@apollo/client 4.0.0-alpha.7 → 4.0.0-alpha.9
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-moons-arrive.md +5 -0
- package/.changeset/beige-mirrors-talk.md +15 -0
- package/.changeset/early-eggs-develop.md +22 -0
- package/.changeset/forty-tomatoes-punch.md +5 -0
- package/.changeset/fuzzy-tips-sit.md +5 -0
- package/.changeset/giant-apes-thank.md +5 -0
- package/.changeset/khaki-keys-deliver.md +5 -0
- package/.changeset/large-plants-know.md +5 -0
- package/.changeset/mean-lizards-think.md +5 -0
- package/.changeset/ninety-bags-bake.md +17 -0
- package/.changeset/perfect-vans-give.md +7 -0
- package/.changeset/pre.json +16 -0
- package/.changeset/shaggy-pugs-add.md +52 -0
- package/.changeset/short-months-complain.md +5 -0
- package/.changeset/swift-rivers-share.md +13 -0
- package/.changeset/thin-peas-hear.md +16 -0
- package/.changeset/wicked-forks-double.md +33 -0
- package/CHANGELOG.md +195 -0
- package/__cjs/cache/core/cache.cjs +1 -1
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +1 -1
- package/__cjs/cache/core/types/Cache.cjs.map +1 -1
- package/__cjs/cache/core/types/Cache.d.cts +1 -1
- package/__cjs/cache/core/types/DataProxy.d.cts +1 -1
- package/__cjs/cache/core/types/common.cjs +1 -0
- package/__cjs/cache/core/types/common.cjs.map +1 -1
- package/__cjs/cache/inmemory/entityStore.cjs +7 -4
- package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/entityStore.d.cts +1 -0
- package/__cjs/cache/inmemory/fragmentRegistry.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.d.cts +1 -1
- package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
- package/__cjs/cache/inmemory/policies.cjs +4 -4
- package/__cjs/cache/inmemory/reactiveVars.cjs.map +1 -1
- package/__cjs/cache/inmemory/reactiveVars.d.cts +1 -1
- package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
- package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/types.d.cts +1 -1
- package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
- package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/writeToStore.d.cts +1 -1
- package/__cjs/config/jest/areCombinedGraphQLErrorsEqual.cjs +2 -3
- package/__cjs/config/jest/areCombinedGraphQLErrorsEqual.cjs.map +1 -1
- package/__cjs/config/jest/areCombinedProtocolErrorsEqual.cjs +2 -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 +21 -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 +12 -1
- package/__cjs/config/jest/setup.cjs.map +1 -1
- package/__cjs/core/ApolloClient.cjs +7 -7
- package/__cjs/core/LocalState.cjs +2 -2
- package/__cjs/core/ObservableQuery.cjs +196 -66
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +20 -2
- package/__cjs/core/QueryInfo.cjs +4 -71
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +0 -8
- package/__cjs/core/QueryManager.cjs +29 -50
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/QueryManager.d.cts +3 -3
- package/__cjs/core/index.cjs +3 -1
- package/__cjs/core/index.cjs.map +1 -1
- package/__cjs/core/index.d.cts +1 -0
- package/__cjs/core/watchQueryOptions.d.cts +2 -2
- package/__cjs/errors/CombinedGraphQLErrors.cjs.map +1 -1
- package/__cjs/errors/CombinedGraphQLErrors.d.cts +1 -1
- package/__cjs/errors/index.cjs +21 -2
- package/__cjs/errors/index.cjs.map +1 -1
- package/__cjs/errors/index.d.cts +2 -0
- package/__cjs/invariantErrorCodes.cjs +82 -70
- package/__cjs/link/context/index.cjs.map +1 -1
- package/__cjs/link/context/index.d.cts +1 -1
- package/__cjs/link/core/ApolloLink.cjs +2 -20
- package/__cjs/link/core/ApolloLink.cjs.map +1 -1
- package/__cjs/link/core/ApolloLink.d.cts +1 -3
- package/__cjs/link/core/types.d.cts +1 -1
- 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/checkFetcher.cjs +1 -1
- package/__cjs/link/http/createHttpLink.cjs +1 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
- package/__cjs/link/http/serializeFetchParameter.cjs +1 -1
- package/__cjs/link/persisted-queries/index.cjs +2 -2
- package/__cjs/link/persisted-queries/index.cjs.map +1 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
- package/__cjs/link/utils/validateOperation.cjs +1 -1
- package/__cjs/masking/maskDefinition.cjs +2 -2
- package/__cjs/masking/maskFragment.cjs +2 -2
- package/__cjs/masking/maskFragment.cjs.map +1 -1
- package/__cjs/masking/maskFragment.d.cts +1 -1
- package/__cjs/masking/maskOperation.cjs +1 -1
- package/__cjs/masking/maskOperation.cjs.map +1 -1
- package/__cjs/masking/maskOperation.d.cts +1 -1
- 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 +1 -1
- package/__cjs/react/context/ApolloContext.cjs +1 -1
- package/__cjs/react/context/ApolloContext.cjs.map +1 -1
- package/__cjs/react/context/ApolloContext.d.cts +1 -1
- package/__cjs/react/context/ApolloProvider.cjs +1 -1
- package/__cjs/react/context/ApolloProvider.cjs.map +1 -1
- package/__cjs/react/context/ApolloProvider.d.cts +1 -1
- package/__cjs/react/hooks/internal/wrapHook.cjs.map +1 -1
- package/__cjs/react/hooks/internal/wrapHook.d.cts +2 -2
- 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.map +1 -1
- package/__cjs/react/hooks/useBackgroundQuery.d.cts +2 -2
- package/__cjs/react/hooks/useFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useFragment.d.cts +1 -1
- package/__cjs/react/hooks/useLazyQuery.cjs +21 -24
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.d.cts +3 -3
- package/__cjs/react/hooks/useLoadableQuery.cjs +2 -2
- package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLoadableQuery.d.cts +2 -2
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.d.cts +2 -2
- package/__cjs/react/hooks/useQuery.cjs +4 -4
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +3 -4
- package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
- package/__cjs/react/hooks/useQueryRefHandlers.d.cts +2 -2
- 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 +1 -1
- package/__cjs/react/hooks/useSubscription.cjs +1 -1
- package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
- package/__cjs/react/hooks/useSubscription.d.cts +1 -1
- package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseFragment.d.cts +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.cjs +4 -4
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.d.cts +3 -3
- package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
- package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/FragmentReference.d.cts +1 -1
- package/__cjs/react/internal/cache/QueryReference.cjs +1 -1
- package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/QueryReference.d.cts +1 -1
- 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/getSuspenseCache.cjs.map +1 -1
- package/__cjs/react/internal/cache/getSuspenseCache.d.cts +2 -2
- package/__cjs/react/internal/types.d.cts +1 -1
- 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 +1 -1
- package/__cjs/react/ssr/prerenderStatic.cjs +2 -2
- package/__cjs/react/ssr/prerenderStatic.cjs.map +1 -1
- package/__cjs/react/ssr/prerenderStatic.d.cts +1 -1
- package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -1
- package/__cjs/react/types/deprecated.d.cts +1 -1
- package/__cjs/react/types/types.documentation.d.cts +2 -2
- package/__cjs/testing/core/index.cjs +2 -1
- package/__cjs/testing/core/index.cjs.map +1 -1
- package/__cjs/testing/core/index.d.cts +2 -2
- 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 +1 -1
- 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 +2 -2
- 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 +2 -1
- package/__cjs/testing/index.cjs.map +1 -1
- package/__cjs/testing/index.d.cts +1 -1
- package/__cjs/testing/internal/incremental.cjs.map +1 -1
- package/__cjs/testing/internal/incremental.d.cts +1 -1
- package/__cjs/testing/internal/renderHelpers.cjs.map +1 -1
- package/__cjs/testing/internal/renderHelpers.d.cts +1 -1
- 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 +6 -8
- 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 +2 -0
- package/__cjs/testing/matchers/index.cjs.map +1 -1
- 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/utils/getSerializableProperties.cjs +2 -2
- package/__cjs/testing/matchers/utils/getSerializableProperties.cjs.map +1 -1
- package/__cjs/testing/react/MockedProvider.cjs +9 -5
- package/__cjs/testing/react/MockedProvider.cjs.map +1 -1
- package/__cjs/testing/react/MockedProvider.d.cts +5 -3
- package/__cjs/utilities/common/mergeOptions.cjs.map +1 -1
- package/__cjs/utilities/common/mergeOptions.d.cts +1 -1
- package/__cjs/utilities/graphql/operations.cjs.map +1 -1
- package/__cjs/utilities/graphql/operations.d.cts +1 -1
- package/__cjs/utilities/index.cjs.map +1 -1
- package/__cjs/utilities/index.d.cts +1 -1
- package/__cjs/utilities/internal/getMemoryInternals.cjs.map +1 -1
- package/__cjs/utilities/internal/toQueryResult.cjs.map +1 -1
- package/__cjs/utilities/internal/toQueryResult.d.cts +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/version.cjs +1 -1
- package/__cjs/version.cjs.map +1 -1
- package/__cjs/version.d.cts +1 -1
- package/cache/core/cache.d.ts +1 -1
- package/cache/core/cache.js +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +1 -1
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +1 -1
- package/cache/core/types/common.js +1 -0
- package/cache/core/types/common.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +1 -0
- package/cache/inmemory/entityStore.js +7 -4
- 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/inMemoryCache.d.ts +1 -1
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.js +4 -4
- package/cache/inmemory/reactiveVars.d.ts +1 -1
- package/cache/inmemory/reactiveVars.js.map +1 -1
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +1 -1
- package/cache/inmemory/writeToStore.d.ts +1 -1
- package/cache/inmemory/writeToStore.js +4 -4
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/config/jest/areCombinedGraphQLErrorsEqual.js +2 -3
- package/config/jest/areCombinedGraphQLErrorsEqual.js.map +1 -1
- package/config/jest/areCombinedProtocolErrorsEqual.js +2 -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 +17 -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 +13 -2
- package/config/jest/setup.js.map +1 -1
- package/core/ApolloClient.js +7 -7
- package/core/LocalState.js +2 -2
- package/core/ObservableQuery.d.ts +20 -2
- package/core/ObservableQuery.js +195 -64
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +0 -8
- package/core/QueryInfo.js +4 -71
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +3 -3
- package/core/QueryManager.js +30 -51
- package/core/QueryManager.js.map +1 -1
- package/core/index.d.ts +1 -0
- package/core/index.js +2 -1
- package/core/index.js.map +1 -1
- package/core/watchQueryOptions.d.ts +2 -2
- package/errors/CombinedGraphQLErrors.d.ts +1 -1
- package/errors/CombinedGraphQLErrors.js.map +1 -1
- package/errors/index.d.ts +2 -0
- package/errors/index.js +18 -0
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +82 -70
- package/link/context/index.d.ts +1 -1
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.d.ts +1 -3
- package/link/core/ApolloLink.js +2 -20
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/types.d.ts +1 -1
- 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/checkFetcher.js +1 -1
- package/link/http/createHttpLink.js +1 -1
- package/link/http/parseAndCheckHttpResponse.js +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- 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/utils/validateOperation.js +1 -1
- package/masking/maskDefinition.js +2 -2
- package/masking/maskFragment.d.ts +1 -1
- package/masking/maskFragment.js +2 -2
- package/masking/maskFragment.js.map +1 -1
- package/masking/maskOperation.d.ts +1 -1
- package/masking/maskOperation.js +1 -1
- package/masking/maskOperation.js.map +1 -1
- package/masking/utils.js +1 -1
- package/package.json +10 -10
- package/react/context/ApolloConsumer.d.ts +1 -1
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloConsumer.js.map +1 -1
- package/react/context/ApolloContext.d.ts +1 -1
- package/react/context/ApolloContext.js +1 -1
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.d.ts +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/hooks/internal/wrapHook.d.ts +2 -2
- package/react/hooks/internal/wrapHook.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.d.ts +2 -2
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.d.ts +1 -1
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +3 -3
- package/react/hooks/useLazyQuery.js +20 -23
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.d.ts +2 -2
- package/react/hooks/useLoadableQuery.js +2 -2
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +2 -2
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +3 -4
- package/react/hooks/useQuery.js +2 -2
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useQueryRefHandlers.d.ts +2 -2
- 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 +1 -1
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +1 -1
- package/react/hooks/useSubscription.js +1 -1
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseFragment.d.ts +1 -1
- package/react/hooks/useSuspenseFragment.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +3 -3
- package/react/hooks/useSuspenseQuery.js +3 -3
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/internal/cache/FragmentReference.d.ts +1 -1
- package/react/internal/cache/FragmentReference.js.map +1 -1
- package/react/internal/cache/QueryReference.d.ts +1 -1
- package/react/internal/cache/QueryReference.js +1 -1
- 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/getSuspenseCache.d.ts +2 -2
- package/react/internal/cache/getSuspenseCache.js.map +1 -1
- package/react/internal/types.d.ts +1 -1
- package/react/query-preloader/createQueryPreloader.d.ts +1 -1
- package/react/query-preloader/createQueryPreloader.js +1 -0
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/ssr/prerenderStatic.d.ts +1 -1
- package/react/ssr/prerenderStatic.js +2 -2
- package/react/ssr/prerenderStatic.js.map +1 -1
- package/react/ssr/useSSRQuery.js.map +1 -1
- package/react/types/deprecated.d.ts +1 -1
- package/react/types/types.documentation.d.ts +2 -2
- package/testing/core/index.d.ts +2 -2
- package/testing/core/index.js +1 -1
- package/testing/core/index.js.map +1 -1
- package/testing/core/mocking/mockClient.d.ts +1 -1
- 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 +1 -1
- 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 +1 -1
- package/testing/index.js +1 -1
- package/testing/index.js.map +1 -1
- package/testing/internal/incremental.d.ts +1 -1
- package/testing/internal/incremental.js.map +1 -1
- package/testing/internal/renderHelpers.d.ts +1 -1
- package/testing/internal/renderHelpers.js.map +1 -1
- 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 +2 -0
- package/testing/matchers/index.js.map +1 -1
- 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/utils/getSerializableProperties.js +1 -1
- package/testing/matchers/utils/getSerializableProperties.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +5 -3
- package/testing/react/MockedProvider.js +7 -3
- package/testing/react/MockedProvider.js.map +1 -1
- package/utilities/common/mergeOptions.d.ts +1 -1
- package/utilities/common/mergeOptions.js.map +1 -1
- package/utilities/graphql/operations.d.ts +1 -1
- package/utilities/graphql/operations.js.map +1 -1
- package/utilities/index.d.ts +1 -1
- package/utilities/index.js.map +1 -1
- package/utilities/internal/getMemoryInternals.js.map +1 -1
- package/utilities/internal/toQueryResult.d.ts +1 -1
- package/utilities/internal/toQueryResult.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/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/__cjs/index.cjs +0 -9
- package/__cjs/index.cjs.map +0 -1
- package/__cjs/index.d.cts +0 -3
- package/index.d.ts +0 -3
- package/index.js +0 -4
- package/index.js.map +0 -1
package/core/QueryManager.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Trie } from "@wry/trie";
|
|
|
2
2
|
import { OperationTypeNode } from "graphql";
|
|
3
3
|
import { catchError, concat, EMPTY, filter, from, lastValueFrom, map, mergeMap, mergeWith, Observable, of, share, shareReplay, Subject, tap, } from "rxjs";
|
|
4
4
|
import { canonicalStringify } from "@apollo/client/cache";
|
|
5
|
-
import { CombinedGraphQLErrors, graphQLResultHasProtocolErrors,
|
|
5
|
+
import { CombinedGraphQLErrors, graphQLResultHasProtocolErrors, toErrorLike, } from "@apollo/client/errors";
|
|
6
6
|
import { PROTOCOL_ERRORS_SYMBOL } from "@apollo/client/errors";
|
|
7
7
|
import { execute } from "@apollo/client/link/core";
|
|
8
8
|
import { maskFragment, maskOperation } from "@apollo/client/masking";
|
|
@@ -89,16 +89,16 @@ export class QueryManager {
|
|
|
89
89
|
this.queries.forEach((_info, queryId) => {
|
|
90
90
|
this.removeQuery(queryId);
|
|
91
91
|
});
|
|
92
|
-
this.cancelPendingFetches(newInvariantError(
|
|
92
|
+
this.cancelPendingFetches(newInvariantError(72));
|
|
93
93
|
}
|
|
94
94
|
cancelPendingFetches(error) {
|
|
95
95
|
this.fetchCancelFns.forEach((cancel) => cancel(error));
|
|
96
96
|
this.fetchCancelFns.clear();
|
|
97
97
|
}
|
|
98
98
|
async mutate({ mutation, variables, optimisticResponse, updateQueries, refetchQueries = [], awaitRefetchQueries = false, update: updateWithProxyFn, onQueryUpdated, fetchPolicy = this.defaultOptions.mutate?.fetchPolicy || "network-only", errorPolicy = this.defaultOptions.mutate?.errorPolicy || "none", keepRootFields, context, }) {
|
|
99
|
-
invariant(mutation,
|
|
99
|
+
invariant(mutation, 73);
|
|
100
100
|
checkDocument(mutation, OperationTypeNode.MUTATION);
|
|
101
|
-
invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache",
|
|
101
|
+
invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 74);
|
|
102
102
|
const mutationId = this.generateMutationId();
|
|
103
103
|
mutation = this.cache.transformForLink(this.transform(mutation));
|
|
104
104
|
const { hasClientExports } = this.getDocumentInfo(mutation);
|
|
@@ -191,7 +191,7 @@ export class QueryManager {
|
|
|
191
191
|
}
|
|
192
192
|
},
|
|
193
193
|
error: (err) => {
|
|
194
|
-
const error =
|
|
194
|
+
const error = toErrorLike(err);
|
|
195
195
|
if (mutationStoreValue) {
|
|
196
196
|
mutationStoreValue.loading = false;
|
|
197
197
|
mutationStoreValue.error = error;
|
|
@@ -396,7 +396,7 @@ export class QueryManager {
|
|
|
396
396
|
return true;
|
|
397
397
|
}
|
|
398
398
|
fetchQuery(queryId, options, networkStatus) {
|
|
399
|
-
return lastValueFrom(this.fetchObservableWithInfo(queryId, options, networkStatus).observable.pipe(map(toQueryResult)), {
|
|
399
|
+
return lastValueFrom(this.fetchObservableWithInfo(this.getOrCreateQuery(queryId), options, networkStatus).observable.pipe(map(toQueryResult)), {
|
|
400
400
|
// This default is needed when a `standby` fetch policy is used to avoid
|
|
401
401
|
// an EmptyError from rejecting this promise.
|
|
402
402
|
defaultValue: { data: undefined },
|
|
@@ -462,7 +462,7 @@ export class QueryManager {
|
|
|
462
462
|
variables: this.getVariables(query, options.variables),
|
|
463
463
|
};
|
|
464
464
|
if (typeof options.notifyOnNetworkStatusChange === "undefined") {
|
|
465
|
-
options.notifyOnNetworkStatusChange =
|
|
465
|
+
options.notifyOnNetworkStatusChange = true;
|
|
466
466
|
}
|
|
467
467
|
const queryInfo = new QueryInfo(this);
|
|
468
468
|
const observable = new ObservableQuery({
|
|
@@ -471,7 +471,9 @@ export class QueryManager {
|
|
|
471
471
|
options,
|
|
472
472
|
});
|
|
473
473
|
observable["lastQuery"] = query;
|
|
474
|
-
|
|
474
|
+
if (!ObservableQuery["inactiveOnCreation"].getValue()) {
|
|
475
|
+
this.queries.set(observable.queryId, queryInfo);
|
|
476
|
+
}
|
|
475
477
|
// We give queryInfo the transformed query to ensure the first cache diff
|
|
476
478
|
// uses the transformed query instead of the raw query
|
|
477
479
|
queryInfo.init({ document: query, variables: observable.variables });
|
|
@@ -513,7 +515,7 @@ export class QueryManager {
|
|
|
513
515
|
// depend on values that previously existed in the data portion of the
|
|
514
516
|
// store. So, we cancel the promises and observers that we have issued
|
|
515
517
|
// so far and not yet resolved (in the case of queries).
|
|
516
|
-
this.cancelPendingFetches(newInvariantError(
|
|
518
|
+
this.cancelPendingFetches(newInvariantError(75));
|
|
517
519
|
this.queries.forEach((queryInfo) => {
|
|
518
520
|
if (queryInfo.observableQuery) {
|
|
519
521
|
// Set loading to true so listeners don't trigger unless they want
|
|
@@ -579,7 +581,7 @@ export class QueryManager {
|
|
|
579
581
|
// pre-allocate a new query ID here, using a special prefix to enable
|
|
580
582
|
// cleaning up these temporary queries later, after fetching.
|
|
581
583
|
const queryId = makeUniqueId("legacyOneTimeQuery");
|
|
582
|
-
const queryInfo = this.
|
|
584
|
+
const queryInfo = this.getOrCreateQuery(queryId).init({
|
|
583
585
|
document: options.query,
|
|
584
586
|
variables: options.variables,
|
|
585
587
|
});
|
|
@@ -601,10 +603,10 @@ export class QueryManager {
|
|
|
601
603
|
if (!included) {
|
|
602
604
|
const queryName = queryNames.get(nameOrQueryString);
|
|
603
605
|
if (queryName) {
|
|
604
|
-
__DEV__ && invariant.warn(
|
|
606
|
+
__DEV__ && invariant.warn(76, queryName);
|
|
605
607
|
}
|
|
606
608
|
else {
|
|
607
|
-
__DEV__ && invariant.warn(
|
|
609
|
+
__DEV__ && invariant.warn(77);
|
|
608
610
|
}
|
|
609
611
|
}
|
|
610
612
|
});
|
|
@@ -620,14 +622,11 @@ export class QueryManager {
|
|
|
620
622
|
(fetchPolicy !== "standby" && fetchPolicy !== "cache-only")) {
|
|
621
623
|
observableQueryPromises.push(observableQuery.refetch());
|
|
622
624
|
}
|
|
623
|
-
this.
|
|
625
|
+
(this.queries.get(queryId) || observableQuery["queryInfo"]).setDiff(null);
|
|
624
626
|
});
|
|
625
627
|
this.broadcastQueries();
|
|
626
628
|
return Promise.all(observableQueryPromises);
|
|
627
629
|
}
|
|
628
|
-
setObservableQuery(observableQuery) {
|
|
629
|
-
this.getQuery(observableQuery.queryId).setObservableQuery(observableQuery);
|
|
630
|
-
}
|
|
631
630
|
startGraphQLSubscription(options) {
|
|
632
631
|
let { query, variables } = options;
|
|
633
632
|
const { fetchPolicy, errorPolicy = "none", context = {}, extensions = {}, } = options;
|
|
@@ -674,7 +673,7 @@ export class QueryManager {
|
|
|
674
673
|
if (errorPolicy === "ignore") {
|
|
675
674
|
return of({ data: undefined });
|
|
676
675
|
}
|
|
677
|
-
return of({ data: undefined, error:
|
|
676
|
+
return of({ data: undefined, error: toErrorLike(error) });
|
|
678
677
|
}), filter((result) => !!(result.data || result.error)));
|
|
679
678
|
if (this.getDocumentInfo(query).hasClientExports) {
|
|
680
679
|
const observablePromise = this.localState
|
|
@@ -700,14 +699,14 @@ export class QueryManager {
|
|
|
700
699
|
// The same queryId could have two rejection fns for two promises
|
|
701
700
|
this.fetchCancelFns.delete(queryId);
|
|
702
701
|
if (this.queries.has(queryId)) {
|
|
703
|
-
this.
|
|
702
|
+
this.queries.get(queryId)?.stop();
|
|
704
703
|
this.queries.delete(queryId);
|
|
705
704
|
}
|
|
706
705
|
}
|
|
707
706
|
broadcastQueries() {
|
|
708
707
|
if (this.onBroadcast)
|
|
709
708
|
this.onBroadcast();
|
|
710
|
-
this.queries.forEach((info) => info.notify());
|
|
709
|
+
this.queries.forEach((info) => info.observableQuery?.["notify"]());
|
|
711
710
|
}
|
|
712
711
|
getLocalState() {
|
|
713
712
|
return this.localState;
|
|
@@ -786,7 +785,7 @@ export class QueryManager {
|
|
|
786
785
|
if (requestId >= queryInfo.lastRequestId) {
|
|
787
786
|
if (hasErrors && errorPolicy === "none") {
|
|
788
787
|
queryInfo.resetLastWrite();
|
|
789
|
-
queryInfo.
|
|
788
|
+
queryInfo.observableQuery?.["resetNotifications"]();
|
|
790
789
|
// Throwing here effectively calls observer.error.
|
|
791
790
|
throw new CombinedGraphQLErrors(result);
|
|
792
791
|
}
|
|
@@ -814,11 +813,11 @@ export class QueryManager {
|
|
|
814
813
|
}
|
|
815
814
|
return aqr;
|
|
816
815
|
}), catchError((error) => {
|
|
817
|
-
error =
|
|
816
|
+
error = toErrorLike(error);
|
|
818
817
|
// Avoid storing errors from older interrupted queries.
|
|
819
818
|
if (requestId >= queryInfo.lastRequestId && errorPolicy === "none") {
|
|
820
819
|
queryInfo.resetLastWrite();
|
|
821
|
-
queryInfo.
|
|
820
|
+
queryInfo.observableQuery?.["resetNotifications"]();
|
|
822
821
|
throw error;
|
|
823
822
|
}
|
|
824
823
|
const aqr = {
|
|
@@ -834,15 +833,14 @@ export class QueryManager {
|
|
|
834
833
|
return of(aqr);
|
|
835
834
|
}));
|
|
836
835
|
}
|
|
837
|
-
fetchObservableWithInfo(
|
|
836
|
+
fetchObservableWithInfo(queryInfo, options,
|
|
838
837
|
// The initial networkStatus for this fetch, most often
|
|
839
838
|
// NetworkStatus.loading, but also possibly fetchMore, poll, refetch,
|
|
840
839
|
// or setVariables.
|
|
841
840
|
networkStatus = NetworkStatus.loading, query = options.query, emitLoadingState = false) {
|
|
842
841
|
const variables = this.getVariables(query, options.variables);
|
|
843
|
-
const queryInfo = this.getQuery(queryId);
|
|
844
842
|
const defaults = this.defaultOptions.watchQuery;
|
|
845
|
-
let { fetchPolicy = (defaults && defaults.fetchPolicy) || "cache-first", errorPolicy = (defaults && defaults.errorPolicy) || "none", returnPartialData = false, notifyOnNetworkStatusChange =
|
|
843
|
+
let { fetchPolicy = (defaults && defaults.fetchPolicy) || "cache-first", errorPolicy = (defaults && defaults.errorPolicy) || "none", returnPartialData = false, notifyOnNetworkStatusChange = true, context = {}, } = options;
|
|
846
844
|
if (this.prioritizeCacheValues &&
|
|
847
845
|
(fetchPolicy === "network-only" || fetchPolicy === "cache-and-network")) {
|
|
848
846
|
fetchPolicy = "cache-first";
|
|
@@ -874,13 +872,13 @@ export class QueryManager {
|
|
|
874
872
|
// This cancel function needs to be set before the concast is created,
|
|
875
873
|
// in case concast creation synchronously cancels the request.
|
|
876
874
|
const cleanupCancelFn = () => {
|
|
877
|
-
this.fetchCancelFns.delete(queryId);
|
|
875
|
+
this.fetchCancelFns.delete(queryInfo.queryId);
|
|
878
876
|
// We need to call `complete` on the subject here otherwise the merged
|
|
879
877
|
// observable will never complete since it waits for all source
|
|
880
878
|
// observables to complete before itself completes.
|
|
881
879
|
fetchCancelSubject.complete();
|
|
882
880
|
};
|
|
883
|
-
this.fetchCancelFns.set(queryId, (reason) => {
|
|
881
|
+
this.fetchCancelFns.set(queryInfo.queryId, (reason) => {
|
|
884
882
|
fetchCancelSubject.error(reason);
|
|
885
883
|
cleanupCancelFn();
|
|
886
884
|
});
|
|
@@ -918,7 +916,7 @@ export class QueryManager {
|
|
|
918
916
|
this.getObservableQueries(include).forEach((oq, queryId) => {
|
|
919
917
|
includedQueriesById.set(queryId, {
|
|
920
918
|
oq,
|
|
921
|
-
lastDiff: this.
|
|
919
|
+
lastDiff: (this.queries.get(queryId) || oq["queryInfo"]).getDiff(),
|
|
922
920
|
});
|
|
923
921
|
});
|
|
924
922
|
}
|
|
@@ -1004,9 +1002,7 @@ export class QueryManager {
|
|
|
1004
1002
|
// queries, even the QueryOptions ones.
|
|
1005
1003
|
if (onQueryUpdated) {
|
|
1006
1004
|
if (!diff) {
|
|
1007
|
-
|
|
1008
|
-
info.reset(); // Force info.getDiff() to read from cache.
|
|
1009
|
-
diff = info.getDiff();
|
|
1005
|
+
diff = this.cache.diff(oq["queryInfo"]["getDiffOptions"]());
|
|
1010
1006
|
}
|
|
1011
1007
|
result = onQueryUpdated(oq, diff, lastDiff);
|
|
1012
1008
|
}
|
|
@@ -1046,7 +1042,7 @@ export class QueryManager {
|
|
|
1046
1042
|
!isFullyUnmaskedOperation(document) &&
|
|
1047
1043
|
!this.noCacheWarningsByQueryId.has(operationId)) {
|
|
1048
1044
|
this.noCacheWarningsByQueryId.add(operationId);
|
|
1049
|
-
__DEV__ && invariant.warn(
|
|
1045
|
+
__DEV__ && invariant.warn(78, getOperationName(document) ??
|
|
1050
1046
|
`Unnamed ${operationType ?? "operation"}`);
|
|
1051
1047
|
}
|
|
1052
1048
|
}
|
|
@@ -1193,7 +1189,7 @@ export class QueryManager {
|
|
|
1193
1189
|
return { fromLink: false, observable: EMPTY };
|
|
1194
1190
|
}
|
|
1195
1191
|
}
|
|
1196
|
-
|
|
1192
|
+
getOrCreateQuery(queryId) {
|
|
1197
1193
|
if (queryId && !this.queries.has(queryId)) {
|
|
1198
1194
|
this.queries.set(queryId, new QueryInfo(this, queryId));
|
|
1199
1195
|
}
|
|
@@ -1208,23 +1204,6 @@ export class QueryManager {
|
|
|
1208
1204
|
};
|
|
1209
1205
|
}
|
|
1210
1206
|
}
|
|
1211
|
-
function isErrorLike(error) {
|
|
1212
|
-
return (error !== null &&
|
|
1213
|
-
typeof error === "object" &&
|
|
1214
|
-
typeof error.message === "string" &&
|
|
1215
|
-
typeof error.name === "string" &&
|
|
1216
|
-
(typeof error.stack === "undefined" ||
|
|
1217
|
-
typeof error.stack === "string"));
|
|
1218
|
-
}
|
|
1219
|
-
function maybeWrapError(error) {
|
|
1220
|
-
if (isErrorLike(error)) {
|
|
1221
|
-
return error;
|
|
1222
|
-
}
|
|
1223
|
-
if (typeof error === "string") {
|
|
1224
|
-
return new Error(error, { cause: error });
|
|
1225
|
-
}
|
|
1226
|
-
return new UnconventionalError(error);
|
|
1227
|
-
}
|
|
1228
1207
|
function validateDidEmitValue() {
|
|
1229
1208
|
let didEmitValue = false;
|
|
1230
1209
|
return tap({
|
|
@@ -1232,7 +1211,7 @@ function validateDidEmitValue() {
|
|
|
1232
1211
|
didEmitValue = true;
|
|
1233
1212
|
},
|
|
1234
1213
|
complete() {
|
|
1235
|
-
invariant(didEmitValue,
|
|
1214
|
+
invariant(didEmitValue, 79);
|
|
1236
1215
|
},
|
|
1237
1216
|
});
|
|
1238
1217
|
}
|