@apollo/client 4.2.9 → 4.2.11
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 +20 -0
- package/__cjs/cache/core/cache.cjs +1 -1
- package/__cjs/cache/inmemory/entityStore.cjs +3 -3
- package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
- package/__cjs/cache/inmemory/policies.cjs +4 -4
- package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
- package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +44 -10
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +12 -1
- package/__cjs/core/QueryInfo.cjs +24 -1
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryManager.cjs +12 -12
- package/__cjs/core/RefetchEventManager.cjs +3 -3
- package/__cjs/invariantErrorCodes.cjs +49 -30
- package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useBackgroundQuery.d.cts +100 -47
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.d.cts +26 -20
- package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLoadableQuery.d.cts +23 -15
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.d.cts +10 -7
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +74 -32
- package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.d.cts +83 -34
- package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
- package/__cjs/react/internal/types.d.cts +14 -3
- package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
- package/__cjs/react/query-preloader/createQueryPreloader.d.cts +20 -5
- package/__cjs/version.cjs +1 -1
- package/__cjs/version.cjs.map +1 -1
- package/cache/core/cache.js +1 -1
- package/cache/inmemory/entityStore.js +3 -3
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.js +4 -4
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/writeToStore.js +4 -4
- package/core/ApolloClient.d.ts +44 -10
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +12 -1
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.js +19 -0
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.js +12 -12
- package/core/QueryManager.js.map +1 -1
- package/core/RefetchEventManager.js +3 -3
- package/invariantErrorCodes.js +49 -30
- package/package.json +1 -1
- package/react/hooks/useBackgroundQuery.d.ts +100 -47
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +26 -20
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.d.ts +23 -15
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +10 -7
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +74 -32
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useQueryRefHandlers.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +83 -34
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks-compiled/useBackgroundQuery.d.ts +100 -47
- package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
- package/react/hooks-compiled/useLazyQuery.d.ts +26 -20
- package/react/hooks-compiled/useLazyQuery.js.map +1 -1
- package/react/hooks-compiled/useLoadableQuery.d.ts +23 -15
- package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
- package/react/hooks-compiled/useMutation.d.ts +10 -7
- package/react/hooks-compiled/useMutation.js.map +1 -1
- package/react/hooks-compiled/useQuery.d.ts +74 -32
- package/react/hooks-compiled/useQuery.js.map +1 -1
- package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
- package/react/hooks-compiled/useSuspenseQuery.d.ts +83 -34
- package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/internal/types.d.ts +15 -4
- package/react/internal/types.js.map +1 -1
- package/react/query-preloader/createQueryPreloader.d.ts +20 -5
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createQueryPreloader.cjs","sources":["../../../../src/react/query-preloader/createQueryPreloader.ts"],"sourcesContent":["import type {\n ApolloClient,\n DefaultContext,\n DocumentNode,\n ErrorPolicy,\n OperationVariables,\n RefetchOn,\n RefetchWritePolicy,\n TypedDocumentNode,\n WatchQueryFetchPolicy,\n} from \"@apollo/client\";\nimport type { PreloadedQueryRef } from \"@apollo/client/react\";\nimport {\n assertWrappedQueryRef,\n getWrappedPromise,\n InternalQueryReference,\n wrapQueryRef,\n} from \"@apollo/client/react/internal\";\nimport type {\n NoInfer,\n OptionWithFallback,\n SignatureStyle,\n VariablesOption,\n} from \"@apollo/client/utilities/internal\";\nimport { FinalizationRegistry } from \"@apollo/client/utilities/internal/ponyfills\";\n\nimport { wrapHook } from \"../hooks/internal/index.js\";\n\nexport type PreloadQueryFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n>;\n\nexport type PreloadQueryOptions<\n TVariables extends OperationVariables = OperationVariables,\n> = {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: PreloadQueryFetchPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy:member} */\n refetchWritePolicy?: RefetchWritePolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchOn:member} */\n refetchOn?: RefetchOn.Option;\n} & VariablesOption<TVariables>;\n\n/**\n * A function that will begin loading a query when called. It's result can be\n * read by `useReadQuery` which will suspend until the query is loaded.\n * This is useful when you want to start loading a query as early as possible\n * outside of a React component.\n *\n * @example\n *\n * ```js\n * const preloadQuery = createQueryPreloader(client);\n * const queryRef = preloadQuery(query, { variables, ...otherOptions });\n *\n * function App() {\n * return (\n * <Suspense fallback={<div>Loading</div>}>\n * <MyQuery />\n * </Suspense>\n * );\n * }\n *\n * function MyQuery() {\n * const { data } = useReadQuery(queryRef);\n *\n * // do something with `data`\n * }\n * ```\n */\nexport interface PreloadQueryFunction\n extends PreloadQueryFunction.Signatures.Evaluated {\n /**\n * A function that returns a promise that resolves when the query has finished\n * loading. The promise resolves with the `QueryReference` itself.\n *\n * @remarks\n * This method is useful for preloading queries in data loading routers, such\n * as [React Router](https://reactrouter.com/en/main) or [TanStack Router](https://tanstack.com/router),\n * to prevent routes from transitioning until the query has finished loading.\n * `data` is not exposed on the promise to discourage using the data in\n * `loader` functions and exposing it to your route components. Instead, we\n * prefer you rely on `useReadQuery` to access the data to ensure your\n * component can rerender with cache updates. If you need to access raw query\n * data, use `client.query()` directly.\n *\n * @example\n * Here's an example using React Router's `loader` function:\n *\n * ```ts\n * import { createQueryPreloader } from \"@apollo/client\";\n *\n * const preloadQuery = createQueryPreloader(client);\n *\n * export async function loader() {\n * const queryRef = preloadQuery(GET_DOGS_QUERY);\n *\n * return preloadQuery.toPromise(queryRef);\n * }\n *\n * export function RouteComponent() {\n * const queryRef = useLoaderData();\n * const { data } = useReadQuery(queryRef);\n *\n * // ...\n * }\n * ```\n */\n toPromise<TQueryRef extends PreloadedQueryRef<any, any, any>>(\n queryRef: TQueryRef\n ): Promise<TQueryRef>;\n}\n\nexport declare namespace PreloadQueryFunction {\n export interface DefaultOptions\n extends ApolloClient.DefaultOptions.WatchQuery.Calculated {}\n\n export namespace DocumentationTypes {\n /**\n * @deprecated Avoid manually specifying generics on `preloadQuery`.\n * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.\n *\n * {@inheritDoc @apollo/client/react!PreloadQueryFunction:interface}\n */\n export interface PreloadQueryFunction_Deprecated\n extends PreloadQueryFunction {}\n }\n\n export type ResultForOptions<\n TData,\n TVariables extends OperationVariables,\n TOptions extends Record<string, never> | PreloadQueryOptions<TVariables>,\n > = TOptions extends any ?\n PreloadedQueryRef<\n TData,\n TVariables,\n ResultForOptions.States<TOptions, DefaultOptions>\n >\n : never;\n\n export namespace ResultForOptions {\n export type States<\n TOptions,\n TDefaultOptions extends DefaultOptions = DefaultOptions,\n > =\n | \"complete\"\n | \"streaming\"\n | (OptionWithFallback<TOptions, TDefaultOptions, \"errorPolicy\"> extends (\n \"none\"\n ) ?\n never\n : \"empty\")\n | (OptionWithFallback<\n TOptions,\n TDefaultOptions,\n \"returnPartialData\"\n > extends false ?\n never\n : \"partial\");\n }\n\n export namespace Signatures {\n export interface Classic {\n // _INFERENCE_ONLY_DO_NOT_SPECIFY is used to distinguish between inferred\n // generics arguments and explicit generic arguments so that we can\n // provide a `@deprecated` signature for explicit generic arguments. As\n // soon as a user provides a generic arg (e.g. preloadQuery<TData>(query))`,\n // the overload falls through to the overloads without\n // _INFERENCE_ONLY_DO_NOT_SPECIFY.\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction:interface} */\n <\n TData,\n TVariables extends OperationVariables,\n _INFERENCE_ONLY_DO_NOT_SPECIFY extends \"inferred\",\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n returnPartialData: true;\n errorPolicy: \"ignore\" | \"all\";\n }\n ): PreloadedQueryRef<\n TData,\n TVariables,\n \"complete\" | \"streaming\" | \"partial\" | \"empty\"\n >;\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction:interface} */\n <\n TData,\n TVariables extends OperationVariables,\n _INFERENCE_ONLY_DO_NOT_SPECIFY extends \"inferred\",\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n errorPolicy: \"ignore\" | \"all\";\n }\n ): PreloadedQueryRef<\n TData,\n TVariables,\n \"complete\" | \"streaming\" | \"empty\"\n >;\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction:interface} */\n <\n TData,\n TVariables extends OperationVariables,\n _INFERENCE_ONLY_DO_NOT_SPECIFY extends \"inferred\",\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n returnPartialData: true;\n }\n ): PreloadedQueryRef<\n TData,\n TVariables,\n \"complete\" | \"streaming\" | \"partial\"\n >;\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction:interface} */\n <\n TData,\n TVariables extends OperationVariables,\n _INFERENCE_ONLY_DO_NOT_SPECIFY extends \"inferred\",\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: {} extends TVariables ?\n [options?: PreloadQueryOptions<NoInfer<TVariables>>]\n : [options: PreloadQueryOptions<NoInfer<TVariables>>]\n ): PreloadedQueryRef<TData, TVariables, \"complete\" | \"streaming\">;\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction.DocumentationTypes.PreloadQueryFunction_Deprecated:interface} */\n <TData, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n returnPartialData: true;\n errorPolicy: \"ignore\" | \"all\";\n }\n ): PreloadedQueryRef<\n TData,\n TVariables,\n \"complete\" | \"streaming\" | \"partial\" | \"empty\"\n >;\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction.DocumentationTypes.PreloadQueryFunction_Deprecated:interface} */\n <TData, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n errorPolicy: \"ignore\" | \"all\";\n }\n ): PreloadedQueryRef<\n TData,\n TVariables,\n \"complete\" | \"streaming\" | \"empty\"\n >;\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction.DocumentationTypes.PreloadQueryFunction_Deprecated:interface} */\n <TData, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n returnPartialData: true;\n }\n ): PreloadedQueryRef<\n TData,\n TVariables,\n \"complete\" | \"streaming\" | \"partial\"\n >;\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction.DocumentationTypes.PreloadQueryFunction_Deprecated:interface} */\n <TData, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: {} extends TVariables ?\n [options?: PreloadQueryOptions<NoInfer<TVariables>>]\n : [options: PreloadQueryOptions<NoInfer<TVariables>>]\n ): PreloadedQueryRef<TData, TVariables, \"complete\" | \"streaming\">;\n }\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction:interface} */\n export interface Modern {\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction:interface} */\n <\n TData,\n TVariables extends OperationVariables,\n // this overload should never be manually defined, it should always be inferred\n TOptions extends never,\n >(\n query: {} extends TVariables ?\n DocumentNode | TypedDocumentNode<TData, TVariables>\n : // this overload should only be accessible if all `TVariables` are optional\n never\n ): PreloadQueryFunction.ResultForOptions<\n TData,\n TVariables,\n Record<string, never>\n >;\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction:interface} */\n <\n TData,\n TVariables extends OperationVariables,\n // this overload should never be manually defined, it should always be inferred\n TOptions extends PreloadQueryOptions<NoInfer<TVariables>> &\n VariablesOption<\n TVariables & {\n [K in Exclude<\n keyof TOptions[\"variables\"],\n keyof TVariables\n >]?: never;\n }\n >,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: {} extends TVariables ? [options?: TOptions]\n : [options: TOptions]\n ): PreloadQueryFunction.ResultForOptions<TData, TVariables, TOptions>;\n }\n\n export type Evaluated = SignatureStyle extends \"classic\" ? Classic : Modern;\n }\n}\n\n/**\n * A higher order function that returns a `preloadQuery` function which\n * can be used to begin loading a query with the given `client`. This is useful\n * when you want to start loading a query as early as possible outside of a\n * React component.\n *\n * > Refer to the [Suspense - Initiating queries outside React](https://www.apollographql.com/docs/react/data/suspense#initiating-queries-outside-react) section for a more in-depth overview.\n *\n * @param client - The `ApolloClient` instance that will be used to load queries\n * from the returned `preloadQuery` function.\n * @returns The `preloadQuery` function.\n *\n * @example\n *\n * ```js\n * const preloadQuery = createQueryPreloader(client);\n * ```\n */\nexport function createQueryPreloader(\n client: ApolloClient\n): PreloadQueryFunction {\n return wrapHook(\n \"createQueryPreloader\",\n _createQueryPreloader,\n client\n )(client);\n}\n\nconst _createQueryPreloader: typeof createQueryPreloader = (client) => {\n function preloadQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> &\n VariablesOption<TVariables> = {} as any\n ): PreloadedQueryRef<TData, TVariables> {\n const queryRef = new InternalQueryReference(\n client.watchQuery({\n ...options,\n query,\n notifyOnNetworkStatusChange: false,\n } as ApolloClient.WatchQueryOptions<any, any>),\n {\n autoDisposeTimeoutMs:\n client.defaultOptions.react?.suspense?.autoDisposeTimeoutMs,\n }\n );\n\n const wrapped = wrapQueryRef(queryRef) as unknown as PreloadedQueryRef<\n TData,\n TVariables\n >;\n softRetainWhileReferenced(wrapped, queryRef);\n return wrapped;\n }\n\n return Object.assign(preloadQuery, {\n toPromise<TQueryRef extends PreloadedQueryRef<any, any, any>>(\n queryRef: TQueryRef\n ) {\n assertWrappedQueryRef(queryRef);\n return getWrappedPromise(queryRef).then(() => queryRef);\n },\n });\n};\n\n/**\n * Soft-retains the underlying `InternalQueryReference` while the `PreloadedQueryRef`\n * is still reachable.\n * When the `PreloadedQueryRef` is garbage collected, the soft retain is\n * disposed of, but only after the initial query has finished loading.\n * Once the `InternalQueryReference` is properly retained, the check for garbage\n * collection is unregistered and the soft retain is disposed of immediately.\n */\n// this is an individual function to avoid closing over any values more than necessary\nfunction softRetainWhileReferenced(\n wrapped: PreloadedQueryRef<any, any, any>,\n queryRef: InternalQueryReference\n) {\n const { softDispose, delayedSoftDispose } = getCleanup(queryRef);\n registry.register(wrapped, delayedSoftDispose, queryRef);\n // This will unregister the cleanup from the finalization registry when\n // the queryRef is properly retained.\n // This is mostly done to keep the FinalizationRegistry from holding too many\n // cleanup functions, as our React Native polyfill has to iterate all of them regularly.\n queryRef.retain = unregisterOnRetain(queryRef.retain, softDispose);\n}\n\ntype RetainFunction = (\n this: InternalQueryReference,\n ...args: Parameters<InternalQueryReference[\"retain\"]>\n) => ReturnType<InternalQueryReference[\"retain\"]>;\n\n// this is an individual function to avoid closing over any values more than necessary\nfunction unregisterOnRetain(\n originalRetain: RetainFunction,\n softDispose: () => void\n): RetainFunction {\n return function (...args) {\n registry.unregister(this);\n const dispose = originalRetain.apply(this, args);\n softDispose();\n return dispose;\n };\n}\n\n// this is an individual function to avoid closing over any values more than necessary\nfunction getCleanup(queryRef: InternalQueryReference) {\n const softDispose = queryRef.softRetain();\n const initialPromise = queryRef.promise;\n\n return {\n softDispose,\n delayedSoftDispose: () =>\n initialPromise.finally(softDispose).catch(() => {}),\n };\n}\n\nconst registry = new FinalizationRegistry<() => void>((cleanup) => cleanup());\n"],"names":[],"mappings":";;AA0VA,CAAA,CAAA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A,CAAA,CAAA,CAAA,CAAyC,CAAa,CAAC,CAAvD,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8D,EAAE,CAAhE,EAAmE,CAAnE,CAAA,CAAA,CAAA,CAAA,CAAA,CAA0E,CAA1E,CAA4E,CAAC;"}
|
|
1
|
+
{"version":3,"file":"createQueryPreloader.cjs","sources":["../../../../src/react/query-preloader/createQueryPreloader.ts"],"sourcesContent":["import type {\n ApolloClient,\n DefaultContext,\n DocumentNode,\n ErrorPolicy,\n OperationVariables,\n RefetchOn,\n RefetchWritePolicy,\n TypedDocumentNode,\n WatchQueryFetchPolicy,\n} from \"@apollo/client\";\nimport type { PreloadedQueryRef } from \"@apollo/client/react\";\nimport {\n assertWrappedQueryRef,\n getWrappedPromise,\n InternalQueryReference,\n wrapQueryRef,\n} from \"@apollo/client/react/internal\";\nimport type {\n NoInfer,\n OptionWithFallback,\n Prettify,\n SignatureStyle,\n VariablesOption,\n} from \"@apollo/client/utilities/internal\";\nimport { FinalizationRegistry } from \"@apollo/client/utilities/internal/ponyfills\";\n\nimport { wrapHook } from \"../hooks/internal/index.js\";\n\nexport type PreloadQueryFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n>;\n\nexport type PreloadQueryOptions<\n TVariables extends OperationVariables = OperationVariables,\n> = {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: PreloadQueryFetchPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy:member} */\n refetchWritePolicy?: RefetchWritePolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchOn:member} */\n refetchOn?: RefetchOn.Option;\n} & VariablesOption<TVariables>;\n\n/**\n * A function that will begin loading a query when called. It's result can be\n * read by `useReadQuery` which will suspend until the query is loaded.\n * This is useful when you want to start loading a query as early as possible\n * outside of a React component.\n *\n * @example\n *\n * ```js\n * const preloadQuery = createQueryPreloader(client);\n * const queryRef = preloadQuery(query, { variables, ...otherOptions });\n *\n * function App() {\n * return (\n * <Suspense fallback={<div>Loading</div>}>\n * <MyQuery />\n * </Suspense>\n * );\n * }\n *\n * function MyQuery() {\n * const { data } = useReadQuery(queryRef);\n *\n * // do something with `data`\n * }\n * ```\n */\nexport interface PreloadQueryFunction\n extends PreloadQueryFunction.Signatures.Evaluated {\n /**\n * A function that returns a promise that resolves when the query has finished\n * loading. The promise resolves with the `QueryReference` itself.\n *\n * @remarks\n * This method is useful for preloading queries in data loading routers, such\n * as [React Router](https://reactrouter.com/en/main) or [TanStack Router](https://tanstack.com/router),\n * to prevent routes from transitioning until the query has finished loading.\n * `data` is not exposed on the promise to discourage using the data in\n * `loader` functions and exposing it to your route components. Instead, we\n * prefer you rely on `useReadQuery` to access the data to ensure your\n * component can rerender with cache updates. If you need to access raw query\n * data, use `client.query()` directly.\n *\n * @example\n * Here's an example using React Router's `loader` function:\n *\n * ```ts\n * import { createQueryPreloader } from \"@apollo/client\";\n *\n * const preloadQuery = createQueryPreloader(client);\n *\n * export async function loader() {\n * const queryRef = preloadQuery(GET_DOGS_QUERY);\n *\n * return preloadQuery.toPromise(queryRef);\n * }\n *\n * export function RouteComponent() {\n * const queryRef = useLoaderData();\n * const { data } = useReadQuery(queryRef);\n *\n * // ...\n * }\n * ```\n */\n toPromise<TQueryRef extends PreloadedQueryRef<any, any, any>>(\n queryRef: TQueryRef\n ): Promise<TQueryRef>;\n}\n\nexport declare namespace PreloadQueryFunction {\n export interface DefaultOptions\n extends ApolloClient.DefaultOptions.WatchQuery.Calculated {}\n\n export namespace DocumentationTypes {\n /**\n * @deprecated Avoid manually specifying generics on `preloadQuery`.\n * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.\n *\n * {@inheritDoc @apollo/client/react!PreloadQueryFunction:interface}\n */\n export interface PreloadQueryFunction_Deprecated\n extends PreloadQueryFunction {}\n }\n\n export type OptionsFor<\n TVariables extends OperationVariables,\n TOptions extends { variables?: unknown },\n > = PreloadQueryOptions<NoInfer<TVariables>> & {\n variables?: Prettify<\n TVariables & {\n // variables that are not part of `TVariables`\n [K in keyof TOptions[\"variables\"]]: K extends keyof TVariables ?\n TVariables[K]\n : never;\n }\n >;\n } & (Exclude<keyof TOptions, keyof PreloadQueryOptions<any>> extends (\n infer InvalidOptionNames extends string\n ) ?\n [InvalidOptionNames] extends [never] ?\n unknown\n : { [K in InvalidOptionNames]: never }\n : never);\n\n export type ResultForOptions<\n TData,\n TVariables extends OperationVariables,\n TOptions extends\n | Record<string, never>\n | Omit<PreloadQueryOptions<any>, \"variables\">,\n > = TOptions extends any ?\n PreloadedQueryRef<\n TData,\n TVariables,\n ResultForOptions.States<TOptions, DefaultOptions>\n >\n : never;\n\n export namespace ResultForOptions {\n export type States<\n TOptions,\n TDefaultOptions extends DefaultOptions = DefaultOptions,\n > =\n | \"complete\"\n | \"streaming\"\n | (OptionWithFallback<TOptions, TDefaultOptions, \"errorPolicy\"> extends (\n \"none\"\n ) ?\n never\n : \"empty\")\n | (OptionWithFallback<\n TOptions,\n TDefaultOptions,\n \"returnPartialData\"\n > extends false ?\n never\n : \"partial\");\n }\n\n export namespace Signatures {\n export interface Classic {\n // _INFERENCE_ONLY_DO_NOT_SPECIFY is used to distinguish between inferred\n // generics arguments and explicit generic arguments so that we can\n // provide a `@deprecated` signature for explicit generic arguments. As\n // soon as a user provides a generic arg (e.g. preloadQuery<TData>(query))`,\n // the overload falls through to the overloads without\n // _INFERENCE_ONLY_DO_NOT_SPECIFY.\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction:interface} */\n <\n TData,\n TVariables extends OperationVariables,\n _INFERENCE_ONLY_DO_NOT_SPECIFY extends \"inferred\",\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n returnPartialData: true;\n errorPolicy: \"ignore\" | \"all\";\n }\n ): PreloadedQueryRef<\n TData,\n TVariables,\n \"complete\" | \"streaming\" | \"partial\" | \"empty\"\n >;\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction:interface} */\n <\n TData,\n TVariables extends OperationVariables,\n _INFERENCE_ONLY_DO_NOT_SPECIFY extends \"inferred\",\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n errorPolicy: \"ignore\" | \"all\";\n }\n ): PreloadedQueryRef<\n TData,\n TVariables,\n \"complete\" | \"streaming\" | \"empty\"\n >;\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction:interface} */\n <\n TData,\n TVariables extends OperationVariables,\n _INFERENCE_ONLY_DO_NOT_SPECIFY extends \"inferred\",\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n returnPartialData: true;\n }\n ): PreloadedQueryRef<\n TData,\n TVariables,\n \"complete\" | \"streaming\" | \"partial\"\n >;\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction:interface} */\n <\n TData,\n TVariables extends OperationVariables,\n _INFERENCE_ONLY_DO_NOT_SPECIFY extends \"inferred\",\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: {} extends TVariables ?\n [options?: PreloadQueryOptions<NoInfer<TVariables>>]\n : [options: PreloadQueryOptions<NoInfer<TVariables>>]\n ): PreloadedQueryRef<TData, TVariables, \"complete\" | \"streaming\">;\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction.DocumentationTypes.PreloadQueryFunction_Deprecated:interface} */\n <TData, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n returnPartialData: true;\n errorPolicy: \"ignore\" | \"all\";\n }\n ): PreloadedQueryRef<\n TData,\n TVariables,\n \"complete\" | \"streaming\" | \"partial\" | \"empty\"\n >;\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction.DocumentationTypes.PreloadQueryFunction_Deprecated:interface} */\n <TData, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n errorPolicy: \"ignore\" | \"all\";\n }\n ): PreloadedQueryRef<\n TData,\n TVariables,\n \"complete\" | \"streaming\" | \"empty\"\n >;\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction.DocumentationTypes.PreloadQueryFunction_Deprecated:interface} */\n <TData, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n returnPartialData: true;\n }\n ): PreloadedQueryRef<\n TData,\n TVariables,\n \"complete\" | \"streaming\" | \"partial\"\n >;\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction.DocumentationTypes.PreloadQueryFunction_Deprecated:interface} */\n <TData, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: {} extends TVariables ?\n [options?: PreloadQueryOptions<NoInfer<TVariables>>]\n : [options: PreloadQueryOptions<NoInfer<TVariables>>]\n ): PreloadedQueryRef<TData, TVariables, \"complete\" | \"streaming\">;\n }\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction:interface} */\n export interface Modern {\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction:interface} */\n <\n TData,\n TVariables extends OperationVariables,\n // this overload should never be manually defined, it should always be inferred\n TOptions extends never,\n >(\n query: {} extends TVariables ?\n DocumentNode | TypedDocumentNode<TData, TVariables>\n : // this overload should only be accessible if all `TVariables` are optional\n never\n ): PreloadQueryFunction.ResultForOptions<\n TData,\n TVariables,\n Record<string, never>\n >;\n\n /** {@inheritDoc @apollo/client/react!PreloadQueryFunction:interface} */\n <\n TData,\n TVariables extends OperationVariables,\n // this overload should never be manually defined, it should always be inferred\n TOptions extends Omit<PreloadQueryOptions<any>, \"variables\"> & {\n variables?: unknown;\n },\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: {} extends TVariables ?\n [\n options?: TOptions &\n PreloadQueryFunction.OptionsFor<TVariables, TOptions>,\n ]\n : [\n options: TOptions &\n PreloadQueryFunction.OptionsFor<TVariables, TOptions>,\n ]\n ): PreloadQueryFunction.ResultForOptions<TData, TVariables, TOptions>;\n }\n\n export type Evaluated = SignatureStyle extends \"classic\" ? Classic : Modern;\n }\n}\n\n/**\n * A higher order function that returns a `preloadQuery` function which\n * can be used to begin loading a query with the given `client`. This is useful\n * when you want to start loading a query as early as possible outside of a\n * React component.\n *\n * > Refer to the [Suspense - Initiating queries outside React](https://www.apollographql.com/docs/react/data/suspense#initiating-queries-outside-react) section for a more in-depth overview.\n *\n * @param client - The `ApolloClient` instance that will be used to load queries\n * from the returned `preloadQuery` function.\n * @returns The `preloadQuery` function.\n *\n * @example\n *\n * ```js\n * const preloadQuery = createQueryPreloader(client);\n * ```\n */\nexport function createQueryPreloader(\n client: ApolloClient\n): PreloadQueryFunction {\n return wrapHook(\n \"createQueryPreloader\",\n _createQueryPreloader,\n client\n )(client);\n}\n\nconst _createQueryPreloader: typeof createQueryPreloader = (client) => {\n function preloadQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> &\n VariablesOption<TVariables> = {} as any\n ): PreloadedQueryRef<TData, TVariables> {\n const queryRef = new InternalQueryReference(\n client.watchQuery({\n ...options,\n query,\n notifyOnNetworkStatusChange: false,\n } as ApolloClient.WatchQueryOptions<any, any>),\n {\n autoDisposeTimeoutMs:\n client.defaultOptions.react?.suspense?.autoDisposeTimeoutMs,\n }\n );\n\n const wrapped = wrapQueryRef(queryRef) as unknown as PreloadedQueryRef<\n TData,\n TVariables\n >;\n softRetainWhileReferenced(wrapped, queryRef);\n return wrapped;\n }\n\n return Object.assign(preloadQuery, {\n toPromise<TQueryRef extends PreloadedQueryRef<any, any, any>>(\n queryRef: TQueryRef\n ) {\n assertWrappedQueryRef(queryRef);\n return getWrappedPromise(queryRef).then(() => queryRef);\n },\n });\n};\n\n/**\n * Soft-retains the underlying `InternalQueryReference` while the `PreloadedQueryRef`\n * is still reachable.\n * When the `PreloadedQueryRef` is garbage collected, the soft retain is\n * disposed of, but only after the initial query has finished loading.\n * Once the `InternalQueryReference` is properly retained, the check for garbage\n * collection is unregistered and the soft retain is disposed of immediately.\n */\n// this is an individual function to avoid closing over any values more than necessary\nfunction softRetainWhileReferenced(\n wrapped: PreloadedQueryRef<any, any, any>,\n queryRef: InternalQueryReference\n) {\n const { softDispose, delayedSoftDispose } = getCleanup(queryRef);\n registry.register(wrapped, delayedSoftDispose, queryRef);\n // This will unregister the cleanup from the finalization registry when\n // the queryRef is properly retained.\n // This is mostly done to keep the FinalizationRegistry from holding too many\n // cleanup functions, as our React Native polyfill has to iterate all of them regularly.\n queryRef.retain = unregisterOnRetain(queryRef.retain, softDispose);\n}\n\ntype RetainFunction = (\n this: InternalQueryReference,\n ...args: Parameters<InternalQueryReference[\"retain\"]>\n) => ReturnType<InternalQueryReference[\"retain\"]>;\n\n// this is an individual function to avoid closing over any values more than necessary\nfunction unregisterOnRetain(\n originalRetain: RetainFunction,\n softDispose: () => void\n): RetainFunction {\n return function (...args) {\n registry.unregister(this);\n const dispose = originalRetain.apply(this, args);\n softDispose();\n return dispose;\n };\n}\n\n// this is an individual function to avoid closing over any values more than necessary\nfunction getCleanup(queryRef: InternalQueryReference) {\n const softDispose = queryRef.softRetain();\n const initialPromise = queryRef.promise;\n\n return {\n softDispose,\n delayedSoftDispose: () =>\n initialPromise.finally(softDispose).catch(() => {}),\n };\n}\n\nconst registry = new FinalizationRegistry<() => void>((cleanup) => cleanup());\n"],"names":[],"mappings":";;AAkXA,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,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAtWA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAaA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAEA,CAAA,CAAA,C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AA,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,CAAyC,CAAa,CAAC,CAAvD,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8D,EAAE,CAAhE,EAAmE,CAAnE,CAAA,CAAA,CAAA,CAAA,CAAA,CAA0E,CAA1E,CAA4E,CAAC;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ApolloClient, DefaultContext, DocumentNode, ErrorPolicy, OperationVariables, RefetchOn, RefetchWritePolicy, TypedDocumentNode, WatchQueryFetchPolicy } from "@apollo/client";
|
|
2
2
|
import type { PreloadedQueryRef } from "@apollo/client/react";
|
|
3
|
-
import type { NoInfer, OptionWithFallback, SignatureStyle, VariablesOption } from "@apollo/client/utilities/internal";
|
|
3
|
+
import type { NoInfer, OptionWithFallback, Prettify, SignatureStyle, VariablesOption } from "@apollo/client/utilities/internal";
|
|
4
4
|
export type PreloadQueryFetchPolicy = Extract<WatchQueryFetchPolicy, "cache-first" | "network-only" | "no-cache" | "cache-and-network">;
|
|
5
5
|
export type PreloadQueryOptions<TVariables extends OperationVariables = OperationVariables> = {
|
|
6
6
|
/**
|
|
@@ -170,7 +170,18 @@ export declare namespace PreloadQueryFunction {
|
|
|
170
170
|
interface PreloadQueryFunction_Deprecated extends PreloadQueryFunction {
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
type
|
|
173
|
+
type OptionsFor<TVariables extends OperationVariables, TOptions extends {
|
|
174
|
+
variables?: unknown;
|
|
175
|
+
}> = PreloadQueryOptions<NoInfer<TVariables>> & {
|
|
176
|
+
variables?: Prettify<TVariables & {
|
|
177
|
+
[K in keyof TOptions["variables"]]: K extends keyof TVariables ? TVariables[K] : never;
|
|
178
|
+
}>;
|
|
179
|
+
} & (Exclude<keyof TOptions, keyof PreloadQueryOptions<any>> extends (infer InvalidOptionNames extends string) ? [
|
|
180
|
+
InvalidOptionNames
|
|
181
|
+
] extends [never] ? unknown : {
|
|
182
|
+
[K in InvalidOptionNames]: never;
|
|
183
|
+
} : never);
|
|
184
|
+
type ResultForOptions<TData, TVariables extends OperationVariables, TOptions extends Record<string, never> | Omit<PreloadQueryOptions<any>, "variables">> = TOptions extends any ? PreloadedQueryRef<TData, TVariables, ResultForOptions.States<TOptions, DefaultOptions>> : never;
|
|
174
185
|
namespace ResultForOptions {
|
|
175
186
|
type States<TOptions, TDefaultOptions extends DefaultOptions = DefaultOptions> = "complete" | "streaming" | (OptionWithFallback<TOptions, TDefaultOptions, "errorPolicy"> extends ("none") ? never : "empty") | (OptionWithFallback<TOptions, TDefaultOptions, "returnPartialData"> extends false ? never : "partial");
|
|
176
187
|
}
|
|
@@ -518,9 +529,13 @@ export declare namespace PreloadQueryFunction {
|
|
|
518
529
|
* }
|
|
519
530
|
* ```
|
|
520
531
|
*/
|
|
521
|
-
<TData, TVariables extends OperationVariables, TOptions extends PreloadQueryOptions<
|
|
522
|
-
|
|
523
|
-
}
|
|
532
|
+
<TData, TVariables extends OperationVariables, TOptions extends Omit<PreloadQueryOptions<any>, "variables"> & {
|
|
533
|
+
variables?: unknown;
|
|
534
|
+
}>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
|
|
535
|
+
options?: TOptions & PreloadQueryFunction.OptionsFor<TVariables, TOptions>
|
|
536
|
+
] : [
|
|
537
|
+
options: TOptions & PreloadQueryFunction.OptionsFor<TVariables, TOptions>
|
|
538
|
+
]): PreloadQueryFunction.ResultForOptions<TData, TVariables, TOptions>;
|
|
524
539
|
}
|
|
525
540
|
type Evaluated = SignatureStyle extends "classic" ? Classic : Modern;
|
|
526
541
|
}
|
package/__cjs/version.cjs
CHANGED
package/__cjs/version.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.cjs","sources":["../../src/version.ts"],"sourcesContent":["export const version = \"local\" as string;\nexport const build = \"source\" as \"source\" | \"esm\" | \"cjs\";\n"],"names":[],"mappings":";;;AAAa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"version.cjs","sources":["../../src/version.ts"],"sourcesContent":["export const version = \"local\" as string;\nexport const build = \"source\" as \"source\" | \"esm\" | \"cjs\";\n"],"names":[],"mappings":";;;AAAa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,UAAwC;AAC3B,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAb,CAAA,CAAA,CAAA,EAAA,OAAyD;"}
|
package/cache/core/cache.js
CHANGED
|
@@ -133,7 +133,7 @@ export class ApolloCache {
|
|
|
133
133
|
if (__DEV__) {
|
|
134
134
|
const actualFragmentName = fragmentName || getFragmentDefinition(fragment).name.value;
|
|
135
135
|
if (id === undefined) {
|
|
136
|
-
__DEV__ && invariant.warn(
|
|
136
|
+
__DEV__ && invariant.warn(119, actualFragmentName);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
return id;
|
|
@@ -73,7 +73,7 @@ export class EntityStore {
|
|
|
73
73
|
// then there are no fields to be merged, so we're done.
|
|
74
74
|
if (!incoming)
|
|
75
75
|
return;
|
|
76
|
-
invariant(typeof dataId === "string",
|
|
76
|
+
invariant(typeof dataId === "string", 105);
|
|
77
77
|
const merged = new DeepMerger({
|
|
78
78
|
reconciler: storeObjectReconciler,
|
|
79
79
|
}).merge(existing, incoming);
|
|
@@ -175,7 +175,7 @@ export class EntityStore {
|
|
|
175
175
|
if (__DEV__) {
|
|
176
176
|
const checkReference = (ref) => {
|
|
177
177
|
if (this.lookup(ref.__ref) === undefined) {
|
|
178
|
-
__DEV__ && invariant.warn(
|
|
178
|
+
__DEV__ && invariant.warn(106, ref);
|
|
179
179
|
return true;
|
|
180
180
|
}
|
|
181
181
|
};
|
|
@@ -204,7 +204,7 @@ export class EntityStore {
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
if (seenReference && someNonReference !== undefined) {
|
|
207
|
-
__DEV__ && invariant.warn(
|
|
207
|
+
__DEV__ && invariant.warn(107, someNonReference);
|
|
208
208
|
break;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
@@ -34,7 +34,7 @@ export function keyFieldsFnFromSpecifier(specifier) {
|
|
|
34
34
|
// context.readField for this extraction.
|
|
35
35
|
extracted = extractKeyPath(object, schemaKeyPath, extractKey);
|
|
36
36
|
}
|
|
37
|
-
invariant(extracted !== void 0,
|
|
37
|
+
invariant(extracted !== void 0, 108, schemaKeyPath.join("."), object);
|
|
38
38
|
return extracted;
|
|
39
39
|
}));
|
|
40
40
|
return `${context.typename}:${JSON.stringify(keyObject)}`;
|
|
@@ -220,7 +220,7 @@ export class Policies {
|
|
|
220
220
|
const rootId = "ROOT_" + which.toUpperCase();
|
|
221
221
|
const old = this.rootTypenamesById[rootId];
|
|
222
222
|
if (typename !== old) {
|
|
223
|
-
invariant(!old || old === which,
|
|
223
|
+
invariant(!old || old === which, 109, which);
|
|
224
224
|
// First, delete any old __typename associated with this rootId from
|
|
225
225
|
// rootIdsByTypename.
|
|
226
226
|
if (old)
|
|
@@ -363,7 +363,7 @@ export class Policies {
|
|
|
363
363
|
if (supertypeSet.has(supertype)) {
|
|
364
364
|
if (!typenameSupertypeSet.has(supertype)) {
|
|
365
365
|
if (checkingFuzzySubtypes) {
|
|
366
|
-
__DEV__ && invariant.warn(
|
|
366
|
+
__DEV__ && invariant.warn(110, typename, supertype);
|
|
367
367
|
}
|
|
368
368
|
// Record positive results for faster future lookup.
|
|
369
369
|
// Unfortunately, we cannot safely cache negative results,
|
|
@@ -615,7 +615,7 @@ export function normalizeReadFieldOptions(readFieldArgs, objectOrReference, vari
|
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
617
|
if (__DEV__ && options.from === void 0) {
|
|
618
|
-
__DEV__ && invariant.warn(
|
|
618
|
+
__DEV__ && invariant.warn(111, stringifyForDisplay(Array.from(readFieldArgs)));
|
|
619
619
|
}
|
|
620
620
|
if (void 0 === options.variables) {
|
|
621
621
|
options.variables = variables;
|
|
@@ -625,7 +625,7 @@ export function normalizeReadFieldOptions(readFieldArgs, objectOrReference, vari
|
|
|
625
625
|
function makeMergeObjectsFunction(store) {
|
|
626
626
|
return function mergeObjects(existing, incoming) {
|
|
627
627
|
if (isArray(existing) || isArray(incoming)) {
|
|
628
|
-
throw newInvariantError(
|
|
628
|
+
throw newInvariantError(112);
|
|
629
629
|
}
|
|
630
630
|
// These dynamic checks are necessary because the parameters of a
|
|
631
631
|
// custom merge function can easily have the any type, so the type
|
|
@@ -191,7 +191,7 @@ export class StoreReader {
|
|
|
191
191
|
else {
|
|
192
192
|
const fragment = getFragmentFromSelection(selection, context.lookupFragment);
|
|
193
193
|
if (!fragment && selection.kind === Kind.FRAGMENT_SPREAD) {
|
|
194
|
-
throw newInvariantError(
|
|
194
|
+
throw newInvariantError(113, selection.name.value);
|
|
195
195
|
}
|
|
196
196
|
if (fragment && policies.fragmentMatches(fragment, typename)) {
|
|
197
197
|
fragment.selectionSet.selections.forEach(workSet.add, workSet);
|
|
@@ -274,7 +274,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
274
274
|
if (isNonNullObject(value)) {
|
|
275
275
|
invariant(
|
|
276
276
|
!isReference(value),
|
|
277
|
-
|
|
277
|
+
114,
|
|
278
278
|
getTypenameFromStoreObject(store, value),
|
|
279
279
|
field.name.value
|
|
280
280
|
);
|
|
@@ -68,7 +68,7 @@ export class StoreWriter {
|
|
|
68
68
|
path: [],
|
|
69
69
|
});
|
|
70
70
|
if (!isReference(ref)) {
|
|
71
|
-
throw newInvariantError(
|
|
71
|
+
throw newInvariantError(115, result);
|
|
72
72
|
}
|
|
73
73
|
// So far, the store has not been modified, so now it's time to process
|
|
74
74
|
// context.incomingById and merge those incoming fields into context.store.
|
|
@@ -230,7 +230,7 @@ export class StoreWriter {
|
|
|
230
230
|
// provide a default value, so its absence from the written data should
|
|
231
231
|
// not be cause for alarm.
|
|
232
232
|
!policies.getReadFunction(typename, field.name.value)) {
|
|
233
|
-
invariant.error(
|
|
233
|
+
invariant.error(116, resultKeyNameFromField(field), result);
|
|
234
234
|
}
|
|
235
235
|
});
|
|
236
236
|
// Identify the result object, even if dataId was already provided,
|
|
@@ -378,7 +378,7 @@ export class StoreWriter {
|
|
|
378
378
|
else {
|
|
379
379
|
const fragment = getFragmentFromSelection(selection, context.lookupFragment);
|
|
380
380
|
if (!fragment && selection.kind === Kind.FRAGMENT_SPREAD) {
|
|
381
|
-
throw newInvariantError(
|
|
381
|
+
throw newInvariantError(117, selection.name.value);
|
|
382
382
|
}
|
|
383
383
|
if (fragment &&
|
|
384
384
|
policies.fragmentMatches(fragment, typename, result, context.variables)) {
|
|
@@ -554,7 +554,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
554
554
|
}
|
|
555
555
|
});
|
|
556
556
|
}
|
|
557
|
-
__DEV__ && invariant.warn(
|
|
557
|
+
__DEV__ && invariant.warn(118, fieldName, parentType, childTypenames.length ?
|
|
558
558
|
"either ensure all objects of type " +
|
|
559
559
|
childTypenames.join(" and ") +
|
|
560
560
|
" have an ID or a custom merge function, or "
|
package/core/ApolloClient.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { ClientAwarenessLink } from "@apollo/client/link/client-awareness";
|
|
|
8
8
|
import type { LocalState } from "@apollo/client/local-state";
|
|
9
9
|
import type { MaybeMasked, Unmasked } from "@apollo/client/masking";
|
|
10
10
|
import { DocumentTransform } from "@apollo/client/utilities";
|
|
11
|
-
import type { LazyType, OptionWithFallback, SignatureStyle, VariablesOption, variablesUnknownSymbol } from "@apollo/client/utilities/internal";
|
|
11
|
+
import type { LazyType, OptionWithFallback, Prettify, SignatureStyle, VariablesOption, variablesUnknownSymbol } from "@apollo/client/utilities/internal";
|
|
12
12
|
import { getApolloClientMemoryInternals } from "@apollo/client/utilities/internal";
|
|
13
13
|
import type { DeclareDefaultOptions, DefaultOptions } from "./defaultOptions.js";
|
|
14
14
|
import type { ObservableQuery } from "./ObservableQuery.js";
|
|
@@ -232,7 +232,20 @@ export declare namespace ApolloClient {
|
|
|
232
232
|
export namespace mutate {
|
|
233
233
|
interface DefaultOptions extends ApolloClient.DefaultOptions.Mutate.Calculated {
|
|
234
234
|
}
|
|
235
|
-
type
|
|
235
|
+
type OptionsFor<TData, TVariables extends OperationVariables, TCache extends ApolloCache, TOptions extends {
|
|
236
|
+
variables?: unknown;
|
|
237
|
+
}> = MutateOptions<NoInfer<TData>, NoInfer<TVariables>, TCache> & {
|
|
238
|
+
variables?: Prettify<TVariables & {
|
|
239
|
+
[K in keyof TOptions["variables"]]: K extends keyof TVariables ? TVariables[K] : never;
|
|
240
|
+
}>;
|
|
241
|
+
} & (Exclude<keyof TOptions, keyof MutateOptions<any, any, any>> extends (infer InvalidOptionNames extends string) ? [
|
|
242
|
+
InvalidOptionNames
|
|
243
|
+
] extends [never] ? unknown : {
|
|
244
|
+
[K in InvalidOptionNames]: never;
|
|
245
|
+
} : never);
|
|
246
|
+
type ResultForOptions<TData, TErrorPolicy extends ErrorPolicy | undefined = undefined> = LazyType<MutateResult<MaybeMasked<TData>, OptionWithFallback<{
|
|
247
|
+
errorPolicy: TErrorPolicy;
|
|
248
|
+
}, DefaultOptions, "errorPolicy"> & ErrorPolicy>>;
|
|
236
249
|
namespace Signatures {
|
|
237
250
|
interface Classic {
|
|
238
251
|
/**
|
|
@@ -271,11 +284,21 @@ export declare namespace ApolloClient {
|
|
|
271
284
|
*
|
|
272
285
|
* It takes options as an object with the following keys and values:
|
|
273
286
|
*/
|
|
274
|
-
<TData, TVariables extends OperationVariables, TCache extends ApolloCache, TOptions extends ApolloClient.MutateOptions<NoInfer<TData>,
|
|
275
|
-
|
|
276
|
-
}
|
|
287
|
+
<TData, TVariables extends OperationVariables, TCache extends ApolloCache, TOptions extends Omit<ApolloClient.MutateOptions<NoInfer<TData>, any, TCache>, "variables"> & {
|
|
288
|
+
variables?: unknown;
|
|
289
|
+
}, TErrorPolicy extends ErrorPolicy | undefined = undefined>(options: TOptions & ApolloClient.mutate.OptionsFor<TData, TVariables, TCache, TOptions> & {
|
|
277
290
|
mutation: TypedDocumentNode<TData, TVariables>;
|
|
278
|
-
|
|
291
|
+
/**
|
|
292
|
+
* Specifies how the mutation handles a response that returns both GraphQL errors and partial results.
|
|
293
|
+
*
|
|
294
|
+
* For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).
|
|
295
|
+
*
|
|
296
|
+
* The default value is `none`, meaning that the mutation result includes error details but _not_ partial results.
|
|
297
|
+
*
|
|
298
|
+
* @docGroup 1. Operation options
|
|
299
|
+
*/
|
|
300
|
+
errorPolicy?: TErrorPolicy;
|
|
301
|
+
}): Promise<ApolloClient.mutate.ResultForOptions<TData, TErrorPolicy>>;
|
|
279
302
|
}
|
|
280
303
|
type Evaluated = SignatureStyle extends "classic" ? Classic : Modern;
|
|
281
304
|
}
|
|
@@ -473,7 +496,18 @@ export declare namespace ApolloClient {
|
|
|
473
496
|
export namespace query {
|
|
474
497
|
interface DefaultOptions extends ApolloClient.DefaultOptions.Query.Calculated {
|
|
475
498
|
}
|
|
476
|
-
type
|
|
499
|
+
type OptionsFor<TData, TVariables extends OperationVariables, TOptions extends {
|
|
500
|
+
variables?: unknown;
|
|
501
|
+
}> = QueryOptions<NoInfer<TData>, NoInfer<TVariables>> & {
|
|
502
|
+
variables?: Prettify<TVariables & {
|
|
503
|
+
[K in keyof TOptions["variables"]]: K extends keyof TVariables ? TVariables[K] : never;
|
|
504
|
+
}>;
|
|
505
|
+
} & (Exclude<keyof TOptions, keyof QueryOptions<any, any>> extends (infer InvalidOptionNames extends string) ? [
|
|
506
|
+
InvalidOptionNames
|
|
507
|
+
] extends [never] ? unknown : {
|
|
508
|
+
[K in InvalidOptionNames]: never;
|
|
509
|
+
} : never);
|
|
510
|
+
type ResultForOptions<TData, TVariables extends OperationVariables, TOptions extends Record<string, unknown> | Omit<QueryOptions<any, any>, "variables">> = LazyType<QueryResult<MaybeMasked<TData>, OptionWithFallback<TOptions, DefaultOptions, "errorPolicy"> & ErrorPolicy>>;
|
|
477
511
|
namespace Signatures {
|
|
478
512
|
interface Classic {
|
|
479
513
|
/**
|
|
@@ -515,9 +549,9 @@ export declare namespace ApolloClient {
|
|
|
515
549
|
* describe how this query should be treated e.g. whether it should hit the
|
|
516
550
|
* server at all or just resolve from the cache, etc.
|
|
517
551
|
*/
|
|
518
|
-
<TData, TVariables extends OperationVariables, TOptions extends ApolloClient.QueryOptions<NoInfer<TData>,
|
|
519
|
-
|
|
520
|
-
}
|
|
552
|
+
<TData, TVariables extends OperationVariables, TOptions extends Omit<ApolloClient.QueryOptions<NoInfer<TData>, any>, "variables"> & {
|
|
553
|
+
variables?: unknown;
|
|
554
|
+
}>(options: TOptions & ApolloClient.query.OptionsFor<TData, TVariables, TOptions> & {
|
|
521
555
|
query: TypedDocumentNode<TData, TVariables>;
|
|
522
556
|
}): Promise<ApolloClient.query.ResultForOptions<TData, TVariables, TOptions>>;
|
|
523
557
|
}
|