diff --git a/.changeset/@graphql-yoga_apollo-link-3660-dependencies.md b/.changeset/@graphql-yoga_apollo-link-3660-dependencies.md new file mode 100644 index 0000000000..db4dfb4a56 --- /dev/null +++ b/.changeset/@graphql-yoga_apollo-link-3660-dependencies.md @@ -0,0 +1,5 @@ +--- +"@graphql-yoga/apollo-link": patch +--- +dependencies updates: + - Updated dependency [`tslib@^2.8.1` ↗︎](https://www.npmjs.com/package/tslib/v/2.8.1) (from `^2.5.2`, in `dependencies`) diff --git a/.changeset/@graphql-yoga_logger-3660-dependencies.md b/.changeset/@graphql-yoga_logger-3660-dependencies.md new file mode 100644 index 0000000000..accdb64f70 --- /dev/null +++ b/.changeset/@graphql-yoga_logger-3660-dependencies.md @@ -0,0 +1,5 @@ +--- +"@graphql-yoga/logger": patch +--- +dependencies updates: + - Updated dependency [`tslib@^2.8.1` ↗︎](https://www.npmjs.com/package/tslib/v/2.8.1) (from `^2.5.2`, in `dependencies`) diff --git a/.changeset/@graphql-yoga_plugin-apollo-inline-trace-3660-dependencies.md b/.changeset/@graphql-yoga_plugin-apollo-inline-trace-3660-dependencies.md new file mode 100644 index 0000000000..a6511aefa0 --- /dev/null +++ b/.changeset/@graphql-yoga_plugin-apollo-inline-trace-3660-dependencies.md @@ -0,0 +1,5 @@ +--- +"@graphql-yoga/plugin-apollo-inline-trace": patch +--- +dependencies updates: + - Updated dependency [`tslib@^2.8.1` ↗︎](https://www.npmjs.com/package/tslib/v/2.8.1) (from `^2.5.2`, in `dependencies`) diff --git a/.changeset/@graphql-yoga_plugin-apollo-usage-report-3660-dependencies.md b/.changeset/@graphql-yoga_plugin-apollo-usage-report-3660-dependencies.md new file mode 100644 index 0000000000..738965322c --- /dev/null +++ b/.changeset/@graphql-yoga_plugin-apollo-usage-report-3660-dependencies.md @@ -0,0 +1,5 @@ +--- +"@graphql-yoga/plugin-apollo-usage-report": patch +--- +dependencies updates: + - Updated dependency [`tslib@^2.8.1` ↗︎](https://www.npmjs.com/package/tslib/v/2.8.1) (from `^2.5.2`, in `dependencies`) diff --git a/.changeset/@graphql-yoga_subscription-3660-dependencies.md b/.changeset/@graphql-yoga_subscription-3660-dependencies.md new file mode 100644 index 0000000000..d8e5b83dfb --- /dev/null +++ b/.changeset/@graphql-yoga_subscription-3660-dependencies.md @@ -0,0 +1,5 @@ +--- +"@graphql-yoga/subscription": patch +--- +dependencies updates: + - Updated dependency [`tslib@^2.8.1` ↗︎](https://www.npmjs.com/package/tslib/v/2.8.1) (from `^2.5.2`, in `dependencies`) diff --git a/.changeset/@graphql-yoga_typed-event-target-3660-dependencies.md b/.changeset/@graphql-yoga_typed-event-target-3660-dependencies.md new file mode 100644 index 0000000000..98420a450c --- /dev/null +++ b/.changeset/@graphql-yoga_typed-event-target-3660-dependencies.md @@ -0,0 +1,5 @@ +--- +"@graphql-yoga/typed-event-target": patch +--- +dependencies updates: + - Updated dependency [`tslib@^2.8.1` ↗︎](https://www.npmjs.com/package/tslib/v/2.8.1) (from `^2.5.2`, in `dependencies`) diff --git a/.changeset/@graphql-yoga_urql-exchange-3660-dependencies.md b/.changeset/@graphql-yoga_urql-exchange-3660-dependencies.md new file mode 100644 index 0000000000..8885e1479c --- /dev/null +++ b/.changeset/@graphql-yoga_urql-exchange-3660-dependencies.md @@ -0,0 +1,5 @@ +--- +"@graphql-yoga/urql-exchange": patch +--- +dependencies updates: + - Updated dependency [`tslib@^2.8.1` ↗︎](https://www.npmjs.com/package/tslib/v/2.8.1) (from `^2.5.2`, in `dependencies`) diff --git a/examples/bun-yoga-ws/package.json b/examples/bun-yoga-ws/package.json index ed0b8809bc..692b2df9da 100644 --- a/examples/bun-yoga-ws/package.json +++ b/examples/bun-yoga-ws/package.json @@ -10,7 +10,7 @@ "bun": "^1.1.42", "bun-types": "^1.0.0", "graphql": "16.10.0", - "graphql-ws": "^5.14.1", + "graphql-ws": "^6.0.0", "graphql-yoga": "^5.3.1" }, "devDependencies": { diff --git a/examples/bun-yoga-ws/src/index.ts b/examples/bun-yoga-ws/src/index.ts index c5affcc179..5475244b4b 100644 --- a/examples/bun-yoga-ws/src/index.ts +++ b/examples/bun-yoga-ws/src/index.ts @@ -1,6 +1,6 @@ import { setTimeout as setTimeout$ } from 'node:timers/promises'; import Bun from 'bun'; -import { makeHandler } from 'graphql-ws/lib/use/bun'; +import { makeHandler } from 'graphql-ws/use/bun'; import { createSchema, createYoga } from 'graphql-yoga'; const schema = createSchema({ @@ -46,19 +46,19 @@ export const websocketHandler = makeHandler({ schema, execute: args => args.rootValue.execute(args), subscribe: args => args.rootValue.subscribe(args), - onSubscribe: async (ctx, msg) => { + onSubscribe: async (ctx, _id, params) => { const { schema, execute, subscribe, contextFactory, parse, validate } = yoga.getEnveloped({ ...ctx, req: ctx.extra.request, socket: ctx.extra.socket, - params: msg.payload, + params, }); const args = { schema, - operationName: msg.payload.operationName, - document: parse(msg.payload.query), - variableValues: msg.payload.variables, + operationName: params.operationName, + document: parse(params.query), + variableValues: params.variables, contextValue: await contextFactory(), rootValue: { execute, diff --git a/examples/graphql-ws/__integration-tests__/graphql-ws.spec.ts b/examples/graphql-ws/__integration-tests__/graphql-ws.spec.ts index e9bf676ad7..7ad0d5fb96 100644 --- a/examples/graphql-ws/__integration-tests__/graphql-ws.spec.ts +++ b/examples/graphql-ws/__integration-tests__/graphql-ws.spec.ts @@ -1,7 +1,7 @@ import { createServer } from 'node:http'; import { AddressInfo } from 'node:net'; import { createClient } from 'graphql-ws'; -import { useServer } from 'graphql-ws/lib/use/ws'; +import { useServer } from 'graphql-ws/use/ws'; import { createSchema, createYoga } from 'graphql-yoga'; import WebSocket from 'ws'; import { buildApp } from '../src/app.js'; @@ -122,15 +122,15 @@ describe('graphql-ws example integration', () => { execute: (args: any) => args.execute(args), // eslint-disable-next-line @typescript-eslint/no-explicit-any subscribe: (args: any) => args.subscribe(args), - onSubscribe: async (_ctx, msg) => { + onSubscribe: async (_ctx, _id, params) => { const { schema, execute, subscribe, contextFactory, parse, validate } = yoga.getEnveloped(); // <- malformed/missing context const args = { schema, - operationName: msg.payload.operationName, - document: parse(msg.payload.query), - variableValues: msg.payload.variables, + operationName: params.operationName, + document: parse(params.query), + variableValues: params.variables, contextValue: await contextFactory(), execute, subscribe, diff --git a/examples/graphql-ws/package.json b/examples/graphql-ws/package.json index 6898f14759..b51f83c58f 100644 --- a/examples/graphql-ws/package.json +++ b/examples/graphql-ws/package.json @@ -9,7 +9,7 @@ }, "dependencies": { "graphql": "16.10.0", - "graphql-ws": "5.16.2", + "graphql-ws": "6.0.0", "graphql-yoga": "workspace:*", "ws": "8.18.0" }, diff --git a/examples/graphql-ws/src/app.ts b/examples/graphql-ws/src/app.ts index dd5b499ab7..0658232d6c 100644 --- a/examples/graphql-ws/src/app.ts +++ b/examples/graphql-ws/src/app.ts @@ -1,6 +1,6 @@ import { createServer } from 'node:http'; import { Socket } from 'node:net'; -import { useServer } from 'graphql-ws/lib/use/ws'; +import { useServer } from 'graphql-ws/use/ws'; import { createSchema, createYoga } from 'graphql-yoga'; import { WebSocketServer } from 'ws'; @@ -57,19 +57,19 @@ export function buildApp() { execute: (args: any) => args.execute(args), // eslint-disable-next-line @typescript-eslint/no-explicit-any subscribe: (args: any) => args.subscribe(args), - onSubscribe: async (ctx, msg) => { + onSubscribe: async (ctx, _id, params) => { const { schema, execute, subscribe, contextFactory, parse, validate } = yoga.getEnveloped({ ...ctx, req: ctx.extra.request, socket: ctx.extra.socket, - params: msg.payload, + params, }); const args = { schema, - operationName: msg.payload.operationName, - document: parse(msg.payload.query), - variableValues: msg.payload.variables, + operationName: params.operationName, + document: parse(params.query), + variableValues: params.variables, contextValue: await contextFactory(), execute, subscribe, diff --git a/examples/graphql-ws/tsconfig.json b/examples/graphql-ws/tsconfig.json index 023e96714a..40e963a760 100644 --- a/examples/graphql-ws/tsconfig.json +++ b/examples/graphql-ws/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { "target": "esnext", - "moduleResolution": "node", - "module": "commonjs", + "moduleResolution": "bundler", + "module": "esnext", "sourceMap": true, "lib": ["esnext", "DOM", "DOM.Iterable"], "allowSyntheticDefaultImports": true, diff --git a/examples/nextjs-ws/__integration-tests__/nextjs-ws.spec.ts b/examples/nextjs-ws/__integration-tests__/nextjs-ws.spec.ts index 335bc2051f..f9605a713f 100644 --- a/examples/nextjs-ws/__integration-tests__/nextjs-ws.spec.ts +++ b/examples/nextjs-ws/__integration-tests__/nextjs-ws.spec.ts @@ -1,13 +1,13 @@ // import to start import { createClient } from 'graphql-ws'; import WebSocket from 'ws'; -import { start } from '../server.js'; +import server from '../server.js'; let stop = () => { // noop }; beforeAll(async () => { - stop = await start(53_000); + stop = await server.start(53_000); }); afterAll(() => stop()); diff --git a/examples/nextjs-ws/package.json b/examples/nextjs-ws/package.json index 28f8207785..d1be8e2149 100644 --- a/examples/nextjs-ws/package.json +++ b/examples/nextjs-ws/package.json @@ -10,7 +10,7 @@ "dependencies": { "@types/react": "19.0.7", "graphql": "16.10.0", - "graphql-ws": "^5.11.3", + "graphql-ws": "^6.0.0", "graphql-yoga": "workspace:*", "next": "15.1.4", "react": "19.0.0", diff --git a/examples/nextjs-ws/server.js b/examples/nextjs-ws/server.js index b6c787903c..549f24a9f5 100644 --- a/examples/nextjs-ws/server.js +++ b/examples/nextjs-ws/server.js @@ -1,12 +1,12 @@ /* eslint-disable @typescript-eslint/no-var-requires */ /* eslint-env node */ -const { createServer } = require('node:http'); -const { WebSocketServer } = require('ws'); -const { createYoga, createSchema } = require('graphql-yoga'); -const { useServer } = require('graphql-ws/lib/use/ws'); -const { parse } = require('node:url'); -const next = require('next'); -const { setTimeout: setTimeout$ } = require('node:timers/promises'); +import { createServer } from 'node:http'; +import { setTimeout as setTimeout$ } from 'node:timers/promises'; +import { parse } from 'node:url'; +import next from 'next'; +import { useServer } from 'graphql-ws/use/ws'; +import { createSchema, createYoga } from 'graphql-yoga'; +import { WebSocketServer } from 'ws'; const dev = process.env.NODE_ENV !== 'production'; const hostname = 'localhost'; @@ -106,20 +106,20 @@ async function start(port, handle) { execute: args => args.rootValue.execute(args), /** @param {EnvelopedExecutionArgs} args */ subscribe: args => args.rootValue.subscribe(args), - onSubscribe: async (ctx, msg) => { + onSubscribe: async (ctx, _id, params) => { const { schema, execute, subscribe, contextFactory, parse, validate } = yoga.getEnveloped({ ...ctx, req: ctx.extra.request, socket: ctx.extra.socket, - params: msg.payload, + params, }); /** @type EnvelopedExecutionArgs */ const args = { schema, - operationName: msg.payload.operationName, - document: parse(msg.payload.query), - variableValues: msg.payload.variables, + operationName: params.operationName, + document: parse(params.query), + variableValues: params.variables, contextValue: await contextFactory(), rootValue: { execute, @@ -156,4 +156,4 @@ if (process.env.NODE_ENV !== 'test') { })(); } -module.exports = { start }; +export default { start }; diff --git a/examples/nextjs-ws/tsconfig.json b/examples/nextjs-ws/tsconfig.json index 94d19d63b6..1aa4a656c3 100644 --- a/examples/nextjs-ws/tsconfig.json +++ b/examples/nextjs-ws/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { - "target": "es5", + "target": "esnext", "module": "esnext", - "moduleResolution": "node", + "moduleResolution": "bundler", "checkJs": true, "skipLibCheck": true, "strict": false, diff --git a/examples/sveltekit/__integration-tests__/sveltekit.spec.ts b/examples/sveltekit/__integration-tests__/sveltekit.spec.ts index 3774df9718..508d47e586 100644 --- a/examples/sveltekit/__integration-tests__/sveltekit.spec.ts +++ b/examples/sveltekit/__integration-tests__/sveltekit.spec.ts @@ -1,7 +1,5 @@ import { execSync, spawn } from 'node:child_process'; -import { Browser, chromium, ElementHandle, Page } from 'playwright'; -import { promises as fsPromises } from 'node:fs'; -import { join } from 'node:path'; +import { Browser, chromium, Page } from 'playwright'; import { setTimeout as setTimeout$ } from 'node:timers/promises'; import { fetch } from '@whatwg-node/fetch'; @@ -20,23 +18,6 @@ const timings = { describe('SvelteKit integration', () => { beforeAll(async () => { - const tslibDirPath = join(__dirname, '../node_modules/tslib'); - const tslibFilePath = join(tslibDirPath, 'tslib.js'); - const tslibFile = await fsPromises.readFile(tslibFilePath, 'utf8'); - const tslibPackageJsonPath = join(tslibDirPath, 'package.json'); - const tslibPackageJson = await fsPromises.readFile(tslibPackageJsonPath, 'utf8'); - const tslibPackageJsonParsed = JSON.parse(tslibPackageJson); - tslibPackageJsonParsed.type = 'module'; - tslibPackageJsonParsed.main = 'tslib.cjs'; - if (tslibPackageJsonParsed.exports?.['.']?.default) { - tslibPackageJsonParsed.exports['.'].default = './tslib.cjs'; - } - await fsPromises.writeFile( - tslibPackageJsonPath, - JSON.stringify(tslibPackageJsonParsed, null, 2) - ); - await fsPromises.writeFile(tslibFilePath.replace('.js', '.cjs'), tslibFile); - // Kill the port if it's used! try { execSync('fuser -k 3007/tcp'); diff --git a/examples/uwebsockets/package.json b/examples/uwebsockets/package.json index 7f7376a4ab..4c914d14dd 100644 --- a/examples/uwebsockets/package.json +++ b/examples/uwebsockets/package.json @@ -9,7 +9,7 @@ "dependencies": { "@types/node": "^22.0.0", "graphql": "16.10.0", - "graphql-ws": "^5.11.3", + "graphql-ws": "^6.0.0", "graphql-yoga": "workspace:*", "ts-node-dev": "^2.0.0", "typescript": "^5.0.0", diff --git a/examples/uwebsockets/src/app.ts b/examples/uwebsockets/src/app.ts index e027b0c9a7..e345ab22f3 100644 --- a/examples/uwebsockets/src/app.ts +++ b/examples/uwebsockets/src/app.ts @@ -1,5 +1,5 @@ import { execute, ExecutionArgs, subscribe } from 'graphql'; -import { makeBehavior } from 'graphql-ws/lib/use/uWebSockets'; +import { makeBehavior } from 'graphql-ws/use/uWebSockets'; import { createSchema, createYoga, Repeater } from 'graphql-yoga'; import { App, HttpRequest, HttpResponse } from 'uWebSockets.js'; @@ -55,14 +55,14 @@ type EnvelopedExecutionArgs = ExecutionArgs & { const wsHandler = makeBehavior({ execute: args => (args as EnvelopedExecutionArgs).rootValue.execute(args), subscribe: args => (args as EnvelopedExecutionArgs).rootValue.subscribe(args), - onSubscribe: async (ctx, msg) => { + onSubscribe: async (ctx, _id, params) => { const { schema, execute, subscribe, contextFactory, parse, validate } = yoga.getEnveloped(ctx); const args: EnvelopedExecutionArgs = { schema, - operationName: msg.payload.operationName, - document: parse(msg.payload.query), - variableValues: msg.payload.variables, + operationName: params.operationName, + document: parse(params.query), + variableValues: params.variables, contextValue: await contextFactory(), rootValue: { execute, diff --git a/packages/client/apollo-link/package.json b/packages/client/apollo-link/package.json index 20966bc981..78136dba95 100644 --- a/packages/client/apollo-link/package.json +++ b/packages/client/apollo-link/package.json @@ -49,7 +49,7 @@ "dependencies": { "@graphql-tools/executor-apollo-link": "^1.0.5", "@graphql-tools/executor-http": "^1.1.10", - "tslib": "^2.5.2" + "tslib": "^2.8.1" }, "devDependencies": { "@apollo/client": "3.12.6", diff --git a/packages/client/urql-exchange/package.json b/packages/client/urql-exchange/package.json index f31d7af06e..78a8e8e1ea 100644 --- a/packages/client/urql-exchange/package.json +++ b/packages/client/urql-exchange/package.json @@ -50,7 +50,7 @@ "dependencies": { "@graphql-tools/executor-http": "^1.1.9", "@graphql-tools/executor-urql-exchange": "^1.0.4", - "tslib": "^2.5.2" + "tslib": "^2.8.1" }, "devDependencies": { "@urql/core": "5.1.0", diff --git a/packages/event-target/typed-event-target/package.json b/packages/event-target/typed-event-target/package.json index b2cf27b5b9..ebb21c522f 100644 --- a/packages/event-target/typed-event-target/package.json +++ b/packages/event-target/typed-event-target/package.json @@ -45,7 +45,7 @@ }, "dependencies": { "@repeaterjs/repeater": "^3.0.4", - "tslib": "^2.5.2" + "tslib": "^2.8.1" }, "publishConfig": { "directory": "dist", diff --git a/packages/graphql-yoga/__tests__/request-cancellation.spec.ts b/packages/graphql-yoga/__tests__/request-cancellation.spec.ts index 94a0c5300b..21177b2e6c 100644 --- a/packages/graphql-yoga/__tests__/request-cancellation.spec.ts +++ b/packages/graphql-yoga/__tests__/request-cancellation.spec.ts @@ -4,16 +4,15 @@ import { createDeferredPromise, fakePromise } from '@whatwg-node/server'; import { createLogger, createSchema, createYoga, FetchAPI } from '../src/index'; import { useExecutionCancellation } from '../src/plugins/use-execution-cancellation'; -const variants: Array<[name: string, fetchAPI: undefined | FetchAPI]> = [['Ponyfill', undefined]]; - -if (!process.env['LEAK_TESTS']) { - variants.push([ +const variants: Array<[name: string, fetchAPI: undefined | FetchAPI]> = [ + ['Ponyfill', undefined], + [ 'Native', // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - URLPattern is not available in types globalThis, - ]); -} + ], +]; function waitAFewMillisecondsToMakeSureGraphQLExecutionIsNotResumingInBackground() { return setTimeout$(5); diff --git a/packages/logger/package.json b/packages/logger/package.json index 131b287564..76ff2fb3b4 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -53,7 +53,7 @@ "check": "tsc --pretty --noEmit" }, "dependencies": { - "tslib": "^2.5.2" + "tslib": "^2.8.1" }, "publishConfig": { "directory": "dist", diff --git a/packages/nestjs-federation/package.json b/packages/nestjs-federation/package.json index d78ff6f0b5..efc38bebf2 100644 --- a/packages/nestjs-federation/package.json +++ b/packages/nestjs-federation/package.json @@ -65,7 +65,7 @@ "@nestjs/core": "^10.0.0", "@nestjs/graphql": "^12.0.0", "graphql": "16.10.0", - "tslib": "^2.5.2" + "tslib": "^2.8.1" }, "publishConfig": { "access": "public" diff --git a/packages/nestjs/package.json b/packages/nestjs/package.json index 5e0a83eed3..b37bbc3be8 100644 --- a/packages/nestjs/package.json +++ b/packages/nestjs/package.json @@ -68,13 +68,13 @@ "glob": "^11.0.0", "graphql": "16.10.0", "graphql-http": "^1.18.0", - "graphql-ws": "^5.11.3", + "graphql-ws": "^6.0.0", "graphql-yoga": "workspace:^", "prettier": "^3.0.0", "reflect-metadata": "^0.2.0", "rxjs": "^7.8.0", "subscriptions-transport-ws": "^0.11.0", - "tslib": "^2.5.2", + "tslib": "^2.8.1", "ws": "^8.12.1" }, "publishConfig": { diff --git a/packages/plugins/apollo-inline-trace/package.json b/packages/plugins/apollo-inline-trace/package.json index c24a4bde47..f34d97be8f 100644 --- a/packages/plugins/apollo-inline-trace/package.json +++ b/packages/plugins/apollo-inline-trace/package.json @@ -45,7 +45,7 @@ "dependencies": { "@apollo/usage-reporting-protobuf": "^4.1.1", "@envelop/on-resolve": "^4.1.1", - "tslib": "^2.5.2" + "tslib": "^2.8.1" }, "devDependencies": { "@apollo/gateway": "^2.9.3", diff --git a/packages/plugins/apollo-usage-report/package.json b/packages/plugins/apollo-usage-report/package.json index 6507607648..8d9ab46511 100644 --- a/packages/plugins/apollo-usage-report/package.json +++ b/packages/plugins/apollo-usage-report/package.json @@ -43,7 +43,7 @@ "dependencies": { "@apollo/usage-reporting-protobuf": "^4.1.1", "@graphql-yoga/plugin-apollo-inline-trace": "workspace:^", - "tslib": "^2.5.2" + "tslib": "^2.8.1" }, "devDependencies": { "@envelop/on-resolve": "^4.0.0", diff --git a/packages/plugins/csrf-prevention/package.json b/packages/plugins/csrf-prevention/package.json index 7f297d40be..7fdc94f158 100644 --- a/packages/plugins/csrf-prevention/package.json +++ b/packages/plugins/csrf-prevention/package.json @@ -41,7 +41,7 @@ }, "devDependencies": { "graphql-yoga": "workspace:*", - "tslib": "^2.5.2" + "tslib": "^2.8.1" }, "publishConfig": { "directory": "dist", diff --git a/packages/plugins/defer-stream/package.json b/packages/plugins/defer-stream/package.json index 7479921be0..8c8d727bc4 100644 --- a/packages/plugins/defer-stream/package.json +++ b/packages/plugins/defer-stream/package.json @@ -50,7 +50,7 @@ "fetch-multipart-graphql": "3.2.1", "graphql": "16.10.0", "graphql-yoga": "workspace:*", - "tslib": "^2.5.2" + "tslib": "^2.8.1" }, "publishConfig": { "directory": "dist", diff --git a/packages/plugins/graphql-sse/package.json b/packages/plugins/graphql-sse/package.json index df6ddfccb5..e8200b512e 100644 --- a/packages/plugins/graphql-sse/package.json +++ b/packages/plugins/graphql-sse/package.json @@ -45,7 +45,7 @@ }, "devDependencies": { "graphql-yoga": "workspace:*", - "tslib": "^2.5.2" + "tslib": "^2.8.1" }, "publishConfig": { "directory": "dist", diff --git a/packages/plugins/jwt/package.json b/packages/plugins/jwt/package.json index d25a6f67c8..a05571f2ce 100644 --- a/packages/plugins/jwt/package.json +++ b/packages/plugins/jwt/package.json @@ -51,7 +51,7 @@ "@types/ws": "^8.5.13", "graphql": "16.10.0", "graphql-scalars": "^1.22.2", - "graphql-ws": "5.16.2", + "graphql-ws": "6.0.0", "graphql-yoga": "workspace:*", "ws": "^8.18.0" }, diff --git a/packages/plugins/jwt/src/__tests__/jwt.spec.ts b/packages/plugins/jwt/src/__tests__/jwt.spec.ts index 9ac2f7d4ff..ca318dbca9 100644 --- a/packages/plugins/jwt/src/__tests__/jwt.spec.ts +++ b/packages/plugins/jwt/src/__tests__/jwt.spec.ts @@ -3,7 +3,7 @@ import { createHmac } from 'node:crypto'; import { createServer, Server } from 'node:http'; import { AddressInfo } from 'node:net'; import { createClient } from 'graphql-ws'; -import { useServer } from 'graphql-ws/lib/use/ws'; +import { useServer } from 'graphql-ws/use/ws'; import { createSchema, createYoga, Plugin } from 'graphql-yoga'; import jwt, { Algorithm, SignOptions } from 'jsonwebtoken'; import WebSocket from 'ws'; @@ -650,20 +650,20 @@ describe('jwt plugin', () => { execute: (args: any) => args.execute(args), subscribe: (args: any) => args.subscribe(args), - onSubscribe: async (ctx, msg) => { + onSubscribe: async (ctx, _id, params) => { const { schema, execute, subscribe, contextFactory, parse, validate } = test.yoga.getEnveloped({ ...ctx, req: ctx.extra.request, socket: ctx.extra.socket, - params: msg.payload, + params, }); const args = { schema, - operationName: msg.payload.operationName, - document: parse(msg.payload.query), - variableValues: msg.payload.variables, + operationName: params.operationName, + document: parse(params.query), + variableValues: params.variables, contextValue: await contextFactory(), execute, subscribe, diff --git a/packages/plugins/jwt/src/utils.ts b/packages/plugins/jwt/src/utils.ts index 9528f497d4..3876ef8921 100644 --- a/packages/plugins/jwt/src/utils.ts +++ b/packages/plugins/jwt/src/utils.ts @@ -1,6 +1,7 @@ import { createGraphQLError } from 'graphql-yoga'; import { JwksClient, type Options as JwksClientOptions } from 'jwks-rsa'; import { GetSigningKeyFunction, type ExtractTokenFunction } from './config.js'; +import '@whatwg-node/server-plugin-cookies'; export function extractFromHeader(options: { name: string; diff --git a/packages/plugins/prometheus/__integration-tests__/graphql-ws.test.ts b/packages/plugins/prometheus/__integration-tests__/graphql-ws.test.ts index 11082476d2..c58b7a8d15 100644 --- a/packages/plugins/prometheus/__integration-tests__/graphql-ws.test.ts +++ b/packages/plugins/prometheus/__integration-tests__/graphql-ws.test.ts @@ -1,7 +1,7 @@ import { createServer, type Server } from 'node:http'; import { AddressInfo } from 'node:net'; import { Client, createClient } from 'graphql-ws'; -import { useServer } from 'graphql-ws/lib/use/ws'; +import { useServer } from 'graphql-ws/use/ws'; import { createSchema, createYoga } from 'graphql-yoga'; import { register as registry } from 'prom-client'; import WebSocket from 'ws'; @@ -64,21 +64,21 @@ describe('GraphQL WS & Prometheus integration', () => { execute: (args: any) => args.execute(args), // eslint-disable-next-line @typescript-eslint/no-explicit-any subscribe: (args: any) => args.subscribe(args), - onSubscribe: async (ctx, msg) => { + onSubscribe: async (ctx, _id, params) => { const { schema, execute, subscribe, contextFactory, parse, validate } = yoga.getEnveloped( { ...ctx, req: ctx.extra.request, socket: ctx.extra.socket, - params: msg.payload, + params, }, ); const args = { schema, - operationName: msg.payload.operationName, - document: parse(msg.payload.query), - variableValues: msg.payload.variables, + operationName: params.operationName, + document: parse(params.query), + variableValues: params.variables, contextValue: await contextFactory(), execute, subscribe, diff --git a/packages/plugins/prometheus/package.json b/packages/plugins/prometheus/package.json index 29da076a68..765f428b8b 100644 --- a/packages/plugins/prometheus/package.json +++ b/packages/plugins/prometheus/package.json @@ -46,7 +46,7 @@ }, "devDependencies": { "@types/ws": "^8.5.13", - "graphql-ws": "^5.16.2", + "graphql-ws": "^6.0.0", "graphql-yoga": "workspace:*", "prom-client": "15.1.3", "ws": "^8.18.0" diff --git a/packages/subscription/package.json b/packages/subscription/package.json index eded46d3ae..e0d394932f 100644 --- a/packages/subscription/package.json +++ b/packages/subscription/package.json @@ -60,7 +60,7 @@ "@graphql-yoga/typed-event-target": "workspace:^", "@repeaterjs/repeater": "^3.0.4", "@whatwg-node/events": "^0.1.0", - "tslib": "^2.5.2" + "tslib": "^2.8.1" }, "devDependencies": { "@graphql-yoga/redis-event-target": "workspace:*", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index eaf3b7ffe0..45bac36869 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -741,8 +741,8 @@ importers: specifier: 16.10.0 version: 16.10.0 graphql-ws: - specifier: 5.16.2 - version: 5.16.2(graphql@16.10.0) + specifier: 6.0.0 + version: 6.0.0(graphql@16.10.0)(uWebSockets.js@https://codeload.github.com/uNetworking/uWebSockets.js/tar.gz/6609a88ffa9a16ac5158046761356ce03250a0df)(ws@8.18.0) graphql-yoga: specifier: workspace:* version: link:../../packages/graphql-yoga/dist @@ -1144,8 +1144,8 @@ importers: specifier: 16.10.0 version: 16.10.0 graphql-ws: - specifier: ^5.11.3 - version: 5.16.2(graphql@16.10.0) + specifier: ^6.0.0 + version: 6.0.0(graphql@16.10.0)(uWebSockets.js@https://codeload.github.com/uNetworking/uWebSockets.js/tar.gz/6609a88ffa9a16ac5158046761356ce03250a0df)(ws@8.18.0) graphql-yoga: specifier: workspace:* version: link:../../packages/graphql-yoga/dist @@ -1462,8 +1462,8 @@ importers: specifier: 16.10.0 version: 16.10.0 graphql-ws: - specifier: ^5.11.3 - version: 5.16.2(graphql@16.10.0) + specifier: ^6.0.0 + version: 6.0.0(graphql@16.10.0)(uWebSockets.js@https://codeload.github.com/uNetworking/uWebSockets.js/tar.gz/6609a88ffa9a16ac5158046761356ce03250a0df)(ws@8.18.0) graphql-yoga: specifier: workspace:* version: link:../../packages/graphql-yoga/dist @@ -1499,7 +1499,7 @@ importers: specifier: 16.10.0 version: 16.10.0 tslib: - specifier: ^2.5.2 + specifier: ^2.8.1 version: 2.8.1 devDependencies: '@apollo/client': @@ -1522,7 +1522,7 @@ importers: specifier: 16.10.0 version: 16.10.0 tslib: - specifier: ^2.5.2 + specifier: ^2.8.1 version: 2.8.1 devDependencies: '@urql/core': @@ -1562,7 +1562,7 @@ importers: specifier: ^3.0.4 version: 3.0.6 tslib: - specifier: ^2.5.2 + specifier: ^2.8.1 version: 2.8.1 publishDirectory: dist @@ -1570,16 +1570,16 @@ importers: dependencies: '@graphiql/plugin-explorer': specifier: ^3.0.0 - version: 3.2.5(@graphiql/react@0.20.4(patch_hash=qwxtultli6uefd732fbjgf3o34)(@codemirror/language@6.0.0)(@types/node@22.10.6)(@types/react-dom@19.0.3(@types/react@19.0.7))(@types/react@19.0.7)(graphql-ws@5.16.2(graphql@16.10.0))(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 3.2.5(@graphiql/react@0.20.4(patch_hash=qwxtultli6uefd732fbjgf3o34)(@codemirror/language@6.0.0)(@types/node@22.10.6)(@types/react-dom@19.0.3(@types/react@19.0.7))(@types/react@19.0.7)(graphql-ws@6.0.0(graphql@16.10.0)(ws@8.18.0))(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@graphiql/toolkit': specifier: 0.11.1 - version: 0.11.1(@types/node@22.10.6)(graphql-ws@5.16.2(graphql@16.10.0))(graphql@16.10.0) + version: 0.11.1(@types/node@22.10.6)(graphql-ws@6.0.0(graphql@16.10.0)(ws@8.18.0))(graphql@16.10.0) '@graphql-tools/url-loader': specifier: ^8.0.15 version: 8.0.24(@types/node@22.10.6)(graphql@16.10.0) graphiql: specifier: 3.1.1 - version: 3.1.1(@codemirror/language@6.0.0)(@types/node@22.10.6)(@types/react-dom@19.0.3(@types/react@19.0.7))(@types/react@19.0.7)(graphql-ws@5.16.2(graphql@16.10.0))(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 3.1.1(@codemirror/language@6.0.0)(@types/node@22.10.6)(@types/react-dom@19.0.3(@types/react@19.0.7))(@types/react@19.0.7)(graphql-ws@6.0.0(graphql@16.10.0)(ws@8.18.0))(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) graphql: specifier: 16.10.0 version: 16.10.0 @@ -1698,7 +1698,7 @@ importers: packages/logger: dependencies: tslib: - specifier: ^2.5.2 + specifier: ^2.8.1 version: 2.8.1 publishDirectory: dist @@ -1753,8 +1753,8 @@ importers: specifier: ^1.18.0 version: 1.22.3(graphql@16.10.0) graphql-ws: - specifier: ^5.11.3 - version: 5.16.2(graphql@16.10.0) + specifier: ^6.0.0 + version: 6.0.0(graphql@16.10.0)(uWebSockets.js@https://codeload.github.com/uNetworking/uWebSockets.js/tar.gz/6609a88ffa9a16ac5158046761356ce03250a0df)(ws@8.18.0) graphql-yoga: specifier: workspace:^ version: link:../graphql-yoga/dist @@ -1771,7 +1771,7 @@ importers: specifier: ^0.11.0 version: 0.11.0(graphql@16.10.0) tslib: - specifier: ^2.5.2 + specifier: ^2.8.1 version: 2.8.1 ws: specifier: ^8.12.1 @@ -1811,7 +1811,7 @@ importers: specifier: 16.10.0 version: 16.10.0 tslib: - specifier: ^2.5.2 + specifier: ^2.8.1 version: 2.8.1 packages/plugins/apollo-inline-trace: @@ -1826,7 +1826,7 @@ importers: specifier: ^10.6.1 version: 10.7.2(graphql@16.10.0) tslib: - specifier: ^2.5.2 + specifier: ^2.8.1 version: 2.8.1 devDependencies: '@apollo/gateway': @@ -1893,7 +1893,7 @@ importers: specifier: workspace:^ version: link:../apollo-inline-trace/dist tslib: - specifier: ^2.5.2 + specifier: ^2.8.1 version: 2.8.1 devDependencies: '@envelop/on-resolve': @@ -1929,7 +1929,7 @@ importers: specifier: workspace:* version: link:../../graphql-yoga/dist tslib: - specifier: ^2.5.2 + specifier: ^2.8.1 version: 2.8.1 publishDirectory: dist @@ -1958,7 +1958,7 @@ importers: specifier: workspace:* version: link:../../graphql-yoga/dist tslib: - specifier: ^2.5.2 + specifier: ^2.8.1 version: 2.8.1 publishDirectory: dist @@ -1985,7 +1985,7 @@ importers: specifier: workspace:* version: link:../../graphql-yoga/dist tslib: - specifier: ^2.5.2 + specifier: ^2.8.1 version: 2.8.1 publishDirectory: dist @@ -2017,8 +2017,8 @@ importers: specifier: ^1.22.2 version: 1.24.0(graphql@16.10.0) graphql-ws: - specifier: 5.16.2 - version: 5.16.2(graphql@16.10.0) + specifier: 6.0.0 + version: 6.0.0(graphql@16.10.0)(uWebSockets.js@https://codeload.github.com/uNetworking/uWebSockets.js/tar.gz/6609a88ffa9a16ac5158046761356ce03250a0df)(ws@8.18.0) graphql-yoga: specifier: workspace:* version: link:../../graphql-yoga/dist @@ -2050,8 +2050,8 @@ importers: specifier: ^8.5.13 version: 8.5.13 graphql-ws: - specifier: ^5.16.2 - version: 5.16.2(graphql@16.10.0) + specifier: ^6.0.0 + version: 6.0.0(graphql@16.10.0)(uWebSockets.js@https://codeload.github.com/uNetworking/uWebSockets.js/tar.gz/6609a88ffa9a16ac5158046761356ce03250a0df)(ws@8.18.0) graphql-yoga: specifier: workspace:* version: link:../../graphql-yoga/dist @@ -2119,7 +2119,7 @@ importers: specifier: ^0.1.0 version: 0.1.2 tslib: - specifier: ^2.5.2 + specifier: ^2.8.1 version: 2.8.1 devDependencies: '@graphql-yoga/redis-event-target': @@ -11652,6 +11652,23 @@ packages: peerDependencies: graphql: 16.10.0 + graphql-ws@6.0.0: + resolution: {integrity: sha512-WiLstdkWZ2Ga9YwCqiYVnu84Kv9cgdZvdIt2GNojSYUMhuk8TLOnxBn7ioHFX4aNX3VWjjwDA3vKaLQGhtDOmw==} + version: 6.0.0 + engines: {node: '>=20'} + peerDependencies: + '@fastify/websocket': ^10 || ^11 + graphql: 16.10.0 + uWebSockets.js: ^20 + ws: ^8 + peerDependenciesMeta: + '@fastify/websocket': + optional: true + uWebSockets.js: + optional: true + ws: + optional: true + graphql@16.10.0: resolution: {integrity: sha512-AjqGKbDGUFRKIRCP9tCKiIGHyriz2oHEbPIbEtcSLSs4YjReZOIPQQWek4+6hjw62H9QShXHyaGivGiYVLeYFQ==} engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0} @@ -20431,17 +20448,17 @@ snapshots: react: 19.0.0 react-dom: 19.0.0(react@19.0.0) - '@graphiql/plugin-explorer@3.2.5(@graphiql/react@0.20.4(patch_hash=qwxtultli6uefd732fbjgf3o34)(@codemirror/language@6.0.0)(@types/node@22.10.6)(@types/react-dom@19.0.3(@types/react@19.0.7))(@types/react@19.0.7)(graphql-ws@5.16.2(graphql@16.10.0))(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@graphiql/plugin-explorer@3.2.5(@graphiql/react@0.20.4(patch_hash=qwxtultli6uefd732fbjgf3o34)(@codemirror/language@6.0.0)(@types/node@22.10.6)(@types/react-dom@19.0.3(@types/react@19.0.7))(@types/react@19.0.7)(graphql-ws@6.0.0(graphql@16.10.0)(ws@8.18.0))(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': dependencies: - '@graphiql/react': 0.20.4(patch_hash=qwxtultli6uefd732fbjgf3o34)(@codemirror/language@6.0.0)(@types/node@22.10.6)(@types/react-dom@19.0.3(@types/react@19.0.7))(@types/react@19.0.7)(graphql-ws@5.16.2(graphql@16.10.0))(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@graphiql/react': 0.20.4(patch_hash=qwxtultli6uefd732fbjgf3o34)(@codemirror/language@6.0.0)(@types/node@22.10.6)(@types/react-dom@19.0.3(@types/react@19.0.7))(@types/react@19.0.7)(graphql-ws@6.0.0(graphql@16.10.0)(ws@8.18.0))(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) graphiql-explorer: 0.9.0(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) graphql: 16.10.0 react: 19.0.0 react-dom: 19.0.0(react@19.0.0) - '@graphiql/react@0.20.4(patch_hash=qwxtultli6uefd732fbjgf3o34)(@codemirror/language@6.0.0)(@types/node@22.10.6)(@types/react-dom@19.0.3(@types/react@19.0.7))(@types/react@19.0.7)(graphql-ws@5.16.2(graphql@16.10.0))(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@graphiql/react@0.20.4(patch_hash=qwxtultli6uefd732fbjgf3o34)(@codemirror/language@6.0.0)(@types/node@22.10.6)(@types/react-dom@19.0.3(@types/react@19.0.7))(@types/react@19.0.7)(graphql-ws@6.0.0(graphql@16.10.0)(ws@8.18.0))(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': dependencies: - '@graphiql/toolkit': 0.9.2(@types/node@22.10.6)(graphql-ws@5.16.2(graphql@16.10.0))(graphql@16.10.0) + '@graphiql/toolkit': 0.9.2(@types/node@22.10.6)(graphql-ws@6.0.0(graphql@16.10.0)(ws@8.18.0))(graphql@16.10.0) '@headlessui/react': 1.7.19(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@radix-ui/react-dialog': 1.1.4(@types/react-dom@19.0.3(@types/react@19.0.7))(@types/react@19.0.7)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@radix-ui/react-dropdown-menu': 2.1.4(@types/react-dom@19.0.3(@types/react@19.0.7))(@types/react@19.0.7)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) @@ -20466,23 +20483,23 @@ snapshots: - '@types/react-dom' - graphql-ws - '@graphiql/toolkit@0.11.1(@types/node@22.10.6)(graphql-ws@5.16.2(graphql@16.10.0))(graphql@16.10.0)': + '@graphiql/toolkit@0.11.1(@types/node@22.10.6)(graphql-ws@6.0.0(graphql@16.10.0)(ws@8.18.0))(graphql@16.10.0)': dependencies: '@n1ru4l/push-pull-async-iterable-iterator': 3.2.0 graphql: 16.10.0 meros: 1.3.0(@types/node@22.10.6) optionalDependencies: - graphql-ws: 5.16.2(graphql@16.10.0) + graphql-ws: 6.0.0(graphql@16.10.0)(uWebSockets.js@https://codeload.github.com/uNetworking/uWebSockets.js/tar.gz/6609a88ffa9a16ac5158046761356ce03250a0df)(ws@8.18.0) transitivePeerDependencies: - '@types/node' - '@graphiql/toolkit@0.9.2(@types/node@22.10.6)(graphql-ws@5.16.2(graphql@16.10.0))(graphql@16.10.0)': + '@graphiql/toolkit@0.9.2(@types/node@22.10.6)(graphql-ws@6.0.0(graphql@16.10.0)(ws@8.18.0))(graphql@16.10.0)': dependencies: '@n1ru4l/push-pull-async-iterable-iterator': 3.2.0 graphql: 16.10.0 meros: 1.3.0(@types/node@22.10.6) optionalDependencies: - graphql-ws: 5.16.2(graphql@16.10.0) + graphql-ws: 6.0.0(graphql@16.10.0)(uWebSockets.js@https://codeload.github.com/uNetworking/uWebSockets.js/tar.gz/6609a88ffa9a16ac5158046761356ce03250a0df)(ws@8.18.0) transitivePeerDependencies: - '@types/node' @@ -29167,10 +29184,10 @@ snapshots: react: 19.0.0 react-dom: 19.0.0(react@19.0.0) - graphiql@3.1.1(@codemirror/language@6.0.0)(@types/node@22.10.6)(@types/react-dom@19.0.3(@types/react@19.0.7))(@types/react@19.0.7)(graphql-ws@5.16.2(graphql@16.10.0))(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0): + graphiql@3.1.1(@codemirror/language@6.0.0)(@types/node@22.10.6)(@types/react-dom@19.0.3(@types/react@19.0.7))(@types/react@19.0.7)(graphql-ws@6.0.0(graphql@16.10.0)(ws@8.18.0))(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0): dependencies: - '@graphiql/react': 0.20.4(patch_hash=qwxtultli6uefd732fbjgf3o34)(@codemirror/language@6.0.0)(@types/node@22.10.6)(@types/react-dom@19.0.3(@types/react@19.0.7))(@types/react@19.0.7)(graphql-ws@5.16.2(graphql@16.10.0))(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@graphiql/toolkit': 0.9.2(@types/node@22.10.6)(graphql-ws@5.16.2(graphql@16.10.0))(graphql@16.10.0) + '@graphiql/react': 0.20.4(patch_hash=qwxtultli6uefd732fbjgf3o34)(@codemirror/language@6.0.0)(@types/node@22.10.6)(@types/react-dom@19.0.3(@types/react@19.0.7))(@types/react@19.0.7)(graphql-ws@6.0.0(graphql@16.10.0)(ws@8.18.0))(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@graphiql/toolkit': 0.9.2(@types/node@22.10.6)(graphql-ws@6.0.0(graphql@16.10.0)(ws@8.18.0))(graphql@16.10.0) graphql: 16.10.0 graphql-language-service: 5.3.0(graphql@16.10.0) markdown-it: 12.3.2 @@ -29262,6 +29279,13 @@ snapshots: dependencies: graphql: 16.10.0 + graphql-ws@6.0.0(graphql@16.10.0)(uWebSockets.js@https://codeload.github.com/uNetworking/uWebSockets.js/tar.gz/6609a88ffa9a16ac5158046761356ce03250a0df)(ws@8.18.0): + dependencies: + graphql: 16.10.0 + optionalDependencies: + uWebSockets.js: https://codeload.github.com/uNetworking/uWebSockets.js/tar.gz/6609a88ffa9a16ac5158046761356ce03250a0df + ws: 8.18.0 + graphql@16.10.0: {} gray-matter@4.0.3: diff --git a/tsconfig.build.json b/tsconfig.build.json index 875678face..d9ef6f7218 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -2,7 +2,8 @@ "extends": "./tsconfig.json", "compilerOptions": { "declaration": true, - "verbatimModuleSyntax": false + "verbatimModuleSyntax": false, + "moduleResolution": "node" }, "exclude": [ "**/node_modules", @@ -11,6 +12,8 @@ "**/scripts", "**/test/*.ts", "**/tests/*.ts", + "**/__tests__", + "**/__integration-tests__", "*.spec.ts", "*.test.ts" ] diff --git a/tsconfig.json b/tsconfig.json index 823753c71a..50c4e219dc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,7 @@ "experimentalDecorators": true, "target": "es2022", "module": "esnext", - "moduleResolution": "node", + "moduleResolution": "bundler", "lib": ["esnext"], "emitDecoratorMetadata": true, "sourceMap": false, diff --git a/website/src/pages/docs/features/subscriptions.mdx b/website/src/pages/docs/features/subscriptions.mdx index 201dfec836..8da2649208 100644 --- a/website/src/pages/docs/features/subscriptions.mdx +++ b/website/src/pages/docs/features/subscriptions.mdx @@ -190,7 +190,7 @@ use WebSockets instead of Server-Sent Events within GraphiQL. ```ts filename="yoga-with-ws.ts" import { createServer } from 'node:http' -import { useServer } from 'graphql-ws/lib/use/ws' +import { useServer } from 'graphql-ws/use/ws' import { createYoga } from 'graphql-yoga' import { WebSocketServer } from 'ws' @@ -214,19 +214,19 @@ useServer( { execute: (args: any) => args.rootValue.execute(args), subscribe: (args: any) => args.rootValue.subscribe(args), - onSubscribe: async (ctx, msg) => { + onSubscribe: async (ctx, _id, params) => { const { schema, execute, subscribe, contextFactory, parse, validate } = yogaApp.getEnveloped({ ...ctx, req: ctx.extra.request, socket: ctx.extra.socket, - params: msg.payload + params }) const args = { schema, - operationName: msg.payload.operationName, - document: parse(msg.payload.query), - variableValues: msg.payload.variables, + operationName: params.operationName, + document: parse(params.query), + variableValues: params.variables, contextValue: await contextFactory(), rootValue: { execute, diff --git a/website/src/pages/docs/integrations/integration-with-nextjs.mdx b/website/src/pages/docs/integrations/integration-with-nextjs.mdx index 78742e2d85..743b681bc3 100644 --- a/website/src/pages/docs/integrations/integration-with-nextjs.mdx +++ b/website/src/pages/docs/integrations/integration-with-nextjs.mdx @@ -116,7 +116,7 @@ npm i graphql-yoga graphql ws graphql-ws const { createServer } = require('http') const { WebSocketServer } = require('ws') const { createYoga, createSchema } = require('graphql-yoga') -const { useServer } = require('graphql-ws/lib/use/ws') +const { useServer } = require('graphql-ws/use/ws') const { parse } = require('url') const next = require('next') const { setTimeout: setTimeout$ } = require('timers/promises') @@ -194,19 +194,19 @@ const yoga = createYoga({ { execute: args => args.rootValue.execute(args), subscribe: args => args.rootValue.subscribe(args), - onSubscribe: async (ctx, msg) => { + onSubscribe: async (ctx, _id, params) => { const { schema, execute, subscribe, contextFactory, parse, validate } = yoga.getEnveloped({ ...ctx, req: ctx.extra.request, socket: ctx.extra.socket, - params: msg.payload + params }) const args = { schema, - operationName: msg.payload.operationName, - document: parse(msg.payload.query), - variableValues: msg.payload.variables, + operationName: params.operationName, + document: parse(params.query), + variableValues: params.variables, contextValue: await contextFactory(), rootValue: { execute, diff --git a/website/src/pages/docs/integrations/integration-with-uwebsockets.mdx b/website/src/pages/docs/integrations/integration-with-uwebsockets.mdx index af94ed716d..1433bd7944 100644 --- a/website/src/pages/docs/integrations/integration-with-uwebsockets.mdx +++ b/website/src/pages/docs/integrations/integration-with-uwebsockets.mdx @@ -62,7 +62,7 @@ npm i graphql-ws ```ts filename="index.ts" import { execute, ExecutionArgs, subscribe } from 'graphql' -import { makeBehavior } from 'graphql-ws/lib/use/uWebSockets' +import { makeBehavior } from 'graphql-ws/use/uWebSockets' import { createSchema, createYoga, Repeater } from 'graphql-yoga' import { App, HttpRequest, HttpResponse } from 'uWebSockets.js' @@ -118,14 +118,14 @@ type EnvelopedExecutionArgs = ExecutionArgs & { const wsHandler = makeBehavior({ execute: args => (args as EnvelopedExecutionArgs).rootValue.execute(args), subscribe: args => (args as EnvelopedExecutionArgs).rootValue.subscribe(args), - onSubscribe: async (ctx, msg) => { + onSubscribe: async (ctx, _id, params) => { const { schema, execute, subscribe, contextFactory, parse, validate } = yoga.getEnveloped(ctx) const args: EnvelopedExecutionArgs = { schema, - operationName: msg.payload.operationName, - document: parse(msg.payload.query), - variableValues: msg.payload.variables, + operationName: params.operationName, + document: parse(params.query), + variableValues: params.variables, contextValue: await contextFactory(), rootValue: { execute,