@reventlessdev/reventless-graphql-server 1.0.0-alpha.6 → 1.0.0-alpha.61
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.
- package/CHANGELOG.md +437 -0
- package/package.json +6 -6
- package/src/GraphQL_ServerInstance.res +30 -4
- package/src/GraphQL_ServerInstance.res.mjs +34 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,443 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 1.0.0-alpha.61 (2026-08-05)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# 1.0.0-alpha.60 (2026-08-04)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# 1.0.0-alpha.59 (2026-08-04)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# 1.0.0-alpha.58 (2026-08-04)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# 1.0.0-alpha.57 (2026-08-03)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# 1.0.0-alpha.56 (2026-08-03)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# 1.0.0-alpha.55 (2026-08-03)
|
|
55
|
+
|
|
56
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# 1.0.0-alpha.54 (2026-08-03)
|
|
63
|
+
|
|
64
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# 1.0.0-alpha.53 (2026-08-02)
|
|
71
|
+
|
|
72
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
# 1.0.0-alpha.52 (2026-08-02)
|
|
79
|
+
|
|
80
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# 1.0.0-alpha.51 (2026-08-02)
|
|
87
|
+
|
|
88
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# 1.0.0-alpha.50 (2026-08-02)
|
|
95
|
+
|
|
96
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# 1.0.0-alpha.49 (2026-08-02)
|
|
103
|
+
|
|
104
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
# 1.0.0-alpha.48 (2026-08-01)
|
|
111
|
+
|
|
112
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# 1.0.0-alpha.47 (2026-08-01)
|
|
119
|
+
|
|
120
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
# 1.0.0-alpha.46 (2026-08-01)
|
|
127
|
+
|
|
128
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
# 1.0.0-alpha.45 (2026-08-01)
|
|
135
|
+
|
|
136
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
# 1.0.0-alpha.44 (2026-07-31)
|
|
143
|
+
|
|
144
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
# 1.0.0-alpha.43 (2026-07-30)
|
|
151
|
+
|
|
152
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
# 1.0.0-alpha.42 (2026-07-30)
|
|
159
|
+
|
|
160
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
# 1.0.0-alpha.41 (2026-07-30)
|
|
167
|
+
|
|
168
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
# 1.0.0-alpha.40 (2026-07-30)
|
|
175
|
+
|
|
176
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
# 1.0.0-alpha.39 (2026-07-29)
|
|
183
|
+
|
|
184
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
# 1.0.0-alpha.38 (2026-07-28)
|
|
191
|
+
|
|
192
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
# 1.0.0-alpha.37 (2026-07-28)
|
|
199
|
+
|
|
200
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
# 1.0.0-alpha.36 (2026-07-28)
|
|
207
|
+
|
|
208
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
# 1.0.0-alpha.35 (2026-07-28)
|
|
215
|
+
|
|
216
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
# 1.0.0-alpha.34 (2026-07-27)
|
|
223
|
+
|
|
224
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
# 1.0.0-alpha.33 (2026-07-27)
|
|
231
|
+
|
|
232
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
# 1.0.0-alpha.32 (2026-07-27)
|
|
239
|
+
|
|
240
|
+
### Bug Fixes
|
|
241
|
+
|
|
242
|
+
* **graphql:** keep a repeat mutation registration from duplicating SDL ([b54e844](https://github.com/ReventlessDev/reventless-core/commit/b54e8446236e16196a40a1a7df9f7ba84b03b167))
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
# 1.0.0-alpha.31 (2026-07-27)
|
|
246
|
+
|
|
247
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
# 1.0.0-alpha.30 (2026-07-27)
|
|
254
|
+
|
|
255
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
# 1.0.0-alpha.29 (2026-07-26)
|
|
262
|
+
|
|
263
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
# 1.0.0-alpha.28 (2026-07-26)
|
|
270
|
+
|
|
271
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
# 1.0.0-alpha.27 (2026-07-24)
|
|
278
|
+
|
|
279
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
# 1.0.0-alpha.26 (2026-07-23)
|
|
286
|
+
|
|
287
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
# 1.0.0-alpha.25 (2026-07-22)
|
|
294
|
+
|
|
295
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
# 1.0.0-alpha.24 (2026-07-22)
|
|
302
|
+
|
|
303
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
# 1.0.0-alpha.23 (2026-07-22)
|
|
310
|
+
|
|
311
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
# 1.0.0-alpha.22 (2026-07-22)
|
|
318
|
+
|
|
319
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
# 1.0.0-alpha.21 (2026-07-21)
|
|
326
|
+
|
|
327
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
# 1.0.0-alpha.20 (2026-07-20)
|
|
334
|
+
|
|
335
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
# 1.0.0-alpha.19 (2026-07-17)
|
|
342
|
+
|
|
343
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
# 1.0.0-alpha.18 (2026-07-17)
|
|
350
|
+
|
|
351
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
# 1.0.0-alpha.17 (2026-07-16)
|
|
358
|
+
|
|
359
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
# 1.0.0-alpha.16 (2026-07-15)
|
|
366
|
+
|
|
367
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
# 1.0.0-alpha.15 (2026-07-14)
|
|
374
|
+
|
|
375
|
+
### Features
|
|
376
|
+
|
|
377
|
+
* surface masked GraphQL resolver errors server-side (local + AWS) ([b3bca51](https://github.com/ReventlessDev/reventless-core/commit/b3bca51b539e40c604b3db338d570de6215ea837))
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
# 1.0.0-alpha.14 (2026-07-14)
|
|
381
|
+
|
|
382
|
+
### Features
|
|
383
|
+
|
|
384
|
+
* **local:** plugin=subgraph composition — per-plugin subschemas merged at start (Phase 6, plan complete) ([40f44c5](https://github.com/ReventlessDev/reventless-core/commit/40f44c5c6aa32fbbd64f362841cf41ba4e2fc2e0))
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
# 1.0.0-alpha.13 (2026-07-14)
|
|
388
|
+
|
|
389
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
# 1.0.0-alpha.12 (2026-07-13)
|
|
396
|
+
|
|
397
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
# 1.0.0-alpha.11 (2026-07-13)
|
|
404
|
+
|
|
405
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
# 1.0.0-alpha.10 (2026-07-13)
|
|
412
|
+
|
|
413
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
# 1.0.0-alpha.9 (2026-07-13)
|
|
420
|
+
|
|
421
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
# 1.0.0-alpha.8 (2026-07-13)
|
|
428
|
+
|
|
429
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
# 1.0.0-alpha.7 (2026-07-13)
|
|
436
|
+
|
|
437
|
+
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
6
443
|
# 1.0.0-alpha.6 (2026-07-12)
|
|
7
444
|
|
|
8
445
|
**Note:** Version bump only for package @reventlessdev/reventless-graphql-server
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/reventless-graphql-server",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.61",
|
|
4
4
|
"description": "Transport-neutral GraphQL server runtime for Reventless: schema-from-fragments, resolver registration, an HTTP + graphql-ws listener, and a subscription fan-out bridge with a pluggable PubSub backend",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@reventlessdev/
|
|
8
|
-
"@reventlessdev/
|
|
7
|
+
"@reventlessdev/rescript-graphql-yoga": "1.0.0-alpha.26",
|
|
8
|
+
"@reventlessdev/reventless-core": "3.0.0-alpha.213"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
|
-
"rescript": "
|
|
11
|
+
"rescript": "12.3.0"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"rescript": "
|
|
14
|
+
"rescript": "12.3.0"
|
|
15
15
|
},
|
|
16
16
|
"publishConfig": {
|
|
17
17
|
"registry": "https://registry.npmjs.org"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
21
|
"url": "git+https://github.com/ReventlessDev/reventless-core.git",
|
|
22
|
-
"directory": "reventless/
|
|
22
|
+
"directory": "reventless/graphql-server"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "rescript build",
|
|
@@ -85,7 +85,16 @@ let make = (~label: string="GraphQL"): t => {
|
|
|
85
85
|
let lastFullSdl: ref<option<string>> = ref(None)
|
|
86
86
|
|
|
87
87
|
let registerMutations = (~sdlFields: array<string>, ~resolvers: dict<resolverFn>) => {
|
|
88
|
-
|
|
88
|
+
// A mutation field has two legitimate writers: the admin base fragment
|
|
89
|
+
// carries the Plugin aggregate's lifecycle fields, and the aggregate
|
|
90
|
+
// auto-flow registers the same fields when the admin is constructed again
|
|
91
|
+
// for a later deploy onto the same server. buildASTSchema rejects a schema
|
|
92
|
+
// that defines a field twice, so keep the first SDL definition and drop
|
|
93
|
+
// repeats by field name — mirroring the resolver dict, where a repeat
|
|
94
|
+
// registration overwrites by key (last resolver wins).
|
|
95
|
+
let existing = Set.fromArray(mutationFields.contents->Array.map(extractFieldName))
|
|
96
|
+
let fresh = sdlFields->Array.filter(f => !(existing->Set.has(extractFieldName(f))))
|
|
97
|
+
mutationFields.contents = mutationFields.contents->Array.concat(fresh)
|
|
89
98
|
resolvers->Dict.toArray->Array.forEach(((k, v)) => mutationResolvers.contents->Dict.set(k, v))
|
|
90
99
|
}
|
|
91
100
|
|
|
@@ -101,8 +110,15 @@ let make = (~label: string="GraphQL"): t => {
|
|
|
101
110
|
)
|
|
102
111
|
}
|
|
103
112
|
|
|
113
|
+
// Identical type blocks dedupe: shared-type registrations (e.g. the
|
|
114
|
+
// CommandResult union family) may be repeated by every component that needs
|
|
115
|
+
// them; a duplicate definition in one document would fail createSchema.
|
|
104
116
|
let registerTypes = (~sdlTypes: array<string>) => {
|
|
105
|
-
|
|
117
|
+
sdlTypes->Array.forEach(t =>
|
|
118
|
+
if !(typeDefinitions.contents->Array.includes(t)) {
|
|
119
|
+
typeDefinitions.contents->Array.push(t)
|
|
120
|
+
}
|
|
121
|
+
)
|
|
106
122
|
}
|
|
107
123
|
|
|
108
124
|
let getMutationResolver = (fieldName: string): option<resolverFn> =>
|
|
@@ -161,12 +177,22 @@ ${mutations}
|
|
|
161
177
|
lastFullSdl.contents = Some(sdl)
|
|
162
178
|
let schema = YG.createSchema({"typeDefs": sdl, "resolvers": resolvers})
|
|
163
179
|
activeSchema.contents = Some(schema)
|
|
180
|
+
// Route yoga's own logging into the framework logger. error/warn ALWAYS
|
|
181
|
+
// surface (so a masked resolver failure — which yoga reports via logger.error
|
|
182
|
+
// with the original Error even when the client response is masked — is never
|
|
183
|
+
// swallowed), while verbose debug/info stay gated on GRAPHQL_DEBUG.
|
|
184
|
+
let yogaLogging: YG.yogaLogger = {
|
|
185
|
+
debug: a => if debug { log.debug(~comp=label, YG.logArgToString(a)) },
|
|
186
|
+
info: a => if debug { log.info(~comp=label, YG.logArgToString(a)) },
|
|
187
|
+
warn: a => log.warn(~comp=label, YG.logArgToString(a)),
|
|
188
|
+
error: a => log.error(~comp=label, YG.logArgToString(a)),
|
|
189
|
+
}
|
|
164
190
|
let yoga = switch contextFactory {
|
|
165
191
|
| Some(ctx) =>
|
|
166
192
|
YG.createYogaWithContext({
|
|
167
193
|
"schema": schema,
|
|
168
194
|
"graphiql": true,
|
|
169
|
-
"logging":
|
|
195
|
+
"logging": yogaLogging,
|
|
170
196
|
"maskedErrors": !debug,
|
|
171
197
|
"context": ctx,
|
|
172
198
|
})
|
|
@@ -174,7 +200,7 @@ ${mutations}
|
|
|
174
200
|
YG.createYoga({
|
|
175
201
|
"schema": schema,
|
|
176
202
|
"graphiql": true,
|
|
177
|
-
"logging":
|
|
203
|
+
"logging": yogaLogging,
|
|
178
204
|
"maskedErrors": !debug,
|
|
179
205
|
})
|
|
180
206
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import * as Ws from "ws";
|
|
4
4
|
import * as Http from "http";
|
|
5
|
-
import * as GraphqlYoga from "graphql-yoga";
|
|
5
|
+
import * as GraphqlYoga from "@reventlessdev/rescript-graphql-yoga/src/GraphqlYoga.res.mjs";
|
|
6
|
+
import * as GraphqlYoga$1 from "graphql-yoga";
|
|
6
7
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
7
8
|
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
8
9
|
import * as Logger$ReventlessCore from "@reventlessdev/reventless-core/src/util/Logger.res.mjs";
|
|
@@ -51,7 +52,9 @@ function make(labelOpt) {
|
|
|
51
52
|
contents: undefined
|
|
52
53
|
};
|
|
53
54
|
let registerMutations = (sdlFields, resolvers) => {
|
|
54
|
-
|
|
55
|
+
let existing = new Set(mutationFields.contents.map(extractFieldName));
|
|
56
|
+
let fresh = sdlFields.filter(f => !existing.has(extractFieldName(f)));
|
|
57
|
+
mutationFields.contents = mutationFields.contents.concat(fresh);
|
|
55
58
|
Object.entries(resolvers).forEach(param => {
|
|
56
59
|
mutationResolvers.contents[param[0]] = param[1];
|
|
57
60
|
});
|
|
@@ -69,7 +72,12 @@ function make(labelOpt) {
|
|
|
69
72
|
});
|
|
70
73
|
};
|
|
71
74
|
let registerTypes = sdlTypes => {
|
|
72
|
-
|
|
75
|
+
sdlTypes.forEach(t => {
|
|
76
|
+
if (!typeDefinitions.contents.includes(t)) {
|
|
77
|
+
typeDefinitions.contents.push(t);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
73
81
|
};
|
|
74
82
|
let getMutationResolver = fieldName => mutationResolvers.contents[fieldName];
|
|
75
83
|
let getQueryResolver = fieldName => queryResolvers.contents[fieldName];
|
|
@@ -106,21 +114,39 @@ type Mutation {
|
|
|
106
114
|
}
|
|
107
115
|
let sdl = buildSdl();
|
|
108
116
|
lastFullSdl.contents = sdl;
|
|
109
|
-
let schema = GraphqlYoga.createSchema({
|
|
117
|
+
let schema = GraphqlYoga$1.createSchema({
|
|
110
118
|
typeDefs: sdl,
|
|
111
119
|
resolvers: resolvers
|
|
112
120
|
});
|
|
113
121
|
activeSchema.contents = Primitive_option.some(schema);
|
|
114
|
-
let
|
|
122
|
+
let yogaLogging_debug = a => {
|
|
123
|
+
if (debug) {
|
|
124
|
+
return log.debug(label, undefined, GraphqlYoga.logArgToString(a));
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
let yogaLogging_info = a => {
|
|
128
|
+
if (debug) {
|
|
129
|
+
return log.info(label, undefined, GraphqlYoga.logArgToString(a));
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
let yogaLogging_warn = a => log.warn(label, undefined, GraphqlYoga.logArgToString(a));
|
|
133
|
+
let yogaLogging_error = a => log.error(label, undefined, GraphqlYoga.logArgToString(a));
|
|
134
|
+
let yogaLogging = {
|
|
135
|
+
debug: yogaLogging_debug,
|
|
136
|
+
info: yogaLogging_info,
|
|
137
|
+
warn: yogaLogging_warn,
|
|
138
|
+
error: yogaLogging_error
|
|
139
|
+
};
|
|
140
|
+
let yoga = contextFactory !== undefined ? GraphqlYoga$1.createYoga({
|
|
115
141
|
schema: schema,
|
|
116
142
|
graphiql: true,
|
|
117
|
-
logging:
|
|
143
|
+
logging: yogaLogging,
|
|
118
144
|
maskedErrors: !debug,
|
|
119
145
|
context: contextFactory
|
|
120
|
-
}) : GraphqlYoga.createYoga({
|
|
146
|
+
}) : GraphqlYoga$1.createYoga({
|
|
121
147
|
schema: schema,
|
|
122
148
|
graphiql: true,
|
|
123
|
-
logging:
|
|
149
|
+
logging: yogaLogging,
|
|
124
150
|
maskedErrors: !debug
|
|
125
151
|
});
|
|
126
152
|
let server = Http.createServer(yoga);
|