@luvio/graphql-parser 0.75.1 → 0.77.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.
@@ -3843,6 +3843,115 @@ function isTypeExtensionNode(node) {
3843
3843
  return node.kind === Kind.SCALAR_TYPE_EXTENSION || node.kind === Kind.OBJECT_TYPE_EXTENSION || node.kind === Kind.INTERFACE_TYPE_EXTENSION || node.kind === Kind.UNION_TYPE_EXTENSION || node.kind === Kind.ENUM_TYPE_EXTENSION || node.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION;
3844
3844
  }
3845
3845
 
3846
+ /* eslint-disable no-redeclare */
3847
+ // $FlowFixMe[name-already-bound]
3848
+ var find = Array.prototype.find ? function (list, predicate) {
3849
+ return Array.prototype.find.call(list, predicate);
3850
+ } : function (list, predicate) {
3851
+ for (var _i2 = 0; _i2 < list.length; _i2++) {
3852
+ var value = list[_i2];
3853
+
3854
+ if (predicate(value)) {
3855
+ return value;
3856
+ }
3857
+ }
3858
+ };
3859
+ var find$1 = find;
3860
+
3861
+ /* eslint-disable no-redeclare */
3862
+ // $FlowFixMe[name-already-bound]
3863
+ var arrayFrom = Array.from || function (obj, mapFn, thisArg) {
3864
+ if (obj == null) {
3865
+ throw new TypeError('Array.from requires an array-like object - not null or undefined');
3866
+ } // Is Iterable?
3867
+
3868
+
3869
+ var iteratorMethod = obj[SYMBOL_ITERATOR];
3870
+
3871
+ if (typeof iteratorMethod === 'function') {
3872
+ var iterator = iteratorMethod.call(obj);
3873
+ var result = [];
3874
+ var step;
3875
+
3876
+ for (var i = 0; !(step = iterator.next()).done; ++i) {
3877
+ result.push(mapFn.call(thisArg, step.value, i)); // Infinite Iterators could cause forEach to run forever.
3878
+ // After a very large number of iterations, produce an error.
3879
+ // istanbul ignore if (Too big to actually test)
3880
+
3881
+ if (i > 9999999) {
3882
+ throw new TypeError('Near-infinite iteration.');
3883
+ }
3884
+ }
3885
+
3886
+ return result;
3887
+ } // Is Array like?
3888
+
3889
+
3890
+ var length = obj.length;
3891
+
3892
+ if (typeof length === 'number' && length >= 0 && length % 1 === 0) {
3893
+ var _result = [];
3894
+
3895
+ for (var _i = 0; _i < length; ++_i) {
3896
+ if (Object.prototype.hasOwnProperty.call(obj, _i)) {
3897
+ _result.push(mapFn.call(thisArg, obj[_i], _i));
3898
+ }
3899
+ }
3900
+
3901
+ return _result;
3902
+ }
3903
+
3904
+ return [];
3905
+ };
3906
+
3907
+ var arrayFrom$1 = arrayFrom;
3908
+
3909
+ /* eslint-disable no-redeclare */
3910
+ // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
3911
+ var objectValues = Object.values || function (obj) {
3912
+ return Object.keys(obj).map(function (key) {
3913
+ return obj[key];
3914
+ });
3915
+ };
3916
+
3917
+ var objectValues$1 = objectValues;
3918
+
3919
+ /* eslint-disable no-redeclare */
3920
+ // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
3921
+ var objectEntries = Object.entries || function (obj) {
3922
+ return Object.keys(obj).map(function (key) {
3923
+ return [key, obj[key]];
3924
+ });
3925
+ };
3926
+
3927
+ var objectEntries$1 = objectEntries;
3928
+
3929
+ function toObjMap(obj) {
3930
+ /* eslint-enable no-redeclare */
3931
+ if (Object.getPrototypeOf(obj) === null) {
3932
+ return obj;
3933
+ }
3934
+
3935
+ var map = Object.create(null);
3936
+
3937
+ for (var _i2 = 0, _objectEntries2 = objectEntries$1(obj); _i2 < _objectEntries2.length; _i2++) {
3938
+ var _ref2 = _objectEntries2[_i2];
3939
+ var key = _ref2[0];
3940
+ var value = _ref2[1];
3941
+ map[key] = value;
3942
+ }
3943
+
3944
+ return map;
3945
+ }
3946
+
3947
+ /* eslint-disable no-redeclare */
3948
+ // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
3949
+ var isFinitePolyfill = Number.isFinite || function (value) {
3950
+ return typeof value === 'number' && isFinite(value);
3951
+ };
3952
+
3953
+ var isFinite$1 = isFinitePolyfill;
3954
+
3846
3955
  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); }
