@xyd-js/gql 0.1.0-xyd.5 → 0.1.0-xyd.54

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 (89) hide show
  1. package/CHANGELOG.md +450 -0
  2. package/LICENSE +21 -0
  3. package/TODO.md +8 -0
  4. package/__fixtures__/-1.opendocs.docs-nested/input.graphql +66 -0
  5. package/__fixtures__/-1.opendocs.docs-nested/output.json +554 -0
  6. package/__fixtures__/-1.opendocs.flat/input.graphql +19 -0
  7. package/__fixtures__/-1.opendocs.flat/output.json +243 -0
  8. package/__fixtures__/-1.opendocs.scopes/input.graphql +33 -0
  9. package/__fixtures__/-1.opendocs.scopes/output.json +378 -0
  10. package/__fixtures__/-1.opendocs.sidebar/input.graphql +44 -0
  11. package/__fixtures__/-1.opendocs.sort/input.graphql +92 -0
  12. package/__fixtures__/-1.opendocs.sort/output.json +1078 -0
  13. package/__fixtures__/-1.opendocs.sort+group/input.graphql +111 -0
  14. package/__fixtures__/-1.opendocs.sort+group/output.json +1114 -0
  15. package/__fixtures__/-1.opendocs.sort+group+path/input.graphql +118 -0
  16. package/__fixtures__/-1.opendocs.sort+group+path/output.json +1114 -0
  17. package/__fixtures__/-2.complex.github/input.graphql +69424 -0
  18. package/__fixtures__/-2.complex.github/output.json +269874 -0
  19. package/__fixtures__/-2.complex.livesession/input.graphql +23 -0
  20. package/__fixtures__/-2.complex.livesession/output.json +302 -0
  21. package/__fixtures__/-2.complex.monday/input.graphql +6089 -0
  22. package/__fixtures__/-2.complex.monday/output.json +1 -0
  23. package/__fixtures__/-3.array-non-null-return/input.graphql +9 -0
  24. package/__fixtures__/-3.array-non-null-return/output.json +151 -0
  25. package/__fixtures__/1.basic/input.graphql +118 -0
  26. package/__fixtures__/1.basic/output.json +630 -0
  27. package/__fixtures__/2.circular/input.graphql +17 -0
  28. package/__fixtures__/2.circular/output.json +248 -0
  29. package/__fixtures__/3.opendocs/input.graphql +27 -0
  30. package/__fixtures__/3.opendocs/output.json +338 -0
  31. package/__fixtures__/4.union/input.graphql +19 -0
  32. package/__fixtures__/4.union/output.json +344 -0
  33. package/__fixtures__/5.flat/input.graphql +27 -0
  34. package/__fixtures__/5.flat/output.json +383 -0
  35. package/__fixtures__/6.default-values/input.graphql +47 -0
  36. package/__fixtures__/6.default-values/output.json +655 -0
  37. package/__fixtures__/7.type-args/input.graphql +19 -0
  38. package/__fixtures__/7.type-args/output.json +301 -0
  39. package/__fixtures__/8.default-sort/input.graphql +60 -0
  40. package/__fixtures__/8.default-sort/output.json +1078 -0
  41. package/__tests__/gqlSchemaToReferences.test.ts +109 -0
  42. package/__tests__/utils.ts +45 -0
  43. package/declarations.d.ts +4 -0
  44. package/dist/index.d.ts +17 -1
  45. package/dist/index.js +1334 -19871
  46. package/dist/index.js.map +1 -1
  47. package/dist/opendocs.graphql +56 -0
  48. package/package.json +7 -9
  49. package/src/context.ts +17 -0
  50. package/src/converters/gql-arg.ts +51 -0
  51. package/src/converters/gql-enum.ts +27 -0
  52. package/src/converters/gql-field.ts +164 -0
  53. package/src/converters/gql-input.ts +34 -0
  54. package/src/converters/gql-interface.ts +35 -0
  55. package/src/converters/gql-mutation.ts +36 -0
  56. package/src/converters/gql-object.ts +83 -0
  57. package/src/converters/gql-operation.ts +128 -0
  58. package/src/converters/gql-query.ts +36 -0
  59. package/src/converters/gql-sample.ts +159 -0
  60. package/src/converters/gql-scalar.ts +16 -0
  61. package/src/converters/gql-subscription.ts +36 -0
  62. package/src/converters/gql-types.ts +195 -0
  63. package/src/converters/gql-union.ts +40 -0
  64. package/src/gql-core.ts +362 -0
  65. package/src/opendocs.graphql +56 -0
  66. package/src/opendocs.ts +253 -0
  67. package/src/schema.ts +253 -67
  68. package/src/types.ts +103 -0
  69. package/src/utils.ts +21 -96
  70. package/tsconfig.json +1 -1
  71. package/tsup.config.ts +15 -1
  72. package/vitest.config.ts +15 -1
  73. package/examples/basic/index.ts +0 -12
  74. package/examples/basic/schema.graphqls +0 -89
  75. package/examples/basic/todo-app.graphqls +0 -184
  76. package/examples/graphql-types/graphql-types.0.basic.graphqls +0 -28
  77. package/examples/nested/nested-arg.0.not-required.graphqls +0 -8
  78. package/examples/nested/nested-arg.0.required.graphqls +0 -8
  79. package/examples/nested/nested-arg.1.deep.graphqls +0 -12
  80. package/src/hydration/README.md +0 -1
  81. package/src/hydration/gql-arg.ts +0 -53
  82. package/src/hydration/gql-field.ts +0 -206
  83. package/src/hydration/gql-input.ts +0 -67
  84. package/src/hydration/gql-object.ts +0 -35
  85. package/src/hydration/gql-types.ts +0 -50
  86. package/src/samples/index.ts +0 -95
  87. package/test/graphql-types.0.test.ts +0 -125
  88. package/test/nested-arg.0.test.ts +0 -208
  89. package/test/nested-arg.1.test.ts +0 -19
