@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
@@ -2,28 +2,150 @@ import type { GraphQLSchema } from "graphql";
2
2
  import { Observable } from "rxjs";
3
3
  import { ApolloLink } from "@apollo/client/link";
4
4
  export declare namespace SchemaLink {
5
+ namespace SchemaLinkDocumentationTypes {
6
+ /**
7
+ * A function that returns the resolver context for a given operation.
8
+ *
9
+ * This function is called for each operation and allows you to create
10
+ * operation-specific context. This is useful when you need to include
11
+ * information from the operation (like headers, variables, etc.) in the
12
+ * resolver context.
13
+ *
14
+ * @param operation - The Apollo Link operation
15
+ * @returns The resolver context object or a promise that resolves to the context
16
+ *
17
+ * @example
18
+ *
19
+ * ```ts
20
+ * const link = new SchemaLink({
21
+ * schema,
22
+ * context: (operation) => {
23
+ * return {
24
+ * userId: operation.getContext().userId,
25
+ * dataSources: {
26
+ * userAPI: new UserAPI(),
27
+ * },
28
+ * };
29
+ * },
30
+ * });
31
+ * ```
32
+ */
33
+ function ResolverContextFunction(operation: ApolloLink.Operation): SchemaLink.ResolverContext | PromiseLike<SchemaLink.ResolverContext>;
34
+ }
35
+ /**
36
+ * The resolver context object passed to GraphQL resolvers.
37
+ *
38
+ * This context object is passed as the third parameter to GraphQL resolvers
39
+ * and typically contains data-fetching connectors, authentication information,
40
+ * and other request-specific data.
41
+ */
5
42
  type ResolverContext = Record<string, any>;
6
- type ResolverContextFunction = (operation: ApolloLink.Operation) => ResolverContext | PromiseLike<ResolverContext>;
43
+ /**
44
+ * A function that returns the resolver context for a given operation.
45
+ *
46
+ * This function is called for each operation and allows you to create
47
+ * operation-specific context. This is useful when you need to include
48
+ * information from the operation (like headers, variables, etc.) in the
49
+ * resolver context.
50
+ *
51
+ * @param operation - The Apollo Link operation
52
+ * @returns The resolver context object or a promise that resolves to the context
53
+ *
54
+ * @example
55
+ *
56
+ * ```ts
57
+ * const link = new SchemaLink({
58
+ * schema,
59
+ * context: (operation) => {
60
+ * return {
61
+ * userId: operation.getContext().userId,
62
+ * dataSources: {
63
+ * userAPI: new UserAPI(),
64
+ * },
65
+ * };
66
+ * },
67
+ * });
68
+ * ```
69
+ */
70
+ type ResolverContextFunction = (operation: ApolloLink.Operation) => SchemaLink.ResolverContext | PromiseLike<SchemaLink.ResolverContext>;
71
+ /**
72
+ * Options for configuring the `SchemaLink`.
73
+ */
7
74
  interface Options {
8
75
  /**
9
- * The schema to generate responses from.
76
+ * An executable GraphQL schema to use for operation execution.
77
+ *
78
+ * @remarks
79
+ *
80
+ * This should be a complete, executable GraphQL schema created using
81
+ * tools like `makeExecutableSchema` from `@graphql-tools/schema` or
82
+ * `buildSchema` from `graphql`.
83
+ *
84
+ * @example
85
+ *
86
+ * ```ts
87
+ * import { makeExecutableSchema } from "@graphql-tools/schema";
88
+ *
89
+ * const schema = makeExecutableSchema({
90
+ * typeDefs,
91
+ * resolvers,
92
+ * });
93
+ *
94
+ * const link = new SchemaLink({ schema });
95
+ * ```
10
96
  */
11
97
  schema: GraphQLSchema;
12
98
  /**
13
- * The root value to use when generating responses.
99
+ * The root value passed to root-level resolvers. It's typically not used in
100
+ * most schemas but can be useful for certain advanced patterns.
14
101
  */
15
102
  rootValue?: any;
16
103
  /**
17
- * A context to provide to resolvers declared within the schema.
104
+ * Context object or function that returns the context object to provide to
105
+ * resolvers. The context is passed as the third parameter to all GraphQL
106
+ * resolvers.
107
+ *
108
+ * - If a static object is provided, the same context will be used for all
109
+ * operations
110
+ * - If a function is provided, the function is called for each operation to
111
+ * generate operation-specific context
18
112
  */
19
- context?: ResolverContext | ResolverContextFunction;
113
+ context?: SchemaLink.ResolverContext | SchemaLink.ResolverContextFunction;
20
114
  /**
21
- * Validate incoming queries against the given schema, returning
22
- * validation errors as a GraphQL server would.
115
+ * Whether to validate incoming queries against the schema before execution.
116
+ *
117
+ * When enabled, queries will be validated against the schema before execution,
118
+ * and validation errors will be returned in the result's `errors` array,
119
+ * just like a remote GraphQL server would.
120
+ *
121
+ * This is useful for testing and development to catch query errors early,
122
+ * but may add overhead in production environments.
123
+ *
124
+ * @defaultValue false
23
125
  */
24
126
  validate?: boolean;
25
127
  }
26
128
  }
