@apollo/client 3.3.0-rc.2 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apollo-client.cjs.js +68 -45
- package/apollo-client.cjs.js.map +1 -1
- package/apollo-client.cjs.min.js +1 -1
- package/cache/cache.cjs.js +40 -14
- package/cache/cache.cjs.js.map +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.js.map +1 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js +11 -2
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fixPolyfills.js.map +1 -1
- package/cache/inmemory/fixPolyfills.native.js.map +1 -1
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/policies.d.ts +1 -0
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +4 -0
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/reactiveVars.d.ts +1 -0
- package/cache/inmemory/reactiveVars.d.ts.map +1 -1
- package/cache/inmemory/reactiveVars.js +25 -12
- package/cache/inmemory/reactiveVars.js.map +1 -1
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/config/jest/setup.js.map +1 -1
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +3 -3
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +9 -4
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.js.map +1 -1
- package/core/Reobserver.js.map +1 -1
- package/core/core.cjs.js +12 -7
- package/core/core.cjs.js.map +1 -1
- package/core/index.js.map +1 -1
- package/core/networkStatus.js.map +1 -1
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/errors/index.js.map +1 -1
- package/index.js.map +1 -1
- package/invariantErrorCodes.js +1 -1
- package/link/batch/batchLink.js.map +1 -1
- package/link/batch/batching.js.map +1 -1
- package/link/batch/index.js.map +1 -1
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/batch-http/index.js.map +1 -1
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/concat.js.map +1 -1
- package/link/core/empty.js.map +1 -1
- package/link/core/execute.js.map +1 -1
- package/link/core/from.js.map +1 -1
- package/link/core/index.js.map +1 -1
- package/link/core/split.js.map +1 -1
- package/link/core/types.js.map +1 -1
- package/link/error/index.js.map +1 -1
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/checkFetcher.js.map +1 -1
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/createSignalIfSupported.js.map +1 -1
- package/link/http/index.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/selectURI.js.map +1 -1
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/persisted-queries/index.js.map +1 -1
- package/link/retry/delayFunction.js.map +1 -1
- package/link/retry/index.js.map +1 -1
- package/link/retry/retryFunction.js.map +1 -1
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +2 -0
- package/link/schema/index.d.ts.map +1 -1
- package/link/schema/index.js +6 -3
- package/link/schema/index.js.map +1 -1
- package/link/schema/schema.cjs.js +6 -3
- package/link/schema/schema.cjs.js.map +1 -1
- package/link/utils/createOperation.js.map +1 -1
- package/link/utils/fromError.js.map +1 -1
- package/link/utils/fromPromise.js.map +1 -1
- package/link/utils/index.js.map +1 -1
- package/link/utils/throwServerError.js.map +1 -1
- package/link/utils/toPromise.js.map +1 -1
- package/link/utils/transformOperation.js.map +1 -1
- package/link/utils/validateOperation.js.map +1 -1
- package/link/ws/index.js.map +1 -1
- package/package.json +5 -5
- package/react/components/Mutation.js.map +1 -1
- package/react/components/Query.js.map +1 -1
- package/react/components/Subscription.js.map +1 -1
- package/react/components/index.js.map +1 -1
- package/react/components/types.js.map +1 -1
- package/react/context/ApolloConsumer.d.ts +1 -1
- package/react/context/ApolloConsumer.d.ts.map +1 -1
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloConsumer.js.map +1 -1
- package/react/context/ApolloContext.d.ts +2 -2
- package/react/context/ApolloContext.d.ts.map +1 -1
- package/react/context/ApolloContext.js +9 -15
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.d.ts +1 -1
- package/react/context/ApolloProvider.d.ts.map +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/context/context.cjs.js +9 -18
- package/react/context/context.cjs.js.map +1 -1
- package/react/context/index.js.map +1 -1
- package/react/data/MutationData.js.map +1 -1
- package/react/data/OperationData.js.map +1 -1
- package/react/data/QueryData.d.ts.map +1 -1
- package/react/data/QueryData.js +2 -1
- package/react/data/QueryData.js.map +1 -1
- package/react/data/SubscriptionData.js.map +1 -1
- package/react/data/data.cjs.js +2 -1
- package/react/data/data.cjs.js.map +1 -1
- package/react/data/index.js.map +1 -1
- package/react/hoc/graphql.js.map +1 -1
- package/react/hoc/hoc-utils.js.map +1 -1
- package/react/hoc/index.js.map +1 -1
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/types.js.map +1 -1
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs.js +1 -4
- package/react/hooks/hooks.cjs.js.map +1 -1
- package/react/hooks/index.js.map +1 -1
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useReactiveVar.js.map +1 -1
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/utils/useBaseQuery.js.map +1 -1
- package/react/hooks/utils/useDeepMemo.js.map +1 -1
- package/react/index.js.map +1 -1
- package/react/parser/index.js.map +1 -1
- package/react/ssr/RenderPromises.js.map +1 -1
- package/react/ssr/getDataFromTree.js.map +1 -1
- package/react/ssr/index.js.map +1 -1
- package/react/ssr/renderToStringWithData.js.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/index.js.map +1 -1
- package/utilities/common/arrays.js.map +1 -1
- package/utilities/common/canUse.js.map +1 -1
- package/utilities/common/cloneDeep.js.map +1 -1
- package/utilities/common/compact.js.map +1 -1
- package/utilities/common/environment.js.map +1 -1
- package/utilities/common/errorHandling.js.map +1 -1
- package/utilities/common/filterInPlace.js.map +1 -1
- package/utilities/common/maybeDeepFreeze.js.map +1 -1
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.js.map +1 -1
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/observables/Observable.js.map +1 -1
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/observables/iteration.js.map +1 -1
- package/utilities/policies/pagination.d.ts +9 -9
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js +3 -2
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/testing/index.js.map +1 -1
- package/utilities/testing/itAsync.js.map +1 -1
- package/utilities/testing/mocking/MockedProvider.js.map +1 -1
- package/utilities/testing/mocking/mockClient.js.map +1 -1
- package/utilities/testing/mocking/mockFetch.js.map +1 -1
- package/utilities/testing/mocking/mockLink.js.map +1 -1
- package/utilities/testing/mocking/mockQueryManager.js.map +1 -1
- package/utilities/testing/mocking/mockSubscriptionLink.js.map +1 -1
- package/utilities/testing/mocking/mockWatchQuery.js.map +1 -1
- package/utilities/testing/observableToPromise.js.map +1 -1
- package/utilities/testing/stripSymbols.js.map +1 -1
- package/utilities/testing/subscribeAndCount.js.map +1 -1
- package/utilities/testing/wrap.js.map +1 -1
- package/utilities/utilities.cjs.js +2 -1
- package/utilities/utilities.cjs.js.map +1 -1
- package/version.js.map +1 -1
package/cache/core/cache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/cache/core/cache.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAGL,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AAMzB;IAAA;QA2GU,mBAAc,GAAG,IAAI,CAAC,wBAAwB,CAAC,CAAC;IAsC1D,CAAC;IA1FQ,iDAA2B,GAAlC,UACE,WAAqC,EACrC,YAAoB;QAEpB,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IACrD,CAAC;IAIM,uCAAiB,GAAxB,UAAyB,QAAsB;QAC7C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEM,8BAAQ,GAAf,UAAgB,MAA+B;QAC7C,OAAO;IACT,CAAC;IAEM,wBAAE,GAAT;QACE,OAAO,EAAE,CAAC;IACZ,CAAC;IAEM,4BAAM,GAAb,UAAc,OAA4B;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IAIM,sCAAgB,GAAvB,UAAwB,QAAsB;QAC5C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAQM,+BAAS,GAAhB,UACE,OAAsD,EACtD,UAAiC;QAAjC,2BAAA,EAAA,cAAc,CAAC,OAAO,CAAC,UAAU;QAEjC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IAAI,CAAC,IAAI,CAAC;YACf,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC;YAClE,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,MAAM,EAAE,OAAO,CAAC,EAAE;YAClB,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;YAC5C,UAAU,YAAA;SACX,CAAC,CAAC;IACL,CAAC;IAEM,gCAAU,GAAjB,UACE,OAAmD;QAEnD,OAAO,IAAI,CAAC,KAAK,CAAC;YAChB,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,YAAY;YAClC,MAAM,EAAE,OAAO,CAAC,IAAI;YACpB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,SAAS,EAAE,OAAO,CAAC,SAAS;SAC7B,CAAC,CAAC;IACL,CAAC;IAEM,mCAAa,GAApB,UACE,OAAsD;QAEtD,OAAO,IAAI,CAAC,KAAK,CAAC;YAChB,MAAM,EAAE,OAAO,CAAC,EAAE;YAClB,MAAM,EAAE,OAAO,CAAC,IAAI;YACpB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC;YAClE,SAAS,EAAE,OAAO,CAAC,SAAS;SAC7B,CAAC,CAAC;IACL,CAAC;IACH,kBAAC;AAAD,CAAC,AAjJD,IAiJC","sourcesContent":["import { DocumentNode } from 'graphql';\nimport { wrap } from 'optimism';\n\nimport {\n StoreObject,\n Reference,\n getFragmentQueryDocument,\n} from '../../utilities';\nimport { DataProxy } from './types/DataProxy';\nimport { Cache } from './types/Cache';\n\nexport type Transaction<T> = (c: ApolloCache<T>) => void;\n\nexport abstract class ApolloCache<TSerialized> implements DataProxy {\n // required to implement\n // core API\n public abstract read<T, TVariables = any>(\n query: Cache.ReadOptions<TVariables, T>,\n ): T | null;\n public abstract write<TResult = any, TVariables = any>(\n write: Cache.WriteOptions<TResult, TVariables>,\n ): Reference | undefined;\n public abstract diff<T>(query: Cache.DiffOptions): Cache.DiffResult<T>;\n public abstract watch(watch: Cache.WatchOptions): () => void;\n public abstract reset(): Promise<void>;\n\n // Remove whole objects from the cache by passing just options.id, or\n // specific fields by passing options.field and/or options.args. If no\n // options.args are provided, all fields matching options.field (even\n // those with arguments) will be removed. Returns true iff any data was\n // removed from the cache.\n public abstract evict(options: Cache.EvictOptions): boolean;\n\n // intializer / offline / ssr API\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 abstract restore(\n serializedState: TSerialized,\n ): ApolloCache<TSerialized>;\n\n /**\n * Exposes the cache's complete state, in a serializable format for later restoration.\n */\n public abstract extract(optimistic?: boolean): TSerialized;\n\n // Optimistic API\n\n public abstract removeOptimistic(id: string): void;\n\n // Transactional API\n\n public abstract performTransaction(\n transaction: Transaction<TSerialized>,\n // Although subclasses may implement recordOptimisticTransaction\n // however they choose, the default implementation simply calls\n // performTransaction with a string as the second argument, allowing\n // performTransaction to handle both optimistic and non-optimistic\n // (broadcast-batching) transactions. Passing null for optimisticId is\n // also allowed, and indicates that performTransaction should apply\n // the transaction non-optimistically (ignoring optimistic data).\n optimisticId?: string | null,\n ): void;\n\n public recordOptimisticTransaction(\n transaction: Transaction<TSerialized>,\n optimisticId: string,\n ) {\n this.performTransaction(transaction, optimisticId);\n }\n\n // Optional API\n\n public transformDocument(document: DocumentNode): DocumentNode {\n return document;\n }\n\n public identify(object: StoreObject | Reference): string | undefined {\n return;\n }\n\n public gc(): string[] {\n return [];\n }\n\n public modify(options: Cache.ModifyOptions): boolean {\n return false;\n }\n\n // Experimental API\n\n public transformForLink(document: DocumentNode): DocumentNode {\n return document;\n }\n\n // DataProxy API\n /**\n *\n * @param options\n * @param optimistic\n */\n public readQuery<QueryType, TVariables = any>(\n options: Cache.ReadQueryOptions<QueryType, TVariables>,\n optimistic = !!options.optimistic,\n ): QueryType | null {\n return this.read({\n rootId: options.id || 'ROOT_QUERY',\n query: options.query,\n variables: options.variables,\n returnPartialData: options.returnPartialData,\n optimistic,\n });\n }\n\n // Make sure we compute the same (===) fragment query document every\n // time we receive the same fragment in readFragment.\n private getFragmentDoc = wrap(getFragmentQueryDocument);\n\n public readFragment<FragmentType, TVariables = any>(\n options: Cache.ReadFragmentOptions<FragmentType, TVariables>,\n optimistic = !!options.optimistic,\n ): FragmentType | null {\n return this.read({\n query: this.getFragmentDoc(options.fragment, options.fragmentName),\n variables: options.variables,\n rootId: options.id,\n returnPartialData: options.returnPartialData,\n optimistic,\n });\n }\n\n public writeQuery<TData = any, TVariables = any>(\n options: Cache.WriteQueryOptions<TData, TVariables>,\n ): Reference | undefined {\n return this.write({\n dataId: options.id || 'ROOT_QUERY',\n result: options.data,\n query: options.query,\n variables: options.variables,\n broadcast: options.broadcast,\n });\n }\n\n public writeFragment<TData = any, TVariables = any>(\n options: Cache.WriteFragmentOptions<TData, TVariables>,\n ): Reference | undefined {\n return this.write({\n dataId: options.id,\n result: options.data,\n variables: options.variables,\n query: this.getFragmentDoc(options.fragment, options.fragmentName),\n broadcast: options.broadcast,\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../../../src/cache/core/types/Cache.ts"],"names":[],"mappings":"AAGA,MAAM,KAAW,KAAK,CAiDrB;AAjDD,WAAiB,KAAK;AAiDtB,CAAC,EAjDgB,KAAK,KAAL,KAAK,QAiDrB"}
|
|
1
|
+
{"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../../../src/cache/core/types/Cache.ts"],"names":[],"mappings":"AAGA,MAAM,KAAW,KAAK,CAiDrB;AAjDD,WAAiB,KAAK;AAiDtB,CAAC,EAjDgB,KAAK,KAAL,KAAK,QAiDrB","sourcesContent":["import { DataProxy } from './DataProxy';\nimport { Modifier, Modifiers } from './common';\n\nexport namespace Cache {\n export type WatchCallback = (diff: Cache.DiffResult<any>) => void;\n\n export interface ReadOptions<TVariables = any, TData = any>\n extends DataProxy.Query<TVariables, TData> {\n rootId?: string;\n previousResult?: any;\n optimistic: boolean;\n returnPartialData?: boolean;\n }\n\n export interface WriteOptions<TResult = any, TVariables = any>\n extends DataProxy.Query<TVariables, TResult> {\n dataId?: string;\n result: TResult;\n broadcast?: boolean;\n }\n\n export interface DiffOptions extends ReadOptions {\n // The DiffOptions interface is currently just an alias for\n // ReadOptions, though DiffOptions used to be responsible for\n // declaring the returnPartialData option.\n }\n\n export interface WatchOptions extends ReadOptions {\n immediate?: boolean;\n callback: WatchCallback;\n }\n\n export interface EvictOptions {\n id?: string;\n fieldName?: string;\n args?: Record<string, any>;\n broadcast?: boolean;\n }\n\n export interface ModifyOptions {\n id?: string;\n fields: Modifiers | Modifier<any>;\n optimistic?: boolean;\n broadcast?: boolean;\n }\n\n export import DiffResult = DataProxy.DiffResult;\n export import ReadQueryOptions = DataProxy.ReadQueryOptions;\n export import ReadFragmentOptions = DataProxy.ReadFragmentOptions;\n export import WriteQueryOptions = DataProxy.WriteQueryOptions;\n export import WriteFragmentOptions = DataProxy.WriteFragmentOptions;\n export import Fragment = DataProxy.Fragment;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataProxy.js","sourceRoot":"","sources":["../../../../src/cache/core/types/DataProxy.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"DataProxy.js","sourceRoot":"","sources":["../../../../src/cache/core/types/DataProxy.ts"],"names":[],"mappings":"","sourcesContent":["import { DocumentNode } from 'graphql'; // eslint-disable-line import/no-extraneous-dependencies, import/no-unresolved\nimport { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport { MissingFieldError } from './common';\n\nexport namespace DataProxy {\n export interface Query<TVariables, TData> {\n /**\n * The GraphQL query shape to be used constructed using the `gql` template\n * string tag from `graphql-tag`. The query will be used to determine the\n * shape of the data to be read.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Any variables that the GraphQL query may depend on.\n */\n variables?: TVariables;\n\n /**\n * The root id to be used. Defaults to \"ROOT_QUERY\", which is the ID of the\n * root query object. This property makes writeQuery capable of writing data\n * to any object in the cache.\n */\n id?: string;\n }\n\n export interface Fragment<TVariables, TData> {\n /**\n * The root id to be used. This id should take the same form as the\n * value returned by your `dataIdFromObject` function. If a value with your\n * id does not exist in the store, `null` will be returned.\n */\n id?: string;\n\n /**\n * A GraphQL document created using the `gql` template string tag from\n * `graphql-tag` with one or more fragments which will be used to determine\n * the shape of data to read. If you provide more than one fragment in this\n * document then you must also specify `fragmentName` to select a single.\n */\n fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * The name of the fragment in your GraphQL document to be used. If you do\n * not provide a `fragmentName` and there is only one fragment in your\n * `fragment` document then that fragment will be used.\n */\n fragmentName?: string;\n\n /**\n * Any variables that your GraphQL fragments depend on.\n */\n variables?: TVariables;\n }\n\n export interface ReadQueryOptions<TData, TVariables>\n extends Query<TVariables, TData> {\n /**\n * Whether to return incomplete data rather than null.\n * Defaults to false.\n */\n returnPartialData?: boolean;\n /**\n * Whether to read from optimistic or non-optimistic cache data. If\n * this named option is provided, the optimistic parameter of the\n * readQuery method can be omitted. Defaults to false.\n */\n optimistic?: boolean;\n }\n\n export interface ReadFragmentOptions<TData, TVariables>\n extends Fragment<TVariables, TData> {\n /**\n * Whether to return incomplete data rather than null.\n * Defaults to false.\n */\n returnPartialData?: boolean;\n /**\n * Whether to read from optimistic or non-optimistic cache data. If\n * this named option is provided, the optimistic parameter of the\n * readQuery method can be omitted. Defaults to false.\n */\n optimistic?: boolean;\n }\n\n export interface WriteQueryOptions<TData, TVariables>\n extends Query<TVariables, TData> {\n /**\n * The data you will be writing to the store.\n */\n data: TData;\n /**\n * Whether to notify query watchers (default: true).\n */\n broadcast?: boolean;\n }\n\n export interface WriteFragmentOptions<TData, TVariables>\n extends Fragment<TVariables, TData> {\n /**\n * The data you will be writing to the store.\n */\n data: TData;\n /**\n * Whether to notify query watchers (default: true).\n */\n broadcast?: boolean;\n }\n\n export type DiffResult<T> = {\n result?: T;\n complete?: boolean;\n missing?: MissingFieldError[];\n fromOptimisticTransaction?: boolean;\n }\n}\n\n/**\n * A proxy to the normalized data living in our store. This interface allows a\n * user to read and write denormalized data which feels natural to the user\n * whilst in the background this data is being converted into the normalized\n * store format.\n */\nexport interface DataProxy {\n /**\n * Reads a GraphQL query from the root query id.\n */\n readQuery<QueryType, TVariables = any>(\n options: DataProxy.ReadQueryOptions<QueryType, TVariables>,\n optimistic?: boolean,\n ): QueryType | null;\n\n /**\n * Reads a GraphQL fragment from any arbitrary id. If there is more than\n * one fragment in the provided document then a `fragmentName` must be\n * provided to select the correct fragment.\n */\n readFragment<FragmentType, TVariables = any>(\n options: DataProxy.ReadFragmentOptions<FragmentType, TVariables>,\n optimistic?: boolean,\n ): FragmentType | null;\n\n /**\n * Writes a GraphQL query to the root query id.\n */\n writeQuery<TData = any, TVariables = any>(\n options: DataProxy.WriteQueryOptions<TData, TVariables>,\n ): void;\n\n /**\n * Writes a GraphQL fragment to any arbitrary id. If there is more than\n * one fragment in the provided document then a `fragmentName` must be\n * provided to select the correct fragment.\n */\n writeFragment<TData = any, TVariables = any>(\n options: DataProxy.WriteFragmentOptions<TData, TVariables>,\n ): void;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/cache/core/types/common.ts"],"names":[],"mappings":"AAoBA;IACE,2BACkB,OAAe,EACf,IAAyB,EACzB,KAAqC,EACrC,UAAmB,EACnB,SAA+B;QAJ/B,YAAO,GAAP,OAAO,CAAQ;QACf,SAAI,GAAJ,IAAI,CAAqB;QACzB,UAAK,GAAL,KAAK,CAAgC;QACrC,eAAU,GAAV,UAAU,CAAS;QACnB,cAAS,GAAT,SAAS,CAAsB;IAC9C,CAAC;IACN,wBAAC;AAAD,CAAC,AARD,IAQC"}
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/cache/core/types/common.ts"],"names":[],"mappings":"AAoBA;IACE,2BACkB,OAAe,EACf,IAAyB,EACzB,KAAqC,EACrC,UAAmB,EACnB,SAA+B;QAJ/B,YAAO,GAAP,OAAO,CAAQ;QACf,SAAI,GAAJ,IAAI,CAAqB;QACzB,UAAK,GAAL,KAAK,CAAgC;QACrC,eAAU,GAAV,UAAU,CAAS;QACnB,cAAS,GAAT,SAAS,CAAsB;IAC9C,CAAC;IACN,wBAAC;AAAD,CAAC,AARD,IAQC","sourcesContent":["import { FieldNode } from 'graphql';\n\nimport {\n Reference,\n StoreObject,\n StoreValue,\n isReference,\n} from '../../../utilities';\n\nimport { StorageType } from '../../inmemory/policies';\n\n// The Readonly<T> type only really works for object types, since it marks\n// all of the object's properties as readonly, but there are many cases when\n// a generic type parameter like TExisting might be a string or some other\n// primitive type, in which case we need to avoid wrapping it with Readonly.\n// SafeReadonly<string> collapses to just string, which makes string\n// assignable to SafeReadonly<any>, whereas string is not assignable to\n// Readonly<any>, somewhat surprisingly.\nexport type SafeReadonly<T> = T extends object ? Readonly<T> : T;\n\nexport class MissingFieldError {\n constructor(\n public readonly message: string,\n public readonly path: (string | number)[],\n public readonly query: import('graphql').DocumentNode,\n public readonly clientOnly: boolean,\n public readonly variables?: Record<string, any>,\n ) {}\n}\n\nexport interface FieldSpecifier {\n typename?: string;\n fieldName: string;\n field?: FieldNode;\n args?: Record<string, any>;\n variables?: Record<string, any>;\n}\n\nexport interface ReadFieldOptions extends FieldSpecifier {\n from?: StoreObject | Reference;\n}\n\nexport interface ReadFieldFunction {\n <V = StoreValue>(options: ReadFieldOptions): SafeReadonly<V> | undefined;\n <V = StoreValue>(\n fieldName: string,\n from?: StoreObject | Reference,\n ): SafeReadonly<V> | undefined;\n}\n\nexport type ToReferenceFunction = (\n objOrIdOrRef: StoreObject | string | Reference,\n mergeIntoStore?: boolean,\n) => Reference | undefined;\n\nexport type CanReadFunction = (value: StoreValue) => boolean;\n\nexport type Modifier<T> = (value: T, details: {\n DELETE: any;\n INVALIDATE: any;\n fieldName: string;\n storeFieldName: string;\n readField: ReadFieldFunction;\n canRead: CanReadFunction;\n isReference: typeof isReference;\n toReference: ToReferenceFunction;\n storage: StorageType;\n}) => T;\n\nexport type Modifiers = {\n [fieldName: string]: Modifier<any>;\n};\n"]}
|
package/cache/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAEL,WAAW,EACX,aAAa,GACd,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,aAAa,GAEd,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAEL,OAAO,EACP,SAAS,GACV,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,uBAAuB,GAQxB,MAAM,qBAAqB,CAAC;AAE7B,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAEL,WAAW,EACX,aAAa,GACd,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,aAAa,GAEd,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAEL,OAAO,EACP,SAAS,GACV,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,uBAAuB,GAQxB,MAAM,qBAAqB,CAAC;AAE7B,cAAc,kBAAkB,CAAC","sourcesContent":["export { Transaction, ApolloCache } from './core/cache';\nexport { Cache } from './core/types/Cache';\nexport { DataProxy } from './core/types/DataProxy';\nexport { MissingFieldError } from './core/types/common';\n\nexport {\n Reference,\n isReference,\n makeReference,\n} from '../utilities';\n\nexport {\n InMemoryCache,\n InMemoryCacheConfig,\n} from './inmemory/inMemoryCache';\n\nexport {\n ReactiveVar,\n makeVar,\n cacheSlot,\n} from './inmemory/reactiveVars';\n\nexport {\n defaultDataIdFromObject,\n TypePolicies,\n TypePolicy,\n FieldPolicy,\n FieldReadFunction,\n FieldMergeFunction,\n FieldFunctionOptions,\n PossibleTypesMap,\n} from './inmemory/policies';\n\nexport * from './inmemory/types';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entityStore.d.ts","sourceRoot":"","sources":["../../../src/cache/inmemory/entityStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,OAAO,EAAE,MAAM,UAAU,CAAC;AAGtE,OAAO,EAEL,UAAU,EACV,WAAW,EACX,SAAS,EAKV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,SAAS,EAET,mBAAmB,EACnB,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAM9B,8BAAsB,WAAY,YAAW,eAAe;aAIxC,QAAQ,EAAE,QAAQ;aAClB,KAAK,EAAE,UAAU;IAJnC,SAAS,CAAC,IAAI,EAAE,qBAAqB,CAAuB;gBAG1C,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,UAAU;aAGnB,QAAQ,CACtB,OAAO,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ACb,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,GAAG,GAClC,KAAK;IAID,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW;IA2BzC,QAAQ,IAAI,qBAAqB;IAOjC,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC;IAQrD,UAAU,IAAI,WAAW;CAKjC;AAiBD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,WAAW,CAGtE"}
|
|
@@ -87,7 +87,12 @@ var EntityStore = (function () {
|
|
|
87
87
|
fieldsToDirty_1.__exists = 1;
|
|
88
88
|
Object.keys(incoming).forEach(function (storeFieldName) {
|
|
89
89
|
if (!existing || existing[storeFieldName] !== merged[storeFieldName]) {
|
|
90
|
-
fieldsToDirty_1[
|
|
90
|
+
fieldsToDirty_1[storeFieldName] = 1;
|
|
91
|
+
var fieldName = fieldNameFromStoreName(storeFieldName);
|
|
92
|
+
if (fieldName !== storeFieldName &&
|
|
93
|
+
!_this.policies.hasKeyArgs(merged.__typename, fieldName)) {
|
|
94
|
+
fieldsToDirty_1[fieldName] = 1;
|
|
95
|
+
}
|
|
91
96
|
if (merged[storeFieldName] === void 0 && !(_this instanceof Layer)) {
|
|
92
97
|
delete merged[storeFieldName];
|
|
93
98
|
}
|
|
@@ -303,6 +308,10 @@ var CacheGroup = (function () {
|
|
|
303
308
|
CacheGroup.prototype.depend = function (dataId, storeFieldName) {
|
|
304
309
|
if (this.d) {
|
|
305
310
|
this.d(makeDepKey(dataId, storeFieldName));
|
|
311
|
+
var fieldName = fieldNameFromStoreName(storeFieldName);
|
|
312
|
+
if (fieldName !== storeFieldName) {
|
|
313
|
+
this.d(makeDepKey(dataId, fieldName));
|
|
314
|
+
}
|
|
306
315
|
}
|
|
307
316
|
};
|
|
308
317
|
CacheGroup.prototype.dirty = function (dataId, storeFieldName) {
|
|
@@ -313,7 +322,7 @@ var CacheGroup = (function () {
|
|
|
313
322
|
return CacheGroup;
|
|
314
323
|
}());
|
|
315
324
|
function makeDepKey(dataId, storeFieldName) {
|
|
316
|
-
return
|
|
325
|
+
return storeFieldName + '#' + dataId;
|
|
317
326
|
}
|
|
318
327
|
(function (EntityStore) {
|
|
319
328
|
var Root = (function (_super) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entityStore.js","sourceRoot":"","sources":["../../../src/cache/inmemory/entityStore.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAgC,OAAO,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EACL,WAAW,EAIX,aAAa,EACb,UAAU,EACV,eAAe,EACf,aAAa,GACd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAY3D,IAAM,MAAM,GAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACxC,IAAM,WAAW,GAAkB,cAAM,OAAA,MAAM,EAAN,CAAM,CAAC;AAChD,IAAM,UAAU,GAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAE5C;IAGE,qBACkB,QAAkB,EAClB,KAAiB;QAFnC,iBAGI;QAFc,aAAQ,GAAR,QAAQ,CAAU;QAClB,UAAK,GAAL,KAAK,CAAY;QAJzB,SAAI,GAA0B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAuQpD,YAAO,GAEX,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QA0DhB,SAAI,GAER,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QA+BjB,kBAAa,GAAG,UACrB,iBAAsD,EACtD,cAAsB,IACnB,OAAA,eAAe,CAClB,WAAW,CAAC,iBAAiB,CAAC;YAC5B,CAAC,CAAC,KAAI,CAAC,GAAG,C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port { equal } from '@wry/equality';\n\nimport {\n isReference,\n StoreValue,\n StoreObject,\n Reference,\n makeReference,\n DeepMerger,\n maybeDeepFreeze,\n canUseWeakMap,\n} from '../../utilities';\nimport { NormalizedCache, NormalizedCacheObject } from './types';\nimport { hasOwn, fieldNameFromStoreName } from './helpers';\nimport { Policies, StorageType } from './policies';\nimport { Cache } from '../core/types/Cache';\nimport {\n SafeReadonly,\n Modifier,\n Modifiers,\n ReadFieldOptions,\n ToReferenceFunction,\n CanReadFunction,\n} from '../core/types/common';\n\nconst DELETE: any = Object.create(null);\nconst delModifier: Modifier<any> = () => DELETE;\nconst INVALIDATE: any = Object.create(null);\n\nexport abstract class EntityStore implements NormalizedCache {\n protected data: NormalizedCacheObject = Object.create(null);\n\n constructor(\n public readonly policies: Policies,\n public readonly group: CacheGroup,\n ) {}\n\n public abstract addLayer(\n layerId: string,\n replay: (layer: EntityStore) => any,\n ): Layer;\n\n public abstract removeLayer(layerId: string): EntityStore;\n\n // Although the EntityStore class is abstract, it contains concrete\n // implementations of the various NormalizedCache interface methods that\n // are inherited by the Root and Layer subclasses.\n\n public toObject(): NormalizedCacheObject {\n return { ...this.data };\n }\n\n public has(dataId: string): boolean {\n return this.lookup(dataId, true) !== void 0;\n }\n\n public get(dataId: string, fieldName: string): StoreValue {\n this.group.depend(dataId, fieldName);\n if (hasOwn.call(this.data, dataId)) {\n const storeObject = this.data[dataId];\n if (storeObject && hasOwn.call(storeObject, fieldName)) {\n return storeObject[fieldName];\n }\n }\n if (fieldName === \"__typename\" &&\n hasOwn.call(this.policies.rootTypenamesById, dataId)) {\n return this.policies.rootTypenamesById[dataId];\n }\n if (this instanceof Layer) {\n return this.parent.get(dataId, fieldName);\n }\n }\n\n protected lookup(dataId: string, dependOnExistence?: boolean): StoreObject | undefined {\n // The has method (above) calls lookup with dependOnExistence = true, so\n // that it can later be invalidated when we add or remove a StoreObject for\n // this dataId. Any consumer who cares about the contents of the StoreObject\n // should not rely on this dependency, since the contents could change\n // without the object being added or removed.\n if (dependOnExistence) this.group.depend(dataId, \"__exists\");\n\n if (hasOwn.call(this.data, dataId)) {\n return this.data[dataId];\n }\n\n if (this instanceof Layer) {\n return this.parent.lookup(dataId, dependOnExistence);\n }\n\n if (this.policies.rootTypenamesById[dataId]) {\n return Object.create(null);\n }\n }\n\n public merge(dataId: string, incoming: StoreObject): void {\n const existing = this.lookup(dataId);\n const merged: StoreObject =\n new DeepMerger(storeObjectReconciler).merge(existing, incoming);\n // Even if merged === existing, existing may have come from a lower\n // layer, so we always need to set this.data[dataId] on this level.\n this.data[dataId] = merged;\n if (merged !== existing) {\n delete this.refs[dataId];\n if (this.group.caching) {\n const fieldsToDirty: Record<string, 1> = Object.create(null);\n\n // If we added a new StoreObject where there was previously none, dirty\n // anything that depended on the existence of this dataId, such as the\n // EntityStore#has method.\n if (!existing) fieldsToDirty.__exists = 1;\n\n // Now invalidate dependents who called getFieldValue for any fields\n // that are changing as a result of this merge.\n Object.keys(incoming).forEach(storeFieldName => {\n if (!existing || existing[storeFieldName] !== merged[storeFieldName]) {\n // Always dirty the full storeFieldName, which may include\n // serialized arguments following the fieldName prefix.\n fieldsToDirty[storeFieldName] = 1;\n\n // Also dirty fieldNameFromStoreName(storeFieldName) if it's\n // different from storeFieldName and this field does not have\n // keyArgs configured, because that means the cache can't make\n // any assumptions about how field values with the same field\n // name but different arguments might be interrelated, so it\n // must err on the side of invalidating all field values that\n // share the same short fieldName, regardless of arguments.\n const fieldName = fieldNameFromStoreName(storeFieldName);\n if (fieldName !== storeFieldName &&\n !this.policies.hasKeyArgs(merged.__typename, fieldName)) {\n fieldsToDirty[fieldName] = 1;\n }\n\n // If merged[storeFieldName] has become undefined, and this is the\n // Root layer, actually delete the property from the merged object,\n // which is guaranteed to have been created fresh in this method.\n if (merged[storeFieldName] === void 0 && !(this instanceof Layer)) {\n delete merged[storeFieldName];\n }\n }\n });\n\n Object.keys(fieldsToDirty).forEach(\n fieldName => this.group.dirty(dataId, fieldName));\n }\n }\n }\n\n public modify(\n dataId: string,\n fields: Modifier<any> | Modifiers,\n ): boolean {\n const storeObject = this.lookup(dataId);\n\n if (storeObject) {\n const changedFields: Record<string, any> = Object.create(null);\n let needToMerge = false;\n let allDeleted = true;\n\n const sharedDetails = {\n DELETE,\n INVALIDATE,\n isReference,\n toReference: this.toReference,\n canRead: this.canRead,\n readField: <V = StoreValue>(\n fieldNameOrOptions: string | ReadFieldOptions,\n from?: StoreObject | Reference,\n ) => this.policies.readField<V>(\n typeof fieldNameOrOptions === \"string\" ? {\n fieldName: fieldNameOrOptions,\n from: from || makeReference(dataId),\n } : fieldNameOrOptions,\n { store: this },\n ),\n };\n\n Object.keys(storeObject).forEach(storeFieldName => {\n const fieldName = fieldNameFromStoreName(storeFieldName);\n let fieldValue = storeObject[storeFieldName];\n if (fieldValue === void 0) return;\n const modify: Modifier<StoreValue> = typeof fields === \"function\"\n ? fields\n : fields[storeFieldName] || fields[fieldName];\n if (modify) {\n let newValue = modify === delModifier ? DELETE :\n modify(maybeDeepFreeze(fieldValue), {\n ...sharedDetails,\n fieldName,\n storeFieldName,\n storage: this.getStorage(dataId, storeFieldName),\n });\n if (newValue === INVALIDATE) {\n this.group.dirty(dataId, storeFieldName);\n } else {\n if (newValue === DELETE) newValue = void 0;\n if (newValue !== fieldValue) {\n changedFields[storeFieldName] = newValue;\n needToMerge = true;\n fieldValue = newValue;\n }\n }\n }\n if (fieldValue !== void 0) {\n allDeleted = false;\n }\n });\n\n if (needToMerge) {\n this.merge(dataId, changedFields);\n\n if (allDeleted) {\n if (this instanceof Layer) {\n this.data[dataId] = void 0;\n } else {\n delete this.data[dataId];\n }\n this.group.dirty(dataId, \"__exists\");\n }\n\n return true;\n }\n }\n\n return false;\n }\n\n // If called with only one argument, removes the entire entity\n // identified by dataId. If called with a fieldName as well, removes all\n // fields of that entity whose names match fieldName according to the\n // fieldNameFromStoreName helper function. If called with a fieldName\n // and variables, removes all fields of that entity whose names match fieldName\n // and whose arguments when cached exactly match the variables passed.\n public delete(\n dataId: string,\n fieldName?: string,\n args?: Record<string, any>,\n ) {\n const storeObject = this.lookup(dataId);\n if (storeObject) {\n const typename = this.getFieldValue<string>(storeObject, \"__typename\");\n const storeFieldName = fieldName && args\n ? this.policies.getStoreFieldName({ typename, fieldName, args })\n : fieldName;\n return this.modify(dataId, storeFieldName ? {\n [storeFieldName]: delModifier,\n } : delModifier);\n }\n return false;\n }\n\n public evict(options: Cache.EvictOptions): boolean {\n let evicted = false;\n if (options.id) {\n if (hasOwn.call(this.data, options.id)) {\n evicted = this.delete(options.id, options.fieldName, options.args);\n }\n if (this instanceof Layer) {\n evicted = this.parent.evict(options) || evicted;\n }\n // Always invalidate the field to trigger rereading of watched\n // queries, even if no cache data was modified by the eviction,\n // because queries may depend on computed fields with custom read\n // functions, whose values are not stored in the EntityStore.\n if (options.fieldName || evicted) {\n this.group.dirty(options.id, options.fieldName || \"__exists\");\n }\n }\n return evicted;\n }\n\n public clear(): void {\n this.replace(null);\n }\n\n public extract(): NormalizedCacheObject {\n const obj = this.toObject();\n const extraRootIds: string[] = [];\n this.getRootIdSet().forEach(id => {\n if (!hasOwn.call(this.policies.rootTypenamesById, id)) {\n extraRootIds.push(id);\n }\n });\n if (extraRootIds.length) {\n obj.__META = { extraRootIds: extraRootIds.sort() };\n }\n return obj;\n }\n\n public replace(newData: NormalizedCacheObject | null): void {\n Object.keys(this.data).forEach(dataId => {\n if (!(newData && hasOwn.call(newData, dataId))) {\n this.delete(dataId);\n }\n });\n if (newData) {\n const { __META, ...rest } = newData;\n Object.keys(rest).forEach(dataId => {\n this.merge(dataId, rest[dataId] as StoreObject);\n });\n if (__META) {\n __META.extraRootIds.forEach(this.retain, this);\n }\n }\n }\n\n public abstract getStorage(\n idOrObj: string | StoreObject,\n ...storeFieldNames: (string | number)[]\n ): StorageType;\n\n // Maps root entity IDs to the number of times they have been retained, minus\n // the number of times they have been released. Retained entities keep other\n // entities they reference (even indirectly) from being garbage collected.\n private rootIds: {\n [rootId: string]: number;\n } = Object.create(null);\n\n public retain(rootId: string): number {\n return this.rootIds[rootId] = (this.rootIds[rootId] || 0) + 1;\n }\n\n public release(rootId: string): number {\n if (this.rootIds[rootId] > 0) {\n const count = --this.rootIds[rootId];\n if (!count) delete this.rootIds[rootId];\n return count;\n }\n return 0;\n }\n\n // Return a Set<string> of all the ID strings that have been retained by\n // this layer/root *and* any layers/roots beneath it.\n public getRootIdSet(ids = new Set<string>()) {\n Object.keys(this.rootIds).forEach(ids.add, ids);\n if (this instanceof Layer) {\n this.parent.getRootIdSet(ids);\n } else {\n // Official singleton IDs like ROOT_QUERY and ROOT_MUTATION are\n // always considered roots for garbage collection, regardless of\n // their retainment counts in this.rootIds.\n Object.keys(this.policies.rootTypenamesById).forEach(ids.add, ids);\n }\n return ids;\n }\n\n // The goal of garbage collection is to remove IDs from the Root layer of the\n // store that are no longer reachable starting from any IDs that have been\n // explicitly retained (see retain and release, above). Returns an array of\n // dataId strings that were removed from the store.\n public gc() {\n const ids = this.getRootIdSet();\n const snapshot = this.toObject();\n ids.forEach(id => {\n if (hasOwn.call(snapshot, id)) {\n // Because we are iterating over an ECMAScript Set, the IDs we add here\n // will be visited in later iterations of the forEach loop only if they\n // were not previously contained by the Set.\n Object.keys(this.findChildRefIds(id)).forEach(ids.add, ids);\n // By removing IDs from the snapshot object here, we protect them from\n // getting removed from the root store layer below.\n delete snapshot[id];\n }\n });\n const idsToRemove = Object.keys(snapshot);\n if (idsToRemove.length) {\n let root: EntityStore = this;\n while (root instanceof Layer) root = root.parent;\n idsToRemove.forEach(id => root.delete(id));\n }\n return idsToRemove;\n }\n\n // Lazily tracks { __ref: <dataId> } strings contained by this.data[dataId].\n private refs: {\n [dataId: string]: Record<string, true>;\n } = Object.create(null);\n\n public findChildRefIds(dataId: string): Record<string, true> {\n if (!hasOwn.call(this.refs, dataId)) {\n const found = this.refs[dataId] = Object.create(null);\n const workSet = new Set([this.data[dataId]]);\n // Within the store, only arrays and objects can contain child entity\n // references, so we can prune the traversal using this predicate:\n const canTraverse = (obj: any) => obj !== null && typeof obj === 'object';\n workSet.forEach(obj => {\n if (isReference(obj)) {\n found[obj.__ref] = true;\n } else if (canTraverse(obj)) {\n Object.values(obj!)\n // No need to add primitive values to the workSet, since they cannot\n // contain reference objects.\n .filter(canTraverse)\n .forEach(workSet.add, workSet);\n }\n });\n }\n return this.refs[dataId];\n }\n\n // Used to compute cache keys specific to this.group.\n public makeCacheKey(...args: any[]) {\n return this.group.keyMaker.lookupArray(args);\n }\n\n // Bound function that can be passed around to provide easy access to fields\n // of Reference objects as well as ordinary objects.\n public getFieldValue = <T = StoreValue>(\n objectOrReference: StoreObject | Reference | undefined,\n storeFieldName: string,\n ) => maybeDeepFreeze(\n isReference(objectOrReference)\n ? this.get(objectOrReference.__ref, storeFieldName)\n : objectOrReference && objectOrReference[storeFieldName]\n ) as SafeReadonly<T>;\n\n // Returns true for non-normalized StoreObjects and non-dangling\n // References, indicating that readField(name, objOrRef) has a chance of\n // working. Useful for filtering out dangling references from lists.\n public canRead: CanReadFunction = objOrRef => {\n return isReference(objOrRef)\n ? this.has(objOrRef.__ref)\n : typeof objOrRef === \"object\";\n };\n\n // Bound function that converts an id or an object with a __typename and\n // primary key fields to a Reference object. If called with a Reference object,\n // that same Reference object is returned. Pass true for mergeIntoStore to persist\n // an object into the store.\n public toReference: ToReferenceFunction = (\n objOrIdOrRef,\n mergeIntoStore,\n ) => {\n if (typeof objOrIdOrRef === \"string\") {\n return makeReference(objOrIdOrRef);\n }\n\n if (isReference(objOrIdOrRef)) {\n return objOrIdOrRef;\n }\n\n const [id] = this.policies.identify(objOrIdOrRef);\n\n if (id) {\n const ref = makeReference(id);\n if (mergeIntoStore) {\n this.merge(id, objOrIdOrRef);\n }\n return ref;\n }\n };\n}\n\nexport type FieldValueGetter = EntityStore[\"getFieldValue\"];\n\n// A single CacheGroup represents a set of one or more EntityStore objects,\n// typically the Root store in a CacheGroup by itself, and all active Layer\n// stores in a group together. A single EntityStore object belongs to only\n// one CacheGroup, store.group. The CacheGroup is responsible for tracking\n// dependencies, so store.group is helpful for generating unique keys for\n// cached results that need to be invalidated when/if those dependencies\n// change. If we used the EntityStore objects themselves as cache keys (that\n// is, store rather than store.group), the cache would become unnecessarily\n// fragmented by all the different Layer objects. Instead, the CacheGroup\n// approach allows all optimistic Layer objects in the same linked list to\n// belong to one CacheGroup, with the non-optimistic Root object belonging\n// to another CacheGroup, allowing resultCaching dependencies to be tracked\n// separately for optimistic and non-optimistic entity data.\nclass CacheGroup {\n private d: OptimisticDependencyFunction<string> | null = null;\n\n constructor(public readonly caching: boolean) {\n this.d = caching ? dep<string>() : null;\n }\n\n public depend(dataId: string, storeFieldName: string) {\n if (this.d) {\n this.d(makeDepKey(dataId, storeFieldName));\n const fieldName = fieldNameFromStoreName(storeFieldName);\n if (fieldName !== storeFieldName) {\n // Fields with arguments that contribute extra identifying\n // information to the fieldName (thus forming the storeFieldName)\n // depend not only on the full storeFieldName but also on the\n // short fieldName, so the field can be invalidated using either\n // level of specificity.\n this.d(makeDepKey(dataId, fieldName));\n }\n }\n }\n\n public dirty(dataId: string, storeFieldName: string) {\n if (this.d) {\n this.d.dirty(makeDepKey(dataId, storeFieldName));\n }\n }\n\n // Used by the EntityStore#makeCacheKey method to compute cache keys\n // specific to this CacheGroup.\n public readonly keyMaker = new KeyTrie<object>(canUseWeakMap);\n}\n\nfunction makeDepKey(dataId: string, storeFieldName: string) {\n // Since field names cannot have '#' characters in them, this method\n // of joining the field name and the ID should be unambiguous, and much\n // cheaper than JSON.stringify([dataId, fieldName]).\n return storeFieldName + '#' + dataId;\n}\n\nexport namespace EntityStore {\n // Refer to this class as EntityStore.Root outside this namespace.\n export class Root extends EntityStore {\n // Although each Root instance gets its own unique CacheGroup object,\n // any Layer instances created by calling addLayer need to share a\n // single distinct CacheGroup object. Since this shared object must\n // outlast the Layer instances themselves, it needs to be created and\n // owned by the Root instance.\n private sharedLayerGroup: CacheGroup;\n\n constructor({\n policies,\n resultCaching = true,\n seed,\n }: {\n policies: Policies;\n resultCaching?: boolean;\n seed?: NormalizedCacheObject;\n }) {\n super(policies, new CacheGroup(resultCaching));\n this.sharedLayerGroup = new CacheGroup(resultCaching);\n if (seed) this.replace(seed);\n }\n\n public addLayer(\n layerId: string,\n replay: (layer: EntityStore) => any,\n ): Layer {\n // The replay function will be called in the Layer constructor.\n return new Layer(layerId, this, replay, this.sharedLayerGroup);\n }\n\n public removeLayer(): Root {\n // Never remove the root layer.\n return this;\n }\n\n public readonly storageTrie = new KeyTrie<StorageType>(canUseWeakMap);\n public getStorage(): StorageType {\n return this.storageTrie.lookupArray(arguments);\n }\n }\n}\n\n// Not exported, since all Layer instances are created by the addLayer method\n// of the EntityStore.Root class.\nclass Layer extends EntityStore {\n constructor(\n public readonly id: string,\n public readonly parent: EntityStore,\n public readonly replay: (layer: EntityStore) => any,\n public readonly group: CacheGroup,\n ) {\n super(parent.policies, group);\n replay(this);\n }\n\n public addLayer(\n layerId: string,\n replay: (layer: EntityStore) => any,\n ): Layer {\n return new Layer(layerId, this, replay, this.group);\n }\n\n public removeLayer(layerId: string): EntityStore {\n // Remove all instances of the given id, not just the first one.\n const parent = this.parent.removeLayer(layerId);\n\n if (layerId === this.id) {\n // Dirty every ID we're removing.\n if (this.group.caching) {\n Object.keys(this.data).forEach(dataId => {\n // If this.data[dataId] contains nothing different from what\n // lies beneath, we can avoid dirtying this dataId and all of\n // its fields, and simply discard this Layer. The only reason we\n // call this.delete here is to dirty the removed fields.\n if (this.data[dataId] !== (parent as Layer).lookup(dataId)) {\n this.delete(dataId);\n }\n });\n }\n return parent;\n }\n\n // No changes are necessary if the parent chain remains identical.\n if (parent === this.parent) return this;\n\n // Recreate this layer on top of the new parent.\n return parent.addLayer(this.id, this.replay);\n }\n\n public toObject(): NormalizedCacheObject {\n return {\n ...this.parent.toObject(),\n ...this.data,\n };\n }\n\n public findChildRefIds(dataId: string): Record<string, true> {\n const fromParent = this.parent.findChildRefIds(dataId);\n return hasOwn.call(this.data, dataId) ? {\n ...fromParent,\n ...super.findChildRefIds(dataId),\n } : fromParent;\n }\n\n public getStorage(): StorageType {\n let p: EntityStore = this.parent;\n while ((p as Layer).parent) p = (p as Layer).parent;\n return p.getStorage.apply(p, arguments);\n }\n}\n\nfunction storeObjectReconciler(\n existingObject: StoreObject,\n incomingObject: StoreObject,\n property: string,\n): StoreValue {\n const existingValue = existingObject[property];\n const incomingValue = incomingObject[property];\n // Wherever there is a key collision, prefer the incoming value, unless\n // it is deeply equal to the existing value. It's worth checking deep\n // equality here (even though blindly returning incoming would be\n // logically correct) because preserving the referential identity of\n // existing data can prevent needless rereading and rerendering.\n return equal(existingValue, incomingValue) ? existingValue : incomingValue;\n}\n\nexport function supportsResultCaching(store: any): store is EntityStore {\n // When result caching is disabled, store.depend will be null.\n return !!(store instanceof EntityStore && store.group.caching);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixPolyfills.js","sourceRoot":"","sources":["../../../src/cache/inmemory/fixPolyfills.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"fixPolyfills.js","sourceRoot":"","sources":["../../../src/cache/inmemory/fixPolyfills.ts"],"names":[],"mappings":"","sourcesContent":["// Most JavaScript environments do not need the workarounds implemented in\n// fixPolyfills.native.ts, so importing fixPolyfills.ts merely imports\n// this empty module, adding nothing to bundle sizes or execution times.\n// When bundling for React Native, we substitute fixPolyfills.native.js\n// for fixPolyfills.js (see the \"react-native\" section of package.json),\n// to work around problems with Map and Set polyfills in older versions of\n// React Native (which should have been fixed in react-native@0.59.0):\n// https://github.com/apollographql/apollo-client/pull/5962\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixPolyfills.native.js","sourceRoot":"","sources":["../../../src/cache/inmemory/fixPolyfills.native.ts"],"names":[],"mappings":"AAEA,IAAM,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;AAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,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IAAI;IAOF,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;CAC5C;AAAC,WAAM;IACN,IAAM,IAAI,GAAG,UAAC,MAAwB;QACpC,OAAO,MAAM,IAAI,CAAC,UAAA,GAAG;YACnB,IAAI;gBAEF,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;aACnC;oBAAS;gBAGR,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;aACjC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IACF,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;CAC3D","sourcesContent":["// Make sure Map.prototype.set returns the Map instance, per spec.\n// https://github.com/apollographql/apollo-client/issues/4024\nconst testMap = new Map();\nif (testMap.set(1, 2) !== testMap) {\n const { set } = testMap;\n Map.prototype.set = function (...args) {\n set.apply(this, args);\n return this;\n };\n}\n\n// Make sure Set.prototype.add returns the Set instance, per spec.\nconst testSet = new Set();\nif (testSet.add(3) !== testSet) {\n const { add } = testSet;\n Set.prototype.add = function (...args) {\n add.apply(this, args);\n return this;\n };\n}\n\nconst frozen = {};\nif (typeof Object.freeze === 'function') {\n Object.freeze(frozen);\n}\n\ntry {\n // If non-extensible objects can't be stored as keys in a Map, make sure we\n // do not freeze/seal/etc. an object without first attempting to put it in a\n // Map. For example, this gives the React Native Map polyfill a chance to tag\n // objects before they become non-extensible:\n // https://github.com/facebook/react-native/blob/98a6f19d7c/Libraries/vendor/core/Map.js#L44-L50\n // https://github.com/apollographql/react-apollo/issues/2442#issuecomment-426489517\n testMap.set(frozen, frozen).delete(frozen);\n} catch {\n const wrap = (method: <T>(obj: T) => T): typeof method => {\n return method && (obj => {\n try {\n // If .set succeeds, also call .delete to avoid leaking memory.\n testMap.set(obj, obj).delete(obj);\n } finally {\n // If .set or .delete fails, the exception will be silently swallowed\n // by this return-from-finally statement:\n return method.call(Object, obj);\n }\n });\n };\n Object.freeze = wrap(Object.freeze);\n Object.seal = wrap(Object.seal);\n Object.preventExtensions = wrap(Object.preventExtensions);\n}\n\nexport {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/cache/inmemory/helpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,WAAW,EAGX,OAAO,EACP,UAAU,EACV,sBAAsB,EACtB,aAAa,GACd,MAAM,iBAAiB,CAAC;AAEzB,MAAM,CAAC,IAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AAEtD,MAAM,UAAU,0BAA0B,CACxC,KAAsB,EACtB,iBAA0C;IAE1C,OAAO,WAAW,CAAC,iBAAiB,CAAC;QACnC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,EAAE,YAAY,CAAW;QAC5D,CAAC,CAAC,iBAAiB,IAAI,iBAAiB,CAAC,UAAU,CAAC;AACxD,CAAC;AAED,MAAM,CAAC,IAAM,qBAAqB,GAAG,oBAAoB,CAAC;AAE1D,MAAM,UAAU,sBAAsB,CAAC,cAAsB;IAC3D,IAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAC1D,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,YAA8B,EAC9B,MAA2B,EAC3B,SAA+B;IAE/B,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ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C;iBAC3E;gBAMD,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;KACN;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,KAAiB;IAEjB,OAAO,KAAK,KAAK,IAAI;QACnB,OAAO,KAAK,KAAK,QAAQ;QACzB,CAAC,WAAW,CAAC,KAAK,CAAC;QACnB,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,OAAO,IAAI,UAAU,CAAC;AACxB,CAAC","sourcesContent":["import { SelectionSetNode } from 'graphql';\n\nimport { NormalizedCache } from './types';\nimport {\n Reference,\n isReference,\n StoreValue,\n StoreObject,\n isField,\n DeepMerger,\n resultKeyNameFromField,\n shouldInclude,\n} from '../../utilities';\n\nexport const hasOwn = Object.prototype.hasOwnProperty;\n\nexport function getTypenameFromStoreObject(\n store: NormalizedCache,\n objectOrReference: StoreObject | Reference,\n): string | undefined {\n return isReference(objectOrReference)\n ? store.get(objectOrReference.__ref, \"__typename\") as string\n : objectOrReference && objectOrReference.__typename;\n}\n\nexport const TypeOrFieldNameRegExp = /^[_a-z][_0-9a-z]*/i;\n\nexport function fieldNameFromStoreName(storeFieldName: string): string {\n const match = storeFieldName.match(TypeOrFieldNameRegExp);\n return match ? match[0] : storeFieldName;\n}\n\nexport function selectionSetMatchesResult(\n selectionSet: SelectionSetNode,\n result: Record<string, any>,\n variables?: Record<string, any>,\n): boolean {\n if (result && typeof result === \"object\") {\n return Array.isArray(result)\n ? result.every(item => selectionSetMatchesResult(selectionSet, item, variables))\n : selectionSet.selections.every(field => {\n if (isField(field) && shouldInclude(field, variables)) {\n const key = resultKeyNameFromField(field);\n return hasOwn.call(result, key) &&\n (!field.selectionSet ||\n selectionSetMatchesResult(field.selectionSet, result[key], variables));\n }\n // If the selection has been skipped with @skip(true) or\n // @include(false), it should not count against the matching. If\n // the selection is not a field, it must be a fragment (inline or\n // named). We will determine if selectionSetMatchesResult for that\n // fragment when we get to it, so for now we return true.\n return true;\n });\n }\n return false;\n}\n\nexport function storeValueIsStoreObject(\n value: StoreValue,\n): value is StoreObject {\n return value !== null &&\n typeof value === \"object\" &&\n !isReference(value) &&\n !Array.isArray(value);\n}\n\nexport function makeProcessedFieldsMerger() {\n return new DeepMerger;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inMemoryCache.js","sourceRoot":"","sources":["../../../src/cache/inmemory/inMemoryCache.ts"],"names":[],"mappings":";AACA,OAAO,gBAAgB,CAAC;AAGxB,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EACL,qBAAqB,EAGrB,WAAW,GACZ,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EACL,uBAAuB,EAEvB,QAAQ,GAET,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAQnC,IAAM,aAAa,GAAwB;IACzC,gBAAgB,EAAE,uBAAuB;IACzC,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,IAAI;IACnB,YAAY,EAAE,EAAE;CACjB,CAAC;AAEF;IAAmC,iCAAkC;IAmBnE,uBAAY,MAAgC;QAAhC,uBAAA,EAAA,WAAgC;QAA5C,YACE,iBAAO,SAiCR;QAhDO,aAAO,GAAG,IAAI,GAAG,EAAsB,CAAC;QAGxC,2BA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B,yBAAmC;QAA9D,iBAIC;QAHC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAAA,CAAC,IAAI,OAAA,KAAI,CAAC,mBAAmB,CAAC,CAAC,EAAE,yBAAyB,CAAC,EAAtD,CAAsD,CAAC,CAAC;SACnF;IACH,CAAC;IAqCO,sCAAc,GAAtB,UACE,CAAqB,EACrB,yBAAkC;QASlC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAQvB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAEjB,IAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAM;YAC1B,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,UAAU,EAAE,CAAC,CAAC,UAAU;SACzB,CAAC,CAAC;QAEH,IAAI,CAAC,CAAC,UAAU,IAAI,yBAAyB,EAAE;YAC7C,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC;SACvC;QAED,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IACH,oBAAC;AAAD,CAAC,AA7XD,CAAmC,WAAW,GA6X7C","sourcesContent":["// Make builtins like Map and Set safe to use with non-extensible objects.\nimport './fixPolyfills';\n\nimport { DocumentNode } from 'graphql';\nimport { dep, wrap } from 'optimism';\n\nimport { ApolloCache } from '../core/cache';\nimport { Cache } from '../core/types/Cache';\nimport { MissingFieldError } from '../core/types/common';\nimport {\n addTypenameToDocument,\n StoreObject,\n Reference,\n isReference,\n} from '../../utilities';\nimport {\n ApolloReducerConfig,\n NormalizedCacheObject,\n} from './types';\nimport { StoreReader } from './readFromStore';\nimport { StoreWriter } from './writeToStore';\nimport { EntityStore, supportsResultCaching } from './entityStore';\nimport { makeVar, forgetCache } from './reactiveVars';\nimport {\n defaultDataIdFromObject,\n PossibleTypesMap,\n Policies,\n TypePolicies,\n} from './policies';\nimport { hasOwn } from './helpers';\n\nexport interface InMemoryCacheConfig extends ApolloReducerConfig {\n resultCaching?: boolean;\n possibleTypes?: PossibleTypesMap;\n typePolicies?: TypePolicies;\n}\n\nconst defaultConfig: InMemoryCacheConfig = {\n dataIdFromObject: defaultDataIdFromObject,\n addTypename: true,\n resultCaching: true,\n typePolicies: {},\n};\n\nexport class InMemoryCache extends ApolloCache<NormalizedCacheObject> {\n private data: EntityStore;\n private optimisticData: EntityStore;\n\n protected config: InMemoryCacheConfig;\n private watches = new Set<Cache.WatchOptions>();\n private addTypename: boolean;\n\n private typenameDocumentCache = new Map<DocumentNode, DocumentNode>();\n private storeReader: StoreReader;\n private storeWriter: StoreWriter;\n\n // Dynamically imported code can augment existing typePolicies or\n // possibleTypes by calling cache.policies.addTypePolicies or\n // cache.policies.addPossibletypes.\n public readonly policies: Policies;\n\n public readonly makeVar = makeVar;\n\n constructor(config: InMemoryCacheConfig = {}) {\n super();\n this.config = { ...defaultConfig, ...config };\n this.addTypename = !!this.config.addTypename;\n\n this.policies = new Policies({\n cache: this,\n dataIdFromObject: this.config.dataIdFromObject,\n possibleTypes: this.config.possibleTypes,\n typePolicies: this.config.typePolicies,\n });\n\n // Passing { resultCaching: false } in the InMemoryCache constructor options\n // will completely disable dependency tracking, which will improve memory\n // usage but worsen the performance of repeated reads.\n this.data = new EntityStore.Root({\n policies: this.policies,\n resultCaching: this.config.resultCaching,\n });\n\n // When no optimistic writes are currently active, cache.optimisticData ===\n // cache.data, so there are no additional layers on top of the actual data.\n // When an optimistic update happens, this.optimisticData will become a\n // linked list of OptimisticCacheLayer objects that terminates with the\n // original this.data cache object.\n this.optimisticData = this.data;\n\n this.storeWriter = new StoreWriter(\n this,\n this.storeReader = new StoreReader({\n cache: this,\n addTypename: this.addTypename,\n }),\n );\n }\n\n public restore(data: NormalizedCacheObject): this {\n if (data) this.data.replace(data);\n return this;\n }\n\n public extract(optimistic: boolean = false): NormalizedCacheObject {\n return (optimistic ? this.optimisticData : this.data).extract();\n }\n\n public read<T>(options: Cache.ReadOptions): T | null {\n const {\n // Since read returns data or null, without any additional metadata\n // about whether/where there might have been missing fields, the\n // default behavior cannot be returnPartialData = true (like it is\n // for the diff method), since defaulting to true would violate the\n // integrity of the T in the return type. However, partial data may\n // be useful in some cases, so returnPartialData:true may be\n // specified explicitly.\n returnPartialData = false,\n } = options;\n try {\n return this.storeReader.diffQueryAgainstStore<T>({\n store: options.optimistic ? this.optimisticData : this.data,\n query: options.query,\n variables: options.variables,\n rootId: options.rootId,\n config: this.config,\n returnPartialData,\n }).result || null;\n } catch (e) {\n if (e instanceof MissingFieldError) {\n // Swallow MissingFieldError and return null, so callers do not\n // need to worry about catching \"normal\" exceptions resulting from\n // incomplete cache data. Unexpected errors will be re-thrown. If\n // you need more information about which fields were missing, use\n // cache.diff instead, and examine diffResult.missing.\n return null;\n }\n throw e;\n }\n }\n\n public write(options: Cache.WriteOptions): Reference | undefined {\n try {\n ++this.txCount;\n return this.storeWriter.writeToStore({\n store: this.data,\n query: options.query,\n result: options.result,\n dataId: options.dataId,\n variables: options.variables,\n });\n } finally {\n if (!--this.txCount && options.broadcast !== false) {\n this.broadcastWatches();\n }\n }\n }\n\n public modify(options: Cache.ModifyOptions): boolean {\n if (hasOwn.call(options, \"id\") && !options.id) {\n // To my knowledge, TypeScript does not currently provide a way to\n // enforce that an optional property?:type must *not* be undefined\n // when present. That ability would be useful here, because we want\n // options.id to default to ROOT_QUERY only when no options.id was\n // provided. If the caller attempts to pass options.id with a\n // falsy/undefined value (perhaps because cache.identify failed), we\n // should not assume the goal was to modify the ROOT_QUERY object.\n // We could throw, but it seems natural to return false to indicate\n // that nothing was modified.\n return false;\n }\n const store = options.optimistic // Defaults to false.\n ? this.optimisticData\n : this.data;\n try {\n ++this.txCount;\n return store.modify(options.id || \"ROOT_QUERY\", options.fields);\n } finally {\n if (!--this.txCount && options.broadcast !== false) {\n this.broadcastWatches();\n }\n }\n }\n\n public diff<T>(options: Cache.DiffOptions): Cache.DiffResult<T> {\n return this.storeReader.diffQueryAgainstStore({\n store: options.optimistic ? this.optimisticData : this.data,\n rootId: options.id || \"ROOT_QUERY\",\n query: options.query,\n variables: options.variables,\n returnPartialData: options.returnPartialData,\n config: this.config,\n });\n }\n\n public watch(watch: Cache.WatchOptions): () => void {\n this.watches.add(watch);\n if (watch.immediate) {\n this.maybeBroadcastWatch(watch);\n }\n return () => {\n // Once we remove the last watch from this.watches, cache.broadcastWatches\n // no longer does anything, so we preemptively tell the reactive variable\n // system to exclude this cache from future broadcasts.\n if (this.watches.delete(watch) && !this.watches.size) {\n forgetCache(this);\n }\n this.watchDep.dirty(watch);\n // Remove this watch from the LRU cache managed by the\n // maybeBroadcastWatch OptimisticWrapperFunction, to prevent memory\n // leaks involving the closure of watch.callback.\n this.maybeBroadcastWatch.forget(watch);\n };\n }\n\n // Request garbage collection of unreachable normalized entities.\n public gc() {\n return this.optimisticData.gc();\n }\n\n // Call this method to ensure the given root ID remains in the cache after\n // garbage collection, along with its transitive child entities. Note that\n // the cache automatically retains all directly written entities. By default,\n // the retainment persists after optimistic updates are removed. Pass true\n // for the optimistic argument if you would prefer for the retainment to be\n // discarded when the top-most optimistic layer is removed. Returns the\n // resulting (non-negative) retainment count.\n public retain(rootId: string, optimistic?: boolean): number {\n return (optimistic ? this.optimisticData : this.data).retain(rootId);\n }\n\n // Call this method to undo the effect of the retain method, above. Once the\n // retainment count falls to zero, the given ID will no longer be preserved\n // during garbage collection, though it may still be preserved by other safe\n // entities that refer to it. Returns the resulting (non-negative) retainment\n // count, in case that's useful.\n public release(rootId: string, optimistic?: boolean): number {\n return (optimistic ? this.optimisticData : this.data).release(rootId);\n }\n\n // Returns the canonical ID for a given StoreObject, obeying typePolicies\n // and keyFields (and dataIdFromObject, if you still use that). At minimum,\n // the object must contain a __typename and any primary key fields required\n // to identify entities of that type. If you pass a query result object, be\n // sure that none of the primary key fields have been renamed by aliasing.\n // If you pass a Reference object, its __ref ID string will be returned.\n public identify(object: StoreObject | Reference): string | undefined {\n return isReference(object) ? object.__ref :\n this.policies.identify(object)[0];\n }\n\n public evict(options: Cache.EvictOptions): boolean {\n if (!options.id) {\n if (hasOwn.call(options, \"id\")) {\n // See comment in modify method about why we return false when\n // options.id exists but is falsy/undefined.\n return false;\n }\n options = { ...options, id: \"ROOT_QUERY\" };\n }\n try {\n // It's unlikely that the eviction will end up invoking any other\n // cache update operations while it's running, but {in,de}crementing\n // this.txCount still seems like a good idea, for uniformity with\n // the other update methods.\n ++this.txCount;\n return this.optimisticData.evict(options);\n } finally {\n if (!--this.txCount && options.broadcast !== false) {\n this.broadcastWatches();\n }\n }\n }\n\n public reset(): Promise<void> {\n this.data.clear();\n this.optimisticData = this.data;\n this.broadcastWatches();\n return Promise.resolve();\n }\n\n public removeOptimistic(idToRemove: string) {\n const newOptimisticData = this.optimisticData.removeLayer(idToRemove);\n if (newOptimisticData !== this.optimisticData) {\n this.optimisticData = newOptimisticData;\n this.broadcastWatches();\n }\n }\n\n private txCount = 0;\n\n public performTransaction(\n transaction: (cache: InMemoryCache) => any,\n optimisticId?: string | null,\n ) {\n const perform = (layer?: EntityStore) => {\n const { data, optimisticData } = this;\n ++this.txCount;\n if (layer) {\n this.data = this.optimisticData = layer;\n }\n try {\n transaction(this);\n } finally {\n --this.txCount;\n this.data = data;\n this.optimisticData = optimisticData;\n }\n };\n\n let fromOptimisticTransaction = false;\n\n if (typeof optimisticId === 'string') {\n // Note that there can be multiple layers with the same optimisticId.\n // When removeOptimistic(id) is called for that id, all matching layers\n // will be removed, and the remaining layers will be reapplied.\n this.optimisticData = this.optimisticData.addLayer(optimisticId, perform);\n fromOptimisticTransaction = true;\n } else if (optimisticId === null) {\n // Ensure both this.data and this.optimisticData refer to the root\n // (non-optimistic) layer of the cache during the transaction. Note\n // that this.data could be a Layer if we are currently executing an\n // optimistic transaction function, but otherwise will always be an\n // EntityStore.Root instance.\n perform(this.data);\n } else {\n // Otherwise, leave this.data and this.optimisticData unchanged and\n // run the transaction with broadcast batching.\n perform();\n }\n\n // This broadcast does nothing if this.txCount > 0.\n this.broadcastWatches(fromOptimisticTransaction);\n }\n\n public transformDocument(document: DocumentNode): DocumentNode {\n if (this.addTypename) {\n let result = this.typenameDocumentCache.get(document);\n if (!result) {\n result = addTypenameToDocument(document);\n this.typenameDocumentCache.set(document, result);\n // If someone calls transformDocument and then mistakenly passes the\n // result back into an API that also calls transformDocument, make sure\n // we don't keep creating new query documents.\n this.typenameDocumentCache.set(result, result);\n }\n return result;\n }\n return document;\n }\n\n protected broadcastWatches(fromOptimisticTransaction?: boolean) {\n if (!this.txCount) {\n this.watches.forEach(c => this.maybeBroadcastWatch(c, fromOptimisticTransaction));\n }\n }\n\n private maybeBroadcastWatch = wrap((\n c: Cache.WatchOptions,\n fromOptimisticTransaction?: boolean,\n ) => {\n return this.broadcastWatch.call(this, c, !!fromOptimisticTransaction);\n }, {\n makeCacheKey: (c: Cache.WatchOptions) => {\n // Return a cache key (thus enabling result caching) only if we're\n // currently using a data store that can track cache dependencies.\n const store = c.optimistic ? this.optimisticData : this.data;\n if (supportsResultCaching(store)) {\n const { optimistic, rootId, variables } = c;\n return store.makeCacheKey(\n c.query,\n // Different watches can have the same query, optimistic\n // status, rootId, and variables, but if their callbacks are\n // different, the (identical) result needs to be delivered to\n // each distinct callback. The easiest way to achieve that\n // separation is to include c.callback in the cache key for\n // maybeBroadcastWatch calls. See issue #5733.\n c.callback,\n JSON.stringify({ optimistic, rootId, variables }),\n );\n }\n }\n });\n\n private watchDep = dep<Cache.WatchOptions>();\n\n // This method is wrapped by maybeBroadcastWatch, which is called by\n // broadcastWatches, so that we compute and broadcast results only when\n // the data that would be broadcast might have changed. It would be\n // simpler to check for changes after recomputing a result but before\n // broadcasting it, but this wrapping approach allows us to skip both\n // the recomputation and the broadcast, in most cases.\n private broadcastWatch(\n c: Cache.WatchOptions,\n fromOptimisticTransaction: boolean,\n ) {\n // First, invalidate any other maybeBroadcastWatch wrapper functions\n // currently depending on this Cache.WatchOptions object (including\n // the one currently calling broadcastWatch), so they will be included\n // in the next broadcast, even if the result they receive is the same\n // as the previous result they received. This is important because we\n // are about to deliver a different result to c.callback, so any\n // previous results should have a chance to be redelivered.\n this.watchDep.dirty(c);\n\n // Next, re-depend on this.watchDep for just this invocation of\n // maybeBroadcastWatch (this is a no-op if broadcastWatch was not\n // called by maybeBroadcastWatch). This allows only the most recent\n // maybeBroadcastWatch invocation for this watcher to remain cached,\n // enabling re-broadcast of previous results even if they have not\n // changed since they were previously delivered.\n this.watchDep(c);\n\n const diff = this.diff<any>({\n query: c.query,\n variables: c.variables,\n optimistic: c.optimistic,\n });\n\n if (c.optimistic && fromOptimisticTransaction) {\n diff.fromOptimisticTransaction = true;\n }\n\n c.callback(diff);\n }\n}\n"]}
|
|
@@ -82,6 +82,7 @@ export declare class Policies {
|
|
|
82
82
|
private getFieldPolicy;
|
|
83
83
|
private getSupertypeSet;
|
|
84
84
|
fragmentMatches(fragment: InlineFragmentNode | FragmentDefinitionNode, typename: string | undefined, result?: Record<string, any>, variables?: Record<string, any>): boolean;
|
|
85
|
+
hasKeyArgs(typename: string | undefined, fieldName: string): boolean;
|
|
85
86
|
getStoreFieldName(fieldSpec: FieldSpecifier): string;
|
|
86
87
|
readField<V = StoreValue>(options: ReadFieldOptions, context: ReadMergeModifyContext): SafeReadonly<V> | undefined;
|
|
87
88
|
getMergeFunction(parentTypename: string | undefined, fieldName: string, childTypename: string | undefined): FieldMergeFunction | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../../../src/cache/inmemory/policies.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,SAAS,EACV,MAAM,SAAS,CAAC;AAKjB,OAAO,EACL,WAAW,EAKX,UAAU,EACV,WAAW,EAEX,SAAS,EACT,WAAW,EAIZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QA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AAE,UAAU,EACpB,QAAQ,EAAE,UAAU,EACpB,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,SAAS,EACrC,OAAO,EAAE,sBAAsB,EAC/B,OAAO,CAAC,EAAE,WAAW;CAuCxB"}
|
|
@@ -252,6 +252,10 @@ var Policies = (function () {
|
|
|
252
252
|
}
|
|
253
253
|
return false;
|
|
254
254
|
};
|
|
255
|
+
Policies.prototype.hasKeyArgs = function (typename, fieldName) {
|
|
256
|
+
var policy = this.getFieldPolicy(typename, fieldName, false);
|
|
257
|
+
return !!(policy && policy.keyFn);
|
|
258
|
+
};
|
|
255
259
|
Policies.prototype.getStoreFieldName = function (fieldSpec) {
|
|
256
260
|
var typename = fieldSpec.typename, fieldName = fieldSpec.fieldName;
|
|
257
261
|
var policy = this.getFieldPolicy(typename, fieldName, false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policies.js","sourceRoot":"","sources":["../../../src/cache/inmemory/policies.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,EAEL,wBAAwB,EACxB,OAAO,EACP,qBAAqB,EACrB,qBAAqB,EAGrB,wBAAwB,EAExB,WAAW,EACX,eAAe,EACf,aAAa,EACb,OAAO,GACR,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,MAAM,EACN,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AA+F3C,SAAS,sBAAsB,CAAC,IAAoB;IAClD,OAAO,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,wBAAwB,CA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;gBACvC,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;aAC9C;iBAAM;gBACL,SAAS,CAAC,CAAC,MAAM,EAAE,oBAAkB,YAAY,iCAA8B,CAAC,CAAC;gBACjF,OAAO,GAAG,KAAK,CAAC,CAAC;aAClB;SACF;IACH,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {\n InlineFragmentNode,\n FragmentDefinitionNode,\n SelectionSetNode,\n FieldNode,\n} from 'graphql';\n\nimport { KeyTrie } from 'optimism';\nimport { invariant, InvariantError } from 'ts-invariant';\n\nimport {\n FragmentMap,\n getFragmentFromSelection,\n isField,\n getTypenameFromResult,\n storeKeyNameFromField,\n StoreValue,\n StoreObject,\n argumentsObjectFromField,\n Reference,\n isReference,\n getStoreKeyName,\n canUseWeakMap,\n compact,\n} from '../../utilities';\nimport { IdGetter, ReadMergeModifyContext, MergeInfo } from \"./types\";\nimport {\n hasOwn,\n fieldNameFromStoreName,\n storeValueIsStoreObject,\n selectionSetMatchesResult,\n TypeOrFieldNameRegExp,\n} from './helpers';\nimport { cacheSlot } from './reactiveVars';\nimport { InMemoryCache } from './inMemoryCache';\nimport {\n SafeReadonly,\n FieldSpecifier,\n ToReferenceFunction,\n ReadFieldFunction,\n ReadFieldOptions,\n CanReadFunction,\n} from '../core/types/common';\nimport { FieldValueGetter } from './entityStore';\n\nexport type TypePolicies = {\n [__typename: string]: TypePolicy;\n}\n\n// TypeScript 3.7 will allow recursive type aliases, so this should work:\n// type KeySpecifier = (string | KeySpecifier)[]\ntype KeySpecifier = (string | any[])[];\n\ntype KeyFieldsContext = {\n typename?: string;\n selectionSet?: SelectionSetNode;\n fragmentMap?: FragmentMap;\n // May be set by the KeyFieldsFunction to report fields that were involved\n // in computing the ID. Never passed in by the caller.\n keyObject?: Record<string, any>;\n};\n\nexport type KeyFieldsFunction = (\n object: Readonly<StoreObject>,\n context: KeyFieldsContext,\n) => KeySpecifier | ReturnType<IdGetter>;\n\n// TODO Should TypePolicy be a generic type, with a TObject or TEntity\n// type parameter?\nexport type TypePolicy = {\n // Allows defining the primary key fields for this type, either using an\n // array of field names or a function that returns an arbitrary string.\n keyFields?: KeySpecifier | KeyFieldsFunction | false;\n\n // Allows defining a merge function (or merge:true/false shorthand) to\n // be used for merging objects of this type wherever they appear, unless\n // the parent field also defines a merge function/boolean (that is,\n // parent field merge functions take precedence over type policy merge\n // functions). In many cases, defining merge:true for a given type\n // policy can save you from specifying merge:true for all the field\n // policies where that type might be encountered.\n merge?: FieldMergeFunction | boolean;\n\n // In the rare event that your schema happens to use a different\n // __typename for the root Query, Mutation, and/or Schema types, you can\n // express your deviant preferences by enabling one of these options.\n queryType?: true,\n mutationType?: true,\n subscriptionType?: true,\n\n fields?: {\n [fieldName: string]:\n | FieldPolicy<any>\n | FieldReadFunction<any>;\n }\n};\n\nexport type KeyArgsFunction = (\n args: Record<string, any> | null,\n context: {\n typename: string;\n fieldName: string;\n field: FieldNode | null;\n variables?: Record<string, any>;\n },\n) => KeySpecifier | ReturnType<IdGetter>;\n\nexport type FieldPolicy<\n // The internal representation used to store the field's data in the\n // cache. Must be JSON-serializable if you plan to serialize the result\n // of cache.extract() using JSON.\n TExisting = any,\n // The type of the incoming parameter passed to the merge function,\n // typically matching the GraphQL response format, but with Reference\n // objects substituted for any identifiable child objects. Often the\n // same as TExisting, but not necessarily.\n TIncoming = TExisting,\n // The type that the read function actually returns, using TExisting\n // data and options.args as input. Usually the same as TIncoming.\n TReadResult = TIncoming,\n> = {\n keyArgs?: KeySpecifier | KeyArgsFunction | false;\n read?: FieldReadFunction<TExisting, TReadResult>;\n merge?: FieldMergeFunction<TExisting, TIncoming> | boolean;\n};\n\nexport type StorageType = Record<string, any>;\n\nfunction argsFromFieldSpecifier(spec: FieldSpecifier) {\n return spec.args !== void 0 ? spec.args :\n spec.field ? argumentsObjectFromField(spec.field, spec.variables) : null;\n}\n\nexport interface FieldFunctionOptions<\n TArgs = Record<string, any>,\n TVars = Record<string, any>,\n> {\n args: TArgs | null;\n\n // The name of the field, equal to options.field.name.value when\n // options.field is available. Useful if you reuse the same function for\n // multiple fields, and you need to know which field you're currently\n // processing. Always a string, even when options.field is null.\n fieldName: string;\n\n // The full field key used internally, including serialized key arguments.\n storeFieldName: string;\n\n // The FieldNode object used to read this field. Useful if you need to\n // know about other attributes of the field, such as its directives. This\n // option will be null when a string was passed to options.readField.\n field: FieldNode | null;\n\n variables?: TVars;\n\n // Utilities for dealing with { __ref } objects.\n isReference: typeof isReference;\n toReference: ToReferenceFunction;\n\n // A handy place to put field-specific data that you want to survive\n // across multiple read function calls. Useful for field-level caching,\n // if your read function does any expensive work.\n storage: StorageType;\n\n cache: InMemoryCache;\n\n // Helper function for reading other fields within the current object.\n // If a foreign object or reference is provided, the field will be read\n // from that object instead of the current object, so this function can\n // be used (together with isReference) to examine the cache outside the\n // current object. If a FieldNode is passed instead of a string, and\n // that FieldNode has arguments, the same options.variables will be used\n // to compute the argument values. Note that this function will invoke\n // custom read functions for other fields, if defined. Always returns\n // immutable data (enforced with Object.freeze in development).\n readField: ReadFieldFunction;\n\n // Returns true for non-normalized StoreObjects and non-dangling\n // References, indicating that readField(name, objOrRef) has a chance of\n // working. Useful for filtering out dangling references from lists.\n canRead: CanReadFunction;\n\n // Instead of just merging objects with { ...existing, ...incoming }, this\n // helper function can be used to merge objects in a way that respects any\n // custom merge functions defined for their fields.\n mergeObjects: MergeObjectsFunction;\n}\n\ntype MergeObjectsFunction = <T extends StoreObject | Reference>(\n existing: T,\n incoming: T,\n) => T;\n\nexport type FieldReadFunction<TExisting = any, TReadResult = TExisting> = (\n // When reading a field, one often needs to know about any existing\n // value stored for that field. If the field is read before any value\n // has been written to the cache, this existing parameter will be\n // undefined, which makes it easy to use a default parameter expression\n // to supply the initial value. This parameter is positional (rather\n // than one of the named options) because that makes it possible for the\n // developer to annotate it with a type, without also having to provide\n // a whole new type for the options object.\n existing: SafeReadonly<TExisting> | undefined,\n options: FieldFunctionOptions,\n) => TReadResult | undefined;\n\nexport type FieldMergeFunction<TExisting = any, TIncoming = TExisting> = (\n existing: SafeReadonly<TExisting> | undefined,\n // The incoming parameter needs to be positional as well, for the same\n // reasons discussed in FieldReadFunction above.\n incoming: SafeReadonly<TIncoming>,\n options: FieldFunctionOptions,\n) => SafeReadonly<TExisting>;\n\nexport const defaultDataIdFromObject = (\n { __typename, id, _id }: Readonly<StoreObject>,\n context?: KeyFieldsContext,\n) => {\n if (typeof __typename === \"string\") {\n if (context) {\n context.keyObject =\n id !== void 0 ? { id } :\n _id !== void 0 ? { _id } :\n void 0;\n }\n // If there is no object.id, fall back to object._id.\n if (id === void 0) id = _id;\n if (id !== void 0) {\n return `${__typename}:${(\n typeof id === \"number\" ||\n typeof id === \"string\"\n ) ? id : JSON.stringify(id)}`;\n }\n }\n};\n\nconst nullKeyFieldsFn: KeyFieldsFunction = () => void 0;\nconst simpleKeyArgsFn: KeyArgsFunction = (_args, context) => context.fieldName;\n\n// These merge functions can be selected by specifying merge:true or\n// merge:false in a field policy.\nconst mergeTrueFn: FieldMergeFunction<any> =\n (existing, incoming, { mergeObjects }) => mergeObjects(existing, incoming);\nconst mergeFalseFn: FieldMergeFunction<any> = (_, incoming) => incoming;\n\nexport type PossibleTypesMap = {\n [supertype: string]: string[];\n};\n\nexport class Policies {\n private typePolicies: {\n [__typename: string]: {\n keyFn?: KeyFieldsFunction;\n merge?: FieldMergeFunction<any>;\n fields: {\n [fieldName: string]: {\n keyFn?: KeyArgsFunction;\n read?: FieldReadFunction<any>;\n merge?: FieldMergeFunction<any>;\n };\n };\n };\n } = Object.create(null);\n\n private toBeAdded: {\n [__typename: string]: TypePolicy[];\n } = Object.create(null);\n\n // Map from subtype names to sets of supertype names. Note that this\n // representation inverts the structure of possibleTypes (whose keys are\n // supertypes and whose values are arrays of subtypes) because it tends\n // to be much more efficient to search upwards than downwards.\n private supertypeMap = new Map<string, Set<string>>();\n\n // Any fuzzy subtypes specified by possibleTypes will be converted to\n // RegExp objects and recorded here. Every key of this map can also be\n // found in supertypeMap. In many cases this Map will be empty, which\n // means no fuzzy subtype checking will happen in fragmentMatches.\n private fuzzySubtypes = new Map<string, RegExp>();\n\n public readonly cache: InMemoryCache;\n\n public readonly rootIdsByTypename: Record<string, string> = Object.create(null);\n public readonly rootTypenamesById: Record<string, string> = Object.create(null);\n\n public readonly usingPossibleTypes = false;\n\n constructor(private config: {\n cache: InMemoryCache;\n dataIdFromObject?: KeyFieldsFunction;\n possibleTypes?: PossibleTypesMap;\n typePolicies?: TypePolicies;\n }) {\n this.config = {\n dataIdFromObject: defaultDataIdFromObject,\n ...config,\n };\n\n this.cache = this.config.cache;\n\n this.setRootTypename(\"Query\");\n this.setRootTypename(\"Mutation\");\n this.setRootTypename(\"Subscription\");\n\n if (config.possibleTypes) {\n this.addPossibleTypes(config.possibleTypes);\n }\n\n if (config.typePolicies) {\n this.addTypePolicies(config.typePolicies);\n }\n }\n\n public identify(\n object: StoreObject,\n selectionSet?: SelectionSetNode,\n fragmentMap?: FragmentMap,\n ): [string?, StoreObject?] {\n // TODO Use an AliasMap here?\n const typename = selectionSet && fragmentMap\n ? getTypenameFromResult(object, selectionSet, fragmentMap)\n : object.__typename;\n\n // It should be possible to write root Query fields with\n // writeFragment, using { __typename: \"Query\", ... } as the data, but\n // it does not make sense to allow the same identification behavior\n // for the Mutation and Subscription types, since application code\n // should never be writing directly to (or reading directly from)\n // those root objects.\n if (typename === this.rootTypenamesById.ROOT_QUERY) {\n return [\"ROOT_QUERY\"];\n }\n\n const context: KeyFieldsContext = {\n typename,\n selectionSet,\n fragmentMap,\n };\n\n let id: string | undefined;\n\n const policy = typename && this.getTypePolicy(typename);\n let keyFn = policy && policy.keyFn || this.config.dataIdFromObject;\n while (keyFn) {\n const specifierOrId = keyFn(object, context);\n if (Array.isArray(specifierOrId)) {\n keyFn = keyFieldsFnFromSpecifier(specifierOrId);\n } else {\n id = specifierOrId;\n break;\n }\n }\n\n id = id && String(id);\n\n return context.keyObject ? [id, context.keyObject] : [id];\n }\n\n public addTypePolicies(typePolicies: TypePolicies) {\n Object.keys(typePolicies).forEach(typename => {\n const incoming = typePolicies[typename];\n if (hasOwn.call(this.toBeAdded, typename)) {\n this.toBeAdded[typename].push(incoming);\n } else {\n this.toBeAdded[typename] = [incoming];\n }\n });\n }\n\n private updateTypePolicy(typename: string, incoming: TypePolicy) {\n const existing = this.getTypePolicy(typename);\n const { keyFields, fields } = incoming;\n\n function setMerge(\n existing: { merge?: FieldMergeFunction | boolean; },\n merge?: FieldMergeFunction | boolean,\n ) {\n existing.merge =\n typeof merge === \"function\" ? merge :\n // Pass merge:true as a shorthand for a merge implementation\n // that returns options.mergeObjects(existing, incoming).\n merge === true ? mergeTrueFn :\n // Pass merge:false to make incoming always replace existing\n // without any warnings about data clobbering.\n merge === false ? mergeFalseFn :\n existing.merge;\n }\n\n // Type policies can define merge functions, as an alternative to\n // using field policies to merge child objects.\n setMerge(existing, incoming.merge);\n\n if (incoming.queryType) this.setRootTypename(\"Query\", typename);\n if (incoming.mutationType) this.setRootTypename(\"Mutation\", typename);\n if (incoming.subscriptionType) this.setRootTypename(\"Subscription\", typename);\n\n existing.keyFn =\n // Pass false to disable normalization for this typename.\n keyFields === false ? nullKeyFieldsFn :\n // Pass an array of strings to use those fields to compute a\n // composite ID for objects of this typename.\n Array.isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields) :\n // Pass a function to take full control over identification.\n typeof keyFields === \"function\" ? keyFields :\n // Leave existing.keyFn unchanged if above cases fail.\n existing.keyFn;\n\n if (fields) {\n Object.keys(fields).forEach(fieldName => {\n const existing = this.getFieldPolicy(typename, fieldName, true)!;\n const incoming = fields[fieldName];\n\n if (typeof incoming === \"function\") {\n existing.read = incoming;\n } else {\n const { keyArgs, read, merge } = incoming;\n\n existing.keyFn =\n // Pass false to disable argument-based differentiation of\n // field identities.\n keyArgs === false ? simpleKeyArgsFn :\n // Pass an array of strings to use named arguments to\n // compute a composite identity for the field.\n Array.isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs) :\n // Pass a function to take full control over field identity.\n typeof keyArgs === \"function\" ? keyArgs :\n // Leave existing.keyFn unchanged if above cases fail.\n existing.keyFn;\n\n if (typeof read === \"function\") {\n existing.read = read;\n }\n\n setMerge(existing, merge);\n }\n\n if (existing.read && existing.merge) {\n // If we have both a read and a merge function, assume\n // keyArgs:false, because read and merge together can take\n // responsibility for interpreting arguments in and out. This\n // default assumption can always be overridden by specifying\n // keyArgs explicitly in the FieldPolicy.\n existing.keyFn = existing.keyFn || simpleKeyArgsFn;\n }\n });\n }\n }\n\n private setRootTypename(\n which: \"Query\" | \"Mutation\" | \"Subscription\",\n typename: string = which,\n ) {\n const rootId = \"ROOT_\" + which.toUpperCase();\n const old = this.rootTypenamesById[rootId];\n if (typename !== old) {\n invariant(!old || old === which, `Cannot change root ${which} __typename more than once`);\n // First, delete any old __typename associated with this rootId from\n // rootIdsByTypename.\n if (old) delete this.rootIdsByTypename[old];\n // Now make this the only __typename that maps to this rootId.\n this.rootIdsByTypename[typename] = rootId;\n // Finally, update the __typename associated with this rootId.\n this.rootTypenamesById[rootId] = typename;\n }\n }\n\n public addPossibleTypes(possibleTypes: PossibleTypesMap) {\n (this.usingPossibleTypes as boolean) = true;\n Object.keys(possibleTypes).forEach(supertype => {\n // Make sure all types have an entry in this.supertypeMap, even if\n // their supertype set is empty, so we can return false immediately\n // from policies.fragmentMatches for unknown supertypes.\n this.getSupertypeSet(supertype, true);\n\n possibleTypes[supertype].forEach(subtype => {\n this.getSupertypeSet(subtype, true)!.add(supertype);\n const match = subtype.match(TypeOrFieldNameRegExp);\n if (!match || match[0] !== subtype) {\n // TODO Don't interpret just any invalid typename as a RegExp.\n this.fuzzySubtypes.set(subtype, new RegExp(subtype));\n }\n });\n });\n }\n\n private getTypePolicy(typename: string): Policies[\"typePolicies\"][string] {\n if (!hasOwn.call(this.typePolicies, typename)) {\n const policy: Policies[\"typePolicies\"][string] =\n this.typePolicies[typename] = Object.create(null);\n policy.fields = Object.create(null);\n\n // When the TypePolicy for typename is first accessed, instead of\n // starting with an empty policy object, inherit any properties or\n // fields from the type policies of the supertypes of typename.\n //\n // Any properties or fields defined explicitly within the TypePolicy\n // for typename will take precedence, and if there are multiple\n // supertypes, the properties of policies whose types were added\n // later via addPossibleTypes will take precedence over those of\n // earlier supertypes. TODO Perhaps we should warn about these\n // conflicts in development, and recommend defining the property\n // explicitly in the subtype policy?\n //\n // Field policy inheritance is atomic/shallow: you can't inherit a\n // field policy and then override just its read function, since read\n // and merge functions often need to cooperate, so changing only one\n // of them would be a recipe for inconsistency.\n //\n // Once the TypePolicy for typename has been accessed, its\n // properties can still be updated directly using addTypePolicies,\n // but future changes to supertype policies will not be reflected in\n // this policy, because this code runs at most once per typename.\n const supertypes = this.supertypeMap.get(typename);\n if (supertypes && supertypes.size) {\n supertypes.forEach(supertype => {\n const { fields, ...rest } = this.getTypePolicy(supertype);\n Object.assign(policy, rest);\n Object.assign(policy.fields, fields);\n });\n }\n }\n\n const inbox = this.toBeAdded[typename];\n if (inbox && inbox.length) {\n this.updateTypePolicy(typename, compact(...inbox.splice(0)));\n }\n\n return this.typePolicies[typename];\n }\n\n private getFieldPolicy(\n typename: string | undefined,\n fieldName: string,\n createIfMissing: boolean,\n ): {\n keyFn?: KeyArgsFunction;\n read?: FieldReadFunction<any>;\n merge?: FieldMergeFunction<any>;\n } | undefined {\n if (typename) {\n const fieldPolicies = this.getTypePolicy(typename).fields;\n return fieldPolicies[fieldName] || (\n createIfMissing && (fieldPolicies[fieldName] = Object.create(null)));\n }\n }\n\n private getSupertypeSet(\n subtype: string,\n createIfMissing: boolean,\n ): Set<string> | undefined {\n let supertypeSet = this.supertypeMap.get(subtype);\n if (!supertypeSet && createIfMissing) {\n this.supertypeMap.set(subtype, supertypeSet = new Set<string>());\n }\n return supertypeSet;\n }\n\n public fragmentMatches(\n fragment: InlineFragmentNode | FragmentDefinitionNode,\n typename: string | undefined,\n result?: Record<string, any>,\n variables?: Record<string, any>,\n ): boolean {\n if (!fragment.typeCondition) return true;\n\n // If the fragment has a type condition but the object we're matching\n // against does not have a __typename, the fragment cannot match.\n if (!typename) return false;\n\n const supertype = fragment.typeCondition.name.value;\n // Common case: fragment type condition and __typename are the same.\n if (typename === supertype) return true;\n\n if (this.usingPossibleTypes &&\n this.supertypeMap.has(supertype)) {\n const typenameSupertypeSet = this.getSupertypeSet(typename, true)!;\n const workQueue = [typenameSupertypeSet];\n const maybeEnqueue = (subtype: string) => {\n const supertypeSet = this.getSupertypeSet(subtype, false);\n if (supertypeSet &&\n supertypeSet.size &&\n workQueue.indexOf(supertypeSet) < 0) {\n workQueue.push(supertypeSet);\n }\n };\n\n // We need to check fuzzy subtypes only if we encountered fuzzy\n // subtype strings in addPossibleTypes, and only while writing to\n // the cache, since that's when selectionSetMatchesResult gives a\n // strong signal of fragment matching. The StoreReader class calls\n // policies.fragmentMatches without passing a result object, so\n // needToCheckFuzzySubtypes is always false while reading.\n let needToCheckFuzzySubtypes = !!(result && this.fuzzySubtypes.size);\n let checkingFuzzySubtypes = false;\n\n // It's important to keep evaluating workQueue.length each time through\n // the loop, because the queue can grow while we're iterating over it.\n for (let i = 0; i < workQueue.length; ++i) {\n const supertypeSet = workQueue[i];\n\n if (supertypeSet.has(supertype)) {\n if (!typenameSupertypeSet.has(supertype)) {\n if (checkingFuzzySubtypes) {\n invariant.warn(`Inferring subtype ${typename} of supertype ${supertype}`);\n }\n // Record positive results for faster future lookup.\n // Unfortunately, we cannot safely cache negative results,\n // because new possibleTypes data could always be added to the\n // Policies class.\n typenameSupertypeSet.add(supertype);\n }\n return true;\n }\n\n supertypeSet.forEach(maybeEnqueue);\n\n if (needToCheckFuzzySubtypes &&\n // Start checking fuzzy subtypes only after exhausting all\n // non-fuzzy subtypes (after the final iteration of the loop).\n i === workQueue.length - 1 &&\n // We could wait to compare fragment.selectionSet to result\n // after we verify the supertype, but this check is often less\n // expensive than that search, and we will have to do the\n // comparison anyway whenever we find a potential match.\n selectionSetMatchesResult(fragment.selectionSet, result!, variables)) {\n // We don't always need to check fuzzy subtypes (if no result\n // was provided, or !this.fuzzySubtypes.size), but, when we do,\n // we only want to check them once.\n needToCheckFuzzySubtypes = false;\n checkingFuzzySubtypes = true;\n\n // If we find any fuzzy subtypes that match typename, extend the\n // workQueue to search through the supertypes of those fuzzy\n // subtypes. Otherwise the for-loop will terminate and we'll\n // return false below.\n this.fuzzySubtypes.forEach((regExp, fuzzyString) => {\n const match = typename.match(regExp);\n if (match && match[0] === typename) {\n maybeEnqueue(fuzzyString);\n }\n });\n }\n }\n }\n\n return false;\n }\n\n public hasKeyArgs(typename: string | undefined, fieldName: string) {\n const policy = this.getFieldPolicy(typename, fieldName, false);\n return !!(policy && policy.keyFn);\n }\n\n public getStoreFieldName(fieldSpec: FieldSpecifier): string {\n const { typename, fieldName } = fieldSpec;\n const policy = this.getFieldPolicy(typename, fieldName, false);\n let storeFieldName: string | undefined;\n\n let keyFn = policy && policy.keyFn;\n if (keyFn && typename) {\n const context: Parameters<KeyArgsFunction>[1] = {\n typename,\n fieldName,\n field: fieldSpec.field || null,\n variables: fieldSpec.variables,\n };\n const args = argsFromFieldSpecifier(fieldSpec);\n while (keyFn) {\n const specifierOrString = keyFn(args, context);\n if (Array.isArray(specifierOrString)) {\n keyFn = keyArgsFnFromSpecifier(specifierOrString);\n } else {\n // If the custom keyFn returns a falsy value, fall back to\n // fieldName instead.\n storeFieldName = specifierOrString || fieldName;\n break;\n }\n }\n }\n\n if (storeFieldName === void 0) {\n storeFieldName = fieldSpec.field\n ? storeKeyNameFromField(fieldSpec.field, fieldSpec.variables)\n : getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec));\n }\n\n // Make sure custom field names start with the actual field.name.value\n // of the field, so we can always figure out which properties of a\n // StoreObject correspond to which original field names.\n return fieldName === fieldNameFromStoreName(storeFieldName)\n ? storeFieldName\n : fieldName + \":\" + storeFieldName;\n }\n\n public readField<V = StoreValue>(\n options: ReadFieldOptions,\n context: ReadMergeModifyContext,\n ): SafeReadonly<V> | undefined {\n const objectOrReference = options.from;\n if (!objectOrReference) return;\n\n const nameOrField = options.field || options.fieldName;\n if (!nameOrField) return;\n\n if (options.typename === void 0) {\n const typename = context.store.getFieldValue<string>(objectOrReference, \"__typename\");\n if (typename) options.typename = typename;\n }\n\n const storeFieldName = this.getStoreFieldName(options);\n const fieldName = fieldNameFromStoreName(storeFieldName);\n const existing = context.store.getFieldValue<V>(objectOrReference, storeFieldName);\n const policy = this.getFieldPolicy(options.typename, fieldName, false);\n const read = policy && policy.read;\n\n if (read) {\n const readOptions = makeFieldFunctionOptions(\n this,\n objectOrReference,\n options,\n context,\n context.store.getStorage(\n isReference(objectOrReference)\n ? objectOrReference.__ref\n : objectOrReference,\n storeFieldName,\n ),\n );\n\n // Call read(existing, readOptions) with cacheSlot holding this.cache.\n return cacheSlot.withValue(\n this.cache,\n read,\n [existing, readOptions],\n ) as SafeReadonly<V>;\n }\n\n return existing;\n }\n\n public getMergeFunction(\n parentTypename: string | undefined,\n fieldName: string,\n childTypename: string | undefined,\n ): FieldMergeFunction | undefined {\n let policy:\n | Policies[\"typePolicies\"][string]\n | Policies[\"typePolicies\"][string][\"fields\"][string]\n | undefined =\n this.getFieldPolicy(parentTypename, fieldName, false);\n let merge = policy && policy.merge;\n if (!merge && childTypename) {\n policy = this.getTypePolicy(childTypename);\n merge = policy && policy.merge;\n }\n return merge;\n }\n\n public runMergeFunction(\n existing: StoreValue,\n incoming: StoreValue,\n { field, typename, merge }: MergeInfo,\n context: ReadMergeModifyContext,\n storage?: StorageType,\n ) {\n if (merge === mergeTrueFn) {\n // Instead of going to the trouble of creating a full\n // FieldFunctionOptions object and calling mergeTrueFn, we can\n // simply call mergeObjects, as mergeTrueFn would.\n return makeMergeObjectsFunction(\n context.store.getFieldValue\n )(existing as StoreObject,\n incoming as StoreObject);\n }\n\n if (merge === mergeFalseFn) {\n // Likewise for mergeFalseFn, whose implementation is even simpler.\n return incoming;\n }\n\n return merge(existing, incoming, makeFieldFunctionOptions(\n this,\n // Unlike options.readField for read functions, we do not fall\n // back to the current object if no foreignObjOrRef is provided,\n // because it's not clear what the current object should be for\n // merge functions: the (possibly undefined) existing object, or\n // the incoming object? If you think your merge function needs\n // to read sibling fields in order to produce a new value for\n // the current field, you might want to rethink your strategy,\n // because that's a recipe for making merge behavior sensitive\n // to the order in which fields are written into the cache.\n // However, readField(name, ref) is useful for merge functions\n // that need to deduplicate child objects and references.\n void 0,\n { typename,\n fieldName: field.name.value,\n field,\n variables: context.variables },\n context,\n storage || Object.create(null),\n ));\n }\n}\n\nfunction makeFieldFunctionOptions(\n policies: Policies,\n objectOrReference: StoreObject | Reference | undefined,\n fieldSpec: FieldSpecifier,\n context: ReadMergeModifyContext,\n storage: StorageType,\n): FieldFunctionOptions {\n const storeFieldName = policies.getStoreFieldName(fieldSpec);\n const fieldName = fieldNameFromStoreName(storeFieldName);\n const variables = fieldSpec.variables || context.variables;\n const { getFieldValue, toReference, canRead } = context.store;\n\n return {\n args: argsFromFieldSpecifier(fieldSpec),\n field: fieldSpec.field || null,\n fieldName,\n storeFieldName,\n variables,\n isReference,\n toReference,\n storage,\n cache: policies.cache,\n canRead,\n\n readField<T>(\n fieldNameOrOptions: string | ReadFieldOptions,\n from?: StoreObject | Reference,\n ) {\n const options: ReadFieldOptions =\n typeof fieldNameOrOptions === \"string\" ? {\n fieldName: fieldNameOrOptions,\n from,\n } : { ...fieldNameOrOptions };\n\n if (void 0 === options.from) {\n options.from = objectOrReference;\n }\n\n if (void 0 === options.variables) {\n options.variables = variables;\n }\n\n return policies.readField<T>(options, context);\n },\n\n mergeObjects: makeMergeObjectsFunction(getFieldValue),\n };\n}\n\nfunction makeMergeObjectsFunction(\n getFieldValue: FieldValueGetter,\n): MergeObjectsFunction {\n return function mergeObjects(existing, incoming) {\n if (Array.isArray(existing) || Array.isArray(incoming)) {\n throw new InvariantError(\"Cannot automatically merge arrays\");\n }\n\n // These dynamic checks are necessary because the parameters of a\n // custom merge function can easily have the any type, so the type\n // system cannot always enforce the StoreObject | Reference parameter\n // types of options.mergeObjects.\n if (existing && typeof existing === \"object\" &&\n incoming && typeof incoming === \"object\") {\n const eType = getFieldValue(existing, \"__typename\");\n const iType = getFieldValue(incoming, \"__typename\");\n const typesDiffer = eType && iType && eType !== iType;\n\n if (typesDiffer ||\n !storeValueIsStoreObject(existing) ||\n !storeValueIsStoreObject(incoming)) {\n return incoming;\n }\n\n return { ...existing, ...incoming };\n }\n\n return incoming;\n };\n}\n\nfunction keyArgsFnFromSpecifier(\n specifier: KeySpecifier,\n): KeyArgsFunction {\n return (args, context) => {\n return args ? `${context.fieldName}:${\n JSON.stringify(computeKeyObject(args, specifier, false))\n }` : context.fieldName;\n };\n}\n\nfunction keyFieldsFnFromSpecifier(\n specifier: KeySpecifier,\n): KeyFieldsFunction {\n const trie = new KeyTrie<{\n aliasMap?: AliasMap;\n }>(canUseWeakMap);\n\n return (object, context) => {\n let aliasMap: AliasMap | undefined;\n if (context.selectionSet && context.fragmentMap) {\n const info = trie.lookupArray([\n context.selectionSet,\n context.fragmentMap,\n ]);\n aliasMap = info.aliasMap || (\n info.aliasMap = makeAliasMap(context.selectionSet, context.fragmentMap)\n );\n }\n\n const keyObject = context.keyObject =\n computeKeyObject(object, specifier, true, aliasMap);\n\n return `${context.typename}:${JSON.stringify(keyObject)}`;\n };\n}\n\ntype AliasMap = {\n // Map from store key to corresponding response key. Undefined when there are\n // no aliased fields in this selection set.\n aliases?: Record<string, string>;\n // Map from store key to AliasMap correponding to a child selection set.\n // Undefined when there are no child selection sets.\n subsets?: Record<string, AliasMap>;\n};\n\nfunction makeAliasMap(\n selectionSet: SelectionSetNode,\n fragmentMap: FragmentMap,\n): AliasMap {\n let map: AliasMap = Object.create(null);\n // TODO Cache this work, perhaps by storing selectionSet._aliasMap?\n const workQueue = new Set([selectionSet]);\n workQueue.forEach(selectionSet => {\n selectionSet.selections.forEach(selection => {\n if (isField(selection)) {\n if (selection.alias) {\n const responseKey = selection.alias.value;\n const storeKey = selection.name.value;\n if (storeKey !== responseKey) {\n const aliases = map.aliases || (map.aliases = Object.create(null));\n aliases[storeKey] = responseKey;\n }\n }\n if (selection.selectionSet) {\n const subsets = map.subsets || (map.subsets = Object.create(null));\n subsets[selection.name.value] =\n makeAliasMap(selection.selectionSet, fragmentMap);\n }\n } else {\n const fragment = getFragmentFromSelection(selection, fragmentMap);\n if (fragment) {\n workQueue.add(fragment.selectionSet);\n }\n }\n });\n });\n return map;\n}\n\nfunction computeKeyObject(\n response: Record<string, any>,\n specifier: KeySpecifier,\n strict: boolean,\n aliasMap?: AliasMap,\n): Record<string, any> {\n // The order of adding properties to keyObj affects its JSON serialization,\n // so we are careful to build keyObj in the order of keys given in\n // specifier.\n const keyObj = Object.create(null);\n let prevKey: string | undefined;\n specifier.forEach(s => {\n if (Array.isArray(s)) {\n if (typeof prevKey === \"string\") {\n const subsets = aliasMap && aliasMap.subsets;\n const subset = subsets && subsets[prevKey];\n keyObj[prevKey] = computeKeyObject(response[prevKey], s, strict, subset);\n }\n } else {\n const aliases = aliasMap && aliasMap.aliases;\n const responseName = aliases && aliases[s] || s;\n if (hasOwn.call(response, responseName)) {\n keyObj[prevKey = s] = response[responseName];\n } else {\n invariant(!strict, `Missing field '${responseName}' while computing key fields`);\n prevKey = void 0;\n }\n }\n });\n return keyObj;\n}\n"]}
|