@xyd-js/gql 0.1.0-xyd.6 → 0.1.0-xyd.66
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 +561 -0
- package/LICENSE +21 -0
- package/TODO.md +8 -0
- package/__fixtures__/-1.opendocs.docs-nested/input.graphql +66 -0
- package/__fixtures__/-1.opendocs.docs-nested/output.json +554 -0
- package/__fixtures__/-1.opendocs.flat/input.graphql +19 -0
- package/__fixtures__/-1.opendocs.flat/output.json +243 -0
- package/__fixtures__/-1.opendocs.scopes/input.graphql +33 -0
- package/__fixtures__/-1.opendocs.scopes/output.json +378 -0
- package/__fixtures__/-1.opendocs.sidebar/input.graphql +44 -0
- package/__fixtures__/-1.opendocs.sort/input.graphql +92 -0
- package/__fixtures__/-1.opendocs.sort/output.json +1078 -0
- package/__fixtures__/-1.opendocs.sort+group/input.graphql +111 -0
- package/__fixtures__/-1.opendocs.sort+group/output.json +1114 -0
- package/__fixtures__/-1.opendocs.sort+group+path/input.graphql +118 -0
- package/__fixtures__/-1.opendocs.sort+group+path/output.json +1114 -0
- package/__fixtures__/-2.complex.github/input.graphql +69424 -0
- package/__fixtures__/-2.complex.github/output.json +269874 -0
- package/__fixtures__/-2.complex.livesession/input.graphql +23 -0
- package/__fixtures__/-2.complex.livesession/output.json +302 -0
- package/__fixtures__/-2.complex.monday/input.graphql +6089 -0
- package/__fixtures__/-2.complex.monday/output.json +1 -0
- package/__fixtures__/-3.array-non-null-return/input.graphql +9 -0
- package/__fixtures__/-3.array-non-null-return/output.json +151 -0
- package/__fixtures__/1.basic/input.graphql +118 -0
- package/__fixtures__/1.basic/output.json +630 -0
- package/__fixtures__/2.circular/input.graphql +17 -0
- package/__fixtures__/2.circular/output.json +248 -0
- package/__fixtures__/3.opendocs/input.graphql +27 -0
- package/__fixtures__/3.opendocs/output.json +338 -0
- package/__fixtures__/4.union/input.graphql +19 -0
- package/__fixtures__/4.union/output.json +344 -0
- package/__fixtures__/5.flat/input.graphql +27 -0
- package/__fixtures__/5.flat/output.json +383 -0
- package/__fixtures__/6.default-values/input.graphql +47 -0
- package/__fixtures__/6.default-values/output.json +655 -0
- package/__fixtures__/7.type-args/input.graphql +19 -0
- package/__fixtures__/7.type-args/output.json +301 -0
- package/__fixtures__/8.default-sort/input.graphql +60 -0
- package/__fixtures__/8.default-sort/output.json +1078 -0
- package/__tests__/gqlSchemaToReferences.test.ts +109 -0
- package/__tests__/utils.ts +45 -0
- package/declarations.d.ts +4 -0
- package/dist/index.d.ts +17 -1
- package/dist/index.js +1334 -19871
- package/dist/index.js.map +1 -1
- package/dist/opendocs.graphql +56 -0
- package/package.json +7 -9
- package/src/context.ts +17 -0
- package/src/converters/gql-arg.ts +51 -0
- package/src/converters/gql-enum.ts +27 -0
- package/src/converters/gql-field.ts +164 -0
- package/src/converters/gql-input.ts +34 -0
- package/src/converters/gql-interface.ts +35 -0
- package/src/converters/gql-mutation.ts +36 -0
- package/src/converters/gql-object.ts +83 -0
- package/src/converters/gql-operation.ts +128 -0
- package/src/converters/gql-query.ts +36 -0
- package/src/converters/gql-sample.ts +159 -0
- package/src/converters/gql-scalar.ts +16 -0
- package/src/converters/gql-subscription.ts +36 -0
- package/src/converters/gql-types.ts +195 -0
- package/src/converters/gql-union.ts +40 -0
- package/src/gql-core.ts +362 -0
- package/src/opendocs.graphql +56 -0
- package/src/opendocs.ts +253 -0
- package/src/schema.ts +253 -67
- package/src/types.ts +103 -0
- package/src/utils.ts +21 -96
- package/tsconfig.json +1 -1
- package/tsup.config.ts +15 -1
- package/vitest.config.ts +15 -1
- package/examples/basic/index.ts +0 -12
- package/examples/basic/schema.graphqls +0 -89
- package/examples/basic/todo-app.graphqls +0 -184
- package/examples/graphql-types/graphql-types.0.basic.graphqls +0 -28
- package/examples/nested/nested-arg.0.not-required.graphqls +0 -8
- package/examples/nested/nested-arg.0.required.graphqls +0 -8
- package/examples/nested/nested-arg.1.deep.graphqls +0 -12
- package/src/hydration/README.md +0 -1
- package/src/hydration/gql-arg.ts +0 -53
- package/src/hydration/gql-field.ts +0 -206
- package/src/hydration/gql-input.ts +0 -67
- package/src/hydration/gql-object.ts +0 -35
- package/src/hydration/gql-types.ts +0 -50
- package/src/samples/index.ts +0 -95
- package/test/graphql-types.0.test.ts +0 -125
- package/test/nested-arg.0.test.ts +0 -208
- package/test/nested-arg.1.test.ts +0 -19
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"title": "Book",
|
|
4
|
+
"description": "",
|
|
5
|
+
"canonical": "objects/Book",
|
|
6
|
+
"category": "graphql",
|
|
7
|
+
"type": "graphql_object",
|
|
8
|
+
"context": {
|
|
9
|
+
"graphqlTypeShort": "object",
|
|
10
|
+
"graphqlName": "Book",
|
|
11
|
+
"group": [
|
|
12
|
+
"Objects"
|
|
13
|
+
],
|
|
14
|
+
"scopes": []
|
|
15
|
+
},
|
|
16
|
+
"examples": {
|
|
17
|
+
"groups": []
|
|
18
|
+
},
|
|
19
|
+
"definitions": [
|
|
20
|
+
{
|
|
21
|
+
"title": "Arguments",
|
|
22
|
+
"properties": [],
|
|
23
|
+
"variants": [
|
|
24
|
+
{
|
|
25
|
+
"title": "",
|
|
26
|
+
"properties": [
|
|
27
|
+
{
|
|
28
|
+
"name": "first",
|
|
29
|
+
"type": "Int",
|
|
30
|
+
"description": "",
|
|
31
|
+
"context": {
|
|
32
|
+
"graphqlName": "first",
|
|
33
|
+
"graphqlTypeFlat": "Int",
|
|
34
|
+
"graphqlBuiltInType": true
|
|
35
|
+
},
|
|
36
|
+
"properties": [],
|
|
37
|
+
"meta": [],
|
|
38
|
+
"symbolDef": {
|
|
39
|
+
"canonical": "/first"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "after",
|
|
44
|
+
"type": "String",
|
|
45
|
+
"description": "",
|
|
46
|
+
"context": {
|
|
47
|
+
"graphqlName": "after",
|
|
48
|
+
"graphqlTypeFlat": "String",
|
|
49
|
+
"graphqlBuiltInType": true
|
|
50
|
+
},
|
|
51
|
+
"properties": [],
|
|
52
|
+
"meta": [],
|
|
53
|
+
"symbolDef": {
|
|
54
|
+
"canonical": "/after"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "limit",
|
|
59
|
+
"type": "Int!",
|
|
60
|
+
"description": "",
|
|
61
|
+
"context": {
|
|
62
|
+
"graphqlName": "limit",
|
|
63
|
+
"graphqlTypeFlat": "Int",
|
|
64
|
+
"graphqlBuiltInType": true
|
|
65
|
+
},
|
|
66
|
+
"properties": [],
|
|
67
|
+
"meta": [
|
|
68
|
+
{
|
|
69
|
+
"name": "required",
|
|
70
|
+
"value": "true"
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"symbolDef": {
|
|
74
|
+
"canonical": "/limit"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"meta": [
|
|
79
|
+
{
|
|
80
|
+
"name": "symbolName",
|
|
81
|
+
"value": "authors"
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"title": "",
|
|
87
|
+
"properties": [
|
|
88
|
+
{
|
|
89
|
+
"name": "limit",
|
|
90
|
+
"type": "Int!",
|
|
91
|
+
"description": "",
|
|
92
|
+
"context": {
|
|
93
|
+
"graphqlName": "limit",
|
|
94
|
+
"graphqlTypeFlat": "Int",
|
|
95
|
+
"graphqlBuiltInType": true
|
|
96
|
+
},
|
|
97
|
+
"properties": [],
|
|
98
|
+
"meta": [
|
|
99
|
+
{
|
|
100
|
+
"name": "required",
|
|
101
|
+
"value": "true"
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"symbolDef": {
|
|
105
|
+
"canonical": "/limit"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"meta": [
|
|
110
|
+
{
|
|
111
|
+
"name": "symbolName",
|
|
112
|
+
"value": "libraries"
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
"meta": [
|
|
118
|
+
{
|
|
119
|
+
"name": "type",
|
|
120
|
+
"value": "arguments"
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"title": "Fields",
|
|
126
|
+
"properties": [
|
|
127
|
+
{
|
|
128
|
+
"name": "authors",
|
|
129
|
+
"type": "[Author!]!",
|
|
130
|
+
"description": "",
|
|
131
|
+
"context": {
|
|
132
|
+
"graphqlName": "authors",
|
|
133
|
+
"graphqlTypeFlat": "Author",
|
|
134
|
+
"graphqlBuiltInType": false
|
|
135
|
+
},
|
|
136
|
+
"properties": [],
|
|
137
|
+
"meta": [
|
|
138
|
+
{
|
|
139
|
+
"name": "required",
|
|
140
|
+
"value": "true"
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
"symbolDef": {
|
|
144
|
+
"canonical": "objects/Author"
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"name": "libraries",
|
|
149
|
+
"type": "[Library!]!",
|
|
150
|
+
"description": "",
|
|
151
|
+
"context": {
|
|
152
|
+
"graphqlName": "libraries",
|
|
153
|
+
"graphqlTypeFlat": "Library",
|
|
154
|
+
"graphqlBuiltInType": false
|
|
155
|
+
},
|
|
156
|
+
"properties": [],
|
|
157
|
+
"meta": [
|
|
158
|
+
{
|
|
159
|
+
"name": "required",
|
|
160
|
+
"value": "true"
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
"symbolDef": {
|
|
164
|
+
"canonical": "objects/Library"
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
"meta": [
|
|
169
|
+
{
|
|
170
|
+
"name": "type",
|
|
171
|
+
"value": "fields"
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"title": "Author",
|
|
179
|
+
"description": "",
|
|
180
|
+
"canonical": "objects/Author",
|
|
181
|
+
"category": "graphql",
|
|
182
|
+
"type": "graphql_object",
|
|
183
|
+
"context": {
|
|
184
|
+
"graphqlTypeShort": "object",
|
|
185
|
+
"graphqlName": "Author",
|
|
186
|
+
"group": [
|
|
187
|
+
"Objects"
|
|
188
|
+
],
|
|
189
|
+
"scopes": []
|
|
190
|
+
},
|
|
191
|
+
"examples": {
|
|
192
|
+
"groups": []
|
|
193
|
+
},
|
|
194
|
+
"definitions": [
|
|
195
|
+
{
|
|
196
|
+
"title": "Arguments",
|
|
197
|
+
"properties": [],
|
|
198
|
+
"variants": [],
|
|
199
|
+
"meta": [
|
|
200
|
+
{
|
|
201
|
+
"name": "type",
|
|
202
|
+
"value": "arguments"
|
|
203
|
+
}
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"title": "Fields",
|
|
208
|
+
"properties": [
|
|
209
|
+
{
|
|
210
|
+
"name": "name",
|
|
211
|
+
"type": "String!",
|
|
212
|
+
"description": "",
|
|
213
|
+
"context": {
|
|
214
|
+
"graphqlName": "name",
|
|
215
|
+
"graphqlTypeFlat": "String",
|
|
216
|
+
"graphqlBuiltInType": true
|
|
217
|
+
},
|
|
218
|
+
"properties": [],
|
|
219
|
+
"meta": [
|
|
220
|
+
{
|
|
221
|
+
"name": "required",
|
|
222
|
+
"value": "true"
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
"symbolDef": {
|
|
226
|
+
"canonical": "/name"
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
],
|
|
230
|
+
"meta": [
|
|
231
|
+
{
|
|
232
|
+
"name": "type",
|
|
233
|
+
"value": "fields"
|
|
234
|
+
}
|
|
235
|
+
]
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"title": "Library",
|
|
241
|
+
"description": "",
|
|
242
|
+
"canonical": "objects/Library",
|
|
243
|
+
"category": "graphql",
|
|
244
|
+
"type": "graphql_object",
|
|
245
|
+
"context": {
|
|
246
|
+
"graphqlTypeShort": "object",
|
|
247
|
+
"graphqlName": "Library",
|
|
248
|
+
"group": [
|
|
249
|
+
"Objects"
|
|
250
|
+
],
|
|
251
|
+
"scopes": []
|
|
252
|
+
},
|
|
253
|
+
"examples": {
|
|
254
|
+
"groups": []
|
|
255
|
+
},
|
|
256
|
+
"definitions": [
|
|
257
|
+
{
|
|
258
|
+
"title": "Arguments",
|
|
259
|
+
"properties": [],
|
|
260
|
+
"variants": [],
|
|
261
|
+
"meta": [
|
|
262
|
+
{
|
|
263
|
+
"name": "type",
|
|
264
|
+
"value": "arguments"
|
|
265
|
+
}
|
|
266
|
+
]
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"title": "Fields",
|
|
270
|
+
"properties": [
|
|
271
|
+
{
|
|
272
|
+
"name": "name",
|
|
273
|
+
"type": "String!",
|
|
274
|
+
"description": "",
|
|
275
|
+
"context": {
|
|
276
|
+
"graphqlName": "name",
|
|
277
|
+
"graphqlTypeFlat": "String",
|
|
278
|
+
"graphqlBuiltInType": true
|
|
279
|
+
},
|
|
280
|
+
"properties": [],
|
|
281
|
+
"meta": [
|
|
282
|
+
{
|
|
283
|
+
"name": "required",
|
|
284
|
+
"value": "true"
|
|
285
|
+
}
|
|
286
|
+
],
|
|
287
|
+
"symbolDef": {
|
|
288
|
+
"canonical": "/name"
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
],
|
|
292
|
+
"meta": [
|
|
293
|
+
{
|
|
294
|
+
"name": "type",
|
|
295
|
+
"value": "fields"
|
|
296
|
+
}
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
]
|
|
300
|
+
}
|
|
301
|
+
]
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Custom scalar
|
|
2
|
+
scalar DateTime
|
|
3
|
+
|
|
4
|
+
# Enum
|
|
5
|
+
enum UserRole {
|
|
6
|
+
ADMIN
|
|
7
|
+
USER
|
|
8
|
+
GUEST
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
# Interface
|
|
12
|
+
interface Node {
|
|
13
|
+
id: ID!
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
# Input object
|
|
17
|
+
input UserInput {
|
|
18
|
+
name: String!
|
|
19
|
+
email: String!
|
|
20
|
+
role: UserRole
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
# Object
|
|
24
|
+
type User implements Node {
|
|
25
|
+
id: ID!
|
|
26
|
+
name: String!
|
|
27
|
+
email: String!
|
|
28
|
+
role: UserRole!
|
|
29
|
+
createdAt: DateTime!
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# Union
|
|
33
|
+
union SearchResult = User | Post
|
|
34
|
+
|
|
35
|
+
type Post implements Node {
|
|
36
|
+
id: ID!
|
|
37
|
+
title: String!
|
|
38
|
+
content: String!
|
|
39
|
+
author: User!
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# Query
|
|
43
|
+
type Query {
|
|
44
|
+
user(id: ID!): User
|
|
45
|
+
users: [User!]!
|
|
46
|
+
search(query: String!): [SearchResult!]!
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
# Mutation
|
|
50
|
+
type Mutation {
|
|
51
|
+
createUser(input: UserInput!): User!
|
|
52
|
+
updateUser(id: ID!, input: UserInput!): User!
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
# Subscription
|
|
56
|
+
type Subscription {
|
|
57
|
+
userCreated: User!
|
|
58
|
+
userUpdated: User!
|
|
59
|
+
}
|
|
60
|
+
|