chore: update package dependencies and improve pub/sub iterator usage

- Updated various package dependencies in package-lock.json and package.json for enhanced stability and performance.
- Changed pub/sub iterator methods from `asyncIterator` to `asyncIterableIterator` in multiple schema files for better compatibility with the latest GraphQL subscriptions.
- Added `moduleResolution` option in tsconfig.json to support Node.js-style module resolution.
This commit is contained in:
2024-12-08 20:38:09 +07:00
parent 16f6f8a629
commit 9e6d62e4be
8 changed files with 266 additions and 1218 deletions

1381
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -30,26 +30,26 @@
"codegen": "graphql-codegen --config codegen.ts" "codegen": "graphql-codegen --config codegen.ts"
}, },
"dependencies": { "dependencies": {
"@apollo/server": "^4.11.0", "@apollo/server": "^4.11.2",
"@clerk/express": "^1.2.2", "@clerk/express": "^1.3.23",
"@graphql-codegen/introspection": "^4.0.3", "@graphql-codegen/introspection": "^4.0.3",
"@graphql-codegen/typescript": "^4.0.9", "@graphql-codegen/typescript": "^4.0.9",
"@graphql-codegen/typescript-operations": "^4.2.3", "@graphql-codegen/typescript-operations": "^4.4.0",
"@graphql-codegen/typescript-resolvers": "^4.2.1", "@graphql-codegen/typescript-resolvers": "^4.2.1",
"@livekit/rtc-node": "^0.11.0", "@livekit/rtc-node": "^0.12.1",
"@nestjs-modules/mailer": "^2.0.2", "@nestjs-modules/mailer": "^1.6.1",
"@nestjs/apollo": "^12.2.0", "@nestjs/apollo": "^12.2.2",
"@nestjs/axios": "^3.1.1", "@nestjs/axios": "^3.1.3",
"@nestjs/common": "^10.0.0", "@nestjs/common": "^10.4.13",
"@nestjs/config": "^3.2.3", "@nestjs/config": "^3.3.0",
"@nestjs/core": "^10.0.0", "@nestjs/core": "^10.4.13",
"@nestjs/devtools-integration": "^0.1.6", "@nestjs/devtools-integration": "^0.1.6",
"@nestjs/event-emitter": "^2.1.1", "@nestjs/event-emitter": "^2.1.1",
"@nestjs/graphql": "^12.2.0", "@nestjs/graphql": "^12.2.2",
"@nestjs/jwt": "^10.2.0", "@nestjs/jwt": "^10.2.0",
"@nestjs/platform-express": "^10.0.0", "@nestjs/platform-express": "^10.4.13",
"@nestjs/schedule": "^4.1.1", "@nestjs/schedule": "^4.1.1",
"@nestjs/swagger": "^7.4.2", "@nestjs/swagger": "^8.1.0",
"@payos/node": "^1.0.10", "@payos/node": "^1.0.10",
"@pothos/core": "4.3.0", "@pothos/core": "4.3.0",
"@pothos/plugin-add-graphql": "4.2.1", "@pothos/plugin-add-graphql": "4.2.1",
@@ -73,22 +73,22 @@
"epess-web-backend": "file:", "epess-web-backend": "file:",
"graphql": "16.9.0", "graphql": "16.9.0",
"graphql-redis-subscriptions": "^2.6.1", "graphql-redis-subscriptions": "^2.6.1",
"graphql-scalars": "^1.23.0", "graphql-scalars": "^1.24.0",
"graphql-subscriptions": "^2.0.0", "graphql-subscriptions": "^3.0.0",
"graphql-tools": "9.0.6", "graphql-tools": "9.0.6",
"graphql-upload": "17.0.0", "graphql-upload": "17.0.0",
"graphql-ws": "^5.16.0", "graphql-ws": "^5.16.0",
"ioredis": "^5.4.1", "ioredis": "^5.4.1",
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
"livekit-server-sdk": "2.9.2", "livekit-server-sdk": "2.9.3",
"luxon": "^3.5.0", "luxon": "^3.5.0",
"minio": "8.0.2", "minio": "8.0.2",
"nestjs-minio": "2.6.2", "nestjs-minio": "2.6.2",
"nodemailer": "^6.9.15", "nodemailer": "^6.9.16",
"openai": "^4.73.1", "openai": "^4.76.0",
"passport-jwt": "^4.0.1", "passport-jwt": "^4.0.1",
"quill": "^2.0.2", "quill": "^2.0.3",
"reflect-metadata": "^0.2.0", "reflect-metadata": "^0.2.2",
"rxjs": "^7.8.1", "rxjs": "^7.8.1",
"swagger-ui-express": "^5.0.1", "swagger-ui-express": "^5.0.1",
"tsimportlib": "^0.0.5", "tsimportlib": "^0.0.5",
@@ -98,40 +98,40 @@
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^1.9.4", "@biomejs/biome": "^1.9.4",
"@clerk/types": "^4.23.0", "@clerk/types": "^4.39.0",
"@faker-js/faker": "^9.0.3", "@faker-js/faker": "^9.3.0",
"@graphql-codegen/cli": "^5.0.2", "@graphql-codegen/cli": "^5.0.3",
"@graphql-codegen/client-preset": "^4.4.0", "@graphql-codegen/client-preset": "^4.5.1",
"@graphql-codegen/typescript": "4.0.9", "@graphql-codegen/typescript": "4.1.2",
"@graphql-codegen/typescript-resolvers": "4.2.1", "@graphql-codegen/typescript-resolvers": "4.4.1",
"@nestjs/cli": "^10.4.8", "@nestjs/cli": "^10.4.8",
"@nestjs/schematics": "^10.2.3", "@nestjs/schematics": "^10.2.3",
"@nestjs/testing": "^10.4.12", "@nestjs/testing": "^10.4.13",
"@swc/cli": "^0.5.1", "@swc/cli": "^0.5.2",
"@swc/core": "^1.9.3", "@swc/core": "^1.10.0",
"@types/bcryptjs": "^2.4.6", "@types/bcryptjs": "^2.4.6",
"@types/express": "^4.17.17", "@types/express": "^5.0.0",
"@types/graphql-upload": "^17.0.0", "@types/graphql-upload": "^17.0.0",
"@types/jest": "^29.5.2", "@types/jest": "^29.5.14",
"@types/lodash": "^4.17.13", "@types/lodash": "^4.17.13",
"@types/luxon": "^3.4.2", "@types/luxon": "^3.4.2",
"@types/node": "^20.3.1", "@types/node": "^22.10.1",
"@types/nodemailer": "^6.4.16", "@types/nodemailer": "^6.4.17",
"@types/passport-jwt": "^4.0.1", "@types/passport-jwt": "^4.0.1",
"@types/supertest": "^6.0.0", "@types/supertest": "^6.0.2",
"@types/uuid": "^10.0.0", "@types/uuid": "^10.0.0",
"@types/ws": "^8.5.12", "@types/ws": "^8.5.13",
"globals": "^15.10.0", "globals": "^15.13.0",
"jest": "^29.5.0", "jest": "^29.7.0",
"prettier": "^3.0.0", "prettier": "^3.4.2",
"prisma": "^6.0.1", "prisma": "^6.0.1",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"supertest": "^7.0.0", "supertest": "^7.0.0",
"ts-jest": "^29.1.0", "ts-jest": "^29.2.5",
"ts-loader": "^9.4.3", "ts-loader": "^9.5.1",
"ts-node": "^10.9.1", "ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0", "tsconfig-paths": "^4.2.0",
"typescript": "^5.6.3", "typescript": "^5.7.2",
"ws": "^8.18.0" "ws": "^8.18.0"
}, },
"optionalDependencies": { "optionalDependencies": {

View File

@@ -283,9 +283,9 @@ export class CollaborationSessionSchema extends PothosSchema {
}, },
}) })
if (!collaborationSession) throw new Error('Collaboration session not found') if (!collaborationSession) throw new Error('Collaboration session not found')
return ctx.websocket.pubSub.asyncIterator( return ctx.websocket.pubSub.asyncIterableIterator(
`collaborationSessionUpdated:${collaborationSession.id}`, `collaborationSessionUpdated:${collaborationSession.id}`,
) as unknown as AsyncIterable<CollaborationSession> )
}, },
resolve: async (payload: CollaborationSession) => payload, resolve: async (payload: CollaborationSession) => payload,
}), }),

