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,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;oCACnD,SAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gCACpB,CAAC;4BACH,CAAC,CAAC,CAAC;4BACH,SAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;4BACpB,kBAAkB,CAAC,OAAO,CAAC,UAAC,SAAS;gCACnC,SAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;4BACzB,CAAC,CAAC,CAAC;wBACL,CAAC;oBACH,CAAC;iBACF,CAAC,CAAC;YACL,CAAC;YACD,OAAO,wBAAwB,CAAC,GAAG,CAAC,cAAc,CAAE,CAAC;QACvD,CAAC;QACD,OAAO,mBAAmB,CAAC,cAAc,CAAC,CAAC;IAC7C,CAAC;IACH,iBAAC;AAAD,CAAC,AAxeD,IAweC","sourcesContent":["import { invariant } from \"../utilities/globals/index.js\";\n\nimport type {\n DocumentNode,\n OperationDefinitionNode,\n SelectionSetNode,\n SelectionNode,\n InlineFragmentNode,\n FragmentDefinitionNode,\n FieldNode,\n ASTNode,\n DirectiveNode,\n FragmentSpreadNode,\n ExecutableDefinitionNode,\n} from \"graphql\";\nimport { visit, BREAK, isSelectionNode } from \"graphql\";\n\nimport type { ApolloCache } from \"../cache/index.js\";\nimport type { FragmentMap, StoreObject } from \"../utilities/index.js\";\nimport {\n argumentsObjectFromField,\n buildQueryFromSelectionSet,\n createFragmentMap,\n getFragmentDefinitions,\n getMainDefinition,\n hasDirectives,\n isField,\n isInlineFragment,\n mergeDeep,\n mergeDeepArray,\n removeClientSetsFromDocument,\n resultKeyNameFromField,\n shouldInclude,\n} from \"../utilities/index.js\";\nimport type { ApolloClient } from \"./ApolloClient.js\";\nimport type { Resolvers, OperationVariables } from \"./types.js\";\nimport type { FetchResult } from \"../link/core/index.js\";\nimport { cacheSlot } from \"../cache/index.js\";\n\nexport type Resolver = (\n rootValue?: any,\n args?: any,\n context?: any,\n info?: {\n field: FieldNode;\n fragmentMap: FragmentMap;\n }\n) => any;\n\nexport type VariableMap = { [name: string]: any };\n\nexport type FragmentMatcher = (\n rootValue: any,\n typeCondition: string,\n context: any\n) => boolean;\n\nexport type ExecContext = {\n fragmentMap: FragmentMap;\n context: any;\n variables: VariableMap;\n fragmentMatcher: FragmentMatcher;\n defaultOperationType: string;\n exportedVariables: Record<string, any>;\n onlyRunForcedResolvers: boolean;\n selectionsToResolve: Set<SelectionNode>;\n};\n\nexport type LocalStateOptions<TCacheShape> = {\n cache: ApolloCache<TCacheShape>;\n client?: ApolloClient<TCacheShape>;\n resolvers?: Resolvers | Resolvers[];\n fragmentMatcher?: FragmentMatcher;\n};\n\nexport class LocalState<TCacheShape> {\n private cache: ApolloCache<TCacheShape>;\n private client?: ApolloClient<TCacheShape>;\n private resolvers?: Resolvers;\n private fragmentMatcher?: FragmentMatcher;\n private selectionsToResolveCache = new WeakMap<\n ExecutableDefinitionNode,\n Set<SelectionNode>\n >();\n\n constructor({\n cache,\n client,\n resolvers,\n fragmentMatcher,\n }: LocalStateOptions<TCacheShape>) {\n this.cache = cache;\n\n if (client) {\n this.client = client;\n }\n\n if (resolvers) {\n this.addResolvers(resolvers);\n }\n\n if (fragmentMatcher) {\n this.setFragmentMatcher(fragmentMatcher);\n }\n }\n\n public addResolvers(resolvers: Resolvers | Resolvers[]) {\n this.resolvers = this.resolvers || {};\n if (Array.isArray(resolvers)) {\n resolvers.forEach((resolverGroup) => {\n this.resolvers = mergeDeep(this.resolvers, resolverGroup);\n });\n } else {\n this.resolvers = mergeDeep(this.resolvers, resolvers);\n }\n }\n\n public setResolvers(resolvers: Resolvers | Resolvers[]) {\n this.resolvers = {};\n this.addResolvers(resolvers);\n }\n\n public getResolvers() {\n return this.resolvers || {};\n }\n\n // Run local client resolvers against the incoming query and remote data.\n // Locally resolved field values are merged with the incoming remote data,\n // and returned. Note that locally resolved fields will overwrite\n // remote data using the same field name.\n public async runResolvers<TData>({\n document,\n remoteResult,\n context,\n variables,\n onlyRunForcedResolvers = false,\n }: {\n document: DocumentNode | null;\n remoteResult: FetchResult<TData>;\n context?: Record<string, any>;\n variables?: Record<string, any>;\n onlyRunForcedResolvers?: boolean;\n }): Promise<FetchResult<TData>> {\n if (document) {\n return this.resolveDocument(\n document,\n remoteResult.data,\n context,\n variables,\n this.fragmentMatcher,\n onlyRunForcedResolvers\n ).then((localResult) => ({\n ...remoteResult,\n data: localResult.result,\n }));\n }\n\n return remoteResult;\n }\n\n public setFragmentMatcher(fragmentMatcher: FragmentMatcher) {\n this.fragmentMatcher = fragmentMatcher;\n }\n\n public getFragmentMatcher(): FragmentMatcher | undefined {\n return this.fragmentMatcher;\n }\n\n // Client queries contain everything in the incoming document (if a @client\n // directive is found).\n public clientQuery(document: DocumentNode) {\n if (hasDirectives([\"client\"], document)) {\n if (this.resolvers) {\n return document;\n }\n }\n return null;\n }\n\n // Server queries are stripped of all @client based selection sets.\n public serverQuery(document: DocumentNode) {\n return removeClientSetsFromDocument(document);\n }\n\n public prepareContext(context?: Record<string, any>) {\n const { cache } = this;\n return {\n ...context,\n cache,\n // Getting an entry's cache key is useful for local state resolvers.\n getCacheKey(obj: StoreObject) {\n return cache.identify(obj);\n },\n };\n }\n\n // To support `@client @export(as: \"someVar\")` syntax, we'll first resolve\n // @client @export fields locally, then pass the resolved values back to be\n // used alongside the original operation variables.\n public async addExportedVariables<TVars extends OperationVariables>(\n document: DocumentNode,\n variables: TVars = {} as TVars,\n context = {}\n ): /* returns at least the variables that were passed in */ Promise<TVars> {\n if (document) {\n return this.resolveDocument(\n document,\n this.buildRootValueFromCache(document, variables) || {},\n this.prepareContext(context),\n variables\n ).then((data) => ({\n ...variables,\n ...data.exportedVariables,\n }));\n }\n\n return {\n ...variables,\n };\n }\n\n public shouldForceResolvers(document: ASTNode) {\n let forceResolvers = false;\n visit(document, {\n Directive: {\n enter(node) {\n if (node.name.value === \"client\" && node.arguments) {\n forceResolvers = node.arguments.some(\n (arg) =>\n arg.name.value === \"always\" &&\n arg.value.kind === \"BooleanValue\" &&\n arg.value.value === true\n );\n if (forceResolvers) {\n return BREAK;\n }\n }\n },\n },\n });\n return forceResolvers;\n }\n\n // Query the cache and return matching data.\n private buildRootValueFromCache(\n document: DocumentNode,\n variables?: Record<string, any>\n ) {\n return this.cache.diff({\n query: buildQueryFromSelectionSet(document),\n variables,\n returnPartialData: true,\n optimistic: false,\n }).result;\n }\n\n private async resolveDocument<TData>(\n document: DocumentNode,\n rootValue: TData,\n context: any = {},\n variables: VariableMap = {},\n fragmentMatcher: FragmentMatcher = () => true,\n onlyRunForcedResolvers: boolean = false\n ) {\n const mainDefinition = getMainDefinition(\n document\n ) as OperationDefinitionNode;\n const fragments = getFragmentDefinitions(document);\n const fragmentMap = createFragmentMap(fragments);\n const selectionsToResolve = this.collectSelectionsToResolve(\n mainDefinition,\n fragmentMap\n );\n\n const definitionOperation = mainDefinition.operation;\n\n const defaultOperationType =\n definitionOperation ?\n definitionOperation.charAt(0).toUpperCase() +\n definitionOperation.slice(1)\n : \"Query\";\n\n const { cache, client } = this;\n const execContext: ExecContext = {\n fragmentMap,\n context: {\n ...context,\n cache,\n client,\n },\n variables,\n fragmentMatcher,\n defaultOperationType,\n exportedVariables: {},\n selectionsToResolve,\n onlyRunForcedResolvers,\n };\n const isClientFieldDescendant = false;\n\n return this.resolveSelectionSet(\n mainDefinition.selectionSet,\n isClientFieldDescendant,\n rootValue,\n execContext\n ).then((result) => ({\n result,\n exportedVariables: execContext.exportedVariables,\n }));\n }\n\n private async resolveSelectionSet<TData>(\n selectionSet: SelectionSetNode,\n isClientFieldDescendant: boolean,\n rootValue: TData,\n execContext: ExecContext\n ) {\n const { fragmentMap, context, variables } = execContext;\n const resultsToMerge: TData[] = [rootValue];\n\n const execute = async (selection: SelectionNode): Promise<void> => {\n if (\n !isClientFieldDescendant &&\n !execContext.selectionsToResolve.has(selection)\n ) {\n // Skip selections without @client directives\n // (still processing if one of the ancestors or one of the child fields has @client directive)\n return;\n }\n if (!shouldInclude(selection, variables)) {\n // Skip this entirely.\n return;\n }\n\n if (isField(selection)) {\n return this.resolveField(\n selection,\n isClientFieldDescendant,\n rootValue,\n execContext\n ).then((fieldResult) => {\n if (typeof fieldResult !== \"undefined\") {\n resultsToMerge.push({\n [resultKeyNameFromField(selection)]: fieldResult,\n } as TData);\n }\n });\n }\n\n let fragment: InlineFragmentNode | FragmentDefinitionNode;\n\n if (isInlineFragment(selection)) {\n fragment = selection;\n } else {\n // This is a named fragment.\n fragment = fragmentMap[selection.name.value];\n invariant(fragment, `No fragment named %s`, selection.name.value);\n }\n\n if (fragment && fragment.typeCondition) {\n const typeCondition = fragment.typeCondition.name.value;\n if (execContext.fragmentMatcher(rootValue, typeCondition, context)) {\n return this.resolveSelectionSet(\n fragment.selectionSet,\n isClientFieldDescendant,\n rootValue,\n execContext\n ).then((fragmentResult) => {\n resultsToMerge.push(fragmentResult);\n });\n }\n }\n };\n\n return Promise.all(selectionSet.selections.map(execute)).then(function () {\n return mergeDeepArray(resultsToMerge);\n });\n }\n\n private async resolveField(\n field: FieldNode,\n isClientFieldDescendant: boolean,\n rootValue: any,\n execContext: ExecContext\n ): Promise<any> {\n if (!rootValue) {\n return null;\n }\n\n const { variables } = execContext;\n const fieldName = field.name.value;\n const aliasedFieldName = resultKeyNameFromField(field);\n const aliasUsed = fieldName !== aliasedFieldName;\n const defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName];\n let resultPromise = Promise.resolve(defaultResult);\n\n // Usually all local resolvers are run when passing through here, but\n // if we've specifically identified that we only want to run forced\n // resolvers (that is, resolvers for fields marked with\n // `@client(always: true)`), then we'll skip running non-forced resolvers.\n if (\n !execContext.onlyRunForcedResolvers ||\n this.shouldForceResolvers(field)\n ) {\n const resolverType =\n rootValue.__typename || execContext.defaultOperationType;\n const resolverMap = this.resolvers && this.resolvers[resolverType];\n if (resolverMap) {\n const resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName];\n if (resolve) {\n resultPromise = Promise.resolve(\n // In case the resolve function accesses reactive variables,\n // set cacheSlot to the current cache instance.\n cacheSlot.withValue(this.cache, resolve, [\n rootValue,\n argumentsObjectFromField(field, variables),\n execContext.context,\n { field, fragmentMap: execContext.fragmentMap },\n ])\n );\n }\n }\n }\n\n return resultPromise.then((result = defaultResult) => {\n // If an @export directive is associated with the current field, store\n // the `as` export variable name and current result for later use.\n if (field.directives) {\n field.directives.forEach((directive) => {\n if (directive.name.value === \"export\" && directive.arguments) {\n directive.arguments.forEach((arg) => {\n if (arg.name.value === \"as\" && arg.value.kind === \"StringValue\") {\n execContext.exportedVariables[arg.value.value] = result;\n }\n });\n }\n });\n }\n\n // Handle all scalar types here.\n if (!field.selectionSet) {\n return result;\n }\n\n // From here down, the field has a selection set, which means it's trying\n // to query a GraphQLObjectType.\n if (result == null) {\n // Basically any field in a GraphQL response can be null, or missing\n return result;\n }\n\n const isClientField =\n field.directives?.some((d) => d.name.value === \"client\") ?? false;\n\n if (Array.isArray(result)) {\n return this.resolveSubSelectedArray(\n field,\n isClientFieldDescendant || isClientField,\n result,\n execContext\n );\n }\n\n // Returned value is an object, and the query has a sub-selection. Recurse.\n if (field.selectionSet) {\n return this.resolveSelectionSet(\n field.selectionSet,\n isClientFieldDescendant || isClientField,\n result,\n execContext\n );\n }\n });\n }\n\n private resolveSubSelectedArray(\n field: FieldNode,\n isClientFieldDescendant: boolean,\n result: any[],\n execContext: ExecContext\n ): any {\n return Promise.all(\n result.map((item) => {\n if (item === null) {\n return null;\n }\n\n // This is a nested array, recurse.\n if (Array.isArray(item)) {\n return this.resolveSubSelectedArray(\n field,\n isClientFieldDescendant,\n item,\n execContext\n );\n }\n\n // This is an object, run the selection set on it.\n if (field.selectionSet) {\n return this.resolveSelectionSet(\n field.selectionSet,\n isClientFieldDescendant,\n item,\n execContext\n );\n }\n })\n );\n }\n\n // Collect selection nodes on paths from document root down to all @client directives.\n // This function takes into account transitive fragment spreads.\n // Complexity equals to a single `visit` over the full document.\n private collectSelectionsToResolve(\n mainDefinition: OperationDefinitionNode,\n fragmentMap: FragmentMap\n ): Set<SelectionNode> {\n const isSingleASTNode = (\n node: ASTNode | readonly ASTNode[]\n ): node is ASTNode => !Array.isArray(node);\n const selectionsToResolveCache = this.selectionsToResolveCache;\n\n function collectByDefinition(\n definitionNode: ExecutableDefinitionNode\n ): Set<SelectionNode> {\n if (!selectionsToResolveCache.has(definitionNode)) {\n const matches = new Set<SelectionNode>();\n selectionsToResolveCache.set(definitionNode, matches);\n\n visit(definitionNode, {\n Directive(node: DirectiveNode, _, __, ___, ancestors) {\n if (node.name.value === \"client\") {\n ancestors.forEach((node) => {\n if (isSingleASTNode(node) && isSelectionNode(node)) {\n matches.add(node);\n }\n });\n }\n },\n FragmentSpread(spread: FragmentSpreadNode, _, __, ___, ancestors) {\n const fragment = fragmentMap[spread.name.value];\n invariant(fragment, `No fragment named %s`, spread.name.value);\n\n const fragmentSelections = collectByDefinition(fragment);\n if (fragmentSelections.size > 0) {\n // Fragment for this spread contains @client directive (either directly or transitively)\n // Collect selection nodes on paths from the root down to fields with the @client directive\n ancestors.forEach((node) => {\n if (isSingleASTNode(node) && isSelectionNode(node)) {\n matches.add(node);\n }\n });\n matches.add(spread);\n fragmentSelections.forEach((selection) => {\n matches.add(selection);\n });\n }\n },\n });\n }\n return selectionsToResolveCache.get(definitionNode)!;\n }\n return collectByDefinition(mainDefinition);\n }\n}\n"]}
\No newline at end of file