@xyd-js/gql 0.0.0-build

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 (76) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/LICENSE +21 -0
  3. package/README.md +3 -0
  4. package/TODO.md +8 -0
  5. package/__fixtures__/-1.opendocs.docs-nested/input.graphql +66 -0
  6. package/__fixtures__/-1.opendocs.docs-nested/output.json +554 -0
  7. package/__fixtures__/-1.opendocs.flat/input.graphql +19 -0
  8. package/__fixtures__/-1.opendocs.flat/output.json +243 -0
  9. package/__fixtures__/-1.opendocs.scopes/input.graphql +33 -0
  10. package/__fixtures__/-1.opendocs.scopes/output.json +378 -0
  11. package/__fixtures__/-1.opendocs.sidebar/input.graphql +44 -0
  12. package/__fixtures__/-1.opendocs.sort/input.graphql +92 -0
  13. package/__fixtures__/-1.opendocs.sort/output.json +1078 -0
  14. package/__fixtures__/-1.opendocs.sort+group/input.graphql +111 -0
  15. package/__fixtures__/-1.opendocs.sort+group/output.json +1114 -0
  16. package/__fixtures__/-1.opendocs.sort+group+path/input.graphql +118 -0
  17. package/__fixtures__/-1.opendocs.sort+group+path/output.json +1114 -0
  18. package/__fixtures__/-2.complex.github/input.graphql +69424 -0
  19. package/__fixtures__/-2.complex.github/output.json +269874 -0
  20. package/__fixtures__/-2.complex.livesession/input.graphql +23 -0
  21. package/__fixtures__/-2.complex.livesession/output.json +302 -0
  22. package/__fixtures__/-2.complex.monday/input.graphql +6089 -0
  23. package/__fixtures__/-2.complex.monday/output.json +1 -0
  24. package/__fixtures__/-3.array-non-null-return/input.graphql +9 -0
  25. package/__fixtures__/-3.array-non-null-return/output.json +151 -0
  26. package/__fixtures__/1.basic/input.graphql +118 -0
  27. package/__fixtures__/1.basic/output.json +630 -0
  28. package/__fixtures__/2.circular/input.graphql +17 -0
  29. package/__fixtures__/2.circular/output.json +248 -0
  30. package/__fixtures__/3.opendocs/input.graphql +27 -0
  31. package/__fixtures__/3.opendocs/output.json +338 -0
  32. package/__fixtures__/4.union/input.graphql +19 -0
  33. package/__fixtures__/4.union/output.json +344 -0
  34. package/__fixtures__/5.flat/input.graphql +27 -0
  35. package/__fixtures__/5.flat/output.json +383 -0
  36. package/__fixtures__/6.default-values/input.graphql +47 -0
  37. package/__fixtures__/6.default-values/output.json +655 -0
  38. package/__fixtures__/7.type-args/input.graphql +19 -0
  39. package/__fixtures__/7.type-args/output.json +301 -0
  40. package/__fixtures__/8.default-sort/input.graphql +60 -0
  41. package/__fixtures__/8.default-sort/output.json +1078 -0
  42. package/__tests__/gqlSchemaToReferences.test.ts +109 -0
  43. package/__tests__/utils.ts +45 -0
  44. package/declarations.d.ts +4 -0
  45. package/dist/index.d.ts +21 -0
  46. package/dist/index.js +1503 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/opendocs.graphql +56 -0
  49. package/index.ts +3 -0
  50. package/package.json +29 -0
  51. package/src/context.ts +17 -0
  52. package/src/converters/gql-arg.ts +51 -0
  53. package/src/converters/gql-enum.ts +27 -0
  54. package/src/converters/gql-field.ts +164 -0
  55. package/src/converters/gql-input.ts +34 -0
  56. package/src/converters/gql-interface.ts +35 -0
  57. package/src/converters/gql-mutation.ts +36 -0
  58. package/src/converters/gql-object.ts +83 -0
  59. package/src/converters/gql-operation.ts +128 -0
  60. package/src/converters/gql-query.ts +36 -0
  61. package/src/converters/gql-sample.ts +159 -0
  62. package/src/converters/gql-scalar.ts +16 -0
  63. package/src/converters/gql-subscription.ts +36 -0
  64. package/src/converters/gql-types.ts +195 -0
  65. package/src/converters/gql-union.ts +40 -0
  66. package/src/gql-core.ts +362 -0
  67. package/src/index.ts +3 -0
  68. package/src/opendocs.graphql +56 -0
  69. package/src/opendocs.ts +253 -0
  70. package/src/schema.ts +293 -0
  71. package/src/types.ts +103 -0
  72. package/src/utils.ts +25 -0
  73. package/tsconfig.json +18 -0
  74. package/tsup.config.ts +33 -0
  75. package/tsup.examples-config.ts +30 -0
  76. package/vitest.config.ts +21 -0
