@graphql-mesh/transport-http-callback 0.5.4 → 0.5.5-alpha-74ce70ffa76773d89e7e68c4b984a188ea1d816b
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +351 -0
- package/dist/index.cjs +256 -0
- package/dist/index.d.cts +26 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +254 -0
- package/package.json +43 -33
- package/cjs/index.js +0 -198
- package/cjs/package.json +0 -1
- package/esm/index.js +0 -196
- package/typings/index.d.cts +0 -23
- package/typings/index.d.ts +0 -23
package/CHANGELOG.md
ADDED
@@ -0,0 +1,351 @@
|
|
1
|
+
# @graphql-mesh/transport-http-callback
|
2
|
+
|
3
|
+
## 0.5.5-alpha-74ce70ffa76773d89e7e68c4b984a188ea1d816b
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- Updated dependencies [[`16fa46b`](https://github.com/graphql-hive/gateway/commit/16fa46b0e31d1fcbfee977fe02efa5e3eabdb150)]:
|
8
|
+
- @graphql-mesh/transport-common@0.7.14-alpha-74ce70ffa76773d89e7e68c4b984a188ea1d816b
|
9
|
+
|
10
|
+
## 0.5.4
|
11
|
+
|
12
|
+
### Patch Changes
|
13
|
+
|
14
|
+
- [#7914](https://github.com/ardatan/graphql-mesh/pull/7914)
|
15
|
+
[`eee53b9`](https://github.com/ardatan/graphql-mesh/commit/eee53b9f455653166c39bca627b3261fbefe4eb7)
|
16
|
+
Thanks [@renovate](https://github.com/apps/renovate)! - dependencies updates:
|
17
|
+
- Updated dependency
|
18
|
+
[`@whatwg-node/fetch@^0.10.0` ↗︎](https://www.npmjs.com/package/@whatwg-node/fetch/v/0.10.0)
|
19
|
+
(from `^0.9.18`, in `dependencies`)
|
20
|
+
- Updated dependencies
|
21
|
+
[[`eee53b9`](https://github.com/ardatan/graphql-mesh/commit/eee53b9f455653166c39bca627b3261fbefe4eb7)]:
|
22
|
+
- @graphql-mesh/utils@0.102.12
|
23
|
+
- @graphql-mesh/transport-common@0.7.13
|
24
|
+
|
25
|
+
## 0.5.3
|
26
|
+
|
27
|
+
### Patch Changes
|
28
|
+
|
29
|
+
- Updated dependencies
|
30
|
+
[[`de41fc2`](https://github.com/ardatan/graphql-mesh/commit/de41fc2932433f8da35b9de9492720e6c8c100af),
|
31
|
+
[`de41fc2`](https://github.com/ardatan/graphql-mesh/commit/de41fc2932433f8da35b9de9492720e6c8c100af)]:
|
32
|
+
- @graphql-mesh/transport-common@0.7.12
|
33
|
+
- @graphql-mesh/utils@0.102.11
|
34
|
+
|
35
|
+
## 0.5.2
|
36
|
+
|
37
|
+
### Patch Changes
|
38
|
+
|
39
|
+
- Updated dependencies
|
40
|
+
[[`997b81c`](https://github.com/ardatan/graphql-mesh/commit/997b81c8a5d28508057806b4f16eecc5b713cf71),
|
41
|
+
[`997b81c`](https://github.com/ardatan/graphql-mesh/commit/997b81c8a5d28508057806b4f16eecc5b713cf71)]:
|
42
|
+
- @graphql-mesh/transport-common@0.7.11
|
43
|
+
- @graphql-mesh/utils@0.102.10
|
44
|
+
|
45
|
+
## 0.5.1
|
46
|
+
|
47
|
+
### Patch Changes
|
48
|
+
|
49
|
+
- Updated dependencies
|
50
|
+
[[`fad4d27`](https://github.com/ardatan/graphql-mesh/commit/fad4d27bfebb80a374c2041b86ffab509845effe)]:
|
51
|
+
- @graphql-mesh/utils@0.102.9
|
52
|
+
- @graphql-mesh/transport-common@0.7.10
|
53
|
+
|
54
|
+
## 0.5.0
|
55
|
+
|
56
|
+
### Minor Changes
|
57
|
+
|
58
|
+
- [#7766](https://github.com/ardatan/graphql-mesh/pull/7766)
|
59
|
+
[`cc53c6c`](https://github.com/ardatan/graphql-mesh/commit/cc53c6c6056dcb38477b260e916825d4c8864b57)
|
60
|
+
Thanks [@ardatan](https://github.com/ardatan)! - Fix/Implement WebSockets support for the Gateway
|
61
|
+
and Client communication
|
62
|
+
|
63
|
+
### Patch Changes
|
64
|
+
|
65
|
+
- Updated dependencies
|
66
|
+
[[`518c42c`](https://github.com/ardatan/graphql-mesh/commit/518c42c5a2bee00e224df95c2beb758a28d1323c),
|
67
|
+
[`518c42c`](https://github.com/ardatan/graphql-mesh/commit/518c42c5a2bee00e224df95c2beb758a28d1323c)]:
|
68
|
+
- @graphql-mesh/transport-common@0.7.9
|
69
|
+
- @graphql-mesh/utils@0.102.8
|
70
|
+
|
71
|
+
## 0.4.2
|
72
|
+
|
73
|
+
### Patch Changes
|
74
|
+
|
75
|
+
- [#7781](https://github.com/ardatan/graphql-mesh/pull/7781)
|
76
|
+
[`50bf472`](https://github.com/ardatan/graphql-mesh/commit/50bf4723657d27dc196d80407bda40c93aa5c9be)
|
77
|
+
Thanks [@ardatan](https://github.com/ardatan)! - dependencies updates:
|
78
|
+
- Updated dependency
|
79
|
+
[`@graphql-tools/utils@^10.5.5` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.5.5)
|
80
|
+
(from `^10.5.3`, in `dependencies`)
|
81
|
+
- Updated dependencies
|
82
|
+
[[`50bf472`](https://github.com/ardatan/graphql-mesh/commit/50bf4723657d27dc196d80407bda40c93aa5c9be),
|
83
|
+
[`50bf472`](https://github.com/ardatan/graphql-mesh/commit/50bf4723657d27dc196d80407bda40c93aa5c9be),
|
84
|
+
[`50bf472`](https://github.com/ardatan/graphql-mesh/commit/50bf4723657d27dc196d80407bda40c93aa5c9be)]:
|
85
|
+
- @graphql-mesh/cross-helpers@0.4.7
|
86
|
+
- @graphql-mesh/transport-common@0.7.8
|
87
|
+
- @graphql-mesh/utils@0.102.7
|
88
|
+
|
89
|
+
## 0.4.1
|
90
|
+
|
91
|
+
### Patch Changes
|
92
|
+
|
93
|
+
- Updated dependencies
|
94
|
+
[[`bf588d3`](https://github.com/ardatan/graphql-mesh/commit/bf588d372c0078378aaa24beea2da794af7949e6)]:
|
95
|
+
- @graphql-mesh/utils@0.102.6
|
96
|
+
- @graphql-mesh/transport-common@0.7.7
|
97
|
+
|
98
|
+
## 0.4.0
|
99
|
+
|
100
|
+
### Minor Changes
|
101
|
+
|
102
|
+
- [#7580](https://github.com/ardatan/graphql-mesh/pull/7580)
|
103
|
+
[`75e9f63`](https://github.com/ardatan/graphql-mesh/commit/75e9f63d09514a0af786f909dc8c32ac09a1a849)
|
104
|
+
Thanks [@ardatan](https://github.com/ardatan)! - BREAKING: All types prefixed with `MeshServe`,
|
105
|
+
now are prefixed with `Gateway`. e.g. `MeshServeRuntime` -> `GatewayRuntime`
|
106
|
+
|
107
|
+
Runtime factory is renamed; `createServeRuntime` -> `createGatewayRuntime`
|
108
|
+
|
109
|
+
The expected export name for config files are renamed from `serveConfig` to `gatewayConfig`
|
110
|
+
|
111
|
+
RENAMING:
|
112
|
+
|
113
|
+
You can rename the product, config file name etc by using the following config options;
|
114
|
+
|
115
|
+
For example;
|
116
|
+
|
117
|
+
```ts
|
118
|
+
productName = 'Mesh Gateway';
|
119
|
+
productDescription =
|
120
|
+
'Mesh Gateway is a GraphQL Gateway that can be used to serve a supergraph schema.';
|
121
|
+
productLogo = '<svg>...</svg>';
|
122
|
+
productPackageName = '@graphql-mesh/gateway';
|
123
|
+
```
|
124
|
+
|
125
|
+
### Patch Changes
|
126
|
+
|
127
|
+
- Updated dependencies
|
128
|
+
[[`3bf14b3`](https://github.com/ardatan/graphql-mesh/commit/3bf14b33ee621cce004a329928b8a04a68218016),
|
129
|
+
[`b7f6ebf`](https://github.com/ardatan/graphql-mesh/commit/b7f6ebfa077957c3a1ecad1fed449e972cb09ae0),
|
130
|
+
[`0a3e52c`](https://github.com/ardatan/graphql-mesh/commit/0a3e52c2ad2941e7c48f0e80706db41644797c2d)]:
|
131
|
+
- @graphql-mesh/utils@0.102.5
|
132
|
+
- @graphql-mesh/transport-common@0.7.6
|
133
|
+
|
134
|
+
## 0.3.5
|
135
|
+
|
136
|
+
### Patch Changes
|
137
|
+
|
138
|
+
- Updated dependencies
|
139
|
+
[[`5146df0`](https://github.com/ardatan/graphql-mesh/commit/5146df0fd3313227d5d7df2beb726ca89e13923f)]:
|
140
|
+
- @graphql-mesh/transport-common@0.7.5
|
141
|
+
|
142
|
+
## 0.3.4
|
143
|
+
|
144
|
+
### Patch Changes
|
145
|
+
|
146
|
+
- Updated dependencies
|
147
|
+
[[`edbc074`](https://github.com/ardatan/graphql-mesh/commit/edbc074523ebc86114bb3342f86b7bcd9268d005),
|
148
|
+
[`edbc074`](https://github.com/ardatan/graphql-mesh/commit/edbc074523ebc86114bb3342f86b7bcd9268d005)]:
|
149
|
+
- @graphql-mesh/transport-common@0.7.4
|
150
|
+
- @graphql-mesh/utils@0.102.4
|
151
|
+
|
152
|
+
## 0.3.3
|
153
|
+
|
154
|
+
### Patch Changes
|
155
|
+
|
156
|
+
- Updated dependencies
|
157
|
+
[[`14ec31f`](https://github.com/ardatan/graphql-mesh/commit/14ec31f95bc06e9a3d06fae387fc40cc534e01f4),
|
158
|
+
[`14ec31f`](https://github.com/ardatan/graphql-mesh/commit/14ec31f95bc06e9a3d06fae387fc40cc534e01f4)]:
|
159
|
+
- @graphql-mesh/transport-common@0.7.3
|
160
|
+
- @graphql-mesh/utils@0.102.3
|
161
|
+
|
162
|
+
## 0.3.2
|
163
|
+
|
164
|
+
### Patch Changes
|
165
|
+
|
166
|
+
- Updated dependencies
|
167
|
+
[[`5d95aad`](https://github.com/ardatan/graphql-mesh/commit/5d95aad185448e8e3a004a08e364f98ee9bbee2a)]:
|
168
|
+
- @graphql-mesh/utils@0.102.2
|
169
|
+
- @graphql-mesh/transport-common@0.7.2
|
170
|
+
|
171
|
+
## 0.3.1
|
172
|
+
|
173
|
+
### Patch Changes
|
174
|
+
|
175
|
+
- Updated dependencies
|
176
|
+
[[`e49a7e6`](https://github.com/ardatan/graphql-mesh/commit/e49a7e69475b652a53a0f289a44247e8b7ea96de),
|
177
|
+
[`60bfc22`](https://github.com/ardatan/graphql-mesh/commit/60bfc2240108af0a599a66451517a146cace879d)]:
|
178
|
+
- @graphql-mesh/utils@0.102.1
|
179
|
+
- @graphql-mesh/transport-common@0.7.1
|
180
|
+
|
181
|
+
## 0.3.0
|
182
|
+
|
183
|
+
### Patch Changes
|
184
|
+
|
185
|
+
- Updated dependencies
|
186
|
+
[[`13fa835`](https://github.com/ardatan/graphql-mesh/commit/13fa835036c3671305fc831fa236f110c33d9965)]:
|
187
|
+
- @graphql-mesh/string-interpolation@0.5.6
|
188
|
+
- @graphql-mesh/utils@0.102.0
|
189
|
+
- @graphql-mesh/transport-common@0.7.0
|
190
|
+
|
191
|
+
## 0.2.2
|
192
|
+
|
193
|
+
### Patch Changes
|
194
|
+
|
195
|
+
- [#7518](https://github.com/ardatan/graphql-mesh/pull/7518)
|
196
|
+
[`b0cdc83`](https://github.com/ardatan/graphql-mesh/commit/b0cdc839699a1dd90d125289b49b75f703cbb18e)
|
197
|
+
Thanks [@enisdenjo](https://github.com/enisdenjo)! - dependencies updates:
|
198
|
+
- Updated dependency
|
199
|
+
[`@graphql-mesh/transport-common@^0.6.1` ↗︎](https://www.npmjs.com/package/@graphql-mesh/transport-common/v/0.6.1)
|
200
|
+
(from `^0.6.0`, in `dependencies`)
|
201
|
+
|
202
|
+
## 0.2.1
|
203
|
+
|
204
|
+
### Patch Changes
|
205
|
+
|
206
|
+
- [#7516](https://github.com/ardatan/graphql-mesh/pull/7516)
|
207
|
+
[`67e1062`](https://github.com/ardatan/graphql-mesh/commit/67e10629c70ec553234c1ffc99af4b89ddb31985)
|
208
|
+
Thanks [@enisdenjo](https://github.com/enisdenjo)! - Transport's kind doesn't need to be typed
|
209
|
+
|
210
|
+
- Updated dependencies
|
211
|
+
[[`67e1062`](https://github.com/ardatan/graphql-mesh/commit/67e10629c70ec553234c1ffc99af4b89ddb31985)]:
|
212
|
+
- @graphql-mesh/transport-common@0.6.1
|
213
|
+
|
214
|
+
## 0.2.0
|
215
|
+
|
216
|
+
### Patch Changes
|
217
|
+
|
218
|
+
- [#7497](https://github.com/ardatan/graphql-mesh/pull/7497)
|
219
|
+
[`d784488`](https://github.com/ardatan/graphql-mesh/commit/d784488dcf04b3b0bf32f386baf8b48e1f20d27e)
|
220
|
+
Thanks [@ardatan](https://github.com/ardatan)! - dependencies updates:
|
221
|
+
|
222
|
+
- Updated dependency
|
223
|
+
[`@graphql-tools/utils@^10.5.2` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.5.2)
|
224
|
+
(from `^10.3.4`, in `dependencies`)
|
225
|
+
|
226
|
+
- [#7512](https://github.com/ardatan/graphql-mesh/pull/7512)
|
227
|
+
[`190e9ec`](https://github.com/ardatan/graphql-mesh/commit/190e9ece9bc050a0564f3b5292ab5229e63d40a6)
|
228
|
+
Thanks [@ardatan](https://github.com/ardatan)! - dependencies updates:
|
229
|
+
- Updated dependency
|
230
|
+
[`@graphql-tools/utils@^10.5.3` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.5.3)
|
231
|
+
(from `^10.5.2`, in `dependencies`)
|
232
|
+
- Updated dependencies
|
233
|
+
[[`d784488`](https://github.com/ardatan/graphql-mesh/commit/d784488dcf04b3b0bf32f386baf8b48e1f20d27e),
|
234
|
+
[`190e9ec`](https://github.com/ardatan/graphql-mesh/commit/190e9ece9bc050a0564f3b5292ab5229e63d40a6),
|
235
|
+
[`d784488`](https://github.com/ardatan/graphql-mesh/commit/d784488dcf04b3b0bf32f386baf8b48e1f20d27e),
|
236
|
+
[`190e9ec`](https://github.com/ardatan/graphql-mesh/commit/190e9ece9bc050a0564f3b5292ab5229e63d40a6),
|
237
|
+
[`d784488`](https://github.com/ardatan/graphql-mesh/commit/d784488dcf04b3b0bf32f386baf8b48e1f20d27e),
|
238
|
+
[`190e9ec`](https://github.com/ardatan/graphql-mesh/commit/190e9ece9bc050a0564f3b5292ab5229e63d40a6),
|
239
|
+
[`d784488`](https://github.com/ardatan/graphql-mesh/commit/d784488dcf04b3b0bf32f386baf8b48e1f20d27e)]:
|
240
|
+
- @graphql-mesh/cross-helpers@0.4.6
|
241
|
+
- @graphql-mesh/transport-common@0.6.0
|
242
|
+
- @graphql-mesh/utils@0.101.0
|
243
|
+
|
244
|
+
## 0.1.0
|
245
|
+
|
246
|
+
### Patch Changes
|
247
|
+
|
248
|
+
- [#7477](https://github.com/ardatan/graphql-mesh/pull/7477)
|
249
|
+
[`c06a048`](https://github.com/ardatan/graphql-mesh/commit/c06a0482e7431683f0b75fde3aebbb97aca00c4c)
|
250
|
+
Thanks [@ardatan](https://github.com/ardatan)! - dependencies updates:
|
251
|
+
- Updated dependency
|
252
|
+
[`@graphql-tools/utils@^10.3.4` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.3.4)
|
253
|
+
(from `^10.2.3`, in `dependencies`)
|
254
|
+
- Updated dependencies
|
255
|
+
[[`c06a048`](https://github.com/ardatan/graphql-mesh/commit/c06a0482e7431683f0b75fde3aebbb97aca00c4c),
|
256
|
+
[`c06a048`](https://github.com/ardatan/graphql-mesh/commit/c06a0482e7431683f0b75fde3aebbb97aca00c4c),
|
257
|
+
[`c06a048`](https://github.com/ardatan/graphql-mesh/commit/c06a0482e7431683f0b75fde3aebbb97aca00c4c),
|
258
|
+
[`a324c5e`](https://github.com/ardatan/graphql-mesh/commit/a324c5ef300c25dcfa265f3457453b50af0b83e7),
|
259
|
+
[`4d1eb28`](https://github.com/ardatan/graphql-mesh/commit/4d1eb285c2b703c5f80473ad0f316004306fac7f),
|
260
|
+
[`a324c5e`](https://github.com/ardatan/graphql-mesh/commit/a324c5ef300c25dcfa265f3457453b50af0b83e7)]:
|
261
|
+
- @graphql-mesh/cross-helpers@0.4.5
|
262
|
+
- @graphql-mesh/transport-common@0.5.0
|
263
|
+
- @graphql-mesh/utils@0.100.0
|
264
|
+
|
265
|
+
## 0.0.6
|
266
|
+
|
267
|
+
### Patch Changes
|
268
|
+
|
269
|
+
- Updated dependencies []:
|
270
|
+
- @graphql-mesh/utils@0.99.7
|
271
|
+
- @graphql-mesh/transport-common@0.4.7
|
272
|
+
|
273
|
+
## 0.0.5
|
274
|
+
|
275
|
+
### Patch Changes
|
276
|
+
|
277
|
+
- Updated dependencies
|
278
|
+
[[`6c67e77`](https://github.com/ardatan/graphql-mesh/commit/6c67e77d3c308615a733577293ecb6dd55793aeb),
|
279
|
+
[`6c67e77`](https://github.com/ardatan/graphql-mesh/commit/6c67e77d3c308615a733577293ecb6dd55793aeb),
|
280
|
+
[`6c67e77`](https://github.com/ardatan/graphql-mesh/commit/6c67e77d3c308615a733577293ecb6dd55793aeb),
|
281
|
+
[`6c67e77`](https://github.com/ardatan/graphql-mesh/commit/6c67e77d3c308615a733577293ecb6dd55793aeb)]:
|
282
|
+
- @graphql-mesh/transport-common@0.4.6
|
283
|
+
- @graphql-mesh/utils@0.99.6
|
284
|
+
|
285
|
+
## 0.0.4
|
286
|
+
|
287
|
+
### Patch Changes
|
288
|
+
|
289
|
+
- [#7401](https://github.com/ardatan/graphql-mesh/pull/7401)
|
290
|
+
[`33c23e8`](https://github.com/ardatan/graphql-mesh/commit/33c23e83a60328df806a8adc8d262a0c6de7e5a4)
|
291
|
+
Thanks [@ardatan](https://github.com/ardatan)! - dependencies updates:
|
292
|
+
- Added dependency
|
293
|
+
[`@graphql-mesh/utils@^0.99.4` ↗︎](https://www.npmjs.com/package/@graphql-mesh/utils/v/0.99.4)
|
294
|
+
(to `dependencies`)
|
295
|
+
- Updated dependencies
|
296
|
+
[[`33c23e8`](https://github.com/ardatan/graphql-mesh/commit/33c23e83a60328df806a8adc8d262a0c6de7e5a4)]:
|
297
|
+
- @graphql-mesh/utils@0.99.5
|
298
|
+
- @graphql-mesh/transport-common@0.4.5
|
299
|
+
|
300
|
+
## 0.0.3
|
301
|
+
|
302
|
+
### Patch Changes
|
303
|
+
|
304
|
+
- Updated dependencies []:
|
305
|
+
- @graphql-mesh/transport-common@0.4.4
|
306
|
+
|
307
|
+
## 0.0.2
|
308
|
+
|
309
|
+
### Patch Changes
|
310
|
+
|
311
|
+
- Updated dependencies []:
|
312
|
+
- @graphql-mesh/transport-common@0.4.3
|
313
|
+
|
314
|
+
## 0.0.1
|
315
|
+
|
316
|
+
### Patch Changes
|
317
|
+
|
318
|
+
- [#7334](https://github.com/ardatan/graphql-mesh/pull/7334)
|
319
|
+
[`22ebcf0`](https://github.com/ardatan/graphql-mesh/commit/22ebcf09d14ddc2da055f566c0e8e08f7428e141)
|
320
|
+
Thanks [@ardatan](https://github.com/ardatan)! - dependencies updates:
|
321
|
+
|
322
|
+
- Added dependency
|
323
|
+
[`@graphql-mesh/cross-helpers@^0.4.4` ↗︎](https://www.npmjs.com/package/@graphql-mesh/cross-helpers/v/0.4.4)
|
324
|
+
(to `dependencies`)
|
325
|
+
|
326
|
+
- [#7294](https://github.com/ardatan/graphql-mesh/pull/7294)
|
327
|
+
[`345a814`](https://github.com/ardatan/graphql-mesh/commit/345a81490f5201f6ee2f378b1b9d83c5881c9730)
|
328
|
+
Thanks [@ardatan](https://github.com/ardatan)! - Support for HTTP Callback protocol for
|
329
|
+
subscriptions
|
330
|
+
|
331
|
+
```ts
|
332
|
+
reviews: {
|
333
|
+
kind: 'hybrid',
|
334
|
+
options: {
|
335
|
+
subscriptions: {
|
336
|
+
kind: 'http-callback',
|
337
|
+
},
|
338
|
+
} satisfies HybridTransportOptions<HTTPCallbackTransportOptions>,
|
339
|
+
},
|
340
|
+
```
|
341
|
+
|
342
|
+
Learn more about protocol;
|
343
|
+
https://www.apollographql.com/docs/router/executing-operations/subscription-callback-protocol/
|
344
|
+
|
345
|
+
- Updated dependencies
|
346
|
+
[[`b01f3ea`](https://github.com/ardatan/graphql-mesh/commit/b01f3eabdc42d8905e8d586a4845e8394c094033),
|
347
|
+
[`0bdc18d`](https://github.com/ardatan/graphql-mesh/commit/0bdc18df3d150a61abf987b8829934ed4ca02eed),
|
348
|
+
[`4bc495c`](https://github.com/ardatan/graphql-mesh/commit/4bc495c03493f18c85e11f3f5fb54b3c35d16d8e),
|
349
|
+
[`345a814`](https://github.com/ardatan/graphql-mesh/commit/345a81490f5201f6ee2f378b1b9d83c5881c9730)]:
|
350
|
+
- @graphql-mesh/string-interpolation@0.5.5
|
351
|
+
- @graphql-mesh/transport-common@0.4.2
|
package/dist/index.cjs
ADDED
@@ -0,0 +1,256 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var crossHelpers = require('@graphql-mesh/cross-helpers');
|
4
|
+
var stringInterpolation = require('@graphql-mesh/string-interpolation');
|
5
|
+
var transportCommon = require('@graphql-mesh/transport-common');
|
6
|
+
var utils = require('@graphql-mesh/utils');
|
7
|
+
var utils$1 = require('@graphql-tools/utils');
|
8
|
+
var repeater = require('@repeaterjs/repeater');
|
9
|
+
var fetch = require('@whatwg-node/fetch');
|
10
|
+
|
11
|
+
function createTimeoutError() {
|
12
|
+
return utils$1.createGraphQLError("Subscription timed out", {
|
13
|
+
extensions: {
|
14
|
+
code: "TIMEOUT_ERROR"
|
15
|
+
}
|
16
|
+
});
|
17
|
+
}
|
18
|
+
var index = {
|
19
|
+
getSubgraphExecutor({
|
20
|
+
transportEntry,
|
21
|
+
fetch: fetch$1,
|
22
|
+
pubsub,
|
23
|
+
logger
|
24
|
+
}) {
|
25
|
+
let headersInConfig;
|
26
|
+
if (typeof transportEntry.headers === "string") {
|
27
|
+
headersInConfig = JSON.parse(transportEntry.headers);
|
28
|
+
}
|
29
|
+
if (Array.isArray(transportEntry.headers)) {
|
30
|
+
headersInConfig = Object.fromEntries(transportEntry.headers);
|
31
|
+
}
|
32
|
+
const headersFactory = stringInterpolation.getInterpolatedHeadersFactory(headersInConfig);
|
33
|
+
const verifier = fetch.crypto.randomUUID();
|
34
|
+
if (!pubsub) {
|
35
|
+
throw new Error(`HTTP Callback Transport: You must provide a pubsub instance to http-callbacks transport!
|
36
|
+
Example:
|
37
|
+
import { PubSub } from '@graphql-hive/gateway'
|
38
|
+
export const gatewayConfig = defineConfig({
|
39
|
+
pubsub: new PubSub(),
|
40
|
+
})
|
41
|
+
See documentation: https://graphql-hive.com/docs/gateway/pubsub`);
|
42
|
+
}
|
43
|
+
const reqAbortCtrls = /* @__PURE__ */ new Set();
|
44
|
+
const heartbeats = /* @__PURE__ */ new Map();
|
45
|
+
const stopFnSet = /* @__PURE__ */ new Set();
|
46
|
+
const publicUrl = transportEntry.options?.public_url || "http://localhost:4000";
|
47
|
+
const callbackPath = transportEntry.options?.path || "/callback";
|
48
|
+
const heartbeatIntervalMs = transportEntry.options?.heartbeat_interval || 5e4;
|
49
|
+
const httpCallbackExecutor = function httpCallbackExecutor2(execReq) {
|
50
|
+
const query = transportCommon.defaultPrintFn(execReq.document);
|
51
|
+
const subscriptionId = fetch.crypto.randomUUID();
|
52
|
+
const subscriptionLogger = logger?.child(subscriptionId);
|
53
|
+
const callbackUrl = `${publicUrl}${callbackPath}/${subscriptionId}`;
|
54
|
+
const subscriptionCallbackPath = `${callbackPath}/${subscriptionId}`;
|
55
|
+
const fetchBody = JSON.stringify({
|
56
|
+
query,
|
57
|
+
variables: execReq.variables,
|
58
|
+
operationName: execReq.operationName,
|
59
|
+
extensions: {
|
60
|
+
...execReq.extensions || {},
|
61
|
+
subscription: {
|
62
|
+
callbackUrl,
|
63
|
+
subscriptionId,
|
64
|
+
verifier,
|
65
|
+
heartbeatIntervalMs
|
66
|
+
}
|
67
|
+
}
|
68
|
+
});
|
69
|
+
let stopSubscription = (error) => {
|
70
|
+
if (error) {
|
71
|
+
throw error;
|
72
|
+
}
|
73
|
+
};
|
74
|
+
heartbeats.set(
|
75
|
+
subscriptionId,
|
76
|
+
setTimeout(() => {
|
77
|
+
stopSubscription(createTimeoutError());
|
78
|
+
}, heartbeatIntervalMs)
|
79
|
+
);
|
80
|
+
subscriptionLogger?.debug(
|
81
|
+
`Subscribing to ${transportEntry.location} with callbackUrl: ${callbackUrl}`
|
82
|
+
);
|
83
|
+
let pushFn = () => {
|
84
|
+
throw new Error(
|
85
|
+
"HTTP Callback Transport: Subgraph does not look like configured correctly. Check your subgraph setup."
|
86
|
+
);
|
87
|
+
};
|
88
|
+
const reqAbortCtrl = new AbortController();
|
89
|
+
if (!fetch$1) {
|
90
|
+
throw new Error(
|
91
|
+
"HTTP Callback Transport: `fetch` implementation is missing!"
|
92
|
+
);
|
93
|
+
}
|
94
|
+
if (!transportEntry.location) {
|
95
|
+
throw new Error(
|
96
|
+
`HTTP Callback Transport: \`location\` is missing in the transport entry!`
|
97
|
+
);
|
98
|
+
}
|
99
|
+
const subFetchCall$ = utils.mapMaybePromise(
|
100
|
+
fetch$1(
|
101
|
+
transportEntry.location,
|
102
|
+
{
|
103
|
+
method: "POST",
|
104
|
+
headers: {
|
105
|
+
"Content-Type": "application/json",
|
106
|
+
...headersFactory({
|
107
|
+
env: crossHelpers.process.env,
|
108
|
+
root: execReq.rootValue,
|
109
|
+
context: execReq.context,
|
110
|
+
info: execReq.info
|
111
|
+
}),
|
112
|
+
Accept: "application/json;callbackSpec=1.0; charset=utf-8"
|
113
|
+
},
|
114
|
+
body: fetchBody,
|
115
|
+
signal: reqAbortCtrl.signal
|
116
|
+
},
|
117
|
+
execReq.context,
|
118
|
+
execReq.info
|
119
|
+
),
|
120
|
+
(res) => utils.mapMaybePromise(res.text(), (resText) => {
|
121
|
+
let resJson;
|
122
|
+
try {
|
123
|
+
resJson = JSON.parse(resText);
|
124
|
+
} catch (e) {
|
125
|
+
if (!res.ok) {
|
126
|
+
stopSubscription(
|
127
|
+
new Error(
|
128
|
+
`Subscription request failed with an HTTP Error: ${res.status} ${resText}`
|
129
|
+
)
|
130
|
+
);
|
131
|
+
} else {
|
132
|
+
stopSubscription(e);
|
133
|
+
}
|
134
|
+
return;
|
135
|
+
}
|
136
|
+
logger?.debug(`Subscription request received`, resJson);
|
137
|
+
if (resJson.errors) {
|
138
|
+
if (resJson.errors.length === 1 && resJson.errors[0]) {
|
139
|
+
const error = resJson.errors[0];
|
140
|
+
stopSubscription(utils$1.createGraphQLError(error.message, error));
|
141
|
+
} else {
|
142
|
+
stopSubscription(
|
143
|
+
new AggregateError(
|
144
|
+
resJson.errors.map(
|
145
|
+
(err) => utils$1.createGraphQLError(err.message, err)
|
146
|
+
),
|
147
|
+
resJson.errors.map((err) => err.message).join("\n")
|
148
|
+
)
|
149
|
+
);
|
150
|
+
}
|
151
|
+
} else if (resJson.data != null) {
|
152
|
+
pushFn(resJson.data);
|
153
|
+
stopSubscription();
|
154
|
+
}
|
155
|
+
}),
|
156
|
+
(e) => {
|
157
|
+
logger?.debug(`Subscription request failed`, e);
|
158
|
+
stopSubscription(e);
|
159
|
+
}
|
160
|
+
);
|
161
|
+
execReq.context?.waitUntil?.(subFetchCall$);
|
162
|
+
return new repeater.Repeater((push, stop) => {
|
163
|
+
pushFn = push;
|
164
|
+
stopSubscription = stop;
|
165
|
+
stopFnSet.add(stop);
|
166
|
+
logger?.debug(`Listening to ${subscriptionCallbackPath}`);
|
167
|
+
const subId = pubsub.subscribe(
|
168
|
+
`webhook:post:${subscriptionCallbackPath}`,
|
169
|
+
(message) => {
|
170
|
+
logger?.debug(
|
171
|
+
`Received message from ${subscriptionCallbackPath}`,
|
172
|
+
message
|
173
|
+
);
|
174
|
+
if (message.verifier !== verifier) {
|
175
|
+
return;
|
176
|
+
}
|
177
|
+
const existingHeartbeat = heartbeats.get(subscriptionId);
|
178
|
+
if (existingHeartbeat) {
|
179
|
+
clearTimeout(existingHeartbeat);
|
180
|
+
}
|
181
|
+
heartbeats.set(
|
182
|
+
subscriptionId,
|
183
|
+
setTimeout(() => {
|
184
|
+
stopSubscription(createTimeoutError());
|
185
|
+
}, heartbeatIntervalMs)
|
186
|
+
);
|
187
|
+
switch (message.action) {
|
188
|
+
case "check":
|
189
|
+
break;
|
190
|
+
case "next":
|
191
|
+
push(message.payload);
|
192
|
+
break;
|
193
|
+
case "complete":
|
194
|
+
if (message.errors) {
|
195
|
+
if (message.errors.length === 1 && message.errors[0]) {
|
196
|
+
const error = message.errors[0];
|
197
|
+
stopSubscription(
|
198
|
+
utils$1.createGraphQLError(error.message, {
|
199
|
+
...error,
|
200
|
+
extensions: {
|
201
|
+
...error.extensions,
|
202
|
+
code: "DOWNSTREAM_SERVICE_ERROR"
|
203
|
+
}
|
204
|
+
})
|
205
|
+
);
|
206
|
+
} else {
|
207
|
+
stopSubscription(
|
208
|
+
new AggregateError(
|
209
|
+
message.errors.map(
|
210
|
+
(err) => utils$1.createGraphQLError(err.message, {
|
211
|
+
...err,
|
212
|
+
extensions: {
|
213
|
+
...err.extensions,
|
214
|
+
code: "DOWNSTREAM_SERVICE_ERROR"
|
215
|
+
}
|
216
|
+
})
|
217
|
+
)
|
218
|
+
)
|
219
|
+
);
|
220
|
+
}
|
221
|
+
} else {
|
222
|
+
stopSubscription();
|
223
|
+
}
|
224
|
+
break;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
);
|
228
|
+
stop.finally(() => {
|
229
|
+
pubsub.unsubscribe(subId);
|
230
|
+
clearTimeout(heartbeats.get(subscriptionId));
|
231
|
+
heartbeats.delete(subscriptionId);
|
232
|
+
stopFnSet.delete(stop);
|
233
|
+
if (!reqAbortCtrl.signal.aborted) {
|
234
|
+
reqAbortCtrl.abort();
|
235
|
+
}
|
236
|
+
});
|
237
|
+
});
|
238
|
+
};
|
239
|
+
function disposeFn() {
|
240
|
+
for (const stop of stopFnSet) {
|
241
|
+
stop();
|
242
|
+
}
|
243
|
+
for (const interval of heartbeats.values()) {
|
244
|
+
clearTimeout(interval);
|
245
|
+
}
|
246
|
+
for (const ctrl of reqAbortCtrls) {
|
247
|
+
if (!ctrl.signal.aborted) {
|
248
|
+
ctrl.abort();
|
249
|
+
}
|
250
|
+
}
|
251
|
+
}
|
252
|
+
return utils.makeDisposable(httpCallbackExecutor, disposeFn);
|
253
|
+
}
|
254
|
+
};
|
255
|
+
|
256
|
+
module.exports = index;
|
package/dist/index.d.cts
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
import * as _graphql_mesh_transport_common from '@graphql-mesh/transport-common';
|
2
|
+
import { DisposableExecutor } from '@graphql-mesh/transport-common';
|
3
|
+
|
4
|
+
interface HTTPCallbackTransportOptions {
|
5
|
+
/**
|
6
|
+
* The gateway's public URL, which your subgraphs access, must include the path configured on the gateway.
|
7
|
+
*
|
8
|
+
* @default http://localhost:4000/callback
|
9
|
+
*/
|
10
|
+
public_url?: string;
|
11
|
+
/**
|
12
|
+
* The path of the router's callback endpoint
|
13
|
+
*
|
14
|
+
* @default /callback
|
15
|
+
*/
|
16
|
+
path?: string;
|
17
|
+
/**
|
18
|
+
* @default 5000
|
19
|
+
*/
|
20
|
+
heartbeat_interval?: number;
|
21
|
+
}
|
22
|
+
declare const _default: {
|
23
|
+
getSubgraphExecutor({ transportEntry, fetch, pubsub, logger, }: _graphql_mesh_transport_common.TransportGetSubgraphExecutorOptions<HTTPCallbackTransportOptions>): DisposableExecutor;
|
24
|
+
};
|
25
|
+
|
26
|
+
export { type HTTPCallbackTransportOptions, _default as default };
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
import * as _graphql_mesh_transport_common from '@graphql-mesh/transport-common';
|
2
|
+
import { DisposableExecutor } from '@graphql-mesh/transport-common';
|
3
|
+
|
4
|
+
interface HTTPCallbackTransportOptions {
|
5
|
+
/**
|
6
|
+
* The gateway's public URL, which your subgraphs access, must include the path configured on the gateway.
|
7
|
+
*
|
8
|
+
* @default http://localhost:4000/callback
|
9
|
+
*/
|
10
|
+
public_url?: string;
|
11
|
+
/**
|
12
|
+
* The path of the router's callback endpoint
|
13
|
+
*
|
14
|
+
* @default /callback
|
15
|
+
*/
|
16
|
+
path?: string;
|
17
|
+
/**
|
18
|
+
* @default 5000
|
19
|
+
*/
|
20
|
+
heartbeat_interval?: number;
|
21
|
+
}
|
22
|
+
declare const _default: {
|
23
|
+
getSubgraphExecutor({ transportEntry, fetch, pubsub, logger, }: _graphql_mesh_transport_common.TransportGetSubgraphExecutorOptions<HTTPCallbackTransportOptions>): DisposableExecutor;
|
24
|
+
};
|
25
|
+
|
26
|
+
export { type HTTPCallbackTransportOptions, _default as default };
|