@apollo/client 4.3.0-alpha.0 → 4.3.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +490 -0
- package/README.md +3 -7
- package/__cjs/cache/core/Scalar.cjs +36 -0
- package/__cjs/cache/core/Scalar.cjs.map +1 -0
- package/__cjs/cache/core/Scalar.d.cts +20 -0
- package/__cjs/cache/core/cache.cjs +32 -1
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +89 -6
- package/__cjs/cache/core/types/Cache.d.cts +25 -0
- package/__cjs/cache/index.cjs +3 -1
- package/__cjs/cache/index.cjs.map +1 -1
- package/__cjs/cache/index.d.cts +3 -2
- package/__cjs/cache/inmemory/entityStore.cjs +48 -5
- package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/entityStore.d.cts +3 -0
- package/__cjs/cache/inmemory/helpers.d.cts +9 -1
- package/__cjs/cache/inmemory/inMemoryCache.cjs +83 -4
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.d.cts +44 -5
- package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
- package/__cjs/cache/inmemory/policies.cjs +35 -6
- package/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.d.cts +4 -1
- package/__cjs/cache/inmemory/readFromStore.cjs +490 -49
- package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/readFromStore.d.cts +11 -2
- package/__cjs/cache/inmemory/types.d.cts +29 -4
- package/__cjs/cache/inmemory/writeToStore.cjs +6 -6
- package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/__cjs/core/ApolloClient.cjs +37 -38
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +44 -10
- package/__cjs/core/ObservableQuery.cjs +228 -76
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +16 -8
- package/__cjs/core/QueryInfo.cjs +178 -190
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +17 -22
- package/__cjs/core/QueryManager.cjs +88 -59
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/QueryManager.d.cts +1 -3
- package/__cjs/core/RefetchEventManager.cjs +3 -3
- package/__cjs/core/dataStateErrorCache.cjs +12 -0
- package/__cjs/core/dataStateErrorCache.cjs.map +1 -0
- package/__cjs/core/dataStateErrorCache.d.cts +3 -0
- package/__cjs/core/index.cjs +2 -1
- package/__cjs/core/index.cjs.map +1 -1
- package/__cjs/core/index.d.cts +4 -3
- package/__cjs/core/types.d.cts +12 -6
- package/__cjs/incremental/GraphQLCodegenIncremental.cjs +3 -0
- package/__cjs/incremental/GraphQLCodegenIncremental.cjs.map +1 -0
- package/__cjs/incremental/GraphQLCodegenIncremental.d.cts +55 -0
- package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -1
- package/__cjs/incremental/handlers/defer20220824.d.cts +2 -4
- package/__cjs/incremental/handlers/graphql17Alpha9.cjs +47 -16
- package/__cjs/incremental/handlers/graphql17Alpha9.cjs.map +1 -1
- package/__cjs/incremental/handlers/graphql17Alpha9.d.cts +29 -6
- package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
- package/__cjs/incremental/index.cjs.map +1 -1
- package/__cjs/incremental/index.d.cts +1 -0
- package/__cjs/incremental/internal/types.cjs +3 -0
- package/__cjs/incremental/internal/types.cjs.map +1 -0
- package/__cjs/incremental/internal/types.d.cts +17 -0
- package/__cjs/incremental/types.d.cts +55 -4
- package/__cjs/invariantErrorCodes.cjs +167 -112
- package/__cjs/link/core/ApolloLink.cjs +3 -3
- package/__cjs/link/http/checkFetcher.cjs +1 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs +2 -2
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +1 -1
- package/__cjs/link/persisted-queries/index.cjs +2 -2
- package/__cjs/link/ws/index.cjs +1 -1
- package/__cjs/local-state/LocalState.cjs +11 -11
- package/__cjs/masking/internal/types.d.cts +1 -2
- 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 +3 -3
- package/__cjs/react/context/ApolloContext.cjs +1 -1
- package/__cjs/react/context/ApolloProvider.cjs +1 -1
- package/__cjs/react/hooks/internal/validateSuspenseHookOptions.cjs +2 -2
- package/__cjs/react/hooks/useApolloClient.cjs +1 -1
- package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useBackgroundQuery.d.cts +100 -47
- package/__cjs/react/hooks/useLazyQuery.cjs +2 -2
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.d.cts +39 -33
- package/__cjs/react/hooks/useLoadableQuery.cjs +2 -2
- package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLoadableQuery.d.cts +23 -15
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.d.cts +10 -7
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +74 -32
- package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
- package/__cjs/react/hooks/useSubscription.cjs +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.d.cts +83 -34
- package/__cjs/react/hooks/useSyncExternalStore.cjs +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/types.d.cts +14 -3
- package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
- package/__cjs/react/query-preloader/createQueryPreloader.d.cts +20 -5
- package/__cjs/react/ssr/prerenderStatic.cjs +2 -2
- package/__cjs/react/types/deprecated.d.cts +5 -4
- package/__cjs/testing/core/mocking/mockLink.cjs +25 -5
- package/__cjs/testing/core/mocking/mockLink.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockLink.d.cts +1 -2
- package/__cjs/utilities/caching/sizes.cjs.map +1 -1
- package/__cjs/utilities/caching/sizes.d.cts +39 -1
- package/__cjs/utilities/graphql/DocumentTransform.cjs +1 -1
- package/__cjs/utilities/index.cjs.map +1 -1
- package/__cjs/utilities/index.d.cts +1 -0
- package/__cjs/utilities/internal/StreamArrayState.cjs +27 -0
- package/__cjs/utilities/internal/StreamArrayState.cjs.map +1 -0
- package/__cjs/utilities/internal/StreamArrayState.d.cts +12 -0
- package/__cjs/utilities/internal/addDeferFragmentLabels.cjs +33 -0
- package/__cjs/utilities/internal/addDeferFragmentLabels.cjs.map +1 -0
- package/__cjs/utilities/internal/addDeferFragmentLabels.d.cts +3 -0
- package/__cjs/utilities/internal/capitalize.cjs +12 -0
- package/__cjs/utilities/internal/capitalize.cjs.map +1 -0
- package/__cjs/utilities/internal/capitalize.d.cts +7 -0
- package/__cjs/utilities/internal/coerceScalarFieldsToParsed.cjs +69 -0
- package/__cjs/utilities/internal/coerceScalarFieldsToParsed.cjs.map +1 -0
- package/__cjs/utilities/internal/coerceScalarFieldsToParsed.d.cts +9 -0
- package/__cjs/utilities/internal/constants.cjs +20 -1
- package/__cjs/utilities/internal/constants.cjs.map +1 -1
- package/__cjs/utilities/internal/constants.d.cts +19 -0
- package/__cjs/utilities/internal/getDirectiveArgValue.cjs +19 -0
- package/__cjs/utilities/internal/getDirectiveArgValue.cjs.map +1 -0
- package/__cjs/utilities/internal/getDirectiveArgValue.d.cts +9 -0
- package/__cjs/utilities/internal/getFragmentDefinition.cjs +3 -3
- package/__cjs/utilities/internal/getFragmentFromSelection.cjs +2 -2
- package/__cjs/utilities/internal/getFragmentFromSelection.cjs.map +1 -1
- package/__cjs/utilities/internal/getFragmentQueryDocument.cjs +2 -2
- package/__cjs/utilities/internal/getMainDefinition.cjs +1 -1
- package/__cjs/utilities/internal/getMemoryInternals.cjs +6 -0
- package/__cjs/utilities/internal/getMemoryInternals.cjs.map +1 -1
- package/__cjs/utilities/internal/getMemoryInternals.d.cts +4 -0
- package/__cjs/utilities/internal/getQueryDefinition.cjs +1 -1
- package/__cjs/utilities/internal/getUnwrappedType.cjs +20 -0
- package/__cjs/utilities/internal/getUnwrappedType.cjs.map +1 -0
- package/__cjs/utilities/internal/getUnwrappedType.d.cts +8 -0
- package/__cjs/utilities/internal/index.cjs +25 -2
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +16 -1
- package/__cjs/utilities/internal/isDeferredFragment.cjs +38 -0
- package/__cjs/utilities/internal/isDeferredFragment.cjs.map +1 -0
- package/__cjs/utilities/internal/isDeferredFragment.d.cts +9 -0
- package/__cjs/utilities/internal/isStreamField.cjs +37 -0
- package/__cjs/utilities/internal/isStreamField.cjs.map +1 -0
- package/__cjs/utilities/internal/isStreamField.d.cts +9 -0
- package/__cjs/utilities/internal/isTypenameField.cjs +7 -0
- package/__cjs/utilities/internal/isTypenameField.cjs.map +1 -0
- package/__cjs/utilities/internal/isTypenameField.d.cts +3 -0
- package/__cjs/utilities/internal/makeStreamInfoTrie.cjs +17 -0
- package/__cjs/utilities/internal/makeStreamInfoTrie.cjs.map +1 -0
- package/__cjs/utilities/internal/makeStreamInfoTrie.d.cts +8 -0
- package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs +1 -1
- package/__cjs/utilities/internal/shouldInclude.cjs +4 -4
- package/__cjs/utilities/internal/toDiffWithDataState.cjs +20 -0
- package/__cjs/utilities/internal/toDiffWithDataState.cjs.map +1 -0
- package/__cjs/utilities/internal/toDiffWithDataState.d.cts +8 -0
- package/__cjs/utilities/internal/types/DeferInfo.cjs +3 -0
- package/__cjs/utilities/internal/types/DeferInfo.cjs.map +1 -0
- package/__cjs/utilities/internal/types/DeferInfo.d.cts +10 -0
- package/__cjs/utilities/internal/types/Exact.cjs +3 -0
- package/__cjs/utilities/internal/types/Exact.cjs.map +1 -0
- package/__cjs/utilities/internal/types/Exact.d.cts +2 -0
- package/__cjs/utilities/internal/types/IsLooselyEqual.cjs +3 -0
- package/__cjs/utilities/internal/types/IsLooselyEqual.cjs.map +1 -0
- package/__cjs/utilities/internal/types/IsLooselyEqual.d.cts +10 -0
- package/__cjs/utilities/internal/types/IsNeverish.cjs +3 -0
- package/__cjs/utilities/internal/types/IsNeverish.cjs.map +1 -0
- package/__cjs/utilities/internal/types/IsNeverish.d.cts +4 -0
- package/__cjs/utilities/internal/types/StreamInfoTrie.d.cts +2 -0
- package/__cjs/utilities/internal/valueToObjectRepresentation.cjs +1 -1
- package/__cjs/utilities/policies/pagination.cjs.map +1 -1
- package/__cjs/utilities/policies/pagination.d.cts +1 -1
- package/__cjs/utilities/subscriptions/relay/index.cjs +1 -0
- package/__cjs/utilities/subscriptions/relay/index.cjs.map +1 -1
- package/__cjs/version.cjs +1 -1
- package/__cjs/version.cjs.map +1 -1
- package/cache/core/Scalar.d.ts +20 -0
- package/cache/core/Scalar.js +32 -0
- package/cache/core/Scalar.js.map +1 -0
- package/cache/core/cache.d.ts +89 -6
- package/cache/core/cache.js +33 -2
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +25 -0
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/index.d.ts +3 -2
- package/cache/index.js +1 -0
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +3 -0
- package/cache/inmemory/entityStore.js +49 -6
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +9 -1
- package/cache/inmemory/inMemoryCache.d.ts +44 -5
- package/cache/inmemory/inMemoryCache.js +84 -5
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.d.ts +4 -1
- package/cache/inmemory/policies.js +35 -6
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +11 -2
- package/cache/inmemory/readFromStore.js +486 -49
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +30 -5
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.js +7 -7
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts +44 -10
- package/core/ApolloClient.js +37 -38
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +16 -8
- package/core/ObservableQuery.js +225 -77
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +18 -23
- package/core/QueryInfo.js +174 -190
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +1 -3
- package/core/QueryManager.js +89 -60
- package/core/QueryManager.js.map +1 -1
- package/core/RefetchEventManager.js +3 -3
- package/core/dataStateErrorCache.d.ts +3 -0
- package/core/dataStateErrorCache.js +9 -0
- package/core/dataStateErrorCache.js.map +1 -0
- package/core/index.d.ts +4 -3
- package/core/index.js +1 -1
- package/core/index.js.map +1 -1
- package/core/types.d.ts +12 -6
- package/core/types.js.map +1 -1
- package/incremental/GraphQLCodegenIncremental.d.ts +55 -0
- package/incremental/GraphQLCodegenIncremental.js +2 -0
- package/incremental/GraphQLCodegenIncremental.js.map +1 -0
- package/incremental/handlers/defer20220824.d.ts +2 -4
- package/incremental/handlers/defer20220824.js.map +1 -1
- package/incremental/handlers/graphql17Alpha9.d.ts +29 -6
- package/incremental/handlers/graphql17Alpha9.js +48 -17
- package/incremental/handlers/graphql17Alpha9.js.map +1 -1
- package/incremental/handlers/notImplemented.js +1 -1
- package/incremental/index.d.ts +1 -0
- package/incremental/index.js.map +1 -1
- package/incremental/internal/types.d.ts +17 -0
- package/incremental/internal/types.js +2 -0
- package/incremental/internal/types.js.map +1 -0
- package/incremental/types.d.ts +55 -4
- package/incremental/types.js.map +1 -1
- package/invariantErrorCodes.js +167 -112
- package/link/core/ApolloLink.js +3 -3
- package/link/http/checkFetcher.js +1 -1
- package/link/http/parseAndCheckHttpResponse.js +2 -2
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/ws/index.js +1 -1
- package/local-state/LocalState.js +11 -11
- package/masking/internal/types.d.ts +1 -2
- package/masking/internal/types.js.map +1 -1
- package/masking/maskDefinition.js +2 -2
- package/masking/maskFragment.js +2 -2
- package/masking/maskOperation.js +1 -1
- package/masking/utils.js +3 -3
- package/package.json +1 -1
- package/react/context/ApolloContext.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/hooks/internal/validateSuspenseHookOptions.js +2 -2
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useBackgroundQuery.d.ts +100 -47
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +39 -33
- package/react/hooks/useLazyQuery.js +2 -2
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.d.ts +23 -15
- package/react/hooks/useLoadableQuery.js +2 -2
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +10 -7
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +74 -32
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useQueryRefHandlers.js.map +1 -1
- package/react/hooks/useSubscription.js +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +83 -34
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/hooks-compiled/internal/validateSuspenseHookOptions.js +2 -2
- package/react/hooks-compiled/useApolloClient.js +1 -1
- package/react/hooks-compiled/useBackgroundQuery.d.ts +100 -47
- package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
- package/react/hooks-compiled/useLazyQuery.d.ts +39 -33
- package/react/hooks-compiled/useLazyQuery.js +2 -2
- package/react/hooks-compiled/useLazyQuery.js.map +1 -1
- package/react/hooks-compiled/useLoadableQuery.d.ts +23 -15
- package/react/hooks-compiled/useLoadableQuery.js +2 -2
- package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
- package/react/hooks-compiled/useMutation.d.ts +10 -7
- package/react/hooks-compiled/useMutation.js.map +1 -1
- package/react/hooks-compiled/useQuery.d.ts +74 -32
- package/react/hooks-compiled/useQuery.js.map +1 -1
- package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
- package/react/hooks-compiled/useSubscription.js +1 -1
- package/react/hooks-compiled/useSuspenseQuery.d.ts +83 -34
- package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
- package/react/hooks-compiled/useSyncExternalStore.js +1 -1
- package/react/internal/cache/QueryReference.js +1 -1
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/internal/types.d.ts +15 -4
- package/react/internal/types.js.map +1 -1
- package/react/query-preloader/createQueryPreloader.d.ts +20 -5
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/ssr/prerenderStatic.js +2 -2
- package/react/types/deprecated.d.ts +5 -4
- package/react/types/deprecated.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +1 -2
- package/testing/core/mocking/mockLink.js +25 -5
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/utilities/caching/sizes.d.ts +39 -1
- package/utilities/caching/sizes.js.map +1 -1
- package/utilities/graphql/DocumentTransform.js +1 -1
- package/utilities/index.d.ts +1 -0
- package/utilities/index.js.map +1 -1
- package/utilities/internal/StreamArrayState.d.ts +12 -0
- package/utilities/internal/StreamArrayState.js +23 -0
- package/utilities/internal/StreamArrayState.js.map +1 -0
- package/utilities/internal/addDeferFragmentLabels.d.ts +3 -0
- package/utilities/internal/addDeferFragmentLabels.js +30 -0
- package/utilities/internal/addDeferFragmentLabels.js.map +1 -0
- package/utilities/internal/capitalize.d.ts +7 -0
- package/utilities/internal/capitalize.js +9 -0
- package/utilities/internal/capitalize.js.map +1 -0
- package/utilities/internal/coerceScalarFieldsToParsed.d.ts +9 -0
- package/utilities/internal/coerceScalarFieldsToParsed.js +66 -0
- package/utilities/internal/coerceScalarFieldsToParsed.js.map +1 -0
- package/utilities/internal/constants.d.ts +19 -0
- package/utilities/internal/constants.js +19 -0
- package/utilities/internal/constants.js.map +1 -1
- package/utilities/internal/getDirectiveArgValue.d.ts +9 -0
- package/utilities/internal/getDirectiveArgValue.js +16 -0
- package/utilities/internal/getDirectiveArgValue.js.map +1 -0
- package/utilities/internal/getFragmentDefinition.js +3 -3
- package/utilities/internal/getFragmentFromSelection.js +2 -2
- package/utilities/internal/getFragmentFromSelection.js.map +1 -1
- package/utilities/internal/getFragmentQueryDocument.js +2 -2
- package/utilities/internal/getMainDefinition.js +1 -1
- package/utilities/internal/getMemoryInternals.d.ts +4 -0
- package/utilities/internal/getMemoryInternals.js +6 -0
- package/utilities/internal/getMemoryInternals.js.map +1 -1
- package/utilities/internal/getQueryDefinition.js +1 -1
- package/utilities/internal/getUnwrappedType.d.ts +8 -0
- package/utilities/internal/getUnwrappedType.js +17 -0
- package/utilities/internal/getUnwrappedType.js.map +1 -0
- package/utilities/internal/index.d.ts +16 -1
- package/utilities/internal/index.js +12 -1
- package/utilities/internal/index.js.map +1 -1
- package/utilities/internal/isDeferredFragment.d.ts +9 -0
- package/utilities/internal/isDeferredFragment.js +35 -0
- package/utilities/internal/isDeferredFragment.js.map +1 -0
- package/utilities/internal/isStreamField.d.ts +9 -0
- package/utilities/internal/isStreamField.js +34 -0
- package/utilities/internal/isStreamField.js.map +1 -0
- package/utilities/internal/isTypenameField.d.ts +3 -0
- package/utilities/internal/isTypenameField.js +4 -0
- package/utilities/internal/isTypenameField.js.map +1 -0
- package/utilities/internal/makeStreamInfoTrie.d.ts +8 -0
- package/utilities/internal/makeStreamInfoTrie.js +14 -0
- package/utilities/internal/makeStreamInfoTrie.js.map +1 -0
- package/utilities/internal/removeDirectivesFromDocument.js +1 -1
- package/utilities/internal/shouldInclude.js +4 -4
- package/utilities/internal/toDiffWithDataState.d.ts +8 -0
- package/utilities/internal/toDiffWithDataState.js +17 -0
- package/utilities/internal/toDiffWithDataState.js.map +1 -0
- package/utilities/internal/types/DeferInfo.d.ts +10 -0
- package/utilities/internal/types/DeferInfo.js +2 -0
- package/utilities/internal/types/DeferInfo.js.map +1 -0
- package/utilities/internal/types/Exact.d.ts +2 -0
- package/utilities/internal/types/Exact.js +2 -0
- package/utilities/internal/types/Exact.js.map +1 -0
- package/utilities/internal/types/IsLooselyEqual.d.ts +10 -0
- package/utilities/internal/types/IsLooselyEqual.js +2 -0
- package/utilities/internal/types/IsLooselyEqual.js.map +1 -0
- package/utilities/internal/types/IsNeverish.d.ts +4 -0
- package/utilities/internal/types/IsNeverish.js +2 -0
- package/utilities/internal/types/IsNeverish.js.map +1 -0
- package/utilities/internal/types/StreamInfoTrie.d.ts +2 -0
- package/utilities/internal/types/StreamInfoTrie.js.map +1 -1
- package/utilities/internal/valueToObjectRepresentation.js +1 -1
- package/utilities/policies/pagination.d.ts +1 -1
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/subscriptions/relay/index.js +1 -0
- package/utilities/subscriptions/relay/index.js.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
|
@@ -18,6 +18,7 @@ const utilities_1 = require("@apollo/client/utilities");
|
|
|
18
18
|
const environment_1 = require("@apollo/client/utilities/environment");
|
|
19
19
|
const internal_1 = require("@apollo/client/utilities/internal");
|
|
20
20
|
const invariant_1 = require("@apollo/client/utilities/invariant");
|
|
21
|
+
const dataStateErrorCache_js_1 = require("./dataStateErrorCache.cjs");
|
|
21
22
|
const networkStatus_js_1 = require("./networkStatus.cjs");
|
|
22
23
|
const ObservableQuery_js_1 = require("./ObservableQuery.cjs");
|
|
23
24
|
const QueryInfo_js_1 = require("./QueryInfo.cjs");
|
|
@@ -82,6 +83,12 @@ class QueryManager {
|
|
|
82
83
|
// selections and fragments from the fragment registry.
|
|
83
84
|
.concat(defaultDocumentTransform)
|
|
84
85
|
: defaultDocumentTransform;
|
|
86
|
+
// Put the incremental transform last so custom document transforms don't
|
|
87
|
+
// revert changes made to the document accidentally. Adding last also
|
|
88
|
+
// ensures `@defer` fragments added by the fragment registry are labeled.
|
|
89
|
+
if (this.incrementalHandler.documentTransform) {
|
|
90
|
+
this.documentTransform = this.documentTransform.concat(this.incrementalHandler.documentTransform);
|
|
91
|
+
}
|
|
85
92
|
this.defaultContext = options.defaultContext || {};
|
|
86
93
|
if ((this.onBroadcast = options.onBroadcast)) {
|
|
87
94
|
this.mutationStore = {};
|
|
@@ -99,7 +106,7 @@ class QueryManager {
|
|
|
99
106
|
*/
|
|
100
107
|
stop() {
|
|
101
108
|
this.obsQueries.forEach((oq) => oq.stop());
|
|
102
|
-
this.cancelPendingFetches((0, invariant_1.newInvariantError)(
|
|
109
|
+
this.cancelPendingFetches((0, invariant_1.newInvariantError)(92));
|
|
103
110
|
}
|
|
104
111
|
cancelPendingFetches(error) {
|
|
105
112
|
this.fetchCancelFns.forEach((cancel) => cancel(error));
|
|
@@ -114,7 +121,7 @@ class QueryManager {
|
|
|
114
121
|
if (environment_1.__DEV__) {
|
|
115
122
|
(0, invariant_1.invariant)(
|
|
116
123
|
this.localState,
|
|
117
|
-
|
|
124
|
+
93,
|
|
118
125
|
(0, internal_1.getOperationName)(mutation, "(anonymous)")
|
|
119
126
|
);
|
|
120
127
|
}
|
|
@@ -128,7 +135,7 @@ class QueryManager {
|
|
|
128
135
|
const mutationStoreValue = this.mutationStore &&
|
|
129
136
|
(this.mutationStore[queryInfo.id] = {
|
|
130
137
|
mutation,
|
|
131
|
-
variables,
|
|
138
|
+
variables: this.cache.serializeVariables(mutation, variables),
|
|
132
139
|
loading: true,
|
|
133
140
|
error: null,
|
|
134
141
|
});
|
|
@@ -341,10 +348,6 @@ class QueryManager {
|
|
|
341
348
|
}),
|
|
342
349
|
}));
|
|
343
350
|
}
|
|
344
|
-
requestIdCounter = 1;
|
|
345
|
-
generateRequestId() {
|
|
346
|
-
return this.requestIdCounter++;
|
|
347
|
-
}
|
|
348
351
|
clearStore(options = {
|
|
349
352
|
discardWatches: true,
|
|
350
353
|
}) {
|
|
@@ -353,7 +356,7 @@ class QueryManager {
|
|
|
353
356
|
// depend on values that previously existed in the data portion of the
|
|
354
357
|
// store. So, we cancel the promises and observers that we have issued
|
|
355
358
|
// so far and not yet resolved (in the case of queries).
|
|
356
|
-
this.cancelPendingFetches((0, invariant_1.newInvariantError)(
|
|
359
|
+
this.cancelPendingFetches((0, invariant_1.newInvariantError)(94));
|
|
357
360
|
this.obsQueries.forEach((observableQuery) => {
|
|
358
361
|
// Set loading to true so listeners don't trigger unless they want
|
|
359
362
|
// results with partial data.
|
|
@@ -423,10 +426,10 @@ class QueryManager {
|
|
|
423
426
|
if (!included) {
|
|
424
427
|
const queryName = queryNames.get(nameOrQueryString);
|
|
425
428
|
if (queryName) {
|
|
426
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
429
|
+
__DEV__ && invariant_1.invariant.warn(95, queryName);
|
|
427
430
|
}
|
|
428
431
|
else {
|
|
429
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
432
|
+
__DEV__ && invariant_1.invariant.warn(96);
|
|
430
433
|
}
|
|
431
434
|
}
|
|
432
435
|
});
|
|
@@ -455,7 +458,7 @@ class QueryManager {
|
|
|
455
458
|
if (environment_1.__DEV__) {
|
|
456
459
|
(0, invariant_1.invariant)(
|
|
457
460
|
!this.getDocumentInfo(query).hasClientExports || this.localState,
|
|
458
|
-
|
|
461
|
+
97,
|
|
459
462
|
(0, internal_1.getOperationName)(query, "(anonymous)")
|
|
460
463
|
);
|
|
461
464
|
}
|
|
@@ -530,6 +533,7 @@ class QueryManager {
|
|
|
530
533
|
const executeContext = {
|
|
531
534
|
client: this.client,
|
|
532
535
|
};
|
|
536
|
+
variables = this.cache.serializeVariables(query, variables);
|
|
533
537
|
if (serverQuery) {
|
|
534
538
|
const { inFlightLinkObservables, link } = this;
|
|
535
539
|
try {
|
|
@@ -599,14 +603,14 @@ class QueryManager {
|
|
|
599
603
|
if (environment_1.__DEV__) {
|
|
600
604
|
(0, invariant_1.invariant)(
|
|
601
605
|
this.localState,
|
|
602
|
-
|
|
606
|
+
98,
|
|
603
607
|
operation[0].toUpperCase() + operation.slice(1),
|
|
604
608
|
operationName ?? "(anonymous)"
|
|
605
609
|
);
|
|
606
610
|
}
|
|
607
611
|
(0, invariant_1.invariant)(
|
|
608
612
|
!hasIncrementalDirective,
|
|
609
|
-
|
|
613
|
+
99,
|
|
610
614
|
operation[0].toUpperCase() + operation.slice(1),
|
|
611
615
|
operationName ?? "(anonymous)"
|
|
612
616
|
);
|
|
@@ -630,8 +634,7 @@ class QueryManager {
|
|
|
630
634
|
})),
|
|
631
635
|
};
|
|
632
636
|
}
|
|
633
|
-
getResultsFromLink(options, { queryInfo, cacheWriteBehavior, observableQuery, exposeExtensions, }) {
|
|
634
|
-
const requestId = (queryInfo.lastRequestId = this.generateRequestId());
|
|
637
|
+
getResultsFromLink(options, { queryInfo, cacheWriteBehavior, observableQuery, exposeExtensions, prunePendingDeferFragments, }) {
|
|
635
638
|
const { errorPolicy } = options;
|
|
636
639
|
// Performing transformForLink here gives this.cache a chance to fill in
|
|
637
640
|
// missing fragment definitions (for example) before sending this document
|
|
@@ -641,57 +644,49 @@ class QueryManager {
|
|
|
641
644
|
// Use linkDocument rather than queryInfo.document so the
|
|
642
645
|
// operation/fragments used to write the result are the same as the
|
|
643
646
|
// ones used to obtain it from the link.
|
|
644
|
-
const result = queryInfo.markQueryResult(incoming, {
|
|
647
|
+
const { dataState, ...result } = queryInfo.markQueryResult(incoming, {
|
|
645
648
|
...options,
|
|
646
649
|
document: linkDocument,
|
|
647
650
|
cacheWriteBehavior,
|
|
651
|
+
returnPartialData: options.returnPartialData,
|
|
652
|
+
prunePendingDeferFragments,
|
|
648
653
|
});
|
|
649
654
|
const hasErrors = (0, internal_1.graphQLResultHasError)(result);
|
|
650
655
|
if (hasErrors && errorPolicy === "none") {
|
|
651
|
-
queryInfo.resetLastWrite();
|
|
652
656
|
observableQuery?.["resetNotifications"]();
|
|
653
|
-
|
|
657
|
+
const error = new errors_1.CombinedGraphQLErrors(removeStreamDetailsFromExtensions(result));
|
|
658
|
+
dataStateErrorCache_js_1.dataStateErrorCache.set(error, dataState);
|
|
659
|
+
throw error;
|
|
654
660
|
}
|
|
661
|
+
const partial = dataState !== "complete";
|
|
655
662
|
const aqr = {
|
|
656
663
|
data: result.data,
|
|
657
664
|
...(queryInfo.hasNext ?
|
|
658
665
|
{
|
|
659
666
|
loading: true,
|
|
660
667
|
networkStatus: networkStatus_js_1.NetworkStatus.streaming,
|
|
661
|
-
dataState
|
|
662
|
-
partial
|
|
668
|
+
dataState,
|
|
669
|
+
partial,
|
|
663
670
|
}
|
|
664
671
|
: {
|
|
665
|
-
dataState
|
|
672
|
+
dataState,
|
|
666
673
|
loading: false,
|
|
667
674
|
networkStatus: networkStatus_js_1.NetworkStatus.ready,
|
|
668
|
-
partial
|
|
675
|
+
partial,
|
|
669
676
|
}),
|
|
670
677
|
};
|
|
671
678
|
if (exposeExtensions && "extensions" in result) {
|
|
672
679
|
aqr[internal_1.extensionsSymbol] = result.extensions;
|
|
673
680
|
}
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
if (hasErrors) {
|
|
679
|
-
if (errorPolicy === "none") {
|
|
680
|
-
aqr.data = void 0;
|
|
681
|
-
aqr.dataState = "empty";
|
|
682
|
-
}
|
|
683
|
-
if (errorPolicy !== "ignore") {
|
|
684
|
-
aqr.error = new errors_1.CombinedGraphQLErrors(removeStreamDetailsFromExtensions(result));
|
|
685
|
-
if (aqr.dataState !== "streaming") {
|
|
686
|
-
aqr.networkStatus = networkStatus_js_1.NetworkStatus.error;
|
|
687
|
-
}
|
|
681
|
+
if (hasErrors && errorPolicy !== "ignore") {
|
|
682
|
+
aqr.error = new errors_1.CombinedGraphQLErrors(removeStreamDetailsFromExtensions(result));
|
|
683
|
+
if (aqr.networkStatus !== networkStatus_js_1.NetworkStatus.streaming) {
|
|
684
|
+
aqr.networkStatus = networkStatus_js_1.NetworkStatus.error;
|
|
688
685
|
}
|
|
689
686
|
}
|
|
690
687
|
return aqr;
|
|
691
688
|
}), (0, rxjs_2.catchError)((error) => {
|
|
692
|
-
|
|
693
|
-
if (requestId >= queryInfo.lastRequestId && errorPolicy === "none") {
|
|
694
|
-
queryInfo.resetLastWrite();
|
|
689
|
+
if (errorPolicy === "none") {
|
|
695
690
|
observableQuery?.["resetNotifications"]();
|
|
696
691
|
throw error;
|
|
697
692
|
}
|
|
@@ -726,6 +721,7 @@ class QueryManager {
|
|
|
726
721
|
fetchPolicy,
|
|
727
722
|
errorPolicy,
|
|
728
723
|
returnPartialData,
|
|
724
|
+
networkStatus,
|
|
729
725
|
notifyOnNetworkStatusChange,
|
|
730
726
|
context,
|
|
731
727
|
});
|
|
@@ -784,7 +780,7 @@ class QueryManager {
|
|
|
784
780
|
if (environment_1.__DEV__) {
|
|
785
781
|
(0, invariant_1.invariant)(
|
|
786
782
|
this.localState,
|
|
787
|
-
|
|
783
|
+
100,
|
|
788
784
|
(0, internal_1.getOperationName)(normalized.query, "(anonymous)")
|
|
789
785
|
);
|
|
790
786
|
}
|
|
@@ -960,7 +956,7 @@ class QueryManager {
|
|
|
960
956
|
!this.noCacheWarningsByCause.has(cause)) {
|
|
961
957
|
this.noCacheWarningsByCause.add(cause);
|
|
962
958
|
__DEV__ && invariant_1.invariant.warn(
|
|
963
|
-
|
|
959
|
+
101,
|
|
964
960
|
(0, internal_1.getOperationName)(document, `Unnamed ${operationType ?? "operation"}`)
|
|
965
961
|
);
|
|
966
962
|
}
|
|
@@ -975,32 +971,33 @@ class QueryManager {
|
|
|
975
971
|
(0, masking_1.maskFragment)(data, fragment, this.cache, fragmentName)
|
|
976
972
|
: data;
|
|
977
973
|
}
|
|
978
|
-
fetchQueryByPolicy({ query, variables, fetchPolicy, errorPolicy, returnPartialData, context, }, { cacheWriteBehavior, onCacheHit, queryInfo, observableQuery, exposeExtensions, }) {
|
|
979
|
-
const readCache = () =>
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
974
|
+
fetchQueryByPolicy({ query, variables, fetchPolicy, errorPolicy, returnPartialData, context, networkStatus, }, { cacheWriteBehavior, onCacheHit, queryInfo, observableQuery, exposeExtensions, }) {
|
|
975
|
+
const readCache = () => {
|
|
976
|
+
return queryInfo.getDiff({
|
|
977
|
+
query,
|
|
978
|
+
variables,
|
|
979
|
+
returnPartialData: true,
|
|
980
|
+
optimistic: true,
|
|
981
|
+
});
|
|
982
|
+
};
|
|
985
983
|
const resultsFromCache = (diff, networkStatus) => {
|
|
986
984
|
const data = diff.result;
|
|
987
985
|
if (environment_1.__DEV__ && !returnPartialData && data !== null) {
|
|
988
986
|
(0, ObservableQuery_js_1.logMissingFieldErrors)(diff.missing);
|
|
989
987
|
}
|
|
990
|
-
const toResult = (data) => {
|
|
988
|
+
const toResult = (data, dataState = diff.dataState) => {
|
|
991
989
|
// TODO: Eventually we should move this handling into
|
|
992
990
|
// queryInfo.getDiff() directly. Since getDiff is updated to return null
|
|
993
991
|
// on returnPartialData: false, we should take advantage of that instead
|
|
994
992
|
// of having to patch it elsewhere.
|
|
995
993
|
if (!diff.complete && !returnPartialData) {
|
|
996
994
|
data = undefined;
|
|
995
|
+
dataState = "empty";
|
|
997
996
|
}
|
|
998
997
|
return {
|
|
999
998
|
// TODO: Handle partial data
|
|
1000
999
|
data: data,
|
|
1001
|
-
dataState
|
|
1002
|
-
: data ? "partial"
|
|
1003
|
-
: "empty",
|
|
1000
|
+
dataState,
|
|
1004
1001
|
loading: (0, utilities_1.isNetworkRequestInFlight)(networkStatus),
|
|
1005
1002
|
networkStatus,
|
|
1006
1003
|
partial: !diff.complete,
|
|
@@ -1010,6 +1007,10 @@ class QueryManager {
|
|
|
1010
1007
|
return (0, rxjs_2.of)({
|
|
1011
1008
|
kind: "N",
|
|
1012
1009
|
value: toResult(data),
|
|
1010
|
+
// Always attach the variables used for this fetch so @export
|
|
1011
|
+
// resolution can update ObservableQuery.options.variables and
|
|
1012
|
+
// resubscribe the cache watch under the correct variable set.
|
|
1013
|
+
resolvedVariables: variables,
|
|
1013
1014
|
source: "cache",
|
|
1014
1015
|
});
|
|
1015
1016
|
};
|
|
@@ -1022,7 +1023,7 @@ class QueryManager {
|
|
|
1022
1023
|
if (environment_1.__DEV__) {
|
|
1023
1024
|
(0, invariant_1.invariant)(
|
|
1024
1025
|
this.localState,
|
|
1025
|
-
|
|
1026
|
+
102,
|
|
1026
1027
|
(0, internal_1.getOperationName)(query, "(anonymous)")
|
|
1027
1028
|
);
|
|
1028
1029
|
}
|
|
@@ -1038,7 +1039,13 @@ class QueryManager {
|
|
|
1038
1039
|
fetchPolicy,
|
|
1039
1040
|
}).then((resolved) => ({
|
|
1040
1041
|
kind: "N",
|
|
1041
|
-
value: toResult(resolved.data || void 0
|
|
1042
|
+
value: toResult(resolved.data || void 0, diff.complete ? "complete"
|
|
1043
|
+
: resolved.data ? "partial"
|
|
1044
|
+
: "empty"),
|
|
1045
|
+
// Always attach the variables used for this fetch so @export
|
|
1046
|
+
// resolution can update ObservableQuery.options.variables and
|
|
1047
|
+
// resubscribe the cache watch under the correct variable set.
|
|
1048
|
+
resolvedVariables: variables,
|
|
1042
1049
|
source: "cache",
|
|
1043
1050
|
})));
|
|
1044
1051
|
}
|
|
@@ -1053,19 +1060,26 @@ class QueryManager {
|
|
|
1053
1060
|
}
|
|
1054
1061
|
return fromData(data || undefined);
|
|
1055
1062
|
};
|
|
1056
|
-
const resultsFromLink = () => this.getResultsFromLink({
|
|
1063
|
+
const resultsFromLink = ({ prunePendingDeferFragments = true, } = {}) => this.getResultsFromLink({
|
|
1057
1064
|
query,
|
|
1058
1065
|
variables,
|
|
1059
1066
|
context,
|
|
1060
1067
|
fetchPolicy,
|
|
1061
1068
|
errorPolicy,
|
|
1069
|
+
returnPartialData,
|
|
1070
|
+
networkStatus,
|
|
1062
1071
|
}, {
|
|
1063
1072
|
cacheWriteBehavior,
|
|
1064
1073
|
queryInfo,
|
|
1065
1074
|
observableQuery,
|
|
1066
1075
|
exposeExtensions,
|
|
1076
|
+
prunePendingDeferFragments,
|
|
1067
1077
|
}).pipe(validateDidEmitValue(), (0, rxjs_2.materialize)(), (0, rxjs_2.map)((result) => ({
|
|
1068
1078
|
...result,
|
|
1079
|
+
// Always attach the variables used for this fetch so @export
|
|
1080
|
+
// resolution can update ObservableQuery.options.variables and
|
|
1081
|
+
// resubscribe the cache watch under the correct variable set.
|
|
1082
|
+
resolvedVariables: variables,
|
|
1069
1083
|
source: "network",
|
|
1070
1084
|
})));
|
|
1071
1085
|
switch (fetchPolicy) {
|
|
@@ -1091,7 +1105,7 @@ class QueryManager {
|
|
|
1091
1105
|
if (diff.complete || returnPartialData) {
|
|
1092
1106
|
return {
|
|
1093
1107
|
fromLink: true,
|
|
1094
|
-
observable: (0, rxjs_2.concat)(resultsFromCache(diff, networkStatus_js_1.NetworkStatus.loading), resultsFromLink()),
|
|
1108
|
+
observable: (0, rxjs_2.concat)(resultsFromCache(diff, networkStatus_js_1.NetworkStatus.loading), resultsFromLink({ prunePendingDeferFragments: false })),
|
|
1095
1109
|
};
|
|
1096
1110
|
}
|
|
1097
1111
|
return { fromLink: true, observable: resultsFromLink() };
|
|
@@ -1102,9 +1116,24 @@ class QueryManager {
|
|
|
1102
1116
|
observable: (0, rxjs_2.concat)(resultsFromCache(readCache(), networkStatus_js_1.NetworkStatus.ready)),
|
|
1103
1117
|
};
|
|
1104
1118
|
case "network-only":
|
|
1105
|
-
return {
|
|
1119
|
+
return {
|
|
1120
|
+
fromLink: true,
|
|
1121
|
+
observable: resultsFromLink({
|
|
1122
|
+
prunePendingDeferFragments: networkStatus !== networkStatus_js_1.NetworkStatus.refetch,
|
|
1123
|
+
}),
|
|
1124
|
+
};
|
|
1106
1125
|
case "no-cache":
|
|
1107
|
-
return {
|
|
1126
|
+
return {
|
|
1127
|
+
fromLink: true,
|
|
1128
|
+
observable: resultsFromLink().pipe((0, rxjs_2.map)((notification) => {
|
|
1129
|
+
if (notification.kind === "N" &&
|
|
1130
|
+
notification.value.data != null &&
|
|
1131
|
+
this.cache.configuresScalars()) {
|
|
1132
|
+
notification.value.data = (0, internal_1.coerceScalarFieldsToParsed)(notification.value.data, query, this.cache);
|
|
1133
|
+
}
|
|
1134
|
+
return notification;
|
|
1135
|
+
})),
|
|
1136
|
+
};
|
|
1108
1137
|
case "standby":
|
|
1109
1138
|
return { fromLink: false, observable: rxjs_2.EMPTY };
|
|
1110
1139
|
}
|
|
@@ -1118,7 +1147,7 @@ function validateDidEmitValue() {
|
|
|
1118
1147
|
didEmitValue = true;
|
|
1119
1148
|
},
|
|
1120
1149
|
complete() {
|
|
1121
|
-
(0, invariant_1.invariant)(didEmitValue,
|
|
1150
|
+
(0, invariant_1.invariant)(didEmitValue, 103);
|
|
1122
1151
|
},
|
|
1123
1152
|
});
|
|
1124
1153
|
}
|