@apollo/client 4.0.0-rc.6 → 4.0.0-rc.8
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 +159 -0
- package/__cjs/cache/core/cache.cjs +12 -7
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +12 -7
- package/__cjs/core/ApolloClient.cjs +2 -2
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +80 -98
- package/__cjs/core/ObservableQuery.d.cts +41 -74
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +3 -3
- package/__cjs/core/QueryManager.cjs +0 -2
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/QueryManager.d.cts +3 -3
- package/__cjs/core/index.cjs +1 -2
- package/__cjs/core/index.cjs.map +1 -1
- package/__cjs/core/index.d.cts +2 -3
- package/__cjs/core/types.d.cts +40 -28
- package/__cjs/errors/CombinedGraphQLErrors.cjs +22 -17
- package/__cjs/errors/CombinedGraphQLErrors.cjs.map +1 -1
- package/__cjs/errors/CombinedGraphQLErrors.d.cts +39 -20
- package/__cjs/errors/CombinedProtocolErrors.cjs +12 -6
- package/__cjs/errors/CombinedProtocolErrors.cjs.map +1 -1
- package/__cjs/errors/CombinedProtocolErrors.d.cts +12 -6
- package/__cjs/errors/ServerError.cjs +2 -1
- package/__cjs/errors/ServerError.cjs.map +1 -1
- package/__cjs/errors/ServerError.d.cts +2 -1
- package/__cjs/errors/ServerParseError.cjs +2 -1
- package/__cjs/errors/ServerParseError.cjs.map +1 -1
- package/__cjs/errors/ServerParseError.d.cts +2 -1
- package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -1
- package/__cjs/incremental/handlers/defer20220824.d.cts +4 -4
- package/__cjs/incremental/handlers/notImplemented.cjs.map +1 -1
- package/__cjs/incremental/handlers/notImplemented.d.cts +2 -2
- package/__cjs/incremental/types.d.cts +4 -4
- package/__cjs/invariantErrorCodes.cjs +15 -11
- package/__cjs/link/batch/batchLink.cjs +4 -12
- package/__cjs/link/batch/batchLink.cjs.map +1 -1
- package/__cjs/link/batch/batchLink.d.cts +36 -28
- package/__cjs/link/batch/batching.cjs +1 -1
- package/__cjs/link/batch/batching.cjs.map +1 -1
- package/__cjs/link/batch/batching.d.cts +8 -8
- package/__cjs/link/batch/index.cjs +1 -2
- package/__cjs/link/batch/index.cjs.map +1 -1
- package/__cjs/link/batch/index.d.cts +1 -2
- package/__cjs/link/batch-http/batchHttpLink.cjs +29 -6
- package/__cjs/link/batch-http/batchHttpLink.cjs.map +1 -1
- package/__cjs/link/batch-http/batchHttpLink.d.cts +45 -6
- package/__cjs/link/client-awareness/ClientAwarenessLink.cjs +33 -0
- package/__cjs/link/client-awareness/ClientAwarenessLink.cjs.map +1 -1
- package/__cjs/link/client-awareness/ClientAwarenessLink.d.cts +35 -2
- package/__cjs/link/context/index.cjs.map +1 -1
- package/__cjs/link/context/index.d.cts +3 -4
- package/__cjs/link/core/ApolloLink.cjs +226 -54
- package/__cjs/link/core/ApolloLink.cjs.map +1 -1
- package/__cjs/link/core/ApolloLink.d.cts +355 -9
- package/__cjs/link/core/concat.cjs +4 -0
- package/__cjs/link/core/concat.cjs.map +1 -1
- package/__cjs/link/core/concat.d.cts +4 -0
- package/__cjs/link/core/deprecated.cjs +3 -0
- package/__cjs/link/core/deprecated.cjs.map +1 -0
- package/__cjs/link/core/deprecated.d.cts +10 -0
- package/__cjs/link/core/empty.cjs +4 -0
- package/__cjs/link/core/empty.cjs.map +1 -1
- package/__cjs/link/core/empty.d.cts +4 -0
- package/__cjs/link/core/from.cjs +4 -0
- package/__cjs/link/core/from.cjs.map +1 -1
- package/__cjs/link/core/from.d.cts +4 -0
- package/__cjs/link/core/split.cjs +4 -0
- package/__cjs/link/core/split.cjs.map +1 -1
- package/__cjs/link/core/split.d.cts +4 -0
- package/__cjs/link/core/types.d.cts +2 -33
- package/__cjs/link/error/index.cjs +44 -0
- package/__cjs/link/error/index.cjs.map +1 -1
- package/__cjs/link/error/index.d.cts +68 -9
- package/__cjs/link/http/BaseHttpLink.cjs +3 -4
- package/__cjs/link/http/BaseHttpLink.cjs.map +1 -1
- package/__cjs/link/http/HttpLink.cjs +26 -1
- package/__cjs/link/http/HttpLink.cjs.map +1 -1
- package/__cjs/link/http/HttpLink.d.cts +191 -89
- package/__cjs/link/http/index.cjs +1 -3
- package/__cjs/link/http/index.cjs.map +1 -1
- package/__cjs/link/http/index.d.cts +0 -2
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs +40 -25
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +1 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.d.cts +2 -2
- package/__cjs/link/http/rewriteURIForGET.cjs +2 -3
- package/__cjs/link/http/rewriteURIForGET.cjs.map +1 -1
- package/__cjs/link/http/selectHttpOptionsAndBody.cjs.map +1 -1
- package/__cjs/link/http/selectHttpOptionsAndBody.d.cts +3 -3
- package/__cjs/link/http/selectURI.cjs.map +1 -1
- package/__cjs/link/http/selectURI.d.cts +2 -2
- package/__cjs/link/index.cjs.map +1 -1
- package/__cjs/link/index.d.cts +2 -1
- package/__cjs/link/persisted-queries/index.cjs.map +1 -1
- package/__cjs/link/persisted-queries/index.d.cts +23 -25
- package/__cjs/link/remove-typename/index.cjs.map +1 -1
- package/__cjs/link/remove-typename/index.d.cts +0 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.d.cts +9 -8
- package/__cjs/link/retry/delayFunction.cjs.map +1 -1
- package/__cjs/link/retry/delayFunction.d.cts +2 -39
- package/__cjs/link/retry/retryFunction.cjs.map +1 -1
- package/__cjs/link/retry/retryFunction.d.cts +2 -29
- package/__cjs/link/retry/retryLink.cjs +12 -9
- package/__cjs/link/retry/retryLink.cjs.map +1 -1
- package/__cjs/link/retry/retryLink.d.cts +57 -6
- package/__cjs/link/schema/index.cjs.map +1 -1
- package/__cjs/link/schema/index.d.cts +3 -4
- package/__cjs/link/subscriptions/index.cjs +23 -0
- package/__cjs/link/subscriptions/index.cjs.map +1 -1
- package/__cjs/link/subscriptions/index.d.cts +24 -2
- package/__cjs/link/utils/createOperation.cjs +12 -4
- package/__cjs/link/utils/createOperation.cjs.map +1 -1
- package/__cjs/link/utils/createOperation.d.cts +2 -2
- package/__cjs/link/utils/index.cjs +1 -5
- package/__cjs/link/utils/index.cjs.map +1 -1
- package/__cjs/link/utils/index.d.cts +0 -2
- package/__cjs/link/ws/index.cjs +17 -1
- package/__cjs/link/ws/index.cjs.map +1 -1
- package/__cjs/link/ws/index.d.cts +8 -2
- package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useBackgroundQuery.d.cts +125 -93
- package/__cjs/react/hooks/useFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useFragment.d.cts +2 -2
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.d.cts +70 -108
- package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLoadableQuery.d.cts +52 -61
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.d.cts +36 -54
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +64 -105
- package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
- package/__cjs/react/hooks/useQueryRefHandlers.d.cts +17 -8
- package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useReadQuery.d.cts +6 -9
- package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
- package/__cjs/react/hooks/useSubscription.d.cts +32 -24
- package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.d.cts +75 -94
- package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/QueryReference.d.cts +3 -1
- package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
- package/__cjs/react/query-preloader/createQueryPreloader.d.cts +29 -20
- package/__cjs/react/types/types.documentation.d.cts +5 -5
- package/__cjs/testing/core/mocking/mockLink.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockLink.d.cts +5 -6
- package/__cjs/testing/core/mocking/mockSubscriptionLink.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockSubscriptionLink.d.cts +3 -4
- package/__cjs/utilities/internal/types/DocumentationTypes.d.cts +20 -28
- package/__cjs/utilities/internal/types/VariablesOption.d.cts +2 -6
- package/__cjs/utilities/subscriptions/relay/index.cjs +1 -2
- package/__cjs/utilities/subscriptions/relay/index.cjs.map +1 -1
- package/__cjs/version.cjs +1 -1
- package/cache/core/cache.d.ts +12 -7
- package/cache/core/cache.js +12 -7
- package/cache/core/cache.js.map +1 -1
- package/core/ApolloClient.d.ts +80 -98
- package/core/ApolloClient.js +2 -2
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +41 -74
- package/core/QueryInfo.d.ts +3 -3
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +3 -3
- package/core/QueryManager.js +0 -2
- package/core/QueryManager.js.map +1 -1
- package/core/index.d.ts +2 -3
- package/core/index.js +1 -1
- package/core/index.js.map +1 -1
- package/core/types.d.ts +40 -28
- package/errors/CombinedGraphQLErrors.d.ts +39 -20
- package/errors/CombinedGraphQLErrors.js +22 -17
- package/errors/CombinedGraphQLErrors.js.map +1 -1
- package/errors/CombinedProtocolErrors.d.ts +12 -6
- package/errors/CombinedProtocolErrors.js +12 -6
- package/errors/CombinedProtocolErrors.js.map +1 -1
- package/errors/ServerError.d.ts +2 -1
- package/errors/ServerError.js +2 -1
- package/errors/ServerError.js.map +1 -1
- package/errors/ServerParseError.d.ts +2 -1
- package/errors/ServerParseError.js +2 -1
- package/errors/ServerParseError.js.map +1 -1
- package/incremental/handlers/defer20220824.d.ts +4 -4
- package/incremental/handlers/defer20220824.js.map +1 -1
- package/incremental/handlers/notImplemented.d.ts +2 -2
- package/incremental/handlers/notImplemented.js.map +1 -1
- package/incremental/types.d.ts +4 -4
- package/incremental/types.js.map +1 -1
- package/invariantErrorCodes.js +15 -11
- package/link/batch/batchLink.d.ts +37 -29
- package/link/batch/batchLink.js +3 -10
- package/link/batch/batchLink.js.map +1 -1
- package/link/batch/batching.d.ts +8 -8
- package/link/batch/batching.js +2 -2
- package/link/batch/batching.js.map +1 -1
- package/link/batch/index.d.ts +1 -2
- package/link/batch/index.js +1 -1
- package/link/batch/index.js.map +1 -1
- package/link/batch-http/batchHttpLink.d.ts +46 -7
- package/link/batch-http/batchHttpLink.js +30 -7
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/client-awareness/ClientAwarenessLink.d.ts +35 -2
- package/link/client-awareness/ClientAwarenessLink.js +33 -0
- package/link/client-awareness/ClientAwarenessLink.js.map +1 -1
- package/link/context/index.d.ts +3 -4
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.d.ts +355 -9
- package/link/core/ApolloLink.js +227 -56
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/concat.d.ts +4 -0
- package/link/core/concat.js +4 -0
- package/link/core/concat.js.map +1 -1
- package/link/core/deprecated.d.ts +10 -0
- package/link/core/deprecated.js +2 -0
- package/link/core/deprecated.js.map +1 -0
- package/link/core/empty.d.ts +4 -0
- package/link/core/empty.js +4 -0
- package/link/core/empty.js.map +1 -1
- package/link/core/from.d.ts +4 -0
- package/link/core/from.js +4 -0
- package/link/core/from.js.map +1 -1
- package/link/core/split.d.ts +4 -0
- package/link/core/split.js +4 -0
- package/link/core/split.js.map +1 -1
- package/link/core/types.d.ts +2 -33
- package/link/core/types.js.map +1 -1
- package/link/error/index.d.ts +69 -10
- package/link/error/index.js +44 -0
- package/link/error/index.js.map +1 -1
- package/link/http/BaseHttpLink.js +3 -4
- package/link/http/BaseHttpLink.js.map +1 -1
- package/link/http/HttpLink.d.ts +192 -90
- package/link/http/HttpLink.js +26 -1
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/index.d.ts +0 -2
- package/link/http/index.js +0 -1
- package/link/http/index.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.d.ts +2 -2
- package/link/http/parseAndCheckHttpResponse.js +40 -25
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/rewriteURIForGET.js +2 -3
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +3 -3
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/selectURI.d.ts +2 -2
- package/link/http/selectURI.js.map +1 -1
- package/link/index.d.ts +2 -1
- package/link/index.js.map +1 -1
- package/link/persisted-queries/index.d.ts +23 -25
- package/link/persisted-queries/index.js.map +1 -1
- package/link/remove-typename/index.d.ts +0 -1
- package/link/remove-typename/index.js.map +1 -1
- package/link/remove-typename/removeTypenameFromVariables.d.ts +9 -8
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
- package/link/retry/delayFunction.d.ts +2 -39
- package/link/retry/delayFunction.js.map +1 -1
- package/link/retry/retryFunction.d.ts +2 -29
- package/link/retry/retryFunction.js.map +1 -1
- package/link/retry/retryLink.d.ts +57 -6
- package/link/retry/retryLink.js +13 -10
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +3 -4
- package/link/schema/index.js.map +1 -1
- package/link/subscriptions/index.d.ts +24 -2
- package/link/subscriptions/index.js +23 -0
- package/link/subscriptions/index.js.map +1 -1
- package/link/utils/createOperation.d.ts +2 -2
- package/link/utils/createOperation.js +12 -4
- package/link/utils/createOperation.js.map +1 -1
- package/link/utils/index.d.ts +0 -2
- package/link/utils/index.js +0 -2
- package/link/utils/index.js.map +1 -1
- package/link/ws/index.d.ts +8 -2
- package/link/ws/index.js +13 -1
- package/link/ws/index.js.map +1 -1
- package/package.json +1 -1
- package/react/hooks/useBackgroundQuery.d.ts +125 -93
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.d.ts +2 -2
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +70 -108
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.d.ts +52 -61
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +36 -54
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +64 -105
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useQueryRefHandlers.d.ts +17 -8
- package/react/hooks/useQueryRefHandlers.js.map +1 -1
- package/react/hooks/useReadQuery.d.ts +6 -9
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +32 -24
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseFragment.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +75 -94
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks-compiled/useBackgroundQuery.d.ts +125 -93
- package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
- package/react/hooks-compiled/useFragment.d.ts +2 -2
- package/react/hooks-compiled/useFragment.js.map +1 -1
- package/react/hooks-compiled/useLazyQuery.d.ts +70 -108
- package/react/hooks-compiled/useLazyQuery.js.map +1 -1
- package/react/hooks-compiled/useLoadableQuery.d.ts +52 -61
- package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
- package/react/hooks-compiled/useMutation.d.ts +36 -54
- package/react/hooks-compiled/useMutation.js.map +1 -1
- package/react/hooks-compiled/useQuery.d.ts +64 -105
- package/react/hooks-compiled/useQuery.js.map +1 -1
- package/react/hooks-compiled/useQueryRefHandlers.d.ts +17 -8
- package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
- package/react/hooks-compiled/useReadQuery.d.ts +6 -9
- package/react/hooks-compiled/useReadQuery.js.map +1 -1
- package/react/hooks-compiled/useSubscription.d.ts +32 -24
- package/react/hooks-compiled/useSubscription.js.map +1 -1
- package/react/hooks-compiled/useSuspenseFragment.js.map +1 -1
- package/react/hooks-compiled/useSuspenseQuery.d.ts +75 -94
- package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
- package/react/internal/cache/QueryReference.d.ts +3 -1
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/query-preloader/createQueryPreloader.d.ts +29 -20
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/types/types.documentation.d.ts +5 -5
- package/testing/core/mocking/mockLink.d.ts +5 -6
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +3 -4
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
- package/utilities/internal/types/DocumentationTypes.d.ts +20 -28
- package/utilities/internal/types/VariablesOption.d.ts +2 -6
- package/utilities/subscriptions/relay/index.js +1 -2
- package/utilities/subscriptions/relay/index.js.map +1 -1
- package/version.js +1 -1
- package/__cjs/link/http/serializeFetchParameter.cjs +0 -18
- package/__cjs/link/http/serializeFetchParameter.cjs.map +0 -1
- package/__cjs/link/http/serializeFetchParameter.d.cts +0 -6
- package/__cjs/link/utils/transformOperation.cjs +0 -22
- package/__cjs/link/utils/transformOperation.cjs.map +0 -1
- package/__cjs/link/utils/transformOperation.d.cts +0 -3
- package/__cjs/link/utils/validateOperation.cjs +0 -21
- package/__cjs/link/utils/validateOperation.cjs.map +0 -1
- package/__cjs/link/utils/validateOperation.d.cts +0 -3
- package/link/http/serializeFetchParameter.d.ts +0 -6
- package/link/http/serializeFetchParameter.js +0 -14
- package/link/http/serializeFetchParameter.js.map +0 -1
- package/link/utils/transformOperation.d.ts +0 -3
- package/link/utils/transformOperation.js +0 -19
- package/link/utils/transformOperation.js.map +0 -1
- package/link/utils/validateOperation.d.ts +0 -3
- package/link/utils/validateOperation.js +0 -18
- package/link/utils/validateOperation.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CombinedProtocolErrors.cjs","sources":["../../../src/errors/CombinedProtocolErrors.ts"],"sourcesContent":["import type { GraphQLFormattedError } from \"graphql\";\n\nimport { brand, isBranded } from \"./utils.js\";\n\nexport declare namespace CombinedProtocolErrors {\n export interface MessageFormatterOptions {\n /**\n * The default message formatter. Call this to get a string with the default\n * formatted message.\n *\n * @remarks\n * To format part of the message using the default message formatter, call\n * the `defaultFormatMessage` function provided to the `options` argument of\n * your message formatter.\n *\n * @example\n *\n * The following example prepends a string to the message and uses the\n * default message formatter to format the error messages.\n *\n * ```ts\n * CombinedProtocolErrors.formatMessage = (errors, { defaultFormatMessage }) => {\n * return `[Protocol errors]: ${defaultFormatMessage(errors)}`;\n * };\n * ```\n */\n defaultFormatMessage: (\n errors: ReadonlyArray<GraphQLFormattedError>\n ) => string;\n }\n\n /**\n * By default, `CombinedProtocolErrors` formats the `message` property by\n * joining each error's `message` field with a newline. To customize the\n * format of the `message`, such as changing the delimiter or adding a message\n * prefix, override the static `formatMessage` method.\n *\n * @remarks\n *\n * See the [`formatMessage`](https://www.apollographql.com/docs/react/api/errors/CombinedProtocolErrors) section for details about the parameters provided to the `formatMessage` function.\n *\n * > [!NOTE]\n * > The message formatter needs to be configured before any operation is executed by Apollo Client, otherwise the default message formatter is used. We recommend configuring the message formatter before initializing your `ApolloClient` instance.\n *\n * @example\n *\n * The following example demonstrates how to format the error message by\n * joining each error with a comma.\n *\n * ```ts\n * import { CombinedProtocolErrors } from \"@apollo/client/errors\";\n *\n * CombinedProtocolErrors.formatMessage = (errors) => {\n * return errors.map((error) => error.message).join(\", \");\n * };\n * ```\n *\n * @param errors - The array of GraphQL errors returned from the server in the\n * `errors` field of the response.\n * @param options - Additional context that could be useful when formatting\n * the message.\n */\n export type MessageFormatter = (\n errors: ReadonlyArray<GraphQLFormattedError>,\n options: MessageFormatterOptions\n ) => string;\n\n namespace DocumentationTypes {\n /**\n * A function that formats the error message used for the error's `message`\n * property. Override this method to provide your own formatting.\n *\n * @remarks\n *\n * The `formatMessage` function is called by the `CombinedProtocolErrors`\n * constructor to provide a formatted message as the `message` property of the\n * `CombinedProtocolErrors` object. Follow the [\"Providing a custom message\n * formatter\"](https://www.apollographql.com/docs/react/api/errors/CombinedProtocolErrors#providing-a-custom-message-formatter) guide to learn how to modify the message format.\n *\n * @param errors - The array of GraphQL errors returned from the server in the\n * `errors` field of the response.\n * @param options - Additional context that could be useful when formatting\n * the message.\n */\n function formatMessage(\n errors: ReadonlyArray<GraphQLFormattedError>,\n options: MessageFormatterOptions\n ): string;\n\n interface InstanceProperties {\n /**\n * The raw list of errors returned by the top-level `errors` field in the\n * multipart HTTP subscription response.\n */\n readonly errors: ReadonlyArray<GraphQLFormattedError>;\n }\n }\n}\n\nfunction defaultFormatMessage(errors: ReadonlyArray<GraphQLFormattedError>) {\n return errors.map((e) => e.message || \"Error message not found.\").join(\"\\n\");\n}\n\n/**\n * Fatal transport-level errors returned when executing a subscription using the\n * multipart HTTP subscription protocol. See the documentation on the\n * [multipart HTTP protocol for GraphQL Subscriptions](https://www.apollographql.com/docs/graphos/routing/operations/subscriptions/multipart-protocol) for more information on these errors.\n *\n * @remarks\n *\n * These errors indicate issues with the subscription transport itself, rather\n * than GraphQL-level errors. They typically occur when there are problems\n * communicating with subgraphs from the Apollo Router.\n *\n * @example\n *\n * ```ts\n * import { CombinedProtocolErrors } from \"@apollo/client/errors\";\n *\n * // Check if an error is a CombinedProtocolErrors instance\n * if (CombinedProtocolErrors.is(error)) {\n * // Access individual protocol errors\n * error.errors.forEach((protocolError) => {\n * console.log(protocolError.message);\n * console.log(protocolError.extensions);\n * });\n * }\n * ```\n */\nexport class CombinedProtocolErrors extends Error {\n /**\n * A method that determines whether an error is a `CombinedProtocolErrors`\n * object. This method enables TypeScript to narrow the error type.\n *\n * @example\n *\n * ```ts\n * if (CombinedProtocolErrors.is(error)) {\n * // TypeScript now knows `error` is a CombinedProtocolErrors object\n * console.log(error.errors);\n * }\n * ```\n */\n static is(error: unknown): error is CombinedProtocolErrors {\n return isBranded(error, \"CombinedProtocolErrors\");\n }\n\n /** {@inheritDoc @apollo/client!CombinedProtocolErrors.DocumentationTypes.formatMessage:function(1)} */\n static formatMessage: CombinedProtocolErrors.MessageFormatter =\n defaultFormatMessage;\n\n /** {@inheritDoc @apollo/client!CombinedProtocolErrors.DocumentationTypes.InstanceProperties#errors:member} */\n readonly errors: ReadonlyArray<GraphQLFormattedError>;\n\n constructor(\n protocolErrors:\n | Array<GraphQLFormattedError>\n | ReadonlyArray<GraphQLFormattedError>\n ) {\n super(\n CombinedProtocolErrors.formatMessage(protocolErrors, {\n defaultFormatMessage,\n })\n );\n this.name = \"CombinedProtocolErrors\";\n this.errors = protocolErrors;\n\n brand(this);\n Object.setPrototypeOf(this, CombinedProtocolErrors.prototype);\n }\n}\n"],"names":[],"mappings":";;;AAEA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAiGA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6B,CAAC,CAA9B,CAAA,CAAA,CAAA,CAAA,CAA0E,EAA1E;IACE,CAAF,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAe,CAAC,CAAhB,CAAA,CAAmB,CAAC,CAAC,CAAC,EAAE,CAAxB,EAA2B,CAAC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ql\";\n\nimport { brand, isBranded } from \"./utils.js\";\n\nexport declare namespace CombinedProtocolErrors {\n export interface MessageFormatterOptions {\n /**\n * The default message formatter. Call this to get a string with the default\n * formatted message.\n *\n * @remarks\n * To format part of the message using the default message formatter, call\n * the `defaultFormatMessage` function provided to the `options` argument of\n * your message formatter.\n *\n * @example\n *\n * The following example prepends a string to the message and uses the\n * default message formatter to format the error messages.\n *\n * ```ts\n * CombinedProtocolErrors.formatMessage = (errors, { defaultFormatMessage }) => {\n * return `[Protocol errors]: ${defaultFormatMessage(errors)}`;\n * };\n * ```\n */\n defaultFormatMessage: (\n errors: ReadonlyArray<GraphQLFormattedError>\n ) => string;\n }\n\n /**\n * By default, `CombinedProtocolErrors` formats the `message` property by\n * joining each error's `message` field with a newline. To customize the\n * format of the `message`, such as changing the delimiter or adding a message\n * prefix, override the static `formatMessage` method.\n *\n * @remarks\n *\n * See the [`formatMessage`](https://www.apollographql.com/docs/react/api/errors/CombinedProtocolErrors) section for details about the parameters provided to the `formatMessage` function.\n *\n * > [!NOTE]\n * > The message formatter needs to be configured before any operation is executed by Apollo Client, otherwise the default message formatter is used. We recommend configuring the message formatter before initializing your `ApolloClient` instance.\n *\n * @example\n *\n * The following example demonstrates how to format the error message by\n * joining each error with a comma.\n *\n * ```ts\n * import { CombinedProtocolErrors } from \"@apollo/client/errors\";\n *\n * CombinedProtocolErrors.formatMessage = (errors) => {\n * return errors.map((error) => error.message).join(\", \");\n * };\n * ```\n *\n * @param errors - The array of GraphQL errors returned from the server in the\n * `errors` field of the response.\n * @param options - Additional context that could be useful when formatting\n * the message.\n */\n export type MessageFormatter = (\n errors: ReadonlyArray<GraphQLFormattedError>,\n options: MessageFormatterOptions\n ) => string;\n\n namespace DocumentationTypes {\n /**\n * A function that formats the error message used for the error's `message`\n * property. Override this method to provide your own formatting.\n *\n * @remarks\n *\n * The `formatMessage` function is called by the `CombinedProtocolErrors`\n * constructor to provide a formatted message as the `message` property of the\n * `CombinedProtocolErrors` object. Follow the [\"Providing a custom message\n * formatter\"](https://www.apollographql.com/docs/react/api/errors/CombinedProtocolErrors#providing-a-custom-message-formatter) guide to learn how to modify the message format.\n *\n * @param errors - The array of GraphQL errors returned from the server in the\n * `errors` field of the response.\n * @param options - Additional context that could be useful when formatting\n * the message.\n */\n function formatMessage(\n errors: ReadonlyArray<GraphQLFormattedError>,\n options: MessageFormatterOptions\n ): string;\n\n interface InstanceProperties {\n /**\n * The raw list of errors returned by the top-level `errors` field in the\n * multipart HTTP subscription response.\n */\n readonly errors: ReadonlyArray<GraphQLFormattedError>;\n }\n }\n}\n\nfunction defaultFormatMessage(errors: ReadonlyArray<GraphQLFormattedError>) {\n return errors.map((e) => e.message || \"Error message not found.\").join(\"\\n\");\n}\n\n/**\n * Fatal transport-level errors returned when executing a subscription using the\n * multipart HTTP subscription protocol. See the documentation on the\n * [multipart HTTP protocol for GraphQL Subscriptions](https://www.apollographql.com/docs/graphos/routing/operations/subscriptions/multipart-protocol) for more information on these errors.\n *\n * @remarks\n *\n * These errors indicate issues with the subscription transport itself, rather\n * than GraphQL-level errors. They typically occur when there are problems\n * communicating with subgraphs from the Apollo Router.\n *\n * @example\n *\n * ```ts\n * import { CombinedProtocolErrors } from \"@apollo/client/errors\";\n *\n * // Check if an error is a CombinedProtocolErrors instance\n * if (CombinedProtocolErrors.is(error)) {\n * // Access individual protocol errors\n * error.errors.forEach((protocolError) => {\n * console.log(protocolError.message);\n * console.log(protocolError.extensions);\n * });\n * }\n * ```\n */\nexport class CombinedProtocolErrors extends Error {\n /**\n * A method that determines whether an error is a `CombinedProtocolErrors`\n * object. This method enables TypeScript to narrow the error type.\n *\n * @example\n *\n * ```ts\n * if (CombinedProtocolErrors.is(error)) {\n * // TypeScript now knows `error` is a CombinedProtocolErrors object\n * console.log(error.errors);\n * }\n * ```\n */\n static is(error: unknown): error is CombinedProtocolErrors {\n return isBranded(error, \"CombinedProtocolErrors\");\n }\n\n /** {@inheritDoc @apollo/client!CombinedProtocolErrors.DocumentationTypes.formatMessage:function(1)} */\n static formatMessage: CombinedProtocolErrors.MessageFormatter =\n defaultFormatMessage;\n\n /** {@inheritDoc @apollo/client!CombinedProtocolErrors.DocumentationTypes.InstanceProperties#errors:member} */\n readonly errors: ReadonlyArray<GraphQLFormattedError>;\n\n constructor(\n protocolErrors:\n | Array<GraphQLFormattedError>\n | ReadonlyArray<GraphQLFormattedError>\n ) {\n super(\n CombinedProtocolErrors.formatMessage(protocolErrors, {\n defaultFormatMessage,\n })\n );\n this.name = \"CombinedProtocolErrors\";\n this.errors = protocolErrors;\n\n brand(this);\n Object.setPrototypeOf(this, CombinedProtocolErrors.prototype);\n }\n}\n"],"names":[],"mappings":";;;AAEA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAiGA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6B,CAAC,CAA9B,CAAA,CAAA,CAAA,CAAA,CAA0E,EAA1E;IACE,CAAF,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAe,CAAC,CAAhB,CAAA,CAAmB,CAAC,CAAC,CAAC,EAAE,CAAxB,EAA2B,CAAC,CAAC,CAA7B,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAwC,CAAxC,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA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AC;QACX,CAAJ,CAAA,CAAA,CAAA,CAAA,CAAU,CAAC,CAAX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAyB,CAAC,CAA1B,CAAA,CAAA,CAA8B,EAAE,CAAhC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsD,CAAC,CAAvD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgE,CAAC;IAC/D;;AAxCF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
|
|
@@ -124,19 +124,25 @@ export declare class CombinedProtocolErrors extends Error {
|
|
|
124
124
|
*/
|
|
125
125
|
static is(error: unknown): error is CombinedProtocolErrors;
|
|
126
126
|
/**
|
|
127
|
-
* A function that formats the error message used for the error's `message`
|
|
127
|
+
* A function that formats the error message used for the error's `message`
|
|
128
|
+
* property. Override this method to provide your own formatting.
|
|
128
129
|
*
|
|
129
130
|
* @remarks
|
|
130
131
|
*
|
|
131
|
-
* The `formatMessage` function is called by the `CombinedProtocolErrors`
|
|
132
|
+
* The `formatMessage` function is called by the `CombinedProtocolErrors`
|
|
133
|
+
* constructor to provide a formatted message as the `message` property of the
|
|
134
|
+
* `CombinedProtocolErrors` object. Follow the ["Providing a custom message
|
|
135
|
+
* formatter"](https://www.apollographql.com/docs/react/api/errors/CombinedProtocolErrors#providing-a-custom-message-formatter) guide to learn how to modify the message format.
|
|
132
136
|
*
|
|
133
|
-
* @param errors - The array of GraphQL errors returned from the server in the
|
|
134
|
-
*
|
|
135
|
-
* @param options - Additional context that could be useful when formatting
|
|
137
|
+
* @param errors - The array of GraphQL errors returned from the server in the
|
|
138
|
+
* `errors` field of the response.
|
|
139
|
+
* @param options - Additional context that could be useful when formatting
|
|
140
|
+
* the message.
|
|
136
141
|
*/
|
|
137
142
|
static formatMessage: CombinedProtocolErrors.MessageFormatter;
|
|
138
143
|
/**
|
|
139
|
-
* The raw list of errors returned by the top-level `errors` field in the
|
|
144
|
+
* The raw list of errors returned by the top-level `errors` field in the
|
|
145
|
+
* multipart HTTP subscription response.
|
|
140
146
|
*/
|
|
141
147
|
readonly errors: ReadonlyArray<GraphQLFormattedError>;
|
|
142
148
|
constructor(protocolErrors: Array<GraphQLFormattedError> | ReadonlyArray<GraphQLFormattedError>);
|
|
@@ -57,7 +57,8 @@ class ServerError extends Error {
|
|
|
57
57
|
*/
|
|
58
58
|
response;
|
|
59
59
|
/**
|
|
60
|
-
* The status code returned by the server in the response. This is provided as
|
|
60
|
+
* The status code returned by the server in the response. This is provided as
|
|
61
|
+
* a shortcut for `response.status`.
|
|
61
62
|
*/
|
|
62
63
|
statusCode;
|
|
63
64
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerError.cjs","sources":["../../../src/errors/ServerError.ts"],"sourcesContent":["import { brand, isBranded } from \"./utils.js\";\n\nexport declare namespace ServerError {\n export interface Options {\n response: Response;\n bodyText: string;\n }\n\n namespace DocumentationTypes {\n interface InstanceProperties {\n /**\n * The raw [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) object provided by the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).\n */\n readonly response: Response;\n /**\n * The status code returned by the server in the response. This is provided as\n * a shortcut for `response.status`.\n */\n readonly statusCode: number;\n\n /**\n * The raw response body text.\n */\n readonly bodyText: string;\n }\n }\n}\n\n/**\n * Represents an error when a non-200 HTTP status code is returned from the\n * server according to the [GraphQL Over HTTP specification](https://graphql.github.io/graphql-over-http/draft/). This error\n * contains the full server response, including status code and body text.\n *\n * @remarks\n *\n * This error occurs when your GraphQL server responds with an HTTP status code\n * other than 200 (such as 4xx or 5xx status codes) with any media type other\n * than [`application/graphql-response+json`](https://graphql.github.io/graphql-over-http/draft/#sec-application-graphql-response-json).\n *\n * Servers that return non-200 status codes with other media types are not\n * guaranteed to contain a well-formed GraphQL response and may indicate issues\n * at the HTTP level, such as authentication failures, server unavailability,\n * or other HTTP-level problems.\n *\n * @example\n *\n * ```ts\n * import { ServerError } from \"@apollo/client/errors\";\n *\n * // Check if an error is a ServerError instance\n * if (ServerError.is(error)) {\n * console.log(`Server returned status: ${error.statusCode}`);\n * console.log(`Response body: ${error.bodyText}`);\n *\n * // Handle specific status codes\n * if (error.statusCode === 401) {\n * // Handle unauthorized access\n * }\n * }\n * ```\n */\nexport class ServerError extends Error {\n /**\n * A method that determines whether an error is a `ServerError` object. This\n * method enables TypeScript to narrow the error type.\n *\n * @example\n *\n * ```ts\n * if (ServerError.is(error)) {\n * // TypeScript now knows `error` is a ServerError object\n * console.log(error.errors);\n * }\n * ```\n */\n static is(error: unknown): error is ServerError {\n return isBranded(error, \"ServerError\");\n }\n\n /** {@inheritDoc @apollo/client!ServerError.DocumentationTypes.InstanceProperties#response:member} */\n readonly response: Response;\n\n /** {@inheritDoc @apollo/client!ServerError.DocumentationTypes.InstanceProperties#statusCode:member} */\n readonly statusCode: number;\n\n /** {@inheritDoc @apollo/client!ServerError.DocumentationTypes.InstanceProperties#bodyText:member} */\n readonly bodyText: string;\n\n constructor(message: string, options: ServerError.Options) {\n super(message);\n this.name = \"ServerError\";\n this.response = options.response;\n this.statusCode = options.response.status;\n this.bodyText = options.bodyText;\n\n brand(this);\n Object.setPrototypeOf(this, ServerError.prototype);\n }\n}\n"],"names":[],"mappings":";;;AAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AA4BA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCA,CAAA;AACA,CAAA,CAAA,CAAA,CAAA,EAAa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAiC,CAAjC,CAAA,CAAA,CAAA,EAAA;IACE,CAAF,CAAA;;;;;;;;;;;;KAYA,CAAA;IACE,CAAF,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAW,CAAC,CAAZ,CAAA,CAAA,CAAA,CAA0B,EAA1B;QACI,CAAJ,CAAA,CAAA,CAAA,CAAA,EAAW,CAAX,CAAA,EAAW,CAAX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoB,CAApB,CAAqB,CAArB,CAAA,CAAA,CAAA,CAA0B,EAAE,CAA5B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAyC,CAAC;IACxC;;;;IAGS,CAAX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAmB
|
|
1
|
+
{"version":3,"file":"ServerError.cjs","sources":["../../../src/errors/ServerError.ts"],"sourcesContent":["import { brand, isBranded } from \"./utils.js\";\n\nexport declare namespace ServerError {\n export interface Options {\n response: Response;\n bodyText: string;\n }\n\n namespace DocumentationTypes {\n interface InstanceProperties {\n /**\n * The raw [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) object provided by the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).\n */\n readonly response: Response;\n /**\n * The status code returned by the server in the response. This is provided as\n * a shortcut for `response.status`.\n */\n readonly statusCode: number;\n\n /**\n * The raw response body text.\n */\n readonly bodyText: string;\n }\n }\n}\n\n/**\n * Represents an error when a non-200 HTTP status code is returned from the\n * server according to the [GraphQL Over HTTP specification](https://graphql.github.io/graphql-over-http/draft/). This error\n * contains the full server response, including status code and body text.\n *\n * @remarks\n *\n * This error occurs when your GraphQL server responds with an HTTP status code\n * other than 200 (such as 4xx or 5xx status codes) with any media type other\n * than [`application/graphql-response+json`](https://graphql.github.io/graphql-over-http/draft/#sec-application-graphql-response-json).\n *\n * Servers that return non-200 status codes with other media types are not\n * guaranteed to contain a well-formed GraphQL response and may indicate issues\n * at the HTTP level, such as authentication failures, server unavailability,\n * or other HTTP-level problems.\n *\n * @example\n *\n * ```ts\n * import { ServerError } from \"@apollo/client/errors\";\n *\n * // Check if an error is a ServerError instance\n * if (ServerError.is(error)) {\n * console.log(`Server returned status: ${error.statusCode}`);\n * console.log(`Response body: ${error.bodyText}`);\n *\n * // Handle specific status codes\n * if (error.statusCode === 401) {\n * // Handle unauthorized access\n * }\n * }\n * ```\n */\nexport class ServerError extends Error {\n /**\n * A method that determines whether an error is a `ServerError` object. This\n * method enables TypeScript to narrow the error type.\n *\n * @example\n *\n * ```ts\n * if (ServerError.is(error)) {\n * // TypeScript now knows `error` is a ServerError object\n * console.log(error.errors);\n * }\n * ```\n */\n static is(error: unknown): error is ServerError {\n return isBranded(error, \"ServerError\");\n }\n\n /** {@inheritDoc @apollo/client!ServerError.DocumentationTypes.InstanceProperties#response:member} */\n readonly response: Response;\n\n /** {@inheritDoc @apollo/client!ServerError.DocumentationTypes.InstanceProperties#statusCode:member} */\n readonly statusCode: number;\n\n /** {@inheritDoc @apollo/client!ServerError.DocumentationTypes.InstanceProperties#bodyText:member} */\n readonly bodyText: string;\n\n constructor(message: string, options: ServerError.Options) {\n super(message);\n this.name = \"ServerError\";\n this.response = options.response;\n this.statusCode = options.response.status;\n this.bodyText = options.bodyText;\n\n brand(this);\n Object.setPrototypeOf(this, ServerError.prototype);\n }\n}\n"],"names":[],"mappings":";;;AAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AA4BA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCA,CAAA;AACA,CAAA,CAAA,CAAA,CAAA,EAAa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAiC,CAAjC,CAAA,CAAA,CAAA,EAAA;IACE,CAAF,CAAA;;;;;;;;;;;;KAYA,CAAA;IACE,CAAF,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAW,CAAC,CAAZ,CAAA,CAAA,CAAA,CAA0B,EAA1B;QACI,CAAJ,CAAA,CAAA,CAAA,CAAA,EAAW,CAAX,CAAA,EAAW,CAAX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoB,CAApB,CAAqB,CAArB,CAAA,CAAA,CAAA,CAA0B,EAAE,CAA5B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAyC,CAAC;IACxC;;;;IAGS,CAAX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAmB;;;;;IAGR,CAAX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqB;;;;IAGV,CAAX,CAAA,CAAA,CAAA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A,CAAA,CAAc,CAAC;QACX,CAAJ,CAAA,CAAA,CAAA,CAAA,CAAU,CAAC,CAAX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAyB,CAAC,CAA1B,CAAA,CAAA,CAA8B,EAAE,CAAhC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA2C,CAAC,CAA5C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqD,CAAC;IACpD;AACF;AArCA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
|
|
@@ -74,7 +74,8 @@ export declare class ServerError extends Error {
|
|
|
74
74
|
*/
|
|
75
75
|
readonly response: Response;
|
|
76
76
|
/**
|
|
77
|
-
* The status code returned by the server in the response. This is provided as
|
|
77
|
+
* The status code returned by the server in the response. This is provided as
|
|
78
|
+
* a shortcut for `response.status`.
|
|
78
79
|
*/
|
|
79
80
|
readonly statusCode: number;
|
|
80
81
|
/**
|
|
@@ -52,7 +52,8 @@ class ServerParseError extends Error {
|
|
|
52
52
|
*/
|
|
53
53
|
response;
|
|
54
54
|
/**
|
|
55
|
-
* The status code returned by the server in the response. This is provided
|
|
55
|
+
* The status code returned by the server in the response. This is provided
|
|
56
|
+
* as a shortcut for `response.status`.
|
|
56
57
|
*/
|
|
57
58
|
statusCode;
|
|
58
59
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerParseError.cjs","sources":["../../../src/errors/ServerParseError.ts"],"sourcesContent":["import { brand, isBranded } from \"./utils.js\";\n\nexport declare namespace ServerParseError {\n export interface Options {\n response: Response;\n bodyText: string;\n }\n\n namespace DocumentationTypes {\n interface InstanceProperties {\n /**\n * The raw [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) object provided by the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).\n */\n readonly response: Response;\n /**\n * The status code returned by the server in the response. This is provided\n * as a shortcut for `response.status`.\n */\n readonly statusCode: number;\n /**\n * The raw response body text.\n */\n readonly bodyText: string;\n }\n }\n}\n\n/**\n * Represents a failure to parse the response as JSON from the server. This\n * error helps debug issues where the server returns malformed JSON or non-JSON\n * content.\n *\n * @remarks\n *\n * This error occurs when Apollo Client receives a response from the server but\n * cannot parse it as valid JSON. This typically happens when the server returns\n * HTML error pages, plain text responses, or malformed JSON instead of the\n * expected GraphQL JSON response format.\n *\n * @example\n *\n * ```ts\n * import { ServerParseError } from \"@apollo/client/errors\";\n *\n * // Check if an error is a ServerParseError instance\n * if (ServerParseError.is(error)) {\n * console.log(`Failed to parse response from ${error.response.url}`);\n * console.log(`Raw response: ${error.bodyText}`);\n * console.log(`Status code: ${error.statusCode}`);\n *\n * // Access the original parse error\n * console.log(`Parse error: ${error.cause}`);\n * }\n * ```\n */\nexport class ServerParseError extends Error {\n /**\n * A method that determines whether an error is a `ServerParseError`\n * object. This method enables TypeScript to narrow the error type.\n *\n * @example\n *\n * ```ts\n * if (ServerParseError.is(error)) {\n * // TypeScript now knows `error` is a ServerParseError object\n * console.log(error.statusCode);\n * }\n * ```\n */\n static is(error: unknown): error is ServerParseError {\n return isBranded(error, \"ServerParseError\");\n }\n /** {@inheritDoc @apollo/client!ServerParseError.DocumentationTypes.InstanceProperties#response:member} */\n readonly response: Response;\n\n /** {@inheritDoc @apollo/client!ServerParseError.DocumentationTypes.InstanceProperties#statusCode:member} */\n readonly statusCode: number;\n\n /** {@inheritDoc @apollo/client!ServerParseError.DocumentationTypes.InstanceProperties#bodyText:member} */\n readonly bodyText: string;\n\n constructor(originalParseError: unknown, options: ServerParseError.Options) {\n super(\n originalParseError instanceof Error ?\n originalParseError.message\n : \"Could not parse server response\",\n { cause: originalParseError }\n );\n this.name = \"ServerParseError\";\n this.response = options.response;\n this.statusCode = options.response.status;\n this.bodyText = options.bodyText;\n\n brand(this);\n Object.setPrototypeOf(this, ServerParseError.prototype);\n }\n}\n"],"names":[],"mappings":";;;AAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AA2BA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BA,CAAA;AACA,CAAA,CAAA,CAAA,CAAA,EAAa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAsC,CAAtC,CAAA,CAAA,CAAA,EAAA;IACE,CAAF,CAAA;;;;;;;;;;;;KAYA,CAAA;IACE,CAAF,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAW,CAAC,CAAZ,CAAA,CAAA,CAAA,CAA0B,EAA1B;QACI,CAAJ,CAAA,CAAA,CAAA,CAAA,EAAW,CAAX,CAAA,EAAW,CAAX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoB,CAApB,CAAqB,CAArB,CAAA,CAAA,CAAA,CAA0B,EAAE,CAA5B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8C,CAAC;IAC7C;;;;IAES,CAAX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAmB
|
|
1
|
+
{"version":3,"file":"ServerParseError.cjs","sources":["../../../src/errors/ServerParseError.ts"],"sourcesContent":["import { brand, isBranded } from \"./utils.js\";\n\nexport declare namespace ServerParseError {\n export interface Options {\n response: Response;\n bodyText: string;\n }\n\n namespace DocumentationTypes {\n interface InstanceProperties {\n /**\n * The raw [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) object provided by the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).\n */\n readonly response: Response;\n /**\n * The status code returned by the server in the response. This is provided\n * as a shortcut for `response.status`.\n */\n readonly statusCode: number;\n /**\n * The raw response body text.\n */\n readonly bodyText: string;\n }\n }\n}\n\n/**\n * Represents a failure to parse the response as JSON from the server. This\n * error helps debug issues where the server returns malformed JSON or non-JSON\n * content.\n *\n * @remarks\n *\n * This error occurs when Apollo Client receives a response from the server but\n * cannot parse it as valid JSON. This typically happens when the server returns\n * HTML error pages, plain text responses, or malformed JSON instead of the\n * expected GraphQL JSON response format.\n *\n * @example\n *\n * ```ts\n * import { ServerParseError } from \"@apollo/client/errors\";\n *\n * // Check if an error is a ServerParseError instance\n * if (ServerParseError.is(error)) {\n * console.log(`Failed to parse response from ${error.response.url}`);\n * console.log(`Raw response: ${error.bodyText}`);\n * console.log(`Status code: ${error.statusCode}`);\n *\n * // Access the original parse error\n * console.log(`Parse error: ${error.cause}`);\n * }\n * ```\n */\nexport class ServerParseError extends Error {\n /**\n * A method that determines whether an error is a `ServerParseError`\n * object. This method enables TypeScript to narrow the error type.\n *\n * @example\n *\n * ```ts\n * if (ServerParseError.is(error)) {\n * // TypeScript now knows `error` is a ServerParseError object\n * console.log(error.statusCode);\n * }\n * ```\n */\n static is(error: unknown): error is ServerParseError {\n return isBranded(error, \"ServerParseError\");\n }\n /** {@inheritDoc @apollo/client!ServerParseError.DocumentationTypes.InstanceProperties#response:member} */\n readonly response: Response;\n\n /** {@inheritDoc @apollo/client!ServerParseError.DocumentationTypes.InstanceProperties#statusCode:member} */\n readonly statusCode: number;\n\n /** {@inheritDoc @apollo/client!ServerParseError.DocumentationTypes.InstanceProperties#bodyText:member} */\n readonly bodyText: string;\n\n constructor(originalParseError: unknown, options: ServerParseError.Options) {\n super(\n originalParseError instanceof Error ?\n originalParseError.message\n : \"Could not parse server response\",\n { cause: originalParseError }\n );\n this.name = \"ServerParseError\";\n this.response = options.response;\n this.statusCode = options.response.status;\n this.bodyText = options.bodyText;\n\n brand(this);\n Object.setPrototypeOf(this, ServerParseError.prototype);\n }\n}\n"],"names":[],"mappings":";;;AAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AA2BA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BA,CAAA;AACA,CAAA,CAAA,CAAA,CAAA,EAAa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAsC,CAAtC,CAAA,CAAA,CAAA,EAAA;IACE,CAAF,CAAA;;;;;;;;;;;;KAYA,CAAA;IACE,CAAF,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAW,CAAC,CAAZ,CAAA,CAAA,CAAA,CAA0B,EAA1B;QACI,CAAJ,CAAA,CAAA,CAAA,CAAA,EAAW,CAAX,CAAA,EAAW,CAAX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoB,CAApB,CAAqB,CAArB,CAAA,CAAA,CAAA,CAA0B,EAAE,CAA5B,CAAA,CAAA,CAAA,CAAA,CAAA,CAA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CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgD,CAAC,CAAjD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA0D,CAAC;IACzD;AACF;AAzCA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
|
|
@@ -69,7 +69,8 @@ export declare class ServerParseError extends Error {
|
|
|
69
69
|
*/
|
|
70
70
|
readonly response: Response;
|
|
71
71
|
/**
|
|
72
|
-
* The status code returned by the server in the response. This is provided
|
|
72
|
+
* The status code returned by the server in the response. This is provided
|
|
73
|
+
* as a shortcut for `response.status`.
|
|
73
74
|
*/
|
|
74
75
|
readonly statusCode: number;
|
|
75
76
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defer20220824.cjs","sources":["../../../../src/incremental/handlers/defer20220824.ts"],"sourcesContent":["import type {\n DocumentNode,\n FormattedExecutionResult,\n GraphQLFormattedError,\n} from \"graphql\";\n\nimport type { FetchResult, GraphQLRequest } from \"@apollo/client\";\nimport type { DeepPartial } from \"@apollo/client/utilities\";\nimport {\n DeepMerger,\n hasDirectives,\n isNonEmptyArray,\n} from \"@apollo/client/utilities/internal\";\n\nimport type { Incremental } from \"../types.js\";\n\nexport declare namespace Defer20220824Handler {\n export type InitialResult<TData = Record<string, unknown>> = {\n data?: TData | null | undefined;\n errors?: ReadonlyArray<GraphQLFormattedError>;\n extensions?: Record<string, unknown>;\n hasNext: boolean;\n };\n\n export type SubsequentResult<TData = Record<string, unknown>> = {\n data?: TData | null | undefined;\n errors?: ReadonlyArray<GraphQLFormattedError>;\n extensions?: Record<string, unknown>;\n hasNext: boolean;\n incremental?: Array<IncrementalDeferPayload<TData>>;\n };\n\n export type Chunk<TData extends Record<string, unknown>> =\n | InitialResult<TData>\n | SubsequentResult<TData>;\n\n export type IncrementalDeferPayload<TData = Record<string, unknown>> = {\n data?: TData | null | undefined;\n errors?: ReadonlyArray<GraphQLFormattedError>;\n extensions?: Record<string, unknown>;\n path?: Incremental.Path;\n label?: string;\n };\n}\n\ndeclare module \"@apollo/client/link\" {\n export interface AdditionalFetchResultTypes {\n Defer20220824Handler: Defer20220824Handler.Chunk<Record<string, unknown>>;\n }\n}\n\nclass DeferRequest<TData extends Record<string, unknown>>\n implements\n Incremental.IncrementalRequest<Defer20220824Handler.Chunk<TData>, TData>\n{\n public hasNext = true;\n\n private errors: Array<GraphQLFormattedError> = [];\n private extensions: Record<string, any> = {};\n private data: any = {};\n\n private mergeIn(\n normalized: FormattedExecutionResult<TData>,\n merger: DeepMerger<any[]>\n ) {\n if (normalized.data !== undefined) {\n this.data = merger.merge(this.data, normalized.data);\n }\n if (normalized.errors) {\n this.errors.push(...normalized.errors);\n }\n Object.assign(this.extensions, normalized.extensions);\n }\n\n handle(\n // we'll get `undefined` here in case of a `no-cache` fetch policy,\n // so we'll continue with the last value this request had accumulated\n cacheData: TData | DeepPartial<TData> | null | undefined = this.data,\n chunk: Defer20220824Handler.Chunk<TData>\n ): FormattedExecutionResult<TData> {\n this.hasNext = chunk.hasNext;\n this.data = cacheData;\n\n this.mergeIn(chunk, new DeepMerger());\n\n if (hasIncrementalChunks(chunk)) {\n const merger = new DeepMerger();\n for (const incremental of chunk.incremental) {\n let { data, path, errors, extensions } = incremental;\n if (data && path) {\n for (let i = path.length - 1; i >= 0; --i) {\n const key = path[i];\n const isNumericKey = !isNaN(+key);\n const parent: Record<string | number, any> = isNumericKey ? [] : {};\n parent[key] = data;\n data = parent as typeof data;\n }\n }\n this.mergeIn(\n {\n errors,\n extensions,\n data: data ? (data as TData) : undefined,\n },\n merger\n );\n }\n }\n\n const result: FormattedExecutionResult<TData> = { data: this.data };\n\n if (isNonEmptyArray(this.errors)) {\n result.errors = this.errors;\n }\n\n if (Object.keys(this.extensions).length > 0) {\n result.extensions = this.extensions;\n }\n\n return result;\n }\n}\n\n/**\n * This handler implements the `@defer` directive as specified in this historical commit:\n * https://github.com/graphql/graphql-spec/tree/48cf7263a71a683fab03d45d309fd42d8d9a6659/spec\n */\nexport class Defer20220824Handler\n implements Incremental.Handler<Defer20220824Handler.Chunk<any>>\n{\n isIncrementalResult(\n result: Record<string, any>\n ): result is\n | Defer20220824Handler.SubsequentResult\n | Defer20220824Handler.InitialResult {\n return \"hasNext\" in result;\n }\n\n extractErrors(result: FetchResult<any>) {\n const acc: GraphQLFormattedError[] = [];\n const push = ({\n errors,\n }: {\n errors?: ReadonlyArray<GraphQLFormattedError>;\n }) => {\n if (errors) {\n acc.push(...errors);\n }\n };\n if (this.isIncrementalResult(result)) {\n push(result);\n if (hasIncrementalChunks(result)) {\n result.incremental.forEach(push);\n }\n }\n if (acc.length) {\n return acc;\n }\n }\n\n prepareRequest(request: GraphQLRequest): GraphQLRequest {\n if (hasDirectives([\"defer\"], request.query)) {\n const context = request.context ?? {};\n const http = (context.http ??= {});\n http.accept = [\n \"multipart/mixed;deferSpec=20220824\",\n ...(http.accept || []),\n ];\n }\n\n return request;\n }\n startRequest<TData extends Record<string, unknown>>(_: {\n query: DocumentNode;\n }) {\n return new DeferRequest<TData>();\n }\n}\n\n// only exported for use in tests\nexport function hasIncrementalChunks(\n result: Record<string, any>\n): result is Required<Defer20220824Handler.SubsequentResult> {\n return isNonEmptyArray(result.incremental);\n}\n"],"names":[],"mappings":";;;AAoLA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CA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F;AAlDA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAoDA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA;AACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAgB,CAAhB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoC,CAClC,CADF,CAAA,CAAA,CAAA,CAAA,CAC6B,EAD7B;IAGE,CAAF,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAA,EAAS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwB,CAAxB,CAAyB,CAAzB,CAAA,CAAA,CAAA,CAAA,CAA+B,CAAC,CAAhC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA2C,CAAC;AAC5C;"}
|
|
1
|
+
{"version":3,"file":"defer20220824.cjs","sources":["../../../../src/incremental/handlers/defer20220824.ts"],"sourcesContent":["import type {\n DocumentNode,\n FormattedExecutionResult,\n GraphQLFormattedError,\n} from \"graphql\";\n\nimport type { ApolloLink } from \"@apollo/client/link\";\nimport type { DeepPartial } from \"@apollo/client/utilities\";\nimport {\n DeepMerger,\n hasDirectives,\n isNonEmptyArray,\n} from \"@apollo/client/utilities/internal\";\n\nimport type { Incremental } from \"../types.js\";\n\nexport declare namespace Defer20220824Handler {\n export type InitialResult<TData = Record<string, unknown>> = {\n data?: TData | null | undefined;\n errors?: ReadonlyArray<GraphQLFormattedError>;\n extensions?: Record<string, unknown>;\n hasNext: boolean;\n };\n\n export type SubsequentResult<TData = Record<string, unknown>> = {\n data?: TData | null | undefined;\n errors?: ReadonlyArray<GraphQLFormattedError>;\n extensions?: Record<string, unknown>;\n hasNext: boolean;\n incremental?: Array<IncrementalDeferPayload<TData>>;\n };\n\n export type Chunk<TData extends Record<string, unknown>> =\n | InitialResult<TData>\n | SubsequentResult<TData>;\n\n export type IncrementalDeferPayload<TData = Record<string, unknown>> = {\n data?: TData | null | undefined;\n errors?: ReadonlyArray<GraphQLFormattedError>;\n extensions?: Record<string, unknown>;\n path?: Incremental.Path;\n label?: string;\n };\n}\n\ndeclare module \"@apollo/client/link\" {\n export interface AdditionalApolloLinkResultTypes {\n Defer20220824Handler: Defer20220824Handler.Chunk<Record<string, unknown>>;\n }\n}\n\nclass DeferRequest<TData extends Record<string, unknown>>\n implements\n Incremental.IncrementalRequest<Defer20220824Handler.Chunk<TData>, TData>\n{\n public hasNext = true;\n\n private errors: Array<GraphQLFormattedError> = [];\n private extensions: Record<string, any> = {};\n private data: any = {};\n\n private mergeIn(\n normalized: FormattedExecutionResult<TData>,\n merger: DeepMerger<any[]>\n ) {\n if (normalized.data !== undefined) {\n this.data = merger.merge(this.data, normalized.data);\n }\n if (normalized.errors) {\n this.errors.push(...normalized.errors);\n }\n Object.assign(this.extensions, normalized.extensions);\n }\n\n handle(\n // we'll get `undefined` here in case of a `no-cache` fetch policy,\n // so we'll continue with the last value this request had accumulated\n cacheData: TData | DeepPartial<TData> | null | undefined = this.data,\n chunk: Defer20220824Handler.Chunk<TData>\n ): FormattedExecutionResult<TData> {\n this.hasNext = chunk.hasNext;\n this.data = cacheData;\n\n this.mergeIn(chunk, new DeepMerger());\n\n if (hasIncrementalChunks(chunk)) {\n const merger = new DeepMerger();\n for (const incremental of chunk.incremental) {\n let { data, path, errors, extensions } = incremental;\n if (data && path) {\n for (let i = path.length - 1; i >= 0; --i) {\n const key = path[i];\n const isNumericKey = !isNaN(+key);\n const parent: Record<string | number, any> = isNumericKey ? [] : {};\n parent[key] = data;\n data = parent as typeof data;\n }\n }\n this.mergeIn(\n {\n errors,\n extensions,\n data: data ? (data as TData) : undefined,\n },\n merger\n );\n }\n }\n\n const result: FormattedExecutionResult<TData> = { data: this.data };\n\n if (isNonEmptyArray(this.errors)) {\n result.errors = this.errors;\n }\n\n if (Object.keys(this.extensions).length > 0) {\n result.extensions = this.extensions;\n }\n\n return result;\n }\n}\n\n/**\n * This handler implements the `@defer` directive as specified in this historical commit:\n * https://github.com/graphql/graphql-spec/tree/48cf7263a71a683fab03d45d309fd42d8d9a6659/spec\n */\nexport class Defer20220824Handler\n implements Incremental.Handler<Defer20220824Handler.Chunk<any>>\n{\n isIncrementalResult(\n result: Record<string, any>\n ): result is\n | Defer20220824Handler.SubsequentResult\n | Defer20220824Handler.InitialResult {\n return \"hasNext\" in result;\n }\n\n extractErrors(result: ApolloLink.Result<any>) {\n const acc: GraphQLFormattedError[] = [];\n const push = ({\n errors,\n }: {\n errors?: ReadonlyArray<GraphQLFormattedError>;\n }) => {\n if (errors) {\n acc.push(...errors);\n }\n };\n if (this.isIncrementalResult(result)) {\n push(result);\n if (hasIncrementalChunks(result)) {\n result.incremental.forEach(push);\n }\n }\n if (acc.length) {\n return acc;\n }\n }\n\n prepareRequest(request: ApolloLink.Request): ApolloLink.Request {\n if (hasDirectives([\"defer\"], request.query)) {\n const context = request.context ?? {};\n const http = (context.http ??= {});\n http.accept = [\n \"multipart/mixed;deferSpec=20220824\",\n ...(http.accept || []),\n ];\n }\n\n return request;\n }\n startRequest<TData extends Record<string, unknown>>(_: {\n query: DocumentNode;\n }) {\n return new DeferRequest<TData>();\n }\n}\n\n// only exported for use in tests\nexport function hasIncrementalChunks(\n result: Record<string, any>\n): result is Required<Defer20220824Handler.SubsequentResult> {\n return isNonEmptyArray(result.incremental);\n}\n"],"names":[],"mappings":";;;AAoLA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AA5KA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AA2CA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAN,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA;IAIS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAmB,CAAnB,CAAA,CAAA,CAAuB;IAEb,CAAV,CAAA,CAAA,CAAA,CAAA,EAAA,EAAiD,CAAjD,CAAmD;IACzC,CAAV,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAA4C,CAA5C,CAA8C;IACpC,CAAV,CAAA,CAAA,EAAA,EAAsB,CAAtB,CAAwB;I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AAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwB,CAAxB,CAAyB,CAAzB,CAAA,CAAA,CAAA,CAAA,CAA+B,CAAC,CAAhC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA2C,CAAC;AAC5C;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DocumentNode, FormattedExecutionResult, GraphQLFormattedError } from "graphql";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ApolloLink } from "@apollo/client/link";
|
|
3
3
|
import type { DeepPartial } from "@apollo/client/utilities";
|
|
4
4
|
import type { Incremental } from "../types.cjs";
|
|
5
5
|
export declare namespace Defer20220824Handler {
|
|
@@ -26,7 +26,7 @@ export declare namespace Defer20220824Handler {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
declare module "@apollo/client/link" {
|
|
29
|
-
interface
|
|
29
|
+
interface AdditionalApolloLinkResultTypes {
|
|
30
30
|
Defer20220824Handler: Defer20220824Handler.Chunk<Record<string, unknown>>;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -44,8 +44,8 @@ declare class DeferRequest<TData extends Record<string, unknown>> implements Inc
|
|
|
44
44
|
*/
|
|
45
45
|
export declare class Defer20220824Handler implements Incremental.Handler<Defer20220824Handler.Chunk<any>> {
|
|
46
46
|
isIncrementalResult(result: Record<string, any>): result is Defer20220824Handler.SubsequentResult | Defer20220824Handler.InitialResult;
|
|
47
|
-
extractErrors(result:
|
|
48
|
-
prepareRequest(request:
|
|
47
|
+
extractErrors(result: ApolloLink.Result<any>): GraphQLFormattedError[] | undefined;
|
|
48
|
+
prepareRequest(request: ApolloLink.Request): ApolloLink.Request;
|
|
49
49
|
startRequest<TData extends Record<string, unknown>>(_: {
|
|
50
50
|
query: DocumentNode;
|
|
51
51
|
}): DeferRequest<TData>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notImplemented.cjs","sources":["../../../../src/incremental/handlers/notImplemented.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"notImplemented.cjs","sources":["../../../../src/incremental/handlers/notImplemented.ts"],"sourcesContent":["import type { ApolloLink } from \"@apollo/client/link\";\nimport { hasDirectives } from \"@apollo/client/utilities/internal\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nimport type { Incremental } from \"../types.js\";\n\nexport class NotImplementedHandler implements Incremental.Handler<never> {\n isIncrementalResult(_: any): _ is never {\n return false;\n }\n prepareRequest(request: ApolloLink.Request) {\n invariant(\n !hasDirectives([\"defer\"], request.query),\n \"`@defer` is not supported without specifying an incremental handler. Please pass a handler as the `incrementalHandler` option to the `ApolloClient` constructor.\"\n );\n\n return request;\n }\n extractErrors() {}\n // This code path can never be reached, so we won't implement it.\n startRequest = undefined as any;\n}\n"],"names":[],"mappings":";;;AACA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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AmB;IACjB,CAAF,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA;IACE,CAAF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAiB,CAAjB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiC;AACjC;AAfA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ApolloLink } from "@apollo/client/link";
|
|
2
2
|
import type { Incremental } from "../types.cjs";
|
|
3
3
|
export declare class NotImplementedHandler implements Incremental.Handler<never> {
|
|
4
4
|
isIncrementalResult(_: any): _ is never;
|
|
5
|
-
prepareRequest(request:
|
|
5
|
+
prepareRequest(request: ApolloLink.Request): ApolloLink.Request;
|
|
6
6
|
extractErrors(): void;
|
|
7
7
|
startRequest: any;
|
|
8
8
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DocumentNode, FormattedExecutionResult, GraphQLFormattedError } from "graphql";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ApolloLink } from "@apollo/client/link";
|
|
3
3
|
import type { DeepPartial } from "@apollo/client/utilities";
|
|
4
4
|
export declare namespace Incremental {
|
|
5
5
|
type Path = ReadonlyArray<string | number>;
|
|
@@ -9,9 +9,9 @@ export declare namespace Incremental {
|
|
|
9
9
|
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
10
10
|
*/
|
|
11
11
|
interface Handler<Chunk extends Record<string, unknown> = Record<string, unknown>> {
|
|
12
|
-
isIncrementalResult: (result:
|
|
13
|
-
prepareRequest: (request:
|
|
14
|
-
extractErrors: (result:
|
|
12
|
+
isIncrementalResult: (result: ApolloLink.Result<any>) => result is Chunk;
|
|
13
|
+
prepareRequest: (request: ApolloLink.Request) => ApolloLink.Request;
|
|
14
|
+
extractErrors: (result: ApolloLink.Result<any>) => readonly GraphQLFormattedError[] | undefined | void;
|
|
15
15
|
startRequest: <TData extends Record<string, unknown>>(request: {
|
|
16
16
|
query: DocumentNode;
|
|
17
17
|
}) => IncrementalRequest<Chunk, TData>;
|
|
@@ -289,11 +289,6 @@ you have an infinite render loop in your application.`
|
|
|
289
289
|
message: "The configured cache does not support fragment matching which will lead to incorrect results when executing local resolvers. Please use a cache that implements `fragmetMatches`."
|
|
290
290
|
},
|
|
291
291
|
|
|
292
|
-
56: {
|
|
293
|
-
file: "@apollo/client/__cjs/link/utils/validateOperation.cjs",
|
|
294
|
-
message: `illegal argument: %s`
|
|
295
|
-
},
|
|
296
|
-
|
|
297
292
|
57: {
|
|
298
293
|
file: "@apollo/client/__cjs/link/persisted-queries/index.cjs",
|
|
299
294
|
condition: "options &&\n (typeof options.sha256 === \"function\" ||\n typeof options.generateHash === \"function\")",
|
|
@@ -333,11 +328,6 @@ const client = new ApolloClient({
|
|
|
333
328
|
message: "Unknown type for `response.body`. Please use a `fetch` implementation that is WhatWG-compliant and that uses WhatWG ReadableStreams for `body`."
|
|
334
329
|
},
|
|
335
330
|
|
|
336
|
-
61: {
|
|
337
|
-
file: "@apollo/client/__cjs/link/http/serializeFetchParameter.cjs",
|
|
338
|
-
message: `Network request failed. %s is not serializable: %s`
|
|
339
|
-
},
|
|
340
|
-
|
|
341
331
|
63: {
|
|
342
332
|
file: "@apollo/client/__cjs/link/core/ApolloLink.cjs",
|
|
343
333
|
message: "request is not implemented"
|
|
@@ -594,9 +584,23 @@ export const devWarn = {
|
|
|
594
584
|
message: "The '%s' field on object %o returned `undefined` instead of a value. The parent resolver did not include the property in the returned value and there was no resolver defined for the field."
|
|
595
585
|
},
|
|
596
586
|
|
|
587
|
+
56: {
|
|
588
|
+
file: "@apollo/client/__cjs/link/ws/index.cjs",
|
|
589
|
+
message: "`WebSocketLink` uses the deprecated and unmaintained `subscriptions-transport-ws` library. This link is no longer maintained and will be removed in a future major version of Apollo Client. We recommend switching to `GraphQLWsLink` which uses the `graphql-ws` library to send GraphQL operations through WebSocket connections (https://the-guild.dev/graphql/ws)."
|
|
590
|
+
},
|
|
591
|
+
|
|
592
|
+
61: {
|
|
593
|
+
file: "@apollo/client/__cjs/link/core/ApolloLink.cjs",
|
|
594
|
+
message: "[ApolloLink.split]: The test function returned a non-boolean value which could result in subtle bugs (e.g. such as using an `async` function which always returns a truthy value). Got `%o`."
|
|
595
|
+
},
|
|
596
|
+
|
|
597
597
|
62: {
|
|
598
598
|
file: "@apollo/client/__cjs/link/core/ApolloLink.cjs",
|
|
599
|
-
|
|
599
|
+
|
|
600
|
+
message: "The terminating link provided to `ApolloLink.execute` called `forward` instead of handling the request. " +
|
|
601
|
+
"This results in an observable that immediately completes and does not emit a value. " +
|
|
602
|
+
"Please provide a terminating link that properly handles the request.\n\n" +
|
|
603
|
+
"If you are using a split link, ensure each branch contains a terminating link that handles the request."
|
|
600
604
|
},
|
|
601
605
|
|
|
602
606
|
77: {
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BatchLink =
|
|
3
|
+
exports.BatchLink = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
4
5
|
const link_1 = require("@apollo/client/link");
|
|
5
6
|
const batching_js_1 = require("./batching.cjs");
|
|
6
|
-
var batching_js_2 = require("./batching.cjs");
|
|
7
|
-
Object.defineProperty(exports, "OperationBatcher", { enumerable: true, get: function () { return batching_js_2.OperationBatcher; } });
|
|
8
7
|
class BatchLink extends link_1.ApolloLink {
|
|
9
8
|
batcher;
|
|
10
9
|
constructor(fetchParams) {
|
|
11
10
|
super();
|
|
12
|
-
const { batchDebounce, batchInterval = 10, batchMax = 0, batchHandler = () =>
|
|
11
|
+
const { batchDebounce, batchInterval = 10, batchMax = 0, batchHandler = () => rxjs_1.EMPTY, batchKey = () => "", } = fetchParams || {};
|
|
13
12
|
this.batcher = new batching_js_1.OperationBatcher({
|
|
14
13
|
batchDebounce,
|
|
15
14
|
batchInterval,
|
|
@@ -17,16 +16,9 @@ class BatchLink extends link_1.ApolloLink {
|
|
|
17
16
|
batchHandler,
|
|
18
17
|
batchKey,
|
|
19
18
|
});
|
|
20
|
-
//make this link terminating
|
|
21
|
-
if (fetchParams.batchHandler.length <= 1) {
|
|
22
|
-
this.request = (operation) => this.batcher.enqueueRequest({ operation });
|
|
23
|
-
}
|
|
24
19
|
}
|
|
25
20
|
request(operation, forward) {
|
|
26
|
-
return this.batcher.enqueueRequest({
|
|
27
|
-
operation,
|
|
28
|
-
forward,
|
|
29
|
-
});
|
|
21
|
+
return this.batcher.enqueueRequest({ operation, forward });
|
|
30
22
|
}
|
|
31
23
|
}
|
|
32
24
|
exports.BatchLink = BatchLink;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batchLink.cjs","sources":["../../../../src/link/batch/batchLink.ts"],"sourcesContent":["import type { Observable } from \"rxjs\";\
|
|
1
|
+
{"version":3,"file":"batchLink.cjs","sources":["../../../../src/link/batch/batchLink.ts"],"sourcesContent":["import type { Observable } from \"rxjs\";\nimport { EMPTY } from \"rxjs\";\n\nimport { ApolloLink } from \"@apollo/client/link\";\n\nimport { OperationBatcher } from \"./batching.js\";\n\nexport declare namespace BatchLink {\n export namespace Shared {\n /** These options are shared between `BatchLink` and `BatchHttpLink` */\n interface Options {\n /**\n * The interval at which to batch, in milliseconds.\n *\n * @defaultValue 10\n */\n batchInterval?: number;\n\n /**\n * \"batchInterval\" is a throttling behavior by default, if you instead wish\n * to debounce outbound requests, set \"batchDebounce\" to true. More useful\n * for mutations than queries.\n */\n batchDebounce?: boolean;\n\n /**\n * The maximum number of operations to include in a single batch.\n *\n * @defaultValue \\{\\{defaultValue\\}\\}\n */\n batchMax?: number;\n\n /**\n * Creates the key for a batch\n */\n batchKey?: (operation: ApolloLink.Operation) => string;\n }\n }\n\n export type BatchHandler = (\n operations: ApolloLink.Operation[],\n forward: ApolloLink.ForwardFunction[]\n ) => Observable<ApolloLink.Result[]>;\n\n export interface Options extends Shared.Options {\n /**\n * The handler that should execute a batch of operations.\n */\n batchHandler?: BatchLink.BatchHandler;\n\n /** {@inheritDoc @apollo/client/link/batch!BatchLink.Shared.Options#batchMax:member {\"defaultValue\": 0}} */\n batchMax?: number;\n }\n}\n\nexport class BatchLink extends ApolloLink {\n private batcher: OperationBatcher;\n\n constructor(fetchParams?: BatchLink.Options) {\n super();\n\n const {\n batchDebounce,\n batchInterval = 10,\n batchMax = 0,\n batchHandler = () => EMPTY,\n batchKey = () => \"\",\n } = fetchParams || {};\n\n this.batcher = new OperationBatcher({\n batchDebounce,\n batchInterval,\n batchMax,\n batchHandler,\n batchKey,\n });\n }\n\n public request(\n operation: ApolloLink.Operation,\n forward: ApolloLink.ForwardFunction\n ): Observable<ApolloLink.Result> {\n return this.batcher.enqueueRequest({ operation, forward });\n }\n}\n"],"names":[],"mappings":";;;AACA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA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,CAEuC,EAFvC;QAII,CAAJ,CAAA,CAAA,CAAA,CAAA,EAAW,CAAX,CAAA,CAAA,CAAe,CAAC,CAAhB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuB,CAAC,CAAxB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsC,CAAC,EAAE,CAAzC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkD,EAAE,CAApD,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAA6D,CAAC;IAC5D;AACF;AA7BA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
|
|
@@ -1,42 +1,50 @@
|
|
|
1
1
|
import type { Observable } from "rxjs";
|
|
2
|
-
import type { FetchResult, NextLink, Operation } from "@apollo/client/link";
|
|
3
2
|
import { ApolloLink } from "@apollo/client/link";
|
|
4
|
-
import type { BatchHandler } from "./batching.cjs";
|
|
5
|
-
export type { BatchableRequest, BatchHandler } from "./batching.cjs";
|
|
6
|
-
export { OperationBatcher } from "./batching.cjs";
|
|
7
3
|
export declare namespace BatchLink {
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
4
|
+
namespace Shared {
|
|
5
|
+
/** These options are shared between `BatchLink` and `BatchHttpLink` */
|
|
6
|
+
interface Options {
|
|
7
|
+
/**
|
|
8
|
+
* The interval at which to batch, in milliseconds.
|
|
9
|
+
*
|
|
10
|
+
* @defaultValue 10
|
|
11
|
+
*/
|
|
12
|
+
batchInterval?: number;
|
|
13
|
+
/**
|
|
14
|
+
* "batchInterval" is a throttling behavior by default, if you instead wish
|
|
15
|
+
* to debounce outbound requests, set "batchDebounce" to true. More useful
|
|
16
|
+
* for mutations than queries.
|
|
17
|
+
*/
|
|
18
|
+
batchDebounce?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The maximum number of operations to include in a single batch.
|
|
21
|
+
*
|
|
22
|
+
* @defaultValue \{\{defaultValue\}\}
|
|
23
|
+
*/
|
|
24
|
+
batchMax?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Creates the key for a batch
|
|
27
|
+
*/
|
|
28
|
+
batchKey?: (operation: ApolloLink.Operation) => string;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
type BatchHandler = (operations: ApolloLink.Operation[], forward: ApolloLink.ForwardFunction[]) => Observable<ApolloLink.Result[]>;
|
|
32
|
+
interface Options extends Shared.Options {
|
|
27
33
|
/**
|
|
28
34
|
* The handler that should execute a batch of operations.
|
|
29
35
|
*/
|
|
30
|
-
batchHandler?: BatchHandler;
|
|
36
|
+
batchHandler?: BatchLink.BatchHandler;
|
|
31
37
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
* The maximum number of operations to include in a single batch.
|
|
39
|
+
*
|
|
40
|
+
* @defaultValue 0
|
|
41
|
+
*/
|
|
42
|
+
batchMax?: number;
|
|
35
43
|
}
|
|
36
44
|
}
|
|
37
45
|
export declare class BatchLink extends ApolloLink {
|
|
38
46
|
private batcher;
|
|
39
47
|
constructor(fetchParams?: BatchLink.Options);
|
|
40
|
-
request(operation: Operation, forward
|
|
48
|
+
request(operation: ApolloLink.Operation, forward: ApolloLink.ForwardFunction): Observable<ApolloLink.Result>;
|
|
41
49
|
}
|
|
42
50
|
//# sourceMappingURL=batchLink.d.cts.map
|
|
@@ -106,7 +106,7 @@ class OperationBatcher {
|
|
|
106
106
|
errors.push(request.error);
|
|
107
107
|
completes.push(request.complete);
|
|
108
108
|
});
|
|
109
|
-
const batchedObservable = this.batchHandler(operations, forwards)
|
|
109
|
+
const batchedObservable = this.batchHandler(operations, forwards);
|
|
110
110
|
const onError = (error) => {
|
|
111
111
|
//each callback list in batch
|
|
112
112
|
errors.forEach((rejecters) => {
|