@luvio/graphql-parser 0.63.0 → 0.63.1

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.
@@ -4,8 +4,9 @@ var SYMBOL_TO_STRING_TAG = typeof Symbol === 'function' && Symbol.toStringTag !=
4
4
 
5
5
  // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
6
6
  var nodejsCustomInspectSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for('nodejs.util.inspect.custom') : undefined;
7
+ var nodejsCustomInspectSymbol$1 = nodejsCustomInspectSymbol;
7
8
 
8
- 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); }
9
+ 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); }
9
10
  var MAX_ARRAY_LENGTH = 10;
10
11
  var MAX_RECURSIVE_DEPTH = 2;
11
12
  /**
@@ -17,7 +18,7 @@ function inspect(value) {
17
18
  }
18
19
 
19
20
  function formatValue(value, seenValues) {
20
- switch (_typeof(value)) {
21
+ switch (_typeof$2(value)) {
21
22
  case 'string':
22
23
  return JSON.stringify(value);
23
24
 
@@ -102,7 +103,7 @@ function formatArray(array, seenValues) {
102
103
  }
103
104
 
104
105
  function getCustomFn(object) {
105
- var customInspectFn = object[String(nodejsCustomInspectSymbol)];
106
+ var customInspectFn = object[String(nodejsCustomInspectSymbol$1)];
106
107
 
107
108
  if (typeof customInspectFn === 'function') {
108
109
  return customInspectFn;
@@ -163,9 +164,9 @@ function instanceOf(value, constructor) {
163
164
  return false;
164
165
  };
165
166
 
166
- 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); } }
167
+ function _defineProperties$1(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); } }
167
168
 
168
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
169
+ function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
169
170
 
170
171
  /**
171
172
  * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are
@@ -190,7 +191,7 @@ var Source = /*#__PURE__*/function () {
190
191
  } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
191
192
 
192
193
 
