@luvio/graphql-parser 0.63.1 → 0.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/luvioGraphqlParser.js +72 -101
- package/package.json +1 -1
- package/rollup.config.js +1 -1
|
@@ -6,7 +6,7 @@ var SYMBOL_TO_STRING_TAG = typeof Symbol === 'function' && Symbol.toStringTag !=
|
|
|
6
6
|
var nodejsCustomInspectSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for('nodejs.util.inspect.custom') : undefined;
|
|
7
7
|
var nodejsCustomInspectSymbol$1 = nodejsCustomInspectSymbol;
|
|
8
8
|
|
|
9
|
-
function _typeof$
|
|
9
|
+
function _typeof$3(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$3 = function _typeof(obj) { return typeof obj; }; } else { _typeof$3 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$3(obj); }
|
|
10
10
|
var MAX_ARRAY_LENGTH = 10;
|
|
11
11
|
var MAX_RECURSIVE_DEPTH = 2;
|
|
12
12
|
/**
|
|
@@ -18,7 +18,7 @@ function inspect(value) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
function formatValue(value, seenValues) {
|
|
21
|
-
switch (_typeof$
|
|
21
|
+
switch (_typeof$3(value)) {
|
|
22
22
|
case 'string':
|
|
23
23
|
return JSON.stringify(value);
|
|
24
24
|
|
|
@@ -136,10 +136,12 @@ function devAssert(condition, message) {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
function _typeof$2(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$2 = function _typeof(obj) { return typeof obj; }; } else { _typeof$2 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$2(obj); }
|
|
139
140
|
/**
|
|
140
141
|
* A replacement for instanceof which includes an error warning when multi-realm
|
|
141
142
|
* constructors are detected.
|
|
142
143
|
*/
|
|
144
|
+
|
|
143
145
|
// See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production
|
|
144
146
|
// See: https://webpack.js.org/guides/production/
|
|
145
147
|
var instanceOf = process.env.NODE_ENV === 'production' ? // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
|
|
@@ -152,12 +154,16 @@ function instanceOf(value, constructor) {
|
|
|
152
154
|
return true;
|
|
153
155
|
}
|
|
154
156
|
|
|
155
|
-
if (value) {
|
|
156
|
-
var
|
|
157
|
-
var className = constructor.name;
|
|
157
|
+
if (_typeof$2(value) === 'object' && value !== null) {
|
|
158
|
+
var _value$constructor;
|
|
158
159
|
|
|
159
|
-
|
|
160
|
-
|
|
160
|
+
var className = constructor.prototype[Symbol.toStringTag];
|
|
161
|
+
var valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library.
|
|
162
|
+
Symbol.toStringTag in value ? value[Symbol.toStringTag] : (_value$constructor = value.constructor) === null || _value$constructor === void 0 ? void 0 : _value$constructor.name;
|
|
163
|
+
|
|
164
|
+
if (className === valueClassName) {
|
|
165
|
+
var stringifiedValue = inspect(value);
|
|
166
|
+
throw new Error("Cannot use ".concat(className, " \"").concat(stringifiedValue, "\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results."));
|
|
161
167
|
}
|
|
162
168
|
}
|
|
163
169
|
|
|
@@ -409,6 +415,12 @@ function isObjectLike(value) {
|
|
|
409
415
|
|
|
410
416
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
411
417
|
|
|
418
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
419
|
+
|
|
420
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
421
|
+
|
|
422
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
423
|
+
|
|
412
424
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
413
425
|
|
|
414
426
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -446,14 +458,6 @@ var GraphQLError = /*#__PURE__*/function (_Error) {
|
|
|
446
458
|
|
|
447
459
|
var _super = _createSuper(GraphQLError);
|
|
448
460
|
|
|
449
|
-
/**
|
|
450
|
-
* A message describing the Error for debugging purposes.
|
|
451
|
-
*
|
|
452
|
-
* Enumerable, and appears in the result of JSON.stringify().
|
|
453
|
-
*
|
|
454
|
-
* Note: should be treated as readonly, despite invariant usage.
|
|
455
|
-
*/
|
|
456
|
-
|
|
457
461
|
/**
|
|
458
462
|
* An array of { line, column } locations within the source GraphQL document
|
|
459
463
|
* which correspond to this error.
|
|
@@ -496,117 +500,79 @@ var GraphQLError = /*#__PURE__*/function (_Error) {
|
|
|
496
500
|
* Extension fields to add to the formatted error.
|
|
497
501
|
*/
|
|
498
502
|
function GraphQLError(message, nodes, source, positions, path, originalError, extensions) {
|
|
499
|
-
var
|
|
503
|
+
var _nodeLocations, _nodeLocations2, _nodeLocations3;
|
|
500
504
|
|
|
501
505
|
var _this;
|
|
502
506
|
|
|
503
507
|
_classCallCheck(this, GraphQLError);
|
|
504
508
|
|
|
505
|
-
_this = _super.call(this, message);
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
var _source = source;
|
|
509
|
+
_this = _super.call(this, message);
|
|
510
|
+
_this.name = 'GraphQLError';
|
|
511
|
+
_this.originalError = originalError !== null && originalError !== void 0 ? originalError : undefined; // Compute list of blame nodes.
|
|
511
512
|
|
|
512
|
-
|
|
513
|
-
|
|
513
|
+
_this.nodes = undefinedIfEmpty(Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined);
|
|
514
|
+
var nodeLocations = [];
|
|
514
515
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
var _positions = positions;
|
|
516
|
+
for (var _i2 = 0, _ref3 = (_this$nodes = _this.nodes) !== null && _this$nodes !== void 0 ? _this$nodes : []; _i2 < _ref3.length; _i2++) {
|
|
517
|
+
var _this$nodes;
|
|
519
518
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
if (node.loc) {
|
|
523
|
-
list.push(node.loc.start);
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
return list;
|
|
527
|
-
}, []);
|
|
528
|
-
}
|
|
519
|
+
var _ref4 = _ref3[_i2];
|
|
520
|
+
var loc = _ref4.loc;
|
|
529
521
|
|
|
530
|
-
|
|
531
|
-
|
|
522
|
+
if (loc != null) {
|
|
523
|
+
nodeLocations.push(loc);
|
|
524
|
+
}
|
|
532
525
|
}
|
|
533
526
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
if (positions && source) {
|
|
537
|
-
_locations = positions.map(function (pos) {
|
|
538
|
-
return getLocation(source, pos);
|
|
539
|
-
});
|
|
540
|
-
} else if (_nodes) {
|
|
541
|
-
_locations = _nodes.reduce(function (list, node) {
|
|
542
|
-
if (node.loc) {
|
|
543
|
-
list.push(getLocation(node.loc.source, node.loc.start));
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
return list;
|
|
547
|
-
}, []);
|
|
548
|
-
}
|
|
527
|
+
nodeLocations = undefinedIfEmpty(nodeLocations); // Compute locations in the source for the given nodes/positions.
|
|
549
528
|
|
|
550
|
-
|
|
529
|
+
_this.source = source !== null && source !== void 0 ? source : (_nodeLocations = nodeLocations) === null || _nodeLocations === void 0 ? void 0 : _nodeLocations[0].source;
|
|
530
|
+
_this.positions = positions !== null && positions !== void 0 ? positions : (_nodeLocations2 = nodeLocations) === null || _nodeLocations2 === void 0 ? void 0 : _nodeLocations2.map(function (loc) {
|
|
531
|
+
return loc.start;
|
|
532
|
+
});
|
|
533
|
+
_this.locations = positions && source ? positions.map(function (pos) {
|
|
534
|
+
return getLocation(source, pos);
|
|
535
|
+
}) : (_nodeLocations3 = nodeLocations) === null || _nodeLocations3 === void 0 ? void 0 : _nodeLocations3.map(function (loc) {
|
|
536
|
+
return getLocation(loc.source, loc.start);
|
|
537
|
+
});
|
|
538
|
+
_this.path = path !== null && path !== void 0 ? path : undefined;
|
|
539
|
+
var originalExtensions = originalError === null || originalError === void 0 ? void 0 : originalError.extensions;
|
|
551
540
|
|
|
552
|
-
if (
|
|
553
|
-
|
|
541
|
+
if (extensions == null && isObjectLike(originalExtensions)) {
|
|
542
|
+
_this.extensions = _objectSpread({}, originalExtensions);
|
|
543
|
+
} else {
|
|
544
|
+
_this.extensions = extensions !== null && extensions !== void 0 ? extensions : {};
|
|
545
|
+
} // By being enumerable, JSON.stringify will include bellow properties in the resulting output.
|
|
546
|
+
// This ensures that the simplest possible GraphQL service adheres to the spec.
|
|
554
547
|
|
|
555
|
-
if (isObjectLike(originalExtensions)) {
|
|
556
|
-
_extensions = originalExtensions;
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
548
|
|
|
560
549
|
Object.defineProperties(_assertThisInitialized(_this), {
|
|
561
|
-
name: {
|
|
562
|
-
value: 'GraphQLError'
|
|
563
|
-
},
|
|
564
550
|
message: {
|
|
565
|
-
|
|
566
|
-
// By being enumerable, JSON.stringify will include `message` in the
|
|
567
|
-
// resulting output. This ensures that the simplest possible GraphQL
|
|
568
|
-
// service adheres to the spec.
|
|
569
|
-
enumerable: true,
|
|
570
|
-
writable: true
|
|
551
|
+
enumerable: true
|
|
571
552
|
},
|
|
572
553
|
locations: {
|
|
573
|
-
|
|
574
|
-
// in JSON.stringify() when not provided.
|
|
575
|
-
value: (_locations2 = _locations) !== null && _locations2 !== void 0 ? _locations2 : undefined,
|
|
576
|
-
// By being enumerable, JSON.stringify will include `locations` in the
|
|
577
|
-
// resulting output. This ensures that the simplest possible GraphQL
|
|
578
|
-
// service adheres to the spec.
|
|
579
|
-
enumerable: _locations != null
|
|
554
|
+
enumerable: _this.locations != null
|
|
580
555
|
},
|
|
581
556
|
path: {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
enumerable:
|
|
557
|
+
enumerable: _this.path != null
|
|
558
|
+
},
|
|
559
|
+
extensions: {
|
|
560
|
+
enumerable: _this.extensions != null && Object.keys(_this.extensions).length > 0
|
|
561
|
+
},
|
|
562
|
+
name: {
|
|
563
|
+
enumerable: false
|
|
589
564
|
},
|
|
590
565
|
nodes: {
|
|
591
|
-
|
|
566
|
+
enumerable: false
|
|
592
567
|
},
|
|
593
568
|
source: {
|
|
594
|
-
|
|
569
|
+
enumerable: false
|
|
595
570
|
},
|
|
596
571
|
positions: {
|
|
597
|
-
|
|
572
|
+
enumerable: false
|
|
598
573
|
},
|
|
599
574
|
originalError: {
|
|
600
|
-
|
|
601
|
-
},
|
|
602
|
-
extensions: {
|
|
603
|
-
// Coercing falsy values to undefined ensures they will not be included
|
|
604
|
-
// in JSON.stringify() when not provided.
|
|
605
|
-
value: (_extensions2 = _extensions) !== null && _extensions2 !== void 0 ? _extensions2 : undefined,
|
|
606
|
-
// By being enumerable, JSON.stringify will include `path` in the
|
|
607
|
-
// resulting output. This ensures that the simplest possible GraphQL
|
|
608
|
-
// service adheres to the spec.
|
|
609
|
-
enumerable: _extensions != null
|
|
575
|
+
enumerable: false
|
|
610
576
|
}
|
|
611
577
|
}); // Include (non-enumerable) stack trace.
|
|
612
578
|
|
|
@@ -649,25 +615,30 @@ var GraphQLError = /*#__PURE__*/function (_Error) {
|
|
|
649
615
|
|
|
650
616
|
return GraphQLError;
|
|
651
617
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
618
|
+
|
|
619
|
+
function undefinedIfEmpty(array) {
|
|
620
|
+
return array === undefined || array.length === 0 ? undefined : array;
|
|
621
|
+
}
|
|
652
622
|
/**
|
|
653
623
|
* Prints a GraphQLError to a string, representing useful location information
|
|
654
624
|
* about the error's position in the source.
|
|
655
625
|
*/
|
|
656
626
|
|
|
627
|
+
|
|
657
628
|
function printError(error) {
|
|
658
629
|
var output = error.message;
|
|
659
630
|
|
|
660
631
|
if (error.nodes) {
|
|
661
|
-
for (var
|
|
662
|
-
var node = _error$nodes2[
|
|
632
|
+
for (var _i4 = 0, _error$nodes2 = error.nodes; _i4 < _error$nodes2.length; _i4++) {
|
|
633
|
+
var node = _error$nodes2[_i4];
|
|
663
634
|
|
|
664
635
|
if (node.loc) {
|
|
665
636
|
output += '\n\n' + printLocation(node.loc);
|
|
666
637
|
}
|
|
667
638
|
}
|
|
668
639
|
} else if (error.source && error.locations) {
|
|
669
|
-
for (var
|
|
670
|
-
var location = _error$locations2[
|
|
640
|
+
for (var _i6 = 0, _error$locations2 = error.locations; _i6 < _error$locations2.length; _i6++) {
|
|
641
|
+
var location = _error$locations2[_i6];
|
|
671
642
|
output += '\n\n' + printSourceLocation(error.source, location);
|
|
672
643
|
}
|
|
673
644
|
}
|
package/package.json
CHANGED
package/rollup.config.js
CHANGED