@xyd-js/gql 0.1.0-xyd.0 → 0.1.0-xyd.2
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/dist/index.d.ts +5 -0
- package/dist/index.js +504 -0
- package/dist/index.js.map +1 -0
- package/package.json +6 -4
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
+
mod
|
|
25
|
+
));
|
|
26
|
+
|
|
27
|
+
// node_modules/graphql/language/ast.js
|
|
28
|
+
var require_ast = __commonJS({
|
|
29
|
+
"node_modules/graphql/language/ast.js"(exports) {
|
|
30
|
+
"use strict";
|
|
31
|
+
Object.defineProperty(exports, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
});
|
|
34
|
+
exports.Token = exports.QueryDocumentKeys = exports.OperationTypeNode = exports.Location = void 0;
|
|
35
|
+
exports.isNode = isNode;
|
|
36
|
+
var Location = class {
|
|
37
|
+
/**
|
|
38
|
+
* The character offset at which this Node begins.
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* The character offset at which this Node ends.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* The Token at which this Node begins.
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* The Token at which this Node ends.
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* The Source document the AST represents.
|
|
51
|
+
*/
|
|
52
|
+
constructor(startToken, endToken, source) {
|
|
53
|
+
this.start = startToken.start;
|
|
54
|
+
this.end = endToken.end;
|
|
55
|
+
this.startToken = startToken;
|
|
56
|
+
this.endToken = endToken;
|
|
57
|
+
this.source = source;
|
|
58
|
+
}
|
|
59
|
+
get [Symbol.toStringTag]() {
|
|
60
|
+
return "Location";
|
|
61
|
+
}
|
|
62
|
+
toJSON() {
|
|
63
|
+
return {
|
|
64
|
+
start: this.start,
|
|
65
|
+
end: this.end
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
exports.Location = Location;
|
|
70
|
+
var Token = class {
|
|
71
|
+
/**
|
|
72
|
+
* The kind of Token.
|
|
73
|
+
*/
|
|
74
|
+
/**
|
|
75
|
+
* The character offset at which this Node begins.
|
|
76
|
+
*/
|
|
77
|
+
/**
|
|
78
|
+
* The character offset at which this Node ends.
|
|
79
|
+
*/
|
|
80
|
+
/**
|
|
81
|
+
* The 1-indexed line number on which this Token appears.
|
|
82
|
+
*/
|
|
83
|
+
/**
|
|
84
|
+
* The 1-indexed column number at which this Token begins.
|
|
85
|
+
*/
|
|
86
|
+
/**
|
|
87
|
+
* For non-punctuation tokens, represents the interpreted value of the token.
|
|
88
|
+
*
|
|
89
|
+
* Note: is undefined for punctuation tokens, but typed as string for
|
|
90
|
+
* convenience in the parser.
|
|
91
|
+
*/
|
|
92
|
+
/**
|
|
93
|
+
* Tokens exist as nodes in a double-linked-list amongst all tokens
|
|
94
|
+
* including ignored tokens. <SOF> is always the first node and <EOF>
|
|
95
|
+
* the last.
|
|
96
|
+
*/
|
|
97
|
+
constructor(kind, start, end, line, column, value) {
|
|
98
|
+
this.kind = kind;
|
|
99
|
+
this.start = start;
|
|
100
|
+
this.end = end;
|
|
101
|
+
this.line = line;
|
|
102
|
+
this.column = column;
|
|
103
|
+
this.value = value;
|
|
104
|
+
this.prev = null;
|
|
105
|
+
this.next = null;
|
|
106
|
+
}
|
|
107
|
+
get [Symbol.toStringTag]() {
|
|
108
|
+
return "Token";
|
|
109
|
+
}
|
|
110
|
+
toJSON() {
|
|
111
|
+
return {
|
|
112
|
+
kind: this.kind,
|
|
113
|
+
value: this.value,
|
|
114
|
+
line: this.line,
|
|
115
|
+
column: this.column
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
exports.Token = Token;
|
|
120
|
+
var QueryDocumentKeys = {
|
|
121
|
+
Name: [],
|
|
122
|
+
Document: ["definitions"],
|
|
123
|
+
OperationDefinition: [
|
|
124
|
+
"name",
|
|
125
|
+
"variableDefinitions",
|
|
126
|
+
"directives",
|
|
127
|
+
"selectionSet"
|
|
128
|
+
],
|
|
129
|
+
VariableDefinition: ["variable", "type", "defaultValue", "directives"],
|
|
130
|
+
Variable: ["name"],
|
|
131
|
+
SelectionSet: ["selections"],
|
|
132
|
+
Field: ["alias", "name", "arguments", "directives", "selectionSet"],
|
|
133
|
+
Argument: ["name", "value"],
|
|
134
|
+
FragmentSpread: ["name", "directives"],
|
|
135
|
+
InlineFragment: ["typeCondition", "directives", "selectionSet"],
|
|
136
|
+
FragmentDefinition: [
|
|
137
|
+
"name",
|
|
138
|
+
// Note: fragment variable definitions are deprecated and will removed in v17.0.0
|
|
139
|
+
"variableDefinitions",
|
|
140
|
+
"typeCondition",
|
|
141
|
+
"directives",
|
|
142
|
+
"selectionSet"
|
|
143
|
+
],
|
|
144
|
+
IntValue: [],
|
|
145
|
+
FloatValue: [],
|
|
146
|
+
StringValue: [],
|
|
147
|
+
BooleanValue: [],
|
|
148
|
+
NullValue: [],
|
|
149
|
+
EnumValue: [],
|
|
150
|
+
ListValue: ["values"],
|
|
151
|
+
ObjectValue: ["fields"],
|
|
152
|
+
ObjectField: ["name", "value"],
|
|
153
|
+
Directive: ["name", "arguments"],
|
|
154
|
+
NamedType: ["name"],
|
|
155
|
+
ListType: ["type"],
|
|
156
|
+
NonNullType: ["type"],
|
|
157
|
+
SchemaDefinition: ["description", "directives", "operationTypes"],
|
|
158
|
+
OperationTypeDefinition: ["type"],
|
|
159
|
+
ScalarTypeDefinition: ["description", "name", "directives"],
|
|
160
|
+
ObjectTypeDefinition: [
|
|
161
|
+
"description",
|
|
162
|
+
"name",
|
|
163
|
+
"interfaces",
|
|
164
|
+
"directives",
|
|
165
|
+
"fields"
|
|
166
|
+
],
|
|
167
|
+
FieldDefinition: ["description", "name", "arguments", "type", "directives"],
|
|
168
|
+
InputValueDefinition: [
|
|
169
|
+
"description",
|
|
170
|
+
"name",
|
|
171
|
+
"type",
|
|
172
|
+
"defaultValue",
|
|
173
|
+
"directives"
|
|
174
|
+
],
|
|
175
|
+
InterfaceTypeDefinition: [
|
|
176
|
+
"description",
|
|
177
|
+
"name",
|
|
178
|
+
"interfaces",
|
|
179
|
+
"directives",
|
|
180
|
+
"fields"
|
|
181
|
+
],
|
|
182
|
+
UnionTypeDefinition: ["description", "name", "directives", "types"],
|
|
183
|
+
EnumTypeDefinition: ["description", "name", "directives", "values"],
|
|
184
|
+
EnumValueDefinition: ["description", "name", "directives"],
|
|
185
|
+
InputObjectTypeDefinition: ["description", "name", "directives", "fields"],
|
|
186
|
+
DirectiveDefinition: ["description", "name", "arguments", "locations"],
|
|
187
|
+
SchemaExtension: ["directives", "operationTypes"],
|
|
188
|
+
ScalarTypeExtension: ["name", "directives"],
|
|
189
|
+
ObjectTypeExtension: ["name", "interfaces", "directives", "fields"],
|
|
190
|
+
InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"],
|
|
191
|
+
UnionTypeExtension: ["name", "directives", "types"],
|
|
192
|
+
EnumTypeExtension: ["name", "directives", "values"],
|
|
193
|
+
InputObjectTypeExtension: ["name", "directives", "fields"]
|
|
194
|
+
};
|
|
195
|
+
exports.QueryDocumentKeys = QueryDocumentKeys;
|
|
196
|
+
var kindValues = new Set(Object.keys(QueryDocumentKeys));
|
|
197
|
+
function isNode(maybeNode) {
|
|
198
|
+
const maybeKind = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind;
|
|
199
|
+
return typeof maybeKind === "string" && kindValues.has(maybeKind);
|
|
200
|
+
}
|
|
201
|
+
var OperationTypeNode2;
|
|
202
|
+
exports.OperationTypeNode = OperationTypeNode2;
|
|
203
|
+
(function(OperationTypeNode3) {
|
|
204
|
+
OperationTypeNode3["QUERY"] = "query";
|
|
205
|
+
OperationTypeNode3["MUTATION"] = "mutation";
|
|
206
|
+
OperationTypeNode3["SUBSCRIPTION"] = "subscription";
|
|
207
|
+
})(OperationTypeNode2 || (exports.OperationTypeNode = OperationTypeNode2 = {}));
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
// src/schema.ts
|
|
212
|
+
var import_ast = __toESM(require_ast(), 1);
|
|
213
|
+
import { getDocumentLoaders, loadSchema } from "@graphql-markdown/graphql";
|
|
214
|
+
import { ReferenceType as ReferenceType3 } from "@xyd-js/uniform";
|
|
215
|
+
|
|
216
|
+
// src/utils.ts
|
|
217
|
+
import {
|
|
218
|
+
ReferenceCategory
|
|
219
|
+
} from "@xyd-js/uniform";
|
|
220
|
+
|
|
221
|
+
// src/fields.ts
|
|
222
|
+
function fieldIntoDefinitionProperty(fieldName, field) {
|
|
223
|
+
let properties;
|
|
224
|
+
if ("ofType" in field.type) {
|
|
225
|
+
switch (field.type.constructor.name) {
|
|
226
|
+
case "GraphQLList": {
|
|
227
|
+
switch (field.type.ofType.constructor.name) {
|
|
228
|
+
case "GraphQLObjectType": {
|
|
229
|
+
const objectType = field.type.ofType;
|
|
230
|
+
properties = nestedProperties(objectType);
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
case "GraphQLInputObjectType": {
|
|
234
|
+
const inputObjectType = field.type.ofType;
|
|
235
|
+
properties = nestedProperties(inputObjectType);
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
case "GraphQLScalarType": {
|
|
239
|
+
properties = definitionPropsFromNestedObj(field) || [];
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
case "GraphQLNonNull": {
|
|
243
|
+
properties = definitionPropsFromNestedObj(field) || [];
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
default: {
|
|
247
|
+
console.error("unsupported ofType list", field.type.ofType.constructor.name);
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
case "GraphQLNonNull": {
|
|
254
|
+
properties = definitionPropsFromNestedObj(field) || [];
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
default: {
|
|
258
|
+
console.error("unsupported ofType", field.type.constructor.name);
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
} else if (field.type.constructor.name === "GraphQLObjectType") {
|
|
263
|
+
const objectType = field.type;
|
|
264
|
+
properties = nestedProperties(objectType);
|
|
265
|
+
} else if (field.type.constructor.name === "GraphQLInputObjectType") {
|
|
266
|
+
const objectType = field.type;
|
|
267
|
+
properties = nestedProperties(objectType);
|
|
268
|
+
}
|
|
269
|
+
return {
|
|
270
|
+
name: fieldName,
|
|
271
|
+
type: field.type.toJSON(),
|
|
272
|
+
description: field.description || "",
|
|
273
|
+
properties
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function definitionPropsFromNestedObj(obj) {
|
|
277
|
+
if (!obj) {
|
|
278
|
+
return null;
|
|
279
|
+
}
|
|
280
|
+
if (obj.getFields) {
|
|
281
|
+
return nestedProperties(obj);
|
|
282
|
+
}
|
|
283
|
+
if (obj.ofType) {
|
|
284
|
+
return definitionPropsFromNestedObj(obj.ofType);
|
|
285
|
+
}
|
|
286
|
+
if (obj.type) {
|
|
287
|
+
return definitionPropsFromNestedObj(obj.type);
|
|
288
|
+
}
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
function deepFieldMap(fieldsMap) {
|
|
292
|
+
const properties = [];
|
|
293
|
+
for (const [name, field] of Object.entries(fieldsMap)) {
|
|
294
|
+
const prop = fieldIntoDefinitionProperty(
|
|
295
|
+
name,
|
|
296
|
+
field
|
|
297
|
+
);
|
|
298
|
+
if (prop) {
|
|
299
|
+
properties.push(prop);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return properties;
|
|
303
|
+
}
|
|
304
|
+
function nestedProperties(objectType) {
|
|
305
|
+
var _a;
|
|
306
|
+
const nestedFields = (_a = objectType == null ? void 0 : objectType.getFields) == null ? void 0 : _a.call(objectType);
|
|
307
|
+
return deepFieldMap(nestedFields);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// src/arguments.ts
|
|
311
|
+
function argumentsIntoDefinitionProperty(args) {
|
|
312
|
+
const resp = [];
|
|
313
|
+
args.forEach((arg) => {
|
|
314
|
+
var _a;
|
|
315
|
+
if (arg.type.constructor.name === "GraphQLInputObjectType") {
|
|
316
|
+
const inputObjectType = arg.type;
|
|
317
|
+
const inputFields = (_a = inputObjectType.getFields) == null ? void 0 : _a.call(inputObjectType);
|
|
318
|
+
const nestedProps = [];
|
|
319
|
+
const nestedDefinitionProperty = {
|
|
320
|
+
name: arg.name,
|
|
321
|
+
type: arg.type.toJSON(),
|
|
322
|
+
description: arg.description || "",
|
|
323
|
+
properties: nestedProps
|
|
324
|
+
};
|
|
325
|
+
for (const [name, inputField] of Object.entries(inputFields)) {
|
|
326
|
+
const prop = fieldIntoDefinitionProperty(
|
|
327
|
+
name,
|
|
328
|
+
inputField
|
|
329
|
+
);
|
|
330
|
+
if (prop) {
|
|
331
|
+
nestedProps.push(prop);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
resp.push(nestedDefinitionProperty);
|
|
335
|
+
} else {
|
|
336
|
+
const prop = {
|
|
337
|
+
name: arg.name,
|
|
338
|
+
type: arg.type.toJSON(),
|
|
339
|
+
description: arg.description || "",
|
|
340
|
+
properties: []
|
|
341
|
+
};
|
|
342
|
+
resp.push(prop);
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
return resp;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// src/examples.ts
|
|
349
|
+
import { jsonToGraphQLQuery, VariableType } from "json-to-graphql-query";
|
|
350
|
+
import {
|
|
351
|
+
ReferenceType
|
|
352
|
+
} from "@xyd-js/uniform";
|
|
353
|
+
function simpleGraphqlExample(operationType, operationName, args, returns) {
|
|
354
|
+
let obj = {};
|
|
355
|
+
switch (operationType) {
|
|
356
|
+
case ReferenceType.GRAPHQL_QUERY: {
|
|
357
|
+
const exampleReturnProps = exampleReturns(returns);
|
|
358
|
+
obj = {
|
|
359
|
+
query: {
|
|
360
|
+
__name: operationName,
|
|
361
|
+
[operationName]: exampleReturnProps
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
case ReferenceType.GRAPHQL_MUTATION: {
|
|
367
|
+
const exampleReturnProps = exampleReturns(returns);
|
|
368
|
+
const vars = exampleVariables(args);
|
|
369
|
+
const argumen = exampleArguments(args);
|
|
370
|
+
obj = {
|
|
371
|
+
mutation: {
|
|
372
|
+
__name: operationName,
|
|
373
|
+
__variables: vars,
|
|
374
|
+
[operationName]: {
|
|
375
|
+
...exampleReturnProps,
|
|
376
|
+
__args: argumen
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return jsonToGraphQLQuery(obj, { pretty: true });
|
|
384
|
+
}
|
|
385
|
+
function exampleReturns(properties, obj = {}) {
|
|
386
|
+
properties.forEach((property) => {
|
|
387
|
+
var _a;
|
|
388
|
+
obj[property.name] = true;
|
|
389
|
+
if ((_a = property == null ? void 0 : property.properties) == null ? void 0 : _a.length) {
|
|
390
|
+
obj[property.name] = {};
|
|
391
|
+
exampleReturns(property.properties, obj[property.name]);
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
return obj;
|
|
395
|
+
}
|
|
396
|
+
function exampleArguments(properties, obj = {}) {
|
|
397
|
+
properties.forEach((property) => {
|
|
398
|
+
obj[property.name] = new VariableType(property.name);
|
|
399
|
+
});
|
|
400
|
+
return obj;
|
|
401
|
+
}
|
|
402
|
+
function exampleVariables(properties, obj = {}) {
|
|
403
|
+
properties.forEach((property) => {
|
|
404
|
+
obj[property.name] = property.type;
|
|
405
|
+
});
|
|
406
|
+
return obj;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// src/utils.ts
|
|
410
|
+
function graphqlOperationReferences(operationType, fieldsMap) {
|
|
411
|
+
const references = [];
|
|
412
|
+
for (const [operationName, operationField] of Object.entries(fieldsMap)) {
|
|
413
|
+
const definitions = [];
|
|
414
|
+
const args = argumentsIntoDefinitionProperty(operationField.args);
|
|
415
|
+
const returns = fieldIntoDefinitionProperty(operationName, operationField);
|
|
416
|
+
const returnProperties = returns.properties || [];
|
|
417
|
+
definitions.push({
|
|
418
|
+
title: "Arguments",
|
|
419
|
+
properties: args
|
|
420
|
+
});
|
|
421
|
+
definitions.push({
|
|
422
|
+
title: "Returns",
|
|
423
|
+
properties: returnProperties
|
|
424
|
+
});
|
|
425
|
+
const exampleQuery = simpleGraphqlExample(
|
|
426
|
+
operationType,
|
|
427
|
+
operationName,
|
|
428
|
+
args,
|
|
429
|
+
returnProperties
|
|
430
|
+
);
|
|
431
|
+
const examples = [
|
|
432
|
+
{
|
|
433
|
+
codeblock: {
|
|
434
|
+
tabs: [
|
|
435
|
+
{
|
|
436
|
+
title: "graphql",
|
|
437
|
+
language: "graphql",
|
|
438
|
+
code: exampleQuery
|
|
439
|
+
}
|
|
440
|
+
]
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
];
|
|
444
|
+
const exampleGroup = {
|
|
445
|
+
description: "Example request",
|
|
446
|
+
examples
|
|
447
|
+
};
|
|
448
|
+
let description = operationField.description || "";
|
|
449
|
+
references.push(graphqlReference(
|
|
450
|
+
operationType,
|
|
451
|
+
operationName,
|
|
452
|
+
operationName,
|
|
453
|
+
description,
|
|
454
|
+
[exampleGroup],
|
|
455
|
+
definitions
|
|
456
|
+
));
|
|
457
|
+
}
|
|
458
|
+
return references;
|
|
459
|
+
}
|
|
460
|
+
function graphqlReference(operationType, title, canonical, description, examples, definitions) {
|
|
461
|
+
return {
|
|
462
|
+
title,
|
|
463
|
+
canonical,
|
|
464
|
+
description,
|
|
465
|
+
category: ReferenceCategory.GRAPHQL,
|
|
466
|
+
type: operationType,
|
|
467
|
+
examples: {
|
|
468
|
+
groups: examples
|
|
469
|
+
},
|
|
470
|
+
definitions
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// src/schema.ts
|
|
475
|
+
async function gqlSchemaToReferences(schemaLocation) {
|
|
476
|
+
var _a, _b;
|
|
477
|
+
const loadersList = {
|
|
478
|
+
["GraphQLFileLoader"]: "@graphql-tools/graphql-file-loader"
|
|
479
|
+
};
|
|
480
|
+
const loaders = await getDocumentLoaders(loadersList);
|
|
481
|
+
const schema = await loadSchema(schemaLocation, loaders);
|
|
482
|
+
const references = [];
|
|
483
|
+
const queries = schema.getRootType(import_ast.OperationTypeNode.QUERY);
|
|
484
|
+
const queryFields = (_a = queries == null ? void 0 : queries.getFields) == null ? void 0 : _a.call(queries);
|
|
485
|
+
if (queryFields) {
|
|
486
|
+
references.push(...graphqlOperationReferences(
|
|
487
|
+
ReferenceType3.GRAPHQL_QUERY,
|
|
488
|
+
queryFields
|
|
489
|
+
));
|
|
490
|
+
}
|
|
491
|
+
const mutations = schema.getRootType(import_ast.OperationTypeNode.MUTATION);
|
|
492
|
+
const mutationFields = (_b = mutations == null ? void 0 : mutations.getFields) == null ? void 0 : _b.call(mutations);
|
|
493
|
+
if (mutationFields) {
|
|
494
|
+
references.push(...graphqlOperationReferences(
|
|
495
|
+
ReferenceType3.GRAPHQL_MUTATION,
|
|
496
|
+
mutationFields
|
|
497
|
+
));
|
|
498
|
+
}
|
|
499
|
+
return references;
|
|
500
|
+
}
|
|
501
|
+
export {
|
|
502
|
+
gqlSchemaToReferences
|
|
503
|
+
};
|
|
504
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../node_modules/graphql/language/ast.js","../src/schema.ts","../src/utils.ts","../src/fields.ts","../src/arguments.ts","../src/examples.ts"],"sourcesContent":["'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true,\n});\nexports.Token =\n exports.QueryDocumentKeys =\n exports.OperationTypeNode =\n exports.Location =\n void 0;\nexports.isNode = isNode;\n\n/**\n * Contains a range of UTF-8 character offsets and token references that\n * identify the region of the source from which the AST derived.\n */\nclass Location {\n /**\n * The character offset at which this Node begins.\n */\n\n /**\n * The character offset at which this Node ends.\n */\n\n /**\n * The Token at which this Node begins.\n */\n\n /**\n * The Token at which this Node ends.\n */\n\n /**\n * The Source document the AST represents.\n */\n constructor(startToken, endToken, source) {\n this.start = startToken.start;\n this.end = endToken.end;\n this.startToken = startToken;\n this.endToken = endToken;\n this.source = source;\n }\n\n get [Symbol.toStringTag]() {\n return 'Location';\n }\n\n toJSON() {\n return {\n start: this.start,\n end: this.end,\n };\n }\n}\n/**\n * Represents a range of characters represented by a lexical token\n * within a Source.\n */\n\nexports.Location = Location;\n\nclass Token {\n /**\n * The kind of Token.\n */\n\n /**\n * The character offset at which this Node begins.\n */\n\n /**\n * The character offset at which this Node ends.\n */\n\n /**\n * The 1-indexed line number on which this Token appears.\n */\n\n /**\n * The 1-indexed column number at which this Token begins.\n */\n\n /**\n * For non-punctuation tokens, represents the interpreted value of the token.\n *\n * Note: is undefined for punctuation tokens, but typed as string for\n * convenience in the parser.\n */\n\n /**\n * Tokens exist as nodes in a double-linked-list amongst all tokens\n * including ignored tokens. <SOF> is always the first node and <EOF>\n * the last.\n */\n constructor(kind, start, end, line, column, value) {\n this.kind = kind;\n this.start = start;\n this.end = end;\n this.line = line;\n this.column = column; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\n this.value = value;\n this.prev = null;\n this.next = null;\n }\n\n get [Symbol.toStringTag]() {\n return 'Token';\n }\n\n toJSON() {\n return {\n kind: this.kind,\n value: this.value,\n line: this.line,\n column: this.column,\n };\n }\n}\n/**\n * The list of all possible AST node types.\n */\n\nexports.Token = Token;\n\n/**\n * @internal\n */\nconst QueryDocumentKeys = {\n Name: [],\n Document: ['definitions'],\n OperationDefinition: [\n 'name',\n 'variableDefinitions',\n 'directives',\n 'selectionSet',\n ],\n VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'],\n Variable: ['name'],\n SelectionSet: ['selections'],\n Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'],\n Argument: ['name', 'value'],\n FragmentSpread: ['name', 'directives'],\n InlineFragment: ['typeCondition', 'directives', 'selectionSet'],\n FragmentDefinition: [\n 'name', // Note: fragment variable definitions are deprecated and will removed in v17.0.0\n 'variableDefinitions',\n 'typeCondition',\n 'directives',\n 'selectionSet',\n ],\n IntValue: [],\n FloatValue: [],\n StringValue: [],\n BooleanValue: [],\n NullValue: [],\n EnumValue: [],\n ListValue: ['values'],\n ObjectValue: ['fields'],\n ObjectField: ['name', 'value'],\n Directive: ['name', 'arguments'],\n NamedType: ['name'],\n ListType: ['type'],\n NonNullType: ['type'],\n SchemaDefinition: ['description', 'directives', 'operationTypes'],\n OperationTypeDefinition: ['type'],\n ScalarTypeDefinition: ['description', 'name', 'directives'],\n ObjectTypeDefinition: [\n 'description',\n 'name',\n 'interfaces',\n 'directives',\n 'fields',\n ],\n FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'],\n InputValueDefinition: [\n 'description',\n 'name',\n 'type',\n 'defaultValue',\n 'directives',\n ],\n InterfaceTypeDefinition: [\n 'description',\n 'name',\n 'interfaces',\n 'directives',\n 'fields',\n ],\n UnionTypeDefinition: ['description', 'name', 'directives', 'types'],\n EnumTypeDefinition: ['description', 'name', 'directives', 'values'],\n EnumValueDefinition: ['description', 'name', 'directives'],\n InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'],\n DirectiveDefinition: ['description', 'name', 'arguments', 'locations'],\n SchemaExtension: ['directives', 'operationTypes'],\n ScalarTypeExtension: ['name', 'directives'],\n ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'],\n InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'],\n UnionTypeExtension: ['name', 'directives', 'types'],\n EnumTypeExtension: ['name', 'directives', 'values'],\n InputObjectTypeExtension: ['name', 'directives', 'fields'],\n};\nexports.QueryDocumentKeys = QueryDocumentKeys;\nconst kindValues = new Set(Object.keys(QueryDocumentKeys));\n/**\n * @internal\n */\n\nfunction isNode(maybeNode) {\n const maybeKind =\n maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind;\n return typeof maybeKind === 'string' && kindValues.has(maybeKind);\n}\n/** Name */\n\nvar OperationTypeNode;\nexports.OperationTypeNode = OperationTypeNode;\n\n(function (OperationTypeNode) {\n OperationTypeNode['QUERY'] = 'query';\n OperationTypeNode['MUTATION'] = 'mutation';\n OperationTypeNode['SUBSCRIPTION'] = 'subscription';\n})(OperationTypeNode || (exports.OperationTypeNode = OperationTypeNode = {}));\n","import {getDocumentLoaders, loadSchema} from \"@graphql-markdown/graphql\";\nimport {OperationTypeNode} from \"graphql/language/ast\";\nimport {Reference, ReferenceType} from \"@xyd-js/uniform\"\n\nimport {\n graphqlOperationReferences\n} from \"./utils\";\n\n// TODO: support multi graphql files\n// TODO: !!! CIRCULAR_DEPENDENCY !!!\n// TODO: sort by tag??\n\nexport async function gqlSchemaToReferences(\n schemaLocation: string\n): Promise<Reference[]> {\n const loadersList = {\n [\"GraphQLFileLoader\"]: \"@graphql-tools/graphql-file-loader\",\n }\n const loaders = await getDocumentLoaders(loadersList);\n\n // @ts-ignore TODO: but ts works in @graphql-markdown/core\n const schema = await loadSchema(schemaLocation as string, loaders);\n\n const references: Reference[] = []\n\n const queries = schema.getRootType(OperationTypeNode.QUERY)\n const queryFields = queries?.getFields?.()\n\n if (queryFields) {\n references.push(...graphqlOperationReferences(\n ReferenceType.GRAPHQL_QUERY,\n queryFields\n ))\n }\n\n const mutations = schema.getRootType(OperationTypeNode.MUTATION)\n const mutationFields = mutations?.getFields?.()\n\n if (mutationFields) {\n references.push(...graphqlOperationReferences(\n ReferenceType.GRAPHQL_MUTATION,\n mutationFields\n ))\n }\n\n return references\n}\n","import {GraphQLFieldMap} from \"graphql/type\";\nimport {\n Reference,\n ReferenceCategory,\n ReferenceType,\n ExampleGroup,\n Definition,\n Example,\n} from \"@xyd-js/uniform\";\n\nimport {argumentsIntoDefinitionProperty} from \"./arguments\";\nimport {fieldIntoDefinitionProperty} from \"./fields\";\nimport {simpleGraphqlExample} from \"./examples\";\n\n// TODO: examples\n// graphqlOperationReferences is a helper function to create a list of xyd reference for a GraphQL query or mutation.\nexport function graphqlOperationReferences(\n operationType: ReferenceType.GRAPHQL_MUTATION | ReferenceType.GRAPHQL_QUERY,\n fieldsMap: GraphQLFieldMap<any, any>\n) {\n const references: Reference[] = []\n\n for (const [operationName, operationField] of Object.entries(fieldsMap)) {\n const definitions: Definition[] = []\n\n const args = argumentsIntoDefinitionProperty(operationField.args)\n const returns = fieldIntoDefinitionProperty(operationName, operationField)\n const returnProperties = returns.properties || []\n\n definitions.push({\n title: \"Arguments\",\n properties: args,\n })\n definitions.push({\n title: \"Returns\",\n properties: returnProperties\n })\n\n const exampleQuery = simpleGraphqlExample(\n operationType,\n operationName,\n args,\n returnProperties\n )\n const examples: Example[] = [\n {\n codeblock: {\n tabs: [\n {\n title: \"graphql\",\n language: \"graphql\",\n code: exampleQuery,\n }\n ]\n }\n }\n ]\n\n const exampleGroup = {\n description: \"Example request\",\n examples,\n }\n\n let description = operationField.description || \"\"\n\n references.push(graphqlReference(\n operationType,\n operationName,\n operationName,\n description,\n [exampleGroup],\n definitions,\n ))\n }\n\n return references\n}\n\n// graphqlReference is a helper function to create a Reference object for a GraphQL query or mutation.\nfunction graphqlReference(\n operationType: ReferenceType.GRAPHQL_QUERY | ReferenceType.GRAPHQL_MUTATION,\n title: string,\n canonical: string,\n description: string,\n examples: ExampleGroup[],\n definitions: Definition[],\n): Reference {\n return {\n title,\n canonical,\n description,\n\n category: ReferenceCategory.GRAPHQL,\n type: operationType,\n\n examples: {\n groups: examples,\n },\n definitions,\n }\n}","// overFields iterates over fields of object or input object types\nimport {\n GraphQLField,\n GraphQLFieldMap,\n GraphQLInputField,\n GraphQLInputFieldMap,\n GraphQLInputObjectType\n} from \"graphql/type\";\nimport {GraphQLObjectType} from \"graphql\";\nimport {DefinitionProperty} from \"@xyd-js/uniform\";\n\n// fieldIntoDefinitionProperty converts GraphQL fields (field or input field) into xyd 'uniform' definition property\nexport function fieldIntoDefinitionProperty(\n fieldName: string,\n field: GraphQLField<any, any> | GraphQLInputField,\n): DefinitionProperty {\n let properties;\n\n // if 'ofType' types (non-null values e.g '!<type>')\n if (\"ofType\" in field.type) {\n switch (field.type.constructor.name) {\n case \"GraphQLList\": {\n switch (field.type.ofType.constructor.name) {\n case \"GraphQLObjectType\": {\n const objectType = field.type.ofType as GraphQLObjectType\n\n properties = nestedProperties(objectType)\n\n break\n }\n\n case \"GraphQLInputObjectType\": {\n const inputObjectType = field.type.ofType as GraphQLInputObjectType\n\n properties = nestedProperties(inputObjectType)\n\n break\n }\n\n case \"GraphQLScalarType\" : {\n properties = definitionPropsFromNestedObj(field) || []\n\n break\n }\n\n case \"GraphQLNonNull\": {\n properties = definitionPropsFromNestedObj(field) || []\n\n break\n }\n\n default: {\n console.error(\"unsupported ofType list\", field.type.ofType.constructor.name)\n break\n }\n\n }\n\n break\n }\n\n case \"GraphQLNonNull\": {\n properties = definitionPropsFromNestedObj(field) || []\n\n break\n }\n\n default: {\n console.error(\"unsupported ofType\", field.type.constructor.name)\n\n break\n }\n\n }\n }\n\n // if regular object type\n else if (field.type.constructor.name === \"GraphQLObjectType\") {\n const objectType = field.type as GraphQLObjectType\n\n // TODO: support nested & circular references - ITS JUST A FAST SOLUTION FOR TESTING PURPOSES\n // properties = [\n // {\n // name: fieldName,\n // type: \"object\",\n // description: objectType.description || \"\",\n // }\n // ]\n\n // TODO: comment if bug with circular references\n properties = nestedProperties(objectType)\n }\n\n // if input object type\n else if (field.type.constructor.name === \"GraphQLInputObjectType\") {\n const objectType = field.type as GraphQLInputObjectType\n\n properties = nestedProperties(objectType)\n }\n\n return {\n name: fieldName,\n type: field.type.toJSON(),\n description: field.description || \"\",\n properties,\n }\n}\n\n// TODO: fix any + another more safety solution?\n// definitionPropsFromNestedObj converts graphql nested obj into xyd 'uniform' definition properties\nfunction definitionPropsFromNestedObj(obj: any): DefinitionProperty[] | null {\n if (!obj) {\n return null\n }\n if (obj.getFields) {\n return nestedProperties(obj)\n }\n\n if (obj.ofType) {\n return definitionPropsFromNestedObj(obj.ofType)\n }\n\n if (obj.type) {\n return definitionPropsFromNestedObj(obj.type)\n }\n\n return null\n}\n\n// deepFieldMap iterates over GraphQL field (field or input fields) maps\nfunction deepFieldMap(\n fieldsMap: GraphQLFieldMap<any, any> | GraphQLInputFieldMap,\n) {\n const properties: DefinitionProperty[] = []\n\n for (const [name, field] of Object.entries(fieldsMap)) {\n const prop = fieldIntoDefinitionProperty(\n name,\n field,\n )\n\n if (prop) {\n properties.push(prop)\n }\n }\n\n return properties\n}\n\n// nestedProperties get fields from object or input object types and iterates over them\nfunction nestedProperties(objectType: GraphQLObjectType | GraphQLInputObjectType) {\n const nestedFields = objectType?.getFields?.()\n\n return deepFieldMap(nestedFields)\n}\n\n","import {GraphQLArgument} from \"graphql/type/definition\";\nimport {GraphQLInputObjectType} from \"graphql/type\";\nimport {DefinitionProperty} from \"@xyd-js/uniform\";\n\nimport {fieldIntoDefinitionProperty} from \"./fields\";\n\n// argumentsIntoDefinitionProperty converts GraphQL arguments into xyd 'uniform' definition properties\nexport function argumentsIntoDefinitionProperty(\n args: readonly GraphQLArgument[]\n): DefinitionProperty[] {\n const resp: DefinitionProperty[] = []\n\n args.forEach(arg => {\n if (arg.type.constructor.name === \"GraphQLInputObjectType\") {\n const inputObjectType = arg.type as GraphQLInputObjectType\n\n const inputFields = inputObjectType.getFields?.()\n\n const nestedProps: DefinitionProperty[] = []\n const nestedDefinitionProperty: DefinitionProperty = {\n name: arg.name,\n type: arg.type.toJSON(),\n description: arg.description || \"\",\n properties: nestedProps,\n }\n\n for (const [name, inputField] of Object.entries(inputFields)) {\n const prop = fieldIntoDefinitionProperty(\n name,\n inputField,\n )\n\n if (prop) {\n nestedProps.push(prop)\n }\n }\n\n resp.push(nestedDefinitionProperty)\n } else {\n const prop: DefinitionProperty = {\n name: arg.name,\n type: arg.type.toJSON(),\n description: arg.description || \"\",\n properties: [],\n }\n\n resp.push(prop)\n }\n })\n\n return resp\n}","import {jsonToGraphQLQuery, VariableType} from \"json-to-graphql-query\";\nimport {\n DefinitionProperty,\n ReferenceType\n} from \"@xyd-js/uniform\";\n\n// TODO: support args\n// simpleGraphqlExample is a helper function to create a simple GraphQL example query or mutation.\nexport function simpleGraphqlExample(\n operationType: ReferenceType.GRAPHQL_QUERY | ReferenceType.GRAPHQL_MUTATION,\n operationName: string,\n args: DefinitionProperty[],\n returns: DefinitionProperty[],\n) {\n let obj: any = {}\n\n\n switch (operationType) {\n case ReferenceType.GRAPHQL_QUERY: {\n const exampleReturnProps = exampleReturns(returns)\n\n obj = {\n query: {\n __name: operationName,\n [operationName]: exampleReturnProps\n }\n }\n\n break\n }\n case ReferenceType.GRAPHQL_MUTATION: {\n const exampleReturnProps = exampleReturns(returns)\n const vars = exampleVariables(args)\n const argumen = exampleArguments(args)\n\n obj = {\n mutation: {\n __name: operationName,\n __variables: vars,\n [operationName]: {\n ...exampleReturnProps,\n __args: argumen,\n }\n }\n }\n\n break;\n }\n }\n\n return jsonToGraphQLQuery(obj, {pretty: true});\n}\n\n// exampleReturns return an example of return GraphQL object\nfunction exampleReturns(\n properties: DefinitionProperty[],\n obj: any = {}\n) {\n properties.forEach((property) => {\n // TODO: only if required?\n obj[property.name] = true\n\n if (property?.properties?.length) {\n obj[property.name] = {}\n exampleReturns(property.properties, obj[property.name])\n }\n })\n\n return obj\n}\n\n// exampleArguments return an example of GraphQL arguments\nfunction exampleArguments(\n properties: DefinitionProperty[],\n obj: any = {}\n) {\n\n properties.forEach((property) => {\n obj[property.name] = new VariableType(property.name)\n })\n\n return obj\n}\n\n// exampleVariables return an example of GraphQL variables\nfunction exampleVariables(\n properties: DefinitionProperty[],\n obj: any = {}\n) {\n\n properties.forEach((property) => {\n obj[property.name] = property.type\n })\n\n return obj\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAEA,WAAO,eAAe,SAAS,cAAc;AAAA,MAC3C,OAAO;AAAA,IACT,CAAC;AACD,YAAQ,QACN,QAAQ,oBACR,QAAQ,oBACR,QAAQ,WACN;AACJ,YAAQ,SAAS;AAMjB,QAAM,WAAN,MAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAoBb,YAAY,YAAY,UAAU,QAAQ;AACxC,a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AU,MAAM,mBAAmB,WAAW;AAGpD,QAAM,SAAS,MAAM,WAAW,gBAA0B,OAAO;AAEjE,QAAM,aAA0B,CAAC;AAEjC,QAAM,UAAU,OAAO,YAAY,6BAAkB,KAAK;AAC1D,QAAM,eAAc,wCAAS,cAAT;AAEpB,MAAI,aAAa;AACb,eAAW,KAAK,GAAG;AAAA,MACfC,eAAc;AAAA,MACd;AAAA,IACJ,CAAC;AAAA,EACL;AAEA,QAAM,YAAY,OAAO,YAAY,6BAAkB,QAAQ;AAC/D,QAAM,kBAAiB,4CAAW,cAAX;AAEvB,MAAI,gBAAgB;AAChB,eAAW,KAAK,GAAG;AAAA,MACfA,eAAc;AAAA,MACd;AAAA,IACJ,CAAC;AAAA,EACL;AAEA,SAAO;AACX;","names":["OperationTypeNode","ReferenceType","ReferenceType"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyd-js/gql",
|
|
3
|
-
"version": "0.1.0-xyd.
|
|
3
|
+
"version": "0.1.0-xyd.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
"graphql-config": "^5.1.2",
|
|
12
12
|
"gray-matter": "^4.0.3",
|
|
13
13
|
"json-to-graphql-query": "^2.3.0",
|
|
14
|
-
"@xyd-js/core": "0.1.0-xyd.
|
|
15
|
-
"@xyd-js/uniform": "0.1.0-xyd.
|
|
14
|
+
"@xyd-js/core": "0.1.0-xyd.2",
|
|
15
|
+
"@xyd-js/uniform": "0.1.0-xyd.4"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"tsup": "^8.3.0"
|
|
18
|
+
"tsup": "^8.3.0",
|
|
19
|
+
"rimraf": "^3.0.2",
|
|
20
|
+
"typescript": "^4.5.5"
|
|
19
21
|
},
|
|
20
22
|
"scripts": {
|
|
21
23
|
"clean": "rimraf build",
|