@apollo/client 3.8.7 → 3.8.9
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 +3369 -0
- package/apollo-client.cjs +356 -354
- 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.d.ts +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 -15
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +14 -15
- 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 +50 -13
- 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 +46 -1
- 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 +56 -45
- 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 +72 -57
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +72 -57
- package/react/hooks/internal/__use.js +5 -0
- package/react/hooks/internal/__use.js.map +1 -1
- package/react/hooks/internal/index.d.ts +1 -0
- package/react/hooks/internal/index.js +2 -0
- package/react/hooks/internal/index.js.map +1 -1
- package/react/hooks/internal/useDeepMemo.js.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.js +6 -3
- package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -1
- package/react/hooks/internal/useLazyRef.d.ts +3 -0
- package/react/hooks/internal/useLazyRef.js +10 -0
- package/react/hooks/internal/useLazyRef.js.map +1 -0
- package/react/hooks/useBackgroundQuery.js +6 -0
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.js +21 -17
- 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 +18 -13
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +18 -13
- 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 +25 -9
- 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.9";
|
|
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
|
});
|
|
@@ -1893,14 +1894,11 @@ function parseAndCheckHttpResponse(operations) {
|
|
|
1893
1894
|
.text()
|
|
1894
1895
|
.then(function (bodyText) { return parseJsonBody(response, bodyText); })
|
|
1895
1896
|
.then(function (result) {
|
|
1896
|
-
if (response.status >= 300) {
|
|
1897
|
-
throwServerError(response, result, "Response not successful: Received status code ".concat(response.status));
|
|
1898
|
-
}
|
|
1899
1897
|
if (!Array.isArray(result) &&
|
|
1900
1898
|
!hasOwnProperty$3.call(result, "data") &&
|
|
1901
1899
|
!hasOwnProperty$3.call(result, "errors")) {
|
|
1902
|
-
throwServerError(response, result, "Server response was missing for query '".concat(Array.isArray(operations)
|
|
1903
|
-
|
|
1900
|
+
throwServerError(response, result, "Server response was missing for query '".concat(Array.isArray(operations) ?
|
|
1901
|
+
operations.map(function (op) { return op.operationName; })
|
|
1904
1902
|
: operations.operationName, "'."));
|
|
1905
1903
|
}
|
|
1906
1904
|
return result;
|
|
@@ -2071,7 +2069,8 @@ function rewriteURIForGET(chosenURI, body) {
|
|
|
2071
2069
|
var backupFetch = maybe(function () { return fetch; });
|
|
2072
2070
|
var createHttpLink = function (linkOptions) {
|
|
2073
2071
|
if (linkOptions === void 0) { linkOptions = {}; }
|
|
2074
|
-
var _a = linkOptions.uri, uri = _a === void 0 ? "/graphql" : _a,
|
|
2072
|
+
var _a = linkOptions.uri, uri = _a === void 0 ? "/graphql" : _a,
|
|
2073
|
+
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
2074
|
if (globalThis.__DEV__ !== false) {
|
|
2076
2075
|
checkFetcher(preferredFetch || backupFetch);
|
|
2077
2076
|
}
|
|
@@ -2190,7 +2189,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
2190
2189
|
});
|
|
2191
2190
|
};
|
|
2192
2191
|
|
|
2193
|
-
var HttpLink =
|
|
2192
|
+
var HttpLink = (function (_super) {
|
|
2194
2193
|
tslib.__extends(HttpLink, _super);
|
|
2195
2194
|
function HttpLink(options) {
|
|
2196
2195
|
if (options === void 0) { options = {}; }
|
|
@@ -2201,17 +2200,15 @@ var HttpLink = (function (_super) {
|
|
|
2201
2200
|
return HttpLink;
|
|
2202
2201
|
}(ApolloLink));
|
|
2203
2202
|
|
|
2204
|
-
var ApolloCache =
|
|
2203
|
+
var ApolloCache = (function () {
|
|
2205
2204
|
function ApolloCache() {
|
|
2206
2205
|
this.assumeImmutableResults = false;
|
|
2207
2206
|
this.getFragmentDoc = optimism.wrap(getFragmentQueryDocument);
|
|
2208
2207
|
}
|
|
2209
2208
|
ApolloCache.prototype.batch = function (options) {
|
|
2210
2209
|
var _this = this;
|
|
2211
|
-
var optimisticId = typeof options.optimistic === "string"
|
|
2212
|
-
|
|
2213
|
-
: options.optimistic === false
|
|
2214
|
-
? null
|
|
2210
|
+
var optimisticId = typeof options.optimistic === "string" ? options.optimistic
|
|
2211
|
+
: options.optimistic === false ? null
|
|
2215
2212
|
: void 0;
|
|
2216
2213
|
var updateResult;
|
|
2217
2214
|
this.performTransaction(function () { return (updateResult = options.update(_this)); }, optimisticId);
|
|
@@ -2289,7 +2286,7 @@ exports.Cache = void 0;
|
|
|
2289
2286
|
(function (Cache) {
|
|
2290
2287
|
})(exports.Cache || (exports.Cache = {}));
|
|
2291
2288
|
|
|
2292
|
-
var MissingFieldError =
|
|
2289
|
+
var MissingFieldError = (function (_super) {
|
|
2293
2290
|
tslib.__extends(MissingFieldError, _super);
|
|
2294
2291
|
function MissingFieldError(message, path, query, variables) {
|
|
2295
2292
|
var _a;
|
|
@@ -2321,18 +2318,17 @@ function defaultDataIdFromObject(_a, context) {
|
|
|
2321
2318
|
var __typename = _a.__typename, id = _a.id, _id = _a._id;
|
|
2322
2319
|
if (typeof __typename === "string") {
|
|
2323
2320
|
if (context) {
|
|
2324
|
-
context.keyObject =
|
|
2325
|
-
? { id: id }
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
: void 0;
|
|
2321
|
+
context.keyObject =
|
|
2322
|
+
!isNullish(id) ? { id: id }
|
|
2323
|
+
: !isNullish(_id) ? { _id: _id }
|
|
2324
|
+
: void 0;
|
|
2329
2325
|
}
|
|
2330
2326
|
if (isNullish(id) && !isNullish(_id)) {
|
|
2331
2327
|
id = _id;
|
|
2332
2328
|
}
|
|
2333
2329
|
if (!isNullish(id)) {
|
|
2334
|
-
return "".concat(__typename, ":").concat(typeof id === "number" || typeof id === "string"
|
|
2335
|
-
|
|
2330
|
+
return "".concat(__typename, ":").concat(typeof id === "number" || typeof id === "string" ?
|
|
2331
|
+
id
|
|
2336
2332
|
: JSON.stringify(id));
|
|
2337
2333
|
}
|
|
2338
2334
|
}
|
|
@@ -2351,8 +2347,8 @@ function shouldCanonizeResults(config) {
|
|
|
2351
2347
|
return value === void 0 ? defaultConfig.canonizeResults : value;
|
|
2352
2348
|
}
|
|
2353
2349
|
function getTypenameFromStoreObject(store, objectOrReference) {
|
|
2354
|
-
return isReference(objectOrReference)
|
|
2355
|
-
|
|
2350
|
+
return isReference(objectOrReference) ?
|
|
2351
|
+
store.get(objectOrReference.__ref, "__typename")
|
|
2356
2352
|
: objectOrReference && objectOrReference.__typename;
|
|
2357
2353
|
}
|
|
2358
2354
|
var TypeOrFieldNameRegExp = /^[_a-z][_0-9a-z]*/i;
|
|
@@ -2362,8 +2358,8 @@ function fieldNameFromStoreName(storeFieldName) {
|
|
|
2362
2358
|
}
|
|
2363
2359
|
function selectionSetMatchesResult(selectionSet, result, variables) {
|
|
2364
2360
|
if (isNonNullObject(result)) {
|
|
2365
|
-
return isArray(result)
|
|
2366
|
-
|
|
2361
|
+
return isArray(result) ?
|
|
2362
|
+
result.every(function (item) {
|
|
2367
2363
|
return selectionSetMatchesResult(selectionSet, item, variables);
|
|
2368
2364
|
})
|
|
2369
2365
|
: selectionSet.selections.every(function (field) {
|
|
@@ -2401,7 +2397,7 @@ function extractFragmentContext(document, fragments) {
|
|
|
2401
2397
|
var DELETE = Object.create(null);
|
|
2402
2398
|
var delModifier = function () { return DELETE; };
|
|
2403
2399
|
var INVALIDATE = Object.create(null);
|
|
2404
|
-
var EntityStore =
|
|
2400
|
+
var EntityStore = (function () {
|
|
2405
2401
|
function EntityStore(policies, group) {
|
|
2406
2402
|
var _this = this;
|
|
2407
2403
|
this.policies = policies;
|
|
@@ -2410,13 +2406,13 @@ var EntityStore = (function () {
|
|
|
2410
2406
|
this.rootIds = Object.create(null);
|
|
2411
2407
|
this.refs = Object.create(null);
|
|
2412
2408
|
this.getFieldValue = function (objectOrReference, storeFieldName) {
|
|
2413
|
-
return maybeDeepFreeze(isReference(objectOrReference)
|
|
2414
|
-
|
|
2409
|
+
return maybeDeepFreeze(isReference(objectOrReference) ?
|
|
2410
|
+
_this.get(objectOrReference.__ref, storeFieldName)
|
|
2415
2411
|
: objectOrReference && objectOrReference[storeFieldName]);
|
|
2416
2412
|
};
|
|
2417
2413
|
this.canRead = function (objOrRef) {
|
|
2418
|
-
return isReference(objOrRef)
|
|
2419
|
-
|
|
2414
|
+
return isReference(objOrRef) ?
|
|
2415
|
+
_this.has(objOrRef.__ref)
|
|
2420
2416
|
: typeof objOrRef === "object";
|
|
2421
2417
|
};
|
|
2422
2418
|
this.toReference = function (objOrIdOrRef, mergeIntoStore) {
|
|
@@ -2530,8 +2526,8 @@ var EntityStore = (function () {
|
|
|
2530
2526
|
toReference: this.toReference,
|
|
2531
2527
|
canRead: this.canRead,
|
|
2532
2528
|
readField: function (fieldNameOrOptions, from) {
|
|
2533
|
-
return _this.policies.readField(typeof fieldNameOrOptions === "string"
|
|
2534
|
-
|
|
2529
|
+
return _this.policies.readField(typeof fieldNameOrOptions === "string" ?
|
|
2530
|
+
{
|
|
2535
2531
|
fieldName: fieldNameOrOptions,
|
|
2536
2532
|
from: from || makeReference(dataId),
|
|
2537
2533
|
}
|
|
@@ -2543,13 +2539,9 @@ var EntityStore = (function () {
|
|
|
2543
2539
|
var fieldValue = storeObject[storeFieldName];
|
|
2544
2540
|
if (fieldValue === void 0)
|
|
2545
2541
|
return;
|
|
2546
|
-
var modify = typeof fields === "function"
|
|
2547
|
-
? fields
|
|
2548
|
-
: fields[storeFieldName] || fields[fieldName];
|
|
2542
|
+
var modify = typeof fields === "function" ? fields : (fields[storeFieldName] || fields[fieldName]);
|
|
2549
2543
|
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) }));
|
|
2544
|
+
var newValue = modify === delModifier ? DELETE : (modify(maybeDeepFreeze(fieldValue), tslib.__assign(tslib.__assign({}, sharedDetails_1), { fieldName: fieldName, storeFieldName: storeFieldName, storage: _this.getStorage(dataId, storeFieldName) })));
|
|
2553
2545
|
if (newValue === INVALIDATE) {
|
|
2554
2546
|
_this.group.dirty(dataId, storeFieldName);
|
|
2555
2547
|
}
|
|
@@ -2623,13 +2615,12 @@ var EntityStore = (function () {
|
|
|
2623
2615
|
var storeObject = this.lookup(dataId);
|
|
2624
2616
|
if (storeObject) {
|
|
2625
2617
|
var typename = this.getFieldValue(storeObject, "__typename");
|
|
2626
|
-
var storeFieldName = fieldName && args
|
|
2627
|
-
|
|
2618
|
+
var storeFieldName = fieldName && args ?
|
|
2619
|
+
this.policies.getStoreFieldName({ typename: typename, fieldName: fieldName, args: args })
|
|
2628
2620
|
: fieldName;
|
|
2629
|
-
return this.modify(dataId, storeFieldName
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
_a) : delModifier);
|
|
2621
|
+
return this.modify(dataId, storeFieldName ? (_a = {},
|
|
2622
|
+
_a[storeFieldName] = delModifier,
|
|
2623
|
+
_a) : delModifier);
|
|
2633
2624
|
}
|
|
2634
2625
|
return false;
|
|
2635
2626
|
};
|
|
@@ -2752,7 +2743,7 @@ var EntityStore = (function () {
|
|
|
2752
2743
|
};
|
|
2753
2744
|
return EntityStore;
|
|
2754
2745
|
}());
|
|
2755
|
-
var CacheGroup =
|
|
2746
|
+
var CacheGroup = (function () {
|
|
2756
2747
|
function CacheGroup(caching, parent) {
|
|
2757
2748
|
if (parent === void 0) { parent = null; }
|
|
2758
2749
|
this.caching = caching;
|
|
@@ -2778,7 +2769,8 @@ var CacheGroup = (function () {
|
|
|
2778
2769
|
};
|
|
2779
2770
|
CacheGroup.prototype.dirty = function (dataId, storeFieldName) {
|
|
2780
2771
|
if (this.d) {
|
|
2781
|
-
this.d.dirty(makeDepKey(dataId, storeFieldName),
|
|
2772
|
+
this.d.dirty(makeDepKey(dataId, storeFieldName),
|
|
2773
|
+
storeFieldName === "__exists" ? "forget" : "setDirty");
|
|
2782
2774
|
}
|
|
2783
2775
|
};
|
|
2784
2776
|
return CacheGroup;
|
|
@@ -2792,7 +2784,7 @@ function maybeDependOnExistenceOfEntity(store, entityId) {
|
|
|
2792
2784
|
}
|
|
2793
2785
|
}
|
|
2794
2786
|
(function (EntityStore) {
|
|
2795
|
-
var Root =
|
|
2787
|
+
var Root = (function (_super) {
|
|
2796
2788
|
tslib.__extends(Root, _super);
|
|
2797
2789
|
function Root(_a) {
|
|
2798
2790
|
var policies = _a.policies, _b = _a.resultCaching, resultCaching = _b === void 0 ? true : _b, seed = _a.seed;
|
|
@@ -2816,7 +2808,7 @@ function maybeDependOnExistenceOfEntity(store, entityId) {
|
|
|
2816
2808
|
}(EntityStore));
|
|
2817
2809
|
EntityStore.Root = Root;
|
|
2818
2810
|
})(EntityStore || (EntityStore = {}));
|
|
2819
|
-
var Layer =
|
|
2811
|
+
var Layer = (function (_super) {
|
|
2820
2812
|
tslib.__extends(Layer, _super);
|
|
2821
2813
|
function Layer(id, parent, replay, group) {
|
|
2822
2814
|
var _this = _super.call(this, parent.policies, group) || this;
|
|
@@ -2867,18 +2859,18 @@ var Layer = (function (_super) {
|
|
|
2867
2859
|
};
|
|
2868
2860
|
Layer.prototype.findChildRefIds = function (dataId) {
|
|
2869
2861
|
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;
|
|
2862
|
+
return hasOwn.call(this.data, dataId) ? tslib.__assign(tslib.__assign({}, fromParent), _super.prototype.findChildRefIds.call(this, dataId)) : fromParent;
|
|
2872
2863
|
};
|
|
2873
2864
|
Layer.prototype.getStorage = function () {
|
|
2874
2865
|
var p = this.parent;
|
|
2875
2866
|
while (p.parent)
|
|
2876
2867
|
p = p.parent;
|
|
2877
|
-
return p.getStorage.apply(p,
|
|
2868
|
+
return p.getStorage.apply(p,
|
|
2869
|
+
arguments);
|
|
2878
2870
|
};
|
|
2879
2871
|
return Layer;
|
|
2880
2872
|
}(EntityStore));
|
|
2881
|
-
var Stump =
|
|
2873
|
+
var Stump = (function (_super) {
|
|
2882
2874
|
tslib.__extends(Stump, _super);
|
|
2883
2875
|
function Stump(root) {
|
|
2884
2876
|
return _super.call(this, "EntityStore.Stump", root, function () { }, new CacheGroup(root.group.caching, root.group)) || this;
|
|
@@ -2886,8 +2878,8 @@ var Stump = (function (_super) {
|
|
|
2886
2878
|
Stump.prototype.removeLayer = function () {
|
|
2887
2879
|
return this;
|
|
2888
2880
|
};
|
|
2889
|
-
Stump.prototype.merge = function () {
|
|
2890
|
-
return this.parent.merge
|
|
2881
|
+
Stump.prototype.merge = function (older, newer) {
|
|
2882
|
+
return this.parent.merge(older, newer);
|
|
2891
2883
|
};
|
|
2892
2884
|
return Stump;
|
|
2893
2885
|
}(Layer));
|
|
@@ -2902,13 +2894,13 @@ function supportsResultCaching(store) {
|
|
|
2902
2894
|
|
|
2903
2895
|
function shallowCopy(value) {
|
|
2904
2896
|
if (isNonNullObject(value)) {
|
|
2905
|
-
return isArray(value)
|
|
2906
|
-
|
|
2897
|
+
return isArray(value) ?
|
|
2898
|
+
value.slice(0)
|
|
2907
2899
|
: tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value);
|
|
2908
2900
|
}
|
|
2909
2901
|
return value;
|
|
2910
2902
|
}
|
|
2911
|
-
var ObjectCanon =
|
|
2903
|
+
var ObjectCanon = (function () {
|
|
2912
2904
|
function ObjectCanon() {
|
|
2913
2905
|
this.known = new (canUseWeakSet ? WeakSet : Set)();
|
|
2914
2906
|
this.pool = new trie.Trie(canUseWeakMap);
|
|
@@ -3022,7 +3014,7 @@ function execSelectionSetKeyArgs(options) {
|
|
|
3022
3014
|
options.context.canonizeResults,
|
|
3023
3015
|
];
|
|
3024
3016
|
}
|
|
3025
|
-
var StoreReader =
|
|
3017
|
+
var StoreReader = (function () {
|
|
3026
3018
|
function StoreReader(config) {
|
|
3027
3019
|
var _this = this;
|
|
3028
3020
|
this.knownResults = new (canUseWeakMap ? WeakMap : Map)();
|
|
@@ -3039,7 +3031,8 @@ var StoreReader = (function () {
|
|
|
3039
3031
|
var other = (_a = _this.executeSelectionSet).peek.apply(_a, peekArgs);
|
|
3040
3032
|
if (other) {
|
|
3041
3033
|
if (canonizeResults) {
|
|
3042
|
-
return tslib.__assign(tslib.__assign({}, other), {
|
|
3034
|
+
return tslib.__assign(tslib.__assign({}, other), {
|
|
3035
|
+
result: _this.canon.admit(other.result) });
|
|
3043
3036
|
}
|
|
3044
3037
|
return other;
|
|
3045
3038
|
}
|
|
@@ -3099,7 +3092,8 @@ var StoreReader = (function () {
|
|
|
3099
3092
|
StoreReader.prototype.isFresh = function (result, parent, selectionSet, context) {
|
|
3100
3093
|
if (supportsResultCaching(context.store) &&
|
|
3101
3094
|
this.knownResults.get(result) === selectionSet) {
|
|
3102
|
-
var latest = this.executeSelectionSet.peek(selectionSet, parent, context,
|
|
3095
|
+
var latest = this.executeSelectionSet.peek(selectionSet, parent, context,
|
|
3096
|
+
this.canon.isKnown(result));
|
|
3103
3097
|
if (latest && result === latest.result) {
|
|
3104
3098
|
return true;
|
|
3105
3099
|
}
|
|
@@ -3152,8 +3146,8 @@ var StoreReader = (function () {
|
|
|
3152
3146
|
if (fieldValue === void 0) {
|
|
3153
3147
|
if (!addTypenameToDocument.added(selection)) {
|
|
3154
3148
|
missing = missingMerger.merge(missing, (_a = {},
|
|
3155
|
-
_a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(isReference(objectOrReference)
|
|
3156
|
-
|
|
3149
|
+
_a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(isReference(objectOrReference) ?
|
|
3150
|
+
objectOrReference.__ref + " object"
|
|
3157
3151
|
: "object " + JSON.stringify(objectOrReference, null, 2)),
|
|
3158
3152
|
_a));
|
|
3159
3153
|
}
|
|
@@ -3195,10 +3189,9 @@ var StoreReader = (function () {
|
|
|
3195
3189
|
});
|
|
3196
3190
|
var result = mergeDeepArray(objectsToMerge);
|
|
3197
3191
|
var finalResult = { result: result, missing: missing };
|
|
3198
|
-
var frozen = context.canonizeResults
|
|
3199
|
-
|
|
3200
|
-
:
|
|
3201
|
-
maybeDeepFreeze(finalResult);
|
|
3192
|
+
var frozen = context.canonizeResults ?
|
|
3193
|
+
this.canon.admit(finalResult)
|
|
3194
|
+
: maybeDeepFreeze(finalResult);
|
|
3202
3195
|
if (frozen.result) {
|
|
3203
3196
|
this.knownResults.set(frozen.result, selectionSet);
|
|
3204
3197
|
}
|
|
@@ -3280,7 +3273,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
3280
3273
|
}
|
|
3281
3274
|
}
|
|
3282
3275
|
|
|
3283
|
-
var cacheSlot = new
|
|
3276
|
+
var cacheSlot = new optimism.Slot();
|
|
3284
3277
|
var cacheInfoMap = new WeakMap();
|
|
3285
3278
|
function getCacheInfo(cache) {
|
|
3286
3279
|
var info = cacheInfoMap.get(cache);
|
|
@@ -3356,7 +3349,8 @@ function keyFieldsFnFromSpecifier(specifier) {
|
|
|
3356
3349
|
return context.readField(key, from);
|
|
3357
3350
|
};
|
|
3358
3351
|
var keyObject = (context.keyObject = collectSpecifierPaths(specifier, function (schemaKeyPath) {
|
|
3359
|
-
var extracted = extractKeyPath(context.storeObject, schemaKeyPath,
|
|
3352
|
+
var extracted = extractKeyPath(context.storeObject, schemaKeyPath,
|
|
3353
|
+
extract);
|
|
3360
3354
|
if (extracted === void 0 &&
|
|
3361
3355
|
object !== context.storeObject &&
|
|
3362
3356
|
hasOwn.call(object, schemaKeyPath[0])) {
|
|
@@ -3382,7 +3376,8 @@ function keyArgsFnFromSpecifier(specifier) {
|
|
|
3382
3376
|
var d = field.directives.find(function (d) { return d.name.value === directiveName_1; });
|
|
3383
3377
|
var directiveArgs = d && argumentsObjectFromField(d, variables);
|
|
3384
3378
|
return (directiveArgs &&
|
|
3385
|
-
extractKeyPath(directiveArgs,
|
|
3379
|
+
extractKeyPath(directiveArgs,
|
|
3380
|
+
keyPath.slice(1)));
|
|
3386
3381
|
}
|
|
3387
3382
|
return;
|
|
3388
3383
|
}
|
|
@@ -3447,8 +3442,8 @@ function extractKey(object, key) {
|
|
|
3447
3442
|
function extractKeyPath(object, path, extract) {
|
|
3448
3443
|
extract = extract || extractKey;
|
|
3449
3444
|
return normalize(path.reduce(function reducer(obj, key) {
|
|
3450
|
-
return isArray(obj)
|
|
3451
|
-
|
|
3445
|
+
return isArray(obj) ?
|
|
3446
|
+
obj.map(function (child) { return reducer(child, key); })
|
|
3452
3447
|
: obj && extract(obj, key);
|
|
3453
3448
|
}, object));
|
|
3454
3449
|
}
|
|
@@ -3466,11 +3461,9 @@ function normalize(value) {
|
|
|
3466
3461
|
|
|
3467
3462
|
getStoreKeyName.setStringify(canonicalStringify);
|
|
3468
3463
|
function argsFromFieldSpecifier(spec) {
|
|
3469
|
-
return spec.args !== void 0
|
|
3470
|
-
? spec.
|
|
3471
|
-
|
|
3472
|
-
? argumentsObjectFromField(spec.field, spec.variables)
|
|
3473
|
-
: null;
|
|
3464
|
+
return (spec.args !== void 0 ? spec.args
|
|
3465
|
+
: spec.field ? argumentsObjectFromField(spec.field, spec.variables)
|
|
3466
|
+
: null);
|
|
3474
3467
|
}
|
|
3475
3468
|
var nullKeyFieldsFn = function () { return void 0; };
|
|
3476
3469
|
var simpleKeyArgsFn = function (_args, context) { return context.fieldName; };
|
|
@@ -3479,7 +3472,7 @@ var mergeTrueFn = function (existing, incoming, _a) {
|
|
|
3479
3472
|
return mergeObjects(existing, incoming);
|
|
3480
3473
|
};
|
|
3481
3474
|
var mergeFalseFn = function (_, incoming) { return incoming; };
|
|
3482
|
-
var Policies =
|
|
3475
|
+
var Policies = (function () {
|
|
3483
3476
|
function Policies(config) {
|
|
3484
3477
|
this.config = config;
|
|
3485
3478
|
this.typePolicies = Object.create(null);
|
|
@@ -3559,28 +3552,17 @@ var Policies = (function () {
|
|
|
3559
3552
|
var keyFields = incoming.keyFields, fields = incoming.fields;
|
|
3560
3553
|
function setMerge(existing, merge) {
|
|
3561
3554
|
existing.merge =
|
|
3562
|
-
typeof merge === "function"
|
|
3563
|
-
?
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
? mergeTrueFn
|
|
3567
|
-
:
|
|
3568
|
-
merge === false
|
|
3569
|
-
? mergeFalseFn
|
|
3570
|
-
: existing.merge;
|
|
3555
|
+
typeof merge === "function" ? merge
|
|
3556
|
+
: merge === true ? mergeTrueFn
|
|
3557
|
+
: merge === false ? mergeFalseFn
|
|
3558
|
+
: existing.merge;
|
|
3571
3559
|
}
|
|
3572
3560
|
setMerge(existing, incoming.merge);
|
|
3573
3561
|
existing.keyFn =
|
|
3574
|
-
keyFields === false
|
|
3575
|
-
?
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
? keyFieldsFnFromSpecifier(keyFields)
|
|
3579
|
-
:
|
|
3580
|
-
typeof keyFields === "function"
|
|
3581
|
-
? keyFields
|
|
3582
|
-
:
|
|
3583
|
-
existing.keyFn;
|
|
3562
|
+
keyFields === false ? nullKeyFieldsFn
|
|
3563
|
+
: isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields)
|
|
3564
|
+
: typeof keyFields === "function" ? keyFields
|
|
3565
|
+
: existing.keyFn;
|
|
3584
3566
|
if (fields) {
|
|
3585
3567
|
Object.keys(fields).forEach(function (fieldName) {
|
|
3586
3568
|
var existing = _this.getFieldPolicy(typename, fieldName, true);
|
|
@@ -3591,16 +3573,10 @@ var Policies = (function () {
|
|
|
3591
3573
|
else {
|
|
3592
3574
|
var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge;
|
|
3593
3575
|
existing.keyFn =
|
|
3594
|
-
keyArgs === false
|
|
3595
|
-
?
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
? keyArgsFnFromSpecifier(keyArgs)
|
|
3599
|
-
:
|
|
3600
|
-
typeof keyArgs === "function"
|
|
3601
|
-
? keyArgs
|
|
3602
|
-
:
|
|
3603
|
-
existing.keyFn;
|
|
3576
|
+
keyArgs === false ? simpleKeyArgsFn
|
|
3577
|
+
: isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs)
|
|
3578
|
+
: typeof keyArgs === "function" ? keyArgs
|
|
3579
|
+
: existing.keyFn;
|
|
3604
3580
|
if (typeof read === "function") {
|
|
3605
3581
|
existing.read = read;
|
|
3606
3582
|
}
|
|
@@ -3766,15 +3742,15 @@ var Policies = (function () {
|
|
|
3766
3742
|
}
|
|
3767
3743
|
}
|
|
3768
3744
|
if (storeFieldName === void 0) {
|
|
3769
|
-
storeFieldName =
|
|
3770
|
-
|
|
3771
|
-
|
|
3745
|
+
storeFieldName =
|
|
3746
|
+
fieldSpec.field ?
|
|
3747
|
+
storeKeyNameFromField(fieldSpec.field, fieldSpec.variables)
|
|
3748
|
+
: getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec));
|
|
3772
3749
|
}
|
|
3773
3750
|
if (storeFieldName === false) {
|
|
3774
3751
|
return fieldName;
|
|
3775
3752
|
}
|
|
3776
|
-
return fieldName === fieldNameFromStoreName(storeFieldName)
|
|
3777
|
-
? storeFieldName
|
|
3753
|
+
return fieldName === fieldNameFromStoreName(storeFieldName) ? storeFieldName
|
|
3778
3754
|
: fieldName + ":" + storeFieldName;
|
|
3779
3755
|
};
|
|
3780
3756
|
Policies.prototype.readField = function (options, context) {
|
|
@@ -3795,8 +3771,8 @@ var Policies = (function () {
|
|
|
3795
3771
|
var policy = this.getFieldPolicy(options.typename, fieldName, false);
|
|
3796
3772
|
var read = policy && policy.read;
|
|
3797
3773
|
if (read) {
|
|
3798
|
-
var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(isReference(objectOrReference)
|
|
3799
|
-
|
|
3774
|
+
var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(isReference(objectOrReference) ?
|
|
3775
|
+
objectOrReference.__ref
|
|
3800
3776
|
: objectOrReference, storeFieldName));
|
|
3801
3777
|
return cacheSlot.withValue(this.cache, read, [
|
|
3802
3778
|
existing,
|
|
@@ -3829,7 +3805,8 @@ var Policies = (function () {
|
|
|
3829
3805
|
if (context.overwrite) {
|
|
3830
3806
|
existing = void 0;
|
|
3831
3807
|
}
|
|
3832
|
-
return merge(existing, incoming, makeFieldFunctionOptions(this,
|
|
3808
|
+
return merge(existing, incoming, makeFieldFunctionOptions(this,
|
|
3809
|
+
void 0, {
|
|
3833
3810
|
typename: typename,
|
|
3834
3811
|
fieldName: field.name.value,
|
|
3835
3812
|
field: field,
|
|
@@ -3917,13 +3894,13 @@ function getContextFlavor(context, clientOnly, deferred) {
|
|
|
3917
3894
|
var flavored = context.flavors.get(key);
|
|
3918
3895
|
if (!flavored) {
|
|
3919
3896
|
context.flavors.set(key, (flavored =
|
|
3920
|
-
context.clientOnly === clientOnly && context.deferred === deferred
|
|
3921
|
-
|
|
3897
|
+
context.clientOnly === clientOnly && context.deferred === deferred ?
|
|
3898
|
+
context
|
|
3922
3899
|
: tslib.__assign(tslib.__assign({}, context), { clientOnly: clientOnly, deferred: deferred })));
|
|
3923
3900
|
}
|
|
3924
3901
|
return flavored;
|
|
3925
3902
|
}
|
|
3926
|
-
var StoreWriter =
|
|
3903
|
+
var StoreWriter = (function () {
|
|
3927
3904
|
function StoreWriter(cache, reader, fragments) {
|
|
3928
3905
|
this.cache = cache;
|
|
3929
3906
|
this.reader = reader;
|
|
@@ -3987,7 +3964,8 @@ var StoreWriter = (function () {
|
|
|
3987
3964
|
};
|
|
3988
3965
|
StoreWriter.prototype.processSelectionSet = function (_a) {
|
|
3989
3966
|
var _this = this;
|
|
3990
|
-
var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context,
|
|
3967
|
+
var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context,
|
|
3968
|
+
mergeTree = _a.mergeTree;
|
|
3991
3969
|
var policies = this.cache.policies;
|
|
3992
3970
|
var incoming = Object.create(null);
|
|
3993
3971
|
var typename = (dataId && policies.rootTypenamesById[dataId]) ||
|
|
@@ -4010,7 +3988,8 @@ var StoreWriter = (function () {
|
|
|
4010
3988
|
return policies.readField(options, context);
|
|
4011
3989
|
};
|
|
4012
3990
|
var fieldNodeSet = new Set();
|
|
4013
|
-
this.flattenFields(selectionSet, result,
|
|
3991
|
+
this.flattenFields(selectionSet, result,
|
|
3992
|
+
context, typename).forEach(function (context, field) {
|
|
4014
3993
|
var _a;
|
|
4015
3994
|
var resultFieldKey = resultKeyNameFromField(field);
|
|
4016
3995
|
var value = result[resultFieldKey];
|
|
@@ -4023,8 +4002,9 @@ var StoreWriter = (function () {
|
|
|
4023
4002
|
variables: context.variables,
|
|
4024
4003
|
});
|
|
4025
4004
|
var childTree = getChildMergeTree(mergeTree, storeFieldName);
|
|
4026
|
-
var incomingValue = _this.processFieldValue(value, field,
|
|
4027
|
-
|
|
4005
|
+
var incomingValue = _this.processFieldValue(value, field,
|
|
4006
|
+
field.selectionSet ?
|
|
4007
|
+
getContextFlavor(context, false, false)
|
|
4028
4008
|
: context, childTree);
|
|
4029
4009
|
var childTypename = void 0;
|
|
4030
4010
|
if (field.selectionSet &&
|
|
@@ -4123,7 +4103,8 @@ var StoreWriter = (function () {
|
|
|
4123
4103
|
var policies = this.cache.policies;
|
|
4124
4104
|
var limitingTrie = new trie.Trie(false);
|
|
4125
4105
|
(function flatten(selectionSet, inheritedContext) {
|
|
4126
|
-
var visitedNode = limitingTrie.lookup(selectionSet,
|
|
4106
|
+
var visitedNode = limitingTrie.lookup(selectionSet,
|
|
4107
|
+
inheritedContext.clientOnly, inheritedContext.deferred);
|
|
4127
4108
|
if (visitedNode.visited)
|
|
4128
4109
|
return;
|
|
4129
4110
|
visitedNode.visited = true;
|
|
@@ -4131,7 +4112,8 @@ var StoreWriter = (function () {
|
|
|
4131
4112
|
if (!shouldInclude(selection, context.variables))
|
|
4132
4113
|
return;
|
|
4133
4114
|
var clientOnly = inheritedContext.clientOnly, deferred = inheritedContext.deferred;
|
|
4134
|
-
if (
|
|
4115
|
+
if (
|
|
4116
|
+
!(clientOnly && deferred) &&
|
|
4135
4117
|
isNonEmptyArray(selection.directives)) {
|
|
4136
4118
|
selection.directives.forEach(function (dir) {
|
|
4137
4119
|
var name = dir.name.value;
|
|
@@ -4171,9 +4153,10 @@ var StoreWriter = (function () {
|
|
|
4171
4153
|
var _a;
|
|
4172
4154
|
var _this = this;
|
|
4173
4155
|
if (mergeTree.map.size && !isReference(incoming)) {
|
|
4174
|
-
var e_1 =
|
|
4175
|
-
|
|
4176
|
-
|
|
4156
|
+
var e_1 =
|
|
4157
|
+
(!isArray(incoming) &&
|
|
4158
|
+
(isReference(existing) || storeValueIsStoreObject(existing))) ?
|
|
4159
|
+
existing
|
|
4177
4160
|
: void 0;
|
|
4178
4161
|
var i_1 = incoming;
|
|
4179
4162
|
if (e_1 && !getStorageArgs) {
|
|
@@ -4181,11 +4164,11 @@ var StoreWriter = (function () {
|
|
|
4181
4164
|
}
|
|
4182
4165
|
var changedFields_1;
|
|
4183
4166
|
var getValue_1 = function (from, name) {
|
|
4184
|
-
return isArray(from)
|
|
4185
|
-
|
|
4186
|
-
|
|
4167
|
+
return (isArray(from) ?
|
|
4168
|
+
typeof name === "number" ?
|
|
4169
|
+
from[name]
|
|
4187
4170
|
: void 0
|
|
4188
|
-
: context.store.getFieldValue(from, String(name));
|
|
4171
|
+
: context.store.getFieldValue(from, String(name)));
|
|
4189
4172
|
};
|
|
4190
4173
|
mergeTree.map.forEach(function (childTree, storeFieldName) {
|
|
4191
4174
|
var eVal = getValue_1(e_1, storeFieldName);
|
|
@@ -4231,13 +4214,10 @@ function mergeMergeTrees(left, right) {
|
|
|
4231
4214
|
return left;
|
|
4232
4215
|
if (!left || mergeTreeIsEmpty(left))
|
|
4233
4216
|
return right;
|
|
4234
|
-
var info = left.info && right.info
|
|
4235
|
-
? tslib.__assign(tslib.__assign({}, left.info), right.info) : left.info || right.info;
|
|
4217
|
+
var info = left.info && right.info ? tslib.__assign(tslib.__assign({}, left.info), right.info) : left.info || right.info;
|
|
4236
4218
|
var needToMergeMaps = left.map.size && right.map.size;
|
|
4237
|
-
var map = needToMergeMaps
|
|
4238
|
-
?
|
|
4239
|
-
: left.map.size
|
|
4240
|
-
? left.map
|
|
4219
|
+
var map = needToMergeMaps ? new Map()
|
|
4220
|
+
: left.map.size ? left.map
|
|
4241
4221
|
: right.map;
|
|
4242
4222
|
var merged = { info: info, map: map };
|
|
4243
4223
|
if (needToMergeMaps) {
|
|
@@ -4298,14 +4278,14 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
4298
4278
|
}
|
|
4299
4279
|
});
|
|
4300
4280
|
}
|
|
4301
|
-
globalThis.__DEV__ !== false && invariant.warn(14, fieldName, parentType, childTypenames.length
|
|
4302
|
-
|
|
4281
|
+
globalThis.__DEV__ !== false && invariant.warn(14, fieldName, parentType, childTypenames.length ?
|
|
4282
|
+
"either ensure all objects of type " +
|
|
4303
4283
|
childTypenames.join(" and ") +
|
|
4304
4284
|
" have an ID or a custom merge function, or "
|
|
4305
4285
|
: "", typeDotName, existing, incoming);
|
|
4306
4286
|
}
|
|
4307
4287
|
|
|
4308
|
-
var InMemoryCache =
|
|
4288
|
+
var InMemoryCache = (function (_super) {
|
|
4309
4289
|
tslib.__extends(InMemoryCache, _super);
|
|
4310
4290
|
function InMemoryCache(config) {
|
|
4311
4291
|
if (config === void 0) { config = {}; }
|
|
@@ -4343,9 +4323,7 @@ var InMemoryCache = (function (_super) {
|
|
|
4343
4323
|
addTypename: this.addTypename,
|
|
4344
4324
|
resultCacheMaxSize: this.config.resultCacheMaxSize,
|
|
4345
4325
|
canonizeResults: shouldCanonizeResults(this.config),
|
|
4346
|
-
canon: resetResultIdentities
|
|
4347
|
-
? void 0
|
|
4348
|
-
: previousReader && previousReader.canon,
|
|
4326
|
+
canon: resetResultIdentities ? void 0 : (previousReader && previousReader.canon),
|
|
4349
4327
|
fragments: fragments,
|
|
4350
4328
|
})), fragments);
|
|
4351
4329
|
this.maybeBroadcastWatch = optimism.wrap(function (c, options) {
|
|
@@ -4356,7 +4334,8 @@ var InMemoryCache = (function (_super) {
|
|
|
4356
4334
|
var store = c.optimistic ? _this.optimisticData : _this.data;
|
|
4357
4335
|
if (supportsResultCaching(store)) {
|
|
4358
4336
|
var optimistic = c.optimistic, id = c.id, variables = c.variables;
|
|
4359
|
-
return store.makeCacheKey(c.query,
|
|
4337
|
+
return store.makeCacheKey(c.query,
|
|
4338
|
+
c.callback, canonicalStringify({ optimistic: optimistic, id: id, variables: variables }));
|
|
4360
4339
|
}
|
|
4361
4340
|
},
|
|
4362
4341
|
});
|
|
@@ -4375,7 +4354,9 @@ var InMemoryCache = (function (_super) {
|
|
|
4375
4354
|
return (optimistic ? this.optimisticData : this.data).extract();
|
|
4376
4355
|
};
|
|
4377
4356
|
InMemoryCache.prototype.read = function (options) {
|
|
4378
|
-
var
|
|
4357
|
+
var
|
|
4358
|
+
_a = options.returnPartialData,
|
|
4359
|
+
returnPartialData = _a === void 0 ? false : _a;
|
|
4379
4360
|
try {
|
|
4380
4361
|
return (this.storeReader.diffQueryAgainstStore(tslib.__assign(tslib.__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, config: this.config, returnPartialData: returnPartialData })).result || null);
|
|
4381
4362
|
}
|
|
@@ -4401,8 +4382,9 @@ var InMemoryCache = (function (_super) {
|
|
|
4401
4382
|
if (hasOwn.call(options, "id") && !options.id) {
|
|
4402
4383
|
return false;
|
|
4403
4384
|
}
|
|
4404
|
-
var store = options.optimistic
|
|
4405
|
-
|
|
4385
|
+
var store = ((options.optimistic)
|
|
4386
|
+
) ?
|
|
4387
|
+
this.optimisticData
|
|
4406
4388
|
: this.data;
|
|
4407
4389
|
try {
|
|
4408
4390
|
++this.txCount;
|
|
@@ -4669,7 +4651,8 @@ function equalBySelectionSet(selectionSet, aResult, bResult, context) {
|
|
|
4669
4651
|
if (fragment) {
|
|
4670
4652
|
if (selectionHasNonreactiveDirective(fragment))
|
|
4671
4653
|
return true;
|
|
4672
|
-
return equalBySelectionSet(fragment.selectionSet,
|
|
4654
|
+
return equalBySelectionSet(fragment.selectionSet,
|
|
4655
|
+
aResult, bResult, context);
|
|
4673
4656
|
}
|
|
4674
4657
|
}
|
|
4675
4658
|
});
|
|
@@ -4682,7 +4665,7 @@ function directiveIsNonreactive(dir) {
|
|
|
4682
4665
|
}
|
|
4683
4666
|
|
|
4684
4667
|
var assign = Object.assign, hasOwnProperty$2 = Object.hasOwnProperty;
|
|
4685
|
-
var ObservableQuery =
|
|
4668
|
+
var ObservableQuery = (function (_super) {
|
|
4686
4669
|
tslib.__extends(ObservableQuery, _super);
|
|
4687
4670
|
function ObservableQuery(_a) {
|
|
4688
4671
|
var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options;
|
|
@@ -4719,10 +4702,12 @@ var ObservableQuery = (function (_super) {
|
|
|
4719
4702
|
_this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy);
|
|
4720
4703
|
_this.isTornDown = false;
|
|
4721
4704
|
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), {
|
|
4705
|
+
var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e,
|
|
4706
|
+
_f = options.initialFetchPolicy,
|
|
4707
|
+
initialFetchPolicy = _f === void 0 ? fetchPolicy === "standby" ? defaultFetchPolicy : (fetchPolicy) : _f;
|
|
4708
|
+
_this.options = tslib.__assign(tslib.__assign({}, options), {
|
|
4709
|
+
initialFetchPolicy: initialFetchPolicy,
|
|
4710
|
+
fetchPolicy: fetchPolicy });
|
|
4726
4711
|
_this.queryId = queryInfo.queryId || queryManager.generateQueryId();
|
|
4727
4712
|
var opDef = getOperationDefinition(_this.query);
|
|
4728
4713
|
_this.queryName = opDef && opDef.name && opDef.name.value;
|
|
@@ -4769,7 +4754,8 @@ var ObservableQuery = (function (_super) {
|
|
|
4769
4754
|
exports.NetworkStatus.ready;
|
|
4770
4755
|
var result = tslib.__assign(tslib.__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus });
|
|
4771
4756
|
var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a;
|
|
4772
|
-
if (
|
|
4757
|
+
if (
|
|
4758
|
+
skipCacheDataFor(fetchPolicy) ||
|
|
4773
4759
|
this.queryManager.getDocumentInfo(this.query).hasForcedResolvers) ;
|
|
4774
4760
|
else if (this.waitForOwnResult) {
|
|
4775
4761
|
this.queryInfo["updateWatch"]();
|
|
@@ -4812,9 +4798,8 @@ var ObservableQuery = (function (_super) {
|
|
|
4812
4798
|
if (!this.last) {
|
|
4813
4799
|
return true;
|
|
4814
4800
|
}
|
|
4815
|
-
var resultIsDifferent = this.queryManager.getDocumentInfo(this.query)
|
|
4816
|
-
.
|
|
4817
|
-
? !equalByQuery(this.query, this.last.result, newResult, this.variables)
|
|
4801
|
+
var resultIsDifferent = this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective ?
|
|
4802
|
+
!equalByQuery(this.query, this.last.result, newResult, this.variables)
|
|
4818
4803
|
: !equal.equal(this.last.result, newResult);
|
|
4819
4804
|
return (resultIsDifferent || (variables && !equal.equal(this.last.variables, variables)));
|
|
4820
4805
|
};
|
|
@@ -4873,14 +4858,14 @@ var ObservableQuery = (function (_super) {
|
|
|
4873
4858
|
};
|
|
4874
4859
|
ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) {
|
|
4875
4860
|
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" });
|
|
4861
|
+
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) })))), {
|
|
4862
|
+
fetchPolicy: "no-cache" });
|
|
4879
4863
|
combinedOptions.query = this.transformDocument(combinedOptions.query);
|
|
4880
4864
|
var qid = this.queryManager.generateQueryId();
|
|
4881
|
-
this.lastQuery =
|
|
4882
|
-
|
|
4883
|
-
|
|
4865
|
+
this.lastQuery =
|
|
4866
|
+
fetchMoreOptions.query ?
|
|
4867
|
+
this.transformDocument(this.options.query)
|
|
4868
|
+
: combinedOptions.query;
|
|
4884
4869
|
var queryInfo = this.queryInfo;
|
|
4885
4870
|
var originalNetworkStatus = queryInfo.networkStatus;
|
|
4886
4871
|
queryInfo.networkStatus = exports.NetworkStatus.fetchMore;
|
|
@@ -5015,7 +5000,8 @@ var ObservableQuery = (function (_super) {
|
|
|
5015
5000
|
this.options.pollInterval = 0;
|
|
5016
5001
|
this.updatePolling();
|
|
5017
5002
|
};
|
|
5018
|
-
ObservableQuery.prototype.applyNextFetchPolicy = function (reason,
|
|
5003
|
+
ObservableQuery.prototype.applyNextFetchPolicy = function (reason,
|
|
5004
|
+
options) {
|
|
5019
5005
|
if (options.nextFetchPolicy) {
|
|
5020
5006
|
var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a, _b = options.initialFetchPolicy, initialFetchPolicy = _b === void 0 ? fetchPolicy : _b;
|
|
5021
5007
|
if (fetchPolicy === "standby") ;
|
|
@@ -5063,8 +5049,8 @@ var ObservableQuery = (function (_super) {
|
|
|
5063
5049
|
if (_this.pollingInfo) {
|
|
5064
5050
|
if (!isNetworkRequestInFlight(_this.queryInfo.networkStatus)) {
|
|
5065
5051
|
_this.reobserve({
|
|
5066
|
-
fetchPolicy: _this.options.initialFetchPolicy === "no-cache"
|
|
5067
|
-
|
|
5052
|
+
fetchPolicy: _this.options.initialFetchPolicy === "no-cache" ?
|
|
5053
|
+
"no-cache"
|
|
5068
5054
|
: "network-only",
|
|
5069
5055
|
}, exports.NetworkStatus.poll).then(poll, poll);
|
|
5070
5056
|
}
|
|
@@ -5088,22 +5074,22 @@ var ObservableQuery = (function (_super) {
|
|
|
5088
5074
|
if (error && this.last && !equal.equal(variables, this.last.variables)) {
|
|
5089
5075
|
error = void 0;
|
|
5090
5076
|
}
|
|
5091
|
-
return (this.last = tslib.__assign({ result: this.queryManager.assumeImmutableResults
|
|
5092
|
-
|
|
5077
|
+
return (this.last = tslib.__assign({ result: this.queryManager.assumeImmutableResults ?
|
|
5078
|
+
newResult
|
|
5093
5079
|
: cloneDeep(newResult), variables: variables }, (error ? { error: error } : null)));
|
|
5094
5080
|
};
|
|
5095
5081
|
ObservableQuery.prototype.reobserveAsConcast = function (newOptions, newNetworkStatus) {
|
|
5096
5082
|
var _this = this;
|
|
5097
5083
|
this.isTornDown = false;
|
|
5098
|
-
var useDisposableConcast =
|
|
5084
|
+
var useDisposableConcast =
|
|
5085
|
+
newNetworkStatus === exports.NetworkStatus.refetch ||
|
|
5099
5086
|
newNetworkStatus === exports.NetworkStatus.fetchMore ||
|
|
5100
5087
|
newNetworkStatus === exports.NetworkStatus.poll;
|
|
5101
5088
|
var oldVariables = this.options.variables;
|
|
5102
5089
|
var oldFetchPolicy = this.options.fetchPolicy;
|
|
5103
5090
|
var mergedOptions = compact(this.options, newOptions || {});
|
|
5104
|
-
var options = useDisposableConcast
|
|
5105
|
-
|
|
5106
|
-
mergedOptions
|
|
5091
|
+
var options = useDisposableConcast ?
|
|
5092
|
+
mergedOptions
|
|
5107
5093
|
: assign(this.options, mergedOptions);
|
|
5108
5094
|
var query = this.transformDocument(options.query);
|
|
5109
5095
|
this.lastQuery = query;
|
|
@@ -5149,7 +5135,8 @@ var ObservableQuery = (function (_super) {
|
|
|
5149
5135
|
return concast;
|
|
5150
5136
|
};
|
|
5151
5137
|
ObservableQuery.prototype.reobserve = function (newOptions, newNetworkStatus) {
|
|
5152
|
-
return this.reobserveAsConcast(newOptions, newNetworkStatus)
|
|
5138
|
+
return this.reobserveAsConcast(newOptions, newNetworkStatus)
|
|
5139
|
+
.promise;
|
|
5153
5140
|
};
|
|
5154
5141
|
ObservableQuery.prototype.resubscribeAfterError = function () {
|
|
5155
5142
|
var args = [];
|
|
@@ -5163,7 +5150,8 @@ var ObservableQuery = (function (_super) {
|
|
|
5163
5150
|
return subscription;
|
|
5164
5151
|
};
|
|
5165
5152
|
ObservableQuery.prototype.observe = function () {
|
|
5166
|
-
this.reportResult(
|
|
5153
|
+
this.reportResult(
|
|
5154
|
+
this.getCurrentResult(false), this.variables);
|
|
5167
5155
|
};
|
|
5168
5156
|
ObservableQuery.prototype.reportResult = function (result, variables) {
|
|
5169
5157
|
var lastError = this.getLastError();
|
|
@@ -5209,10 +5197,10 @@ function reobserveCacheFirst(obsQuery) {
|
|
|
5209
5197
|
if (fetchPolicy === "cache-and-network" || fetchPolicy === "network-only") {
|
|
5210
5198
|
return obsQuery.reobserve({
|
|
5211
5199
|
fetchPolicy: "cache-first",
|
|
5212
|
-
nextFetchPolicy: function () {
|
|
5200
|
+
nextFetchPolicy: function (currentFetchPolicy, context) {
|
|
5213
5201
|
this.nextFetchPolicy = nextFetchPolicy;
|
|
5214
|
-
if (typeof nextFetchPolicy === "function") {
|
|
5215
|
-
return nextFetchPolicy
|
|
5202
|
+
if (typeof this.nextFetchPolicy === "function") {
|
|
5203
|
+
return this.nextFetchPolicy(currentFetchPolicy, context);
|
|
5216
5204
|
}
|
|
5217
5205
|
return fetchPolicy;
|
|
5218
5206
|
},
|
|
@@ -5228,13 +5216,13 @@ function logMissingFieldErrors(missing) {
|
|
|
5228
5216
|
globalThis.__DEV__ !== false && invariant.debug(24, missing);
|
|
5229
5217
|
}
|
|
5230
5218
|
}
|
|
5231
|
-
function skipCacheDataFor(fetchPolicy) {
|
|
5219
|
+
function skipCacheDataFor(fetchPolicy ) {
|
|
5232
5220
|
return (fetchPolicy === "network-only" ||
|
|
5233
5221
|
fetchPolicy === "no-cache" ||
|
|
5234
5222
|
fetchPolicy === "standby");
|
|
5235
5223
|
}
|
|
5236
5224
|
|
|
5237
|
-
var LocalState =
|
|
5225
|
+
var LocalState = (function () {
|
|
5238
5226
|
function LocalState(_a) {
|
|
5239
5227
|
var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher;
|
|
5240
5228
|
this.selectionsToResolveCache = new WeakMap();
|
|
@@ -5273,9 +5261,9 @@ var LocalState = (function () {
|
|
|
5273
5261
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
5274
5262
|
return tslib.__generator(this, function (_c) {
|
|
5275
5263
|
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 })); })];
|
|
5264
|
+
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
5265
|
}
|
|
5278
|
-
return [2, remoteResult];
|
|
5266
|
+
return [2 , remoteResult];
|
|
5279
5267
|
});
|
|
5280
5268
|
});
|
|
5281
5269
|
};
|
|
@@ -5298,7 +5286,8 @@ var LocalState = (function () {
|
|
|
5298
5286
|
};
|
|
5299
5287
|
LocalState.prototype.prepareContext = function (context) {
|
|
5300
5288
|
var cache = this.cache;
|
|
5301
|
-
return tslib.__assign(tslib.__assign({}, context), { cache: cache,
|
|
5289
|
+
return tslib.__assign(tslib.__assign({}, context), { cache: cache,
|
|
5290
|
+
getCacheKey: function (obj) {
|
|
5302
5291
|
return cache.identify(obj);
|
|
5303
5292
|
} });
|
|
5304
5293
|
};
|
|
@@ -5308,9 +5297,9 @@ var LocalState = (function () {
|
|
|
5308
5297
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
5309
5298
|
return tslib.__generator(this, function (_a) {
|
|
5310
5299
|
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)); })];
|
|
5300
|
+
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
5301
|
}
|
|
5313
|
-
return [2, tslib.__assign({}, variables)];
|
|
5302
|
+
return [2 , tslib.__assign({}, variables)];
|
|
5314
5303
|
});
|
|
5315
5304
|
});
|
|
5316
5305
|
};
|
|
@@ -5355,8 +5344,8 @@ var LocalState = (function () {
|
|
|
5355
5344
|
fragmentMap = createFragmentMap(fragments);
|
|
5356
5345
|
selectionsToResolve = this.collectSelectionsToResolve(mainDefinition, fragmentMap);
|
|
5357
5346
|
definitionOperation = mainDefinition.operation;
|
|
5358
|
-
defaultOperationType = definitionOperation
|
|
5359
|
-
|
|
5347
|
+
defaultOperationType = definitionOperation ?
|
|
5348
|
+
definitionOperation.charAt(0).toUpperCase() +
|
|
5360
5349
|
definitionOperation.slice(1)
|
|
5361
5350
|
: "Query";
|
|
5362
5351
|
_a = this, cache = _a.cache, client = _a.client;
|
|
@@ -5371,7 +5360,7 @@ var LocalState = (function () {
|
|
|
5371
5360
|
onlyRunForcedResolvers: onlyRunForcedResolvers,
|
|
5372
5361
|
};
|
|
5373
5362
|
isClientFieldDescendant = false;
|
|
5374
|
-
return [2, this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({
|
|
5363
|
+
return [2 , this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({
|
|
5375
5364
|
result: result,
|
|
5376
5365
|
exportedVariables: execContext.exportedVariables,
|
|
5377
5366
|
}); })];
|
|
@@ -5390,13 +5379,13 @@ var LocalState = (function () {
|
|
|
5390
5379
|
return tslib.__generator(this, function (_a) {
|
|
5391
5380
|
if (!isClientFieldDescendant &&
|
|
5392
5381
|
!execContext.selectionsToResolve.has(selection)) {
|
|
5393
|
-
return [2];
|
|
5382
|
+
return [2 ];
|
|
5394
5383
|
}
|
|
5395
5384
|
if (!shouldInclude(selection, variables)) {
|
|
5396
|
-
return [2];
|
|
5385
|
+
return [2 ];
|
|
5397
5386
|
}
|
|
5398
5387
|
if (isField(selection)) {
|
|
5399
|
-
return [2, this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) {
|
|
5388
|
+
return [2 , this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) {
|
|
5400
5389
|
var _a;
|
|
5401
5390
|
if (typeof fieldResult !== "undefined") {
|
|
5402
5391
|
resultsToMerge.push((_a = {},
|
|
@@ -5415,15 +5404,15 @@ var LocalState = (function () {
|
|
|
5415
5404
|
if (fragment && fragment.typeCondition) {
|
|
5416
5405
|
typeCondition = fragment.typeCondition.name.value;
|
|
5417
5406
|
if (execContext.fragmentMatcher(rootValue, typeCondition, context)) {
|
|
5418
|
-
return [2, this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) {
|
|
5407
|
+
return [2 , this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) {
|
|
5419
5408
|
resultsToMerge.push(fragmentResult);
|
|
5420
5409
|
})];
|
|
5421
5410
|
}
|
|
5422
5411
|
}
|
|
5423
|
-
return [2];
|
|
5412
|
+
return [2 ];
|
|
5424
5413
|
});
|
|
5425
5414
|
}); };
|
|
5426
|
-
return [2, Promise.all(selectionSet.selections.map(execute)).then(function () {
|
|
5415
|
+
return [2 , Promise.all(selectionSet.selections.map(execute)).then(function () {
|
|
5427
5416
|
return mergeDeepArray(resultsToMerge);
|
|
5428
5417
|
})];
|
|
5429
5418
|
});
|
|
@@ -5435,7 +5424,7 @@ var LocalState = (function () {
|
|
|
5435
5424
|
var _this = this;
|
|
5436
5425
|
return tslib.__generator(this, function (_a) {
|
|
5437
5426
|
if (!rootValue) {
|
|
5438
|
-
return [2, null];
|
|
5427
|
+
return [2 , null];
|
|
5439
5428
|
}
|
|
5440
5429
|
variables = execContext.variables;
|
|
5441
5430
|
fieldName = field.name.value;
|
|
@@ -5450,7 +5439,8 @@ var LocalState = (function () {
|
|
|
5450
5439
|
if (resolverMap) {
|
|
5451
5440
|
resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName];
|
|
5452
5441
|
if (resolve) {
|
|
5453
|
-
resultPromise = Promise.resolve(
|
|
5442
|
+
resultPromise = Promise.resolve(
|
|
5443
|
+
cacheSlot.withValue(this.cache, resolve, [
|
|
5454
5444
|
rootValue,
|
|
5455
5445
|
argumentsObjectFromField(field, variables),
|
|
5456
5446
|
execContext.context,
|
|
@@ -5459,7 +5449,7 @@ var LocalState = (function () {
|
|
|
5459
5449
|
}
|
|
5460
5450
|
}
|
|
5461
5451
|
}
|
|
5462
|
-
return [2, resultPromise.then(function (result) {
|
|
5452
|
+
return [2 , resultPromise.then(function (result) {
|
|
5463
5453
|
var _a, _b;
|
|
5464
5454
|
if (result === void 0) { result = defaultResult; }
|
|
5465
5455
|
if (field.directives) {
|
|
@@ -5551,7 +5541,8 @@ function wrapDestructiveCacheMethod(cache, methodName) {
|
|
|
5551
5541
|
var original = cache[methodName];
|
|
5552
5542
|
if (typeof original === "function") {
|
|
5553
5543
|
cache[methodName] = function () {
|
|
5554
|
-
destructiveMethodCounts.set(cache,
|
|
5544
|
+
destructiveMethodCounts.set(cache,
|
|
5545
|
+
(destructiveMethodCounts.get(cache) + 1) % 1e15);
|
|
5555
5546
|
return original.apply(this, arguments);
|
|
5556
5547
|
};
|
|
5557
5548
|
}
|
|
@@ -5562,7 +5553,7 @@ function cancelNotifyTimeout(info) {
|
|
|
5562
5553
|
info["notifyTimeout"] = void 0;
|
|
5563
5554
|
}
|
|
5564
5555
|
}
|
|
5565
|
-
var QueryInfo =
|
|
5556
|
+
var QueryInfo = (function () {
|
|
5566
5557
|
function QueryInfo(queryManager, queryId) {
|
|
5567
5558
|
if (queryId === void 0) { queryId = queryManager.generateQueryId(); }
|
|
5568
5559
|
this.queryId = queryId;
|
|
@@ -5624,12 +5615,13 @@ var QueryInfo = (function () {
|
|
|
5624
5615
|
return diff;
|
|
5625
5616
|
};
|
|
5626
5617
|
QueryInfo.prototype.updateLastDiff = function (diff, options) {
|
|
5627
|
-
this.lastDiff =
|
|
5628
|
-
?
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5618
|
+
this.lastDiff =
|
|
5619
|
+
diff ?
|
|
5620
|
+
{
|
|
5621
|
+
diff: diff,
|
|
5622
|
+
options: options || this.getDiffOptions(),
|
|
5623
|
+
}
|
|
5624
|
+
: void 0;
|
|
5633
5625
|
};
|
|
5634
5626
|
QueryInfo.prototype.getDiffOptions = function (variables) {
|
|
5635
5627
|
var _a;
|
|
@@ -5735,9 +5727,7 @@ var QueryInfo = (function () {
|
|
|
5735
5727
|
QueryInfo.prototype.markResult = function (result, document, options, cacheWriteBehavior) {
|
|
5736
5728
|
var _this = this;
|
|
5737
5729
|
var merger = new DeepMerger();
|
|
5738
|
-
var graphQLErrors = isNonEmptyArray(result.errors)
|
|
5739
|
-
? result.errors.slice(0)
|
|
5740
|
-
: [];
|
|
5730
|
+
var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];
|
|
5741
5731
|
this.reset();
|
|
5742
5732
|
if ("incremental" in result && isNonEmptyArray(result.incremental)) {
|
|
5743
5733
|
var mergedData = mergeIncrementalData(this.getDiff().result, result);
|
|
@@ -5751,7 +5741,7 @@ var QueryInfo = (function () {
|
|
|
5751
5741
|
if (options.fetchPolicy === "no-cache") {
|
|
5752
5742
|
this.updateLastDiff({ result: result.data, complete: true }, this.getDiffOptions(options.variables));
|
|
5753
5743
|
}
|
|
5754
|
-
else if (cacheWriteBehavior !== 0) {
|
|
5744
|
+
else if (cacheWriteBehavior !== 0 ) {
|
|
5755
5745
|
if (shouldWriteResult(result, options.errorPolicy)) {
|
|
5756
5746
|
this.cache.performTransaction(function (cache) {
|
|
5757
5747
|
if (_this.shouldWrite(result, options.variables)) {
|
|
@@ -5759,7 +5749,7 @@ var QueryInfo = (function () {
|
|
|
5759
5749
|
query: document,
|
|
5760
5750
|
data: result.data,
|
|
5761
5751
|
variables: options.variables,
|
|
5762
|
-
overwrite: cacheWriteBehavior === 1,
|
|
5752
|
+
overwrite: cacheWriteBehavior === 1 ,
|
|
5763
5753
|
});
|
|
5764
5754
|
_this.lastWrite = {
|
|
5765
5755
|
result: result,
|
|
@@ -5818,10 +5808,10 @@ function shouldWriteResult(result, errorPolicy) {
|
|
|
5818
5808
|
}
|
|
5819
5809
|
|
|
5820
5810
|
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
5821
|
-
var QueryManager =
|
|
5811
|
+
var QueryManager = (function () {
|
|
5822
5812
|
function QueryManager(_a) {
|
|
5823
|
-
var _this = this;
|
|
5824
5813
|
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;
|
|
5814
|
+
var _this = this;
|
|
5825
5815
|
this.clientAwareness = {};
|
|
5826
5816
|
this.queries = new Map();
|
|
5827
5817
|
this.fetchCancelFns = new Map();
|
|
@@ -5830,7 +5820,8 @@ var QueryManager = (function () {
|
|
|
5830
5820
|
this.requestIdCounter = 1;
|
|
5831
5821
|
this.mutationIdCounter = 1;
|
|
5832
5822
|
this.inFlightLinkObservables = new Map();
|
|
5833
|
-
var defaultDocumentTransform = new DocumentTransform(function (document) { return _this.cache.transformDocument(document); },
|
|
5823
|
+
var defaultDocumentTransform = new DocumentTransform(function (document) { return _this.cache.transformDocument(document); },
|
|
5824
|
+
{ cache: false });
|
|
5834
5825
|
this.cache = cache;
|
|
5835
5826
|
this.link = link;
|
|
5836
5827
|
this.defaultOptions = defaultOptions || Object.create(null);
|
|
@@ -5839,11 +5830,12 @@ var QueryManager = (function () {
|
|
|
5839
5830
|
this.localState = localState || new LocalState({ cache: cache });
|
|
5840
5831
|
this.ssrMode = ssrMode;
|
|
5841
5832
|
this.assumeImmutableResults = assumeImmutableResults;
|
|
5842
|
-
this.documentTransform =
|
|
5843
|
-
?
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5833
|
+
this.documentTransform =
|
|
5834
|
+
documentTransform ?
|
|
5835
|
+
defaultDocumentTransform
|
|
5836
|
+
.concat(documentTransform)
|
|
5837
|
+
.concat(defaultDocumentTransform)
|
|
5838
|
+
: defaultDocumentTransform;
|
|
5847
5839
|
if ((this.onBroadcast = onBroadcast)) {
|
|
5848
5840
|
this.mutationStore = Object.create(null);
|
|
5849
5841
|
}
|
|
@@ -5873,8 +5865,8 @@ var QueryManager = (function () {
|
|
|
5873
5865
|
mutation = this.cache.transformForLink(this.transform(mutation));
|
|
5874
5866
|
hasClientExports = this.getDocumentInfo(mutation).hasClientExports;
|
|
5875
5867
|
variables = this.getVariables(mutation, variables);
|
|
5876
|
-
if (!hasClientExports) return [3, 2];
|
|
5877
|
-
return [4, this.localState.addExportedVariables(mutation, variables, context)];
|
|
5868
|
+
if (!hasClientExports) return [3 , 2];
|
|
5869
|
+
return [4 , this.localState.addExportedVariables(mutation, variables, context)];
|
|
5878
5870
|
case 1:
|
|
5879
5871
|
variables = (_h.sent());
|
|
5880
5872
|
_h.label = 2;
|
|
@@ -5901,7 +5893,7 @@ var QueryManager = (function () {
|
|
|
5901
5893
|
}
|
|
5902
5894
|
this.broadcastQueries();
|
|
5903
5895
|
self = this;
|
|
5904
|
-
return [2, new Promise(function (resolve, reject) {
|
|
5896
|
+
return [2 , new Promise(function (resolve, reject) {
|
|
5905
5897
|
return asyncMap(self.getObservableFromLink(mutation, tslib.__assign(tslib.__assign({}, context), { optimisticResponse: optimisticResponse }), variables, false), function (result) {
|
|
5906
5898
|
if (graphQLResultHasError(result) && errorPolicy === "none") {
|
|
5907
5899
|
throw new ApolloError({
|
|
@@ -5951,11 +5943,9 @@ var QueryManager = (function () {
|
|
|
5951
5943
|
self.cache.removeOptimistic(mutationId);
|
|
5952
5944
|
}
|
|
5953
5945
|
self.broadcastQueries();
|
|
5954
|
-
reject(err instanceof ApolloError
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
networkError: err,
|
|
5958
|
-
}));
|
|
5946
|
+
reject(err instanceof ApolloError ? err : (new ApolloError({
|
|
5947
|
+
networkError: err,
|
|
5948
|
+
})));
|
|
5959
5949
|
},
|
|
5960
5950
|
});
|
|
5961
5951
|
})];
|
|
@@ -6098,8 +6088,8 @@ var QueryManager = (function () {
|
|
|
6098
6088
|
};
|
|
6099
6089
|
QueryManager.prototype.markMutationOptimistic = function (optimisticResponse, mutation) {
|
|
6100
6090
|
var _this = this;
|
|
6101
|
-
var data = typeof optimisticResponse === "function"
|
|
6102
|
-
|
|
6091
|
+
var data = typeof optimisticResponse === "function" ?
|
|
6092
|
+
optimisticResponse(mutation.variables)
|
|
6103
6093
|
: optimisticResponse;
|
|
6104
6094
|
return this.cache.recordOptimisticTransaction(function (cache) {
|
|
6105
6095
|
try {
|
|
@@ -6391,7 +6381,8 @@ var QueryManager = (function () {
|
|
|
6391
6381
|
QueryManager.prototype.getLocalState = function () {
|
|
6392
6382
|
return this.localState;
|
|
6393
6383
|
};
|
|
6394
|
-
QueryManager.prototype.getObservableFromLink = function (query, context, variables,
|
|
6384
|
+
QueryManager.prototype.getObservableFromLink = function (query, context, variables,
|
|
6385
|
+
deduplication) {
|
|
6395
6386
|
var _this = this;
|
|
6396
6387
|
var _a;
|
|
6397
6388
|
if (deduplication === void 0) { deduplication = (_a = context === null || context === void 0 ? void 0 : context.queryDeduplication) !== null && _a !== void 0 ? _a : this.queryDeduplication; }
|
|
@@ -6472,16 +6463,15 @@ var QueryManager = (function () {
|
|
|
6472
6463
|
}
|
|
6473
6464
|
return aqr;
|
|
6474
6465
|
}, function (networkError) {
|
|
6475
|
-
var error = isApolloError(networkError)
|
|
6476
|
-
? networkError
|
|
6477
|
-
: new ApolloError({ networkError: networkError });
|
|
6466
|
+
var error = isApolloError(networkError) ? networkError : (new ApolloError({ networkError: networkError }));
|
|
6478
6467
|
if (requestId >= queryInfo.lastRequestId) {
|
|
6479
6468
|
queryInfo.markError(error);
|
|
6480
6469
|
}
|
|
6481
6470
|
throw error;
|
|
6482
6471
|
});
|
|
6483
6472
|
};
|
|
6484
|
-
QueryManager.prototype.fetchConcastWithInfo = function (queryId, options,
|
|
6473
|
+
QueryManager.prototype.fetchConcastWithInfo = function (queryId, options,
|
|
6474
|
+
networkStatus, query) {
|
|
6485
6475
|
var _this = this;
|
|
6486
6476
|
if (networkStatus === void 0) { networkStatus = exports.NetworkStatus.loading; }
|
|
6487
6477
|
if (query === void 0) { query = options.query; }
|
|
@@ -6501,7 +6491,8 @@ var QueryManager = (function () {
|
|
|
6501
6491
|
var fromVariables = function (variables) {
|
|
6502
6492
|
normalized.variables = variables;
|
|
6503
6493
|
var sourcesWithInfo = _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus);
|
|
6504
|
-
if (
|
|
6494
|
+
if (
|
|
6495
|
+
normalized.fetchPolicy !== "standby" &&
|
|
6505
6496
|
sourcesWithInfo.sources.length > 0 &&
|
|
6506
6497
|
queryInfo.observableQuery) {
|
|
6507
6498
|
queryInfo.observableQuery["applyNextFetchPolicy"]("after-fetch", options);
|
|
@@ -6599,7 +6590,8 @@ var QueryManager = (function () {
|
|
|
6599
6590
|
}
|
|
6600
6591
|
return results;
|
|
6601
6592
|
};
|
|
6602
|
-
QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a,
|
|
6593
|
+
QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a,
|
|
6594
|
+
networkStatus) {
|
|
6603
6595
|
var _this = this;
|
|
6604
6596
|
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
6597
|
var oldNetworkStatus = queryInfo.networkStatus;
|
|
@@ -6636,13 +6628,11 @@ var QueryManager = (function () {
|
|
|
6636
6628
|
}
|
|
6637
6629
|
return fromData(data);
|
|
6638
6630
|
};
|
|
6639
|
-
var cacheWriteBehavior = fetchPolicy === "no-cache"
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
? 1
|
|
6645
|
-
: 2;
|
|
6631
|
+
var cacheWriteBehavior = fetchPolicy === "no-cache" ? 0
|
|
6632
|
+
: (networkStatus === exports.NetworkStatus.refetch &&
|
|
6633
|
+
refetchWritePolicy !== "merge") ?
|
|
6634
|
+
1
|
|
6635
|
+
: 2 ;
|
|
6646
6636
|
var resultsFromLink = function () {
|
|
6647
6637
|
return _this.getResultsFromLink(queryInfo, cacheWriteBehavior, {
|
|
6648
6638
|
query: query,
|
|
@@ -6724,7 +6714,7 @@ var QueryManager = (function () {
|
|
|
6724
6714
|
}());
|
|
6725
6715
|
|
|
6726
6716
|
var hasSuggestedDevtools = false;
|
|
6727
|
-
var ApolloClient =
|
|
6717
|
+
var ApolloClient = (function () {
|
|
6728
6718
|
function ApolloClient(options) {
|
|
6729
6719
|
var _this = this;
|
|
6730
6720
|
this.resetStoreCallbacks = [];
|
|
@@ -6732,14 +6722,15 @@ var ApolloClient = (function () {
|
|
|
6732
6722
|
if (!options.cache) {
|
|
6733
6723
|
throw newInvariantError(15);
|
|
6734
6724
|
}
|
|
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,
|
|
6725
|
+
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,
|
|
6726
|
+
_c = options.connectToDevTools,
|
|
6727
|
+
connectToDevTools = _c === void 0 ? typeof window === "object" &&
|
|
6736
6728
|
!window.__APOLLO_CLIENT__ &&
|
|
6737
6729
|
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
6730
|
var link = options.link;
|
|
6739
6731
|
if (!link) {
|
|
6740
|
-
link =
|
|
6741
|
-
? new HttpLink({ uri: uri, credentials: credentials, headers: headers })
|
|
6742
|
-
: ApolloLink.empty();
|
|
6732
|
+
link =
|
|
6733
|
+
uri ? new HttpLink({ uri: uri, credentials: credentials, headers: headers }) : ApolloLink.empty();
|
|
6743
6734
|
}
|
|
6744
6735
|
this.link = link;
|
|
6745
6736
|
this.cache = cache;
|
|
@@ -6775,8 +6766,8 @@ var ApolloClient = (function () {
|
|
|
6775
6766
|
},
|
|
6776
6767
|
localState: this.localState,
|
|
6777
6768
|
assumeImmutableResults: assumeImmutableResults,
|
|
6778
|
-
onBroadcast: connectToDevTools
|
|
6779
|
-
|
|
6769
|
+
onBroadcast: connectToDevTools ?
|
|
6770
|
+
function () {
|
|
6780
6771
|
if (_this.devToolsHookCb) {
|
|
6781
6772
|
_this.devToolsHookCb({
|
|
6782
6773
|
action: {},
|
|
@@ -6980,9 +6971,7 @@ var ApolloClient = (function () {
|
|
|
6980
6971
|
return ApolloClient;
|
|
6981
6972
|
}());
|
|
6982
6973
|
|
|
6983
|
-
var contextKey = canUseSymbol
|
|
6984
|
-
? Symbol.for("__APOLLO_CONTEXT__")
|
|
6985
|
-
: "__APOLLO_CONTEXT__";
|
|
6974
|
+
var contextKey = canUseSymbol ? Symbol.for("__APOLLO_CONTEXT__") : "__APOLLO_CONTEXT__";
|
|
6986
6975
|
function getApolloContext() {
|
|
6987
6976
|
invariant("createContext" in React__namespace, 45);
|
|
6988
6977
|
var context = React__namespace.createContext[contextKey];
|
|
@@ -7031,7 +7020,8 @@ var realHook$1 = React__namespace[uSESKey];
|
|
|
7031
7020
|
var useSyncExternalStore = realHook$1 ||
|
|
7032
7021
|
(function (subscribe, getSnapshot, getServerSnapshot) {
|
|
7033
7022
|
var value = getSnapshot();
|
|
7034
|
-
if (
|
|
7023
|
+
if (
|
|
7024
|
+
globalThis.__DEV__ !== false &&
|
|
7035
7025
|
!didWarnUncachedGetSnapshot &&
|
|
7036
7026
|
value !== getSnapshot()) {
|
|
7037
7027
|
didWarnUncachedGetSnapshot = true;
|
|
@@ -7140,10 +7130,8 @@ function parser(document) {
|
|
|
7140
7130
|
type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation;
|
|
7141
7131
|
if (!queries.length && !mutations.length)
|
|
7142
7132
|
type = exports.DocumentType.Subscription;
|
|
7143
|
-
var definitions = queries.length
|
|
7144
|
-
?
|
|
7145
|
-
: mutations.length
|
|
7146
|
-
? mutations
|
|
7133
|
+
var definitions = queries.length ? queries
|
|
7134
|
+
: mutations.length ? mutations
|
|
7147
7135
|
: subscriptions;
|
|
7148
7136
|
invariant(definitions.length === 1, 62, document, definitions.length);
|
|
7149
7137
|
var definition = definitions[0];
|
|
@@ -7187,7 +7175,7 @@ function useInternalState(client, query) {
|
|
|
7187
7175
|
state.forceUpdateState = React__namespace.useReducer(function (tick) { return tick + 1; }, 0)[1];
|
|
7188
7176
|
return state;
|
|
7189
7177
|
}
|
|
7190
|
-
var InternalState =
|
|
7178
|
+
var InternalState = (function () {
|
|
7191
7179
|
function InternalState(client, query, previous) {
|
|
7192
7180
|
var _this = this;
|
|
7193
7181
|
this.client = client;
|
|
@@ -7337,7 +7325,8 @@ var InternalState = (function () {
|
|
|
7337
7325
|
InternalState.prototype.createWatchQueryOptions = function (_a) {
|
|
7338
7326
|
var _b;
|
|
7339
7327
|
if (_a === void 0) { _a = {}; }
|
|
7340
|
-
var skip = _a.skip; _a.ssr; _a.onCompleted; _a.onError; _a.defaultOptions;
|
|
7328
|
+
var skip = _a.skip; _a.ssr; _a.onCompleted; _a.onError; _a.defaultOptions;
|
|
7329
|
+
var otherOptions = tslib.__rest(_a, ["skip", "ssr", "onCompleted", "onError", "defaultOptions"]);
|
|
7341
7330
|
var watchQueryOptions = Object.assign(otherOptions, { query: this.query });
|
|
7342
7331
|
if (this.renderPromises &&
|
|
7343
7332
|
(watchQueryOptions.fetchPolicy === "network-only" ||
|
|
@@ -7423,8 +7412,8 @@ var InternalState = (function () {
|
|
|
7423
7412
|
}
|
|
7424
7413
|
};
|
|
7425
7414
|
InternalState.prototype.toApolloError = function (result) {
|
|
7426
|
-
return isNonEmptyArray(result.errors)
|
|
7427
|
-
|
|
7415
|
+
return isNonEmptyArray(result.errors) ?
|
|
7416
|
+
new ApolloError({ graphQLErrors: result.errors })
|
|
7428
7417
|
: result.error;
|
|
7429
7418
|
};
|
|
7430
7419
|
InternalState.prototype.getCurrentResult = function () {
|
|
@@ -7504,10 +7493,10 @@ function useLazyQuery(query, options) {
|
|
|
7504
7493
|
}, []);
|
|
7505
7494
|
Object.assign(result, eagerMethods);
|
|
7506
7495
|
var execute = React__namespace.useCallback(function (executeOptions) {
|
|
7507
|
-
execOptionsRef.current =
|
|
7508
|
-
? tslib.__assign(tslib.__assign({}, executeOptions), { fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy }) : {
|
|
7509
|
-
|
|
7510
|
-
|
|
7496
|
+
execOptionsRef.current =
|
|
7497
|
+
executeOptions ? tslib.__assign(tslib.__assign({}, executeOptions), { fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy }) : {
|
|
7498
|
+
fetchPolicy: initialFetchPolicy,
|
|
7499
|
+
};
|
|
7511
7500
|
var options = mergeOptions(optionsRef.current, tslib.__assign({ query: queryRef.current }, execOptionsRef.current));
|
|
7512
7501
|
var promise = internalState
|
|
7513
7502
|
.executeQuery(tslib.__assign(tslib.__assign({}, options), { skip: false }))
|
|
@@ -7560,8 +7549,8 @@ function useMutation(mutation, options) {
|
|
|
7560
7549
|
.then(function (response) {
|
|
7561
7550
|
var _a, _b;
|
|
7562
7551
|
var data = response.data, errors = response.errors;
|
|
7563
|
-
var error = errors && errors.length > 0
|
|
7564
|
-
|
|
7552
|
+
var error = errors && errors.length > 0 ?
|
|
7553
|
+
new ApolloError({ graphQLErrors: errors })
|
|
7565
7554
|
: void 0;
|
|
7566
7555
|
var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError);
|
|
7567
7556
|
if (error && onError) {
|
|
@@ -7610,7 +7599,9 @@ function useMutation(mutation, options) {
|
|
|
7610
7599
|
}, []);
|
|
7611
7600
|
var reset = React__namespace.useCallback(function () {
|
|
7612
7601
|
if (ref.current.isMounted) {
|
|
7613
|
-
|
|
7602
|
+
var result_3 = { called: false, loading: false, client: client };
|
|
7603
|
+
Object.assign(ref.current, { mutationId: 0, result: result_3 });
|
|
7604
|
+
setResult(result_3);
|
|
7614
7605
|
}
|
|
7615
7606
|
}, []);
|
|
7616
7607
|
React__namespace.useEffect(function () {
|
|
@@ -7775,44 +7766,6 @@ function useReactiveVar(rv) {
|
|
|
7775
7766
|
}, [rv]), rv, rv);
|
|
7776
7767
|
}
|
|
7777
7768
|
|
|
7778
|
-
function useFragment(options) {
|
|
7779
|
-
var cache = useApolloClient().cache;
|
|
7780
|
-
var fragment = options.fragment, fragmentName = options.fragmentName, from = options.from, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, rest = tslib.__rest(options, ["fragment", "fragmentName", "from", "optimistic"]);
|
|
7781
|
-
var diffOptions = tslib.__assign(tslib.__assign({}, rest), { returnPartialData: true, id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
|
|
7782
|
-
var resultRef = React__namespace.useRef();
|
|
7783
|
-
var latestDiff = cache.diff(diffOptions);
|
|
7784
|
-
var getSnapshot = function () {
|
|
7785
|
-
var latestDiffToResult = diffToResult(latestDiff);
|
|
7786
|
-
return resultRef.current &&
|
|
7787
|
-
equal.equal(resultRef.current.data, latestDiffToResult.data)
|
|
7788
|
-
? resultRef.current
|
|
7789
|
-
: (resultRef.current = latestDiffToResult);
|
|
7790
|
-
};
|
|
7791
|
-
return useSyncExternalStore(function (forceUpdate) {
|
|
7792
|
-
var lastTimeout = 0;
|
|
7793
|
-
var unsubcribe = cache.watch(tslib.__assign(tslib.__assign({}, diffOptions), { immediate: true, callback: function (diff) {
|
|
7794
|
-
if (!equal.equal(diff, latestDiff)) {
|
|
7795
|
-
resultRef.current = diffToResult((latestDiff = diff));
|
|
7796
|
-
lastTimeout = setTimeout(forceUpdate);
|
|
7797
|
-
}
|
|
7798
|
-
} }));
|
|
7799
|
-
return function () {
|
|
7800
|
-
unsubcribe();
|
|
7801
|
-
clearTimeout(lastTimeout);
|
|
7802
|
-
};
|
|
7803
|
-
}, getSnapshot, getSnapshot);
|
|
7804
|
-
}
|
|
7805
|
-
function diffToResult(diff) {
|
|
7806
|
-
var result = {
|
|
7807
|
-
data: diff.result,
|
|
7808
|
-
complete: !!diff.complete,
|
|
7809
|
-
};
|
|
7810
|
-
if (diff.missing) {
|
|
7811
|
-
result.missing = mergeDeepArray(diff.missing.map(function (error) { return error.missing; }));
|
|
7812
|
-
}
|
|
7813
|
-
return result;
|
|
7814
|
-
}
|
|
7815
|
-
|
|
7816
7769
|
function useDeepMemo(memoFn, deps) {
|
|
7817
7770
|
var ref = React__namespace.useRef();
|
|
7818
7771
|
if (!ref.current || !equal.equal(ref.current.deps, deps)) {
|
|
@@ -7821,6 +7774,15 @@ function useDeepMemo(memoFn, deps) {
|
|
|
7821
7774
|
return ref.current.value;
|
|
7822
7775
|
}
|
|
7823
7776
|
|
|
7777
|
+
var INIT = {};
|
|
7778
|
+
function useLazyRef(getInitialValue) {
|
|
7779
|
+
var ref = React__namespace.useRef(INIT);
|
|
7780
|
+
if (ref.current === INIT) {
|
|
7781
|
+
ref.current = getInitialValue();
|
|
7782
|
+
}
|
|
7783
|
+
return ref;
|
|
7784
|
+
}
|
|
7785
|
+
|
|
7824
7786
|
var useKey = "use";
|
|
7825
7787
|
var realHook = React__namespace[useKey];
|
|
7826
7788
|
var __use = realHook ||
|
|
@@ -7836,6 +7798,42 @@ var __use = realHook ||
|
|
|
7836
7798
|
}
|
|
7837
7799
|
};
|
|
7838
7800
|
|
|
7801
|
+
function useFragment(options) {
|
|
7802
|
+
var cache = useApolloClient().cache;
|
|
7803
|
+
var diffOptions = useDeepMemo(function () {
|
|
7804
|
+
var fragment = options.fragment, fragmentName = options.fragmentName, from = options.from, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, rest = tslib.__rest(options, ["fragment", "fragmentName", "from", "optimistic"]);
|
|
7805
|
+
return tslib.__assign(tslib.__assign({}, rest), { returnPartialData: true, id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
|
|
7806
|
+
}, [options]);
|
|
7807
|
+
var resultRef = useLazyRef(function () {
|
|
7808
|
+
return diffToResult(cache.diff(diffOptions));
|
|
7809
|
+
});
|
|
7810
|
+
var getSnapshot = React__namespace.useCallback(function () { return resultRef.current; }, []);
|
|
7811
|
+
return useSyncExternalStore(React__namespace.useCallback(function (forceUpdate) {
|
|
7812
|
+
var lastTimeout = 0;
|
|
7813
|
+
var unsubscribe = cache.watch(tslib.__assign(tslib.__assign({}, diffOptions), { immediate: true, callback: function (diff) {
|
|
7814
|
+
if (!equal.equal(diff.result, resultRef.current.data)) {
|
|
7815
|
+
resultRef.current = diffToResult(diff);
|
|
7816
|
+
clearTimeout(lastTimeout);
|
|
7817
|
+
lastTimeout = setTimeout(forceUpdate);
|
|
7818
|
+
}
|
|
7819
|
+
} }));
|
|
7820
|
+
return function () {
|
|
7821
|
+
unsubscribe();
|
|
7822
|
+
clearTimeout(lastTimeout);
|
|
7823
|
+
};
|
|
7824
|
+
}, [cache, diffOptions]), getSnapshot, getSnapshot);
|
|
7825
|
+
}
|
|
7826
|
+
function diffToResult(diff) {
|
|
7827
|
+
var result = {
|
|
7828
|
+
data: diff.result,
|
|
7829
|
+
complete: !!diff.complete,
|
|
7830
|
+
};
|
|
7831
|
+
if (diff.missing) {
|
|
7832
|
+
result.missing = mergeDeepArray(diff.missing.map(function (error) { return error.missing; }));
|
|
7833
|
+
}
|
|
7834
|
+
return result;
|
|
7835
|
+
}
|
|
7836
|
+
|
|
7839
7837
|
var QUERY_REFERENCE_SYMBOL = Symbol();
|
|
7840
7838
|
function wrapQueryRef(internalQueryRef) {
|
|
7841
7839
|
var _a;
|
|
@@ -7852,7 +7850,7 @@ var OBSERVED_CHANGED_OPTIONS = [
|
|
|
7852
7850
|
"refetchWritePolicy",
|
|
7853
7851
|
"returnPartialData",
|
|
7854
7852
|
];
|
|
7855
|
-
var InternalQueryReference =
|
|
7853
|
+
var InternalQueryReference = (function () {
|
|
7856
7854
|
function InternalQueryReference(observable, options) {
|
|
7857
7855
|
var _this = this;
|
|
7858
7856
|
this.listeners = new Set();
|
|
@@ -8029,7 +8027,7 @@ var InternalQueryReference = (function () {
|
|
|
8029
8027
|
return InternalQueryReference;
|
|
8030
8028
|
}());
|
|
8031
8029
|
|
|
8032
|
-
var SuspenseCache =
|
|
8030
|
+
var SuspenseCache = (function () {
|
|
8033
8031
|
function SuspenseCache(options) {
|
|
8034
8032
|
if (options === void 0) { options = Object.create(null); }
|
|
8035
8033
|
this.queryRefs = new trie.Trie(canUseWeakMap);
|
|
@@ -8066,7 +8064,11 @@ function useSuspenseQuery(query, options) {
|
|
|
8066
8064
|
if (options === void 0) { options = Object.create(null); }
|
|
8067
8065
|
var client = useApolloClient(options.client);
|
|
8068
8066
|
var suspenseCache = getSuspenseCache(client);
|
|
8069
|
-
var watchQueryOptions = useWatchQueryOptions({
|
|
8067
|
+
var watchQueryOptions = useWatchQueryOptions({
|
|
8068
|
+
client: client,
|
|
8069
|
+
query: query,
|
|
8070
|
+
options: options,
|
|
8071
|
+
});
|
|
8070
8072
|
var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables;
|
|
8071
8073
|
var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
|
|
8072
8074
|
var cacheKey = tslib.__spreadArray([
|
|
@@ -8108,13 +8110,13 @@ function useSuspenseQuery(query, options) {
|
|
|
8108
8110
|
};
|
|
8109
8111
|
}, [queryRef.result]);
|
|
8110
8112
|
var result = fetchPolicy === "standby" ? skipResult : __use(promise);
|
|
8111
|
-
var fetchMore = React__namespace.useCallback(function (options) {
|
|
8113
|
+
var fetchMore = React__namespace.useCallback((function (options) {
|
|
8112
8114
|
var promise = queryRef.fetchMore(options);
|
|
8113
8115
|
setPromiseCache(function (previousPromiseCache) {
|
|
8114
8116
|
return new Map(previousPromiseCache).set(queryRef.key, queryRef.promise);
|
|
8115
8117
|
});
|
|
8116
8118
|
return promise;
|
|
8117
|
-
}, [queryRef]);
|
|
8119
|
+
}), [queryRef]);
|
|
8118
8120
|
var refetch = React__namespace.useCallback(function (variables) {
|
|
8119
8121
|
var promise = queryRef.refetch(variables);
|
|
8120
8122
|
setPromiseCache(function (previousPromiseCache) {
|
|
@@ -8157,8 +8159,8 @@ function validatePartialDataReturn(fetchPolicy, returnPartialData) {
|
|
|
8157
8159
|
}
|
|
8158
8160
|
}
|
|
8159
8161
|
function toApolloError(result) {
|
|
8160
|
-
return isNonEmptyArray(result.errors)
|
|
8161
|
-
|
|
8162
|
+
return isNonEmptyArray(result.errors) ?
|
|
8163
|
+
new ApolloError({ graphQLErrors: result.errors })
|
|
8162
8164
|
: result.error;
|
|
8163
8165
|
}
|
|
8164
8166
|
function useWatchQueryOptions(_a) {
|