@xyd-js/gql 0.1.0-xyd.4 → 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 +459 -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
@@ -0,0 +1,655 @@
1
+ [
2
+ {
3
+ "title": "getData",
4
+ "description": "",
5
+ "canonical": "queries/getData",
6
+ "category": "graphql",
7
+ "type": "graphql_query",
8
+ "context": {
9
+ "graphqlTypeShort": "query",
10
+ "graphqlName": "getData",
11
+ "group": [
12
+ "Queries"
13
+ ],
14
+ "scopes": []
15
+ },
16
+ "examples": {
17
+ "groups": [
18
+ {
19
+ "description": "",
20
+ "examples": [
21
+ {
22
+ "codeblock": {
23
+ "tabs": [
24
+ {
25
+ "title": "",
26
+ "language": "graphql",
27
+ "code": "query getData($input: DataInput!) {\n getData(input: $input) {\n # getData fields\n }\n}"
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ]
35
+ },
36
+ "definitions": [
37
+ {
38
+ "title": "Arguments",
39
+ "properties": [
40
+ {
41
+ "name": "input",
42
+ "type": "DataInput!",
43
+ "description": "",
44
+ "context": {
45
+ "graphqlTypeShort": "input",
46
+ "graphqlName": "DataInput",
47
+ "group": [
48
+ "Inputs"
49
+ ],
50
+ "scopes": []
51
+ },
52
+ "properties": [],
53
+ "meta": [
54
+ {
55
+ "name": "required",
56
+ "value": "true"
57
+ }
58
+ ],
59
+ "symbolDef": {
60
+ "canonical": "inputs/DataInput"
61
+ }
62
+ }
63
+ ]
64
+ },
65
+ {
66
+ "title": "Returns",
67
+ "properties": [
68
+ {
69
+ "name": "",
70
+ "type": "Data",
71
+ "description": "",
72
+ "context": {
73
+ "graphqlName": "getData",
74
+ "graphqlTypeFlat": "Data",
75
+ "graphqlBuiltInType": false
76
+ },
77
+ "properties": [],
78
+ "meta": [],
79
+ "symbolDef": {
80
+ "canonical": "objects/Data"
81
+ }
82
+ }
83
+ ]
84
+ }
85
+ ]
86
+ },
87
+ {
88
+ "title": "getDataList",
89
+ "description": "",
90
+ "canonical": "queries/getDataList",
91
+ "category": "graphql",
92
+ "type": "graphql_query",
93
+ "context": {
94
+ "graphqlTypeShort": "query",
95
+ "graphqlName": "getDataList",
96
+ "group": [
97
+ "Queries"
98
+ ],
99
+ "scopes": []
100
+ },
101
+ "examples": {
102
+ "groups": [
103
+ {
104
+ "description": "",
105
+ "examples": [
106
+ {
107
+ "codeblock": {
108
+ "tabs": [
109
+ {
110
+ "title": "",
111
+ "language": "graphql",
112
+ "code": "{\n getDataList(limit: 10) {\n # getDataList fields\n }\n}"
113
+ }
114
+ ]
115
+ }
116
+ }
117
+ ]
118
+ }
119
+ ]
120
+ },
121
+ "definitions": [
122
+ {
123
+ "title": "Arguments",
124
+ "properties": [
125
+ {
126
+ "name": "limit",
127
+ "type": "Int!",
128
+ "description": "",
129
+ "context": {
130
+ "graphqlName": "limit",
131
+ "graphqlTypeFlat": "Int",
132
+ "graphqlBuiltInType": true
133
+ },
134
+ "properties": [],
135
+ "meta": [
136
+ {
137
+ "name": "required",
138
+ "value": "true"
139
+ },
140
+ {
141
+ "name": "defaults",
142
+ "value": 10
143
+ }
144
+ ],
145
+ "symbolDef": {
146
+ "canonical": "/limit"
147
+ }
148
+ },
149
+ {
150
+ "name": "offset",
151
+ "type": "Int",
152
+ "description": "",
153
+ "context": {
154
+ "graphqlName": "offset",
155
+ "graphqlTypeFlat": "Int",
156
+ "graphqlBuiltInType": true
157
+ },
158
+ "properties": [],
159
+ "meta": [
160
+ {
161
+ "name": "defaults",
162
+ "value": 0
163
+ }
164
+ ],
165
+ "symbolDef": {
166
+ "canonical": "/offset"
167
+ }
168
+ },
169
+ {
170
+ "name": "page",
171
+ "type": "Int",
172
+ "description": "",
173
+ "context": {
174
+ "graphqlName": "page",
175
+ "graphqlTypeFlat": "Int",
176
+ "graphqlBuiltInType": true
177
+ },
178
+ "properties": [],
179
+ "meta": [],
180
+ "symbolDef": {
181
+ "canonical": "/page"
182
+ }
183
+ }
184
+ ]
185
+ },
186
+ {
187
+ "title": "Returns",
188
+ "properties": [
189
+ {
190
+ "name": "",
191
+ "type": "Data",
192
+ "description": "",
193
+ "context": {
194
+ "graphqlName": "getDataList",
195
+ "graphqlTypeFlat": "Data",
196
+ "graphqlBuiltInType": false
197
+ },
198
+ "properties": [],
199
+ "meta": [],
200
+ "symbolDef": {
201
+ "canonical": "objects/Data"
202
+ }
203
+ }
204
+ ]
205
+ }
206
+ ]
207
+ },
208
+ {
209
+ "title": "Data",
210
+ "description": "",
211
+ "canonical": "objects/Data",
212
+ "category": "graphql",
213
+ "type": "graphql_object",
214
+ "context": {
215
+ "graphqlTypeShort": "object",
216
+ "graphqlName": "Data",
217
+ "group": [
218
+ "Objects"
219
+ ],
220
+ "scopes": []
221
+ },
222
+ "examples": {
223
+ "groups": []
224
+ },
225
+ "definitions": [
226
+ {
227
+ "title": "Arguments",
228
+ "properties": [],
229
+ "variants": [],
230
+ "meta": [
231
+ {
232
+ "name": "type",
233
+ "value": "arguments"
234
+ }
235
+ ]
236
+ },
237
+ {
238
+ "title": "Fields",
239
+ "properties": [
240
+ {
241
+ "name": "id",
242
+ "type": "ID!",
243
+ "description": "",
244
+ "context": {
245
+ "graphqlName": "id",
246
+ "graphqlTypeFlat": "ID",
247
+ "graphqlBuiltInType": true
248
+ },
249
+ "properties": [],
250
+ "meta": [
251
+ {
252
+ "name": "required",
253
+ "value": "true"
254
+ }
255
+ ],
256
+ "symbolDef": {
257
+ "canonical": "/id"
258
+ }
259
+ },
260
+ {
261
+ "name": "name",
262
+ "type": "String!",
263
+ "description": "",
264
+ "context": {
265
+ "graphqlName": "name",
266
+ "graphqlTypeFlat": "String",
267
+ "graphqlBuiltInType": true
268
+ },
269
+ "properties": [],
270
+ "meta": [
271
+ {
272
+ "name": "required",
273
+ "value": "true"
274
+ }
275
+ ],
276
+ "symbolDef": {
277
+ "canonical": "/name"
278
+ }
279
+ },
280
+ {
281
+ "name": "metadata",
282
+ "type": "Metadata!",
283
+ "description": "",
284
+ "context": {
285
+ "graphqlName": "metadata",
286
+ "graphqlTypeFlat": "Metadata",
287
+ "graphqlBuiltInType": false
288
+ },
289
+ "properties": [],
290
+ "meta": [
291
+ {
292
+ "name": "required",
293
+ "value": "true"
294
+ }
295
+ ],
296
+ "symbolDef": {
297
+ "canonical": "objects/Metadata"
298
+ }
299
+ }
300
+ ],
301
+ "meta": [
302
+ {
303
+ "name": "type",
304
+ "value": "fields"
305
+ }
306
+ ]
307
+ }
308
+ ]
309
+ },
310
+ {
311
+ "title": "Metadata",
312
+ "description": "",
313
+ "canonical": "objects/Metadata",
314
+ "category": "graphql",
315
+ "type": "graphql_object",
316
+ "context": {
317
+ "graphqlTypeShort": "object",
318
+ "graphqlName": "Metadata",
319
+ "group": [
320
+ "Objects"
321
+ ],
322
+ "scopes": []
323
+ },
324
+ "examples": {
325
+ "groups": []
326
+ },
327
+ "definitions": [
328
+ {
329
+ "title": "Arguments",
330
+ "properties": [],
331
+ "variants": [],
332
+ "meta": [
333
+ {
334
+ "name": "type",
335
+ "value": "arguments"
336
+ }
337
+ ]
338
+ },
339
+ {
340
+ "title": "Fields",
341
+ "properties": [
342
+ {
343
+ "name": "active",
344
+ "type": "Boolean!",
345
+ "description": "",
346
+ "context": {
347
+ "graphqlName": "active",
348
+ "graphqlTypeFlat": "Boolean",
349
+ "graphqlBuiltInType": true
350
+ },
351
+ "properties": [],
352
+ "meta": [
353
+ {
354
+ "name": "required",
355
+ "value": "true"
356
+ }
357
+ ],
358
+ "symbolDef": {
359
+ "canonical": "/active"
360
+ }
361
+ },
362
+ {
363
+ "name": "tags",
364
+ "type": "[String!]!",
365
+ "description": "",
366
+ "context": {
367
+ "graphqlName": "tags",
368
+ "graphqlTypeFlat": "String",
369
+ "graphqlBuiltInType": true
370
+ },
371
+ "properties": [],
372
+ "meta": [
373
+ {
374
+ "name": "required",
375
+ "value": "true"
376
+ }
377
+ ],
378
+ "symbolDef": {
379
+ "canonical": "/tags"
380
+ }
381
+ }
382
+ ],
383
+ "meta": [
384
+ {
385
+ "name": "type",
386
+ "value": "fields"
387
+ }
388
+ ]
389
+ }
390
+ ]
391
+ },
392
+ {
393
+ "title": "DataInput",
394
+ "description": "",
395
+ "canonical": "inputs/DataInput",
396
+ "category": "graphql",
397
+ "type": "graphql_input",
398
+ "context": {
399
+ "graphqlTypeShort": "input",
400
+ "graphqlName": "DataInput",
401
+ "group": [
402
+ "Inputs"
403
+ ],
404
+ "scopes": []
405
+ },
406
+ "examples": {
407
+ "groups": []
408
+ },
409
+ "definitions": [
410
+ {
411
+ "title": "Fields",
412
+ "properties": [
413
+ {
414
+ "name": "name",
415
+ "type": "String",
416
+ "description": "",
417
+ "context": {
418
+ "graphqlName": "name",
419
+ "graphqlTypeFlat": "String",
420
+ "graphqlBuiltInType": true
421
+ },
422
+ "properties": [],
423
+ "meta": [
424
+ {
425
+ "name": "defaults",
426
+ "value": "default"
427
+ }
428
+ ],
429
+ "symbolDef": {
430
+ "canonical": "/name"
431
+ }
432
+ },
433
+ {
434
+ "name": "count",
435
+ "type": "Int",
436
+ "description": "",
437
+ "context": {
438
+ "graphqlName": "count",
439
+ "graphqlTypeFlat": "Int",
440
+ "graphqlBuiltInType": true
441
+ },
442
+ "properties": [],
443
+ "meta": [
444
+ {
445
+ "name": "defaults",
446
+ "value": 0
447
+ }
448
+ ],
449
+ "symbolDef": {
450
+ "canonical": "/count"
451
+ }
452
+ },
453
+ {
454
+ "name": "isActive",
455
+ "type": "Boolean",
456
+ "description": "",
457
+ "context": {
458
+ "graphqlName": "isActive",
459
+ "graphqlTypeFlat": "Boolean",
460
+ "graphqlBuiltInType": true
461
+ },
462
+ "properties": [],
463
+ "meta": [
464
+ {
465
+ "name": "defaults",
466
+ "value": true
467
+ }
468
+ ],
469
+ "symbolDef": {
470
+ "canonical": "/isActive"
471
+ }
472
+ },
473
+ {
474
+ "name": "role",
475
+ "type": "Role",
476
+ "description": "",
477
+ "context": {
478
+ "graphqlName": "role",
479
+ "graphqlTypeFlat": "Role",
480
+ "graphqlBuiltInType": false
481
+ },
482
+ "properties": [],
483
+ "meta": [
484
+ {
485
+ "name": "defaults",
486
+ "value": "USER"
487
+ }
488
+ ],
489
+ "symbolDef": {
490
+ "canonical": "enums/Role"
491
+ }
492
+ },
493
+ {
494
+ "name": "tags",
495
+ "type": "[String!]",
496
+ "description": "",
497
+ "context": {
498
+ "graphqlName": "tags",
499
+ "graphqlTypeFlat": "String",
500
+ "graphqlBuiltInType": true
501
+ },
502
+ "properties": [],
503
+ "meta": [
504
+ {
505
+ "name": "required",
506
+ "value": "true"
507
+ },
508
+ {
509
+ "name": "defaults",
510
+ "value": [
511
+ "tag1",
512
+ "tag2"
513
+ ]
514
+ }
515
+ ],
516
+ "symbolDef": {
517
+ "canonical": "/tags"
518
+ }
519
+ },
520
+ {
521
+ "name": "metadata",
522
+ "type": "MetadataInput",
523
+ "description": "",
524
+ "context": {
525
+ "graphqlName": "metadata",
526
+ "graphqlTypeFlat": "MetadataInput",
527
+ "graphqlBuiltInType": false
528
+ },
529
+ "properties": [],
530
+ "meta": [
531
+ {
532
+ "name": "defaults",
533
+ "value": {
534
+ "active": true,
535
+ "tags": [
536
+ "default"
537
+ ]
538
+ }
539
+ }
540
+ ],
541
+ "symbolDef": {
542
+ "canonical": "inputs/MetadataInput"
543
+ }
544
+ }
545
+ ]
546
+ }
547
+ ]
548
+ },
549
+ {
550
+ "title": "MetadataInput",
551
+ "description": "",
552
+ "canonical": "inputs/MetadataInput",
553
+ "category": "graphql",
554
+ "type": "graphql_input",
555
+ "context": {
556
+ "graphqlTypeShort": "input",
557
+ "graphqlName": "MetadataInput",
558
+ "group": [
559
+ "Inputs"
560
+ ],
561
+ "scopes": []
562
+ },
563
+ "examples": {
564
+ "groups": []
565
+ },
566
+ "definitions": [
567
+ {
568
+ "title": "Fields",
569
+ "properties": [
570
+ {
571
+ "name": "active",
572
+ "type": "Boolean",
573
+ "description": "",
574
+ "context": {
575
+ "graphqlName": "active",
576
+ "graphqlTypeFlat": "Boolean",
577
+ "graphqlBuiltInType": true
578
+ },
579
+ "properties": [],
580
+ "meta": [
581
+ {
582
+ "name": "defaults",
583
+ "value": false
584
+ }
585
+ ],
586
+ "symbolDef": {
587
+ "canonical": "/active"
588
+ }
589
+ },
590
+ {
591
+ "name": "tags",
592
+ "type": "[String!]",
593
+ "description": "",
594
+ "context": {
595
+ "graphqlName": "tags",
596
+ "graphqlTypeFlat": "String",
597
+ "graphqlBuiltInType": true
598
+ },
599
+ "properties": [],
600
+ "meta": [
601
+ {
602
+ "name": "required",
603
+ "value": "true"
604
+ },
605
+ {
606
+ "name": "defaults",
607
+ "value": [
608
+ "default"
609
+ ]
610
+ }
611
+ ],
612
+ "symbolDef": {
613
+ "canonical": "/tags"
614
+ }
615
+ }
616
+ ]
617
+ }
618
+ ]
619
+ },
620
+ {
621
+ "title": "Role",
622
+ "description": "",
623
+ "canonical": "enums/Role",
624
+ "category": "graphql",
625
+ "type": "graphql_enum",
626
+ "context": {
627
+ "graphqlTypeShort": "enum",
628
+ "graphqlName": "Role",
629
+ "group": [
630
+ "Enums"
631
+ ],
632
+ "scopes": []
633
+ },
634
+ "examples": {
635
+ "groups": []
636
+ },
637
+ "definitions": [
638
+ {
639
+ "title": "Valid values",
640
+ "properties": [
641
+ {
642
+ "name": "USER",
643
+ "type": "string",
644
+ "description": ""
645
+ },
646
+ {
647
+ "name": "ADMIN",
648
+ "type": "string",
649
+ "description": ""
650
+ }
651
+ ]
652
+ }
653
+ ]
654
+ }
655
+ ]
@@ -0,0 +1,19 @@
1
+ type Book {
2
+ authors(
3
+ first: Int
4
+ after: String
5
+ limit: Int!
6
+ ): [Author!]!
7
+
8
+ libraries(
9
+ limit: Int!
10
+ ): [Library!]!
11
+ }
12
+
13
+ type Author {
14
+ name: String!
15
+ }
16
+
17
+ type Library {
18
+ name: String!
19
+ }