@apollo/client 4.0.12-beta.0 → 4.0.13
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 +10 -194
- package/__cjs/cache/core/cache.cjs +48 -169
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +25 -94
- package/__cjs/cache/core/types/Cache.d.cts +17 -49
- package/__cjs/cache/index.cjs.map +1 -1
- package/__cjs/cache/index.d.cts +1 -1
- package/__cjs/cache/inmemory/entityStore.cjs +4 -6
- package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/fragmentRegistry.cjs +5 -0
- package/__cjs/cache/inmemory/fragmentRegistry.cjs.map +1 -1
- package/__cjs/cache/inmemory/helpers.d.cts +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.cjs +1 -15
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.d.cts +0 -1
- package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
- package/__cjs/cache/inmemory/key-extractor.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.cjs +17 -56
- package/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.d.cts +6 -30
- package/__cjs/cache/inmemory/readFromStore.cjs +3 -3
- package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/types.d.cts +0 -2
- package/__cjs/cache/inmemory/writeToStore.cjs +10 -24
- package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/writeToStore.d.cts +1 -2
- package/__cjs/core/ApolloClient.cjs +49 -31
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +17 -143
- package/__cjs/core/ObservableQuery.cjs +128 -162
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +0 -1
- package/__cjs/core/QueryInfo.cjs +1 -9
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +1 -2
- package/__cjs/core/QueryManager.cjs +24 -46
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/QueryManager.d.cts +2 -18
- package/__cjs/incremental/handlers/defer20220824.cjs +19 -44
- package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -1
- package/__cjs/incremental/handlers/defer20220824.d.cts +7 -15
- package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
- package/__cjs/incremental/handlers/notImplemented.cjs.map +1 -1
- package/__cjs/incremental/index.cjs +1 -3
- package/__cjs/incremental/index.cjs.map +1 -1
- package/__cjs/incremental/index.d.cts +0 -1
- package/__cjs/incremental/types.d.cts +0 -9
- package/__cjs/invariantErrorCodes.cjs +62 -78
- package/__cjs/link/client-awareness/ClientAwarenessLink.cjs +1 -13
- package/__cjs/link/client-awareness/ClientAwarenessLink.cjs.map +1 -1
- package/__cjs/link/client-awareness/ClientAwarenessLink.d.cts +1 -1
- package/__cjs/link/core/ApolloLink.cjs +3 -3
- package/__cjs/link/http/checkFetcher.cjs +1 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
- package/__cjs/link/persisted-queries/index.cjs +2 -2
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs +51 -50
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.d.cts +3 -0
- package/__cjs/link/ws/index.cjs +1 -1
- package/__cjs/local-state/LocalState.cjs +14 -28
- package/__cjs/local-state/LocalState.cjs.map +1 -1
- package/__cjs/local-state/LocalState.d.cts +2 -3
- package/__cjs/masking/types.d.cts +1 -2
- package/__cjs/react/hooks/internal/useDeepMemo.cjs +0 -2
- package/__cjs/react/hooks/internal/useDeepMemo.cjs.map +1 -1
- package/__cjs/react/hooks/useApolloClient.cjs +1 -1
- package/__cjs/react/hooks/useApolloClient.cjs.map +1 -1
- package/__cjs/react/hooks/useApolloClient.d.cts +1 -1
- package/__cjs/react/hooks/useBackgroundQuery.cjs +3 -1
- package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useFragment.cjs +87 -38
- package/__cjs/react/hooks/useFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useFragment.d.cts +6 -65
- package/__cjs/react/hooks/useLazyQuery.cjs +0 -2
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.cjs +1 -7
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.d.cts +1 -13
- package/__cjs/react/hooks/useQuery.cjs +4 -1
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +1 -1
- package/__cjs/react/hooks/useQueryRefHandlers.cjs +3 -1
- package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
- package/__cjs/react/hooks/useReadQuery.cjs +3 -1
- package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSubscription.cjs +1 -1
- package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseFragment.cjs +16 -16
- package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseFragment.d.cts +7 -33
- package/__cjs/react/hooks/useSuspenseQuery.cjs +4 -4
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/internal/cache/FragmentReference.cjs +22 -3
- package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/FragmentReference.d.cts +4 -2
- package/__cjs/react/internal/cache/QueryReference.cjs +0 -16
- package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/QueryReference.d.cts +0 -5
- package/__cjs/react/internal/cache/SuspenseCache.cjs.map +1 -1
- package/__cjs/react/internal/cache/SuspenseCache.d.cts +1 -1
- package/__cjs/react/internal/cache/types.d.cts +2 -2
- package/__cjs/react/query-preloader/createQueryPreloader.cjs +1 -41
- package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
- package/__cjs/react/ssr/useSSRQuery.cjs +0 -1
- package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -1
- package/__cjs/utilities/DeepPartial.cjs.map +1 -1
- package/__cjs/utilities/DeepPartial.d.cts +1 -1
- package/__cjs/utilities/internal/DeepMerger.cjs +4 -36
- package/__cjs/utilities/internal/DeepMerger.cjs.map +1 -1
- package/__cjs/utilities/internal/DeepMerger.d.cts +4 -20
- package/__cjs/utilities/internal/bindCacheKey.cjs +21 -0
- package/__cjs/utilities/internal/bindCacheKey.cjs.map +1 -0
- package/__cjs/utilities/internal/bindCacheKey.d.cts +15 -0
- package/__cjs/utilities/internal/compact.cjs +1 -1
- package/__cjs/utilities/internal/compact.cjs.map +1 -1
- package/__cjs/utilities/internal/constants.cjs +1 -17
- package/__cjs/utilities/internal/constants.cjs.map +1 -1
- package/__cjs/utilities/internal/constants.d.cts +0 -16
- package/__cjs/utilities/internal/getStoreKeyName.cjs +0 -1
- package/__cjs/utilities/internal/getStoreKeyName.cjs.map +1 -1
- package/__cjs/utilities/internal/index.cjs +4 -8
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +2 -4
- package/__cjs/utilities/internal/memoize.cjs +2 -2
- package/__cjs/utilities/internal/memoize.cjs.map +1 -1
- package/__cjs/utilities/internal/memoize.d.cts +1 -2
- package/__cjs/version.cjs +1 -1
- package/__cjs/version.cjs.map +1 -1
- package/cache/core/cache.d.ts +25 -94
- package/cache/core/cache.js +51 -172
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +17 -49
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/index.d.ts +1 -1
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.js +4 -6
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fragmentRegistry.js +6 -1
- package/cache/inmemory/fragmentRegistry.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +0 -1
- package/cache/inmemory/inMemoryCache.js +1 -15
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/policies.d.ts +6 -30
- package/cache/inmemory/policies.js +7 -45
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.js +3 -3
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +0 -2
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +1 -2
- package/cache/inmemory/writeToStore.js +12 -26
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts +17 -143
- package/core/ApolloClient.js +50 -32
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +0 -1
- package/core/ObservableQuery.js +131 -165
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +1 -2
- package/core/QueryInfo.js +2 -10
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +2 -18
- package/core/QueryManager.js +25 -47
- package/core/QueryManager.js.map +1 -1
- package/incremental/handlers/defer20220824.d.ts +7 -15
- package/incremental/handlers/defer20220824.js +19 -44
- package/incremental/handlers/defer20220824.js.map +1 -1
- package/incremental/handlers/notImplemented.js +1 -1
- package/incremental/handlers/notImplemented.js.map +1 -1
- package/incremental/index.d.ts +0 -1
- package/incremental/index.js +2 -3
- package/incremental/index.js.map +1 -1
- package/incremental/types.d.ts +0 -9
- package/incremental/types.js.map +1 -1
- package/invariantErrorCodes.js +62 -78
- package/link/client-awareness/ClientAwarenessLink.d.ts +1 -1
- package/link/client-awareness/ClientAwarenessLink.js +1 -13
- package/link/client-awareness/ClientAwarenessLink.js.map +1 -1
- package/link/core/ApolloLink.js +3 -3
- package/link/http/checkFetcher.js +1 -1
- package/link/http/parseAndCheckHttpResponse.js +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/remove-typename/removeTypenameFromVariables.d.ts +3 -0
- package/link/remove-typename/removeTypenameFromVariables.js +51 -50
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
- package/link/ws/index.js +1 -1
- package/local-state/LocalState.d.ts +2 -3
- package/local-state/LocalState.js +14 -28
- package/local-state/LocalState.js.map +1 -1
- package/masking/types.d.ts +1 -2
- package/masking/types.js.map +1 -1
- package/package.json +1 -15
- package/react/hooks/internal/useDeepMemo.js +0 -2
- package/react/hooks/internal/useDeepMemo.js.map +1 -1
- package/react/hooks/useApolloClient.d.ts +1 -1
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useBackgroundQuery.js +3 -1
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.d.ts +6 -65
- package/react/hooks/useFragment.js +87 -38
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.js +0 -2
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +1 -13
- package/react/hooks/useMutation.js +1 -7
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.js +4 -1
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useQueryRefHandlers.js +3 -1
- package/react/hooks/useQueryRefHandlers.js.map +1 -1
- package/react/hooks/useReadQuery.js +3 -1
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.js +1 -1
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseFragment.d.ts +7 -33
- package/react/hooks/useSuspenseFragment.js +17 -17
- package/react/hooks/useSuspenseFragment.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +4 -4
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks-compiled/internal/useDeepMemo.js +0 -2
- package/react/hooks-compiled/internal/useDeepMemo.js.map +1 -1
- package/react/hooks-compiled/internal/useSuspenseHookCacheKey.js +2 -0
- package/react/hooks-compiled/internal/useSuspenseHookCacheKey.js.map +1 -1
- package/react/hooks-compiled/useApolloClient.d.ts +1 -1
- package/react/hooks-compiled/useApolloClient.js +1 -1
- package/react/hooks-compiled/useApolloClient.js.map +1 -1
- package/react/hooks-compiled/useBackgroundQuery.js +3 -1
- package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
- package/react/hooks-compiled/useFragment.d.ts +6 -65
- package/react/hooks-compiled/useFragment.js +88 -110
- package/react/hooks-compiled/useFragment.js.map +1 -1
- package/react/hooks-compiled/useLazyQuery.js +0 -2
- package/react/hooks-compiled/useLazyQuery.js.map +1 -1
- package/react/hooks-compiled/useLoadableQuery.js +75 -69
- package/react/hooks-compiled/useMutation.d.ts +1 -13
- package/react/hooks-compiled/useMutation.js +13 -5
- package/react/hooks-compiled/useMutation.js.map +1 -1
- package/react/hooks-compiled/useQuery.js +56 -44
- package/react/hooks-compiled/useQuery.js.map +1 -1
- package/react/hooks-compiled/useQueryRefHandlers.js +5 -1
- package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
- package/react/hooks-compiled/useReadQuery.js +14 -77
- package/react/hooks-compiled/useReadQuery.js.map +1 -1
- package/react/hooks-compiled/useSubscription.js +93 -237
- package/react/hooks-compiled/useSubscription.js.map +1 -1
- package/react/hooks-compiled/useSuspenseFragment.d.ts +7 -33
- package/react/hooks-compiled/useSuspenseFragment.js +17 -17
- package/react/hooks-compiled/useSuspenseFragment.js.map +1 -1
- package/react/hooks-compiled/useSuspenseQuery.js +8 -4
- package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
- package/react/index.compiled.d.ts +1 -1
- package/react/index.compiled.js +1 -1
- package/react/index.compiled.js.map +1 -1
- package/react/internal/cache/FragmentReference.d.ts +4 -2
- package/react/internal/cache/FragmentReference.js +22 -3
- package/react/internal/cache/FragmentReference.js.map +1 -1
- package/react/internal/cache/QueryReference.d.ts +0 -5
- package/react/internal/cache/QueryReference.js +0 -16
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/internal/cache/SuspenseCache.d.ts +1 -1
- package/react/internal/cache/SuspenseCache.js.map +1 -1
- package/react/internal/cache/types.d.ts +2 -2
- package/react/internal/cache/types.js.map +1 -1
- package/react/query-preloader/createQueryPreloader.js +1 -41
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/ssr/useSSRQuery.js +0 -1
- package/react/ssr/useSSRQuery.js.map +1 -1
- package/utilities/DeepPartial.d.ts +1 -1
- package/utilities/DeepPartial.js.map +1 -1
- package/utilities/internal/DeepMerger.d.ts +4 -20
- package/utilities/internal/DeepMerger.js +4 -36
- package/utilities/internal/DeepMerger.js.map +1 -1
- package/utilities/internal/bindCacheKey.d.ts +15 -0
- package/utilities/internal/bindCacheKey.js +18 -0
- package/utilities/internal/bindCacheKey.js.map +1 -0
- package/utilities/internal/compact.js +1 -1
- package/utilities/internal/compact.js.map +1 -1
- package/utilities/internal/constants.d.ts +0 -16
- package/utilities/internal/constants.js +0 -16
- package/utilities/internal/constants.js.map +1 -1
- package/utilities/internal/getStoreKeyName.js +0 -1
- package/utilities/internal/getStoreKeyName.js.map +1 -1
- package/utilities/internal/index.d.ts +2 -4
- package/utilities/internal/index.js +2 -3
- package/utilities/internal/index.js.map +1 -1
- package/utilities/internal/memoize.d.ts +1 -2
- package/utilities/internal/memoize.js +2 -2
- package/utilities/internal/memoize.js.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/__cjs/incremental/handlers/graphql17Alpha9.cjs +0 -222
- package/__cjs/incremental/handlers/graphql17Alpha9.cjs.map +0 -1
- package/__cjs/incremental/handlers/graphql17Alpha9.d.cts +0 -98
- package/__cjs/utilities/internal/combineLatestBatched.cjs +0 -71
- package/__cjs/utilities/internal/combineLatestBatched.cjs.map +0 -1
- package/__cjs/utilities/internal/combineLatestBatched.d.cts +0 -14
- package/__cjs/utilities/internal/mapObservableFragment.cjs +0 -27
- package/__cjs/utilities/internal/mapObservableFragment.cjs.map +0 -1
- package/__cjs/utilities/internal/mapObservableFragment.d.cts +0 -3
- package/__cjs/utilities/internal/ponyfills/FinalizationRegistry.cjs +0 -61
- package/__cjs/utilities/internal/ponyfills/FinalizationRegistry.cjs.map +0 -1
- package/__cjs/utilities/internal/ponyfills/FinalizationRegistry.d.cts +0 -11
- package/__cjs/utilities/internal/ponyfills/index.cjs +0 -6
- package/__cjs/utilities/internal/ponyfills/index.cjs.map +0 -1
- package/__cjs/utilities/internal/ponyfills/index.d.cts +0 -3
- package/__cjs/utilities/internal/ponyfills/index.react-native.cjs +0 -6
- package/__cjs/utilities/internal/ponyfills/index.react-native.cjs.map +0 -1
- package/__cjs/utilities/internal/ponyfills/index.react-native.d.cts +0 -2
- package/__cjs/utilities/internal/types/ExtensionsWithStreamDetails.cjs +0 -3
- package/__cjs/utilities/internal/types/ExtensionsWithStreamDetails.cjs.map +0 -1
- package/__cjs/utilities/internal/types/ExtensionsWithStreamDetails.d.cts +0 -24
- package/incremental/handlers/graphql17Alpha9.d.ts +0 -98
- package/incremental/handlers/graphql17Alpha9.js +0 -218
- package/incremental/handlers/graphql17Alpha9.js.map +0 -1
- package/legacyEntryPoints/utilities/internal/ponyfills/index.d.ts +0 -1
- package/legacyEntryPoints/utilities/internal/ponyfills/index.js +0 -1
- package/legacyEntryPoints/utilities/internal/ponyfills/ponyfills.cjs +0 -1
- package/legacyEntryPoints/utilities/internal/ponyfills/ponyfills.d.cts +0 -1
- package/utilities/internal/combineLatestBatched.d.ts +0 -14
- package/utilities/internal/combineLatestBatched.js +0 -68
- package/utilities/internal/combineLatestBatched.js.map +0 -1
- package/utilities/internal/mapObservableFragment.d.ts +0 -3
- package/utilities/internal/mapObservableFragment.js +0 -24
- package/utilities/internal/mapObservableFragment.js.map +0 -1
- package/utilities/internal/ponyfills/FinalizationRegistry.d.ts +0 -11
- package/utilities/internal/ponyfills/FinalizationRegistry.js +0 -57
- package/utilities/internal/ponyfills/FinalizationRegistry.js.map +0 -1
- package/utilities/internal/ponyfills/index.d.ts +0 -3
- package/utilities/internal/ponyfills/index.js +0 -3
- package/utilities/internal/ponyfills/index.js.map +0 -1
- package/utilities/internal/ponyfills/index.react-native.d.ts +0 -2
- package/utilities/internal/ponyfills/index.react-native.js +0 -2
- package/utilities/internal/ponyfills/index.react-native.js.map +0 -1
- package/utilities/internal/types/ExtensionsWithStreamDetails.d.ts +0 -24
- package/utilities/internal/types/ExtensionsWithStreamDetails.js +0 -2
- package/utilities/internal/types/ExtensionsWithStreamDetails.js.map +0 -1
|
@@ -99,7 +99,7 @@ class QueryManager {
|
|
|
99
99
|
*/
|
|
100
100
|
stop() {
|
|
101
101
|
this.obsQueries.forEach((oq) => oq.stop());
|
|
102
|
-
this.cancelPendingFetches((0, invariant_1.newInvariantError)(
|
|
102
|
+
this.cancelPendingFetches((0, invariant_1.newInvariantError)(84));
|
|
103
103
|
}
|
|
104
104
|
cancelPendingFetches(error) {
|
|
105
105
|
this.fetchCancelFns.forEach((cancel) => cancel(error));
|
|
@@ -114,7 +114,7 @@ class QueryManager {
|
|
|
114
114
|
if (environment_1.__DEV__) {
|
|
115
115
|
(0, invariant_1.invariant)(
|
|
116
116
|
this.localState,
|
|
117
|
-
|
|
117
|
+
85,
|
|
118
118
|
(0, internal_1.getOperationName)(mutation, "(anonymous)")
|
|
119
119
|
);
|
|
120
120
|
}
|
|
@@ -151,7 +151,7 @@ class QueryManager {
|
|
|
151
151
|
return this.getObservableFromLink(mutation, {
|
|
152
152
|
...context,
|
|
153
153
|
optimisticResponse: isOptimistic ? optimisticResponse : void 0,
|
|
154
|
-
}, variables,
|
|
154
|
+
}, variables, {}, false)
|
|
155
155
|
.observable.pipe(validateDidEmitValue(), (0, rxjs_2.mergeMap)((result) => {
|
|
156
156
|
const storeResult = { ...result };
|
|
157
157
|
return (0, rxjs_2.from)(queryInfo.markMutationResult(storeResult, {
|
|
@@ -174,7 +174,7 @@ class QueryManager {
|
|
|
174
174
|
.pipe((0, rxjs_2.map)((storeResult) => {
|
|
175
175
|
const hasErrors = (0, internal_1.graphQLResultHasError)(storeResult);
|
|
176
176
|
if (hasErrors && errorPolicy === "none") {
|
|
177
|
-
throw new errors_1.CombinedGraphQLErrors(
|
|
177
|
+
throw new errors_1.CombinedGraphQLErrors(storeResult);
|
|
178
178
|
}
|
|
179
179
|
if (mutationStoreValue) {
|
|
180
180
|
mutationStoreValue.loading = false;
|
|
@@ -353,7 +353,7 @@ class QueryManager {
|
|
|
353
353
|
// depend on values that previously existed in the data portion of the
|
|
354
354
|
// store. So, we cancel the promises and observers that we have issued
|
|
355
355
|
// so far and not yet resolved (in the case of queries).
|
|
356
|
-
this.cancelPendingFetches((0, invariant_1.newInvariantError)(
|
|
356
|
+
this.cancelPendingFetches((0, invariant_1.newInvariantError)(86));
|
|
357
357
|
this.obsQueries.forEach((observableQuery) => {
|
|
358
358
|
// Set loading to true so listeners don't trigger unless they want
|
|
359
359
|
// results with partial data.
|
|
@@ -423,10 +423,10 @@ class QueryManager {
|
|
|
423
423
|
if (!included) {
|
|
424
424
|
const queryName = queryNames.get(nameOrQueryString);
|
|
425
425
|
if (queryName) {
|
|
426
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
426
|
+
__DEV__ && invariant_1.invariant.warn(87, queryName);
|
|
427
427
|
}
|
|
428
428
|
else {
|
|
429
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
429
|
+
__DEV__ && invariant_1.invariant.warn(88);
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
});
|
|
@@ -447,7 +447,7 @@ class QueryManager {
|
|
|
447
447
|
}
|
|
448
448
|
startGraphQLSubscription(options) {
|
|
449
449
|
let { query, variables } = options;
|
|
450
|
-
const { fetchPolicy
|
|
450
|
+
const { fetchPolicy, errorPolicy = "none", context = {}, extensions = {}, } = options;
|
|
451
451
|
(0, internal_1.checkDocument)(query, graphql_1.OperationTypeNode.SUBSCRIPTION);
|
|
452
452
|
query = this.transform(query);
|
|
453
453
|
variables = this.getVariables(query, variables);
|
|
@@ -455,7 +455,7 @@ class QueryManager {
|
|
|
455
455
|
if (environment_1.__DEV__) {
|
|
456
456
|
(0, invariant_1.invariant)(
|
|
457
457
|
!this.getDocumentInfo(query).hasClientExports || this.localState,
|
|
458
|
-
|
|
458
|
+
89,
|
|
459
459
|
(0, internal_1.getOperationName)(query, "(anonymous)")
|
|
460
460
|
);
|
|
461
461
|
}
|
|
@@ -467,7 +467,7 @@ class QueryManager {
|
|
|
467
467
|
context,
|
|
468
468
|
}))
|
|
469
469
|
: (0, rxjs_2.of)(variables)).pipe((0, rxjs_2.mergeMap)((variables) => {
|
|
470
|
-
const { observable, restart: res } = this.getObservableFromLink(query, context, variables,
|
|
470
|
+
const { observable, restart: res } = this.getObservableFromLink(query, context, variables, extensions);
|
|
471
471
|
const queryInfo = new QueryInfo_js_1.QueryInfo(this);
|
|
472
472
|
restart = res;
|
|
473
473
|
return observable.pipe((0, rxjs_2.map)((rawResult) => {
|
|
@@ -520,7 +520,7 @@ class QueryManager {
|
|
|
520
520
|
// Use protected instead of private field so
|
|
521
521
|
// @apollo/experimental-nextjs-app-support can access type info.
|
|
522
522
|
inFlightLinkObservables = new trie_1.Trie(false);
|
|
523
|
-
getObservableFromLink(query, context, variables,
|
|
523
|
+
getObservableFromLink(query, context, variables, extensions,
|
|
524
524
|
// Prefer context.queryDeduplication if specified.
|
|
525
525
|
deduplication = context?.queryDeduplication ??
|
|
526
526
|
this.queryDeduplication) {
|
|
@@ -599,14 +599,14 @@ class QueryManager {
|
|
|
599
599
|
if (environment_1.__DEV__) {
|
|
600
600
|
(0, invariant_1.invariant)(
|
|
601
601
|
this.localState,
|
|
602
|
-
|
|
602
|
+
90,
|
|
603
603
|
operation[0].toUpperCase() + operation.slice(1),
|
|
604
604
|
operationName ?? "(anonymous)"
|
|
605
605
|
);
|
|
606
606
|
}
|
|
607
607
|
(0, invariant_1.invariant)(
|
|
608
608
|
!hasIncrementalDirective,
|
|
609
|
-
|
|
609
|
+
91,
|
|
610
610
|
operation[0].toUpperCase() + operation.slice(1),
|
|
611
611
|
operationName ?? "(anonymous)"
|
|
612
612
|
);
|
|
@@ -617,7 +617,6 @@ class QueryManager {
|
|
|
617
617
|
remoteResult: result,
|
|
618
618
|
context,
|
|
619
619
|
variables,
|
|
620
|
-
fetchPolicy,
|
|
621
620
|
}));
|
|
622
621
|
}));
|
|
623
622
|
}
|
|
@@ -630,14 +629,14 @@ class QueryManager {
|
|
|
630
629
|
})),
|
|
631
630
|
};
|
|
632
631
|
}
|
|
633
|
-
getResultsFromLink(options, { queryInfo, cacheWriteBehavior, observableQuery,
|
|
632
|
+
getResultsFromLink(options, { queryInfo, cacheWriteBehavior, observableQuery, }) {
|
|
634
633
|
const requestId = (queryInfo.lastRequestId = this.generateRequestId());
|
|
635
634
|
const { errorPolicy } = options;
|
|
636
635
|
// Performing transformForLink here gives this.cache a chance to fill in
|
|
637
636
|
// missing fragment definitions (for example) before sending this document
|
|
638
637
|
// through the link chain.
|
|
639
638
|
const linkDocument = this.cache.transformForLink(options.query);
|
|
640
|
-
return this.getObservableFromLink(linkDocument, options.context, options.variables
|
|
639
|
+
return this.getObservableFromLink(linkDocument, options.context, options.variables).observable.pipe((0, rxjs_2.map)((incoming) => {
|
|
641
640
|
// Use linkDocument rather than queryInfo.document so the
|
|
642
641
|
// operation/fragments used to write the result are the same as the
|
|
643
642
|
// ones used to obtain it from the link.
|
|
@@ -650,7 +649,7 @@ class QueryManager {
|
|
|
650
649
|
if (hasErrors && errorPolicy === "none") {
|
|
651
650
|
queryInfo.resetLastWrite();
|
|
652
651
|
observableQuery?.["resetNotifications"]();
|
|
653
|
-
throw new errors_1.CombinedGraphQLErrors(
|
|
652
|
+
throw new errors_1.CombinedGraphQLErrors(result);
|
|
654
653
|
}
|
|
655
654
|
const aqr = {
|
|
656
655
|
data: result.data,
|
|
@@ -668,9 +667,6 @@ class QueryManager {
|
|
|
668
667
|
partial: !result.data,
|
|
669
668
|
}),
|
|
670
669
|
};
|
|
671
|
-
if (exposeExtensions && "extensions" in result) {
|
|
672
|
-
aqr[internal_1.extensionsSymbol] = result.extensions;
|
|
673
|
-
}
|
|
674
670
|
// In the case we start multiple network requests simultaneously, we
|
|
675
671
|
// want to ensure we properly set `data` if we're reporting on an old
|
|
676
672
|
// result which will not be caught by the conditional above that ends up
|
|
@@ -681,7 +677,7 @@ class QueryManager {
|
|
|
681
677
|
aqr.dataState = "empty";
|
|
682
678
|
}
|
|
683
679
|
if (errorPolicy !== "ignore") {
|
|
684
|
-
aqr.error = new errors_1.CombinedGraphQLErrors(
|
|
680
|
+
aqr.error = new errors_1.CombinedGraphQLErrors(result);
|
|
685
681
|
if (aqr.dataState !== "streaming") {
|
|
686
682
|
aqr.networkStatus = networkStatus_js_1.NetworkStatus.error;
|
|
687
683
|
}
|
|
@@ -713,7 +709,7 @@ class QueryManager {
|
|
|
713
709
|
// The initial networkStatus for this fetch, most often
|
|
714
710
|
// NetworkStatus.loading, but also possibly fetchMore, poll, refetch,
|
|
715
711
|
// or setVariables.
|
|
716
|
-
networkStatus = networkStatus_js_1.NetworkStatus.loading, query = options.query, fetchQueryOperator = (x) => x, onCacheHit = () => { }, observableQuery,
|
|
712
|
+
networkStatus = networkStatus_js_1.NetworkStatus.loading, query = options.query, fetchQueryOperator = (x) => x, onCacheHit = () => { }, observableQuery, }) {
|
|
717
713
|
const variables = this.getVariables(query, options.variables);
|
|
718
714
|
const defaults = this.defaultOptions.watchQuery;
|
|
719
715
|
let { fetchPolicy = (defaults && defaults.fetchPolicy) || "cache-first", errorPolicy = (defaults && defaults.errorPolicy) || "none", returnPartialData = false, notifyOnNetworkStatusChange = true, context = {}, } = options;
|
|
@@ -743,13 +739,7 @@ class QueryManager {
|
|
|
743
739
|
normalized.refetchWritePolicy !== "merge") ?
|
|
744
740
|
1 /* CacheWriteBehavior.OVERWRITE */
|
|
745
741
|
: 2 /* CacheWriteBehavior.MERGE */;
|
|
746
|
-
const observableWithInfo = this.fetchQueryByPolicy(normalized, {
|
|
747
|
-
queryInfo,
|
|
748
|
-
cacheWriteBehavior,
|
|
749
|
-
onCacheHit,
|
|
750
|
-
observableQuery,
|
|
751
|
-
exposeExtensions,
|
|
752
|
-
});
|
|
742
|
+
const observableWithInfo = this.fetchQueryByPolicy(normalized, { queryInfo, cacheWriteBehavior, onCacheHit, observableQuery });
|
|
753
743
|
observableWithInfo.observable =
|
|
754
744
|
observableWithInfo.observable.pipe(fetchQueryOperator);
|
|
755
745
|
if (
|
|
@@ -785,7 +775,7 @@ class QueryManager {
|
|
|
785
775
|
if (environment_1.__DEV__) {
|
|
786
776
|
(0, invariant_1.invariant)(
|
|
787
777
|
this.localState,
|
|
788
|
-
|
|
778
|
+
92,
|
|
789
779
|
(0, internal_1.getOperationName)(normalized.query, "(anonymous)")
|
|
790
780
|
);
|
|
791
781
|
}
|
|
@@ -961,7 +951,7 @@ class QueryManager {
|
|
|
961
951
|
!this.noCacheWarningsByCause.has(cause)) {
|
|
962
952
|
this.noCacheWarningsByCause.add(cause);
|
|
963
953
|
__DEV__ && invariant_1.invariant.warn(
|
|
964
|
-
|
|
954
|
+
93,
|
|
965
955
|
(0, internal_1.getOperationName)(document, `Unnamed ${operationType ?? "operation"}`)
|
|
966
956
|
);
|
|
967
957
|
}
|
|
@@ -976,7 +966,7 @@ class QueryManager {
|
|
|
976
966
|
(0, masking_1.maskFragment)(data, fragment, this.cache, fragmentName)
|
|
977
967
|
: data;
|
|
978
968
|
}
|
|
979
|
-
fetchQueryByPolicy({ query, variables, fetchPolicy, errorPolicy, returnPartialData, context, }, { cacheWriteBehavior, onCacheHit, queryInfo, observableQuery,
|
|
969
|
+
fetchQueryByPolicy({ query, variables, fetchPolicy, errorPolicy, returnPartialData, context, }, { cacheWriteBehavior, onCacheHit, queryInfo, observableQuery, }) {
|
|
980
970
|
const readCache = () => this.cache.diff({
|
|
981
971
|
query,
|
|
982
972
|
variables,
|
|
@@ -1023,7 +1013,7 @@ class QueryManager {
|
|
|
1023
1013
|
if (environment_1.__DEV__) {
|
|
1024
1014
|
(0, invariant_1.invariant)(
|
|
1025
1015
|
this.localState,
|
|
1026
|
-
|
|
1016
|
+
94,
|
|
1027
1017
|
(0, internal_1.getOperationName)(query, "(anonymous)")
|
|
1028
1018
|
);
|
|
1029
1019
|
}
|
|
@@ -1036,7 +1026,6 @@ class QueryManager {
|
|
|
1036
1026
|
variables,
|
|
1037
1027
|
onlyRunForcedResolvers: true,
|
|
1038
1028
|
returnPartialData: true,
|
|
1039
|
-
fetchPolicy,
|
|
1040
1029
|
}).then((resolved) => ({
|
|
1041
1030
|
kind: "N",
|
|
1042
1031
|
value: toResult(resolved.data || void 0),
|
|
@@ -1064,7 +1053,6 @@ class QueryManager {
|
|
|
1064
1053
|
cacheWriteBehavior,
|
|
1065
1054
|
queryInfo,
|
|
1066
1055
|
observableQuery,
|
|
1067
|
-
exposeExtensions,
|
|
1068
1056
|
}).pipe(validateDidEmitValue(), (0, rxjs_2.materialize)(), (0, rxjs_2.map)((result) => ({
|
|
1069
1057
|
...result,
|
|
1070
1058
|
source: "network",
|
|
@@ -1119,7 +1107,7 @@ function validateDidEmitValue() {
|
|
|
1119
1107
|
didEmitValue = true;
|
|
1120
1108
|
},
|
|
1121
1109
|
complete() {
|
|
1122
|
-
(0, invariant_1.invariant)(didEmitValue,
|
|
1110
|
+
(0, invariant_1.invariant)(didEmitValue, 95);
|
|
1123
1111
|
},
|
|
1124
1112
|
});
|
|
1125
1113
|
}
|
|
@@ -1158,14 +1146,4 @@ function addNonReactiveToNamedFragments(document) {
|
|
|
1158
1146
|
},
|
|
1159
1147
|
});
|
|
1160
1148
|
}
|
|
1161
|
-
function removeStreamDetailsFromExtensions(original) {
|
|
1162
|
-
if (original.extensions?.[internal_1.streamDetailsSymbol] == null) {
|
|
1163
|
-
return original;
|
|
1164
|
-
}
|
|
1165
|
-
const { extensions: { [internal_1.streamDetailsSymbol]: _, ...extensions }, ...result } = original;
|
|
1166
|
-
if (Object.keys(extensions).length > 0) {
|
|
1167
|
-
result.extensions = extensions;
|
|
1168
|
-
}
|
|
1169
|
-
return result;
|
|
1170
|
-
}
|
|
1171
1149
|
//# sourceMappingURL=QueryManager.cjs.map
|