UNPKG

93.3 kBSource Map (JSON)View Raw
1{"version":3,"file":"QueryManager.js","sourceRoot":"","sources":["../../src/core/QueryManager.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAK7E,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAEL,aAAa,EACb,iCAAiC,EACjC,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAMvD,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,0BAA0B,EAC1B,UAAU,EACV,QAAQ,EACR,eAAe,EACf,OAAO,EACP,YAAY,EACZ,cAAc,EACd,eAAe,EACf,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EACL,WAAW,EACX,aAAa,EACb,8BAA8B,GAC/B,MAAM,oBAAoB,CAAC;AAS5B,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAe7E,OAAO,EACL,SAAS,EACT,iBAAiB,GAElB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAItC,IAAA,cAAc,GAAK,MAAM,CAAC,SAAS,eAArB,CAAsB;AAE5C,IAAM,MAAM,GAAmB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAsBnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW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,SAAS;gBACZ,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;QAC5C,CAAC;IACH,CAAC;IAEO,+BAAQ,GAAhB,UAAiB,OAAe;QAC9B,IAAI,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAE,CAAC;IACpC,CAAC;IAEO,qCAAc,GAAtB,UAAuB,OAAY;QAAZ,wBAAA,EAAA,YAAY;QACjC,IAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC3D,sCACK,IAAI,CAAC,cAAc,GACnB,UAAU,KACb,eAAe,EAAE,IAAI,CAAC,eAAe,IACrC;IACJ,CAAC;IACH,mBAAC;AAAD,CAAC,AA3iDD,IA2iDC","sourcesContent":["import { invariant, newInvariantError } from \"../utilities/globals/index.js\";\n\nimport type { DocumentNode } from \"graphql\";\n// TODO(brian): A hack until this issue is resolved (https://github.com/graphql/graphql-js/issues/3356)\ntype OperationTypeNode = any;\nimport { equal } from \"@wry/equality\";\n\nimport type { ApolloLink, FetchResult } from \"../link/core/index.js\";\nimport { execute } from \"../link/core/index.js\";\nimport {\n defaultCacheSizes,\n hasDirectives,\n isExecutionPatchIncrementalResult,\n isExecutionPatchResult,\n removeDirectivesFromDocument,\n} from \"../utilities/index.js\";\nimport type { Cache, ApolloCache } from \"../cache/index.js\";\nimport { canonicalStringify } from \"../cache/index.js\";\n\nimport type {\n ObservableSubscription,\n ConcastSourcesArray,\n} from \"../utilities/index.js\";\nimport {\n getDefaultValues,\n getOperationDefinition,\n getOperationName,\n hasClientExports,\n graphQLResultHasError,\n getGraphQLErrorsFromResult,\n Observable,\n asyncMap,\n isNonEmptyArray,\n Concast,\n makeUniqueId,\n isDocumentNode,\n isNonNullObject,\n DocumentTransform,\n} from \"../utilities/index.js\";\nimport { mergeIncrementalData } from \"../utilities/common/incrementalResult.js\";\nimport {\n ApolloError,\n isApolloError,\n graphQLResultHasProtocolErrors,\n} from \"../errors/index.js\";\nimport type {\n QueryOptions,\n WatchQueryOptions,\n SubscriptionOptions,\n MutationOptions,\n ErrorPolicy,\n MutationFetchPolicy,\n} from \"./watchQueryOptions.js\";\nimport { ObservableQuery, logMissingFieldErrors } from \"./ObservableQuery.js\";\nimport { NetworkStatus, isNetworkRequestInFlight } from \"./networkStatus.js\";\nimport type {\n ApolloQueryResult,\n OperationVariables,\n MutationUpdaterFunction,\n OnQueryUpdated,\n InternalRefetchQueriesInclude,\n InternalRefetchQueriesOptions,\n InternalRefetchQueriesResult,\n InternalRefetchQueriesMap,\n DefaultContext,\n} from \"./types.js\";\nimport type { LocalState } from \"./LocalState.js\";\n\nimport type { QueryStoreValue } from \"./QueryInfo.js\";\nimport {\n QueryInfo,\n shouldWriteResult,\n CacheWriteBehavior,\n} from \"./QueryInfo.js\";\nimport type { ApolloErrorOptions } from \"../errors/index.js\";\nimport { PROTOCOL_ERRORS_SYMBOL } from \"../errors/index.js\";\nimport { print } from \"../utilities/index.js\";\nimport type { IgnoreModifier } from \"../cache/core/types/common.js\";\nimport type { TODO } from \"../utilities/types/TODO.js\";\n\nconst { hasOwnProperty } = Object.prototype;\n\nconst IGNORE: IgnoreModifier = Object.create(null);\n\ninterface MutationStoreValue {\n mutation: DocumentNode;\n variables: Record<string, any>;\n loading: boolean;\n error: Error | null;\n}\n\ntype UpdateQueries<TData> = MutationOptions<TData, any, any>[\"updateQueries\"];\n\ninterface TransformCacheEntry {\n hasClientExports: boolean;\n hasForcedResolvers: boolean;\n hasNonreactiveDirective: boolean;\n clientQuery: DocumentNode | null;\n serverQuery: DocumentNode | null;\n defaultVars: OperationVariables;\n asQuery: DocumentNode;\n}\n\nimport type { DefaultOptions } from \"./ApolloClient.js\";\nimport { Trie } from \"@wry/trie\";\nimport { AutoCleanedWeakCache, cacheSizes } from \"../utilities/index.js\";\n\nexport interface QueryManagerOptions<TStore> {\n cache: ApolloCache<TStore>;\n link: ApolloLink;\n defaultOptions: DefaultOptions;\n documentTransform: DocumentTransform | null | undefined;\n queryDeduplication: boolean;\n onBroadcast: undefined | (() => void);\n ssrMode: boolean;\n clientAwareness: Record<string, string>;\n localState: LocalState<TStore>;\n assumeImmutableResults: boolean;\n defaultContext: Partial<DefaultContext> | undefined;\n}\n\nexport class QueryManager<TStore> {\n public cache: ApolloCache<TStore>;\n public link: ApolloLink;\n public defaultOptions: DefaultOptions;\n\n public readonly assumeImmutableResults: boolean;\n public readonly documentTransform: DocumentTransform;\n public readonly ssrMode: boolean;\n public readonly defaultContext: Partial<DefaultContext>;\n\n private queryDeduplication: boolean;\n private clientAwareness: Record<string, string> = {};\n private localState: LocalState<TStore>;\n\n private onBroadcast?: () => void;\n public mutationStore?: {\n [mutationId: string]: MutationStoreValue;\n };\n\n // All the queries that the QueryManager is currently managing (not\n // including mutations and subscriptions).\n private queries = new Map<string, QueryInfo>();\n\n // Maps from queryId strings to Promise rejection functions for\n // currently active queries and fetches.\n // Use protected instead of private field so\n // @apollo/experimental-nextjs-app-support can access type info.\n protected fetchCancelFns = new Map<string, (error: any) => any>();\n\n constructor(options: QueryManagerOptions<TStore>) {\n const defaultDocumentTransform = new DocumentTransform(\n (document) => this.cache.transformDocument(document),\n // Allow the apollo cache to manage its own transform caches\n { cache: false }\n );\n\n this.cache = options.cache;\n this.link = options.link;\n this.defaultOptions = options.defaultOptions;\n this.queryDeduplication = options.queryDeduplication;\n this.clientAwareness = options.clientAwareness;\n this.localState = options.localState;\n this.ssrMode = options.ssrMode;\n this.assumeImmutableResults = options.assumeImmutableResults;\n const documentTransform = options.documentTransform;\n this.documentTransform =\n documentTransform ?\n defaultDocumentTransform\n .concat(documentTransform)\n // The custom document transform may add new fragment spreads or new\n // field selections, so we want to give the cache a chance to run\n // again. For example, the InMemoryCache adds __typename to field\n // selections and fragments from the fragment registry.\n .concat(defaultDocumentTransform)\n : defaultDocumentTransform;\n this.defaultContext = options.defaultContext || Object.create(null);\n\n if ((this.onBroadcast = options.onBroadcast)) {\n this.mutationStore = Object.create(null);\n }\n }\n\n /**\n * Call this method to terminate any active query processes, making it safe\n * to dispose of this QueryManager instance.\n */\n public stop() {\n this.queries.forEach((_info, queryId) => {\n this.stopQueryNoBroadcast(queryId);\n });\n\n this.cancelPendingFetches(\n newInvariantError(\"QueryManager stopped while query was in flight\")\n );\n }\n\n private cancelPendingFetches(error: Error) {\n this.fetchCancelFns.forEach((cancel) => cancel(error));\n this.fetchCancelFns.clear();\n }\n\n public async mutate<\n TData,\n TVariables extends OperationVariables,\n TContext extends Record<string, any>,\n TCache extends ApolloCache<any>,\n >({\n mutation,\n variables,\n optimisticResponse,\n updateQueries,\n refetchQueries = [],\n awaitRefetchQueries = false,\n update: updateWithProxyFn,\n onQueryUpdated,\n fetchPolicy = this.defaultOptions.mutate?.fetchPolicy || \"network-only\",\n errorPolicy = this.defaultOptions.mutate?.errorPolicy || \"none\",\n keepRootFields,\n context,\n }: MutationOptions<TData, TVariables, TContext>): Promise<\n FetchResult<TData>\n > {\n invariant(\n mutation,\n \"mutation option is required. You must specify your GraphQL document in the mutation option.\"\n );\n\n invariant(\n fetchPolicy === \"network-only\" || fetchPolicy === \"no-cache\",\n \"Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write.\"\n );\n\n const mutationId = this.generateMutationId();\n\n mutation = this.cache.transformForLink(this.transform(mutation));\n const { hasClientExports } = this.getDocumentInfo(mutation);\n\n variables = this.getVariables(mutation, variables) as TVariables;\n if (hasClientExports) {\n variables = (await this.localState.addExportedVariables(\n mutation,\n variables,\n context\n )) as TVariables;\n }\n\n const mutationStoreValue =\n this.mutationStore &&\n (this.mutationStore[mutationId] = {\n mutation,\n variables,\n loading: true,\n error: null,\n } as MutationStoreValue);\n\n const isOptimistic =\n optimisticResponse &&\n this.markMutationOptimistic<TData, TVariables, TContext, TCache>(\n optimisticResponse,\n {\n mutationId,\n document: mutation,\n variables,\n fetchPolicy,\n errorPolicy,\n context,\n updateQueries,\n update: updateWithProxyFn,\n keepRootFields,\n }\n );\n\n this.broadcastQueries();\n\n const self = this;\n\n return new Promise((resolve, reject) => {\n return asyncMap(\n self.getObservableFromLink(\n mutation,\n {\n ...context,\n optimisticResponse: isOptimistic ? optimisticResponse : void 0,\n },\n variables,\n {},\n false\n ),\n\n (result: FetchResult<TData>) => {\n if (graphQLResultHasError(result) && errorPolicy === \"none\") {\n throw new ApolloError({\n graphQLErrors: getGraphQLErrorsFromResult(result),\n });\n }\n\n if (mutationStoreValue) {\n mutationStoreValue.loading = false;\n mutationStoreValue.error = null;\n }\n\n const storeResult: typeof result = { ...result };\n\n if (typeof refetchQueries === \"function\") {\n refetchQueries = refetchQueries(storeResult);\n }\n\n if (errorPolicy === \"ignore\" && graphQLResultHasError(storeResult)) {\n delete storeResult.errors;\n }\n\n return self.markMutationResult<TData, TVariables, TContext, TCache>({\n mutationId,\n result: storeResult,\n document: mutation,\n variables,\n fetchPolicy,\n errorPolicy,\n context,\n update: updateWithProxyFn,\n updateQueries,\n awaitRefetchQueries,\n refetchQueries,\n removeOptimistic: isOptimistic ? mutationId : void 0,\n onQueryUpdated,\n keepRootFields,\n });\n }\n ).subscribe({\n next(storeResult) {\n self.broadcastQueries();\n\n // Since mutations might receive multiple payloads from the\n // ApolloLink chain (e.g. when used with @defer),\n // we resolve with a SingleExecutionResult or after the final\n // ExecutionPatchResult has arrived and we have assembled the\n // multipart response into a single result.\n if (!(\"hasNext\" in storeResult) || storeResult.hasNext === false) {\n resolve(storeResult);\n }\n },\n\n error(err: Error) {\n if (mutationStoreValue) {\n mutationStoreValue.loading = false;\n mutationStoreValue.error = err;\n }\n\n if (isOptimistic) {\n self.cache.removeOptimistic(mutationId);\n }\n\n self.broadcastQueries();\n\n reject(\n err instanceof ApolloError ? err : (\n new ApolloError({\n networkError: err,\n })\n )\n );\n },\n });\n });\n }\n\n public markMutationResult<\n TData,\n TVariables,\n TContext,\n TCache extends ApolloCache<any>,\n >(\n mutation: {\n mutationId: string;\n result: FetchResult<TData>;\n document: DocumentNode;\n variables?: TVariables;\n fetchPolicy?: MutationFetchPolicy;\n errorPolicy: ErrorPolicy;\n context?: TContext;\n updateQueries: UpdateQueries<TData>;\n update?: MutationUpdaterFunction<TData, TVariables, TContext, TCache>;\n awaitRefetchQueries?: boolean;\n refetchQueries?: InternalRefetchQueriesInclude;\n removeOptimistic?: string;\n onQueryUpdated?: OnQueryUpdated<any>;\n keepRootFields?: boolean;\n },\n cache = this.cache\n ): Promise<FetchResult<TData>> {\n let { result } = mutation;\n const cacheWrites: Cache.WriteOptions[] = [];\n const skipCache = mutation.fetchPolicy === \"no-cache\";\n\n if (!skipCache && shouldWriteResult(result, mutation.errorPolicy)) {\n if (!isExecutionPatchIncrementalResult(result)) {\n cacheWrites.push({\n result: result.data,\n dataId: \"ROOT_MUTATION\",\n query: mutation.document,\n variables: mutation.variables,\n });\n }\n if (\n isExecutionPatchIncrementalResult(result) &&\n isNonEmptyArray(result.incremental)\n ) {\n const diff = cache.diff<TData>({\n id: \"ROOT_MUTATION\",\n // The cache complains if passed a mutation where it expects a\n // query, so we transform mutations and subscriptions to queries\n // (only once, thanks to this.transformCache).\n query: this.getDocumentInfo(mutation.document).asQuery,\n variables: mutation.variables,\n optimistic: false,\n returnPartialData: true,\n });\n let mergedData;\n if (diff.result) {\n mergedData = mergeIncrementalData(diff.result, result);\n }\n if (typeof mergedData !== \"undefined\") {\n // cast the ExecutionPatchResult to FetchResult here since\n // ExecutionPatchResult never has `data` when returned from the server\n (result as FetchResult).data = mergedData;\n cacheWrites.push({\n result: mergedData,\n dataId: \"ROOT_MUTATION\",\n query: mutation.document,\n variables: mutation.variables,\n });\n }\n }\n\n const { updateQueries } = mutation;\n if (updateQueries) {\n this.queries.forEach(({ observableQuery }, queryId) => {\n const queryName = observableQuery && observableQuery.queryName;\n if (!queryName || !hasOwnProperty.call(updateQueries, queryName)) {\n return;\n }\n const updater = updateQueries[queryName];\n const { document, variables } = this.queries.get(queryId)!;\n\n // Read the current query result from the store.\n const { result: currentQueryResult, complete } = cache.diff<TData>({\n query: document!,\n variables,\n returnPartialData: true,\n optimistic: false,\n });\n\n if (complete && currentQueryResult) {\n // Run our reducer using the current query result and the mutation result.\n const nextQueryResult = updater(currentQueryResult, {\n mutationResult: result,\n queryName: (document && getOperationName(document)) || void 0,\n queryVariables: variables!,\n });\n\n // Write the modified result back into the store if we got a new result.\n if (nextQueryResult) {\n cacheWrites.push({\n result: nextQueryResult,\n dataId: \"ROOT_QUERY\",\n query: document!,\n variables,\n });\n }\n }\n });\n }\n }\n\n if (\n cacheWrites.length > 0 ||\n (mutation.refetchQueries || \"\").length > 0 ||\n mutation.update ||\n mutation.onQueryUpdated ||\n mutation.removeOptimistic\n ) {\n const results: any[] = [];\n\n this.refetchQueries({\n updateCache: (cache) => {\n if (!skipCache) {\n cacheWrites.forEach((write) => cache.write(write));\n }\n\n // If the mutation has some writes associated with it then we need to\n // apply those writes to the store by running this reducer again with\n // a write action.\n const { update } = mutation;\n // Determine whether result is a SingleExecutionResult,\n // or the final ExecutionPatchResult.\n const isFinalResult =\n !isExecutionPatchResult(result) ||\n (isExecutionPatchIncrementalResult(result) && !result.hasNext);\n\n if (update) {\n if (!skipCache) {\n // Re-read the ROOT_MUTATION data we just wrote into the cache\n // (the first cache.write call in the cacheWrites.forEach loop\n // above), so field read functions have a chance to run for\n // fields within mutation result objects.\n const diff = cache.diff<TData>({\n id: \"ROOT_MUTATION\",\n // The cache complains if passed a mutation where it expects a\n // query, so we transform mutations and subscriptions to queries\n // (only once, thanks to this.transformCache).\n query: this.getDocumentInfo(mutation.document).asQuery,\n variables: mutation.variables,\n optimistic: false,\n returnPartialData: true,\n });\n\n if (diff.complete) {\n result = { ...(result as FetchResult), data: diff.result };\n if (\"incremental\" in result) {\n delete result.incremental;\n }\n if (\"hasNext\" in result) {\n delete result.hasNext;\n }\n }\n }\n\n // If we've received the whole response,\n // either a SingleExecutionResult or the final ExecutionPatchResult,\n // call the update function.\n if (isFinalResult) {\n update(cache as TCache, result, {\n context: mutation.context,\n variables: mutation.variables,\n });\n }\n }\n\n // TODO Do this with cache.evict({ id: 'ROOT_MUTATION' }) but make it\n // shallow to allow rolling back optimistic evictions.\n if (!skipCache && !mutation.keepRootFields && isFinalResult) {\n cache.modify({\n id: \"ROOT_MUTATION\",\n fields(value, { fieldName, DELETE }) {\n return fieldName === \"__typename\" ? value : DELETE;\n },\n });\n }\n },\n\n include: mutation.refetchQueries,\n\n // Write the final mutation.result to the root layer of the cache.\n optimistic: false,\n\n // Remove the corresponding optimistic layer at the same time as we\n // write the final non-optimistic result.\n removeOptimistic: mutation.removeOptimistic,\n\n // Let the caller of client.mutate optionally determine the refetching\n // behavior for watched queries after the mutation.update function runs.\n // If no onQueryUpdated function was provided for this mutation, pass\n // null instead of undefined to disable the default refetching behavior.\n onQueryUpdated: mutation.onQueryUpdated || null,\n }).forEach((result) => results.push(result));\n\n if (mutation.awaitRefetchQueries || mutation.onQueryUpdated) {\n // Returning a promise here makes the mutation await that promise, so we\n // include results in that promise's work if awaitRefetchQueries or an\n // onQueryUpdated function was specified.\n return Promise.all(results).then(() => result);\n }\n }\n\n return Promise.resolve(result);\n }\n\n public markMutationOptimistic<\n TData,\n TVariables,\n TContext,\n TCache extends ApolloCache<any>,\n >(\n optimisticResponse: any,\n mutation: {\n mutationId: string;\n document: DocumentNode;\n variables?: TVariables;\n fetchPolicy?: MutationFetchPolicy;\n errorPolicy: ErrorPolicy;\n context?: TContext;\n updateQueries: UpdateQueries<TData>;\n update?: MutationUpdaterFunction<TData, TVariables, TContext, TCache>;\n keepRootFields?: boolean;\n }\n ) {\n const data =\n typeof optimisticResponse === \"function\" ?\n optimisticResponse(mutation.variables, { IGNORE })\n : optimisticResponse;\n\n if (data === IGNORE) {\n return false;\n }\n\n this.cache.recordOptimisticTransaction((cache) => {\n try {\n this.markMutationResult<TData, TVariables, TContext, TCache>(\n {\n ...mutation,\n result: { data },\n },\n cache\n );\n } catch (error) {\n invariant.error(error);\n }\n }, mutation.mutationId);\n\n return true;\n }\n\n public fetchQuery<TData, TVars extends OperationVariables>(\n queryId: string,\n options: WatchQueryOptions<TVars, TData>,\n networkStatus?: NetworkStatus\n ): Promise<ApolloQueryResult<TData>> {\n return this.fetchConcastWithInfo(queryId, options, networkStatus).concast\n .promise as TODO;\n }\n\n public getQueryStore() {\n const store: Record<string, QueryStoreValue> = Object.create(null);\n this.queries.forEach((info, queryId) => {\n store[queryId] = {\n variables: info.variables,\n networkStatus: info.networkStatus,\n networkError: info.networkError,\n graphQLErrors: info.graphQLErrors,\n };\n });\n return store;\n }\n\n public resetErrors(queryId: string) {\n const queryInfo = this.queries.get(queryId);\n if (queryInfo) {\n queryInfo.networkError = undefined;\n queryInfo.graphQLErrors = [];\n }\n }\n\n public transform(document: DocumentNode) {\n return this.documentTransform.transformDocument(document);\n }\n\n private transformCache = new AutoCleanedWeakCache<\n DocumentNode,\n TransformCacheEntry\n >(\n cacheSizes[\"queryManager.getDocumentInfo\"] ||\n defaultCacheSizes[\"queryManager.getDocumentInfo\"]\n );\n\n public getDocumentInfo(document: DocumentNode) {\n const { transformCache } = this;\n\n if (!transformCache.has(document)) {\n const cacheEntry: TransformCacheEntry = {\n // TODO These three calls (hasClientExports, shouldForceResolvers, and\n // usesNonreactiveDirective) are performing independent full traversals\n // of the transformed document. We should consider merging these\n // traversals into a single pass in the future, though the work is\n // cached after the first time.\n hasClientExports: hasClientExports(document),\n hasForcedResolvers: this.localState.shouldForceResolvers(document),\n hasNonreactiveDirective: hasDirectives([\"nonreactive\"], document),\n clientQuery: this.localState.clientQuery(document),\n serverQuery: removeDirectivesFromDocument(\n [\n { name: \"client\", remove: true },\n { name: \"connection\" },\n { name: \"nonreactive\" },\n ],\n document\n ),\n defaultVars: getDefaultValues(\n getOperationDefinition(document)\n ) as OperationVariables,\n // Transform any mutation or subscription operations to query operations\n // so we can read/write them from/to the cache.\n asQuery: {\n ...document,\n definitions: document.definitions.map((def) => {\n if (\n def.kind === \"OperationDefinition\" &&\n def.operation !== \"query\"\n ) {\n return { ...def, operation: \"query\" as OperationTypeNode };\n }\n return def;\n }),\n },\n };\n\n transformCache.set(document, cacheEntry);\n }\n\n return transformCache.get(document)!;\n }\n\n private getVariables<TVariables>(\n document: DocumentNode,\n variables?: TVariables\n ): OperationVariables {\n return {\n ...this.getDocumentInfo(document).defaultVars,\n ...variables,\n };\n }\n\n public watchQuery<\n T,\n TVariables extends OperationVariables = OperationVariables,\n >(options: WatchQueryOptions<TVariables, T>): ObservableQuery<T, TVariables> {\n const query = this.transform(options.query);\n\n // assign variable default values if supplied\n // NOTE: We don't modify options.query here with the transformed query to\n // ensure observable.options.query is set to the raw untransformed query.\n options = {\n ...options,\n variables: this.getVariables(query, options.variables) as TVariables,\n };\n\n if (typeof options.notifyOnNetworkStatusChange === \"undefined\") {\n options.notifyOnNetworkStatusChange = false;\n }\n\n const queryInfo = new QueryInfo(this);\n const observable = new ObservableQuery<T, TVariables>({\n queryManager: this,\n queryInfo,\n options,\n });\n observable[\"lastQuery\"] = query;\n\n this.queries.set(observable.queryId, queryInfo);\n\n // We give queryInfo the transformed query to ensure the first cache diff\n // uses the transformed query instead of the raw query\n queryInfo.init({\n document: query,\n observableQuery: observable,\n variables: observable.variables,\n });\n\n return observable;\n }\n\n public query<TData, TVars extends OperationVariables = OperationVariables>(\n options: QueryOptions<TVars, TData>,\n queryId = this.generateQueryId()\n ): Promise<ApolloQueryResult<TData>> {\n invariant(\n options.query,\n \"query option is required. You must specify your GraphQL document \" +\n \"in the query option.\"\n );\n\n invariant(\n options.query.kind === \"Document\",\n 'You must wrap the query string in a \"gql\" tag.'\n );\n\n invariant(\n !(options as any).returnPartialData,\n \"returnPartialData option only supported on watchQuery.\"\n );\n\n invariant(\n !(options as any).pollInterval,\n \"pollInterval option only supported on watchQuery.\"\n );\n\n return this.fetchQuery<TData, TVars>(queryId, {\n ...options,\n query: this.transform(options.query),\n }).finally(() => this.stopQuery(queryId));\n }\n\n private queryIdCounter = 1;\n public generateQueryId() {\n return String(this.queryIdCounter++);\n }\n\n private requestIdCounter = 1;\n public generateRequestId() {\n return this.requestIdCounter++;\n }\n\n private mutationIdCounter = 1;\n public generateMutationId() {\n return String(this.mutationIdCounter++);\n }\n\n public stopQueryInStore(queryId: string) {\n this.stopQueryInStoreNoBroadcast(queryId);\n this.broadcastQueries();\n }\n\n private stopQueryInStoreNoBroadcast(queryId: string) {\n const queryInfo = this.queries.get(queryId);\n if (queryInfo) queryInfo.stop();\n }\n\n public clearStore(\n options: Cache.ResetOptions = {\n discardWatches: true,\n }\n ): Promise<void> {\n // Before we have sent the reset action to the store, we can no longer\n // rely on the results returned by in-flight requests since these may\n // depend on values that previously existed in the data portion of the\n // store. So, we cancel the promises and observers that we have issued\n // so far and not yet resolved (in the case of queries).\n this.cancelPendingFetches(\n newInvariantError(\n \"Store reset while query was in flight (not completed in link chain)\"\n )\n );\n\n this.queries.forEach((queryInfo) => {\n if (queryInfo.observableQuery) {\n // Set loading to true so listeners don't trigger unless they want\n // results with partial data.\n queryInfo.networkStatus = NetworkStatus.loading;\n } else {\n queryInfo.stop();\n }\n });\n\n if (this.mutationStore) {\n this.mutationStore = Object.create(null);\n }\n\n // begin removing data from the store\n return this.cache.reset(options);\n }\n\n public getObservableQueries(\n include: InternalRefetchQueriesInclude = \"active\"\n ) {\n const queries = new Map<string, ObservableQuery<any>>();\n const queryNamesAndDocs = new Map<string | DocumentNode, boolean>();\n const legacyQueryOptions = new Set<QueryOptions>();\n\n if (Array.isArray(include)) {\n include.forEach((desc) => {\n if (typeof desc === \"string\") {\n queryNamesAndDocs.set(desc, false);\n } else if (isDocumentNode(desc)) {\n queryNamesAndDocs.set(this.transform(desc), false);\n } else if (isNonNullObject(desc) && desc.query) {\n legacyQueryOptions.add(desc);\n }\n });\n }\n\n this.queries.forEach(({ observableQuery: oq, document }, queryId) => {\n if (oq) {\n if (include === \"all\") {\n queries.set(queryId, oq);\n return;\n }\n\n const {\n queryName,\n options: { fetchPolicy },\n } = oq;\n\n if (\n fetchPolicy === \"standby\" ||\n (include === \"active\" && !oq.hasObservers())\n ) {\n return;\n }\n\n if (\n include === \"active\" ||\n (queryName && queryNamesAndDocs.has(queryName)) ||\n (document && queryNamesAndDocs.has(document))\n ) {\n queries.set(queryId, oq);\n if (queryName) queryNamesAndDocs.set(queryName, true);\n if (document) queryNamesAndDocs.set(document, true);\n }\n }\n });\n\n if (legacyQueryOptions.size) {\n legacyQueryOptions.forEach((options: QueryOptions) => {\n // We will be issuing a fresh network request for this query, so we\n // pre-allocate a new query ID here, using a special prefix to enable\n // cleaning up these temporary queries later, after fetching.\n const queryId = makeUniqueId(\"legacyOneTimeQuery\");\n const queryInfo = this.getQuery(queryId).init({\n document: options.query,\n variables: options.variables,\n });\n const oq = new ObservableQuery({\n queryManager: this,\n queryInfo,\n options: {\n ...options,\n fetchPolicy: \"network-only\",\n },\n });\n invariant(oq.queryId === queryId);\n queryInfo.setObservableQuery(oq);\n queries.set(queryId, oq);\n });\n }\n\n if (__DEV__ && queryNamesAndDocs.size) {\n queryNamesAndDocs.forEach((included, nameOrDoc) => {\n if (!included) {\n invariant.warn(\n typeof nameOrDoc === \"string\" ?\n `Unknown query named \"%s\" requested in refetchQueries options.include array`\n : `Unknown query %o requested in refetchQueries options.include array`,\n nameOrDoc\n );\n }\n });\n }\n\n return queries;\n }\n\n public reFetchObservableQueries(\n includeStandby: boolean = false\n ): Promise<ApolloQueryResult<any>[]> {\n const observableQueryPromises: Promise<ApolloQueryResult<any>>[] = [];\n\n this.getObservableQueries(includeStandby ? \"all\" : \"active\").forEach(\n (observableQuery, queryId) => {\n const { fetchPolicy } = observableQuery.options;\n observableQuery.resetLastResults();\n if (\n includeStandby ||\n (fetchPolicy !== \"standby\" && fetchPolicy !== \"cache-only\")\n ) {\n observableQueryPromises.push(observableQuery.refetch());\n }\n this.getQuery(queryId).setDiff(null);\n }\n );\n\n this.broadcastQueries();\n\n return Promise.all(observableQueryPromises);\n }\n\n public setObservableQuery(observableQuery: ObservableQuery<any, any>) {\n this.getQuery(observableQuery.queryId).setObservableQuery(observableQuery);\n }\n\n public startGraphQLSubscription<T = any>({\n query,\n fetchPolicy,\n errorPolicy = \"none\",\n variables,\n context = {},\n extensions = {},\n }: SubscriptionOptions): Observable<FetchResult<T>> {\n query = this.transform(query);\n variables = this.getVariables(query, variables);\n\n const makeObservable = (variables: OperationVariables) =>\n this.getObservableFromLink<T>(query, context, variables, extensions).map(\n (result) => {\n if (fetchPolicy !== \"no-cache\") {\n // the subscription interface should handle not sending us results we no longer subscribe to.\n // XXX I don't think we ever send in an object with errors, but we might in the future...\n if (shouldWriteResult(result, errorPolicy)) {\n this.cache.write({\n query,\n result: result.data,\n dataId: \"ROOT_SUBSCRIPTION\",\n variables: variables,\n });\n }\n\n this.broadcastQueries();\n }\n\n const hasErrors = graphQLResultHasError(result);\n const hasProtocolErrors = graphQLResultHasProtocolErrors(result);\n if (hasErrors || hasProtocolErrors) {\n const errors: ApolloErrorOptions = {};\n if (hasErrors) {\n errors.graphQLErrors = result.errors;\n }\n if (hasProtocolErrors) {\n errors.protocolErrors = result.extensions[PROTOCOL_ERRORS_SYMBOL];\n }\n\n // `errorPolicy` is a mechanism for handling GraphQL errors, according\n // to our documentation, so we throw protocol errors regardless of the\n // set error policy.\n if (errorPolicy === \"none\" || hasProtocolErrors) {\n throw new ApolloError(errors);\n }\n }\n\n if (errorPolicy === \"ignore\") {\n delete result.errors;\n }\n\n return result;\n }\n );\n\n if (this.getDocumentInfo(query).hasClientExports) {\n const observablePromise = this.localState\n .addExportedVariables(query, variables, context)\n .then(makeObservable);\n\n return new Observable<FetchResult<T>>((observer) => {\n let sub: ObservableSubscription | null = null;\n observablePromise.then(\n (observable) => (sub = observable.subscribe(observer)),\n observer.error\n );\n return () => sub && sub.unsubscribe();\n });\n }\n\n return makeObservable(variables);\n }\n\n public stopQuery(queryId: string) {\n this.stopQueryNoBroadcast(queryId);\n this.broadcastQueries();\n }\n\n private stopQueryNoBroadcast(queryId: string) {\n this.stopQueryInStoreNoBroadcast(queryId);\n this.removeQuery(queryId);\n }\n\n public removeQuery(queryId: string) {\n // teardown all links\n // Both `QueryManager.fetchRequest` and `QueryManager.query` create separate promises\n // that each add their reject functions to fetchCancelFns.\n // A query created with `QueryManager.query()` could trigger a `QueryManager.fetchRequest`.\n // The same queryId could have two rejection fns for two promises\n this.fetchCancelFns.delete(queryId);\n if (this.queries.has(queryId)) {\n this.getQuery(queryId).stop();\n this.queries.delete(queryId);\n }\n }\n\n public broadcastQueries() {\n if (this.onBroadcast) this.onBroadcast();\n this.queries.forEach((info) => info.notify());\n }\n\n public getLocalState(): LocalState<TStore> {\n return this.localState;\n }\n\n // Use protected instead of private field so\n // @apollo/experimental-nextjs-app-support can access type info.\n protected inFlightLinkObservables = new Trie<{\n observable?: Observable<FetchResult<any>>;\n }>(false);\n\n private getObservableFromLink<T = any>(\n query: DocumentNode,\n context: any,\n variables?: OperationVariables,\n extensions?: Record<string, any>,\n // Prefer context.queryDeduplication if specified.\n deduplication: boolean = context?.queryDeduplication ??\n this.queryDeduplication\n ): Observable<FetchResult<T>> {\n let observable: Observable<FetchResult<T>> | undefined;\n\n const { serverQuery, clientQuery } = this.getDocumentInfo(query);\n if (serverQuery) {\n const { inFlightLinkObservables, link } = this;\n\n const operation = {\n query: serverQuery,\n variables,\n operationName: getOperationName(serverQuery) || void 0,\n context: this.prepareContext({\n ...context,\n forceFetch: !deduplication,\n }),\n extensions,\n };\n\n context = operation.context;\n\n if (deduplication) {\n const printedServerQuery = print(serverQuery);\n const varJson = canonicalStringify(variables);\n\n const entry = inFlightLinkObservables.lookup(\n printedServerQuery,\n varJson\n );\n\n observable = entry.observable;\n if (!observable) {\n const concast = new Concast([\n execute(link, operation) as Observable<FetchResult<T>>,\n ]);\n observable = entry.observable = concast;\n\n concast.beforeNext(() => {\n inFlightLinkObservables.remove(printedServerQuery, varJson);\n });\n }\n } else {\n observable = new Concast([\n execute(link, operation) as Observable<FetchResult<T>>,\n ]);\n }\n } else {\n observable = new Concast([Observable.of({ data: {} } as FetchResult<T>)]);\n context = this.prepareContext(context);\n }\n\n if (clientQuery) {\n observable = asyncMap(observable, (result) => {\n return this.localState.runResolvers({\n document: clientQuery,\n remoteResult: result,\n context,\n variables,\n });\n });\n }\n\n return observable;\n }\n\n private getResultsFromLink<TData, TVars extends OperationVariables>(\n queryInfo: QueryInfo,\n cacheWriteBehavior: CacheWriteBehavior,\n options: Pick<\n WatchQueryOptions<TVars, TData>,\n \"query\" | \"variables\" | \"context\" | \"fetchPolicy\" | \"errorPolicy\"\n >\n ): Observable<ApolloQueryResult<TData>> {\n const requestId = (queryInfo.lastRequestId = this.generateRequestId());\n\n // Performing transformForLink here gives this.cache a chance to fill in\n // missing fragment definitions (for example) before sending this document\n // through the link chain.\n const linkDocument = this.cache.transformForLink(options.query);\n\n return asyncMap(\n this.getObservableFromLink(\n linkDocument,\n options.context,\n options.variables\n ),\n\n (result) => {\n const graphQLErrors = getGraphQLErrorsFromResult(result);\n const hasErrors = graphQLErrors.length > 0;\n const { errorPolicy } = options;\n\n // If we interrupted this request by calling getResultsFromLink again\n // with the same QueryInfo object, we ignore the old results.\n if (requestId >= queryInfo.lastRequestId) {\n if (hasErrors && errorPolicy === \"none\") {\n // Throwing here effectively calls observer.error.\n throw queryInfo.markError(\n new ApolloError({\n graphQLErrors,\n })\n );\n }\n // Use linkDocument rather than queryInfo.document so the\n // operation/fragments used to write the result are the same as the\n // ones used to obtain it from the link.\n queryInfo.markResult(\n result,\n linkDocument,\n options,\n cacheWriteBehavior\n );\n queryInfo.markReady();\n }\n\n const aqr: ApolloQueryResult<TData> = {\n data: result.data,\n loading: false,\n networkStatus: NetworkStatus.ready,\n };\n\n // In the case we start multiple network requests simulatenously, we\n // want to ensure we properly set `data` if we're reporting on an old\n // result which will not be caught by the conditional above that ends up\n // throwing the markError result.\n if (hasErrors && errorPolicy === \"none\") {\n aqr.data = void 0 as TData;\n }\n\n if (hasErrors && errorPolicy !== \"ignore\") {\n aqr.errors = graphQLErrors;\n aqr.networkStatus = NetworkStatus.error;\n }\n\n return aqr;\n },\n\n (networkError) => {\n const error =\n isApolloError(networkError) ? networkError : (\n new ApolloError({ networkError })\n );\n\n // Avoid storing errors from older interrupted queries.\n if (requestId >= queryInfo.lastRequestId) {\n queryInfo.markError(error);\n }\n\n throw error;\n }\n );\n }\n\n private fetchConcastWithInfo<TData, TVars extends OperationVariables>(\n queryId: string,\n options: WatchQueryOptions<TVars, TData>,\n // The initial networkStatus for this fetch, most often\n // NetworkStatus.loading, but also possibly fetchMore, poll, refetch,\n // or setVariables.\n networkStatus = NetworkStatus.loading,\n query = options.query\n ): ConcastAndInfo<TData> {\n const variables = this.getVariables(query, options.variables) as TVars;\n const queryInfo = this.getQuery(queryId);\n\n const defaults = this.defaultOptions.watchQuery;\n let {\n fetchPolicy = (defaults && defaults.fetchPolicy) || \"cache-first\",\n errorPolicy = (defaults && defaults.errorPolicy) || \"none\",\n returnPartialData = false,\n notifyOnNetworkStatusChange = false,\n context = {},\n } = options;\n\n const normalized = Object.assign({}, options, {\n query,\n variables,\n fetchPolicy,\n errorPolicy,\n returnPartialData,\n notifyOnNetworkStatusChange,\n context,\n });\n\n const fromVariables = (variables: TVars) => {\n // Since normalized is always a fresh copy of options, it's safe to\n // modify its properties here, rather than creating yet another new\n // WatchQueryOptions object.\n normalized.variables = variables;\n\n const sourcesWithInfo = this.fetchQueryByPolicy<TData, TVars>(\n queryInfo,\n normalized,\n networkStatus\n );\n\n if (\n // If we're in standby, postpone advancing options.fetchPolicy using\n // applyNextFetchPolicy.\n normalized.fetchPolicy !== \"standby\" &&\n // The \"standby\" policy currently returns [] from fetchQueryByPolicy, so\n // this is another way to detect when nothing was done/fetched.\n sourcesWithInfo.sources.length > 0 &&\n queryInfo.observableQuery\n ) {\n queryInfo.observableQuery[\"applyNextFetchPolicy\"](\n \"after-fetch\",\n options\n );\n }\n\n return sourcesWithInfo;\n };\n\n // This cancel function needs to be set before the concast is created,\n // in case concast creation synchronously cancels the request.\n const cleanupCancelFn = () => this.fetchCancelFns.delete(queryId);\n this.fetchCancelFns.set(queryId, (reason) => {\n cleanupCancelFn();\n // This delay ensures the concast variable has been initialized.\n setTimeout(() => concast.cancel(reason));\n });\n\n let concast: Concast<ApolloQueryResult<TData>>,\n containsDataFromLink: boolean;\n // If the query has @export(as: ...) directives, then we need to\n // process those directives asynchronously. When there are no\n // @export directives (the common case), we deliberately avoid\n // wrapping the result of this.fetchQueryByPolicy in a Promise,\n // since the timing of result delivery is (unfortunately) important\n // for backwards compatibility. TODO This code could be simpler if\n // we deprecated and removed LocalState.\n if (this.getDocumentInfo(normalized.query).hasClientExports) {\n concast = new Concast(\n this.localState\n .addExportedVariables(\n normalized.query,\n normalized.variables,\n normalized.context\n )\n .then(fromVariables)\n .then((sourcesWithInfo) => sourcesWithInfo.sources)\n );\n // there is just no way we can synchronously get the *right* value here,\n // so we will assume `true`, which is the behaviour before the bug fix in\n // #10597. This means that bug is not fixed in that case, and is probably\n // un-fixable with reasonable effort for the edge case of @export as\n // directives.\n containsDataFromLink = true;\n } else {\n const sourcesWithInfo = fromVariables(normalized.variables);\n containsDataFromLink = sourcesWithInfo.fromLink;\n concast = new Concast(sourcesWithInfo.sources);\n }\n\n concast.promise.then(cleanupCancelFn, cleanupCancelFn);\n\n return {\n concast,\n fromLink: containsDataFromLink,\n };\n }\n\n public refetchQueries<TResult>({\n updateCache,\n include,\n optimistic = false,\n removeOptimistic = optimistic ? makeUniqueId(\"refetchQueries\") : void 0,\n onQueryUpdated,\n }: InternalRefetchQueriesOptions<\n ApolloCache<TStore>,\n TResult\n >): InternalRefetchQueriesMap<TResult> {\n const includedQueriesById = new Map<\n string,\n {\n oq: ObservableQuery<any>;\n lastDiff?: Cache.DiffResult<any>;\n diff?: Cache.DiffResult<any>;\n }\n >();\n\n if (include) {\n this.getObservableQueries(include).forEach((oq, queryId) => {\n includedQueriesById.set(queryId, {\n oq,\n lastDiff: this.getQuery(queryId).getDiff(),\n });\n });\n }\n\n const results: InternalRefetchQueriesMap<TResult> = new Map();\n\n if (updateCache) {\n this.cache.batch({\n update: updateCache,\n\n // Since you can perform any combination of cache reads and/or writes in\n // the cache.batch update function, its optimistic option can be either\n // a boolean or a string, representing three distinct modes of\n // operation:\n //\n // * false: read/write only the root layer\n // * true: read/write the topmost layer\n // * string: read/write a fresh optimistic layer with that ID string\n //\n // When typeof optimistic === \"string\", a new optimistic layer will be\n // temporarily created within cache.batch with that string as its ID. If\n // we then pass that same string as the removeOptimistic option, we can\n // make cache.batch immediately remove the optimistic layer after\n // running the updateCache function, triggering only one broadcast.\n //\n // However, the refetchQueries method accepts only true or false for its\n // optimistic option (not string). We interpret true to mean a temporary\n // optimistic layer should be created, to allow efficiently rolling back\n // the effect of the updateCache function, which involves passing a\n // string instead of true as the optimistic option to cache.batch, when\n // refetchQueries receives optimistic: true.\n //\n // In other words, we are deliberately not supporting the use case of\n // writing to an *existing* optimistic layer (using the refetchQueries\n // updateCache function), since that would potentially interfere with\n // other optimistic updates in progress. Instead, you can read/write\n // only the root layer by passing optimistic: false to refetchQueries,\n // or you can read/write a brand new optimistic layer that will be\n // automatically removed by passing optimistic: true.\n optimistic: (optimistic && removeOptimistic) || false,\n\n // The removeOptimistic option can also be provided by itself, even if\n // optimistic === false, to remove some previously-added optimistic\n // layer safely and efficiently, like we do in markMutationResult.\n //\n // If an explicit removeOptimistic string is provided with optimistic:\n // true, the removeOptimistic string will determine the ID of the\n // temporary optimistic layer, in case that ever matters.\n removeOptimistic,\n\n onWatchUpdated(watch, diff, lastDiff) {\n const oq =\n watch.watcher instanceof QueryInfo && watch.watcher.observableQuery;\n\n if (oq) {\n if (onQueryUpdated) {\n // Since we're about to handle this query now, remove it from\n // includedQueriesById, in case it was added earlier because of\n // options.include.\n includedQueriesById.delete(oq.queryId);\n\n let result: TResult | boolean | Promise<ApolloQueryResult<any>> =\n onQueryUpdated(oq, diff, lastDiff);\n\n if (result === true) {\n // The onQueryUpdated function requested the default refetching\n // behavior by returning true.\n result = oq.refetch();\n }\n\n // Record the result in the results Map, as long as onQueryUpdated\n // did not return false to skip/ignore this result.\n if (result !== false) {\n results.set(\n oq,\n result as InternalRefetchQueriesResult<TResult>\n );\n }\n\n // Allow the default cache broadcast to happen, except when\n // onQueryUpdated returns false.\n return result;\n }\n\n if (onQueryUpdated !== null) {\n // If we don't have an onQueryUpdated function, and onQueryUpdated\n // was not disabled by passing null, make sure this query is\n // \"included\" like any other options.include-specified query.\n includedQueriesById.set(oq.queryId, { oq, lastDiff, diff });\n }\n }\n },\n });\n }\n\n if (includedQueriesById.size) {\n includedQueriesById.forEach(({ oq, lastDiff, diff }, queryId) => {\n let result:\n | TResult\n | boolean\n | Promise<ApolloQueryResult<any>>\n | undefined;\n\n // If onQueryUpdated is provided, we want to use it for all included\n // queries, even the QueryOptions ones.\n if (onQueryUpdated) {\n if (!diff) {\n const info = oq[\"queryInfo\"];\n info.reset(); // Force info.getDiff() to read from cache.\n diff = info.getDiff();\n }\n result = onQueryUpdated(oq, diff, lastDiff);\n }\n\n // Otherwise, we fall back to refetching.\n if (!onQueryUpdated || result === true) {\n result = oq.refetch();\n }\n\n if (result !== false) {\n results.set(oq, result as InternalRefetchQueriesResult<TResult>);\n }\n\n if (queryId.indexOf(\"legacyOneTimeQuery\") >= 0) {\n this.stopQueryNoBroadcast(queryId);\n }\n });\n }\n\n if (removeOptimistic) {\n // In case no updateCache callback was provided (so cache.batch was not\n // called above, and thus did not already remove the optimistic layer),\n // remove it here. Since this is a no-op when the layer has already been\n // removed, we do it even if we called cache.batch above, since it's\n // possible this.cache is an instance of some ApolloCache subclass other\n // than InMemoryCache, and does not fully support the removeOptimistic\n // option for cache.batch.\n this.cache.removeOptimistic(removeOptimistic);\n }\n\n return results;\n }\n\n private fetchQueryByPolicy<TData, TVars extends OperationVariables>(\n queryInfo: QueryInfo,\n {\n query,\n variables,\n fetchPolicy,\n refetchWritePolicy,\n errorPolicy,\n returnPartialData,\n context,\n notifyOnNetworkStatusChange,\n }: WatchQueryOptions<TVars, TData>,\n // The initial networkStatus for this fetch, most often\n // NetworkStatus.loading, but also possibly fetchMore, poll, refetch,\n // or setVariables.\n networkStatus: NetworkStatus\n ): SourcesAndInfo<TData> {\n const oldNetworkStatus = queryInfo.networkStatus;\n\n queryInfo.init({\n document: query,\n variables,\n networkStatus,\n });\n\n const readCache = () => queryInfo.getDiff();\n\n const resultsFromCache = (\n diff: Cache.DiffResult<TData>,\n networkStatus = queryInfo.networkStatus || NetworkStatus.loading\n ) => {\n const data = diff.result;\n\n if (__DEV__ && !returnPartialData && !equal(data, {})) {\n logMissingFieldErrors(diff.missing);\n }\n\n const fromData = (data: TData | undefined) =>\n Observable.of({\n data,\n loading: isNetworkRequestInFlight(networkStatus),\n networkStatus,\n ...(diff.complete ? null : { partial: true }),\n } as ApolloQueryResult<TData>);\n\n if (data && this.getDocumentInfo(query).hasForcedResolvers) {\n return this.localState\n .runResolvers({\n document: query,\n remoteResult: { data },\n context,\n variables,\n onlyRunForcedResolvers: true,\n })\n .then((resolved) => fromData(resolved.data || void 0));\n }\n\n // Resolves https://github.com/apollographql/apollo-client/issues/10317.\n // If errorPolicy is 'none' and notifyOnNetworkStatusChange is true,\n // data was incorrectly returned from the cache on refetch:\n // if diff.missing exists, we should not return cache data.\n if (\n errorPolicy === \"none\" &&\n networkStatus === NetworkStatus.refetch &&\n Array.isArray(diff.missing)\n ) {\n return fromData(void 0);\n }\n\n return fromData(data);\n };\n\n const cacheWriteBehavior =\n fetchPolicy === \"no-cache\" ? CacheWriteBehavior.FORBID\n // Watched queries must opt into overwriting existing data on refetch,\n // by passing refetchWritePolicy: \"overwrite\" in their WatchQueryOptions.\n : (\n networkStatus === NetworkStatus.refetch &&\n refetchWritePolicy !== \"merge\"\n ) ?\n CacheWriteBehavior.OVERWRITE\n : CacheWriteBehavior.MERGE;\n\n const resultsFromLink = () =>\n this.getResultsFromLink<TData, TVars>(queryInfo, cacheWriteBehavior, {\n query,\n variables,\n context,\n fetchPolicy,\n errorPolicy,\n });\n\n const shouldNotify =\n notifyOnNetworkStatusChange &&\n typeof oldNetworkStatus === \"number\" &&\n oldNetworkStatus !== networkStatus &&\n isNetworkRequestInFlight(networkStatus);\n\n switch (fetchPolicy) {\n default:\n case \"cache-first\": {\n const diff = readCache();\n\n if (diff.complete) {\n return {\n fromLink: false,\n sources: [resultsFromCache(diff, queryInfo.markReady())],\n };\n }\n\n if (returnPartialData || shouldNotify) {\n return {\n fromLink: true,\n sources: [resultsFromCache(diff), resultsFromLink()],\n };\n }\n\n return { fromLink: true, sources: [resultsFromLink()] };\n }\n\n case \"cache-and-network\": {\n const diff = readCache();\n\n if (diff.complete || returnPartialData || shouldNotify) {\n return {\n fromLink: true,\n sources: [resultsFromCache(diff), resultsFromLink()],\n };\n }\n\n return { fromLink: true, sources: [resultsFromLink()] };\n }\n\n case \"cache-only\":\n return {\n fromLink: false,\n sources: [resultsFromCache(readCache(), queryInfo.markReady())],\n };\n\n case \"network-only\":\n if (shouldNotify) {\n return {\n fromLink: true,\n sources: [resultsFromCache(readCache()), resultsFromLink()],\n };\n }\n\n return { fromLink: true, sources: [resultsFromLink()] };\n\n case \"no-cache\":\n if (shouldNotify) {\n return {\n fromLink: true,\n // Note that queryInfo.getDiff() for no-cache queries does not call\n // cache.diff, but instead returns a { complete: false } stub result\n // when there is no queryInfo.diff already defined.\n sources: [resultsFromCache(queryInfo.getDiff()), resultsFromLink()],\n };\n }\n\n return { fromLink: true, sources: [resultsFromLink()] };\n\n case \"standby\":\n return { fromLink: false, sources: [] };\n }\n }\n\n private getQuery(queryId: string): QueryInfo {\n if (queryId && !this.queries.has(queryId)) {\n this.queries.set(queryId, new QueryInfo(this, queryId));\n }\n return this.queries.get(queryId)!;\n }\n\n private prepareContext(context = {}) {\n const newContext = this.localState.prepareContext(context);\n return {\n ...this.defaultContext,\n ...newContext,\n clientAwareness: this.clientAwareness,\n };\n }\n}\n\n// Return types used by fetchQueryByPolicy and other private methods above.\ninterface FetchConcastInfo {\n // Metadata properties that can be returned in addition to the Concast.\n fromLink: boolean;\n}\ninterface SourcesAndInfo<TData> extends FetchConcastInfo {\n sources: ConcastSourcesArray<ApolloQueryResult<TData>>;\n}\ninterface ConcastAndInfo<TData> extends FetchConcastInfo {\n concast: Concast<ApolloQueryResult<TData>>;\n}\n"]}
\No newline at end of file