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

fix(deps): update dependency graphql-ws to v6 #3660

Merged
merged 6 commits into from
Jan 15, 2025
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
5 changes: 5 additions & 0 deletions .changeset/@graphql-yoga_apollo-link-3660-dependencies.md
Original file line number Diff line number Diff line change
@@ -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`)
5 changes: 5 additions & 0 deletions .changeset/@graphql-yoga_logger-3660-dependencies.md
Original file line number Diff line number Diff line change
@@ -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`)
Original file line number Diff line number Diff line change
@@ -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`)
Original file line number Diff line number Diff line change
@@ -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`)
5 changes: 5 additions & 0 deletions .changeset/@graphql-yoga_subscription-3660-dependencies.md
Original file line number Diff line number Diff line change
@@ -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`)
Original file line number Diff line number Diff line change
@@ -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`)
5 changes: 5 additions & 0 deletions .changeset/@graphql-yoga_urql-exchange-3660-dependencies.md
Original file line number Diff line number Diff line change
@@ -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`)
2 changes: 1 addition & 1 deletion examples/bun-yoga-ws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
12 changes: 6 additions & 6 deletions examples/bun-yoga-ws/src/index.ts
Original file line number Diff line number Diff line change
@@ -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({
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions examples/graphql-ws/__integration-tests__/graphql-ws.spec.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion examples/graphql-ws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
12 changes: 6 additions & 6 deletions examples/graphql-ws/src/app.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions examples/graphql-ws/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"target": "esnext",
"moduleResolution": "node",
"module": "commonjs",
"moduleResolution": "bundler",
"module": "esnext",
"sourceMap": true,
"lib": ["esnext", "DOM", "DOM.Iterable"],
"allowSyntheticDefaultImports": true,
Expand Down
4 changes: 2 additions & 2 deletions examples/nextjs-ws/__integration-tests__/nextjs-ws.spec.ts
Original file line number Diff line number Diff line change
@@ -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());

Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs-ws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
26 changes: 13 additions & 13 deletions examples/nextjs-ws/server.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -156,4 +156,4 @@ if (process.env.NODE_ENV !== 'test') {
})();
}

module.exports = { start };
export default { start };
4 changes: 2 additions & 2 deletions examples/nextjs-ws/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"target": "es5",
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "bundler",
"checkJs": true,
"skipLibCheck": true,
"strict": false,
Expand Down
21 changes: 1 addition & 20 deletions examples/sveltekit/__integration-tests__/sveltekit.spec.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion examples/uwebsockets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions examples/uwebsockets/src/app.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/client/apollo-link/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/client/urql-exchange/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/event-target/typed-event-target/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"dependencies": {
"@repeaterjs/repeater": "^3.0.4",
"tslib": "^2.5.2"
"tslib": "^2.8.1"
},
"publishConfig": {
"directory": "dist",
Expand Down
11 changes: 5 additions & 6 deletions packages/graphql-yoga/__tests__/request-cancellation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"check": "tsc --pretty --noEmit"
},
"dependencies": {
"tslib": "^2.5.2"
"tslib": "^2.8.1"
},
"publishConfig": {
"directory": "dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-federation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading
Loading