@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.
Files changed (280) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/__cjs/cache/core/cache.cjs +50 -15
  3. package/__cjs/cache/core/cache.cjs.map +1 -1
  4. package/__cjs/cache/core/cache.d.cts +22 -4
  5. package/__cjs/cache/index.cjs.map +1 -1
  6. package/__cjs/cache/index.d.cts +1 -1
  7. package/__cjs/cache/inmemory/entityStore.cjs +4 -4
  8. package/__cjs/cache/inmemory/helpers.cjs +12 -0
  9. package/__cjs/cache/inmemory/helpers.cjs.map +1 -1
  10. package/__cjs/cache/inmemory/helpers.d.cts +10 -5
  11. package/__cjs/cache/inmemory/inMemoryCache.cjs +13 -2
  12. package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
  13. package/__cjs/cache/inmemory/inMemoryCache.d.cts +19 -4
  14. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  15. package/__cjs/cache/inmemory/policies.cjs +7 -7
  16. package/__cjs/cache/inmemory/policies.cjs.map +1 -1
  17. package/__cjs/cache/inmemory/readFromStore.cjs +86 -31
  18. package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
  19. package/__cjs/cache/inmemory/types.d.cts +11 -2
  20. package/__cjs/cache/inmemory/writeToStore.cjs +27 -24
  21. package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
  22. package/__cjs/cache/inmemory/writeToStore.d.cts +5 -4
  23. package/__cjs/core/ApolloClient.cjs +19 -15
  24. package/__cjs/core/ApolloClient.cjs.map +1 -1
  25. package/__cjs/core/ApolloClient.d.cts +1 -0
  26. package/__cjs/core/ObservableQuery.cjs +8 -8
  27. package/__cjs/core/QueryInfo.cjs +1 -1
  28. package/__cjs/core/QueryManager.cjs +12 -12
  29. package/__cjs/core/RefetchEventManager.cjs +3 -3
  30. package/__cjs/errors/CombinedGraphQLErrors.cjs +3 -7
  31. package/__cjs/errors/CombinedGraphQLErrors.cjs.map +1 -1
  32. package/__cjs/errors/CombinedGraphQLErrors.d.cts +2 -2
  33. package/__cjs/errors/CombinedProtocolErrors.cjs +3 -8
  34. package/__cjs/errors/CombinedProtocolErrors.cjs.map +1 -1
  35. package/__cjs/errors/CombinedProtocolErrors.d.cts +2 -2
  36. package/__cjs/incremental/handlers/graphql17Alpha9.cjs +2 -2
  37. package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
  38. package/__cjs/invariantErrorCodes.cjs +125 -120
  39. package/__cjs/link/core/ApolloLink.cjs +3 -3
  40. package/__cjs/link/http/checkFetcher.cjs +1 -1
  41. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
  42. package/__cjs/link/persisted-queries/index.cjs +2 -2
  43. package/__cjs/link/ws/index.cjs +1 -1
  44. package/__cjs/local-state/LocalState.cjs +23 -22
  45. package/__cjs/local-state/LocalState.cjs.map +1 -1
  46. package/__cjs/masking/maskDefinition.cjs +20 -2
  47. package/__cjs/masking/maskDefinition.cjs.map +1 -1
  48. package/__cjs/masking/maskFragment.cjs +2 -2
  49. package/__cjs/masking/maskOperation.cjs +1 -1
  50. package/__cjs/masking/utils.cjs +3 -3
  51. package/__cjs/react/context/ApolloContext.cjs +1 -1
  52. package/__cjs/react/context/ApolloProvider.cjs +1 -1
  53. package/__cjs/react/hooks/internal/validateSuspenseHookOptions.cjs +2 -2
  54. package/__cjs/react/hooks/useApolloClient.cjs +1 -1
  55. package/__cjs/react/hooks/useFragment.cjs +8 -2
  56. package/__cjs/react/hooks/useFragment.cjs.map +1 -1
  57. package/__cjs/react/hooks/useLazyQuery.cjs +2 -2
  58. package/__cjs/react/hooks/useLoadableQuery.cjs +2 -2
  59. package/__cjs/react/hooks/useSubscription.cjs +1 -1
  60. package/__cjs/react/hooks/useSuspenseFragment.cjs +10 -4
  61. package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
  62. package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
  63. package/__cjs/react/internal/cache/FragmentReference.cjs +2 -2
  64. package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
  65. package/__cjs/react/internal/cache/FragmentReference.d.cts +4 -5
  66. package/__cjs/react/internal/cache/QueryReference.cjs +1 -1
  67. package/__cjs/react/internal/cache/SuspenseCache.cjs +3 -3
  68. package/__cjs/react/internal/cache/SuspenseCache.cjs.map +1 -1
  69. package/__cjs/react/internal/cache/SuspenseCache.d.cts +4 -5
  70. package/__cjs/react/internal/cache/types.d.cts +0 -5
  71. package/__cjs/react/ssr/prerenderStatic.cjs +2 -2
  72. package/__cjs/testing/core/mocking/mockLink.cjs +4 -4
  73. package/__cjs/utilities/graphql/DocumentTransform.cjs +1 -1
  74. package/__cjs/utilities/internal/DeepMerger.cjs +6 -2
  75. package/__cjs/utilities/internal/DeepMerger.cjs.map +1 -1
  76. package/__cjs/utilities/internal/DeepMerger.d.cts +13 -3
  77. package/__cjs/utilities/internal/constants.cjs +33 -1
  78. package/__cjs/utilities/internal/constants.cjs.map +1 -1
  79. package/__cjs/utilities/internal/constants.d.cts +32 -0
  80. package/__cjs/utilities/internal/createArgumentNode.cjs +14 -0
  81. package/__cjs/utilities/internal/createArgumentNode.cjs.map +1 -0
  82. package/__cjs/utilities/internal/createArgumentNode.d.cts +3 -0
  83. package/__cjs/utilities/internal/createDirectiveNode.cjs +14 -0
  84. package/__cjs/utilities/internal/createDirectiveNode.cjs.map +1 -0
  85. package/__cjs/utilities/internal/createDirectiveNode.d.cts +3 -0
  86. package/__cjs/utilities/internal/createFragmentSpreadNode.cjs +4 -1
  87. package/__cjs/utilities/internal/createFragmentSpreadNode.cjs.map +1 -1
  88. package/__cjs/utilities/internal/createFragmentSpreadNode.d.cts +3 -2
  89. package/__cjs/utilities/internal/createValueNode.cjs +27 -0
  90. package/__cjs/utilities/internal/createValueNode.cjs.map +1 -0
  91. package/__cjs/utilities/internal/createValueNode.d.cts +12 -0
  92. package/__cjs/utilities/internal/equalByQuery.cjs +8 -8
  93. package/__cjs/utilities/internal/equalByQuery.cjs.map +1 -1
  94. package/__cjs/utilities/internal/equalByQuery.d.cts +2 -3
  95. package/__cjs/utilities/internal/getFragmentDefinition.cjs +3 -3
  96. package/__cjs/utilities/internal/getFragmentDefinition.cjs.map +1 -1
  97. package/__cjs/utilities/internal/getFragmentFromSelection.cjs +1 -1
  98. package/__cjs/utilities/internal/getFragmentQueryDocument.cjs +10 -2
  99. package/__cjs/utilities/internal/getFragmentQueryDocument.cjs.map +1 -1
  100. package/__cjs/utilities/internal/getFragmentScope.cjs +23 -0
  101. package/__cjs/utilities/internal/getFragmentScope.cjs.map +1 -0
  102. package/__cjs/utilities/internal/getFragmentScope.d.cts +13 -0
  103. package/__cjs/utilities/internal/getFragmentVariables.cjs +14 -15
  104. package/__cjs/utilities/internal/getFragmentVariables.cjs.map +1 -1
  105. package/__cjs/utilities/internal/getFragmentVariables.d.cts +8 -4
  106. package/__cjs/utilities/internal/getMainDefinition.cjs +1 -1
  107. package/__cjs/utilities/internal/getQueryDefinition.cjs +1 -1
  108. package/__cjs/utilities/internal/index.cjs +9 -2
  109. package/__cjs/utilities/internal/index.cjs.map +1 -1
  110. package/__cjs/utilities/internal/index.d.cts +5 -1
  111. package/__cjs/utilities/internal/isNonEmptyObject.cjs +13 -0
  112. package/__cjs/utilities/internal/isNonEmptyObject.cjs.map +1 -0
  113. package/__cjs/utilities/internal/isNonEmptyObject.d.cts +7 -0
  114. package/__cjs/utilities/internal/isNonNullObject.cjs.map +1 -1
  115. package/__cjs/utilities/internal/isNonNullObject.d.cts +1 -1
  116. package/__cjs/utilities/internal/mapObservableFragment.cjs +14 -9
  117. package/__cjs/utilities/internal/mapObservableFragment.cjs.map +1 -1
  118. package/__cjs/utilities/internal/mapObservableFragment.d.cts +5 -1
  119. package/__cjs/utilities/internal/mergeDeepArray.cjs +2 -2
  120. package/__cjs/utilities/internal/mergeDeepArray.cjs.map +1 -1
  121. package/__cjs/utilities/internal/mergeDeepArray.d.cts +2 -1
  122. package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs +1 -1
  123. package/__cjs/utilities/internal/removeFragmentSpreads.cjs +55 -2
  124. package/__cjs/utilities/internal/removeFragmentSpreads.cjs.map +1 -1
  125. package/__cjs/utilities/internal/removeFragmentSpreads.d.cts +17 -1
  126. package/__cjs/utilities/internal/shouldInclude.cjs +4 -4
  127. package/__cjs/utilities/internal/types/FragmentInfo.cjs +3 -0
  128. package/__cjs/utilities/internal/types/FragmentInfo.cjs.map +1 -0
  129. package/__cjs/utilities/internal/types/FragmentInfo.d.cts +14 -0
  130. package/__cjs/utilities/internal/types/ObjectWithFragmentInfo.cjs +3 -0
  131. package/__cjs/utilities/internal/types/ObjectWithFragmentInfo.cjs.map +1 -0
  132. package/__cjs/utilities/internal/types/ObjectWithFragmentInfo.d.cts +13 -0
  133. package/__cjs/utilities/internal/valueToObjectRepresentation.cjs +1 -1
  134. package/__cjs/version.cjs +1 -1
  135. package/cache/core/cache.d.ts +22 -4
  136. package/cache/core/cache.js +51 -16
  137. package/cache/core/cache.js.map +1 -1
  138. package/cache/index.d.ts +1 -1
  139. package/cache/index.js.map +1 -1
  140. package/cache/inmemory/entityStore.js +4 -4
  141. package/cache/inmemory/helpers.d.ts +10 -5
  142. package/cache/inmemory/helpers.js +12 -1
  143. package/cache/inmemory/helpers.js.map +1 -1
  144. package/cache/inmemory/inMemoryCache.d.ts +19 -4
  145. package/cache/inmemory/inMemoryCache.js +14 -3
  146. package/cache/inmemory/inMemoryCache.js.map +1 -1
  147. package/cache/inmemory/key-extractor.js +1 -1
  148. package/cache/inmemory/policies.js +7 -7
  149. package/cache/inmemory/policies.js.map +1 -1
  150. package/cache/inmemory/readFromStore.js +89 -34
  151. package/cache/inmemory/readFromStore.js.map +1 -1
  152. package/cache/inmemory/types.d.ts +11 -2
  153. package/cache/inmemory/types.js.map +1 -1
  154. package/cache/inmemory/writeToStore.d.ts +5 -4
  155. package/cache/inmemory/writeToStore.js +30 -27
  156. package/cache/inmemory/writeToStore.js.map +1 -1
  157. package/core/ApolloClient.d.ts +1 -0
  158. package/core/ApolloClient.js +20 -16
  159. package/core/ApolloClient.js.map +1 -1
  160. package/core/ObservableQuery.js +8 -8
  161. package/core/QueryInfo.js +1 -1
  162. package/core/QueryManager.js +12 -12
  163. package/core/RefetchEventManager.js +3 -3
  164. package/errors/CombinedGraphQLErrors.d.ts +2 -2
  165. package/errors/CombinedGraphQLErrors.js +3 -7
  166. package/errors/CombinedGraphQLErrors.js.map +1 -1
  167. package/errors/CombinedProtocolErrors.d.ts +2 -2
  168. package/errors/CombinedProtocolErrors.js +3 -8
  169. package/errors/CombinedProtocolErrors.js.map +1 -1
  170. package/incremental/handlers/graphql17Alpha9.js +2 -2
  171. package/incremental/handlers/notImplemented.js +1 -1
  172. package/invariantErrorCodes.js +125 -120
  173. package/link/core/ApolloLink.js +3 -3
  174. package/link/http/checkFetcher.js +1 -1
  175. package/link/http/parseAndCheckHttpResponse.js +1 -1
  176. package/link/persisted-queries/index.js +2 -2
  177. package/link/ws/index.js +1 -1
  178. package/local-state/LocalState.js +24 -23
  179. package/local-state/LocalState.js.map +1 -1
  180. package/masking/maskDefinition.js +21 -3
  181. package/masking/maskDefinition.js.map +1 -1
  182. package/masking/maskFragment.js +2 -2
  183. package/masking/maskOperation.js +1 -1
  184. package/masking/utils.js +3 -3
  185. package/package.json +1 -1
  186. package/react/context/ApolloContext.js +1 -1
  187. package/react/context/ApolloProvider.js +1 -1
  188. package/react/hooks/internal/validateSuspenseHookOptions.js +2 -2
  189. package/react/hooks/useApolloClient.js +1 -1
  190. package/react/hooks/useFragment.js +8 -2
  191. package/react/hooks/useFragment.js.map +1 -1
  192. package/react/hooks/useLazyQuery.js +2 -2
  193. package/react/hooks/useLoadableQuery.js +2 -2
  194. package/react/hooks/useSubscription.js +1 -1
  195. package/react/hooks/useSuspenseFragment.js +10 -4
  196. package/react/hooks/useSuspenseFragment.js.map +1 -1
  197. package/react/hooks/useSyncExternalStore.js +1 -1
  198. package/react/hooks-compiled/internal/validateSuspenseHookOptions.js +2 -2
  199. package/react/hooks-compiled/useApolloClient.js +1 -1
  200. package/react/hooks-compiled/useFragment.js +56 -32
  201. package/react/hooks-compiled/useFragment.js.map +1 -1
  202. package/react/hooks-compiled/useLazyQuery.js +2 -2
  203. package/react/hooks-compiled/useLoadableQuery.js +2 -2
  204. package/react/hooks-compiled/useSubscription.js +1 -1
  205. package/react/hooks-compiled/useSuspenseFragment.js +10 -4
  206. package/react/hooks-compiled/useSuspenseFragment.js.map +1 -1
  207. package/react/hooks-compiled/useSyncExternalStore.js +1 -1
  208. package/react/internal/cache/FragmentReference.d.ts +4 -5
  209. package/react/internal/cache/FragmentReference.js +2 -2
  210. package/react/internal/cache/FragmentReference.js.map +1 -1
  211. package/react/internal/cache/QueryReference.js +1 -1
  212. package/react/internal/cache/SuspenseCache.d.ts +4 -5
  213. package/react/internal/cache/SuspenseCache.js +3 -3
  214. package/react/internal/cache/SuspenseCache.js.map +1 -1
  215. package/react/internal/cache/types.d.ts +0 -5
  216. package/react/internal/cache/types.js.map +1 -1
  217. package/react/ssr/prerenderStatic.js +2 -2
  218. package/testing/core/mocking/mockLink.js +4 -4
  219. package/utilities/graphql/DocumentTransform.js +1 -1
  220. package/utilities/internal/DeepMerger.d.ts +13 -3
  221. package/utilities/internal/DeepMerger.js +6 -2
  222. package/utilities/internal/DeepMerger.js.map +1 -1
  223. package/utilities/internal/constants.d.ts +32 -0
  224. package/utilities/internal/constants.js +32 -0
  225. package/utilities/internal/constants.js.map +1 -1
  226. package/utilities/internal/createArgumentNode.d.ts +3 -0
  227. package/utilities/internal/createArgumentNode.js +11 -0
  228. package/utilities/internal/createArgumentNode.js.map +1 -0
  229. package/utilities/internal/createDirectiveNode.d.ts +3 -0
  230. package/utilities/internal/createDirectiveNode.js +11 -0
  231. package/utilities/internal/createDirectiveNode.js.map +1 -0
  232. package/utilities/internal/createFragmentSpreadNode.d.ts +3 -2
  233. package/utilities/internal/createFragmentSpreadNode.js +4 -1
  234. package/utilities/internal/createFragmentSpreadNode.js.map +1 -1
  235. package/utilities/internal/createValueNode.d.ts +12 -0
  236. package/utilities/internal/createValueNode.js +24 -0
  237. package/utilities/internal/createValueNode.js.map +1 -0
  238. package/utilities/internal/equalByQuery.d.ts +2 -3
  239. package/utilities/internal/equalByQuery.js +8 -8
  240. package/utilities/internal/equalByQuery.js.map +1 -1
  241. package/utilities/internal/getFragmentDefinition.js +3 -3
  242. package/utilities/internal/getFragmentDefinition.js.map +1 -1
  243. package/utilities/internal/getFragmentFromSelection.js +1 -1
  244. package/utilities/internal/getFragmentQueryDocument.js +10 -2
  245. package/utilities/internal/getFragmentQueryDocument.js.map +1 -1
  246. package/utilities/internal/getFragmentScope.d.ts +13 -0
  247. package/utilities/internal/getFragmentScope.js +20 -0
  248. package/utilities/internal/getFragmentScope.js.map +1 -0
  249. package/utilities/internal/getFragmentVariables.d.ts +9 -5
  250. package/utilities/internal/getFragmentVariables.js +15 -16
  251. package/utilities/internal/getFragmentVariables.js.map +1 -1
  252. package/utilities/internal/getMainDefinition.js +1 -1
  253. package/utilities/internal/getQueryDefinition.js +1 -1
  254. package/utilities/internal/index.d.ts +5 -1
  255. package/utilities/internal/index.js +3 -1
  256. package/utilities/internal/index.js.map +1 -1
  257. package/utilities/internal/isNonEmptyObject.d.ts +7 -0
  258. package/utilities/internal/isNonEmptyObject.js +10 -0
  259. package/utilities/internal/isNonEmptyObject.js.map +1 -0
  260. package/utilities/internal/isNonNullObject.d.ts +1 -1
  261. package/utilities/internal/isNonNullObject.js.map +1 -1
  262. package/utilities/internal/mapObservableFragment.d.ts +5 -1
  263. package/utilities/internal/mapObservableFragment.js +14 -9
  264. package/utilities/internal/mapObservableFragment.js.map +1 -1
  265. package/utilities/internal/mergeDeepArray.d.ts +2 -1
  266. package/utilities/internal/mergeDeepArray.js +2 -2
  267. package/utilities/internal/mergeDeepArray.js.map +1 -1
  268. package/utilities/internal/removeDirectivesFromDocument.js +1 -1
  269. package/utilities/internal/removeFragmentSpreads.d.ts +18 -2
  270. package/utilities/internal/removeFragmentSpreads.js +56 -3
  271. package/utilities/internal/removeFragmentSpreads.js.map +1 -1
  272. package/utilities/internal/shouldInclude.js +4 -4
  273. package/utilities/internal/types/FragmentInfo.d.ts +14 -0
  274. package/utilities/internal/types/FragmentInfo.js +2 -0
  275. package/utilities/internal/types/FragmentInfo.js.map +1 -0
  276. package/utilities/internal/types/ObjectWithFragmentInfo.d.ts +13 -0
  277. package/utilities/internal/types/ObjectWithFragmentInfo.js +2 -0
  278. package/utilities/internal/types/ObjectWithFragmentInfo.js.map +1 -0
  279. package/utilities/internal/valueToObjectRepresentation.js +1 -1
  280. package/version.js +1 -1