129
+ /**
130
+ * `SchemaLink` is a terminating link that executes GraphQL operations against
131
+ * a local GraphQL schema instead of making network requests. This is commonly
132
+ * used for server-side rendering (SSR) and mocking dataa.
133
+ *
134
+ * > [!NOTE]
135
+ * > While `SchemaLink` can provide GraphQL results on the client, the GraphQL
136
+ * > execution layer is [quite large](https://bundlephobia.com/result?p=graphql) for practical client-side use.
137
+ * > For client-side state management, consider Apollo Client's [local state management](https://apollographql.com/docs/react/local-state/local-state-management/)
138
+ * > functionality instead, which integrates with the Apollo Client cache.
139
+ *
140
+ * @example
141
+ *
142
+ * ```ts
143
+ * import { SchemaLink } from "@apollo/client/link/schema";
144
+ * import schema from "./path/to/your/schema";
145
+ *
146
+ * const link = new SchemaLink({ schema });
147
+ * ```
148
+ */
27
149
  export declare class SchemaLink extends ApolloLink {
28
150
  schema: SchemaLink.Options["schema"];
29
151
  rootValue: SchemaLink.Options["rootValue"];
@@ -32,4 +154,4 @@ export declare class SchemaLink extends ApolloLink {
32
154
  constructor(options: SchemaLink.Options);
33
155
  request(operation: ApolloLink.Operation): Observable<ApolloLink.Result>;
34
156
  }
35
- //# sourceMappingURL=index.d.ts.map
157
+ //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,26 @@
1
1
  import { execute, validate } from "graphql";
2
2
  import { Observable } from "rxjs";
3
3
  import { ApolloLink } from "@apollo/client/link";
4
+ /**
5
+ * `SchemaLink` is a terminating link that executes GraphQL operations against
6
+ * a local GraphQL schema instead of making network requests. This is commonly
7
+ * used for server-side rendering (SSR) and mocking dataa.
8
+ *
9
+ * > [!NOTE]
10
+ * > While `SchemaLink` can provide GraphQL results on the client, the GraphQL
11
+ * > execution layer is [quite large](https://bundlephobia.com/result?p=graphql) for practical client-side use.
12
+ * > For client-side state management, consider Apollo Client's [local state management](https://apollographql.com/docs/react/local-state/local-state-management/)
13
+ * > functionality instead, which integrates with the Apollo Client cache.
14
+ *
15
+ * @example
16
+ *
17
+ * ```ts
18
+ * import { SchemaLink } from "@apollo/client/link/schema";
19
+ * import schema from "./path/to/your/schema";
20
+ *
21
+ * const link = new SchemaLink({ schema });
22
+ * ```
23
+ */
4
24
  export class SchemaLink extends ApolloLink {
5
25
  schema;
6
26
  rootValue;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/schema/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAgCjD,MAAM,OAAO,UAAW,SAAQ,UAAU;IACjC,MAAM,CAA+B;IACrC,SAAS,CAAkC;IAC3C,OAAO,CAAgC;IACvC,QAAQ,CAAU;IAEzB,YAAY,OAA2B;QACrC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IACrC,CAAC;IAEM,OAAO,CACZ,SAA+B;QAE/B,OAAO,IAAI,UAAU,CAAoB,CAAC,QAAQ,EAAE,EAAE;YACpD,IAAI,OAAO,CAA6B,CAAC,OAAO,EAAE,EAAE,CAClD,OAAO,CACL,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;gBAClC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;gBACzB,CAAC,CAAC,IAAI,CAAC,OAAO,CACf,CACF;iBACE,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;gBAChB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;oBAClB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;oBAChE,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBAChC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;oBACtC,CAAC;gBACH,CAAC;gBAED,OAAO,OAAO,CAAC;oBACb,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,QAAQ,EAAE,SAAS,CAAC,KAAK;oBACzB,SAAS,EAAE,IAAI,CAAC,SAAS;oBACzB,YAAY,EAAE,OAAO;oBACrB,cAAc,EAAE,SAAS,CAAC,SAAS;oBACnC,aAAa,EAAE,SAAS,CAAC,aAAa;iBACvC,CAAC,CAAC;YACL,CAAC,CAAC;iBACD,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;gBACb,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;oBACrB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACpB,QAAQ,CAAC,QAAQ,EAAE,CAAC;gBACtB,CAAC;YACH,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBACf,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;oBACrB,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import type { GraphQLSchema } from \"graphql\";\nimport { execute, validate } from \"graphql\";\nimport { Observable } from \"rxjs\";\n\nimport { ApolloLink } from \"@apollo/client/link\";\n\nexport declare namespace SchemaLink {\n export type ResolverContext = Record<string, any>;\n export type ResolverContextFunction = (\n operation: ApolloLink.Operation\n ) => ResolverContext | PromiseLike<ResolverContext>;\n\n export interface Options {\n /**\n * The schema to generate responses from.\n */\n schema: GraphQLSchema;\n\n /**\n * The root value to use when generating responses.\n */\n rootValue?: any;\n\n /**\n * A context to provide to resolvers declared within the schema.\n */\n context?: ResolverContext | ResolverContextFunction;\n\n /**\n * Validate incoming queries against the given schema, returning\n * validation errors as a GraphQL server would.\n */\n validate?: boolean;\n }\n}\n\nexport class SchemaLink extends ApolloLink {\n public schema: SchemaLink.Options[\"schema\"];\n public rootValue: SchemaLink.Options[\"rootValue\"];\n public context: SchemaLink.Options[\"context\"];\n public validate: boolean;\n\n constructor(options: SchemaLink.Options) {\n super();\n this.schema = options.schema;\n this.rootValue = options.rootValue;\n this.context = options.context;\n this.validate = !!options.validate;\n }\n\n public request(\n operation: ApolloLink.Operation\n ): Observable<ApolloLink.Result> {\n return new Observable<ApolloLink.Result>((observer) => {\n new Promise<SchemaLink.ResolverContext>((resolve) =>\n resolve(\n typeof this.context === \"function\" ?\n this.context(operation)\n : this.context\n )\n )\n .then((context) => {\n if (this.validate) {\n const validationErrors = validate(this.schema, operation.query);\n if (validationErrors.length > 0) {\n return { errors: validationErrors };\n }\n }\n\n return execute({\n schema: this.schema,\n document: operation.query,\n rootValue: this.rootValue,\n contextValue: context,\n variableValues: operation.variables,\n operationName: operation.operationName,\n });\n })\n .then((data) => {\n if (!observer.closed) {\n observer.next(data);\n observer.complete();\n }\n })\n .catch((error) => {\n if (!observer.closed) {\n observer.error(error);\n }\n });\n });\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/schema/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA+GjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU;IACjC,MAAM,CAA+B;IACrC,SAAS,CAAkC;IAC3C,OAAO,CAAgC;IACvC,QAAQ,CAAU;IAEzB,YAAY,OAA2B;QACrC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,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AC;iBACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBACf,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;oBACrB,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import type { GraphQLSchema } from \"graphql\";\nimport { execute, validate } from \"graphql\";\nimport { Observable } from \"rxjs\";\n\nimport { ApolloLink } from \"@apollo/client/link\";\n\nexport declare namespace SchemaLink {\n export namespace SchemaLinkDocumentationTypes {\n /**\n * A function that returns the resolver context for a given operation.\n *\n * This function is called for each operation and allows you to create\n * operation-specific context. This is useful when you need to include\n * information from the operation (like headers, variables, etc.) in the\n * resolver context.\n *\n * @param operation - The Apollo Link operation\n * @returns The resolver context object or a promise that resolves to the context\n *\n * @example\n *\n * ```ts\n * const link = new SchemaLink({\n * schema,\n * context: (operation) => {\n * return {\n * userId: operation.getContext().userId,\n * dataSources: {\n * userAPI: new UserAPI(),\n * },\n * };\n * },\n * });\n * ```\n */\n export function ResolverContextFunction(\n operation: ApolloLink.Operation\n ): SchemaLink.ResolverContext | PromiseLike<SchemaLink.ResolverContext>;\n }\n /**\n * The resolver context object passed to GraphQL resolvers.\n *\n * This context object is passed as the third parameter to GraphQL resolvers\n * and typically contains data-fetching connectors, authentication information,\n * and other request-specific data.\n */\n export type ResolverContext = Record<string, any>;\n\n /** {@inheritDoc @apollo/client/link/schema!SchemaLink.SchemaLinkDocumentationTypes.ResolverContextFunction:function(1)} */\n export type ResolverContextFunction = (\n operation: ApolloLink.Operation\n ) => SchemaLink.ResolverContext | PromiseLike<SchemaLink.ResolverContext>;\n\n /**\n * Options for configuring the `SchemaLink`.\n */\n export interface Options {\n /**\n * An executable GraphQL schema to use for operation execution.\n *\n * @remarks\n *\n * This should be a complete, executable GraphQL schema created using\n * tools like `makeExecutableSchema` from `@graphql-tools/schema` or\n * `buildSchema` from `graphql`.\n *\n * @example\n *\n * ```ts\n * import { makeExecutableSchema } from \"@graphql-tools/schema\";\n *\n * const schema = makeExecutableSchema({\n * typeDefs,\n * resolvers,\n * });\n *\n * const link = new SchemaLink({ schema });\n * ```\n */\n schema: GraphQLSchema;\n\n /**\n * The root value passed to root-level resolvers. It's typically not used in\n * most schemas but can be useful for certain advanced patterns.\n */\n rootValue?: any;\n\n /**\n * Context object or function that returns the context object to provide to\n * resolvers. The context is passed as the third parameter to all GraphQL\n * resolvers.\n *\n * - If a static object is provided, the same context will be used for all\n * operations\n * - If a function is provided, the function is called for each operation to\n * generate operation-specific context\n */\n context?: SchemaLink.ResolverContext | SchemaLink.ResolverContextFunction;\n\n /**\n * Whether to validate incoming queries against the schema before execution.\n *\n * When enabled, queries will be validated against the schema before execution,\n * and validation errors will be returned in the result's `errors` array,\n * just like a remote GraphQL server would.\n *\n * This is useful for testing and development to catch query errors early,\n * but may add overhead in production environments.\n *\n * @defaultValue false\n */\n validate?: boolean;\n }\n}\n\n/**\n * `SchemaLink` is a terminating link that executes GraphQL operations against\n * a local GraphQL schema instead of making network requests. This is commonly\n * used for server-side rendering (SSR) and mocking dataa.\n *\n * > [!NOTE]\n * > While `SchemaLink` can provide GraphQL results on the client, the GraphQL\n * > execution layer is [quite large](https://bundlephobia.com/result?p=graphql) for practical client-side use.\n * > For client-side state management, consider Apollo Client's [local state management](https://apollographql.com/docs/react/local-state/local-state-management/)\n * > functionality instead, which integrates with the Apollo Client cache.\n *\n * @example\n *\n * ```ts\n * import { SchemaLink } from \"@apollo/client/link/schema\";\n * import schema from \"./path/to/your/schema\";\n *\n * const link = new SchemaLink({ schema });\n * ```\n */\nexport class SchemaLink extends ApolloLink {\n public schema: SchemaLink.Options[\"schema\"];\n public rootValue: SchemaLink.Options[\"rootValue\"];\n public context: SchemaLink.Options[\"context\"];\n public validate: boolean;\n\n constructor(options: SchemaLink.Options) {\n super();\n this.schema = options.schema;\n this.rootValue = options.rootValue;\n this.context = options.context;\n this.validate = !!options.validate;\n }\n\n public request(\n operation: ApolloLink.Operation\n ): Observable<ApolloLink.Result> {\n return new Observable<ApolloLink.Result>((observer) => {\n new Promise<SchemaLink.ResolverContext>((resolve) =>\n resolve(\n typeof this.context === \"function\" ?\n this.context(operation)\n : this.context\n )\n )\n .then((context) => {\n if (this.validate) {\n const validationErrors = validate(this.schema, operation.query);\n if (validationErrors.length > 0) {\n return { errors: validationErrors };\n }\n }\n\n return execute({\n schema: this.schema,\n document: operation.query,\n rootValue: this.rootValue,\n contextValue: context,\n variableValues: operation.variables,\n operationName: operation.operationName,\n });\n })\n .then((data) => {\n if (!observer.closed) {\n observer.next(data);\n observer.complete();\n }\n })\n .catch((error) => {\n if (!observer.closed) {\n observer.error(error);\n }\n });\n });\n }\n}\n"]}
