@luvio/graphql-parser 0.133.0 → 0.134.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.
- package/dist/luvioGraphqlParser.js +24 -23
- package/dist/luvioGraphqlParser.mjs +24 -23
- package/package.json +1 -1
|
@@ -12496,6 +12496,27 @@ function transform$4(variableDefinitions, transformState) {
|
|
|
12496
12496
|
return ret;
|
|
12497
12497
|
}
|
|
12498
12498
|
|
|
12499
|
+
function validateVariables(variableDefinitions, transformState) {
|
|
12500
|
+
if (process.env.NODE_ENV === 'production') {
|
|
12501
|
+
throw new ReferenceError("Do not call this function in production becuase we don't want to break existing uses. Other environments are okay because we want to catch errors early.");
|
|
12502
|
+
}
|
|
12503
|
+
const variablesDefined = {};
|
|
12504
|
+
if (variableDefinitions !== undefined) {
|
|
12505
|
+
for (let i = 0, len = variableDefinitions.length; i < len; i++) {
|
|
12506
|
+
const definedVariableName = variableDefinitions[i].variable.name.value;
|
|
12507
|
+
variablesDefined[definedVariableName] = true;
|
|
12508
|
+
if (transformState.variablesUsed[definedVariableName] === undefined) {
|
|
12509
|
+
throw new Error(`Variable $${definedVariableName} was defined but never used.`);
|
|
12510
|
+
}
|
|
12511
|
+
}
|
|
12512
|
+
}
|
|
12513
|
+
const usedVariableKeys = Object.keys(transformState.variablesUsed);
|
|
12514
|
+
for (let i = 0, len = usedVariableKeys.length; i < len; i++) {
|
|
12515
|
+
if (variablesDefined[usedVariableKeys[i]] !== true) {
|
|
12516
|
+
throw new Error(`Variable $${usedVariableKeys[i]} was used but never defined.`);
|
|
12517
|
+
}
|
|
12518
|
+
}
|
|
12519
|
+
}
|
|
12499
12520
|
function transform$3(node) {
|
|
12500
12521
|
const queryRoot = {
|
|
12501
12522
|
kind: 'ObjectFieldSelection',
|
|
@@ -12522,30 +12543,10 @@ function transform$3(node) {
|
|
|
12522
12543
|
if (directives !== undefined && directives.length > 0) {
|
|
12523
12544
|
operationDefinition.directives = directives.map((node) => transform$9(node, transformState));
|
|
12524
12545
|
}
|
|
12525
|
-
|
|
12526
|
-
|
|
12527
|
-
}
|
|
12528
|
-
function validateVariables(variableDefinitions, transformState) {
|
|
12529
|
-
const variablesDefined = {};
|
|
12530
|
-
if (variableDefinitions !== undefined) {
|
|
12531
|
-
for (let i = 0, len = variableDefinitions.length; i < len; i++) {
|
|
12532
|
-
const definedVariableName = variableDefinitions[i].variable.name.value;
|
|
12533
|
-
variablesDefined[definedVariableName] = true;
|
|
12534
|
-
if (transformState.variablesUsed[definedVariableName] === undefined) {
|
|
12535
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
12536
|
-
throw new Error(`Variable $${definedVariableName} was defined but never used.`);
|
|
12537
|
-
}
|
|
12538
|
-
}
|
|
12539
|
-
}
|
|
12540
|
-
}
|
|
12541
|
-
const usedVariableKeys = Object.keys(transformState.variablesUsed);
|
|
12542
|
-
for (let i = 0, len = usedVariableKeys.length; i < len; i++) {
|
|
12543
|
-
if (variablesDefined[usedVariableKeys[i]] !== true) {
|
|
12544
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
12545
|
-
throw new Error(`Variable $${usedVariableKeys[i]} was used but never defined.`);
|
|
12546
|
-
}
|
|
12547
|
-
}
|
|
12546
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
12547
|
+
validateVariables(variableDefinitions, transformState);
|
|
12548
12548
|
}
|
|
12549
|
+
return operationDefinition;
|
|
12549
12550
|
}
|
|
12550
12551
|
|
|
12551
12552
|
function transform$2(node) {
|
|
@@ -12492,6 +12492,27 @@ function transform$4(variableDefinitions, transformState) {
|
|
|
12492
12492
|
return ret;
|
|
12493
12493
|
}
|
|
12494
12494
|
|
|
12495
|
+
function validateVariables(variableDefinitions, transformState) {
|
|
12496
|
+
if (process.env.NODE_ENV === 'production') {
|
|
12497
|
+
throw new ReferenceError("Do not call this function in production becuase we don't want to break existing uses. Other environments are okay because we want to catch errors early.");
|
|
12498
|
+
}
|
|
12499
|
+
const variablesDefined = {};
|
|
12500
|
+
if (variableDefinitions !== undefined) {
|
|
12501
|
+
for (let i = 0, len = variableDefinitions.length; i < len; i++) {
|
|
12502
|
+
const definedVariableName = variableDefinitions[i].variable.name.value;
|
|
12503
|
+
variablesDefined[definedVariableName] = true;
|
|
12504
|
+
if (transformState.variablesUsed[definedVariableName] === undefined) {
|
|
12505
|
+
throw new Error(`Variable $${definedVariableName} was defined but never used.`);
|
|
12506
|
+
}
|
|
12507
|
+
}
|
|
12508
|
+
}
|
|
12509
|
+
const usedVariableKeys = Object.keys(transformState.variablesUsed);
|
|
12510
|
+
for (let i = 0, len = usedVariableKeys.length; i < len; i++) {
|
|
12511
|
+
if (variablesDefined[usedVariableKeys[i]] !== true) {
|
|
12512
|
+
throw new Error(`Variable $${usedVariableKeys[i]} was used but never defined.`);
|
|
12513
|
+
}
|
|
12514
|
+
}
|
|
12515
|
+
}
|
|
12495
12516
|
function transform$3(node) {
|
|
12496
12517
|
const queryRoot = {
|
|
12497
12518
|
kind: 'ObjectFieldSelection',
|
|
@@ -12518,30 +12539,10 @@ function transform$3(node) {
|
|
|
12518
12539
|
if (directives !== undefined && directives.length > 0) {
|
|
12519
12540
|
operationDefinition.directives = directives.map((node) => transform$9(node, transformState));
|
|
12520
12541
|
}
|
|
12521
|
-
|
|
12522
|
-
|
|
12523
|
-
}
|
|
12524
|
-
function validateVariables(variableDefinitions, transformState) {
|
|
12525
|
-
const variablesDefined = {};
|
|
12526
|
-
if (variableDefinitions !== undefined) {
|
|
12527
|
-
for (let i = 0, len = variableDefinitions.length; i < len; i++) {
|
|
12528
|
-
const definedVariableName = variableDefinitions[i].variable.name.value;
|
|
12529
|
-
variablesDefined[definedVariableName] = true;
|
|
12530
|
-
if (transformState.variablesUsed[definedVariableName] === undefined) {
|
|
12531
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
12532
|
-
throw new Error(`Variable $${definedVariableName} was defined but never used.`);
|
|
12533
|
-
}
|
|
12534
|
-
}
|
|
12535
|
-
}
|
|
12536
|
-
}
|
|
12537
|
-
const usedVariableKeys = Object.keys(transformState.variablesUsed);
|
|
12538
|
-
for (let i = 0, len = usedVariableKeys.length; i < len; i++) {
|
|
12539
|
-
if (variablesDefined[usedVariableKeys[i]] !== true) {
|
|
12540
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
12541
|
-
throw new Error(`Variable $${usedVariableKeys[i]} was used but never defined.`);
|
|
12542
|
-
}
|
|
12543
|
-
}
|
|
12542
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
12543
|
+
validateVariables(variableDefinitions, transformState);
|
|
12544
12544
|
}
|
|
12545
|
+
return operationDefinition;
|
|
12545
12546
|
}
|
|
12546
12547
|
|
|
12547
12548
|
function transform$2(node) {
|