Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump deps #582

Merged
merged 1 commit into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.15.1
v20.9.0
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ---------------
# Install Dependencies
# ---------------
FROM node:16.15.1-alpine as deps
FROM node:20.9.0-alpine as deps

WORKDIR /app

Expand Down Expand Up @@ -41,7 +41,7 @@ RUN npm prune --production
# ---------------
# Release App
# ---------------
FROM node:16.15.1-alpine as final
FROM node:20.9.0-alpine as final

WORKDIR /app

Expand Down
11,707 changes: 7,286 additions & 4,421 deletions package-lock.json

Large diffs are not rendered by default.

126 changes: 63 additions & 63 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,30 @@
"prepare": "husky install"
},
"dependencies": {
"@apollo/client": "^3.8.2",
"@apollo/client": "^3.8.7",
"@fullerstack/nax-ipware": "^0.10.0",
"@nestjs/apollo": "^12.0.7",
"@nestjs/common": "^10.2.4",
"@nestjs/config": "^3.0.1",
"@nestjs/core": "^10.2.4",
"@nestjs/graphql": "^12.0.8",
"@nestjs/apollo": "^12.0.9",
"@nestjs/common": "^10.2.8",
"@nestjs/config": "^3.1.1",
"@nestjs/core": "^10.2.8",
"@nestjs/graphql": "^12.0.9",
"@nestjs/jwt": "^10.1.1",
"@nestjs/passport": "^10.0.1",
"@nestjs/platform-express": "^10.2.4",
"@nestjs/platform-socket.io": "^10.2.4",
"@nestjs/schedule": "^3.0.3",
"@nestjs/throttler": "^4.2.1",
"@nestjs/websockets": "^10.2.4",
"@tanstack/react-table": "^8.9.3",
"@nestjs/passport": "^10.0.2",
"@nestjs/platform-express": "^10.2.8",
"@nestjs/platform-socket.io": "^10.2.8",
"@nestjs/schedule": "^4.0.0",
"@nestjs/throttler": "^5.0.1",
"@nestjs/websockets": "^10.2.8",
"@tanstack/react-table": "^8.10.7",
"apollo-server-express": "^3.12.1",
"balanceofsatoshis": "^15.10.0",
"balanceofsatoshis": "^17.3.0",
"bcryptjs": "^2.4.3",
"bech32": "^2.0.0",
"big.js": "^6.2.1",
"bip32": "^4.0.0",
"bip39": "^3.1.0",
"bitcoinjs-lib": "^6.1.3",
"boltz-core": "^0.6.2",
"bitcoinjs-lib": "^6.1.5",
"boltz-core": "^1.0.4",
"cookie": "^0.5.0",
"cross-env": "^7.0.3",
"crypto-js": "^4.1.1",
Expand All @@ -69,15 +69,15 @@
"echarts": "^5.4.3",
"echarts-for-react": "^3.0.2",
"ecpair": "^2.0.1",
"graphql": "^16.8.0",
"graphql": "^16.8.1",
"jest-fetch-mock": "^3.0.3",
"js-cookie": "^3.0.5",
"js-yaml": "^4.1.0",
"jsonwebtoken": "^9.0.2",
"lightning": "^9.13.1",
"lightning": "^10.1.1",
"lodash": "^4.17.21",
"nest-winston": "^1.9.4",
"next": "^13.4.19",
"next": "^14.0.1",
"node-fetch": "^3.3.2",
"numeral": "^2.0.6",
"otplib": "^12.0.1",
Expand All @@ -89,15 +89,15 @@
"react-copy-to-clipboard": "^5.1.0",
"react-dom": "^18.2.0",
"react-feather": "^2.0.10",
"react-grid-layout": "^1.3.4",
"react-grid-layout": "^1.4.2",
"react-is": "^18.2.0",
"react-select": "^5.7.4",
"react-select": "^5.7.7",
"react-slider": "^2.0.6",
"react-spinners": "^0.13.8",
"react-toastify": "^9.1.3",
"react-tooltip": "^5.21.1",
"react-tooltip": "^5.22.0",
"reflect-metadata": "^0.1.13",
"rimraf": "^5.0.1",
"rimraf": "^5.0.5",
"rxjs": "^7.5.6",
"secp256k1": "^5.0.0",
"socket.io-client": "^4.7.2",
Expand All @@ -106,68 +106,68 @@
"styled-react-modal": "^3.0.1",
"styled-theming": "^2.2.0",
"tiny-secp256k1": "^2.2.3",
"uuid": "^9.0.0",
"winston": "^3.10.0"
"uuid": "^9.0.1",
"winston": "^3.11.0"
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.0",
"@graphql-codegen/fragment-matcher": "^5.0.0",
"@graphql-codegen/introspection": "^4.0.0",
"@graphql-codegen/near-operation-file-preset": "^2.5.0",
"@graphql-codegen/near-operation-file-preset": "^3.0.0",
"@graphql-codegen/typescript": "^4.0.1",
"@graphql-codegen/typescript-operations": "^4.0.1",
"@graphql-codegen/typescript-react-apollo": "^3.3.7",
"@graphql-codegen/typescript-react-apollo": "^4.1.0",
"@graphql-codegen/typescript-resolvers": "^4.0.1",
"@nestjs/cli": "^10.1.17",
"@nestjs/schematics": "^10.0.2",
"@types/bcryptjs": "^2.4.3",
"@types/big.js": "^6.2.0",
"@types/cookie": "^0.5.1",
"@nestjs/cli": "^10.2.1",
"@nestjs/schematics": "^10.0.3",
"@types/bcryptjs": "^2.4.5",
"@types/big.js": "^6.2.1",
"@types/cookie": "^0.5.3",
"@types/cron": "^2.4.0",
"@types/crypto-js": "^4.1.1",
"@types/d3-array": "^3.0.7",
"@types/d3-time-format": "^4.0.0",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.4",
"@types/js-cookie": "^3.0.3",
"@types/js-yaml": "^4.0.5",
"@types/jsonwebtoken": "^9.0.2",
"@types/lodash": "^4.14.197",
"@types/crypto-js": "^4.1.3",
"@types/d3-array": "^3.2.0",
"@types/d3-time-format": "^4.0.2",
"@types/express": "^4.17.20",
"@types/jest": "^29.5.7",
"@types/js-cookie": "^3.0.5",
"@types/js-yaml": "^4.0.8",
"@types/jsonwebtoken": "^9.0.4",
"@types/lodash": "^4.14.200",
"@types/node": "^20.5.8",
"@types/numeral": "^2.0.2",
"@types/qrcode.react": "^1.0.3",
"@types/react": "^18.2.21",
"@types/react-copy-to-clipboard": "^5.0.4",
"@types/react-grid-layout": "^1.3.2",
"@types/react-qr-reader": "^2.1.4",
"@types/react-slider": "^1.3.1",
"@types/secp256k1": "^4.0.3",
"@types/styled-components": "^5.1.26",
"@types/styled-react-modal": "^1.2.2",
"@types/styled-theming": "^2.2.5",
"@types/supertest": "^2.0.12",
"@types/uuid": "^9.0.3",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
"@types/numeral": "^2.0.4",
"@types/qrcode.react": "^1.0.4",
"@types/react": "^18.2.35",
"@types/react-copy-to-clipboard": "^5.0.6",
"@types/react-grid-layout": "^1.3.4",
"@types/react-qr-reader": "^2.1.6",
"@types/react-slider": "^1.3.3",
"@types/secp256k1": "^4.0.5",
"@types/styled-components": "^5.1.29",
"@types/styled-react-modal": "^1.2.4",
"@types/styled-theming": "^2.2.7",
"@types/supertest": "^2.0.15",
"@types/uuid": "^9.0.6",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"apollo-server": "^3.12.1",
"babel-plugin-styled-components": "^2.1.4",
"eslint": "^8.48.0",
"eslint-config-next": "^13.4.19",
"eslint": "^8.53.0",
"eslint-config-next": "^14.0.1",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-prettier": "^5.0.1",
"husky": "^8.0.3",
"jest": "^29.6.4",
"lint-staged": "^14.0.1",
"jest": "^29.7.0",
"lint-staged": "^15.0.2",
"prettier": "^3.0.3",
"source-map-support": "^0.5.21",
"standard-version": "^9.5.0",
"supertest": "^6.3.3",
"ts-jest": "^29.1.1",
"ts-loader": "^9.4.4",
"ts-loader": "^9.5.0",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.2.2",
"ws": "^8.13.0"
"ws": "^8.14.2"
},
"jest": {
"moduleFileExtensions": [
Expand Down
4 changes: 2 additions & 2 deletions src/server/modules/api/account/account.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
import { Logger } from 'winston';
import { Inject } from '@nestjs/common';
import { UserId } from '../../security/security.types';
import { Throttle } from '@nestjs/throttler';
import { Throttle, seconds } from '@nestjs/throttler';

@Resolver()
export class AccountResolver {
Expand Down Expand Up @@ -45,7 +45,7 @@ export class AccountResolver {
}

@Public()
@Throttle(4, 10)
@Throttle({ default: { limit: 4, ttl: seconds(10) } })
@Query(() => [ServerAccount])
async getServerAccounts(
@Context() { authToken }: ContextType
Expand Down
6 changes: 3 additions & 3 deletions src/server/modules/api/auth/auth.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { UserId } from '../../security/security.types';
import { authenticator } from 'otplib';
import { shorten } from 'src/server/utils/string';
import { TwofaResult } from './auth.types';
import { Throttle } from '@nestjs/throttler';
import { Throttle, seconds } from '@nestjs/throttler';

@Resolver()
export class AuthResolver {
Expand Down Expand Up @@ -149,7 +149,7 @@ export class AuthResolver {
}

@Public()
@Throttle(4, 10)
@Throttle({ default: { limit: 4, ttl: seconds(10) } })
@Mutation(() => Boolean)
async getAuthToken(
@Args('cookie', { nullable: true }) cookie: string,
Expand Down Expand Up @@ -225,7 +225,7 @@ export class AuthResolver {
}

@Public()
@Throttle(4, 10)
@Throttle({ default: { limit: 4, ttl: seconds(10) } })
@Mutation(() => String)
async getSessionToken(
@Args('id') id: string,
Expand Down
11 changes: 8 additions & 3 deletions src/server/modules/security/guards/throttler.guard.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
import { ExecutionContext, Injectable } from '@nestjs/common';
import { GqlExecutionContext } from '@nestjs/graphql';
import { ThrottlerException, ThrottlerGuard } from '@nestjs/throttler';
import {
ThrottlerException,
ThrottlerGuard,
ThrottlerOptions,
} from '@nestjs/throttler';
import { getIp } from 'src/server/utils/request';

@Injectable()
export class GqlThrottlerGuard extends ThrottlerGuard {
async handleRequest(
context: ExecutionContext,
limit: number,
ttl: number
ttl: number,
throttler: ThrottlerOptions
): Promise<boolean> {
const gqlCtx = GqlExecutionContext.create(context);
const { req, connection } = gqlCtx.getContext();

const request = connection?.context?.req ? connection.context.req : req;
const ip = getIp(request);
const key = this.generateKey(context, ip);
const key = this.generateKey(context, ip, throttler.name);
const { totalHits } = await this.storageService.increment(key, ttl);

if (totalHits >= limit) {
Expand Down
10 changes: 6 additions & 4 deletions src/server/modules/security/security.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ import { ThrottlerModule } from '@nestjs/throttler';
PassportModule.register({ defaultStrategy: 'jwt', session: true }),
ThrottlerModule.forRootAsync({
inject: [ConfigService],
useFactory: (config: ConfigService) => ({
ttl: config.get('throttler.ttl'),
limit: config.get('throttler.limit'),
}),
useFactory: (config: ConfigService) => [
{
ttl: config.get('throttler.ttl'),
limit: config.get('throttler.limit') * 1000,
},
],
}),
],

Expand Down
Loading