3847
3956
  /**
3848
3957
  * Safer version of `Array.from` that return `null` if value isn't convertible to array.
@@ -3908,40 +4017,13 @@ function safeArrayFrom(collection) {
3908
4017
  return null;
3909
4018
  }
3910
4019
 
3911
- /* eslint-disable no-redeclare */
3912
- // $FlowFixMe[name-already-bound]
3913
- var find = Array.prototype.find ? function (list, predicate) {
3914
- return Array.prototype.find.call(list, predicate);
3915
- } : function (list, predicate) {
3916
- for (var _i2 = 0; _i2 < list.length; _i2++) {
3917
- var value = list[_i2];
3918
-
3919
- if (predicate(value)) {
3920
- return value;
3921
- }
3922
- }
3923
- };
3924
- var find$1 = find;
3925
-
3926
- /* eslint-disable no-redeclare */
3927
- // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
3928
- var objectValues = Object.values || function (obj) {
3929
- return Object.keys(obj).map(function (key) {
3930
- return obj[key];
3931
- });
3932
- };
3933
-
3934
- var objectValues$1 = objectValues;
3935
-
3936
4020
  /* eslint-disable no-redeclare */
3937
4021
  // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
3938
- var objectEntries = Object.entries || function (obj) {
3939
- return Object.keys(obj).map(function (key) {
3940
- return [key, obj[key]];
3941
- });
4022
+ var isInteger = Number.isInteger || function (value) {
4023
+ return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;
3942
4024
  };
3943
4025
 
3944
- var objectEntries$1 = objectEntries;
4026
+ var isInteger$1 = isInteger;
3945
4027
 
3946
4028
  /**
3947
4029
  * Creates a keyed JS object from an array, given a function to produce the keys
@@ -3990,24 +4072,6 @@ function mapValue(map, fn) {
3990
4072
  return result;
3991
4073
  }
3992
4074
 
3993
- function toObjMap(obj) {
3994
- /* eslint-enable no-redeclare */
3995
- if (Object.getPrototypeOf(obj) === null) {
3996
- return obj;
3997
- }
3998
-
3999
- var map = Object.create(null);
4000
-
4001
- for (var _i2 = 0, _objectEntries2 = objectEntries$1(obj); _i2 < _objectEntries2.length; _i2++) {
4002
- var _ref2 = _objectEntries2[_i2];
4003
- var key = _ref2[0];
4004
- var value = _ref2[1];
4005
- map[key] = value;
4006
- }
4007
-
4008
- return map;
4009
- }
4010
-
4011
4075
  /**
4012
4076
  * Creates a keyed JS object from an array, given a function to produce the keys
4013
4077
  * and a function to produce the values from each item in the array.
@@ -5291,151 +5355,6 @@ function isRequiredInputField(field) {
5291
5355
  return isNonNullType(field.type) && field.defaultValue === undefined;
5292
5356
  }
5293
5357
 
5294
- /**
5295
- * Provided a type and a super type, return true if the first type is either
5296
- * equal or a subset of the second super type (covariant).
5297
- */
5298
-
5299
- function isTypeSubTypeOf(schema, maybeSubType, superType) {
5300
- // Equivalent type is a valid subtype
5301
- if (maybeSubType === superType) {
5302
- return true;
5303
- } // If superType is non-null, maybeSubType must also be non-null.
5304
-
5305
-
5306
- if (isNonNullType(superType)) {
5307
- if (isNonNullType(maybeSubType)) {
5308
- return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType);
5309
- }
5310
-
5311
- return false;
5312
- }
5313
-
5314
- if (isNonNullType(maybeSubType)) {
5315
- // If superType is nullable, maybeSubType may be non-null or nullable.
5316
- return isTypeSubTypeOf(schema, maybeSubType.ofType, superType);
5317
- } // If superType type is a list, maybeSubType type must also be a list.
5318
-
5319
-
5320
- if (isListType(superType)) {
5321
- if (isListType(maybeSubType)) {
5322
- return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType);
5323
- }
5324
-
5325
- return false;
5326
- }
5327
-
5328
- if (isListType(maybeSubType)) {
5329
- // If superType is not a list, maybeSubType must also be not a list.
5330
- return false;
5331
- } // If superType type is an abstract type, check if it is super type of maybeSubType.
5332
- // Otherwise, the child type is not a valid subtype of the parent type.
5333
-
5334
-
5335
- return isAbstractType(superType) && (isInterfaceType(maybeSubType) || isObjectType(maybeSubType)) && schema.isSubType(superType, maybeSubType);
5336
- }
5337
- /**
5338
- * Provided two composite types, determine if they "overlap". Two composite
5339
- * types overlap when the Sets of possible concrete types for each intersect.
5340
- *
5341
- * This is often used to determine if a fragment of a given type could possibly
5342
- * be visited in a context of another type.
5343
- *
5344
- * This function is commutative.
5345
- */
5346
-
5347
- function doTypesOverlap(schema, typeA, typeB) {
5348
- // Equivalent types overlap
5349
- if (typeA === typeB) {
5350
- return true;
5351
- }
5352
-
5353
- if (isAbstractType(typeA)) {
5354
- if (isAbstractType(typeB)) {
5355
- // If both types are abstract, then determine if there is any intersection
5356
- // between possible concrete types of each.
5357
- return schema.getPossibleTypes(typeA).some(function (type) {
5358
- return schema.isSubType(typeB, type);
5359
- });
5360
- } // Determine if the latter type is a possible concrete type of the former.
5361
-
5362
-
5363
- return schema.isSubType(typeA, typeB);
5364
- }
5365
-
5366
- if (isAbstractType(typeB)) {
5367
- // Determine if the former type is a possible concrete type of the latter.
5368
- return schema.isSubType(typeB, typeA);
5369
- } // Otherwise the types do not overlap.
5370
-
5371
-
5372
- return false;
5373
- }
5374
-
5375
- /* eslint-disable no-redeclare */
5376
- // $FlowFixMe[name-already-bound]
5377
- var arrayFrom = Array.from || function (obj, mapFn, thisArg) {
5378
- if (obj == null) {
5379
- throw new TypeError('Array.from requires an array-like object - not null or undefined');
5380
- } // Is Iterable?
5381
-
5382
-
5383
- var iteratorMethod = obj[SYMBOL_ITERATOR];
5384
-
5385
- if (typeof iteratorMethod === 'function') {
5386
- var iterator = iteratorMethod.call(obj);
5387
- var result = [];
5388
- var step;
5389
-
5390
- for (var i = 0; !(step = iterator.next()).done; ++i) {
5391
- result.push(mapFn.call(thisArg, step.value, i)); // Infinite Iterators could cause forEach to run forever.
5392
- // After a very large number of iterations, produce an error.
5393
- // istanbul ignore if (Too big to actually test)
5394
-
5395
- if (i > 9999999) {
5396
- throw new TypeError('Near-infinite iteration.');
5397
- }
5398
- }
5399
-
5400
- return result;
5401
- } // Is Array like?
5402
-
5403
-
5404
- var length = obj.length;
5405
-
5406
- if (typeof length === 'number' && length >= 0 && length % 1 === 0) {
5407
- var _result = [];
5408
-
5409
- for (var _i = 0; _i < length; ++_i) {
5410
- if (Object.prototype.hasOwnProperty.call(obj, _i)) {
5411
- _result.push(mapFn.call(thisArg, obj[_i], _i));
5412
- }
5413
- }
5414
-
5415
- return _result;
5416
- }
5417
-
5418
- return [];
5419
- };
5420
-
5421
- var arrayFrom$1 = arrayFrom;
5422
-
5423
- /* eslint-disable no-redeclare */
5424
- // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
5425
- var isFinitePolyfill = Number.isFinite || function (value) {
5426
- return typeof value === 'number' && isFinite(value);
5427
- };
5428
-
5429
- var isFinite$1 = isFinitePolyfill;
5430
-
5431
- /* eslint-disable no-redeclare */
5432
- // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
5433
- var isInteger = Number.isInteger || function (value) {
5434
- return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;
5435
- };
5436
-
5437
- var isInteger$1 = isInteger;
5438
-
5439
5358
  // 32-bit signed integer, providing the broadest support across platforms.
