@apollo/client 3.8.0-alpha.8 → 3.8.0-beta.0
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 +1064 -680
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +49 -34
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +49 -34
- package/cache/core/cache.d.ts +5 -4
- package/cache/core/cache.d.ts.map +1 -1
- package/cache/core/cache.js +1 -0
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +2 -2
- 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 +6 -5
- 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/inmemory/entityStore.d.ts +5 -5
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js +2 -2
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fragmentRegistry.d.ts +1 -1
- package/cache/inmemory/fragmentRegistry.d.ts.map +1 -1
- package/cache/inmemory/fragmentRegistry.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +6 -5
- package/cache/inmemory/helpers.d.ts.map +1 -1
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +9 -7
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js +14 -15
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.d.ts +1 -1
- package/cache/inmemory/key-extractor.d.ts.map +1 -1
- package/cache/inmemory/key-extractor.js +2 -2
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/policies.d.ts +7 -6
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +20 -9
- 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.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +6 -6
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +10 -5
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +6 -6
- package/cache/inmemory/types.d.ts.map +1 -1
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +6 -6
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js +7 -8
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/config/jest/setup.d.ts +1 -0
- package/config/jest/setup.d.ts.map +1 -1
- package/config/jest/setup.js +3 -0
- package/config/jest/setup.js.map +1 -1
- package/core/ApolloClient.d.ts +15 -12
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +28 -20
- package/core/ApolloClient.js.map +1 -1
- package/core/DocumentTransform.d.ts +24 -0
- package/core/DocumentTransform.d.ts.map +1 -0
- package/core/DocumentTransform.js +68 -0
- package/core/DocumentTransform.js.map +1 -0
- package/core/LocalState.d.ts +7 -9
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +6 -10
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +11 -8
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +48 -28
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +9 -9
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +15 -11
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +115 -108
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +342 -176
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +342 -176
- package/core/equalByQuery.d.ts +4 -0
- package/core/equalByQuery.d.ts.map +1 -0
- package/{react/hooks/compareResults.js → core/equalByQuery.js} +14 -10
- package/core/equalByQuery.js.map +1 -0
- package/core/index.d.ts +2 -1
- package/core/index.d.ts.map +1 -1
- package/core/index.js +2 -1
- package/core/index.js.map +1 -1
- package/core/networkStatus.d.ts +1 -0
- package/core/networkStatus.d.ts.map +1 -1
- package/core/networkStatus.js +3 -0
- package/core/networkStatus.js.map +1 -1
- package/core/types.d.ts +14 -14
- package/core/types.d.ts.map +1 -1
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +6 -7
- package/core/watchQueryOptions.d.ts.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/dev/dev.cjs +642 -0
- package/dev/dev.cjs.map +1 -0
- package/dev/dev.cjs.native.js +642 -0
- package/dev/index.d.ts +4 -0
- package/dev/index.d.ts.map +1 -0
- package/dev/index.js +4 -0
- package/dev/index.js.map +1 -0
- package/dev/loadDevMessages.d.ts +2 -0
- package/dev/loadDevMessages.d.ts.map +1 -0
- package/dev/loadDevMessages.js +6 -0
- package/dev/loadDevMessages.js.map +1 -0
- package/dev/loadErrorMessageHandler.d.ts +3 -0
- package/dev/loadErrorMessageHandler.d.ts.map +1 -0
- package/dev/loadErrorMessageHandler.js +26 -0
- package/dev/loadErrorMessageHandler.js.map +1 -0
- package/dev/loadErrorMessages.d.ts +2 -0
- package/dev/loadErrorMessages.d.ts.map +1 -0
- package/dev/loadErrorMessages.js +6 -0
- package/dev/loadErrorMessages.js.map +1 -0
- package/dev/package.json +8 -0
- package/errors/errors.cjs +17 -17
- package/errors/errors.cjs.map +1 -1
- package/errors/errors.cjs.native.js +17 -17
- package/errors/index.d.ts +26 -10
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js +17 -19
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.d.ts +13 -0
- package/invariantErrorCodes.d.ts.map +1 -0
- package/invariantErrorCodes.js +331 -144
- package/invariantErrorCodes.js.map +1 -0
- package/link/batch/batchLink.d.ts +4 -3
- package/link/batch/batchLink.d.ts.map +1 -1
- package/link/batch/batchLink.js.map +1 -1
- package/link/batch/batching.d.ts +1 -1
- package/link/batch/batching.d.ts.map +1 -1
- package/link/batch/batching.js.map +1 -1
- package/link/batch-http/batch-http.cjs +23 -2
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batch-http.cjs.native.js +23 -2
- package/link/batch-http/batchHttpLink.d.ts +3 -2
- package/link/batch-http/batchHttpLink.d.ts.map +1 -1
- package/link/batch-http/batchHttpLink.js +7 -2
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/context/index.d.ts +3 -2
- package/link/context/index.d.ts.map +1 -1
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.d.ts +3 -2
- package/link/core/ApolloLink.d.ts.map +1 -1
- package/link/core/ApolloLink.js +3 -13
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/core.cjs +2 -12
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +2 -12
- package/link/core/types.d.ts +8 -3
- package/link/core/types.d.ts.map +1 -1
- package/link/core/types.js.map +1 -1
- package/link/error/index.d.ts +4 -3
- package/link/error/index.d.ts.map +1 -1
- package/link/error/index.js.map +1 -1
- package/link/http/HttpLink.d.ts +3 -2
- package/link/http/HttpLink.d.ts.map +1 -1
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/checkFetcher.js +2 -2
- package/link/http/checkFetcher.js.map +1 -1
- package/link/http/createHttpLink.d.ts +1 -1
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js +21 -20
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +73 -43
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +73 -43
- package/link/http/iterators/nodeStream.d.ts +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 +2 -2
- package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +47 -26
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/responseIterator.d.ts +1 -1
- package/link/http/responseIterator.d.ts.map +1 -1
- package/link/http/responseIterator.js.map +1 -1
- package/link/http/rewriteURIForGET.d.ts +1 -1
- package/link/http/rewriteURIForGET.d.ts.map +1 -1
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +3 -2
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/selectURI.d.ts +1 -1
- package/link/http/selectURI.d.ts.map +1 -1
- package/link/http/selectURI.js.map +1 -1
- package/link/http/serializeFetchParameter.d.ts +1 -1
- package/link/http/serializeFetchParameter.d.ts.map +1 -1
- package/link/http/serializeFetchParameter.js +2 -2
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/persisted-queries/index.d.ts +4 -3
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +16 -20
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +15 -19
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +15 -19
- package/link/remove-typename/index.d.ts +2 -0
- package/link/remove-typename/index.d.ts.map +1 -0
- package/link/remove-typename/index.js +2 -0
- package/link/remove-typename/index.js.map +1 -0
- package/link/remove-typename/package.json +8 -0
- package/link/remove-typename/remove-typename.cjs +82 -0
- package/link/remove-typename/remove-typename.cjs.map +1 -0
- package/link/remove-typename/remove-typename.cjs.native.js +82 -0
- package/link/remove-typename/removeTypenameFromVariables.d.ts +11 -0
- package/link/remove-typename/removeTypenameFromVariables.d.ts.map +1 -0
- package/link/remove-typename/removeTypenameFromVariables.js +74 -0
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -0
- package/link/retry/delayFunction.d.ts +1 -1
- package/link/retry/delayFunction.d.ts.map +1 -1
- package/link/retry/delayFunction.js.map +1 -1
- package/link/retry/retryFunction.d.ts +1 -1
- package/link/retry/retryFunction.d.ts.map +1 -1
- package/link/retry/retryFunction.js.map +1 -1
- package/link/retry/retryLink.d.ts +4 -3
- package/link/retry/retryLink.d.ts.map +1 -1
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +3 -2
- package/link/schema/index.d.ts.map +1 -1
- package/link/schema/index.js.map +1 -1
- package/link/subscriptions/index.d.ts +2 -1
- package/link/subscriptions/index.d.ts.map +1 -1
- package/link/subscriptions/index.js +8 -3
- package/link/subscriptions/index.js.map +1 -1
- package/link/subscriptions/subscriptions.cjs +8 -3
- package/link/subscriptions/subscriptions.cjs.map +1 -1
- package/link/subscriptions/subscriptions.cjs.native.js +8 -3
- package/link/utils/createOperation.d.ts +1 -1
- package/link/utils/createOperation.d.ts.map +1 -1
- package/link/utils/createOperation.js.map +1 -1
- package/link/utils/filterOperationVariables.d.ts +5 -0
- package/link/utils/filterOperationVariables.d.ts.map +1 -0
- package/link/utils/filterOperationVariables.js +18 -0
- package/link/utils/filterOperationVariables.js.map +1 -0
- package/link/utils/index.d.ts +1 -0
- package/link/utils/index.d.ts.map +1 -1
- package/link/utils/index.js +1 -0
- package/link/utils/index.js.map +1 -1
- package/link/utils/throwServerError.d.ts +1 -1
- package/link/utils/throwServerError.d.ts.map +1 -1
- package/link/utils/throwServerError.js.map +1 -1
- package/link/utils/toPromise.d.ts +1 -1
- package/link/utils/toPromise.d.ts.map +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.d.ts.map +1 -1
- package/link/utils/transformOperation.js.map +1 -1
- package/link/utils/utils.cjs +20 -2
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +20 -2
- package/link/utils/validateOperation.d.ts +1 -1
- package/link/utils/validateOperation.d.ts.map +1 -1
- package/link/utils/validateOperation.js +2 -2
- package/link/utils/validateOperation.js.map +1 -1
- package/link/ws/index.d.ts +5 -3
- package/link/ws/index.d.ts.map +1 -1
- package/link/ws/index.js.map +1 -1
- package/package.json +37 -34
- package/react/cache/QueryReference.d.ts +34 -0
- package/react/cache/QueryReference.d.ts.map +1 -0
- package/react/cache/QueryReference.js +107 -0
- package/react/cache/QueryReference.js.map +1 -0
- package/react/cache/SuspenseCache.d.ts +10 -13
- package/react/cache/SuspenseCache.d.ts.map +1 -1
- package/react/cache/SuspenseCache.js +18 -41
- package/react/cache/SuspenseCache.js.map +1 -1
- package/react/cache/types.d.ts +2 -0
- package/react/cache/types.d.ts.map +1 -0
- package/react/cache/types.js +2 -0
- package/react/cache/types.js.map +1 -0
- package/react/components/Mutation.d.ts +2 -2
- package/react/components/Mutation.d.ts.map +1 -1
- package/react/components/Mutation.js.map +1 -1
- package/react/components/Query.d.ts +2 -2
- package/react/components/Query.d.ts.map +1 -1
- package/react/components/Query.js.map +1 -1
- package/react/components/Subscription.d.ts +2 -2
- package/react/components/Subscription.d.ts.map +1 -1
- package/react/components/Subscription.js.map +1 -1
- package/react/components/types.d.ts +4 -4
- package/react/components/types.d.ts.map +1 -1
- package/react/components/types.js.map +1 -1
- package/react/context/ApolloConsumer.d.ts +1 -1
- package/react/context/ApolloConsumer.d.ts.map +1 -1
- package/react/context/ApolloConsumer.js +2 -3
- package/react/context/ApolloConsumer.js.map +1 -1
- package/react/context/ApolloContext.d.ts +10 -3
- package/react/context/ApolloContext.d.ts.map +1 -1
- package/react/context/ApolloContext.js +10 -8
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.d.ts +2 -2
- package/react/context/ApolloProvider.d.ts.map +1 -1
- package/react/context/ApolloProvider.js +8 -13
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/context/context.cjs +18 -22
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +18 -22
- package/react/context/index.d.ts +1 -1
- package/react/context/index.d.ts.map +1 -1
- package/react/context/index.js +1 -1
- package/react/context/index.js.map +1 -1
- package/react/hoc/graphql.d.ts +3 -3
- package/react/hoc/graphql.d.ts.map +1 -1
- package/react/hoc/graphql.js.map +1 -1
- package/react/hoc/hoc-utils.d.ts +2 -2
- package/react/hoc/hoc-utils.d.ts.map +1 -1
- package/react/hoc/hoc-utils.js +2 -3
- package/react/hoc/hoc-utils.js.map +1 -1
- package/react/hoc/hoc.cjs +2 -4
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +2 -4
- package/react/hoc/mutation-hoc.d.ts +4 -4
- package/react/hoc/mutation-hoc.d.ts.map +1 -1
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/query-hoc.d.ts +2 -2
- package/react/hoc/query-hoc.d.ts.map +1 -1
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.d.ts +2 -2
- package/react/hoc/subscription-hoc.d.ts.map +1 -1
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/types.d.ts +4 -4
- package/react/hoc/types.d.ts.map +1 -1
- package/react/hoc/types.js.map +1 -1
- package/react/hoc/withApollo.d.ts +1 -1
- package/react/hoc/withApollo.d.ts.map +1 -1
- package/react/hoc/withApollo.js +2 -3
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs +226 -216
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +226 -216
- package/react/hooks/index.d.ts +2 -1
- package/react/hooks/index.d.ts.map +1 -1
- package/react/hooks/index.js +2 -1
- package/react/hooks/index.js.map +1 -1
- package/react/hooks/internal/__use.d.ts +4 -0
- package/react/hooks/internal/__use.d.ts.map +1 -0
- package/react/hooks/internal/__use.js +17 -0
- package/react/hooks/internal/__use.js.map +1 -0
- package/react/hooks/internal/index.d.ts +2 -0
- package/react/hooks/internal/index.d.ts.map +1 -1
- package/react/hooks/internal/index.js +2 -0
- package/react/hooks/internal/index.js.map +1 -1
- package/react/hooks/internal/useDeepMemo.d.ts +1 -1
- package/react/hooks/internal/useDeepMemo.d.ts.map +1 -1
- package/react/hooks/internal/useDeepMemo.js.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.js +2 -2
- package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -1
- package/react/hooks/internal/useStrictModeSafeCleanupEffect.d.ts +2 -0
- package/react/hooks/internal/useStrictModeSafeCleanupEffect.d.ts.map +1 -0
- package/react/hooks/internal/useStrictModeSafeCleanupEffect.js +11 -0
- package/react/hooks/internal/useStrictModeSafeCleanupEffect.js.map +1 -0
- package/react/hooks/useApolloClient.d.ts +1 -1
- package/react/hooks/useApolloClient.d.ts.map +1 -1
- package/react/hooks/useApolloClient.js +2 -4
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useBackgroundQuery.d.ts +18 -0
- package/react/hooks/useBackgroundQuery.d.ts.map +1 -0
- package/react/hooks/useBackgroundQuery.js +69 -0
- package/react/hooks/useBackgroundQuery.js.map +1 -0
- package/react/hooks/useFragment.d.ts +14 -9
- package/react/hooks/useFragment.d.ts.map +1 -1
- package/react/hooks/useFragment.js +2 -2
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +4 -4
- package/react/hooks/useLazyQuery.d.ts.map +1 -1
- package/react/hooks/useLazyQuery.js +13 -22
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +4 -4
- package/react/hooks/useMutation.d.ts.map +1 -1
- package/react/hooks/useMutation.js +3 -2
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +6 -6
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +30 -29
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useReactiveVar.d.ts +1 -1
- package/react/hooks/useReactiveVar.d.ts.map +1 -1
- package/react/hooks/useReactiveVar.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +4 -4
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +27 -19
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseCache.d.ts +1 -1
- package/react/hooks/useSuspenseCache.d.ts.map +1 -1
- package/react/hooks/useSuspenseCache.js +2 -4
- package/react/hooks/useSuspenseCache.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +39 -7
- package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
- package/react/hooks/useSuspenseQuery.js +68 -144
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/index.d.ts +1 -1
- package/react/index.d.ts.map +1 -1
- package/react/index.js +1 -1
- package/react/index.js.map +1 -1
- package/react/parser/index.d.ts +1 -1
- package/react/parser/index.d.ts.map +1 -1
- package/react/parser/index.js +20 -17
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +19 -16
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +19 -16
- package/react/react.cjs +116 -35
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +116 -35
- package/react/ssr/RenderPromises.d.ts +2 -2
- package/react/ssr/RenderPromises.d.ts.map +1 -1
- package/react/ssr/RenderPromises.js.map +1 -1
- package/react/ssr/renderToStringWithData.d.ts +1 -1
- package/react/ssr/renderToStringWithData.d.ts.map +1 -1
- package/react/ssr/renderToStringWithData.js.map +1 -1
- package/react/types/types.d.ts +10 -13
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +1 -1
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +1 -1
- package/testing/core/itAsync.js.map +1 -1
- package/testing/core/mocking/mockClient.d.ts +2 -2
- package/testing/core/mocking/mockClient.d.ts.map +1 -1
- package/testing/core/mocking/mockClient.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +2 -1
- package/testing/core/mocking/mockLink.d.ts.map +1 -1
- package/testing/core/mocking/mockLink.js +3 -3
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts.map +1 -1
- package/testing/core/mocking/mockQueryManager.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +3 -2
- package/testing/core/mocking/mockSubscriptionLink.d.ts.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
- package/testing/core/mocking/mockWatchQuery.d.ts +2 -2
- package/testing/core/mocking/mockWatchQuery.d.ts.map +1 -1
- package/testing/core/mocking/mockWatchQuery.js.map +1 -1
- package/testing/core/observableToPromise.d.ts +2 -2
- package/testing/core/observableToPromise.d.ts.map +1 -1
- 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.map +1 -1
- package/testing/matchers/index.d.ts +2 -0
- package/testing/matchers/index.d.ts.map +1 -0
- package/testing/matchers/index.js +6 -0
- package/testing/matchers/index.js.map +1 -0
- package/testing/matchers/toMatchDocument.d.ts +4 -0
- package/testing/matchers/toMatchDocument.d.ts.map +1 -0
- package/testing/matchers/toMatchDocument.js +34 -0
- package/testing/matchers/toMatchDocument.js.map +1 -0
- package/testing/react/MockedProvider.d.ts +8 -7
- package/testing/react/MockedProvider.d.ts.map +1 -1
- package/testing/react/MockedProvider.js +7 -6
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +7 -51
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +7 -51
- package/utilities/common/compact.d.ts +1 -1
- package/utilities/common/compact.d.ts.map +1 -1
- package/utilities/common/compact.js.map +1 -1
- 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/incrementalResult.d.ts +2 -1
- package/utilities/common/incrementalResult.d.ts.map +1 -1
- package/utilities/common/incrementalResult.js +4 -0
- package/utilities/common/incrementalResult.js.map +1 -1
- package/utilities/common/mergeOptions.d.ts +1 -1
- package/utilities/common/mergeOptions.d.ts.map +1 -1
- package/utilities/common/mergeOptions.js +1 -1
- package/utilities/common/mergeOptions.js.map +1 -1
- package/utilities/common/objects.d.ts +1 -0
- package/utilities/common/objects.d.ts.map +1 -1
- package/utilities/common/objects.js +6 -0
- package/utilities/common/objects.js.map +1 -1
- package/utilities/common/omitDeep.d.ts +3 -0
- package/utilities/common/omitDeep.d.ts.map +1 -0
- package/utilities/common/omitDeep.js +41 -0
- package/utilities/common/omitDeep.js.map +1 -0
- package/utilities/common/responseIterator.d.ts +2 -2
- package/utilities/common/responseIterator.d.ts.map +1 -1
- package/utilities/common/responseIterator.js.map +1 -1
- package/utilities/common/stringifyForDisplay.d.ts +1 -1
- package/utilities/common/stringifyForDisplay.d.ts.map +1 -1
- package/utilities/common/stringifyForDisplay.js +3 -2
- package/utilities/common/stringifyForDisplay.js.map +1 -1
- package/utilities/common/stripTypename.d.ts +2 -0
- package/utilities/common/stripTypename.d.ts.map +1 -0
- package/utilities/common/stripTypename.js +5 -0
- package/utilities/common/stripTypename.js.map +1 -0
- package/utilities/globals/global.d.ts +6 -3
- package/utilities/globals/global.d.ts.map +1 -1
- package/utilities/globals/global.js.map +1 -1
- package/utilities/globals/globals.cjs +67 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +67 -1
- package/utilities/globals/index.d.ts +2 -2
- package/utilities/globals/index.d.ts.map +1 -1
- package/utilities/globals/index.js +2 -2
- package/utilities/globals/index.js.map +1 -1
- package/utilities/globals/invariantWrappers.d.ts +24 -0
- package/utilities/globals/invariantWrappers.d.ts.map +1 -0
- package/utilities/globals/invariantWrappers.js +53 -0
- package/utilities/globals/invariantWrappers.js.map +1 -0
- package/utilities/graphql/directives.d.ts +1 -1
- package/utilities/graphql/directives.d.ts.map +1 -1
- package/utilities/graphql/directives.js +6 -7
- 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 +8 -5
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.d.ts +1 -1
- package/utilities/graphql/getFromAST.d.ts.map +1 -1
- package/utilities/graphql/getFromAST.js +16 -12
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/operations.d.ts +5 -0
- package/utilities/graphql/operations.d.ts.map +1 -0
- package/utilities/graphql/operations.js +16 -0
- package/utilities/graphql/operations.js.map +1 -0
- package/utilities/graphql/storeUtils.d.ts +2 -2
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +16 -7
- 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 +30 -21
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +6 -0
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +4 -0
- package/utilities/index.js.map +1 -1
- package/utilities/observables/Concast.d.ts +2 -1
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/observables/Observable.d.ts +2 -1
- package/utilities/observables/Observable.d.ts.map +1 -1
- package/utilities/observables/Observable.js +1 -1
- package/utilities/observables/Observable.js.map +1 -1
- package/utilities/observables/asyncMap.d.ts.map +1 -1
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/observables/iteration.d.ts +1 -1
- package/utilities/observables/iteration.d.ts.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.map +1 -1
- package/utilities/promises/decoration.d.ts +17 -0
- package/utilities/promises/decoration.d.ts.map +1 -0
- package/utilities/promises/decoration.js +37 -0
- package/utilities/promises/decoration.js.map +1 -0
- package/utilities/types/DeepOmit.d.ts +10 -0
- package/utilities/types/DeepOmit.d.ts.map +1 -0
- package/utilities/types/DeepOmit.js +2 -0
- package/utilities/types/DeepOmit.js.map +1 -0
- package/utilities/types/DeepPartial.d.ts +12 -0
- package/utilities/types/DeepPartial.d.ts.map +1 -0
- package/utilities/types/DeepPartial.js +2 -0
- package/utilities/types/DeepPartial.js.map +1 -0
- package/utilities/types/Primitive.d.ts +2 -0
- package/utilities/types/Primitive.d.ts.map +1 -0
- package/utilities/types/Primitive.js +2 -0
- package/utilities/types/Primitive.js.map +1 -0
- package/utilities/utilities.cjs +188 -48
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +188 -48
- package/version.js +1 -1
- package/cache/inmemory/__mocks__/optimism.d.ts +0 -2
- package/cache/inmemory/__mocks__/optimism.d.ts.map +0 -1
- package/cache/inmemory/__mocks__/optimism.js +0 -14
- package/cache/inmemory/__mocks__/optimism.js.map +0 -1
- package/react/hooks/compareResults.d.ts +0 -3
- package/react/hooks/compareResults.d.ts.map +0 -1
- package/react/hooks/compareResults.js.map +0 -1
package/apollo-client.cjs
CHANGED
|
@@ -3,18 +3,20 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
|
-
var tsInvariant = require('ts-invariant');
|
|
7
6
|
var process$1 = require('ts-invariant/process');
|
|
8
7
|
var graphql = require('graphql');
|
|
9
|
-
var
|
|
8
|
+
var equal = require('@wry/equality');
|
|
9
|
+
var tsInvariant = require('ts-invariant');
|
|
10
10
|
var zenObservableTs = require('zen-observable-ts');
|
|
11
11
|
require('symbol-observable');
|
|
12
|
+
var trie = require('@wry/trie');
|
|
12
13
|
var optimism = require('optimism');
|
|
13
14
|
var context = require('@wry/context');
|
|
14
|
-
var trie = require('@wry/trie');
|
|
15
15
|
var graphqlTag = require('graphql-tag');
|
|
16
16
|
var React = require('react');
|
|
17
17
|
|
|
18
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
|
19
|
+
|
|
18
20
|
function _interopNamespace(e) {
|
|
19
21
|
if (e && e.__esModule) return e;
|
|
20
22
|
var n = Object.create(null);
|
|
@@ -27,7 +29,11 @@ function _interopNamespace(e) {
|
|
|
27
29
|
return Object.freeze(n);
|
|
28
30
|
}
|
|
29
31
|
|
|
32
|
+
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
|
|
30
33
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
34
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
35
|
+
|
|
36
|
+
var version = '3.8.0-beta.0';
|
|
31
37
|
|
|
32
38
|
function maybe(thunk) {
|
|
33
39
|
try {
|
|
@@ -42,6 +48,68 @@ var global$1 = (maybe(function () { return globalThis; }) ||
|
|
|
42
48
|
maybe(function () { return global; }) ||
|
|
43
49
|
maybe(function () { return maybe.constructor("return this")(); }));
|
|
44
50
|
|
|
51
|
+
var prefixCounts = new Map();
|
|
52
|
+
function makeUniqueId(prefix) {
|
|
53
|
+
var count = prefixCounts.get(prefix) || 1;
|
|
54
|
+
prefixCounts.set(prefix, count + 1);
|
|
55
|
+
return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function stringifyForDisplay(value, space) {
|
|
59
|
+
if (space === void 0) { space = 0; }
|
|
60
|
+
var undefId = makeUniqueId("stringifyForDisplay");
|
|
61
|
+
return JSON.stringify(value, function (key, value) {
|
|
62
|
+
return value === void 0 ? undefId : value;
|
|
63
|
+
}, space).split(JSON.stringify(undefId)).join("<undefined>");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function wrap(fn) {
|
|
67
|
+
return function (message) {
|
|
68
|
+
var args = [];
|
|
69
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
70
|
+
args[_i - 1] = arguments[_i];
|
|
71
|
+
}
|
|
72
|
+
fn.apply(void 0, tslib.__spreadArray([typeof message === 'number' ? getErrorMsg(message) : message], args, false));
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
var invariant = Object.assign(function invariant(condition, message) {
|
|
76
|
+
var args = [];
|
|
77
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
78
|
+
args[_i - 2] = arguments[_i];
|
|
79
|
+
}
|
|
80
|
+
if (!condition) {
|
|
81
|
+
tsInvariant.invariant(condition, getErrorMsg(message, args));
|
|
82
|
+
}
|
|
83
|
+
}, {
|
|
84
|
+
debug: wrap(tsInvariant.invariant.debug),
|
|
85
|
+
log: wrap(tsInvariant.invariant.log),
|
|
86
|
+
warn: wrap(tsInvariant.invariant.warn),
|
|
87
|
+
error: wrap(tsInvariant.invariant.error),
|
|
88
|
+
});
|
|
89
|
+
function newInvariantError(message) {
|
|
90
|
+
var optionalParams = [];
|
|
91
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
92
|
+
optionalParams[_i - 1] = arguments[_i];
|
|
93
|
+
}
|
|
94
|
+
return new tsInvariant.InvariantError(getErrorMsg(message, optionalParams));
|
|
95
|
+
}
|
|
96
|
+
var ApolloErrorMessageHandler = Symbol.for('ApolloErrorMessageHandler_' + version);
|
|
97
|
+
function getErrorMsg(message, messageArgs) {
|
|
98
|
+
if (messageArgs === void 0) { messageArgs = []; }
|
|
99
|
+
if (!message)
|
|
100
|
+
return;
|
|
101
|
+
var args = messageArgs.map(function (arg) {
|
|
102
|
+
return typeof arg == 'string' ? arg : stringifyForDisplay(arg, 2).slice(0, 1000);
|
|
103
|
+
});
|
|
104
|
+
return ((global$1[ApolloErrorMessageHandler] &&
|
|
105
|
+
global$1[ApolloErrorMessageHandler](message, args)) ||
|
|
106
|
+
"An error occured! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({
|
|
107
|
+
version: version,
|
|
108
|
+
message: message,
|
|
109
|
+
args: args,
|
|
110
|
+
}))));
|
|
111
|
+
}
|
|
112
|
+
|
|
45
113
|
var DEV = ("__DEV__" in global$1
|
|
46
114
|
? Boolean(global$1.__DEV__)
|
|
47
115
|
: maybe(function () { return process.env.NODE_ENV; }) !== "production");
|
|
@@ -63,7 +131,7 @@ function shouldInclude(_a, variables) {
|
|
|
63
131
|
var evaledValue = false;
|
|
64
132
|
if (ifArgument.value.kind === 'Variable') {
|
|
65
133
|
evaledValue = variables && variables[ifArgument.value.name.value];
|
|
66
|
-
|
|
134
|
+
invariant(evaledValue !== void 0, 66, directive.name.value);
|
|
67
135
|
}
|
|
68
136
|
else {
|
|
69
137
|
evaledValue = ifArgument.value.value;
|
|
@@ -99,13 +167,12 @@ function getInclusionDirectives(directives) {
|
|
|
99
167
|
return;
|
|
100
168
|
var directiveArguments = directive.arguments;
|
|
101
169
|
var directiveName = directive.name.value;
|
|
102
|
-
|
|
170
|
+
invariant(directiveArguments && directiveArguments.length === 1, 67, directiveName);
|
|
103
171
|
var ifArgument = directiveArguments[0];
|
|
104
|
-
|
|
172
|
+
invariant(ifArgument.name && ifArgument.name.value === 'if', 68, directiveName);
|
|
105
173
|
var ifValue = ifArgument.value;
|
|
106
|
-
|
|
107
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),
|
|
108
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 44);
|
|
174
|
+
invariant(ifValue &&
|
|
175
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 69, directiveName);
|
|
109
176
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
110
177
|
});
|
|
111
178
|
}
|
|
@@ -117,15 +184,18 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
117
184
|
var fragments = [];
|
|
118
185
|
document.definitions.forEach(function (definition) {
|
|
119
186
|
if (definition.kind === 'OperationDefinition') {
|
|
120
|
-
throw
|
|
121
|
-
|
|
187
|
+
throw newInvariantError(
|
|
188
|
+
70,
|
|
189
|
+
definition.operation,
|
|
190
|
+
definition.name ? " named '".concat(definition.name.value, "'") : ''
|
|
191
|
+
);
|
|
122
192
|
}
|
|
123
193
|
if (definition.kind === 'FragmentDefinition') {
|
|
124
194
|
fragments.push(definition);
|
|
125
195
|
}
|
|
126
196
|
});
|
|
127
197
|
if (typeof actualFragmentName === 'undefined') {
|
|
128
|
-
|
|
198
|
+
invariant(fragments.length === 1, 71, fragments.length);
|
|
129
199
|
actualFragmentName = fragments[0].name.value;
|
|
130
200
|
}
|
|
131
201
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -166,7 +236,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
166
236
|
return fragmentMap(fragmentName);
|
|
167
237
|
}
|
|
168
238
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
169
|
-
|
|
239
|
+
invariant(fragment, 72, fragmentName);
|
|
170
240
|
return fragment || null;
|
|
171
241
|
}
|
|
172
242
|
default:
|
|
@@ -248,9 +318,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
248
318
|
argObj[name.value] = null;
|
|
249
319
|
}
|
|
250
320
|
else {
|
|
251
|
-
throw
|
|
252
|
-
'is not supported. Use variables instead of inline arguments to ' +
|
|
253
|
-
'overcome this limitation.') : new tsInvariant.InvariantError(56);
|
|
321
|
+
throw newInvariantError(81, name.value, value.kind);
|
|
254
322
|
}
|
|
255
323
|
}
|
|
256
324
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -284,6 +352,7 @@ var KNOWN_DIRECTIVES = [
|
|
|
284
352
|
'client',
|
|
285
353
|
'rest',
|
|
286
354
|
'export',
|
|
355
|
+
'nonreactive',
|
|
287
356
|
];
|
|
288
357
|
var getStoreKeyName = Object.assign(function (fieldName, args, directives) {
|
|
289
358
|
if (args &&
|
|
@@ -358,9 +427,7 @@ function resultKeyNameFromField(field) {
|
|
|
358
427
|
return field.alias ? field.alias.value : field.name.value;
|
|
359
428
|
}
|
|
360
429
|
function getTypenameFromResult(result, selectionSet, fragmentMap) {
|
|
361
|
-
|
|
362
|
-
return result.__typename;
|
|
363
|
-
}
|
|
430
|
+
var fragments;
|
|
364
431
|
for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) {
|
|
365
432
|
var selection = _a[_i];
|
|
366
433
|
if (isField(selection)) {
|
|
@@ -368,7 +435,19 @@ function getTypenameFromResult(result, selectionSet, fragmentMap) {
|
|
|
368
435
|
return result[resultKeyNameFromField(selection)];
|
|
369
436
|
}
|
|
370
437
|
}
|
|
438
|
+
else if (fragments) {
|
|
439
|
+
fragments.push(selection);
|
|
440
|
+
}
|
|
371
441
|
else {
|
|
442
|
+
fragments = [selection];
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
if (typeof result.__typename === 'string') {
|
|
446
|
+
return result.__typename;
|
|
447
|
+
}
|
|
448
|
+
if (fragments) {
|
|
449
|
+
for (var _b = 0, fragments_1 = fragments; _b < fragments_1.length; _b++) {
|
|
450
|
+
var selection = fragments_1[_b];
|
|
372
451
|
var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap);
|
|
373
452
|
if (typeof typename === 'string') {
|
|
374
453
|
return typename;
|
|
@@ -384,42 +463,46 @@ function isInlineFragment(selection) {
|
|
|
384
463
|
}
|
|
385
464
|
|
|
386
465
|
function checkDocument(doc) {
|
|
387
|
-
|
|
466
|
+
invariant(doc && doc.kind === 'Document', 73);
|
|
388
467
|
var operations = doc.definitions
|
|
389
468
|
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
|
390
469
|
.map(function (definition) {
|
|
391
470
|
if (definition.kind !== 'OperationDefinition') {
|
|
392
|
-
throw
|
|
471
|
+
throw newInvariantError(74, definition.kind);
|
|
393
472
|
}
|
|
394
473
|
return definition;
|
|
395
474
|
});
|
|
396
|
-
|
|
475
|
+
invariant(operations.length <= 1, 75, operations.length);
|
|
397
476
|
return doc;
|
|
398
477
|
}
|
|
399
478
|
function getOperationDefinition(doc) {
|
|
400
479
|
checkDocument(doc);
|
|
401
|
-
return doc.definitions.filter(function (definition) {
|
|
480
|
+
return doc.definitions.filter(function (definition) {
|
|
481
|
+
return definition.kind === 'OperationDefinition';
|
|
482
|
+
})[0];
|
|
402
483
|
}
|
|
403
484
|
function getOperationName(doc) {
|
|
404
485
|
return (doc.definitions
|
|
405
486
|
.filter(function (definition) {
|
|
406
|
-
return definition.kind === 'OperationDefinition' && definition.name;
|
|
487
|
+
return definition.kind === 'OperationDefinition' && !!definition.name;
|
|
407
488
|
})
|
|
408
489
|
.map(function (x) { return x.name.value; })[0] || null);
|
|
409
490
|
}
|
|
410
491
|
function getFragmentDefinitions(doc) {
|
|
411
|
-
return doc.definitions.filter(function (definition) {
|
|
492
|
+
return doc.definitions.filter(function (definition) {
|
|
493
|
+
return definition.kind === 'FragmentDefinition';
|
|
494
|
+
});
|
|
412
495
|
}
|
|
413
496
|
function getQueryDefinition(doc) {
|
|
414
497
|
var queryDef = getOperationDefinition(doc);
|
|
415
|
-
|
|
498
|
+
invariant(queryDef && queryDef.operation === 'query', 76);
|
|
416
499
|
return queryDef;
|
|
417
500
|
}
|
|
418
501
|
function getFragmentDefinition(doc) {
|
|
419
|
-
|
|
420
|
-
|
|
502
|
+
invariant(doc.kind === 'Document', 77);
|
|
503
|
+
invariant(doc.definitions.length <= 1, 78);
|
|
421
504
|
var fragmentDef = doc.definitions[0];
|
|
422
|
-
|
|
505
|
+
invariant(fragmentDef.kind === 'FragmentDefinition', 79);
|
|
423
506
|
return fragmentDef;
|
|
424
507
|
}
|
|
425
508
|
function getMainDefinition(queryDoc) {
|
|
@@ -442,7 +525,7 @@ function getMainDefinition(queryDoc) {
|
|
|
442
525
|
if (fragmentDefinition) {
|
|
443
526
|
return fragmentDefinition;
|
|
444
527
|
}
|
|
445
|
-
throw
|
|
528
|
+
throw newInvariantError(80);
|
|
446
529
|
}
|
|
447
530
|
function getDefaultValues(definition) {
|
|
448
531
|
var defaultValues = Object.create(null);
|
|
@@ -478,19 +561,30 @@ function nullIfDocIsEmpty(doc) {
|
|
|
478
561
|
? null
|
|
479
562
|
: doc;
|
|
480
563
|
}
|
|
481
|
-
function getDirectiveMatcher(
|
|
482
|
-
var
|
|
483
|
-
var tests =
|
|
484
|
-
|
|
485
|
-
if (directive
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
564
|
+
function getDirectiveMatcher(configs) {
|
|
565
|
+
var names = new Map();
|
|
566
|
+
var tests = new Map();
|
|
567
|
+
configs.forEach(function (directive) {
|
|
568
|
+
if (directive) {
|
|
569
|
+
if (directive.name) {
|
|
570
|
+
names.set(directive.name, directive);
|
|
571
|
+
}
|
|
572
|
+
else if (directive.test) {
|
|
573
|
+
tests.set(directive.test, directive);
|
|
574
|
+
}
|
|
490
575
|
}
|
|
491
576
|
});
|
|
492
|
-
return function (directive) {
|
|
493
|
-
|
|
577
|
+
return function (directive) {
|
|
578
|
+
var config = names.get(directive.name.value);
|
|
579
|
+
if (!config && tests.size) {
|
|
580
|
+
tests.forEach(function (testConfig, test) {
|
|
581
|
+
if (test(directive)) {
|
|
582
|
+
config = testConfig;
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
return config;
|
|
587
|
+
};
|
|
494
588
|
}
|
|
495
589
|
function makeInUseGetterFunction(defaultKey) {
|
|
496
590
|
var map = new Map();
|
|
@@ -507,6 +601,7 @@ function makeInUseGetterFunction(defaultKey) {
|
|
|
507
601
|
};
|
|
508
602
|
}
|
|
509
603
|
function removeDirectivesFromDocument(directives, doc) {
|
|
604
|
+
checkDocument(doc);
|
|
510
605
|
var getInUseByOperationName = makeInUseGetterFunction("");
|
|
511
606
|
var getInUseByFragmentName = makeInUseGetterFunction("");
|
|
512
607
|
var getInUse = function (ancestors) {
|
|
@@ -520,7 +615,7 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
520
615
|
return getInUseByFragmentName(ancestor.name.value);
|
|
521
616
|
}
|
|
522
617
|
}
|
|
523
|
-
__DEV__ &&
|
|
618
|
+
__DEV__ && invariant.error(82);
|
|
524
619
|
return null;
|
|
525
620
|
};
|
|
526
621
|
var operationCount = 0;
|
|
@@ -530,10 +625,8 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
530
625
|
}
|
|
531
626
|
}
|
|
532
627
|
var directiveMatcher = getDirectiveMatcher(directives);
|
|
533
|
-
var
|
|
534
|
-
|
|
535
|
-
nodeDirectives &&
|
|
536
|
-
nodeDirectives.some(directiveMatcher)); };
|
|
628
|
+
var shouldRemoveField = function (nodeDirectives) { return (isNonEmptyArray(nodeDirectives) &&
|
|
629
|
+
nodeDirectives.map(directiveMatcher).some(function (config) { return config && config.remove; })); };
|
|
537
630
|
var originalFragmentDefsByPath = new Map();
|
|
538
631
|
var firstVisitMadeChanges = false;
|
|
539
632
|
var fieldOrInlineFragmentVisitor = {
|
|
@@ -692,22 +785,6 @@ var addTypenameToDocument = Object.assign(function (doc) {
|
|
|
692
785
|
return field === TYPENAME_FIELD;
|
|
693
786
|
},
|
|
694
787
|
});
|
|
695
|
-
var connectionRemoveConfig = {
|
|
696
|
-
test: function (directive) {
|
|
697
|
-
var willRemove = directive.name.value === 'connection';
|
|
698
|
-
if (willRemove) {
|
|
699
|
-
if (!directive.arguments ||
|
|
700
|
-
!directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) {
|
|
701
|
-
__DEV__ && tsInvariant.invariant.warn('Removing an @connection directive even though it does not have a key. ' +
|
|
702
|
-
'You may want to use the key parameter to specify a store key.');
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
return willRemove;
|
|
706
|
-
},
|
|
707
|
-
};
|
|
708
|
-
function removeConnectionDirectiveFromDocument(doc) {
|
|
709
|
-
return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc));
|
|
710
|
-
}
|
|
711
788
|
function buildQueryFromSelectionSet(document) {
|
|
712
789
|
var definition = getMainDefinition(document);
|
|
713
790
|
var definitionOperation = definition.operation;
|
|
@@ -807,6 +884,43 @@ var DeepMerger = (function () {
|
|
|
807
884
|
return DeepMerger;
|
|
808
885
|
}());
|
|
809
886
|
|
|
887
|
+
function createFulfilledPromise(value) {
|
|
888
|
+
var promise = Promise.resolve(value);
|
|
889
|
+
promise.status = 'fulfilled';
|
|
890
|
+
promise.value = value;
|
|
891
|
+
return promise;
|
|
892
|
+
}
|
|
893
|
+
function createRejectedPromise(reason) {
|
|
894
|
+
var promise = Promise.reject(reason);
|
|
895
|
+
promise.status = 'rejected';
|
|
896
|
+
promise.reason = reason;
|
|
897
|
+
return promise;
|
|
898
|
+
}
|
|
899
|
+
function isStatefulPromise(promise) {
|
|
900
|
+
return 'status' in promise;
|
|
901
|
+
}
|
|
902
|
+
function wrapPromiseWithState(promise) {
|
|
903
|
+
if (isStatefulPromise(promise)) {
|
|
904
|
+
return promise;
|
|
905
|
+
}
|
|
906
|
+
var pendingPromise = promise;
|
|
907
|
+
pendingPromise.status = 'pending';
|
|
908
|
+
pendingPromise.then(function (value) {
|
|
909
|
+
if (pendingPromise.status === 'pending') {
|
|
910
|
+
var fulfilledPromise = pendingPromise;
|
|
911
|
+
fulfilledPromise.status = 'fulfilled';
|
|
912
|
+
fulfilledPromise.value = value;
|
|
913
|
+
}
|
|
914
|
+
}, function (reason) {
|
|
915
|
+
if (pendingPromise.status === 'pending') {
|
|
916
|
+
var rejectedPromise = pendingPromise;
|
|
917
|
+
rejectedPromise.status = 'rejected';
|
|
918
|
+
rejectedPromise.reason = reason;
|
|
919
|
+
}
|
|
920
|
+
});
|
|
921
|
+
return promise;
|
|
922
|
+
}
|
|
923
|
+
|
|
810
924
|
var toString = Object.prototype.toString;
|
|
811
925
|
function cloneDeep(value) {
|
|
812
926
|
return cloneDeepHelper(value);
|
|
@@ -1089,6 +1203,9 @@ function isExecutionPatchResult(value) {
|
|
|
1089
1203
|
return (isExecutionPatchIncrementalResult(value) ||
|
|
1090
1204
|
isExecutionPatchInitialResult(value));
|
|
1091
1205
|
}
|
|
1206
|
+
function isApolloPayloadResult(value) {
|
|
1207
|
+
return isNonNullObject(value) && "payload" in value;
|
|
1208
|
+
}
|
|
1092
1209
|
function mergeIncrementalData(prevResult, result) {
|
|
1093
1210
|
var mergedData = prevResult;
|
|
1094
1211
|
var merger = new DeepMerger();
|
|
@@ -1147,23 +1264,9 @@ function compact() {
|
|
|
1147
1264
|
return result;
|
|
1148
1265
|
}
|
|
1149
1266
|
|
|
1150
|
-
var prefixCounts = new Map();
|
|
1151
|
-
function makeUniqueId(prefix) {
|
|
1152
|
-
var count = prefixCounts.get(prefix) || 1;
|
|
1153
|
-
prefixCounts.set(prefix, count + 1);
|
|
1154
|
-
return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2));
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
function stringifyForDisplay(value) {
|
|
1158
|
-
var undefId = makeUniqueId("stringifyForDisplay");
|
|
1159
|
-
return JSON.stringify(value, function (key, value) {
|
|
1160
|
-
return value === void 0 ? undefId : value;
|
|
1161
|
-
}).split(JSON.stringify(undefId)).join("<undefined>");
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
1267
|
function mergeOptions(defaults, options) {
|
|
1165
1268
|
return compact(defaults, options, options.variables && {
|
|
1166
|
-
variables: tslib.__assign(tslib.__assign({}, (defaults && defaults.variables)), options.variables),
|
|
1269
|
+
variables: compact(tslib.__assign(tslib.__assign({}, (defaults && defaults.variables)), options.variables)),
|
|
1167
1270
|
});
|
|
1168
1271
|
}
|
|
1169
1272
|
|
|
@@ -1199,7 +1302,7 @@ function toPromise(observable) {
|
|
|
1199
1302
|
observable.subscribe({
|
|
1200
1303
|
next: function (data) {
|
|
1201
1304
|
if (completed) {
|
|
1202
|
-
__DEV__ &&
|
|
1305
|
+
__DEV__ && invariant.warn(42);
|
|
1203
1306
|
}
|
|
1204
1307
|
else {
|
|
1205
1308
|
completed = true;
|
|
@@ -1242,7 +1345,7 @@ function validateOperation(operation) {
|
|
|
1242
1345
|
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
|
|
1243
1346
|
var key = _a[_i];
|
|
1244
1347
|
if (OPERATION_FIELDS.indexOf(key) < 0) {
|
|
1245
|
-
throw
|
|
1348
|
+
throw newInvariantError(43, key);
|
|
1246
1349
|
}
|
|
1247
1350
|
}
|
|
1248
1351
|
return operation;
|
|
@@ -1286,6 +1389,22 @@ function transformOperation(operation) {
|
|
|
1286
1389
|
return transformedOperation;
|
|
1287
1390
|
}
|
|
1288
1391
|
|
|
1392
|
+
function filterOperationVariables(variables, operation) {
|
|
1393
|
+
var result = tslib.__assign({}, variables);
|
|
1394
|
+
var unusedNames = new Set(Object.keys(variables));
|
|
1395
|
+
graphql.visit(operation.query, {
|
|
1396
|
+
Variable: function (node, _key, parent) {
|
|
1397
|
+
if (parent && parent.kind !== 'VariableDefinition') {
|
|
1398
|
+
unusedNames.delete(node.name.value);
|
|
1399
|
+
}
|
|
1400
|
+
},
|
|
1401
|
+
});
|
|
1402
|
+
unusedNames.forEach(function (name) {
|
|
1403
|
+
delete result[name];
|
|
1404
|
+
});
|
|
1405
|
+
return result;
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1289
1408
|
function passthrough(op, forward) {
|
|
1290
1409
|
return (forward ? forward(op) : zenObservableTs.Observable.of());
|
|
1291
1410
|
}
|
|
@@ -1295,15 +1414,6 @@ function toLink(handler) {
|
|
|
1295
1414
|
function isTerminating(link) {
|
|
1296
1415
|
return link.request.length <= 1;
|
|
1297
1416
|
}
|
|
1298
|
-
var LinkError = (function (_super) {
|
|
1299
|
-
tslib.__extends(LinkError, _super);
|
|
1300
|
-
function LinkError(message, link) {
|
|
1301
|
-
var _this = _super.call(this, message) || this;
|
|
1302
|
-
_this.link = link;
|
|
1303
|
-
return _this;
|
|
1304
|
-
}
|
|
1305
|
-
return LinkError;
|
|
1306
|
-
}(Error));
|
|
1307
1417
|
var ApolloLink = (function () {
|
|
1308
1418
|
function ApolloLink(request) {
|
|
1309
1419
|
if (request)
|
|
@@ -1341,7 +1451,7 @@ var ApolloLink = (function () {
|
|
|
1341
1451
|
ApolloLink.concat = function (first, second) {
|
|
1342
1452
|
var firstLink = toLink(first);
|
|
1343
1453
|
if (isTerminating(firstLink)) {
|
|
1344
|
-
__DEV__ &&
|
|
1454
|
+
__DEV__ && invariant.warn(35, firstLink);
|
|
1345
1455
|
return firstLink;
|
|
1346
1456
|
}
|
|
1347
1457
|
var nextLink = toLink(second);
|
|
@@ -1365,7 +1475,7 @@ var ApolloLink = (function () {
|
|
|
1365
1475
|
return ApolloLink.concat(this, next);
|
|
1366
1476
|
};
|
|
1367
1477
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
1368
|
-
throw
|
|
1478
|
+
throw newInvariantError(36);
|
|
1369
1479
|
};
|
|
1370
1480
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
1371
1481
|
if (observer && observer.error) {
|
|
@@ -1391,8 +1501,6 @@ var concat = ApolloLink.concat;
|
|
|
1391
1501
|
|
|
1392
1502
|
var execute = ApolloLink.execute;
|
|
1393
1503
|
|
|
1394
|
-
var version = '3.8.0-alpha.8';
|
|
1395
|
-
|
|
1396
1504
|
function asyncIterator(source) {
|
|
1397
1505
|
var _a;
|
|
1398
1506
|
var iterator = source[Symbol.asyncIterator]();
|
|
@@ -1536,60 +1644,115 @@ function responseIterator(response) {
|
|
|
1536
1644
|
throw new Error("Unknown body type for responseIterator. Please pass a streamable response.");
|
|
1537
1645
|
}
|
|
1538
1646
|
|
|
1647
|
+
var PROTOCOL_ERRORS_SYMBOL = Symbol();
|
|
1648
|
+
function graphQLResultHasProtocolErrors(result) {
|
|
1649
|
+
if (result.extensions) {
|
|
1650
|
+
return Array.isArray(result.extensions[PROTOCOL_ERRORS_SYMBOL]);
|
|
1651
|
+
}
|
|
1652
|
+
return false;
|
|
1653
|
+
}
|
|
1654
|
+
function isApolloError(err) {
|
|
1655
|
+
return err.hasOwnProperty('graphQLErrors');
|
|
1656
|
+
}
|
|
1657
|
+
var generateErrorMessage = function (err) {
|
|
1658
|
+
var errors = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], err.graphQLErrors, true), err.clientErrors, true), err.protocolErrors, true);
|
|
1659
|
+
if (err.networkError)
|
|
1660
|
+
errors.push(err.networkError);
|
|
1661
|
+
return errors
|
|
1662
|
+
.map(function (err) { return isNonNullObject(err) && err.message || 'Error message not found.'; })
|
|
1663
|
+
.join('\n');
|
|
1664
|
+
};
|
|
1665
|
+
var ApolloError = (function (_super) {
|
|
1666
|
+
tslib.__extends(ApolloError, _super);
|
|
1667
|
+
function ApolloError(_a) {
|
|
1668
|
+
var graphQLErrors = _a.graphQLErrors, protocolErrors = _a.protocolErrors, clientErrors = _a.clientErrors, networkError = _a.networkError, errorMessage = _a.errorMessage, extraInfo = _a.extraInfo;
|
|
1669
|
+
var _this = _super.call(this, errorMessage) || this;
|
|
1670
|
+
_this.name = 'ApolloError';
|
|
1671
|
+
_this.graphQLErrors = graphQLErrors || [];
|
|
1672
|
+
_this.protocolErrors = protocolErrors || [];
|
|
1673
|
+
_this.clientErrors = clientErrors || [];
|
|
1674
|
+
_this.networkError = networkError || null;
|
|
1675
|
+
_this.message = errorMessage || generateErrorMessage(_this);
|
|
1676
|
+
_this.extraInfo = extraInfo;
|
|
1677
|
+
_this.__proto__ = ApolloError.prototype;
|
|
1678
|
+
return _this;
|
|
1679
|
+
}
|
|
1680
|
+
return ApolloError;
|
|
1681
|
+
}(Error));
|
|
1682
|
+
|
|
1539
1683
|
var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
1540
1684
|
function readMultipartBody(response, observer) {
|
|
1541
|
-
var _a, _b, _c;
|
|
1685
|
+
var _a, _b, _c, _d, _e;
|
|
1542
1686
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1543
|
-
var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running,
|
|
1544
|
-
var
|
|
1545
|
-
return tslib.__generator(this, function (
|
|
1546
|
-
switch (
|
|
1687
|
+
var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _f, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next;
|
|
1688
|
+
var _g, _h;
|
|
1689
|
+
return tslib.__generator(this, function (_j) {
|
|
1690
|
+
switch (_j.label) {
|
|
1547
1691
|
case 0:
|
|
1548
1692
|
if (TextDecoder === undefined) {
|
|
1549
1693
|
throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");
|
|
1550
1694
|
}
|
|
1551
1695
|
decoder = new TextDecoder("utf-8");
|
|
1552
|
-
contentType = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get(
|
|
1696
|
+
contentType = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type");
|
|
1553
1697
|
delimiter = "boundary=";
|
|
1554
1698
|
boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter))
|
|
1555
1699
|
? contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['"]/g, "").replace(/\;(.*)/gm, "").trim()
|
|
1556
1700
|
: "-";
|
|
1557
|
-
boundary = "--".concat(boundaryVal);
|
|
1701
|
+
boundary = "\r\n--".concat(boundaryVal);
|
|
1558
1702
|
buffer = "";
|
|
1559
1703
|
iterator = responseIterator(response);
|
|
1560
1704
|
running = true;
|
|
1561
|
-
|
|
1705
|
+
_j.label = 1;
|
|
1562
1706
|
case 1:
|
|
1563
1707
|
if (!running) return [3, 3];
|
|
1564
1708
|
return [4, iterator.next()];
|
|
1565
1709
|
case 2:
|
|
1566
|
-
|
|
1710
|
+
_f = _j.sent(), value = _f.value, done = _f.done;
|
|
1567
1711
|
chunk = typeof value === "string" ? value : decoder.decode(value);
|
|
1712
|
+
searchFrom = buffer.length - boundary.length + 1;
|
|
1568
1713
|
running = !done;
|
|
1569
1714
|
buffer += chunk;
|
|
1570
|
-
bi = buffer.indexOf(boundary);
|
|
1715
|
+
bi = buffer.indexOf(boundary, searchFrom);
|
|
1571
1716
|
while (bi > -1) {
|
|
1572
1717
|
message = void 0;
|
|
1573
|
-
|
|
1718
|
+
_g = [
|
|
1574
1719
|
buffer.slice(0, bi),
|
|
1575
1720
|
buffer.slice(bi + boundary.length),
|
|
1576
|
-
], message =
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1721
|
+
], message = _g[0], buffer = _g[1];
|
|
1722
|
+
i = message.indexOf("\r\n\r\n");
|
|
1723
|
+
headers = parseHeaders(message.slice(0, i));
|
|
1724
|
+
contentType_1 = headers["content-type"];
|
|
1725
|
+
if (contentType_1 &&
|
|
1726
|
+
contentType_1.toLowerCase().indexOf("application/json") === -1) {
|
|
1727
|
+
throw new Error("Unsupported patch content type: application/json is required.");
|
|
1728
|
+
}
|
|
1729
|
+
body = message.slice(i);
|
|
1730
|
+
if (body) {
|
|
1586
1731
|
try {
|
|
1587
|
-
result = parseJsonBody(response, body
|
|
1732
|
+
result = parseJsonBody(response, body);
|
|
1588
1733
|
if (Object.keys(result).length > 1 ||
|
|
1589
1734
|
"data" in result ||
|
|
1590
1735
|
"incremental" in result ||
|
|
1591
|
-
"errors" in result
|
|
1592
|
-
|
|
1736
|
+
"errors" in result ||
|
|
1737
|
+
"payload" in result) {
|
|
1738
|
+
if (isApolloPayloadResult(result)) {
|
|
1739
|
+
next = {};
|
|
1740
|
+
if ("payload" in result) {
|
|
1741
|
+
next = tslib.__assign({}, result.payload);
|
|
1742
|
+
}
|
|
1743
|
+
if ("errors" in result) {
|
|
1744
|
+
next = tslib.__assign(tslib.__assign({}, next), { extensions: tslib.__assign(tslib.__assign({}, ("extensions" in next ? next.extensions : null)), (_h = {}, _h[PROTOCOL_ERRORS_SYMBOL] = result.errors, _h)) });
|
|
1745
|
+
}
|
|
1746
|
+
(_b = observer.next) === null || _b === void 0 ? void 0 : _b.call(observer, next);
|
|
1747
|
+
}
|
|
1748
|
+
else {
|
|
1749
|
+
(_c = observer.next) === null || _c === void 0 ? void 0 : _c.call(observer, result);
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
else if (Object.keys(result).length === 1 &&
|
|
1753
|
+
"hasNext" in result &&
|
|
1754
|
+
!result.hasNext) {
|
|
1755
|
+
(_d = observer.complete) === null || _d === void 0 ? void 0 : _d.call(observer);
|
|
1593
1756
|
}
|
|
1594
1757
|
}
|
|
1595
1758
|
catch (err) {
|
|
@@ -1600,7 +1763,7 @@ function readMultipartBody(response, observer) {
|
|
|
1600
1763
|
}
|
|
1601
1764
|
return [3, 1];
|
|
1602
1765
|
case 3:
|
|
1603
|
-
(
|
|
1766
|
+
(_e = observer.complete) === null || _e === void 0 ? void 0 : _e.call(observer);
|
|
1604
1767
|
return [2];
|
|
1605
1768
|
}
|
|
1606
1769
|
});
|
|
@@ -1687,7 +1850,7 @@ var serializeFetchParameter = function (p, label) {
|
|
|
1687
1850
|
serialized = JSON.stringify(p);
|
|
1688
1851
|
}
|
|
1689
1852
|
catch (e) {
|
|
1690
|
-
var parseError =
|
|
1853
|
+
var parseError = newInvariantError(39, label, e.message);
|
|
1691
1854
|
parseError.parseError = e;
|
|
1692
1855
|
throw parseError;
|
|
1693
1856
|
}
|
|
@@ -1770,7 +1933,7 @@ function removeDuplicateHeaders(headers, preserveHeaderCase) {
|
|
|
1770
1933
|
|
|
1771
1934
|
var checkFetcher = function (fetcher) {
|
|
1772
1935
|
if (!fetcher && typeof fetch === 'undefined') {
|
|
1773
|
-
throw
|
|
1936
|
+
throw newInvariantError(37);
|
|
1774
1937
|
}
|
|
1775
1938
|
};
|
|
1776
1939
|
|
|
@@ -1880,20 +2043,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
1880
2043
|
}
|
|
1881
2044
|
var _b = selectHttpOptionsAndBodyInternal(operation, print, fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body;
|
|
1882
2045
|
if (body.variables && !includeUnusedVariables) {
|
|
1883
|
-
|
|
1884
|
-
graphql.visit(operation.query, {
|
|
1885
|
-
Variable: function (node, _key, parent) {
|
|
1886
|
-
if (parent && parent.kind !== 'VariableDefinition') {
|
|
1887
|
-
unusedNames_1.delete(node.name.value);
|
|
1888
|
-
}
|
|
1889
|
-
},
|
|
1890
|
-
});
|
|
1891
|
-
if (unusedNames_1.size) {
|
|
1892
|
-
body.variables = tslib.__assign({}, body.variables);
|
|
1893
|
-
unusedNames_1.forEach(function (name) {
|
|
1894
|
-
delete body.variables[name];
|
|
1895
|
-
});
|
|
1896
|
-
}
|
|
2046
|
+
body.variables = filterOperationVariables(body.variables, operation);
|
|
1897
2047
|
}
|
|
1898
2048
|
var controller;
|
|
1899
2049
|
if (!options.signal) {
|
|
@@ -1905,13 +2055,28 @@ var createHttpLink = function (linkOptions) {
|
|
|
1905
2055
|
var definitionIsMutation = function (d) {
|
|
1906
2056
|
return d.kind === 'OperationDefinition' && d.operation === 'mutation';
|
|
1907
2057
|
};
|
|
2058
|
+
var definitionIsSubscription = function (d) {
|
|
2059
|
+
return d.kind === 'OperationDefinition' && d.operation === 'subscription';
|
|
2060
|
+
};
|
|
2061
|
+
var isSubscription = definitionIsSubscription(getMainDefinition(operation.query));
|
|
2062
|
+
var hasDefer = hasDirectives(['defer'], operation.query);
|
|
1908
2063
|
if (useGETForQueries &&
|
|
1909
2064
|
!operation.query.definitions.some(definitionIsMutation)) {
|
|
1910
2065
|
options.method = 'GET';
|
|
1911
2066
|
}
|
|
1912
|
-
if (
|
|
2067
|
+
if (hasDefer || isSubscription) {
|
|
1913
2068
|
options.headers = options.headers || {};
|
|
1914
|
-
|
|
2069
|
+
var acceptHeader = "multipart/mixed;";
|
|
2070
|
+
if (isSubscription && hasDefer) {
|
|
2071
|
+
__DEV__ && invariant.warn(38);
|
|
2072
|
+
}
|
|
2073
|
+
if (isSubscription) {
|
|
2074
|
+
acceptHeader += 'boundary=graphql;subscriptionSpec=1.0,application/json';
|
|
2075
|
+
}
|
|
2076
|
+
else if (hasDefer) {
|
|
2077
|
+
acceptHeader += 'deferSpec=20220824,application/json';
|
|
2078
|
+
}
|
|
2079
|
+
options.headers.accept = acceptHeader;
|
|
1915
2080
|
}
|
|
1916
2081
|
if (options.method === 'GET') {
|
|
1917
2082
|
var _d = rewriteURIForGET(chosenURI, body), newURI = _d.newURI, parseError = _d.parseError;
|
|
@@ -1964,6 +2129,7 @@ var HttpLink = (function (_super) {
|
|
|
1964
2129
|
|
|
1965
2130
|
var ApolloCache = (function () {
|
|
1966
2131
|
function ApolloCache() {
|
|
2132
|
+
this.assumeImmutableResults = false;
|
|
1967
2133
|
this.getFragmentDoc = optimism.wrap(getFragmentQueryDocument);
|
|
1968
2134
|
}
|
|
1969
2135
|
ApolloCache.prototype.batch = function (options) {
|
|
@@ -2239,7 +2405,7 @@ var EntityStore = (function () {
|
|
|
2239
2405
|
: newer;
|
|
2240
2406
|
if (!incoming)
|
|
2241
2407
|
return;
|
|
2242
|
-
|
|
2408
|
+
invariant(typeof dataId === "string", 1);
|
|
2243
2409
|
var merged = new DeepMerger(storeObjectReconciler).merge(existing, incoming);
|
|
2244
2410
|
this.data[dataId] = merged;
|
|
2245
2411
|
if (merged !== existing) {
|
|
@@ -2562,7 +2728,7 @@ var Layer = (function (_super) {
|
|
|
2562
2728
|
}
|
|
2563
2729
|
else if (ownStoreObject !== parentStoreObject) {
|
|
2564
2730
|
Object.keys(ownStoreObject).forEach(function (storeFieldName) {
|
|
2565
|
-
if (!
|
|
2731
|
+
if (!equal.equal(ownStoreObject[storeFieldName], parentStoreObject[storeFieldName])) {
|
|
2566
2732
|
_this.group.dirty(dataId, storeFieldName);
|
|
2567
2733
|
}
|
|
2568
2734
|
});
|
|
@@ -2606,7 +2772,7 @@ var Stump = (function (_super) {
|
|
|
2606
2772
|
function storeObjectReconciler(existingObject, incomingObject, property) {
|
|
2607
2773
|
var existingValue = existingObject[property];
|
|
2608
2774
|
var incomingValue = incomingObject[property];
|
|
2609
|
-
return
|
|
2775
|
+
return equal.equal(existingValue, incomingValue) ? existingValue : incomingValue;
|
|
2610
2776
|
}
|
|
2611
2777
|
function supportsResultCaching(store) {
|
|
2612
2778
|
return !!(store instanceof EntityStore && store.group.caching);
|
|
@@ -2894,7 +3060,7 @@ var StoreReader = (function () {
|
|
|
2894
3060
|
else {
|
|
2895
3061
|
var fragment = getFragmentFromSelection(selection, context.lookupFragment);
|
|
2896
3062
|
if (!fragment && selection.kind === graphql.Kind.FRAGMENT_SPREAD) {
|
|
2897
|
-
throw
|
|
3063
|
+
throw newInvariantError(7, selection.name.value);
|
|
2898
3064
|
}
|
|
2899
3065
|
if (fragment && policies.fragmentMatches(fragment, typename)) {
|
|
2900
3066
|
fragment.selectionSet.selections.forEach(workSet.add, workSet);
|
|
@@ -2975,7 +3141,12 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
2975
3141
|
var workSet_1 = new Set([fieldValue]);
|
|
2976
3142
|
workSet_1.forEach(function (value) {
|
|
2977
3143
|
if (isNonNullObject(value)) {
|
|
2978
|
-
|
|
3144
|
+
invariant(
|
|
3145
|
+
!isReference(value),
|
|
3146
|
+
8,
|
|
3147
|
+
getTypenameFromStoreObject(store, value),
|
|
3148
|
+
field.name.value
|
|
3149
|
+
);
|
|
2979
3150
|
Object.values(value).forEach(workSet_1.add, workSet_1);
|
|
2980
3151
|
}
|
|
2981
3152
|
});
|
|
@@ -3062,7 +3233,7 @@ function keyFieldsFnFromSpecifier(specifier) {
|
|
|
3062
3233
|
hasOwn.call(object, schemaKeyPath[0])) {
|
|
3063
3234
|
extracted = extractKeyPath(object, schemaKeyPath, extractKey);
|
|
3064
3235
|
}
|
|
3065
|
-
|
|
3236
|
+
invariant(extracted !== void 0, 2, schemaKeyPath.join('.'), object);
|
|
3066
3237
|
return extracted;
|
|
3067
3238
|
});
|
|
3068
3239
|
return "".concat(context.typename, ":").concat(JSON.stringify(keyObject));
|
|
@@ -3214,7 +3385,7 @@ var Policies = (function () {
|
|
|
3214
3385
|
var policy = typename && this.getTypePolicy(typename);
|
|
3215
3386
|
var keyFn = policy && policy.keyFn || this.config.dataIdFromObject;
|
|
3216
3387
|
while (keyFn) {
|
|
3217
|
-
var specifierOrId = keyFn(object, context);
|
|
3388
|
+
var specifierOrId = keyFn(tslib.__assign(tslib.__assign({}, object), storeObject), context);
|
|
3218
3389
|
if (isArray(specifierOrId)) {
|
|
3219
3390
|
keyFn = keyFieldsFnFromSpecifier(specifierOrId);
|
|
3220
3391
|
}
|
|
@@ -3291,7 +3462,7 @@ var Policies = (function () {
|
|
|
3291
3462
|
var rootId = "ROOT_" + which.toUpperCase();
|
|
3292
3463
|
var old = this.rootTypenamesById[rootId];
|
|
3293
3464
|
if (typename !== old) {
|
|
3294
|
-
|
|
3465
|
+
invariant(!old || old === which, 3, which);
|
|
3295
3466
|
if (old)
|
|
3296
3467
|
delete this.rootIdsByTypename[old];
|
|
3297
3468
|
this.rootIdsByTypename[typename] = rootId;
|
|
@@ -3317,9 +3488,20 @@ var Policies = (function () {
|
|
|
3317
3488
|
if (!hasOwn.call(this.typePolicies, typename)) {
|
|
3318
3489
|
var policy_1 = this.typePolicies[typename] = Object.create(null);
|
|
3319
3490
|
policy_1.fields = Object.create(null);
|
|
3320
|
-
var
|
|
3321
|
-
if (
|
|
3322
|
-
|
|
3491
|
+
var supertypes_1 = this.supertypeMap.get(typename);
|
|
3492
|
+
if (!supertypes_1 && this.fuzzySubtypes.size) {
|
|
3493
|
+
supertypes_1 = this.getSupertypeSet(typename, true);
|
|
3494
|
+
this.fuzzySubtypes.forEach(function (regExp, fuzzy) {
|
|
3495
|
+
if (regExp.test(typename)) {
|
|
3496
|
+
var fuzzySupertypes = _this.supertypeMap.get(fuzzy);
|
|
3497
|
+
if (fuzzySupertypes) {
|
|
3498
|
+
fuzzySupertypes.forEach(function (supertype) { return supertypes_1.add(supertype); });
|
|
3499
|
+
}
|
|
3500
|
+
}
|
|
3501
|
+
});
|
|
3502
|
+
}
|
|
3503
|
+
if (supertypes_1 && supertypes_1.size) {
|
|
3504
|
+
supertypes_1.forEach(function (supertype) {
|
|
3323
3505
|
var _a = _this.getTypePolicy(supertype), fields = _a.fields, rest = tslib.__rest(_a, ["fields"]);
|
|
3324
3506
|
Object.assign(policy_1, rest);
|
|
3325
3507
|
Object.assign(policy_1.fields, fields);
|
|
@@ -3375,7 +3557,7 @@ var Policies = (function () {
|
|
|
3375
3557
|
if (supertypeSet.has(supertype)) {
|
|
3376
3558
|
if (!typenameSupertypeSet.has(supertype)) {
|
|
3377
3559
|
if (checkingFuzzySubtypes) {
|
|
3378
|
-
__DEV__ &&
|
|
3560
|
+
__DEV__ && invariant.warn(4, typename, supertype);
|
|
3379
3561
|
}
|
|
3380
3562
|
typenameSupertypeSet.add(supertype);
|
|
3381
3563
|
}
|
|
@@ -3529,7 +3711,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
3529
3711
|
}
|
|
3530
3712
|
}
|
|
3531
3713
|
if (__DEV__ && options.from === void 0) {
|
|
3532
|
-
__DEV__ &&
|
|
3714
|
+
__DEV__ && invariant.warn(5, stringifyForDisplay(Array.from(readFieldArgs)));
|
|
3533
3715
|
}
|
|
3534
3716
|
if (void 0 === options.variables) {
|
|
3535
3717
|
options.variables = variables;
|
|
@@ -3539,7 +3721,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
3539
3721
|
function makeMergeObjectsFunction(store) {
|
|
3540
3722
|
return function mergeObjects(existing, incoming) {
|
|
3541
3723
|
if (isArray(existing) || isArray(incoming)) {
|
|
3542
|
-
throw
|
|
3724
|
+
throw newInvariantError(6);
|
|
3543
3725
|
}
|
|
3544
3726
|
if (isNonNullObject(existing) &&
|
|
3545
3727
|
isNonNullObject(incoming)) {
|
|
@@ -3600,7 +3782,7 @@ var StoreWriter = (function () {
|
|
|
3600
3782
|
context: context,
|
|
3601
3783
|
});
|
|
3602
3784
|
if (!isReference(ref)) {
|
|
3603
|
-
throw
|
|
3785
|
+
throw newInvariantError(9, result);
|
|
3604
3786
|
}
|
|
3605
3787
|
context.incomingById.forEach(function (_a, dataId) {
|
|
3606
3788
|
var storeObject = _a.storeObject, mergeTree = _a.mergeTree, fieldNodeSet = _a.fieldNodeSet;
|
|
@@ -3705,7 +3887,7 @@ var StoreWriter = (function () {
|
|
|
3705
3887
|
!context.deferred &&
|
|
3706
3888
|
!addTypenameToDocument.added(field) &&
|
|
3707
3889
|
!policies.getReadFunction(typename, field.name.value)) {
|
|
3708
|
-
__DEV__ &&
|
|
3890
|
+
__DEV__ && invariant.error(10, resultKeyNameFromField(field), result);
|
|
3709
3891
|
}
|
|
3710
3892
|
});
|
|
3711
3893
|
try {
|
|
@@ -3809,7 +3991,7 @@ var StoreWriter = (function () {
|
|
|
3809
3991
|
else {
|
|
3810
3992
|
var fragment = getFragmentFromSelection(selection, context.lookupFragment);
|
|
3811
3993
|
if (!fragment && selection.kind === graphql.Kind.FRAGMENT_SPREAD) {
|
|
3812
|
-
throw
|
|
3994
|
+
throw newInvariantError(11, selection.name.value);
|
|
3813
3995
|
}
|
|
3814
3996
|
if (fragment &&
|
|
3815
3997
|
policies.fragmentMatches(fragment, typename, result, context.variables)) {
|
|
@@ -3850,7 +4032,7 @@ var StoreWriter = (function () {
|
|
|
3850
4032
|
changedFields_1.set(storeFieldName, aVal);
|
|
3851
4033
|
}
|
|
3852
4034
|
if (getStorageArgs) {
|
|
3853
|
-
|
|
4035
|
+
invariant(getStorageArgs.pop() === storeFieldName);
|
|
3854
4036
|
}
|
|
3855
4037
|
});
|
|
3856
4038
|
if (changedFields_1) {
|
|
@@ -3922,7 +4104,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
3922
4104
|
return;
|
|
3923
4105
|
if (isReference(existing))
|
|
3924
4106
|
return;
|
|
3925
|
-
if (
|
|
4107
|
+
if (equal.equal(existing, incoming))
|
|
3926
4108
|
return;
|
|
3927
4109
|
if (Object.keys(existing).every(function (key) { return store.getFieldValue(incoming, key) !== void 0; })) {
|
|
3928
4110
|
return;
|
|
@@ -3945,10 +4127,9 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
3945
4127
|
}
|
|
3946
4128
|
});
|
|
3947
4129
|
}
|
|
3948
|
-
__DEV__ &&
|
|
3949
|
-
? "either ensure all objects of type " +
|
|
3950
|
-
|
|
3951
|
-
: "", "define a custom merge function for the ").concat(typeDotName, " field, so InMemoryCache can safely merge these objects:\n\n existing: ").concat(JSON.stringify(existing).slice(0, 1000), "\n incoming: ").concat(JSON.stringify(incoming).slice(0, 1000), "\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n"));
|
|
4130
|
+
__DEV__ && invariant.warn(12, fieldName, parentType, childTypenames.length
|
|
4131
|
+
? "either ensure all objects of type " + childTypenames.join(" and ") + " have an ID or a custom merge function, or "
|
|
4132
|
+
: "", typeDotName, existing, incoming);
|
|
3952
4133
|
}
|
|
3953
4134
|
|
|
3954
4135
|
var InMemoryCache = (function (_super) {
|
|
@@ -3957,7 +4138,8 @@ var InMemoryCache = (function (_super) {
|
|
|
3957
4138
|
if (config === void 0) { config = {}; }
|
|
3958
4139
|
var _this = _super.call(this) || this;
|
|
3959
4140
|
_this.watches = new Set();
|
|
3960
|
-
_this.
|
|
4141
|
+
_this.addTypenameTransform = new DocumentTransform(addTypenameToDocument);
|
|
4142
|
+
_this.assumeImmutableResults = true;
|
|
3961
4143
|
_this.makeVar = makeVar;
|
|
3962
4144
|
_this.txCount = 0;
|
|
3963
4145
|
_this.config = normalizeConfig(config);
|
|
@@ -4105,7 +4287,7 @@ var InMemoryCache = (function (_super) {
|
|
|
4105
4287
|
return this.policies.identify(object)[0];
|
|
4106
4288
|
}
|
|
4107
4289
|
catch (e) {
|
|
4108
|
-
__DEV__ &&
|
|
4290
|
+
__DEV__ && invariant.warn(e);
|
|
4109
4291
|
}
|
|
4110
4292
|
};
|
|
4111
4293
|
InMemoryCache.prototype.evict = function (options) {
|
|
@@ -4208,28 +4390,25 @@ var InMemoryCache = (function (_super) {
|
|
|
4208
4390
|
});
|
|
4209
4391
|
};
|
|
4210
4392
|
InMemoryCache.prototype.transformDocument = function (document) {
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
}
|
|
4218
|
-
return result;
|
|
4393
|
+
return this.addTypenameToDocument(this.addFragmentsToDocument(document));
|
|
4394
|
+
};
|
|
4395
|
+
InMemoryCache.prototype.broadcastWatches = function (options) {
|
|
4396
|
+
var _this = this;
|
|
4397
|
+
if (!this.txCount) {
|
|
4398
|
+
this.watches.forEach(function (c) { return _this.maybeBroadcastWatch(c, options); });
|
|
4219
4399
|
}
|
|
4220
|
-
return document;
|
|
4221
4400
|
};
|
|
4222
|
-
InMemoryCache.prototype.
|
|
4401
|
+
InMemoryCache.prototype.addFragmentsToDocument = function (document) {
|
|
4223
4402
|
var fragments = this.config.fragments;
|
|
4224
4403
|
return fragments
|
|
4225
4404
|
? fragments.transform(document)
|
|
4226
4405
|
: document;
|
|
4227
4406
|
};
|
|
4228
|
-
InMemoryCache.prototype.
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
this.watches.forEach(function (c) { return _this.maybeBroadcastWatch(c, options); });
|
|
4407
|
+
InMemoryCache.prototype.addTypenameToDocument = function (document) {
|
|
4408
|
+
if (this.addTypename) {
|
|
4409
|
+
return this.addTypenameTransform.transformDocument(document);
|
|
4232
4410
|
}
|
|
4411
|
+
return document;
|
|
4233
4412
|
};
|
|
4234
4413
|
InMemoryCache.prototype.broadcastWatch = function (c, options) {
|
|
4235
4414
|
var lastDiff = c.lastDiff;
|
|
@@ -4244,51 +4423,13 @@ var InMemoryCache = (function (_super) {
|
|
|
4244
4423
|
return;
|
|
4245
4424
|
}
|
|
4246
4425
|
}
|
|
4247
|
-
if (!lastDiff || !
|
|
4426
|
+
if (!lastDiff || !equal.equal(lastDiff.result, diff.result)) {
|
|
4248
4427
|
c.callback(c.lastDiff = diff, lastDiff);
|
|
4249
4428
|
}
|
|
4250
4429
|
};
|
|
4251
4430
|
return InMemoryCache;
|
|
4252
4431
|
}(ApolloCache));
|
|
4253
4432
|
|
|
4254
|
-
function isApolloError(err) {
|
|
4255
|
-
return err.hasOwnProperty('graphQLErrors');
|
|
4256
|
-
}
|
|
4257
|
-
var generateErrorMessage = function (err) {
|
|
4258
|
-
var message = '';
|
|
4259
|
-
if (isNonEmptyArray(err.graphQLErrors) || isNonEmptyArray(err.clientErrors)) {
|
|
4260
|
-
var errors = (err.graphQLErrors || [])
|
|
4261
|
-
.concat(err.clientErrors || []);
|
|
4262
|
-
errors.forEach(function (error) {
|
|
4263
|
-
var errorMessage = error
|
|
4264
|
-
? error.message
|
|
4265
|
-
: 'Error message not found.';
|
|
4266
|
-
message += "".concat(errorMessage, "\n");
|
|
4267
|
-
});
|
|
4268
|
-
}
|
|
4269
|
-
if (err.networkError) {
|
|
4270
|
-
message += "".concat(err.networkError.message, "\n");
|
|
4271
|
-
}
|
|
4272
|
-
message = message.replace(/\n$/, '');
|
|
4273
|
-
return message;
|
|
4274
|
-
};
|
|
4275
|
-
var ApolloError = (function (_super) {
|
|
4276
|
-
tslib.__extends(ApolloError, _super);
|
|
4277
|
-
function ApolloError(_a) {
|
|
4278
|
-
var graphQLErrors = _a.graphQLErrors, clientErrors = _a.clientErrors, networkError = _a.networkError, errorMessage = _a.errorMessage, extraInfo = _a.extraInfo;
|
|
4279
|
-
var _this = _super.call(this, errorMessage) || this;
|
|
4280
|
-
_this.name = 'ApolloError';
|
|
4281
|
-
_this.graphQLErrors = graphQLErrors || [];
|
|
4282
|
-
_this.clientErrors = clientErrors || [];
|
|
4283
|
-
_this.networkError = networkError || null;
|
|
4284
|
-
_this.message = errorMessage || generateErrorMessage(_this);
|
|
4285
|
-
_this.extraInfo = extraInfo;
|
|
4286
|
-
_this.__proto__ = ApolloError.prototype;
|
|
4287
|
-
return _this;
|
|
4288
|
-
}
|
|
4289
|
-
return ApolloError;
|
|
4290
|
-
}(Error));
|
|
4291
|
-
|
|
4292
4433
|
exports.NetworkStatus = void 0;
|
|
4293
4434
|
(function (NetworkStatus) {
|
|
4294
4435
|
NetworkStatus[NetworkStatus["loading"] = 1] = "loading";
|
|
@@ -4302,6 +4443,73 @@ exports.NetworkStatus = void 0;
|
|
|
4302
4443
|
function isNetworkRequestInFlight(networkStatus) {
|
|
4303
4444
|
return networkStatus ? networkStatus < 7 : false;
|
|
4304
4445
|
}
|
|
4446
|
+
function isNetworkRequestSettled(networkStatus) {
|
|
4447
|
+
return networkStatus === 7 || networkStatus === 8;
|
|
4448
|
+
}
|
|
4449
|
+
|
|
4450
|
+
function equalByQuery(query, _a, _b, variables) {
|
|
4451
|
+
var aData = _a.data, aRest = tslib.__rest(_a, ["data"]);
|
|
4452
|
+
var bData = _b.data, bRest = tslib.__rest(_b, ["data"]);
|
|
4453
|
+
return equal__default(aRest, bRest) && equalBySelectionSet(getMainDefinition(query).selectionSet, aData, bData, {
|
|
4454
|
+
fragmentMap: createFragmentMap(getFragmentDefinitions(query)),
|
|
4455
|
+
variables: variables,
|
|
4456
|
+
});
|
|
4457
|
+
}
|
|
4458
|
+
function equalBySelectionSet(selectionSet, aResult, bResult, context) {
|
|
4459
|
+
if (aResult === bResult) {
|
|
4460
|
+
return true;
|
|
4461
|
+
}
|
|
4462
|
+
var seenSelections = new Set();
|
|
4463
|
+
return selectionSet.selections.every(function (selection) {
|
|
4464
|
+
if (seenSelections.has(selection))
|
|
4465
|
+
return true;
|
|
4466
|
+
seenSelections.add(selection);
|
|
4467
|
+
if (!shouldInclude(selection, context.variables))
|
|
4468
|
+
return true;
|
|
4469
|
+
if (selectionHasNonreactiveDirective(selection))
|
|
4470
|
+
return true;
|
|
4471
|
+
if (isField(selection)) {
|
|
4472
|
+
var resultKey = resultKeyNameFromField(selection);
|
|
4473
|
+
var aResultChild = aResult && aResult[resultKey];
|
|
4474
|
+
var bResultChild = bResult && bResult[resultKey];
|
|
4475
|
+
var childSelectionSet = selection.selectionSet;
|
|
4476
|
+
if (!childSelectionSet) {
|
|
4477
|
+
return equal__default(aResultChild, bResultChild);
|
|
4478
|
+
}
|
|
4479
|
+
var aChildIsArray = Array.isArray(aResultChild);
|
|
4480
|
+
var bChildIsArray = Array.isArray(bResultChild);
|
|
4481
|
+
if (aChildIsArray !== bChildIsArray)
|
|
4482
|
+
return false;
|
|
4483
|
+
if (aChildIsArray && bChildIsArray) {
|
|
4484
|
+
var length_1 = aResultChild.length;
|
|
4485
|
+
if (bResultChild.length !== length_1) {
|
|
4486
|
+
return false;
|
|
4487
|
+
}
|
|
4488
|
+
for (var i = 0; i < length_1; ++i) {
|
|
4489
|
+
if (!equalBySelectionSet(childSelectionSet, aResultChild[i], bResultChild[i], context)) {
|
|
4490
|
+
return false;
|
|
4491
|
+
}
|
|
4492
|
+
}
|
|
4493
|
+
return true;
|
|
4494
|
+
}
|
|
4495
|
+
return equalBySelectionSet(childSelectionSet, aResultChild, bResultChild, context);
|
|
4496
|
+
}
|
|
4497
|
+
else {
|
|
4498
|
+
var fragment = getFragmentFromSelection(selection, context.fragmentMap);
|
|
4499
|
+
if (fragment) {
|
|
4500
|
+
if (selectionHasNonreactiveDirective(fragment))
|
|
4501
|
+
return true;
|
|
4502
|
+
return equalBySelectionSet(fragment.selectionSet, aResult, bResult, context);
|
|
4503
|
+
}
|
|
4504
|
+
}
|
|
4505
|
+
});
|
|
4506
|
+
}
|
|
4507
|
+
function selectionHasNonreactiveDirective(selection) {
|
|
4508
|
+
return !!selection.directives && selection.directives.some(directiveIsNonreactive);
|
|
4509
|
+
}
|
|
4510
|
+
function directiveIsNonreactive(dir) {
|
|
4511
|
+
return dir.name.value === "nonreactive";
|
|
4512
|
+
}
|
|
4305
4513
|
|
|
4306
4514
|
var assign = Object.assign, hasOwnProperty$2 = Object.hasOwnProperty;
|
|
4307
4515
|
var ObservableQuery = (function (_super) {
|
|
@@ -4309,14 +4517,13 @@ var ObservableQuery = (function (_super) {
|
|
|
4309
4517
|
function ObservableQuery(_a) {
|
|
4310
4518
|
var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options;
|
|
4311
4519
|
var _this = _super.call(this, function (observer) {
|
|
4312
|
-
var _a = options.fetchOnFirstSubscribe, fetchOnFirstSubscribe = _a === void 0 ? true : _a;
|
|
4313
4520
|
try {
|
|
4314
4521
|
var subObserver = observer._subscription._observer;
|
|
4315
4522
|
if (subObserver && !subObserver.error) {
|
|
4316
4523
|
subObserver.error = defaultSubscriptionObserverErrorCallback;
|
|
4317
4524
|
}
|
|
4318
4525
|
}
|
|
4319
|
-
catch (
|
|
4526
|
+
catch (_a) { }
|
|
4320
4527
|
var first = !_this.observers.size;
|
|
4321
4528
|
_this.observers.add(observer);
|
|
4322
4529
|
var last = _this.last;
|
|
@@ -4326,7 +4533,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4326
4533
|
else if (last && last.result) {
|
|
4327
4534
|
observer.next && observer.next(last.result);
|
|
4328
4535
|
}
|
|
4329
|
-
if (first
|
|
4536
|
+
if (first) {
|
|
4330
4537
|
_this.reobserve().catch(function () { });
|
|
4331
4538
|
}
|
|
4332
4539
|
return function () {
|
|
@@ -4350,7 +4557,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4350
4557
|
}
|
|
4351
4558
|
Object.defineProperty(ObservableQuery.prototype, "query", {
|
|
4352
4559
|
get: function () {
|
|
4353
|
-
return this.
|
|
4560
|
+
return this.lastQuery || this.options.query;
|
|
4354
4561
|
},
|
|
4355
4562
|
enumerable: false,
|
|
4356
4563
|
configurable: true
|
|
@@ -4392,13 +4599,13 @@ var ObservableQuery = (function (_super) {
|
|
|
4392
4599
|
if (fetchPolicy === 'network-only' ||
|
|
4393
4600
|
fetchPolicy === 'no-cache' ||
|
|
4394
4601
|
fetchPolicy === 'standby' ||
|
|
4395
|
-
this.queryManager.
|
|
4602
|
+
this.queryManager.getDocumentInfo(this.query).hasForcedResolvers) ;
|
|
4396
4603
|
else {
|
|
4397
4604
|
var diff = this.queryInfo.getDiff();
|
|
4398
4605
|
if (diff.complete || this.options.returnPartialData) {
|
|
4399
4606
|
result.data = diff.result;
|
|
4400
4607
|
}
|
|
4401
|
-
if (
|
|
4608
|
+
if (equal.equal(result.data, {})) {
|
|
4402
4609
|
result.data = void 0;
|
|
4403
4610
|
}
|
|
4404
4611
|
if (diff.complete) {
|
|
@@ -4429,15 +4636,20 @@ var ObservableQuery = (function (_super) {
|
|
|
4429
4636
|
return result;
|
|
4430
4637
|
};
|
|
4431
4638
|
ObservableQuery.prototype.isDifferentFromLastResult = function (newResult, variables) {
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4639
|
+
if (!this.last) {
|
|
4640
|
+
return true;
|
|
4641
|
+
}
|
|
4642
|
+
var resultIsDifferent = this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective
|
|
4643
|
+
? !equalByQuery(this.query, this.last.result, newResult, this.variables)
|
|
4644
|
+
: !equal.equal(this.last.result, newResult);
|
|
4645
|
+
return (resultIsDifferent ||
|
|
4646
|
+
(variables && !equal.equal(this.last.variables, variables)));
|
|
4435
4647
|
};
|
|
4436
4648
|
ObservableQuery.prototype.getLast = function (key, variablesMustMatch) {
|
|
4437
4649
|
var last = this.last;
|
|
4438
4650
|
if (last &&
|
|
4439
4651
|
last[key] &&
|
|
4440
|
-
(!variablesMustMatch ||
|
|
4652
|
+
(!variablesMustMatch || equal.equal(last.variables, this.variables))) {
|
|
4441
4653
|
return last[key];
|
|
4442
4654
|
}
|
|
4443
4655
|
};
|
|
@@ -4473,10 +4685,14 @@ var ObservableQuery = (function (_super) {
|
|
|
4473
4685
|
var queryDef = getQueryDefinition(this.query);
|
|
4474
4686
|
var vars = queryDef.variableDefinitions;
|
|
4475
4687
|
if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) {
|
|
4476
|
-
__DEV__ &&
|
|
4688
|
+
__DEV__ && invariant.warn(
|
|
4689
|
+
20,
|
|
4690
|
+
variables,
|
|
4691
|
+
((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || queryDef
|
|
4692
|
+
);
|
|
4477
4693
|
}
|
|
4478
4694
|
}
|
|
4479
|
-
if (variables && !
|
|
4695
|
+
if (variables && !equal.equal(this.options.variables, variables)) {
|
|
4480
4696
|
reobserveOptions.variables = this.options.variables = tslib.__assign(tslib.__assign({}, this.options.variables), variables);
|
|
4481
4697
|
}
|
|
4482
4698
|
this.queryInfo.resetLastWrite();
|
|
@@ -4484,8 +4700,12 @@ var ObservableQuery = (function (_super) {
|
|
|
4484
4700
|
};
|
|
4485
4701
|
ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) {
|
|
4486
4702
|
var _this = this;
|
|
4487
|
-
var combinedOptions = tslib.__assign(tslib.__assign({}, (fetchMoreOptions.query ? fetchMoreOptions : tslib.__assign(tslib.__assign(tslib.__assign(tslib.__assign({}, this.options), { query: this.query }), fetchMoreOptions), { variables: tslib.__assign(tslib.__assign({}, this.options.variables), fetchMoreOptions.variables) }))), { fetchPolicy: "no-cache" });
|
|
4703
|
+
var combinedOptions = tslib.__assign(tslib.__assign({}, (fetchMoreOptions.query ? fetchMoreOptions : tslib.__assign(tslib.__assign(tslib.__assign(tslib.__assign({}, this.options), { query: this.options.query }), fetchMoreOptions), { variables: tslib.__assign(tslib.__assign({}, this.options.variables), fetchMoreOptions.variables) }))), { fetchPolicy: "no-cache" });
|
|
4704
|
+
combinedOptions.query = this.transformDocument(combinedOptions.query);
|
|
4488
4705
|
var qid = this.queryManager.generateQueryId();
|
|
4706
|
+
this.lastQuery = fetchMoreOptions.query
|
|
4707
|
+
? this.transformDocument(this.options.query)
|
|
4708
|
+
: combinedOptions.query;
|
|
4489
4709
|
var queryInfo = this.queryInfo;
|
|
4490
4710
|
var originalNetworkStatus = queryInfo.networkStatus;
|
|
4491
4711
|
queryInfo.networkStatus = exports.NetworkStatus.fetchMore;
|
|
@@ -4557,7 +4777,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4557
4777
|
options.onError(err);
|
|
4558
4778
|
return;
|
|
4559
4779
|
}
|
|
4560
|
-
__DEV__ &&
|
|
4780
|
+
__DEV__ && invariant.error(21, err);
|
|
4561
4781
|
},
|
|
4562
4782
|
});
|
|
4563
4783
|
this.subscriptions.add(subscription);
|
|
@@ -4571,7 +4791,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4571
4791
|
return this.reobserve(newOptions);
|
|
4572
4792
|
};
|
|
4573
4793
|
ObservableQuery.prototype.setVariables = function (variables) {
|
|
4574
|
-
if (
|
|
4794
|
+
if (equal.equal(this.variables, variables)) {
|
|
4575
4795
|
return this.observers.size
|
|
4576
4796
|
? this.result()
|
|
4577
4797
|
: Promise.resolve();
|
|
@@ -4636,7 +4856,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4636
4856
|
};
|
|
4637
4857
|
ObservableQuery.prototype.fetch = function (options, newNetworkStatus) {
|
|
4638
4858
|
this.queryManager.setObservableQuery(this);
|
|
4639
|
-
return this.queryManager
|
|
4859
|
+
return this.queryManager['fetchConcastWithInfo'](this.queryId, options, newNetworkStatus);
|
|
4640
4860
|
};
|
|
4641
4861
|
ObservableQuery.prototype.updatePolling = function () {
|
|
4642
4862
|
var _this = this;
|
|
@@ -4655,7 +4875,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4655
4875
|
pollingInfo.interval === pollInterval) {
|
|
4656
4876
|
return;
|
|
4657
4877
|
}
|
|
4658
|
-
|
|
4878
|
+
invariant(pollInterval, 22);
|
|
4659
4879
|
var info = pollingInfo || (this.pollingInfo = {});
|
|
4660
4880
|
info.interval = pollInterval;
|
|
4661
4881
|
var maybeFetch = function () {
|
|
@@ -4681,13 +4901,13 @@ var ObservableQuery = (function (_super) {
|
|
|
4681
4901
|
};
|
|
4682
4902
|
ObservableQuery.prototype.updateLastResult = function (newResult, variables) {
|
|
4683
4903
|
if (variables === void 0) { variables = this.variables; }
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
if (!isNonEmptyArray(newResult.errors)) {
|
|
4688
|
-
delete this.last.error;
|
|
4904
|
+
var error = this.getLastError();
|
|
4905
|
+
if (error && this.last && !equal.equal(variables, this.last.variables)) {
|
|
4906
|
+
error = void 0;
|
|
4689
4907
|
}
|
|
4690
|
-
return this.last
|
|
4908
|
+
return this.last = tslib.__assign({ result: this.queryManager.assumeImmutableResults
|
|
4909
|
+
? newResult
|
|
4910
|
+
: cloneDeep(newResult), variables: variables }, (error ? { error: error } : null));
|
|
4691
4911
|
};
|
|
4692
4912
|
ObservableQuery.prototype.reobserveAsConcast = function (newOptions, newNetworkStatus) {
|
|
4693
4913
|
var _this = this;
|
|
@@ -4701,11 +4921,13 @@ var ObservableQuery = (function (_super) {
|
|
|
4701
4921
|
var options = useDisposableConcast
|
|
4702
4922
|
? mergedOptions
|
|
4703
4923
|
: assign(this.options, mergedOptions);
|
|
4924
|
+
var query = this.transformDocument(options.query);
|
|
4925
|
+
this.lastQuery = query;
|
|
4704
4926
|
if (!useDisposableConcast) {
|
|
4705
4927
|
this.updatePolling();
|
|
4706
4928
|
if (newOptions &&
|
|
4707
4929
|
newOptions.variables &&
|
|
4708
|
-
!
|
|
4930
|
+
!equal.equal(newOptions.variables, oldVariables) &&
|
|
4709
4931
|
options.fetchPolicy !== "standby" &&
|
|
4710
4932
|
options.fetchPolicy === oldFetchPolicy) {
|
|
4711
4933
|
this.applyNextFetchPolicy("variables-changed", options);
|
|
@@ -4714,8 +4936,9 @@ var ObservableQuery = (function (_super) {
|
|
|
4714
4936
|
}
|
|
4715
4937
|
}
|
|
4716
4938
|
}
|
|
4939
|
+
var fetchOptions = query === options.query ? options : tslib.__assign(tslib.__assign({}, options), { query: query });
|
|
4717
4940
|
var variables = options.variables && tslib.__assign({}, options.variables);
|
|
4718
|
-
var
|
|
4941
|
+
var _a = this.fetch(fetchOptions, newNetworkStatus), concast = _a.concast, fromLink = _a.fromLink;
|
|
4719
4942
|
var observer = {
|
|
4720
4943
|
next: function (result) {
|
|
4721
4944
|
_this.reportResult(result, variables);
|
|
@@ -4724,7 +4947,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4724
4947
|
_this.reportError(error, variables);
|
|
4725
4948
|
},
|
|
4726
4949
|
};
|
|
4727
|
-
if (!useDisposableConcast) {
|
|
4950
|
+
if (!useDisposableConcast && (fromLink || !this.concast)) {
|
|
4728
4951
|
if (this.concast && this.observer) {
|
|
4729
4952
|
this.concast.removeObserver(this.observer);
|
|
4730
4953
|
}
|
|
@@ -4742,11 +4965,12 @@ var ObservableQuery = (function (_super) {
|
|
|
4742
4965
|
};
|
|
4743
4966
|
ObservableQuery.prototype.reportResult = function (result, variables) {
|
|
4744
4967
|
var lastError = this.getLastError();
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4968
|
+
var isDifferent = this.isDifferentFromLastResult(result, variables);
|
|
4969
|
+
if (lastError || !result.partial || this.options.returnPartialData) {
|
|
4970
|
+
this.updateLastResult(result, variables);
|
|
4971
|
+
}
|
|
4972
|
+
if (lastError || isDifferent) {
|
|
4973
|
+
iterateObserversSafely(this.observers, "next", result);
|
|
4750
4974
|
}
|
|
4751
4975
|
};
|
|
4752
4976
|
ObservableQuery.prototype.reportError = function (error, variables) {
|
|
@@ -4772,6 +4996,9 @@ var ObservableQuery = (function (_super) {
|
|
|
4772
4996
|
this.observers.clear();
|
|
4773
4997
|
this.isTornDown = true;
|
|
4774
4998
|
};
|
|
4999
|
+
ObservableQuery.prototype.transformDocument = function (document) {
|
|
5000
|
+
return this.queryManager.transform(document);
|
|
5001
|
+
};
|
|
4775
5002
|
return ObservableQuery;
|
|
4776
5003
|
}(zenObservableTs.Observable));
|
|
4777
5004
|
fixObservableSubclass(ObservableQuery);
|
|
@@ -4793,14 +5020,78 @@ function reobserveCacheFirst(obsQuery) {
|
|
|
4793
5020
|
return obsQuery.reobserve();
|
|
4794
5021
|
}
|
|
4795
5022
|
function defaultSubscriptionObserverErrorCallback(error) {
|
|
4796
|
-
__DEV__ &&
|
|
5023
|
+
__DEV__ && invariant.error(23, error.message, error.stack);
|
|
4797
5024
|
}
|
|
4798
5025
|
function logMissingFieldErrors(missing) {
|
|
4799
5026
|
if (__DEV__ && missing) {
|
|
4800
|
-
__DEV__ &&
|
|
5027
|
+
__DEV__ && invariant.debug(24, missing);
|
|
4801
5028
|
}
|
|
4802
5029
|
}
|
|
4803
5030
|
|
|
5031
|
+
function identity(document) {
|
|
5032
|
+
return document;
|
|
5033
|
+
}
|
|
5034
|
+
var DocumentTransform = (function () {
|
|
5035
|
+
function DocumentTransform(transform, options) {
|
|
5036
|
+
if (options === void 0) { options = Object.create(null); }
|
|
5037
|
+
this.resultCache = canUseWeakSet
|
|
5038
|
+
? new WeakSet()
|
|
5039
|
+
: new Set();
|
|
5040
|
+
this.transform = transform;
|
|
5041
|
+
if (options.getCacheKey) {
|
|
5042
|
+
this.getCacheKey = options.getCacheKey;
|
|
5043
|
+
}
|
|
5044
|
+
if (options.cache !== false) {
|
|
5045
|
+
this.stableCacheKeys = new trie.Trie(canUseWeakMap, function (key) { return ({ key: key }); });
|
|
5046
|
+
}
|
|
5047
|
+
}
|
|
5048
|
+
DocumentTransform.prototype.getCacheKey = function (document) {
|
|
5049
|
+
return [document];
|
|
5050
|
+
};
|
|
5051
|
+
DocumentTransform.identity = function () {
|
|
5052
|
+
return new DocumentTransform(identity, { cache: false });
|
|
5053
|
+
};
|
|
5054
|
+
DocumentTransform.split = function (predicate, left, right) {
|
|
5055
|
+
if (right === void 0) { right = DocumentTransform.identity(); }
|
|
5056
|
+
return new DocumentTransform(function (document) {
|
|
5057
|
+
var documentTransform = predicate(document) ? left : right;
|
|
5058
|
+
return documentTransform.transformDocument(document);
|
|
5059
|
+
}, { cache: false });
|
|
5060
|
+
};
|
|
5061
|
+
DocumentTransform.prototype.transformDocument = function (document) {
|
|
5062
|
+
if (this.resultCache.has(document)) {
|
|
5063
|
+
return document;
|
|
5064
|
+
}
|
|
5065
|
+
var cacheEntry = this.getStableCacheEntry(document);
|
|
5066
|
+
if (cacheEntry && cacheEntry.value) {
|
|
5067
|
+
return cacheEntry.value;
|
|
5068
|
+
}
|
|
5069
|
+
checkDocument(document);
|
|
5070
|
+
var transformedDocument = this.transform(document);
|
|
5071
|
+
this.resultCache.add(transformedDocument);
|
|
5072
|
+
if (cacheEntry) {
|
|
5073
|
+
cacheEntry.value = transformedDocument;
|
|
5074
|
+
}
|
|
5075
|
+
return transformedDocument;
|
|
5076
|
+
};
|
|
5077
|
+
DocumentTransform.prototype.concat = function (otherTransform) {
|
|
5078
|
+
var _this = this;
|
|
5079
|
+
return new DocumentTransform(function (document) {
|
|
5080
|
+
return otherTransform.transformDocument(_this.transformDocument(document));
|
|
5081
|
+
}, { cache: false });
|
|
5082
|
+
};
|
|
5083
|
+
DocumentTransform.prototype.getStableCacheEntry = function (document) {
|
|
5084
|
+
if (!this.stableCacheKeys)
|
|
5085
|
+
return;
|
|
5086
|
+
var cacheKeys = this.getCacheKey(document);
|
|
5087
|
+
if (cacheKeys) {
|
|
5088
|
+
invariant(Array.isArray(cacheKeys), 17);
|
|
5089
|
+
return this.stableCacheKeys.lookupArray(cacheKeys);
|
|
5090
|
+
}
|
|
5091
|
+
};
|
|
5092
|
+
return DocumentTransform;
|
|
5093
|
+
}());
|
|
5094
|
+
|
|
4804
5095
|
var LocalState = (function () {
|
|
4805
5096
|
function LocalState(_a) {
|
|
4806
5097
|
var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher;
|
|
@@ -4860,12 +5151,8 @@ var LocalState = (function () {
|
|
|
4860
5151
|
}
|
|
4861
5152
|
return null;
|
|
4862
5153
|
};
|
|
4863
|
-
LocalState.prototype.serverQuery = function (document
|
|
4864
|
-
|
|
4865
|
-
var _a = options.removeClientFields, removeClientFields = _a === void 0 ? true : _a;
|
|
4866
|
-
return removeClientFields
|
|
4867
|
-
? removeClientSetsFromDocument(document)
|
|
4868
|
-
: document;
|
|
5154
|
+
LocalState.prototype.serverQuery = function (document) {
|
|
5155
|
+
return removeClientSetsFromDocument(document);
|
|
4869
5156
|
};
|
|
4870
5157
|
LocalState.prototype.prepareContext = function (context) {
|
|
4871
5158
|
var cache = this.cache;
|
|
@@ -4980,7 +5267,7 @@ var LocalState = (function () {
|
|
|
4980
5267
|
}
|
|
4981
5268
|
else {
|
|
4982
5269
|
fragment = fragmentMap[selection.name.value];
|
|
4983
|
-
|
|
5270
|
+
invariant(fragment, 18, selection.name.value);
|
|
4984
5271
|
}
|
|
4985
5272
|
if (fragment && fragment.typeCondition) {
|
|
4986
5273
|
typeCondition = fragment.typeCondition.name.value;
|
|
@@ -5093,7 +5380,7 @@ var LocalState = (function () {
|
|
|
5093
5380
|
},
|
|
5094
5381
|
FragmentSpread: function (spread, _, __, ___, ancestors) {
|
|
5095
5382
|
var fragment = fragmentMap[spread.name.value];
|
|
5096
|
-
|
|
5383
|
+
invariant(fragment, 19, spread.name.value);
|
|
5097
5384
|
var fragmentSelections = collectByDefinition(fragment);
|
|
5098
5385
|
if (fragmentSelections.size > 0) {
|
|
5099
5386
|
ancestors.forEach(function (node) {
|
|
@@ -5155,10 +5442,10 @@ var QueryInfo = (function () {
|
|
|
5155
5442
|
var networkStatus = query.networkStatus || exports.NetworkStatus.loading;
|
|
5156
5443
|
if (this.variables &&
|
|
5157
5444
|
this.networkStatus !== exports.NetworkStatus.loading &&
|
|
5158
|
-
!
|
|
5445
|
+
!equal.equal(this.variables, query.variables)) {
|
|
5159
5446
|
networkStatus = exports.NetworkStatus.setVariables;
|
|
5160
5447
|
}
|
|
5161
|
-
if (!
|
|
5448
|
+
if (!equal.equal(query.variables, this.variables)) {
|
|
5162
5449
|
this.lastDiff = void 0;
|
|
5163
5450
|
}
|
|
5164
5451
|
Object.assign(this, {
|
|
@@ -5183,7 +5470,7 @@ var QueryInfo = (function () {
|
|
|
5183
5470
|
QueryInfo.prototype.getDiff = function (variables) {
|
|
5184
5471
|
if (variables === void 0) { variables = this.variables; }
|
|
5185
5472
|
var options = this.getDiffOptions(variables);
|
|
5186
|
-
if (this.lastDiff &&
|
|
5473
|
+
if (this.lastDiff && equal.equal(options, this.lastDiff.options)) {
|
|
5187
5474
|
return this.lastDiff.diff;
|
|
5188
5475
|
}
|
|
5189
5476
|
this.updateWatch(this.variables = variables);
|
|
@@ -5217,7 +5504,7 @@ var QueryInfo = (function () {
|
|
|
5217
5504
|
var oldDiff = this.lastDiff && this.lastDiff.diff;
|
|
5218
5505
|
this.updateLastDiff(diff);
|
|
5219
5506
|
if (!this.dirty &&
|
|
5220
|
-
!
|
|
5507
|
+
!equal.equal(oldDiff && oldDiff.result, diff && diff.result)) {
|
|
5221
5508
|
this.dirty = true;
|
|
5222
5509
|
if (!this.notifyTimeout) {
|
|
5223
5510
|
this.notifyTimeout = setTimeout(function () { return _this.notify(); }, 0);
|
|
@@ -5292,7 +5579,7 @@ var QueryInfo = (function () {
|
|
|
5292
5579
|
}
|
|
5293
5580
|
var watchOptions = tslib.__assign(tslib.__assign({}, this.getDiffOptions(variables)), { watcher: this, callback: function (diff) { return _this.setDiff(diff); } });
|
|
5294
5581
|
if (!this.lastWatch ||
|
|
5295
|
-
!
|
|
5582
|
+
!equal.equal(watchOptions, this.lastWatch)) {
|
|
5296
5583
|
this.cancel();
|
|
5297
5584
|
this.cancel = this.cache.watch(this.lastWatch = watchOptions);
|
|
5298
5585
|
}
|
|
@@ -5304,8 +5591,8 @@ var QueryInfo = (function () {
|
|
|
5304
5591
|
var lastWrite = this.lastWrite;
|
|
5305
5592
|
return !(lastWrite &&
|
|
5306
5593
|
lastWrite.dmCount === destructiveMethodCounts.get(this.cache) &&
|
|
5307
|
-
|
|
5308
|
-
|
|
5594
|
+
equal.equal(variables, lastWrite.variables) &&
|
|
5595
|
+
equal.equal(result.data, lastWrite.result.data));
|
|
5309
5596
|
};
|
|
5310
5597
|
QueryInfo.prototype.markResult = function (result, document, options, cacheWriteBehavior) {
|
|
5311
5598
|
var _this = this;
|
|
@@ -5397,7 +5684,8 @@ function shouldWriteResult(result, errorPolicy) {
|
|
|
5397
5684
|
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
5398
5685
|
var QueryManager = (function () {
|
|
5399
5686
|
function QueryManager(_a) {
|
|
5400
|
-
var cache = _a.cache, link = _a.link, defaultOptions = _a.defaultOptions, _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,
|
|
5687
|
+
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;
|
|
5688
|
+
var _this = this;
|
|
5401
5689
|
this.clientAwareness = {};
|
|
5402
5690
|
this.queries = new Map();
|
|
5403
5691
|
this.fetchCancelFns = new Map();
|
|
@@ -5406,6 +5694,7 @@ var QueryManager = (function () {
|
|
|
5406
5694
|
this.requestIdCounter = 1;
|
|
5407
5695
|
this.mutationIdCounter = 1;
|
|
5408
5696
|
this.inFlightLinkObservables = new Map();
|
|
5697
|
+
var defaultDocumentTransform = new DocumentTransform(function (document) { return _this.cache.transformDocument(document); }, { cache: false });
|
|
5409
5698
|
this.cache = cache;
|
|
5410
5699
|
this.link = link;
|
|
5411
5700
|
this.defaultOptions = defaultOptions || Object.create(null);
|
|
@@ -5413,7 +5702,12 @@ var QueryManager = (function () {
|
|
|
5413
5702
|
this.clientAwareness = clientAwareness;
|
|
5414
5703
|
this.localState = localState || new LocalState({ cache: cache });
|
|
5415
5704
|
this.ssrMode = ssrMode;
|
|
5416
|
-
this.assumeImmutableResults =
|
|
5705
|
+
this.assumeImmutableResults = assumeImmutableResults;
|
|
5706
|
+
this.documentTransform = documentTransform
|
|
5707
|
+
? defaultDocumentTransform
|
|
5708
|
+
.concat(documentTransform)
|
|
5709
|
+
.concat(defaultDocumentTransform)
|
|
5710
|
+
: defaultDocumentTransform;
|
|
5417
5711
|
if ((this.onBroadcast = onBroadcast)) {
|
|
5418
5712
|
this.mutationStore = Object.create(null);
|
|
5419
5713
|
}
|
|
@@ -5423,7 +5717,7 @@ var QueryManager = (function () {
|
|
|
5423
5717
|
this.queries.forEach(function (_info, queryId) {
|
|
5424
5718
|
_this.stopQueryNoBroadcast(queryId);
|
|
5425
5719
|
});
|
|
5426
|
-
this.cancelPendingFetches(
|
|
5720
|
+
this.cancelPendingFetches(newInvariantError(25));
|
|
5427
5721
|
};
|
|
5428
5722
|
QueryManager.prototype.cancelPendingFetches = function (error) {
|
|
5429
5723
|
this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
|
|
@@ -5433,23 +5727,22 @@ var QueryManager = (function () {
|
|
|
5433
5727
|
var _b, _c;
|
|
5434
5728
|
var mutation = _a.mutation, variables = _a.variables, optimisticResponse = _a.optimisticResponse, updateQueries = _a.updateQueries, _d = _a.refetchQueries, refetchQueries = _d === void 0 ? [] : _d, _e = _a.awaitRefetchQueries, awaitRefetchQueries = _e === void 0 ? false : _e, updateWithProxyFn = _a.update, onQueryUpdated = _a.onQueryUpdated, _f = _a.fetchPolicy, fetchPolicy = _f === void 0 ? ((_b = this.defaultOptions.mutate) === null || _b === void 0 ? void 0 : _b.fetchPolicy) || "network-only" : _f, _g = _a.errorPolicy, errorPolicy = _g === void 0 ? ((_c = this.defaultOptions.mutate) === null || _c === void 0 ? void 0 : _c.errorPolicy) || "none" : _g, keepRootFields = _a.keepRootFields, context = _a.context;
|
|
5435
5729
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
5436
|
-
var mutationId,
|
|
5437
|
-
return tslib.__generator(this, function (
|
|
5438
|
-
switch (
|
|
5730
|
+
var mutationId, hasClientExports, mutationStoreValue, self;
|
|
5731
|
+
return tslib.__generator(this, function (_h) {
|
|
5732
|
+
switch (_h.label) {
|
|
5439
5733
|
case 0:
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
fetchPolicy === 'no-cache',
|
|
5443
|
-
fetchPolicy === 'no-cache', 16);
|
|
5734
|
+
invariant(mutation, 26);
|
|
5735
|
+
invariant(fetchPolicy === 'network-only' ||
|
|
5736
|
+
fetchPolicy === 'no-cache', 27);
|
|
5444
5737
|
mutationId = this.generateMutationId();
|
|
5445
|
-
|
|
5446
|
-
|
|
5738
|
+
mutation = this.cache.transformForLink(this.transform(mutation));
|
|
5739
|
+
hasClientExports = this.getDocumentInfo(mutation).hasClientExports;
|
|
5447
5740
|
variables = this.getVariables(mutation, variables);
|
|
5448
5741
|
if (!hasClientExports) return [3, 2];
|
|
5449
5742
|
return [4, this.localState.addExportedVariables(mutation, variables, context)];
|
|
5450
5743
|
case 1:
|
|
5451
|
-
variables = (
|
|
5452
|
-
|
|
5744
|
+
variables = (_h.sent());
|
|
5745
|
+
_h.label = 2;
|
|
5453
5746
|
case 2:
|
|
5454
5747
|
mutationStoreValue = this.mutationStore &&
|
|
5455
5748
|
(this.mutationStore[mutationId] = {
|
|
@@ -5552,7 +5845,7 @@ var QueryManager = (function () {
|
|
|
5552
5845
|
if (isExecutionPatchIncrementalResult(result) && isNonEmptyArray(result.incremental)) {
|
|
5553
5846
|
var diff = cache.diff({
|
|
5554
5847
|
id: "ROOT_MUTATION",
|
|
5555
|
-
query: this.
|
|
5848
|
+
query: this.getDocumentInfo(mutation.document).asQuery,
|
|
5556
5849
|
variables: mutation.variables,
|
|
5557
5850
|
optimistic: false,
|
|
5558
5851
|
returnPartialData: true,
|
|
@@ -5623,7 +5916,7 @@ var QueryManager = (function () {
|
|
|
5623
5916
|
if (!skipCache) {
|
|
5624
5917
|
var diff = cache.diff({
|
|
5625
5918
|
id: "ROOT_MUTATION",
|
|
5626
|
-
query: _this.
|
|
5919
|
+
query: _this.getDocumentInfo(mutation.document).asQuery,
|
|
5627
5920
|
variables: mutation.variables,
|
|
5628
5921
|
optimistic: false,
|
|
5629
5922
|
returnPartialData: true,
|
|
@@ -5676,12 +5969,12 @@ var QueryManager = (function () {
|
|
|
5676
5969
|
_this.markMutationResult(tslib.__assign(tslib.__assign({}, mutation), { result: { data: data } }), cache);
|
|
5677
5970
|
}
|
|
5678
5971
|
catch (error) {
|
|
5679
|
-
__DEV__ &&
|
|
5972
|
+
__DEV__ && invariant.error(error);
|
|
5680
5973
|
}
|
|
5681
5974
|
}, mutation.mutationId);
|
|
5682
5975
|
};
|
|
5683
5976
|
QueryManager.prototype.fetchQuery = function (queryId, options, networkStatus) {
|
|
5684
|
-
return this.
|
|
5977
|
+
return this.fetchConcastWithInfo(queryId, options, networkStatus).concast.promise;
|
|
5685
5978
|
};
|
|
5686
5979
|
QueryManager.prototype.getQueryStore = function () {
|
|
5687
5980
|
var store = Object.create(null);
|
|
@@ -5703,22 +5996,23 @@ var QueryManager = (function () {
|
|
|
5703
5996
|
}
|
|
5704
5997
|
};
|
|
5705
5998
|
QueryManager.prototype.transform = function (document) {
|
|
5999
|
+
return this.documentTransform.transformDocument(document);
|
|
6000
|
+
};
|
|
6001
|
+
QueryManager.prototype.getDocumentInfo = function (document) {
|
|
5706
6002
|
var transformCache = this.transformCache;
|
|
5707
|
-
var _a = (this.defaultOptions.transformQuery || Object.create(null)).removeClientFields, removeClientFields = _a === void 0 ? true : _a;
|
|
5708
6003
|
if (!transformCache.has(document)) {
|
|
5709
|
-
var
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
this.localState.
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
asQuery: tslib.__assign(tslib.__assign({}, transformed), { definitions: transformed.definitions.map(function (def) {
|
|
6004
|
+
var cacheEntry = {
|
|
6005
|
+
hasClientExports: hasClientExports(document),
|
|
6006
|
+
hasForcedResolvers: this.localState.shouldForceResolvers(document),
|
|
6007
|
+
hasNonreactiveDirective: hasDirectives(['nonreactive'], document),
|
|
6008
|
+
clientQuery: this.localState.clientQuery(document),
|
|
6009
|
+
serverQuery: removeDirectivesFromDocument([
|
|
6010
|
+
{ name: 'client', remove: true },
|
|
6011
|
+
{ name: 'connection' },
|
|
6012
|
+
{ name: 'nonreactive' },
|
|
6013
|
+
], document),
|
|
6014
|
+
defaultVars: getDefaultValues(getOperationDefinition(document)),
|
|
6015
|
+
asQuery: tslib.__assign(tslib.__assign({}, document), { definitions: document.definitions.map(function (def) {
|
|
5722
6016
|
if (def.kind === "OperationDefinition" &&
|
|
5723
6017
|
def.operation !== "query") {
|
|
5724
6018
|
return tslib.__assign(tslib.__assign({}, def), { operation: "query" });
|
|
@@ -5726,23 +6020,16 @@ var QueryManager = (function () {
|
|
|
5726
6020
|
return def;
|
|
5727
6021
|
}) })
|
|
5728
6022
|
};
|
|
5729
|
-
|
|
5730
|
-
if (doc && !transformCache.has(doc)) {
|
|
5731
|
-
transformCache.set(doc, cacheEntry_1);
|
|
5732
|
-
}
|
|
5733
|
-
};
|
|
5734
|
-
add(document);
|
|
5735
|
-
add(transformed);
|
|
5736
|
-
add(clientQuery);
|
|
5737
|
-
add(serverQuery);
|
|
6023
|
+
transformCache.set(document, cacheEntry);
|
|
5738
6024
|
}
|
|
5739
6025
|
return transformCache.get(document);
|
|
5740
6026
|
};
|
|
5741
6027
|
QueryManager.prototype.getVariables = function (document, variables) {
|
|
5742
|
-
return tslib.__assign(tslib.__assign({}, this.
|
|
6028
|
+
return tslib.__assign(tslib.__assign({}, this.getDocumentInfo(document).defaultVars), variables);
|
|
5743
6029
|
};
|
|
5744
6030
|
QueryManager.prototype.watchQuery = function (options) {
|
|
5745
|
-
|
|
6031
|
+
var query = this.transform(options.query);
|
|
6032
|
+
options = tslib.__assign(tslib.__assign({}, options), { variables: this.getVariables(query, options.variables) });
|
|
5746
6033
|
if (typeof options.notifyOnNetworkStatusChange === 'undefined') {
|
|
5747
6034
|
options.notifyOnNetworkStatusChange = false;
|
|
5748
6035
|
}
|
|
@@ -5752,9 +6039,10 @@ var QueryManager = (function () {
|
|
|
5752
6039
|
queryInfo: queryInfo,
|
|
5753
6040
|
options: options,
|
|
5754
6041
|
});
|
|
6042
|
+
observable['lastQuery'] = query;
|
|
5755
6043
|
this.queries.set(observable.queryId, queryInfo);
|
|
5756
6044
|
queryInfo.init({
|
|
5757
|
-
document:
|
|
6045
|
+
document: query,
|
|
5758
6046
|
observableQuery: observable,
|
|
5759
6047
|
variables: observable.variables,
|
|
5760
6048
|
});
|
|
@@ -5763,12 +6051,11 @@ var QueryManager = (function () {
|
|
|
5763
6051
|
QueryManager.prototype.query = function (options, queryId) {
|
|
5764
6052
|
var _this = this;
|
|
5765
6053
|
if (queryId === void 0) { queryId = this.generateQueryId(); }
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
return this.fetchQuery(queryId, options).finally(function () { return _this.stopQuery(queryId); });
|
|
6054
|
+
invariant(options.query, 28);
|
|
6055
|
+
invariant(options.query.kind === 'Document', 29);
|
|
6056
|
+
invariant(!options.returnPartialData, 30);
|
|
6057
|
+
invariant(!options.pollInterval, 31);
|
|
6058
|
+
return this.fetchQuery(queryId, tslib.__assign(tslib.__assign({}, options), { query: this.transform(options.query) })).finally(function () { return _this.stopQuery(queryId); });
|
|
5772
6059
|
};
|
|
5773
6060
|
QueryManager.prototype.generateQueryId = function () {
|
|
5774
6061
|
return String(this.queryIdCounter++);
|
|
@@ -5792,7 +6079,7 @@ var QueryManager = (function () {
|
|
|
5792
6079
|
if (options === void 0) { options = {
|
|
5793
6080
|
discardWatches: true,
|
|
5794
6081
|
}; }
|
|
5795
|
-
this.cancelPendingFetches(
|
|
6082
|
+
this.cancelPendingFetches(newInvariantError(32));
|
|
5796
6083
|
this.queries.forEach(function (queryInfo) {
|
|
5797
6084
|
if (queryInfo.observableQuery) {
|
|
5798
6085
|
queryInfo.networkStatus = exports.NetworkStatus.loading;
|
|
@@ -5818,7 +6105,7 @@ var QueryManager = (function () {
|
|
|
5818
6105
|
queryNamesAndDocs.set(desc, false);
|
|
5819
6106
|
}
|
|
5820
6107
|
else if (isDocumentNode(desc)) {
|
|
5821
|
-
queryNamesAndDocs.set(_this.transform(desc)
|
|
6108
|
+
queryNamesAndDocs.set(_this.transform(desc), false);
|
|
5822
6109
|
}
|
|
5823
6110
|
else if (isNonNullObject(desc) && desc.query) {
|
|
5824
6111
|
legacyQueryOptions.add(desc);
|
|
@@ -5860,7 +6147,7 @@ var QueryManager = (function () {
|
|
|
5860
6147
|
queryInfo: queryInfo,
|
|
5861
6148
|
options: tslib.__assign(tslib.__assign({}, options), { fetchPolicy: "network-only" }),
|
|
5862
6149
|
});
|
|
5863
|
-
|
|
6150
|
+
invariant(oq.queryId === queryId);
|
|
5864
6151
|
queryInfo.setObservableQuery(oq);
|
|
5865
6152
|
queries.set(queryId, oq);
|
|
5866
6153
|
});
|
|
@@ -5868,7 +6155,7 @@ var QueryManager = (function () {
|
|
|
5868
6155
|
if (__DEV__ && queryNamesAndDocs.size) {
|
|
5869
6156
|
queryNamesAndDocs.forEach(function (included, nameOrDoc) {
|
|
5870
6157
|
if (!included) {
|
|
5871
|
-
__DEV__ &&
|
|
6158
|
+
__DEV__ && invariant.warn(typeof nameOrDoc === "string" ? 33 : 34, nameOrDoc);
|
|
5872
6159
|
}
|
|
5873
6160
|
});
|
|
5874
6161
|
}
|
|
@@ -5897,7 +6184,7 @@ var QueryManager = (function () {
|
|
|
5897
6184
|
QueryManager.prototype.startGraphQLSubscription = function (_a) {
|
|
5898
6185
|
var _this = this;
|
|
5899
6186
|
var query = _a.query, fetchPolicy = _a.fetchPolicy, errorPolicy = _a.errorPolicy, variables = _a.variables, _b = _a.context, context = _b === void 0 ? {} : _b;
|
|
5900
|
-
query = this.transform(query)
|
|
6187
|
+
query = this.transform(query);
|
|
5901
6188
|
variables = this.getVariables(query, variables);
|
|
5902
6189
|
var makeObservable = function (variables) {
|
|
5903
6190
|
return _this.getObservableFromLink(query, context, variables).map(function (result) {
|
|
@@ -5912,15 +6199,22 @@ var QueryManager = (function () {
|
|
|
5912
6199
|
}
|
|
5913
6200
|
_this.broadcastQueries();
|
|
5914
6201
|
}
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
}
|
|
6202
|
+
var hasErrors = graphQLResultHasError(result);
|
|
6203
|
+
var hasProtocolErrors = graphQLResultHasProtocolErrors(result);
|
|
6204
|
+
if (hasErrors || hasProtocolErrors) {
|
|
6205
|
+
var errors = {};
|
|
6206
|
+
if (hasErrors) {
|
|
6207
|
+
errors.graphQLErrors = result.errors;
|
|
6208
|
+
}
|
|
6209
|
+
if (hasProtocolErrors) {
|
|
6210
|
+
errors.protocolErrors = result.extensions[PROTOCOL_ERRORS_SYMBOL];
|
|
6211
|
+
}
|
|
6212
|
+
throw new ApolloError(errors);
|
|
5919
6213
|
}
|
|
5920
6214
|
return result;
|
|
5921
6215
|
});
|
|
5922
6216
|
};
|
|
5923
|
-
if (this.
|
|
6217
|
+
if (this.getDocumentInfo(query).hasClientExports) {
|
|
5924
6218
|
var observablePromise_1 = this.localState.addExportedVariables(query, variables, context).then(makeObservable);
|
|
5925
6219
|
return new zenObservableTs.Observable(function (observer) {
|
|
5926
6220
|
var sub = null;
|
|
@@ -5958,9 +6252,9 @@ var QueryManager = (function () {
|
|
|
5958
6252
|
var _a;
|
|
5959
6253
|
if (deduplication === void 0) { deduplication = (_a = context === null || context === void 0 ? void 0 : context.queryDeduplication) !== null && _a !== void 0 ? _a : this.queryDeduplication; }
|
|
5960
6254
|
var observable;
|
|
5961
|
-
var
|
|
6255
|
+
var _b = this.getDocumentInfo(query), serverQuery = _b.serverQuery, clientQuery = _b.clientQuery;
|
|
5962
6256
|
if (serverQuery) {
|
|
5963
|
-
var
|
|
6257
|
+
var _c = this, inFlightLinkObservables_1 = _c.inFlightLinkObservables, link = _c.link;
|
|
5964
6258
|
var operation = {
|
|
5965
6259
|
query: serverQuery,
|
|
5966
6260
|
variables: variables,
|
|
@@ -5998,7 +6292,6 @@ var QueryManager = (function () {
|
|
|
5998
6292
|
]);
|
|
5999
6293
|
context = this.prepareContext(context);
|
|
6000
6294
|
}
|
|
6001
|
-
var clientQuery = this.transform(query).clientQuery;
|
|
6002
6295
|
if (clientQuery) {
|
|
6003
6296
|
observable = asyncMap(observable, function (result) {
|
|
6004
6297
|
return _this.localState.runResolvers({
|
|
@@ -6013,7 +6306,7 @@ var QueryManager = (function () {
|
|
|
6013
6306
|
};
|
|
6014
6307
|
QueryManager.prototype.getResultsFromLink = function (queryInfo, cacheWriteBehavior, options) {
|
|
6015
6308
|
var requestId = queryInfo.lastRequestId = this.generateRequestId();
|
|
6016
|
-
var linkDocument = this.cache.transformForLink(
|
|
6309
|
+
var linkDocument = this.cache.transformForLink(options.query);
|
|
6017
6310
|
return asyncMap(this.getObservableFromLink(linkDocument, options.context, options.variables), function (result) {
|
|
6018
6311
|
var graphQLErrors = getGraphQLErrorsFromResult(result);
|
|
6019
6312
|
var hasErrors = graphQLErrors.length > 0;
|
|
@@ -6046,10 +6339,10 @@ var QueryManager = (function () {
|
|
|
6046
6339
|
throw error;
|
|
6047
6340
|
});
|
|
6048
6341
|
};
|
|
6049
|
-
QueryManager.prototype.
|
|
6342
|
+
QueryManager.prototype.fetchConcastWithInfo = function (queryId, options, networkStatus) {
|
|
6050
6343
|
var _this = this;
|
|
6051
6344
|
if (networkStatus === void 0) { networkStatus = exports.NetworkStatus.loading; }
|
|
6052
|
-
var query =
|
|
6345
|
+
var query = options.query;
|
|
6053
6346
|
var variables = this.getVariables(query, options.variables);
|
|
6054
6347
|
var queryInfo = this.getQuery(queryId);
|
|
6055
6348
|
var defaults = this.defaultOptions.watchQuery;
|
|
@@ -6065,24 +6358,36 @@ var QueryManager = (function () {
|
|
|
6065
6358
|
});
|
|
6066
6359
|
var fromVariables = function (variables) {
|
|
6067
6360
|
normalized.variables = variables;
|
|
6068
|
-
var
|
|
6361
|
+
var sourcesWithInfo = _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus);
|
|
6069
6362
|
if (normalized.fetchPolicy !== "standby" &&
|
|
6070
|
-
|
|
6363
|
+
sourcesWithInfo.sources.length > 0 &&
|
|
6071
6364
|
queryInfo.observableQuery) {
|
|
6072
6365
|
queryInfo.observableQuery["applyNextFetchPolicy"]("after-fetch", options);
|
|
6073
6366
|
}
|
|
6074
|
-
return
|
|
6367
|
+
return sourcesWithInfo;
|
|
6075
6368
|
};
|
|
6076
6369
|
var cleanupCancelFn = function () { return _this.fetchCancelFns.delete(queryId); };
|
|
6077
6370
|
this.fetchCancelFns.set(queryId, function (reason) {
|
|
6078
6371
|
cleanupCancelFn();
|
|
6079
6372
|
setTimeout(function () { return concast.cancel(reason); });
|
|
6080
6373
|
});
|
|
6081
|
-
var concast
|
|
6082
|
-
|
|
6083
|
-
|
|
6374
|
+
var concast, containsDataFromLink;
|
|
6375
|
+
if (this.getDocumentInfo(normalized.query).hasClientExports) {
|
|
6376
|
+
concast = new Concast(this.localState
|
|
6377
|
+
.addExportedVariables(normalized.query, normalized.variables, normalized.context)
|
|
6378
|
+
.then(fromVariables).then(function (sourcesWithInfo) { return sourcesWithInfo.sources; }));
|
|
6379
|
+
containsDataFromLink = true;
|
|
6380
|
+
}
|
|
6381
|
+
else {
|
|
6382
|
+
var sourcesWithInfo = fromVariables(normalized.variables);
|
|
6383
|
+
containsDataFromLink = sourcesWithInfo.fromLink;
|
|
6384
|
+
concast = new Concast(sourcesWithInfo.sources);
|
|
6385
|
+
}
|
|
6084
6386
|
concast.promise.then(cleanupCancelFn, cleanupCancelFn);
|
|
6085
|
-
return
|
|
6387
|
+
return {
|
|
6388
|
+
concast: concast,
|
|
6389
|
+
fromLink: containsDataFromLink,
|
|
6390
|
+
};
|
|
6086
6391
|
};
|
|
6087
6392
|
QueryManager.prototype.refetchQueries = function (_a) {
|
|
6088
6393
|
var _this = this;
|
|
@@ -6157,7 +6462,7 @@ var QueryManager = (function () {
|
|
|
6157
6462
|
var query = _a.query, variables = _a.variables, fetchPolicy = _a.fetchPolicy, refetchWritePolicy = _a.refetchWritePolicy, errorPolicy = _a.errorPolicy, returnPartialData = _a.returnPartialData, context = _a.context, notifyOnNetworkStatusChange = _a.notifyOnNetworkStatusChange;
|
|
6158
6463
|
var oldNetworkStatus = queryInfo.networkStatus;
|
|
6159
6464
|
queryInfo.init({
|
|
6160
|
-
document:
|
|
6465
|
+
document: query,
|
|
6161
6466
|
variables: variables,
|
|
6162
6467
|
networkStatus: networkStatus,
|
|
6163
6468
|
});
|
|
@@ -6167,11 +6472,11 @@ var QueryManager = (function () {
|
|
|
6167
6472
|
var data = diff.result;
|
|
6168
6473
|
if (__DEV__ &&
|
|
6169
6474
|
!returnPartialData &&
|
|
6170
|
-
!
|
|
6475
|
+
!equal.equal(data, {})) {
|
|
6171
6476
|
logMissingFieldErrors(diff.missing);
|
|
6172
6477
|
}
|
|
6173
6478
|
var fromData = function (data) { return zenObservableTs.Observable.of(tslib.__assign({ data: data, loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus }, (diff.complete ? null : { partial: true }))); };
|
|
6174
|
-
if (data && _this.
|
|
6479
|
+
if (data && _this.getDocumentInfo(query).hasForcedResolvers) {
|
|
6175
6480
|
return _this.localState.runResolvers({
|
|
6176
6481
|
document: query,
|
|
6177
6482
|
remoteResult: { data: data },
|
|
@@ -6192,6 +6497,7 @@ var QueryManager = (function () {
|
|
|
6192
6497
|
refetchWritePolicy !== "merge") ? 1
|
|
6193
6498
|
: 2;
|
|
6194
6499
|
var resultsFromLink = function () { return _this.getResultsFromLink(queryInfo, cacheWriteBehavior, {
|
|
6500
|
+
query: query,
|
|
6195
6501
|
variables: variables,
|
|
6196
6502
|
context: context,
|
|
6197
6503
|
fetchPolicy: fetchPolicy,
|
|
@@ -6206,54 +6512,40 @@ var QueryManager = (function () {
|
|
|
6206
6512
|
case "cache-first": {
|
|
6207
6513
|
var diff = readCache();
|
|
6208
6514
|
if (diff.complete) {
|
|
6209
|
-
return [
|
|
6210
|
-
resultsFromCache(diff, queryInfo.markReady()),
|
|
6211
|
-
];
|
|
6515
|
+
return { fromLink: false, sources: [resultsFromCache(diff, queryInfo.markReady())] };
|
|
6212
6516
|
}
|
|
6213
6517
|
if (returnPartialData || shouldNotify) {
|
|
6214
|
-
return [
|
|
6215
|
-
resultsFromCache(diff),
|
|
6216
|
-
resultsFromLink(),
|
|
6217
|
-
];
|
|
6518
|
+
return { fromLink: true, sources: [resultsFromCache(diff), resultsFromLink()] };
|
|
6218
6519
|
}
|
|
6219
|
-
return [
|
|
6220
|
-
resultsFromLink(),
|
|
6221
|
-
];
|
|
6520
|
+
return { fromLink: true, sources: [resultsFromLink()] };
|
|
6222
6521
|
}
|
|
6223
6522
|
case "cache-and-network": {
|
|
6224
6523
|
var diff = readCache();
|
|
6225
6524
|
if (diff.complete || returnPartialData || shouldNotify) {
|
|
6226
|
-
return [
|
|
6227
|
-
resultsFromCache(diff),
|
|
6228
|
-
resultsFromLink(),
|
|
6229
|
-
];
|
|
6525
|
+
return { fromLink: true, sources: [resultsFromCache(diff), resultsFromLink()] };
|
|
6230
6526
|
}
|
|
6231
|
-
return [
|
|
6232
|
-
resultsFromLink(),
|
|
6233
|
-
];
|
|
6527
|
+
return { fromLink: true, sources: [resultsFromLink()] };
|
|
6234
6528
|
}
|
|
6235
6529
|
case "cache-only":
|
|
6236
|
-
return [
|
|
6237
|
-
resultsFromCache(readCache(), queryInfo.markReady()),
|
|
6238
|
-
];
|
|
6530
|
+
return { fromLink: false, sources: [resultsFromCache(readCache(), queryInfo.markReady())] };
|
|
6239
6531
|
case "network-only":
|
|
6240
6532
|
if (shouldNotify) {
|
|
6241
|
-
return [
|
|
6242
|
-
resultsFromCache(readCache()),
|
|
6243
|
-
resultsFromLink(),
|
|
6244
|
-
];
|
|
6533
|
+
return { fromLink: true, sources: [resultsFromCache(readCache()), resultsFromLink()] };
|
|
6245
6534
|
}
|
|
6246
|
-
return [resultsFromLink()];
|
|
6535
|
+
return { fromLink: true, sources: [resultsFromLink()] };
|
|
6247
6536
|
case "no-cache":
|
|
6248
6537
|
if (shouldNotify) {
|
|
6249
|
-
return
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6538
|
+
return {
|
|
6539
|
+
fromLink: true,
|
|
6540
|
+
sources: [
|
|
6541
|
+
resultsFromCache(queryInfo.getDiff()),
|
|
6542
|
+
resultsFromLink(),
|
|
6543
|
+
],
|
|
6544
|
+
};
|
|
6253
6545
|
}
|
|
6254
|
-
return [resultsFromLink()];
|
|
6546
|
+
return { fromLink: true, sources: [resultsFromLink()] };
|
|
6255
6547
|
case "standby":
|
|
6256
|
-
return [];
|
|
6548
|
+
return { fromLink: false, sources: [] };
|
|
6257
6549
|
}
|
|
6258
6550
|
};
|
|
6259
6551
|
QueryManager.prototype.getQuery = function (queryId) {
|
|
@@ -6276,20 +6568,18 @@ var ApolloClient = (function () {
|
|
|
6276
6568
|
var _this = this;
|
|
6277
6569
|
this.resetStoreCallbacks = [];
|
|
6278
6570
|
this.clearStoreCallbacks = [];
|
|
6279
|
-
|
|
6571
|
+
if (!options.cache) {
|
|
6572
|
+
throw newInvariantError(13);
|
|
6573
|
+
}
|
|
6574
|
+
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' &&
|
|
6280
6575
|
!window.__APOLLO_CLIENT__ &&
|
|
6281
|
-
__DEV__ : _c, _d = options.queryDeduplication, queryDeduplication = _d === void 0 ? true : _d, defaultOptions = options.defaultOptions, _e = options.assumeImmutableResults, assumeImmutableResults = _e === void 0 ?
|
|
6576
|
+
__DEV__ : _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;
|
|
6282
6577
|
var link = options.link;
|
|
6283
6578
|
if (!link) {
|
|
6284
6579
|
link = uri
|
|
6285
6580
|
? new HttpLink({ uri: uri, credentials: credentials, headers: headers })
|
|
6286
6581
|
: ApolloLink.empty();
|
|
6287
6582
|
}
|
|
6288
|
-
if (!cache) {
|
|
6289
|
-
throw __DEV__ ? new tsInvariant.InvariantError("To initialize Apollo Client, you must specify a 'cache' property " +
|
|
6290
|
-
"in the options object. \n" +
|
|
6291
|
-
"For more information, please visit: https://go.apollo.dev/c/docs") : new tsInvariant.InvariantError(9);
|
|
6292
|
-
}
|
|
6293
6583
|
this.link = link;
|
|
6294
6584
|
this.cache = cache;
|
|
6295
6585
|
this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0;
|
|
@@ -6326,8 +6616,7 @@ var ApolloClient = (function () {
|
|
|
6326
6616
|
}
|
|
6327
6617
|
}
|
|
6328
6618
|
if (url) {
|
|
6329
|
-
__DEV__ &&
|
|
6330
|
-
"experience: " + url);
|
|
6619
|
+
__DEV__ && invariant.log(14, url);
|
|
6331
6620
|
}
|
|
6332
6621
|
}
|
|
6333
6622
|
}
|
|
@@ -6342,6 +6631,7 @@ var ApolloClient = (function () {
|
|
|
6342
6631
|
cache: this.cache,
|
|
6343
6632
|
link: this.link,
|
|
6344
6633
|
defaultOptions: this.defaultOptions,
|
|
6634
|
+
documentTransform: documentTransform,
|
|
6345
6635
|
queryDeduplication: queryDeduplication,
|
|
6346
6636
|
ssrMode: ssrMode,
|
|
6347
6637
|
clientAwareness: {
|
|
@@ -6364,6 +6654,13 @@ var ApolloClient = (function () {
|
|
|
6364
6654
|
} : void 0,
|
|
6365
6655
|
});
|
|
6366
6656
|
}
|
|
6657
|
+
Object.defineProperty(ApolloClient.prototype, "documentTransform", {
|
|
6658
|
+
get: function () {
|
|
6659
|
+
return this.queryManager.documentTransform;
|
|
6660
|
+
},
|
|
6661
|
+
enumerable: false,
|
|
6662
|
+
configurable: true
|
|
6663
|
+
});
|
|
6367
6664
|
ApolloClient.prototype.stop = function () {
|
|
6368
6665
|
this.queryManager.stop();
|
|
6369
6666
|
};
|
|
@@ -6382,10 +6679,7 @@ var ApolloClient = (function () {
|
|
|
6382
6679
|
if (this.defaultOptions.query) {
|
|
6383
6680
|
options = mergeOptions(this.defaultOptions.query, options);
|
|
6384
6681
|
}
|
|
6385
|
-
|
|
6386
|
-
'client.query can only return a single result. Please use client.watchQuery ' +
|
|
6387
|
-
'to receive multiple results from the cache and the network, or consider ' +
|
|
6388
|
-
'using a different fetchPolicy, such as cache-first or network-only.') : tsInvariant.invariant(options.fetchPolicy !== 'cache-and-network', 10);
|
|
6682
|
+
invariant(options.fetchPolicy !== 'cache-and-network', 15);
|
|
6389
6683
|
if (this.disableNetworkFetches && options.fetchPolicy === 'network-only') {
|
|
6390
6684
|
options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: 'cache-first' });
|
|
6391
6685
|
}
|
|
@@ -6409,12 +6703,18 @@ var ApolloClient = (function () {
|
|
|
6409
6703
|
return this.cache.readFragment(options, optimistic);
|
|
6410
6704
|
};
|
|
6411
6705
|
ApolloClient.prototype.writeQuery = function (options) {
|
|
6412
|
-
this.cache.writeQuery(options);
|
|
6413
|
-
|
|
6706
|
+
var ref = this.cache.writeQuery(options);
|
|
6707
|
+
if (options.broadcast !== false) {
|
|
6708
|
+
this.queryManager.broadcastQueries();
|
|
6709
|
+
}
|
|
6710
|
+
return ref;
|
|
6414
6711
|
};
|
|
6415
6712
|
ApolloClient.prototype.writeFragment = function (options) {
|
|
6416
|
-
this.cache.writeFragment(options);
|
|
6417
|
-
|
|
6713
|
+
var ref = this.cache.writeFragment(options);
|
|
6714
|
+
if (options.broadcast !== false) {
|
|
6715
|
+
this.queryManager.broadcastQueries();
|
|
6716
|
+
}
|
|
6717
|
+
return ref;
|
|
6418
6718
|
};
|
|
6419
6719
|
ApolloClient.prototype.__actionHookForDevTools = function (cb) {
|
|
6420
6720
|
this.devToolsHookCb = cb;
|
|
@@ -6468,7 +6768,7 @@ var ApolloClient = (function () {
|
|
|
6468
6768
|
result.queries = queries;
|
|
6469
6769
|
result.results = results;
|
|
6470
6770
|
result.catch(function (error) {
|
|
6471
|
-
__DEV__ &&
|
|
6771
|
+
__DEV__ && invariant.debug(16, error);
|
|
6472
6772
|
});
|
|
6473
6773
|
return result;
|
|
6474
6774
|
};
|
|
@@ -6504,24 +6804,25 @@ var contextKey = canUseSymbol
|
|
|
6504
6804
|
? Symbol.for('__APOLLO_CONTEXT__')
|
|
6505
6805
|
: '__APOLLO_CONTEXT__';
|
|
6506
6806
|
function getApolloContext() {
|
|
6507
|
-
|
|
6807
|
+
invariant('createContext' in React__namespace, 45);
|
|
6808
|
+
var contextStorage = global$1[contextKey];
|
|
6809
|
+
if (!contextStorage) {
|
|
6810
|
+
contextStorage = global$1[contextKey] = new Map();
|
|
6811
|
+
}
|
|
6812
|
+
var context = contextStorage.get(React__namespace);
|
|
6508
6813
|
if (!context) {
|
|
6509
|
-
|
|
6510
|
-
value: context = React__namespace.createContext({}),
|
|
6511
|
-
enumerable: false,
|
|
6512
|
-
writable: false,
|
|
6513
|
-
configurable: true,
|
|
6514
|
-
});
|
|
6814
|
+
context = React__namespace.createContext({});
|
|
6515
6815
|
context.displayName = 'ApolloContext';
|
|
6816
|
+
contextStorage.set(React__namespace, context);
|
|
6516
6817
|
}
|
|
6517
6818
|
return context;
|
|
6518
6819
|
}
|
|
6820
|
+
var resetApolloContext = getApolloContext;
|
|
6519
6821
|
|
|
6520
6822
|
var ApolloConsumer = function (props) {
|
|
6521
6823
|
var ApolloContext = getApolloContext();
|
|
6522
6824
|
return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
|
|
6523
|
-
|
|
6524
|
-
'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client, 28);
|
|
6825
|
+
invariant(context && context.client, 44);
|
|
6525
6826
|
return props.children(context.client);
|
|
6526
6827
|
}));
|
|
6527
6828
|
};
|
|
@@ -6529,39 +6830,31 @@ var ApolloConsumer = function (props) {
|
|
|
6529
6830
|
var ApolloProvider = function (_a) {
|
|
6530
6831
|
var client = _a.client, suspenseCache = _a.suspenseCache, children = _a.children;
|
|
6531
6832
|
var ApolloContext = getApolloContext();
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
context = Object.assign({}, context, { suspenseCache: suspenseCache });
|
|
6539
|
-
}
|
|
6540
|
-
__DEV__ ? tsInvariant.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
|
|
6541
|
-
'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client, 29);
|
|
6542
|
-
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
6543
|
-
}));
|
|
6833
|
+
var parentContext = React__namespace.useContext(ApolloContext);
|
|
6834
|
+
var context = React__namespace.useMemo(function () {
|
|
6835
|
+
return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client, suspenseCache: suspenseCache || parentContext.suspenseCache });
|
|
6836
|
+
}, [parentContext, client, suspenseCache]);
|
|
6837
|
+
invariant(context.client, 46);
|
|
6838
|
+
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
6544
6839
|
};
|
|
6545
6840
|
|
|
6546
6841
|
function useApolloClient(override) {
|
|
6547
6842
|
var context = React.useContext(getApolloContext());
|
|
6548
6843
|
var client = override || context.client;
|
|
6549
|
-
|
|
6550
|
-
'Wrap the root component in an <ApolloProvider>, or pass an ApolloClient ' +
|
|
6551
|
-
'instance in via options.') : tsInvariant.invariant(!!client, 32);
|
|
6844
|
+
invariant(!!client, 49);
|
|
6552
6845
|
return client;
|
|
6553
6846
|
}
|
|
6554
6847
|
|
|
6555
6848
|
var didWarnUncachedGetSnapshot = false;
|
|
6556
6849
|
var uSESKey = "useSyncExternalStore";
|
|
6557
|
-
var realHook = React__namespace[uSESKey];
|
|
6558
|
-
var useSyncExternalStore = realHook || (function (subscribe, getSnapshot, getServerSnapshot) {
|
|
6850
|
+
var realHook$1 = React__namespace[uSESKey];
|
|
6851
|
+
var useSyncExternalStore = realHook$1 || (function (subscribe, getSnapshot, getServerSnapshot) {
|
|
6559
6852
|
var value = getSnapshot();
|
|
6560
6853
|
if (__DEV__ &&
|
|
6561
6854
|
!didWarnUncachedGetSnapshot &&
|
|
6562
6855
|
value !== getSnapshot()) {
|
|
6563
6856
|
didWarnUncachedGetSnapshot = true;
|
|
6564
|
-
__DEV__ &&
|
|
6857
|
+
__DEV__ && invariant.error(59);
|
|
6565
6858
|
}
|
|
6566
6859
|
var _a = React__namespace.useState({ inst: { value: value, getSnapshot: getSnapshot } }), inst = _a[0].inst, forceUpdate = _a[1];
|
|
6567
6860
|
if (canUseLayoutEffect) {
|
|
@@ -6624,9 +6917,7 @@ function parser(document) {
|
|
|
6624
6917
|
if (cached)
|
|
6625
6918
|
return cached;
|
|
6626
6919
|
var variables, type, name;
|
|
6627
|
-
|
|
6628
|
-
"DocumentNode. You may need to use 'graphql-tag' or another method " +
|
|
6629
|
-
"to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind, 35);
|
|
6920
|
+
invariant(!!document && !!document.kind, 60, document);
|
|
6630
6921
|
var fragments = [];
|
|
6631
6922
|
var queries = [];
|
|
6632
6923
|
var mutations = [];
|
|
@@ -6651,14 +6942,16 @@ function parser(document) {
|
|
|
6651
6942
|
}
|
|
6652
6943
|
}
|
|
6653
6944
|
}
|
|
6654
|
-
|
|
6655
|
-
(queries.length || mutations.length || subscriptions.length),
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6945
|
+
invariant(!fragments.length ||
|
|
6946
|
+
(queries.length || mutations.length || subscriptions.length), 61);
|
|
6947
|
+
invariant(
|
|
6948
|
+
queries.length + mutations.length + subscriptions.length <= 1,
|
|
6949
|
+
62,
|
|
6950
|
+
document,
|
|
6951
|
+
queries.length,
|
|
6952
|
+
subscriptions.length,
|
|
6953
|
+
mutations.length
|
|
6954
|
+
);
|
|
6662
6955
|
type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation;
|
|
6663
6956
|
if (!queries.length && !mutations.length)
|
|
6664
6957
|
type = exports.DocumentType.Subscription;
|
|
@@ -6667,9 +6960,7 @@ function parser(document) {
|
|
|
6667
6960
|
: mutations.length
|
|
6668
6961
|
? mutations
|
|
6669
6962
|
: subscriptions;
|
|
6670
|
-
|
|
6671
|
-
"".concat(definitions.length, " definitions. ") +
|
|
6672
|
-
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1, 38);
|
|
6963
|
+
invariant(definitions.length === 1, 63, document, definitions.length);
|
|
6673
6964
|
var definition = definitions[0];
|
|
6674
6965
|
variables = definition.variableDefinitions || [];
|
|
6675
6966
|
if (definition.name && definition.name.kind === 'Name') {
|
|
@@ -6686,8 +6977,13 @@ function verifyDocumentType(document, type) {
|
|
|
6686
6977
|
var operation = parser(document);
|
|
6687
6978
|
var requiredOperationName = operationName(type);
|
|
6688
6979
|
var usedOperationName = operationName(operation.type);
|
|
6689
|
-
|
|
6690
|
-
|
|
6980
|
+
invariant(
|
|
6981
|
+
operation.type === type,
|
|
6982
|
+
64,
|
|
6983
|
+
requiredOperationName,
|
|
6984
|
+
requiredOperationName,
|
|
6985
|
+
usedOperationName
|
|
6986
|
+
);
|
|
6691
6987
|
}
|
|
6692
6988
|
|
|
6693
6989
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
@@ -6713,8 +7009,6 @@ var InternalState = (function () {
|
|
|
6713
7009
|
function InternalState(client, query, previous) {
|
|
6714
7010
|
this.client = client;
|
|
6715
7011
|
this.query = query;
|
|
6716
|
-
this.asyncResolveFns = new Set();
|
|
6717
|
-
this.optionsToIgnoreOnce = new (canUseWeakSet ? WeakSet : Set)();
|
|
6718
7012
|
this.ssrDisabledResult = maybeDeepFreeze({
|
|
6719
7013
|
loading: true,
|
|
6720
7014
|
data: void 0,
|
|
@@ -6736,22 +7030,32 @@ var InternalState = (function () {
|
|
|
6736
7030
|
}
|
|
6737
7031
|
}
|
|
6738
7032
|
InternalState.prototype.forceUpdate = function () {
|
|
6739
|
-
__DEV__ &&
|
|
7033
|
+
__DEV__ && invariant.warn(51);
|
|
6740
7034
|
};
|
|
6741
|
-
InternalState.prototype.
|
|
7035
|
+
InternalState.prototype.executeQuery = function (options) {
|
|
6742
7036
|
var _this = this;
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
7037
|
+
var _a;
|
|
7038
|
+
if (options.query) {
|
|
7039
|
+
Object.assign(this, { query: options.query });
|
|
7040
|
+
}
|
|
7041
|
+
this.watchQueryOptions = this.createWatchQueryOptions(this.queryHookOptions = options);
|
|
7042
|
+
var concast = this.observable.reobserveAsConcast(this.getObsQueryOptions());
|
|
7043
|
+
this.previousData = ((_a = this.result) === null || _a === void 0 ? void 0 : _a.data) || this.previousData;
|
|
7044
|
+
this.result = void 0;
|
|
7045
|
+
this.forceUpdate();
|
|
7046
|
+
return new Promise(function (resolve) {
|
|
7047
|
+
var result;
|
|
7048
|
+
concast.subscribe({
|
|
7049
|
+
next: function (value) {
|
|
7050
|
+
result = value;
|
|
7051
|
+
},
|
|
7052
|
+
error: function () {
|
|
7053
|
+
resolve(_this.toQueryResult(_this.observable.getCurrentResult()));
|
|
7054
|
+
},
|
|
7055
|
+
complete: function () {
|
|
7056
|
+
resolve(_this.toQueryResult(result));
|
|
7057
|
+
}
|
|
7058
|
+
});
|
|
6755
7059
|
});
|
|
6756
7060
|
};
|
|
6757
7061
|
InternalState.prototype.useQuery = function (options) {
|
|
@@ -6769,7 +7073,7 @@ var InternalState = (function () {
|
|
|
6769
7073
|
if (previousResult &&
|
|
6770
7074
|
previousResult.loading === result.loading &&
|
|
6771
7075
|
previousResult.networkStatus === result.networkStatus &&
|
|
6772
|
-
|
|
7076
|
+
equal.equal(previousResult.data, result.data)) {
|
|
6773
7077
|
return;
|
|
6774
7078
|
}
|
|
6775
7079
|
_this.setResult(result);
|
|
@@ -6790,7 +7094,7 @@ var InternalState = (function () {
|
|
|
6790
7094
|
var previousResult = _this.result;
|
|
6791
7095
|
if (!previousResult ||
|
|
6792
7096
|
(previousResult && previousResult.loading) ||
|
|
6793
|
-
!
|
|
7097
|
+
!equal.equal(error, previousResult.error)) {
|
|
6794
7098
|
_this.setResult({
|
|
6795
7099
|
data: (previousResult && previousResult.data),
|
|
6796
7100
|
error: error,
|
|
@@ -6800,29 +7104,22 @@ var InternalState = (function () {
|
|
|
6800
7104
|
}
|
|
6801
7105
|
};
|
|
6802
7106
|
var subscription = obsQuery.subscribe(onNext, onError);
|
|
6803
|
-
return function () { return subscription.unsubscribe(); };
|
|
7107
|
+
return function () { return setTimeout(function () { return subscription.unsubscribe(); }); };
|
|
6804
7108
|
}, [
|
|
6805
7109
|
obsQuery,
|
|
6806
7110
|
this.renderPromises,
|
|
6807
7111
|
this.client.disableNetworkFetches,
|
|
6808
7112
|
]), function () { return _this.getCurrentResult(); }, function () { return _this.getCurrentResult(); });
|
|
6809
7113
|
this.unsafeHandlePartialRefetch(result);
|
|
6810
|
-
|
|
6811
|
-
if (!queryResult.loading && this.asyncResolveFns.size) {
|
|
6812
|
-
this.asyncResolveFns.forEach(function (resolve) { return resolve(queryResult); });
|
|
6813
|
-
this.asyncResolveFns.clear();
|
|
6814
|
-
}
|
|
6815
|
-
return queryResult;
|
|
7114
|
+
return this.toQueryResult(result);
|
|
6816
7115
|
};
|
|
6817
7116
|
InternalState.prototype.useOptions = function (options) {
|
|
6818
7117
|
var _a;
|
|
6819
7118
|
var watchQueryOptions = this.createWatchQueryOptions(this.queryHookOptions = options);
|
|
6820
7119
|
var currentWatchQueryOptions = this.watchQueryOptions;
|
|
6821
|
-
if (
|
|
6822
|
-
!equality.equal(watchQueryOptions, currentWatchQueryOptions)) {
|
|
7120
|
+
if (!equal.equal(watchQueryOptions, currentWatchQueryOptions)) {
|
|
6823
7121
|
this.watchQueryOptions = watchQueryOptions;
|
|
6824
7122
|
if (currentWatchQueryOptions && this.observable) {
|
|
6825
|
-
this.optionsToIgnoreOnce.delete(currentWatchQueryOptions);
|
|
6826
7123
|
this.observable.reobserve(this.getObsQueryOptions());
|
|
6827
7124
|
this.previousData = ((_a = this.result) === null || _a === void 0 ? void 0 : _a.data) || this.previousData;
|
|
6828
7125
|
this.result = void 0;
|
|
@@ -6938,7 +7235,7 @@ var InternalState = (function () {
|
|
|
6938
7235
|
_this.onCompleted(result.data);
|
|
6939
7236
|
}
|
|
6940
7237
|
}).catch(function (error) {
|
|
6941
|
-
__DEV__ &&
|
|
7238
|
+
__DEV__ && invariant.warn(error);
|
|
6942
7239
|
});
|
|
6943
7240
|
}
|
|
6944
7241
|
};
|
|
@@ -6989,11 +7286,15 @@ var EAGER_METHODS = [
|
|
|
6989
7286
|
'subscribeToMore',
|
|
6990
7287
|
];
|
|
6991
7288
|
function useLazyQuery(query, options) {
|
|
6992
|
-
var _a
|
|
6993
|
-
var abortControllersRef = React.useRef(new Set());
|
|
7289
|
+
var _a;
|
|
6994
7290
|
var execOptionsRef = React.useRef();
|
|
6995
|
-
var
|
|
6996
|
-
var
|
|
7291
|
+
var optionsRef = React.useRef();
|
|
7292
|
+
var queryRef = React.useRef();
|
|
7293
|
+
var merged = mergeOptions(options, execOptionsRef.current || {});
|
|
7294
|
+
var document = (_a = merged === null || merged === void 0 ? void 0 : merged.query) !== null && _a !== void 0 ? _a : query;
|
|
7295
|
+
optionsRef.current = merged;
|
|
7296
|
+
queryRef.current = document;
|
|
7297
|
+
var internalState = useInternalState(useApolloClient(options && options.client), document);
|
|
6997
7298
|
var useQueryResult = internalState.useQuery(tslib.__assign(tslib.__assign({}, merged), { skip: !execOptionsRef.current }));
|
|
6998
7299
|
var initialFetchPolicy = useQueryResult.observable.options.initialFetchPolicy ||
|
|
6999
7300
|
internalState.getDefaultFetchPolicy();
|
|
@@ -7019,28 +7320,15 @@ function useLazyQuery(query, options) {
|
|
|
7019
7320
|
return eagerMethods;
|
|
7020
7321
|
}, []);
|
|
7021
7322
|
Object.assign(result, eagerMethods);
|
|
7022
|
-
React.useEffect(function () {
|
|
7023
|
-
return function () {
|
|
7024
|
-
abortControllersRef.current.forEach(function (controller) {
|
|
7025
|
-
controller.abort();
|
|
7026
|
-
});
|
|
7027
|
-
};
|
|
7028
|
-
}, []);
|
|
7029
7323
|
var execute = React.useCallback(function (executeOptions) {
|
|
7030
|
-
var controller = new AbortController();
|
|
7031
|
-
abortControllersRef.current.add(controller);
|
|
7032
7324
|
execOptionsRef.current = executeOptions ? tslib.__assign(tslib.__assign({}, executeOptions), { fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy }) : {
|
|
7033
7325
|
fetchPolicy: initialFetchPolicy,
|
|
7034
7326
|
};
|
|
7327
|
+
var options = mergeOptions(optionsRef.current, tslib.__assign({ query: queryRef.current }, execOptionsRef.current));
|
|
7035
7328
|
var promise = internalState
|
|
7036
|
-
.
|
|
7037
|
-
.then(function (queryResult) {
|
|
7038
|
-
|
|
7039
|
-
return Object.assign(queryResult, eagerMethods);
|
|
7040
|
-
});
|
|
7041
|
-
promise.catch(function () {
|
|
7042
|
-
abortControllersRef.current.delete(controller);
|
|
7043
|
-
});
|
|
7329
|
+
.executeQuery(tslib.__assign(tslib.__assign({}, options), { skip: false }))
|
|
7330
|
+
.then(function (queryResult) { return Object.assign(queryResult, eagerMethods); });
|
|
7331
|
+
promise.catch(function () { });
|
|
7044
7332
|
return promise;
|
|
7045
7333
|
}, []);
|
|
7046
7334
|
return [execute, result];
|
|
@@ -7067,8 +7355,9 @@ function useMutation(mutation, options) {
|
|
|
7067
7355
|
}
|
|
7068
7356
|
var execute = React.useCallback(function (executeOptions) {
|
|
7069
7357
|
if (executeOptions === void 0) { executeOptions = {}; }
|
|
7070
|
-
var _a = ref.current,
|
|
7358
|
+
var _a = ref.current, options = _a.options, mutation = _a.mutation;
|
|
7071
7359
|
var baseOptions = tslib.__assign(tslib.__assign({}, options), { mutation: mutation });
|
|
7360
|
+
var client = executeOptions.client || ref.current.client;
|
|
7072
7361
|
if (!ref.current.result.loading && !baseOptions.ignoreResults && ref.current.isMounted) {
|
|
7073
7362
|
setResult(ref.current.result = {
|
|
7074
7363
|
loading: true,
|
|
@@ -7095,7 +7384,7 @@ function useMutation(mutation, options) {
|
|
|
7095
7384
|
error: error,
|
|
7096
7385
|
client: client,
|
|
7097
7386
|
};
|
|
7098
|
-
if (ref.current.isMounted && !
|
|
7387
|
+
if (ref.current.isMounted && !equal.equal(ref.current.result, result_1)) {
|
|
7099
7388
|
setResult(ref.current.result = result_1);
|
|
7100
7389
|
}
|
|
7101
7390
|
}
|
|
@@ -7113,7 +7402,7 @@ function useMutation(mutation, options) {
|
|
|
7113
7402
|
called: true,
|
|
7114
7403
|
client: client,
|
|
7115
7404
|
};
|
|
7116
|
-
if (!
|
|
7405
|
+
if (!equal.equal(ref.current.result, result_2)) {
|
|
7117
7406
|
setResult(ref.current.result = result_2);
|
|
7118
7407
|
}
|
|
7119
7408
|
}
|
|
@@ -7152,14 +7441,10 @@ function useSubscription(subscription, options) {
|
|
|
7152
7441
|
if (!hasIssuedDeprecationWarningRef.current) {
|
|
7153
7442
|
hasIssuedDeprecationWarningRef.current = true;
|
|
7154
7443
|
if (options === null || options === void 0 ? void 0 : options.onSubscriptionData) {
|
|
7155
|
-
__DEV__ &&
|
|
7156
|
-
? "'useSubscription' supports only the 'onSubscriptionData' or 'onData' option, but not both. Only the 'onData' option will be used."
|
|
7157
|
-
: "'onSubscriptionData' is deprecated and will be removed in a future major version. Please use the 'onData' option instead.");
|
|
7444
|
+
__DEV__ && invariant.warn(options.onData ? 52 : 53);
|
|
7158
7445
|
}
|
|
7159
7446
|
if (options === null || options === void 0 ? void 0 : options.onSubscriptionComplete) {
|
|
7160
|
-
__DEV__ &&
|
|
7161
|
-
? "'useSubscription' supports only the 'onSubscriptionComplete' or 'onComplete' option, but not both. Only the 'onComplete' option will be used."
|
|
7162
|
-
: "'onSubscriptionComplete' is deprecated and will be removed in a future major version. Please use the 'onComplete' option instead.");
|
|
7447
|
+
__DEV__ && invariant.warn(options.onComplete ? 54 : 55);
|
|
7163
7448
|
}
|
|
7164
7449
|
}
|
|
7165
7450
|
var _b = React.useState(function () {
|
|
@@ -7203,7 +7488,7 @@ function useSubscription(subscription, options) {
|
|
|
7203
7488
|
subscription !== ref.current.subscription ||
|
|
7204
7489
|
(options === null || options === void 0 ? void 0 : options.fetchPolicy) !== ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.fetchPolicy) ||
|
|
7205
7490
|
!(options === null || options === void 0 ? void 0 : options.skip) !== !((_c = ref.current.options) === null || _c === void 0 ? void 0 : _c.skip) ||
|
|
7206
|
-
!
|
|
7491
|
+
!equal.equal(options === null || options === void 0 ? void 0 : options.variables, (_d = ref.current.options) === null || _d === void 0 ? void 0 : _d.variables))) ||
|
|
7207
7492
|
canResetObservableRef.current) {
|
|
7208
7493
|
setResult({
|
|
7209
7494
|
loading: true,
|
|
@@ -7225,9 +7510,13 @@ function useSubscription(subscription, options) {
|
|
|
7225
7510
|
if (!observable) {
|
|
7226
7511
|
return;
|
|
7227
7512
|
}
|
|
7513
|
+
var subscriptionStopped = false;
|
|
7228
7514
|
var subscription = observable.subscribe({
|
|
7229
7515
|
next: function (fetchResult) {
|
|
7230
7516
|
var _a, _b;
|
|
7517
|
+
if (subscriptionStopped) {
|
|
7518
|
+
return;
|
|
7519
|
+
}
|
|
7231
7520
|
var result = {
|
|
7232
7521
|
loading: false,
|
|
7233
7522
|
data: fetchResult.data,
|
|
@@ -7250,26 +7539,33 @@ function useSubscription(subscription, options) {
|
|
|
7250
7539
|
},
|
|
7251
7540
|
error: function (error) {
|
|
7252
7541
|
var _a, _b;
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7542
|
+
if (!subscriptionStopped) {
|
|
7543
|
+
setResult({
|
|
7544
|
+
loading: false,
|
|
7545
|
+
data: void 0,
|
|
7546
|
+
error: error,
|
|
7547
|
+
variables: options === null || options === void 0 ? void 0 : options.variables,
|
|
7548
|
+
});
|
|
7549
|
+
(_b = (_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);
|
|
7550
|
+
}
|
|
7260
7551
|
},
|
|
7261
7552
|
complete: function () {
|
|
7262
7553
|
var _a, _b;
|
|
7263
|
-
if (
|
|
7264
|
-
ref.current.options.onComplete
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
ref.current.options.onSubscriptionComplete
|
|
7554
|
+
if (!subscriptionStopped) {
|
|
7555
|
+
if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onComplete) {
|
|
7556
|
+
ref.current.options.onComplete();
|
|
7557
|
+
}
|
|
7558
|
+
else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionComplete) {
|
|
7559
|
+
ref.current.options.onSubscriptionComplete();
|
|
7560
|
+
}
|
|
7268
7561
|
}
|
|
7269
7562
|
},
|
|
7270
7563
|
});
|
|
7271
7564
|
return function () {
|
|
7272
|
-
|
|
7565
|
+
subscriptionStopped = true;
|
|
7566
|
+
setTimeout(function () {
|
|
7567
|
+
subscription.unsubscribe();
|
|
7568
|
+
});
|
|
7273
7569
|
};
|
|
7274
7570
|
}, [observable]);
|
|
7275
7571
|
return result;
|
|
@@ -7290,22 +7586,22 @@ function useReactiveVar(rv) {
|
|
|
7290
7586
|
return value;
|
|
7291
7587
|
}
|
|
7292
7588
|
|
|
7293
|
-
function
|
|
7589
|
+
function useFragment(options) {
|
|
7294
7590
|
var cache = useApolloClient().cache;
|
|
7295
7591
|
var fragment = options.fragment, fragmentName = options.fragmentName, from = options.from, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, rest = tslib.__rest(options, ["fragment", "fragmentName", "from", "optimistic"]);
|
|
7296
|
-
var diffOptions = tslib.__assign(tslib.__assign({}, rest), { id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
|
|
7592
|
+
var diffOptions = tslib.__assign(tslib.__assign({}, rest), { returnPartialData: true, id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
|
|
7297
7593
|
var resultRef = React.useRef();
|
|
7298
7594
|
var latestDiff = cache.diff(diffOptions);
|
|
7299
7595
|
var getSnapshot = function () {
|
|
7300
7596
|
var latestDiffToResult = diffToResult(latestDiff);
|
|
7301
7597
|
return resultRef.current &&
|
|
7302
|
-
|
|
7598
|
+
equal.equal(resultRef.current.data, latestDiffToResult.data)
|
|
7303
7599
|
? resultRef.current
|
|
7304
7600
|
: (resultRef.current = latestDiffToResult);
|
|
7305
7601
|
};
|
|
7306
7602
|
return useSyncExternalStore(function (forceUpdate) {
|
|
7307
7603
|
return cache.watch(tslib.__assign(tslib.__assign({}, diffOptions), { immediate: true, callback: function (diff) {
|
|
7308
|
-
if (!
|
|
7604
|
+
if (!equal.equal(diff, latestDiff)) {
|
|
7309
7605
|
resultRef.current = diffToResult((latestDiff = diff));
|
|
7310
7606
|
forceUpdate();
|
|
7311
7607
|
}
|
|
@@ -7325,122 +7621,116 @@ function diffToResult(diff) {
|
|
|
7325
7621
|
|
|
7326
7622
|
function useDeepMemo(memoFn, deps) {
|
|
7327
7623
|
var ref = React.useRef();
|
|
7328
|
-
if (!ref.current || !
|
|
7624
|
+
if (!ref.current || !equal.equal(ref.current.deps, deps)) {
|
|
7329
7625
|
ref.current = { value: memoFn(), deps: deps };
|
|
7330
7626
|
}
|
|
7331
7627
|
return ref.current.value;
|
|
7332
7628
|
}
|
|
7333
7629
|
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7630
|
+
function useStrictModeSafeCleanupEffect(cleanup) {
|
|
7631
|
+
var timeout;
|
|
7632
|
+
React.useEffect(function () {
|
|
7633
|
+
clearTimeout(timeout);
|
|
7634
|
+
return function () {
|
|
7635
|
+
timeout = setTimeout(cleanup);
|
|
7636
|
+
};
|
|
7637
|
+
}, []);
|
|
7638
|
+
}
|
|
7639
|
+
|
|
7640
|
+
var useKey = 'use';
|
|
7641
|
+
var realHook = React__default[useKey];
|
|
7642
|
+
var __use = realHook ||
|
|
7643
|
+
function __use(promise) {
|
|
7644
|
+
var statefulPromise = wrapPromiseWithState(promise);
|
|
7645
|
+
switch (statefulPromise.status) {
|
|
7646
|
+
case 'pending':
|
|
7647
|
+
throw statefulPromise;
|
|
7648
|
+
case 'rejected':
|
|
7649
|
+
throw statefulPromise.reason;
|
|
7650
|
+
case 'fulfilled':
|
|
7651
|
+
return statefulPromise.value;
|
|
7652
|
+
}
|
|
7653
|
+
};
|
|
7337
7654
|
|
|
7338
7655
|
function useSuspenseCache(override) {
|
|
7339
7656
|
var context = React.useContext(getApolloContext());
|
|
7340
7657
|
var suspenseCache = override || context.suspenseCache;
|
|
7341
|
-
|
|
7342
|
-
'Wrap the root component in an <ApolloProvider> and provide a suspenseCache, ' +
|
|
7343
|
-
'or pass a SuspenseCache instance in via options.') : tsInvariant.invariant(suspenseCache, 33);
|
|
7658
|
+
invariant(suspenseCache, 56);
|
|
7344
7659
|
return suspenseCache;
|
|
7345
7660
|
}
|
|
7346
7661
|
|
|
7347
|
-
|
|
7348
|
-
'cache-first',
|
|
7349
|
-
'network-only',
|
|
7350
|
-
'no-cache',
|
|
7351
|
-
'cache-and-network',
|
|
7352
|
-
];
|
|
7353
|
-
var DEFAULT_FETCH_POLICY = 'cache-first';
|
|
7354
|
-
var DEFAULT_SUSPENSE_POLICY = 'always';
|
|
7355
|
-
var DEFAULT_ERROR_POLICY = 'none';
|
|
7356
|
-
function useSuspenseQuery_experimental(query, options) {
|
|
7662
|
+
function useSuspenseQuery(query, options) {
|
|
7357
7663
|
if (options === void 0) { options = Object.create(null); }
|
|
7358
|
-
var suspenseCache = useSuspenseCache(options.suspenseCache);
|
|
7359
7664
|
var client = useApolloClient(options.client);
|
|
7360
|
-
var
|
|
7361
|
-
var
|
|
7362
|
-
var
|
|
7363
|
-
var
|
|
7364
|
-
var
|
|
7365
|
-
var
|
|
7366
|
-
return
|
|
7367
|
-
})
|
|
7368
|
-
var
|
|
7369
|
-
var
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
if (result.error &&
|
|
7374
|
-
(result.error.networkError || allowsThrownErrors)) {
|
|
7375
|
-
throw result.error;
|
|
7376
|
-
}
|
|
7377
|
-
if (result.loading) {
|
|
7378
|
-
if (!cacheEntry) {
|
|
7379
|
-
cacheEntry = suspenseCache.add(query, variables, {
|
|
7380
|
-
promise: maybeWrapConcastWithCustomPromise(observable.reobserveAsConcast(watchQueryOptions), { deferred: deferred }),
|
|
7381
|
-
observable: observable,
|
|
7382
|
-
});
|
|
7383
|
-
}
|
|
7384
|
-
var hasUsableResult = usePartialResult ||
|
|
7385
|
-
(fetchPolicy === 'cache-and-network' && hasFullResult);
|
|
7386
|
-
if (!hasUsableResult && !cacheEntry.fulfilled) {
|
|
7387
|
-
throw cacheEntry.promise;
|
|
7388
|
-
}
|
|
7665
|
+
var suspenseCache = useSuspenseCache(options.suspenseCache);
|
|
7666
|
+
var watchQueryOptions = useWatchQueryOptions({ query: query, options: options });
|
|
7667
|
+
var variables = watchQueryOptions.variables;
|
|
7668
|
+
var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
|
|
7669
|
+
var cacheKey = [client, query, canonicalStringify(variables)].concat(queryKey);
|
|
7670
|
+
var queryRef = suspenseCache.getQueryRef(cacheKey, function () {
|
|
7671
|
+
return client.watchQuery(watchQueryOptions);
|
|
7672
|
+
});
|
|
7673
|
+
var _b = React.useState(function () { return new Map([[queryRef.key, queryRef.promise]]); }), promiseCache = _b[0], setPromiseCache = _b[1];
|
|
7674
|
+
var promise = promiseCache.get(queryRef.key);
|
|
7675
|
+
if (!promise) {
|
|
7676
|
+
promise = queryRef.promise;
|
|
7677
|
+
promiseCache.set(queryRef.key, promise);
|
|
7389
7678
|
}
|
|
7679
|
+
useTrackedQueryRefs(queryRef);
|
|
7390
7680
|
React.useEffect(function () {
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
suspenseCache.remove(previousOpts.query, previousOpts.variables);
|
|
7395
|
-
suspenseCache.add(query, variables, {
|
|
7396
|
-
promise: observable.reobserve({ query: query, variables: variables }),
|
|
7397
|
-
observable: observable,
|
|
7681
|
+
return queryRef.listen(function (promise) {
|
|
7682
|
+
setPromiseCache(function (promiseCache) {
|
|
7683
|
+
return new Map(promiseCache).set(queryRef.key, promise);
|
|
7398
7684
|
});
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
React.
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7685
|
+
});
|
|
7686
|
+
}, [queryRef]);
|
|
7687
|
+
var result = __use(promise);
|
|
7688
|
+
var fetchMore = React.useCallback(function (options) {
|
|
7689
|
+
var promise = queryRef.fetchMore(options);
|
|
7690
|
+
setPromiseCache(function (previousPromiseCache) {
|
|
7691
|
+
return new Map(previousPromiseCache).set(queryRef.key, promise);
|
|
7692
|
+
});
|
|
7693
|
+
return promise;
|
|
7694
|
+
}, [queryRef]);
|
|
7695
|
+
var refetch = React.useCallback(function (variables) {
|
|
7696
|
+
var promise = queryRef.refetch(variables);
|
|
7697
|
+
setPromiseCache(function (previousPromiseCache) {
|
|
7698
|
+
return new Map(previousPromiseCache).set(queryRef.key, promise);
|
|
7699
|
+
});
|
|
7700
|
+
return promise;
|
|
7701
|
+
}, [queryRef]);
|
|
7702
|
+
var subscribeToMore = React.useCallback(function (options) { return queryRef.observable.subscribeToMore(options); }, [queryRef]);
|
|
7407
7703
|
return React.useMemo(function () {
|
|
7408
7704
|
return {
|
|
7409
7705
|
client: client,
|
|
7410
7706
|
data: result.data,
|
|
7411
|
-
error:
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
observable: observable,
|
|
7417
|
-
});
|
|
7418
|
-
return promise;
|
|
7419
|
-
},
|
|
7420
|
-
refetch: function (variables) {
|
|
7421
|
-
var promise = observable.refetch(variables);
|
|
7422
|
-
suspenseCache.add(query, watchQueryOptions.variables, {
|
|
7423
|
-
promise: promise,
|
|
7424
|
-
observable: observable,
|
|
7425
|
-
});
|
|
7426
|
-
return promise;
|
|
7427
|
-
},
|
|
7428
|
-
subscribeToMore: function (options) { return observable.subscribeToMore(options); },
|
|
7707
|
+
error: toApolloError(result),
|
|
7708
|
+
networkStatus: result.networkStatus,
|
|
7709
|
+
fetchMore: fetchMore,
|
|
7710
|
+
refetch: refetch,
|
|
7711
|
+
subscribeToMore: subscribeToMore,
|
|
7429
7712
|
};
|
|
7430
|
-
}, [client,
|
|
7713
|
+
}, [client, fetchMore, refetch, result, subscribeToMore]);
|
|
7431
7714
|
}
|
|
7432
7715
|
function validateOptions(options) {
|
|
7433
|
-
var query = options.query,
|
|
7716
|
+
var query = options.query, fetchPolicy = options.fetchPolicy, returnPartialData = options.returnPartialData;
|
|
7434
7717
|
verifyDocumentType(query, exports.DocumentType.Query);
|
|
7435
7718
|
validateFetchPolicy(fetchPolicy);
|
|
7436
7719
|
validatePartialDataReturn(fetchPolicy, returnPartialData);
|
|
7437
7720
|
}
|
|
7438
7721
|
function validateFetchPolicy(fetchPolicy) {
|
|
7439
|
-
|
|
7722
|
+
if (fetchPolicy === void 0) { fetchPolicy = 'cache-first'; }
|
|
7723
|
+
var supportedFetchPolicies = [
|
|
7724
|
+
'cache-first',
|
|
7725
|
+
'network-only',
|
|
7726
|
+
'no-cache',
|
|
7727
|
+
'cache-and-network',
|
|
7728
|
+
];
|
|
7729
|
+
invariant(supportedFetchPolicies.includes(fetchPolicy), 57, fetchPolicy);
|
|
7440
7730
|
}
|
|
7441
7731
|
function validatePartialDataReturn(fetchPolicy, returnPartialData) {
|
|
7442
7732
|
if (fetchPolicy === 'no-cache' && returnPartialData) {
|
|
7443
|
-
__DEV__ &&
|
|
7733
|
+
__DEV__ && invariant.warn(58);
|
|
7444
7734
|
}
|
|
7445
7735
|
}
|
|
7446
7736
|
function toApolloError(result) {
|
|
@@ -7448,115 +7738,205 @@ function toApolloError(result) {
|
|
|
7448
7738
|
? new ApolloError({ graphQLErrors: result.errors })
|
|
7449
7739
|
: result.error;
|
|
7450
7740
|
}
|
|
7451
|
-
function
|
|
7452
|
-
var
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
resolve(value);
|
|
7458
|
-
subscription.unsubscribe();
|
|
7459
|
-
},
|
|
7460
|
-
error: reject,
|
|
7461
|
-
});
|
|
7462
|
-
});
|
|
7463
|
-
}
|
|
7464
|
-
return concast.promise;
|
|
7741
|
+
function useTrackedQueryRefs(queryRef) {
|
|
7742
|
+
var trackedQueryRefs = React.useRef(new Set());
|
|
7743
|
+
trackedQueryRefs.current.add(queryRef);
|
|
7744
|
+
useStrictModeSafeCleanupEffect(function () {
|
|
7745
|
+
trackedQueryRefs.current.forEach(function (sub) { return sub.dispose(); });
|
|
7746
|
+
});
|
|
7465
7747
|
}
|
|
7466
7748
|
function useWatchQueryOptions(_a) {
|
|
7467
|
-
var query = _a.query, options = _a.options
|
|
7468
|
-
var
|
|
7469
|
-
var watchQueryOptions = useDeepMemo(function () {
|
|
7470
|
-
var errorPolicy = options.errorPolicy, fetchPolicy = options.fetchPolicy, _a = options.suspensePolicy, suspensePolicy = _a === void 0 ? DEFAULT_SUSPENSE_POLICY : _a, variables = options.variables, watchQueryOptions = tslib.__rest(options, ["errorPolicy", "fetchPolicy", "suspensePolicy", "variables"]);
|
|
7471
|
-
return tslib.__assign(tslib.__assign({}, watchQueryOptions), { query: query, errorPolicy: errorPolicy || (defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.errorPolicy) || DEFAULT_ERROR_POLICY, fetchPolicy: fetchPolicy || (defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.fetchPolicy) || DEFAULT_FETCH_POLICY, notifyOnNetworkStatusChange: suspensePolicy === 'always', fetchOnFirstSubscribe: false, variables: compact(tslib.__assign(tslib.__assign({}, defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.variables), variables)) });
|
|
7472
|
-
}, [options, query, defaultOptions]);
|
|
7749
|
+
var query = _a.query, options = _a.options;
|
|
7750
|
+
var watchQueryOptions = useDeepMemo(function () { return (tslib.__assign(tslib.__assign({}, options), { query: query, notifyOnNetworkStatusChange: false, nextFetchPolicy: void 0 })); }, [options, query]);
|
|
7473
7751
|
if (__DEV__) {
|
|
7474
7752
|
validateOptions(watchQueryOptions);
|
|
7475
7753
|
}
|
|
7476
7754
|
return watchQueryOptions;
|
|
7477
7755
|
}
|
|
7478
|
-
|
|
7479
|
-
|
|
7756
|
+
|
|
7757
|
+
function useBackgroundQuery(query, options) {
|
|
7758
|
+
if (options === void 0) { options = Object.create(null); }
|
|
7759
|
+
var suspenseCache = useSuspenseCache(options.suspenseCache);
|
|
7760
|
+
var client = useApolloClient(options.client);
|
|
7761
|
+
var watchQueryOptions = useWatchQueryOptions({ query: query, options: options });
|
|
7762
|
+
var variables = watchQueryOptions.variables;
|
|
7763
|
+
var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
|
|
7764
|
+
var cacheKey = [client, query, canonicalStringify(variables)].concat(queryKey);
|
|
7765
|
+
var queryRef = suspenseCache.getQueryRef(cacheKey, function () {
|
|
7766
|
+
return client.watchQuery(watchQueryOptions);
|
|
7767
|
+
});
|
|
7768
|
+
var _b = React.useState(function () { return new Map([[queryRef.key, queryRef.promise]]); }), promiseCache = _b[0], setPromiseCache = _b[1];
|
|
7769
|
+
useTrackedQueryRefs(queryRef);
|
|
7770
|
+
var fetchMore = React.useCallback(function (options) {
|
|
7771
|
+
var promise = queryRef.fetchMore(options);
|
|
7772
|
+
setPromiseCache(function (promiseCache) {
|
|
7773
|
+
return new Map(promiseCache).set(queryRef.key, promise);
|
|
7774
|
+
});
|
|
7775
|
+
return promise;
|
|
7776
|
+
}, [queryRef]);
|
|
7777
|
+
var refetch = React.useCallback(function (variables) {
|
|
7778
|
+
var promise = queryRef.refetch(variables);
|
|
7779
|
+
setPromiseCache(function (promiseCache) {
|
|
7780
|
+
return new Map(promiseCache).set(queryRef.key, promise);
|
|
7781
|
+
});
|
|
7782
|
+
return promise;
|
|
7783
|
+
}, [queryRef]);
|
|
7784
|
+
queryRef.promiseCache = promiseCache;
|
|
7785
|
+
return React.useMemo(function () {
|
|
7786
|
+
return [
|
|
7787
|
+
queryRef,
|
|
7788
|
+
{
|
|
7789
|
+
fetchMore: fetchMore,
|
|
7790
|
+
refetch: refetch,
|
|
7791
|
+
},
|
|
7792
|
+
];
|
|
7793
|
+
}, [queryRef, fetchMore, refetch]);
|
|
7480
7794
|
}
|
|
7481
|
-
function
|
|
7482
|
-
var
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7795
|
+
function useReadQuery(queryRef) {
|
|
7796
|
+
var _a = React.useState(0), forceUpdate = _a[1];
|
|
7797
|
+
invariant(queryRef.promiseCache, 50);
|
|
7798
|
+
var promise = queryRef.promiseCache.get(queryRef.key);
|
|
7799
|
+
if (!promise) {
|
|
7800
|
+
promise = queryRef.promise;
|
|
7801
|
+
queryRef.promiseCache.set(queryRef.key, promise);
|
|
7486
7802
|
}
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
};
|
|
7492
|
-
}, []);
|
|
7493
|
-
return useSyncExternalStore(React.useCallback(function (forceUpdate) {
|
|
7494
|
-
function handleUpdate() {
|
|
7495
|
-
var previousResult = resultRef.current;
|
|
7496
|
-
var result = observable.getCurrentResult();
|
|
7497
|
-
if (previousResult.loading === result.loading &&
|
|
7498
|
-
previousResult.networkStatus === result.networkStatus &&
|
|
7499
|
-
equality.equal(previousResult.data, result.data)) {
|
|
7500
|
-
return;
|
|
7501
|
-
}
|
|
7502
|
-
resultRef.current = result;
|
|
7503
|
-
if (isMountedRef.current) {
|
|
7504
|
-
forceUpdate();
|
|
7505
|
-
}
|
|
7506
|
-
}
|
|
7507
|
-
var subscription = observable.subscribe({
|
|
7508
|
-
next: handleUpdate,
|
|
7509
|
-
error: handleUpdate,
|
|
7803
|
+
React.useEffect(function () {
|
|
7804
|
+
return queryRef.listen(function (promise) {
|
|
7805
|
+
queryRef.promiseCache.set(queryRef.key, promise);
|
|
7806
|
+
forceUpdate(function (prevState) { return prevState + 1; });
|
|
7510
7807
|
});
|
|
7511
|
-
|
|
7512
|
-
|
|
7808
|
+
}, [queryRef]);
|
|
7809
|
+
var result = __use(promise);
|
|
7810
|
+
return React.useMemo(function () {
|
|
7811
|
+
return {
|
|
7812
|
+
data: result.data,
|
|
7813
|
+
networkStatus: result.networkStatus,
|
|
7814
|
+
error: toApolloError(result),
|
|
7513
7815
|
};
|
|
7514
|
-
}, [
|
|
7816
|
+
}, [result]);
|
|
7515
7817
|
}
|
|
7516
7818
|
|
|
7517
|
-
var
|
|
7518
|
-
function
|
|
7519
|
-
|
|
7819
|
+
var QueryReference = (function () {
|
|
7820
|
+
function QueryReference(observable, options) {
|
|
7821
|
+
var _this = this;
|
|
7822
|
+
var _a;
|
|
7823
|
+
this.listeners = new Set();
|
|
7824
|
+
this.initialized = false;
|
|
7825
|
+
this.refetching = false;
|
|
7826
|
+
this.listen = this.listen.bind(this);
|
|
7827
|
+
this.handleNext = this.handleNext.bind(this);
|
|
7828
|
+
this.handleError = this.handleError.bind(this);
|
|
7829
|
+
this.dispose = this.dispose.bind(this);
|
|
7830
|
+
this.observable = observable;
|
|
7831
|
+
this.result = observable.getCurrentResult(false);
|
|
7832
|
+
this.key = options.key;
|
|
7833
|
+
if (options.onDispose) {
|
|
7834
|
+
this.onDispose = options.onDispose;
|
|
7835
|
+
}
|
|
7836
|
+
if (isNetworkRequestSettled(this.result.networkStatus) ||
|
|
7837
|
+
(this.result.data &&
|
|
7838
|
+
(!this.result.partial || this.observable.options.returnPartialData))) {
|
|
7839
|
+
this.promise = createFulfilledPromise(this.result);
|
|
7840
|
+
this.initialized = true;
|
|
7841
|
+
this.refetching = false;
|
|
7842
|
+
}
|
|
7843
|
+
this.subscription = observable.subscribe({
|
|
7844
|
+
next: this.handleNext,
|
|
7845
|
+
error: this.handleError,
|
|
7846
|
+
});
|
|
7847
|
+
if (!this.promise) {
|
|
7848
|
+
this.promise = new Promise(function (resolve, reject) {
|
|
7849
|
+
_this.resolve = resolve;
|
|
7850
|
+
_this.reject = reject;
|
|
7851
|
+
});
|
|
7852
|
+
}
|
|
7853
|
+
this.autoDisposeTimeoutId = setTimeout(this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);
|
|
7520
7854
|
}
|
|
7521
|
-
|
|
7522
|
-
var
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
fulfilled: false,
|
|
7528
|
-
promise: promise
|
|
7529
|
-
.catch(function () {
|
|
7530
|
-
})
|
|
7531
|
-
.finally(function () {
|
|
7532
|
-
entry.fulfilled = true;
|
|
7533
|
-
}),
|
|
7855
|
+
QueryReference.prototype.listen = function (listener) {
|
|
7856
|
+
var _this = this;
|
|
7857
|
+
clearTimeout(this.autoDisposeTimeoutId);
|
|
7858
|
+
this.listeners.add(listener);
|
|
7859
|
+
return function () {
|
|
7860
|
+
_this.listeners.delete(listener);
|
|
7534
7861
|
};
|
|
7535
|
-
map.set(variablesKey, entry);
|
|
7536
|
-
this.queries.set(query, map);
|
|
7537
|
-
return entry;
|
|
7538
7862
|
};
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
|
|
7863
|
+
QueryReference.prototype.refetch = function (variables) {
|
|
7864
|
+
this.refetching = true;
|
|
7865
|
+
var promise = this.observable.refetch(variables);
|
|
7866
|
+
this.promise = promise;
|
|
7867
|
+
return promise;
|
|
7543
7868
|
};
|
|
7544
|
-
|
|
7545
|
-
var
|
|
7546
|
-
|
|
7869
|
+
QueryReference.prototype.fetchMore = function (options) {
|
|
7870
|
+
var promise = this.observable.fetchMore(options);
|
|
7871
|
+
this.promise = promise;
|
|
7872
|
+
return promise;
|
|
7873
|
+
};
|
|
7874
|
+
QueryReference.prototype.dispose = function () {
|
|
7875
|
+
this.subscription.unsubscribe();
|
|
7876
|
+
this.onDispose();
|
|
7877
|
+
};
|
|
7878
|
+
QueryReference.prototype.onDispose = function () {
|
|
7879
|
+
};
|
|
7880
|
+
QueryReference.prototype.handleNext = function (result) {
|
|
7881
|
+
if (!this.initialized || this.refetching) {
|
|
7882
|
+
if (!isNetworkRequestSettled(result.networkStatus)) {
|
|
7883
|
+
return;
|
|
7884
|
+
}
|
|
7885
|
+
if (this.result.data && result.data === void 0) {
|
|
7886
|
+
result.data = this.result.data;
|
|
7887
|
+
}
|
|
7888
|
+
this.initialized = true;
|
|
7889
|
+
this.refetching = false;
|
|
7890
|
+
this.result = result;
|
|
7891
|
+
this.resolve(result);
|
|
7547
7892
|
return;
|
|
7548
7893
|
}
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
if (entry && !entry.observable.hasObservers()) {
|
|
7552
|
-
map.delete(key);
|
|
7894
|
+
if (result.data === this.result.data) {
|
|
7895
|
+
return;
|
|
7553
7896
|
}
|
|
7554
|
-
|
|
7555
|
-
|
|
7897
|
+
this.result = result;
|
|
7898
|
+
this.promise = createFulfilledPromise(result);
|
|
7899
|
+
this.deliver(this.promise);
|
|
7900
|
+
};
|
|
7901
|
+
QueryReference.prototype.handleError = function (error) {
|
|
7902
|
+
var result = tslib.__assign(tslib.__assign({}, this.result), { error: error, networkStatus: exports.NetworkStatus.error });
|
|
7903
|
+
this.result = result;
|
|
7904
|
+
if (!this.initialized || this.refetching) {
|
|
7905
|
+
this.initialized = true;
|
|
7906
|
+
this.refetching = false;
|
|
7907
|
+
this.reject(error);
|
|
7908
|
+
return;
|
|
7556
7909
|
}
|
|
7910
|
+
this.result = result;
|
|
7911
|
+
this.promise = result.data
|
|
7912
|
+
? createFulfilledPromise(result)
|
|
7913
|
+
: createRejectedPromise(result);
|
|
7914
|
+
this.deliver(this.promise);
|
|
7557
7915
|
};
|
|
7558
|
-
|
|
7559
|
-
|
|
7916
|
+
QueryReference.prototype.deliver = function (promise) {
|
|
7917
|
+
this.listeners.forEach(function (listener) { return listener(promise); });
|
|
7918
|
+
};
|
|
7919
|
+
return QueryReference;
|
|
7920
|
+
}());
|
|
7921
|
+
|
|
7922
|
+
var SuspenseCache = (function () {
|
|
7923
|
+
function SuspenseCache(options) {
|
|
7924
|
+
if (options === void 0) { options = Object.create(null); }
|
|
7925
|
+
this.cacheKeys = new trie.Trie(canUseWeakMap, function (cacheKey) { return cacheKey; });
|
|
7926
|
+
this.queryRefs = new Map();
|
|
7927
|
+
this.options = options;
|
|
7928
|
+
}
|
|
7929
|
+
SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) {
|
|
7930
|
+
var _this = this;
|
|
7931
|
+
var stableCacheKey = this.cacheKeys.lookupArray(cacheKey);
|
|
7932
|
+
if (!this.queryRefs.has(stableCacheKey)) {
|
|
7933
|
+
this.queryRefs.set(stableCacheKey, new QueryReference(createObservable(), {
|
|
7934
|
+
key: stableCacheKey,
|
|
7935
|
+
autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs,
|
|
7936
|
+
onDispose: function () { return _this.queryRefs.delete(stableCacheKey); },
|
|
7937
|
+
}));
|
|
7938
|
+
}
|
|
7939
|
+
return this.queryRefs.get(stableCacheKey);
|
|
7560
7940
|
};
|
|
7561
7941
|
return SuspenseCache;
|
|
7562
7942
|
}());
|
|
@@ -7574,6 +7954,7 @@ exports.ApolloConsumer = ApolloConsumer;
|
|
|
7574
7954
|
exports.ApolloError = ApolloError;
|
|
7575
7955
|
exports.ApolloLink = ApolloLink;
|
|
7576
7956
|
exports.ApolloProvider = ApolloProvider;
|
|
7957
|
+
exports.DocumentTransform = DocumentTransform;
|
|
7577
7958
|
exports.HttpLink = HttpLink;
|
|
7578
7959
|
exports.InMemoryCache = InMemoryCache;
|
|
7579
7960
|
exports.MissingFieldError = MissingFieldError;
|
|
@@ -7593,6 +7974,7 @@ exports.fromError = fromError;
|
|
|
7593
7974
|
exports.fromPromise = fromPromise;
|
|
7594
7975
|
exports.getApolloContext = getApolloContext;
|
|
7595
7976
|
exports.isApolloError = isApolloError;
|
|
7977
|
+
exports.isNetworkRequestSettled = isNetworkRequestSettled;
|
|
7596
7978
|
exports.isReference = isReference;
|
|
7597
7979
|
exports.makeReference = makeReference;
|
|
7598
7980
|
exports.makeVar = makeVar;
|
|
@@ -7600,7 +7982,7 @@ exports.mergeOptions = mergeOptions;
|
|
|
7600
7982
|
exports.operationName = operationName;
|
|
7601
7983
|
exports.parseAndCheckHttpResponse = parseAndCheckHttpResponse;
|
|
7602
7984
|
exports.parser = parser;
|
|
7603
|
-
exports.resetApolloContext =
|
|
7985
|
+
exports.resetApolloContext = resetApolloContext;
|
|
7604
7986
|
exports.rewriteURIForGET = rewriteURIForGET;
|
|
7605
7987
|
exports.selectHttpOptionsAndBody = selectHttpOptionsAndBody;
|
|
7606
7988
|
exports.selectHttpOptionsAndBodyInternal = selectHttpOptionsAndBodyInternal;
|
|
@@ -7610,11 +7992,13 @@ exports.split = split;
|
|
|
7610
7992
|
exports.throwServerError = throwServerError;
|
|
7611
7993
|
exports.toPromise = toPromise;
|
|
7612
7994
|
exports.useApolloClient = useApolloClient;
|
|
7613
|
-
exports.
|
|
7995
|
+
exports.useBackgroundQuery = useBackgroundQuery;
|
|
7996
|
+
exports.useFragment = useFragment;
|
|
7614
7997
|
exports.useLazyQuery = useLazyQuery;
|
|
7615
7998
|
exports.useMutation = useMutation;
|
|
7616
7999
|
exports.useQuery = useQuery;
|
|
7617
8000
|
exports.useReactiveVar = useReactiveVar;
|
|
8001
|
+
exports.useReadQuery = useReadQuery;
|
|
7618
8002
|
exports.useSubscription = useSubscription;
|
|
7619
|
-
exports.
|
|
8003
|
+
exports.useSuspenseQuery = useSuspenseQuery;
|
|
7620
8004
|
//# sourceMappingURL=apollo-client.cjs.map
|