@apollo/client 3.14.0-alpha.0 → 3.14.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 (198) hide show
  1. package/.changeset/breezy-lions-rule.md +5 -0
  2. package/.changeset/great-jobs-fetch.md +5 -0
  3. package/.changeset/pre.json +4 -1
  4. package/.changeset/tidy-bulldogs-exercise.md +5 -0
  5. package/CHANGELOG.md +10 -0
  6. package/apollo-client.cjs +187 -119
  7. package/apollo-client.cjs.map +1 -1
  8. package/apollo-client.min.cjs +1 -1
  9. package/cache/cache.cjs +7 -2
  10. package/cache/cache.cjs.map +1 -1
  11. package/cache/cache.cjs.native.js +7 -2
  12. package/cache/inmemory/inMemoryCache.d.ts +8 -0
  13. package/cache/inmemory/inMemoryCache.js +3 -0
  14. package/cache/inmemory/inMemoryCache.js.map +1 -1
  15. package/core/ApolloClient.d.ts +9 -9
  16. package/core/ApolloClient.js +6 -1
  17. package/core/ApolloClient.js.map +1 -1
  18. package/core/LocalState.js +2 -2
  19. package/core/ObservableQuery.d.ts +51 -6
  20. package/core/ObservableQuery.js +89 -13
  21. package/core/ObservableQuery.js.map +1 -1
  22. package/core/QueryInfo.js +6 -3
  23. package/core/QueryInfo.js.map +1 -1
  24. package/core/QueryManager.js +14 -12
  25. package/core/QueryManager.js.map +1 -1
  26. package/core/core.cjs +85 -33
  27. package/core/core.cjs.map +1 -1
  28. package/core/core.cjs.native.js +85 -33
  29. package/core/types.d.ts +177 -3
  30. package/core/types.js.map +1 -1
  31. package/core/watchQueryOptions.d.ts +10 -2
  32. package/core/watchQueryOptions.js.map +1 -1
  33. package/dev/dev.cjs +149 -97
  34. package/dev/dev.cjs.map +1 -1
  35. package/dev/dev.cjs.native.js +149 -97
  36. package/errors/errors.cjs.map +1 -1
  37. package/errors/index.d.ts +19 -0
  38. package/errors/index.js +19 -0
  39. package/errors/index.js.map +1 -1
  40. package/invariantErrorCodes.js +161 -96
  41. package/link/batch-http/batch-http.cjs +9 -0
  42. package/link/batch-http/batch-http.cjs.map +1 -1
  43. package/link/batch-http/batch-http.cjs.native.js +9 -0
  44. package/link/batch-http/batchHttpLink.js +9 -0
  45. package/link/batch-http/batchHttpLink.js.map +1 -1
  46. package/link/core/ApolloLink.d.ts +8 -0
  47. package/link/core/ApolloLink.js +19 -2
  48. package/link/core/ApolloLink.js.map +1 -1
  49. package/link/core/core.cjs +24 -2
  50. package/link/core/core.cjs.map +1 -1
  51. package/link/core/core.cjs.native.js +24 -2
  52. package/link/core/types.d.ts +20 -0
  53. package/link/core/types.js.map +1 -1
  54. package/link/error/index.d.ts +48 -0
  55. package/link/error/index.js.map +1 -1
  56. package/link/http/checkFetcher.js +1 -1
  57. package/link/http/createHttpLink.js +4 -1
  58. package/link/http/createHttpLink.js.map +1 -1
  59. package/link/http/http.cjs +6 -3
  60. package/link/http/http.cjs.map +1 -1
  61. package/link/http/http.cjs.native.js +6 -3
  62. package/link/http/serializeFetchParameter.js +1 -1
  63. package/link/persisted-queries/index.d.ts +38 -0
  64. package/link/persisted-queries/index.js +2 -2
  65. package/link/persisted-queries/index.js.map +1 -1
  66. package/link/persisted-queries/persisted-queries.cjs +2 -2
  67. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  68. package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
  69. package/link/utils/fromError.d.ts +16 -0
  70. package/link/utils/fromError.js +16 -0
  71. package/link/utils/fromError.js.map +1 -1
  72. package/link/utils/fromPromise.d.ts +16 -0
  73. package/link/utils/fromPromise.js +16 -0
  74. package/link/utils/fromPromise.js.map +1 -1
  75. package/link/utils/throwServerError.d.ts +30 -0
  76. package/link/utils/throwServerError.js +17 -0
  77. package/link/utils/throwServerError.js.map +1 -1
  78. package/link/utils/toPromise.d.ts +16 -0
  79. package/link/utils/toPromise.js +17 -1
  80. package/link/utils/toPromise.js.map +1 -1
  81. package/link/utils/utils.cjs +2 -2
  82. package/link/utils/utils.cjs.map +1 -1
  83. package/link/utils/utils.cjs.native.js +2 -2
  84. package/link/utils/validateOperation.js +1 -1
  85. package/masking/maskDefinition.js +2 -2
  86. package/masking/maskFragment.js +2 -2
  87. package/masking/maskOperation.js +1 -1
  88. package/masking/masking.cjs +6 -6
  89. package/masking/masking.cjs.map +1 -1
  90. package/masking/masking.cjs.native.js +6 -6
  91. package/masking/utils.js +1 -1
  92. package/masking/utils.js.map +1 -1
  93. package/package.json +1 -1
  94. package/react/components/Mutation.js +1 -1
  95. package/react/components/Query.js +1 -1
  96. package/react/components/Subscription.js +1 -1
  97. package/react/components/components.cjs +6 -4
  98. package/react/components/components.cjs.map +1 -1
  99. package/react/components/components.cjs.native.js +6 -4
  100. package/react/context/ApolloConsumer.js +1 -1
  101. package/react/context/ApolloContext.js +2 -2
  102. package/react/context/ApolloProvider.js +1 -1
  103. package/react/context/context.cjs +4 -4
  104. package/react/context/context.cjs.map +1 -1
  105. package/react/context/context.cjs.native.js +4 -4
  106. package/react/hoc/graphql.js +1 -1
  107. package/react/hoc/hoc-utils.js +1 -1
  108. package/react/hoc/hoc.cjs +9 -7
  109. package/react/hoc/hoc.cjs.map +1 -1
  110. package/react/hoc/hoc.cjs.native.js +9 -7
  111. package/react/hoc/mutation-hoc.js +1 -1
  112. package/react/hoc/query-hoc.js +1 -1
  113. package/react/hoc/subscription-hoc.js +1 -1
  114. package/react/hoc/withApollo.js +1 -1
  115. package/react/hooks/hooks.cjs +18 -16
  116. package/react/hooks/hooks.cjs.map +1 -1
  117. package/react/hooks/hooks.cjs.native.js +18 -16
  118. package/react/hooks/internal/useWarnRemoved.d.ts +2 -1
  119. package/react/hooks/internal/useWarnRemoved.js.map +1 -1
  120. package/react/hooks/internal/useWarnRemovedOption.js +1 -1
  121. package/react/hooks/useApolloClient.js +1 -1
  122. package/react/hooks/useLazyQuery.js +2 -2
  123. package/react/hooks/useLoadableQuery.js +2 -2
  124. package/react/hooks/useQuery.js +1 -1
  125. package/react/hooks/useSubscription.js +3 -3
  126. package/react/hooks/useSuspenseQuery.js +2 -2
  127. package/react/hooks/useSyncExternalStore.js +1 -1
  128. package/react/internal/cache/QueryReference.d.ts +1 -0
  129. package/react/internal/cache/QueryReference.js +5 -2
  130. package/react/internal/cache/QueryReference.js.map +1 -1
  131. package/react/internal/internal.cjs +16 -3
  132. package/react/internal/internal.cjs.map +1 -1
  133. package/react/internal/internal.cjs.native.js +16 -3
  134. package/react/parser/index.js +6 -6
  135. package/react/parser/parser.cjs +9 -7
  136. package/react/parser/parser.cjs.map +1 -1
  137. package/react/parser/parser.cjs.native.js +9 -7
  138. package/react/react.cjs +4 -2
  139. package/react/react.cjs.map +1 -1
  140. package/react/react.cjs.native.js +4 -2
  141. package/react/types/types.d.ts +40 -0
  142. package/react/types/types.documentation.d.ts +1 -1
  143. package/react/types/types.documentation.js.map +1 -1
  144. package/react/types/types.js.map +1 -1
  145. package/testing/core/core.cjs +17 -3
  146. package/testing/core/core.cjs.map +1 -1
  147. package/testing/core/core.cjs.native.js +17 -3
  148. package/testing/core/itAsync.d.ts +5 -0
  149. package/testing/core/itAsync.js +5 -0
  150. package/testing/core/itAsync.js.map +1 -1
  151. package/testing/core/mocking/mockClient.d.ts +4 -0
  152. package/testing/core/mocking/mockClient.js +4 -0
  153. package/testing/core/mocking/mockClient.js.map +1 -1
  154. package/testing/core/mocking/mockLink.d.ts +10 -0
  155. package/testing/core/mocking/mockLink.js +23 -4
  156. package/testing/core/mocking/mockLink.js.map +1 -1
  157. package/testing/core/mocking/mockSubscriptionLink.d.ts +4 -0
  158. package/testing/core/mocking/mockSubscriptionLink.js +4 -0
  159. package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
  160. package/testing/core/subscribeAndCount.d.ts +4 -0
  161. package/testing/core/subscribeAndCount.js +4 -0
  162. package/testing/core/subscribeAndCount.js.map +1 -1
  163. package/testing/experimental/createSchemaFetch.d.ts +1 -1
  164. package/testing/experimental/createSchemaFetch.js +1 -1
  165. package/testing/experimental/createSchemaFetch.js.map +1 -1
  166. package/testing/experimental/createTestSchema.d.ts +1 -1
  167. package/testing/experimental/createTestSchema.js +1 -1
  168. package/testing/experimental/createTestSchema.js.map +1 -1
  169. package/testing/experimental/experimental.cjs.map +1 -1
  170. package/testing/testing.cjs +4 -2
  171. package/testing/testing.cjs.map +1 -1
  172. package/testing/testing.cjs.native.js +4 -2
  173. package/utilities/deprecation/index.d.ts +83 -3
  174. package/utilities/deprecation/index.js +15 -3
  175. package/utilities/deprecation/index.js.map +1 -1
  176. package/utilities/globals/globals.cjs +1 -1
  177. package/utilities/globals/globals.cjs.map +1 -1
  178. package/utilities/globals/globals.cjs.native.js +1 -1
  179. package/utilities/graphql/DocumentTransform.js +1 -1
  180. package/utilities/graphql/directives.js +7 -7
  181. package/utilities/graphql/fragments.js +3 -3
  182. package/utilities/graphql/getFromAST.js +8 -8
  183. package/utilities/graphql/storeUtils.js +1 -1
  184. package/utilities/graphql/transform.js +2 -2
  185. package/utilities/observables/asyncMap.d.ts +13 -0
  186. package/utilities/observables/asyncMap.js +13 -0
  187. package/utilities/observables/asyncMap.js.map +1 -1
  188. package/utilities/observables/iteration.d.ts +4 -0
  189. package/utilities/observables/iteration.js +4 -0
  190. package/utilities/observables/iteration.js.map +1 -1
  191. package/utilities/subscriptions/urql/index.d.ts +5 -0
  192. package/utilities/subscriptions/urql/index.js +5 -0
  193. package/utilities/subscriptions/urql/index.js.map +1 -1
  194. package/utilities/subscriptions/urql/urql.cjs.map +1 -1
  195. package/utilities/utilities.cjs +22 -22
  196. package/utilities/utilities.cjs.map +1 -1
  197. package/utilities/utilities.cjs.native.js +22 -22
  198. package/version.js +1 -1