@@ -1,6 +1,29 @@
1
1
  import type { Client } from "graphql-ws";
2
2
  import { Observable } from "rxjs";
3
3
  import { ApolloLink } from "@apollo/client/link";
4
+ /**
5
+ * The `GraphQLWsLink` is a terminating link sends GraphQL operations over a
6
+ * WebSocket connection using the [`graphql-ws`](https://www.npmjs.com/package/graphql-ws) library. It's used most
7
+ * commonly with GraphQL [subscriptions](https://apollographql.com/docs/react/data/subscriptions/),
8
+ *
9
+ * > [!NOTE]
10
+ * > This link works with the `graphql-ws` library. If your server uses
11
+ * > the deprecated `subscriptions-transport-ws` library, use the deprecated
12
+ * > [`WebSocketLink`](https://apollographql.com/docs/react/api/link/apollo-link-ws) link instead.
13
+ *
14
+ * @example
15
+ *
16
+ * ```ts
17
+ * import { GraphQLWsLink } from "@apollo/client/link/subscriptions";
18
+ * import { createClient } from "graphql-ws";
19
+ *
20
+ * const link = new GraphQLWsLink(
21
+ * createClient({
22
+ * url: "ws://localhost:3000/subscriptions",
23
+ * })
24
+ * );
25
+ * ```
26
+ */
4
27
  export declare class GraphQLWsLink extends ApolloLink {
5
28
  readonly client: Client;
6
29
  constructor(client: Client);
@@ -40,6 +40,29 @@ function isLikeCloseEvent(val) {
40
40
  function isLikeErrorEvent(err) {
41
41
  return isNonNullObject(err) && err.target?.readyState === WebSocket.CLOSED;
42
42
  }
43
+ /**
44
+ * The `GraphQLWsLink` is a terminating link sends GraphQL operations over a
45
+ * WebSocket connection using the [`graphql-ws`](https://www.npmjs.com/package/graphql-ws) library. It's used most
46
+ * commonly with GraphQL [subscriptions](https://apollographql.com/docs/react/data/subscriptions/),
47
+ *
48
+ * > [!NOTE]
49
+ * > This link works with the `graphql-ws` library. If your server uses
50
+ * > the deprecated `subscriptions-transport-ws` library, use the deprecated
51
+ * > [`WebSocketLink`](https://apollographql.com/docs/react/api/link/apollo-link-ws) link instead.
52
+ *
53
+ * @example
54
+ *
55
+ * ```ts
56
+ * import { GraphQLWsLink } from "@apollo/client/link/subscriptions";
57
+ * import { createClient } from "graphql-ws";
58
+ *
59
+ * const link = new GraphQLWsLink(
60
+ * createClient({
61
+ * url: "ws://localhost:3000/subscriptions",
62
+ * })
63
+ * );
64
+ * ```
65
+ */
43
66
  export class GraphQLWsLink extends ApolloLink {
44
67
  client;
45
68
  constructor(client) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/subscriptions/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,0CAA0C;AAC1C,EAAE;AACF,+EAA+E;AAC/E,0CAA0C;AAC1C,EAAE;AACF,2CAA2C;AAC3C,EAAE;AACF,wBAAwB;AACxB,EAAE;AACF,yCAAyC;AACzC,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,6EAA6E;AAC7E,sDAAsD;AACtD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,4EAA4E;AAC5E,gBAAgB;AAIhB,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,qBAAqB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C,GAAG,CAAC,EAAE,CAAC;wBACvC,OAAO,QAAQ,CAAC,KAAK;wBACnB,2CAA2C;wBAC3C,IAAI,KAAK,CACP,gBAAgB,SAAS,CAAC,CAAC,CAAC,eAAe,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,GACxD,SAAS,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EACjC,EAAE,CACH,CACF,CAAC;oBACJ,CAAC;oBAED,OAAO,QAAQ,CAAC,KAAK,CACnB,IAAI,qBAAqB,CAAC;wBACxB,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;qBACzC,CAAC,CACH,CAAC;gBACJ,CAAC;gBACD,+FAA+F;aAChD,CAClD,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["// This file is adapted from the graphql-ws npm package:\n// https://github.com/enisdenjo/graphql-ws\n//\n// Most of the file comes from that package's README; some other parts (such as\n// isLikeCloseEvent) come from its source.\n//\n// Here's the license of the original code:\n//\n// The MIT License (MIT)\n//\n// Copyright (c) 2020-2021 Denis Badurina\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport type { FormattedExecutionResult } from \"graphql\";\nimport type { Client, Sink } from \"graphql-ws\";\nimport { Observable } from \"rxjs\";\n\nimport { CombinedGraphQLErrors } from \"@apollo/client/errors\";\nimport { ApolloLink } from \"@apollo/client/link\";\nimport { print } from \"@apollo/client/utilities\";\nimport { isNonNullObject } from \"@apollo/client/utilities/internal\";\n\n// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close_event\nfunction isLikeCloseEvent(val: unknown): val is CloseEvent {\n return isNonNullObject(val) && \"code\" in val && \"reason\" in val;\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event\nfunction isLikeErrorEvent(err: unknown): err is Event {\n return isNonNullObject(err) && err.target?.readyState === WebSocket.CLOSED;\n}\n\nexport class GraphQLWsLink extends ApolloLink {\n constructor(public readonly client: Client) {\n super();\n }\n\n public request(\n operation: ApolloLink.Operation\n ): Observable<ApolloLink.Result> {\n return new Observable((observer) => {\n return this.client.subscribe<ApolloLink.Result>(\n { ...operation, query: print(operation.query) },\n {\n next: observer.next.bind(observer),\n complete: observer.complete.bind(observer),\n error: (err) => {\n if (err instanceof Error) {\n return observer.error(err);\n }\n const likeClose = isLikeCloseEvent(err);\n if (likeClose || isLikeErrorEvent(err)) {\n return observer.error(\n // reason will be available on clean closes\n new Error(\n `Socket closed${likeClose ? ` with event ${err.code}` : \"\"}${\n likeClose ? ` ${err.reason}` : \"\"\n }`\n )\n );\n }\n\n return observer.error(\n new CombinedGraphQLErrors({\n errors: Array.isArray(err) ? err : [err],\n })\n );\n },\n // casting around a wrong type in graphql-ws, which incorrectly expects `Sink<ExecutionResult>`\n } satisfies Sink<FormattedExecutionResult> as any\n );\n });\n }\n}\n"]}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jo/graphql-ws\n//\n// Most of the file comes from that package's README; some other parts (such as\n// isLikeCloseEvent) come from its source.\n//\n// Here's the license of the original code:\n//\n// The MIT License (MIT)\n//\n// Copyright (c) 2020-2021 Denis Badurina\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport type { FormattedExecutionResult } from \"graphql\";\nimport type { Client, Sink } from \"graphql-ws\";\nimport { Observable } from \"rxjs\";\n\nimport { CombinedGraphQLErrors } from \"@apollo/client/errors\";\nimport { ApolloLink } from \"@apollo/client/link\";\nimport { print } from \"@apollo/client/utilities\";\nimport { isNonNullObject } from \"@apollo/client/utilities/internal\";\n\n// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close_event\nfunction isLikeCloseEvent(val: unknown): val is CloseEvent {\n return isNonNullObject(val) && \"code\" in val && \"reason\" in val;\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event\nfunction isLikeErrorEvent(err: unknown): err is Event {\n return isNonNullObject(err) && err.target?.readyState === WebSocket.CLOSED;\n}\n\n/**\n * The `GraphQLWsLink` is a terminating link sends GraphQL operations over a\n * WebSocket connection using the [`graphql-ws`](https://www.npmjs.com/package/graphql-ws) library. It's used most\n * commonly with GraphQL [subscriptions](https://apollographql.com/docs/react/data/subscriptions/),\n *\n * > [!NOTE]\n * > This link works with the `graphql-ws` library. If your server uses\n * > the deprecated `subscriptions-transport-ws` library, use the deprecated\n * > [`WebSocketLink`](https://apollographql.com/docs/react/api/link/apollo-link-ws) link instead.\n *\n * @example\n *\n * ```ts\n * import { GraphQLWsLink } from \"@apollo/client/link/subscriptions\";\n * import { createClient } from \"graphql-ws\";\n *\n * const link = new GraphQLWsLink(\n * createClient({\n * url: \"ws://localhost:3000/subscriptions\",\n * })\n * );\n * ```\n */\nexport class GraphQLWsLink extends ApolloLink {\n constructor(public readonly client: Client) {\n super();\n }\n\n public request(\n operation: ApolloLink.Operation\n ): Observable<ApolloLink.Result> {\n return new Observable((observer) => {\n return this.client.subscribe<ApolloLink.Result>(\n { ...operation, query: print(operation.query) },\n {\n next: observer.next.bind(observer),\n complete: observer.complete.bind(observer),\n error: (err) => {\n if (err instanceof Error) {\n return observer.error(err);\n }\n const likeClose = isLikeCloseEvent(err);\n if (likeClose || isLikeErrorEvent(err)) {\n return observer.error(\n // reason will be available on clean closes\n new Error(\n `Socket closed${likeClose ? ` with event ${err.code}` : \"\"}${\n likeClose ? ` ${err.reason}` : \"\"\n }`\n )\n );\n }\n\n return observer.error(\n new CombinedGraphQLErrors({\n errors: Array.isArray(err) ? err : [err],\n })\n );\n },\n // casting around a wrong type in graphql-ws, which incorrectly expects `Sink<ExecutionResult>`\n } satisfies Sink<FormattedExecutionResult> as any\n );\n });\n }\n}\n"]}
@@ -4,24 +4,82 @@ import { SubscriptionClient } from "subscriptions-transport-ws";
4
4
  import { ApolloLink } from "@apollo/client/link";
5
5
  export declare namespace WebSocketLink {
6
6
  /**
7
- * Configuration to use when constructing the subscription client (subscriptions-transport-ws).
7
+ * Configuration options for creating a `WebSocketLink` instance.
8
+ *
9
+ * @remarks
10
+ *
11
+ * These configuration options are used when creating a `WebSocketLink` without
12
+ * providing an existing `SubscriptionClient` instance. The options are passed
13
+ * directly to the `SubscriptionClient` constructor from the `subscriptions-transport-ws`
14
+ * library.
8
15
  */
9
16
  interface Configuration {
10
17
  /**
11
- * The endpoint to connect to.
18
+ * The WebSocket endpoint URI to connect to.
19
+ *
20
+ * This should be a valid WebSocket URI (starting with `ws://` or `wss://`)
21
+ * that points to your GraphQL subscription endpoint.
22
+ *
23
+ * @example "ws://localhost:4000/subscriptions"
24
+ * @example "wss://api.example.com/graphql"
12
25
  */
13
26
  uri: string;
14
27
  /**
15
- * Options to pass when constructing the subscription client.
28
+ * Configuration options passed to the underlying `SubscriptionClient`.
29
+ *
30
+ * These options configure the WebSocket connection behavior, including
31
+ * reconnection settings, connection parameters, and event handlers.
32
+ *
33
+ * For a complete list of available options, see the
34
+ * [supported `subscriptions-transport-ws` options](https://github.com/apollographql/subscriptions-transport-ws/blob/master/src/client.ts#L61-L71).
16
35
  */
17
36
  options?: ClientOptions;
18
37
  /**
19
- * A custom WebSocket implementation to use.
38
+ * A custom WebSocket implementation to use for the connection.
39
+ *
40
+ * This is useful in environments that don't have native WebSocket support.
41
+ * You can provide a WebSocket polyfill or implementation that conforms to
42
+ * the W3C WebSocket API.
43
+ *
44
+ * @example
45
+ *
46
+ * ```ts
47
+ * import WebSocket from "ws";
48
+ *
49
+ * const wsLink = new WebSocketLink({
50
+ * uri: "ws://localhost:4000/subscriptions",
51
+ * webSocketImpl: WebSocket,
52
+ * });
53
+ * ```
20
54
  */
21
55
  webSocketImpl?: any;
22
56
  }
23
57
  }
24
- export import WebSocketParams = WebSocketLink.Configuration;
58
+ /**
59
+ * `WebSocketLink` is a terminating link that executes GraphQL operations over
60
+ * WebSocket connections using the `subscriptions-transport-ws` library. It's
61
+ * primarily used for GraphQL subscriptions but can also handle queries and
62
+ * mutations.
63
+ *
64
+ * @example
65
+ *
66
+ * ```ts
67
+ * import { WebSocketLink } from "@apollo/client/link/ws";
68
+ * import { SubscriptionClient } from "subscriptions-transport-ws";
69
+ *
70
+ * const wsLink = new WebSocketLink(
71
+ * new SubscriptionClient("ws://localhost:4000/subscriptions", {
72
+ * reconnect: true,
73
+ * })
74
+ * );
75
+ * ```
76
+ *
77
+ * @deprecated `WebSocketLink` uses the deprecated and unmaintained
78
+ * `subscriptions-transport-ws` library. This link is no longer maintained and
79
+ * will be removed in a future major version of Apollo Client. We recommend
80
+ * switching to `GraphQLWsLink`, which uses the [`graphql-ws` library](https://the-guild.dev/graphql/ws) to
81
+ * send GraphQL operations through WebSocket connections.
82
+ */
25
83
  export declare class WebSocketLink extends ApolloLink {
26
84
  private subscriptionClient;
27
85
  constructor(paramsOrClient: WebSocketLink.Configuration | SubscriptionClient);
package/link/ws/index.js CHANGED
@@ -1,9 +1,39 @@
1
1
  import { SubscriptionClient } from "subscriptions-transport-ws";
2
2
  import { ApolloLink } from "@apollo/client/link";
3
+ import { __DEV__ } from "@apollo/client/utilities/environment";
4
+ import { invariant } from "@apollo/client/utilities/invariant";
5
+ /**
6
+ * `WebSocketLink` is a terminating link that executes GraphQL operations over
7
+ * WebSocket connections using the `subscriptions-transport-ws` library. It's
8
+ * primarily used for GraphQL subscriptions but can also handle queries and
9
+ * mutations.
10
+ *
11
+ * @example
12
+ *
13
+ * ```ts
14
+ * import { WebSocketLink } from "@apollo/client/link/ws";
15
+ * import { SubscriptionClient } from "subscriptions-transport-ws";
16
+ *
17
+ * const wsLink = new WebSocketLink(
18
+ * new SubscriptionClient("ws://localhost:4000/subscriptions", {
19
+ * reconnect: true,
20
+ * })
21
+ * );
22
+ * ```
23
+ *
24
+ * @deprecated `WebSocketLink` uses the deprecated and unmaintained
25
+ * `subscriptions-transport-ws` library. This link is no longer maintained and
26
+ * will be removed in a future major version of Apollo Client. We recommend
27
+ * switching to `GraphQLWsLink`, which uses the [`graphql-ws` library](https://the-guild.dev/graphql/ws) to
28
+ * send GraphQL operations through WebSocket connections.
29
+ */
3
30
  export class WebSocketLink extends ApolloLink {
4
31
  subscriptionClient;
5
32
  constructor(paramsOrClient) {
6
33
  super();
34
+ if (__DEV__) {
35
+ __DEV__ && invariant.warn(56);
36
+ }
7
37
  if (paramsOrClient instanceof SubscriptionClient) {
8
38
  this.subscriptionClient = paramsOrClient;
9
39
  }
@@ -15,4 +45,4 @@ export class WebSocketLink extends ApolloLink {
15
45
  return this.subscriptionClient.request(operation);
16
46
  }
17
47
  }
18
- //# sourceMappingURL=index.js.map
48
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/ws/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA2BjD,MAAM,OAAO,aAAc,SAAQ,UAAU;IACnC,kBAAkB,CAAqB;IAE/C,YACE,cAAgE;QAEhE,KAAK,EAAE,CAAC;QAER,IAAI,cAAc,YAAY,kBAAkB,EAAE,CAAC;YACjD,IAAI,CAAC,kBAAkB,GAAG,cAAc,CAAC;QAC3C,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,kBAAkB,GAAG,IAAI,kBAAkB,CAC9C,cAAc,CAAC,GAAG,EAClB,cAAc,CAAC,OAAO,EACtB,cAAc,CAAC,aAAa,CAC7B,CAAC;QACJ,CAAC;IACH,CAAC;IAEM,OAAO,CACZ,SAA+B;QAE/B,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CACpC,SAAS,CACuB,CAAC;IACrC,CAAC;CACF","sourcesContent":["import type { Observable } from \"rxjs\";\nimport type { ClientOptions } from \"subscriptions-transport-ws\";\nimport { SubscriptionClient } from \"subscriptions-transport-ws\";\n\nimport { ApolloLink } from \"@apollo/client/link\";\n\nexport declare namespace WebSocketLink {\n /**\n * Configuration to use when constructing the subscription client (subscriptions-transport-ws).\n */\n export interface Configuration {\n /**\n * The endpoint to connect to.\n */\n uri: string;\n\n /**\n * Options to pass when constructing the subscription client.\n */\n options?: ClientOptions;\n\n /**\n * A custom WebSocket implementation to use.\n */\n webSocketImpl?: any;\n }\n}\n\n// For backwards compatibility.\nexport import WebSocketParams = WebSocketLink.Configuration;\n\nexport class WebSocketLink extends ApolloLink {\n private subscriptionClient: SubscriptionClient;\n\n constructor(\n paramsOrClient: WebSocketLink.Configuration | SubscriptionClient\n ) {\n super();\n\n if (paramsOrClient instanceof SubscriptionClient) {\n this.subscriptionClient = paramsOrClient;\n } else {\n this.subscriptionClient = new SubscriptionClient(\n paramsOrClient.uri,\n paramsOrClient.options,\n paramsOrClient.webSocketImpl\n );\n }\n }\n\n public request(\n operation: ApolloLink.Operation\n ): Observable<ApolloLink.Result> {\n return this.subscriptionClient.request(\n operation\n ) as Observable<ApolloLink.Result>;\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sources":["../../../src/link/ws/index.ts"],"sourcesContent":["import type { Observable } from \"rxjs\";\nimport type { ClientOptions } from \"subscriptions-transport-ws\";\nimport { SubscriptionClient } from \"subscriptions-transport-ws\";\n\nimport { ApolloLink } from \"@apollo/client/link\";\nimport { __DEV__ } from \"@apollo/client/utilities/environment\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nexport declare namespace WebSocketLink {\n /**\n * Configuration options for creating a `WebSocketLink` instance.\n *\n * @remarks\n *\n * These configuration options are used when creating a `WebSocketLink` without\n * providing an existing `SubscriptionClient` instance. The options are passed\n * directly to the `SubscriptionClient` constructor from the `subscriptions-transport-ws`\n * library.\n */\n export interface Configuration {\n /**\n * The WebSocket endpoint URI to connect to.\n *\n * This should be a valid WebSocket URI (starting with `ws://` or `wss://`)\n * that points to your GraphQL subscription endpoint.\n *\n * @example \"ws://localhost:4000/subscriptions\"\n * @example \"wss://api.example.com/graphql\"\n */\n uri: string;\n\n /**\n * Configuration options passed to the underlying `SubscriptionClient`.\n *\n * These options configure the WebSocket connection behavior, including\n * reconnection settings, connection parameters, and event handlers.\n *\n * For a complete list of available options, see the\n * [supported `subscriptions-transport-ws` options](https://github.com/apollographql/subscriptions-transport-ws/blob/master/src/client.ts#L61-L71).\n */\n options?: ClientOptions;\n\n /**\n * A custom WebSocket implementation to use for the connection.\n *\n * This is useful in environments that don't have native WebSocket support.\n * You can provide a WebSocket polyfill or implementation that conforms to\n * the W3C WebSocket API.\n *\n * @example\n *\n * ```ts\n * import WebSocket from \"ws\";\n *\n * const wsLink = new WebSocketLink({\n * uri: \"ws://localhost:4000/subscriptions\",\n * webSocketImpl: WebSocket,\n * });\n * ```\n */\n webSocketImpl?: any;\n }\n}\n\n/**\n * `WebSocketLink` is a terminating link that executes GraphQL operations over\n * WebSocket connections using the `subscriptions-transport-ws` library. It's\n * primarily used for GraphQL subscriptions but can also handle queries and\n * mutations.\n *\n * @example\n *\n * ```ts\n * import { WebSocketLink } from \"@apollo/client/link/ws\";\n * import { SubscriptionClient } from \"subscriptions-transport-ws\";\n *\n * const wsLink = new WebSocketLink(\n * new SubscriptionClient(\"ws://localhost:4000/subscriptions\", {\n * reconnect: true,\n * })\n * );\n * ```\n *\n * @deprecated `WebSocketLink` uses the deprecated and unmaintained\n * `subscriptions-transport-ws` library. This link is no longer maintained and\n * will be removed in a future major version of Apollo Client. We recommend\n * switching to `GraphQLWsLink`, which uses the [`graphql-ws` library](https://the-guild.dev/graphql/ws) to\n * send GraphQL operations through WebSocket connections.\n */\nexport class WebSocketLink extends ApolloLink {\n private subscriptionClient: SubscriptionClient;\n\n constructor(\n paramsOrClient: WebSocketLink.Configuration | SubscriptionClient\n ) {\n super();\n\n if (__DEV__) {\n invariant.warn(\n \"`WebSocketLink` uses the deprecated and unmaintained `subscriptions-transport-ws` library. This link is no longer maintained and will be removed in a future major version of Apollo Client. We recommend switching to `GraphQLWsLink` which uses the `graphql-ws` library to send GraphQL operations through WebSocket connections (https://the-guild.dev/graphql/ws).\"\n );\n }\n\n if (paramsOrClient instanceof SubscriptionClient) {\n this.subscriptionClient = paramsOrClient;\n } else {\n this.subscriptionClient = new SubscriptionClient(\n paramsOrClient.uri,\n paramsOrClient.options,\n paramsOrClient.webSocketImpl\n );\n }\n }\n\n public request(\n operation: ApolloLink.Operation\n ): Observable<ApolloLink.Result> {\n return this.subscriptionClient.request(\n operation\n ) as Observable<ApolloLink.Result>;\n }\n}\n"],"names":[],"mappings":"AAEA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAmC,CAAnC,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,CAA+D;AAE/D,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAA2B,CAA3B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgD;AAChD,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAwB,CAAxB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8D;AAC9D,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AEO,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,CACZ,CADJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACmC,EADnC;QAGI,CAAJ,CAAA,CAAA,CAAA,CAAA,EAAW,CAAX,CAAA,CAAA,CAAe,CAAC,CAAhB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkC,CAAC,CAAnC,CAAA,CAAA,CAAA,CAAA,CAAA,CAA0C,CACpC,CADN,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACe,CACuB;IACpC;AACF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollo/client",
3
- "version": "4.0.0-rc.7",
3
+ "version": "4.0.0-rc.9",
4
4
  "description": "A fully-featured caching GraphQL client.",
5
5
  "private": false,
6
6
  "keywords": [
@@ -46,7 +46,7 @@ export const useSyncExternalStore = realHook ||
46
46
  value !== getSnapshot()) {
47
47
  didWarnUncachedGetSnapshot = true;
48
48
  // DEVIATION: Using invariant.error instead of console.error directly.
49
- __DEV__ && invariant.error(34);
49
+ invariant.error(34);
50
50
  }
51
51
  // Because updates are synchronous, we don't queue them. Instead we force a
52
52
  // re-render whenever the subscribed state changes by updating an some