@apollo/client 3.4.17 → 3.5.6
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/README.md +1 -1
- package/{apollo-client.cjs.js → apollo-client.cjs} +1219 -1280
- package/apollo-client.cjs.map +1 -0
- package/apollo-client.min.cjs +1 -0
- package/cache/{cache.cjs.js → cache.cjs} +757 -601
- package/cache/cache.cjs.map +1 -0
- package/cache/core/cache.d.ts +6 -4
- package/cache/core/cache.d.ts.map +1 -1
- package/cache/core/cache.js +28 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +12 -10
- package/cache/core/types/Cache.d.ts.map +1 -1
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +4 -0
- 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 +8 -5
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/core/types/common.js +6 -11
- package/cache/core/types/common.js.map +1 -1
- package/cache/inmemory/helpers.js +1 -1
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +4 -4
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js +12 -3
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.d.ts +9 -0
- package/cache/inmemory/key-extractor.d.ts.map +1 -0
- package/cache/inmemory/key-extractor.js +118 -0
- package/cache/inmemory/key-extractor.js.map +1 -0
- package/cache/inmemory/policies.d.ts +7 -3
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +47 -118
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +2 -2
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +54 -42
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +8 -3
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js +166 -95
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/cache/package.json +2 -1
- package/core/ApolloClient.d.ts +0 -1
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +3 -3
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js +1 -1
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +2 -2
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +19 -14
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +2 -2
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +0 -1
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +10 -10
- package/core/QueryManager.js.map +1 -1
- package/core/{core.cjs.js → core.cjs} +38 -34
- package/core/core.cjs.map +1 -0
- package/core/package.json +2 -1
- package/errors/{errors.cjs.js → errors.cjs} +3 -3
- package/errors/errors.cjs.map +1 -0
- package/errors/index.d.ts +3 -1
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js +2 -2
- package/errors/index.js.map +1 -1
- package/errors/package.json +2 -1
- package/invariantErrorCodes.js +84 -104
- package/link/batch/{batch.cjs.js → batch.cjs} +2 -2
- package/link/batch/batch.cjs.map +1 -0
- package/link/batch/batchLink.d.ts +0 -1
- package/link/batch/batchLink.d.ts.map +1 -1
- package/link/batch/batching.d.ts +0 -1
- package/link/batch/batching.d.ts.map +1 -1
- package/link/batch/batching.js +1 -1
- package/link/batch/batching.js.map +1 -1
- package/link/batch/package.json +2 -1
- package/link/batch-http/{batch-http.cjs.js → batch-http.cjs} +3 -3
- package/link/batch-http/batch-http.cjs.map +1 -0
- package/link/batch-http/batchHttpLink.d.ts +0 -1
- package/link/batch-http/batchHttpLink.d.ts.map +1 -1
- package/link/batch-http/batchHttpLink.js +3 -3
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/batch-http/package.json +2 -1
- package/link/context/{context.cjs.js → context.cjs} +1 -1
- package/link/context/context.cjs.map +1 -0
- package/link/context/index.js.map +1 -1
- package/link/context/package.json +2 -1
- package/link/core/ApolloLink.d.ts +2 -3
- package/link/core/ApolloLink.d.ts.map +1 -1
- package/link/core/ApolloLink.js +1 -1
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/{core.cjs.js → core.cjs} +2 -2
- package/link/core/core.cjs.map +1 -0
- package/link/core/package.json +2 -1
- package/link/core/types.d.ts +4 -7
- package/link/core/types.d.ts.map +1 -1
- package/link/core/types.js.map +1 -1
- package/link/error/{error.cjs.js → error.cjs} +2 -2
- package/link/error/error.cjs.map +1 -0
- package/link/error/index.d.ts +5 -7
- package/link/error/index.d.ts.map +1 -1
- package/link/error/index.js +1 -1
- package/link/error/index.js.map +1 -1
- package/link/error/package.json +2 -1
- package/link/http/checkFetcher.js +1 -1
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js +3 -3
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/{http.cjs.js → http.cjs} +28 -15
- package/link/http/http.cjs.map +1 -0
- package/link/http/index.d.ts +1 -1
- package/link/http/index.d.ts.map +1 -1
- package/link/http/index.js +1 -1
- package/link/http/index.js.map +1 -1
- package/link/http/package.json +2 -1
- package/link/http/parseAndCheckHttpResponse.js +3 -3
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/rewriteURIForGET.js +1 -1
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +11 -1
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +20 -7
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +3 -3
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/package.json +2 -1
- package/link/persisted-queries/{persisted-queries.cjs.js → persisted-queries.cjs} +3 -3
- package/link/persisted-queries/persisted-queries.cjs.map +1 -0
- package/link/retry/package.json +2 -1
- package/link/retry/{retry.cjs.js → retry.cjs} +1 -1
- package/link/retry/retry.cjs.map +1 -0
- package/link/retry/retryLink.d.ts +0 -1
- package/link/retry/retryLink.d.ts.map +1 -1
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +0 -1
- package/link/schema/index.d.ts.map +1 -1
- package/link/schema/index.js +8 -1
- package/link/schema/index.js.map +1 -1
- package/link/schema/package.json +2 -1
- package/link/schema/{schema.cjs.js → schema.cjs} +9 -2
- package/link/schema/schema.cjs.map +1 -0
- package/link/utils/fromError.d.ts +0 -1
- package/link/utils/fromError.d.ts.map +1 -1
- package/link/utils/fromPromise.d.ts +0 -1
- package/link/utils/fromPromise.d.ts.map +1 -1
- package/link/utils/package.json +2 -1
- package/link/utils/toPromise.d.ts +0 -1
- package/link/utils/toPromise.d.ts.map +1 -1
- package/link/utils/{utils.cjs.js → utils.cjs} +2 -2
- package/link/utils/utils.cjs.map +1 -0
- package/link/utils/validateOperation.js +1 -1
- package/link/utils/validateOperation.js.map +1 -1
- package/link/ws/index.d.ts +0 -1
- package/link/ws/index.d.ts.map +1 -1
- package/link/ws/package.json +2 -1
- package/link/ws/{ws.cjs.js → ws.cjs} +1 -1
- package/link/ws/ws.cjs.map +1 -0
- package/{main.cjs.js → main.cjs} +5 -5
- package/main.cjs.map +1 -0
- package/package.json +20 -19
- package/react/components/Query.js.map +1 -1
- package/react/components/{components.cjs.js → components.cjs} +4 -4
- package/react/components/components.cjs.map +1 -0
- package/react/components/package.json +2 -1
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/{context.cjs.js → context.cjs} +6 -6
- package/react/context/context.cjs.map +1 -0
- package/react/context/index.d.ts +3 -3
- package/react/context/index.d.ts.map +1 -1
- package/react/context/index.js +3 -3
- package/react/context/index.js.map +1 -1
- package/react/context/package.json +2 -1
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/{hoc.cjs.js → hoc.cjs} +12 -12
- package/react/hoc/hoc.cjs.map +1 -0
- package/react/hoc/mutation-hoc.js +2 -2
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/package.json +2 -1
- package/react/hoc/query-hoc.js +1 -1
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.js +1 -1
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/withApollo.js +2 -2
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs +502 -0
- package/react/hooks/hooks.cjs.map +1 -0
- package/react/hooks/package.json +2 -1
- package/react/hooks/useApolloClient.d.ts +1 -1
- package/react/hooks/useApolloClient.d.ts.map +1 -1
- package/react/hooks/useApolloClient.js +7 -5
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts.map +1 -1
- package/react/hooks/useLazyQuery.js +56 -2
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts.map +1 -1
- package/react/hooks/useMutation.js +89 -21
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +2 -3
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +224 -2
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +2 -7
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +89 -32
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/package.json +2 -1
- package/react/parser/index.d.ts +1 -0
- package/react/parser/index.d.ts.map +1 -1
- package/react/parser/index.js +16 -9
- package/react/parser/index.js.map +1 -1
- package/react/parser/package.json +2 -1
- package/react/parser/{parser.cjs.js → parser.cjs} +18 -10
- package/react/parser/parser.cjs.map +1 -0
- package/react/{react.cjs.js → react.cjs} +3 -3
- package/react/react.cjs.map +1 -0
- package/react/ssr/RenderPromises.d.ts +7 -3
- package/react/ssr/RenderPromises.d.ts.map +1 -1
- package/react/ssr/RenderPromises.js.map +1 -1
- package/react/ssr/package.json +2 -1
- package/react/ssr/{ssr.cjs.js → ssr.cjs} +4 -4
- package/react/ssr/ssr.cjs.map +1 -0
- package/react/types/types.d.ts +7 -18
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/{testing.cjs.js → core/core.cjs} +10 -104
- package/testing/core/core.cjs.map +1 -0
- package/{utilities/testing → testing/core}/index.d.ts +0 -1
- package/testing/core/index.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/index.js +0 -1
- package/testing/core/index.js.map +1 -0
- package/{utilities/testing → testing/core}/itAsync.d.ts +0 -0
- package/testing/core/itAsync.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/itAsync.js +0 -0
- package/testing/core/itAsync.js.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockClient.d.ts +0 -0
- package/testing/core/mocking/mockClient.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockClient.js +0 -0
- package/testing/core/mocking/mockClient.js.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockFetch.d.ts +0 -0
- package/testing/core/mocking/mockFetch.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockFetch.js +1 -1
- package/testing/core/mocking/mockFetch.js.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockLink.d.ts +0 -1
- package/testing/core/mocking/mockLink.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockLink.js +5 -5
- package/testing/core/mocking/mockLink.js.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockQueryManager.d.ts +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockQueryManager.js +1 -1
- package/testing/core/mocking/mockQueryManager.js.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockSubscriptionLink.d.ts +1 -4
- package/testing/core/mocking/mockSubscriptionLink.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockSubscriptionLink.js +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockWatchQuery.d.ts +1 -1
- package/testing/core/mocking/mockWatchQuery.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockWatchQuery.js +0 -0
- package/testing/core/mocking/mockWatchQuery.js.map +1 -0
- package/{utilities/testing → testing/core}/observableToPromise.d.ts +2 -3
- package/testing/core/observableToPromise.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/observableToPromise.js +1 -1
- package/testing/core/observableToPromise.js.map +1 -0
- package/testing/core/package.json +8 -0
- package/testing/core/subscribeAndCount.d.ts +4 -0
- package/testing/core/subscribeAndCount.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/subscribeAndCount.js +1 -1
- package/testing/core/subscribeAndCount.js.map +1 -0
- package/{utilities/testing → testing/core}/withConsoleSpy.d.ts +0 -0
- package/testing/core/withConsoleSpy.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/withConsoleSpy.js +0 -0
- package/testing/core/withConsoleSpy.js.map +1 -0
- package/{utilities/testing → testing/core}/wrap.d.ts +0 -0
- package/testing/core/wrap.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/wrap.js +0 -0
- package/testing/core/wrap.js.map +1 -0
- package/testing/index.d.ts +2 -1
- package/testing/index.d.ts.map +1 -1
- package/testing/index.js +2 -1
- package/testing/index.js.map +1 -1
- package/testing/package.json +2 -1
- package/{utilities/testing/mocking → testing/react}/MockedProvider.d.ts +5 -5
- package/testing/react/MockedProvider.d.ts.map +1 -0
- package/{utilities/testing/mocking → testing/react}/MockedProvider.js +4 -4
- package/testing/react/MockedProvider.js.map +1 -0
- package/testing/testing.cjs +58 -0
- package/testing/testing.cjs.map +1 -0
- package/utilities/common/errorHandling.d.ts +1 -1
- package/utilities/common/errorHandling.d.ts.map +1 -1
- package/utilities/common/errorHandling.js.map +1 -1
- package/utilities/common/makeUniqueId.js +1 -1
- package/utilities/common/makeUniqueId.js.map +1 -1
- package/utilities/common/mergeDeep.d.ts.map +1 -1
- package/utilities/common/mergeDeep.js +6 -1
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/globals/fix-graphql.js +1 -1
- package/utilities/globals/global.d.ts.map +1 -1
- package/utilities/globals/global.js +1 -1
- package/utilities/globals/global.js.map +1 -1
- package/utilities/globals/{globals.cjs.js → globals.cjs} +3 -3
- package/utilities/globals/globals.cjs.map +1 -0
- package/utilities/globals/index.js +1 -1
- package/utilities/globals/package.json +2 -1
- package/utilities/graphql/directives.js +5 -5
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts.map +1 -1
- package/utilities/graphql/fragments.js +4 -4
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/storeUtils.js +6 -6
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/observables/Concast.d.ts +0 -1
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/asyncMap.d.ts +0 -1
- package/utilities/observables/asyncMap.d.ts.map +1 -1
- package/utilities/observables/subclassing.d.ts +0 -1
- package/utilities/observables/subclassing.d.ts.map +1 -1
- package/utilities/package.json +2 -1
- package/utilities/{utilities.cjs.js → utilities.cjs} +31 -26
- package/utilities/utilities.cjs.map +1 -0
- package/version.js +1 -1
- package/apollo-client.cjs.js.map +0 -1
- package/apollo-client.cjs.min.js +0 -1
- package/cache/cache.cjs.js.map +0 -1
- package/core/core.cjs.js.map +0 -1
- package/errors/errors.cjs.js.map +0 -1
- package/link/batch/batch.cjs.js.map +0 -1
- package/link/batch-http/batch-http.cjs.js.map +0 -1
- package/link/context/context.cjs.js.map +0 -1
- package/link/core/core.cjs.js.map +0 -1
- package/link/error/error.cjs.js.map +0 -1
- package/link/http/http.cjs.js.map +0 -1
- package/link/persisted-queries/persisted-queries.cjs.js.map +0 -1
- package/link/retry/retry.cjs.js.map +0 -1
- package/link/schema/schema.cjs.js.map +0 -1
- package/link/utils/utils.cjs.js.map +0 -1
- package/link/ws/ws.cjs.js.map +0 -1
- package/main.cjs.js.map +0 -1
- package/react/components/components.cjs.js.map +0 -1
- package/react/context/context.cjs.js.map +0 -1
- package/react/data/MutationData.d.ts +0 -29
- package/react/data/MutationData.d.ts.map +0 -1
- package/react/data/MutationData.js +0 -115
- package/react/data/MutationData.js.map +0 -1
- package/react/data/OperationData.d.ts +0 -24
- package/react/data/OperationData.d.ts.map +0 -1
- package/react/data/OperationData.js +0 -53
- package/react/data/OperationData.js.map +0 -1
- package/react/data/QueryData.d.ts +0 -44
- package/react/data/QueryData.d.ts.map +0 -1
- package/react/data/QueryData.js +0 -298
- package/react/data/QueryData.js.map +0 -1
- package/react/data/SubscriptionData.d.ts +0 -28
- package/react/data/SubscriptionData.d.ts.map +0 -1
- package/react/data/SubscriptionData.js +0 -122
- package/react/data/SubscriptionData.js.map +0 -1
- package/react/data/data.cjs.js +0 -581
- package/react/data/data.cjs.js.map +0 -1
- package/react/data/index.d.ts +0 -6
- package/react/data/index.d.ts.map +0 -1
- package/react/data/index.js +0 -6
- package/react/data/index.js.map +0 -1
- package/react/data/package.json +0 -7
- package/react/hoc/hoc.cjs.js.map +0 -1
- package/react/hooks/hooks.cjs.js +0 -195
- package/react/hooks/hooks.cjs.js.map +0 -1
- package/react/hooks/utils/useAfterFastRefresh.d.ts +0 -3
- package/react/hooks/utils/useAfterFastRefresh.d.ts.map +0 -1
- package/react/hooks/utils/useAfterFastRefresh.js +0 -19
- package/react/hooks/utils/useAfterFastRefresh.js.map +0 -1
- package/react/hooks/utils/useBaseQuery.d.ts +0 -7
- package/react/hooks/utils/useBaseQuery.d.ts.map +0 -1
- package/react/hooks/utils/useBaseQuery.js +0 -55
- package/react/hooks/utils/useBaseQuery.js.map +0 -1
- package/react/hooks/utils/useDeepMemo.d.ts +0 -2
- package/react/hooks/utils/useDeepMemo.d.ts.map +0 -1
- package/react/hooks/utils/useDeepMemo.js +0 -10
- package/react/hooks/utils/useDeepMemo.js.map +0 -1
- package/react/parser/parser.cjs.js.map +0 -1
- package/react/react.cjs.js.map +0 -1
- package/react/ssr/ssr.cjs.js.map +0 -1
- package/testing/testing.cjs.js.map +0 -1
- package/utilities/globals/globals.cjs.js.map +0 -1
- package/utilities/testing/index.d.ts.map +0 -1
- package/utilities/testing/index.js.map +0 -1
- package/utilities/testing/itAsync.d.ts.map +0 -1
- package/utilities/testing/itAsync.js.map +0 -1
- package/utilities/testing/mocking/MockedProvider.d.ts.map +0 -1
- package/utilities/testing/mocking/MockedProvider.js.map +0 -1
- package/utilities/testing/mocking/mockClient.d.ts.map +0 -1
- package/utilities/testing/mocking/mockClient.js.map +0 -1
- package/utilities/testing/mocking/mockFetch.d.ts.map +0 -1
- package/utilities/testing/mocking/mockFetch.js.map +0 -1
- package/utilities/testing/mocking/mockLink.d.ts.map +0 -1
- package/utilities/testing/mocking/mockLink.js.map +0 -1
- package/utilities/testing/mocking/mockQueryManager.d.ts.map +0 -1
- package/utilities/testing/mocking/mockQueryManager.js.map +0 -1
- package/utilities/testing/mocking/mockSubscriptionLink.d.ts.map +0 -1
- package/utilities/testing/mocking/mockSubscriptionLink.js.map +0 -1
- package/utilities/testing/mocking/mockWatchQuery.d.ts.map +0 -1
- package/utilities/testing/mocking/mockWatchQuery.js.map +0 -1
- package/utilities/testing/observableToPromise.d.ts.map +0 -1
- package/utilities/testing/observableToPromise.js.map +0 -1
- package/utilities/testing/subscribeAndCount.d.ts +0 -5
- package/utilities/testing/subscribeAndCount.d.ts.map +0 -1
- package/utilities/testing/subscribeAndCount.js.map +0 -1
- package/utilities/testing/withConsoleSpy.d.ts.map +0 -1
- package/utilities/testing/withConsoleSpy.js.map +0 -1
- package/utilities/testing/wrap.d.ts.map +0 -1
- package/utilities/testing/wrap.js.map +0 -1
- package/utilities/utilities.cjs.js.map +0 -1
package/react/data/data.cjs.js
DELETED
|
@@ -1,581 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var globals = require('../../utilities/globals');
|
|
6
|
-
var tslib = require('tslib');
|
|
7
|
-
var equality = require('@wry/equality');
|
|
8
|
-
var parser = require('../parser');
|
|
9
|
-
var errors = require('../../errors');
|
|
10
|
-
var core = require('../../core');
|
|
11
|
-
|
|
12
|
-
var OperationData = (function () {
|
|
13
|
-
function OperationData(options, context) {
|
|
14
|
-
this.isMounted = false;
|
|
15
|
-
this.previousOptions = {};
|
|
16
|
-
this.context = {};
|
|
17
|
-
this.options = {};
|
|
18
|
-
this.options = options || {};
|
|
19
|
-
this.context = context || {};
|
|
20
|
-
}
|
|
21
|
-
OperationData.prototype.getOptions = function () {
|
|
22
|
-
return this.options;
|
|
23
|
-
};
|
|
24
|
-
OperationData.prototype.setOptions = function (newOptions, storePrevious) {
|
|
25
|
-
if (storePrevious === void 0) { storePrevious = false; }
|
|
26
|
-
if (storePrevious && !equality.equal(this.options, newOptions)) {
|
|
27
|
-
this.previousOptions = this.options;
|
|
28
|
-
}
|
|
29
|
-
this.options = newOptions;
|
|
30
|
-
};
|
|
31
|
-
OperationData.prototype.unmount = function () {
|
|
32
|
-
this.isMounted = false;
|
|
33
|
-
};
|
|
34
|
-
OperationData.prototype.refreshClient = function () {
|
|
35
|
-
var client = (this.options && this.options.client) ||
|
|
36
|
-
(this.context && this.context.client);
|
|
37
|
-
__DEV__ ? globals.invariant(!!client, 'Could not find "client" in the context or passed in as an option. ' +
|
|
38
|
-
'Wrap the root component in an <ApolloProvider>, or pass an ' +
|
|
39
|
-
'ApolloClient instance in via options.') : globals.invariant(!!client, 29);
|
|
40
|
-
var isNew = false;
|
|
41
|
-
if (client !== this.client) {
|
|
42
|
-
isNew = true;
|
|
43
|
-
this.client = client;
|
|
44
|
-
this.cleanup();
|
|
45
|
-
}
|
|
46
|
-
return {
|
|
47
|
-
client: this.client,
|
|
48
|
-
isNew: isNew
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
OperationData.prototype.verifyDocumentType = function (document, type) {
|
|
52
|
-
var operation = parser.parser(document);
|
|
53
|
-
var requiredOperationName = parser.operationName(type);
|
|
54
|
-
var usedOperationName = parser.operationName(operation.type);
|
|
55
|
-
__DEV__ ? globals.invariant(operation.type === type, "Running a " + requiredOperationName + " requires a graphql " +
|
|
56
|
-
(requiredOperationName + ", but a " + usedOperationName + " was used instead.")) : globals.invariant(operation.type === type, 30);
|
|
57
|
-
};
|
|
58
|
-
return OperationData;
|
|
59
|
-
}());
|
|
60
|
-
|
|
61
|
-
var SubscriptionData = (function (_super) {
|
|
62
|
-
tslib.__extends(SubscriptionData, _super);
|
|
63
|
-
function SubscriptionData(_a) {
|
|
64
|
-
var options = _a.options, context = _a.context, setResult = _a.setResult;
|
|
65
|
-
var _this = _super.call(this, options, context) || this;
|
|
66
|
-
_this.currentObservable = {};
|
|
67
|
-
_this.setResult = setResult;
|
|
68
|
-
_this.initialize(options);
|
|
69
|
-
return _this;
|
|
70
|
-
}
|
|
71
|
-
SubscriptionData.prototype.execute = function (result) {
|
|
72
|
-
if (this.getOptions().skip === true) {
|
|
73
|
-
this.cleanup();
|
|
74
|
-
return {
|
|
75
|
-
loading: false,
|
|
76
|
-
error: undefined,
|
|
77
|
-
data: undefined,
|
|
78
|
-
variables: this.getOptions().variables
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
var currentResult = result;
|
|
82
|
-
if (this.refreshClient().isNew) {
|
|
83
|
-
currentResult = this.getLoadingResult();
|
|
84
|
-
}
|
|
85
|
-
var shouldResubscribe = this.getOptions().shouldResubscribe;
|
|
86
|
-
if (typeof shouldResubscribe === 'function') {
|
|
87
|
-
shouldResubscribe = !!shouldResubscribe(this.getOptions());
|
|
88
|
-
}
|
|
89
|
-
if (shouldResubscribe !== false &&
|
|
90
|
-
this.previousOptions &&
|
|
91
|
-
Object.keys(this.previousOptions).length > 0 &&
|
|
92
|
-
(this.previousOptions.subscription !== this.getOptions().subscription ||
|
|
93
|
-
!equality.equal(this.previousOptions.variables, this.getOptions().variables) ||
|
|
94
|
-
this.previousOptions.skip !== this.getOptions().skip)) {
|
|
95
|
-
this.cleanup();
|
|
96
|
-
currentResult = this.getLoadingResult();
|
|
97
|
-
}
|
|
98
|
-
this.initialize(this.getOptions());
|
|
99
|
-
this.startSubscription();
|
|
100
|
-
this.previousOptions = this.getOptions();
|
|
101
|
-
return tslib.__assign(tslib.__assign({}, currentResult), { variables: this.getOptions().variables });
|
|
102
|
-
};
|
|
103
|
-
SubscriptionData.prototype.afterExecute = function () {
|
|
104
|
-
this.isMounted = true;
|
|
105
|
-
};
|
|
106
|
-
SubscriptionData.prototype.cleanup = function () {
|
|
107
|
-
this.endSubscription();
|
|
108
|
-
delete this.currentObservable.query;
|
|
109
|
-
};
|
|
110
|
-
SubscriptionData.prototype.initialize = function (options) {
|
|
111
|
-
if (this.currentObservable.query || this.getOptions().skip === true)
|
|
112
|
-
return;
|
|
113
|
-
this.currentObservable.query = this.refreshClient().client.subscribe({
|
|
114
|
-
query: options.subscription,
|
|
115
|
-
variables: options.variables,
|
|
116
|
-
fetchPolicy: options.fetchPolicy,
|
|
117
|
-
context: options.context,
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
SubscriptionData.prototype.startSubscription = function () {
|
|
121
|
-
if (this.currentObservable.subscription)
|
|
122
|
-
return;
|
|
123
|
-
this.currentObservable.subscription = this.currentObservable.query.subscribe({
|
|
124
|
-
next: this.updateCurrentData.bind(this),
|
|
125
|
-
error: this.updateError.bind(this),
|
|
126
|
-
complete: this.completeSubscription.bind(this)
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
SubscriptionData.prototype.getLoadingResult = function () {
|
|
130
|
-
return {
|
|
131
|
-
loading: true,
|
|
132
|
-
error: undefined,
|
|
133
|
-
data: undefined
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
SubscriptionData.prototype.updateResult = function (result) {
|
|
137
|
-
if (this.isMounted) {
|
|
138
|
-
this.setResult(result);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
SubscriptionData.prototype.updateCurrentData = function (result) {
|
|
142
|
-
var onSubscriptionData = this.getOptions().onSubscriptionData;
|
|
143
|
-
this.updateResult({
|
|
144
|
-
data: result.data,
|
|
145
|
-
loading: false,
|
|
146
|
-
error: undefined
|
|
147
|
-
});
|
|
148
|
-
if (onSubscriptionData) {
|
|
149
|
-
onSubscriptionData({
|
|
150
|
-
client: this.refreshClient().client,
|
|
151
|
-
subscriptionData: result
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
SubscriptionData.prototype.updateError = function (error) {
|
|
156
|
-
this.updateResult({
|
|
157
|
-
error: error,
|
|
158
|
-
loading: false
|
|
159
|
-
});
|
|
160
|
-
};
|
|
161
|
-
SubscriptionData.prototype.completeSubscription = function () {
|
|
162
|
-
var _this = this;
|
|
163
|
-
Promise.resolve().then(function () {
|
|
164
|
-
var onSubscriptionComplete = _this.getOptions().onSubscriptionComplete;
|
|
165
|
-
if (onSubscriptionComplete)
|
|
166
|
-
onSubscriptionComplete();
|
|
167
|
-
_this.endSubscription();
|
|
168
|
-
});
|
|
169
|
-
};
|
|
170
|
-
SubscriptionData.prototype.endSubscription = function () {
|
|
171
|
-
if (this.currentObservable.subscription) {
|
|
172
|
-
this.currentObservable.subscription.unsubscribe();
|
|
173
|
-
delete this.currentObservable.subscription;
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
return SubscriptionData;
|
|
177
|
-
}(OperationData));
|
|
178
|
-
|
|
179
|
-
var MutationData = (function (_super) {
|
|
180
|
-
tslib.__extends(MutationData, _super);
|
|
181
|
-
function MutationData(_a) {
|
|
182
|
-
var options = _a.options, context = _a.context, result = _a.result, setResult = _a.setResult;
|
|
183
|
-
var _this = _super.call(this, options, context) || this;
|
|
184
|
-
_this.runMutation = function (mutationFunctionOptions) {
|
|
185
|
-
if (mutationFunctionOptions === void 0) { mutationFunctionOptions = {}; }
|
|
186
|
-
_this.onMutationStart();
|
|
187
|
-
var mutationId = _this.generateNewMutationId();
|
|
188
|
-
return _this.mutate(mutationFunctionOptions)
|
|
189
|
-
.then(function (response) {
|
|
190
|
-
_this.onMutationCompleted(response, mutationId);
|
|
191
|
-
return response;
|
|
192
|
-
})
|
|
193
|
-
.catch(function (error) {
|
|
194
|
-
var onError = _this.getOptions().onError;
|
|
195
|
-
_this.onMutationError(error, mutationId);
|
|
196
|
-
if (onError) {
|
|
197
|
-
onError(error);
|
|
198
|
-
return {
|
|
199
|
-
data: undefined,
|
|
200
|
-
errors: error,
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
throw error;
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
};
|
|
208
|
-
_this.verifyDocumentType(options.mutation, parser.DocumentType.Mutation);
|
|
209
|
-
_this.result = result;
|
|
210
|
-
_this.setResult = setResult;
|
|
211
|
-
_this.mostRecentMutationId = 0;
|
|
212
|
-
return _this;
|
|
213
|
-
}
|
|
214
|
-
MutationData.prototype.execute = function (result) {
|
|
215
|
-
this.isMounted = true;
|
|
216
|
-
this.verifyDocumentType(this.getOptions().mutation, parser.DocumentType.Mutation);
|
|
217
|
-
return [
|
|
218
|
-
this.runMutation,
|
|
219
|
-
tslib.__assign(tslib.__assign({}, result), { client: this.refreshClient().client })
|
|
220
|
-
];
|
|
221
|
-
};
|
|
222
|
-
MutationData.prototype.afterExecute = function () {
|
|
223
|
-
this.isMounted = true;
|
|
224
|
-
return this.unmount.bind(this);
|
|
225
|
-
};
|
|
226
|
-
MutationData.prototype.cleanup = function () {
|
|
227
|
-
};
|
|
228
|
-
MutationData.prototype.mutate = function (options) {
|
|
229
|
-
return this.refreshClient().client.mutate(core.mergeOptions(this.getOptions(), options));
|
|
230
|
-
};
|
|
231
|
-
MutationData.prototype.onMutationStart = function () {
|
|
232
|
-
if (!this.result.loading && !this.getOptions().ignoreResults) {
|
|
233
|
-
this.updateResult({
|
|
234
|
-
loading: true,
|
|
235
|
-
error: undefined,
|
|
236
|
-
data: undefined,
|
|
237
|
-
called: true
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
MutationData.prototype.onMutationCompleted = function (response, mutationId) {
|
|
242
|
-
var _a = this.getOptions(), onCompleted = _a.onCompleted, ignoreResults = _a.ignoreResults;
|
|
243
|
-
var data = response.data, errors$1 = response.errors;
|
|
244
|
-
var error = errors$1 && errors$1.length > 0
|
|
245
|
-
? new errors.ApolloError({ graphQLErrors: errors$1 })
|
|
246
|
-
: undefined;
|
|
247
|
-
var callOncomplete = function () {
|
|
248
|
-
return onCompleted ? onCompleted(data) : null;
|
|
249
|
-
};
|
|
250
|
-
if (this.isMostRecentMutation(mutationId) && !ignoreResults) {
|
|
251
|
-
this.updateResult({
|
|
252
|
-
called: true,
|
|
253
|
-
loading: false,
|
|
254
|
-
data: data,
|
|
255
|
-
error: error
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
callOncomplete();
|
|
259
|
-
};
|
|
260
|
-
MutationData.prototype.onMutationError = function (error, mutationId) {
|
|
261
|
-
if (this.isMostRecentMutation(mutationId)) {
|
|
262
|
-
this.updateResult({
|
|
263
|
-
loading: false,
|
|
264
|
-
error: error,
|
|
265
|
-
data: undefined,
|
|
266
|
-
called: true
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
MutationData.prototype.generateNewMutationId = function () {
|
|
271
|
-
return ++this.mostRecentMutationId;
|
|
272
|
-
};
|
|
273
|
-
MutationData.prototype.isMostRecentMutation = function (mutationId) {
|
|
274
|
-
return this.mostRecentMutationId === mutationId;
|
|
275
|
-
};
|
|
276
|
-
MutationData.prototype.updateResult = function (result) {
|
|
277
|
-
if (this.isMounted &&
|
|
278
|
-
(!this.previousResult || !equality.equal(this.previousResult, result))) {
|
|
279
|
-
this.setResult(result);
|
|
280
|
-
this.previousResult = result;
|
|
281
|
-
return result;
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
return MutationData;
|
|
285
|
-
}(OperationData));
|
|
286
|
-
|
|
287
|
-
var QueryData = (function (_super) {
|
|
288
|
-
tslib.__extends(QueryData, _super);
|
|
289
|
-
function QueryData(_a) {
|
|
290
|
-
var options = _a.options, context = _a.context, onNewData = _a.onNewData;
|
|
291
|
-
var _this = _super.call(this, options, context) || this;
|
|
292
|
-
_this.runLazy = false;
|
|
293
|
-
_this.previous = Object.create(null);
|
|
294
|
-
_this.runLazyQuery = function (options) {
|
|
295
|
-
_this.cleanup();
|
|
296
|
-
_this.runLazy = true;
|
|
297
|
-
_this.lazyOptions = options;
|
|
298
|
-
_this.onNewData();
|
|
299
|
-
};
|
|
300
|
-
_this.obsRefetch = function (variables) { var _a; return (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.refetch(variables); };
|
|
301
|
-
_this.obsFetchMore = function (fetchMoreOptions) { var _a; return (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.fetchMore(fetchMoreOptions); };
|
|
302
|
-
_this.obsUpdateQuery = function (mapFn) { var _a; return (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.updateQuery(mapFn); };
|
|
303
|
-
_this.obsStartPolling = function (pollInterval) {
|
|
304
|
-
var _a;
|
|
305
|
-
(_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.startPolling(pollInterval);
|
|
306
|
-
};
|
|
307
|
-
_this.obsStopPolling = function () {
|
|
308
|
-
var _a;
|
|
309
|
-
(_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.stopPolling();
|
|
310
|
-
};
|
|
311
|
-
_this.obsSubscribeToMore = function (options) { var _a; return (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.subscribeToMore(options); };
|
|
312
|
-
_this.onNewData = onNewData;
|
|
313
|
-
return _this;
|
|
314
|
-
}
|
|
315
|
-
QueryData.prototype.execute = function () {
|
|
316
|
-
this.refreshClient();
|
|
317
|
-
var _a = this.getOptions(), skip = _a.skip, query = _a.query;
|
|
318
|
-
if (skip || query !== this.previous.query) {
|
|
319
|
-
this.removeQuerySubscription();
|
|
320
|
-
this.removeObservable(!skip);
|
|
321
|
-
this.previous.query = query;
|
|
322
|
-
}
|
|
323
|
-
this.updateObservableQuery();
|
|
324
|
-
return this.getExecuteSsrResult() || this.getExecuteResult();
|
|
325
|
-
};
|
|
326
|
-
QueryData.prototype.executeLazy = function () {
|
|
327
|
-
return !this.runLazy
|
|
328
|
-
? [
|
|
329
|
-
this.runLazyQuery,
|
|
330
|
-
{
|
|
331
|
-
loading: false,
|
|
332
|
-
networkStatus: core.NetworkStatus.ready,
|
|
333
|
-
called: false,
|
|
334
|
-
data: undefined
|
|
335
|
-
}
|
|
336
|
-
]
|
|
337
|
-
: [this.runLazyQuery, this.execute()];
|
|
338
|
-
};
|
|
339
|
-
QueryData.prototype.fetchData = function () {
|
|
340
|
-
var _this = this;
|
|
341
|
-
var options = this.getOptions();
|
|
342
|
-
if (options.skip || options.ssr === false)
|
|
343
|
-
return false;
|
|
344
|
-
return new Promise(function (resolve) { return _this.startQuerySubscription(resolve); });
|
|
345
|
-
};
|
|
346
|
-
QueryData.prototype.afterExecute = function (_a) {
|
|
347
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.lazy, lazy = _c === void 0 ? false : _c;
|
|
348
|
-
this.isMounted = true;
|
|
349
|
-
var options = this.getOptions();
|
|
350
|
-
if (this.currentObservable && !this.ssrInitiated()) {
|
|
351
|
-
this.startQuerySubscription();
|
|
352
|
-
}
|
|
353
|
-
if (!lazy || this.runLazy) {
|
|
354
|
-
this.handleErrorOrCompleted();
|
|
355
|
-
}
|
|
356
|
-
this.previousOptions = options;
|
|
357
|
-
return this.unmount.bind(this);
|
|
358
|
-
};
|
|
359
|
-
QueryData.prototype.cleanup = function () {
|
|
360
|
-
this.removeQuerySubscription();
|
|
361
|
-
this.removeObservable(true);
|
|
362
|
-
delete this.previous.result;
|
|
363
|
-
};
|
|
364
|
-
QueryData.prototype.getOptions = function () {
|
|
365
|
-
var options = _super.prototype.getOptions.call(this);
|
|
366
|
-
if (this.lazyOptions) {
|
|
367
|
-
options.variables = tslib.__assign(tslib.__assign({}, options.variables), this.lazyOptions.variables);
|
|
368
|
-
options.context = tslib.__assign(tslib.__assign({}, options.context), this.lazyOptions.context);
|
|
369
|
-
}
|
|
370
|
-
if (this.runLazy) {
|
|
371
|
-
delete options.skip;
|
|
372
|
-
}
|
|
373
|
-
return options;
|
|
374
|
-
};
|
|
375
|
-
QueryData.prototype.ssrInitiated = function () {
|
|
376
|
-
return this.context && this.context.renderPromises;
|
|
377
|
-
};
|
|
378
|
-
QueryData.prototype.getExecuteSsrResult = function () {
|
|
379
|
-
var _a = this.getOptions(), ssr = _a.ssr, skip = _a.skip;
|
|
380
|
-
var ssrDisabled = ssr === false;
|
|
381
|
-
var fetchDisabled = this.refreshClient().client.disableNetworkFetches;
|
|
382
|
-
var ssrLoading = tslib.__assign({ loading: true, networkStatus: core.NetworkStatus.loading, called: true, data: undefined, stale: false, client: this.client }, this.observableQueryFields());
|
|
383
|
-
if (ssrDisabled && (this.ssrInitiated() || fetchDisabled)) {
|
|
384
|
-
this.previous.result = ssrLoading;
|
|
385
|
-
return ssrLoading;
|
|
386
|
-
}
|
|
387
|
-
if (this.ssrInitiated()) {
|
|
388
|
-
var result = this.getExecuteResult() || ssrLoading;
|
|
389
|
-
if (result.loading && !skip) {
|
|
390
|
-
this.context.renderPromises.addQueryPromise(this, function () { return null; });
|
|
391
|
-
}
|
|
392
|
-
return result;
|
|
393
|
-
}
|
|
394
|
-
};
|
|
395
|
-
QueryData.prototype.prepareObservableQueryOptions = function () {
|
|
396
|
-
var options = this.getOptions();
|
|
397
|
-
this.verifyDocumentType(options.query, parser.DocumentType.Query);
|
|
398
|
-
var displayName = options.displayName || 'Query';
|
|
399
|
-
if (this.ssrInitiated() &&
|
|
400
|
-
(options.fetchPolicy === 'network-only' ||
|
|
401
|
-
options.fetchPolicy === 'cache-and-network')) {
|
|
402
|
-
options.fetchPolicy = 'cache-first';
|
|
403
|
-
}
|
|
404
|
-
return tslib.__assign(tslib.__assign({}, options), { displayName: displayName, context: options.context });
|
|
405
|
-
};
|
|
406
|
-
QueryData.prototype.initializeObservableQuery = function () {
|
|
407
|
-
if (this.ssrInitiated()) {
|
|
408
|
-
this.currentObservable = this.context.renderPromises.getSSRObservable(this.getOptions());
|
|
409
|
-
}
|
|
410
|
-
if (!this.currentObservable) {
|
|
411
|
-
var observableQueryOptions = this.prepareObservableQueryOptions();
|
|
412
|
-
this.previous.observableQueryOptions = tslib.__assign(tslib.__assign({}, observableQueryOptions), { children: void 0 });
|
|
413
|
-
this.currentObservable = this.refreshClient().client.watchQuery(tslib.__assign({}, observableQueryOptions));
|
|
414
|
-
if (this.ssrInitiated()) {
|
|
415
|
-
this.context.renderPromises.registerSSRObservable(this.currentObservable, observableQueryOptions);
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
};
|
|
419
|
-
QueryData.prototype.updateObservableQuery = function () {
|
|
420
|
-
if (!this.currentObservable) {
|
|
421
|
-
this.initializeObservableQuery();
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
var newObservableQueryOptions = tslib.__assign(tslib.__assign({}, this.prepareObservableQueryOptions()), { children: void 0 });
|
|
425
|
-
if (this.getOptions().skip) {
|
|
426
|
-
this.previous.observableQueryOptions = newObservableQueryOptions;
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
if (!equality.equal(newObservableQueryOptions, this.previous.observableQueryOptions)) {
|
|
430
|
-
this.previous.observableQueryOptions = newObservableQueryOptions;
|
|
431
|
-
this.currentObservable
|
|
432
|
-
.setOptions(newObservableQueryOptions)
|
|
433
|
-
.catch(function () { });
|
|
434
|
-
}
|
|
435
|
-
};
|
|
436
|
-
QueryData.prototype.startQuerySubscription = function (onNewData) {
|
|
437
|
-
var _this = this;
|
|
438
|
-
if (onNewData === void 0) { onNewData = this.onNewData; }
|
|
439
|
-
if (this.currentSubscription || this.getOptions().skip)
|
|
440
|
-
return;
|
|
441
|
-
this.currentSubscription = this.currentObservable.subscribe({
|
|
442
|
-
next: function (_a) {
|
|
443
|
-
var loading = _a.loading, networkStatus = _a.networkStatus, data = _a.data;
|
|
444
|
-
var previousResult = _this.previous.result;
|
|
445
|
-
if (previousResult &&
|
|
446
|
-
previousResult.loading === loading &&
|
|
447
|
-
previousResult.networkStatus === networkStatus &&
|
|
448
|
-
equality.equal(previousResult.data, data)) {
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
onNewData();
|
|
452
|
-
},
|
|
453
|
-
error: function (error) {
|
|
454
|
-
_this.resubscribeToQuery();
|
|
455
|
-
if (!error.hasOwnProperty('graphQLErrors'))
|
|
456
|
-
throw error;
|
|
457
|
-
var previousResult = _this.previous.result;
|
|
458
|
-
if ((previousResult && previousResult.loading) ||
|
|
459
|
-
!equality.equal(error, _this.previous.error)) {
|
|
460
|
-
_this.previous.error = error;
|
|
461
|
-
onNewData();
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
});
|
|
465
|
-
};
|
|
466
|
-
QueryData.prototype.resubscribeToQuery = function () {
|
|
467
|
-
this.removeQuerySubscription();
|
|
468
|
-
var currentObservable = this.currentObservable;
|
|
469
|
-
if (currentObservable) {
|
|
470
|
-
var last = currentObservable["last"];
|
|
471
|
-
try {
|
|
472
|
-
currentObservable.resetLastResults();
|
|
473
|
-
this.startQuerySubscription();
|
|
474
|
-
}
|
|
475
|
-
finally {
|
|
476
|
-
currentObservable["last"] = last;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
QueryData.prototype.getExecuteResult = function () {
|
|
481
|
-
var result = this.observableQueryFields();
|
|
482
|
-
var options = this.getOptions();
|
|
483
|
-
if (options.skip) {
|
|
484
|
-
result = tslib.__assign(tslib.__assign({}, result), { data: undefined, error: undefined, loading: false, networkStatus: core.NetworkStatus.ready, called: true });
|
|
485
|
-
}
|
|
486
|
-
else if (this.currentObservable) {
|
|
487
|
-
var currentResult = this.currentObservable.getCurrentResult();
|
|
488
|
-
var data = currentResult.data, loading = currentResult.loading, partial = currentResult.partial, networkStatus = currentResult.networkStatus, errors$1 = currentResult.errors;
|
|
489
|
-
var error = currentResult.error;
|
|
490
|
-
if (errors$1 && errors$1.length > 0) {
|
|
491
|
-
error = new errors.ApolloError({ graphQLErrors: errors$1 });
|
|
492
|
-
}
|
|
493
|
-
result = tslib.__assign(tslib.__assign({}, result), { data: data, loading: loading, networkStatus: networkStatus, error: error, called: true });
|
|
494
|
-
if (loading) ;
|
|
495
|
-
else if (error) {
|
|
496
|
-
Object.assign(result, {
|
|
497
|
-
data: (this.currentObservable.getLastResult() || {})
|
|
498
|
-
.data
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
else {
|
|
502
|
-
var fetchPolicy = this.currentObservable.options.fetchPolicy;
|
|
503
|
-
var partialRefetch = options.partialRefetch;
|
|
504
|
-
if (partialRefetch &&
|
|
505
|
-
partial &&
|
|
506
|
-
(!data || Object.keys(data).length === 0) &&
|
|
507
|
-
fetchPolicy !== 'cache-only') {
|
|
508
|
-
Object.assign(result, {
|
|
509
|
-
loading: true,
|
|
510
|
-
networkStatus: core.NetworkStatus.loading
|
|
511
|
-
});
|
|
512
|
-
result.refetch();
|
|
513
|
-
return result;
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
result.client = this.client;
|
|
518
|
-
this.setOptions(options, true);
|
|
519
|
-
var previousResult = this.previous.result;
|
|
520
|
-
this.previous.loading =
|
|
521
|
-
previousResult && previousResult.loading || false;
|
|
522
|
-
result.previousData = previousResult &&
|
|
523
|
-
(previousResult.data || previousResult.previousData);
|
|
524
|
-
this.previous.result = result;
|
|
525
|
-
this.currentObservable && this.currentObservable.resetQueryStoreErrors();
|
|
526
|
-
return result;
|
|
527
|
-
};
|
|
528
|
-
QueryData.prototype.handleErrorOrCompleted = function () {
|
|
529
|
-
if (!this.currentObservable || !this.previous.result)
|
|
530
|
-
return;
|
|
531
|
-
var _a = this.previous.result, data = _a.data, loading = _a.loading, error = _a.error;
|
|
532
|
-
if (!loading) {
|
|
533
|
-
var _b = this.getOptions(), query = _b.query, variables = _b.variables, onCompleted = _b.onCompleted, onError = _b.onError, skip = _b.skip;
|
|
534
|
-
if (this.previousOptions &&
|
|
535
|
-
!this.previous.loading &&
|
|
536
|
-
equality.equal(this.previousOptions.query, query) &&
|
|
537
|
-
equality.equal(this.previousOptions.variables, variables)) {
|
|
538
|
-
return;
|
|
539
|
-
}
|
|
540
|
-
if (onCompleted && !error && !skip) {
|
|
541
|
-
onCompleted(data);
|
|
542
|
-
}
|
|
543
|
-
else if (onError && error) {
|
|
544
|
-
onError(error);
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
};
|
|
548
|
-
QueryData.prototype.removeQuerySubscription = function () {
|
|
549
|
-
if (this.currentSubscription) {
|
|
550
|
-
this.currentSubscription.unsubscribe();
|
|
551
|
-
delete this.currentSubscription;
|
|
552
|
-
}
|
|
553
|
-
};
|
|
554
|
-
QueryData.prototype.removeObservable = function (andDelete) {
|
|
555
|
-
if (this.currentObservable) {
|
|
556
|
-
this.currentObservable["tearDownQuery"]();
|
|
557
|
-
if (andDelete) {
|
|
558
|
-
delete this.currentObservable;
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
};
|
|
562
|
-
QueryData.prototype.observableQueryFields = function () {
|
|
563
|
-
var _a;
|
|
564
|
-
return {
|
|
565
|
-
variables: (_a = this.currentObservable) === null || _a === void 0 ? void 0 : _a.variables,
|
|
566
|
-
refetch: this.obsRefetch,
|
|
567
|
-
fetchMore: this.obsFetchMore,
|
|
568
|
-
updateQuery: this.obsUpdateQuery,
|
|
569
|
-
startPolling: this.obsStartPolling,
|
|
570
|
-
stopPolling: this.obsStopPolling,
|
|
571
|
-
subscribeToMore: this.obsSubscribeToMore
|
|
572
|
-
};
|
|
573
|
-
};
|
|
574
|
-
return QueryData;
|
|
575
|
-
}(OperationData));
|
|
576
|
-
|
|
577
|
-
exports.MutationData = MutationData;
|
|
578
|
-
exports.OperationData = OperationData;
|
|
579
|
-
exports.QueryData = QueryData;
|
|
580
|
-
exports.SubscriptionData = SubscriptionData;
|
|
581
|
-
//# sourceMappingURL=data.cjs.js.map
|