193
- _createClass(Source, [{
194
+ _createClass$1(Source, [{
194
195
  key: SYMBOL_TO_STRING_TAG,
195
196
  get: function get() {
196
197
  return 'Source';
@@ -278,8 +279,8 @@ function printSourceLocation(source, sourceLocation) {
278
279
 
279
280
  function printPrefixedLines(lines) {
280
281
  var existingLines = lines.filter(function (_ref) {
281
- var _ = _ref[0],
282
- line = _ref[1];
282
+ _ref[0];
283
+ var line = _ref[1];
283
284
  return line !== undefined;
284
285
  });
285
286
  var padLen = Math.max.apply(Math, existingLines.map(function (_ref2) {
@@ -406,19 +407,19 @@ function isObjectLike(value) {
406
407
  return _typeof$1(value) == 'object' && value !== null;
407
408
  }
408
409
 
409
- 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); }
410
+ 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); }
410
411
 
411
412
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
412
413
 
413
- function _defineProperties$1(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); } }
414
+ 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); } }
414
415
 
415
- function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
416
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
416
417
 
417
418
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
418
419
 
419
420
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
420
421
 
421
- function _possibleConstructorReturn(self, call) { if (call && (_typeof$2(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
422
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
422
423
 
423
424
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
424
425
 
@@ -632,7 +633,7 @@ var GraphQLError = /*#__PURE__*/function (_Error) {
632
633
  return _this;
633
634
  }
634
635
 
635
- _createClass$1(GraphQLError, [{
636
+ _createClass(GraphQLError, [{
636
637
  key: "toString",
637
638
  value: function toString() {
638
639
  return printError(this);
@@ -700,8 +701,8 @@ function defineInspect(classObject) {
700
701
  typeof fn === 'function' || invariant(0);
701
702
  classObject.prototype.inspect = fn; // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2317')
702
703
 
703
- if (nodejsCustomInspectSymbol) {
704
- classObject.prototype[nodejsCustomInspectSymbol] = fn;
704
+ if (nodejsCustomInspectSymbol$1) {
705
+ classObject.prototype[nodejsCustomInspectSymbol$1] = fn;
705
706
  }
706
707
  }
707
708
 
@@ -3483,7 +3484,7 @@ const NODE_KIND_OBJECT_FIELD_SELECTION = 'ObjectFieldSelection';
3483
3484
  const NODE_KIND_SCALAR_FIELD_SELECTION = 'ScalarFieldSelection';
3484
3485
  const NODE_TYPE_CONNECTION = 'Connection';
3485
3486
 
3486
- function transform(node, transformState) {
3487
+ function transform$b(node, transformState) {
3487
3488
  switch (node.kind) {
3488
3489
  case 'Variable':
3489
3490
  transformState.variablesUsed[node.name.value] = true;
@@ -3523,7 +3524,7 @@ function transform(node, transformState) {
3523
3524
  case 'ListValue': {
3524
3525
  const values = [];
3525
3526
  for (var index = 0; index < node.values.length; index++) {
3526
- const value = transform(node.values[index], transformState);
3527
+ const value = transform$b(node.values[index], transformState);
3527
3528
  values.push(value);
3528
3529
  }
3529
3530
  return {
@@ -3536,7 +3537,7 @@ function transform(node, transformState) {
3536
3537
  const result = {};
3537
3538
  fields.forEach((field) => {
3538
3539
  const name = field.name.value;
3539
- const value = transform(field.value, transformState);
3540
+ const value = transform$b(field.value, transformState);
3540
3541
  result[name] = value;
3541
3542
  });
3542
3543
  return {
@@ -3549,9 +3550,9 @@ function transform(node, transformState) {
3549
3550
  }
3550
3551
  }
3551
3552
 
3552
- function transform$1(node, transformState) {
3553
+ function transform$a(node, transformState) {
3553
3554
  const { kind, name: { value: nodeName }, value: nodeValue, } = node;
3554
- const valueNode = transform(nodeValue, transformState);
3555
+ const valueNode = transform$b(nodeValue, transformState);
3555
3556
  return {
3556
3557
  kind,
3557
3558
  name: nodeName,
@@ -3559,7 +3560,7 @@ function transform$1(node, transformState) {
3559
3560
  };
3560
3561
  }
3561
3562
 
3562
- function transform$2(node, transformState) {
3563
+ function transform$9(node, transformState) {
3563
3564
  const { kind, name: { value: nodeName }, arguments: nodeArguments, } = node;
3564
3565
  const ret = {
3565
3566
  kind,
@@ -3569,7 +3570,7 @@ function transform$2(node, transformState) {
3569
3570
  let returnArguments = [];
3570
3571
  for (var index = 0; index < nodeArguments.length; index++) {
3571
3572
  const argumentNode = nodeArguments[index];
3572
- const value = transform$1(argumentNode, transformState);
3573
+ const value = transform$a(argumentNode, transformState);
3573
3574
  returnArguments.push(value);
3574
3575
  }
3575
3576
  ret.arguments = returnArguments;
@@ -3581,7 +3582,7 @@ function isCustomDirective(node) {
3581
3582
  node.name.value === CUSTOM_DIRECTIVE_RESOURCE);
3582
3583
  }
3583
3584
 
3584
- function transform$3(node, transformState) {
3585
+ function transform$8(node, transformState) {
3585
3586
  const { name, alias, arguments: fieldArgs, selectionSet, directives } = node;
3586
3587
  let luvioNode = {
3587
3588
  kind: NODE_KIND_OBJECT_FIELD_SELECTION,
@@ -3600,7 +3601,7 @@ function transform$3(node, transformState) {
3600
3601
  const customDirectiveNode = directives.find(isCustomDirective);
3601
3602
  if (customDirectiveNode === undefined) {
3602
3603
  // transform non client-side directives
3603
- luvioNode.directives = directives.map((directive) => transform$2(directive, transformState));
3604
+ luvioNode.directives = directives.map((directive) => transform$9(directive, transformState));
3604
3605
  }
3605
3606
  else {
3606
3607
  if (customDirectiveNode.name.value === CUSTOM_DIRECTIVE_CONNECTION) {
@@ -3624,7 +3625,7 @@ function transform$3(node, transformState) {
3624
3625
  if (fieldArgs !== undefined && fieldArgs.length > 0) {
3625
3626
  const returnArguments = [];
3626
3627
  for (var index = 0; index < fieldArgs.length; index++) {
3627
- const value = transform$1(fieldArgs[index], transformState);
3628
+ const value = transform$a(fieldArgs[index], transformState);
3628
3629
  returnArguments.push(value);
3629
3630
  }
3630
3631
  luvioNode.arguments = returnArguments;
@@ -3636,19 +3637,19 @@ function transform$3(node, transformState) {
3636
3637
  return luvioNode;
3637
3638
  }
3638
3639
 
3639
- function transform$4(node, transformState) {
3640
+ function transform$7(node, transformState) {
3640
3641
  const { kind, name: { value }, directives, } = node;
3641
3642
  const luvioNode = {
3642
3643
  kind,
3643
3644
  name: value,
3644
3645
  };
3645
3646
  if (directives !== undefined && directives.length > 0) {
3646
- luvioNode.directives = directives.map((directive) => transform$2(directive, transformState));
3647
+ luvioNode.directives = directives.map((directive) => transform$9(directive, transformState));
3647
3648
  }
3648
3649
  return luvioNode;
3649
3650
  }
3650
3651
 
3651
- function transform$5(node, transformState) {
3652
+ function transform$6(node, transformState) {
3652
3653
  const { kind: nodeKind, typeCondition, directives } = node;
3653
3654
  const luvioNode = {
3654
3655
  kind: nodeKind,
@@ -3661,7 +3662,7 @@ function transform$5(node, transformState) {
3661
3662
  };
3662
3663
  }
3663
3664
  if (directives !== undefined && directives.length > 0) {
3664
- luvioNode.directives = directives.map((directive) => transform$2(directive, transformState));
3665
+ luvioNode.directives = directives.map((directive) => transform$9(directive, transformState));
3665
3666
  }
3666
3667
  return luvioNode;
3667
3668
  }
@@ -3672,15 +3673,15 @@ function selectionSetVisitor(ast, luvioSelectionPath, transformState) {
3672
3673
  let selectionNode;
3673
3674
  switch (node.kind) {
3674
3675
  case NODE_KIND_FIELD: {
3675
- const fieldNode = transform$3(node, transformState);
3676
+ const fieldNode = transform$8(node, transformState);
3676
3677
  selectionNode = fieldNode;
3677
3678
  break;
3678
3679
  }
3679
3680
  case NODE_KIND_FRAGMENT_SPREAD:
3680
- selectionNode = transform$4(node, transformState);
3681
+ selectionNode = transform$7(node, transformState);
3681
3682
  break;
3682
3683
  case NODE_KIND_INLINE_FRAGMENT:
3683
- selectionNode = transform$5(node, transformState);
3684
+ selectionNode = transform$6(node, transformState);
3684
3685
  break;
3685
3686
  }
3686
3687
  if (selectionNode !== undefined) {
@@ -3706,7 +3707,7 @@ function selectionSetVisitor(ast, luvioSelectionPath, transformState) {
3706
3707
  visit(ast, visitor);
3707
3708
  }
3708
3709
 
3709
- function transform$6(node) {
3710
+ function transform$5(node) {
3710
3711
  if (isNamedTypeNode(node)) {
3711
3712
  return {
3712
3713
  kind: NODE_KIND_NAMED_TYPE,
@@ -3716,7 +3717,7 @@ function transform$6(node) {
3716
3717
  else if (isListTypeNode(node)) {
3717
3718
  return {
3718
3719
  kind: NODE_KIND_LIST_TYPE,
3719
- type: transform$6(node.type),
3720
+ type: transform$5(node.type),
3720
3721
  };
3721
3722
  }
3722
3723
  else if (isNonNullTypeNode(node)) {
@@ -3734,7 +3735,7 @@ function transform$6(node) {
3734
3735
  kind: NODE_KIND_NON_NULL_TYPE,
3735
3736
  type: {
3736
3737
  kind: NODE_KIND_LIST_TYPE,
3737
- type: transform$6(node.type.type),
3738
+ type: transform$5(node.type.type),
3738
3739
  },
3739
3740
  };
3740
3741
  }
@@ -3747,7 +3748,7 @@ function transform$6(node) {
3747
3748
  }
3748
3749
  }
3749
3750
 
3750
- function transform$7(variableDefinitions, transformState) {
3751
+ function transform$4(variableDefinitions, transformState) {
3751
3752
  const { kind, variable: { kind: variableKind, name: { value: variableName }, }, type, defaultValue, } = variableDefinitions;
3752
3753
  const ret = {
3753
3754
  kind,
@@ -3755,17 +3756,17 @@ function transform$7(variableDefinitions, transformState) {
3755
3756
  kind: variableKind,
3756
3757
  name: variableName,
3757
3758
  },
3758
- type: transform$6(type),
3759
+ type: transform$5(type),
3759
3760
  };
3760
3761
  if (defaultValue !== undefined) {
3761
- const value = transform(defaultValue, transformState);
3762
+ const value = transform$b(defaultValue, transformState);
3762
3763
  ret.defaultValue = value;
3763
3764
  }
3764
3765
  // TODO: transform directives
3765
3766
  return ret;
3766
3767
  }
3767
3768
 
3768
- function transform$8(node) {
3769
+ function transform$3(node) {
3769
3770
  const queryRoot = {
3770
3771
  kind: 'ObjectFieldSelection',
3771
3772
  name: 'query',
@@ -3786,10 +3787,10 @@ function transform$8(node) {
3786
3787
  }
3787
3788
  const { variableDefinitions, directives } = node;
3788
3789
  if (variableDefinitions !== undefined && variableDefinitions.length > 0) {
3789
- operationDefinition.variableDefinitions = variableDefinitions.map((variableDefinition) => transform$7(variableDefinition, transformState));
3790
+ operationDefinition.variableDefinitions = variableDefinitions.map((variableDefinition) => transform$4(variableDefinition, transformState));
3790
3791
  }
3791
3792
  if (directives !== undefined && directives.length > 0) {
3792
- operationDefinition.directives = directives.map((node) => transform$2(node, transformState));
3793
+ operationDefinition.directives = directives.map((node) => transform$9(node, transformState));
3793
3794
  }
3794
3795
  validateVariables(variableDefinitions, transformState);
3795
3796
  return operationDefinition;
@@ -3817,15 +3818,15 @@ function validateVariables(variableDefinitions, transformState) {
3817
3818
  }
3818
3819
  }
3819
3820
 
3820
- function transform$9(node) {
3821
+ function transform$2(node) {
3821
3822
  const { operation } = node;
3822
3823
  if (operation === 'query') {
3823
- return transform$8(node);
3824
+ return transform$3(node);
3824
3825
  }
3825
3826
  throw new Error(`Unsupported ${operation} operation. Only query operation is supported`);
3826
3827
  }
3827
3828
 
3828
- function transform$a(node) {
3829
+ function transform$1(node) {
3829
3830
  const { kind: nodeKind, name: { value: nodeName }, typeCondition: { kind: typeKind, name: { value: typeName }, }, directives, } = node;
3830
3831
  // dummy root node
3831
3832
  const fragmentRoot = {
@@ -3846,21 +3847,21 @@ function transform$a(node) {
3846
3847
  luvioSelections: fragmentRoot.luvioSelections,
3847
3848
  };
3848
3849
  if (directives !== undefined && directives.length > 0) {
3849
- luvioNode.directives = directives.map((node) => transform$2(node, transformState));
3850
+ luvioNode.directives = directives.map((node) => transform$9(node, transformState));
3850
3851
  }
3851
3852
  return luvioNode;
3852
3853
  }
3853
3854
 
3854
- function transform$b(root) {
3855
+ function transform(root) {
3855
3856
  const { kind, definitions } = root;
3856
3857
  const luvioDefinitions = [];
3857
3858
  for (let i = 0; i < definitions.length; i++) {
3858
3859
  const definition = definitions[i];
3859
3860
  if (isOperationDefinitionNode(definition)) {
3860
- luvioDefinitions.push(transform$9(definition));
3861
+ luvioDefinitions.push(transform$2(definition));
3861
3862
  }
3862
3863
  else if (isFragmentDefinitionNode(definition)) {
3863
- luvioDefinitions.push(transform$a(definition));
3864
+ luvioDefinitions.push(transform$1(definition));
3864
3865
  }
3865
3866
  else {
3866
3867
  if (process.env.NODE_ENV !== 'production') {
@@ -3877,7 +3878,7 @@ function transform$b(root) {
3877
3878
  function parseAndVisit(source) {
3878
3879
  // TODO: handle generic <Type>
3879
3880
  const ast = parse(source);
3880
- return transform$b(ast);
3881
+ return transform(ast);
3881
3882
  }
3882
3883
 
3883
3884
  export { parseAndVisit };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luvio/graphql-parser",
3
- "version": "0.63.0",
3
+ "version": "0.63.1",
4
4
  "description": "GraphQL parser for Luvio GraphQL adapter support",
5
5
  "main": "dist/luvioGraphqlParser.js",
6
6
  "module": "dist/luvioGraphqlParser.js",