View File

@@ -406,7 +406,7 @@ export class DocumentSchema extends PothosSchema {
) )
throw new Error('User is not owner or collaborator of document') throw new Error('User is not owner or collaborator of document')
} }
return pubSub.asyncIterator([ return pubSub.asyncIterableIterator([
`${DocumentEvent.CHANGED}.${documentId}`, `${DocumentEvent.CHANGED}.${documentId}`,
`${DocumentEvent.DELETED}.${documentId}`, `${DocumentEvent.DELETED}.${documentId}`,
`${DocumentEvent.SAVED}.${documentId}`, `${DocumentEvent.SAVED}.${documentId}`,

View File

@@ -101,8 +101,8 @@ export class Builder extends SchemaBuilder<SchemaBuilderOption> {
debounceDelay: 1000, debounceDelay: 1000,
...subscribeOptionsFromIterator((name, context) => { ...subscribeOptionsFromIterator((name, context) => {
return context.isSubscription return context.isSubscription
? context.websocket.pubSub.asyncIterator(name) ? context.websocket.pubSub.asyncIterableIterator(name)
: context.http.pubSub.asyncIterator(name) : context.http.pubSub.asyncIterableIterator(name)
}), }),
}, },
zod: { zod: {

View File

@@ -215,9 +215,9 @@ export class MessageSchema extends PothosSchema {
const { const {
websocket: { pubSub }, websocket: { pubSub },
} = ctx } = ctx
return pubSub.asyncIterator([ return pubSub.asyncIterableIterator([
`${PubSubEvent.MESSAGE_SENT}.${args.chatRoomId}`, `${PubSubEvent.MESSAGE_SENT}.${args.chatRoomId}`,
]) as unknown as AsyncIterable<Message> ])
}, },
resolve: (payload: Message) => payload, resolve: (payload: Message) => payload,
}), }),

View File

@@ -544,10 +544,10 @@ export class UserSchema extends PothosSchema {
const { const {
websocket: { pubSub }, websocket: { pubSub },
} = ctx } = ctx
return pubSub.asyncIterator([ return pubSub.asyncIterableIterator([
`${PubSubEvent.NEW_MESSAGE}.${ctx.websocket.me?.id}`, `${PubSubEvent.NEW_MESSAGE}.${ctx.websocket.me?.id}`,
`${PubSubEvent.NOTIFICATION}.${ctx.websocket.me?.id}`, `${PubSubEvent.NOTIFICATION}.${ctx.websocket.me?.id}`,
]) as unknown as AsyncIterable<Message> ])
}, },
resolve: async (payload: Message) => payload, resolve: async (payload: Message) => payload,
}), }),

View File

@@ -21,5 +21,6 @@
"allowJs": true, "allowJs": true,
"maxNodeModuleJsDepth": 10, "maxNodeModuleJsDepth": 10,
"resolveJsonModule": true, "resolveJsonModule": true,
"moduleResolution": "nodenext",
} }
} }