@apollo/client 4.0.0-alpha.1 → 4.0.0-alpha.11
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/.changeset/afraid-grapes-call.md +5 -0
- package/.changeset/afraid-moons-arrive.md +5 -0
- package/.changeset/beige-mirrors-talk.md +15 -0
- package/.changeset/cool-kiwis-hunt.md +15 -0
- package/.changeset/cuddly-spiders-tie.md +5 -0
- package/.changeset/dirty-eagles-poke.md +5 -0
- package/.changeset/early-eggs-develop.md +22 -0
- package/.changeset/eighty-squids-fix.md +15 -0
- package/.changeset/eleven-kangaroos-jump.md +5 -0
- package/.changeset/forty-shrimps-fry.md +5 -0
- package/.changeset/forty-tomatoes-punch.md +5 -0
- package/.changeset/four-countries-clean.md +24 -0
- package/.changeset/four-ghosts-watch.md +5 -0
- package/.changeset/funny-jeans-invent.md +16 -0
- package/.changeset/funny-terms-deny.md +5 -0
- package/.changeset/fuzzy-tips-sit.md +5 -0
- package/.changeset/gentle-badgers-train.md +5 -0
- package/.changeset/gentle-waves-cough.md +5 -0
- package/.changeset/giant-apes-thank.md +5 -0
- package/.changeset/giant-bags-share.md +5 -0
- package/.changeset/gorgeous-chefs-tap.md +5 -0
- package/.changeset/great-roses-jog.md +15 -0
- package/.changeset/grumpy-vans-type.md +5 -0
- package/.changeset/hip-vans-act.md +5 -0
- package/.changeset/hungry-bikes-cough.md +5 -0
- package/.changeset/itchy-chefs-run.md +23 -0
- package/.changeset/khaki-keys-deliver.md +5 -0
- package/.changeset/khaki-spies-work.md +11 -0
- package/.changeset/large-plants-know.md +5 -0
- package/.changeset/light-apes-rescue.md +5 -0
- package/.changeset/little-spoons-kick.md +7 -0
- package/.changeset/loud-cows-raise.md +7 -0
- package/.changeset/lucky-sheep-explain.md +34 -0
- package/.changeset/many-buses-allow.md +5 -0
- package/.changeset/mean-lizards-think.md +5 -0
- package/.changeset/nervous-fireants-bow.md +5 -0
- package/.changeset/nervous-goats-allow.md +5 -0
- package/.changeset/nice-dots-matter.md +5 -0
- package/.changeset/ninety-bags-bake.md +17 -0
- package/.changeset/odd-chicken-hide.md +17 -0
- package/.changeset/odd-lemons-relax.md +5 -0
- package/.changeset/orange-suits-laugh.md +5 -0
- package/.changeset/perfect-ducks-reflect.md +12 -0
- package/.changeset/perfect-vans-give.md +7 -0
- package/.changeset/poor-eels-punch.md +5 -0
- package/.changeset/pre.json +70 -0
- package/.changeset/purple-bears-flash.md +5 -0
- package/.changeset/real-teachers-peel.md +5 -0
- package/.changeset/serious-moons-juggle.md +5 -0
- package/.changeset/seven-dragons-repair.md +14 -0
- package/.changeset/seven-schools-carry.md +5 -0
- package/.changeset/shaggy-pugs-add.md +52 -0
- package/.changeset/short-months-complain.md +5 -0
- package/.changeset/slimy-chicken-melt.md +5 -0
- package/.changeset/slimy-maps-press.md +5 -0
- package/.changeset/small-buttons-rhyme.md +5 -0
- package/.changeset/small-poems-rest.md +5 -0
- package/.changeset/swift-rivers-share.md +13 -0
- package/.changeset/tall-bikes-develop.md +5 -0
- package/.changeset/tame-points-work.md +11 -0
- package/.changeset/tender-swans-flash.md +16 -0
- package/.changeset/thick-books-grin.md +5 -0
- package/.changeset/thin-peas-hear.md +16 -0
- package/.changeset/tidy-pandas-punch.md +5 -0
- package/.changeset/tough-rockets-allow.md +5 -0
- package/.changeset/tricky-tables-shave.md +5 -0
- package/.changeset/unlucky-kiwis-sell.md +5 -0
- package/.changeset/warm-ties-sit.md +7 -0
- package/.changeset/wicked-forks-double.md +33 -0
- package/.changeset/young-phones-fold.md +5 -0
- package/.changeset/young-snails-grin.md +5 -0
- package/CHANGELOG.md +535 -0
- package/__cjs/cache/core/cache.cjs +2 -2
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +18 -18
- package/__cjs/cache/core/types/Cache.cjs.map +1 -1
- package/__cjs/cache/core/types/Cache.d.cts +9 -16
- package/__cjs/cache/core/types/DataProxy.d.cts +8 -23
- package/__cjs/cache/core/types/common.cjs +1 -0
- package/__cjs/cache/core/types/common.cjs.map +1 -1
- package/__cjs/cache/index.cjs +4 -4
- package/__cjs/cache/index.cjs.map +1 -1
- package/__cjs/cache/index.d.cts +3 -3
- package/__cjs/cache/inmemory/entityStore.cjs +9 -8
- package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/entityStore.d.cts +3 -2
- package/__cjs/cache/inmemory/fragmentRegistry.cjs +3 -3
- package/__cjs/cache/inmemory/fragmentRegistry.cjs.map +1 -1
- package/__cjs/cache/inmemory/helpers.cjs +0 -8
- package/__cjs/cache/inmemory/helpers.cjs.map +1 -1
- package/__cjs/cache/inmemory/helpers.d.cts +3 -4
- package/__cjs/cache/inmemory/inMemoryCache.cjs +4 -12
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.d.cts +8 -9
- package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
- package/__cjs/cache/inmemory/policies.cjs +9 -9
- package/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.d.cts +1 -1
- package/__cjs/cache/inmemory/reactiveVars.cjs.map +1 -1
- package/__cjs/cache/inmemory/reactiveVars.d.cts +7 -7
- package/__cjs/cache/inmemory/readFromStore.cjs +14 -56
- package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/readFromStore.d.cts +1 -6
- package/__cjs/cache/inmemory/types.d.cts +3 -17
- package/__cjs/cache/inmemory/writeToStore.cjs +8 -8
- package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/writeToStore.d.cts +2 -2
- package/__cjs/config/jest/areCombinedGraphQLErrorsEqual.cjs +6 -4
- package/__cjs/config/jest/areCombinedGraphQLErrorsEqual.cjs.map +1 -1
- package/__cjs/config/jest/areCombinedProtocolErrorsEqual.cjs +3 -3
- package/__cjs/config/jest/areCombinedProtocolErrorsEqual.cjs.map +1 -1
- package/__cjs/config/jest/areMissingFieldErrorsEqual.cjs +2 -3
- package/__cjs/config/jest/areMissingFieldErrorsEqual.cjs.map +1 -1
- package/__cjs/config/jest/areServerErrorsEqual.cjs +22 -0
- package/__cjs/config/jest/areServerErrorsEqual.cjs.map +1 -0
- package/__cjs/config/jest/areServerErrorsEqual.d.cts +3 -0
- package/__cjs/config/jest/resolver.cjs +11 -0
- package/__cjs/config/jest/resolver.cjs.map +1 -1
- package/__cjs/config/jest/setup.cjs +18 -1
- package/__cjs/config/jest/setup.cjs.map +1 -1
- package/__cjs/core/ApolloClient.cjs +37 -21
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +37 -27
- package/__cjs/core/LocalState.cjs +2 -3
- package/__cjs/core/LocalState.cjs.map +1 -1
- package/__cjs/core/LocalState.d.cts +7 -8
- package/__cjs/core/ObservableQuery.cjs +267 -103
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +156 -17
- package/__cjs/core/QueryInfo.cjs +12 -86
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +2 -11
- package/__cjs/core/QueryManager.cjs +173 -128
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/QueryManager.d.cts +51 -32
- package/__cjs/core/index.cjs +42 -21
- package/__cjs/core/index.cjs.map +1 -1
- package/__cjs/core/index.d.cts +12 -11
- package/__cjs/core/types.d.cts +65 -7
- package/__cjs/core/watchQueryOptions.d.cts +32 -119
- package/__cjs/errors/CombinedGraphQLErrors.cjs +30 -11
- 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 +20 -0
- package/__cjs/errors/LinkError.cjs.map +1 -0
- package/__cjs/errors/LinkError.d.cts +14 -0
- package/__cjs/errors/ServerError.cjs +6 -0
- package/__cjs/errors/ServerError.cjs.map +1 -1
- package/__cjs/errors/ServerError.d.cts +2 -0
- 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 +19 -4
- package/__cjs/errors/index.cjs.map +1 -1
- package/__cjs/errors/index.d.cts +2 -3
- 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/invariantErrorCodes.cjs +131 -138
- package/__cjs/link/batch/index.cjs +4 -2
- package/__cjs/link/batch/index.cjs.map +1 -1
- package/__cjs/link/batch/index.d.cts +2 -1
- package/__cjs/link/batch-http/batchHttpLink.cjs.map +1 -1
- package/__cjs/link/batch-http/batchHttpLink.d.cts +3 -2
- package/__cjs/link/batch-http/index.cjs +3 -2
- package/__cjs/link/batch-http/index.cjs.map +1 -1
- package/__cjs/link/batch-http/index.d.cts +1 -1
- package/__cjs/link/context/index.cjs.map +1 -1
- package/__cjs/link/context/index.d.cts +2 -3
- package/__cjs/link/core/ApolloLink.cjs +4 -22
- package/__cjs/link/core/ApolloLink.cjs.map +1 -1
- package/__cjs/link/core/ApolloLink.d.cts +3 -5
- package/__cjs/link/core/index.cjs.map +1 -1
- package/__cjs/link/core/index.d.cts +1 -1
- package/__cjs/link/core/types.d.cts +15 -4
- package/__cjs/link/error/index.cjs +13 -28
- package/__cjs/link/error/index.cjs.map +1 -1
- package/__cjs/link/error/index.d.cts +4 -15
- package/__cjs/link/http/HttpLink.cjs.map +1 -1
- package/__cjs/link/http/HttpLink.d.cts +128 -3
- package/__cjs/link/http/checkFetcher.cjs +1 -1
- package/__cjs/link/http/createHttpLink.cjs +1 -1
- package/__cjs/link/http/createHttpLink.cjs.map +1 -1
- package/__cjs/link/http/createHttpLink.d.cts +3 -2
- package/__cjs/link/http/index.cjs.map +1 -1
- package/__cjs/link/http/index.d.cts +0 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
- package/__cjs/link/http/rewriteURIForGET.cjs.map +1 -1
- package/__cjs/link/http/rewriteURIForGET.d.cts +2 -2
- package/__cjs/link/http/selectHttpOptionsAndBody.cjs.map +1 -1
- package/__cjs/link/http/selectHttpOptionsAndBody.d.cts +7 -82
- package/__cjs/link/http/serializeFetchParameter.cjs +1 -1
- package/__cjs/link/persisted-queries/index.cjs +3 -3
- package/__cjs/link/persisted-queries/index.cjs.map +1 -1
- package/__cjs/link/persisted-queries/index.d.cts +14 -3
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs +1 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.d.cts +10 -1
- package/__cjs/link/retry/index.cjs +3 -2
- package/__cjs/link/retry/index.cjs.map +1 -1
- package/__cjs/link/retry/index.d.cts +1 -1
- package/__cjs/link/subscriptions/index.cjs +3 -1
- package/__cjs/link/subscriptions/index.cjs.map +1 -1
- 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/validateOperation.cjs +1 -1
- package/__cjs/masking/maskDefinition.cjs +2 -2
- package/__cjs/masking/maskDefinition.cjs.map +1 -1
- package/__cjs/masking/maskDefinition.d.cts +1 -1
- package/__cjs/masking/maskFragment.cjs +2 -2
- package/__cjs/masking/maskFragment.cjs.map +1 -1
- package/__cjs/masking/maskFragment.d.cts +2 -2
- package/__cjs/masking/maskOperation.cjs +1 -1
- package/__cjs/masking/maskOperation.cjs.map +1 -1
- package/__cjs/masking/maskOperation.d.cts +2 -2
- package/__cjs/masking/utils.cjs +1 -1
- package/__cjs/react/context/ApolloConsumer.cjs +1 -1
- package/__cjs/react/context/ApolloConsumer.cjs.map +1 -1
- package/__cjs/react/context/ApolloConsumer.d.cts +7 -4
- package/__cjs/react/context/ApolloContext.cjs +1 -1
- package/__cjs/react/context/ApolloContext.cjs.map +1 -1
- package/__cjs/react/context/ApolloContext.d.cts +4 -4
- package/__cjs/react/context/ApolloProvider.cjs +1 -1
- package/__cjs/react/context/ApolloProvider.cjs.map +1 -1
- package/__cjs/react/context/ApolloProvider.d.cts +7 -5
- package/__cjs/react/hooks/internal/__use.d.cts +3 -1
- package/__cjs/react/hooks/internal/useIsomorphicLayoutEffect.d.cts +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 +26 -5
- package/__cjs/react/hooks/internal/wrapHook.cjs.map +1 -1
- package/__cjs/react/hooks/internal/wrapHook.d.cts +7 -5
- package/__cjs/react/hooks/useApolloClient.cjs +2 -2
- package/__cjs/react/hooks/useApolloClient.cjs.map +1 -1
- package/__cjs/react/hooks/useApolloClient.d.cts +2 -2
- package/__cjs/react/hooks/useBackgroundQuery.cjs +2 -2
- package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useBackgroundQuery.d.cts +143 -46
- package/__cjs/react/hooks/useFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useFragment.d.cts +51 -26
- package/__cjs/react/hooks/useLazyQuery.cjs +31 -32
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.d.cts +278 -276
- package/__cjs/react/hooks/useLoadableQuery.cjs +21 -2
- package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLoadableQuery.d.cts +106 -34
- package/__cjs/react/hooks/useMutation.cjs +14 -21
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.d.cts +231 -4
- package/__cjs/react/hooks/useQuery.cjs +87 -206
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +274 -4
- package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
- package/__cjs/react/hooks/useQueryRefHandlers.d.cts +23 -22
- package/__cjs/react/hooks/useReactiveVar.cjs.map +1 -1
- package/__cjs/react/hooks/useReactiveVar.d.cts +1 -1
- package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useReadQuery.d.cts +27 -25
- package/__cjs/react/hooks/useSubscription.cjs +9 -60
- package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
- package/__cjs/react/hooks/useSubscription.d.cts +94 -3
- package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseFragment.d.cts +40 -38
- package/__cjs/react/hooks/useSuspenseQuery.cjs +7 -32
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.d.cts +199 -38
- package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
- package/__cjs/react/index.cjs +37 -11
- package/__cjs/react/index.cjs.map +1 -1
- package/__cjs/react/index.d.cts +22 -6
- package/__cjs/react/index.react-server.cjs +1 -5
- package/__cjs/react/index.react-server.cjs.map +1 -1
- package/__cjs/react/index.react-server.d.cts +0 -1
- package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/FragmentReference.d.cts +3 -3
- package/__cjs/react/internal/cache/QueryReference.cjs +3 -14
- package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/QueryReference.d.cts +7 -7
- package/__cjs/react/internal/cache/SuspenseCache.cjs.map +1 -1
- package/__cjs/react/internal/cache/SuspenseCache.d.cts +3 -3
- package/__cjs/react/internal/cache/getSuspenseCache.cjs.map +1 -1
- package/__cjs/react/internal/cache/getSuspenseCache.d.cts +4 -4
- package/__cjs/react/internal/index.cjs +3 -1
- package/__cjs/react/internal/index.cjs.map +1 -1
- package/__cjs/react/internal/index.d.cts +2 -0
- package/__cjs/react/internal/types.d.cts +9 -0
- package/__cjs/react/query-preloader/createQueryPreloader.cjs +1 -0
- package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
- package/__cjs/react/query-preloader/createQueryPreloader.d.cts +6 -45
- package/__cjs/react/ssr/getDataFromTree.cjs +24 -30
- package/__cjs/react/ssr/getDataFromTree.cjs.map +1 -1
- package/__cjs/react/ssr/getDataFromTree.d.cts +12 -1
- package/__cjs/react/ssr/index.cjs +3 -3
- package/__cjs/react/ssr/index.cjs.map +1 -1
- package/__cjs/react/ssr/index.d.cts +1 -1
- package/__cjs/react/ssr/prerenderStatic.cjs +151 -0
- package/__cjs/react/ssr/prerenderStatic.cjs.map +1 -0
- package/__cjs/react/ssr/prerenderStatic.d.cts +122 -0
- package/__cjs/react/ssr/renderToStringWithData.cjs +11 -5
- package/__cjs/react/ssr/renderToStringWithData.cjs.map +1 -1
- package/__cjs/react/ssr/renderToStringWithData.d.cts +5 -0
- package/__cjs/react/ssr/useSSRQuery.cjs +60 -0
- package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -0
- package/__cjs/react/ssr/useSSRQuery.d.cts +5 -0
- package/__cjs/{utilities/types/TODO.cjs → react/types/deprecated.cjs} +1 -1
- package/__cjs/react/types/deprecated.cjs.map +1 -0
- package/__cjs/react/types/deprecated.d.cts +75 -0
- package/__cjs/react/types/types.documentation.d.cts +6 -34
- package/__cjs/testing/core/index.cjs +6 -3
- package/__cjs/testing/core/index.cjs.map +1 -1
- package/__cjs/testing/core/index.d.cts +3 -3
- package/__cjs/testing/core/mocking/mockClient.cjs +3 -4
- package/__cjs/testing/core/mocking/mockClient.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockClient.d.cts +2 -3
- package/__cjs/testing/core/mocking/mockLink.cjs +118 -112
- package/__cjs/testing/core/mocking/mockLink.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockLink.d.cts +26 -7
- package/__cjs/testing/experimental/createSchemaFetch.cjs +4 -4
- package/__cjs/testing/experimental/createSchemaFetch.cjs.map +1 -1
- package/__cjs/testing/experimental/createTestSchema.cjs.map +1 -1
- package/__cjs/testing/experimental/createTestSchema.d.cts +1 -1
- package/__cjs/testing/index.cjs +13 -2
- package/__cjs/testing/index.cjs.map +1 -1
- package/__cjs/testing/index.d.cts +2 -1
- package/__cjs/testing/internal/disposables/spyOnConsole.cjs +0 -1
- package/__cjs/testing/internal/disposables/spyOnConsole.cjs.map +1 -1
- package/__cjs/testing/internal/disposables/spyOnConsole.d.cts +0 -1
- package/__cjs/testing/internal/disposables/withProdMode.d.cts +1 -1
- package/__cjs/testing/internal/incremental.cjs.map +1 -1
- package/__cjs/testing/internal/incremental.d.cts +4 -3
- package/__cjs/testing/internal/index.cjs +17 -8
- package/__cjs/testing/internal/index.cjs.map +1 -1
- package/__cjs/testing/internal/index.d.cts +5 -3
- package/__cjs/testing/internal/link.cjs +16 -0
- package/__cjs/testing/internal/link.cjs.map +1 -0
- package/__cjs/testing/internal/link.d.cts +5 -0
- package/__cjs/testing/internal/renderHelpers.cjs.map +1 -1
- package/__cjs/testing/internal/renderHelpers.d.cts +3 -3
- package/__cjs/testing/internal/resetApolloContext.cjs +24 -0
- package/__cjs/testing/internal/resetApolloContext.cjs.map +1 -0
- package/__cjs/testing/internal/resetApolloContext.d.cts +10 -0
- package/__cjs/testing/internal/scenarios/index.cjs +9 -7
- package/__cjs/testing/internal/scenarios/index.cjs.map +1 -1
- package/__cjs/testing/internal/scenarios/index.d.cts +14 -5
- package/__cjs/testing/matchers/arrayWithLength.cjs +15 -0
- package/__cjs/testing/matchers/arrayWithLength.cjs.map +1 -0
- package/__cjs/testing/matchers/arrayWithLength.d.cts +3 -0
- package/__cjs/testing/matchers/index.cjs +6 -18
- package/__cjs/testing/matchers/index.cjs.map +1 -1
- package/__cjs/testing/matchers/isSameClient.cjs +19 -0
- package/__cjs/testing/matchers/isSameClient.cjs.map +1 -0
- package/__cjs/testing/matchers/isSameClient.d.cts +3 -0
- package/__cjs/testing/matchers/isSameObservableQuery.cjs +19 -0
- package/__cjs/testing/matchers/isSameObservableQuery.cjs.map +1 -0
- package/__cjs/testing/matchers/isSameObservableQuery.d.cts +3 -0
- package/__cjs/testing/matchers/toComplete.cjs.map +1 -1
- package/__cjs/testing/matchers/toEmitAnything.cjs.map +1 -1
- package/__cjs/testing/matchers/toEmitError.cjs.map +1 -1
- package/__cjs/testing/matchers/toEmitNext.cjs.map +1 -1
- package/__cjs/testing/matchers/{toEmitFetchResult.cjs → toEmitTypedValue.cjs} +9 -7
- package/__cjs/testing/matchers/toEmitTypedValue.cjs.map +1 -0
- package/__cjs/testing/matchers/{toEmitValueStrict.d.cts → toEmitTypedValue.d.cts} +2 -2
- package/__cjs/testing/matchers/toHaveSuspenseCacheEntryUsing.cjs +2 -2
- package/__cjs/testing/matchers/toHaveSuspenseCacheEntryUsing.cjs.map +1 -1
- package/__cjs/testing/matchers/toHaveSuspenseCacheEntryUsing.d.cts +1 -1
- package/__cjs/testing/matchers/toMatchDocument.cjs.map +1 -1
- package/__cjs/testing/matchers/toMatchDocument.d.cts +1 -1
- package/__cjs/testing/matchers/toStrictEqualTyped.cjs +32 -0
- package/__cjs/testing/matchers/toStrictEqualTyped.cjs.map +1 -0
- package/__cjs/testing/matchers/toStrictEqualTyped.d.cts +8 -0
- package/__cjs/testing/matchers/utils/getSerializableProperties.cjs +24 -0
- package/__cjs/testing/matchers/utils/getSerializableProperties.cjs.map +1 -0
- package/__cjs/testing/matchers/utils/getSerializableProperties.d.cts +4 -0
- package/__cjs/testing/react/MockedProvider.cjs +11 -7
- package/__cjs/testing/react/MockedProvider.cjs.map +1 -1
- package/__cjs/testing/react/MockedProvider.d.cts +8 -6
- package/__cjs/utilities/caching/sizes.cjs +2 -2
- package/__cjs/utilities/caching/sizes.cjs.map +1 -1
- package/__cjs/utilities/caching/sizes.d.cts +2 -20
- package/__cjs/utilities/common/errorHandling.d.cts +1 -1
- package/__cjs/utilities/common/mergeOptions.cjs.map +1 -1
- package/__cjs/utilities/common/mergeOptions.d.cts +1 -1
- package/__cjs/utilities/graphql/getFromAST.cjs +15 -6
- package/__cjs/utilities/graphql/getFromAST.cjs.map +1 -1
- package/__cjs/utilities/graphql/getFromAST.d.cts +2 -2
- package/__cjs/utilities/graphql/operations.cjs.map +1 -1
- package/__cjs/utilities/graphql/operations.d.cts +1 -1
- package/__cjs/utilities/graphql/storeUtils.cjs +1 -1
- package/__cjs/utilities/graphql/transform.cjs +2 -2
- package/__cjs/utilities/index.cjs +39 -19
- package/__cjs/utilities/index.cjs.map +1 -1
- package/__cjs/utilities/index.d.cts +16 -15
- package/__cjs/utilities/internal/getMemoryInternals.cjs +0 -2
- package/__cjs/utilities/internal/getMemoryInternals.cjs.map +1 -1
- package/__cjs/utilities/internal/getMemoryInternals.d.cts +1 -2
- package/__cjs/utilities/internal/index.cjs +3 -1
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +1 -0
- package/__cjs/utilities/internal/index.production.cjs +1 -0
- package/__cjs/utilities/internal/index.production.cjs.map +1 -1
- package/__cjs/utilities/internal/toQueryResult.cjs +13 -0
- package/__cjs/utilities/internal/toQueryResult.cjs.map +1 -0
- package/__cjs/utilities/internal/toQueryResult.d.cts +3 -0
- package/__cjs/utilities/invariant/index.development.cjs +1 -0
- package/__cjs/utilities/invariant/index.development.cjs.map +1 -1
- package/__cjs/utilities/subscriptions/relay/index.cjs +2 -2
- package/__cjs/utilities/subscriptions/relay/index.cjs.map +1 -1
- package/__cjs/utilities/subscriptions/relay/index.d.cts +1 -1
- package/__cjs/utilities/types/NoInfer.d.cts +1 -1
- package/__cjs/utilities/types/{OnlyRequiredProperties.cjs → VariablesOption.cjs} +1 -1
- package/__cjs/utilities/types/VariablesOption.cjs.map +1 -0
- package/__cjs/utilities/types/VariablesOption.d.cts +25 -0
- package/__cjs/version.cjs +1 -1
- package/__cjs/version.cjs.map +1 -1
- package/__cjs/version.d.cts +1 -1
- package/cache/core/cache.d.ts +18 -18
- package/cache/core/cache.js +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +9 -16
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +8 -23
- package/cache/core/types/common.js +1 -0
- package/cache/core/types/common.js.map +1 -1
- package/cache/index.d.ts +3 -3
- package/cache/index.js +1 -1
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +3 -2
- package/cache/inmemory/entityStore.js +9 -8
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fragmentRegistry.js +1 -1
- package/cache/inmemory/fragmentRegistry.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +0 -1
- package/cache/inmemory/helpers.js +0 -7
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +8 -9
- package/cache/inmemory/inMemoryCache.js +4 -12
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.d.ts +1 -1
- package/cache/inmemory/policies.js +9 -9
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/reactiveVars.d.ts +7 -7
- package/cache/inmemory/reactiveVars.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +1 -6
- package/cache/inmemory/readFromStore.js +14 -56
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +3 -17
- package/cache/inmemory/writeToStore.d.ts +2 -2
- package/cache/inmemory/writeToStore.js +8 -8
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/config/jest/areCombinedGraphQLErrorsEqual.js +6 -4
- package/config/jest/areCombinedGraphQLErrorsEqual.js.map +1 -1
- package/config/jest/areCombinedProtocolErrorsEqual.js +3 -3
- package/config/jest/areCombinedProtocolErrorsEqual.js.map +1 -1
- package/config/jest/areMissingFieldErrorsEqual.js +2 -3
- package/config/jest/areMissingFieldErrorsEqual.js.map +1 -1
- package/config/jest/areServerErrorsEqual.d.ts +3 -0
- package/config/jest/areServerErrorsEqual.js +18 -0
- package/config/jest/areServerErrorsEqual.js.map +1 -0
- package/config/jest/resolver.js +12 -1
- package/config/jest/resolver.js.map +1 -1
- package/config/jest/setup.js +19 -2
- package/config/jest/setup.js.map +1 -1
- package/core/ApolloClient.d.ts +37 -27
- package/core/ApolloClient.js +38 -22
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +5 -6
- package/core/LocalState.js +2 -3
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +156 -17
- package/core/ObservableQuery.js +266 -101
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +2 -11
- package/core/QueryInfo.js +12 -86
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +38 -29
- package/core/QueryManager.js +176 -131
- package/core/QueryManager.js.map +1 -1
- package/core/index.d.ts +12 -11
- package/core/index.js +9 -6
- package/core/index.js.map +1 -1
- package/core/types.d.ts +65 -7
- package/core/watchQueryOptions.d.ts +32 -119
- package/errors/CombinedGraphQLErrors.d.ts +21 -2
- package/errors/CombinedGraphQLErrors.js +30 -11
- 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 +14 -0
- package/errors/LinkError.js +16 -0
- package/errors/LinkError.js.map +1 -0
- package/errors/ServerError.d.ts +2 -0
- package/errors/ServerError.js +6 -0
- 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 +2 -3
- package/errors/index.js +13 -1
- 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/invariantErrorCodes.js +131 -138
- package/legacyEntryPoints/testing/internal/index.d.ts +1 -0
- package/legacyEntryPoints/testing/internal/index.js +1 -0
- package/legacyEntryPoints/testing/internal/internal.cjs +1 -0
- package/legacyEntryPoints/testing/internal/internal.d.cts +1 -0
- package/link/batch/index.d.ts +2 -1
- package/link/batch/index.js +1 -1
- package/link/batch/index.js.map +1 -1
- package/link/batch-http/batchHttpLink.d.ts +3 -2
- 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/context/index.d.ts +2 -3
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.d.ts +3 -5
- package/link/core/ApolloLink.js +4 -22
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/index.d.ts +1 -1
- package/link/core/index.js.map +1 -1
- package/link/core/types.d.ts +15 -4
- package/link/error/index.d.ts +4 -15
- package/link/error/index.js +14 -29
- package/link/error/index.js.map +1 -1
- package/link/http/HttpLink.d.ts +128 -3
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/checkFetcher.js +1 -1
- package/link/http/createHttpLink.d.ts +2 -2
- package/link/http/createHttpLink.js +1 -1
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/index.d.ts +0 -1
- package/link/http/index.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +1 -1
- package/link/http/rewriteURIForGET.d.ts +2 -2
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +7 -82
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.d.ts +2 -2
- package/link/persisted-queries/index.js +3 -3
- package/link/persisted-queries/index.js.map +1 -1
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
- package/link/retry/index.d.ts +1 -1
- package/link/retry/index.js +1 -1
- package/link/retry/index.js.map +1 -1
- package/link/subscriptions/index.js +3 -1
- 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/validateOperation.js +1 -1
- package/masking/maskDefinition.d.ts +1 -1
- package/masking/maskDefinition.js +2 -2
- package/masking/maskDefinition.js.map +1 -1
- package/masking/maskFragment.d.ts +2 -2
- package/masking/maskFragment.js +2 -2
- package/masking/maskFragment.js.map +1 -1
- package/masking/maskOperation.d.ts +2 -2
- package/masking/maskOperation.js +1 -1
- package/masking/maskOperation.js.map +1 -1
- package/masking/utils.js +1 -1
- package/package.json +20 -40
- package/react/context/ApolloConsumer.d.ts +7 -4
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloConsumer.js.map +1 -1
- package/react/context/ApolloContext.d.ts +4 -4
- package/react/context/ApolloContext.js +1 -1
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.d.ts +7 -5
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/ApolloProvider.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 +7 -5
- package/react/hooks/internal/wrapHook.js +24 -5
- package/react/hooks/internal/wrapHook.js.map +1 -1
- package/react/hooks/useApolloClient.d.ts +2 -2
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useBackgroundQuery.d.ts +143 -46
- package/react/hooks/useBackgroundQuery.js +2 -2
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.d.ts +51 -26
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +278 -276
- package/react/hooks/useLazyQuery.js +30 -31
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.d.ts +106 -34
- package/react/hooks/useLoadableQuery.js +21 -2
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +231 -4
- package/react/hooks/useMutation.js +14 -21
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +274 -4
- package/react/hooks/useQuery.js +86 -205
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useQueryRefHandlers.d.ts +23 -22
- package/react/hooks/useQueryRefHandlers.js.map +1 -1
- package/react/hooks/useReactiveVar.d.ts +1 -1
- package/react/hooks/useReactiveVar.js.map +1 -1
- package/react/hooks/useReadQuery.d.ts +27 -25
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +94 -9
- package/react/hooks/useSubscription.js +8 -56
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseFragment.d.ts +40 -38
- package/react/hooks/useSuspenseFragment.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +199 -38
- package/react/hooks/useSuspenseQuery.js +5 -26
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/index.d.ts +22 -6
- package/react/index.js +18 -3
- package/react/index.js.map +1 -1
- package/react/index.react-server.d.ts +0 -1
- package/react/index.react-server.js +0 -1
- package/react/index.react-server.js.map +1 -1
- package/react/internal/cache/FragmentReference.d.ts +3 -3
- package/react/internal/cache/FragmentReference.js.map +1 -1
- package/react/internal/cache/QueryReference.d.ts +5 -5
- package/react/internal/cache/QueryReference.js +3 -14
- 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/cache/getSuspenseCache.d.ts +3 -3
- package/react/internal/cache/getSuspenseCache.js.map +1 -1
- package/react/internal/index.d.ts +2 -0
- package/react/internal/index.js +2 -1
- package/react/internal/index.js.map +1 -1
- package/react/internal/types.d.ts +9 -0
- package/react/query-preloader/createQueryPreloader.d.ts +6 -45
- package/react/query-preloader/createQueryPreloader.js +1 -0
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/ssr/getDataFromTree.d.ts +12 -1
- package/react/ssr/getDataFromTree.js +24 -29
- package/react/ssr/getDataFromTree.js.map +1 -1
- package/react/ssr/index.d.ts +1 -1
- package/react/ssr/index.js +1 -1
- package/react/ssr/index.js.map +1 -1
- package/react/ssr/prerenderStatic.d.ts +122 -0
- package/react/ssr/prerenderStatic.js +147 -0
- package/react/ssr/prerenderStatic.js.map +1 -0
- package/react/ssr/renderToStringWithData.d.ts +5 -0
- package/react/ssr/renderToStringWithData.js +11 -5
- package/react/ssr/renderToStringWithData.js.map +1 -1
- package/react/ssr/useSSRQuery.d.ts +5 -0
- package/react/ssr/useSSRQuery.js +56 -0
- package/react/ssr/useSSRQuery.js.map +1 -0
- package/react/types/deprecated.d.ts +75 -0
- package/react/types/deprecated.js +2 -0
- package/react/types/deprecated.js.map +1 -0
- package/react/types/types.documentation.d.ts +6 -34
- package/testing/core/index.d.ts +3 -3
- package/testing/core/index.js +2 -2
- package/testing/core/index.js.map +1 -1
- package/testing/core/mocking/mockClient.d.ts +2 -3
- package/testing/core/mocking/mockClient.js +2 -3
- package/testing/core/mocking/mockClient.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +26 -7
- package/testing/core/mocking/mockLink.js +117 -113
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/experimental/createSchemaFetch.js +2 -2
- package/testing/experimental/createSchemaFetch.js.map +1 -1
- package/testing/experimental/createTestSchema.d.ts +1 -1
- package/testing/experimental/createTestSchema.js.map +1 -1
- package/testing/index.d.ts +2 -1
- package/testing/index.js +1 -1
- package/testing/index.js.map +1 -1
- package/testing/internal/disposables/spyOnConsole.d.ts +0 -1
- package/testing/internal/disposables/spyOnConsole.js +0 -1
- package/testing/internal/disposables/spyOnConsole.js.map +1 -1
- package/testing/internal/incremental.d.ts +1 -1
- package/testing/internal/incremental.js.map +1 -1
- package/testing/internal/index.d.ts +5 -3
- package/testing/internal/index.js +5 -3
- package/testing/internal/index.js.map +1 -1
- package/testing/internal/link.d.ts +5 -0
- package/testing/internal/link.js +12 -0
- package/testing/internal/link.js.map +1 -0
- package/testing/internal/renderHelpers.d.ts +3 -3
- package/testing/internal/renderHelpers.js.map +1 -1
- package/testing/internal/resetApolloContext.d.ts +10 -0
- package/testing/internal/resetApolloContext.js +20 -0
- package/testing/internal/resetApolloContext.js.map +1 -0
- package/testing/internal/scenarios/index.d.ts +6 -8
- package/testing/internal/scenarios/index.js +4 -2
- package/testing/internal/scenarios/index.js.map +1 -1
- package/testing/matchers/arrayWithLength.d.ts +3 -0
- package/testing/matchers/arrayWithLength.js +11 -0
- package/testing/matchers/arrayWithLength.js.map +1 -0
- package/testing/matchers/index.js +6 -18
- package/testing/matchers/index.js.map +1 -1
- package/testing/matchers/isSameClient.d.ts +3 -0
- package/testing/matchers/isSameClient.js +15 -0
- package/testing/matchers/isSameClient.js.map +1 -0
- package/testing/matchers/isSameObservableQuery.d.ts +3 -0
- package/testing/matchers/isSameObservableQuery.js +15 -0
- package/testing/matchers/isSameObservableQuery.js.map +1 -0
- package/testing/matchers/toComplete.js.map +1 -1
- package/testing/matchers/toEmitAnything.js.map +1 -1
- package/testing/matchers/toEmitError.js.map +1 -1
- package/testing/matchers/toEmitNext.js.map +1 -1
- package/testing/matchers/{toEmitValueStrict.d.ts → toEmitTypedValue.d.ts} +2 -2
- package/testing/matchers/{toEmitFetchResult.js → toEmitTypedValue.js} +7 -5
- package/testing/matchers/toEmitTypedValue.js.map +1 -0
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts +1 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.js +1 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map +1 -1
- package/testing/matchers/toMatchDocument.d.ts +1 -1
- package/testing/matchers/toMatchDocument.js.map +1 -1
- package/testing/matchers/toStrictEqualTyped.d.ts +8 -0
- package/testing/matchers/toStrictEqualTyped.js +28 -0
- package/testing/matchers/toStrictEqualTyped.js.map +1 -0
- package/testing/matchers/utils/getSerializableProperties.d.ts +4 -0
- package/testing/matchers/utils/getSerializableProperties.js +21 -0
- package/testing/matchers/utils/getSerializableProperties.js.map +1 -0
- package/testing/react/MockedProvider.d.ts +8 -6
- package/testing/react/MockedProvider.js +8 -4
- package/testing/react/MockedProvider.js.map +1 -1
- package/utilities/caching/sizes.d.ts +2 -20
- package/utilities/caching/sizes.js +2 -2
- package/utilities/caching/sizes.js.map +1 -1
- package/utilities/common/mergeOptions.d.ts +1 -1
- package/utilities/common/mergeOptions.js.map +1 -1
- package/utilities/graphql/getFromAST.d.ts +2 -2
- package/utilities/graphql/getFromAST.js +15 -6
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/operations.d.ts +1 -1
- package/utilities/graphql/operations.js.map +1 -1
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/index.d.ts +16 -15
- package/utilities/index.js +12 -12
- package/utilities/index.js.map +1 -1
- package/utilities/internal/getMemoryInternals.d.ts +0 -1
- package/utilities/internal/getMemoryInternals.js +0 -2
- package/utilities/internal/getMemoryInternals.js.map +1 -1
- package/utilities/internal/index.d.ts +1 -0
- package/utilities/internal/index.js +2 -1
- package/utilities/internal/index.js.map +1 -1
- package/utilities/internal/index.production.js +1 -0
- package/utilities/internal/index.production.js.map +1 -1
- package/utilities/internal/toQueryResult.d.ts +3 -0
- package/utilities/internal/toQueryResult.js +10 -0
- package/utilities/internal/toQueryResult.js.map +1 -0
- package/utilities/invariant/index.development.js +1 -0
- package/utilities/invariant/index.development.js.map +1 -1
- package/utilities/subscriptions/relay/index.d.ts +1 -1
- package/utilities/subscriptions/relay/index.js +1 -1
- package/utilities/subscriptions/relay/index.js.map +1 -1
- package/utilities/types/NoInfer.d.ts +1 -1
- package/utilities/types/VariablesOption.d.ts +25 -0
- package/utilities/types/VariablesOption.js +2 -0
- package/utilities/types/VariablesOption.js.map +1 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/__cjs/cache/inmemory/object-canon.cjs +0 -180
- package/__cjs/cache/inmemory/object-canon.cjs.map +0 -1
- package/__cjs/cache/inmemory/object-canon.d.cts +0 -12
- package/__cjs/index.cjs +0 -8
- package/__cjs/index.cjs.map +0 -1
- package/__cjs/index.d.cts +0 -3
- package/__cjs/react/context/index.cjs +0 -10
- package/__cjs/react/context/index.cjs.map +0 -1
- package/__cjs/react/context/index.d.cts +0 -7
- package/__cjs/react/hooks/index.cjs +0 -27
- package/__cjs/react/hooks/index.cjs.map +0 -1
- package/__cjs/react/hooks/index.d.cts +0 -22
- package/__cjs/react/parser/index.cjs +0 -115
- package/__cjs/react/parser/index.cjs.map +0 -1
- package/__cjs/react/parser/index.d.cts +0 -18
- package/__cjs/react/ssr/RenderPromises.cjs +0 -104
- package/__cjs/react/ssr/RenderPromises.cjs.map +0 -1
- package/__cjs/react/ssr/RenderPromises.d.cts +0 -22
- package/__cjs/react/types/types.d.cts +0 -689
- package/__cjs/testing/matchers/toEmitApolloQueryResult.cjs +0 -40
- package/__cjs/testing/matchers/toEmitApolloQueryResult.cjs.map +0 -1
- package/__cjs/testing/matchers/toEmitApolloQueryResult.d.cts +0 -8
- package/__cjs/testing/matchers/toEmitFetchResult.cjs.map +0 -1
- package/__cjs/testing/matchers/toEmitFetchResult.d.cts +0 -8
- package/__cjs/testing/matchers/toEmitMatchedValue.cjs +0 -40
- package/__cjs/testing/matchers/toEmitMatchedValue.cjs.map +0 -1
- package/__cjs/testing/matchers/toEmitMatchedValue.d.cts +0 -7
- package/__cjs/testing/matchers/toEmitValue.cjs +0 -41
- package/__cjs/testing/matchers/toEmitValue.cjs.map +0 -1
- package/__cjs/testing/matchers/toEmitValue.d.cts +0 -4
- package/__cjs/testing/matchers/toEmitValueStrict.cjs +0 -46
- package/__cjs/testing/matchers/toEmitValueStrict.cjs.map +0 -1
- package/__cjs/testing/matchers/toEqualApolloQueryResult.cjs +0 -24
- package/__cjs/testing/matchers/toEqualApolloQueryResult.cjs.map +0 -1
- package/__cjs/testing/matchers/toEqualApolloQueryResult.d.cts +0 -6
- package/__cjs/testing/matchers/toEqualFetchResult.cjs +0 -24
- package/__cjs/testing/matchers/toEqualFetchResult.cjs.map +0 -1
- package/__cjs/testing/matchers/toEqualFetchResult.d.cts +0 -4
- package/__cjs/testing/matchers/toEqualLazyQueryResult.cjs +0 -40
- package/__cjs/testing/matchers/toEqualLazyQueryResult.cjs.map +0 -1
- package/__cjs/testing/matchers/toEqualLazyQueryResult.d.cts +0 -10
- package/__cjs/testing/matchers/toEqualQueryResult.cjs +0 -40
- package/__cjs/testing/matchers/toEqualQueryResult.cjs.map +0 -1
- package/__cjs/testing/matchers/toEqualQueryResult.d.cts +0 -9
- package/__cjs/utilities/types/OnlyRequiredProperties.cjs.map +0 -1
- package/__cjs/utilities/types/OnlyRequiredProperties.d.cts +0 -7
- package/__cjs/utilities/types/TODO.cjs.map +0 -1
- package/__cjs/utilities/types/TODO.d.cts +0 -3
- package/cache/inmemory/object-canon.d.ts +0 -12
- package/cache/inmemory/object-canon.js +0 -176
- package/cache/inmemory/object-canon.js.map +0 -1
- package/index.d.ts +0 -3
- package/index.js +0 -3
- package/index.js.map +0 -1
- package/legacyEntryPoints/react/context/context.cjs +0 -1
- package/legacyEntryPoints/react/context/context.d.cts +0 -1
- package/legacyEntryPoints/react/context/index.d.ts +0 -1
- package/legacyEntryPoints/react/context/index.js +0 -1
- package/legacyEntryPoints/react/hooks/hooks.cjs +0 -1
- package/legacyEntryPoints/react/hooks/hooks.d.cts +0 -1
- package/legacyEntryPoints/react/hooks/index.d.ts +0 -1
- package/legacyEntryPoints/react/hooks/index.js +0 -1
- package/legacyEntryPoints/react/parser/index.d.ts +0 -1
- package/legacyEntryPoints/react/parser/index.js +0 -1
- package/legacyEntryPoints/react/parser/parser.cjs +0 -1
- package/legacyEntryPoints/react/parser/parser.d.cts +0 -1
- package/react/context/index.d.ts +0 -7
- package/react/context/index.js +0 -4
- package/react/context/index.js.map +0 -1
- package/react/hooks/index.d.ts +0 -22
- package/react/hooks/index.js +0 -15
- package/react/hooks/index.js.map +0 -1
- package/react/parser/index.d.ts +0 -18
- package/react/parser/index.js +0 -109
- package/react/parser/index.js.map +0 -1
- package/react/ssr/RenderPromises.d.ts +0 -22
- package/react/ssr/RenderPromises.js +0 -100
- package/react/ssr/RenderPromises.js.map +0 -1
- package/react/types/types.d.ts +0 -689
- package/testing/matchers/toEmitApolloQueryResult.d.ts +0 -8
- package/testing/matchers/toEmitApolloQueryResult.js +0 -36
- package/testing/matchers/toEmitApolloQueryResult.js.map +0 -1
- package/testing/matchers/toEmitFetchResult.d.ts +0 -8
- package/testing/matchers/toEmitFetchResult.js.map +0 -1
- package/testing/matchers/toEmitMatchedValue.d.ts +0 -7
- package/testing/matchers/toEmitMatchedValue.js +0 -36
- package/testing/matchers/toEmitMatchedValue.js.map +0 -1
- package/testing/matchers/toEmitValue.d.ts +0 -4
- package/testing/matchers/toEmitValue.js +0 -37
- package/testing/matchers/toEmitValue.js.map +0 -1
- package/testing/matchers/toEmitValueStrict.js +0 -42
- package/testing/matchers/toEmitValueStrict.js.map +0 -1
- package/testing/matchers/toEqualApolloQueryResult.d.ts +0 -6
- package/testing/matchers/toEqualApolloQueryResult.js +0 -20
- package/testing/matchers/toEqualApolloQueryResult.js.map +0 -1
- package/testing/matchers/toEqualFetchResult.d.ts +0 -4
- package/testing/matchers/toEqualFetchResult.js +0 -20
- package/testing/matchers/toEqualFetchResult.js.map +0 -1
- package/testing/matchers/toEqualLazyQueryResult.d.ts +0 -10
- package/testing/matchers/toEqualLazyQueryResult.js +0 -36
- package/testing/matchers/toEqualLazyQueryResult.js.map +0 -1
- package/testing/matchers/toEqualQueryResult.d.ts +0 -9
- package/testing/matchers/toEqualQueryResult.js +0 -36
- package/testing/matchers/toEqualQueryResult.js.map +0 -1
- 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/TODO.d.ts +0 -3
- package/utilities/types/TODO.js +0 -2
- package/utilities/types/TODO.js.map +0 -1
- /package/__cjs/react/{types → internal}/types.cjs +0 -0
- /package/__cjs/react/{types → internal}/types.cjs.map +0 -0
- /package/react/{types → internal}/types.js +0 -0
- /package/react/{types → internal}/types.js.map +0 -0
|
@@ -1,282 +1,284 @@
|
|
|
1
1
|
import type { TypedDocumentNode } from "@graphql-typed-document-node/core";
|
|
2
2
|
import type { DocumentNode } from "graphql";
|
|
3
|
-
import type { ApolloClient,
|
|
4
|
-
import { NetworkStatus } from "@apollo/client
|
|
5
|
-
import type { NoInfer } from "@apollo/client/
|
|
6
|
-
import type { VariablesOption } from "@apollo/client/react";
|
|
7
|
-
import type { OnlyRequiredProperties } from "@apollo/client/utilities";
|
|
3
|
+
import type { ApolloClient, DefaultContext, ErrorLike, ErrorPolicy, FetchMoreQueryOptions, MaybeMasked, ObservableQuery, OperationVariables, QueryResult, RefetchWritePolicy, SubscribeToMoreFunction, Unmasked, UpdateQueryMapFn, WatchQueryFetchPolicy, WatchQueryOptions } from "@apollo/client";
|
|
4
|
+
import { NetworkStatus } from "@apollo/client";
|
|
5
|
+
import type { NoInfer, VariablesOption } from "@apollo/client/utilities";
|
|
8
6
|
import type { NextFetchPolicyContext } from "../../core/watchQueryOptions.js";
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
7
|
+
export declare namespace useLazyQuery {
|
|
8
|
+
interface Options<TData = unknown, TVariables extends OperationVariables = OperationVariables> {
|
|
9
|
+
/**
|
|
10
|
+
* Specifies how the query interacts with the Apollo Client cache during execution (for example, whether it checks the cache for results before sending a request to the server).
|
|
11
|
+
*
|
|
12
|
+
* For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy).
|
|
13
|
+
*
|
|
14
|
+
* The default value is `cache-first`.
|
|
15
|
+
*
|
|
16
|
+
* @docGroup
|
|
17
|
+
*
|
|
18
|
+
* 3. Caching options
|
|
19
|
+
*/
|
|
20
|
+
fetchPolicy?: WatchQueryFetchPolicy;
|
|
21
|
+
/**
|
|
22
|
+
* Specifies the `FetchPolicy` to be used after this query has completed.
|
|
23
|
+
*
|
|
24
|
+
* @docGroup
|
|
25
|
+
*
|
|
26
|
+
* 3. Caching options
|
|
27
|
+
*/
|
|
28
|
+
nextFetchPolicy?: WatchQueryFetchPolicy | ((this: WatchQueryOptions<TVariables, TData>, currentFetchPolicy: WatchQueryFetchPolicy, context: NextFetchPolicyContext<TData, TVariables>) => WatchQueryFetchPolicy);
|
|
29
|
+
/**
|
|
30
|
+
* Specifies whether a `NetworkStatus.refetch` operation should merge incoming field data with existing data, or overwrite the existing data. Overwriting is probably preferable, but merging is currently the default behavior, for backwards compatibility with Apollo Client 3.x.
|
|
31
|
+
*
|
|
32
|
+
* @docGroup
|
|
33
|
+
*
|
|
34
|
+
* 3. Caching options
|
|
35
|
+
*/
|
|
36
|
+
refetchWritePolicy?: RefetchWritePolicy;
|
|
37
|
+
/**
|
|
38
|
+
* Specifies how the query handles a response that returns both GraphQL errors and partial results.
|
|
39
|
+
*
|
|
40
|
+
* For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).
|
|
41
|
+
*
|
|
42
|
+
* The default value is `none`, meaning that the query result includes error details but not partial results.
|
|
43
|
+
*
|
|
44
|
+
* @docGroup
|
|
45
|
+
*
|
|
46
|
+
* 1. Operation options
|
|
47
|
+
*/
|
|
48
|
+
errorPolicy?: ErrorPolicy;
|
|
49
|
+
/**
|
|
50
|
+
* Specifies the interval (in milliseconds) at which the query polls for updated results.
|
|
51
|
+
*
|
|
52
|
+
* The default value is `0` (no polling).
|
|
53
|
+
*
|
|
54
|
+
* @docGroup
|
|
55
|
+
*
|
|
56
|
+
* 2. Networking options
|
|
57
|
+
*/
|
|
58
|
+
pollInterval?: number;
|
|
59
|
+
/**
|
|
60
|
+
* If `true`, the in-progress query's associated component re-renders whenever the network status changes or a network error occurs.
|
|
61
|
+
*
|
|
62
|
+
* The default value is `true`.
|
|
63
|
+
*
|
|
64
|
+
* @docGroup
|
|
65
|
+
*
|
|
66
|
+
* 2. Networking options
|
|
67
|
+
*/
|
|
68
|
+
notifyOnNetworkStatusChange?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* If `true`, the query can return partial results from the cache if the cache doesn't contain results for all queried fields.
|
|
71
|
+
*
|
|
72
|
+
* The default value is `false`.
|
|
73
|
+
*
|
|
74
|
+
* @docGroup
|
|
75
|
+
*
|
|
76
|
+
* 3. Caching options
|
|
77
|
+
*/
|
|
78
|
+
returnPartialData?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* A callback function that's called whenever a refetch attempt occurs while polling. If the function returns `true`, the refetch is skipped and not reattempted until the next poll interval.
|
|
81
|
+
*
|
|
82
|
+
* @docGroup
|
|
83
|
+
*
|
|
84
|
+
* 2. Networking options
|
|
85
|
+
*/
|
|
86
|
+
skipPollAttempt?: () => boolean;
|
|
87
|
+
/**
|
|
88
|
+
* The instance of `ApolloClient` to use to execute the query.
|
|
89
|
+
*
|
|
90
|
+
* By default, the instance that's passed down via context is used, but you can provide a different instance here.
|
|
91
|
+
*
|
|
92
|
+
* @docGroup
|
|
93
|
+
*
|
|
94
|
+
* 1. Operation options
|
|
95
|
+
*/
|
|
96
|
+
client?: ApolloClient;
|
|
97
|
+
/**
|
|
98
|
+
* If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain.
|
|
99
|
+
*
|
|
100
|
+
* @docGroup
|
|
101
|
+
*
|
|
102
|
+
* 2. Networking options
|
|
103
|
+
*/
|
|
104
|
+
context?: DefaultContext;
|
|
105
|
+
}
|
|
106
|
+
type Result<TData, TVariables extends OperationVariables> = {
|
|
107
|
+
/**
|
|
108
|
+
* A function that instructs the query to begin re-executing at a specified interval (in milliseconds).
|
|
109
|
+
*
|
|
110
|
+
*
|
|
111
|
+
* @docGroup
|
|
112
|
+
*
|
|
113
|
+
* 3. Helper functions
|
|
114
|
+
*/
|
|
115
|
+
startPolling: (pollInterval: number) => void;
|
|
116
|
+
/**
|
|
117
|
+
* A function that instructs the query to stop polling after a previous call to `startPolling`.
|
|
118
|
+
*
|
|
119
|
+
*
|
|
120
|
+
* @docGroup
|
|
121
|
+
*
|
|
122
|
+
* 3. Helper functions
|
|
123
|
+
*/
|
|
124
|
+
stopPolling: () => void;
|
|
125
|
+
/**
|
|
126
|
+
* A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query.
|
|
127
|
+
*
|
|
128
|
+
* This function returns _another_ function that you can call to terminate the subscription.
|
|
129
|
+
*
|
|
130
|
+
*
|
|
131
|
+
* @docGroup
|
|
132
|
+
*
|
|
133
|
+
* 3. Helper functions
|
|
134
|
+
*/
|
|
135
|
+
subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;
|
|
136
|
+
/**
|
|
137
|
+
* A function that enables you to update the query's cached result without executing a followup GraphQL operation.
|
|
138
|
+
*
|
|
139
|
+
* See [using updateQuery and updateFragment](https://www.apollographql.com/docs/react/caching/cache-interaction/#using-updatequery-and-updatefragment) for additional information.
|
|
140
|
+
*
|
|
141
|
+
*
|
|
142
|
+
* @docGroup
|
|
143
|
+
*
|
|
144
|
+
* 3. Helper functions
|
|
145
|
+
*/
|
|
146
|
+
updateQuery: (mapFn: UpdateQueryMapFn<TData, TVariables>) => void;
|
|
147
|
+
/**
|
|
148
|
+
* A function that enables you to re-execute the query, optionally passing in new `variables`.
|
|
149
|
+
*
|
|
150
|
+
* To guarantee that the refetch performs a network request, its `fetchPolicy` is set to `network-only` (unless the original query's `fetchPolicy` is `no-cache` or `cache-and-network`, which also guarantee a network request).
|
|
151
|
+
*
|
|
152
|
+
* See also [Refetching](https://www.apollographql.com/docs/react/data/queries/#refetching).
|
|
153
|
+
*
|
|
154
|
+
* @docGroup
|
|
155
|
+
*
|
|
156
|
+
* 3. Helper functions
|
|
157
|
+
*/
|
|
158
|
+
refetch: (variables?: Partial<TVariables>) => Promise<QueryResult<MaybeMasked<TData>>>;
|
|
159
|
+
/**
|
|
160
|
+
* 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/).
|
|
161
|
+
*
|
|
162
|
+
*
|
|
163
|
+
* @docGroup
|
|
164
|
+
*
|
|
165
|
+
* 3. Helper functions
|
|
166
|
+
*/
|
|
167
|
+
fetchMore: <TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
|
|
168
|
+
updateQuery?: (previousQueryResult: Unmasked<TData>, options: {
|
|
169
|
+
fetchMoreResult: Unmasked<TFetchData>;
|
|
170
|
+
variables: TFetchVars;
|
|
171
|
+
}) => Unmasked<TData>;
|
|
172
|
+
}) => Promise<QueryResult<MaybeMasked<TFetchData>>>;
|
|
173
|
+
/**
|
|
174
|
+
* The instance of Apollo Client that executed the query. Can be useful for manually executing followup queries or writing data to the cache.
|
|
175
|
+
*
|
|
176
|
+
* @docGroup
|
|
177
|
+
*
|
|
178
|
+
* 2. Network info
|
|
179
|
+
*/
|
|
180
|
+
client: ApolloClient;
|
|
181
|
+
/**
|
|
182
|
+
* A reference to the internal `ObservableQuery` used by the hook.
|
|
183
|
+
*/
|
|
184
|
+
observable: ObservableQuery<TData, TVariables>;
|
|
185
|
+
/**
|
|
186
|
+
* An object containing the result of your GraphQL query after it completes.
|
|
187
|
+
*
|
|
188
|
+
* This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`).
|
|
189
|
+
*
|
|
190
|
+
* @docGroup
|
|
191
|
+
*
|
|
192
|
+
* 1. Operation data
|
|
193
|
+
*/
|
|
194
|
+
data: MaybeMasked<TData> | undefined;
|
|
195
|
+
/**
|
|
196
|
+
* An object containing the result from the most recent _previous_ execution of this query.
|
|
197
|
+
*
|
|
198
|
+
* This value is `undefined` if this is the query's first execution.
|
|
199
|
+
*
|
|
200
|
+
* @docGroup
|
|
201
|
+
*
|
|
202
|
+
* 1. Operation data
|
|
203
|
+
*/
|
|
204
|
+
previousData?: MaybeMasked<TData>;
|
|
205
|
+
/**
|
|
206
|
+
* If the query produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`.
|
|
207
|
+
*
|
|
208
|
+
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
209
|
+
*
|
|
210
|
+
* @docGroup
|
|
211
|
+
*
|
|
212
|
+
* 1. Operation data
|
|
213
|
+
*/
|
|
214
|
+
error?: ErrorLike;
|
|
215
|
+
/**
|
|
216
|
+
* If `true`, the query is still in flight and results have not yet been returned.
|
|
217
|
+
*
|
|
218
|
+
* @docGroup
|
|
219
|
+
*
|
|
220
|
+
* 2. Network info
|
|
221
|
+
*/
|
|
222
|
+
loading: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* A number indicating the current network state of the query's associated request. [See possible values.](https://github.com/apollographql/apollo-client/blob/d96f4578f89b933c281bb775a39503f6cdb59ee8/src/core/networkStatus.ts#L4)
|
|
225
|
+
*
|
|
226
|
+
* Used in conjunction with the [`notifyOnNetworkStatusChange`](#notifyonnetworkstatuschange) option.
|
|
227
|
+
*
|
|
228
|
+
* @docGroup
|
|
229
|
+
*
|
|
230
|
+
* 2. Network info
|
|
231
|
+
*/
|
|
232
|
+
networkStatus: NetworkStatus;
|
|
233
|
+
} & ({
|
|
234
|
+
/**
|
|
235
|
+
* If `true`, the associated lazy query has been executed.
|
|
236
|
+
*
|
|
237
|
+
* @docGroup 2. Network info
|
|
238
|
+
*/
|
|
239
|
+
called: true;
|
|
240
|
+
/**
|
|
241
|
+
* An object containing the variables that were provided for the query.
|
|
242
|
+
*
|
|
243
|
+
* @docGroup
|
|
244
|
+
*
|
|
245
|
+
* 1. Operation data
|
|
246
|
+
*/
|
|
247
|
+
variables: TVariables;
|
|
248
|
+
} | {
|
|
249
|
+
/**
|
|
250
|
+
* If `true`, the associated lazy query has been executed.
|
|
251
|
+
*
|
|
252
|
+
* @docGroup 2. Network info
|
|
253
|
+
*/
|
|
254
|
+
called: false;
|
|
255
|
+
/**
|
|
256
|
+
* An object containing the variables that were provided for the query.
|
|
257
|
+
*
|
|
258
|
+
* @docGroup
|
|
259
|
+
*
|
|
260
|
+
* 1. Operation data
|
|
261
|
+
*/
|
|
262
|
+
variables: Partial<TVariables>;
|
|
263
|
+
});
|
|
264
|
+
type ExecOptions<TVariables extends OperationVariables = OperationVariables> = {
|
|
265
|
+
/**
|
|
266
|
+
* If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain.
|
|
267
|
+
*
|
|
268
|
+
* @docGroup
|
|
269
|
+
*
|
|
270
|
+
* 2. Networking options
|
|
271
|
+
*/
|
|
272
|
+
context?: DefaultContext;
|
|
273
|
+
} & VariablesOption<TVariables>;
|
|
274
|
+
type ResultTuple<TData, TVariables extends OperationVariables> = [
|
|
275
|
+
execute: ExecFunction<TData, TVariables>,
|
|
276
|
+
result: useLazyQuery.Result<TData, TVariables>
|
|
277
|
+
];
|
|
278
|
+
type ExecFunction<TData, TVariables extends OperationVariables> = (...args: {} extends TVariables ? [
|
|
279
|
+
options?: useLazyQuery.ExecOptions<TVariables>
|
|
280
|
+
] : [options: useLazyQuery.ExecOptions<TVariables>]) => Promise<QueryResult<TData>>;
|
|
114
281
|
}
|
|
115
|
-
export type LazyQueryHookExecOptions<TVariables extends OperationVariables = OperationVariables> = {
|
|
116
|
-
/**
|
|
117
|
-
* If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain.
|
|
118
|
-
*
|
|
119
|
-
* @docGroup
|
|
120
|
-
*
|
|
121
|
-
* 2. Networking options
|
|
122
|
-
*/
|
|
123
|
-
context?: DefaultContext;
|
|
124
|
-
} & VariablesOption<TVariables>;
|
|
125
|
-
export interface LazyQueryResult<TData, TVariables extends OperationVariables> {
|
|
126
|
-
/**
|
|
127
|
-
* A function that instructs the query to begin re-executing at a specified interval (in milliseconds).
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
* @docGroup
|
|
131
|
-
*
|
|
132
|
-
* 3. Helper functions
|
|
133
|
-
*/
|
|
134
|
-
startPolling: (pollInterval: number) => void;
|
|
135
|
-
/**
|
|
136
|
-
* A function that instructs the query to stop polling after a previous call to `startPolling`.
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* @docGroup
|
|
140
|
-
*
|
|
141
|
-
* 3. Helper functions
|
|
142
|
-
*/
|
|
143
|
-
stopPolling: () => void;
|
|
144
|
-
/**
|
|
145
|
-
* A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query.
|
|
146
|
-
*
|
|
147
|
-
* This function returns _another_ function that you can call to terminate the subscription.
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
* @docGroup
|
|
151
|
-
*
|
|
152
|
-
* 3. Helper functions
|
|
153
|
-
*/
|
|
154
|
-
subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;
|
|
155
|
-
/**
|
|
156
|
-
* A function that enables you to update the query's cached result without executing a followup GraphQL operation.
|
|
157
|
-
*
|
|
158
|
-
* See [using updateQuery and updateFragment](https://www.apollographql.com/docs/react/caching/cache-interaction/#using-updatequery-and-updatefragment) for additional information.
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
* @docGroup
|
|
162
|
-
*
|
|
163
|
-
* 3. Helper functions
|
|
164
|
-
*/
|
|
165
|
-
updateQuery: (mapFn: UpdateQueryMapFn<TData, TVariables>) => void;
|
|
166
|
-
/**
|
|
167
|
-
* A function that enables you to re-execute the query, optionally passing in new `variables`.
|
|
168
|
-
*
|
|
169
|
-
* To guarantee that the refetch performs a network request, its `fetchPolicy` is set to `network-only` (unless the original query's `fetchPolicy` is `no-cache` or `cache-and-network`, which also guarantee a network request).
|
|
170
|
-
*
|
|
171
|
-
* See also [Refetching](https://www.apollographql.com/docs/react/data/queries/#refetching).
|
|
172
|
-
*
|
|
173
|
-
* @docGroup
|
|
174
|
-
*
|
|
175
|
-
* 3. Helper functions
|
|
176
|
-
*/
|
|
177
|
-
refetch: (variables?: Partial<TVariables>) => Promise<ApolloQueryResult<MaybeMasked<TData>>>;
|
|
178
|
-
/**
|
|
179
|
-
* An object containing the variables that were provided for the query.
|
|
180
|
-
*
|
|
181
|
-
* @docGroup
|
|
182
|
-
*
|
|
183
|
-
* 1. Operation data
|
|
184
|
-
*/
|
|
185
|
-
variables: TVariables | undefined;
|
|
186
|
-
/**
|
|
187
|
-
* 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/).
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
* @docGroup
|
|
191
|
-
*
|
|
192
|
-
* 3. Helper functions
|
|
193
|
-
*/
|
|
194
|
-
fetchMore: <TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
|
|
195
|
-
updateQuery?: (previousQueryResult: Unmasked<TData>, options: {
|
|
196
|
-
fetchMoreResult: Unmasked<TFetchData>;
|
|
197
|
-
variables: TFetchVars;
|
|
198
|
-
}) => Unmasked<TData>;
|
|
199
|
-
}) => Promise<ApolloQueryResult<MaybeMasked<TFetchData>>>;
|
|
200
|
-
/**
|
|
201
|
-
* The instance of Apollo Client that executed the query. Can be useful for manually executing followup queries or writing data to the cache.
|
|
202
|
-
*
|
|
203
|
-
* @docGroup
|
|
204
|
-
*
|
|
205
|
-
* 2. Network info
|
|
206
|
-
*/
|
|
207
|
-
client: ApolloClient<any>;
|
|
208
|
-
/**
|
|
209
|
-
* A reference to the internal `ObservableQuery` used by the hook.
|
|
210
|
-
*/
|
|
211
|
-
observable: ObservableQuery<TData, TVariables>;
|
|
212
|
-
/**
|
|
213
|
-
* An object containing the result of your GraphQL query after it completes.
|
|
214
|
-
*
|
|
215
|
-
* This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`).
|
|
216
|
-
*
|
|
217
|
-
* @docGroup
|
|
218
|
-
*
|
|
219
|
-
* 1. Operation data
|
|
220
|
-
*/
|
|
221
|
-
data: MaybeMasked<TData> | undefined;
|
|
222
|
-
/**
|
|
223
|
-
* An object containing the result from the most recent _previous_ execution of this query.
|
|
224
|
-
*
|
|
225
|
-
* This value is `undefined` if this is the query's first execution.
|
|
226
|
-
*
|
|
227
|
-
* @docGroup
|
|
228
|
-
*
|
|
229
|
-
* 1. Operation data
|
|
230
|
-
*/
|
|
231
|
-
previousData?: MaybeMasked<TData>;
|
|
232
|
-
/**
|
|
233
|
-
* If the query produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`.
|
|
234
|
-
*
|
|
235
|
-
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
236
|
-
*
|
|
237
|
-
* @docGroup
|
|
238
|
-
*
|
|
239
|
-
* 1. Operation data
|
|
240
|
-
*/
|
|
241
|
-
error?: ErrorLike;
|
|
242
|
-
/**
|
|
243
|
-
* If `true`, the query is still in flight and results have not yet been returned.
|
|
244
|
-
*
|
|
245
|
-
* @docGroup
|
|
246
|
-
*
|
|
247
|
-
* 2. Network info
|
|
248
|
-
*/
|
|
249
|
-
loading: boolean;
|
|
250
|
-
/**
|
|
251
|
-
* A number indicating the current network state of the query's associated request. [See possible values.](https://github.com/apollographql/apollo-client/blob/d96f4578f89b933c281bb775a39503f6cdb59ee8/src/core/networkStatus.ts#L4)
|
|
252
|
-
*
|
|
253
|
-
* Used in conjunction with the [`notifyOnNetworkStatusChange`](#notifyonnetworkstatuschange) option.
|
|
254
|
-
*
|
|
255
|
-
* @docGroup
|
|
256
|
-
*
|
|
257
|
-
* 2. Network info
|
|
258
|
-
*/
|
|
259
|
-
networkStatus: NetworkStatus;
|
|
260
|
-
/**
|
|
261
|
-
* If `true`, the associated lazy query has been executed.
|
|
262
|
-
*
|
|
263
|
-
* This field is only present on the result object returned by [`useLazyQuery`](/react/data/queries/#executing-queries-manually).
|
|
264
|
-
*
|
|
265
|
-
* @docGroup
|
|
266
|
-
*
|
|
267
|
-
* 2. Network info
|
|
268
|
-
*/
|
|
269
|
-
called: boolean;
|
|
270
|
-
}
|
|
271
|
-
export type LazyQueryResultTuple<TData, TVariables extends OperationVariables> = [
|
|
272
|
-
execute: LazyQueryExecFunction<TData, TVariables>,
|
|
273
|
-
result: LazyQueryResult<TData, TVariables>
|
|
274
|
-
];
|
|
275
|
-
export type LazyQueryExecFunction<TData, TVariables extends OperationVariables> = (...args: [TVariables] extends [never] ? [
|
|
276
|
-
options?: LazyQueryHookExecOptions<TVariables>
|
|
277
|
-
] : Record<string, never> extends OnlyRequiredProperties<TVariables> ? [
|
|
278
|
-
options?: LazyQueryHookExecOptions<TVariables>
|
|
279
|
-
] : [options: LazyQueryHookExecOptions<TVariables>]) => Promise<ApolloQueryResult<TData>>;
|
|
280
282
|
/**
|
|
281
283
|
* A hook for imperatively executing queries in an Apollo application, e.g. in response to user interaction.
|
|
282
284
|
*
|
|
@@ -312,5 +314,5 @@ export type LazyQueryExecFunction<TData, TVariables extends OperationVariables>
|
|
|
312
314
|
* @param options - Default options to control how the query is executed.
|
|
313
315
|
* @returns A tuple in the form of `[execute, result]`
|
|
314
316
|
*/
|
|
315
|
-
export declare function useLazyQuery<TData =
|
|
317
|
+
export declare function useLazyQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: useLazyQuery.Options<NoInfer<TData>, NoInfer<TVariables>>): useLazyQuery.ResultTuple<TData, TVariables>;
|
|
316
318
|
//# sourceMappingURL=useLazyQuery.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { equal } from "@wry/equality";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { NetworkStatus } from "@apollo/client
|
|
3
|
+
import { NetworkStatus } from "@apollo/client";
|
|
4
4
|
import { maybeDeepFreeze } from "@apollo/client/utilities";
|
|
5
5
|
import { invariant } from "@apollo/client/utilities/invariant";
|
|
6
6
|
import { useRenderGuard } from "./internal/index.js";
|
|
@@ -86,7 +86,7 @@ export function useLazyQuery(query, options) {
|
|
|
86
86
|
}, []);
|
|
87
87
|
const observableResult = useSyncExternalStore(React.useCallback((forceUpdate) => {
|
|
88
88
|
const subscription = observable.subscribe((result) => {
|
|
89
|
-
if (!equal(resultRef.current, result)) {
|
|
89
|
+
if (!equal(resultRef.current || initialResult, result)) {
|
|
90
90
|
updateResult(result, forceUpdate);
|
|
91
91
|
}
|
|
92
92
|
});
|
|
@@ -94,16 +94,15 @@ export function useLazyQuery(query, options) {
|
|
|
94
94
|
subscription.unsubscribe();
|
|
95
95
|
};
|
|
96
96
|
}, [observable, updateResult]), () => resultRef.current || initialResult, () => initialResult);
|
|
97
|
-
const [, forceUpdateState] = React.useReducer((tick) => tick + 1, 0);
|
|
98
97
|
// We use useMemo here to make sure the eager methods have a stable identity.
|
|
99
98
|
const eagerMethods = React.useMemo(() => {
|
|
100
99
|
const eagerMethods = {};
|
|
101
100
|
for (const key of EAGER_METHODS) {
|
|
102
101
|
// eslint-disable-next-line react-compiler/react-compiler
|
|
103
|
-
eagerMethods[key] = function () {
|
|
102
|
+
eagerMethods[key] = function (...args) {
|
|
104
103
|
invariant(resultRef.current, 32, key);
|
|
105
104
|
// @ts-expect-error this is just to generic to type
|
|
106
|
-
return observable[key]
|
|
105
|
+
return observable[key](...args);
|
|
107
106
|
};
|
|
108
107
|
}
|
|
109
108
|
return eagerMethods;
|
|
@@ -124,7 +123,7 @@ export function useLazyQuery(query, options) {
|
|
|
124
123
|
// the fetch policy away from standby for us when called for the first time.
|
|
125
124
|
if (observable.options.fetchPolicy !== "standby" &&
|
|
126
125
|
stableOptions?.fetchPolicy) {
|
|
127
|
-
updatedOptions.fetchPolicy = stableOptions
|
|
126
|
+
updatedOptions.fetchPolicy = stableOptions.fetchPolicy;
|
|
128
127
|
}
|
|
129
128
|
observable.silentSetOptions(updatedOptions);
|
|
130
129
|
}, [
|
|
@@ -140,37 +139,37 @@ export function useLazyQuery(query, options) {
|
|
|
140
139
|
const execute = React.useCallback((...args) => {
|
|
141
140
|
invariant(!calledDuringRender(), 33);
|
|
142
141
|
const [executeOptions] = args;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
variables: (executeOptions?.variables ?? {}),
|
|
147
|
-
};
|
|
148
|
-
if (observable.options.fetchPolicy === "standby") {
|
|
149
|
-
options.fetchPolicy = observable.options.initialFetchPolicy;
|
|
150
|
-
}
|
|
151
|
-
const promise = observable.setOptions(options);
|
|
152
|
-
// TODO: This should be fixed in core
|
|
153
|
-
if (!resultRef.current && stableOptions?.notifyOnNetworkStatusChange) {
|
|
154
|
-
updateResult(observable.getCurrentResult(), forceUpdateState);
|
|
142
|
+
let fetchPolicy = observable.options.fetchPolicy;
|
|
143
|
+
if (fetchPolicy === "standby") {
|
|
144
|
+
fetchPolicy = observable.options.initialFetchPolicy;
|
|
155
145
|
}
|
|
156
|
-
return
|
|
157
|
-
|
|
146
|
+
return observable.reobserve({
|
|
147
|
+
...executeOptions,
|
|
148
|
+
fetchPolicy,
|
|
149
|
+
// If `variables` is not given, reset back to empty variables by
|
|
150
|
+
// ensuring the key exists in options
|
|
151
|
+
variables: executeOptions?.variables,
|
|
152
|
+
});
|
|
153
|
+
}, [observable, calledDuringRender]);
|
|
158
154
|
const executeRef = React.useRef(execute);
|
|
159
155
|
useIsomorphicLayoutEffect(() => {
|
|
160
156
|
executeRef.current = execute;
|
|
161
157
|
});
|
|
162
158
|
const stableExecute = React.useCallback((...args) => executeRef.current(...args), []);
|
|
163
|
-
const result = React.useMemo(() =>
|
|
164
|
-
...
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
159
|
+
const result = React.useMemo(() => {
|
|
160
|
+
const { partial, ...result } = observableResult;
|
|
161
|
+
return {
|
|
162
|
+
...eagerMethods,
|
|
163
|
+
...result,
|
|
164
|
+
client,
|
|
165
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
166
|
+
previousData: previousDataRef.current,
|
|
167
|
+
variables: observable.variables,
|
|
168
|
+
observable,
|
|
169
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
170
|
+
called: !!resultRef.current,
|
|
171
|
+
};
|
|
172
|
+
}, [client, observableResult, eagerMethods, observable]);
|
|
174
173
|
return [stableExecute, result];
|
|
175
174
|
}
|
|
176
175
|
const initialResult = maybeDeepFreeze({
|