@apollo/client 4.0.9 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +445 -0
- package/__cjs/cache/core/cache.cjs +217 -52
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +141 -25
- package/__cjs/cache/core/types/Cache.d.cts +78 -17
- package/__cjs/cache/index.cjs.map +1 -1
- package/__cjs/cache/index.d.cts +1 -1
- package/__cjs/cache/inmemory/entityStore.cjs +6 -4
- 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 +62 -1
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.d.cts +48 -0
- 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 +76 -17
- package/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.d.cts +33 -6
- package/__cjs/cache/inmemory/readFromStore.cjs +9 -8
- package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/types.d.cts +3 -0
- package/__cjs/cache/inmemory/writeToStore.cjs +25 -10
- package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/writeToStore.d.cts +1 -1
- package/__cjs/core/ApolloClient.cjs +31 -49
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +159 -18
- package/__cjs/core/ObservableQuery.cjs +178 -131
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +2 -0
- package/__cjs/core/QueryInfo.cjs +9 -1
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +4 -3
- package/__cjs/core/QueryManager.cjs +47 -25
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/QueryManager.d.cts +19 -2
- package/__cjs/incremental/handlers/defer20220824.cjs +44 -19
- package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -1
- package/__cjs/incremental/handlers/defer20220824.d.cts +15 -7
- package/__cjs/incremental/handlers/graphql17Alpha9.cjs +227 -0
- package/__cjs/incremental/handlers/graphql17Alpha9.cjs.map +1 -0
- package/__cjs/incremental/handlers/graphql17Alpha9.d.cts +98 -0
- package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
- package/__cjs/incremental/handlers/notImplemented.cjs.map +1 -1
- package/__cjs/incremental/index.cjs +3 -1
- package/__cjs/incremental/index.cjs.map +1 -1
- package/__cjs/incremental/index.d.cts +1 -0
- package/__cjs/incremental/types.d.cts +9 -0
- package/__cjs/invariantErrorCodes.cjs +83 -61
- package/__cjs/link/client-awareness/ClientAwarenessLink.cjs +13 -1
- 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/error/index.cjs +1 -1
- package/__cjs/link/error/index.cjs.map +1 -1
- package/__cjs/link/error/index.d.cts +1 -1
- package/__cjs/link/http/checkFetcher.cjs +1 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs +2 -2
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +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/schema/index.cjs +1 -1
- package/__cjs/link/schema/index.cjs.map +1 -1
- package/__cjs/link/schema/index.d.cts +1 -1
- package/__cjs/link/ws/index.cjs +1 -1
- package/__cjs/local-state/LocalState.cjs +29 -15
- package/__cjs/local-state/LocalState.cjs.map +1 -1
- package/__cjs/local-state/LocalState.d.cts +3 -2
- package/__cjs/masking/types.d.cts +2 -1
- package/__cjs/react/hooks/internal/useDeepMemo.cjs +2 -0
- 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 +1 -3
- package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useFragment.cjs +38 -87
- package/__cjs/react/hooks/useFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useFragment.d.cts +65 -6
- package/__cjs/react/hooks/useLazyQuery.cjs +3 -0
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.cjs +7 -1
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.d.cts +13 -1
- package/__cjs/react/hooks/useQuery.cjs +8 -8
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +1 -1
- package/__cjs/react/hooks/useQueryRefHandlers.cjs +1 -3
- package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
- package/__cjs/react/hooks/useReadQuery.cjs +1 -3
- 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 +33 -7
- package/__cjs/react/hooks/useSuspenseQuery.cjs +6 -4
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/internal/cache/FragmentReference.cjs +3 -22
- package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/FragmentReference.d.cts +2 -4
- package/__cjs/react/internal/cache/QueryReference.cjs +16 -0
- package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/QueryReference.d.cts +5 -0
- 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 +41 -1
- package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
- package/__cjs/react/ssr/prerenderStatic.cjs +17 -4
- package/__cjs/react/ssr/prerenderStatic.cjs.map +1 -1
- package/__cjs/react/ssr/prerenderStatic.d.cts +23 -4
- package/__cjs/react/ssr/useSSRQuery.cjs +7 -4
- package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -1
- package/__cjs/react/ssr/useSSRQuery.d.cts +2 -1
- package/__cjs/utilities/DeepPartial.cjs.map +1 -1
- package/__cjs/utilities/DeepPartial.d.cts +1 -1
- package/__cjs/utilities/internal/DeepMerger.cjs +36 -4
- package/__cjs/utilities/internal/DeepMerger.cjs.map +1 -1
- package/__cjs/utilities/internal/DeepMerger.d.cts +20 -4
- 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/checkDocument.cjs +2 -4
- package/__cjs/utilities/internal/checkDocument.cjs.map +1 -1
- package/__cjs/utilities/internal/combineLatestBatched.cjs +71 -0
- package/__cjs/utilities/internal/combineLatestBatched.cjs.map +1 -0
- package/__cjs/utilities/internal/combineLatestBatched.d.cts +14 -0
- package/__cjs/utilities/internal/compact.cjs +1 -1
- package/__cjs/utilities/internal/compact.cjs.map +1 -1
- package/__cjs/utilities/internal/constants.cjs +26 -0
- package/__cjs/utilities/internal/constants.cjs.map +1 -0
- package/__cjs/utilities/internal/constants.d.cts +23 -0
- package/__cjs/utilities/internal/getStoreKeyName.cjs +1 -0
- package/__cjs/utilities/internal/getStoreKeyName.cjs.map +1 -1
- package/__cjs/utilities/internal/index.cjs +12 -2
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +6 -0
- package/__cjs/utilities/internal/mapObservableFragment.cjs +27 -0
- package/__cjs/utilities/internal/mapObservableFragment.cjs.map +1 -0
- package/__cjs/utilities/internal/mapObservableFragment.d.cts +3 -0
- package/__cjs/utilities/internal/memoize.cjs +31 -0
- package/__cjs/utilities/internal/memoize.cjs.map +1 -0
- package/__cjs/utilities/internal/memoize.d.cts +8 -0
- package/__cjs/utilities/internal/ponyfills/FinalizationRegistry.cjs +61 -0
- package/__cjs/utilities/internal/ponyfills/FinalizationRegistry.cjs.map +1 -0
- package/__cjs/utilities/internal/ponyfills/FinalizationRegistry.d.cts +11 -0
- package/__cjs/utilities/internal/ponyfills/index.cjs +6 -0
- package/__cjs/utilities/internal/ponyfills/index.cjs.map +1 -0
- package/__cjs/utilities/internal/ponyfills/index.d.cts +3 -0
- package/__cjs/utilities/internal/ponyfills/index.react-native.cjs +6 -0
- package/__cjs/utilities/internal/ponyfills/index.react-native.cjs.map +1 -0
- package/__cjs/utilities/internal/ponyfills/index.react-native.d.cts +2 -0
- package/__cjs/utilities/internal/types/ExtensionsWithStreamDetails.cjs +3 -0
- package/__cjs/utilities/internal/types/ExtensionsWithStreamDetails.cjs.map +1 -0
- package/__cjs/utilities/internal/types/ExtensionsWithStreamDetails.d.cts +12 -0
- package/__cjs/utilities/internal/types/StreamInfoTrie.cjs +3 -0
- package/__cjs/utilities/internal/types/StreamInfoTrie.cjs.map +1 -0
- package/__cjs/utilities/internal/types/StreamInfoTrie.d.cts +16 -0
- package/__cjs/version.cjs +1 -1
- package/cache/core/cache.d.ts +141 -25
- package/cache/core/cache.js +220 -55
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +78 -17
- 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 +6 -4
- 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 +48 -0
- package/cache/inmemory/inMemoryCache.js +62 -1
- 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 +33 -6
- package/cache/inmemory/policies.js +65 -7
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.js +9 -8
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +3 -0
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +1 -1
- package/cache/inmemory/writeToStore.js +27 -12
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts +159 -18
- package/core/ApolloClient.js +32 -50
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +2 -0
- package/core/ObservableQuery.js +181 -134
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +4 -3
- package/core/QueryInfo.js +10 -2
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +19 -2
- package/core/QueryManager.js +48 -26
- package/core/QueryManager.js.map +1 -1
- package/incremental/handlers/defer20220824.d.ts +15 -7
- package/incremental/handlers/defer20220824.js +44 -19
- package/incremental/handlers/defer20220824.js.map +1 -1
- package/incremental/handlers/graphql17Alpha9.d.ts +98 -0
- package/incremental/handlers/graphql17Alpha9.js +223 -0
- package/incremental/handlers/graphql17Alpha9.js.map +1 -0
- package/incremental/handlers/notImplemented.js +1 -1
- package/incremental/handlers/notImplemented.js.map +1 -1
- package/incremental/index.d.ts +1 -0
- package/incremental/index.js +3 -2
- package/incremental/index.js.map +1 -1
- package/incremental/types.d.ts +9 -0
- package/incremental/types.js.map +1 -1
- package/invariantErrorCodes.js +83 -61
- package/legacyEntryPoints/utilities/internal/ponyfills/index.d.ts +1 -0
- package/legacyEntryPoints/utilities/internal/ponyfills/index.js +1 -0
- package/legacyEntryPoints/utilities/internal/ponyfills/ponyfills.cjs +1 -0
- package/legacyEntryPoints/utilities/internal/ponyfills/ponyfills.d.cts +1 -0
- package/link/client-awareness/ClientAwarenessLink.d.ts +1 -1
- package/link/client-awareness/ClientAwarenessLink.js +13 -1
- package/link/client-awareness/ClientAwarenessLink.js.map +1 -1
- package/link/core/ApolloLink.js +3 -3
- package/link/error/index.d.ts +1 -1
- package/link/error/index.js +1 -1
- package/link/error/index.js.map +1 -1
- package/link/http/checkFetcher.js +1 -1
- package/link/http/parseAndCheckHttpResponse.js +2 -2
- package/link/http/parseAndCheckHttpResponse.js.map +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/schema/index.d.ts +1 -1
- package/link/schema/index.js +1 -1
- package/link/schema/index.js.map +1 -1
- package/link/ws/index.js +1 -1
- package/local-state/LocalState.d.ts +3 -2
- package/local-state/LocalState.js +29 -15
- package/local-state/LocalState.js.map +1 -1
- package/masking/types.d.ts +2 -1
- package/masking/types.js.map +1 -1
- package/package.json +15 -1
- package/react/hooks/internal/useDeepMemo.js +2 -0
- 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 +1 -3
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.d.ts +65 -6
- package/react/hooks/useFragment.js +38 -87
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.js +4 -1
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +13 -1
- package/react/hooks/useMutation.js +7 -1
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.js +9 -9
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useQueryRefHandlers.js +1 -3
- package/react/hooks/useQueryRefHandlers.js.map +1 -1
- package/react/hooks/useReadQuery.js +1 -3
- 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 +33 -7
- package/react/hooks/useSuspenseFragment.js +17 -17
- package/react/hooks/useSuspenseFragment.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +6 -4
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks-compiled/internal/useDeepMemo.js +2 -0
- package/react/hooks-compiled/internal/useDeepMemo.js.map +1 -1
- package/react/hooks-compiled/internal/useSuspenseHookCacheKey.js +0 -2
- 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 +1 -3
- package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
- package/react/hooks-compiled/useFragment.d.ts +65 -6
- package/react/hooks-compiled/useFragment.js +110 -88
- package/react/hooks-compiled/useFragment.js.map +1 -1
- package/react/hooks-compiled/useLazyQuery.js +4 -1
- package/react/hooks-compiled/useLazyQuery.js.map +1 -1
- package/react/hooks-compiled/useLoadableQuery.js +69 -75
- package/react/hooks-compiled/useMutation.d.ts +13 -1
- package/react/hooks-compiled/useMutation.js +5 -13
- package/react/hooks-compiled/useMutation.js.map +1 -1
- package/react/hooks-compiled/useQuery.js +53 -61
- package/react/hooks-compiled/useQuery.js.map +1 -1
- package/react/hooks-compiled/useQueryRefHandlers.js +1 -5
- package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
- package/react/hooks-compiled/useReadQuery.js +77 -14
- package/react/hooks-compiled/useReadQuery.js.map +1 -1
- package/react/hooks-compiled/useSubscription.js +237 -93
- package/react/hooks-compiled/useSubscription.js.map +1 -1
- package/react/hooks-compiled/useSuspenseFragment.d.ts +33 -7
- package/react/hooks-compiled/useSuspenseFragment.js +17 -17
- package/react/hooks-compiled/useSuspenseFragment.js.map +1 -1
- package/react/hooks-compiled/useSuspenseQuery.js +7 -9
- 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 +2 -4
- package/react/internal/cache/FragmentReference.js +3 -22
- package/react/internal/cache/FragmentReference.js.map +1 -1
- package/react/internal/cache/QueryReference.d.ts +5 -0
- package/react/internal/cache/QueryReference.js +16 -0
- 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 +41 -1
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/ssr/prerenderStatic.d.ts +24 -5
- package/react/ssr/prerenderStatic.js +17 -4
- package/react/ssr/prerenderStatic.js.map +1 -1
- package/react/ssr/useSSRQuery.d.ts +2 -1
- package/react/ssr/useSSRQuery.js +8 -5
- 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 +20 -4
- package/utilities/internal/DeepMerger.js +36 -4
- 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/checkDocument.js +2 -4
- package/utilities/internal/checkDocument.js.map +1 -1
- package/utilities/internal/combineLatestBatched.d.ts +14 -0
- package/utilities/internal/combineLatestBatched.js +68 -0
- package/utilities/internal/combineLatestBatched.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 +23 -0
- package/utilities/internal/constants.js +23 -0
- package/utilities/internal/constants.js.map +1 -0
- package/utilities/internal/getStoreKeyName.js +1 -0
- package/utilities/internal/getStoreKeyName.js.map +1 -1
- package/utilities/internal/index.d.ts +6 -0
- package/utilities/internal/index.js +4 -0
- package/utilities/internal/index.js.map +1 -1
- package/utilities/internal/mapObservableFragment.d.ts +3 -0
- package/utilities/internal/mapObservableFragment.js +24 -0
- package/utilities/internal/mapObservableFragment.js.map +1 -0
- package/utilities/internal/memoize.d.ts +8 -0
- package/utilities/internal/memoize.js +28 -0
- package/utilities/internal/memoize.js.map +1 -0
- package/utilities/internal/ponyfills/FinalizationRegistry.d.ts +11 -0
- package/utilities/internal/ponyfills/FinalizationRegistry.js +57 -0
- package/utilities/internal/ponyfills/FinalizationRegistry.js.map +1 -0
- package/utilities/internal/ponyfills/index.d.ts +3 -0
- package/utilities/internal/ponyfills/index.js +3 -0
- package/utilities/internal/ponyfills/index.js.map +1 -0
- package/utilities/internal/ponyfills/index.react-native.d.ts +2 -0
- package/utilities/internal/ponyfills/index.react-native.js +2 -0
- package/utilities/internal/ponyfills/index.react-native.js.map +1 -0
- package/utilities/internal/types/ExtensionsWithStreamDetails.d.ts +12 -0
- package/utilities/internal/types/ExtensionsWithStreamDetails.js +2 -0
- package/utilities/internal/types/ExtensionsWithStreamDetails.js.map +1 -0
- package/utilities/internal/types/StreamInfoTrie.d.ts +16 -0
- package/utilities/internal/types/StreamInfoTrie.js +2 -0
- package/utilities/internal/types/StreamInfoTrie.js.map +1 -0
- package/version.js +1 -1
|
@@ -64,7 +64,7 @@ export class LocalState {
|
|
|
64
64
|
addResolvers(resolvers) {
|
|
65
65
|
this.resolvers = mergeDeep(this.resolvers, resolvers);
|
|
66
66
|
}
|
|
67
|
-
async execute({ document, client, context, remoteResult, variables = {}, onlyRunForcedResolvers = false, returnPartialData = false, }) {
|
|
67
|
+
async execute({ document, client, context, remoteResult, variables = {}, onlyRunForcedResolvers = false, returnPartialData = false, fetchPolicy, }) {
|
|
68
68
|
if (__DEV__) {
|
|
69
69
|
invariant(hasDirectives(["client"], document), 47);
|
|
70
70
|
validateCacheImplementation(client.cache);
|
|
@@ -78,12 +78,14 @@ export class LocalState {
|
|
|
78
78
|
}
|
|
79
79
|
const { selectionsToResolve, exportedVariableDefs, operationDefinition, fragmentMap, } = this.collectQueryDetail(document);
|
|
80
80
|
const rootValue = remoteResult ? remoteResult.data : {};
|
|
81
|
-
const diff =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
const diff = fetchPolicy === "no-cache" ?
|
|
82
|
+
{ result: null, complete: false }
|
|
83
|
+
: client.cache.diff({
|
|
84
|
+
query: toQueryOperation(document),
|
|
85
|
+
variables,
|
|
86
|
+
returnPartialData: true,
|
|
87
|
+
optimistic: false,
|
|
88
|
+
});
|
|
87
89
|
const requestContext = { ...client.defaultContext, ...context };
|
|
88
90
|
const execContext = {
|
|
89
91
|
client,
|
|
@@ -105,6 +107,7 @@ export class LocalState {
|
|
|
105
107
|
exportedVariableDefs,
|
|
106
108
|
diff,
|
|
107
109
|
returnPartialData,
|
|
110
|
+
fetchPolicy,
|
|
108
111
|
};
|
|
109
112
|
const localResult = await this.resolveSelectionSet(operationDefinition.selectionSet, false, rootValue, execContext, []);
|
|
110
113
|
const errors = (remoteResult?.errors ?? []).concat(execContext.errors);
|
|
@@ -221,7 +224,7 @@ export class LocalState {
|
|
|
221
224
|
: rootValue;
|
|
222
225
|
}
|
|
223
226
|
resolveServerField(field, rootValue, execContext, path) {
|
|
224
|
-
const result = rootValue?.[field
|
|
227
|
+
const result = rootValue?.[resultKeyNameFromField(field)];
|
|
225
228
|
if (!field.selectionSet) {
|
|
226
229
|
return result;
|
|
227
230
|
}
|
|
@@ -241,7 +244,8 @@ export class LocalState {
|
|
|
241
244
|
return this.resolveSelectionSet(field.selectionSet, false, result, execContext, path);
|
|
242
245
|
}
|
|
243
246
|
async resolveClientField(field, isClientFieldDescendant, rootValue, execContext, parentSelectionSet, path) {
|
|
244
|
-
const { client, diff, variables, operationDefinition, phase,
|
|
247
|
+
const { client, diff, variables, operationDefinition, phase, onlyRunForcedResolvers, fetchPolicy, } = execContext;
|
|
248
|
+
let { returnPartialData } = execContext;
|
|
245
249
|
const isRootField = parentSelectionSet === operationDefinition.selectionSet;
|
|
246
250
|
const fieldName = field.name.value;
|
|
247
251
|
const typename = isRootField ?
|
|
@@ -263,7 +267,17 @@ export class LocalState {
|
|
|
263
267
|
if (fieldFromCache !== undefined) {
|
|
264
268
|
return fieldFromCache;
|
|
265
269
|
}
|
|
270
|
+
if (client.cache.resolvesClientField?.(typename, fieldName)) {
|
|
271
|
+
if (fetchPolicy === "no-cache") {
|
|
272
|
+
__DEV__ && invariant.warn(50, resolverName);
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
275
|
+
// assume the cache will handle returning the correct value
|
|
276
|
+
returnPartialData = true;
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
266
279
|
if (!returnPartialData) {
|
|
280
|
+
__DEV__ && invariant.warn(51, resolverName);
|
|
267
281
|
return null;
|
|
268
282
|
}
|
|
269
283
|
});
|
|
@@ -329,13 +343,13 @@ export class LocalState {
|
|
|
329
343
|
if (result === undefined && !returnPartialData) {
|
|
330
344
|
if (__DEV__ && phase === "resolve") {
|
|
331
345
|
if (resolver && !onlyRunForcedResolvers) {
|
|
332
|
-
__DEV__ && invariant.warn(
|
|
346
|
+
__DEV__ && invariant.warn(52, resolverName);
|
|
333
347
|
}
|
|
334
348
|
else if (onlyRunForcedResolvers) {
|
|
335
|
-
__DEV__ && invariant.warn(
|
|
349
|
+
__DEV__ && invariant.warn(53, resolverName);
|
|
336
350
|
}
|
|
337
351
|
else {
|
|
338
|
-
__DEV__ && invariant.warn(
|
|
352
|
+
__DEV__ && invariant.warn(54, fieldName, rootValue);
|
|
339
353
|
}
|
|
340
354
|
}
|
|
341
355
|
result = null;
|
|
@@ -347,7 +361,7 @@ export class LocalState {
|
|
|
347
361
|
return this.resolveSubSelectedArray(field, true, result, execContext, path);
|
|
348
362
|
}
|
|
349
363
|
if (phase === "resolve" && !result.__typename) {
|
|
350
|
-
this.addError(newInvariantError(
|
|
364
|
+
this.addError(newInvariantError(55, result, resolverName), path, execContext, { resolver: resolverName });
|
|
351
365
|
return null;
|
|
352
366
|
}
|
|
353
367
|
return this.resolveSelectionSet(field.selectionSet, true, result, execContext, path);
|
|
@@ -458,7 +472,7 @@ export class LocalState {
|
|
|
458
472
|
},
|
|
459
473
|
FragmentSpread(spread, _, __, ___, ancestors) {
|
|
460
474
|
const fragment = fragmentMap[spread.name.value];
|
|
461
|
-
invariant(fragment,
|
|
475
|
+
invariant(fragment, 56, spread.name.value);
|
|
462
476
|
const { selectionsToResolve: fragmentSelections } = traverse(fragment);
|
|
463
477
|
if (fragmentSelections.size > 0) {
|
|
464
478
|
// Fragment for this spread contains @client directive (either directly or transitively)
|
|
@@ -517,7 +531,7 @@ function getExportedVariableName(directive) {
|
|
|
517
531
|
}
|
|
518
532
|
}
|
|
519
533
|
function validateCacheImplementation(cache) {
|
|
520
|
-
invariant(cache.fragmentMatches,
|
|
534
|
+
invariant(cache.fragmentMatches, 57);
|
|
521
535
|
}
|
|
522
536
|
function getCacheResultAtPath(diff, path) {
|
|
523
537
|
if (diff.result === null) {
|