@salesforce/lds-graphql-parser 1.247.0 → 1.248.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.
@@ -8457,6 +8457,22 @@ function assertValidSDL(documentAST) {
8457
8457
  }).join('\n\n'));
8458
8458
  }
8459
8459
  }
8460
+ /**
8461
+ * Utility function which asserts a SDL document is valid by throwing an error
8462
+ * if it is invalid.
8463
+ *
8464
+ * @internal
8465
+ */
8466
+
8467
+ function assertValidSDLExtension(documentAST, schema) {
8468
+ var errors = validateSDL(documentAST, schema);
8469
+
8470
+ if (errors.length !== 0) {
8471
+ throw new Error(errors.map(function (error) {
8472
+ return error.message;
8473
+ }).join('\n\n'));
8474
+ }
8475
+ }
8460
8476
 
8461
8477
  /**
8462
8478
  * Memoizes the provided three-argument function.
@@ -9902,6 +9918,37 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
9902
9918
  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; }
9903
9919
 
9904
9920
  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; }
9921
+
9922
+ /**
9923
+ * Produces a new schema given an existing schema and a document which may
9924
+ * contain GraphQL type extensions and definitions. The original schema will
9925
+ * remain unaltered.
9926
+ *
9927
+ * Because a schema represents a graph of references, a schema cannot be
9928
+ * extended without effectively making an entire copy. We do not know until it's
9929
+ * too late if subgraphs remain unchanged.
9930
+ *
9931
+ * This algorithm copies the provided schema, applying extensions while
9932
+ * producing the copy. The original schema remains unaltered.
9933
+ *
9934
+ * Accepts options as a third argument:
9935
+ *
9936
+ * - commentDescriptions:
9937
+ * Provide true to use preceding comments as the description.
9938
+ *
9939
+ */
9940
+ function extendSchema(schema, documentAST, options) {
9941
+ assertSchema(schema);
9942
+ documentAST != null && documentAST.kind === Kind.DOCUMENT || devAssert(0, 'Must provide valid Document AST.');
9943
+
9944
+ if ((options === null || options === void 0 ? void 0 : options.assumeValid) !== true && (options === null || options === void 0 ? void 0 : options.assumeValidSDL) !== true) {
9945
+ assertValidSDLExtension(documentAST, schema);
9946
+ }
9947
+
9948
+ var schemaConfig = schema.toConfig();
9949
+ var extendedConfig = extendSchemaImpl(schemaConfig, documentAST, options);
9950
+ return schemaConfig === extendedConfig ? schema : new GraphQLSchema(extendedConfig);
9951
+ }
9905
9952
  /**
9906
9953
  * @internal
9907
9954
  */
@@ -11508,5 +11555,5 @@ function gql(literals, ...subs) {
11508
11555
  return superResult;
11509
11556
  }
11510
11557
 
11511
- export { Kind, astResolver, buildSchema, defaultFieldResolver, execute, gql, isObjectType, parse, parseAndVisit, print, visit };
11512
- // version: 1.247.0-4fe38c091
11558
+ export { Kind, astResolver, buildSchema, defaultFieldResolver, execute, extendSchema, gql, isObjectType, isScalarType, parse, parseAndVisit, print, visit };
11559
+ // version: 1.248.0-1f7f01112
@@ -1,2 +1,2 @@
1
1
  export { gql } from './gql';
2
- export { astResolver, Kind, parse, parseAndVisit, print, visit, isObjectType, defaultFieldResolver, buildSchema, execute, } from '@luvio/graphql-parser';
2
+ export { astResolver, Kind, parse, parseAndVisit, print, visit, isObjectType, defaultFieldResolver, buildSchema, extendSchema, execute, isScalarType, } from '@luvio/graphql-parser';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-graphql-parser",
3
- "version": "1.247.0",
3
+ "version": "1.248.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS graphql parser for SFDC",
6
6
  "main": "dist/ldsGraphqlParser.js",
@@ -33,14 +33,14 @@
33
33
  "release:core": "yarn build && ../core-build/scripts/core.js --name=lds-graphql-parser"
34
34
  },
35
35
  "dependencies": {
36
- "@luvio/graphql-parser": "0.151.0"
36
+ "@luvio/graphql-parser": "0.151.1"
37
37
  },
38
38
  "luvioBundlesize": [
39
39
  {
40
40
  "path": "./dist/ldsGraphqlParser.js",
41
41
  "maxSize": {
42
42
  "none": "370 kB",
43
- "min": "158 kB",
43
+ "min": "160 kB",
44
44
  "compressed": "61 kB"
45
45
  }
46
46
  }