@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,383 @@
1
+ [
2
+ {
3
+ "title": "author",
4
+ "description": "",
5
+ "canonical": "queries/author",
6
+ "category": "graphql",
7
+ "type": "graphql_query",
8
+ "context": {
9
+ "graphqlTypeShort": "query",
10
+ "graphqlName": "author",
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 author($id: ID!) {\n author(id: $id) {\n # author fields\n }\n}"
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ]
35
+ },
36
+ "definitions": [
37
+ {
38
+ "title": "Arguments",
39
+ "properties": [
40
+ {
41
+ "name": "id",
42
+ "type": "ID!",
43
+ "description": "",
44
+ "context": {
45
+ "graphqlName": "id",
46
+ "graphqlTypeFlat": "ID",
47
+ "graphqlBuiltInType": true
48
+ },
49
+ "properties": [],
50
+ "meta": [
51
+ {
52
+ "name": "required",
53
+ "value": "true"
54
+ }
55
+ ],
56
+ "symbolDef": {
57
+ "canonical": "/id"
58
+ }
59
+ },
60
+ {
61
+ "name": "details",
62
+ "type": "AuthorDetailsInput",
63
+ "description": "",
64
+ "context": {
65
+ "graphqlTypeShort": "input",
66
+ "graphqlName": "AuthorDetailsInput",
67
+ "group": [
68
+ "Inputs"
69
+ ],
70
+ "scopes": []
71
+ },
72
+ "properties": [],
73
+ "meta": [],
74
+ "symbolDef": {
75
+ "canonical": "inputs/AuthorDetailsInput"
76
+ }
77
+ }
78
+ ]
79
+ },
80
+ {
81
+ "title": "Returns",
82
+ "properties": [
83
+ {
84
+ "name": "",
85
+ "type": "Author",
86
+ "description": "",
87
+ "context": {
88
+ "graphqlName": "author",
89
+ "graphqlTypeFlat": "Author",
90
+ "graphqlBuiltInType": false
91
+ },
92
+ "properties": [],
93
+ "meta": [],
94
+ "symbolDef": {
95
+ "canonical": "objects/Author"
96
+ }
97
+ }
98
+ ]
99
+ }
100
+ ]
101
+ },
102
+ {
103
+ "title": "authorDelete",
104
+ "description": "",
105
+ "canonical": "queries/authorDelete",
106
+ "category": "graphql",
107
+ "type": "graphql_query",
108
+ "context": {
109
+ "graphqlTypeShort": "query",
110
+ "graphqlName": "authorDelete",
111
+ "group": [
112
+ "Queries"
113
+ ],
114
+ "scopes": []
115
+ },
116
+ "examples": {
117
+ "groups": [
118
+ {
119
+ "description": "",
120
+ "examples": [
121
+ {
122
+ "codeblock": {
123
+ "tabs": [
124
+ {
125
+ "title": "",
126
+ "language": "graphql",
127
+ "code": "query authorDelete($id: ID!) {\n authorDelete(id: $id) {\n # authorDelete fields\n }\n}"
128
+ }
129
+ ]
130
+ }
131
+ }
132
+ ]
133
+ }
134
+ ]
135
+ },
136
+ "definitions": [
137
+ {
138
+ "title": "Arguments",
139
+ "properties": [
140
+ {
141
+ "name": "id",
142
+ "type": "ID!",
143
+ "description": "",
144
+ "context": {
145
+ "graphqlName": "id",
146
+ "graphqlTypeFlat": "ID",
147
+ "graphqlBuiltInType": true
148
+ },
149
+ "properties": [],
150
+ "meta": [
151
+ {
152
+ "name": "required",
153
+ "value": "true"
154
+ }
155
+ ],
156
+ "symbolDef": {
157
+ "canonical": "/id"
158
+ }
159
+ }
160
+ ]
161
+ },
162
+ {
163
+ "title": "Returns",
164
+ "properties": [
165
+ {
166
+ "name": "",
167
+ "type": "Boolean",
168
+ "description": "",
169
+ "context": {
170
+ "graphqlName": "authorDelete",
171
+ "graphqlTypeFlat": "Boolean",
172
+ "graphqlBuiltInType": true
173
+ },
174
+ "properties": [],
175
+ "meta": [],
176
+ "symbolDef": {
177
+ "canonical": "/authorDelete"
178
+ }
179
+ }
180
+ ]
181
+ }
182
+ ]
183
+ },
184
+ {
185
+ "title": "Author",
186
+ "description": "",
187
+ "canonical": "objects/Author",
188
+ "category": "graphql",
189
+ "type": "graphql_object",
190
+ "context": {
191
+ "graphqlTypeShort": "object",
192
+ "graphqlName": "Author",
193
+ "group": [
194
+ "Objects"
195
+ ],
196
+ "scopes": []
197
+ },
198
+ "examples": {
199
+ "groups": []
200
+ },
201
+ "definitions": [
202
+ {
203
+ "title": "Arguments",
204
+ "properties": [],
205
+ "variants": [],
206
+ "meta": [
207
+ {
208
+ "name": "type",
209
+ "value": "arguments"
210
+ }
211
+ ]
212
+ },
213
+ {
214
+ "title": "Fields",
215
+ "properties": [
216
+ {
217
+ "name": "id",
218
+ "type": "ID!",
219
+ "description": "",
220
+ "context": {
221
+ "graphqlName": "id",
222
+ "graphqlTypeFlat": "ID",
223
+ "graphqlBuiltInType": true
224
+ },
225
+ "properties": [],
226
+ "meta": [
227
+ {
228
+ "name": "required",
229
+ "value": "true"
230
+ }
231
+ ],
232
+ "symbolDef": {
233
+ "canonical": "/id"
234
+ }
235
+ },
236
+ {
237
+ "name": "name",
238
+ "type": "String!",
239
+ "description": "",
240
+ "context": {
241
+ "graphqlName": "name",
242
+ "graphqlTypeFlat": "String",
243
+ "graphqlBuiltInType": true
244
+ },
245
+ "properties": [],
246
+ "meta": [
247
+ {
248
+ "name": "required",
249
+ "value": "true"
250
+ }
251
+ ],
252
+ "symbolDef": {
253
+ "canonical": "/name"
254
+ }
255
+ },
256
+ {
257
+ "name": "details",
258
+ "type": "AuthorDetails!",
259
+ "description": "",
260
+ "context": {
261
+ "graphqlName": "details",
262
+ "graphqlTypeFlat": "AuthorDetails",
263
+ "graphqlBuiltInType": false
264
+ },
265
+ "properties": [],
266
+ "meta": [
267
+ {
268
+ "name": "required",
269
+ "value": "true"
270
+ }
271
+ ],
272
+ "symbolDef": {
273
+ "canonical": "objects/AuthorDetails"
274
+ }
275
+ }
276
+ ],
277
+ "meta": [
278
+ {
279
+ "name": "type",
280
+ "value": "fields"
281
+ }
282
+ ]
283
+ }
284
+ ]
285
+ },
286
+ {
287
+ "title": "AuthorDetails",
288
+ "description": "",
289
+ "canonical": "objects/AuthorDetails",
290
+ "category": "graphql",
291
+ "type": "graphql_object",
292
+ "context": {
293
+ "graphqlTypeShort": "object",
294
+ "graphqlName": "AuthorDetails",
295
+ "group": [
296
+ "Objects"
297
+ ],
298
+ "scopes": []
299
+ },
300
+ "examples": {
301
+ "groups": []
302
+ },
303
+ "definitions": [
304
+ {
305
+ "title": "Arguments",
306
+ "properties": [],
307
+ "variants": [],
308
+ "meta": [
309
+ {
310
+ "name": "type",
311
+ "value": "arguments"
312
+ }
313
+ ]
314
+ },
315
+ {
316
+ "title": "Fields",
317
+ "properties": [
318
+ {
319
+ "name": "birthDate",
320
+ "type": "String",
321
+ "description": "",
322
+ "context": {
323
+ "graphqlName": "birthDate",
324
+ "graphqlTypeFlat": "String",
325
+ "graphqlBuiltInType": true
326
+ },
327
+ "properties": [],
328
+ "meta": [],
329
+ "symbolDef": {
330
+ "canonical": "/birthDate"
331
+ }
332
+ }
333
+ ],
334
+ "meta": [
335
+ {
336
+ "name": "type",
337
+ "value": "fields"
338
+ }
339
+ ]
340
+ }
341
+ ]
342
+ },
343
+ {
344
+ "title": "AuthorDetailsInput",
345
+ "description": "",
346
+ "canonical": "inputs/AuthorDetailsInput",
347
+ "category": "graphql",
348
+ "type": "graphql_input",
349
+ "context": {
350
+ "graphqlTypeShort": "input",
351
+ "graphqlName": "AuthorDetailsInput",
352
+ "group": [
353
+ "Inputs"
354
+ ],
355
+ "scopes": []
356
+ },
357
+ "examples": {
358
+ "groups": []
359
+ },
360
+ "definitions": [
361
+ {
362
+ "title": "Fields",
363
+ "properties": [
364
+ {
365
+ "name": "birthDate",
366
+ "type": "String",
367
+ "description": "",
368
+ "context": {
369
+ "graphqlName": "birthDate",
370
+ "graphqlTypeFlat": "String",
371
+ "graphqlBuiltInType": true
372
+ },
373
+ "properties": [],
374
+ "meta": [],
375
+ "symbolDef": {
376
+ "canonical": "/birthDate"
377
+ }
378
+ }
379
+ ]
380
+ }
381
+ ]
382
+ }
383
+ ]
@@ -0,0 +1,47 @@
1
+ enum Role {
2
+ USER
3
+ ADMIN
4
+ }
5
+
6
+ type Data {
7
+ id: ID!
8
+ name: String!
9
+ metadata: Metadata!
10
+ }
11
+
12
+ type Metadata {
13
+ active: Boolean!
14
+ tags: [String!]!
15
+ }
16
+
17
+ input DataInput {
18
+ # Scalar types with defaults
19
+ name: String = "default"
20
+ count: Int = 0
21
+ isActive: Boolean = true
22
+ role: Role = USER
23
+
24
+ # Array with default
25
+ tags: [String!] = ["tag1", "tag2"]
26
+
27
+ # Nested input with defaults
28
+ metadata: MetadataInput = { active: true, tags: ["default"] }
29
+ }
30
+
31
+ input MetadataInput {
32
+ active: Boolean = false
33
+ tags: [String!] = ["default"]
34
+ }
35
+
36
+ type Query {
37
+ getData(input: DataInput!): Data
38
+
39
+ getDataList(
40
+ limit: Int! = 10,
41
+
42
+ offset: Int = 0,
43
+
44
+ page: Int
45
+ ): Data
46
+ }
47
+