@apollo/client 4.0.0-alpha.21 → 4.0.0-alpha.23
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 +341 -2
- package/__cjs/cache/core/cache.cjs +1 -1
- package/__cjs/cache/inmemory/entityStore.cjs +3 -3
- package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
- package/__cjs/cache/inmemory/key-extractor.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.cjs +4 -4
- package/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
- package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
- package/__cjs/core/ApolloClient.cjs +24 -19
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +15 -11
- package/__cjs/core/ObservableQuery.cjs +52 -48
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +48 -14
- package/__cjs/core/QueryInfo.cjs +146 -168
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +14 -11
- package/__cjs/core/QueryManager.cjs +138 -123
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/QueryManager.d.cts +17 -6
- package/__cjs/core/index.cjs +2 -1
- package/__cjs/core/index.cjs.map +1 -1
- package/__cjs/core/index.d.cts +4 -4
- package/__cjs/core/types.d.cts +72 -18
- package/__cjs/core/watchQueryOptions.d.cts +2 -24
- package/__cjs/dev/setErrorMessageHandler.cjs.map +1 -1
- package/__cjs/errors/CombinedGraphQLErrors.cjs +6 -3
- package/__cjs/errors/CombinedGraphQLErrors.cjs.map +1 -1
- package/__cjs/errors/CombinedGraphQLErrors.d.cts +7 -2
- package/__cjs/errors/index.cjs +1 -1
- package/__cjs/errors/index.cjs.map +1 -1
- package/__cjs/errors/index.d.cts +1 -3
- package/__cjs/incremental/handlers/defer20220824.cjs +102 -0
- package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -0
- package/__cjs/incremental/handlers/defer20220824.d.cts +55 -0
- package/__cjs/incremental/handlers/notImplemented.cjs +19 -0
- package/__cjs/incremental/handlers/notImplemented.cjs.map +1 -0
- package/__cjs/incremental/handlers/notImplemented.d.cts +9 -0
- package/__cjs/incremental/index.cjs +9 -0
- package/__cjs/incremental/index.cjs.map +1 -0
- package/__cjs/incremental/index.d.cts +4 -0
- package/__cjs/incremental/types.cjs +3 -0
- package/__cjs/incremental/types.cjs.map +1 -0
- package/__cjs/incremental/types.d.cts +24 -0
- package/__cjs/invariantErrorCodes.cjs +131 -114
- package/__cjs/link/batch-http/batchHttpLink.cjs +14 -14
- package/__cjs/link/batch-http/batchHttpLink.cjs.map +1 -1
- package/__cjs/link/batch-http/batchHttpLink.d.cts +4 -0
- package/__cjs/link/batch-http/index.cjs +2 -1
- package/__cjs/link/batch-http/index.cjs.map +1 -1
- package/__cjs/link/batch-http/index.d.cts +1 -1
- package/__cjs/link/client-awareness/ClientAwarenessLink.cjs +45 -0
- package/__cjs/link/client-awareness/ClientAwarenessLink.cjs.map +1 -0
- package/__cjs/link/client-awareness/ClientAwarenessLink.d.cts +62 -0
- package/__cjs/link/client-awareness/index.cjs +6 -0
- package/__cjs/link/client-awareness/index.cjs.map +1 -0
- package/__cjs/link/client-awareness/index.d.cts +2 -0
- package/__cjs/link/context/index.cjs +36 -25
- package/__cjs/link/context/index.cjs.map +1 -1
- package/__cjs/link/context/index.d.cts +8 -1
- package/__cjs/link/core/types.d.cts +5 -38
- package/__cjs/link/error/index.cjs +68 -65
- package/__cjs/link/error/index.cjs.map +1 -1
- package/__cjs/link/error/index.d.cts +15 -14
- package/__cjs/link/http/BaseHttpLink.cjs +111 -0
- package/__cjs/link/http/BaseHttpLink.cjs.map +1 -0
- package/__cjs/link/http/BaseHttpLink.d.cts +6 -0
- package/__cjs/link/http/HttpLink.cjs +12 -5
- package/__cjs/link/http/HttpLink.cjs.map +1 -1
- package/__cjs/link/http/HttpLink.d.cts +20 -4
- package/__cjs/link/http/checkFetcher.cjs +1 -1
- package/__cjs/link/http/index.cjs +4 -3
- package/__cjs/link/http/index.cjs.map +1 -1
- package/__cjs/link/http/index.d.cts +2 -2
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs +45 -57
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +1 -1
- package/__cjs/link/http/selectHttpOptionsAndBody.cjs +6 -5
- package/__cjs/link/http/selectHttpOptionsAndBody.cjs.map +1 -1
- package/__cjs/link/index.cjs.map +1 -1
- package/__cjs/link/index.d.cts +1 -1
- package/__cjs/link/persisted-queries/index.cjs +159 -141
- package/__cjs/link/persisted-queries/index.cjs.map +1 -1
- package/__cjs/link/persisted-queries/index.d.cts +19 -19
- package/__cjs/link/remove-typename/index.cjs +2 -1
- package/__cjs/link/remove-typename/index.cjs.map +1 -1
- package/__cjs/link/remove-typename/index.d.cts +1 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs +34 -23
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.d.cts +8 -9
- package/__cjs/link/utils/validateOperation.cjs +1 -1
- package/__cjs/local-state/LocalState.cjs +10 -18
- package/__cjs/local-state/LocalState.cjs.map +1 -1
- package/__cjs/local-state/LocalState.d.cts +3 -4
- package/__cjs/masking/maskDefinition.cjs +2 -2
- package/__cjs/masking/maskFragment.cjs +2 -2
- package/__cjs/masking/maskOperation.cjs +1 -1
- package/__cjs/masking/types.d.cts +6 -5
- package/__cjs/masking/utils.cjs +3 -3
- package/__cjs/react/context/ApolloConsumer.cjs +1 -1
- 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 +1 -0
- package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useFragment.cjs +1 -0
- package/__cjs/react/hooks/useFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.cjs +4 -4
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.d.cts +2 -7
- package/__cjs/react/hooks/useLoadableQuery.cjs +2 -2
- package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.d.cts +2 -2
- package/__cjs/react/hooks/useQuery.cjs +23 -21
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +3 -8
- package/__cjs/react/hooks/useQueryRefHandlers.cjs +1 -0
- package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
- package/__cjs/react/hooks/useReadQuery.cjs +1 -0
- package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSubscription.cjs +1 -1
- package/__cjs/react/hooks/useSuspenseFragment.cjs +1 -0
- package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.cjs +1 -0
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
- package/__cjs/react/internal/cache/QueryReference.cjs +5 -5
- package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/QueryReference.d.cts +2 -3
- package/__cjs/react/internal/types.d.cts +2 -7
- package/__cjs/react/ssr/prerenderStatic.cjs +2 -2
- package/__cjs/testing/core/mocking/mockLink.cjs +4 -4
- package/__cjs/utilities/caching/sizes.cjs.map +1 -1
- package/__cjs/utilities/caching/sizes.d.cts +6 -0
- package/__cjs/utilities/graphql/DocumentTransform.cjs +1 -1
- package/__cjs/utilities/graphql/isFormattedExecutionResult.cjs +9 -0
- package/__cjs/utilities/graphql/isFormattedExecutionResult.cjs.map +1 -0
- package/__cjs/utilities/graphql/isFormattedExecutionResult.d.cts +3 -0
- package/__cjs/utilities/index.cjs +3 -1
- package/__cjs/utilities/index.cjs.map +1 -1
- package/__cjs/utilities/index.d.cts +1 -0
- package/__cjs/utilities/internal/checkDocument.cjs +47 -13
- package/__cjs/utilities/internal/checkDocument.cjs.map +1 -1
- package/__cjs/utilities/internal/checkDocument.d.cts +1 -1
- package/__cjs/utilities/internal/getFragmentDefinition.cjs +3 -3
- package/__cjs/utilities/internal/getFragmentFromSelection.cjs +1 -1
- package/__cjs/utilities/internal/getFragmentQueryDocument.cjs +2 -2
- package/__cjs/utilities/internal/getGraphQLErrorsFromResult.cjs +1 -12
- package/__cjs/utilities/internal/getGraphQLErrorsFromResult.cjs.map +1 -1
- package/__cjs/utilities/internal/getGraphQLErrorsFromResult.d.cts +4 -2
- package/__cjs/utilities/internal/getMainDefinition.cjs +1 -1
- package/__cjs/utilities/internal/getMemoryInternals.cjs +1 -0
- package/__cjs/utilities/internal/getMemoryInternals.cjs.map +1 -1
- package/__cjs/utilities/internal/getMemoryInternals.d.cts +0 -1
- package/__cjs/utilities/internal/getQueryDefinition.cjs +1 -1
- package/__cjs/utilities/internal/graphQLResultHasError.cjs +1 -4
- package/__cjs/utilities/internal/graphQLResultHasError.cjs.map +1 -1
- package/__cjs/utilities/internal/graphQLResultHasError.d.cts +2 -2
- package/__cjs/utilities/internal/index.cjs +2 -10
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +0 -4
- package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs +1 -1
- package/__cjs/utilities/internal/shouldInclude.cjs +4 -4
- package/__cjs/utilities/internal/valueToObjectRepresentation.cjs +1 -1
- package/__cjs/version.cjs +3 -2
- package/__cjs/version.cjs.map +1 -1
- package/__cjs/version.d.cts +1 -0
- package/cache/core/cache.js +1 -1
- package/cache/inmemory/entityStore.js +3 -3
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/policies.js +4 -4
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/writeToStore.js +4 -4
- package/core/ApolloClient.d.ts +15 -11
- package/core/ApolloClient.js +25 -20
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +48 -14
- package/core/ObservableQuery.js +53 -49
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +14 -11
- package/core/QueryInfo.js +147 -169
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +17 -6
- package/core/QueryManager.js +140 -125
- package/core/QueryManager.js.map +1 -1
- package/core/index.d.ts +4 -4
- package/core/index.js +1 -1
- package/core/index.js.map +1 -1
- package/core/types.d.ts +72 -18
- package/core/watchQueryOptions.d.ts +2 -24
- package/dev/setErrorMessageHandler.js.map +1 -1
- package/errors/CombinedGraphQLErrors.d.ts +7 -2
- package/errors/CombinedGraphQLErrors.js +6 -3
- package/errors/CombinedGraphQLErrors.js.map +1 -1
- package/errors/index.d.ts +1 -3
- package/errors/index.js +1 -1
- package/errors/index.js.map +1 -1
- package/incremental/handlers/defer20220824.d.ts +55 -0
- package/incremental/handlers/defer20220824.js +97 -0
- package/incremental/handlers/defer20220824.js.map +1 -0
- package/incremental/handlers/notImplemented.d.ts +9 -0
- package/incremental/handlers/notImplemented.js +15 -0
- package/incremental/handlers/notImplemented.js.map +1 -0
- package/incremental/index.d.ts +4 -0
- package/incremental/index.js +3 -0
- package/incremental/index.js.map +1 -0
- package/incremental/types.d.ts +24 -0
- package/incremental/types.js +2 -0
- package/incremental/types.js.map +1 -0
- package/invariantErrorCodes.js +132 -118
- package/legacyEntryPoints/incremental/incremental.cjs +1 -0
- package/legacyEntryPoints/incremental/incremental.d.cts +1 -0
- package/legacyEntryPoints/incremental/index.d.ts +1 -0
- package/legacyEntryPoints/incremental/index.js +1 -0
- package/legacyEntryPoints/link/client-awareness/client-awareness.cjs +1 -0
- package/legacyEntryPoints/link/client-awareness/client-awareness.d.cts +1 -0
- package/legacyEntryPoints/link/client-awareness/index.d.ts +1 -0
- package/legacyEntryPoints/link/client-awareness/index.js +1 -0
- package/link/batch-http/batchHttpLink.d.ts +4 -0
- package/link/batch-http/batchHttpLink.js +11 -12
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/batch-http/index.d.ts +1 -1
- package/link/batch-http/index.js +1 -1
- package/link/batch-http/index.js.map +1 -1
- package/link/client-awareness/ClientAwarenessLink.d.ts +62 -0
- package/link/client-awareness/ClientAwarenessLink.js +41 -0
- package/link/client-awareness/ClientAwarenessLink.js.map +1 -0
- package/link/client-awareness/index.d.ts +2 -0
- package/link/client-awareness/index.js +2 -0
- package/link/client-awareness/index.js.map +1 -0
- package/link/context/index.d.ts +8 -1
- package/link/context/index.js +34 -25
- package/link/context/index.js.map +1 -1
- package/link/core/types.d.ts +5 -38
- package/link/error/index.d.ts +15 -14
- package/link/error/index.js +68 -65
- package/link/error/index.js.map +1 -1
- package/link/http/BaseHttpLink.d.ts +6 -0
- package/link/http/BaseHttpLink.js +107 -0
- package/link/http/BaseHttpLink.js.map +1 -0
- package/link/http/HttpLink.d.ts +20 -4
- package/link/http/HttpLink.js +10 -4
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/checkFetcher.js +1 -1
- package/link/http/index.d.ts +2 -2
- package/link/http/index.js +2 -2
- package/link/http/index.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +45 -57
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +6 -5
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/index.d.ts +1 -1
- package/link/index.js.map +1 -1
- package/link/persisted-queries/index.d.ts +19 -19
- package/link/persisted-queries/index.js +157 -140
- package/link/persisted-queries/index.js.map +1 -1
- package/link/remove-typename/index.d.ts +1 -1
- package/link/remove-typename/index.js +1 -1
- package/link/remove-typename/index.js.map +1 -1
- package/link/remove-typename/removeTypenameFromVariables.d.ts +8 -9
- package/link/remove-typename/removeTypenameFromVariables.js +32 -22
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
- package/link/utils/validateOperation.js +1 -1
- package/local-state/LocalState.d.ts +3 -4
- package/local-state/LocalState.js +10 -18
- package/local-state/LocalState.js.map +1 -1
- package/masking/maskDefinition.js +2 -2
- package/masking/maskFragment.js +2 -2
- package/masking/maskOperation.js +1 -1
- package/masking/types.d.ts +6 -5
- package/masking/utils.js +3 -3
- package/package.json +15 -2
- package/react/context/ApolloConsumer.js +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 +15 -2
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useBackgroundQuery.js +7 -6
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.js +12 -11
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +2 -7
- package/react/hooks/useLazyQuery.js +17 -17
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.js +229 -69
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +2 -2
- package/react/hooks/useMutation.js +191 -81
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +3 -8
- package/react/hooks/useQuery.js +243 -70
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useQueryRefHandlers.js +64 -23
- package/react/hooks/useQueryRefHandlers.js.map +1 -1
- package/react/hooks/useReadQuery.js +3 -2
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.js +5 -5
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseFragment.js +1 -0
- package/react/hooks/useSuspenseFragment.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +59 -33
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/internal/cache/QueryReference.d.ts +2 -3
- package/react/internal/cache/QueryReference.js +5 -5
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/internal/types.d.ts +2 -7
- package/react/ssr/prerenderStatic.js +2 -2
- package/testing/core/mocking/mockLink.js +4 -4
- package/utilities/caching/sizes.d.ts +6 -0
- package/utilities/caching/sizes.js.map +1 -1
- package/utilities/graphql/DocumentTransform.js +1 -1
- package/utilities/graphql/isFormattedExecutionResult.d.ts +3 -0
- package/utilities/graphql/isFormattedExecutionResult.js +6 -0
- package/utilities/graphql/isFormattedExecutionResult.js.map +1 -0
- package/utilities/index.d.ts +1 -0
- package/utilities/index.js +1 -0
- package/utilities/index.js.map +1 -1
- package/utilities/internal/checkDocument.d.ts +1 -1
- package/utilities/internal/checkDocument.js +46 -12
- package/utilities/internal/checkDocument.js.map +1 -1
- package/utilities/internal/getFragmentDefinition.js +3 -3
- package/utilities/internal/getFragmentFromSelection.js +1 -1
- package/utilities/internal/getFragmentQueryDocument.js +2 -2
- package/utilities/internal/getGraphQLErrorsFromResult.d.ts +4 -2
- package/utilities/internal/getGraphQLErrorsFromResult.js +1 -12
- package/utilities/internal/getGraphQLErrorsFromResult.js.map +1 -1
- package/utilities/internal/getMainDefinition.js +1 -1
- package/utilities/internal/getMemoryInternals.d.ts +0 -1
- package/utilities/internal/getMemoryInternals.js +1 -0
- package/utilities/internal/getMemoryInternals.js.map +1 -1
- package/utilities/internal/getQueryDefinition.js +1 -1
- package/utilities/internal/graphQLResultHasError.d.ts +2 -2
- package/utilities/internal/graphQLResultHasError.js +1 -4
- package/utilities/internal/graphQLResultHasError.js.map +1 -1
- package/utilities/internal/index.d.ts +0 -4
- package/utilities/internal/index.js +0 -4
- package/utilities/internal/index.js.map +1 -1
- package/utilities/internal/removeDirectivesFromDocument.js +1 -1
- package/utilities/internal/shouldInclude.js +4 -4
- package/utilities/internal/valueToObjectRepresentation.js +1 -1
- package/version.d.ts +1 -0
- package/version.js +2 -1
- package/version.js.map +1 -1
- package/__cjs/link/http/createHttpLink.cjs +0 -151
- package/__cjs/link/http/createHttpLink.cjs.map +0 -1
- package/__cjs/link/http/createHttpLink.d.cts +0 -4
- package/__cjs/utilities/internal/isExecutionPatchIncrementalResult.cjs +0 -12
- package/__cjs/utilities/internal/isExecutionPatchIncrementalResult.cjs.map +0 -1
- package/__cjs/utilities/internal/isExecutionPatchIncrementalResult.d.cts +0 -8
- package/__cjs/utilities/internal/isExecutionPatchIninitialResult.cjs +0 -12
- package/__cjs/utilities/internal/isExecutionPatchIninitialResult.cjs.map +0 -1
- package/__cjs/utilities/internal/isExecutionPatchIninitialResult.d.cts +0 -8
- package/__cjs/utilities/internal/isExecutionPatchResult.cjs +0 -15
- package/__cjs/utilities/internal/isExecutionPatchResult.cjs.map +0 -1
- package/__cjs/utilities/internal/isExecutionPatchResult.d.cts +0 -8
- package/__cjs/utilities/internal/mergeIncrementalData.cjs +0 -30
- package/__cjs/utilities/internal/mergeIncrementalData.cjs.map +0 -1
- package/__cjs/utilities/internal/mergeIncrementalData.d.cts +0 -8
- package/link/http/createHttpLink.d.ts +0 -4
- package/link/http/createHttpLink.js +0 -143
- package/link/http/createHttpLink.js.map +0 -1
- package/utilities/internal/isExecutionPatchIncrementalResult.d.ts +0 -8
- package/utilities/internal/isExecutionPatchIncrementalResult.js +0 -9
- package/utilities/internal/isExecutionPatchIncrementalResult.js.map +0 -1
- package/utilities/internal/isExecutionPatchIninitialResult.d.ts +0 -8
- package/utilities/internal/isExecutionPatchIninitialResult.js +0 -9
- package/utilities/internal/isExecutionPatchIninitialResult.js.map +0 -1
- package/utilities/internal/isExecutionPatchResult.d.ts +0 -8
- package/utilities/internal/isExecutionPatchResult.js +0 -12
- package/utilities/internal/isExecutionPatchResult.js.map +0 -1
- package/utilities/internal/mergeIncrementalData.d.ts +0 -8
- package/utilities/internal/mergeIncrementalData.js +0 -27
- package/utilities/internal/mergeIncrementalData.js.map +0 -1
|
@@ -24,14 +24,18 @@ const QueryInfo_js_1 = require("./QueryInfo.cjs");
|
|
|
24
24
|
class QueryManager {
|
|
25
25
|
defaultOptions;
|
|
26
26
|
client;
|
|
27
|
+
/**
|
|
28
|
+
* The options that were passed to the ApolloClient constructor.
|
|
29
|
+
*/
|
|
30
|
+
clientOptions;
|
|
27
31
|
assumeImmutableResults;
|
|
28
32
|
documentTransform;
|
|
29
33
|
ssrMode;
|
|
30
34
|
defaultContext;
|
|
31
35
|
dataMasking;
|
|
36
|
+
incrementalHandler;
|
|
32
37
|
localState;
|
|
33
38
|
queryDeduplication;
|
|
34
|
-
clientAwareness = {};
|
|
35
39
|
/**
|
|
36
40
|
* Whether to prioritize cache values over network results when
|
|
37
41
|
* `fetchObservableWithInfo` is called.
|
|
@@ -61,11 +65,12 @@ class QueryManager {
|
|
|
61
65
|
this.client = options.client;
|
|
62
66
|
this.defaultOptions = options.defaultOptions;
|
|
63
67
|
this.queryDeduplication = options.queryDeduplication;
|
|
64
|
-
this.
|
|
68
|
+
this.clientOptions = options.clientOptions;
|
|
65
69
|
this.ssrMode = options.ssrMode;
|
|
66
70
|
this.assumeImmutableResults = options.assumeImmutableResults;
|
|
67
71
|
this.dataMasking = options.dataMasking;
|
|
68
72
|
this.localState = options.localState;
|
|
73
|
+
this.incrementalHandler = options.incrementalHandler;
|
|
69
74
|
const documentTransform = options.documentTransform;
|
|
70
75
|
this.documentTransform =
|
|
71
76
|
documentTransform ?
|
|
@@ -94,16 +99,13 @@ class QueryManager {
|
|
|
94
99
|
*/
|
|
95
100
|
stop() {
|
|
96
101
|
this.obsQueries.forEach((oq) => oq.stop());
|
|
97
|
-
this.cancelPendingFetches((0, invariant_1.newInvariantError)(
|
|
102
|
+
this.cancelPendingFetches((0, invariant_1.newInvariantError)(85));
|
|
98
103
|
}
|
|
99
104
|
cancelPendingFetches(error) {
|
|
100
105
|
this.fetchCancelFns.forEach((cancel) => cancel(error));
|
|
101
106
|
this.fetchCancelFns.clear();
|
|
102
107
|
}
|
|
103
|
-
async mutate({ mutation, variables, optimisticResponse, updateQueries, refetchQueries = [], awaitRefetchQueries = false, update: updateWithProxyFn, onQueryUpdated, fetchPolicy
|
|
104
|
-
(0, invariant_1.invariant)(mutation, 82);
|
|
105
|
-
(0, internal_1.checkDocument)(mutation, graphql_1.OperationTypeNode.MUTATION);
|
|
106
|
-
(0, invariant_1.invariant)(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 83);
|
|
108
|
+
async mutate({ mutation, variables, optimisticResponse, updateQueries, refetchQueries = [], awaitRefetchQueries = false, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }) {
|
|
107
109
|
const queryInfo = new QueryInfo_js_1.QueryInfo(this);
|
|
108
110
|
mutation = this.cache.transformForLink(this.transform(mutation));
|
|
109
111
|
const { hasClientExports } = this.getDocumentInfo(mutation);
|
|
@@ -112,7 +114,7 @@ class QueryManager {
|
|
|
112
114
|
if (environment_1.__DEV__) {
|
|
113
115
|
(0, invariant_1.invariant)(
|
|
114
116
|
this.localState,
|
|
115
|
-
|
|
117
|
+
86,
|
|
116
118
|
(0, internal_1.getOperationName)(mutation, "(anonymous)")
|
|
117
119
|
);
|
|
118
120
|
}
|
|
@@ -151,21 +153,7 @@ class QueryManager {
|
|
|
151
153
|
optimisticResponse: isOptimistic ? optimisticResponse : void 0,
|
|
152
154
|
}, variables, {}, false)
|
|
153
155
|
.observable.pipe(validateDidEmitValue(), (0, rxjs_2.mergeMap)((result) => {
|
|
154
|
-
const hasErrors = (0, internal_1.graphQLResultHasError)(result);
|
|
155
|
-
if (hasErrors && errorPolicy === "none") {
|
|
156
|
-
throw new errors_1.CombinedGraphQLErrors(result);
|
|
157
|
-
}
|
|
158
|
-
if (mutationStoreValue) {
|
|
159
|
-
mutationStoreValue.loading = false;
|
|
160
|
-
mutationStoreValue.error = null;
|
|
161
|
-
}
|
|
162
156
|
const storeResult = { ...result };
|
|
163
|
-
if (typeof refetchQueries === "function") {
|
|
164
|
-
refetchQueries = refetchQueries(storeResult);
|
|
165
|
-
}
|
|
166
|
-
if (errorPolicy === "ignore" && hasErrors) {
|
|
167
|
-
delete storeResult.errors;
|
|
168
|
-
}
|
|
169
157
|
return (0, rxjs_2.from)(queryInfo.markMutationResult(storeResult, {
|
|
170
158
|
document: mutation,
|
|
171
159
|
variables,
|
|
@@ -182,6 +170,17 @@ class QueryManager {
|
|
|
182
170
|
onQueryUpdated,
|
|
183
171
|
keepRootFields,
|
|
184
172
|
}));
|
|
173
|
+
}))
|
|
174
|
+
.pipe((0, rxjs_2.map)((storeResult) => {
|
|
175
|
+
const hasErrors = (0, internal_1.graphQLResultHasError)(storeResult);
|
|
176
|
+
if (hasErrors && errorPolicy === "none") {
|
|
177
|
+
throw new errors_1.CombinedGraphQLErrors(storeResult);
|
|
178
|
+
}
|
|
179
|
+
if (mutationStoreValue) {
|
|
180
|
+
mutationStoreValue.loading = false;
|
|
181
|
+
mutationStoreValue.error = null;
|
|
182
|
+
}
|
|
183
|
+
return storeResult;
|
|
185
184
|
}))
|
|
186
185
|
.subscribe({
|
|
187
186
|
next: (storeResult) => {
|
|
@@ -191,7 +190,7 @@ class QueryManager {
|
|
|
191
190
|
// we resolve with a SingleExecutionResult or after the final
|
|
192
191
|
// ExecutionPatchResult has arrived and we have assembled the
|
|
193
192
|
// multipart response into a single result.
|
|
194
|
-
if (!
|
|
193
|
+
if (!queryInfo.hasNext) {
|
|
195
194
|
const result = {
|
|
196
195
|
data: this.maskOperation({
|
|
197
196
|
document: mutation,
|
|
@@ -203,7 +202,7 @@ class QueryManager {
|
|
|
203
202
|
if ((0, internal_1.graphQLResultHasError)(storeResult)) {
|
|
204
203
|
result.error = new errors_1.CombinedGraphQLErrors(storeResult);
|
|
205
204
|
}
|
|
206
|
-
if (storeResult.extensions) {
|
|
205
|
+
if (Object.keys(storeResult.extensions || {}).length) {
|
|
207
206
|
result.extensions = storeResult.extensions;
|
|
208
207
|
}
|
|
209
208
|
resolve(result);
|
|
@@ -230,7 +229,10 @@ class QueryManager {
|
|
|
230
229
|
});
|
|
231
230
|
}
|
|
232
231
|
fetchQuery(options, networkStatus) {
|
|
233
|
-
|
|
232
|
+
(0, internal_1.checkDocument)(options.query, graphql_1.OperationTypeNode.QUERY);
|
|
233
|
+
// do the rest asynchronously to keep the same rejection timing as
|
|
234
|
+
// checks further in `.mutate`
|
|
235
|
+
return (async () => (0, rxjs_2.lastValueFrom)(this.fetchObservableWithInfo(options, {
|
|
234
236
|
networkStatus,
|
|
235
237
|
}).observable.pipe((0, internal_1.filterMap)((value) => {
|
|
236
238
|
switch (value.kind) {
|
|
@@ -245,7 +247,7 @@ class QueryManager {
|
|
|
245
247
|
// This default is needed when a `standby` fetch policy is used to avoid
|
|
246
248
|
// an EmptyError from rejecting this promise.
|
|
247
249
|
defaultValue: { data: undefined },
|
|
248
|
-
});
|
|
250
|
+
}))();
|
|
249
251
|
}
|
|
250
252
|
transform(document) {
|
|
251
253
|
return this.documentTransform.transformDocument(document);
|
|
@@ -265,6 +267,7 @@ class QueryManager {
|
|
|
265
267
|
hasClientExports: (0, internal_1.hasDirectives)(["client", "export"], document, true),
|
|
266
268
|
hasForcedResolvers: (0, internal_1.hasForcedResolvers)(document),
|
|
267
269
|
hasNonreactiveDirective: (0, internal_1.hasDirectives)(["nonreactive"], document),
|
|
270
|
+
hasIncrementalDirective: (0, internal_1.hasDirectives)(["defer"], document),
|
|
268
271
|
nonReactiveQuery: addNonReactiveToNamedFragments(document),
|
|
269
272
|
clientQuery: (0, internal_1.hasDirectives)(["client"], document) ? document : null,
|
|
270
273
|
serverQuery: (0, internal_1.removeDirectivesFromDocument)([
|
|
@@ -290,7 +293,11 @@ class QueryManager {
|
|
|
290
293
|
};
|
|
291
294
|
transformCache.set(document, cacheEntry);
|
|
292
295
|
}
|
|
293
|
-
|
|
296
|
+
const entry = transformCache.get(document);
|
|
297
|
+
if (entry.violation) {
|
|
298
|
+
throw entry.violation;
|
|
299
|
+
}
|
|
300
|
+
return entry;
|
|
294
301
|
}
|
|
295
302
|
getVariables(document, variables) {
|
|
296
303
|
const defaultVars = this.getDocumentInfo(document).defaultVars;
|
|
@@ -320,7 +327,7 @@ class QueryManager {
|
|
|
320
327
|
});
|
|
321
328
|
return observable;
|
|
322
329
|
}
|
|
323
|
-
|
|
330
|
+
query(options) {
|
|
324
331
|
const query = this.transform(options.query);
|
|
325
332
|
return this.fetchQuery({
|
|
326
333
|
...options,
|
|
@@ -346,7 +353,7 @@ class QueryManager {
|
|
|
346
353
|
// depend on values that previously existed in the data portion of the
|
|
347
354
|
// store. So, we cancel the promises and observers that we have issued
|
|
348
355
|
// so far and not yet resolved (in the case of queries).
|
|
349
|
-
this.cancelPendingFetches((0, invariant_1.newInvariantError)(
|
|
356
|
+
this.cancelPendingFetches((0, invariant_1.newInvariantError)(87));
|
|
350
357
|
this.obsQueries.forEach((observableQuery) => {
|
|
351
358
|
// Set loading to true so listeners don't trigger unless they want
|
|
352
359
|
// results with partial data.
|
|
@@ -416,10 +423,10 @@ class QueryManager {
|
|
|
416
423
|
if (!included) {
|
|
417
424
|
const queryName = queryNames.get(nameOrQueryString);
|
|
418
425
|
if (queryName) {
|
|
419
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
426
|
+
__DEV__ && invariant_1.invariant.warn(88, queryName);
|
|
420
427
|
}
|
|
421
428
|
else {
|
|
422
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
429
|
+
__DEV__ && invariant_1.invariant.warn(89);
|
|
423
430
|
}
|
|
424
431
|
}
|
|
425
432
|
});
|
|
@@ -430,8 +437,8 @@ class QueryManager {
|
|
|
430
437
|
const observableQueryPromises = [];
|
|
431
438
|
this.getObservableQueries(includeStandby ? "all" : "active").forEach((observableQuery) => {
|
|
432
439
|
const { fetchPolicy } = observableQuery.options;
|
|
433
|
-
if (includeStandby ||
|
|
434
|
-
|
|
440
|
+
if ((includeStandby || fetchPolicy !== "standby") &&
|
|
441
|
+
fetchPolicy !== "cache-only") {
|
|
435
442
|
observableQueryPromises.push(observableQuery.refetch());
|
|
436
443
|
}
|
|
437
444
|
});
|
|
@@ -448,7 +455,7 @@ class QueryManager {
|
|
|
448
455
|
if (environment_1.__DEV__) {
|
|
449
456
|
(0, invariant_1.invariant)(
|
|
450
457
|
!this.getDocumentInfo(query).hasClientExports || this.localState,
|
|
451
|
-
|
|
458
|
+
90,
|
|
452
459
|
(0, internal_1.getOperationName)(query, "(anonymous)")
|
|
453
460
|
);
|
|
454
461
|
}
|
|
@@ -516,82 +523,92 @@ class QueryManager {
|
|
|
516
523
|
deduplication = context?.queryDeduplication ??
|
|
517
524
|
this.queryDeduplication) {
|
|
518
525
|
let entry = {};
|
|
519
|
-
const { serverQuery, clientQuery, operationType } = this.getDocumentInfo(query);
|
|
526
|
+
const { serverQuery, clientQuery, operationType, hasIncrementalDirective } = this.getDocumentInfo(query);
|
|
520
527
|
const operationName = (0, internal_1.getOperationName)(query);
|
|
521
528
|
const executeContext = {
|
|
522
529
|
client: this.client,
|
|
523
530
|
};
|
|
524
531
|
if (serverQuery) {
|
|
525
532
|
const { inFlightLinkObservables, link } = this;
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
};
|
|
538
|
-
context = operation.context;
|
|
539
|
-
function withRestart(source) {
|
|
540
|
-
return new rxjs_1.Observable((observer) => {
|
|
541
|
-
function subscribe() {
|
|
542
|
-
return source.subscribe({
|
|
543
|
-
next: observer.next.bind(observer),
|
|
544
|
-
complete: observer.complete.bind(observer),
|
|
545
|
-
error: observer.error.bind(observer),
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
|
-
let subscription = subscribe();
|
|
549
|
-
entry.restart ||= () => {
|
|
550
|
-
subscription.unsubscribe();
|
|
551
|
-
subscription = subscribe();
|
|
552
|
-
};
|
|
553
|
-
return () => {
|
|
554
|
-
subscription.unsubscribe();
|
|
555
|
-
entry.restart = undefined;
|
|
556
|
-
};
|
|
533
|
+
try {
|
|
534
|
+
const operation = this.incrementalHandler.prepareRequest({
|
|
535
|
+
query: serverQuery,
|
|
536
|
+
variables,
|
|
537
|
+
operationName,
|
|
538
|
+
context: {
|
|
539
|
+
...this.defaultContext,
|
|
540
|
+
...context,
|
|
541
|
+
queryDeduplication: deduplication,
|
|
542
|
+
},
|
|
543
|
+
extensions,
|
|
557
544
|
});
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
inFlightLinkObservables.remove(printedServerQuery, varJson);
|
|
545
|
+
context = operation.context;
|
|
546
|
+
function withRestart(source) {
|
|
547
|
+
return new rxjs_1.Observable((observer) => {
|
|
548
|
+
function subscribe() {
|
|
549
|
+
return source.subscribe({
|
|
550
|
+
next: observer.next.bind(observer),
|
|
551
|
+
complete: observer.complete.bind(observer),
|
|
552
|
+
error: observer.error.bind(observer),
|
|
553
|
+
});
|
|
568
554
|
}
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
555
|
+
let subscription = subscribe();
|
|
556
|
+
entry.restart ||= () => {
|
|
557
|
+
subscription.unsubscribe();
|
|
558
|
+
subscription = subscribe();
|
|
559
|
+
};
|
|
560
|
+
return () => {
|
|
561
|
+
subscription.unsubscribe();
|
|
562
|
+
entry.restart = undefined;
|
|
563
|
+
};
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
if (deduplication) {
|
|
567
|
+
const printedServerQuery = (0, utilities_1.print)(serverQuery);
|
|
568
|
+
const varJson = (0, cache_1.canonicalStringify)(variables);
|
|
569
|
+
entry = inFlightLinkObservables.lookup(printedServerQuery, varJson);
|
|
570
|
+
if (!entry.observable) {
|
|
571
|
+
entry.observable = (0, link_1.execute)(link, operation, executeContext).pipe(withRestart, (0, rxjs_2.finalize)(() => {
|
|
572
|
+
if (inFlightLinkObservables.peek(printedServerQuery, varJson) ===
|
|
573
|
+
entry) {
|
|
574
|
+
inFlightLinkObservables.remove(printedServerQuery, varJson);
|
|
575
|
+
}
|
|
576
|
+
}),
|
|
577
|
+
// We don't want to replay the last emitted value for
|
|
578
|
+
// subscriptions and instead opt to wait to receive updates until
|
|
579
|
+
// the subscription emits new values.
|
|
580
|
+
operationType === graphql_1.OperationTypeNode.SUBSCRIPTION ?
|
|
581
|
+
(0, rxjs_2.share)()
|
|
582
|
+
: (0, rxjs_2.shareReplay)({ refCount: true }));
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
entry.observable = (0, link_1.execute)(link, operation, executeContext).pipe(withRestart);
|
|
576
587
|
}
|
|
577
588
|
}
|
|
578
|
-
|
|
579
|
-
entry.observable = (0,
|
|
589
|
+
catch (error) {
|
|
590
|
+
entry.observable = (0, rxjs_1.throwError)(() => error);
|
|
580
591
|
}
|
|
581
592
|
}
|
|
582
593
|
else {
|
|
583
594
|
entry.observable = (0, rxjs_2.of)({ data: {} });
|
|
584
595
|
}
|
|
585
596
|
if (clientQuery) {
|
|
597
|
+
const { operation } = (0, internal_1.getOperationDefinition)(query);
|
|
586
598
|
if (environment_1.__DEV__) {
|
|
587
|
-
const { operation } = (0, internal_1.getOperationDefinition)(query);
|
|
588
599
|
(0, invariant_1.invariant)(
|
|
589
600
|
this.localState,
|
|
590
|
-
|
|
601
|
+
91,
|
|
591
602
|
operation[0].toUpperCase() + operation.slice(1),
|
|
592
603
|
operationName ?? "(anonymous)"
|
|
593
604
|
);
|
|
594
605
|
}
|
|
606
|
+
(0, invariant_1.invariant)(
|
|
607
|
+
!hasIncrementalDirective,
|
|
608
|
+
92,
|
|
609
|
+
operation[0].toUpperCase() + operation.slice(1),
|
|
610
|
+
operationName ?? "(anonymous)"
|
|
611
|
+
);
|
|
595
612
|
entry.observable = entry.observable.pipe((0, rxjs_2.mergeMap)((result) => {
|
|
596
613
|
return (0, rxjs_2.from)(this.localState.execute({
|
|
597
614
|
client: this.client,
|
|
@@ -618,30 +635,24 @@ class QueryManager {
|
|
|
618
635
|
// missing fragment definitions (for example) before sending this document
|
|
619
636
|
// through the link chain.
|
|
620
637
|
const linkDocument = this.cache.transformForLink(options.query);
|
|
621
|
-
return this.getObservableFromLink(linkDocument, options.context, options.variables).observable.pipe((0, rxjs_2.map)((
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
//
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
// ones used to obtain it from the link.
|
|
636
|
-
queryInfo.markQueryResult(result, {
|
|
637
|
-
...options,
|
|
638
|
-
document: linkDocument,
|
|
639
|
-
cacheWriteBehavior,
|
|
640
|
-
});
|
|
638
|
+
return this.getObservableFromLink(linkDocument, options.context, options.variables).observable.pipe((0, rxjs_2.map)((incoming) => {
|
|
639
|
+
// Use linkDocument rather than queryInfo.document so the
|
|
640
|
+
// operation/fragments used to write the result are the same as the
|
|
641
|
+
// ones used to obtain it from the link.
|
|
642
|
+
const result = queryInfo.markQueryResult(incoming, {
|
|
643
|
+
...options,
|
|
644
|
+
document: linkDocument,
|
|
645
|
+
cacheWriteBehavior,
|
|
646
|
+
});
|
|
647
|
+
const hasErrors = (0, internal_1.graphQLResultHasError)(result);
|
|
648
|
+
if (hasErrors && errorPolicy === "none") {
|
|
649
|
+
queryInfo.resetLastWrite();
|
|
650
|
+
observableQuery?.["resetNotifications"]();
|
|
651
|
+
throw new errors_1.CombinedGraphQLErrors(result);
|
|
641
652
|
}
|
|
642
653
|
const aqr = {
|
|
643
654
|
data: result.data,
|
|
644
|
-
...(
|
|
655
|
+
...(queryInfo.hasNext ?
|
|
645
656
|
{
|
|
646
657
|
loading: true,
|
|
647
658
|
networkStatus: networkStatus_js_1.NetworkStatus.streaming,
|
|
@@ -659,15 +670,16 @@ class QueryManager {
|
|
|
659
670
|
// want to ensure we properly set `data` if we're reporting on an old
|
|
660
671
|
// result which will not be caught by the conditional above that ends up
|
|
661
672
|
// throwing the markError result.
|
|
662
|
-
if (hasErrors
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
673
|
+
if (hasErrors) {
|
|
674
|
+
if (errorPolicy === "none") {
|
|
675
|
+
aqr.data = void 0;
|
|
676
|
+
aqr.dataState = "empty";
|
|
677
|
+
}
|
|
678
|
+
if (errorPolicy !== "ignore") {
|
|
679
|
+
aqr.error = new errors_1.CombinedGraphQLErrors(result);
|
|
680
|
+
if (aqr.dataState !== "streaming") {
|
|
681
|
+
aqr.networkStatus = networkStatus_js_1.NetworkStatus.error;
|
|
682
|
+
}
|
|
671
683
|
}
|
|
672
684
|
}
|
|
673
685
|
return aqr;
|
|
@@ -762,7 +774,7 @@ class QueryManager {
|
|
|
762
774
|
if (environment_1.__DEV__) {
|
|
763
775
|
(0, invariant_1.invariant)(
|
|
764
776
|
this.localState,
|
|
765
|
-
|
|
777
|
+
93,
|
|
766
778
|
(0, internal_1.getOperationName)(normalized.query, "(anonymous)")
|
|
767
779
|
);
|
|
768
780
|
}
|
|
@@ -799,6 +811,9 @@ class QueryManager {
|
|
|
799
811
|
const includedQueriesByOq = new Map();
|
|
800
812
|
if (include) {
|
|
801
813
|
this.getObservableQueries(include).forEach((oq) => {
|
|
814
|
+
if (oq.options.fetchPolicy === "cache-only") {
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
802
817
|
const current = oq.getCurrentResult();
|
|
803
818
|
includedQueriesByOq.set(oq, {
|
|
804
819
|
oq,
|
|
@@ -878,7 +893,8 @@ class QueryManager {
|
|
|
878
893
|
// onQueryUpdated returns false.
|
|
879
894
|
return result;
|
|
880
895
|
}
|
|
881
|
-
if (onQueryUpdated !== null
|
|
896
|
+
if (onQueryUpdated !== null &&
|
|
897
|
+
oq.options.fetchPolicy !== "cache-only") {
|
|
882
898
|
// If we don't have an onQueryUpdated function, and onQueryUpdated
|
|
883
899
|
// was not disabled by passing null, make sure this query is
|
|
884
900
|
// "included" like any other options.include-specified query.
|
|
@@ -934,7 +950,7 @@ class QueryManager {
|
|
|
934
950
|
!this.noCacheWarningsByCause.has(cause)) {
|
|
935
951
|
this.noCacheWarningsByCause.add(cause);
|
|
936
952
|
__DEV__ && invariant_1.invariant.warn(
|
|
937
|
-
|
|
953
|
+
94,
|
|
938
954
|
(0, internal_1.getOperationName)(document, `Unnamed ${operationType ?? "operation"}`)
|
|
939
955
|
);
|
|
940
956
|
}
|
|
@@ -996,7 +1012,7 @@ class QueryManager {
|
|
|
996
1012
|
if (environment_1.__DEV__) {
|
|
997
1013
|
(0, invariant_1.invariant)(
|
|
998
1014
|
this.localState,
|
|
999
|
-
|
|
1015
|
+
95,
|
|
1000
1016
|
(0, internal_1.getOperationName)(query, "(anonymous)")
|
|
1001
1017
|
);
|
|
1002
1018
|
}
|
|
@@ -1090,7 +1106,7 @@ function validateDidEmitValue() {
|
|
|
1090
1106
|
didEmitValue = true;
|
|
1091
1107
|
},
|
|
1092
1108
|
complete() {
|
|
1093
|
-
(0, invariant_1.invariant)(didEmitValue,
|
|
1109
|
+
(0, invariant_1.invariant)(didEmitValue, 96);
|
|
1094
1110
|
},
|
|
1095
1111
|
});
|
|
1096
1112
|
}
|
|
@@ -1109,7 +1125,6 @@ function isFullyUnmaskedOperation(document) {
|
|
|
1109
1125
|
return isUnmasked;
|
|
1110
1126
|
}
|
|
1111
1127
|
function addNonReactiveToNamedFragments(document) {
|
|
1112
|
-
(0, internal_1.checkDocument)(document);
|
|
1113
1128
|
return (0, graphql_1.visit)(document, {
|
|
1114
1129
|
FragmentSpread: (node) => {
|
|
1115
1130
|
// Do not add `@nonreactive` if the fragment is marked with `@unmask`
|