@@ -0,0 +1,248 @@
1
+ [
2
+ {
3
+ "title": "getBookByTitle",
4
+ "description": "",
5
+ "canonical": "queries/getBookByTitle",
6
+ "category": "graphql",
7
+ "type": "graphql_query",
8
+ "context": {
9
+ "graphqlTypeShort": "query",
10
+ "graphqlName": "getBookByTitle",
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": "{\n getBookByTitle(title: \"example-title\") {\n # getBookByTitle fields\n }\n}"
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ ]
35
+ },
36
+ "definitions": [
37
+ {
38
+ "title": "Arguments",
39
+ "properties": [
40
+ {
41
+ "name": "title",
42
+ "type": "String!",
43
+ "description": "",
44
+ "context": {
45
+ "graphqlName": "title",
46
+ "graphqlTypeFlat": "String",
47
+ "graphqlBuiltInType": true
48
+ },
49
+ "properties": [],
50
+ "meta": [
51
+ {
52
+ "name": "required",
53
+ "value": "true"
54
+ }
55
+ ],
56
+ "symbolDef": {
57
+ "canonical": ""
58
+ }
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ "title": "Returns",
64
+ "properties": [
65
+ {
66
+ "name": "",
67
+ "type": "Book",
68
+ "description": "",
69
+ "context": {
70
+ "graphqlName": "getBookByTitle",
71
+ "graphqlTypeFlat": "Book",
72
+ "graphqlBuiltInType": false
73
+ },
74
+ "properties": [],
75
+ "meta": [],
76
+ "symbolDef": {
77
+ "canonical": "objects/Book"
78
+ }
79
+ }
80
+ ]
81
+ }
82
+ ]
83
+ },
84
+ {
85
+ "title": "Author",
86
+ "description": "",
87
+ "canonical": "objects/Author",
88
+ "category": "graphql",
89
+ "type": "graphql_object",
90
+ "context": {
91
+ "graphqlTypeShort": "object",
92
+ "graphqlName": "Author",
93
+ "group": [
94
+ "Objects"
95
+ ],
96
+ "scopes": []
97
+ },
98
+ "examples": {
99
+ "groups": []
100
+ },
101
+ "definitions": [
102
+ {
103
+ "title": "Arguments",
104
+ "properties": [],
105
+ "variants": [],
106
+ "meta": [
107
+ {
108
+ "name": "type",
109
+ "value": "arguments"
110
+ }
111
+ ]
112
+ },
113
+ {
114
+ "title": "Fields",
115
+ "properties": [
116
+ {
117
+ "name": "title",
118
+ "type": "String!",
119
+ "description": "",
120
+ "context": {
121
+ "graphqlName": "title",
122
+ "graphqlTypeFlat": "String",
123
+ "graphqlBuiltInType": true
124
+ },
125
+ "properties": [],
126
+ "meta": [
127
+ {
128
+ "name": "required",
129
+ "value": "true"
130
+ }
131
+ ],
132
+ "symbolDef": {
133
+ "canonical": ""
134
+ }
135
+ },
136
+ {
137
+ "name": "books",
138
+ "type": "[Book!]!",
139
+ "description": "",
140
+ "context": {
141
+ "graphqlName": "books",
142
+ "graphqlTypeFlat": "Book",
143
+ "graphqlBuiltInType": false
144
+ },
145
+ "properties": [],
146
+ "meta": [
147
+ {
148
+ "name": "required",
149
+ "value": "true"
150
+ }
151
+ ],
152
+ "symbolDef": {
153
+ "canonical": "objects/Book"
154
+ }
155
+ }
156
+ ],
157
+ "meta": [
158
+ {
159
+ "name": "type",
160
+ "value": "fields"
161
+ }
162
+ ]
163
+ }
164
+ ]
165
+ },
166
+ {
167
+ "title": "Book",
168
+ "description": "",
169
+ "canonical": "objects/Book",
170
+ "category": "graphql",
171
+ "type": "graphql_object",
172
+ "context": {
173
+ "graphqlTypeShort": "object",
174
+ "graphqlName": "Book",
175
+ "group": [
176
+ "Objects"
177
+ ],
178
+ "scopes": []
179
+ },
180
+ "examples": {
181
+ "groups": []
182
+ },
183
+ "definitions": [
184
+ {
185
+ "title": "Arguments",
186
+ "properties": [],
187
+ "variants": [],
188
+ "meta": [
189
+ {
190
+ "name": "type",
191
+ "value": "arguments"
192
+ }
193
+ ]
194
+ },
195
+ {
196
+ "title": "Fields",
197
+ "properties": [
198
+ {
199
+ "name": "title",
200
+ "type": "String!",
201
+ "description": "",
202
+ "context": {
203
+ "graphqlName": "title",
204
+ "graphqlTypeFlat": "String",
205
+ "graphqlBuiltInType": true
206
+ },
207
+ "properties": [],
208
+ "meta": [
209
+ {
210
+ "name": "required",
211
+ "value": "true"
212
+ }
213
+ ],
214
+ "symbolDef": {
215
+ "canonical": ""
216
+ }
217
+ },
218
+ {
219
+ "name": "author",
220
+ "type": "Author!",
221
+ "description": "",
222
+ "context": {
223
+ "graphqlName": "author",
224
+ "graphqlTypeFlat": "Author",
225
+ "graphqlBuiltInType": false
226
+ },
227
+ "properties": [],
228
+ "meta": [
229
+ {
230
+ "name": "required",
231
+ "value": "true"
232
+ }
233
+ ],
234
+ "symbolDef": {
235
+ "canonical": "objects/Author"
236
+ }
237
+ }
238
+ ],
239
+ "meta": [
240
+ {
241
+ "name": "type",
242
+ "value": "fields"
243
+ }
244
+ ]
245
+ }
246
+ ]
247
+ }
248
+ ]
@@ -0,0 +1,27 @@
1
+ type Checkout @doc(
2
+ group: ["Checkout"],
3
+ ) {
4
+ id: ID!
5
+
6
+ checkoutId: String!
7
+ @deprecated(reason: "Use `id` instead.")
8
+ }
9
+
10
+ type CheckoutLine @doc(
11
+ group: ["Checkout"],
12
+ ) {
13
+ id: ID!
14
+
15
+ checkoutLineId: String!
16
+ @deprecated
17
+ }
18
+
19
+ type Query {
20
+ checkout(
21
+ id: ID!
22
+ ): Checkout
23
+
24
+ checkoutLine(
25
+ id: ID!
26
+ ): CheckoutLine
27
+ }
@@ -0,0 +1,338 @@
1
+ [
2
+ {
3
+ "title": "checkout",
4
+ "description": "",
5
+ "canonical": "queries/checkout",
6
+ "category": "graphql",
7
+ "type": "graphql_query",
8
+ "context": {
9
+ "graphqlTypeShort": "query",
10
+ "graphqlName": "checkout",
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 checkout($id: ID!) {\n checkout(id: $id) {\n # checkout 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": ""
58
+ }
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ "title": "Returns",
64
+ "properties": [
65
+ {
66
+ "name": "",
67
+ "type": "Checkout",
68
+ "description": "",
69
+ "context": {
70
+ "graphqlName": "checkout",
71
+ "graphqlTypeFlat": "Checkout",
72
+ "graphqlBuiltInType": false
73
+ },
74
+ "properties": [],
75
+ "meta": [],
76
+ "symbolDef": {
77
+ "canonical": "objects/Checkout"
78
+ }
79
+ }
80
+ ]
81
+ }
82
+ ]
83
+ },
84
+ {
85
+ "title": "checkoutLine",
86
+ "description": "",
87
+ "canonical": "queries/checkoutLine",
88
+ "category": "graphql",
89
+ "type": "graphql_query",
90
+ "context": {
91
+ "graphqlTypeShort": "query",
92
+ "graphqlName": "checkoutLine",
93
+ "group": [
94
+ "Queries"
95
+ ],
96
+ "scopes": []
97
+ },
98
+ "examples": {
99
+ "groups": [
100
+ {
101
+ "description": "",
102
+ "examples": [
103
+ {
104
+ "codeblock": {
105
+ "tabs": [
106
+ {
107
+ "title": "",
108
+ "language": "graphql",
109
+ "code": "query checkoutLine($id: ID!) {\n checkoutLine(id: $id) {\n # checkoutLine fields\n }\n}"
110
+ }
111
+ ]
112
+ }
113
+ }
114
+ ]
115
+ }
116
+ ]
117
+ },
118
+ "definitions": [
119
+ {
120
+ "title": "Arguments",
121
+ "properties": [
122
+ {
123
+ "name": "id",
124
+ "type": "ID!",
125
+ "description": "",
126
+ "context": {
127
+ "graphqlName": "id",
128
+ "graphqlTypeFlat": "ID",
129
+ "graphqlBuiltInType": true
130
+ },
131
+ "properties": [],
132
+ "meta": [
133
+ {
134
+ "name": "required",
135
+ "value": "true"
136
+ }
137
+ ],
138
+ "symbolDef": {
139
+ "canonical": ""
140
+ }
141
+ }
142
+ ]
143
+ },
144
+ {
145
+ "title": "Returns",
146
+ "properties": [
147
+ {
148
+ "name": "",
149
+ "type": "CheckoutLine",
150
+ "description": "",
151
+ "context": {
152
+ "graphqlName": "checkoutLine",
153
+ "graphqlTypeFlat": "CheckoutLine",
154
+ "graphqlBuiltInType": false
155
+ },
156
+ "properties": [],
157
+ "meta": [],
158
+ "symbolDef": {
159
+ "canonical": "objects/CheckoutLine"
160
+ }
161
+ }
162
+ ]
163
+ }
164
+ ]
165
+ },
166
+ {
167
+ "title": "Checkout",
168
+ "description": "",
169
+ "canonical": "objects/Checkout",
170
+ "category": "graphql",
171
+ "type": "graphql_object",
172
+ "context": {
173
+ "graphqlTypeShort": "object",
174
+ "graphqlName": "Checkout",
175
+ "group": [
176
+ "Checkout"
177
+ ],
178
+ "scopes": []
179
+ },
180
+ "examples": {
181
+ "groups": []
182
+ },
183
+ "definitions": [
184
+ {
185
+ "title": "Arguments",
186
+ "properties": [],
187
+ "variants": [],
188
+ "meta": [
189
+ {
190
+ "name": "type",
191
+ "value": "arguments"
192
+ }
193
+ ]
194
+ },
195
+ {
196
+ "title": "Fields",
197
+ "properties": [
198
+ {
199
+ "name": "id",
200
+ "type": "ID!",
201
+ "description": "",
202
+ "context": {
203
+ "graphqlName": "id",
204
+ "graphqlTypeFlat": "ID",
205
+ "graphqlBuiltInType": true
206
+ },
207
+ "properties": [],
208
+ "meta": [
209
+ {
210
+ "name": "required",
211
+ "value": "true"
212
+ }
213
+ ],
214
+ "symbolDef": {
215
+ "canonical": ""
216
+ }
217
+ },
218
+ {
219
+ "name": "checkoutId",
220
+ "type": "String!",
221
+ "description": "",
222
+ "context": {
223
+ "graphqlName": "checkoutId",
224
+ "graphqlTypeFlat": "String",
225
+ "graphqlBuiltInType": true
226
+ },
227
+ "properties": [],
228
+ "meta": [
229
+ {
230
+ "name": "required",
231
+ "value": "true"
232
+ },
233
+ {
234
+ "name": "deprecated",
235
+ "value": "Use `id` instead."
236
+ }
237
+ ],
238
+ "symbolDef": {
239
+ "canonical": ""
240
+ }
241
+ }
242
+ ],
243
+ "meta": [
244
+ {
245
+ "name": "type",
246
+ "value": "fields"
247
+ }
248
+ ]
249
+ }
250
+ ]
251
+ },
252
+ {
253
+ "title": "CheckoutLine",
254
+ "description": "",
255
+ "canonical": "objects/CheckoutLine",
256
+ "category": "graphql",
257
+ "type": "graphql_object",
258
+ "context": {
259
+ "graphqlTypeShort": "object",
260
+ "graphqlName": "CheckoutLine",
261
+ "group": [
262
+ "Checkout"
263
+ ],
264
+ "scopes": []
265
+ },
266
+ "examples": {
267
+ "groups": []
268
+ },
269
+ "definitions": [
270
+ {
271
+ "title": "Arguments",
272
+ "properties": [],
273
+ "variants": [],
274
+ "meta": [
275
+ {
276
+ "name": "type",
277
+ "value": "arguments"
278
+ }
279
+ ]
280
+ },
281
+ {
282
+ "title": "Fields",
283
+ "properties": [
284
+ {
285
+ "name": "id",
286
+ "type": "ID!",
287
+ "description": "",
288
+ "context": {
289
+ "graphqlName": "id",
290
+ "graphqlTypeFlat": "ID",
291
+ "graphqlBuiltInType": true
292
+ },
293
+ "properties": [],
294
+ "meta": [
295
+ {
296
+ "name": "required",
297
+ "value": "true"
298
+ }
299
+ ],
300
+ "symbolDef": {
301
+ "canonical": ""
302
+ }
303
+ },
304
+ {
305
+ "name": "checkoutLineId",
306
+ "type": "String!",
307
+ "description": "",
308
+ "context": {
309
+ "graphqlName": "checkoutLineId",
310
+ "graphqlTypeFlat": "String",
311
+ "graphqlBuiltInType": true
312
+ },
313
+ "properties": [],
314
+ "meta": [
315
+ {
316
+ "name": "required",
317
+ "value": "true"
318
+ },
319
+ {
320
+ "name": "deprecated",
321
+ "value": "true"
322
+ }
323
+ ],
324
+ "symbolDef": {
325
+ "canonical": ""
326
+ }
327
+ }
328
+ ],
329
+ "meta": [
330
+ {
331
+ "name": "type",
332
+ "value": "fields"
333
+ }
334
+ ]
335
+ }
336
+ ]
337
+ }
338
+ ]
@@ -0,0 +1,19 @@
1
+ type Discount {
2
+ id: ID!
3
+ }
4
+
5
+ type Coupon {
6
+ id: ID!
7
+ }
8
+
9
+ type Refund {
10
+ id: ID!
11
+ }
12
+
13
+ union Offer = Discount | Coupon | Refund
14
+
15
+ type Order {
16
+ id: ID!
17
+
18
+ offer: Offer
19
+ }