@apollo/client 3.8.7 → 3.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.changeset/README.md +8 -0
- package/.changeset/config.json +14 -0
- package/CHANGELOG.md +3357 -0
- package/apollo-client.cjs +314 -316
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +133 -152
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +133 -152
- package/cache/core/cache.d.ts +10 -0
- package/cache/core/cache.js +17 -5
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +1 -1
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +92 -0
- package/cache/core/types/common.js +4 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +1 -1
- package/cache/inmemory/entityStore.js +190 -29
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fixPolyfills.js +9 -0
- package/cache/inmemory/fixPolyfills.js.map +1 -1
- package/cache/inmemory/fixPolyfills.native.js +12 -0
- package/cache/inmemory/fixPolyfills.native.js.map +1 -1
- package/cache/inmemory/fragmentRegistry.js +23 -12
- package/cache/inmemory/fragmentRegistry.js.map +1 -1
- package/cache/inmemory/helpers.js +20 -11
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.js +161 -8
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +72 -4
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/object-canon.js +91 -3
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.js +193 -43
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/reactiveVars.js +20 -2
- package/cache/inmemory/reactiveVars.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +4 -0
- package/cache/inmemory/readFromStore.js +54 -9
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +28 -0
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.js +152 -25
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/config/jest/setup.js +2 -0
- package/config/jest/setup.js.map +1 -1
- package/core/ApolloClient.d.ts +264 -3
- package/core/ApolloClient.js +235 -7
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +4 -6
- package/core/LocalState.js +56 -18
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +25 -0
- package/core/ObservableQuery.js +239 -30
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +3 -3
- package/core/QueryInfo.js +116 -13
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +4 -0
- package/core/QueryManager.js +229 -33
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +112 -103
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +112 -103
- package/core/equalByQuery.js +20 -1
- package/core/equalByQuery.js.map +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +19 -0
- package/core/index.js.map +1 -1
- package/core/networkStatus.d.ts +39 -0
- package/core/networkStatus.js +39 -0
- package/core/networkStatus.js.map +1 -1
- package/core/types.d.ts +9 -0
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +225 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/dev/dev.cjs +5 -111
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +5 -111
- package/dev/loadErrorMessageHandler.js.map +1 -1
- package/errors/errors.cjs +1 -1
- package/errors/errors.cjs.map +1 -1
- package/errors/errors.cjs.native.js +1 -1
- package/errors/index.js +14 -1
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +1 -0
- package/link/batch/batch.cjs +2 -2
- package/link/batch/batch.cjs.map +1 -1
- package/link/batch/batch.cjs.native.js +2 -2
- package/link/batch/batchLink.d.ts +21 -0
- package/link/batch/batchLink.js +2 -1
- package/link/batch/batchLink.js.map +1 -1
- package/link/batch/batching.js +24 -1
- package/link/batch/batching.js.map +1 -1
- package/link/batch-http/batch-http.cjs +3 -2
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batch-http.cjs.native.js +3 -2
- package/link/batch-http/batchHttpLink.d.ts +4 -0
- package/link/batch-http/batchHttpLink.js +53 -2
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/context/context.cjs.map +1 -1
- package/link/context/index.js +1 -0
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.js +12 -5
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/core.cjs +5 -5
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +5 -5
- package/link/error/error.cjs +1 -1
- package/link/error/error.cjs.map +1 -1
- package/link/error/error.cjs.native.js +1 -1
- package/link/error/index.d.ts +3 -0
- package/link/error/index.js +4 -1
- package/link/error/index.js.map +1 -1
- package/link/http/HttpLink.d.ts +0 -2
- package/link/http/HttpLink.js +1 -1
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/checkFetcher.js.map +1 -1
- package/link/http/createHttpLink.js +23 -1
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/createSignalIfSupported.d.ts +5 -0
- package/link/http/createSignalIfSupported.js +5 -0
- package/link/http/createSignalIfSupported.js.map +1 -1
- package/link/http/http.cjs +14 -12
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +14 -12
- package/link/http/index.js +2 -1
- package/link/http/index.js.map +1 -1
- package/link/http/iterators/async.d.ts +4 -0
- package/link/http/iterators/async.js +4 -0
- package/link/http/iterators/async.js.map +1 -1
- package/link/http/iterators/nodeStream.d.ts +4 -0
- package/link/http/iterators/nodeStream.js +4 -0
- package/link/http/iterators/nodeStream.js.map +1 -1
- package/link/http/iterators/promise.d.ts +4 -0
- package/link/http/iterators/promise.js +4 -0
- package/link/http/iterators/promise.js.map +1 -1
- package/link/http/iterators/reader.d.ts +4 -0
- package/link/http/iterators/reader.js +4 -0
- package/link/http/iterators/reader.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +51 -10
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/responseIterator.d.ts +4 -0
- package/link/http/responseIterator.js +6 -0
- package/link/http/responseIterator.js.map +1 -1
- package/link/http/rewriteURIForGET.d.ts +1 -1
- package/link/http/rewriteURIForGET.js +10 -0
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +45 -0
- package/link/http/selectHttpOptionsAndBody.js +23 -0
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/selectURI.js.map +1 -1
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/persisted-queries/index.js +34 -4
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +4 -4
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +4 -4
- package/link/remove-typename/remove-typename.cjs +12 -9
- package/link/remove-typename/remove-typename.cjs.map +1 -1
- package/link/remove-typename/remove-typename.cjs.native.js +12 -9
- package/link/remove-typename/removeTypenameFromVariables.js +12 -9
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
- package/link/retry/delayFunction.d.ts +29 -0
- package/link/retry/delayFunction.js +6 -0
- package/link/retry/delayFunction.js.map +1 -1
- package/link/retry/retry.cjs +5 -5
- package/link/retry/retry.cjs.map +1 -1
- package/link/retry/retry.cjs.native.js +5 -5
- package/link/retry/retryFunction.d.ts +20 -0
- package/link/retry/retryLink.d.ts +6 -0
- package/link/retry/retryLink.js +31 -6
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +13 -0
- package/link/schema/index.js +3 -3
- package/link/schema/index.js.map +1 -1
- package/link/schema/schema.cjs +3 -3
- package/link/schema/schema.cjs.map +1 -1
- package/link/schema/schema.cjs.native.js +3 -3
- package/link/subscriptions/index.js +35 -2
- package/link/subscriptions/index.js.map +1 -1
- package/link/subscriptions/subscriptions.cjs +3 -2
- package/link/subscriptions/subscriptions.cjs.map +1 -1
- package/link/subscriptions/subscriptions.cjs.native.js +3 -2
- package/link/utils/createOperation.js.map +1 -1
- package/link/utils/filterOperationVariables.js +4 -0
- package/link/utils/filterOperationVariables.js.map +1 -1
- package/link/utils/toPromise.js.map +1 -1
- package/link/utils/transformOperation.js +3 -2
- package/link/utils/transformOperation.js.map +1 -1
- package/link/utils/utils.cjs +2 -2
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +2 -2
- package/link/utils/validateOperation.js.map +1 -1
- package/link/ws/index.d.ts +12 -0
- package/link/ws/index.js +1 -1
- package/link/ws/index.js.map +1 -1
- package/link/ws/ws.cjs +1 -1
- package/link/ws/ws.cjs.map +1 -1
- package/link/ws/ws.cjs.native.js +1 -1
- package/package.json +49 -38
- package/react/cache/QueryReference.d.ts +6 -1
- package/react/cache/QueryReference.js +26 -1
- package/react/cache/QueryReference.js.map +1 -1
- package/react/cache/SuspenseCache.d.ts +10 -0
- package/react/cache/SuspenseCache.js +1 -1
- package/react/cache/SuspenseCache.js.map +1 -1
- package/react/cache/getSuspenseCache.js.map +1 -1
- package/react/context/ApolloContext.d.ts +5 -0
- package/react/context/ApolloContext.js +10 -3
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/context.cjs +1 -3
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +1 -3
- package/react/hoc/graphql.js.map +1 -1
- package/react/hoc/hoc-utils.js +3 -1
- package/react/hoc/hoc-utils.js.map +1 -1
- package/react/hoc/hoc.cjs +9 -17
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +9 -17
- package/react/hoc/mutation-hoc.js +9 -4
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/query-hoc.js +10 -4
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.js +10 -4
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/withApollo.js +3 -4
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs +30 -22
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +30 -22
- package/react/hooks/internal/__use.js +5 -0
- package/react/hooks/internal/__use.js.map +1 -1
- package/react/hooks/internal/index.js +1 -0
- package/react/hooks/internal/index.js.map +1 -1
- package/react/hooks/internal/useDeepMemo.js.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.js +6 -3
- package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -1
- package/react/hooks/useBackgroundQuery.js +6 -0
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.js +4 -3
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.js +13 -4
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.js +8 -3
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +11 -0
- package/react/hooks/useQuery.js +137 -5
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useReactiveVar.js +5 -0
- package/react/hooks/useReactiveVar.js.map +1 -1
- package/react/hooks/useReadQuery.d.ts +19 -0
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.js +5 -0
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +11 -5
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +53 -1
- package/react/hooks/useSyncExternalStore.js.map +1 -1
- package/react/parser/index.js +4 -5
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +2 -4
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +2 -4
- package/react/ssr/RenderPromises.js +21 -1
- package/react/ssr/RenderPromises.js.map +1 -1
- package/react/ssr/getDataFromTree.js +18 -3
- package/react/ssr/getDataFromTree.js.map +1 -1
- package/react/ssr/ssr.cjs +6 -4
- package/react/ssr/ssr.cjs.map +1 -1
- package/react/ssr/ssr.cjs.native.js +6 -4
- package/react/types/types.d.ts +66 -0
- package/testing/core/core.cjs +14 -11
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +14 -11
- package/testing/core/itAsync.d.ts +1 -1
- package/testing/core/itAsync.js.map +1 -1
- package/testing/core/mocking/mockFetch.d.ts +2 -2
- package/testing/core/mocking/mockFetch.js +8 -4
- package/testing/core/mocking/mockFetch.js.map +1 -1
- package/testing/core/mocking/mockLink.js +17 -7
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockQueryManager.js +2 -0
- package/testing/core/mocking/mockQueryManager.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
- package/testing/core/mocking/mockWatchQuery.js +1 -1
- package/testing/core/mocking/mockWatchQuery.js.map +1 -1
- package/testing/core/observableToPromise.d.ts +17 -3
- package/testing/core/observableToPromise.js +5 -0
- package/testing/core/observableToPromise.js.map +1 -1
- package/testing/core/subscribeAndCount.js +3 -0
- package/testing/core/subscribeAndCount.js.map +1 -1
- package/testing/core/wait.js +2 -2
- package/testing/core/wait.js.map +1 -1
- package/testing/core/withConsoleSpy.d.ts +3 -0
- package/testing/core/withConsoleSpy.js +7 -1
- package/testing/core/withConsoleSpy.js.map +1 -1
- package/testing/core/wrap.js +2 -0
- package/testing/core/wrap.js.map +1 -1
- package/testing/internal/ObservableStream.js +14 -14
- package/testing/internal/ObservableStream.js.map +1 -1
- package/testing/internal/disposables/spyOnConsole.d.ts +1 -0
- package/testing/internal/disposables/spyOnConsole.js +2 -0
- package/testing/internal/disposables/spyOnConsole.js.map +1 -1
- package/testing/internal/disposables/withCleanup.d.ts +1 -0
- package/testing/internal/disposables/withCleanup.js +3 -0
- package/testing/internal/disposables/withCleanup.js.map +1 -1
- package/testing/internal/profile/Render.d.ts +28 -0
- package/testing/internal/profile/Render.js +12 -1
- package/testing/internal/profile/Render.js.map +1 -1
- package/testing/internal/profile/profile.d.ts +44 -7
- package/testing/internal/profile/profile.js +63 -51
- package/testing/internal/profile/profile.js.map +1 -1
- package/testing/internal/profile/traces.d.ts +4 -0
- package/testing/internal/profile/traces.js +9 -5
- package/testing/internal/profile/traces.js.map +1 -1
- package/testing/matchers/ProfiledComponent.js +27 -22
- package/testing/matchers/ProfiledComponent.js.map +1 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map +1 -1
- package/testing/matchers/toMatchDocument.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +4 -0
- package/testing/react/MockedProvider.js +6 -2
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +4 -2
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +4 -2
- package/utilities/common/arrays.js +1 -0
- package/utilities/common/arrays.js.map +1 -1
- package/utilities/common/canUse.js +16 -1
- package/utilities/common/canUse.js.map +1 -1
- package/utilities/common/cloneDeep.d.ts +3 -0
- package/utilities/common/cloneDeep.js +5 -0
- package/utilities/common/cloneDeep.js.map +1 -1
- package/utilities/common/compact.d.ts +4 -0
- package/utilities/common/compact.js +4 -0
- package/utilities/common/compact.js.map +1 -1
- package/utilities/common/errorHandling.js +1 -3
- package/utilities/common/errorHandling.js.map +1 -1
- package/utilities/common/incrementalResult.js +3 -0
- package/utilities/common/incrementalResult.js.map +1 -1
- package/utilities/common/makeUniqueId.js +2 -0
- package/utilities/common/makeUniqueId.js.map +1 -1
- package/utilities/common/maybeDeepFreeze.js +3 -0
- package/utilities/common/maybeDeepFreeze.js.map +1 -1
- package/utilities/common/mergeDeep.js +12 -1
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/common/mergeOptions.d.ts +1 -1
- package/utilities/common/mergeOptions.js.map +1 -1
- package/utilities/common/omitDeep.js.map +1 -1
- package/utilities/globals/global.js +7 -1
- package/utilities/globals/global.js.map +1 -1
- package/utilities/globals/globals.cjs +4 -5
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +4 -5
- package/utilities/globals/index.d.ts +4 -0
- package/utilities/globals/index.js +7 -0
- package/utilities/globals/index.js.map +1 -1
- package/utilities/globals/invariantWrappers.d.ts +40 -0
- package/utilities/globals/invariantWrappers.js +11 -3
- package/utilities/globals/invariantWrappers.js.map +1 -1
- package/utilities/globals/maybe.js.map +1 -1
- package/utilities/graphql/DocumentTransform.js +19 -6
- package/utilities/graphql/DocumentTransform.js.map +1 -1
- package/utilities/graphql/directives.js +3 -0
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts +25 -0
- package/utilities/graphql/fragments.js +36 -0
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.d.ts +5 -0
- package/utilities/graphql/getFromAST.js +9 -0
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/print.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts +14 -0
- package/utilities/graphql/storeUtils.js +7 -2
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.js +106 -7
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/observables/Concast.d.ts +1 -1
- package/utilities/observables/Concast.js +84 -1
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/observables/Observable.js +6 -0
- package/utilities/observables/Observable.js.map +1 -1
- package/utilities/observables/asyncMap.js +12 -3
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/observables/iteration.js +3 -0
- package/utilities/observables/iteration.js.map +1 -1
- package/utilities/observables/subclassing.js +14 -0
- package/utilities/observables/subclassing.js.map +1 -1
- package/utilities/policies/pagination.js +47 -3
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/promises/decoration.js +1 -0
- package/utilities/promises/decoration.js.map +1 -1
- package/utilities/types/DeepOmit.js.map +1 -1
- package/utilities/types/DeepPartial.d.ts +1 -1
- package/utilities/types/DeepPartial.js +4 -0
- package/utilities/types/DeepPartial.js.map +1 -1
- package/utilities/types/IsStrictlyAny.js.map +1 -1
- package/utilities/types/TODO.d.ts +3 -0
- package/utilities/types/TODO.js +2 -0
- package/utilities/types/TODO.js.map +1 -0
- package/utilities/utilities.cjs +31 -27
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +31 -27
- package/version.js +1 -1
- package/cache/core/cache.d.ts.map +0 -1
- package/cache/core/types/Cache.d.ts.map +0 -1
- package/cache/core/types/DataProxy.d.ts.map +0 -1
- package/cache/core/types/common.d.ts.map +0 -1
- package/cache/index.d.ts.map +0 -1
- package/cache/inmemory/entityStore.d.ts.map +0 -1
- package/cache/inmemory/fixPolyfills.d.ts.map +0 -1
- package/cache/inmemory/fixPolyfills.native.d.ts.map +0 -1
- package/cache/inmemory/fragmentRegistry.d.ts.map +0 -1
- package/cache/inmemory/helpers.d.ts.map +0 -1
- package/cache/inmemory/inMemoryCache.d.ts.map +0 -1
- package/cache/inmemory/key-extractor.d.ts.map +0 -1
- package/cache/inmemory/object-canon.d.ts.map +0 -1
- package/cache/inmemory/policies.d.ts.map +0 -1
- package/cache/inmemory/reactiveVars.d.ts.map +0 -1
- package/cache/inmemory/readFromStore.d.ts.map +0 -1
- package/cache/inmemory/types.d.ts.map +0 -1
- package/cache/inmemory/writeToStore.d.ts.map +0 -1
- package/config/jest/setup.d.ts.map +0 -1
- package/core/ApolloClient.d.ts.map +0 -1
- package/core/LocalState.d.ts.map +0 -1
- package/core/ObservableQuery.d.ts.map +0 -1
- package/core/QueryInfo.d.ts.map +0 -1
- package/core/QueryManager.d.ts.map +0 -1
- package/core/equalByQuery.d.ts.map +0 -1
- package/core/index.d.ts.map +0 -1
- package/core/networkStatus.d.ts.map +0 -1
- package/core/types.d.ts.map +0 -1
- package/core/watchQueryOptions.d.ts.map +0 -1
- package/dev/index.d.ts.map +0 -1
- package/dev/loadDevMessages.d.ts.map +0 -1
- package/dev/loadErrorMessageHandler.d.ts.map +0 -1
- package/dev/loadErrorMessages.d.ts.map +0 -1
- package/errors/index.d.ts.map +0 -1
- package/index.d.ts.map +0 -1
- package/invariantErrorCodes.d.ts.map +0 -1
- package/link/batch/batchLink.d.ts.map +0 -1
- package/link/batch/batching.d.ts.map +0 -1
- package/link/batch/index.d.ts.map +0 -1
- package/link/batch-http/batchHttpLink.d.ts.map +0 -1
- package/link/batch-http/index.d.ts.map +0 -1
- package/link/context/index.d.ts.map +0 -1
- package/link/core/ApolloLink.d.ts.map +0 -1
- package/link/core/concat.d.ts.map +0 -1
- package/link/core/empty.d.ts.map +0 -1
- package/link/core/execute.d.ts.map +0 -1
- package/link/core/from.d.ts.map +0 -1
- package/link/core/index.d.ts.map +0 -1
- package/link/core/split.d.ts.map +0 -1
- package/link/core/types.d.ts.map +0 -1
- package/link/error/index.d.ts.map +0 -1
- package/link/http/HttpLink.d.ts.map +0 -1
- package/link/http/checkFetcher.d.ts.map +0 -1
- package/link/http/createHttpLink.d.ts.map +0 -1
- package/link/http/createSignalIfSupported.d.ts.map +0 -1
- package/link/http/index.d.ts.map +0 -1
- package/link/http/iterators/async.d.ts.map +0 -1
- package/link/http/iterators/nodeStream.d.ts.map +0 -1
- package/link/http/iterators/promise.d.ts.map +0 -1
- package/link/http/iterators/reader.d.ts.map +0 -1
- package/link/http/parseAndCheckHttpResponse.d.ts.map +0 -1
- package/link/http/responseIterator.d.ts.map +0 -1
- package/link/http/rewriteURIForGET.d.ts.map +0 -1
- package/link/http/selectHttpOptionsAndBody.d.ts.map +0 -1
- package/link/http/selectURI.d.ts.map +0 -1
- package/link/http/serializeFetchParameter.d.ts.map +0 -1
- package/link/persisted-queries/index.d.ts.map +0 -1
- package/link/remove-typename/index.d.ts.map +0 -1
- package/link/remove-typename/removeTypenameFromVariables.d.ts.map +0 -1
- package/link/retry/delayFunction.d.ts.map +0 -1
- package/link/retry/index.d.ts.map +0 -1
- package/link/retry/retryFunction.d.ts.map +0 -1
- package/link/retry/retryLink.d.ts.map +0 -1
- package/link/schema/index.d.ts.map +0 -1
- package/link/subscriptions/index.d.ts.map +0 -1
- package/link/utils/createOperation.d.ts.map +0 -1
- package/link/utils/filterOperationVariables.d.ts.map +0 -1
- package/link/utils/fromError.d.ts.map +0 -1
- package/link/utils/fromPromise.d.ts.map +0 -1
- package/link/utils/index.d.ts.map +0 -1
- package/link/utils/throwServerError.d.ts.map +0 -1
- package/link/utils/toPromise.d.ts.map +0 -1
- package/link/utils/transformOperation.d.ts.map +0 -1
- package/link/utils/validateOperation.d.ts.map +0 -1
- package/link/ws/index.d.ts.map +0 -1
- package/react/cache/QueryReference.d.ts.map +0 -1
- package/react/cache/SuspenseCache.d.ts.map +0 -1
- package/react/cache/getSuspenseCache.d.ts.map +0 -1
- package/react/cache/index.d.ts.map +0 -1
- package/react/cache/types.d.ts.map +0 -1
- package/react/components/Mutation.d.ts.map +0 -1
- package/react/components/Query.d.ts.map +0 -1
- package/react/components/Subscription.d.ts.map +0 -1
- package/react/components/index.d.ts.map +0 -1
- package/react/components/types.d.ts.map +0 -1
- package/react/context/ApolloConsumer.d.ts.map +0 -1
- package/react/context/ApolloContext.d.ts.map +0 -1
- package/react/context/ApolloProvider.d.ts.map +0 -1
- package/react/context/index.d.ts.map +0 -1
- package/react/hoc/graphql.d.ts.map +0 -1
- package/react/hoc/hoc-utils.d.ts.map +0 -1
- package/react/hoc/index.d.ts.map +0 -1
- package/react/hoc/mutation-hoc.d.ts.map +0 -1
- package/react/hoc/query-hoc.d.ts.map +0 -1
- package/react/hoc/subscription-hoc.d.ts.map +0 -1
- package/react/hoc/types.d.ts.map +0 -1
- package/react/hoc/withApollo.d.ts.map +0 -1
- package/react/hooks/constants.d.ts.map +0 -1
- package/react/hooks/index.d.ts.map +0 -1
- package/react/hooks/internal/__use.d.ts.map +0 -1
- package/react/hooks/internal/index.d.ts.map +0 -1
- package/react/hooks/internal/useDeepMemo.d.ts.map +0 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +0 -1
- package/react/hooks/useApolloClient.d.ts.map +0 -1
- package/react/hooks/useBackgroundQuery.d.ts.map +0 -1
- package/react/hooks/useFragment.d.ts.map +0 -1
- package/react/hooks/useLazyQuery.d.ts.map +0 -1
- package/react/hooks/useMutation.d.ts.map +0 -1
- package/react/hooks/useQuery.d.ts.map +0 -1
- package/react/hooks/useReactiveVar.d.ts.map +0 -1
- package/react/hooks/useReadQuery.d.ts.map +0 -1
- package/react/hooks/useSubscription.d.ts.map +0 -1
- package/react/hooks/useSuspenseQuery.d.ts.map +0 -1
- package/react/hooks/useSyncExternalStore.d.ts.map +0 -1
- package/react/index.d.ts.map +0 -1
- package/react/parser/index.d.ts.map +0 -1
- package/react/ssr/RenderPromises.d.ts.map +0 -1
- package/react/ssr/getDataFromTree.d.ts.map +0 -1
- package/react/ssr/index.d.ts.map +0 -1
- package/react/ssr/renderToStringWithData.d.ts.map +0 -1
- package/react/types/types.d.ts.map +0 -1
- package/testing/core/index.d.ts.map +0 -1
- package/testing/core/itAsync.d.ts.map +0 -1
- package/testing/core/mocking/mockClient.d.ts.map +0 -1
- package/testing/core/mocking/mockFetch.d.ts.map +0 -1
- package/testing/core/mocking/mockLink.d.ts.map +0 -1
- package/testing/core/mocking/mockQueryManager.d.ts.map +0 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts.map +0 -1
- package/testing/core/mocking/mockWatchQuery.d.ts.map +0 -1
- package/testing/core/observableToPromise.d.ts.map +0 -1
- package/testing/core/subscribeAndCount.d.ts.map +0 -1
- package/testing/core/wait.d.ts.map +0 -1
- package/testing/core/withConsoleSpy.d.ts.map +0 -1
- package/testing/core/wrap.d.ts.map +0 -1
- package/testing/index.d.ts.map +0 -1
- package/testing/internal/ObservableStream.d.ts.map +0 -1
- package/testing/internal/disposables/index.d.ts.map +0 -1
- package/testing/internal/disposables/spyOnConsole.d.ts.map +0 -1
- package/testing/internal/disposables/withCleanup.d.ts.map +0 -1
- package/testing/internal/index.d.ts.map +0 -1
- package/testing/internal/profile/Render.d.ts.map +0 -1
- package/testing/internal/profile/index.d.ts.map +0 -1
- package/testing/internal/profile/profile.d.ts.map +0 -1
- package/testing/internal/profile/traces.d.ts.map +0 -1
- package/testing/matchers/ProfiledComponent.d.ts.map +0 -1
- package/testing/matchers/index.d.ts.map +0 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts.map +0 -1
- package/testing/matchers/toMatchDocument.d.ts.map +0 -1
- package/testing/react/MockedProvider.d.ts.map +0 -1
- package/utilities/common/arrays.d.ts.map +0 -1
- package/utilities/common/canUse.d.ts.map +0 -1
- package/utilities/common/cloneDeep.d.ts.map +0 -1
- package/utilities/common/compact.d.ts.map +0 -1
- package/utilities/common/errorHandling.d.ts.map +0 -1
- package/utilities/common/filterInPlace.d.ts +0 -2
- package/utilities/common/filterInPlace.d.ts.map +0 -1
- package/utilities/common/filterInPlace.js +0 -11
- package/utilities/common/filterInPlace.js.map +0 -1
- package/utilities/common/incrementalResult.d.ts.map +0 -1
- package/utilities/common/makeUniqueId.d.ts.map +0 -1
- package/utilities/common/maybeDeepFreeze.d.ts.map +0 -1
- package/utilities/common/mergeDeep.d.ts.map +0 -1
- package/utilities/common/mergeOptions.d.ts.map +0 -1
- package/utilities/common/objects.d.ts.map +0 -1
- package/utilities/common/omitDeep.d.ts.map +0 -1
- package/utilities/common/stringifyForDisplay.d.ts.map +0 -1
- package/utilities/common/stripTypename.d.ts.map +0 -1
- package/utilities/globals/global.d.ts.map +0 -1
- package/utilities/globals/index.d.ts.map +0 -1
- package/utilities/globals/invariantWrappers.d.ts.map +0 -1
- package/utilities/globals/maybe.d.ts.map +0 -1
- package/utilities/graphql/DocumentTransform.d.ts.map +0 -1
- package/utilities/graphql/directives.d.ts.map +0 -1
- package/utilities/graphql/fragments.d.ts.map +0 -1
- package/utilities/graphql/getFromAST.d.ts.map +0 -1
- package/utilities/graphql/operations.d.ts.map +0 -1
- package/utilities/graphql/print.d.ts.map +0 -1
- package/utilities/graphql/storeUtils.d.ts.map +0 -1
- package/utilities/graphql/transform.d.ts.map +0 -1
- package/utilities/index.d.ts.map +0 -1
- package/utilities/observables/Concast.d.ts.map +0 -1
- package/utilities/observables/Observable.d.ts.map +0 -1
- package/utilities/observables/asyncMap.d.ts.map +0 -1
- package/utilities/observables/iteration.d.ts.map +0 -1
- package/utilities/observables/subclassing.d.ts.map +0 -1
- package/utilities/policies/pagination.d.ts.map +0 -1
- package/utilities/promises/decoration.d.ts.map +0 -1
- package/utilities/types/DeepOmit.d.ts.map +0 -1
- package/utilities/types/DeepPartial.d.ts.map +0 -1
- package/utilities/types/IsStrictlyAny.d.ts.map +0 -1
- package/utilities/types/Primitive.d.ts.map +0 -1
- package/version.d.ts.map +0 -1
package/core/core.cjs.native.js
CHANGED
|
@@ -19,7 +19,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
19
19
|
|
|
20
20
|
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
|
|
21
21
|
|
|
22
|
-
var version = "3.8.
|
|
22
|
+
var version = "3.8.8";
|
|
23
23
|
|
|
24
24
|
function isNonNullObject(obj) {
|
|
25
25
|
return obj !== null && typeof obj === "object";
|
|
@@ -33,7 +33,7 @@ var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
|
33
33
|
var defaultReconciler = function (target, source, property) {
|
|
34
34
|
return this.merge(target[property], source[property]);
|
|
35
35
|
};
|
|
36
|
-
var DeepMerger =
|
|
36
|
+
var DeepMerger = (function () {
|
|
37
37
|
function DeepMerger(reconciler) {
|
|
38
38
|
if (reconciler === void 0) { reconciler = defaultReconciler; }
|
|
39
39
|
this.reconciler = reconciler;
|
|
@@ -179,7 +179,8 @@ function equalBySelectionSet(selectionSet, aResult, bResult, context) {
|
|
|
179
179
|
if (fragment) {
|
|
180
180
|
if (selectionHasNonreactiveDirective(fragment))
|
|
181
181
|
return true;
|
|
182
|
-
return equalBySelectionSet(fragment.selectionSet,
|
|
182
|
+
return equalBySelectionSet(fragment.selectionSet,
|
|
183
|
+
aResult, bResult, context);
|
|
183
184
|
}
|
|
184
185
|
}
|
|
185
186
|
});
|
|
@@ -192,7 +193,7 @@ function directiveIsNonreactive(dir) {
|
|
|
192
193
|
}
|
|
193
194
|
|
|
194
195
|
var assign = Object.assign, hasOwnProperty$1 = Object.hasOwnProperty;
|
|
195
|
-
var ObservableQuery =
|
|
196
|
+
var ObservableQuery = (function (_super) {
|
|
196
197
|
tslib.__extends(ObservableQuery, _super);
|
|
197
198
|
function ObservableQuery(_a) {
|
|
198
199
|
var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options;
|
|
@@ -229,10 +230,12 @@ var ObservableQuery = (function (_super) {
|
|
|
229
230
|
_this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy);
|
|
230
231
|
_this.isTornDown = false;
|
|
231
232
|
var _b = queryManager.defaultOptions.watchQuery, _c = _b === void 0 ? {} : _b, _d = _c.fetchPolicy, defaultFetchPolicy = _d === void 0 ? "cache-first" : _d;
|
|
232
|
-
var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e,
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
_this.options = tslib.__assign(tslib.__assign({}, options), {
|
|
233
|
+
var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e,
|
|
234
|
+
_f = options.initialFetchPolicy,
|
|
235
|
+
initialFetchPolicy = _f === void 0 ? fetchPolicy === "standby" ? defaultFetchPolicy : (fetchPolicy) : _f;
|
|
236
|
+
_this.options = tslib.__assign(tslib.__assign({}, options), {
|
|
237
|
+
initialFetchPolicy: initialFetchPolicy,
|
|
238
|
+
fetchPolicy: fetchPolicy });
|
|
236
239
|
_this.queryId = queryInfo.queryId || queryManager.generateQueryId();
|
|
237
240
|
var opDef = utilities.getOperationDefinition(_this.query);
|
|
238
241
|
_this.queryName = opDef && opDef.name && opDef.name.value;
|
|
@@ -279,7 +282,8 @@ var ObservableQuery = (function (_super) {
|
|
|
279
282
|
exports.NetworkStatus.ready;
|
|
280
283
|
var result = tslib.__assign(tslib.__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus });
|
|
281
284
|
var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a;
|
|
282
|
-
if (
|
|
285
|
+
if (
|
|
286
|
+
skipCacheDataFor(fetchPolicy) ||
|
|
283
287
|
this.queryManager.getDocumentInfo(this.query).hasForcedResolvers) ;
|
|
284
288
|
else if (this.waitForOwnResult) {
|
|
285
289
|
this.queryInfo["updateWatch"]();
|
|
@@ -322,9 +326,8 @@ var ObservableQuery = (function (_super) {
|
|
|
322
326
|
if (!this.last) {
|
|
323
327
|
return true;
|
|
324
328
|
}
|
|
325
|
-
var resultIsDifferent = this.queryManager.getDocumentInfo(this.query)
|
|
326
|
-
.
|
|
327
|
-
? !equalByQuery(this.query, this.last.result, newResult, this.variables)
|
|
329
|
+
var resultIsDifferent = this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective ?
|
|
330
|
+
!equalByQuery(this.query, this.last.result, newResult, this.variables)
|
|
328
331
|
: !equal.equal(this.last.result, newResult);
|
|
329
332
|
return (resultIsDifferent || (variables && !equal.equal(this.last.variables, variables)));
|
|
330
333
|
};
|
|
@@ -383,14 +386,14 @@ var ObservableQuery = (function (_super) {
|
|
|
383
386
|
};
|
|
384
387
|
ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) {
|
|
385
388
|
var _this = this;
|
|
386
|
-
var combinedOptions = tslib.__assign(tslib.__assign({}, (fetchMoreOptions.query
|
|
387
|
-
|
|
388
|
-
: tslib.__assign(tslib.__assign(tslib.__assign(tslib.__assign({}, this.options), { query: this.options.query }), fetchMoreOptions), { variables: tslib.__assign(tslib.__assign({}, this.options.variables), fetchMoreOptions.variables) }))), { fetchPolicy: "no-cache" });
|
|
389
|
+
var combinedOptions = tslib.__assign(tslib.__assign({}, (fetchMoreOptions.query ? fetchMoreOptions : (tslib.__assign(tslib.__assign(tslib.__assign(tslib.__assign({}, this.options), { query: this.options.query }), fetchMoreOptions), { variables: tslib.__assign(tslib.__assign({}, this.options.variables), fetchMoreOptions.variables) })))), {
|
|
390
|
+
fetchPolicy: "no-cache" });
|
|
389
391
|
combinedOptions.query = this.transformDocument(combinedOptions.query);
|
|
390
392
|
var qid = this.queryManager.generateQueryId();
|
|
391
|
-
this.lastQuery =
|
|
392
|
-
|
|
393
|
-
|
|
393
|
+
this.lastQuery =
|
|
394
|
+
fetchMoreOptions.query ?
|
|
395
|
+
this.transformDocument(this.options.query)
|
|
396
|
+
: combinedOptions.query;
|
|
394
397
|
var queryInfo = this.queryInfo;
|
|
395
398
|
var originalNetworkStatus = queryInfo.networkStatus;
|
|
396
399
|
queryInfo.networkStatus = exports.NetworkStatus.fetchMore;
|
|
@@ -525,7 +528,8 @@ var ObservableQuery = (function (_super) {
|
|
|
525
528
|
this.options.pollInterval = 0;
|
|
526
529
|
this.updatePolling();
|
|
527
530
|
};
|
|
528
|
-
ObservableQuery.prototype.applyNextFetchPolicy = function (reason,
|
|
531
|
+
ObservableQuery.prototype.applyNextFetchPolicy = function (reason,
|
|
532
|
+
options) {
|
|
529
533
|
if (options.nextFetchPolicy) {
|
|
530
534
|
var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a, _b = options.initialFetchPolicy, initialFetchPolicy = _b === void 0 ? fetchPolicy : _b;
|
|
531
535
|
if (fetchPolicy === "standby") ;
|
|
@@ -573,8 +577,8 @@ var ObservableQuery = (function (_super) {
|
|
|
573
577
|
if (_this.pollingInfo) {
|
|
574
578
|
if (!isNetworkRequestInFlight(_this.queryInfo.networkStatus)) {
|
|
575
579
|
_this.reobserve({
|
|
576
|
-
fetchPolicy: _this.options.initialFetchPolicy === "no-cache"
|
|
577
|
-
|
|
580
|
+
fetchPolicy: _this.options.initialFetchPolicy === "no-cache" ?
|
|
581
|
+
"no-cache"
|
|
578
582
|
: "network-only",
|
|
579
583
|
}, exports.NetworkStatus.poll).then(poll, poll);
|
|
580
584
|
}
|
|
@@ -598,22 +602,22 @@ var ObservableQuery = (function (_super) {
|
|
|
598
602
|
if (error && this.last && !equal.equal(variables, this.last.variables)) {
|
|
599
603
|
error = void 0;
|
|
600
604
|
}
|
|
601
|
-
return (this.last = tslib.__assign({ result: this.queryManager.assumeImmutableResults
|
|
602
|
-
|
|
605
|
+
return (this.last = tslib.__assign({ result: this.queryManager.assumeImmutableResults ?
|
|
606
|
+
newResult
|
|
603
607
|
: utilities.cloneDeep(newResult), variables: variables }, (error ? { error: error } : null)));
|
|
604
608
|
};
|
|
605
609
|
ObservableQuery.prototype.reobserveAsConcast = function (newOptions, newNetworkStatus) {
|
|
606
610
|
var _this = this;
|
|
607
611
|
this.isTornDown = false;
|
|
608
|
-
var useDisposableConcast =
|
|
612
|
+
var useDisposableConcast =
|
|
613
|
+
newNetworkStatus === exports.NetworkStatus.refetch ||
|
|
609
614
|
newNetworkStatus === exports.NetworkStatus.fetchMore ||
|
|
610
615
|
newNetworkStatus === exports.NetworkStatus.poll;
|
|
611
616
|
var oldVariables = this.options.variables;
|
|
612
617
|
var oldFetchPolicy = this.options.fetchPolicy;
|
|
613
618
|
var mergedOptions = utilities.compact(this.options, newOptions || {});
|
|
614
|
-
var options = useDisposableConcast
|
|
615
|
-
|
|
616
|
-
mergedOptions
|
|
619
|
+
var options = useDisposableConcast ?
|
|
620
|
+
mergedOptions
|
|
617
621
|
: assign(this.options, mergedOptions);
|
|
618
622
|
var query = this.transformDocument(options.query);
|
|
619
623
|
this.lastQuery = query;
|
|
@@ -659,7 +663,8 @@ var ObservableQuery = (function (_super) {
|
|
|
659
663
|
return concast;
|
|
660
664
|
};
|
|
661
665
|
ObservableQuery.prototype.reobserve = function (newOptions, newNetworkStatus) {
|
|
662
|
-
return this.reobserveAsConcast(newOptions, newNetworkStatus)
|
|
666
|
+
return this.reobserveAsConcast(newOptions, newNetworkStatus)
|
|
667
|
+
.promise;
|
|
663
668
|
};
|
|
664
669
|
ObservableQuery.prototype.resubscribeAfterError = function () {
|
|
665
670
|
var args = [];
|
|
@@ -673,7 +678,8 @@ var ObservableQuery = (function (_super) {
|
|
|
673
678
|
return subscription;
|
|
674
679
|
};
|
|
675
680
|
ObservableQuery.prototype.observe = function () {
|
|
676
|
-
this.reportResult(
|
|
681
|
+
this.reportResult(
|
|
682
|
+
this.getCurrentResult(false), this.variables);
|
|
677
683
|
};
|
|
678
684
|
ObservableQuery.prototype.reportResult = function (result, variables) {
|
|
679
685
|
var lastError = this.getLastError();
|
|
@@ -719,10 +725,10 @@ function reobserveCacheFirst(obsQuery) {
|
|
|
719
725
|
if (fetchPolicy === "cache-and-network" || fetchPolicy === "network-only") {
|
|
720
726
|
return obsQuery.reobserve({
|
|
721
727
|
fetchPolicy: "cache-first",
|
|
722
|
-
nextFetchPolicy: function () {
|
|
728
|
+
nextFetchPolicy: function (currentFetchPolicy, context) {
|
|
723
729
|
this.nextFetchPolicy = nextFetchPolicy;
|
|
724
|
-
if (typeof nextFetchPolicy === "function") {
|
|
725
|
-
return nextFetchPolicy
|
|
730
|
+
if (typeof this.nextFetchPolicy === "function") {
|
|
731
|
+
return this.nextFetchPolicy(currentFetchPolicy, context);
|
|
726
732
|
}
|
|
727
733
|
return fetchPolicy;
|
|
728
734
|
},
|
|
@@ -738,13 +744,13 @@ function logMissingFieldErrors(missing) {
|
|
|
738
744
|
globalThis.__DEV__ !== false && globals.invariant.debug(24, missing);
|
|
739
745
|
}
|
|
740
746
|
}
|
|
741
|
-
function skipCacheDataFor(fetchPolicy) {
|
|
747
|
+
function skipCacheDataFor(fetchPolicy ) {
|
|
742
748
|
return (fetchPolicy === "network-only" ||
|
|
743
749
|
fetchPolicy === "no-cache" ||
|
|
744
750
|
fetchPolicy === "standby");
|
|
745
751
|
}
|
|
746
752
|
|
|
747
|
-
var LocalState =
|
|
753
|
+
var LocalState = (function () {
|
|
748
754
|
function LocalState(_a) {
|
|
749
755
|
var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher;
|
|
750
756
|
this.selectionsToResolveCache = new WeakMap();
|
|
@@ -783,9 +789,9 @@ var LocalState = (function () {
|
|
|
783
789
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
784
790
|
return tslib.__generator(this, function (_c) {
|
|
785
791
|
if (document) {
|
|
786
|
-
return [2, this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return (tslib.__assign(tslib.__assign({}, remoteResult), { data: localResult.result })); })];
|
|
792
|
+
return [2 , this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return (tslib.__assign(tslib.__assign({}, remoteResult), { data: localResult.result })); })];
|
|
787
793
|
}
|
|
788
|
-
return [2, remoteResult];
|
|
794
|
+
return [2 , remoteResult];
|
|
789
795
|
});
|
|
790
796
|
});
|
|
791
797
|
};
|
|
@@ -808,7 +814,8 @@ var LocalState = (function () {
|
|
|
808
814
|
};
|
|
809
815
|
LocalState.prototype.prepareContext = function (context) {
|
|
810
816
|
var cache = this.cache;
|
|
811
|
-
return tslib.__assign(tslib.__assign({}, context), { cache: cache,
|
|
817
|
+
return tslib.__assign(tslib.__assign({}, context), { cache: cache,
|
|
818
|
+
getCacheKey: function (obj) {
|
|
812
819
|
return cache.identify(obj);
|
|
813
820
|
} });
|
|
814
821
|
};
|
|
@@ -818,9 +825,9 @@ var LocalState = (function () {
|
|
|
818
825
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
819
826
|
return tslib.__generator(this, function (_a) {
|
|
820
827
|
if (document) {
|
|
821
|
-
return [2, this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return (tslib.__assign(tslib.__assign({}, variables), data.exportedVariables)); })];
|
|
828
|
+
return [2 , this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return (tslib.__assign(tslib.__assign({}, variables), data.exportedVariables)); })];
|
|
822
829
|
}
|
|
823
|
-
return [2, tslib.__assign({}, variables)];
|
|
830
|
+
return [2 , tslib.__assign({}, variables)];
|
|
824
831
|
});
|
|
825
832
|
});
|
|
826
833
|
};
|
|
@@ -865,8 +872,8 @@ var LocalState = (function () {
|
|
|
865
872
|
fragmentMap = utilities.createFragmentMap(fragments);
|
|
866
873
|
selectionsToResolve = this.collectSelectionsToResolve(mainDefinition, fragmentMap);
|
|
867
874
|
definitionOperation = mainDefinition.operation;
|
|
868
|
-
defaultOperationType = definitionOperation
|
|
869
|
-
|
|
875
|
+
defaultOperationType = definitionOperation ?
|
|
876
|
+
definitionOperation.charAt(0).toUpperCase() +
|
|
870
877
|
definitionOperation.slice(1)
|
|
871
878
|
: "Query";
|
|
872
879
|
_a = this, cache = _a.cache, client = _a.client;
|
|
@@ -881,7 +888,7 @@ var LocalState = (function () {
|
|
|
881
888
|
onlyRunForcedResolvers: onlyRunForcedResolvers,
|
|
882
889
|
};
|
|
883
890
|
isClientFieldDescendant = false;
|
|
884
|
-
return [2, this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({
|
|
891
|
+
return [2 , this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({
|
|
885
892
|
result: result,
|
|
886
893
|
exportedVariables: execContext.exportedVariables,
|
|
887
894
|
}); })];
|
|
@@ -900,13 +907,13 @@ var LocalState = (function () {
|
|
|
900
907
|
return tslib.__generator(this, function (_a) {
|
|
901
908
|
if (!isClientFieldDescendant &&
|
|
902
909
|
!execContext.selectionsToResolve.has(selection)) {
|
|
903
|
-
return [2];
|
|
910
|
+
return [2 ];
|
|
904
911
|
}
|
|
905
912
|
if (!utilities.shouldInclude(selection, variables)) {
|
|
906
|
-
return [2];
|
|
913
|
+
return [2 ];
|
|
907
914
|
}
|
|
908
915
|
if (utilities.isField(selection)) {
|
|
909
|
-
return [2, this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) {
|
|
916
|
+
return [2 , this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) {
|
|
910
917
|
var _a;
|
|
911
918
|
if (typeof fieldResult !== "undefined") {
|
|
912
919
|
resultsToMerge.push((_a = {},
|
|
@@ -925,15 +932,15 @@ var LocalState = (function () {
|
|
|
925
932
|
if (fragment && fragment.typeCondition) {
|
|
926
933
|
typeCondition = fragment.typeCondition.name.value;
|
|
927
934
|
if (execContext.fragmentMatcher(rootValue, typeCondition, context)) {
|
|
928
|
-
return [2, this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) {
|
|
935
|
+
return [2 , this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) {
|
|
929
936
|
resultsToMerge.push(fragmentResult);
|
|
930
937
|
})];
|
|
931
938
|
}
|
|
932
939
|
}
|
|
933
|
-
return [2];
|
|
940
|
+
return [2 ];
|
|
934
941
|
});
|
|
935
942
|
}); };
|
|
936
|
-
return [2, Promise.all(selectionSet.selections.map(execute)).then(function () {
|
|
943
|
+
return [2 , Promise.all(selectionSet.selections.map(execute)).then(function () {
|
|
937
944
|
return utilities.mergeDeepArray(resultsToMerge);
|
|
938
945
|
})];
|
|
939
946
|
});
|
|
@@ -945,7 +952,7 @@ var LocalState = (function () {
|
|
|
945
952
|
var _this = this;
|
|
946
953
|
return tslib.__generator(this, function (_a) {
|
|
947
954
|
if (!rootValue) {
|
|
948
|
-
return [2, null];
|
|
955
|
+
return [2 , null];
|
|
949
956
|
}
|
|
950
957
|
variables = execContext.variables;
|
|
951
958
|
fieldName = field.name.value;
|
|
@@ -960,7 +967,8 @@ var LocalState = (function () {
|
|
|
960
967
|
if (resolverMap) {
|
|
961
968
|
resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName];
|
|
962
969
|
if (resolve) {
|
|
963
|
-
resultPromise = Promise.resolve(
|
|
970
|
+
resultPromise = Promise.resolve(
|
|
971
|
+
cache.cacheSlot.withValue(this.cache, resolve, [
|
|
964
972
|
rootValue,
|
|
965
973
|
utilities.argumentsObjectFromField(field, variables),
|
|
966
974
|
execContext.context,
|
|
@@ -969,7 +977,7 @@ var LocalState = (function () {
|
|
|
969
977
|
}
|
|
970
978
|
}
|
|
971
979
|
}
|
|
972
|
-
return [2, resultPromise.then(function (result) {
|
|
980
|
+
return [2 , resultPromise.then(function (result) {
|
|
973
981
|
var _a, _b;
|
|
974
982
|
if (result === void 0) { result = defaultResult; }
|
|
975
983
|
if (field.directives) {
|
|
@@ -1061,7 +1069,8 @@ function wrapDestructiveCacheMethod(cache, methodName) {
|
|
|
1061
1069
|
var original = cache[methodName];
|
|
1062
1070
|
if (typeof original === "function") {
|
|
1063
1071
|
cache[methodName] = function () {
|
|
1064
|
-
destructiveMethodCounts.set(cache,
|
|
1072
|
+
destructiveMethodCounts.set(cache,
|
|
1073
|
+
(destructiveMethodCounts.get(cache) + 1) % 1e15);
|
|
1065
1074
|
return original.apply(this, arguments);
|
|
1066
1075
|
};
|
|
1067
1076
|
}
|
|
@@ -1072,7 +1081,7 @@ function cancelNotifyTimeout(info) {
|
|
|
1072
1081
|
info["notifyTimeout"] = void 0;
|
|
1073
1082
|
}
|
|
1074
1083
|
}
|
|
1075
|
-
var QueryInfo =
|
|
1084
|
+
var QueryInfo = (function () {
|
|
1076
1085
|
function QueryInfo(queryManager, queryId) {
|
|
1077
1086
|
if (queryId === void 0) { queryId = queryManager.generateQueryId(); }
|
|
1078
1087
|
this.queryId = queryId;
|
|
@@ -1134,12 +1143,13 @@ var QueryInfo = (function () {
|
|
|
1134
1143
|
return diff;
|
|
1135
1144
|
};
|
|
1136
1145
|
QueryInfo.prototype.updateLastDiff = function (diff, options) {
|
|
1137
|
-
this.lastDiff =
|
|
1138
|
-
?
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1146
|
+
this.lastDiff =
|
|
1147
|
+
diff ?
|
|
1148
|
+
{
|
|
1149
|
+
diff: diff,
|
|
1150
|
+
options: options || this.getDiffOptions(),
|
|
1151
|
+
}
|
|
1152
|
+
: void 0;
|
|
1143
1153
|
};
|
|
1144
1154
|
QueryInfo.prototype.getDiffOptions = function (variables) {
|
|
1145
1155
|
var _a;
|
|
@@ -1245,9 +1255,7 @@ var QueryInfo = (function () {
|
|
|
1245
1255
|
QueryInfo.prototype.markResult = function (result, document, options, cacheWriteBehavior) {
|
|
1246
1256
|
var _this = this;
|
|
1247
1257
|
var merger = new utilities.DeepMerger();
|
|
1248
|
-
var graphQLErrors = utilities.isNonEmptyArray(result.errors)
|
|
1249
|
-
? result.errors.slice(0)
|
|
1250
|
-
: [];
|
|
1258
|
+
var graphQLErrors = utilities.isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];
|
|
1251
1259
|
this.reset();
|
|
1252
1260
|
if ("incremental" in result && utilities.isNonEmptyArray(result.incremental)) {
|
|
1253
1261
|
var mergedData = utilities.mergeIncrementalData(this.getDiff().result, result);
|
|
@@ -1261,7 +1269,7 @@ var QueryInfo = (function () {
|
|
|
1261
1269
|
if (options.fetchPolicy === "no-cache") {
|
|
1262
1270
|
this.updateLastDiff({ result: result.data, complete: true }, this.getDiffOptions(options.variables));
|
|
1263
1271
|
}
|
|
1264
|
-
else if (cacheWriteBehavior !== 0) {
|
|
1272
|
+
else if (cacheWriteBehavior !== 0 ) {
|
|
1265
1273
|
if (shouldWriteResult(result, options.errorPolicy)) {
|
|
1266
1274
|
this.cache.performTransaction(function (cache) {
|
|
1267
1275
|
if (_this.shouldWrite(result, options.variables)) {
|
|
@@ -1269,7 +1277,7 @@ var QueryInfo = (function () {
|
|
|
1269
1277
|
query: document,
|
|
1270
1278
|
data: result.data,
|
|
1271
1279
|
variables: options.variables,
|
|
1272
|
-
overwrite: cacheWriteBehavior === 1,
|
|
1280
|
+
overwrite: cacheWriteBehavior === 1 ,
|
|
1273
1281
|
});
|
|
1274
1282
|
_this.lastWrite = {
|
|
1275
1283
|
result: result,
|
|
@@ -1328,10 +1336,10 @@ function shouldWriteResult(result, errorPolicy) {
|
|
|
1328
1336
|
}
|
|
1329
1337
|
|
|
1330
1338
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1331
|
-
var QueryManager =
|
|
1339
|
+
var QueryManager = (function () {
|
|
1332
1340
|
function QueryManager(_a) {
|
|
1333
|
-
var _this = this;
|
|
1334
1341
|
var cache = _a.cache, link = _a.link, defaultOptions = _a.defaultOptions, documentTransform = _a.documentTransform, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, onBroadcast = _a.onBroadcast, _c = _a.ssrMode, ssrMode = _c === void 0 ? false : _c, _d = _a.clientAwareness, clientAwareness = _d === void 0 ? {} : _d, localState = _a.localState, _e = _a.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? !!cache.assumeImmutableResults : _e;
|
|
1342
|
+
var _this = this;
|
|
1335
1343
|
this.clientAwareness = {};
|
|
1336
1344
|
this.queries = new Map();
|
|
1337
1345
|
this.fetchCancelFns = new Map();
|
|
@@ -1340,7 +1348,8 @@ var QueryManager = (function () {
|
|
|
1340
1348
|
this.requestIdCounter = 1;
|
|
1341
1349
|
this.mutationIdCounter = 1;
|
|
1342
1350
|
this.inFlightLinkObservables = new Map();
|
|
1343
|
-
var defaultDocumentTransform = new utilities.DocumentTransform(function (document) { return _this.cache.transformDocument(document); },
|
|
1351
|
+
var defaultDocumentTransform = new utilities.DocumentTransform(function (document) { return _this.cache.transformDocument(document); },
|
|
1352
|
+
{ cache: false });
|
|
1344
1353
|
this.cache = cache;
|
|
1345
1354
|
this.link = link;
|
|
1346
1355
|
this.defaultOptions = defaultOptions || Object.create(null);
|
|
@@ -1349,11 +1358,12 @@ var QueryManager = (function () {
|
|
|
1349
1358
|
this.localState = localState || new LocalState({ cache: cache });
|
|
1350
1359
|
this.ssrMode = ssrMode;
|
|
1351
1360
|
this.assumeImmutableResults = assumeImmutableResults;
|
|
1352
|
-
this.documentTransform =
|
|
1353
|
-
?
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1361
|
+
this.documentTransform =
|
|
1362
|
+
documentTransform ?
|
|
1363
|
+
defaultDocumentTransform
|
|
1364
|
+
.concat(documentTransform)
|
|
1365
|
+
.concat(defaultDocumentTransform)
|
|
1366
|
+
: defaultDocumentTransform;
|
|
1357
1367
|
if ((this.onBroadcast = onBroadcast)) {
|
|
1358
1368
|
this.mutationStore = Object.create(null);
|
|
1359
1369
|
}
|
|
@@ -1383,8 +1393,8 @@ var QueryManager = (function () {
|
|
|
1383
1393
|
mutation = this.cache.transformForLink(this.transform(mutation));
|
|
1384
1394
|
hasClientExports = this.getDocumentInfo(mutation).hasClientExports;
|
|
1385
1395
|
variables = this.getVariables(mutation, variables);
|
|
1386
|
-
if (!hasClientExports) return [3, 2];
|
|
1387
|
-
return [4, this.localState.addExportedVariables(mutation, variables, context)];
|
|
1396
|
+
if (!hasClientExports) return [3 , 2];
|
|
1397
|
+
return [4 , this.localState.addExportedVariables(mutation, variables, context)];
|
|
1388
1398
|
case 1:
|
|
1389
1399
|
variables = (_h.sent());
|
|
1390
1400
|
_h.label = 2;
|
|
@@ -1411,7 +1421,7 @@ var QueryManager = (function () {
|
|
|
1411
1421
|
}
|
|
1412
1422
|
this.broadcastQueries();
|
|
1413
1423
|
self = this;
|
|
1414
|
-
return [2, new Promise(function (resolve, reject) {
|
|
1424
|
+
return [2 , new Promise(function (resolve, reject) {
|
|
1415
1425
|
return utilities.asyncMap(self.getObservableFromLink(mutation, tslib.__assign(tslib.__assign({}, context), { optimisticResponse: optimisticResponse }), variables, false), function (result) {
|
|
1416
1426
|
if (utilities.graphQLResultHasError(result) && errorPolicy === "none") {
|
|
1417
1427
|
throw new errors.ApolloError({
|
|
@@ -1461,11 +1471,9 @@ var QueryManager = (function () {
|
|
|
1461
1471
|
self.cache.removeOptimistic(mutationId);
|
|
1462
1472
|
}
|
|
1463
1473
|
self.broadcastQueries();
|
|
1464
|
-
reject(err instanceof errors.ApolloError
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
networkError: err,
|
|
1468
|
-
}));
|
|
1474
|
+
reject(err instanceof errors.ApolloError ? err : (new errors.ApolloError({
|
|
1475
|
+
networkError: err,
|
|
1476
|
+
})));
|
|
1469
1477
|
},
|
|
1470
1478
|
});
|
|
1471
1479
|
})];
|
|
@@ -1608,8 +1616,8 @@ var QueryManager = (function () {
|
|
|
1608
1616
|
};
|
|
1609
1617
|
QueryManager.prototype.markMutationOptimistic = function (optimisticResponse, mutation) {
|
|
1610
1618
|
var _this = this;
|
|
1611
|
-
var data = typeof optimisticResponse === "function"
|
|
1612
|
-
|
|
1619
|
+
var data = typeof optimisticResponse === "function" ?
|
|
1620
|
+
optimisticResponse(mutation.variables)
|
|
1613
1621
|
: optimisticResponse;
|
|
1614
1622
|
return this.cache.recordOptimisticTransaction(function (cache) {
|
|
1615
1623
|
try {
|
|
@@ -1901,7 +1909,8 @@ var QueryManager = (function () {
|
|
|
1901
1909
|
QueryManager.prototype.getLocalState = function () {
|
|
1902
1910
|
return this.localState;
|
|
1903
1911
|
};
|
|
1904
|
-
QueryManager.prototype.getObservableFromLink = function (query, context, variables,
|
|
1912
|
+
QueryManager.prototype.getObservableFromLink = function (query, context, variables,
|
|
1913
|
+
deduplication) {
|
|
1905
1914
|
var _this = this;
|
|
1906
1915
|
var _a;
|
|
1907
1916
|
if (deduplication === void 0) { deduplication = (_a = context === null || context === void 0 ? void 0 : context.queryDeduplication) !== null && _a !== void 0 ? _a : this.queryDeduplication; }
|
|
@@ -1982,16 +1991,15 @@ var QueryManager = (function () {
|
|
|
1982
1991
|
}
|
|
1983
1992
|
return aqr;
|
|
1984
1993
|
}, function (networkError) {
|
|
1985
|
-
var error = errors.isApolloError(networkError)
|
|
1986
|
-
? networkError
|
|
1987
|
-
: new errors.ApolloError({ networkError: networkError });
|
|
1994
|
+
var error = errors.isApolloError(networkError) ? networkError : (new errors.ApolloError({ networkError: networkError }));
|
|
1988
1995
|
if (requestId >= queryInfo.lastRequestId) {
|
|
1989
1996
|
queryInfo.markError(error);
|
|
1990
1997
|
}
|
|
1991
1998
|
throw error;
|
|
1992
1999
|
});
|
|
1993
2000
|
};
|
|
1994
|
-
QueryManager.prototype.fetchConcastWithInfo = function (queryId, options,
|
|
2001
|
+
QueryManager.prototype.fetchConcastWithInfo = function (queryId, options,
|
|
2002
|
+
networkStatus, query) {
|
|
1995
2003
|
var _this = this;
|
|
1996
2004
|
if (networkStatus === void 0) { networkStatus = exports.NetworkStatus.loading; }
|
|
1997
2005
|
if (query === void 0) { query = options.query; }
|
|
@@ -2011,7 +2019,8 @@ var QueryManager = (function () {
|
|
|
2011
2019
|
var fromVariables = function (variables) {
|
|
2012
2020
|
normalized.variables = variables;
|
|
2013
2021
|
var sourcesWithInfo = _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus);
|
|
2014
|
-
if (
|
|
2022
|
+
if (
|
|
2023
|
+
normalized.fetchPolicy !== "standby" &&
|
|
2015
2024
|
sourcesWithInfo.sources.length > 0 &&
|
|
2016
2025
|
queryInfo.observableQuery) {
|
|
2017
2026
|
queryInfo.observableQuery["applyNextFetchPolicy"]("after-fetch", options);
|
|
@@ -2109,7 +2118,8 @@ var QueryManager = (function () {
|
|
|
2109
2118
|
}
|
|
2110
2119
|
return results;
|
|
2111
2120
|
};
|
|
2112
|
-
QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a,
|
|
2121
|
+
QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a,
|
|
2122
|
+
networkStatus) {
|
|
2113
2123
|
var _this = this;
|
|
2114
2124
|
var query = _a.query, variables = _a.variables, fetchPolicy = _a.fetchPolicy, refetchWritePolicy = _a.refetchWritePolicy, errorPolicy = _a.errorPolicy, returnPartialData = _a.returnPartialData, context = _a.context, notifyOnNetworkStatusChange = _a.notifyOnNetworkStatusChange;
|
|
2115
2125
|
var oldNetworkStatus = queryInfo.networkStatus;
|
|
@@ -2146,13 +2156,11 @@ var QueryManager = (function () {
|
|
|
2146
2156
|
}
|
|
2147
2157
|
return fromData(data);
|
|
2148
2158
|
};
|
|
2149
|
-
var cacheWriteBehavior = fetchPolicy === "no-cache"
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
? 1
|
|
2155
|
-
: 2;
|
|
2159
|
+
var cacheWriteBehavior = fetchPolicy === "no-cache" ? 0
|
|
2160
|
+
: (networkStatus === exports.NetworkStatus.refetch &&
|
|
2161
|
+
refetchWritePolicy !== "merge") ?
|
|
2162
|
+
1
|
|
2163
|
+
: 2 ;
|
|
2156
2164
|
var resultsFromLink = function () {
|
|
2157
2165
|
return _this.getResultsFromLink(queryInfo, cacheWriteBehavior, {
|
|
2158
2166
|
query: query,
|
|
@@ -2234,7 +2242,7 @@ var QueryManager = (function () {
|
|
|
2234
2242
|
}());
|
|
2235
2243
|
|
|
2236
2244
|
var hasSuggestedDevtools = false;
|
|
2237
|
-
var ApolloClient =
|
|
2245
|
+
var ApolloClient = (function () {
|
|
2238
2246
|
function ApolloClient(options) {
|
|
2239
2247
|
var _this = this;
|
|
2240
2248
|
this.resetStoreCallbacks = [];
|
|
@@ -2242,14 +2250,15 @@ var ApolloClient = (function () {
|
|
|
2242
2250
|
if (!options.cache) {
|
|
2243
2251
|
throw globals.newInvariantError(15);
|
|
2244
2252
|
}
|
|
2245
|
-
var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, documentTransform = options.documentTransform, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b,
|
|
2253
|
+
var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, documentTransform = options.documentTransform, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b,
|
|
2254
|
+
_c = options.connectToDevTools,
|
|
2255
|
+
connectToDevTools = _c === void 0 ? typeof window === "object" &&
|
|
2246
2256
|
!window.__APOLLO_CLIENT__ &&
|
|
2247
2257
|
globalThis.__DEV__ !== false : _c, _d = options.queryDeduplication, queryDeduplication = _d === void 0 ? true : _d, defaultOptions = options.defaultOptions, _e = options.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? cache.assumeImmutableResults : _e, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version;
|
|
2248
2258
|
var link = options.link;
|
|
2249
2259
|
if (!link) {
|
|
2250
|
-
link =
|
|
2251
|
-
? new http.HttpLink({ uri: uri, credentials: credentials, headers: headers })
|
|
2252
|
-
: core.ApolloLink.empty();
|
|
2260
|
+
link =
|
|
2261
|
+
uri ? new http.HttpLink({ uri: uri, credentials: credentials, headers: headers }) : core.ApolloLink.empty();
|
|
2253
2262
|
}
|
|
2254
2263
|
this.link = link;
|
|
2255
2264
|
this.cache = cache;
|
|
@@ -2285,8 +2294,8 @@ var ApolloClient = (function () {
|
|
|
2285
2294
|
},
|
|
2286
2295
|
localState: this.localState,
|
|
2287
2296
|
assumeImmutableResults: assumeImmutableResults,
|
|
2288
|
-
onBroadcast: connectToDevTools
|
|
2289
|
-
|
|
2297
|
+
onBroadcast: connectToDevTools ?
|
|
2298
|
+
function () {
|
|
2290
2299
|
if (_this.devToolsHookCb) {
|
|
2291
2300
|
_this.devToolsHookCb({
|
|
2292
2301
|
action: {},
|
package/core/equalByQuery.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import equal from "@wry/equality";
|
|
3
3
|
import { createFragmentMap, getFragmentDefinitions, getFragmentFromSelection, getMainDefinition, isField, resultKeyNameFromField, shouldInclude, } from "../utilities/index.js";
|
|
4
|
+
// Returns true if aResult and bResult are deeply equal according to the fields
|
|
5
|
+
// selected by the given query, ignoring any fields marked as @nonreactive.
|
|
4
6
|
export function equalByQuery(query, _a, _b, variables) {
|
|
5
7
|
var aData = _a.data, aRest = __rest(_a, ["data"]);
|
|
6
8
|
var bData = _b.data, bRest = __rest(_b, ["data"]);
|
|
@@ -15,12 +17,20 @@ function equalBySelectionSet(selectionSet, aResult, bResult, context) {
|
|
|
15
17
|
return true;
|
|
16
18
|
}
|
|
17
19
|
var seenSelections = new Set();
|
|
20
|
+
// Returning true from this Array.prototype.every callback function skips the
|
|
21
|
+
// current field/subtree. Returning false aborts the entire traversal
|
|
22
|
+
// immediately, causing equalBySelectionSet to return false.
|
|
18
23
|
return selectionSet.selections.every(function (selection) {
|
|
24
|
+
// Avoid re-processing the same selection at the same level of recursion, in
|
|
25
|
+
// case the same field gets included via multiple indirect fragment spreads.
|
|
19
26
|
if (seenSelections.has(selection))
|
|
20
27
|
return true;
|
|
21
28
|
seenSelections.add(selection);
|
|
29
|
+
// Ignore @skip(if: true) and @include(if: false) fields.
|
|
22
30
|
if (!shouldInclude(selection, context.variables))
|
|
23
31
|
return true;
|
|
32
|
+
// If the field or (named) fragment spread has a @nonreactive directive on
|
|
33
|
+
// it, we don't care if it's different, so we pretend it's the same.
|
|
24
34
|
if (selectionHasNonreactiveDirective(selection))
|
|
25
35
|
return true;
|
|
26
36
|
if (isField(selection)) {
|
|
@@ -29,6 +39,8 @@ function equalBySelectionSet(selectionSet, aResult, bResult, context) {
|
|
|
29
39
|
var bResultChild = bResult && bResult[resultKey];
|
|
30
40
|
var childSelectionSet = selection.selectionSet;
|
|
31
41
|
if (!childSelectionSet) {
|
|
42
|
+
// These are scalar values, so we can compare them with deep equal
|
|
43
|
+
// without redoing the main recursive work.
|
|
32
44
|
return equal(aResultChild, bResultChild);
|
|
33
45
|
}
|
|
34
46
|
var aChildIsArray = Array.isArray(aResultChild);
|
|
@@ -52,9 +64,16 @@ function equalBySelectionSet(selectionSet, aResult, bResult, context) {
|
|
|
52
64
|
else {
|
|
53
65
|
var fragment = getFragmentFromSelection(selection, context.fragmentMap);
|
|
54
66
|
if (fragment) {
|
|
67
|
+
// The fragment might === selection if it's an inline fragment, but
|
|
68
|
+
// could be !== if it's a named fragment ...spread.
|
|
55
69
|
if (selectionHasNonreactiveDirective(fragment))
|
|
56
70
|
return true;
|
|
57
|
-
return equalBySelectionSet(fragment.selectionSet,
|
|
71
|
+
return equalBySelectionSet(fragment.selectionSet,
|
|
72
|
+
// Notice that we reuse the same aResult and bResult values here,
|
|
73
|
+
// since the fragment ...spread does not specify a field name, but
|
|
74
|
+
// consists of multiple fields (within the fragment's selection set)
|
|
75
|
+
// that should be applied to the current result value(s).
|
|
76
|
+
aResult, bResult, context);
|
|
58
77
|
}
|
|
59
78
|
}
|
|
60
79
|
});
|