@apollo/client 4.3.0-alpha.3 → 4.3.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/__cjs/cache/core/types/Cache.d.cts +25 -0
- package/__cjs/cache/index.cjs.map +1 -1
- package/__cjs/cache/index.d.cts +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.cjs +4 -0
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.d.cts +7 -3
- package/__cjs/cache/inmemory/readFromStore.cjs +453 -42
- package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/readFromStore.d.cts +11 -2
- package/__cjs/cache/inmemory/types.d.cts +11 -1
- package/__cjs/cache/inmemory/writeToStore.cjs +1 -5
- package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/__cjs/core/QueryInfo.cjs +86 -172
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +8 -2
- package/__cjs/core/QueryManager.cjs +3 -1
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -1
- package/__cjs/incremental/handlers/defer20220824.d.cts +2 -4
- package/__cjs/incremental/handlers/graphql17Alpha9.cjs +20 -12
- package/__cjs/incremental/handlers/graphql17Alpha9.cjs.map +1 -1
- package/__cjs/incremental/handlers/graphql17Alpha9.d.cts +5 -5
- package/__cjs/incremental/types.d.cts +16 -3
- package/__cjs/utilities/caching/sizes.cjs.map +1 -1
- package/__cjs/utilities/caching/sizes.d.cts +39 -1
- package/__cjs/utilities/internal/StreamArrayState.cjs +27 -0
- package/__cjs/utilities/internal/StreamArrayState.cjs.map +1 -0
- package/__cjs/utilities/internal/StreamArrayState.d.cts +12 -0
- package/__cjs/utilities/internal/constants.cjs +20 -1
- package/__cjs/utilities/internal/constants.cjs.map +1 -1
- package/__cjs/utilities/internal/constants.d.cts +19 -0
- package/__cjs/utilities/internal/getFragmentFromSelection.cjs +1 -1
- package/__cjs/utilities/internal/getFragmentFromSelection.cjs.map +1 -1
- package/__cjs/utilities/internal/getMemoryInternals.cjs +6 -0
- package/__cjs/utilities/internal/getMemoryInternals.cjs.map +1 -1
- package/__cjs/utilities/internal/getMemoryInternals.d.cts +4 -0
- package/__cjs/utilities/internal/index.cjs +9 -4
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +5 -3
- package/__cjs/utilities/internal/isDeferredFragment.cjs +19 -4
- package/__cjs/utilities/internal/isDeferredFragment.cjs.map +1 -1
- package/__cjs/utilities/internal/isDeferredFragment.d.cts +6 -1
- package/__cjs/utilities/internal/isStreamField.cjs +37 -0
- package/__cjs/utilities/internal/isStreamField.cjs.map +1 -0
- package/__cjs/utilities/internal/isStreamField.d.cts +9 -0
- package/__cjs/utilities/internal/makeStreamInfoTrie.cjs +17 -0
- package/__cjs/utilities/internal/makeStreamInfoTrie.cjs.map +1 -0
- package/__cjs/utilities/internal/makeStreamInfoTrie.d.cts +8 -0
- package/__cjs/utilities/internal/types/DeferInfo.cjs +3 -0
- package/__cjs/utilities/internal/types/DeferInfo.cjs.map +1 -0
- package/__cjs/utilities/internal/types/DeferInfo.d.cts +10 -0
- package/__cjs/utilities/internal/types/StreamInfoTrie.d.cts +2 -0
- package/__cjs/version.cjs +1 -1
- package/cache/core/types/Cache.d.ts +25 -0
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/index.d.ts +1 -1
- package/cache/index.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +7 -3
- package/cache/inmemory/inMemoryCache.js +5 -1
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +11 -2
- package/cache/inmemory/readFromStore.js +454 -43
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +12 -2
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.js +2 -6
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/QueryInfo.d.ts +8 -2
- package/core/QueryInfo.js +87 -173
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.js +3 -1
- package/core/QueryManager.js.map +1 -1
- package/incremental/handlers/defer20220824.d.ts +2 -4
- package/incremental/handlers/defer20220824.js.map +1 -1
- package/incremental/handlers/graphql17Alpha9.d.ts +5 -5
- package/incremental/handlers/graphql17Alpha9.js +21 -13
- package/incremental/handlers/graphql17Alpha9.js.map +1 -1
- package/incremental/types.d.ts +16 -3
- package/incremental/types.js.map +1 -1
- package/package.json +1 -1
- package/utilities/caching/sizes.d.ts +39 -1
- package/utilities/caching/sizes.js.map +1 -1
- package/utilities/internal/StreamArrayState.d.ts +12 -0
- package/utilities/internal/StreamArrayState.js +23 -0
- package/utilities/internal/StreamArrayState.js.map +1 -0
- package/utilities/internal/constants.d.ts +19 -0
- package/utilities/internal/constants.js +19 -0
- package/utilities/internal/constants.js.map +1 -1
- package/utilities/internal/getFragmentFromSelection.js +1 -1
- package/utilities/internal/getFragmentFromSelection.js.map +1 -1
- package/utilities/internal/getMemoryInternals.d.ts +4 -0
- package/utilities/internal/getMemoryInternals.js +6 -0
- package/utilities/internal/getMemoryInternals.js.map +1 -1
- package/utilities/internal/index.d.ts +5 -3
- package/utilities/internal/index.js +4 -2
- package/utilities/internal/index.js.map +1 -1
- package/utilities/internal/isDeferredFragment.d.ts +7 -2
- package/utilities/internal/isDeferredFragment.js +19 -4
- package/utilities/internal/isDeferredFragment.js.map +1 -1
- package/utilities/internal/isStreamField.d.ts +9 -0
- package/utilities/internal/isStreamField.js +34 -0
- package/utilities/internal/isStreamField.js.map +1 -0
- package/utilities/internal/makeStreamInfoTrie.d.ts +8 -0
- package/utilities/internal/makeStreamInfoTrie.js +14 -0
- package/utilities/internal/makeStreamInfoTrie.js.map +1 -0
- package/utilities/internal/types/DeferInfo.d.ts +10 -0
- package/utilities/internal/types/DeferInfo.js +2 -0
- package/utilities/internal/types/DeferInfo.js.map +1 -0
- package/utilities/internal/types/StreamInfoTrie.d.ts +2 -0
- package/utilities/internal/types/StreamInfoTrie.js.map +1 -1
- package/version.js +1 -1
- package/__cjs/utilities/internal/collectSiblingFields.cjs +0 -61
- package/__cjs/utilities/internal/collectSiblingFields.cjs.map +0 -1
- package/__cjs/utilities/internal/collectSiblingFields.d.cts +0 -21
- package/utilities/internal/collectSiblingFields.d.ts +0 -21
- package/utilities/internal/collectSiblingFields.js +0 -58
- package/utilities/internal/collectSiblingFields.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FormattedExecutionResult, GraphQLFormattedError } from "graphql";
|
|
2
2
|
import type { ApolloLink } from "@apollo/client/link";
|
|
3
3
|
import type { DeepPartial, HKT } from "@apollo/client/utilities";
|
|
4
4
|
import type { Incremental } from "../types.js";
|
|
@@ -57,9 +57,7 @@ export declare class Defer20220824Handler implements Incremental.Handler<Defer20
|
|
|
57
57
|
isIncrementalResult(result: Record<string, any>): result is Defer20220824Handler.SubsequentResult | Defer20220824Handler.InitialResult;
|
|
58
58
|
extractErrors(result: ApolloLink.Result<any>): GraphQLFormattedError[] | undefined;
|
|
59
59
|
prepareRequest(request: ApolloLink.Request): ApolloLink.Request;
|
|
60
|
-
startRequest<TData extends Record<string, unknown>>(_:
|
|
61
|
-
query: DocumentNode;
|
|
62
|
-
}): DeferRequest<TData>;
|
|
60
|
+
startRequest<TData extends Record<string, unknown>>(_: Incremental.StartRequestOptions): DeferRequest<TData>;
|
|
63
61
|
}
|
|
64
62
|
export declare function hasIncrementalChunks(result: Record<string, any>): result is Required<Defer20220824Handler.SubsequentResult>;
|
|
65
63
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defer20220824.js","sourceRoot":"","sources":["../../../src/incremental/handlers/defer20220824.ts"],"names":[],"mappings":"AAQA,OAAO,EAC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AW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;QACD,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YACf,OAAO,GAAG,CAAC;QACb,CAAC;IACH,CAAC;IAED,cAAc,CAAC,OAA2B;QACxC,IAAI,aAAa,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACtD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;YACtC,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;YACnC,IAAI,CAAC,MAAM,GAAG;gBACZ,oCAAoC;gBACpC,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;aACvB,CAAC;QACJ,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,YAAY,CAAwC,CAEnD;QACC,OAAO,IAAI,YAAY,EAAS,CAAC;IACnC,CAAC;CACF;AAED,iCAAiC;AACjC,MAAM,UAAU,oBAAoB,CAClC,MAA2B;IAE3B,OAAO,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import type {\n DocumentNode,\n FormattedExecutionResult,\n GraphQLFormattedError,\n} from \"graphql\";\n\nimport type { ApolloLink } from \"@apollo/client/link\";\nimport type { DeepPartial, HKT } from \"@apollo/client/utilities\";\nimport {\n DeepMerger,\n hasDirectives,\n isNonEmptyArray,\n} from \"@apollo/client/utilities/internal\";\n\nimport type { Incremental } from \"../types.js\";\n\nexport declare namespace Defer20220824Handler {\n interface Defer20220824Result extends HKT {\n arg1: unknown; // TData\n arg2: unknown; // TExtensions\n return: Defer20220824Handler.Chunk<Record<string, unknown>>;\n }\n export interface TypeOverrides {\n AdditionalApolloLinkResultTypes: Defer20220824Result;\n }\n\n export type InitialResult<TData = Record<string, unknown>> = {\n data?: TData | null | undefined;\n errors?: ReadonlyArray<GraphQLFormattedError>;\n extensions?: Record<string, unknown>;\n hasNext: boolean;\n incremental?: ReadonlyArray<IncrementalResult<TData>>;\n };\n\n export type SubsequentResult<TData = Record<string, unknown>> = {\n extensions?: Record<string, unknown>;\n hasNext: boolean;\n incremental?: Array<IncrementalResult<TData>>;\n };\n\n export type IncrementalDeferResult<TData = Record<string, unknown>> = {\n data?: TData | null;\n errors?: ReadonlyArray<GraphQLFormattedError>;\n extensions?: Record<string, unknown>;\n path?: Incremental.Path;\n label?: string;\n };\n\n export type IncrementalStreamResult<TData = Array<unknown>> = {\n errors?: ReadonlyArray<GraphQLFormattedError>;\n items?: TData;\n path?: Incremental.Path;\n label?: string;\n extensions?: Record<string, unknown>;\n };\n\n export type IncrementalResult<TData = Record<string, unknown>> =\n | IncrementalDeferResult<TData>\n | IncrementalStreamResult<TData>;\n\n export type Chunk<TData extends Record<string, unknown>> =\n | InitialResult<TData>\n | SubsequentResult<TData>;\n}\n\nclass DeferRequest<TData extends Record<string, unknown>>\n implements\n Incremental.IncrementalRequest<Defer20220824Handler.Chunk<TData>, TData>\n{\n public hasNext = true;\n\n private errors: Array<GraphQLFormattedError> = [];\n private extensions: Record<string, any> = {};\n private data: any = {};\n // This tracks paths for `@stream` arrays that returns items: null due to\n // errors thrown for non-null array items. We stop processing future updates\n // to these stream arrays to prevent creating sparse arrays or inserting\n // `null` for an expected non-null value which could cause runtime crashes.\n private ignoredImpossibleStreamPaths = new Set<string>();\n\n private merge(\n normalized: FormattedExecutionResult<TData>,\n atPath?: DeepMerger.MergeOptions[\"atPath\"]\n ) {\n if (normalized.data !== undefined) {\n this.data = new DeepMerger({ arrayMerge: \"truncate\" }).merge(\n this.data,\n normalized.data,\n { atPath }\n );\n }\n if (normalized.errors) {\n this.errors.push(...normalized.errors);\n }\n Object.assign(this.extensions, normalized.extensions);\n }\n\n handle(\n // we'll get `undefined` here in case of a `no-cache` fetch policy,\n // so we'll continue with the last value this request had accumulated\n cacheData: TData | DeepPartial<TData> | null | undefined = this.data,\n chunk: Defer20220824Handler.Chunk<TData>\n ): FormattedExecutionResult<TData> {\n this.hasNext = chunk.hasNext;\n this.data = cacheData;\n\n if (hasIncrementalChunks(chunk)) {\n for (const incremental of chunk.incremental) {\n const { path, errors, extensions } = incremental;\n\n if (\"items\" in incremental) {\n // Remove the array index from the end of the array since each future\n // chunk sends a different array index. This normalizes the path to\n // ensure we ignore updates to this field if `items` is `null`.\n const stringPath = path?.slice(0, -1).join(\".\") ?? \"\";\n\n if (incremental.items === null) {\n this.ignoredImpossibleStreamPaths.add(stringPath);\n }\n\n if (this.ignoredImpossibleStreamPaths.has(stringPath)) {\n this.merge({ errors, extensions });\n continue;\n }\n }\n\n let data: any =\n \"items\" in incremental ? incremental.items\n // Ensure `data: null` isn't merged for `@defer` responses by\n // falling back to `undefined`\n : \"data\" in incremental ? incremental.data ?? undefined\n : undefined;\n\n if (path && typeof path.at(-1) === \"number\" && Array.isArray(data)) {\n const startingIdx = path.at(-1) as number;\n data.forEach((item, idx) => {\n this.merge({ data: item }, [\n ...path!.slice(0, -1),\n startingIdx + idx,\n ]);\n });\n } else {\n this.merge({ data }, path);\n }\n\n this.merge({ errors, extensions });\n }\n } else {\n this.merge(chunk);\n }\n\n const result: FormattedExecutionResult<TData> = { data: this.data };\n\n if (isNonEmptyArray(this.errors)) {\n result.errors = this.errors;\n }\n\n if (Object.keys(this.extensions).length > 0) {\n result.extensions = this.extensions;\n }\n\n return result;\n }\n}\n\n/**\n * This handler implements the `@defer` directive as specified in this historical commit:\n * https://github.com/graphql/graphql-spec/tree/48cf7263a71a683fab03d45d309fd42d8d9a6659/spec\n */\nexport class Defer20220824Handler\n implements Incremental.Handler<Defer20220824Handler.Chunk<any>>\n{\n isIncrementalResult(\n result: Record<string, any>\n ): result is\n | Defer20220824Handler.SubsequentResult\n | Defer20220824Handler.InitialResult {\n return \"hasNext\" in result;\n }\n\n extractErrors(result: ApolloLink.Result<any>) {\n const acc: GraphQLFormattedError[] = [];\n const push = ({\n errors,\n }: {\n errors?: ReadonlyArray<GraphQLFormattedError>;\n }) => {\n if (errors) {\n acc.push(...errors);\n }\n };\n if (this.isIncrementalResult(result)) {\n if (\"errors\" in result) {\n push(result);\n }\n if (hasIncrementalChunks(result)) {\n result.incremental.forEach(push);\n }\n }\n if (acc.length) {\n return acc;\n }\n }\n\n prepareRequest(request: ApolloLink.Request): ApolloLink.Request {\n if (hasDirectives([\"defer\", \"stream\"], request.query)) {\n const context = request.context ?? {};\n const http = (context.http ??= {});\n http.accept = [\n \"multipart/mixed;deferSpec=20220824\",\n ...(http.accept || []),\n ];\n }\n\n return request;\n }\n startRequest<TData extends Record<string, unknown>>(_: {\n query: DocumentNode;\n }) {\n return new DeferRequest<TData>();\n }\n}\n\n// only exported for use in tests\nexport function hasIncrementalChunks(\n result: Record<string, any>\n): result is Required<Defer20220824Handler.SubsequentResult> {\n return isNonEmptyArray(result.incremental);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"defer20220824.js","sourceRoot":"","sources":["../../../src/incremental/handlers/defer20220824.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,UAAU,EACV,aAAa,EACb,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAqD3C,MAAM,YAAY;IAIT,OAAO,GAAG,IAAI,CAAC;IAEd,MAAM,GAAiC,EAAE,CAAC;IAC1C,UAAU,GAAwB,EAAE,CAAC;IACrC,IAAI,GAAQ,EAAE,CAAC;IACvB,yEAAyE;IACzE,4EAA4E;IAC5E,wEAAwE;IACxE,2EAA2E;IACnE,4BAA4B,GAAG,IAAI,GAAG,EAAU,CAAC;IAEjD,KAAK,CACX,UAA2C,EAC3C,MAA0C;QAE1C,IAAI,UAAU,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAClC,IAAI,CAAC,IAAI,GAAG,IAAI,UAAU,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC,KAAK,CAC1D,IAAI,CAAC,IAAI,EACT,UAAU,CAAC,IAAI,EACf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;IACjB,CAAC;IACD,YAAY,CACV,CAAkC;QAElC,OAAO,IAAI,YAAY,EAAS,CAAC;IACnC,CAAC;CACF;AAED,iCAAiC;AACjC,MAAM,UAAU,oBAAoB,CAClC,MAA2B;IAE3B,OAAO,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import type { FormattedExecutionResult, GraphQLFormattedError } from \"graphql\";\n\nimport type { ApolloLink } from \"@apollo/client/link\";\nimport type { DeepPartial, HKT } from \"@apollo/client/utilities\";\nimport {\n DeepMerger,\n hasDirectives,\n isNonEmptyArray,\n} from \"@apollo/client/utilities/internal\";\n\nimport type { Incremental } from \"../types.js\";\n\nexport declare namespace Defer20220824Handler {\n interface Defer20220824Result extends HKT {\n arg1: unknown; // TData\n arg2: unknown; // TExtensions\n return: Defer20220824Handler.Chunk<Record<string, unknown>>;\n }\n export interface TypeOverrides {\n AdditionalApolloLinkResultTypes: Defer20220824Result;\n }\n\n export type InitialResult<TData = Record<string, unknown>> = {\n data?: TData | null | undefined;\n errors?: ReadonlyArray<GraphQLFormattedError>;\n extensions?: Record<string, unknown>;\n hasNext: boolean;\n incremental?: ReadonlyArray<IncrementalResult<TData>>;\n };\n\n export type SubsequentResult<TData = Record<string, unknown>> = {\n extensions?: Record<string, unknown>;\n hasNext: boolean;\n incremental?: Array<IncrementalResult<TData>>;\n };\n\n export type IncrementalDeferResult<TData = Record<string, unknown>> = {\n data?: TData | null;\n errors?: ReadonlyArray<GraphQLFormattedError>;\n extensions?: Record<string, unknown>;\n path?: Incremental.Path;\n label?: string;\n };\n\n export type IncrementalStreamResult<TData = Array<unknown>> = {\n errors?: ReadonlyArray<GraphQLFormattedError>;\n items?: TData;\n path?: Incremental.Path;\n label?: string;\n extensions?: Record<string, unknown>;\n };\n\n export type IncrementalResult<TData = Record<string, unknown>> =\n | IncrementalDeferResult<TData>\n | IncrementalStreamResult<TData>;\n\n export type Chunk<TData extends Record<string, unknown>> =\n | InitialResult<TData>\n | SubsequentResult<TData>;\n}\n\nclass DeferRequest<TData extends Record<string, unknown>>\n implements\n Incremental.IncrementalRequest<Defer20220824Handler.Chunk<TData>, TData>\n{\n public hasNext = true;\n\n private errors: Array<GraphQLFormattedError> = [];\n private extensions: Record<string, any> = {};\n private data: any = {};\n // This tracks paths for `@stream` arrays that returns items: null due to\n // errors thrown for non-null array items. We stop processing future updates\n // to these stream arrays to prevent creating sparse arrays or inserting\n // `null` for an expected non-null value which could cause runtime crashes.\n private ignoredImpossibleStreamPaths = new Set<string>();\n\n private merge(\n normalized: FormattedExecutionResult<TData>,\n atPath?: DeepMerger.MergeOptions[\"atPath\"]\n ) {\n if (normalized.data !== undefined) {\n this.data = new DeepMerger({ arrayMerge: \"truncate\" }).merge(\n this.data,\n normalized.data,\n { atPath }\n );\n }\n if (normalized.errors) {\n this.errors.push(...normalized.errors);\n }\n Object.assign(this.extensions, normalized.extensions);\n }\n\n handle(\n // we'll get `undefined` here in case of a `no-cache` fetch policy,\n // so we'll continue with the last value this request had accumulated\n cacheData: TData | DeepPartial<TData> | null | undefined = this.data,\n chunk: Defer20220824Handler.Chunk<TData>\n ): FormattedExecutionResult<TData> {\n this.hasNext = chunk.hasNext;\n this.data = cacheData;\n\n if (hasIncrementalChunks(chunk)) {\n for (const incremental of chunk.incremental) {\n const { path, errors, extensions } = incremental;\n\n if (\"items\" in incremental) {\n // Remove the array index from the end of the array since each future\n // chunk sends a different array index. This normalizes the path to\n // ensure we ignore updates to this field if `items` is `null`.\n const stringPath = path?.slice(0, -1).join(\".\") ?? \"\";\n\n if (incremental.items === null) {\n this.ignoredImpossibleStreamPaths.add(stringPath);\n }\n\n if (this.ignoredImpossibleStreamPaths.has(stringPath)) {\n this.merge({ errors, extensions });\n continue;\n }\n }\n\n let data: any =\n \"items\" in incremental ? incremental.items\n // Ensure `data: null` isn't merged for `@defer` responses by\n // falling back to `undefined`\n : \"data\" in incremental ? incremental.data ?? undefined\n : undefined;\n\n if (path && typeof path.at(-1) === \"number\" && Array.isArray(data)) {\n const startingIdx = path.at(-1) as number;\n data.forEach((item, idx) => {\n this.merge({ data: item }, [\n ...path!.slice(0, -1),\n startingIdx + idx,\n ]);\n });\n } else {\n this.merge({ data }, path);\n }\n\n this.merge({ errors, extensions });\n }\n } else {\n this.merge(chunk);\n }\n\n const result: FormattedExecutionResult<TData> = { data: this.data };\n\n if (isNonEmptyArray(this.errors)) {\n result.errors = this.errors;\n }\n\n if (Object.keys(this.extensions).length > 0) {\n result.extensions = this.extensions;\n }\n\n return result;\n }\n}\n\n/**\n * This handler implements the `@defer` directive as specified in this historical commit:\n * https://github.com/graphql/graphql-spec/tree/48cf7263a71a683fab03d45d309fd42d8d9a6659/spec\n */\nexport class Defer20220824Handler\n implements Incremental.Handler<Defer20220824Handler.Chunk<any>>\n{\n isIncrementalResult(\n result: Record<string, any>\n ): result is\n | Defer20220824Handler.SubsequentResult\n | Defer20220824Handler.InitialResult {\n return \"hasNext\" in result;\n }\n\n extractErrors(result: ApolloLink.Result<any>) {\n const acc: GraphQLFormattedError[] = [];\n const push = ({\n errors,\n }: {\n errors?: ReadonlyArray<GraphQLFormattedError>;\n }) => {\n if (errors) {\n acc.push(...errors);\n }\n };\n if (this.isIncrementalResult(result)) {\n if (\"errors\" in result) {\n push(result);\n }\n if (hasIncrementalChunks(result)) {\n result.incremental.forEach(push);\n }\n }\n if (acc.length) {\n return acc;\n }\n }\n\n prepareRequest(request: ApolloLink.Request): ApolloLink.Request {\n if (hasDirectives([\"defer\", \"stream\"], request.query)) {\n const context = request.context ?? {};\n const http = (context.http ??= {});\n http.accept = [\n \"multipart/mixed;deferSpec=20220824\",\n ...(http.accept || []),\n ];\n }\n\n return request;\n }\n startRequest<TData extends Record<string, unknown>>(\n _: Incremental.StartRequestOptions\n ) {\n return new DeferRequest<TData>();\n }\n}\n\n// only exported for use in tests\nexport function hasIncrementalChunks(\n result: Record<string, any>\n): result is Required<Defer20220824Handler.SubsequentResult> {\n return isNonEmptyArray(result.incremental);\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FormattedExecutionResult, GraphQLFormattedError } from "graphql";
|
|
2
2
|
import type { ApolloLink } from "@apollo/client/link";
|
|
3
3
|
import type { DeepPartial, HKT } from "@apollo/client/utilities";
|
|
4
4
|
import type { Incremental } from "../types.js";
|
|
@@ -56,9 +56,11 @@ declare class IncrementalRequest<TData> implements Incremental.IncrementalReques
|
|
|
56
56
|
private data;
|
|
57
57
|
private errors;
|
|
58
58
|
private extensions;
|
|
59
|
-
private
|
|
59
|
+
private pendingMap;
|
|
60
60
|
private streamInfo;
|
|
61
61
|
private streamPositions;
|
|
62
|
+
get pending(): GraphQL17Alpha9Handler.PendingResult[];
|
|
63
|
+
getPendingType(id: string): "defer" | "stream";
|
|
62
64
|
handle(cacheData: TData | DeepPartial<TData> | null | undefined, chunk: GraphQL17Alpha9Handler.Chunk<TData>): FormattedExecutionResult<TData>;
|
|
63
65
|
private merge;
|
|
64
66
|
}
|
|
@@ -90,9 +92,7 @@ export declare class GraphQL17Alpha9Handler implements Incremental.Handler<Graph
|
|
|
90
92
|
*
|
|
91
93
|
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
92
94
|
*/
|
|
93
|
-
startRequest<TData>(_:
|
|
94
|
-
query: DocumentNode;
|
|
95
|
-
}): IncrementalRequest<TData>;
|
|
95
|
+
startRequest<TData>(_: Incremental.StartRequestOptions): IncrementalRequest<TData>;
|
|
96
96
|
}
|
|
97
97
|
export {};
|
|
98
98
|
//# sourceMappingURL=graphql17Alpha9.d.ts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DeepMerger, streamInfoSymbol, } from "@apollo/client/utilities/internal";
|
|
1
|
+
import { DeepMerger, makeStreamInfoTrie, streamInfoSymbol, } from "@apollo/client/utilities/internal";
|
|
3
2
|
import { hasDirectives, isNonEmptyArray, } from "@apollo/client/utilities/internal";
|
|
4
3
|
import { invariant } from "@apollo/client/utilities/invariant";
|
|
5
4
|
class IncrementalRequest {
|
|
@@ -7,10 +6,8 @@ class IncrementalRequest {
|
|
|
7
6
|
data = {};
|
|
8
7
|
errors = [];
|
|
9
8
|
extensions = {};
|
|
10
|
-
|
|
11
|
-
streamInfo =
|
|
12
|
-
current: { isFirstChunk: true, isLastChunk: false },
|
|
13
|
-
}));
|
|
9
|
+
pendingMap = new Map();
|
|
10
|
+
streamInfo = makeStreamInfoTrie();
|
|
14
11
|
// `streamPositions` maps `pending.id` to the index that should be set by the
|
|
15
12
|
// next `incremental` stream chunk to ensure the streamed array item is placed
|
|
16
13
|
// at the correct point in the data array. `this.data` contains cached
|
|
@@ -19,27 +16,35 @@ class IncrementalRequest {
|
|
|
19
16
|
// updated by the cache between a streamed chunk aren't overwritten by merges
|
|
20
17
|
// of future stream items from already merged stream items.
|
|
21
18
|
streamPositions = {};
|
|
19
|
+
get pending() {
|
|
20
|
+
return Array.from(this.pendingMap.values());
|
|
21
|
+
}
|
|
22
|
+
getPendingType(id) {
|
|
23
|
+
return id in this.streamPositions ? "stream" : "defer";
|
|
24
|
+
}
|
|
22
25
|
handle(cacheData = this.data, chunk) {
|
|
23
26
|
this.hasNext = chunk.hasNext;
|
|
24
27
|
this.data = cacheData;
|
|
25
28
|
if (chunk.pending) {
|
|
26
29
|
for (const pending of chunk.pending) {
|
|
27
|
-
this.
|
|
30
|
+
this.pendingMap.set(pending.id, pending);
|
|
28
31
|
if ("data" in chunk) {
|
|
29
32
|
const dataAtPath = pending.path.reduce((data, key) => data[key], chunk.data);
|
|
30
33
|
if (Array.isArray(dataAtPath)) {
|
|
31
34
|
this.streamPositions[pending.id] = dataAtPath.length;
|
|
32
|
-
this.streamInfo.lookupArray(pending.path)
|
|
35
|
+
const entry = this.streamInfo.lookupArray(pending.path);
|
|
36
|
+
entry.current = {
|
|
33
37
|
isFirstChunk: true,
|
|
34
38
|
isLastChunk: false,
|
|
35
39
|
};
|
|
40
|
+
entry.state.streamPosition = dataAtPath.length;
|
|
36
41
|
}
|
|
37
42
|
}
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
45
|
if (hasIncrementalChunks(chunk)) {
|
|
41
46
|
for (const incremental of chunk.incremental) {
|
|
42
|
-
const pending = this.
|
|
47
|
+
const pending = this.pendingMap.get(incremental.id);
|
|
43
48
|
invariant(pending, 66);
|
|
44
49
|
const path = pending.path.concat(incremental.subPath ?? []);
|
|
45
50
|
let data;
|
|
@@ -53,10 +58,12 @@ class IncrementalRequest {
|
|
|
53
58
|
parent[i + this.streamPositions[pending.id]] = items[i];
|
|
54
59
|
}
|
|
55
60
|
this.streamPositions[pending.id] += items.length;
|
|
56
|
-
this.streamInfo.lookupArray(path)
|
|
61
|
+
const entry = this.streamInfo.lookupArray(path);
|
|
62
|
+
entry.current = {
|
|
57
63
|
isFirstChunk: false,
|
|
58
64
|
isLastChunk: false,
|
|
59
65
|
};
|
|
66
|
+
entry.state.streamPosition = this.streamPositions[pending.id];
|
|
60
67
|
data = parent;
|
|
61
68
|
}
|
|
62
69
|
else {
|
|
@@ -65,7 +72,7 @@ class IncrementalRequest {
|
|
|
65
72
|
// that we can update streamPositions with the initial length of the
|
|
66
73
|
// array to ensure future streamed items are inserted at the right
|
|
67
74
|
// starting index.
|
|
68
|
-
this.
|
|
75
|
+
this.pendingMap.forEach((pendingItem) => {
|
|
69
76
|
if (!(pendingItem.id in this.streamPositions)) {
|
|
70
77
|
// Check if this incremental data contains array data for the pending path
|
|
71
78
|
// The pending path is absolute, but incremental data is relative to the defer
|
|
@@ -92,7 +99,7 @@ class IncrementalRequest {
|
|
|
92
99
|
}
|
|
93
100
|
if ("completed" in chunk && chunk.completed) {
|
|
94
101
|
for (const completed of chunk.completed) {
|
|
95
|
-
const { path } = this.
|
|
102
|
+
const { path } = this.pendingMap.get(completed.id);
|
|
96
103
|
const streamPosition = this.streamPositions[completed.id];
|
|
97
104
|
// Truncate any stream arrays in case the chunk only contains `hasNext`
|
|
98
105
|
// and `completed`.
|
|
@@ -107,8 +114,9 @@ class IncrementalRequest {
|
|
|
107
114
|
isFirstChunk: false,
|
|
108
115
|
isLastChunk: true,
|
|
109
116
|
};
|
|
117
|
+
details.state.streamPosition = streamPosition;
|
|
110
118
|
}
|
|
111
|
-
this.
|
|
119
|
+
this.pendingMap.delete(completed.id);
|
|
112
120
|
if (completed.errors) {
|
|
113
121
|
this.errors.push(...completed.errors);
|
|
114
122
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql17Alpha9.js","sources":["../../../src/incremental/handlers/graphql17Alpha9.ts"],"sourcesContent":["import { Trie } from \"@wry/trie\";\nimport type {\n DocumentNode,\n FormattedExecutionResult,\n GraphQLFormattedError,\n} from \"graphql\";\n\nimport type { ApolloLink } from \"@apollo/client/link\";\nimport type { DeepPartial, HKT } from \"@apollo/client/utilities\";\nimport type {\n ExtensionsWithStreamInfo,\n StreamInfoTrie,\n} from \"@apollo/client/utilities/internal\";\nimport {\n DeepMerger,\n streamInfoSymbol,\n} from \"@apollo/client/utilities/internal\";\nimport {\n hasDirectives,\n isNonEmptyArray,\n} from \"@apollo/client/utilities/internal\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nimport type { Incremental } from \"../types.js\";\n\nexport declare namespace GraphQL17Alpha9Handler {\n interface GraphQL17Alpha9Result extends HKT {\n arg1: unknown; // TData\n arg2: unknown; // TExtensions\n return: GraphQL17Alpha9Handler.Chunk<Record<string, unknown>>;\n }\n\n export interface TypeOverrides {\n AdditionalApolloLinkResultTypes: GraphQL17Alpha9Result;\n }\n\n export type InitialResult<TData = Record<string, unknown>> = {\n data: TData;\n errors?: ReadonlyArray<GraphQLFormattedError>;\n pending: ReadonlyArray<PendingResult>;\n hasNext: boolean;\n extensions?: Record<string, unknown>;\n };\n\n export type SubsequentResult<TData = unknown> = {\n hasNext: boolean;\n pending?: ReadonlyArray<PendingResult>;\n incremental?: ReadonlyArray<IncrementalResult<TData>>;\n completed?: ReadonlyArray<CompletedResult>;\n extensions?: Record<string, unknown>;\n };\n\n export interface PendingResult {\n id: string;\n path: Incremental.Path;\n label?: string;\n }\n\n export interface CompletedResult {\n id: string;\n errors?: ReadonlyArray<GraphQLFormattedError>;\n }\n\n export interface IncrementalDeferResult<TData = Record<string, unknown>> {\n errors?: ReadonlyArray<GraphQLFormattedError>;\n data: TData;\n id: string;\n subPath?: Incremental.Path;\n extensions?: Record<string, unknown>;\n }\n\n export interface IncrementalStreamResult<TData = ReadonlyArray<unknown>> {\n errors?: ReadonlyArray<GraphQLFormattedError>;\n items: TData;\n id: string;\n subPath?: Incremental.Path;\n extensions?: Record<string, unknown>;\n }\n\n export type IncrementalResult<TData = unknown> =\n | IncrementalDeferResult<TData>\n | IncrementalStreamResult<TData>;\n\n export type Chunk<TData> = InitialResult<TData> | SubsequentResult<TData>;\n}\n\nclass IncrementalRequest<TData>\n implements\n Incremental.IncrementalRequest<GraphQL17Alpha9Handler.Chunk<TData>, TData>\n{\n hasNext = true;\n\n private data: any = {};\n private errors: GraphQLFormattedError[] = [];\n private extensions: Record<string, any> = {};\n private pending = new Map<string, GraphQL17Alpha9Handler.PendingResult>();\n private streamInfo: StreamInfoTrie = new Trie(false, () => ({\n current: { isFirstChunk: true, isLastChunk: false },\n }));\n // `streamPositions` maps `pending.id` to the index that should be set by the\n // next `incremental` stream chunk to ensure the streamed array item is placed\n // at the correct point in the data array. `this.data` contains cached\n // references with the full array so we can't rely on the array length in\n // `this.data` to determine where to place item. This also ensures that items\n // updated by the cache between a streamed chunk aren't overwritten by merges\n // of future stream items from already merged stream items.\n private streamPositions: Record<string, number> = {};\n\n handle(\n cacheData: TData | DeepPartial<TData> | null | undefined = this.data,\n chunk: GraphQL17Alpha9Handler.Chunk<TData>\n ): FormattedExecutionResult<TData> {\n this.hasNext = chunk.hasNext;\n this.data = cacheData;\n\n if (chunk.pending) {\n for (const pending of chunk.pending) {\n this.pending.set(pending.id, pending);\n\n if (\"data\" in chunk) {\n const dataAtPath = pending.path.reduce(\n (data, key) => (data as any)[key],\n chunk.data\n );\n\n if (Array.isArray(dataAtPath)) {\n this.streamPositions[pending.id] = dataAtPath.length;\n this.streamInfo.lookupArray(pending.path as any[]).current = {\n isFirstChunk: true,\n isLastChunk: false,\n };\n }\n }\n }\n }\n\n if (hasIncrementalChunks(chunk)) {\n for (const incremental of chunk.incremental) {\n const pending = this.pending.get(incremental.id);\n\n invariant(\n pending,\n \"Could not find pending chunk for incremental value. Please file an issue for the Apollo Client team to investigate.\"\n );\n\n const path = pending.path.concat(incremental.subPath ?? []);\n\n let data: any;\n if (\"items\" in incremental) {\n const items = incremental.items as any[];\n const parent: any[] = [];\n\n // This creates a sparse array with values set at the indices streamed\n // from the server. DeepMerger uses Object.keys and will correctly\n // place the values in this array in the correct place\n for (let i = 0; i < items.length; i++) {\n parent[i + this.streamPositions[pending.id]] = items[i];\n }\n\n this.streamPositions[pending.id] += items.length;\n this.streamInfo.lookupArray(path).current = {\n isFirstChunk: false,\n isLastChunk: false,\n };\n data = parent;\n } else {\n data = incremental.data;\n\n // Check if any pending streams added arrays from deferred data so\n // that we can update streamPositions with the initial length of the\n // array to ensure future streamed items are inserted at the right\n // starting index.\n this.pending.forEach((pendingItem) => {\n if (!(pendingItem.id in this.streamPositions)) {\n // Check if this incremental data contains array data for the pending path\n // The pending path is absolute, but incremental data is relative to the defer\n // E.g., pending.path = [\"nestedObject\"], pendingItem.path = [\"nestedObject\", \"nestedFriendList\"]\n // incremental.data = { scalarField: \"...\", nestedFriendList: [...] }\n // So we need the path from pending.path onwards\n const relativePath = pendingItem.path.slice(pending.path.length);\n const dataAtPath = relativePath.reduce(\n (data, key) => (data as any)?.[key],\n incremental.data\n );\n\n if (Array.isArray(dataAtPath)) {\n this.streamPositions[pendingItem.id] = dataAtPath.length;\n }\n }\n });\n }\n\n this.merge(\n {\n data,\n extensions: incremental.extensions,\n errors: incremental.errors,\n },\n path\n );\n }\n } else {\n this.merge(chunk);\n }\n\n if (\"completed\" in chunk && chunk.completed) {\n for (const completed of chunk.completed) {\n const { path } = this.pending.get(completed.id)!;\n const streamPosition = this.streamPositions[completed.id];\n\n // Truncate any stream arrays in case the chunk only contains `hasNext`\n // and `completed`.\n if (streamPosition !== undefined) {\n const dataAtPath = path.reduce(\n (data, key) => (data as any)?.[key],\n this.data\n );\n\n this.merge({ data: dataAtPath.slice(0, streamPosition) }, path);\n }\n\n // peek instead of lookup to avoid creating an entry for non-array values\n const details = this.streamInfo.peekArray(path as any[]);\n if (details) {\n details.current = {\n isFirstChunk: false,\n isLastChunk: true,\n };\n }\n this.pending.delete(completed.id);\n\n if (completed.errors) {\n this.errors.push(...completed.errors);\n }\n }\n }\n\n const result: FormattedExecutionResult<TData> = { data: this.data };\n\n if (isNonEmptyArray(this.errors)) {\n result.errors = this.errors;\n }\n\n if (Object.keys(this.extensions).length > 0) {\n result.extensions = this.extensions;\n }\n\n if (this.streamInfo[\"strong\"]) {\n result.extensions = {\n ...result.extensions,\n // Create a new object so we can check for === in QueryInfo to trigger a\n // final cache write when emitting a `hasNext: false` by itself.\n // We create a `WeakRef`, not a plain object to avoid retaining memory\n // in case the `result` or `extensions` stays around longer than the handler\n // itself.\n [streamInfoSymbol]: new WeakRef(this.streamInfo),\n } satisfies ExtensionsWithStreamInfo;\n }\n\n return result;\n }\n\n private merge(\n normalized: FormattedExecutionResult<TData>,\n atPath?: DeepMerger.MergeOptions[\"atPath\"]\n ) {\n if (normalized.data !== undefined) {\n this.data = new DeepMerger({ arrayMerge: \"truncate\" }).merge(\n this.data,\n normalized.data,\n { atPath }\n );\n }\n\n if (normalized.errors) {\n this.errors.push(...normalized.errors);\n }\n\n Object.assign(this.extensions, normalized.extensions);\n }\n}\n\n/**\n * Provides handling for the incremental delivery specification implemented by\n * graphql.js version `17.0.0-alpha.9`.\n */\nexport class GraphQL17Alpha9Handler\n implements Incremental.Handler<GraphQL17Alpha9Handler.Chunk<any>>\n{\n /** @internal */\n isIncrementalResult(\n result: ApolloLink.Result<any>\n ): result is\n | GraphQL17Alpha9Handler.InitialResult\n | GraphQL17Alpha9Handler.SubsequentResult {\n return \"hasNext\" in result;\n }\n\n /** @internal */\n prepareRequest(request: ApolloLink.Request): ApolloLink.Request {\n if (hasDirectives([\"defer\", \"stream\"], request.query)) {\n const context = request.context ?? {};\n const http = (context.http ??= {});\n // https://specs.apollo.dev/incremental/v0.2/\n http.accept = [\n \"multipart/mixed;incrementalSpec=v0.2\",\n ...(http.accept || []),\n ];\n\n request.context = context;\n }\n\n return request;\n }\n\n /** @internal */\n extractErrors(result: ApolloLink.Result<any>) {\n const acc: GraphQLFormattedError[] = [];\n const push = ({\n errors,\n }: {\n errors?: ReadonlyArray<GraphQLFormattedError>;\n }) => {\n if (errors) {\n acc.push(...errors);\n }\n };\n\n if (this.isIncrementalResult(result)) {\n if (\"errors\" in result) {\n push(result);\n }\n if (hasIncrementalChunks(result)) {\n result.incremental.forEach(push);\n }\n if (hasCompletedChunks(result)) {\n result.completed.forEach(push);\n }\n } else if (\"errors\" in result) {\n push(result);\n }\n\n if (acc.length) {\n return acc;\n }\n }\n\n /** @internal */\n startRequest<TData>(_: { query: DocumentNode }) {\n return new IncrementalRequest<TData>();\n }\n}\n\nfunction hasIncrementalChunks(\n result: Record<string, any>\n): result is Required<GraphQL17Alpha9Handler.SubsequentResult> {\n return isNonEmptyArray(result.incremental);\n}\n\nfunction hasCompletedChunks(\n result: Record<string, any>\n): result is Required<GraphQL17Alpha9Handler.SubsequentResult> {\n return isNonEmptyArray(result.completed);\n}\n"],"names":[],"mappings":"AAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAqB,CAArB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgC;AAahC,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EACL,CADF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA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wB,CAAC,CAAzB,CAAA,CAAA,CAAA,CAAA,CAA+B,CAAC,CAAhC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA2C,CAAC;AAC5C;AAEA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA2B,CACzB,CADF,CAAA,CAAA,CAAA,CAAA,CAC6B,EAD7B;IAGE,CAAF,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwB,CAAC,CAAzB,CAAA,CAAA,CAAA,CAAA,CAA+B,CAAC,CAAhC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAyC,CAAC;AAC1C;"}
|
|
1
|
+
{"version":3,"file":"graphql17Alpha9.js","sources":["../../../src/incremental/handlers/graphql17Alpha9.ts"],"sourcesContent":["import type { FormattedExecutionResult, GraphQLFormattedError } from \"graphql\";\n\nimport type { ApolloLink } from \"@apollo/client/link\";\nimport type { DeepPartial, HKT } from \"@apollo/client/utilities\";\nimport type { ExtensionsWithStreamInfo } from \"@apollo/client/utilities/internal\";\nimport {\n DeepMerger,\n makeStreamInfoTrie,\n streamInfoSymbol,\n} from \"@apollo/client/utilities/internal\";\nimport {\n hasDirectives,\n isNonEmptyArray,\n} from \"@apollo/client/utilities/internal\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nimport type { Incremental } from \"../types.js\";\n\nexport declare namespace GraphQL17Alpha9Handler {\n interface GraphQL17Alpha9Result extends HKT {\n arg1: unknown; // TData\n arg2: unknown; // TExtensions\n return: GraphQL17Alpha9Handler.Chunk<Record<string, unknown>>;\n }\n\n export interface TypeOverrides {\n AdditionalApolloLinkResultTypes: GraphQL17Alpha9Result;\n }\n\n export type InitialResult<TData = Record<string, unknown>> = {\n data: TData;\n errors?: ReadonlyArray<GraphQLFormattedError>;\n pending: ReadonlyArray<PendingResult>;\n hasNext: boolean;\n extensions?: Record<string, unknown>;\n };\n\n export type SubsequentResult<TData = unknown> = {\n hasNext: boolean;\n pending?: ReadonlyArray<PendingResult>;\n incremental?: ReadonlyArray<IncrementalResult<TData>>;\n completed?: ReadonlyArray<CompletedResult>;\n extensions?: Record<string, unknown>;\n };\n\n export interface PendingResult {\n id: string;\n path: Incremental.Path;\n label?: string;\n }\n\n export interface CompletedResult {\n id: string;\n errors?: ReadonlyArray<GraphQLFormattedError>;\n }\n\n export interface IncrementalDeferResult<TData = Record<string, unknown>> {\n errors?: ReadonlyArray<GraphQLFormattedError>;\n data: TData;\n id: string;\n subPath?: Incremental.Path;\n extensions?: Record<string, unknown>;\n }\n\n export interface IncrementalStreamResult<TData = ReadonlyArray<unknown>> {\n errors?: ReadonlyArray<GraphQLFormattedError>;\n items: TData;\n id: string;\n subPath?: Incremental.Path;\n extensions?: Record<string, unknown>;\n }\n\n export type IncrementalResult<TData = unknown> =\n | IncrementalDeferResult<TData>\n | IncrementalStreamResult<TData>;\n\n export type Chunk<TData> = InitialResult<TData> | SubsequentResult<TData>;\n}\n\nclass IncrementalRequest<TData>\n implements\n Incremental.IncrementalRequest<GraphQL17Alpha9Handler.Chunk<TData>, TData>\n{\n hasNext = true;\n\n private data: any = {};\n private errors: GraphQLFormattedError[] = [];\n private extensions: Record<string, any> = {};\n private pendingMap = new Map<string, GraphQL17Alpha9Handler.PendingResult>();\n private streamInfo = makeStreamInfoTrie();\n // `streamPositions` maps `pending.id` to the index that should be set by the\n // next `incremental` stream chunk to ensure the streamed array item is placed\n // at the correct point in the data array. `this.data` contains cached\n // references with the full array so we can't rely on the array length in\n // `this.data` to determine where to place item. This also ensures that items\n // updated by the cache between a streamed chunk aren't overwritten by merges\n // of future stream items from already merged stream items.\n private streamPositions: Record<string, number> = {};\n\n get pending() {\n return Array.from(this.pendingMap.values());\n }\n\n getPendingType(id: string): \"defer\" | \"stream\" {\n return id in this.streamPositions ? \"stream\" : \"defer\";\n }\n\n handle(\n cacheData: TData | DeepPartial<TData> | null | undefined = this.data,\n chunk: GraphQL17Alpha9Handler.Chunk<TData>\n ): FormattedExecutionResult<TData> {\n this.hasNext = chunk.hasNext;\n this.data = cacheData;\n\n if (chunk.pending) {\n for (const pending of chunk.pending) {\n this.pendingMap.set(pending.id, pending);\n\n if (\"data\" in chunk) {\n const dataAtPath = pending.path.reduce(\n (data, key) => (data as any)[key],\n chunk.data\n );\n\n if (Array.isArray(dataAtPath)) {\n this.streamPositions[pending.id] = dataAtPath.length;\n const entry = this.streamInfo.lookupArray(pending.path as any[]);\n entry.current = {\n isFirstChunk: true,\n isLastChunk: false,\n };\n entry.state.streamPosition = dataAtPath.length;\n }\n }\n }\n }\n\n if (hasIncrementalChunks(chunk)) {\n for (const incremental of chunk.incremental) {\n const pending = this.pendingMap.get(incremental.id);\n\n invariant(\n pending,\n \"Could not find pending chunk for incremental value. Please file an issue for the Apollo Client team to investigate.\"\n );\n\n const path = pending.path.concat(incremental.subPath ?? []);\n\n let data: any;\n if (\"items\" in incremental) {\n const items = incremental.items as any[];\n const parent: any[] = [];\n\n // This creates a sparse array with values set at the indices streamed\n // from the server. DeepMerger uses Object.keys and will correctly\n // place the values in this array in the correct place\n for (let i = 0; i < items.length; i++) {\n parent[i + this.streamPositions[pending.id]] = items[i];\n }\n\n this.streamPositions[pending.id] += items.length;\n const entry = this.streamInfo.lookupArray(path);\n entry.current = {\n isFirstChunk: false,\n isLastChunk: false,\n };\n entry.state.streamPosition = this.streamPositions[pending.id];\n\n data = parent;\n } else {\n data = incremental.data;\n\n // Check if any pending streams added arrays from deferred data so\n // that we can update streamPositions with the initial length of the\n // array to ensure future streamed items are inserted at the right\n // starting index.\n this.pendingMap.forEach((pendingItem) => {\n if (!(pendingItem.id in this.streamPositions)) {\n // Check if this incremental data contains array data for the pending path\n // The pending path is absolute, but incremental data is relative to the defer\n // E.g., pending.path = [\"nestedObject\"], pendingItem.path = [\"nestedObject\", \"nestedFriendList\"]\n // incremental.data = { scalarField: \"...\", nestedFriendList: [...] }\n // So we need the path from pending.path onwards\n const relativePath = pendingItem.path.slice(pending.path.length);\n const dataAtPath = relativePath.reduce(\n (data, key) => (data as any)?.[key],\n incremental.data\n );\n\n if (Array.isArray(dataAtPath)) {\n this.streamPositions[pendingItem.id] = dataAtPath.length;\n }\n }\n });\n }\n\n this.merge(\n {\n data,\n extensions: incremental.extensions,\n errors: incremental.errors,\n },\n path\n );\n }\n } else {\n this.merge(chunk);\n }\n\n if (\"completed\" in chunk && chunk.completed) {\n for (const completed of chunk.completed) {\n const { path } = this.pendingMap.get(completed.id)!;\n const streamPosition = this.streamPositions[completed.id];\n\n // Truncate any stream arrays in case the chunk only contains `hasNext`\n // and `completed`.\n if (streamPosition !== undefined) {\n const dataAtPath = path.reduce(\n (data, key) => (data as any)?.[key],\n this.data\n );\n\n this.merge({ data: dataAtPath.slice(0, streamPosition) }, path);\n }\n\n // peek instead of lookup to avoid creating an entry for non-array values\n const details = this.streamInfo.peekArray(path as any[]);\n if (details) {\n details.current = {\n isFirstChunk: false,\n isLastChunk: true,\n };\n details.state.streamPosition = streamPosition;\n }\n this.pendingMap.delete(completed.id);\n\n if (completed.errors) {\n this.errors.push(...completed.errors);\n }\n }\n }\n\n const result: FormattedExecutionResult<TData> = { data: this.data };\n\n if (isNonEmptyArray(this.errors)) {\n result.errors = this.errors;\n }\n\n if (Object.keys(this.extensions).length > 0) {\n result.extensions = this.extensions;\n }\n\n if (this.streamInfo[\"strong\"]) {\n result.extensions = {\n ...result.extensions,\n // Create a new object so we can check for === in QueryInfo to trigger a\n // final cache write when emitting a `hasNext: false` by itself.\n // We create a `WeakRef`, not a plain object to avoid retaining memory\n // in case the `result` or `extensions` stays around longer than the handler\n // itself.\n [streamInfoSymbol]: new WeakRef(this.streamInfo),\n } satisfies ExtensionsWithStreamInfo;\n }\n\n return result;\n }\n\n private merge(\n normalized: FormattedExecutionResult<TData>,\n atPath?: DeepMerger.MergeOptions[\"atPath\"]\n ) {\n if (normalized.data !== undefined) {\n this.data = new DeepMerger({ arrayMerge: \"truncate\" }).merge(\n this.data,\n normalized.data,\n { atPath }\n );\n }\n\n if (normalized.errors) {\n this.errors.push(...normalized.errors);\n }\n\n Object.assign(this.extensions, normalized.extensions);\n }\n}\n\n/**\n * Provides handling for the incremental delivery specification implemented by\n * graphql.js version `17.0.0-alpha.9`.\n */\nexport class GraphQL17Alpha9Handler\n implements Incremental.Handler<GraphQL17Alpha9Handler.Chunk<any>>\n{\n /** @internal */\n isIncrementalResult(\n result: ApolloLink.Result<any>\n ): result is\n | GraphQL17Alpha9Handler.InitialResult\n | GraphQL17Alpha9Handler.SubsequentResult {\n return \"hasNext\" in result;\n }\n\n /** @internal */\n prepareRequest(request: ApolloLink.Request): ApolloLink.Request {\n if (hasDirectives([\"defer\", \"stream\"], request.query)) {\n const context = request.context ?? {};\n const http = (context.http ??= {});\n // https://specs.apollo.dev/incremental/v0.2/\n http.accept = [\n \"multipart/mixed;incrementalSpec=v0.2\",\n ...(http.accept || []),\n ];\n\n request.context = context;\n }\n\n return request;\n }\n\n /** @internal */\n extractErrors(result: ApolloLink.Result<any>) {\n const acc: GraphQLFormattedError[] = [];\n const push = ({\n errors,\n }: {\n errors?: ReadonlyArray<GraphQLFormattedError>;\n }) => {\n if (errors) {\n acc.push(...errors);\n }\n };\n\n if (this.isIncrementalResult(result)) {\n if (\"errors\" in result) {\n push(result);\n }\n if (hasIncrementalChunks(result)) {\n result.incremental.forEach(push);\n }\n if (hasCompletedChunks(result)) {\n result.completed.forEach(push);\n }\n } else if (\"errors\" in result) {\n push(result);\n }\n\n if (acc.length) {\n return acc;\n }\n }\n\n /** @internal */\n startRequest<TData>(_: Incremental.StartRequestOptions) {\n return new IncrementalRequest<TData>();\n }\n}\n\nfunction hasIncrementalChunks(\n result: Record<string, any>\n): result is Required<GraphQL17Alpha9Handler.SubsequentResult> {\n return isNonEmptyArray(result.incremental);\n}\n\nfunction hasCompletedChunks(\n result: Record<string, any>\n): result is Required<GraphQL17Alpha9Handler.SubsequentResult> {\n return isNonEmptyArray(result.completed);\n}\n"],"names":[],"mappings":"AAKA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EACL,CADF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACY,EACV,CAFF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAEoB,EAClB,CAHF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAGkB,EAHlB,EAAA,CAAA,CAAA,CAAA,EAIO,CAJP,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAI0C;AAC1C,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EACL,CADF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACe,EACb,CAFF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAEiB,EAFjB,EAAA,CAAA,CAAA,CAAA,EAGO,CAHP,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAG0C;AAC1C,CAAA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,CAC6B,EAD7B;IAGE,CAAF,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwB,CAAC,CAAzB,CAAA,CAAA,CAAA,CAAA,CAA+B,CAAC,CAAhC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAyC,CAAC;AAC1C;"}
|
package/incremental/types.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ import type { ApolloLink } from "@apollo/client/link";
|
|
|
3
3
|
import type { DeepPartial } from "@apollo/client/utilities";
|
|
4
4
|
export declare namespace Incremental {
|
|
5
5
|
type Path = ReadonlyArray<string | number>;
|
|
6
|
+
interface PendingResult {
|
|
7
|
+
id: string;
|
|
8
|
+
path: Incremental.Path;
|
|
9
|
+
label?: string;
|
|
10
|
+
}
|
|
6
11
|
/**
|
|
7
12
|
* @internal
|
|
8
13
|
*
|
|
@@ -12,12 +17,20 @@ export declare namespace Incremental {
|
|
|
12
17
|
isIncrementalResult: (result: ApolloLink.Result<any>) => result is Chunk;
|
|
13
18
|
prepareRequest: (request: ApolloLink.Request) => ApolloLink.Request;
|
|
14
19
|
extractErrors: (result: ApolloLink.Result<any>) => readonly GraphQLFormattedError[] | undefined | void;
|
|
15
|
-
startRequest: <TData extends Record<string, unknown>>(request:
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
startRequest: <TData extends Record<string, unknown>>(request: Incremental.StartRequestOptions) => IncrementalRequest<Chunk, TData>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
*
|
|
25
|
+
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
26
|
+
*/
|
|
27
|
+
interface StartRequestOptions {
|
|
28
|
+
query: DocumentNode;
|
|
18
29
|
}
|
|
19
30
|
interface IncrementalRequest<Chunk extends Record<string, unknown>, TData> {
|
|
20
31
|
hasNext: boolean;
|
|
32
|
+
pending?: Array<Incremental.PendingResult>;
|
|
33
|
+
getPendingType?: (id: string) => "defer" | "stream";
|
|
21
34
|
handle: (cacheData: TData | DeepPartial<TData> | undefined | null, chunk: Chunk) => FormattedExecutionResult<TData>;
|
|
22
35
|
}
|
|
23
36
|
/**
|
package/incremental/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/incremental/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DocumentNode,\n FormattedExecutionResult,\n GraphQLFormattedError,\n} from \"graphql\";\n\nimport type { ApolloLink } from \"@apollo/client/link\";\nimport type { DeepPartial } from \"@apollo/client/utilities\";\n\nexport declare namespace Incremental {\n export type Path = ReadonlyArray<string | number>;\n\n /** @internal */\n export interface Handler<\n Chunk extends Record<string, unknown> = Record<string, unknown>,\n > {\n isIncrementalResult: (result: ApolloLink.Result<any>) => result is Chunk;\n prepareRequest: (request: ApolloLink.Request) => ApolloLink.Request;\n extractErrors: (\n result: ApolloLink.Result<any>\n ) => readonly GraphQLFormattedError[] | undefined | void;\n startRequest: <TData extends Record<string, unknown>>(
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/incremental/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DocumentNode,\n FormattedExecutionResult,\n GraphQLFormattedError,\n} from \"graphql\";\n\nimport type { ApolloLink } from \"@apollo/client/link\";\nimport type { DeepPartial } from \"@apollo/client/utilities\";\n\nexport declare namespace Incremental {\n export type Path = ReadonlyArray<string | number>;\n\n export interface PendingResult {\n id: string;\n path: Incremental.Path;\n label?: string;\n }\n\n /** @internal */\n export interface Handler<\n Chunk extends Record<string, unknown> = Record<string, unknown>,\n > {\n isIncrementalResult: (result: ApolloLink.Result<any>) => result is Chunk;\n prepareRequest: (request: ApolloLink.Request) => ApolloLink.Request;\n extractErrors: (\n result: ApolloLink.Result<any>\n ) => readonly GraphQLFormattedError[] | undefined | void;\n startRequest: <TData extends Record<string, unknown>>(\n request: Incremental.StartRequestOptions\n ) => IncrementalRequest<Chunk, TData>;\n }\n\n /** @internal */\n export interface StartRequestOptions {\n query: DocumentNode;\n }\n\n export interface IncrementalRequest<\n Chunk extends Record<string, unknown>,\n TData,\n > {\n hasNext: boolean;\n pending?: Array<Incremental.PendingResult>;\n getPendingType?: (id: string) => \"defer\" | \"stream\";\n handle: (\n cacheData: TData | DeepPartial<TData> | undefined | null,\n chunk: Chunk\n ) => FormattedExecutionResult<TData>;\n }\n\n /** @internal */\n export interface StreamFieldInfo {\n isFirstChunk: boolean;\n isLastChunk: boolean;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -236,11 +236,45 @@ export interface CacheSizes {
|
|
|
236
236
|
* recommended to set this to a high value.
|
|
237
237
|
*/
|
|
238
238
|
"inMemoryCache.executeSubSelectedArray": number;
|
|
239
|
+
/**
|
|
240
|
+
* Cache size for the `prunePartialBoundaries` method on [`StoreReader`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/readFromStore.ts).
|
|
241
|
+
*
|
|
242
|
+
* @defaultValue
|
|
243
|
+
* Defaults to `20000`.
|
|
244
|
+
*
|
|
245
|
+
* @remarks
|
|
246
|
+
* Every object that is read from the cache for `@defer` and `@stream`
|
|
247
|
+
* queries will be cached here, so it is recommended to set this to a
|
|
248
|
+
* relatively high value.
|
|
249
|
+
*/
|
|
250
|
+
"inMemoryCache.prunePartialBoundaries": number;
|
|
251
|
+
/**
|
|
252
|
+
* Cache size for the `prunePartialStreamArray` method on [`StoreReader`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/readFromStore.ts).
|
|
253
|
+
*
|
|
254
|
+
* @defaultValue
|
|
255
|
+
* Defaults to `20000`.
|
|
256
|
+
*
|
|
257
|
+
* @remarks
|
|
258
|
+
* Every array that is read from the cache for `@defer` and `@stream`
|
|
259
|
+
* queries will be cached here, so it is recommended to set this to a
|
|
260
|
+
* relatively high value.
|
|
261
|
+
*/
|
|
262
|
+
"inMemoryCache.prunePartialStreamArray": number;
|
|
239
263
|
/**
|
|
240
264
|
* Used by the internal `checkDocument` that traverses GraphQL documents and throws an error if the document is invalid.
|
|
241
265
|
* if they are not valid.
|
|
242
266
|
*/
|
|
243
267
|
checkDocument: number;
|
|
268
|
+
/**
|
|
269
|
+
* Used by the internal `isDeferredFragment` utility that determines whether a
|
|
270
|
+
* fragment selection node is a deferred fragment.
|
|
271
|
+
*/
|
|
272
|
+
isDeferredFragment: number;
|
|
273
|
+
/**
|
|
274
|
+
* Used by the internal `isStreamField` utility that determines whether a
|
|
275
|
+
* field selection node is a streamed field.
|
|
276
|
+
*/
|
|
277
|
+
isStreamField: number;
|
|
244
278
|
}
|
|
245
279
|
declare const cacheSizeSymbol: unique symbol;
|
|
246
280
|
/**
|
|
@@ -268,6 +302,8 @@ declare const cacheSizeSymbol: unique symbol;
|
|
|
268
302
|
export declare const cacheSizes: Partial<CacheSizes>;
|
|
269
303
|
export declare const enum defaultCacheSizes {
|
|
270
304
|
checkDocument = 2000,
|
|
305
|
+
isDeferredFragment = 2000,
|
|
306
|
+
isStreamField = 2000,
|
|
271
307
|
canonicalStringify = 1000,
|
|
272
308
|
print = 2000,
|
|
273
309
|
"documentTransform.cache" = 2000,
|
|
@@ -280,7 +316,9 @@ export declare const enum defaultCacheSizes {
|
|
|
280
316
|
"removeTypenameFromVariables.getVariableDefinitions" = 2000,
|
|
281
317
|
"inMemoryCache.maybeBroadcastWatch" = 5000,
|
|
282
318
|
"inMemoryCache.executeSelectionSet" = 50000,
|
|
283
|
-
"inMemoryCache.executeSubSelectedArray" = 10000
|
|
319
|
+
"inMemoryCache.executeSubSelectedArray" = 10000,
|
|
320
|
+
"inMemoryCache.prunePartialBoundaries" = 20000,
|
|
321
|
+
"inMemoryCache.prunePartialStreamArray" = 20000
|
|
284
322
|
}
|
|
285
323
|
export {};
|
|
286
324
|
//# sourceMappingURL=sizes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sizes.js","sourceRoot":"","sources":["../../../src/utilities/caching/sizes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AA6PnE,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AACvD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAwB,EAAE,GAAG,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC","sourcesContent":["import { global } from \"@apollo/client/utilities/internal/globals\";\n\ndeclare global {\n interface Window {\n [cacheSizeSymbol]?: Partial<CacheSizes>;\n }\n}\n\n/**\n * The cache sizes used by various Apollo Client caches.\n *\n * @remarks\n * All configurable caches hold memoized values. If an item is\n * cache-collected, it incurs only a small performance impact and\n * doesn't cause data loss. A smaller cache size might save you memory.\n *\n * You should choose cache sizes appropriate for storing a reasonable\n * number of values rather than every value. To prevent too much recalculation,\n * choose cache sizes that are at least large enough to hold memoized values for\n * all hooks/queries on the screen at any given time.\n */\n/*\n * We assume a \"base value\" of 1000 here, which is already very generous.\n * In most applications, it will be very unlikely that 1000 different queries\n * are on screen at the same time.\n */\nexport interface CacheSizes {\n /**\n * Cache size for the [`print`](https://github.com/apollographql/apollo-client/blob/main/src/utilities/graphql/print.ts) function.\n *\n * It is called with transformed `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `2000`.\n *\n * @remarks\n * This method is called to transform a GraphQL query AST parsed by `gql`\n * back into a GraphQL string.\n *\n * @privateRemarks\n * This method is called from the `QueryManager` and various `ApolloLink`s,\n * always with the \"serverQuery\", so the server-facing part of a transformed\n * `DocumentNode`.\n */\n print: number;\n /**\n * Cache size for the cache of [`DocumentTransform`](https://github.com/apollographql/apollo-client/blob/main/src/utilities/graphql/DocumentTransform.ts)\n * instances with the `cache` option set to `true`.\n *\n * Can be called with user-defined or already-transformed `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `2000`.\n *\n * @remarks\n * The cache size here should be chosen with other `DocumentTransform`s in mind.\n * For example, if there was a `DocumentTransform` that would take `x` `DocumentNode`s,\n * and returned a differently-transformed `DocumentNode` depending if the app is\n * online or offline, then we assume that the cache returns `2*x` documents.\n * If that were concatenated with another `DocumentTransform` that would\n * also duplicate the cache size, you'd need to account for `4*x` documents\n * returned by the second transform.\n *\n * Due to an implementation detail of Apollo Client, if you use custom document\n * transforms you should always add `n` (the \"base\" number of user-provided\n * Documents) to the resulting cache size.\n *\n * If we assume that the user-provided transforms receive `n` documents and\n * return `n` documents, the cache size should be `2*n`.\n *\n * If we assume that the chain of user-provided transforms receive `n` documents and\n * return `4*n` documents, the cache size should be `5*n`.\n *\n * This size should also then be used in every other cache that mentions that\n * it operates on a \"transformed\" `DocumentNode`.\n *\n * @privateRemarks\n * Cache size for the `performWork` method of each [`DocumentTransform`](https://github.com/apollographql/apollo-client/blob/main/src/utilities/graphql/DocumentTransform.ts).\n *\n * No user-provided DocumentNode will actually be \"the last one\", as we run the\n * `defaultDocumentTransform` before _and_ after the user-provided transforms.\n * For that reason, we need the extra `n` here - `n` for \"before transformation\"\n * plus the actual maximum cache size of the user-provided transform chain.\n *\n * This method is called from `transformDocument`, which is called from\n * `QueryManager` with a user-provided DocumentNode.\n * It is also called with already-transformed DocumentNodes, assuming the\n * user provided additional transforms.\n */\n \"documentTransform.cache\": number;\n /**\n * A cache inside of [`QueryManager`](https://github.com/apollographql/apollo-client/blob/main/src/core/QueryManager.ts).\n *\n * It is called with transformed `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `2000`.\n *\n * @privateRemarks\n * Cache size for the `transformCache` used in the `getDocumentInfo` method of `QueryManager`.\n * Called throughout the `QueryManager` with transformed DocumentNodes.\n */\n \"queryManager.getDocumentInfo\": number;\n /**\n * A cache inside of [`PersistedQueryLink`](https://github.com/apollographql/apollo-client/blob/main/src/link/persisted-queries/index.ts).\n *\n * It is called with transformed `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `2000`.\n *\n * @remarks\n * This cache is used to cache the hashes of persisted queries.\n *\n * @privateRemarks\n * Cache size for the `hashesByQuery` cache in the `PersistedQueryLink`.\n */\n \"PersistedQueryLink.persistedQueryHashes\": number;\n /**\n * Cache used by [`canonicalStringify`](https://github.com/apollographql/apollo-client/blob/main/src/utilities/common/canonicalStringify.ts).\n *\n * @defaultValue\n * Defaults to `1000`.\n *\n * @remarks\n * This cache contains the sorted keys of objects that are stringified by\n * `canonicalStringify`.\n * It uses the stringified unsorted keys of objects as keys.\n * The cache will not grow beyond the size of different object **shapes**\n * encountered in an application, no matter how much actual data gets stringified.\n *\n * @privateRemarks\n * Cache size for the `sortingMap` in `canonicalStringify`.\n */\n canonicalStringify: number;\n /**\n * A cache inside of [`FragmentRegistry`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/fragmentRegistry.ts).\n *\n * Can be called with user-defined or already-transformed `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `2000`.\n *\n * @privateRemarks\n *\n * Cache size for the `transform` method of FragmentRegistry.\n * This function is called as part of the `defaultDocumentTransform` which will be called with\n * user-provided and already-transformed DocumentNodes.\n */\n \"fragmentRegistry.transform\": number;\n /**\n * A cache inside of [`FragmentRegistry`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/fragmentRegistry.ts).\n *\n * This function is called with fragment names in the form of a string.\n *\n * @defaultValue\n * Defaults to `1000`.\n *\n * @remarks\n * The size of this case should be chosen with the number of fragments in\n * your application in mind.\n *\n * Note:\n * This function is a dependency of `fragmentRegistry.transform`, so having too small of a cache size here\n * might involuntarily invalidate values in the `transform` cache.\n *\n * @privateRemarks\n * Cache size for the `lookup` method of FragmentRegistry.\n */\n \"fragmentRegistry.lookup\": number;\n /**\n * Cache size for the `findFragmentSpreads` method of [`FragmentRegistry`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/fragmentRegistry.ts).\n *\n * This function is called with transformed `DocumentNode`s, as well as recursively\n * with every fragment spread referenced within that, or a fragment referenced by a\n * fragment spread.\n *\n * @defaultValue\n * Defaults to `4000`.\n *\n * @remarks\n *\n * Note: This function is a dependency of `fragmentRegistry.transform`, so having too small of cache size here\n * might involuntarily invalidate values in the `transform` cache.\n */\n \"fragmentRegistry.findFragmentSpreads\": number;\n /**\n * Cache size for the `getFragmentDoc` method of [`ApolloCache`](https://github.com/apollographql/apollo-client/blob/main/src/cache/core/cache.ts).\n *\n * This function is called with user-provided fragment definitions.\n *\n * @defaultValue\n * Defaults to `1000`.\n *\n * @remarks\n * This function is called from `readFragment` with user-provided fragment definitions.\n */\n \"cache.fragmentQueryDocuments\": number;\n /**\n * Cache used in [`removeTypenameFromVariables`](https://github.com/apollographql/apollo-client/blob/main/src/link/remove-typename/removeTypenameFromVariables.ts).\n *\n * This function is called transformed `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `2000`.\n *\n * @privateRemarks\n * Cache size for the `getVariableDefinitions` function of `removeTypenameFromVariables`.\n */\n \"removeTypenameFromVariables.getVariableDefinitions\": number;\n /**\n * Cache size for the `maybeBroadcastWatch` method on [`InMemoryCache`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/inMemoryCache.ts).\n *\n * @defaultValue\n * Defaults to `5000`.\n *\n * @remarks\n * This method is used for dependency tracking in the `InMemoryCache` and\n * prevents from unnecessary re-renders.\n * It is recommended to keep this value significantly higher than the number of\n * possible subscribers you will have active at the same time in your application\n * at any time.\n */\n \"inMemoryCache.maybeBroadcastWatch\": number;\n /**\n * Cache size for the `executeSelectionSet` method on [`StoreReader`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/readFromStore.ts).\n *\n * @defaultValue\n * Defaults to `50000`.\n *\n * @remarks\n * Every object that is read from the cache will be cached here, so it is\n * recommended to set this to a high value.\n */\n \"inMemoryCache.executeSelectionSet\": number;\n /**\n * Cache size for the `executeSubSelectedArray` method on [`StoreReader`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/readFromStore.ts).\n *\n * @defaultValue\n * Defaults to `10000`.\n *\n * @remarks\n * Every array that is read from the cache will be cached here, so it is\n * recommended to set this to a high value.\n */\n \"inMemoryCache.executeSubSelectedArray\": number;\n /**\n * Used by the internal `checkDocument` that traverses GraphQL documents and throws an error if the document is invalid.\n * if they are not valid.\n */\n checkDocument: number;\n}\n\nconst cacheSizeSymbol = Symbol.for(\"apollo.cacheSize\");\n/**\n * The global cache size configuration for Apollo Client.\n *\n * @remarks\n *\n * You can directly modify this object, but any modification will\n * only have an effect on caches that are created after the modification.\n *\n * So for global caches, such as `canonicalStringify` and `print`,\n * you might need to call `.reset` on them, which will essentially re-create them.\n *\n * Alternatively, you can set `globalThis[Symbol.for(\"apollo.cacheSize\")]` before\n * you load the Apollo Client package:\n *\n * @example\n *\n * ```ts\n * globalThis[Symbol.for(\"apollo.cacheSize\")] = {\n * print: 100,\n * } satisfies Partial<CacheSizes>; // the `satisfies` is optional if using TypeScript\n * ```\n */\nexport const cacheSizes: Partial<CacheSizes> = { ...global[cacheSizeSymbol] };\n\nexport const enum defaultCacheSizes {\n checkDocument = 2000,\n canonicalStringify = 1000,\n print = 2000,\n \"documentTransform.cache\" = 2000,\n \"queryManager.getDocumentInfo\" = 2000,\n \"PersistedQueryLink.persistedQueryHashes\" = 2000,\n \"fragmentRegistry.transform\" = 2000,\n \"fragmentRegistry.lookup\" = 1000,\n \"fragmentRegistry.findFragmentSpreads\" = 4000,\n \"cache.fragmentQueryDocuments\" = 1000,\n \"removeTypenameFromVariables.getVariableDefinitions\" = 2000,\n \"inMemoryCache.maybeBroadcastWatch\" = 5000,\n \"inMemoryCache.executeSelectionSet\" = 50000,\n \"inMemoryCache.executeSubSelectedArray\" = 10000,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sizes.js","sourceRoot":"","sources":["../../../src/utilities/caching/sizes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAiSnE,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AACvD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAwB,EAAE,GAAG,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC","sourcesContent":["import { global } from \"@apollo/client/utilities/internal/globals\";\n\ndeclare global {\n interface Window {\n [cacheSizeSymbol]?: Partial<CacheSizes>;\n }\n}\n\n/**\n * The cache sizes used by various Apollo Client caches.\n *\n * @remarks\n * All configurable caches hold memoized values. If an item is\n * cache-collected, it incurs only a small performance impact and\n * doesn't cause data loss. A smaller cache size might save you memory.\n *\n * You should choose cache sizes appropriate for storing a reasonable\n * number of values rather than every value. To prevent too much recalculation,\n * choose cache sizes that are at least large enough to hold memoized values for\n * all hooks/queries on the screen at any given time.\n */\n/*\n * We assume a \"base value\" of 1000 here, which is already very generous.\n * In most applications, it will be very unlikely that 1000 different queries\n * are on screen at the same time.\n */\nexport interface CacheSizes {\n /**\n * Cache size for the [`print`](https://github.com/apollographql/apollo-client/blob/main/src/utilities/graphql/print.ts) function.\n *\n * It is called with transformed `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `2000`.\n *\n * @remarks\n * This method is called to transform a GraphQL query AST parsed by `gql`\n * back into a GraphQL string.\n *\n * @privateRemarks\n * This method is called from the `QueryManager` and various `ApolloLink`s,\n * always with the \"serverQuery\", so the server-facing part of a transformed\n * `DocumentNode`.\n */\n print: number;\n /**\n * Cache size for the cache of [`DocumentTransform`](https://github.com/apollographql/apollo-client/blob/main/src/utilities/graphql/DocumentTransform.ts)\n * instances with the `cache` option set to `true`.\n *\n * Can be called with user-defined or already-transformed `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `2000`.\n *\n * @remarks\n * The cache size here should be chosen with other `DocumentTransform`s in mind.\n * For example, if there was a `DocumentTransform` that would take `x` `DocumentNode`s,\n * and returned a differently-transformed `DocumentNode` depending if the app is\n * online or offline, then we assume that the cache returns `2*x` documents.\n * If that were concatenated with another `DocumentTransform` that would\n * also duplicate the cache size, you'd need to account for `4*x` documents\n * returned by the second transform.\n *\n * Due to an implementation detail of Apollo Client, if you use custom document\n * transforms you should always add `n` (the \"base\" number of user-provided\n * Documents) to the resulting cache size.\n *\n * If we assume that the user-provided transforms receive `n` documents and\n * return `n` documents, the cache size should be `2*n`.\n *\n * If we assume that the chain of user-provided transforms receive `n` documents and\n * return `4*n` documents, the cache size should be `5*n`.\n *\n * This size should also then be used in every other cache that mentions that\n * it operates on a \"transformed\" `DocumentNode`.\n *\n * @privateRemarks\n * Cache size for the `performWork` method of each [`DocumentTransform`](https://github.com/apollographql/apollo-client/blob/main/src/utilities/graphql/DocumentTransform.ts).\n *\n * No user-provided DocumentNode will actually be \"the last one\", as we run the\n * `defaultDocumentTransform` before _and_ after the user-provided transforms.\n * For that reason, we need the extra `n` here - `n` for \"before transformation\"\n * plus the actual maximum cache size of the user-provided transform chain.\n *\n * This method is called from `transformDocument`, which is called from\n * `QueryManager` with a user-provided DocumentNode.\n * It is also called with already-transformed DocumentNodes, assuming the\n * user provided additional transforms.\n */\n \"documentTransform.cache\": number;\n /**\n * A cache inside of [`QueryManager`](https://github.com/apollographql/apollo-client/blob/main/src/core/QueryManager.ts).\n *\n * It is called with transformed `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `2000`.\n *\n * @privateRemarks\n * Cache size for the `transformCache` used in the `getDocumentInfo` method of `QueryManager`.\n * Called throughout the `QueryManager` with transformed DocumentNodes.\n */\n \"queryManager.getDocumentInfo\": number;\n /**\n * A cache inside of [`PersistedQueryLink`](https://github.com/apollographql/apollo-client/blob/main/src/link/persisted-queries/index.ts).\n *\n * It is called with transformed `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `2000`.\n *\n * @remarks\n * This cache is used to cache the hashes of persisted queries.\n *\n * @privateRemarks\n * Cache size for the `hashesByQuery` cache in the `PersistedQueryLink`.\n */\n \"PersistedQueryLink.persistedQueryHashes\": number;\n /**\n * Cache used by [`canonicalStringify`](https://github.com/apollographql/apollo-client/blob/main/src/utilities/common/canonicalStringify.ts).\n *\n * @defaultValue\n * Defaults to `1000`.\n *\n * @remarks\n * This cache contains the sorted keys of objects that are stringified by\n * `canonicalStringify`.\n * It uses the stringified unsorted keys of objects as keys.\n * The cache will not grow beyond the size of different object **shapes**\n * encountered in an application, no matter how much actual data gets stringified.\n *\n * @privateRemarks\n * Cache size for the `sortingMap` in `canonicalStringify`.\n */\n canonicalStringify: number;\n /**\n * A cache inside of [`FragmentRegistry`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/fragmentRegistry.ts).\n *\n * Can be called with user-defined or already-transformed `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `2000`.\n *\n * @privateRemarks\n *\n * Cache size for the `transform` method of FragmentRegistry.\n * This function is called as part of the `defaultDocumentTransform` which will be called with\n * user-provided and already-transformed DocumentNodes.\n */\n \"fragmentRegistry.transform\": number;\n /**\n * A cache inside of [`FragmentRegistry`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/fragmentRegistry.ts).\n *\n * This function is called with fragment names in the form of a string.\n *\n * @defaultValue\n * Defaults to `1000`.\n *\n * @remarks\n * The size of this case should be chosen with the number of fragments in\n * your application in mind.\n *\n * Note:\n * This function is a dependency of `fragmentRegistry.transform`, so having too small of a cache size here\n * might involuntarily invalidate values in the `transform` cache.\n *\n * @privateRemarks\n * Cache size for the `lookup` method of FragmentRegistry.\n */\n \"fragmentRegistry.lookup\": number;\n /**\n * Cache size for the `findFragmentSpreads` method of [`FragmentRegistry`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/fragmentRegistry.ts).\n *\n * This function is called with transformed `DocumentNode`s, as well as recursively\n * with every fragment spread referenced within that, or a fragment referenced by a\n * fragment spread.\n *\n * @defaultValue\n * Defaults to `4000`.\n *\n * @remarks\n *\n * Note: This function is a dependency of `fragmentRegistry.transform`, so having too small of cache size here\n * might involuntarily invalidate values in the `transform` cache.\n */\n \"fragmentRegistry.findFragmentSpreads\": number;\n /**\n * Cache size for the `getFragmentDoc` method of [`ApolloCache`](https://github.com/apollographql/apollo-client/blob/main/src/cache/core/cache.ts).\n *\n * This function is called with user-provided fragment definitions.\n *\n * @defaultValue\n * Defaults to `1000`.\n *\n * @remarks\n * This function is called from `readFragment` with user-provided fragment definitions.\n */\n \"cache.fragmentQueryDocuments\": number;\n /**\n * Cache used in [`removeTypenameFromVariables`](https://github.com/apollographql/apollo-client/blob/main/src/link/remove-typename/removeTypenameFromVariables.ts).\n *\n * This function is called transformed `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `2000`.\n *\n * @privateRemarks\n * Cache size for the `getVariableDefinitions` function of `removeTypenameFromVariables`.\n */\n \"removeTypenameFromVariables.getVariableDefinitions\": number;\n /**\n * Cache size for the `maybeBroadcastWatch` method on [`InMemoryCache`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/inMemoryCache.ts).\n *\n * @defaultValue\n * Defaults to `5000`.\n *\n * @remarks\n * This method is used for dependency tracking in the `InMemoryCache` and\n * prevents from unnecessary re-renders.\n * It is recommended to keep this value significantly higher than the number of\n * possible subscribers you will have active at the same time in your application\n * at any time.\n */\n \"inMemoryCache.maybeBroadcastWatch\": number;\n /**\n * Cache size for the `executeSelectionSet` method on [`StoreReader`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/readFromStore.ts).\n *\n * @defaultValue\n * Defaults to `50000`.\n *\n * @remarks\n * Every object that is read from the cache will be cached here, so it is\n * recommended to set this to a high value.\n */\n \"inMemoryCache.executeSelectionSet\": number;\n /**\n * Cache size for the `executeSubSelectedArray` method on [`StoreReader`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/readFromStore.ts).\n *\n * @defaultValue\n * Defaults to `10000`.\n *\n * @remarks\n * Every array that is read from the cache will be cached here, so it is\n * recommended to set this to a high value.\n */\n \"inMemoryCache.executeSubSelectedArray\": number;\n /**\n * Cache size for the `prunePartialBoundaries` method on [`StoreReader`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/readFromStore.ts).\n *\n * @defaultValue\n * Defaults to `20000`.\n *\n * @remarks\n * Every object that is read from the cache for `@defer` and `@stream`\n * queries will be cached here, so it is recommended to set this to a\n * relatively high value.\n */\n \"inMemoryCache.prunePartialBoundaries\": number;\n /**\n * Cache size for the `prunePartialStreamArray` method on [`StoreReader`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/readFromStore.ts).\n *\n * @defaultValue\n * Defaults to `20000`.\n *\n * @remarks\n * Every array that is read from the cache for `@defer` and `@stream`\n * queries will be cached here, so it is recommended to set this to a\n * relatively high value.\n */\n \"inMemoryCache.prunePartialStreamArray\": number;\n /**\n * Used by the internal `checkDocument` that traverses GraphQL documents and throws an error if the document is invalid.\n * if they are not valid.\n */\n checkDocument: number;\n\n /**\n * Used by the internal `isDeferredFragment` utility that determines whether a\n * fragment selection node is a deferred fragment.\n */\n isDeferredFragment: number;\n\n /**\n * Used by the internal `isStreamField` utility that determines whether a\n * field selection node is a streamed field.\n */\n isStreamField: number;\n}\n\nconst cacheSizeSymbol = Symbol.for(\"apollo.cacheSize\");\n/**\n * The global cache size configuration for Apollo Client.\n *\n * @remarks\n *\n * You can directly modify this object, but any modification will\n * only have an effect on caches that are created after the modification.\n *\n * So for global caches, such as `canonicalStringify` and `print`,\n * you might need to call `.reset` on them, which will essentially re-create them.\n *\n * Alternatively, you can set `globalThis[Symbol.for(\"apollo.cacheSize\")]` before\n * you load the Apollo Client package:\n *\n * @example\n *\n * ```ts\n * globalThis[Symbol.for(\"apollo.cacheSize\")] = {\n * print: 100,\n * } satisfies Partial<CacheSizes>; // the `satisfies` is optional if using TypeScript\n * ```\n */\nexport const cacheSizes: Partial<CacheSizes> = { ...global[cacheSizeSymbol] };\n\nexport const enum defaultCacheSizes {\n checkDocument = 2000,\n isDeferredFragment = 2000,\n isStreamField = 2000,\n canonicalStringify = 1000,\n print = 2000,\n \"documentTransform.cache\" = 2000,\n \"queryManager.getDocumentInfo\" = 2000,\n \"PersistedQueryLink.persistedQueryHashes\" = 2000,\n \"fragmentRegistry.transform\" = 2000,\n \"fragmentRegistry.lookup\" = 1000,\n \"fragmentRegistry.findFragmentSpreads\" = 4000,\n \"cache.fragmentQueryDocuments\" = 1000,\n \"removeTypenameFromVariables.getVariableDefinitions\" = 2000,\n \"inMemoryCache.maybeBroadcastWatch\" = 5000,\n \"inMemoryCache.executeSelectionSet\" = 50000,\n \"inMemoryCache.executeSubSelectedArray\" = 10000,\n \"inMemoryCache.prunePartialBoundaries\" = 20000,\n \"inMemoryCache.prunePartialStreamArray\" = 20000,\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Incremental } from "@apollo/client/incremental";
|
|
2
|
+
export declare class StreamArrayState {
|
|
3
|
+
truncate: boolean;
|
|
4
|
+
private _streamPosition;
|
|
5
|
+
private path;
|
|
6
|
+
private dep;
|
|
7
|
+
constructor(path: Incremental.Path);
|
|
8
|
+
depend(): void;
|
|
9
|
+
get streamPosition(): number;
|
|
10
|
+
set streamPosition(value: number);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=StreamArrayState.d.ts.map
|