@baeta/plugin-graphql 0.0.2 → 0.0.3
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.cjs +1282 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.js +1260 -21
- package/package.json +13 -12
- package/dist/codegen.d.ts +0 -6
- package/dist/codegen.js +0 -116
- package/dist/codegen.mjs +0 -89
- package/dist/config.d.ts +0 -10
- package/dist/config.js +0 -16
- package/dist/config.mjs +0 -0
- package/dist/index.mjs +0 -19
- package/dist/modules/builder.d.ts +0 -17
- package/dist/modules/builder.js +0 -439
- package/dist/modules/builder.mjs +0 -429
- package/dist/modules/config.d.ts +0 -11
- package/dist/modules/config.js +0 -16
- package/dist/modules/config.mjs +0 -0
- package/dist/modules/index.d.ts +0 -6
- package/dist/modules/index.js +0 -148
- package/dist/modules/index.mjs +0 -132
- package/dist/modules/utils.d.ts +0 -28
- package/dist/modules/utils.js +0 -209
- package/dist/modules/utils.mjs +0 -168
- package/dist/resolvers/config.d.ts +0 -16
- package/dist/resolvers/config.js +0 -16
- package/dist/resolvers/config.mjs +0 -0
- package/dist/resolvers/index.d.ts +0 -10
- package/dist/resolvers/index.js +0 -309
- package/dist/resolvers/index.mjs +0 -289
- package/dist/resolvers/visitor.d.ts +0 -29
- package/dist/resolvers/visitor.js +0 -139
- package/dist/resolvers/visitor.mjs +0 -111
- package/dist/utils/cache.d.ts +0 -3
- package/dist/utils/cache.js +0 -40
- package/dist/utils/cache.mjs +0 -16
- package/dist/utils/hash.d.ts +0 -6
- package/dist/utils/hash.js +0 -38
- package/dist/utils/hash.mjs +0 -13
- package/dist/utils/load.d.ts +0 -9
- package/dist/utils/load.js +0 -62
- package/dist/utils/load.mjs +0 -40
- package/dist/utils/path.d.ts +0 -3
- package/dist/utils/path.js +0 -37
- package/dist/utils/path.mjs +0 -7
package/dist/modules/builder.js
DELETED
|
@@ -1,439 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var builder_exports = {};
|
|
20
|
-
__export(builder_exports, {
|
|
21
|
-
buildModule: () => buildModule
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(builder_exports);
|
|
24
|
-
var import_graphql = require("graphql");
|
|
25
|
-
var import_change_case_all = require("change-case-all");
|
|
26
|
-
var import_utils = require("./utils");
|
|
27
|
-
const registryKeys = [
|
|
28
|
-
"objects",
|
|
29
|
-
"inputs",
|
|
30
|
-
"interfaces",
|
|
31
|
-
"scalars",
|
|
32
|
-
"unions",
|
|
33
|
-
"enums"
|
|
34
|
-
];
|
|
35
|
-
const resolverKeys = ["scalars", "objects", "enums"];
|
|
36
|
-
function buildModule(name, doc, {
|
|
37
|
-
importNamespace,
|
|
38
|
-
importPath,
|
|
39
|
-
encapsulate,
|
|
40
|
-
requireRootResolvers,
|
|
41
|
-
shouldDeclare,
|
|
42
|
-
rootTypes,
|
|
43
|
-
schema,
|
|
44
|
-
baseVisitor
|
|
45
|
-
}) {
|
|
46
|
-
const picks = (0, import_utils.createObject)(
|
|
47
|
-
registryKeys,
|
|
48
|
-
() => ({})
|
|
49
|
-
);
|
|
50
|
-
const defined = (0, import_utils.createObject)(registryKeys, () => []);
|
|
51
|
-
const extended = (0, import_utils.createObject)(registryKeys, () => []);
|
|
52
|
-
const usedTypes = (0, import_utils.collectUsedTypes)(doc);
|
|
53
|
-
(0, import_graphql.visit)(doc, {
|
|
54
|
-
ObjectTypeDefinition(node) {
|
|
55
|
-
collectTypeDefinition(node);
|
|
56
|
-
},
|
|
57
|
-
ObjectTypeExtension(node) {
|
|
58
|
-
collectTypeExtension(node);
|
|
59
|
-
},
|
|
60
|
-
InputObjectTypeDefinition(node) {
|
|
61
|
-
collectTypeDefinition(node);
|
|
62
|
-
},
|
|
63
|
-
InputObjectTypeExtension(node) {
|
|
64
|
-
collectTypeExtension(node);
|
|
65
|
-
},
|
|
66
|
-
InterfaceTypeDefinition(node) {
|
|
67
|
-
collectTypeDefinition(node);
|
|
68
|
-
},
|
|
69
|
-
InterfaceTypeExtension(node) {
|
|
70
|
-
collectTypeExtension(node);
|
|
71
|
-
},
|
|
72
|
-
ScalarTypeDefinition(node) {
|
|
73
|
-
collectTypeDefinition(node);
|
|
74
|
-
},
|
|
75
|
-
UnionTypeDefinition(node) {
|
|
76
|
-
collectTypeDefinition(node);
|
|
77
|
-
},
|
|
78
|
-
UnionTypeExtension(node) {
|
|
79
|
-
collectTypeExtension(node);
|
|
80
|
-
},
|
|
81
|
-
EnumTypeDefinition(node) {
|
|
82
|
-
collectTypeDefinition(node);
|
|
83
|
-
},
|
|
84
|
-
EnumTypeExtension(node) {
|
|
85
|
-
collectTypeExtension(node);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
const visited = (0, import_utils.createObject)(
|
|
89
|
-
registryKeys,
|
|
90
|
-
(key) => (0, import_utils.concatByKey)(defined, extended, key)
|
|
91
|
-
);
|
|
92
|
-
const external = (0, import_utils.createObject)(
|
|
93
|
-
registryKeys,
|
|
94
|
-
(key) => (0, import_utils.uniqueByKey)(extended, defined, key)
|
|
95
|
-
);
|
|
96
|
-
const imports = [
|
|
97
|
-
`import * as ${importNamespace} from "${importPath}";`,
|
|
98
|
-
'import { DocumentNode } from "graphql";',
|
|
99
|
-
'import * as Baeta from "@baeta/core/sdk";'
|
|
100
|
-
];
|
|
101
|
-
let content = [
|
|
102
|
-
printDefinedFields(),
|
|
103
|
-
printDefinedEnumValues(),
|
|
104
|
-
printDefinedInputFields(),
|
|
105
|
-
printSchemaTypes(usedTypes),
|
|
106
|
-
printScalars(visited),
|
|
107
|
-
printResolveSignaturesPerType(visited),
|
|
108
|
-
printResolversType(visited),
|
|
109
|
-
printMetadata()
|
|
110
|
-
].filter(Boolean).join("\n\n");
|
|
111
|
-
const moduleNamespace = baseVisitor.convertName(name, {
|
|
112
|
-
suffix: "Module",
|
|
113
|
-
useTypesPrefix: false,
|
|
114
|
-
useTypesSuffix: false
|
|
115
|
-
});
|
|
116
|
-
if (encapsulate === "namespace") {
|
|
117
|
-
content = `${shouldDeclare ? "declare" : "export"} namespace ${baseVisitor.convertName(name, {
|
|
118
|
-
suffix: "Module",
|
|
119
|
-
useTypesPrefix: false,
|
|
120
|
-
useTypesSuffix: false
|
|
121
|
-
})} {
|
|
122
|
-
` + (shouldDeclare ? `${(0, import_utils.indent)(2)(imports.join("\n"))}
|
|
123
|
-
` : "") + (0, import_utils.indent)(2)(content) + "\n}";
|
|
124
|
-
}
|
|
125
|
-
return [...!shouldDeclare ? imports : [], content, printFactoryMethod()].filter(Boolean).join("\n");
|
|
126
|
-
function printMetadata() {
|
|
127
|
-
return `export namespace ModuleMetadata {
|
|
128
|
-
export const id = '${name}';
|
|
129
|
-
export const dirname = __dirname;
|
|
130
|
-
export const typedef = ${JSON.stringify(doc)} as unknown as DocumentNode;
|
|
131
|
-
${printBaetaManager()}
|
|
132
|
-
}`;
|
|
133
|
-
}
|
|
134
|
-
function printDefinedFields() {
|
|
135
|
-
return (0, import_utils.buildBlock)({
|
|
136
|
-
name: `interface DefinedFields`,
|
|
137
|
-
lines: [...visited.objects, ...visited.interfaces].map(
|
|
138
|
-
(typeName) => `${typeName}: ${printPicks(typeName, {
|
|
139
|
-
...picks.objects,
|
|
140
|
-
...picks.interfaces
|
|
141
|
-
})};`
|
|
142
|
-
)
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
function printFactoryMethod() {
|
|
146
|
-
const name2 = moduleNamespace.slice(0, moduleNamespace.length - 6);
|
|
147
|
-
const createModuleFn = `create${name2}Module`;
|
|
148
|
-
const getModuleFn = `get${name2}Module`;
|
|
149
|
-
return `
|
|
150
|
-
export const ${createModuleFn} = () => Baeta.createModule(ModuleMetadata);
|
|
151
|
-
export const ${getModuleFn} = Baeta.createSingletonModule(${createModuleFn});
|
|
152
|
-
`;
|
|
153
|
-
}
|
|
154
|
-
function printObjectFieldResolverBuilder(typeName, field) {
|
|
155
|
-
const resolverType = `${typeName}Resolvers["${field}"]`;
|
|
156
|
-
return `${field}: Baeta.createResolverBuilder<NonNullable<${resolverType}>>("${typeName}", "${field}", options),`;
|
|
157
|
-
}
|
|
158
|
-
function printObjectResolverBuilder(typeName, objects) {
|
|
159
|
-
var _a;
|
|
160
|
-
const fields = ((_a = objects[typeName]) == null ? void 0 : _a.filter(import_utils.unique).map((field) => printObjectFieldResolverBuilder(typeName, field))) ?? [];
|
|
161
|
-
if (fields.length === 0) {
|
|
162
|
-
return "";
|
|
163
|
-
}
|
|
164
|
-
const resolversType = `${typeName}Resolvers`;
|
|
165
|
-
const content2 = `{
|
|
166
|
-
${fields.map((0, import_utils.indent)(2)).join("\n")}
|
|
167
|
-
}`;
|
|
168
|
-
return `${typeName}: Baeta.createResolversBuilder("${typeName}", options, {} as ${resolversType}, ${content2}),`;
|
|
169
|
-
}
|
|
170
|
-
function printSubscriptionFieldBuilder(field) {
|
|
171
|
-
const resolverType = `SubscriptionResolvers["${field}"]`;
|
|
172
|
-
return `${field}: Baeta.createSubscriptionBuilder<${resolverType}>("${field}", options),`;
|
|
173
|
-
}
|
|
174
|
-
function printSubscriptionObjectBuilder() {
|
|
175
|
-
var _a;
|
|
176
|
-
const subscriptions = ((_a = picks.objects["Subscription"]) == null ? void 0 : _a.filter(import_utils.unique)) ?? [];
|
|
177
|
-
if (subscriptions.length === 0) {
|
|
178
|
-
return "";
|
|
179
|
-
}
|
|
180
|
-
const fields = subscriptions.map(
|
|
181
|
-
(subscription) => printSubscriptionFieldBuilder(subscription)
|
|
182
|
-
);
|
|
183
|
-
const resolversType = `SubscriptionResolvers`;
|
|
184
|
-
const content2 = `{
|
|
185
|
-
${fields.map((0, import_utils.indent)(2)).join("\n")}
|
|
186
|
-
}`;
|
|
187
|
-
return `Subscription: Baeta.createSubscriptionsBuilder(options, {} as ${resolversType}, ${content2}),`;
|
|
188
|
-
}
|
|
189
|
-
function printScalarBuilder() {
|
|
190
|
-
const scalars = visited.scalars;
|
|
191
|
-
if (scalars.length === 0) {
|
|
192
|
-
return "";
|
|
193
|
-
}
|
|
194
|
-
const fields = scalars.map(
|
|
195
|
-
(scalar) => `${scalar}: Baeta.createScalarBuilder("${scalar}", options),`
|
|
196
|
-
);
|
|
197
|
-
const content2 = fields.map((0, import_utils.indent)(2)).join("\n");
|
|
198
|
-
return `Scalar: {
|
|
199
|
-
${content2}
|
|
200
|
-
},`;
|
|
201
|
-
}
|
|
202
|
-
function printBaetaManager() {
|
|
203
|
-
const objects = visited.objects.filter((type) => type !== "Subscription").map((typeName) => printObjectResolverBuilder(typeName, picks.objects)).filter(Boolean);
|
|
204
|
-
const bodyFields = [
|
|
205
|
-
...objects,
|
|
206
|
-
printScalarBuilder(),
|
|
207
|
-
printSubscriptionObjectBuilder()
|
|
208
|
-
];
|
|
209
|
-
const body = bodyFields.filter(Boolean).map((0, import_utils.indent)(6)).join("\n");
|
|
210
|
-
const content2 = `{
|
|
211
|
-
${body}
|
|
212
|
-
}`;
|
|
213
|
-
return `
|
|
214
|
-
export function createManager(options: Baeta.ManagerOptions) {
|
|
215
|
-
return Baeta.createManager(options, {}, ${content2});
|
|
216
|
-
}`;
|
|
217
|
-
}
|
|
218
|
-
function printDefinedEnumValues() {
|
|
219
|
-
return (0, import_utils.buildBlock)({
|
|
220
|
-
name: `interface DefinedEnumValues`,
|
|
221
|
-
lines: visited.enums.map(
|
|
222
|
-
(typeName) => `${typeName}: ${printPicks(typeName, picks.enums)};`
|
|
223
|
-
)
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
function encapsulateTypeName(typeName) {
|
|
227
|
-
if (encapsulate === "prefix") {
|
|
228
|
-
return `${(0, import_change_case_all.pascalCase)(name)}_${typeName}`;
|
|
229
|
-
}
|
|
230
|
-
return typeName;
|
|
231
|
-
}
|
|
232
|
-
function printDefinedInputFields() {
|
|
233
|
-
return (0, import_utils.buildBlock)({
|
|
234
|
-
name: `interface DefinedInputFields`,
|
|
235
|
-
lines: visited.inputs.map(
|
|
236
|
-
(typeName) => `${typeName}: ${printPicks(typeName, picks.inputs)};`
|
|
237
|
-
)
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
function printSchemaTypes(types) {
|
|
241
|
-
return types.filter((type) => !visited.scalars.includes(type)).map(printExportType).join("\n");
|
|
242
|
-
}
|
|
243
|
-
function printResolveSignaturesPerType(registry) {
|
|
244
|
-
return [
|
|
245
|
-
[...registry.objects, ...registry.interfaces].map(
|
|
246
|
-
(name2) => printResolverType(
|
|
247
|
-
name2,
|
|
248
|
-
"DefinedFields",
|
|
249
|
-
requireRootResolvers && rootTypes.includes(name2),
|
|
250
|
-
!rootTypes.includes(name2) && defined.objects.includes(name2) ? ` | '__isTypeOf'` : ""
|
|
251
|
-
)
|
|
252
|
-
).join("\n")
|
|
253
|
-
].join("\n");
|
|
254
|
-
}
|
|
255
|
-
function printScalars(registry) {
|
|
256
|
-
if (!registry.scalars.length) {
|
|
257
|
-
return "";
|
|
258
|
-
}
|
|
259
|
-
return [
|
|
260
|
-
`export type ${encapsulateTypeName(
|
|
261
|
-
"Scalars"
|
|
262
|
-
)} = Pick<${importNamespace}.Scalars, ${registry.scalars.map(import_utils.withQuotes).join(" | ")}>;`,
|
|
263
|
-
...registry.scalars.map((scalar) => {
|
|
264
|
-
const convertedName = baseVisitor.convertName(scalar, {
|
|
265
|
-
suffix: "ScalarConfig"
|
|
266
|
-
});
|
|
267
|
-
return `export type ${encapsulateTypeName(
|
|
268
|
-
convertedName
|
|
269
|
-
)} = ${importNamespace}.${convertedName};`;
|
|
270
|
-
})
|
|
271
|
-
].join("\n");
|
|
272
|
-
}
|
|
273
|
-
function printResolversType(registry) {
|
|
274
|
-
const lines = [];
|
|
275
|
-
for (const kind in registry) {
|
|
276
|
-
const k = kind;
|
|
277
|
-
if (registry.hasOwnProperty(k) && resolverKeys.includes(k)) {
|
|
278
|
-
const types = registry[k];
|
|
279
|
-
types.forEach((typeName) => {
|
|
280
|
-
if (k === "enums") {
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
if (k === "scalars") {
|
|
284
|
-
lines.push(
|
|
285
|
-
`${typeName}?: ${encapsulateTypeName(
|
|
286
|
-
importNamespace
|
|
287
|
-
)}.Resolvers['${typeName}'];`
|
|
288
|
-
);
|
|
289
|
-
} else {
|
|
290
|
-
const fieldModifier = requireRootResolvers && rootTypes.includes(typeName) ? "" : "?";
|
|
291
|
-
lines.push(
|
|
292
|
-
`${typeName}${fieldModifier}: ${encapsulateTypeName(
|
|
293
|
-
typeName
|
|
294
|
-
)}Resolvers;`
|
|
295
|
-
);
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
return (0, import_utils.buildBlock)({
|
|
301
|
-
name: `export interface ${encapsulateTypeName("Resolvers")}`,
|
|
302
|
-
lines
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
function printResolverType(typeName, picksTypeName, requireFieldsResolvers = false, extraKeys = "") {
|
|
306
|
-
const typeSignature = `Pick<${importNamespace}.${baseVisitor.convertName(
|
|
307
|
-
typeName,
|
|
308
|
-
{
|
|
309
|
-
suffix: "Resolvers"
|
|
310
|
-
}
|
|
311
|
-
)}, ${picksTypeName}['${typeName}']${extraKeys}>`;
|
|
312
|
-
return `export type ${encapsulateTypeName(`${typeName}Resolvers`)} = ${requireFieldsResolvers ? `Required<${typeSignature}>` : typeSignature};`;
|
|
313
|
-
}
|
|
314
|
-
function printPicks(typeName, records) {
|
|
315
|
-
return records[typeName].filter(import_utils.unique).map(import_utils.withQuotes).join(" | ");
|
|
316
|
-
}
|
|
317
|
-
function printTypeBody(typeName) {
|
|
318
|
-
const coreType = `${importNamespace}.${baseVisitor.convertName(typeName, {
|
|
319
|
-
useTypesSuffix: true,
|
|
320
|
-
useTypesPrefix: true
|
|
321
|
-
})}`;
|
|
322
|
-
if (external.enums.includes(typeName) || external.objects.includes(typeName)) {
|
|
323
|
-
if (schema && (0, import_graphql.isScalarType)(schema.getType(typeName))) {
|
|
324
|
-
return `${importNamespace}.Scalars['${typeName}']`;
|
|
325
|
-
}
|
|
326
|
-
return coreType;
|
|
327
|
-
}
|
|
328
|
-
if (defined.enums.includes(typeName) && picks.enums[typeName]) {
|
|
329
|
-
return `DefinedEnumValues['${typeName}']`;
|
|
330
|
-
}
|
|
331
|
-
if (defined.objects.includes(typeName) && picks.objects[typeName]) {
|
|
332
|
-
return `Pick<${coreType}, DefinedFields['${typeName}']>`;
|
|
333
|
-
}
|
|
334
|
-
if (defined.interfaces.includes(typeName) && picks.interfaces[typeName]) {
|
|
335
|
-
return `Pick<${coreType}, DefinedFields['${typeName}']>`;
|
|
336
|
-
}
|
|
337
|
-
if (defined.inputs.includes(typeName) && picks.inputs[typeName]) {
|
|
338
|
-
return `Pick<${coreType}, DefinedInputFields['${typeName}']>`;
|
|
339
|
-
}
|
|
340
|
-
return coreType;
|
|
341
|
-
}
|
|
342
|
-
function printExportType(typeName) {
|
|
343
|
-
return `export type ${encapsulateTypeName(typeName)} = ${printTypeBody(
|
|
344
|
-
typeName
|
|
345
|
-
)};`;
|
|
346
|
-
}
|
|
347
|
-
function collectFields(node, picksObj) {
|
|
348
|
-
const name2 = node.name.value;
|
|
349
|
-
if (node.fields) {
|
|
350
|
-
if (!picksObj[name2]) {
|
|
351
|
-
picksObj[name2] = [];
|
|
352
|
-
}
|
|
353
|
-
node.fields.forEach((field) => {
|
|
354
|
-
picksObj[name2].push(field.name.value);
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
function collectValuesFromEnum(node) {
|
|
359
|
-
const name2 = node.name.value;
|
|
360
|
-
if (node.values) {
|
|
361
|
-
if (!picks.enums[name2]) {
|
|
362
|
-
picks.enums[name2] = [];
|
|
363
|
-
}
|
|
364
|
-
node.values.forEach((field) => {
|
|
365
|
-
picks.enums[name2].push(field.name.value);
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
function collectTypeDefinition(node) {
|
|
370
|
-
const name2 = node.name.value;
|
|
371
|
-
switch (node.kind) {
|
|
372
|
-
case import_graphql.Kind.OBJECT_TYPE_DEFINITION: {
|
|
373
|
-
defined.objects.push(name2);
|
|
374
|
-
collectFields(node, picks.objects);
|
|
375
|
-
break;
|
|
376
|
-
}
|
|
377
|
-
case import_graphql.Kind.ENUM_TYPE_DEFINITION: {
|
|
378
|
-
defined.enums.push(name2);
|
|
379
|
-
collectValuesFromEnum(node);
|
|
380
|
-
break;
|
|
381
|
-
}
|
|
382
|
-
case import_graphql.Kind.INPUT_OBJECT_TYPE_DEFINITION: {
|
|
383
|
-
defined.inputs.push(name2);
|
|
384
|
-
collectFields(node, picks.inputs);
|
|
385
|
-
break;
|
|
386
|
-
}
|
|
387
|
-
case import_graphql.Kind.SCALAR_TYPE_DEFINITION: {
|
|
388
|
-
defined.scalars.push(name2);
|
|
389
|
-
break;
|
|
390
|
-
}
|
|
391
|
-
case import_graphql.Kind.INTERFACE_TYPE_DEFINITION: {
|
|
392
|
-
defined.interfaces.push(name2);
|
|
393
|
-
collectFields(node, picks.interfaces);
|
|
394
|
-
break;
|
|
395
|
-
}
|
|
396
|
-
case import_graphql.Kind.UNION_TYPE_DEFINITION: {
|
|
397
|
-
defined.unions.push(name2);
|
|
398
|
-
break;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
function collectTypeExtension(node) {
|
|
403
|
-
const name2 = node.name.value;
|
|
404
|
-
switch (node.kind) {
|
|
405
|
-
case import_graphql.Kind.OBJECT_TYPE_EXTENSION: {
|
|
406
|
-
collectFields(node, picks.objects);
|
|
407
|
-
if (rootTypes.includes(name2)) {
|
|
408
|
-
(0, import_utils.pushUnique)(defined.objects, name2);
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
411
|
-
(0, import_utils.pushUnique)(extended.objects, name2);
|
|
412
|
-
break;
|
|
413
|
-
}
|
|
414
|
-
case import_graphql.Kind.ENUM_TYPE_EXTENSION: {
|
|
415
|
-
collectValuesFromEnum(node);
|
|
416
|
-
(0, import_utils.pushUnique)(extended.enums, name2);
|
|
417
|
-
break;
|
|
418
|
-
}
|
|
419
|
-
case import_graphql.Kind.INPUT_OBJECT_TYPE_EXTENSION: {
|
|
420
|
-
collectFields(node, picks.inputs);
|
|
421
|
-
(0, import_utils.pushUnique)(extended.inputs, name2);
|
|
422
|
-
break;
|
|
423
|
-
}
|
|
424
|
-
case import_graphql.Kind.INTERFACE_TYPE_EXTENSION: {
|
|
425
|
-
collectFields(node, picks.interfaces);
|
|
426
|
-
(0, import_utils.pushUnique)(extended.interfaces, name2);
|
|
427
|
-
break;
|
|
428
|
-
}
|
|
429
|
-
case import_graphql.Kind.UNION_TYPE_EXTENSION: {
|
|
430
|
-
(0, import_utils.pushUnique)(extended.unions, name2);
|
|
431
|
-
break;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
437
|
-
0 && (module.exports = {
|
|
438
|
-
buildModule
|
|
439
|
-
});
|