@apollo/client 4.0.0-alpha.1 → 4.0.0-alpha.2
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/.changeset/cuddly-spiders-tie.md +5 -0
- package/.changeset/gorgeous-chefs-tap.md +5 -0
- package/.changeset/hip-vans-act.md +5 -0
- package/.changeset/nervous-goats-allow.md +5 -0
- package/.changeset/pre.json +8 -0
- package/.changeset/slimy-maps-press.md +5 -0
- package/.changeset/small-buttons-rhyme.md +5 -0
- package/.changeset/tall-bikes-develop.md +5 -0
- package/.changeset/young-phones-fold.md +5 -0
- package/CHANGELOG.md +22 -0
- package/__cjs/cache/core/cache.cjs +1 -1
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +17 -17
- package/__cjs/cache/core/types/Cache.cjs.map +1 -1
- package/__cjs/cache/core/types/Cache.d.cts +9 -16
- package/__cjs/cache/core/types/DataProxy.d.cts +8 -23
- package/__cjs/cache/inmemory/entityStore.cjs +2 -4
- package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/entityStore.d.cts +2 -2
- package/__cjs/cache/inmemory/fragmentRegistry.cjs +3 -3
- package/__cjs/cache/inmemory/fragmentRegistry.cjs.map +1 -1
- package/__cjs/cache/inmemory/helpers.cjs +0 -8
- package/__cjs/cache/inmemory/helpers.cjs.map +1 -1
- package/__cjs/cache/inmemory/helpers.d.cts +3 -4
- package/__cjs/cache/inmemory/inMemoryCache.cjs +4 -12
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.d.cts +7 -8
- package/__cjs/cache/inmemory/policies.cjs +5 -5
- package/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.d.cts +1 -1
- package/__cjs/cache/inmemory/reactiveVars.cjs.map +1 -1
- package/__cjs/cache/inmemory/reactiveVars.d.cts +6 -6
- package/__cjs/cache/inmemory/readFromStore.cjs +12 -54
- package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/readFromStore.d.cts +1 -6
- package/__cjs/cache/inmemory/types.d.cts +3 -17
- package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
- package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/writeToStore.d.cts +2 -2
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +18 -18
- package/__cjs/core/LocalState.cjs.map +1 -1
- package/__cjs/core/LocalState.d.cts +8 -8
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +4 -4
- package/__cjs/core/QueryInfo.cjs +0 -1
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +1 -1
- package/__cjs/core/QueryManager.cjs +1 -1
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/QueryManager.d.cts +26 -16
- package/__cjs/core/types.d.cts +4 -4
- package/__cjs/core/watchQueryOptions.d.cts +10 -26
- package/__cjs/link/http/createHttpLink.d.cts +2 -1
- package/__cjs/link/persisted-queries/index.cjs +1 -1
- package/__cjs/link/persisted-queries/index.cjs.map +1 -1
- package/__cjs/link/persisted-queries/index.d.cts +12 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs +1 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.d.cts +10 -1
- package/__cjs/masking/maskDefinition.cjs.map +1 -1
- package/__cjs/masking/maskDefinition.d.cts +1 -1
- package/__cjs/masking/maskFragment.cjs.map +1 -1
- package/__cjs/masking/maskFragment.d.cts +1 -1
- package/__cjs/masking/maskOperation.cjs.map +1 -1
- package/__cjs/masking/maskOperation.d.cts +1 -1
- package/__cjs/react/context/ApolloConsumer.cjs.map +1 -1
- package/__cjs/react/context/ApolloConsumer.d.cts +1 -1
- package/__cjs/react/context/ApolloContext.cjs.map +1 -1
- package/__cjs/react/context/ApolloContext.d.cts +1 -1
- package/__cjs/react/context/ApolloProvider.cjs.map +1 -1
- package/__cjs/react/context/ApolloProvider.d.cts +3 -3
- package/__cjs/react/hooks/internal/__use.d.cts +3 -1
- package/__cjs/react/hooks/internal/useIsomorphicLayoutEffect.d.cts +1 -1
- package/__cjs/react/hooks/internal/wrapHook.cjs.map +1 -1
- package/__cjs/react/hooks/internal/wrapHook.d.cts +1 -1
- package/__cjs/react/hooks/useApolloClient.cjs.map +1 -1
- package/__cjs/react/hooks/useApolloClient.d.cts +1 -1
- package/__cjs/react/hooks/useFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useFragment.d.cts +3 -3
- package/__cjs/react/hooks/useLazyQuery.cjs +2 -2
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.d.cts +4 -12
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.d.cts +1 -1
- package/__cjs/react/hooks/useQuery.cjs +11 -20
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +1 -1
- package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
- package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
- package/__cjs/react/hooks/useSubscription.d.cts +7 -1
- package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseFragment.d.cts +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.d.cts +2 -2
- package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/FragmentReference.d.cts +3 -3
- package/__cjs/react/internal/cache/QueryReference.cjs +1 -6
- package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/QueryReference.d.cts +6 -6
- package/__cjs/react/internal/cache/SuspenseCache.cjs.map +1 -1
- package/__cjs/react/internal/cache/SuspenseCache.d.cts +3 -3
- package/__cjs/react/internal/cache/getSuspenseCache.cjs.map +1 -1
- package/__cjs/react/internal/cache/getSuspenseCache.d.cts +2 -2
- package/__cjs/react/parser/index.cjs +1 -1
- package/__cjs/react/parser/index.cjs.map +1 -1
- package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
- package/__cjs/react/query-preloader/createQueryPreloader.d.cts +1 -9
- package/__cjs/react/types/types.d.cts +31 -49
- package/__cjs/react/types/types.documentation.d.cts +0 -12
- package/__cjs/testing/core/mocking/mockClient.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockClient.d.cts +1 -2
- package/__cjs/testing/internal/disposables/withProdMode.d.cts +1 -1
- package/__cjs/testing/internal/incremental.d.cts +3 -2
- package/__cjs/testing/internal/renderHelpers.cjs.map +1 -1
- package/__cjs/testing/internal/renderHelpers.d.cts +2 -2
- package/__cjs/testing/internal/scenarios/index.d.cts +16 -5
- package/__cjs/testing/react/MockedProvider.cjs.map +1 -1
- package/__cjs/testing/react/MockedProvider.d.cts +3 -3
- package/__cjs/utilities/common/errorHandling.d.cts +1 -1
- package/__cjs/utilities/internal/getMemoryInternals.cjs.map +1 -1
- package/__cjs/utilities/internal/getMemoryInternals.d.cts +1 -1
- package/__cjs/utilities/types/NoInfer.d.cts +1 -1
- package/__cjs/version.cjs +1 -1
- package/__cjs/version.d.cts +1 -1
- package/cache/core/cache.d.ts +17 -17
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +9 -16
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +8 -23
- package/cache/inmemory/entityStore.d.ts +2 -2
- package/cache/inmemory/entityStore.js +2 -4
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +0 -1
- package/cache/inmemory/helpers.js +0 -7
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +7 -8
- package/cache/inmemory/inMemoryCache.js +4 -12
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/policies.d.ts +1 -1
- package/cache/inmemory/policies.js +5 -5
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/reactiveVars.d.ts +6 -6
- package/cache/inmemory/reactiveVars.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +1 -6
- package/cache/inmemory/readFromStore.js +12 -54
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +3 -17
- package/cache/inmemory/writeToStore.d.ts +2 -2
- package/cache/inmemory/writeToStore.js +4 -4
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts +18 -18
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +6 -6
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +3 -3
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +1 -1
- package/core/QueryInfo.js +0 -1
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +13 -13
- package/core/QueryManager.js.map +1 -1
- package/core/types.d.ts +4 -4
- package/core/watchQueryOptions.d.ts +10 -26
- package/masking/maskDefinition.d.ts +1 -1
- package/masking/maskDefinition.js.map +1 -1
- package/masking/maskFragment.d.ts +1 -1
- package/masking/maskFragment.js.map +1 -1
- package/masking/maskOperation.d.ts +1 -1
- package/masking/maskOperation.js.map +1 -1
- package/package.json +1 -1
- package/react/context/ApolloConsumer.d.ts +1 -1
- package/react/context/ApolloConsumer.js.map +1 -1
- package/react/context/ApolloContext.d.ts +1 -1
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.d.ts +3 -3
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/hooks/internal/wrapHook.d.ts +1 -1
- package/react/hooks/internal/wrapHook.js.map +1 -1
- package/react/hooks/useApolloClient.d.ts +1 -1
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useFragment.d.ts +3 -3
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +4 -12
- package/react/hooks/useLazyQuery.js +2 -2
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +1 -1
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +1 -1
- package/react/hooks/useQuery.js +11 -20
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useQueryRefHandlers.js.map +1 -1
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +1 -1
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseFragment.d.ts +1 -1
- package/react/hooks/useSuspenseFragment.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +2 -2
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/internal/cache/FragmentReference.d.ts +3 -3
- package/react/internal/cache/FragmentReference.js.map +1 -1
- package/react/internal/cache/QueryReference.d.ts +1 -1
- package/react/internal/cache/QueryReference.js +1 -6
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/internal/cache/SuspenseCache.d.ts +3 -3
- package/react/internal/cache/SuspenseCache.js.map +1 -1
- package/react/internal/cache/getSuspenseCache.d.ts +1 -1
- package/react/internal/cache/getSuspenseCache.js.map +1 -1
- package/react/query-preloader/createQueryPreloader.d.ts +1 -9
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/types/types.d.ts +31 -49
- package/react/types/types.documentation.d.ts +0 -12
- package/testing/core/mocking/mockClient.d.ts +1 -2
- package/testing/core/mocking/mockClient.js.map +1 -1
- package/testing/internal/renderHelpers.d.ts +2 -2
- package/testing/internal/renderHelpers.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +3 -3
- package/testing/react/MockedProvider.js.map +1 -1
- package/utilities/internal/getMemoryInternals.js.map +1 -1
- package/utilities/types/NoInfer.d.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/__cjs/cache/inmemory/object-canon.cjs +0 -180
- package/__cjs/cache/inmemory/object-canon.cjs.map +0 -1
- package/__cjs/cache/inmemory/object-canon.d.cts +0 -12
- package/cache/inmemory/object-canon.d.ts +0 -12
- package/cache/inmemory/object-canon.js +0 -176
- package/cache/inmemory/object-canon.js.map +0 -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 RefetchWritePolicy,\n TypedDocumentNode,\n WatchQueryFetchPolicy,\n WatchQueryOptions,\n} from \"@apollo/client/core\";\nimport type { NoInfer, VariablesOption } from \"@apollo/client/react\";\nimport type { PreloadedQueryRef } from \"@apollo/client/react/internal\";\nimport {\n InternalQueryReference,\n wrapQueryRef,\n} from \"@apollo/client/react/internal\";\nimport type {\n DeepPartial,\n OnlyRequiredProperties,\n} from \"@apollo/client/utilities\";\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#canonizeResults:member} */\n canonizeResults?: boolean;\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} & VariablesOption<TVariables>;\n\ntype PreloadQueryOptionsArg<\n TVariables extends OperationVariables,\n TOptions = unknown,\n> = [TVariables] extends [never] ?\n [options?: PreloadQueryOptions<never> & TOptions]\n: {} extends OnlyRequiredProperties<TVariables> ?\n [\n options?: PreloadQueryOptions<NoInfer<TVariables>> &\n Omit<TOptions, \"variables\">,\n ]\n: [\n options: PreloadQueryOptions<NoInfer<TVariables>> &\n Omit<TOptions, \"variables\">,\n ];\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 * ```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 /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <\n TData,\n TVariables extends OperationVariables,\n TOptions extends Omit<PreloadQueryOptions, \"variables\">,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: PreloadQueryOptionsArg<NoInfer<TVariables>, TOptions>\n ): PreloadedQueryRef<\n TOptions[\"errorPolicy\"] extends \"ignore\" | \"all\" ?\n TOptions[\"returnPartialData\"] extends true ?\n DeepPartial<TData> | undefined\n : TData | undefined\n : TOptions[\"returnPartialData\"] extends true ? DeepPartial<TData>\n : TData,\n TVariables\n >;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <TData = unknown, 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<DeepPartial<TData> | undefined, TVariables>;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <TData = unknown, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n errorPolicy: \"ignore\" | \"all\";\n }\n ): PreloadedQueryRef<TData | undefined, TVariables>;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <TData = unknown, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n returnPartialData: true;\n }\n ): PreloadedQueryRef<DeepPartial<TData>, TVariables>;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <TData = unknown, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: PreloadQueryOptionsArg<NoInfer<TVariables>>\n ): PreloadedQueryRef<TData, TVariables>;\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 * ```js\n * const preloadQuery = createQueryPreloader(client);\n * ```\n * @since 3.9.0\n */\nexport function createQueryPreloader(\n client: ApolloClient<any>\n): PreloadQueryFunction {\n return wrapHook(\n \"createQueryPreloader\",\n _createQueryPreloader,\n client\n )(client);\n}\n\nconst _createQueryPreloader: typeof createQueryPreloader = (client) => {\n return 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 } as WatchQueryOptions<any, any>),\n {\n autoDisposeTimeoutMs:\n client.defaultOptions.react?.suspense?.autoDisposeTimeoutMs,\n }\n );\n\n return wrapQueryRef(queryRef) as PreloadedQueryRef<TData, TVariables>;\n };\n};\n"],"names":[],"mappings":";;AA4JA,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;AA/IA,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;AASA,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,C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A,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACqE;QACrE,CAAO,CACF;QAED,CAAJ,CAAA,CAAA,CAAA,CAAA,EAAW,CAAX,CAAA,EAAW,CAAX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuB,CAAvB,CAAwB,CAAxB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgC,CAAyC;IACvE,CAAC;AACH,CAAA;"}
|
|
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 RefetchWritePolicy,\n TypedDocumentNode,\n WatchQueryFetchPolicy,\n WatchQueryOptions,\n} from \"@apollo/client/core\";\nimport type { NoInfer, VariablesOption } from \"@apollo/client/react\";\nimport type { PreloadedQueryRef } from \"@apollo/client/react/internal\";\nimport {\n InternalQueryReference,\n wrapQueryRef,\n} from \"@apollo/client/react/internal\";\nimport type {\n DeepPartial,\n OnlyRequiredProperties,\n} from \"@apollo/client/utilities\";\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} & VariablesOption<TVariables>;\n\ntype PreloadQueryOptionsArg<\n TVariables extends OperationVariables,\n TOptions = unknown,\n> = [TVariables] extends [never] ?\n [options?: PreloadQueryOptions<never> & TOptions]\n: {} extends OnlyRequiredProperties<TVariables> ?\n [\n options?: PreloadQueryOptions<NoInfer<TVariables>> &\n Omit<TOptions, \"variables\">,\n ]\n: [\n options: PreloadQueryOptions<NoInfer<TVariables>> &\n Omit<TOptions, \"variables\">,\n ];\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 * ```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 /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <\n TData,\n TVariables extends OperationVariables,\n TOptions extends Omit<PreloadQueryOptions, \"variables\">,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: PreloadQueryOptionsArg<NoInfer<TVariables>, TOptions>\n ): PreloadedQueryRef<\n TOptions[\"errorPolicy\"] extends \"ignore\" | \"all\" ?\n TOptions[\"returnPartialData\"] extends true ?\n DeepPartial<TData> | undefined\n : TData | undefined\n : TOptions[\"returnPartialData\"] extends true ? DeepPartial<TData>\n : TData,\n TVariables\n >;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <TData = unknown, 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<DeepPartial<TData> | undefined, TVariables>;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <TData = unknown, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n errorPolicy: \"ignore\" | \"all\";\n }\n ): PreloadedQueryRef<TData | undefined, TVariables>;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <TData = unknown, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: PreloadQueryOptions<NoInfer<TVariables>> & {\n returnPartialData: true;\n }\n ): PreloadedQueryRef<DeepPartial<TData>, TVariables>;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <TData = unknown, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: PreloadQueryOptionsArg<NoInfer<TVariables>>\n ): PreloadedQueryRef<TData, TVariables>;\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 * ```js\n * const preloadQuery = createQueryPreloader(client);\n * ```\n * @since 3.9.0\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 return 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 } as WatchQueryOptions<any, any>),\n {\n autoDisposeTimeoutMs:\n client.defaultOptions.react?.suspense?.autoDisposeTimeoutMs,\n }\n );\n\n return wrapQueryRef(queryRef) as PreloadedQueryRef<TData, TVariables>;\n };\n};\n"],"names":[],"mappings":";;AA0JA,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;AA7IA,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;AASA,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,CA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AAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACqE;QACrE,CAAO,CACF;QAED,CAAJ,CAAA,CAAA,CAAA,CAAA,EAAW,CAAX,CAAA,EAAW,CAAX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuB,CAAvB,CAAwB,CAAxB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgC,CAAyC;IACvE,CAAC;AACH,CAAA;"}
|
|
@@ -4,14 +4,6 @@ import type { PreloadedQueryRef } from "@apollo/client/react/internal";
|
|
|
4
4
|
import type { DeepPartial, OnlyRequiredProperties } from "@apollo/client/utilities";
|
|
5
5
|
export type PreloadQueryFetchPolicy = Extract<WatchQueryFetchPolicy, "cache-first" | "network-only" | "no-cache" | "cache-and-network">;
|
|
6
6
|
export type PreloadQueryOptions<TVariables extends OperationVariables = OperationVariables> = {
|
|
7
|
-
/**
|
|
8
|
-
* Whether to canonize cache results before returning them. Canonization takes some extra time, but it speeds up future deep equality comparisons. Defaults to false.
|
|
9
|
-
*
|
|
10
|
-
* @deprecated
|
|
11
|
-
*
|
|
12
|
-
* Using `canonizeResults` can result in memory leaks so we generally do not recommend using this option anymore. A future version of Apollo Client will contain a similar feature without the risk of memory leaks.
|
|
13
|
-
*/
|
|
14
|
-
canonizeResults?: boolean;
|
|
15
7
|
/**
|
|
16
8
|
* If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain.
|
|
17
9
|
*
|
|
@@ -243,6 +235,6 @@ export interface PreloadQueryFunction {
|
|
|
243
235
|
* ```
|
|
244
236
|
* @since 3.9.0
|
|
245
237
|
*/
|
|
246
|
-
export declare function createQueryPreloader(client: ApolloClient
|
|
238
|
+
export declare function createQueryPreloader(client: ApolloClient): PreloadQueryFunction;
|
|
247
239
|
export {};
|
|
248
240
|
//# sourceMappingURL=createQueryPreloader.d.cts.map
|
|
@@ -9,9 +9,9 @@ import type { MutationSharedOptions, SharedWatchQueryOptions } from "../../core/
|
|
|
9
9
|
export type { PreloadedQueryRef, QueryRef, QueryReference, } from "../internal/index.cjs";
|
|
10
10
|
export type { DefaultContext as Context } from "../../core/index.cjs";
|
|
11
11
|
export type CommonOptions<TOptions> = TOptions & {
|
|
12
|
-
client?: ApolloClient
|
|
12
|
+
client?: ApolloClient;
|
|
13
13
|
};
|
|
14
|
-
export interface BaseQueryOptions<TVariables extends OperationVariables = OperationVariables, TData =
|
|
14
|
+
export interface BaseQueryOptions<TVariables extends OperationVariables = OperationVariables, TData = unknown> extends SharedWatchQueryOptions<TVariables, TData> {
|
|
15
15
|
/**
|
|
16
16
|
* Pass `false` to skip executing the query during [server-side rendering](https://www.apollographql.com/docs/react/performance/server-side-rendering/).
|
|
17
17
|
*
|
|
@@ -29,7 +29,7 @@ export interface BaseQueryOptions<TVariables extends OperationVariables = Operat
|
|
|
29
29
|
*
|
|
30
30
|
* 1. Operation options
|
|
31
31
|
*/
|
|
32
|
-
client?: ApolloClient
|
|
32
|
+
client?: ApolloClient;
|
|
33
33
|
/**
|
|
34
34
|
* If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain.
|
|
35
35
|
*
|
|
@@ -39,7 +39,7 @@ export interface BaseQueryOptions<TVariables extends OperationVariables = Operat
|
|
|
39
39
|
*/
|
|
40
40
|
context?: DefaultContext;
|
|
41
41
|
}
|
|
42
|
-
export interface QueryFunctionOptions<TData =
|
|
42
|
+
export interface QueryFunctionOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> extends BaseQueryOptions<TVariables, TData> {
|
|
43
43
|
/**
|
|
44
44
|
* If true, the query is not executed.
|
|
45
45
|
*
|
|
@@ -50,8 +50,6 @@ export interface QueryFunctionOptions<TData = any, TVariables extends OperationV
|
|
|
50
50
|
* 1. Operation options
|
|
51
51
|
*/
|
|
52
52
|
skip?: boolean;
|
|
53
|
-
/** @internal */
|
|
54
|
-
defaultOptions?: Partial<WatchQueryOptions<TVariables, TData>>;
|
|
55
53
|
}
|
|
56
54
|
export interface ObservableQueryFields<TData, TVariables extends OperationVariables> {
|
|
57
55
|
/**
|
|
@@ -131,7 +129,7 @@ export interface ObservableQueryFields<TData, TVariables extends OperationVariab
|
|
|
131
129
|
}) => Unmasked<TData>;
|
|
132
130
|
}) => Promise<ApolloQueryResult<MaybeMasked<TFetchData>>>;
|
|
133
131
|
}
|
|
134
|
-
export interface QueryResult<TData =
|
|
132
|
+
export interface QueryResult<TData = unknown, TVariables extends OperationVariables = OperationVariables> extends ObservableQueryFields<TData, TVariables> {
|
|
135
133
|
/**
|
|
136
134
|
* The instance of Apollo Client that executed the query. Can be useful for manually executing followup queries or writing data to the cache.
|
|
137
135
|
*
|
|
@@ -139,7 +137,7 @@ export interface QueryResult<TData = any, TVariables extends OperationVariables
|
|
|
139
137
|
*
|
|
140
138
|
* 2. Network info
|
|
141
139
|
*/
|
|
142
|
-
client: ApolloClient
|
|
140
|
+
client: ApolloClient;
|
|
143
141
|
/**
|
|
144
142
|
* A reference to the internal `ObservableQuery` used by the hook.
|
|
145
143
|
*/
|
|
@@ -203,7 +201,7 @@ export interface QueryResult<TData = any, TVariables extends OperationVariables
|
|
|
203
201
|
*/
|
|
204
202
|
called: boolean;
|
|
205
203
|
}
|
|
206
|
-
export interface QueryDataOptions<TData =
|
|
204
|
+
export interface QueryDataOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> extends QueryFunctionOptions<TData, TVariables> {
|
|
207
205
|
children?: (result: QueryResult<TData, TVariables>) => ReactTypes.ReactNode;
|
|
208
206
|
/**
|
|
209
207
|
* A GraphQL query string parsed into an AST with the gql template literal.
|
|
@@ -214,7 +212,7 @@ export interface QueryDataOptions<TData = any, TVariables extends OperationVaria
|
|
|
214
212
|
*/
|
|
215
213
|
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
|
|
216
214
|
}
|
|
217
|
-
export interface QueryHookOptions<TData =
|
|
215
|
+
export interface QueryHookOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> extends QueryFunctionOptions<TData, TVariables> {
|
|
218
216
|
}
|
|
219
217
|
export type SuspenseQueryHookFetchPolicy = Extract<WatchQueryFetchPolicy, "cache-first" | "network-only" | "no-cache" | "cache-and-network">;
|
|
220
218
|
export interface SuspenseQueryHookOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> {
|
|
@@ -227,7 +225,7 @@ export interface SuspenseQueryHookOptions<TData = unknown, TVariables extends Op
|
|
|
227
225
|
*
|
|
228
226
|
* 1. Operation options
|
|
229
227
|
*/
|
|
230
|
-
client?: ApolloClient
|
|
228
|
+
client?: ApolloClient;
|
|
231
229
|
/**
|
|
232
230
|
* If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain.
|
|
233
231
|
*
|
|
@@ -259,14 +257,6 @@ export interface SuspenseQueryHookOptions<TData = unknown, TVariables extends Op
|
|
|
259
257
|
*/
|
|
260
258
|
errorPolicy?: ErrorPolicy;
|
|
261
259
|
/**
|
|
262
|
-
* Whether to canonize cache results before returning them. Canonization takes some extra time, but it speeds up future deep equality comparisons. Defaults to false.
|
|
263
|
-
*
|
|
264
|
-
* @deprecated
|
|
265
|
-
*
|
|
266
|
-
* Using `canonizeResults` can result in memory leaks so we generally do not recommend using this option anymore. A future version of Apollo Client will contain a similar feature without the risk of memory leaks.
|
|
267
|
-
*/
|
|
268
|
-
canonizeResults?: boolean;
|
|
269
|
-
/**
|
|
270
260
|
* If `true`, the query can return partial results from the cache if the cache doesn't contain results for all queried fields.
|
|
271
261
|
*
|
|
272
262
|
* The default value is `false`.
|
|
@@ -332,7 +322,7 @@ export interface SuspenseQueryHookOptions<TData = unknown, TVariables extends Op
|
|
|
332
322
|
skip?: boolean;
|
|
333
323
|
}
|
|
334
324
|
export type BackgroundQueryHookFetchPolicy = Extract<WatchQueryFetchPolicy, "cache-first" | "network-only" | "no-cache" | "cache-and-network">;
|
|
335
|
-
export interface BackgroundQueryHookOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> extends Pick<QueryHookOptions<TData, TVariables>, "client" | "variables" | "errorPolicy" | "context" | "
|
|
325
|
+
export interface BackgroundQueryHookOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> extends Pick<QueryHookOptions<TData, TVariables>, "client" | "variables" | "errorPolicy" | "context" | "returnPartialData" | "refetchWritePolicy"> {
|
|
336
326
|
fetchPolicy?: BackgroundQueryHookFetchPolicy;
|
|
337
327
|
queryKey?: string | number | any[];
|
|
338
328
|
/**
|
|
@@ -360,14 +350,6 @@ export interface BackgroundQueryHookOptions<TData = unknown, TVariables extends
|
|
|
360
350
|
}
|
|
361
351
|
export type LoadableQueryHookFetchPolicy = Extract<WatchQueryFetchPolicy, "cache-first" | "network-only" | "no-cache" | "cache-and-network">;
|
|
362
352
|
export interface LoadableQueryHookOptions {
|
|
363
|
-
/**
|
|
364
|
-
* Whether to canonize cache results before returning them. Canonization takes some extra time, but it speeds up future deep equality comparisons. Defaults to false.
|
|
365
|
-
*
|
|
366
|
-
* @deprecated
|
|
367
|
-
*
|
|
368
|
-
* Using `canonizeResults` can result in memory leaks so we generally do not recommend using this option anymore. A future version of Apollo Client will contain a similar feature without the risk of memory leaks.
|
|
369
|
-
*/
|
|
370
|
-
canonizeResults?: boolean;
|
|
371
353
|
/**
|
|
372
354
|
* The instance of `ApolloClient` to use to execute the query.
|
|
373
355
|
*
|
|
@@ -377,7 +359,7 @@ export interface LoadableQueryHookOptions {
|
|
|
377
359
|
*
|
|
378
360
|
* 1. Operation options
|
|
379
361
|
*/
|
|
380
|
-
client?: ApolloClient
|
|
362
|
+
client?: ApolloClient;
|
|
381
363
|
/**
|
|
382
364
|
* If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain.
|
|
383
365
|
*
|
|
@@ -440,7 +422,7 @@ export interface LoadableQueryHookOptions {
|
|
|
440
422
|
returnPartialData?: boolean;
|
|
441
423
|
}
|
|
442
424
|
export type RefetchQueriesFunction = (...args: any[]) => InternalRefetchQueriesInclude;
|
|
443
|
-
export interface BaseMutationOptions<TData =
|
|
425
|
+
export interface BaseMutationOptions<TData = unknown, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache = ApolloCache> extends MutationSharedOptions<TData, TVariables, TContext, TCache> {
|
|
444
426
|
/**
|
|
445
427
|
* The instance of `ApolloClient` to use to execute the mutation.
|
|
446
428
|
*
|
|
@@ -450,7 +432,7 @@ export interface BaseMutationOptions<TData = any, TVariables = OperationVariable
|
|
|
450
432
|
*
|
|
451
433
|
* 2. Networking options
|
|
452
434
|
*/
|
|
453
|
-
client?: ApolloClient
|
|
435
|
+
client?: ApolloClient;
|
|
454
436
|
/**
|
|
455
437
|
* If `true`, the in-progress mutation's associated component re-renders whenever the network status changes or a network error occurs.
|
|
456
438
|
*
|
|
@@ -470,7 +452,7 @@ export interface BaseMutationOptions<TData = any, TVariables = OperationVariable
|
|
|
470
452
|
*
|
|
471
453
|
* 1. Operation options
|
|
472
454
|
*/
|
|
473
|
-
onCompleted?: (data: MaybeMasked<TData>, clientOptions?: BaseMutationOptions) => void;
|
|
455
|
+
onCompleted?: (data: MaybeMasked<TData>, clientOptions?: BaseMutationOptions<TData, TVariables, TContext, TCache>) => void;
|
|
474
456
|
/**
|
|
475
457
|
* A callback function that's called when the mutation encounters one or more errors (unless `errorPolicy` is `ignore`).
|
|
476
458
|
*
|
|
@@ -480,9 +462,9 @@ export interface BaseMutationOptions<TData = any, TVariables = OperationVariable
|
|
|
480
462
|
*
|
|
481
463
|
* 1. Operation options
|
|
482
464
|
*/
|
|
483
|
-
onError?: (error: ErrorLike, clientOptions?: BaseMutationOptions) => void;
|
|
465
|
+
onError?: (error: ErrorLike, clientOptions?: BaseMutationOptions<TData, TVariables, TContext, TCache>) => void;
|
|
484
466
|
}
|
|
485
|
-
export interface MutationFunctionOptions<TData =
|
|
467
|
+
export interface MutationFunctionOptions<TData = unknown, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache = ApolloCache> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {
|
|
486
468
|
/**
|
|
487
469
|
* A GraphQL document, often created with `gql` from the `graphql-tag` package, that contains a single mutation inside of it.
|
|
488
470
|
*
|
|
@@ -492,7 +474,7 @@ export interface MutationFunctionOptions<TData = any, TVariables = OperationVari
|
|
|
492
474
|
*/
|
|
493
475
|
mutation?: DocumentNode | TypedDocumentNode<TData, TVariables>;
|
|
494
476
|
}
|
|
495
|
-
export interface MutationResult<TData =
|
|
477
|
+
export interface MutationResult<TData = unknown> {
|
|
496
478
|
/**
|
|
497
479
|
* The data returned from your mutation. Can be `undefined` if `ignoreResults` is `true`.
|
|
498
480
|
*/
|
|
@@ -516,31 +498,31 @@ export interface MutationResult<TData = any> {
|
|
|
516
498
|
*
|
|
517
499
|
* Can be useful for manually executing followup operations or writing data to the cache.
|
|
518
500
|
*/
|
|
519
|
-
client: ApolloClient
|
|
501
|
+
client: ApolloClient;
|
|
520
502
|
/**
|
|
521
503
|
* A function that you can call to reset the mutation's result to its initial, uncalled state.
|
|
522
504
|
*/
|
|
523
505
|
reset: () => void;
|
|
524
506
|
}
|
|
525
|
-
export declare type MutationFunction<TData =
|
|
526
|
-
export interface MutationHookOptions<TData =
|
|
507
|
+
export declare type MutationFunction<TData = unknown, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache = ApolloCache> = (options?: MutationFunctionOptions<TData, TVariables, TContext, TCache>) => Promise<FetchResult<MaybeMasked<TData>>>;
|
|
508
|
+
export interface MutationHookOptions<TData = unknown, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache = ApolloCache> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {
|
|
527
509
|
}
|
|
528
|
-
export interface MutationDataOptions<TData =
|
|
510
|
+
export interface MutationDataOptions<TData = unknown, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache = ApolloCache> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {
|
|
529
511
|
mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;
|
|
530
512
|
}
|
|
531
|
-
export type MutationTuple<TData, TVariables, TContext = DefaultContext, TCache extends ApolloCache
|
|
513
|
+
export type MutationTuple<TData, TVariables, TContext = DefaultContext, TCache extends ApolloCache = ApolloCache> = [
|
|
532
514
|
mutate: (options?: MutationFunctionOptions<TData, TVariables, TContext, TCache>) => Promise<FetchResult<MaybeMasked<TData>>>,
|
|
533
515
|
result: MutationResult<TData>
|
|
534
516
|
];
|
|
535
|
-
export interface OnDataOptions<TData =
|
|
536
|
-
client: ApolloClient
|
|
517
|
+
export interface OnDataOptions<TData = unknown> {
|
|
518
|
+
client: ApolloClient;
|
|
537
519
|
data: SubscriptionResult<TData>;
|
|
538
520
|
}
|
|
539
|
-
export interface OnSubscriptionDataOptions<TData =
|
|
540
|
-
client: ApolloClient
|
|
521
|
+
export interface OnSubscriptionDataOptions<TData = unknown> {
|
|
522
|
+
client: ApolloClient;
|
|
541
523
|
subscriptionData: SubscriptionResult<TData>;
|
|
542
524
|
}
|
|
543
|
-
export interface BaseSubscriptionOptions<TData =
|
|
525
|
+
export interface BaseSubscriptionOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> {
|
|
544
526
|
/**
|
|
545
527
|
* An object containing all of the variables your subscription needs to execute
|
|
546
528
|
*/
|
|
@@ -560,7 +542,7 @@ export interface BaseSubscriptionOptions<TData = any, TVariables extends Operati
|
|
|
560
542
|
/**
|
|
561
543
|
* An `ApolloClient` instance. By default `useSubscription` / `Subscription` uses the client passed down via context, but a different client can be passed in.
|
|
562
544
|
*/
|
|
563
|
-
client?: ApolloClient
|
|
545
|
+
client?: ApolloClient;
|
|
564
546
|
/**
|
|
565
547
|
* Determines if the current subscription should be skipped. Useful if, for example, variables depend on previous queries and are not ready yet.
|
|
566
548
|
*/
|
|
@@ -622,7 +604,7 @@ export interface BaseSubscriptionOptions<TData = any, TVariables extends Operati
|
|
|
622
604
|
*/
|
|
623
605
|
ignoreResults?: boolean;
|
|
624
606
|
}
|
|
625
|
-
export interface SubscriptionResult<TData =
|
|
607
|
+
export interface SubscriptionResult<TData = unknown, TVariables = OperationVariables> {
|
|
626
608
|
/**
|
|
627
609
|
* A boolean that indicates whether any initial data has been returned
|
|
628
610
|
*/
|
|
@@ -640,12 +622,12 @@ export interface SubscriptionResult<TData = any, TVariables = any> {
|
|
|
640
622
|
*/
|
|
641
623
|
variables?: TVariables;
|
|
642
624
|
}
|
|
643
|
-
export interface SubscriptionHookOptions<TData =
|
|
625
|
+
export interface SubscriptionHookOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> extends BaseSubscriptionOptions<TData, TVariables> {
|
|
644
626
|
}
|
|
645
627
|
/**
|
|
646
628
|
* @deprecated This type is not used anymore. It will be removed in the next major version of Apollo Client
|
|
647
629
|
*/
|
|
648
|
-
export interface SubscriptionDataOptions<TData =
|
|
630
|
+
export interface SubscriptionDataOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> extends BaseSubscriptionOptions<TData, TVariables> {
|
|
649
631
|
subscription: DocumentNode | TypedDocumentNode<TData, TVariables>;
|
|
650
632
|
children?: null | ((result: SubscriptionResult<TData>) => ReactTypes.ReactNode);
|
|
651
633
|
}
|
|
@@ -94,18 +94,6 @@ export interface QueryOptionsDocumentation {
|
|
|
94
94
|
* @docGroup 3. Caching options
|
|
95
95
|
*/
|
|
96
96
|
refetchWritePolicy_suspense: unknown;
|
|
97
|
-
/**
|
|
98
|
-
* Whether to canonize cache results before returning them. Canonization
|
|
99
|
-
* takes some extra time, but it speeds up future deep equality comparisons.
|
|
100
|
-
* Defaults to false.
|
|
101
|
-
*
|
|
102
|
-
* @deprecated
|
|
103
|
-
* Using `canonizeResults` can result in memory leaks so we generally do not
|
|
104
|
-
* recommend using this option anymore.
|
|
105
|
-
* A future version of Apollo Client will contain a similar feature without
|
|
106
|
-
* the risk of memory leaks.
|
|
107
|
-
*/
|
|
108
|
-
canonizeResults: unknown;
|
|
109
97
|
/**
|
|
110
98
|
* If true, the query is not executed.
|
|
111
99
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockClient.cjs","sources":["../../../../../src/testing/core/mocking/mockClient.ts"],"sourcesContent":["import type { DocumentNode } from \"graphql\";\n\nimport
|
|
1
|
+
{"version":3,"file":"mockClient.cjs","sources":["../../../../../src/testing/core/mocking/mockClient.ts"],"sourcesContent":["import type { DocumentNode } from \"graphql\";\n\nimport { InMemoryCache } from \"@apollo/client/cache\";\nimport { ApolloClient } from \"@apollo/client/core\";\n\nimport { mockSingleLink } from \"./mockLink.js\";\n\nexport function createMockClient<TData>(\n data: TData,\n query: DocumentNode,\n variables = {}\n): ApolloClient {\n return new ApolloClient({\n link: mockSingleLink({\n request: { query, variables },\n result: { data },\n }).setOnError((error) => {\n throw error;\n }),\n cache: new InMemoryCache(),\n });\n}\n"],"names":[],"mappings":";;AAOA,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;AALA,CAAA,CAAA,CAAA,CAAA,EAAA,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;AACA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,C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,CAAa,EAAE,EAAE,CAAjB,CAAA,CAAA,CAAA,CAAsB,EAAE,CAAxB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAmC;YAC7B,CAAN,CAAA,CAAA,CAAA,CAAA,CAAY,EAAE,EAAE,CAAhB,CAAA,CAAA,EAAA,CAAsB;QACtB,CAAK,CAAC,CAAC,CAAP,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiB,CAAC,CAAC,CAAnB,CAAA,CAAA,CAAA,CAAwB,EAAE,CAA1B,EAAA;YACM,CAAN,CAAA,CAAA,CAAA,EAAY,CAAZ,CAAA,CAAA,CAAA,CAAiB;QACb,CAAC,CAAC;QACF,CAAJ,CAAA,CAAA,CAAA,CAAS,EAAE,CAAX,CAAA,EAAe,CAAf,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA4B,CAA5B,CAA8B;IAC9B,CAAG,CAAC;AACJ;"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { DocumentNode } from "graphql";
|
|
2
|
-
import type { NormalizedCacheObject } from "@apollo/client/cache";
|
|
3
2
|
import { ApolloClient } from "@apollo/client/core";
|
|
4
|
-
export declare function createMockClient<TData>(data: TData, query: DocumentNode, variables?: {}): ApolloClient
|
|
3
|
+
export declare function createMockClient<TData>(data: TData, query: DocumentNode, variables?: {}): ApolloClient;
|
|
5
4
|
//# sourceMappingURL=mockClient.d.cts.map
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { GraphQLFormattedError, InitialIncrementalExecutionResult, SubsequentIncrementalExecutionResult } from "graphql-17-alpha2";
|
|
2
2
|
import type { ApolloPayloadResult } from "@apollo/client/core";
|
|
3
|
+
import { HttpLink } from "@apollo/client/link/http";
|
|
3
4
|
export declare function mockDeferStream<TData = Record<string, unknown>, TExtensions = Record<string, unknown>>(): {
|
|
4
|
-
httpLink:
|
|
5
|
+
httpLink: HttpLink;
|
|
5
6
|
enqueueInitialChunk(chunk: InitialIncrementalExecutionResult<TData, TExtensions>): void;
|
|
6
7
|
enqueueSubsequentChunk(chunk: SubsequentIncrementalExecutionResult<TData, TExtensions>): void;
|
|
7
8
|
enqueueErrorChunk(errors: GraphQLFormattedError[]): void;
|
|
8
9
|
};
|
|
9
10
|
export declare function mockMultipartSubscriptionStream<TData = Record<string, unknown>, TExtensions = Record<string, unknown>>(): {
|
|
10
|
-
httpLink:
|
|
11
|
+
httpLink: HttpLink;
|
|
11
12
|
enqueueHeartbeat: () => void;
|
|
12
13
|
enqueuePayloadResult(payload: ApolloPayloadResult<TData, TExtensions>["payload"], hasNext?: boolean): void;
|
|
13
14
|
enqueueProtocolErrors(errors: ApolloPayloadResult["errors"]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderHelpers.cjs","sources":["../../../../src/testing/internal/renderHelpers.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport type { ApolloClient } from \"@apollo/client/core\";\nimport { ApolloProvider } from \"@apollo/client/react\";\nimport type { MockedProviderProps } from \"@apollo/client/testing/react\";\nimport { MockedProvider } from \"@apollo/client/testing/react\";\n\nexport function createClientWrapper(\n client: ApolloClient
|
|
1
|
+
{"version":3,"file":"renderHelpers.cjs","sources":["../../../../src/testing/internal/renderHelpers.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport type { ApolloClient } from \"@apollo/client/core\";\nimport { ApolloProvider } from \"@apollo/client/react\";\nimport type { MockedProviderProps } from \"@apollo/client/testing/react\";\nimport { MockedProvider } from \"@apollo/client/testing/react\";\n\nexport function createClientWrapper(\n client: ApolloClient,\n Wrapper: React.JSXElementConstructor<{\n children: React.ReactNode;\n }> = React.Fragment\n): React.JSXElementConstructor<{\n children: React.ReactNode;\n}> {\n return ({ children }) => {\n return (\n <ApolloProvider client={client}>\n <Wrapper>{children}</Wrapper>\n </ApolloProvider>\n );\n };\n}\n\nexport function createMockWrapper(\n renderOptions: MockedProviderProps,\n Wrapper: React.JSXElementConstructor<{\n children: React.ReactNode;\n }> = React.Fragment\n): React.JSXElementConstructor<{\n children: React.ReactNode;\n}> {\n return ({ children }) => {\n return (\n <MockedProvider {...renderOptions}>\n <Wrapper>{children}</Wrapper>\n </MockedProvider>\n );\n };\n}\n"],"names":[],"mappings":";;AAOA,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;AAiBA,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;;AAxBA,CAAA,CAAA,CAAA,CAAA,EAAA,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;AAGA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA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CAAA,CAAA,CAC0B,CAD1B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA;YAEQ,CAAR,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,EAAhB,CAAA,CAAA,CAAA,CAAA,EAAkB,CAAlB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA0B,CAAW,CACd,CAClB;IACH,CAAC;AACH;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { ApolloClient } from "@apollo/client/core";
|
|
3
3
|
import type { MockedProviderProps } from "@apollo/client/testing/react";
|
|
4
|
-
export declare function createClientWrapper(client: ApolloClient
|
|
4
|
+
export declare function createClientWrapper(client: ApolloClient, Wrapper?: React.JSXElementConstructor<{
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
}>): React.JSXElementConstructor<{
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
}>;
|
|
9
|
-
export declare function createMockWrapper(renderOptions: MockedProviderProps
|
|
9
|
+
export declare function createMockWrapper(renderOptions: MockedProviderProps, Wrapper?: React.JSXElementConstructor<{
|
|
10
10
|
children: React.ReactNode;
|
|
11
11
|
}>): React.JSXElementConstructor<{
|
|
12
12
|
children: React.ReactNode;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import type { TypedDocumentNode } from "@apollo/client/core";
|
|
2
|
+
import { ApolloLink } from "@apollo/client/core";
|
|
3
|
+
import type { MaskedDocumentNode } from "@apollo/client/masking";
|
|
1
4
|
import type { MockedResponse } from "@apollo/client/testing/core";
|
|
2
5
|
export interface SimpleCaseData {
|
|
3
6
|
greeting: string;
|
|
4
7
|
}
|
|
5
8
|
export declare function setupSimpleCase(): {
|
|
6
9
|
query: TypedDocumentNode<SimpleCaseData, Record<string, never>>;
|
|
7
|
-
mocks: MockedResponse<SimpleCaseData
|
|
10
|
+
mocks: MockedResponse<SimpleCaseData, Record<string, any>>[];
|
|
8
11
|
};
|
|
9
12
|
export interface VariablesCaseData {
|
|
10
13
|
character: {
|
|
@@ -17,7 +20,7 @@ export interface VariablesCaseVariables {
|
|
|
17
20
|
id: string;
|
|
18
21
|
}
|
|
19
22
|
export declare function setupVariablesCase(): {
|
|
20
|
-
mocks: MockedResponse<VariablesCaseData
|
|
23
|
+
mocks: MockedResponse<VariablesCaseData, Record<string, any>>[];
|
|
21
24
|
query: TypedDocumentNode<VariablesCaseData, VariablesCaseVariables>;
|
|
22
25
|
};
|
|
23
26
|
type MaskedVariablesCaseFragment = {
|
|
@@ -44,11 +47,19 @@ export interface UnmaskedVariablesCaseData {
|
|
|
44
47
|
};
|
|
45
48
|
}
|
|
46
49
|
export declare function setupMaskedVariablesCase(): {
|
|
47
|
-
mocks: MockedResponse<MaskedVariablesCaseData
|
|
50
|
+
mocks: MockedResponse<MaskedVariablesCaseData, Record<string, any>>[];
|
|
48
51
|
query: MaskedDocumentNode<MaskedVariablesCaseData, VariablesCaseVariables>;
|
|
49
52
|
unmaskedQuery: TypedDocumentNode<MaskedVariablesCaseData, VariablesCaseVariables>;
|
|
50
53
|
};
|
|
51
|
-
export declare function addDelayToMocks<T extends MockedResponse<unknown>[]>(mocks: T, delay?: number, override?: boolean):
|
|
54
|
+
export declare function addDelayToMocks<T extends MockedResponse<unknown>[]>(mocks: T, delay?: number, override?: boolean): {
|
|
55
|
+
delay: number;
|
|
56
|
+
request: import("@apollo/client/core").GraphQLRequest<Record<string, any>>;
|
|
57
|
+
maxUsageCount?: number;
|
|
58
|
+
result?: import("@apollo/client/core").FetchResult<unknown> | import("@apollo/client/testing/core").ResultFunction<import("@apollo/client/core").FetchResult<unknown>, Record<string, any>> | undefined;
|
|
59
|
+
error?: Error;
|
|
60
|
+
variableMatcher?: ((arg: Record<string, any>) => boolean) | undefined;
|
|
61
|
+
newData?: import("@apollo/client/testing/core").ResultFunction<import("@apollo/client/core").FetchResult<unknown>, Record<string, any>> | undefined;
|
|
62
|
+
}[];
|
|
52
63
|
interface Letter {
|
|
53
64
|
__typename: "Letter";
|
|
54
65
|
letter: string;
|
|
@@ -63,7 +74,7 @@ export interface PaginatedCaseVariables {
|
|
|
63
74
|
}
|
|
64
75
|
export declare function setupPaginatedCase(): {
|
|
65
76
|
query: TypedDocumentNode<PaginatedCaseData, PaginatedCaseVariables>;
|
|
66
|
-
link:
|
|
77
|
+
link: ApolloLink;
|
|
67
78
|
data: {
|
|
68
79
|
__typename: string;
|
|
69
80
|
letter: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MockedProvider.cjs","sources":["../../../../src/testing/react/MockedProvider.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport type { ApolloCache } from \"@apollo/client/cache\";\nimport { InMemoryCache as Cache } from \"@apollo/client/cache\";\nimport type { DefaultOptions } from \"@apollo/client/core\";\nimport type { Resolvers } from \"@apollo/client/core\";\nimport { ApolloClient } from \"@apollo/client/core\";\nimport type { ApolloLink } from \"@apollo/client/link/core\";\nimport { ApolloProvider } from \"@apollo/client/react/context\";\nimport type { MockedResponse } from \"@apollo/client/testing/core\";\nimport { MockLink } from \"@apollo/client/testing/core\";\n\nexport interface MockedProviderProps
|
|
1
|
+
{"version":3,"file":"MockedProvider.cjs","sources":["../../../../src/testing/react/MockedProvider.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport type { ApolloCache } from \"@apollo/client/cache\";\nimport { InMemoryCache as Cache } from \"@apollo/client/cache\";\nimport type { DefaultOptions } from \"@apollo/client/core\";\nimport type { Resolvers } from \"@apollo/client/core\";\nimport { ApolloClient } from \"@apollo/client/core\";\nimport type { ApolloLink } from \"@apollo/client/link/core\";\nimport { ApolloProvider } from \"@apollo/client/react/context\";\nimport type { MockedResponse } from \"@apollo/client/testing/core\";\nimport { MockLink } from \"@apollo/client/testing/core\";\n\nexport interface MockedProviderProps {\n mocks?: ReadonlyArray<MockedResponse<any, any>>;\n defaultOptions?: DefaultOptions;\n cache?: ApolloCache;\n resolvers?: Resolvers;\n childProps?: object;\n children?: any;\n link?: ApolloLink;\n showWarnings?: boolean;\n /**\n * If set to true, the MockedProvider will try to connect to the Apollo DevTools.\n * Defaults to false.\n */\n connectToDevTools?: boolean;\n}\n\ninterface MockedProviderState {\n client: ApolloClient;\n}\n\nexport class MockedProvider extends React.Component<\n MockedProviderProps,\n MockedProviderState\n> {\n constructor(props: MockedProviderProps) {\n super(props);\n\n const {\n mocks,\n defaultOptions,\n cache,\n resolvers,\n link,\n showWarnings,\n connectToDevTools = false,\n } = this.props;\n const client = new ApolloClient({\n cache: cache || new Cache(),\n defaultOptions,\n connectToDevTools,\n link: link || new MockLink(mocks || [], { showWarnings }),\n resolvers,\n });\n\n this.state = {\n client,\n };\n }\n\n public render() {\n const { children, childProps } = this.props;\n const { client } = this.state;\n\n return React.isValidElement(children) ?\n <ApolloProvider client={client}>\n {React.cloneElement(React.Children.only(children), { ...childProps })}\n </ApolloProvider>\n : null;\n }\n\n public componentWillUnmount() {\n // Since this.state.client was created in the constructor, it's this\n // MockedProvider's responsibility to terminate it.\n this.state.client.stop();\n }\n}\n"],"names":[],"mappings":";;;;AAAA,CAAA,CAAA,CAAA,CAAA,EAAA,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;AAGA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA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CAAA,CAAA,CAAA,CAAA,CAA6B,CAA7B,EAAA;QACI,CAAJ,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA;QACI,CAAJ,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA;QACI,CAAJ,CAAA,CAAA,CAAQ,CAAC,CAAT,CAAA,CAAA,CAAA,CAAc,CAAC,CAAf,CAAA,CAAA,CAAA,CAAA,CAAqB,CAAC,CAAtB,CAAA,CAAA,CAA0B,CAA1B,CAA4B;IAC1B;AACF;AA7CA,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;"}
|
|
@@ -5,10 +5,10 @@ import type { Resolvers } from "@apollo/client/core";
|
|
|
5
5
|
import { ApolloClient } from "@apollo/client/core";
|
|
6
6
|
import type { ApolloLink } from "@apollo/client/link/core";
|
|
7
7
|
import type { MockedResponse } from "@apollo/client/testing/core";
|
|
8
|
-
export interface MockedProviderProps
|
|
8
|
+
export interface MockedProviderProps {
|
|
9
9
|
mocks?: ReadonlyArray<MockedResponse<any, any>>;
|
|
10
10
|
defaultOptions?: DefaultOptions;
|
|
11
|
-
cache?: ApolloCache
|
|
11
|
+
cache?: ApolloCache;
|
|
12
12
|
resolvers?: Resolvers;
|
|
13
13
|
childProps?: object;
|
|
14
14
|
children?: any;
|
|
@@ -21,7 +21,7 @@ export interface MockedProviderProps<TSerializedCache = {}> {
|
|
|
21
21
|
connectToDevTools?: boolean;
|
|
22
22
|
}
|
|
23
23
|
interface MockedProviderState {
|
|
24
|
-
client: ApolloClient
|
|
24
|
+
client: ApolloClient;
|
|
25
25
|
}
|
|
26
26
|
export declare class MockedProvider extends React.Component<MockedProviderProps, MockedProviderState> {
|
|
27
27
|
constructor(props: MockedProviderProps);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { FetchResult } from "@apollo/client/link/core";
|
|
2
2
|
export declare function graphQLResultHasError<T>(result: FetchResult<T>): boolean;
|
|
3
|
-
export declare function getGraphQLErrorsFromResult<T>(result: FetchResult<T>):
|
|
3
|
+
export declare function getGraphQLErrorsFromResult<T>(result: FetchResult<T>): import("graphql").GraphQLFormattedError[];
|
|
4
4
|
//# sourceMappingURL=errorHandling.d.cts.map
|