package/CHANGELOG.md CHANGED
@@ -1,5 +1,455 @@
1
1
  # @xyd-js/gql
2
2
 
3
+ ## 0.1.0-xyd.54
4
+
5
+ ### Patch Changes
6
+
7
+ - update all packages
8
+ - Updated dependencies
9
+ - @xyd-js/core@0.1.0-xyd.54
10
+ - @xyd-js/uniform@0.1.0-xyd.56
11
+
12
+ ## 0.1.0-xyd.53
13
+
14
+ ### Patch Changes
15
+
16
+ - update all packages
17
+ - Updated dependencies
18
+ - @xyd-js/core@0.1.0-xyd.53
19
+ - @xyd-js/uniform@0.1.0-xyd.55
20
+
21
+ ## 0.1.0-xyd.52
22
+
23
+ ### Patch Changes
24
+
25
+ - update all packages
26
+ - Updated dependencies
27
+ - @xyd-js/core@0.1.0-xyd.52
28
+ - @xyd-js/uniform@0.1.0-xyd.54
29
+
30
+ ## 0.1.0-xyd.51
31
+
32
+ ### Patch Changes
33
+
34
+ - update all packages
35
+ - Updated dependencies
36
+ - @xyd-js/core@0.1.0-xyd.51
37
+ - @xyd-js/uniform@0.1.0-xyd.53
38
+
39
+ ## 0.1.0-xyd.50
40
+
41
+ ### Patch Changes
42
+
43
+ - update all packages
44
+ - Updated dependencies
45
+ - @xyd-js/core@0.1.0-xyd.50
46
+ - @xyd-js/uniform@0.1.0-xyd.52
47
+
48
+ ## 0.1.0-xyd.49
49
+
50
+ ### Patch Changes
51
+
52
+ - update all packages
53
+ - Updated dependencies
54
+ - @xyd-js/core@0.1.0-xyd.49
55
+ - @xyd-js/uniform@0.1.0-xyd.51
56
+
57
+ ## 0.1.0-xyd.48
58
+
59
+ ### Patch Changes
60
+
61
+ - update all packages
62
+ - Updated dependencies
63
+ - @xyd-js/core@0.1.0-xyd.48
64
+ - @xyd-js/uniform@0.1.0-xyd.50
65
+
66
+ ## 0.1.0-xyd.47
67
+
68
+ ### Patch Changes
69
+
70
+ - update all packages
71
+ - Updated dependencies
72
+ - @xyd-js/core@0.1.0-xyd.47
73
+ - @xyd-js/uniform@0.1.0-xyd.49
74
+
75
+ ## 0.1.0-xyd.46
76
+
77
+ ### Patch Changes
78
+
79
+ - update all packages
80
+ - Updated dependencies
81
+ - @xyd-js/core@0.1.0-xyd.46
82
+ - @xyd-js/uniform@0.1.0-xyd.48
83
+
84
+ ## 0.1.0-xyd.45
85
+
86
+ ### Patch Changes
87
+
88
+ - update all packages
89
+ - Updated dependencies
90
+ - @xyd-js/core@0.1.0-xyd.45
91
+ - @xyd-js/uniform@0.1.0-xyd.47
92
+
93
+ ## 0.1.0-xyd.44
94
+
95
+ ### Patch Changes
96
+
97
+ - update all packages
98
+ - Updated dependencies
99
+ - @xyd-js/core@0.1.0-xyd.44
100
+ - @xyd-js/uniform@0.1.0-xyd.46
101
+
102
+ ## 0.1.0-xyd.43
103
+
104
+ ### Patch Changes
105
+
106
+ - update all packages
107
+ - Updated dependencies
108
+ - @xyd-js/core@0.1.0-xyd.43
109
+ - @xyd-js/uniform@0.1.0-xyd.45
110
+
111
+ ## 0.1.0-xyd.42
112
+
113
+ ### Patch Changes
114
+
115
+ - update all packages
116
+ - Updated dependencies
117
+ - @xyd-js/core@0.1.0-xyd.42
118
+ - @xyd-js/uniform@0.1.0-xyd.44
119
+
120
+ ## 0.1.0-xyd.41
121
+
122
+ ### Patch Changes
123
+
124
+ - update all packages
125
+ - Updated dependencies
126
+ - @xyd-js/core@0.1.0-xyd.41
127
+ - @xyd-js/uniform@0.1.0-xyd.43
128
+
129
+ ## 0.1.0-xyd.40
130
+
131
+ ### Patch Changes
132
+
133
+ - update all packages
134
+ - Updated dependencies
135
+ - @xyd-js/core@0.1.0-xyd.40
136
+ - @xyd-js/uniform@0.1.0-xyd.42
137
+
138
+ ## 0.1.0-xyd.39
139
+
140
+ ### Patch Changes
141
+
142
+ - update all packages
143
+ - Updated dependencies
144
+ - @xyd-js/core@0.1.0-xyd.39
145
+ - @xyd-js/uniform@0.1.0-xyd.41
146
+
147
+ ## 0.1.0-xyd.38
148
+
149
+ ### Patch Changes
150
+
151
+ - update all packages
152
+ - Updated dependencies
153
+ - @xyd-js/core@0.1.0-xyd.38
154
+ - @xyd-js/uniform@0.1.0-xyd.40
155
+
156
+ ## 0.1.0-xyd.37
157
+
158
+ ### Patch Changes
159
+
160
+ - update all packages
161
+ - Updated dependencies
162
+ - @xyd-js/core@0.1.0-xyd.37
163
+ - @xyd-js/uniform@0.1.0-xyd.39
164
+
165
+ ## 0.1.0-xyd.36
166
+
167
+ ### Patch Changes
168
+
169
+ - update all packages
170
+ - Updated dependencies
171
+ - @xyd-js/core@0.1.0-xyd.36
172
+ - @xyd-js/uniform@0.1.0-xyd.38
173
+
174
+ ## 0.1.0-xyd.35
175
+
176
+ ### Patch Changes
177
+
178
+ - update all packages
179
+ - Updated dependencies
180
+ - @xyd-js/core@0.1.0-xyd.35
181
+ - @xyd-js/uniform@0.1.0-xyd.37
182
+
183
+ ## 0.1.0-xyd.34
184
+
185
+ ### Patch Changes
186
+
187
+ - update all packages
188
+ - Updated dependencies
189
+ - @xyd-js/core@0.1.0-xyd.34
190
+ - @xyd-js/uniform@0.1.0-xyd.36
191
+
192
+ ## 0.1.0-xyd.33
193
+
194
+ ### Patch Changes
195
+
196
+ - update all packages
197
+ - Updated dependencies
198
+ - @xyd-js/core@0.1.0-xyd.33
199
+ - @xyd-js/uniform@0.1.0-xyd.35
200
+
201
+ ## 0.1.0-xyd.32
202
+
203
+ ### Patch Changes
204
+
205
+ - update all packages
206
+ - Updated dependencies
207
+ - @xyd-js/core@0.1.0-xyd.32
208
+ - @xyd-js/uniform@0.1.0-xyd.34
209
+
210
+ ## 0.1.0-xyd.31
211
+
212
+ ### Patch Changes
213
+
214
+ - update all packages
215
+ - update all packages
216
+ - Updated dependencies
217
+ - Updated dependencies
218
+ - @xyd-js/core@0.1.0-xyd.31
219
+ - @xyd-js/uniform@0.1.0-xyd.33
220
+
221
+ ## 0.1.0-xyd.30
222
+
223
+ ### Patch Changes
224
+
225
+ - update all packages
226
+ - Updated dependencies
227
+ - @xyd-js/core@0.1.0-xyd.30
228
+ - @xyd-js/uniform@0.1.0-xyd.32
229
+
230
+ ## 0.1.0-xyd.29
231
+
232
+ ### Patch Changes
233
+
234
+ - update all packages
235
+ - update all packages
236
+ - Updated dependencies
237
+ - Updated dependencies
238
+ - @xyd-js/core@0.1.0-xyd.29
239
+ - @xyd-js/uniform@0.1.0-xyd.31
240
+
241
+ ## 0.1.0-xyd.28
242
+
243
+ ### Patch Changes
244
+
245
+ - update all packages
246
+ - update all packages
247
+ - Updated dependencies
248
+ - Updated dependencies
249
+ - @xyd-js/core@0.1.0-xyd.28
250
+ - @xyd-js/uniform@0.1.0-xyd.30
251
+
252
+ ## 0.1.0-xyd.27
253
+
254
+ ### Patch Changes
255
+
256
+ - update all packages
257
+ - update all packages
258
+ - Updated dependencies
259
+ - Updated dependencies
260
+ - @xyd-js/core@0.1.0-xyd.27
261
+ - @xyd-js/uniform@0.1.0-xyd.29
262
+
263
+ ## 0.1.0-xyd.26
264
+
265
+ ### Patch Changes
266
+
267
+ - update all packages
268
+ - update all packages
269
+ - Updated dependencies
270
+ - Updated dependencies
271
+ - @xyd-js/core@0.1.0-xyd.26
272
+ - @xyd-js/uniform@0.1.0-xyd.28
273
+
274
+ ## 0.1.0-xyd.25
275
+
276
+ ### Patch Changes
277
+
278
+ - update all packages
279
+ - update all packages
280
+ - Updated dependencies
281
+ - Updated dependencies
282
+ - @xyd-js/core@0.1.0-xyd.25
283
+ - @xyd-js/uniform@0.1.0-xyd.27
284
+
285
+ ## 0.1.0-xyd.24
286
+
287
+ ### Patch Changes
288
+
289
+ - update all packages
290
+ - update all packages
291
+ - Updated dependencies
292
+ - Updated dependencies
293
+ - @xyd-js/core@0.1.0-xyd.24
294
+ - @xyd-js/uniform@0.1.0-xyd.26
295
+
296
+ ## 0.1.0-xyd.23
297
+
298
+ ### Patch Changes
299
+
300
+ - update all packages
301
+ - Updated dependencies
302
+ - @xyd-js/core@0.1.0-xyd.23
303
+ - @xyd-js/uniform@0.1.0-xyd.25
304
+
305
+ ## 0.1.0-xyd.22
306
+
307
+ ### Patch Changes
308
+
309
+ - update all packages
310
+ - Updated dependencies
311
+ - @xyd-js/core@0.1.0-xyd.22
312
+ - @xyd-js/uniform@0.1.0-xyd.24
313
+
314
+ ## 0.1.0-xyd.21
315
+
316
+ ### Patch Changes
317
+
318
+ - update all packages
319
+ - Updated dependencies
320
+ - @xyd-js/core@0.1.0-xyd.21
321
+ - @xyd-js/uniform@0.1.0-xyd.23
322
+
323
+ ## 0.1.0-xyd.20
324
+
325
+ ### Patch Changes
326
+
327
+ - update
328
+ - Updated dependencies
329
+ - @xyd-js/core@0.1.0-xyd.20
330
+ - @xyd-js/uniform@0.1.0-xyd.22
331
+
332
+ ## 0.1.0-xyd.19
333
+
334
+ ### Patch Changes
335
+
336
+ - update
337
+ - Updated dependencies
338
+ - @xyd-js/core@0.1.0-xyd.19
339
+ - @xyd-js/uniform@0.1.0-xyd.21
340
+
341
+ ## 0.1.0-xyd.18
342
+
343
+ ### Patch Changes
344
+
345
+ - update
346
+ - Updated dependencies
347
+ - @xyd-js/core@0.1.0-xyd.18
348
+ - @xyd-js/uniform@0.1.0-xyd.20
349
+
350
+ ## 0.1.0-xyd.17
351
+
352
+ ### Patch Changes
353
+
354
+ - update
355
+ - Updated dependencies
356
+ - @xyd-js/core@0.1.0-xyd.17
357
+ - @xyd-js/uniform@0.1.0-xyd.19
358
+
359
+ ## 0.1.0-xyd.16
360
+
361
+ ### Patch Changes
362
+
363
+ - update
364
+ - Updated dependencies
365
+ - @xyd-js/core@0.1.0-xyd.16
366
+ - @xyd-js/uniform@0.1.0-xyd.18
367
+
368
+ ## 0.1.0-xyd.15
369
+
370
+ ### Patch Changes
371
+
372
+ - test
373
+ - Updated dependencies
374
+ - @xyd-js/core@0.1.0-xyd.15
375
+ - @xyd-js/uniform@0.1.0-xyd.17
376
+
377
+ ## 0.1.0-xyd.14
378
+
379
+ ### Patch Changes
380
+
381
+ - update packages
382
+ - Updated dependencies
383
+ - @xyd-js/core@0.1.0-xyd.14
384
+ - @xyd-js/uniform@0.1.0-xyd.16
385
+
386
+ ## 0.1.0-xyd.13
387
+
388
+ ### Patch Changes
389
+
390
+ - version
391
+ - Updated dependencies
392
+ - @xyd-js/core@0.1.0-xyd.13
393
+ - @xyd-js/uniform@0.1.0-xyd.15
394
+
395
+ ## 0.1.0-xyd.12
396
+
397
+ ### Patch Changes
398
+
399
+ - Updated dependencies
400
+ - @xyd-js/core@0.1.0-xyd.12
401
+ - @xyd-js/uniform@0.1.0-xyd.14
402
+
403
+ ## 0.1.0-xyd.11
404
+
405
+ ### Patch Changes
406
+
407
+ - Updated dependencies
408
+ - @xyd-js/core@0.1.0-xyd.11
409
+ - @xyd-js/uniform@0.1.0-xyd.13
410
+
411
+ ## 0.1.0-xyd.10
412
+
413
+ ### Patch Changes
414
+
415
+ - Updated dependencies
416
+ - @xyd-js/core@0.1.0-xyd.10
417
+ - @xyd-js/uniform@0.1.0-xyd.12
418
+
419
+ ## 0.1.0-xyd.9
420
+
421
+ ### Patch Changes
422
+
423
+ - refactor, tweaks and ui changes
424
+ - Updated dependencies
425
+ - @xyd-js/core@0.1.0-xyd.9
426
+ - @xyd-js/uniform@0.1.0-xyd.11
427
+
428
+ ## 0.1.0-xyd.8
429
+
430
+ ### Patch Changes
431
+
432
+ - Updated dependencies
433
+ - @xyd-js/core@0.1.0-xyd.8
434
+ - @xyd-js/uniform@0.1.0-xyd.10
435
+
436
+ ## 0.1.0-xyd.7
437
+
438
+ ### Patch Changes
439
+
440
+ - Updated dependencies
441
+ - @xyd-js/core@0.1.0-xyd.7
442
+ - @xyd-js/uniform@0.1.0-xyd.9
443
+
444
+ ## 0.1.0-xyd.6
445
+
446
+ ### Patch Changes
447
+
448
+ - use react-router 7.1.1
449
+ - Updated dependencies
450
+ - @xyd-js/core@0.1.0-xyd.6
451
+ - @xyd-js/uniform@0.1.0-xyd.8
452
+
3
453
  ## 0.1.0-xyd.5
