@apollo/client 3.9.0-alpha.4 → 3.9.0-beta.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/.changeset/README.md +8 -0
- package/.changeset/beige-geese-wink.md +5 -0
- package/.changeset/breezy-spiders-tap.md +38 -0
- package/.changeset/clean-items-smash.md +5 -0
- package/.changeset/cold-llamas-turn.md +8 -0
- package/.changeset/config.json +14 -0
- package/.changeset/dirty-kids-crash.md +5 -0
- package/.changeset/dirty-tigers-matter.md +13 -0
- package/.changeset/forty-cups-shop.md +5 -0
- package/.changeset/friendly-clouds-laugh.md +7 -0
- package/.changeset/hot-ducks-burn.md +5 -0
- package/.changeset/mighty-coats-check.md +47 -0
- package/.changeset/polite-avocados-warn.md +5 -0
- package/.changeset/pre.json +37 -0
- package/.changeset/quick-hats-marry.md +5 -0
- package/.changeset/rare-snakes-melt.md +24 -0
- package/.changeset/shaggy-ears-scream.md +5 -0
- package/.changeset/shaggy-sheep-pull.md +5 -0
- package/.changeset/sixty-boxes-rest.md +8 -0
- package/.changeset/sour-sheep-walk.md +7 -0
- package/.changeset/strong-terms-perform.md +46 -0
- package/.changeset/swift-zoos-collect.md +19 -0
- package/.changeset/thick-mice-collect.md +5 -0
- package/.changeset/thick-tips-cry.md +9 -0
- package/.changeset/thirty-ties-arrive.md +26 -0
- package/.changeset/tough-timers-begin.md +8 -0
- package/.changeset/unlucky-rats-decide.md +5 -0
- package/.changeset/violet-lions-draw.md +5 -0
- package/.changeset/wet-forks-rhyme.md +5 -0
- package/.changeset/wild-dolphins-jog.md +5 -0
- package/.changeset/yellow-flies-repeat.md +5 -0
- package/CHANGELOG.md +3649 -0
- package/apollo-client.cjs +775 -451
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +210 -156
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +210 -156
- package/cache/core/cache.d.ts +19 -0
- package/cache/core/cache.js +28 -7
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +8 -1
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +104 -0
- package/cache/core/types/DataProxy.js.map +1 -1
- package/cache/core/types/common.d.ts +5 -1
- package/cache/core/types/common.js +4 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +10 -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.d.ts +1 -0
- package/cache/inmemory/fragmentRegistry.js +39 -14
- 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.d.ts +9 -0
- package/cache/inmemory/inMemoryCache.js +172 -10
- 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 +87 -3
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.js +190 -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 +65 -12
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +46 -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 +273 -3
- package/core/ApolloClient.js +239 -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 +27 -0
- package/core/ObservableQuery.js +246 -31
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +4 -3
- package/core/QueryInfo.js +122 -13
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +9 -2
- package/core/QueryManager.js +259 -53
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +222 -122
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +222 -122
- 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 +245 -2
- package/core/watchQueryOptions.js.map +1 -1
- package/dev/dev.cjs +10 -119
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +10 -119
- 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 +6 -8
- 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.d.ts +15 -0
- package/link/core/ApolloLink.js +20 -9
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/core.cjs +13 -9
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +13 -9
- 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.d.ts +11 -1
- package/link/persisted-queries/index.js +62 -7
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +30 -7
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +30 -7
- package/link/remove-typename/remove-typename.cjs +30 -11
- package/link/remove-typename/remove-typename.cjs.map +1 -1
- package/link/remove-typename/remove-typename.cjs.native.js +30 -11
- package/link/remove-typename/removeTypenameFromVariables.d.ts +9 -1
- package/link/remove-typename/removeTypenameFromVariables.js +31 -12
- 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 +53 -41
- package/react/cache/QueryReference.d.ts +27 -13
- package/react/cache/QueryReference.js +122 -42
- package/react/cache/QueryReference.js.map +1 -1
- package/react/cache/SuspenseCache.d.ts +10 -0
- package/react/cache/SuspenseCache.js +1 -2
- package/react/cache/SuspenseCache.js.map +1 -1
- package/react/cache/getSuspenseCache.js.map +1 -1
- package/react/cache/types.d.ts +3 -0
- package/react/cache/types.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 +230 -98
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +230 -98
- package/react/hooks/index.d.ts +4 -0
- package/react/hooks/index.js +2 -0
- package/react/hooks/index.js.map +1 -1
- package/react/hooks/internal/__use.js +5 -0
- package/react/hooks/internal/__use.js.map +1 -1
- package/react/hooks/internal/index.d.ts +1 -0
- package/react/hooks/internal/index.js +2 -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/internal/useRenderGuard.d.ts +2 -0
- package/react/hooks/internal/useRenderGuard.js +17 -0
- package/react/hooks/internal/useRenderGuard.js.map +1 -0
- package/react/hooks/useBackgroundQuery.d.ts +12 -9
- package/react/hooks/useBackgroundQuery.js +14 -11
- 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/useLoadableQuery.d.ts +30 -0
- package/react/hooks/useLoadableQuery.js +61 -0
- package/react/hooks/useLoadableQuery.js.map +1 -0
- 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 +138 -6
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useQueryRefHandlers.d.ts +35 -0
- package/react/hooks/useQueryRefHandlers.js +48 -0
- package/react/hooks/useQueryRefHandlers.js.map +1 -0
- 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 +9 -9
- 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 +22 -22
- 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/index.d.ts +2 -0
- package/react/index.js +1 -0
- package/react/index.js.map +1 -1
- package/react/parser/index.d.ts +3 -0
- package/react/parser/index.js +16 -6
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +19 -5
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +19 -5
- package/react/query-preloader/createQueryPreloader.d.ts +253 -0
- package/react/query-preloader/createQueryPreloader.js +29 -0
- package/react/query-preloader/createQueryPreloader.js.map +1 -0
- package/react/react.cjs +248 -1
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +248 -1
- 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 +129 -1
- package/react/types/types.js.map +1 -1
- 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.d.ts +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/disableActWarnings.d.ts +10 -0
- package/testing/internal/disposables/disableActWarnings.js +15 -0
- package/testing/internal/disposables/disableActWarnings.js.map +1 -0
- package/testing/internal/disposables/index.d.ts +1 -0
- package/testing/internal/disposables/index.js +1 -0
- package/testing/internal/disposables/index.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/index.d.ts +4 -0
- package/testing/internal/index.js +2 -0
- package/testing/internal/index.js.map +1 -1
- package/testing/internal/profile/Render.d.ts +32 -1
- package/testing/internal/profile/Render.js +14 -2
- package/testing/internal/profile/Render.js.map +1 -1
- package/testing/internal/profile/context.d.ts +10 -0
- package/testing/internal/profile/context.js +14 -0
- package/testing/internal/profile/context.js.map +1 -0
- package/testing/internal/profile/index.d.ts +2 -2
- package/testing/internal/profile/index.js +1 -1
- package/testing/internal/profile/index.js.map +1 -1
- package/testing/internal/profile/profile.d.ts +67 -13
- package/testing/internal/profile/profile.js +153 -79
- 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/internal/renderHelpers.d.ts +12 -0
- package/testing/internal/renderHelpers.js +22 -0
- package/testing/internal/renderHelpers.js.map +1 -0
- package/testing/internal/scenarios/index.d.ts +41 -0
- package/testing/internal/scenarios/index.js +46 -0
- package/testing/internal/scenarios/index.js.map +1 -0
- package/testing/matchers/ProfiledComponent.js +29 -26
- package/testing/matchers/ProfiledComponent.js.map +1 -1
- package/testing/matchers/index.js +4 -0
- package/testing/matchers/index.js.map +1 -1
- package/testing/matchers/toBeDisposed.d.ts +3 -0
- package/testing/matchers/toBeDisposed.js +26 -0
- package/testing/matchers/toBeDisposed.js.map +1 -0
- package/testing/matchers/toBeGarbageCollected.d.ts +8 -0
- package/testing/matchers/toBeGarbageCollected.js +48 -0
- package/testing/matchers/toBeGarbageCollected.js.map +1 -0
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map +1 -1
- package/testing/matchers/toMatchDocument.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +5 -1
- 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/caching/caches.d.ts +34 -0
- package/utilities/caching/caches.js +64 -0
- package/utilities/caching/caches.js.map +1 -0
- package/utilities/caching/getMemoryInternals.d.ts +76 -0
- package/utilities/caching/getMemoryInternals.js +112 -0
- package/utilities/caching/getMemoryInternals.js.map +1 -0
- package/utilities/caching/index.d.ts +4 -0
- package/utilities/caching/index.js +3 -0
- package/utilities/caching/index.js.map +1 -0
- package/utilities/caching/sizes.d.ts +261 -0
- package/utilities/caching/sizes.js +27 -0
- package/utilities/caching/sizes.js.map +1 -0
- package/utilities/common/arrays.js +1 -0
- package/utilities/common/arrays.js.map +1 -1
- package/utilities/common/canUse.js +17 -2
- package/utilities/common/canUse.js.map +1 -1
- package/utilities/common/canonicalStringify.d.ts +17 -0
- package/utilities/common/canonicalStringify.js +49 -2
- package/utilities/common/canonicalStringify.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.d.ts +20 -6
- package/utilities/graphql/DocumentTransform.js +54 -29
- 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 +8 -5
- package/utilities/graphql/print.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts +14 -0
- package/utilities/graphql/storeUtils.js +8 -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/index.d.ts +4 -0
- package/utilities/index.js +1 -0
- package/utilities/index.js.map +1 -1
- package/utilities/observables/Concast.d.ts +1 -1
- package/utilities/observables/Concast.js +85 -2
- 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/subscriptions/relay/index.js.map +1 -1
- package/utilities/subscriptions/relay/relay.cjs +9 -8
- package/utilities/subscriptions/relay/relay.cjs.map +1 -1
- package/utilities/subscriptions/relay/relay.cjs.native.js +9 -8
- package/utilities/subscriptions/urql/index.js.map +1 -1
- package/utilities/subscriptions/urql/urql.cjs +9 -8
- package/utilities/subscriptions/urql/urql.cjs.map +1 -1
- package/utilities/subscriptions/urql/urql.cjs.native.js +9 -8
- 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/OnlyRequiredProperties.d.ts +7 -0
- package/utilities/types/OnlyRequiredProperties.js +2 -0
- package/utilities/types/OnlyRequiredProperties.js.map +1 -0
- 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 +114 -58
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +114 -58
- 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/canonicalStringify.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/subscriptions/relay/index.d.ts.map +0 -1
- package/utilities/subscriptions/shared.d.ts.map +0 -1
- package/utilities/subscriptions/urql/index.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
|
@@ -6,22 +6,69 @@ var globals = require('../utilities/globals');
|
|
|
6
6
|
var tslib = require('tslib');
|
|
7
7
|
var optimism = require('optimism');
|
|
8
8
|
var utilities = require('../utilities');
|
|
9
|
+
var caches = require('@wry/caches');
|
|
9
10
|
var equality = require('@wry/equality');
|
|
10
11
|
var trie = require('@wry/trie');
|
|
11
12
|
var graphql = require('graphql');
|
|
12
|
-
var context = require('@wry/context');
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var getInMemoryCacheMemoryInternals = globalThis.__DEV__ !== false ?
|
|
15
|
+
_getInMemoryCacheMemoryInternals
|
|
16
|
+
: undefined;
|
|
17
|
+
var getApolloCacheMemoryInternals = globalThis.__DEV__ !== false ?
|
|
18
|
+
_getApolloCacheMemoryInternals
|
|
19
|
+
: undefined;
|
|
20
|
+
function _getApolloCacheMemoryInternals() {
|
|
21
|
+
return {
|
|
22
|
+
cache: {
|
|
23
|
+
fragmentQueryDocuments: getWrapperInformation(this["getFragmentDoc"]),
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function _getInMemoryCacheMemoryInternals() {
|
|
28
|
+
var fragments = this.config.fragments;
|
|
29
|
+
return tslib.__assign(tslib.__assign({}, _getApolloCacheMemoryInternals.apply(this)), { addTypenameDocumentTransform: transformInfo(this["addTypenameTransform"]), inMemoryCache: {
|
|
30
|
+
executeSelectionSet: getWrapperInformation(this["storeReader"]["executeSelectionSet"]),
|
|
31
|
+
executeSubSelectedArray: getWrapperInformation(this["storeReader"]["executeSubSelectedArray"]),
|
|
32
|
+
maybeBroadcastWatch: getWrapperInformation(this["maybeBroadcastWatch"]),
|
|
33
|
+
}, fragmentRegistry: {
|
|
34
|
+
findFragmentSpreads: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.findFragmentSpreads),
|
|
35
|
+
lookup: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.lookup),
|
|
36
|
+
transform: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.transform),
|
|
37
|
+
} });
|
|
38
|
+
}
|
|
39
|
+
function isWrapper(f) {
|
|
40
|
+
return !!f && "dirtyKey" in f;
|
|
41
|
+
}
|
|
42
|
+
function getWrapperInformation(f) {
|
|
43
|
+
return isWrapper(f) ? f.size : undefined;
|
|
44
|
+
}
|
|
45
|
+
function isDefined(value) {
|
|
46
|
+
return value != null;
|
|
47
|
+
}
|
|
48
|
+
function transformInfo(transform) {
|
|
49
|
+
return recurseTransformInfo(transform).map(function (cache) { return ({ cache: cache }); });
|
|
50
|
+
}
|
|
51
|
+
function recurseTransformInfo(transform) {
|
|
52
|
+
return transform ?
|
|
53
|
+
tslib.__spreadArray(tslib.__spreadArray([
|
|
54
|
+
getWrapperInformation(transform === null || transform === void 0 ? void 0 : transform["performWork"])
|
|
55
|
+
], recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform["left"]), true), recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform["right"]), true).filter(isDefined)
|
|
56
|
+
: [];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
var ApolloCache = (function () {
|
|
15
60
|
function ApolloCache() {
|
|
16
61
|
this.assumeImmutableResults = false;
|
|
17
|
-
this.getFragmentDoc = optimism.wrap(utilities.getFragmentQueryDocument
|
|
62
|
+
this.getFragmentDoc = optimism.wrap(utilities.getFragmentQueryDocument, {
|
|
63
|
+
max: utilities.cacheSizes["cache.fragmentQueryDocuments"] ||
|
|
64
|
+
1000 ,
|
|
65
|
+
cache: caches.WeakCache,
|
|
66
|
+
});
|
|
18
67
|
}
|
|
19
68
|
ApolloCache.prototype.batch = function (options) {
|
|
20
69
|
var _this = this;
|
|
21
|
-
var optimisticId = typeof options.optimistic === "string"
|
|
22
|
-
|
|
23
|
-
: options.optimistic === false
|
|
24
|
-
? null
|
|
70
|
+
var optimisticId = typeof options.optimistic === "string" ? options.optimistic
|
|
71
|
+
: options.optimistic === false ? null
|
|
25
72
|
: void 0;
|
|
26
73
|
var updateResult;
|
|
27
74
|
this.performTransaction(function () { return (updateResult = options.update(_this)); }, optimisticId);
|
|
@@ -94,12 +141,15 @@ var ApolloCache = (function () {
|
|
|
94
141
|
};
|
|
95
142
|
return ApolloCache;
|
|
96
143
|
}());
|
|
144
|
+
if (globalThis.__DEV__ !== false) {
|
|
145
|
+
ApolloCache.prototype.getMemoryInternals = getApolloCacheMemoryInternals;
|
|
146
|
+
}
|
|
97
147
|
|
|
98
148
|
exports.Cache = void 0;
|
|
99
149
|
(function (Cache) {
|
|
100
150
|
})(exports.Cache || (exports.Cache = {}));
|
|
101
151
|
|
|
102
|
-
var MissingFieldError =
|
|
152
|
+
var MissingFieldError = (function (_super) {
|
|
103
153
|
tslib.__extends(MissingFieldError, _super);
|
|
104
154
|
function MissingFieldError(message, path, query, variables) {
|
|
105
155
|
var _a;
|
|
@@ -131,18 +181,17 @@ function defaultDataIdFromObject(_a, context) {
|
|
|
131
181
|
var __typename = _a.__typename, id = _a.id, _id = _a._id;
|
|
132
182
|
if (typeof __typename === "string") {
|
|
133
183
|
if (context) {
|
|
134
|
-
context.keyObject =
|
|
135
|
-
? { id: id }
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
: void 0;
|
|
184
|
+
context.keyObject =
|
|
185
|
+
!isNullish(id) ? { id: id }
|
|
186
|
+
: !isNullish(_id) ? { _id: _id }
|
|
187
|
+
: void 0;
|
|
139
188
|
}
|
|
140
189
|
if (isNullish(id) && !isNullish(_id)) {
|
|
141
190
|
id = _id;
|
|
142
191
|
}
|
|
143
192
|
if (!isNullish(id)) {
|
|
144
|
-
return "".concat(__typename, ":").concat(typeof id === "number" || typeof id === "string"
|
|
145
|
-
|
|
193
|
+
return "".concat(__typename, ":").concat(typeof id === "number" || typeof id === "string" ?
|
|
194
|
+
id
|
|
146
195
|
: JSON.stringify(id));
|
|
147
196
|
}
|
|
148
197
|
}
|
|
@@ -161,8 +210,8 @@ function shouldCanonizeResults(config) {
|
|
|
161
210
|
return value === void 0 ? defaultConfig.canonizeResults : value;
|
|
162
211
|
}
|
|
163
212
|
function getTypenameFromStoreObject(store, objectOrReference) {
|
|
164
|
-
return utilities.isReference(objectOrReference)
|
|
165
|
-
|
|
213
|
+
return utilities.isReference(objectOrReference) ?
|
|
214
|
+
store.get(objectOrReference.__ref, "__typename")
|
|
166
215
|
: objectOrReference && objectOrReference.__typename;
|
|
167
216
|
}
|
|
168
217
|
var TypeOrFieldNameRegExp = /^[_a-z][_0-9a-z]*/i;
|
|
@@ -172,8 +221,8 @@ function fieldNameFromStoreName(storeFieldName) {
|
|
|
172
221
|
}
|
|
173
222
|
function selectionSetMatchesResult(selectionSet, result, variables) {
|
|
174
223
|
if (utilities.isNonNullObject(result)) {
|
|
175
|
-
return utilities.isArray(result)
|
|
176
|
-
|
|
224
|
+
return utilities.isArray(result) ?
|
|
225
|
+
result.every(function (item) {
|
|
177
226
|
return selectionSetMatchesResult(selectionSet, item, variables);
|
|
178
227
|
})
|
|
179
228
|
: selectionSet.selections.every(function (field) {
|
|
@@ -211,7 +260,7 @@ function extractFragmentContext(document, fragments) {
|
|
|
211
260
|
var DELETE = Object.create(null);
|
|
212
261
|
var delModifier = function () { return DELETE; };
|
|
213
262
|
var INVALIDATE = Object.create(null);
|
|
214
|
-
exports.EntityStore =
|
|
263
|
+
exports.EntityStore = (function () {
|
|
215
264
|
function EntityStore(policies, group) {
|
|
216
265
|
var _this = this;
|
|
217
266
|
this.policies = policies;
|
|
@@ -220,13 +269,13 @@ exports.EntityStore = (function () {
|
|
|
220
269
|
this.rootIds = Object.create(null);
|
|
221
270
|
this.refs = Object.create(null);
|
|
222
271
|
this.getFieldValue = function (objectOrReference, storeFieldName) {
|
|
223
|
-
return utilities.maybeDeepFreeze(utilities.isReference(objectOrReference)
|
|
224
|
-
|
|
272
|
+
return utilities.maybeDeepFreeze(utilities.isReference(objectOrReference) ?
|
|
273
|
+
_this.get(objectOrReference.__ref, storeFieldName)
|
|
225
274
|
: objectOrReference && objectOrReference[storeFieldName]);
|
|
226
275
|
};
|
|
227
276
|
this.canRead = function (objOrRef) {
|
|
228
|
-
return utilities.isReference(objOrRef)
|
|
229
|
-
|
|
277
|
+
return utilities.isReference(objOrRef) ?
|
|
278
|
+
_this.has(objOrRef.__ref)
|
|
230
279
|
: typeof objOrRef === "object";
|
|
231
280
|
};
|
|
232
281
|
this.toReference = function (objOrIdOrRef, mergeIntoStore) {
|
|
@@ -340,8 +389,8 @@ exports.EntityStore = (function () {
|
|
|
340
389
|
toReference: this.toReference,
|
|
341
390
|
canRead: this.canRead,
|
|
342
391
|
readField: function (fieldNameOrOptions, from) {
|
|
343
|
-
return _this.policies.readField(typeof fieldNameOrOptions === "string"
|
|
344
|
-
|
|
392
|
+
return _this.policies.readField(typeof fieldNameOrOptions === "string" ?
|
|
393
|
+
{
|
|
345
394
|
fieldName: fieldNameOrOptions,
|
|
346
395
|
from: from || utilities.makeReference(dataId),
|
|
347
396
|
}
|
|
@@ -353,13 +402,9 @@ exports.EntityStore = (function () {
|
|
|
353
402
|
var fieldValue = storeObject[storeFieldName];
|
|
354
403
|
if (fieldValue === void 0)
|
|
355
404
|
return;
|
|
356
|
-
var modify = typeof fields === "function"
|
|
357
|
-
? fields
|
|
358
|
-
: fields[storeFieldName] || fields[fieldName];
|
|
405
|
+
var modify = typeof fields === "function" ? fields : (fields[storeFieldName] || fields[fieldName]);
|
|
359
406
|
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) }));
|
|
407
|
+
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
408
|
if (newValue === INVALIDATE) {
|
|
364
409
|
_this.group.dirty(dataId, storeFieldName);
|
|
365
410
|
}
|
|
@@ -433,13 +478,12 @@ exports.EntityStore = (function () {
|
|
|
433
478
|
var storeObject = this.lookup(dataId);
|
|
434
479
|
if (storeObject) {
|
|
435
480
|
var typename = this.getFieldValue(storeObject, "__typename");
|
|
436
|
-
var storeFieldName = fieldName && args
|
|
437
|
-
|
|
481
|
+
var storeFieldName = fieldName && args ?
|
|
482
|
+
this.policies.getStoreFieldName({ typename: typename, fieldName: fieldName, args: args })
|
|
438
483
|
: fieldName;
|
|
439
|
-
return this.modify(dataId, storeFieldName
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
_a) : delModifier);
|
|
484
|
+
return this.modify(dataId, storeFieldName ? (_a = {},
|
|
485
|
+
_a[storeFieldName] = delModifier,
|
|
486
|
+
_a) : delModifier);
|
|
443
487
|
}
|
|
444
488
|
return false;
|
|
445
489
|
};
|
|
@@ -562,7 +606,7 @@ exports.EntityStore = (function () {
|
|
|
562
606
|
};
|
|
563
607
|
return EntityStore;
|
|
564
608
|
}());
|
|
565
|
-
var CacheGroup =
|
|
609
|
+
var CacheGroup = (function () {
|
|
566
610
|
function CacheGroup(caching, parent) {
|
|
567
611
|
if (parent === void 0) { parent = null; }
|
|
568
612
|
this.caching = caching;
|
|
@@ -588,7 +632,8 @@ var CacheGroup = (function () {
|
|
|
588
632
|
};
|
|
589
633
|
CacheGroup.prototype.dirty = function (dataId, storeFieldName) {
|
|
590
634
|
if (this.d) {
|
|
591
|
-
this.d.dirty(makeDepKey(dataId, storeFieldName),
|
|
635
|
+
this.d.dirty(makeDepKey(dataId, storeFieldName),
|
|
636
|
+
storeFieldName === "__exists" ? "forget" : "setDirty");
|
|
592
637
|
}
|
|
593
638
|
};
|
|
594
639
|
return CacheGroup;
|
|
@@ -602,7 +647,7 @@ function maybeDependOnExistenceOfEntity(store, entityId) {
|
|
|
602
647
|
}
|
|
603
648
|
}
|
|
604
649
|
(function (EntityStore) {
|
|
605
|
-
var Root =
|
|
650
|
+
var Root = (function (_super) {
|
|
606
651
|
tslib.__extends(Root, _super);
|
|
607
652
|
function Root(_a) {
|
|
608
653
|
var policies = _a.policies, _b = _a.resultCaching, resultCaching = _b === void 0 ? true : _b, seed = _a.seed;
|
|
@@ -626,7 +671,7 @@ function maybeDependOnExistenceOfEntity(store, entityId) {
|
|
|
626
671
|
}(EntityStore));
|
|
627
672
|
EntityStore.Root = Root;
|
|
628
673
|
})(exports.EntityStore || (exports.EntityStore = {}));
|
|
629
|
-
var Layer =
|
|
674
|
+
var Layer = (function (_super) {
|
|
630
675
|
tslib.__extends(Layer, _super);
|
|
631
676
|
function Layer(id, parent, replay, group) {
|
|
632
677
|
var _this = _super.call(this, parent.policies, group) || this;
|
|
@@ -677,18 +722,18 @@ var Layer = (function (_super) {
|
|
|
677
722
|
};
|
|
678
723
|
Layer.prototype.findChildRefIds = function (dataId) {
|
|
679
724
|
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;
|
|
725
|
+
return hasOwn.call(this.data, dataId) ? tslib.__assign(tslib.__assign({}, fromParent), _super.prototype.findChildRefIds.call(this, dataId)) : fromParent;
|
|
682
726
|
};
|
|
683
727
|
Layer.prototype.getStorage = function () {
|
|
684
728
|
var p = this.parent;
|
|
685
729
|
while (p.parent)
|
|
686
730
|
p = p.parent;
|
|
687
|
-
return p.getStorage.apply(p,
|
|
731
|
+
return p.getStorage.apply(p,
|
|
732
|
+
arguments);
|
|
688
733
|
};
|
|
689
734
|
return Layer;
|
|
690
735
|
}(exports.EntityStore));
|
|
691
|
-
var Stump =
|
|
736
|
+
var Stump = (function (_super) {
|
|
692
737
|
tslib.__extends(Stump, _super);
|
|
693
738
|
function Stump(root) {
|
|
694
739
|
return _super.call(this, "EntityStore.Stump", root, function () { }, new CacheGroup(root.group.caching, root.group)) || this;
|
|
@@ -696,8 +741,8 @@ var Stump = (function (_super) {
|
|
|
696
741
|
Stump.prototype.removeLayer = function () {
|
|
697
742
|
return this;
|
|
698
743
|
};
|
|
699
|
-
Stump.prototype.merge = function () {
|
|
700
|
-
return this.parent.merge
|
|
744
|
+
Stump.prototype.merge = function (older, newer) {
|
|
745
|
+
return this.parent.merge(older, newer);
|
|
701
746
|
};
|
|
702
747
|
return Stump;
|
|
703
748
|
}(Layer));
|
|
@@ -712,13 +757,13 @@ function supportsResultCaching(store) {
|
|
|
712
757
|
|
|
713
758
|
function shallowCopy(value) {
|
|
714
759
|
if (utilities.isNonNullObject(value)) {
|
|
715
|
-
return utilities.isArray(value)
|
|
716
|
-
|
|
760
|
+
return utilities.isArray(value) ?
|
|
761
|
+
value.slice(0)
|
|
717
762
|
: tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value);
|
|
718
763
|
}
|
|
719
764
|
return value;
|
|
720
765
|
}
|
|
721
|
-
var ObjectCanon =
|
|
766
|
+
var ObjectCanon = (function () {
|
|
722
767
|
function ObjectCanon() {
|
|
723
768
|
this.known = new (utilities.canUseWeakSet ? WeakSet : Set)();
|
|
724
769
|
this.pool = new trie.Trie(utilities.canUseWeakMap);
|
|
@@ -810,7 +855,7 @@ function execSelectionSetKeyArgs(options) {
|
|
|
810
855
|
options.context.canonizeResults,
|
|
811
856
|
];
|
|
812
857
|
}
|
|
813
|
-
var StoreReader =
|
|
858
|
+
var StoreReader = (function () {
|
|
814
859
|
function StoreReader(config) {
|
|
815
860
|
var _this = this;
|
|
816
861
|
this.knownResults = new (utilities.canUseWeakMap ? WeakMap : Map)();
|
|
@@ -827,14 +872,17 @@ var StoreReader = (function () {
|
|
|
827
872
|
var other = (_a = _this.executeSelectionSet).peek.apply(_a, peekArgs);
|
|
828
873
|
if (other) {
|
|
829
874
|
if (canonizeResults) {
|
|
830
|
-
return tslib.__assign(tslib.__assign({}, other), {
|
|
875
|
+
return tslib.__assign(tslib.__assign({}, other), {
|
|
876
|
+
result: _this.canon.admit(other.result) });
|
|
831
877
|
}
|
|
832
878
|
return other;
|
|
833
879
|
}
|
|
834
880
|
maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref);
|
|
835
881
|
return _this.execSelectionSetImpl(options);
|
|
836
882
|
}, {
|
|
837
|
-
max: this.config.resultCacheMaxSize
|
|
883
|
+
max: this.config.resultCacheMaxSize ||
|
|
884
|
+
utilities.cacheSizes["inMemoryCache.executeSelectionSet"] ||
|
|
885
|
+
10000 ,
|
|
838
886
|
keyArgs: execSelectionSetKeyArgs,
|
|
839
887
|
makeCacheKey: function (selectionSet, parent, context, canonizeResults) {
|
|
840
888
|
if (supportsResultCaching(context.store)) {
|
|
@@ -846,7 +894,9 @@ var StoreReader = (function () {
|
|
|
846
894
|
maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref);
|
|
847
895
|
return _this.execSubSelectedArrayImpl(options);
|
|
848
896
|
}, {
|
|
849
|
-
max: this.config.resultCacheMaxSize
|
|
897
|
+
max: this.config.resultCacheMaxSize ||
|
|
898
|
+
utilities.cacheSizes["inMemoryCache.executeSubSelectedArray"] ||
|
|
899
|
+
5000 ,
|
|
850
900
|
makeCacheKey: function (_a) {
|
|
851
901
|
var field = _a.field, array = _a.array, context = _a.context;
|
|
852
902
|
if (supportsResultCaching(context.store)) {
|
|
@@ -887,7 +937,8 @@ var StoreReader = (function () {
|
|
|
887
937
|
StoreReader.prototype.isFresh = function (result, parent, selectionSet, context) {
|
|
888
938
|
if (supportsResultCaching(context.store) &&
|
|
889
939
|
this.knownResults.get(result) === selectionSet) {
|
|
890
|
-
var latest = this.executeSelectionSet.peek(selectionSet, parent, context,
|
|
940
|
+
var latest = this.executeSelectionSet.peek(selectionSet, parent, context,
|
|
941
|
+
this.canon.isKnown(result));
|
|
891
942
|
if (latest && result === latest.result) {
|
|
892
943
|
return true;
|
|
893
944
|
}
|
|
@@ -940,8 +991,8 @@ var StoreReader = (function () {
|
|
|
940
991
|
if (fieldValue === void 0) {
|
|
941
992
|
if (!utilities.addTypenameToDocument.added(selection)) {
|
|
942
993
|
missing = missingMerger.merge(missing, (_a = {},
|
|
943
|
-
_a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(utilities.isReference(objectOrReference)
|
|
944
|
-
|
|
994
|
+
_a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(utilities.isReference(objectOrReference) ?
|
|
995
|
+
objectOrReference.__ref + " object"
|
|
945
996
|
: "object " + JSON.stringify(objectOrReference, null, 2)),
|
|
946
997
|
_a));
|
|
947
998
|
}
|
|
@@ -983,10 +1034,9 @@ var StoreReader = (function () {
|
|
|
983
1034
|
});
|
|
984
1035
|
var result = utilities.mergeDeepArray(objectsToMerge);
|
|
985
1036
|
var finalResult = { result: result, missing: missing };
|
|
986
|
-
var frozen = context.canonizeResults
|
|
987
|
-
|
|
988
|
-
:
|
|
989
|
-
utilities.maybeDeepFreeze(finalResult);
|
|
1037
|
+
var frozen = context.canonizeResults ?
|
|
1038
|
+
this.canon.admit(finalResult)
|
|
1039
|
+
: utilities.maybeDeepFreeze(finalResult);
|
|
990
1040
|
if (frozen.result) {
|
|
991
1041
|
this.knownResults.set(frozen.result, selectionSet);
|
|
992
1042
|
}
|
|
@@ -1068,7 +1118,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
1068
1118
|
}
|
|
1069
1119
|
}
|
|
1070
1120
|
|
|
1071
|
-
var cacheSlot = new
|
|
1121
|
+
var cacheSlot = new optimism.Slot();
|
|
1072
1122
|
var cacheInfoMap = new WeakMap();
|
|
1073
1123
|
function getCacheInfo(cache) {
|
|
1074
1124
|
var info = cacheInfoMap.get(cache);
|
|
@@ -1144,7 +1194,8 @@ function keyFieldsFnFromSpecifier(specifier) {
|
|
|
1144
1194
|
return context.readField(key, from);
|
|
1145
1195
|
};
|
|
1146
1196
|
var keyObject = (context.keyObject = collectSpecifierPaths(specifier, function (schemaKeyPath) {
|
|
1147
|
-
var extracted = extractKeyPath(context.storeObject, schemaKeyPath,
|
|
1197
|
+
var extracted = extractKeyPath(context.storeObject, schemaKeyPath,
|
|
1198
|
+
extract);
|
|
1148
1199
|
if (extracted === void 0 &&
|
|
1149
1200
|
object !== context.storeObject &&
|
|
1150
1201
|
hasOwn.call(object, schemaKeyPath[0])) {
|
|
@@ -1170,7 +1221,8 @@ function keyArgsFnFromSpecifier(specifier) {
|
|
|
1170
1221
|
var d = field.directives.find(function (d) { return d.name.value === directiveName_1; });
|
|
1171
1222
|
var directiveArgs = d && utilities.argumentsObjectFromField(d, variables);
|
|
1172
1223
|
return (directiveArgs &&
|
|
1173
|
-
extractKeyPath(directiveArgs,
|
|
1224
|
+
extractKeyPath(directiveArgs,
|
|
1225
|
+
keyPath.slice(1)));
|
|
1174
1226
|
}
|
|
1175
1227
|
return;
|
|
1176
1228
|
}
|
|
@@ -1235,8 +1287,8 @@ function extractKey(object, key) {
|
|
|
1235
1287
|
function extractKeyPath(object, path, extract) {
|
|
1236
1288
|
extract = extract || extractKey;
|
|
1237
1289
|
return normalize(path.reduce(function reducer(obj, key) {
|
|
1238
|
-
return utilities.isArray(obj)
|
|
1239
|
-
|
|
1290
|
+
return utilities.isArray(obj) ?
|
|
1291
|
+
obj.map(function (child) { return reducer(child, key); })
|
|
1240
1292
|
: obj && extract(obj, key);
|
|
1241
1293
|
}, object));
|
|
1242
1294
|
}
|
|
@@ -1253,11 +1305,9 @@ function normalize(value) {
|
|
|
1253
1305
|
}
|
|
1254
1306
|
|
|
1255
1307
|
function argsFromFieldSpecifier(spec) {
|
|
1256
|
-
return spec.args !== void 0
|
|
1257
|
-
? spec.
|
|
1258
|
-
|
|
1259
|
-
? utilities.argumentsObjectFromField(spec.field, spec.variables)
|
|
1260
|
-
: null;
|
|
1308
|
+
return (spec.args !== void 0 ? spec.args
|
|
1309
|
+
: spec.field ? utilities.argumentsObjectFromField(spec.field, spec.variables)
|
|
1310
|
+
: null);
|
|
1261
1311
|
}
|
|
1262
1312
|
var nullKeyFieldsFn = function () { return void 0; };
|
|
1263
1313
|
var simpleKeyArgsFn = function (_args, context) { return context.fieldName; };
|
|
@@ -1266,7 +1316,7 @@ var mergeTrueFn = function (existing, incoming, _a) {
|
|
|
1266
1316
|
return mergeObjects(existing, incoming);
|
|
1267
1317
|
};
|
|
1268
1318
|
var mergeFalseFn = function (_, incoming) { return incoming; };
|
|
1269
|
-
var Policies =
|
|
1319
|
+
var Policies = (function () {
|
|
1270
1320
|
function Policies(config) {
|
|
1271
1321
|
this.config = config;
|
|
1272
1322
|
this.typePolicies = Object.create(null);
|
|
@@ -1346,28 +1396,17 @@ var Policies = (function () {
|
|
|
1346
1396
|
var keyFields = incoming.keyFields, fields = incoming.fields;
|
|
1347
1397
|
function setMerge(existing, merge) {
|
|
1348
1398
|
existing.merge =
|
|
1349
|
-
typeof merge === "function"
|
|
1350
|
-
?
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
? mergeTrueFn
|
|
1354
|
-
:
|
|
1355
|
-
merge === false
|
|
1356
|
-
? mergeFalseFn
|
|
1357
|
-
: existing.merge;
|
|
1399
|
+
typeof merge === "function" ? merge
|
|
1400
|
+
: merge === true ? mergeTrueFn
|
|
1401
|
+
: merge === false ? mergeFalseFn
|
|
1402
|
+
: existing.merge;
|
|
1358
1403
|
}
|
|
1359
1404
|
setMerge(existing, incoming.merge);
|
|
1360
1405
|
existing.keyFn =
|
|
1361
|
-
keyFields === false
|
|
1362
|
-
?
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
? keyFieldsFnFromSpecifier(keyFields)
|
|
1366
|
-
:
|
|
1367
|
-
typeof keyFields === "function"
|
|
1368
|
-
? keyFields
|
|
1369
|
-
:
|
|
1370
|
-
existing.keyFn;
|
|
1406
|
+
keyFields === false ? nullKeyFieldsFn
|
|
1407
|
+
: utilities.isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields)
|
|
1408
|
+
: typeof keyFields === "function" ? keyFields
|
|
1409
|
+
: existing.keyFn;
|
|
1371
1410
|
if (fields) {
|
|
1372
1411
|
Object.keys(fields).forEach(function (fieldName) {
|
|
1373
1412
|
var existing = _this.getFieldPolicy(typename, fieldName, true);
|
|
@@ -1378,16 +1417,10 @@ var Policies = (function () {
|
|
|
1378
1417
|
else {
|
|
1379
1418
|
var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge;
|
|
1380
1419
|
existing.keyFn =
|
|
1381
|
-
keyArgs === false
|
|
1382
|
-
?
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
? keyArgsFnFromSpecifier(keyArgs)
|
|
1386
|
-
:
|
|
1387
|
-
typeof keyArgs === "function"
|
|
1388
|
-
? keyArgs
|
|
1389
|
-
:
|
|
1390
|
-
existing.keyFn;
|
|
1420
|
+
keyArgs === false ? simpleKeyArgsFn
|
|
1421
|
+
: utilities.isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs)
|
|
1422
|
+
: typeof keyArgs === "function" ? keyArgs
|
|
1423
|
+
: existing.keyFn;
|
|
1391
1424
|
if (typeof read === "function") {
|
|
1392
1425
|
existing.read = read;
|
|
1393
1426
|
}
|
|
@@ -1553,15 +1586,15 @@ var Policies = (function () {
|
|
|
1553
1586
|
}
|
|
1554
1587
|
}
|
|
1555
1588
|
if (storeFieldName === void 0) {
|
|
1556
|
-
storeFieldName =
|
|
1557
|
-
|
|
1558
|
-
|
|
1589
|
+
storeFieldName =
|
|
1590
|
+
fieldSpec.field ?
|
|
1591
|
+
utilities.storeKeyNameFromField(fieldSpec.field, fieldSpec.variables)
|
|
1592
|
+
: utilities.getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec));
|
|
1559
1593
|
}
|
|
1560
1594
|
if (storeFieldName === false) {
|
|
1561
1595
|
return fieldName;
|
|
1562
1596
|
}
|
|
1563
|
-
return fieldName === fieldNameFromStoreName(storeFieldName)
|
|
1564
|
-
? storeFieldName
|
|
1597
|
+
return fieldName === fieldNameFromStoreName(storeFieldName) ? storeFieldName
|
|
1565
1598
|
: fieldName + ":" + storeFieldName;
|
|
1566
1599
|
};
|
|
1567
1600
|
Policies.prototype.readField = function (options, context) {
|
|
@@ -1582,8 +1615,8 @@ var Policies = (function () {
|
|
|
1582
1615
|
var policy = this.getFieldPolicy(options.typename, fieldName, false);
|
|
1583
1616
|
var read = policy && policy.read;
|
|
1584
1617
|
if (read) {
|
|
1585
|
-
var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(utilities.isReference(objectOrReference)
|
|
1586
|
-
|
|
1618
|
+
var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(utilities.isReference(objectOrReference) ?
|
|
1619
|
+
objectOrReference.__ref
|
|
1587
1620
|
: objectOrReference, storeFieldName));
|
|
1588
1621
|
return cacheSlot.withValue(this.cache, read, [
|
|
1589
1622
|
existing,
|
|
@@ -1616,7 +1649,8 @@ var Policies = (function () {
|
|
|
1616
1649
|
if (context.overwrite) {
|
|
1617
1650
|
existing = void 0;
|
|
1618
1651
|
}
|
|
1619
|
-
return merge(existing, incoming, makeFieldFunctionOptions(this,
|
|
1652
|
+
return merge(existing, incoming, makeFieldFunctionOptions(this,
|
|
1653
|
+
void 0, {
|
|
1620
1654
|
typename: typename,
|
|
1621
1655
|
fieldName: field.name.value,
|
|
1622
1656
|
field: field,
|
|
@@ -1704,13 +1738,13 @@ function getContextFlavor(context, clientOnly, deferred) {
|
|
|
1704
1738
|
var flavored = context.flavors.get(key);
|
|
1705
1739
|
if (!flavored) {
|
|
1706
1740
|
context.flavors.set(key, (flavored =
|
|
1707
|
-
context.clientOnly === clientOnly && context.deferred === deferred
|
|
1708
|
-
|
|
1741
|
+
context.clientOnly === clientOnly && context.deferred === deferred ?
|
|
1742
|
+
context
|
|
1709
1743
|
: tslib.__assign(tslib.__assign({}, context), { clientOnly: clientOnly, deferred: deferred })));
|
|
1710
1744
|
}
|
|
1711
1745
|
return flavored;
|
|
1712
1746
|
}
|
|
1713
|
-
var StoreWriter =
|
|
1747
|
+
var StoreWriter = (function () {
|
|
1714
1748
|
function StoreWriter(cache, reader, fragments) {
|
|
1715
1749
|
this.cache = cache;
|
|
1716
1750
|
this.reader = reader;
|
|
@@ -1774,7 +1808,8 @@ var StoreWriter = (function () {
|
|
|
1774
1808
|
};
|
|
1775
1809
|
StoreWriter.prototype.processSelectionSet = function (_a) {
|
|
1776
1810
|
var _this = this;
|
|
1777
|
-
var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context,
|
|
1811
|
+
var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context,
|
|
1812
|
+
mergeTree = _a.mergeTree;
|
|
1778
1813
|
var policies = this.cache.policies;
|
|
1779
1814
|
var incoming = Object.create(null);
|
|
1780
1815
|
var typename = (dataId && policies.rootTypenamesById[dataId]) ||
|
|
@@ -1797,7 +1832,8 @@ var StoreWriter = (function () {
|
|
|
1797
1832
|
return policies.readField(options, context);
|
|
1798
1833
|
};
|
|
1799
1834
|
var fieldNodeSet = new Set();
|
|
1800
|
-
this.flattenFields(selectionSet, result,
|
|
1835
|
+
this.flattenFields(selectionSet, result,
|
|
1836
|
+
context, typename).forEach(function (context, field) {
|
|
1801
1837
|
var _a;
|
|
1802
1838
|
var resultFieldKey = utilities.resultKeyNameFromField(field);
|
|
1803
1839
|
var value = result[resultFieldKey];
|
|
@@ -1810,8 +1846,9 @@ var StoreWriter = (function () {
|
|
|
1810
1846
|
variables: context.variables,
|
|
1811
1847
|
});
|
|
1812
1848
|
var childTree = getChildMergeTree(mergeTree, storeFieldName);
|
|
1813
|
-
var incomingValue = _this.processFieldValue(value, field,
|
|
1814
|
-
|
|
1849
|
+
var incomingValue = _this.processFieldValue(value, field,
|
|
1850
|
+
field.selectionSet ?
|
|
1851
|
+
getContextFlavor(context, false, false)
|
|
1815
1852
|
: context, childTree);
|
|
1816
1853
|
var childTypename = void 0;
|
|
1817
1854
|
if (field.selectionSet &&
|
|
@@ -1910,7 +1947,8 @@ var StoreWriter = (function () {
|
|
|
1910
1947
|
var policies = this.cache.policies;
|
|
1911
1948
|
var limitingTrie = new trie.Trie(false);
|
|
1912
1949
|
(function flatten(selectionSet, inheritedContext) {
|
|
1913
|
-
var visitedNode = limitingTrie.lookup(selectionSet,
|
|
1950
|
+
var visitedNode = limitingTrie.lookup(selectionSet,
|
|
1951
|
+
inheritedContext.clientOnly, inheritedContext.deferred);
|
|
1914
1952
|
if (visitedNode.visited)
|
|
1915
1953
|
return;
|
|
1916
1954
|
visitedNode.visited = true;
|
|
@@ -1918,7 +1956,8 @@ var StoreWriter = (function () {
|
|
|
1918
1956
|
if (!utilities.shouldInclude(selection, context.variables))
|
|
1919
1957
|
return;
|
|
1920
1958
|
var clientOnly = inheritedContext.clientOnly, deferred = inheritedContext.deferred;
|
|
1921
|
-
if (
|
|
1959
|
+
if (
|
|
1960
|
+
!(clientOnly && deferred) &&
|
|
1922
1961
|
utilities.isNonEmptyArray(selection.directives)) {
|
|
1923
1962
|
selection.directives.forEach(function (dir) {
|
|
1924
1963
|
var name = dir.name.value;
|
|
@@ -1958,9 +1997,10 @@ var StoreWriter = (function () {
|
|
|
1958
1997
|
var _a;
|
|
1959
1998
|
var _this = this;
|
|
1960
1999
|
if (mergeTree.map.size && !utilities.isReference(incoming)) {
|
|
1961
|
-
var e_1 =
|
|
1962
|
-
|
|
1963
|
-
|
|
2000
|
+
var e_1 =
|
|
2001
|
+
(!utilities.isArray(incoming) &&
|
|
2002
|
+
(utilities.isReference(existing) || storeValueIsStoreObject(existing))) ?
|
|
2003
|
+
existing
|
|
1964
2004
|
: void 0;
|
|
1965
2005
|
var i_1 = incoming;
|
|
1966
2006
|
if (e_1 && !getStorageArgs) {
|
|
@@ -1968,11 +2008,11 @@ var StoreWriter = (function () {
|
|
|
1968
2008
|
}
|
|
1969
2009
|
var changedFields_1;
|
|
1970
2010
|
var getValue_1 = function (from, name) {
|
|
1971
|
-
return utilities.isArray(from)
|
|
1972
|
-
|
|
1973
|
-
|
|
2011
|
+
return (utilities.isArray(from) ?
|
|
2012
|
+
typeof name === "number" ?
|
|
2013
|
+
from[name]
|
|
1974
2014
|
: void 0
|
|
1975
|
-
: context.store.getFieldValue(from, String(name));
|
|
2015
|
+
: context.store.getFieldValue(from, String(name)));
|
|
1976
2016
|
};
|
|
1977
2017
|
mergeTree.map.forEach(function (childTree, storeFieldName) {
|
|
1978
2018
|
var eVal = getValue_1(e_1, storeFieldName);
|
|
@@ -2018,13 +2058,10 @@ function mergeMergeTrees(left, right) {
|
|
|
2018
2058
|
return left;
|
|
2019
2059
|
if (!left || mergeTreeIsEmpty(left))
|
|
2020
2060
|
return right;
|
|
2021
|
-
var info = left.info && right.info
|
|
2022
|
-
? tslib.__assign(tslib.__assign({}, left.info), right.info) : left.info || right.info;
|
|
2061
|
+
var info = left.info && right.info ? tslib.__assign(tslib.__assign({}, left.info), right.info) : left.info || right.info;
|
|
2023
2062
|
var needToMergeMaps = left.map.size && right.map.size;
|
|
2024
|
-
var map = needToMergeMaps
|
|
2025
|
-
?
|
|
2026
|
-
: left.map.size
|
|
2027
|
-
? left.map
|
|
2063
|
+
var map = needToMergeMaps ? new Map()
|
|
2064
|
+
: left.map.size ? left.map
|
|
2028
2065
|
: right.map;
|
|
2029
2066
|
var merged = { info: info, map: map };
|
|
2030
2067
|
if (needToMergeMaps) {
|
|
@@ -2085,14 +2122,14 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
2085
2122
|
}
|
|
2086
2123
|
});
|
|
2087
2124
|
}
|
|
2088
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(14, fieldName, parentType, childTypenames.length
|
|
2089
|
-
|
|
2125
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(14, fieldName, parentType, childTypenames.length ?
|
|
2126
|
+
"either ensure all objects of type " +
|
|
2090
2127
|
childTypenames.join(" and ") +
|
|
2091
2128
|
" have an ID or a custom merge function, or "
|
|
2092
2129
|
: "", typeDotName, existing, incoming);
|
|
2093
2130
|
}
|
|
2094
2131
|
|
|
2095
|
-
var InMemoryCache =
|
|
2132
|
+
var InMemoryCache = (function (_super) {
|
|
2096
2133
|
tslib.__extends(InMemoryCache, _super);
|
|
2097
2134
|
function InMemoryCache(config) {
|
|
2098
2135
|
if (config === void 0) { config = {}; }
|
|
@@ -2130,20 +2167,21 @@ var InMemoryCache = (function (_super) {
|
|
|
2130
2167
|
addTypename: this.addTypename,
|
|
2131
2168
|
resultCacheMaxSize: this.config.resultCacheMaxSize,
|
|
2132
2169
|
canonizeResults: shouldCanonizeResults(this.config),
|
|
2133
|
-
canon: resetResultIdentities
|
|
2134
|
-
? void 0
|
|
2135
|
-
: previousReader && previousReader.canon,
|
|
2170
|
+
canon: resetResultIdentities ? void 0 : (previousReader && previousReader.canon),
|
|
2136
2171
|
fragments: fragments,
|
|
2137
2172
|
})), fragments);
|
|
2138
2173
|
this.maybeBroadcastWatch = optimism.wrap(function (c, options) {
|
|
2139
2174
|
return _this.broadcastWatch(c, options);
|
|
2140
2175
|
}, {
|
|
2141
|
-
max: this.config.resultCacheMaxSize
|
|
2176
|
+
max: this.config.resultCacheMaxSize ||
|
|
2177
|
+
utilities.cacheSizes["inMemoryCache.maybeBroadcastWatch"] ||
|
|
2178
|
+
5000 ,
|
|
2142
2179
|
makeCacheKey: function (c) {
|
|
2143
2180
|
var store = c.optimistic ? _this.optimisticData : _this.data;
|
|
2144
2181
|
if (supportsResultCaching(store)) {
|
|
2145
2182
|
var optimistic = c.optimistic, id = c.id, variables = c.variables;
|
|
2146
|
-
return store.makeCacheKey(c.query,
|
|
2183
|
+
return store.makeCacheKey(c.query,
|
|
2184
|
+
c.callback, utilities.canonicalStringify({ optimistic: optimistic, id: id, variables: variables }));
|
|
2147
2185
|
}
|
|
2148
2186
|
},
|
|
2149
2187
|
});
|
|
@@ -2162,7 +2200,9 @@ var InMemoryCache = (function (_super) {
|
|
|
2162
2200
|
return (optimistic ? this.optimisticData : this.data).extract();
|
|
2163
2201
|
};
|
|
2164
2202
|
InMemoryCache.prototype.read = function (options) {
|
|
2165
|
-
var
|
|
2203
|
+
var
|
|
2204
|
+
_a = options.returnPartialData,
|
|
2205
|
+
returnPartialData = _a === void 0 ? false : _a;
|
|
2166
2206
|
try {
|
|
2167
2207
|
return (this.storeReader.diffQueryAgainstStore(tslib.__assign(tslib.__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, config: this.config, returnPartialData: returnPartialData })).result || null);
|
|
2168
2208
|
}
|
|
@@ -2188,8 +2228,9 @@ var InMemoryCache = (function (_super) {
|
|
|
2188
2228
|
if (hasOwn.call(options, "id") && !options.id) {
|
|
2189
2229
|
return false;
|
|
2190
2230
|
}
|
|
2191
|
-
var store = options.optimistic
|
|
2192
|
-
|
|
2231
|
+
var store = ((options.optimistic)
|
|
2232
|
+
) ?
|
|
2233
|
+
this.optimisticData
|
|
2193
2234
|
: this.data;
|
|
2194
2235
|
try {
|
|
2195
2236
|
++this.txCount;
|
|
@@ -2221,8 +2262,11 @@ var InMemoryCache = (function (_super) {
|
|
|
2221
2262
|
};
|
|
2222
2263
|
};
|
|
2223
2264
|
InMemoryCache.prototype.gc = function (options) {
|
|
2265
|
+
var _a;
|
|
2224
2266
|
utilities.canonicalStringify.reset();
|
|
2225
2267
|
utilities.print.reset();
|
|
2268
|
+
this.addTypenameTransform.resetCache();
|
|
2269
|
+
(_a = this.config.fragments) === null || _a === void 0 ? void 0 : _a.resetCaches();
|
|
2226
2270
|
var ids = this.optimisticData.gc();
|
|
2227
2271
|
if (options && !this.txCount) {
|
|
2228
2272
|
if (options.resetResultCache) {
|
|
@@ -2386,6 +2430,9 @@ var InMemoryCache = (function (_super) {
|
|
|
2386
2430
|
};
|
|
2387
2431
|
return InMemoryCache;
|
|
2388
2432
|
}(ApolloCache));
|
|
2433
|
+
if (globalThis.__DEV__ !== false) {
|
|
2434
|
+
InMemoryCache.prototype.getMemoryInternals = getInMemoryCacheMemoryInternals;
|
|
2435
|
+
}
|
|
2389
2436
|
|
|
2390
2437
|
function createFragmentRegistry() {
|
|
2391
2438
|
var fragments = [];
|
|
@@ -2394,8 +2441,7 @@ function createFragmentRegistry() {
|
|
|
2394
2441
|
}
|
|
2395
2442
|
return new (FragmentRegistry.bind.apply(FragmentRegistry, tslib.__spreadArray([void 0], fragments, false)))();
|
|
2396
2443
|
}
|
|
2397
|
-
var
|
|
2398
|
-
var FragmentRegistry = (function () {
|
|
2444
|
+
var FragmentRegistry = (function () {
|
|
2399
2445
|
function FragmentRegistry() {
|
|
2400
2446
|
var fragments = [];
|
|
2401
2447
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -2409,8 +2455,12 @@ var FragmentRegistry = (function () {
|
|
|
2409
2455
|
}
|
|
2410
2456
|
FragmentRegistry.prototype.register = function () {
|
|
2411
2457
|
var _this = this;
|
|
2458
|
+
var fragments = [];
|
|
2459
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2460
|
+
fragments[_i] = arguments[_i];
|
|
2461
|
+
}
|
|
2412
2462
|
var definitions = new Map();
|
|
2413
|
-
|
|
2463
|
+
fragments.forEach(function (doc) {
|
|
2414
2464
|
utilities.getFragmentDefinitions(doc).forEach(function (node) {
|
|
2415
2465
|
definitions.set(node.name.value, node);
|
|
2416
2466
|
});
|
|
@@ -2425,17 +2475,21 @@ var FragmentRegistry = (function () {
|
|
|
2425
2475
|
};
|
|
2426
2476
|
FragmentRegistry.prototype.invalidate = function (name) { };
|
|
2427
2477
|
FragmentRegistry.prototype.resetCaches = function () {
|
|
2428
|
-
|
|
2429
|
-
this.
|
|
2430
|
-
this.findFragmentSpreads = this.cacheUnaryMethod("findFragmentSpreads");
|
|
2431
|
-
};
|
|
2432
|
-
FragmentRegistry.prototype.cacheUnaryMethod = function (name) {
|
|
2433
|
-
var registry = this;
|
|
2434
|
-
var originalMethod = FragmentRegistry.prototype[name];
|
|
2435
|
-
return optimism.wrap(function () {
|
|
2436
|
-
return originalMethod.apply(registry, arguments);
|
|
2437
|
-
}, {
|
|
2478
|
+
var proto = FragmentRegistry.prototype;
|
|
2479
|
+
this.invalidate = (this.lookup = optimism.wrap(proto.lookup.bind(this), {
|
|
2438
2480
|
makeCacheKey: function (arg) { return arg; },
|
|
2481
|
+
max: utilities.cacheSizes["fragmentRegistry.lookup"] ||
|
|
2482
|
+
1000 ,
|
|
2483
|
+
})).dirty;
|
|
2484
|
+
this.transform = optimism.wrap(proto.transform.bind(this), {
|
|
2485
|
+
cache: caches.WeakCache,
|
|
2486
|
+
max: utilities.cacheSizes["fragmentRegistry.transform"] ||
|
|
2487
|
+
2000 ,
|
|
2488
|
+
});
|
|
2489
|
+
this.findFragmentSpreads = optimism.wrap(proto.findFragmentSpreads.bind(this), {
|
|
2490
|
+
cache: caches.WeakCache,
|
|
2491
|
+
max: utilities.cacheSizes["fragmentRegistry.findFragmentSpreads"] ||
|
|
2492
|
+
4000 ,
|
|
2439
2493
|
});
|
|
2440
2494
|
};
|
|
2441
2495
|
FragmentRegistry.prototype.lookup = function (fragmentName) {
|