From 8df6013b6b45452ec058fab3e068b5b6d6c493f7 Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Wed, 24 Apr 2024 12:38:00 +0200 Subject: [PATCH 01/17] MockLink: add query default variables if not specified in mock request resolves #8023 --- .changeset/fluffy-badgers-rush.md | 5 ++ .../core/mocking/__tests__/mockLink.ts | 84 ++++++++++++++++++- src/testing/core/mocking/mockLink.ts | 9 ++ .../internal/disposables/enableFakeTimers.ts | 26 ++++++ src/testing/internal/disposables/index.ts | 1 + 5 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 .changeset/fluffy-badgers-rush.md create mode 100644 src/testing/internal/disposables/enableFakeTimers.ts diff --git a/.changeset/fluffy-badgers-rush.md b/.changeset/fluffy-badgers-rush.md new file mode 100644 index 00000000000..62f55a2b0f0 --- /dev/null +++ b/.changeset/fluffy-badgers-rush.md @@ -0,0 +1,5 @@ +--- +"@apollo/client": patch +--- + +MockLink: add query default variables if not specified in mock request diff --git a/src/testing/core/mocking/__tests__/mockLink.ts b/src/testing/core/mocking/__tests__/mockLink.ts index dc68b654505..119c9b1ba45 100644 --- a/src/testing/core/mocking/__tests__/mockLink.ts +++ b/src/testing/core/mocking/__tests__/mockLink.ts @@ -1,6 +1,7 @@ import gql from "graphql-tag"; import { MockLink, MockedResponse } from "../mockLink"; import { execute } from "../../../../link/core/execute"; +import { ObservableStream, enableFakeTimers } from "../../../internal"; describe("MockedResponse.newData", () => { const setup = () => { @@ -72,9 +73,6 @@ We've chosen this value as the MAXIMUM_DELAY since values that don't fit into a const MAXIMUM_DELAY = 0x7f_ff_ff_ff; describe("mockLink", () => { - beforeAll(() => jest.useFakeTimers()); - afterAll(() => jest.useRealTimers()); - const query = gql` query A { a @@ -82,6 +80,8 @@ describe("mockLink", () => { `; it("should not require a result or error when delay equals Infinity", async () => { + using _fakeTimers = enableFakeTimers(); + const mockLink = new MockLink([ { request: { @@ -103,6 +103,8 @@ describe("mockLink", () => { }); it("should require result or error when delay is just large", (done) => { + using _fakeTimers = enableFakeTimers(); + const mockLink = new MockLink([ { request: { @@ -125,4 +127,80 @@ describe("mockLink", () => { jest.advanceTimersByTime(MAXIMUM_DELAY); }); + + it("should fill in default variables if they are missing in mocked requests", async () => { + const query = gql` + query GetTodo($done: Boolean = true, $user: String!) { + todo(user: $user, done: $done) { + id + title + } + } + `; + const mocks = [ + { + // default should get filled in here + request: { query, variables: { user: "Tim" } }, + result: { + data: { todo: { id: 1 } }, + }, + }, + { + // we provide our own `done`, so it should not get filled in + request: { query, variables: { user: "Tim", done: false } }, + result: { + data: { todo: { id: 2 } }, + }, + }, + { + // one more that has a different user variable and should never match + request: { query, variables: { user: "Tom" } }, + result: { + data: { todo: { id: 2 } }, + }, + }, + ]; + + // Apollo Client will always fill in default values for missing variables + // in the operation before calling the Link, so we have to do the same here + // when we call `execute` + const defaults = { done: true }; + const link = new MockLink(mocks, false, { showWarnings: false }); + { + // Non-optional variable is missing, should not match. + const stream = new ObservableStream( + execute(link, { query, variables: { ...defaults } }) + ); + await stream.takeError(); + } + { + // Execute called incorrectly without a default variable filled in. + // This will never happen in Apollo Client since AC always fills these + // before calling `execute`, so it's okay if it results in a "no match" + // scenario here. + const stream = new ObservableStream( + execute(link, { query, variables: { user: "Tim" } }) + ); + await stream.takeError(); + } + { + // Expect default value to be filled in the mock request. + const stream = new ObservableStream( + execute(link, { query, variables: { ...defaults, user: "Tim" } }) + ); + const result = await stream.takeNext(); + expect(result).toEqual({ data: { todo: { id: 1 } } }); + } + { + // Test that defaults don't overwrite explicitly different values in a mock request. + const stream = new ObservableStream( + execute(link, { + query, + variables: { ...defaults, user: "Tim", done: false }, + }) + ); + const result = await stream.takeNext(); + expect(result).toEqual({ data: { todo: { id: 2 } } }); + } + }); }); diff --git a/src/testing/core/mocking/mockLink.ts b/src/testing/core/mocking/mockLink.ts index 46b43cca6ad..1258dae115d 100644 --- a/src/testing/core/mocking/mockLink.ts +++ b/src/testing/core/mocking/mockLink.ts @@ -17,6 +17,8 @@ import { cloneDeep, stringifyForDisplay, print, + getOperationDefinition, + getDefaultValues, } from "../../../utilities/index.js"; export type ResultFunction> = (variables: V) => T; @@ -212,6 +214,13 @@ ${unmatchedVars.map((d) => ` ${stringifyForDisplay(d)}`).join("\n")} newMockedResponse.request.query = query; } + newMockedResponse.request.variables = { + ...getDefaultValues( + getOperationDefinition(newMockedResponse.request.query) + ), + ...newMockedResponse.request.variables, + }; + mockedResponse.maxUsageCount = mockedResponse.maxUsageCount ?? 1; invariant( mockedResponse.maxUsageCount > 0, diff --git a/src/testing/internal/disposables/enableFakeTimers.ts b/src/testing/internal/disposables/enableFakeTimers.ts new file mode 100644 index 00000000000..6be85d24730 --- /dev/null +++ b/src/testing/internal/disposables/enableFakeTimers.ts @@ -0,0 +1,26 @@ +import { withCleanup } from "./withCleanup.js"; + +declare global { + interface DateConstructor { + /* Jest uses @sinonjs/fake-timers, that add this flag */ + isFake: boolean; + } +} + +export function enableFakeTimers( + config?: FakeTimersConfig | LegacyFakeTimersConfig +) { + if (global.Date.isFake === true) { + // Nothing to do here, fake timers have already been set up. + // That also means we don't want to clean that up later. + return withCleanup({}, () => {}); + } + + jest.useFakeTimers(config); + return withCleanup({}, () => { + if (global.Date.isFake === true) { + jest.runOnlyPendingTimers(); + jest.useRealTimers(); + } + }); +} diff --git a/src/testing/internal/disposables/index.ts b/src/testing/internal/disposables/index.ts index 9895d129589..9d61c88fd90 100644 --- a/src/testing/internal/disposables/index.ts +++ b/src/testing/internal/disposables/index.ts @@ -1,3 +1,4 @@ export { disableActWarnings } from "./disableActWarnings.js"; export { spyOnConsole } from "./spyOnConsole.js"; export { withCleanup } from "./withCleanup.js"; +export { enableFakeTimers } from "./enableFakeTimers.js"; From bcd51e071b55c790116d7183022e83e6ed778737 Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Wed, 24 Apr 2024 13:08:40 +0200 Subject: [PATCH 02/17] move logic --- src/testing/core/mocking/mockLink.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/testing/core/mocking/mockLink.ts b/src/testing/core/mocking/mockLink.ts index 1258dae115d..46e6dbd760a 100644 --- a/src/testing/core/mocking/mockLink.ts +++ b/src/testing/core/mocking/mockLink.ts @@ -214,13 +214,6 @@ ${unmatchedVars.map((d) => ` ${stringifyForDisplay(d)}`).join("\n")} newMockedResponse.request.query = query; } - newMockedResponse.request.variables = { - ...getDefaultValues( - getOperationDefinition(newMockedResponse.request.query) - ), - ...newMockedResponse.request.variables, - }; - mockedResponse.maxUsageCount = mockedResponse.maxUsageCount ?? 1; invariant( mockedResponse.maxUsageCount > 0, @@ -233,17 +226,21 @@ ${unmatchedVars.map((d) => ` ${stringifyForDisplay(d)}`).join("\n")} } private normalizeVariableMatching(mockedResponse: MockedResponse) { - const variables = mockedResponse.request.variables; - if (mockedResponse.variableMatcher && variables) { + const request = mockedResponse.request; + if (mockedResponse.variableMatcher && request.variables) { throw new Error( "Mocked response should contain either variableMatcher or request.variables" ); } if (!mockedResponse.variableMatcher) { + request.variables = { + ...getDefaultValues(getOperationDefinition(request.query)), + ...request.variables, + }; mockedResponse.variableMatcher = (vars) => { const requestVariables = vars || {}; - const mockedResponseVariables = variables || {}; + const mockedResponseVariables = request.variables || {}; return equal(requestVariables, mockedResponseVariables); }; } From 7249ff6d9feffca15a36bbe3331ce98146a49747 Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Thu, 2 May 2024 11:37:42 +0200 Subject: [PATCH 03/17] Update src/testing/core/mocking/__tests__/mockLink.ts Co-authored-by: Jerel Miller --- src/testing/core/mocking/__tests__/mockLink.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/testing/core/mocking/__tests__/mockLink.ts b/src/testing/core/mocking/__tests__/mockLink.ts index 119c9b1ba45..6c2d8e1d65a 100644 --- a/src/testing/core/mocking/__tests__/mockLink.ts +++ b/src/testing/core/mocking/__tests__/mockLink.ts @@ -133,7 +133,6 @@ describe("mockLink", () => { query GetTodo($done: Boolean = true, $user: String!) { todo(user: $user, done: $done) { id - title } } `; From b1253c024f16b9665f725f7a6464cef9a948feaa Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jul 2024 16:59:34 -0600 Subject: [PATCH 04/17] chore(deps): update all dependencies - patch updates (#11840) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package-lock.json | 1233 ++++++++++++++------------------------------- package.json | 38 +- 2 files changed, 392 insertions(+), 879 deletions(-) diff --git a/package-lock.json b/package-lock.json index bb5066c76b7..6238c74bb3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,18 +27,18 @@ }, "devDependencies": { "@arethetypeswrong/cli": "0.15.3", - "@babel/parser": "7.24.5", + "@babel/parser": "7.24.7", "@changesets/changelog-github": "0.5.0", - "@changesets/cli": "2.27.1", - "@graphql-tools/merge": "9.0.3", - "@graphql-tools/schema": "10.0.3", + "@changesets/cli": "2.27.7", + "@graphql-tools/merge": "9.0.4", + "@graphql-tools/schema": "10.0.4", "@graphql-tools/utils": "10.2.0", "@microsoft/api-extractor": "7.47.0", "@rollup/plugin-node-resolve": "11.2.1", - "@size-limit/esbuild-why": "11.1.2", - "@size-limit/preset-small-lib": "11.1.2", - "@testing-library/jest-dom": "6.4.5", - "@testing-library/react": "15.0.6", + "@size-limit/esbuild-why": "11.1.4", + "@size-limit/preset-small-lib": "11.1.4", + "@testing-library/jest-dom": "6.4.6", + "@testing-library/react": "15.0.7", "@testing-library/react-12": "npm:@testing-library/react@^12", "@testing-library/user-event": "14.5.2", "@tsconfig/node20": "20.1.4", @@ -47,12 +47,12 @@ "@types/glob": "8.1.0", "@types/hoist-non-react-statics": "3.3.5", "@types/jest": "29.5.12", - "@types/lodash": "4.17.1", + "@types/lodash": "4.17.6", "@types/node": "20.12.10", "@types/node-fetch": "2.6.11", - "@types/react": "18.3.1", + "@types/react": "18.3.3", "@types/react-dom": "18.3.0", - "@types/relay-runtime": "14.1.23", + "@types/relay-runtime": "14.1.24", "@types/use-sync-external-store": "0.0.6", "@typescript-eslint/eslint-plugin": "7.9.0", "@typescript-eslint/parser": "7.9.0", @@ -84,28 +84,28 @@ "prettier": "3.1.1", "react": "18.3.1", "react-17": "npm:react@^17", - "react-19": "npm:react@19.0.0-rc-cc1ec60d0d-20240607", + "react-19": "npm:react@19.0.0-rc-fb9a90fa48-20240614", "react-dom": "18.3.1", "react-dom-17": "npm:react-dom@^17", - "react-dom-19": "npm:react-dom@19.0.0-rc-cc1ec60d0d-20240607", + "react-dom-19": "npm:react-dom@19.0.0-rc-fb9a90fa48-20240614", "react-error-boundary": "4.0.13", - "recast": "0.23.6", + "recast": "0.23.9", "resolve": "1.22.8", - "rimraf": "5.0.5", + "rimraf": "5.0.7", "rollup": "2.79.1", "rollup-plugin-cleanup": "3.2.1", "rollup-plugin-terser": "7.0.2", "rxjs": "7.8.1", - "size-limit": "11.1.2", + "size-limit": "11.1.4", "subscriptions-transport-ws": "0.11.0", - "terser": "5.31.0", + "terser": "5.31.1", "ts-api-utils": "1.3.0", - "ts-jest": "29.1.2", + "ts-jest": "29.1.5", "ts-jest-resolver": "2.0.1", "ts-morph": "22.0.0", "ts-node": "10.9.2", "typedoc": "0.25.0", - "typescript": "5.5.2", + "typescript": "5.5.3", "wait-for-observables": "1.0.3", "web-streams-polyfill": "4.0.0", "whatwg-fetch": "3.6.20" @@ -136,10 +136,11 @@ } }, "node_modules/@adobe/css-tools": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.3.2.tgz", - "integrity": "sha512-DA5a1C0gD/pLOvhv33YMrbf2FK3oUzwNl9oOJqE4XVjuEtt6XIakRcsd7eLiOSPkp1kTRQGICTA8cKra/vFbjw==", - "dev": true + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.4.0.tgz", + "integrity": "sha512-Ff9+ksdQQB3rMncgqDK78uLznstjyfIf2Arnh22pW8kBpLs6rpKDwgnZT46hin5Hl1WzazzK64DOrhSwYpS7bQ==", + "dev": true, + "license": "MIT" }, "node_modules/@ampproject/remapping": { "version": "2.2.1", @@ -308,18 +309,6 @@ "url": "https://opencollective.com/babel" } }, - "node_modules/@babel/core/node_modules/@babel/parser": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz", - "integrity": "sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==", - "dev": true, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/@babel/core/node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", @@ -659,10 +648,11 @@ } }, "node_modules/@babel/parser": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.5.tgz", - "integrity": "sha512-EOv5IK8arwh3LI47dz1b0tKUb/1uhHAnHJOrjgtQMIpu1uXd9mlFrJg9IUgGUgZ41Ch0K8REPTYpO7B76b4vJg==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz", + "integrity": "sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==", "dev": true, + "license": "MIT", "bin": { "parser": "bin/babel-parser.js" }, @@ -890,18 +880,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/template/node_modules/@babel/parser": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz", - "integrity": "sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==", - "dev": true, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/@babel/traverse": { "version": "7.24.6", "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.6.tgz", @@ -923,18 +901,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/traverse/node_modules/@babel/parser": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz", - "integrity": "sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==", - "dev": true, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/@babel/types": { "version": "7.24.6", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.6.tgz", @@ -956,15 +922,17 @@ "dev": true }, "node_modules/@changesets/apply-release-plan": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@changesets/apply-release-plan/-/apply-release-plan-7.0.0.tgz", - "integrity": "sha512-vfi69JR416qC9hWmFGSxj7N6wA5J222XNBmezSVATPWDVPIF7gkd4d8CpbEbXmRWbVrkoli3oerGS6dcL/BGsQ==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/@changesets/apply-release-plan/-/apply-release-plan-7.0.4.tgz", + "integrity": "sha512-HLFwhKWayKinWAul0Vj+76jVx1Pc2v55MGPVjZ924Y/ROeSsBMFutv9heHmCUj48lJyRfOTJG5+ar+29FUky/A==", "dev": true, + "license": "MIT", "dependencies": { "@babel/runtime": "^7.20.1", - "@changesets/config": "^3.0.0", + "@changesets/config": "^3.0.2", "@changesets/get-version-range-type": "^0.4.0", "@changesets/git": "^3.0.0", + "@changesets/should-skip-package": "^0.1.0", "@changesets/types": "^6.0.0", "@manypkg/get-packages": "^1.1.3", "detect-indent": "^6.0.0", @@ -1004,14 +972,16 @@ } }, "node_modules/@changesets/assemble-release-plan": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@changesets/assemble-release-plan/-/assemble-release-plan-6.0.0.tgz", - "integrity": "sha512-4QG7NuisAjisbW4hkLCmGW2lRYdPrKzro+fCtZaILX+3zdUELSvYjpL4GTv0E4aM9Mef3PuIQp89VmHJ4y2bfw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@changesets/assemble-release-plan/-/assemble-release-plan-6.0.3.tgz", + "integrity": "sha512-bLNh9/Lgl1VwkjWZTq8JmRqH+hj7/Yzfz0jsQ/zJJ+FTmVqmqPj3szeKOri8O/hEM8JmHW019vh2gTO9iq5Cuw==", "dev": true, + "license": "MIT", "dependencies": { "@babel/runtime": "^7.20.1", "@changesets/errors": "^0.2.0", - "@changesets/get-dependents-graph": "^2.0.0", + "@changesets/get-dependents-graph": "^2.1.1", + "@changesets/should-skip-package": "^0.1.0", "@changesets/types": "^6.0.0", "@manypkg/get-packages": "^1.1.3", "semver": "^7.5.3" @@ -1050,25 +1020,27 @@ } }, "node_modules/@changesets/cli": { - "version": "2.27.1", - "resolved": "https://registry.npmjs.org/@changesets/cli/-/cli-2.27.1.tgz", - "integrity": "sha512-iJ91xlvRnnrJnELTp4eJJEOPjgpF3NOh4qeQehM6Ugiz9gJPRZ2t+TsXun6E3AMN4hScZKjqVXl0TX+C7AB3ZQ==", + "version": "2.27.7", + "resolved": "https://registry.npmjs.org/@changesets/cli/-/cli-2.27.7.tgz", + "integrity": "sha512-6lr8JltiiXPIjDeYg4iM2MeePP6VN/JkmqBsVA5XRiy01hGS3y629LtSDvKcycj/w/5Eur1rEwby/MjcYS+e2A==", "dev": true, + "license": "MIT", "dependencies": { "@babel/runtime": "^7.20.1", - "@changesets/apply-release-plan": "^7.0.0", - "@changesets/assemble-release-plan": "^6.0.0", + "@changesets/apply-release-plan": "^7.0.4", + "@changesets/assemble-release-plan": "^6.0.3", "@changesets/changelog-git": "^0.2.0", - "@changesets/config": "^3.0.0", + "@changesets/config": "^3.0.2", "@changesets/errors": "^0.2.0", - "@changesets/get-dependents-graph": "^2.0.0", - "@changesets/get-release-plan": "^4.0.0", + "@changesets/get-dependents-graph": "^2.1.1", + "@changesets/get-release-plan": "^4.0.3", "@changesets/git": "^3.0.0", "@changesets/logger": "^0.1.0", "@changesets/pre": "^2.0.0", "@changesets/read": "^0.6.0", + "@changesets/should-skip-package": "^0.1.0", "@changesets/types": "^6.0.0", - "@changesets/write": "^0.3.0", + "@changesets/write": "^0.3.1", "@manypkg/get-packages": "^1.1.3", "@types/semver": "^7.5.0", "ansi-colors": "^4.1.3", @@ -1078,15 +1050,14 @@ "external-editor": "^3.1.0", "fs-extra": "^7.0.1", "human-id": "^1.0.2", - "meow": "^6.0.0", + "mri": "^1.2.0", "outdent": "^0.5.0", "p-limit": "^2.2.0", "preferred-pm": "^3.0.0", "resolve-from": "^5.0.0", "semver": "^7.5.3", "spawndamnit": "^2.0.0", - "term-size": "^2.1.0", - "tty-table": "^4.1.5" + "term-size": "^2.1.0" }, "bin": { "changeset": "bin.js" @@ -1097,6 +1068,7 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -1111,6 +1083,7 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "dev": true, + "license": "MIT", "engines": { "node": ">=4" } @@ -1120,6 +1093,7 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -1132,6 +1106,7 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^3.0.0" }, @@ -1140,13 +1115,14 @@ } }, "node_modules/@changesets/config": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@changesets/config/-/config-3.0.0.tgz", - "integrity": "sha512-o/rwLNnAo/+j9Yvw9mkBQOZySDYyOr/q+wptRLcAVGlU6djOeP9v1nlalbL9MFsobuBVQbZCTp+dIzdq+CLQUA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@changesets/config/-/config-3.0.2.tgz", + "integrity": "sha512-cdEhS4t8woKCX2M8AotcV2BOWnBp09sqICxKapgLHf9m5KdENpWjyrFNMjkLqGJtUys9U+w93OxWT0czorVDfw==", "dev": true, + "license": "MIT", "dependencies": { "@changesets/errors": "^0.2.0", - "@changesets/get-dependents-graph": "^2.0.0", + "@changesets/get-dependents-graph": "^2.1.1", "@changesets/logger": "^0.1.0", "@changesets/types": "^6.0.0", "@manypkg/get-packages": "^1.1.3", @@ -1164,10 +1140,11 @@ } }, "node_modules/@changesets/get-dependents-graph": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@changesets/get-dependents-graph/-/get-dependents-graph-2.0.0.tgz", - "integrity": "sha512-cafUXponivK4vBgZ3yLu944mTvam06XEn2IZGjjKc0antpenkYANXiiE6GExV/yKdsCnE8dXVZ25yGqLYZmScA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@changesets/get-dependents-graph/-/get-dependents-graph-2.1.1.tgz", + "integrity": "sha512-LRFjjvigBSzfnPU2n/AhFsuWR5DK++1x47aq6qZ8dzYsPtS/I5mNhIGAS68IAxh1xjO9BTtz55FwefhANZ+FCA==", "dev": true, + "license": "MIT", "dependencies": { "@changesets/types": "^6.0.0", "@manypkg/get-packages": "^1.1.3", @@ -1181,6 +1158,7 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -1195,6 +1173,7 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "dev": true, + "license": "MIT", "engines": { "node": ">=4" } @@ -1204,6 +1183,7 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -1216,6 +1196,7 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^3.0.0" }, @@ -1234,14 +1215,15 @@ } }, "node_modules/@changesets/get-release-plan": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@changesets/get-release-plan/-/get-release-plan-4.0.0.tgz", - "integrity": "sha512-9L9xCUeD/Tb6L/oKmpm8nyzsOzhdNBBbt/ZNcjynbHC07WW4E1eX8NMGC5g5SbM5z/V+MOrYsJ4lRW41GCbg3w==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@changesets/get-release-plan/-/get-release-plan-4.0.3.tgz", + "integrity": "sha512-6PLgvOIwTSdJPTtpdcr3sLtGatT+Jr22+cQwEBJBy6wP0rjB4yJ9lv583J9fVpn1bfQlBkDa8JxbS2g/n9lIyA==", "dev": true, + "license": "MIT", "dependencies": { "@babel/runtime": "^7.20.1", - "@changesets/assemble-release-plan": "^6.0.0", - "@changesets/config": "^3.0.0", + "@changesets/assemble-release-plan": "^6.0.3", + "@changesets/config": "^3.0.2", "@changesets/pre": "^2.0.0", "@changesets/read": "^0.6.0", "@changesets/types": "^6.0.0", @@ -1387,6 +1369,18 @@ "node": ">=4" } }, + "node_modules/@changesets/should-skip-package": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@changesets/should-skip-package/-/should-skip-package-0.1.0.tgz", + "integrity": "sha512-FxG6Mhjw7yFStlSM7Z0Gmg3RiyQ98d/9VpQAZ3Fzr59dCOM9G6ZdYbjiSAt0XtFr9JR5U2tBaJWPjrkGGc618g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.20.1", + "@changesets/types": "^6.0.0", + "@manypkg/get-packages": "^1.1.3" + } + }, "node_modules/@changesets/types": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/@changesets/types/-/types-6.0.0.tgz", @@ -1394,10 +1388,11 @@ "dev": true }, "node_modules/@changesets/write": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@changesets/write/-/write-0.3.0.tgz", - "integrity": "sha512-slGLb21fxZVUYbyea+94uFiD6ntQW0M2hIKNznFizDhZPDgn2c/fv1UzzlW43RVzh1BEDuIqW6hzlJ1OflNmcw==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@changesets/write/-/write-0.3.1.tgz", + "integrity": "sha512-SyGtMXzH3qFqlHKcvFY2eX+6b0NGiFcNav8AFsYwy5l8hejOeoeTDemu5Yjmke2V5jpzY+pBvM0vCCQ3gdZpfw==", "dev": true, + "license": "MIT", "dependencies": { "@babel/runtime": "^7.20.1", "@changesets/types": "^6.0.0", @@ -1444,13 +1439,14 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz", - "integrity": "sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", "cpu": [ "ppc64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "aix" @@ -1460,13 +1456,14 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.2.tgz", - "integrity": "sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" @@ -1476,13 +1473,14 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.2.tgz", - "integrity": "sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" @@ -1492,13 +1490,14 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.2.tgz", - "integrity": "sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" @@ -1508,13 +1507,14 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.2.tgz", - "integrity": "sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -1524,13 +1524,14 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.2.tgz", - "integrity": "sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -1540,13 +1541,14 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.2.tgz", - "integrity": "sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "freebsd" @@ -1556,13 +1558,14 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.2.tgz", - "integrity": "sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "freebsd" @@ -1572,13 +1575,14 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.2.tgz", - "integrity": "sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -1588,13 +1592,14 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.2.tgz", - "integrity": "sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -1604,13 +1609,14 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.2.tgz", - "integrity": "sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", "cpu": [ "ia32" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -1620,13 +1626,14 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.2.tgz", - "integrity": "sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", "cpu": [ "loong64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -1636,13 +1643,14 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.2.tgz", - "integrity": "sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", "cpu": [ "mips64el" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -1652,13 +1660,14 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.2.tgz", - "integrity": "sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", "cpu": [ "ppc64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -1668,13 +1677,14 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.2.tgz", - "integrity": "sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", "cpu": [ "riscv64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -1684,13 +1694,14 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.2.tgz", - "integrity": "sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", "cpu": [ "s390x" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -1700,13 +1711,14 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.2.tgz", - "integrity": "sha512-1MdwI6OOTsfQfek8sLwgyjOXAu+wKhLEoaOLTjbijk6E2WONYpH9ZU2mNtR+lZ2B4uwr+usqGuVfFT9tMtGvGw==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -1716,13 +1728,14 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.2.tgz", - "integrity": "sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "netbsd" @@ -1732,13 +1745,14 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz", - "integrity": "sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "openbsd" @@ -1748,13 +1762,14 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.2.tgz", - "integrity": "sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "sunos" @@ -1764,13 +1779,14 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.2.tgz", - "integrity": "sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" @@ -1780,13 +1796,14 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.2.tgz", - "integrity": "sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", "cpu": [ "ia32" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" @@ -1796,13 +1813,14 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.2.tgz", - "integrity": "sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" @@ -1935,10 +1953,11 @@ } }, "node_modules/@graphql-tools/merge": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/@graphql-tools/merge/-/merge-9.0.3.tgz", - "integrity": "sha512-FeKv9lKLMwqDu0pQjPpF59GY3HReUkWXKsMIuMuJQOKh9BETu7zPEFUELvcw8w+lwZkl4ileJsHXC9+AnsT2Lw==", + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/@graphql-tools/merge/-/merge-9.0.4.tgz", + "integrity": "sha512-MivbDLUQ+4Q8G/Hp/9V72hbn810IJDEZQ57F01sHnlrrijyadibfVhaQfW/pNH+9T/l8ySZpaR/DpL5i+ruZ+g==", "dev": true, + "license": "MIT", "dependencies": { "@graphql-tools/utils": "^10.0.13", "tslib": "^2.4.0" @@ -1951,13 +1970,14 @@ } }, "node_modules/@graphql-tools/schema": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/@graphql-tools/schema/-/schema-10.0.3.tgz", - "integrity": "sha512-p28Oh9EcOna6i0yLaCFOnkcBDQECVf3SCexT6ktb86QNj9idnkhI+tCxnwZDh58Qvjd2nURdkbevvoZkvxzCog==", + "version": "10.0.4", + "resolved": "https://registry.npmjs.org/@graphql-tools/schema/-/schema-10.0.4.tgz", + "integrity": "sha512-HuIwqbKxPaJujox25Ra4qwz0uQzlpsaBOzO6CVfzB/MemZdd+Gib8AIvfhQArK0YIN40aDran/yi+E5Xf0mQww==", "dev": true, + "license": "MIT", "dependencies": { "@graphql-tools/merge": "^9.0.3", - "@graphql-tools/utils": "^10.0.13", + "@graphql-tools/utils": "^10.2.1", "tslib": "^2.4.0", "value-or-promise": "^1.0.12" }, @@ -1968,6 +1988,25 @@ "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, + "node_modules/@graphql-tools/schema/node_modules/@graphql-tools/utils": { + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/@graphql-tools/utils/-/utils-10.3.1.tgz", + "integrity": "sha512-Yhk1F0MNk4/ctgl3d0DKq++ZPovvZuh1ixWuUEVAxrFloYOAVwJ+rvGI1lsopArdJly8QXClT9lkvOxQszMw/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@graphql-typed-document-node/core": "^3.1.1", + "cross-inspect": "1.0.0", + "dset": "^3.1.2", + "tslib": "^2.4.0" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" + } + }, "node_modules/@graphql-tools/utils": { "version": "10.2.0", "resolved": "https://registry.npmjs.org/@graphql-tools/utils/-/utils-10.2.0.tgz", @@ -3004,26 +3043,28 @@ } }, "node_modules/@size-limit/esbuild": { - "version": "11.1.2", - "resolved": "https://registry.npmjs.org/@size-limit/esbuild/-/esbuild-11.1.2.tgz", - "integrity": "sha512-IGQNaZsS4kP4hwU9C8P+3VvPhtW9PQ9OrwKJsvHDgMsbGX01hz39b9KkVwoI29wOXdwtj0aETaJUZPqoJq588w==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@size-limit/esbuild/-/esbuild-11.1.4.tgz", + "integrity": "sha512-Nxh+Fw4Z7sFjRLeT7GDZIy297VXyJrMvG20UDSWP31QgglriEBDkW9U77T7W6js5FaEr89bYVrGzpHfmE1CLFw==", "dev": true, + "license": "MIT", "dependencies": { - "esbuild": "^0.20.2", - "nanoid": "^5.0.6" + "esbuild": "^0.21.3", + "nanoid": "^5.0.7" }, "engines": { "node": "^18.0.0 || >=20.0.0" }, "peerDependencies": { - "size-limit": "11.1.2" + "size-limit": "11.1.4" } }, "node_modules/@size-limit/esbuild-why": { - "version": "11.1.2", - "resolved": "https://registry.npmjs.org/@size-limit/esbuild-why/-/esbuild-why-11.1.2.tgz", - "integrity": "sha512-qNCLK2PxgBc2n+yVIdod5xl4LStMqx1HoqDR1cN72fbkUeZ1DTqWnfb/ytvcj3d/u7kHnjT46ythXO7WOVzYjg==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@size-limit/esbuild-why/-/esbuild-why-11.1.4.tgz", + "integrity": "sha512-bcT68pnfhqSZmNYGRMyer0c3FT33AVBsBHJhXzWGxxOzzQ6v1/Ke4bSr8iri4NZTFIZqLSV+/QB/5TKDy3v4Dg==", "dev": true, + "license": "MIT", "dependencies": { "esbuild-visualizer": "^0.6.0", "open": "^10.1.0" @@ -3032,7 +3073,7 @@ "node": "^18.0.0 || >=20.0.0" }, "peerDependencies": { - "size-limit": "11.1.2" + "size-limit": "11.1.4" } }, "node_modules/@size-limit/esbuild-why/node_modules/is-wsl": { @@ -3040,6 +3081,7 @@ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", "dev": true, + "license": "MIT", "dependencies": { "is-inside-container": "^1.0.0" }, @@ -3055,6 +3097,7 @@ "resolved": "https://registry.npmjs.org/open/-/open-10.1.0.tgz", "integrity": "sha512-mnkeQ1qP5Ue2wd+aivTD3NHd/lZ96Lu0jgf0pwktLPtx6cTZiH7tyeGRRHs0zX0rbrahXPnXlUnbeXyaBBuIaw==", "dev": true, + "license": "MIT", "dependencies": { "default-browser": "^5.2.1", "define-lazy-prop": "^3.0.0", @@ -3069,29 +3112,31 @@ } }, "node_modules/@size-limit/file": { - "version": "11.1.2", - "resolved": "https://registry.npmjs.org/@size-limit/file/-/file-11.1.2.tgz", - "integrity": "sha512-zktWwhO7MxVwQXbrZzy0VKfM5mZK3Aza1G3XbWRP8q+/3+irPKCz2fmyYJqJAJVwC9U1jAs6xEPlTJzxKgEAmw==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@size-limit/file/-/file-11.1.4.tgz", + "integrity": "sha512-QxnGj9cxhCEuqMAV01gqonXIKcc+caZqFHZpV51oL2ZJNGSPP9Q/yyf+7HbVe00faOFd1dZZwMwzZmX7HQ9LbA==", "dev": true, + "license": "MIT", "engines": { "node": "^18.0.0 || >=20.0.0" }, "peerDependencies": { - "size-limit": "11.1.2" + "size-limit": "11.1.4" } }, "node_modules/@size-limit/preset-small-lib": { - "version": "11.1.2", - "resolved": "https://registry.npmjs.org/@size-limit/preset-small-lib/-/preset-small-lib-11.1.2.tgz", - "integrity": "sha512-fxZW3woI6SOYyvq44QhlnYdcYfOfiW7zqFCPf+1Ox0OHbrug7YuMz74JNFlHJcnvB4Z6aErED+afkoYJ7vxohQ==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@size-limit/preset-small-lib/-/preset-small-lib-11.1.4.tgz", + "integrity": "sha512-wELW374esv+2Nlzf7g+qW4Af9L69duLoO9F52f0sGk/nzb6et7u8gLRvweWrBfm3itUrqHCpGSSVabTsIU8kNw==", "dev": true, + "license": "MIT", "dependencies": { - "@size-limit/esbuild": "11.1.2", - "@size-limit/file": "11.1.2", - "size-limit": "11.1.2" + "@size-limit/esbuild": "11.1.4", + "@size-limit/file": "11.1.4", + "size-limit": "11.1.4" }, "peerDependencies": { - "size-limit": "11.1.2" + "size-limit": "11.1.4" } }, "node_modules/@testing-library/dom": { @@ -3123,12 +3168,13 @@ } }, "node_modules/@testing-library/jest-dom": { - "version": "6.4.5", - "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.4.5.tgz", - "integrity": "sha512-AguB9yvTXmCnySBP1lWjfNNUwpbElsaQ567lt2VdGqAdHtpieLgjmcVyv1q7PMIvLbgpDdkWV5Ydv3FEejyp2A==", + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.4.6.tgz", + "integrity": "sha512-8qpnGVincVDLEcQXWaHOf6zmlbwTKc6Us6PPu4CRnPXCzo2OGBS5cwgMMOWdxDpEz1mkbvXHpEy99M5Yvt682w==", "dev": true, + "license": "MIT", "dependencies": { - "@adobe/css-tools": "^4.3.2", + "@adobe/css-tools": "^4.4.0", "@babel/runtime": "^7.9.2", "aria-query": "^5.0.0", "chalk": "^3.0.0", @@ -3172,6 +3218,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -3187,6 +3234,7 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -3200,6 +3248,7 @@ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -3211,19 +3260,22 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@testing-library/jest-dom/node_modules/dom-accessibility-api": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz", "integrity": "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@testing-library/react": { - "version": "15.0.6", - "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-15.0.6.tgz", - "integrity": "sha512-UlbazRtEpQClFOiYp+1BapMT+xyqWMnE+hh9tn5DQ6gmlE7AIZWcGpzZukmDZuFk3By01oiqOf8lRedLS4k6xQ==", + "version": "15.0.7", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-15.0.7.tgz", + "integrity": "sha512-cg0RvEdD1TIhhkm1IeYMQxrzy0MtUNfa3minv4MjbgcYzJAZ7yD0i0lwoPOTPr+INtiXFezt2o8xMSnyHhEn2Q==", "dev": true, + "license": "MIT", "dependencies": { "@babel/runtime": "^7.12.5", "@testing-library/dom": "^10.0.0", @@ -3283,10 +3335,11 @@ } }, "node_modules/@testing-library/react/node_modules/@testing-library/dom": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.2.0.tgz", - "integrity": "sha512-CytIvb6tVOADRngTHGWNxH8LPgO/3hi/BdCEHOf7Qd2GvZVClhVP0Wo/QHzWhpki49Bk0b4VT6xpt3fx8HTSIw==", + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.3.1.tgz", + "integrity": "sha512-q/WL+vlXMpC0uXDyfsMtc1rmotzLV8Y0gq6q1gfrrDjQeHoeLrqHbxdPvPNAh1i+xuJl7+BezywcXArz7vLqKQ==", "dev": true, + "license": "MIT", "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", @@ -3588,10 +3641,11 @@ "dev": true }, "node_modules/@types/lodash": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.1.tgz", - "integrity": "sha512-X+2qazGS3jxLAIz5JDXDzglAF3KpijdhFxlf/V1+hEsOUc+HnWi81L/uv/EvGuV90WY+7mPGFCUDGfQC3Gj95Q==", - "dev": true + "version": "4.17.6", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.6.tgz", + "integrity": "sha512-OpXEVoCKSS3lQqjx9GGGOapBeuW5eUboYHRlHP9urXPX25IKZ6AnP5ZRxtVf63iieUbsHxLn8NQ5Nlftc6yzAA==", + "dev": true, + "license": "MIT" }, "node_modules/@types/minimatch": { "version": "5.1.2", @@ -3599,12 +3653,6 @@ "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", "dev": true }, - "node_modules/@types/minimist": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", - "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", - "dev": true - }, "node_modules/@types/node": { "version": "20.12.10", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.10.tgz", @@ -3624,12 +3672,6 @@ "form-data": "^4.0.0" } }, - "node_modules/@types/normalize-package-data": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", - "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", - "dev": true - }, "node_modules/@types/prop-types": { "version": "15.7.4", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.4.tgz", @@ -3637,10 +3679,11 @@ "dev": true }, "node_modules/@types/react": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.1.tgz", - "integrity": "sha512-V0kuGBX3+prX+DQ/7r2qsv1NsdfnCLnTgnRJ1pYnxykBhGMz+qj+box5lq7XsO5mtZsBqpjwwTu/7wszPfMBcw==", + "version": "18.3.3", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.3.tgz", + "integrity": "sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==", "dev": true, + "license": "MIT", "dependencies": { "@types/prop-types": "*", "csstype": "^3.0.2" @@ -3656,10 +3699,11 @@ } }, "node_modules/@types/relay-runtime": { - "version": "14.1.23", - "resolved": "https://registry.npmjs.org/@types/relay-runtime/-/relay-runtime-14.1.23.tgz", - "integrity": "sha512-tP2l6YLI2HJ11UzEB7j4IWeADyiPIKTehdeyHsyOzNBu7WvKsyf4kAZDmsB2NPaXp9Lud+KEJbRi/VW+jEDYCA==", - "dev": true + "version": "14.1.24", + "resolved": "https://registry.npmjs.org/@types/relay-runtime/-/relay-runtime-14.1.24.tgz", + "integrity": "sha512-ta7vPoFXtEG1wu0Mk7sTngzhmfNGnIe8cDiy3yBEm8pJcGpv55YY/+vWrd9gYd9OQht8rALZpXIYSOLzS/0PVg==", + "dev": true, + "license": "MIT" }, "node_modules/@types/resolve": { "version": "1.17.1", @@ -4391,15 +4435,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/ast-types": { "version": "0.16.1", "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.16.1.tgz", @@ -4610,15 +4645,6 @@ "node": ">=8" } }, - "node_modules/breakword": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/breakword/-/breakword-1.0.5.tgz", - "integrity": "sha512-ex5W9DoOQ/LUEU3PMdLs9ua/CYZl1678NUkKOdUSi8Aw5F1idieaiRURCBFJCwVcrD1J8Iy3vfWSloaMwO2qFg==", - "dev": true, - "dependencies": { - "wcwidth": "^1.0.1" - } - }, "node_modules/browser-process-hrtime": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", @@ -4787,23 +4813,6 @@ "node": ">=6" } }, - "node_modules/camelcase-keys": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", - "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", - "dev": true, - "dependencies": { - "camelcase": "^5.3.1", - "map-obj": "^4.0.0", - "quick-lru": "^4.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/caniuse-lite": { "version": "1.0.30001623", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001623.tgz", @@ -4975,15 +4984,6 @@ "node": ">=12" } }, - "node_modules/clone": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", - "dev": true, - "engines": { - "node": ">=0.8" - } - }, "node_modules/co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -5160,39 +5160,6 @@ "integrity": "sha512-jXKhWqXPmlUeoQnF/EhTtTl4C9SnrxSH/jZUih3jmO6lBKr99rP3/+FmrMj4EFpOXzMtXHAZkd3x0E6h6Fgflw==", "dev": true }, - "node_modules/csv": { - "version": "5.5.3", - "resolved": "https://registry.npmjs.org/csv/-/csv-5.5.3.tgz", - "integrity": "sha512-QTaY0XjjhTQOdguARF0lGKm5/mEq9PD9/VhZZegHDIBq2tQwgNpHc3dneD4mGo2iJs+fTKv5Bp0fZ+BRuY3Z0g==", - "dev": true, - "dependencies": { - "csv-generate": "^3.4.3", - "csv-parse": "^4.16.3", - "csv-stringify": "^5.6.5", - "stream-transform": "^2.1.3" - }, - "engines": { - "node": ">= 0.1.90" - } - }, - "node_modules/csv-generate": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/csv-generate/-/csv-generate-3.4.3.tgz", - "integrity": "sha512-w/T+rqR0vwvHqWs/1ZyMDWtHHSJaN06klRqJXBEpDJaM/+dZkso0OKh1VcuuYvK3XM53KysVNq8Ko/epCK8wOw==", - "dev": true - }, - "node_modules/csv-parse": { - "version": "4.16.3", - "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-4.16.3.tgz", - "integrity": "sha512-cO1I/zmz4w2dcKHVvpCr7JVRu8/FymG5OEpmvsZYlccYolPBLoVGKUHgNoc4ZGkFeFlWGEDmMyBM+TTqRdW/wg==", - "dev": true - }, - "node_modules/csv-stringify": { - "version": "5.6.5", - "resolved": "https://registry.npmjs.org/csv-stringify/-/csv-stringify-5.6.5.tgz", - "integrity": "sha512-PjiQ659aQ+fUTQqSrd1XEDnOr52jh30RBurfzkscaE2tPaFsDH5wOAHJiw8XAHphRknCwMUE9KRayc4K/NbO8A==", - "dev": true - }, "node_modules/data-urls": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", @@ -5264,40 +5231,6 @@ } } }, - "node_modules/decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/decamelize-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", - "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", - "dev": true, - "dependencies": { - "decamelize": "^1.1.0", - "map-obj": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/decamelize-keys/node_modules/map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/decimal.js": { "version": "10.3.1", "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.3.1.tgz", @@ -5393,18 +5326,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/defaults": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", - "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", - "dev": true, - "dependencies": { - "clone": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/define-data-property": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", @@ -5791,11 +5712,12 @@ } }, "node_modules/esbuild": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.2.tgz", - "integrity": "sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", "dev": true, "hasInstallScript": true, + "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, @@ -5803,29 +5725,29 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.20.2", - "@esbuild/android-arm": "0.20.2", - "@esbuild/android-arm64": "0.20.2", - "@esbuild/android-x64": "0.20.2", - "@esbuild/darwin-arm64": "0.20.2", - "@esbuild/darwin-x64": "0.20.2", - "@esbuild/freebsd-arm64": "0.20.2", - "@esbuild/freebsd-x64": "0.20.2", - "@esbuild/linux-arm": "0.20.2", - "@esbuild/linux-arm64": "0.20.2", - "@esbuild/linux-ia32": "0.20.2", - "@esbuild/linux-loong64": "0.20.2", - "@esbuild/linux-mips64el": "0.20.2", - "@esbuild/linux-ppc64": "0.20.2", - "@esbuild/linux-riscv64": "0.20.2", - "@esbuild/linux-s390x": "0.20.2", - "@esbuild/linux-x64": "0.20.2", - "@esbuild/netbsd-x64": "0.20.2", - "@esbuild/openbsd-x64": "0.20.2", - "@esbuild/sunos-x64": "0.20.2", - "@esbuild/win32-arm64": "0.20.2", - "@esbuild/win32-ia32": "0.20.2", - "@esbuild/win32-x64": "0.20.2" + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" } }, "node_modules/esbuild-visualizer": { @@ -7210,12 +7132,6 @@ "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", "dev": true }, - "node_modules/grapheme-splitter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", - "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", - "dev": true - }, "node_modules/graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", @@ -7260,15 +7176,6 @@ "graphql": ">=0.11 <=16" } }, - "node_modules/hard-rejection": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", - "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -7385,12 +7292,6 @@ "react-is": "^16.7.0" } }, - "node_modules/hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true - }, "node_modules/html-encoding-sniffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", @@ -7838,15 +7739,6 @@ "node": ">=8" } }, - "node_modules/is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/is-potential-custom-element-name": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", @@ -9367,15 +9259,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/klaw-sync": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz", @@ -9595,18 +9478,6 @@ "tmpl": "1.0.5" } }, - "node_modules/map-obj": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", - "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/marked": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", @@ -9663,56 +9534,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/meow": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/meow/-/meow-6.1.1.tgz", - "integrity": "sha512-3YffViIt2QWgTy6Pale5QpopX/IvU3LPL03jOTqp6pGj3VjesdO/U8CuHMKpnQr4shCNCM5fd5XFFvIIl6JBHg==", - "dev": true, - "dependencies": { - "@types/minimist": "^1.2.0", - "camelcase-keys": "^6.2.2", - "decamelize-keys": "^1.1.0", - "hard-rejection": "^2.1.0", - "minimist-options": "^4.0.2", - "normalize-package-data": "^2.5.0", - "read-pkg-up": "^7.0.1", - "redent": "^3.0.0", - "trim-newlines": "^3.0.0", - "type-fest": "^0.13.1", - "yargs-parser": "^18.1.3" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/meow/node_modules/type-fest": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz", - "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/meow/node_modules/yargs-parser": { - "version": "18.1.3", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", - "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", - "dev": true, - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -9801,20 +9622,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/minimist-options": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", - "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", - "dev": true, - "dependencies": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0", - "kind-of": "^6.0.3" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/minipass": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", @@ -9824,15 +9631,6 @@ "node": ">=16 || 14 >=14.17" } }, - "node_modules/mixme": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/mixme/-/mixme-0.5.4.tgz", - "integrity": "sha512-3KYa4m4Vlqx98GPdOHghxSdNtTvcP8E0kkaJ5Dlh+h2DRzF7zpuVVcA8B0QpKd11YJeP9QQ7ASkKzOeu195Wzw==", - "dev": true, - "engines": { - "node": ">= 8.0.0" - } - }, "node_modules/mkdirp": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", @@ -9845,6 +9643,16 @@ "node": ">=10" } }, + "node_modules/mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -9852,9 +9660,9 @@ "dev": true }, "node_modules/nanoid": { - "version": "5.0.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.6.tgz", - "integrity": "sha512-rRq0eMHoGZxlvaFOUdK1Ev83Bd1IgzzR+WJ3IbDJ7QOSdAxYjlurSPqFs9s4lJg29RT6nPwizFtJhQS6V5xgiA==", + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.7.tgz", + "integrity": "sha512-oLxFY2gd2IqnjcYyOXD8XGCftpGtZP2AbHbOkthDkvRywH5ayNtPVy9YlOPcHckXzbLTCHpkb7FB+yuxKV13pQ==", "dev": true, "funding": [ { @@ -9862,6 +9670,7 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "bin": { "nanoid": "bin/nanoid.js" }, @@ -9953,27 +9762,6 @@ "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", "dev": true }, - "node_modules/normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "node_modules/normalize-package-data/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "dev": true, - "bin": { - "semver": "bin/semver" - } - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -10786,15 +10574,6 @@ } ] }, - "node_modules/quick-lru": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", - "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -10832,10 +10611,11 @@ }, "node_modules/react-19": { "name": "react", - "version": "19.0.0-rc-cc1ec60d0d-20240607", - "resolved": "https://registry.npmjs.org/react/-/react-19.0.0-rc-cc1ec60d0d-20240607.tgz", - "integrity": "sha512-q8A0/IdJ2wdHsjDNO1igFcSSFIMqSKmO7oJZtAjxIA9g0klK45Lxt15NQJ7z7cBvgD1r3xRTtQ/MAqnmwYHs1Q==", + "version": "19.0.0-rc-fb9a90fa48-20240614", + "resolved": "https://registry.npmjs.org/react/-/react-19.0.0-rc-fb9a90fa48-20240614.tgz", + "integrity": "sha512-nvE3Gy+IOIfH/DXhkyxFVQSrITarFcQz4+shzC/McxQXEUSonpw2oDy/Wi9hdDtV3hlP12VYuDL95iiBREedNQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -10880,22 +10660,24 @@ }, "node_modules/react-dom-19": { "name": "react-dom", - "version": "19.0.0-rc-cc1ec60d0d-20240607", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.0.0-rc-cc1ec60d0d-20240607.tgz", - "integrity": "sha512-paspD9kAfKKuURVwKWJ0/g3qYw1DGi9h1k9xQV2iQN9cSVZ4JAOD727yjVLyp1zdzsoygjFfLMtSBdZ+oERYvA==", + "version": "19.0.0-rc-fb9a90fa48-20240614", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.0.0-rc-fb9a90fa48-20240614.tgz", + "integrity": "sha512-PoEsPe32F7KPLYOBvZfjylEI1B67N44PwY3lyvpmBkhlluLnLz0jH8q2Wg9YidAi6z0k3iUnNRm5x10wurzt9Q==", "dev": true, + "license": "MIT", "dependencies": { - "scheduler": "0.25.0-rc-cc1ec60d0d-20240607" + "scheduler": "0.25.0-rc-fb9a90fa48-20240614" }, "peerDependencies": { - "react": "19.0.0-rc-cc1ec60d0d-20240607" + "react": "19.0.0-rc-fb9a90fa48-20240614" } }, "node_modules/react-dom-19/node_modules/scheduler": { - "version": "0.25.0-rc-cc1ec60d0d-20240607", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.25.0-rc-cc1ec60d0d-20240607.tgz", - "integrity": "sha512-yFVKy6SDJkN2bOJSeH6gNo4+1MTygTZXnLRY5IHvEB6P9+O6WYRWz9PkELLjnl64lQwRgiigwzWQRSMNEboOGQ==", - "dev": true + "version": "0.25.0-rc-fb9a90fa48-20240614", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.25.0-rc-fb9a90fa48-20240614.tgz", + "integrity": "sha512-HHqQ/SqbeiDfXXVKgNxTpbQTD4n7IUb4hZATvHjp03jr3TF7igehCyHdOjeYTrzIseLO93cTTfSb5f4qWcirMQ==", + "dev": true, + "license": "MIT" }, "node_modules/react-error-boundary": { "version": "4.0.13", @@ -10914,56 +10696,6 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, - "node_modules/read-pkg": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", - "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", - "dev": true, - "dependencies": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/read-pkg-up": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", - "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", - "dev": true, - "dependencies": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/read-pkg-up/node_modules/type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/read-pkg/node_modules/type-fest": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", - "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/read-yaml-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/read-yaml-file/-/read-yaml-file-1.1.0.tgz", @@ -11001,10 +10733,11 @@ } }, "node_modules/recast": { - "version": "0.23.6", - "resolved": "https://registry.npmjs.org/recast/-/recast-0.23.6.tgz", - "integrity": "sha512-9FHoNjX1yjuesMwuthAmPKabxYQdOgihFYmT5ebXfYGBcnqXZf3WOVz+5foEZ8Y83P4ZY6yQD5GMmtV+pgCCAQ==", + "version": "0.23.9", + "resolved": "https://registry.npmjs.org/recast/-/recast-0.23.9.tgz", + "integrity": "sha512-Hx/BGIbwj+Des3+xy5uAtAbdCyqK9y9wbBcDFDYanLS9JnMqf7OeF87HQwUimE87OEc72mr6tkKUKMBBL+hF9Q==", "dev": true, + "license": "MIT", "dependencies": { "ast-types": "^0.16.1", "esprima": "~4.0.0", @@ -11096,12 +10829,6 @@ "node": ">=0.10.0" } }, - "node_modules/require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, "node_modules/requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", @@ -11183,10 +10910,11 @@ } }, "node_modules/rimraf": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.5.tgz", - "integrity": "sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==", + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.7.tgz", + "integrity": "sha512-nV6YcJo5wbLW77m+8KjH8aB/7/rxQy9SZ0HY5shnwULfS+9nmTtVXAJET5NdZmCzA4fPI/Hm1wo/Po/4mopOdg==", "dev": true, + "license": "ISC", "dependencies": { "glob": "^10.3.7" }, @@ -11194,7 +10922,7 @@ "rimraf": "dist/esm/bin.mjs" }, "engines": { - "node": ">=14" + "node": ">=14.18" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -11205,6 +10933,7 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } @@ -11214,6 +10943,7 @@ "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.2.tgz", "integrity": "sha512-GwMlUF6PkPo3Gk21UxkCohOv0PLcIXVtKyLlpEI28R/cO/4eNOdmLk3CMW1wROV/WR/EsZOWAfBbBOqYvs88/w==", "dev": true, + "license": "ISC", "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", @@ -11233,10 +10963,11 @@ } }, "node_modules/rimraf/node_modules/minimatch": { - "version": "9.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", - "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, + "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" }, @@ -11449,12 +11180,6 @@ "randombytes": "^2.1.0" } }, - "node_modules/set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", - "dev": true - }, "node_modules/set-function-length": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", @@ -11546,10 +11271,11 @@ "dev": true }, "node_modules/size-limit": { - "version": "11.1.2", - "resolved": "https://registry.npmjs.org/size-limit/-/size-limit-11.1.2.tgz", - "integrity": "sha512-W9V/QR98fiLgGg+S77DNy7usExpz7HCdDAqm2t2Q77GWCV//wWUC6hyZA9QXKk1x6bxMMTzq1vmncw5Cve/43w==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/size-limit/-/size-limit-11.1.4.tgz", + "integrity": "sha512-V2JAI/Z7h8sEuxU3V+Ig3XKA5FcYbI4CZ7sh6s7wvuy+TUwDZYqw7sAqrHhQ4cgcNfPKIAHAaH8VaqOdbcwJDA==", "dev": true, + "license": "MIT", "dependencies": { "bytes-iec": "^3.1.1", "chokidar": "^3.6.0", @@ -11557,7 +11283,7 @@ "jiti": "^1.21.0", "lilconfig": "^3.1.1", "nanospinner": "^1.1.0", - "picocolors": "^1.0.0" + "picocolors": "^1.0.1" }, "bin": { "size-limit": "bin.js" @@ -11567,10 +11293,11 @@ } }, "node_modules/size-limit/node_modules/globby": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.1.tgz", - "integrity": "sha512-jOMLD2Z7MAhyG8aJpNOpmziMOP4rPLcc95oQPKXBazW82z+CEgPFBQvEpRUa1KeIMUJo4Wsm+q6uzO/Q/4BksQ==", + "version": "14.0.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.2.tgz", + "integrity": "sha512-s3Fq41ZVh7vbbe2PN3nrW7yC7U7MFVc5c98/iTl9c2GawNMKx/J648KQRW6WKkuU8GIbbh2IXfIRQjOZnXcTnw==", "dev": true, + "license": "MIT", "dependencies": { "@sindresorhus/merge-streams": "^2.1.0", "fast-glob": "^3.3.2", @@ -11591,6 +11318,7 @@ "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz", "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -11603,6 +11331,7 @@ "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", "dev": true, + "license": "MIT", "engines": { "node": ">=14.16" }, @@ -11640,125 +11369,6 @@ "node": ">=8" } }, - "node_modules/smartwrap": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/smartwrap/-/smartwrap-2.0.2.tgz", - "integrity": "sha512-vCsKNQxb7PnCNd2wY1WClWifAc2lwqsG8OaswpJkVJsvMGcnEntdTCDajZCkk93Ay1U3t/9puJmb525Rg5MZBA==", - "dev": true, - "dependencies": { - "array.prototype.flat": "^1.2.3", - "breakword": "^1.0.5", - "grapheme-splitter": "^1.0.4", - "strip-ansi": "^6.0.0", - "wcwidth": "^1.0.1", - "yargs": "^15.1.0" - }, - "bin": { - "smartwrap": "src/terminal-adapter.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/smartwrap/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/smartwrap/node_modules/cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - } - }, - "node_modules/smartwrap/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/smartwrap/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/smartwrap/node_modules/wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/smartwrap/node_modules/y18n": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", - "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", - "dev": true - }, - "node_modules/smartwrap/node_modules/yargs": { - "version": "15.4.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", - "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", - "dev": true, - "dependencies": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/smartwrap/node_modules/yargs-parser": { - "version": "18.1.3", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", - "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", - "dev": true, - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -11855,38 +11465,6 @@ "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==", "dev": true }, - "node_modules/spdx-correct": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", - "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", - "dev": true, - "dependencies": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-exceptions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", - "dev": true - }, - "node_modules/spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, - "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-license-ids": { - "version": "3.0.12", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.12.tgz", - "integrity": "sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA==", - "dev": true - }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -11926,15 +11504,6 @@ "node": ">= 0.4" } }, - "node_modules/stream-transform": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/stream-transform/-/stream-transform-2.1.3.tgz", - "integrity": "sha512-9GHUiM5hMiCi6Y03jD2ARC1ettBXkQBoQAe7nJsPknnI0ow10aXjTnew8QtYQmLjzn974BnmWEAJgCY6ZP1DeQ==", - "dev": true, - "dependencies": { - "mixme": "^0.5.1" - } - }, "node_modules/string-argv": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", @@ -12196,10 +11765,11 @@ } }, "node_modules/terser": { - "version": "5.31.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.31.0.tgz", - "integrity": "sha512-Q1JFAoUKE5IMfI4Z/lkE/E6+SwgzO+x4tq4v1AyBLRj8VSYvRO6A/rQrPg1yud4g0En9EKI1TvFRF2tQFcoUkg==", + "version": "5.31.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.31.1.tgz", + "integrity": "sha512-37upzU1+viGvuFtBo9NPufCb9dwM0+l9hMxYyWfBA+fbwrPqNJAhbZ6W47bBFnZHKHTUBnMvi87434qq+qnxOg==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.8.2", @@ -12331,15 +11901,6 @@ "punycode": "^2.1.0" } }, - "node_modules/trim-newlines": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", - "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/ts-api-utils": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", @@ -12370,10 +11931,11 @@ } }, "node_modules/ts-jest": { - "version": "29.1.2", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz", - "integrity": "sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==", + "version": "29.1.5", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.5.tgz", + "integrity": "sha512-UuClSYxM7byvvYfyWdFI+/2UxMmwNyJb0NPkZPQE2hew3RurV7l7zURgOHAd/1I1ZdPpe3GUsXNXAcN8TFKSIg==", "dev": true, + "license": "MIT", "dependencies": { "bs-logger": "0.x", "fast-json-stable-stringify": "2.x", @@ -12388,10 +11950,11 @@ "ts-jest": "cli.js" }, "engines": { - "node": "^16.10.0 || ^18.0.0 || >=20.0.0" + "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0" }, "peerDependencies": { "@babel/core": ">=7.0.0-beta.0 <8", + "@jest/transform": "^29.0.0", "@jest/types": "^29.0.0", "babel-jest": "^29.0.0", "jest": "^29.0.0", @@ -12401,6 +11964,9 @@ "@babel/core": { "optional": true }, + "@jest/transform": { + "optional": true + }, "@jest/types": { "optional": true }, @@ -12426,6 +11992,7 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -12557,36 +12124,6 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, - "node_modules/tty-table": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/tty-table/-/tty-table-4.1.6.tgz", - "integrity": "sha512-kRj5CBzOrakV4VRRY5kUWbNYvo/FpOsz65DzI5op9P+cHov3+IqPbo1JE1ZnQGkHdZgNFDsrEjrfqqy/Ply9fw==", - "dev": true, - "dependencies": { - "chalk": "^4.1.2", - "csv": "^5.5.0", - "kleur": "^4.1.4", - "smartwrap": "^2.0.2", - "strip-ansi": "^6.0.0", - "wcwidth": "^1.0.1", - "yargs": "^17.1.1" - }, - "bin": { - "tty-table": "adapters/terminal-adapter.js" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/tty-table/node_modules/kleur": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", - "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", @@ -12731,10 +12268,11 @@ } }, "node_modules/typescript": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz", - "integrity": "sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==", + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz", + "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -12882,16 +12420,6 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "dependencies": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, "node_modules/validate-npm-package-name": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-5.0.0.tgz", @@ -12970,15 +12498,6 @@ "makeerror": "1.0.12" } }, - "node_modules/wcwidth": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", - "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", - "dev": true, - "dependencies": { - "defaults": "^1.0.3" - } - }, "node_modules/web-streams-polyfill": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0.tgz", @@ -13081,12 +12600,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q==", - "dev": true - }, "node_modules/which-pm": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-pm/-/which-pm-2.0.0.tgz", diff --git a/package.json b/package.json index 4015ecf87f7..c9bfcd4f6e1 100644 --- a/package.json +++ b/package.json @@ -108,18 +108,18 @@ }, "devDependencies": { "@arethetypeswrong/cli": "0.15.3", - "@babel/parser": "7.24.5", + "@babel/parser": "7.24.7", "@changesets/changelog-github": "0.5.0", - "@changesets/cli": "2.27.1", - "@graphql-tools/merge": "9.0.3", - "@graphql-tools/schema": "10.0.3", + "@changesets/cli": "2.27.7", + "@graphql-tools/merge": "9.0.4", + "@graphql-tools/schema": "10.0.4", "@graphql-tools/utils": "10.2.0", "@microsoft/api-extractor": "7.47.0", "@rollup/plugin-node-resolve": "11.2.1", - "@size-limit/esbuild-why": "11.1.2", - "@size-limit/preset-small-lib": "11.1.2", - "@testing-library/jest-dom": "6.4.5", - "@testing-library/react": "15.0.6", + "@size-limit/esbuild-why": "11.1.4", + "@size-limit/preset-small-lib": "11.1.4", + "@testing-library/jest-dom": "6.4.6", + "@testing-library/react": "15.0.7", "@testing-library/react-12": "npm:@testing-library/react@^12", "@testing-library/user-event": "14.5.2", "@tsconfig/node20": "20.1.4", @@ -128,12 +128,12 @@ "@types/glob": "8.1.0", "@types/hoist-non-react-statics": "3.3.5", "@types/jest": "29.5.12", - "@types/lodash": "4.17.1", + "@types/lodash": "4.17.6", "@types/node": "20.12.10", "@types/node-fetch": "2.6.11", - "@types/react": "18.3.1", + "@types/react": "18.3.3", "@types/react-dom": "18.3.0", - "@types/relay-runtime": "14.1.23", + "@types/relay-runtime": "14.1.24", "@types/use-sync-external-store": "0.0.6", "@typescript-eslint/eslint-plugin": "7.9.0", "@typescript-eslint/parser": "7.9.0", @@ -165,28 +165,28 @@ "prettier": "3.1.1", "react": "18.3.1", "react-17": "npm:react@^17", - "react-19": "npm:react@19.0.0-rc-cc1ec60d0d-20240607", + "react-19": "npm:react@19.0.0-rc-fb9a90fa48-20240614", "react-dom": "18.3.1", "react-dom-17": "npm:react-dom@^17", - "react-dom-19": "npm:react-dom@19.0.0-rc-cc1ec60d0d-20240607", + "react-dom-19": "npm:react-dom@19.0.0-rc-fb9a90fa48-20240614", "react-error-boundary": "4.0.13", - "recast": "0.23.6", + "recast": "0.23.9", "resolve": "1.22.8", - "rimraf": "5.0.5", + "rimraf": "5.0.7", "rollup": "2.79.1", "rollup-plugin-cleanup": "3.2.1", "rollup-plugin-terser": "7.0.2", "rxjs": "7.8.1", - "size-limit": "11.1.2", + "size-limit": "11.1.4", "subscriptions-transport-ws": "0.11.0", - "terser": "5.31.0", + "terser": "5.31.1", "ts-api-utils": "1.3.0", - "ts-jest": "29.1.2", + "ts-jest": "29.1.5", "ts-jest-resolver": "2.0.1", "ts-morph": "22.0.0", "ts-node": "10.9.2", "typedoc": "0.25.0", - "typescript": "5.5.2", + "typescript": "5.5.3", "wait-for-observables": "1.0.3", "web-streams-polyfill": "4.0.0", "whatwg-fetch": "3.6.20" From 5002b9454ac8769b214d3f5a517b6164f221bdfc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jul 2024 17:07:28 -0600 Subject: [PATCH 05/17] chore(deps): update all devdependencies (#11867) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package-lock.json | 164 +++++++++++------------ package.json | 18 +-- scripts/codemods/ac2-to-ac3/package.json | 2 +- scripts/memory/package.json | 2 +- 4 files changed, 87 insertions(+), 99 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6238c74bb3e..dd9d7458937 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,7 @@ "@changesets/cli": "2.27.7", "@graphql-tools/merge": "9.0.4", "@graphql-tools/schema": "10.0.4", - "@graphql-tools/utils": "10.2.0", + "@graphql-tools/utils": "10.3.1", "@microsoft/api-extractor": "7.47.0", "@rollup/plugin-node-resolve": "11.2.1", "@size-limit/esbuild-why": "11.1.4", @@ -48,18 +48,18 @@ "@types/hoist-non-react-statics": "3.3.5", "@types/jest": "29.5.12", "@types/lodash": "4.17.6", - "@types/node": "20.12.10", + "@types/node": "20.14.10", "@types/node-fetch": "2.6.11", "@types/react": "18.3.3", "@types/react-dom": "18.3.0", "@types/relay-runtime": "14.1.24", "@types/use-sync-external-store": "0.0.6", - "@typescript-eslint/eslint-plugin": "7.9.0", - "@typescript-eslint/parser": "7.9.0", - "@typescript-eslint/rule-tester": "7.9.0", - "@typescript-eslint/types": "7.9.0", - "@typescript-eslint/utils": "7.9.0", - "acorn": "8.11.3", + "@typescript-eslint/eslint-plugin": "7.15.0", + "@typescript-eslint/parser": "7.15.0", + "@typescript-eslint/rule-tester": "7.15.0", + "@typescript-eslint/types": "7.15.0", + "@typescript-eslint/utils": "7.15.0", + "acorn": "8.12.1", "ajv": "8.16.0", "blob-polyfill": "7.0.20220408", "bytes": "3.1.2", @@ -74,7 +74,7 @@ "expect-type": "0.19.0", "fetch-mock": "9.11.0", "glob": "8.1.0", - "graphql": "16.8.1", + "graphql": "16.9.0", "graphql-ws": "5.16.0", "jest": "29.7.0", "jest-environment-jsdom": "29.7.0", @@ -1988,7 +1988,7 @@ "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, - "node_modules/@graphql-tools/schema/node_modules/@graphql-tools/utils": { + "node_modules/@graphql-tools/utils": { "version": "10.3.1", "resolved": "https://registry.npmjs.org/@graphql-tools/utils/-/utils-10.3.1.tgz", "integrity": "sha512-Yhk1F0MNk4/ctgl3d0DKq++ZPovvZuh1ixWuUEVAxrFloYOAVwJ+rvGI1lsopArdJly8QXClT9lkvOxQszMw/w==", @@ -2007,24 +2007,6 @@ "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, - "node_modules/@graphql-tools/utils": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/@graphql-tools/utils/-/utils-10.2.0.tgz", - "integrity": "sha512-HYV7dO6pNA2nGKawygaBpk8y+vXOUjjzzO43W/Kb7EPRmXUEQKjHxPYRvQbiF72u1N3XxwGK5jnnFk9WVhUwYw==", - "dev": true, - "dependencies": { - "@graphql-typed-document-node/core": "^3.1.1", - "cross-inspect": "1.0.0", - "dset": "^3.1.2", - "tslib": "^2.4.0" - }, - "engines": { - "node": ">=16.0.0" - }, - "peerDependencies": { - "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" - } - }, "node_modules/@graphql-typed-document-node/core": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/@graphql-typed-document-node/core/-/core-3.1.1.tgz", @@ -3654,10 +3636,11 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.12.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.10.tgz", - "integrity": "sha512-Eem5pH9pmWBHoGAT8Dr5fdc5rYA+4NAovdM4EktRPVAAiJhmWWfQrA0cFhAbOsQdSfIHjAud6YdkbL69+zSKjw==", + "version": "20.14.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.10.tgz", + "integrity": "sha512-MdiXf+nDuMvY0gJKxyfZ7/6UFsETO7mGKF54MVD/ekJS6HdFtpZFBgrh6Pseu64XTb2MLyFPlbW6hj8HYRQNOQ==", "dev": true, + "license": "MIT", "dependencies": { "undici-types": "~5.26.4" } @@ -3760,17 +3743,17 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.9.0.tgz", - "integrity": "sha512-6e+X0X3sFe/G/54aC3jt0txuMTURqLyekmEHViqyA2VnxhLMpvA6nqmcjIy+Cr9tLDHPssA74BP5Mx9HQIxBEA==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.15.0.tgz", + "integrity": "sha512-uiNHpyjZtFrLwLDpHnzaDlP3Tt6sGMqTCiqmxaN4n4RP0EfYZDODJyddiFDF44Hjwxr5xAcaYxVKm9QKQFJFLA==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "7.9.0", - "@typescript-eslint/type-utils": "7.9.0", - "@typescript-eslint/utils": "7.9.0", - "@typescript-eslint/visitor-keys": "7.9.0", + "@typescript-eslint/scope-manager": "7.15.0", + "@typescript-eslint/type-utils": "7.15.0", + "@typescript-eslint/utils": "7.15.0", + "@typescript-eslint/visitor-keys": "7.15.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -3794,16 +3777,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.9.0.tgz", - "integrity": "sha512-qHMJfkL5qvgQB2aLvhUSXxbK7OLnDkwPzFalg458pxQgfxKDfT1ZDbHQM/I6mDIf/svlMkj21kzKuQ2ixJlatQ==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.15.0.tgz", + "integrity": "sha512-k9fYuQNnypLFcqORNClRykkGOMOj+pV6V91R4GO/l1FDGwpqmSwoOQrOHo3cGaH63e+D3ZiCAOsuS/D2c99j/A==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/scope-manager": "7.9.0", - "@typescript-eslint/types": "7.9.0", - "@typescript-eslint/typescript-estree": "7.9.0", - "@typescript-eslint/visitor-keys": "7.9.0", + "@typescript-eslint/scope-manager": "7.15.0", + "@typescript-eslint/types": "7.15.0", + "@typescript-eslint/typescript-estree": "7.15.0", + "@typescript-eslint/visitor-keys": "7.15.0", "debug": "^4.3.4" }, "engines": { @@ -3823,15 +3806,16 @@ } }, "node_modules/@typescript-eslint/rule-tester": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/rule-tester/-/rule-tester-7.9.0.tgz", - "integrity": "sha512-Oz5IB1kCUToVS0Nvkpgx5Vb89J+7iSsBAWKvfxQFWmcYpiqdStO6eRI2cAuRNrqo6uGh2sNsAji9hcv/KrHwMQ==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/rule-tester/-/rule-tester-7.15.0.tgz", + "integrity": "sha512-QyBNG3gTpUJKb+Kx0hMbfZk9K7a3VnWEcWygZyKbw6ihTt/pf7c7AaR7JNbdnrFYc0q3JOgCXdKq8JM4RsAeaA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "7.9.0", - "@typescript-eslint/utils": "7.9.0", + "@typescript-eslint/typescript-estree": "7.15.0", + "@typescript-eslint/utils": "7.15.0", "ajv": "^6.12.6", + "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "4.6.2", "semver": "^7.6.0" }, @@ -3852,6 +3836,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, + "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -3867,7 +3852,8 @@ "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@typescript-eslint/rule-tester/node_modules/semver": { "version": "7.6.2", @@ -3883,14 +3869,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.9.0.tgz", - "integrity": "sha512-ZwPK4DeCDxr3GJltRz5iZejPFAAr4Wk3+2WIBaj1L5PYK5RgxExu/Y68FFVclN0y6GGwH8q+KgKRCvaTmFBbgQ==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.15.0.tgz", + "integrity": "sha512-Q/1yrF/XbxOTvttNVPihxh1b9fxamjEoz2Os/Pe38OHwxC24CyCqXxGTOdpb4lt6HYtqw9HetA/Rf6gDGaMPlw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "7.9.0", - "@typescript-eslint/visitor-keys": "7.9.0" + "@typescript-eslint/types": "7.15.0", + "@typescript-eslint/visitor-keys": "7.15.0" }, "engines": { "node": "^18.18.0 || >=20.0.0" @@ -3901,14 +3887,14 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.9.0.tgz", - "integrity": "sha512-6Qy8dfut0PFrFRAZsGzuLoM4hre4gjzWJB6sUvdunCYZsYemTkzZNwF1rnGea326PHPT3zn5Lmg32M/xfJfByA==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.15.0.tgz", + "integrity": "sha512-SkgriaeV6PDvpA6253PDVep0qCqgbO1IOBiycjnXsszNTVQe5flN5wR5jiczoEoDEnAqYFSFFc9al9BSGVltkg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "7.9.0", - "@typescript-eslint/utils": "7.9.0", + "@typescript-eslint/typescript-estree": "7.15.0", + "@typescript-eslint/utils": "7.15.0", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, @@ -3929,9 +3915,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.9.0.tgz", - "integrity": "sha512-oZQD9HEWQanl9UfsbGVcZ2cGaR0YT5476xfWE0oE5kQa2sNK2frxOlkeacLOTh9po4AlUT5rtkGyYM5kew0z5w==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.15.0.tgz", + "integrity": "sha512-aV1+B1+ySXbQH0pLK0rx66I3IkiZNidYobyfn0WFsdGhSXw+P3YOqeTq5GED458SfB24tg+ux3S+9g118hjlTw==", "dev": true, "license": "MIT", "engines": { @@ -3943,14 +3929,14 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.9.0.tgz", - "integrity": "sha512-zBCMCkrb2YjpKV3LA0ZJubtKCDxLttxfdGmwZvTqqWevUPN0FZvSI26FalGFFUZU/9YQK/A4xcQF9o/VVaCKAg==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.15.0.tgz", + "integrity": "sha512-gjyB/rHAopL/XxfmYThQbXbzRMGhZzGw6KpcMbfe8Q3nNQKStpxnUKeXb0KiN/fFDR42Z43szs6rY7eHk0zdGQ==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/types": "7.9.0", - "@typescript-eslint/visitor-keys": "7.9.0", + "@typescript-eslint/types": "7.15.0", + "@typescript-eslint/visitor-keys": "7.15.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -3982,9 +3968,9 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { - "version": "9.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", - "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, "license": "ISC", "dependencies": { @@ -4011,16 +3997,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.9.0.tgz", - "integrity": "sha512-5KVRQCzZajmT4Ep+NEgjXCvjuypVvYHUW7RHlXzNPuak2oWpVoD1jf5xCP0dPAuNIchjC7uQyvbdaSTFaLqSdA==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.15.0.tgz", + "integrity": "sha512-hfDMDqaqOqsUVGiEPSMLR/AjTSCsmJwjpKkYQRo1FNbmW4tBwBspYDwO9eh7sKSTwMQgBw9/T4DHudPaqshRWA==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "7.9.0", - "@typescript-eslint/types": "7.9.0", - "@typescript-eslint/typescript-estree": "7.9.0" + "@typescript-eslint/scope-manager": "7.15.0", + "@typescript-eslint/types": "7.15.0", + "@typescript-eslint/typescript-estree": "7.15.0" }, "engines": { "node": "^18.18.0 || >=20.0.0" @@ -4034,13 +4020,13 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.9.0.tgz", - "integrity": "sha512-iESPx2TNLDNGQLyjKhUvIKprlP49XNEK+MvIf9nIO7ZZaZdbnfWKHnXAgufpxqfA0YryH8XToi4+CjBgVnFTSQ==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.15.0.tgz", + "integrity": "sha512-Hqgy/ETgpt2L5xueA/zHHIl4fJI2O4XUE9l4+OIfbJIRSnTJb/QscncdqqZzofQegIJugRIF57OJea1khw2SDw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "7.9.0", + "@typescript-eslint/types": "7.15.0", "eslint-visitor-keys": "^3.4.3" }, "engines": { @@ -4114,10 +4100,11 @@ "dev": true }, "node_modules/acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", "dev": true, + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -7139,10 +7126,11 @@ "dev": true }, "node_modules/graphql": { - "version": "16.8.1", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.8.1.tgz", - "integrity": "sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==", + "version": "16.9.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.9.0.tgz", + "integrity": "sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw==", "dev": true, + "license": "MIT", "engines": { "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" } diff --git a/package.json b/package.json index c9bfcd4f6e1..95195f4b93e 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,7 @@ "@changesets/cli": "2.27.7", "@graphql-tools/merge": "9.0.4", "@graphql-tools/schema": "10.0.4", - "@graphql-tools/utils": "10.2.0", + "@graphql-tools/utils": "10.3.1", "@microsoft/api-extractor": "7.47.0", "@rollup/plugin-node-resolve": "11.2.1", "@size-limit/esbuild-why": "11.1.4", @@ -129,18 +129,18 @@ "@types/hoist-non-react-statics": "3.3.5", "@types/jest": "29.5.12", "@types/lodash": "4.17.6", - "@types/node": "20.12.10", + "@types/node": "20.14.10", "@types/node-fetch": "2.6.11", "@types/react": "18.3.3", "@types/react-dom": "18.3.0", "@types/relay-runtime": "14.1.24", "@types/use-sync-external-store": "0.0.6", - "@typescript-eslint/eslint-plugin": "7.9.0", - "@typescript-eslint/parser": "7.9.0", - "@typescript-eslint/rule-tester": "7.9.0", - "@typescript-eslint/types": "7.9.0", - "@typescript-eslint/utils": "7.9.0", - "acorn": "8.11.3", + "@typescript-eslint/eslint-plugin": "7.15.0", + "@typescript-eslint/parser": "7.15.0", + "@typescript-eslint/rule-tester": "7.15.0", + "@typescript-eslint/types": "7.15.0", + "@typescript-eslint/utils": "7.15.0", + "acorn": "8.12.1", "ajv": "8.16.0", "blob-polyfill": "7.0.20220408", "bytes": "3.1.2", @@ -155,7 +155,7 @@ "expect-type": "0.19.0", "fetch-mock": "9.11.0", "glob": "8.1.0", - "graphql": "16.8.1", + "graphql": "16.9.0", "graphql-ws": "5.16.0", "jest": "29.7.0", "jest-environment-jsdom": "29.7.0", diff --git a/scripts/codemods/ac2-to-ac3/package.json b/scripts/codemods/ac2-to-ac3/package.json index 10edeac9d56..4ef497695f4 100644 --- a/scripts/codemods/ac2-to-ac3/package.json +++ b/scripts/codemods/ac2-to-ac3/package.json @@ -1,6 +1,6 @@ { "private": true, "devDependencies": { - "jscodeshift": "0.15.2" + "jscodeshift": "0.16.1" } } diff --git a/scripts/memory/package.json b/scripts/memory/package.json index e637bb89e7b..123c7adde5f 100644 --- a/scripts/memory/package.json +++ b/scripts/memory/package.json @@ -9,6 +9,6 @@ "graphql": "^16.0.0" }, "devDependencies": { - "mocha": "10.4.0" + "mocha": "10.6.0" } } From 96422ce95b923b560321a88acd2eec35cf2a1c18 Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Mon, 8 Jul 2024 10:28:18 +0200 Subject: [PATCH 06/17] Add `cause` field to `ApolloError`. (#11902) * Add `cause` field to `ApolloError`. * review feedback: include `protocolErrors` * Clean up Prettier, Size-limit, and Api-Extractor --------- Co-authored-by: phryneas --- .api-reports/api-report-core.api.md | 4 ++++ .api-reports/api-report-errors.api.md | 4 ++++ .api-reports/api-report-react.api.md | 4 ++++ .../api-report-react_components.api.md | 4 ++++ .api-reports/api-report-react_context.api.md | 4 ++++ .api-reports/api-report-react_hoc.api.md | 4 ++++ .api-reports/api-report-react_hooks.api.md | 4 ++++ .api-reports/api-report-react_internal.api.md | 4 ++++ .api-reports/api-report-react_ssr.api.md | 4 ++++ .api-reports/api-report-testing.api.md | 4 ++++ .api-reports/api-report-testing_core.api.md | 4 ++++ .api-reports/api-report-utilities.api.md | 4 ++++ .api-reports/api-report.api.md | 4 ++++ .changeset/flat-onions-guess.md | 5 +++++ .size-limits.json | 4 ++-- src/errors/index.ts | 18 ++++++++++++++++++ 16 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 .changeset/flat-onions-guess.md diff --git a/.api-reports/api-report-core.api.md b/.api-reports/api-report-core.api.md index de8b71f9153..35789a58440 100644 --- a/.api-reports/api-report-core.api.md +++ b/.api-reports/api-report-core.api.md @@ -172,6 +172,10 @@ export interface ApolloClientOptions { export class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); + cause: ({ + message: string; + extensions?: GraphQLErrorExtensions[]; + } & Partial) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) diff --git a/.api-reports/api-report-errors.api.md b/.api-reports/api-report-errors.api.md index 205b170bf0f..2b3d65a0558 100644 --- a/.api-reports/api-report-errors.api.md +++ b/.api-reports/api-report-errors.api.md @@ -11,6 +11,10 @@ import type { GraphQLErrorExtensions } from 'graphql'; // @public (undocumented) export class ApolloError extends Error { constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); + cause: ({ + message: string; + extensions?: GraphQLErrorExtensions[]; + } & Partial) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) diff --git a/.api-reports/api-report-react.api.md b/.api-reports/api-report-react.api.md index 368a7fdc53f..c81d938a887 100644 --- a/.api-reports/api-report-react.api.md +++ b/.api-reports/api-report-react.api.md @@ -223,6 +223,10 @@ export interface ApolloContextValue { class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); + cause: ({ + message: string; + extensions?: GraphQLErrorExtensions[]; + } & Partial) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) diff --git a/.api-reports/api-report-react_components.api.md b/.api-reports/api-report-react_components.api.md index b9bd5eda67e..efb4ddab230 100644 --- a/.api-reports/api-report-react_components.api.md +++ b/.api-reports/api-report-react_components.api.md @@ -201,6 +201,10 @@ interface ApolloClientOptions { class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); + cause: ({ + message: string; + extensions?: GraphQLErrorExtensions[]; + } & Partial) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) diff --git a/.api-reports/api-report-react_context.api.md b/.api-reports/api-report-react_context.api.md index bc1878779ad..41aed0f90c4 100644 --- a/.api-reports/api-report-react_context.api.md +++ b/.api-reports/api-report-react_context.api.md @@ -221,6 +221,10 @@ export interface ApolloContextValue { class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); + cause: ({ + message: string; + extensions?: GraphQLErrorExtensions[]; + } & Partial) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) diff --git a/.api-reports/api-report-react_hoc.api.md b/.api-reports/api-report-react_hoc.api.md index a5cf57a3c8d..18f094dde4c 100644 --- a/.api-reports/api-report-react_hoc.api.md +++ b/.api-reports/api-report-react_hoc.api.md @@ -200,6 +200,10 @@ interface ApolloClientOptions { class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); + cause: ({ + message: string; + extensions?: GraphQLErrorExtensions[]; + } & Partial) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) diff --git a/.api-reports/api-report-react_hooks.api.md b/.api-reports/api-report-react_hooks.api.md index a88a99c06ca..b5ee3e1c051 100644 --- a/.api-reports/api-report-react_hooks.api.md +++ b/.api-reports/api-report-react_hooks.api.md @@ -199,6 +199,10 @@ interface ApolloClientOptions { class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); + cause: ({ + message: string; + extensions?: GraphQLErrorExtensions[]; + } & Partial) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) diff --git a/.api-reports/api-report-react_internal.api.md b/.api-reports/api-report-react_internal.api.md index be65e4e3a3f..95a7366593c 100644 --- a/.api-reports/api-report-react_internal.api.md +++ b/.api-reports/api-report-react_internal.api.md @@ -199,6 +199,10 @@ interface ApolloClientOptions { class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); + cause: ({ + message: string; + extensions?: GraphQLErrorExtensions[]; + } & Partial) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) diff --git a/.api-reports/api-report-react_ssr.api.md b/.api-reports/api-report-react_ssr.api.md index f4ca55a6daf..ea788b305b9 100644 --- a/.api-reports/api-report-react_ssr.api.md +++ b/.api-reports/api-report-react_ssr.api.md @@ -200,6 +200,10 @@ interface ApolloClientOptions { class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); + cause: ({ + message: string; + extensions?: GraphQLErrorExtensions[]; + } & Partial) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) diff --git a/.api-reports/api-report-testing.api.md b/.api-reports/api-report-testing.api.md index c147f00f820..01ba05ec8b1 100644 --- a/.api-reports/api-report-testing.api.md +++ b/.api-reports/api-report-testing.api.md @@ -200,6 +200,10 @@ interface ApolloClientOptions { class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); + cause: ({ + message: string; + extensions?: GraphQLErrorExtensions[]; + } & Partial) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) diff --git a/.api-reports/api-report-testing_core.api.md b/.api-reports/api-report-testing_core.api.md index 1cbfc54605f..545e30231cd 100644 --- a/.api-reports/api-report-testing_core.api.md +++ b/.api-reports/api-report-testing_core.api.md @@ -199,6 +199,10 @@ interface ApolloClientOptions { class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); + cause: ({ + message: string; + extensions?: GraphQLErrorExtensions[]; + } & Partial) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) diff --git a/.api-reports/api-report-utilities.api.md b/.api-reports/api-report-utilities.api.md index c53a249f699..84e1668f11b 100644 --- a/.api-reports/api-report-utilities.api.md +++ b/.api-reports/api-report-utilities.api.md @@ -212,6 +212,10 @@ interface ApolloClientOptions { class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); + cause: ({ + message: string; + extensions?: GraphQLErrorExtensions[]; + } & Partial) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) diff --git a/.api-reports/api-report.api.md b/.api-reports/api-report.api.md index 4acdff1d7da..fb2bec58947 100644 --- a/.api-reports/api-report.api.md +++ b/.api-reports/api-report.api.md @@ -195,6 +195,10 @@ export interface ApolloContextValue { export class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); + cause: ({ + message: string; + extensions?: GraphQLErrorExtensions[]; + } & Partial) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) diff --git a/.changeset/flat-onions-guess.md b/.changeset/flat-onions-guess.md new file mode 100644 index 00000000000..ce7dc67887a --- /dev/null +++ b/.changeset/flat-onions-guess.md @@ -0,0 +1,5 @@ +--- +"@apollo/client": patch +--- + +Add `cause` field to `ApolloError`. diff --git a/.size-limits.json b/.size-limits.json index 81ed0bcf995..5cca69e7256 100644 --- a/.size-limits.json +++ b/.size-limits.json @@ -1,4 +1,4 @@ { - "dist/apollo-client.min.cjs": 39873, - "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32865 + "dist/apollo-client.min.cjs": 39906, + "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32896 } diff --git a/src/errors/index.ts b/src/errors/index.ts index 69277055500..3c07411161b 100644 --- a/src/errors/index.ts +++ b/src/errors/index.ts @@ -81,6 +81,17 @@ export class ApolloError extends Error { }>; public clientErrors: ReadonlyArray; public networkError: Error | ServerParseError | ServerError | null; + /** + * Indicates the specific original cause of the error. + * + * This field contains the first available `networkError`, `graphQLError`, `protocolError`, `clientError`, or `null` if none are available. + */ + public cause: + | ({ + message: string; + extensions?: GraphQLErrorExtensions[]; + } & Partial) + | null; // An object that can be used to provide some additional information // about an error, e.g. specifying the type of error this is. Used @@ -106,6 +117,13 @@ export class ApolloError extends Error { this.networkError = networkError || null; this.message = errorMessage || generateErrorMessage(this); this.extraInfo = extraInfo; + this.cause = + [ + networkError, + ...(graphQLErrors || []), + ...(protocolErrors || []), + ...(clientErrors || []), + ].find((e) => !!e) || null; // We're not using `Object.setPrototypeOf` here as it isn't fully // supported on Android (see issue #3236). From 228429a1d36eae691473b24fb641ec3cd84c8a3d Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Mon, 8 Jul 2024 11:26:14 +0200 Subject: [PATCH 07/17] Call `nextFetchPolicy` with "variables-changed" even if there is a `fetchPolicy` option specified. (#11626) * Call `nextFetchPolicy` with "variables-changed" even if there is a `fetchPolicy` specified. fixes #11365 * update size-limits * remove `.only` * Clean up Prettier, Size-limit, and Api-Extractor * use `mockFetchQuery` helper in test * fix detail in test-tsconfig.json --------- Co-authored-by: phryneas --- .changeset/tasty-chairs-dress.md | 5 + .size-limits.json | 4 +- src/core/ObservableQuery.ts | 5 +- src/react/hooks/__tests__/useQuery.test.tsx | 127 ++++++++++++++++++++ src/tsconfig.json | 2 + 5 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 .changeset/tasty-chairs-dress.md diff --git a/.changeset/tasty-chairs-dress.md b/.changeset/tasty-chairs-dress.md new file mode 100644 index 00000000000..459c72bd44b --- /dev/null +++ b/.changeset/tasty-chairs-dress.md @@ -0,0 +1,5 @@ +--- +"@apollo/client": patch +--- + +Call `nextFetchPolicy` with "variables-changed" even if there is a `fetchPolicy` specified. (fixes #11365) diff --git a/.size-limits.json b/.size-limits.json index 5cca69e7256..c9a1233d358 100644 --- a/.size-limits.json +++ b/.size-limits.json @@ -1,4 +1,4 @@ { - "dist/apollo-client.min.cjs": 39906, - "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32896 + "dist/apollo-client.min.cjs": 39924, + "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32903 } diff --git a/src/core/ObservableQuery.ts b/src/core/ObservableQuery.ts index f9e6dd6b1e4..7a419ff078e 100644 --- a/src/core/ObservableQuery.ts +++ b/src/core/ObservableQuery.ts @@ -910,7 +910,10 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`, options.fetchPolicy !== "standby" && // If we're changing the fetchPolicy anyway, don't try to change it here // using applyNextFetchPolicy. The explicit options.fetchPolicy wins. - options.fetchPolicy === oldFetchPolicy + (options.fetchPolicy === oldFetchPolicy || + // A `nextFetchPolicy` function has even higher priority, though, + // so in that case `applyNextFetchPolicy` must be called. + typeof options.nextFetchPolicy === "function") ) { this.applyNextFetchPolicy("variables-changed", options); if (newNetworkStatus === void 0) { diff --git a/src/react/hooks/__tests__/useQuery.test.tsx b/src/react/hooks/__tests__/useQuery.test.tsx index 7909f8673d8..19a1ba57687 100644 --- a/src/react/hooks/__tests__/useQuery.test.tsx +++ b/src/react/hooks/__tests__/useQuery.test.tsx @@ -11,6 +11,7 @@ import { OperationVariables, TypedDocumentNode, WatchQueryFetchPolicy, + WatchQueryOptions, } from "../../../core"; import { InMemoryCache } from "../../../cache"; import { ApolloProvider } from "../../context"; @@ -36,6 +37,7 @@ import { } from "../../../testing/internal"; import { useApolloClient } from "../useApolloClient"; import { useLazyQuery } from "../useLazyQuery"; +import { mockFetchQuery } from "../../../core/__tests__/ObservableQuery"; const IS_REACT_17 = React.version.startsWith("17"); @@ -7071,6 +7073,131 @@ describe("useQuery Hook", () => { expect(reasons).toEqual(["variables-changed", "after-fetch"]); }); + + it("should prioritize a `nextFetchPolicy` function over a `fetchPolicy` option when changing variables", async () => { + const query = gql` + { + hello + } + `; + const link = new MockLink([ + { + request: { query, variables: { id: 1 } }, + result: { data: { hello: "from link" } }, + delay: 10, + }, + { + request: { query, variables: { id: 2 } }, + result: { data: { hello: "from link2" } }, + delay: 10, + }, + ]); + + const client = new ApolloClient({ + cache: new InMemoryCache(), + link, + }); + + const mocks = mockFetchQuery(client["queryManager"]); + + const expectQueryTriggered = ( + nth: number, + fetchPolicy: WatchQueryFetchPolicy + ) => { + expect(mocks.fetchQueryByPolicy).toHaveBeenCalledTimes(nth); + expect(mocks.fetchQueryByPolicy).toHaveBeenNthCalledWith( + nth, + expect.anything(), + expect.objectContaining({ fetchPolicy }), + expect.any(Number) + ); + }; + let nextFetchPolicy: WatchQueryOptions< + OperationVariables, + any + >["nextFetchPolicy"] = (_, context) => { + if (context.reason === "variables-changed") { + return "cache-and-network"; + } else if (context.reason === "after-fetch") { + return "cache-only"; + } + throw new Error("should never happen"); + }; + nextFetchPolicy = jest.fn(nextFetchPolicy); + + const { result, rerender } = renderHook< + QueryResult, + { + variables: { id: number }; + } + >( + ({ variables }) => + useQuery(query, { + fetchPolicy: "network-only", + variables, + notifyOnNetworkStatusChange: true, + nextFetchPolicy, + }), + { + initialProps: { + variables: { id: 1 }, + }, + wrapper: ({ children }) => ( + {children} + ), + } + ); + // first network request triggers with initial fetchPolicy + expectQueryTriggered(1, "network-only"); + + await waitFor(() => { + expect(result.current.networkStatus).toBe(NetworkStatus.ready); + }); + + expect(nextFetchPolicy).toHaveBeenCalledTimes(1); + expect(nextFetchPolicy).toHaveBeenNthCalledWith( + 1, + "network-only", + expect.objectContaining({ + reason: "after-fetch", + }) + ); + // `nextFetchPolicy(..., {reason: "after-fetch"})` changed it to + // cache-only + expect(result.current.observable.options.fetchPolicy).toBe("cache-only"); + + rerender({ + variables: { id: 2 }, + }); + + expect(nextFetchPolicy).toHaveBeenNthCalledWith( + 2, + // has been reset to the initial `fetchPolicy` of "network-only" because + // we changed variables, then `nextFetchPolicy` is called + "network-only", + expect.objectContaining({ + reason: "variables-changed", + }) + ); + // the return value of `nextFetchPolicy(..., {reason: "variables-changed"})` + expectQueryTriggered(2, "cache-and-network"); + + await waitFor(() => { + expect(result.current.networkStatus).toBe(NetworkStatus.ready); + }); + + expect(nextFetchPolicy).toHaveBeenCalledTimes(3); + expect(nextFetchPolicy).toHaveBeenNthCalledWith( + 3, + "cache-and-network", + expect.objectContaining({ + reason: "after-fetch", + }) + ); + // `nextFetchPolicy(..., {reason: "after-fetch"})` changed it to + // cache-only + expect(result.current.observable.options.fetchPolicy).toBe("cache-only"); + }); }); describe("Missing Fields", () => { diff --git a/src/tsconfig.json b/src/tsconfig.json index efeb2f2da38..d7e90510ecc 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -5,6 +5,8 @@ { "compilerOptions": { "noEmit": true, + "declaration": false, + "declarationMap": false, "lib": ["es2015", "esnext.asynciterable", "ES2021.WeakRef"], "types": ["jest", "node", "./testing/matchers/index.d.ts"] }, From 2941824dd66cdd20eee5f2293373ad7a9cf991a4 Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Mon, 8 Jul 2024 11:38:11 +0200 Subject: [PATCH 08/17] Add `restart` function to `useSubscription` (#11927) * syntax adjustment for compiler * Add `restart` function to `useSubscription`. * add tests * adjust test timing to accomodate for React 17 * Apply suggestions from code review Co-authored-by: Jerel Miller * Clean up Prettier, Size-limit, and Api-Extractor --------- Co-authored-by: Jerel Miller Co-authored-by: phryneas --- .api-reports/api-report-react.api.md | 8 +- .api-reports/api-report-react_hooks.api.md | 8 +- .api-reports/api-report.api.md | 8 +- .changeset/clever-bikes-admire.md | 5 + .size-limits.json | 2 +- .../hooks/__tests__/useSubscription.test.tsx | 337 +++++++++++++++++- src/react/hooks/useSubscription.ts | 48 ++- 7 files changed, 394 insertions(+), 22 deletions(-) create mode 100644 .changeset/clever-bikes-admire.md diff --git a/.api-reports/api-report-react.api.md b/.api-reports/api-report-react.api.md index c81d938a887..d1cd5a93af3 100644 --- a/.api-reports/api-report-react.api.md +++ b/.api-reports/api-report-react.api.md @@ -2190,7 +2190,13 @@ export interface UseReadQueryResult { } // @public -export function useSubscription(subscription: DocumentNode | TypedDocumentNode, options?: SubscriptionHookOptions, NoInfer_2>): SubscriptionResult; +export function useSubscription(subscription: DocumentNode | TypedDocumentNode, options?: SubscriptionHookOptions, NoInfer_2>): { + restart(): void; + loading: boolean; + data?: TData | undefined; + error?: ApolloError; + variables?: TVariables | undefined; +}; // @public (undocumented) export function useSuspenseQuery, "variables">>(query: DocumentNode | TypedDocumentNode, options?: SuspenseQueryHookOptions, NoInfer_2> & TOptions): UseSuspenseQueryResult | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? TOptions["skip"] extends boolean ? DeepPartial | undefined : DeepPartial : TOptions["skip"] extends boolean ? TData | undefined : TData, TVariables>; diff --git a/.api-reports/api-report-react_hooks.api.md b/.api-reports/api-report-react_hooks.api.md index b5ee3e1c051..cec9f2c4d1e 100644 --- a/.api-reports/api-report-react_hooks.api.md +++ b/.api-reports/api-report-react_hooks.api.md @@ -2023,7 +2023,13 @@ export interface UseReadQueryResult { // Warning: (ae-forgotten-export) The symbol "SubscriptionHookOptions" needs to be exported by the entry point index.d.ts // // @public -export function useSubscription(subscription: DocumentNode | TypedDocumentNode, options?: SubscriptionHookOptions, NoInfer_2>): SubscriptionResult; +export function useSubscription(subscription: DocumentNode | TypedDocumentNode, options?: SubscriptionHookOptions, NoInfer_2>): { + restart(): void; + loading: boolean; + data?: TData | undefined; + error?: ApolloError; + variables?: TVariables | undefined; +}; // Warning: (ae-forgotten-export) The symbol "SuspenseQueryHookOptions" needs to be exported by the entry point index.d.ts // diff --git a/.api-reports/api-report.api.md b/.api-reports/api-report.api.md index fb2bec58947..11e76dd8d6f 100644 --- a/.api-reports/api-report.api.md +++ b/.api-reports/api-report.api.md @@ -2851,7 +2851,13 @@ export interface UseReadQueryResult { } // @public -export function useSubscription(subscription: DocumentNode | TypedDocumentNode, options?: SubscriptionHookOptions, NoInfer_2>): SubscriptionResult; +export function useSubscription(subscription: DocumentNode | TypedDocumentNode, options?: SubscriptionHookOptions, NoInfer_2>): { + restart(): void; + loading: boolean; + data?: TData | undefined; + error?: ApolloError; + variables?: TVariables | undefined; +}; // @public (undocumented) export function useSuspenseQuery, "variables">>(query: DocumentNode | TypedDocumentNode, options?: SuspenseQueryHookOptions, NoInfer_2> & TOptions): UseSuspenseQueryResult | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? TOptions["skip"] extends boolean ? DeepPartial | undefined : DeepPartial : TOptions["skip"] extends boolean ? TData | undefined : TData, TVariables>; diff --git a/.changeset/clever-bikes-admire.md b/.changeset/clever-bikes-admire.md new file mode 100644 index 00000000000..36b9ba5de3a --- /dev/null +++ b/.changeset/clever-bikes-admire.md @@ -0,0 +1,5 @@ +--- +"@apollo/client": patch +--- + +Add `restart` function to `useSubscription`. diff --git a/.size-limits.json b/.size-limits.json index c9a1233d358..4e756f84c34 100644 --- a/.size-limits.json +++ b/.size-limits.json @@ -1,4 +1,4 @@ { - "dist/apollo-client.min.cjs": 39924, + "dist/apollo-client.min.cjs": 39971, "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32903 } diff --git a/src/react/hooks/__tests__/useSubscription.test.tsx b/src/react/hooks/__tests__/useSubscription.test.tsx index decdd17b973..e955ae1e00c 100644 --- a/src/react/hooks/__tests__/useSubscription.test.tsx +++ b/src/react/hooks/__tests__/useSubscription.test.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { renderHook, waitFor } from "@testing-library/react"; +import { render, renderHook, waitFor } from "@testing-library/react"; import gql from "graphql-tag"; import { @@ -14,7 +14,10 @@ import { InMemoryCache as Cache } from "../../../cache"; import { ApolloProvider } from "../../context"; import { MockSubscriptionLink } from "../../../testing"; import { useSubscription } from "../useSubscription"; -import { spyOnConsole } from "../../../testing/internal"; +import { profileHook, spyOnConsole } from "../../../testing/internal"; +import { SubscriptionHookOptions } from "../../types/types"; +import { GraphQLError } from "graphql"; +import { InvariantError } from "ts-invariant"; describe("useSubscription Hook", () => { it("should handle a simple subscription properly", async () => { @@ -1122,6 +1125,336 @@ followed by new in-flight setup", async () => { }); }); +describe("`restart` callback", () => { + function setup() { + const subscription: TypedDocumentNode< + { totalLikes: number }, + { id: string } + > = gql` + subscription ($id: ID!) { + totalLikes(postId: $id) + } + `; + const onSubscribe = jest.fn(); + const onUnsubscribe = jest.fn(); + const link = new MockSubscriptionLink(); + link.onSetup(onSubscribe); + link.onUnsubscribe(onUnsubscribe); + const client = new ApolloClient({ + link, + cache: new Cache(), + }); + const ProfiledHook = profileHook( + ( + options: SubscriptionHookOptions<{ totalLikes: number }, { id: string }> + ) => useSubscription(subscription, options) + ); + return { client, link, ProfiledHook, onSubscribe, onUnsubscribe }; + } + it("can restart a running subscription", async () => { + const { client, link, ProfiledHook, onSubscribe, onUnsubscribe } = setup(); + render(, { + wrapper: ({ children }) => ( + {children} + ), + }); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: true, + data: undefined, + error: undefined, + restart: expect.any(Function), + variables: { id: "1" }, + }); + } + link.simulateResult({ result: { data: { totalLikes: 1 } } }); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + data: { totalLikes: 1 }, + error: undefined, + restart: expect.any(Function), + variables: { id: "1" }, + }); + } + await expect(ProfiledHook).not.toRerender({ timeout: 20 }); + expect(onUnsubscribe).toHaveBeenCalledTimes(0); + expect(onSubscribe).toHaveBeenCalledTimes(1); + + ProfiledHook.getCurrentSnapshot().restart(); + + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: true, + data: undefined, + error: undefined, + restart: expect.any(Function), + variables: { id: "1" }, + }); + } + await waitFor(() => expect(onUnsubscribe).toHaveBeenCalledTimes(1)); + expect(onSubscribe).toHaveBeenCalledTimes(2); + + link.simulateResult({ result: { data: { totalLikes: 2 } } }); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + data: { totalLikes: 2 }, + error: undefined, + restart: expect.any(Function), + variables: { id: "1" }, + }); + } + }); + it("will use the most recently passed in options", async () => { + const { client, link, ProfiledHook, onSubscribe, onUnsubscribe } = setup(); + const { rerender } = render(, { + wrapper: ({ children }) => ( + {children} + ), + }); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: true, + data: undefined, + error: undefined, + restart: expect.any(Function), + variables: { id: "1" }, + }); + } + // deliberately keeping a reference to a very old `restart` function + // to show that the most recent options are used even with that + const restart = ProfiledHook.getCurrentSnapshot().restart; + link.simulateResult({ result: { data: { totalLikes: 1 } } }); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + data: { totalLikes: 1 }, + error: undefined, + restart: expect.any(Function), + variables: { id: "1" }, + }); + } + await expect(ProfiledHook).not.toRerender({ timeout: 20 }); + expect(onUnsubscribe).toHaveBeenCalledTimes(0); + expect(onSubscribe).toHaveBeenCalledTimes(1); + + rerender(); + await waitFor(() => expect(onUnsubscribe).toHaveBeenCalledTimes(1)); + expect(onSubscribe).toHaveBeenCalledTimes(2); + expect(link.operation?.variables).toStrictEqual({ id: "2" }); + + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: true, + data: undefined, + error: undefined, + restart: expect.any(Function), + variables: { id: "2" }, + }); + } + link.simulateResult({ result: { data: { totalLikes: 1000 } } }); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + data: { totalLikes: 1000 }, + error: undefined, + restart: expect.any(Function), + variables: { id: "2" }, + }); + } + + expect(onUnsubscribe).toHaveBeenCalledTimes(1); + expect(onSubscribe).toHaveBeenCalledTimes(2); + expect(link.operation?.variables).toStrictEqual({ id: "2" }); + + restart(); + + await waitFor(() => expect(onUnsubscribe).toHaveBeenCalledTimes(2)); + expect(onSubscribe).toHaveBeenCalledTimes(3); + expect(link.operation?.variables).toStrictEqual({ id: "2" }); + + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: true, + data: undefined, + error: undefined, + restart: expect.any(Function), + variables: { id: "2" }, + }); + } + link.simulateResult({ result: { data: { totalLikes: 1005 } } }); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + data: { totalLikes: 1005 }, + error: undefined, + restart: expect.any(Function), + variables: { id: "2" }, + }); + } + }); + it("can restart a subscription that has completed", async () => { + const { client, link, ProfiledHook, onSubscribe, onUnsubscribe } = setup(); + render(, { + wrapper: ({ children }) => ( + {children} + ), + }); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: true, + data: undefined, + error: undefined, + restart: expect.any(Function), + variables: { id: "1" }, + }); + } + link.simulateResult({ result: { data: { totalLikes: 1 } } }, true); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + data: { totalLikes: 1 }, + error: undefined, + restart: expect.any(Function), + variables: { id: "1" }, + }); + } + await expect(ProfiledHook).not.toRerender({ timeout: 20 }); + expect(onUnsubscribe).toHaveBeenCalledTimes(1); + expect(onSubscribe).toHaveBeenCalledTimes(1); + + ProfiledHook.getCurrentSnapshot().restart(); + + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: true, + data: undefined, + error: undefined, + restart: expect.any(Function), + variables: { id: "1" }, + }); + } + await waitFor(() => expect(onSubscribe).toHaveBeenCalledTimes(2)); + expect(onUnsubscribe).toHaveBeenCalledTimes(1); + + link.simulateResult({ result: { data: { totalLikes: 2 } } }); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + data: { totalLikes: 2 }, + error: undefined, + restart: expect.any(Function), + variables: { id: "1" }, + }); + } + }); + it("can restart a subscription that has errored", async () => { + const { client, link, ProfiledHook, onSubscribe, onUnsubscribe } = setup(); + render(, { + wrapper: ({ children }) => ( + {children} + ), + }); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: true, + data: undefined, + error: undefined, + restart: expect.any(Function), + variables: { id: "1" }, + }); + } + const error = new GraphQLError("error"); + link.simulateResult({ + result: { errors: [error] }, + }); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + data: undefined, + error: new ApolloError({ graphQLErrors: [error] }), + restart: expect.any(Function), + variables: { id: "1" }, + }); + } + await expect(ProfiledHook).not.toRerender({ timeout: 20 }); + expect(onUnsubscribe).toHaveBeenCalledTimes(1); + expect(onSubscribe).toHaveBeenCalledTimes(1); + + ProfiledHook.getCurrentSnapshot().restart(); + + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: true, + data: undefined, + error: undefined, + restart: expect.any(Function), + variables: { id: "1" }, + }); + } + await waitFor(() => expect(onSubscribe).toHaveBeenCalledTimes(2)); + expect(onUnsubscribe).toHaveBeenCalledTimes(1); + + link.simulateResult({ result: { data: { totalLikes: 2 } } }); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + data: { totalLikes: 2 }, + error: undefined, + restart: expect.any(Function), + variables: { id: "1" }, + }); + } + }); + it("will not restart a subscription that has been `skip`ped", async () => { + const { client, ProfiledHook, onSubscribe, onUnsubscribe } = setup(); + render(, { + wrapper: ({ children }) => ( + {children} + ), + }); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + data: undefined, + error: undefined, + restart: expect.any(Function), + variables: { id: "1" }, + }); + } + expect(onUnsubscribe).toHaveBeenCalledTimes(0); + expect(onSubscribe).toHaveBeenCalledTimes(0); + + expect(() => ProfiledHook.getCurrentSnapshot().restart()).toThrow( + new InvariantError("A subscription that is skipped cannot be restarted.") + ); + + await expect(ProfiledHook).not.toRerender({ timeout: 20 }); + expect(onUnsubscribe).toHaveBeenCalledTimes(0); + expect(onSubscribe).toHaveBeenCalledTimes(0); + }); +}); + describe.skip("Type Tests", () => { test("NoInfer prevents adding arbitrary additional variables", () => { const typedNode = {} as TypedDocumentNode<{ foo: string }, { bar: number }>; diff --git a/src/react/hooks/useSubscription.ts b/src/react/hooks/useSubscription.ts index 3b0d7f4303d..b1f3a9a733b 100644 --- a/src/react/hooks/useSubscription.ts +++ b/src/react/hooks/useSubscription.ts @@ -21,6 +21,7 @@ import { Observable } from "../../core/index.js"; import { useApolloClient } from "./useApolloClient.js"; import { useDeepMemo } from "./internal/useDeepMemo.js"; import { useSyncExternalStore } from "./useSyncExternalStore.js"; +import { useIsomorphicLayoutEffect } from "./internal/useIsomorphicLayoutEffect.js"; /** * > Refer to the [Subscriptions](https://www.apollographql.com/docs/react/data/subscriptions/) section for a more in-depth overview of `useSubscription`. @@ -146,6 +147,14 @@ export function useSubscription< ) ); + const recreate = () => + createSubscription(client, subscription, variables, fetchPolicy, context); + + const recreateRef = React.useRef(recreate); + useIsomorphicLayoutEffect(() => { + recreateRef.current = recreate; + }); + if (skip) { if (observable) { setObservable((observable = null)); @@ -160,15 +169,7 @@ export function useSubscription< !!shouldResubscribe(options!) : shouldResubscribe) !== false) ) { - setObservable( - (observable = createSubscription( - client, - subscription, - variables, - fetchPolicy, - context - )) - ); + setObservable((observable = recreate())); } const optionsRef = React.useRef(options); @@ -186,7 +187,7 @@ export function useSubscription< [skip, variables] ); - return useSyncExternalStore>( + const ret = useSyncExternalStore>( React.useCallback( (update) => { if (!observable) { @@ -262,6 +263,19 @@ export function useSubscription< ), () => (observable && !skip ? observable.__.result : fallbackResult) ); + return React.useMemo( + () => ({ + ...ret, + restart() { + invariant( + !optionsRef.current.skip, + "A subscription that is skipped cannot be restarted." + ); + setObservable(recreateRef.current()); + }, + }), + [ret] + ); } function createSubscription< @@ -295,12 +309,14 @@ function createSubscription< new Observable>((observer) => { // lazily start the subscription when the first observer subscribes // to get around strict mode - observable ||= client.subscribe({ - query, - variables, - fetchPolicy, - context, - }); + if (!observable) { + observable = client.subscribe({ + query, + variables, + fetchPolicy, + context, + }); + } const sub = observable.subscribe(observer); return () => sub.unsubscribe(); }), From 70406bfd2b9a645d781638569853d9b435e047df Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Mon, 8 Jul 2024 13:04:26 +0200 Subject: [PATCH 09/17] add `ignoreResults` option to `useSubscription` (#11921) * add `ignoreResults` option to `useSubscription` * more tests * changeset * restore type, add deprecation, tweak tag * Update src/react/hooks/useSubscription.ts * reflect code change in comment * review feedback * Update src/react/types/types.documentation.ts Co-authored-by: Jerel Miller * add clarification about resetting the return value when switching on `ignoreResults` later * test fixup --------- Co-authored-by: Jerel Miller --- .api-reports/api-report-react.api.md | 3 +- .../api-report-react_components.api.md | 1 + .api-reports/api-report-react_hooks.api.md | 1 + .api-reports/api-report.api.md | 3 +- .changeset/unlucky-birds-press.md | 5 + .size-limits.json | 2 +- .../hooks/__tests__/useSubscription.test.tsx | 291 ++++++++++++++++++ src/react/hooks/useSubscription.ts | 30 +- src/react/types/types.documentation.ts | 6 + src/react/types/types.ts | 8 + 10 files changed, 341 insertions(+), 9 deletions(-) create mode 100644 .changeset/unlucky-birds-press.md diff --git a/.api-reports/api-report-react.api.md b/.api-reports/api-report-react.api.md index d1cd5a93af3..d685c3f6599 100644 --- a/.api-reports/api-report-react.api.md +++ b/.api-reports/api-report-react.api.md @@ -388,6 +388,7 @@ export interface BaseSubscriptionOptions void; onData?: (options: OnDataOptions) => any; onError?: (error: ApolloError) => void; @@ -1919,7 +1920,7 @@ export interface SubscriptionCurrentObservable { subscription?: Subscription; } -// @public (undocumented) +// @public @deprecated (undocumented) export interface SubscriptionDataOptions extends BaseSubscriptionOptions { // (undocumented) children?: null | ((result: SubscriptionResult) => ReactTypes.ReactNode); diff --git a/.api-reports/api-report-react_components.api.md b/.api-reports/api-report-react_components.api.md index efb4ddab230..0aff1af40cf 100644 --- a/.api-reports/api-report-react_components.api.md +++ b/.api-reports/api-report-react_components.api.md @@ -336,6 +336,7 @@ interface BaseSubscriptionOptions void; // Warning: (ae-forgotten-export) The symbol "OnDataOptions" needs to be exported by the entry point index.d.ts onData?: (options: OnDataOptions) => any; diff --git a/.api-reports/api-report-react_hooks.api.md b/.api-reports/api-report-react_hooks.api.md index cec9f2c4d1e..2dcd7bce461 100644 --- a/.api-reports/api-report-react_hooks.api.md +++ b/.api-reports/api-report-react_hooks.api.md @@ -359,6 +359,7 @@ interface BaseSubscriptionOptions void; // Warning: (ae-forgotten-export) The symbol "OnDataOptions" needs to be exported by the entry point index.d.ts onData?: (options: OnDataOptions) => any; diff --git a/.api-reports/api-report.api.md b/.api-reports/api-report.api.md index 11e76dd8d6f..007a3ba589b 100644 --- a/.api-reports/api-report.api.md +++ b/.api-reports/api-report.api.md @@ -359,6 +359,7 @@ export interface BaseSubscriptionOptions; context?: DefaultContext; fetchPolicy?: FetchPolicy; + ignoreResults?: boolean; onComplete?: () => void; onData?: (options: OnDataOptions) => any; onError?: (error: ApolloError) => void; @@ -2551,7 +2552,7 @@ export interface SubscriptionCurrentObservable { subscription?: ObservableSubscription; } -// @public (undocumented) +// @public @deprecated (undocumented) export interface SubscriptionDataOptions extends BaseSubscriptionOptions { // (undocumented) children?: null | ((result: SubscriptionResult) => ReactTypes.ReactNode); diff --git a/.changeset/unlucky-birds-press.md b/.changeset/unlucky-birds-press.md new file mode 100644 index 00000000000..5696787576d --- /dev/null +++ b/.changeset/unlucky-birds-press.md @@ -0,0 +1,5 @@ +--- +"@apollo/client": patch +--- + +add `ignoreResults` option to `useSubscription` diff --git a/.size-limits.json b/.size-limits.json index 4e756f84c34..28452c40fd4 100644 --- a/.size-limits.json +++ b/.size-limits.json @@ -1,4 +1,4 @@ { - "dist/apollo-client.min.cjs": 39971, + "dist/apollo-client.min.cjs": 40015, "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32903 } diff --git a/src/react/hooks/__tests__/useSubscription.test.tsx b/src/react/hooks/__tests__/useSubscription.test.tsx index e955ae1e00c..eb02e41c9aa 100644 --- a/src/react/hooks/__tests__/useSubscription.test.tsx +++ b/src/react/hooks/__tests__/useSubscription.test.tsx @@ -1455,6 +1455,297 @@ describe("`restart` callback", () => { }); }); +describe("ignoreResults", () => { + const subscription = gql` + subscription { + car { + make + } + } + `; + + const results = ["Audi", "BMW"].map((make) => ({ + result: { data: { car: { make } } }, + })); + + it("should not rerender when ignoreResults is true, but will call `onData` and `onComplete`", async () => { + const link = new MockSubscriptionLink(); + const client = new ApolloClient({ + link, + cache: new Cache({ addTypename: false }), + }); + + const onData = jest.fn((() => {}) as SubscriptionHookOptions["onData"]); + const onError = jest.fn((() => {}) as SubscriptionHookOptions["onError"]); + const onComplete = jest.fn( + (() => {}) as SubscriptionHookOptions["onComplete"] + ); + const ProfiledHook = profileHook(() => + useSubscription(subscription, { + ignoreResults: true, + onData, + onError, + onComplete, + }) + ); + render(, { + wrapper: ({ children }) => ( + {children} + ), + }); + + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + error: undefined, + data: undefined, + variables: undefined, + restart: expect.any(Function), + }); + link.simulateResult(results[0]); + + await waitFor(() => { + expect(onData).toHaveBeenCalledTimes(1); + expect(onData).toHaveBeenLastCalledWith( + expect.objectContaining({ + data: { + data: results[0].result.data, + error: undefined, + loading: false, + variables: undefined, + }, + }) + ); + expect(onError).toHaveBeenCalledTimes(0); + expect(onComplete).toHaveBeenCalledTimes(0); + }); + + link.simulateResult(results[1], true); + await waitFor(() => { + expect(onData).toHaveBeenCalledTimes(2); + expect(onData).toHaveBeenLastCalledWith( + expect.objectContaining({ + data: { + data: results[1].result.data, + error: undefined, + loading: false, + variables: undefined, + }, + }) + ); + expect(onError).toHaveBeenCalledTimes(0); + expect(onComplete).toHaveBeenCalledTimes(1); + }); + + await expect(ProfiledHook).not.toRerender(); + }); + + it("should not rerender when ignoreResults is true and an error occurs", async () => { + const link = new MockSubscriptionLink(); + const client = new ApolloClient({ + link, + cache: new Cache({ addTypename: false }), + }); + + const onData = jest.fn((() => {}) as SubscriptionHookOptions["onData"]); + const onError = jest.fn((() => {}) as SubscriptionHookOptions["onError"]); + const onComplete = jest.fn( + (() => {}) as SubscriptionHookOptions["onComplete"] + ); + const ProfiledHook = profileHook(() => + useSubscription(subscription, { + ignoreResults: true, + onData, + onError, + onComplete, + }) + ); + render(, { + wrapper: ({ children }) => ( + {children} + ), + }); + + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + error: undefined, + data: undefined, + variables: undefined, + restart: expect.any(Function), + }); + link.simulateResult(results[0]); + + await waitFor(() => { + expect(onData).toHaveBeenCalledTimes(1); + expect(onData).toHaveBeenLastCalledWith( + expect.objectContaining({ + data: { + data: results[0].result.data, + error: undefined, + loading: false, + variables: undefined, + }, + }) + ); + expect(onError).toHaveBeenCalledTimes(0); + expect(onComplete).toHaveBeenCalledTimes(0); + }); + + const error = new Error("test"); + link.simulateResult({ error }); + await waitFor(() => { + expect(onData).toHaveBeenCalledTimes(1); + expect(onError).toHaveBeenCalledTimes(1); + expect(onError).toHaveBeenLastCalledWith(error); + expect(onComplete).toHaveBeenCalledTimes(0); + }); + + await expect(ProfiledHook).not.toRerender(); + }); + + it("can switch from `ignoreResults: true` to `ignoreResults: false` and will start rerendering, without creating a new subscription", async () => { + const subscriptionCreated = jest.fn(); + const link = new MockSubscriptionLink(); + link.onSetup(subscriptionCreated); + const client = new ApolloClient({ + link, + cache: new Cache({ addTypename: false }), + }); + + const onData = jest.fn((() => {}) as SubscriptionHookOptions["onData"]); + const ProfiledHook = profileHook( + ({ ignoreResults }: { ignoreResults: boolean }) => + useSubscription(subscription, { + ignoreResults, + onData, + }) + ); + const { rerender } = render(, { + wrapper: ({ children }) => ( + {children} + ), + }); + expect(subscriptionCreated).toHaveBeenCalledTimes(1); + + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + error: undefined, + data: undefined, + variables: undefined, + restart: expect.any(Function), + }); + expect(onData).toHaveBeenCalledTimes(0); + } + link.simulateResult(results[0]); + await expect(ProfiledHook).not.toRerender({ timeout: 20 }); + expect(onData).toHaveBeenCalledTimes(1); + + rerender(); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + error: undefined, + // `data` appears immediately after changing to `ignoreResults: false` + data: results[0].result.data, + variables: undefined, + restart: expect.any(Function), + }); + // `onData` should not be called again for the same result + expect(onData).toHaveBeenCalledTimes(1); + } + + link.simulateResult(results[1]); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + error: undefined, + data: results[1].result.data, + variables: undefined, + restart: expect.any(Function), + }); + expect(onData).toHaveBeenCalledTimes(2); + } + // a second subscription should not have been started + expect(subscriptionCreated).toHaveBeenCalledTimes(1); + }); + it("can switch from `ignoreResults: false` to `ignoreResults: true` and will stop rerendering, without creating a new subscription", async () => { + const subscriptionCreated = jest.fn(); + const link = new MockSubscriptionLink(); + link.onSetup(subscriptionCreated); + const client = new ApolloClient({ + link, + cache: new Cache({ addTypename: false }), + }); + + const onData = jest.fn((() => {}) as SubscriptionHookOptions["onData"]); + const ProfiledHook = profileHook( + ({ ignoreResults }: { ignoreResults: boolean }) => + useSubscription(subscription, { + ignoreResults, + onData, + }) + ); + const { rerender } = render(, { + wrapper: ({ children }) => ( + {children} + ), + }); + expect(subscriptionCreated).toHaveBeenCalledTimes(1); + + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: true, + error: undefined, + data: undefined, + variables: undefined, + restart: expect.any(Function), + }); + expect(onData).toHaveBeenCalledTimes(0); + } + link.simulateResult(results[0]); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + error: undefined, + data: results[0].result.data, + variables: undefined, + restart: expect.any(Function), + }); + expect(onData).toHaveBeenCalledTimes(1); + } + await expect(ProfiledHook).not.toRerender({ timeout: 20 }); + + rerender(); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + error: undefined, + // switching back to the default `ignoreResults: true` return value + data: undefined, + variables: undefined, + restart: expect.any(Function), + }); + // `onData` should not be called again + expect(onData).toHaveBeenCalledTimes(1); + } + + link.simulateResult(results[1]); + await expect(ProfiledHook).not.toRerender({ timeout: 20 }); + expect(onData).toHaveBeenCalledTimes(2); + + // a second subscription should not have been started + expect(subscriptionCreated).toHaveBeenCalledTimes(1); + }); +}); + describe.skip("Type Tests", () => { test("NoInfer prevents adding arbitrary additional variables", () => { const typedNode = {} as TypedDocumentNode<{ foo: string }, { bar: number }>; diff --git a/src/react/hooks/useSubscription.ts b/src/react/hooks/useSubscription.ts index b1f3a9a733b..d602578de73 100644 --- a/src/react/hooks/useSubscription.ts +++ b/src/react/hooks/useSubscription.ts @@ -138,7 +138,8 @@ export function useSubscription< } } - const { skip, fetchPolicy, shouldResubscribe, context } = options; + const { skip, fetchPolicy, shouldResubscribe, context, ignoreResults } = + options; const variables = useDeepMemo(() => options.variables, [options.variables]); let [observable, setObservable] = React.useState(() => @@ -177,16 +178,30 @@ export function useSubscription< optionsRef.current = options; }); + const fallbackLoading = !skip && !ignoreResults; const fallbackResult = React.useMemo>( () => ({ - loading: !skip, + loading: fallbackLoading, error: void 0, data: void 0, variables, }), - [skip, variables] + [fallbackLoading, variables] ); + const ignoreResultsRef = React.useRef(ignoreResults); + useIsomorphicLayoutEffect(() => { + // We cannot reference `ignoreResults` directly in the effect below + // it would add a dependency to the `useEffect` deps array, which means the + // subscription would be recreated if `ignoreResults` changes + // As a result, on resubscription, the last result would be re-delivered, + // rendering the component one additional time, and re-triggering `onData`. + // The same applies to `fetchPolicy`, which results in a new `observable` + // being created. We cannot really avoid it in that case, but we can at least + // avoid it for `ignoreResults`. + ignoreResultsRef.current = ignoreResults; + }); + const ret = useSyncExternalStore>( React.useCallback( (update) => { @@ -212,7 +227,7 @@ export function useSubscription< variables, }; observable.__.setResult(result); - update(); + if (!ignoreResultsRef.current) update(); if (optionsRef.current.onData) { optionsRef.current.onData({ @@ -234,7 +249,7 @@ export function useSubscription< error, variables, }); - update(); + if (!ignoreResultsRef.current) update(); optionsRef.current.onError?.(error); } }, @@ -261,7 +276,10 @@ export function useSubscription< }, [observable] ), - () => (observable && !skip ? observable.__.result : fallbackResult) + () => + observable && !skip && !ignoreResults ? + observable.__.result + : fallbackResult ); return React.useMemo( () => ({ diff --git a/src/react/types/types.documentation.ts b/src/react/types/types.documentation.ts index 186d651dfd8..c5f232c1b18 100644 --- a/src/react/types/types.documentation.ts +++ b/src/react/types/types.documentation.ts @@ -531,6 +531,12 @@ export interface SubscriptionOptionsDocumentation { */ shouldResubscribe: unknown; + /** + * If `true`, the hook will not cause the component to rerender. This is useful when you want to control the rendering of your component yourself with logic in the `onData` and `onError` callbacks. + * + * Changing this to `true` when the hook already has `data` will reset the `data` to `undefined`. + */ + ignoreResults: unknown; /** * An `ApolloClient` instance. By default `useSubscription` / `Subscription` uses the client passed down via context, but a different client can be passed in. */ diff --git a/src/react/types/types.ts b/src/react/types/types.ts index 41cff9e8835..be799bf52dd 100644 --- a/src/react/types/types.ts +++ b/src/react/types/types.ts @@ -457,6 +457,11 @@ export interface BaseSubscriptionOptions< onError?: (error: ApolloError) => void; /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onSubscriptionComplete:member} */ onSubscriptionComplete?: () => void; + /** + * {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#ignoreResults:member} + * @defaultValue `false` + */ + ignoreResults?: boolean; } export interface SubscriptionResult { @@ -479,6 +484,9 @@ export interface SubscriptionHookOptions< TVariables extends OperationVariables = OperationVariables, > extends BaseSubscriptionOptions {} +/** + * @deprecated This type is not used anymore. It will be removed in the next major version of Apollo Client + */ export interface SubscriptionDataOptions< TData = any, TVariables extends OperationVariables = OperationVariables, From 00a3bcccb6c540543b480f98331d989dae6195da Mon Sep 17 00:00:00 2001 From: Jerel Miller Date: Mon, 8 Jul 2024 09:14:30 -0600 Subject: [PATCH 10/17] Update ROADMAP.md --- ROADMAP.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index c4db934254d..1fa3dc7bc3b 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,6 +1,6 @@ # 🔮 Apollo Client Roadmap -**Last updated: 2024-07-01** +**Last updated: 2024-07-08** For up to date release notes, refer to the project's [Changelog](https://github.com/apollographql/apollo-client/blob/main/CHANGELOG.md). @@ -13,8 +13,8 @@ For up to date release notes, refer to the project's [Changelog](https://github. --- -## [3.11.0](https://github.com/apollographql/apollo-client/milestone/40) - July 16th, 2024 -_Release candidate - July 8th, 2024_ +## [3.11.0](https://github.com/apollographql/apollo-client/milestone/40) - July 17th, 2024 +_Release candidate - July 9th, 2024_ - Rewriting `useQuery` and `useSubscription` for better React Compiler support - Add an `ignoreResults` option to the `useSubscription` API From fce54f2b8b3e6a1e4ef6c87b4d47792d3dbc2273 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 15:28:27 -0600 Subject: [PATCH 11/17] chore(deps): update dependency rimraf to v5.0.8 (#11931) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package-lock.json | 18 +++++++++--------- package.json | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index dd9d7458937..7f208bd5e57 100644 --- a/package-lock.json +++ b/package-lock.json @@ -91,7 +91,7 @@ "react-error-boundary": "4.0.13", "recast": "0.23.9", "resolve": "1.22.8", - "rimraf": "5.0.7", + "rimraf": "5.0.8", "rollup": "2.79.1", "rollup-plugin-cleanup": "3.2.1", "rollup-plugin-terser": "7.0.2", @@ -10898,9 +10898,9 @@ } }, "node_modules/rimraf": { - "version": "5.0.7", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.7.tgz", - "integrity": "sha512-nV6YcJo5wbLW77m+8KjH8aB/7/rxQy9SZ0HY5shnwULfS+9nmTtVXAJET5NdZmCzA4fPI/Hm1wo/Po/4mopOdg==", + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.8.tgz", + "integrity": "sha512-XSh0V2/yNhDEi8HwdIefD8MLgs4LQXPag/nEJWs3YUc3Upn+UHa1GyIkEg9xSSNt7HnkO5FjTvmcRzgf+8UZuw==", "dev": true, "license": "ISC", "dependencies": { @@ -10910,7 +10910,7 @@ "rimraf": "dist/esm/bin.mjs" }, "engines": { - "node": ">=14.18" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -10927,9 +10927,9 @@ } }, "node_modules/rimraf/node_modules/glob": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.2.tgz", - "integrity": "sha512-GwMlUF6PkPo3Gk21UxkCohOv0PLcIXVtKyLlpEI28R/cO/4eNOdmLk3CMW1wROV/WR/EsZOWAfBbBOqYvs88/w==", + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.3.tgz", + "integrity": "sha512-Q38SGlYRpVtDBPSWEylRyctn7uDeTp4NQERTLiCT1FqA9JXPYWqAVmQU6qh4r/zMM5ehxTcbaO8EjhWnvEhmyg==", "dev": true, "license": "ISC", "dependencies": { @@ -10944,7 +10944,7 @@ "glob": "dist/esm/bin.mjs" }, "engines": { - "node": ">=16 || 14 >=14.18" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/isaacs" diff --git a/package.json b/package.json index 95195f4b93e..ad69cdf8d52 100644 --- a/package.json +++ b/package.json @@ -172,7 +172,7 @@ "react-error-boundary": "4.0.13", "recast": "0.23.9", "resolve": "1.22.8", - "rimraf": "5.0.7", + "rimraf": "5.0.8", "rollup": "2.79.1", "rollup-plugin-cleanup": "3.2.1", "rollup-plugin-terser": "7.0.2", From 9a19f5e099a3f47c14b3bf2c477d4dfd2811385a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 15:51:39 -0600 Subject: [PATCH 12/17] chore(deps): update cimg/node docker tag to v22.4.0 (#11932) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .circleci/config.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 17eaba3e2f2..774b52063e5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,7 @@ jobs: Lint: docker: - - image: cimg/node:22.3.0 + - image: cimg/node:22.4.0 steps: - checkout - run: npm version @@ -24,7 +24,7 @@ jobs: Formatting: docker: - - image: cimg/node:22.3.0 + - image: cimg/node:22.4.0 steps: - checkout - run: npm ci @@ -32,7 +32,7 @@ jobs: Tests: docker: - - image: cimg/node:22.3.0 + - image: cimg/node:22.4.0 parameters: project: type: string @@ -54,7 +54,7 @@ jobs: BuildTarball: docker: - - image: cimg/node:22.3.0 + - image: cimg/node:22.4.0 steps: - checkout - run: npm run ci:precheck @@ -73,7 +73,7 @@ jobs: react: type: string docker: - - image: cimg/node:22.3.0-browsers + - image: cimg/node:22.4.0-browsers steps: - checkout - attach_workspace: @@ -111,7 +111,7 @@ jobs: externalPackage: type: string docker: - - image: cimg/node:22.3.0 + - image: cimg/node:22.4.0 steps: - checkout - attach_workspace: From 09a6677ec1a0cffedeecb2cbac5cd3a3c8aa0fa1 Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Tue, 9 Jul 2024 09:39:27 +0200 Subject: [PATCH 13/17] also wrap createQueryPreloader (#11719) * also wrap `createQueryPreloader` * changeset * Clean up Prettier, Size-limit, and Api-Extractor --------- Co-authored-by: phryneas --- .api-reports/api-report-react_internal.api.md | 72 ++++++++++++++++++- .changeset/thin-lies-begin.md | 5 ++ .size-limits.json | 2 +- src/react/hooks/internal/wrapHook.ts | 2 + .../query-preloader/createQueryPreloader.ts | 11 ++- 5 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 .changeset/thin-lies-begin.md diff --git a/.api-reports/api-report-react_internal.api.md b/.api-reports/api-report-react_internal.api.md index 95a7366593c..77a4d29c2f8 100644 --- a/.api-reports/api-report-react_internal.api.md +++ b/.api-reports/api-report-react_internal.api.md @@ -493,6 +493,11 @@ class Concast extends Observable { // @public (undocumented) type ConcastSourcesIterable = Iterable>; +// Warning: (ae-forgotten-export) The symbol "PreloadQueryFunction" needs to be exported by the entry point index.d.ts +// +// @public +function createQueryPreloader(client: ApolloClient): PreloadQueryFunction; + // @public (undocumented) namespace DataProxy { // (undocumented) @@ -1252,6 +1257,11 @@ const OBSERVED_CHANGED_OPTIONS: readonly ["canonizeResults", "context", "errorPo // @public (undocumented) type ObservedOptions = Pick; +// @public +type OnlyRequiredProperties = { + [K in keyof T as {} extends Pick ? never : K]: T[K]; +}; + // @public (undocumented) type OnQueryUpdated = (observableQuery: ObservableQuery, diff: Cache_2.DiffResult, lastDiff: Cache_2.DiffResult | undefined) => boolean | TResult; @@ -1291,6 +1301,50 @@ export interface PreloadedQueryRef extend toPromise(): Promise>; } +// @public (undocumented) +type PreloadQueryFetchPolicy = Extract; + +// @public +interface PreloadQueryFunction { + // Warning: (ae-forgotten-export) The symbol "PreloadQueryOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "PreloadQueryOptionsArg" needs to be exported by the entry point index.d.ts + >(query: DocumentNode | TypedDocumentNode, ...[options]: PreloadQueryOptionsArg, TOptions>): PreloadedQueryRef | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? DeepPartial : TData, TVariables>; + (query: DocumentNode | TypedDocumentNode, options: PreloadQueryOptions> & { + returnPartialData: true; + errorPolicy: "ignore" | "all"; + }): PreloadedQueryRef | undefined, TVariables>; + (query: DocumentNode | TypedDocumentNode, options: PreloadQueryOptions> & { + errorPolicy: "ignore" | "all"; + }): PreloadedQueryRef; + (query: DocumentNode | TypedDocumentNode, options: PreloadQueryOptions> & { + returnPartialData: true; + }): PreloadedQueryRef, TVariables>; + (query: DocumentNode | TypedDocumentNode, ...[options]: PreloadQueryOptionsArg>): PreloadedQueryRef; +} + +// Warning: (ae-forgotten-export) The symbol "VariablesOption" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type PreloadQueryOptions = { + canonizeResults?: boolean; + context?: DefaultContext; + errorPolicy?: ErrorPolicy; + fetchPolicy?: PreloadQueryFetchPolicy; + returnPartialData?: boolean; + refetchWritePolicy?: RefetchWritePolicy; +} & VariablesOption; + +// Warning: (ae-forgotten-export) The symbol "OnlyRequiredProperties" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type PreloadQueryOptionsArg = [TVariables] extends [never] ? [ +options?: PreloadQueryOptions & TOptions +] : {} extends OnlyRequiredProperties ? [ +options?: PreloadQueryOptions> & Omit +] : [ +options: PreloadQueryOptions> & Omit +]; + // @public (undocumented) type Primitive = null | undefined | string | number | boolean | symbol | bigint; @@ -1692,7 +1746,6 @@ interface SharedWatchQueryOptions // @deprecated partialRefetch?: boolean; pollInterval?: number; - // Warning: (ae-forgotten-export) The symbol "RefetchWritePolicy" needs to be exported by the entry point index.d.ts refetchWritePolicy?: RefetchWritePolicy; returnPartialData?: boolean; skipPollAttempt?: () => boolean; @@ -2049,6 +2102,17 @@ interface UseSuspenseQueryResult; } +// @public (undocumented) +type VariablesOption = [ +TVariables +] extends [never] ? { + variables?: Record; +} : {} extends OnlyRequiredProperties ? { + variables?: TVariables; +} : { + variables: TVariables; +}; + // @public interface WatchFragmentOptions { // @deprecated (undocumented) @@ -2081,6 +2145,10 @@ interface WatchQueryOptions(inter // src/react/hooks/useBackgroundQuery.ts:38:3 - (ae-forgotten-export) The symbol "SubscribeToMoreFunction" needs to be exported by the entry point index.d.ts // src/react/hooks/useBackgroundQuery.ts:54:3 - (ae-forgotten-export) The symbol "FetchMoreFunction" needs to be exported by the entry point index.d.ts // src/react/hooks/useBackgroundQuery.ts:78:4 - (ae-forgotten-export) The symbol "RefetchFunction" needs to be exported by the entry point index.d.ts +// src/react/query-preloader/createQueryPreloader.ts:145:3 - (ae-forgotten-export) The symbol "PreloadQueryFetchPolicy" needs to be exported by the entry point index.d.ts +// src/react/query-preloader/createQueryPreloader.ts:167:5 - (ae-forgotten-export) The symbol "RefetchWritePolicy" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/.changeset/thin-lies-begin.md b/.changeset/thin-lies-begin.md new file mode 100644 index 00000000000..bc258c65cdf --- /dev/null +++ b/.changeset/thin-lies-begin.md @@ -0,0 +1,5 @@ +--- +"@apollo/client": patch +--- + +Allow wrapping `createQueryPreloader` diff --git a/.size-limits.json b/.size-limits.json index 28452c40fd4..e794acb3beb 100644 --- a/.size-limits.json +++ b/.size-limits.json @@ -1,4 +1,4 @@ { - "dist/apollo-client.min.cjs": 40015, + "dist/apollo-client.min.cjs": 40030, "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32903 } diff --git a/src/react/hooks/internal/wrapHook.ts b/src/react/hooks/internal/wrapHook.ts index c22ec726e9d..59b112c3216 100644 --- a/src/react/hooks/internal/wrapHook.ts +++ b/src/react/hooks/internal/wrapHook.ts @@ -9,10 +9,12 @@ import type { import type { QueryManager } from "../../../core/QueryManager.js"; import type { ApolloClient } from "../../../core/ApolloClient.js"; import type { ObservableQuery } from "../../../core/ObservableQuery.js"; +import type { createQueryPreloader } from "../../query-preloader/createQueryPreloader.js"; const wrapperSymbol = Symbol.for("apollo.hook.wrappers"); interface WrappableHooks { + createQueryPreloader: typeof createQueryPreloader; useQuery: typeof useQuery; useSuspenseQuery: typeof useSuspenseQuery; useBackgroundQuery: typeof useBackgroundQuery; diff --git a/src/react/query-preloader/createQueryPreloader.ts b/src/react/query-preloader/createQueryPreloader.ts index 226723dab9a..6389992519c 100644 --- a/src/react/query-preloader/createQueryPreloader.ts +++ b/src/react/query-preloader/createQueryPreloader.ts @@ -16,6 +16,7 @@ import type { import { InternalQueryReference, wrapQueryRef } from "../internal/index.js"; import type { PreloadedQueryRef } from "../internal/index.js"; import type { NoInfer } from "../index.js"; +import { wrapHook } from "../hooks/internal/index.js"; type VariablesOption = [TVariables] extends [never] ? @@ -168,6 +169,14 @@ export interface PreloadQueryFunction { export function createQueryPreloader( client: ApolloClient ): PreloadQueryFunction { + return wrapHook( + "createQueryPreloader", + _createQueryPreloader, + client + )(client); +} + +const _createQueryPreloader: typeof createQueryPreloader = (client) => { return function preloadQuery< TData = unknown, TVariables extends OperationVariables = OperationVariables, @@ -189,4 +198,4 @@ export function createQueryPreloader( return wrapQueryRef(queryRef) as PreloadedQueryRef; }; -} +}; From 602a67896886c9ce8595d340fe88c3768a79b4d2 Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Tue, 9 Jul 2024 15:00:50 +0200 Subject: [PATCH 14/17] forward `errorPolicy` option from `useSubscription` (#11928) * forward `errorPolicy` option from `useSubscription` * more work * add test * ensure errors are instanceOf `ApolloError` * test with more realistic errors * Clean up Prettier, Size-limit, and Api-Extractor --------- Co-authored-by: phryneas --- .api-reports/api-report-react.api.md | 3 +- .../api-report-react_components.api.md | 3 +- .api-reports/api-report-react_hooks.api.md | 3 +- .api-reports/api-report.api.md | 1 + .size-limits.json | 2 +- .../hooks/__tests__/useSubscription.test.tsx | 248 +++++++++++++++++- src/react/hooks/useQuery.ts | 4 +- src/react/hooks/useSubscription.ts | 46 +++- src/react/types/types.ts | 2 + 9 files changed, 298 insertions(+), 14 deletions(-) diff --git a/.api-reports/api-report-react.api.md b/.api-reports/api-report-react.api.md index d685c3f6599..6fd83bb10f4 100644 --- a/.api-reports/api-report-react.api.md +++ b/.api-reports/api-report-react.api.md @@ -386,6 +386,8 @@ export interface BaseQueryOptions { client?: ApolloClient; context?: Context; + // Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts + errorPolicy?: ErrorPolicy; // Warning: (ae-forgotten-export) The symbol "FetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: FetchPolicy; ignoreResults?: boolean; @@ -994,7 +996,6 @@ export interface LoadableQueryHookOptions { canonizeResults?: boolean; client?: ApolloClient; context?: Context; - // Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts errorPolicy?: ErrorPolicy; fetchPolicy?: LoadableQueryHookFetchPolicy; queryKey?: string | number | any[]; diff --git a/.api-reports/api-report-react_components.api.md b/.api-reports/api-report-react_components.api.md index 0aff1af40cf..350691ae935 100644 --- a/.api-reports/api-report-react_components.api.md +++ b/.api-reports/api-report-react_components.api.md @@ -334,6 +334,8 @@ interface BaseQueryOptions { client?: ApolloClient; context?: DefaultContext; + // Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts + errorPolicy?: ErrorPolicy; // Warning: (ae-forgotten-export) The symbol "FetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: FetchPolicy; ignoreResults?: boolean; @@ -982,7 +984,6 @@ export interface Mutation { interface MutationBaseOptions = ApolloCache> { awaitRefetchQueries?: boolean; context?: TContext; - // Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts errorPolicy?: ErrorPolicy; // Warning: (ae-forgotten-export) The symbol "OnQueryUpdated" needs to be exported by the entry point index.d.ts onQueryUpdated?: OnQueryUpdated; diff --git a/.api-reports/api-report-react_hooks.api.md b/.api-reports/api-report-react_hooks.api.md index 2dcd7bce461..861d5c89198 100644 --- a/.api-reports/api-report-react_hooks.api.md +++ b/.api-reports/api-report-react_hooks.api.md @@ -357,6 +357,8 @@ interface BaseQueryOptions { client?: ApolloClient; context?: DefaultContext; + // Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts + errorPolicy?: ErrorPolicy; // Warning: (ae-forgotten-export) The symbol "FetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: FetchPolicy; ignoreResults?: boolean; @@ -942,7 +944,6 @@ interface LoadableQueryHookOptions { canonizeResults?: boolean; client?: ApolloClient; context?: DefaultContext; - // Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts errorPolicy?: ErrorPolicy; // Warning: (ae-forgotten-export) The symbol "LoadableQueryHookFetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: LoadableQueryHookFetchPolicy; diff --git a/.api-reports/api-report.api.md b/.api-reports/api-report.api.md index 007a3ba589b..181d29f8273 100644 --- a/.api-reports/api-report.api.md +++ b/.api-reports/api-report.api.md @@ -358,6 +358,7 @@ export interface BaseQueryOptions { client?: ApolloClient; context?: DefaultContext; + errorPolicy?: ErrorPolicy; fetchPolicy?: FetchPolicy; ignoreResults?: boolean; onComplete?: () => void; diff --git a/.size-limits.json b/.size-limits.json index e794acb3beb..e7e76549d6e 100644 --- a/.size-limits.json +++ b/.size-limits.json @@ -1,4 +1,4 @@ { - "dist/apollo-client.min.cjs": 40030, + "dist/apollo-client.min.cjs": 40066, "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32903 } diff --git a/src/react/hooks/__tests__/useSubscription.test.tsx b/src/react/hooks/__tests__/useSubscription.test.tsx index eb02e41c9aa..c003585f309 100644 --- a/src/react/hooks/__tests__/useSubscription.test.tsx +++ b/src/react/hooks/__tests__/useSubscription.test.tsx @@ -16,6 +16,8 @@ import { MockSubscriptionLink } from "../../../testing"; import { useSubscription } from "../useSubscription"; import { profileHook, spyOnConsole } from "../../../testing/internal"; import { SubscriptionHookOptions } from "../../types/types"; +import { ErrorBoundary } from "react-error-boundary"; +import { MockedSubscriptionResult } from "../../../testing/core/mocking/mockSubscriptionLink"; import { GraphQLError } from "graphql"; import { InvariantError } from "ts-invariant"; @@ -1123,6 +1125,248 @@ followed by new in-flight setup", async () => { unmount(); }); + + describe("errorPolicy", () => { + function setup() { + const subscription: TypedDocumentNode<{ totalLikes: number }, {}> = gql` + subscription ($id: ID!) { + totalLikes + } + `; + const errorBoundaryOnError = jest.fn(); + const link = new MockSubscriptionLink(); + const client = new ApolloClient({ + link, + cache: new Cache(), + }); + const ProfiledHook = profileHook( + (options: SubscriptionHookOptions<{ totalLikes: number }, {}>) => + useSubscription(subscription, options) + ); + const wrapper = ({ children }: { children: any }) => ( + + error}> + {children} + + + ); + const graphQlErrorResult: MockedSubscriptionResult = { + result: { + data: { totalLikes: 42 }, + errors: [{ message: "test" } as any], + }, + }; + const protocolErrorResult: MockedSubscriptionResult = { + error: new Error("Socket closed with event -1: I'm a test!"), + }; + return { + client, + link, + errorBoundaryOnError, + ProfiledHook, + wrapper, + graphQlErrorResult, + protocolErrorResult, + }; + } + describe("GraphQL error", () => { + it.each([undefined, "none"] as const)( + "`errorPolicy: '%s'`: returns `{ error }`, calls `onError`", + async (errorPolicy) => { + const { + ProfiledHook, + wrapper, + link, + graphQlErrorResult, + errorBoundaryOnError, + } = setup(); + const onData = jest.fn(); + const onError = jest.fn(); + render( + , + { + wrapper, + } + ); + + await ProfiledHook.takeSnapshot(); + link.simulateResult(graphQlErrorResult); + { + const snapshot = await ProfiledHook.takeSnapshot(); + console.dir({ graphQlErrorResult, snapshot }, { depth: 5 }); + expect(snapshot).toStrictEqual({ + loading: false, + error: new ApolloError({ + graphQLErrors: graphQlErrorResult.result!.errors as any, + }), + data: undefined, + restart: expect.any(Function), + variables: undefined, + }); + expect(snapshot.error).toBeInstanceOf(ApolloError); + } + expect(onError).toHaveBeenCalledTimes(1); + expect(onError).toHaveBeenCalledWith( + new ApolloError({ + graphQLErrors: graphQlErrorResult.result!.errors as any, + }) + ); + expect(onError).toHaveBeenCalledWith(expect.any(ApolloError)); + expect(onData).toHaveBeenCalledTimes(0); + expect(errorBoundaryOnError).toHaveBeenCalledTimes(0); + } + ); + it("`errorPolicy: 'all'`: returns `{ error, data }`, calls `onError`", async () => { + const { + ProfiledHook, + wrapper, + link, + graphQlErrorResult, + errorBoundaryOnError, + } = setup(); + const onData = jest.fn(); + const onError = jest.fn(); + render( + , + { + wrapper, + } + ); + + await ProfiledHook.takeSnapshot(); + link.simulateResult(graphQlErrorResult); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + error: new ApolloError({ + errorMessage: "test", + graphQLErrors: graphQlErrorResult.result!.errors as any, + }), + data: { totalLikes: 42 }, + restart: expect.any(Function), + variables: undefined, + }); + expect(snapshot.error).toBeInstanceOf(ApolloError); + } + + expect(onError).toHaveBeenCalledTimes(1); + expect(onError).toHaveBeenCalledWith( + new ApolloError({ + errorMessage: "test", + graphQLErrors: graphQlErrorResult.result!.errors as any, + }) + ); + expect(onError).toHaveBeenCalledWith(expect.any(ApolloError)); + expect(onData).toHaveBeenCalledTimes(0); + expect(errorBoundaryOnError).toHaveBeenCalledTimes(0); + }); + it("`errorPolicy: 'ignore'`: returns `{ data }`, calls `onData`", async () => { + const { + ProfiledHook, + wrapper, + link, + graphQlErrorResult, + errorBoundaryOnError, + } = setup(); + const onData = jest.fn(); + const onError = jest.fn(); + render( + , + { + wrapper, + } + ); + + await ProfiledHook.takeSnapshot(); + link.simulateResult(graphQlErrorResult); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + error: undefined, + data: { totalLikes: 42 }, + restart: expect.any(Function), + variables: undefined, + }); + } + + expect(onError).toHaveBeenCalledTimes(0); + expect(onData).toHaveBeenCalledTimes(1); + expect(onData).toHaveBeenCalledWith({ + client: expect.anything(), + data: { + data: { totalLikes: 42 }, + loading: false, + // should this be undefined? + error: undefined, + variables: undefined, + }, + }); + expect(errorBoundaryOnError).toHaveBeenCalledTimes(0); + }); + }); + describe("protocol error", () => { + it.each([undefined, "none", "all", "ignore"] as const)( + "`errorPolicy: '%s'`: returns `{ error }`, calls `onError`", + async (errorPolicy) => { + const { + ProfiledHook, + wrapper, + link, + protocolErrorResult, + errorBoundaryOnError, + } = setup(); + const onData = jest.fn(); + const onError = jest.fn(); + render( + , + { + wrapper, + } + ); + + await ProfiledHook.takeSnapshot(); + link.simulateResult(protocolErrorResult); + { + const snapshot = await ProfiledHook.takeSnapshot(); + expect(snapshot).toStrictEqual({ + loading: false, + error: new ApolloError({ + protocolErrors: [protocolErrorResult.error!], + }), + data: undefined, + restart: expect.any(Function), + variables: undefined, + }); + expect(snapshot.error).toBeInstanceOf(ApolloError); + } + + expect(onError).toHaveBeenCalledTimes(1); + expect(onError).toHaveBeenCalledWith(expect.any(ApolloError)); + expect(onError).toHaveBeenCalledWith( + new ApolloError({ + protocolErrors: [protocolErrorResult.error!], + }) + ); + expect(onData).toHaveBeenCalledTimes(0); + expect(errorBoundaryOnError).toHaveBeenCalledTimes(0); + } + ); + }); + }); }); describe("`restart` callback", () => { @@ -1597,7 +1841,9 @@ describe("ignoreResults", () => { await waitFor(() => { expect(onData).toHaveBeenCalledTimes(1); expect(onError).toHaveBeenCalledTimes(1); - expect(onError).toHaveBeenLastCalledWith(error); + expect(onError).toHaveBeenLastCalledWith( + new ApolloError({ protocolErrors: [error] }) + ); expect(onComplete).toHaveBeenCalledTimes(0); }); diff --git a/src/react/hooks/useQuery.ts b/src/react/hooks/useQuery.ts index f3ef9aacb0e..8f56c095fe5 100644 --- a/src/react/hooks/useQuery.ts +++ b/src/react/hooks/useQuery.ts @@ -776,8 +776,8 @@ export function getDefaultFetchPolicy< ); } -function toApolloError( - result: ApolloQueryResult +export function toApolloError( + result: Pick, "errors" | "error"> ): ApolloError | undefined { return isNonEmptyArray(result.errors) ? new ApolloError({ graphQLErrors: result.errors }) diff --git a/src/react/hooks/useSubscription.ts b/src/react/hooks/useSubscription.ts index d602578de73..0bbcb9cf17e 100644 --- a/src/react/hooks/useSubscription.ts +++ b/src/react/hooks/useSubscription.ts @@ -13,14 +13,16 @@ import type { import type { ApolloClient, DefaultContext, + ErrorPolicy, FetchPolicy, FetchResult, OperationVariables, } from "../../core/index.js"; -import { Observable } from "../../core/index.js"; +import { ApolloError, Observable } from "../../core/index.js"; import { useApolloClient } from "./useApolloClient.js"; import { useDeepMemo } from "./internal/useDeepMemo.js"; import { useSyncExternalStore } from "./useSyncExternalStore.js"; +import { toApolloError } from "./useQuery.js"; import { useIsomorphicLayoutEffect } from "./internal/useIsomorphicLayoutEffect.js"; /** @@ -138,18 +140,38 @@ export function useSubscription< } } - const { skip, fetchPolicy, shouldResubscribe, context, ignoreResults } = - options; + const { + skip, + fetchPolicy, + errorPolicy, + shouldResubscribe, + context, + ignoreResults, + } = options; const variables = useDeepMemo(() => options.variables, [options.variables]); let [observable, setObservable] = React.useState(() => options.skip ? null : ( - createSubscription(client, subscription, variables, fetchPolicy, context) + createSubscription( + client, + subscription, + variables, + fetchPolicy, + errorPolicy, + context + ) ) ); const recreate = () => - createSubscription(client, subscription, variables, fetchPolicy, context); + createSubscription( + client, + subscription, + variables, + fetchPolicy, + errorPolicy, + context + ); const recreateRef = React.useRef(recreate); useIsomorphicLayoutEffect(() => { @@ -165,6 +187,7 @@ export function useSubscription< ((client !== observable.__.client || subscription !== observable.__.query || fetchPolicy !== observable.__.fetchPolicy || + errorPolicy !== observable.__.errorPolicy || !equal(variables, observable.__.variables)) && (typeof shouldResubscribe === "function" ? !!shouldResubscribe(options!) @@ -223,13 +246,15 @@ export function useSubscription< // TODO: fetchResult.data can be null but SubscriptionResult.data // expects TData | undefined only data: fetchResult.data!, - error: void 0, + error: toApolloError(fetchResult), variables, }; observable.__.setResult(result); if (!ignoreResultsRef.current) update(); - if (optionsRef.current.onData) { + if (result.error) { + optionsRef.current.onError?.(result.error); + } else if (optionsRef.current.onData) { optionsRef.current.onData({ client, data: result, @@ -242,6 +267,10 @@ export function useSubscription< } }, error(error) { + error = + error instanceof ApolloError ? error : ( + new ApolloError({ protocolErrors: [error] }) + ); if (!subscriptionStopped) { observable.__.setResult({ loading: false, @@ -304,6 +333,7 @@ function createSubscription< query: TypedDocumentNode, variables?: TVariables, fetchPolicy?: FetchPolicy, + errorPolicy?: ErrorPolicy, context?: DefaultContext ) { const __ = { @@ -311,6 +341,7 @@ function createSubscription< client, query, fetchPolicy, + errorPolicy, result: { loading: true, data: void 0, @@ -332,6 +363,7 @@ function createSubscription< query, variables, fetchPolicy, + errorPolicy, context, }); } diff --git a/src/react/types/types.ts b/src/react/types/types.ts index be799bf52dd..ee441640737 100644 --- a/src/react/types/types.ts +++ b/src/react/types/types.ts @@ -437,6 +437,8 @@ export interface BaseSubscriptionOptions< variables?: TVariables; /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#fetchPolicy:member} */ fetchPolicy?: FetchPolicy; + /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#errorPolicy:member} */ + errorPolicy?: ErrorPolicy; /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#shouldResubscribe:member} */ shouldResubscribe?: | boolean From 1b23337e5a9eec4ce3ed69531ca4f4afe8e897a6 Mon Sep 17 00:00:00 2001 From: Jerel Miller Date: Tue, 9 Jul 2024 08:16:30 -0600 Subject: [PATCH 15/17] Add ability to configure a name for the client for use with devtools (#11936) Co-authored-by: Lenz Weber-Tronic --- .api-reports/api-report-core.api.md | 12 ++++++ .api-reports/api-report-react.api.md | 12 ++++++ .../api-report-react_components.api.md | 12 ++++++ .api-reports/api-report-react_context.api.md | 12 ++++++ .api-reports/api-report-react_hoc.api.md | 12 ++++++ .api-reports/api-report-react_hooks.api.md | 12 ++++++ .api-reports/api-report-react_internal.api.md | 12 ++++++ .api-reports/api-report-react_ssr.api.md | 12 ++++++ .api-reports/api-report-testing.api.md | 12 ++++++ .api-reports/api-report-testing_core.api.md | 12 ++++++ .api-reports/api-report-utilities.api.md | 12 ++++++ .api-reports/api-report.api.md | 12 ++++++ .changeset/pink-ants-remember.md | 16 +++++++ .size-limits.json | 4 +- src/core/ApolloClient.ts | 43 +++++++++++++++++-- 15 files changed, 201 insertions(+), 6 deletions(-) create mode 100644 .changeset/pink-ants-remember.md diff --git a/.api-reports/api-report-core.api.md b/.api-reports/api-report-core.api.md index 35789a58440..92b34976cf7 100644 --- a/.api-reports/api-report-core.api.md +++ b/.api-reports/api-report-core.api.md @@ -103,6 +103,10 @@ export class ApolloClient implements DataProxy { get defaultContext(): Partial; // (undocumented) defaultOptions: DefaultOptions; + // Warning: (ae-forgotten-export) The symbol "DevtoolsOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly devtoolsConfig: DevtoolsOptions; // (undocumented) disableNetworkFetches: boolean; get documentTransform(): DocumentTransform; @@ -144,12 +148,14 @@ export class ApolloClient implements DataProxy { export interface ApolloClientOptions { assumeImmutableResults?: boolean; cache: ApolloCache; + // @deprecated connectToDevTools?: boolean; // (undocumented) credentials?: string; // (undocumented) defaultContext?: Partial; defaultOptions?: DefaultOptions; + devtools?: DevtoolsOptions; // (undocumented) documentTransform?: DocumentTransform; // (undocumented) @@ -593,6 +599,12 @@ interface DeleteModifier { // @public (undocumented) const _deleteModifier: unique symbol; +// @public (undocumented) +interface DevtoolsOptions { + enabled?: boolean; + name?: string; +} + // @public (undocumented) export type DiffQueryAgainstStoreOptions = ReadQueryOptions & { returnPartialData?: boolean; diff --git a/.api-reports/api-report-react.api.md b/.api-reports/api-report-react.api.md index 6fd83bb10f4..916035b05c5 100644 --- a/.api-reports/api-report-react.api.md +++ b/.api-reports/api-report-react.api.md @@ -114,6 +114,10 @@ class ApolloClient implements DataProxy { get defaultContext(): Partial; // (undocumented) defaultOptions: DefaultOptions; + // Warning: (ae-forgotten-export) The symbol "DevtoolsOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly devtoolsConfig: DevtoolsOptions; // (undocumented) disableNetworkFetches: boolean; // Warning: (ae-forgotten-export) The symbol "DocumentTransform" needs to be exported by the entry point index.d.ts @@ -171,12 +175,14 @@ class ApolloClient implements DataProxy { interface ApolloClientOptions { assumeImmutableResults?: boolean; cache: ApolloCache; + // @deprecated connectToDevTools?: boolean; // (undocumented) credentials?: string; // (undocumented) defaultContext?: Partial; defaultOptions?: DefaultOptions; + devtools?: DevtoolsOptions; // (undocumented) documentTransform?: DocumentTransform; // (undocumented) @@ -680,6 +686,12 @@ interface DeleteModifier { // @public (undocumented) const _deleteModifier: unique symbol; +// @public (undocumented) +interface DevtoolsOptions { + enabled?: boolean; + name?: string; +} + // @public (undocumented) class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts diff --git a/.api-reports/api-report-react_components.api.md b/.api-reports/api-report-react_components.api.md index 350691ae935..90af57d6d2e 100644 --- a/.api-reports/api-report-react_components.api.md +++ b/.api-reports/api-report-react_components.api.md @@ -114,6 +114,10 @@ class ApolloClient implements DataProxy { get defaultContext(): Partial; // (undocumented) defaultOptions: DefaultOptions; + // Warning: (ae-forgotten-export) The symbol "DevtoolsOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly devtoolsConfig: DevtoolsOptions; // (undocumented) disableNetworkFetches: boolean; // Warning: (ae-forgotten-export) The symbol "DocumentTransform" needs to be exported by the entry point index.d.ts @@ -172,12 +176,14 @@ class ApolloClient implements DataProxy { interface ApolloClientOptions { assumeImmutableResults?: boolean; cache: ApolloCache; + // @deprecated connectToDevTools?: boolean; // (undocumented) credentials?: string; // (undocumented) defaultContext?: Partial; defaultOptions?: DefaultOptions; + devtools?: DevtoolsOptions; // (undocumented) documentTransform?: DocumentTransform; // (undocumented) @@ -623,6 +629,12 @@ interface DeleteModifier { // @public (undocumented) const _deleteModifier: unique symbol; +// @public (undocumented) +interface DevtoolsOptions { + enabled?: boolean; + name?: string; +} + // @public (undocumented) class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts diff --git a/.api-reports/api-report-react_context.api.md b/.api-reports/api-report-react_context.api.md index 41aed0f90c4..f2ec9bb082b 100644 --- a/.api-reports/api-report-react_context.api.md +++ b/.api-reports/api-report-react_context.api.md @@ -113,6 +113,10 @@ class ApolloClient implements DataProxy { get defaultContext(): Partial; // (undocumented) defaultOptions: DefaultOptions; + // Warning: (ae-forgotten-export) The symbol "DevtoolsOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly devtoolsConfig: DevtoolsOptions; // (undocumented) disableNetworkFetches: boolean; // Warning: (ae-forgotten-export) The symbol "DocumentTransform" needs to be exported by the entry point index.d.ts @@ -171,12 +175,14 @@ class ApolloClient implements DataProxy { interface ApolloClientOptions { assumeImmutableResults?: boolean; cache: ApolloCache; + // @deprecated connectToDevTools?: boolean; // (undocumented) credentials?: string; // (undocumented) defaultContext?: Partial; defaultOptions?: DefaultOptions; + devtools?: DevtoolsOptions; // (undocumented) documentTransform?: DocumentTransform; // (undocumented) @@ -618,6 +624,12 @@ interface DeleteModifier { // @public (undocumented) const _deleteModifier: unique symbol; +// @public (undocumented) +interface DevtoolsOptions { + enabled?: boolean; + name?: string; +} + // @public (undocumented) class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts diff --git a/.api-reports/api-report-react_hoc.api.md b/.api-reports/api-report-react_hoc.api.md index 18f094dde4c..f82219194f5 100644 --- a/.api-reports/api-report-react_hoc.api.md +++ b/.api-reports/api-report-react_hoc.api.md @@ -113,6 +113,10 @@ class ApolloClient implements DataProxy { get defaultContext(): Partial; // (undocumented) defaultOptions: DefaultOptions; + // Warning: (ae-forgotten-export) The symbol "DevtoolsOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly devtoolsConfig: DevtoolsOptions; // (undocumented) disableNetworkFetches: boolean; // Warning: (ae-forgotten-export) The symbol "DocumentTransform" needs to be exported by the entry point index.d.ts @@ -171,12 +175,14 @@ class ApolloClient implements DataProxy { interface ApolloClientOptions { assumeImmutableResults?: boolean; cache: ApolloCache; + // @deprecated connectToDevTools?: boolean; // (undocumented) credentials?: string; // (undocumented) defaultContext?: Partial; defaultOptions?: DefaultOptions; + devtools?: DevtoolsOptions; // (undocumented) documentTransform?: DocumentTransform; // (undocumented) @@ -616,6 +622,12 @@ interface DeleteModifier { // @public (undocumented) const _deleteModifier: unique symbol; +// @public (undocumented) +interface DevtoolsOptions { + enabled?: boolean; + name?: string; +} + // @public (undocumented) class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts diff --git a/.api-reports/api-report-react_hooks.api.md b/.api-reports/api-report-react_hooks.api.md index 861d5c89198..094ea9d31a8 100644 --- a/.api-reports/api-report-react_hooks.api.md +++ b/.api-reports/api-report-react_hooks.api.md @@ -112,6 +112,10 @@ class ApolloClient implements DataProxy { get defaultContext(): Partial; // (undocumented) defaultOptions: DefaultOptions; + // Warning: (ae-forgotten-export) The symbol "DevtoolsOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly devtoolsConfig: DevtoolsOptions; // (undocumented) disableNetworkFetches: boolean; // Warning: (ae-forgotten-export) The symbol "DocumentTransform" needs to be exported by the entry point index.d.ts @@ -170,12 +174,14 @@ class ApolloClient implements DataProxy { interface ApolloClientOptions { assumeImmutableResults?: boolean; cache: ApolloCache; + // @deprecated connectToDevTools?: boolean; // (undocumented) credentials?: string; // (undocumented) defaultContext?: Partial; defaultOptions?: DefaultOptions; + devtools?: DevtoolsOptions; // (undocumented) documentTransform?: DocumentTransform; // (undocumented) @@ -646,6 +652,12 @@ interface DeleteModifier { // @public (undocumented) const _deleteModifier: unique symbol; +// @public (undocumented) +interface DevtoolsOptions { + enabled?: boolean; + name?: string; +} + // @public (undocumented) class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts diff --git a/.api-reports/api-report-react_internal.api.md b/.api-reports/api-report-react_internal.api.md index 77a4d29c2f8..81bffbb7458 100644 --- a/.api-reports/api-report-react_internal.api.md +++ b/.api-reports/api-report-react_internal.api.md @@ -112,6 +112,10 @@ class ApolloClient implements DataProxy { get defaultContext(): Partial; // (undocumented) defaultOptions: DefaultOptions; + // Warning: (ae-forgotten-export) The symbol "DevtoolsOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly devtoolsConfig: DevtoolsOptions; // (undocumented) disableNetworkFetches: boolean; // Warning: (ae-forgotten-export) The symbol "DocumentTransform" needs to be exported by the entry point index.d.ts @@ -170,12 +174,14 @@ class ApolloClient implements DataProxy { interface ApolloClientOptions { assumeImmutableResults?: boolean; cache: ApolloCache; + // @deprecated connectToDevTools?: boolean; // (undocumented) credentials?: string; // (undocumented) defaultContext?: Partial; defaultOptions?: DefaultOptions; + devtools?: DevtoolsOptions; // (undocumented) documentTransform?: DocumentTransform; // (undocumented) @@ -631,6 +637,12 @@ interface DeleteModifier { // @public (undocumented) const _deleteModifier: unique symbol; +// @public (undocumented) +interface DevtoolsOptions { + enabled?: boolean; + name?: string; +} + // @public (undocumented) class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts diff --git a/.api-reports/api-report-react_ssr.api.md b/.api-reports/api-report-react_ssr.api.md index ea788b305b9..ca7a9f6f209 100644 --- a/.api-reports/api-report-react_ssr.api.md +++ b/.api-reports/api-report-react_ssr.api.md @@ -113,6 +113,10 @@ class ApolloClient implements DataProxy { get defaultContext(): Partial; // (undocumented) defaultOptions: DefaultOptions; + // Warning: (ae-forgotten-export) The symbol "DevtoolsOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly devtoolsConfig: DevtoolsOptions; // (undocumented) disableNetworkFetches: boolean; // Warning: (ae-forgotten-export) The symbol "DocumentTransform" needs to be exported by the entry point index.d.ts @@ -171,12 +175,14 @@ class ApolloClient implements DataProxy { interface ApolloClientOptions { assumeImmutableResults?: boolean; cache: ApolloCache; + // @deprecated connectToDevTools?: boolean; // (undocumented) credentials?: string; // (undocumented) defaultContext?: Partial; defaultOptions?: DefaultOptions; + devtools?: DevtoolsOptions; // (undocumented) documentTransform?: DocumentTransform; // (undocumented) @@ -587,6 +593,12 @@ interface DeleteModifier { // @public (undocumented) const _deleteModifier: unique symbol; +// @public (undocumented) +interface DevtoolsOptions { + enabled?: boolean; + name?: string; +} + // @public (undocumented) class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts diff --git a/.api-reports/api-report-testing.api.md b/.api-reports/api-report-testing.api.md index 01ba05ec8b1..ffcefbd2d41 100644 --- a/.api-reports/api-report-testing.api.md +++ b/.api-reports/api-report-testing.api.md @@ -113,6 +113,10 @@ class ApolloClient implements DataProxy { get defaultContext(): Partial; // (undocumented) defaultOptions: DefaultOptions; + // Warning: (ae-forgotten-export) The symbol "DevtoolsOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly devtoolsConfig: DevtoolsOptions; // (undocumented) disableNetworkFetches: boolean; // Warning: (ae-forgotten-export) The symbol "DocumentTransform" needs to be exported by the entry point index.d.ts @@ -171,12 +175,14 @@ class ApolloClient implements DataProxy { interface ApolloClientOptions { assumeImmutableResults?: boolean; cache: ApolloCache; + // @deprecated connectToDevTools?: boolean; // (undocumented) credentials?: string; // (undocumented) defaultContext?: Partial; defaultOptions?: DefaultOptions; + devtools?: DevtoolsOptions; // (undocumented) documentTransform?: DocumentTransform; // (undocumented) @@ -588,6 +594,12 @@ interface DeleteModifier { // @public (undocumented) const _deleteModifier: unique symbol; +// @public (undocumented) +interface DevtoolsOptions { + enabled?: boolean; + name?: string; +} + // @public (undocumented) class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts diff --git a/.api-reports/api-report-testing_core.api.md b/.api-reports/api-report-testing_core.api.md index 545e30231cd..b0659710384 100644 --- a/.api-reports/api-report-testing_core.api.md +++ b/.api-reports/api-report-testing_core.api.md @@ -112,6 +112,10 @@ class ApolloClient implements DataProxy { get defaultContext(): Partial; // (undocumented) defaultOptions: DefaultOptions; + // Warning: (ae-forgotten-export) The symbol "DevtoolsOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly devtoolsConfig: DevtoolsOptions; // (undocumented) disableNetworkFetches: boolean; // Warning: (ae-forgotten-export) The symbol "DocumentTransform" needs to be exported by the entry point index.d.ts @@ -170,12 +174,14 @@ class ApolloClient implements DataProxy { interface ApolloClientOptions { assumeImmutableResults?: boolean; cache: ApolloCache; + // @deprecated connectToDevTools?: boolean; // (undocumented) credentials?: string; // (undocumented) defaultContext?: Partial; defaultOptions?: DefaultOptions; + devtools?: DevtoolsOptions; // (undocumented) documentTransform?: DocumentTransform; // (undocumented) @@ -587,6 +593,12 @@ interface DeleteModifier { // @public (undocumented) const _deleteModifier: unique symbol; +// @public (undocumented) +interface DevtoolsOptions { + enabled?: boolean; + name?: string; +} + // @public (undocumented) class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts diff --git a/.api-reports/api-report-utilities.api.md b/.api-reports/api-report-utilities.api.md index 84e1668f11b..7b26126fdc0 100644 --- a/.api-reports/api-report-utilities.api.md +++ b/.api-reports/api-report-utilities.api.md @@ -126,6 +126,10 @@ class ApolloClient implements DataProxy { get defaultContext(): Partial; // (undocumented) defaultOptions: DefaultOptions; + // Warning: (ae-forgotten-export) The symbol "DevtoolsOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly devtoolsConfig: DevtoolsOptions; // (undocumented) disableNetworkFetches: boolean; get documentTransform(): DocumentTransform; @@ -183,12 +187,14 @@ class ApolloClient implements DataProxy { interface ApolloClientOptions { assumeImmutableResults?: boolean; cache: ApolloCache; + // @deprecated connectToDevTools?: boolean; // (undocumented) credentials?: string; // (undocumented) defaultContext?: Partial; defaultOptions?: DefaultOptions; + devtools?: DevtoolsOptions; // (undocumented) documentTransform?: DocumentTransform; // (undocumented) @@ -779,6 +785,12 @@ const _deleteModifier: unique symbol; // @public @deprecated (undocumented) export const DEV: boolean; +// @public (undocumented) +interface DevtoolsOptions { + enabled?: boolean; + name?: string; +} + // @public (undocumented) export type DirectiveInfo = { [fieldName: string]: { diff --git a/.api-reports/api-report.api.md b/.api-reports/api-report.api.md index 181d29f8273..a56145500ed 100644 --- a/.api-reports/api-report.api.md +++ b/.api-reports/api-report.api.md @@ -105,6 +105,10 @@ export class ApolloClient implements DataProxy { get defaultContext(): Partial; // (undocumented) defaultOptions: DefaultOptions; + // Warning: (ae-forgotten-export) The symbol "DevtoolsOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly devtoolsConfig: DevtoolsOptions; // (undocumented) disableNetworkFetches: boolean; get documentTransform(): DocumentTransform; @@ -146,12 +150,14 @@ export class ApolloClient implements DataProxy { export interface ApolloClientOptions { assumeImmutableResults?: boolean; cache: ApolloCache; + // @deprecated connectToDevTools?: boolean; // (undocumented) credentials?: string; // (undocumented) defaultContext?: Partial; defaultOptions?: DefaultOptions; + devtools?: DevtoolsOptions; // (undocumented) documentTransform?: DocumentTransform; // (undocumented) @@ -694,6 +700,12 @@ interface DeleteModifier { // @public (undocumented) const _deleteModifier: unique symbol; +// @public (undocumented) +interface DevtoolsOptions { + enabled?: boolean; + name?: string; +} + // @public (undocumented) export type DiffQueryAgainstStoreOptions = ReadQueryOptions & { returnPartialData?: boolean; diff --git a/.changeset/pink-ants-remember.md b/.changeset/pink-ants-remember.md new file mode 100644 index 00000000000..b5d5506d5b7 --- /dev/null +++ b/.changeset/pink-ants-remember.md @@ -0,0 +1,16 @@ +--- +"@apollo/client": minor +--- + +Add the ability to specify a name for the client instance for use with Apollo Client Devtools. This is useful when instantiating multiple clients to identify the client instance more easily. This deprecates the `connectToDevtools` option in favor of a new `devtools` configuration. + +```ts +new ApolloClient({ + devtools: { + enabled: true, + name: "Test Client", + }, +}); +``` + +This option is backwards-compatible with `connectToDevtools` and will be used in the absense of a `devtools` option. diff --git a/.size-limits.json b/.size-limits.json index e7e76549d6e..c81dd92070b 100644 --- a/.size-limits.json +++ b/.size-limits.json @@ -1,4 +1,4 @@ { - "dist/apollo-client.min.cjs": 40066, - "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32903 + "dist/apollo-client.min.cjs": 40110, + "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32941 } diff --git a/src/core/ApolloClient.ts b/src/core/ApolloClient.ts index 05e713d520a..307ea715e85 100644 --- a/src/core/ApolloClient.ts +++ b/src/core/ApolloClient.ts @@ -41,6 +41,22 @@ export interface DefaultOptions { mutate?: Partial>; } +export interface DevtoolsOptions { + /** + * If `true`, the [Apollo Client Devtools](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) browser extension can connect to this `ApolloClient` instance. + * + * The default value is `false` in production and `true` in development if there is a `window` object. + */ + enabled?: boolean; + + /** + * Optional name for this `ApolloClient` instance in the devtools. This is + * useful when you instantiate multiple clients and want to be able to + * identify them by name. + */ + name?: string; +} + let hasSuggestedDevtools = false; export interface ApolloClientOptions { @@ -85,6 +101,7 @@ export interface ApolloClientOptions { * If `true`, the [Apollo Client Devtools](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) browser extension can connect to Apollo Client. * * The default value is `false` in production and `true` in development (if there is a `window` object). + * @deprecated Please use the `devtools.enabled` option. */ connectToDevTools?: boolean; /** @@ -120,6 +137,13 @@ export interface ApolloClientOptions { */ version?: string; documentTransform?: DocumentTransform; + + /** + * Configuration used by the [Apollo Client Devtools extension](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) for this client. + * + * @since 3.11.0 + */ + devtools?: DevtoolsOptions; } // Though mergeOptions now resides in @apollo/client/utilities, it was @@ -148,6 +172,7 @@ export class ApolloClient implements DataProxy { public queryDeduplication: boolean; public defaultOptions: DefaultOptions; public readonly typeDefs: ApolloClientOptions["typeDefs"]; + public readonly devtoolsConfig: DevtoolsOptions; private queryManager: QueryManager; private devToolsHookCb?: Function; @@ -201,9 +226,7 @@ export class ApolloClient implements DataProxy { // Expose the client instance as window.__APOLLO_CLIENT__ and call // onBroadcast in queryManager.broadcastQueries to enable browser // devtools, but disable them by default in production. - connectToDevTools = typeof window === "object" && - !(window as any).__APOLLO_CLIENT__ && - __DEV__, + connectToDevTools, queryDeduplication = true, defaultOptions, defaultContext, @@ -213,6 +236,7 @@ export class ApolloClient implements DataProxy { fragmentMatcher, name: clientAwarenessName, version: clientAwarenessVersion, + devtools, } = options; let { link } = options; @@ -228,6 +252,17 @@ export class ApolloClient implements DataProxy { this.queryDeduplication = queryDeduplication; this.defaultOptions = defaultOptions || Object.create(null); this.typeDefs = typeDefs; + this.devtoolsConfig = { + ...devtools, + enabled: devtools?.enabled || connectToDevTools, + }; + + if (this.devtoolsConfig.enabled === undefined) { + this.devtoolsConfig.enabled = + typeof window === "object" && + (window as any).__APOLLO_CLIENT__ && + __DEV__; + } if (ssrForceFetchDelay) { setTimeout( @@ -283,7 +318,7 @@ export class ApolloClient implements DataProxy { : void 0, }); - if (connectToDevTools) this.connectToDevTools(); + if (this.devtoolsConfig.enabled) this.connectToDevTools(); } private connectToDevTools() { From 579330147d6bd6f7167a35413a33746103e375cb Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Tue, 9 Jul 2024 17:43:13 +0200 Subject: [PATCH 16/17] Change usages of the `GraphQLError` type to `GraphQLFormattedError`. (#11789) * post-process errors received from responses into GraphQLError instances * adjust types, add test * fixing more types * Clean up Prettier, Size-limit, and Api-Extractor * remove runtime components * add eslint rule * Clean up Prettier, Size-limit, and Api-Extractor * adjust some more * adjustments * change patch level --------- Co-authored-by: phryneas --- .api-reports/api-report-core.api.md | 35 +++++++++--------- .api-reports/api-report-errors.api.md | 24 +++++++----- .../api-report-link_batch-http.api.md | 13 ++++--- .api-reports/api-report-link_batch.api.md | 13 ++++--- .api-reports/api-report-link_context.api.md | 13 ++++--- .api-reports/api-report-link_core.api.md | 13 ++++--- .api-reports/api-report-link_error.api.md | 23 ++++++------ .api-reports/api-report-link_http.api.md | 13 ++++--- .../api-report-link_persisted-queries.api.md | 18 +++++---- .../api-report-link_remove-typename.api.md | 13 ++++--- .api-reports/api-report-link_retry.api.md | 13 ++++--- .api-reports/api-report-link_schema.api.md | 13 ++++--- .../api-report-link_subscriptions.api.md | 13 ++++--- .api-reports/api-report-link_ws.api.md | 13 ++++--- .api-reports/api-report-react.api.md | 35 +++++++++--------- .../api-report-react_components.api.md | 35 +++++++++--------- .api-reports/api-report-react_context.api.md | 35 +++++++++--------- .api-reports/api-report-react_hoc.api.md | 35 +++++++++--------- .api-reports/api-report-react_hooks.api.md | 35 +++++++++--------- .api-reports/api-report-react_internal.api.md | 35 +++++++++--------- .api-reports/api-report-react_ssr.api.md | 35 +++++++++--------- .api-reports/api-report-testing.api.md | 35 +++++++++--------- .api-reports/api-report-testing_core.api.md | 35 +++++++++--------- .api-reports/api-report-utilities.api.md | 37 +++++++++---------- .api-reports/api-report.api.md | 35 +++++++++--------- .changeset/slimy-berries-yawn.md | 14 +++++++ .eslintrc | 16 ++++++++ src/__tests__/client.ts | 6 +-- src/core/ApolloClient.ts | 6 ++- src/core/QueryInfo.ts | 4 +- src/core/types.ts | 4 +- src/errors/__tests__/ApolloError.ts | 17 ++++----- src/errors/index.ts | 30 +++++++++++---- src/link/core/types.ts | 10 +++-- src/link/error/index.ts | 8 ++-- src/link/persisted-queries/index.ts | 28 +++++++++----- src/link/subscriptions/index.ts | 6 ++- .../__tests__/client/Mutation.test.tsx | 8 +++- src/testing/experimental/createSchemaFetch.ts | 13 ++++++- 39 files changed, 442 insertions(+), 345 deletions(-) create mode 100644 .changeset/slimy-berries-yawn.md diff --git a/.api-reports/api-report-core.api.md b/.api-reports/api-report-core.api.md index 92b34976cf7..815cb7391ad 100644 --- a/.api-reports/api-report-core.api.md +++ b/.api-reports/api-report-core.api.md @@ -9,12 +9,12 @@ import { disableExperimentalFragmentVariables } from 'graphql-tag'; import { disableFragmentWarnings } from 'graphql-tag'; import type { DocumentNode } from 'graphql'; import { enableExperimentalFragmentVariables } from 'graphql-tag'; -import type { ExecutionResult } from 'graphql'; import type { FieldNode } from 'graphql'; +import type { FormattedExecutionResult } from 'graphql'; import type { FragmentDefinitionNode } from 'graphql'; import { gql } from 'graphql-tag'; -import type { GraphQLError } from 'graphql'; import type { GraphQLErrorExtensions } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import type { InlineFragmentNode } from 'graphql'; import { InvariantError } from 'ts-invariant'; import { Observable } from 'zen-observable-ts'; @@ -94,7 +94,7 @@ export class ApolloClient implements DataProxy { __actionHookForDevTools(cb: () => any): void; constructor(options: ApolloClientOptions); // (undocumented) - __requestRaw(payload: GraphQLRequest): Observable; + __requestRaw(payload: GraphQLRequest): Observable; addResolvers(resolvers: Resolvers | Resolvers[]): void; // (undocumented) cache: ApolloCache; @@ -179,17 +179,15 @@ export class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); cause: ({ - message: string; - extensions?: GraphQLErrorExtensions[]; - } & Partial) | null; + readonly message: string; + extensions?: GraphQLErrorExtensions[] | GraphQLFormattedError["extensions"]; + } & Omit & Partial, "extensions">) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) extraInfo: any; - // Warning: (ae-forgotten-export) The symbol "GraphQLErrors" needs to be exported by the entry point index.d.ts - // // (undocumented) - graphQLErrors: GraphQLErrors; + graphQLErrors: ReadonlyArray; // (undocumented) message: string; // (undocumented) @@ -212,7 +210,7 @@ interface ApolloErrorOptions { // (undocumented) extraInfo?: any; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) networkError?: Error | ServerParseError | ServerError | null; // (undocumented) @@ -266,7 +264,7 @@ export interface ApolloQueryResult { // (undocumented) data: T; error?: ApolloError; - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) loading: boolean; // (undocumented) @@ -776,7 +774,7 @@ export interface ExecutionPatchInitialResult, TExten // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -993,9 +991,6 @@ const getInMemoryCacheMemoryInternals: (() => { export { gql } -// @public (undocumented) -type GraphQLErrors = ReadonlyArray; - // @public (undocumented) export interface GraphQLRequest> { // (undocumented) @@ -1080,7 +1075,7 @@ export interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -1712,7 +1707,7 @@ class QueryInfo { // (undocumented) getDiff(): Cache_2.DiffResult; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) init(query: { document: DocumentNode; @@ -2089,11 +2084,15 @@ interface SharedWatchQueryOptions } // @public (undocumented) -export interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +export interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // @public (undocumented) diff --git a/.api-reports/api-report-errors.api.md b/.api-reports/api-report-errors.api.md index 2b3d65a0558..96c8bafc999 100644 --- a/.api-reports/api-report-errors.api.md +++ b/.api-reports/api-report-errors.api.md @@ -4,23 +4,23 @@ ```ts -import type { ExecutionResult } from 'graphql'; import type { GraphQLError } from 'graphql'; import type { GraphQLErrorExtensions } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; // @public (undocumented) export class ApolloError extends Error { constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); cause: ({ - message: string; - extensions?: GraphQLErrorExtensions[]; - } & Partial) | null; + readonly message: string; + extensions?: GraphQLErrorExtensions[] | GraphQLFormattedError["extensions"]; + } & Omit & Partial, "extensions">) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) extraInfo: any; // (undocumented) - graphQLErrors: GraphQLErrors; + graphQLErrors: ReadonlyArray; // (undocumented) message: string; // (undocumented) @@ -46,7 +46,7 @@ export interface ApolloErrorOptions { // (undocumented) extraInfo?: any; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) networkError?: Error | ServerParseError | ServerError | null; // (undocumented) @@ -81,7 +81,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -113,7 +113,7 @@ type FetchResultWithSymbolExtensions = FetchResult & { extensions: Record; }; -// @public (undocumented) +// @public @deprecated (undocumented) export type GraphQLErrors = ReadonlyArray; // Warning: (ae-forgotten-export) The symbol "FetchResultWithSymbolExtensions" needs to be exported by the entry point index.d.ts @@ -126,7 +126,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -166,11 +166,15 @@ type ServerParseError = Error & { // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // (No @packageDocumentation comment for this package) diff --git a/.api-reports/api-report-link_batch-http.api.md b/.api-reports/api-report-link_batch-http.api.md index 89008cc6985..f212ce55c05 100644 --- a/.api-reports/api-report-link_batch-http.api.md +++ b/.api-reports/api-report-link_batch-http.api.md @@ -6,8 +6,7 @@ import type { ASTNode } from 'graphql'; import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; -import type { GraphQLError } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; @@ -117,7 +116,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -179,7 +178,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -232,11 +231,15 @@ interface Printer { type RequestHandler = (operation: Operation, forward: NextLink) => Observable | null; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // @public (undocumented) diff --git a/.api-reports/api-report-link_batch.api.md b/.api-reports/api-report-link_batch.api.md index 6f6464edbbd..f7e4426ef61 100644 --- a/.api-reports/api-report-link_batch.api.md +++ b/.api-reports/api-report-link_batch.api.md @@ -5,8 +5,7 @@ ```ts import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; -import type { GraphQLError } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; @@ -107,7 +106,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -153,7 +152,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -208,11 +207,15 @@ type Path = ReadonlyArray; type RequestHandler = (operation: Operation, forward: NextLink) => Observable | null; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // (No @packageDocumentation comment for this package) diff --git a/.api-reports/api-report-link_context.api.md b/.api-reports/api-report-link_context.api.md index 76a7c4e5344..cbf51621b32 100644 --- a/.api-reports/api-report-link_context.api.md +++ b/.api-reports/api-report-link_context.api.md @@ -5,8 +5,7 @@ ```ts import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; -import type { GraphQLError } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; @@ -80,7 +79,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -124,7 +123,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -169,11 +168,15 @@ type RequestHandler = (operation: Operation, forward: NextLink) => Observable, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // (No @packageDocumentation comment for this package) diff --git a/.api-reports/api-report-link_core.api.md b/.api-reports/api-report-link_core.api.md index ce472253f3c..32f6e56f608 100644 --- a/.api-reports/api-report-link_core.api.md +++ b/.api-reports/api-report-link_core.api.md @@ -5,8 +5,7 @@ ```ts import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; -import type { GraphQLError } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; @@ -83,7 +82,7 @@ export interface ExecutionPatchInitialResult, TExten // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -126,7 +125,7 @@ export interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -164,11 +163,15 @@ export type Path = ReadonlyArray; export type RequestHandler = (operation: Operation, forward: NextLink) => Observable | null; // @public (undocumented) -export interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +export interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // @public (undocumented) diff --git a/.api-reports/api-report-link_error.api.md b/.api-reports/api-report-link_error.api.md index 245cc7946c9..92cbae62eb5 100644 --- a/.api-reports/api-report-link_error.api.md +++ b/.api-reports/api-report-link_error.api.md @@ -5,8 +5,8 @@ ```ts import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; -import type { GraphQLError } from 'graphql'; +import type { FormattedExecutionResult } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; @@ -80,10 +80,8 @@ export class ErrorLink extends ApolloLink { export interface ErrorResponse { // (undocumented) forward: NextLink; - // Warning: (ae-forgotten-export) The symbol "GraphQLErrors" needs to be exported by the entry point index.d.ts - // // (undocumented) - graphQLErrors?: GraphQLErrors; + graphQLErrors?: ReadonlyArray; // Warning: (ae-forgotten-export) The symbol "NetworkError" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -91,7 +89,7 @@ export interface ErrorResponse { // (undocumented) operation: Operation; // (undocumented) - response?: ExecutionResult; + response?: FormattedExecutionResult; } // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResultBase" needs to be exported by the entry point index.d.ts @@ -115,7 +113,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -140,9 +138,6 @@ interface ExecutionPatchResultBase { // @public (undocumented) type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; -// @public (undocumented) -type GraphQLErrors = ReadonlyArray; - // @public (undocumented) interface GraphQLRequest> { // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts @@ -164,7 +159,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -227,11 +222,15 @@ type ServerParseError = Error & { }; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // (No @packageDocumentation comment for this package) diff --git a/.api-reports/api-report-link_http.api.md b/.api-reports/api-report-link_http.api.md index 6e74d1fd378..dd7cf6778c2 100644 --- a/.api-reports/api-report-link_http.api.md +++ b/.api-reports/api-report-link_http.api.md @@ -6,8 +6,7 @@ import type { ASTNode } from 'graphql'; import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; -import type { GraphQLError } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { InvariantError } from 'ts-invariant'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; @@ -116,7 +115,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -217,7 +216,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -311,11 +310,15 @@ export type ServerParseError = Error & { }; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // @public (undocumented) diff --git a/.api-reports/api-report-link_persisted-queries.api.md b/.api-reports/api-report-link_persisted-queries.api.md index 7a977f4ce55..0e4fa0e4639 100644 --- a/.api-reports/api-report-link_persisted-queries.api.md +++ b/.api-reports/api-report-link_persisted-queries.api.md @@ -5,8 +5,8 @@ ```ts import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; -import type { GraphQLError } from 'graphql'; +import type { FormattedExecutionResult } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; @@ -88,7 +88,7 @@ type ErrorMeta = { // @public (undocumented) export interface ErrorResponse { // (undocumented) - graphQLErrors?: readonly GraphQLError[]; + graphQLErrors?: ReadonlyArray; // Warning: (ae-forgotten-export) The symbol "ErrorMeta" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -100,7 +100,7 @@ export interface ErrorResponse { // (undocumented) operation: Operation; // (undocumented) - response?: ExecutionResult; + response?: FormattedExecutionResult; } // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResultBase" needs to be exported by the entry point index.d.ts @@ -124,7 +124,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -173,7 +173,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -263,11 +263,15 @@ type ServerParseError = Error & { type SHA256Function = (...args: any[]) => string | PromiseLike; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // @public (undocumented) diff --git a/.api-reports/api-report-link_remove-typename.api.md b/.api-reports/api-report-link_remove-typename.api.md index 05dcca3dac0..7d088615a2b 100644 --- a/.api-reports/api-report-link_remove-typename.api.md +++ b/.api-reports/api-report-link_remove-typename.api.md @@ -5,8 +5,7 @@ ```ts import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; -import type { GraphQLError } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; @@ -75,7 +74,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -121,7 +120,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -191,11 +190,15 @@ export interface RemoveTypenameFromVariablesOptions { type RequestHandler = (operation: Operation, forward: NextLink) => Observable | null; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // (No @packageDocumentation comment for this package) diff --git a/.api-reports/api-report-link_retry.api.md b/.api-reports/api-report-link_retry.api.md index 173a281dd67..843ff5f1654 100644 --- a/.api-reports/api-report-link_retry.api.md +++ b/.api-reports/api-report-link_retry.api.md @@ -5,8 +5,7 @@ ```ts import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; -import type { GraphQLError } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; @@ -88,7 +87,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -134,7 +133,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -208,11 +207,15 @@ export class RetryLink extends ApolloLink { } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // (No @packageDocumentation comment for this package) diff --git a/.api-reports/api-report-link_schema.api.md b/.api-reports/api-report-link_schema.api.md index 14459f745e9..817398b7594 100644 --- a/.api-reports/api-report-link_schema.api.md +++ b/.api-reports/api-report-link_schema.api.md @@ -5,8 +5,7 @@ ```ts import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; -import type { GraphQLError } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import type { GraphQLSchema } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; @@ -76,7 +75,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -122,7 +121,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -194,11 +193,15 @@ export class SchemaLink extends ApolloLink { } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // (No @packageDocumentation comment for this package) diff --git a/.api-reports/api-report-link_subscriptions.api.md b/.api-reports/api-report-link_subscriptions.api.md index a67c5415721..b7fcb443f86 100644 --- a/.api-reports/api-report-link_subscriptions.api.md +++ b/.api-reports/api-report-link_subscriptions.api.md @@ -6,8 +6,7 @@ import type { Client } from 'graphql-ws'; import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; -import type { GraphQLError } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; @@ -76,7 +75,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -133,7 +132,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -173,11 +172,15 @@ type Path = ReadonlyArray; type RequestHandler = (operation: Operation, forward: NextLink) => Observable | null; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // (No @packageDocumentation comment for this package) diff --git a/.api-reports/api-report-link_ws.api.md b/.api-reports/api-report-link_ws.api.md index 7969b0cdbc1..ec666d00c71 100644 --- a/.api-reports/api-report-link_ws.api.md +++ b/.api-reports/api-report-link_ws.api.md @@ -6,8 +6,7 @@ import type { ClientOptions } from 'subscriptions-transport-ws'; import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; -import type { GraphQLError } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; import { SubscriptionClient } from 'subscriptions-transport-ws'; @@ -77,7 +76,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -123,7 +122,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -163,11 +162,15 @@ type Path = ReadonlyArray; type RequestHandler = (operation: Operation, forward: NextLink) => Observable | null; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // @public (undocumented) diff --git a/.api-reports/api-report-react.api.md b/.api-reports/api-report-react.api.md index 916035b05c5..32dd9f8010c 100644 --- a/.api-reports/api-report-react.api.md +++ b/.api-reports/api-report-react.api.md @@ -6,11 +6,11 @@ import type { ASTNode } from 'graphql'; import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; import type { FieldNode } from 'graphql'; +import type { FormattedExecutionResult } from 'graphql'; import type { FragmentDefinitionNode } from 'graphql'; -import type { GraphQLError } from 'graphql'; import type { GraphQLErrorExtensions } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; import type * as ReactTypes from 'react'; @@ -102,7 +102,7 @@ class ApolloClient implements DataProxy { // Warning: (ae-forgotten-export) The symbol "GraphQLRequest" needs to be exported by the entry point index.d.ts // // (undocumented) - __requestRaw(payload: GraphQLRequest): Observable; + __requestRaw(payload: GraphQLRequest): Observable; // Warning: (ae-forgotten-export) The symbol "Resolvers" needs to be exported by the entry point index.d.ts addResolvers(resolvers: Resolvers | Resolvers[]): void; // Warning: (ae-forgotten-export) The symbol "ApolloCache" needs to be exported by the entry point index.d.ts @@ -230,17 +230,15 @@ class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); cause: ({ - message: string; - extensions?: GraphQLErrorExtensions[]; - } & Partial) | null; + readonly message: string; + extensions?: GraphQLErrorExtensions[] | GraphQLFormattedError["extensions"]; + } & Omit & Partial, "extensions">) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) extraInfo: any; - // Warning: (ae-forgotten-export) The symbol "GraphQLErrors" needs to be exported by the entry point index.d.ts - // // (undocumented) - graphQLErrors: GraphQLErrors; + graphQLErrors: ReadonlyArray; // (undocumented) message: string; // (undocumented) @@ -266,7 +264,7 @@ interface ApolloErrorOptions { // (undocumented) extraInfo?: any; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) networkError?: Error | ServerParseError | ServerError | null; // (undocumented) @@ -332,7 +330,7 @@ interface ApolloQueryResult { data: T; // Warning: (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts error?: ApolloError; - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) loading: boolean; // Warning: (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts @@ -760,7 +758,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -874,9 +872,6 @@ const getApolloClientMemoryInternals: (() => { // @public (undocumented) export function getApolloContext(): ReactTypes.Context; -// @public (undocumented) -type GraphQLErrors = ReadonlyArray; - // @public (undocumented) interface GraphQLRequest> { // (undocumented) @@ -915,7 +910,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -1480,7 +1475,7 @@ class QueryInfo { // (undocumented) getDiff(): Cache_2.DiffResult; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) init(query: { document: DocumentNode; @@ -1878,11 +1873,15 @@ interface SharedWatchQueryOptions } // @public (undocumented) -interface SingleExecutionResult, TContext = Context, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = Context, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // @public (undocumented) diff --git a/.api-reports/api-report-react_components.api.md b/.api-reports/api-report-react_components.api.md index 90af57d6d2e..a1e25d69774 100644 --- a/.api-reports/api-report-react_components.api.md +++ b/.api-reports/api-report-react_components.api.md @@ -6,11 +6,11 @@ import type { ASTNode } from 'graphql'; import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; import type { FieldNode } from 'graphql'; +import type { FormattedExecutionResult } from 'graphql'; import type { FragmentDefinitionNode } from 'graphql'; -import type { GraphQLError } from 'graphql'; import type { GraphQLErrorExtensions } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; import * as PropTypes from 'prop-types'; @@ -102,7 +102,7 @@ class ApolloClient implements DataProxy { // Warning: (ae-forgotten-export) The symbol "GraphQLRequest" needs to be exported by the entry point index.d.ts // // (undocumented) - __requestRaw(payload: GraphQLRequest): Observable; + __requestRaw(payload: GraphQLRequest): Observable; // Warning: (ae-forgotten-export) The symbol "Resolvers" needs to be exported by the entry point index.d.ts addResolvers(resolvers: Resolvers | Resolvers[]): void; // Warning: (ae-forgotten-export) The symbol "ApolloCache" needs to be exported by the entry point index.d.ts @@ -208,17 +208,15 @@ class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); cause: ({ - message: string; - extensions?: GraphQLErrorExtensions[]; - } & Partial) | null; + readonly message: string; + extensions?: GraphQLErrorExtensions[] | GraphQLFormattedError["extensions"]; + } & Omit & Partial, "extensions">) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) extraInfo: any; - // Warning: (ae-forgotten-export) The symbol "GraphQLErrors" needs to be exported by the entry point index.d.ts - // // (undocumented) - graphQLErrors: GraphQLErrors; + graphQLErrors: ReadonlyArray; // (undocumented) message: string; // (undocumented) @@ -244,7 +242,7 @@ interface ApolloErrorOptions { // (undocumented) extraInfo?: any; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) networkError?: Error | ServerParseError | ServerError | null; // (undocumented) @@ -297,7 +295,7 @@ interface ApolloQueryResult { data: T; // Warning: (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts error?: ApolloError; - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) loading: boolean; // Warning: (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts @@ -692,7 +690,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -793,9 +791,6 @@ const getApolloClientMemoryInternals: (() => { }; }) | undefined; -// @public (undocumented) -type GraphQLErrors = ReadonlyArray; - // @public (undocumented) interface GraphQLRequest> { // (undocumented) @@ -824,7 +819,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -1300,7 +1295,7 @@ class QueryInfo { // (undocumented) getDiff(): Cache_2.DiffResult; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) init(query: { document: DocumentNode; @@ -1631,11 +1626,15 @@ interface SharedWatchQueryOptions } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // @public (undocumented) diff --git a/.api-reports/api-report-react_context.api.md b/.api-reports/api-report-react_context.api.md index f2ec9bb082b..4c0c8a8991d 100644 --- a/.api-reports/api-report-react_context.api.md +++ b/.api-reports/api-report-react_context.api.md @@ -6,11 +6,11 @@ import type { ASTNode } from 'graphql'; import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; import type { FieldNode } from 'graphql'; +import type { FormattedExecutionResult } from 'graphql'; import type { FragmentDefinitionNode } from 'graphql'; -import type { GraphQLError } from 'graphql'; import type { GraphQLErrorExtensions } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; import type * as ReactTypes from 'react'; @@ -101,7 +101,7 @@ class ApolloClient implements DataProxy { // Warning: (ae-forgotten-export) The symbol "GraphQLRequest" needs to be exported by the entry point index.d.ts // // (undocumented) - __requestRaw(payload: GraphQLRequest): Observable; + __requestRaw(payload: GraphQLRequest): Observable; // Warning: (ae-forgotten-export) The symbol "Resolvers" needs to be exported by the entry point index.d.ts addResolvers(resolvers: Resolvers | Resolvers[]): void; // Warning: (ae-forgotten-export) The symbol "ApolloCache" needs to be exported by the entry point index.d.ts @@ -228,17 +228,15 @@ class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); cause: ({ - message: string; - extensions?: GraphQLErrorExtensions[]; - } & Partial) | null; + readonly message: string; + extensions?: GraphQLErrorExtensions[] | GraphQLFormattedError["extensions"]; + } & Omit & Partial, "extensions">) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) extraInfo: any; - // Warning: (ae-forgotten-export) The symbol "GraphQLErrors" needs to be exported by the entry point index.d.ts - // // (undocumented) - graphQLErrors: GraphQLErrors; + graphQLErrors: ReadonlyArray; // (undocumented) message: string; // (undocumented) @@ -264,7 +262,7 @@ interface ApolloErrorOptions { // (undocumented) extraInfo?: any; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) networkError?: Error | ServerParseError | ServerError | null; // (undocumented) @@ -328,7 +326,7 @@ interface ApolloQueryResult { data: T; // Warning: (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts error?: ApolloError; - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) loading: boolean; // Warning: (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts @@ -687,7 +685,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -791,9 +789,6 @@ const getApolloClientMemoryInternals: (() => { // @public (undocumented) export function getApolloContext(): ReactTypes.Context; -// @public (undocumented) -type GraphQLErrors = ReadonlyArray; - // @public (undocumented) interface GraphQLRequest> { // (undocumented) @@ -822,7 +817,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -1229,7 +1224,7 @@ class QueryInfo { // (undocumented) getDiff(): Cache_2.DiffResult; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) init(query: { document: DocumentNode; @@ -1585,11 +1580,15 @@ interface SharedWatchQueryOptions } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // @public (undocumented) diff --git a/.api-reports/api-report-react_hoc.api.md b/.api-reports/api-report-react_hoc.api.md index f82219194f5..ad7a5bf8b46 100644 --- a/.api-reports/api-report-react_hoc.api.md +++ b/.api-reports/api-report-react_hoc.api.md @@ -6,11 +6,11 @@ import type { ASTNode } from 'graphql'; import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; import type { FieldNode } from 'graphql'; +import type { FormattedExecutionResult } from 'graphql'; import type { FragmentDefinitionNode } from 'graphql'; -import type { GraphQLError } from 'graphql'; import type { GraphQLErrorExtensions } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; import type * as ReactTypes from 'react'; @@ -101,7 +101,7 @@ class ApolloClient implements DataProxy { // Warning: (ae-forgotten-export) The symbol "GraphQLRequest" needs to be exported by the entry point index.d.ts // // (undocumented) - __requestRaw(payload: GraphQLRequest): Observable; + __requestRaw(payload: GraphQLRequest): Observable; // Warning: (ae-forgotten-export) The symbol "Resolvers" needs to be exported by the entry point index.d.ts addResolvers(resolvers: Resolvers | Resolvers[]): void; // Warning: (ae-forgotten-export) The symbol "ApolloCache" needs to be exported by the entry point index.d.ts @@ -207,17 +207,15 @@ class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); cause: ({ - message: string; - extensions?: GraphQLErrorExtensions[]; - } & Partial) | null; + readonly message: string; + extensions?: GraphQLErrorExtensions[] | GraphQLFormattedError["extensions"]; + } & Omit & Partial, "extensions">) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) extraInfo: any; - // Warning: (ae-forgotten-export) The symbol "GraphQLErrors" needs to be exported by the entry point index.d.ts - // // (undocumented) - graphQLErrors: GraphQLErrors; + graphQLErrors: ReadonlyArray; // (undocumented) message: string; // (undocumented) @@ -243,7 +241,7 @@ interface ApolloErrorOptions { // (undocumented) extraInfo?: any; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) networkError?: Error | ServerParseError | ServerError | null; // (undocumented) @@ -296,7 +294,7 @@ interface ApolloQueryResult { data: T; // Warning: (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts error?: ApolloError; - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) loading: boolean; // Warning: (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts @@ -685,7 +683,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -798,9 +796,6 @@ const getApolloClientMemoryInternals: (() => { // @public @deprecated (undocumented) export function graphql> & Partial>>(document: DocumentNode, operationOptions?: OperationOption): (WrappedComponent: ReactTypes.ComponentType) => ReactTypes.ComponentClass; -// @public (undocumented) -type GraphQLErrors = ReadonlyArray; - // @public (undocumented) interface GraphQLRequest> { // (undocumented) @@ -829,7 +824,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -1274,7 +1269,7 @@ class QueryInfo { // (undocumented) getDiff(): Cache_2.DiffResult; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) init(query: { document: DocumentNode; @@ -1591,11 +1586,15 @@ interface SharedWatchQueryOptions } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // @public (undocumented) diff --git a/.api-reports/api-report-react_hooks.api.md b/.api-reports/api-report-react_hooks.api.md index 094ea9d31a8..2137e1da774 100644 --- a/.api-reports/api-report-react_hooks.api.md +++ b/.api-reports/api-report-react_hooks.api.md @@ -6,11 +6,11 @@ import type { ASTNode } from 'graphql'; import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; import type { FieldNode } from 'graphql'; +import type { FormattedExecutionResult } from 'graphql'; import type { FragmentDefinitionNode } from 'graphql'; -import type { GraphQLError } from 'graphql'; import type { GraphQLErrorExtensions } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; import type { Subscriber } from 'zen-observable-ts'; @@ -100,7 +100,7 @@ class ApolloClient implements DataProxy { // Warning: (ae-forgotten-export) The symbol "GraphQLRequest" needs to be exported by the entry point index.d.ts // // (undocumented) - __requestRaw(payload: GraphQLRequest): Observable; + __requestRaw(payload: GraphQLRequest): Observable; // Warning: (ae-forgotten-export) The symbol "Resolvers" needs to be exported by the entry point index.d.ts addResolvers(resolvers: Resolvers | Resolvers[]): void; // Warning: (ae-forgotten-export) The symbol "ApolloCache" needs to be exported by the entry point index.d.ts @@ -206,17 +206,15 @@ class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); cause: ({ - message: string; - extensions?: GraphQLErrorExtensions[]; - } & Partial) | null; + readonly message: string; + extensions?: GraphQLErrorExtensions[] | GraphQLFormattedError["extensions"]; + } & Omit & Partial, "extensions">) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) extraInfo: any; - // Warning: (ae-forgotten-export) The symbol "GraphQLErrors" needs to be exported by the entry point index.d.ts - // // (undocumented) - graphQLErrors: GraphQLErrors; + graphQLErrors: ReadonlyArray; // (undocumented) message: string; // (undocumented) @@ -242,7 +240,7 @@ interface ApolloErrorOptions { // (undocumented) extraInfo?: any; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) networkError?: Error | ServerParseError | ServerError | null; // (undocumented) @@ -295,7 +293,7 @@ interface ApolloQueryResult { data: T; // Warning: (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts error?: ApolloError; - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) loading: boolean; // Warning: (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts @@ -715,7 +713,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -826,9 +824,6 @@ const getApolloClientMemoryInternals: (() => { }; }) | undefined; -// @public (undocumented) -type GraphQLErrors = ReadonlyArray; - // @public (undocumented) interface GraphQLRequest> { // (undocumented) @@ -857,7 +852,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -1355,7 +1350,7 @@ class QueryInfo { // (undocumented) getDiff(): Cache_2.DiffResult; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) init(query: { document: DocumentNode; @@ -1714,11 +1709,15 @@ interface SharedWatchQueryOptions } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // @public (undocumented) diff --git a/.api-reports/api-report-react_internal.api.md b/.api-reports/api-report-react_internal.api.md index 81bffbb7458..993f35c5615 100644 --- a/.api-reports/api-report-react_internal.api.md +++ b/.api-reports/api-report-react_internal.api.md @@ -6,11 +6,11 @@ import type { ASTNode } from 'graphql'; import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; import type { FieldNode } from 'graphql'; +import type { FormattedExecutionResult } from 'graphql'; import type { FragmentDefinitionNode } from 'graphql'; -import type { GraphQLError } from 'graphql'; import type { GraphQLErrorExtensions } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; import type { Subscriber } from 'zen-observable-ts'; @@ -100,7 +100,7 @@ class ApolloClient implements DataProxy { // Warning: (ae-forgotten-export) The symbol "GraphQLRequest" needs to be exported by the entry point index.d.ts // // (undocumented) - __requestRaw(payload: GraphQLRequest): Observable; + __requestRaw(payload: GraphQLRequest): Observable; // Warning: (ae-forgotten-export) The symbol "Resolvers" needs to be exported by the entry point index.d.ts addResolvers(resolvers: Resolvers | Resolvers[]): void; // Warning: (ae-forgotten-export) The symbol "ApolloCache" needs to be exported by the entry point index.d.ts @@ -206,17 +206,15 @@ class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); cause: ({ - message: string; - extensions?: GraphQLErrorExtensions[]; - } & Partial) | null; + readonly message: string; + extensions?: GraphQLErrorExtensions[] | GraphQLFormattedError["extensions"]; + } & Omit & Partial, "extensions">) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) extraInfo: any; - // Warning: (ae-forgotten-export) The symbol "GraphQLErrors" needs to be exported by the entry point index.d.ts - // // (undocumented) - graphQLErrors: GraphQLErrors; + graphQLErrors: ReadonlyArray; // (undocumented) message: string; // (undocumented) @@ -242,7 +240,7 @@ interface ApolloErrorOptions { // (undocumented) extraInfo?: any; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) networkError?: Error | ServerParseError | ServerError | null; // (undocumented) @@ -295,7 +293,7 @@ interface ApolloQueryResult { data: T; // Warning: (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts error?: ApolloError; - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) loading: boolean; // Warning: (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts @@ -700,7 +698,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -834,9 +832,6 @@ export function getSuspenseCache(client: ApolloClient & { // @public (undocumented) export function getWrappedPromise(queryRef: WrappedQueryRef): QueryRefPromise; -// @public (undocumented) -type GraphQLErrors = ReadonlyArray; - // @public (undocumented) interface GraphQLRequest> { // (undocumented) @@ -872,7 +867,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -1401,7 +1396,7 @@ class QueryInfo { // (undocumented) getDiff(): Cache_2.DiffResult; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) init(query: { document: DocumentNode; @@ -1765,11 +1760,15 @@ interface SharedWatchQueryOptions } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // @public (undocumented) diff --git a/.api-reports/api-report-react_ssr.api.md b/.api-reports/api-report-react_ssr.api.md index ca7a9f6f209..6db286b108c 100644 --- a/.api-reports/api-report-react_ssr.api.md +++ b/.api-reports/api-report-react_ssr.api.md @@ -6,11 +6,11 @@ import type { ASTNode } from 'graphql'; import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; import type { FieldNode } from 'graphql'; +import type { FormattedExecutionResult } from 'graphql'; import type { FragmentDefinitionNode } from 'graphql'; -import type { GraphQLError } from 'graphql'; import type { GraphQLErrorExtensions } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; import type * as ReactTypes from 'react'; @@ -101,7 +101,7 @@ class ApolloClient implements DataProxy { // Warning: (ae-forgotten-export) The symbol "GraphQLRequest" needs to be exported by the entry point index.d.ts // // (undocumented) - __requestRaw(payload: GraphQLRequest): Observable; + __requestRaw(payload: GraphQLRequest): Observable; // Warning: (ae-forgotten-export) The symbol "Resolvers" needs to be exported by the entry point index.d.ts addResolvers(resolvers: Resolvers | Resolvers[]): void; // Warning: (ae-forgotten-export) The symbol "ApolloCache" needs to be exported by the entry point index.d.ts @@ -207,17 +207,15 @@ class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); cause: ({ - message: string; - extensions?: GraphQLErrorExtensions[]; - } & Partial) | null; + readonly message: string; + extensions?: GraphQLErrorExtensions[] | GraphQLFormattedError["extensions"]; + } & Omit & Partial, "extensions">) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) extraInfo: any; - // Warning: (ae-forgotten-export) The symbol "GraphQLErrors" needs to be exported by the entry point index.d.ts - // // (undocumented) - graphQLErrors: GraphQLErrors; + graphQLErrors: ReadonlyArray; // (undocumented) message: string; // (undocumented) @@ -243,7 +241,7 @@ interface ApolloErrorOptions { // (undocumented) extraInfo?: any; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) networkError?: Error | ServerParseError | ServerError | null; // (undocumented) @@ -296,7 +294,7 @@ interface ApolloQueryResult { data: T; // Warning: (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts error?: ApolloError; - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) loading: boolean; // Warning: (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts @@ -656,7 +654,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -776,9 +774,6 @@ type GetMarkupFromTreeOptions = { renderFunction?: (tree: ReactTypes.ReactElement) => string | PromiseLike; }; -// @public (undocumented) -type GraphQLErrors = ReadonlyArray; - // @public (undocumented) interface GraphQLRequest> { // (undocumented) @@ -807,7 +802,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -1214,7 +1209,7 @@ class QueryInfo { // (undocumented) getDiff(): Cache_2.DiffResult; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) init(query: { document: DocumentNode; @@ -1570,11 +1565,15 @@ interface SharedWatchQueryOptions } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // @public (undocumented) diff --git a/.api-reports/api-report-testing.api.md b/.api-reports/api-report-testing.api.md index ffcefbd2d41..170a8acc433 100644 --- a/.api-reports/api-report-testing.api.md +++ b/.api-reports/api-report-testing.api.md @@ -6,11 +6,11 @@ import type { ASTNode } from 'graphql'; import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; import type { FieldNode } from 'graphql'; +import type { FormattedExecutionResult } from 'graphql'; import type { FragmentDefinitionNode } from 'graphql'; -import type { GraphQLError } from 'graphql'; import type { GraphQLErrorExtensions } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; import * as React_2 from 'react'; @@ -101,7 +101,7 @@ class ApolloClient implements DataProxy { // Warning: (ae-forgotten-export) The symbol "GraphQLRequest" needs to be exported by the entry point index.d.ts // // (undocumented) - __requestRaw(payload: GraphQLRequest): Observable; + __requestRaw(payload: GraphQLRequest): Observable; // Warning: (ae-forgotten-export) The symbol "Resolvers" needs to be exported by the entry point index.d.ts addResolvers(resolvers: Resolvers | Resolvers[]): void; // Warning: (ae-forgotten-export) The symbol "ApolloCache" needs to be exported by the entry point index.d.ts @@ -207,17 +207,15 @@ class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); cause: ({ - message: string; - extensions?: GraphQLErrorExtensions[]; - } & Partial) | null; + readonly message: string; + extensions?: GraphQLErrorExtensions[] | GraphQLFormattedError["extensions"]; + } & Omit & Partial, "extensions">) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) extraInfo: any; - // Warning: (ae-forgotten-export) The symbol "GraphQLErrors" needs to be exported by the entry point index.d.ts - // // (undocumented) - graphQLErrors: GraphQLErrors; + graphQLErrors: ReadonlyArray; // (undocumented) message: string; // (undocumented) @@ -243,7 +241,7 @@ interface ApolloErrorOptions { // (undocumented) extraInfo?: any; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) networkError?: Error | ServerParseError | ServerError | null; // (undocumented) @@ -296,7 +294,7 @@ interface ApolloQueryResult { data: T; // Warning: (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts error?: ApolloError; - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) loading: boolean; // Warning: (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts @@ -657,7 +655,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -758,9 +756,6 @@ const getApolloClientMemoryInternals: (() => { }; }) | undefined; -// @public (undocumented) -type GraphQLErrors = ReadonlyArray; - // @public (undocumented) interface GraphQLRequest> { // (undocumented) @@ -789,7 +784,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -1297,7 +1292,7 @@ class QueryInfo { // (undocumented) getDiff(): Cache_2.DiffResult; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) init(query: { document: DocumentNode; @@ -1617,11 +1612,15 @@ interface SharedWatchQueryOptions } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // @public (undocumented) diff --git a/.api-reports/api-report-testing_core.api.md b/.api-reports/api-report-testing_core.api.md index b0659710384..aacf32eccc3 100644 --- a/.api-reports/api-report-testing_core.api.md +++ b/.api-reports/api-report-testing_core.api.md @@ -6,11 +6,11 @@ import type { ASTNode } from 'graphql'; import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; import type { FieldNode } from 'graphql'; +import type { FormattedExecutionResult } from 'graphql'; import type { FragmentDefinitionNode } from 'graphql'; -import type { GraphQLError } from 'graphql'; import type { GraphQLErrorExtensions } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; import type { Subscriber } from 'zen-observable-ts'; @@ -100,7 +100,7 @@ class ApolloClient implements DataProxy { // Warning: (ae-forgotten-export) The symbol "GraphQLRequest" needs to be exported by the entry point index.d.ts // // (undocumented) - __requestRaw(payload: GraphQLRequest): Observable; + __requestRaw(payload: GraphQLRequest): Observable; // Warning: (ae-forgotten-export) The symbol "Resolvers" needs to be exported by the entry point index.d.ts addResolvers(resolvers: Resolvers | Resolvers[]): void; // Warning: (ae-forgotten-export) The symbol "ApolloCache" needs to be exported by the entry point index.d.ts @@ -206,17 +206,15 @@ class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); cause: ({ - message: string; - extensions?: GraphQLErrorExtensions[]; - } & Partial) | null; + readonly message: string; + extensions?: GraphQLErrorExtensions[] | GraphQLFormattedError["extensions"]; + } & Omit & Partial, "extensions">) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) extraInfo: any; - // Warning: (ae-forgotten-export) The symbol "GraphQLErrors" needs to be exported by the entry point index.d.ts - // // (undocumented) - graphQLErrors: GraphQLErrors; + graphQLErrors: ReadonlyArray; // (undocumented) message: string; // (undocumented) @@ -242,7 +240,7 @@ interface ApolloErrorOptions { // (undocumented) extraInfo?: any; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) networkError?: Error | ServerParseError | ServerError | null; // (undocumented) @@ -295,7 +293,7 @@ interface ApolloQueryResult { data: T; // Warning: (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts error?: ApolloError; - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) loading: boolean; // Warning: (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts @@ -656,7 +654,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -757,9 +755,6 @@ const getApolloClientMemoryInternals: (() => { }; }) | undefined; -// @public (undocumented) -type GraphQLErrors = ReadonlyArray; - // @public (undocumented) interface GraphQLRequest> { // (undocumented) @@ -788,7 +783,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -1252,7 +1247,7 @@ class QueryInfo { // (undocumented) getDiff(): Cache_2.DiffResult; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) init(query: { document: DocumentNode; @@ -1574,11 +1569,15 @@ interface SharedWatchQueryOptions } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // @public (undocumented) diff --git a/.api-reports/api-report-utilities.api.md b/.api-reports/api-report-utilities.api.md index 7b26126fdc0..8dc5e2982b6 100644 --- a/.api-reports/api-report-utilities.api.md +++ b/.api-reports/api-report-utilities.api.md @@ -8,12 +8,12 @@ import type { ArgumentNode } from 'graphql'; import type { ASTNode } from 'graphql'; import type { DirectiveNode } from 'graphql'; import type { DocumentNode } from 'graphql'; -import type { ExecutionResult } from 'graphql'; import type { FieldNode } from 'graphql'; +import type { FormattedExecutionResult } from 'graphql'; import type { FragmentDefinitionNode } from 'graphql'; import type { FragmentSpreadNode } from 'graphql'; -import { GraphQLError } from 'graphql'; import type { GraphQLErrorExtensions } from 'graphql'; +import { GraphQLFormattedError } from 'graphql'; import type { InlineFragmentNode } from 'graphql'; import type { NameNode } from 'graphql'; import { Observable } from 'zen-observable-ts'; @@ -114,7 +114,7 @@ class ApolloClient implements DataProxy { // Warning: (ae-forgotten-export) The symbol "GraphQLRequest" needs to be exported by the entry point index.d.ts // // (undocumented) - __requestRaw(payload: GraphQLRequest): Observable; + __requestRaw(payload: GraphQLRequest): Observable; // Warning: (ae-forgotten-export) The symbol "Resolvers" needs to be exported by the entry point index.d.ts addResolvers(resolvers: Resolvers | Resolvers[]): void; // Warning: (ae-forgotten-export) The symbol "ApolloCache" needs to be exported by the entry point index.d.ts @@ -219,17 +219,15 @@ class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); cause: ({ - message: string; - extensions?: GraphQLErrorExtensions[]; - } & Partial) | null; + readonly message: string; + extensions?: GraphQLErrorExtensions[] | GraphQLFormattedError["extensions"]; + } & Omit & Partial, "extensions">) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) extraInfo: any; - // Warning: (ae-forgotten-export) The symbol "GraphQLErrors" needs to be exported by the entry point index.d.ts - // // (undocumented) - graphQLErrors: GraphQLErrors; + graphQLErrors: ReadonlyArray; // (undocumented) message: string; // (undocumented) @@ -255,7 +253,7 @@ interface ApolloErrorOptions { // (undocumented) extraInfo?: any; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) networkError?: Error | ServerParseError | ServerError | null; // (undocumented) @@ -319,7 +317,7 @@ interface ApolloQueryResult { data: T; // Warning: (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts error?: ApolloError; - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) loading: boolean; // Warning: (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts @@ -963,7 +961,7 @@ interface ExecutionPatchInitialResult, TExtensions = // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -1169,7 +1167,7 @@ export function getFragmentQueryDocument(document: DocumentNode, fragmentName?: export type GetFragmentSpreadConfig = GetNodeConfig; // @public (undocumented) -export function getGraphQLErrorsFromResult(result: FetchResult): GraphQLError[]; +export function getGraphQLErrorsFromResult(result: FetchResult): GraphQLFormattedError[]; // @public (undocumented) export function getInclusionDirectives(directives: ReadonlyArray): InclusionDirectives; @@ -1220,9 +1218,6 @@ export const getStoreKeyName: ((fieldName: string, args?: Record | // @public (undocumented) export function getTypenameFromResult(result: Record, selectionSet: SelectionSetNode, fragmentMap?: FragmentMap): string | undefined; -// @public (undocumented) -type GraphQLErrors = ReadonlyArray; - // @public (undocumented) interface GraphQLRequest> { // (undocumented) @@ -1287,7 +1282,7 @@ interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -2016,7 +2011,7 @@ class QueryInfo { // (undocumented) getDiff(): Cache_2.DiffResult; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) init(query: { document: DocumentNode; @@ -2418,11 +2413,15 @@ interface SharedWatchQueryOptions export function shouldInclude({ directives }: SelectionNode, variables?: Record): boolean; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // @public (undocumented) diff --git a/.api-reports/api-report.api.md b/.api-reports/api-report.api.md index a56145500ed..b8b6d180649 100644 --- a/.api-reports/api-report.api.md +++ b/.api-reports/api-report.api.md @@ -9,12 +9,12 @@ import { disableExperimentalFragmentVariables } from 'graphql-tag'; import { disableFragmentWarnings } from 'graphql-tag'; import type { DocumentNode } from 'graphql'; import { enableExperimentalFragmentVariables } from 'graphql-tag'; -import type { ExecutionResult } from 'graphql'; import type { FieldNode } from 'graphql'; +import type { FormattedExecutionResult } from 'graphql'; import type { FragmentDefinitionNode } from 'graphql'; import { gql } from 'graphql-tag'; -import type { GraphQLError } from 'graphql'; import type { GraphQLErrorExtensions } from 'graphql'; +import type { GraphQLFormattedError } from 'graphql'; import type { InlineFragmentNode } from 'graphql'; import { InvariantError } from 'ts-invariant'; import { Observable } from 'zen-observable-ts'; @@ -96,7 +96,7 @@ export class ApolloClient implements DataProxy { __actionHookForDevTools(cb: () => any): void; constructor(options: ApolloClientOptions); // (undocumented) - __requestRaw(payload: GraphQLRequest): Observable; + __requestRaw(payload: GraphQLRequest): Observable; addResolvers(resolvers: Resolvers | Resolvers[]): void; // (undocumented) cache: ApolloCache; @@ -202,17 +202,15 @@ export class ApolloError extends Error { // Warning: (ae-forgotten-export) The symbol "ApolloErrorOptions" needs to be exported by the entry point index.d.ts constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); cause: ({ - message: string; - extensions?: GraphQLErrorExtensions[]; - } & Partial) | null; + readonly message: string; + extensions?: GraphQLErrorExtensions[] | GraphQLFormattedError["extensions"]; + } & Omit & Partial, "extensions">) | null; // (undocumented) clientErrors: ReadonlyArray; // (undocumented) extraInfo: any; - // Warning: (ae-forgotten-export) The symbol "GraphQLErrors" needs to be exported by the entry point index.d.ts - // // (undocumented) - graphQLErrors: GraphQLErrors; + graphQLErrors: ReadonlyArray; // (undocumented) message: string; // (undocumented) @@ -235,7 +233,7 @@ interface ApolloErrorOptions { // (undocumented) extraInfo?: any; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) networkError?: Error | ServerParseError | ServerError | null; // (undocumented) @@ -302,7 +300,7 @@ export interface ApolloQueryResult { // (undocumented) data: T; error?: ApolloError; - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) loading: boolean; // (undocumented) @@ -888,7 +886,7 @@ export interface ExecutionPatchInitialResult, TExten // (undocumented) data: TData | null | undefined; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -1116,9 +1114,6 @@ const getInMemoryCacheMemoryInternals: (() => { export { gql } -// @public (undocumented) -type GraphQLErrors = ReadonlyArray; - // @public (undocumented) export interface GraphQLRequest> { // (undocumented) @@ -1213,7 +1208,7 @@ export interface IncrementalPayload { // (undocumented) data: TData | null; // (undocumented) - errors?: ReadonlyArray; + errors?: ReadonlyArray; // (undocumented) extensions?: TExtensions; // (undocumented) @@ -2056,7 +2051,7 @@ class QueryInfo { // (undocumented) getDiff(): Cache_2.DiffResult; // (undocumented) - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; // (undocumented) init(query: { document: DocumentNode; @@ -2498,11 +2493,15 @@ interface SharedWatchQueryOptions } // @public (undocumented) -export interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { +export interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) data?: TData | null; + // (undocumented) + errors?: ReadonlyArray; + // (undocumented) + extensions?: TExtensions; } // @public (undocumented) diff --git a/.changeset/slimy-berries-yawn.md b/.changeset/slimy-berries-yawn.md new file mode 100644 index 00000000000..ef7d7ec671c --- /dev/null +++ b/.changeset/slimy-berries-yawn.md @@ -0,0 +1,14 @@ +--- +"@apollo/client": minor +--- + +Changes usages of the `GraphQLError` type to `GraphQLFormattedError`. + +This was a type bug - these errors were never `GraphQLError` instances +to begin with, and the `GraphQLError` class has additional properties that can +never be correctly rehydrated from a GraphQL result. +The correct type to use here is `GraphQLFormattedError`. + +Similarly, please ensure to use the type `FormattedExecutionResult` +instead of `ExecutionResult` - the non-"Formatted" versions of these types +are for use on the server only, but don't get transported over the network. diff --git a/.eslintrc b/.eslintrc index b4d6d6f5363..e8abca31af1 100644 --- a/.eslintrc +++ b/.eslintrc @@ -40,6 +40,22 @@ ], "@typescript-eslint/consistent-type-exports": ["error"], "@typescript-eslint/no-import-type-side-effects": "error", + "@typescript-eslint/ban-types": [ + "error", + { + "types": { + "GraphQLError": { + "message": "Use GraphQLFormattedError instead", + "fixWith": "GraphQLFormattedError" + }, + "ExecutionResult": { + "message": "Use FormattedExecutionResult instead", + "fixWith": "FormattedExecutionResult" + } + }, + "extendDefaults": false + } + ], "no-restricted-syntax": [ "error", { diff --git a/src/__tests__/client.ts b/src/__tests__/client.ts index cf8df19c268..c16b01d593e 100644 --- a/src/__tests__/client.ts +++ b/src/__tests__/client.ts @@ -1,11 +1,11 @@ import { cloneDeep, assign } from "lodash"; import { GraphQLError, - ExecutionResult, DocumentNode, Kind, print, visit, + FormattedExecutionResult, } from "graphql"; import gql from "graphql-tag"; @@ -752,7 +752,7 @@ describe("client", () => { cache: new InMemoryCache({ addTypename: false }), }); - return client.query({ query }).then((result: ExecutionResult) => { + return client.query({ query }).then((result: FormattedExecutionResult) => { expect(result.data).toEqual(data); }); }); @@ -6411,7 +6411,7 @@ function clientRoundtrip( resolve: (result: any) => any, reject: (reason: any) => any, query: DocumentNode, - data: ExecutionResult, + data: FormattedExecutionResult, variables?: any, possibleTypes?: PossibleTypesMap ) { diff --git a/src/core/ApolloClient.ts b/src/core/ApolloClient.ts index 307ea715e85..39fc6f3d503 100644 --- a/src/core/ApolloClient.ts +++ b/src/core/ApolloClient.ts @@ -1,6 +1,6 @@ import { invariant, newInvariantError } from "../utilities/globals/index.js"; -import type { ExecutionResult, DocumentNode } from "graphql"; +import type { DocumentNode, FormattedExecutionResult } from "graphql"; import type { FetchResult, GraphQLRequest } from "../link/core/index.js"; import { ApolloLink, execute } from "../link/core/index.js"; @@ -606,7 +606,9 @@ export class ApolloClient implements DataProxy { this.devToolsHookCb = cb; } - public __requestRaw(payload: GraphQLRequest): Observable { + public __requestRaw( + payload: GraphQLRequest + ): Observable { return execute(this.link, payload); } diff --git a/src/core/QueryInfo.ts b/src/core/QueryInfo.ts index 2e8c149eedd..d4058bae2af 100644 --- a/src/core/QueryInfo.ts +++ b/src/core/QueryInfo.ts @@ -1,4 +1,4 @@ -import type { DocumentNode, GraphQLError } from "graphql"; +import type { DocumentNode, GraphQLFormattedError } from "graphql"; import { equal } from "@wry/equality"; import type { Cache, ApolloCache } from "../cache/index.js"; @@ -82,7 +82,7 @@ export class QueryInfo { variables?: Record; networkStatus?: NetworkStatus; networkError?: Error | null; - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; stopped = false; private cache: ApolloCache; diff --git a/src/core/types.ts b/src/core/types.ts index 8085d013839..fefe245b04c 100644 --- a/src/core/types.ts +++ b/src/core/types.ts @@ -1,4 +1,4 @@ -import type { DocumentNode, GraphQLError } from "graphql"; +import type { DocumentNode, GraphQLFormattedError } from "graphql"; import type { ApolloCache } from "../cache/index.js"; import type { FetchResult } from "../link/core/index.js"; @@ -145,7 +145,7 @@ export interface ApolloQueryResult { * A list of any errors that occurred during server-side execution of a GraphQL operation. * See https://www.apollographql.com/docs/react/data/error-handling/ for more information. */ - errors?: ReadonlyArray; + errors?: ReadonlyArray; /** * The single Error object that is passed to onError and useQuery hooks, and is often thrown during manual `client.query` calls. * This will contain both a NetworkError field and any GraphQLErrors. diff --git a/src/errors/__tests__/ApolloError.ts b/src/errors/__tests__/ApolloError.ts index 1881bade231..e672536f667 100644 --- a/src/errors/__tests__/ApolloError.ts +++ b/src/errors/__tests__/ApolloError.ts @@ -1,11 +1,10 @@ import { ApolloError } from ".."; -import { GraphQLError } from "graphql"; describe("ApolloError", () => { it("should construct itself correctly", () => { const graphQLErrors = [ - new GraphQLError("Something went wrong with GraphQL"), - new GraphQLError("Something else went wrong with GraphQL"), + { message: "Something went wrong with GraphQL" }, + { message: "Something else went wrong with GraphQL" }, ]; const protocolErrors = [ { @@ -41,7 +40,7 @@ describe("ApolloError", () => { }); it("should add a graphql error to the message", () => { - const graphQLErrors = [new GraphQLError("this is an error message")]; + const graphQLErrors = [{ message: "this is an error message" }]; const apolloError = new ApolloError({ graphQLErrors, }); @@ -51,8 +50,8 @@ describe("ApolloError", () => { it("should add multiple graphql errors to the message", () => { const graphQLErrors = [ - new GraphQLError("this is new"), - new GraphQLError("this is old"), + { message: "this is new" }, + { message: "this is old" }, ]; const apolloError = new ApolloError({ graphQLErrors, @@ -64,7 +63,7 @@ describe("ApolloError", () => { }); it("should add both network and graphql errors to the message", () => { - const graphQLErrors = [new GraphQLError("graphql error message")]; + const graphQLErrors = [{ message: "graphql error message" }]; const networkError = new Error("network error message"); const apolloError = new ApolloError({ graphQLErrors, @@ -77,7 +76,7 @@ describe("ApolloError", () => { }); it("should add both protocol and graphql errors to the message", () => { - const graphQLErrors = [new GraphQLError("graphql error message")]; + const graphQLErrors = [{ message: "graphql error message" }]; const protocolErrors = [ { message: "cannot read message from websocket", @@ -99,7 +98,7 @@ describe("ApolloError", () => { }); it("should contain a stack trace", () => { - const graphQLErrors = [new GraphQLError("graphql error message")]; + const graphQLErrors = [{ message: "graphql error message" }]; const networkError = new Error("network error message"); const apolloError = new ApolloError({ graphQLErrors, diff --git a/src/errors/index.ts b/src/errors/index.ts index 3c07411161b..11a14007734 100644 --- a/src/errors/index.ts +++ b/src/errors/index.ts @@ -1,6 +1,10 @@ import "../utilities/globals/index.js"; -import type { GraphQLError, GraphQLErrorExtensions } from "graphql"; +import type { + GraphQLError, + GraphQLErrorExtensions, + GraphQLFormattedError, +} from "graphql"; import { isNonNullObject } from "../utilities/index.js"; import type { ServerParseError } from "../link/http/index.js"; @@ -17,7 +21,7 @@ type FetchResultWithSymbolExtensions = FetchResult & { }; export interface ApolloErrorOptions { - graphQLErrors?: ReadonlyArray; + graphQLErrors?: ReadonlyArray; protocolErrors?: ReadonlyArray<{ message: string; extensions?: GraphQLErrorExtensions[]; @@ -67,6 +71,13 @@ const generateErrorMessage = (err: ApolloError) => { ); }; +/** + * @deprecated This type is deprecated and will be removed in the next major version of Apollo Client. + * It mistakenly referenced `GraqhQLError` instead of `GraphQLFormattedError`. + * + * Use `ReadonlyArray` instead. + */ +// eslint-disable-next-line @typescript-eslint/ban-types export type GraphQLErrors = ReadonlyArray; export type NetworkError = Error | ServerParseError | ServerError | null; @@ -74,7 +85,7 @@ export type NetworkError = Error | ServerParseError | ServerError | null; export class ApolloError extends Error { public name: string; public message: string; - public graphQLErrors: GraphQLErrors; + public graphQLErrors: ReadonlyArray; public protocolErrors: ReadonlyArray<{ message: string; extensions?: GraphQLErrorExtensions[]; @@ -88,9 +99,11 @@ export class ApolloError extends Error { */ public cause: | ({ - message: string; - extensions?: GraphQLErrorExtensions[]; - } & Partial) + readonly message: string; + extensions?: + | GraphQLErrorExtensions[] + | GraphQLFormattedError["extensions"]; + } & Omit & Partial, "extensions">) | null; // An object that can be used to provide some additional information @@ -98,8 +111,9 @@ export class ApolloError extends Error { // internally within Apollo Client. public extraInfo: any; - // Constructs an instance of ApolloError given a GraphQLError - // or a network error. Note that one of these has to be a valid + // Constructs an instance of ApolloError given serialized GraphQL errors, + // client errors, protocol errors or network errors. + // Note that one of these has to be a valid // value or the constructed error will be meaningless. constructor({ graphQLErrors, diff --git a/src/link/core/types.ts b/src/link/core/types.ts index a898f1a598e..c596ecac0c2 100644 --- a/src/link/core/types.ts +++ b/src/link/core/types.ts @@ -1,4 +1,4 @@ -import type { ExecutionResult, GraphQLError } from "graphql"; +import type { GraphQLFormattedError } from "graphql"; import type { DocumentNode } from "graphql"; import type { DefaultContext } from "../../core/index.js"; export type { DocumentNode }; @@ -18,7 +18,7 @@ export interface ExecutionPatchInitialResult< // if data is present, incremental is not data: TData | null | undefined; incremental?: never; - errors?: ReadonlyArray; + errors?: ReadonlyArray; extensions?: TExtensions; } @@ -28,7 +28,7 @@ export interface IncrementalPayload { data: TData | null; label?: string; path: Path; - errors?: ReadonlyArray; + errors?: ReadonlyArray; extensions?: TExtensions; } @@ -91,10 +91,12 @@ export interface SingleExecutionResult< TData = Record, TContext = DefaultContext, TExtensions = Record, -> extends ExecutionResult { +> { // data might be undefined if errorPolicy was set to 'ignore' data?: TData | null; context?: TContext; + errors?: ReadonlyArray; + extensions?: TExtensions; } export type FetchResult< diff --git a/src/link/error/index.ts b/src/link/error/index.ts index 00b0701ab6f..bf9494c5dfa 100644 --- a/src/link/error/index.ts +++ b/src/link/error/index.ts @@ -1,14 +1,14 @@ -import type { ExecutionResult } from "graphql"; +import type { FormattedExecutionResult, GraphQLFormattedError } from "graphql"; -import type { NetworkError, GraphQLErrors } from "../../errors/index.js"; +import type { NetworkError } from "../../errors/index.js"; import { Observable } from "../../utilities/index.js"; import type { Operation, FetchResult, NextLink } from "../core/index.js"; import { ApolloLink } from "../core/index.js"; export interface ErrorResponse { - graphQLErrors?: GraphQLErrors; + graphQLErrors?: ReadonlyArray; networkError?: NetworkError; - response?: ExecutionResult; + response?: FormattedExecutionResult; operation: Operation; forward: NextLink; } diff --git a/src/link/persisted-queries/index.ts b/src/link/persisted-queries/index.ts index 920633bd7f3..e631098652d 100644 --- a/src/link/persisted-queries/index.ts +++ b/src/link/persisted-queries/index.ts @@ -1,7 +1,11 @@ import { invariant } from "../../utilities/globals/index.js"; import { print } from "../../utilities/index.js"; -import type { DocumentNode, ExecutionResult, GraphQLError } from "graphql"; +import type { + DocumentNode, + FormattedExecutionResult, + GraphQLFormattedError, +} from "graphql"; import type { Operation } from "../core/index.js"; import { ApolloLink } from "../core/index.js"; @@ -21,9 +25,9 @@ import { export const VERSION = 1; export interface ErrorResponse { - graphQLErrors?: readonly GraphQLError[]; + graphQLErrors?: ReadonlyArray; networkError?: NetworkError; - response?: ExecutionResult; + response?: FormattedExecutionResult; operation: Operation; meta: ErrorMeta; } @@ -59,7 +63,10 @@ export namespace PersistedQueryLink { } function processErrors( - graphQLErrors: GraphQLError[] | readonly GraphQLError[] | undefined + graphQLErrors: + | GraphQLFormattedError[] + | ReadonlyArray + | undefined ): ErrorMeta { const byMessage = Object.create(null), byCode = Object.create(null); @@ -165,7 +172,7 @@ export const createPersistedQueryLink = ( const { query } = operation; - return new Observable((observer: Observer) => { + return new Observable((observer: Observer) => { let subscription: ObservableSubscription; let retried = false; let originalFetchOptions: any; @@ -174,13 +181,16 @@ export const createPersistedQueryLink = ( { response, networkError, - }: { response?: ExecutionResult; networkError?: ServerError }, + }: { + response?: FormattedExecutionResult; + networkError?: ServerError; + }, cb: () => void ) => { if (!retried && ((response && response.errors) || networkError)) { retried = true; - const graphQLErrors: GraphQLError[] = []; + const graphQLErrors: GraphQLFormattedError[] = []; const responseErrors = response && response.errors; if (isNonEmptyArray(responseErrors)) { @@ -193,7 +203,7 @@ export const createPersistedQueryLink = ( networkErrors = networkError && networkError.result && - (networkError.result.errors as GraphQLError[]); + (networkError.result.errors as GraphQLFormattedError[]); } if (isNonEmptyArray(networkErrors)) { graphQLErrors.push(...networkErrors); @@ -243,7 +253,7 @@ export const createPersistedQueryLink = ( cb(); }; const handler = { - next: (response: ExecutionResult) => { + next: (response: FormattedExecutionResult) => { maybeRetry({ response }, () => observer.next!(response)); }, error: (networkError: ServerError) => { diff --git a/src/link/subscriptions/index.ts b/src/link/subscriptions/index.ts index db56154718c..4823f7a22ee 100644 --- a/src/link/subscriptions/index.ts +++ b/src/link/subscriptions/index.ts @@ -29,12 +29,13 @@ // THE SOFTWARE. import { print } from "../../utilities/index.js"; -import type { Client } from "graphql-ws"; +import type { Client, Sink } from "graphql-ws"; import type { Operation, FetchResult } from "../core/index.js"; import { ApolloLink } from "../core/index.js"; import { isNonNullObject, Observable } from "../../utilities/index.js"; import { ApolloError } from "../../errors/index.js"; +import type { FormattedExecutionResult } from "graphql"; // https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close_event function isLikeCloseEvent(val: unknown): val is CloseEvent { @@ -80,7 +81,8 @@ export class GraphQLWsLink extends ApolloLink { }) ); }, - } + // casting around a wrong type in graphql-ws, which incorrectly expects `Sink` + } satisfies Sink as any ); }); } diff --git a/src/react/components/__tests__/client/Mutation.test.tsx b/src/react/components/__tests__/client/Mutation.test.tsx index b71ba82f7cc..fc88f76b44e 100644 --- a/src/react/components/__tests__/client/Mutation.test.tsx +++ b/src/react/components/__tests__/client/Mutation.test.tsx @@ -1,6 +1,10 @@ import React, { useState, PropsWithChildren } from "react"; import gql from "graphql-tag"; -import { ExecutionResult, GraphQLError } from "graphql"; +import { + ExecutionResult, + FormattedExecutionResult, + GraphQLError, +} from "graphql"; import userEvent from "@testing-library/user-event"; import { render, screen, waitFor, act } from "@testing-library/react"; @@ -1195,7 +1199,7 @@ describe("General Mutation testing", () => { })); it("has an update prop for updating the store after the mutation", async () => { - const update = (_proxy: DataProxy, response: ExecutionResult) => { + const update = (_proxy: DataProxy, response: FormattedExecutionResult) => { expect(response.data).toEqual(data); }; diff --git a/src/testing/experimental/createSchemaFetch.ts b/src/testing/experimental/createSchemaFetch.ts index 5c03ea0da0d..fe253f98899 100644 --- a/src/testing/experimental/createSchemaFetch.ts +++ b/src/testing/experimental/createSchemaFetch.ts @@ -1,5 +1,5 @@ import { execute, validate } from "graphql"; -import type { GraphQLError, GraphQLSchema } from "graphql"; +import type { GraphQLFormattedError, GraphQLSchema } from "graphql"; import { ApolloError, gql } from "../../core/index.js"; import { withCleanup } from "../internal/index.js"; import { wait } from "../core/wait.js"; @@ -67,7 +67,16 @@ const createSchemaFetch = ( validationErrors = validate(schema, document); } catch (e) { validationErrors = [ - new ApolloError({ graphQLErrors: [e as GraphQLError] }), + new ApolloError({ + graphQLErrors: [ + /* + * Technically, these are even `GraphQLError` instances, + * but we try to avoid referencing that type, and `GraphQLError` + * implements the `GraphQLFormattedError` interface. + */ + e as GraphQLFormattedError, + ], + }), ]; } From 3812800c6e4e5e3e64f473543babdba35ce100c2 Mon Sep 17 00:00:00 2001 From: jcostello-atlassian <64562665+jcostello-atlassian@users.noreply.github.com> Date: Tue, 9 Jul 2024 12:01:50 -0400 Subject: [PATCH 17/17] Support extensions in useSubscription (#11854) Co-authored-by: Lenz Weber-Tronic --- .api-reports/api-report-core.api.md | 9 +-- .api-reports/api-report-react.api.md | 10 +-- .../api-report-react_components.api.md | 10 +-- .api-reports/api-report-react_context.api.md | 9 +-- .api-reports/api-report-react_hoc.api.md | 9 +-- .api-reports/api-report-react_hooks.api.md | 10 +-- .api-reports/api-report-react_internal.api.md | 9 +-- .api-reports/api-report-react_ssr.api.md | 9 +-- .api-reports/api-report-testing.api.md | 9 +-- .api-reports/api-report-testing_core.api.md | 9 +-- .api-reports/api-report-utilities.api.md | 9 +-- .api-reports/api-report.api.md | 10 +-- .changeset/angry-seals-jog.md | 5 ++ .size-limits.json | 4 +- src/core/QueryManager.ts | 72 ++++++++++--------- src/core/watchQueryOptions.ts | 3 + .../hooks/__tests__/useSubscription.test.tsx | 68 ++++++++++++++++++ src/react/hooks/useSubscription.ts | 49 ++++++------- src/react/types/types.documentation.ts | 5 ++ src/react/types/types.ts | 2 + 20 files changed, 209 insertions(+), 111 deletions(-) create mode 100644 .changeset/angry-seals-jog.md diff --git a/.api-reports/api-report-core.api.md b/.api-reports/api-report-core.api.md index 815cb7391ad..5382952aee8 100644 --- a/.api-reports/api-report-core.api.md +++ b/.api-reports/api-report-core.api.md @@ -1866,7 +1866,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, }: SubscriptionOptions): Observable>; + startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -2142,6 +2142,7 @@ export type SubscribeToMoreOptions { context?: DefaultContext; errorPolicy?: ErrorPolicy; + extensions?: Record; fetchPolicy?: FetchPolicy; query: DocumentNode | TypedDocumentNode; variables?: TVariables; @@ -2302,9 +2303,9 @@ interface WriteContext extends ReadMergeModifyContext { // src/core/ObservableQuery.ts:117:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:124:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:158:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts -// src/core/QueryManager.ts:390:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts -// src/core/watchQueryOptions.ts:269:2 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts -// src/core/watchQueryOptions.ts:269:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:391:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:272:2 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:272:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts // src/link/http/selectHttpOptionsAndBody.ts:128:32 - (ae-forgotten-export) The symbol "HttpQueryOptions" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/.api-reports/api-report-react.api.md b/.api-reports/api-report-react.api.md index 32dd9f8010c..0e32289572a 100644 --- a/.api-reports/api-report-react.api.md +++ b/.api-reports/api-report-react.api.md @@ -392,6 +392,7 @@ export interface BaseSubscriptionOptions; // Warning: (ae-forgotten-export) The symbol "FetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: FetchPolicy; ignoreResults?: boolean; @@ -1647,7 +1648,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, }: SubscriptionOptions): Observable>; + startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1948,6 +1949,7 @@ export interface SubscriptionHookOptions { context?: Context; errorPolicy?: ErrorPolicy; + extensions?: Record; fetchPolicy?: FetchPolicy; query: DocumentNode | TypedDocumentNode; variables?: TVariables; @@ -2324,11 +2326,11 @@ interface WatchQueryOptions; // Warning: (ae-forgotten-export) The symbol "FetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: FetchPolicy; ignoreResults?: boolean; @@ -1461,7 +1462,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, }: SubscriptionOptions): Observable>; + startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1696,6 +1697,7 @@ export interface SubscriptionComponentOptions { context?: DefaultContext; errorPolicy?: ErrorPolicy; + extensions?: Record; fetchPolicy?: FetchPolicy; query: DocumentNode | TypedDocumentNode; variables?: TVariables; @@ -1803,11 +1805,11 @@ interface WatchQueryOptions { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, }: SubscriptionOptions): Observable>; + startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1626,6 +1626,7 @@ type SubscribeToMoreOptions { context?: DefaultContext; errorPolicy?: ErrorPolicy; + extensions?: Record; fetchPolicy?: FetchPolicy; query: DocumentNode | TypedDocumentNode; variables?: TVariables; @@ -1724,11 +1725,11 @@ interface WatchQueryOptions { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, }: SubscriptionOptions): Observable>; + startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1632,6 +1632,7 @@ type SubscribeToMoreOptions { context?: DefaultContext; errorPolicy?: ErrorPolicy; + extensions?: Record; fetchPolicy?: FetchPolicy; query: DocumentNode | TypedDocumentNode; variables?: TVariables; @@ -1753,11 +1754,11 @@ export function withSubscription; // Warning: (ae-forgotten-export) The symbol "FetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: FetchPolicy; ignoreResults?: boolean; @@ -1516,7 +1517,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, }: SubscriptionOptions): Observable>; + startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1770,6 +1771,7 @@ interface SubscriptionHookOptions { context?: DefaultContext; errorPolicy?: ErrorPolicy; + extensions?: Record; fetchPolicy?: FetchPolicy; query: DocumentNode | TypedDocumentNode; variables?: TVariables; @@ -2148,11 +2150,11 @@ interface WatchQueryOptions { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, }: SubscriptionOptions): Observable>; + startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1815,6 +1815,7 @@ type SubscribeToMoreOptions { context?: DefaultContext; errorPolicy?: ErrorPolicy; + extensions?: Record; fetchPolicy?: FetchPolicy; query: DocumentNode | TypedDocumentNode; variables?: TVariables; @@ -2212,11 +2213,11 @@ export function wrapQueryRef(inter // src/core/ObservableQuery.ts:117:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:124:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:158:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts -// src/core/QueryManager.ts:390:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:391:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts // src/core/types.ts:174:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts // src/core/types.ts:203:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts -// src/core/watchQueryOptions.ts:269:2 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts -// src/core/watchQueryOptions.ts:269:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:272:2 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:272:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts // src/react/hooks/useBackgroundQuery.ts:38:3 - (ae-forgotten-export) The symbol "SubscribeToMoreFunction" needs to be exported by the entry point index.d.ts // src/react/hooks/useBackgroundQuery.ts:54:3 - (ae-forgotten-export) The symbol "FetchMoreFunction" needs to be exported by the entry point index.d.ts // src/react/hooks/useBackgroundQuery.ts:78:4 - (ae-forgotten-export) The symbol "RefetchFunction" needs to be exported by the entry point index.d.ts diff --git a/.api-reports/api-report-react_ssr.api.md b/.api-reports/api-report-react_ssr.api.md index 6db286b108c..c547e869238 100644 --- a/.api-reports/api-report-react_ssr.api.md +++ b/.api-reports/api-report-react_ssr.api.md @@ -1375,7 +1375,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, }: SubscriptionOptions): Observable>; + startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1611,6 +1611,7 @@ type SubscribeToMoreOptions { context?: DefaultContext; errorPolicy?: ErrorPolicy; + extensions?: Record; fetchPolicy?: FetchPolicy; query: DocumentNode | TypedDocumentNode; variables?: TVariables; @@ -1709,11 +1710,11 @@ interface WatchQueryOptions { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, }: SubscriptionOptions): Observable>; + startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1661,6 +1661,7 @@ type SubscribeToMoreOptions { context?: DefaultContext; errorPolicy?: ErrorPolicy; + extensions?: Record; fetchPolicy?: FetchPolicy; query: DocumentNode | TypedDocumentNode; variables?: TVariables; @@ -1779,11 +1780,11 @@ export function withWarningSpy(it: (...args: TArgs // src/core/ObservableQuery.ts:117:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:124:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:158:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts -// src/core/QueryManager.ts:390:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:391:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts // src/core/types.ts:174:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts // src/core/types.ts:203:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts -// src/core/watchQueryOptions.ts:269:2 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts -// src/core/watchQueryOptions.ts:269:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:272:2 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:272:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/.api-reports/api-report-testing_core.api.md b/.api-reports/api-report-testing_core.api.md index aacf32eccc3..ddf2c0aa6c4 100644 --- a/.api-reports/api-report-testing_core.api.md +++ b/.api-reports/api-report-testing_core.api.md @@ -1413,7 +1413,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, }: SubscriptionOptions): Observable>; + startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1618,6 +1618,7 @@ type SubscribeToMoreOptions { context?: DefaultContext; errorPolicy?: ErrorPolicy; + extensions?: Record; fetchPolicy?: FetchPolicy; query: DocumentNode | TypedDocumentNode; variables?: TVariables; @@ -1736,11 +1737,11 @@ export function withWarningSpy(it: (...args: TArgs // src/core/ObservableQuery.ts:117:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:124:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:158:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts -// src/core/QueryManager.ts:390:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:391:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts // src/core/types.ts:174:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts // src/core/types.ts:203:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts -// src/core/watchQueryOptions.ts:269:2 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts -// src/core/watchQueryOptions.ts:269:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:272:2 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:272:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/.api-reports/api-report-utilities.api.md b/.api-reports/api-report-utilities.api.md index 8dc5e2982b6..ea225f4f7e6 100644 --- a/.api-reports/api-report-utilities.api.md +++ b/.api-reports/api-report-utilities.api.md @@ -2177,7 +2177,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, }: SubscriptionOptions): Observable>; + startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -2478,6 +2478,7 @@ type SubscribeToMoreOptions { context?: DefaultContext; errorPolicy?: ErrorPolicy; + extensions?: Record; fetchPolicy?: FetchPolicy; query: DocumentNode | TypedDocumentNode; variables?: TVariables; @@ -2667,11 +2668,11 @@ interface WriteContext extends ReadMergeModifyContext { // src/core/ObservableQuery.ts:117:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:124:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:158:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts -// src/core/QueryManager.ts:390:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:391:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts // src/core/types.ts:174:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts // src/core/types.ts:203:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts -// src/core/watchQueryOptions.ts:269:2 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts -// src/core/watchQueryOptions.ts:269:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:272:2 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:272:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts // src/utilities/graphql/storeUtils.ts:226:12 - (ae-forgotten-export) The symbol "storeKeyNameStringify" needs to be exported by the entry point index.d.ts // src/utilities/policies/pagination.ts:76:3 - (ae-forgotten-export) The symbol "TRelayEdge" needs to be exported by the entry point index.d.ts // src/utilities/policies/pagination.ts:77:3 - (ae-forgotten-export) The symbol "TRelayPageInfo" needs to be exported by the entry point index.d.ts diff --git a/.api-reports/api-report.api.md b/.api-reports/api-report.api.md index b8b6d180649..58d5f5cbdd7 100644 --- a/.api-reports/api-report.api.md +++ b/.api-reports/api-report.api.md @@ -363,6 +363,7 @@ export interface BaseSubscriptionOptions; context?: DefaultContext; errorPolicy?: ErrorPolicy; + extensions?: Record; fetchPolicy?: FetchPolicy; ignoreResults?: boolean; onComplete?: () => void; @@ -2216,7 +2217,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, }: SubscriptionOptions): Observable>; + startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -2580,6 +2581,7 @@ export interface SubscriptionHookOptions { context?: DefaultContext; errorPolicy?: ErrorPolicy; + extensions?: Record; fetchPolicy?: FetchPolicy; query: DocumentNode | TypedDocumentNode; variables?: TVariables; @@ -3014,9 +3016,9 @@ interface WriteContext extends ReadMergeModifyContext { // src/core/ObservableQuery.ts:117:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:124:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:158:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts -// src/core/QueryManager.ts:390:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts -// src/core/watchQueryOptions.ts:269:2 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts -// src/core/watchQueryOptions.ts:269:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:391:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:272:2 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:272:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts // src/link/http/selectHttpOptionsAndBody.ts:128:32 - (ae-forgotten-export) The symbol "HttpQueryOptions" needs to be exported by the entry point index.d.ts // src/react/hooks/useBackgroundQuery.ts:38:3 - (ae-forgotten-export) The symbol "SubscribeToMoreFunction" needs to be exported by the entry point index.d.ts // src/react/hooks/useBackgroundQuery.ts:54:3 - (ae-forgotten-export) The symbol "FetchMoreFunction" needs to be exported by the entry point index.d.ts diff --git a/.changeset/angry-seals-jog.md b/.changeset/angry-seals-jog.md new file mode 100644 index 00000000000..9ba52ae2f3c --- /dev/null +++ b/.changeset/angry-seals-jog.md @@ -0,0 +1,5 @@ +--- +"@apollo/client": minor +--- + +Support extensions in useSubscription diff --git a/.size-limits.json b/.size-limits.json index c81dd92070b..3e400e47793 100644 --- a/.size-limits.json +++ b/.size-limits.json @@ -1,4 +1,4 @@ { - "dist/apollo-client.min.cjs": 40110, - "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32941 + "dist/apollo-client.min.cjs": 40179, + "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32973 } diff --git a/src/core/QueryManager.ts b/src/core/QueryManager.ts index 92029d9a6f1..9d230fcc3c0 100644 --- a/src/core/QueryManager.ts +++ b/src/core/QueryManager.ts @@ -293,6 +293,7 @@ export class QueryManager { optimisticResponse: isOptimistic ? optimisticResponse : void 0, }, variables, + {}, false ), @@ -981,52 +982,55 @@ export class QueryManager { errorPolicy = "none", variables, context = {}, + extensions = {}, }: SubscriptionOptions): Observable> { query = this.transform(query); variables = this.getVariables(query, variables); const makeObservable = (variables: OperationVariables) => - this.getObservableFromLink(query, context, variables).map((result) => { - if (fetchPolicy !== "no-cache") { - // the subscription interface should handle not sending us results we no longer subscribe to. - // XXX I don't think we ever send in an object with errors, but we might in the future... - if (shouldWriteResult(result, errorPolicy)) { - this.cache.write({ - query, - result: result.data, - dataId: "ROOT_SUBSCRIPTION", - variables: variables, - }); + this.getObservableFromLink(query, context, variables, extensions).map( + (result) => { + if (fetchPolicy !== "no-cache") { + // the subscription interface should handle not sending us results we no longer subscribe to. + // XXX I don't think we ever send in an object with errors, but we might in the future... + if (shouldWriteResult(result, errorPolicy)) { + this.cache.write({ + query, + result: result.data, + dataId: "ROOT_SUBSCRIPTION", + variables: variables, + }); + } + + this.broadcastQueries(); } - this.broadcastQueries(); - } + const hasErrors = graphQLResultHasError(result); + const hasProtocolErrors = graphQLResultHasProtocolErrors(result); + if (hasErrors || hasProtocolErrors) { + const errors: ApolloErrorOptions = {}; + if (hasErrors) { + errors.graphQLErrors = result.errors; + } + if (hasProtocolErrors) { + errors.protocolErrors = result.extensions[PROTOCOL_ERRORS_SYMBOL]; + } - const hasErrors = graphQLResultHasError(result); - const hasProtocolErrors = graphQLResultHasProtocolErrors(result); - if (hasErrors || hasProtocolErrors) { - const errors: ApolloErrorOptions = {}; - if (hasErrors) { - errors.graphQLErrors = result.errors; - } - if (hasProtocolErrors) { - errors.protocolErrors = result.extensions[PROTOCOL_ERRORS_SYMBOL]; + // `errorPolicy` is a mechanism for handling GraphQL errors, according + // to our documentation, so we throw protocol errors regardless of the + // set error policy. + if (errorPolicy === "none" || hasProtocolErrors) { + throw new ApolloError(errors); + } } - // `errorPolicy` is a mechanism for handling GraphQL errors, according - // to our documentation, so we throw protocol errors regardless of the - // set error policy. - if (errorPolicy === "none" || hasProtocolErrors) { - throw new ApolloError(errors); + if (errorPolicy === "ignore") { + delete result.errors; } - } - if (errorPolicy === "ignore") { - delete result.errors; + return result; } - - return result; - }); + ); if (this.getDocumentInfo(query).hasClientExports) { const observablePromise = this.localState @@ -1088,6 +1092,7 @@ export class QueryManager { query: DocumentNode, context: any, variables?: OperationVariables, + extensions?: Record, // Prefer context.queryDeduplication if specified. deduplication: boolean = context?.queryDeduplication ?? this.queryDeduplication @@ -1106,6 +1111,7 @@ export class QueryManager { ...context, forceFetch: !deduplication, }), + extensions, }; context = operation.context; diff --git a/src/core/watchQueryOptions.ts b/src/core/watchQueryOptions.ts index 5810c6464c4..b05cdb13c33 100644 --- a/src/core/watchQueryOptions.ts +++ b/src/core/watchQueryOptions.ts @@ -206,6 +206,9 @@ export interface SubscriptionOptions< /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#context:member} */ context?: DefaultContext; + + /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#extensions:member} */ + extensions?: Record; } export interface MutationBaseOptions< diff --git a/src/react/hooks/__tests__/useSubscription.test.tsx b/src/react/hooks/__tests__/useSubscription.test.tsx index c003585f309..0c9002638d1 100644 --- a/src/react/hooks/__tests__/useSubscription.test.tsx +++ b/src/react/hooks/__tests__/useSubscription.test.tsx @@ -459,6 +459,74 @@ describe("useSubscription Hook", () => { expect(context!).toBe("Audi"); }); + it("should share extensions set in options", async () => { + const subscription = gql` + subscription { + car { + make + } + } + `; + + const results = ["Audi", "BMW"].map((make) => ({ + result: { data: { car: { make } } }, + })); + + let extensions: string; + const link = new MockSubscriptionLink(); + const extensionsLink = new ApolloLink((operation, forward) => { + extensions = operation.extensions.make; + return forward(operation); + }); + const client = new ApolloClient({ + link: concat(extensionsLink, link), + cache: new Cache({ addTypename: false }), + }); + + const { result } = renderHook( + () => + useSubscription(subscription, { + extensions: { make: "Audi" }, + }), + { + wrapper: ({ children }) => ( + {children} + ), + } + ); + + expect(result.current.loading).toBe(true); + expect(result.current.error).toBe(undefined); + expect(result.current.data).toBe(undefined); + setTimeout(() => { + link.simulateResult(results[0]); + }, 100); + + await waitFor( + () => { + expect(result.current.data).toEqual(results[0].result.data); + }, + { interval: 1 } + ); + expect(result.current.loading).toBe(false); + expect(result.current.error).toBe(undefined); + + setTimeout(() => { + link.simulateResult(results[1]); + }); + + await waitFor( + () => { + expect(result.current.data).toEqual(results[1].result.data); + }, + { interval: 1 } + ); + expect(result.current.loading).toBe(false); + expect(result.current.error).toBe(undefined); + + expect(extensions!).toBe("Audi"); + }); + it("should handle multiple subscriptions properly", async () => { const subscription = gql` subscription { diff --git a/src/react/hooks/useSubscription.ts b/src/react/hooks/useSubscription.ts index 0bbcb9cf17e..fc2280c7bfb 100644 --- a/src/react/hooks/useSubscription.ts +++ b/src/react/hooks/useSubscription.ts @@ -146,23 +146,11 @@ export function useSubscription< errorPolicy, shouldResubscribe, context, + extensions, ignoreResults, } = options; const variables = useDeepMemo(() => options.variables, [options.variables]); - let [observable, setObservable] = React.useState(() => - options.skip ? null : ( - createSubscription( - client, - subscription, - variables, - fetchPolicy, - errorPolicy, - context - ) - ) - ); - const recreate = () => createSubscription( client, @@ -170,9 +158,14 @@ export function useSubscription< variables, fetchPolicy, errorPolicy, - context + context, + extensions ); + let [observable, setObservable] = React.useState( + options.skip ? null : recreate + ); + const recreateRef = React.useRef(recreate); useIsomorphicLayoutEffect(() => { recreateRef.current = recreate; @@ -331,17 +324,23 @@ function createSubscription< >( client: ApolloClient, query: TypedDocumentNode, - variables?: TVariables, - fetchPolicy?: FetchPolicy, - errorPolicy?: ErrorPolicy, - context?: DefaultContext + variables: TVariables | undefined, + fetchPolicy: FetchPolicy | undefined, + errorPolicy: ErrorPolicy | undefined, + context: DefaultContext | undefined, + extensions: Record | undefined ) { - const __ = { - variables, - client, + const options = { query, + variables, fetchPolicy, errorPolicy, + context, + extensions, + }; + const __ = { + ...options, + client, result: { loading: true, data: void 0, @@ -359,13 +358,7 @@ function createSubscription< // lazily start the subscription when the first observer subscribes // to get around strict mode if (!observable) { - observable = client.subscribe({ - query, - variables, - fetchPolicy, - errorPolicy, - context, - }); + observable = client.subscribe(options); } const sub = observable.subscribe(observer); return () => sub.unsubscribe(); diff --git a/src/react/types/types.documentation.ts b/src/react/types/types.documentation.ts index c5f232c1b18..515834e7cb7 100644 --- a/src/react/types/types.documentation.ts +++ b/src/react/types/types.documentation.ts @@ -552,6 +552,11 @@ export interface SubscriptionOptionsDocumentation { */ context: unknown; + /** + * Shared context between your component and your network interface (Apollo Link). + */ + extensions: unknown; + /** * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component completes the subscription. * diff --git a/src/react/types/types.ts b/src/react/types/types.ts index ee441640737..cd2e6df1ccb 100644 --- a/src/react/types/types.ts +++ b/src/react/types/types.ts @@ -449,6 +449,8 @@ export interface BaseSubscriptionOptions< skip?: boolean; /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#context:member} */ context?: DefaultContext; + /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#extensions:member} */ + extensions?: Record; /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onComplete:member} */ onComplete?: () => void; /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onData:member} */