5440
5359
  //
5441
5360
  // n.b. JavaScript's integers are safe between -(2^53 - 1) and 2^53 - 1 because
@@ -6912,6 +6831,87 @@ function collectReferencedTypes(type, typeSet) {
6912
6831
  return typeSet;
6913
6832
  }
6914
6833
 
6834
+ /**
6835
+ * Provided a type and a super type, return true if the first type is either
6836
+ * equal or a subset of the second super type (covariant).
6837
+ */
6838
+
6839
+ function isTypeSubTypeOf(schema, maybeSubType, superType) {
6840
+ // Equivalent type is a valid subtype
6841
+ if (maybeSubType === superType) {
6842
+ return true;
6843
+ } // If superType is non-null, maybeSubType must also be non-null.
6844
+
6845
+
6846
+ if (isNonNullType(superType)) {
6847
+ if (isNonNullType(maybeSubType)) {
6848
+ return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType);
6849
+ }
6850
+
6851
+ return false;
6852
+ }
6853
+
6854
+ if (isNonNullType(maybeSubType)) {
6855
+ // If superType is nullable, maybeSubType may be non-null or nullable.
6856
+ return isTypeSubTypeOf(schema, maybeSubType.ofType, superType);
6857
+ } // If superType type is a list, maybeSubType type must also be a list.
6858
+
6859
+
6860
+ if (isListType(superType)) {
6861
+ if (isListType(maybeSubType)) {
6862
+ return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType);
6863
+ }
6864
+
6865
+ return false;
6866
+ }
6867
+
6868
+ if (isListType(maybeSubType)) {
6869
+ // If superType is not a list, maybeSubType must also be not a list.
6870
+ return false;
6871
+ } // If superType type is an abstract type, check if it is super type of maybeSubType.
6872
+ // Otherwise, the child type is not a valid subtype of the parent type.
6873
+
6874
+
6875
+ return isAbstractType(superType) && (isInterfaceType(maybeSubType) || isObjectType(maybeSubType)) && schema.isSubType(superType, maybeSubType);
6876
+ }
6877
+ /**
6878
+ * Provided two composite types, determine if they "overlap". Two composite
6879
+ * types overlap when the Sets of possible concrete types for each intersect.
6880
+ *
6881
+ * This is often used to determine if a fragment of a given type could possibly
6882
+ * be visited in a context of another type.
6883
+ *
6884
+ * This function is commutative.
6885
+ */
6886
+
6887
+ function doTypesOverlap(schema, typeA, typeB) {
6888
+ // Equivalent types overlap
6889
+ if (typeA === typeB) {
6890
+ return true;
6891
+ }
6892
+
6893
+ if (isAbstractType(typeA)) {
6894
+ if (isAbstractType(typeB)) {
6895
+ // If both types are abstract, then determine if there is any intersection
6896
+ // between possible concrete types of each.
6897
+ return schema.getPossibleTypes(typeA).some(function (type) {
6898
+ return schema.isSubType(typeB, type);
6899
+ });
6900
+ } // Determine if the latter type is a possible concrete type of the former.
6901
+
6902
+
6903
+ return schema.isSubType(typeA, typeB);
6904
+ }
6905
+
6906
+ if (isAbstractType(typeB)) {
6907
+ // Determine if the former type is a possible concrete type of the latter.
6908
+ return schema.isSubType(typeB, typeA);
6909
+ } // Otherwise the types do not overlap.
6910
+
6911
+
6912
+ return false;
6913
+ }
6914
+
6915
6915
  /**
6916
6916
  * Given a Schema and an AST node describing a type, return a GraphQLType
6917
6917
  * definition which applies to that type. For example, if provided the parsed
@@ -10712,6 +10712,8 @@ function parseLuvioSchema(source, schemaName) {
10712
10712
  });
10713
10713
  }
10714
10714
 
10715
+ exports.Kind = Kind;
10715
10716
  exports.LuvioGraphQLSchema = LuvioGraphQLSchema;
10717
+ exports.isScalarType = isScalarType;
10716
10718
  exports.parseAndVisit = parseAndVisit;
10717
10719
  exports.parseLuvioSchema = parseLuvioSchema;
@@ -3839,6 +3839,115 @@ function isTypeExtensionNode(node) {
3839
3839
  return node.kind === Kind.SCALAR_TYPE_EXTENSION || node.kind === Kind.OBJECT_TYPE_EXTENSION || node.kind === Kind.INTERFACE_TYPE_EXTENSION || node.kind === Kind.UNION_TYPE_EXTENSION || node.kind === Kind.ENUM_TYPE_EXTENSION || node.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION;
3840
3840
  }
3841
3841
 
3842
+ /* eslint-disable no-redeclare */
3843
+ // $FlowFixMe[name-already-bound]
3844
+ var find = Array.prototype.find ? function (list, predicate) {
3845
+ return Array.prototype.find.call(list, predicate);
3846
+ } : function (list, predicate) {
3847
+ for (var _i2 = 0; _i2 < list.length; _i2++) {
3848
+ var value = list[_i2];
3849
+
3850
+ if (predicate(value)) {
3851
+ return value;
3852
+ }
3853
+ }
3854
+ };
3855
+ var find$1 = find;
3856
+
3857
+ /* eslint-disable no-redeclare */
3858
+ // $FlowFixMe[name-already-bound]
3859
+ var arrayFrom = Array.from || function (obj, mapFn, thisArg) {
3860
+ if (obj == null) {
3861
+ throw new TypeError('Array.from requires an array-like object - not null or undefined');
3862
+ } // Is Iterable?
3863
+
3864
+
3865
+ var iteratorMethod = obj[SYMBOL_ITERATOR];
3866
+
3867
+ if (typeof iteratorMethod === 'function') {
3868
+ var iterator = iteratorMethod.call(obj);
3869
+ var result = [];
3870
+ var step;
3871
+
3872
+ for (var i = 0; !(step = iterator.next()).done; ++i) {
3873
+ result.push(mapFn.call(thisArg, step.value, i)); // Infinite Iterators could cause forEach to run forever.
3874
+ // After a very large number of iterations, produce an error.
3875
+ // istanbul ignore if (Too big to actually test)
3876
+
3877
+ if (i > 9999999) {
3878
+ throw new TypeError('Near-infinite iteration.');
3879
+ }
3880
+ }
3881
+
3882
+ return result;
3883
+ } // Is Array like?
3884
+
3885
+
3886
+ var length = obj.length;
3887
+
3888
+ if (typeof length === 'number' && length >= 0 && length % 1 === 0) {
3889
+ var _result = [];
3890
+
3891
+ for (var _i = 0; _i < length; ++_i) {
3892
+ if (Object.prototype.hasOwnProperty.call(obj, _i)) {
3893
+ _result.push(mapFn.call(thisArg, obj[_i], _i));
3894
+ }
3895
+ }
3896
+
3897
+ return _result;
3898
+ }
3899
+
3900
+ return [];
3901
+ };
3902
+
3903
+ var arrayFrom$1 = arrayFrom;
3904
+
3905
+ /* eslint-disable no-redeclare */
3906
+ // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
3907
+ var objectValues = Object.values || function (obj) {
3908
+ return Object.keys(obj).map(function (key) {
3909
+ return obj[key];
3910
+ });
3911
+ };
3912
+
3913
+ var objectValues$1 = objectValues;
3914
+
3915
+ /* eslint-disable no-redeclare */
3916
+ // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
3917
+ var objectEntries = Object.entries || function (obj) {
3918
+ return Object.keys(obj).map(function (key) {
3919
+ return [key, obj[key]];
3920
+ });
3921
+ };
3922
+
3923
+ var objectEntries$1 = objectEntries;
3924
+
3925
+ function toObjMap(obj) {
3926
+ /* eslint-enable no-redeclare */
3927
+ if (Object.getPrototypeOf(obj) === null) {
3928
+ return obj;
3929
+ }
3930
+
3931
+ var map = Object.create(null);
3932
+
3933
+ for (var _i2 = 0, _objectEntries2 = objectEntries$1(obj); _i2 < _objectEntries2.length; _i2++) {
3934
+ var _ref2 = _objectEntries2[_i2];
3935
+ var key = _ref2[0];
3936
+ var value = _ref2[1];
3937
+ map[key] = value;
3938
+ }
3939
+
3940
+ return map;
3941
+ }
3942
+
3943
+ /* eslint-disable no-redeclare */
3944
+ // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
3945
+ var isFinitePolyfill = Number.isFinite || function (value) {
3946
+ return typeof value === 'number' && isFinite(value);
3947
+ };
3948
+
3949
+ var isFinite$1 = isFinitePolyfill;
3950
+
3842
3951
  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); }
3843
3952
  /**
3844
3953
  * Safer version of `Array.from` that return `null` if value isn't convertible to array.
@@ -3904,40 +4013,13 @@ function safeArrayFrom(collection) {
3904
4013
  return null;
3905
4014
  }
3906
4015
 
3907
- /* eslint-disable no-redeclare */
3908
- // $FlowFixMe[name-already-bound]
3909
- var find = Array.prototype.find ? function (list, predicate) {
3910
- return Array.prototype.find.call(list, predicate);
3911
- } : function (list, predicate) {
3912
- for (var _i2 = 0; _i2 < list.length; _i2++) {
3913
- var value = list[_i2];
3914
-
3915
- if (predicate(value)) {
3916
- return value;
3917
- }
3918
- }
3919
- };
3920
- var find$1 = find;
3921
-
3922
- /* eslint-disable no-redeclare */
3923
- // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
3924
- var objectValues = Object.values || function (obj) {
3925
- return Object.keys(obj).map(function (key) {
3926
- return obj[key];
3927
- });
3928
- };
3929
-
3930
- var objectValues$1 = objectValues;
3931
-
3932
4016
  /* eslint-disable no-redeclare */
3933
4017
  // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
3934
- var objectEntries = Object.entries || function (obj) {
3935
- return Object.keys(obj).map(function (key) {
3936
- return [key, obj[key]];
3937
- });
4018
+ var isInteger = Number.isInteger || function (value) {
4019
+ return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;
3938
4020
  };
3939
4021
 
3940
- var objectEntries$1 = objectEntries;
4022
+ var isInteger$1 = isInteger;
3941
4023
 
3942
4024
  /**
3943
4025
  * Creates a keyed JS object from an array, given a function to produce the keys
@@ -3986,24 +4068,6 @@ function mapValue(map, fn) {
3986
4068
  return result;
3987
4069
  }
3988
4070
 
3989
- function toObjMap(obj) {
3990
- /* eslint-enable no-redeclare */
3991
- if (Object.getPrototypeOf(obj) === null) {
3992
- return obj;
3993
- }
3994
-
3995
- var map = Object.create(null);
3996
-
3997
- for (var _i2 = 0, _objectEntries2 = objectEntries$1(obj); _i2 < _objectEntries2.length; _i2++) {
3998
- var _ref2 = _objectEntries2[_i2];
3999
- var key = _ref2[0];
4000
- var value = _ref2[1];
4001
- map[key] = value;
4002
- }
4003
-
4004
- return map;
4005
- }
4006
-
4007
4071
  /**
4008
4072
  * Creates a keyed JS object from an array, given a function to produce the keys
4009
4073
  * and a function to produce the values from each item in the array.
@@ -5287,151 +5351,6 @@ function isRequiredInputField(field) {
5287
5351
  return isNonNullType(field.type) && field.defaultValue === undefined;
5288
5352
  }
5289
5353
 
5290
- /**
5291
- * Provided a type and a super type, return true if the first type is either
5292
- * equal or a subset of the second super type (covariant).
5293
- */
5294
-
5295
- function isTypeSubTypeOf(schema, maybeSubType, superType) {
5296
- // Equivalent type is a valid subtype
5297
- if (maybeSubType === superType) {
5298
- return true;
5299
- } // If superType is non-null, maybeSubType must also be non-null.
5300
-
5301
-
5302
- if (isNonNullType(superType)) {
5303
- if (isNonNullType(maybeSubType)) {
5304
- return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType);
5305
- }
5306
-
5307
- return false;
5308
- }
5309
-
5310
- if (isNonNullType(maybeSubType)) {
5311
- // If superType is nullable, maybeSubType may be non-null or nullable.
5312
- return isTypeSubTypeOf(schema, maybeSubType.ofType, superType);
5313
- } // If superType type is a list, maybeSubType type must also be a list.
5314
-
5315
-
5316
- if (isListType(superType)) {
5317
- if (isListType(maybeSubType)) {
5318
- return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType);
5319
- }
5320
-
5321
- return false;
5322
- }
5323
-
5324
- if (isListType(maybeSubType)) {
5325
- // If superType is not a list, maybeSubType must also be not a list.
5326
- return false;
5327
- } // If superType type is an abstract type, check if it is super type of maybeSubType.
5328
- // Otherwise, the child type is not a valid subtype of the parent type.
5329
-
5330
-
5331
- return isAbstractType(superType) && (isInterfaceType(maybeSubType) || isObjectType(maybeSubType)) && schema.isSubType(superType, maybeSubType);
5332
- }
5333
- /**
5334
- * Provided two composite types, determine if they "overlap". Two composite
5335
- * types overlap when the Sets of possible concrete types for each intersect.
5336
- *
5337
- * This is often used to determine if a fragment of a given type could possibly
5338
- * be visited in a context of another type.
5339
- *
5340
- * This function is commutative.
5341
- */
5342
-
5343
- function doTypesOverlap(schema, typeA, typeB) {
5344
- // Equivalent types overlap
5345
- if (typeA === typeB) {
5346
- return true;
5347
- }
5348
-
5349
- if (isAbstractType(typeA)) {
5350
- if (isAbstractType(typeB)) {
5351
- // If both types are abstract, then determine if there is any intersection
5352
- // between possible concrete types of each.
5353
- return schema.getPossibleTypes(typeA).some(function (type) {
5354
- return schema.isSubType(typeB, type);
5355
- });
5356
- } // Determine if the latter type is a possible concrete type of the former.
5357
-
5358
-
5359
- return schema.isSubType(typeA, typeB);
5360
- }
5361
-
5362
- if (isAbstractType(typeB)) {
5363
- // Determine if the former type is a possible concrete type of the latter.
5364
- return schema.isSubType(typeB, typeA);
5365
- } // Otherwise the types do not overlap.
5366
-
5367
-
5368
- return false;
5369
- }
5370
-
5371
- /* eslint-disable no-redeclare */
5372
- // $FlowFixMe[name-already-bound]
5373
- var arrayFrom = Array.from || function (obj, mapFn, thisArg) {
5374
- if (obj == null) {
5375
- throw new TypeError('Array.from requires an array-like object - not null or undefined');
5376
- } // Is Iterable?
5377
-
5378
-
5379
- var iteratorMethod = obj[SYMBOL_ITERATOR];
5380
-
5381
- if (typeof iteratorMethod === 'function') {
5382
- var iterator = iteratorMethod.call(obj);
5383
- var result = [];
5384
- var step;
5385
-
5386
- for (var i = 0; !(step = iterator.next()).done; ++i) {
5387
- result.push(mapFn.call(thisArg, step.value, i)); // Infinite Iterators could cause forEach to run forever.
5388
- // After a very large number of iterations, produce an error.
5389
- // istanbul ignore if (Too big to actually test)
5390
-
5391
- if (i > 9999999) {
5392
- throw new TypeError('Near-infinite iteration.');
5393
- }
5394
- }
5395
-
5396
- return result;
5397
- } // Is Array like?
5398
-
5399
-
5400
- var length = obj.length;
5401
-
5402
- if (typeof length === 'number' && length >= 0 && length % 1 === 0) {
5403
- var _result = [];
5404
-
5405
- for (var _i = 0; _i < length; ++_i) {
5406
- if (Object.prototype.hasOwnProperty.call(obj, _i)) {
5407
- _result.push(mapFn.call(thisArg, obj[_i], _i));
5408
- }
5409
- }
5410
-
5411
- return _result;
5412
- }
5413
-
5414
- return [];
5415
- };
5416
-
5417
- var arrayFrom$1 = arrayFrom;
5418
-
5419
- /* eslint-disable no-redeclare */
5420
- // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
5421
- var isFinitePolyfill = Number.isFinite || function (value) {
5422
- return typeof value === 'number' && isFinite(value);
5423
- };
5424
-
5425
- var isFinite$1 = isFinitePolyfill;
5426
-
5427
- /* eslint-disable no-redeclare */
5428
- // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
5429
- var isInteger = Number.isInteger || function (value) {
5430
- return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;
5431
- };
5432
-
5433
- var isInteger$1 = isInteger;
5434
-
5435
5354
  // 32-bit signed integer, providing the broadest support across platforms.
5436
5355
  //
5437
5356
  // n.b. JavaScript's integers are safe between -(2^53 - 1) and 2^53 - 1 because
@@ -6908,6 +6827,87 @@ function collectReferencedTypes(type, typeSet) {
6908
6827
  return typeSet;
6909
6828
  }
6910
6829
 
6830
+ /**
6831
+ * Provided a type and a super type, return true if the first type is either
6832
+ * equal or a subset of the second super type (covariant).
6833
+ */
6834
+
6835
+ function isTypeSubTypeOf(schema, maybeSubType, superType) {
6836
+ // Equivalent type is a valid subtype
6837
+ if (maybeSubType === superType) {
6838
+ return true;
6839
+ } // If superType is non-null, maybeSubType must also be non-null.
6840
+
6841
+
6842
+ if (isNonNullType(superType)) {
6843
+ if (isNonNullType(maybeSubType)) {
6844
+ return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType);
6845
+ }
6846
+
6847
+ return false;
6848
+ }
6849
+
6850
+ if (isNonNullType(maybeSubType)) {
6851
+ // If superType is nullable, maybeSubType may be non-null or nullable.
6852
+ return isTypeSubTypeOf(schema, maybeSubType.ofType, superType);
6853
+ } // If superType type is a list, maybeSubType type must also be a list.
6854
+
6855
+
6856
+ if (isListType(superType)) {
6857
+ if (isListType(maybeSubType)) {
6858
+ return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType);
6859
+ }
6860
+
6861
+ return false;
6862
+ }
6863
+
6864
+ if (isListType(maybeSubType)) {
6865
+ // If superType is not a list, maybeSubType must also be not a list.
6866
+ return false;
6867
+ } // If superType type is an abstract type, check if it is super type of maybeSubType.
6868
+ // Otherwise, the child type is not a valid subtype of the parent type.
6869
+
6870
+
6871
+ return isAbstractType(superType) && (isInterfaceType(maybeSubType) || isObjectType(maybeSubType)) && schema.isSubType(superType, maybeSubType);
6872
+ }
6873
+ /**
6874
+ * Provided two composite types, determine if they "overlap". Two composite
6875
+ * types overlap when the Sets of possible concrete types for each intersect.
6876
+ *
6877
+ * This is often used to determine if a fragment of a given type could possibly
6878
+ * be visited in a context of another type.
6879
+ *
6880
+ * This function is commutative.
6881
+ */
6882
+
6883
+ function doTypesOverlap(schema, typeA, typeB) {
6884
+ // Equivalent types overlap
6885
+ if (typeA === typeB) {
6886
+ return true;
6887
+ }
6888
+
6889
+ if (isAbstractType(typeA)) {
6890
+ if (isAbstractType(typeB)) {
6891
+ // If both types are abstract, then determine if there is any intersection
6892
+ // between possible concrete types of each.
6893
+ return schema.getPossibleTypes(typeA).some(function (type) {
6894
+ return schema.isSubType(typeB, type);
6895
+ });
6896
+ } // Determine if the latter type is a possible concrete type of the former.
6897
+
6898
+
6899
+ return schema.isSubType(typeA, typeB);
6900
+ }
6901
+
6902
+ if (isAbstractType(typeB)) {
6903
+ // Determine if the former type is a possible concrete type of the latter.
6904
+ return schema.isSubType(typeB, typeA);
6905
+ } // Otherwise the types do not overlap.
6906
+
6907
+
6908
+ return false;
6909
+ }
6910
+
6911
6911
  /**
6912
6912
  * Given a Schema and an AST node describing a type, return a GraphQLType
6913
6913
  * definition which applies to that type. For example, if provided the parsed
@@ -10708,4 +10708,4 @@ function parseLuvioSchema(source, schemaName) {
10708
10708
  });
10709
10709
  }
10710
10710
 
10711
- export { LuvioGraphQLSchema, parseAndVisit, parseLuvioSchema };
10711
+ export { Kind, LuvioGraphQLSchema, isScalarType, parseAndVisit, parseLuvioSchema };
package/dist/main.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { BooleanValueNode, FloatValueNode, IntValueNode, StringValueNode } from 'graphql/language';
1
+ import { BooleanValueNode, EnumTypeDefinitionNode, FieldDefinitionNode, FloatValueNode, InterfaceTypeDefinitionNode, IntValueNode, Kind, NamedTypeNode, ObjectTypeDefinitionNode, StringValueNode, TypeNode, UnionTypeDefinitionNode } from 'graphql/language';
2
+ import { isScalarType } from 'graphql/type';
2
3
  import { LuvioDocumentNode, LuvioArgumentNode, LuvioDefinitionNode, LuvioObjectValueNode, LuvioOperationDefinitionNode, LuvioSelectionCustomFieldNode, LuvioSelectionNode, LuvioSelectionObjectFieldNode, LuvioSelectionScalarFieldNode, LuvioValueNode, LuvioFieldNode, LuvioVariableDefinitionNode, LuvioVariableNode, LuvioNamedTypeNode, LuvioListTypeNode, LuvioListValueNode, LuvioTypeNode } from './ast';
3
4
  import { LuvioGraphQLSchema } from './luvio-schema';
4
5
  export declare function parseAndVisit(source: string): LuvioDocumentNode;
@@ -7,4 +8,4 @@ export { LuvioGraphQLSchema };
7
8
  /**
8
9
  * @deprecated - Schema-backed adapters will use standard graphql types re-exported from @luvio/graphql
9
10
  */
10
- export { BooleanValueNode, FloatValueNode, IntValueNode, StringValueNode, LuvioDocumentNode, LuvioArgumentNode, LuvioDefinitionNode, LuvioObjectValueNode, LuvioOperationDefinitionNode, LuvioSelectionCustomFieldNode, LuvioSelectionNode, LuvioSelectionObjectFieldNode, LuvioSelectionScalarFieldNode, LuvioValueNode, LuvioFieldNode, LuvioVariableDefinitionNode, LuvioVariableNode, LuvioNamedTypeNode, LuvioListTypeNode, LuvioListValueNode, LuvioTypeNode, };
11
+ export { isScalarType, BooleanValueNode, EnumTypeDefinitionNode, FieldDefinitionNode, FloatValueNode, InterfaceTypeDefinitionNode, IntValueNode, Kind, NamedTypeNode, ObjectTypeDefinitionNode, StringValueNode, TypeNode, UnionTypeDefinitionNode, LuvioDocumentNode, LuvioArgumentNode, LuvioDefinitionNode, LuvioObjectValueNode, LuvioOperationDefinitionNode, LuvioSelectionCustomFieldNode, LuvioSelectionNode, LuvioSelectionObjectFieldNode, LuvioSelectionScalarFieldNode, LuvioValueNode, LuvioFieldNode, LuvioVariableDefinitionNode, LuvioVariableNode, LuvioNamedTypeNode, LuvioListTypeNode, LuvioListValueNode, LuvioTypeNode, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luvio/graphql-parser",
3
- "version": "0.75.1",
3
+ "version": "0.77.1",
4
4
  "description": "GraphQL parser for Luvio GraphQL adapter support",
5
5
  "main": "./dist/luvioGraphqlParser.js",
6
6
  "module": "./dist/luvioGraphqlParser.mjs",
package/src/main.ts CHANGED
@@ -1,11 +1,19 @@
1
1
  import {
2
2
  parse,
3
3
  BooleanValueNode,
4
+ EnumTypeDefinitionNode,
5
+ FieldDefinitionNode,
4
6
  FloatValueNode,
7
+ InterfaceTypeDefinitionNode,
5
8
  IntValueNode,
9
+ Kind,
10
+ NamedTypeNode,
11
+ ObjectTypeDefinitionNode,
6
12
  StringValueNode,
13
+ TypeNode,
14
+ UnionTypeDefinitionNode,
7
15
  } from 'graphql/language';
8
-
16
+ import { isScalarType } from 'graphql/type';
9
17
  import { buildASTSchema } from 'graphql/utilities';
10
18
  import {
11
19
  LuvioDocumentNode,
@@ -51,10 +59,19 @@ export { LuvioGraphQLSchema };
51
59
  * @deprecated - Schema-backed adapters will use standard graphql types re-exported from @luvio/graphql
52
60
  */
53
61
  export {
62
+ isScalarType,
54
63
  BooleanValueNode,
64
+ EnumTypeDefinitionNode,
65
+ FieldDefinitionNode,
55
66
  FloatValueNode,
67
+ InterfaceTypeDefinitionNode,
56
68
  IntValueNode,
69
+ Kind,
70
+ NamedTypeNode,
71
+ ObjectTypeDefinitionNode,
57
72
  StringValueNode,
73
+ TypeNode,
74
+ UnionTypeDefinitionNode,
58
75
  LuvioDocumentNode,
59
76
  LuvioArgumentNode,
60
77
  LuvioDefinitionNode,