package/errors/index.d.ts CHANGED
@@ -16,6 +16,25 @@ export interface ApolloErrorOptions {
16
16
  extraInfo?: any;
17
17
  }
18
18
  export declare function graphQLResultHasProtocolErrors<T>(result: FetchResult<T>): result is FetchResultWithSymbolExtensions<T>;
19
+ /**
20
+ * @deprecated `isApolloError` will be removed with Apollo Client 4.0. This
21
+ * function is safe to use in Apollo Client 3.x.
22
+ *
23
+ * **Recommended now**
24
+ *
25
+ * No action needed
26
+ *
27
+ * **When migrating**
28
+ *
29
+ * Errors are no longer wrapped in Apollo Client 4.0. To check if an error is an
30
+ * instance of an error provided by Apollo Client, use the static `.is` method
31
+ * on the error class you want to test against.
32
+ *
33
+ * ```ts
34
+ * // Test if an error is an instance of `CombinedGraphQLErrors`
35
+ * const isGraphQLErrors = CombinedGraphQLErrors.is(error);
36
+ * ```
37
+ */
19
38
  export declare function isApolloError(err: Error): err is ApolloError;
20
39
  /**
21
40
  * @deprecated This type is deprecated and will be removed in the next major version of Apollo Client.
package/errors/index.js CHANGED
@@ -11,6 +11,25 @@ export function graphQLResultHasProtocolErrors(result) {
11
11
  }
12
12
  return false;
13
13
  }
14
+ /**
15
+ * @deprecated `isApolloError` will be removed with Apollo Client 4.0. This
16
+ * function is safe to use in Apollo Client 3.x.
17
+ *
18
+ * **Recommended now**
19
+ *
20
+ * No action needed
21
+ *
22
+ * **When migrating**
23
+ *
24
+ * Errors are no longer wrapped in Apollo Client 4.0. To check if an error is an
25
+ * instance of an error provided by Apollo Client, use the static `.is` method
26
+ * on the error class you want to test against.
27
+ *
28
+ * ```ts
29
+ * // Test if an error is an instance of `CombinedGraphQLErrors`
30
+ * const isGraphQLErrors = CombinedGraphQLErrors.is(error);
31
+ * ```
32
+ */
14
33
  export function isApolloError(err) {
15
34
  return err.hasOwnProperty("graphQLErrors");
16
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":";AAAA,OAAO,+BAA+B,CAAC;AAQvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAKxD,8EAA8E;AAC9E,+EAA+E;AAC/E,2DAA2D;AAC3D,MAAM,CAAC,IAAM,sBAAsB,GAAkB,MAAM,EAAE,CAAC;AAe9D,MAAM,UAAU,8BAA8B,CAC5C,MAAsB;IAEtB,IAAI,MAAM,CAAC,UAAU,EA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AI,CAAC,YAAY,GAAG,YAAY,IAAI,IAAI,CAAC;QACzC,KAAI,CAAC,OAAO,GAAG,YAAY,IAAI,oBAAoB,CAAC,KAAI,CAAC,CAAC;QAC1D,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,KAAI,CAAC,KAAK;YACR;gBACE,YAAY;eACT,CAAC,aAAa,IAAI,EAAE,CAAC,SACrB,CAAC,cAAc,IAAI,EAAE,CAAC,SACtB,CAAC,YAAY,IAAI,EAAE,CAAC,QACvB,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,CAAC,EAAH,CAAG,CAAC,IAAI,IAAI,CAAC;QAE7B,iEAAiE;QACjE,0CAA0C;QACzC,KAAY,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;;IAClD,CAAC;IACH,kBAAC;AAAD,CAAC,AA1DD,CAAiC,KAAK,GA0DrC","sourcesContent":["import \"../utilities/globals/index.js\";\n\nimport type {\n GraphQLError,\n GraphQLErrorExtensions,\n GraphQLFormattedError,\n} from \"graphql\";\n\nimport { isNonNullObject } from \"../utilities/index.js\";\nimport type { ServerParseError } from \"../link/http/index.js\";\nimport type { ServerError } from \"../link/utils/index.js\";\nimport type { FetchResult } from \"../link/core/index.js\";\n\n// This Symbol allows us to pass transport-specific errors from the link chain\n// into QueryManager/client internals without risking a naming collision within\n// extensions (which implementers can use as they see fit).\nexport const PROTOCOL_ERRORS_SYMBOL: unique symbol = Symbol();\n\ntype FetchResultWithSymbolExtensions<T> = FetchResult<T> & {\n extensions: Record<string | symbol, any>;\n};\n\nexport interface ApolloErrorOptions {\n graphQLErrors?: ReadonlyArray<GraphQLFormattedError>;\n protocolErrors?: ReadonlyArray<GraphQLFormattedError>;\n clientErrors?: ReadonlyArray<Error>;\n networkError?: Error | ServerParseError | ServerError | null;\n errorMessage?: string;\n extraInfo?: any;\n}\n\nexport function graphQLResultHasProtocolErrors<T>(\n result: FetchResult<T>\n): result is FetchResultWithSymbolExtensions<T> {\n if (result.extensions) {\n return Array.isArray(\n (result as FetchResultWithSymbolExtensions<T>).extensions[\n PROTOCOL_ERRORS_SYMBOL\n ]\n );\n }\n return false;\n}\n\nexport function isApolloError(err: Error): err is ApolloError {\n return err.hasOwnProperty(\"graphQLErrors\");\n}\n\n// Sets the error message on this error according to the\n// the GraphQL and network errors that are present.\n// If the error message has already been set through the\n// constructor or otherwise, this function is a nop.\nconst generateErrorMessage = (err: ApolloError) => {\n const errors = [\n ...err.graphQLErrors,\n ...err.clientErrors,\n ...err.protocolErrors,\n ];\n if (err.networkError) errors.push(err.networkError);\n return (\n errors\n // The rest of the code sometimes unsafely types non-Error objects as GraphQLErrors\n .map(\n (err) =>\n (isNonNullObject(err) && err.message) || \"Error message not found.\"\n )\n .join(\"\\n\")\n );\n};\n\n/**\n * @deprecated This type is deprecated and will be removed in the next major version of Apollo Client.\n * It mistakenly referenced `GraqhQLError` instead of `GraphQLFormattedError`.\n *\n * Use `ReadonlyArray<GraphQLFormattedError>` instead.\n */\n// eslint-disable-next-line @typescript-eslint/no-restricted-types\nexport type GraphQLErrors = ReadonlyArray<GraphQLError>;\n\nexport type NetworkError = Error | ServerParseError | ServerError | null;\n\nexport class ApolloError extends Error {\n public name: string;\n public message: string;\n public graphQLErrors: ReadonlyArray<GraphQLFormattedError>;\n public protocolErrors: ReadonlyArray<GraphQLFormattedError>;\n public clientErrors: ReadonlyArray<Error>;\n public networkError: Error | ServerParseError | ServerError | null;\n /**\n * Indicates the specific original cause of the error.\n *\n * This field contains the first available `networkError`, `graphQLError`, `protocolError`, `clientError`, or `null` if none are available.\n */\n public cause:\n | ({\n readonly message: string;\n extensions?:\n | GraphQLErrorExtensions[]\n | GraphQLFormattedError[\"extensions\"];\n } & Omit<Partial<Error> & Partial<GraphQLFormattedError>, \"extensions\">)\n | null;\n\n // An object that can be used to provide some additional information\n // about an error, e.g. specifying the type of error this is. Used\n // internally within Apollo Client.\n public extraInfo: any;\n\n // Constructs an instance of ApolloError given serialized GraphQL errors,\n // client errors, protocol errors or network errors.\n // Note that one of these has to be a valid\n // value or the constructed error will be meaningless.\n constructor({\n graphQLErrors,\n protocolErrors,\n clientErrors,\n networkError,\n errorMessage,\n extraInfo,\n }: ApolloErrorOptions) {\n super(errorMessage);\n this.name = \"ApolloError\";\n this.graphQLErrors = graphQLErrors || [];\n this.protocolErrors = protocolErrors || [];\n this.clientErrors = clientErrors || [];\n this.networkError = networkError || null;\n this.message = errorMessage || generateErrorMessage(this);\n this.extraInfo = extraInfo;\n this.cause =\n [\n networkError,\n ...(graphQLErrors || []),\n ...(protocolErrors || []),\n ...(clientErrors || []),\n ].find((e) => !!e) || null;\n\n // We're not using `Object.setPrototypeOf` here as it isn't fully\n // supported on Android (see issue #3236).\n (this as any).__proto__ = ApolloError.prototype;\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":";AAAA,OAAO,+BAA+B,CAAC;AAQvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAKxD,8EAA8E;AAC9E,+EAA+E;AAC/E,2DAA2D;AAC3D,MAAM,CAAC,IAAM,sBAAsB,GAAkB,MAAM,EAAE,CAAC;AAe9D,MAAM,UAAU,8BAA8B,CAC5C,MAAsB;IAEtB,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC,OAAO,CACjB,MAA6C,CAAC,UAAU,CACvD,sBAAsB,CACvB,CACF,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,aAAa,CAAC,GAAU;IACtC,OAAO,GAAG,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;AAC7C,CAAC;AAED,wDAAwD;AACxD,mDAAmD;AACnD,wDAAwD;AACxD,oDAAoD;AACpD,IAAM,oBAAoB,GAAG,UAAC,GAAgB;IAC5C,IAAM,MAAM,iDACP,GAA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AC,EAAH,CAAG,CAAC,IAAI,IAAI,CAAC;QAE7B,iEAAiE;QACjE,0CAA0C;QACzC,KAAY,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;;IAClD,CAAC;IACH,kBAAC;AAAD,CAAC,AA1DD,CAAiC,KAAK,GA0DrC","sourcesContent":["import \"../utilities/globals/index.js\";\n\nimport type {\n GraphQLError,\n GraphQLErrorExtensions,\n GraphQLFormattedError,\n} from \"graphql\";\n\nimport { isNonNullObject } from \"../utilities/index.js\";\nimport type { ServerParseError } from \"../link/http/index.js\";\nimport type { ServerError } from \"../link/utils/index.js\";\nimport type { FetchResult } from \"../link/core/index.js\";\n\n// This Symbol allows us to pass transport-specific errors from the link chain\n// into QueryManager/client internals without risking a naming collision within\n// extensions (which implementers can use as they see fit).\nexport const PROTOCOL_ERRORS_SYMBOL: unique symbol = Symbol();\n\ntype FetchResultWithSymbolExtensions<T> = FetchResult<T> & {\n extensions: Record<string | symbol, any>;\n};\n\nexport interface ApolloErrorOptions {\n graphQLErrors?: ReadonlyArray<GraphQLFormattedError>;\n protocolErrors?: ReadonlyArray<GraphQLFormattedError>;\n clientErrors?: ReadonlyArray<Error>;\n networkError?: Error | ServerParseError | ServerError | null;\n errorMessage?: string;\n extraInfo?: any;\n}\n\nexport function graphQLResultHasProtocolErrors<T>(\n result: FetchResult<T>\n): result is FetchResultWithSymbolExtensions<T> {\n if (result.extensions) {\n return Array.isArray(\n (result as FetchResultWithSymbolExtensions<T>).extensions[\n PROTOCOL_ERRORS_SYMBOL\n ]\n );\n }\n return false;\n}\n\n/**\n * @deprecated `isApolloError` will be removed with Apollo Client 4.0. This\n * function is safe to use in Apollo Client 3.x.\n *\n * **Recommended now**\n *\n * No action needed\n *\n * **When migrating**\n *\n * Errors are no longer wrapped in Apollo Client 4.0. To check if an error is an\n * instance of an error provided by Apollo Client, use the static `.is` method\n * on the error class you want to test against.\n *\n * ```ts\n * // Test if an error is an instance of `CombinedGraphQLErrors`\n * const isGraphQLErrors = CombinedGraphQLErrors.is(error);\n * ```\n */\nexport function isApolloError(err: Error): err is ApolloError {\n return err.hasOwnProperty(\"graphQLErrors\");\n}\n\n// Sets the error message on this error according to the\n// the GraphQL and network errors that are present.\n// If the error message has already been set through the\n// constructor or otherwise, this function is a nop.\nconst generateErrorMessage = (err: ApolloError) => {\n const errors = [\n ...err.graphQLErrors,\n ...err.clientErrors,\n ...err.protocolErrors,\n ];\n if (err.networkError) errors.push(err.networkError);\n return (\n errors\n // The rest of the code sometimes unsafely types non-Error objects as GraphQLErrors\n .map(\n (err) =>\n (isNonNullObject(err) && err.message) || \"Error message not found.\"\n )\n .join(\"\\n\")\n );\n};\n\n/**\n * @deprecated This type is deprecated and will be removed in the next major version of Apollo Client.\n * It mistakenly referenced `GraqhQLError` instead of `GraphQLFormattedError`.\n *\n * Use `ReadonlyArray<GraphQLFormattedError>` instead.\n */\n// eslint-disable-next-line @typescript-eslint/no-restricted-types\nexport type GraphQLErrors = ReadonlyArray<GraphQLError>;\n\nexport type NetworkError = Error | ServerParseError | ServerError | null;\n\nexport class ApolloError extends Error {\n public name: string;\n public message: string;\n public graphQLErrors: ReadonlyArray<GraphQLFormattedError>;\n public protocolErrors: ReadonlyArray<GraphQLFormattedError>;\n public clientErrors: ReadonlyArray<Error>;\n public networkError: Error | ServerParseError | ServerError | null;\n /**\n * Indicates the specific original cause of the error.\n *\n * This field contains the first available `networkError`, `graphQLError`, `protocolError`, `clientError`, or `null` if none are available.\n */\n public cause:\n | ({\n readonly message: string;\n extensions?:\n | GraphQLErrorExtensions[]\n | GraphQLFormattedError[\"extensions\"];\n } & Omit<Partial<Error> & Partial<GraphQLFormattedError>, \"extensions\">)\n | null;\n\n // An object that can be used to provide some additional information\n // about an error, e.g. specifying the type of error this is. Used\n // internally within Apollo Client.\n public extraInfo: any;\n\n // Constructs an instance of ApolloError given serialized GraphQL errors,\n // client errors, protocol errors or network errors.\n // Note that one of these has to be a valid\n // value or the constructed error will be meaningless.\n constructor({\n graphQLErrors,\n protocolErrors,\n clientErrors,\n networkError,\n errorMessage,\n extraInfo,\n }: ApolloErrorOptions) {\n super(errorMessage);\n this.name = \"ApolloError\";\n this.graphQLErrors = graphQLErrors || [];\n this.protocolErrors = protocolErrors || [];\n this.clientErrors = clientErrors || [];\n this.networkError = networkError || null;\n this.message = errorMessage || generateErrorMessage(this);\n this.extraInfo = extraInfo;\n this.cause =\n [\n networkError,\n ...(graphQLErrors || []),\n ...(protocolErrors || []),\n ...(clientErrors || []),\n ].find((e) => !!e) || null;\n\n // We're not using `Object.setPrototypeOf` here as it isn't fully\n // supported on Android (see issue #3236).\n (this as any).__proto__ = ApolloError.prototype;\n }\n}\n"]}