@apollo/client 3.14.0-alpha.0 → 3.14.0-alpha.1

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.
Files changed (198) hide show
  1. package/.changeset/breezy-lions-rule.md +5 -0
  2. package/.changeset/great-jobs-fetch.md +5 -0
  3. package/.changeset/pre.json +4 -1
  4. package/.changeset/tidy-bulldogs-exercise.md +5 -0
  5. package/CHANGELOG.md +10 -0
  6. package/apollo-client.cjs +187 -119
  7. package/apollo-client.cjs.map +1 -1
  8. package/apollo-client.min.cjs +1 -1
  9. package/cache/cache.cjs +7 -2
  10. package/cache/cache.cjs.map +1 -1
  11. package/cache/cache.cjs.native.js +7 -2
  12. package/cache/inmemory/inMemoryCache.d.ts +8 -0
  13. package/cache/inmemory/inMemoryCache.js +3 -0
  14. package/cache/inmemory/inMemoryCache.js.map +1 -1
  15. package/core/ApolloClient.d.ts +9 -9
  16. package/core/ApolloClient.js +6 -1
  17. package/core/ApolloClient.js.map +1 -1
  18. package/core/LocalState.js +2 -2
  19. package/core/ObservableQuery.d.ts +51 -6
  20. package/core/ObservableQuery.js +89 -13
  21. package/core/ObservableQuery.js.map +1 -1
  22. package/core/QueryInfo.js +6 -3
  23. package/core/QueryInfo.js.map +1 -1
  24. package/core/QueryManager.js +14 -12
  25. package/core/QueryManager.js.map +1 -1
  26. package/core/core.cjs +85 -33
  27. package/core/core.cjs.map +1 -1
  28. package/core/core.cjs.native.js +85 -33
  29. package/core/types.d.ts +177 -3
  30. package/core/types.js.map +1 -1
  31. package/core/watchQueryOptions.d.ts +10 -2
  32. package/core/watchQueryOptions.js.map +1 -1
  33. package/dev/dev.cjs +149 -97
  34. package/dev/dev.cjs.map +1 -1
  35. package/dev/dev.cjs.native.js +149 -97
  36. package/errors/errors.cjs.map +1 -1
  37. package/errors/index.d.ts +19 -0
  38. package/errors/index.js +19 -0
  39. package/errors/index.js.map +1 -1
  40. package/invariantErrorCodes.js +161 -96
  41. package/link/batch-http/batch-http.cjs +9 -0
  42. package/link/batch-http/batch-http.cjs.map +1 -1
  43. package/link/batch-http/batch-http.cjs.native.js +9 -0
  44. package/link/batch-http/batchHttpLink.js +9 -0
  45. package/link/batch-http/batchHttpLink.js.map +1 -1
  46. package/link/core/ApolloLink.d.ts +8 -0
  47. package/link/core/ApolloLink.js +19 -2
  48. package/link/core/ApolloLink.js.map +1 -1
  49. package/link/core/core.cjs +24 -2
  50. package/link/core/core.cjs.map +1 -1
  51. package/link/core/core.cjs.native.js +24 -2
  52. package/link/core/types.d.ts +20 -0
  53. package/link/core/types.js.map +1 -1
  54. package/link/error/index.d.ts +48 -0
  55. package/link/error/index.js.map +1 -1
  56. package/link/http/checkFetcher.js +1 -1
  57. package/link/http/createHttpLink.js +4 -1
  58. package/link/http/createHttpLink.js.map +1 -1
  59. package/link/http/http.cjs +6 -3
  60. package/link/http/http.cjs.map +1 -1
  61. package/link/http/http.cjs.native.js +6 -3
  62. package/link/http/serializeFetchParameter.js +1 -1
  63. package/link/persisted-queries/index.d.ts +38 -0
  64. package/link/persisted-queries/index.js +2 -2
  65. package/link/persisted-queries/index.js.map +1 -1
  66. package/link/persisted-queries/persisted-queries.cjs +2 -2
  67. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  68. package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
  69. package/link/utils/fromError.d.ts +16 -0
  70. package/link/utils/fromError.js +16 -0
  71. package/link/utils/fromError.js.map +1 -1
  72. package/link/utils/fromPromise.d.ts +16 -0
  73. package/link/utils/fromPromise.js +16 -0
  74. package/link/utils/fromPromise.js.map +1 -1
  75. package/link/utils/throwServerError.d.ts +30 -0
  76. package/link/utils/throwServerError.js +17 -0
  77. package/link/utils/throwServerError.js.map +1 -1
  78. package/link/utils/toPromise.d.ts +16 -0
  79. package/link/utils/toPromise.js +17 -1
  80. package/link/utils/toPromise.js.map +1 -1
  81. package/link/utils/utils.cjs +2 -2
  82. package/link/utils/utils.cjs.map +1 -1
  83. package/link/utils/utils.cjs.native.js +2 -2
  84. package/link/utils/validateOperation.js +1 -1
  85. package/masking/maskDefinition.js +2 -2
  86. package/masking/maskFragment.js +2 -2
  87. package/masking/maskOperation.js +1 -1
  88. package/masking/masking.cjs +6 -6
  89. package/masking/masking.cjs.map +1 -1
  90. package/masking/masking.cjs.native.js +6 -6
  91. package/masking/utils.js +1 -1
  92. package/masking/utils.js.map +1 -1
  93. package/package.json +1 -1
  94. package/react/components/Mutation.js +1 -1
  95. package/react/components/Query.js +1 -1
  96. package/react/components/Subscription.js +1 -1
  97. package/react/components/components.cjs +6 -4
  98. package/react/components/components.cjs.map +1 -1
  99. package/react/components/components.cjs.native.js +6 -4
  100. package/react/context/ApolloConsumer.js +1 -1
  101. package/react/context/ApolloContext.js +2 -2
  102. package/react/context/ApolloProvider.js +1 -1
  103. package/react/context/context.cjs +4 -4
  104. package/react/context/context.cjs.map +1 -1
  105. package/react/context/context.cjs.native.js +4 -4
  106. package/react/hoc/graphql.js +1 -1
  107. package/react/hoc/hoc-utils.js +1 -1
  108. package/react/hoc/hoc.cjs +9 -7
  109. package/react/hoc/hoc.cjs.map +1 -1
  110. package/react/hoc/hoc.cjs.native.js +9 -7
  111. package/react/hoc/mutation-hoc.js +1 -1
  112. package/react/hoc/query-hoc.js +1 -1
  113. package/react/hoc/subscription-hoc.js +1 -1
  114. package/react/hoc/withApollo.js +1 -1
  115. package/react/hooks/hooks.cjs +18 -16
  116. package/react/hooks/hooks.cjs.map +1 -1
  117. package/react/hooks/hooks.cjs.native.js +18 -16
  118. package/react/hooks/internal/useWarnRemoved.d.ts +2 -1
  119. package/react/hooks/internal/useWarnRemoved.js.map +1 -1
  120. package/react/hooks/internal/useWarnRemovedOption.js +1 -1
  121. package/react/hooks/useApolloClient.js +1 -1
  122. package/react/hooks/useLazyQuery.js +2 -2
  123. package/react/hooks/useLoadableQuery.js +2 -2
  124. package/react/hooks/useQuery.js +1 -1
  125. package/react/hooks/useSubscription.js +3 -3
  126. package/react/hooks/useSuspenseQuery.js +2 -2
  127. package/react/hooks/useSyncExternalStore.js +1 -1
  128. package/react/internal/cache/QueryReference.d.ts +1 -0
  129. package/react/internal/cache/QueryReference.js +5 -2
  130. package/react/internal/cache/QueryReference.js.map +1 -1
  131. package/react/internal/internal.cjs +16 -3
  132. package/react/internal/internal.cjs.map +1 -1
  133. package/react/internal/internal.cjs.native.js +16 -3
  134. package/react/parser/index.js +6 -6
  135. package/react/parser/parser.cjs +9 -7
  136. package/react/parser/parser.cjs.map +1 -1
  137. package/react/parser/parser.cjs.native.js +9 -7
  138. package/react/react.cjs +4 -2
  139. package/react/react.cjs.map +1 -1
  140. package/react/react.cjs.native.js +4 -2
  141. package/react/types/types.d.ts +40 -0
  142. package/react/types/types.documentation.d.ts +1 -1
  143. package/react/types/types.documentation.js.map +1 -1
  144. package/react/types/types.js.map +1 -1
  145. package/testing/core/core.cjs +17 -3
  146. package/testing/core/core.cjs.map +1 -1
  147. package/testing/core/core.cjs.native.js +17 -3
  148. package/testing/core/itAsync.d.ts +5 -0
  149. package/testing/core/itAsync.js +5 -0
  150. package/testing/core/itAsync.js.map +1 -1
  151. package/testing/core/mocking/mockClient.d.ts +4 -0
  152. package/testing/core/mocking/mockClient.js +4 -0
  153. package/testing/core/mocking/mockClient.js.map +1 -1
  154. package/testing/core/mocking/mockLink.d.ts +10 -0
  155. package/testing/core/mocking/mockLink.js +23 -4
  156. package/testing/core/mocking/mockLink.js.map +1 -1
  157. package/testing/core/mocking/mockSubscriptionLink.d.ts +4 -0
  158. package/testing/core/mocking/mockSubscriptionLink.js +4 -0
  159. package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
  160. package/testing/core/subscribeAndCount.d.ts +4 -0
  161. package/testing/core/subscribeAndCount.js +4 -0
  162. package/testing/core/subscribeAndCount.js.map +1 -1
  163. package/testing/experimental/createSchemaFetch.d.ts +1 -1
  164. package/testing/experimental/createSchemaFetch.js +1 -1
  165. package/testing/experimental/createSchemaFetch.js.map +1 -1
  166. package/testing/experimental/createTestSchema.d.ts +1 -1
  167. package/testing/experimental/createTestSchema.js +1 -1
  168. package/testing/experimental/createTestSchema.js.map +1 -1
  169. package/testing/experimental/experimental.cjs.map +1 -1
  170. package/testing/testing.cjs +4 -2
  171. package/testing/testing.cjs.map +1 -1
  172. package/testing/testing.cjs.native.js +4 -2
  173. package/utilities/deprecation/index.d.ts +83 -3
  174. package/utilities/deprecation/index.js +15 -3
  175. package/utilities/deprecation/index.js.map +1 -1
  176. package/utilities/globals/globals.cjs +1 -1
  177. package/utilities/globals/globals.cjs.map +1 -1
  178. package/utilities/globals/globals.cjs.native.js +1 -1
  179. package/utilities/graphql/DocumentTransform.js +1 -1
  180. package/utilities/graphql/directives.js +7 -7
  181. package/utilities/graphql/fragments.js +3 -3
  182. package/utilities/graphql/getFromAST.js +8 -8
  183. package/utilities/graphql/storeUtils.js +1 -1
  184. package/utilities/graphql/transform.js +2 -2
  185. package/utilities/observables/asyncMap.d.ts +13 -0
  186. package/utilities/observables/asyncMap.js +13 -0
  187. package/utilities/observables/asyncMap.js.map +1 -1
  188. package/utilities/observables/iteration.d.ts +4 -0
  189. package/utilities/observables/iteration.js +4 -0
  190. package/utilities/observables/iteration.js.map +1 -1
  191. package/utilities/subscriptions/urql/index.d.ts +5 -0
  192. package/utilities/subscriptions/urql/index.js +5 -0
  193. package/utilities/subscriptions/urql/index.js.map +1 -1
  194. package/utilities/subscriptions/urql/urql.cjs.map +1 -1
  195. package/utilities/utilities.cjs +22 -22
  196. package/utilities/utilities.cjs.map +1 -1
  197. package/utilities/utilities.cjs.native.js +22 -22
  198. package/version.js +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloClient.js","sourceRoot":"","sources":["../../src/core/ApolloClient.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAK7E,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAI5D,OA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AC,eAAe,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACI,8BAAO,GAAd,UAAe,OAAmB;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,GAAG,OAAO,CAAC;IAC/C,CAAC;IAED,sBAAW,wCAAc;aAAzB;YACE,OAAO,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC;QAC1C,CAAC;;;OAAA;IAmFH,mBAAC;AAAD,CAAC,AAz3BD,IAy3BC;;AAED,IAAI,OAAO,EAAE,CAAC;IACZ,YAAY,CAAC,SAAS,CAAC,kBAAkB,GAAG,8BAA8B,CAAC;AAC7E,CAAC","sourcesContent":["import { invariant, newInvariantError } from \"../utilities/globals/index.js\";\n\nimport type { DocumentNode, FormattedExecutionResult } from \"graphql\";\n\nimport type { FetchResult, GraphQLRequest } from \"../link/core/index.js\";\nimport { ApolloLink, execute } from \"../link/core/index.js\";\nimport type { ApolloCache, DataProxy, Reference } from \"../cache/index.js\";\nimport type { DocumentTransform } from \"../utilities/index.js\";\nimport type { Observable } from \"../utilities/index.js\";\nimport { version } from \"../version.js\";\nimport type { UriFunction } from \"../link/http/index.js\";\nimport { HttpLink } from \"../link/http/index.js\";\n\nimport { QueryManager } from \"./QueryManager.js\";\nimport type { ObservableQuery } from \"./ObservableQuery.js\";\n\nimport type {\n ApolloQueryResult,\n DefaultContext,\n OperationVariables,\n Resolvers,\n RefetchQueriesOptions,\n RefetchQueriesResult,\n InternalRefetchQueriesResult,\n RefetchQueriesInclude,\n} from \"./types.js\";\n\nimport type {\n QueryOptions,\n WatchQueryOptions,\n MutationOptions,\n SubscriptionOptions,\n WatchQueryFetchPolicy,\n} from \"./watchQueryOptions.js\";\n\nimport type { FragmentMatcher } from \"./LocalState.js\";\nimport { LocalState } from \"./LocalState.js\";\n\nexport interface DefaultOptions {\n watchQuery?: Partial<WatchQueryOptions<any, any>>;\n query?: Partial<QueryOptions<any, any>>;\n mutate?: Partial<MutationOptions<any, any, any>>;\n}\n\nexport interface DevtoolsOptions {\n /**\n * If `true`, the [Apollo Client Devtools](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) browser extension can connect to this `ApolloClient` instance.\n *\n * The default value is `false` in production and `true` in development if there is a `window` object.\n */\n enabled?: boolean;\n\n /**\n * Optional name for this `ApolloClient` instance in the devtools. This is\n * useful when you instantiate multiple clients and want to be able to\n * identify them by name.\n */\n name?: string;\n}\n\nlet hasSuggestedDevtools = false;\n\nexport interface ApolloClientOptions<TCacheShape> {\n /**\n * The URI of the GraphQL endpoint that Apollo Client will communicate with.\n *\n * One of `uri` or `link` is **required**. If you provide both, `link` takes precedence.\n *\n * @deprecated `uri` will be removed in Apollo Client 4.0.\n *\n * **Recommended now**\n *\n * Instantiate an instance of `HttpClient` and pass `uri` as an option.\n *\n * ```js\n * import { HttpLink } from \"@apollo/client\";\n *\n * new ApolloClient({\n * link: new HttpLink({ uri })\n * });\n * ```\n */\n uri?: string | UriFunction;\n\n /**\n * @deprecated `credentials` will be removed in Apollo Client 4.0.\n *\n * **Recommended now**\n *\n * Instantiate an instance of `HttpClient` and pass `credentials` as an option.\n *\n * ```js\n * import { HttpLink } from \"@apollo/client\";\n *\n * new ApolloClient({\n * link: new HttpLink({ credentials })\n * });\n * ```\n */\n credentials?: string;\n /**\n * An object representing headers to include in every HTTP request, such as `{Authorization: 'Bearer 1234'}`\n *\n * This value will be ignored when using the `link` option.\n *\n * @deprecated `headers` will be removed in Apollo Client 4.0.\n *\n * **Recommended now**\n *\n * Instantiate an instance of `HttpClient` and pass `headers` as an option.\n *\n * ```js\n * import { HttpLink } from \"@apollo/client\";\n *\n * new ApolloClient({\n * link: new HttpLink({ headers })\n * });\n * ```\n */\n headers?: Record<string, string>;\n /**\n * You can provide an `ApolloLink` instance to serve as Apollo Client's network layer. For more information, see [Advanced HTTP networking](https://www.apollographql.com/docs/react/networking/advanced-http-networking/).\n *\n * One of `uri` or `link` is **required**. If you provide both, `link` takes precedence.\n */\n link?: ApolloLink;\n /**\n * The cache that Apollo Client should use to store query results locally. The recommended cache is `InMemoryCache`, which is provided by the `@apollo/client` package.\n *\n * For more information, see [Configuring the cache](https://www.apollographql.com/docs/react/caching/cache-configuration/).\n */\n cache: ApolloCache<TCacheShape>;\n /**\n * The time interval (in milliseconds) before Apollo Client force-fetches queries after a server-side render.\n *\n * @defaultValue `0` (no delay)\n */\n ssrForceFetchDelay?: number;\n /**\n * When using Apollo Client for [server-side rendering](https://www.apollographql.com/docs/react/performance/server-side-rendering/), set this to `true` so that the [`getDataFromTree` function](../react/ssr/#getdatafromtree) can work effectively.\n *\n * @defaultValue `false`\n */\n ssrMode?: boolean;\n /**\n * If `true`, the [Apollo Client Devtools](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) browser extension can connect to Apollo Client.\n *\n * The default value is `false` in production and `true` in development (if there is a `window` object).\n *\n * @deprecated `connectToDevTools` will be removed in Apollo Client 4.0.\n *\n * **Recommended now**\n *\n * Use the `devtools.enabled` option instead.\n *\n * ```ts\n * new ApolloClient({\n * devtools: { enabled: true }\n * });\n * ```\n */\n connectToDevTools?: boolean;\n /**\n * If `false`, Apollo Client sends every created query to the server, even if a _completely_ identical query (identical in terms of query string, variable values, and operationName) is already in flight.\n *\n * @defaultValue `true`\n */\n queryDeduplication?: boolean;\n /**\n * Provide this object to set application-wide default values for options you can provide to the `watchQuery`, `query`, and `mutate` functions. See below for an example object.\n *\n * See this [example object](https://www.apollographql.com/docs/react/api/core/ApolloClient#example-defaultoptions-object).\n */\n defaultOptions?: DefaultOptions;\n defaultContext?: Partial<DefaultContext>;\n /**\n * If `true`, Apollo Client will assume results read from the cache are never mutated by application code, which enables substantial performance optimizations.\n *\n * @defaultValue `false`\n */\n assumeImmutableResults?: boolean;\n\n /**\n * @deprecated `resolvers` has been moved in Apollo Client 4.0. This option is\n * safe to use in Apollo Client 3.x.\n *\n * **Recommended now**\n *\n * No action needed\n *\n * **When upgrading**\n *\n * `resolvers` will need to be passed as the `resolvers` option to an instance\n * of `LocalState`. That `LocalState` instance should be provided as the\n * `localState` option to the `ApolloClient` constructor.\n */\n resolvers?: Resolvers | Resolvers[];\n\n /**\n * @deprecated `typeDefs` will be removed in Apollo Client 4.0. It is safe to\n * stop using this option in Apollo Client 3.x.\n */\n typeDefs?: string | string[] | DocumentNode | DocumentNode[];\n\n /**\n * @deprecated Custom fragment matchers will no longer be supported in Apollo\n * Client 4.0 and has been replaced by `cache.fragmentMatches`. It is safe to\n * continue using this in Apollo Client 3.x.\n *\n * **Recommended now**\n *\n * No action needed\n *\n * **When upgrading**\n *\n * Leverage `possibleTypes` with `InMemoryCache` to ensure fragments match\n * correctly. Ensure `possibleTypes` include local types if needed. This\n * option should then be removed. If working with a 3rd party cache\n * implementation, ensure the 3rd party cache implements the\n * `cache.fragmentMatches` method.\n */\n fragmentMatcher?: FragmentMatcher;\n /**\n * A custom name (e.g., `iOS`) that identifies this particular client among your set of clients. Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * @deprecated `name` has been moved to `clientAwareness.name` in Apollo Client 4.0.\n *\n * **Recommended now**\n *\n * Use `clientAwareness.name` to set the client awareness name.\n *\n * ```ts\n * new ApolloClient({ clientAwareness: { name } });\n * ```\n */\n name?: string;\n /**\n * A custom version that identifies the current version of this particular client (e.g., `1.2`). Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * This is **not** the version of Apollo Client that you are using, but rather any version string that helps you differentiate between versions of your client.\n *\n * @deprecated `name` has been moved to `clientAwareness.version` in Apollo Client 4.0.\n *\n * **Recommended now**\n *\n * Use `clientAwareness.version` to set the client awareness version.\n *\n * ```ts\n * new ApolloClient({ clientAwareness: { version } });\n * ```\n */\n version?: string;\n\n clientAwareness?: {\n /**\n * A custom name (e.g., `iOS`) that identifies this particular client among your set of clients. Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n */\n name?: string;\n /**\n * A custom version that identifies the current version of this particular client (e.g., `1.2`). Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * This is **not** the version of Apollo Client that you are using, but rather any version string that helps you differentiate between versions of your client.\n */\n version?: string;\n };\n\n documentTransform?: DocumentTransform;\n\n /**\n * Configuration used by the [Apollo Client Devtools extension](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) for this client.\n *\n * @since 3.11.0\n */\n devtools?: DevtoolsOptions;\n\n /**\n * Determines if data masking is enabled for the client.\n *\n * @defaultValue false\n */\n dataMasking?: boolean;\n}\n\n// Though mergeOptions now resides in @apollo/client/utilities, it was\n// previously declared and exported from this module, and then reexported from\n// @apollo/client/core. Since we need to preserve that API anyway, the easiest\n// solution is to reexport mergeOptions where it was previously declared (here).\nimport { mergeOptions } from \"../utilities/index.js\";\nimport { getApolloClientMemoryInternals } from \"../utilities/caching/getMemoryInternals.js\";\nimport type {\n WatchFragmentOptions,\n WatchFragmentResult,\n} from \"../cache/core/cache.js\";\nimport type { MaybeMasked, Unmasked } from \"../masking/index.js\";\nimport { warnRemovedOption } from \"../utilities/deprecation/index.js\";\nexport { mergeOptions };\n\n/**\n * This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries\n * and mutations) to a GraphQL spec-compliant server over an `ApolloLink` instance,\n * receive results from the server and cache the results in a store. It also delivers updates\n * to GraphQL queries through `Observable` instances.\n */\nexport class ApolloClient<TCacheShape> implements DataProxy {\n public link: ApolloLink;\n public cache: ApolloCache<TCacheShape>;\n\n /**\n * @deprecated `disableNetworkFetches` has been renamed to `prioritizeCacheValues`\n * in Apollo Client 4.0.\n *\n * **Recommended now**\n *\n * Access `client.prioritizeCacheValues` instead.\n */\n public disableNetworkFetches: boolean;\n public version: string;\n public queryDeduplication: boolean;\n public defaultOptions: DefaultOptions;\n public readonly typeDefs: ApolloClientOptions<TCacheShape>[\"typeDefs\"];\n public readonly devtoolsConfig: DevtoolsOptions;\n\n private queryManager: QueryManager<TCacheShape>;\n private devToolsHookCb?: Function;\n private resetStoreCallbacks: Array<() => Promise<any>> = [];\n private clearStoreCallbacks: Array<() => Promise<any>> = [];\n public localState: LocalState<TCacheShape>;\n\n /**\n * Whether to prioritize cache values over network results when `query` or `watchQuery` is called.\n * This will essentially turn a `\"network-only\"` or `\"cache-and-network\"` fetchPolicy into a `\"cache-first\"` fetchPolicy,\n * but without influencing the `fetchPolicy` of the created `ObservableQuery` long-term.\n *\n * This can e.g. be used to prioritize the cache during the first render after SSR.\n */\n public get prioritizeCacheValues() {\n return this.disableNetworkFetches;\n }\n\n public set prioritizeCacheValues(value: boolean) {\n this.disableNetworkFetches = value;\n }\n\n /**\n * Constructs an instance of `ApolloClient`.\n *\n * @example\n * ```js\n * import { ApolloClient, InMemoryCache } from '@apollo/client';\n *\n * const cache = new InMemoryCache();\n *\n * const client = new ApolloClient({\n * // Provide required constructor fields\n * cache: cache,\n * uri: 'http://localhost:4000/',\n *\n * // Provide some optional constructor fields\n * name: 'react-web-client',\n * version: '1.3',\n * queryDeduplication: false,\n * defaultOptions: {\n * watchQuery: {\n * fetchPolicy: 'cache-and-network',\n * },\n * },\n * });\n * ```\n */\n constructor(options: ApolloClientOptions<TCacheShape>) {\n if (!options.cache) {\n throw newInvariantError(\n \"To initialize Apollo Client, you must specify a 'cache' property \" +\n \"in the options object. \\n\" +\n \"For more information, please visit: https://go.apollo.dev/c/docs\"\n );\n }\n\n const {\n uri,\n credentials,\n headers,\n cache,\n documentTransform,\n ssrMode = false,\n ssrForceFetchDelay = 0,\n // Expose the client instance as window.__APOLLO_CLIENT__ and call\n // onBroadcast in queryManager.broadcastQueries to enable browser\n // devtools, but disable them by default in production.\n connectToDevTools,\n queryDeduplication = true,\n defaultOptions,\n defaultContext,\n assumeImmutableResults = cache.assumeImmutableResults,\n resolvers,\n typeDefs,\n fragmentMatcher,\n clientAwareness,\n name: clientAwarenessName,\n version: clientAwarenessVersion,\n devtools,\n dataMasking,\n } = options;\n\n if (__DEV__) {\n warnRemovedOption(\n options,\n \"connectToDevTools\",\n \"ApolloClient\",\n \"Please use `devtools.enabled` instead.\"\n );\n warnRemovedOption(\n options,\n \"uri\",\n \"ApolloClient\",\n \"Please initialize an instance of `HttpLink` with `uri` instead.\"\n );\n warnRemovedOption(\n options,\n \"credentials\",\n \"ApolloClient\",\n \"Please initialize an instance of `HttpLink` with `credentials` instead.\"\n );\n warnRemovedOption(\n options,\n \"headers\",\n \"ApolloClient\",\n \"Please initialize an instance of `HttpLink` with `headers` instead.\"\n );\n warnRemovedOption(\n options,\n \"name\",\n \"ApolloClient\",\n \"Please use the `clientAwareness.name` option instead.\"\n );\n warnRemovedOption(\n options,\n \"version\",\n \"ApolloClient\",\n \"Please use the `clientAwareness.version` option instead.\"\n );\n warnRemovedOption(options, \"typeDefs\", \"ApolloClient\");\n\n if (!options.link) {\n invariant.warn(\n \"[ApolloClient]: Apollo Client 4.0 will require a `link` option and will not create a default link when not provided. Please provide a `link` option.\"\n );\n }\n }\n\n let { link } = options;\n\n if (!link) {\n link =\n uri ? new HttpLink({ uri, credentials, headers }) : ApolloLink.empty();\n }\n\n this.link = link;\n this.cache = cache;\n this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0;\n this.queryDeduplication = queryDeduplication;\n this.defaultOptions = defaultOptions || Object.create(null);\n this.typeDefs = typeDefs;\n this.devtoolsConfig = {\n ...devtools,\n enabled: devtools?.enabled ?? connectToDevTools,\n };\n\n if (this.devtoolsConfig.enabled === undefined) {\n this.devtoolsConfig.enabled = __DEV__;\n }\n\n if (ssrForceFetchDelay) {\n setTimeout(\n () => (this.disableNetworkFetches = false),\n ssrForceFetchDelay\n );\n }\n\n this.watchQuery = this.watchQuery.bind(this);\n this.query = this.query.bind(this);\n this.mutate = this.mutate.bind(this);\n this.watchFragment = this.watchFragment.bind(this);\n this.resetStore = this.resetStore.bind(this);\n this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this);\n\n this.version = version;\n\n this.localState = new LocalState({\n cache,\n client: this,\n resolvers,\n fragmentMatcher,\n });\n\n this.queryManager = new QueryManager({\n cache: this.cache,\n link: this.link,\n defaultOptions: this.defaultOptions,\n defaultContext,\n documentTransform,\n queryDeduplication,\n ssrMode,\n dataMasking: !!dataMasking,\n clientAwareness: {\n name: clientAwareness?.name ?? clientAwarenessName!,\n version: clientAwareness?.version ?? clientAwarenessVersion!,\n },\n localState: this.localState,\n assumeImmutableResults,\n onBroadcast:\n this.devtoolsConfig.enabled ?\n () => {\n if (this.devToolsHookCb) {\n this.devToolsHookCb({\n action: {},\n state: {\n queries: this.queryManager.getQueryStore(),\n mutations: this.queryManager.mutationStore || {},\n },\n dataWithOptimisticResults: this.cache.extract(true),\n });\n }\n }\n : void 0,\n });\n\n if (this.devtoolsConfig.enabled) this.connectToDevTools();\n }\n\n private connectToDevTools() {\n if (typeof window === \"undefined\") {\n return;\n }\n\n type DevToolsConnector = {\n push(client: ApolloClient<any>): void;\n };\n const windowWithDevTools = window as Window & {\n [devtoolsSymbol]?: DevToolsConnector;\n __APOLLO_CLIENT__?: ApolloClient<any>;\n };\n const devtoolsSymbol = Symbol.for(\"apollo.devtools\");\n (windowWithDevTools[devtoolsSymbol] =\n windowWithDevTools[devtoolsSymbol] || ([] as DevToolsConnector)).push(\n this\n );\n windowWithDevTools.__APOLLO_CLIENT__ = this;\n\n /**\n * Suggest installing the devtools for developers who don't have them\n */\n if (!hasSuggestedDevtools && __DEV__) {\n hasSuggestedDevtools = true;\n if (\n window.document &&\n window.top === window.self &&\n /^(https?|file):$/.test(window.location.protocol)\n ) {\n setTimeout(() => {\n if (!(window as any).__APOLLO_DEVTOOLS_GLOBAL_HOOK__) {\n const nav = window.navigator;\n const ua = nav && nav.userAgent;\n let url: string | undefined;\n if (typeof ua === \"string\") {\n if (ua.indexOf(\"Chrome/\") > -1) {\n url =\n \"https://chrome.google.com/webstore/detail/\" +\n \"apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm\";\n } else if (ua.indexOf(\"Firefox/\") > -1) {\n url =\n \"https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/\";\n }\n }\n if (url) {\n invariant.log(\n \"Download the Apollo DevTools for a better development \" +\n \"experience: %s\",\n url\n );\n }\n }\n }, 10000);\n }\n }\n }\n\n /**\n * The `DocumentTransform` used to modify GraphQL documents before a request\n * is made. If a custom `DocumentTransform` is not provided, this will be the\n * default document transform.\n */\n get documentTransform() {\n return this.queryManager.documentTransform;\n }\n\n /**\n * Call this method to terminate any active client processes, making it safe\n * to dispose of this `ApolloClient` instance.\n */\n public stop() {\n this.queryManager.stop();\n }\n\n /**\n * This watches the cache store of the query according to the options specified and\n * returns an `ObservableQuery`. We can subscribe to this `ObservableQuery` and\n * receive updated results through an observer when the cache store changes.\n *\n * Note that this method is not an implementation of GraphQL subscriptions. Rather,\n * it uses Apollo's store in order to reactively deliver updates to your query results.\n *\n * For example, suppose you call watchQuery on a GraphQL query that fetches a person's\n * first and last name and this person has a particular object identifier, provided by\n * dataIdFromObject. Later, a different query fetches that same person's\n * first and last name and the first name has now changed. Then, any observers associated\n * with the results of the first query will be updated with a new result object.\n *\n * Note that if the cache does not change, the subscriber will *not* be notified.\n *\n * See [here](https://medium.com/apollo-stack/the-concepts-of-graphql-bc68bd819be3#.3mb0cbcmc) for\n * a description of store reactivity.\n */\n public watchQuery<\n T = any,\n TVariables extends OperationVariables = OperationVariables,\n >(options: WatchQueryOptions<TVariables, T>): ObservableQuery<T, TVariables> {\n if (this.defaultOptions.watchQuery) {\n options = mergeOptions(this.defaultOptions.watchQuery, options);\n }\n\n // XXX Overwriting options is probably not the best way to do this long term...\n if (\n this.disableNetworkFetches &&\n (options.fetchPolicy === \"network-only\" ||\n options.fetchPolicy === \"cache-and-network\")\n ) {\n options = { ...options, fetchPolicy: \"cache-first\" };\n }\n\n if (__DEV__) {\n warnRemovedOption(options, \"canonizeResults\", \"client.watchQuery\");\n }\n\n return this.queryManager.watchQuery<T, TVariables>(options);\n }\n\n /**\n * This resolves a single query according to the options specified and\n * returns a `Promise` which is either resolved with the resulting data\n * or rejected with an error.\n *\n * @param options - An object of type `QueryOptions` that allows us to\n * describe how this query should be treated e.g. whether it should hit the\n * server at all or just resolve from the cache, etc.\n */\n public query<\n T = any,\n TVariables extends OperationVariables = OperationVariables,\n >(\n options: QueryOptions<TVariables, T>\n ): Promise<ApolloQueryResult<MaybeMasked<T>>> {\n if (this.defaultOptions.query) {\n options = mergeOptions(this.defaultOptions.query, options);\n }\n\n invariant(\n (options.fetchPolicy as WatchQueryFetchPolicy) !== \"cache-and-network\",\n \"The cache-and-network fetchPolicy does not work with client.query, because \" +\n \"client.query can only return a single result. Please use client.watchQuery \" +\n \"to receive multiple results from the cache and the network, or consider \" +\n \"using a different fetchPolicy, such as cache-first or network-only.\"\n );\n\n if (this.disableNetworkFetches && options.fetchPolicy === \"network-only\") {\n options = { ...options, fetchPolicy: \"cache-first\" };\n }\n\n if (__DEV__) {\n warnRemovedOption(options, \"canonizeResults\", \"client.query\");\n }\n\n return this.queryManager.query<T, TVariables>(options);\n }\n\n /**\n * This resolves a single mutation according to the options specified and returns a\n * Promise which is either resolved with the resulting data or rejected with an\n * error. In some cases both `data` and `errors` might be undefined, for example\n * when `errorPolicy` is set to `'ignore'`.\n *\n * It takes options as an object with the following keys and values:\n */\n public mutate<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n TContext extends Record<string, any> = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n >(\n options: MutationOptions<TData, TVariables, TContext>\n ): Promise<FetchResult<MaybeMasked<TData>>> {\n if (this.defaultOptions.mutate) {\n options = mergeOptions(this.defaultOptions.mutate, options);\n }\n return this.queryManager.mutate<TData, TVariables, TContext, TCache>(\n options\n );\n }\n\n /**\n * This subscribes to a graphql subscription according to the options specified and returns an\n * `Observable` which either emits received data or an error.\n */\n public subscribe<\n T = any,\n TVariables extends OperationVariables = OperationVariables,\n >(\n options: SubscriptionOptions<TVariables, T>\n ): Observable<FetchResult<MaybeMasked<T>>> {\n const id = this.queryManager.generateQueryId();\n\n return this.queryManager\n .startGraphQLSubscription<T>(options)\n .map((result) => ({\n ...result,\n data: this.queryManager.maskOperation({\n document: options.query,\n data: result.data,\n fetchPolicy: options.fetchPolicy,\n id,\n }),\n }));\n }\n\n /**\n * Tries to read some data from the store in the shape of the provided\n * GraphQL query without making a network request. This method will start at\n * the root query. To start at a specific id returned by `dataIdFromObject`\n * use `readFragment`.\n *\n * @param optimistic - Set to `true` to allow `readQuery` to return\n * optimistic results. Is `false` by default.\n */\n public readQuery<T = any, TVariables = OperationVariables>(\n options: DataProxy.Query<TVariables, T>,\n optimistic: boolean = false\n ): Unmasked<T> | null {\n return this.cache.readQuery<T, TVariables>(options, optimistic);\n }\n\n /**\n * Watches the cache store of the fragment according to the options specified\n * and returns an `Observable`. We can subscribe to this\n * `Observable` and receive updated results through an\n * observer when the cache store changes.\n *\n * You must pass in a GraphQL document with a single fragment or a document\n * with multiple fragments that represent what you are reading. If you pass\n * in a document with multiple fragments then you must also specify a\n * `fragmentName`.\n *\n * @since 3.10.0\n * @param options - An object of type `WatchFragmentOptions` that allows\n * the cache to identify the fragment and optionally specify whether to react\n * to optimistic updates.\n */\n\n public watchFragment<\n TFragmentData = unknown,\n TVariables = OperationVariables,\n >(\n options: WatchFragmentOptions<TFragmentData, TVariables>\n ): Observable<WatchFragmentResult<TFragmentData>> {\n return this.cache.watchFragment({\n ...options,\n [Symbol.for(\"apollo.dataMasking\")]: this.queryManager.dataMasking,\n });\n }\n\n /**\n * Tries to read some data from the store in the shape of the provided\n * GraphQL fragment without making a network request. This method will read a\n * GraphQL fragment from any arbitrary id that is currently cached, unlike\n * `readQuery` which will only read from the root query.\n *\n * You must pass in a GraphQL document with a single fragment or a document\n * with multiple fragments that represent what you are reading. If you pass\n * in a document with multiple fragments then you must also specify a\n * `fragmentName`.\n *\n * @param optimistic - Set to `true` to allow `readFragment` to return\n * optimistic results. Is `false` by default.\n */\n public readFragment<T = any, TVariables = OperationVariables>(\n options: DataProxy.Fragment<TVariables, T>,\n optimistic: boolean = false\n ): Unmasked<T> | null {\n return this.cache.readFragment<T, TVariables>(options, optimistic);\n }\n\n /**\n * Writes some data in the shape of the provided GraphQL query directly to\n * the store. This method will start at the root query. To start at a\n * specific id returned by `dataIdFromObject` then use `writeFragment`.\n */\n public writeQuery<TData = any, TVariables = OperationVariables>(\n options: DataProxy.WriteQueryOptions<TData, TVariables>\n ): Reference | undefined {\n const ref = this.cache.writeQuery<TData, TVariables>(options);\n\n if (options.broadcast !== false) {\n this.queryManager.broadcastQueries();\n }\n\n return ref;\n }\n\n /**\n * Writes some data in the shape of the provided GraphQL fragment directly to\n * the store. This method will write to a GraphQL fragment from any arbitrary\n * id that is currently cached, unlike `writeQuery` which will only write\n * from the root query.\n *\n * You must pass in a GraphQL document with a single fragment or a document\n * with multiple fragments that represent what you are writing. If you pass\n * in a document with multiple fragments then you must also specify a\n * `fragmentName`.\n */\n public writeFragment<TData = any, TVariables = OperationVariables>(\n options: DataProxy.WriteFragmentOptions<TData, TVariables>\n ): Reference | undefined {\n const ref = this.cache.writeFragment<TData, TVariables>(options);\n\n if (options.broadcast !== false) {\n this.queryManager.broadcastQueries();\n }\n\n return ref;\n }\n\n public __actionHookForDevTools(cb: () => any) {\n this.devToolsHookCb = cb;\n }\n\n public __requestRaw(\n payload: GraphQLRequest\n ): Observable<FormattedExecutionResult> {\n return execute(this.link, payload);\n }\n\n /**\n * Resets your entire store by clearing out your cache and then re-executing\n * all of your active queries. This makes it so that you may guarantee that\n * there is no data left in your store from a time before you called this\n * method.\n *\n * `resetStore()` is useful when your user just logged out. You’ve removed the\n * user session, and you now want to make sure that any references to data you\n * might have fetched while the user session was active is gone.\n *\n * It is important to remember that `resetStore()` *will* refetch any active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n */\n public resetStore(): Promise<ApolloQueryResult<any>[] | null> {\n return Promise.resolve()\n .then(() =>\n this.queryManager.clearStore({\n discardWatches: false,\n })\n )\n .then(() => Promise.all(this.resetStoreCallbacks.map((fn) => fn())))\n .then(() => this.reFetchObservableQueries());\n }\n\n /**\n * Remove all data from the store. Unlike `resetStore`, `clearStore` will\n * not refetch any active queries.\n */\n public clearStore(): Promise<any[]> {\n return Promise.resolve()\n .then(() =>\n this.queryManager.clearStore({\n discardWatches: true,\n })\n )\n .then(() => Promise.all(this.clearStoreCallbacks.map((fn) => fn())));\n }\n\n /**\n * Allows callbacks to be registered that are executed when the store is\n * reset. `onResetStore` returns an unsubscribe function that can be used\n * to remove registered callbacks.\n */\n public onResetStore(cb: () => Promise<any>): () => void {\n this.resetStoreCallbacks.push(cb);\n return () => {\n this.resetStoreCallbacks = this.resetStoreCallbacks.filter(\n (c) => c !== cb\n );\n };\n }\n\n /**\n * Allows callbacks to be registered that are executed when the store is\n * cleared. `onClearStore` returns an unsubscribe function that can be used\n * to remove registered callbacks.\n */\n public onClearStore(cb: () => Promise<any>): () => void {\n this.clearStoreCallbacks.push(cb);\n return () => {\n this.clearStoreCallbacks = this.clearStoreCallbacks.filter(\n (c) => c !== cb\n );\n };\n }\n\n /**\n * Refetches all of your active queries.\n *\n * `reFetchObservableQueries()` is useful if you want to bring the client back to proper state in case of a network outage\n *\n * It is important to remember that `reFetchObservableQueries()` *will* refetch any active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n * Takes optional parameter `includeStandby` which will include queries in standby-mode when refetching.\n */\n public reFetchObservableQueries(\n includeStandby?: boolean\n ): Promise<ApolloQueryResult<any>[]> {\n return this.queryManager.reFetchObservableQueries(includeStandby);\n }\n\n /**\n * Refetches specified active queries. Similar to \"reFetchObservableQueries()\" but with a specific list of queries.\n *\n * `refetchQueries()` is useful for use cases to imperatively refresh a selection of queries.\n *\n * It is important to remember that `refetchQueries()` *will* refetch specified active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n */\n public refetchQueries<\n TCache extends ApolloCache<any> = ApolloCache<TCacheShape>,\n TResult = Promise<ApolloQueryResult<any>>,\n >(\n options: RefetchQueriesOptions<TCache, TResult>\n ): RefetchQueriesResult<TResult> {\n const map = this.queryManager.refetchQueries(\n options as RefetchQueriesOptions<ApolloCache<TCacheShape>, TResult>\n );\n const queries: ObservableQuery<any>[] = [];\n const results: InternalRefetchQueriesResult<TResult>[] = [];\n\n map.forEach((result, obsQuery) => {\n queries.push(obsQuery);\n results.push(result);\n });\n\n const result = Promise.all<TResult>(\n results as TResult[]\n ) as RefetchQueriesResult<TResult>;\n\n // In case you need the raw results immediately, without awaiting\n // Promise.all(results):\n result.queries = queries;\n result.results = results;\n\n // If you decide to ignore the result Promise because you're using\n // result.queries and result.results instead, you shouldn't have to worry\n // about preventing uncaught rejections for the Promise.all result.\n result.catch((error) => {\n invariant.debug(\n `In client.refetchQueries, Promise.all promise rejected with error %o`,\n error\n );\n });\n\n return result;\n }\n\n /**\n * Get all currently active `ObservableQuery` objects, in a `Map` keyed by\n * query ID strings.\n *\n * An \"active\" query is one that has observers and a `fetchPolicy` other than\n * \"standby\" or \"cache-only\".\n *\n * You can include all `ObservableQuery` objects (including the inactive ones)\n * by passing \"all\" instead of \"active\", or you can include just a subset of\n * active queries by passing an array of query names or DocumentNode objects.\n */\n public getObservableQueries(\n include: RefetchQueriesInclude = \"active\"\n ): Map<string, ObservableQuery<any>> {\n return this.queryManager.getObservableQueries(include);\n }\n\n /**\n * Exposes the cache's complete state, in a serializable format for later restoration.\n */\n public extract(optimistic?: boolean): TCacheShape {\n return this.cache.extract(optimistic);\n }\n\n /**\n * Replaces existing state in the cache (if any) with the values expressed by\n * `serializedState`.\n *\n * Called when hydrating a cache (server side rendering, or offline storage),\n * and also (potentially) during hot reloads.\n */\n public restore(serializedState: TCacheShape): ApolloCache<TCacheShape> {\n return this.cache.restore(serializedState);\n }\n\n /**\n * Add additional local resolvers.\n *\n * @deprecated `addResolvers` will been removed in Apollo Client 4.0. It is\n * safe to continue using this method in Apollo Client 3.x.\n *\n * **Recommended now**\n *\n * No action needed\n *\n * **When upgrading**\n *\n * Use `client.localState.addResolvers(resolvers)`. Alternatively, store\n * the `LocalState` instance in a separate variable and call `addResolvers` on\n * that.\n */\n public addResolvers(resolvers: Resolvers | Resolvers[]) {\n this.localState.addResolvers(resolvers);\n }\n\n /**\n * Set (override existing) local resolvers.\n *\n * @deprecated `setResolvers` will been removed in Apollo Client 4.0. It is\n * safe to continue using this method in Apollo Client 3.x.\n *\n * **Recommended now**\n *\n * If possible, stop using the `setResolvers` method.\n *\n * **When upgrading**\n *\n * Remove the use of `setResolvers`.\n */\n public setResolvers(resolvers: Resolvers | Resolvers[]) {\n this.localState.setResolvers(resolvers);\n }\n\n /**\n * Get all registered local resolvers.\n *\n * @deprecated `getResolvers` will be removed in Apollo Client 4.0. It is\n * safe to continue using this method in Apollo Client 3.x.\n *\n * **Recommended now**\n *\n * If possible, stop using the `getResolvers` method.\n *\n * **When upgrading**\n *\n * Remove the use of `getResolvers`.\n */\n public getResolvers() {\n return this.localState.getResolvers();\n }\n\n /**\n * Set a custom local state fragment matcher.\n *\n * @deprecated Custom fragment matchers will no longer be supported in Apollo\n * Client 4.0 and has been replaced by `cache.fragmentMatches`. It is safe to\n * continue using `setLocalStateFragmentMatcher` in Apollo Client 3.x.\n *\n * **Recommended now**\n *\n * No action needed\n *\n * **When upgrading**\n *\n * Leverage `possibleTypes` with `InMemoryCache` to ensure fragments match\n * correctly. Ensure `possibleTypes` include local types if needed. If working\n * with a 3rd party cache implementation, ensure the 3rd party cache implements\n * the `cache.fragmentMatches` method. This function should no longer be used.\n */\n public setLocalStateFragmentMatcher(fragmentMatcher: FragmentMatcher) {\n this.localState.setFragmentMatcher(fragmentMatcher);\n }\n\n /**\n * Define a new ApolloLink (or link chain) that Apollo Client will use.\n */\n public setLink(newLink: ApolloLink) {\n this.link = this.queryManager.link = newLink;\n }\n\n public get defaultContext() {\n return this.queryManager.defaultContext;\n }\n\n /**\n * @experimental\n * This is not a stable API - it is used in development builds to expose\n * information to the DevTools.\n * Use at your own risk!\n * For more details, see [Memory Management](https://www.apollographql.com/docs/react/caching/memory-management/#measuring-cache-usage)\n *\n * @example\n * ```ts\n * console.log(client.getMemoryInternals())\n * ```\n * Logs output in the following JSON format:\n * @example\n * ```json\n *{\n * limits: {\n * parser: 1000,\n * canonicalStringify: 1000,\n * print: 2000,\n * 'documentTransform.cache': 2000,\n * 'queryManager.getDocumentInfo': 2000,\n * 'PersistedQueryLink.persistedQueryHashes': 2000,\n * 'fragmentRegistry.transform': 2000,\n * 'fragmentRegistry.lookup': 1000,\n * 'fragmentRegistry.findFragmentSpreads': 4000,\n * 'cache.fragmentQueryDocuments': 1000,\n * 'removeTypenameFromVariables.getVariableDefinitions': 2000,\n * 'inMemoryCache.maybeBroadcastWatch': 5000,\n * 'inMemoryCache.executeSelectionSet': 10000,\n * 'inMemoryCache.executeSubSelectedArray': 5000\n * },\n * sizes: {\n * parser: 26,\n * canonicalStringify: 4,\n * print: 14,\n * addTypenameDocumentTransform: [\n * {\n * cache: 14,\n * },\n * ],\n * queryManager: {\n * getDocumentInfo: 14,\n * documentTransforms: [\n * {\n * cache: 14,\n * },\n * {\n * cache: 14,\n * },\n * ],\n * },\n * fragmentRegistry: {\n * findFragmentSpreads: 34,\n * lookup: 20,\n * transform: 14,\n * },\n * cache: {\n * fragmentQueryDocuments: 22,\n * },\n * inMemoryCache: {\n * executeSelectionSet: 4345,\n * executeSubSelectedArray: 1206,\n * maybeBroadcastWatch: 32,\n * },\n * links: [\n * {\n * PersistedQueryLink: {\n * persistedQueryHashes: 14,\n * },\n * },\n * {\n * removeTypenameFromVariables: {\n * getVariableDefinitions: 14,\n * },\n * },\n * ],\n * },\n * }\n *```\n */\n public getMemoryInternals?: typeof getApolloClientMemoryInternals;\n}\n\nif (__DEV__) {\n ApolloClient.prototype.getMemoryInternals = getApolloClientMemoryInternals;\n}\n"]}
