Socket
Socket
Sign inDemoInstall

codemirror-graphql

Package Overview
Dependencies
1
Maintainers
11
Versions
243
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.5 to 2.0.6

32

esm/info.js

@@ -18,3 +18,3 @@ import { GraphQLList, GraphQLNonNull, } from 'graphql';

const into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.fieldDef);

@@ -28,3 +28,3 @@ return into;

const into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.directiveDef);

@@ -38,3 +38,3 @@ return into;

const into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.argDef);

@@ -50,3 +50,3 @@ return into;

const into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.enumValue);

@@ -62,3 +62,3 @@ return into;

const into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.type);

@@ -110,3 +110,3 @@ return into;

}
into.appendChild(typeSpan);
into.append(typeSpan);
}

@@ -136,5 +136,5 @@ function renderType(into, typeInfo, options, t) {

else {
descriptionDiv.appendChild(document.createTextNode(description));
descriptionDiv.append(document.createTextNode(description));
}
into.appendChild(descriptionDiv);
into.append(descriptionDiv);
}

@@ -148,7 +148,7 @@ renderDeprecation(into, options, def);

deprecationDiv.className = 'info-deprecation';
into.appendChild(deprecationDiv);
into.append(deprecationDiv);
const label = document.createElement('span');
label.className = 'info-deprecation-label';
label.appendChild(document.createTextNode('Deprecated'));
deprecationDiv.appendChild(label);
label.append(document.createTextNode('Deprecated'));
deprecationDiv.append(label);
const reasonDiv = document.createElement('div');

@@ -160,5 +160,5 @@ reasonDiv.className = 'info-deprecation-reason';

else {
reasonDiv.appendChild(document.createTextNode(reason));
reasonDiv.append(document.createTextNode(reason));
}
deprecationDiv.appendChild(reasonDiv);
deprecationDiv.append(reasonDiv);
}

@@ -181,9 +181,9 @@ }

node.className = className;
node.appendChild(document.createTextNode(content));
into.appendChild(node);
node.append(document.createTextNode(content));
into.append(node);
}
else {
into.appendChild(document.createTextNode(content));
into.append(document.createTextNode(content));
}
}
//# sourceMappingURL=info.js.map
import { typeFromAST, } from 'graphql';
export default function collectVariables(schema, documentAST) {
const variableToType = Object.create(null);
documentAST.definitions.forEach(definition => {
for (const definition of documentAST.definitions) {
if (definition.kind === 'OperationDefinition') {
const { variableDefinitions } = definition;
if (variableDefinitions) {
variableDefinitions.forEach(({ variable, type }) => {
for (const { variable, type } of variableDefinitions) {
const inputType = typeFromAST(schema, type);

@@ -13,8 +13,8 @@ if (inputType) {

}
});
}
}
}
});
}
return variableToType;
}
//# sourceMappingURL=collectVariables.js.map

@@ -80,4 +80,4 @@ import CodeMirror from 'codemirror';

popup.className = 'CodeMirror-info';
popup.appendChild(info);
document.body.appendChild(popup);
popup.append(info);
document.body.append(popup);
const popupBox = popup.getBoundingClientRect();

@@ -124,3 +124,3 @@ const popupStyle = window.getComputedStyle(popup);

if (popup.parentNode) {
popup.parentNode.removeChild(popup);
popup.remove();
}

@@ -130,3 +130,3 @@ }, 600);

else if (popup.parentNode) {
popup.parentNode.removeChild(popup);
popup.remove();
}

@@ -133,0 +133,0 @@ };

@@ -6,3 +6,3 @@ import { CharacterStream, onlineParser, } from 'graphql-language-service';

const lines = sourceText.split('\n');
lines.forEach(line => {
for (const line of lines) {
const stream = new CharacterStream(line);

@@ -13,4 +13,4 @@ while (!stream.eol()) {

}
});
}
}
//# sourceMappingURL=runParser.js.map

