@apollo/client 4.0.0-rc.7 → 4.0.0-rc.9

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 (176) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/__cjs/cache/inmemory/writeToStore.cjs +1 -1
  3. package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
  4. package/__cjs/core/ObservableQuery.cjs +1 -1
  5. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  6. package/__cjs/core/QueryInfo.cjs +2 -6
  7. package/__cjs/core/QueryInfo.cjs.map +1 -1
  8. package/__cjs/core/index.cjs +1 -2
  9. package/__cjs/core/index.cjs.map +1 -1
  10. package/__cjs/core/index.d.cts +1 -2
  11. package/__cjs/invariantErrorCodes.cjs +9 -9
  12. package/__cjs/link/batch/batchLink.cjs +31 -5
  13. package/__cjs/link/batch/batchLink.cjs.map +1 -1
  14. package/__cjs/link/batch/batchLink.d.cts +102 -26
  15. package/__cjs/link/batch/batching.cjs.map +1 -1
  16. package/__cjs/link/batch/batching.d.cts +2 -2
  17. package/__cjs/link/batch/index.cjs +1 -2
  18. package/__cjs/link/batch/index.cjs.map +1 -1
  19. package/__cjs/link/batch/index.d.cts +1 -2
  20. package/__cjs/link/batch-http/BaseBatchHttpLink.cjs +156 -0
  21. package/__cjs/link/batch-http/BaseBatchHttpLink.cjs.map +1 -0
  22. package/__cjs/link/batch-http/BaseBatchHttpLink.d.cts +68 -0
  23. package/__cjs/link/batch-http/batchHttpLink.cjs +25 -130
  24. package/__cjs/link/batch-http/batchHttpLink.cjs.map +1 -1
  25. package/__cjs/link/batch-http/batchHttpLink.d.cts +40 -16
  26. package/__cjs/link/batch-http/index.cjs +2 -1
  27. package/__cjs/link/batch-http/index.cjs.map +1 -1
  28. package/__cjs/link/batch-http/index.d.cts +2 -1
  29. package/__cjs/link/client-awareness/ClientAwarenessLink.cjs +36 -3
  30. package/__cjs/link/client-awareness/ClientAwarenessLink.cjs.map +1 -1
  31. package/__cjs/link/client-awareness/ClientAwarenessLink.d.cts +55 -3
  32. package/__cjs/link/context/index.cjs +19 -0
  33. package/__cjs/link/context/index.cjs.map +1 -1
  34. package/__cjs/link/context/index.d.cts +64 -2
  35. package/__cjs/link/error/index.cjs +44 -0
  36. package/__cjs/link/error/index.cjs.map +1 -1
  37. package/__cjs/link/error/index.d.cts +64 -4
  38. package/__cjs/link/http/BaseHttpLink.cjs +60 -10
  39. package/__cjs/link/http/BaseHttpLink.cjs.map +1 -1
  40. package/__cjs/link/http/BaseHttpLink.d.cts +256 -2
  41. package/__cjs/link/http/HttpLink.cjs +23 -1
  42. package/__cjs/link/http/HttpLink.cjs.map +1 -1
  43. package/__cjs/link/http/HttpLink.d.cts +41 -141
  44. package/__cjs/link/http/checkFetcher.cjs +1 -1
  45. package/__cjs/link/http/index.cjs +1 -3
  46. package/__cjs/link/http/index.cjs.map +1 -1
  47. package/__cjs/link/http/index.d.cts +0 -2
  48. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
  49. package/__cjs/link/http/rewriteURIForGET.cjs +2 -3
  50. package/__cjs/link/http/rewriteURIForGET.cjs.map +1 -1
  51. package/__cjs/link/http/rewriteURIForGET.d.cts +2 -2
  52. package/__cjs/link/http/selectHttpOptionsAndBody.cjs.map +1 -1
  53. package/__cjs/link/http/selectHttpOptionsAndBody.d.cts +7 -7
  54. package/__cjs/link/persisted-queries/index.cjs +18 -2
  55. package/__cjs/link/persisted-queries/index.cjs.map +1 -1
  56. package/__cjs/link/persisted-queries/index.d.cts +204 -24
  57. package/__cjs/link/remove-typename/index.cjs.map +1 -1
  58. package/__cjs/link/remove-typename/index.d.cts +0 -1
  59. package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs +48 -0
  60. package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
  61. package/__cjs/link/remove-typename/removeTypenameFromVariables.d.cts +124 -8
  62. package/__cjs/link/retry/delayFunction.cjs.map +1 -1
  63. package/__cjs/link/retry/delayFunction.d.cts +2 -39
  64. package/__cjs/link/retry/retryFunction.cjs.map +1 -1
  65. package/__cjs/link/retry/retryFunction.d.cts +2 -29
  66. package/__cjs/link/retry/retryLink.cjs +35 -10
  67. package/__cjs/link/retry/retryLink.cjs.map +1 -1
  68. package/__cjs/link/retry/retryLink.d.cts +129 -4
  69. package/__cjs/link/schema/index.cjs +20 -0
  70. package/__cjs/link/schema/index.cjs.map +1 -1
  71. package/__cjs/link/schema/index.d.cts +129 -7
  72. package/__cjs/link/subscriptions/index.cjs +23 -0
  73. package/__cjs/link/subscriptions/index.cjs.map +1 -1
  74. package/__cjs/link/subscriptions/index.d.cts +23 -0
  75. package/__cjs/link/ws/index.cjs +35 -1
  76. package/__cjs/link/ws/index.cjs.map +1 -1
  77. package/__cjs/link/ws/index.d.cts +63 -5
  78. package/__cjs/react/hooks/useSyncExternalStore.cjs +2 -6
  79. package/__cjs/react/hooks/useSyncExternalStore.cjs.map +1 -1
  80. package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs +2 -6
  81. package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs.map +1 -1
  82. package/__cjs/utilities/subscriptions/relay/index.cjs +1 -2
  83. package/__cjs/utilities/subscriptions/relay/index.cjs.map +1 -1
  84. package/__cjs/version.cjs +1 -1
  85. package/cache/inmemory/writeToStore.js +1 -1
  86. package/cache/inmemory/writeToStore.js.map +1 -1
  87. package/core/ObservableQuery.js +1 -1
  88. package/core/ObservableQuery.js.map +1 -1
  89. package/core/QueryInfo.js +1 -2
  90. package/core/QueryInfo.js.map +1 -1
  91. package/core/index.d.ts +1 -2
  92. package/core/index.js +1 -1
  93. package/core/index.js.map +1 -1
  94. package/invariantErrorCodes.js +9 -9
  95. package/link/batch/batchLink.d.ts +103 -27
  96. package/link/batch/batchLink.js +30 -3
  97. package/link/batch/batchLink.js.map +1 -1
  98. package/link/batch/batching.d.ts +2 -2
  99. package/link/batch/batching.js.map +1 -1
  100. package/link/batch/index.d.ts +1 -2
  101. package/link/batch/index.js +1 -1
  102. package/link/batch/index.js.map +1 -1
  103. package/link/batch-http/BaseBatchHttpLink.d.ts +68 -0
  104. package/link/batch-http/BaseBatchHttpLink.js +152 -0
  105. package/link/batch-http/BaseBatchHttpLink.js.map +1 -0
  106. package/link/batch-http/batchHttpLink.d.ts +40 -16
  107. package/link/batch-http/batchHttpLink.js +23 -127
  108. package/link/batch-http/batchHttpLink.js.map +1 -1
  109. package/link/batch-http/index.d.ts +2 -1
  110. package/link/batch-http/index.js +2 -1
  111. package/link/batch-http/index.js.map +1 -1
  112. package/link/client-awareness/ClientAwarenessLink.d.ts +56 -4
  113. package/link/client-awareness/ClientAwarenessLink.js +36 -3
  114. package/link/client-awareness/ClientAwarenessLink.js.map +1 -1
  115. package/link/context/index.d.ts +65 -3
  116. package/link/context/index.js +19 -0
  117. package/link/context/index.js.map +1 -1
  118. package/link/error/index.d.ts +65 -5
  119. package/link/error/index.js +44 -0
  120. package/link/error/index.js.map +1 -1
  121. package/link/http/BaseHttpLink.d.ts +257 -3
  122. package/link/http/BaseHttpLink.js +60 -10
  123. package/link/http/BaseHttpLink.js.map +1 -1
  124. package/link/http/HttpLink.d.ts +41 -141
  125. package/link/http/HttpLink.js +23 -1
  126. package/link/http/HttpLink.js.map +1 -1
  127. package/link/http/checkFetcher.js +1 -1
  128. package/link/http/index.d.ts +0 -2
  129. package/link/http/index.js +0 -1
  130. package/link/http/index.js.map +1 -1
  131. package/link/http/parseAndCheckHttpResponse.js +1 -1
  132. package/link/http/rewriteURIForGET.d.ts +2 -2
  133. package/link/http/rewriteURIForGET.js +2 -3
  134. package/link/http/rewriteURIForGET.js.map +1 -1
  135. package/link/http/selectHttpOptionsAndBody.d.ts +7 -7
  136. package/link/http/selectHttpOptionsAndBody.js.map +1 -1
  137. package/link/persisted-queries/index.d.ts +205 -25
  138. package/link/persisted-queries/index.js +18 -2
  139. package/link/persisted-queries/index.js.map +1 -1
  140. package/link/remove-typename/index.d.ts +0 -1
  141. package/link/remove-typename/index.js.map +1 -1
  142. package/link/remove-typename/removeTypenameFromVariables.d.ts +124 -8
  143. package/link/remove-typename/removeTypenameFromVariables.js +48 -0
  144. package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
  145. package/link/retry/delayFunction.d.ts +2 -39
  146. package/link/retry/delayFunction.js.map +1 -1
  147. package/link/retry/retryFunction.d.ts +2 -29
  148. package/link/retry/retryFunction.js.map +1 -1
  149. package/link/retry/retryLink.d.ts +130 -5
  150. package/link/retry/retryLink.js +36 -11
  151. package/link/retry/retryLink.js.map +1 -1
  152. package/link/schema/index.d.ts +130 -8
  153. package/link/schema/index.js +20 -0
  154. package/link/schema/index.js.map +1 -1
  155. package/link/subscriptions/index.d.ts +23 -0
  156. package/link/subscriptions/index.js +23 -0
  157. package/link/subscriptions/index.js.map +1 -1
  158. package/link/ws/index.d.ts +63 -5
  159. package/link/ws/index.js +31 -1
  160. package/link/ws/index.js.map +1 -1
  161. package/package.json +1 -1
  162. package/react/hooks/useSyncExternalStore.js +1 -1
  163. package/react/hooks/useSyncExternalStore.js.map +1 -1
  164. package/react/hooks-compiled/useSyncExternalStore.js +1 -1
  165. package/react/hooks-compiled/useSyncExternalStore.js.map +1 -1
  166. package/utilities/internal/removeDirectivesFromDocument.js +1 -2
  167. package/utilities/internal/removeDirectivesFromDocument.js.map +1 -1
  168. package/utilities/subscriptions/relay/index.js +1 -2
  169. package/utilities/subscriptions/relay/index.js.map +1 -1
  170. package/version.js +1 -1
  171. package/__cjs/link/http/serializeFetchParameter.cjs +0 -18
  172. package/__cjs/link/http/serializeFetchParameter.cjs.map +0 -1
  173. package/__cjs/link/http/serializeFetchParameter.d.cts +0 -6
  174. package/link/http/serializeFetchParameter.d.ts +0 -6
  175. package/link/http/serializeFetchParameter.js +0 -14
  176. package/link/http/serializeFetchParameter.js.map +0 -1