1
+ {"version":3,"file":"ApolloClient.js","sourceRoot":"","sources":["../../src/core/ApolloClient.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAK7E,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAI5D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAyBjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAwB7C,IAAI,oBAAoB,GAAG,KAAK,CAAC;AA+NjC,sEAAsE;AACtE,8EAA8E;AAC9E,8EAA8E;AAC9E,gFAAgF;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AAM5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB;;;;;GAKG;AACH;IAwCE;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,sBAAY,OAAyC;QAArD,iBA+JC;;QA5MO,wBAAmB,GAA8B,EAAE,CAAC;QACpD,wBAAmB,GAA8B,EAAE,CAAC;QA6C1D,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACnB,MAAM,iBAAiB,CACrB,mEAAmE;gBACjE,2BAA2B;gBAC3B,kEAAkE,CACrE,CAAC;QACJ,CAAC;QAGC,IAAA,GAAG,GAuBD,OAAO,IAvB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C,OAAO,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACI,8BAAO,GAAd,UAAe,eAA4B;QACzC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACI,mCAAY,GAAnB,UAAoB,SAAkC;QACpD,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;;;;;;;;OAaG;IACI,mCAAY,GAAnB,UAAoB,SAAkC;QACpD,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;;;;;;;;OAaG;IACI,mCAAY,GAAnB;QACE,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;IACxC,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACI,mDAA4B,GAAnC,UAAoC,eAAgC;QAClE,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACI,8BAAO,GAAd,UAAe,OAAmB;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,GAAG,OAAO,CAAC;IAC/C,CAAC;IAED,sBAAW,wCAAc;aAAzB;YACE,OAAO,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC;QAC1C,CAAC;;;OAAA;IAmFH,mBAAC;AAAD,CAAC,AAt4BD,IAs4BC;;AAED,IAAI,OAAO,EAAE,CAAC;IACZ,YAAY,CAAC,SAAS,CAAC,kBAAkB,GAAG,8BAA8B,CAAC;AAC7E,CAAC","sourcesContent":["import { invariant, newInvariantError } from \"../utilities/globals/index.js\";\n\nimport type { DocumentNode, FormattedExecutionResult } from \"graphql\";\n\nimport type { GraphQLRequest } from \"../link/core/index.js\";\nimport { ApolloLink, execute } from \"../link/core/index.js\";\nimport type { ApolloCache, DataProxy, Reference } from \"../cache/index.js\";\nimport type { DocumentTransform } from \"../utilities/index.js\";\nimport type { Observable } from \"../utilities/index.js\";\nimport { version } from \"../version.js\";\nimport type { UriFunction } from \"../link/http/index.js\";\nimport { HttpLink } from \"../link/http/index.js\";\n\nimport { QueryManager } from \"./QueryManager.js\";\nimport type { ObservableQuery } from \"./ObservableQuery.js\";\n\nimport type {\n DefaultContext,\n OperationVariables,\n Resolvers,\n RefetchQueriesOptions,\n RefetchQueriesResult,\n InternalRefetchQueriesResult,\n RefetchQueriesInclude,\n InteropApolloQueryResult,\n InteropMutateResult,\n InteropSubscribeResult,\n} from \"./types.js\";\n\nimport type {\n QueryOptions,\n WatchQueryOptions,\n MutationOptions,\n SubscriptionOptions,\n WatchQueryFetchPolicy,\n} from \"./watchQueryOptions.js\";\n\nimport type { FragmentMatcher } from \"./LocalState.js\";\nimport { LocalState } from \"./LocalState.js\";\n\nexport interface DefaultOptions {\n watchQuery?: Partial<WatchQueryOptions<any, any>>;\n query?: Partial<QueryOptions<any, any>>;\n mutate?: Partial<MutationOptions<any, any, any>>;\n}\n\nexport interface DevtoolsOptions {\n /**\n * If `true`, the [Apollo Client Devtools](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) browser extension can connect to this `ApolloClient` instance.\n *\n * The default value is `false` in production and `true` in development if there is a `window` object.\n */\n enabled?: boolean;\n\n /**\n * Optional name for this `ApolloClient` instance in the devtools. This is\n * useful when you instantiate multiple clients and want to be able to\n * identify them by name.\n */\n name?: string;\n}\n\nlet hasSuggestedDevtools = false;\n\nexport interface ApolloClientOptions<TCacheShape> {\n /**\n * The URI of the GraphQL endpoint that Apollo Client will communicate with.\n *\n * One of `uri` or `link` is **required**. If you provide both, `link` takes precedence.\n *\n * @deprecated `uri` will be removed in Apollo Client 4.0.\n *\n * **Recommended now**\n *\n * Instantiate an instance of `HttpClient` and pass `uri` as an option.\n *\n * ```js\n * import { HttpLink } from \"@apollo/client\";\n *\n * new ApolloClient({\n * link: new HttpLink({ uri })\n * });\n * ```\n */\n uri?: string | UriFunction;\n\n /**\n * @deprecated `credentials` will be removed in Apollo Client 4.0.\n *\n * **Recommended now**\n *\n * Instantiate an instance of `HttpClient` and pass `credentials` as an option.\n *\n * ```js\n * import { HttpLink } from \"@apollo/client\";\n *\n * new ApolloClient({\n * link: new HttpLink({ credentials })\n * });\n * ```\n */\n credentials?: string;\n /**\n * An object representing headers to include in every HTTP request, such as `{Authorization: 'Bearer 1234'}`\n *\n * This value will be ignored when using the `link` option.\n *\n * @deprecated `headers` will be removed in Apollo Client 4.0.\n *\n * **Recommended now**\n *\n * Instantiate an instance of `HttpClient` and pass `headers` as an option.\n *\n * ```js\n * import { HttpLink } from \"@apollo/client\";\n *\n * new ApolloClient({\n * link: new HttpLink({ headers })\n * });\n * ```\n */\n headers?: Record<string, string>;\n /**\n * You can provide an `ApolloLink` instance to serve as Apollo Client's network layer. For more information, see [Advanced HTTP networking](https://www.apollographql.com/docs/react/networking/advanced-http-networking/).\n *\n * One of `uri` or `link` is **required**. If you provide both, `link` takes precedence.\n */\n link?: ApolloLink;\n /**\n * The cache that Apollo Client should use to store query results locally. The recommended cache is `InMemoryCache`, which is provided by the `@apollo/client` package.\n *\n * For more information, see [Configuring the cache](https://www.apollographql.com/docs/react/caching/cache-configuration/).\n */\n cache: ApolloCache<TCacheShape>;\n /**\n * The time interval (in milliseconds) before Apollo Client force-fetches queries after a server-side render.\n *\n * @defaultValue `0` (no delay)\n */\n ssrForceFetchDelay?: number;\n /**\n * When using Apollo Client for [server-side rendering](https://www.apollographql.com/docs/react/performance/server-side-rendering/), set this to `true` so that the [`getDataFromTree` function](../react/ssr/#getdatafromtree) can work effectively.\n *\n * @defaultValue `false`\n */\n ssrMode?: boolean;\n /**\n * If `true`, the [Apollo Client Devtools](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) browser extension can connect to Apollo Client.\n *\n * The default value is `false` in production and `true` in development (if there is a `window` object).\n *\n * @deprecated `connectToDevTools` will be removed in Apollo Client 4.0.\n *\n * **Recommended now**\n *\n * Use the `devtools.enabled` option instead.\n *\n * ```ts\n * new ApolloClient({\n * devtools: { enabled: true }\n * });\n * ```\n */\n connectToDevTools?: boolean;\n /**\n * If `false`, Apollo Client sends every created query to the server, even if a _completely_ identical query (identical in terms of query string, variable values, and operationName) is already in flight.\n *\n * @defaultValue `true`\n */\n queryDeduplication?: boolean;\n /**\n * Provide this object to set application-wide default values for options you can provide to the `watchQuery`, `query`, and `mutate` functions. See below for an example object.\n *\n * See this [example object](https://www.apollographql.com/docs/react/api/core/ApolloClient#example-defaultoptions-object).\n */\n defaultOptions?: DefaultOptions;\n defaultContext?: Partial<DefaultContext>;\n /**\n * If `true`, Apollo Client will assume results read from the cache are never mutated by application code, which enables substantial performance optimizations.\n *\n * @defaultValue `false`\n */\n assumeImmutableResults?: boolean;\n\n /**\n * @deprecated `resolvers` has been moved in Apollo Client 4.0. This option is\n * safe to use in Apollo Client 3.x.\n *\n * **Recommended now**\n *\n * No action needed\n *\n * **When upgrading**\n *\n * `resolvers` will need to be passed as the `resolvers` option to an instance\n * of `LocalState`. That `LocalState` instance should be provided as the\n * `localState` option to the `ApolloClient` constructor.\n */\n resolvers?: Resolvers | Resolvers[];\n\n /**\n * @deprecated `typeDefs` will be removed in Apollo Client 4.0. It is safe to\n * stop using this option in Apollo Client 3.x.\n */\n typeDefs?: string | string[] | DocumentNode | DocumentNode[];\n\n /**\n * @deprecated Custom fragment matchers will no longer be supported in Apollo\n * Client 4.0 and has been replaced by `cache.fragmentMatches`. It is safe to\n * continue using this in Apollo Client 3.x.\n *\n * **Recommended now**\n *\n * No action needed\n *\n * **When upgrading**\n *\n * Leverage `possibleTypes` with `InMemoryCache` to ensure fragments match\n * correctly. Ensure `possibleTypes` include local types if needed. This\n * option should then be removed. If working with a 3rd party cache\n * implementation, ensure the 3rd party cache implements the\n * `cache.fragmentMatches` method.\n */\n fragmentMatcher?: FragmentMatcher;\n /**\n * A custom name (e.g., `iOS`) that identifies this particular client among your set of clients. Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * @deprecated `name` has been moved to `clientAwareness.name` in Apollo Client 4.0.\n *\n * **Recommended now**\n *\n * Use `clientAwareness.name` to set the client awareness name.\n *\n * ```ts\n * new ApolloClient({ clientAwareness: { name } });\n * ```\n */\n name?: string;\n /**\n * A custom version that identifies the current version of this particular client (e.g., `1.2`). Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * This is **not** the version of Apollo Client that you are using, but rather any version string that helps you differentiate between versions of your client.\n *\n * @deprecated `name` has been moved to `clientAwareness.version` in Apollo Client 4.0.\n *\n * **Recommended now**\n *\n * Use `clientAwareness.version` to set the client awareness version.\n *\n * ```ts\n * new ApolloClient({ clientAwareness: { version } });\n * ```\n */\n version?: string;\n\n clientAwareness?: {\n /**\n * A custom name (e.g., `iOS`) that identifies this particular client among your set of clients. Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n */\n name?: string;\n /**\n * A custom version that identifies the current version of this particular client (e.g., `1.2`). Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * This is **not** the version of Apollo Client that you are using, but rather any version string that helps you differentiate between versions of your client.\n */\n version?: string;\n };\n\n documentTransform?: DocumentTransform;\n\n /**\n * Configuration used by the [Apollo Client Devtools extension](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) for this client.\n *\n * @since 3.11.0\n */\n devtools?: DevtoolsOptions;\n\n /**\n * Determines if data masking is enabled for the client.\n *\n * @defaultValue false\n */\n dataMasking?: boolean;\n}\n\n// Though mergeOptions now resides in @apollo/client/utilities, it was\n// previously declared and exported from this module, and then reexported from\n// @apollo/client/core. Since we need to preserve that API anyway, the easiest\n// solution is to reexport mergeOptions where it was previously declared (here).\nimport { mergeOptions } from \"../utilities/index.js\";\nimport { getApolloClientMemoryInternals } from \"../utilities/caching/getMemoryInternals.js\";\nimport type {\n WatchFragmentOptions,\n WatchFragmentResult,\n} from \"../cache/core/cache.js\";\nimport type { MaybeMasked, Unmasked } from \"../masking/index.js\";\nimport { warnRemovedOption } from \"../utilities/deprecation/index.js\";\nexport { mergeOptions };\n\n/**\n * This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries\n * and mutations) to a GraphQL spec-compliant server over an `ApolloLink` instance,\n * receive results from the server and cache the results in a store. It also delivers updates\n * to GraphQL queries through `Observable` instances.\n */\nexport class ApolloClient<TCacheShape = any> implements DataProxy {\n public link: ApolloLink;\n public cache: ApolloCache<TCacheShape>;\n\n /**\n * @deprecated `disableNetworkFetches` has been renamed to `prioritizeCacheValues`\n * in Apollo Client 4.0.\n *\n * **Recommended now**\n *\n * Access `client.prioritizeCacheValues` instead.\n */\n public disableNetworkFetches: boolean;\n public version: string;\n public queryDeduplication: boolean;\n public defaultOptions: DefaultOptions;\n public readonly typeDefs: ApolloClientOptions<TCacheShape>[\"typeDefs\"];\n public readonly devtoolsConfig: DevtoolsOptions;\n\n private queryManager: QueryManager<TCacheShape>;\n private devToolsHookCb?: Function;\n private resetStoreCallbacks: Array<() => Promise<any>> = [];\n private clearStoreCallbacks: Array<() => Promise<any>> = [];\n public localState: LocalState<TCacheShape>;\n\n /**\n * Whether to prioritize cache values over network results when `query` or `watchQuery` is called.\n * This will essentially turn a `\"network-only\"` or `\"cache-and-network\"` fetchPolicy into a `\"cache-first\"` fetchPolicy,\n * but without influencing the `fetchPolicy` of the created `ObservableQuery` long-term.\n *\n * This can e.g. be used to prioritize the cache during the first render after SSR.\n */\n public get prioritizeCacheValues() {\n return this.disableNetworkFetches;\n }\n\n public set prioritizeCacheValues(value: boolean) {\n this.disableNetworkFetches = value;\n }\n\n /**\n * Constructs an instance of `ApolloClient`.\n *\n * @example\n * ```js\n * import { ApolloClient, InMemoryCache } from '@apollo/client';\n *\n * const cache = new InMemoryCache();\n *\n * const client = new ApolloClient({\n * // Provide required constructor fields\n * cache: cache,\n * uri: 'http://localhost:4000/',\n *\n * // Provide some optional constructor fields\n * name: 'react-web-client',\n * version: '1.3',\n * queryDeduplication: false,\n * defaultOptions: {\n * watchQuery: {\n * fetchPolicy: 'cache-and-network',\n * },\n * },\n * });\n * ```\n */\n constructor(options: ApolloClientOptions<TCacheShape>) {\n if (!options.cache) {\n throw newInvariantError(\n \"To initialize Apollo Client, you must specify a 'cache' property \" +\n \"in the options object. \\n\" +\n \"For more information, please visit: https://go.apollo.dev/c/docs\"\n );\n }\n\n const {\n uri,\n credentials,\n headers,\n cache,\n documentTransform,\n ssrMode = false,\n ssrForceFetchDelay = 0,\n // Expose the client instance as window.__APOLLO_CLIENT__ and call\n // onBroadcast in queryManager.broadcastQueries to enable browser\n // devtools, but disable them by default in production.\n connectToDevTools,\n queryDeduplication = true,\n defaultOptions,\n defaultContext,\n assumeImmutableResults = cache.assumeImmutableResults,\n resolvers,\n typeDefs,\n fragmentMatcher,\n clientAwareness,\n name: clientAwarenessName,\n version: clientAwarenessVersion,\n devtools,\n dataMasking,\n } = options;\n\n if (__DEV__) {\n warnRemovedOption(\n options,\n \"connectToDevTools\",\n \"ApolloClient\",\n \"Please use `devtools.enabled` instead.\"\n );\n warnRemovedOption(\n options,\n \"uri\",\n \"ApolloClient\",\n \"Please initialize an instance of `HttpLink` with `uri` instead.\"\n );\n warnRemovedOption(\n options,\n \"credentials\",\n \"ApolloClient\",\n \"Please initialize an instance of `HttpLink` with `credentials` instead.\"\n );\n warnRemovedOption(\n options,\n \"headers\",\n \"ApolloClient\",\n \"Please initialize an instance of `HttpLink` with `headers` instead.\"\n );\n warnRemovedOption(\n options,\n \"name\",\n \"ApolloClient\",\n \"Please use the `clientAwareness.name` option instead.\"\n );\n warnRemovedOption(\n options,\n \"version\",\n \"ApolloClient\",\n \"Please use the `clientAwareness.version` option instead.\"\n );\n warnRemovedOption(options, \"typeDefs\", \"ApolloClient\");\n\n if (!options.link) {\n invariant.warn(\n \"[ApolloClient]: Apollo Client 4.0 will require a `link` option and will not create a default link when not provided. Please provide a `link` option.\"\n );\n }\n }\n\n let { link } = options;\n\n if (!link) {\n link =\n uri ? new HttpLink({ uri, credentials, headers }) : ApolloLink.empty();\n }\n\n this.link = link;\n this.cache = cache;\n this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0;\n this.queryDeduplication = queryDeduplication;\n this.defaultOptions = defaultOptions || Object.create(null);\n this.typeDefs = typeDefs;\n this.devtoolsConfig = {\n ...devtools,\n enabled: devtools?.enabled ?? connectToDevTools,\n };\n\n if (this.devtoolsConfig.enabled === undefined) {\n this.devtoolsConfig.enabled = __DEV__;\n }\n\n if (ssrForceFetchDelay) {\n setTimeout(\n () => (this.disableNetworkFetches = false),\n ssrForceFetchDelay\n );\n }\n\n this.watchQuery = this.watchQuery.bind(this);\n this.query = this.query.bind(this);\n this.mutate = this.mutate.bind(this);\n this.watchFragment = this.watchFragment.bind(this);\n this.resetStore = this.resetStore.bind(this);\n this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this);\n\n this.version = version;\n\n this.localState = new LocalState({\n cache,\n client: this,\n resolvers,\n fragmentMatcher,\n });\n\n this.queryManager = new QueryManager({\n cache: this.cache,\n link: this.link,\n defaultOptions: this.defaultOptions,\n defaultContext,\n documentTransform,\n queryDeduplication,\n ssrMode,\n dataMasking: !!dataMasking,\n clientAwareness: {\n name: clientAwareness?.name ?? clientAwarenessName!,\n version: clientAwareness?.version ?? clientAwarenessVersion!,\n },\n localState: this.localState,\n assumeImmutableResults,\n onBroadcast:\n this.devtoolsConfig.enabled ?\n () => {\n if (this.devToolsHookCb) {\n this.devToolsHookCb({\n action: {},\n state: {\n queries: this.queryManager.getQueryStore(),\n mutations: this.queryManager.mutationStore || {},\n },\n dataWithOptimisticResults: this.cache.extract(true),\n });\n }\n }\n : void 0,\n });\n\n if (this.devtoolsConfig.enabled) this.connectToDevTools();\n }\n\n private connectToDevTools() {\n if (typeof window === \"undefined\") {\n return;\n }\n\n type DevToolsConnector = {\n push(client: ApolloClient<any>): void;\n };\n const windowWithDevTools = window as Window & {\n [devtoolsSymbol]?: DevToolsConnector;\n __APOLLO_CLIENT__?: ApolloClient<any>;\n };\n const devtoolsSymbol = Symbol.for(\"apollo.devtools\");\n (windowWithDevTools[devtoolsSymbol] =\n windowWithDevTools[devtoolsSymbol] || ([] as DevToolsConnector)).push(\n this\n );\n windowWithDevTools.__APOLLO_CLIENT__ = this;\n\n /**\n * Suggest installing the devtools for developers who don't have them\n */\n if (!hasSuggestedDevtools && __DEV__) {\n hasSuggestedDevtools = true;\n if (\n window.document &&\n window.top === window.self &&\n /^(https?|file):$/.test(window.location.protocol)\n ) {\n setTimeout(() => {\n if (!(window as any).__APOLLO_DEVTOOLS_GLOBAL_HOOK__) {\n const nav = window.navigator;\n const ua = nav && nav.userAgent;\n let url: string | undefined;\n if (typeof ua === \"string\") {\n if (ua.indexOf(\"Chrome/\") > -1) {\n url =\n \"https://chrome.google.com/webstore/detail/\" +\n \"apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm\";\n } else if (ua.indexOf(\"Firefox/\") > -1) {\n url =\n \"https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/\";\n }\n }\n if (url) {\n invariant.log(\n \"Download the Apollo DevTools for a better development \" +\n \"experience: %s\",\n url\n );\n }\n }\n }, 10000);\n }\n }\n }\n\n /**\n * The `DocumentTransform` used to modify GraphQL documents before a request\n * is made. If a custom `DocumentTransform` is not provided, this will be the\n * default document transform.\n */\n get documentTransform() {\n return this.queryManager.documentTransform;\n }\n\n /**\n * Call this method to terminate any active client processes, making it safe\n * to dispose of this `ApolloClient` instance.\n */\n public stop() {\n this.queryManager.stop();\n }\n\n /**\n * This watches the cache store of the query according to the options specified and\n * returns an `ObservableQuery`. We can subscribe to this `ObservableQuery` and\n * receive updated results through an observer when the cache store changes.\n *\n * Note that this method is not an implementation of GraphQL subscriptions. Rather,\n * it uses Apollo's store in order to reactively deliver updates to your query results.\n *\n * For example, suppose you call watchQuery on a GraphQL query that fetches a person's\n * first and last name and this person has a particular object identifier, provided by\n * dataIdFromObject. Later, a different query fetches that same person's\n * first and last name and the first name has now changed. Then, any observers associated\n * with the results of the first query will be updated with a new result object.\n *\n * Note that if the cache does not change, the subscriber will *not* be notified.\n *\n * See [here](https://medium.com/apollo-stack/the-concepts-of-graphql-bc68bd819be3#.3mb0cbcmc) for\n * a description of store reactivity.\n */\n public watchQuery<\n T = any,\n TVariables extends OperationVariables = OperationVariables,\n >(options: WatchQueryOptions<TVariables, T>): ObservableQuery<T, TVariables> {\n if (this.defaultOptions.watchQuery) {\n options = mergeOptions(this.defaultOptions.watchQuery, options);\n }\n\n // XXX Overwriting options is probably not the best way to do this long term...\n if (\n this.disableNetworkFetches &&\n (options.fetchPolicy === \"network-only\" ||\n options.fetchPolicy === \"cache-and-network\")\n ) {\n options = { ...options, fetchPolicy: \"cache-first\" };\n }\n\n if (__DEV__) {\n warnRemovedOption(options, \"canonizeResults\", \"client.watchQuery\");\n warnRemovedOption(options, \"partialRefetch\", \"client.watchQuery\");\n }\n\n return this.queryManager.watchQuery<T, TVariables>(options);\n }\n\n /**\n * This resolves a single query according to the options specified and\n * returns a `Promise` which is either resolved with the resulting data\n * or rejected with an error.\n *\n * @param options - An object of type `QueryOptions` that allows us to\n * describe how this query should be treated e.g. whether it should hit the\n * server at all or just resolve from the cache, etc.\n */\n public query<\n T = any,\n TVariables extends OperationVariables = OperationVariables,\n >(\n options: QueryOptions<TVariables, T>\n ): Promise<InteropApolloQueryResult<MaybeMasked<T>>> {\n if (this.defaultOptions.query) {\n options = mergeOptions(this.defaultOptions.query, options);\n }\n\n invariant(\n (options.fetchPolicy as WatchQueryFetchPolicy) !== \"cache-and-network\",\n \"The cache-and-network fetchPolicy does not work with client.query, because \" +\n \"client.query can only return a single result. Please use client.watchQuery \" +\n \"to receive multiple results from the cache and the network, or consider \" +\n \"using a different fetchPolicy, such as cache-first or network-only.\"\n );\n\n if (this.disableNetworkFetches && options.fetchPolicy === \"network-only\") {\n options = { ...options, fetchPolicy: \"cache-first\" };\n }\n\n if (__DEV__) {\n warnRemovedOption(options, \"canonizeResults\", \"client.query\");\n warnRemovedOption(\n options,\n \"notifyOnNetworkStatusChange\",\n \"client.query\",\n \"This option does not affect `client.query` and can be safely removed.\"\n );\n\n if (options.fetchPolicy === \"standby\") {\n invariant.warn(\n \"[client.query]: Apollo Client 4.0 will no longer support the `standby` fetch policy with `client.query`. Please use a different fetch policy.\"\n );\n }\n }\n\n return this.queryManager.query<T, TVariables>(options);\n }\n\n /**\n * This resolves a single mutation according to the options specified and returns a\n * Promise which is either resolved with the resulting data or rejected with an\n * error. In some cases both `data` and `errors` might be undefined, for example\n * when `errorPolicy` is set to `'ignore'`.\n *\n * It takes options as an object with the following keys and values:\n */\n public mutate<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n TContext extends Record<string, any> = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n >(\n options: MutationOptions<TData, TVariables, TContext>\n ): Promise<InteropMutateResult<MaybeMasked<TData>>> {\n if (this.defaultOptions.mutate) {\n options = mergeOptions(this.defaultOptions.mutate, options);\n }\n return this.queryManager.mutate<TData, TVariables, TContext, TCache>(\n options\n );\n }\n\n /**\n * This subscribes to a graphql subscription according to the options specified and returns an\n * `Observable` which either emits received data or an error.\n */\n public subscribe<\n T = any,\n TVariables extends OperationVariables = OperationVariables,\n >(\n options: SubscriptionOptions<TVariables, T>\n ): Observable<InteropSubscribeResult<MaybeMasked<T>>> {\n const id = this.queryManager.generateQueryId();\n\n return this.queryManager\n .startGraphQLSubscription<T>(options)\n .map((result) => ({\n ...result,\n data: this.queryManager.maskOperation({\n document: options.query,\n data: result.data,\n fetchPolicy: options.fetchPolicy,\n id,\n }),\n }));\n }\n\n /**\n * Tries to read some data from the store in the shape of the provided\n * GraphQL query without making a network request. This method will start at\n * the root query. To start at a specific id returned by `dataIdFromObject`\n * use `readFragment`.\n *\n * @param optimistic - Set to `true` to allow `readQuery` to return\n * optimistic results. Is `false` by default.\n */\n public readQuery<T = any, TVariables = OperationVariables>(\n options: DataProxy.Query<TVariables, T>,\n optimistic: boolean = false\n ): Unmasked<T> | null {\n return this.cache.readQuery<T, TVariables>(options, optimistic);\n }\n\n /**\n * Watches the cache store of the fragment according to the options specified\n * and returns an `Observable`. We can subscribe to this\n * `Observable` and receive updated results through an\n * observer when the cache store changes.\n *\n * You must pass in a GraphQL document with a single fragment or a document\n * with multiple fragments that represent what you are reading. If you pass\n * in a document with multiple fragments then you must also specify a\n * `fragmentName`.\n *\n * @since 3.10.0\n * @param options - An object of type `WatchFragmentOptions` that allows\n * the cache to identify the fragment and optionally specify whether to react\n * to optimistic updates.\n */\n\n public watchFragment<\n TFragmentData = unknown,\n TVariables = OperationVariables,\n >(\n options: WatchFragmentOptions<TFragmentData, TVariables>\n ): Observable<WatchFragmentResult<TFragmentData>> {\n return this.cache.watchFragment({\n ...options,\n [Symbol.for(\"apollo.dataMasking\")]: this.queryManager.dataMasking,\n });\n }\n\n /**\n * Tries to read some data from the store in the shape of the provided\n * GraphQL fragment without making a network request. This method will read a\n * GraphQL fragment from any arbitrary id that is currently cached, unlike\n * `readQuery` which will only read from the root query.\n *\n * You must pass in a GraphQL document with a single fragment or a document\n * with multiple fragments that represent what you are reading. If you pass\n * in a document with multiple fragments then you must also specify a\n * `fragmentName`.\n *\n * @param optimistic - Set to `true` to allow `readFragment` to return\n * optimistic results. Is `false` by default.\n */\n public readFragment<T = any, TVariables = OperationVariables>(\n options: DataProxy.Fragment<TVariables, T>,\n optimistic: boolean = false\n ): Unmasked<T> | null {\n return this.cache.readFragment<T, TVariables>(options, optimistic);\n }\n\n /**\n * Writes some data in the shape of the provided GraphQL query directly to\n * the store. This method will start at the root query. To start at a\n * specific id returned by `dataIdFromObject` then use `writeFragment`.\n */\n public writeQuery<TData = any, TVariables = OperationVariables>(\n options: DataProxy.WriteQueryOptions<TData, TVariables>\n ): Reference | undefined {\n const ref = this.cache.writeQuery<TData, TVariables>(options);\n\n if (options.broadcast !== false) {\n this.queryManager.broadcastQueries();\n }\n\n return ref;\n }\n\n /**\n * Writes some data in the shape of the provided GraphQL fragment directly to\n * the store. This method will write to a GraphQL fragment from any arbitrary\n * id that is currently cached, unlike `writeQuery` which will only write\n * from the root query.\n *\n * You must pass in a GraphQL document with a single fragment or a document\n * with multiple fragments that represent what you are writing. If you pass\n * in a document with multiple fragments then you must also specify a\n * `fragmentName`.\n */\n public writeFragment<TData = any, TVariables = OperationVariables>(\n options: DataProxy.WriteFragmentOptions<TData, TVariables>\n ): Reference | undefined {\n const ref = this.cache.writeFragment<TData, TVariables>(options);\n\n if (options.broadcast !== false) {\n this.queryManager.broadcastQueries();\n }\n\n return ref;\n }\n\n public __actionHookForDevTools(cb: () => any) {\n this.devToolsHookCb = cb;\n }\n\n public __requestRaw(\n payload: GraphQLRequest\n ): Observable<FormattedExecutionResult> {\n return execute(this.link, payload);\n }\n\n /**\n * Resets your entire store by clearing out your cache and then re-executing\n * all of your active queries. This makes it so that you may guarantee that\n * there is no data left in your store from a time before you called this\n * method.\n *\n * `resetStore()` is useful when your user just logged out. You’ve removed the\n * user session, and you now want to make sure that any references to data you\n * might have fetched while the user session was active is gone.\n *\n * It is important to remember that `resetStore()` *will* refetch any active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n */\n public resetStore(): Promise<InteropApolloQueryResult<any>[] | null> {\n return Promise.resolve()\n .then(() =>\n this.queryManager.clearStore({\n discardWatches: false,\n })\n )\n .then(() => Promise.all(this.resetStoreCallbacks.map((fn) => fn())))\n .then(() => this.reFetchObservableQueries());\n }\n\n /**\n * Remove all data from the store. Unlike `resetStore`, `clearStore` will\n * not refetch any active queries.\n */\n public clearStore(): Promise<any[]> {\n return Promise.resolve()\n .then(() =>\n this.queryManager.clearStore({\n discardWatches: true,\n })\n )\n .then(() => Promise.all(this.clearStoreCallbacks.map((fn) => fn())));\n }\n\n /**\n * Allows callbacks to be registered that are executed when the store is\n * reset. `onResetStore` returns an unsubscribe function that can be used\n * to remove registered callbacks.\n */\n public onResetStore(cb: () => Promise<any>): () => void {\n this.resetStoreCallbacks.push(cb);\n return () => {\n this.resetStoreCallbacks = this.resetStoreCallbacks.filter(\n (c) => c !== cb\n );\n };\n }\n\n /**\n * Allows callbacks to be registered that are executed when the store is\n * cleared. `onClearStore` returns an unsubscribe function that can be used\n * to remove registered callbacks.\n */\n public onClearStore(cb: () => Promise<any>): () => void {\n this.clearStoreCallbacks.push(cb);\n return () => {\n this.clearStoreCallbacks = this.clearStoreCallbacks.filter(\n (c) => c !== cb\n );\n };\n }\n\n /**\n * Refetches all of your active queries.\n *\n * `reFetchObservableQueries()` is useful if you want to bring the client back to proper state in case of a network outage\n *\n * It is important to remember that `reFetchObservableQueries()` *will* refetch any active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n * Takes optional parameter `includeStandby` which will include queries in standby-mode when refetching.\n */\n public reFetchObservableQueries(\n includeStandby?: boolean\n ): Promise<InteropApolloQueryResult<any>[]> {\n return this.queryManager.reFetchObservableQueries(includeStandby);\n }\n\n /**\n * Refetches specified active queries. Similar to \"reFetchObservableQueries()\" but with a specific list of queries.\n *\n * `refetchQueries()` is useful for use cases to imperatively refresh a selection of queries.\n *\n * It is important to remember that `refetchQueries()` *will* refetch specified active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n */\n public refetchQueries<\n TCache extends ApolloCache<any> = ApolloCache<TCacheShape>,\n TResult = Promise<InteropApolloQueryResult<any>>,\n >(\n options: RefetchQueriesOptions<TCache, TResult>\n ): RefetchQueriesResult<TResult> {\n const map = this.queryManager.refetchQueries(\n options as RefetchQueriesOptions<ApolloCache<TCacheShape>, TResult>\n );\n const queries: ObservableQuery<any>[] = [];\n const results: InternalRefetchQueriesResult<TResult>[] = [];\n\n map.forEach((result, obsQuery) => {\n queries.push(obsQuery);\n results.push(result);\n });\n\n const result = Promise.all<TResult>(\n results as TResult[]\n ) as RefetchQueriesResult<TResult>;\n\n // In case you need the raw results immediately, without awaiting\n // Promise.all(results):\n result.queries = queries;\n result.results = results;\n\n // If you decide to ignore the result Promise because you're using\n // result.queries and result.results instead, you shouldn't have to worry\n // about preventing uncaught rejections for the Promise.all result.\n result.catch((error) => {\n invariant.debug(\n `In client.refetchQueries, Promise.all promise rejected with error %o`,\n error\n );\n });\n\n return result;\n }\n\n /**\n * Get all currently active `ObservableQuery` objects, in a `Map` keyed by\n * query ID strings.\n *\n * An \"active\" query is one that has observers and a `fetchPolicy` other than\n * \"standby\" or \"cache-only\".\n *\n * You can include all `ObservableQuery` objects (including the inactive ones)\n * by passing \"all\" instead of \"active\", or you can include just a subset of\n * active queries by passing an array of query names or DocumentNode objects.\n */\n public getObservableQueries(\n include: RefetchQueriesInclude = \"active\"\n ): Map<string, ObservableQuery<any>> {\n return this.queryManager.getObservableQueries(include);\n }\n\n /**\n * Exposes the cache's complete state, in a serializable format for later restoration.\n */\n public extract(optimistic?: boolean): TCacheShape {\n return this.cache.extract(optimistic);\n }\n\n /**\n * Replaces existing state in the cache (if any) with the values expressed by\n * `serializedState`.\n *\n * Called when hydrating a cache (server side rendering, or offline storage),\n * and also (potentially) during hot reloads.\n */\n public restore(serializedState: TCacheShape): ApolloCache<TCacheShape> {\n return this.cache.restore(serializedState);\n }\n\n /**\n * Add additional local resolvers.\n *\n * @deprecated `addResolvers` will been removed in Apollo Client 4.0. It is\n * safe to continue using this method in Apollo Client 3.x.\n *\n * **Recommended now**\n *\n * No action needed\n *\n * **When upgrading**\n *\n * Use `client.localState.addResolvers(resolvers)`. Alternatively, store\n * the `LocalState` instance in a separate variable and call `addResolvers` on\n * that.\n */\n public addResolvers(resolvers: Resolvers | Resolvers[]) {\n this.localState.addResolvers(resolvers);\n }\n\n /**\n * Set (override existing) local resolvers.\n *\n * @deprecated `setResolvers` will been removed in Apollo Client 4.0. It is\n * safe to continue using this method in Apollo Client 3.x.\n *\n * **Recommended now**\n *\n * If possible, stop using the `setResolvers` method.\n *\n * **When upgrading**\n *\n * Remove the use of `setResolvers`.\n */\n public setResolvers(resolvers: Resolvers | Resolvers[]) {\n this.localState.setResolvers(resolvers);\n }\n\n /**\n * Get all registered local resolvers.\n *\n * @deprecated `getResolvers` will be removed in Apollo Client 4.0. It is\n * safe to continue using this method in Apollo Client 3.x.\n *\n * **Recommended now**\n *\n * If possible, stop using the `getResolvers` method.\n *\n * **When upgrading**\n *\n * Remove the use of `getResolvers`.\n */\n public getResolvers() {\n return this.localState.getResolvers();\n }\n\n /**\n * Set a custom local state fragment matcher.\n *\n * @deprecated Custom fragment matchers will no longer be supported in Apollo\n * Client 4.0 and has been replaced by `cache.fragmentMatches`. It is safe to\n * continue using `setLocalStateFragmentMatcher` in Apollo Client 3.x.\n *\n * **Recommended now**\n *\n * No action needed\n *\n * **When upgrading**\n *\n * Leverage `possibleTypes` with `InMemoryCache` to ensure fragments match\n * correctly. Ensure `possibleTypes` include local types if needed. If working\n * with a 3rd party cache implementation, ensure the 3rd party cache implements\n * the `cache.fragmentMatches` method. This function should no longer be used.\n */\n public setLocalStateFragmentMatcher(fragmentMatcher: FragmentMatcher) {\n this.localState.setFragmentMatcher(fragmentMatcher);\n }\n\n /**\n * Define a new ApolloLink (or link chain) that Apollo Client will use.\n */\n public setLink(newLink: ApolloLink) {\n this.link = this.queryManager.link = newLink;\n }\n\n public get defaultContext() {\n return this.queryManager.defaultContext;\n }\n\n /**\n * @experimental\n * This is not a stable API - it is used in development builds to expose\n * information to the DevTools.\n * Use at your own risk!\n * For more details, see [Memory Management](https://www.apollographql.com/docs/react/caching/memory-management/#measuring-cache-usage)\n *\n * @example\n * ```ts\n * console.log(client.getMemoryInternals())\n * ```\n * Logs output in the following JSON format:\n * @example\n * ```json\n *{\n * limits: {\n * parser: 1000,\n * canonicalStringify: 1000,\n * print: 2000,\n * 'documentTransform.cache': 2000,\n * 'queryManager.getDocumentInfo': 2000,\n * 'PersistedQueryLink.persistedQueryHashes': 2000,\n * 'fragmentRegistry.transform': 2000,\n * 'fragmentRegistry.lookup': 1000,\n * 'fragmentRegistry.findFragmentSpreads': 4000,\n * 'cache.fragmentQueryDocuments': 1000,\n * 'removeTypenameFromVariables.getVariableDefinitions': 2000,\n * 'inMemoryCache.maybeBroadcastWatch': 5000,\n * 'inMemoryCache.executeSelectionSet': 10000,\n * 'inMemoryCache.executeSubSelectedArray': 5000\n * },\n * sizes: {\n * parser: 26,\n * canonicalStringify: 4,\n * print: 14,\n * addTypenameDocumentTransform: [\n * {\n * cache: 14,\n * },\n * ],\n * queryManager: {\n * getDocumentInfo: 14,\n * documentTransforms: [\n * {\n * cache: 14,\n * },\n * {\n * cache: 14,\n * },\n * ],\n * },\n * fragmentRegistry: {\n * findFragmentSpreads: 34,\n * lookup: 20,\n * transform: 14,\n * },\n * cache: {\n * fragmentQueryDocuments: 22,\n * },\n * inMemoryCache: {\n * executeSelectionSet: 4345,\n * executeSubSelectedArray: 1206,\n * maybeBroadcastWatch: 32,\n * },\n * links: [\n * {\n * PersistedQueryLink: {\n * persistedQueryHashes: 14,\n * },\n * },\n * {\n * removeTypenameFromVariables: {\n * getVariableDefinitions: 14,\n * },\n * },\n * ],\n * },\n * }\n *```\n */\n public getMemoryInternals?: typeof getApolloClientMemoryInternals;\n}\n\nif (__DEV__) {\n ApolloClient.prototype.getMemoryInternals = getApolloClientMemoryInternals;\n}\n"]}
@@ -196,7 +196,7 @@ var LocalState = /** @class */ (function () {
196
196
  else {
197
197
  // This is a named fragment.
198
198
  fragment = fragmentMap[selection.name.value];
199
- invariant(fragment, 20, selection.name.value);
199
+ invariant(fragment, 21, selection.name.value);
200
200
  }
201
201
  if (fragment && fragment.typeCondition) {
202
202
  typeCondition = fragment.typeCondition.name.value;
@@ -328,7 +328,7 @@ var LocalState = /** @class */ (function () {
328
328
  },
329
329
  FragmentSpread: function (spread, _, __, ___, ancestors) {
330
330
  var fragment = fragmentMap[spread.name.value];
331
- invariant(fragment, 21, spread.name.value);
331
+ invariant(fragment, 22, spread.name.value);
332
332
  var fragmentSelections = collectByDefinition(fragment);
333
333
  if (fragmentSelections.size > 0) {
334
334
  // Fragment for this spread contains @client directive (either directly or transitively)
@@ -3,7 +3,7 @@ import type { Concast, Observer, ObservableSubscription } from "../utilities/ind
3
3
  import { Observable } from "../utilities/index.js";
4
4
  import { ApolloError } from "../errors/index.js";
5
5
  import type { QueryManager } from "./QueryManager.js";
6
- import type { ApolloQueryResult, OperationVariables, TypedDocumentNode } from "./types.js";
6
+ import type { ApolloQueryResult, InteropApolloQueryResult, OperationVariables, TypedDocumentNode } from "./types.js";
7
7
  import type { WatchQueryOptions, FetchMoreQueryOptions, SubscribeToMoreOptions, UpdateQueryMapFn } from "./watchQueryOptions.js";
8
8
  import type { QueryInfo } from "./QueryInfo.js";
9
9
  import type { MissingFieldError } from "../cache/index.js";
@@ -25,6 +25,15 @@ export declare class ObservableQuery<TData = any, TVariables extends OperationVa
25
25
  */
26
26
  private static inactiveOnCreation;
27
27
  readonly options: WatchQueryOptions<TVariables, TData>;
28
+ /**
29
+ * @deprecated `queryId` will be removed in Apollo Client 4.0. This value is
30
+ * safe to use in Apollo Client 3.x.
31
+ *
32
+ * **Recommended now**
33
+ *
34
+ * `ObservableQuery` does not have a unique identifier in 4.0. If you rely on
35
+ * this value, please try to migrate away from it.
36
+ */
28
37
  readonly queryId: string;
29
38
  readonly queryName?: string;
30
39
  get query(): TypedDocumentNode<TData, TVariables>;
@@ -48,6 +57,22 @@ export declare class ObservableQuery<TData = any, TVariables extends OperationVa
48
57
  queryInfo: QueryInfo;
49
58
  options: WatchQueryOptions<TVariables, TData>;
50
59
  });
60
+ /**
61
+ * @deprecated `result` will be removed in Apollo Client 4.0.
62
+ *
63
+ * **Recommended now**
64
+ *
65
+ * If you continue to need this functionality, subscribe to `ObservableQuery`
66
+ * to get the first value emitted from the observable, then immediately unsubscribe.
67
+ *
68
+ * **When upgrading**
69
+ *
70
+ * Use RxJS's [`firstResultFrom`](https://rxjs.dev/api/index/function/firstValueFrom) function to mimic this functionality.
71
+ *
72
+ * ```ts
73
+ * const result = await firstValueFrom(from(observableQuery));
74
+ * ```
75
+ */
51
76
  result(): Promise<ApolloQueryResult<MaybeMasked<TData>>>;
52
77
  /** @internal */
53
78
  resetDiff(): void;
@@ -55,9 +80,25 @@ export declare class ObservableQuery<TData = any, TVariables extends OperationVa
55
80
  getCurrentResult(saveAsLastResult?: boolean): ApolloQueryResult<MaybeMasked<TData>>;
56
81
  isDifferentFromLastResult(newResult: ApolloQueryResult<TData>, variables?: TVariables): boolean | undefined;
57
82
  private getLast;
83
+ /**
84
+ * @deprecated `getLastResult` will be removed in Apollo Client 4.0. Please
85
+ * discontinue using this method.
86
+ */
58
87
  getLastResult(variablesMustMatch?: boolean): ApolloQueryResult<TData> | undefined;
88
+ /**
89
+ * @deprecated `getLastError` will be removed in Apollo Client 4.0. Please
90
+ * discontinue using this method.
91
+ */
59
92
  getLastError(variablesMustMatch?: boolean): ApolloError | undefined;
93
+ /**
94
+ * @deprecated `resetLastResults` will be removed in Apollo Client 4.0. Please
95
+ * discontinue using this method.
96
+ */
60
97
  resetLastResults(): void;
98
+ /**
99
+ * @deprecated `resetQueryStoreErrors` will be removed in Apollo Client 4.0.
100
+ * Please discontinue using this method.
101
+ */
61
102
  resetQueryStoreErrors(): void;
62
103
  /**
63
104
  * Update the variables of this observable query, and fetch the new results.
@@ -66,7 +107,7 @@ export declare class ObservableQuery<TData = any, TVariables extends OperationVa
66
107
  * @param variables - The new set of variables. If there are missing variables,
67
108
  * the previous values of those variables will be used.
68
109
  */
69
- refetch(variables?: Partial<TVariables>): Promise<ApolloQueryResult<MaybeMasked<TData>>>;
110
+ refetch(variables?: Partial<TVariables>): Promise<InteropApolloQueryResult<MaybeMasked<TData>>>;
70
111
  /**
71
112
  * A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/).
72
113
  */
@@ -75,14 +116,18 @@ export declare class ObservableQuery<TData = any, TVariables extends OperationVa
75
116
  fetchMoreResult: Unmasked<TFetchData>;
76
117
  variables: TFetchVars;
77
118
  }) => Unmasked<TData>;
78
- }): Promise<ApolloQueryResult<MaybeMasked<TFetchData>>>;
119
+ }): Promise<InteropApolloQueryResult<MaybeMasked<TFetchData>>>;
79
120
  /**
80
121
  * A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query.
81
122
  *
82
123
  * This function returns _another_ function that you can call to terminate the subscription.
83
124
  */