@@ -102,7 +102,7 @@ export class ObservableQuery {
102
102
  // Make sure we don't store "standby" as the initialFetchPolicy.
103
103
  initialFetchPolicy = fetchPolicy === "standby" ? defaultFetchPolicy : (fetchPolicy), } = options;
104
104
  if (options[variablesUnknownSymbol]) {
105
- invariant(fetchPolicy === "standby", 85);
105
+ invariant(fetchPolicy === "standby", 86);
106
106
  this.variablesUnknown = true;
107
107
  }
108
108
  this.lastQuery = transformedQuery;
@@ -411,7 +411,7 @@ export class ObservableQuery {
411
411
  const queryDef = getQueryDefinition(this.query);
412
412
  const vars = queryDef.variableDefinitions;
413
413
  if (!vars || !vars.some((v) => v.variable.name.value === "variables")) {
414
- __DEV__ && invariant.warn(86, variables, queryDef.name?.value || queryDef);
414
+ __DEV__ && invariant.warn(87, variables, queryDef.name?.value || queryDef);
415
415
  }
416
416
  }
417
417
  if (variables && !equal(this.variables, variables)) {
@@ -426,7 +426,7 @@ export class ObservableQuery {
426
426
  fetchMore({ query, variables, context, errorPolicy, updateQuery, }) {
427
427
  invariant(
428
428
  this.options.fetchPolicy !== "cache-only",
429
- 87,
429
+ 88,
430
430
  getOperationName(this.query, "(anonymous)")
431
431
  );
432
432
  const combinedOptions = {
@@ -460,7 +460,7 @@ export class ObservableQuery {
460
460
  let wasUpdated = false;
461
461
  const isCached = this.options.fetchPolicy !== "no-cache";
462
462
  if (!isCached) {
463
- invariant(updateQuery, 88);
463
+ invariant(updateQuery, 89);
464
464
  }
465
465
  const { finalize, pushNotification } = this.pushOperation(NetworkStatus.fetchMore);
466
466
  pushNotification({
@@ -634,7 +634,7 @@ export class ObservableQuery {
634
634
  onError(error);
635
635
  }
636
636
  else {
637
- invariant.error(89, error);
637
+ invariant.error(90, error);
638
638
  }
639
639
  return;
640
640
  }
@@ -885,7 +885,7 @@ export class ObservableQuery {
885
885
  if (!this.didWarnCacheOnlyPolling &&
886
886
  pollInterval &&
887
887
  fetchPolicy === "cache-only") {
888
- __DEV__ && invariant.warn(90, getOperationName(this.query, "(anonymous)"));
888
+ __DEV__ && invariant.warn(91, getOperationName(this.query, "(anonymous)"));
889
889
  this.didWarnCacheOnlyPolling = true;
890
890
  }
891
891
  }
@@ -1511,7 +1511,7 @@ export class ObservableQuery {
1511
1511
  }
1512
1512
  export function logMissingFieldErrors(missing) {
1513
1513
  if (__DEV__ && missing) {
1514
- __DEV__ && invariant.debug(91, missing);
1514
+ __DEV__ && invariant.debug(92, missing);
1515
1515
  }
1516
1516
  }
1517
1517
  function isEqualQuery(a, b) {
@@ -1555,6 +1555,6 @@ function getTrackingOperatorPromise(defaultValue) {
1555
1555
  return { promise, operator };
1556
1556
  }
1557
1557
  function warnOnFeud(query, diff) {
1558
- __DEV__ && invariant.warn(92, getOperationName(query, "(anonymous)"), diff.missing?.missing);
1558
+ __DEV__ && invariant.warn(93, getOperationName(query, "(anonymous)"), diff.missing?.missing);
1559
1559
  }
1560
1560
  //# sourceMappingURL=ObservableQuery.js.map
package/core/QueryInfo.js CHANGED
@@ -355,7 +355,7 @@ export class QueryInfo {
355
355
  }
356
356
  function warnAboutPartialCacheResult(query, networkResult, diff) {
357
357
  __DEV__ && invariant.warn(
358
- 93,
358
+ 94,
359
359
  getOperationName(query, "(anonymous)"),
360
360
  diff.missing?.missing,
361
361
  networkResult,
@@ -99,7 +99,7 @@ export class QueryManager {
99
99
  */
100
100
  stop() {
101
101
  this.obsQueries.forEach((oq) => oq.stop());
102
- this.cancelPendingFetches(newInvariantError(94));
102
+ this.cancelPendingFetches(newInvariantError(95));
103
103
  }
104
104
  cancelPendingFetches(error) {
105
105
  this.fetchCancelFns.forEach((cancel) => cancel(error));
@@ -112,7 +112,7 @@ export class QueryManager {
112
112
  variables = this.getVariables(mutation, variables);
113
113
  if (hasClientExports) {
114
114
  if (__DEV__) {
115
- invariant(this.localState, 95, getOperationName(mutation, "(anonymous)"));
115
+ invariant(this.localState, 96, getOperationName(mutation, "(anonymous)"));
116
116
  }
117
117
  variables = await this.localState.getExportedVariables({
118
118
  client: this.client,
@@ -345,7 +345,7 @@ export class QueryManager {
345
345
  // depend on values that previously existed in the data portion of the
346
346
  // store. So, we cancel the promises and observers that we have issued
347
347
  // so far and not yet resolved (in the case of queries).
348
- this.cancelPendingFetches(newInvariantError(96));
348
+ this.cancelPendingFetches(newInvariantError(97));
349
349
  this.obsQueries.forEach((observableQuery) => {
350
350
  // Set loading to true so listeners don't trigger unless they want
351
351
  // results with partial data.
@@ -415,10 +415,10 @@ export class QueryManager {
415
415
  if (!included) {
416
416
  const queryName = queryNames.get(nameOrQueryString);
417
417
  if (queryName) {
418
- __DEV__ && invariant.warn(97, queryName);
418
+ __DEV__ && invariant.warn(98, queryName);
419
419
  }
420
420
  else {
421
- __DEV__ && invariant.warn(98);
421
+ __DEV__ && invariant.warn(99);
422
422
  }
423
423
  }
424
424
  });
@@ -447,7 +447,7 @@ export class QueryManager {
447
447
  if (__DEV__) {
448
448
  invariant(
449
449
  !this.getDocumentInfo(query).hasClientExports || this.localState,
450
- 99,
450
+ 100,
451
451
  getOperationName(query, "(anonymous)")
452
452
  );
453
453
  }
@@ -599,14 +599,14 @@ export class QueryManager {
599
599
  if (__DEV__) {
600
600
  invariant(
601
601
  this.localState,
602
- 100,
602
+ 101,
603
603
  operation[0].toUpperCase() + operation.slice(1),
604
604
  operationName ?? "(anonymous)"
605
605
  );
606
606
  }
607
607
  invariant(
608
608
  !hasIncrementalDirective,
609
- 101,
609
+ 102,
610
610
  operation[0].toUpperCase() + operation.slice(1),
611
611
  operationName ?? "(anonymous)"
612
612
  );
@@ -774,7 +774,7 @@ export class QueryManager {
774
774
  // we deprecated and removed LocalState.
775
775
  if (this.getDocumentInfo(normalized.query).hasClientExports) {
776
776
  if (__DEV__) {
777
- invariant(this.localState, 102, getOperationName(normalized.query, "(anonymous)"));
777
+ invariant(this.localState, 103, getOperationName(normalized.query, "(anonymous)"));
778
778
  }
779
779
  observable = from(this.localState.getExportedVariables({
780
780
  client: this.client,
@@ -947,7 +947,7 @@ export class QueryManager {
947
947
  !isFullyUnmaskedOperation(document) &&
948
948
  !this.noCacheWarningsByCause.has(cause)) {
949
949
  this.noCacheWarningsByCause.add(cause);
950
- __DEV__ && invariant.warn(103, getOperationName(document, `Unnamed ${operationType ?? "operation"}`));
950
+ __DEV__ && invariant.warn(104, getOperationName(document, `Unnamed ${operationType ?? "operation"}`));
951
951
  }
952
952
  }
953
953
  return (this.dataMasking ?
@@ -1010,7 +1010,7 @@ export class QueryManager {
1010
1010
  (diff.complete || returnPartialData) &&
1011
1011
  this.getDocumentInfo(query).hasForcedResolvers) {
1012
1012
  if (__DEV__) {
1013
- invariant(this.localState, 104, getOperationName(query, "(anonymous)"));
1013
+ invariant(this.localState, 105, getOperationName(query, "(anonymous)"));
1014
1014
  }
1015
1015
  onCacheHit();
1016
1016
  return from(this.localState.execute({
@@ -1131,7 +1131,7 @@ function validateDidEmitValue() {
1131
1131
  didEmitValue = true;
1132
1132
  },
1133
1133
  complete() {
1134
- invariant(didEmitValue, 105);
1134
+ invariant(didEmitValue, 106);
1135
1135
  },
1136
1136
  });
1137
1137
  }
@@ -27,7 +27,7 @@ export class RefetchEventManager {
27
27
  }
28
28
  if (this.client) {
29
29
  if (__DEV__) {
30
- __DEV__ && invariant.warn(106);
30
+ __DEV__ && invariant.warn(107);
31
31
  }
32
32
  this.disconnect();
33
33
  }
@@ -96,13 +96,13 @@ export class RefetchEventManager {
96
96
  const [payload] = args;
97
97
  if (!this.client) {
98
98
  if (__DEV__) {
99
- __DEV__ && invariant.warn(107, source);
99
+ __DEV__ && invariant.warn(108, source);
100
100
  }
101
101
  return;
102
102
  }
103
103
  if (!this.hasSource(source)) {
104
104
  if (__DEV__) {
105
- __DEV__ && invariant.warn(108, source);
105
+ __DEV__ && invariant.warn(109, source);
106
106
  }
107
107
  return;
108
108
  }
@@ -141,7 +141,7 @@ export declare namespace CombinedGraphQLErrors {
141
141
  * }
142
142
  * ```
143
143
  */
144
- export declare class CombinedGraphQLErrors extends Error {
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
- readonly errors: ReadonlyArray<GraphQLFormattedError>;
179
+ errors: Array<GraphQLFormattedError>;
180
180
  /**
181
181
  * Partial data returned in the `data` field of the GraphQL response.
182
182
  */
@@ -39,7 +39,7 @@ function defaultFormatMessage(errors) {
39
39
  * }
40
40
  * ```
41
41
  */
42
- export class CombinedGraphQLErrors extends Error {
42
+ export class CombinedGraphQLErrors extends AggregateError {
43
43
  /**
44
44
  * A method that determines whether an error is a `CombinedGraphQLErrors`
45
45
  * object. This method enables TypeScript to narrow the error type.
@@ -74,10 +74,6 @@ export class CombinedGraphQLErrors extends Error {
74
74
  */
75
75
  static formatMessage = defaultFormatMessage;
76
76
  /**
77
- * The raw list of GraphQL errors returned by the `errors` field in the GraphQL response.
78
- */
79
- errors;
80
- /**
81
77
  * Partial data returned in the `data` field of the GraphQL response.
82
78
  */
83
79
  data;
@@ -86,11 +82,11 @@ export class CombinedGraphQLErrors extends Error {
86
82
  */
87
83
  extensions;
88
84
  constructor(result, errors = result.errors || []) {
89
- super(CombinedGraphQLErrors.formatMessage(errors, {
85
+ super(errors, CombinedGraphQLErrors.formatMessage(errors, {
90
86
  result,
91
87
  defaultFormatMessage,
92
88
  }));
93
- this.errors = errors;
89
+ Object.defineProperty(this, "errors", { enumerable: true });
94
90
  this.data = result.data;
95
91
  this.extensions = result.extensions;
96
92
  this.name = "CombinedGraphQLErrors";
@@ -1 +1 @@
1
- {"version":3,"file":"CombinedGraphQLErrors.js","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,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAc,EAAE,CAAhB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAiC,CAAjC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6C;AA8H7C,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,CACL,CADJ,CAAA,CAAA,CAAA,CAAA;QAEM,CAAN,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA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AAA,EAAkB,CAAlB,CAAA,CAAA,CAAA,CAAA,CAAwB;QACpB,CAAJ,CAAA,CAAA,CAAQ,CAAC,CAAT,CAAA,CAAA,EAAA,EAAiB,CAAjB,CAAA,CAAA,CAAA,CAAA,CAA6D,CAAC,CAA9D,CAAA,CAAA,CAAkE;QAC9D,CAAJ,CAAA,CAAA,CAAQ,CAAC,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAuB,CAAvB,CAAA,CAAA,CAAA,CAAA,CAAmE,CAAC,CAApE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8E;QAC1E,CAAJ,CAAA,CAAA,CAAQ,CAAC,CAAT,CAAA,CAAA,EAAA,EAAgB,CAAhB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuC;QAEnC,CAAJ,CAAA,CAAA,CAAA,CAAS,CAAC,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;;"}
1
+ {"version":3,"file":"CombinedGraphQLErrors.js","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, CombinedGraphQLErr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B,CAAA,CAAA,CAAA,CAAA,CAA6D,CAAC,CAA9D,CAAA,CAAA,CAAkE;QAC9D,CAAJ,CAAA,CAAA,CAAQ,CAAC,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAuB,CAAvB,CAAA,CAAA,CAAA,CAAA,CAAmE,CAAC,CAApE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8E;QAC1E,CAAJ,CAAA,CAAA,CAAQ,CAAC,CAAT,CAAA,CAAA,EAAA,EAAgB,CAAhB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuC;QAEnC,CAAJ,CAAA,CAAA,CAAA,CAAS,CAAC,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;;"}
@@ -108,7 +108,7 @@ export declare namespace CombinedProtocolErrors {
108
108
  * }
109
109
  * ```
110
110
  */
111
- export declare class CombinedProtocolErrors extends Error {
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
- readonly errors: ReadonlyArray<GraphQLFormattedError>;
147
+ errors: Array<GraphQLFormattedError>;
148
148
  constructor(protocolErrors: Array<GraphQLFormattedError> | ReadonlyArray<GraphQLFormattedError>);
149
149
  }
150
150
  //# sourceMappingURL=CombinedProtocolErrors.d.ts.map
@@ -28,7 +28,7 @@ function defaultFormatMessage(errors) {
28
28
  * }
29
29
  * ```
30
30
  */
31
- export class CombinedProtocolErrors extends Error {
31
+ export class CombinedProtocolErrors extends AggregateError {
32
32
  /**
33
33
  * A method that determines whether an error is a `CombinedProtocolErrors`
34
34
  * object. This method enables TypeScript to narrow the error type.
@@ -62,17 +62,12 @@ export class CombinedProtocolErrors extends Error {
62
62
  * the message.
63
63
  */
64
64
  static formatMessage = defaultFormatMessage;
65
- /**
66
- * The raw list of errors returned by the top-level `errors` field in the
67
- * multipart HTTP subscription response.
68
- */
69
- errors;
70
65
  constructor(protocolErrors) {
71
- super(CombinedProtocolErrors.formatMessage(protocolErrors, {
66
+ super(protocolErrors, CombinedProtocolErrors.formatMessage(protocolErrors, {
72
67
  defaultFormatMessage,
73
68
  }));
74
69
  this.name = "CombinedProtocolErrors";
75
- this.errors = protocolErrors;
70
+ Object.defineProperty(this, "errors", { enumerable: true });
76
71
  brand(this);
77
72
  Object.setPrototypeOf(this, CombinedProtocolErrors.prototype);
78
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CombinedProtocolErrors.js","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,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAc,EAAE,CAAhB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAiC,CAAjC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6C;AAiG7C,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,CAAA,CAAA,CAA6E,CAAC;AAC9E;AAEA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;CAyBA,CAAA;AACA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAa,CAAb,CAAA,CAAA,CAA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1
+ {"version":3,"file":"CombinedProtocolErrors.js","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,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAc,EAAE,CAAhB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAiC,CAAjC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6C;AAiG7C,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,C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A,CAA8B,EAAE,CAAhC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwC,EAAE,EAAE,CAA5C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsD,EAAE,CAAxD,CAAA,CAAA,EAAA,CAA8D,CAAC;QAE3D,CAAJ,CAAA,CAAA,CAAA,CAAS,CAAC,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;;"}
@@ -34,7 +34,7 @@ class IncrementalRequest {
34
34
  const name = node.name.value;
35
35
  if (name === "defer") {
36
36
  const labelNode = node.arguments?.find((arg) => arg.name.value === "label");
37
- invariant(labelNode && labelNode.value.kind === "StringValue", 68);
37
+ invariant(labelNode && labelNode.value.kind === "StringValue", 69);
38
38
  this.deferLabels.add(labelNode.value.value);
39
39
  }
40
40
  },
@@ -108,7 +108,7 @@ class IncrementalRequest {
108
108
  if (hasIncrementalChunks(chunk)) {
109
109
  for (const incremental of chunk.incremental) {
110
110
  const pending = this.pendingMap.get(incremental.id);
111
- invariant(pending, 69);
111
+ invariant(pending, 70);
112
112
  const path = pending.path.concat(incremental.subPath ?? []);
113
113
  let data;
114
114
  if ("items" in incremental) {
@@ -5,7 +5,7 @@ export class NotImplementedHandler {
5
5
  return false;
6
6
  }
7
7
  prepareRequest(request) {
8
- invariant(!hasDirectives(["defer", "stream"], request.query), 70);
8
+ invariant(!hasDirectives(["defer", "stream"], request.query), 71);
9
9
  return request;
10
10
  }
11
11
  extractErrors() { }