@neutron.co.id/operasional-interfaces 1.1.1-beta.2 → 1.1.1-beta.4
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/build/index.cjs +3793 -26
- package/build/index.mjs +3794 -27
- package/build/types/components/task/elements/TaskWorkButton.vue.d.ts +2 -0
- package/build/types/components/task/elements/index.d.ts +1 -0
- package/build/types/components/task/index.d.ts +1 -0
- package/build/types/components/task/sheets/TaskWork.vue.d.ts +2 -0
- package/build/types/components/task/sheets/index.d.ts +1 -0
- package/package.json +4 -4
package/build/index.cjs
CHANGED
|
@@ -8,9 +8,9 @@ const context = require("@neon.id/context");
|
|
|
8
8
|
const office = require("@neon.id/office");
|
|
9
9
|
const form = require("@neon.id/form");
|
|
10
10
|
const _hoisted_1$1 = { class: "xxx-button" };
|
|
11
|
-
const __default__$
|
|
12
|
-
const _sfc_main$
|
|
13
|
-
...__default__$
|
|
11
|
+
const __default__$3 = vue.defineComponent({ name: "XxxButton" });
|
|
12
|
+
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
13
|
+
...__default__$3,
|
|
14
14
|
props: {
|
|
15
15
|
color: {
|
|
16
16
|
type: String,
|
|
@@ -26,11 +26,11 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
const StaffModel = personaliaModels.models.StaffModel;
|
|
29
|
-
const __default__$
|
|
29
|
+
const __default__$2 = vue.defineComponent({
|
|
30
30
|
name: "StaffCollection"
|
|
31
31
|
});
|
|
32
|
-
const _sfc_main$
|
|
33
|
-
...__default__$
|
|
32
|
+
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
33
|
+
...__default__$2,
|
|
34
34
|
setup(__props) {
|
|
35
35
|
context.useCollection();
|
|
36
36
|
return (_ctx, _cache) => {
|
|
@@ -46,7 +46,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
46
46
|
});
|
|
47
47
|
const _hoisted_1 = { class: "grid gap-4 sm:grid-cols-[3fr_1fr]" };
|
|
48
48
|
const _hoisted_2 = { class: "grid gap-4 sm:grid-cols-2" };
|
|
49
|
-
const _sfc_main$
|
|
49
|
+
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
50
50
|
__name: "StaffSingle",
|
|
51
51
|
setup(__props) {
|
|
52
52
|
const {
|
|
@@ -190,19 +190,3553 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
190
190
|
});
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
});
|
|
194
|
-
const StaffSingle_vue_vue_type_style_index_0_scoped_dbeb1998_lang = "";
|
|
195
|
-
const _export_sfc = (sfc, props) => {
|
|
196
|
-
const target = sfc.__vccOpts || sfc;
|
|
197
|
-
for (const [key, val] of props) {
|
|
198
|
-
target[key] = val;
|
|
193
|
+
});
|
|
194
|
+
const StaffSingle_vue_vue_type_style_index_0_scoped_dbeb1998_lang = "";
|
|
195
|
+
const _export_sfc = (sfc, props) => {
|
|
196
|
+
const target = sfc.__vccOpts || sfc;
|
|
197
|
+
for (const [key, val] of props) {
|
|
198
|
+
target[key] = val;
|
|
199
|
+
}
|
|
200
|
+
return target;
|
|
201
|
+
};
|
|
202
|
+
const StaffSingle = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-dbeb1998"]]);
|
|
203
|
+
const TaskModel = personaliaModels.models.TaskModel;
|
|
204
|
+
function devAssert(condition, message) {
|
|
205
|
+
const booleanCondition = Boolean(condition);
|
|
206
|
+
if (!booleanCondition) {
|
|
207
|
+
throw new Error(message);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function isObjectLike(value) {
|
|
211
|
+
return typeof value == "object" && value !== null;
|
|
212
|
+
}
|
|
213
|
+
function invariant(condition, message) {
|
|
214
|
+
const booleanCondition = Boolean(condition);
|
|
215
|
+
if (!booleanCondition) {
|
|
216
|
+
throw new Error(
|
|
217
|
+
message != null ? message : "Unexpected invariant triggered."
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
const LineRegExp = /\r\n|[\n\r]/g;
|
|
222
|
+
function getLocation(source, position) {
|
|
223
|
+
let lastLineStart = 0;
|
|
224
|
+
let line = 1;
|
|
225
|
+
for (const match of source.body.matchAll(LineRegExp)) {
|
|
226
|
+
typeof match.index === "number" || invariant(false);
|
|
227
|
+
if (match.index >= position) {
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
lastLineStart = match.index + match[0].length;
|
|
231
|
+
line += 1;
|
|
232
|
+
}
|
|
233
|
+
return {
|
|
234
|
+
line,
|
|
235
|
+
column: position + 1 - lastLineStart
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function printLocation(location) {
|
|
239
|
+
return printSourceLocation(
|
|
240
|
+
location.source,
|
|
241
|
+
getLocation(location.source, location.start)
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
function printSourceLocation(source, sourceLocation) {
|
|
245
|
+
const firstLineColumnOffset = source.locationOffset.column - 1;
|
|
246
|
+
const body = "".padStart(firstLineColumnOffset) + source.body;
|
|
247
|
+
const lineIndex = sourceLocation.line - 1;
|
|
248
|
+
const lineOffset = source.locationOffset.line - 1;
|
|
249
|
+
const lineNum = sourceLocation.line + lineOffset;
|
|
250
|
+
const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0;
|
|
251
|
+
const columnNum = sourceLocation.column + columnOffset;
|
|
252
|
+
const locationStr = `${source.name}:${lineNum}:${columnNum}
|
|
253
|
+
`;
|
|
254
|
+
const lines = body.split(/\r\n|[\n\r]/g);
|
|
255
|
+
const locationLine = lines[lineIndex];
|
|
256
|
+
if (locationLine.length > 120) {
|
|
257
|
+
const subLineIndex = Math.floor(columnNum / 80);
|
|
258
|
+
const subLineColumnNum = columnNum % 80;
|
|
259
|
+
const subLines = [];
|
|
260
|
+
for (let i2 = 0; i2 < locationLine.length; i2 += 80) {
|
|
261
|
+
subLines.push(locationLine.slice(i2, i2 + 80));
|
|
262
|
+
}
|
|
263
|
+
return locationStr + printPrefixedLines([
|
|
264
|
+
[`${lineNum} |`, subLines[0]],
|
|
265
|
+
...subLines.slice(1, subLineIndex + 1).map((subLine) => ["|", subLine]),
|
|
266
|
+
["|", "^".padStart(subLineColumnNum)],
|
|
267
|
+
["|", subLines[subLineIndex + 1]]
|
|
268
|
+
]);
|
|
269
|
+
}
|
|
270
|
+
return locationStr + printPrefixedLines([
|
|
271
|
+
// Lines specified like this: ["prefix", "string"],
|
|
272
|
+
[`${lineNum - 1} |`, lines[lineIndex - 1]],
|
|
273
|
+
[`${lineNum} |`, locationLine],
|
|
274
|
+
["|", "^".padStart(columnNum)],
|
|
275
|
+
[`${lineNum + 1} |`, lines[lineIndex + 1]]
|
|
276
|
+
]);
|
|
277
|
+
}
|
|
278
|
+
function printPrefixedLines(lines) {
|
|
279
|
+
const existingLines = lines.filter(([_, line]) => line !== void 0);
|
|
280
|
+
const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length));
|
|
281
|
+
return existingLines.map(([prefix, line]) => prefix.padStart(padLen) + (line ? " " + line : "")).join("\n");
|
|
282
|
+
}
|
|
283
|
+
function toNormalizedOptions(args) {
|
|
284
|
+
const firstArg = args[0];
|
|
285
|
+
if (firstArg == null || "kind" in firstArg || "length" in firstArg) {
|
|
286
|
+
return {
|
|
287
|
+
nodes: firstArg,
|
|
288
|
+
source: args[1],
|
|
289
|
+
positions: args[2],
|
|
290
|
+
path: args[3],
|
|
291
|
+
originalError: args[4],
|
|
292
|
+
extensions: args[5]
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
return firstArg;
|
|
296
|
+
}
|
|
297
|
+
class GraphQLError extends Error {
|
|
298
|
+
/**
|
|
299
|
+
* An array of `{ line, column }` locations within the source GraphQL document
|
|
300
|
+
* which correspond to this error.
|
|
301
|
+
*
|
|
302
|
+
* Errors during validation often contain multiple locations, for example to
|
|
303
|
+
* point out two things with the same name. Errors during execution include a
|
|
304
|
+
* single location, the field which produced the error.
|
|
305
|
+
*
|
|
306
|
+
* Enumerable, and appears in the result of JSON.stringify().
|
|
307
|
+
*/
|
|
308
|
+
/**
|
|
309
|
+
* An array describing the JSON-path into the execution response which
|
|
310
|
+
* corresponds to this error. Only included for errors during execution.
|
|
311
|
+
*
|
|
312
|
+
* Enumerable, and appears in the result of JSON.stringify().
|
|
313
|
+
*/
|
|
314
|
+
/**
|
|
315
|
+
* An array of GraphQL AST Nodes corresponding to this error.
|
|
316
|
+
*/
|
|
317
|
+
/**
|
|
318
|
+
* The source GraphQL document for the first location of this error.
|
|
319
|
+
*
|
|
320
|
+
* Note that if this Error represents more than one node, the source may not
|
|
321
|
+
* represent nodes after the first node.
|
|
322
|
+
*/
|
|
323
|
+
/**
|
|
324
|
+
* An array of character offsets within the source GraphQL document
|
|
325
|
+
* which correspond to this error.
|
|
326
|
+
*/
|
|
327
|
+
/**
|
|
328
|
+
* The original error thrown from a field resolver during execution.
|
|
329
|
+
*/
|
|
330
|
+
/**
|
|
331
|
+
* Extension fields to add to the formatted error.
|
|
332
|
+
*/
|
|
333
|
+
/**
|
|
334
|
+
* @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
|
|
335
|
+
*/
|
|
336
|
+
constructor(message, ...rawArgs) {
|
|
337
|
+
var _this$nodes, _nodeLocations$, _ref;
|
|
338
|
+
const { nodes, source, positions, path, originalError, extensions } = toNormalizedOptions(rawArgs);
|
|
339
|
+
super(message);
|
|
340
|
+
this.name = "GraphQLError";
|
|
341
|
+
this.path = path !== null && path !== void 0 ? path : void 0;
|
|
342
|
+
this.originalError = originalError !== null && originalError !== void 0 ? originalError : void 0;
|
|
343
|
+
this.nodes = undefinedIfEmpty(
|
|
344
|
+
Array.isArray(nodes) ? nodes : nodes ? [nodes] : void 0
|
|
345
|
+
);
|
|
346
|
+
const nodeLocations = undefinedIfEmpty(
|
|
347
|
+
(_this$nodes = this.nodes) === null || _this$nodes === void 0 ? void 0 : _this$nodes.map((node) => node.loc).filter((loc) => loc != null)
|
|
348
|
+
);
|
|
349
|
+
this.source = source !== null && source !== void 0 ? source : nodeLocations === null || nodeLocations === void 0 ? void 0 : (_nodeLocations$ = nodeLocations[0]) === null || _nodeLocations$ === void 0 ? void 0 : _nodeLocations$.source;
|
|
350
|
+
this.positions = positions !== null && positions !== void 0 ? positions : nodeLocations === null || nodeLocations === void 0 ? void 0 : nodeLocations.map((loc) => loc.start);
|
|
351
|
+
this.locations = positions && source ? positions.map((pos) => getLocation(source, pos)) : nodeLocations === null || nodeLocations === void 0 ? void 0 : nodeLocations.map((loc) => getLocation(loc.source, loc.start));
|
|
352
|
+
const originalExtensions = isObjectLike(
|
|
353
|
+
originalError === null || originalError === void 0 ? void 0 : originalError.extensions
|
|
354
|
+
) ? originalError === null || originalError === void 0 ? void 0 : originalError.extensions : void 0;
|
|
355
|
+
this.extensions = (_ref = extensions !== null && extensions !== void 0 ? extensions : originalExtensions) !== null && _ref !== void 0 ? _ref : /* @__PURE__ */ Object.create(null);
|
|
356
|
+
Object.defineProperties(this, {
|
|
357
|
+
message: {
|
|
358
|
+
writable: true,
|
|
359
|
+
enumerable: true
|
|
360
|
+
},
|
|
361
|
+
name: {
|
|
362
|
+
enumerable: false
|
|
363
|
+
},
|
|
364
|
+
nodes: {
|
|
365
|
+
enumerable: false
|
|
366
|
+
},
|
|
367
|
+
source: {
|
|
368
|
+
enumerable: false
|
|
369
|
+
},
|
|
370
|
+
positions: {
|
|
371
|
+
enumerable: false
|
|
372
|
+
},
|
|
373
|
+
originalError: {
|
|
374
|
+
enumerable: false
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
if (originalError !== null && originalError !== void 0 && originalError.stack) {
|
|
378
|
+
Object.defineProperty(this, "stack", {
|
|
379
|
+
value: originalError.stack,
|
|
380
|
+
writable: true,
|
|
381
|
+
configurable: true
|
|
382
|
+
});
|
|
383
|
+
} else if (Error.captureStackTrace) {
|
|
384
|
+
Error.captureStackTrace(this, GraphQLError);
|
|
385
|
+
} else {
|
|
386
|
+
Object.defineProperty(this, "stack", {
|
|
387
|
+
value: Error().stack,
|
|
388
|
+
writable: true,
|
|
389
|
+
configurable: true
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
get [Symbol.toStringTag]() {
|
|
394
|
+
return "GraphQLError";
|
|
395
|
+
}
|
|
396
|
+
toString() {
|
|
397
|
+
let output = this.message;
|
|
398
|
+
if (this.nodes) {
|
|
399
|
+
for (const node of this.nodes) {
|
|
400
|
+
if (node.loc) {
|
|
401
|
+
output += "\n\n" + printLocation(node.loc);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
} else if (this.source && this.locations) {
|
|
405
|
+
for (const location of this.locations) {
|
|
406
|
+
output += "\n\n" + printSourceLocation(this.source, location);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return output;
|
|
410
|
+
}
|
|
411
|
+
toJSON() {
|
|
412
|
+
const formattedError = {
|
|
413
|
+
message: this.message
|
|
414
|
+
};
|
|
415
|
+
if (this.locations != null) {
|
|
416
|
+
formattedError.locations = this.locations;
|
|
417
|
+
}
|
|
418
|
+
if (this.path != null) {
|
|
419
|
+
formattedError.path = this.path;
|
|
420
|
+
}
|
|
421
|
+
if (this.extensions != null && Object.keys(this.extensions).length > 0) {
|
|
422
|
+
formattedError.extensions = this.extensions;
|
|
423
|
+
}
|
|
424
|
+
return formattedError;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
function undefinedIfEmpty(array) {
|
|
428
|
+
return array === void 0 || array.length === 0 ? void 0 : array;
|
|
429
|
+
}
|
|
430
|
+
function syntaxError(source, position, description) {
|
|
431
|
+
return new GraphQLError(`Syntax Error: ${description}`, {
|
|
432
|
+
source,
|
|
433
|
+
positions: [position]
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
class Location {
|
|
437
|
+
/**
|
|
438
|
+
* The character offset at which this Node begins.
|
|
439
|
+
*/
|
|
440
|
+
/**
|
|
441
|
+
* The character offset at which this Node ends.
|
|
442
|
+
*/
|
|
443
|
+
/**
|
|
444
|
+
* The Token at which this Node begins.
|
|
445
|
+
*/
|
|
446
|
+
/**
|
|
447
|
+
* The Token at which this Node ends.
|
|
448
|
+
*/
|
|
449
|
+
/**
|
|
450
|
+
* The Source document the AST represents.
|
|
451
|
+
*/
|
|
452
|
+
constructor(startToken, endToken, source) {
|
|
453
|
+
this.start = startToken.start;
|
|
454
|
+
this.end = endToken.end;
|
|
455
|
+
this.startToken = startToken;
|
|
456
|
+
this.endToken = endToken;
|
|
457
|
+
this.source = source;
|
|
458
|
+
}
|
|
459
|
+
get [Symbol.toStringTag]() {
|
|
460
|
+
return "Location";
|
|
461
|
+
}
|
|
462
|
+
toJSON() {
|
|
463
|
+
return {
|
|
464
|
+
start: this.start,
|
|
465
|
+
end: this.end
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
class Token {
|
|
470
|
+
/**
|
|
471
|
+
* The kind of Token.
|
|
472
|
+
*/
|
|
473
|
+
/**
|
|
474
|
+
* The character offset at which this Node begins.
|
|
475
|
+
*/
|
|
476
|
+
/**
|
|
477
|
+
* The character offset at which this Node ends.
|
|
478
|
+
*/
|
|
479
|
+
/**
|
|
480
|
+
* The 1-indexed line number on which this Token appears.
|
|
481
|
+
*/
|
|
482
|
+
/**
|
|
483
|
+
* The 1-indexed column number at which this Token begins.
|
|
484
|
+
*/
|
|
485
|
+
/**
|
|
486
|
+
* For non-punctuation tokens, represents the interpreted value of the token.
|
|
487
|
+
*
|
|
488
|
+
* Note: is undefined for punctuation tokens, but typed as string for
|
|
489
|
+
* convenience in the parser.
|
|
490
|
+
*/
|
|
491
|
+
/**
|
|
492
|
+
* Tokens exist as nodes in a double-linked-list amongst all tokens
|
|
493
|
+
* including ignored tokens. <SOF> is always the first node and <EOF>
|
|
494
|
+
* the last.
|
|
495
|
+
*/
|
|
496
|
+
constructor(kind, start2, end, line, column, value) {
|
|
497
|
+
this.kind = kind;
|
|
498
|
+
this.start = start2;
|
|
499
|
+
this.end = end;
|
|
500
|
+
this.line = line;
|
|
501
|
+
this.column = column;
|
|
502
|
+
this.value = value;
|
|
503
|
+
this.prev = null;
|
|
504
|
+
this.next = null;
|
|
505
|
+
}
|
|
506
|
+
get [Symbol.toStringTag]() {
|
|
507
|
+
return "Token";
|
|
508
|
+
}
|
|
509
|
+
toJSON() {
|
|
510
|
+
return {
|
|
511
|
+
kind: this.kind,
|
|
512
|
+
value: this.value,
|
|
513
|
+
line: this.line,
|
|
514
|
+
column: this.column
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
const QueryDocumentKeys = {
|
|
519
|
+
Name: [],
|
|
520
|
+
Document: ["definitions"],
|
|
521
|
+
OperationDefinition: [
|
|
522
|
+
"name",
|
|
523
|
+
"variableDefinitions",
|
|
524
|
+
"directives",
|
|
525
|
+
"selectionSet"
|
|
526
|
+
],
|
|
527
|
+
VariableDefinition: ["variable", "type", "defaultValue", "directives"],
|
|
528
|
+
Variable: ["name"],
|
|
529
|
+
SelectionSet: ["selections"],
|
|
530
|
+
Field: ["alias", "name", "arguments", "directives", "selectionSet"],
|
|
531
|
+
Argument: ["name", "value"],
|
|
532
|
+
FragmentSpread: ["name", "directives"],
|
|
533
|
+
InlineFragment: ["typeCondition", "directives", "selectionSet"],
|
|
534
|
+
FragmentDefinition: [
|
|
535
|
+
"name",
|
|
536
|
+
// Note: fragment variable definitions are deprecated and will removed in v17.0.0
|
|
537
|
+
"variableDefinitions",
|
|
538
|
+
"typeCondition",
|
|
539
|
+
"directives",
|
|
540
|
+
"selectionSet"
|
|
541
|
+
],
|
|
542
|
+
IntValue: [],
|
|
543
|
+
FloatValue: [],
|
|
544
|
+
StringValue: [],
|
|
545
|
+
BooleanValue: [],
|
|
546
|
+
NullValue: [],
|
|
547
|
+
EnumValue: [],
|
|
548
|
+
ListValue: ["values"],
|
|
549
|
+
ObjectValue: ["fields"],
|
|
550
|
+
ObjectField: ["name", "value"],
|
|
551
|
+
Directive: ["name", "arguments"],
|
|
552
|
+
NamedType: ["name"],
|
|
553
|
+
ListType: ["type"],
|
|
554
|
+
NonNullType: ["type"],
|
|
555
|
+
SchemaDefinition: ["description", "directives", "operationTypes"],
|
|
556
|
+
OperationTypeDefinition: ["type"],
|
|
557
|
+
ScalarTypeDefinition: ["description", "name", "directives"],
|
|
558
|
+
ObjectTypeDefinition: [
|
|
559
|
+
"description",
|
|
560
|
+
"name",
|
|
561
|
+
"interfaces",
|
|
562
|
+
"directives",
|
|
563
|
+
"fields"
|
|
564
|
+
],
|
|
565
|
+
FieldDefinition: ["description", "name", "arguments", "type", "directives"],
|
|
566
|
+
InputValueDefinition: [
|
|
567
|
+
"description",
|
|
568
|
+
"name",
|
|
569
|
+
"type",
|
|
570
|
+
"defaultValue",
|
|
571
|
+
"directives"
|
|
572
|
+
],
|
|
573
|
+
InterfaceTypeDefinition: [
|
|
574
|
+
"description",
|
|
575
|
+
"name",
|
|
576
|
+
"interfaces",
|
|
577
|
+
"directives",
|
|
578
|
+
"fields"
|
|
579
|
+
],
|
|
580
|
+
UnionTypeDefinition: ["description", "name", "directives", "types"],
|
|
581
|
+
EnumTypeDefinition: ["description", "name", "directives", "values"],
|
|
582
|
+
EnumValueDefinition: ["description", "name", "directives"],
|
|
583
|
+
InputObjectTypeDefinition: ["description", "name", "directives", "fields"],
|
|
584
|
+
DirectiveDefinition: ["description", "name", "arguments", "locations"],
|
|
585
|
+
SchemaExtension: ["directives", "operationTypes"],
|
|
586
|
+
ScalarTypeExtension: ["name", "directives"],
|
|
587
|
+
ObjectTypeExtension: ["name", "interfaces", "directives", "fields"],
|
|
588
|
+
InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"],
|
|
589
|
+
UnionTypeExtension: ["name", "directives", "types"],
|
|
590
|
+
EnumTypeExtension: ["name", "directives", "values"],
|
|
591
|
+
InputObjectTypeExtension: ["name", "directives", "fields"]
|
|
592
|
+
};
|
|
593
|
+
const kindValues = new Set(Object.keys(QueryDocumentKeys));
|
|
594
|
+
function isNode(maybeNode) {
|
|
595
|
+
const maybeKind = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind;
|
|
596
|
+
return typeof maybeKind === "string" && kindValues.has(maybeKind);
|
|
597
|
+
}
|
|
598
|
+
var OperationTypeNode;
|
|
599
|
+
(function(OperationTypeNode2) {
|
|
600
|
+
OperationTypeNode2["QUERY"] = "query";
|
|
601
|
+
OperationTypeNode2["MUTATION"] = "mutation";
|
|
602
|
+
OperationTypeNode2["SUBSCRIPTION"] = "subscription";
|
|
603
|
+
})(OperationTypeNode || (OperationTypeNode = {}));
|
|
604
|
+
var DirectiveLocation;
|
|
605
|
+
(function(DirectiveLocation2) {
|
|
606
|
+
DirectiveLocation2["QUERY"] = "QUERY";
|
|
607
|
+
DirectiveLocation2["MUTATION"] = "MUTATION";
|
|
608
|
+
DirectiveLocation2["SUBSCRIPTION"] = "SUBSCRIPTION";
|
|
609
|
+
DirectiveLocation2["FIELD"] = "FIELD";
|
|
610
|
+
DirectiveLocation2["FRAGMENT_DEFINITION"] = "FRAGMENT_DEFINITION";
|
|
611
|
+
DirectiveLocation2["FRAGMENT_SPREAD"] = "FRAGMENT_SPREAD";
|
|
612
|
+
DirectiveLocation2["INLINE_FRAGMENT"] = "INLINE_FRAGMENT";
|
|
613
|
+
DirectiveLocation2["VARIABLE_DEFINITION"] = "VARIABLE_DEFINITION";
|
|
614
|
+
DirectiveLocation2["SCHEMA"] = "SCHEMA";
|
|
615
|
+
DirectiveLocation2["SCALAR"] = "SCALAR";
|
|
616
|
+
DirectiveLocation2["OBJECT"] = "OBJECT";
|
|
617
|
+
DirectiveLocation2["FIELD_DEFINITION"] = "FIELD_DEFINITION";
|
|
618
|
+
DirectiveLocation2["ARGUMENT_DEFINITION"] = "ARGUMENT_DEFINITION";
|
|
619
|
+
DirectiveLocation2["INTERFACE"] = "INTERFACE";
|
|
620
|
+
DirectiveLocation2["UNION"] = "UNION";
|
|
621
|
+
DirectiveLocation2["ENUM"] = "ENUM";
|
|
622
|
+
DirectiveLocation2["ENUM_VALUE"] = "ENUM_VALUE";
|
|
623
|
+
DirectiveLocation2["INPUT_OBJECT"] = "INPUT_OBJECT";
|
|
624
|
+
DirectiveLocation2["INPUT_FIELD_DEFINITION"] = "INPUT_FIELD_DEFINITION";
|
|
625
|
+
})(DirectiveLocation || (DirectiveLocation = {}));
|
|
626
|
+
var Kind;
|
|
627
|
+
(function(Kind2) {
|
|
628
|
+
Kind2["NAME"] = "Name";
|
|
629
|
+
Kind2["DOCUMENT"] = "Document";
|
|
630
|
+
Kind2["OPERATION_DEFINITION"] = "OperationDefinition";
|
|
631
|
+
Kind2["VARIABLE_DEFINITION"] = "VariableDefinition";
|
|
632
|
+
Kind2["SELECTION_SET"] = "SelectionSet";
|
|
633
|
+
Kind2["FIELD"] = "Field";
|
|
634
|
+
Kind2["ARGUMENT"] = "Argument";
|
|
635
|
+
Kind2["FRAGMENT_SPREAD"] = "FragmentSpread";
|
|
636
|
+
Kind2["INLINE_FRAGMENT"] = "InlineFragment";
|
|
637
|
+
Kind2["FRAGMENT_DEFINITION"] = "FragmentDefinition";
|
|
638
|
+
Kind2["VARIABLE"] = "Variable";
|
|
639
|
+
Kind2["INT"] = "IntValue";
|
|
640
|
+
Kind2["FLOAT"] = "FloatValue";
|
|
641
|
+
Kind2["STRING"] = "StringValue";
|
|
642
|
+
Kind2["BOOLEAN"] = "BooleanValue";
|
|
643
|
+
Kind2["NULL"] = "NullValue";
|
|
644
|
+
Kind2["ENUM"] = "EnumValue";
|
|
645
|
+
Kind2["LIST"] = "ListValue";
|
|
646
|
+
Kind2["OBJECT"] = "ObjectValue";
|
|
647
|
+
Kind2["OBJECT_FIELD"] = "ObjectField";
|
|
648
|
+
Kind2["DIRECTIVE"] = "Directive";
|
|
649
|
+
Kind2["NAMED_TYPE"] = "NamedType";
|
|
650
|
+
Kind2["LIST_TYPE"] = "ListType";
|
|
651
|
+
Kind2["NON_NULL_TYPE"] = "NonNullType";
|
|
652
|
+
Kind2["SCHEMA_DEFINITION"] = "SchemaDefinition";
|
|
653
|
+
Kind2["OPERATION_TYPE_DEFINITION"] = "OperationTypeDefinition";
|
|
654
|
+
Kind2["SCALAR_TYPE_DEFINITION"] = "ScalarTypeDefinition";
|
|
655
|
+
Kind2["OBJECT_TYPE_DEFINITION"] = "ObjectTypeDefinition";
|
|
656
|
+
Kind2["FIELD_DEFINITION"] = "FieldDefinition";
|
|
657
|
+
Kind2["INPUT_VALUE_DEFINITION"] = "InputValueDefinition";
|
|
658
|
+
Kind2["INTERFACE_TYPE_DEFINITION"] = "InterfaceTypeDefinition";
|
|
659
|
+
Kind2["UNION_TYPE_DEFINITION"] = "UnionTypeDefinition";
|
|
660
|
+
Kind2["ENUM_TYPE_DEFINITION"] = "EnumTypeDefinition";
|
|
661
|
+
Kind2["ENUM_VALUE_DEFINITION"] = "EnumValueDefinition";
|
|
662
|
+
Kind2["INPUT_OBJECT_TYPE_DEFINITION"] = "InputObjectTypeDefinition";
|
|
663
|
+
Kind2["DIRECTIVE_DEFINITION"] = "DirectiveDefinition";
|
|
664
|
+
Kind2["SCHEMA_EXTENSION"] = "SchemaExtension";
|
|
665
|
+
Kind2["SCALAR_TYPE_EXTENSION"] = "ScalarTypeExtension";
|
|
666
|
+
Kind2["OBJECT_TYPE_EXTENSION"] = "ObjectTypeExtension";
|
|
667
|
+
Kind2["INTERFACE_TYPE_EXTENSION"] = "InterfaceTypeExtension";
|
|
668
|
+
Kind2["UNION_TYPE_EXTENSION"] = "UnionTypeExtension";
|
|
669
|
+
Kind2["ENUM_TYPE_EXTENSION"] = "EnumTypeExtension";
|
|
670
|
+
Kind2["INPUT_OBJECT_TYPE_EXTENSION"] = "InputObjectTypeExtension";
|
|
671
|
+
})(Kind || (Kind = {}));
|
|
672
|
+
function isWhiteSpace(code) {
|
|
673
|
+
return code === 9 || code === 32;
|
|
674
|
+
}
|
|
675
|
+
function isDigit(code) {
|
|
676
|
+
return code >= 48 && code <= 57;
|
|
677
|
+
}
|
|
678
|
+
function isLetter(code) {
|
|
679
|
+
return code >= 97 && code <= 122 || // A-Z
|
|
680
|
+
code >= 65 && code <= 90;
|
|
681
|
+
}
|
|
682
|
+
function isNameStart(code) {
|
|
683
|
+
return isLetter(code) || code === 95;
|
|
684
|
+
}
|
|
685
|
+
function isNameContinue(code) {
|
|
686
|
+
return isLetter(code) || isDigit(code) || code === 95;
|
|
687
|
+
}
|
|
688
|
+
function dedentBlockStringLines(lines) {
|
|
689
|
+
var _firstNonEmptyLine2;
|
|
690
|
+
let commonIndent = Number.MAX_SAFE_INTEGER;
|
|
691
|
+
let firstNonEmptyLine = null;
|
|
692
|
+
let lastNonEmptyLine = -1;
|
|
693
|
+
for (let i2 = 0; i2 < lines.length; ++i2) {
|
|
694
|
+
var _firstNonEmptyLine;
|
|
695
|
+
const line = lines[i2];
|
|
696
|
+
const indent2 = leadingWhitespace(line);
|
|
697
|
+
if (indent2 === line.length) {
|
|
698
|
+
continue;
|
|
699
|
+
}
|
|
700
|
+
firstNonEmptyLine = (_firstNonEmptyLine = firstNonEmptyLine) !== null && _firstNonEmptyLine !== void 0 ? _firstNonEmptyLine : i2;
|
|
701
|
+
lastNonEmptyLine = i2;
|
|
702
|
+
if (i2 !== 0 && indent2 < commonIndent) {
|
|
703
|
+
commonIndent = indent2;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
return lines.map((line, i2) => i2 === 0 ? line : line.slice(commonIndent)).slice(
|
|
707
|
+
(_firstNonEmptyLine2 = firstNonEmptyLine) !== null && _firstNonEmptyLine2 !== void 0 ? _firstNonEmptyLine2 : 0,
|
|
708
|
+
lastNonEmptyLine + 1
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
function leadingWhitespace(str) {
|
|
712
|
+
let i2 = 0;
|
|
713
|
+
while (i2 < str.length && isWhiteSpace(str.charCodeAt(i2))) {
|
|
714
|
+
++i2;
|
|
715
|
+
}
|
|
716
|
+
return i2;
|
|
717
|
+
}
|
|
718
|
+
function printBlockString(value, options) {
|
|
719
|
+
const escapedValue = value.replace(/"""/g, '\\"""');
|
|
720
|
+
const lines = escapedValue.split(/\r\n|[\n\r]/g);
|
|
721
|
+
const isSingleLine = lines.length === 1;
|
|
722
|
+
const forceLeadingNewLine = lines.length > 1 && lines.slice(1).every((line) => line.length === 0 || isWhiteSpace(line.charCodeAt(0)));
|
|
723
|
+
const hasTrailingTripleQuotes = escapedValue.endsWith('\\"""');
|
|
724
|
+
const hasTrailingQuote = value.endsWith('"') && !hasTrailingTripleQuotes;
|
|
725
|
+
const hasTrailingSlash = value.endsWith("\\");
|
|
726
|
+
const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash;
|
|
727
|
+
const printAsMultipleLines = !(options !== null && options !== void 0 && options.minimize) && // add leading and trailing new lines only if it improves readability
|
|
728
|
+
(!isSingleLine || value.length > 70 || forceTrailingNewline || forceLeadingNewLine || hasTrailingTripleQuotes);
|
|
729
|
+
let result = "";
|
|
730
|
+
const skipLeadingNewLine = isSingleLine && isWhiteSpace(value.charCodeAt(0));
|
|
731
|
+
if (printAsMultipleLines && !skipLeadingNewLine || forceLeadingNewLine) {
|
|
732
|
+
result += "\n";
|
|
733
|
+
}
|
|
734
|
+
result += escapedValue;
|
|
735
|
+
if (printAsMultipleLines || forceTrailingNewline) {
|
|
736
|
+
result += "\n";
|
|
737
|
+
}
|
|
738
|
+
return '"""' + result + '"""';
|
|
739
|
+
}
|
|
740
|
+
var TokenKind;
|
|
741
|
+
(function(TokenKind2) {
|
|
742
|
+
TokenKind2["SOF"] = "<SOF>";
|
|
743
|
+
TokenKind2["EOF"] = "<EOF>";
|
|
744
|
+
TokenKind2["BANG"] = "!";
|
|
745
|
+
TokenKind2["DOLLAR"] = "$";
|
|
746
|
+
TokenKind2["AMP"] = "&";
|
|
747
|
+
TokenKind2["PAREN_L"] = "(";
|
|
748
|
+
TokenKind2["PAREN_R"] = ")";
|
|
749
|
+
TokenKind2["SPREAD"] = "...";
|
|
750
|
+
TokenKind2["COLON"] = ":";
|
|
751
|
+
TokenKind2["EQUALS"] = "=";
|
|
752
|
+
TokenKind2["AT"] = "@";
|
|
753
|
+
TokenKind2["BRACKET_L"] = "[";
|
|
754
|
+
TokenKind2["BRACKET_R"] = "]";
|
|
755
|
+
TokenKind2["BRACE_L"] = "{";
|
|
756
|
+
TokenKind2["PIPE"] = "|";
|
|
757
|
+
TokenKind2["BRACE_R"] = "}";
|
|
758
|
+
TokenKind2["NAME"] = "Name";
|
|
759
|
+
TokenKind2["INT"] = "Int";
|
|
760
|
+
TokenKind2["FLOAT"] = "Float";
|
|
761
|
+
TokenKind2["STRING"] = "String";
|
|
762
|
+
TokenKind2["BLOCK_STRING"] = "BlockString";
|
|
763
|
+
TokenKind2["COMMENT"] = "Comment";
|
|
764
|
+
})(TokenKind || (TokenKind = {}));
|
|
765
|
+
class Lexer {
|
|
766
|
+
/**
|
|
767
|
+
* The previously focused non-ignored token.
|
|
768
|
+
*/
|
|
769
|
+
/**
|
|
770
|
+
* The currently focused non-ignored token.
|
|
771
|
+
*/
|
|
772
|
+
/**
|
|
773
|
+
* The (1-indexed) line containing the current token.
|
|
774
|
+
*/
|
|
775
|
+
/**
|
|
776
|
+
* The character offset at which the current line begins.
|
|
777
|
+
*/
|
|
778
|
+
constructor(source) {
|
|
779
|
+
const startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0);
|
|
780
|
+
this.source = source;
|
|
781
|
+
this.lastToken = startOfFileToken;
|
|
782
|
+
this.token = startOfFileToken;
|
|
783
|
+
this.line = 1;
|
|
784
|
+
this.lineStart = 0;
|
|
785
|
+
}
|
|
786
|
+
get [Symbol.toStringTag]() {
|
|
787
|
+
return "Lexer";
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Advances the token stream to the next non-ignored token.
|
|
791
|
+
*/
|
|
792
|
+
advance() {
|
|
793
|
+
this.lastToken = this.token;
|
|
794
|
+
const token = this.token = this.lookahead();
|
|
795
|
+
return token;
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Looks ahead and returns the next non-ignored token, but does not change
|
|
799
|
+
* the state of Lexer.
|
|
800
|
+
*/
|
|
801
|
+
lookahead() {
|
|
802
|
+
let token = this.token;
|
|
803
|
+
if (token.kind !== TokenKind.EOF) {
|
|
804
|
+
do {
|
|
805
|
+
if (token.next) {
|
|
806
|
+
token = token.next;
|
|
807
|
+
} else {
|
|
808
|
+
const nextToken = readNextToken(this, token.end);
|
|
809
|
+
token.next = nextToken;
|
|
810
|
+
nextToken.prev = token;
|
|
811
|
+
token = nextToken;
|
|
812
|
+
}
|
|
813
|
+
} while (token.kind === TokenKind.COMMENT);
|
|
814
|
+
}
|
|
815
|
+
return token;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
function isPunctuatorTokenKind(kind) {
|
|
819
|
+
return kind === TokenKind.BANG || kind === TokenKind.DOLLAR || kind === TokenKind.AMP || kind === TokenKind.PAREN_L || kind === TokenKind.PAREN_R || kind === TokenKind.SPREAD || kind === TokenKind.COLON || kind === TokenKind.EQUALS || kind === TokenKind.AT || kind === TokenKind.BRACKET_L || kind === TokenKind.BRACKET_R || kind === TokenKind.BRACE_L || kind === TokenKind.PIPE || kind === TokenKind.BRACE_R;
|
|
820
|
+
}
|
|
821
|
+
function isUnicodeScalarValue(code) {
|
|
822
|
+
return code >= 0 && code <= 55295 || code >= 57344 && code <= 1114111;
|
|
823
|
+
}
|
|
824
|
+
function isSupplementaryCodePoint(body, location) {
|
|
825
|
+
return isLeadingSurrogate(body.charCodeAt(location)) && isTrailingSurrogate(body.charCodeAt(location + 1));
|
|
826
|
+
}
|
|
827
|
+
function isLeadingSurrogate(code) {
|
|
828
|
+
return code >= 55296 && code <= 56319;
|
|
829
|
+
}
|
|
830
|
+
function isTrailingSurrogate(code) {
|
|
831
|
+
return code >= 56320 && code <= 57343;
|
|
832
|
+
}
|
|
833
|
+
function printCodePointAt(lexer, location) {
|
|
834
|
+
const code = lexer.source.body.codePointAt(location);
|
|
835
|
+
if (code === void 0) {
|
|
836
|
+
return TokenKind.EOF;
|
|
837
|
+
} else if (code >= 32 && code <= 126) {
|
|
838
|
+
const char = String.fromCodePoint(code);
|
|
839
|
+
return char === '"' ? `'"'` : `"${char}"`;
|
|
840
|
+
}
|
|
841
|
+
return "U+" + code.toString(16).toUpperCase().padStart(4, "0");
|
|
842
|
+
}
|
|
843
|
+
function createToken(lexer, kind, start2, end, value) {
|
|
844
|
+
const line = lexer.line;
|
|
845
|
+
const col = 1 + start2 - lexer.lineStart;
|
|
846
|
+
return new Token(kind, start2, end, line, col, value);
|
|
847
|
+
}
|
|
848
|
+
function readNextToken(lexer, start2) {
|
|
849
|
+
const body = lexer.source.body;
|
|
850
|
+
const bodyLength = body.length;
|
|
851
|
+
let position = start2;
|
|
852
|
+
while (position < bodyLength) {
|
|
853
|
+
const code = body.charCodeAt(position);
|
|
854
|
+
switch (code) {
|
|
855
|
+
case 65279:
|
|
856
|
+
case 9:
|
|
857
|
+
case 32:
|
|
858
|
+
case 44:
|
|
859
|
+
++position;
|
|
860
|
+
continue;
|
|
861
|
+
case 10:
|
|
862
|
+
++position;
|
|
863
|
+
++lexer.line;
|
|
864
|
+
lexer.lineStart = position;
|
|
865
|
+
continue;
|
|
866
|
+
case 13:
|
|
867
|
+
if (body.charCodeAt(position + 1) === 10) {
|
|
868
|
+
position += 2;
|
|
869
|
+
} else {
|
|
870
|
+
++position;
|
|
871
|
+
}
|
|
872
|
+
++lexer.line;
|
|
873
|
+
lexer.lineStart = position;
|
|
874
|
+
continue;
|
|
875
|
+
case 35:
|
|
876
|
+
return readComment(lexer, position);
|
|
877
|
+
case 33:
|
|
878
|
+
return createToken(lexer, TokenKind.BANG, position, position + 1);
|
|
879
|
+
case 36:
|
|
880
|
+
return createToken(lexer, TokenKind.DOLLAR, position, position + 1);
|
|
881
|
+
case 38:
|
|
882
|
+
return createToken(lexer, TokenKind.AMP, position, position + 1);
|
|
883
|
+
case 40:
|
|
884
|
+
return createToken(lexer, TokenKind.PAREN_L, position, position + 1);
|
|
885
|
+
case 41:
|
|
886
|
+
return createToken(lexer, TokenKind.PAREN_R, position, position + 1);
|
|
887
|
+
case 46:
|
|
888
|
+
if (body.charCodeAt(position + 1) === 46 && body.charCodeAt(position + 2) === 46) {
|
|
889
|
+
return createToken(lexer, TokenKind.SPREAD, position, position + 3);
|
|
890
|
+
}
|
|
891
|
+
break;
|
|
892
|
+
case 58:
|
|
893
|
+
return createToken(lexer, TokenKind.COLON, position, position + 1);
|
|
894
|
+
case 61:
|
|
895
|
+
return createToken(lexer, TokenKind.EQUALS, position, position + 1);
|
|
896
|
+
case 64:
|
|
897
|
+
return createToken(lexer, TokenKind.AT, position, position + 1);
|
|
898
|
+
case 91:
|
|
899
|
+
return createToken(lexer, TokenKind.BRACKET_L, position, position + 1);
|
|
900
|
+
case 93:
|
|
901
|
+
return createToken(lexer, TokenKind.BRACKET_R, position, position + 1);
|
|
902
|
+
case 123:
|
|
903
|
+
return createToken(lexer, TokenKind.BRACE_L, position, position + 1);
|
|
904
|
+
case 124:
|
|
905
|
+
return createToken(lexer, TokenKind.PIPE, position, position + 1);
|
|
906
|
+
case 125:
|
|
907
|
+
return createToken(lexer, TokenKind.BRACE_R, position, position + 1);
|
|
908
|
+
case 34:
|
|
909
|
+
if (body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) {
|
|
910
|
+
return readBlockString(lexer, position);
|
|
911
|
+
}
|
|
912
|
+
return readString(lexer, position);
|
|
913
|
+
}
|
|
914
|
+
if (isDigit(code) || code === 45) {
|
|
915
|
+
return readNumber(lexer, position, code);
|
|
916
|
+
}
|
|
917
|
+
if (isNameStart(code)) {
|
|
918
|
+
return readName(lexer, position);
|
|
919
|
+
}
|
|
920
|
+
throw syntaxError(
|
|
921
|
+
lexer.source,
|
|
922
|
+
position,
|
|
923
|
+
code === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : isUnicodeScalarValue(code) || isSupplementaryCodePoint(body, position) ? `Unexpected character: ${printCodePointAt(lexer, position)}.` : `Invalid character: ${printCodePointAt(lexer, position)}.`
|
|
924
|
+
);
|
|
925
|
+
}
|
|
926
|
+
return createToken(lexer, TokenKind.EOF, bodyLength, bodyLength);
|
|
927
|
+
}
|
|
928
|
+
function readComment(lexer, start2) {
|
|
929
|
+
const body = lexer.source.body;
|
|
930
|
+
const bodyLength = body.length;
|
|
931
|
+
let position = start2 + 1;
|
|
932
|
+
while (position < bodyLength) {
|
|
933
|
+
const code = body.charCodeAt(position);
|
|
934
|
+
if (code === 10 || code === 13) {
|
|
935
|
+
break;
|
|
936
|
+
}
|
|
937
|
+
if (isUnicodeScalarValue(code)) {
|
|
938
|
+
++position;
|
|
939
|
+
} else if (isSupplementaryCodePoint(body, position)) {
|
|
940
|
+
position += 2;
|
|
941
|
+
} else {
|
|
942
|
+
break;
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
return createToken(
|
|
946
|
+
lexer,
|
|
947
|
+
TokenKind.COMMENT,
|
|
948
|
+
start2,
|
|
949
|
+
position,
|
|
950
|
+
body.slice(start2 + 1, position)
|
|
951
|
+
);
|
|
952
|
+
}
|
|
953
|
+
function readNumber(lexer, start2, firstCode) {
|
|
954
|
+
const body = lexer.source.body;
|
|
955
|
+
let position = start2;
|
|
956
|
+
let code = firstCode;
|
|
957
|
+
let isFloat = false;
|
|
958
|
+
if (code === 45) {
|
|
959
|
+
code = body.charCodeAt(++position);
|
|
960
|
+
}
|
|
961
|
+
if (code === 48) {
|
|
962
|
+
code = body.charCodeAt(++position);
|
|
963
|
+
if (isDigit(code)) {
|
|
964
|
+
throw syntaxError(
|
|
965
|
+
lexer.source,
|
|
966
|
+
position,
|
|
967
|
+
`Invalid number, unexpected digit after 0: ${printCodePointAt(
|
|
968
|
+
lexer,
|
|
969
|
+
position
|
|
970
|
+
)}.`
|
|
971
|
+
);
|
|
972
|
+
}
|
|
973
|
+
} else {
|
|
974
|
+
position = readDigits(lexer, position, code);
|
|
975
|
+
code = body.charCodeAt(position);
|
|
976
|
+
}
|
|
977
|
+
if (code === 46) {
|
|
978
|
+
isFloat = true;
|
|
979
|
+
code = body.charCodeAt(++position);
|
|
980
|
+
position = readDigits(lexer, position, code);
|
|
981
|
+
code = body.charCodeAt(position);
|
|
982
|
+
}
|
|
983
|
+
if (code === 69 || code === 101) {
|
|
984
|
+
isFloat = true;
|
|
985
|
+
code = body.charCodeAt(++position);
|
|
986
|
+
if (code === 43 || code === 45) {
|
|
987
|
+
code = body.charCodeAt(++position);
|
|
988
|
+
}
|
|
989
|
+
position = readDigits(lexer, position, code);
|
|
990
|
+
code = body.charCodeAt(position);
|
|
991
|
+
}
|
|
992
|
+
if (code === 46 || isNameStart(code)) {
|
|
993
|
+
throw syntaxError(
|
|
994
|
+
lexer.source,
|
|
995
|
+
position,
|
|
996
|
+
`Invalid number, expected digit but got: ${printCodePointAt(
|
|
997
|
+
lexer,
|
|
998
|
+
position
|
|
999
|
+
)}.`
|
|
1000
|
+
);
|
|
1001
|
+
}
|
|
1002
|
+
return createToken(
|
|
1003
|
+
lexer,
|
|
1004
|
+
isFloat ? TokenKind.FLOAT : TokenKind.INT,
|
|
1005
|
+
start2,
|
|
1006
|
+
position,
|
|
1007
|
+
body.slice(start2, position)
|
|
1008
|
+
);
|
|
1009
|
+
}
|
|
1010
|
+
function readDigits(lexer, start2, firstCode) {
|
|
1011
|
+
if (!isDigit(firstCode)) {
|
|
1012
|
+
throw syntaxError(
|
|
1013
|
+
lexer.source,
|
|
1014
|
+
start2,
|
|
1015
|
+
`Invalid number, expected digit but got: ${printCodePointAt(
|
|
1016
|
+
lexer,
|
|
1017
|
+
start2
|
|
1018
|
+
)}.`
|
|
1019
|
+
);
|
|
1020
|
+
}
|
|
1021
|
+
const body = lexer.source.body;
|
|
1022
|
+
let position = start2 + 1;
|
|
1023
|
+
while (isDigit(body.charCodeAt(position))) {
|
|
1024
|
+
++position;
|
|
1025
|
+
}
|
|
1026
|
+
return position;
|
|
1027
|
+
}
|
|
1028
|
+
function readString(lexer, start2) {
|
|
1029
|
+
const body = lexer.source.body;
|
|
1030
|
+
const bodyLength = body.length;
|
|
1031
|
+
let position = start2 + 1;
|
|
1032
|
+
let chunkStart = position;
|
|
1033
|
+
let value = "";
|
|
1034
|
+
while (position < bodyLength) {
|
|
1035
|
+
const code = body.charCodeAt(position);
|
|
1036
|
+
if (code === 34) {
|
|
1037
|
+
value += body.slice(chunkStart, position);
|
|
1038
|
+
return createToken(lexer, TokenKind.STRING, start2, position + 1, value);
|
|
1039
|
+
}
|
|
1040
|
+
if (code === 92) {
|
|
1041
|
+
value += body.slice(chunkStart, position);
|
|
1042
|
+
const escape = body.charCodeAt(position + 1) === 117 ? body.charCodeAt(position + 2) === 123 ? readEscapedUnicodeVariableWidth(lexer, position) : readEscapedUnicodeFixedWidth(lexer, position) : readEscapedCharacter(lexer, position);
|
|
1043
|
+
value += escape.value;
|
|
1044
|
+
position += escape.size;
|
|
1045
|
+
chunkStart = position;
|
|
1046
|
+
continue;
|
|
1047
|
+
}
|
|
1048
|
+
if (code === 10 || code === 13) {
|
|
1049
|
+
break;
|
|
1050
|
+
}
|
|
1051
|
+
if (isUnicodeScalarValue(code)) {
|
|
1052
|
+
++position;
|
|
1053
|
+
} else if (isSupplementaryCodePoint(body, position)) {
|
|
1054
|
+
position += 2;
|
|
1055
|
+
} else {
|
|
1056
|
+
throw syntaxError(
|
|
1057
|
+
lexer.source,
|
|
1058
|
+
position,
|
|
1059
|
+
`Invalid character within String: ${printCodePointAt(
|
|
1060
|
+
lexer,
|
|
1061
|
+
position
|
|
1062
|
+
)}.`
|
|
1063
|
+
);
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
throw syntaxError(lexer.source, position, "Unterminated string.");
|
|
1067
|
+
}
|
|
1068
|
+
function readEscapedUnicodeVariableWidth(lexer, position) {
|
|
1069
|
+
const body = lexer.source.body;
|
|
1070
|
+
let point = 0;
|
|
1071
|
+
let size = 3;
|
|
1072
|
+
while (size < 12) {
|
|
1073
|
+
const code = body.charCodeAt(position + size++);
|
|
1074
|
+
if (code === 125) {
|
|
1075
|
+
if (size < 5 || !isUnicodeScalarValue(point)) {
|
|
1076
|
+
break;
|
|
1077
|
+
}
|
|
1078
|
+
return {
|
|
1079
|
+
value: String.fromCodePoint(point),
|
|
1080
|
+
size
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
point = point << 4 | readHexDigit(code);
|
|
1084
|
+
if (point < 0) {
|
|
1085
|
+
break;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
throw syntaxError(
|
|
1089
|
+
lexer.source,
|
|
1090
|
+
position,
|
|
1091
|
+
`Invalid Unicode escape sequence: "${body.slice(
|
|
1092
|
+
position,
|
|
1093
|
+
position + size
|
|
1094
|
+
)}".`
|
|
1095
|
+
);
|
|
1096
|
+
}
|
|
1097
|
+
function readEscapedUnicodeFixedWidth(lexer, position) {
|
|
1098
|
+
const body = lexer.source.body;
|
|
1099
|
+
const code = read16BitHexCode(body, position + 2);
|
|
1100
|
+
if (isUnicodeScalarValue(code)) {
|
|
1101
|
+
return {
|
|
1102
|
+
value: String.fromCodePoint(code),
|
|
1103
|
+
size: 6
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1106
|
+
if (isLeadingSurrogate(code)) {
|
|
1107
|
+
if (body.charCodeAt(position + 6) === 92 && body.charCodeAt(position + 7) === 117) {
|
|
1108
|
+
const trailingCode = read16BitHexCode(body, position + 8);
|
|
1109
|
+
if (isTrailingSurrogate(trailingCode)) {
|
|
1110
|
+
return {
|
|
1111
|
+
value: String.fromCodePoint(code, trailingCode),
|
|
1112
|
+
size: 12
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
throw syntaxError(
|
|
1118
|
+
lexer.source,
|
|
1119
|
+
position,
|
|
1120
|
+
`Invalid Unicode escape sequence: "${body.slice(position, position + 6)}".`
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
1123
|
+
function read16BitHexCode(body, position) {
|
|
1124
|
+
return readHexDigit(body.charCodeAt(position)) << 12 | readHexDigit(body.charCodeAt(position + 1)) << 8 | readHexDigit(body.charCodeAt(position + 2)) << 4 | readHexDigit(body.charCodeAt(position + 3));
|
|
1125
|
+
}
|
|
1126
|
+
function readHexDigit(code) {
|
|
1127
|
+
return code >= 48 && code <= 57 ? code - 48 : code >= 65 && code <= 70 ? code - 55 : code >= 97 && code <= 102 ? code - 87 : -1;
|
|
1128
|
+
}
|
|
1129
|
+
function readEscapedCharacter(lexer, position) {
|
|
1130
|
+
const body = lexer.source.body;
|
|
1131
|
+
const code = body.charCodeAt(position + 1);
|
|
1132
|
+
switch (code) {
|
|
1133
|
+
case 34:
|
|
1134
|
+
return {
|
|
1135
|
+
value: '"',
|
|
1136
|
+
size: 2
|
|
1137
|
+
};
|
|
1138
|
+
case 92:
|
|
1139
|
+
return {
|
|
1140
|
+
value: "\\",
|
|
1141
|
+
size: 2
|
|
1142
|
+
};
|
|
1143
|
+
case 47:
|
|
1144
|
+
return {
|
|
1145
|
+
value: "/",
|
|
1146
|
+
size: 2
|
|
1147
|
+
};
|
|
1148
|
+
case 98:
|
|
1149
|
+
return {
|
|
1150
|
+
value: "\b",
|
|
1151
|
+
size: 2
|
|
1152
|
+
};
|
|
1153
|
+
case 102:
|
|
1154
|
+
return {
|
|
1155
|
+
value: "\f",
|
|
1156
|
+
size: 2
|
|
1157
|
+
};
|
|
1158
|
+
case 110:
|
|
1159
|
+
return {
|
|
1160
|
+
value: "\n",
|
|
1161
|
+
size: 2
|
|
1162
|
+
};
|
|
1163
|
+
case 114:
|
|
1164
|
+
return {
|
|
1165
|
+
value: "\r",
|
|
1166
|
+
size: 2
|
|
1167
|
+
};
|
|
1168
|
+
case 116:
|
|
1169
|
+
return {
|
|
1170
|
+
value: " ",
|
|
1171
|
+
size: 2
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1174
|
+
throw syntaxError(
|
|
1175
|
+
lexer.source,
|
|
1176
|
+
position,
|
|
1177
|
+
`Invalid character escape sequence: "${body.slice(
|
|
1178
|
+
position,
|
|
1179
|
+
position + 2
|
|
1180
|
+
)}".`
|
|
1181
|
+
);
|
|
1182
|
+
}
|
|
1183
|
+
function readBlockString(lexer, start2) {
|
|
1184
|
+
const body = lexer.source.body;
|
|
1185
|
+
const bodyLength = body.length;
|
|
1186
|
+
let lineStart = lexer.lineStart;
|
|
1187
|
+
let position = start2 + 3;
|
|
1188
|
+
let chunkStart = position;
|
|
1189
|
+
let currentLine = "";
|
|
1190
|
+
const blockLines = [];
|
|
1191
|
+
while (position < bodyLength) {
|
|
1192
|
+
const code = body.charCodeAt(position);
|
|
1193
|
+
if (code === 34 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) {
|
|
1194
|
+
currentLine += body.slice(chunkStart, position);
|
|
1195
|
+
blockLines.push(currentLine);
|
|
1196
|
+
const token = createToken(
|
|
1197
|
+
lexer,
|
|
1198
|
+
TokenKind.BLOCK_STRING,
|
|
1199
|
+
start2,
|
|
1200
|
+
position + 3,
|
|
1201
|
+
// Return a string of the lines joined with U+000A.
|
|
1202
|
+
dedentBlockStringLines(blockLines).join("\n")
|
|
1203
|
+
);
|
|
1204
|
+
lexer.line += blockLines.length - 1;
|
|
1205
|
+
lexer.lineStart = lineStart;
|
|
1206
|
+
return token;
|
|
1207
|
+
}
|
|
1208
|
+
if (code === 92 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34 && body.charCodeAt(position + 3) === 34) {
|
|
1209
|
+
currentLine += body.slice(chunkStart, position);
|
|
1210
|
+
chunkStart = position + 1;
|
|
1211
|
+
position += 4;
|
|
1212
|
+
continue;
|
|
1213
|
+
}
|
|
1214
|
+
if (code === 10 || code === 13) {
|
|
1215
|
+
currentLine += body.slice(chunkStart, position);
|
|
1216
|
+
blockLines.push(currentLine);
|
|
1217
|
+
if (code === 13 && body.charCodeAt(position + 1) === 10) {
|
|
1218
|
+
position += 2;
|
|
1219
|
+
} else {
|
|
1220
|
+
++position;
|
|
1221
|
+
}
|
|
1222
|
+
currentLine = "";
|
|
1223
|
+
chunkStart = position;
|
|
1224
|
+
lineStart = position;
|
|
1225
|
+
continue;
|
|
1226
|
+
}
|
|
1227
|
+
if (isUnicodeScalarValue(code)) {
|
|
1228
|
+
++position;
|
|
1229
|
+
} else if (isSupplementaryCodePoint(body, position)) {
|
|
1230
|
+
position += 2;
|
|
1231
|
+
} else {
|
|
1232
|
+
throw syntaxError(
|
|
1233
|
+
lexer.source,
|
|
1234
|
+
position,
|
|
1235
|
+
`Invalid character within String: ${printCodePointAt(
|
|
1236
|
+
lexer,
|
|
1237
|
+
position
|
|
1238
|
+
)}.`
|
|
1239
|
+
);
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
throw syntaxError(lexer.source, position, "Unterminated string.");
|
|
1243
|
+
}
|
|
1244
|
+
function readName(lexer, start2) {
|
|
1245
|
+
const body = lexer.source.body;
|
|
1246
|
+
const bodyLength = body.length;
|
|
1247
|
+
let position = start2 + 1;
|
|
1248
|
+
while (position < bodyLength) {
|
|
1249
|
+
const code = body.charCodeAt(position);
|
|
1250
|
+
if (isNameContinue(code)) {
|
|
1251
|
+
++position;
|
|
1252
|
+
} else {
|
|
1253
|
+
break;
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
return createToken(
|
|
1257
|
+
lexer,
|
|
1258
|
+
TokenKind.NAME,
|
|
1259
|
+
start2,
|
|
1260
|
+
position,
|
|
1261
|
+
body.slice(start2, position)
|
|
1262
|
+
);
|
|
1263
|
+
}
|
|
1264
|
+
const MAX_ARRAY_LENGTH = 10;
|
|
1265
|
+
const MAX_RECURSIVE_DEPTH = 2;
|
|
1266
|
+
function inspect(value) {
|
|
1267
|
+
return formatValue(value, []);
|
|
1268
|
+
}
|
|
1269
|
+
function formatValue(value, seenValues) {
|
|
1270
|
+
switch (typeof value) {
|
|
1271
|
+
case "string":
|
|
1272
|
+
return JSON.stringify(value);
|
|
1273
|
+
case "function":
|
|
1274
|
+
return value.name ? `[function ${value.name}]` : "[function]";
|
|
1275
|
+
case "object":
|
|
1276
|
+
return formatObjectValue(value, seenValues);
|
|
1277
|
+
default:
|
|
1278
|
+
return String(value);
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
function formatObjectValue(value, previouslySeenValues) {
|
|
1282
|
+
if (value === null) {
|
|
1283
|
+
return "null";
|
|
1284
|
+
}
|
|
1285
|
+
if (previouslySeenValues.includes(value)) {
|
|
1286
|
+
return "[Circular]";
|
|
1287
|
+
}
|
|
1288
|
+
const seenValues = [...previouslySeenValues, value];
|
|
1289
|
+
if (isJSONable(value)) {
|
|
1290
|
+
const jsonValue = value.toJSON();
|
|
1291
|
+
if (jsonValue !== value) {
|
|
1292
|
+
return typeof jsonValue === "string" ? jsonValue : formatValue(jsonValue, seenValues);
|
|
1293
|
+
}
|
|
1294
|
+
} else if (Array.isArray(value)) {
|
|
1295
|
+
return formatArray(value, seenValues);
|
|
1296
|
+
}
|
|
1297
|
+
return formatObject(value, seenValues);
|
|
1298
|
+
}
|
|
1299
|
+
function isJSONable(value) {
|
|
1300
|
+
return typeof value.toJSON === "function";
|
|
1301
|
+
}
|
|
1302
|
+
function formatObject(object, seenValues) {
|
|
1303
|
+
const entries = Object.entries(object);
|
|
1304
|
+
if (entries.length === 0) {
|
|
1305
|
+
return "{}";
|
|
1306
|
+
}
|
|
1307
|
+
if (seenValues.length > MAX_RECURSIVE_DEPTH) {
|
|
1308
|
+
return "[" + getObjectTag(object) + "]";
|
|
1309
|
+
}
|
|
1310
|
+
const properties = entries.map(
|
|
1311
|
+
([key, value]) => key + ": " + formatValue(value, seenValues)
|
|
1312
|
+
);
|
|
1313
|
+
return "{ " + properties.join(", ") + " }";
|
|
1314
|
+
}
|
|
1315
|
+
function formatArray(array, seenValues) {
|
|
1316
|
+
if (array.length === 0) {
|
|
1317
|
+
return "[]";
|
|
1318
|
+
}
|
|
1319
|
+
if (seenValues.length > MAX_RECURSIVE_DEPTH) {
|
|
1320
|
+
return "[Array]";
|
|
1321
|
+
}
|
|
1322
|
+
const len = Math.min(MAX_ARRAY_LENGTH, array.length);
|
|
1323
|
+
const remaining = array.length - len;
|
|
1324
|
+
const items = [];
|
|
1325
|
+
for (let i2 = 0; i2 < len; ++i2) {
|
|
1326
|
+
items.push(formatValue(array[i2], seenValues));
|
|
1327
|
+
}
|
|
1328
|
+
if (remaining === 1) {
|
|
1329
|
+
items.push("... 1 more item");
|
|
1330
|
+
} else if (remaining > 1) {
|
|
1331
|
+
items.push(`... ${remaining} more items`);
|
|
1332
|
+
}
|
|
1333
|
+
return "[" + items.join(", ") + "]";
|
|
1334
|
+
}
|
|
1335
|
+
function getObjectTag(object) {
|
|
1336
|
+
const tag = Object.prototype.toString.call(object).replace(/^\[object /, "").replace(/]$/, "");
|
|
1337
|
+
if (tag === "Object" && typeof object.constructor === "function") {
|
|
1338
|
+
const name = object.constructor.name;
|
|
1339
|
+
if (typeof name === "string" && name !== "") {
|
|
1340
|
+
return name;
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
return tag;
|
|
1344
|
+
}
|
|
1345
|
+
const instanceOf = (
|
|
1346
|
+
/* c8 ignore next 6 */
|
|
1347
|
+
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
1348
|
+
// eslint-disable-next-line no-undef
|
|
1349
|
+
process.env.NODE_ENV === "production" ? function instanceOf2(value, constructor) {
|
|
1350
|
+
return value instanceof constructor;
|
|
1351
|
+
} : function instanceOf3(value, constructor) {
|
|
1352
|
+
if (value instanceof constructor) {
|
|
1353
|
+
return true;
|
|
1354
|
+
}
|
|
1355
|
+
if (typeof value === "object" && value !== null) {
|
|
1356
|
+
var _value$constructor;
|
|
1357
|
+
const className = constructor.prototype[Symbol.toStringTag];
|
|
1358
|
+
const valueClassName = (
|
|
1359
|
+
// We still need to support constructor's name to detect conflicts with older versions of this library.
|
|
1360
|
+
Symbol.toStringTag in value ? value[Symbol.toStringTag] : (_value$constructor = value.constructor) === null || _value$constructor === void 0 ? void 0 : _value$constructor.name
|
|
1361
|
+
);
|
|
1362
|
+
if (className === valueClassName) {
|
|
1363
|
+
const stringifiedValue = inspect(value);
|
|
1364
|
+
throw new Error(`Cannot use ${className} "${stringifiedValue}" from another module or realm.
|
|
1365
|
+
|
|
1366
|
+
Ensure that there is only one instance of "graphql" in the node_modules
|
|
1367
|
+
directory. If different versions of "graphql" are the dependencies of other
|
|
1368
|
+
relied on modules, use "resolutions" to ensure only one version is installed.
|
|
1369
|
+
|
|
1370
|
+
https://yarnpkg.com/en/docs/selective-version-resolutions
|
|
1371
|
+
|
|
1372
|
+
Duplicate "graphql" modules cannot be used at the same time since different
|
|
1373
|
+
versions may have different capabilities and behavior. The data from one
|
|
1374
|
+
version used in the function from another could produce confusing and
|
|
1375
|
+
spurious results.`);
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
return false;
|
|
1379
|
+
}
|
|
1380
|
+
);
|
|
1381
|
+
class Source {
|
|
1382
|
+
constructor(body, name = "GraphQL request", locationOffset = {
|
|
1383
|
+
line: 1,
|
|
1384
|
+
column: 1
|
|
1385
|
+
}) {
|
|
1386
|
+
typeof body === "string" || devAssert(false, `Body must be a string. Received: ${inspect(body)}.`);
|
|
1387
|
+
this.body = body;
|
|
1388
|
+
this.name = name;
|
|
1389
|
+
this.locationOffset = locationOffset;
|
|
1390
|
+
this.locationOffset.line > 0 || devAssert(
|
|
1391
|
+
false,
|
|
1392
|
+
"line in locationOffset is 1-indexed and must be positive."
|
|
1393
|
+
);
|
|
1394
|
+
this.locationOffset.column > 0 || devAssert(
|
|
1395
|
+
false,
|
|
1396
|
+
"column in locationOffset is 1-indexed and must be positive."
|
|
1397
|
+
);
|
|
1398
|
+
}
|
|
1399
|
+
get [Symbol.toStringTag]() {
|
|
1400
|
+
return "Source";
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
function isSource(source) {
|
|
1404
|
+
return instanceOf(source, Source);
|
|
1405
|
+
}
|
|
1406
|
+
function parse(source, options) {
|
|
1407
|
+
const parser = new Parser(source, options);
|
|
1408
|
+
return parser.parseDocument();
|
|
1409
|
+
}
|
|
1410
|
+
class Parser {
|
|
1411
|
+
constructor(source, options = {}) {
|
|
1412
|
+
const sourceObj = isSource(source) ? source : new Source(source);
|
|
1413
|
+
this._lexer = new Lexer(sourceObj);
|
|
1414
|
+
this._options = options;
|
|
1415
|
+
this._tokenCounter = 0;
|
|
1416
|
+
}
|
|
1417
|
+
/**
|
|
1418
|
+
* Converts a name lex token into a name parse node.
|
|
1419
|
+
*/
|
|
1420
|
+
parseName() {
|
|
1421
|
+
const token = this.expectToken(TokenKind.NAME);
|
|
1422
|
+
return this.node(token, {
|
|
1423
|
+
kind: Kind.NAME,
|
|
1424
|
+
value: token.value
|
|
1425
|
+
});
|
|
1426
|
+
}
|
|
1427
|
+
// Implements the parsing rules in the Document section.
|
|
1428
|
+
/**
|
|
1429
|
+
* Document : Definition+
|
|
1430
|
+
*/
|
|
1431
|
+
parseDocument() {
|
|
1432
|
+
return this.node(this._lexer.token, {
|
|
1433
|
+
kind: Kind.DOCUMENT,
|
|
1434
|
+
definitions: this.many(
|
|
1435
|
+
TokenKind.SOF,
|
|
1436
|
+
this.parseDefinition,
|
|
1437
|
+
TokenKind.EOF
|
|
1438
|
+
)
|
|
1439
|
+
});
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* Definition :
|
|
1443
|
+
* - ExecutableDefinition
|
|
1444
|
+
* - TypeSystemDefinition
|
|
1445
|
+
* - TypeSystemExtension
|
|
1446
|
+
*
|
|
1447
|
+
* ExecutableDefinition :
|
|
1448
|
+
* - OperationDefinition
|
|
1449
|
+
* - FragmentDefinition
|
|
1450
|
+
*
|
|
1451
|
+
* TypeSystemDefinition :
|
|
1452
|
+
* - SchemaDefinition
|
|
1453
|
+
* - TypeDefinition
|
|
1454
|
+
* - DirectiveDefinition
|
|
1455
|
+
*
|
|
1456
|
+
* TypeDefinition :
|
|
1457
|
+
* - ScalarTypeDefinition
|
|
1458
|
+
* - ObjectTypeDefinition
|
|
1459
|
+
* - InterfaceTypeDefinition
|
|
1460
|
+
* - UnionTypeDefinition
|
|
1461
|
+
* - EnumTypeDefinition
|
|
1462
|
+
* - InputObjectTypeDefinition
|
|
1463
|
+
*/
|
|
1464
|
+
parseDefinition() {
|
|
1465
|
+
if (this.peek(TokenKind.BRACE_L)) {
|
|
1466
|
+
return this.parseOperationDefinition();
|
|
1467
|
+
}
|
|
1468
|
+
const hasDescription = this.peekDescription();
|
|
1469
|
+
const keywordToken = hasDescription ? this._lexer.lookahead() : this._lexer.token;
|
|
1470
|
+
if (keywordToken.kind === TokenKind.NAME) {
|
|
1471
|
+
switch (keywordToken.value) {
|
|
1472
|
+
case "schema":
|
|
1473
|
+
return this.parseSchemaDefinition();
|
|
1474
|
+
case "scalar":
|
|
1475
|
+
return this.parseScalarTypeDefinition();
|
|
1476
|
+
case "type":
|
|
1477
|
+
return this.parseObjectTypeDefinition();
|
|
1478
|
+
case "interface":
|
|
1479
|
+
return this.parseInterfaceTypeDefinition();
|
|
1480
|
+
case "union":
|
|
1481
|
+
return this.parseUnionTypeDefinition();
|
|
1482
|
+
case "enum":
|
|
1483
|
+
return this.parseEnumTypeDefinition();
|
|
1484
|
+
case "input":
|
|
1485
|
+
return this.parseInputObjectTypeDefinition();
|
|
1486
|
+
case "directive":
|
|
1487
|
+
return this.parseDirectiveDefinition();
|
|
1488
|
+
}
|
|
1489
|
+
if (hasDescription) {
|
|
1490
|
+
throw syntaxError(
|
|
1491
|
+
this._lexer.source,
|
|
1492
|
+
this._lexer.token.start,
|
|
1493
|
+
"Unexpected description, descriptions are supported only on type definitions."
|
|
1494
|
+
);
|
|
1495
|
+
}
|
|
1496
|
+
switch (keywordToken.value) {
|
|
1497
|
+
case "query":
|
|
1498
|
+
case "mutation":
|
|
1499
|
+
case "subscription":
|
|
1500
|
+
return this.parseOperationDefinition();
|
|
1501
|
+
case "fragment":
|
|
1502
|
+
return this.parseFragmentDefinition();
|
|
1503
|
+
case "extend":
|
|
1504
|
+
return this.parseTypeSystemExtension();
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
throw this.unexpected(keywordToken);
|
|
1508
|
+
}
|
|
1509
|
+
// Implements the parsing rules in the Operations section.
|
|
1510
|
+
/**
|
|
1511
|
+
* OperationDefinition :
|
|
1512
|
+
* - SelectionSet
|
|
1513
|
+
* - OperationType Name? VariableDefinitions? Directives? SelectionSet
|
|
1514
|
+
*/
|
|
1515
|
+
parseOperationDefinition() {
|
|
1516
|
+
const start2 = this._lexer.token;
|
|
1517
|
+
if (this.peek(TokenKind.BRACE_L)) {
|
|
1518
|
+
return this.node(start2, {
|
|
1519
|
+
kind: Kind.OPERATION_DEFINITION,
|
|
1520
|
+
operation: OperationTypeNode.QUERY,
|
|
1521
|
+
name: void 0,
|
|
1522
|
+
variableDefinitions: [],
|
|
1523
|
+
directives: [],
|
|
1524
|
+
selectionSet: this.parseSelectionSet()
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
const operation = this.parseOperationType();
|
|
1528
|
+
let name;
|
|
1529
|
+
if (this.peek(TokenKind.NAME)) {
|
|
1530
|
+
name = this.parseName();
|
|
1531
|
+
}
|
|
1532
|
+
return this.node(start2, {
|
|
1533
|
+
kind: Kind.OPERATION_DEFINITION,
|
|
1534
|
+
operation,
|
|
1535
|
+
name,
|
|
1536
|
+
variableDefinitions: this.parseVariableDefinitions(),
|
|
1537
|
+
directives: this.parseDirectives(false),
|
|
1538
|
+
selectionSet: this.parseSelectionSet()
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
/**
|
|
1542
|
+
* OperationType : one of query mutation subscription
|
|
1543
|
+
*/
|
|
1544
|
+
parseOperationType() {
|
|
1545
|
+
const operationToken = this.expectToken(TokenKind.NAME);
|
|
1546
|
+
switch (operationToken.value) {
|
|
1547
|
+
case "query":
|
|
1548
|
+
return OperationTypeNode.QUERY;
|
|
1549
|
+
case "mutation":
|
|
1550
|
+
return OperationTypeNode.MUTATION;
|
|
1551
|
+
case "subscription":
|
|
1552
|
+
return OperationTypeNode.SUBSCRIPTION;
|
|
1553
|
+
}
|
|
1554
|
+
throw this.unexpected(operationToken);
|
|
1555
|
+
}
|
|
1556
|
+
/**
|
|
1557
|
+
* VariableDefinitions : ( VariableDefinition+ )
|
|
1558
|
+
*/
|
|
1559
|
+
parseVariableDefinitions() {
|
|
1560
|
+
return this.optionalMany(
|
|
1561
|
+
TokenKind.PAREN_L,
|
|
1562
|
+
this.parseVariableDefinition,
|
|
1563
|
+
TokenKind.PAREN_R
|
|
1564
|
+
);
|
|
1565
|
+
}
|
|
1566
|
+
/**
|
|
1567
|
+
* VariableDefinition : Variable : Type DefaultValue? Directives[Const]?
|
|
1568
|
+
*/
|
|
1569
|
+
parseVariableDefinition() {
|
|
1570
|
+
return this.node(this._lexer.token, {
|
|
1571
|
+
kind: Kind.VARIABLE_DEFINITION,
|
|
1572
|
+
variable: this.parseVariable(),
|
|
1573
|
+
type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()),
|
|
1574
|
+
defaultValue: this.expectOptionalToken(TokenKind.EQUALS) ? this.parseConstValueLiteral() : void 0,
|
|
1575
|
+
directives: this.parseConstDirectives()
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1578
|
+
/**
|
|
1579
|
+
* Variable : $ Name
|
|
1580
|
+
*/
|
|
1581
|
+
parseVariable() {
|
|
1582
|
+
const start2 = this._lexer.token;
|
|
1583
|
+
this.expectToken(TokenKind.DOLLAR);
|
|
1584
|
+
return this.node(start2, {
|
|
1585
|
+
kind: Kind.VARIABLE,
|
|
1586
|
+
name: this.parseName()
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1589
|
+
/**
|
|
1590
|
+
* ```
|
|
1591
|
+
* SelectionSet : { Selection+ }
|
|
1592
|
+
* ```
|
|
1593
|
+
*/
|
|
1594
|
+
parseSelectionSet() {
|
|
1595
|
+
return this.node(this._lexer.token, {
|
|
1596
|
+
kind: Kind.SELECTION_SET,
|
|
1597
|
+
selections: this.many(
|
|
1598
|
+
TokenKind.BRACE_L,
|
|
1599
|
+
this.parseSelection,
|
|
1600
|
+
TokenKind.BRACE_R
|
|
1601
|
+
)
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1604
|
+
/**
|
|
1605
|
+
* Selection :
|
|
1606
|
+
* - Field
|
|
1607
|
+
* - FragmentSpread
|
|
1608
|
+
* - InlineFragment
|
|
1609
|
+
*/
|
|
1610
|
+
parseSelection() {
|
|
1611
|
+
return this.peek(TokenKind.SPREAD) ? this.parseFragment() : this.parseField();
|
|
1612
|
+
}
|
|
1613
|
+
/**
|
|
1614
|
+
* Field : Alias? Name Arguments? Directives? SelectionSet?
|
|
1615
|
+
*
|
|
1616
|
+
* Alias : Name :
|
|
1617
|
+
*/
|
|
1618
|
+
parseField() {
|
|
1619
|
+
const start2 = this._lexer.token;
|
|
1620
|
+
const nameOrAlias = this.parseName();
|
|
1621
|
+
let alias;
|
|
1622
|
+
let name;
|
|
1623
|
+
if (this.expectOptionalToken(TokenKind.COLON)) {
|
|
1624
|
+
alias = nameOrAlias;
|
|
1625
|
+
name = this.parseName();
|
|
1626
|
+
} else {
|
|
1627
|
+
name = nameOrAlias;
|
|
1628
|
+
}
|
|
1629
|
+
return this.node(start2, {
|
|
1630
|
+
kind: Kind.FIELD,
|
|
1631
|
+
alias,
|
|
1632
|
+
name,
|
|
1633
|
+
arguments: this.parseArguments(false),
|
|
1634
|
+
directives: this.parseDirectives(false),
|
|
1635
|
+
selectionSet: this.peek(TokenKind.BRACE_L) ? this.parseSelectionSet() : void 0
|
|
1636
|
+
});
|
|
1637
|
+
}
|
|
1638
|
+
/**
|
|
1639
|
+
* Arguments[Const] : ( Argument[?Const]+ )
|
|
1640
|
+
*/
|
|
1641
|
+
parseArguments(isConst) {
|
|
1642
|
+
const item = isConst ? this.parseConstArgument : this.parseArgument;
|
|
1643
|
+
return this.optionalMany(TokenKind.PAREN_L, item, TokenKind.PAREN_R);
|
|
1644
|
+
}
|
|
1645
|
+
/**
|
|
1646
|
+
* Argument[Const] : Name : Value[?Const]
|
|
1647
|
+
*/
|
|
1648
|
+
parseArgument(isConst = false) {
|
|
1649
|
+
const start2 = this._lexer.token;
|
|
1650
|
+
const name = this.parseName();
|
|
1651
|
+
this.expectToken(TokenKind.COLON);
|
|
1652
|
+
return this.node(start2, {
|
|
1653
|
+
kind: Kind.ARGUMENT,
|
|
1654
|
+
name,
|
|
1655
|
+
value: this.parseValueLiteral(isConst)
|
|
1656
|
+
});
|
|
1657
|
+
}
|
|
1658
|
+
parseConstArgument() {
|
|
1659
|
+
return this.parseArgument(true);
|
|
1660
|
+
}
|
|
1661
|
+
// Implements the parsing rules in the Fragments section.
|
|
1662
|
+
/**
|
|
1663
|
+
* Corresponds to both FragmentSpread and InlineFragment in the spec.
|
|
1664
|
+
*
|
|
1665
|
+
* FragmentSpread : ... FragmentName Directives?
|
|
1666
|
+
*
|
|
1667
|
+
* InlineFragment : ... TypeCondition? Directives? SelectionSet
|
|
1668
|
+
*/
|
|
1669
|
+
parseFragment() {
|
|
1670
|
+
const start2 = this._lexer.token;
|
|
1671
|
+
this.expectToken(TokenKind.SPREAD);
|
|
1672
|
+
const hasTypeCondition = this.expectOptionalKeyword("on");
|
|
1673
|
+
if (!hasTypeCondition && this.peek(TokenKind.NAME)) {
|
|
1674
|
+
return this.node(start2, {
|
|
1675
|
+
kind: Kind.FRAGMENT_SPREAD,
|
|
1676
|
+
name: this.parseFragmentName(),
|
|
1677
|
+
directives: this.parseDirectives(false)
|
|
1678
|
+
});
|
|
1679
|
+
}
|
|
1680
|
+
return this.node(start2, {
|
|
1681
|
+
kind: Kind.INLINE_FRAGMENT,
|
|
1682
|
+
typeCondition: hasTypeCondition ? this.parseNamedType() : void 0,
|
|
1683
|
+
directives: this.parseDirectives(false),
|
|
1684
|
+
selectionSet: this.parseSelectionSet()
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1687
|
+
/**
|
|
1688
|
+
* FragmentDefinition :
|
|
1689
|
+
* - fragment FragmentName on TypeCondition Directives? SelectionSet
|
|
1690
|
+
*
|
|
1691
|
+
* TypeCondition : NamedType
|
|
1692
|
+
*/
|
|
1693
|
+
parseFragmentDefinition() {
|
|
1694
|
+
const start2 = this._lexer.token;
|
|
1695
|
+
this.expectKeyword("fragment");
|
|
1696
|
+
if (this._options.allowLegacyFragmentVariables === true) {
|
|
1697
|
+
return this.node(start2, {
|
|
1698
|
+
kind: Kind.FRAGMENT_DEFINITION,
|
|
1699
|
+
name: this.parseFragmentName(),
|
|
1700
|
+
variableDefinitions: this.parseVariableDefinitions(),
|
|
1701
|
+
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
|
|
1702
|
+
directives: this.parseDirectives(false),
|
|
1703
|
+
selectionSet: this.parseSelectionSet()
|
|
1704
|
+
});
|
|
1705
|
+
}
|
|
1706
|
+
return this.node(start2, {
|
|
1707
|
+
kind: Kind.FRAGMENT_DEFINITION,
|
|
1708
|
+
name: this.parseFragmentName(),
|
|
1709
|
+
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
|
|
1710
|
+
directives: this.parseDirectives(false),
|
|
1711
|
+
selectionSet: this.parseSelectionSet()
|
|
1712
|
+
});
|
|
1713
|
+
}
|
|
1714
|
+
/**
|
|
1715
|
+
* FragmentName : Name but not `on`
|
|
1716
|
+
*/
|
|
1717
|
+
parseFragmentName() {
|
|
1718
|
+
if (this._lexer.token.value === "on") {
|
|
1719
|
+
throw this.unexpected();
|
|
1720
|
+
}
|
|
1721
|
+
return this.parseName();
|
|
1722
|
+
}
|
|
1723
|
+
// Implements the parsing rules in the Values section.
|
|
1724
|
+
/**
|
|
1725
|
+
* Value[Const] :
|
|
1726
|
+
* - [~Const] Variable
|
|
1727
|
+
* - IntValue
|
|
1728
|
+
* - FloatValue
|
|
1729
|
+
* - StringValue
|
|
1730
|
+
* - BooleanValue
|
|
1731
|
+
* - NullValue
|
|
1732
|
+
* - EnumValue
|
|
1733
|
+
* - ListValue[?Const]
|
|
1734
|
+
* - ObjectValue[?Const]
|
|
1735
|
+
*
|
|
1736
|
+
* BooleanValue : one of `true` `false`
|
|
1737
|
+
*
|
|
1738
|
+
* NullValue : `null`
|
|
1739
|
+
*
|
|
1740
|
+
* EnumValue : Name but not `true`, `false` or `null`
|
|
1741
|
+
*/
|
|
1742
|
+
parseValueLiteral(isConst) {
|
|
1743
|
+
const token = this._lexer.token;
|
|
1744
|
+
switch (token.kind) {
|
|
1745
|
+
case TokenKind.BRACKET_L:
|
|
1746
|
+
return this.parseList(isConst);
|
|
1747
|
+
case TokenKind.BRACE_L:
|
|
1748
|
+
return this.parseObject(isConst);
|
|
1749
|
+
case TokenKind.INT:
|
|
1750
|
+
this.advanceLexer();
|
|
1751
|
+
return this.node(token, {
|
|
1752
|
+
kind: Kind.INT,
|
|
1753
|
+
value: token.value
|
|
1754
|
+
});
|
|
1755
|
+
case TokenKind.FLOAT:
|
|
1756
|
+
this.advanceLexer();
|
|
1757
|
+
return this.node(token, {
|
|
1758
|
+
kind: Kind.FLOAT,
|
|
1759
|
+
value: token.value
|
|
1760
|
+
});
|
|
1761
|
+
case TokenKind.STRING:
|
|
1762
|
+
case TokenKind.BLOCK_STRING:
|
|
1763
|
+
return this.parseStringLiteral();
|
|
1764
|
+
case TokenKind.NAME:
|
|
1765
|
+
this.advanceLexer();
|
|
1766
|
+
switch (token.value) {
|
|
1767
|
+
case "true":
|
|
1768
|
+
return this.node(token, {
|
|
1769
|
+
kind: Kind.BOOLEAN,
|
|
1770
|
+
value: true
|
|
1771
|
+
});
|
|
1772
|
+
case "false":
|
|
1773
|
+
return this.node(token, {
|
|
1774
|
+
kind: Kind.BOOLEAN,
|
|
1775
|
+
value: false
|
|
1776
|
+
});
|
|
1777
|
+
case "null":
|
|
1778
|
+
return this.node(token, {
|
|
1779
|
+
kind: Kind.NULL
|
|
1780
|
+
});
|
|
1781
|
+
default:
|
|
1782
|
+
return this.node(token, {
|
|
1783
|
+
kind: Kind.ENUM,
|
|
1784
|
+
value: token.value
|
|
1785
|
+
});
|
|
1786
|
+
}
|
|
1787
|
+
case TokenKind.DOLLAR:
|
|
1788
|
+
if (isConst) {
|
|
1789
|
+
this.expectToken(TokenKind.DOLLAR);
|
|
1790
|
+
if (this._lexer.token.kind === TokenKind.NAME) {
|
|
1791
|
+
const varName = this._lexer.token.value;
|
|
1792
|
+
throw syntaxError(
|
|
1793
|
+
this._lexer.source,
|
|
1794
|
+
token.start,
|
|
1795
|
+
`Unexpected variable "$${varName}" in constant value.`
|
|
1796
|
+
);
|
|
1797
|
+
} else {
|
|
1798
|
+
throw this.unexpected(token);
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
return this.parseVariable();
|
|
1802
|
+
default:
|
|
1803
|
+
throw this.unexpected();
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
parseConstValueLiteral() {
|
|
1807
|
+
return this.parseValueLiteral(true);
|
|
1808
|
+
}
|
|
1809
|
+
parseStringLiteral() {
|
|
1810
|
+
const token = this._lexer.token;
|
|
1811
|
+
this.advanceLexer();
|
|
1812
|
+
return this.node(token, {
|
|
1813
|
+
kind: Kind.STRING,
|
|
1814
|
+
value: token.value,
|
|
1815
|
+
block: token.kind === TokenKind.BLOCK_STRING
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* ListValue[Const] :
|
|
1820
|
+
* - [ ]
|
|
1821
|
+
* - [ Value[?Const]+ ]
|
|
1822
|
+
*/
|
|
1823
|
+
parseList(isConst) {
|
|
1824
|
+
const item = () => this.parseValueLiteral(isConst);
|
|
1825
|
+
return this.node(this._lexer.token, {
|
|
1826
|
+
kind: Kind.LIST,
|
|
1827
|
+
values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R)
|
|
1828
|
+
});
|
|
1829
|
+
}
|
|
1830
|
+
/**
|
|
1831
|
+
* ```
|
|
1832
|
+
* ObjectValue[Const] :
|
|
1833
|
+
* - { }
|
|
1834
|
+
* - { ObjectField[?Const]+ }
|
|
1835
|
+
* ```
|
|
1836
|
+
*/
|
|
1837
|
+
parseObject(isConst) {
|
|
1838
|
+
const item = () => this.parseObjectField(isConst);
|
|
1839
|
+
return this.node(this._lexer.token, {
|
|
1840
|
+
kind: Kind.OBJECT,
|
|
1841
|
+
fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R)
|
|
1842
|
+
});
|
|
1843
|
+
}
|
|
1844
|
+
/**
|
|
1845
|
+
* ObjectField[Const] : Name : Value[?Const]
|
|
1846
|
+
*/
|
|
1847
|
+
parseObjectField(isConst) {
|
|
1848
|
+
const start2 = this._lexer.token;
|
|
1849
|
+
const name = this.parseName();
|
|
1850
|
+
this.expectToken(TokenKind.COLON);
|
|
1851
|
+
return this.node(start2, {
|
|
1852
|
+
kind: Kind.OBJECT_FIELD,
|
|
1853
|
+
name,
|
|
1854
|
+
value: this.parseValueLiteral(isConst)
|
|
1855
|
+
});
|
|
1856
|
+
}
|
|
1857
|
+
// Implements the parsing rules in the Directives section.
|
|
1858
|
+
/**
|
|
1859
|
+
* Directives[Const] : Directive[?Const]+
|
|
1860
|
+
*/
|
|
1861
|
+
parseDirectives(isConst) {
|
|
1862
|
+
const directives = [];
|
|
1863
|
+
while (this.peek(TokenKind.AT)) {
|
|
1864
|
+
directives.push(this.parseDirective(isConst));
|
|
1865
|
+
}
|
|
1866
|
+
return directives;
|
|
1867
|
+
}
|
|
1868
|
+
parseConstDirectives() {
|
|
1869
|
+
return this.parseDirectives(true);
|
|
1870
|
+
}
|
|
1871
|
+
/**
|
|
1872
|
+
* ```
|
|
1873
|
+
* Directive[Const] : @ Name Arguments[?Const]?
|
|
1874
|
+
* ```
|
|
1875
|
+
*/
|
|
1876
|
+
parseDirective(isConst) {
|
|
1877
|
+
const start2 = this._lexer.token;
|
|
1878
|
+
this.expectToken(TokenKind.AT);
|
|
1879
|
+
return this.node(start2, {
|
|
1880
|
+
kind: Kind.DIRECTIVE,
|
|
1881
|
+
name: this.parseName(),
|
|
1882
|
+
arguments: this.parseArguments(isConst)
|
|
1883
|
+
});
|
|
1884
|
+
}
|
|
1885
|
+
// Implements the parsing rules in the Types section.
|
|
1886
|
+
/**
|
|
1887
|
+
* Type :
|
|
1888
|
+
* - NamedType
|
|
1889
|
+
* - ListType
|
|
1890
|
+
* - NonNullType
|
|
1891
|
+
*/
|
|
1892
|
+
parseTypeReference() {
|
|
1893
|
+
const start2 = this._lexer.token;
|
|
1894
|
+
let type;
|
|
1895
|
+
if (this.expectOptionalToken(TokenKind.BRACKET_L)) {
|
|
1896
|
+
const innerType = this.parseTypeReference();
|
|
1897
|
+
this.expectToken(TokenKind.BRACKET_R);
|
|
1898
|
+
type = this.node(start2, {
|
|
1899
|
+
kind: Kind.LIST_TYPE,
|
|
1900
|
+
type: innerType
|
|
1901
|
+
});
|
|
1902
|
+
} else {
|
|
1903
|
+
type = this.parseNamedType();
|
|
1904
|
+
}
|
|
1905
|
+
if (this.expectOptionalToken(TokenKind.BANG)) {
|
|
1906
|
+
return this.node(start2, {
|
|
1907
|
+
kind: Kind.NON_NULL_TYPE,
|
|
1908
|
+
type
|
|
1909
|
+
});
|
|
1910
|
+
}
|
|
1911
|
+
return type;
|
|
1912
|
+
}
|
|
1913
|
+
/**
|
|
1914
|
+
* NamedType : Name
|
|
1915
|
+
*/
|
|
1916
|
+
parseNamedType() {
|
|
1917
|
+
return this.node(this._lexer.token, {
|
|
1918
|
+
kind: Kind.NAMED_TYPE,
|
|
1919
|
+
name: this.parseName()
|
|
1920
|
+
});
|
|
1921
|
+
}
|
|
1922
|
+
// Implements the parsing rules in the Type Definition section.
|
|
1923
|
+
peekDescription() {
|
|
1924
|
+
return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING);
|
|
1925
|
+
}
|
|
1926
|
+
/**
|
|
1927
|
+
* Description : StringValue
|
|
1928
|
+
*/
|
|
1929
|
+
parseDescription() {
|
|
1930
|
+
if (this.peekDescription()) {
|
|
1931
|
+
return this.parseStringLiteral();
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
/**
|
|
1935
|
+
* ```
|
|
1936
|
+
* SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ }
|
|
1937
|
+
* ```
|
|
1938
|
+
*/
|
|
1939
|
+
parseSchemaDefinition() {
|
|
1940
|
+
const start2 = this._lexer.token;
|
|
1941
|
+
const description = this.parseDescription();
|
|
1942
|
+
this.expectKeyword("schema");
|
|
1943
|
+
const directives = this.parseConstDirectives();
|
|
1944
|
+
const operationTypes = this.many(
|
|
1945
|
+
TokenKind.BRACE_L,
|
|
1946
|
+
this.parseOperationTypeDefinition,
|
|
1947
|
+
TokenKind.BRACE_R
|
|
1948
|
+
);
|
|
1949
|
+
return this.node(start2, {
|
|
1950
|
+
kind: Kind.SCHEMA_DEFINITION,
|
|
1951
|
+
description,
|
|
1952
|
+
directives,
|
|
1953
|
+
operationTypes
|
|
1954
|
+
});
|
|
1955
|
+
}
|
|
1956
|
+
/**
|
|
1957
|
+
* OperationTypeDefinition : OperationType : NamedType
|
|
1958
|
+
*/
|
|
1959
|
+
parseOperationTypeDefinition() {
|
|
1960
|
+
const start2 = this._lexer.token;
|
|
1961
|
+
const operation = this.parseOperationType();
|
|
1962
|
+
this.expectToken(TokenKind.COLON);
|
|
1963
|
+
const type = this.parseNamedType();
|
|
1964
|
+
return this.node(start2, {
|
|
1965
|
+
kind: Kind.OPERATION_TYPE_DEFINITION,
|
|
1966
|
+
operation,
|
|
1967
|
+
type
|
|
1968
|
+
});
|
|
1969
|
+
}
|
|
1970
|
+
/**
|
|
1971
|
+
* ScalarTypeDefinition : Description? scalar Name Directives[Const]?
|
|
1972
|
+
*/
|
|
1973
|
+
parseScalarTypeDefinition() {
|
|
1974
|
+
const start2 = this._lexer.token;
|
|
1975
|
+
const description = this.parseDescription();
|
|
1976
|
+
this.expectKeyword("scalar");
|
|
1977
|
+
const name = this.parseName();
|
|
1978
|
+
const directives = this.parseConstDirectives();
|
|
1979
|
+
return this.node(start2, {
|
|
1980
|
+
kind: Kind.SCALAR_TYPE_DEFINITION,
|
|
1981
|
+
description,
|
|
1982
|
+
name,
|
|
1983
|
+
directives
|
|
1984
|
+
});
|
|
1985
|
+
}
|
|
1986
|
+
/**
|
|
1987
|
+
* ObjectTypeDefinition :
|
|
1988
|
+
* Description?
|
|
1989
|
+
* type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?
|
|
1990
|
+
*/
|
|
1991
|
+
parseObjectTypeDefinition() {
|
|
1992
|
+
const start2 = this._lexer.token;
|
|
1993
|
+
const description = this.parseDescription();
|
|
1994
|
+
this.expectKeyword("type");
|
|
1995
|
+
const name = this.parseName();
|
|
1996
|
+
const interfaces2 = this.parseImplementsInterfaces();
|
|
1997
|
+
const directives = this.parseConstDirectives();
|
|
1998
|
+
const fields = this.parseFieldsDefinition();
|
|
1999
|
+
return this.node(start2, {
|
|
2000
|
+
kind: Kind.OBJECT_TYPE_DEFINITION,
|
|
2001
|
+
description,
|
|
2002
|
+
name,
|
|
2003
|
+
interfaces: interfaces2,
|
|
2004
|
+
directives,
|
|
2005
|
+
fields
|
|
2006
|
+
});
|
|
2007
|
+
}
|
|
2008
|
+
/**
|
|
2009
|
+
* ImplementsInterfaces :
|
|
2010
|
+
* - implements `&`? NamedType
|
|
2011
|
+
* - ImplementsInterfaces & NamedType
|
|
2012
|
+
*/
|
|
2013
|
+
parseImplementsInterfaces() {
|
|
2014
|
+
return this.expectOptionalKeyword("implements") ? this.delimitedMany(TokenKind.AMP, this.parseNamedType) : [];
|
|
2015
|
+
}
|
|
2016
|
+
/**
|
|
2017
|
+
* ```
|
|
2018
|
+
* FieldsDefinition : { FieldDefinition+ }
|
|
2019
|
+
* ```
|
|
2020
|
+
*/
|
|
2021
|
+
parseFieldsDefinition() {
|
|
2022
|
+
return this.optionalMany(
|
|
2023
|
+
TokenKind.BRACE_L,
|
|
2024
|
+
this.parseFieldDefinition,
|
|
2025
|
+
TokenKind.BRACE_R
|
|
2026
|
+
);
|
|
2027
|
+
}
|
|
2028
|
+
/**
|
|
2029
|
+
* FieldDefinition :
|
|
2030
|
+
* - Description? Name ArgumentsDefinition? : Type Directives[Const]?
|
|
2031
|
+
*/
|
|
2032
|
+
parseFieldDefinition() {
|
|
2033
|
+
const start2 = this._lexer.token;
|
|
2034
|
+
const description = this.parseDescription();
|
|
2035
|
+
const name = this.parseName();
|
|
2036
|
+
const args = this.parseArgumentDefs();
|
|
2037
|
+
this.expectToken(TokenKind.COLON);
|
|
2038
|
+
const type = this.parseTypeReference();
|
|
2039
|
+
const directives = this.parseConstDirectives();
|
|
2040
|
+
return this.node(start2, {
|
|
2041
|
+
kind: Kind.FIELD_DEFINITION,
|
|
2042
|
+
description,
|
|
2043
|
+
name,
|
|
2044
|
+
arguments: args,
|
|
2045
|
+
type,
|
|
2046
|
+
directives
|
|
2047
|
+
});
|
|
2048
|
+
}
|
|
2049
|
+
/**
|
|
2050
|
+
* ArgumentsDefinition : ( InputValueDefinition+ )
|
|
2051
|
+
*/
|
|
2052
|
+
parseArgumentDefs() {
|
|
2053
|
+
return this.optionalMany(
|
|
2054
|
+
TokenKind.PAREN_L,
|
|
2055
|
+
this.parseInputValueDef,
|
|
2056
|
+
TokenKind.PAREN_R
|
|
2057
|
+
);
|
|
2058
|
+
}
|
|
2059
|
+
/**
|
|
2060
|
+
* InputValueDefinition :
|
|
2061
|
+
* - Description? Name : Type DefaultValue? Directives[Const]?
|
|
2062
|
+
*/
|
|
2063
|
+
parseInputValueDef() {
|
|
2064
|
+
const start2 = this._lexer.token;
|
|
2065
|
+
const description = this.parseDescription();
|
|
2066
|
+
const name = this.parseName();
|
|
2067
|
+
this.expectToken(TokenKind.COLON);
|
|
2068
|
+
const type = this.parseTypeReference();
|
|
2069
|
+
let defaultValue;
|
|
2070
|
+
if (this.expectOptionalToken(TokenKind.EQUALS)) {
|
|
2071
|
+
defaultValue = this.parseConstValueLiteral();
|
|
2072
|
+
}
|
|
2073
|
+
const directives = this.parseConstDirectives();
|
|
2074
|
+
return this.node(start2, {
|
|
2075
|
+
kind: Kind.INPUT_VALUE_DEFINITION,
|
|
2076
|
+
description,
|
|
2077
|
+
name,
|
|
2078
|
+
type,
|
|
2079
|
+
defaultValue,
|
|
2080
|
+
directives
|
|
2081
|
+
});
|
|
2082
|
+
}
|
|
2083
|
+
/**
|
|
2084
|
+
* InterfaceTypeDefinition :
|
|
2085
|
+
* - Description? interface Name Directives[Const]? FieldsDefinition?
|
|
2086
|
+
*/
|
|
2087
|
+
parseInterfaceTypeDefinition() {
|
|
2088
|
+
const start2 = this._lexer.token;
|
|
2089
|
+
const description = this.parseDescription();
|
|
2090
|
+
this.expectKeyword("interface");
|
|
2091
|
+
const name = this.parseName();
|
|
2092
|
+
const interfaces2 = this.parseImplementsInterfaces();
|
|
2093
|
+
const directives = this.parseConstDirectives();
|
|
2094
|
+
const fields = this.parseFieldsDefinition();
|
|
2095
|
+
return this.node(start2, {
|
|
2096
|
+
kind: Kind.INTERFACE_TYPE_DEFINITION,
|
|
2097
|
+
description,
|
|
2098
|
+
name,
|
|
2099
|
+
interfaces: interfaces2,
|
|
2100
|
+
directives,
|
|
2101
|
+
fields
|
|
2102
|
+
});
|
|
2103
|
+
}
|
|
2104
|
+
/**
|
|
2105
|
+
* UnionTypeDefinition :
|
|
2106
|
+
* - Description? union Name Directives[Const]? UnionMemberTypes?
|
|
2107
|
+
*/
|
|
2108
|
+
parseUnionTypeDefinition() {
|
|
2109
|
+
const start2 = this._lexer.token;
|
|
2110
|
+
const description = this.parseDescription();
|
|
2111
|
+
this.expectKeyword("union");
|
|
2112
|
+
const name = this.parseName();
|
|
2113
|
+
const directives = this.parseConstDirectives();
|
|
2114
|
+
const types = this.parseUnionMemberTypes();
|
|
2115
|
+
return this.node(start2, {
|
|
2116
|
+
kind: Kind.UNION_TYPE_DEFINITION,
|
|
2117
|
+
description,
|
|
2118
|
+
name,
|
|
2119
|
+
directives,
|
|
2120
|
+
types
|
|
2121
|
+
});
|
|
2122
|
+
}
|
|
2123
|
+
/**
|
|
2124
|
+
* UnionMemberTypes :
|
|
2125
|
+
* - = `|`? NamedType
|
|
2126
|
+
* - UnionMemberTypes | NamedType
|
|
2127
|
+
*/
|
|
2128
|
+
parseUnionMemberTypes() {
|
|
2129
|
+
return this.expectOptionalToken(TokenKind.EQUALS) ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType) : [];
|
|
2130
|
+
}
|
|
2131
|
+
/**
|
|
2132
|
+
* EnumTypeDefinition :
|
|
2133
|
+
* - Description? enum Name Directives[Const]? EnumValuesDefinition?
|
|
2134
|
+
*/
|
|
2135
|
+
parseEnumTypeDefinition() {
|
|
2136
|
+
const start2 = this._lexer.token;
|
|
2137
|
+
const description = this.parseDescription();
|
|
2138
|
+
this.expectKeyword("enum");
|
|
2139
|
+
const name = this.parseName();
|
|
2140
|
+
const directives = this.parseConstDirectives();
|
|
2141
|
+
const values = this.parseEnumValuesDefinition();
|
|
2142
|
+
return this.node(start2, {
|
|
2143
|
+
kind: Kind.ENUM_TYPE_DEFINITION,
|
|
2144
|
+
description,
|
|
2145
|
+
name,
|
|
2146
|
+
directives,
|
|
2147
|
+
values
|
|
2148
|
+
});
|
|
2149
|
+
}
|
|
2150
|
+
/**
|
|
2151
|
+
* ```
|
|
2152
|
+
* EnumValuesDefinition : { EnumValueDefinition+ }
|
|
2153
|
+
* ```
|
|
2154
|
+
*/
|
|
2155
|
+
parseEnumValuesDefinition() {
|
|
2156
|
+
return this.optionalMany(
|
|
2157
|
+
TokenKind.BRACE_L,
|
|
2158
|
+
this.parseEnumValueDefinition,
|
|
2159
|
+
TokenKind.BRACE_R
|
|
2160
|
+
);
|
|
2161
|
+
}
|
|
2162
|
+
/**
|
|
2163
|
+
* EnumValueDefinition : Description? EnumValue Directives[Const]?
|
|
2164
|
+
*/
|
|
2165
|
+
parseEnumValueDefinition() {
|
|
2166
|
+
const start2 = this._lexer.token;
|
|
2167
|
+
const description = this.parseDescription();
|
|
2168
|
+
const name = this.parseEnumValueName();
|
|
2169
|
+
const directives = this.parseConstDirectives();
|
|
2170
|
+
return this.node(start2, {
|
|
2171
|
+
kind: Kind.ENUM_VALUE_DEFINITION,
|
|
2172
|
+
description,
|
|
2173
|
+
name,
|
|
2174
|
+
directives
|
|
2175
|
+
});
|
|
2176
|
+
}
|
|
2177
|
+
/**
|
|
2178
|
+
* EnumValue : Name but not `true`, `false` or `null`
|
|
2179
|
+
*/
|
|
2180
|
+
parseEnumValueName() {
|
|
2181
|
+
if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null") {
|
|
2182
|
+
throw syntaxError(
|
|
2183
|
+
this._lexer.source,
|
|
2184
|
+
this._lexer.token.start,
|
|
2185
|
+
`${getTokenDesc(
|
|
2186
|
+
this._lexer.token
|
|
2187
|
+
)} is reserved and cannot be used for an enum value.`
|
|
2188
|
+
);
|
|
2189
|
+
}
|
|
2190
|
+
return this.parseName();
|
|
2191
|
+
}
|
|
2192
|
+
/**
|
|
2193
|
+
* InputObjectTypeDefinition :
|
|
2194
|
+
* - Description? input Name Directives[Const]? InputFieldsDefinition?
|
|
2195
|
+
*/
|
|
2196
|
+
parseInputObjectTypeDefinition() {
|
|
2197
|
+
const start2 = this._lexer.token;
|
|
2198
|
+
const description = this.parseDescription();
|
|
2199
|
+
this.expectKeyword("input");
|
|
2200
|
+
const name = this.parseName();
|
|
2201
|
+
const directives = this.parseConstDirectives();
|
|
2202
|
+
const fields = this.parseInputFieldsDefinition();
|
|
2203
|
+
return this.node(start2, {
|
|
2204
|
+
kind: Kind.INPUT_OBJECT_TYPE_DEFINITION,
|
|
2205
|
+
description,
|
|
2206
|
+
name,
|
|
2207
|
+
directives,
|
|
2208
|
+
fields
|
|
2209
|
+
});
|
|
2210
|
+
}
|
|
2211
|
+
/**
|
|
2212
|
+
* ```
|
|
2213
|
+
* InputFieldsDefinition : { InputValueDefinition+ }
|
|
2214
|
+
* ```
|
|
2215
|
+
*/
|
|
2216
|
+
parseInputFieldsDefinition() {
|
|
2217
|
+
return this.optionalMany(
|
|
2218
|
+
TokenKind.BRACE_L,
|
|
2219
|
+
this.parseInputValueDef,
|
|
2220
|
+
TokenKind.BRACE_R
|
|
2221
|
+
);
|
|
2222
|
+
}
|
|
2223
|
+
/**
|
|
2224
|
+
* TypeSystemExtension :
|
|
2225
|
+
* - SchemaExtension
|
|
2226
|
+
* - TypeExtension
|
|
2227
|
+
*
|
|
2228
|
+
* TypeExtension :
|
|
2229
|
+
* - ScalarTypeExtension
|
|
2230
|
+
* - ObjectTypeExtension
|
|
2231
|
+
* - InterfaceTypeExtension
|
|
2232
|
+
* - UnionTypeExtension
|
|
2233
|
+
* - EnumTypeExtension
|
|
2234
|
+
* - InputObjectTypeDefinition
|
|
2235
|
+
*/
|
|
2236
|
+
parseTypeSystemExtension() {
|
|
2237
|
+
const keywordToken = this._lexer.lookahead();
|
|
2238
|
+
if (keywordToken.kind === TokenKind.NAME) {
|
|
2239
|
+
switch (keywordToken.value) {
|
|
2240
|
+
case "schema":
|
|
2241
|
+
return this.parseSchemaExtension();
|
|
2242
|
+
case "scalar":
|
|
2243
|
+
return this.parseScalarTypeExtension();
|
|
2244
|
+
case "type":
|
|
2245
|
+
return this.parseObjectTypeExtension();
|
|
2246
|
+
case "interface":
|
|
2247
|
+
return this.parseInterfaceTypeExtension();
|
|
2248
|
+
case "union":
|
|
2249
|
+
return this.parseUnionTypeExtension();
|
|
2250
|
+
case "enum":
|
|
2251
|
+
return this.parseEnumTypeExtension();
|
|
2252
|
+
case "input":
|
|
2253
|
+
return this.parseInputObjectTypeExtension();
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
throw this.unexpected(keywordToken);
|
|
2257
|
+
}
|
|
2258
|
+
/**
|
|
2259
|
+
* ```
|
|
2260
|
+
* SchemaExtension :
|
|
2261
|
+
* - extend schema Directives[Const]? { OperationTypeDefinition+ }
|
|
2262
|
+
* - extend schema Directives[Const]
|
|
2263
|
+
* ```
|
|
2264
|
+
*/
|
|
2265
|
+
parseSchemaExtension() {
|
|
2266
|
+
const start2 = this._lexer.token;
|
|
2267
|
+
this.expectKeyword("extend");
|
|
2268
|
+
this.expectKeyword("schema");
|
|
2269
|
+
const directives = this.parseConstDirectives();
|
|
2270
|
+
const operationTypes = this.optionalMany(
|
|
2271
|
+
TokenKind.BRACE_L,
|
|
2272
|
+
this.parseOperationTypeDefinition,
|
|
2273
|
+
TokenKind.BRACE_R
|
|
2274
|
+
);
|
|
2275
|
+
if (directives.length === 0 && operationTypes.length === 0) {
|
|
2276
|
+
throw this.unexpected();
|
|
2277
|
+
}
|
|
2278
|
+
return this.node(start2, {
|
|
2279
|
+
kind: Kind.SCHEMA_EXTENSION,
|
|
2280
|
+
directives,
|
|
2281
|
+
operationTypes
|
|
2282
|
+
});
|
|
2283
|
+
}
|
|
2284
|
+
/**
|
|
2285
|
+
* ScalarTypeExtension :
|
|
2286
|
+
* - extend scalar Name Directives[Const]
|
|
2287
|
+
*/
|
|
2288
|
+
parseScalarTypeExtension() {
|
|
2289
|
+
const start2 = this._lexer.token;
|
|
2290
|
+
this.expectKeyword("extend");
|
|
2291
|
+
this.expectKeyword("scalar");
|
|
2292
|
+
const name = this.parseName();
|
|
2293
|
+
const directives = this.parseConstDirectives();
|
|
2294
|
+
if (directives.length === 0) {
|
|
2295
|
+
throw this.unexpected();
|
|
2296
|
+
}
|
|
2297
|
+
return this.node(start2, {
|
|
2298
|
+
kind: Kind.SCALAR_TYPE_EXTENSION,
|
|
2299
|
+
name,
|
|
2300
|
+
directives
|
|
2301
|
+
});
|
|
2302
|
+
}
|
|
2303
|
+
/**
|
|
2304
|
+
* ObjectTypeExtension :
|
|
2305
|
+
* - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
|
|
2306
|
+
* - extend type Name ImplementsInterfaces? Directives[Const]
|
|
2307
|
+
* - extend type Name ImplementsInterfaces
|
|
2308
|
+
*/
|
|
2309
|
+
parseObjectTypeExtension() {
|
|
2310
|
+
const start2 = this._lexer.token;
|
|
2311
|
+
this.expectKeyword("extend");
|
|
2312
|
+
this.expectKeyword("type");
|
|
2313
|
+
const name = this.parseName();
|
|
2314
|
+
const interfaces2 = this.parseImplementsInterfaces();
|
|
2315
|
+
const directives = this.parseConstDirectives();
|
|
2316
|
+
const fields = this.parseFieldsDefinition();
|
|
2317
|
+
if (interfaces2.length === 0 && directives.length === 0 && fields.length === 0) {
|
|
2318
|
+
throw this.unexpected();
|
|
2319
|
+
}
|
|
2320
|
+
return this.node(start2, {
|
|
2321
|
+
kind: Kind.OBJECT_TYPE_EXTENSION,
|
|
2322
|
+
name,
|
|
2323
|
+
interfaces: interfaces2,
|
|
2324
|
+
directives,
|
|
2325
|
+
fields
|
|
2326
|
+
});
|
|
2327
|
+
}
|
|
2328
|
+
/**
|
|
2329
|
+
* InterfaceTypeExtension :
|
|
2330
|
+
* - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
|
|
2331
|
+
* - extend interface Name ImplementsInterfaces? Directives[Const]
|
|
2332
|
+
* - extend interface Name ImplementsInterfaces
|
|
2333
|
+
*/
|
|
2334
|
+
parseInterfaceTypeExtension() {
|
|
2335
|
+
const start2 = this._lexer.token;
|
|
2336
|
+
this.expectKeyword("extend");
|
|
2337
|
+
this.expectKeyword("interface");
|
|
2338
|
+
const name = this.parseName();
|
|
2339
|
+
const interfaces2 = this.parseImplementsInterfaces();
|
|
2340
|
+
const directives = this.parseConstDirectives();
|
|
2341
|
+
const fields = this.parseFieldsDefinition();
|
|
2342
|
+
if (interfaces2.length === 0 && directives.length === 0 && fields.length === 0) {
|
|
2343
|
+
throw this.unexpected();
|
|
2344
|
+
}
|
|
2345
|
+
return this.node(start2, {
|
|
2346
|
+
kind: Kind.INTERFACE_TYPE_EXTENSION,
|
|
2347
|
+
name,
|
|
2348
|
+
interfaces: interfaces2,
|
|
2349
|
+
directives,
|
|
2350
|
+
fields
|
|
2351
|
+
});
|
|
2352
|
+
}
|
|
2353
|
+
/**
|
|
2354
|
+
* UnionTypeExtension :
|
|
2355
|
+
* - extend union Name Directives[Const]? UnionMemberTypes
|
|
2356
|
+
* - extend union Name Directives[Const]
|
|
2357
|
+
*/
|
|
2358
|
+
parseUnionTypeExtension() {
|
|
2359
|
+
const start2 = this._lexer.token;
|
|
2360
|
+
this.expectKeyword("extend");
|
|
2361
|
+
this.expectKeyword("union");
|
|
2362
|
+
const name = this.parseName();
|
|
2363
|
+
const directives = this.parseConstDirectives();
|
|
2364
|
+
const types = this.parseUnionMemberTypes();
|
|
2365
|
+
if (directives.length === 0 && types.length === 0) {
|
|
2366
|
+
throw this.unexpected();
|
|
2367
|
+
}
|
|
2368
|
+
return this.node(start2, {
|
|
2369
|
+
kind: Kind.UNION_TYPE_EXTENSION,
|
|
2370
|
+
name,
|
|
2371
|
+
directives,
|
|
2372
|
+
types
|
|
2373
|
+
});
|
|
2374
|
+
}
|
|
2375
|
+
/**
|
|
2376
|
+
* EnumTypeExtension :
|
|
2377
|
+
* - extend enum Name Directives[Const]? EnumValuesDefinition
|
|
2378
|
+
* - extend enum Name Directives[Const]
|
|
2379
|
+
*/
|
|
2380
|
+
parseEnumTypeExtension() {
|
|
2381
|
+
const start2 = this._lexer.token;
|
|
2382
|
+
this.expectKeyword("extend");
|
|
2383
|
+
this.expectKeyword("enum");
|
|
2384
|
+
const name = this.parseName();
|
|
2385
|
+
const directives = this.parseConstDirectives();
|
|
2386
|
+
const values = this.parseEnumValuesDefinition();
|
|
2387
|
+
if (directives.length === 0 && values.length === 0) {
|
|
2388
|
+
throw this.unexpected();
|
|
2389
|
+
}
|
|
2390
|
+
return this.node(start2, {
|
|
2391
|
+
kind: Kind.ENUM_TYPE_EXTENSION,
|
|
2392
|
+
name,
|
|
2393
|
+
directives,
|
|
2394
|
+
values
|
|
2395
|
+
});
|
|
2396
|
+
}
|
|
2397
|
+
/**
|
|
2398
|
+
* InputObjectTypeExtension :
|
|
2399
|
+
* - extend input Name Directives[Const]? InputFieldsDefinition
|
|
2400
|
+
* - extend input Name Directives[Const]
|
|
2401
|
+
*/
|
|
2402
|
+
parseInputObjectTypeExtension() {
|
|
2403
|
+
const start2 = this._lexer.token;
|
|
2404
|
+
this.expectKeyword("extend");
|
|
2405
|
+
this.expectKeyword("input");
|
|
2406
|
+
const name = this.parseName();
|
|
2407
|
+
const directives = this.parseConstDirectives();
|
|
2408
|
+
const fields = this.parseInputFieldsDefinition();
|
|
2409
|
+
if (directives.length === 0 && fields.length === 0) {
|
|
2410
|
+
throw this.unexpected();
|
|
2411
|
+
}
|
|
2412
|
+
return this.node(start2, {
|
|
2413
|
+
kind: Kind.INPUT_OBJECT_TYPE_EXTENSION,
|
|
2414
|
+
name,
|
|
2415
|
+
directives,
|
|
2416
|
+
fields
|
|
2417
|
+
});
|
|
2418
|
+
}
|
|
2419
|
+
/**
|
|
2420
|
+
* ```
|
|
2421
|
+
* DirectiveDefinition :
|
|
2422
|
+
* - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations
|
|
2423
|
+
* ```
|
|
2424
|
+
*/
|
|
2425
|
+
parseDirectiveDefinition() {
|
|
2426
|
+
const start2 = this._lexer.token;
|
|
2427
|
+
const description = this.parseDescription();
|
|
2428
|
+
this.expectKeyword("directive");
|
|
2429
|
+
this.expectToken(TokenKind.AT);
|
|
2430
|
+
const name = this.parseName();
|
|
2431
|
+
const args = this.parseArgumentDefs();
|
|
2432
|
+
const repeatable = this.expectOptionalKeyword("repeatable");
|
|
2433
|
+
this.expectKeyword("on");
|
|
2434
|
+
const locations = this.parseDirectiveLocations();
|
|
2435
|
+
return this.node(start2, {
|
|
2436
|
+
kind: Kind.DIRECTIVE_DEFINITION,
|
|
2437
|
+
description,
|
|
2438
|
+
name,
|
|
2439
|
+
arguments: args,
|
|
2440
|
+
repeatable,
|
|
2441
|
+
locations
|
|
2442
|
+
});
|
|
2443
|
+
}
|
|
2444
|
+
/**
|
|
2445
|
+
* DirectiveLocations :
|
|
2446
|
+
* - `|`? DirectiveLocation
|
|
2447
|
+
* - DirectiveLocations | DirectiveLocation
|
|
2448
|
+
*/
|
|
2449
|
+
parseDirectiveLocations() {
|
|
2450
|
+
return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation);
|
|
2451
|
+
}
|
|
2452
|
+
/*
|
|
2453
|
+
* DirectiveLocation :
|
|
2454
|
+
* - ExecutableDirectiveLocation
|
|
2455
|
+
* - TypeSystemDirectiveLocation
|
|
2456
|
+
*
|
|
2457
|
+
* ExecutableDirectiveLocation : one of
|
|
2458
|
+
* `QUERY`
|
|
2459
|
+
* `MUTATION`
|
|
2460
|
+
* `SUBSCRIPTION`
|
|
2461
|
+
* `FIELD`
|
|
2462
|
+
* `FRAGMENT_DEFINITION`
|
|
2463
|
+
* `FRAGMENT_SPREAD`
|
|
2464
|
+
* `INLINE_FRAGMENT`
|
|
2465
|
+
*
|
|
2466
|
+
* TypeSystemDirectiveLocation : one of
|
|
2467
|
+
* `SCHEMA`
|
|
2468
|
+
* `SCALAR`
|
|
2469
|
+
* `OBJECT`
|
|
2470
|
+
* `FIELD_DEFINITION`
|
|
2471
|
+
* `ARGUMENT_DEFINITION`
|
|
2472
|
+
* `INTERFACE`
|
|
2473
|
+
* `UNION`
|
|
2474
|
+
* `ENUM`
|
|
2475
|
+
* `ENUM_VALUE`
|
|
2476
|
+
* `INPUT_OBJECT`
|
|
2477
|
+
* `INPUT_FIELD_DEFINITION`
|
|
2478
|
+
*/
|
|
2479
|
+
parseDirectiveLocation() {
|
|
2480
|
+
const start2 = this._lexer.token;
|
|
2481
|
+
const name = this.parseName();
|
|
2482
|
+
if (Object.prototype.hasOwnProperty.call(DirectiveLocation, name.value)) {
|
|
2483
|
+
return name;
|
|
2484
|
+
}
|
|
2485
|
+
throw this.unexpected(start2);
|
|
2486
|
+
}
|
|
2487
|
+
// Core parsing utility functions
|
|
2488
|
+
/**
|
|
2489
|
+
* Returns a node that, if configured to do so, sets a "loc" field as a
|
|
2490
|
+
* location object, used to identify the place in the source that created a
|
|
2491
|
+
* given parsed object.
|
|
2492
|
+
*/
|
|
2493
|
+
node(startToken, node) {
|
|
2494
|
+
if (this._options.noLocation !== true) {
|
|
2495
|
+
node.loc = new Location(
|
|
2496
|
+
startToken,
|
|
2497
|
+
this._lexer.lastToken,
|
|
2498
|
+
this._lexer.source
|
|
2499
|
+
);
|
|
2500
|
+
}
|
|
2501
|
+
return node;
|
|
2502
|
+
}
|
|
2503
|
+
/**
|
|
2504
|
+
* Determines if the next token is of a given kind
|
|
2505
|
+
*/
|
|
2506
|
+
peek(kind) {
|
|
2507
|
+
return this._lexer.token.kind === kind;
|
|
2508
|
+
}
|
|
2509
|
+
/**
|
|
2510
|
+
* If the next token is of the given kind, return that token after advancing the lexer.
|
|
2511
|
+
* Otherwise, do not change the parser state and throw an error.
|
|
2512
|
+
*/
|
|
2513
|
+
expectToken(kind) {
|
|
2514
|
+
const token = this._lexer.token;
|
|
2515
|
+
if (token.kind === kind) {
|
|
2516
|
+
this.advanceLexer();
|
|
2517
|
+
return token;
|
|
2518
|
+
}
|
|
2519
|
+
throw syntaxError(
|
|
2520
|
+
this._lexer.source,
|
|
2521
|
+
token.start,
|
|
2522
|
+
`Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`
|
|
2523
|
+
);
|
|
2524
|
+
}
|
|
2525
|
+
/**
|
|
2526
|
+
* If the next token is of the given kind, return "true" after advancing the lexer.
|
|
2527
|
+
* Otherwise, do not change the parser state and return "false".
|
|
2528
|
+
*/
|
|
2529
|
+
expectOptionalToken(kind) {
|
|
2530
|
+
const token = this._lexer.token;
|
|
2531
|
+
if (token.kind === kind) {
|
|
2532
|
+
this.advanceLexer();
|
|
2533
|
+
return true;
|
|
2534
|
+
}
|
|
2535
|
+
return false;
|
|
2536
|
+
}
|
|
2537
|
+
/**
|
|
2538
|
+
* If the next token is a given keyword, advance the lexer.
|
|
2539
|
+
* Otherwise, do not change the parser state and throw an error.
|
|
2540
|
+
*/
|
|
2541
|
+
expectKeyword(value) {
|
|
2542
|
+
const token = this._lexer.token;
|
|
2543
|
+
if (token.kind === TokenKind.NAME && token.value === value) {
|
|
2544
|
+
this.advanceLexer();
|
|
2545
|
+
} else {
|
|
2546
|
+
throw syntaxError(
|
|
2547
|
+
this._lexer.source,
|
|
2548
|
+
token.start,
|
|
2549
|
+
`Expected "${value}", found ${getTokenDesc(token)}.`
|
|
2550
|
+
);
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
/**
|
|
2554
|
+
* If the next token is a given keyword, return "true" after advancing the lexer.
|
|
2555
|
+
* Otherwise, do not change the parser state and return "false".
|
|
2556
|
+
*/
|
|
2557
|
+
expectOptionalKeyword(value) {
|
|
2558
|
+
const token = this._lexer.token;
|
|
2559
|
+
if (token.kind === TokenKind.NAME && token.value === value) {
|
|
2560
|
+
this.advanceLexer();
|
|
2561
|
+
return true;
|
|
2562
|
+
}
|
|
2563
|
+
return false;
|
|
2564
|
+
}
|
|
2565
|
+
/**
|
|
2566
|
+
* Helper function for creating an error when an unexpected lexed token is encountered.
|
|
2567
|
+
*/
|
|
2568
|
+
unexpected(atToken) {
|
|
2569
|
+
const token = atToken !== null && atToken !== void 0 ? atToken : this._lexer.token;
|
|
2570
|
+
return syntaxError(
|
|
2571
|
+
this._lexer.source,
|
|
2572
|
+
token.start,
|
|
2573
|
+
`Unexpected ${getTokenDesc(token)}.`
|
|
2574
|
+
);
|
|
2575
|
+
}
|
|
2576
|
+
/**
|
|
2577
|
+
* Returns a possibly empty list of parse nodes, determined by the parseFn.
|
|
2578
|
+
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2579
|
+
* Advances the parser to the next lex token after the closing token.
|
|
2580
|
+
*/
|
|
2581
|
+
any(openKind, parseFn, closeKind) {
|
|
2582
|
+
this.expectToken(openKind);
|
|
2583
|
+
const nodes = [];
|
|
2584
|
+
while (!this.expectOptionalToken(closeKind)) {
|
|
2585
|
+
nodes.push(parseFn.call(this));
|
|
2586
|
+
}
|
|
2587
|
+
return nodes;
|
|
2588
|
+
}
|
|
2589
|
+
/**
|
|
2590
|
+
* Returns a list of parse nodes, determined by the parseFn.
|
|
2591
|
+
* It can be empty only if open token is missing otherwise it will always return non-empty list
|
|
2592
|
+
* that begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2593
|
+
* Advances the parser to the next lex token after the closing token.
|
|
2594
|
+
*/
|
|
2595
|
+
optionalMany(openKind, parseFn, closeKind) {
|
|
2596
|
+
if (this.expectOptionalToken(openKind)) {
|
|
2597
|
+
const nodes = [];
|
|
2598
|
+
do {
|
|
2599
|
+
nodes.push(parseFn.call(this));
|
|
2600
|
+
} while (!this.expectOptionalToken(closeKind));
|
|
2601
|
+
return nodes;
|
|
2602
|
+
}
|
|
2603
|
+
return [];
|
|
2604
|
+
}
|
|
2605
|
+
/**
|
|
2606
|
+
* Returns a non-empty list of parse nodes, determined by the parseFn.
|
|
2607
|
+
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2608
|
+
* Advances the parser to the next lex token after the closing token.
|
|
2609
|
+
*/
|
|
2610
|
+
many(openKind, parseFn, closeKind) {
|
|
2611
|
+
this.expectToken(openKind);
|
|
2612
|
+
const nodes = [];
|
|
2613
|
+
do {
|
|
2614
|
+
nodes.push(parseFn.call(this));
|
|
2615
|
+
} while (!this.expectOptionalToken(closeKind));
|
|
2616
|
+
return nodes;
|
|
2617
|
+
}
|
|
2618
|
+
/**
|
|
2619
|
+
* Returns a non-empty list of parse nodes, determined by the parseFn.
|
|
2620
|
+
* This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
|
|
2621
|
+
* Advances the parser to the next lex token after last item in the list.
|
|
2622
|
+
*/
|
|
2623
|
+
delimitedMany(delimiterKind, parseFn) {
|
|
2624
|
+
this.expectOptionalToken(delimiterKind);
|
|
2625
|
+
const nodes = [];
|
|
2626
|
+
do {
|
|
2627
|
+
nodes.push(parseFn.call(this));
|
|
2628
|
+
} while (this.expectOptionalToken(delimiterKind));
|
|
2629
|
+
return nodes;
|
|
2630
|
+
}
|
|
2631
|
+
advanceLexer() {
|
|
2632
|
+
const { maxTokens } = this._options;
|
|
2633
|
+
const token = this._lexer.advance();
|
|
2634
|
+
if (maxTokens !== void 0 && token.kind !== TokenKind.EOF) {
|
|
2635
|
+
++this._tokenCounter;
|
|
2636
|
+
if (this._tokenCounter > maxTokens) {
|
|
2637
|
+
throw syntaxError(
|
|
2638
|
+
this._lexer.source,
|
|
2639
|
+
token.start,
|
|
2640
|
+
`Document contains more that ${maxTokens} tokens. Parsing aborted.`
|
|
2641
|
+
);
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
function getTokenDesc(token) {
|
|
2647
|
+
const value = token.value;
|
|
2648
|
+
return getTokenKindDesc(token.kind) + (value != null ? ` "${value}"` : "");
|
|
2649
|
+
}
|
|
2650
|
+
function getTokenKindDesc(kind) {
|
|
2651
|
+
return isPunctuatorTokenKind(kind) ? `"${kind}"` : kind;
|
|
2652
|
+
}
|
|
2653
|
+
function printString(str) {
|
|
2654
|
+
return `"${str.replace(escapedRegExp, escapedReplacer)}"`;
|
|
2655
|
+
}
|
|
2656
|
+
const escapedRegExp = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
|
|
2657
|
+
function escapedReplacer(str) {
|
|
2658
|
+
return escapeSequences[str.charCodeAt(0)];
|
|
2659
|
+
}
|
|
2660
|
+
const escapeSequences = [
|
|
2661
|
+
"\\u0000",
|
|
2662
|
+
"\\u0001",
|
|
2663
|
+
"\\u0002",
|
|
2664
|
+
"\\u0003",
|
|
2665
|
+
"\\u0004",
|
|
2666
|
+
"\\u0005",
|
|
2667
|
+
"\\u0006",
|
|
2668
|
+
"\\u0007",
|
|
2669
|
+
"\\b",
|
|
2670
|
+
"\\t",
|
|
2671
|
+
"\\n",
|
|
2672
|
+
"\\u000B",
|
|
2673
|
+
"\\f",
|
|
2674
|
+
"\\r",
|
|
2675
|
+
"\\u000E",
|
|
2676
|
+
"\\u000F",
|
|
2677
|
+
"\\u0010",
|
|
2678
|
+
"\\u0011",
|
|
2679
|
+
"\\u0012",
|
|
2680
|
+
"\\u0013",
|
|
2681
|
+
"\\u0014",
|
|
2682
|
+
"\\u0015",
|
|
2683
|
+
"\\u0016",
|
|
2684
|
+
"\\u0017",
|
|
2685
|
+
"\\u0018",
|
|
2686
|
+
"\\u0019",
|
|
2687
|
+
"\\u001A",
|
|
2688
|
+
"\\u001B",
|
|
2689
|
+
"\\u001C",
|
|
2690
|
+
"\\u001D",
|
|
2691
|
+
"\\u001E",
|
|
2692
|
+
"\\u001F",
|
|
2693
|
+
"",
|
|
2694
|
+
"",
|
|
2695
|
+
'\\"',
|
|
2696
|
+
"",
|
|
2697
|
+
"",
|
|
2698
|
+
"",
|
|
2699
|
+
"",
|
|
2700
|
+
"",
|
|
2701
|
+
"",
|
|
2702
|
+
"",
|
|
2703
|
+
"",
|
|
2704
|
+
"",
|
|
2705
|
+
"",
|
|
2706
|
+
"",
|
|
2707
|
+
"",
|
|
2708
|
+
"",
|
|
2709
|
+
// 2F
|
|
2710
|
+
"",
|
|
2711
|
+
"",
|
|
2712
|
+
"",
|
|
2713
|
+
"",
|
|
2714
|
+
"",
|
|
2715
|
+
"",
|
|
2716
|
+
"",
|
|
2717
|
+
"",
|
|
2718
|
+
"",
|
|
2719
|
+
"",
|
|
2720
|
+
"",
|
|
2721
|
+
"",
|
|
2722
|
+
"",
|
|
2723
|
+
"",
|
|
2724
|
+
"",
|
|
2725
|
+
"",
|
|
2726
|
+
// 3F
|
|
2727
|
+
"",
|
|
2728
|
+
"",
|
|
2729
|
+
"",
|
|
2730
|
+
"",
|
|
2731
|
+
"",
|
|
2732
|
+
"",
|
|
2733
|
+
"",
|
|
2734
|
+
"",
|
|
2735
|
+
"",
|
|
2736
|
+
"",
|
|
2737
|
+
"",
|
|
2738
|
+
"",
|
|
2739
|
+
"",
|
|
2740
|
+
"",
|
|
2741
|
+
"",
|
|
2742
|
+
"",
|
|
2743
|
+
// 4F
|
|
2744
|
+
"",
|
|
2745
|
+
"",
|
|
2746
|
+
"",
|
|
2747
|
+
"",
|
|
2748
|
+
"",
|
|
2749
|
+
"",
|
|
2750
|
+
"",
|
|
2751
|
+
"",
|
|
2752
|
+
"",
|
|
2753
|
+
"",
|
|
2754
|
+
"",
|
|
2755
|
+
"",
|
|
2756
|
+
"\\\\",
|
|
2757
|
+
"",
|
|
2758
|
+
"",
|
|
2759
|
+
"",
|
|
2760
|
+
// 5F
|
|
2761
|
+
"",
|
|
2762
|
+
"",
|
|
2763
|
+
"",
|
|
2764
|
+
"",
|
|
2765
|
+
"",
|
|
2766
|
+
"",
|
|
2767
|
+
"",
|
|
2768
|
+
"",
|
|
2769
|
+
"",
|
|
2770
|
+
"",
|
|
2771
|
+
"",
|
|
2772
|
+
"",
|
|
2773
|
+
"",
|
|
2774
|
+
"",
|
|
2775
|
+
"",
|
|
2776
|
+
"",
|
|
2777
|
+
// 6F
|
|
2778
|
+
"",
|
|
2779
|
+
"",
|
|
2780
|
+
"",
|
|
2781
|
+
"",
|
|
2782
|
+
"",
|
|
2783
|
+
"",
|
|
2784
|
+
"",
|
|
2785
|
+
"",
|
|
2786
|
+
"",
|
|
2787
|
+
"",
|
|
2788
|
+
"",
|
|
2789
|
+
"",
|
|
2790
|
+
"",
|
|
2791
|
+
"",
|
|
2792
|
+
"",
|
|
2793
|
+
"\\u007F",
|
|
2794
|
+
"\\u0080",
|
|
2795
|
+
"\\u0081",
|
|
2796
|
+
"\\u0082",
|
|
2797
|
+
"\\u0083",
|
|
2798
|
+
"\\u0084",
|
|
2799
|
+
"\\u0085",
|
|
2800
|
+
"\\u0086",
|
|
2801
|
+
"\\u0087",
|
|
2802
|
+
"\\u0088",
|
|
2803
|
+
"\\u0089",
|
|
2804
|
+
"\\u008A",
|
|
2805
|
+
"\\u008B",
|
|
2806
|
+
"\\u008C",
|
|
2807
|
+
"\\u008D",
|
|
2808
|
+
"\\u008E",
|
|
2809
|
+
"\\u008F",
|
|
2810
|
+
"\\u0090",
|
|
2811
|
+
"\\u0091",
|
|
2812
|
+
"\\u0092",
|
|
2813
|
+
"\\u0093",
|
|
2814
|
+
"\\u0094",
|
|
2815
|
+
"\\u0095",
|
|
2816
|
+
"\\u0096",
|
|
2817
|
+
"\\u0097",
|
|
2818
|
+
"\\u0098",
|
|
2819
|
+
"\\u0099",
|
|
2820
|
+
"\\u009A",
|
|
2821
|
+
"\\u009B",
|
|
2822
|
+
"\\u009C",
|
|
2823
|
+
"\\u009D",
|
|
2824
|
+
"\\u009E",
|
|
2825
|
+
"\\u009F"
|
|
2826
|
+
];
|
|
2827
|
+
const BREAK = Object.freeze({});
|
|
2828
|
+
function visit(root, visitor, visitorKeys = QueryDocumentKeys) {
|
|
2829
|
+
const enterLeaveMap = /* @__PURE__ */ new Map();
|
|
2830
|
+
for (const kind of Object.values(Kind)) {
|
|
2831
|
+
enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind));
|
|
2832
|
+
}
|
|
2833
|
+
let stack = void 0;
|
|
2834
|
+
let inArray = Array.isArray(root);
|
|
2835
|
+
let keys = [root];
|
|
2836
|
+
let index = -1;
|
|
2837
|
+
let edits = [];
|
|
2838
|
+
let node = root;
|
|
2839
|
+
let key = void 0;
|
|
2840
|
+
let parent = void 0;
|
|
2841
|
+
const path = [];
|
|
2842
|
+
const ancestors = [];
|
|
2843
|
+
do {
|
|
2844
|
+
index++;
|
|
2845
|
+
const isLeaving = index === keys.length;
|
|
2846
|
+
const isEdited = isLeaving && edits.length !== 0;
|
|
2847
|
+
if (isLeaving) {
|
|
2848
|
+
key = ancestors.length === 0 ? void 0 : path[path.length - 1];
|
|
2849
|
+
node = parent;
|
|
2850
|
+
parent = ancestors.pop();
|
|
2851
|
+
if (isEdited) {
|
|
2852
|
+
if (inArray) {
|
|
2853
|
+
node = node.slice();
|
|
2854
|
+
let editOffset = 0;
|
|
2855
|
+
for (const [editKey, editValue] of edits) {
|
|
2856
|
+
const arrayKey = editKey - editOffset;
|
|
2857
|
+
if (editValue === null) {
|
|
2858
|
+
node.splice(arrayKey, 1);
|
|
2859
|
+
editOffset++;
|
|
2860
|
+
} else {
|
|
2861
|
+
node[arrayKey] = editValue;
|
|
2862
|
+
}
|
|
2863
|
+
}
|
|
2864
|
+
} else {
|
|
2865
|
+
node = Object.defineProperties(
|
|
2866
|
+
{},
|
|
2867
|
+
Object.getOwnPropertyDescriptors(node)
|
|
2868
|
+
);
|
|
2869
|
+
for (const [editKey, editValue] of edits) {
|
|
2870
|
+
node[editKey] = editValue;
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
index = stack.index;
|
|
2875
|
+
keys = stack.keys;
|
|
2876
|
+
edits = stack.edits;
|
|
2877
|
+
inArray = stack.inArray;
|
|
2878
|
+
stack = stack.prev;
|
|
2879
|
+
} else if (parent) {
|
|
2880
|
+
key = inArray ? index : keys[index];
|
|
2881
|
+
node = parent[key];
|
|
2882
|
+
if (node === null || node === void 0) {
|
|
2883
|
+
continue;
|
|
2884
|
+
}
|
|
2885
|
+
path.push(key);
|
|
2886
|
+
}
|
|
2887
|
+
let result;
|
|
2888
|
+
if (!Array.isArray(node)) {
|
|
2889
|
+
var _enterLeaveMap$get, _enterLeaveMap$get2;
|
|
2890
|
+
isNode(node) || devAssert(false, `Invalid AST Node: ${inspect(node)}.`);
|
|
2891
|
+
const visitFn = isLeaving ? (_enterLeaveMap$get = enterLeaveMap.get(node.kind)) === null || _enterLeaveMap$get === void 0 ? void 0 : _enterLeaveMap$get.leave : (_enterLeaveMap$get2 = enterLeaveMap.get(node.kind)) === null || _enterLeaveMap$get2 === void 0 ? void 0 : _enterLeaveMap$get2.enter;
|
|
2892
|
+
result = visitFn === null || visitFn === void 0 ? void 0 : visitFn.call(visitor, node, key, parent, path, ancestors);
|
|
2893
|
+
if (result === BREAK) {
|
|
2894
|
+
break;
|
|
2895
|
+
}
|
|
2896
|
+
if (result === false) {
|
|
2897
|
+
if (!isLeaving) {
|
|
2898
|
+
path.pop();
|
|
2899
|
+
continue;
|
|
2900
|
+
}
|
|
2901
|
+
} else if (result !== void 0) {
|
|
2902
|
+
edits.push([key, result]);
|
|
2903
|
+
if (!isLeaving) {
|
|
2904
|
+
if (isNode(result)) {
|
|
2905
|
+
node = result;
|
|
2906
|
+
} else {
|
|
2907
|
+
path.pop();
|
|
2908
|
+
continue;
|
|
2909
|
+
}
|
|
2910
|
+
}
|
|
2911
|
+
}
|
|
2912
|
+
}
|
|
2913
|
+
if (result === void 0 && isEdited) {
|
|
2914
|
+
edits.push([key, node]);
|
|
2915
|
+
}
|
|
2916
|
+
if (isLeaving) {
|
|
2917
|
+
path.pop();
|
|
2918
|
+
} else {
|
|
2919
|
+
var _node$kind;
|
|
2920
|
+
stack = {
|
|
2921
|
+
inArray,
|
|
2922
|
+
index,
|
|
2923
|
+
keys,
|
|
2924
|
+
edits,
|
|
2925
|
+
prev: stack
|
|
2926
|
+
};
|
|
2927
|
+
inArray = Array.isArray(node);
|
|
2928
|
+
keys = inArray ? node : (_node$kind = visitorKeys[node.kind]) !== null && _node$kind !== void 0 ? _node$kind : [];
|
|
2929
|
+
index = -1;
|
|
2930
|
+
edits = [];
|
|
2931
|
+
if (parent) {
|
|
2932
|
+
ancestors.push(parent);
|
|
2933
|
+
}
|
|
2934
|
+
parent = node;
|
|
2935
|
+
}
|
|
2936
|
+
} while (stack !== void 0);
|
|
2937
|
+
if (edits.length !== 0) {
|
|
2938
|
+
return edits[edits.length - 1][1];
|
|
2939
|
+
}
|
|
2940
|
+
return root;
|
|
2941
|
+
}
|
|
2942
|
+
function getEnterLeaveForKind(visitor, kind) {
|
|
2943
|
+
const kindVisitor = visitor[kind];
|
|
2944
|
+
if (typeof kindVisitor === "object") {
|
|
2945
|
+
return kindVisitor;
|
|
2946
|
+
} else if (typeof kindVisitor === "function") {
|
|
2947
|
+
return {
|
|
2948
|
+
enter: kindVisitor,
|
|
2949
|
+
leave: void 0
|
|
2950
|
+
};
|
|
2951
|
+
}
|
|
2952
|
+
return {
|
|
2953
|
+
enter: visitor.enter,
|
|
2954
|
+
leave: visitor.leave
|
|
2955
|
+
};
|
|
2956
|
+
}
|
|
2957
|
+
function print(ast) {
|
|
2958
|
+
return visit(ast, printDocASTReducer);
|
|
2959
|
+
}
|
|
2960
|
+
const MAX_LINE_LENGTH = 80;
|
|
2961
|
+
const printDocASTReducer = {
|
|
2962
|
+
Name: {
|
|
2963
|
+
leave: (node) => node.value
|
|
2964
|
+
},
|
|
2965
|
+
Variable: {
|
|
2966
|
+
leave: (node) => "$" + node.name
|
|
2967
|
+
},
|
|
2968
|
+
// Document
|
|
2969
|
+
Document: {
|
|
2970
|
+
leave: (node) => join(node.definitions, "\n\n")
|
|
2971
|
+
},
|
|
2972
|
+
OperationDefinition: {
|
|
2973
|
+
leave(node) {
|
|
2974
|
+
const varDefs = wrap("(", join(node.variableDefinitions, ", "), ")");
|
|
2975
|
+
const prefix = join(
|
|
2976
|
+
[
|
|
2977
|
+
node.operation,
|
|
2978
|
+
join([node.name, varDefs]),
|
|
2979
|
+
join(node.directives, " ")
|
|
2980
|
+
],
|
|
2981
|
+
" "
|
|
2982
|
+
);
|
|
2983
|
+
return (prefix === "query" ? "" : prefix + " ") + node.selectionSet;
|
|
2984
|
+
}
|
|
2985
|
+
},
|
|
2986
|
+
VariableDefinition: {
|
|
2987
|
+
leave: ({ variable, type, defaultValue, directives }) => variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ", join(directives, " "))
|
|
2988
|
+
},
|
|
2989
|
+
SelectionSet: {
|
|
2990
|
+
leave: ({ selections }) => block(selections)
|
|
2991
|
+
},
|
|
2992
|
+
Field: {
|
|
2993
|
+
leave({ alias, name, arguments: args, directives, selectionSet }) {
|
|
2994
|
+
const prefix = wrap("", alias, ": ") + name;
|
|
2995
|
+
let argsLine = prefix + wrap("(", join(args, ", "), ")");
|
|
2996
|
+
if (argsLine.length > MAX_LINE_LENGTH) {
|
|
2997
|
+
argsLine = prefix + wrap("(\n", indent(join(args, "\n")), "\n)");
|
|
2998
|
+
}
|
|
2999
|
+
return join([argsLine, join(directives, " "), selectionSet], " ");
|
|
3000
|
+
}
|
|
3001
|
+
},
|
|
3002
|
+
Argument: {
|
|
3003
|
+
leave: ({ name, value }) => name + ": " + value
|
|
3004
|
+
},
|
|
3005
|
+
// Fragments
|
|
3006
|
+
FragmentSpread: {
|
|
3007
|
+
leave: ({ name, directives }) => "..." + name + wrap(" ", join(directives, " "))
|
|
3008
|
+
},
|
|
3009
|
+
InlineFragment: {
|
|
3010
|
+
leave: ({ typeCondition, directives, selectionSet }) => join(
|
|
3011
|
+
[
|
|
3012
|
+
"...",
|
|
3013
|
+
wrap("on ", typeCondition),
|
|
3014
|
+
join(directives, " "),
|
|
3015
|
+
selectionSet
|
|
3016
|
+
],
|
|
3017
|
+
" "
|
|
3018
|
+
)
|
|
3019
|
+
},
|
|
3020
|
+
FragmentDefinition: {
|
|
3021
|
+
leave: ({ name, typeCondition, variableDefinitions, directives, selectionSet }) => (
|
|
3022
|
+
// or removed in the future.
|
|
3023
|
+
`fragment ${name}${wrap("(", join(variableDefinitions, ", "), ")")} on ${typeCondition} ${wrap("", join(directives, " "), " ")}` + selectionSet
|
|
3024
|
+
)
|
|
3025
|
+
},
|
|
3026
|
+
// Value
|
|
3027
|
+
IntValue: {
|
|
3028
|
+
leave: ({ value }) => value
|
|
3029
|
+
},
|
|
3030
|
+
FloatValue: {
|
|
3031
|
+
leave: ({ value }) => value
|
|
3032
|
+
},
|
|
3033
|
+
StringValue: {
|
|
3034
|
+
leave: ({ value, block: isBlockString }) => isBlockString ? printBlockString(value) : printString(value)
|
|
3035
|
+
},
|
|
3036
|
+
BooleanValue: {
|
|
3037
|
+
leave: ({ value }) => value ? "true" : "false"
|
|
3038
|
+
},
|
|
3039
|
+
NullValue: {
|
|
3040
|
+
leave: () => "null"
|
|
3041
|
+
},
|
|
3042
|
+
EnumValue: {
|
|
3043
|
+
leave: ({ value }) => value
|
|
3044
|
+
},
|
|
3045
|
+
ListValue: {
|
|
3046
|
+
leave: ({ values }) => "[" + join(values, ", ") + "]"
|
|
3047
|
+
},
|
|
3048
|
+
ObjectValue: {
|
|
3049
|
+
leave: ({ fields }) => "{" + join(fields, ", ") + "}"
|
|
3050
|
+
},
|
|
3051
|
+
ObjectField: {
|
|
3052
|
+
leave: ({ name, value }) => name + ": " + value
|
|
3053
|
+
},
|
|
3054
|
+
// Directive
|
|
3055
|
+
Directive: {
|
|
3056
|
+
leave: ({ name, arguments: args }) => "@" + name + wrap("(", join(args, ", "), ")")
|
|
3057
|
+
},
|
|
3058
|
+
// Type
|
|
3059
|
+
NamedType: {
|
|
3060
|
+
leave: ({ name }) => name
|
|
3061
|
+
},
|
|
3062
|
+
ListType: {
|
|
3063
|
+
leave: ({ type }) => "[" + type + "]"
|
|
3064
|
+
},
|
|
3065
|
+
NonNullType: {
|
|
3066
|
+
leave: ({ type }) => type + "!"
|
|
3067
|
+
},
|
|
3068
|
+
// Type System Definitions
|
|
3069
|
+
SchemaDefinition: {
|
|
3070
|
+
leave: ({ description, directives, operationTypes }) => wrap("", description, "\n") + join(["schema", join(directives, " "), block(operationTypes)], " ")
|
|
3071
|
+
},
|
|
3072
|
+
OperationTypeDefinition: {
|
|
3073
|
+
leave: ({ operation, type }) => operation + ": " + type
|
|
3074
|
+
},
|
|
3075
|
+
ScalarTypeDefinition: {
|
|
3076
|
+
leave: ({ description, name, directives }) => wrap("", description, "\n") + join(["scalar", name, join(directives, " ")], " ")
|
|
3077
|
+
},
|
|
3078
|
+
ObjectTypeDefinition: {
|
|
3079
|
+
leave: ({ description, name, interfaces: interfaces2, directives, fields }) => wrap("", description, "\n") + join(
|
|
3080
|
+
[
|
|
3081
|
+
"type",
|
|
3082
|
+
name,
|
|
3083
|
+
wrap("implements ", join(interfaces2, " & ")),
|
|
3084
|
+
join(directives, " "),
|
|
3085
|
+
block(fields)
|
|
3086
|
+
],
|
|
3087
|
+
" "
|
|
3088
|
+
)
|
|
3089
|
+
},
|
|
3090
|
+
FieldDefinition: {
|
|
3091
|
+
leave: ({ description, name, arguments: args, type, directives }) => wrap("", description, "\n") + name + (hasMultilineItems(args) ? wrap("(\n", indent(join(args, "\n")), "\n)") : wrap("(", join(args, ", "), ")")) + ": " + type + wrap(" ", join(directives, " "))
|
|
3092
|
+
},
|
|
3093
|
+
InputValueDefinition: {
|
|
3094
|
+
leave: ({ description, name, type, defaultValue, directives }) => wrap("", description, "\n") + join(
|
|
3095
|
+
[name + ": " + type, wrap("= ", defaultValue), join(directives, " ")],
|
|
3096
|
+
" "
|
|
3097
|
+
)
|
|
3098
|
+
},
|
|
3099
|
+
InterfaceTypeDefinition: {
|
|
3100
|
+
leave: ({ description, name, interfaces: interfaces2, directives, fields }) => wrap("", description, "\n") + join(
|
|
3101
|
+
[
|
|
3102
|
+
"interface",
|
|
3103
|
+
name,
|
|
3104
|
+
wrap("implements ", join(interfaces2, " & ")),
|
|
3105
|
+
join(directives, " "),
|
|
3106
|
+
block(fields)
|
|
3107
|
+
],
|
|
3108
|
+
" "
|
|
3109
|
+
)
|
|
3110
|
+
},
|
|
3111
|
+
UnionTypeDefinition: {
|
|
3112
|
+
leave: ({ description, name, directives, types }) => wrap("", description, "\n") + join(
|
|
3113
|
+
["union", name, join(directives, " "), wrap("= ", join(types, " | "))],
|
|
3114
|
+
" "
|
|
3115
|
+
)
|
|
3116
|
+
},
|
|
3117
|
+
EnumTypeDefinition: {
|
|
3118
|
+
leave: ({ description, name, directives, values }) => wrap("", description, "\n") + join(["enum", name, join(directives, " "), block(values)], " ")
|
|
3119
|
+
},
|
|
3120
|
+
EnumValueDefinition: {
|
|
3121
|
+
leave: ({ description, name, directives }) => wrap("", description, "\n") + join([name, join(directives, " ")], " ")
|
|
3122
|
+
},
|
|
3123
|
+
InputObjectTypeDefinition: {
|
|
3124
|
+
leave: ({ description, name, directives, fields }) => wrap("", description, "\n") + join(["input", name, join(directives, " "), block(fields)], " ")
|
|
3125
|
+
},
|
|
3126
|
+
DirectiveDefinition: {
|
|
3127
|
+
leave: ({ description, name, arguments: args, repeatable, locations }) => wrap("", description, "\n") + "directive @" + name + (hasMultilineItems(args) ? wrap("(\n", indent(join(args, "\n")), "\n)") : wrap("(", join(args, ", "), ")")) + (repeatable ? " repeatable" : "") + " on " + join(locations, " | ")
|
|
3128
|
+
},
|
|
3129
|
+
SchemaExtension: {
|
|
3130
|
+
leave: ({ directives, operationTypes }) => join(
|
|
3131
|
+
["extend schema", join(directives, " "), block(operationTypes)],
|
|
3132
|
+
" "
|
|
3133
|
+
)
|
|
3134
|
+
},
|
|
3135
|
+
ScalarTypeExtension: {
|
|
3136
|
+
leave: ({ name, directives }) => join(["extend scalar", name, join(directives, " ")], " ")
|
|
3137
|
+
},
|
|
3138
|
+
ObjectTypeExtension: {
|
|
3139
|
+
leave: ({ name, interfaces: interfaces2, directives, fields }) => join(
|
|
3140
|
+
[
|
|
3141
|
+
"extend type",
|
|
3142
|
+
name,
|
|
3143
|
+
wrap("implements ", join(interfaces2, " & ")),
|
|
3144
|
+
join(directives, " "),
|
|
3145
|
+
block(fields)
|
|
3146
|
+
],
|
|
3147
|
+
" "
|
|
3148
|
+
)
|
|
3149
|
+
},
|
|
3150
|
+
InterfaceTypeExtension: {
|
|
3151
|
+
leave: ({ name, interfaces: interfaces2, directives, fields }) => join(
|
|
3152
|
+
[
|
|
3153
|
+
"extend interface",
|
|
3154
|
+
name,
|
|
3155
|
+
wrap("implements ", join(interfaces2, " & ")),
|
|
3156
|
+
join(directives, " "),
|
|
3157
|
+
block(fields)
|
|
3158
|
+
],
|
|
3159
|
+
" "
|
|
3160
|
+
)
|
|
3161
|
+
},
|
|
3162
|
+
UnionTypeExtension: {
|
|
3163
|
+
leave: ({ name, directives, types }) => join(
|
|
3164
|
+
[
|
|
3165
|
+
"extend union",
|
|
3166
|
+
name,
|
|
3167
|
+
join(directives, " "),
|
|
3168
|
+
wrap("= ", join(types, " | "))
|
|
3169
|
+
],
|
|
3170
|
+
" "
|
|
3171
|
+
)
|
|
3172
|
+
},
|
|
3173
|
+
EnumTypeExtension: {
|
|
3174
|
+
leave: ({ name, directives, values }) => join(["extend enum", name, join(directives, " "), block(values)], " ")
|
|
3175
|
+
},
|
|
3176
|
+
InputObjectTypeExtension: {
|
|
3177
|
+
leave: ({ name, directives, fields }) => join(["extend input", name, join(directives, " "), block(fields)], " ")
|
|
3178
|
+
}
|
|
3179
|
+
};
|
|
3180
|
+
function join(maybeArray, separator = "") {
|
|
3181
|
+
var _maybeArray$filter$jo;
|
|
3182
|
+
return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter((x) => x).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : "";
|
|
3183
|
+
}
|
|
3184
|
+
function block(array) {
|
|
3185
|
+
return wrap("{\n", indent(join(array, "\n")), "\n}");
|
|
3186
|
+
}
|
|
3187
|
+
function wrap(start2, maybeString, end = "") {
|
|
3188
|
+
return maybeString != null && maybeString !== "" ? start2 + maybeString + end : "";
|
|
3189
|
+
}
|
|
3190
|
+
function indent(str) {
|
|
3191
|
+
return wrap(" ", str.replace(/\n/g, "\n "));
|
|
3192
|
+
}
|
|
3193
|
+
function hasMultilineItems(maybeArray) {
|
|
3194
|
+
var _maybeArray$some;
|
|
3195
|
+
return (_maybeArray$some = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.some((str) => str.includes("\n"))) !== null && _maybeArray$some !== void 0 ? _maybeArray$some : false;
|
|
3196
|
+
}
|
|
3197
|
+
var e;
|
|
3198
|
+
!function(e2) {
|
|
3199
|
+
e2[e2.Pull = 0] = "Pull";
|
|
3200
|
+
e2[e2.Close = 1] = "Close";
|
|
3201
|
+
}(e || (e = {}));
|
|
3202
|
+
var r;
|
|
3203
|
+
!function(e2) {
|
|
3204
|
+
e2[e2.Start = 0] = "Start";
|
|
3205
|
+
e2[e2.Push = 1] = "Push";
|
|
3206
|
+
e2[e2.End = 0] = "End";
|
|
3207
|
+
}(r || (r = {}));
|
|
3208
|
+
var teardownPlaceholder = () => {
|
|
3209
|
+
};
|
|
3210
|
+
var t = teardownPlaceholder;
|
|
3211
|
+
function start(e2) {
|
|
3212
|
+
var t2 = [e2];
|
|
3213
|
+
t2.tag = r.Start;
|
|
3214
|
+
return t2;
|
|
3215
|
+
}
|
|
3216
|
+
function onEnd(t2) {
|
|
3217
|
+
return (l2) => (n) => {
|
|
3218
|
+
var a = false;
|
|
3219
|
+
l2((l3) => {
|
|
3220
|
+
if (a)
|
|
3221
|
+
;
|
|
3222
|
+
else if (l3 === r.End) {
|
|
3223
|
+
a = true;
|
|
3224
|
+
n(r.End);
|
|
3225
|
+
t2();
|
|
3226
|
+
} else if (l3.tag === r.Start) {
|
|
3227
|
+
var i2 = l3[0];
|
|
3228
|
+
n(start((r2) => {
|
|
3229
|
+
if (r2 === e.Close) {
|
|
3230
|
+
a = true;
|
|
3231
|
+
i2(e.Close);
|
|
3232
|
+
t2();
|
|
3233
|
+
} else {
|
|
3234
|
+
i2(r2);
|
|
3235
|
+
}
|
|
3236
|
+
}));
|
|
3237
|
+
} else {
|
|
3238
|
+
n(l3);
|
|
3239
|
+
}
|
|
3240
|
+
});
|
|
3241
|
+
};
|
|
3242
|
+
}
|
|
3243
|
+
function take(l2) {
|
|
3244
|
+
return (n) => (a) => {
|
|
3245
|
+
var i2 = t;
|
|
3246
|
+
var s2 = false;
|
|
3247
|
+
var f2 = 0;
|
|
3248
|
+
n((t2) => {
|
|
3249
|
+
if (s2)
|
|
3250
|
+
;
|
|
3251
|
+
else if (t2 === r.End) {
|
|
3252
|
+
s2 = true;
|
|
3253
|
+
a(r.End);
|
|
3254
|
+
} else if (t2.tag === r.Start) {
|
|
3255
|
+
if (l2 <= 0) {
|
|
3256
|
+
s2 = true;
|
|
3257
|
+
a(r.End);
|
|
3258
|
+
t2[0](e.Close);
|
|
3259
|
+
} else {
|
|
3260
|
+
i2 = t2[0];
|
|
3261
|
+
}
|
|
3262
|
+
} else if (f2++ < l2) {
|
|
3263
|
+
a(t2);
|
|
3264
|
+
if (!s2 && f2 >= l2) {
|
|
3265
|
+
s2 = true;
|
|
3266
|
+
a(r.End);
|
|
3267
|
+
i2(e.Close);
|
|
3268
|
+
}
|
|
3269
|
+
} else {
|
|
3270
|
+
a(t2);
|
|
3271
|
+
}
|
|
3272
|
+
});
|
|
3273
|
+
a(start((r2) => {
|
|
3274
|
+
if (r2 === e.Close && !s2) {
|
|
3275
|
+
s2 = true;
|
|
3276
|
+
i2(e.Close);
|
|
3277
|
+
} else if (r2 === e.Pull && !s2 && f2 < l2) {
|
|
3278
|
+
i2(e.Pull);
|
|
3279
|
+
}
|
|
3280
|
+
}));
|
|
3281
|
+
};
|
|
3282
|
+
}
|
|
3283
|
+
function subscribe(l2) {
|
|
3284
|
+
return (n) => {
|
|
3285
|
+
var a = t;
|
|
3286
|
+
var i2 = false;
|
|
3287
|
+
n((t2) => {
|
|
3288
|
+
if (t2 === r.End) {
|
|
3289
|
+
i2 = true;
|
|
3290
|
+
} else if (t2.tag === r.Start) {
|
|
3291
|
+
(a = t2[0])(e.Pull);
|
|
3292
|
+
} else if (!i2) {
|
|
3293
|
+
l2(t2[0]);
|
|
3294
|
+
a(e.Pull);
|
|
3295
|
+
}
|
|
3296
|
+
});
|
|
3297
|
+
return {
|
|
3298
|
+
unsubscribe() {
|
|
3299
|
+
if (!i2) {
|
|
3300
|
+
i2 = true;
|
|
3301
|
+
a(e.Close);
|
|
3302
|
+
}
|
|
3303
|
+
}
|
|
3304
|
+
};
|
|
3305
|
+
};
|
|
3306
|
+
}
|
|
3307
|
+
function toPromise(l2) {
|
|
3308
|
+
return new Promise((n) => {
|
|
3309
|
+
var a = t;
|
|
3310
|
+
var i2;
|
|
3311
|
+
l2((t2) => {
|
|
3312
|
+
if (t2 === r.End) {
|
|
3313
|
+
Promise.resolve(i2).then(n);
|
|
3314
|
+
} else if (t2.tag === r.Start) {
|
|
3315
|
+
(a = t2[0])(e.Pull);
|
|
3316
|
+
} else {
|
|
3317
|
+
i2 = t2[0];
|
|
3318
|
+
a(e.Pull);
|
|
3319
|
+
}
|
|
3320
|
+
});
|
|
3321
|
+
});
|
|
3322
|
+
}
|
|
3323
|
+
var phash = (r2, e2) => {
|
|
3324
|
+
var t2 = "number" == typeof e2 ? 0 | e2 : 5381;
|
|
3325
|
+
for (var a = 0, n = 0 | r2.length; a < n; a++) {
|
|
3326
|
+
t2 = (t2 << 5) + t2 + r2.charCodeAt(a);
|
|
3327
|
+
}
|
|
3328
|
+
return t2;
|
|
3329
|
+
};
|
|
3330
|
+
var o = /* @__PURE__ */ new Set();
|
|
3331
|
+
var i = /* @__PURE__ */ new WeakMap();
|
|
3332
|
+
var stringify = (r2) => {
|
|
3333
|
+
if (null === r2 || o.has(r2)) {
|
|
3334
|
+
return "null";
|
|
3335
|
+
} else if ("object" != typeof r2) {
|
|
3336
|
+
return JSON.stringify(r2) || "";
|
|
3337
|
+
} else if (r2.toJSON) {
|
|
3338
|
+
return stringify(r2.toJSON());
|
|
3339
|
+
} else if (Array.isArray(r2)) {
|
|
3340
|
+
var e2 = "[";
|
|
3341
|
+
for (var t2 of r2) {
|
|
3342
|
+
if ("[" !== e2) {
|
|
3343
|
+
e2 += ",";
|
|
3344
|
+
}
|
|
3345
|
+
e2 += (t2 = stringify(t2)).length > 0 ? t2 : "null";
|
|
3346
|
+
}
|
|
3347
|
+
return e2 += "]";
|
|
3348
|
+
}
|
|
3349
|
+
var a = Object.keys(r2).sort();
|
|
3350
|
+
if (!a.length && r2.constructor && r2.constructor !== Object) {
|
|
3351
|
+
var n = i.get(r2) || Math.random().toString(36).slice(2);
|
|
3352
|
+
i.set(r2, n);
|
|
3353
|
+
return `{"__key":"${n}"}`;
|
|
3354
|
+
}
|
|
3355
|
+
o.add(r2);
|
|
3356
|
+
var s2 = "{";
|
|
3357
|
+
for (var v2 of a) {
|
|
3358
|
+
var f2 = stringify(r2[v2]);
|
|
3359
|
+
if (f2) {
|
|
3360
|
+
if (s2.length > 1) {
|
|
3361
|
+
s2 += ",";
|
|
3362
|
+
}
|
|
3363
|
+
s2 += stringify(v2) + ":" + f2;
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
o.delete(r2);
|
|
3367
|
+
return s2 += "}";
|
|
3368
|
+
};
|
|
3369
|
+
var stringifyVariables = (r2) => {
|
|
3370
|
+
o.clear();
|
|
3371
|
+
return stringify(r2);
|
|
3372
|
+
};
|
|
3373
|
+
var s = /("{3}[\s\S]*"{3}|"(?:\\.|[^"])*")/g;
|
|
3374
|
+
var v = /(#[^\n\r]+)?(?:\n|\r\n?|$)+/g;
|
|
3375
|
+
var replaceOutsideStrings = (r2, e2) => e2 % 2 == 0 ? r2.replace(v, "\n") : r2;
|
|
3376
|
+
var sanitizeDocument = (r2) => r2.split(s).map(replaceOutsideStrings).join("").trim();
|
|
3377
|
+
var f = /* @__PURE__ */ new Map();
|
|
3378
|
+
var l = /* @__PURE__ */ new Map();
|
|
3379
|
+
var stringifyDocument = (r2) => {
|
|
3380
|
+
var e2;
|
|
3381
|
+
if ("string" == typeof r2) {
|
|
3382
|
+
e2 = sanitizeDocument(r2);
|
|
3383
|
+
} else if (r2.loc && l.get(r2.__key) === r2) {
|
|
3384
|
+
e2 = r2.loc.source.body;
|
|
3385
|
+
} else {
|
|
3386
|
+
e2 = f.get(r2) || sanitizeDocument(print(r2));
|
|
3387
|
+
f.set(r2, e2);
|
|
3388
|
+
}
|
|
3389
|
+
if ("string" != typeof r2 && !r2.loc) {
|
|
3390
|
+
r2.loc = {
|
|
3391
|
+
start: 0,
|
|
3392
|
+
end: e2.length,
|
|
3393
|
+
source: {
|
|
3394
|
+
body: e2,
|
|
3395
|
+
name: "gql",
|
|
3396
|
+
locationOffset: {
|
|
3397
|
+
line: 1,
|
|
3398
|
+
column: 1
|
|
3399
|
+
}
|
|
3400
|
+
}
|
|
3401
|
+
};
|
|
3402
|
+
}
|
|
3403
|
+
return e2;
|
|
3404
|
+
};
|
|
3405
|
+
var hashDocument = (r2) => {
|
|
3406
|
+
var e2 = phash(stringifyDocument(r2));
|
|
3407
|
+
if ("object" == typeof r2 && "definitions" in r2) {
|
|
3408
|
+
var t2 = getOperationName(r2);
|
|
3409
|
+
if (t2) {
|
|
3410
|
+
e2 = phash(`
|
|
3411
|
+
# ${t2}`, e2);
|
|
3412
|
+
}
|
|
199
3413
|
}
|
|
200
|
-
return
|
|
3414
|
+
return e2;
|
|
201
3415
|
};
|
|
202
|
-
|
|
203
|
-
|
|
3416
|
+
var keyDocument = (r2) => {
|
|
3417
|
+
var e2;
|
|
3418
|
+
var t2;
|
|
3419
|
+
if ("string" == typeof r2) {
|
|
3420
|
+
e2 = hashDocument(r2);
|
|
3421
|
+
t2 = l.get(e2) || parse(r2, {
|
|
3422
|
+
noLocation: true
|
|
3423
|
+
});
|
|
3424
|
+
} else {
|
|
3425
|
+
e2 = r2.__key || hashDocument(r2);
|
|
3426
|
+
t2 = l.get(e2) || r2;
|
|
3427
|
+
}
|
|
3428
|
+
if (!t2.loc) {
|
|
3429
|
+
stringifyDocument(t2);
|
|
3430
|
+
}
|
|
3431
|
+
t2.__key = e2;
|
|
3432
|
+
l.set(e2, t2);
|
|
3433
|
+
return t2;
|
|
3434
|
+
};
|
|
3435
|
+
var createRequest = (r2, e2) => {
|
|
3436
|
+
if (!e2) {
|
|
3437
|
+
e2 = {};
|
|
3438
|
+
}
|
|
3439
|
+
var t2 = keyDocument(r2);
|
|
3440
|
+
var a = stringifyVariables(e2);
|
|
3441
|
+
var n = t2.__key;
|
|
3442
|
+
if ("{}" !== a) {
|
|
3443
|
+
n = phash(a, n);
|
|
3444
|
+
}
|
|
3445
|
+
return {
|
|
3446
|
+
key: n,
|
|
3447
|
+
query: t2,
|
|
3448
|
+
variables: e2
|
|
3449
|
+
};
|
|
3450
|
+
};
|
|
3451
|
+
var getOperationName = (r2) => {
|
|
3452
|
+
for (var t2 of r2.definitions) {
|
|
3453
|
+
if (t2.kind === Kind.OPERATION_DEFINITION && t2.name) {
|
|
3454
|
+
return t2.name.value;
|
|
3455
|
+
}
|
|
3456
|
+
}
|
|
3457
|
+
};
|
|
3458
|
+
"undefined" != typeof TextDecoder ? new TextDecoder() : null;
|
|
3459
|
+
function useClient() {
|
|
3460
|
+
if ("production" !== process.env.NODE_ENV && !vue.getCurrentInstance()) {
|
|
3461
|
+
throw new Error("use* functions may only be called during the `setup()` or other lifecycle hooks.");
|
|
3462
|
+
}
|
|
3463
|
+
var e2 = vue.inject("$urql");
|
|
3464
|
+
if ("production" !== process.env.NODE_ENV && !e2) {
|
|
3465
|
+
throw new Error("No urql Client was provided. Did you forget to install the plugin or call `provideClient` in a parent?");
|
|
3466
|
+
}
|
|
3467
|
+
return e2;
|
|
3468
|
+
}
|
|
3469
|
+
function unwrapPossibleProxy(e2) {
|
|
3470
|
+
return e2 && vue.isRef(e2) ? e2.value : e2;
|
|
3471
|
+
}
|
|
3472
|
+
var b = {
|
|
3473
|
+
flush: "pre"
|
|
3474
|
+
};
|
|
3475
|
+
function callUseQuery(e2, l2 = useClient(), t2 = []) {
|
|
3476
|
+
var n = vue.reactive(e2);
|
|
3477
|
+
var o2 = vue.ref();
|
|
3478
|
+
var v2 = vue.ref(false);
|
|
3479
|
+
var f2 = vue.ref(false);
|
|
3480
|
+
var y = vue.ref();
|
|
3481
|
+
var d2 = vue.ref();
|
|
3482
|
+
var h = vue.ref();
|
|
3483
|
+
var x = vue.isRef(e2.pause) ? e2.pause : vue.ref(!!e2.pause);
|
|
3484
|
+
var w = vue.ref(createRequest(n.query, unwrapPossibleProxy(n.variables)));
|
|
3485
|
+
var P = vue.ref();
|
|
3486
|
+
t2.push(vue.watchEffect(() => {
|
|
3487
|
+
var e3 = createRequest(n.query, unwrapPossibleProxy(n.variables));
|
|
3488
|
+
if (w.value.key !== e3.key) {
|
|
3489
|
+
w.value = e3;
|
|
3490
|
+
}
|
|
3491
|
+
}, b));
|
|
3492
|
+
t2.push(vue.watchEffect(() => {
|
|
3493
|
+
P.value = !x.value ? l2.value.executeQuery(w.value, {
|
|
3494
|
+
requestPolicy: n.requestPolicy,
|
|
3495
|
+
...n.context
|
|
3496
|
+
}) : void 0;
|
|
3497
|
+
}, b));
|
|
3498
|
+
var q = {
|
|
3499
|
+
data: o2,
|
|
3500
|
+
stale: v2,
|
|
3501
|
+
error: y,
|
|
3502
|
+
operation: d2,
|
|
3503
|
+
extensions: h,
|
|
3504
|
+
fetching: f2,
|
|
3505
|
+
isPaused: x,
|
|
3506
|
+
executeQuery(e3) {
|
|
3507
|
+
var u = P.value = l2.value.executeQuery(w.value, {
|
|
3508
|
+
requestPolicy: n.requestPolicy,
|
|
3509
|
+
...n.context,
|
|
3510
|
+
...e3
|
|
3511
|
+
});
|
|
3512
|
+
return {
|
|
3513
|
+
...E,
|
|
3514
|
+
then(e4, r2) {
|
|
3515
|
+
var a;
|
|
3516
|
+
return new Promise((e5) => {
|
|
3517
|
+
var r3 = false;
|
|
3518
|
+
a = subscribe(() => {
|
|
3519
|
+
if (!q.fetching.value && !q.stale.value) {
|
|
3520
|
+
if (a) {
|
|
3521
|
+
a.unsubscribe();
|
|
3522
|
+
}
|
|
3523
|
+
r3 = true;
|
|
3524
|
+
e5(q);
|
|
3525
|
+
}
|
|
3526
|
+
})(u);
|
|
3527
|
+
if (r3) {
|
|
3528
|
+
a.unsubscribe();
|
|
3529
|
+
}
|
|
3530
|
+
}).then(e4, r2);
|
|
3531
|
+
}
|
|
3532
|
+
};
|
|
3533
|
+
},
|
|
3534
|
+
pause() {
|
|
3535
|
+
x.value = true;
|
|
3536
|
+
},
|
|
3537
|
+
resume() {
|
|
3538
|
+
x.value = false;
|
|
3539
|
+
}
|
|
3540
|
+
};
|
|
3541
|
+
t2.push(vue.watchEffect((e3) => {
|
|
3542
|
+
if (P.value) {
|
|
3543
|
+
f2.value = true;
|
|
3544
|
+
v2.value = false;
|
|
3545
|
+
e3(subscribe((e4) => {
|
|
3546
|
+
o2.value = e4.data;
|
|
3547
|
+
v2.value = !!e4.stale;
|
|
3548
|
+
f2.value = false;
|
|
3549
|
+
y.value = e4.error;
|
|
3550
|
+
d2.value = e4.operation;
|
|
3551
|
+
h.value = e4.extensions;
|
|
3552
|
+
})(onEnd(() => {
|
|
3553
|
+
f2.value = false;
|
|
3554
|
+
v2.value = false;
|
|
3555
|
+
})(P.value)).unsubscribe);
|
|
3556
|
+
} else {
|
|
3557
|
+
f2.value = false;
|
|
3558
|
+
v2.value = false;
|
|
3559
|
+
}
|
|
3560
|
+
}, {
|
|
3561
|
+
flush: "sync"
|
|
3562
|
+
}));
|
|
3563
|
+
var E = {
|
|
3564
|
+
...q,
|
|
3565
|
+
then(e3, u) {
|
|
3566
|
+
var r2;
|
|
3567
|
+
return new Promise((e4) => {
|
|
3568
|
+
if (!P.value) {
|
|
3569
|
+
return e4(q);
|
|
3570
|
+
}
|
|
3571
|
+
var u2 = false;
|
|
3572
|
+
r2 = subscribe(() => {
|
|
3573
|
+
if (!q.fetching.value && !q.stale.value) {
|
|
3574
|
+
if (r2) {
|
|
3575
|
+
r2.unsubscribe();
|
|
3576
|
+
}
|
|
3577
|
+
u2 = true;
|
|
3578
|
+
e4(q);
|
|
3579
|
+
}
|
|
3580
|
+
})(P.value);
|
|
3581
|
+
if (u2) {
|
|
3582
|
+
r2.unsubscribe();
|
|
3583
|
+
}
|
|
3584
|
+
}).then(e3, u);
|
|
3585
|
+
}
|
|
3586
|
+
};
|
|
3587
|
+
return E;
|
|
3588
|
+
}
|
|
3589
|
+
function callUseMutation(e2, r2 = useClient()) {
|
|
3590
|
+
var l2 = vue.ref();
|
|
3591
|
+
var t2 = vue.ref(false);
|
|
3592
|
+
var n = vue.ref(false);
|
|
3593
|
+
var s2 = vue.ref();
|
|
3594
|
+
var i2 = vue.ref();
|
|
3595
|
+
var o2 = vue.ref();
|
|
3596
|
+
return {
|
|
3597
|
+
data: l2,
|
|
3598
|
+
stale: t2,
|
|
3599
|
+
fetching: n,
|
|
3600
|
+
error: s2,
|
|
3601
|
+
operation: i2,
|
|
3602
|
+
extensions: o2,
|
|
3603
|
+
executeMutation(a, v2) {
|
|
3604
|
+
n.value = true;
|
|
3605
|
+
return toPromise(take(1)(r2.value.executeMutation(createRequest(e2, unwrapPossibleProxy(a)), v2 || {}))).then((e3) => {
|
|
3606
|
+
l2.value = e3.data;
|
|
3607
|
+
t2.value = !!e3.stale;
|
|
3608
|
+
n.value = false;
|
|
3609
|
+
s2.value = e3.error;
|
|
3610
|
+
i2.value = e3.operation;
|
|
3611
|
+
o2.value = e3.extensions;
|
|
3612
|
+
return e3;
|
|
3613
|
+
});
|
|
3614
|
+
}
|
|
3615
|
+
};
|
|
3616
|
+
}
|
|
3617
|
+
var d = {
|
|
3618
|
+
flush: "pre"
|
|
3619
|
+
};
|
|
3620
|
+
function callUseSubscription(e2, l2, t2 = useClient(), n = []) {
|
|
3621
|
+
var o2 = vue.reactive(e2);
|
|
3622
|
+
var v2 = vue.ref();
|
|
3623
|
+
var f2 = vue.ref(false);
|
|
3624
|
+
var y = vue.ref(false);
|
|
3625
|
+
var b2 = vue.ref();
|
|
3626
|
+
var h = vue.ref();
|
|
3627
|
+
var x = vue.ref();
|
|
3628
|
+
var w = vue.ref(l2);
|
|
3629
|
+
var P = vue.isRef(e2.pause) ? e2.pause : vue.ref(!!e2.pause);
|
|
3630
|
+
var q = vue.ref(createRequest(o2.query, unwrapPossibleProxy(o2.variables)));
|
|
3631
|
+
var E = vue.ref();
|
|
3632
|
+
n.push(vue.watchEffect(() => {
|
|
3633
|
+
var e3 = createRequest(o2.query, unwrapPossibleProxy(o2.variables));
|
|
3634
|
+
if (q.value.key !== e3.key) {
|
|
3635
|
+
q.value = e3;
|
|
3636
|
+
}
|
|
3637
|
+
}, d));
|
|
3638
|
+
n.push(vue.watchEffect(() => {
|
|
3639
|
+
E.value = !P.value ? t2.value.executeSubscription(q.value, {
|
|
3640
|
+
...o2.context
|
|
3641
|
+
}) : void 0;
|
|
3642
|
+
}, d));
|
|
3643
|
+
n.push(vue.watchEffect((e3) => {
|
|
3644
|
+
if (E.value) {
|
|
3645
|
+
y.value = true;
|
|
3646
|
+
e3(subscribe((e4) => {
|
|
3647
|
+
y.value = true;
|
|
3648
|
+
v2.value = void 0 !== e4.data ? "function" == typeof w.value ? w.value(v2.value, e4.data) : e4.data : e4.data, b2.value = e4.error;
|
|
3649
|
+
x.value = e4.extensions;
|
|
3650
|
+
f2.value = !!e4.stale;
|
|
3651
|
+
h.value = e4.operation;
|
|
3652
|
+
})(onEnd(() => {
|
|
3653
|
+
y.value = false;
|
|
3654
|
+
})(E.value)).unsubscribe);
|
|
3655
|
+
} else {
|
|
3656
|
+
y.value = false;
|
|
3657
|
+
}
|
|
3658
|
+
}, d));
|
|
3659
|
+
var m = {
|
|
3660
|
+
data: v2,
|
|
3661
|
+
stale: f2,
|
|
3662
|
+
error: b2,
|
|
3663
|
+
operation: h,
|
|
3664
|
+
extensions: x,
|
|
3665
|
+
fetching: y,
|
|
3666
|
+
isPaused: P,
|
|
3667
|
+
executeSubscription(e3) {
|
|
3668
|
+
E.value = t2.value.executeSubscription(q.value, {
|
|
3669
|
+
...o2.context,
|
|
3670
|
+
...e3
|
|
3671
|
+
});
|
|
3672
|
+
return m;
|
|
3673
|
+
},
|
|
3674
|
+
pause() {
|
|
3675
|
+
P.value = true;
|
|
3676
|
+
},
|
|
3677
|
+
resume() {
|
|
3678
|
+
P.value = false;
|
|
3679
|
+
}
|
|
3680
|
+
};
|
|
3681
|
+
return m;
|
|
3682
|
+
}
|
|
3683
|
+
function useClientHandle() {
|
|
3684
|
+
var e2 = useClient();
|
|
3685
|
+
var u = [];
|
|
3686
|
+
vue.onBeforeUnmount(() => {
|
|
3687
|
+
var e3;
|
|
3688
|
+
while (e3 = u.shift()) {
|
|
3689
|
+
e3();
|
|
3690
|
+
}
|
|
3691
|
+
});
|
|
3692
|
+
var r2 = {
|
|
3693
|
+
client: e2.value,
|
|
3694
|
+
useQuery: (r3) => callUseQuery(r3, e2, u),
|
|
3695
|
+
useSubscription: (r3, a) => callUseSubscription(r3, a, e2, u),
|
|
3696
|
+
useMutation: (u2) => callUseMutation(u2, e2)
|
|
3697
|
+
};
|
|
3698
|
+
if ("production" !== process.env.NODE_ENV) {
|
|
3699
|
+
vue.onMounted(() => {
|
|
3700
|
+
Object.assign(r2, {
|
|
3701
|
+
useQuery(r3) {
|
|
3702
|
+
if ("production" !== process.env.NODE_ENV && !vue.getCurrentInstance()) {
|
|
3703
|
+
throw new Error("`handle.useQuery()` should only be called in the `setup()` or a lifecycle hook.");
|
|
3704
|
+
}
|
|
3705
|
+
return callUseQuery(r3, e2, u);
|
|
3706
|
+
},
|
|
3707
|
+
useSubscription(r3, a) {
|
|
3708
|
+
if ("production" !== process.env.NODE_ENV && !vue.getCurrentInstance()) {
|
|
3709
|
+
throw new Error("`handle.useSubscription()` should only be called in the `setup()` or a lifecycle hook.");
|
|
3710
|
+
}
|
|
3711
|
+
return callUseSubscription(r3, a, e2, u);
|
|
3712
|
+
}
|
|
3713
|
+
});
|
|
3714
|
+
});
|
|
3715
|
+
}
|
|
3716
|
+
return r2;
|
|
3717
|
+
}
|
|
3718
|
+
const __default__$1 = vue.defineComponent({ name: "TaskWorkButton" });
|
|
3719
|
+
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
3720
|
+
...__default__$1,
|
|
3721
|
+
setup(__props) {
|
|
3722
|
+
useClientHandle();
|
|
3723
|
+
const startTaskWork = () => {
|
|
3724
|
+
console.info("Start work");
|
|
3725
|
+
};
|
|
3726
|
+
return (_ctx, _cache) => {
|
|
3727
|
+
return vue.openBlock(), vue.createBlock(vue.unref(interfaces.NeonButton), {
|
|
3728
|
+
"is-rounded": true,
|
|
3729
|
+
size: "sm",
|
|
3730
|
+
color: "warning",
|
|
3731
|
+
"icon-left": "play",
|
|
3732
|
+
label: "Mulai",
|
|
3733
|
+
onClick: startTaskWork
|
|
3734
|
+
});
|
|
3735
|
+
};
|
|
3736
|
+
}
|
|
3737
|
+
});
|
|
204
3738
|
const __default__ = vue.defineComponent({ name: "TaskCollection" });
|
|
205
|
-
const _sfc_main$
|
|
3739
|
+
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
206
3740
|
...__default__,
|
|
207
3741
|
setup(__props) {
|
|
208
3742
|
context.useCollection();
|
|
@@ -217,7 +3751,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
217
3751
|
};
|
|
218
3752
|
}
|
|
219
3753
|
});
|
|
220
|
-
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
3754
|
+
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
221
3755
|
__name: "TaskSingle",
|
|
222
3756
|
setup(__props) {
|
|
223
3757
|
const {
|
|
@@ -445,15 +3979,246 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
445
3979
|
};
|
|
446
3980
|
}
|
|
447
3981
|
});
|
|
3982
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
3983
|
+
__name: "TaskWork",
|
|
3984
|
+
setup(__props) {
|
|
3985
|
+
const {
|
|
3986
|
+
fields,
|
|
3987
|
+
id,
|
|
3988
|
+
initialValues,
|
|
3989
|
+
values,
|
|
3990
|
+
isNew,
|
|
3991
|
+
isLoading,
|
|
3992
|
+
isChanged,
|
|
3993
|
+
isReady,
|
|
3994
|
+
isMain,
|
|
3995
|
+
saveOne,
|
|
3996
|
+
discardChanges
|
|
3997
|
+
} = context.useSingle();
|
|
3998
|
+
function onChangeDateUpdate(date) {
|
|
3999
|
+
values.value.estimatedStartDate = date == null ? void 0 : date.start.toISOString();
|
|
4000
|
+
values.value.estimatedEndDate = date == null ? void 0 : date.end.toISOString();
|
|
4001
|
+
}
|
|
4002
|
+
return (_ctx, _cache) => {
|
|
4003
|
+
return vue.openBlock(), vue.createBlock(vue.unref(context.NeonSingle), { class: "neu-task-single" }, {
|
|
4004
|
+
default: vue.withCtx(() => [
|
|
4005
|
+
vue.createVNode(vue.unref(office.OfficeTabs), { "use-url": vue.unref(isMain) }, {
|
|
4006
|
+
default: vue.withCtx(() => [
|
|
4007
|
+
vue.createVNode(vue.unref(office.OfficeTab), {
|
|
4008
|
+
handle: "info",
|
|
4009
|
+
icon: "circle-info",
|
|
4010
|
+
title: "Info"
|
|
4011
|
+
}, {
|
|
4012
|
+
default: vue.withCtx(() => [
|
|
4013
|
+
vue.createVNode(vue.unref(form.NeonForm), {
|
|
4014
|
+
handle: "info",
|
|
4015
|
+
"initial-values": vue.unref(initialValues),
|
|
4016
|
+
"is-loading": vue.unref(isLoading),
|
|
4017
|
+
"is-changed": vue.unref(isChanged),
|
|
4018
|
+
"use-unsaved": "",
|
|
4019
|
+
onCancel: vue.unref(discardChanges),
|
|
4020
|
+
onSubmit: vue.unref(saveOne)
|
|
4021
|
+
}, {
|
|
4022
|
+
default: vue.withCtx(() => [
|
|
4023
|
+
vue.createVNode(vue.unref(form.NeonFields), {
|
|
4024
|
+
md: "grid gap-4",
|
|
4025
|
+
title: "Pekerjaan"
|
|
4026
|
+
}, {
|
|
4027
|
+
default: vue.withCtx(() => [
|
|
4028
|
+
vue.createVNode(vue.unref(form.NeonField), vue.mergeProps({
|
|
4029
|
+
modelValue: vue.unref(values).priority,
|
|
4030
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(values).priority = $event)
|
|
4031
|
+
}, vue.unref(fields).priority), null, 16, ["modelValue"])
|
|
4032
|
+
]),
|
|
4033
|
+
_: 1
|
|
4034
|
+
/* STABLE */
|
|
4035
|
+
}),
|
|
4036
|
+
vue.createVNode(vue.unref(form.NeonFields), { md: "grid gap-4 sm:grid-cols-2" }, {
|
|
4037
|
+
default: vue.withCtx(() => [
|
|
4038
|
+
vue.createVNode(vue.unref(form.NeonField), vue.mergeProps({
|
|
4039
|
+
modelValue: vue.unref(values).estimatedRealizedAssignmentStart,
|
|
4040
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.unref(values).estimatedRealizedAssignmentStart = $event)
|
|
4041
|
+
}, vue.unref(fields).estimatedRealizedAssignmentStart, { "is-disabled": "" }), null, 16, ["modelValue"]),
|
|
4042
|
+
vue.createVNode(vue.unref(form.NeonField), vue.mergeProps({
|
|
4043
|
+
modelValue: vue.unref(values).estimatedRealizedAssignmentEnd,
|
|
4044
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.unref(values).estimatedRealizedAssignmentEnd = $event)
|
|
4045
|
+
}, vue.unref(fields).estimatedRealizedAssignmentEnd, { "is-disabled": "" }), null, 16, ["modelValue"])
|
|
4046
|
+
]),
|
|
4047
|
+
_: 1
|
|
4048
|
+
/* STABLE */
|
|
4049
|
+
}),
|
|
4050
|
+
vue.createVNode(vue.unref(form.NeonFields), { md: "grid gap-4" }, {
|
|
4051
|
+
default: vue.withCtx(() => [
|
|
4052
|
+
vue.createVNode(vue.unref(form.NeonField), vue.mergeProps({
|
|
4053
|
+
modelValue: vue.unref(values).resultAssignment,
|
|
4054
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => vue.unref(values).resultAssignment = $event)
|
|
4055
|
+
}, vue.unref(fields).resultAssignment), null, 16, ["modelValue"])
|
|
4056
|
+
]),
|
|
4057
|
+
_: 1
|
|
4058
|
+
/* STABLE */
|
|
4059
|
+
}),
|
|
4060
|
+
vue.createVNode(vue.unref(form.NeonFields), {
|
|
4061
|
+
md: "grid-cols-4",
|
|
4062
|
+
title: "Perencanaan"
|
|
4063
|
+
}, {
|
|
4064
|
+
default: vue.withCtx(() => [
|
|
4065
|
+
vue.createVNode(vue.unref(form.NeonField), vue.mergeProps({
|
|
4066
|
+
modelValue: vue.unref(values).taskName,
|
|
4067
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.unref(values).taskName = $event)
|
|
4068
|
+
}, vue.unref(fields).taskName, { "is-disabled": "" }), null, 16, ["modelValue"])
|
|
4069
|
+
]),
|
|
4070
|
+
_: 1
|
|
4071
|
+
/* STABLE */
|
|
4072
|
+
}),
|
|
4073
|
+
vue.createVNode(vue.unref(form.NeonFields), { md: "grid gap-4" }, {
|
|
4074
|
+
default: vue.withCtx(() => [
|
|
4075
|
+
vue.createVNode(vue.unref(form.NeonField), vue.mergeProps({
|
|
4076
|
+
modelValue: vue.unref(values).internalServiceDescription,
|
|
4077
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => vue.unref(values).internalServiceDescription = $event)
|
|
4078
|
+
}, vue.unref(fields).internalServiceDescription, { "is-disabled": "" }), null, 16, ["modelValue"])
|
|
4079
|
+
]),
|
|
4080
|
+
_: 1
|
|
4081
|
+
/* STABLE */
|
|
4082
|
+
}),
|
|
4083
|
+
vue.createVNode(vue.unref(form.NeonFields), { md: "grid gap-4" }, {
|
|
4084
|
+
default: vue.withCtx(() => [
|
|
4085
|
+
vue.createVNode(vue.unref(form.NeonField), vue.mergeProps({
|
|
4086
|
+
modelValue: vue.unref(values).externalServiceDescription,
|
|
4087
|
+
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => vue.unref(values).externalServiceDescription = $event)
|
|
4088
|
+
}, vue.unref(fields).externalServiceDescription, { "is-disabled": "" }), null, 16, ["modelValue"])
|
|
4089
|
+
]),
|
|
4090
|
+
_: 1
|
|
4091
|
+
/* STABLE */
|
|
4092
|
+
}),
|
|
4093
|
+
vue.createVNode(vue.unref(office.OfficeRelation), {
|
|
4094
|
+
modelValue: vue.unref(values),
|
|
4095
|
+
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => vue.isRef(values) ? values.value = $event : null),
|
|
4096
|
+
field: vue.unref(fields).branches,
|
|
4097
|
+
"is-disabled": ""
|
|
4098
|
+
}, null, 8, ["modelValue", "field"]),
|
|
4099
|
+
vue.createVNode(vue.unref(form.NeonFields), { md: "grid gap-4 sm:grid-cols-2" }, {
|
|
4100
|
+
default: vue.withCtx(() => [
|
|
4101
|
+
vue.createVNode(vue.unref(office.OfficeRelation), {
|
|
4102
|
+
modelValue: vue.unref(values),
|
|
4103
|
+
"onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => vue.isRef(values) ? values.value = $event : null),
|
|
4104
|
+
field: vue.unref(fields).giveAssignments,
|
|
4105
|
+
"is-disabled": ""
|
|
4106
|
+
}, null, 8, ["modelValue", "field"]),
|
|
4107
|
+
vue.createVNode(vue.unref(office.OfficeRelation), {
|
|
4108
|
+
modelValue: vue.unref(values),
|
|
4109
|
+
"onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => vue.isRef(values) ? values.value = $event : null),
|
|
4110
|
+
field: vue.unref(fields).supervisingAssignments,
|
|
4111
|
+
"is-disabled": ""
|
|
4112
|
+
}, null, 8, ["modelValue", "field"])
|
|
4113
|
+
]),
|
|
4114
|
+
_: 1
|
|
4115
|
+
/* STABLE */
|
|
4116
|
+
}),
|
|
4117
|
+
vue.createVNode(vue.unref(form.NeonFields), { md: "grid gap-3 sm:grid-cols-2" }, {
|
|
4118
|
+
default: vue.withCtx(() => [
|
|
4119
|
+
vue.createVNode(vue.unref(office.OfficeRelation), {
|
|
4120
|
+
modelValue: vue.unref(values),
|
|
4121
|
+
"onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => vue.isRef(values) ? values.value = $event : null),
|
|
4122
|
+
field: vue.unref(fields).doingAssignments,
|
|
4123
|
+
"is-disabled": ""
|
|
4124
|
+
}, null, 8, ["modelValue", "field"]),
|
|
4125
|
+
vue.createVNode(vue.unref(office.OfficeRelation), {
|
|
4126
|
+
modelValue: vue.unref(values),
|
|
4127
|
+
"onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => vue.isRef(values) ? values.value = $event : null),
|
|
4128
|
+
field: vue.unref(fields).helpAssignments
|
|
4129
|
+
}, null, 8, ["modelValue", "field"])
|
|
4130
|
+
]),
|
|
4131
|
+
_: 1
|
|
4132
|
+
/* STABLE */
|
|
4133
|
+
}),
|
|
4134
|
+
vue.createVNode(vue.unref(form.NeonFields), { md: "grid gap-4 sm:grid-cols-2" }, {
|
|
4135
|
+
default: vue.withCtx(() => [
|
|
4136
|
+
vue.createVNode(vue.unref(form.NeonField), vue.mergeProps({
|
|
4137
|
+
modelValue: vue.unref(values).estimatedHourDoingAssignment,
|
|
4138
|
+
"onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => vue.unref(values).estimatedHourDoingAssignment = $event)
|
|
4139
|
+
}, vue.unref(fields).estimatedHourDoingAssignment, { "is-disabled": "" }), null, 16, ["modelValue"]),
|
|
4140
|
+
vue.createVNode(vue.unref(form.NeonField), vue.mergeProps({
|
|
4141
|
+
modelValue: vue.unref(values).estimatedHourCommunicationAssignment,
|
|
4142
|
+
"onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => vue.unref(values).estimatedHourCommunicationAssignment = $event)
|
|
4143
|
+
}, vue.unref(fields).estimatedHourCommunicationAssignment, { "is-disabled": "" }), null, 16, ["modelValue"])
|
|
4144
|
+
]),
|
|
4145
|
+
_: 1
|
|
4146
|
+
/* STABLE */
|
|
4147
|
+
}),
|
|
4148
|
+
vue.createVNode(vue.unref(form.NeonFields), { md: "grid gap-4 sm:grid-cols-2" }, {
|
|
4149
|
+
default: vue.withCtx(() => [
|
|
4150
|
+
vue.createVNode(vue.unref(form.NeonField), vue.mergeProps({
|
|
4151
|
+
modelValue: vue.unref(values).estimatedHourCognitiveAssignment,
|
|
4152
|
+
"onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => vue.unref(values).estimatedHourCognitiveAssignment = $event)
|
|
4153
|
+
}, vue.unref(fields).estimatedHourCognitiveAssignment, { "is-disabled": "" }), null, 16, ["modelValue"]),
|
|
4154
|
+
vue.createVNode(vue.unref(form.NeonField), vue.mergeProps({
|
|
4155
|
+
modelValue: vue.unref(values).estimatedHourCreativeAssignment,
|
|
4156
|
+
"onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => vue.unref(values).estimatedHourCreativeAssignment = $event)
|
|
4157
|
+
}, vue.unref(fields).estimatedHourCreativeAssignment, { "is-disabled": "" }), null, 16, ["modelValue"])
|
|
4158
|
+
]),
|
|
4159
|
+
_: 1
|
|
4160
|
+
/* STABLE */
|
|
4161
|
+
}),
|
|
4162
|
+
vue.createVNode(vue.unref(form.NeonFields), { md: "grid gap-4" }, {
|
|
4163
|
+
default: vue.withCtx(() => [
|
|
4164
|
+
vue.createCommentVNode(' <NeonInputDateRange\n :model-value="{\n start: new Date(values.estimatedStartDate || Date.now()),\n end: new Date(values.estimatedEndDate || Date.now()),\n }"\n min-date="values.estimatedStartDate"\n max-date="values.estimatedEndDate"\n locale="id"\n title="Estimasi"\n @update:model-value="onChangeDateUpdate"\n /> '),
|
|
4165
|
+
vue.createVNode(vue.unref(form.NeonField), {
|
|
4166
|
+
"model-value": {
|
|
4167
|
+
start: new Date(vue.unref(values).estimatedStartDate || ""),
|
|
4168
|
+
end: new Date(vue.unref(values).estimatedEndDate || "")
|
|
4169
|
+
},
|
|
4170
|
+
name: "Est. Mulai - Selesai",
|
|
4171
|
+
note: "Tanggal tugas dimulai dan selesai",
|
|
4172
|
+
input: "date-range",
|
|
4173
|
+
type: "date-range",
|
|
4174
|
+
"is-alone": "",
|
|
4175
|
+
"is-disabled": "",
|
|
4176
|
+
"onUpdate:modelValue": onChangeDateUpdate
|
|
4177
|
+
}, null, 8, ["model-value"])
|
|
4178
|
+
]),
|
|
4179
|
+
_: 1
|
|
4180
|
+
/* STABLE */
|
|
4181
|
+
}),
|
|
4182
|
+
vue.createVNode(vue.unref(form.NeonFields), { md: "grid gap-4" }, {
|
|
4183
|
+
default: vue.withCtx(() => [
|
|
4184
|
+
vue.createVNode(vue.unref(form.NeonField), vue.mergeProps({
|
|
4185
|
+
modelValue: vue.unref(values).estimatedHourByDay,
|
|
4186
|
+
"onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => vue.unref(values).estimatedHourByDay = $event)
|
|
4187
|
+
}, vue.unref(fields).estimatedHourByDay, { "is-disabled": "" }), null, 16, ["modelValue"])
|
|
4188
|
+
]),
|
|
4189
|
+
_: 1
|
|
4190
|
+
/* STABLE */
|
|
4191
|
+
})
|
|
4192
|
+
]),
|
|
4193
|
+
_: 1
|
|
4194
|
+
/* STABLE */
|
|
4195
|
+
}, 8, ["initial-values", "is-loading", "is-changed", "onCancel", "onSubmit"])
|
|
4196
|
+
]),
|
|
4197
|
+
_: 1
|
|
4198
|
+
/* STABLE */
|
|
4199
|
+
})
|
|
4200
|
+
]),
|
|
4201
|
+
_: 1
|
|
4202
|
+
/* STABLE */
|
|
4203
|
+
}, 8, ["use-url"])
|
|
4204
|
+
]),
|
|
4205
|
+
_: 1
|
|
4206
|
+
/* STABLE */
|
|
4207
|
+
});
|
|
4208
|
+
};
|
|
4209
|
+
}
|
|
4210
|
+
});
|
|
448
4211
|
const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
449
4212
|
__proto__: null,
|
|
450
|
-
StaffCollection: _sfc_main$
|
|
4213
|
+
StaffCollection: _sfc_main$5,
|
|
451
4214
|
StaffModel,
|
|
452
4215
|
StaffSingle,
|
|
453
|
-
TaskCollection: _sfc_main$
|
|
4216
|
+
TaskCollection: _sfc_main$2,
|
|
454
4217
|
TaskModel,
|
|
455
|
-
TaskSingle: _sfc_main,
|
|
456
|
-
|
|
4218
|
+
TaskSingle: _sfc_main$1,
|
|
4219
|
+
TaskWork: _sfc_main,
|
|
4220
|
+
TaskWorkButton: _sfc_main$3,
|
|
4221
|
+
XxxButton: _sfc_main$6
|
|
457
4222
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
458
4223
|
function registerComponents(app) {
|
|
459
4224
|
Object.entries(components).forEach(([name, component]) => {
|
|
@@ -470,10 +4235,12 @@ const OperasionalInterfacesPlugin = {
|
|
|
470
4235
|
};
|
|
471
4236
|
exports.OperasionalInterfacesPlugin = OperasionalInterfacesPlugin;
|
|
472
4237
|
exports.Schema = graphql;
|
|
473
|
-
exports.StaffCollection = _sfc_main$
|
|
4238
|
+
exports.StaffCollection = _sfc_main$5;
|
|
474
4239
|
exports.StaffModel = StaffModel;
|
|
475
4240
|
exports.StaffSingle = StaffSingle;
|
|
476
|
-
exports.TaskCollection = _sfc_main$
|
|
4241
|
+
exports.TaskCollection = _sfc_main$2;
|
|
477
4242
|
exports.TaskModel = TaskModel;
|
|
478
|
-
exports.TaskSingle = _sfc_main;
|
|
479
|
-
exports.
|
|
4243
|
+
exports.TaskSingle = _sfc_main$1;
|
|
4244
|
+
exports.TaskWork = _sfc_main;
|
|
4245
|
+
exports.TaskWorkButton = _sfc_main$3;
|
|
4246
|
+
exports.XxxButton = _sfc_main$6;
|