@@ -1,25 +1,49 @@
1
- import { Observable } from "rxjs";
2
1
  import { ApolloLink } from "@apollo/client/link";
3
- import { BatchLink } from "@apollo/client/link/batch";
4
2
  import { ClientAwarenessLink } from "@apollo/client/link/client-awareness";
5
- import type { HttpLink } from "@apollo/client/link/http";
3
+ import { BaseBatchHttpLink } from "./BaseBatchHttpLink.cjs";
6
4
  export declare namespace BatchHttpLink {
7
- type Options = Pick<BatchLink.Options, "batchMax" | "batchDebounce" | "batchInterval" | "batchKey"> & Omit<HttpLink.Options, "useGETForQueries">;
8
- type ContextOptions = HttpLink.ContextOptions;
5
+ /**
6
+ * Options provided to the `BatchHttpLink` constructor.
7
+ */
8
+ interface Options extends BaseBatchHttpLink.Options, ClientAwarenessLink.Options {
9
+ }
10
+ /**
11
+ * Options passed to `BatchHttpLink` through [request context](https://apollographql.com/docs/react/api/link/introduction#managing-context). Previous
12
+ * non-terminating links in the link chain also can set these values to
13
+ * customize the behavior of `BatchHttpLink` for each operation.
14
+ *
15
+ * > [!NOTE]
16
+ * > Some of these values can also be provided to the `BatchHttpLink` constructor.
17
+ * > If a value is provided to both, the value in `context` takes precedence.
18
+ */
19
+ interface ContextOptions extends BaseBatchHttpLink.ContextOptions, ClientAwarenessLink.ContextOptions {
20
+ }
9
21
  }
10
22
  /**
11
- * Transforms Operation for into HTTP results.
12
- * context can include the headers property, which will be passed to the fetch function
23
+ * `BatchHttpLink` is a terminating link that batches array of individual
24
+ * GraphQL operations into a single HTTP request that's sent to a single GraphQL
25
+ * endpoint. It combines the functionality of `BaseBatchHttpLink` and
26
+ * `ClientAwarenessLink` into a single link.
27
+ *
28
+ * @remarks
29
+ *
30
+ * If you use `BatchHttpLink` instead of `HttpLink` as your terminating link,
31
+ * Apollo Client automatically batches executed GraphQL operations and transmits
32
+ * them to your server according to the batching options you provide.
33
+ *
34
+ * @example
35
+ *
36
+ * ```ts
37
+ * import { BatchHttpLink } from "@apollo/client/link/batch-http";
38
+ *
39
+ * const link = new BatchHttpLink({
40
+ * uri: "http://localhost:4000/graphql",
41
+ * batchMax: 5, // No more than 5 operations per batch
42
+ * batchInterval: 20, // Wait no more than 20ms after first batched operation
43
+ * });
44
+ * ```
13
45
  */
