@apollo/client 3.8.7 → 3.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.changeset/README.md +8 -0
- package/.changeset/config.json +14 -0
- package/CHANGELOG.md +3357 -0
- package/apollo-client.cjs +314 -316
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +133 -152
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +133 -152
- package/cache/core/cache.d.ts +10 -0
- package/cache/core/cache.js +17 -5
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +1 -1
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +92 -0
- package/cache/core/types/common.js +4 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +1 -1
- package/cache/inmemory/entityStore.js +190 -29
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fixPolyfills.js +9 -0
- package/cache/inmemory/fixPolyfills.js.map +1 -1
- package/cache/inmemory/fixPolyfills.native.js +12 -0
- package/cache/inmemory/fixPolyfills.native.js.map +1 -1
- package/cache/inmemory/fragmentRegistry.js +23 -12
- package/cache/inmemory/fragmentRegistry.js.map +1 -1
- package/cache/inmemory/helpers.js +20 -11
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.js +161 -8
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +72 -4
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/object-canon.js +91 -3
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.js +193 -43
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/reactiveVars.js +20 -2
- package/cache/inmemory/reactiveVars.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +4 -0
- package/cache/inmemory/readFromStore.js +54 -9
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +28 -0
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.js +152 -25
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/config/jest/setup.js +2 -0
- package/config/jest/setup.js.map +1 -1
- package/core/ApolloClient.d.ts +264 -3
- package/core/ApolloClient.js +235 -7
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +4 -6
- package/core/LocalState.js +56 -18
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +25 -0
- package/core/ObservableQuery.js +239 -30
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +3 -3
- package/core/QueryInfo.js +116 -13
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +4 -0
- package/core/QueryManager.js +229 -33
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +112 -103
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +112 -103
- package/core/equalByQuery.js +20 -1
- package/core/equalByQuery.js.map +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +19 -0
- package/core/index.js.map +1 -1
- package/core/networkStatus.d.ts +39 -0
- package/core/networkStatus.js +39 -0
- package/core/networkStatus.js.map +1 -1
- package/core/types.d.ts +9 -0
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +225 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/dev/dev.cjs +5 -111
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +5 -111
- package/dev/loadErrorMessageHandler.js.map +1 -1
- package/errors/errors.cjs +1 -1
- package/errors/errors.cjs.map +1 -1
- package/errors/errors.cjs.native.js +1 -1
- package/errors/index.js +14 -1
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +1 -0
- package/link/batch/batch.cjs +2 -2
- package/link/batch/batch.cjs.map +1 -1
- package/link/batch/batch.cjs.native.js +2 -2
- package/link/batch/batchLink.d.ts +21 -0
- package/link/batch/batchLink.js +2 -1
- package/link/batch/batchLink.js.map +1 -1
- package/link/batch/batching.js +24 -1
- package/link/batch/batching.js.map +1 -1
- package/link/batch-http/batch-http.cjs +3 -2
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batch-http.cjs.native.js +3 -2
- package/link/batch-http/batchHttpLink.d.ts +4 -0
- package/link/batch-http/batchHttpLink.js +53 -2
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/context/context.cjs.map +1 -1
- package/link/context/index.js +1 -0
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.js +12 -5
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/core.cjs +5 -5
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +5 -5
- package/link/error/error.cjs +1 -1
- package/link/error/error.cjs.map +1 -1
- package/link/error/error.cjs.native.js +1 -1
- package/link/error/index.d.ts +3 -0
- package/link/error/index.js +4 -1
- package/link/error/index.js.map +1 -1
- package/link/http/HttpLink.d.ts +0 -2
- package/link/http/HttpLink.js +1 -1
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/checkFetcher.js.map +1 -1
- package/link/http/createHttpLink.js +23 -1
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/createSignalIfSupported.d.ts +5 -0
- package/link/http/createSignalIfSupported.js +5 -0
- package/link/http/createSignalIfSupported.js.map +1 -1
- package/link/http/http.cjs +14 -12
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +14 -12
- package/link/http/index.js +2 -1
- package/link/http/index.js.map +1 -1
- package/link/http/iterators/async.d.ts +4 -0
- package/link/http/iterators/async.js +4 -0
- package/link/http/iterators/async.js.map +1 -1
- package/link/http/iterators/nodeStream.d.ts +4 -0
- package/link/http/iterators/nodeStream.js +4 -0
- package/link/http/iterators/nodeStream.js.map +1 -1
- package/link/http/iterators/promise.d.ts +4 -0
- package/link/http/iterators/promise.js +4 -0
- package/link/http/iterators/promise.js.map +1 -1
- package/link/http/iterators/reader.d.ts +4 -0
- package/link/http/iterators/reader.js +4 -0
- package/link/http/iterators/reader.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +51 -10
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/responseIterator.d.ts +4 -0
- package/link/http/responseIterator.js +6 -0
- package/link/http/responseIterator.js.map +1 -1
- package/link/http/rewriteURIForGET.d.ts +1 -1
- package/link/http/rewriteURIForGET.js +10 -0
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +45 -0
- package/link/http/selectHttpOptionsAndBody.js +23 -0
- 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 +34 -4
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +4 -4
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +4 -4
- package/link/remove-typename/remove-typename.cjs +12 -9
- package/link/remove-typename/remove-typename.cjs.map +1 -1
- package/link/remove-typename/remove-typename.cjs.native.js +12 -9
- package/link/remove-typename/removeTypenameFromVariables.js +12 -9
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
- package/link/retry/delayFunction.d.ts +29 -0
- package/link/retry/delayFunction.js +6 -0
- package/link/retry/delayFunction.js.map +1 -1
- package/link/retry/retry.cjs +5 -5
- package/link/retry/retry.cjs.map +1 -1
- package/link/retry/retry.cjs.native.js +5 -5
- package/link/retry/retryFunction.d.ts +20 -0
- package/link/retry/retryLink.d.ts +6 -0
- package/link/retry/retryLink.js +31 -6
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +13 -0
- package/link/schema/index.js +3 -3
- package/link/schema/index.js.map +1 -1
- package/link/schema/schema.cjs +3 -3
- package/link/schema/schema.cjs.map +1 -1
- package/link/schema/schema.cjs.native.js +3 -3
- package/link/subscriptions/index.js +35 -2
- package/link/subscriptions/index.js.map +1 -1
- package/link/subscriptions/subscriptions.cjs +3 -2
- package/link/subscriptions/subscriptions.cjs.map +1 -1
- package/link/subscriptions/subscriptions.cjs.native.js +3 -2
- package/link/utils/createOperation.js.map +1 -1
- package/link/utils/filterOperationVariables.js +4 -0
- package/link/utils/filterOperationVariables.js.map +1 -1
- package/link/utils/toPromise.js.map +1 -1
- package/link/utils/transformOperation.js +3 -2
- package/link/utils/transformOperation.js.map +1 -1
- package/link/utils/utils.cjs +2 -2
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +2 -2
- package/link/utils/validateOperation.js.map +1 -1
- package/link/ws/index.d.ts +12 -0
- package/link/ws/index.js +1 -1
- package/link/ws/index.js.map +1 -1
- package/link/ws/ws.cjs +1 -1
- package/link/ws/ws.cjs.map +1 -1
- package/link/ws/ws.cjs.native.js +1 -1
- package/package.json +49 -38
- package/react/cache/QueryReference.d.ts +6 -1
- package/react/cache/QueryReference.js +26 -1
- package/react/cache/QueryReference.js.map +1 -1
- package/react/cache/SuspenseCache.d.ts +10 -0
- package/react/cache/SuspenseCache.js +1 -1
- package/react/cache/SuspenseCache.js.map +1 -1
- package/react/cache/getSuspenseCache.js.map +1 -1
- package/react/context/ApolloContext.d.ts +5 -0
- package/react/context/ApolloContext.js +10 -3
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/context.cjs +1 -3
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +1 -3
- package/react/hoc/graphql.js.map +1 -1
- package/react/hoc/hoc-utils.js +3 -1
- package/react/hoc/hoc-utils.js.map +1 -1
- package/react/hoc/hoc.cjs +9 -17
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +9 -17
- package/react/hoc/mutation-hoc.js +9 -4
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/query-hoc.js +10 -4
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.js +10 -4
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/withApollo.js +3 -4
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs +30 -22
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +30 -22
- package/react/hooks/internal/__use.js +5 -0
- package/react/hooks/internal/__use.js.map +1 -1
- package/react/hooks/internal/index.js +1 -0
- package/react/hooks/internal/index.js.map +1 -1
- package/react/hooks/internal/useDeepMemo.js.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.js +6 -3
- package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -1
- package/react/hooks/useBackgroundQuery.js +6 -0
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.js +4 -3
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.js +13 -4
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.js +8 -3
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +11 -0
- package/react/hooks/useQuery.js +137 -5
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useReactiveVar.js +5 -0
- package/react/hooks/useReactiveVar.js.map +1 -1
- package/react/hooks/useReadQuery.d.ts +19 -0
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.js +5 -0
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +11 -5
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +53 -1
- package/react/hooks/useSyncExternalStore.js.map +1 -1
- package/react/parser/index.js +4 -5
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +2 -4
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +2 -4
- package/react/ssr/RenderPromises.js +21 -1
- package/react/ssr/RenderPromises.js.map +1 -1
- package/react/ssr/getDataFromTree.js +18 -3
- package/react/ssr/getDataFromTree.js.map +1 -1
- package/react/ssr/ssr.cjs +6 -4
- package/react/ssr/ssr.cjs.map +1 -1
- package/react/ssr/ssr.cjs.native.js +6 -4
- package/react/types/types.d.ts +66 -0
- package/testing/core/core.cjs +14 -11
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +14 -11
- package/testing/core/itAsync.d.ts +1 -1
- package/testing/core/itAsync.js.map +1 -1
- package/testing/core/mocking/mockFetch.d.ts +2 -2
- package/testing/core/mocking/mockFetch.js +8 -4
- package/testing/core/mocking/mockFetch.js.map +1 -1
- package/testing/core/mocking/mockLink.js +17 -7
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockQueryManager.js +2 -0
- package/testing/core/mocking/mockQueryManager.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
- package/testing/core/mocking/mockWatchQuery.js +1 -1
- package/testing/core/mocking/mockWatchQuery.js.map +1 -1
- package/testing/core/observableToPromise.d.ts +17 -3
- package/testing/core/observableToPromise.js +5 -0
- package/testing/core/observableToPromise.js.map +1 -1
- package/testing/core/subscribeAndCount.js +3 -0
- package/testing/core/subscribeAndCount.js.map +1 -1
- package/testing/core/wait.js +2 -2
- package/testing/core/wait.js.map +1 -1
- package/testing/core/withConsoleSpy.d.ts +3 -0
- package/testing/core/withConsoleSpy.js +7 -1
- package/testing/core/withConsoleSpy.js.map +1 -1
- package/testing/core/wrap.js +2 -0
- package/testing/core/wrap.js.map +1 -1
- package/testing/internal/ObservableStream.js +14 -14
- package/testing/internal/ObservableStream.js.map +1 -1
- package/testing/internal/disposables/spyOnConsole.d.ts +1 -0
- package/testing/internal/disposables/spyOnConsole.js +2 -0
- package/testing/internal/disposables/spyOnConsole.js.map +1 -1
- package/testing/internal/disposables/withCleanup.d.ts +1 -0
- package/testing/internal/disposables/withCleanup.js +3 -0
- package/testing/internal/disposables/withCleanup.js.map +1 -1
- package/testing/internal/profile/Render.d.ts +28 -0
- package/testing/internal/profile/Render.js +12 -1
- package/testing/internal/profile/Render.js.map +1 -1
- package/testing/internal/profile/profile.d.ts +44 -7
- package/testing/internal/profile/profile.js +63 -51
- package/testing/internal/profile/profile.js.map +1 -1
- package/testing/internal/profile/traces.d.ts +4 -0
- package/testing/internal/profile/traces.js +9 -5
- package/testing/internal/profile/traces.js.map +1 -1
- package/testing/matchers/ProfiledComponent.js +27 -22
- package/testing/matchers/ProfiledComponent.js.map +1 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map +1 -1
- package/testing/matchers/toMatchDocument.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +4 -0
- package/testing/react/MockedProvider.js +6 -2
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +4 -2
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +4 -2
- package/utilities/common/arrays.js +1 -0
- package/utilities/common/arrays.js.map +1 -1
- package/utilities/common/canUse.js +16 -1
- package/utilities/common/canUse.js.map +1 -1
- package/utilities/common/cloneDeep.d.ts +3 -0
- package/utilities/common/cloneDeep.js +5 -0
- package/utilities/common/cloneDeep.js.map +1 -1
- package/utilities/common/compact.d.ts +4 -0
- package/utilities/common/compact.js +4 -0
- package/utilities/common/compact.js.map +1 -1
- package/utilities/common/errorHandling.js +1 -3
- package/utilities/common/errorHandling.js.map +1 -1
- package/utilities/common/incrementalResult.js +3 -0
- package/utilities/common/incrementalResult.js.map +1 -1
- package/utilities/common/makeUniqueId.js +2 -0
- package/utilities/common/makeUniqueId.js.map +1 -1
- package/utilities/common/maybeDeepFreeze.js +3 -0
- package/utilities/common/maybeDeepFreeze.js.map +1 -1
- package/utilities/common/mergeDeep.js +12 -1
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/common/mergeOptions.d.ts +1 -1
- package/utilities/common/mergeOptions.js.map +1 -1
- package/utilities/common/omitDeep.js.map +1 -1
- package/utilities/globals/global.js +7 -1
- package/utilities/globals/global.js.map +1 -1
- package/utilities/globals/globals.cjs +4 -5
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +4 -5
- package/utilities/globals/index.d.ts +4 -0
- package/utilities/globals/index.js +7 -0
- package/utilities/globals/index.js.map +1 -1
- package/utilities/globals/invariantWrappers.d.ts +40 -0
- package/utilities/globals/invariantWrappers.js +11 -3
- package/utilities/globals/invariantWrappers.js.map +1 -1
- package/utilities/globals/maybe.js.map +1 -1
- package/utilities/graphql/DocumentTransform.js +19 -6
- package/utilities/graphql/DocumentTransform.js.map +1 -1
- package/utilities/graphql/directives.js +3 -0
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts +25 -0
- package/utilities/graphql/fragments.js +36 -0
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.d.ts +5 -0
- package/utilities/graphql/getFromAST.js +9 -0
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/print.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts +14 -0
- package/utilities/graphql/storeUtils.js +7 -2
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.js +106 -7
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/observables/Concast.d.ts +1 -1
- package/utilities/observables/Concast.js +84 -1
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/observables/Observable.js +6 -0
- package/utilities/observables/Observable.js.map +1 -1
- package/utilities/observables/asyncMap.js +12 -3
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/observables/iteration.js +3 -0
- package/utilities/observables/iteration.js.map +1 -1
- package/utilities/observables/subclassing.js +14 -0
- package/utilities/observables/subclassing.js.map +1 -1
- package/utilities/policies/pagination.js +47 -3
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/promises/decoration.js +1 -0
- package/utilities/promises/decoration.js.map +1 -1
- package/utilities/types/DeepOmit.js.map +1 -1
- package/utilities/types/DeepPartial.d.ts +1 -1
- package/utilities/types/DeepPartial.js +4 -0
- package/utilities/types/DeepPartial.js.map +1 -1
- package/utilities/types/IsStrictlyAny.js.map +1 -1
- package/utilities/types/TODO.d.ts +3 -0
- package/utilities/types/TODO.js +2 -0
- package/utilities/types/TODO.js.map +1 -0
- package/utilities/utilities.cjs +31 -27
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +31 -27
- package/version.js +1 -1
- package/cache/core/cache.d.ts.map +0 -1
- package/cache/core/types/Cache.d.ts.map +0 -1
- package/cache/core/types/DataProxy.d.ts.map +0 -1
- package/cache/core/types/common.d.ts.map +0 -1
- package/cache/index.d.ts.map +0 -1
- package/cache/inmemory/entityStore.d.ts.map +0 -1
- package/cache/inmemory/fixPolyfills.d.ts.map +0 -1
- package/cache/inmemory/fixPolyfills.native.d.ts.map +0 -1
- package/cache/inmemory/fragmentRegistry.d.ts.map +0 -1
- package/cache/inmemory/helpers.d.ts.map +0 -1
- package/cache/inmemory/inMemoryCache.d.ts.map +0 -1
- package/cache/inmemory/key-extractor.d.ts.map +0 -1
- package/cache/inmemory/object-canon.d.ts.map +0 -1
- package/cache/inmemory/policies.d.ts.map +0 -1
- package/cache/inmemory/reactiveVars.d.ts.map +0 -1
- package/cache/inmemory/readFromStore.d.ts.map +0 -1
- package/cache/inmemory/types.d.ts.map +0 -1
- package/cache/inmemory/writeToStore.d.ts.map +0 -1
- package/config/jest/setup.d.ts.map +0 -1
- package/core/ApolloClient.d.ts.map +0 -1
- package/core/LocalState.d.ts.map +0 -1
- package/core/ObservableQuery.d.ts.map +0 -1
- package/core/QueryInfo.d.ts.map +0 -1
- package/core/QueryManager.d.ts.map +0 -1
- package/core/equalByQuery.d.ts.map +0 -1
- package/core/index.d.ts.map +0 -1
- package/core/networkStatus.d.ts.map +0 -1
- package/core/types.d.ts.map +0 -1
- package/core/watchQueryOptions.d.ts.map +0 -1
- package/dev/index.d.ts.map +0 -1
- package/dev/loadDevMessages.d.ts.map +0 -1
- package/dev/loadErrorMessageHandler.d.ts.map +0 -1
- package/dev/loadErrorMessages.d.ts.map +0 -1
- package/errors/index.d.ts.map +0 -1
- package/index.d.ts.map +0 -1
- package/invariantErrorCodes.d.ts.map +0 -1
- package/link/batch/batchLink.d.ts.map +0 -1
- package/link/batch/batching.d.ts.map +0 -1
- package/link/batch/index.d.ts.map +0 -1
- package/link/batch-http/batchHttpLink.d.ts.map +0 -1
- package/link/batch-http/index.d.ts.map +0 -1
- package/link/context/index.d.ts.map +0 -1
- package/link/core/ApolloLink.d.ts.map +0 -1
- package/link/core/concat.d.ts.map +0 -1
- package/link/core/empty.d.ts.map +0 -1
- package/link/core/execute.d.ts.map +0 -1
- package/link/core/from.d.ts.map +0 -1
- package/link/core/index.d.ts.map +0 -1
- package/link/core/split.d.ts.map +0 -1
- package/link/core/types.d.ts.map +0 -1
- package/link/error/index.d.ts.map +0 -1
- package/link/http/HttpLink.d.ts.map +0 -1
- package/link/http/checkFetcher.d.ts.map +0 -1
- package/link/http/createHttpLink.d.ts.map +0 -1
- package/link/http/createSignalIfSupported.d.ts.map +0 -1
- package/link/http/index.d.ts.map +0 -1
- package/link/http/iterators/async.d.ts.map +0 -1
- package/link/http/iterators/nodeStream.d.ts.map +0 -1
- package/link/http/iterators/promise.d.ts.map +0 -1
- package/link/http/iterators/reader.d.ts.map +0 -1
- package/link/http/parseAndCheckHttpResponse.d.ts.map +0 -1
- package/link/http/responseIterator.d.ts.map +0 -1
- package/link/http/rewriteURIForGET.d.ts.map +0 -1
- package/link/http/selectHttpOptionsAndBody.d.ts.map +0 -1
- package/link/http/selectURI.d.ts.map +0 -1
- package/link/http/serializeFetchParameter.d.ts.map +0 -1
- package/link/persisted-queries/index.d.ts.map +0 -1
- package/link/remove-typename/index.d.ts.map +0 -1
- package/link/remove-typename/removeTypenameFromVariables.d.ts.map +0 -1
- package/link/retry/delayFunction.d.ts.map +0 -1
- package/link/retry/index.d.ts.map +0 -1
- package/link/retry/retryFunction.d.ts.map +0 -1
- package/link/retry/retryLink.d.ts.map +0 -1
- package/link/schema/index.d.ts.map +0 -1
- package/link/subscriptions/index.d.ts.map +0 -1
- package/link/utils/createOperation.d.ts.map +0 -1
- package/link/utils/filterOperationVariables.d.ts.map +0 -1
- package/link/utils/fromError.d.ts.map +0 -1
- package/link/utils/fromPromise.d.ts.map +0 -1
- package/link/utils/index.d.ts.map +0 -1
- package/link/utils/throwServerError.d.ts.map +0 -1
- package/link/utils/toPromise.d.ts.map +0 -1
- package/link/utils/transformOperation.d.ts.map +0 -1
- package/link/utils/validateOperation.d.ts.map +0 -1
- package/link/ws/index.d.ts.map +0 -1
- package/react/cache/QueryReference.d.ts.map +0 -1
- package/react/cache/SuspenseCache.d.ts.map +0 -1
- package/react/cache/getSuspenseCache.d.ts.map +0 -1
- package/react/cache/index.d.ts.map +0 -1
- package/react/cache/types.d.ts.map +0 -1
- package/react/components/Mutation.d.ts.map +0 -1
- package/react/components/Query.d.ts.map +0 -1
- package/react/components/Subscription.d.ts.map +0 -1
- package/react/components/index.d.ts.map +0 -1
- package/react/components/types.d.ts.map +0 -1
- package/react/context/ApolloConsumer.d.ts.map +0 -1
- package/react/context/ApolloContext.d.ts.map +0 -1
- package/react/context/ApolloProvider.d.ts.map +0 -1
- package/react/context/index.d.ts.map +0 -1
- package/react/hoc/graphql.d.ts.map +0 -1
- package/react/hoc/hoc-utils.d.ts.map +0 -1
- package/react/hoc/index.d.ts.map +0 -1
- package/react/hoc/mutation-hoc.d.ts.map +0 -1
- package/react/hoc/query-hoc.d.ts.map +0 -1
- package/react/hoc/subscription-hoc.d.ts.map +0 -1
- package/react/hoc/types.d.ts.map +0 -1
- package/react/hoc/withApollo.d.ts.map +0 -1
- package/react/hooks/constants.d.ts.map +0 -1
- package/react/hooks/index.d.ts.map +0 -1
- package/react/hooks/internal/__use.d.ts.map +0 -1
- package/react/hooks/internal/index.d.ts.map +0 -1
- package/react/hooks/internal/useDeepMemo.d.ts.map +0 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +0 -1
- package/react/hooks/useApolloClient.d.ts.map +0 -1
- package/react/hooks/useBackgroundQuery.d.ts.map +0 -1
- package/react/hooks/useFragment.d.ts.map +0 -1
- package/react/hooks/useLazyQuery.d.ts.map +0 -1
- package/react/hooks/useMutation.d.ts.map +0 -1
- package/react/hooks/useQuery.d.ts.map +0 -1
- package/react/hooks/useReactiveVar.d.ts.map +0 -1
- package/react/hooks/useReadQuery.d.ts.map +0 -1
- package/react/hooks/useSubscription.d.ts.map +0 -1
- package/react/hooks/useSuspenseQuery.d.ts.map +0 -1
- package/react/hooks/useSyncExternalStore.d.ts.map +0 -1
- package/react/index.d.ts.map +0 -1
- package/react/parser/index.d.ts.map +0 -1
- package/react/ssr/RenderPromises.d.ts.map +0 -1
- package/react/ssr/getDataFromTree.d.ts.map +0 -1
- package/react/ssr/index.d.ts.map +0 -1
- package/react/ssr/renderToStringWithData.d.ts.map +0 -1
- package/react/types/types.d.ts.map +0 -1
- package/testing/core/index.d.ts.map +0 -1
- package/testing/core/itAsync.d.ts.map +0 -1
- package/testing/core/mocking/mockClient.d.ts.map +0 -1
- package/testing/core/mocking/mockFetch.d.ts.map +0 -1
- package/testing/core/mocking/mockLink.d.ts.map +0 -1
- package/testing/core/mocking/mockQueryManager.d.ts.map +0 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts.map +0 -1
- package/testing/core/mocking/mockWatchQuery.d.ts.map +0 -1
- package/testing/core/observableToPromise.d.ts.map +0 -1
- package/testing/core/subscribeAndCount.d.ts.map +0 -1
- package/testing/core/wait.d.ts.map +0 -1
- package/testing/core/withConsoleSpy.d.ts.map +0 -1
- package/testing/core/wrap.d.ts.map +0 -1
- package/testing/index.d.ts.map +0 -1
- package/testing/internal/ObservableStream.d.ts.map +0 -1
- package/testing/internal/disposables/index.d.ts.map +0 -1
- package/testing/internal/disposables/spyOnConsole.d.ts.map +0 -1
- package/testing/internal/disposables/withCleanup.d.ts.map +0 -1
- package/testing/internal/index.d.ts.map +0 -1
- package/testing/internal/profile/Render.d.ts.map +0 -1
- package/testing/internal/profile/index.d.ts.map +0 -1
- package/testing/internal/profile/profile.d.ts.map +0 -1
- package/testing/internal/profile/traces.d.ts.map +0 -1
- package/testing/matchers/ProfiledComponent.d.ts.map +0 -1
- package/testing/matchers/index.d.ts.map +0 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts.map +0 -1
- package/testing/matchers/toMatchDocument.d.ts.map +0 -1
- package/testing/react/MockedProvider.d.ts.map +0 -1
- package/utilities/common/arrays.d.ts.map +0 -1
- package/utilities/common/canUse.d.ts.map +0 -1
- package/utilities/common/cloneDeep.d.ts.map +0 -1
- package/utilities/common/compact.d.ts.map +0 -1
- package/utilities/common/errorHandling.d.ts.map +0 -1
- package/utilities/common/filterInPlace.d.ts +0 -2
- package/utilities/common/filterInPlace.d.ts.map +0 -1
- package/utilities/common/filterInPlace.js +0 -11
- package/utilities/common/filterInPlace.js.map +0 -1
- package/utilities/common/incrementalResult.d.ts.map +0 -1
- package/utilities/common/makeUniqueId.d.ts.map +0 -1
- package/utilities/common/maybeDeepFreeze.d.ts.map +0 -1
- package/utilities/common/mergeDeep.d.ts.map +0 -1
- package/utilities/common/mergeOptions.d.ts.map +0 -1
- package/utilities/common/objects.d.ts.map +0 -1
- package/utilities/common/omitDeep.d.ts.map +0 -1
- package/utilities/common/stringifyForDisplay.d.ts.map +0 -1
- package/utilities/common/stripTypename.d.ts.map +0 -1
- package/utilities/globals/global.d.ts.map +0 -1
- package/utilities/globals/index.d.ts.map +0 -1
- package/utilities/globals/invariantWrappers.d.ts.map +0 -1
- package/utilities/globals/maybe.d.ts.map +0 -1
- package/utilities/graphql/DocumentTransform.d.ts.map +0 -1
- package/utilities/graphql/directives.d.ts.map +0 -1
- package/utilities/graphql/fragments.d.ts.map +0 -1
- package/utilities/graphql/getFromAST.d.ts.map +0 -1
- package/utilities/graphql/operations.d.ts.map +0 -1
- package/utilities/graphql/print.d.ts.map +0 -1
- package/utilities/graphql/storeUtils.d.ts.map +0 -1
- package/utilities/graphql/transform.d.ts.map +0 -1
- package/utilities/index.d.ts.map +0 -1
- package/utilities/observables/Concast.d.ts.map +0 -1
- package/utilities/observables/Observable.d.ts.map +0 -1
- package/utilities/observables/asyncMap.d.ts.map +0 -1
- package/utilities/observables/iteration.d.ts.map +0 -1
- package/utilities/observables/subclassing.d.ts.map +0 -1
- package/utilities/policies/pagination.d.ts.map +0 -1
- package/utilities/promises/decoration.d.ts.map +0 -1
- package/utilities/types/DeepOmit.d.ts.map +0 -1
- package/utilities/types/DeepPartial.d.ts.map +0 -1
- package/utilities/types/IsStrictlyAny.d.ts.map +0 -1
- package/utilities/types/Primitive.d.ts.map +0 -1
- package/version.d.ts.map +0 -1
package/cache/cache.cjs
CHANGED
|
@@ -9,19 +9,16 @@ var utilities = require('../utilities');
|
|
|
9
9
|
var equality = require('@wry/equality');
|
|
10
10
|
var trie = require('@wry/trie');
|
|
11
11
|
var graphql = require('graphql');
|
|
12
|
-
var context = require('@wry/context');
|
|
13
12
|
|
|
14
|
-
var ApolloCache =
|
|
13
|
+
var ApolloCache = (function () {
|
|
15
14
|
function ApolloCache() {
|
|
16
15
|
this.assumeImmutableResults = false;
|
|
17
16
|
this.getFragmentDoc = optimism.wrap(utilities.getFragmentQueryDocument);
|
|
18
17
|
}
|
|
19
18
|
ApolloCache.prototype.batch = function (options) {
|
|
20
19
|
var _this = this;
|
|
21
|
-
var optimisticId = typeof options.optimistic === "string"
|
|
22
|
-
|
|
23
|
-
: options.optimistic === false
|
|
24
|
-
? null
|
|
20
|
+
var optimisticId = typeof options.optimistic === "string" ? options.optimistic
|
|
21
|
+
: options.optimistic === false ? null
|
|
25
22
|
: void 0;
|
|
26
23
|
var updateResult;
|
|
27
24
|
this.performTransaction(function () { return (updateResult = options.update(_this)); }, optimisticId);
|
|
@@ -99,7 +96,7 @@ exports.Cache = void 0;
|
|
|
99
96
|
(function (Cache) {
|
|
100
97
|
})(exports.Cache || (exports.Cache = {}));
|
|
101
98
|
|
|
102
|
-
var MissingFieldError =
|
|
99
|
+
var MissingFieldError = (function (_super) {
|
|
103
100
|
tslib.__extends(MissingFieldError, _super);
|
|
104
101
|
function MissingFieldError(message, path, query, variables) {
|
|
105
102
|
var _a;
|
|
@@ -131,18 +128,17 @@ function defaultDataIdFromObject(_a, context) {
|
|
|
131
128
|
var __typename = _a.__typename, id = _a.id, _id = _a._id;
|
|
132
129
|
if (typeof __typename === "string") {
|
|
133
130
|
if (context) {
|
|
134
|
-
context.keyObject =
|
|
135
|
-
? { id: id }
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
: void 0;
|
|
131
|
+
context.keyObject =
|
|
132
|
+
!isNullish(id) ? { id: id }
|
|
133
|
+
: !isNullish(_id) ? { _id: _id }
|
|
134
|
+
: void 0;
|
|
139
135
|
}
|
|
140
136
|
if (isNullish(id) && !isNullish(_id)) {
|
|
141
137
|
id = _id;
|
|
142
138
|
}
|
|
143
139
|
if (!isNullish(id)) {
|
|
144
|
-
return "".concat(__typename, ":").concat(typeof id === "number" || typeof id === "string"
|
|
145
|
-
|
|
140
|
+
return "".concat(__typename, ":").concat(typeof id === "number" || typeof id === "string" ?
|
|
141
|
+
id
|
|
146
142
|
: JSON.stringify(id));
|
|
147
143
|
}
|
|
148
144
|
}
|
|
@@ -161,8 +157,8 @@ function shouldCanonizeResults(config) {
|
|
|
161
157
|
return value === void 0 ? defaultConfig.canonizeResults : value;
|
|
162
158
|
}
|
|
163
159
|
function getTypenameFromStoreObject(store, objectOrReference) {
|
|
164
|
-
return utilities.isReference(objectOrReference)
|
|
165
|
-
|
|
160
|
+
return utilities.isReference(objectOrReference) ?
|
|
161
|
+
store.get(objectOrReference.__ref, "__typename")
|
|
166
162
|
: objectOrReference && objectOrReference.__typename;
|
|
167
163
|
}
|
|
168
164
|
var TypeOrFieldNameRegExp = /^[_a-z][_0-9a-z]*/i;
|
|
@@ -172,8 +168,8 @@ function fieldNameFromStoreName(storeFieldName) {
|
|
|
172
168
|
}
|
|
173
169
|
function selectionSetMatchesResult(selectionSet, result, variables) {
|
|
174
170
|
if (utilities.isNonNullObject(result)) {
|
|
175
|
-
return utilities.isArray(result)
|
|
176
|
-
|
|
171
|
+
return utilities.isArray(result) ?
|
|
172
|
+
result.every(function (item) {
|
|
177
173
|
return selectionSetMatchesResult(selectionSet, item, variables);
|
|
178
174
|
})
|
|
179
175
|
: selectionSet.selections.every(function (field) {
|
|
@@ -211,7 +207,7 @@ function extractFragmentContext(document, fragments) {
|
|
|
211
207
|
var DELETE = Object.create(null);
|
|
212
208
|
var delModifier = function () { return DELETE; };
|
|
213
209
|
var INVALIDATE = Object.create(null);
|
|
214
|
-
exports.EntityStore =
|
|
210
|
+
exports.EntityStore = (function () {
|
|
215
211
|
function EntityStore(policies, group) {
|
|
216
212
|
var _this = this;
|
|
217
213
|
this.policies = policies;
|
|
@@ -220,13 +216,13 @@ exports.EntityStore = (function () {
|
|
|
220
216
|
this.rootIds = Object.create(null);
|
|
221
217
|
this.refs = Object.create(null);
|
|
222
218
|
this.getFieldValue = function (objectOrReference, storeFieldName) {
|
|
223
|
-
return utilities.maybeDeepFreeze(utilities.isReference(objectOrReference)
|
|
224
|
-
|
|
219
|
+
return utilities.maybeDeepFreeze(utilities.isReference(objectOrReference) ?
|
|
220
|
+
_this.get(objectOrReference.__ref, storeFieldName)
|
|
225
221
|
: objectOrReference && objectOrReference[storeFieldName]);
|
|
226
222
|
};
|
|
227
223
|
this.canRead = function (objOrRef) {
|
|
228
|
-
return utilities.isReference(objOrRef)
|
|
229
|
-
|
|
224
|
+
return utilities.isReference(objOrRef) ?
|
|
225
|
+
_this.has(objOrRef.__ref)
|
|
230
226
|
: typeof objOrRef === "object";
|
|
231
227
|
};
|
|
232
228
|
this.toReference = function (objOrIdOrRef, mergeIntoStore) {
|
|
@@ -340,8 +336,8 @@ exports.EntityStore = (function () {
|
|
|
340
336
|
toReference: this.toReference,
|
|
341
337
|
canRead: this.canRead,
|
|
342
338
|
readField: function (fieldNameOrOptions, from) {
|
|
343
|
-
return _this.policies.readField(typeof fieldNameOrOptions === "string"
|
|
344
|
-
|
|
339
|
+
return _this.policies.readField(typeof fieldNameOrOptions === "string" ?
|
|
340
|
+
{
|
|
345
341
|
fieldName: fieldNameOrOptions,
|
|
346
342
|
from: from || utilities.makeReference(dataId),
|
|
347
343
|
}
|
|
@@ -353,13 +349,9 @@ exports.EntityStore = (function () {
|
|
|
353
349
|
var fieldValue = storeObject[storeFieldName];
|
|
354
350
|
if (fieldValue === void 0)
|
|
355
351
|
return;
|
|
356
|
-
var modify = typeof fields === "function"
|
|
357
|
-
? fields
|
|
358
|
-
: fields[storeFieldName] || fields[fieldName];
|
|
352
|
+
var modify = typeof fields === "function" ? fields : (fields[storeFieldName] || fields[fieldName]);
|
|
359
353
|
if (modify) {
|
|
360
|
-
var newValue = modify === delModifier
|
|
361
|
-
? DELETE
|
|
362
|
-
: modify(utilities.maybeDeepFreeze(fieldValue), tslib.__assign(tslib.__assign({}, sharedDetails_1), { fieldName: fieldName, storeFieldName: storeFieldName, storage: _this.getStorage(dataId, storeFieldName) }));
|
|
354
|
+
var newValue = modify === delModifier ? DELETE : (modify(utilities.maybeDeepFreeze(fieldValue), tslib.__assign(tslib.__assign({}, sharedDetails_1), { fieldName: fieldName, storeFieldName: storeFieldName, storage: _this.getStorage(dataId, storeFieldName) })));
|
|
363
355
|
if (newValue === INVALIDATE) {
|
|
364
356
|
_this.group.dirty(dataId, storeFieldName);
|
|
365
357
|
}
|
|
@@ -433,13 +425,12 @@ exports.EntityStore = (function () {
|
|
|
433
425
|
var storeObject = this.lookup(dataId);
|
|
434
426
|
if (storeObject) {
|
|
435
427
|
var typename = this.getFieldValue(storeObject, "__typename");
|
|
436
|
-
var storeFieldName = fieldName && args
|
|
437
|
-
|
|
428
|
+
var storeFieldName = fieldName && args ?
|
|
429
|
+
this.policies.getStoreFieldName({ typename: typename, fieldName: fieldName, args: args })
|
|
438
430
|
: fieldName;
|
|
439
|
-
return this.modify(dataId, storeFieldName
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
_a) : delModifier);
|
|
431
|
+
return this.modify(dataId, storeFieldName ? (_a = {},
|
|
432
|
+
_a[storeFieldName] = delModifier,
|
|
433
|
+
_a) : delModifier);
|
|
443
434
|
}
|
|
444
435
|
return false;
|
|
445
436
|
};
|
|
@@ -562,7 +553,7 @@ exports.EntityStore = (function () {
|
|
|
562
553
|
};
|
|
563
554
|
return EntityStore;
|
|
564
555
|
}());
|
|
565
|
-
var CacheGroup =
|
|
556
|
+
var CacheGroup = (function () {
|
|
566
557
|
function CacheGroup(caching, parent) {
|
|
567
558
|
if (parent === void 0) { parent = null; }
|
|
568
559
|
this.caching = caching;
|
|
@@ -588,7 +579,8 @@ var CacheGroup = (function () {
|
|
|
588
579
|
};
|
|
589
580
|
CacheGroup.prototype.dirty = function (dataId, storeFieldName) {
|
|
590
581
|
if (this.d) {
|
|
591
|
-
this.d.dirty(makeDepKey(dataId, storeFieldName),
|
|
582
|
+
this.d.dirty(makeDepKey(dataId, storeFieldName),
|
|
583
|
+
storeFieldName === "__exists" ? "forget" : "setDirty");
|
|
592
584
|
}
|
|
593
585
|
};
|
|
594
586
|
return CacheGroup;
|
|
@@ -602,7 +594,7 @@ function maybeDependOnExistenceOfEntity(store, entityId) {
|
|
|
602
594
|
}
|
|
603
595
|
}
|
|
604
596
|
(function (EntityStore) {
|
|
605
|
-
var Root =
|
|
597
|
+
var Root = (function (_super) {
|
|
606
598
|
tslib.__extends(Root, _super);
|
|
607
599
|
function Root(_a) {
|
|
608
600
|
var policies = _a.policies, _b = _a.resultCaching, resultCaching = _b === void 0 ? true : _b, seed = _a.seed;
|
|
@@ -626,7 +618,7 @@ function maybeDependOnExistenceOfEntity(store, entityId) {
|
|
|
626
618
|
}(EntityStore));
|
|
627
619
|
EntityStore.Root = Root;
|
|
628
620
|
})(exports.EntityStore || (exports.EntityStore = {}));
|
|
629
|
-
var Layer =
|
|
621
|
+
var Layer = (function (_super) {
|
|
630
622
|
tslib.__extends(Layer, _super);
|
|
631
623
|
function Layer(id, parent, replay, group) {
|
|
632
624
|
var _this = _super.call(this, parent.policies, group) || this;
|
|
@@ -677,18 +669,18 @@ var Layer = (function (_super) {
|
|
|
677
669
|
};
|
|
678
670
|
Layer.prototype.findChildRefIds = function (dataId) {
|
|
679
671
|
var fromParent = this.parent.findChildRefIds(dataId);
|
|
680
|
-
return hasOwn.call(this.data, dataId)
|
|
681
|
-
? tslib.__assign(tslib.__assign({}, fromParent), _super.prototype.findChildRefIds.call(this, dataId)) : fromParent;
|
|
672
|
+
return hasOwn.call(this.data, dataId) ? tslib.__assign(tslib.__assign({}, fromParent), _super.prototype.findChildRefIds.call(this, dataId)) : fromParent;
|
|
682
673
|
};
|
|
683
674
|
Layer.prototype.getStorage = function () {
|
|
684
675
|
var p = this.parent;
|
|
685
676
|
while (p.parent)
|
|
686
677
|
p = p.parent;
|
|
687
|
-
return p.getStorage.apply(p,
|
|
678
|
+
return p.getStorage.apply(p,
|
|
679
|
+
arguments);
|
|
688
680
|
};
|
|
689
681
|
return Layer;
|
|
690
682
|
}(exports.EntityStore));
|
|
691
|
-
var Stump =
|
|
683
|
+
var Stump = (function (_super) {
|
|
692
684
|
tslib.__extends(Stump, _super);
|
|
693
685
|
function Stump(root) {
|
|
694
686
|
return _super.call(this, "EntityStore.Stump", root, function () { }, new CacheGroup(root.group.caching, root.group)) || this;
|
|
@@ -696,8 +688,8 @@ var Stump = (function (_super) {
|
|
|
696
688
|
Stump.prototype.removeLayer = function () {
|
|
697
689
|
return this;
|
|
698
690
|
};
|
|
699
|
-
Stump.prototype.merge = function () {
|
|
700
|
-
return this.parent.merge
|
|
691
|
+
Stump.prototype.merge = function (older, newer) {
|
|
692
|
+
return this.parent.merge(older, newer);
|
|
701
693
|
};
|
|
702
694
|
return Stump;
|
|
703
695
|
}(Layer));
|
|
@@ -712,13 +704,13 @@ function supportsResultCaching(store) {
|
|
|
712
704
|
|
|
713
705
|
function shallowCopy(value) {
|
|
714
706
|
if (utilities.isNonNullObject(value)) {
|
|
715
|
-
return utilities.isArray(value)
|
|
716
|
-
|
|
707
|
+
return utilities.isArray(value) ?
|
|
708
|
+
value.slice(0)
|
|
717
709
|
: tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value);
|
|
718
710
|
}
|
|
719
711
|
return value;
|
|
720
712
|
}
|
|
721
|
-
var ObjectCanon =
|
|
713
|
+
var ObjectCanon = (function () {
|
|
722
714
|
function ObjectCanon() {
|
|
723
715
|
this.known = new (utilities.canUseWeakSet ? WeakSet : Set)();
|
|
724
716
|
this.pool = new trie.Trie(utilities.canUseWeakMap);
|
|
@@ -832,7 +824,7 @@ function execSelectionSetKeyArgs(options) {
|
|
|
832
824
|
options.context.canonizeResults,
|
|
833
825
|
];
|
|
834
826
|
}
|
|
835
|
-
var StoreReader =
|
|
827
|
+
var StoreReader = (function () {
|
|
836
828
|
function StoreReader(config) {
|
|
837
829
|
var _this = this;
|
|
838
830
|
this.knownResults = new (utilities.canUseWeakMap ? WeakMap : Map)();
|
|
@@ -849,7 +841,8 @@ var StoreReader = (function () {
|
|
|
849
841
|
var other = (_a = _this.executeSelectionSet).peek.apply(_a, peekArgs);
|
|
850
842
|
if (other) {
|
|
851
843
|
if (canonizeResults) {
|
|
852
|
-
return tslib.__assign(tslib.__assign({}, other), {
|
|
844
|
+
return tslib.__assign(tslib.__assign({}, other), {
|
|
845
|
+
result: _this.canon.admit(other.result) });
|
|
853
846
|
}
|
|
854
847
|
return other;
|
|
855
848
|
}
|
|
@@ -909,7 +902,8 @@ var StoreReader = (function () {
|
|
|
909
902
|
StoreReader.prototype.isFresh = function (result, parent, selectionSet, context) {
|
|
910
903
|
if (supportsResultCaching(context.store) &&
|
|
911
904
|
this.knownResults.get(result) === selectionSet) {
|
|
912
|
-
var latest = this.executeSelectionSet.peek(selectionSet, parent, context,
|
|
905
|
+
var latest = this.executeSelectionSet.peek(selectionSet, parent, context,
|
|
906
|
+
this.canon.isKnown(result));
|
|
913
907
|
if (latest && result === latest.result) {
|
|
914
908
|
return true;
|
|
915
909
|
}
|
|
@@ -962,8 +956,8 @@ var StoreReader = (function () {
|
|
|
962
956
|
if (fieldValue === void 0) {
|
|
963
957
|
if (!utilities.addTypenameToDocument.added(selection)) {
|
|
964
958
|
missing = missingMerger.merge(missing, (_a = {},
|
|
965
|
-
_a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(utilities.isReference(objectOrReference)
|
|
966
|
-
|
|
959
|
+
_a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(utilities.isReference(objectOrReference) ?
|
|
960
|
+
objectOrReference.__ref + " object"
|
|
967
961
|
: "object " + JSON.stringify(objectOrReference, null, 2)),
|
|
968
962
|
_a));
|
|
969
963
|
}
|
|
@@ -1005,10 +999,9 @@ var StoreReader = (function () {
|
|
|
1005
999
|
});
|
|
1006
1000
|
var result = utilities.mergeDeepArray(objectsToMerge);
|
|
1007
1001
|
var finalResult = { result: result, missing: missing };
|
|
1008
|
-
var frozen = context.canonizeResults
|
|
1009
|
-
|
|
1010
|
-
:
|
|
1011
|
-
utilities.maybeDeepFreeze(finalResult);
|
|
1002
|
+
var frozen = context.canonizeResults ?
|
|
1003
|
+
this.canon.admit(finalResult)
|
|
1004
|
+
: utilities.maybeDeepFreeze(finalResult);
|
|
1012
1005
|
if (frozen.result) {
|
|
1013
1006
|
this.knownResults.set(frozen.result, selectionSet);
|
|
1014
1007
|
}
|
|
@@ -1090,7 +1083,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
1090
1083
|
}
|
|
1091
1084
|
}
|
|
1092
1085
|
|
|
1093
|
-
var cacheSlot = new
|
|
1086
|
+
var cacheSlot = new optimism.Slot();
|
|
1094
1087
|
var cacheInfoMap = new WeakMap();
|
|
1095
1088
|
function getCacheInfo(cache) {
|
|
1096
1089
|
var info = cacheInfoMap.get(cache);
|
|
@@ -1166,7 +1159,8 @@ function keyFieldsFnFromSpecifier(specifier) {
|
|
|
1166
1159
|
return context.readField(key, from);
|
|
1167
1160
|
};
|
|
1168
1161
|
var keyObject = (context.keyObject = collectSpecifierPaths(specifier, function (schemaKeyPath) {
|
|
1169
|
-
var extracted = extractKeyPath(context.storeObject, schemaKeyPath,
|
|
1162
|
+
var extracted = extractKeyPath(context.storeObject, schemaKeyPath,
|
|
1163
|
+
extract);
|
|
1170
1164
|
if (extracted === void 0 &&
|
|
1171
1165
|
object !== context.storeObject &&
|
|
1172
1166
|
hasOwn.call(object, schemaKeyPath[0])) {
|
|
@@ -1192,7 +1186,8 @@ function keyArgsFnFromSpecifier(specifier) {
|
|
|
1192
1186
|
var d = field.directives.find(function (d) { return d.name.value === directiveName_1; });
|
|
1193
1187
|
var directiveArgs = d && utilities.argumentsObjectFromField(d, variables);
|
|
1194
1188
|
return (directiveArgs &&
|
|
1195
|
-
extractKeyPath(directiveArgs,
|
|
1189
|
+
extractKeyPath(directiveArgs,
|
|
1190
|
+
keyPath.slice(1)));
|
|
1196
1191
|
}
|
|
1197
1192
|
return;
|
|
1198
1193
|
}
|
|
@@ -1257,8 +1252,8 @@ function extractKey(object, key) {
|
|
|
1257
1252
|
function extractKeyPath(object, path, extract) {
|
|
1258
1253
|
extract = extract || extractKey;
|
|
1259
1254
|
return normalize(path.reduce(function reducer(obj, key) {
|
|
1260
|
-
return utilities.isArray(obj)
|
|
1261
|
-
|
|
1255
|
+
return utilities.isArray(obj) ?
|
|
1256
|
+
obj.map(function (child) { return reducer(child, key); })
|
|
1262
1257
|
: obj && extract(obj, key);
|
|
1263
1258
|
}, object));
|
|
1264
1259
|
}
|
|
@@ -1276,11 +1271,9 @@ function normalize(value) {
|
|
|
1276
1271
|
|
|
1277
1272
|
utilities.getStoreKeyName.setStringify(canonicalStringify);
|
|
1278
1273
|
function argsFromFieldSpecifier(spec) {
|
|
1279
|
-
return spec.args !== void 0
|
|
1280
|
-
? spec.
|
|
1281
|
-
|
|
1282
|
-
? utilities.argumentsObjectFromField(spec.field, spec.variables)
|
|
1283
|
-
: null;
|
|
1274
|
+
return (spec.args !== void 0 ? spec.args
|
|
1275
|
+
: spec.field ? utilities.argumentsObjectFromField(spec.field, spec.variables)
|
|
1276
|
+
: null);
|
|
1284
1277
|
}
|
|
1285
1278
|
var nullKeyFieldsFn = function () { return void 0; };
|
|
1286
1279
|
var simpleKeyArgsFn = function (_args, context) { return context.fieldName; };
|
|
@@ -1289,7 +1282,7 @@ var mergeTrueFn = function (existing, incoming, _a) {
|
|
|
1289
1282
|
return mergeObjects(existing, incoming);
|
|
1290
1283
|
};
|
|
1291
1284
|
var mergeFalseFn = function (_, incoming) { return incoming; };
|
|
1292
|
-
var Policies =
|
|
1285
|
+
var Policies = (function () {
|
|
1293
1286
|
function Policies(config) {
|
|
1294
1287
|
this.config = config;
|
|
1295
1288
|
this.typePolicies = Object.create(null);
|
|
@@ -1369,28 +1362,17 @@ var Policies = (function () {
|
|
|
1369
1362
|
var keyFields = incoming.keyFields, fields = incoming.fields;
|
|
1370
1363
|
function setMerge(existing, merge) {
|
|
1371
1364
|
existing.merge =
|
|
1372
|
-
typeof merge === "function"
|
|
1373
|
-
?
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
? mergeTrueFn
|
|
1377
|
-
:
|
|
1378
|
-
merge === false
|
|
1379
|
-
? mergeFalseFn
|
|
1380
|
-
: existing.merge;
|
|
1365
|
+
typeof merge === "function" ? merge
|
|
1366
|
+
: merge === true ? mergeTrueFn
|
|
1367
|
+
: merge === false ? mergeFalseFn
|
|
1368
|
+
: existing.merge;
|
|
1381
1369
|
}
|
|
1382
1370
|
setMerge(existing, incoming.merge);
|
|
1383
1371
|
existing.keyFn =
|
|
1384
|
-
keyFields === false
|
|
1385
|
-
?
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
? keyFieldsFnFromSpecifier(keyFields)
|
|
1389
|
-
:
|
|
1390
|
-
typeof keyFields === "function"
|
|
1391
|
-
? keyFields
|
|
1392
|
-
:
|
|
1393
|
-
existing.keyFn;
|
|
1372
|
+
keyFields === false ? nullKeyFieldsFn
|
|
1373
|
+
: utilities.isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields)
|
|
1374
|
+
: typeof keyFields === "function" ? keyFields
|
|
1375
|
+
: existing.keyFn;
|
|
1394
1376
|
if (fields) {
|
|
1395
1377
|
Object.keys(fields).forEach(function (fieldName) {
|
|
1396
1378
|
var existing = _this.getFieldPolicy(typename, fieldName, true);
|
|
@@ -1401,16 +1383,10 @@ var Policies = (function () {
|
|
|
1401
1383
|
else {
|
|
1402
1384
|
var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge;
|
|
1403
1385
|
existing.keyFn =
|
|
1404
|
-
keyArgs === false
|
|
1405
|
-
?
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
? keyArgsFnFromSpecifier(keyArgs)
|
|
1409
|
-
:
|
|
1410
|
-
typeof keyArgs === "function"
|
|
1411
|
-
? keyArgs
|
|
1412
|
-
:
|
|
1413
|
-
existing.keyFn;
|
|
1386
|
+
keyArgs === false ? simpleKeyArgsFn
|
|
1387
|
+
: utilities.isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs)
|
|
1388
|
+
: typeof keyArgs === "function" ? keyArgs
|
|
1389
|
+
: existing.keyFn;
|
|
1414
1390
|
if (typeof read === "function") {
|
|
1415
1391
|
existing.read = read;
|
|
1416
1392
|
}
|
|
@@ -1576,15 +1552,15 @@ var Policies = (function () {
|
|
|
1576
1552
|
}
|
|
1577
1553
|
}
|
|
1578
1554
|
if (storeFieldName === void 0) {
|
|
1579
|
-
storeFieldName =
|
|
1580
|
-
|
|
1581
|
-
|
|
1555
|
+
storeFieldName =
|
|
1556
|
+
fieldSpec.field ?
|
|
1557
|
+
utilities.storeKeyNameFromField(fieldSpec.field, fieldSpec.variables)
|
|
1558
|
+
: utilities.getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec));
|
|
1582
1559
|
}
|
|
1583
1560
|
if (storeFieldName === false) {
|
|
1584
1561
|
return fieldName;
|
|
1585
1562
|
}
|
|
1586
|
-
return fieldName === fieldNameFromStoreName(storeFieldName)
|
|
1587
|
-
? storeFieldName
|
|
1563
|
+
return fieldName === fieldNameFromStoreName(storeFieldName) ? storeFieldName
|
|
1588
1564
|
: fieldName + ":" + storeFieldName;
|
|
1589
1565
|
};
|
|
1590
1566
|
Policies.prototype.readField = function (options, context) {
|
|
@@ -1605,8 +1581,8 @@ var Policies = (function () {
|
|
|
1605
1581
|
var policy = this.getFieldPolicy(options.typename, fieldName, false);
|
|
1606
1582
|
var read = policy && policy.read;
|
|
1607
1583
|
if (read) {
|
|
1608
|
-
var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(utilities.isReference(objectOrReference)
|
|
1609
|
-
|
|
1584
|
+
var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(utilities.isReference(objectOrReference) ?
|
|
1585
|
+
objectOrReference.__ref
|
|
1610
1586
|
: objectOrReference, storeFieldName));
|
|
1611
1587
|
return cacheSlot.withValue(this.cache, read, [
|
|
1612
1588
|
existing,
|
|
@@ -1639,7 +1615,8 @@ var Policies = (function () {
|
|
|
1639
1615
|
if (context.overwrite) {
|
|
1640
1616
|
existing = void 0;
|
|
1641
1617
|
}
|
|
1642
|
-
return merge(existing, incoming, makeFieldFunctionOptions(this,
|
|
1618
|
+
return merge(existing, incoming, makeFieldFunctionOptions(this,
|
|
1619
|
+
void 0, {
|
|
1643
1620
|
typename: typename,
|
|
1644
1621
|
fieldName: field.name.value,
|
|
1645
1622
|
field: field,
|
|
@@ -1727,13 +1704,13 @@ function getContextFlavor(context, clientOnly, deferred) {
|
|
|
1727
1704
|
var flavored = context.flavors.get(key);
|
|
1728
1705
|
if (!flavored) {
|
|
1729
1706
|
context.flavors.set(key, (flavored =
|
|
1730
|
-
context.clientOnly === clientOnly && context.deferred === deferred
|
|
1731
|
-
|
|
1707
|
+
context.clientOnly === clientOnly && context.deferred === deferred ?
|
|
1708
|
+
context
|
|
1732
1709
|
: tslib.__assign(tslib.__assign({}, context), { clientOnly: clientOnly, deferred: deferred })));
|
|
1733
1710
|
}
|
|
1734
1711
|
return flavored;
|
|
1735
1712
|
}
|
|
1736
|
-
var StoreWriter =
|
|
1713
|
+
var StoreWriter = (function () {
|
|
1737
1714
|
function StoreWriter(cache, reader, fragments) {
|
|
1738
1715
|
this.cache = cache;
|
|
1739
1716
|
this.reader = reader;
|
|
@@ -1797,7 +1774,8 @@ var StoreWriter = (function () {
|
|
|
1797
1774
|
};
|
|
1798
1775
|
StoreWriter.prototype.processSelectionSet = function (_a) {
|
|
1799
1776
|
var _this = this;
|
|
1800
|
-
var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context,
|
|
1777
|
+
var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context,
|
|
1778
|
+
mergeTree = _a.mergeTree;
|
|
1801
1779
|
var policies = this.cache.policies;
|
|
1802
1780
|
var incoming = Object.create(null);
|
|
1803
1781
|
var typename = (dataId && policies.rootTypenamesById[dataId]) ||
|
|
@@ -1820,7 +1798,8 @@ var StoreWriter = (function () {
|
|
|
1820
1798
|
return policies.readField(options, context);
|
|
1821
1799
|
};
|
|
1822
1800
|
var fieldNodeSet = new Set();
|
|
1823
|
-
this.flattenFields(selectionSet, result,
|
|
1801
|
+
this.flattenFields(selectionSet, result,
|
|
1802
|
+
context, typename).forEach(function (context, field) {
|
|
1824
1803
|
var _a;
|
|
1825
1804
|
var resultFieldKey = utilities.resultKeyNameFromField(field);
|
|
1826
1805
|
var value = result[resultFieldKey];
|
|
@@ -1833,8 +1812,9 @@ var StoreWriter = (function () {
|
|
|
1833
1812
|
variables: context.variables,
|
|
1834
1813
|
});
|
|
1835
1814
|
var childTree = getChildMergeTree(mergeTree, storeFieldName);
|
|
1836
|
-
var incomingValue = _this.processFieldValue(value, field,
|
|
1837
|
-
|
|
1815
|
+
var incomingValue = _this.processFieldValue(value, field,
|
|
1816
|
+
field.selectionSet ?
|
|
1817
|
+
getContextFlavor(context, false, false)
|
|
1838
1818
|
: context, childTree);
|
|
1839
1819
|
var childTypename = void 0;
|
|
1840
1820
|
if (field.selectionSet &&
|
|
@@ -1933,7 +1913,8 @@ var StoreWriter = (function () {
|
|
|
1933
1913
|
var policies = this.cache.policies;
|
|
1934
1914
|
var limitingTrie = new trie.Trie(false);
|
|
1935
1915
|
(function flatten(selectionSet, inheritedContext) {
|
|
1936
|
-
var visitedNode = limitingTrie.lookup(selectionSet,
|
|
1916
|
+
var visitedNode = limitingTrie.lookup(selectionSet,
|
|
1917
|
+
inheritedContext.clientOnly, inheritedContext.deferred);
|
|
1937
1918
|
if (visitedNode.visited)
|
|
1938
1919
|
return;
|
|
1939
1920
|
visitedNode.visited = true;
|
|
@@ -1941,7 +1922,8 @@ var StoreWriter = (function () {
|
|
|
1941
1922
|
if (!utilities.shouldInclude(selection, context.variables))
|
|
1942
1923
|
return;
|
|
1943
1924
|
var clientOnly = inheritedContext.clientOnly, deferred = inheritedContext.deferred;
|
|
1944
|
-
if (
|
|
1925
|
+
if (
|
|
1926
|
+
!(clientOnly && deferred) &&
|
|
1945
1927
|
utilities.isNonEmptyArray(selection.directives)) {
|
|
1946
1928
|
selection.directives.forEach(function (dir) {
|
|
1947
1929
|
var name = dir.name.value;
|
|
@@ -1981,9 +1963,10 @@ var StoreWriter = (function () {
|
|
|
1981
1963
|
var _a;
|
|
1982
1964
|
var _this = this;
|
|
1983
1965
|
if (mergeTree.map.size && !utilities.isReference(incoming)) {
|
|
1984
|
-
var e_1 =
|
|
1985
|
-
|
|
1986
|
-
|
|
1966
|
+
var e_1 =
|
|
1967
|
+
(!utilities.isArray(incoming) &&
|
|
1968
|
+
(utilities.isReference(existing) || storeValueIsStoreObject(existing))) ?
|
|
1969
|
+
existing
|
|
1987
1970
|
: void 0;
|
|
1988
1971
|
var i_1 = incoming;
|
|
1989
1972
|
if (e_1 && !getStorageArgs) {
|
|
@@ -1991,11 +1974,11 @@ var StoreWriter = (function () {
|
|
|
1991
1974
|
}
|
|
1992
1975
|
var changedFields_1;
|
|
1993
1976
|
var getValue_1 = function (from, name) {
|
|
1994
|
-
return utilities.isArray(from)
|
|
1995
|
-
|
|
1996
|
-
|
|
1977
|
+
return (utilities.isArray(from) ?
|
|
1978
|
+
typeof name === "number" ?
|
|
1979
|
+
from[name]
|
|
1997
1980
|
: void 0
|
|
1998
|
-
: context.store.getFieldValue(from, String(name));
|
|
1981
|
+
: context.store.getFieldValue(from, String(name)));
|
|
1999
1982
|
};
|
|
2000
1983
|
mergeTree.map.forEach(function (childTree, storeFieldName) {
|
|
2001
1984
|
var eVal = getValue_1(e_1, storeFieldName);
|
|
@@ -2041,13 +2024,10 @@ function mergeMergeTrees(left, right) {
|
|
|
2041
2024
|
return left;
|
|
2042
2025
|
if (!left || mergeTreeIsEmpty(left))
|
|
2043
2026
|
return right;
|
|
2044
|
-
var info = left.info && right.info
|
|
2045
|
-
? tslib.__assign(tslib.__assign({}, left.info), right.info) : left.info || right.info;
|
|
2027
|
+
var info = left.info && right.info ? tslib.__assign(tslib.__assign({}, left.info), right.info) : left.info || right.info;
|
|
2046
2028
|
var needToMergeMaps = left.map.size && right.map.size;
|
|
2047
|
-
var map = needToMergeMaps
|
|
2048
|
-
?
|
|
2049
|
-
: left.map.size
|
|
2050
|
-
? left.map
|
|
2029
|
+
var map = needToMergeMaps ? new Map()
|
|
2030
|
+
: left.map.size ? left.map
|
|
2051
2031
|
: right.map;
|
|
2052
2032
|
var merged = { info: info, map: map };
|
|
2053
2033
|
if (needToMergeMaps) {
|
|
@@ -2108,14 +2088,14 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
2108
2088
|
}
|
|
2109
2089
|
});
|
|
2110
2090
|
}
|
|
2111
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(14, fieldName, parentType, childTypenames.length
|
|
2112
|
-
|
|
2091
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(14, fieldName, parentType, childTypenames.length ?
|
|
2092
|
+
"either ensure all objects of type " +
|
|
2113
2093
|
childTypenames.join(" and ") +
|
|
2114
2094
|
" have an ID or a custom merge function, or "
|
|
2115
2095
|
: "", typeDotName, existing, incoming);
|
|
2116
2096
|
}
|
|
2117
2097
|
|
|
2118
|
-
var InMemoryCache =
|
|
2098
|
+
var InMemoryCache = (function (_super) {
|
|
2119
2099
|
tslib.__extends(InMemoryCache, _super);
|
|
2120
2100
|
function InMemoryCache(config) {
|
|
2121
2101
|
if (config === void 0) { config = {}; }
|
|
@@ -2153,9 +2133,7 @@ var InMemoryCache = (function (_super) {
|
|
|
2153
2133
|
addTypename: this.addTypename,
|
|
2154
2134
|
resultCacheMaxSize: this.config.resultCacheMaxSize,
|
|
2155
2135
|
canonizeResults: shouldCanonizeResults(this.config),
|
|
2156
|
-
canon: resetResultIdentities
|
|
2157
|
-
? void 0
|
|
2158
|
-
: previousReader && previousReader.canon,
|
|
2136
|
+
canon: resetResultIdentities ? void 0 : (previousReader && previousReader.canon),
|
|
2159
2137
|
fragments: fragments,
|
|
2160
2138
|
})), fragments);
|
|
2161
2139
|
this.maybeBroadcastWatch = optimism.wrap(function (c, options) {
|
|
@@ -2166,7 +2144,8 @@ var InMemoryCache = (function (_super) {
|
|
|
2166
2144
|
var store = c.optimistic ? _this.optimisticData : _this.data;
|
|
2167
2145
|
if (supportsResultCaching(store)) {
|
|
2168
2146
|
var optimistic = c.optimistic, id = c.id, variables = c.variables;
|
|
2169
|
-
return store.makeCacheKey(c.query,
|
|
2147
|
+
return store.makeCacheKey(c.query,
|
|
2148
|
+
c.callback, canonicalStringify({ optimistic: optimistic, id: id, variables: variables }));
|
|
2170
2149
|
}
|
|
2171
2150
|
},
|
|
2172
2151
|
});
|
|
@@ -2185,7 +2164,9 @@ var InMemoryCache = (function (_super) {
|
|
|
2185
2164
|
return (optimistic ? this.optimisticData : this.data).extract();
|
|
2186
2165
|
};
|
|
2187
2166
|
InMemoryCache.prototype.read = function (options) {
|
|
2188
|
-
var
|
|
2167
|
+
var
|
|
2168
|
+
_a = options.returnPartialData,
|
|
2169
|
+
returnPartialData = _a === void 0 ? false : _a;
|
|
2189
2170
|
try {
|
|
2190
2171
|
return (this.storeReader.diffQueryAgainstStore(tslib.__assign(tslib.__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, config: this.config, returnPartialData: returnPartialData })).result || null);
|
|
2191
2172
|
}
|
|
@@ -2211,8 +2192,9 @@ var InMemoryCache = (function (_super) {
|
|
|
2211
2192
|
if (hasOwn.call(options, "id") && !options.id) {
|
|
2212
2193
|
return false;
|
|
2213
2194
|
}
|
|
2214
|
-
var store = options.optimistic
|
|
2215
|
-
|
|
2195
|
+
var store = ((options.optimistic)
|
|
2196
|
+
) ?
|
|
2197
|
+
this.optimisticData
|
|
2216
2198
|
: this.data;
|
|
2217
2199
|
try {
|
|
2218
2200
|
++this.txCount;
|
|
@@ -2416,8 +2398,7 @@ function createFragmentRegistry() {
|
|
|
2416
2398
|
}
|
|
2417
2399
|
return new (FragmentRegistry.bind.apply(FragmentRegistry, tslib.__spreadArray([void 0], fragments, false)))();
|
|
2418
2400
|
}
|
|
2419
|
-
var
|
|
2420
|
-
var FragmentRegistry = (function () {
|
|
2401
|
+
var FragmentRegistry = (function () {
|
|
2421
2402
|
function FragmentRegistry() {
|
|
2422
2403
|
var fragments = [];
|
|
2423
2404
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -2431,8 +2412,12 @@ var FragmentRegistry = (function () {
|
|
|
2431
2412
|
}
|
|
2432
2413
|
FragmentRegistry.prototype.register = function () {
|
|
2433
2414
|
var _this = this;
|
|
2415
|
+
var fragments = [];
|
|
2416
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2417
|
+
fragments[_i] = arguments[_i];
|
|
2418
|
+
}
|
|
2434
2419
|
var definitions = new Map();
|
|
2435
|
-
|
|
2420
|
+
fragments.forEach(function (doc) {
|
|
2436
2421
|
utilities.getFragmentDefinitions(doc).forEach(function (node) {
|
|
2437
2422
|
definitions.set(node.name.value, node);
|
|
2438
2423
|
});
|
|
@@ -2447,16 +2432,12 @@ var FragmentRegistry = (function () {
|
|
|
2447
2432
|
};
|
|
2448
2433
|
FragmentRegistry.prototype.invalidate = function (name) { };
|
|
2449
2434
|
FragmentRegistry.prototype.resetCaches = function () {
|
|
2450
|
-
this.invalidate = (this.lookup = this.cacheUnaryMethod(
|
|
2451
|
-
this.transform = this.cacheUnaryMethod(
|
|
2452
|
-
this.findFragmentSpreads = this.cacheUnaryMethod(
|
|
2453
|
-
};
|
|
2454
|
-
FragmentRegistry.prototype.cacheUnaryMethod = function (
|
|
2455
|
-
|
|
2456
|
-
var originalMethod = FragmentRegistry.prototype[name];
|
|
2457
|
-
return optimism.wrap(function () {
|
|
2458
|
-
return originalMethod.apply(registry, arguments);
|
|
2459
|
-
}, {
|
|
2435
|
+
this.invalidate = (this.lookup = this.cacheUnaryMethod(this.lookup)).dirty;
|
|
2436
|
+
this.transform = this.cacheUnaryMethod(this.transform);
|
|
2437
|
+
this.findFragmentSpreads = this.cacheUnaryMethod(this.findFragmentSpreads);
|
|
2438
|
+
};
|
|
2439
|
+
FragmentRegistry.prototype.cacheUnaryMethod = function (originalMethod) {
|
|
2440
|
+
return optimism.wrap(originalMethod.bind(this), {
|
|
2460
2441
|
makeCacheKey: function (arg) { return arg; },
|
|
2461
2442
|
});
|
|
2462
2443
|
};
|