@apollo/client 3.9.7 → 3.9.8

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 (47) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/apollo-client.cjs +9 -5
  3. package/apollo-client.cjs.map +1 -1
  4. package/apollo-client.min.cjs +1 -1
  5. package/core/ApolloClient.d.ts +7 -7
  6. package/core/ApolloClient.js +6 -6
  7. package/core/ApolloClient.js.map +1 -1
  8. package/core/core.cjs +1 -1
  9. package/core/core.cjs.map +1 -1
  10. package/core/core.cjs.native.js +1 -1
  11. package/core/watchQueryOptions.d.ts +3 -3
  12. package/dev/dev.cjs +18 -15
  13. package/dev/dev.cjs.map +1 -1
  14. package/dev/dev.cjs.native.js +18 -15
  15. package/dev/index.d.ts +2 -0
  16. package/dev/index.js +1 -0
  17. package/dev/index.js.map +1 -1
  18. package/dev/loadErrorMessageHandler.d.ts +6 -1
  19. package/dev/loadErrorMessageHandler.js +17 -14
  20. package/dev/loadErrorMessageHandler.js.map +1 -1
  21. package/dev/setErrorMessageHandler.d.ts +34 -0
  22. package/dev/setErrorMessageHandler.js +9 -0
  23. package/dev/setErrorMessageHandler.js.map +1 -0
  24. package/package.json +17 -17
  25. package/react/hooks/hooks.cjs +3 -0
  26. package/react/hooks/hooks.cjs.map +1 -1
  27. package/react/hooks/hooks.cjs.native.js +3 -0
  28. package/react/hooks/useFragment.d.ts +1 -1
  29. package/react/hooks/useFragment.js +5 -0
  30. package/react/hooks/useFragment.js.map +1 -1
  31. package/react/internal/cache/QueryReference.d.ts +2 -2
  32. package/react/internal/cache/QueryReference.js +13 -4
  33. package/react/internal/cache/QueryReference.js.map +1 -1
  34. package/react/internal/internal.cjs +5 -4
  35. package/react/internal/internal.cjs.map +1 -1
  36. package/react/internal/internal.cjs.native.js +5 -4
  37. package/react/query-preloader/createQueryPreloader.d.ts +6 -6
  38. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  39. package/react/types/types.d.ts +3 -3
  40. package/react/types/types.documentation.d.ts +4 -4
  41. package/react/types/types.documentation.js.map +1 -1
  42. package/utilities/globals/globals.cjs +1 -1
  43. package/utilities/globals/globals.cjs.map +1 -1
  44. package/utilities/globals/globals.cjs.native.js +1 -1
  45. package/utilities/globals/invariantWrappers.d.ts +1 -1
  46. package/utilities/globals/invariantWrappers.js.map +1 -1
  47. package/version.js +1 -1
