@apollo/client 4.4.0-alpha.0 → 4.4.0-alpha.1
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 +39 -0
- package/__cjs/cache/core/cache.cjs +50 -15
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +22 -4
- package/__cjs/cache/index.cjs.map +1 -1
- package/__cjs/cache/index.d.cts +1 -1
- package/__cjs/cache/inmemory/entityStore.cjs +4 -4
- package/__cjs/cache/inmemory/helpers.cjs +12 -0
- package/__cjs/cache/inmemory/helpers.cjs.map +1 -1
- package/__cjs/cache/inmemory/helpers.d.cts +10 -5
- package/__cjs/cache/inmemory/inMemoryCache.cjs +13 -2
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.d.cts +19 -4
- package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
- package/__cjs/cache/inmemory/policies.cjs +7 -7
- package/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/__cjs/cache/inmemory/readFromStore.cjs +86 -31
- package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/types.d.cts +11 -2
- package/__cjs/cache/inmemory/writeToStore.cjs +27 -24
- package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/writeToStore.d.cts +5 -4
- package/__cjs/core/ApolloClient.cjs +19 -15
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +1 -0
- package/__cjs/core/ObservableQuery.cjs +8 -8
- package/__cjs/core/QueryInfo.cjs +1 -1
- package/__cjs/core/QueryManager.cjs +12 -12
- package/__cjs/core/RefetchEventManager.cjs +3 -3
- package/__cjs/errors/CombinedGraphQLErrors.cjs +3 -7
- package/__cjs/errors/CombinedGraphQLErrors.cjs.map +1 -1
- package/__cjs/errors/CombinedGraphQLErrors.d.cts +2 -2
- package/__cjs/errors/CombinedProtocolErrors.cjs +3 -8
- package/__cjs/errors/CombinedProtocolErrors.cjs.map +1 -1
- package/__cjs/errors/CombinedProtocolErrors.d.cts +2 -2
- package/__cjs/incremental/handlers/graphql17Alpha9.cjs +2 -2
- package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
- package/__cjs/invariantErrorCodes.cjs +125 -120
- package/__cjs/link/core/ApolloLink.cjs +3 -3
- package/__cjs/link/http/checkFetcher.cjs +1 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
- package/__cjs/link/persisted-queries/index.cjs +2 -2
- package/__cjs/link/ws/index.cjs +1 -1
- package/__cjs/local-state/LocalState.cjs +23 -22
- package/__cjs/local-state/LocalState.cjs.map +1 -1
- package/__cjs/masking/maskDefinition.cjs +20 -2
- package/__cjs/masking/maskDefinition.cjs.map +1 -1
- package/__cjs/masking/maskFragment.cjs +2 -2
- package/__cjs/masking/maskOperation.cjs +1 -1
- package/__cjs/masking/utils.cjs +3 -3
- package/__cjs/react/context/ApolloContext.cjs +1 -1
- package/__cjs/react/context/ApolloProvider.cjs +1 -1
- package/__cjs/react/hooks/internal/validateSuspenseHookOptions.cjs +2 -2
- package/__cjs/react/hooks/useApolloClient.cjs +1 -1
- package/__cjs/react/hooks/useFragment.cjs +8 -2
- package/__cjs/react/hooks/useFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.cjs +2 -2
- package/__cjs/react/hooks/useLoadableQuery.cjs +2 -2
- package/__cjs/react/hooks/useSubscription.cjs +1 -1
- package/__cjs/react/hooks/useSuspenseFragment.cjs +10 -4
- package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
- package/__cjs/react/internal/cache/FragmentReference.cjs +2 -2
- package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/FragmentReference.d.cts +4 -5
- package/__cjs/react/internal/cache/QueryReference.cjs +1 -1
- package/__cjs/react/internal/cache/SuspenseCache.cjs +3 -3
- package/__cjs/react/internal/cache/SuspenseCache.cjs.map +1 -1
- package/__cjs/react/internal/cache/SuspenseCache.d.cts +4 -5
- package/__cjs/react/internal/cache/types.d.cts +0 -5
- package/__cjs/react/ssr/prerenderStatic.cjs +2 -2
- package/__cjs/testing/core/mocking/mockLink.cjs +4 -4
- package/__cjs/utilities/graphql/DocumentTransform.cjs +1 -1
- package/__cjs/utilities/internal/DeepMerger.cjs +6 -2
- package/__cjs/utilities/internal/DeepMerger.cjs.map +1 -1
- package/__cjs/utilities/internal/DeepMerger.d.cts +13 -3
- package/__cjs/utilities/internal/constants.cjs +33 -1
- package/__cjs/utilities/internal/constants.cjs.map +1 -1
- package/__cjs/utilities/internal/constants.d.cts +32 -0
- package/__cjs/utilities/internal/createArgumentNode.cjs +14 -0
- package/__cjs/utilities/internal/createArgumentNode.cjs.map +1 -0
- package/__cjs/utilities/internal/createArgumentNode.d.cts +3 -0
- package/__cjs/utilities/internal/createDirectiveNode.cjs +14 -0
- package/__cjs/utilities/internal/createDirectiveNode.cjs.map +1 -0
- package/__cjs/utilities/internal/createDirectiveNode.d.cts +3 -0
- package/__cjs/utilities/internal/createFragmentSpreadNode.cjs +4 -1
- package/__cjs/utilities/internal/createFragmentSpreadNode.cjs.map +1 -1
- package/__cjs/utilities/internal/createFragmentSpreadNode.d.cts +3 -2
- package/__cjs/utilities/internal/createValueNode.cjs +27 -0
- package/__cjs/utilities/internal/createValueNode.cjs.map +1 -0
- package/__cjs/utilities/internal/createValueNode.d.cts +12 -0
- package/__cjs/utilities/internal/equalByQuery.cjs +8 -8
- package/__cjs/utilities/internal/equalByQuery.cjs.map +1 -1
- package/__cjs/utilities/internal/equalByQuery.d.cts +2 -3
- package/__cjs/utilities/internal/getFragmentDefinition.cjs +3 -3
- package/__cjs/utilities/internal/getFragmentDefinition.cjs.map +1 -1
- package/__cjs/utilities/internal/getFragmentFromSelection.cjs +1 -1
- package/__cjs/utilities/internal/getFragmentQueryDocument.cjs +10 -2
- package/__cjs/utilities/internal/getFragmentQueryDocument.cjs.map +1 -1
- package/__cjs/utilities/internal/getFragmentScope.cjs +23 -0
- package/__cjs/utilities/internal/getFragmentScope.cjs.map +1 -0
- package/__cjs/utilities/internal/getFragmentScope.d.cts +13 -0
- package/__cjs/utilities/internal/getFragmentVariables.cjs +14 -15
- package/__cjs/utilities/internal/getFragmentVariables.cjs.map +1 -1
- package/__cjs/utilities/internal/getFragmentVariables.d.cts +8 -4
- package/__cjs/utilities/internal/getMainDefinition.cjs +1 -1
- package/__cjs/utilities/internal/getQueryDefinition.cjs +1 -1
- package/__cjs/utilities/internal/index.cjs +9 -2
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +5 -1
- package/__cjs/utilities/internal/isNonEmptyObject.cjs +13 -0
- package/__cjs/utilities/internal/isNonEmptyObject.cjs.map +1 -0
- package/__cjs/utilities/internal/isNonEmptyObject.d.cts +7 -0
- package/__cjs/utilities/internal/isNonNullObject.cjs.map +1 -1
- package/__cjs/utilities/internal/isNonNullObject.d.cts +1 -1
- package/__cjs/utilities/internal/mapObservableFragment.cjs +14 -9
- package/__cjs/utilities/internal/mapObservableFragment.cjs.map +1 -1
- package/__cjs/utilities/internal/mapObservableFragment.d.cts +5 -1
- package/__cjs/utilities/internal/mergeDeepArray.cjs +2 -2
- package/__cjs/utilities/internal/mergeDeepArray.cjs.map +1 -1
- package/__cjs/utilities/internal/mergeDeepArray.d.cts +2 -1
- package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs +1 -1
- package/__cjs/utilities/internal/removeFragmentSpreads.cjs +55 -2
- package/__cjs/utilities/internal/removeFragmentSpreads.cjs.map +1 -1
- package/__cjs/utilities/internal/removeFragmentSpreads.d.cts +17 -1
- package/__cjs/utilities/internal/shouldInclude.cjs +4 -4
- package/__cjs/utilities/internal/types/FragmentInfo.cjs +3 -0
- package/__cjs/utilities/internal/types/FragmentInfo.cjs.map +1 -0
- package/__cjs/utilities/internal/types/FragmentInfo.d.cts +14 -0
- package/__cjs/utilities/internal/types/ObjectWithFragmentInfo.cjs +3 -0
- package/__cjs/utilities/internal/types/ObjectWithFragmentInfo.cjs.map +1 -0
- package/__cjs/utilities/internal/types/ObjectWithFragmentInfo.d.cts +13 -0
- package/__cjs/utilities/internal/valueToObjectRepresentation.cjs +1 -1
- package/__cjs/version.cjs +1 -1
- package/cache/core/cache.d.ts +22 -4
- package/cache/core/cache.js +51 -16
- package/cache/core/cache.js.map +1 -1
- package/cache/index.d.ts +1 -1
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.js +4 -4
- package/cache/inmemory/helpers.d.ts +10 -5
- package/cache/inmemory/helpers.js +12 -1
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +19 -4
- package/cache/inmemory/inMemoryCache.js +14 -3
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.js +7 -7
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.js +89 -34
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +11 -2
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +5 -4
- package/cache/inmemory/writeToStore.js +30 -27
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts +1 -0
- package/core/ApolloClient.js +20 -16
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.js +8 -8
- package/core/QueryInfo.js +1 -1
- package/core/QueryManager.js +12 -12
- package/core/RefetchEventManager.js +3 -3
- package/errors/CombinedGraphQLErrors.d.ts +2 -2
- package/errors/CombinedGraphQLErrors.js +3 -7
- package/errors/CombinedGraphQLErrors.js.map +1 -1
- package/errors/CombinedProtocolErrors.d.ts +2 -2
- package/errors/CombinedProtocolErrors.js +3 -8
- package/errors/CombinedProtocolErrors.js.map +1 -1
- package/incremental/handlers/graphql17Alpha9.js +2 -2
- package/incremental/handlers/notImplemented.js +1 -1
- package/invariantErrorCodes.js +125 -120
- package/link/core/ApolloLink.js +3 -3
- package/link/http/checkFetcher.js +1 -1
- package/link/http/parseAndCheckHttpResponse.js +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/ws/index.js +1 -1
- package/local-state/LocalState.js +24 -23
- package/local-state/LocalState.js.map +1 -1
- package/masking/maskDefinition.js +21 -3
- package/masking/maskDefinition.js.map +1 -1
- package/masking/maskFragment.js +2 -2
- package/masking/maskOperation.js +1 -1
- package/masking/utils.js +3 -3
- package/package.json +1 -1
- package/react/context/ApolloContext.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/hooks/internal/validateSuspenseHookOptions.js +2 -2
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useFragment.js +8 -2
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.js +2 -2
- package/react/hooks/useLoadableQuery.js +2 -2
- package/react/hooks/useSubscription.js +1 -1
- package/react/hooks/useSuspenseFragment.js +10 -4
- package/react/hooks/useSuspenseFragment.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/hooks-compiled/internal/validateSuspenseHookOptions.js +2 -2
- package/react/hooks-compiled/useApolloClient.js +1 -1
- package/react/hooks-compiled/useFragment.js +56 -32
- package/react/hooks-compiled/useFragment.js.map +1 -1
- package/react/hooks-compiled/useLazyQuery.js +2 -2
- package/react/hooks-compiled/useLoadableQuery.js +2 -2
- package/react/hooks-compiled/useSubscription.js +1 -1
- package/react/hooks-compiled/useSuspenseFragment.js +10 -4
- package/react/hooks-compiled/useSuspenseFragment.js.map +1 -1
- package/react/hooks-compiled/useSyncExternalStore.js +1 -1
- package/react/internal/cache/FragmentReference.d.ts +4 -5
- package/react/internal/cache/FragmentReference.js +2 -2
- package/react/internal/cache/FragmentReference.js.map +1 -1
- package/react/internal/cache/QueryReference.js +1 -1
- package/react/internal/cache/SuspenseCache.d.ts +4 -5
- package/react/internal/cache/SuspenseCache.js +3 -3
- package/react/internal/cache/SuspenseCache.js.map +1 -1
- package/react/internal/cache/types.d.ts +0 -5
- package/react/internal/cache/types.js.map +1 -1
- package/react/ssr/prerenderStatic.js +2 -2
- package/testing/core/mocking/mockLink.js +4 -4
- package/utilities/graphql/DocumentTransform.js +1 -1
- package/utilities/internal/DeepMerger.d.ts +13 -3
- package/utilities/internal/DeepMerger.js +6 -2
- package/utilities/internal/DeepMerger.js.map +1 -1
- package/utilities/internal/constants.d.ts +32 -0
- package/utilities/internal/constants.js +32 -0
- package/utilities/internal/constants.js.map +1 -1
- package/utilities/internal/createArgumentNode.d.ts +3 -0
- package/utilities/internal/createArgumentNode.js +11 -0
- package/utilities/internal/createArgumentNode.js.map +1 -0
- package/utilities/internal/createDirectiveNode.d.ts +3 -0
- package/utilities/internal/createDirectiveNode.js +11 -0
- package/utilities/internal/createDirectiveNode.js.map +1 -0
- package/utilities/internal/createFragmentSpreadNode.d.ts +3 -2
- package/utilities/internal/createFragmentSpreadNode.js +4 -1
- package/utilities/internal/createFragmentSpreadNode.js.map +1 -1
- package/utilities/internal/createValueNode.d.ts +12 -0
- package/utilities/internal/createValueNode.js +24 -0
- package/utilities/internal/createValueNode.js.map +1 -0
- package/utilities/internal/equalByQuery.d.ts +2 -3
- package/utilities/internal/equalByQuery.js +8 -8
- package/utilities/internal/equalByQuery.js.map +1 -1
- package/utilities/internal/getFragmentDefinition.js +3 -3
- package/utilities/internal/getFragmentDefinition.js.map +1 -1
- package/utilities/internal/getFragmentFromSelection.js +1 -1
- package/utilities/internal/getFragmentQueryDocument.js +10 -2
- package/utilities/internal/getFragmentQueryDocument.js.map +1 -1
- package/utilities/internal/getFragmentScope.d.ts +13 -0
- package/utilities/internal/getFragmentScope.js +20 -0
- package/utilities/internal/getFragmentScope.js.map +1 -0
- package/utilities/internal/getFragmentVariables.d.ts +9 -5
- package/utilities/internal/getFragmentVariables.js +15 -16
- package/utilities/internal/getFragmentVariables.js.map +1 -1
- package/utilities/internal/getMainDefinition.js +1 -1
- package/utilities/internal/getQueryDefinition.js +1 -1
- package/utilities/internal/index.d.ts +5 -1
- package/utilities/internal/index.js +3 -1
- package/utilities/internal/index.js.map +1 -1
- package/utilities/internal/isNonEmptyObject.d.ts +7 -0
- package/utilities/internal/isNonEmptyObject.js +10 -0
- package/utilities/internal/isNonEmptyObject.js.map +1 -0
- package/utilities/internal/isNonNullObject.d.ts +1 -1
- package/utilities/internal/isNonNullObject.js.map +1 -1
- package/utilities/internal/mapObservableFragment.d.ts +5 -1
- package/utilities/internal/mapObservableFragment.js +14 -9
- package/utilities/internal/mapObservableFragment.js.map +1 -1
- package/utilities/internal/mergeDeepArray.d.ts +2 -1
- package/utilities/internal/mergeDeepArray.js +2 -2
- package/utilities/internal/mergeDeepArray.js.map +1 -1
- package/utilities/internal/removeDirectivesFromDocument.js +1 -1
- package/utilities/internal/removeFragmentSpreads.d.ts +18 -2
- package/utilities/internal/removeFragmentSpreads.js +56 -3
- package/utilities/internal/removeFragmentSpreads.js.map +1 -1
- package/utilities/internal/shouldInclude.js +4 -4
- package/utilities/internal/types/FragmentInfo.d.ts +14 -0
- package/utilities/internal/types/FragmentInfo.js +2 -0
- package/utilities/internal/types/FragmentInfo.js.map +1 -0
- package/utilities/internal/types/ObjectWithFragmentInfo.d.ts +13 -0
- package/utilities/internal/types/ObjectWithFragmentInfo.js +2 -0
- package/utilities/internal/types/ObjectWithFragmentInfo.js.map +1 -0
- package/utilities/internal/valueToObjectRepresentation.js +1 -1
- package/version.js +1 -1
|
@@ -1448,6 +1448,7 @@ export declare class ApolloClient {
|
|
|
1448
1448
|
setLink(newLink: ApolloLink): void;
|
|
1449
1449
|
get defaultContext(): Partial<DefaultContext>;
|
|
1450
1450
|
private maskedFragmentTransform;
|
|
1451
|
+
private fragmentVariablesTransform;
|
|
1451
1452
|
private transform;
|
|
1452
1453
|
/**
|
|
1453
1454
|
* @experimental
|
|
@@ -110,7 +110,7 @@ class ObservableQuery {
|
|
|
110
110
|
// Make sure we don't store "standby" as the initialFetchPolicy.
|
|
111
111
|
initialFetchPolicy = fetchPolicy === "standby" ? defaultFetchPolicy : (fetchPolicy), } = options;
|
|
112
112
|
if (options[internal_1.variablesUnknownSymbol]) {
|
|
113
|
-
(0, invariant_1.invariant)(fetchPolicy === "standby",
|
|
113
|
+
(0, invariant_1.invariant)(fetchPolicy === "standby", 86);
|
|
114
114
|
this.variablesUnknown = true;
|
|
115
115
|
}
|
|
116
116
|
this.lastQuery = transformedQuery;
|
|
@@ -419,7 +419,7 @@ class ObservableQuery {
|
|
|
419
419
|
const queryDef = (0, internal_1.getQueryDefinition)(this.query);
|
|
420
420
|
const vars = queryDef.variableDefinitions;
|
|
421
421
|
if (!vars || !vars.some((v) => v.variable.name.value === "variables")) {
|
|
422
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
422
|
+
__DEV__ && invariant_1.invariant.warn(87, variables, queryDef.name?.value || queryDef);
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
if (variables && !(0, equality_1.equal)(this.variables, variables)) {
|
|
@@ -434,7 +434,7 @@ class ObservableQuery {
|
|
|
434
434
|
fetchMore({ query, variables, context, errorPolicy, updateQuery, }) {
|
|
435
435
|
(0, invariant_1.invariant)(
|
|
436
436
|
this.options.fetchPolicy !== "cache-only",
|
|
437
|
-
|
|
437
|
+
88,
|
|
438
438
|
(0, internal_1.getOperationName)(this.query, "(anonymous)")
|
|
439
439
|
);
|
|
440
440
|
const combinedOptions = {
|
|
@@ -468,7 +468,7 @@ class ObservableQuery {
|
|
|
468
468
|
let wasUpdated = false;
|
|
469
469
|
const isCached = this.options.fetchPolicy !== "no-cache";
|
|
470
470
|
if (!isCached) {
|
|
471
|
-
(0, invariant_1.invariant)(updateQuery,
|
|
471
|
+
(0, invariant_1.invariant)(updateQuery, 89);
|
|
472
472
|
}
|
|
473
473
|
const { finalize, pushNotification } = this.pushOperation(networkStatus_js_1.NetworkStatus.fetchMore);
|
|
474
474
|
pushNotification({
|
|
@@ -642,7 +642,7 @@ class ObservableQuery {
|
|
|
642
642
|
onError(error);
|
|
643
643
|
}
|
|
644
644
|
else {
|
|
645
|
-
invariant_1.invariant.error(
|
|
645
|
+
invariant_1.invariant.error(90, error);
|
|
646
646
|
}
|
|
647
647
|
return;
|
|
648
648
|
}
|
|
@@ -893,7 +893,7 @@ class ObservableQuery {
|
|
|
893
893
|
if (!this.didWarnCacheOnlyPolling &&
|
|
894
894
|
pollInterval &&
|
|
895
895
|
fetchPolicy === "cache-only") {
|
|
896
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
896
|
+
__DEV__ && invariant_1.invariant.warn(91, (0, internal_1.getOperationName)(this.query, "(anonymous)"));
|
|
897
897
|
this.didWarnCacheOnlyPolling = true;
|
|
898
898
|
}
|
|
899
899
|
}
|
|
@@ -1520,7 +1520,7 @@ class ObservableQuery {
|
|
|
1520
1520
|
exports.ObservableQuery = ObservableQuery;
|
|
1521
1521
|
function logMissingFieldErrors(missing) {
|
|
1522
1522
|
if (environment_1.__DEV__ && missing) {
|
|
1523
|
-
__DEV__ && invariant_1.invariant.debug(
|
|
1523
|
+
__DEV__ && invariant_1.invariant.debug(92, missing);
|
|
1524
1524
|
}
|
|
1525
1525
|
}
|
|
1526
1526
|
function isEqualQuery(a, b) {
|
|
@@ -1565,7 +1565,7 @@ function getTrackingOperatorPromise(defaultValue) {
|
|
|
1565
1565
|
}
|
|
1566
1566
|
function warnOnFeud(query, diff) {
|
|
1567
1567
|
__DEV__ && invariant_1.invariant.warn(
|
|
1568
|
-
|
|
1568
|
+
93,
|
|
1569
1569
|
(0, internal_1.getOperationName)(query, "(anonymous)"),
|
|
1570
1570
|
diff.missing?.missing
|
|
1571
1571
|
);
|
package/__cjs/core/QueryInfo.cjs
CHANGED
|
@@ -363,7 +363,7 @@ class QueryInfo {
|
|
|
363
363
|
exports.QueryInfo = QueryInfo;
|
|
364
364
|
function warnAboutPartialCacheResult(query, networkResult, diff) {
|
|
365
365
|
__DEV__ && invariant_1.invariant.warn(
|
|
366
|
-
|
|
366
|
+
94,
|
|
367
367
|
(0, internal_1.getOperationName)(query, "(anonymous)"),
|
|
368
368
|
diff.missing?.missing,
|
|
369
369
|
networkResult,
|
|
@@ -106,7 +106,7 @@ class QueryManager {
|
|
|
106
106
|
*/
|
|
107
107
|
stop() {
|
|
108
108
|
this.obsQueries.forEach((oq) => oq.stop());
|
|
109
|
-
this.cancelPendingFetches((0, invariant_1.newInvariantError)(
|
|
109
|
+
this.cancelPendingFetches((0, invariant_1.newInvariantError)(95));
|
|
110
110
|
}
|
|
111
111
|
cancelPendingFetches(error) {
|
|
112
112
|
this.fetchCancelFns.forEach((cancel) => cancel(error));
|
|
@@ -121,7 +121,7 @@ class QueryManager {
|
|
|
121
121
|
if (environment_1.__DEV__) {
|
|
122
122
|
(0, invariant_1.invariant)(
|
|
123
123
|
this.localState,
|
|
124
|
-
|
|
124
|
+
96,
|
|
125
125
|
(0, internal_1.getOperationName)(mutation, "(anonymous)")
|
|
126
126
|
);
|
|
127
127
|
}
|
|
@@ -356,7 +356,7 @@ class QueryManager {
|
|
|
356
356
|
// depend on values that previously existed in the data portion of the
|
|
357
357
|
// store. So, we cancel the promises and observers that we have issued
|
|
358
358
|
// so far and not yet resolved (in the case of queries).
|
|
359
|
-
this.cancelPendingFetches((0, invariant_1.newInvariantError)(
|
|
359
|
+
this.cancelPendingFetches((0, invariant_1.newInvariantError)(97));
|
|
360
360
|
this.obsQueries.forEach((observableQuery) => {
|
|
361
361
|
// Set loading to true so listeners don't trigger unless they want
|
|
362
362
|
// results with partial data.
|
|
@@ -426,10 +426,10 @@ class QueryManager {
|
|
|
426
426
|
if (!included) {
|
|
427
427
|
const queryName = queryNames.get(nameOrQueryString);
|
|
428
428
|
if (queryName) {
|
|
429
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
429
|
+
__DEV__ && invariant_1.invariant.warn(98, queryName);
|
|
430
430
|
}
|
|
431
431
|
else {
|
|
432
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
432
|
+
__DEV__ && invariant_1.invariant.warn(99);
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
});
|
|
@@ -458,7 +458,7 @@ class QueryManager {
|
|
|
458
458
|
if (environment_1.__DEV__) {
|
|
459
459
|
(0, invariant_1.invariant)(
|
|
460
460
|
!this.getDocumentInfo(query).hasClientExports || this.localState,
|
|
461
|
-
|
|
461
|
+
100,
|
|
462
462
|
(0, internal_1.getOperationName)(query, "(anonymous)")
|
|
463
463
|
);
|
|
464
464
|
}
|
|
@@ -610,14 +610,14 @@ class QueryManager {
|
|
|
610
610
|
if (environment_1.__DEV__) {
|
|
611
611
|
(0, invariant_1.invariant)(
|
|
612
612
|
this.localState,
|
|
613
|
-
|
|
613
|
+
101,
|
|
614
614
|
operation[0].toUpperCase() + operation.slice(1),
|
|
615
615
|
operationName ?? "(anonymous)"
|
|
616
616
|
);
|
|
617
617
|
}
|
|
618
618
|
(0, invariant_1.invariant)(
|
|
619
619
|
!hasIncrementalDirective,
|
|
620
|
-
|
|
620
|
+
102,
|
|
621
621
|
operation[0].toUpperCase() + operation.slice(1),
|
|
622
622
|
operationName ?? "(anonymous)"
|
|
623
623
|
);
|
|
@@ -787,7 +787,7 @@ class QueryManager {
|
|
|
787
787
|
if (environment_1.__DEV__) {
|
|
788
788
|
(0, invariant_1.invariant)(
|
|
789
789
|
this.localState,
|
|
790
|
-
|
|
790
|
+
103,
|
|
791
791
|
(0, internal_1.getOperationName)(normalized.query, "(anonymous)")
|
|
792
792
|
);
|
|
793
793
|
}
|
|
@@ -963,7 +963,7 @@ class QueryManager {
|
|
|
963
963
|
!this.noCacheWarningsByCause.has(cause)) {
|
|
964
964
|
this.noCacheWarningsByCause.add(cause);
|
|
965
965
|
__DEV__ && invariant_1.invariant.warn(
|
|
966
|
-
|
|
966
|
+
104,
|
|
967
967
|
(0, internal_1.getOperationName)(document, `Unnamed ${operationType ?? "operation"}`)
|
|
968
968
|
);
|
|
969
969
|
}
|
|
@@ -1030,7 +1030,7 @@ class QueryManager {
|
|
|
1030
1030
|
if (environment_1.__DEV__) {
|
|
1031
1031
|
(0, invariant_1.invariant)(
|
|
1032
1032
|
this.localState,
|
|
1033
|
-
|
|
1033
|
+
105,
|
|
1034
1034
|
(0, internal_1.getOperationName)(query, "(anonymous)")
|
|
1035
1035
|
);
|
|
1036
1036
|
}
|
|
@@ -1154,7 +1154,7 @@ function validateDidEmitValue() {
|
|
|
1154
1154
|
didEmitValue = true;
|
|
1155
1155
|
},
|
|
1156
1156
|
complete() {
|
|
1157
|
-
(0, invariant_1.invariant)(didEmitValue,
|
|
1157
|
+
(0, invariant_1.invariant)(didEmitValue, 106);
|
|
1158
1158
|
},
|
|
1159
1159
|
});
|
|
1160
1160
|
}
|
|
@@ -34,7 +34,7 @@ class RefetchEventManager {
|
|
|
34
34
|
}
|
|
35
35
|
if (this.client) {
|
|
36
36
|
if (environment_1.__DEV__) {
|
|
37
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
37
|
+
__DEV__ && invariant_1.invariant.warn(107);
|
|
38
38
|
}
|
|
39
39
|
this.disconnect();
|
|
40
40
|
}
|
|
@@ -103,13 +103,13 @@ class RefetchEventManager {
|
|
|
103
103
|
const [payload] = args;
|
|
104
104
|
if (!this.client) {
|
|
105
105
|
if (environment_1.__DEV__) {
|
|
106
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
106
|
+
__DEV__ && invariant_1.invariant.warn(108, source);
|
|
107
107
|
}
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
110
|
if (!this.hasSource(source)) {
|
|
111
111
|
if (environment_1.__DEV__) {
|
|
112
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
112
|
+
__DEV__ && invariant_1.invariant.warn(109, source);
|
|
113
113
|
}
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
@@ -42,7 +42,7 @@ function defaultFormatMessage(errors) {
|
|
|
42
42
|
* }
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
|
-
class CombinedGraphQLErrors extends
|
|
45
|
+
class CombinedGraphQLErrors extends AggregateError {
|
|
46
46
|
/**
|
|
47
47
|
* A method that determines whether an error is a `CombinedGraphQLErrors`
|
|
48
48
|
* object. This method enables TypeScript to narrow the error type.
|
|
@@ -77,10 +77,6 @@ class CombinedGraphQLErrors extends Error {
|
|
|
77
77
|
*/
|
|
78
78
|
static formatMessage = defaultFormatMessage;
|
|
79
79
|
/**
|
|
80
|
-
* The raw list of GraphQL errors returned by the `errors` field in the GraphQL response.
|
|
81
|
-
*/
|
|
82
|
-
errors;
|
|
83
|
-
/**
|
|
84
80
|
* Partial data returned in the `data` field of the GraphQL response.
|
|
85
81
|
*/
|
|
86
82
|
data;
|
|
@@ -89,11 +85,11 @@ class CombinedGraphQLErrors extends Error {
|
|
|
89
85
|
*/
|
|
90
86
|
extensions;
|
|
91
87
|
constructor(result, errors = result.errors || []) {
|
|
92
|
-
super(CombinedGraphQLErrors.formatMessage(errors, {
|
|
88
|
+
super(errors, CombinedGraphQLErrors.formatMessage(errors, {
|
|
93
89
|
result,
|
|
94
90
|
defaultFormatMessage,
|
|
95
91
|
}));
|
|
96
|
-
this
|
|
92
|
+
Object.defineProperty(this, "errors", { enumerable: true });
|
|
97
93
|
this.data = result.data;
|
|
98
94
|
this.extensions = result.extensions;
|
|
99
95
|
this.name = "CombinedGraphQLErrors";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CombinedGraphQLErrors.cjs","sources":["../../../src/errors/CombinedGraphQLErrors.ts"],"sourcesContent":["import type { FormattedExecutionResult, GraphQLFormattedError } from \"graphql\";\n\nimport type { ApolloLink } from \"@apollo/client/link\";\n\nimport { brand, isBranded } from \"./utils.js\";\n\nexport declare namespace CombinedGraphQLErrors {\n export interface MessageFormatterOptions {\n /**\n * The raw result returned from the server.\n */\n result: ApolloLink.Result<unknown>;\n\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 * CombinedGraphQLErrors.formatMessage = (errors, { defaultFormatMessage }) => {\n * return `[GraphQL errors]: ${defaultFormatMessage(errors)}`;\n * };\n * ```\n */\n defaultFormatMessage: (\n errors: ReadonlyArray<GraphQLFormattedError>\n ) => string;\n }\n\n /**\n * By default, `CombinedGraphQLErrors` 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 * @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 { CombinedGraphQLErrors } from \"@apollo/client/errors\";\n *\n * CombinedGraphQLErrors.formatMessage = (errors) => {\n * return errors.map((error) => error.message).join(\", \");\n * };\n * ```\n *\n * @remarks\n *\n * See the [`formatMessage`](https://www.apollographql.com/docs/react/api/errors/CombinedGraphQLErrors#formatmessage) docs 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 * @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 `CombinedGraphQLErrors`\n * constructor to provide a formatted message as the `message` property of the\n * `CombinedGraphQLErrors` object. Follow the [\"Providing a custom message\n * formatter\"](https://www.apollographql.com/docs/react/api/errors/CombinedGraphQLErrors#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\n * the `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 GraphQL errors returned by the `errors` field in the GraphQL response.\n */\n readonly errors: ReadonlyArray<GraphQLFormattedError>;\n\n /**\n * Partial data returned in the `data` field of the GraphQL response.\n */\n readonly data: Record<string, unknown> | null | undefined;\n\n /**\n * Extensions returned by the `extensions` field in the GraphQL response.\n */\n readonly extensions: Record<string, unknown> | undefined;\n }\n\n /**\n * A method that determines whether an error is a `{{errorClass}}`\n * object. This method enables TypeScript to narrow the error type.\n *\n * @example\n *\n * ```ts\n * if ({{errorClass}}.is(error)) {\n * // TypeScript now knows `error` is a `{{errorClass}}` object\n * console.log(error.errors);\n * }\n * ```\n */\n function is(error: unknown): boolean;\n }\n}\n\nfunction defaultFormatMessage(errors: ReadonlyArray<GraphQLFormattedError>) {\n return (\n errors\n // Handle non-spec-compliant servers: See #1185\n .filter((e) => e)\n .map((e) => e.message || \"Error message not found.\")\n .join(\"\\n\")\n );\n}\n\n/**\n * Represents the combined list of GraphQL errors returned from the server in a\n * GraphQL response. This error type is used when your GraphQL operation returns\n * errors in the `errors` field of the response.\n *\n * @remarks\n *\n * When your GraphQL operation encounters errors on the server side (such as\n * resolver errors, validation errors, or syntax errors), the server returns\n * these errors in the `errors` array of the GraphQL response. Apollo Client\n * wraps these errors in a `CombinedGraphQLErrors` object, which provides access\n * to the individual errors while maintaining additional context about the\n * response.\n *\n * @example\n *\n * ```ts\n * import { CombinedGraphQLErrors } from \"@apollo/client/errors\";\n *\n * // Check if an error is a CombinedGraphQLErrors object\n * if (CombinedGraphQLErrors.is(error)) {\n * // Access individual GraphQL errors\n * error.errors.forEach((graphQLError) => {\n * console.log(graphQLError.message);\n * console.log(graphQLError.path);\n * console.log(graphQLError.locations);\n * });\n *\n * // Access the original GraphQL result\n * console.log(error.result);\n * }\n * ```\n */\nexport class CombinedGraphQLErrors extends Error {\n /**\n * {@inheritDoc @apollo/client!CombinedGraphQLErrors.DocumentationTypes.is:function(1) {\"errorClass\":\"CombinedGraphQLErrors\"}}\n */\n static is(error: unknown): error is CombinedGraphQLErrors {\n return isBranded(error, \"CombinedGraphQLErrors\");\n }\n\n /** {@inheritDoc @apollo/client!CombinedGraphQLErrors.DocumentationTypes.formatMessage:function(1)} */\n static formatMessage: CombinedGraphQLErrors.MessageFormatter =\n defaultFormatMessage;\n\n /** {@inheritDoc @apollo/client!CombinedGraphQLErrors.DocumentationTypes.InstanceProperties#errors:member} */\n readonly errors: ReadonlyArray<GraphQLFormattedError>;\n\n /** {@inheritDoc @apollo/client!CombinedGraphQLErrors.DocumentationTypes.InstanceProperties#data:member} */\n readonly data: Record<string, unknown> | null | undefined;\n\n /** {@inheritDoc @apollo/client!CombinedGraphQLErrors.DocumentationTypes.InstanceProperties#extensions:member} */\n readonly extensions: Record<string, unknown> | undefined;\n\n constructor(result: FormattedExecutionResult<any>);\n constructor(\n result: ApolloLink.Result<any>,\n errors: ReadonlyArray<GraphQLFormattedError>\n );\n\n constructor(\n result: ApolloLink.Result<any> | FormattedExecutionResult<any>,\n errors = (result as FormattedExecutionResult<any>).errors || []\n ) {\n super(\n CombinedGraphQLErrors.formatMessage(errors, {\n result,\n defaultFormatMessage,\n })\n );\n this.errors = errors;\n this.data = (result as Partial<FormattedExecutionResult>).data;\n this.extensions = (result as Partial<FormattedExecutionResult>).extensions;\n this.name = \"CombinedGraphQLErrors\";\n\n brand(this);\n Object.setPrototypeOf(this, CombinedGraphQLErrors.prototype);\n }\n}\n"],"names":[],"mappings":";;;AAIA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA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A,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuC;QAEnC,CAAJ,CAAA,EAAI,CAAJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAT,CAAU,CAAV,CAAA,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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqD,CAAC,CAAtD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA+D,CAAC;IAC9D;;AA5CF,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
|
+
{"version":3,"file":"CombinedGraphQLErrors.cjs","sources":["../../../src/errors/CombinedGraphQLErrors.ts"],"sourcesContent":["import type { FormattedExecutionResult, GraphQLFormattedError } from \"graphql\";\n\nimport type { ApolloLink } from \"@apollo/client/link\";\n\nimport { brand, isBranded } from \"./utils.js\";\n\nexport declare namespace CombinedGraphQLErrors {\n export interface MessageFormatterOptions {\n /**\n * The raw result returned from the server.\n */\n result: ApolloLink.Result<unknown>;\n\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 * CombinedGraphQLErrors.formatMessage = (errors, { defaultFormatMessage }) => {\n * return `[GraphQL errors]: ${defaultFormatMessage(errors)}`;\n * };\n * ```\n */\n defaultFormatMessage: (\n errors: ReadonlyArray<GraphQLFormattedError>\n ) => string;\n }\n\n /**\n * By default, `CombinedGraphQLErrors` 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 * @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 { CombinedGraphQLErrors } from \"@apollo/client/errors\";\n *\n * CombinedGraphQLErrors.formatMessage = (errors) => {\n * return errors.map((error) => error.message).join(\", \");\n * };\n * ```\n *\n * @remarks\n *\n * See the [`formatMessage`](https://www.apollographql.com/docs/react/api/errors/CombinedGraphQLErrors#formatmessage) docs 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 * @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 `CombinedGraphQLErrors`\n * constructor to provide a formatted message as the `message` property of the\n * `CombinedGraphQLErrors` object. Follow the [\"Providing a custom message\n * formatter\"](https://www.apollographql.com/docs/react/api/errors/CombinedGraphQLErrors#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\n * the `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 GraphQL errors returned by the `errors` field in the GraphQL response.\n */\n readonly errors: ReadonlyArray<GraphQLFormattedError>;\n\n /**\n * Partial data returned in the `data` field of the GraphQL response.\n */\n readonly data: Record<string, unknown> | null | undefined;\n\n /**\n * Extensions returned by the `extensions` field in the GraphQL response.\n */\n readonly extensions: Record<string, unknown> | undefined;\n }\n\n /**\n * A method that determines whether an error is a `{{errorClass}}`\n * object. This method enables TypeScript to narrow the error type.\n *\n * @example\n *\n * ```ts\n * if ({{errorClass}}.is(error)) {\n * // TypeScript now knows `error` is a `{{errorClass}}` object\n * console.log(error.errors);\n * }\n * ```\n */\n function is(error: unknown): boolean;\n }\n}\n\nfunction defaultFormatMessage(errors: ReadonlyArray<GraphQLFormattedError>) {\n return (\n errors\n // Handle non-spec-compliant servers: See #1185\n .filter((e) => e)\n .map((e) => e.message || \"Error message not found.\")\n .join(\"\\n\")\n );\n}\n\n/**\n * Represents the combined list of GraphQL errors returned from the server in a\n * GraphQL response. This error type is used when your GraphQL operation returns\n * errors in the `errors` field of the response.\n *\n * @remarks\n *\n * When your GraphQL operation encounters errors on the server side (such as\n * resolver errors, validation errors, or syntax errors), the server returns\n * these errors in the `errors` array of the GraphQL response. Apollo Client\n * wraps these errors in a `CombinedGraphQLErrors` object, which provides access\n * to the individual errors while maintaining additional context about the\n * response.\n *\n * @example\n *\n * ```ts\n * import { CombinedGraphQLErrors } from \"@apollo/client/errors\";\n *\n * // Check if an error is a CombinedGraphQLErrors object\n * if (CombinedGraphQLErrors.is(error)) {\n * // Access individual GraphQL errors\n * error.errors.forEach((graphQLError) => {\n * console.log(graphQLError.message);\n * console.log(graphQLError.path);\n * console.log(graphQLError.locations);\n * });\n *\n * // Access the original GraphQL result\n * console.log(error.result);\n * }\n * ```\n */\nexport class CombinedGraphQLErrors extends AggregateError {\n /**\n * {@inheritDoc @apollo/client!CombinedGraphQLErrors.DocumentationTypes.is:function(1) {\"errorClass\":\"CombinedGraphQLErrors\"}}\n */\n static is(error: unknown): error is CombinedGraphQLErrors {\n return isBranded(error, \"CombinedGraphQLErrors\");\n }\n\n /** {@inheritDoc @apollo/client!CombinedGraphQLErrors.DocumentationTypes.formatMessage:function(1)} */\n static formatMessage: CombinedGraphQLErrors.MessageFormatter =\n defaultFormatMessage;\n\n /** {@inheritDoc @apollo/client!CombinedGraphQLErrors.DocumentationTypes.InstanceProperties#errors:member} */\n declare errors: Array<GraphQLFormattedError>;\n\n /** {@inheritDoc @apollo/client!CombinedGraphQLErrors.DocumentationTypes.InstanceProperties#data:member} */\n readonly data: Record<string, unknown> | null | undefined;\n\n /** {@inheritDoc @apollo/client!CombinedGraphQLErrors.DocumentationTypes.InstanceProperties#extensions:member} */\n readonly extensions: Record<string, unknown> | undefined;\n\n constructor(result: FormattedExecutionResult<any>);\n constructor(\n result: ApolloLink.Result<any>,\n errors: ReadonlyArray<GraphQLFormattedError>\n );\n\n constructor(\n result: ApolloLink.Result<any> | FormattedExecutionResult<any>,\n errors: ReadonlyArray<GraphQLFormattedError> = (\n result as FormattedExecutionResult<any>\n ).errors || []\n ) {\n super(\n errors,\n CombinedGraphQLErrors.formatMessage(errors, {\n result,\n defaultFormatMessage,\n })\n );\n Object.defineProperty(this, \"errors\", { enumerable: true });\n this.data = (result as Partial<FormattedExecutionResult>).data;\n this.extensions = (result as Partial<FormattedExecutionResult>).extensions;\n this.name = \"CombinedGraphQLErrors\";\n\n brand(this);\n Object.setPrototypeOf(this, CombinedGraphQLErrors.prototype);\n }\n}\n"],"names":[],"mappings":";;;AAIA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA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A,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
|
|
@@ -141,7 +141,7 @@ export declare namespace CombinedGraphQLErrors {
|
|
|
141
141
|
* }
|
|
142
142
|
* ```
|
|
143
143
|
*/
|
|
144
|
-
export declare class CombinedGraphQLErrors extends
|
|
144
|
+
export declare class CombinedGraphQLErrors extends AggregateError {
|
|
145
145
|
/**
|
|
146
146
|
* A method that determines whether an error is a `CombinedGraphQLErrors`
|
|
147
147
|
* object. This method enables TypeScript to narrow the error type.
|
|
@@ -176,7 +176,7 @@ export declare class CombinedGraphQLErrors extends Error {
|
|
|
176
176
|
/**
|
|
177
177
|
* The raw list of GraphQL errors returned by the `errors` field in the GraphQL response.
|
|
178
178
|
*/
|
|
179
|
-
|
|
179
|
+
errors: Array<GraphQLFormattedError>;
|
|
180
180
|
/**
|
|
181
181
|
* Partial data returned in the `data` field of the GraphQL response.
|
|
182
182
|
*/
|
|
@@ -31,7 +31,7 @@ function defaultFormatMessage(errors) {
|
|
|
31
31
|
* }
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
|
-
class CombinedProtocolErrors extends
|
|
34
|
+
class CombinedProtocolErrors extends AggregateError {
|
|
35
35
|
/**
|
|
36
36
|
* A method that determines whether an error is a `CombinedProtocolErrors`
|
|
37
37
|
* object. This method enables TypeScript to narrow the error type.
|
|
@@ -65,17 +65,12 @@ class CombinedProtocolErrors extends Error {
|
|
|
65
65
|
* the message.
|
|
66
66
|
*/
|
|
67
67
|
static formatMessage = defaultFormatMessage;
|
|
68
|
-
/**
|
|
69
|
-
* The raw list of errors returned by the top-level `errors` field in the
|
|
70
|
-
* multipart HTTP subscription response.
|
|
71
|
-
*/
|
|
72
|
-
errors;
|
|
73
68
|
constructor(protocolErrors) {
|
|
74
|
-
super(CombinedProtocolErrors.formatMessage(protocolErrors, {
|
|
69
|
+
super(protocolErrors, CombinedProtocolErrors.formatMessage(protocolErrors, {
|
|
75
70
|
defaultFormatMessage,
|
|
76
71
|
}));
|
|
77
72
|
this.name = "CombinedProtocolErrors";
|
|
78
|
-
this
|
|
73
|
+
Object.defineProperty(this, "errors", { enumerable: true });
|
|
79
74
|
(0, utils_js_1.brand)(this);
|
|
80
75
|
Object.setPrototypeOf(this, CombinedProtocolErrors.prototype);
|
|
81
76
|
}
|
|
@@ -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,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,CAAA,CAAA,CAAQ,CAAC,CAAT,CAAA,CAAA,CAAA,CAAA,EAAA,EAAkB,CAAlB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgC;QAE5B,CAAJ,CAAA,EAAI,CAAJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAT,CAAU,CAAV,CAAA,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,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;"}
|
|
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 AggregateError {\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 declare errors: Array<GraphQLFormattedError>;\n\n constructor(\n protocolErrors:\n | Array<GraphQLFormattedError>\n | ReadonlyArray<GraphQLFormattedError>\n ) {\n super(\n protocolErrors,\n CombinedProtocolErrors.formatMessage(protocolErrors, {\n defaultFormatMessage,\n })\n );\n this.name = \"CombinedProtocolErrors\";\n Object.defineProperty(this, \"errors\", { enumerable: true });\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,CAAkE,CAAC,CAAC,CAApE,CAAA,CAAA,CAAwE,CAAC,CAAzE,CAA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D,EAAE,CAAxD,CAAA,CAAA,EAAA,CAA8D,CAAC;QAE3D,CAAJ,CAAA,EAAI,CAAJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAT,CAAU,CAAV,CAAA,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,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;;AAzCF,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;"}
|
|
@@ -108,7 +108,7 @@ export declare namespace CombinedProtocolErrors {
|
|
|
108
108
|
* }
|
|
109
109
|
* ```
|
|
110
110
|
*/
|
|
111
|
-
export declare class CombinedProtocolErrors extends
|
|
111
|
+
export declare class CombinedProtocolErrors extends AggregateError {
|
|
112
112
|
/**
|
|
113
113
|
* A method that determines whether an error is a `CombinedProtocolErrors`
|
|
114
114
|
* object. This method enables TypeScript to narrow the error type.
|
|
@@ -144,7 +144,7 @@ export declare class CombinedProtocolErrors extends Error {
|
|
|
144
144
|
* The raw list of errors returned by the top-level `errors` field in the
|
|
145
145
|
* multipart HTTP subscription response.
|
|
146
146
|
*/
|
|
147
|
-
|
|
147
|
+
errors: Array<GraphQLFormattedError>;
|
|
148
148
|
constructor(protocolErrors: Array<GraphQLFormattedError> | ReadonlyArray<GraphQLFormattedError>);
|
|
149
149
|
}
|
|
150
150
|
//# sourceMappingURL=CombinedProtocolErrors.d.cts.map
|
|
@@ -37,7 +37,7 @@ class IncrementalRequest {
|
|
|
37
37
|
const name = node.name.value;
|
|
38
38
|
if (name === "defer") {
|
|
39
39
|
const labelNode = node.arguments?.find((arg) => arg.name.value === "label");
|
|
40
|
-
(0, invariant_1.invariant)(labelNode && labelNode.value.kind === "StringValue",
|
|
40
|
+
(0, invariant_1.invariant)(labelNode && labelNode.value.kind === "StringValue", 69);
|
|
41
41
|
this.deferLabels.add(labelNode.value.value);
|
|
42
42
|
}
|
|
43
43
|
},
|
|
@@ -111,7 +111,7 @@ class IncrementalRequest {
|
|
|
111
111
|
if (hasIncrementalChunks(chunk)) {
|
|
112
112
|
for (const incremental of chunk.incremental) {
|
|
113
113
|
const pending = this.pendingMap.get(incremental.id);
|
|
114
|
-
(0, invariant_1.invariant)(pending,
|
|
114
|
+
(0, invariant_1.invariant)(pending, 70);
|
|
115
115
|
const path = pending.path.concat(incremental.subPath ?? []);
|
|
116
116
|
let data;
|
|
117
117
|
if ("items" in incremental) {
|
|
@@ -8,7 +8,7 @@ class NotImplementedHandler {
|
|
|
8
8
|
return false;
|
|
9
9
|
}
|
|
10
10
|
prepareRequest(request) {
|
|
11
|
-
(0, invariant_1.invariant)(!(0, internal_1.hasDirectives)(["defer", "stream"], request.query),
|
|
11
|
+
(0, invariant_1.invariant)(!(0, internal_1.hasDirectives)(["defer", "stream"], request.query), 71);
|
|
12
12
|
return request;
|
|
13
13
|
}
|
|
14
14
|
extractErrors() { }
|