@apollo/client 3.9.0-alpha.4 → 3.9.0-alpha.5
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/forty-cups-shop.md +5 -0
- package/.changeset/friendly-clouds-laugh.md +7 -0
- package/.changeset/hot-ducks-burn.md +5 -0
- package/.changeset/polite-avocados-warn.md +5 -0
- package/.changeset/pre.json +29 -0
- package/.changeset/quick-hats-marry.md +5 -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/thick-mice-collect.md +5 -0
- package/.changeset/thirty-ties-arrive.md +26 -0
- package/.changeset/violet-lions-draw.md +5 -0
- package/.changeset/wild-dolphins-jog.md +5 -0
- package/.changeset/yellow-flies-repeat.md +5 -0
- package/CHANGELOG.md +3535 -0
- package/apollo-client.cjs +475 -398
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +135 -153
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +135 -153
- 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.d.ts +1 -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 +23 -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.js +164 -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 +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 +58 -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 +118 -13
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +8 -1
- package/core/QueryManager.js +247 -46
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +127 -114
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +127 -114
- 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 +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.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 +50 -38
- package/react/cache/QueryReference.d.ts +18 -10
- package/react/cache/QueryReference.js +52 -8
- 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 +138 -66
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +138 -66
- package/react/hooks/index.d.ts +2 -0
- package/react/hooks/index.js +1 -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.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/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 +4 -10
- 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/parser/index.d.ts +3 -0
- package/react/parser/index.js +13 -6
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +11 -5
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +11 -5
- 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 +123 -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/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/matchers/ProfiledComponent.js +29 -26
- package/testing/matchers/ProfiledComponent.js.map +1 -1
- package/testing/matchers/index.js +2 -0
- package/testing/matchers/index.js.map +1 -1
- 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/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/canonicalStringify.d.ts +17 -0
- package/utilities/common/canonicalStringify.js +41 -0
- 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 +6 -5
- package/utilities/graphql/DocumentTransform.js +48 -27
- 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 +4 -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 +2 -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 +61 -53
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +61 -53
- 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
|
@@ -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);
|
|
@@ -810,7 +802,7 @@ function execSelectionSetKeyArgs(options) {
|
|
|
810
802
|
options.context.canonizeResults,
|
|
811
803
|
];
|
|
812
804
|
}
|
|
813
|
-
var StoreReader =
|
|
805
|
+
var StoreReader = (function () {
|
|
814
806
|
function StoreReader(config) {
|
|
815
807
|
var _this = this;
|
|
816
808
|
this.knownResults = new (utilities.canUseWeakMap ? WeakMap : Map)();
|
|
@@ -827,7 +819,8 @@ var StoreReader = (function () {
|
|
|
827
819
|
var other = (_a = _this.executeSelectionSet).peek.apply(_a, peekArgs);
|
|
828
820
|
if (other) {
|
|
829
821
|
if (canonizeResults) {
|
|
830
|
-
return tslib.__assign(tslib.__assign({}, other), {
|
|
822
|
+
return tslib.__assign(tslib.__assign({}, other), {
|
|
823
|
+
result: _this.canon.admit(other.result) });
|
|
831
824
|
}
|
|
832
825
|
return other;
|
|
833
826
|
}
|
|
@@ -887,7 +880,8 @@ var StoreReader = (function () {
|
|
|
887
880
|
StoreReader.prototype.isFresh = function (result, parent, selectionSet, context) {
|
|
888
881
|
if (supportsResultCaching(context.store) &&
|
|
889
882
|
this.knownResults.get(result) === selectionSet) {
|
|
890
|
-
var latest = this.executeSelectionSet.peek(selectionSet, parent, context,
|
|
883
|
+
var latest = this.executeSelectionSet.peek(selectionSet, parent, context,
|
|
884
|
+
this.canon.isKnown(result));
|
|
891
885
|
if (latest && result === latest.result) {
|
|
892
886
|
return true;
|
|
893
887
|
}
|
|
@@ -940,8 +934,8 @@ var StoreReader = (function () {
|
|
|
940
934
|
if (fieldValue === void 0) {
|
|
941
935
|
if (!utilities.addTypenameToDocument.added(selection)) {
|
|
942
936
|
missing = missingMerger.merge(missing, (_a = {},
|
|
943
|
-
_a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(utilities.isReference(objectOrReference)
|
|
944
|
-
|
|
937
|
+
_a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(utilities.isReference(objectOrReference) ?
|
|
938
|
+
objectOrReference.__ref + " object"
|
|
945
939
|
: "object " + JSON.stringify(objectOrReference, null, 2)),
|
|
946
940
|
_a));
|
|
947
941
|
}
|
|
@@ -983,10 +977,9 @@ var StoreReader = (function () {
|
|
|
983
977
|
});
|
|
984
978
|
var result = utilities.mergeDeepArray(objectsToMerge);
|
|
985
979
|
var finalResult = { result: result, missing: missing };
|
|
986
|
-
var frozen = context.canonizeResults
|
|
987
|
-
|
|
988
|
-
:
|
|
989
|
-
utilities.maybeDeepFreeze(finalResult);
|
|
980
|
+
var frozen = context.canonizeResults ?
|
|
981
|
+
this.canon.admit(finalResult)
|
|
982
|
+
: utilities.maybeDeepFreeze(finalResult);
|
|
990
983
|
if (frozen.result) {
|
|
991
984
|
this.knownResults.set(frozen.result, selectionSet);
|
|
992
985
|
}
|
|
@@ -1068,7 +1061,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
1068
1061
|
}
|
|
1069
1062
|
}
|
|
1070
1063
|
|
|
1071
|
-
var cacheSlot = new
|
|
1064
|
+
var cacheSlot = new optimism.Slot();
|
|
1072
1065
|
var cacheInfoMap = new WeakMap();
|
|
1073
1066
|
function getCacheInfo(cache) {
|
|
1074
1067
|
var info = cacheInfoMap.get(cache);
|
|
@@ -1144,7 +1137,8 @@ function keyFieldsFnFromSpecifier(specifier) {
|
|
|
1144
1137
|
return context.readField(key, from);
|
|
1145
1138
|
};
|
|
1146
1139
|
var keyObject = (context.keyObject = collectSpecifierPaths(specifier, function (schemaKeyPath) {
|
|
1147
|
-
var extracted = extractKeyPath(context.storeObject, schemaKeyPath,
|
|
1140
|
+
var extracted = extractKeyPath(context.storeObject, schemaKeyPath,
|
|
1141
|
+
extract);
|
|
1148
1142
|
if (extracted === void 0 &&
|
|
1149
1143
|
object !== context.storeObject &&
|
|
1150
1144
|
hasOwn.call(object, schemaKeyPath[0])) {
|
|
@@ -1170,7 +1164,8 @@ function keyArgsFnFromSpecifier(specifier) {
|
|
|
1170
1164
|
var d = field.directives.find(function (d) { return d.name.value === directiveName_1; });
|
|
1171
1165
|
var directiveArgs = d && utilities.argumentsObjectFromField(d, variables);
|
|
1172
1166
|
return (directiveArgs &&
|
|
1173
|
-
extractKeyPath(directiveArgs,
|
|
1167
|
+
extractKeyPath(directiveArgs,
|
|
1168
|
+
keyPath.slice(1)));
|
|
1174
1169
|
}
|
|
1175
1170
|
return;
|
|
1176
1171
|
}
|
|
@@ -1235,8 +1230,8 @@ function extractKey(object, key) {
|
|
|
1235
1230
|
function extractKeyPath(object, path, extract) {
|
|
1236
1231
|
extract = extract || extractKey;
|
|
1237
1232
|
return normalize(path.reduce(function reducer(obj, key) {
|
|
1238
|
-
return utilities.isArray(obj)
|
|
1239
|
-
|
|
1233
|
+
return utilities.isArray(obj) ?
|
|
1234
|
+
obj.map(function (child) { return reducer(child, key); })
|
|
1240
1235
|
: obj && extract(obj, key);
|
|
1241
1236
|
}, object));
|
|
1242
1237
|
}
|
|
@@ -1253,11 +1248,9 @@ function normalize(value) {
|
|
|
1253
1248
|
}
|
|
1254
1249
|
|
|
1255
1250
|
function argsFromFieldSpecifier(spec) {
|
|
1256
|
-
return spec.args !== void 0
|
|
1257
|
-
? spec.
|
|
1258
|
-
|
|
1259
|
-
? utilities.argumentsObjectFromField(spec.field, spec.variables)
|
|
1260
|
-
: null;
|
|
1251
|
+
return (spec.args !== void 0 ? spec.args
|
|
1252
|
+
: spec.field ? utilities.argumentsObjectFromField(spec.field, spec.variables)
|
|
1253
|
+
: null);
|
|
1261
1254
|
}
|
|
1262
1255
|
var nullKeyFieldsFn = function () { return void 0; };
|
|
1263
1256
|
var simpleKeyArgsFn = function (_args, context) { return context.fieldName; };
|
|
@@ -1266,7 +1259,7 @@ var mergeTrueFn = function (existing, incoming, _a) {
|
|
|
1266
1259
|
return mergeObjects(existing, incoming);
|
|
1267
1260
|
};
|
|
1268
1261
|
var mergeFalseFn = function (_, incoming) { return incoming; };
|
|
1269
|
-
var Policies =
|
|
1262
|
+
var Policies = (function () {
|
|
1270
1263
|
function Policies(config) {
|
|
1271
1264
|
this.config = config;
|
|
1272
1265
|
this.typePolicies = Object.create(null);
|
|
@@ -1346,28 +1339,17 @@ var Policies = (function () {
|
|
|
1346
1339
|
var keyFields = incoming.keyFields, fields = incoming.fields;
|
|
1347
1340
|
function setMerge(existing, merge) {
|
|
1348
1341
|
existing.merge =
|
|
1349
|
-
typeof merge === "function"
|
|
1350
|
-
?
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
? mergeTrueFn
|
|
1354
|
-
:
|
|
1355
|
-
merge === false
|
|
1356
|
-
? mergeFalseFn
|
|
1357
|
-
: existing.merge;
|
|
1342
|
+
typeof merge === "function" ? merge
|
|
1343
|
+
: merge === true ? mergeTrueFn
|
|
1344
|
+
: merge === false ? mergeFalseFn
|
|
1345
|
+
: existing.merge;
|
|
1358
1346
|
}
|
|
1359
1347
|
setMerge(existing, incoming.merge);
|
|
1360
1348
|
existing.keyFn =
|
|
1361
|
-
keyFields === false
|
|
1362
|
-
?
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
? keyFieldsFnFromSpecifier(keyFields)
|
|
1366
|
-
:
|
|
1367
|
-
typeof keyFields === "function"
|
|
1368
|
-
? keyFields
|
|
1369
|
-
:
|
|
1370
|
-
existing.keyFn;
|
|
1349
|
+
keyFields === false ? nullKeyFieldsFn
|
|
1350
|
+
: utilities.isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields)
|
|
1351
|
+
: typeof keyFields === "function" ? keyFields
|
|
1352
|
+
: existing.keyFn;
|
|
1371
1353
|
if (fields) {
|
|
1372
1354
|
Object.keys(fields).forEach(function (fieldName) {
|
|
1373
1355
|
var existing = _this.getFieldPolicy(typename, fieldName, true);
|
|
@@ -1378,16 +1360,10 @@ var Policies = (function () {
|
|
|
1378
1360
|
else {
|
|
1379
1361
|
var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge;
|
|
1380
1362
|
existing.keyFn =
|
|
1381
|
-
keyArgs === false
|
|
1382
|
-
?
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
? keyArgsFnFromSpecifier(keyArgs)
|
|
1386
|
-
:
|
|
1387
|
-
typeof keyArgs === "function"
|
|
1388
|
-
? keyArgs
|
|
1389
|
-
:
|
|
1390
|
-
existing.keyFn;
|
|
1363
|
+
keyArgs === false ? simpleKeyArgsFn
|
|
1364
|
+
: utilities.isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs)
|
|
1365
|
+
: typeof keyArgs === "function" ? keyArgs
|
|
1366
|
+
: existing.keyFn;
|
|
1391
1367
|
if (typeof read === "function") {
|
|
1392
1368
|
existing.read = read;
|
|
1393
1369
|
}
|
|
@@ -1553,15 +1529,15 @@ var Policies = (function () {
|
|
|
1553
1529
|
}
|
|
1554
1530
|
}
|
|
1555
1531
|
if (storeFieldName === void 0) {
|
|
1556
|
-
storeFieldName =
|
|
1557
|
-
|
|
1558
|
-
|
|
1532
|
+
storeFieldName =
|
|
1533
|
+
fieldSpec.field ?
|
|
1534
|
+
utilities.storeKeyNameFromField(fieldSpec.field, fieldSpec.variables)
|
|
1535
|
+
: utilities.getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec));
|
|
1559
1536
|
}
|
|
1560
1537
|
if (storeFieldName === false) {
|
|
1561
1538
|
return fieldName;
|
|
1562
1539
|
}
|
|
1563
|
-
return fieldName === fieldNameFromStoreName(storeFieldName)
|
|
1564
|
-
? storeFieldName
|
|
1540
|
+
return fieldName === fieldNameFromStoreName(storeFieldName) ? storeFieldName
|
|
1565
1541
|
: fieldName + ":" + storeFieldName;
|
|
1566
1542
|
};
|
|
1567
1543
|
Policies.prototype.readField = function (options, context) {
|
|
@@ -1582,8 +1558,8 @@ var Policies = (function () {
|
|
|
1582
1558
|
var policy = this.getFieldPolicy(options.typename, fieldName, false);
|
|
1583
1559
|
var read = policy && policy.read;
|
|
1584
1560
|
if (read) {
|
|
1585
|
-
var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(utilities.isReference(objectOrReference)
|
|
1586
|
-
|
|
1561
|
+
var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(utilities.isReference(objectOrReference) ?
|
|
1562
|
+
objectOrReference.__ref
|
|
1587
1563
|
: objectOrReference, storeFieldName));
|
|
1588
1564
|
return cacheSlot.withValue(this.cache, read, [
|
|
1589
1565
|
existing,
|
|
@@ -1616,7 +1592,8 @@ var Policies = (function () {
|
|
|
1616
1592
|
if (context.overwrite) {
|
|
1617
1593
|
existing = void 0;
|
|
1618
1594
|
}
|
|
1619
|
-
return merge(existing, incoming, makeFieldFunctionOptions(this,
|
|
1595
|
+
return merge(existing, incoming, makeFieldFunctionOptions(this,
|
|
1596
|
+
void 0, {
|
|
1620
1597
|
typename: typename,
|
|
1621
1598
|
fieldName: field.name.value,
|
|
1622
1599
|
field: field,
|
|
@@ -1704,13 +1681,13 @@ function getContextFlavor(context, clientOnly, deferred) {
|
|
|
1704
1681
|
var flavored = context.flavors.get(key);
|
|
1705
1682
|
if (!flavored) {
|
|
1706
1683
|
context.flavors.set(key, (flavored =
|
|
1707
|
-
context.clientOnly === clientOnly && context.deferred === deferred
|
|
1708
|
-
|
|
1684
|
+
context.clientOnly === clientOnly && context.deferred === deferred ?
|
|
1685
|
+
context
|
|
1709
1686
|
: tslib.__assign(tslib.__assign({}, context), { clientOnly: clientOnly, deferred: deferred })));
|
|
1710
1687
|
}
|
|
1711
1688
|
return flavored;
|
|
1712
1689
|
}
|
|
1713
|
-
var StoreWriter =
|
|
1690
|
+
var StoreWriter = (function () {
|
|
1714
1691
|
function StoreWriter(cache, reader, fragments) {
|
|
1715
1692
|
this.cache = cache;
|
|
1716
1693
|
this.reader = reader;
|
|
@@ -1774,7 +1751,8 @@ var StoreWriter = (function () {
|
|
|
1774
1751
|
};
|
|
1775
1752
|
StoreWriter.prototype.processSelectionSet = function (_a) {
|
|
1776
1753
|
var _this = this;
|
|
1777
|
-
var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context,
|
|
1754
|
+
var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context,
|
|
1755
|
+
mergeTree = _a.mergeTree;
|
|
1778
1756
|
var policies = this.cache.policies;
|
|
1779
1757
|
var incoming = Object.create(null);
|
|
1780
1758
|
var typename = (dataId && policies.rootTypenamesById[dataId]) ||
|
|
@@ -1797,7 +1775,8 @@ var StoreWriter = (function () {
|
|
|
1797
1775
|
return policies.readField(options, context);
|
|
1798
1776
|
};
|
|
1799
1777
|
var fieldNodeSet = new Set();
|
|
1800
|
-
this.flattenFields(selectionSet, result,
|
|
1778
|
+
this.flattenFields(selectionSet, result,
|
|
1779
|
+
context, typename).forEach(function (context, field) {
|
|
1801
1780
|
var _a;
|
|
1802
1781
|
var resultFieldKey = utilities.resultKeyNameFromField(field);
|
|
1803
1782
|
var value = result[resultFieldKey];
|
|
@@ -1810,8 +1789,9 @@ var StoreWriter = (function () {
|
|
|
1810
1789
|
variables: context.variables,
|
|
1811
1790
|
});
|
|
1812
1791
|
var childTree = getChildMergeTree(mergeTree, storeFieldName);
|
|
1813
|
-
var incomingValue = _this.processFieldValue(value, field,
|
|
1814
|
-
|
|
1792
|
+
var incomingValue = _this.processFieldValue(value, field,
|
|
1793
|
+
field.selectionSet ?
|
|
1794
|
+
getContextFlavor(context, false, false)
|
|
1815
1795
|
: context, childTree);
|
|
1816
1796
|
var childTypename = void 0;
|
|
1817
1797
|
if (field.selectionSet &&
|
|
@@ -1910,7 +1890,8 @@ var StoreWriter = (function () {
|
|
|
1910
1890
|
var policies = this.cache.policies;
|
|
1911
1891
|
var limitingTrie = new trie.Trie(false);
|
|
1912
1892
|
(function flatten(selectionSet, inheritedContext) {
|
|
1913
|
-
var visitedNode = limitingTrie.lookup(selectionSet,
|
|
1893
|
+
var visitedNode = limitingTrie.lookup(selectionSet,
|
|
1894
|
+
inheritedContext.clientOnly, inheritedContext.deferred);
|
|
1914
1895
|
if (visitedNode.visited)
|
|
1915
1896
|
return;
|
|
1916
1897
|
visitedNode.visited = true;
|
|
@@ -1918,7 +1899,8 @@ var StoreWriter = (function () {
|
|
|
1918
1899
|
if (!utilities.shouldInclude(selection, context.variables))
|
|
1919
1900
|
return;
|
|
1920
1901
|
var clientOnly = inheritedContext.clientOnly, deferred = inheritedContext.deferred;
|
|
1921
|
-
if (
|
|
1902
|
+
if (
|
|
1903
|
+
!(clientOnly && deferred) &&
|
|
1922
1904
|
utilities.isNonEmptyArray(selection.directives)) {
|
|
1923
1905
|
selection.directives.forEach(function (dir) {
|
|
1924
1906
|
var name = dir.name.value;
|
|
@@ -1958,9 +1940,10 @@ var StoreWriter = (function () {
|
|
|
1958
1940
|
var _a;
|
|
1959
1941
|
var _this = this;
|
|
1960
1942
|
if (mergeTree.map.size && !utilities.isReference(incoming)) {
|
|
1961
|
-
var e_1 =
|
|
1962
|
-
|
|
1963
|
-
|
|
1943
|
+
var e_1 =
|
|
1944
|
+
(!utilities.isArray(incoming) &&
|
|
1945
|
+
(utilities.isReference(existing) || storeValueIsStoreObject(existing))) ?
|
|
1946
|
+
existing
|
|
1964
1947
|
: void 0;
|
|
1965
1948
|
var i_1 = incoming;
|
|
1966
1949
|
if (e_1 && !getStorageArgs) {
|
|
@@ -1968,11 +1951,11 @@ var StoreWriter = (function () {
|
|
|
1968
1951
|
}
|
|
1969
1952
|
var changedFields_1;
|
|
1970
1953
|
var getValue_1 = function (from, name) {
|
|
1971
|
-
return utilities.isArray(from)
|
|
1972
|
-
|
|
1973
|
-
|
|
1954
|
+
return (utilities.isArray(from) ?
|
|
1955
|
+
typeof name === "number" ?
|
|
1956
|
+
from[name]
|
|
1974
1957
|
: void 0
|
|
1975
|
-
: context.store.getFieldValue(from, String(name));
|
|
1958
|
+
: context.store.getFieldValue(from, String(name)));
|
|
1976
1959
|
};
|
|
1977
1960
|
mergeTree.map.forEach(function (childTree, storeFieldName) {
|
|
1978
1961
|
var eVal = getValue_1(e_1, storeFieldName);
|
|
@@ -2018,13 +2001,10 @@ function mergeMergeTrees(left, right) {
|
|
|
2018
2001
|
return left;
|
|
2019
2002
|
if (!left || mergeTreeIsEmpty(left))
|
|
2020
2003
|
return right;
|
|
2021
|
-
var info = left.info && right.info
|
|
2022
|
-
? tslib.__assign(tslib.__assign({}, left.info), right.info) : left.info || right.info;
|
|
2004
|
+
var info = left.info && right.info ? tslib.__assign(tslib.__assign({}, left.info), right.info) : left.info || right.info;
|
|
2023
2005
|
var needToMergeMaps = left.map.size && right.map.size;
|
|
2024
|
-
var map = needToMergeMaps
|
|
2025
|
-
?
|
|
2026
|
-
: left.map.size
|
|
2027
|
-
? left.map
|
|
2006
|
+
var map = needToMergeMaps ? new Map()
|
|
2007
|
+
: left.map.size ? left.map
|
|
2028
2008
|
: right.map;
|
|
2029
2009
|
var merged = { info: info, map: map };
|
|
2030
2010
|
if (needToMergeMaps) {
|
|
@@ -2085,14 +2065,14 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
2085
2065
|
}
|
|
2086
2066
|
});
|
|
2087
2067
|
}
|
|
2088
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(14, fieldName, parentType, childTypenames.length
|
|
2089
|
-
|
|
2068
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(14, fieldName, parentType, childTypenames.length ?
|
|
2069
|
+
"either ensure all objects of type " +
|
|
2090
2070
|
childTypenames.join(" and ") +
|
|
2091
2071
|
" have an ID or a custom merge function, or "
|
|
2092
2072
|
: "", typeDotName, existing, incoming);
|
|
2093
2073
|
}
|
|
2094
2074
|
|
|
2095
|
-
var InMemoryCache =
|
|
2075
|
+
var InMemoryCache = (function (_super) {
|
|
2096
2076
|
tslib.__extends(InMemoryCache, _super);
|
|
2097
2077
|
function InMemoryCache(config) {
|
|
2098
2078
|
if (config === void 0) { config = {}; }
|
|
@@ -2130,9 +2110,7 @@ var InMemoryCache = (function (_super) {
|
|
|
2130
2110
|
addTypename: this.addTypename,
|
|
2131
2111
|
resultCacheMaxSize: this.config.resultCacheMaxSize,
|
|
2132
2112
|
canonizeResults: shouldCanonizeResults(this.config),
|
|
2133
|
-
canon: resetResultIdentities
|
|
2134
|
-
? void 0
|
|
2135
|
-
: previousReader && previousReader.canon,
|
|
2113
|
+
canon: resetResultIdentities ? void 0 : (previousReader && previousReader.canon),
|
|
2136
2114
|
fragments: fragments,
|
|
2137
2115
|
})), fragments);
|
|
2138
2116
|
this.maybeBroadcastWatch = optimism.wrap(function (c, options) {
|
|
@@ -2143,7 +2121,8 @@ var InMemoryCache = (function (_super) {
|
|
|
2143
2121
|
var store = c.optimistic ? _this.optimisticData : _this.data;
|
|
2144
2122
|
if (supportsResultCaching(store)) {
|
|
2145
2123
|
var optimistic = c.optimistic, id = c.id, variables = c.variables;
|
|
2146
|
-
return store.makeCacheKey(c.query,
|
|
2124
|
+
return store.makeCacheKey(c.query,
|
|
2125
|
+
c.callback, utilities.canonicalStringify({ optimistic: optimistic, id: id, variables: variables }));
|
|
2147
2126
|
}
|
|
2148
2127
|
},
|
|
2149
2128
|
});
|
|
@@ -2162,7 +2141,9 @@ var InMemoryCache = (function (_super) {
|
|
|
2162
2141
|
return (optimistic ? this.optimisticData : this.data).extract();
|
|
2163
2142
|
};
|
|
2164
2143
|
InMemoryCache.prototype.read = function (options) {
|
|
2165
|
-
var
|
|
2144
|
+
var
|
|
2145
|
+
_a = options.returnPartialData,
|
|
2146
|
+
returnPartialData = _a === void 0 ? false : _a;
|
|
2166
2147
|
try {
|
|
2167
2148
|
return (this.storeReader.diffQueryAgainstStore(tslib.__assign(tslib.__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, config: this.config, returnPartialData: returnPartialData })).result || null);
|
|
2168
2149
|
}
|
|
@@ -2188,8 +2169,9 @@ var InMemoryCache = (function (_super) {
|
|
|
2188
2169
|
if (hasOwn.call(options, "id") && !options.id) {
|
|
2189
2170
|
return false;
|
|
2190
2171
|
}
|
|
2191
|
-
var store = options.optimistic
|
|
2192
|
-
|
|
2172
|
+
var store = ((options.optimistic)
|
|
2173
|
+
) ?
|
|
2174
|
+
this.optimisticData
|
|
2193
2175
|
: this.data;
|
|
2194
2176
|
try {
|
|
2195
2177
|
++this.txCount;
|
|
@@ -2221,8 +2203,11 @@ var InMemoryCache = (function (_super) {
|
|
|
2221
2203
|
};
|
|
2222
2204
|
};
|
|
2223
2205
|
InMemoryCache.prototype.gc = function (options) {
|
|
2206
|
+
var _a;
|
|
2224
2207
|
utilities.canonicalStringify.reset();
|
|
2225
2208
|
utilities.print.reset();
|
|
2209
|
+
this.addTypenameTransform.resetCache();
|
|
2210
|
+
(_a = this.config.fragments) === null || _a === void 0 ? void 0 : _a.resetCaches();
|
|
2226
2211
|
var ids = this.optimisticData.gc();
|
|
2227
2212
|
if (options && !this.txCount) {
|
|
2228
2213
|
if (options.resetResultCache) {
|
|
@@ -2394,8 +2379,7 @@ function createFragmentRegistry() {
|
|
|
2394
2379
|
}
|
|
2395
2380
|
return new (FragmentRegistry.bind.apply(FragmentRegistry, tslib.__spreadArray([void 0], fragments, false)))();
|
|
2396
2381
|
}
|
|
2397
|
-
var
|
|
2398
|
-
var FragmentRegistry = (function () {
|
|
2382
|
+
var FragmentRegistry = (function () {
|
|
2399
2383
|
function FragmentRegistry() {
|
|
2400
2384
|
var fragments = [];
|
|
2401
2385
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -2409,8 +2393,12 @@ var FragmentRegistry = (function () {
|
|
|
2409
2393
|
}
|
|
2410
2394
|
FragmentRegistry.prototype.register = function () {
|
|
2411
2395
|
var _this = this;
|
|
2396
|
+
var fragments = [];
|
|
2397
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2398
|
+
fragments[_i] = arguments[_i];
|
|
2399
|
+
}
|
|
2412
2400
|
var definitions = new Map();
|
|
2413
|
-
|
|
2401
|
+
fragments.forEach(function (doc) {
|
|
2414
2402
|
utilities.getFragmentDefinitions(doc).forEach(function (node) {
|
|
2415
2403
|
definitions.set(node.name.value, node);
|
|
2416
2404
|
});
|
|
@@ -2425,18 +2413,12 @@ var FragmentRegistry = (function () {
|
|
|
2425
2413
|
};
|
|
2426
2414
|
FragmentRegistry.prototype.invalidate = function (name) { };
|
|
2427
2415
|
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
|
-
}, {
|
|
2416
|
+
var proto = FragmentRegistry.prototype;
|
|
2417
|
+
this.invalidate = (this.lookup = optimism.wrap(proto.lookup.bind(this), {
|
|
2438
2418
|
makeCacheKey: function (arg) { return arg; },
|
|
2439
|
-
});
|
|
2419
|
+
})).dirty;
|
|
2420
|
+
this.transform = optimism.wrap(proto.transform.bind(this));
|
|
2421
|
+
this.findFragmentSpreads = optimism.wrap(proto.findFragmentSpreads.bind(this));
|
|
2440
2422
|
};
|
|
2441
2423
|
FragmentRegistry.prototype.lookup = function (fragmentName) {
|
|
2442
2424
|
return this.registry[fragmentName] || null;
|