@@ -28,7 +28,7 @@ export interface ApolloClientOptions<TCacheShape> {
28
28
  */
29
29
  headers?: Record<string, string>;
30
30
  /**
31
- * You can provide an {@link 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/).
31
+ * 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/).
32
32
  *
33
33
  * One of `uri` or `link` is **required**. If you provide both, `link` takes precedence.
34
34
  */
@@ -96,9 +96,9 @@ import { getApolloClientMemoryInternals } from "../utilities/caching/getMemoryIn
96
96
  export { mergeOptions };
97
97
  /**
98
98
  * This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries
99
- * and mutations) to a GraphQL spec-compliant server over an {@link ApolloLink} instance,
99
+ * and mutations) to a GraphQL spec-compliant server over an `ApolloLink` instance,
100
100
  * receive results from the server and cache the results in a store. It also delivers updates
101
- * to GraphQL queries through {@link Observable} instances.
101
+ * to GraphQL queries through `Observable` instances.
102
102
  */
103
103
  export declare class ApolloClient<TCacheShape> implements DataProxy {
104
104
  link: ApolloLink;
@@ -114,7 +114,7 @@ export declare class ApolloClient<TCacheShape> implements DataProxy {
114
114
  private clearStoreCallbacks;
115
115
  private localState;
116
116
  /**
117
- * Constructs an instance of {@link ApolloClient}.
117
+ * Constructs an instance of `ApolloClient`.
118
118
  *
119
119
  * @example
120
120
  * ```js
@@ -154,7 +154,7 @@ export declare class ApolloClient<TCacheShape> implements DataProxy {
154
154
  stop(): void;
155
155
  /**
156
156
  * This watches the cache store of the query according to the options specified and
157
- * returns an {@link ObservableQuery}. We can subscribe to this {@link ObservableQuery} and
157
+ * returns an `ObservableQuery`. We can subscribe to this `ObservableQuery` and
158
158
  * receive updated results through a GraphQL observer when the cache store changes.
159
159
  *
160
160
  * Note that this method is not an implementation of GraphQL subscriptions. Rather,
@@ -177,7 +177,7 @@ export declare class ApolloClient<TCacheShape> implements DataProxy {
177
177
  * returns a `Promise` which is either resolved with the resulting data
178
178
  * or rejected with an error.
179
179
  *
180
- * @param options - An object of type {@link QueryOptions} that allows us to
180
+ * @param options - An object of type `QueryOptions` that allows us to
181
181
  * describe how this query should be treated e.g. whether it should hit the
182
182
  * server at all or just resolve from the cache, etc.
183
183
  */
@@ -193,7 +193,7 @@ export declare class ApolloClient<TCacheShape> implements DataProxy {
193
193
  mutate<TData = any, TVariables extends OperationVariables = OperationVariables, TContext extends Record<string, any> = DefaultContext, TCache extends ApolloCache<any> = ApolloCache<any>>(options: MutationOptions<TData, TVariables, TContext>): Promise<FetchResult<TData>>;
194
194
  /**
195
195
  * This subscribes to a graphql subscription according to the options specified and returns an
196
- * {@link Observable} which either emits received data or an error.
196
+ * `Observable` which either emits received data or an error.
197
197
  */
198
198
  subscribe<T = any, TVariables extends OperationVariables = OperationVariables>(options: SubscriptionOptions<TVariables, T>): Observable<FetchResult<T>>;
199
199
  /**
@@ -15,13 +15,13 @@ import { getApolloClientMemoryInternals } from "../utilities/caching/getMemoryIn
15
15
  export { mergeOptions };
16
16
  /**
17
17
  * This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries
18
- * and mutations) to a GraphQL spec-compliant server over an {@link ApolloLink} instance,
18
+ * and mutations) to a GraphQL spec-compliant server over an `ApolloLink` instance,
19
19
  * receive results from the server and cache the results in a store. It also delivers updates
20
- * to GraphQL queries through {@link Observable} instances.
20
+ * to GraphQL queries through `Observable` instances.
21
21
  */
22
22
  var ApolloClient = /** @class */ (function () {
23
23
  /**
24
- * Constructs an instance of {@link ApolloClient}.
24
+ * Constructs an instance of `ApolloClient`.
25
25
  *
26
26
  * @example
27
27
  * ```js
@@ -183,7 +183,7 @@ var ApolloClient = /** @class */ (function () {
183
183
  };
184
184
  /**
185
185
  * This watches the cache store of the query according to the options specified and
186
- * returns an {@link ObservableQuery}. We can subscribe to this {@link ObservableQuery} and
186
+ * returns an `ObservableQuery`. We can subscribe to this `ObservableQuery` and
187
187
  * receive updated results through a GraphQL observer when the cache store changes.
188
188
  *
189
189
  * Note that this method is not an implementation of GraphQL subscriptions. Rather,
@@ -217,7 +217,7 @@ var ApolloClient = /** @class */ (function () {
217
217
  * returns a `Promise` which is either resolved with the resulting data
218
218
  * or rejected with an error.
219
219
  *
220
- * @param options - An object of type {@link QueryOptions} that allows us to
220
+ * @param options - An object of type `QueryOptions` that allows us to
221
221
  * describe how this query should be treated e.g. whether it should hit the
222
222
  * server at all or just resolve from the cache, etc.
223
223
  */
@@ -247,7 +247,7 @@ var ApolloClient = /** @class */ (function () {
247
247
  };
248
248
  /**
249
249
  * This subscribes to a graphql subscription according to the options specified and returns an
250
- * {@link Observable} which either emits received data or an error.
250
+ * `Observable` which either emits received data or an error.
251
251
  */
252
252
  ApolloClient.prototype.subscribe = function (options) {
253
253
  return this.queryManager.startGraphQLSubscription(options);
@@ -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;AAG5D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAuBjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQ7C,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Ae,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,AA3rBD,IA2rBC;;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 { ExecutionResult, DocumentNode } 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, 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\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 uri?: string | UriFunction;\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 headers?: Record<string, string>;\n /**\n * You can provide an {@link 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 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 resolvers?: Resolvers | Resolvers[];\n typeDefs?: string | string[] | DocumentNode | DocumentNode[];\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 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 documentTransform?: DocumentTransform;\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\";\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 {@link ApolloLink} instance,\n * receive results from the server and cache the results in a store. It also delivers updates\n * to GraphQL queries through {@link Observable} instances.\n */\nexport class ApolloClient<TCacheShape> implements DataProxy {\n public link: ApolloLink;\n public cache: ApolloCache<TCacheShape>;\n public disableNetworkFetches: boolean;\n public version: string;\n public queryDeduplication: boolean;\n public defaultOptions: DefaultOptions;\n public readonly typeDefs: ApolloClientOptions<TCacheShape>[\"typeDefs\"];\n\n private queryManager: QueryManager<TCacheShape>;\n private devToolsHookCb?: Function;\n private resetStoreCallbacks: Array<() => Promise<any>> = [];\n private clearStoreCallbacks: Array<() => Promise<any>> = [];\n private localState: LocalState<TCacheShape>;\n\n /**\n * Constructs an instance of {@link 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 = typeof window === \"object\" &&\n !(window as any).__APOLLO_CLIENT__ &&\n __DEV__,\n queryDeduplication = true,\n defaultOptions,\n defaultContext,\n assumeImmutableResults = cache.assumeImmutableResults,\n resolvers,\n typeDefs,\n fragmentMatcher,\n name: clientAwarenessName,\n version: clientAwarenessVersion,\n } = options;\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\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.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 clientAwareness: {\n name: clientAwarenessName!,\n version: clientAwarenessVersion!,\n },\n localState: this.localState,\n assumeImmutableResults,\n onBroadcast:\n connectToDevTools ?\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 (connectToDevTools) this.connectToDevTools();\n }\n\n private connectToDevTools() {\n if (typeof window === \"object\") {\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 /**\n * Suggest installing the devtools for developers who don't have them\n */\n if (!hasSuggestedDevtools && __DEV__) {\n hasSuggestedDevtools = true;\n setTimeout(() => {\n if (\n typeof window !== \"undefined\" &&\n window.document &&\n window.top === window.self &&\n !(window as any).__APOLLO_DEVTOOLS_GLOBAL_HOOK__\n ) {\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 * 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 {@link ObservableQuery}. We can subscribe to this {@link ObservableQuery} and\n * receive updated results through a GraphQL 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 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 {@link 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 >(options: QueryOptions<TVariables, T>): Promise<ApolloQueryResult<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 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<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 * {@link Observable} which either emits received data or an error.\n */\n public subscribe<\n T = any,\n TVariables extends OperationVariables = OperationVariables,\n >(options: SubscriptionOptions<TVariables, T>): Observable<FetchResult<T>> {\n return this.queryManager.startGraphQLSubscription<T>(options);\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 ): T | null {\n return this.cache.readQuery<T, TVariables>(options, optimistic);\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 ): 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(payload: GraphQLRequest): Observable<ExecutionResult> {\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 public addResolvers(resolvers: Resolvers | Resolvers[]) {\n this.localState.addResolvers(resolvers);\n }\n\n /**\n * Set (override existing) local resolvers.\n */\n public setResolvers(resolvers: Resolvers | Resolvers[]) {\n this.localState.setResolvers(resolvers);\n }\n\n /**\n * Get all registered local resolvers.\n */\n public getResolvers() {\n return this.localState.getResolvers();\n }\n\n /**\n * Set a custom local state fragment matcher.\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;AAG5D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CA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C,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,AA3rBD,IA2rBC;;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 { ExecutionResult, DocumentNode } 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, 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\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 uri?: string | UriFunction;\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 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 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 resolvers?: Resolvers | Resolvers[];\n typeDefs?: string | string[] | DocumentNode | DocumentNode[];\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 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 documentTransform?: DocumentTransform;\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\";\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 public disableNetworkFetches: boolean;\n public version: string;\n public queryDeduplication: boolean;\n public defaultOptions: DefaultOptions;\n public readonly typeDefs: ApolloClientOptions<TCacheShape>[\"typeDefs\"];\n\n private queryManager: QueryManager<TCacheShape>;\n private devToolsHookCb?: Function;\n private resetStoreCallbacks: Array<() => Promise<any>> = [];\n private clearStoreCallbacks: Array<() => Promise<any>> = [];\n private localState: LocalState<TCacheShape>;\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 = typeof window === \"object\" &&\n !(window as any).__APOLLO_CLIENT__ &&\n __DEV__,\n queryDeduplication = true,\n defaultOptions,\n defaultContext,\n assumeImmutableResults = cache.assumeImmutableResults,\n resolvers,\n typeDefs,\n fragmentMatcher,\n name: clientAwarenessName,\n version: clientAwarenessVersion,\n } = options;\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\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.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 clientAwareness: {\n name: clientAwarenessName!,\n version: clientAwarenessVersion!,\n },\n localState: this.localState,\n assumeImmutableResults,\n onBroadcast:\n connectToDevTools ?\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 (connectToDevTools) this.connectToDevTools();\n }\n\n private connectToDevTools() {\n if (typeof window === \"object\") {\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 /**\n * Suggest installing the devtools for developers who don't have them\n */\n if (!hasSuggestedDevtools && __DEV__) {\n hasSuggestedDevtools = true;\n setTimeout(() => {\n if (\n typeof window !== \"undefined\" &&\n window.document &&\n window.top === window.self &&\n !(window as any).__APOLLO_DEVTOOLS_GLOBAL_HOOK__\n ) {\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 * 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 a GraphQL 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 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 >(options: QueryOptions<TVariables, T>): Promise<ApolloQueryResult<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 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<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 >(options: SubscriptionOptions<TVariables, T>): Observable<FetchResult<T>> {\n return this.queryManager.startGraphQLSubscription<T>(options);\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 ): T | null {\n return this.cache.readQuery<T, TVariables>(options, optimistic);\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 ): 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(payload: GraphQLRequest): Observable<ExecutionResult> {\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 public addResolvers(resolvers: Resolvers | Resolvers[]) {\n this.localState.addResolvers(resolvers);\n }\n\n /**\n * Set (override existing) local resolvers.\n */\n public setResolvers(resolvers: Resolvers | Resolvers[]) {\n this.localState.setResolvers(resolvers);\n }\n\n /**\n * Get all registered local resolvers.\n */\n public getResolvers() {\n return this.localState.getResolvers();\n }\n\n /**\n * Set a custom local state fragment matcher.\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"]}
package/core/core.cjs CHANGED
@@ -20,7 +20,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
20
20
 
21
21
  var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
22
22
 
23
- var version = "3.9.7";
23
+ var version = "3.9.8";
24
24
 
25
25
  function isNonNullObject(obj) {
26
26
  return obj !== null && typeof obj === "object";