84
125
  subscribeToMore<TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData, TVariables>): () => void;
85
- setOptions(newOptions: Partial<WatchQueryOptions<TVariables, TData>>): Promise<ApolloQueryResult<MaybeMasked<TData>>>;
126
+ /**
127
+ * @deprecated `setOptions` will be removed in Apollo Client 4.0. Please use
128
+ * `observableQuery.reobserve(newOptions)` instead.
129
+ */
130
+ setOptions(newOptions: Partial<WatchQueryOptions<TVariables, TData>>): Promise<InteropApolloQueryResult<MaybeMasked<TData>>>;
86
131
  silentSetOptions(newOptions: Partial<WatchQueryOptions<TVariables, TData>>): void;
87
132
  /**
88
133
  * Update the variables of this observable query, and fetch the new results
@@ -102,7 +147,7 @@ export declare class ObservableQuery<TData = any, TVariables extends OperationVa
102
147
  * @param variables - The new set of variables. If there are missing variables,
103
148
  * the previous values of those variables will be used.
104
149
  */
105
- setVariables(variables: TVariables): Promise<ApolloQueryResult<MaybeMasked<TData>> | void>;
150
+ setVariables(variables: TVariables): Promise<InteropApolloQueryResult<MaybeMasked<TData>> | void>;
106
151
  /**
107
152
  * A function that enables you to update the query's cached result without executing a followup GraphQL operation.
108
153
  *
@@ -122,7 +167,7 @@ export declare class ObservableQuery<TData = any, TVariables extends OperationVa
122
167
  private updatePolling;
123
168
  private updateLastResult;
124
169
  reobserveAsConcast(newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus): Concast<ApolloQueryResult<TData>>;
125
- reobserve(newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus): Promise<ApolloQueryResult<MaybeMasked<TData>>>;
170
+ reobserve(newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus): Promise<InteropApolloQueryResult<MaybeMasked<TData>>>;
126
171
  resubscribeAfterError(onNext: (value: ApolloQueryResult<MaybeMasked<TData>>) => void, onError?: (error: any) => void, onComplete?: () => void): ObservableSubscription;
127
172
  resubscribeAfterError(observer: Observer<ApolloQueryResult<TData>>): ObservableSubscription;
128
173
  private observe;