@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
package/utilities/utilities.cjs
CHANGED
|
@@ -6,6 +6,8 @@ var globals = require('./globals');
|
|
|
6
6
|
var graphql = require('graphql');
|
|
7
7
|
var trie = require('@wry/trie');
|
|
8
8
|
var tslib = require('tslib');
|
|
9
|
+
var caches = require('@wry/caches');
|
|
10
|
+
var optimism = require('optimism');
|
|
9
11
|
var zenObservableTs = require('zen-observable-ts');
|
|
10
12
|
require('symbol-observable');
|
|
11
13
|
|
|
@@ -83,12 +85,13 @@ function getInclusionDirectives(directives) {
|
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
var canUseWeakMap = typeof WeakMap === "function" &&
|
|
86
|
-
globals.maybe(function () { return navigator.product
|
|
88
|
+
!globals.maybe(function () { return navigator.product == "ReactNative" && !global.HermesInternal; });
|
|
87
89
|
var canUseWeakSet = typeof WeakSet === "function";
|
|
88
90
|
var canUseSymbol = typeof Symbol === "function" && typeof Symbol.for === "function";
|
|
89
91
|
var canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator;
|
|
90
92
|
var canUseDOM = typeof globals.maybe(function () { return window.document.createElement; }) === "function";
|
|
91
|
-
var usingJSDOM =
|
|
93
|
+
var usingJSDOM =
|
|
94
|
+
globals.maybe(function () { return navigator.userAgent.indexOf("jsdom") >= 0; }) || false;
|
|
92
95
|
var canUseLayoutEffect = canUseDOM && !usingJSDOM;
|
|
93
96
|
|
|
94
97
|
function isNonNullObject(obj) {
|
|
@@ -166,14 +169,53 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
166
169
|
}
|
|
167
170
|
}
|
|
168
171
|
|
|
172
|
+
var scheduledCleanup = new WeakSet();
|
|
173
|
+
function schedule(cache) {
|
|
174
|
+
if (!scheduledCleanup.has(cache)) {
|
|
175
|
+
scheduledCleanup.add(cache);
|
|
176
|
+
setTimeout(function () {
|
|
177
|
+
cache.clean();
|
|
178
|
+
scheduledCleanup.delete(cache);
|
|
179
|
+
}, 100);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
var AutoCleanedWeakCache = function (max, dispose) {
|
|
183
|
+
var cache = new caches.WeakCache(max, dispose);
|
|
184
|
+
cache.set = function (key, value) {
|
|
185
|
+
schedule(this);
|
|
186
|
+
return caches.WeakCache.prototype.set.call(this, key, value);
|
|
187
|
+
};
|
|
188
|
+
return cache;
|
|
189
|
+
};
|
|
190
|
+
var AutoCleanedStrongCache = function (max, dispose) {
|
|
191
|
+
var cache = new caches.StrongCache(max, dispose);
|
|
192
|
+
cache.set = function (key, value) {
|
|
193
|
+
schedule(this);
|
|
194
|
+
return caches.StrongCache.prototype.set.call(this, key, value);
|
|
195
|
+
};
|
|
196
|
+
return cache;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
var cacheSizeSymbol = Symbol.for("apollo.cacheSize");
|
|
200
|
+
var cacheSizes = tslib.__assign({}, globals.global[cacheSizeSymbol]);
|
|
201
|
+
|
|
202
|
+
var globalCaches = {};
|
|
203
|
+
function registerGlobalCache(name, getSize) {
|
|
204
|
+
globalCaches[name] = getSize;
|
|
205
|
+
}
|
|
206
|
+
|
|
169
207
|
var canonicalStringify = Object.assign(function canonicalStringify(value) {
|
|
170
208
|
return JSON.stringify(value, stableObjectReplacer);
|
|
171
209
|
}, {
|
|
172
210
|
reset: function () {
|
|
173
|
-
sortingMap.
|
|
211
|
+
sortingMap = new AutoCleanedStrongCache(cacheSizes.canonicalStringify || 1000 );
|
|
174
212
|
},
|
|
175
213
|
});
|
|
176
|
-
|
|
214
|
+
if (globalThis.__DEV__ !== false) {
|
|
215
|
+
registerGlobalCache("canonicalStringify", function () { return sortingMap.size; });
|
|
216
|
+
}
|
|
217
|
+
var sortingMap;
|
|
218
|
+
canonicalStringify.reset();
|
|
177
219
|
function stableObjectReplacer(key, value) {
|
|
178
220
|
if (value && typeof value === "object") {
|
|
179
221
|
var proto = Object.getPrototypeOf(value);
|
|
@@ -317,8 +359,8 @@ var getStoreKeyName = Object.assign(function (fieldName, args, directives) {
|
|
|
317
359
|
directives["connection"]["key"]) {
|
|
318
360
|
if (directives["connection"]["filter"] &&
|
|
319
361
|
directives["connection"]["filter"].length > 0) {
|
|
320
|
-
var filterKeys = directives["connection"]["filter"]
|
|
321
|
-
|
|
362
|
+
var filterKeys = directives["connection"]["filter"] ?
|
|
363
|
+
directives["connection"]["filter"]
|
|
322
364
|
: [];
|
|
323
365
|
filterKeys.sort();
|
|
324
366
|
var filteredArgs_1 = {};
|
|
@@ -487,19 +529,16 @@ function getDefaultValues(definition) {
|
|
|
487
529
|
function identity(document) {
|
|
488
530
|
return document;
|
|
489
531
|
}
|
|
490
|
-
var DocumentTransform =
|
|
532
|
+
var DocumentTransform = (function () {
|
|
491
533
|
function DocumentTransform(transform, options) {
|
|
492
534
|
if (options === void 0) { options = Object.create(null); }
|
|
493
|
-
this.resultCache = canUseWeakSet
|
|
494
|
-
? new WeakSet()
|
|
495
|
-
: new Set();
|
|
535
|
+
this.resultCache = canUseWeakSet ? new WeakSet() : new Set();
|
|
496
536
|
this.transform = transform;
|
|
497
537
|
if (options.getCacheKey) {
|
|
498
538
|
this.getCacheKey = options.getCacheKey;
|
|
499
539
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
}
|
|
540
|
+
this.cached = options.cache !== false;
|
|
541
|
+
this.resetCache();
|
|
503
542
|
}
|
|
504
543
|
DocumentTransform.prototype.getCacheKey = function (document) {
|
|
505
544
|
return [document];
|
|
@@ -509,60 +548,71 @@ var DocumentTransform = (function () {
|
|
|
509
548
|
};
|
|
510
549
|
DocumentTransform.split = function (predicate, left, right) {
|
|
511
550
|
if (right === void 0) { right = DocumentTransform.identity(); }
|
|
512
|
-
return new DocumentTransform(function (document) {
|
|
551
|
+
return Object.assign(new DocumentTransform(function (document) {
|
|
513
552
|
var documentTransform = predicate(document) ? left : right;
|
|
514
553
|
return documentTransform.transformDocument(document);
|
|
515
|
-
},
|
|
554
|
+
},
|
|
555
|
+
{ cache: false }), { left: left, right: right });
|
|
556
|
+
};
|
|
557
|
+
DocumentTransform.prototype.resetCache = function () {
|
|
558
|
+
var _this = this;
|
|
559
|
+
if (this.cached) {
|
|
560
|
+
var stableCacheKeys_1 = new trie.Trie(canUseWeakMap);
|
|
561
|
+
this.performWork = optimism.wrap(DocumentTransform.prototype.performWork.bind(this), {
|
|
562
|
+
makeCacheKey: function (document) {
|
|
563
|
+
var cacheKeys = _this.getCacheKey(document);
|
|
564
|
+
if (cacheKeys) {
|
|
565
|
+
globals.invariant(Array.isArray(cacheKeys), 66);
|
|
566
|
+
return stableCacheKeys_1.lookupArray(cacheKeys);
|
|
567
|
+
}
|
|
568
|
+
},
|
|
569
|
+
max: cacheSizes["documentTransform.cache"],
|
|
570
|
+
cache: (caches.WeakCache),
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
DocumentTransform.prototype.performWork = function (document) {
|
|
575
|
+
checkDocument(document);
|
|
576
|
+
return this.transform(document);
|
|
516
577
|
};
|
|
517
578
|
DocumentTransform.prototype.transformDocument = function (document) {
|
|
518
579
|
if (this.resultCache.has(document)) {
|
|
519
580
|
return document;
|
|
520
581
|
}
|
|
521
|
-
var
|
|
522
|
-
if (cacheEntry && cacheEntry.value) {
|
|
523
|
-
return cacheEntry.value;
|
|
524
|
-
}
|
|
525
|
-
checkDocument(document);
|
|
526
|
-
var transformedDocument = this.transform(document);
|
|
582
|
+
var transformedDocument = this.performWork(document);
|
|
527
583
|
this.resultCache.add(transformedDocument);
|
|
528
|
-
if (cacheEntry) {
|
|
529
|
-
cacheEntry.value = transformedDocument;
|
|
530
|
-
}
|
|
531
584
|
return transformedDocument;
|
|
532
585
|
};
|
|
533
586
|
DocumentTransform.prototype.concat = function (otherTransform) {
|
|
534
587
|
var _this = this;
|
|
535
|
-
return new DocumentTransform(function (document) {
|
|
588
|
+
return Object.assign(new DocumentTransform(function (document) {
|
|
536
589
|
return otherTransform.transformDocument(_this.transformDocument(document));
|
|
537
|
-
},
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
var cacheKeys = this.getCacheKey(document);
|
|
543
|
-
if (cacheKeys) {
|
|
544
|
-
globals.invariant(Array.isArray(cacheKeys), 66);
|
|
545
|
-
return this.stableCacheKeys.lookupArray(cacheKeys);
|
|
546
|
-
}
|
|
590
|
+
},
|
|
591
|
+
{ cache: false }), {
|
|
592
|
+
left: this,
|
|
593
|
+
right: otherTransform,
|
|
594
|
+
});
|
|
547
595
|
};
|
|
548
596
|
return DocumentTransform;
|
|
549
597
|
}());
|
|
550
598
|
|
|
551
599
|
var printCache;
|
|
552
600
|
var print = Object.assign(function (ast) {
|
|
553
|
-
var result;
|
|
554
|
-
result = printCache === null || printCache === void 0 ? void 0 : printCache.get(ast);
|
|
601
|
+
var result = printCache.get(ast);
|
|
555
602
|
if (!result) {
|
|
556
603
|
result = graphql.print(ast);
|
|
557
|
-
printCache
|
|
604
|
+
printCache.set(ast, result);
|
|
558
605
|
}
|
|
559
606
|
return result;
|
|
560
607
|
}, {
|
|
561
608
|
reset: function () {
|
|
562
|
-
printCache =
|
|
609
|
+
printCache = new AutoCleanedWeakCache(cacheSizes.print || 2000 );
|
|
563
610
|
},
|
|
564
611
|
});
|
|
565
612
|
print.reset();
|
|
613
|
+
if (globalThis.__DEV__ !== false) {
|
|
614
|
+
registerGlobalCache("print", function () { return (printCache ? printCache.size : 0); });
|
|
615
|
+
}
|
|
566
616
|
|
|
567
617
|
var isArray = Array.isArray;
|
|
568
618
|
function isNonEmptyArray(value) {
|
|
@@ -584,8 +634,8 @@ function isEmpty(op, fragmentMap) {
|
|
|
584
634
|
}));
|
|
585
635
|
}
|
|
586
636
|
function nullIfDocIsEmpty(doc) {
|
|
587
|
-
return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc)))
|
|
588
|
-
|
|
637
|
+
return (isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc)))) ?
|
|
638
|
+
null
|
|
589
639
|
: doc;
|
|
590
640
|
}
|
|
591
641
|
function getDirectiveMatcher(configs) {
|
|
@@ -705,7 +755,8 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
705
755
|
if (node === originalNode) {
|
|
706
756
|
return node;
|
|
707
757
|
}
|
|
708
|
-
if (
|
|
758
|
+
if (
|
|
759
|
+
operationCount > 0 &&
|
|
709
760
|
node.selectionSet.selections.every(function (selection) {
|
|
710
761
|
return selection.kind === graphql.Kind.FIELD &&
|
|
711
762
|
selection.name.value === "__typename";
|
|
@@ -760,7 +811,8 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
760
811
|
});
|
|
761
812
|
});
|
|
762
813
|
var fragmentWillBeRemoved = function (fragmentName) {
|
|
763
|
-
return !!(
|
|
814
|
+
return !!(
|
|
815
|
+
(!allFragmentNamesUsed.has(fragmentName) ||
|
|
764
816
|
getInUseByFragmentName(fragmentName).removed));
|
|
765
817
|
};
|
|
766
818
|
var enterVisitor = {
|
|
@@ -776,7 +828,8 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
776
828
|
OperationDefinition: {
|
|
777
829
|
leave: function (node) {
|
|
778
830
|
if (node.variableDefinitions) {
|
|
779
|
-
var usedVariableNames_1 = populateTransitiveVars(
|
|
831
|
+
var usedVariableNames_1 = populateTransitiveVars(
|
|
832
|
+
getInUseByOperationName(node.name && node.name.value)).transitiveVars;
|
|
780
833
|
if (usedVariableNames_1.size < node.variableDefinitions.length) {
|
|
781
834
|
return tslib.__assign(tslib.__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) {
|
|
782
835
|
return usedVariableNames_1.has(varDef.variable.name.value);
|
|
@@ -854,8 +907,9 @@ function removeArgumentsFromDocument(config, doc) {
|
|
|
854
907
|
return nullIfDocIsEmpty(graphql.visit(doc, {
|
|
855
908
|
OperationDefinition: {
|
|
856
909
|
enter: function (node) {
|
|
857
|
-
return tslib.__assign(tslib.__assign({}, node), {
|
|
858
|
-
|
|
910
|
+
return tslib.__assign(tslib.__assign({}, node), {
|
|
911
|
+
variableDefinitions: node.variableDefinitions ?
|
|
912
|
+
node.variableDefinitions.filter(function (varDef) {
|
|
859
913
|
return !config.some(function (arg) { return arg.name === varDef.variable.name.value; });
|
|
860
914
|
})
|
|
861
915
|
: [] });
|
|
@@ -961,7 +1015,7 @@ function mergeDeepArray(sources) {
|
|
|
961
1015
|
var defaultReconciler = function (target, source, property) {
|
|
962
1016
|
return this.merge(target[property], source[property]);
|
|
963
1017
|
};
|
|
964
|
-
var DeepMerger =
|
|
1018
|
+
var DeepMerger = (function () {
|
|
965
1019
|
function DeepMerger(reconciler) {
|
|
966
1020
|
if (reconciler === void 0) { reconciler = defaultReconciler; }
|
|
967
1021
|
this.reconciler = reconciler;
|
|
@@ -1069,7 +1123,8 @@ function relayStylePagination(keyArgs) {
|
|
|
1069
1123
|
firstEdgeCursor = "";
|
|
1070
1124
|
}
|
|
1071
1125
|
var _b = existing.pageInfo || {}, startCursor = _b.startCursor, endCursor = _b.endCursor;
|
|
1072
|
-
return tslib.__assign(tslib.__assign({}, getExtras(existing)), { edges: edges, pageInfo: tslib.__assign(tslib.__assign({}, existing.pageInfo), {
|
|
1126
|
+
return tslib.__assign(tslib.__assign({}, getExtras(existing)), { edges: edges, pageInfo: tslib.__assign(tslib.__assign({}, existing.pageInfo), {
|
|
1127
|
+
startCursor: startCursor || firstEdgeCursor, endCursor: endCursor || lastEdgeCursor }) });
|
|
1073
1128
|
},
|
|
1074
1129
|
merge: function (existing, incoming, _a) {
|
|
1075
1130
|
var args = _a.args, isReference = _a.isReference, readField = _a.readField;
|
|
@@ -1079,8 +1134,8 @@ function relayStylePagination(keyArgs) {
|
|
|
1079
1134
|
if (!incoming) {
|
|
1080
1135
|
return existing;
|
|
1081
1136
|
}
|
|
1082
|
-
var incomingEdges = incoming.edges
|
|
1083
|
-
|
|
1137
|
+
var incomingEdges = incoming.edges ?
|
|
1138
|
+
incoming.edges.map(function (edge) {
|
|
1084
1139
|
if (isReference((edge = tslib.__assign({}, edge)))) {
|
|
1085
1140
|
edge.cursor = readField("cursor", edge);
|
|
1086
1141
|
}
|
|
@@ -1287,8 +1342,8 @@ function asyncMap(observable, mapFn, catchFn) {
|
|
|
1287
1342
|
return function (arg) {
|
|
1288
1343
|
if (examiner) {
|
|
1289
1344
|
var both = function () {
|
|
1290
|
-
return observer.closed
|
|
1291
|
-
|
|
1345
|
+
return observer.closed ?
|
|
1346
|
+
0
|
|
1292
1347
|
: examiner(arg);
|
|
1293
1348
|
};
|
|
1294
1349
|
promiseQueue = promiseQueue.then(both, both).then(function (result) { return observer.next(result); }, function (error) { return observer.error(error); });
|
|
@@ -1302,7 +1357,7 @@ function asyncMap(observable, mapFn, catchFn) {
|
|
|
1302
1357
|
next: makeCallback(mapFn, "next"),
|
|
1303
1358
|
error: makeCallback(catchFn, "error"),
|
|
1304
1359
|
complete: function () {
|
|
1305
|
-
|
|
1360
|
+
promiseQueue.then(function () { return observer.complete(); });
|
|
1306
1361
|
},
|
|
1307
1362
|
};
|
|
1308
1363
|
var sub = observable.subscribe(handler);
|
|
@@ -1324,7 +1379,7 @@ function fixObservableSubclass(subclass) {
|
|
|
1324
1379
|
function isPromiseLike(value) {
|
|
1325
1380
|
return value && typeof value.then === "function";
|
|
1326
1381
|
}
|
|
1327
|
-
var Concast =
|
|
1382
|
+
var Concast = (function (_super) {
|
|
1328
1383
|
tslib.__extends(Concast, _super);
|
|
1329
1384
|
function Concast(sources) {
|
|
1330
1385
|
var _this = _super.call(this, function (observer) {
|
|
@@ -1374,7 +1429,7 @@ var Concast = (function (_super) {
|
|
|
1374
1429
|
iterateObserversSafely(_this.observers, "complete");
|
|
1375
1430
|
}
|
|
1376
1431
|
else if (isPromiseLike(value)) {
|
|
1377
|
-
value.then(function (obs) { return (_this.sub = obs.subscribe(_this.handlers)); });
|
|
1432
|
+
value.then(function (obs) { return (_this.sub = obs.subscribe(_this.handlers)); }, _this.handlers.error);
|
|
1378
1433
|
}
|
|
1379
1434
|
else {
|
|
1380
1435
|
_this.sub = value.subscribe(_this.handlers);
|
|
@@ -1487,9 +1542,7 @@ function graphQLResultHasError(result) {
|
|
|
1487
1542
|
return isNonEmptyArray(errors);
|
|
1488
1543
|
}
|
|
1489
1544
|
function getGraphQLErrorsFromResult(result) {
|
|
1490
|
-
var graphQLErrors = isNonEmptyArray(result.errors)
|
|
1491
|
-
? result.errors.slice(0)
|
|
1492
|
-
: [];
|
|
1545
|
+
var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];
|
|
1493
1546
|
if (isExecutionPatchIncrementalResult(result) &&
|
|
1494
1547
|
isNonEmptyArray(result.incremental)) {
|
|
1495
1548
|
result.incremental.forEach(function (incrementalResult) {
|
|
@@ -1590,6 +1643,8 @@ function stripTypename(value) {
|
|
|
1590
1643
|
exports.DEV = globals.DEV;
|
|
1591
1644
|
exports.maybe = globals.maybe;
|
|
1592
1645
|
exports.Observable = zenObservableTs.Observable;
|
|
1646
|
+
exports.AutoCleanedStrongCache = AutoCleanedStrongCache;
|
|
1647
|
+
exports.AutoCleanedWeakCache = AutoCleanedWeakCache;
|
|
1593
1648
|
exports.Concast = Concast;
|
|
1594
1649
|
exports.DeepMerger = DeepMerger;
|
|
1595
1650
|
exports.DocumentTransform = DocumentTransform;
|
|
@@ -1597,6 +1652,7 @@ exports.addTypenameToDocument = addTypenameToDocument;
|
|
|
1597
1652
|
exports.argumentsObjectFromField = argumentsObjectFromField;
|
|
1598
1653
|
exports.asyncMap = asyncMap;
|
|
1599
1654
|
exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet;
|
|
1655
|
+
exports.cacheSizes = cacheSizes;
|
|
1600
1656
|
exports.canUseAsyncIteratorSymbol = canUseAsyncIteratorSymbol;
|
|
1601
1657
|
exports.canUseDOM = canUseDOM;
|
|
1602
1658
|
exports.canUseLayoutEffect = canUseLayoutEffect;
|