@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/apollo-client.cjs
CHANGED
|
@@ -9,7 +9,6 @@ var graphql = require('graphql');
|
|
|
9
9
|
var zenObservableTs = require('zen-observable-ts');
|
|
10
10
|
require('symbol-observable');
|
|
11
11
|
var optimism = require('optimism');
|
|
12
|
-
var context = require('@wry/context');
|
|
13
12
|
var trie = require('@wry/trie');
|
|
14
13
|
var graphqlTag = require('graphql-tag');
|
|
15
14
|
var React = require('react');
|
|
@@ -31,7 +30,7 @@ function _interopNamespace(e) {
|
|
|
31
30
|
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
|
|
32
31
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
33
32
|
|
|
34
|
-
var version = "3.8.
|
|
33
|
+
var version = "3.8.8";
|
|
35
34
|
|
|
36
35
|
function maybe(thunk) {
|
|
37
36
|
try {
|
|
@@ -43,7 +42,8 @@ function maybe(thunk) {
|
|
|
43
42
|
var global$1 = (maybe(function () { return globalThis; }) ||
|
|
44
43
|
maybe(function () { return window; }) ||
|
|
45
44
|
maybe(function () { return self; }) ||
|
|
46
|
-
maybe(function () { return global; }) ||
|
|
45
|
+
maybe(function () { return global; }) ||
|
|
46
|
+
maybe(function () {
|
|
47
47
|
return maybe.constructor("return this")();
|
|
48
48
|
}));
|
|
49
49
|
|
|
@@ -105,9 +105,7 @@ function newInvariantError(message) {
|
|
|
105
105
|
}
|
|
106
106
|
var ApolloErrorMessageHandler = Symbol.for("ApolloErrorMessageHandler_" + version);
|
|
107
107
|
function stringify$1(arg) {
|
|
108
|
-
return typeof arg == "string"
|
|
109
|
-
? arg
|
|
110
|
-
: stringifyForDisplay(arg, 2).slice(0, 1000);
|
|
108
|
+
return typeof arg == "string" ? arg : (stringifyForDisplay(arg, 2).slice(0, 1000));
|
|
111
109
|
}
|
|
112
110
|
function getHandledErrorMsg(message, messageArgs) {
|
|
113
111
|
if (messageArgs === void 0) { messageArgs = []; }
|
|
@@ -191,7 +189,8 @@ var canUseWeakSet = typeof WeakSet === "function";
|
|
|
191
189
|
var canUseSymbol = typeof Symbol === "function" && typeof Symbol.for === "function";
|
|
192
190
|
var canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator;
|
|
193
191
|
var canUseDOM = typeof maybe(function () { return window.document.createElement; }) === "function";
|
|
194
|
-
var usingJSDOM =
|
|
192
|
+
var usingJSDOM =
|
|
193
|
+
maybe(function () { return navigator.userAgent.indexOf("jsdom") >= 0; }) || false;
|
|
195
194
|
var canUseLayoutEffect = canUseDOM && !usingJSDOM;
|
|
196
195
|
|
|
197
196
|
function isNonNullObject(obj) {
|
|
@@ -376,8 +375,8 @@ var getStoreKeyName = Object.assign(function (fieldName, args, directives) {
|
|
|
376
375
|
directives["connection"]["key"]) {
|
|
377
376
|
if (directives["connection"]["filter"] &&
|
|
378
377
|
directives["connection"]["filter"].length > 0) {
|
|
379
|
-
var filterKeys = directives["connection"]["filter"]
|
|
380
|
-
|
|
378
|
+
var filterKeys = directives["connection"]["filter"] ?
|
|
379
|
+
directives["connection"]["filter"]
|
|
381
380
|
: [];
|
|
382
381
|
filterKeys.sort();
|
|
383
382
|
var filteredArgs_1 = {};
|
|
@@ -560,12 +559,10 @@ function getDefaultValues(definition) {
|
|
|
560
559
|
function identity(document) {
|
|
561
560
|
return document;
|
|
562
561
|
}
|
|
563
|
-
var DocumentTransform =
|
|
562
|
+
var DocumentTransform = (function () {
|
|
564
563
|
function DocumentTransform(transform, options) {
|
|
565
564
|
if (options === void 0) { options = Object.create(null); }
|
|
566
|
-
this.resultCache = canUseWeakSet
|
|
567
|
-
? new WeakSet()
|
|
568
|
-
: new Set();
|
|
565
|
+
this.resultCache = canUseWeakSet ? new WeakSet() : new Set();
|
|
569
566
|
this.transform = transform;
|
|
570
567
|
if (options.getCacheKey) {
|
|
571
568
|
this.getCacheKey = options.getCacheKey;
|
|
@@ -585,7 +582,8 @@ var DocumentTransform = (function () {
|
|
|
585
582
|
return new DocumentTransform(function (document) {
|
|
586
583
|
var documentTransform = predicate(document) ? left : right;
|
|
587
584
|
return documentTransform.transformDocument(document);
|
|
588
|
-
},
|
|
585
|
+
},
|
|
586
|
+
{ cache: false });
|
|
589
587
|
};
|
|
590
588
|
DocumentTransform.prototype.transformDocument = function (document) {
|
|
591
589
|
if (this.resultCache.has(document)) {
|
|
@@ -607,7 +605,8 @@ var DocumentTransform = (function () {
|
|
|
607
605
|
var _this = this;
|
|
608
606
|
return new DocumentTransform(function (document) {
|
|
609
607
|
return otherTransform.transformDocument(_this.transformDocument(document));
|
|
610
|
-
},
|
|
608
|
+
},
|
|
609
|
+
{ cache: false });
|
|
611
610
|
};
|
|
612
611
|
DocumentTransform.prototype.getStableCacheEntry = function (document) {
|
|
613
612
|
if (!this.stableCacheKeys)
|
|
@@ -652,8 +651,8 @@ function isEmpty(op, fragmentMap) {
|
|
|
652
651
|
}));
|
|
653
652
|
}
|
|
654
653
|
function nullIfDocIsEmpty(doc) {
|
|
655
|
-
return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc)))
|
|
656
|
-
|
|
654
|
+
return (isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc)))) ?
|
|
655
|
+
null
|
|
657
656
|
: doc;
|
|
658
657
|
}
|
|
659
658
|
function getDirectiveMatcher(configs) {
|
|
@@ -773,7 +772,8 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
773
772
|
if (node === originalNode) {
|
|
774
773
|
return node;
|
|
775
774
|
}
|
|
776
|
-
if (
|
|
775
|
+
if (
|
|
776
|
+
operationCount > 0 &&
|
|
777
777
|
node.selectionSet.selections.every(function (selection) {
|
|
778
778
|
return selection.kind === graphql.Kind.FIELD &&
|
|
779
779
|
selection.name.value === "__typename";
|
|
@@ -828,7 +828,8 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
828
828
|
});
|
|
829
829
|
});
|
|
830
830
|
var fragmentWillBeRemoved = function (fragmentName) {
|
|
831
|
-
return !!(
|
|
831
|
+
return !!(
|
|
832
|
+
(!allFragmentNamesUsed.has(fragmentName) ||
|
|
832
833
|
getInUseByFragmentName(fragmentName).removed));
|
|
833
834
|
};
|
|
834
835
|
var enterVisitor = {
|
|
@@ -844,7 +845,8 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
844
845
|
OperationDefinition: {
|
|
845
846
|
leave: function (node) {
|
|
846
847
|
if (node.variableDefinitions) {
|
|
847
|
-
var usedVariableNames_1 = populateTransitiveVars(
|
|
848
|
+
var usedVariableNames_1 = populateTransitiveVars(
|
|
849
|
+
getInUseByOperationName(node.name && node.name.value)).transitiveVars;
|
|
848
850
|
if (usedVariableNames_1.size < node.variableDefinitions.length) {
|
|
849
851
|
return tslib.__assign(tslib.__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) {
|
|
850
852
|
return usedVariableNames_1.has(varDef.variable.name.value);
|
|
@@ -939,7 +941,7 @@ function mergeDeepArray(sources) {
|
|
|
939
941
|
var defaultReconciler = function (target, source, property) {
|
|
940
942
|
return this.merge(target[property], source[property]);
|
|
941
943
|
};
|
|
942
|
-
var DeepMerger =
|
|
944
|
+
var DeepMerger = (function () {
|
|
943
945
|
function DeepMerger(reconciler) {
|
|
944
946
|
if (reconciler === void 0) { reconciler = defaultReconciler; }
|
|
945
947
|
this.reconciler = reconciler;
|
|
@@ -1112,8 +1114,8 @@ function asyncMap(observable, mapFn, catchFn) {
|
|
|
1112
1114
|
return function (arg) {
|
|
1113
1115
|
if (examiner) {
|
|
1114
1116
|
var both = function () {
|
|
1115
|
-
return observer.closed
|
|
1116
|
-
|
|
1117
|
+
return observer.closed ?
|
|
1118
|
+
0
|
|
1117
1119
|
: examiner(arg);
|
|
1118
1120
|
};
|
|
1119
1121
|
promiseQueue = promiseQueue.then(both, both).then(function (result) { return observer.next(result); }, function (error) { return observer.error(error); });
|
|
@@ -1127,7 +1129,7 @@ function asyncMap(observable, mapFn, catchFn) {
|
|
|
1127
1129
|
next: makeCallback(mapFn, "next"),
|
|
1128
1130
|
error: makeCallback(catchFn, "error"),
|
|
1129
1131
|
complete: function () {
|
|
1130
|
-
|
|
1132
|
+
promiseQueue.then(function () { return observer.complete(); });
|
|
1131
1133
|
},
|
|
1132
1134
|
};
|
|
1133
1135
|
var sub = observable.subscribe(handler);
|
|
@@ -1149,7 +1151,7 @@ function fixObservableSubclass(subclass) {
|
|
|
1149
1151
|
function isPromiseLike(value) {
|
|
1150
1152
|
return value && typeof value.then === "function";
|
|
1151
1153
|
}
|
|
1152
|
-
var Concast =
|
|
1154
|
+
var Concast = (function (_super) {
|
|
1153
1155
|
tslib.__extends(Concast, _super);
|
|
1154
1156
|
function Concast(sources) {
|
|
1155
1157
|
var _this = _super.call(this, function (observer) {
|
|
@@ -1312,9 +1314,7 @@ function graphQLResultHasError(result) {
|
|
|
1312
1314
|
return isNonEmptyArray(errors);
|
|
1313
1315
|
}
|
|
1314
1316
|
function getGraphQLErrorsFromResult(result) {
|
|
1315
|
-
var graphQLErrors = isNonEmptyArray(result.errors)
|
|
1316
|
-
? result.errors.slice(0)
|
|
1317
|
-
: [];
|
|
1317
|
+
var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];
|
|
1318
1318
|
if (isExecutionPatchIncrementalResult(result) &&
|
|
1319
1319
|
isNonEmptyArray(result.incremental)) {
|
|
1320
1320
|
result.incremental.forEach(function (incrementalResult) {
|
|
@@ -1443,8 +1443,8 @@ function transformOperation(operation) {
|
|
|
1443
1443
|
};
|
|
1444
1444
|
if (!transformedOperation.operationName) {
|
|
1445
1445
|
transformedOperation.operationName =
|
|
1446
|
-
typeof transformedOperation.query !== "string"
|
|
1447
|
-
|
|
1446
|
+
typeof transformedOperation.query !== "string" ?
|
|
1447
|
+
getOperationName(transformedOperation.query) || undefined
|
|
1448
1448
|
: "";
|
|
1449
1449
|
}
|
|
1450
1450
|
return transformedOperation;
|
|
@@ -1476,7 +1476,7 @@ function toLink(handler) {
|
|
|
1476
1476
|
function isTerminating(link) {
|
|
1477
1477
|
return link.request.length <= 1;
|
|
1478
1478
|
}
|
|
1479
|
-
var ApolloLink =
|
|
1479
|
+
var ApolloLink = (function () {
|
|
1480
1480
|
function ApolloLink(request) {
|
|
1481
1481
|
if (request)
|
|
1482
1482
|
this.request = request;
|
|
@@ -1494,15 +1494,15 @@ var ApolloLink = (function () {
|
|
|
1494
1494
|
var rightLink = toLink(right || new ApolloLink(passthrough));
|
|
1495
1495
|
if (isTerminating(leftLink) && isTerminating(rightLink)) {
|
|
1496
1496
|
return new ApolloLink(function (operation) {
|
|
1497
|
-
return test(operation)
|
|
1498
|
-
|
|
1497
|
+
return test(operation) ?
|
|
1498
|
+
leftLink.request(operation) || zenObservableTs.Observable.of()
|
|
1499
1499
|
: rightLink.request(operation) || zenObservableTs.Observable.of();
|
|
1500
1500
|
});
|
|
1501
1501
|
}
|
|
1502
1502
|
else {
|
|
1503
1503
|
return new ApolloLink(function (operation, forward) {
|
|
1504
|
-
return test(operation)
|
|
1505
|
-
|
|
1504
|
+
return test(operation) ?
|
|
1505
|
+
leftLink.request(operation, forward) || zenObservableTs.Observable.of()
|
|
1506
1506
|
: rightLink.request(operation, forward) || zenObservableTs.Observable.of();
|
|
1507
1507
|
});
|
|
1508
1508
|
}
|
|
@@ -1745,7 +1745,7 @@ var generateErrorMessage = function (err) {
|
|
|
1745
1745
|
})
|
|
1746
1746
|
.join("\n"));
|
|
1747
1747
|
};
|
|
1748
|
-
var ApolloError =
|
|
1748
|
+
var ApolloError = (function (_super) {
|
|
1749
1749
|
tslib.__extends(ApolloError, _super);
|
|
1750
1750
|
function ApolloError(_a) {
|
|
1751
1751
|
var graphQLErrors = _a.graphQLErrors, protocolErrors = _a.protocolErrors, clientErrors = _a.clientErrors, networkError = _a.networkError, errorMessage = _a.errorMessage, extraInfo = _a.extraInfo;
|
|
@@ -1778,8 +1778,8 @@ function readMultipartBody(response, nextValue) {
|
|
|
1778
1778
|
decoder = new TextDecoder("utf-8");
|
|
1779
1779
|
contentType = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type");
|
|
1780
1780
|
delimiter = "boundary=";
|
|
1781
|
-
boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter))
|
|
1782
|
-
|
|
1781
|
+
boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter)) ?
|
|
1782
|
+
contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['"]/g, "").replace(/\;(.*)/gm, "").trim()
|
|
1783
1783
|
: "-";
|
|
1784
1784
|
boundary = "\r\n--".concat(boundaryVal);
|
|
1785
1785
|
buffer = "";
|
|
@@ -1787,8 +1787,8 @@ function readMultipartBody(response, nextValue) {
|
|
|
1787
1787
|
running = true;
|
|
1788
1788
|
_e.label = 1;
|
|
1789
1789
|
case 1:
|
|
1790
|
-
if (!running) return [3, 3];
|
|
1791
|
-
return [4, iterator.next()];
|
|
1790
|
+
if (!running) return [3 , 3];
|
|
1791
|
+
return [4 , iterator.next()];
|
|
1792
1792
|
case 2:
|
|
1793
1793
|
_b = _e.sent(), value = _b.value, done = _b.done;
|
|
1794
1794
|
chunk = typeof value === "string" ? value : decoder.decode(value);
|
|
@@ -1831,16 +1831,17 @@ function readMultipartBody(response, nextValue) {
|
|
|
1831
1831
|
nextValue(result);
|
|
1832
1832
|
}
|
|
1833
1833
|
}
|
|
1834
|
-
else if (
|
|
1834
|
+
else if (
|
|
1835
|
+
Object.keys(result).length === 1 &&
|
|
1835
1836
|
"hasNext" in result &&
|
|
1836
1837
|
!result.hasNext) {
|
|
1837
|
-
return [2];
|
|
1838
|
+
return [2 ];
|
|
1838
1839
|
}
|
|
1839
1840
|
}
|
|
1840
1841
|
bi = buffer.indexOf(boundary);
|
|
1841
1842
|
}
|
|
1842
|
-
return [3, 1];
|
|
1843
|
-
case 3: return [2];
|
|
1843
|
+
return [3 , 1];
|
|
1844
|
+
case 3: return [2 ];
|
|
1844
1845
|
}
|
|
1845
1846
|
});
|
|
1846
1847
|
});
|
|
@@ -1899,8 +1900,8 @@ function parseAndCheckHttpResponse(operations) {
|
|
|
1899
1900
|
if (!Array.isArray(result) &&
|
|
1900
1901
|
!hasOwnProperty$3.call(result, "data") &&
|
|
1901
1902
|
!hasOwnProperty$3.call(result, "errors")) {
|
|
1902
|
-
throwServerError(response, result, "Server response was missing for query '".concat(Array.isArray(operations)
|
|
1903
|
-
|
|
1903
|
+
throwServerError(response, result, "Server response was missing for query '".concat(Array.isArray(operations) ?
|
|
1904
|
+
operations.map(function (op) { return op.operationName; })
|
|
1904
1905
|
: operations.operationName, "'."));
|
|
1905
1906
|
}
|
|
1906
1907
|
return result;
|
|
@@ -2071,7 +2072,8 @@ function rewriteURIForGET(chosenURI, body) {
|
|
|
2071
2072
|
var backupFetch = maybe(function () { return fetch; });
|
|
2072
2073
|
var createHttpLink = function (linkOptions) {
|
|
2073
2074
|
if (linkOptions === void 0) { linkOptions = {}; }
|
|
2074
|
-
var _a = linkOptions.uri, uri = _a === void 0 ? "/graphql" : _a,
|
|
2075
|
+
var _a = linkOptions.uri, uri = _a === void 0 ? "/graphql" : _a,
|
|
2076
|
+
preferredFetch = linkOptions.fetch, _b = linkOptions.print, print = _b === void 0 ? defaultPrinter : _b, includeExtensions = linkOptions.includeExtensions, preserveHeaderCase = linkOptions.preserveHeaderCase, useGETForQueries = linkOptions.useGETForQueries, _c = linkOptions.includeUnusedVariables, includeUnusedVariables = _c === void 0 ? false : _c, requestOptions = tslib.__rest(linkOptions, ["uri", "fetch", "print", "includeExtensions", "preserveHeaderCase", "useGETForQueries", "includeUnusedVariables"]);
|
|
2075
2077
|
if (globalThis.__DEV__ !== false) {
|
|
2076
2078
|
checkFetcher(preferredFetch || backupFetch);
|
|
2077
2079
|
}
|
|
@@ -2190,7 +2192,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
2190
2192
|
});
|
|
2191
2193
|
};
|
|
2192
2194
|
|
|
2193
|
-
var HttpLink =
|
|
2195
|
+
var HttpLink = (function (_super) {
|
|
2194
2196
|
tslib.__extends(HttpLink, _super);
|
|
2195
2197
|
function HttpLink(options) {
|
|
2196
2198
|
if (options === void 0) { options = {}; }
|
|
@@ -2201,17 +2203,15 @@ var HttpLink = (function (_super) {
|
|
|
2201
2203
|
return HttpLink;
|
|
2202
2204
|
}(ApolloLink));
|
|
2203
2205
|
|
|
2204
|
-
var ApolloCache =
|
|
2206
|
+
var ApolloCache = (function () {
|
|
2205
2207
|
function ApolloCache() {
|
|
2206
2208
|
this.assumeImmutableResults = false;
|
|
2207
2209
|
this.getFragmentDoc = optimism.wrap(getFragmentQueryDocument);
|
|
2208
2210
|
}
|
|
2209
2211
|
ApolloCache.prototype.batch = function (options) {
|
|
2210
2212
|
var _this = this;
|
|
2211
|
-
var optimisticId = typeof options.optimistic === "string"
|
|
2212
|
-
|
|
2213
|
-
: options.optimistic === false
|
|
2214
|
-
? null
|
|
2213
|
+
var optimisticId = typeof options.optimistic === "string" ? options.optimistic
|
|
2214
|
+
: options.optimistic === false ? null
|
|
2215
2215
|
: void 0;
|
|
2216
2216
|
var updateResult;
|
|
2217
2217
|
this.performTransaction(function () { return (updateResult = options.update(_this)); }, optimisticId);
|
|
@@ -2289,7 +2289,7 @@ exports.Cache = void 0;
|
|
|
2289
2289
|
(function (Cache) {
|
|
2290
2290
|
})(exports.Cache || (exports.Cache = {}));
|
|
2291
2291
|
|
|
2292
|
-
var MissingFieldError =
|
|
2292
|
+
var MissingFieldError = (function (_super) {
|
|
2293
2293
|
tslib.__extends(MissingFieldError, _super);
|
|
2294
2294
|
function MissingFieldError(message, path, query, variables) {
|
|
2295
2295
|
var _a;
|
|
@@ -2321,18 +2321,17 @@ function defaultDataIdFromObject(_a, context) {
|
|
|
2321
2321
|
var __typename = _a.__typename, id = _a.id, _id = _a._id;
|
|
2322
2322
|
if (typeof __typename === "string") {
|
|
2323
2323
|
if (context) {
|
|
2324
|
-
context.keyObject =
|
|
2325
|
-
? { id: id }
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
: void 0;
|
|
2324
|
+
context.keyObject =
|
|
2325
|
+
!isNullish(id) ? { id: id }
|
|
2326
|
+
: !isNullish(_id) ? { _id: _id }
|
|
2327
|
+
: void 0;
|
|
2329
2328
|
}
|
|
2330
2329
|
if (isNullish(id) && !isNullish(_id)) {
|
|
2331
2330
|
id = _id;
|
|
2332
2331
|
}
|
|
2333
2332
|
if (!isNullish(id)) {
|
|
2334
|
-
return "".concat(__typename, ":").concat(typeof id === "number" || typeof id === "string"
|
|
2335
|
-
|
|
2333
|
+
return "".concat(__typename, ":").concat(typeof id === "number" || typeof id === "string" ?
|
|
2334
|
+
id
|
|
2336
2335
|
: JSON.stringify(id));
|
|
2337
2336
|
}
|
|
2338
2337
|
}
|
|
@@ -2351,8 +2350,8 @@ function shouldCanonizeResults(config) {
|
|
|
2351
2350
|
return value === void 0 ? defaultConfig.canonizeResults : value;
|
|
2352
2351
|
}
|
|
2353
2352
|
function getTypenameFromStoreObject(store, objectOrReference) {
|
|
2354
|
-
return isReference(objectOrReference)
|
|
2355
|
-
|
|
2353
|
+
return isReference(objectOrReference) ?
|
|
2354
|
+
store.get(objectOrReference.__ref, "__typename")
|
|
2356
2355
|
: objectOrReference && objectOrReference.__typename;
|
|
2357
2356
|
}
|
|
2358
2357
|
var TypeOrFieldNameRegExp = /^[_a-z][_0-9a-z]*/i;
|
|
@@ -2362,8 +2361,8 @@ function fieldNameFromStoreName(storeFieldName) {
|
|
|
2362
2361
|
}
|
|
2363
2362
|
function selectionSetMatchesResult(selectionSet, result, variables) {
|
|
2364
2363
|
if (isNonNullObject(result)) {
|
|
2365
|
-
return isArray(result)
|
|
2366
|
-
|
|
2364
|
+
return isArray(result) ?
|
|
2365
|
+
result.every(function (item) {
|
|
2367
2366
|
return selectionSetMatchesResult(selectionSet, item, variables);
|
|
2368
2367
|
})
|
|
2369
2368
|
: selectionSet.selections.every(function (field) {
|
|
@@ -2401,7 +2400,7 @@ function extractFragmentContext(document, fragments) {
|
|
|
2401
2400
|
var DELETE = Object.create(null);
|
|
2402
2401
|
var delModifier = function () { return DELETE; };
|
|
2403
2402
|
var INVALIDATE = Object.create(null);
|
|
2404
|
-
var EntityStore =
|
|
2403
|
+
var EntityStore = (function () {
|
|
2405
2404
|
function EntityStore(policies, group) {
|
|
2406
2405
|
var _this = this;
|
|
2407
2406
|
this.policies = policies;
|
|
@@ -2410,13 +2409,13 @@ var EntityStore = (function () {
|
|
|
2410
2409
|
this.rootIds = Object.create(null);
|
|
2411
2410
|
this.refs = Object.create(null);
|
|
2412
2411
|
this.getFieldValue = function (objectOrReference, storeFieldName) {
|
|
2413
|
-
return maybeDeepFreeze(isReference(objectOrReference)
|
|
2414
|
-
|
|
2412
|
+
return maybeDeepFreeze(isReference(objectOrReference) ?
|
|
2413
|
+
_this.get(objectOrReference.__ref, storeFieldName)
|
|
2415
2414
|
: objectOrReference && objectOrReference[storeFieldName]);
|
|
2416
2415
|
};
|
|
2417
2416
|
this.canRead = function (objOrRef) {
|
|
2418
|
-
return isReference(objOrRef)
|
|
2419
|
-
|
|
2417
|
+
return isReference(objOrRef) ?
|
|
2418
|
+
_this.has(objOrRef.__ref)
|
|
2420
2419
|
: typeof objOrRef === "object";
|
|
2421
2420
|
};
|
|
2422
2421
|
this.toReference = function (objOrIdOrRef, mergeIntoStore) {
|
|
@@ -2530,8 +2529,8 @@ var EntityStore = (function () {
|
|
|
2530
2529
|
toReference: this.toReference,
|
|
2531
2530
|
canRead: this.canRead,
|
|
2532
2531
|
readField: function (fieldNameOrOptions, from) {
|
|
2533
|
-
return _this.policies.readField(typeof fieldNameOrOptions === "string"
|
|
2534
|
-
|
|
2532
|
+
return _this.policies.readField(typeof fieldNameOrOptions === "string" ?
|
|
2533
|
+
{
|
|
2535
2534
|
fieldName: fieldNameOrOptions,
|
|
2536
2535
|
from: from || makeReference(dataId),
|
|
2537
2536
|
}
|
|
@@ -2543,13 +2542,9 @@ var EntityStore = (function () {
|
|
|
2543
2542
|
var fieldValue = storeObject[storeFieldName];
|
|
2544
2543
|
if (fieldValue === void 0)
|
|
2545
2544
|
return;
|
|
2546
|
-
var modify = typeof fields === "function"
|
|
2547
|
-
? fields
|
|
2548
|
-
: fields[storeFieldName] || fields[fieldName];
|
|
2545
|
+
var modify = typeof fields === "function" ? fields : (fields[storeFieldName] || fields[fieldName]);
|
|
2549
2546
|
if (modify) {
|
|
2550
|
-
var newValue = modify === delModifier
|
|
2551
|
-
? DELETE
|
|
2552
|
-
: modify(maybeDeepFreeze(fieldValue), tslib.__assign(tslib.__assign({}, sharedDetails_1), { fieldName: fieldName, storeFieldName: storeFieldName, storage: _this.getStorage(dataId, storeFieldName) }));
|
|
2547
|
+
var newValue = modify === delModifier ? DELETE : (modify(maybeDeepFreeze(fieldValue), tslib.__assign(tslib.__assign({}, sharedDetails_1), { fieldName: fieldName, storeFieldName: storeFieldName, storage: _this.getStorage(dataId, storeFieldName) })));
|
|
2553
2548
|
if (newValue === INVALIDATE) {
|
|
2554
2549
|
_this.group.dirty(dataId, storeFieldName);
|
|
2555
2550
|
}
|
|
@@ -2623,13 +2618,12 @@ var EntityStore = (function () {
|
|
|
2623
2618
|
var storeObject = this.lookup(dataId);
|
|
2624
2619
|
if (storeObject) {
|
|
2625
2620
|
var typename = this.getFieldValue(storeObject, "__typename");
|
|
2626
|
-
var storeFieldName = fieldName && args
|
|
2627
|
-
|
|
2621
|
+
var storeFieldName = fieldName && args ?
|
|
2622
|
+
this.policies.getStoreFieldName({ typename: typename, fieldName: fieldName, args: args })
|
|
2628
2623
|
: fieldName;
|
|
2629
|
-
return this.modify(dataId, storeFieldName
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
_a) : delModifier);
|
|
2624
|
+
return this.modify(dataId, storeFieldName ? (_a = {},
|
|
2625
|
+
_a[storeFieldName] = delModifier,
|
|
2626
|
+
_a) : delModifier);
|
|
2633
2627
|
}
|
|
2634
2628
|
return false;
|
|
2635
2629
|
};
|
|
@@ -2752,7 +2746,7 @@ var EntityStore = (function () {
|
|
|
2752
2746
|
};
|
|
2753
2747
|
return EntityStore;
|
|
2754
2748
|
}());
|
|
2755
|
-
var CacheGroup =
|
|
2749
|
+
var CacheGroup = (function () {
|
|
2756
2750
|
function CacheGroup(caching, parent) {
|
|
2757
2751
|
if (parent === void 0) { parent = null; }
|
|
2758
2752
|
this.caching = caching;
|
|
@@ -2778,7 +2772,8 @@ var CacheGroup = (function () {
|
|
|
2778
2772
|
};
|
|
2779
2773
|
CacheGroup.prototype.dirty = function (dataId, storeFieldName) {
|
|
2780
2774
|
if (this.d) {
|
|
2781
|
-
this.d.dirty(makeDepKey(dataId, storeFieldName),
|
|
2775
|
+
this.d.dirty(makeDepKey(dataId, storeFieldName),
|
|
2776
|
+
storeFieldName === "__exists" ? "forget" : "setDirty");
|
|
2782
2777
|
}
|
|
2783
2778
|
};
|
|
2784
2779
|
return CacheGroup;
|
|
@@ -2792,7 +2787,7 @@ function maybeDependOnExistenceOfEntity(store, entityId) {
|
|
|
2792
2787
|
}
|
|
2793
2788
|
}
|
|
2794
2789
|
(function (EntityStore) {
|
|
2795
|
-
var Root =
|
|
2790
|
+
var Root = (function (_super) {
|
|
2796
2791
|
tslib.__extends(Root, _super);
|
|
2797
2792
|
function Root(_a) {
|
|
2798
2793
|
var policies = _a.policies, _b = _a.resultCaching, resultCaching = _b === void 0 ? true : _b, seed = _a.seed;
|
|
@@ -2816,7 +2811,7 @@ function maybeDependOnExistenceOfEntity(store, entityId) {
|
|
|
2816
2811
|
}(EntityStore));
|
|
2817
2812
|
EntityStore.Root = Root;
|
|
2818
2813
|
})(EntityStore || (EntityStore = {}));
|
|
2819
|
-
var Layer =
|
|
2814
|
+
var Layer = (function (_super) {
|
|
2820
2815
|
tslib.__extends(Layer, _super);
|
|
2821
2816
|
function Layer(id, parent, replay, group) {
|
|
2822
2817
|
var _this = _super.call(this, parent.policies, group) || this;
|
|
@@ -2867,18 +2862,18 @@ var Layer = (function (_super) {
|
|
|
2867
2862
|
};
|
|
2868
2863
|
Layer.prototype.findChildRefIds = function (dataId) {
|
|
2869
2864
|
var fromParent = this.parent.findChildRefIds(dataId);
|
|
2870
|
-
return hasOwn.call(this.data, dataId)
|
|
2871
|
-
? tslib.__assign(tslib.__assign({}, fromParent), _super.prototype.findChildRefIds.call(this, dataId)) : fromParent;
|
|
2865
|
+
return hasOwn.call(this.data, dataId) ? tslib.__assign(tslib.__assign({}, fromParent), _super.prototype.findChildRefIds.call(this, dataId)) : fromParent;
|
|
2872
2866
|
};
|
|
2873
2867
|
Layer.prototype.getStorage = function () {
|
|
2874
2868
|
var p = this.parent;
|
|
2875
2869
|
while (p.parent)
|
|
2876
2870
|
p = p.parent;
|
|
2877
|
-
return p.getStorage.apply(p,
|
|
2871
|
+
return p.getStorage.apply(p,
|
|
2872
|
+
arguments);
|
|
2878
2873
|
};
|
|
2879
2874
|
return Layer;
|
|
2880
2875
|
}(EntityStore));
|
|
2881
|
-
var Stump =
|
|
2876
|
+
var Stump = (function (_super) {
|
|
2882
2877
|
tslib.__extends(Stump, _super);
|
|
2883
2878
|
function Stump(root) {
|
|
2884
2879
|
return _super.call(this, "EntityStore.Stump", root, function () { }, new CacheGroup(root.group.caching, root.group)) || this;
|
|
@@ -2886,8 +2881,8 @@ var Stump = (function (_super) {
|
|
|
2886
2881
|
Stump.prototype.removeLayer = function () {
|
|
2887
2882
|
return this;
|
|
2888
2883
|
};
|
|
2889
|
-
Stump.prototype.merge = function () {
|
|
2890
|
-
return this.parent.merge
|
|
2884
|
+
Stump.prototype.merge = function (older, newer) {
|
|
2885
|
+
return this.parent.merge(older, newer);
|
|
2891
2886
|
};
|
|
2892
2887
|
return Stump;
|
|
2893
2888
|
}(Layer));
|
|
@@ -2902,13 +2897,13 @@ function supportsResultCaching(store) {
|
|
|
2902
2897
|
|
|
2903
2898
|
function shallowCopy(value) {
|
|
2904
2899
|
if (isNonNullObject(value)) {
|
|
2905
|
-
return isArray(value)
|
|
2906
|
-
|
|
2900
|
+
return isArray(value) ?
|
|
2901
|
+
value.slice(0)
|
|
2907
2902
|
: tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value);
|
|
2908
2903
|
}
|
|
2909
2904
|
return value;
|
|
2910
2905
|
}
|
|
2911
|
-
var ObjectCanon =
|
|
2906
|
+
var ObjectCanon = (function () {
|
|
2912
2907
|
function ObjectCanon() {
|
|
2913
2908
|
this.known = new (canUseWeakSet ? WeakSet : Set)();
|
|
2914
2909
|
this.pool = new trie.Trie(canUseWeakMap);
|
|
@@ -3022,7 +3017,7 @@ function execSelectionSetKeyArgs(options) {
|
|
|
3022
3017
|
options.context.canonizeResults,
|
|
3023
3018
|
];
|
|
3024
3019
|
}
|
|
3025
|
-
var StoreReader =
|
|
3020
|
+
var StoreReader = (function () {
|
|
3026
3021
|
function StoreReader(config) {
|
|
3027
3022
|
var _this = this;
|
|
3028
3023
|
this.knownResults = new (canUseWeakMap ? WeakMap : Map)();
|
|
@@ -3039,7 +3034,8 @@ var StoreReader = (function () {
|
|
|
3039
3034
|
var other = (_a = _this.executeSelectionSet).peek.apply(_a, peekArgs);
|
|
3040
3035
|
if (other) {
|
|
3041
3036
|
if (canonizeResults) {
|
|
3042
|
-
return tslib.__assign(tslib.__assign({}, other), {
|
|
3037
|
+
return tslib.__assign(tslib.__assign({}, other), {
|
|
3038
|
+
result: _this.canon.admit(other.result) });
|
|
3043
3039
|
}
|
|
3044
3040
|
return other;
|
|
3045
3041
|
}
|
|
@@ -3099,7 +3095,8 @@ var StoreReader = (function () {
|
|
|
3099
3095
|
StoreReader.prototype.isFresh = function (result, parent, selectionSet, context) {
|
|
3100
3096
|
if (supportsResultCaching(context.store) &&
|
|
3101
3097
|
this.knownResults.get(result) === selectionSet) {
|
|
3102
|
-
var latest = this.executeSelectionSet.peek(selectionSet, parent, context,
|
|
3098
|
+
var latest = this.executeSelectionSet.peek(selectionSet, parent, context,
|
|
3099
|
+
this.canon.isKnown(result));
|
|
3103
3100
|
if (latest && result === latest.result) {
|
|
3104
3101
|
return true;
|
|
3105
3102
|
}
|
|
@@ -3152,8 +3149,8 @@ var StoreReader = (function () {
|
|
|
3152
3149
|
if (fieldValue === void 0) {
|
|
3153
3150
|
if (!addTypenameToDocument.added(selection)) {
|
|
3154
3151
|
missing = missingMerger.merge(missing, (_a = {},
|
|
3155
|
-
_a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(isReference(objectOrReference)
|
|
3156
|
-
|
|
3152
|
+
_a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(isReference(objectOrReference) ?
|
|
3153
|
+
objectOrReference.__ref + " object"
|
|
3157
3154
|
: "object " + JSON.stringify(objectOrReference, null, 2)),
|
|
3158
3155
|
_a));
|
|
3159
3156
|
}
|
|
@@ -3195,10 +3192,9 @@ var StoreReader = (function () {
|
|
|
3195
3192
|
});
|
|
3196
3193
|
var result = mergeDeepArray(objectsToMerge);
|
|
3197
3194
|
var finalResult = { result: result, missing: missing };
|
|
3198
|
-
var frozen = context.canonizeResults
|
|
3199
|
-
|
|
3200
|
-
:
|
|
3201
|
-
maybeDeepFreeze(finalResult);
|
|
3195
|
+
var frozen = context.canonizeResults ?
|
|
3196
|
+
this.canon.admit(finalResult)
|
|
3197
|
+
: maybeDeepFreeze(finalResult);
|
|
3202
3198
|
if (frozen.result) {
|
|
3203
3199
|
this.knownResults.set(frozen.result, selectionSet);
|
|
3204
3200
|
}
|
|
@@ -3280,7 +3276,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
3280
3276
|
}
|
|
3281
3277
|
}
|
|
3282
3278
|
|
|
3283
|
-
var cacheSlot = new
|
|
3279
|
+
var cacheSlot = new optimism.Slot();
|
|
3284
3280
|
var cacheInfoMap = new WeakMap();
|
|
3285
3281
|
function getCacheInfo(cache) {
|
|
3286
3282
|
var info = cacheInfoMap.get(cache);
|
|
@@ -3356,7 +3352,8 @@ function keyFieldsFnFromSpecifier(specifier) {
|
|
|
3356
3352
|
return context.readField(key, from);
|
|
3357
3353
|
};
|
|
3358
3354
|
var keyObject = (context.keyObject = collectSpecifierPaths(specifier, function (schemaKeyPath) {
|
|
3359
|
-
var extracted = extractKeyPath(context.storeObject, schemaKeyPath,
|
|
3355
|
+
var extracted = extractKeyPath(context.storeObject, schemaKeyPath,
|
|
3356
|
+
extract);
|
|
3360
3357
|
if (extracted === void 0 &&
|
|
3361
3358
|
object !== context.storeObject &&
|
|
3362
3359
|
hasOwn.call(object, schemaKeyPath[0])) {
|
|
@@ -3382,7 +3379,8 @@ function keyArgsFnFromSpecifier(specifier) {
|
|
|
3382
3379
|
var d = field.directives.find(function (d) { return d.name.value === directiveName_1; });
|
|
3383
3380
|
var directiveArgs = d && argumentsObjectFromField(d, variables);
|
|
3384
3381
|
return (directiveArgs &&
|
|
3385
|
-
extractKeyPath(directiveArgs,
|
|
3382
|
+
extractKeyPath(directiveArgs,
|
|
3383
|
+
keyPath.slice(1)));
|
|
3386
3384
|
}
|
|
3387
3385
|
return;
|
|
3388
3386
|
}
|
|
@@ -3447,8 +3445,8 @@ function extractKey(object, key) {
|
|
|
3447
3445
|
function extractKeyPath(object, path, extract) {
|
|
3448
3446
|
extract = extract || extractKey;
|
|
3449
3447
|
return normalize(path.reduce(function reducer(obj, key) {
|
|
3450
|
-
return isArray(obj)
|
|
3451
|
-
|
|
3448
|
+
return isArray(obj) ?
|
|
3449
|
+
obj.map(function (child) { return reducer(child, key); })
|
|
3452
3450
|
: obj && extract(obj, key);
|
|
3453
3451
|
}, object));
|
|
3454
3452
|
}
|
|
@@ -3466,11 +3464,9 @@ function normalize(value) {
|
|
|
3466
3464
|
|
|
3467
3465
|
getStoreKeyName.setStringify(canonicalStringify);
|
|
3468
3466
|
function argsFromFieldSpecifier(spec) {
|
|
3469
|
-
return spec.args !== void 0
|
|
3470
|
-
? spec.
|
|
3471
|
-
|
|
3472
|
-
? argumentsObjectFromField(spec.field, spec.variables)
|
|
3473
|
-
: null;
|
|
3467
|
+
return (spec.args !== void 0 ? spec.args
|
|
3468
|
+
: spec.field ? argumentsObjectFromField(spec.field, spec.variables)
|
|
3469
|
+
: null);
|
|
3474
3470
|
}
|
|
3475
3471
|
var nullKeyFieldsFn = function () { return void 0; };
|
|
3476
3472
|
var simpleKeyArgsFn = function (_args, context) { return context.fieldName; };
|
|
@@ -3479,7 +3475,7 @@ var mergeTrueFn = function (existing, incoming, _a) {
|
|
|
3479
3475
|
return mergeObjects(existing, incoming);
|
|
3480
3476
|
};
|
|
3481
3477
|
var mergeFalseFn = function (_, incoming) { return incoming; };
|
|
3482
|
-
var Policies =
|
|
3478
|
+
var Policies = (function () {
|
|
3483
3479
|
function Policies(config) {
|
|
3484
3480
|
this.config = config;
|
|
3485
3481
|
this.typePolicies = Object.create(null);
|
|
@@ -3559,28 +3555,17 @@ var Policies = (function () {
|
|
|
3559
3555
|
var keyFields = incoming.keyFields, fields = incoming.fields;
|
|
3560
3556
|
function setMerge(existing, merge) {
|
|
3561
3557
|
existing.merge =
|
|
3562
|
-
typeof merge === "function"
|
|
3563
|
-
?
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
? mergeTrueFn
|
|
3567
|
-
:
|
|
3568
|
-
merge === false
|
|
3569
|
-
? mergeFalseFn
|
|
3570
|
-
: existing.merge;
|
|
3558
|
+
typeof merge === "function" ? merge
|
|
3559
|
+
: merge === true ? mergeTrueFn
|
|
3560
|
+
: merge === false ? mergeFalseFn
|
|
3561
|
+
: existing.merge;
|
|
3571
3562
|
}
|
|
3572
3563
|
setMerge(existing, incoming.merge);
|
|
3573
3564
|
existing.keyFn =
|
|
3574
|
-
keyFields === false
|
|
3575
|
-
?
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
? keyFieldsFnFromSpecifier(keyFields)
|
|
3579
|
-
:
|
|
3580
|
-
typeof keyFields === "function"
|
|
3581
|
-
? keyFields
|
|
3582
|
-
:
|
|
3583
|
-
existing.keyFn;
|
|
3565
|
+
keyFields === false ? nullKeyFieldsFn
|
|
3566
|
+
: isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields)
|
|
3567
|
+
: typeof keyFields === "function" ? keyFields
|
|
3568
|
+
: existing.keyFn;
|
|
3584
3569
|
if (fields) {
|
|
3585
3570
|
Object.keys(fields).forEach(function (fieldName) {
|
|
3586
3571
|
var existing = _this.getFieldPolicy(typename, fieldName, true);
|
|
@@ -3591,16 +3576,10 @@ var Policies = (function () {
|
|
|
3591
3576
|
else {
|
|
3592
3577
|
var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge;
|
|
3593
3578
|
existing.keyFn =
|
|
3594
|
-
keyArgs === false
|
|
3595
|
-
?
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
? keyArgsFnFromSpecifier(keyArgs)
|
|
3599
|
-
:
|
|
3600
|
-
typeof keyArgs === "function"
|
|
3601
|
-
? keyArgs
|
|
3602
|
-
:
|
|
3603
|
-
existing.keyFn;
|
|
3579
|
+
keyArgs === false ? simpleKeyArgsFn
|
|
3580
|
+
: isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs)
|
|
3581
|
+
: typeof keyArgs === "function" ? keyArgs
|
|
3582
|
+
: existing.keyFn;
|
|
3604
3583
|
if (typeof read === "function") {
|
|
3605
3584
|
existing.read = read;
|
|
3606
3585
|
}
|
|
@@ -3766,15 +3745,15 @@ var Policies = (function () {
|
|
|
3766
3745
|
}
|
|
3767
3746
|
}
|
|
3768
3747
|
if (storeFieldName === void 0) {
|
|
3769
|
-
storeFieldName =
|
|
3770
|
-
|
|
3771
|
-
|
|
3748
|
+
storeFieldName =
|
|
3749
|
+
fieldSpec.field ?
|
|
3750
|
+
storeKeyNameFromField(fieldSpec.field, fieldSpec.variables)
|
|
3751
|
+
: getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec));
|
|
3772
3752
|
}
|
|
3773
3753
|
if (storeFieldName === false) {
|
|
3774
3754
|
return fieldName;
|
|
3775
3755
|
}
|
|
3776
|
-
return fieldName === fieldNameFromStoreName(storeFieldName)
|
|
3777
|
-
? storeFieldName
|
|
3756
|
+
return fieldName === fieldNameFromStoreName(storeFieldName) ? storeFieldName
|
|
3778
3757
|
: fieldName + ":" + storeFieldName;
|
|
3779
3758
|
};
|
|
3780
3759
|
Policies.prototype.readField = function (options, context) {
|
|
@@ -3795,8 +3774,8 @@ var Policies = (function () {
|
|
|
3795
3774
|
var policy = this.getFieldPolicy(options.typename, fieldName, false);
|
|
3796
3775
|
var read = policy && policy.read;
|
|
3797
3776
|
if (read) {
|
|
3798
|
-
var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(isReference(objectOrReference)
|
|
3799
|
-
|
|
3777
|
+
var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(isReference(objectOrReference) ?
|
|
3778
|
+
objectOrReference.__ref
|
|
3800
3779
|
: objectOrReference, storeFieldName));
|
|
3801
3780
|
return cacheSlot.withValue(this.cache, read, [
|
|
3802
3781
|
existing,
|
|
@@ -3829,7 +3808,8 @@ var Policies = (function () {
|
|
|
3829
3808
|
if (context.overwrite) {
|
|
3830
3809
|
existing = void 0;
|
|
3831
3810
|
}
|
|
3832
|
-
return merge(existing, incoming, makeFieldFunctionOptions(this,
|
|
3811
|
+
return merge(existing, incoming, makeFieldFunctionOptions(this,
|
|
3812
|
+
void 0, {
|
|
3833
3813
|
typename: typename,
|
|
3834
3814
|
fieldName: field.name.value,
|
|
3835
3815
|
field: field,
|
|
@@ -3917,13 +3897,13 @@ function getContextFlavor(context, clientOnly, deferred) {
|
|
|
3917
3897
|
var flavored = context.flavors.get(key);
|
|
3918
3898
|
if (!flavored) {
|
|
3919
3899
|
context.flavors.set(key, (flavored =
|
|
3920
|
-
context.clientOnly === clientOnly && context.deferred === deferred
|
|
3921
|
-
|
|
3900
|
+
context.clientOnly === clientOnly && context.deferred === deferred ?
|
|
3901
|
+
context
|
|
3922
3902
|
: tslib.__assign(tslib.__assign({}, context), { clientOnly: clientOnly, deferred: deferred })));
|
|
3923
3903
|
}
|
|
3924
3904
|
return flavored;
|
|
3925
3905
|
}
|
|
3926
|
-
var StoreWriter =
|
|
3906
|
+
var StoreWriter = (function () {
|
|
3927
3907
|
function StoreWriter(cache, reader, fragments) {
|
|
3928
3908
|
this.cache = cache;
|
|
3929
3909
|
this.reader = reader;
|
|
@@ -3987,7 +3967,8 @@ var StoreWriter = (function () {
|
|
|
3987
3967
|
};
|
|
3988
3968
|
StoreWriter.prototype.processSelectionSet = function (_a) {
|
|
3989
3969
|
var _this = this;
|
|
3990
|
-
var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context,
|
|
3970
|
+
var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context,
|
|
3971
|
+
mergeTree = _a.mergeTree;
|
|
3991
3972
|
var policies = this.cache.policies;
|
|
3992
3973
|
var incoming = Object.create(null);
|
|
3993
3974
|
var typename = (dataId && policies.rootTypenamesById[dataId]) ||
|
|
@@ -4010,7 +3991,8 @@ var StoreWriter = (function () {
|
|
|
4010
3991
|
return policies.readField(options, context);
|
|
4011
3992
|
};
|
|
4012
3993
|
var fieldNodeSet = new Set();
|
|
4013
|
-
this.flattenFields(selectionSet, result,
|
|
3994
|
+
this.flattenFields(selectionSet, result,
|
|
3995
|
+
context, typename).forEach(function (context, field) {
|
|
4014
3996
|
var _a;
|
|
4015
3997
|
var resultFieldKey = resultKeyNameFromField(field);
|
|
4016
3998
|
var value = result[resultFieldKey];
|
|
@@ -4023,8 +4005,9 @@ var StoreWriter = (function () {
|
|
|
4023
4005
|
variables: context.variables,
|
|
4024
4006
|
});
|
|
4025
4007
|
var childTree = getChildMergeTree(mergeTree, storeFieldName);
|
|
4026
|
-
var incomingValue = _this.processFieldValue(value, field,
|
|
4027
|
-
|
|
4008
|
+
var incomingValue = _this.processFieldValue(value, field,
|
|
4009
|
+
field.selectionSet ?
|
|
4010
|
+
getContextFlavor(context, false, false)
|
|
4028
4011
|
: context, childTree);
|
|
4029
4012
|
var childTypename = void 0;
|
|
4030
4013
|
if (field.selectionSet &&
|
|
@@ -4123,7 +4106,8 @@ var StoreWriter = (function () {
|
|
|
4123
4106
|
var policies = this.cache.policies;
|
|
4124
4107
|
var limitingTrie = new trie.Trie(false);
|
|
4125
4108
|
(function flatten(selectionSet, inheritedContext) {
|
|
4126
|
-
var visitedNode = limitingTrie.lookup(selectionSet,
|
|
4109
|
+
var visitedNode = limitingTrie.lookup(selectionSet,
|
|
4110
|
+
inheritedContext.clientOnly, inheritedContext.deferred);
|
|
4127
4111
|
if (visitedNode.visited)
|
|
4128
4112
|
return;
|
|
4129
4113
|
visitedNode.visited = true;
|
|
@@ -4131,7 +4115,8 @@ var StoreWriter = (function () {
|
|
|
4131
4115
|
if (!shouldInclude(selection, context.variables))
|
|
4132
4116
|
return;
|
|
4133
4117
|
var clientOnly = inheritedContext.clientOnly, deferred = inheritedContext.deferred;
|
|
4134
|
-
if (
|
|
4118
|
+
if (
|
|
4119
|
+
!(clientOnly && deferred) &&
|
|
4135
4120
|
isNonEmptyArray(selection.directives)) {
|
|
4136
4121
|
selection.directives.forEach(function (dir) {
|
|
4137
4122
|
var name = dir.name.value;
|
|
@@ -4171,9 +4156,10 @@ var StoreWriter = (function () {
|
|
|
4171
4156
|
var _a;
|
|
4172
4157
|
var _this = this;
|
|
4173
4158
|
if (mergeTree.map.size && !isReference(incoming)) {
|
|
4174
|
-
var e_1 =
|
|
4175
|
-
|
|
4176
|
-
|
|
4159
|
+
var e_1 =
|
|
4160
|
+
(!isArray(incoming) &&
|
|
4161
|
+
(isReference(existing) || storeValueIsStoreObject(existing))) ?
|
|
4162
|
+
existing
|
|
4177
4163
|
: void 0;
|
|
4178
4164
|
var i_1 = incoming;
|
|
4179
4165
|
if (e_1 && !getStorageArgs) {
|
|
@@ -4181,11 +4167,11 @@ var StoreWriter = (function () {
|
|
|
4181
4167
|
}
|
|
4182
4168
|
var changedFields_1;
|
|
4183
4169
|
var getValue_1 = function (from, name) {
|
|
4184
|
-
return isArray(from)
|
|
4185
|
-
|
|
4186
|
-
|
|
4170
|
+
return (isArray(from) ?
|
|
4171
|
+
typeof name === "number" ?
|
|
4172
|
+
from[name]
|
|
4187
4173
|
: void 0
|
|
4188
|
-
: context.store.getFieldValue(from, String(name));
|
|
4174
|
+
: context.store.getFieldValue(from, String(name)));
|
|
4189
4175
|
};
|
|
4190
4176
|
mergeTree.map.forEach(function (childTree, storeFieldName) {
|
|
4191
4177
|
var eVal = getValue_1(e_1, storeFieldName);
|
|
@@ -4231,13 +4217,10 @@ function mergeMergeTrees(left, right) {
|
|
|
4231
4217
|
return left;
|
|
4232
4218
|
if (!left || mergeTreeIsEmpty(left))
|
|
4233
4219
|
return right;
|
|
4234
|
-
var info = left.info && right.info
|
|
4235
|
-
? tslib.__assign(tslib.__assign({}, left.info), right.info) : left.info || right.info;
|
|
4220
|
+
var info = left.info && right.info ? tslib.__assign(tslib.__assign({}, left.info), right.info) : left.info || right.info;
|
|
4236
4221
|
var needToMergeMaps = left.map.size && right.map.size;
|
|
4237
|
-
var map = needToMergeMaps
|
|
4238
|
-
?
|
|
4239
|
-
: left.map.size
|
|
4240
|
-
? left.map
|
|
4222
|
+
var map = needToMergeMaps ? new Map()
|
|
4223
|
+
: left.map.size ? left.map
|
|
4241
4224
|
: right.map;
|
|
4242
4225
|
var merged = { info: info, map: map };
|
|
4243
4226
|
if (needToMergeMaps) {
|
|
@@ -4298,14 +4281,14 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
4298
4281
|
}
|
|
4299
4282
|
});
|
|
4300
4283
|
}
|
|
4301
|
-
globalThis.__DEV__ !== false && invariant.warn(14, fieldName, parentType, childTypenames.length
|
|
4302
|
-
|
|
4284
|
+
globalThis.__DEV__ !== false && invariant.warn(14, fieldName, parentType, childTypenames.length ?
|
|
4285
|
+
"either ensure all objects of type " +
|
|
4303
4286
|
childTypenames.join(" and ") +
|
|
4304
4287
|
" have an ID or a custom merge function, or "
|
|
4305
4288
|
: "", typeDotName, existing, incoming);
|
|
4306
4289
|
}
|
|
4307
4290
|
|
|
4308
|
-
var InMemoryCache =
|
|
4291
|
+
var InMemoryCache = (function (_super) {
|
|
4309
4292
|
tslib.__extends(InMemoryCache, _super);
|
|
4310
4293
|
function InMemoryCache(config) {
|
|
4311
4294
|
if (config === void 0) { config = {}; }
|
|
@@ -4343,9 +4326,7 @@ var InMemoryCache = (function (_super) {
|
|
|
4343
4326
|
addTypename: this.addTypename,
|
|
4344
4327
|
resultCacheMaxSize: this.config.resultCacheMaxSize,
|
|
4345
4328
|
canonizeResults: shouldCanonizeResults(this.config),
|
|
4346
|
-
canon: resetResultIdentities
|
|
4347
|
-
? void 0
|
|
4348
|
-
: previousReader && previousReader.canon,
|
|
4329
|
+
canon: resetResultIdentities ? void 0 : (previousReader && previousReader.canon),
|
|
4349
4330
|
fragments: fragments,
|
|
4350
4331
|
})), fragments);
|
|
4351
4332
|
this.maybeBroadcastWatch = optimism.wrap(function (c, options) {
|
|
@@ -4356,7 +4337,8 @@ var InMemoryCache = (function (_super) {
|
|
|
4356
4337
|
var store = c.optimistic ? _this.optimisticData : _this.data;
|
|
4357
4338
|
if (supportsResultCaching(store)) {
|
|
4358
4339
|
var optimistic = c.optimistic, id = c.id, variables = c.variables;
|
|
4359
|
-
return store.makeCacheKey(c.query,
|
|
4340
|
+
return store.makeCacheKey(c.query,
|
|
4341
|
+
c.callback, canonicalStringify({ optimistic: optimistic, id: id, variables: variables }));
|
|
4360
4342
|
}
|
|
4361
4343
|
},
|
|
4362
4344
|
});
|
|
@@ -4375,7 +4357,9 @@ var InMemoryCache = (function (_super) {
|
|
|
4375
4357
|
return (optimistic ? this.optimisticData : this.data).extract();
|
|
4376
4358
|
};
|
|
4377
4359
|
InMemoryCache.prototype.read = function (options) {
|
|
4378
|
-
var
|
|
4360
|
+
var
|
|
4361
|
+
_a = options.returnPartialData,
|
|
4362
|
+
returnPartialData = _a === void 0 ? false : _a;
|
|
4379
4363
|
try {
|
|
4380
4364
|
return (this.storeReader.diffQueryAgainstStore(tslib.__assign(tslib.__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, config: this.config, returnPartialData: returnPartialData })).result || null);
|
|
4381
4365
|
}
|
|
@@ -4401,8 +4385,9 @@ var InMemoryCache = (function (_super) {
|
|
|
4401
4385
|
if (hasOwn.call(options, "id") && !options.id) {
|
|
4402
4386
|
return false;
|
|
4403
4387
|
}
|
|
4404
|
-
var store = options.optimistic
|
|
4405
|
-
|
|
4388
|
+
var store = ((options.optimistic)
|
|
4389
|
+
) ?
|
|
4390
|
+
this.optimisticData
|
|
4406
4391
|
: this.data;
|
|
4407
4392
|
try {
|
|
4408
4393
|
++this.txCount;
|
|
@@ -4669,7 +4654,8 @@ function equalBySelectionSet(selectionSet, aResult, bResult, context) {
|
|
|
4669
4654
|
if (fragment) {
|
|
4670
4655
|
if (selectionHasNonreactiveDirective(fragment))
|
|
4671
4656
|
return true;
|
|
4672
|
-
return equalBySelectionSet(fragment.selectionSet,
|
|
4657
|
+
return equalBySelectionSet(fragment.selectionSet,
|
|
4658
|
+
aResult, bResult, context);
|
|
4673
4659
|
}
|
|
4674
4660
|
}
|
|
4675
4661
|
});
|
|
@@ -4682,7 +4668,7 @@ function directiveIsNonreactive(dir) {
|
|
|
4682
4668
|
}
|
|
4683
4669
|
|
|
4684
4670
|
var assign = Object.assign, hasOwnProperty$2 = Object.hasOwnProperty;
|
|
4685
|
-
var ObservableQuery =
|
|
4671
|
+
var ObservableQuery = (function (_super) {
|
|
4686
4672
|
tslib.__extends(ObservableQuery, _super);
|
|
4687
4673
|
function ObservableQuery(_a) {
|
|
4688
4674
|
var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options;
|
|
@@ -4719,10 +4705,12 @@ var ObservableQuery = (function (_super) {
|
|
|
4719
4705
|
_this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy);
|
|
4720
4706
|
_this.isTornDown = false;
|
|
4721
4707
|
var _b = queryManager.defaultOptions.watchQuery, _c = _b === void 0 ? {} : _b, _d = _c.fetchPolicy, defaultFetchPolicy = _d === void 0 ? "cache-first" : _d;
|
|
4722
|
-
var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e,
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
_this.options = tslib.__assign(tslib.__assign({}, options), {
|
|
4708
|
+
var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e,
|
|
4709
|
+
_f = options.initialFetchPolicy,
|
|
4710
|
+
initialFetchPolicy = _f === void 0 ? fetchPolicy === "standby" ? defaultFetchPolicy : (fetchPolicy) : _f;
|
|
4711
|
+
_this.options = tslib.__assign(tslib.__assign({}, options), {
|
|
4712
|
+
initialFetchPolicy: initialFetchPolicy,
|
|
4713
|
+
fetchPolicy: fetchPolicy });
|
|
4726
4714
|
_this.queryId = queryInfo.queryId || queryManager.generateQueryId();
|
|
4727
4715
|
var opDef = getOperationDefinition(_this.query);
|
|
4728
4716
|
_this.queryName = opDef && opDef.name && opDef.name.value;
|
|
@@ -4769,7 +4757,8 @@ var ObservableQuery = (function (_super) {
|
|
|
4769
4757
|
exports.NetworkStatus.ready;
|
|
4770
4758
|
var result = tslib.__assign(tslib.__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus });
|
|
4771
4759
|
var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a;
|
|
4772
|
-
if (
|
|
4760
|
+
if (
|
|
4761
|
+
skipCacheDataFor(fetchPolicy) ||
|
|
4773
4762
|
this.queryManager.getDocumentInfo(this.query).hasForcedResolvers) ;
|
|
4774
4763
|
else if (this.waitForOwnResult) {
|
|
4775
4764
|
this.queryInfo["updateWatch"]();
|
|
@@ -4812,9 +4801,8 @@ var ObservableQuery = (function (_super) {
|
|
|
4812
4801
|
if (!this.last) {
|
|
4813
4802
|
return true;
|
|
4814
4803
|
}
|
|
4815
|
-
var resultIsDifferent = this.queryManager.getDocumentInfo(this.query)
|
|
4816
|
-
.
|
|
4817
|
-
? !equalByQuery(this.query, this.last.result, newResult, this.variables)
|
|
4804
|
+
var resultIsDifferent = this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective ?
|
|
4805
|
+
!equalByQuery(this.query, this.last.result, newResult, this.variables)
|
|
4818
4806
|
: !equal.equal(this.last.result, newResult);
|
|
4819
4807
|
return (resultIsDifferent || (variables && !equal.equal(this.last.variables, variables)));
|
|
4820
4808
|
};
|
|
@@ -4873,14 +4861,14 @@ var ObservableQuery = (function (_super) {
|
|
|
4873
4861
|
};
|
|
4874
4862
|
ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) {
|
|
4875
4863
|
var _this = this;
|
|
4876
|
-
var combinedOptions = tslib.__assign(tslib.__assign({}, (fetchMoreOptions.query
|
|
4877
|
-
|
|
4878
|
-
: 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" });
|
|
4864
|
+
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) })))), {
|
|
4865
|
+
fetchPolicy: "no-cache" });
|
|
4879
4866
|
combinedOptions.query = this.transformDocument(combinedOptions.query);
|
|
4880
4867
|
var qid = this.queryManager.generateQueryId();
|
|
4881
|
-
this.lastQuery =
|
|
4882
|
-
|
|
4883
|
-
|
|
4868
|
+
this.lastQuery =
|
|
4869
|
+
fetchMoreOptions.query ?
|
|
4870
|
+
this.transformDocument(this.options.query)
|
|
4871
|
+
: combinedOptions.query;
|
|
4884
4872
|
var queryInfo = this.queryInfo;
|
|
4885
4873
|
var originalNetworkStatus = queryInfo.networkStatus;
|
|
4886
4874
|
queryInfo.networkStatus = exports.NetworkStatus.fetchMore;
|
|
@@ -5015,7 +5003,8 @@ var ObservableQuery = (function (_super) {
|
|
|
5015
5003
|
this.options.pollInterval = 0;
|
|
5016
5004
|
this.updatePolling();
|
|
5017
5005
|
};
|
|
5018
|
-
ObservableQuery.prototype.applyNextFetchPolicy = function (reason,
|
|
5006
|
+
ObservableQuery.prototype.applyNextFetchPolicy = function (reason,
|
|
5007
|
+
options) {
|
|
5019
5008
|
if (options.nextFetchPolicy) {
|
|
5020
5009
|
var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a, _b = options.initialFetchPolicy, initialFetchPolicy = _b === void 0 ? fetchPolicy : _b;
|
|
5021
5010
|
if (fetchPolicy === "standby") ;
|
|
@@ -5063,8 +5052,8 @@ var ObservableQuery = (function (_super) {
|
|
|
5063
5052
|
if (_this.pollingInfo) {
|
|
5064
5053
|
if (!isNetworkRequestInFlight(_this.queryInfo.networkStatus)) {
|
|
5065
5054
|
_this.reobserve({
|
|
5066
|
-
fetchPolicy: _this.options.initialFetchPolicy === "no-cache"
|
|
5067
|
-
|
|
5055
|
+
fetchPolicy: _this.options.initialFetchPolicy === "no-cache" ?
|
|
5056
|
+
"no-cache"
|
|
5068
5057
|
: "network-only",
|
|
5069
5058
|
}, exports.NetworkStatus.poll).then(poll, poll);
|
|
5070
5059
|
}
|
|
@@ -5088,22 +5077,22 @@ var ObservableQuery = (function (_super) {
|
|
|
5088
5077
|
if (error && this.last && !equal.equal(variables, this.last.variables)) {
|
|
5089
5078
|
error = void 0;
|
|
5090
5079
|
}
|
|
5091
|
-
return (this.last = tslib.__assign({ result: this.queryManager.assumeImmutableResults
|
|
5092
|
-
|
|
5080
|
+
return (this.last = tslib.__assign({ result: this.queryManager.assumeImmutableResults ?
|
|
5081
|
+
newResult
|
|
5093
5082
|
: cloneDeep(newResult), variables: variables }, (error ? { error: error } : null)));
|
|
5094
5083
|
};
|
|
5095
5084
|
ObservableQuery.prototype.reobserveAsConcast = function (newOptions, newNetworkStatus) {
|
|
5096
5085
|
var _this = this;
|
|
5097
5086
|
this.isTornDown = false;
|
|
5098
|
-
var useDisposableConcast =
|
|
5087
|
+
var useDisposableConcast =
|
|
5088
|
+
newNetworkStatus === exports.NetworkStatus.refetch ||
|
|
5099
5089
|
newNetworkStatus === exports.NetworkStatus.fetchMore ||
|
|
5100
5090
|
newNetworkStatus === exports.NetworkStatus.poll;
|
|
5101
5091
|
var oldVariables = this.options.variables;
|
|
5102
5092
|
var oldFetchPolicy = this.options.fetchPolicy;
|
|
5103
5093
|
var mergedOptions = compact(this.options, newOptions || {});
|
|
5104
|
-
var options = useDisposableConcast
|
|
5105
|
-
|
|
5106
|
-
mergedOptions
|
|
5094
|
+
var options = useDisposableConcast ?
|
|
5095
|
+
mergedOptions
|
|
5107
5096
|
: assign(this.options, mergedOptions);
|
|
5108
5097
|
var query = this.transformDocument(options.query);
|
|
5109
5098
|
this.lastQuery = query;
|
|
@@ -5149,7 +5138,8 @@ var ObservableQuery = (function (_super) {
|
|
|
5149
5138
|
return concast;
|
|
5150
5139
|
};
|
|
5151
5140
|
ObservableQuery.prototype.reobserve = function (newOptions, newNetworkStatus) {
|
|
5152
|
-
return this.reobserveAsConcast(newOptions, newNetworkStatus)
|
|
5141
|
+
return this.reobserveAsConcast(newOptions, newNetworkStatus)
|
|
5142
|
+
.promise;
|
|
5153
5143
|
};
|
|
5154
5144
|
ObservableQuery.prototype.resubscribeAfterError = function () {
|
|
5155
5145
|
var args = [];
|
|
@@ -5163,7 +5153,8 @@ var ObservableQuery = (function (_super) {
|
|
|
5163
5153
|
return subscription;
|
|
5164
5154
|
};
|
|
5165
5155
|
ObservableQuery.prototype.observe = function () {
|
|
5166
|
-
this.reportResult(
|
|
5156
|
+
this.reportResult(
|
|
5157
|
+
this.getCurrentResult(false), this.variables);
|
|
5167
5158
|
};
|
|
5168
5159
|
ObservableQuery.prototype.reportResult = function (result, variables) {
|
|
5169
5160
|
var lastError = this.getLastError();
|
|
@@ -5209,10 +5200,10 @@ function reobserveCacheFirst(obsQuery) {
|
|
|
5209
5200
|
if (fetchPolicy === "cache-and-network" || fetchPolicy === "network-only") {
|
|
5210
5201
|
return obsQuery.reobserve({
|
|
5211
5202
|
fetchPolicy: "cache-first",
|
|
5212
|
-
nextFetchPolicy: function () {
|
|
5203
|
+
nextFetchPolicy: function (currentFetchPolicy, context) {
|
|
5213
5204
|
this.nextFetchPolicy = nextFetchPolicy;
|
|
5214
|
-
if (typeof nextFetchPolicy === "function") {
|
|
5215
|
-
return nextFetchPolicy
|
|
5205
|
+
if (typeof this.nextFetchPolicy === "function") {
|
|
5206
|
+
return this.nextFetchPolicy(currentFetchPolicy, context);
|
|
5216
5207
|
}
|
|
5217
5208
|
return fetchPolicy;
|
|
5218
5209
|
},
|
|
@@ -5228,13 +5219,13 @@ function logMissingFieldErrors(missing) {
|
|
|
5228
5219
|
globalThis.__DEV__ !== false && invariant.debug(24, missing);
|
|
5229
5220
|
}
|
|
5230
5221
|
}
|
|
5231
|
-
function skipCacheDataFor(fetchPolicy) {
|
|
5222
|
+
function skipCacheDataFor(fetchPolicy ) {
|
|
5232
5223
|
return (fetchPolicy === "network-only" ||
|
|
5233
5224
|
fetchPolicy === "no-cache" ||
|
|
5234
5225
|
fetchPolicy === "standby");
|
|
5235
5226
|
}
|
|
5236
5227
|
|
|
5237
|
-
var LocalState =
|
|
5228
|
+
var LocalState = (function () {
|
|
5238
5229
|
function LocalState(_a) {
|
|
5239
5230
|
var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher;
|
|
5240
5231
|
this.selectionsToResolveCache = new WeakMap();
|
|
@@ -5273,9 +5264,9 @@ var LocalState = (function () {
|
|
|
5273
5264
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
5274
5265
|
return tslib.__generator(this, function (_c) {
|
|
5275
5266
|
if (document) {
|
|
5276
|
-
return [2, this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return (tslib.__assign(tslib.__assign({}, remoteResult), { data: localResult.result })); })];
|
|
5267
|
+
return [2 , this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return (tslib.__assign(tslib.__assign({}, remoteResult), { data: localResult.result })); })];
|
|
5277
5268
|
}
|
|
5278
|
-
return [2, remoteResult];
|
|
5269
|
+
return [2 , remoteResult];
|
|
5279
5270
|
});
|
|
5280
5271
|
});
|
|
5281
5272
|
};
|
|
@@ -5298,7 +5289,8 @@ var LocalState = (function () {
|
|
|
5298
5289
|
};
|
|
5299
5290
|
LocalState.prototype.prepareContext = function (context) {
|
|
5300
5291
|
var cache = this.cache;
|
|
5301
|
-
return tslib.__assign(tslib.__assign({}, context), { cache: cache,
|
|
5292
|
+
return tslib.__assign(tslib.__assign({}, context), { cache: cache,
|
|
5293
|
+
getCacheKey: function (obj) {
|
|
5302
5294
|
return cache.identify(obj);
|
|
5303
5295
|
} });
|
|
5304
5296
|
};
|
|
@@ -5308,9 +5300,9 @@ var LocalState = (function () {
|
|
|
5308
5300
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
5309
5301
|
return tslib.__generator(this, function (_a) {
|
|
5310
5302
|
if (document) {
|
|
5311
|
-
return [2, this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return (tslib.__assign(tslib.__assign({}, variables), data.exportedVariables)); })];
|
|
5303
|
+
return [2 , this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return (tslib.__assign(tslib.__assign({}, variables), data.exportedVariables)); })];
|
|
5312
5304
|
}
|
|
5313
|
-
return [2, tslib.__assign({}, variables)];
|
|
5305
|
+
return [2 , tslib.__assign({}, variables)];
|
|
5314
5306
|
});
|
|
5315
5307
|
});
|
|
5316
5308
|
};
|
|
@@ -5355,8 +5347,8 @@ var LocalState = (function () {
|
|
|
5355
5347
|
fragmentMap = createFragmentMap(fragments);
|
|
5356
5348
|
selectionsToResolve = this.collectSelectionsToResolve(mainDefinition, fragmentMap);
|
|
5357
5349
|
definitionOperation = mainDefinition.operation;
|
|
5358
|
-
defaultOperationType = definitionOperation
|
|
5359
|
-
|
|
5350
|
+
defaultOperationType = definitionOperation ?
|
|
5351
|
+
definitionOperation.charAt(0).toUpperCase() +
|
|
5360
5352
|
definitionOperation.slice(1)
|
|
5361
5353
|
: "Query";
|
|
5362
5354
|
_a = this, cache = _a.cache, client = _a.client;
|
|
@@ -5371,7 +5363,7 @@ var LocalState = (function () {
|
|
|
5371
5363
|
onlyRunForcedResolvers: onlyRunForcedResolvers,
|
|
5372
5364
|
};
|
|
5373
5365
|
isClientFieldDescendant = false;
|
|
5374
|
-
return [2, this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({
|
|
5366
|
+
return [2 , this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({
|
|
5375
5367
|
result: result,
|
|
5376
5368
|
exportedVariables: execContext.exportedVariables,
|
|
5377
5369
|
}); })];
|
|
@@ -5390,13 +5382,13 @@ var LocalState = (function () {
|
|
|
5390
5382
|
return tslib.__generator(this, function (_a) {
|
|
5391
5383
|
if (!isClientFieldDescendant &&
|
|
5392
5384
|
!execContext.selectionsToResolve.has(selection)) {
|
|
5393
|
-
return [2];
|
|
5385
|
+
return [2 ];
|
|
5394
5386
|
}
|
|
5395
5387
|
if (!shouldInclude(selection, variables)) {
|
|
5396
|
-
return [2];
|
|
5388
|
+
return [2 ];
|
|
5397
5389
|
}
|
|
5398
5390
|
if (isField(selection)) {
|
|
5399
|
-
return [2, this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) {
|
|
5391
|
+
return [2 , this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) {
|
|
5400
5392
|
var _a;
|
|
5401
5393
|
if (typeof fieldResult !== "undefined") {
|
|
5402
5394
|
resultsToMerge.push((_a = {},
|
|
@@ -5415,15 +5407,15 @@ var LocalState = (function () {
|
|
|
5415
5407
|
if (fragment && fragment.typeCondition) {
|
|
5416
5408
|
typeCondition = fragment.typeCondition.name.value;
|
|
5417
5409
|
if (execContext.fragmentMatcher(rootValue, typeCondition, context)) {
|
|
5418
|
-
return [2, this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) {
|
|
5410
|
+
return [2 , this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) {
|
|
5419
5411
|
resultsToMerge.push(fragmentResult);
|
|
5420
5412
|
})];
|
|
5421
5413
|
}
|
|
5422
5414
|
}
|
|
5423
|
-
return [2];
|
|
5415
|
+
return [2 ];
|
|
5424
5416
|
});
|
|
5425
5417
|
}); };
|
|
5426
|
-
return [2, Promise.all(selectionSet.selections.map(execute)).then(function () {
|
|
5418
|
+
return [2 , Promise.all(selectionSet.selections.map(execute)).then(function () {
|
|
5427
5419
|
return mergeDeepArray(resultsToMerge);
|
|
5428
5420
|
})];
|
|
5429
5421
|
});
|
|
@@ -5435,7 +5427,7 @@ var LocalState = (function () {
|
|
|
5435
5427
|
var _this = this;
|
|
5436
5428
|
return tslib.__generator(this, function (_a) {
|
|
5437
5429
|
if (!rootValue) {
|
|
5438
|
-
return [2, null];
|
|
5430
|
+
return [2 , null];
|
|
5439
5431
|
}
|
|
5440
5432
|
variables = execContext.variables;
|
|
5441
5433
|
fieldName = field.name.value;
|
|
@@ -5450,7 +5442,8 @@ var LocalState = (function () {
|
|
|
5450
5442
|
if (resolverMap) {
|
|
5451
5443
|
resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName];
|
|
5452
5444
|
if (resolve) {
|
|
5453
|
-
resultPromise = Promise.resolve(
|
|
5445
|
+
resultPromise = Promise.resolve(
|
|
5446
|
+
cacheSlot.withValue(this.cache, resolve, [
|
|
5454
5447
|
rootValue,
|
|
5455
5448
|
argumentsObjectFromField(field, variables),
|
|
5456
5449
|
execContext.context,
|
|
@@ -5459,7 +5452,7 @@ var LocalState = (function () {
|
|
|
5459
5452
|
}
|
|
5460
5453
|
}
|
|
5461
5454
|
}
|
|
5462
|
-
return [2, resultPromise.then(function (result) {
|
|
5455
|
+
return [2 , resultPromise.then(function (result) {
|
|
5463
5456
|
var _a, _b;
|
|
5464
5457
|
if (result === void 0) { result = defaultResult; }
|
|
5465
5458
|
if (field.directives) {
|
|
@@ -5551,7 +5544,8 @@ function wrapDestructiveCacheMethod(cache, methodName) {
|
|
|
5551
5544
|
var original = cache[methodName];
|
|
5552
5545
|
if (typeof original === "function") {
|
|
5553
5546
|
cache[methodName] = function () {
|
|
5554
|
-
destructiveMethodCounts.set(cache,
|
|
5547
|
+
destructiveMethodCounts.set(cache,
|
|
5548
|
+
(destructiveMethodCounts.get(cache) + 1) % 1e15);
|
|
5555
5549
|
return original.apply(this, arguments);
|
|
5556
5550
|
};
|
|
5557
5551
|
}
|
|
@@ -5562,7 +5556,7 @@ function cancelNotifyTimeout(info) {
|
|
|
5562
5556
|
info["notifyTimeout"] = void 0;
|
|
5563
5557
|
}
|
|
5564
5558
|
}
|
|
5565
|
-
var QueryInfo =
|
|
5559
|
+
var QueryInfo = (function () {
|
|
5566
5560
|
function QueryInfo(queryManager, queryId) {
|
|
5567
5561
|
if (queryId === void 0) { queryId = queryManager.generateQueryId(); }
|
|
5568
5562
|
this.queryId = queryId;
|
|
@@ -5624,12 +5618,13 @@ var QueryInfo = (function () {
|
|
|
5624
5618
|
return diff;
|
|
5625
5619
|
};
|
|
5626
5620
|
QueryInfo.prototype.updateLastDiff = function (diff, options) {
|
|
5627
|
-
this.lastDiff =
|
|
5628
|
-
?
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5621
|
+
this.lastDiff =
|
|
5622
|
+
diff ?
|
|
5623
|
+
{
|
|
5624
|
+
diff: diff,
|
|
5625
|
+
options: options || this.getDiffOptions(),
|
|
5626
|
+
}
|
|
5627
|
+
: void 0;
|
|
5633
5628
|
};
|
|
5634
5629
|
QueryInfo.prototype.getDiffOptions = function (variables) {
|
|
5635
5630
|
var _a;
|
|
@@ -5735,9 +5730,7 @@ var QueryInfo = (function () {
|
|
|
5735
5730
|
QueryInfo.prototype.markResult = function (result, document, options, cacheWriteBehavior) {
|
|
5736
5731
|
var _this = this;
|
|
5737
5732
|
var merger = new DeepMerger();
|
|
5738
|
-
var graphQLErrors = isNonEmptyArray(result.errors)
|
|
5739
|
-
? result.errors.slice(0)
|
|
5740
|
-
: [];
|
|
5733
|
+
var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];
|
|
5741
5734
|
this.reset();
|
|
5742
5735
|
if ("incremental" in result && isNonEmptyArray(result.incremental)) {
|
|
5743
5736
|
var mergedData = mergeIncrementalData(this.getDiff().result, result);
|
|
@@ -5751,7 +5744,7 @@ var QueryInfo = (function () {
|
|
|
5751
5744
|
if (options.fetchPolicy === "no-cache") {
|
|
5752
5745
|
this.updateLastDiff({ result: result.data, complete: true }, this.getDiffOptions(options.variables));
|
|
5753
5746
|
}
|
|
5754
|
-
else if (cacheWriteBehavior !== 0) {
|
|
5747
|
+
else if (cacheWriteBehavior !== 0 ) {
|
|
5755
5748
|
if (shouldWriteResult(result, options.errorPolicy)) {
|
|
5756
5749
|
this.cache.performTransaction(function (cache) {
|
|
5757
5750
|
if (_this.shouldWrite(result, options.variables)) {
|
|
@@ -5759,7 +5752,7 @@ var QueryInfo = (function () {
|
|
|
5759
5752
|
query: document,
|
|
5760
5753
|
data: result.data,
|
|
5761
5754
|
variables: options.variables,
|
|
5762
|
-
overwrite: cacheWriteBehavior === 1,
|
|
5755
|
+
overwrite: cacheWriteBehavior === 1 ,
|
|
5763
5756
|
});
|
|
5764
5757
|
_this.lastWrite = {
|
|
5765
5758
|
result: result,
|
|
@@ -5818,10 +5811,10 @@ function shouldWriteResult(result, errorPolicy) {
|
|
|
5818
5811
|
}
|
|
5819
5812
|
|
|
5820
5813
|
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
5821
|
-
var QueryManager =
|
|
5814
|
+
var QueryManager = (function () {
|
|
5822
5815
|
function QueryManager(_a) {
|
|
5823
|
-
var _this = this;
|
|
5824
5816
|
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;
|
|
5817
|
+
var _this = this;
|
|
5825
5818
|
this.clientAwareness = {};
|
|
5826
5819
|
this.queries = new Map();
|
|
5827
5820
|
this.fetchCancelFns = new Map();
|
|
@@ -5830,7 +5823,8 @@ var QueryManager = (function () {
|
|
|
5830
5823
|
this.requestIdCounter = 1;
|
|
5831
5824
|
this.mutationIdCounter = 1;
|
|
5832
5825
|
this.inFlightLinkObservables = new Map();
|
|
5833
|
-
var defaultDocumentTransform = new DocumentTransform(function (document) { return _this.cache.transformDocument(document); },
|
|
5826
|
+
var defaultDocumentTransform = new DocumentTransform(function (document) { return _this.cache.transformDocument(document); },
|
|
5827
|
+
{ cache: false });
|
|
5834
5828
|
this.cache = cache;
|
|
5835
5829
|
this.link = link;
|
|
5836
5830
|
this.defaultOptions = defaultOptions || Object.create(null);
|
|
@@ -5839,11 +5833,12 @@ var QueryManager = (function () {
|
|
|
5839
5833
|
this.localState = localState || new LocalState({ cache: cache });
|
|
5840
5834
|
this.ssrMode = ssrMode;
|
|
5841
5835
|
this.assumeImmutableResults = assumeImmutableResults;
|
|
5842
|
-
this.documentTransform =
|
|
5843
|
-
?
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5836
|
+
this.documentTransform =
|
|
5837
|
+
documentTransform ?
|
|
5838
|
+
defaultDocumentTransform
|
|
5839
|
+
.concat(documentTransform)
|
|
5840
|
+
.concat(defaultDocumentTransform)
|
|
5841
|
+
: defaultDocumentTransform;
|
|
5847
5842
|
if ((this.onBroadcast = onBroadcast)) {
|
|
5848
5843
|
this.mutationStore = Object.create(null);
|
|
5849
5844
|
}
|
|
@@ -5873,8 +5868,8 @@ var QueryManager = (function () {
|
|
|
5873
5868
|
mutation = this.cache.transformForLink(this.transform(mutation));
|
|
5874
5869
|
hasClientExports = this.getDocumentInfo(mutation).hasClientExports;
|
|
5875
5870
|
variables = this.getVariables(mutation, variables);
|
|
5876
|
-
if (!hasClientExports) return [3, 2];
|
|
5877
|
-
return [4, this.localState.addExportedVariables(mutation, variables, context)];
|
|
5871
|
+
if (!hasClientExports) return [3 , 2];
|
|
5872
|
+
return [4 , this.localState.addExportedVariables(mutation, variables, context)];
|
|
5878
5873
|
case 1:
|
|
5879
5874
|
variables = (_h.sent());
|
|
5880
5875
|
_h.label = 2;
|
|
@@ -5901,7 +5896,7 @@ var QueryManager = (function () {
|
|
|
5901
5896
|
}
|
|
5902
5897
|
this.broadcastQueries();
|
|
5903
5898
|
self = this;
|
|
5904
|
-
return [2, new Promise(function (resolve, reject) {
|
|
5899
|
+
return [2 , new Promise(function (resolve, reject) {
|
|
5905
5900
|
return asyncMap(self.getObservableFromLink(mutation, tslib.__assign(tslib.__assign({}, context), { optimisticResponse: optimisticResponse }), variables, false), function (result) {
|
|
5906
5901
|
if (graphQLResultHasError(result) && errorPolicy === "none") {
|
|
5907
5902
|
throw new ApolloError({
|
|
@@ -5951,11 +5946,9 @@ var QueryManager = (function () {
|
|
|
5951
5946
|
self.cache.removeOptimistic(mutationId);
|
|
5952
5947
|
}
|
|
5953
5948
|
self.broadcastQueries();
|
|
5954
|
-
reject(err instanceof ApolloError
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
networkError: err,
|
|
5958
|
-
}));
|
|
5949
|
+
reject(err instanceof ApolloError ? err : (new ApolloError({
|
|
5950
|
+
networkError: err,
|
|
5951
|
+
})));
|
|
5959
5952
|
},
|
|
5960
5953
|
});
|
|
5961
5954
|
})];
|
|
@@ -6098,8 +6091,8 @@ var QueryManager = (function () {
|
|
|
6098
6091
|
};
|
|
6099
6092
|
QueryManager.prototype.markMutationOptimistic = function (optimisticResponse, mutation) {
|
|
6100
6093
|
var _this = this;
|
|
6101
|
-
var data = typeof optimisticResponse === "function"
|
|
6102
|
-
|
|
6094
|
+
var data = typeof optimisticResponse === "function" ?
|
|
6095
|
+
optimisticResponse(mutation.variables)
|
|
6103
6096
|
: optimisticResponse;
|
|
6104
6097
|
return this.cache.recordOptimisticTransaction(function (cache) {
|
|
6105
6098
|
try {
|
|
@@ -6391,7 +6384,8 @@ var QueryManager = (function () {
|
|
|
6391
6384
|
QueryManager.prototype.getLocalState = function () {
|
|
6392
6385
|
return this.localState;
|
|
6393
6386
|
};
|
|
6394
|
-
QueryManager.prototype.getObservableFromLink = function (query, context, variables,
|
|
6387
|
+
QueryManager.prototype.getObservableFromLink = function (query, context, variables,
|
|
6388
|
+
deduplication) {
|
|
6395
6389
|
var _this = this;
|
|
6396
6390
|
var _a;
|
|
6397
6391
|
if (deduplication === void 0) { deduplication = (_a = context === null || context === void 0 ? void 0 : context.queryDeduplication) !== null && _a !== void 0 ? _a : this.queryDeduplication; }
|
|
@@ -6472,16 +6466,15 @@ var QueryManager = (function () {
|
|
|
6472
6466
|
}
|
|
6473
6467
|
return aqr;
|
|
6474
6468
|
}, function (networkError) {
|
|
6475
|
-
var error = isApolloError(networkError)
|
|
6476
|
-
? networkError
|
|
6477
|
-
: new ApolloError({ networkError: networkError });
|
|
6469
|
+
var error = isApolloError(networkError) ? networkError : (new ApolloError({ networkError: networkError }));
|
|
6478
6470
|
if (requestId >= queryInfo.lastRequestId) {
|
|
6479
6471
|
queryInfo.markError(error);
|
|
6480
6472
|
}
|
|
6481
6473
|
throw error;
|
|
6482
6474
|
});
|
|
6483
6475
|
};
|
|
6484
|
-
QueryManager.prototype.fetchConcastWithInfo = function (queryId, options,
|
|
6476
|
+
QueryManager.prototype.fetchConcastWithInfo = function (queryId, options,
|
|
6477
|
+
networkStatus, query) {
|
|
6485
6478
|
var _this = this;
|
|
6486
6479
|
if (networkStatus === void 0) { networkStatus = exports.NetworkStatus.loading; }
|
|
6487
6480
|
if (query === void 0) { query = options.query; }
|
|
@@ -6501,7 +6494,8 @@ var QueryManager = (function () {
|
|
|
6501
6494
|
var fromVariables = function (variables) {
|
|
6502
6495
|
normalized.variables = variables;
|
|
6503
6496
|
var sourcesWithInfo = _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus);
|
|
6504
|
-
if (
|
|
6497
|
+
if (
|
|
6498
|
+
normalized.fetchPolicy !== "standby" &&
|
|
6505
6499
|
sourcesWithInfo.sources.length > 0 &&
|
|
6506
6500
|
queryInfo.observableQuery) {
|
|
6507
6501
|
queryInfo.observableQuery["applyNextFetchPolicy"]("after-fetch", options);
|
|
@@ -6599,7 +6593,8 @@ var QueryManager = (function () {
|
|
|
6599
6593
|
}
|
|
6600
6594
|
return results;
|
|
6601
6595
|
};
|
|
6602
|
-
QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a,
|
|
6596
|
+
QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a,
|
|
6597
|
+
networkStatus) {
|
|
6603
6598
|
var _this = this;
|
|
6604
6599
|
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;
|
|
6605
6600
|
var oldNetworkStatus = queryInfo.networkStatus;
|
|
@@ -6636,13 +6631,11 @@ var QueryManager = (function () {
|
|
|
6636
6631
|
}
|
|
6637
6632
|
return fromData(data);
|
|
6638
6633
|
};
|
|
6639
|
-
var cacheWriteBehavior = fetchPolicy === "no-cache"
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
? 1
|
|
6645
|
-
: 2;
|
|
6634
|
+
var cacheWriteBehavior = fetchPolicy === "no-cache" ? 0
|
|
6635
|
+
: (networkStatus === exports.NetworkStatus.refetch &&
|
|
6636
|
+
refetchWritePolicy !== "merge") ?
|
|
6637
|
+
1
|
|
6638
|
+
: 2 ;
|
|
6646
6639
|
var resultsFromLink = function () {
|
|
6647
6640
|
return _this.getResultsFromLink(queryInfo, cacheWriteBehavior, {
|
|
6648
6641
|
query: query,
|
|
@@ -6724,7 +6717,7 @@ var QueryManager = (function () {
|
|
|
6724
6717
|
}());
|
|
6725
6718
|
|
|
6726
6719
|
var hasSuggestedDevtools = false;
|
|
6727
|
-
var ApolloClient =
|
|
6720
|
+
var ApolloClient = (function () {
|
|
6728
6721
|
function ApolloClient(options) {
|
|
6729
6722
|
var _this = this;
|
|
6730
6723
|
this.resetStoreCallbacks = [];
|
|
@@ -6732,14 +6725,15 @@ var ApolloClient = (function () {
|
|
|
6732
6725
|
if (!options.cache) {
|
|
6733
6726
|
throw newInvariantError(15);
|
|
6734
6727
|
}
|
|
6735
|
-
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,
|
|
6728
|
+
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,
|
|
6729
|
+
_c = options.connectToDevTools,
|
|
6730
|
+
connectToDevTools = _c === void 0 ? typeof window === "object" &&
|
|
6736
6731
|
!window.__APOLLO_CLIENT__ &&
|
|
6737
6732
|
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;
|
|
6738
6733
|
var link = options.link;
|
|
6739
6734
|
if (!link) {
|
|
6740
|
-
link =
|
|
6741
|
-
? new HttpLink({ uri: uri, credentials: credentials, headers: headers })
|
|
6742
|
-
: ApolloLink.empty();
|
|
6735
|
+
link =
|
|
6736
|
+
uri ? new HttpLink({ uri: uri, credentials: credentials, headers: headers }) : ApolloLink.empty();
|
|
6743
6737
|
}
|
|
6744
6738
|
this.link = link;
|
|
6745
6739
|
this.cache = cache;
|
|
@@ -6775,8 +6769,8 @@ var ApolloClient = (function () {
|
|
|
6775
6769
|
},
|
|
6776
6770
|
localState: this.localState,
|
|
6777
6771
|
assumeImmutableResults: assumeImmutableResults,
|
|
6778
|
-
onBroadcast: connectToDevTools
|
|
6779
|
-
|
|
6772
|
+
onBroadcast: connectToDevTools ?
|
|
6773
|
+
function () {
|
|
6780
6774
|
if (_this.devToolsHookCb) {
|
|
6781
6775
|
_this.devToolsHookCb({
|
|
6782
6776
|
action: {},
|
|
@@ -6980,9 +6974,7 @@ var ApolloClient = (function () {
|
|
|
6980
6974
|
return ApolloClient;
|
|
6981
6975
|
}());
|
|
6982
6976
|
|
|
6983
|
-
var contextKey = canUseSymbol
|
|
6984
|
-
? Symbol.for("__APOLLO_CONTEXT__")
|
|
6985
|
-
: "__APOLLO_CONTEXT__";
|
|
6977
|
+
var contextKey = canUseSymbol ? Symbol.for("__APOLLO_CONTEXT__") : "__APOLLO_CONTEXT__";
|
|
6986
6978
|
function getApolloContext() {
|
|
6987
6979
|
invariant("createContext" in React__namespace, 45);
|
|
6988
6980
|
var context = React__namespace.createContext[contextKey];
|
|
@@ -7031,7 +7023,8 @@ var realHook$1 = React__namespace[uSESKey];
|
|
|
7031
7023
|
var useSyncExternalStore = realHook$1 ||
|
|
7032
7024
|
(function (subscribe, getSnapshot, getServerSnapshot) {
|
|
7033
7025
|
var value = getSnapshot();
|
|
7034
|
-
if (
|
|
7026
|
+
if (
|
|
7027
|
+
globalThis.__DEV__ !== false &&
|
|
7035
7028
|
!didWarnUncachedGetSnapshot &&
|
|
7036
7029
|
value !== getSnapshot()) {
|
|
7037
7030
|
didWarnUncachedGetSnapshot = true;
|
|
@@ -7140,10 +7133,8 @@ function parser(document) {
|
|
|
7140
7133
|
type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation;
|
|
7141
7134
|
if (!queries.length && !mutations.length)
|
|
7142
7135
|
type = exports.DocumentType.Subscription;
|
|
7143
|
-
var definitions = queries.length
|
|
7144
|
-
?
|
|
7145
|
-
: mutations.length
|
|
7146
|
-
? mutations
|
|
7136
|
+
var definitions = queries.length ? queries
|
|
7137
|
+
: mutations.length ? mutations
|
|
7147
7138
|
: subscriptions;
|
|
7148
7139
|
invariant(definitions.length === 1, 62, document, definitions.length);
|
|
7149
7140
|
var definition = definitions[0];
|
|
@@ -7187,7 +7178,7 @@ function useInternalState(client, query) {
|
|
|
7187
7178
|
state.forceUpdateState = React__namespace.useReducer(function (tick) { return tick + 1; }, 0)[1];
|
|
7188
7179
|
return state;
|
|
7189
7180
|
}
|
|
7190
|
-
var InternalState =
|
|
7181
|
+
var InternalState = (function () {
|
|
7191
7182
|
function InternalState(client, query, previous) {
|
|
7192
7183
|
var _this = this;
|
|
7193
7184
|
this.client = client;
|
|
@@ -7337,7 +7328,8 @@ var InternalState = (function () {
|
|
|
7337
7328
|
InternalState.prototype.createWatchQueryOptions = function (_a) {
|
|
7338
7329
|
var _b;
|
|
7339
7330
|
if (_a === void 0) { _a = {}; }
|
|
7340
|
-
var skip = _a.skip; _a.ssr; _a.onCompleted; _a.onError; _a.defaultOptions;
|
|
7331
|
+
var skip = _a.skip; _a.ssr; _a.onCompleted; _a.onError; _a.defaultOptions;
|
|
7332
|
+
var otherOptions = tslib.__rest(_a, ["skip", "ssr", "onCompleted", "onError", "defaultOptions"]);
|
|
7341
7333
|
var watchQueryOptions = Object.assign(otherOptions, { query: this.query });
|
|
7342
7334
|
if (this.renderPromises &&
|
|
7343
7335
|
(watchQueryOptions.fetchPolicy === "network-only" ||
|
|
@@ -7423,8 +7415,8 @@ var InternalState = (function () {
|
|
|
7423
7415
|
}
|
|
7424
7416
|
};
|
|
7425
7417
|
InternalState.prototype.toApolloError = function (result) {
|
|
7426
|
-
return isNonEmptyArray(result.errors)
|
|
7427
|
-
|
|
7418
|
+
return isNonEmptyArray(result.errors) ?
|
|
7419
|
+
new ApolloError({ graphQLErrors: result.errors })
|
|
7428
7420
|
: result.error;
|
|
7429
7421
|
};
|
|
7430
7422
|
InternalState.prototype.getCurrentResult = function () {
|
|
@@ -7504,10 +7496,10 @@ function useLazyQuery(query, options) {
|
|
|
7504
7496
|
}, []);
|
|
7505
7497
|
Object.assign(result, eagerMethods);
|
|
7506
7498
|
var execute = React__namespace.useCallback(function (executeOptions) {
|
|
7507
|
-
execOptionsRef.current =
|
|
7508
|
-
? tslib.__assign(tslib.__assign({}, executeOptions), { fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy }) : {
|
|
7509
|
-
|
|
7510
|
-
|
|
7499
|
+
execOptionsRef.current =
|
|
7500
|
+
executeOptions ? tslib.__assign(tslib.__assign({}, executeOptions), { fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy }) : {
|
|
7501
|
+
fetchPolicy: initialFetchPolicy,
|
|
7502
|
+
};
|
|
7511
7503
|
var options = mergeOptions(optionsRef.current, tslib.__assign({ query: queryRef.current }, execOptionsRef.current));
|
|
7512
7504
|
var promise = internalState
|
|
7513
7505
|
.executeQuery(tslib.__assign(tslib.__assign({}, options), { skip: false }))
|
|
@@ -7560,8 +7552,8 @@ function useMutation(mutation, options) {
|
|
|
7560
7552
|
.then(function (response) {
|
|
7561
7553
|
var _a, _b;
|
|
7562
7554
|
var data = response.data, errors = response.errors;
|
|
7563
|
-
var error = errors && errors.length > 0
|
|
7564
|
-
|
|
7555
|
+
var error = errors && errors.length > 0 ?
|
|
7556
|
+
new ApolloError({ graphQLErrors: errors })
|
|
7565
7557
|
: void 0;
|
|
7566
7558
|
var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError);
|
|
7567
7559
|
if (error && onError) {
|
|
@@ -7610,7 +7602,9 @@ function useMutation(mutation, options) {
|
|
|
7610
7602
|
}, []);
|
|
7611
7603
|
var reset = React__namespace.useCallback(function () {
|
|
7612
7604
|
if (ref.current.isMounted) {
|
|
7613
|
-
|
|
7605
|
+
var result_3 = { called: false, loading: false, client: client };
|
|
7606
|
+
Object.assign(ref.current, { mutationId: 0, result: result_3 });
|
|
7607
|
+
setResult(result_3);
|
|
7614
7608
|
}
|
|
7615
7609
|
}, []);
|
|
7616
7610
|
React__namespace.useEffect(function () {
|
|
@@ -7783,9 +7777,9 @@ function useFragment(options) {
|
|
|
7783
7777
|
var latestDiff = cache.diff(diffOptions);
|
|
7784
7778
|
var getSnapshot = function () {
|
|
7785
7779
|
var latestDiffToResult = diffToResult(latestDiff);
|
|
7786
|
-
return resultRef.current &&
|
|
7787
|
-
equal.equal(resultRef.current.data, latestDiffToResult.data)
|
|
7788
|
-
|
|
7780
|
+
return (resultRef.current &&
|
|
7781
|
+
equal.equal(resultRef.current.data, latestDiffToResult.data)) ?
|
|
7782
|
+
resultRef.current
|
|
7789
7783
|
: (resultRef.current = latestDiffToResult);
|
|
7790
7784
|
};
|
|
7791
7785
|
return useSyncExternalStore(function (forceUpdate) {
|
|
@@ -7852,7 +7846,7 @@ var OBSERVED_CHANGED_OPTIONS = [
|
|
|
7852
7846
|
"refetchWritePolicy",
|
|
7853
7847
|
"returnPartialData",
|
|
7854
7848
|
];
|
|
7855
|
-
var InternalQueryReference =
|
|
7849
|
+
var InternalQueryReference = (function () {
|
|
7856
7850
|
function InternalQueryReference(observable, options) {
|
|
7857
7851
|
var _this = this;
|
|
7858
7852
|
this.listeners = new Set();
|
|
@@ -8029,7 +8023,7 @@ var InternalQueryReference = (function () {
|
|
|
8029
8023
|
return InternalQueryReference;
|
|
8030
8024
|
}());
|
|
8031
8025
|
|
|
8032
|
-
var SuspenseCache =
|
|
8026
|
+
var SuspenseCache = (function () {
|
|
8033
8027
|
function SuspenseCache(options) {
|
|
8034
8028
|
if (options === void 0) { options = Object.create(null); }
|
|
8035
8029
|
this.queryRefs = new trie.Trie(canUseWeakMap);
|
|
@@ -8066,7 +8060,11 @@ function useSuspenseQuery(query, options) {
|
|
|
8066
8060
|
if (options === void 0) { options = Object.create(null); }
|
|
8067
8061
|
var client = useApolloClient(options.client);
|
|
8068
8062
|
var suspenseCache = getSuspenseCache(client);
|
|
8069
|
-
var watchQueryOptions = useWatchQueryOptions({
|
|
8063
|
+
var watchQueryOptions = useWatchQueryOptions({
|
|
8064
|
+
client: client,
|
|
8065
|
+
query: query,
|
|
8066
|
+
options: options,
|
|
8067
|
+
});
|
|
8070
8068
|
var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables;
|
|
8071
8069
|
var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
|
|
8072
8070
|
var cacheKey = tslib.__spreadArray([
|
|
@@ -8108,13 +8106,13 @@ function useSuspenseQuery(query, options) {
|
|
|
8108
8106
|
};
|
|
8109
8107
|
}, [queryRef.result]);
|
|
8110
8108
|
var result = fetchPolicy === "standby" ? skipResult : __use(promise);
|
|
8111
|
-
var fetchMore = React__namespace.useCallback(function (options) {
|
|
8109
|
+
var fetchMore = React__namespace.useCallback((function (options) {
|
|
8112
8110
|
var promise = queryRef.fetchMore(options);
|
|
8113
8111
|
setPromiseCache(function (previousPromiseCache) {
|
|
8114
8112
|
return new Map(previousPromiseCache).set(queryRef.key, queryRef.promise);
|
|
8115
8113
|
});
|
|
8116
8114
|
return promise;
|
|
8117
|
-
}, [queryRef]);
|
|
8115
|
+
}), [queryRef]);
|
|
8118
8116
|
var refetch = React__namespace.useCallback(function (variables) {
|
|
8119
8117
|
var promise = queryRef.refetch(variables);
|
|
8120
8118
|
setPromiseCache(function (previousPromiseCache) {
|
|
@@ -8157,8 +8155,8 @@ function validatePartialDataReturn(fetchPolicy, returnPartialData) {
|
|
|
8157
8155
|
}
|
|
8158
8156
|
}
|
|
8159
8157
|
function toApolloError(result) {
|
|
8160
|
-
return isNonEmptyArray(result.errors)
|
|
8161
|
-
|
|
8158
|
+
return isNonEmptyArray(result.errors) ?
|
|
8159
|
+
new ApolloError({ graphQLErrors: result.errors })
|
|
8162
8160
|
: result.error;
|
|
8163
8161
|
}
|
|
8164
8162
|
function useWatchQueryOptions(_a) {
|