@apollo/client 3.8.0 → 3.8.2
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/apollo-client.cjs +715 -587
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +253 -191
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +253 -191
- package/cache/core/cache.d.ts +4 -4
- package/cache/core/cache.d.ts.map +1 -1
- package/cache/core/cache.js +10 -7
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +3 -3
- package/cache/core/types/Cache.d.ts.map +1 -1
- package/cache/core/types/Cache.js +0 -1
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +6 -6
- package/cache/core/types/DataProxy.d.ts.map +1 -1
- package/cache/core/types/DataProxy.js.map +1 -1
- package/cache/core/types/common.d.ts +3 -3
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/index.d.ts +20 -20
- package/cache/index.d.ts.map +1 -1
- package/cache/index.js +13 -13
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +6 -6
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js +38 -30
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fixPolyfills.native.d.ts.map +1 -1
- package/cache/inmemory/fixPolyfills.native.js +10 -9
- package/cache/inmemory/fixPolyfills.native.js.map +1 -1
- package/cache/inmemory/fragmentRegistry.d.ts.map +1 -1
- package/cache/inmemory/fragmentRegistry.js +6 -4
- package/cache/inmemory/fragmentRegistry.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +6 -6
- package/cache/inmemory/helpers.d.ts.map +1 -1
- package/cache/inmemory/helpers.js +16 -14
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +9 -9
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js +29 -33
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.d.ts.map +1 -1
- package/cache/inmemory/key-extractor.js +55 -49
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/object-canon.d.ts.map +1 -1
- package/cache/inmemory/object-canon.js +5 -5
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.d.ts +6 -6
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +74 -45
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/reactiveVars.d.ts +1 -1
- package/cache/inmemory/reactiveVars.d.ts.map +1 -1
- package/cache/inmemory/reactiveVars.js +5 -5
- package/cache/inmemory/reactiveVars.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +7 -7
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +21 -17
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +7 -7
- package/cache/inmemory/types.d.ts.map +1 -1
- package/cache/inmemory/types.js +0 -2
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +7 -7
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js +40 -30
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/config/jest/setup.d.ts +2 -2
- package/config/jest/setup.js +5 -5
- package/config/jest/setup.js.map +1 -1
- package/core/ApolloClient.d.ts +11 -11
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +64 -50
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +6 -6
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +17 -16
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +12 -10
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +57 -38
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +11 -11
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +28 -34
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +10 -10
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +117 -93
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +255 -199
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +255 -199
- package/core/networkStatus.js.map +1 -1
- package/core/types.d.ts +13 -13
- package/core/types.d.ts.map +1 -1
- package/core/types.js +0 -1
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +11 -11
- package/core/watchQueryOptions.d.ts.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/dev/dev.cjs +44 -40
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +44 -40
- package/errors/errors.cjs +7 -5
- package/errors/errors.cjs.map +1 -1
- package/errors/errors.cjs.native.js +7 -5
- package/errors/index.d.ts +4 -4
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js +9 -7
- package/errors/index.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/index.js.map +1 -1
- package/invariantErrorCodes.d.ts.map +1 -1
- package/invariantErrorCodes.js +36 -36
- package/invariantErrorCodes.js.map +1 -1
- package/link/batch/batch.cjs +4 -4
- package/link/batch/batch.cjs.map +1 -1
- package/link/batch/batch.cjs.native.js +4 -4
- package/link/batch/batchLink.d.ts +6 -6
- package/link/batch/batchLink.d.ts.map +1 -1
- package/link/batch/batchLink.js +4 -4
- package/link/batch/batchLink.js.map +1 -1
- package/link/batch/batching.d.ts +2 -2
- package/link/batch/batching.d.ts.map +1 -1
- package/link/batch/batching.js +4 -4
- package/link/batch/batching.js.map +1 -1
- package/link/batch/index.d.ts +1 -1
- package/link/batch/index.js +1 -1
- package/link/batch/index.js.map +1 -1
- package/link/batch-http/batch-http.cjs +13 -11
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batch-http.cjs.native.js +13 -11
- package/link/batch-http/batchHttpLink.d.ts +6 -6
- package/link/batch-http/batchHttpLink.d.ts.map +1 -1
- package/link/batch-http/batchHttpLink.js +17 -15
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/batch-http/index.d.ts +1 -1
- package/link/batch-http/index.js +1 -1
- package/link/batch-http/index.js.map +1 -1
- package/link/context/context.cjs.map +1 -1
- package/link/context/index.d.ts +3 -3
- package/link/context/index.js +2 -2
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.d.ts +3 -3
- package/link/core/ApolloLink.js +4 -4
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/concat.d.ts +1 -1
- package/link/core/concat.js +1 -1
- package/link/core/concat.js.map +1 -1
- package/link/core/core.cjs +1 -1
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +1 -1
- package/link/core/empty.d.ts +1 -1
- package/link/core/empty.js +1 -1
- package/link/core/empty.js.map +1 -1
- package/link/core/execute.d.ts +1 -1
- package/link/core/execute.js +1 -1
- package/link/core/execute.js.map +1 -1
- package/link/core/from.d.ts +1 -1
- package/link/core/from.js +1 -1
- package/link/core/from.js.map +1 -1
- package/link/core/index.d.ts +8 -8
- package/link/core/index.js +8 -8
- package/link/core/index.js.map +1 -1
- package/link/core/split.d.ts +1 -1
- package/link/core/split.js +1 -1
- package/link/core/split.js.map +1 -1
- package/link/core/types.js.map +1 -1
- package/link/error/error.cjs.map +1 -1
- package/link/error/index.d.ts +5 -5
- package/link/error/index.js +2 -2
- package/link/error/index.js.map +1 -1
- package/link/http/HttpLink.d.ts +3 -3
- package/link/http/HttpLink.js +2 -2
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/checkFetcher.d.ts +1 -1
- package/link/http/checkFetcher.d.ts.map +1 -1
- package/link/http/checkFetcher.js +2 -2
- package/link/http/checkFetcher.js.map +1 -1
- package/link/http/createHttpLink.d.ts +2 -2
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js +27 -26
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/createSignalIfSupported.js +1 -1
- package/link/http/createSignalIfSupported.js.map +1 -1
- package/link/http/http.cjs +64 -41
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +64 -41
- package/link/http/index.d.ts +13 -13
- package/link/http/index.js +10 -10
- package/link/http/index.js.map +1 -1
- package/link/http/iterators/nodeStream.d.ts.map +1 -1
- package/link/http/iterators/nodeStream.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +2 -2
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/responseIterator.d.ts.map +1 -1
- package/link/http/responseIterator.js +20 -1
- package/link/http/responseIterator.js.map +1 -1
- package/link/http/rewriteURIForGET.d.ts +1 -1
- package/link/http/rewriteURIForGET.js +12 -12
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +5 -5
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +8 -7
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/selectURI.d.ts +1 -1
- package/link/http/selectURI.js +2 -2
- package/link/http/selectURI.js.map +1 -1
- package/link/http/serializeFetchParameter.d.ts +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/persisted-queries/index.d.ts +4 -4
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +26 -25
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +22 -17
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +22 -17
- package/link/retry/delayFunction.d.ts +1 -1
- package/link/retry/delayFunction.js.map +1 -1
- package/link/retry/index.d.ts +1 -1
- package/link/retry/index.js +1 -1
- package/link/retry/index.js.map +1 -1
- package/link/retry/retry.cjs +2 -2
- package/link/retry/retry.cjs.map +1 -1
- package/link/retry/retry.cjs.native.js +2 -2
- package/link/retry/retryFunction.d.ts +1 -1
- package/link/retry/retryFunction.js.map +1 -1
- package/link/retry/retryLink.d.ts +5 -5
- package/link/retry/retryLink.d.ts.map +1 -1
- package/link/retry/retryLink.js +6 -6
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +4 -4
- package/link/schema/index.d.ts.map +1 -1
- package/link/schema/index.js +13 -8
- package/link/schema/index.js.map +1 -1
- package/link/schema/schema.cjs +10 -5
- package/link/schema/schema.cjs.map +1 -1
- package/link/schema/schema.cjs.native.js +10 -5
- package/link/subscriptions/index.js +1 -1
- package/link/subscriptions/index.js.map +1 -1
- package/link/subscriptions/subscriptions.cjs.map +1 -1
- package/link/utils/createOperation.d.ts +1 -1
- package/link/utils/createOperation.js +3 -3
- package/link/utils/createOperation.js.map +1 -1
- package/link/utils/filterOperationVariables.d.ts +1 -1
- package/link/utils/filterOperationVariables.js +2 -2
- package/link/utils/filterOperationVariables.js.map +1 -1
- package/link/utils/fromError.d.ts +1 -1
- package/link/utils/fromError.js +1 -1
- package/link/utils/fromError.js.map +1 -1
- package/link/utils/fromPromise.d.ts +1 -1
- package/link/utils/fromPromise.js +1 -1
- package/link/utils/fromPromise.js.map +1 -1
- package/link/utils/index.d.ts +10 -10
- package/link/utils/index.js +9 -9
- package/link/utils/index.js.map +1 -1
- package/link/utils/throwServerError.js +1 -1
- package/link/utils/throwServerError.js.map +1 -1
- package/link/utils/toPromise.d.ts +1 -1
- package/link/utils/toPromise.js +1 -1
- package/link/utils/toPromise.js.map +1 -1
- package/link/utils/transformOperation.d.ts +1 -1
- package/link/utils/transformOperation.js +3 -3
- package/link/utils/transformOperation.js.map +1 -1
- package/link/utils/utils.cjs +12 -12
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +12 -12
- package/link/utils/validateOperation.d.ts +1 -1
- package/link/utils/validateOperation.js +6 -6
- package/link/utils/validateOperation.js.map +1 -1
- package/link/ws/index.d.ts +5 -5
- package/link/ws/index.js +2 -2
- package/link/ws/index.js.map +1 -1
- package/link/ws/ws.cjs.map +1 -1
- package/package.json +27 -27
- package/react/cache/QueryReference.d.ts +1 -1
- package/react/cache/QueryReference.d.ts.map +1 -1
- package/react/cache/QueryReference.js +2 -0
- package/react/cache/QueryReference.js.map +1 -1
- package/react/hooks/constants.js +1 -1
- package/react/hooks/constants.js.map +1 -1
- package/react/hooks/hooks.cjs +10 -21
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +10 -21
- package/react/hooks/useBackgroundQuery.d.ts +1 -1
- package/react/hooks/useBackgroundQuery.d.ts.map +1 -1
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +1 -8
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useReactiveVar.d.ts.map +1 -1
- package/react/hooks/useReactiveVar.js +7 -12
- package/react/hooks/useReactiveVar.js.map +1 -1
- package/react/hooks/useReadQuery.d.ts +1 -1
- package/react/hooks/useReadQuery.d.ts.map +1 -1
- package/react/hooks/useReadQuery.js +1 -1
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +1 -1
- package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/react.cjs +2 -0
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +2 -0
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +37 -28
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +37 -28
- package/testing/core/itAsync.d.ts.map +1 -1
- package/testing/core/itAsync.js +8 -4
- package/testing/core/itAsync.js.map +1 -1
- package/testing/core/mocking/mockClient.d.ts +3 -3
- package/testing/core/mocking/mockClient.d.ts.map +1 -1
- package/testing/core/mocking/mockClient.js +6 -4
- package/testing/core/mocking/mockClient.js.map +1 -1
- package/testing/core/mocking/mockFetch.d.ts +1 -1
- package/testing/core/mocking/mockFetch.d.ts.map +1 -1
- package/testing/core/mocking/mockFetch.js +3 -3
- package/testing/core/mocking/mockFetch.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +3 -3
- package/testing/core/mocking/mockLink.d.ts.map +1 -1
- package/testing/core/mocking/mockLink.js +24 -23
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts +2 -2
- package/testing/core/mocking/mockQueryManager.js +3 -3
- package/testing/core/mocking/mockQueryManager.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +3 -3
- package/testing/core/mocking/mockSubscriptionLink.js +4 -4
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
- package/testing/core/mocking/mockWatchQuery.d.ts +2 -2
- package/testing/core/mocking/mockWatchQuery.js +2 -2
- package/testing/core/mocking/mockWatchQuery.js.map +1 -1
- package/testing/core/observableToPromise.d.ts +3 -3
- package/testing/core/observableToPromise.d.ts.map +1 -1
- package/testing/core/observableToPromise.js +8 -4
- package/testing/core/observableToPromise.js.map +1 -1
- package/testing/core/subscribeAndCount.d.ts +1 -1
- package/testing/core/subscribeAndCount.d.ts.map +1 -1
- package/testing/core/subscribeAndCount.js +5 -3
- package/testing/core/subscribeAndCount.js.map +1 -1
- package/testing/core/wait.js.map +1 -1
- package/testing/core/withConsoleSpy.d.ts.map +1 -1
- package/testing/core/withConsoleSpy.js.map +1 -1
- package/testing/core/wrap.d.ts.map +1 -1
- package/testing/core/wrap.js +14 -12
- package/testing/core/wrap.js.map +1 -1
- package/testing/index.d.ts +4 -4
- package/testing/index.js +3 -3
- package/testing/index.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +7 -7
- package/testing/react/MockedProvider.d.ts.map +1 -1
- package/testing/react/MockedProvider.js +10 -11
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +3 -5
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +3 -5
- package/utilities/common/canUse.d.ts.map +1 -1
- package/utilities/common/canUse.js +4 -5
- package/utilities/common/canUse.js.map +1 -1
- package/utilities/common/cloneDeep.js +2 -2
- package/utilities/common/cloneDeep.js.map +1 -1
- package/utilities/common/compact.d.ts +1 -1
- package/utilities/common/compact.js.map +1 -1
- package/utilities/common/filterInPlace.js.map +1 -1
- package/utilities/common/maybeDeepFreeze.js +1 -1
- package/utilities/common/maybeDeepFreeze.js.map +1 -1
- package/utilities/common/mergeDeep.d.ts.map +1 -1
- package/utilities/common/mergeDeep.js +3 -1
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/common/mergeOptions.d.ts.map +1 -1
- package/utilities/common/mergeOptions.js.map +1 -1
- package/utilities/common/objects.js +2 -2
- package/utilities/common/objects.js.map +1 -1
- package/utilities/common/stringifyForDisplay.d.ts.map +1 -1
- package/utilities/common/stringifyForDisplay.js +3 -1
- package/utilities/common/stringifyForDisplay.js.map +1 -1
- package/utilities/globals/global.d.ts.map +1 -1
- package/utilities/globals/global.js +3 -1
- package/utilities/globals/global.js.map +1 -1
- package/utilities/globals/globals.cjs +8 -4
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +8 -4
- package/utilities/globals/index.d.ts.map +1 -1
- package/utilities/globals/index.js +1 -1
- package/utilities/globals/index.js.map +1 -1
- package/utilities/globals/invariantWrappers.js +1 -1
- package/utilities/globals/invariantWrappers.js.map +1 -1
- package/utilities/globals/maybe.d.ts.map +1 -1
- package/utilities/globals/maybe.js.map +1 -1
- package/utilities/graphql/directives.d.ts +1 -1
- package/utilities/graphql/directives.d.ts.map +1 -1
- package/utilities/graphql/directives.js +17 -13
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts +1 -1
- package/utilities/graphql/fragments.d.ts.map +1 -1
- package/utilities/graphql/fragments.js +12 -12
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.d.ts +1 -1
- package/utilities/graphql/getFromAST.js +16 -16
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts +2 -2
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +36 -34
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.d.ts +1 -1
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js +48 -32
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +0 -1
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +0 -1
- package/utilities/index.js.map +1 -1
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/Concast.js +5 -9
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/observables/Observable.d.ts +4 -4
- package/utilities/observables/Observable.d.ts.map +1 -1
- package/utilities/observables/Observable.js +6 -4
- package/utilities/observables/Observable.js.map +1 -1
- package/utilities/observables/asyncMap.d.ts.map +1 -1
- package/utilities/observables/asyncMap.js +5 -2
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/observables/iteration.js.map +1 -1
- package/utilities/policies/pagination.d.ts +1 -1
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js +9 -7
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/types/IsStrictlyAny.d.ts +2 -2
- package/utilities/types/IsStrictlyAny.d.ts.map +1 -1
- package/utilities/types/IsStrictlyAny.js.map +1 -1
- package/utilities/utilities.cjs +147 -147
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +147 -147
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/utilities/common/responseIterator.d.ts +0 -10
- package/utilities/common/responseIterator.d.ts.map +0 -1
- package/utilities/common/responseIterator.js +0 -21
- package/utilities/common/responseIterator.js.map +0 -1
package/core/core.cjs
CHANGED
|
@@ -19,10 +19,10 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
19
19
|
|
|
20
20
|
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
|
|
21
21
|
|
|
22
|
-
var version =
|
|
22
|
+
var version = "3.8.2";
|
|
23
23
|
|
|
24
24
|
function isNonNullObject(obj) {
|
|
25
|
-
return obj !== null && typeof obj ===
|
|
25
|
+
return obj !== null && typeof obj === "object";
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
function isNonEmptyArray(value) {
|
|
@@ -51,7 +51,9 @@ var DeepMerger = (function () {
|
|
|
51
51
|
if (hasOwnProperty$2.call(target, sourceKey)) {
|
|
52
52
|
var targetValue = target[sourceKey];
|
|
53
53
|
if (source[sourceKey] !== targetValue) {
|
|
54
|
-
var result = _this.reconciler.apply(_this, tslib.__spreadArray([target,
|
|
54
|
+
var result = _this.reconciler.apply(_this, tslib.__spreadArray([target,
|
|
55
|
+
source,
|
|
56
|
+
sourceKey], context, false));
|
|
55
57
|
if (result !== targetValue) {
|
|
56
58
|
target = _this.shallowCopyForMerge(target);
|
|
57
59
|
target[sourceKey] = result;
|
|
@@ -227,7 +229,9 @@ var ObservableQuery = (function (_super) {
|
|
|
227
229
|
_this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy);
|
|
228
230
|
_this.isTornDown = false;
|
|
229
231
|
var _b = queryManager.defaultOptions.watchQuery, _c = _b === void 0 ? {} : _b, _d = _c.fetchPolicy, defaultFetchPolicy = _d === void 0 ? "cache-first" : _d;
|
|
230
|
-
var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e, _f = options.initialFetchPolicy, initialFetchPolicy = _f === void 0 ?
|
|
232
|
+
var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e, _f = options.initialFetchPolicy, initialFetchPolicy = _f === void 0 ? fetchPolicy === "standby"
|
|
233
|
+
? defaultFetchPolicy
|
|
234
|
+
: fetchPolicy : _f;
|
|
231
235
|
_this.options = tslib.__assign(tslib.__assign({}, options), { initialFetchPolicy: initialFetchPolicy, fetchPolicy: fetchPolicy });
|
|
232
236
|
_this.queryId = queryInfo.queryId || queryManager.generateQueryId();
|
|
233
237
|
var opDef = utilities.getOperationDefinition(_this.query);
|
|
@@ -278,7 +282,7 @@ var ObservableQuery = (function (_super) {
|
|
|
278
282
|
if (skipCacheDataFor(fetchPolicy) ||
|
|
279
283
|
this.queryManager.getDocumentInfo(this.query).hasForcedResolvers) ;
|
|
280
284
|
else if (this.waitForOwnResult) {
|
|
281
|
-
this.queryInfo[
|
|
285
|
+
this.queryInfo["updateWatch"]();
|
|
282
286
|
}
|
|
283
287
|
else {
|
|
284
288
|
var diff = this.queryInfo.getDiff();
|
|
@@ -292,8 +296,7 @@ var ObservableQuery = (function (_super) {
|
|
|
292
296
|
delete result.partial;
|
|
293
297
|
if (diff.complete &&
|
|
294
298
|
result.networkStatus === exports.NetworkStatus.loading &&
|
|
295
|
-
(fetchPolicy ===
|
|
296
|
-
fetchPolicy === 'cache-only')) {
|
|
299
|
+
(fetchPolicy === "cache-first" || fetchPolicy === "cache-only")) {
|
|
297
300
|
result.networkStatus = exports.NetworkStatus.ready;
|
|
298
301
|
result.loading = false;
|
|
299
302
|
}
|
|
@@ -319,11 +322,11 @@ var ObservableQuery = (function (_super) {
|
|
|
319
322
|
if (!this.last) {
|
|
320
323
|
return true;
|
|
321
324
|
}
|
|
322
|
-
var resultIsDifferent = this.queryManager.getDocumentInfo(this.query)
|
|
325
|
+
var resultIsDifferent = this.queryManager.getDocumentInfo(this.query)
|
|
326
|
+
.hasNonreactiveDirective
|
|
323
327
|
? !equalByQuery(this.query, this.last.result, newResult, this.variables)
|
|
324
328
|
: !equal.equal(this.last.result, newResult);
|
|
325
|
-
return (resultIsDifferent ||
|
|
326
|
-
(variables && !equal.equal(this.last.variables, variables)));
|
|
329
|
+
return (resultIsDifferent || (variables && !equal.equal(this.last.variables, variables)));
|
|
327
330
|
};
|
|
328
331
|
ObservableQuery.prototype.getLast = function (key, variablesMustMatch) {
|
|
329
332
|
var last = this.last;
|
|
@@ -352,14 +355,14 @@ var ObservableQuery = (function (_super) {
|
|
|
352
355
|
pollInterval: 0,
|
|
353
356
|
};
|
|
354
357
|
var fetchPolicy = this.options.fetchPolicy;
|
|
355
|
-
if (fetchPolicy ===
|
|
358
|
+
if (fetchPolicy === "cache-and-network") {
|
|
356
359
|
reobserveOptions.fetchPolicy = fetchPolicy;
|
|
357
360
|
}
|
|
358
|
-
else if (fetchPolicy ===
|
|
359
|
-
reobserveOptions.fetchPolicy =
|
|
361
|
+
else if (fetchPolicy === "no-cache") {
|
|
362
|
+
reobserveOptions.fetchPolicy = "no-cache";
|
|
360
363
|
}
|
|
361
364
|
else {
|
|
362
|
-
reobserveOptions.fetchPolicy =
|
|
365
|
+
reobserveOptions.fetchPolicy = "network-only";
|
|
363
366
|
}
|
|
364
367
|
if (globalThis.__DEV__ !== false && variables && hasOwnProperty$1.call(variables, "variables")) {
|
|
365
368
|
var queryDef = utilities.getQueryDefinition(this.query);
|
|
@@ -380,7 +383,9 @@ var ObservableQuery = (function (_super) {
|
|
|
380
383
|
};
|
|
381
384
|
ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) {
|
|
382
385
|
var _this = this;
|
|
383
|
-
var combinedOptions = tslib.__assign(tslib.__assign({}, (fetchMoreOptions.query
|
|
386
|
+
var combinedOptions = tslib.__assign(tslib.__assign({}, (fetchMoreOptions.query
|
|
387
|
+
? fetchMoreOptions
|
|
388
|
+
: tslib.__assign(tslib.__assign(tslib.__assign(tslib.__assign({}, this.options), { query: this.options.query }), fetchMoreOptions), { variables: tslib.__assign(tslib.__assign({}, this.options.variables), fetchMoreOptions.variables) }))), { fetchPolicy: "no-cache" });
|
|
384
389
|
combinedOptions.query = this.transformDocument(combinedOptions.query);
|
|
385
390
|
var qid = this.queryManager.generateQueryId();
|
|
386
391
|
this.lastQuery = fetchMoreOptions.query
|
|
@@ -393,7 +398,9 @@ var ObservableQuery = (function (_super) {
|
|
|
393
398
|
this.observe();
|
|
394
399
|
}
|
|
395
400
|
var updatedQuerySet = new Set();
|
|
396
|
-
return this.queryManager
|
|
401
|
+
return this.queryManager
|
|
402
|
+
.fetchQuery(qid, combinedOptions, exports.NetworkStatus.fetchMore)
|
|
403
|
+
.then(function (fetchMoreResult) {
|
|
397
404
|
_this.queryManager.removeQuery(qid);
|
|
398
405
|
if (queryInfo.networkStatus === exports.NetworkStatus.fetchMore) {
|
|
399
406
|
queryInfo.networkStatus = originalNetworkStatus;
|
|
@@ -407,10 +414,12 @@ var ObservableQuery = (function (_super) {
|
|
|
407
414
|
variables: _this.variables,
|
|
408
415
|
returnPartialData: true,
|
|
409
416
|
optimistic: false,
|
|
410
|
-
}, function (previous) {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
417
|
+
}, function (previous) {
|
|
418
|
+
return updateQuery(previous, {
|
|
419
|
+
fetchMoreResult: fetchMoreResult.data,
|
|
420
|
+
variables: combinedOptions.variables,
|
|
421
|
+
});
|
|
422
|
+
});
|
|
414
423
|
}
|
|
415
424
|
else {
|
|
416
425
|
cache.writeQuery({
|
|
@@ -425,7 +434,8 @@ var ObservableQuery = (function (_super) {
|
|
|
425
434
|
},
|
|
426
435
|
});
|
|
427
436
|
return fetchMoreResult;
|
|
428
|
-
})
|
|
437
|
+
})
|
|
438
|
+
.finally(function () {
|
|
429
439
|
if (!updatedQuerySet.has(_this.query)) {
|
|
430
440
|
reobserveCacheFirst(_this);
|
|
431
441
|
}
|
|
@@ -476,9 +486,7 @@ var ObservableQuery = (function (_super) {
|
|
|
476
486
|
};
|
|
477
487
|
ObservableQuery.prototype.setVariables = function (variables) {
|
|
478
488
|
if (equal.equal(this.variables, variables)) {
|
|
479
|
-
return this.observers.size
|
|
480
|
-
? this.result()
|
|
481
|
-
: Promise.resolve();
|
|
489
|
+
return this.observers.size ? this.result() : Promise.resolve();
|
|
482
490
|
}
|
|
483
491
|
this.options.variables = variables;
|
|
484
492
|
if (!this.observers.size) {
|
|
@@ -540,7 +548,7 @@ var ObservableQuery = (function (_super) {
|
|
|
540
548
|
};
|
|
541
549
|
ObservableQuery.prototype.fetch = function (options, newNetworkStatus) {
|
|
542
550
|
this.queryManager.setObservableQuery(this);
|
|
543
|
-
return this.queryManager[
|
|
551
|
+
return this.queryManager["fetchConcastWithInfo"](this.queryId, options, newNetworkStatus);
|
|
544
552
|
};
|
|
545
553
|
ObservableQuery.prototype.updatePolling = function () {
|
|
546
554
|
var _this = this;
|
|
@@ -555,8 +563,7 @@ var ObservableQuery = (function (_super) {
|
|
|
555
563
|
}
|
|
556
564
|
return;
|
|
557
565
|
}
|
|
558
|
-
if (pollingInfo &&
|
|
559
|
-
pollingInfo.interval === pollInterval) {
|
|
566
|
+
if (pollingInfo && pollingInfo.interval === pollInterval) {
|
|
560
567
|
return;
|
|
561
568
|
}
|
|
562
569
|
globals.invariant(pollInterval, 20);
|
|
@@ -566,7 +573,9 @@ var ObservableQuery = (function (_super) {
|
|
|
566
573
|
if (_this.pollingInfo) {
|
|
567
574
|
if (!isNetworkRequestInFlight(_this.queryInfo.networkStatus)) {
|
|
568
575
|
_this.reobserve({
|
|
569
|
-
fetchPolicy: _this.options.initialFetchPolicy ===
|
|
576
|
+
fetchPolicy: _this.options.initialFetchPolicy === "no-cache"
|
|
577
|
+
? "no-cache"
|
|
578
|
+
: "network-only",
|
|
570
579
|
}, exports.NetworkStatus.poll).then(poll, poll);
|
|
571
580
|
}
|
|
572
581
|
else {
|
|
@@ -589,9 +598,9 @@ var ObservableQuery = (function (_super) {
|
|
|
589
598
|
if (error && this.last && !equal.equal(variables, this.last.variables)) {
|
|
590
599
|
error = void 0;
|
|
591
600
|
}
|
|
592
|
-
return this.last = tslib.__assign({ result: this.queryManager.assumeImmutableResults
|
|
601
|
+
return (this.last = tslib.__assign({ result: this.queryManager.assumeImmutableResults
|
|
593
602
|
? newResult
|
|
594
|
-
: utilities.cloneDeep(newResult), variables: variables }, (error ? { error: error } : null));
|
|
603
|
+
: utilities.cloneDeep(newResult), variables: variables }, (error ? { error: error } : null)));
|
|
595
604
|
};
|
|
596
605
|
ObservableQuery.prototype.reobserveAsConcast = function (newOptions, newNetworkStatus) {
|
|
597
606
|
var _this = this;
|
|
@@ -603,7 +612,8 @@ var ObservableQuery = (function (_super) {
|
|
|
603
612
|
var oldFetchPolicy = this.options.fetchPolicy;
|
|
604
613
|
var mergedOptions = utilities.compact(this.options, newOptions || {});
|
|
605
614
|
var options = useDisposableConcast
|
|
606
|
-
?
|
|
615
|
+
?
|
|
616
|
+
mergedOptions
|
|
607
617
|
: assign(this.options, mergedOptions);
|
|
608
618
|
var query = this.transformDocument(options.query);
|
|
609
619
|
this.lastQuery = query;
|
|
@@ -652,6 +662,17 @@ var ObservableQuery = (function (_super) {
|
|
|
652
662
|
ObservableQuery.prototype.reobserve = function (newOptions, newNetworkStatus) {
|
|
653
663
|
return this.reobserveAsConcast(newOptions, newNetworkStatus).promise;
|
|
654
664
|
};
|
|
665
|
+
ObservableQuery.prototype.resubscribeAfterError = function () {
|
|
666
|
+
var args = [];
|
|
667
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
668
|
+
args[_i] = arguments[_i];
|
|
669
|
+
}
|
|
670
|
+
var last = this.last;
|
|
671
|
+
this.resetLastResults();
|
|
672
|
+
var subscription = this.subscribe.apply(this, args);
|
|
673
|
+
this.last = last;
|
|
674
|
+
return subscription;
|
|
675
|
+
};
|
|
655
676
|
ObservableQuery.prototype.observe = function () {
|
|
656
677
|
this.reportResult(this.getCurrentResult(false), this.variables);
|
|
657
678
|
};
|
|
@@ -668,7 +689,7 @@ var ObservableQuery = (function (_super) {
|
|
|
668
689
|
ObservableQuery.prototype.reportError = function (error, variables) {
|
|
669
690
|
var errorResult = tslib.__assign(tslib.__assign({}, this.getLastResult()), { error: error, errors: error.graphQLErrors, networkStatus: exports.NetworkStatus.error, loading: false });
|
|
670
691
|
this.updateLastResult(errorResult, variables);
|
|
671
|
-
utilities.iterateObserversSafely(this.observers,
|
|
692
|
+
utilities.iterateObserversSafely(this.observers, "error", (this.last.error = error));
|
|
672
693
|
};
|
|
673
694
|
ObservableQuery.prototype.hasObservers = function () {
|
|
674
695
|
return this.observers.size > 0;
|
|
@@ -696,8 +717,7 @@ var ObservableQuery = (function (_super) {
|
|
|
696
717
|
utilities.fixObservableSubclass(ObservableQuery);
|
|
697
718
|
function reobserveCacheFirst(obsQuery) {
|
|
698
719
|
var _a = obsQuery.options, fetchPolicy = _a.fetchPolicy, nextFetchPolicy = _a.nextFetchPolicy;
|
|
699
|
-
if (fetchPolicy === "cache-and-network" ||
|
|
700
|
-
fetchPolicy === "network-only") {
|
|
720
|
+
if (fetchPolicy === "cache-and-network" || fetchPolicy === "network-only") {
|
|
701
721
|
return obsQuery.reobserve({
|
|
702
722
|
fetchPolicy: "cache-first",
|
|
703
723
|
nextFetchPolicy: function () {
|
|
@@ -720,7 +740,9 @@ function logMissingFieldErrors(missing) {
|
|
|
720
740
|
}
|
|
721
741
|
}
|
|
722
742
|
function skipCacheDataFor(fetchPolicy) {
|
|
723
|
-
return fetchPolicy === "network-only" ||
|
|
743
|
+
return (fetchPolicy === "network-only" ||
|
|
744
|
+
fetchPolicy === "no-cache" ||
|
|
745
|
+
fetchPolicy === "standby");
|
|
724
746
|
}
|
|
725
747
|
|
|
726
748
|
var LocalState = (function () {
|
|
@@ -775,7 +797,7 @@ var LocalState = (function () {
|
|
|
775
797
|
return this.fragmentMatcher;
|
|
776
798
|
};
|
|
777
799
|
LocalState.prototype.clientQuery = function (document) {
|
|
778
|
-
if (utilities.hasDirectives([
|
|
800
|
+
if (utilities.hasDirectives(["client"], document)) {
|
|
779
801
|
if (this.resolvers) {
|
|
780
802
|
return document;
|
|
781
803
|
}
|
|
@@ -808,10 +830,10 @@ var LocalState = (function () {
|
|
|
808
830
|
graphql.visit(document, {
|
|
809
831
|
Directive: {
|
|
810
832
|
enter: function (node) {
|
|
811
|
-
if (node.name.value ===
|
|
833
|
+
if (node.name.value === "client" && node.arguments) {
|
|
812
834
|
forceResolvers = node.arguments.some(function (arg) {
|
|
813
|
-
return arg.name.value ===
|
|
814
|
-
arg.value.kind ===
|
|
835
|
+
return arg.name.value === "always" &&
|
|
836
|
+
arg.value.kind === "BooleanValue" &&
|
|
815
837
|
arg.value.value === true;
|
|
816
838
|
});
|
|
817
839
|
if (forceResolvers) {
|
|
@@ -847,7 +869,7 @@ var LocalState = (function () {
|
|
|
847
869
|
defaultOperationType = definitionOperation
|
|
848
870
|
? definitionOperation.charAt(0).toUpperCase() +
|
|
849
871
|
definitionOperation.slice(1)
|
|
850
|
-
:
|
|
872
|
+
: "Query";
|
|
851
873
|
_a = this, cache = _a.cache, client = _a.client;
|
|
852
874
|
execContext = {
|
|
853
875
|
fragmentMap: fragmentMap,
|
|
@@ -877,7 +899,8 @@ var LocalState = (function () {
|
|
|
877
899
|
execute = function (selection) { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
878
900
|
var fragment, typeCondition;
|
|
879
901
|
return tslib.__generator(this, function (_a) {
|
|
880
|
-
if (!isClientFieldDescendant &&
|
|
902
|
+
if (!isClientFieldDescendant &&
|
|
903
|
+
!execContext.selectionsToResolve.has(selection)) {
|
|
881
904
|
return [2];
|
|
882
905
|
}
|
|
883
906
|
if (!utilities.shouldInclude(selection, variables)) {
|
|
@@ -886,7 +909,7 @@ var LocalState = (function () {
|
|
|
886
909
|
if (utilities.isField(selection)) {
|
|
887
910
|
return [2, this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) {
|
|
888
911
|
var _a;
|
|
889
|
-
if (typeof fieldResult !==
|
|
912
|
+
if (typeof fieldResult !== "undefined") {
|
|
890
913
|
resultsToMerge.push((_a = {},
|
|
891
914
|
_a[utilities.resultKeyNameFromField(selection)] = fieldResult,
|
|
892
915
|
_a));
|
|
@@ -952,9 +975,9 @@ var LocalState = (function () {
|
|
|
952
975
|
if (result === void 0) { result = defaultResult; }
|
|
953
976
|
if (field.directives) {
|
|
954
977
|
field.directives.forEach(function (directive) {
|
|
955
|
-
if (directive.name.value ===
|
|
978
|
+
if (directive.name.value === "export" && directive.arguments) {
|
|
956
979
|
directive.arguments.forEach(function (arg) {
|
|
957
|
-
if (arg.name.value ===
|
|
980
|
+
if (arg.name.value === "as" && arg.value.kind === "StringValue") {
|
|
958
981
|
execContext.exportedVariables[arg.value.value] = result;
|
|
959
982
|
}
|
|
960
983
|
});
|
|
@@ -967,7 +990,7 @@ var LocalState = (function () {
|
|
|
967
990
|
if (result == null) {
|
|
968
991
|
return result;
|
|
969
992
|
}
|
|
970
|
-
var isClientField = (_b = (_a = field.directives) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.name.value ===
|
|
993
|
+
var isClientField = (_b = (_a = field.directives) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.name.value === "client"; })) !== null && _b !== void 0 ? _b : false;
|
|
971
994
|
if (Array.isArray(result)) {
|
|
972
995
|
return _this.resolveSubSelectedArray(field, isClientFieldDescendant || isClientField, result, execContext);
|
|
973
996
|
}
|
|
@@ -1001,7 +1024,7 @@ var LocalState = (function () {
|
|
|
1001
1024
|
selectionsToResolveCache.set(definitionNode, matches_1);
|
|
1002
1025
|
graphql.visit(definitionNode, {
|
|
1003
1026
|
Directive: function (node, _, __, ___, ancestors) {
|
|
1004
|
-
if (node.name.value ===
|
|
1027
|
+
if (node.name.value === "client") {
|
|
1005
1028
|
ancestors.forEach(function (node) {
|
|
1006
1029
|
if (isSingleASTNode(node) && graphql.isSelectionNode(node)) {
|
|
1007
1030
|
matches_1.add(node);
|
|
@@ -1024,7 +1047,7 @@ var LocalState = (function () {
|
|
|
1024
1047
|
matches_1.add(selection);
|
|
1025
1048
|
});
|
|
1026
1049
|
}
|
|
1027
|
-
}
|
|
1050
|
+
},
|
|
1028
1051
|
});
|
|
1029
1052
|
}
|
|
1030
1053
|
return selectionsToResolveCache.get(definitionNode);
|
|
@@ -1061,7 +1084,7 @@ var QueryInfo = (function () {
|
|
|
1061
1084
|
this.stopped = false;
|
|
1062
1085
|
this.dirty = false;
|
|
1063
1086
|
this.observableQuery = null;
|
|
1064
|
-
var cache = this.cache = queryManager.cache;
|
|
1087
|
+
var cache = (this.cache = queryManager.cache);
|
|
1065
1088
|
if (!destructiveMethodCounts.has(cache)) {
|
|
1066
1089
|
destructiveMethodCounts.set(cache, 0);
|
|
1067
1090
|
wrapDestructiveCacheMethod(cache, "evict");
|
|
@@ -1098,13 +1121,12 @@ var QueryInfo = (function () {
|
|
|
1098
1121
|
cancelNotifyTimeout(this);
|
|
1099
1122
|
this.dirty = false;
|
|
1100
1123
|
};
|
|
1101
|
-
QueryInfo.prototype.getDiff = function (
|
|
1102
|
-
|
|
1103
|
-
var options = this.getDiffOptions(variables);
|
|
1124
|
+
QueryInfo.prototype.getDiff = function () {
|
|
1125
|
+
var options = this.getDiffOptions();
|
|
1104
1126
|
if (this.lastDiff && equal.equal(options, this.lastDiff.options)) {
|
|
1105
1127
|
return this.lastDiff.diff;
|
|
1106
1128
|
}
|
|
1107
|
-
this.updateWatch(this.variables
|
|
1129
|
+
this.updateWatch(this.variables);
|
|
1108
1130
|
var oq = this.observableQuery;
|
|
1109
1131
|
if (oq && oq.options.fetchPolicy === "no-cache") {
|
|
1110
1132
|
return { complete: false };
|
|
@@ -1114,10 +1136,12 @@ var QueryInfo = (function () {
|
|
|
1114
1136
|
return diff;
|
|
1115
1137
|
};
|
|
1116
1138
|
QueryInfo.prototype.updateLastDiff = function (diff, options) {
|
|
1117
|
-
this.lastDiff = diff
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1139
|
+
this.lastDiff = diff
|
|
1140
|
+
? {
|
|
1141
|
+
diff: diff,
|
|
1142
|
+
options: options || this.getDiffOptions(),
|
|
1143
|
+
}
|
|
1144
|
+
: void 0;
|
|
1121
1145
|
};
|
|
1122
1146
|
QueryInfo.prototype.getDiffOptions = function (variables) {
|
|
1123
1147
|
var _a;
|
|
@@ -1134,8 +1158,7 @@ var QueryInfo = (function () {
|
|
|
1134
1158
|
var _this = this;
|
|
1135
1159
|
var oldDiff = this.lastDiff && this.lastDiff.diff;
|
|
1136
1160
|
this.updateLastDiff(diff);
|
|
1137
|
-
if (!this.dirty &&
|
|
1138
|
-
!equal.equal(oldDiff && oldDiff.result, diff && diff.result)) {
|
|
1161
|
+
if (!this.dirty && !equal.equal(oldDiff && oldDiff.result, diff && diff.result)) {
|
|
1139
1162
|
this.dirty = true;
|
|
1140
1163
|
if (!this.notifyTimeout) {
|
|
1141
1164
|
this.notifyTimeout = setTimeout(function () { return _this.notify(); }, 0);
|
|
@@ -1152,7 +1175,7 @@ var QueryInfo = (function () {
|
|
|
1152
1175
|
this.observableQuery = oq;
|
|
1153
1176
|
if (oq) {
|
|
1154
1177
|
oq["queryInfo"] = this;
|
|
1155
|
-
this.listeners.add(this.oqListener = function () {
|
|
1178
|
+
this.listeners.add((this.oqListener = function () {
|
|
1156
1179
|
var diff = _this.getDiff();
|
|
1157
1180
|
if (diff.fromOptimisticTransaction) {
|
|
1158
1181
|
oq["observe"]();
|
|
@@ -1160,7 +1183,7 @@ var QueryInfo = (function () {
|
|
|
1160
1183
|
else {
|
|
1161
1184
|
reobserveCacheFirst(oq);
|
|
1162
1185
|
}
|
|
1163
|
-
});
|
|
1186
|
+
}));
|
|
1164
1187
|
}
|
|
1165
1188
|
else {
|
|
1166
1189
|
delete this.oqListener;
|
|
@@ -1178,11 +1201,9 @@ var QueryInfo = (function () {
|
|
|
1178
1201
|
if (!this.dirty || !this.listeners.size) {
|
|
1179
1202
|
return false;
|
|
1180
1203
|
}
|
|
1181
|
-
if (isNetworkRequestInFlight(this.networkStatus) &&
|
|
1182
|
-
this.observableQuery) {
|
|
1204
|
+
if (isNetworkRequestInFlight(this.networkStatus) && this.observableQuery) {
|
|
1183
1205
|
var fetchPolicy = this.observableQuery.options.fetchPolicy;
|
|
1184
|
-
if (fetchPolicy !== "cache-only" &&
|
|
1185
|
-
fetchPolicy !== "cache-and-network") {
|
|
1206
|
+
if (fetchPolicy !== "cache-only" && fetchPolicy !== "cache-and-network") {
|
|
1186
1207
|
return false;
|
|
1187
1208
|
}
|
|
1188
1209
|
}
|
|
@@ -1209,10 +1230,9 @@ var QueryInfo = (function () {
|
|
|
1209
1230
|
return;
|
|
1210
1231
|
}
|
|
1211
1232
|
var watchOptions = tslib.__assign(tslib.__assign({}, this.getDiffOptions(variables)), { watcher: this, callback: function (diff) { return _this.setDiff(diff); } });
|
|
1212
|
-
if (!this.lastWatch ||
|
|
1213
|
-
!equal.equal(watchOptions, this.lastWatch)) {
|
|
1233
|
+
if (!this.lastWatch || !equal.equal(watchOptions, this.lastWatch)) {
|
|
1214
1234
|
this.cancel();
|
|
1215
|
-
this.cancel = this.cache.watch(this.lastWatch = watchOptions);
|
|
1235
|
+
this.cancel = this.cache.watch((this.lastWatch = watchOptions));
|
|
1216
1236
|
}
|
|
1217
1237
|
};
|
|
1218
1238
|
QueryInfo.prototype.resetLastWrite = function () {
|
|
@@ -1232,16 +1252,16 @@ var QueryInfo = (function () {
|
|
|
1232
1252
|
? result.errors.slice(0)
|
|
1233
1253
|
: [];
|
|
1234
1254
|
this.reset();
|
|
1235
|
-
if (
|
|
1255
|
+
if ("incremental" in result && utilities.isNonEmptyArray(result.incremental)) {
|
|
1236
1256
|
var mergedData = utilities.mergeIncrementalData(this.getDiff().result, result);
|
|
1237
1257
|
result.data = mergedData;
|
|
1238
1258
|
}
|
|
1239
|
-
else if (
|
|
1259
|
+
else if ("hasNext" in result && result.hasNext) {
|
|
1240
1260
|
var diff = this.getDiff();
|
|
1241
1261
|
result.data = merger.merge(diff.result, result.data);
|
|
1242
1262
|
}
|
|
1243
1263
|
this.graphQLErrors = graphQLErrors;
|
|
1244
|
-
if (options.fetchPolicy ===
|
|
1264
|
+
if (options.fetchPolicy === "no-cache") {
|
|
1245
1265
|
this.updateLastDiff({ result: result.data, complete: true }, this.getDiffOptions(options.variables));
|
|
1246
1266
|
}
|
|
1247
1267
|
else if (cacheWriteBehavior !== 0) {
|
|
@@ -1261,15 +1281,14 @@ var QueryInfo = (function () {
|
|
|
1261
1281
|
};
|
|
1262
1282
|
}
|
|
1263
1283
|
else {
|
|
1264
|
-
if (_this.lastDiff &&
|
|
1265
|
-
_this.lastDiff.diff.complete) {
|
|
1284
|
+
if (_this.lastDiff && _this.lastDiff.diff.complete) {
|
|
1266
1285
|
result.data = _this.lastDiff.diff.result;
|
|
1267
1286
|
return;
|
|
1268
1287
|
}
|
|
1269
1288
|
}
|
|
1270
1289
|
var diffOptions = _this.getDiffOptions(options.variables);
|
|
1271
1290
|
var diff = cache.diff(diffOptions);
|
|
1272
|
-
if (!_this.stopped) {
|
|
1291
|
+
if (!_this.stopped && equal.equal(_this.variables, options.variables)) {
|
|
1273
1292
|
_this.updateWatch(options.variables);
|
|
1274
1293
|
}
|
|
1275
1294
|
_this.updateLastDiff(diff, diffOptions);
|
|
@@ -1285,7 +1304,7 @@ var QueryInfo = (function () {
|
|
|
1285
1304
|
};
|
|
1286
1305
|
QueryInfo.prototype.markReady = function () {
|
|
1287
1306
|
this.networkError = null;
|
|
1288
|
-
return this.networkStatus = exports.NetworkStatus.ready;
|
|
1307
|
+
return (this.networkStatus = exports.NetworkStatus.ready);
|
|
1289
1308
|
};
|
|
1290
1309
|
QueryInfo.prototype.markError = function (error) {
|
|
1291
1310
|
this.networkStatus = exports.NetworkStatus.error;
|
|
@@ -1303,8 +1322,7 @@ var QueryInfo = (function () {
|
|
|
1303
1322
|
}());
|
|
1304
1323
|
function shouldWriteResult(result, errorPolicy) {
|
|
1305
1324
|
if (errorPolicy === void 0) { errorPolicy = "none"; }
|
|
1306
|
-
var ignoreErrors = errorPolicy === "ignore" ||
|
|
1307
|
-
errorPolicy === "all";
|
|
1325
|
+
var ignoreErrors = errorPolicy === "ignore" || errorPolicy === "all";
|
|
1308
1326
|
var writeWithErrors = !utilities.graphQLResultHasError(result);
|
|
1309
1327
|
if (!writeWithErrors && ignoreErrors && result.data) {
|
|
1310
1328
|
writeWithErrors = true;
|
|
@@ -1315,8 +1333,8 @@ function shouldWriteResult(result, errorPolicy) {
|
|
|
1315
1333
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1316
1334
|
var QueryManager = (function () {
|
|
1317
1335
|
function QueryManager(_a) {
|
|
1318
|
-
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;
|
|
1319
1336
|
var _this = this;
|
|
1337
|
+
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;
|
|
1320
1338
|
this.clientAwareness = {};
|
|
1321
1339
|
this.queries = new Map();
|
|
1322
1340
|
this.fetchCancelFns = new Map();
|
|
@@ -1363,8 +1381,7 @@ var QueryManager = (function () {
|
|
|
1363
1381
|
switch (_h.label) {
|
|
1364
1382
|
case 0:
|
|
1365
1383
|
globals.invariant(mutation, 24);
|
|
1366
|
-
globals.invariant(fetchPolicy ===
|
|
1367
|
-
fetchPolicy === 'no-cache', 25);
|
|
1384
|
+
globals.invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 25);
|
|
1368
1385
|
mutationId = this.generateMutationId();
|
|
1369
1386
|
mutation = this.cache.transformForLink(this.transform(mutation));
|
|
1370
1387
|
hasClientExports = this.getDocumentInfo(mutation).hasClientExports;
|
|
@@ -1399,7 +1416,7 @@ var QueryManager = (function () {
|
|
|
1399
1416
|
self = this;
|
|
1400
1417
|
return [2, new Promise(function (resolve, reject) {
|
|
1401
1418
|
return utilities.asyncMap(self.getObservableFromLink(mutation, tslib.__assign(tslib.__assign({}, context), { optimisticResponse: optimisticResponse }), variables, false), function (result) {
|
|
1402
|
-
if (utilities.graphQLResultHasError(result) && errorPolicy ===
|
|
1419
|
+
if (utilities.graphQLResultHasError(result) && errorPolicy === "none") {
|
|
1403
1420
|
throw new errors.ApolloError({
|
|
1404
1421
|
graphQLErrors: utilities.getGraphQLErrorsFromResult(result),
|
|
1405
1422
|
});
|
|
@@ -1412,8 +1429,7 @@ var QueryManager = (function () {
|
|
|
1412
1429
|
if (typeof refetchQueries === "function") {
|
|
1413
1430
|
refetchQueries = refetchQueries(storeResult);
|
|
1414
1431
|
}
|
|
1415
|
-
if (errorPolicy ===
|
|
1416
|
-
utilities.graphQLResultHasError(storeResult)) {
|
|
1432
|
+
if (errorPolicy === "ignore" && utilities.graphQLResultHasError(storeResult)) {
|
|
1417
1433
|
delete storeResult.errors;
|
|
1418
1434
|
}
|
|
1419
1435
|
return self.markMutationResult({
|
|
@@ -1435,7 +1451,7 @@ var QueryManager = (function () {
|
|
|
1435
1451
|
}).subscribe({
|
|
1436
1452
|
next: function (storeResult) {
|
|
1437
1453
|
self.broadcastQueries();
|
|
1438
|
-
if (!(
|
|
1454
|
+
if (!("hasNext" in storeResult) || storeResult.hasNext === false) {
|
|
1439
1455
|
resolve(storeResult);
|
|
1440
1456
|
}
|
|
1441
1457
|
},
|
|
@@ -1448,9 +1464,11 @@ var QueryManager = (function () {
|
|
|
1448
1464
|
self.cache.removeOptimistic(mutationId);
|
|
1449
1465
|
}
|
|
1450
1466
|
self.broadcastQueries();
|
|
1451
|
-
reject(err instanceof errors.ApolloError
|
|
1452
|
-
|
|
1453
|
-
|
|
1467
|
+
reject(err instanceof errors.ApolloError
|
|
1468
|
+
? err
|
|
1469
|
+
: new errors.ApolloError({
|
|
1470
|
+
networkError: err,
|
|
1471
|
+
}));
|
|
1454
1472
|
},
|
|
1455
1473
|
});
|
|
1456
1474
|
})];
|
|
@@ -1468,12 +1486,13 @@ var QueryManager = (function () {
|
|
|
1468
1486
|
if (!utilities.isExecutionPatchIncrementalResult(result)) {
|
|
1469
1487
|
cacheWrites.push({
|
|
1470
1488
|
result: result.data,
|
|
1471
|
-
dataId:
|
|
1489
|
+
dataId: "ROOT_MUTATION",
|
|
1472
1490
|
query: mutation.document,
|
|
1473
1491
|
variables: mutation.variables,
|
|
1474
1492
|
});
|
|
1475
1493
|
}
|
|
1476
|
-
if (utilities.isExecutionPatchIncrementalResult(result) &&
|
|
1494
|
+
if (utilities.isExecutionPatchIncrementalResult(result) &&
|
|
1495
|
+
utilities.isNonEmptyArray(result.incremental)) {
|
|
1477
1496
|
var diff = cache.diff({
|
|
1478
1497
|
id: "ROOT_MUTATION",
|
|
1479
1498
|
query: this.getDocumentInfo(mutation.document).asQuery,
|
|
@@ -1485,11 +1504,11 @@ var QueryManager = (function () {
|
|
|
1485
1504
|
if (diff.result) {
|
|
1486
1505
|
mergedData = mergeIncrementalData(diff.result, result);
|
|
1487
1506
|
}
|
|
1488
|
-
if (typeof mergedData !==
|
|
1507
|
+
if (typeof mergedData !== "undefined") {
|
|
1489
1508
|
result.data = mergedData;
|
|
1490
1509
|
cacheWrites.push({
|
|
1491
1510
|
result: mergedData,
|
|
1492
|
-
dataId:
|
|
1511
|
+
dataId: "ROOT_MUTATION",
|
|
1493
1512
|
query: mutation.document,
|
|
1494
1513
|
variables: mutation.variables,
|
|
1495
1514
|
});
|
|
@@ -1514,13 +1533,13 @@ var QueryManager = (function () {
|
|
|
1514
1533
|
if (complete && currentQueryResult) {
|
|
1515
1534
|
var nextQueryResult = updater(currentQueryResult, {
|
|
1516
1535
|
mutationResult: result,
|
|
1517
|
-
queryName: document && utilities.getOperationName(document) || void 0,
|
|
1536
|
+
queryName: (document && utilities.getOperationName(document)) || void 0,
|
|
1518
1537
|
queryVariables: variables,
|
|
1519
1538
|
});
|
|
1520
1539
|
if (nextQueryResult) {
|
|
1521
1540
|
cacheWrites.push({
|
|
1522
1541
|
result: nextQueryResult,
|
|
1523
|
-
dataId:
|
|
1542
|
+
dataId: "ROOT_QUERY",
|
|
1524
1543
|
query: document,
|
|
1525
1544
|
variables: variables,
|
|
1526
1545
|
});
|
|
@@ -1554,10 +1573,10 @@ var QueryManager = (function () {
|
|
|
1554
1573
|
});
|
|
1555
1574
|
if (diff.complete) {
|
|
1556
1575
|
result = tslib.__assign(tslib.__assign({}, result), { data: diff.result });
|
|
1557
|
-
if (
|
|
1576
|
+
if ("incremental" in result) {
|
|
1558
1577
|
delete result.incremental;
|
|
1559
1578
|
}
|
|
1560
|
-
if (
|
|
1579
|
+
if ("hasNext" in result) {
|
|
1561
1580
|
delete result.hasNext;
|
|
1562
1581
|
}
|
|
1563
1582
|
}
|
|
@@ -1571,7 +1590,7 @@ var QueryManager = (function () {
|
|
|
1571
1590
|
}
|
|
1572
1591
|
if (!skipCache && !mutation.keepRootFields && isFinalResult) {
|
|
1573
1592
|
cache.modify({
|
|
1574
|
-
id:
|
|
1593
|
+
id: "ROOT_MUTATION",
|
|
1575
1594
|
fields: function (value, _a) {
|
|
1576
1595
|
var fieldName = _a.fieldName, DELETE = _a.DELETE;
|
|
1577
1596
|
return fieldName === "__typename" ? value : DELETE;
|
|
@@ -1605,7 +1624,8 @@ var QueryManager = (function () {
|
|
|
1605
1624
|
}, mutation.mutationId);
|
|
1606
1625
|
};
|
|
1607
1626
|
QueryManager.prototype.fetchQuery = function (queryId, options, networkStatus) {
|
|
1608
|
-
return this.fetchConcastWithInfo(queryId, options, networkStatus).concast
|
|
1627
|
+
return this.fetchConcastWithInfo(queryId, options, networkStatus).concast
|
|
1628
|
+
.promise;
|
|
1609
1629
|
};
|
|
1610
1630
|
QueryManager.prototype.getQueryStore = function () {
|
|
1611
1631
|
var store = Object.create(null);
|
|
@@ -1635,12 +1655,12 @@ var QueryManager = (function () {
|
|
|
1635
1655
|
var cacheEntry = {
|
|
1636
1656
|
hasClientExports: utilities.hasClientExports(document),
|
|
1637
1657
|
hasForcedResolvers: this.localState.shouldForceResolvers(document),
|
|
1638
|
-
hasNonreactiveDirective: utilities.hasDirectives([
|
|
1658
|
+
hasNonreactiveDirective: utilities.hasDirectives(["nonreactive"], document),
|
|
1639
1659
|
clientQuery: this.localState.clientQuery(document),
|
|
1640
1660
|
serverQuery: utilities.removeDirectivesFromDocument([
|
|
1641
|
-
{ name:
|
|
1642
|
-
{ name:
|
|
1643
|
-
{ name:
|
|
1661
|
+
{ name: "client", remove: true },
|
|
1662
|
+
{ name: "connection" },
|
|
1663
|
+
{ name: "nonreactive" },
|
|
1644
1664
|
], document),
|
|
1645
1665
|
defaultVars: utilities.getDefaultValues(utilities.getOperationDefinition(document)),
|
|
1646
1666
|
asQuery: tslib.__assign(tslib.__assign({}, document), { definitions: document.definitions.map(function (def) {
|
|
@@ -1649,7 +1669,7 @@ var QueryManager = (function () {
|
|
|
1649
1669
|
return tslib.__assign(tslib.__assign({}, def), { operation: "query" });
|
|
1650
1670
|
}
|
|
1651
1671
|
return def;
|
|
1652
|
-
}) })
|
|
1672
|
+
}) }),
|
|
1653
1673
|
};
|
|
1654
1674
|
transformCache.set(document, cacheEntry);
|
|
1655
1675
|
}
|
|
@@ -1661,7 +1681,7 @@ var QueryManager = (function () {
|
|
|
1661
1681
|
QueryManager.prototype.watchQuery = function (options) {
|
|
1662
1682
|
var query = this.transform(options.query);
|
|
1663
1683
|
options = tslib.__assign(tslib.__assign({}, options), { variables: this.getVariables(query, options.variables) });
|
|
1664
|
-
if (typeof options.notifyOnNetworkStatusChange ===
|
|
1684
|
+
if (typeof options.notifyOnNetworkStatusChange === "undefined") {
|
|
1665
1685
|
options.notifyOnNetworkStatusChange = false;
|
|
1666
1686
|
}
|
|
1667
1687
|
var queryInfo = new QueryInfo(this);
|
|
@@ -1670,7 +1690,7 @@ var QueryManager = (function () {
|
|
|
1670
1690
|
queryInfo: queryInfo,
|
|
1671
1691
|
options: options,
|
|
1672
1692
|
});
|
|
1673
|
-
observable[
|
|
1693
|
+
observable["lastQuery"] = query;
|
|
1674
1694
|
this.queries.set(observable.queryId, queryInfo);
|
|
1675
1695
|
queryInfo.init({
|
|
1676
1696
|
document: query,
|
|
@@ -1683,7 +1703,7 @@ var QueryManager = (function () {
|
|
|
1683
1703
|
var _this = this;
|
|
1684
1704
|
if (queryId === void 0) { queryId = this.generateQueryId(); }
|
|
1685
1705
|
globals.invariant(options.query, 26);
|
|
1686
|
-
globals.invariant(options.query.kind ===
|
|
1706
|
+
globals.invariant(options.query.kind === "Document", 27);
|
|
1687
1707
|
globals.invariant(!options.returnPartialData, 28);
|
|
1688
1708
|
globals.invariant(!options.pollInterval, 29);
|
|
1689
1709
|
return this.fetchQuery(queryId, tslib.__assign(tslib.__assign({}, options), { query: this.transform(options.query) })).finally(function () { return _this.stopQuery(queryId); });
|
|
@@ -1800,8 +1820,7 @@ var QueryManager = (function () {
|
|
|
1800
1820
|
var fetchPolicy = observableQuery.options.fetchPolicy;
|
|
1801
1821
|
observableQuery.resetLastResults();
|
|
1802
1822
|
if (includeStandby ||
|
|
1803
|
-
(fetchPolicy !== "standby" &&
|
|
1804
|
-
fetchPolicy !== "cache-only")) {
|
|
1823
|
+
(fetchPolicy !== "standby" && fetchPolicy !== "cache-only")) {
|
|
1805
1824
|
observableQueryPromises.push(observableQuery.refetch());
|
|
1806
1825
|
}
|
|
1807
1826
|
_this.getQuery(queryId).setDiff(null);
|
|
@@ -1814,17 +1833,17 @@ var QueryManager = (function () {
|
|
|
1814
1833
|
};
|
|
1815
1834
|
QueryManager.prototype.startGraphQLSubscription = function (_a) {
|
|
1816
1835
|
var _this = this;
|
|
1817
|
-
var query = _a.query, fetchPolicy = _a.fetchPolicy,
|
|
1836
|
+
var query = _a.query, fetchPolicy = _a.fetchPolicy, _b = _a.errorPolicy, errorPolicy = _b === void 0 ? "none" : _b, variables = _a.variables, _c = _a.context, context = _c === void 0 ? {} : _c;
|
|
1818
1837
|
query = this.transform(query);
|
|
1819
1838
|
variables = this.getVariables(query, variables);
|
|
1820
1839
|
var makeObservable = function (variables) {
|
|
1821
1840
|
return _this.getObservableFromLink(query, context, variables).map(function (result) {
|
|
1822
|
-
if (fetchPolicy !==
|
|
1841
|
+
if (fetchPolicy !== "no-cache") {
|
|
1823
1842
|
if (shouldWriteResult(result, errorPolicy)) {
|
|
1824
1843
|
_this.cache.write({
|
|
1825
1844
|
query: query,
|
|
1826
1845
|
result: result.data,
|
|
1827
|
-
dataId:
|
|
1846
|
+
dataId: "ROOT_SUBSCRIPTION",
|
|
1828
1847
|
variables: variables,
|
|
1829
1848
|
});
|
|
1830
1849
|
}
|
|
@@ -1840,16 +1859,23 @@ var QueryManager = (function () {
|
|
|
1840
1859
|
if (hasProtocolErrors) {
|
|
1841
1860
|
errors$1.protocolErrors = result.extensions[errors.PROTOCOL_ERRORS_SYMBOL];
|
|
1842
1861
|
}
|
|
1843
|
-
|
|
1862
|
+
if (errorPolicy === "none" || hasProtocolErrors) {
|
|
1863
|
+
throw new errors.ApolloError(errors$1);
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
if (errorPolicy === "ignore") {
|
|
1867
|
+
delete result.errors;
|
|
1844
1868
|
}
|
|
1845
1869
|
return result;
|
|
1846
1870
|
});
|
|
1847
1871
|
};
|
|
1848
1872
|
if (this.getDocumentInfo(query).hasClientExports) {
|
|
1849
|
-
var observablePromise_1 = this.localState
|
|
1873
|
+
var observablePromise_1 = this.localState
|
|
1874
|
+
.addExportedVariables(query, variables, context)
|
|
1875
|
+
.then(makeObservable);
|
|
1850
1876
|
return new utilities.Observable(function (observer) {
|
|
1851
1877
|
var sub = null;
|
|
1852
|
-
observablePromise_1.then(function (observable) { return sub = observable.subscribe(observer); }, observer.error);
|
|
1878
|
+
observablePromise_1.then(function (observable) { return (sub = observable.subscribe(observer)); }, observer.error);
|
|
1853
1879
|
return function () { return sub && sub.unsubscribe(); };
|
|
1854
1880
|
});
|
|
1855
1881
|
}
|
|
@@ -1901,12 +1927,11 @@ var QueryManager = (function () {
|
|
|
1901
1927
|
observable = byVariables_1.get(varJson_1);
|
|
1902
1928
|
if (!observable) {
|
|
1903
1929
|
var concast = new utilities.Concast([
|
|
1904
|
-
core.execute(link, operation)
|
|
1930
|
+
core.execute(link, operation),
|
|
1905
1931
|
]);
|
|
1906
|
-
byVariables_1.set(varJson_1, observable = concast);
|
|
1932
|
+
byVariables_1.set(varJson_1, (observable = concast));
|
|
1907
1933
|
concast.beforeNext(function () {
|
|
1908
|
-
if (byVariables_1.delete(varJson_1) &&
|
|
1909
|
-
byVariables_1.size < 1) {
|
|
1934
|
+
if (byVariables_1.delete(varJson_1) && byVariables_1.size < 1) {
|
|
1910
1935
|
inFlightLinkObservables_1.delete(printedServerQuery_1);
|
|
1911
1936
|
}
|
|
1912
1937
|
});
|
|
@@ -1914,14 +1939,12 @@ var QueryManager = (function () {
|
|
|
1914
1939
|
}
|
|
1915
1940
|
else {
|
|
1916
1941
|
observable = new utilities.Concast([
|
|
1917
|
-
core.execute(link, operation)
|
|
1942
|
+
core.execute(link, operation),
|
|
1918
1943
|
]);
|
|
1919
1944
|
}
|
|
1920
1945
|
}
|
|
1921
1946
|
else {
|
|
1922
|
-
observable = new utilities.Concast([
|
|
1923
|
-
utilities.Observable.of({ data: {} })
|
|
1924
|
-
]);
|
|
1947
|
+
observable = new utilities.Concast([utilities.Observable.of({ data: {} })]);
|
|
1925
1948
|
context = this.prepareContext(context);
|
|
1926
1949
|
}
|
|
1927
1950
|
if (clientQuery) {
|
|
@@ -1937,7 +1960,7 @@ var QueryManager = (function () {
|
|
|
1937
1960
|
return observable;
|
|
1938
1961
|
};
|
|
1939
1962
|
QueryManager.prototype.getResultsFromLink = function (queryInfo, cacheWriteBehavior, options) {
|
|
1940
|
-
var requestId = queryInfo.lastRequestId = this.generateRequestId();
|
|
1963
|
+
var requestId = (queryInfo.lastRequestId = this.generateRequestId());
|
|
1941
1964
|
var linkDocument = this.cache.transformForLink(options.query);
|
|
1942
1965
|
return utilities.asyncMap(this.getObservableFromLink(linkDocument, options.context, options.variables), function (result) {
|
|
1943
1966
|
var graphQLErrors = utilities.getGraphQLErrorsFromResult(result);
|
|
@@ -1978,7 +2001,7 @@ var QueryManager = (function () {
|
|
|
1978
2001
|
var variables = this.getVariables(query, options.variables);
|
|
1979
2002
|
var queryInfo = this.getQuery(queryId);
|
|
1980
2003
|
var defaults = this.defaultOptions.watchQuery;
|
|
1981
|
-
var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? defaults && defaults.fetchPolicy || "cache-first" : _a, _b = options.errorPolicy, errorPolicy = _b === void 0 ? defaults && defaults.errorPolicy || "none" : _b, _c = options.returnPartialData, returnPartialData = _c === void 0 ? false : _c, _d = options.notifyOnNetworkStatusChange, notifyOnNetworkStatusChange = _d === void 0 ? false : _d, _e = options.context, context = _e === void 0 ? {} : _e;
|
|
2004
|
+
var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? (defaults && defaults.fetchPolicy) || "cache-first" : _a, _b = options.errorPolicy, errorPolicy = _b === void 0 ? (defaults && defaults.errorPolicy) || "none" : _b, _c = options.returnPartialData, returnPartialData = _c === void 0 ? false : _c, _d = options.notifyOnNetworkStatusChange, notifyOnNetworkStatusChange = _d === void 0 ? false : _d, _e = options.context, context = _e === void 0 ? {} : _e;
|
|
1982
2005
|
var normalized = Object.assign({}, options, {
|
|
1983
2006
|
query: query,
|
|
1984
2007
|
variables: variables,
|
|
@@ -2007,7 +2030,8 @@ var QueryManager = (function () {
|
|
|
2007
2030
|
if (this.getDocumentInfo(normalized.query).hasClientExports) {
|
|
2008
2031
|
concast = new utilities.Concast(this.localState
|
|
2009
2032
|
.addExportedVariables(normalized.query, normalized.variables, normalized.context)
|
|
2010
|
-
.then(fromVariables)
|
|
2033
|
+
.then(fromVariables)
|
|
2034
|
+
.then(function (sourcesWithInfo) { return sourcesWithInfo.sources; }));
|
|
2011
2035
|
containsDataFromLink = true;
|
|
2012
2036
|
}
|
|
2013
2037
|
else {
|
|
@@ -2033,15 +2057,14 @@ var QueryManager = (function () {
|
|
|
2033
2057
|
});
|
|
2034
2058
|
});
|
|
2035
2059
|
}
|
|
2036
|
-
var results = new Map;
|
|
2060
|
+
var results = new Map();
|
|
2037
2061
|
if (updateCache) {
|
|
2038
2062
|
this.cache.batch({
|
|
2039
2063
|
update: updateCache,
|
|
2040
|
-
optimistic: optimistic && removeOptimistic || false,
|
|
2064
|
+
optimistic: (optimistic && removeOptimistic) || false,
|
|
2041
2065
|
removeOptimistic: removeOptimistic,
|
|
2042
2066
|
onWatchUpdated: function (watch, diff, lastDiff) {
|
|
2043
|
-
var oq = watch.watcher instanceof QueryInfo &&
|
|
2044
|
-
watch.watcher.observableQuery;
|
|
2067
|
+
var oq = watch.watcher instanceof QueryInfo && watch.watcher.observableQuery;
|
|
2045
2068
|
if (oq) {
|
|
2046
2069
|
if (onQueryUpdated) {
|
|
2047
2070
|
includedQueriesById.delete(oq.queryId);
|
|
@@ -2098,43 +2121,50 @@ var QueryManager = (function () {
|
|
|
2098
2121
|
variables: variables,
|
|
2099
2122
|
networkStatus: networkStatus,
|
|
2100
2123
|
});
|
|
2101
|
-
var readCache = function () { return queryInfo.getDiff(
|
|
2124
|
+
var readCache = function () { return queryInfo.getDiff(); };
|
|
2102
2125
|
var resultsFromCache = function (diff, networkStatus) {
|
|
2103
2126
|
if (networkStatus === void 0) { networkStatus = queryInfo.networkStatus || exports.NetworkStatus.loading; }
|
|
2104
2127
|
var data = diff.result;
|
|
2105
|
-
if (globalThis.__DEV__ !== false &&
|
|
2106
|
-
!returnPartialData &&
|
|
2107
|
-
!equal.equal(data, {})) {
|
|
2128
|
+
if (globalThis.__DEV__ !== false && !returnPartialData && !equal.equal(data, {})) {
|
|
2108
2129
|
logMissingFieldErrors(diff.missing);
|
|
2109
2130
|
}
|
|
2110
|
-
var fromData = function (data) {
|
|
2131
|
+
var fromData = function (data) {
|
|
2132
|
+
return utilities.Observable.of(tslib.__assign({ data: data, loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus }, (diff.complete ? null : { partial: true })));
|
|
2133
|
+
};
|
|
2111
2134
|
if (data && _this.getDocumentInfo(query).hasForcedResolvers) {
|
|
2112
|
-
return _this.localState
|
|
2135
|
+
return _this.localState
|
|
2136
|
+
.runResolvers({
|
|
2113
2137
|
document: query,
|
|
2114
2138
|
remoteResult: { data: data },
|
|
2115
2139
|
context: context,
|
|
2116
2140
|
variables: variables,
|
|
2117
2141
|
onlyRunForcedResolvers: true,
|
|
2118
|
-
})
|
|
2142
|
+
})
|
|
2143
|
+
.then(function (resolved) { return fromData(resolved.data || void 0); });
|
|
2119
2144
|
}
|
|
2120
|
-
if (errorPolicy ===
|
|
2145
|
+
if (errorPolicy === "none" &&
|
|
2121
2146
|
networkStatus === exports.NetworkStatus.refetch &&
|
|
2122
2147
|
Array.isArray(diff.missing)) {
|
|
2123
2148
|
return fromData(void 0);
|
|
2124
2149
|
}
|
|
2125
2150
|
return fromData(data);
|
|
2126
2151
|
};
|
|
2127
|
-
var cacheWriteBehavior = fetchPolicy === "no-cache"
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2152
|
+
var cacheWriteBehavior = fetchPolicy === "no-cache"
|
|
2153
|
+
? 0
|
|
2154
|
+
:
|
|
2155
|
+
networkStatus === exports.NetworkStatus.refetch &&
|
|
2156
|
+
refetchWritePolicy !== "merge"
|
|
2157
|
+
? 1
|
|
2158
|
+
: 2;
|
|
2159
|
+
var resultsFromLink = function () {
|
|
2160
|
+
return _this.getResultsFromLink(queryInfo, cacheWriteBehavior, {
|
|
2161
|
+
query: query,
|
|
2162
|
+
variables: variables,
|
|
2163
|
+
context: context,
|
|
2164
|
+
fetchPolicy: fetchPolicy,
|
|
2165
|
+
errorPolicy: errorPolicy,
|
|
2166
|
+
});
|
|
2167
|
+
};
|
|
2138
2168
|
var shouldNotify = notifyOnNetworkStatusChange &&
|
|
2139
2169
|
typeof oldNetworkStatus === "number" &&
|
|
2140
2170
|
oldNetworkStatus !== networkStatus &&
|
|
@@ -2144,35 +2174,47 @@ var QueryManager = (function () {
|
|
|
2144
2174
|
case "cache-first": {
|
|
2145
2175
|
var diff = readCache();
|
|
2146
2176
|
if (diff.complete) {
|
|
2147
|
-
return {
|
|
2177
|
+
return {
|
|
2178
|
+
fromLink: false,
|
|
2179
|
+
sources: [resultsFromCache(diff, queryInfo.markReady())],
|
|
2180
|
+
};
|
|
2148
2181
|
}
|
|
2149
2182
|
if (returnPartialData || shouldNotify) {
|
|
2150
|
-
return {
|
|
2183
|
+
return {
|
|
2184
|
+
fromLink: true,
|
|
2185
|
+
sources: [resultsFromCache(diff), resultsFromLink()],
|
|
2186
|
+
};
|
|
2151
2187
|
}
|
|
2152
2188
|
return { fromLink: true, sources: [resultsFromLink()] };
|
|
2153
2189
|
}
|
|
2154
2190
|
case "cache-and-network": {
|
|
2155
2191
|
var diff = readCache();
|
|
2156
2192
|
if (diff.complete || returnPartialData || shouldNotify) {
|
|
2157
|
-
return {
|
|
2193
|
+
return {
|
|
2194
|
+
fromLink: true,
|
|
2195
|
+
sources: [resultsFromCache(diff), resultsFromLink()],
|
|
2196
|
+
};
|
|
2158
2197
|
}
|
|
2159
2198
|
return { fromLink: true, sources: [resultsFromLink()] };
|
|
2160
2199
|
}
|
|
2161
2200
|
case "cache-only":
|
|
2162
|
-
return {
|
|
2201
|
+
return {
|
|
2202
|
+
fromLink: false,
|
|
2203
|
+
sources: [resultsFromCache(readCache(), queryInfo.markReady())],
|
|
2204
|
+
};
|
|
2163
2205
|
case "network-only":
|
|
2164
2206
|
if (shouldNotify) {
|
|
2165
|
-
return {
|
|
2207
|
+
return {
|
|
2208
|
+
fromLink: true,
|
|
2209
|
+
sources: [resultsFromCache(readCache()), resultsFromLink()],
|
|
2210
|
+
};
|
|
2166
2211
|
}
|
|
2167
2212
|
return { fromLink: true, sources: [resultsFromLink()] };
|
|
2168
2213
|
case "no-cache":
|
|
2169
2214
|
if (shouldNotify) {
|
|
2170
2215
|
return {
|
|
2171
2216
|
fromLink: true,
|
|
2172
|
-
sources: [
|
|
2173
|
-
resultsFromCache(queryInfo.getDiff()),
|
|
2174
|
-
resultsFromLink(),
|
|
2175
|
-
],
|
|
2217
|
+
sources: [resultsFromCache(queryInfo.getDiff()), resultsFromLink()],
|
|
2176
2218
|
};
|
|
2177
2219
|
}
|
|
2178
2220
|
return { fromLink: true, sources: [resultsFromLink()] };
|
|
@@ -2203,7 +2245,7 @@ var ApolloClient = (function () {
|
|
|
2203
2245
|
if (!options.cache) {
|
|
2204
2246
|
throw globals.newInvariantError(13);
|
|
2205
2247
|
}
|
|
2206
|
-
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, _c = options.connectToDevTools, connectToDevTools = _c === void 0 ? typeof window ===
|
|
2248
|
+
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, _c = options.connectToDevTools, connectToDevTools = _c === void 0 ? typeof window === "object" &&
|
|
2207
2249
|
!window.__APOLLO_CLIENT__ &&
|
|
2208
2250
|
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;
|
|
2209
2251
|
var link = options.link;
|
|
@@ -2226,32 +2268,40 @@ var ApolloClient = (function () {
|
|
|
2226
2268
|
this.mutate = this.mutate.bind(this);
|
|
2227
2269
|
this.resetStore = this.resetStore.bind(this);
|
|
2228
2270
|
this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this);
|
|
2229
|
-
if (connectToDevTools && typeof window ===
|
|
2230
|
-
|
|
2271
|
+
if (connectToDevTools && typeof window === "object") {
|
|
2272
|
+
var windowWithDevTools = window;
|
|
2273
|
+
var devtoolsSymbol = Symbol.for("apollo.devtools");
|
|
2274
|
+
(windowWithDevTools[devtoolsSymbol] =
|
|
2275
|
+
windowWithDevTools[devtoolsSymbol] || []).push(this);
|
|
2276
|
+
windowWithDevTools.__APOLLO_CLIENT__ = this;
|
|
2231
2277
|
}
|
|
2232
2278
|
if (!hasSuggestedDevtools && connectToDevTools && globalThis.__DEV__ !== false) {
|
|
2233
2279
|
hasSuggestedDevtools = true;
|
|
2234
|
-
|
|
2235
|
-
window
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
if (ua
|
|
2243
|
-
|
|
2244
|
-
|
|
2280
|
+
setTimeout(function () {
|
|
2281
|
+
if (typeof window !== "undefined" &&
|
|
2282
|
+
window.document &&
|
|
2283
|
+
window.top === window.self &&
|
|
2284
|
+
!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__) {
|
|
2285
|
+
var nav = window.navigator;
|
|
2286
|
+
var ua = nav && nav.userAgent;
|
|
2287
|
+
var url = void 0;
|
|
2288
|
+
if (typeof ua === "string") {
|
|
2289
|
+
if (ua.indexOf("Chrome/") > -1) {
|
|
2290
|
+
url =
|
|
2291
|
+
"https://chrome.google.com/webstore/detail/" +
|
|
2292
|
+
"apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm";
|
|
2293
|
+
}
|
|
2294
|
+
else if (ua.indexOf("Firefox/") > -1) {
|
|
2295
|
+
url =
|
|
2296
|
+
"https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/";
|
|
2297
|
+
}
|
|
2245
2298
|
}
|
|
2246
|
-
|
|
2247
|
-
|
|
2299
|
+
if (url) {
|
|
2300
|
+
globalThis.__DEV__ !== false && globals.invariant.log("Download the Apollo DevTools for a better development " +
|
|
2301
|
+
"experience: %s", url);
|
|
2248
2302
|
}
|
|
2249
2303
|
}
|
|
2250
|
-
|
|
2251
|
-
globalThis.__DEV__ !== false && globals.invariant.log("Download the Apollo DevTools for a better development " +
|
|
2252
|
-
"experience: %s", url);
|
|
2253
|
-
}
|
|
2254
|
-
}
|
|
2304
|
+
}, 10000);
|
|
2255
2305
|
}
|
|
2256
2306
|
this.version = version;
|
|
2257
2307
|
this.localState = new LocalState({
|
|
@@ -2273,18 +2323,20 @@ var ApolloClient = (function () {
|
|
|
2273
2323
|
},
|
|
2274
2324
|
localState: this.localState,
|
|
2275
2325
|
assumeImmutableResults: assumeImmutableResults,
|
|
2276
|
-
onBroadcast: connectToDevTools
|
|
2277
|
-
|
|
2278
|
-
_this.devToolsHookCb
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2326
|
+
onBroadcast: connectToDevTools
|
|
2327
|
+
? function () {
|
|
2328
|
+
if (_this.devToolsHookCb) {
|
|
2329
|
+
_this.devToolsHookCb({
|
|
2330
|
+
action: {},
|
|
2331
|
+
state: {
|
|
2332
|
+
queries: _this.queryManager.getQueryStore(),
|
|
2333
|
+
mutations: _this.queryManager.mutationStore || {},
|
|
2334
|
+
},
|
|
2335
|
+
dataWithOptimisticResults: _this.cache.extract(true),
|
|
2336
|
+
});
|
|
2337
|
+
}
|
|
2286
2338
|
}
|
|
2287
|
-
|
|
2339
|
+
: void 0,
|
|
2288
2340
|
});
|
|
2289
2341
|
}
|
|
2290
2342
|
Object.defineProperty(ApolloClient.prototype, "documentTransform", {
|
|
@@ -2302,9 +2354,9 @@ var ApolloClient = (function () {
|
|
|
2302
2354
|
options = utilities.mergeOptions(this.defaultOptions.watchQuery, options);
|
|
2303
2355
|
}
|
|
2304
2356
|
if (this.disableNetworkFetches &&
|
|
2305
|
-
(options.fetchPolicy ===
|
|
2306
|
-
options.fetchPolicy ===
|
|
2307
|
-
options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy:
|
|
2357
|
+
(options.fetchPolicy === "network-only" ||
|
|
2358
|
+
options.fetchPolicy === "cache-and-network")) {
|
|
2359
|
+
options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: "cache-first" });
|
|
2308
2360
|
}
|
|
2309
2361
|
return this.queryManager.watchQuery(options);
|
|
2310
2362
|
};
|
|
@@ -2312,9 +2364,9 @@ var ApolloClient = (function () {
|
|
|
2312
2364
|
if (this.defaultOptions.query) {
|
|
2313
2365
|
options = utilities.mergeOptions(this.defaultOptions.query, options);
|
|
2314
2366
|
}
|
|
2315
|
-
globals.invariant(options.fetchPolicy !==
|
|
2316
|
-
if (this.disableNetworkFetches && options.fetchPolicy ===
|
|
2317
|
-
options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy:
|
|
2367
|
+
globals.invariant(options.fetchPolicy !== "cache-and-network", 14);
|
|
2368
|
+
if (this.disableNetworkFetches && options.fetchPolicy === "network-only") {
|
|
2369
|
+
options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: "cache-first" });
|
|
2318
2370
|
}
|
|
2319
2371
|
return this.queryManager.query(options);
|
|
2320
2372
|
};
|
|
@@ -2358,18 +2410,22 @@ var ApolloClient = (function () {
|
|
|
2358
2410
|
ApolloClient.prototype.resetStore = function () {
|
|
2359
2411
|
var _this = this;
|
|
2360
2412
|
return Promise.resolve()
|
|
2361
|
-
.then(function () {
|
|
2362
|
-
|
|
2363
|
-
|
|
2413
|
+
.then(function () {
|
|
2414
|
+
return _this.queryManager.clearStore({
|
|
2415
|
+
discardWatches: false,
|
|
2416
|
+
});
|
|
2417
|
+
})
|
|
2364
2418
|
.then(function () { return Promise.all(_this.resetStoreCallbacks.map(function (fn) { return fn(); })); })
|
|
2365
2419
|
.then(function () { return _this.reFetchObservableQueries(); });
|
|
2366
2420
|
};
|
|
2367
2421
|
ApolloClient.prototype.clearStore = function () {
|
|
2368
2422
|
var _this = this;
|
|
2369
2423
|
return Promise.resolve()
|
|
2370
|
-
.then(function () {
|
|
2371
|
-
|
|
2372
|
-
|
|
2424
|
+
.then(function () {
|
|
2425
|
+
return _this.queryManager.clearStore({
|
|
2426
|
+
discardWatches: true,
|
|
2427
|
+
});
|
|
2428
|
+
})
|
|
2373
2429
|
.then(function () { return Promise.all(_this.clearStoreCallbacks.map(function (fn) { return fn(); })); });
|
|
2374
2430
|
};
|
|
2375
2431
|
ApolloClient.prototype.onResetStore = function (cb) {
|