4
454
 
5
455
  ### Patch Changes
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 xyd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/TODO.md ADDED
@@ -0,0 +1,8 @@
1
+ 1. support nested inline default values if possible?
2
+ ```graphql
3
+ type Mutation {
4
+ setData(input: DataInput! = {
5
+ name: "new data"
6
+ }): Data
7
+ }
8
+ ```
@@ -0,0 +1,66 @@
1
+ type Query
2
+ type Mutation
3
+
4
+ extend schema @docs(
5
+ group: ["API & Reference"]
6
+ # above `group` is the root that every node will inherit
7
+ )
8
+
9
+ extend type Query @doc(
10
+ group: ["Users", "Queries"],
11
+ path: "users/queries"
12
+ # `group` and `path` will be inherited by all operations in this type
13
+ ) {
14
+ getUser(id: ID!): User
15
+ @doc(
16
+ path: "get"
17
+ )
18
+ }
19
+
20
+ extend type Query @doc(
21
+ group: ["Todos", "Queries"],
22
+ path: "todos/queries"
23
+ # `group` and `path` will be inherited by all operations in this type
24
+ # NOTE: is a different type from the previous one, so it can have its own `group` and `path`
25
+ ) {
26
+ getTodo(id: ID!): User
27
+ }
28
+
29
+ extend type Mutation @doc(
30
+ group: ["Users", "Mutations"],
31
+ path: "users/mutations"
32
+ ) {
33
+ createUser(input: createUserInput!): User
34
+ # if `path` is not specified, it will be derived from the operation name
35
+ }
36
+
37
+ type User @doc(
38
+ group: ["Users", "Objects"],
39
+ # we can declare `group` for the type itself
40
+ ) {
41
+ id: ID!
42
+ name: String!
43
+ email: String!
44
+ }
45
+
46
+ input createUserInput @doc(
47
+ group: ["Users", "Inputs"],
48
+ # we can declare `group` for the input type itself
49
+ ) {
50
+ name: String!
51
+ email: String!
52
+ }
53
+
54
+ scalar Email @doc(
55
+ group: ["Scalars"]
56
+ # we can declare `group` for the scalar type itself too
57
+ )
58
+
59
+ type Todo @doc(
60
+ group: ["Todos", "Objects"],
61
+ ) {
62
+ id: ID!
63
+ title: String!
64
+ completed: Boolean!
65
+ }
66
+