@apollo/client 4.0.0-alpha.5 → 4.0.0-alpha.7
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/dirty-eagles-poke.md +5 -0
- package/.changeset/giant-bags-share.md +5 -0
- package/.changeset/nervous-fireants-bow.md +5 -0
- package/.changeset/nice-dots-matter.md +5 -0
- package/.changeset/pre.json +7 -0
- package/.changeset/purple-bears-flash.md +5 -0
- package/.changeset/tame-points-work.md +11 -0
- package/.changeset/tender-swans-flash.md +16 -0
- package/CHANGELOG.md +44 -0
- package/__cjs/cache/core/cache.cjs +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 +3 -3
- package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
- package/__cjs/cache/inmemory/policies.cjs +4 -4
- package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
- package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
- package/__cjs/config/jest/areCombinedGraphQLErrorsEqual.cjs +3 -1
- package/__cjs/config/jest/areCombinedGraphQLErrorsEqual.cjs.map +1 -1
- package/__cjs/config/jest/setup.cjs +6 -0
- package/__cjs/config/jest/setup.cjs.map +1 -1
- package/__cjs/core/ApolloClient.cjs +9 -5
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +5 -7
- package/__cjs/core/LocalState.cjs +2 -2
- package/__cjs/core/ObservableQuery.cjs +15 -10
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +6 -6
- package/__cjs/core/QueryInfo.cjs +0 -7
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +0 -2
- package/__cjs/core/QueryManager.cjs +41 -30
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/QueryManager.d.cts +4 -4
- package/__cjs/core/index.cjs +39 -21
- package/__cjs/core/index.cjs.map +1 -1
- package/__cjs/core/index.d.cts +12 -11
- package/__cjs/core/types.d.cts +24 -2
- package/__cjs/errors/CombinedGraphQLErrors.cjs +8 -1
- package/__cjs/errors/CombinedGraphQLErrors.cjs.map +1 -1
- package/__cjs/errors/CombinedGraphQLErrors.d.cts +7 -2
- package/__cjs/index.cjs +1 -0
- package/__cjs/index.cjs.map +1 -1
- package/__cjs/invariantErrorCodes.cjs +111 -125
- 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/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/core/ApolloLink.cjs +2 -2
- package/__cjs/link/core/index.cjs.map +1 -1
- package/__cjs/link/core/index.d.cts +1 -1
- 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/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/validateOperation.cjs +1 -1
- package/__cjs/masking/maskDefinition.cjs +2 -2
- package/__cjs/masking/maskFragment.cjs +2 -2
- package/__cjs/masking/maskOperation.cjs +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 +6 -3
- package/__cjs/react/context/ApolloContext.cjs +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 +6 -4
- package/__cjs/react/hooks/internal/wrapHook.cjs.map +1 -1
- package/__cjs/react/hooks/internal/wrapHook.d.cts +1 -1
- package/__cjs/react/hooks/useApolloClient.cjs +3 -3
- package/__cjs/react/hooks/useApolloClient.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.cjs +2 -2
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.d.cts +4 -4
- package/__cjs/react/hooks/useLoadableQuery.cjs +2 -2
- package/__cjs/react/hooks/useMutation.cjs +0 -2
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.d.cts +1 -2
- package/__cjs/react/hooks/useQuery.cjs +0 -2
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +3 -3
- package/__cjs/react/hooks/useSubscription.cjs +1 -3
- package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.cjs +3 -5
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
- package/__cjs/react/index.cjs +35 -11
- package/__cjs/react/index.cjs.map +1 -1
- package/__cjs/react/index.d.cts +21 -7
- 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/QueryReference.cjs +1 -1
- package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/QueryReference.d.cts +3 -3
- package/__cjs/react/internal/types.d.cts +2 -2
- package/__cjs/react/ssr/getDataFromTree.cjs +23 -60
- package/__cjs/react/ssr/getDataFromTree.cjs.map +1 -1
- package/__cjs/react/ssr/getDataFromTree.d.cts +12 -6
- package/__cjs/react/ssr/index.cjs +3 -1
- package/__cjs/react/ssr/index.cjs.map +1 -1
- package/__cjs/react/ssr/index.d.cts +1 -0
- 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.map +1 -1
- package/__cjs/react/ssr/useSSRQuery.d.cts +2 -2
- package/__cjs/react/types/deprecated.d.cts +11 -1
- package/__cjs/testing/core/index.cjs +5 -3
- package/__cjs/testing/core/index.cjs.map +1 -1
- package/__cjs/testing/core/index.d.cts +1 -1
- package/__cjs/testing/core/mocking/mockLink.cjs +2 -2
- package/__cjs/testing/experimental/createSchemaFetch.cjs +2 -2
- package/__cjs/testing/experimental/createSchemaFetch.cjs.map +1 -1
- package/__cjs/testing/index.cjs +12 -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/index.cjs +14 -8
- package/__cjs/testing/internal/index.cjs.map +1 -1
- package/__cjs/testing/internal/index.d.cts +4 -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/matchers/index.cjs +4 -22
- package/__cjs/testing/matchers/index.cjs.map +1 -1
- 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/{toEmitStrictTyped.cjs → toEmitTypedValue.cjs} +5 -5
- 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/{toEqualStrictTyped.cjs → toStrictEqualTyped.cjs} +5 -5
- package/__cjs/testing/matchers/{toEqualStrictTyped.cjs.map → toStrictEqualTyped.cjs.map} +1 -1
- package/__cjs/testing/matchers/toStrictEqualTyped.d.cts +3 -0
- package/__cjs/testing/react/MockedProvider.cjs +2 -2
- package/__cjs/testing/react/MockedProvider.cjs.map +1 -1
- 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/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/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 +14 -13
- package/__cjs/utilities/internal/getMemoryInternals.cjs +0 -2
- package/__cjs/utilities/internal/getMemoryInternals.cjs.map +1 -1
- package/__cjs/utilities/internal/getMemoryInternals.d.cts +0 -1
- 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/version.cjs +1 -1
- package/__cjs/version.d.cts +1 -1
- package/cache/core/cache.js +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.js +3 -3
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.js +4 -4
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/writeToStore.js +4 -4
- package/config/jest/areCombinedGraphQLErrorsEqual.js +3 -1
- package/config/jest/areCombinedGraphQLErrorsEqual.js.map +1 -1
- package/config/jest/setup.js +6 -0
- package/config/jest/setup.js.map +1 -1
- package/core/ApolloClient.d.ts +5 -7
- package/core/ApolloClient.js +9 -5
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js +2 -2
- package/core/ObservableQuery.d.ts +6 -6
- package/core/ObservableQuery.js +15 -10
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +0 -2
- package/core/QueryInfo.js +0 -7
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +4 -4
- package/core/QueryManager.js +43 -32
- package/core/QueryManager.js.map +1 -1
- package/core/index.d.ts +12 -11
- package/core/index.js +7 -5
- package/core/index.js.map +1 -1
- package/core/types.d.ts +24 -2
- package/errors/CombinedGraphQLErrors.d.ts +7 -2
- package/errors/CombinedGraphQLErrors.js +8 -1
- package/errors/CombinedGraphQLErrors.js.map +1 -1
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/invariantErrorCodes.js +111 -125
- 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/index.d.ts +1 -1
- package/link/batch-http/index.js +1 -1
- package/link/batch-http/index.js.map +1 -1
- package/link/core/ApolloLink.js +2 -2
- package/link/core/index.d.ts +1 -1
- package/link/core/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 +2 -2
- 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/validateOperation.js +1 -1
- package/masking/maskDefinition.js +2 -2
- package/masking/maskFragment.js +2 -2
- package/masking/maskOperation.js +1 -1
- package/masking/utils.js +1 -1
- package/package.json +11 -31
- package/react/context/ApolloConsumer.d.ts +6 -3
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloConsumer.js.map +1 -1
- package/react/context/ApolloContext.js +1 -1
- package/react/context/ApolloProvider.d.ts +6 -4
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/hooks/internal/wrapHook.d.ts +1 -1
- package/react/hooks/internal/wrapHook.js.map +1 -1
- package/react/hooks/useApolloClient.js +2 -2
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +4 -4
- package/react/hooks/useLazyQuery.js +2 -2
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.js +2 -2
- package/react/hooks/useMutation.d.ts +1 -2
- package/react/hooks/useMutation.js +0 -2
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +3 -3
- package/react/hooks/useQuery.js +0 -2
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSubscription.js +1 -3
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +3 -5
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/index.d.ts +21 -7
- package/react/index.js +17 -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/QueryReference.d.ts +3 -3
- package/react/internal/cache/QueryReference.js +1 -1
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/internal/types.d.ts +2 -2
- package/react/ssr/getDataFromTree.d.ts +12 -6
- package/react/ssr/getDataFromTree.js +23 -59
- package/react/ssr/getDataFromTree.js.map +1 -1
- package/react/ssr/index.d.ts +1 -0
- package/react/ssr/index.js +1 -0
- 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 +2 -2
- package/react/ssr/useSSRQuery.js.map +1 -1
- package/react/types/deprecated.d.ts +11 -1
- package/testing/core/index.d.ts +1 -1
- package/testing/core/index.js +1 -1
- package/testing/core/index.js.map +1 -1
- package/testing/core/mocking/mockLink.js +2 -2
- package/testing/experimental/createSchemaFetch.js +1 -1
- package/testing/experimental/createSchemaFetch.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/index.d.ts +4 -3
- package/testing/internal/index.js +4 -3
- package/testing/internal/index.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/matchers/index.js +4 -22
- package/testing/matchers/index.js.map +1 -1
- 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/{toEmitStrictTyped.js → toEmitTypedValue.js} +3 -3
- package/testing/matchers/toEmitTypedValue.js.map +1 -0
- package/testing/matchers/toStrictEqualTyped.d.ts +3 -0
- package/testing/matchers/{toEqualStrictTyped.js → toStrictEqualTyped.js} +3 -3
- package/testing/matchers/{toEqualStrictTyped.js.map → toStrictEqualTyped.js.map} +1 -1
- package/testing/react/MockedProvider.js +1 -1
- 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/graphql/getFromAST.d.ts +2 -2
- package/utilities/graphql/getFromAST.js +15 -6
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/index.d.ts +14 -13
- 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/version.d.ts +1 -1
- package/version.js +1 -1
- 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 -32
- package/__cjs/react/hooks/index.cjs.map +0 -1
- package/__cjs/react/hooks/index.d.cts +0 -16
- 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/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 +0 -40
- 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/toEmitStrictTyped.cjs.map +0 -1
- package/__cjs/testing/matchers/toEmitStrictTyped.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 -39
- package/__cjs/testing/matchers/toEqualQueryResult.cjs.map +0 -1
- package/__cjs/testing/matchers/toEqualQueryResult.d.cts +0 -9
- package/__cjs/testing/matchers/toEqualStrictTyped.d.cts +0 -3
- package/__cjs/utilities/types/TODO.cjs +0 -3
- package/__cjs/utilities/types/TODO.cjs.map +0 -1
- package/__cjs/utilities/types/TODO.d.cts +0 -3
- 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 -16
- 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/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 +0 -36
- 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/toEmitStrictTyped.d.ts +0 -7
- package/testing/matchers/toEmitStrictTyped.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 -35
- package/testing/matchers/toEqualQueryResult.js.map +0 -1
- package/testing/matchers/toEqualStrictTyped.d.ts +0 -3
- package/utilities/types/TODO.d.ts +0 -3
- package/utilities/types/TODO.js +0 -2
- package/utilities/types/TODO.js.map +0 -1
package/core/QueryManager.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { Trie } from "@wry/trie";
|
|
2
|
+
import { OperationTypeNode } from "graphql";
|
|
2
3
|
import { catchError, concat, EMPTY, filter, from, lastValueFrom, map, mergeMap, mergeWith, Observable, of, share, shareReplay, Subject, tap, } from "rxjs";
|
|
3
4
|
import { canonicalStringify } from "@apollo/client/cache";
|
|
4
5
|
import { CombinedGraphQLErrors, graphQLResultHasProtocolErrors, UnconventionalError, } from "@apollo/client/errors";
|
|
5
6
|
import { PROTOCOL_ERRORS_SYMBOL } from "@apollo/client/errors";
|
|
6
7
|
import { execute } from "@apollo/client/link/core";
|
|
7
8
|
import { maskFragment, maskOperation } from "@apollo/client/masking";
|
|
8
|
-
import { print } from "@apollo/client/utilities";
|
|
9
|
+
import { checkDocument, print } from "@apollo/client/utilities";
|
|
9
10
|
import { AutoCleanedWeakCache, cacheSizes } from "@apollo/client/utilities";
|
|
10
11
|
import { addNonReactiveToNamedFragments, hasDirectives, isExecutionPatchIncrementalResult, isExecutionPatchResult, isFullyUnmaskedOperation, removeDirectivesFromDocument, } from "@apollo/client/utilities";
|
|
11
12
|
import { DocumentTransform, getDefaultValues, getGraphQLErrorsFromResult, getOperationDefinition, getOperationName, graphQLResultHasError, hasClientExports, isDocumentNode, isNonEmptyArray, isNonNullObject, makeUniqueId, } from "@apollo/client/utilities";
|
|
12
13
|
import { mergeIncrementalData } from "@apollo/client/utilities";
|
|
13
14
|
import { __DEV__ } from "@apollo/client/utilities/environment";
|
|
14
|
-
import { onAnyEvent } from "@apollo/client/utilities/internal";
|
|
15
|
+
import { onAnyEvent, toQueryResult } from "@apollo/client/utilities/internal";
|
|
15
16
|
import { invariant, newInvariantError, } from "@apollo/client/utilities/invariant";
|
|
16
17
|
import { isNetworkRequestInFlight, NetworkStatus } from "./networkStatus.js";
|
|
17
18
|
import { logMissingFieldErrors, ObservableQuery } from "./ObservableQuery.js";
|
|
@@ -88,15 +89,16 @@ export class QueryManager {
|
|
|
88
89
|
this.queries.forEach((_info, queryId) => {
|
|
89
90
|
this.removeQuery(queryId);
|
|
90
91
|
});
|
|
91
|
-
this.cancelPendingFetches(newInvariantError(
|
|
92
|
+
this.cancelPendingFetches(newInvariantError(70));
|
|
92
93
|
}
|
|
93
94
|
cancelPendingFetches(error) {
|
|
94
95
|
this.fetchCancelFns.forEach((cancel) => cancel(error));
|
|
95
96
|
this.fetchCancelFns.clear();
|
|
96
97
|
}
|
|
97
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, }) {
|
|
98
|
-
invariant(mutation,
|
|
99
|
-
|
|
99
|
+
invariant(mutation, 71);
|
|
100
|
+
checkDocument(mutation, OperationTypeNode.MUTATION);
|
|
101
|
+
invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 72);
|
|
100
102
|
const mutationId = this.generateMutationId();
|
|
101
103
|
mutation = this.cache.transformForLink(this.transform(mutation));
|
|
102
104
|
const { hasClientExports } = this.getDocumentInfo(mutation);
|
|
@@ -129,10 +131,10 @@ export class QueryManager {
|
|
|
129
131
|
...context,
|
|
130
132
|
optimisticResponse: isOptimistic ? optimisticResponse : void 0,
|
|
131
133
|
}, variables, {}, false)
|
|
132
|
-
.pipe(mergeMap((result) => {
|
|
134
|
+
.pipe(validateDidEmitValue(), mergeMap((result) => {
|
|
133
135
|
const hasErrors = graphQLResultHasError(result);
|
|
134
136
|
if (hasErrors && errorPolicy === "none") {
|
|
135
|
-
throw new CombinedGraphQLErrors(
|
|
137
|
+
throw new CombinedGraphQLErrors(result);
|
|
136
138
|
}
|
|
137
139
|
if (mutationStoreValue) {
|
|
138
140
|
mutationStoreValue.loading = false;
|
|
@@ -180,7 +182,7 @@ export class QueryManager {
|
|
|
180
182
|
}),
|
|
181
183
|
};
|
|
182
184
|
if (graphQLResultHasError(storeResult)) {
|
|
183
|
-
result.error = new CombinedGraphQLErrors(
|
|
185
|
+
result.error = new CombinedGraphQLErrors(storeResult);
|
|
184
186
|
}
|
|
185
187
|
if (storeResult.extensions) {
|
|
186
188
|
result.extensions = storeResult.extensions;
|
|
@@ -394,7 +396,11 @@ export class QueryManager {
|
|
|
394
396
|
return true;
|
|
395
397
|
}
|
|
396
398
|
fetchQuery(queryId, options, networkStatus) {
|
|
397
|
-
return lastValueFrom(this.fetchObservableWithInfo(queryId, options, networkStatus).observable, {
|
|
399
|
+
return lastValueFrom(this.fetchObservableWithInfo(queryId, options, networkStatus).observable.pipe(map(toQueryResult)), {
|
|
400
|
+
// This default is needed when a `standby` fetch policy is used to avoid
|
|
401
|
+
// an EmptyError from rejecting this promise.
|
|
402
|
+
defaultValue: { data: undefined },
|
|
403
|
+
});
|
|
398
404
|
}
|
|
399
405
|
transform(document) {
|
|
400
406
|
return this.documentTransform.transformDocument(document);
|
|
@@ -446,6 +452,7 @@ export class QueryManager {
|
|
|
446
452
|
};
|
|
447
453
|
}
|
|
448
454
|
watchQuery(options) {
|
|
455
|
+
checkDocument(options.query, OperationTypeNode.QUERY);
|
|
449
456
|
const query = this.transform(options.query);
|
|
450
457
|
// assign variable default values if supplied
|
|
451
458
|
// NOTE: We don't modify options.query here with the transformed query to
|
|
@@ -467,31 +474,23 @@ export class QueryManager {
|
|
|
467
474
|
this.queries.set(observable.queryId, queryInfo);
|
|
468
475
|
// We give queryInfo the transformed query to ensure the first cache diff
|
|
469
476
|
// uses the transformed query instead of the raw query
|
|
470
|
-
queryInfo.init({
|
|
471
|
-
|
|
472
|
-
observableQuery: observable,
|
|
473
|
-
variables: observable.variables,
|
|
474
|
-
});
|
|
477
|
+
queryInfo.init({ document: query, variables: observable.variables });
|
|
478
|
+
queryInfo.setObservableQuery(observable);
|
|
475
479
|
return observable;
|
|
476
480
|
}
|
|
477
|
-
// TODO: catch `EmptyError` and rethrow as network error if `complete`
|
|
478
|
-
// notification is emitted without a value.
|
|
479
481
|
query(options, queryId = this.generateQueryId()) {
|
|
480
|
-
|
|
481
|
-
invariant(options.query.kind === "Document", 72);
|
|
482
|
-
invariant(!options.returnPartialData, 73);
|
|
483
|
-
invariant(!options.pollInterval, 74);
|
|
482
|
+
checkDocument(options.query, OperationTypeNode.QUERY);
|
|
484
483
|
const query = this.transform(options.query);
|
|
485
484
|
return this.fetchQuery(queryId, { ...options, query })
|
|
486
|
-
.then((
|
|
487
|
-
...
|
|
485
|
+
.then((value) => ({
|
|
486
|
+
...value,
|
|
488
487
|
data: this.maskOperation({
|
|
489
488
|
document: query,
|
|
490
|
-
data:
|
|
489
|
+
data: value?.data,
|
|
491
490
|
fetchPolicy: options.fetchPolicy,
|
|
492
491
|
id: queryId,
|
|
493
492
|
}),
|
|
494
|
-
})
|
|
493
|
+
}))
|
|
495
494
|
.finally(() => this.stopQuery(queryId));
|
|
496
495
|
}
|
|
497
496
|
queryIdCounter = 1;
|
|
@@ -514,7 +513,7 @@ export class QueryManager {
|
|
|
514
513
|
// depend on values that previously existed in the data portion of the
|
|
515
514
|
// store. So, we cancel the promises and observers that we have issued
|
|
516
515
|
// so far and not yet resolved (in the case of queries).
|
|
517
|
-
this.cancelPendingFetches(newInvariantError(
|
|
516
|
+
this.cancelPendingFetches(newInvariantError(73));
|
|
518
517
|
this.queries.forEach((queryInfo) => {
|
|
519
518
|
if (queryInfo.observableQuery) {
|
|
520
519
|
// Set loading to true so listeners don't trigger unless they want
|
|
@@ -602,10 +601,10 @@ export class QueryManager {
|
|
|
602
601
|
if (!included) {
|
|
603
602
|
const queryName = queryNames.get(nameOrQueryString);
|
|
604
603
|
if (queryName) {
|
|
605
|
-
__DEV__ && invariant.warn(
|
|
604
|
+
__DEV__ && invariant.warn(74, queryName);
|
|
606
605
|
}
|
|
607
606
|
else {
|
|
608
|
-
__DEV__ && invariant.warn(
|
|
607
|
+
__DEV__ && invariant.warn(75);
|
|
609
608
|
}
|
|
610
609
|
}
|
|
611
610
|
});
|
|
@@ -632,6 +631,7 @@ export class QueryManager {
|
|
|
632
631
|
startGraphQLSubscription(options) {
|
|
633
632
|
let { query, variables } = options;
|
|
634
633
|
const { fetchPolicy, errorPolicy = "none", context = {}, extensions = {}, } = options;
|
|
634
|
+
checkDocument(query, OperationTypeNode.SUBSCRIPTION);
|
|
635
635
|
query = this.transform(query);
|
|
636
636
|
variables = this.getVariables(query, variables);
|
|
637
637
|
const makeObservable = (variables) => this.getObservableFromLink(query, context, variables, extensions).pipe(map((rawResult) => {
|
|
@@ -652,7 +652,7 @@ export class QueryManager {
|
|
|
652
652
|
data: rawResult.data ?? undefined,
|
|
653
653
|
};
|
|
654
654
|
if (graphQLResultHasError(rawResult)) {
|
|
655
|
-
result.error = new CombinedGraphQLErrors(rawResult
|
|
655
|
+
result.error = new CombinedGraphQLErrors(rawResult);
|
|
656
656
|
}
|
|
657
657
|
else if (graphQLResultHasProtocolErrors(rawResult)) {
|
|
658
658
|
result.error = rawResult.extensions[PROTOCOL_ERRORS_SYMBOL];
|
|
@@ -788,7 +788,7 @@ export class QueryManager {
|
|
|
788
788
|
queryInfo.resetLastWrite();
|
|
789
789
|
queryInfo.reset();
|
|
790
790
|
// Throwing here effectively calls observer.error.
|
|
791
|
-
throw new CombinedGraphQLErrors(
|
|
791
|
+
throw new CombinedGraphQLErrors(result);
|
|
792
792
|
}
|
|
793
793
|
// Use linkDocument rather than queryInfo.document so the
|
|
794
794
|
// operation/fragments used to write the result are the same as the
|
|
@@ -809,7 +809,7 @@ export class QueryManager {
|
|
|
809
809
|
aqr.data = void 0;
|
|
810
810
|
}
|
|
811
811
|
if (hasErrors && errorPolicy !== "ignore") {
|
|
812
|
-
aqr.error = new CombinedGraphQLErrors(
|
|
812
|
+
aqr.error = new CombinedGraphQLErrors(result);
|
|
813
813
|
aqr.networkStatus = NetworkStatus.error;
|
|
814
814
|
}
|
|
815
815
|
return aqr;
|
|
@@ -1046,7 +1046,7 @@ export class QueryManager {
|
|
|
1046
1046
|
!isFullyUnmaskedOperation(document) &&
|
|
1047
1047
|
!this.noCacheWarningsByQueryId.has(operationId)) {
|
|
1048
1048
|
this.noCacheWarningsByQueryId.add(operationId);
|
|
1049
|
-
__DEV__ && invariant.warn(
|
|
1049
|
+
__DEV__ && invariant.warn(76, getOperationName(document) ??
|
|
1050
1050
|
`Unnamed ${operationType ?? "operation"}`);
|
|
1051
1051
|
}
|
|
1052
1052
|
}
|
|
@@ -1136,7 +1136,7 @@ export class QueryManager {
|
|
|
1136
1136
|
context,
|
|
1137
1137
|
fetchPolicy,
|
|
1138
1138
|
errorPolicy,
|
|
1139
|
-
});
|
|
1139
|
+
}).pipe(validateDidEmitValue());
|
|
1140
1140
|
switch (fetchPolicy) {
|
|
1141
1141
|
default:
|
|
1142
1142
|
case "cache-first": {
|
|
@@ -1225,4 +1225,15 @@ function maybeWrapError(error) {
|
|
|
1225
1225
|
}
|
|
1226
1226
|
return new UnconventionalError(error);
|
|
1227
1227
|
}
|
|
1228
|
+
function validateDidEmitValue() {
|
|
1229
|
+
let didEmitValue = false;
|
|
1230
|
+
return tap({
|
|
1231
|
+
next() {
|
|
1232
|
+
didEmitValue = true;
|
|
1233
|
+
},
|
|
1234
|
+
complete() {
|
|
1235
|
+
invariant(didEmitValue, 77);
|
|
1236
|
+
},
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1228
1239
|
//# sourceMappingURL=QueryManager.js.map
|