@@ -25,5 +25,5 @@ import CodeMirror from 'codemirror';

function validateVariables(editor, variableToType, variablesAST) {
var _a;
const errors = [];
variablesAST.members.forEach(member => {
var _a;
for (const member of variablesAST.members) {
if (member) {

@@ -33,5 +33,5 @@ const variableName = (_a = member.key) === null || _a === void 0 ? void 0 : _a.value;

if (type) {
validateValue(type, member.value).forEach(([node, message]) => {
for (const [node, message] of validateValue(type, member.value)) {
errors.push(lintError(editor, node, message));
});
}
}

@@ -42,3 +42,3 @@ else {

}
});
}
return errors;

@@ -88,3 +88,3 @@ }

});
Object.keys(type.getFields()).forEach(fieldName => {
for (const fieldName of Object.keys(type.getFields())) {
const field = type.getFields()[fieldName];

@@ -99,3 +99,3 @@ if (!providedFields[fieldName] &&

}
});
}
return fieldErrors;

@@ -102,0 +102,0 @@ }

@@ -18,3 +18,3 @@ import { GraphQLList, GraphQLNonNull, } from 'graphql';

const into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.fieldDef);

@@ -28,3 +28,3 @@ return into;

const into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.directiveDef);

@@ -38,3 +38,3 @@ return into;

const into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.argDef);

@@ -50,3 +50,3 @@ return into;

const into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.enumValue);

@@ -62,3 +62,3 @@ return into;

const into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.type);

@@ -110,3 +110,3 @@ return into;

}
into.appendChild(typeSpan);
into.append(typeSpan);
}

@@ -136,5 +136,5 @@ function renderType(into, typeInfo, options, t) {

else {
descriptionDiv.appendChild(document.createTextNode(description));
descriptionDiv.append(document.createTextNode(description));
}
into.appendChild(descriptionDiv);
into.append(descriptionDiv);
}

@@ -148,7 +148,7 @@ renderDeprecation(into, options, def);

deprecationDiv.className = 'info-deprecation';
into.appendChild(deprecationDiv);
into.append(deprecationDiv);
const label = document.createElement('span');
label.className = 'info-deprecation-label';
label.appendChild(document.createTextNode('Deprecated'));
deprecationDiv.appendChild(label);
label.append(document.createTextNode('Deprecated'));
deprecationDiv.append(label);
const reasonDiv = document.createElement('div');

@@ -160,5 +160,5 @@ reasonDiv.className = 'info-deprecation-reason';

else {
reasonDiv.appendChild(document.createTextNode(reason));
reasonDiv.append(document.createTextNode(reason));
}
deprecationDiv.appendChild(reasonDiv);
deprecationDiv.append(reasonDiv);
}

@@ -181,9 +181,9 @@ }

node.className = className;
node.appendChild(document.createTextNode(content));
into.appendChild(node);
node.append(document.createTextNode(content));
into.append(node);
}
else {
into.appendChild(document.createTextNode(content));
into.append(document.createTextNode(content));
}
}
//# sourceMappingURL=info.js.map

@@ -23,3 +23,3 @@ "use strict";

var into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.fieldDef);

@@ -33,3 +33,3 @@ return into;

var into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.directiveDef);

@@ -43,3 +43,3 @@ return into;

var into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.argDef);

@@ -55,3 +55,3 @@ return into;

var into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.enumValue);

@@ -67,3 +67,3 @@ return into;

var into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.type);

@@ -115,3 +115,3 @@ return into;

}
into.appendChild(typeSpan);
into.append(typeSpan);
}

@@ -141,5 +141,5 @@ function renderType(into, typeInfo, options, t) {

else {
descriptionDiv.appendChild(document.createTextNode(description));
descriptionDiv.append(document.createTextNode(description));
}
into.appendChild(descriptionDiv);
into.append(descriptionDiv);
}

@@ -153,7 +153,7 @@ renderDeprecation(into, options, def);

