@salesforce/lds-graphql-parser 1.225.0 → 1.227.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/ldsGraphqlParser.js +30 -2
- package/dist/types/gql.d.ts +1 -0
- package/dist/types/index.d.ts +2 -1
- package/package.json +1 -1
package/dist/ldsGraphqlParser.js
CHANGED
@@ -11283,7 +11283,7 @@ const astResolver = function (astReference) {
|
|
11283
11283
|
* @param subs - all other substitutions
|
11284
11284
|
* @returns an opaque reference to the parsed document
|
11285
11285
|
*/
|
11286
|
-
function gql(literals, ...subs) {
|
11286
|
+
function gql$1(literals, ...subs) {
|
11287
11287
|
let inputString;
|
11288
11288
|
let inputSubstitutionFragments;
|
11289
11289
|
if (!literals) {
|
@@ -11480,5 +11480,33 @@ function parseAndVisit(source) {
|
|
11480
11480
|
return luvioDocumentNode;
|
11481
11481
|
}
|
11482
11482
|
|
11483
|
+
function validateDocument(root) {
|
11484
|
+
const validationMessages = [];
|
11485
|
+
const { definitions } = root;
|
11486
|
+
for (let i = 0; i < definitions.length; i++) {
|
11487
|
+
const definition = definitions[i];
|
11488
|
+
if (definition.kind === 'OperationDefinition') {
|
11489
|
+
const { operation, name } = definition;
|
11490
|
+
if (operation !== 'query') {
|
11491
|
+
validationMessages.push(`Unsupported ${operation} ${name ? `(${name.value}) ` : ''}operation.`);
|
11492
|
+
}
|
11493
|
+
}
|
11494
|
+
}
|
11495
|
+
return validationMessages;
|
11496
|
+
}
|
11497
|
+
function gql(literals, ...subs) {
|
11498
|
+
const superResult = gql$1(literals, ...subs);
|
11499
|
+
if (superResult !== null) {
|
11500
|
+
const root = astResolver(superResult);
|
11501
|
+
if (root !== undefined) {
|
11502
|
+
const errors = validateDocument(root);
|
11503
|
+
if (errors.length > 0) {
|
11504
|
+
throw new SyntaxError(`There are unsupported operations in the graphql query:\n${errors.join('\n')}`);
|
11505
|
+
}
|
11506
|
+
}
|
11507
|
+
}
|
11508
|
+
return superResult;
|
11509
|
+
}
|
11510
|
+
|
11483
11511
|
export { Kind, astResolver, buildSchema, defaultFieldResolver, execute, gql, isObjectType, parse, parseAndVisit, print, visit };
|
11484
|
-
// version: 1.
|
11512
|
+
// version: 1.227.0-f636c0f4c
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function gql(literals: ReadonlyArray<string> | string, ...subs: (string | object)[]): object | null;
|
package/dist/types/index.d.ts
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
export {
|
1
|
+
export { gql } from './gql';
|
2
|
+
export { astResolver, Kind, parse, parseAndVisit, print, visit, isObjectType, defaultFieldResolver, buildSchema, execute, } from '@luvio/graphql-parser';
|