@apollo/client 4.0.0-alpha.8 → 4.0.0-rc.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/CHANGELOG.md +1041 -0
- package/README.md +80 -31
- package/__cjs/cache/core/cache.cjs +11 -9
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +11 -8
- package/__cjs/cache/index.cjs +1 -2
- package/__cjs/cache/index.cjs.map +1 -1
- package/__cjs/cache/index.d.cts +1 -1
- package/__cjs/cache/inmemory/entityStore.cjs +12 -11
- package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/fragmentRegistry.cjs +3 -2
- package/__cjs/cache/inmemory/fragmentRegistry.cjs.map +1 -1
- package/__cjs/cache/inmemory/helpers.cjs +10 -10
- package/__cjs/cache/inmemory/helpers.cjs.map +1 -1
- package/__cjs/cache/inmemory/helpers.d.cts +3 -3
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.d.cts +9 -7
- package/__cjs/cache/inmemory/key-extractor.cjs +10 -10
- package/__cjs/cache/inmemory/key-extractor.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.cjs +14 -13
- package/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.d.cts +2 -1
- package/__cjs/cache/inmemory/readFromStore.cjs +17 -16
- package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/writeToStore.cjs +50 -22
- package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/writeToStore.d.cts +2 -1
- package/__cjs/core/ApolloClient.cjs +53 -74
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +29 -55
- package/__cjs/core/ObservableQuery.cjs +798 -435
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +292 -61
- package/__cjs/core/QueryInfo.cjs +271 -180
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +55 -30
- package/__cjs/core/QueryManager.cjs +511 -589
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/QueryManager.d.cts +52 -62
- package/__cjs/core/equalByQuery.cjs +7 -7
- package/__cjs/core/equalByQuery.cjs.map +1 -1
- package/__cjs/core/index.cjs +11 -10
- package/__cjs/core/index.cjs.map +1 -1
- package/__cjs/core/index.d.cts +10 -12
- package/__cjs/core/networkStatus.cjs +7 -1
- package/__cjs/core/networkStatus.cjs.map +1 -1
- package/__cjs/core/networkStatus.d.cts +7 -1
- package/__cjs/core/types.d.cts +137 -25
- package/__cjs/core/watchQueryOptions.d.cts +17 -102
- package/__cjs/dev/loadErrorMessageHandler.cjs +2 -3
- package/__cjs/dev/loadErrorMessageHandler.cjs.map +1 -1
- package/__cjs/dev/setErrorMessageHandler.cjs +2 -3
- package/__cjs/dev/setErrorMessageHandler.cjs.map +1 -1
- package/__cjs/errors/CombinedGraphQLErrors.cjs +28 -13
- package/__cjs/errors/CombinedGraphQLErrors.cjs.map +1 -1
- package/__cjs/errors/CombinedGraphQLErrors.d.cts +21 -2
- package/__cjs/errors/CombinedProtocolErrors.cjs +13 -6
- package/__cjs/errors/CombinedProtocolErrors.cjs.map +1 -1
- package/__cjs/errors/CombinedProtocolErrors.d.cts +9 -0
- package/__cjs/errors/LinkError.cjs +24 -0
- package/__cjs/errors/LinkError.cjs.map +1 -0
- package/__cjs/errors/LinkError.d.cts +18 -0
- package/__cjs/errors/LocalStateError.cjs +27 -0
- package/__cjs/errors/LocalStateError.cjs.map +1 -0
- package/__cjs/errors/LocalStateError.d.cts +20 -0
- package/__cjs/errors/ServerError.cjs +9 -4
- package/__cjs/errors/ServerError.cjs.map +1 -1
- package/__cjs/errors/ServerError.d.cts +10 -8
- package/__cjs/errors/ServerParseError.cjs +6 -0
- package/__cjs/errors/ServerParseError.cjs.map +1 -1
- package/__cjs/errors/ServerParseError.d.cts +2 -0
- package/__cjs/errors/UnconventionalError.cjs +6 -0
- package/__cjs/errors/UnconventionalError.cjs.map +1 -1
- package/__cjs/errors/UnconventionalError.d.cts +2 -0
- package/__cjs/errors/index.cjs +12 -12
- package/__cjs/errors/index.cjs.map +1 -1
- package/__cjs/errors/index.d.cts +5 -8
- package/__cjs/errors/isErrorLike.cjs +12 -0
- package/__cjs/errors/isErrorLike.cjs.map +1 -0
- package/__cjs/errors/isErrorLike.d.cts +3 -0
- package/__cjs/errors/utils.cjs +18 -0
- package/__cjs/errors/utils.cjs.map +1 -0
- package/__cjs/errors/utils.d.cts +3 -0
- package/__cjs/incremental/handlers/defer20220824.cjs +102 -0
- package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -0
- package/__cjs/incremental/handlers/defer20220824.d.cts +55 -0
- package/__cjs/incremental/handlers/notImplemented.cjs +19 -0
- package/__cjs/incremental/handlers/notImplemented.cjs.map +1 -0
- package/__cjs/incremental/handlers/notImplemented.d.cts +9 -0
- package/__cjs/incremental/index.cjs +9 -0
- package/__cjs/incremental/index.cjs.map +1 -0
- package/__cjs/incremental/index.d.cts +4 -0
- package/__cjs/incremental/types.cjs +3 -0
- package/__cjs/incremental/types.cjs.map +1 -0
- package/__cjs/incremental/types.d.cts +24 -0
- package/__cjs/invariantErrorCodes.cjs +275 -172
- package/__cjs/link/batch/batchLink.cjs +2 -2
- package/__cjs/link/batch/batchLink.cjs.map +1 -1
- package/__cjs/link/batch/batchLink.d.cts +2 -2
- package/__cjs/link/batch/batching.cjs.map +1 -1
- package/__cjs/link/batch/batching.d.cts +1 -1
- package/__cjs/link/batch-http/batchHttpLink.cjs +21 -67
- package/__cjs/link/batch-http/batchHttpLink.cjs.map +1 -1
- package/__cjs/link/batch-http/batchHttpLink.d.cts +9 -4
- package/__cjs/link/batch-http/index.cjs +2 -1
- package/__cjs/link/batch-http/index.cjs.map +1 -1
- package/__cjs/link/batch-http/index.d.cts +1 -1
- package/__cjs/link/client-awareness/ClientAwarenessLink.cjs +45 -0
- package/__cjs/link/client-awareness/ClientAwarenessLink.cjs.map +1 -0
- package/__cjs/link/client-awareness/ClientAwarenessLink.d.cts +62 -0
- package/__cjs/link/client-awareness/index.cjs +6 -0
- package/__cjs/link/client-awareness/index.cjs.map +1 -0
- package/__cjs/link/client-awareness/index.d.cts +2 -0
- package/__cjs/link/context/index.cjs +37 -26
- package/__cjs/link/context/index.cjs.map +1 -1
- package/__cjs/link/context/index.d.cts +11 -5
- package/__cjs/link/core/ApolloLink.cjs +19 -13
- package/__cjs/link/core/ApolloLink.cjs.map +1 -1
- package/__cjs/link/core/ApolloLink.d.cts +17 -11
- package/__cjs/link/core/types.d.cts +14 -36
- package/__cjs/link/error/index.cjs +69 -66
- package/__cjs/link/error/index.cjs.map +1 -1
- package/__cjs/link/error/index.d.cts +17 -16
- package/__cjs/link/http/BaseHttpLink.cjs +111 -0
- package/__cjs/link/http/BaseHttpLink.cjs.map +1 -0
- package/__cjs/link/http/BaseHttpLink.d.cts +6 -0
- package/__cjs/link/http/HttpLink.cjs +14 -7
- package/__cjs/link/http/HttpLink.cjs.map +1 -1
- package/__cjs/link/http/HttpLink.d.cts +145 -4
- package/__cjs/link/http/checkFetcher.cjs +1 -1
- package/__cjs/link/http/index.cjs +4 -3
- package/__cjs/link/http/index.cjs.map +1 -1
- package/__cjs/link/http/index.d.cts +2 -3
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs +74 -113
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +1 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.d.cts +1 -3
- package/__cjs/link/http/rewriteURIForGET.cjs.map +1 -1
- package/__cjs/link/http/rewriteURIForGET.d.cts +2 -2
- package/__cjs/link/http/selectHttpOptionsAndBody.cjs +7 -6
- package/__cjs/link/http/selectHttpOptionsAndBody.cjs.map +1 -1
- package/__cjs/link/http/selectHttpOptionsAndBody.d.cts +8 -83
- package/__cjs/link/http/selectURI.cjs.map +1 -1
- package/__cjs/link/http/selectURI.d.cts +1 -1
- package/__cjs/link/http/serializeFetchParameter.cjs +1 -1
- package/__cjs/link/index.cjs +16 -0
- package/__cjs/link/index.cjs.map +1 -0
- package/__cjs/link/index.d.cts +8 -0
- package/__cjs/link/persisted-queries/index.cjs +162 -142
- package/__cjs/link/persisted-queries/index.cjs.map +1 -1
- package/__cjs/link/persisted-queries/index.d.cts +21 -21
- package/__cjs/link/remove-typename/index.cjs +2 -1
- package/__cjs/link/remove-typename/index.cjs.map +1 -1
- package/__cjs/link/remove-typename/index.d.cts +1 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs +37 -25
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.d.cts +9 -10
- package/__cjs/link/retry/delayFunction.cjs.map +1 -1
- package/__cjs/link/retry/delayFunction.d.cts +1 -1
- package/__cjs/link/retry/retryFunction.cjs.map +1 -1
- package/__cjs/link/retry/retryFunction.d.cts +1 -1
- package/__cjs/link/retry/retryLink.cjs +2 -2
- package/__cjs/link/retry/retryLink.cjs.map +1 -1
- package/__cjs/link/retry/retryLink.d.cts +2 -2
- package/__cjs/link/schema/index.cjs +2 -2
- package/__cjs/link/schema/index.cjs.map +1 -1
- package/__cjs/link/schema/index.d.cts +2 -2
- package/__cjs/link/subscriptions/index.cjs +5 -5
- package/__cjs/link/subscriptions/index.cjs.map +1 -1
- package/__cjs/link/subscriptions/index.d.cts +2 -2
- package/__cjs/link/utils/createOperation.cjs +5 -1
- package/__cjs/link/utils/createOperation.cjs.map +1 -1
- package/__cjs/link/utils/createOperation.d.cts +2 -2
- package/__cjs/link/utils/transformOperation.cjs +2 -2
- package/__cjs/link/utils/transformOperation.cjs.map +1 -1
- package/__cjs/link/utils/transformOperation.d.cts +1 -1
- package/__cjs/link/utils/validateOperation.cjs +1 -1
- package/__cjs/link/utils/validateOperation.cjs.map +1 -1
- package/__cjs/link/utils/validateOperation.d.cts +1 -1
- package/__cjs/link/ws/index.cjs +2 -2
- package/__cjs/link/ws/index.cjs.map +1 -1
- package/__cjs/link/ws/index.d.cts +2 -2
- package/__cjs/local-state/LocalState.cjs +527 -0
- package/__cjs/local-state/LocalState.cjs.map +1 -0
- package/__cjs/local-state/LocalState.d.cts +88 -0
- package/__cjs/local-state/index.cjs +6 -0
- package/__cjs/local-state/index.cjs.map +1 -0
- package/__cjs/local-state/index.d.cts +2 -0
- package/__cjs/masking/GraphQLCodegenDataMasking.cjs +3 -0
- package/__cjs/masking/GraphQLCodegenDataMasking.cjs.map +1 -0
- package/__cjs/masking/GraphQLCodegenDataMasking.d.cts +79 -0
- package/__cjs/masking/index.cjs.map +1 -1
- package/__cjs/masking/index.d.cts +1 -0
- package/__cjs/masking/internal/types.d.cts +1 -2
- package/__cjs/masking/maskDefinition.cjs +6 -6
- package/__cjs/masking/maskDefinition.cjs.map +1 -1
- package/__cjs/masking/maskDefinition.d.cts +1 -1
- package/__cjs/masking/maskFragment.cjs +9 -13
- package/__cjs/masking/maskFragment.cjs.map +1 -1
- package/__cjs/masking/maskFragment.d.cts +5 -1
- package/__cjs/masking/maskOperation.cjs +9 -13
- package/__cjs/masking/maskOperation.cjs.map +1 -1
- package/__cjs/masking/maskOperation.d.cts +5 -1
- package/__cjs/masking/types.d.cts +12 -26
- package/__cjs/masking/utils.cjs +32 -7
- package/__cjs/masking/utils.cjs.map +1 -1
- package/__cjs/masking/utils.d.cts +7 -2
- package/__cjs/react/context/ApolloConsumer.cjs +1 -1
- package/__cjs/react/context/ApolloContext.cjs +1 -1
- package/__cjs/react/context/ApolloProvider.cjs +1 -1
- package/__cjs/react/hooks/internal/__use.cjs +6 -6
- package/__cjs/react/hooks/internal/__use.cjs.map +1 -1
- package/__cjs/react/hooks/internal/useIsomorphicLayoutEffect.cjs +2 -2
- package/__cjs/react/hooks/internal/useIsomorphicLayoutEffect.cjs.map +1 -1
- package/__cjs/react/hooks/internal/validateSuspenseHookOptions.cjs +28 -0
- package/__cjs/react/hooks/internal/validateSuspenseHookOptions.cjs.map +1 -0
- package/__cjs/react/hooks/internal/validateSuspenseHookOptions.d.cts +3 -0
- package/__cjs/react/hooks/internal/wrapHook.cjs +36 -34
- package/__cjs/react/hooks/internal/wrapHook.cjs.map +1 -1
- package/__cjs/react/hooks/internal/wrapHook.d.cts +42 -38
- package/__cjs/react/hooks/useApolloClient.cjs +1 -1
- package/__cjs/react/hooks/useBackgroundQuery.cjs +3 -2
- package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useBackgroundQuery.d.cts +59 -28
- package/__cjs/react/hooks/useFragment.cjs +1 -0
- package/__cjs/react/hooks/useFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useFragment.d.cts +2 -1
- package/__cjs/react/hooks/useLazyQuery.cjs +32 -33
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.d.cts +56 -81
- package/__cjs/react/hooks/useLoadableQuery.cjs +23 -4
- package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLoadableQuery.d.cts +8 -10
- package/__cjs/react/hooks/useMutation.cjs +2 -2
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.d.cts +48 -15
- package/__cjs/react/hooks/useQuery.cjs +36 -48
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +20 -72
- package/__cjs/react/hooks/useQueryRefHandlers.cjs +1 -0
- package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
- package/__cjs/react/hooks/useQueryRefHandlers.d.cts +2 -2
- package/__cjs/react/hooks/useReadQuery.cjs +2 -0
- package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useReadQuery.d.cts +4 -11
- package/__cjs/react/hooks/useSubscription.cjs +13 -18
- package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
- package/__cjs/react/hooks/useSubscription.d.cts +6 -8
- package/__cjs/react/hooks/useSuspenseFragment.cjs +1 -0
- package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseFragment.d.cts +1 -2
- package/__cjs/react/hooks/useSuspenseQuery.cjs +8 -28
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.d.cts +19 -36
- package/__cjs/react/hooks/useSyncExternalStore.cjs +22 -3
- package/__cjs/react/hooks/useSyncExternalStore.cjs.map +1 -1
- package/__cjs/react/index.cjs +3 -1
- package/__cjs/react/index.cjs.map +1 -1
- package/__cjs/react/index.d.cts +2 -1
- package/__cjs/react/internal/cache/FragmentReference.cjs +8 -5
- package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/FragmentReference.d.cts +2 -2
- package/__cjs/react/internal/cache/QueryReference.cjs +27 -38
- package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/QueryReference.d.cts +48 -108
- package/__cjs/react/internal/cache/SuspenseCache.cjs.map +1 -1
- package/__cjs/react/internal/cache/SuspenseCache.d.cts +3 -3
- package/__cjs/react/internal/index.cjs.map +1 -1
- package/__cjs/react/internal/index.d.cts +2 -2
- package/__cjs/react/internal/types.d.cts +3 -45
- package/__cjs/react/query-preloader/createQueryPreloader.cjs +9 -2
- package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
- package/__cjs/react/query-preloader/createQueryPreloader.d.cts +46 -38
- package/__cjs/react/ssr/prerenderStatic.cjs +9 -2
- package/__cjs/react/ssr/prerenderStatic.cjs.map +1 -1
- package/__cjs/react/ssr/useSSRQuery.cjs +12 -2
- package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -1
- package/__cjs/react/types/deprecated.d.cts +3 -3
- package/__cjs/react/types/types.documentation.d.cts +14 -2
- package/__cjs/testing/core/mocking/mockLink.cjs +21 -22
- package/__cjs/testing/core/mocking/mockLink.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockLink.d.cts +31 -24
- package/__cjs/testing/core/mocking/mockSubscriptionLink.cjs +2 -6
- package/__cjs/testing/core/mocking/mockSubscriptionLink.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockSubscriptionLink.d.cts +9 -8
- package/__cjs/testing/core/types/deprecated.cjs +3 -0
- package/__cjs/testing/core/types/deprecated.cjs.map +1 -0
- package/__cjs/testing/core/types/deprecated.d.cts +10 -0
- package/__cjs/testing/index.cjs +6 -13
- package/__cjs/testing/index.cjs.map +1 -1
- package/__cjs/testing/index.d.cts +3 -2
- package/__cjs/testing/react/MockedProvider.cjs +4 -4
- package/__cjs/testing/react/MockedProvider.cjs.map +1 -1
- package/__cjs/testing/react/MockedProvider.d.cts +5 -6
- package/__cjs/utilities/DeepPartial.cjs.map +1 -0
- package/__cjs/utilities/DeepPartial.d.cts +15 -0
- package/__cjs/utilities/HKT.cjs +3 -0
- package/__cjs/utilities/HKT.cjs.map +1 -0
- package/__cjs/utilities/HKT.d.cts +35 -0
- package/__cjs/utilities/caching/index.cjs +1 -4
- package/__cjs/utilities/caching/index.cjs.map +1 -1
- package/__cjs/utilities/caching/index.d.cts +0 -1
- package/__cjs/utilities/caching/sizes.cjs +1 -1
- package/__cjs/utilities/caching/sizes.cjs.map +1 -1
- package/__cjs/utilities/caching/sizes.d.cts +6 -0
- package/__cjs/utilities/common/stripTypename.cjs +8 -2
- package/__cjs/utilities/common/stripTypename.cjs.map +1 -1
- package/__cjs/utilities/common/stripTypename.d.cts +7 -1
- package/__cjs/utilities/graphql/DocumentTransform.cjs +13 -9
- package/__cjs/utilities/graphql/DocumentTransform.cjs.map +1 -1
- package/__cjs/utilities/graphql/DocumentTransform.d.cts +10 -6
- package/__cjs/utilities/graphql/isFormattedExecutionResult.cjs +9 -0
- package/__cjs/utilities/graphql/isFormattedExecutionResult.cjs.map +1 -0
- package/__cjs/utilities/graphql/isFormattedExecutionResult.d.cts +3 -0
- package/__cjs/utilities/graphql/operations.cjs +23 -2
- package/__cjs/utilities/graphql/operations.cjs.map +1 -1
- package/__cjs/utilities/graphql/operations.d.cts +21 -0
- package/__cjs/utilities/graphql/print.cjs +9 -1
- package/__cjs/utilities/graphql/print.cjs.map +1 -1
- package/__cjs/utilities/graphql/print.d.cts +8 -0
- package/__cjs/utilities/graphql/storeUtils.cjs +5 -206
- package/__cjs/utilities/graphql/storeUtils.cjs.map +1 -1
- package/__cjs/utilities/graphql/storeUtils.d.cts +14 -22
- package/__cjs/utilities/graphql/transform.cjs +8 -454
- package/__cjs/utilities/graphql/transform.cjs.map +1 -1
- package/__cjs/utilities/graphql/transform.d.cts +6 -24
- package/__cjs/utilities/index.cjs +4 -90
- package/__cjs/utilities/index.cjs.map +1 -1
- package/__cjs/utilities/index.d.cts +8 -38
- package/__cjs/utilities/internal/DeepMerger.cjs +67 -0
- package/__cjs/utilities/internal/DeepMerger.cjs.map +1 -0
- package/__cjs/utilities/internal/DeepMerger.d.cts +17 -0
- package/__cjs/utilities/internal/argumentsObjectFromField.cjs +18 -0
- package/__cjs/utilities/internal/argumentsObjectFromField.cjs.map +1 -0
- package/__cjs/utilities/internal/argumentsObjectFromField.d.cts +8 -0
- package/__cjs/utilities/internal/caches.cjs +76 -0
- package/__cjs/utilities/internal/caches.cjs.map +1 -0
- package/__cjs/utilities/internal/caches.d.cts +42 -0
- package/__cjs/utilities/internal/canUseDOM.cjs +11 -0
- package/__cjs/utilities/internal/canUseDOM.cjs.map +1 -0
- package/__cjs/utilities/internal/canUseDOM.d.cts +7 -0
- package/__cjs/utilities/internal/checkDocument.cjs +69 -0
- package/__cjs/utilities/internal/checkDocument.cjs.map +1 -0
- package/__cjs/utilities/internal/checkDocument.d.cts +10 -0
- package/__cjs/utilities/internal/cloneDeep.cjs +45 -0
- package/__cjs/utilities/internal/cloneDeep.cjs.map +1 -0
- package/__cjs/utilities/internal/cloneDeep.d.cts +9 -0
- package/__cjs/utilities/internal/compact.cjs +26 -0
- package/__cjs/utilities/internal/compact.cjs.map +1 -0
- package/__cjs/utilities/internal/compact.d.cts +11 -0
- package/__cjs/utilities/internal/createFragmentMap.cjs +19 -0
- package/__cjs/utilities/internal/createFragmentMap.cjs.map +1 -0
- package/__cjs/utilities/internal/createFragmentMap.d.cts +12 -0
- package/__cjs/utilities/internal/createFulfilledPromise.cjs +15 -0
- package/__cjs/utilities/internal/createFulfilledPromise.cjs.map +1 -0
- package/__cjs/utilities/internal/createFulfilledPromise.d.cts +8 -0
- package/__cjs/utilities/internal/createRejectedPromise.cjs +17 -0
- package/__cjs/utilities/internal/createRejectedPromise.cjs.map +1 -0
- package/__cjs/utilities/internal/createRejectedPromise.d.cts +8 -0
- package/__cjs/utilities/internal/dealias.cjs +21 -0
- package/__cjs/utilities/internal/dealias.cjs.map +1 -0
- package/__cjs/utilities/internal/dealias.d.cts +5 -0
- package/__cjs/utilities/internal/decoratePromise.cjs +33 -0
- package/__cjs/utilities/internal/decoratePromise.cjs.map +1 -0
- package/__cjs/utilities/internal/decoratePromise.d.cts +8 -0
- package/__cjs/utilities/internal/deepFreeze.cjs +39 -0
- package/__cjs/utilities/internal/deepFreeze.cjs.map +1 -0
- package/__cjs/utilities/internal/deepFreeze.d.cts +7 -0
- package/__cjs/utilities/internal/filterMap.cjs +31 -0
- package/__cjs/utilities/internal/filterMap.cjs.map +1 -0
- package/__cjs/utilities/internal/filterMap.d.cts +4 -0
- package/__cjs/utilities/internal/getDefaultValues.cjs +22 -0
- package/__cjs/utilities/internal/getDefaultValues.cjs.map +1 -0
- package/__cjs/utilities/internal/getDefaultValues.d.cts +8 -0
- package/__cjs/utilities/internal/getFragmentDefinition.cjs +17 -0
- package/__cjs/utilities/internal/getFragmentDefinition.cjs.map +1 -0
- package/__cjs/utilities/internal/getFragmentDefinition.d.cts +8 -0
- package/__cjs/utilities/internal/getFragmentDefinitions.cjs +12 -0
- package/__cjs/utilities/internal/getFragmentDefinitions.cjs.map +1 -0
- package/__cjs/utilities/internal/getFragmentDefinitions.d.cts +8 -0
- package/__cjs/utilities/internal/getFragmentFromSelection.cjs +27 -0
- package/__cjs/utilities/internal/getFragmentFromSelection.cjs.map +1 -0
- package/__cjs/utilities/internal/getFragmentFromSelection.d.cts +10 -0
- package/__cjs/utilities/internal/getFragmentQueryDocument.cjs +86 -0
- package/__cjs/utilities/internal/getFragmentQueryDocument.cjs.map +1 -0
- package/__cjs/utilities/internal/getFragmentQueryDocument.d.cts +29 -0
- package/__cjs/utilities/internal/getGraphQLErrorsFromResult.cjs +12 -0
- package/__cjs/utilities/internal/getGraphQLErrorsFromResult.cjs.map +1 -0
- package/__cjs/utilities/internal/getGraphQLErrorsFromResult.d.cts +10 -0
- package/__cjs/utilities/internal/getMainDefinition.cjs +38 -0
- package/__cjs/utilities/internal/getMainDefinition.cjs.map +1 -0
- package/__cjs/utilities/internal/getMainDefinition.d.cts +12 -0
- package/__cjs/utilities/internal/getMemoryInternals.cjs +16 -9
- package/__cjs/utilities/internal/getMemoryInternals.cjs.map +1 -1
- package/__cjs/utilities/internal/getMemoryInternals.d.cts +15 -10
- package/__cjs/utilities/internal/getOperationDefinition.cjs +14 -0
- package/__cjs/utilities/internal/getOperationDefinition.cjs.map +1 -0
- package/__cjs/utilities/internal/getOperationDefinition.d.cts +8 -0
- package/__cjs/utilities/internal/getOperationName.cjs +12 -0
- package/__cjs/utilities/internal/getOperationName.cjs.map +1 -0
- package/__cjs/utilities/internal/getOperationName.d.cts +8 -0
- package/__cjs/utilities/internal/getQueryDefinition.cjs +16 -0
- package/__cjs/utilities/internal/getQueryDefinition.cjs.map +1 -0
- package/__cjs/utilities/internal/getQueryDefinition.d.cts +8 -0
- package/__cjs/utilities/internal/getStoreKeyName.cjs +73 -0
- package/__cjs/utilities/internal/getStoreKeyName.cjs.map +1 -0
- package/__cjs/utilities/internal/getStoreKeyName.d.cts +16 -0
- package/__cjs/utilities/internal/globals/global.cjs.map +1 -0
- package/__cjs/utilities/internal/globals/index.cjs.map +1 -0
- package/__cjs/utilities/internal/globals/maybe.cjs.map +1 -0
- package/__cjs/utilities/internal/graphQLResultHasError.cjs +12 -0
- package/__cjs/utilities/internal/graphQLResultHasError.cjs.map +1 -0
- package/__cjs/utilities/internal/graphQLResultHasError.d.cts +8 -0
- package/__cjs/utilities/internal/hasDirectives.cjs +24 -0
- package/__cjs/utilities/internal/hasDirectives.cjs.map +1 -0
- package/__cjs/utilities/internal/hasDirectives.d.cts +8 -0
- package/__cjs/utilities/internal/hasForcedResolvers.cjs +23 -0
- package/__cjs/utilities/internal/hasForcedResolvers.cjs.map +1 -0
- package/__cjs/utilities/internal/hasForcedResolvers.d.cts +3 -0
- package/__cjs/utilities/internal/index.cjs +97 -5
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +62 -2
- package/__cjs/utilities/internal/isArray.cjs +12 -0
- package/__cjs/utilities/internal/isArray.cjs.map +1 -0
- package/__cjs/utilities/internal/isArray.d.cts +9 -0
- package/__cjs/utilities/internal/isDocumentNode.cjs +15 -0
- package/__cjs/utilities/internal/isDocumentNode.cjs.map +1 -0
- package/__cjs/utilities/internal/isDocumentNode.d.cts +8 -0
- package/__cjs/utilities/internal/isField.cjs +12 -0
- package/__cjs/utilities/internal/isField.cjs.map +1 -0
- package/__cjs/utilities/internal/isField.d.cts +8 -0
- package/__cjs/utilities/internal/isNonEmptyArray.cjs +12 -0
- package/__cjs/utilities/internal/isNonEmptyArray.cjs.map +1 -0
- package/__cjs/utilities/internal/isNonEmptyArray.d.cts +7 -0
- package/__cjs/utilities/internal/isNonNullObject.cjs +12 -0
- package/__cjs/utilities/internal/isNonNullObject.cjs.map +1 -0
- package/__cjs/utilities/internal/isNonNullObject.d.cts +7 -0
- package/__cjs/utilities/internal/isPlainObject.cjs +15 -0
- package/__cjs/utilities/internal/isPlainObject.cjs.map +1 -0
- package/__cjs/utilities/internal/isPlainObject.d.cts +7 -0
- package/__cjs/utilities/internal/makeReference.cjs +12 -0
- package/__cjs/utilities/internal/makeReference.cjs.map +1 -0
- package/__cjs/utilities/internal/makeReference.d.cts +8 -0
- package/__cjs/utilities/internal/makeUniqueId.cjs +18 -0
- package/__cjs/utilities/internal/makeUniqueId.cjs.map +1 -0
- package/__cjs/utilities/internal/makeUniqueId.d.cts +10 -0
- package/__cjs/utilities/internal/maybeDeepFreeze.cjs +17 -0
- package/__cjs/utilities/internal/maybeDeepFreeze.cjs.map +1 -0
- package/__cjs/utilities/internal/maybeDeepFreeze.d.cts +7 -0
- package/__cjs/utilities/internal/mergeDeep.cjs +26 -0
- package/__cjs/utilities/internal/mergeDeep.cjs.map +1 -0
- package/__cjs/utilities/internal/mergeDeep.d.cts +8 -0
- package/__cjs/utilities/internal/mergeDeepArray.cjs +27 -0
- package/__cjs/utilities/internal/mergeDeepArray.cjs.map +1 -0
- package/__cjs/utilities/internal/mergeDeepArray.d.cts +7 -0
- package/__cjs/utilities/internal/mergeOptions.cjs +18 -0
- package/__cjs/utilities/internal/mergeOptions.cjs.map +1 -0
- package/__cjs/utilities/internal/mergeOptions.d.cts +10 -0
- package/__cjs/utilities/internal/omitDeep.cjs +48 -0
- package/__cjs/utilities/internal/omitDeep.cjs.map +1 -0
- package/__cjs/utilities/internal/omitDeep.d.cts +8 -0
- package/__cjs/utilities/internal/preventUnhandledRejection.cjs.map +1 -0
- package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs +306 -0
- package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs.map +1 -0
- package/__cjs/utilities/internal/removeDirectivesFromDocument.d.cts +14 -0
- package/__cjs/utilities/internal/resultKeyNameFromField.cjs +12 -0
- package/__cjs/utilities/internal/resultKeyNameFromField.cjs.map +1 -0
- package/__cjs/utilities/internal/resultKeyNameFromField.d.cts +8 -0
- package/__cjs/utilities/internal/shouldInclude.cjs +50 -0
- package/__cjs/utilities/internal/shouldInclude.cjs.map +1 -0
- package/__cjs/utilities/internal/shouldInclude.d.cts +8 -0
- package/__cjs/utilities/internal/storeKeyNameFromField.cjs +29 -0
- package/__cjs/utilities/internal/storeKeyNameFromField.cjs.map +1 -0
- package/__cjs/utilities/internal/storeKeyNameFromField.d.cts +8 -0
- package/__cjs/utilities/internal/stringifyForDisplay.cjs +18 -0
- package/__cjs/utilities/internal/stringifyForDisplay.cjs.map +1 -0
- package/__cjs/utilities/internal/stringifyForDisplay.d.cts +7 -0
- package/__cjs/utilities/internal/toQueryResult.cjs +5 -0
- package/__cjs/utilities/internal/toQueryResult.cjs.map +1 -1
- package/__cjs/utilities/internal/toQueryResult.d.cts +5 -0
- package/__cjs/utilities/internal/types/ApplyHKT.cjs +3 -0
- package/__cjs/utilities/internal/types/ApplyHKT.cjs.map +1 -0
- package/__cjs/utilities/internal/types/ApplyHKT.d.cts +13 -0
- package/__cjs/utilities/internal/types/ApplyHKTImplementationWithDefault.cjs +3 -0
- package/__cjs/utilities/internal/types/ApplyHKTImplementationWithDefault.cjs.map +1 -0
- package/__cjs/utilities/internal/types/ApplyHKTImplementationWithDefault.d.cts +11 -0
- package/__cjs/utilities/internal/types/DecoratedPromise.cjs +3 -0
- package/__cjs/utilities/internal/types/DecoratedPromise.cjs.map +1 -0
- package/__cjs/utilities/internal/types/DecoratedPromise.d.cts +10 -0
- package/__cjs/utilities/internal/types/DeepOmit.d.cts +15 -0
- package/__cjs/utilities/internal/types/FragmentMap.cjs +3 -0
- package/__cjs/utilities/internal/types/FragmentMap.cjs.map +1 -0
- package/__cjs/utilities/internal/types/FragmentMap.d.cts +12 -0
- package/__cjs/utilities/internal/types/FragmentMapFunction.cjs +3 -0
- package/__cjs/utilities/internal/types/FragmentMapFunction.cjs.map +1 -0
- package/__cjs/utilities/internal/types/FragmentMapFunction.d.cts +8 -0
- package/__cjs/utilities/internal/types/FulfilledPromise.cjs +3 -0
- package/__cjs/utilities/internal/types/FulfilledPromise.cjs.map +1 -0
- package/__cjs/utilities/internal/types/FulfilledPromise.d.cts +10 -0
- package/__cjs/utilities/internal/types/IsAny.cjs +3 -0
- package/__cjs/utilities/internal/types/IsAny.cjs.map +1 -0
- package/__cjs/utilities/internal/types/IsAny.d.cts +7 -0
- package/__cjs/utilities/internal/types/NoInfer.d.cts +29 -0
- package/__cjs/utilities/internal/types/PendingPromise.cjs +3 -0
- package/__cjs/utilities/internal/types/PendingPromise.cjs.map +1 -0
- package/__cjs/utilities/internal/types/PendingPromise.d.cts +9 -0
- package/__cjs/utilities/internal/types/Prettify.d.cts +9 -0
- package/__cjs/utilities/internal/types/Primitive.d.cts +7 -0
- package/__cjs/utilities/internal/types/RejectedPromise.cjs +3 -0
- package/__cjs/utilities/internal/types/RejectedPromise.cjs.map +1 -0
- package/__cjs/utilities/internal/types/RejectedPromise.d.cts +10 -0
- package/__cjs/utilities/internal/types/RemoveIndexSignature.d.cts +9 -0
- package/__cjs/utilities/internal/types/TupleToIntersection.cjs +3 -0
- package/__cjs/utilities/internal/types/TupleToIntersection.cjs.map +1 -0
- package/__cjs/utilities/internal/types/TupleToIntersection.d.cts +2 -0
- package/__cjs/utilities/internal/types/VariablesOption.cjs +3 -0
- package/__cjs/utilities/internal/types/VariablesOption.cjs.map +1 -0
- package/__cjs/utilities/internal/types/VariablesOption.d.cts +30 -0
- package/__cjs/utilities/internal/valueToObjectRepresentation.cjs +44 -0
- package/__cjs/utilities/internal/valueToObjectRepresentation.cjs.map +1 -0
- package/__cjs/utilities/internal/valueToObjectRepresentation.d.cts +8 -0
- package/__cjs/utilities/invariant/index.cjs +3 -2
- package/__cjs/utilities/invariant/index.cjs.map +1 -1
- package/__cjs/utilities/policies/pagination.cjs +26 -9
- package/__cjs/utilities/policies/pagination.cjs.map +1 -1
- package/__cjs/utilities/policies/pagination.d.cts +23 -0
- package/__cjs/utilities/shared/canonicalStringify.cjs +91 -0
- package/__cjs/utilities/shared/canonicalStringify.cjs.map +1 -0
- package/__cjs/utilities/subscriptions/relay/index.cjs +4 -4
- package/__cjs/utilities/subscriptions/relay/index.cjs.map +1 -1
- package/__cjs/version.cjs +3 -2
- package/__cjs/version.cjs.map +1 -1
- package/__cjs/version.d.cts +1 -0
- package/cache/core/cache.d.ts +11 -8
- package/cache/core/cache.js +11 -9
- package/cache/core/cache.js.map +1 -1
- package/cache/index.d.ts +1 -1
- package/cache/index.js +1 -1
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.js +5 -4
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fragmentRegistry.js +2 -1
- package/cache/inmemory/fragmentRegistry.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +3 -3
- package/cache/inmemory/helpers.js +2 -2
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +9 -7
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +3 -3
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/policies.d.ts +2 -1
- package/cache/inmemory/policies.js +7 -6
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.js +5 -4
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +2 -1
- package/cache/inmemory/writeToStore.js +34 -6
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts +29 -55
- package/core/ApolloClient.js +52 -77
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +292 -61
- package/core/ObservableQuery.js +796 -433
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +55 -30
- package/core/QueryInfo.js +267 -178
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +52 -62
- package/core/QueryManager.js +482 -575
- package/core/QueryManager.js.map +1 -1
- package/core/equalByQuery.js +1 -1
- package/core/equalByQuery.js.map +1 -1
- package/core/index.d.ts +10 -12
- package/core/index.js +5 -5
- package/core/index.js.map +1 -1
- package/core/networkStatus.d.ts +7 -1
- package/core/networkStatus.js +7 -1
- package/core/networkStatus.js.map +1 -1
- package/core/types.d.ts +137 -25
- package/core/watchQueryOptions.d.ts +17 -102
- package/dev/loadErrorMessageHandler.js +1 -1
- package/dev/loadErrorMessageHandler.js.map +1 -1
- package/dev/setErrorMessageHandler.js +1 -1
- package/dev/setErrorMessageHandler.js.map +1 -1
- package/errors/CombinedGraphQLErrors.d.ts +21 -2
- package/errors/CombinedGraphQLErrors.js +28 -13
- package/errors/CombinedGraphQLErrors.js.map +1 -1
- package/errors/CombinedProtocolErrors.d.ts +9 -0
- package/errors/CombinedProtocolErrors.js +13 -6
- package/errors/CombinedProtocolErrors.js.map +1 -1
- package/errors/LinkError.d.ts +18 -0
- package/errors/LinkError.js +20 -0
- package/errors/LinkError.js.map +1 -0
- package/errors/LocalStateError.d.ts +20 -0
- package/errors/LocalStateError.js +23 -0
- package/errors/LocalStateError.js.map +1 -0
- package/errors/ServerError.d.ts +10 -8
- package/errors/ServerError.js +9 -4
- package/errors/ServerError.js.map +1 -1
- package/errors/ServerParseError.d.ts +2 -0
- package/errors/ServerParseError.js +6 -0
- package/errors/ServerParseError.js.map +1 -1
- package/errors/UnconventionalError.d.ts +2 -0
- package/errors/UnconventionalError.js +6 -0
- package/errors/UnconventionalError.js.map +1 -1
- package/errors/index.d.ts +5 -8
- package/errors/index.js +6 -10
- package/errors/index.js.map +1 -1
- package/errors/isErrorLike.d.ts +3 -0
- package/errors/isErrorLike.js +9 -0
- package/errors/isErrorLike.js.map +1 -0
- package/errors/utils.d.ts +3 -0
- package/errors/utils.js +14 -0
- package/errors/utils.js.map +1 -0
- package/incremental/handlers/defer20220824.d.ts +55 -0
- package/incremental/handlers/defer20220824.js +97 -0
- package/incremental/handlers/defer20220824.js.map +1 -0
- package/incremental/handlers/notImplemented.d.ts +9 -0
- package/incremental/handlers/notImplemented.js +15 -0
- package/incremental/handlers/notImplemented.js.map +1 -0
- package/incremental/index.d.ts +4 -0
- package/incremental/index.js +3 -0
- package/incremental/index.js.map +1 -0
- package/incremental/types.d.ts +24 -0
- package/incremental/types.js +2 -0
- package/incremental/types.js.map +1 -0
- package/invariantErrorCodes.js +276 -176
- package/legacyEntryPoints/incremental/incremental.cjs +1 -0
- package/legacyEntryPoints/incremental/incremental.d.cts +1 -0
- package/legacyEntryPoints/incremental/index.d.ts +1 -0
- package/legacyEntryPoints/incremental/index.js +1 -0
- package/legacyEntryPoints/link/client-awareness/client-awareness.cjs +1 -0
- package/legacyEntryPoints/link/client-awareness/client-awareness.d.cts +1 -0
- package/legacyEntryPoints/link/client-awareness/index.d.ts +1 -0
- package/legacyEntryPoints/link/client-awareness/index.js +1 -0
- package/legacyEntryPoints/link/index.d.ts +1 -0
- package/legacyEntryPoints/link/index.js +1 -0
- package/legacyEntryPoints/link/link.cjs +1 -0
- package/legacyEntryPoints/link/link.d.cts +1 -0
- package/legacyEntryPoints/local-state/index.d.ts +1 -0
- package/legacyEntryPoints/local-state/index.js +1 -0
- package/legacyEntryPoints/local-state/local-state.cjs +1 -0
- package/legacyEntryPoints/local-state/local-state.d.cts +1 -0
- package/legacyEntryPoints/utilities/internal/globals/globals.cjs +1 -0
- package/legacyEntryPoints/utilities/internal/globals/globals.d.cts +1 -0
- package/legacyEntryPoints/utilities/internal/globals/index.d.ts +1 -0
- package/legacyEntryPoints/utilities/internal/globals/index.js +1 -0
- package/link/batch/batchLink.d.ts +2 -2
- package/link/batch/batchLink.js +1 -1
- package/link/batch/batchLink.js.map +1 -1
- package/link/batch/batching.d.ts +1 -1
- package/link/batch/batching.js.map +1 -1
- package/link/batch-http/batchHttpLink.d.ts +9 -4
- package/link/batch-http/batchHttpLink.js +15 -62
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/batch-http/index.d.ts +1 -1
- package/link/batch-http/index.js +1 -1
- package/link/batch-http/index.js.map +1 -1
- package/link/client-awareness/ClientAwarenessLink.d.ts +62 -0
- package/link/client-awareness/ClientAwarenessLink.js +41 -0
- package/link/client-awareness/ClientAwarenessLink.js.map +1 -0
- package/link/client-awareness/index.d.ts +2 -0
- package/link/client-awareness/index.js +2 -0
- package/link/client-awareness/index.js.map +1 -0
- package/link/context/index.d.ts +11 -5
- package/link/context/index.js +35 -26
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.d.ts +17 -11
- package/link/core/ApolloLink.js +19 -13
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/types.d.ts +14 -36
- package/link/error/index.d.ts +17 -16
- package/link/error/index.js +69 -66
- package/link/error/index.js.map +1 -1
- package/link/http/BaseHttpLink.d.ts +6 -0
- package/link/http/BaseHttpLink.js +107 -0
- package/link/http/BaseHttpLink.js.map +1 -0
- package/link/http/HttpLink.d.ts +145 -4
- package/link/http/HttpLink.js +11 -5
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/checkFetcher.js +1 -1
- package/link/http/index.d.ts +2 -3
- package/link/http/index.js +2 -2
- package/link/http/index.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.d.ts +1 -3
- package/link/http/parseAndCheckHttpResponse.js +74 -112
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/rewriteURIForGET.d.ts +2 -2
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +8 -83
- package/link/http/selectHttpOptionsAndBody.js +7 -6
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/selectURI.d.ts +1 -1
- package/link/http/selectURI.js.map +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/index.d.ts +8 -0
- package/link/index.js +7 -0
- package/link/index.js.map +1 -0
- package/link/persisted-queries/index.d.ts +21 -21
- package/link/persisted-queries/index.js +159 -140
- package/link/persisted-queries/index.js.map +1 -1
- package/link/remove-typename/index.d.ts +1 -1
- package/link/remove-typename/index.js +1 -1
- package/link/remove-typename/index.js.map +1 -1
- package/link/remove-typename/removeTypenameFromVariables.d.ts +9 -10
- package/link/remove-typename/removeTypenameFromVariables.js +35 -24
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
- package/link/retry/delayFunction.d.ts +1 -1
- package/link/retry/delayFunction.js.map +1 -1
- package/link/retry/retryFunction.d.ts +1 -1
- package/link/retry/retryFunction.js.map +1 -1
- package/link/retry/retryLink.d.ts +2 -2
- package/link/retry/retryLink.js +1 -1
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +2 -2
- package/link/schema/index.js +1 -1
- package/link/schema/index.js.map +1 -1
- package/link/subscriptions/index.d.ts +2 -2
- package/link/subscriptions/index.js +2 -2
- package/link/subscriptions/index.js.map +1 -1
- package/link/utils/createOperation.d.ts +2 -2
- package/link/utils/createOperation.js +5 -1
- package/link/utils/createOperation.js.map +1 -1
- package/link/utils/transformOperation.d.ts +1 -1
- package/link/utils/transformOperation.js +2 -2
- package/link/utils/transformOperation.js.map +1 -1
- package/link/utils/validateOperation.d.ts +1 -1
- package/link/utils/validateOperation.js +1 -1
- package/link/utils/validateOperation.js.map +1 -1
- package/link/ws/index.d.ts +2 -2
- package/link/ws/index.js +1 -1
- package/link/ws/index.js.map +1 -1
- package/local-state/LocalState.d.ts +88 -0
- package/local-state/LocalState.js +519 -0
- package/local-state/LocalState.js.map +1 -0
- package/local-state/index.d.ts +2 -0
- package/local-state/index.js +2 -0
- package/local-state/index.js.map +1 -0
- package/masking/GraphQLCodegenDataMasking.d.ts +79 -0
- package/masking/GraphQLCodegenDataMasking.js +2 -0
- package/masking/GraphQLCodegenDataMasking.js.map +1 -0
- package/masking/index.d.ts +1 -0
- package/masking/index.js.map +1 -1
- package/masking/internal/types.d.ts +1 -2
- package/masking/maskDefinition.d.ts +1 -1
- package/masking/maskDefinition.js +4 -4
- package/masking/maskDefinition.js.map +1 -1
- package/masking/maskFragment.d.ts +5 -1
- package/masking/maskFragment.js +8 -12
- package/masking/maskFragment.js.map +1 -1
- package/masking/maskOperation.d.ts +5 -1
- package/masking/maskOperation.js +7 -11
- package/masking/maskOperation.js.map +1 -1
- package/masking/types.d.ts +12 -26
- package/masking/utils.d.ts +7 -2
- package/masking/utils.js +31 -7
- package/masking/utils.js.map +1 -1
- package/package.json +38 -185
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloContext.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/hooks/internal/__use.js +6 -6
- package/react/hooks/internal/__use.js.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.js +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -1
- package/react/hooks/internal/validateSuspenseHookOptions.d.ts +3 -0
- package/react/hooks/internal/validateSuspenseHookOptions.js +22 -0
- package/react/hooks/internal/validateSuspenseHookOptions.js.map +1 -0
- package/react/hooks/internal/wrapHook.d.ts +42 -38
- package/react/hooks/internal/wrapHook.js +36 -34
- package/react/hooks/internal/wrapHook.js.map +1 -1
- package/react/hooks/useApolloClient.js +15 -2
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useBackgroundQuery.d.ts +59 -28
- package/react/hooks/useBackgroundQuery.js +9 -8
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.d.ts +2 -1
- package/react/hooks/useFragment.js +12 -11
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +56 -81
- package/react/hooks/useLazyQuery.js +40 -41
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.d.ts +8 -10
- package/react/hooks/useLoadableQuery.js +232 -53
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +48 -15
- package/react/hooks/useMutation.js +192 -82
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +20 -72
- package/react/hooks/useQuery.js +253 -94
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useQueryRefHandlers.d.ts +2 -2
- package/react/hooks/useQueryRefHandlers.js +64 -23
- package/react/hooks/useQueryRefHandlers.js.map +1 -1
- package/react/hooks/useReadQuery.d.ts +4 -11
- package/react/hooks/useReadQuery.js +4 -2
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +6 -8
- package/react/hooks/useSubscription.js +16 -21
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseFragment.d.ts +1 -2
- package/react/hooks/useSuspenseFragment.js +1 -0
- package/react/hooks/useSuspenseFragment.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +19 -36
- package/react/hooks/useSuspenseQuery.js +63 -54
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +21 -2
- package/react/hooks/useSyncExternalStore.js.map +1 -1
- package/react/index.d.ts +2 -1
- package/react/index.js +1 -0
- package/react/index.js.map +1 -1
- package/react/internal/cache/FragmentReference.d.ts +2 -2
- package/react/internal/cache/FragmentReference.js +6 -3
- package/react/internal/cache/FragmentReference.js.map +1 -1
- package/react/internal/cache/QueryReference.d.ts +48 -108
- package/react/internal/cache/QueryReference.js +24 -35
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/internal/cache/SuspenseCache.d.ts +3 -3
- package/react/internal/cache/SuspenseCache.js.map +1 -1
- package/react/internal/index.d.ts +2 -2
- package/react/internal/index.js.map +1 -1
- package/react/internal/types.d.ts +3 -45
- package/react/query-preloader/createQueryPreloader.d.ts +46 -38
- package/react/query-preloader/createQueryPreloader.js +10 -3
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/ssr/prerenderStatic.js +9 -2
- package/react/ssr/prerenderStatic.js.map +1 -1
- package/react/ssr/useSSRQuery.js +12 -2
- package/react/ssr/useSSRQuery.js.map +1 -1
- package/react/types/deprecated.d.ts +3 -3
- package/react/types/types.documentation.d.ts +14 -2
- package/testing/core/mocking/mockLink.d.ts +31 -24
- package/testing/core/mocking/mockLink.js +15 -15
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +9 -8
- package/testing/core/mocking/mockSubscriptionLink.js +1 -4
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
- package/testing/core/types/deprecated.d.ts +10 -0
- package/testing/core/types/deprecated.js +2 -0
- package/testing/core/types/deprecated.js.map +1 -0
- package/testing/index.d.ts +3 -2
- package/testing/index.js +2 -1
- package/testing/index.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +5 -6
- package/testing/react/MockedProvider.js +3 -3
- package/testing/react/MockedProvider.js.map +1 -1
- package/utilities/DeepPartial.d.ts +15 -0
- package/utilities/DeepPartial.js.map +1 -0
- package/utilities/HKT.d.ts +35 -0
- package/utilities/HKT.js +2 -0
- package/utilities/HKT.js.map +1 -0
- package/utilities/caching/index.d.ts +0 -1
- package/utilities/caching/index.js +0 -1
- package/utilities/caching/index.js.map +1 -1
- package/utilities/caching/sizes.d.ts +6 -0
- package/utilities/caching/sizes.js +1 -1
- package/utilities/caching/sizes.js.map +1 -1
- package/utilities/common/stripTypename.d.ts +7 -1
- package/utilities/common/stripTypename.js +7 -1
- package/utilities/common/stripTypename.js.map +1 -1
- package/utilities/graphql/DocumentTransform.d.ts +10 -6
- package/utilities/graphql/DocumentTransform.js +12 -8
- package/utilities/graphql/DocumentTransform.js.map +1 -1
- package/utilities/graphql/isFormattedExecutionResult.d.ts +3 -0
- package/utilities/graphql/isFormattedExecutionResult.js +6 -0
- package/utilities/graphql/isFormattedExecutionResult.js.map +1 -0
- package/utilities/graphql/operations.d.ts +21 -0
- package/utilities/graphql/operations.js +22 -1
- package/utilities/graphql/operations.js.map +1 -1
- package/utilities/graphql/print.d.ts +8 -0
- package/utilities/graphql/print.js +10 -2
- package/utilities/graphql/print.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts +14 -22
- package/utilities/graphql/storeUtils.js +5 -196
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.d.ts +6 -24
- package/utilities/graphql/transform.js +7 -443
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +8 -38
- package/utilities/index.js +5 -23
- package/utilities/index.js.map +1 -1
- package/utilities/internal/DeepMerger.d.ts +17 -0
- package/utilities/internal/DeepMerger.js +63 -0
- package/utilities/internal/DeepMerger.js.map +1 -0
- package/utilities/internal/argumentsObjectFromField.d.ts +8 -0
- package/utilities/internal/argumentsObjectFromField.js +15 -0
- package/utilities/internal/argumentsObjectFromField.js.map +1 -0
- package/utilities/internal/caches.d.ts +42 -0
- package/utilities/internal/caches.js +73 -0
- package/utilities/internal/caches.js.map +1 -0
- package/utilities/internal/canUseDOM.d.ts +7 -0
- package/utilities/internal/canUseDOM.js +8 -0
- package/utilities/internal/canUseDOM.js.map +1 -0
- package/utilities/internal/checkDocument.d.ts +10 -0
- package/utilities/internal/checkDocument.js +66 -0
- package/utilities/internal/checkDocument.js.map +1 -0
- package/utilities/internal/cloneDeep.d.ts +9 -0
- package/utilities/internal/cloneDeep.js +42 -0
- package/utilities/internal/cloneDeep.js.map +1 -0
- package/utilities/internal/compact.d.ts +11 -0
- package/utilities/internal/compact.js +23 -0
- package/utilities/internal/compact.js.map +1 -0
- package/utilities/internal/createFragmentMap.d.ts +12 -0
- package/utilities/internal/createFragmentMap.js +16 -0
- package/utilities/internal/createFragmentMap.js.map +1 -0
- package/utilities/internal/createFulfilledPromise.d.ts +8 -0
- package/utilities/internal/createFulfilledPromise.js +12 -0
- package/utilities/internal/createFulfilledPromise.js.map +1 -0
- package/utilities/internal/createRejectedPromise.d.ts +8 -0
- package/utilities/internal/createRejectedPromise.js +14 -0
- package/utilities/internal/createRejectedPromise.js.map +1 -0
- package/utilities/internal/dealias.d.ts +5 -0
- package/utilities/internal/dealias.js +18 -0
- package/utilities/internal/dealias.js.map +1 -0
- package/utilities/internal/decoratePromise.d.ts +8 -0
- package/utilities/internal/decoratePromise.js +30 -0
- package/utilities/internal/decoratePromise.js.map +1 -0
- package/utilities/internal/deepFreeze.d.ts +7 -0
- package/utilities/internal/deepFreeze.js +36 -0
- package/utilities/internal/deepFreeze.js.map +1 -0
- package/utilities/internal/filterMap.d.ts +4 -0
- package/utilities/internal/filterMap.js +28 -0
- package/utilities/internal/filterMap.js.map +1 -0
- package/utilities/internal/getDefaultValues.d.ts +8 -0
- package/utilities/internal/getDefaultValues.js +19 -0
- package/utilities/internal/getDefaultValues.js.map +1 -0
- package/utilities/internal/getFragmentDefinition.d.ts +8 -0
- package/utilities/internal/getFragmentDefinition.js +14 -0
- package/utilities/internal/getFragmentDefinition.js.map +1 -0
- package/utilities/internal/getFragmentDefinitions.d.ts +8 -0
- package/utilities/internal/getFragmentDefinitions.js +9 -0
- package/utilities/internal/getFragmentDefinitions.js.map +1 -0
- package/utilities/internal/getFragmentFromSelection.d.ts +10 -0
- package/utilities/internal/getFragmentFromSelection.js +24 -0
- package/utilities/internal/getFragmentFromSelection.js.map +1 -0
- package/utilities/internal/getFragmentQueryDocument.d.ts +29 -0
- package/utilities/internal/getFragmentQueryDocument.js +83 -0
- package/utilities/internal/getFragmentQueryDocument.js.map +1 -0
- package/utilities/internal/getGraphQLErrorsFromResult.d.ts +10 -0
- package/utilities/internal/getGraphQLErrorsFromResult.js +9 -0
- package/utilities/internal/getGraphQLErrorsFromResult.js.map +1 -0
- package/utilities/internal/getMainDefinition.d.ts +12 -0
- package/utilities/internal/getMainDefinition.js +35 -0
- package/utilities/internal/getMainDefinition.js.map +1 -0
- package/utilities/internal/getMemoryInternals.d.ts +15 -10
- package/utilities/internal/getMemoryInternals.js +16 -9
- package/utilities/internal/getMemoryInternals.js.map +1 -1
- package/utilities/internal/getOperationDefinition.d.ts +8 -0
- package/utilities/internal/getOperationDefinition.js +11 -0
- package/utilities/internal/getOperationDefinition.js.map +1 -0
- package/utilities/internal/getOperationName.d.ts +8 -0
- package/utilities/internal/getOperationName.js +9 -0
- package/utilities/internal/getOperationName.js.map +1 -0
- package/utilities/internal/getQueryDefinition.d.ts +8 -0
- package/utilities/internal/getQueryDefinition.js +13 -0
- package/utilities/internal/getQueryDefinition.js.map +1 -0
- package/utilities/internal/getStoreKeyName.d.ts +16 -0
- package/utilities/internal/getStoreKeyName.js +70 -0
- package/utilities/internal/getStoreKeyName.js.map +1 -0
- package/utilities/internal/globals/global.js +14 -0
- package/utilities/internal/globals/global.js.map +1 -0
- package/utilities/internal/globals/index.js.map +1 -0
- package/utilities/internal/globals/maybe.js.map +1 -0
- package/utilities/internal/graphQLResultHasError.d.ts +8 -0
- package/utilities/internal/graphQLResultHasError.js +9 -0
- package/utilities/internal/graphQLResultHasError.js.map +1 -0
- package/utilities/internal/hasDirectives.d.ts +8 -0
- package/utilities/internal/hasDirectives.js +21 -0
- package/utilities/internal/hasDirectives.js.map +1 -0
- package/utilities/internal/hasForcedResolvers.d.ts +3 -0
- package/utilities/internal/hasForcedResolvers.js +20 -0
- package/utilities/internal/hasForcedResolvers.js.map +1 -0
- package/utilities/internal/index.d.ts +62 -2
- package/utilities/internal/index.js +47 -2
- package/utilities/internal/index.js.map +1 -1
- package/utilities/internal/isArray.d.ts +9 -0
- package/utilities/internal/isArray.js +9 -0
- package/utilities/internal/isArray.js.map +1 -0
- package/utilities/internal/isDocumentNode.d.ts +8 -0
- package/utilities/internal/isDocumentNode.js +12 -0
- package/utilities/internal/isDocumentNode.js.map +1 -0
- package/utilities/internal/isField.d.ts +8 -0
- package/utilities/internal/isField.js +9 -0
- package/utilities/internal/isField.js.map +1 -0
- package/utilities/internal/isNonEmptyArray.d.ts +7 -0
- package/utilities/internal/isNonEmptyArray.js +9 -0
- package/utilities/internal/isNonEmptyArray.js.map +1 -0
- package/utilities/internal/isNonNullObject.d.ts +7 -0
- package/utilities/internal/isNonNullObject.js +9 -0
- package/utilities/internal/isNonNullObject.js.map +1 -0
- package/utilities/internal/isPlainObject.d.ts +7 -0
- package/utilities/internal/isPlainObject.js +12 -0
- package/utilities/internal/isPlainObject.js.map +1 -0
- package/utilities/internal/makeReference.d.ts +8 -0
- package/utilities/internal/makeReference.js +9 -0
- package/utilities/internal/makeReference.js.map +1 -0
- package/utilities/internal/makeUniqueId.d.ts +10 -0
- package/utilities/internal/makeUniqueId.js +15 -0
- package/utilities/internal/makeUniqueId.js.map +1 -0
- package/utilities/internal/maybeDeepFreeze.d.ts +7 -0
- package/utilities/internal/maybeDeepFreeze.js +14 -0
- package/utilities/internal/maybeDeepFreeze.js.map +1 -0
- package/utilities/internal/mergeDeep.d.ts +8 -0
- package/utilities/internal/mergeDeep.js +23 -0
- package/utilities/internal/mergeDeep.js.map +1 -0
- package/utilities/internal/mergeDeepArray.d.ts +7 -0
- package/utilities/internal/mergeDeepArray.js +24 -0
- package/utilities/internal/mergeDeepArray.js.map +1 -0
- package/utilities/internal/mergeOptions.d.ts +10 -0
- package/utilities/internal/mergeOptions.js +15 -0
- package/utilities/internal/mergeOptions.js.map +1 -0
- package/utilities/internal/omitDeep.d.ts +8 -0
- package/utilities/internal/omitDeep.js +45 -0
- package/utilities/internal/omitDeep.js.map +1 -0
- package/utilities/internal/preventUnhandledRejection.js.map +1 -0
- package/utilities/internal/removeDirectivesFromDocument.d.ts +14 -0
- package/utilities/internal/removeDirectivesFromDocument.js +300 -0
- package/utilities/internal/removeDirectivesFromDocument.js.map +1 -0
- package/utilities/internal/resultKeyNameFromField.d.ts +8 -0
- package/utilities/internal/resultKeyNameFromField.js +9 -0
- package/utilities/internal/resultKeyNameFromField.js.map +1 -0
- package/utilities/internal/shouldInclude.d.ts +8 -0
- package/utilities/internal/shouldInclude.js +47 -0
- package/utilities/internal/shouldInclude.js.map +1 -0
- package/utilities/internal/storeKeyNameFromField.d.ts +8 -0
- package/utilities/internal/storeKeyNameFromField.js +26 -0
- package/utilities/internal/storeKeyNameFromField.js.map +1 -0
- package/utilities/internal/stringifyForDisplay.d.ts +7 -0
- package/utilities/internal/stringifyForDisplay.js +15 -0
- package/utilities/internal/stringifyForDisplay.js.map +1 -0
- package/utilities/internal/toQueryResult.d.ts +5 -0
- package/utilities/internal/toQueryResult.js +5 -0
- package/utilities/internal/toQueryResult.js.map +1 -1
- package/utilities/internal/types/ApplyHKT.d.ts +13 -0
- package/utilities/internal/types/ApplyHKT.js +2 -0
- package/utilities/internal/types/ApplyHKT.js.map +1 -0
- package/utilities/internal/types/ApplyHKTImplementationWithDefault.d.ts +11 -0
- package/utilities/internal/types/ApplyHKTImplementationWithDefault.js +2 -0
- package/utilities/internal/types/ApplyHKTImplementationWithDefault.js.map +1 -0
- package/utilities/internal/types/DecoratedPromise.d.ts +10 -0
- package/utilities/internal/types/DecoratedPromise.js +2 -0
- package/utilities/internal/types/DecoratedPromise.js.map +1 -0
- package/utilities/internal/types/DeepOmit.d.ts +15 -0
- package/utilities/internal/types/FragmentMap.d.ts +12 -0
- package/utilities/internal/types/FragmentMap.js +2 -0
- package/utilities/internal/types/FragmentMap.js.map +1 -0
- package/utilities/internal/types/FragmentMapFunction.d.ts +8 -0
- package/utilities/internal/types/FragmentMapFunction.js +2 -0
- package/utilities/internal/types/FragmentMapFunction.js.map +1 -0
- package/utilities/internal/types/FulfilledPromise.d.ts +10 -0
- package/utilities/internal/types/FulfilledPromise.js +2 -0
- package/utilities/internal/types/FulfilledPromise.js.map +1 -0
- package/utilities/internal/types/IsAny.d.ts +7 -0
- package/utilities/internal/types/IsAny.js +2 -0
- package/utilities/internal/types/IsAny.js.map +1 -0
- package/utilities/internal/types/NoInfer.d.ts +29 -0
- package/utilities/internal/types/PendingPromise.d.ts +9 -0
- package/utilities/internal/types/PendingPromise.js +2 -0
- package/utilities/internal/types/PendingPromise.js.map +1 -0
- package/utilities/internal/types/Prettify.d.ts +9 -0
- package/utilities/internal/types/Primitive.d.ts +7 -0
- package/utilities/internal/types/RejectedPromise.d.ts +10 -0
- package/utilities/internal/types/RejectedPromise.js +2 -0
- package/utilities/internal/types/RejectedPromise.js.map +1 -0
- package/utilities/internal/types/RemoveIndexSignature.d.ts +9 -0
- package/utilities/internal/types/TupleToIntersection.d.ts +2 -0
- package/utilities/internal/types/TupleToIntersection.js +2 -0
- package/utilities/internal/types/TupleToIntersection.js.map +1 -0
- package/utilities/internal/types/VariablesOption.d.ts +30 -0
- package/utilities/internal/types/VariablesOption.js +2 -0
- package/utilities/internal/types/VariablesOption.js.map +1 -0
- package/utilities/internal/valueToObjectRepresentation.d.ts +8 -0
- package/utilities/internal/valueToObjectRepresentation.js +41 -0
- package/utilities/internal/valueToObjectRepresentation.js.map +1 -0
- package/utilities/invariant/index.js +3 -2
- package/utilities/invariant/index.js.map +1 -1
- package/utilities/policies/pagination.d.ts +23 -0
- package/utilities/policies/pagination.js +24 -7
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/shared/canonicalStringify.js +88 -0
- package/utilities/shared/canonicalStringify.js.map +1 -0
- package/utilities/subscriptions/relay/index.js +3 -3
- package/utilities/subscriptions/relay/index.js.map +1 -1
- package/version.d.ts +1 -0
- package/version.js +2 -1
- package/version.js.map +1 -1
- package/.changeset/README.md +0 -8
- package/.changeset/afraid-moons-arrive.md +0 -5
- package/.changeset/beige-mirrors-talk.md +0 -15
- package/.changeset/brave-radios-wait.md +0 -5
- package/.changeset/bright-ads-share.md +0 -5
- package/.changeset/calm-frogs-remain.md +0 -7
- package/.changeset/calm-seals-relate.md +0 -5
- package/.changeset/chatty-planes-grin.md +0 -5
- package/.changeset/clean-sheep-hide.md +0 -6
- package/.changeset/clever-zebras-mate.md +0 -5
- package/.changeset/config.json +0 -14
- package/.changeset/cool-bikes-shake.md +0 -12
- package/.changeset/cuddly-spiders-tie.md +0 -5
- package/.changeset/curvy-pianos-count.md +0 -5
- package/.changeset/dirty-eagles-poke.md +0 -5
- package/.changeset/dirty-trees-pump.md +0 -5
- package/.changeset/early-eggs-develop.md +0 -22
- package/.changeset/eighty-squids-fix.md +0 -15
- package/.changeset/eleven-kangaroos-jump.md +0 -5
- package/.changeset/empty-rabbits-move.md +0 -5
- package/.changeset/fluffy-shoes-applaud.md +0 -5
- package/.changeset/forty-hairs-occur.md +0 -5
- package/.changeset/forty-shrimps-fry.md +0 -5
- package/.changeset/four-ghosts-watch.md +0 -5
- package/.changeset/fresh-moose-hope.md +0 -5
- package/.changeset/funny-jeans-invent.md +0 -16
- package/.changeset/giant-apes-thank.md +0 -5
- package/.changeset/giant-bags-share.md +0 -5
- package/.changeset/good-dolphins-peel.md +0 -113
- package/.changeset/gorgeous-chefs-tap.md +0 -5
- package/.changeset/grumpy-vans-type.md +0 -5
- package/.changeset/healthy-apes-sneeze.md +0 -5
- package/.changeset/hip-vans-act.md +0 -5
- package/.changeset/hot-cycles-notice.md +0 -5
- package/.changeset/itchy-drinks-refuse.md +0 -5
- package/.changeset/itchy-roses-accept.md +0 -5
- package/.changeset/khaki-spies-work.md +0 -11
- package/.changeset/kind-fishes-develop.md +0 -17
- package/.changeset/late-trainers-peel.md +0 -7
- package/.changeset/light-apes-rescue.md +0 -5
- package/.changeset/light-dolphins-taste.md +0 -5
- package/.changeset/light-sloths-end.md +0 -16
- package/.changeset/little-spoons-kick.md +0 -7
- package/.changeset/loud-cows-raise.md +0 -7
- package/.changeset/lucky-hats-push.md +0 -7
- package/.changeset/many-buses-allow.md +0 -5
- package/.changeset/many-papayas-hide.md +0 -5
- package/.changeset/metal-needles-search.md +0 -5
- package/.changeset/mighty-penguins-wink.md +0 -16
- package/.changeset/modern-feet-do.md +0 -5
- package/.changeset/moody-lobsters-listen.md +0 -7
- package/.changeset/nervous-fireants-bow.md +0 -5
- package/.changeset/nervous-goats-allow.md +0 -5
- package/.changeset/nice-donkeys-reflect.md +0 -5
- package/.changeset/nice-dots-matter.md +0 -5
- package/.changeset/nice-waves-work.md +0 -7
- package/.changeset/ninety-bags-bake.md +0 -17
- package/.changeset/odd-lemons-relax.md +0 -5
- package/.changeset/perfect-vans-give.md +0 -7
- package/.changeset/polite-bees-care.md +0 -26
- package/.changeset/poor-eels-punch.md +0 -5
- package/.changeset/popular-games-sleep.md +0 -5
- package/.changeset/pre.json +0 -115
- package/.changeset/purple-bears-flash.md +0 -5
- package/.changeset/purple-lions-cough.md +0 -5
- package/.changeset/rare-houses-prove.md +0 -5
- package/.changeset/real-gorillas-move.md +0 -21
- package/.changeset/real-teachers-peel.md +0 -5
- package/.changeset/rich-eagles-cross.md +0 -5
- package/.changeset/rich-kids-carry.md +0 -9
- package/.changeset/rude-fans-study.md +0 -5
- package/.changeset/seven-foxes-melt.md +0 -5
- package/.changeset/shaggy-pugs-add.md +0 -52
- package/.changeset/shiny-carrots-invent.md +0 -5
- package/.changeset/short-jokes-jam.md +0 -27
- package/.changeset/short-months-complain.md +0 -5
- package/.changeset/silly-knives-exist.md +0 -5
- package/.changeset/slimy-chicken-melt.md +0 -5
- package/.changeset/slimy-maps-press.md +0 -5
- package/.changeset/slow-ravens-explain.md +0 -19
- package/.changeset/small-buttons-rhyme.md +0 -5
- package/.changeset/small-cycles-rescue.md +0 -5
- package/.changeset/small-kids-film.md +0 -14
- package/.changeset/smart-rats-explode.md +0 -5
- package/.changeset/smooth-coins-collect.md +0 -5
- package/.changeset/smooth-pens-reply.md +0 -7
- package/.changeset/soft-mails-clean.md +0 -5
- package/.changeset/sour-pillows-guess.md +0 -7
- package/.changeset/strange-seahorses-impress.md +0 -17
- package/.changeset/swift-rivers-share.md +0 -13
- package/.changeset/tall-bikes-develop.md +0 -5
- package/.changeset/tall-cups-suffer.md +0 -13
- package/.changeset/tame-doors-shop.md +0 -14
- package/.changeset/tame-points-work.md +0 -11
- package/.changeset/tender-swans-flash.md +0 -16
- package/.changeset/thick-books-grin.md +0 -5
- package/.changeset/tidy-squids-poke.md +0 -12
- package/.changeset/tough-rockets-allow.md +0 -5
- package/.changeset/tough-taxis-smoke.md +0 -7
- package/.changeset/tough-tips-drop.md +0 -15
- package/.changeset/tricky-tables-shave.md +0 -5
- package/.changeset/twenty-snakes-sort.md +0 -7
- package/.changeset/unlucky-kiwis-sell.md +0 -5
- package/.changeset/unlucky-sheep-change.md +0 -5
- package/.changeset/warm-ties-sit.md +0 -7
- package/.changeset/wicked-forks-double.md +0 -33
- package/.changeset/yellow-cats-judge.md +0 -13
- package/.changeset/young-phones-fold.md +0 -5
- package/.changeset/young-turtles-explode.md +0 -5
- package/__cjs/config/jest/areCombinedGraphQLErrorsEqual.cjs +0 -20
- package/__cjs/config/jest/areCombinedGraphQLErrorsEqual.cjs.map +0 -1
- package/__cjs/config/jest/areCombinedGraphQLErrorsEqual.d.cts +0 -3
- package/__cjs/config/jest/areCombinedProtocolErrorsEqual.cjs +0 -18
- package/__cjs/config/jest/areCombinedProtocolErrorsEqual.cjs.map +0 -1
- package/__cjs/config/jest/areCombinedProtocolErrorsEqual.d.cts +0 -3
- package/__cjs/config/jest/areGraphQlErrorsEqual.cjs +0 -11
- package/__cjs/config/jest/areGraphQlErrorsEqual.cjs.map +0 -1
- package/__cjs/config/jest/areGraphQlErrorsEqual.d.cts +0 -3
- package/__cjs/config/jest/areMissingFieldErrorsEqual.cjs +0 -20
- package/__cjs/config/jest/areMissingFieldErrorsEqual.cjs.map +0 -1
- package/__cjs/config/jest/areMissingFieldErrorsEqual.d.cts +0 -3
- package/__cjs/config/jest/areServerErrorsEqual.cjs +0 -21
- package/__cjs/config/jest/areServerErrorsEqual.cjs.map +0 -1
- package/__cjs/config/jest/areServerErrorsEqual.d.cts +0 -3
- package/__cjs/config/jest/resolver.cjs +0 -32
- package/__cjs/config/jest/resolver.cjs.map +0 -1
- package/__cjs/config/jest/resolver.d.cts +0 -3
- package/__cjs/config/jest/setup.cjs +0 -65
- package/__cjs/config/jest/setup.cjs.map +0 -1
- package/__cjs/config/jest/setup.d.cts +0 -3
- package/__cjs/core/LocalState.cjs +0 -333
- package/__cjs/core/LocalState.cjs.map +0 -1
- package/__cjs/core/LocalState.d.cts +0 -53
- package/__cjs/link/core/index.cjs +0 -16
- package/__cjs/link/core/index.cjs.map +0 -1
- package/__cjs/link/core/index.d.cts +0 -8
- package/__cjs/link/http/createHttpLink.cjs +0 -158
- package/__cjs/link/http/createHttpLink.cjs.map +0 -1
- package/__cjs/link/http/createHttpLink.d.cts +0 -4
- package/__cjs/masking/__benches__/types.bench.cjs +0 -223
- package/__cjs/masking/__benches__/types.bench.cjs.map +0 -1
- package/__cjs/masking/__benches__/types.bench.d.cts +0 -2
- package/__cjs/testing/core/index.cjs +0 -20
- package/__cjs/testing/core/index.cjs.map +0 -1
- package/__cjs/testing/core/index.d.cts +0 -7
- package/__cjs/testing/core/mocking/mockClient.cjs +0 -17
- package/__cjs/testing/core/mocking/mockClient.cjs.map +0 -1
- package/__cjs/testing/core/mocking/mockClient.d.cts +0 -4
- package/__cjs/testing/core/wait.cjs +0 -11
- package/__cjs/testing/core/wait.cjs.map +0 -1
- package/__cjs/testing/core/wait.d.cts +0 -3
- package/__cjs/testing/core/withConsoleSpy.cjs +0 -33
- package/__cjs/testing/core/withConsoleSpy.cjs.map +0 -1
- package/__cjs/testing/core/withConsoleSpy.d.cts +0 -7
- package/__cjs/testing/experimental/createSchemaFetch.cjs +0 -92
- package/__cjs/testing/experimental/createSchemaFetch.cjs.map +0 -1
- package/__cjs/testing/experimental/createSchemaFetch.d.cts +0 -43
- package/__cjs/testing/experimental/createTestSchema.cjs +0 -110
- package/__cjs/testing/experimental/createTestSchema.cjs.map +0 -1
- package/__cjs/testing/experimental/createTestSchema.d.cts +0 -57
- package/__cjs/testing/experimental/graphql-tools/utils.cjs +0 -177
- package/__cjs/testing/experimental/graphql-tools/utils.cjs.map +0 -1
- package/__cjs/testing/experimental/graphql-tools/utils.d.cts +0 -26
- package/__cjs/testing/experimental/graphql-tools/utils.test.cjs +0 -200
- package/__cjs/testing/experimental/graphql-tools/utils.test.cjs.map +0 -1
- package/__cjs/testing/experimental/graphql-tools/utils.test.d.cts +0 -2
- package/__cjs/testing/experimental/index.cjs +0 -8
- package/__cjs/testing/experimental/index.cjs.map +0 -1
- package/__cjs/testing/experimental/index.d.cts +0 -3
- package/__cjs/testing/internal/ObservableStream.cjs +0 -98
- package/__cjs/testing/internal/ObservableStream.cjs.map +0 -1
- package/__cjs/testing/internal/ObservableStream.d.cts +0 -28
- package/__cjs/testing/internal/disposables/enableFakeTimers.cjs +0 -19
- package/__cjs/testing/internal/disposables/enableFakeTimers.cjs.map +0 -1
- package/__cjs/testing/internal/disposables/enableFakeTimers.d.cts +0 -7
- package/__cjs/testing/internal/disposables/index.cjs +0 -12
- package/__cjs/testing/internal/disposables/index.cjs.map +0 -1
- package/__cjs/testing/internal/disposables/index.d.cts +0 -5
- package/__cjs/testing/internal/disposables/spyOnConsole.cjs +0 -24
- package/__cjs/testing/internal/disposables/spyOnConsole.cjs.map +0 -1
- package/__cjs/testing/internal/disposables/spyOnConsole.d.cts +0 -8
- package/__cjs/testing/internal/disposables/withCleanup.cjs +0 -18
- package/__cjs/testing/internal/disposables/withCleanup.cjs.map +0 -1
- package/__cjs/testing/internal/disposables/withCleanup.d.cts +0 -3
- package/__cjs/testing/internal/disposables/withProdMode.cjs +0 -17
- package/__cjs/testing/internal/disposables/withProdMode.cjs.map +0 -1
- package/__cjs/testing/internal/disposables/withProdMode.d.cts +0 -4
- package/__cjs/testing/internal/incremental.cjs +0 -124
- package/__cjs/testing/internal/incremental.cjs.map +0 -1
- package/__cjs/testing/internal/incremental.d.cts +0 -16
- package/__cjs/testing/internal/index.cjs +0 -31
- package/__cjs/testing/internal/index.cjs.map +0 -1
- package/__cjs/testing/internal/index.d.cts +0 -11
- package/__cjs/testing/internal/messageChannelPolyfill.cjs +0 -18
- package/__cjs/testing/internal/messageChannelPolyfill.cjs.map +0 -1
- package/__cjs/testing/internal/messageChannelPolyfill.d.cts +0 -2
- package/__cjs/testing/internal/renderHelpers.cjs +0 -21
- package/__cjs/testing/internal/renderHelpers.cjs.map +0 -1
- package/__cjs/testing/internal/renderHelpers.d.cts +0 -14
- package/__cjs/testing/internal/resetApolloContext.cjs +0 -24
- package/__cjs/testing/internal/resetApolloContext.cjs.map +0 -1
- package/__cjs/testing/internal/resetApolloContext.d.cts +0 -10
- package/__cjs/testing/internal/rtl/actAsync.cjs +0 -18
- package/__cjs/testing/internal/rtl/actAsync.cjs.map +0 -1
- package/__cjs/testing/internal/rtl/actAsync.d.cts +0 -2
- package/__cjs/testing/internal/rtl/renderAsync.cjs +0 -15
- package/__cjs/testing/internal/rtl/renderAsync.cjs.map +0 -1
- package/__cjs/testing/internal/rtl/renderAsync.d.cts +0 -9
- package/__cjs/testing/internal/rtl/renderHookAsync.cjs +0 -37
- package/__cjs/testing/internal/rtl/renderHookAsync.cjs.map +0 -1
- package/__cjs/testing/internal/rtl/renderHookAsync.d.cts +0 -8
- package/__cjs/testing/internal/scenarios/index.cjs +0 -104
- package/__cjs/testing/internal/scenarios/index.cjs.map +0 -1
- package/__cjs/testing/internal/scenarios/index.d.cts +0 -83
- package/__cjs/testing/matchers/index.cjs +0 -26
- package/__cjs/testing/matchers/index.cjs.map +0 -1
- package/__cjs/testing/matchers/index.d.cts +0 -2
- package/__cjs/testing/matchers/toBeDisposed.cjs +0 -20
- package/__cjs/testing/matchers/toBeDisposed.cjs.map +0 -1
- package/__cjs/testing/matchers/toBeDisposed.d.cts +0 -3
- package/__cjs/testing/matchers/toBeGarbageCollected.cjs +0 -43
- package/__cjs/testing/matchers/toBeGarbageCollected.cjs.map +0 -1
- package/__cjs/testing/matchers/toBeGarbageCollected.d.cts +0 -8
- package/__cjs/testing/matchers/toComplete.cjs +0 -30
- package/__cjs/testing/matchers/toComplete.cjs.map +0 -1
- package/__cjs/testing/matchers/toComplete.d.cts +0 -4
- package/__cjs/testing/matchers/toEmitAnything.cjs +0 -33
- package/__cjs/testing/matchers/toEmitAnything.cjs.map +0 -1
- package/__cjs/testing/matchers/toEmitAnything.d.cts +0 -4
- package/__cjs/testing/matchers/toEmitError.cjs +0 -46
- package/__cjs/testing/matchers/toEmitError.cjs.map +0 -1
- package/__cjs/testing/matchers/toEmitError.d.cts +0 -7
- package/__cjs/testing/matchers/toEmitNext.cjs +0 -30
- package/__cjs/testing/matchers/toEmitNext.cjs.map +0 -1
- package/__cjs/testing/matchers/toEmitNext.d.cts +0 -4
- package/__cjs/testing/matchers/toEmitTypedValue.cjs +0 -42
- package/__cjs/testing/matchers/toEmitTypedValue.cjs.map +0 -1
- package/__cjs/testing/matchers/toEmitTypedValue.d.cts +0 -7
- package/__cjs/testing/matchers/toHaveSuspenseCacheEntryUsing.cjs +0 -26
- package/__cjs/testing/matchers/toHaveSuspenseCacheEntryUsing.cjs.map +0 -1
- package/__cjs/testing/matchers/toHaveSuspenseCacheEntryUsing.d.cts +0 -11
- package/__cjs/testing/matchers/toMatchDocument.cjs +0 -36
- package/__cjs/testing/matchers/toMatchDocument.cjs.map +0 -1
- package/__cjs/testing/matchers/toMatchDocument.d.cts +0 -4
- package/__cjs/testing/matchers/toStrictEqualTyped.cjs +0 -26
- package/__cjs/testing/matchers/toStrictEqualTyped.cjs.map +0 -1
- package/__cjs/testing/matchers/toStrictEqualTyped.d.cts +0 -3
- package/__cjs/testing/matchers/utils/getSerializableProperties.cjs +0 -23
- package/__cjs/testing/matchers/utils/getSerializableProperties.cjs.map +0 -1
- package/__cjs/testing/matchers/utils/getSerializableProperties.d.cts +0 -2
- package/__cjs/utilities/caching/caches.cjs +0 -72
- package/__cjs/utilities/caching/caches.cjs.map +0 -1
- package/__cjs/utilities/caching/caches.d.cts +0 -34
- package/__cjs/utilities/common/arrays.cjs +0 -10
- package/__cjs/utilities/common/arrays.cjs.map +0 -1
- package/__cjs/utilities/common/arrays.d.cts +0 -3
- package/__cjs/utilities/common/canUse.cjs +0 -24
- package/__cjs/utilities/common/canUse.cjs.map +0 -1
- package/__cjs/utilities/common/canUse.d.cts +0 -3
- package/__cjs/utilities/common/canonicalStringify.cjs +0 -88
- package/__cjs/utilities/common/canonicalStringify.cjs.map +0 -1
- package/__cjs/utilities/common/cloneDeep.cjs +0 -41
- package/__cjs/utilities/common/cloneDeep.cjs.map +0 -1
- package/__cjs/utilities/common/cloneDeep.d.cts +0 -5
- package/__cjs/utilities/common/compact.cjs +0 -22
- package/__cjs/utilities/common/compact.cjs.map +0 -1
- package/__cjs/utilities/common/compact.d.cts +0 -7
- package/__cjs/utilities/common/errorHandling.cjs +0 -23
- package/__cjs/utilities/common/errorHandling.cjs.map +0 -1
- package/__cjs/utilities/common/errorHandling.d.cts +0 -4
- package/__cjs/utilities/common/incrementalResult.cjs +0 -45
- package/__cjs/utilities/common/incrementalResult.cjs.map +0 -1
- package/__cjs/utilities/common/incrementalResult.d.cts +0 -7
- package/__cjs/utilities/common/makeUniqueId.cjs +0 -12
- package/__cjs/utilities/common/makeUniqueId.cjs.map +0 -1
- package/__cjs/utilities/common/makeUniqueId.d.cts +0 -2
- package/__cjs/utilities/common/maybeDeepFreeze.cjs +0 -42
- package/__cjs/utilities/common/maybeDeepFreeze.cjs.map +0 -1
- package/__cjs/utilities/common/maybeDeepFreeze.d.cts +0 -4
- package/__cjs/utilities/common/mergeDeep.cjs +0 -84
- package/__cjs/utilities/common/mergeDeep.cjs.map +0 -1
- package/__cjs/utilities/common/mergeDeep.d.cts +0 -14
- package/__cjs/utilities/common/mergeOptions.cjs +0 -13
- package/__cjs/utilities/common/mergeOptions.cjs.map +0 -1
- package/__cjs/utilities/common/mergeOptions.d.cts +0 -5
- package/__cjs/utilities/common/objects.cjs +0 -14
- package/__cjs/utilities/common/objects.cjs.map +0 -1
- package/__cjs/utilities/common/objects.d.cts +0 -3
- package/__cjs/utilities/common/omitDeep.cjs +0 -43
- package/__cjs/utilities/common/omitDeep.cjs.map +0 -1
- package/__cjs/utilities/common/omitDeep.d.cts +0 -3
- package/__cjs/utilities/common/stringifyForDisplay.cjs +0 -13
- package/__cjs/utilities/common/stringifyForDisplay.cjs.map +0 -1
- package/__cjs/utilities/common/stringifyForDisplay.d.cts +0 -2
- package/__cjs/utilities/globals/global.cjs.map +0 -1
- package/__cjs/utilities/globals/index.cjs.map +0 -1
- package/__cjs/utilities/globals/maybe.cjs.map +0 -1
- package/__cjs/utilities/graphql/directives.cjs +0 -114
- package/__cjs/utilities/graphql/directives.cjs.map +0 -1
- package/__cjs/utilities/graphql/directives.d.cts +0 -20
- package/__cjs/utilities/graphql/fragments.cjs +0 -126
- package/__cjs/utilities/graphql/fragments.cjs.map +0 -1
- package/__cjs/utilities/graphql/fragments.d.cts +0 -35
- package/__cjs/utilities/graphql/getFromAST.cjs +0 -101
- package/__cjs/utilities/graphql/getFromAST.cjs.map +0 -1
- package/__cjs/utilities/graphql/getFromAST.d.cts +0 -15
- package/__cjs/utilities/internal/observables.cjs +0 -29
- package/__cjs/utilities/internal/observables.cjs.map +0 -1
- package/__cjs/utilities/internal/observables.d.cts +0 -14
- package/__cjs/utilities/promises/decoration.cjs +0 -45
- package/__cjs/utilities/promises/decoration.cjs.map +0 -1
- package/__cjs/utilities/promises/decoration.d.cts +0 -18
- package/__cjs/utilities/promises/preventUnhandledRejection.cjs.map +0 -1
- package/__cjs/utilities/types/DeepOmit.d.cts +0 -10
- package/__cjs/utilities/types/DeepPartial.cjs.map +0 -1
- package/__cjs/utilities/types/DeepPartial.d.cts +0 -12
- package/__cjs/utilities/types/IsStrictlyAny.cjs +0 -3
- package/__cjs/utilities/types/IsStrictlyAny.cjs.map +0 -1
- package/__cjs/utilities/types/IsStrictlyAny.d.cts +0 -5
- package/__cjs/utilities/types/NoInfer.d.cts +0 -27
- package/__cjs/utilities/types/OnlyRequiredProperties.cjs +0 -3
- package/__cjs/utilities/types/OnlyRequiredProperties.cjs.map +0 -1
- package/__cjs/utilities/types/OnlyRequiredProperties.d.cts +0 -7
- package/__cjs/utilities/types/Prettify.d.cts +0 -4
- package/__cjs/utilities/types/Primitive.d.cts +0 -2
- package/__cjs/utilities/types/RemoveIndexSignature.d.cts +0 -4
- package/__cjs/utilities/types/UnionToIntersection.cjs +0 -3
- package/__cjs/utilities/types/UnionToIntersection.cjs.map +0 -1
- package/__cjs/utilities/types/UnionToIntersection.d.cts +0 -2
- package/config/jest/areCombinedGraphQLErrorsEqual.d.ts +0 -3
- package/config/jest/areCombinedGraphQLErrorsEqual.js +0 -16
- package/config/jest/areCombinedGraphQLErrorsEqual.js.map +0 -1
- package/config/jest/areCombinedProtocolErrorsEqual.d.ts +0 -3
- package/config/jest/areCombinedProtocolErrorsEqual.js +0 -14
- package/config/jest/areCombinedProtocolErrorsEqual.js.map +0 -1
- package/config/jest/areGraphQlErrorsEqual.d.ts +0 -3
- package/config/jest/areGraphQlErrorsEqual.js +0 -7
- package/config/jest/areGraphQlErrorsEqual.js.map +0 -1
- package/config/jest/areMissingFieldErrorsEqual.d.ts +0 -3
- package/config/jest/areMissingFieldErrorsEqual.js +0 -16
- package/config/jest/areMissingFieldErrorsEqual.js.map +0 -1
- package/config/jest/areServerErrorsEqual.d.ts +0 -3
- package/config/jest/areServerErrorsEqual.js +0 -17
- package/config/jest/areServerErrorsEqual.js.map +0 -1
- package/config/jest/resolver.d.ts +0 -3
- package/config/jest/resolver.js +0 -29
- package/config/jest/resolver.js.map +0 -1
- package/config/jest/setup.d.ts +0 -3
- package/config/jest/setup.js +0 -62
- package/config/jest/setup.js.map +0 -1
- package/core/LocalState.d.ts +0 -53
- package/core/LocalState.js +0 -329
- package/core/LocalState.js.map +0 -1
- package/legacyEntryPoints/link/core/core.cjs +0 -1
- package/legacyEntryPoints/link/core/core.d.cts +0 -1
- package/legacyEntryPoints/link/core/index.d.ts +0 -1
- package/legacyEntryPoints/link/core/index.js +0 -1
- package/legacyEntryPoints/testing/core/core.cjs +0 -1
- package/legacyEntryPoints/testing/core/core.d.cts +0 -1
- package/legacyEntryPoints/testing/core/index.d.ts +0 -1
- package/legacyEntryPoints/testing/core/index.js +0 -1
- package/legacyEntryPoints/testing/experimental/experimental.cjs +0 -1
- package/legacyEntryPoints/testing/experimental/experimental.d.cts +0 -1
- package/legacyEntryPoints/testing/experimental/index.d.ts +0 -1
- package/legacyEntryPoints/testing/experimental/index.js +0 -1
- package/legacyEntryPoints/testing/internal/index.d.ts +0 -1
- package/legacyEntryPoints/testing/internal/index.js +0 -1
- package/legacyEntryPoints/testing/internal/internal.cjs +0 -1
- package/legacyEntryPoints/testing/internal/internal.d.cts +0 -1
- package/legacyEntryPoints/utilities/globals/globals.cjs +0 -1
- package/legacyEntryPoints/utilities/globals/globals.d.cts +0 -1
- package/legacyEntryPoints/utilities/globals/index.d.ts +0 -1
- package/legacyEntryPoints/utilities/globals/index.js +0 -1
- package/link/core/index.d.ts +0 -8
- package/link/core/index.js +0 -7
- package/link/core/index.js.map +0 -1
- package/link/http/createHttpLink.d.ts +0 -4
- package/link/http/createHttpLink.js +0 -150
- package/link/http/createHttpLink.js.map +0 -1
- package/masking/__benches__/types.bench.d.ts +0 -2
- package/masking/__benches__/types.bench.js +0 -221
- package/masking/__benches__/types.bench.js.map +0 -1
- package/testing/core/index.d.ts +0 -7
- package/testing/core/index.js +0 -6
- package/testing/core/index.js.map +0 -1
- package/testing/core/mocking/mockClient.d.ts +0 -4
- package/testing/core/mocking/mockClient.js +0 -14
- package/testing/core/mocking/mockClient.js.map +0 -1
- package/testing/core/wait.d.ts +0 -3
- package/testing/core/wait.js +0 -7
- package/testing/core/wait.js.map +0 -1
- package/testing/core/withConsoleSpy.d.ts +0 -7
- package/testing/core/withConsoleSpy.js +0 -28
- package/testing/core/withConsoleSpy.js.map +0 -1
- package/testing/experimental/createSchemaFetch.d.ts +0 -43
- package/testing/experimental/createSchemaFetch.js +0 -89
- package/testing/experimental/createSchemaFetch.js.map +0 -1
- package/testing/experimental/createTestSchema.d.ts +0 -57
- package/testing/experimental/createTestSchema.js +0 -107
- package/testing/experimental/createTestSchema.js.map +0 -1
- package/testing/experimental/graphql-tools/utils.d.ts +0 -26
- package/testing/experimental/graphql-tools/utils.js +0 -174
- package/testing/experimental/graphql-tools/utils.js.map +0 -1
- package/testing/experimental/graphql-tools/utils.test.d.ts +0 -2
- package/testing/experimental/graphql-tools/utils.test.js +0 -198
- package/testing/experimental/graphql-tools/utils.test.js.map +0 -1
- package/testing/experimental/index.d.ts +0 -3
- package/testing/experimental/index.js +0 -3
- package/testing/experimental/index.js.map +0 -1
- package/testing/internal/ObservableStream.d.ts +0 -28
- package/testing/internal/ObservableStream.js +0 -93
- package/testing/internal/ObservableStream.js.map +0 -1
- package/testing/internal/disposables/enableFakeTimers.d.ts +0 -7
- package/testing/internal/disposables/enableFakeTimers.js +0 -16
- package/testing/internal/disposables/enableFakeTimers.js.map +0 -1
- package/testing/internal/disposables/index.d.ts +0 -5
- package/testing/internal/disposables/index.js +0 -5
- package/testing/internal/disposables/index.js.map +0 -1
- package/testing/internal/disposables/spyOnConsole.d.ts +0 -8
- package/testing/internal/disposables/spyOnConsole.js +0 -21
- package/testing/internal/disposables/spyOnConsole.js.map +0 -1
- package/testing/internal/disposables/withCleanup.d.ts +0 -3
- package/testing/internal/disposables/withCleanup.js +0 -15
- package/testing/internal/disposables/withCleanup.js.map +0 -1
- package/testing/internal/disposables/withProdMode.d.ts +0 -4
- package/testing/internal/disposables/withProdMode.js +0 -13
- package/testing/internal/disposables/withProdMode.js.map +0 -1
- package/testing/internal/incremental.d.ts +0 -16
- package/testing/internal/incremental.js +0 -120
- package/testing/internal/incremental.js.map +0 -1
- package/testing/internal/index.d.ts +0 -11
- package/testing/internal/index.js +0 -10
- package/testing/internal/index.js.map +0 -1
- package/testing/internal/messageChannelPolyfill.d.ts +0 -2
- package/testing/internal/messageChannelPolyfill.js +0 -16
- package/testing/internal/messageChannelPolyfill.js.map +0 -1
- package/testing/internal/renderHelpers.d.ts +0 -14
- package/testing/internal/renderHelpers.js +0 -16
- package/testing/internal/renderHelpers.js.map +0 -1
- package/testing/internal/resetApolloContext.d.ts +0 -10
- package/testing/internal/resetApolloContext.js +0 -20
- package/testing/internal/resetApolloContext.js.map +0 -1
- package/testing/internal/rtl/actAsync.d.ts +0 -2
- package/testing/internal/rtl/actAsync.js +0 -14
- package/testing/internal/rtl/actAsync.js.map +0 -1
- package/testing/internal/rtl/renderAsync.d.ts +0 -9
- package/testing/internal/rtl/renderAsync.js +0 -12
- package/testing/internal/rtl/renderAsync.js.map +0 -1
- package/testing/internal/rtl/renderHookAsync.d.ts +0 -8
- package/testing/internal/rtl/renderHookAsync.js +0 -33
- package/testing/internal/rtl/renderHookAsync.js.map +0 -1
- package/testing/internal/scenarios/index.d.ts +0 -83
- package/testing/internal/scenarios/index.js +0 -97
- package/testing/internal/scenarios/index.js.map +0 -1
- package/testing/matchers/index.d.ts +0 -2
- package/testing/matchers/index.js +0 -24
- package/testing/matchers/index.js.map +0 -1
- package/testing/matchers/toBeDisposed.d.ts +0 -3
- package/testing/matchers/toBeDisposed.js +0 -16
- package/testing/matchers/toBeDisposed.js.map +0 -1
- package/testing/matchers/toBeGarbageCollected.d.ts +0 -8
- package/testing/matchers/toBeGarbageCollected.js +0 -39
- package/testing/matchers/toBeGarbageCollected.js.map +0 -1
- package/testing/matchers/toComplete.d.ts +0 -4
- package/testing/matchers/toComplete.js +0 -26
- package/testing/matchers/toComplete.js.map +0 -1
- package/testing/matchers/toEmitAnything.d.ts +0 -4
- package/testing/matchers/toEmitAnything.js +0 -29
- package/testing/matchers/toEmitAnything.js.map +0 -1
- package/testing/matchers/toEmitError.d.ts +0 -7
- package/testing/matchers/toEmitError.js +0 -42
- package/testing/matchers/toEmitError.js.map +0 -1
- package/testing/matchers/toEmitNext.d.ts +0 -4
- package/testing/matchers/toEmitNext.js +0 -26
- package/testing/matchers/toEmitNext.js.map +0 -1
- package/testing/matchers/toEmitTypedValue.d.ts +0 -7
- package/testing/matchers/toEmitTypedValue.js +0 -38
- package/testing/matchers/toEmitTypedValue.js.map +0 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts +0 -11
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.js +0 -22
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map +0 -1
- package/testing/matchers/toMatchDocument.d.ts +0 -4
- package/testing/matchers/toMatchDocument.js +0 -32
- package/testing/matchers/toMatchDocument.js.map +0 -1
- package/testing/matchers/toStrictEqualTyped.d.ts +0 -3
- package/testing/matchers/toStrictEqualTyped.js +0 -22
- package/testing/matchers/toStrictEqualTyped.js.map +0 -1
- package/testing/matchers/utils/getSerializableProperties.d.ts +0 -2
- package/testing/matchers/utils/getSerializableProperties.js +0 -20
- package/testing/matchers/utils/getSerializableProperties.js.map +0 -1
- package/utilities/caching/caches.d.ts +0 -34
- package/utilities/caching/caches.js +0 -69
- package/utilities/caching/caches.js.map +0 -1
- package/utilities/common/arrays.d.ts +0 -3
- package/utilities/common/arrays.js +0 -6
- package/utilities/common/arrays.js.map +0 -1
- package/utilities/common/canUse.d.ts +0 -3
- package/utilities/common/canUse.js +0 -21
- package/utilities/common/canUse.js.map +0 -1
- package/utilities/common/canonicalStringify.js +0 -85
- package/utilities/common/canonicalStringify.js.map +0 -1
- package/utilities/common/cloneDeep.d.ts +0 -5
- package/utilities/common/cloneDeep.js +0 -38
- package/utilities/common/cloneDeep.js.map +0 -1
- package/utilities/common/compact.d.ts +0 -7
- package/utilities/common/compact.js +0 -19
- package/utilities/common/compact.js.map +0 -1
- package/utilities/common/errorHandling.d.ts +0 -4
- package/utilities/common/errorHandling.js +0 -19
- package/utilities/common/errorHandling.js.map +0 -1
- package/utilities/common/incrementalResult.d.ts +0 -7
- package/utilities/common/incrementalResult.js +0 -38
- package/utilities/common/incrementalResult.js.map +0 -1
- package/utilities/common/makeUniqueId.d.ts +0 -2
- package/utilities/common/makeUniqueId.js +0 -9
- package/utilities/common/makeUniqueId.js.map +0 -1
- package/utilities/common/maybeDeepFreeze.d.ts +0 -4
- package/utilities/common/maybeDeepFreeze.js +0 -38
- package/utilities/common/maybeDeepFreeze.js.map +0 -1
- package/utilities/common/mergeDeep.d.ts +0 -14
- package/utilities/common/mergeDeep.js +0 -78
- package/utilities/common/mergeDeep.js.map +0 -1
- package/utilities/common/mergeOptions.d.ts +0 -5
- package/utilities/common/mergeOptions.js +0 -10
- package/utilities/common/mergeOptions.js.map +0 -1
- package/utilities/common/objects.d.ts +0 -3
- package/utilities/common/objects.js +0 -10
- package/utilities/common/objects.js.map +0 -1
- package/utilities/common/omitDeep.d.ts +0 -3
- package/utilities/common/omitDeep.js +0 -40
- package/utilities/common/omitDeep.js.map +0 -1
- package/utilities/common/stringifyForDisplay.d.ts +0 -2
- package/utilities/common/stringifyForDisplay.js +0 -10
- package/utilities/common/stringifyForDisplay.js.map +0 -1
- package/utilities/globals/global.js +0 -14
- package/utilities/globals/global.js.map +0 -1
- package/utilities/globals/index.js.map +0 -1
- package/utilities/globals/maybe.js.map +0 -1
- package/utilities/graphql/directives.d.ts +0 -20
- package/utilities/graphql/directives.js +0 -99
- package/utilities/graphql/directives.js.map +0 -1
- package/utilities/graphql/fragments.d.ts +0 -35
- package/utilities/graphql/fragments.js +0 -120
- package/utilities/graphql/fragments.js.map +0 -1
- package/utilities/graphql/getFromAST.d.ts +0 -15
- package/utilities/graphql/getFromAST.js +0 -91
- package/utilities/graphql/getFromAST.js.map +0 -1
- package/utilities/internal/observables.d.ts +0 -14
- package/utilities/internal/observables.js +0 -26
- package/utilities/internal/observables.js.map +0 -1
- package/utilities/promises/decoration.d.ts +0 -18
- package/utilities/promises/decoration.js +0 -39
- package/utilities/promises/decoration.js.map +0 -1
- package/utilities/promises/preventUnhandledRejection.js.map +0 -1
- package/utilities/types/DeepOmit.d.ts +0 -10
- package/utilities/types/DeepPartial.d.ts +0 -12
- package/utilities/types/DeepPartial.js.map +0 -1
- package/utilities/types/IsStrictlyAny.d.ts +0 -5
- package/utilities/types/IsStrictlyAny.js +0 -2
- package/utilities/types/IsStrictlyAny.js.map +0 -1
- package/utilities/types/NoInfer.d.ts +0 -27
- package/utilities/types/OnlyRequiredProperties.d.ts +0 -7
- package/utilities/types/OnlyRequiredProperties.js +0 -2
- package/utilities/types/OnlyRequiredProperties.js.map +0 -1
- package/utilities/types/Prettify.d.ts +0 -4
- package/utilities/types/Primitive.d.ts +0 -2
- package/utilities/types/RemoveIndexSignature.d.ts +0 -4
- package/utilities/types/UnionToIntersection.d.ts +0 -2
- package/utilities/types/UnionToIntersection.js +0 -2
- package/utilities/types/UnionToIntersection.js.map +0 -1
- /package/__cjs/utilities/{types/DeepPartial.cjs → DeepPartial.cjs} +0 -0
- /package/__cjs/utilities/{globals → internal/globals}/global.cjs +0 -0
- /package/__cjs/utilities/{globals → internal/globals}/global.d.cts +0 -0
- /package/__cjs/utilities/{globals → internal/globals}/index.cjs +0 -0
- /package/__cjs/utilities/{globals → internal/globals}/index.d.cts +0 -0
- /package/__cjs/utilities/{globals → internal/globals}/maybe.cjs +0 -0
- /package/__cjs/utilities/{globals → internal/globals}/maybe.d.cts +0 -0
- /package/__cjs/utilities/{promises → internal}/preventUnhandledRejection.cjs +0 -0
- /package/__cjs/utilities/{promises → internal}/preventUnhandledRejection.d.cts +0 -0
- /package/__cjs/utilities/{types → internal/types}/DeepOmit.cjs +0 -0
- /package/__cjs/utilities/{types → internal/types}/DeepOmit.cjs.map +0 -0
- /package/__cjs/utilities/{types → internal/types}/NoInfer.cjs +0 -0
- /package/__cjs/utilities/{types → internal/types}/NoInfer.cjs.map +0 -0
- /package/__cjs/utilities/{types → internal/types}/Prettify.cjs +0 -0
- /package/__cjs/utilities/{types → internal/types}/Prettify.cjs.map +0 -0
- /package/__cjs/utilities/{types → internal/types}/Primitive.cjs +0 -0
- /package/__cjs/utilities/{types → internal/types}/Primitive.cjs.map +0 -0
- /package/__cjs/utilities/{types → internal/types}/RemoveIndexSignature.cjs +0 -0
- /package/__cjs/utilities/{types → internal/types}/RemoveIndexSignature.cjs.map +0 -0
- /package/__cjs/utilities/{common → shared}/canonicalStringify.d.cts +0 -0
- /package/utilities/{types/DeepPartial.js → DeepPartial.js} +0 -0
- /package/utilities/{globals → internal/globals}/global.d.ts +0 -0
- /package/utilities/{globals → internal/globals}/index.d.ts +0 -0
- /package/utilities/{globals → internal/globals}/index.js +0 -0
- /package/utilities/{globals → internal/globals}/maybe.d.ts +0 -0
- /package/utilities/{globals → internal/globals}/maybe.js +0 -0
- /package/utilities/{promises → internal}/preventUnhandledRejection.d.ts +0 -0
- /package/utilities/{promises → internal}/preventUnhandledRejection.js +0 -0
- /package/utilities/{types → internal/types}/DeepOmit.js +0 -0
- /package/utilities/{types → internal/types}/DeepOmit.js.map +0 -0
- /package/utilities/{types → internal/types}/NoInfer.js +0 -0
- /package/utilities/{types → internal/types}/NoInfer.js.map +0 -0
- /package/utilities/{types → internal/types}/Prettify.js +0 -0
- /package/utilities/{types → internal/types}/Prettify.js.map +0 -0
- /package/utilities/{types → internal/types}/Primitive.js +0 -0
- /package/utilities/{types → internal/types}/Primitive.js.map +0 -0
- /package/utilities/{types → internal/types}/RemoveIndexSignature.js +0 -0
- /package/utilities/{types → internal/types}/RemoveIndexSignature.js.map +0 -0
- /package/utilities/{common → shared}/canonicalStringify.d.ts +0 -0
package/core/ObservableQuery.js
CHANGED
|
@@ -1,118 +1,77 @@
|
|
|
1
1
|
import { equal } from "@wry/equality";
|
|
2
|
-
import {
|
|
3
|
-
import { BehaviorSubject, filter, lastValueFrom, tap } from "rxjs";
|
|
4
|
-
import { cloneDeep, compact, getOperationDefinition, getQueryDefinition, preventUnhandledRejection, } from "@apollo/client/utilities";
|
|
2
|
+
import { BehaviorSubject, Observable, share, Subject, tap } from "rxjs";
|
|
5
3
|
import { __DEV__ } from "@apollo/client/utilities/environment";
|
|
6
|
-
import { toQueryResult } from "@apollo/client/utilities/internal";
|
|
4
|
+
import { compact, filterMap, getOperationDefinition, getOperationName, getQueryDefinition, preventUnhandledRejection, toQueryResult, } from "@apollo/client/utilities/internal";
|
|
7
5
|
import { invariant } from "@apollo/client/utilities/invariant";
|
|
8
6
|
import { equalByQuery } from "./equalByQuery.js";
|
|
9
7
|
import { isNetworkRequestInFlight, NetworkStatus } from "./networkStatus.js";
|
|
10
8
|
const { assign, hasOwnProperty } = Object;
|
|
11
|
-
const
|
|
9
|
+
const uninitialized = {
|
|
10
|
+
loading: true,
|
|
11
|
+
networkStatus: NetworkStatus.loading,
|
|
12
|
+
data: undefined,
|
|
13
|
+
dataState: "empty",
|
|
14
|
+
partial: true,
|
|
15
|
+
};
|
|
16
|
+
const empty = {
|
|
17
|
+
loading: false,
|
|
18
|
+
networkStatus: NetworkStatus.ready,
|
|
19
|
+
data: undefined,
|
|
20
|
+
dataState: "empty",
|
|
21
|
+
partial: true,
|
|
22
|
+
};
|
|
12
23
|
export class ObservableQuery {
|
|
13
|
-
/**
|
|
14
|
-
* @internal
|
|
15
|
-
* A slot used by the `useQuery` hook to indicate that `client.watchQuery`
|
|
16
|
-
* should not register the query immediately, but instead wait for the query to
|
|
17
|
-
* be started registered with the `QueryManager` when `useSyncExternalStore`
|
|
18
|
-
* actively subscribes to it.
|
|
19
|
-
*/
|
|
20
|
-
static inactiveOnCreation = new Slot();
|
|
21
24
|
options;
|
|
22
|
-
queryId;
|
|
23
25
|
queryName;
|
|
26
|
+
/**
|
|
27
|
+
* @internal will be read and written from `QueryInfo`
|
|
28
|
+
*
|
|
29
|
+
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
30
|
+
*/
|
|
31
|
+
_lastWrite;
|
|
24
32
|
// The `query` computed property will always reflect the document transformed
|
|
25
33
|
// by the last run query. `this.options.query` will always reflect the raw
|
|
26
34
|
// untransformed query to ensure document transforms with runtime conditionals
|
|
27
35
|
// are run on the original document.
|
|
28
36
|
get query() {
|
|
29
|
-
return this.lastQuery
|
|
37
|
+
return this.lastQuery;
|
|
30
38
|
}
|
|
31
|
-
// Computed shorthand for this.options.variables, preserved for
|
|
32
|
-
// backwards compatibility.
|
|
33
39
|
/**
|
|
34
40
|
* An object containing the variables that were provided for the query.
|
|
35
41
|
*/
|
|
36
42
|
get variables() {
|
|
37
43
|
return this.options.variables;
|
|
38
44
|
}
|
|
45
|
+
unsubscribeFromCache;
|
|
46
|
+
input;
|
|
39
47
|
subject;
|
|
40
|
-
observable;
|
|
41
|
-
initialResult;
|
|
42
48
|
isTornDown;
|
|
43
49
|
queryManager;
|
|
44
50
|
subscriptions = new Set();
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
/**
|
|
52
|
+
* If an `ObservableQuery` is created with a `network-only` fetch policy,
|
|
53
|
+
* it should actually start receiving cache updates, but not before it has
|
|
54
|
+
* received the first result from the network.
|
|
55
|
+
*/
|
|
56
|
+
waitForNetworkResult;
|
|
47
57
|
lastQuery;
|
|
48
|
-
queryInfo;
|
|
49
58
|
linkSubscription;
|
|
50
|
-
linkObservable;
|
|
51
59
|
pollingInfo;
|
|
52
|
-
networkStatus
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
data: undefined,
|
|
57
|
-
loading: true,
|
|
58
|
-
networkStatus: this.networkStatus,
|
|
59
|
-
partial: true,
|
|
60
|
-
};
|
|
61
|
-
let startedInactive = ObservableQuery.inactiveOnCreation.getValue();
|
|
62
|
-
this.subject = new BehaviorSubject(this.initialResult);
|
|
63
|
-
this.observable = this.subject.pipe(tap({
|
|
64
|
-
subscribe: () => {
|
|
65
|
-
if (startedInactive) {
|
|
66
|
-
queryManager["queries"].set(this.queryId, queryInfo);
|
|
67
|
-
startedInactive = false;
|
|
68
|
-
}
|
|
69
|
-
if (!this.subject.observed) {
|
|
70
|
-
this.reobserve();
|
|
71
|
-
// TODO: See if we can rework updatePolling to better handle this.
|
|
72
|
-
// reobserve calls updatePolling but this `subscribe` callback is
|
|
73
|
-
// called before the subject is subscribed to so `updatePolling`
|
|
74
|
-
// can't accurately detect if there is an active subscription.
|
|
75
|
-
// Calling it again here ensures that it can detect if it can poll
|
|
76
|
-
setTimeout(() => this.updatePolling());
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
unsubscribe: () => {
|
|
80
|
-
if (!this.subject.observed) {
|
|
81
|
-
this.tearDownQuery();
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
}),
|
|
85
|
-
// TODO: Conditionally filter when notifyOnNetworkStatusChange is true or
|
|
86
|
-
// not. We want to emit the loading result if notifyOnNetworkStatusChange
|
|
87
|
-
// is true.
|
|
88
|
-
filter((result) =>
|
|
89
|
-
// TODO: Remove this behavior when unifying loading state for notifyOnNetworkStatusChange
|
|
90
|
-
(this.options.fetchPolicy === "no-cache" &&
|
|
91
|
-
this.options.notifyOnNetworkStatusChange) ||
|
|
92
|
-
// TODO: Remove this behavior when unifying loading state for notifyOnNetworkStatusChange
|
|
93
|
-
(this.options.fetchPolicy === "network-only" &&
|
|
94
|
-
!this.queryManager.prioritizeCacheValues &&
|
|
95
|
-
this.queryInfo.getDiff().complete) ||
|
|
96
|
-
result !== this.initialResult));
|
|
97
|
-
this["@@observable"] = () => this;
|
|
98
|
-
if (Symbol.observable) {
|
|
99
|
-
this[Symbol.observable] = () => this;
|
|
100
|
-
}
|
|
101
|
-
this.pipe = this.observable.pipe.bind(this.observable);
|
|
102
|
-
this.subscribe = this.observable.subscribe.bind(this.observable);
|
|
103
|
-
// related classes
|
|
104
|
-
this.queryInfo = queryInfo;
|
|
60
|
+
get networkStatus() {
|
|
61
|
+
return this.subject.getValue().result.networkStatus;
|
|
62
|
+
}
|
|
63
|
+
constructor({ queryManager, options, transformedQuery = queryManager.transform(options.query), }) {
|
|
105
64
|
this.queryManager = queryManager;
|
|
106
65
|
// active state
|
|
107
|
-
this.
|
|
66
|
+
this.waitForNetworkResult = options.fetchPolicy === "network-only";
|
|
108
67
|
this.isTornDown = false;
|
|
109
|
-
this.subscribe = this.subscribe.bind(this);
|
|
110
68
|
this.subscribeToMore = this.subscribeToMore.bind(this);
|
|
111
69
|
this.maskResult = this.maskResult.bind(this);
|
|
112
70
|
const { watchQuery: { fetchPolicy: defaultFetchPolicy = "cache-first" } = {}, } = queryManager.defaultOptions;
|
|
113
71
|
const { fetchPolicy = defaultFetchPolicy,
|
|
114
72
|
// Make sure we don't store "standby" as the initialFetchPolicy.
|
|
115
73
|
initialFetchPolicy = fetchPolicy === "standby" ? defaultFetchPolicy : (fetchPolicy), } = options;
|
|
74
|
+
this.lastQuery = transformedQuery;
|
|
116
75
|
this.options = {
|
|
117
76
|
...options,
|
|
118
77
|
// Remember the initial options.fetchPolicy so we can revert back to this
|
|
@@ -122,11 +81,84 @@ export class ObservableQuery {
|
|
|
122
81
|
// This ensures this.options.fetchPolicy always has a string value, in
|
|
123
82
|
// case options.fetchPolicy was not provided.
|
|
124
83
|
fetchPolicy,
|
|
84
|
+
variables: this.getVariablesWithDefaults(options.variables),
|
|
125
85
|
};
|
|
126
|
-
this.
|
|
86
|
+
this.initializeObservablesQueue();
|
|
87
|
+
this["@@observable"] = () => this;
|
|
88
|
+
if (Symbol.observable) {
|
|
89
|
+
this[Symbol.observable] = () => this;
|
|
90
|
+
}
|
|
127
91
|
const opDef = getOperationDefinition(this.query);
|
|
128
92
|
this.queryName = opDef && opDef.name && opDef.name.value;
|
|
129
93
|
}
|
|
94
|
+
initializeObservablesQueue() {
|
|
95
|
+
this.subject = new BehaviorSubject({
|
|
96
|
+
query: this.query,
|
|
97
|
+
variables: this.variables,
|
|
98
|
+
result: uninitialized,
|
|
99
|
+
meta: {},
|
|
100
|
+
});
|
|
101
|
+
const observable = this.subject.pipe(tap({
|
|
102
|
+
subscribe: () => {
|
|
103
|
+
if (!this.subject.observed) {
|
|
104
|
+
this.reobserve();
|
|
105
|
+
// TODO: See if we can rework updatePolling to better handle this.
|
|
106
|
+
// reobserve calls updatePolling but this `subscribe` callback is
|
|
107
|
+
// called before the subject is subscribed to so `updatePolling`
|
|
108
|
+
// can't accurately detect if there is an active subscription.
|
|
109
|
+
// Calling it again here ensures that it can detect if it can poll
|
|
110
|
+
setTimeout(() => this.updatePolling());
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
unsubscribe: () => {
|
|
114
|
+
if (!this.subject.observed) {
|
|
115
|
+
this.tearDownQuery();
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
}), filterMap(({ query, variables, result: current, meta }, context) => {
|
|
119
|
+
const { shouldEmit } = meta;
|
|
120
|
+
if (current === uninitialized) {
|
|
121
|
+
// reset internal state after `ObservableQuery.reset()`
|
|
122
|
+
context.previous = undefined;
|
|
123
|
+
context.previousVariables = undefined;
|
|
124
|
+
}
|
|
125
|
+
if (this.options.fetchPolicy === "standby" ||
|
|
126
|
+
shouldEmit === 2 /* EmitBehavior.never */)
|
|
127
|
+
return;
|
|
128
|
+
if (shouldEmit === 1 /* EmitBehavior.force */)
|
|
129
|
+
return emit();
|
|
130
|
+
const { previous, previousVariables } = context;
|
|
131
|
+
if (previous) {
|
|
132
|
+
const documentInfo = this.queryManager.getDocumentInfo(query);
|
|
133
|
+
const dataMasking = this.queryManager.dataMasking;
|
|
134
|
+
const maskedQuery = dataMasking ? documentInfo.nonReactiveQuery : query;
|
|
135
|
+
const resultIsEqual = dataMasking || documentInfo.hasNonreactiveDirective ?
|
|
136
|
+
equalByQuery(maskedQuery, previous, current, variables)
|
|
137
|
+
: equal(previous, current);
|
|
138
|
+
if (resultIsEqual && equal(previousVariables, variables)) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (shouldEmit === 3 /* EmitBehavior.networkStatusChange */ &&
|
|
143
|
+
(!this.options.notifyOnNetworkStatusChange ||
|
|
144
|
+
equal(previous, current))) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
return emit();
|
|
148
|
+
function emit() {
|
|
149
|
+
context.previous = current;
|
|
150
|
+
context.previousVariables = variables;
|
|
151
|
+
return current;
|
|
152
|
+
}
|
|
153
|
+
}, () => ({})));
|
|
154
|
+
this.pipe = observable.pipe.bind(observable);
|
|
155
|
+
this.subscribe = observable.subscribe.bind(observable);
|
|
156
|
+
this.input = new Subject();
|
|
157
|
+
// we want to feed many streams into `this.subject`, but none of them should
|
|
158
|
+
// be able to close `this.input`
|
|
159
|
+
this.input.complete = () => { };
|
|
160
|
+
this.input.pipe(this.operator).subscribe(this.subject);
|
|
161
|
+
}
|
|
130
162
|
// We can't use Observable['subscribe'] here as the type as it conflicts with
|
|
131
163
|
// the ability to infer T from Subscribable<T>. This limits the surface area
|
|
132
164
|
// to the non-deprecated signature which works properly with type inference.
|
|
@@ -134,122 +166,153 @@ export class ObservableQuery {
|
|
|
134
166
|
pipe;
|
|
135
167
|
[Symbol.observable];
|
|
136
168
|
["@@observable"];
|
|
137
|
-
/**
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
169
|
+
/**
|
|
170
|
+
* @internal
|
|
171
|
+
*
|
|
172
|
+
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
173
|
+
*/
|
|
174
|
+
getCacheDiff({ optimistic = true } = {}) {
|
|
175
|
+
return this.queryManager.cache.diff({
|
|
176
|
+
query: this.query,
|
|
177
|
+
variables: this.variables,
|
|
178
|
+
returnPartialData: true,
|
|
179
|
+
optimistic,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
getInitialResult(initialFetchPolicy) {
|
|
183
|
+
const fetchPolicy = this.queryManager.prioritizeCacheValues ?
|
|
184
|
+
"cache-first"
|
|
185
|
+
: initialFetchPolicy || this.options.fetchPolicy;
|
|
186
|
+
const cacheResult = () => {
|
|
187
|
+
const diff = this.getCacheDiff();
|
|
188
|
+
// TODO: queryInfo.getDiff should handle this since cache.diff returns a
|
|
189
|
+
// null when returnPartialData is false
|
|
190
|
+
const data = this.options.returnPartialData || diff.complete ?
|
|
191
|
+
diff.result ?? undefined
|
|
192
|
+
: undefined;
|
|
193
|
+
return this.maskResult({
|
|
194
|
+
data,
|
|
195
|
+
dataState: diff.complete ? "complete"
|
|
196
|
+
: data === undefined ? "empty"
|
|
197
|
+
: "partial",
|
|
198
|
+
loading: !diff.complete,
|
|
199
|
+
networkStatus: diff.complete ? NetworkStatus.ready : NetworkStatus.loading,
|
|
200
|
+
partial: !diff.complete,
|
|
201
|
+
});
|
|
151
202
|
};
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
this.queryInfo["updateWatch"]();
|
|
203
|
+
switch (fetchPolicy) {
|
|
204
|
+
case "cache-only": {
|
|
205
|
+
return {
|
|
206
|
+
...cacheResult(),
|
|
207
|
+
loading: false,
|
|
208
|
+
networkStatus: NetworkStatus.ready,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
case "cache-first":
|
|
212
|
+
return cacheResult();
|
|
213
|
+
case "cache-and-network":
|
|
214
|
+
return {
|
|
215
|
+
...cacheResult(),
|
|
216
|
+
loading: true,
|
|
217
|
+
networkStatus: NetworkStatus.loading,
|
|
218
|
+
};
|
|
219
|
+
case "standby":
|
|
220
|
+
return empty;
|
|
221
|
+
default:
|
|
222
|
+
return uninitialized;
|
|
173
223
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
224
|
+
}
|
|
225
|
+
resubscribeCache() {
|
|
226
|
+
const { variables, fetchPolicy } = this.options;
|
|
227
|
+
const query = this.query;
|
|
228
|
+
const shouldUnsubscribe = fetchPolicy === "standby" ||
|
|
229
|
+
fetchPolicy === "no-cache" ||
|
|
230
|
+
this.waitForNetworkResult;
|
|
231
|
+
const shouldResubscribe = !isEqualQuery({ query, variables }, this.unsubscribeFromCache) &&
|
|
232
|
+
!this.waitForNetworkResult;
|
|
233
|
+
if (shouldUnsubscribe || shouldResubscribe) {
|
|
234
|
+
this.unsubscribeFromCache?.();
|
|
235
|
+
}
|
|
236
|
+
if (shouldUnsubscribe || !shouldResubscribe) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const watch = {
|
|
240
|
+
query,
|
|
241
|
+
variables,
|
|
242
|
+
optimistic: true,
|
|
243
|
+
watcher: this,
|
|
244
|
+
callback: (diff) => {
|
|
245
|
+
const info = this.queryManager.getDocumentInfo(query);
|
|
246
|
+
if (info.hasClientExports || info.hasForcedResolvers) {
|
|
247
|
+
// If this is not set to something different than `diff`, we will
|
|
248
|
+
// not be notified about future cache changes with an equal `diff`.
|
|
249
|
+
// That would be the case if we are working with client-only fields
|
|
250
|
+
// that are forced or with `exports` fields that might change, causing
|
|
251
|
+
// local resovlers to return a new result.
|
|
252
|
+
// This is based on an implementation detail of `InMemoryCache`, which
|
|
253
|
+
// is not optimal - but the only alternative to this would be to
|
|
254
|
+
// resubscribe to the cache asynchonouly, which would bear the risk of
|
|
255
|
+
// missing further synchronous updates.
|
|
256
|
+
watch.lastDiff = undefined;
|
|
192
257
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
// since the observable will terminate.
|
|
252
|
-
this.isTornDown = false;
|
|
258
|
+
if (watch.lastOwnDiff === diff) {
|
|
259
|
+
// skip cache updates that were caused by our own writes
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const { result: previousResult } = this.subject.getValue();
|
|
263
|
+
if (!diff.complete &&
|
|
264
|
+
// If we are trying to deliver an incomplete cache result, we avoid
|
|
265
|
+
// reporting it if the query has errored, otherwise we let the broadcast try
|
|
266
|
+
// and repair the partial result by refetching the query. This check avoids
|
|
267
|
+
// a situation where a query that errors and another succeeds with
|
|
268
|
+
// overlapping data does not report the partial data result to the errored
|
|
269
|
+
// query.
|
|
270
|
+
//
|
|
271
|
+
// See https://github.com/apollographql/apollo-client/issues/11400 for more
|
|
272
|
+
// information on this issue.
|
|
273
|
+
(previousResult.error ||
|
|
274
|
+
// Prevent to schedule a notify directly after the `ObservableQuery`
|
|
275
|
+
// has been `reset` (which will set the `previousResult` to `uninitialized` or `empty`)
|
|
276
|
+
// as in those cases, `resetCache` will manually call `refetch` with more intentional timing.
|
|
277
|
+
previousResult === uninitialized ||
|
|
278
|
+
previousResult === empty)) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (!equal(previousResult.data, diff.result)) {
|
|
282
|
+
this.scheduleNotify();
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
};
|
|
286
|
+
const cancelWatch = this.queryManager.cache.watch(watch);
|
|
287
|
+
this.unsubscribeFromCache = Object.assign(() => {
|
|
288
|
+
this.unsubscribeFromCache = undefined;
|
|
289
|
+
cancelWatch();
|
|
290
|
+
}, { query, variables });
|
|
291
|
+
}
|
|
292
|
+
stableLastResult;
|
|
293
|
+
getCurrentResult() {
|
|
294
|
+
const { result: current } = this.subject.getValue();
|
|
295
|
+
let value = (
|
|
296
|
+
// if the `current` result is in an error state, we will always return that
|
|
297
|
+
// error state, even if we have no observers
|
|
298
|
+
(current.networkStatus === NetworkStatus.error ||
|
|
299
|
+
// if we have observers, we are watching the cache and
|
|
300
|
+
// this.subject.getValue() will always be up to date
|
|
301
|
+
this.hasObservers() || // if we are using a `no-cache` fetch policy in which case this
|
|
302
|
+
// `ObservableQuery` cannot have been updated from the outside - in
|
|
303
|
+
// that case, we prefer to keep the current value
|
|
304
|
+
this.options.fetchPolicy === "no-cache")) ?
|
|
305
|
+
current
|
|
306
|
+
// otherwise, the `current` value might be outdated due to missed
|
|
307
|
+
// external updates - calculate it again
|
|
308
|
+
: this.getInitialResult();
|
|
309
|
+
if (value === uninitialized) {
|
|
310
|
+
value = this.getInitialResult();
|
|
311
|
+
}
|
|
312
|
+
if (!equal(this.stableLastResult, value)) {
|
|
313
|
+
this.stableLastResult = value;
|
|
314
|
+
}
|
|
315
|
+
return this.stableLastResult;
|
|
253
316
|
}
|
|
254
317
|
/**
|
|
255
318
|
* Update the variables of this observable query, and fetch the new results.
|
|
@@ -259,6 +322,7 @@ export class ObservableQuery {
|
|
|
259
322
|
* the previous values of those variables will be used.
|
|
260
323
|
*/
|
|
261
324
|
refetch(variables) {
|
|
325
|
+
const { fetchPolicy } = this.options;
|
|
262
326
|
const reobserveOptions = {
|
|
263
327
|
// Always disable polling for refetches.
|
|
264
328
|
pollInterval: 0,
|
|
@@ -266,7 +330,6 @@ export class ObservableQuery {
|
|
|
266
330
|
// Unless the provided fetchPolicy always consults the network
|
|
267
331
|
// (no-cache, network-only, or cache-and-network), override it with
|
|
268
332
|
// network-only to force the refetch for this fetchQuery call.
|
|
269
|
-
const { fetchPolicy } = this.options;
|
|
270
333
|
if (fetchPolicy === "no-cache") {
|
|
271
334
|
reobserveOptions.fetchPolicy = "no-cache";
|
|
272
335
|
}
|
|
@@ -277,35 +340,37 @@ export class ObservableQuery {
|
|
|
277
340
|
const queryDef = getQueryDefinition(this.query);
|
|
278
341
|
const vars = queryDef.variableDefinitions;
|
|
279
342
|
if (!vars || !vars.some((v) => v.variable.name.value === "variables")) {
|
|
280
|
-
__DEV__ && invariant.warn(
|
|
343
|
+
__DEV__ && invariant.warn(79, variables, queryDef.name?.value || queryDef);
|
|
281
344
|
}
|
|
282
345
|
}
|
|
283
|
-
if (variables && !equal(this.
|
|
346
|
+
if (variables && !equal(this.variables, variables)) {
|
|
284
347
|
// Update the existing options with new variables
|
|
285
|
-
reobserveOptions.variables = this.options.variables =
|
|
286
|
-
...this.
|
|
287
|
-
...variables,
|
|
288
|
-
};
|
|
348
|
+
reobserveOptions.variables = this.options.variables =
|
|
349
|
+
this.getVariablesWithDefaults({ ...this.variables, ...variables });
|
|
289
350
|
}
|
|
290
|
-
this.
|
|
291
|
-
return this.
|
|
292
|
-
|
|
293
|
-
[newNetworkStatusSymbol]: NetworkStatus.refetch,
|
|
351
|
+
this._lastWrite = undefined;
|
|
352
|
+
return this._reobserve(reobserveOptions, {
|
|
353
|
+
newNetworkStatus: NetworkStatus.refetch,
|
|
294
354
|
});
|
|
295
355
|
}
|
|
296
356
|
/**
|
|
297
357
|
* A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/).
|
|
298
358
|
*/
|
|
299
|
-
fetchMore(
|
|
359
|
+
fetchMore({ query, variables, context, errorPolicy, updateQuery, }) {
|
|
360
|
+
invariant(
|
|
361
|
+
this.options.fetchPolicy !== "cache-only",
|
|
362
|
+
80,
|
|
363
|
+
getOperationName(this.query, "(anonymous)")
|
|
364
|
+
);
|
|
300
365
|
const combinedOptions = {
|
|
301
|
-
...(
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
366
|
+
...compact(this.options, { errorPolicy: "none" }, {
|
|
367
|
+
query,
|
|
368
|
+
context,
|
|
369
|
+
errorPolicy,
|
|
370
|
+
}),
|
|
371
|
+
variables: (query ? variables : ({
|
|
372
|
+
...this.variables,
|
|
373
|
+
...variables,
|
|
309
374
|
})),
|
|
310
375
|
// The fetchMore request goes immediately to the network and does
|
|
311
376
|
// not automatically write its result to the cache (hence no-cache
|
|
@@ -313,38 +378,37 @@ export class ObservableQuery {
|
|
|
313
378
|
// fetchMore to provide an updateQuery callback that determines how
|
|
314
379
|
// the data gets written to the cache.
|
|
315
380
|
fetchPolicy: "no-cache",
|
|
381
|
+
notifyOnNetworkStatusChange: this.options.notifyOnNetworkStatusChange,
|
|
316
382
|
};
|
|
317
383
|
combinedOptions.query = this.transformDocument(combinedOptions.query);
|
|
318
|
-
const qid = this.queryManager.generateQueryId();
|
|
319
384
|
// If a temporary query is passed to `fetchMore`, we don't want to store
|
|
320
385
|
// it as the last query result since it may be an optimized query for
|
|
321
386
|
// pagination. We will however run the transforms on the original document
|
|
322
387
|
// as well as the document passed in `fetchMoreOptions` to ensure the cache
|
|
323
388
|
// uses the most up-to-date document which may rely on runtime conditionals.
|
|
324
389
|
this.lastQuery =
|
|
325
|
-
|
|
390
|
+
query ?
|
|
326
391
|
this.transformDocument(this.options.query)
|
|
327
392
|
: combinedOptions.query;
|
|
328
|
-
|
|
329
|
-
// result.networkStatus === NetworkStatus.fetchMore.
|
|
330
|
-
const originalNetworkStatus = this.networkStatus;
|
|
331
|
-
this.networkStatus = NetworkStatus.fetchMore;
|
|
332
|
-
if (combinedOptions.notifyOnNetworkStatusChange) {
|
|
333
|
-
this.observe();
|
|
334
|
-
}
|
|
335
|
-
const updatedQuerySet = new Set();
|
|
336
|
-
const updateQuery = fetchMoreOptions?.updateQuery;
|
|
393
|
+
let wasUpdated = false;
|
|
337
394
|
const isCached = this.options.fetchPolicy !== "no-cache";
|
|
338
395
|
if (!isCached) {
|
|
339
|
-
invariant(updateQuery,
|
|
396
|
+
invariant(updateQuery, 81);
|
|
340
397
|
}
|
|
398
|
+
const { finalize, pushNotification } = this.pushOperation(NetworkStatus.fetchMore);
|
|
399
|
+
pushNotification({
|
|
400
|
+
source: "newNetworkStatus",
|
|
401
|
+
kind: "N",
|
|
402
|
+
value: {},
|
|
403
|
+
}, { shouldEmit: 3 /* EmitBehavior.networkStatusChange */ });
|
|
341
404
|
return this.queryManager
|
|
342
|
-
.fetchQuery(
|
|
405
|
+
.fetchQuery(combinedOptions, NetworkStatus.fetchMore)
|
|
343
406
|
.then((fetchMoreResult) => {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
407
|
+
// disable the `fetchMore` override that is currently active
|
|
408
|
+
// the next updates caused by this should not be `fetchMore` anymore,
|
|
409
|
+
// but `ready` or whatever other calculated loading state is currently
|
|
410
|
+
// appropriate
|
|
411
|
+
finalize();
|
|
348
412
|
if (isCached) {
|
|
349
413
|
// Performing this cache update inside a cache.batch transaction ensures
|
|
350
414
|
// any affected cache.watch watchers are notified at most once about any
|
|
@@ -353,7 +417,6 @@ export class ObservableQuery {
|
|
|
353
417
|
// fetchMore cache results back to this ObservableQuery.
|
|
354
418
|
this.queryManager.cache.batch({
|
|
355
419
|
update: (cache) => {
|
|
356
|
-
const { updateQuery } = fetchMoreOptions;
|
|
357
420
|
if (updateQuery) {
|
|
358
421
|
cache.updateQuery({
|
|
359
422
|
query: this.query,
|
|
@@ -379,9 +442,9 @@ export class ObservableQuery {
|
|
|
379
442
|
}
|
|
380
443
|
},
|
|
381
444
|
onWatchUpdated: (watch) => {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
445
|
+
if (watch.watcher === this) {
|
|
446
|
+
wasUpdated = true;
|
|
447
|
+
}
|
|
385
448
|
},
|
|
386
449
|
});
|
|
387
450
|
}
|
|
@@ -400,28 +463,41 @@ export class ObservableQuery {
|
|
|
400
463
|
// adjustment to the types on `updateQuery` since that function
|
|
401
464
|
// expects that the first argument always contains previous result
|
|
402
465
|
// data, but not `undefined`.
|
|
403
|
-
const lastResult = this.
|
|
466
|
+
const lastResult = this.getCurrentResult();
|
|
404
467
|
const data = updateQuery(lastResult.data, {
|
|
405
468
|
fetchMoreResult: fetchMoreResult.data,
|
|
406
469
|
variables: combinedOptions.variables,
|
|
407
470
|
});
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
471
|
+
// was reportResult
|
|
472
|
+
pushNotification({
|
|
473
|
+
kind: "N",
|
|
474
|
+
value: {
|
|
475
|
+
...lastResult,
|
|
476
|
+
networkStatus: NetworkStatus.ready,
|
|
477
|
+
// will be overwritten anyways, just here for types sake
|
|
478
|
+
loading: false,
|
|
479
|
+
data: data,
|
|
480
|
+
dataState: lastResult.dataState === "streaming" ? "streaming" : "complete",
|
|
481
|
+
},
|
|
482
|
+
source: "network",
|
|
483
|
+
});
|
|
414
484
|
}
|
|
415
485
|
return this.maskResult(fetchMoreResult);
|
|
416
486
|
})
|
|
417
487
|
.finally(() => {
|
|
488
|
+
// call `finalize` a second time in case the `.then` case above was not reached
|
|
489
|
+
finalize();
|
|
418
490
|
// In case the cache writes above did not generate a broadcast
|
|
419
491
|
// notification (which would have been intercepted by onWatchUpdated),
|
|
420
492
|
// likely because the written data were the same as what was already in
|
|
421
493
|
// the cache, we still want fetchMore to deliver its final loading:false
|
|
422
494
|
// result with the unchanged data.
|
|
423
|
-
if (isCached && !
|
|
424
|
-
|
|
495
|
+
if (isCached && !wasUpdated) {
|
|
496
|
+
pushNotification({
|
|
497
|
+
kind: "N",
|
|
498
|
+
source: "newNetworkStatus",
|
|
499
|
+
value: {},
|
|
500
|
+
}, { shouldEmit: 1 /* EmitBehavior.force */ });
|
|
425
501
|
}
|
|
426
502
|
});
|
|
427
503
|
}
|
|
@@ -449,7 +525,7 @@ export class ObservableQuery {
|
|
|
449
525
|
onError(error);
|
|
450
526
|
}
|
|
451
527
|
else {
|
|
452
|
-
__DEV__ && invariant.error(
|
|
528
|
+
__DEV__ && invariant.error(82, error);
|
|
453
529
|
}
|
|
454
530
|
return;
|
|
455
531
|
}
|
|
@@ -468,10 +544,15 @@ export class ObservableQuery {
|
|
|
468
544
|
}
|
|
469
545
|
};
|
|
470
546
|
}
|
|
471
|
-
/**
|
|
472
|
-
|
|
547
|
+
/**
|
|
548
|
+
* @internal
|
|
549
|
+
*
|
|
550
|
+
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
551
|
+
*/
|
|
552
|
+
applyOptions(newOptions) {
|
|
473
553
|
const mergedOptions = compact(this.options, newOptions || {});
|
|
474
554
|
assign(this.options, mergedOptions);
|
|
555
|
+
this.updatePolling();
|
|
475
556
|
}
|
|
476
557
|
/**
|
|
477
558
|
* Update the variables of this observable query, and fetch the new results
|
|
@@ -492,23 +573,23 @@ export class ObservableQuery {
|
|
|
492
573
|
* the previous values of those variables will be used.
|
|
493
574
|
*/
|
|
494
575
|
async setVariables(variables) {
|
|
576
|
+
variables = this.getVariablesWithDefaults(variables);
|
|
495
577
|
if (equal(this.variables, variables)) {
|
|
496
578
|
// If we have no observers, then we don't actually want to make a network
|
|
497
579
|
// request. As soon as someone observes the query, the request will kick
|
|
498
580
|
// off. For now, we just store any changes. (See #1077)
|
|
499
|
-
return toQueryResult(this.
|
|
581
|
+
return toQueryResult(this.getCurrentResult());
|
|
500
582
|
}
|
|
501
583
|
this.options.variables = variables;
|
|
502
584
|
// See comment above
|
|
503
585
|
if (!this.hasObservers()) {
|
|
504
|
-
return toQueryResult(this.
|
|
586
|
+
return toQueryResult(this.getCurrentResult());
|
|
505
587
|
}
|
|
506
|
-
return this.
|
|
588
|
+
return this._reobserve({
|
|
507
589
|
// Reset options.fetchPolicy to its original value.
|
|
508
590
|
fetchPolicy: this.options.initialFetchPolicy,
|
|
509
591
|
variables,
|
|
510
|
-
|
|
511
|
-
});
|
|
592
|
+
}, { newNetworkStatus: NetworkStatus.setVariables });
|
|
512
593
|
}
|
|
513
594
|
/**
|
|
514
595
|
* A function that enables you to update the query's cached result without executing a followup GraphQL operation.
|
|
@@ -517,12 +598,7 @@ export class ObservableQuery {
|
|
|
517
598
|
*/
|
|
518
599
|
updateQuery(mapFn) {
|
|
519
600
|
const { queryManager } = this;
|
|
520
|
-
const { result, complete } =
|
|
521
|
-
query: this.options.query,
|
|
522
|
-
variables: this.variables,
|
|
523
|
-
returnPartialData: true,
|
|
524
|
-
optimistic: false,
|
|
525
|
-
});
|
|
601
|
+
const { result, complete } = this.getCacheDiff({ optimistic: false });
|
|
526
602
|
const newResult = mapFn(result, {
|
|
527
603
|
variables: this.variables,
|
|
528
604
|
complete: !!complete,
|
|
@@ -574,12 +650,7 @@ export class ObservableQuery {
|
|
|
574
650
|
// that end, the options.nextFetchPolicy option provides an easy way to
|
|
575
651
|
// update options.fetchPolicy after the initial network request, without
|
|
576
652
|
// having to call observableQuery.reobserve.
|
|
577
|
-
options.fetchPolicy = options.nextFetchPolicy(fetchPolicy, {
|
|
578
|
-
reason,
|
|
579
|
-
options,
|
|
580
|
-
observable: this,
|
|
581
|
-
initialFetchPolicy,
|
|
582
|
-
});
|
|
653
|
+
options.fetchPolicy = options.nextFetchPolicy.call(options, fetchPolicy, { reason, options, observable: this, initialFetchPolicy });
|
|
583
654
|
}
|
|
584
655
|
else if (reason === "variables-changed") {
|
|
585
656
|
options.fetchPolicy = initialFetchPolicy;
|
|
@@ -590,38 +661,133 @@ export class ObservableQuery {
|
|
|
590
661
|
}
|
|
591
662
|
return options.fetchPolicy;
|
|
592
663
|
}
|
|
593
|
-
fetch(options,
|
|
664
|
+
fetch(options, networkStatus, fetchQuery, operator) {
|
|
594
665
|
// TODO Make sure we update the networkStatus (and infer fetchVariables)
|
|
595
666
|
// before actually committing to the fetch.
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
|
|
667
|
+
const initialFetchPolicy = this.options.fetchPolicy;
|
|
668
|
+
options.context ??= {};
|
|
669
|
+
let synchronouslyEmitted = false;
|
|
670
|
+
const onCacheHit = () => {
|
|
671
|
+
synchronouslyEmitted = true;
|
|
672
|
+
};
|
|
673
|
+
const fetchQueryOperator = // we cannot use `tap` here, since it allows only for a "before subscription"
|
|
674
|
+
|
|
675
|
+
// hook with `subscribe` and we care for "directly before and after subscription"
|
|
676
|
+
(source) => new Observable((subscriber) => {
|
|
677
|
+
try {
|
|
678
|
+
return source.subscribe({
|
|
679
|
+
next(value) {
|
|
680
|
+
synchronouslyEmitted = true;
|
|
681
|
+
subscriber.next(value);
|
|
682
|
+
},
|
|
683
|
+
error: (error) => subscriber.error(error),
|
|
684
|
+
complete: () => subscriber.complete(),
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
finally {
|
|
688
|
+
if (!synchronouslyEmitted) {
|
|
689
|
+
operation.override = networkStatus;
|
|
690
|
+
this.input.next({
|
|
691
|
+
kind: "N",
|
|
692
|
+
source: "newNetworkStatus",
|
|
693
|
+
value: {
|
|
694
|
+
resetError: true,
|
|
695
|
+
},
|
|
696
|
+
query,
|
|
697
|
+
variables,
|
|
698
|
+
meta: {
|
|
699
|
+
shouldEmit: 3 /* EmitBehavior.networkStatusChange */,
|
|
700
|
+
/*
|
|
701
|
+
* The moment this notification is emitted, `nextFetchPolicy`
|
|
702
|
+
* might already have switched from a `network-only` to a
|
|
703
|
+
* `cache-something` policy, so we want to ensure that the
|
|
704
|
+
* loading state emit doesn't accidentally read from the cache
|
|
705
|
+
* in those cases.
|
|
706
|
+
*/
|
|
707
|
+
fetchPolicy: initialFetchPolicy,
|
|
708
|
+
},
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
let { observable, fromLink } = this.queryManager.fetchObservableWithInfo(options, {
|
|
714
|
+
networkStatus,
|
|
715
|
+
query: fetchQuery,
|
|
716
|
+
onCacheHit,
|
|
717
|
+
fetchQueryOperator,
|
|
718
|
+
observableQuery: this,
|
|
719
|
+
});
|
|
720
|
+
// track query and variables from the start of the operation
|
|
721
|
+
const { query, variables } = this;
|
|
722
|
+
const operation = {
|
|
723
|
+
abort: () => {
|
|
724
|
+
subscription.unsubscribe();
|
|
725
|
+
},
|
|
726
|
+
query,
|
|
727
|
+
variables,
|
|
728
|
+
};
|
|
729
|
+
this.activeOperations.add(operation);
|
|
730
|
+
let forceFirstValueEmit = networkStatus == NetworkStatus.refetch ||
|
|
731
|
+
networkStatus == NetworkStatus.setVariables;
|
|
732
|
+
observable = observable.pipe(operator, share());
|
|
733
|
+
const subscription = observable
|
|
734
|
+
.pipe(tap({
|
|
735
|
+
next: (notification) => {
|
|
736
|
+
if (notification.source === "newNetworkStatus" ||
|
|
737
|
+
(notification.kind === "N" && notification.value.loading)) {
|
|
738
|
+
operation.override = networkStatus;
|
|
739
|
+
}
|
|
740
|
+
else {
|
|
741
|
+
delete operation.override;
|
|
742
|
+
}
|
|
743
|
+
},
|
|
744
|
+
finalize: () => this.activeOperations.delete(operation),
|
|
745
|
+
}))
|
|
746
|
+
.subscribe({
|
|
747
|
+
next: (value) => {
|
|
748
|
+
const meta = {};
|
|
749
|
+
if (forceFirstValueEmit &&
|
|
750
|
+
value.kind === "N" &&
|
|
751
|
+
"loading" in value.value &&
|
|
752
|
+
!value.value.loading) {
|
|
753
|
+
forceFirstValueEmit = false;
|
|
754
|
+
meta.shouldEmit = 1 /* EmitBehavior.force */;
|
|
755
|
+
}
|
|
756
|
+
this.input.next({ ...value, query, variables, meta });
|
|
757
|
+
},
|
|
758
|
+
});
|
|
759
|
+
return { fromLink, subscription, observable };
|
|
599
760
|
}
|
|
600
761
|
// Turns polling on or off based on this.options.pollInterval.
|
|
762
|
+
didWarnCacheOnlyPolling = false;
|
|
601
763
|
updatePolling() {
|
|
602
764
|
// Avoid polling in SSR mode
|
|
603
765
|
if (this.queryManager.ssrMode) {
|
|
604
766
|
return;
|
|
605
767
|
}
|
|
606
|
-
const { pollingInfo, options: { pollInterval }, } = this;
|
|
607
|
-
if (!pollInterval || !this.hasObservers()) {
|
|
608
|
-
if (
|
|
609
|
-
|
|
610
|
-
|
|
768
|
+
const { pollingInfo, options: { fetchPolicy, pollInterval }, } = this;
|
|
769
|
+
if (!pollInterval || !this.hasObservers() || fetchPolicy === "cache-only") {
|
|
770
|
+
if (__DEV__) {
|
|
771
|
+
if (!this.didWarnCacheOnlyPolling &&
|
|
772
|
+
pollInterval &&
|
|
773
|
+
fetchPolicy === "cache-only") {
|
|
774
|
+
__DEV__ && invariant.warn(83, getOperationName(this.query, "(anonymous)"));
|
|
775
|
+
this.didWarnCacheOnlyPolling = true;
|
|
776
|
+
}
|
|
611
777
|
}
|
|
778
|
+
this.cancelPolling();
|
|
612
779
|
return;
|
|
613
780
|
}
|
|
614
|
-
if (pollingInfo
|
|
781
|
+
if (pollingInfo?.interval === pollInterval) {
|
|
615
782
|
return;
|
|
616
783
|
}
|
|
617
|
-
invariant(pollInterval, 70);
|
|
618
784
|
const info = pollingInfo || (this.pollingInfo = {});
|
|
619
785
|
info.interval = pollInterval;
|
|
620
786
|
const maybeFetch = () => {
|
|
621
787
|
if (this.pollingInfo) {
|
|
622
788
|
if (!isNetworkRequestInFlight(this.networkStatus) &&
|
|
623
789
|
!this.options.skipPollAttempt?.()) {
|
|
624
|
-
this.
|
|
790
|
+
this._reobserve({
|
|
625
791
|
// Most fetchPolicy options don't make sense to use in a polling context, as
|
|
626
792
|
// users wouldn't want to be polling the cache directly. However, network-only and
|
|
627
793
|
// no-cache are both useful for when the user wants to control whether or not the
|
|
@@ -629,7 +795,8 @@ export class ObservableQuery {
|
|
|
629
795
|
fetchPolicy: this.options.initialFetchPolicy === "no-cache" ?
|
|
630
796
|
"no-cache"
|
|
631
797
|
: "network-only",
|
|
632
|
-
|
|
798
|
+
}, {
|
|
799
|
+
newNetworkStatus: NetworkStatus.poll,
|
|
633
800
|
}).then(poll, poll);
|
|
634
801
|
}
|
|
635
802
|
else {
|
|
@@ -646,45 +813,34 @@ export class ObservableQuery {
|
|
|
646
813
|
};
|
|
647
814
|
poll();
|
|
648
815
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
816
|
+
// This differs from stopPolling in that it does not set pollInterval to 0
|
|
817
|
+
cancelPolling() {
|
|
818
|
+
if (this.pollingInfo) {
|
|
819
|
+
clearTimeout(this.pollingInfo.timeout);
|
|
820
|
+
delete this.pollingInfo;
|
|
654
821
|
}
|
|
655
|
-
return (this.last = {
|
|
656
|
-
result: this.queryManager.assumeImmutableResults ?
|
|
657
|
-
newResult
|
|
658
|
-
: cloneDeep(newResult),
|
|
659
|
-
variables,
|
|
660
|
-
...(error ? { error } : null),
|
|
661
|
-
});
|
|
662
822
|
}
|
|
663
823
|
/**
|
|
664
824
|
* Reevaluate the query, optionally against new options. New options will be
|
|
665
825
|
* merged with the current options when given.
|
|
666
826
|
*/
|
|
667
827
|
reobserve(newOptions) {
|
|
828
|
+
return this._reobserve(newOptions);
|
|
829
|
+
}
|
|
830
|
+
_reobserve(newOptions, internalOptions) {
|
|
668
831
|
this.isTornDown = false;
|
|
669
|
-
let newNetworkStatus;
|
|
670
|
-
|
|
671
|
-
newNetworkStatus = newOptions[newNetworkStatusSymbol];
|
|
672
|
-
// Avoid setting the symbol option in this.options
|
|
673
|
-
delete newOptions[newNetworkStatusSymbol];
|
|
674
|
-
}
|
|
832
|
+
let { newNetworkStatus } = internalOptions || {};
|
|
833
|
+
this.queryManager.obsQueries.add(this);
|
|
675
834
|
const useDisposableObservable =
|
|
676
835
|
// Refetching uses a disposable Observable to allow refetches using different
|
|
677
|
-
// options
|
|
836
|
+
// options, without permanently altering the options of the
|
|
678
837
|
// original ObservableQuery.
|
|
679
838
|
newNetworkStatus === NetworkStatus.refetch ||
|
|
680
|
-
// The fetchMore method does not actually call the reobserve method, but,
|
|
681
|
-
// if it did, it would definitely use a disposable Observable.
|
|
682
|
-
newNetworkStatus === NetworkStatus.fetchMore ||
|
|
683
839
|
// Polling uses a disposable Observable so the polling options (which force
|
|
684
840
|
// fetchPolicy to be "network-only" or "no-cache") won't override the original options.
|
|
685
841
|
newNetworkStatus === NetworkStatus.poll;
|
|
686
842
|
// Save the old variables, since Object.assign may modify them below.
|
|
687
|
-
const oldVariables = this.
|
|
843
|
+
const oldVariables = this.variables;
|
|
688
844
|
const oldFetchPolicy = this.options.fetchPolicy;
|
|
689
845
|
const mergedOptions = compact(this.options, newOptions || {});
|
|
690
846
|
const options = useDisposableObservable ?
|
|
@@ -698,6 +854,16 @@ export class ObservableQuery {
|
|
|
698
854
|
// time a request is made against the original query.
|
|
699
855
|
const query = this.transformDocument(options.query);
|
|
700
856
|
this.lastQuery = query;
|
|
857
|
+
// Reevaluate variables to allow resetting variables with variables: undefined,
|
|
858
|
+
// otherwise `compact` will ignore the `variables` key in `newOptions`. We
|
|
859
|
+
// do this after we run the query transform to ensure we get default
|
|
860
|
+
// variables from the transformed query.
|
|
861
|
+
//
|
|
862
|
+
// Note: updating options.variables may mutate this.options.variables
|
|
863
|
+
// in the case of a non-disposable query. This is intentional.
|
|
864
|
+
if (newOptions && "variables" in newOptions) {
|
|
865
|
+
options.variables = this.getVariablesWithDefaults(newOptions.variables);
|
|
866
|
+
}
|
|
701
867
|
if (!useDisposableObservable) {
|
|
702
868
|
// We can skip calling updatePolling if we're not changing this.options.
|
|
703
869
|
this.updatePolling();
|
|
@@ -714,6 +880,7 @@ export class ObservableQuery {
|
|
|
714
880
|
// A `nextFetchPolicy` function has even higher priority, though,
|
|
715
881
|
// so in that case `applyNextFetchPolicy` must be called.
|
|
716
882
|
typeof options.nextFetchPolicy === "function")) {
|
|
883
|
+
// This might mutate options.fetchPolicy
|
|
717
884
|
this.applyNextFetchPolicy("variables-changed", options);
|
|
718
885
|
if (newNetworkStatus === void 0) {
|
|
719
886
|
newNetworkStatus = NetworkStatus.setVariables;
|
|
@@ -728,181 +895,336 @@ export class ObservableQuery {
|
|
|
728
895
|
!equal(newOptions.variables, oldVariables)) {
|
|
729
896
|
newNetworkStatus = NetworkStatus.setVariables;
|
|
730
897
|
}
|
|
898
|
+
// QueryManager does not emit any values for standby fetch policies so we
|
|
899
|
+
// want ensure that the networkStatus remains ready.
|
|
900
|
+
if (options.fetchPolicy === "standby") {
|
|
901
|
+
newNetworkStatus = NetworkStatus.ready;
|
|
902
|
+
}
|
|
731
903
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
904
|
+
if (options.fetchPolicy === "standby") {
|
|
905
|
+
this.cancelPolling();
|
|
906
|
+
}
|
|
907
|
+
this.resubscribeCache();
|
|
908
|
+
const { promise, operator: promiseOperator } = getTrackingOperatorPromise((value) => {
|
|
909
|
+
switch (value.kind) {
|
|
910
|
+
case "E":
|
|
911
|
+
throw value.error;
|
|
912
|
+
case "N":
|
|
913
|
+
if (value.source !== "newNetworkStatus" && !value.value.loading)
|
|
914
|
+
return value.value;
|
|
737
915
|
}
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
finishWaitingForOwnResult();
|
|
748
|
-
this.reportResult(result, variables);
|
|
749
|
-
}
|
|
750
|
-
},
|
|
751
|
-
error: (error) => {
|
|
752
|
-
if (equal(this.variables, variables)) {
|
|
753
|
-
finishWaitingForOwnResult();
|
|
754
|
-
this.reportError(error, variables);
|
|
755
|
-
}
|
|
756
|
-
},
|
|
757
|
-
};
|
|
916
|
+
},
|
|
917
|
+
// This default value should only be used when using a `fetchPolicy` of
|
|
918
|
+
// `standby` since that fetch policy completes without emitting a
|
|
919
|
+
// result. Since we are converting this to a QueryResult type, we
|
|
920
|
+
// omit the extra fields from ApolloQueryResult in the default value.
|
|
921
|
+
options.fetchPolicy === "standby" ?
|
|
922
|
+
{ data: undefined }
|
|
923
|
+
: undefined);
|
|
924
|
+
const { subscription, observable, fromLink } = this.fetch(options, newNetworkStatus, query, promiseOperator);
|
|
758
925
|
if (!useDisposableObservable && (fromLink || !this.linkSubscription)) {
|
|
759
926
|
if (this.linkSubscription) {
|
|
760
927
|
this.linkSubscription.unsubscribe();
|
|
761
928
|
}
|
|
762
|
-
this.
|
|
763
|
-
this.linkSubscription = observable.subscribe(observer);
|
|
929
|
+
this.linkSubscription = subscription;
|
|
764
930
|
}
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
this.reportResult(
|
|
784
|
-
// Passing false is important so that this.getCurrentResult doesn't
|
|
785
|
-
// save the fetchMore result as this.lastResult, causing it to be
|
|
786
|
-
// ignored due to the this.isDifferentFromLastResult check in
|
|
787
|
-
// this.reportResult.
|
|
788
|
-
this.getCurrentFullResult(false), this.variables);
|
|
789
|
-
}
|
|
790
|
-
reportResult(result, variables) {
|
|
791
|
-
const lastError = this.getLastError();
|
|
792
|
-
const isDifferent = this.isDifferentFromLastResult(result, variables);
|
|
793
|
-
// Update the last result even when isDifferentFromLastResult returns false,
|
|
794
|
-
// because the query may be using the @nonreactive directive, and we want to
|
|
795
|
-
// save the the latest version of any nonreactive subtrees (in case
|
|
796
|
-
// getCurrentResult is called), even though we skip broadcasting changes.
|
|
797
|
-
this.updateLastResult(result, variables);
|
|
798
|
-
this.networkStatus = result.networkStatus;
|
|
799
|
-
if (lastError || isDifferent) {
|
|
800
|
-
this.subject.next(this.maskResult(result));
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
reportError(error, variables) {
|
|
804
|
-
// Since we don't get the current result on errors, only the error, we
|
|
805
|
-
// must mirror the updates that occur in QueryStore.markQueryError here
|
|
806
|
-
const errorResult = {
|
|
807
|
-
data: undefined,
|
|
808
|
-
partial: true,
|
|
809
|
-
...this.getLastResult(),
|
|
810
|
-
error,
|
|
811
|
-
networkStatus: NetworkStatus.error,
|
|
812
|
-
loading: false,
|
|
813
|
-
};
|
|
814
|
-
this.updateLastResult(errorResult, variables);
|
|
815
|
-
this.networkStatus = NetworkStatus.error;
|
|
816
|
-
this.last.error = error;
|
|
817
|
-
this.subject.next(errorResult);
|
|
931
|
+
const ret = Object.assign(preventUnhandledRejection(promise
|
|
932
|
+
.then((result) => toQueryResult(this.maskResult(result)))
|
|
933
|
+
.finally(() => {
|
|
934
|
+
if (!this.hasObservers() && this.activeOperations.size === 0) {
|
|
935
|
+
// If `reobserve` was called on a query without any obervers,
|
|
936
|
+
// the teardown logic would never be called, so we need to
|
|
937
|
+
// call it here to ensure the query is properly torn down.
|
|
938
|
+
this.tearDownQuery();
|
|
939
|
+
}
|
|
940
|
+
})), {
|
|
941
|
+
retain: () => {
|
|
942
|
+
const subscription = observable.subscribe({});
|
|
943
|
+
const unsubscribe = () => subscription.unsubscribe();
|
|
944
|
+
promise.then(unsubscribe, unsubscribe);
|
|
945
|
+
return ret;
|
|
946
|
+
},
|
|
947
|
+
});
|
|
948
|
+
return ret;
|
|
818
949
|
}
|
|
819
950
|
hasObservers() {
|
|
820
951
|
return this.subject.observed;
|
|
821
952
|
}
|
|
953
|
+
/**
|
|
954
|
+
* Tears down the `ObservableQuery` and stops all active operations by sending a `complete` notification.
|
|
955
|
+
*/
|
|
956
|
+
stop() {
|
|
957
|
+
this.subject.complete();
|
|
958
|
+
this.initializeObservablesQueue();
|
|
959
|
+
this.tearDownQuery();
|
|
960
|
+
}
|
|
822
961
|
tearDownQuery() {
|
|
823
962
|
if (this.isTornDown)
|
|
824
963
|
return;
|
|
825
|
-
|
|
964
|
+
this.resetNotifications();
|
|
965
|
+
this.unsubscribeFromCache?.();
|
|
966
|
+
if (this.linkSubscription) {
|
|
826
967
|
this.linkSubscription.unsubscribe();
|
|
827
|
-
delete this.linkObservable;
|
|
828
968
|
delete this.linkSubscription;
|
|
829
969
|
}
|
|
830
970
|
this.stopPolling();
|
|
831
971
|
// stop all active GraphQL subscriptions
|
|
832
972
|
this.subscriptions.forEach((sub) => sub.unsubscribe());
|
|
833
973
|
this.subscriptions.clear();
|
|
834
|
-
this.queryManager.
|
|
974
|
+
this.queryManager.obsQueries.delete(this);
|
|
835
975
|
this.isTornDown = true;
|
|
976
|
+
this.abortActiveOperations();
|
|
977
|
+
this._lastWrite = undefined;
|
|
836
978
|
}
|
|
837
979
|
transformDocument(document) {
|
|
838
980
|
return this.queryManager.transform(document);
|
|
839
981
|
}
|
|
840
982
|
maskResult(result) {
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
}),
|
|
850
|
-
}
|
|
851
|
-
: result;
|
|
983
|
+
const masked = this.queryManager.maskOperation({
|
|
984
|
+
document: this.query,
|
|
985
|
+
data: result.data,
|
|
986
|
+
fetchPolicy: this.options.fetchPolicy,
|
|
987
|
+
cause: this,
|
|
988
|
+
});
|
|
989
|
+
// Maintain object identity as much as possible
|
|
990
|
+
return masked === result.data ? result : { ...result, data: masked };
|
|
852
991
|
}
|
|
853
992
|
dirty = false;
|
|
854
993
|
notifyTimeout;
|
|
855
|
-
/**
|
|
994
|
+
/**
|
|
995
|
+
* @internal
|
|
996
|
+
*
|
|
997
|
+
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
998
|
+
*/
|
|
856
999
|
resetNotifications() {
|
|
857
|
-
this.cancelNotifyTimeout();
|
|
858
|
-
this.dirty = false;
|
|
859
|
-
}
|
|
860
|
-
cancelNotifyTimeout() {
|
|
861
1000
|
if (this.notifyTimeout) {
|
|
862
1001
|
clearTimeout(this.notifyTimeout);
|
|
863
1002
|
this.notifyTimeout = void 0;
|
|
864
1003
|
}
|
|
1004
|
+
this.dirty = false;
|
|
865
1005
|
}
|
|
866
|
-
/**
|
|
1006
|
+
/**
|
|
1007
|
+
* @internal
|
|
1008
|
+
*
|
|
1009
|
+
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
1010
|
+
*/
|
|
867
1011
|
scheduleNotify() {
|
|
868
1012
|
if (this.dirty)
|
|
869
1013
|
return;
|
|
870
1014
|
this.dirty = true;
|
|
871
1015
|
if (!this.notifyTimeout) {
|
|
872
|
-
this.notifyTimeout = setTimeout(() => this.notify(), 0);
|
|
1016
|
+
this.notifyTimeout = setTimeout(() => this.notify(true), 0);
|
|
873
1017
|
}
|
|
874
1018
|
}
|
|
875
|
-
/**
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
1019
|
+
/**
|
|
1020
|
+
* @internal
|
|
1021
|
+
*
|
|
1022
|
+
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
1023
|
+
*/
|
|
1024
|
+
notify(scheduled = false) {
|
|
1025
|
+
if (!scheduled) {
|
|
1026
|
+
// For queries with client exports or forced resolvers, we don't want to
|
|
1027
|
+
// synchronously reobserve the cache on broadcast,
|
|
1028
|
+
// but actually wait for the `scheduleNotify` timeout triggered by the
|
|
1029
|
+
// `cache.watch` callback from `resubscribeCache`.
|
|
1030
|
+
const info = this.queryManager.getDocumentInfo(this.query);
|
|
1031
|
+
if (info.hasClientExports || info.hasForcedResolvers) {
|
|
1032
|
+
return;
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
const { dirty } = this;
|
|
1036
|
+
this.resetNotifications();
|
|
1037
|
+
if (dirty &&
|
|
1038
|
+
(this.options.fetchPolicy == "cache-only" ||
|
|
880
1039
|
this.options.fetchPolicy == "cache-and-network" ||
|
|
881
|
-
!
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
1040
|
+
!this.activeOperations.size)) {
|
|
1041
|
+
const diff = this.getCacheDiff();
|
|
1042
|
+
if (
|
|
1043
|
+
// `fromOptimisticTransaction` is not avaiable through the `cache.diff`
|
|
1044
|
+
// code path, so we need to check it this way
|
|
1045
|
+
equal(diff.result, this.getCacheDiff({ optimistic: false }).result)) {
|
|
1046
|
+
//If this diff did not come from an optimistic transaction
|
|
1047
|
+
// make the ObservableQuery "reobserve" the latest data
|
|
1048
|
+
// using a temporary fetch policy of "cache-first", so complete cache
|
|
1049
|
+
// results have a chance to be delivered without triggering additional
|
|
1050
|
+
// network requests, even when options.fetchPolicy is "network-only"
|
|
1051
|
+
// or "cache-and-network". All other fetch policies are preserved by
|
|
1052
|
+
// this method, and are handled by calling oq.reobserve(). If this
|
|
1053
|
+
// reobservation is spurious, distinctUntilChanged still has a
|
|
1054
|
+
// chance to catch it before delivery to ObservableQuery subscribers.
|
|
1055
|
+
this.reobserveCacheFirst();
|
|
1056
|
+
}
|
|
1057
|
+
else {
|
|
1058
|
+
// If this diff came from an optimistic transaction, deliver the
|
|
1059
|
+
// current cache data to the ObservableQuery, but don't perform a
|
|
1060
|
+
// reobservation, since oq.reobserveCacheFirst might make a network
|
|
1061
|
+
// request, and we never want to trigger network requests in the
|
|
1062
|
+
// middle of optimistic updates.
|
|
1063
|
+
this.input.next({
|
|
1064
|
+
kind: "N",
|
|
1065
|
+
value: {
|
|
1066
|
+
data: diff.result,
|
|
1067
|
+
dataState: diff.complete ? "complete"
|
|
1068
|
+
: diff.result ? "partial"
|
|
1069
|
+
: "empty",
|
|
1070
|
+
networkStatus: NetworkStatus.ready,
|
|
1071
|
+
loading: false,
|
|
1072
|
+
error: undefined,
|
|
1073
|
+
partial: !diff.complete,
|
|
1074
|
+
},
|
|
1075
|
+
source: "cache",
|
|
1076
|
+
query: this.query,
|
|
1077
|
+
variables: this.variables,
|
|
1078
|
+
meta: {},
|
|
1079
|
+
});
|
|
902
1080
|
}
|
|
903
1081
|
}
|
|
904
|
-
this.dirty = false;
|
|
905
1082
|
}
|
|
1083
|
+
activeOperations = new Set();
|
|
1084
|
+
pushOperation(networkStatus) {
|
|
1085
|
+
let aborted = false;
|
|
1086
|
+
// track query and variables from the start of the operation
|
|
1087
|
+
const { query, variables } = this;
|
|
1088
|
+
const finalize = () => {
|
|
1089
|
+
this.activeOperations.delete(operation);
|
|
1090
|
+
};
|
|
1091
|
+
const operation = {
|
|
1092
|
+
override: networkStatus,
|
|
1093
|
+
abort: () => {
|
|
1094
|
+
aborted = true;
|
|
1095
|
+
finalize();
|
|
1096
|
+
},
|
|
1097
|
+
query,
|
|
1098
|
+
variables,
|
|
1099
|
+
};
|
|
1100
|
+
this.activeOperations.add(operation);
|
|
1101
|
+
return {
|
|
1102
|
+
finalize,
|
|
1103
|
+
pushNotification: (notification, additionalMeta) => {
|
|
1104
|
+
if (!aborted) {
|
|
1105
|
+
this.input.next({
|
|
1106
|
+
...notification,
|
|
1107
|
+
query,
|
|
1108
|
+
variables,
|
|
1109
|
+
meta: { ...additionalMeta },
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
},
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
calculateNetworkStatus(baseNetworkStatus) {
|
|
1116
|
+
if (baseNetworkStatus === NetworkStatus.streaming) {
|
|
1117
|
+
return baseNetworkStatus;
|
|
1118
|
+
}
|
|
1119
|
+
// in the future, this could be more complex logic, e.g. "refetch" and
|
|
1120
|
+
// "fetchMore" having priority over "polling" or "loading" network statuses
|
|
1121
|
+
// as for now we just take the "latest" operation that is still active,
|
|
1122
|
+
// as that lines up best with previous behavior[]
|
|
1123
|
+
const operation = Array.from(this.activeOperations.values()).findLast((operation) => isEqualQuery(operation, this) && operation.override !== undefined);
|
|
1124
|
+
return operation?.override ?? baseNetworkStatus;
|
|
1125
|
+
}
|
|
1126
|
+
abortActiveOperations() {
|
|
1127
|
+
this.activeOperations.forEach((operation) => operation.abort());
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* @internal
|
|
1131
|
+
* Called from `clearStore`.
|
|
1132
|
+
* * resets the query to its initial state
|
|
1133
|
+
* * cancels all active operations and their subscriptions
|
|
1134
|
+
*
|
|
1135
|
+
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
1136
|
+
*/
|
|
1137
|
+
reset() {
|
|
1138
|
+
// exception for cache-only queries - we reset them into a "ready" state
|
|
1139
|
+
// as we won't trigger a refetch for them
|
|
1140
|
+
const resetToEmpty = this.options.fetchPolicy === "cache-only";
|
|
1141
|
+
this.setResult(resetToEmpty ? empty : uninitialized, {
|
|
1142
|
+
shouldEmit: resetToEmpty ? 1 /* EmitBehavior.force */ : 2 /* EmitBehavior.never */,
|
|
1143
|
+
});
|
|
1144
|
+
this.abortActiveOperations();
|
|
1145
|
+
}
|
|
1146
|
+
/**
|
|
1147
|
+
* @internal
|
|
1148
|
+
*
|
|
1149
|
+
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
1150
|
+
*/
|
|
1151
|
+
setResult(result, additionalMeta) {
|
|
1152
|
+
this.input.next({
|
|
1153
|
+
source: "setResult",
|
|
1154
|
+
kind: "N",
|
|
1155
|
+
value: result,
|
|
1156
|
+
query: this.query,
|
|
1157
|
+
variables: this.variables,
|
|
1158
|
+
meta: { ...additionalMeta },
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
operator = filterMap((notification) => {
|
|
1162
|
+
const { query, variables, meta } = notification;
|
|
1163
|
+
if (notification.source === "setResult") {
|
|
1164
|
+
return { query, variables, result: notification.value, meta };
|
|
1165
|
+
}
|
|
1166
|
+
if (notification.kind === "C" || !isEqualQuery(notification, this)) {
|
|
1167
|
+
return;
|
|
1168
|
+
}
|
|
1169
|
+
let result;
|
|
1170
|
+
const previous = this.subject.getValue();
|
|
1171
|
+
if (notification.source === "cache") {
|
|
1172
|
+
result = notification.value;
|
|
1173
|
+
if (result.networkStatus === NetworkStatus.ready &&
|
|
1174
|
+
result.partial &&
|
|
1175
|
+
(!this.options.returnPartialData ||
|
|
1176
|
+
previous.result.networkStatus === NetworkStatus.error) &&
|
|
1177
|
+
this.options.fetchPolicy !== "cache-only") {
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
else if (notification.source === "network") {
|
|
1182
|
+
if (this.waitForNetworkResult) {
|
|
1183
|
+
this.waitForNetworkResult = false;
|
|
1184
|
+
this.resubscribeCache();
|
|
1185
|
+
}
|
|
1186
|
+
result =
|
|
1187
|
+
notification.kind === "E" ?
|
|
1188
|
+
{
|
|
1189
|
+
...(isEqualQuery(previous, notification) ?
|
|
1190
|
+
previous.result
|
|
1191
|
+
: { data: undefined, dataState: "empty", partial: true }),
|
|
1192
|
+
error: notification.error,
|
|
1193
|
+
networkStatus: NetworkStatus.error,
|
|
1194
|
+
loading: false,
|
|
1195
|
+
}
|
|
1196
|
+
: notification.value;
|
|
1197
|
+
if (notification.kind === "E" && result.dataState === "streaming") {
|
|
1198
|
+
result.dataState = "complete";
|
|
1199
|
+
}
|
|
1200
|
+
if (result.error) {
|
|
1201
|
+
meta.shouldEmit = 1 /* EmitBehavior.force */;
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
else if (notification.source === "newNetworkStatus") {
|
|
1205
|
+
const baseResult = isEqualQuery(previous, notification) ?
|
|
1206
|
+
previous.result
|
|
1207
|
+
: this.getInitialResult(meta.fetchPolicy);
|
|
1208
|
+
const { resetError } = notification.value;
|
|
1209
|
+
const error = resetError ? undefined : baseResult.error;
|
|
1210
|
+
const networkStatus = error ? NetworkStatus.error : NetworkStatus.ready;
|
|
1211
|
+
result = {
|
|
1212
|
+
...baseResult,
|
|
1213
|
+
error,
|
|
1214
|
+
networkStatus,
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
// every code path until here should have either returned or set a result,
|
|
1218
|
+
// but typescript needs a little help
|
|
1219
|
+
invariant(result);
|
|
1220
|
+
// normalize result shape
|
|
1221
|
+
if (!result.error)
|
|
1222
|
+
delete result.error;
|
|
1223
|
+
result.networkStatus = this.calculateNetworkStatus(result.networkStatus);
|
|
1224
|
+
result.loading = isNetworkRequestInFlight(result.networkStatus);
|
|
1225
|
+
result = this.maskResult(result);
|
|
1226
|
+
return { query, variables, result, meta };
|
|
1227
|
+
});
|
|
906
1228
|
// Reobserve with fetchPolicy effectively set to "cache-first", triggering
|
|
907
1229
|
// delivery of any new data from the cache, possibly falling back to the network
|
|
908
1230
|
// if any cache data are missing. This allows _complete_ cache results to be
|
|
@@ -913,7 +1235,7 @@ export class ObservableQuery {
|
|
|
913
1235
|
reobserveCacheFirst() {
|
|
914
1236
|
const { fetchPolicy, nextFetchPolicy } = this.options;
|
|
915
1237
|
if (fetchPolicy === "cache-and-network" || fetchPolicy === "network-only") {
|
|
916
|
-
|
|
1238
|
+
this.reobserve({
|
|
917
1239
|
fetchPolicy: "cache-first",
|
|
918
1240
|
// Use a temporary nextFetchPolicy function that replaces itself with the
|
|
919
1241
|
// previous nextFetchPolicy value and returns the original fetchPolicy.
|
|
@@ -931,17 +1253,58 @@ export class ObservableQuery {
|
|
|
931
1253
|
},
|
|
932
1254
|
});
|
|
933
1255
|
}
|
|
934
|
-
|
|
1256
|
+
else {
|
|
1257
|
+
this.reobserve();
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
getVariablesWithDefaults(variables) {
|
|
1261
|
+
return this.queryManager.getVariables(this.query, variables);
|
|
935
1262
|
}
|
|
936
1263
|
}
|
|
937
1264
|
export function logMissingFieldErrors(missing) {
|
|
938
1265
|
if (__DEV__ && missing) {
|
|
939
|
-
__DEV__ && invariant.debug(
|
|
1266
|
+
__DEV__ && invariant.debug(84, missing);
|
|
940
1267
|
}
|
|
941
1268
|
}
|
|
942
|
-
function
|
|
943
|
-
return (
|
|
944
|
-
|
|
945
|
-
|
|
1269
|
+
function isEqualQuery(a, b) {
|
|
1270
|
+
return !!(a && b && a.query === b.query && equal(a.variables, b.variables));
|
|
1271
|
+
}
|
|
1272
|
+
function getTrackingOperatorPromise(filterMapCb, defaultValue) {
|
|
1273
|
+
let lastValue = defaultValue, resolve, reject;
|
|
1274
|
+
const promise = new Promise((res, rej) => {
|
|
1275
|
+
resolve = res;
|
|
1276
|
+
reject = rej;
|
|
1277
|
+
});
|
|
1278
|
+
const operator = tap({
|
|
1279
|
+
next(value) {
|
|
1280
|
+
try {
|
|
1281
|
+
const newValue = filterMapCb(value);
|
|
1282
|
+
if (newValue !== undefined) {
|
|
1283
|
+
lastValue = newValue;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
catch (error) {
|
|
1287
|
+
reject(error);
|
|
1288
|
+
}
|
|
1289
|
+
},
|
|
1290
|
+
finalize: () => {
|
|
1291
|
+
if (lastValue) {
|
|
1292
|
+
resolve(lastValue);
|
|
1293
|
+
}
|
|
1294
|
+
else {
|
|
1295
|
+
const message = "The operation was aborted.";
|
|
1296
|
+
const name = "AbortError";
|
|
1297
|
+
reject(typeof DOMException !== "undefined" ?
|
|
1298
|
+
new DOMException(message, name)
|
|
1299
|
+
// some environments do not have `DOMException`, e.g. node
|
|
1300
|
+
// uses a normal `Error` with a `name` property instead: https://github.com/phryneas/node/blob/d0579b64f0f6b722f8e49bf8a471dd0d0604a21e/lib/internal/errors.js#L964
|
|
1301
|
+
// error.code is a legacy property that is not used anymore,
|
|
1302
|
+
// and also inconsistent across environments (in supporting
|
|
1303
|
+
// browsers it is `20`, in node `'ABORT_ERR'`) so we omit that.
|
|
1304
|
+
: Object.assign(new Error(message), { name }));
|
|
1305
|
+
}
|
|
1306
|
+
},
|
|
1307
|
+
});
|
|
1308
|
+
return { promise, operator };
|
|
946
1309
|
}
|
|
947
1310
|
//# sourceMappingURL=ObservableQuery.js.map
|