deprecationDiv.className = 'info-deprecation';
into.appendChild(deprecationDiv);
into.append(deprecationDiv);
var label = document.createElement('span');
label.className = 'info-deprecation-label';
label.appendChild(document.createTextNode('Deprecated'));
deprecationDiv.appendChild(label);
label.append(document.createTextNode('Deprecated'));
deprecationDiv.append(label);
var reasonDiv = document.createElement('div');

@@ -165,5 +165,5 @@ reasonDiv.className = 'info-deprecation-reason';

else {
reasonDiv.appendChild(document.createTextNode(reason));
reasonDiv.append(document.createTextNode(reason));
}
deprecationDiv.appendChild(reasonDiv);
deprecationDiv.append(reasonDiv);
}

@@ -189,9 +189,9 @@ }

node.className = className;
node.appendChild(document.createTextNode(content));
into.appendChild(node);
node.append(document.createTextNode(content));
into.append(node);
}
else {
into.appendChild(document.createTextNode(content));
into.append(document.createTextNode(content));
}
}
//# sourceMappingURL=info.js.map
{
"name": "codemirror-graphql",
"version": "2.0.5",
"version": "2.0.6",
"description": "GraphQL mode and helpers for CodeMirror.",

@@ -54,3 +54,3 @@ "contributors": [

"dependencies": {
"graphql-language-service": "5.1.3"
"graphql-language-service": "5.1.4"
},

@@ -57,0 +57,0 @@ "devDependencies": {

@@ -8,2 +8,4 @@ # GraphQL mode for CodeMirror

**NOTE: For CodeMirror 6, use [cm6-graphql](/packages/cm6-graphql/) instead**
Provides CodeMirror with a parser mode for GraphQL along with a live linter and

@@ -10,0 +12,0 @@ typeahead hinter powered by your GraphQL Schema.

@@ -16,3 +16,2 @@ import 'codemirror/addon/hint/show-hint';

// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface CodeMirrorHintMap {}

@@ -19,0 +18,0 @@

@@ -78,3 +78,3 @@ /* @flow */

const into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.fieldDef as any);

@@ -88,3 +88,3 @@ return into;

const into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.directiveDef);

@@ -98,3 +98,3 @@ return into;

const into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.argDef);

@@ -112,3 +112,3 @@ return into;

const into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.enumValue);

@@ -126,3 +126,3 @@ return into;

const into = document.createElement('div');
into.appendChild(header);
into.append(header);
renderDescription(into, options, typeInfo.type);

@@ -206,3 +206,3 @@ return into;

}
into.appendChild(typeSpan);
into.append(typeSpan);
}

@@ -251,5 +251,5 @@

} else {
descriptionDiv.appendChild(document.createTextNode(description));
descriptionDiv.append(document.createTextNode(description));
}
into.appendChild(descriptionDiv);
into.append(descriptionDiv);
}

@@ -274,8 +274,8 @@

deprecationDiv.className = 'info-deprecation';
into.appendChild(deprecationDiv);
into.append(deprecationDiv);
const label = document.createElement('span');
label.className = 'info-deprecation-label';
label.appendChild(document.createTextNode('Deprecated'));
deprecationDiv.appendChild(label);
label.append(document.createTextNode('Deprecated'));
deprecationDiv.append(label);

@@ -287,5 +287,5 @@ const reasonDiv = document.createElement('div');

} else {
reasonDiv.appendChild(document.createTextNode(reason));
reasonDiv.append(document.createTextNode(reason));
}
deprecationDiv.appendChild(reasonDiv);
deprecationDiv.append(reasonDiv);
}

@@ -317,7 +317,7 @@ }

node.className = className;
node.appendChild(document.createTextNode(content));
into.appendChild(node);
node.append(document.createTextNode(content));
into.append(node);
} else {
into.appendChild(document.createTextNode(content));
into.append(document.createTextNode(content));
}
}