14
46
  export declare class BatchHttpLink extends ApolloLink {
15
- constructor(options?: BatchHttpLink.Options & ClientAwarenessLink.Options);
16
- }
17
- export declare class BaseBatchHttpLink extends ApolloLink {
18
- private batchDebounce?;
19
- private batchInterval;
20
- private batchMax;
21
- private batcher;
22
- constructor(fetchParams?: BatchHttpLink.Options);
23
- request(operation: ApolloLink.Operation, forward: ApolloLink.ForwardFunction): Observable<ApolloLink.Result>;
47
+ constructor(options?: BatchHttpLink.Options);
24
48
  }
25
49
  //# sourceMappingURL=batchHttpLink.d.cts.map
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BatchHttpLink = exports.BaseBatchHttpLink = void 0;
4
+ var BaseBatchHttpLink_js_1 = require("./BaseBatchHttpLink.cjs");
5
+ Object.defineProperty(exports, "BaseBatchHttpLink", { enumerable: true, get: function () { return BaseBatchHttpLink_js_1.BaseBatchHttpLink; } });
4
6
  var batchHttpLink_js_1 = require("./batchHttpLink.cjs");
5
- Object.defineProperty(exports, "BaseBatchHttpLink", { enumerable: true, get: function () { return batchHttpLink_js_1.BaseBatchHttpLink; } });
6
7
  Object.defineProperty(exports, "BatchHttpLink", { enumerable: true, get: function () { return batchHttpLink_js_1.BatchHttpLink; } });
7
8
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../../src/link/batch-http/index.ts"],"sourcesContent":["export { BaseBatchHttpLink, BatchHttpLink } from \"./batchHttpLink.js\";\n"],"names":[],"mappings":";;;AAAA,CAAA,CAAA,EAAA,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,sBAAA,CAAA;AAAS,CAAT,CAAA,CAAA,CAAA,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CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA4B,CAA5B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAyC,EAAzC,EAAA,CAAA,CAAA;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../../src/link/batch-http/index.ts"],"sourcesContent":["export { BaseBatchHttpLink } from \"./BaseBatchHttpLink.js\";\nexport { BatchHttpLink } from \"./batchHttpLink.js\";\n"],"names":[],"mappings":";;;AAAA,CAAA,CAAA,EAAA,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,0BAAA,CAAA;AAAS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,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,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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pLink.cjs";
2
+ export { BatchHttpLink } from "./batchHttpLink.cjs";
2
3
  //# sourceMappingURL=index.d.cts.map
@@ -3,14 +3,47 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ClientAwarenessLink = void 0;
4
4
  const link_1 = require("@apollo/client/link");
5
5
  const internal_1 = require("@apollo/client/utilities/internal");
6
+ /**
7
+ * `ClientAwarenessLink` provides support for providing client awareness
8
+ * features.
9
+ *
10
+ * @remarks
11
+ *
12
+ * Client awareness adds identifying information about the client to HTTP
13
+ * requests for use with metrics reporting tools, such as [Apollo GraphOS](https://apollographql.com/docs/graphos/platform).
14
+ * It is included in the functionality of [`HttpLink`](https://apollographql.com/docs/react/api/link/apollo-link-http) by default.
15
+ *
16
+ * Client awareness distinguishes between user-provided client awareness
17
+ * (provided by the `clientAwareness` option) and enhanced client awareness
18
+ * (provided by the `enhancedClientAwareness` option). User-provided client
19
+ * awareness enables you to set a customized client name and version for
20
+ * identification in metrics reporting tools. Enhanced client awareness enables
21
+ * the identification of the Apollo Client package name and version.
22
+ *
23
+ * @example
24
+ *
25
+ * ```ts
26
+ * import { ClientAwarenessLink } from "@apollo/client/link/client-awareness";
27
+ *
28
+ * const link = new ClientAwarenessLink({
29
+ * clientAwareness: {
30
+ * name: "My Client",
31
+ * version: "1",
32
+ * },
33
+ * enhancedClientAwareness: {
34
+ * transport: "extensions",
35
+ * },
36
+ * });
37
+ * ```
38
+ */
6
39
  class ClientAwarenessLink extends link_1.ApolloLink {
7
- constructor(constructorOptions = {}) {
40
+ constructor(options = {}) {
8
41
  super((operation, forward) => {
9
42
  const client = operation.client;
10
43
  const clientOptions = client["queryManager"].clientOptions;
11
44
  const context = operation.getContext();
12
45
  {
13
- const { name, version, transport = "headers", } = (0, internal_1.compact)({}, clientOptions.clientAwareness, constructorOptions.clientAwareness, context.clientAwareness);
46
+ const { name, version, transport = "headers", } = (0, internal_1.compact)({}, clientOptions.clientAwareness, options.clientAwareness, context.clientAwareness);
14
47
  if (transport === "headers") {
15
48
  operation.setContext(({ headers, extensions }) => {
16
49
  return {
@@ -25,7 +58,7 @@ class ClientAwarenessLink extends link_1.ApolloLink {
25
58
  }
26
59
  }
27
60
  {
28
- const { transport = "extensions" } = (0, internal_1.compact)({}, clientOptions.enhancedClientAwareness, constructorOptions.enhancedClientAwareness);
61
+ const { transport = "extensions" } = (0, internal_1.compact)({}, clientOptions.enhancedClientAwareness, options.enhancedClientAwareness);
29
62
  if (transport === "extensions") {
30
63
  operation.extensions = (0, internal_1.compact)(
31
64
  // setting these first so that it can be overridden by user-provided extensions
@@ -1 +1 @@
1
- {"version":3,"file":"ClientAwarenessLink.cjs","sources":["../../../../src/link/client-awareness/ClientAwarenessLink.ts"],"sourcesContent":["import { ApolloLink } from \"@apollo/client/link\";\nimport { compact } from \"@apollo/client/utilities/internal\";\n\nexport declare namespace ClientAwarenessLink {\n export interface ClientAwarenessOptions {\n /**\n * A custom name (e.g., `iOS`) that identifies this particular client among your set of clients. Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * This option can either be set as part of the Apollo Client constructor call or when manually constructing a `HttpLink`, `BatchHttpLink` or `ClientAwarenessLink`.\n */\n name?: string;\n /**\n * A custom version that identifies the current version of this particular client (e.g., `1.2`). Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * This is **not** the version of Apollo Client that you are using, but rather any version string that helps you differentiate between versions of your client.\n *\n * This option can either be set as part of the Apollo Client constructor call or when manually constructing a `HttpLink`, `BatchHttpLink` or `ClientAwarenessLink`.\n */\n version?: string;\n /**\n * Determines how `name` and `version` are sent in outgoing requests.\n *\n * If `name` and `version` are not provided, this option will be ignored.\n * (These options can either be set as part of the Apollo Client constructor call or when manually constructing a `HttpLink`, `BatchHttpLink` or `ClientAwarenessLink`.)\n *\n * - If set to `\"headers\"`, `name` and `version` will be sent in the request headers as `apollographql-client-name` and `apollographql-client-version`, respectively.\n * - If set to `false`, `name` and `version` will not be included in outgoing requests.\n *\n * @defaultValue \"headers\"\n */\n transport?: \"headers\" | false;\n }\n export interface EnhancedClientAwarenessOptions {\n /**\n * Determines how the the version information of Apollo Client is sent in outgoing requests.\n *\n * - If set to `\"extensions\"`, library `name` and `version` will be sent in an object in the request extensions as `clientLibrary`.\n * - If set to `false`, library name and version will not be included in outgoing requests.\n *\n * @defaultValue \"extensions\"\n */\n transport?: \"extensions\" | false;\n }\n\n export interface Options {\n /**\n * Configures the \"client awareness\" feature.\n * This feature allows you to identify distinct applications in Apollo Studio\n * and Apollo Server logs (and other monitoring or analytics tools) by adding\n * information about the your application to outgoing requests.\n */\n clientAwareness?: ClientAwarenessOptions;\n /**\n * Configures the \"enhanced client awareness\" feature.\n * This feature allows you to identify the version of the Apollo Client library\n * used in your application in Apollo Studio (and other monitoring or analytics tools)\n * by adding information about the Apollo Client library to outgoing requests.\n */\n enhancedClientAwareness?: EnhancedClientAwarenessOptions;\n }\n}\n\nexport class ClientAwarenessLink extends ApolloLink {\n constructor(constructorOptions: ClientAwarenessLink.Options = {}) {\n super((operation, forward) => {\n const client = operation.client;\n\n const clientOptions = client[\"queryManager\"].clientOptions;\n const context = operation.getContext();\n {\n const {\n name,\n version,\n transport = \"headers\",\n } = compact(\n {},\n clientOptions.clientAwareness,\n constructorOptions.clientAwareness,\n context.clientAwareness\n );\n\n if (transport === \"headers\") {\n operation.setContext(({ headers, extensions }) => {\n return {\n headers: compact(\n // setting these first so that they can be overridden by user-provided headers\n {\n \"apollographql-client-name\": name,\n \"apollographql-client-version\": version,\n },\n headers\n ),\n };\n });\n }\n }\n {\n const { transport = \"extensions\" } = compact(\n {},\n clientOptions.enhancedClientAwareness,\n constructorOptions.enhancedClientAwareness\n );\n if (transport === \"extensions\") {\n operation.extensions = compact(\n // setting these first so that it can be overridden by user-provided extensions\n {\n clientLibrary: {\n name: \"@apollo/client\",\n version: client.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AAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
1
+ {"version":3,"file":"ClientAwarenessLink.cjs","sources":["../../../../src/link/client-awareness/ClientAwarenessLink.ts"],"sourcesContent":["import { ApolloLink } from \"@apollo/client/link\";\nimport { compact } from \"@apollo/client/utilities/internal\";\n\nexport declare namespace ClientAwarenessLink {\n /**\n * Options passed to `ClientAwarenessLink` through [request context](https://apollographql.com/docs/react/api/link/introduction#managing-context). Previous\n * non-terminating links in the link chain also can set these values to\n * customize the behavior of `ClientAwarenessLink` for each operation.\n *\n * > [!NOTE]\n * > Some of these values can also be provided to the `ClientAwarenessLink`\n * > constructor. If a value is provided to both, the value in `context` takes\n * > precedence.\n */\n export interface ContextOptions {\n /** {@inheritDoc @apollo/client/link/client-awareness!ClientAwarenessLink.Options#clientAwareness:member} */\n clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;\n }\n\n export interface ClientAwarenessOptions {\n /**\n * A custom name (e.g., `iOS`) that identifies this particular client among your set of clients. Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * This option can either be set as part of the Apollo Client constructor call or when manually constructing a `HttpLink`, `BatchHttpLink` or `ClientAwarenessLink`.\n */\n name?: string;\n /**\n * A custom version that identifies the current version of this particular client (e.g., `1.2`). Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * This is **not** the version of Apollo Client that you are using, but rather any version string that helps you differentiate between versions of your client.\n *\n * This option can either be set as part of the Apollo Client constructor call or when manually constructing a `HttpLink`, `BatchHttpLink` or `ClientAwarenessLink`.\n */\n version?: string;\n /**\n * Determines how `name` and `version` are sent in outgoing requests.\n *\n * If `name` and `version` are not provided, this option will be ignored.\n * (These options can either be set as part of the Apollo Client constructor call or when manually constructing a `HttpLink`, `BatchHttpLink` or `ClientAwarenessLink`.)\n *\n * - If set to `\"headers\"`, `name` and `version` will be sent in the request headers as `apollographql-client-name` and `apollographql-client-version`, respectively.\n * - If set to `false`, `name` and `version` will not be included in outgoing requests.\n *\n * @defaultValue \"headers\"\n */\n transport?: \"headers\" | false;\n }\n export interface EnhancedClientAwarenessOptions {\n /**\n * Determines how the the version information of Apollo Client is sent in outgoing requests.\n *\n * - If set to `\"extensions\"`, library `name` and `version` will be sent in an object in the request extensions as `clientLibrary`.\n * - If set to `false`, library name and version will not be included in outgoing requests.\n *\n * @defaultValue \"extensions\"\n */\n transport?: \"extensions\" | false;\n }\n\n export interface Options {\n /**\n * Configures the \"client awareness\" feature.\n * This feature allows you to identify distinct applications in Apollo Studio\n * and Apollo Server logs (and other monitoring or analytics tools) by adding\n * information about the your application to outgoing requests.\n */\n clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;\n /**\n * Configures the \"enhanced client awareness\" feature.\n * This feature allows you to identify the version of the Apollo Client library\n * used in your application in Apollo Studio (and other monitoring or analytics tools)\n * by adding information about the Apollo Client library to outgoing requests.\n */\n enhancedClientAwareness?: ClientAwarenessLink.EnhancedClientAwarenessOptions;\n }\n}\n\n/**\n * `ClientAwarenessLink` provides support for providing client awareness\n * features.\n *\n * @remarks\n *\n * Client awareness adds identifying information about the client to HTTP\n * requests for use with metrics reporting tools, such as [Apollo GraphOS](https://apollographql.com/docs/graphos/platform).\n * It is included in the functionality of [`HttpLink`](https://apollographql.com/docs/react/api/link/apollo-link-http) by default.\n *\n * Client awareness distinguishes between user-provided client awareness\n * (provided by the `clientAwareness` option) and enhanced client awareness\n * (provided by the `enhancedClientAwareness` option). User-provided client\n * awareness enables you to set a customized client name and version for\n * identification in metrics reporting tools. Enhanced client awareness enables\n * the identification of the Apollo Client package name and version.\n *\n * @example\n *\n * ```ts\n * import { ClientAwarenessLink } from \"@apollo/client/link/client-awareness\";\n *\n * const link = new ClientAwarenessLink({\n * clientAwareness: {\n * name: \"My Client\",\n * version: \"1\",\n * },\n * enhancedClientAwareness: {\n * transport: \"extensions\",\n * },\n * });\n * ```\n */\nexport class ClientAwarenessLink extends ApolloLink {\n constructor(options: ClientAwarenessLink.Options = {}) {\n super((operation, forward) => {\n const client = operation.client;\n\n const clientOptions = client[\"queryManager\"].clientOptions;\n const context = operation.getContext();\n {\n const {\n name,\n version,\n transport = \"headers\",\n } = compact(\n {},\n clientOptions.clientAwareness,\n options.clientAwareness,\n context.clientAwareness\n );\n\n if (transport === \"headers\") {\n operation.setContext(({ headers, extensions }) => {\n return {\n headers: compact(\n // setting these first so that they can be overridden by user-provided headers\n {\n \"apollographql-client-name\": name,\n \"apollographql-client-version\": version,\n },\n headers\n ),\n };\n });\n }\n }\n {\n const { transport = \"extensions\" } = compact(\n {},\n clientOptions.enhancedClientAwareness,\n options.enhancedClientAwareness\n );\n if (transport === \"extensions\") {\n operation.extensions = compact(\n // setting these first so that it can be overridden by user-provided extensions\n {\n clientLibrary: {\n name: \"@apollo/client\",\n version: client.version,\n },\n },\n operation.extensions\n );\n }\n }\n\n return forward(operation);\n });\n }\n}\n"],"names":[],"mappings":";;;AAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CA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A,CAAA,CAAA,CACqB,CAAC,CADtB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACgC,CACrB;gBACH;YACF;YAEA,CAAN,CAAA,CAAA,CAAA,CAAA,EAAa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoB,CAAC,CAArB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8B,CAAC;QAC3B,CAAC,CAAC;IACJ;AACF;AAzDA,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;"}
@@ -1,5 +1,24 @@
1
1
  import { ApolloLink } from "@apollo/client/link";
2
2
  export declare namespace ClientAwarenessLink {
3
+ /**
4
+ * Options passed to `ClientAwarenessLink` through [request context](https://apollographql.com/docs/react/api/link/introduction#managing-context). Previous
5
+ * non-terminating links in the link chain also can set these values to
6
+ * customize the behavior of `ClientAwarenessLink` for each operation.
7
+ *
8
+ * > [!NOTE]
9
+ * > Some of these values can also be provided to the `ClientAwarenessLink`
10
+ * > constructor. If a value is provided to both, the value in `context` takes
11
+ * > precedence.
12
+ */
13
+ interface ContextOptions {
14
+ /**
15
+ * Configures the "client awareness" feature.
16
+ * This feature allows you to identify distinct applications in Apollo Studio
17
+ * and Apollo Server logs (and other monitoring or analytics tools) by adding
18
+ * information about the your application to outgoing requests.
19
+ */
20
+ clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;
21
+ }
3
22
  interface ClientAwarenessOptions {
4
23
  /**
5
24
  * A custom name (e.g., `iOS`) that identifies this particular client among your set of clients. Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.
@@ -46,17 +65,50 @@ export declare namespace ClientAwarenessLink {
46
65
  * and Apollo Server logs (and other monitoring or analytics tools) by adding
47
66
  * information about the your application to outgoing requests.
48
67
  */
49
- clientAwareness?: ClientAwarenessOptions;
68
+ clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;
50
69
  /**
51
70
  * Configures the "enhanced client awareness" feature.
52
71
  * This feature allows you to identify the version of the Apollo Client library
53
72
  * used in your application in Apollo Studio (and other monitoring or analytics tools)
54
73
  * by adding information about the Apollo Client library to outgoing requests.
55
74
  */
56
- enhancedClientAwareness?: EnhancedClientAwarenessOptions;
75
+ enhancedClientAwareness?: ClientAwarenessLink.EnhancedClientAwarenessOptions;
57
76
  }
58
77
  }
78
+ /**
79
+ * `ClientAwarenessLink` provides support for providing client awareness
80
+ * features.
81
+ *
82
+ * @remarks
83
+ *
84
+ * Client awareness adds identifying information about the client to HTTP
85
+ * requests for use with metrics reporting tools, such as [Apollo GraphOS](https://apollographql.com/docs/graphos/platform).
86
+ * It is included in the functionality of [`HttpLink`](https://apollographql.com/docs/react/api/link/apollo-link-http) by default.
87
+ *
88
+ * Client awareness distinguishes between user-provided client awareness
89
+ * (provided by the `clientAwareness` option) and enhanced client awareness
90
+ * (provided by the `enhancedClientAwareness` option). User-provided client
91
+ * awareness enables you to set a customized client name and version for
92
+ * identification in metrics reporting tools. Enhanced client awareness enables
93
+ * the identification of the Apollo Client package name and version.
94
+ *
95
+ * @example
96
+ *
97
+ * ```ts
98
+ * import { ClientAwarenessLink } from "@apollo/client/link/client-awareness";
99
+ *
100
+ * const link = new ClientAwarenessLink({
101
+ * clientAwareness: {
102
+ * name: "My Client",
103
+ * version: "1",
104
+ * },
105
+ * enhancedClientAwareness: {
106
+ * transport: "extensions",
107
+ * },
108
+ * });
109
+ * ```
110
+ */
59
111
  export declare class ClientAwarenessLink extends ApolloLink {
60
- constructor(constructorOptions?: ClientAwarenessLink.Options);
112
+ constructor(options?: ClientAwarenessLink.Options);
61
113
  }
62
114
  //# sourceMappingURL=ClientAwarenessLink.d.cts.map
@@ -19,6 +19,25 @@ const link_1 = require("@apollo/client/link");
19
19
  function setContext(setter) {
20
20
  return new SetContextLink((prevContext, operation) => setter(operation, prevContext));
21
21
  }
22
+ /**
23
+ * `SetContextLink` is a non-terminating link that allows you to modify the
24
+ * context of GraphQL operations before they're passed to the next link in the
25
+ * chain. This is commonly used for authentication, adding headers, and other
26
+ * request-time configuration.
27
+ *
28
+ * @example
29
+ *
30
+ * ```ts
31
+ * import { SetContextLink } from "@apollo/client/link/context";
32
+ *
33
+ * const link = new SetContextLink((prevContext, operation) => {
34
+ * return {
35
+ * credentials: "include",
36
+ * // ...
37
+ * };
38
+ * });
39
+ * ```
40
+ */
22
41
  class SetContextLink extends link_1.ApolloLink {
23
42
  constructor(setter) {
24
43
  super((operation, forward) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../../src/link/context/index.ts"],"sourcesContent":["import { Observable } from \"rxjs\";\n\nimport { ApolloLink } from \"@apollo/client/link\";\n\nexport declare namespace SetContextLink {\n export type ContextSetter = (\n prevContext: ApolloLink.OperationContext,\n operation: SetContextOperation\n ) =>\n | Promise<Partial<ApolloLink.OperationContext>>\n | Partial<ApolloLink.OperationContext>;\n\n export type LegacyContextSetter = (\n operation: SetContextOperation,\n prevContext: ApolloLink.OperationContext\n ) =>\n | Promise<Partial<ApolloLink.OperationContext>>\n | Partial<ApolloLink.OperationContext>;\n\n export type SetContextOperation = Omit<\n ApolloLink.Operation,\n \"getContext\" | \"setContext\"\n >;\n}\n\n/**\n * @deprecated\n * Use `SetContextLink` from `@apollo/client/link/context` instead. Note you\n * will need to flip the arguments when using `SetContextLink` as `prevContext`\n * is the first argument.\n *\n * ```ts\n * new SetContextLink((prevContext, operation) => {\n * // ...\n * });\n * ```\n */\nexport function setContext(setter: SetContextLink.LegacyContextSetter) {\n return new SetContextLink((prevContext, operation) =>\n setter(operation, prevContext)\n );\n}\nexport class SetContextLink extends ApolloLink {\n constructor(setter: SetContextLink.ContextSetter) {\n super((operation, forward) => {\n const { ...request } = operation as SetContextLink.SetContextOperation;\n\n Object.defineProperty(request, \"client\", {\n enumerable: false,\n value: operation.client,\n });\n\n return new Observable((observer) => {\n let closed = false;\n Promise.resolve(request)\n .then((req) => setter(operation.getContext(), req))\n .then(operation.setContext)\n .then(() => {\n if (!closed) {\n forward(operation).subscribe(observer);\n }\n })\n .catch(observer.error.bind(observer));\n\n return () => {\n closed = true;\n };\n });\n });\n }\n}\n"],"names":[],"mappings":";;;AAqCA,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;AArCA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAEA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAuBA,CAAA,CAAA;;;;;;;;;;;CAWA,CAAA;AACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAgB,CAAhB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA0B,CAAC,CAA3B,CAAA,CAAA,CAAA,CAAA,CAAqE,EAArE;IACE,CAAF,CAAA,CAAA,CAAA,CAAA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AAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../../src/link/context/index.ts"],"sourcesContent":["import { Observable } from \"rxjs\";\n\nimport { ApolloLink } from \"@apollo/client/link\";\n\nexport declare namespace SetContextLink {\n namespace SetContextLinkDocumentationTypes {\n /**\n * A function that returns an updated context object for an Apollo Link\n * operation.\n *\n * The context setter function is called for each operation and allows you to\n * modify the operation's context before it's passed to the next link in the\n * chain. The returned context object is shallowly merged with the previous\n * context object.\n *\n * @param prevContext - The previous context of the operation (e.g. the value\n * of `operation.getContext()`)\n * @param operation - The GraphQL operation being executed, without the\n * `getContext` and `setContext` methods\n * @returns A partial context object or a promise that resolves to a partial context object\n */\n export function ContextSetter(\n prevContext: Readonly<ApolloLink.OperationContext>,\n operation: SetContextLink.SetContextOperation\n ):\n | Promise<Partial<ApolloLink.OperationContext>>\n | Partial<ApolloLink.OperationContext>;\n }\n\n /** {@inheritDoc @apollo/client/link/context!SetContextLink.SetContextLinkDocumentationTypes.ContextSetter:function(1)} */\n export type ContextSetter = (\n prevContext: Readonly<ApolloLink.OperationContext>,\n operation: SetContextLink.SetContextOperation\n ) =>\n | Promise<Partial<ApolloLink.OperationContext>>\n | Partial<ApolloLink.OperationContext>;\n\n /**\n * @deprecated\n * Use `ContextSetter` instead. This type is used by the deprecated\n * `setContext` function.\n */\n export type LegacyContextSetter = (\n operation: SetContextLink.SetContextOperation,\n prevContext: Readonly<ApolloLink.OperationContext>\n ) =>\n | Promise<Partial<ApolloLink.OperationContext>>\n | Partial<ApolloLink.OperationContext>;\n\n /**\n * An `ApolloLink.Operation` object without the `getContext` and `setContext`\n * methods. This prevents context setters from directly manipulating the\n * context during the setter function execution.\n */\n export type SetContextOperation = Omit<\n ApolloLink.Operation,\n \"getContext\" | \"setContext\"\n >;\n}\n\n/**\n * @deprecated\n * Use `SetContextLink` from `@apollo/client/link/context` instead. Note you\n * will need to flip the arguments when using `SetContextLink` as `prevContext`\n * is the first argument.\n *\n * ```ts\n * new SetContextLink((prevContext, operation) => {\n * // ...\n * });\n * ```\n */\nexport function setContext(setter: SetContextLink.LegacyContextSetter) {\n return new SetContextLink((prevContext, operation) =>\n setter(operation, prevContext)\n );\n}\n/**\n * `SetContextLink` is a non-terminating link that allows you to modify the\n * context of GraphQL operations before they're passed to the next link in the\n * chain. This is commonly used for authentication, adding headers, and other\n * request-time configuration.\n *\n * @example\n *\n * ```ts\n * import { SetContextLink } from \"@apollo/client/link/context\";\n *\n * const link = new SetContextLink((prevContext, operation) => {\n * return {\n * credentials: \"include\",\n * // ...\n * };\n * });\n * ```\n */\nexport class SetContextLink extends ApolloLink {\n constructor(setter: SetContextLink.ContextSetter) {\n super((operation, forward) => {\n const { ...request } = operation as SetContextLink.SetContextOperation;\n\n Object.defineProperty(request, \"client\", {\n enumerable: false,\n value: operation.client,\n });\n\n return new Observable((observer) => {\n let closed = false;\n Promise.resolve(request)\n .then((req) => setter(operation.getContext(), req))\n .then(operation.setContext)\n .then(() => {\n if (!closed) {\n forward(operation).subscribe(observer);\n }\n })\n .catch(observer.error.bind(observer));\n\n return () => {\n closed = true;\n };\n });\n });\n }\n}\n"],"names":[],"mappings":";;;AAwEA,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;AAxEA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAEA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CA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AAoC,CAAC,CAArC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6C,CAAC,CAAC;gBAEvC,CAAR,CAAA,CAAA,CAAA,CAAA,EAAe,CAAf,EAAkB,CAAlB,EAAA;oBACU,CAAV,CAAA,CAAA,CAAA,CAAA,EAAA,EAAmB,CAAnB,CAAA,CAAA,CAAuB;gBACf,CAAC;YACH,CAAC,CAAC;QACJ,CAAC,CAAC;IACJ;AACF;AA5BA,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;"}
@@ -1,7 +1,50 @@
1
1
  import { ApolloLink } from "@apollo/client/link";
2
2
  export declare namespace SetContextLink {
3
- type ContextSetter = (prevContext: ApolloLink.OperationContext, operation: SetContextOperation) => Promise<Partial<ApolloLink.OperationContext>> | Partial<ApolloLink.OperationContext>;
4
- type LegacyContextSetter = (operation: SetContextOperation, prevContext: ApolloLink.OperationContext) => Promise<Partial<ApolloLink.OperationContext>> | Partial<ApolloLink.OperationContext>;
3
+ namespace SetContextLinkDocumentationTypes {
4
+ /**
5
+ * A function that returns an updated context object for an Apollo Link
6
+ * operation.
7
+ *
8
+ * The context setter function is called for each operation and allows you to
9
+ * modify the operation's context before it's passed to the next link in the
10
+ * chain. The returned context object is shallowly merged with the previous
11
+ * context object.
12
+ *
13
+ * @param prevContext - The previous context of the operation (e.g. the value
14
+ * of `operation.getContext()`)
15
+ * @param operation - The GraphQL operation being executed, without the
16
+ * `getContext` and `setContext` methods
17
+ * @returns A partial context object or a promise that resolves to a partial context object
18
+ */
19
+ function ContextSetter(prevContext: Readonly<ApolloLink.OperationContext>, operation: SetContextLink.SetContextOperation): Promise<Partial<ApolloLink.OperationContext>> | Partial<ApolloLink.OperationContext>;
20
+ }
21
+ /**
22
+ * A function that returns an updated context object for an Apollo Link
23
+ * operation.
24
+ *
25
+ * The context setter function is called for each operation and allows you to
26
+ * modify the operation's context before it's passed to the next link in the
27
+ * chain. The returned context object is shallowly merged with the previous
28
+ * context object.
29
+ *
30
+ * @param prevContext - The previous context of the operation (e.g. the value
31
+ * of `operation.getContext()`)
32
+ * @param operation - The GraphQL operation being executed, without the
33
+ * `getContext` and `setContext` methods
34
+ * @returns A partial context object or a promise that resolves to a partial context object
35
+ */
36
+ type ContextSetter = (prevContext: Readonly<ApolloLink.OperationContext>, operation: SetContextLink.SetContextOperation) => Promise<Partial<ApolloLink.OperationContext>> | Partial<ApolloLink.OperationContext>;
37
+ /**
38
+ * @deprecated
39
+ * Use `ContextSetter` instead. This type is used by the deprecated
40
+ * `setContext` function.
41
+ */
42
+ type LegacyContextSetter = (operation: SetContextLink.SetContextOperation, prevContext: Readonly<ApolloLink.OperationContext>) => Promise<Partial<ApolloLink.OperationContext>> | Partial<ApolloLink.OperationContext>;
43
+ /**
44
+ * An `ApolloLink.Operation` object without the `getContext` and `setContext`
45
+ * methods. This prevents context setters from directly manipulating the
46
+ * context during the setter function execution.
47
+ */
5
48
  type SetContextOperation = Omit<ApolloLink.Operation, "getContext" | "setContext">;
6
49
  }
7
50
  /**
@@ -17,6 +60,25 @@ export declare namespace SetContextLink {
17
60
  * ```
18
61
  */
19
62
  export declare function setContext(setter: SetContextLink.LegacyContextSetter): SetContextLink;
63
+ /**
64
+ * `SetContextLink` is a non-terminating link that allows you to modify the
65
+ * context of GraphQL operations before they're passed to the next link in the
66
+ * chain. This is commonly used for authentication, adding headers, and other
67
+ * request-time configuration.
68
+ *
69
+ * @example
70
+ *
71
+ * ```ts
72
+ * import { SetContextLink } from "@apollo/client/link/context";
73
+ *
74
+ * const link = new SetContextLink((prevContext, operation) => {
75
+ * return {
76
+ * credentials: "include",
77
+ * // ...
78
+ * };
79
+ * });
80
+ * ```
81
+ */
20
82
  export declare class SetContextLink extends ApolloLink {
21
83
  constructor(setter: SetContextLink.ContextSetter);
22
84
  }
@@ -12,6 +12,50 @@ const link_1 = require("@apollo/client/link");
12
12
  function onError(errorHandler) {
13
13
  return new ErrorLink(errorHandler);
14
14
  }
15
+ /**
16
+ * Use the `ErrorLink` to perform custom logic when a [GraphQL or network error](https://apollographql.com/docs/react/data/error-handling)
17
+ * occurs.
18
+ *
19
+ * @remarks
20
+ *
21
+ * This link is used after the GraphQL operation completes and execution is
22
+ * moving back up your [link chain](https://apollographql.com/docs/react/introduction#handling-a-response). The `errorHandler` function should
23
+ * not return a value unless you want to [retry the operation](https://apollographql.com/docs/react/data/error-handling#retrying-operations).
24
+ *
25
+ * For more information on the types of errors that might be encountered, see
26
+ * the guide on [error handling](https://apollographql.com/docs/react/data/error-handling).
27
+ *
28
+ * @example
29
+ *
30
+ * ```ts
31
+ * import { ErrorLink } from "@apollo/client/link/error";
32
+ * import {
33
+ * CombinedGraphQLErrors,
34
+ * CombinedProtocolErrors,
35
+ * } from "@apollo/client/errors";
36
+ *
37
+ * // Log any GraphQL errors, protocol errors, or network error that occurred
38
+ * const errorLink = new ErrorLink(({ error, operation }) => {
39
+ * if (CombinedGraphQLErrors.is(error)) {
40
+ * error.errors.forEach(({ message, locations, path }) =>
41
+ * console.log(
42
+ * `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`
43
+ * )
44
+ * );
45
+ * } else if (CombinedProtocolErrors.is(error)) {
46
+ * error.errors.forEach(({ message, extensions }) =>
47
+ * console.log(
48
+ * `[Protocol error]: Message: ${message}, Extensions: ${JSON.stringify(
49
+ * extensions
50
+ * )}`
51
+ * )
52
+ * );
53
+ * } else {
54
+ * console.error(`[Network error]: ${error}`);
55
+ * }
56
+ * });
57
+ * ```
58
+ */
15
59
  class ErrorLink extends link_1.ApolloLink {
16
60
  constructor(errorHandler) {
17
61
  super((operation, forward) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../../src/link/error/index.ts"],"sourcesContent":["import type { Subscription } from \"rxjs\";\nimport { Observable } from \"rxjs\";\n\nimport type { ErrorLike } from \"@apollo/client\";\nimport {\n CombinedGraphQLErrors,\n graphQLResultHasProtocolErrors,\n PROTOCOL_ERRORS_SYMBOL,\n toErrorLike,\n} from \"@apollo/client/errors\";\nimport { ApolloLink } from \"@apollo/client/link\";\n\nexport declare namespace ErrorLink {\n /**\n * Callback to be triggered when an error occurs within the link stack.\n */\n export interface ErrorHandler {\n (options: ErrorHandlerOptions): Observable<ApolloLink.Result> | void;\n }\n\n export interface ErrorHandlerOptions {\n /**\n * The error that occurred during the operation execution. This can be a\n * `CombinedGraphQLErrors` instance (for GraphQL errors) or another error\n * type (for network errors).\n *\n * Use `CombinedGraphQLErrors.is(error)` to check if it's a GraphQL error with an `errors` array.\n */\n error: ErrorLike;\n /**\n * The raw GraphQL result from the server (if available), which may include\n * partial data alongside errors.\n */\n result?: ApolloLink.Result;\n\n /** The details of the GraphQL operation that produced an error. */\n operation: ApolloLink.Operation;\n\n /**\n * A function that calls the next link in the link chain. Calling\n * `return forward(operation)` in your `ErrorLink` callback\n * [retries the operation](../../data/error-handling#retrying-operations), returning a new observable for the\n * upstream link to subscribe to.\n */\n forward: ApolloLink.ForwardFunction;\n }\n}\n\n// For backwards compatibility.\nexport import ErrorHandler = ErrorLink.ErrorHandler;\n\n/**\n * @deprecated\n * Use `ErrorLink` from `@apollo/client/link/error` instead.\n */\nexport function onError(errorHandler: ErrorHandler) {\n return new ErrorLink(errorHandler);\n}\n\nexport class ErrorLink extends ApolloLink {\n constructor(errorHandler: ErrorLink.ErrorHandler) {\n super((operation, forward) => {\n return new Observable((observer) => {\n let sub: Subscription | undefined;\n let retriedSub: Subscription | undefined;\n let retriedResult: ReturnType<ErrorHandler>;\n\n try {\n sub = forward(operation).subscribe({\n next: (result) => {\n const handler =\n operation.client[\"queryManager\"].incrementalHandler;\n const errors =\n handler.isIncrementalResult(result) ?\n handler.extractErrors(result)\n : result.errors;\n if (errors) {\n retriedResult = errorHandler({\n error: new CombinedGraphQLErrors(result, errors),\n result,\n operation,\n forward,\n });\n } else if (graphQLResultHasProtocolErrors(result)) {\n retriedResult = errorHandler({\n error: result.extensions[PROTOCOL_ERRORS_SYMBOL],\n result,\n operation,\n forward,\n });\n }\n\n retriedSub = retriedResult?.subscribe(observer);\n\n if (!retriedSub) {\n observer.next(result);\n }\n },\n error: (error) => {\n retriedResult = errorHandler({\n operation,\n error: toErrorLike(error),\n forward,\n });\n retriedSub = retriedResult?.subscribe(observer);\n\n if (!retriedSub) {\n observer.error(error);\n }\n },\n complete: () => {\n // disable the previous sub from calling complete on observable\n // if retry is in flight.\n if (!retriedResult) {\n observer.complete();\n }\n },\n });\n } catch (e) {\n errorHandler({ error: toErrorLike(e), operation, forward });\n observer.error(e);\n }\n\n return () => {\n if (sub) sub.unsubscribe();\n if (retriedSub) retriedSub.unsubscribe();\n };\n });\n });\n }\n}\n"],"names":[],"mappings":";;;AAuDA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAtDA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAGA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAMA,CAAA,CAAA,CAAA,CAAA,EAA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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../../src/link/error/index.ts"],"sourcesContent":["import type { Subscription } from \"rxjs\";\nimport { Observable } from \"rxjs\";\n\nimport type { ErrorLike } from \"@apollo/client\";\nimport {\n CombinedGraphQLErrors,\n graphQLResultHasProtocolErrors,\n PROTOCOL_ERRORS_SYMBOL,\n toErrorLike,\n} from \"@apollo/client/errors\";\nimport { ApolloLink } from \"@apollo/client/link\";\n\nexport declare namespace ErrorLink {\n // Using a different namespace name to avoid clash with\n // `ApolloLink.DocumentationTypes`\n export namespace ErrorLinkDocumentationTypes {\n /**\n * Callback that is called by `ErrorLink` when an error occurs from a\n * downstream link in link chain.\n *\n * @param options - The options object provided by `ErrorLink` to the error\n * handler when an error occurs.\n */\n export function ErrorHandler(\n options: ErrorHandlerOptions\n ): Observable<ApolloLink.Result> | void;\n }\n\n /** {@inheritDoc @apollo/client/link/error!ErrorLink.ErrorLinkDocumentationTypes.ErrorHandler:function(1)} */\n export interface ErrorHandler {\n (options: ErrorHandlerOptions): Observable<ApolloLink.Result> | void;\n }\n\n /**\n * The object provided to the `ErrorHandler` callback function.\n */\n export interface ErrorHandlerOptions {\n /**\n * The error that occurred during the operation execution. This can be a\n * `CombinedGraphQLErrors` instance (for GraphQL errors) or another error\n * type (for network errors).\n *\n * Use `CombinedGraphQLErrors.is(error)` to check if it's a GraphQL error with an `errors` array.\n */\n error: ErrorLike;\n /**\n * The raw GraphQL result from the server (if available), which may include\n * partial data alongside errors.\n */\n result?: ApolloLink.Result;\n\n /** The details of the GraphQL operation that produced an error. */\n operation: ApolloLink.Operation;\n\n /**\n * A function that calls the next link in the link chain. Calling\n * `return forward(operation)` in your `ErrorLink` callback\n * [retries the operation](../../data/error-handling#retrying-operations), returning a new observable for the\n * upstream link to subscribe to.\n */\n forward: ApolloLink.ForwardFunction;\n }\n}\n\n/**\n * @deprecated\n * Use `ErrorLink` from `@apollo/client/link/error` instead.\n */\nexport function onError(errorHandler: ErrorLink.ErrorHandler) {\n return new ErrorLink(errorHandler);\n}\n\n/**\n * Use the `ErrorLink` to perform custom logic when a [GraphQL or network error](https://apollographql.com/docs/react/data/error-handling)\n * occurs.\n *\n * @remarks\n *\n * This link is used after the GraphQL operation completes and execution is\n * moving back up your [link chain](https://apollographql.com/docs/react/introduction#handling-a-response). The `errorHandler` function should\n * not return a value unless you want to [retry the operation](https://apollographql.com/docs/react/data/error-handling#retrying-operations).\n *\n * For more information on the types of errors that might be encountered, see\n * the guide on [error handling](https://apollographql.com/docs/react/data/error-handling).\n *\n * @example\n *\n * ```ts\n * import { ErrorLink } from \"@apollo/client/link/error\";\n * import {\n * CombinedGraphQLErrors,\n * CombinedProtocolErrors,\n * } from \"@apollo/client/errors\";\n *\n * // Log any GraphQL errors, protocol errors, or network error that occurred\n * const errorLink = new ErrorLink(({ error, operation }) => {\n * if (CombinedGraphQLErrors.is(error)) {\n * error.errors.forEach(({ message, locations, path }) =>\n * console.log(\n * `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`\n * )\n * );\n * } else if (CombinedProtocolErrors.is(error)) {\n * error.errors.forEach(({ message, extensions }) =>\n * console.log(\n * `[Protocol error]: Message: ${message}, Extensions: ${JSON.stringify(\n * extensions\n * )}`\n * )\n * );\n * } else {\n * console.error(`[Network error]: ${error}`);\n * }\n * });\n * ```\n */\nexport class ErrorLink extends ApolloLink {\n constructor(errorHandler: ErrorLink.ErrorHandler) {\n super((operation, forward) => {\n return new Observable((observer) => {\n let sub: Subscription | undefined;\n let retriedSub: Subscription | undefined;\n let retriedResult: ReturnType<ErrorLink.ErrorHandler>;\n\n try {\n sub = forward(operation).subscribe({\n next: (result) => {\n const handler =\n operation.client[\"queryManager\"].incrementalHandler;\n const errors =\n handler.isIncrementalResult(result) ?\n handler.extractErrors(result)\n : result.errors;\n if (errors) {\n retriedResult = errorHandler({\n error: new CombinedGraphQLErrors(result, errors),\n result,\n operation,\n forward,\n });\n } else if (graphQLResultHasProtocolErrors(result)) {\n retriedResult = errorHandler({\n error: result.extensions[PROTOCOL_ERRORS_SYMBOL],\n result,\n operation,\n forward,\n });\n }\n\n retriedSub = retriedResult?.subscribe(observer);\n\n if (!retriedSub) {\n observer.next(result);\n }\n },\n error: (error) => {\n retriedResult = errorHandler({\n operation,\n error: toErrorLike(error),\n forward,\n });\n retriedSub = retriedResult?.subscribe(observer);\n\n if (!retriedSub) {\n observer.error(error);\n }\n },\n complete: () => {\n // disable the previous sub from calling complete on observable\n // if retry is in flight.\n if (!retriedResult) {\n observer.complete();\n }\n },\n });\n } catch (e) {\n errorHandler({ error: toErrorLike(e), operation, forward });\n observer.error(e);\n }\n\n return () => {\n if (sub) sub.unsubscribe();\n if (retriedSub) retriedSub.unsubscribe();\n };\n });\n });\n }\n}\n"],"names":[],"mappings":";;;AAoEA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAnEA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAGA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAMA,CAA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