@@ -25,7 +25,7 @@ /**

const variableToType = Object.create(null);
documentAST.definitions.forEach(definition => {
for (const definition of documentAST.definitions) {
if (definition.kind === 'OperationDefinition') {
const { variableDefinitions } = definition;
if (variableDefinitions) {
variableDefinitions.forEach(({ variable, type }) => {
for (const { variable, type } of variableDefinitions) {
const inputType = typeFromAST(schema, type as NamedTypeNode);

@@ -35,7 +35,7 @@ if (inputType) {

}
});
}
}
}
});
}
return variableToType;
}

@@ -115,4 +115,4 @@ /**

popup.className = 'CodeMirror-info';
popup.appendChild(info);
document.body.appendChild(popup);
popup.append(info);
document.body.append(popup);

@@ -173,7 +173,7 @@ const popupBox = popup.getBoundingClientRect();

if (popup.parentNode) {
popup.parentNode.removeChild(popup);
popup.remove();
}
}, 600);
} else if (popup.parentNode) {
popup.parentNode.removeChild(popup);
popup.remove();
}

@@ -180,0 +180,0 @@ };

@@ -26,3 +26,3 @@ /**

lines.forEach(line => {
for (const line of lines) {
const stream = new CharacterStream(line);

@@ -33,3 +33,3 @@ while (!stream.eol()) {

}
});
}
}

@@ -88,3 +88,3 @@ /**

variablesAST.members.forEach(member => {
for (const member of variablesAST.members) {
if (member) {

@@ -94,5 +94,5 @@ const variableName = member.key?.value;

if (type) {
validateValue(type, member.value).forEach(([node, message]) => {
for (const [node, message] of validateValue(type, member.value)) {
errors.push(lintError(editor, node, message));
});
}
} else {

@@ -108,3 +108,3 @@ errors.push(

}
});
}

@@ -175,3 +175,3 @@ return errors;

// Look for missing non-nullable fields.
Object.keys(type.getFields()).forEach(fieldName => {
for (const fieldName of Object.keys(type.getFields())) {
const field = type.getFields()[fieldName];

@@ -188,3 +188,3 @@ if (

}
});
}

@@ -191,0 +191,0 @@ return fieldErrors;

import { typeFromAST, } from 'graphql';
export default function collectVariables(schema, documentAST) {
const variableToType = Object.create(null);
documentAST.definitions.forEach(definition => {
for (const definition of documentAST.definitions) {
if (definition.kind === 'OperationDefinition') {
const { variableDefinitions } = definition;
if (variableDefinitions) {
variableDefinitions.forEach(({ variable, type }) => {
for (const { variable, type } of variableDefinitions) {
const inputType = typeFromAST(schema, type);

@@ -13,8 +13,8 @@ if (inputType) {

}
});
}
}
}
});
}
return variableToType;
}
//# sourceMappingURL=collectVariables.js.map
"use strict";
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
var graphql_1 = require("graphql");
function collectVariables(schema, documentAST) {
var e_1, _a, e_2, _b;
var variableToType = Object.create(null);
documentAST.definitions.forEach(function (definition) {
if (definition.kind === 'OperationDefinition') {
var variableDefinitions = definition.variableDefinitions;
if (variableDefinitions) {
variableDefinitions.forEach(function (_a) {
var variable = _a.variable, type = _a.type;
var inputType = (0, graphql_1.typeFromAST)(schema, type);
if (inputType) {
variableToType[variable.name.value] = inputType;
try {
for (var _c = __values(documentAST.definitions), _d = _c.next(); !_d.done; _d = _c.next()) {
var definition = _d.value;
if (definition.kind === 'OperationDefinition') {
var variableDefinitions = definition.variableDefinitions;
if (variableDefinitions) {
try {
for (var variableDefinitions_1 = (e_2 = void 0, __values(variableDefinitions)), variableDefinitions_1_1 = variableDefinitions_1.next(); !variableDefinitions_1_1.done; variableDefinitions_1_1 = variableDefinitions_1.next()) {
var _e = variableDefinitions_1_1.value, variable = _e.variable, type = _e.type;
var inputType = (0, graphql_1.typeFromAST)(schema, type);
if (inputType) {
variableToType[variable.name.value] = inputType;
}
}
}
});
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (variableDefinitions_1_1 && !variableDefinitions_1_1.done && (_b = variableDefinitions_1.return)) _b.call(variableDefinitions_1);
}
finally { if (e_2) throw e_2.error; }
}
}
}
}
});
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}
finally { if (e_1) throw e_1.error; }
}
return variableToType;

@@ -21,0 +52,0 @@ }

@@ -80,4 +80,4 @@ import CodeMirror from 'codemirror';

popup.className = 'CodeMirror-info';
popup.appendChild(info);
document.body.appendChild(popup);
popup.append(info);
document.body.append(popup);
const popupBox = popup.getBoundingClientRect();

@@ -124,3 +124,3 @@ const popupStyle = window.getComputedStyle(popup);

if (popup.parentNode) {
popup.parentNode.removeChild(popup);
popup.remove();
}

@@ -130,3 +130,3 @@ }, 600);

else if (popup.parentNode) {
popup.parentNode.removeChild(popup);
popup.remove();
}

@@ -133,0 +133,0 @@ };

@@ -85,4 +85,4 @@ "use strict";

popup.className = 'CodeMirror-info';
popup.appendChild(info);
document.body.appendChild(popup);
popup.append(info);
document.body.append(popup);
var popupBox = popup.getBoundingClientRect();

@@ -129,3 +129,3 @@ var popupStyle = window.getComputedStyle(popup);

if (popup.parentNode) {
popup.parentNode.removeChild(popup);
popup.remove();
}

@@ -135,3 +135,3 @@ }, 600);

else if (popup.parentNode) {
popup.parentNode.removeChild(popup);
popup.remove();
}

@@ -138,0 +138,0 @@ };

@@ -6,3 +6,3 @@ import { CharacterStream, onlineParser, } from 'graphql-language-service';

const lines = sourceText.split('\n');
lines.forEach(line => {
for (const line of lines) {
const stream = new CharacterStream(line);

@@ -13,4 +13,4 @@ while (!stream.eol()) {

}
});
}
}
//# sourceMappingURL=runParser.js.map
"use strict";
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
var graphql_language_service_1 = require("graphql-language-service");
function runParser(sourceText, parserOptions, callbackFn) {
var e_1, _a;
var parser = (0, graphql_language_service_1.onlineParser)(parserOptions);
var state = parser.startState();
var lines = sourceText.split('\n');
lines.forEach(function (line) {
var stream = new graphql_language_service_1.CharacterStream(line);
while (!stream.eol()) {
var style = parser.token(stream, state);
callbackFn(stream, state, style);
try {
for (var lines_1 = __values(lines), lines_1_1 = lines_1.next(); !lines_1_1.done; lines_1_1 = lines_1.next()) {
var line = lines_1_1.value;
var stream = new graphql_language_service_1.CharacterStream(line);
while (!stream.eol()) {
var style = parser.token(stream, state);
callbackFn(stream, state, style);
}
}
});
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (lines_1_1 && !lines_1_1.done && (_a = lines_1.return)) _a.call(lines_1);
}
finally { if (e_1) throw e_1.error; }
}
}
exports.default = runParser;
//# sourceMappingURL=runParser.js.map

@@ -25,5 +25,5 @@ import CodeMirror from 'codemirror';

function validateVariables(editor, variableToType, variablesAST) {
var _a;
const errors = [];
variablesAST.members.forEach(member => {
var _a;
for (const member of variablesAST.members) {
if (member) {

@@ -33,5 +33,5 @@ const variableName = (_a = member.key) === null || _a === void 0 ? void 0 : _a.value;

if (type) {
validateValue(type, member.value).forEach(([node, message]) => {
for (const [node, message] of validateValue(type, member.value)) {
errors.push(lintError(editor, node, message));
});
}
}

@@ -42,3 +42,3 @@ else {

}
});
}
return errors;

@@ -88,3 +88,3 @@ }

});
Object.keys(type.getFields()).forEach(fieldName => {
for (const fieldName of Object.keys(type.getFields())) {
const field = type.getFields()[fieldName];

@@ -99,3 +99,3 @@ if (!providedFields[fieldName] &&

}
});
}
return fieldErrors;

@@ -102,0 +102,0 @@ }

@@ -25,2 +25,13 @@ "use strict";

};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __read = (this && this.__read) || function (o, n) {

@@ -70,22 +81,43 @@ var m = typeof Symbol === "function" && o[Symbol.iterator];

function validateVariables(editor, variableToType, variablesAST) {
var e_1, _a, e_2, _b;
var _c;
var errors = [];
variablesAST.members.forEach(function (member) {
var _a;
if (member) {
var variableName = (_a = member.key) === null || _a === void 0 ? void 0 : _a.value;
var type = variableToType[variableName];
if (type) {
validateValue(type, member.value).forEach(function (_a) {
var _b = __read(_a, 2), node = _b[0], message = _b[1];
errors.push(lintError(editor, node, message));
});
try {
for (var _d = __values(variablesAST.members), _e = _d.next(); !_e.done; _e = _d.next()) {
var member = _e.value;
if (member) {
var variableName = (_c = member.key) === null || _c === void 0 ? void 0 : _c.value;
var type = variableToType[variableName];
if (type) {
try {
for (var _f = (e_2 = void 0, __values(validateValue(type, member.value))), _g = _f.next(); !_g.done; _g = _f.next()) {
var _h = __read(_g.value, 2), node = _h[0], message = _h[1];
errors.push(lintError(editor, node, message));
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
}
finally { if (e_2) throw e_2.error; }
}
}
else {
errors.push(lintError(editor, member.key, "Variable \"$".concat(variableName, "\" does not appear in any GraphQL query.")));
}
}
else {
errors.push(lintError(editor, member.key, "Variable \"$".concat(variableName, "\" does not appear in any GraphQL query.")));
}
}
});
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
}
finally { if (e_1) throw e_1.error; }
}
return errors;
}
function validateValue(type, valueAST) {
var e_3, _a;
if (!type || !valueAST) {

@@ -116,3 +148,3 @@ return [];

var providedFields_1 = Object.create(null);
var fieldErrors_1 = mapCat(valueAST.members, function (member) {
var fieldErrors = mapCat(valueAST.members, function (member) {
var _a;

@@ -133,14 +165,24 @@ var fieldName = (_a = member === null || member === void 0 ? void 0 : member.key) === null || _a === void 0 ? void 0 : _a.value;

});
Object.keys(type.getFields()).forEach(function (fieldName) {
var field = type.getFields()[fieldName];
if (!providedFields_1[fieldName] &&
field.type instanceof graphql_1.GraphQLNonNull &&
!field.defaultValue) {
fieldErrors_1.push([
valueAST,
"Object of type \"".concat(type, "\" is missing required field \"").concat(fieldName, "\"."),
]);
try {
for (var _b = __values(Object.keys(type.getFields())), _c = _b.next(); !_c.done; _c = _b.next()) {
var fieldName = _c.value;
var field = type.getFields()[fieldName];
if (!providedFields_1[fieldName] &&
field.type instanceof graphql_1.GraphQLNonNull &&
!field.defaultValue) {
fieldErrors.push([
valueAST,
"Object of type \"".concat(type, "\" is missing required field \"").concat(fieldName, "\"."),
]);
}
}
});
return fieldErrors_1;
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_3) throw e_3.error; }
}
return fieldErrors;
}

@@ -147,0 +189,0 @@ if ((type.name === 'Boolean' && valueAST.kind !== 'Boolean') ||

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc