Socket
Socket
Sign inDemoInstall

graphql-language-service

Package Overview
Dependencies
Maintainers
13
Versions
242
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-language-service - npm Package Compare versions

Comparing version 5.1.0 to 5.1.1

208

dist/interface/getAutocompleteSuggestions.js

@@ -6,3 +6,2 @@ "use strict";

const types_1 = require("../types");
const graphql_2 = require("graphql");
const parser_1 = require("../parser");

@@ -18,3 +17,3 @@ const autocompleteUtils_1 = require("./autocompleteUtils");

try {
(0, graphql_2.visit)((0, graphql_2.parse)(op), {
(0, graphql_1.visit)((0, graphql_1.parse)(op), {
FragmentDefinition(def) {

@@ -53,3 +52,3 @@ externalFragments.push(def);

try {
(0, graphql_2.visit)((0, graphql_2.parse)(sdl), {
(0, graphql_1.visit)((0, graphql_1.parse)(sdl), {
enter(node) {

@@ -61,3 +60,3 @@ if (node.kind === 'Document') {

hasTypeSystemDef = true;
return graphql_2.BREAK;
return graphql_1.BREAK;
}

@@ -83,4 +82,3 @@ return false;

}
const kind = state.kind;
const step = state.step;
const { kind, step } = state;
const typeInfo = getTypeInfo(schema, token.state);

@@ -160,3 +158,3 @@ if (kind === parser_1.RuleKinds.DOCUMENT) {

(kind === parser_1.RuleKinds.ARGUMENT && step === 0)) {
const argDefs = typeInfo.argDefs;
const { argDefs } = typeInfo;
if (argDefs) {

@@ -177,20 +175,19 @@ return (0, autocompleteUtils_1.hintList)(token, argDefs.map((argDef) => {

}
if (kind === parser_1.RuleKinds.OBJECT_VALUE ||
(kind === parser_1.RuleKinds.OBJECT_FIELD && step === 0)) {
if (typeInfo.objectFieldDefs) {
const objectFields = (0, autocompleteUtils_1.objectValues)(typeInfo.objectFieldDefs);
const completionKind = kind === parser_1.RuleKinds.OBJECT_VALUE
? types_1.CompletionItemKind.Value
: types_1.CompletionItemKind.Field;
return (0, autocompleteUtils_1.hintList)(token, objectFields.map(field => {
var _a;
return ({
label: field.name,
detail: String(field.type),
documentation: (_a = field.description) !== null && _a !== void 0 ? _a : undefined,
kind: completionKind,
type: field.type,
});
}));
}
if ((kind === parser_1.RuleKinds.OBJECT_VALUE ||
(kind === parser_1.RuleKinds.OBJECT_FIELD && step === 0)) &&
typeInfo.objectFieldDefs) {
const objectFields = (0, autocompleteUtils_1.objectValues)(typeInfo.objectFieldDefs);
const completionKind = kind === parser_1.RuleKinds.OBJECT_VALUE
? types_1.CompletionItemKind.Value
: types_1.CompletionItemKind.Field;
return (0, autocompleteUtils_1.hintList)(token, objectFields.map(field => {
var _a;
return ({
label: field.name,
detail: String(field.type),
documentation: (_a = field.description) !== null && _a !== void 0 ? _a : undefined,
kind: completionKind,
type: field.type,
});
}));
}

@@ -204,3 +201,3 @@ if (kind === parser_1.RuleKinds.ENUM_VALUE ||

if (kind === parser_1.RuleKinds.VARIABLE && step === 1) {
const namedInputType = (0, graphql_2.getNamedType)(typeInfo.inputType);
const namedInputType = (0, graphql_1.getNamedType)(typeInfo.inputType);
const variableDefinitions = getVariableCompletions(queryText, schema, token);

@@ -235,3 +232,3 @@ return (0, autocompleteUtils_1.hintList)(token, variableDefinitions.filter(v => v.detail === (namedInputType === null || namedInputType === void 0 ? void 0 : namedInputType.name)));

return (0, autocompleteUtils_1.hintList)(token, Object.values(schema.getTypeMap())
.filter(type => (0, graphql_2.isInputType)(type) && !type.name.startsWith('__'))
.filter(type => (0, graphql_1.isInputType)(type) && !type.name.startsWith('__'))
.map(type => ({

@@ -260,14 +257,14 @@ label: type.name,

const getInsertText = (field) => {
const type = field.type;
if ((0, graphql_2.isCompositeType)(type)) {
const { type } = field;
if ((0, graphql_1.isCompositeType)(type)) {
return insertSuffix;
}
if ((0, graphql_1.isListType)(type) && (0, graphql_2.isCompositeType)(type.ofType)) {
if ((0, graphql_1.isListType)(type) && (0, graphql_1.isCompositeType)(type.ofType)) {
return insertSuffix;
}
if ((0, graphql_1.isNonNullType)(type)) {
if ((0, graphql_2.isCompositeType)(type.ofType)) {
if ((0, graphql_1.isCompositeType)(type.ofType)) {
return insertSuffix;
}
if ((0, graphql_1.isListType)(type.ofType) && (0, graphql_2.isCompositeType)(type.ofType.ofType)) {
if ((0, graphql_1.isListType)(type.ofType) && (0, graphql_1.isCompositeType)(type.ofType.ofType)) {
return insertSuffix;

@@ -311,3 +308,3 @@ }

if (typeInfo.parentType) {
const parentType = typeInfo.parentType;
const { parentType } = typeInfo;
let fields = [];

@@ -317,7 +314,7 @@ if ('getFields' in parentType) {

}
if ((0, graphql_2.isCompositeType)(parentType)) {
fields.push(graphql_2.TypeNameMetaFieldDef);
if ((0, graphql_1.isCompositeType)(parentType)) {
fields.push(graphql_1.TypeNameMetaFieldDef);
}
if (parentType === ((_a = options === null || options === void 0 ? void 0 : options.schema) === null || _a === void 0 ? void 0 : _a.getQueryType())) {
fields.push(graphql_2.SchemaMetaFieldDef, graphql_2.TypeMetaFieldDef);
fields.push(graphql_1.SchemaMetaFieldDef, graphql_1.TypeMetaFieldDef);
}

@@ -337,7 +334,9 @@ return (0, autocompleteUtils_1.hintList)(token, fields.map((field, index) => {

};
const insertText = getInsertText(field);
if (insertText) {
suggestion.insertText = field.name + insertText;
suggestion.insertTextFormat = types_1.InsertTextFormat.Snippet;
suggestion.command = exports.SuggestionCommand;
if (options === null || options === void 0 ? void 0 : options.fillLeafsOnComplete) {
const insertText = getInsertText(field);
if (insertText) {
suggestion.insertText = field.name + insertText;
suggestion.insertTextFormat = types_1.InsertTextFormat.Snippet;
suggestion.command = exports.SuggestionCommand;
}
}

@@ -350,5 +349,5 @@ return suggestion;

function getSuggestionsForInputValues(token, typeInfo, queryText, schema) {
const namedInputType = (0, graphql_2.getNamedType)(typeInfo.inputType);
const namedInputType = (0, graphql_1.getNamedType)(typeInfo.inputType);
const queryVariables = getVariableCompletions(queryText, schema, token).filter(v => v.detail === namedInputType.name);
if (namedInputType instanceof graphql_2.GraphQLEnumType) {
if (namedInputType instanceof graphql_1.GraphQLEnumType) {
const values = namedInputType.getValues();

@@ -371,17 +370,17 @@ return (0, autocompleteUtils_1.hintList)(token, values

}
else if (namedInputType === graphql_2.GraphQLBoolean) {
if (namedInputType === graphql_1.GraphQLBoolean) {
return (0, autocompleteUtils_1.hintList)(token, queryVariables.concat([
{
label: 'true',
detail: String(graphql_2.GraphQLBoolean),
detail: String(graphql_1.GraphQLBoolean),
documentation: 'Not false.',
kind: types_1.CompletionItemKind.Variable,
type: graphql_2.GraphQLBoolean,
type: graphql_1.GraphQLBoolean,
},
{
label: 'false',
detail: String(graphql_2.GraphQLBoolean),
detail: String(graphql_1.GraphQLBoolean),
documentation: 'Not true.',
kind: types_1.CompletionItemKind.Variable,
type: graphql_2.GraphQLBoolean,
type: graphql_1.GraphQLBoolean,
},

@@ -460,4 +459,4 @@ ]));

if (typeInfo.parentType) {
if ((0, graphql_2.isAbstractType)(typeInfo.parentType)) {
const abstractType = (0, graphql_2.assertAbstractType)(typeInfo.parentType);
if ((0, graphql_1.isAbstractType)(typeInfo.parentType)) {
const abstractType = (0, graphql_1.assertAbstractType)(typeInfo.parentType);
const possibleObjTypes = schema.getPossibleTypes(abstractType);

@@ -478,6 +477,6 @@ const possibleIfaceMap = Object.create(null);

const typeMap = schema.getTypeMap();
possibleTypes = (0, autocompleteUtils_1.objectValues)(typeMap).filter(type => (0, graphql_2.isCompositeType)(type) && !type.name.startsWith('__'));
possibleTypes = (0, autocompleteUtils_1.objectValues)(typeMap).filter(type => (0, graphql_1.isCompositeType)(type) && !type.name.startsWith('__'));
}
return (0, autocompleteUtils_1.hintList)(token, possibleTypes.map(type => {
const namedType = (0, graphql_2.getNamedType)(type);
const namedType = (0, graphql_1.getNamedType)(type);
return {

@@ -504,5 +503,5 @@ label: String(type),

defState.name === frag.name.value) &&
(0, graphql_2.isCompositeType)(typeInfo.parentType) &&
(0, graphql_2.isCompositeType)(typeMap[frag.typeCondition.name.value]) &&
(0, graphql_2.doTypesOverlap)(schema, typeInfo.parentType, typeMap[frag.typeCondition.name.value]));
(0, graphql_1.isCompositeType)(typeInfo.parentType) &&
(0, graphql_1.isCompositeType)(typeMap[frag.typeCondition.name.value]) &&
(0, graphql_1.doTypesOverlap)(schema, typeInfo.parentType, typeMap[frag.typeCondition.name.value]));
return (0, autocompleteUtils_1.hintList)(token, relevantFrags.map(frag => ({

@@ -545,14 +544,12 @@ label: frag.name.value,

}
if (variableName && variableType) {
if (!definitions[variableName]) {
definitions[variableName] = {
detail: variableType.toString(),
insertText: token.string === '$' ? variableName : '$' + variableName,
label: variableName,
type: variableType,
kind: types_1.CompletionItemKind.Variable,
};
variableName = null;
variableType = null;
}
if (variableName && variableType && !definitions[variableName]) {
definitions[variableName] = {
detail: variableType.toString(),
insertText: token.string === '$' ? variableName : '$' + variableName,
label: variableName,
type: variableType,
kind: types_1.CompletionItemKind.Variable,
};
variableName = null;
variableType = null;
}

@@ -594,3 +591,3 @@ });

const inputTypeMap = schema.getTypeMap();
const inputTypes = (0, autocompleteUtils_1.objectValues)(inputTypeMap).filter(graphql_2.isInputType);
const inputTypes = (0, autocompleteUtils_1.objectValues)(inputTypeMap).filter(graphql_1.isInputType);
return (0, autocompleteUtils_1.hintList)(token, inputTypes.map((type) => ({

@@ -621,9 +618,8 @@ label: type.name,

const token = runOnlineParser(queryText, (stream, state, style, index) => {
if (index === cursor.line) {
if (stream.getCurrentPosition() >= cursor.character) {
styleAtCursor = style;
stateAtCursor = Object.assign({}, state);
stringAtCursor = stream.current();
return 'BREAK';
}
if (index === cursor.line &&
stream.getCurrentPosition() >= cursor.character) {
styleAtCursor = style;
stateAtCursor = Object.assign({}, state);
stringAtCursor = stream.current();
return 'BREAK';
}

@@ -674,38 +670,38 @@ });

}
const kind = state.kind;
const locations = directive.locations;
const { kind } = state;
const { locations } = directive;
switch (kind) {
case parser_1.RuleKinds.QUERY:
return locations.indexOf(graphql_1.DirectiveLocation.QUERY) !== -1;
return locations.includes(graphql_1.DirectiveLocation.QUERY);
case parser_1.RuleKinds.MUTATION:
return locations.indexOf(graphql_1.DirectiveLocation.MUTATION) !== -1;
return locations.includes(graphql_1.DirectiveLocation.MUTATION);
case parser_1.RuleKinds.SUBSCRIPTION:
return locations.indexOf(graphql_1.DirectiveLocation.SUBSCRIPTION) !== -1;
return locations.includes(graphql_1.DirectiveLocation.SUBSCRIPTION);
case parser_1.RuleKinds.FIELD:
case parser_1.RuleKinds.ALIASED_FIELD:
return locations.indexOf(graphql_1.DirectiveLocation.FIELD) !== -1;
return locations.includes(graphql_1.DirectiveLocation.FIELD);
case parser_1.RuleKinds.FRAGMENT_DEFINITION:
return locations.indexOf(graphql_1.DirectiveLocation.FRAGMENT_DEFINITION) !== -1;
return locations.includes(graphql_1.DirectiveLocation.FRAGMENT_DEFINITION);
case parser_1.RuleKinds.FRAGMENT_SPREAD:
return locations.indexOf(graphql_1.DirectiveLocation.FRAGMENT_SPREAD) !== -1;
return locations.includes(graphql_1.DirectiveLocation.FRAGMENT_SPREAD);
case parser_1.RuleKinds.INLINE_FRAGMENT:
return locations.indexOf(graphql_1.DirectiveLocation.INLINE_FRAGMENT) !== -1;
return locations.includes(graphql_1.DirectiveLocation.INLINE_FRAGMENT);
case parser_1.RuleKinds.SCHEMA_DEF:
return locations.indexOf(graphql_1.DirectiveLocation.SCHEMA) !== -1;
return locations.includes(graphql_1.DirectiveLocation.SCHEMA);
case parser_1.RuleKinds.SCALAR_DEF:
return locations.indexOf(graphql_1.DirectiveLocation.SCALAR) !== -1;
return locations.includes(graphql_1.DirectiveLocation.SCALAR);
case parser_1.RuleKinds.OBJECT_TYPE_DEF:
return locations.indexOf(graphql_1.DirectiveLocation.OBJECT) !== -1;
return locations.includes(graphql_1.DirectiveLocation.OBJECT);
case parser_1.RuleKinds.FIELD_DEF:
return locations.indexOf(graphql_1.DirectiveLocation.FIELD_DEFINITION) !== -1;
return locations.includes(graphql_1.DirectiveLocation.FIELD_DEFINITION);
case parser_1.RuleKinds.INTERFACE_DEF:
return locations.indexOf(graphql_1.DirectiveLocation.INTERFACE) !== -1;
return locations.includes(graphql_1.DirectiveLocation.INTERFACE);
case parser_1.RuleKinds.UNION_DEF:
return locations.indexOf(graphql_1.DirectiveLocation.UNION) !== -1;
return locations.includes(graphql_1.DirectiveLocation.UNION);
case parser_1.RuleKinds.ENUM_DEF:
return locations.indexOf(graphql_1.DirectiveLocation.ENUM) !== -1;
return locations.includes(graphql_1.DirectiveLocation.ENUM);
case parser_1.RuleKinds.ENUM_VALUE:
return locations.indexOf(graphql_1.DirectiveLocation.ENUM_VALUE) !== -1;
return locations.includes(graphql_1.DirectiveLocation.ENUM_VALUE);
case parser_1.RuleKinds.INPUT_DEF:
return locations.indexOf(graphql_1.DirectiveLocation.INPUT_OBJECT) !== -1;
return locations.includes(graphql_1.DirectiveLocation.INPUT_OBJECT);
case parser_1.RuleKinds.INPUT_VALUE_DEF:

@@ -715,5 +711,5 @@ const prevStateKind = (_a = state.prevState) === null || _a === void 0 ? void 0 : _a.kind;

case parser_1.RuleKinds.ARGUMENTS_DEF:
return (locations.indexOf(graphql_1.DirectiveLocation.ARGUMENT_DEFINITION) !== -1);
return locations.includes(graphql_1.DirectiveLocation.ARGUMENT_DEFINITION);
case parser_1.RuleKinds.INPUT_DEF:
return (locations.indexOf(graphql_1.DirectiveLocation.INPUT_FIELD_DEFINITION) !== -1);
return locations.includes(graphql_1.DirectiveLocation.INPUT_FIELD_DEFINITION);
}

@@ -769,3 +765,3 @@ }

case parser_1.RuleKinds.SELECTION_SET:
parentType = (0, graphql_2.getNamedType)(type);
parentType = (0, graphql_1.getNamedType)(type);
break;

@@ -796,6 +792,3 @@ case parser_1.RuleKinds.DIRECTIVE:

case parser_1.RuleKinds.ARGUMENTS: {
if (!state.prevState) {
argDefs = null;
}
else {
if (state.prevState) {
switch (state.prevState.kind) {

@@ -830,2 +823,5 @@ case parser_1.RuleKinds.FIELD:

}
else {
argDefs = null;
}
break;

@@ -845,5 +841,5 @@ }

case parser_1.RuleKinds.ENUM_VALUE:
const enumType = (0, graphql_2.getNamedType)(inputType);
const enumType = (0, graphql_1.getNamedType)(inputType);
enumValue =
enumType instanceof graphql_2.GraphQLEnumType
enumType instanceof graphql_1.GraphQLEnumType
? enumType

@@ -855,10 +851,10 @@ .getValues()

case parser_1.RuleKinds.LIST_VALUE:
const nullableType = (0, graphql_2.getNullableType)(inputType);
const nullableType = (0, graphql_1.getNullableType)(inputType);
inputType =
nullableType instanceof graphql_2.GraphQLList ? nullableType.ofType : null;
nullableType instanceof graphql_1.GraphQLList ? nullableType.ofType : null;
break;
case parser_1.RuleKinds.OBJECT_VALUE:
const objectType = (0, graphql_2.getNamedType)(inputType);
const objectType = (0, graphql_1.getNamedType)(inputType);
objectFieldDefs =
objectType instanceof graphql_2.GraphQLInputObjectType
objectType instanceof graphql_1.GraphQLInputObjectType
? objectType.getFields()

@@ -865,0 +861,0 @@ : null;

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

if (defNodes.length === 0) {
throw Error(`Definition not found for GraphQL type ${name}`);
throw new Error(`Definition not found for GraphQL type ${name}`);
}

@@ -50,3 +50,3 @@ const definitions = defNodes.map(({ filePath, content, definition }) => getDefinitionForNodeDefinition(filePath || '', content, definition));

if (defNodes.length === 0) {
throw Error(`Definition not found for GraphQL type ${typeName}`);
throw new Error(`Definition not found for GraphQL type ${typeName}`);
}

@@ -74,3 +74,3 @@ const definitions = [];

if (defNodes.length === 0) {
throw Error(`Definition not found for GraphQL fragment ${name}`);
throw new Error(`Definition not found for GraphQL fragment ${name}`);
}

@@ -93,5 +93,5 @@ const definitions = defNodes.map(({ filePath, content, definition }) => getDefinitionForFragmentDefinition(filePath || '', content, definition));

function getDefinitionForFragmentDefinition(path, text, definition) {
const name = definition.name;
const { name } = definition;
if (!name) {
throw Error('Expected ASTNode to have a Name.');
throw new Error('Expected ASTNode to have a Name.');
}

@@ -108,3 +108,3 @@ return {

function getDefinitionForNodeDefinition(path, text, definition) {
const name = definition.name;
const { name } = definition;
assert(name, 'Expected ASTNode to have a Name.');

@@ -121,3 +121,3 @@ return {

function getDefinitionForFieldDefinition(path, text, definition) {
const name = definition.name;
const { name } = definition;
assert(name, 'Expected ASTNode to have a Name.');

@@ -124,0 +124,0 @@ return {

@@ -5,3 +5,2 @@ "use strict";

const graphql_1 = require("graphql");
const graphql_2 = require("graphql");
const parser_1 = require("../parser");

@@ -43,3 +42,3 @@ const utils_1 = require("../utils");

try {
ast = (0, graphql_2.parse)(query);
ast = (0, graphql_1.parse)(query);
}

@@ -67,10 +66,9 @@ catch (error) {

}
const validationErrorAnnotations = mapCat((0, utils_1.validateWithCustomRules)(schema, ast, customRules, isRelayCompatMode), error => annotations(error, exports.DIAGNOSTIC_SEVERITY.Error, 'Validation'));
const deprecationWarningAnnotations = mapCat((0, graphql_1.validate)(schema, ast, [graphql_1.NoDeprecatedCustomRule]), error => annotations(error, exports.DIAGNOSTIC_SEVERITY.Warning, 'Deprecation'));
const validationErrorAnnotations = (0, utils_1.validateWithCustomRules)(schema, ast, customRules, isRelayCompatMode).flatMap(error => annotations(error, exports.DIAGNOSTIC_SEVERITY.Error, 'Validation'));
const deprecationWarningAnnotations = (0, graphql_1.validate)(schema, ast, [
graphql_1.NoDeprecatedCustomRule,
]).flatMap(error => annotations(error, exports.DIAGNOSTIC_SEVERITY.Warning, 'Deprecation'));
return validationErrorAnnotations.concat(deprecationWarningAnnotations);
}
exports.validateQuery = validateQuery;
function mapCat(array, mapper) {
return Array.prototype.concat.apply([], array.map(mapper));
}
function annotations(error, severity, type) {

@@ -77,0 +75,0 @@ if (!error.nodes) {

@@ -11,5 +11,4 @@ "use strict";

}
const state = token.state;
const kind = state.kind;
const step = state.step;
const { state } = token;
const { kind, step } = state;
const typeInfo = (0, getAutocompleteSuggestions_1.getTypeInfo)(schema, token.state);

@@ -26,3 +25,3 @@ const options = Object.assign(Object.assign({}, config), { schema });

}
else if (kind === 'Directive' && step === 1 && typeInfo.directiveDef) {
if (kind === 'Directive' && step === 1 && typeInfo.directiveDef) {
const into = [];

@@ -35,3 +34,3 @@ renderMdCodeStart(into, options);

}
else if (kind === 'Argument' && step === 0 && typeInfo.argDef) {
if (kind === 'Argument' && step === 0 && typeInfo.argDef) {
const into = [];

@@ -44,3 +43,3 @@ renderMdCodeStart(into, options);

}
else if (kind === 'EnumValue' &&
if (kind === 'EnumValue' &&
typeInfo.enumValue &&

@@ -55,5 +54,3 @@ 'description' in typeInfo.enumValue) {

}
else if (kind === 'NamedType' &&
typeInfo.type &&
'description' in typeInfo.type) {
if (kind === 'NamedType' && typeInfo.type && 'description' in typeInfo.type) {
const into = [];

@@ -111,3 +108,3 @@ renderMdCodeStart(into, options);

}
const name = typeInfo.argDef.name;
const { name } = typeInfo.argDef;
text(into, '(');

@@ -126,3 +123,3 @@ text(into, name);

}
const name = typeInfo.enumValue.name;
const { name } = typeInfo.enumValue;
renderType(into, typeInfo, options, typeInfo.inputType);

@@ -164,3 +161,3 @@ text(into, '.');

}
const reason = def.deprecationReason ? def.deprecationReason : null;
const reason = def.deprecationReason || null;
if (!reason) {

@@ -167,0 +164,0 @@ return;

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

}
catch (error) {
catch (_a) {
return null;

@@ -32,0 +32,0 @@ }

@@ -10,5 +10,3 @@ "use strict";

this.peek = () => {
return this._sourceText.charAt(this._pos)
? this._sourceText.charAt(this._pos)
: null;
return this._sourceText.charAt(this._pos) || null;
};

@@ -62,14 +60,13 @@ this.next = () => {

}
if (match != null) {
if (typeof pattern === 'string' ||
if (match != null &&
(typeof pattern === 'string' ||
(match instanceof Array &&
this._sourceText.startsWith(match[0], this._pos))) {
if (consume) {
this._start = this._pos;
if (token && token.length) {
this._pos += token.length;
}
this._sourceText.startsWith(match[0], this._pos)))) {
if (consume) {
this._start = this._pos;
if (token && token.length) {
this._pos += token.length;
}
return match;
}
return match;
}

@@ -76,0 +73,0 @@ return false;

@@ -1,8 +0,8 @@

import { LexRules as LexRulesType, ParseRules as ParseRulesType } from './Rules';
import CharacterStream from './CharacterStream';
import { State } from './types';
import { LexRules, ParseRules } from './Rules';
export declare type ParserOptions = {
eatWhitespace: (stream: CharacterStream) => boolean;
lexRules: Partial<typeof LexRulesType>;
parseRules: typeof ParseRulesType;
lexRules: Partial<typeof LexRules>;
parseRules: typeof ParseRules;
editorConfig: {

@@ -9,0 +9,0 @@ [name: string]: any;

@@ -39,6 +39,4 @@ "use strict";

}
else {
stream.skipToEnd();
return 'string';
}
stream.skipToEnd();
return 'string';
}

@@ -82,7 +80,6 @@ const { lexRules, parseRules, eatWhitespace, editorConfig } = options;

const levels = (state.levels = (state.levels || []).slice(0, -1));
if (state.indentLevel) {
if (levels.length > 0 &&
levels[levels.length - 1] < state.indentLevel) {
state.indentLevel = levels[levels.length - 1];
}
if (state.indentLevel &&
levels.length > 0 &&
levels[levels.length - 1] < state.indentLevel) {
state.indentLevel = levels[levels.length - 1];
}

@@ -167,3 +164,3 @@ }

if (step.separator) {
const separator = step.separator;
const { separator } = step;
state.needsSeparator = !state.needsSeparator;

@@ -170,0 +167,0 @@ if (!state.needsSeparator && separator.ofRule) {

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

if (definition.kind === 'OperationDefinition') {
const variableDefinitions = definition.variableDefinitions;
const { variableDefinitions } = definition;
if (variableDefinitions) {

@@ -17,6 +17,5 @@ variableDefinitions.forEach(({ variable, type }) => {

}
else if (type.kind === graphql_1.Kind.NAMED_TYPE) {
if (type.name.value === 'Float') {
variableToType[variable.name.value] = graphql_1.GraphQLFloat;
}
else if (type.kind === graphql_1.Kind.NAMED_TYPE &&
type.name.value === 'Float') {
variableToType[variable.name.value] = graphql_1.GraphQLFloat;
}

@@ -23,0 +22,0 @@ });

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

}
catch (error) {
catch (_a) {
return [];

@@ -20,0 +20,0 @@ }

@@ -10,8 +10,6 @@ "use strict";

}
else if (this.end.line === position.line) {
if (this.end.line === position.line) {
return this.end.character >= position.character;
}
else {
return this.start.line <= position.line && this.end.line >= position.line;
}
return this.start.line <= position.line && this.end.line >= position.line;
};

@@ -18,0 +16,0 @@ this.start = start;

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

return errors.filter(error => {
if (error.message.indexOf('Unknown directive') !== -1 && error.nodes) {
if (error.message.includes('Unknown directive') && error.nodes) {
const node = error.nodes[0];

@@ -40,0 +40,0 @@ if (node && node.kind === graphql_1.Kind.DIRECTIVE) {

@@ -1,2 +0,2 @@

import { isCompositeType } from 'graphql';
import { isCompositeType, } from 'graphql';
import { SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef, } from 'graphql/type/introspection';

@@ -3,0 +3,0 @@ export function getDefinitionState(tokenState) {

@@ -1,4 +0,3 @@

import { isInterfaceType, GraphQLInterfaceType, GraphQLObjectType, Kind, DirectiveLocation, isListType, isNonNullType, isScalarType, isObjectType, isUnionType, isEnumType, isInputObjectType, isOutputType, } from 'graphql';
import { isInterfaceType, GraphQLInterfaceType, GraphQLObjectType, Kind, DirectiveLocation, isListType, isNonNullType, isScalarType, isObjectType, isUnionType, isEnumType, isInputObjectType, isOutputType, GraphQLBoolean, GraphQLEnumType, GraphQLInputObjectType, GraphQLList, SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef, assertAbstractType, doTypesOverlap, getNamedType, getNullableType, isAbstractType, isCompositeType, isInputType, visit, BREAK, parse, } from 'graphql';
import { CompletionItemKind, InsertTextFormat, } from '../types';
import { GraphQLBoolean, GraphQLEnumType, GraphQLInputObjectType, GraphQLList, SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef, assertAbstractType, doTypesOverlap, getNamedType, getNullableType, isAbstractType, isCompositeType, isInputType, visit, BREAK, parse, } from 'graphql';
import { CharacterStream, onlineParser, RuleKinds, } from '../parser';

@@ -76,4 +75,3 @@ import { forEachState, getDefinitionState, getFieldDef, hintList, objectValues, } from './autocompleteUtils';

}
const kind = state.kind;
const step = state.step;
const { kind, step } = state;
const typeInfo = getTypeInfo(schema, token.state);

@@ -153,3 +151,3 @@ if (kind === RuleKinds.DOCUMENT) {

(kind === RuleKinds.ARGUMENT && step === 0)) {
const argDefs = typeInfo.argDefs;
const { argDefs } = typeInfo;
if (argDefs) {

@@ -170,20 +168,19 @@ return hintList(token, argDefs.map((argDef) => {

}
if (kind === RuleKinds.OBJECT_VALUE ||
(kind === RuleKinds.OBJECT_FIELD && step === 0)) {
if (typeInfo.objectFieldDefs) {
const objectFields = objectValues(typeInfo.objectFieldDefs);
const completionKind = kind === RuleKinds.OBJECT_VALUE
? CompletionItemKind.Value
: CompletionItemKind.Field;
return hintList(token, objectFields.map(field => {
var _a;
return ({
label: field.name,
detail: String(field.type),
documentation: (_a = field.description) !== null && _a !== void 0 ? _a : undefined,
kind: completionKind,
type: field.type,
});
}));
}
if ((kind === RuleKinds.OBJECT_VALUE ||
(kind === RuleKinds.OBJECT_FIELD && step === 0)) &&
typeInfo.objectFieldDefs) {
const objectFields = objectValues(typeInfo.objectFieldDefs);
const completionKind = kind === RuleKinds.OBJECT_VALUE
? CompletionItemKind.Value
: CompletionItemKind.Field;
return hintList(token, objectFields.map(field => {
var _a;
return ({
label: field.name,
detail: String(field.type),
documentation: (_a = field.description) !== null && _a !== void 0 ? _a : undefined,
kind: completionKind,
type: field.type,
});
}));
}

@@ -250,3 +247,3 @@ if (kind === RuleKinds.ENUM_VALUE ||

const getInsertText = (field) => {
const type = field.type;
const { type } = field;
if (isCompositeType(type)) {

@@ -301,3 +298,3 @@ return insertSuffix;

if (typeInfo.parentType) {
const parentType = typeInfo.parentType;
const { parentType } = typeInfo;
let fields = [];

@@ -326,7 +323,9 @@ if ('getFields' in parentType) {

};
const insertText = getInsertText(field);
if (insertText) {
suggestion.insertText = field.name + insertText;
suggestion.insertTextFormat = InsertTextFormat.Snippet;
suggestion.command = SuggestionCommand;
if (options === null || options === void 0 ? void 0 : options.fillLeafsOnComplete) {
const insertText = getInsertText(field);
if (insertText) {
suggestion.insertText = field.name + insertText;
suggestion.insertTextFormat = InsertTextFormat.Snippet;
suggestion.command = SuggestionCommand;
}
}

@@ -359,3 +358,3 @@ return suggestion;

}
else if (namedInputType === GraphQLBoolean) {
if (namedInputType === GraphQLBoolean) {
return hintList(token, queryVariables.concat([

@@ -530,14 +529,12 @@ {

}
if (variableName && variableType) {
if (!definitions[variableName]) {
definitions[variableName] = {
detail: variableType.toString(),
insertText: token.string === '$' ? variableName : '$' + variableName,
label: variableName,
type: variableType,
kind: CompletionItemKind.Variable,
};
variableName = null;
variableType = null;
}
if (variableName && variableType && !definitions[variableName]) {
definitions[variableName] = {
detail: variableType.toString(),
insertText: token.string === '$' ? variableName : '$' + variableName,
label: variableName,
type: variableType,
kind: CompletionItemKind.Variable,
};
variableName = null;
variableType = null;
}

@@ -603,9 +600,8 @@ });

const token = runOnlineParser(queryText, (stream, state, style, index) => {
if (index === cursor.line) {
if (stream.getCurrentPosition() >= cursor.character) {
styleAtCursor = style;
stateAtCursor = Object.assign({}, state);
stringAtCursor = stream.current();
return 'BREAK';
}
if (index === cursor.line &&
stream.getCurrentPosition() >= cursor.character) {
styleAtCursor = style;
stateAtCursor = Object.assign({}, state);
stringAtCursor = stream.current();
return 'BREAK';
}

@@ -654,38 +650,38 @@ });

}
const kind = state.kind;
const locations = directive.locations;
const { kind } = state;
const { locations } = directive;
switch (kind) {
case RuleKinds.QUERY:
return locations.indexOf(DirectiveLocation.QUERY) !== -1;
return locations.includes(DirectiveLocation.QUERY);
case RuleKinds.MUTATION:
return locations.indexOf(DirectiveLocation.MUTATION) !== -1;
return locations.includes(DirectiveLocation.MUTATION);
case RuleKinds.SUBSCRIPTION:
return locations.indexOf(DirectiveLocation.SUBSCRIPTION) !== -1;
return locations.includes(DirectiveLocation.SUBSCRIPTION);
case RuleKinds.FIELD:
case RuleKinds.ALIASED_FIELD:
return locations.indexOf(DirectiveLocation.FIELD) !== -1;
return locations.includes(DirectiveLocation.FIELD);
case RuleKinds.FRAGMENT_DEFINITION:
return locations.indexOf(DirectiveLocation.FRAGMENT_DEFINITION) !== -1;
return locations.includes(DirectiveLocation.FRAGMENT_DEFINITION);
case RuleKinds.FRAGMENT_SPREAD:
return locations.indexOf(DirectiveLocation.FRAGMENT_SPREAD) !== -1;
return locations.includes(DirectiveLocation.FRAGMENT_SPREAD);
case RuleKinds.INLINE_FRAGMENT:
return locations.indexOf(DirectiveLocation.INLINE_FRAGMENT) !== -1;
return locations.includes(DirectiveLocation.INLINE_FRAGMENT);
case RuleKinds.SCHEMA_DEF:
return locations.indexOf(DirectiveLocation.SCHEMA) !== -1;
return locations.includes(DirectiveLocation.SCHEMA);
case RuleKinds.SCALAR_DEF:
return locations.indexOf(DirectiveLocation.SCALAR) !== -1;
return locations.includes(DirectiveLocation.SCALAR);
case RuleKinds.OBJECT_TYPE_DEF:
return locations.indexOf(DirectiveLocation.OBJECT) !== -1;
return locations.includes(DirectiveLocation.OBJECT);
case RuleKinds.FIELD_DEF:
return locations.indexOf(DirectiveLocation.FIELD_DEFINITION) !== -1;
return locations.includes(DirectiveLocation.FIELD_DEFINITION);
case RuleKinds.INTERFACE_DEF:
return locations.indexOf(DirectiveLocation.INTERFACE) !== -1;
return locations.includes(DirectiveLocation.INTERFACE);
case RuleKinds.UNION_DEF:
return locations.indexOf(DirectiveLocation.UNION) !== -1;
return locations.includes(DirectiveLocation.UNION);
case RuleKinds.ENUM_DEF:
return locations.indexOf(DirectiveLocation.ENUM) !== -1;
return locations.includes(DirectiveLocation.ENUM);
case RuleKinds.ENUM_VALUE:
return locations.indexOf(DirectiveLocation.ENUM_VALUE) !== -1;
return locations.includes(DirectiveLocation.ENUM_VALUE);
case RuleKinds.INPUT_DEF:
return locations.indexOf(DirectiveLocation.INPUT_OBJECT) !== -1;
return locations.includes(DirectiveLocation.INPUT_OBJECT);
case RuleKinds.INPUT_VALUE_DEF:

@@ -695,5 +691,5 @@ const prevStateKind = (_a = state.prevState) === null || _a === void 0 ? void 0 : _a.kind;

case RuleKinds.ARGUMENTS_DEF:
return (locations.indexOf(DirectiveLocation.ARGUMENT_DEFINITION) !== -1);
return locations.includes(DirectiveLocation.ARGUMENT_DEFINITION);
case RuleKinds.INPUT_DEF:
return (locations.indexOf(DirectiveLocation.INPUT_FIELD_DEFINITION) !== -1);
return locations.includes(DirectiveLocation.INPUT_FIELD_DEFINITION);
}

@@ -774,6 +770,3 @@ }

case RuleKinds.ARGUMENTS: {
if (!state.prevState) {
argDefs = null;
}
else {
if (state.prevState) {
switch (state.prevState.kind) {

@@ -808,2 +801,5 @@ case RuleKinds.FIELD:

}
else {
argDefs = null;
}
break;

@@ -810,0 +806,0 @@ }

@@ -32,3 +32,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

if (defNodes.length === 0) {
throw Error(`Definition not found for GraphQL type ${name}`);
throw new Error(`Definition not found for GraphQL type ${name}`);
}

@@ -46,3 +46,3 @@ const definitions = defNodes.map(({ filePath, content, definition }) => getDefinitionForNodeDefinition(filePath || '', content, definition));

if (defNodes.length === 0) {
throw Error(`Definition not found for GraphQL type ${typeName}`);
throw new Error(`Definition not found for GraphQL type ${typeName}`);
}

@@ -69,3 +69,3 @@ const definitions = [];

if (defNodes.length === 0) {
throw Error(`Definition not found for GraphQL fragment ${name}`);
throw new Error(`Definition not found for GraphQL fragment ${name}`);
}

@@ -86,5 +86,5 @@ const definitions = defNodes.map(({ filePath, content, definition }) => getDefinitionForFragmentDefinition(filePath || '', content, definition));

function getDefinitionForFragmentDefinition(path, text, definition) {
const name = definition.name;
const { name } = definition;
if (!name) {
throw Error('Expected ASTNode to have a Name.');
throw new Error('Expected ASTNode to have a Name.');
}

@@ -101,3 +101,3 @@ return {

function getDefinitionForNodeDefinition(path, text, definition) {
const name = definition.name;
const { name } = definition;
assert(name, 'Expected ASTNode to have a Name.');

@@ -114,3 +114,3 @@ return {

function getDefinitionForFieldDefinition(path, text, definition) {
const name = definition.name;
const { name } = definition;
assert(name, 'Expected ASTNode to have a Name.');

@@ -117,0 +117,0 @@ return {

@@ -1,3 +0,2 @@

import { GraphQLError, print, validate, NoDeprecatedCustomRule, } from 'graphql';
import { parse } from 'graphql';
import { GraphQLError, print, validate, NoDeprecatedCustomRule, parse, } from 'graphql';
import { CharacterStream, onlineParser } from '../parser';

@@ -61,9 +60,8 @@ import { Range, validateWithCustomRules, Position } from '../utils';

}
const validationErrorAnnotations = mapCat(validateWithCustomRules(schema, ast, customRules, isRelayCompatMode), error => annotations(error, DIAGNOSTIC_SEVERITY.Error, 'Validation'));
const deprecationWarningAnnotations = mapCat(validate(schema, ast, [NoDeprecatedCustomRule]), error => annotations(error, DIAGNOSTIC_SEVERITY.Warning, 'Deprecation'));
const validationErrorAnnotations = validateWithCustomRules(schema, ast, customRules, isRelayCompatMode).flatMap(error => annotations(error, DIAGNOSTIC_SEVERITY.Error, 'Validation'));
const deprecationWarningAnnotations = validate(schema, ast, [
NoDeprecatedCustomRule,
]).flatMap(error => annotations(error, DIAGNOSTIC_SEVERITY.Warning, 'Deprecation'));
return validationErrorAnnotations.concat(deprecationWarningAnnotations);
}
function mapCat(array, mapper) {
return Array.prototype.concat.apply([], array.map(mapper));
}
function annotations(error, severity, type) {

@@ -70,0 +68,0 @@ if (!error.nodes) {

@@ -8,5 +8,4 @@ import { GraphQLNonNull, GraphQLList, } from 'graphql';

}
const state = token.state;
const kind = state.kind;
const step = state.step;
const { state } = token;
const { kind, step } = state;
const typeInfo = getTypeInfo(schema, token.state);

@@ -23,3 +22,3 @@ const options = Object.assign(Object.assign({}, config), { schema });

}
else if (kind === 'Directive' && step === 1 && typeInfo.directiveDef) {
if (kind === 'Directive' && step === 1 && typeInfo.directiveDef) {
const into = [];

@@ -32,3 +31,3 @@ renderMdCodeStart(into, options);

}
else if (kind === 'Argument' && step === 0 && typeInfo.argDef) {
if (kind === 'Argument' && step === 0 && typeInfo.argDef) {
const into = [];

@@ -41,3 +40,3 @@ renderMdCodeStart(into, options);

}
else if (kind === 'EnumValue' &&
if (kind === 'EnumValue' &&
typeInfo.enumValue &&

@@ -52,5 +51,3 @@ 'description' in typeInfo.enumValue) {

}
else if (kind === 'NamedType' &&
typeInfo.type &&
'description' in typeInfo.type) {
if (kind === 'NamedType' && typeInfo.type && 'description' in typeInfo.type) {
const into = [];

@@ -107,3 +104,3 @@ renderMdCodeStart(into, options);

}
const name = typeInfo.argDef.name;
const { name } = typeInfo.argDef;
text(into, '(');

@@ -122,3 +119,3 @@ text(into, name);

}
const name = typeInfo.enumValue.name;
const { name } = typeInfo.enumValue;
renderType(into, typeInfo, options, typeInfo.inputType);

@@ -160,3 +157,3 @@ text(into, '.');

}
const reason = def.deprecationReason ? def.deprecationReason : null;
const reason = def.deprecationReason || null;
if (!reason) {

@@ -163,0 +160,0 @@ return;

@@ -26,3 +26,3 @@ import { Kind, parse, visit, } from 'graphql';

}
catch (error) {
catch (_a) {
return null;

@@ -29,0 +29,0 @@ }

@@ -8,5 +8,3 @@ export default class CharacterStream {

this.peek = () => {
return this._sourceText.charAt(this._pos)
? this._sourceText.charAt(this._pos)
: null;
return this._sourceText.charAt(this._pos) || null;
};

@@ -60,14 +58,13 @@ this.next = () => {

}
if (match != null) {
if (typeof pattern === 'string' ||
if (match != null &&
(typeof pattern === 'string' ||
(match instanceof Array &&
this._sourceText.startsWith(match[0], this._pos))) {
if (consume) {
this._start = this._pos;
if (token && token.length) {
this._pos += token.length;
}
this._sourceText.startsWith(match[0], this._pos)))) {
if (consume) {
this._start = this._pos;
if (token && token.length) {
this._pos += token.length;
}
return match;
}
return match;
}

@@ -74,0 +71,0 @@ return false;

@@ -1,8 +0,8 @@

import { LexRules as LexRulesType, ParseRules as ParseRulesType } from './Rules';
import CharacterStream from './CharacterStream';
import { State } from './types';
import { LexRules, ParseRules } from './Rules';
export declare type ParserOptions = {
eatWhitespace: (stream: CharacterStream) => boolean;
lexRules: Partial<typeof LexRulesType>;
parseRules: typeof ParseRulesType;
lexRules: Partial<typeof LexRules>;
parseRules: typeof ParseRules;
editorConfig: {

@@ -9,0 +9,0 @@ [name: string]: any;

@@ -36,6 +36,4 @@ import { LexRules, ParseRules, isIgnored } from './Rules';

}
else {
stream.skipToEnd();
return 'string';
}
stream.skipToEnd();
return 'string';
}

@@ -79,7 +77,6 @@ const { lexRules, parseRules, eatWhitespace, editorConfig } = options;

const levels = (state.levels = (state.levels || []).slice(0, -1));
if (state.indentLevel) {
if (levels.length > 0 &&
levels[levels.length - 1] < state.indentLevel) {
state.indentLevel = levels[levels.length - 1];
}
if (state.indentLevel &&
levels.length > 0 &&
levels[levels.length - 1] < state.indentLevel) {
state.indentLevel = levels[levels.length - 1];
}

@@ -164,3 +161,3 @@ }

if (step.separator) {
const separator = step.separator;
const { separator } = step;
state.needsSeparator = !state.needsSeparator;

@@ -167,0 +164,0 @@ if (!state.needsSeparator && separator.ofRule) {

@@ -6,3 +6,3 @@ import { typeFromAST, GraphQLFloat, Kind, } from 'graphql';

if (definition.kind === 'OperationDefinition') {
const variableDefinitions = definition.variableDefinitions;
const { variableDefinitions } = definition;
if (variableDefinitions) {

@@ -14,6 +14,5 @@ variableDefinitions.forEach(({ variable, type }) => {

}
else if (type.kind === Kind.NAMED_TYPE) {
if (type.name.value === 'Float') {
variableToType[variable.name.value] = GraphQLFloat;
}
else if (type.kind === Kind.NAMED_TYPE &&
type.name.value === 'Float') {
variableToType[variable.name.value] = GraphQLFloat;
}

@@ -20,0 +19,0 @@ });

@@ -11,3 +11,3 @@ import { parse, visit } from 'graphql';

}
catch (error) {
catch (_a) {
return [];

@@ -14,0 +14,0 @@ }

@@ -7,8 +7,6 @@ export class Range {

}
else if (this.end.line === position.line) {
if (this.end.line === position.line) {
return this.end.character >= position.character;
}
else {
return this.start.line <= position.line && this.end.line >= position.line;
}
return this.start.line <= position.line && this.end.line >= position.line;
};

@@ -15,0 +13,0 @@ this.start = start;

@@ -34,3 +34,3 @@ import { specifiedRules, validate, NoUnusedFragmentsRule, KnownFragmentNamesRule, Kind, ExecutableDefinitionsRule, LoneSchemaDefinitionRule, UniqueOperationTypesRule, UniqueTypeNamesRule, UniqueEnumValueNamesRule, UniqueFieldDefinitionNamesRule, UniqueDirectiveNamesRule, KnownTypeNamesRule, KnownDirectivesRule, UniqueDirectivesPerLocationRule, PossibleTypeExtensionsRule, UniqueArgumentNamesRule, UniqueInputFieldNamesRule, } from 'graphql';

return errors.filter(error => {
if (error.message.indexOf('Unknown directive') !== -1 && error.nodes) {
if (error.message.includes('Unknown directive') && error.nodes) {
const node = error.nodes[0];

@@ -37,0 +37,0 @@ if (node && node.kind === Kind.DIRECTIVE) {

{
"name": "graphql-language-service",
"version": "5.1.0",
"version": "5.1.1",
"description": "The official, runtime independent Language Service for GraphQL",

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

"bugs": {
"url": "https://github.com/graphql/graphiql/issues?q=issue+label:languageservice"
"url": "https://github.com/graphql/graphiql/issues?q=issue+label:graphql-language-service"
},

@@ -18,0 +18,0 @@ "license": "MIT",

# `graphql-language-service`
[Changelog](https://github.com/graphql/graphiql/blob/main/packages/graphql-language-service/CHANGELOG.md) | [API Docs](https://graphiql-test.netlify.app/typedoc/modules/graphql_language_service.html) |
[Discord](https://discord.gg/wkQCKwazxj)
[Changelog](https://github.com/graphql/graphiql/blob/main/packages/graphql-language-service/CHANGELOG.md)
|
[API Docs](https://graphiql-test.netlify.app/typedoc/modules/graphql_language_service.html)
| [Discord](https://discord.gg/wkQCKwazxj)
> **Note**: Still mostly experimental, however it depends mostly on stable libraries.
> **Migration Note**: As of 3.0.0, the LSP Server command line interface has been moved to [`graphql-language-service-cli`](../graphql-language-service-cli)
> **Note**: Still mostly experimental, however it depends mostly on stable
> libraries. **Migration Note**: As of 3.0.0, the LSP Server command line
> interface has been moved to
> [`graphql-language-service-cli`](../graphql-language-service-cli)
## Purpose
This package brings together all the dependencies for building out web or desktop IDE services for the GraphQL Language.
This package brings together all the dependencies for building out web or
desktop IDE services for the GraphQL Language.

@@ -17,9 +22,16 @@ It is named as such to match the convention of other vscode language services.

Language Service Protocol (LSP) methods written in TypeScript used by [`graphql-language-service-server`](https://github.com/graphql/graphiql/tree/main/packages/graphql-language-service-server), [`monaco-graphql`](https://github.com/graphql/graphiql/tree/main/packages/monaco-graphql) and [`codemirror-graphql`](https://github.com/graphql/graphiql/tree/main/packages/codemirror-graphql).
Language Service Protocol (LSP) methods written in TypeScript used by
[`graphql-language-service-server`](https://github.com/graphql/graphiql/tree/main/packages/graphql-language-service-server),
[`monaco-graphql`](https://github.com/graphql/graphiql/tree/main/packages/monaco-graphql)
and
[`codemirror-graphql`](https://github.com/graphql/graphiql/tree/main/packages/codemirror-graphql).
The goal is to provide methods for creating [Language Server Protocol](https://langserver.org) compliant services to be used by an IDE plugin, a browser application or desktop application.
The goal is to provide methods for creating
[Language Server Protocol](https://langserver.org) compliant services to be used
by an IDE plugin, a browser application or desktop application.
## Parser
A standalone online, immutable, dependency-free parser for [GraphQL](http://graphql.org/), used by the LSP interface methods
A standalone online, immutable, dependency-free parser for
[GraphQL](http://graphql.org/), used by the LSP interface methods

@@ -26,0 +38,0 @@ ## Utils

@@ -10,3 +10,6 @@ /**

import { CompletionItem } from 'graphql-language-service';
import {
AutocompleteSuggestionOptions,
CompletionItem,
} from 'graphql-language-service';

@@ -24,36 +27,20 @@ import fs from 'fs';

import {
getAutocompleteSuggestions,
SuggestionCommand,
} from '../getAutocompleteSuggestions';
import { getAutocompleteSuggestions } from '../getAutocompleteSuggestions';
const commonInsert = {
insertTextFormat: 2,
command: SuggestionCommand,
};
const expectedResults = {
droid: {
...commonInsert,
label: 'droid',
detail: 'Droid',
insertText: `droid {\n $1\n}`,
},
hero: {
...commonInsert,
label: 'hero',
detail: 'Character',
insertText: `hero {\n $1\n}`,
},
human: {
...commonInsert,
label: 'human',
detail: 'Human',
insertText: `human {\n $1\n}`,
},
inputTypeTest: {
...commonInsert,
label: 'inputTypeTest',
detail: 'TestType',
insertText: `inputTypeTest {\n $1\n}`,
},

@@ -65,6 +52,4 @@ appearsIn: {

friends: {
...commonInsert,
label: 'friends',
detail: '[Character]',
insertText: `friends {\n $1\n}`,
},

@@ -95,3 +80,3 @@ };

externalFragments?: FragmentDefinitionNode[],
uri?: string,
options?: AutocompleteSuggestionOptions,
): Array<CompletionItem> {

@@ -104,7 +89,5 @@ return getAutocompleteSuggestions(

externalFragments,
{ uri },
options,
)
.filter(
field => !['__schema', '__type'].some(name => name === field.label),
)
.filter(field => !['__schema', '__type'].includes(field.label))
.sort((a, b) => a.label.localeCompare(b.label))

@@ -528,3 +511,3 @@ .map(suggestion => {

expect(
testSuggestions('', new Position(0, 0), [], 'schema.graphqls'),
testSuggestions('', new Position(0, 0), [], { uri: 'schema.graphqls' }),
).toEqual([

@@ -623,8 +606,5 @@ { label: 'extend' },

expect(
testSuggestions(
`type Type {\n aField: s`,
new Position(0, 23),
[],
'schema.graphqls',
),
testSuggestions(`type Type {\n aField: s`, new Position(0, 23), [], {
uri: 'schema.graphqls',
}),
).toEqual([

@@ -639,8 +619,5 @@ { label: 'Episode' },

expect(
testSuggestions(
`type Type {\n aField: []`,
new Position(0, 25),
[],
'schema.graphqls',
),
testSuggestions(`type Type {\n aField: []`, new Position(0, 25), [], {
uri: 'schema.graphqls',
}),
).toEqual([

@@ -662,8 +639,5 @@ { label: 'AnotherInterface' },

expect(
testSuggestions(
`input Type {\n aField: s`,
new Position(0, 23),
[],
'schema.graphqls',
),
testSuggestions(`input Type {\n aField: s`, new Position(0, 23), [], {
uri: 'schema.graphqls',
}),
).toEqual([{ label: 'Episode' }, { label: 'String' }]));

@@ -670,0 +644,0 @@ it('provides correct directive suggestions on args definitions', () =>

@@ -76,3 +76,2 @@ /**

expect(error.message).toEqual(
// eslint-disable-next-line no-useless-escape
'The field Query.deprecatedField is deprecated. Use test instead.',

@@ -110,3 +109,2 @@ );

expect(error.message).toEqual(
// eslint-disable-next-line no-useless-escape
'Syntax Error: Expected ":", found Name "id".',

@@ -113,0 +111,0 @@ );

@@ -10,5 +10,9 @@ /**

import { GraphQLField, GraphQLSchema, GraphQLType } from 'graphql';
import { isCompositeType } from 'graphql';
import {
GraphQLField,
GraphQLSchema,
GraphQLType,
isCompositeType,
} from 'graphql';
import {
SchemaMetaFieldDef,

@@ -15,0 +19,0 @@ TypeMetaFieldDef,

@@ -34,13 +34,2 @@ /**

isOutputType,
} from 'graphql';
import {
CompletionItem,
AllTypeInfo,
IPosition,
CompletionItemKind,
InsertTextFormat,
} from '../types';
import {
GraphQLBoolean,

@@ -66,2 +55,10 @@ GraphQLEnumType,

import {
CompletionItem,
AllTypeInfo,
IPosition,
CompletionItemKind,
InsertTextFormat,
} from '../types';
import {
CharacterStream,

@@ -185,4 +182,3 @@ onlineParser,

const kind = state.kind;
const step = state.step;
const { kind, step } = state;
const typeInfo = getTypeInfo(schema, token.state);

@@ -315,3 +311,3 @@

) {
const argDefs = typeInfo.argDefs;
const { argDefs } = typeInfo;
if (argDefs) {

@@ -337,22 +333,21 @@ return hintList(

if (
kind === RuleKinds.OBJECT_VALUE ||
(kind === RuleKinds.OBJECT_FIELD && step === 0)
(kind === RuleKinds.OBJECT_VALUE ||
(kind === RuleKinds.OBJECT_FIELD && step === 0)) &&
typeInfo.objectFieldDefs
) {
if (typeInfo.objectFieldDefs) {
const objectFields = objectValues(typeInfo.objectFieldDefs);
const completionKind =
kind === RuleKinds.OBJECT_VALUE
? CompletionItemKind.Value
: CompletionItemKind.Field;
return hintList(
token,
objectFields.map(field => ({
label: field.name,
detail: String(field.type),
documentation: field.description ?? undefined,
kind: completionKind,
type: field.type,
})),
);
}
const objectFields = objectValues(typeInfo.objectFieldDefs);
const completionKind =
kind === RuleKinds.OBJECT_VALUE
? CompletionItemKind.Value
: CompletionItemKind.Field;
return hintList(
token,
objectFields.map(field => ({
label: field.name,
detail: String(field.type),
documentation: field.description ?? undefined,
kind: completionKind,
type: field.type,
})),
);
}

@@ -472,3 +467,3 @@

const getInsertText = (field: GraphQLField<null, null>) => {
const type = field.type;
const { type } = field;
if (isCompositeType(type)) {

@@ -531,3 +526,3 @@ return insertSuffix;

if (typeInfo.parentType) {
const parentType = typeInfo.parentType;
const { parentType } = typeInfo;
let fields: GraphQLField<null, null>[] = [];

@@ -562,10 +557,13 @@ if ('getFields' in parentType) {

};
// TODO: fillLeafs capability
const insertText = getInsertText(field);
if (insertText) {
suggestion.insertText = field.name + insertText;
suggestion.insertTextFormat = InsertTextFormat.Snippet;
suggestion.command = SuggestionCommand;
if (options?.fillLeafsOnComplete) {
// TODO: fillLeafs capability
const insertText = getInsertText(field);
if (insertText) {
suggestion.insertText = field.name + insertText;
suggestion.insertTextFormat = InsertTextFormat.Snippet;
suggestion.command = SuggestionCommand;
}
}
return suggestion;

@@ -609,3 +607,4 @@ }),

);
} else if (namedInputType === GraphQLBoolean) {
}
if (namedInputType === GraphQLBoolean) {
return hintList(

@@ -879,17 +878,15 @@ token,

if (variableName && variableType) {
if (!definitions[variableName]) {
// append `$` if the `token.string` is not already `$`
if (variableName && variableType && !definitions[variableName]) {
// append `$` if the `token.string` is not already `$`
definitions[variableName] = {
detail: variableType.toString(),
insertText: token.string === '$' ? variableName : '$' + variableName,
label: variableName, // keep label the same for `codemirror-graphql`
type: variableType,
kind: CompletionItemKind.Variable,
} as CompletionItem;
definitions[variableName] = {
detail: variableType.toString(),
insertText: token.string === '$' ? variableName : '$' + variableName,
label: variableName, // keep label the same for `codemirror-graphql`
type: variableType,
kind: CompletionItemKind.Variable,
} as CompletionItem;
variableName = null;
variableType = null;
}
variableName = null;
variableType = null;
}

@@ -985,9 +982,10 @@ });

const token = runOnlineParser(queryText, (stream, state, style, index) => {
if (index === cursor.line) {
if (stream.getCurrentPosition() >= cursor.character) {
styleAtCursor = style;
stateAtCursor = { ...state };
stringAtCursor = stream.current();
return 'BREAK';
}
if (
index === cursor.line &&
stream.getCurrentPosition() >= cursor.character
) {
styleAtCursor = style;
stateAtCursor = { ...state };
stringAtCursor = stream.current();
return 'BREAK';
}

@@ -1067,40 +1065,40 @@ });

}
const kind = state.kind;
const locations = directive.locations;
const { kind } = state;
const { locations } = directive;
switch (kind) {
case RuleKinds.QUERY:
return locations.indexOf(DirectiveLocation.QUERY) !== -1;
return locations.includes(DirectiveLocation.QUERY);
case RuleKinds.MUTATION:
return locations.indexOf(DirectiveLocation.MUTATION) !== -1;
return locations.includes(DirectiveLocation.MUTATION);
case RuleKinds.SUBSCRIPTION:
return locations.indexOf(DirectiveLocation.SUBSCRIPTION) !== -1;
return locations.includes(DirectiveLocation.SUBSCRIPTION);
case RuleKinds.FIELD:
case RuleKinds.ALIASED_FIELD:
return locations.indexOf(DirectiveLocation.FIELD) !== -1;
return locations.includes(DirectiveLocation.FIELD);
case RuleKinds.FRAGMENT_DEFINITION:
return locations.indexOf(DirectiveLocation.FRAGMENT_DEFINITION) !== -1;
return locations.includes(DirectiveLocation.FRAGMENT_DEFINITION);
case RuleKinds.FRAGMENT_SPREAD:
return locations.indexOf(DirectiveLocation.FRAGMENT_SPREAD) !== -1;
return locations.includes(DirectiveLocation.FRAGMENT_SPREAD);
case RuleKinds.INLINE_FRAGMENT:
return locations.indexOf(DirectiveLocation.INLINE_FRAGMENT) !== -1;
return locations.includes(DirectiveLocation.INLINE_FRAGMENT);
// Schema Definitions
case RuleKinds.SCHEMA_DEF:
return locations.indexOf(DirectiveLocation.SCHEMA) !== -1;
return locations.includes(DirectiveLocation.SCHEMA);
case RuleKinds.SCALAR_DEF:
return locations.indexOf(DirectiveLocation.SCALAR) !== -1;
return locations.includes(DirectiveLocation.SCALAR);
case RuleKinds.OBJECT_TYPE_DEF:
return locations.indexOf(DirectiveLocation.OBJECT) !== -1;
return locations.includes(DirectiveLocation.OBJECT);
case RuleKinds.FIELD_DEF:
return locations.indexOf(DirectiveLocation.FIELD_DEFINITION) !== -1;
return locations.includes(DirectiveLocation.FIELD_DEFINITION);
case RuleKinds.INTERFACE_DEF:
return locations.indexOf(DirectiveLocation.INTERFACE) !== -1;
return locations.includes(DirectiveLocation.INTERFACE);
case RuleKinds.UNION_DEF:
return locations.indexOf(DirectiveLocation.UNION) !== -1;
return locations.includes(DirectiveLocation.UNION);
case RuleKinds.ENUM_DEF:
return locations.indexOf(DirectiveLocation.ENUM) !== -1;
return locations.includes(DirectiveLocation.ENUM);
case RuleKinds.ENUM_VALUE:
return locations.indexOf(DirectiveLocation.ENUM_VALUE) !== -1;
return locations.includes(DirectiveLocation.ENUM_VALUE);
case RuleKinds.INPUT_DEF:
return locations.indexOf(DirectiveLocation.INPUT_OBJECT) !== -1;
return locations.includes(DirectiveLocation.INPUT_OBJECT);
case RuleKinds.INPUT_VALUE_DEF:

@@ -1110,9 +1108,5 @@ const prevStateKind = state.prevState?.kind;

case RuleKinds.ARGUMENTS_DEF:
return (
locations.indexOf(DirectiveLocation.ARGUMENT_DEFINITION) !== -1
);
return locations.includes(DirectiveLocation.ARGUMENT_DEFINITION);
case RuleKinds.INPUT_DEF:
return (
locations.indexOf(DirectiveLocation.INPUT_FIELD_DEFINITION) !== -1
);
return locations.includes(DirectiveLocation.INPUT_FIELD_DEFINITION);
}

@@ -1202,5 +1196,3 @@ }

case RuleKinds.ARGUMENTS: {
if (!state.prevState) {
argDefs = null;
} else {
if (state.prevState) {
switch (state.prevState.kind) {

@@ -1235,2 +1227,4 @@ case RuleKinds.FIELD:

}
} else {
argDefs = null;
}

@@ -1237,0 +1231,0 @@ break;

@@ -62,3 +62,3 @@ /**

if (defNodes.length === 0) {
throw Error(`Definition not found for GraphQL type ${name}`);
throw new Error(`Definition not found for GraphQL type ${name}`);
}

@@ -86,3 +86,3 @@ const definitions: Array<Definition> = defNodes.map(

if (defNodes.length === 0) {
throw Error(`Definition not found for GraphQL type ${typeName}`);
throw new Error(`Definition not found for GraphQL type ${typeName}`);
}

@@ -124,3 +124,3 @@

if (defNodes.length === 0) {
throw Error(`Definition not found for GraphQL fragment ${name}`);
throw new Error(`Definition not found for GraphQL fragment ${name}`);
}

@@ -154,5 +154,5 @@ const definitions: Array<Definition> = defNodes.map(

): Definition {
const name = definition.name;
const { name } = definition;
if (!name) {
throw Error('Expected ASTNode to have a Name.');
throw new Error('Expected ASTNode to have a Name.');
}

@@ -178,3 +178,3 @@

): Definition {
const name = definition.name;
const { name } = definition;
assert(name, 'Expected ASTNode to have a Name.');

@@ -197,3 +197,3 @@ return {

): Definition {
const name = definition.name;
const { name } = definition;
assert(name, 'Expected ASTNode to have a Name.');

@@ -200,0 +200,0 @@ return {

@@ -22,6 +22,5 @@ /**

NoDeprecatedCustomRule,
parse,
} from 'graphql';
import { parse } from 'graphql';
import { CharacterStream, onlineParser } from '../parser';

@@ -117,11 +116,16 @@

const validationErrorAnnotations = mapCat(
validateWithCustomRules(schema, ast, customRules, isRelayCompatMode),
error => annotations(error, DIAGNOSTIC_SEVERITY.Error, 'Validation'),
const validationErrorAnnotations = validateWithCustomRules(
schema,
ast,
customRules,
isRelayCompatMode,
).flatMap(error =>
annotations(error, DIAGNOSTIC_SEVERITY.Error, 'Validation'),
);
// TODO: detect if > graphql@15.2.0, and use the new rule for this.
const deprecationWarningAnnotations = mapCat(
validate(schema, ast, [NoDeprecatedCustomRule]),
error => annotations(error, DIAGNOSTIC_SEVERITY.Warning, 'Deprecation'),
const deprecationWarningAnnotations = validate(schema, ast, [
NoDeprecatedCustomRule,
]).flatMap(error =>
annotations(error, DIAGNOSTIC_SEVERITY.Warning, 'Deprecation'),
);

@@ -131,10 +135,2 @@ return validationErrorAnnotations.concat(deprecationWarningAnnotations);

// General utility for mapping-and-concatenating (aka flat-mapping).
function mapCat<T>(
array: ReadonlyArray<T>,
mapper: (item: T) => Array<any>,
): Array<any> {
return Array.prototype.concat.apply([], array.map(mapper));
}
function annotations(

@@ -141,0 +137,0 @@ error: GraphQLError,

@@ -44,5 +44,4 @@ /**

const state = token.state;
const kind = state.kind;
const step = state.step;
const { state } = token;
const { kind, step } = state;
const typeInfo = getTypeInfo(schema, token.state);

@@ -64,3 +63,4 @@ const options = { ...config, schema };

return into.join('').trim();
} else if (kind === 'Directive' && step === 1 && typeInfo.directiveDef) {
}
if (kind === 'Directive' && step === 1 && typeInfo.directiveDef) {
const into: string[] = [];

@@ -72,3 +72,4 @@ renderMdCodeStart(into, options);

return into.join('').trim();
} else if (kind === 'Argument' && step === 0 && typeInfo.argDef) {
}
if (kind === 'Argument' && step === 0 && typeInfo.argDef) {
const into: string[] = [];

@@ -80,3 +81,4 @@ renderMdCodeStart(into, options);

return into.join('').trim();
} else if (
}
if (
kind === 'EnumValue' &&

@@ -92,7 +94,4 @@ typeInfo.enumValue &&

return into.join('').trim();
} else if (
kind === 'NamedType' &&
typeInfo.type &&
'description' in typeInfo.type
) {
}
if (kind === 'NamedType' && typeInfo.type && 'description' in typeInfo.type) {
const into: string[] = [];

@@ -159,3 +158,3 @@ renderMdCodeStart(into, options);

const name = typeInfo.argDef.name;
const { name } = typeInfo.argDef;
text(into, '(');

@@ -186,3 +185,3 @@ text(into, name);

}
const name = typeInfo.enumValue.name;
const { name } = typeInfo.enumValue;
renderType(into, typeInfo, options, typeInfo.inputType as GraphQLType);

@@ -242,3 +241,3 @@ text(into, '.');

const reason = def.deprecationReason ? def.deprecationReason : null;
const reason = def.deprecationReason || null;
if (!reason) {

@@ -245,0 +244,0 @@ return;

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

ast = parse(documentText);
} catch (error) {
} catch {
return null;

@@ -91,0 +91,0 @@ }

@@ -1,2 +0,1 @@

/* eslint-disable jest/expect-expect, jest/no-export */
import OnlineParser from '../onlineParser';

@@ -136,3 +135,3 @@ import CharacterStream from '../CharacterStream';

);
test(utils, { type, value, kind, valueType }); // eslint-disable-line
test(utils, { type, value, kind, valueType });
});

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

@@ -56,5 +56,3 @@ /**

public peek = (): string | null => {
return this._sourceText.charAt(this._pos)
? this._sourceText.charAt(this._pos)
: null;
return this._sourceText.charAt(this._pos) || null;
};

@@ -124,5 +122,5 @@

if (match != null) {
if (
typeof pattern === 'string' ||
if (
match != null &&
(typeof pattern === 'string' ||
(match instanceof Array &&

@@ -132,13 +130,12 @@ // String.match returns 'index' property, which flow fails to detect

// is just checking if `match.index === 0`
this._sourceText.startsWith(match[0], this._pos))
) {
if (consume) {
this._start = this._pos;
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- otherwise has type issue
if (token && token.length) {
this._pos += token.length;
}
this._sourceText.startsWith(match[0], this._pos)))
) {
if (consume) {
this._start = this._pos;
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- otherwise has type issue
if (token && token.length) {
this._pos += token.length;
}
return match;
}
return match;
}

@@ -145,0 +142,0 @@

@@ -30,6 +30,2 @@ /**

import {
LexRules as LexRulesType,
ParseRules as ParseRulesType,
} from './Rules';
import CharacterStream from './CharacterStream';

@@ -43,4 +39,4 @@ import { State, Token, Rule, RuleKind } from './types';

eatWhitespace: (stream: CharacterStream) => boolean;
lexRules: Partial<typeof LexRulesType>;
parseRules: typeof ParseRulesType;
lexRules: Partial<typeof LexRules>;
parseRules: typeof ParseRules;
editorConfig: { [name: string]: any };

@@ -91,6 +87,5 @@ };

return 'string';
} else {
stream.skipToEnd();
return 'string';
}
stream.skipToEnd();
return 'string';
}

@@ -156,9 +151,8 @@

// what if state.indentLevel === 0?
if (state.indentLevel) {
if (
levels.length > 0 &&
levels[levels.length - 1] < state.indentLevel
) {
state.indentLevel = levels[levels.length - 1];
}
if (
state.indentLevel &&
levels.length > 0 &&
levels[levels.length - 1] < state.indentLevel
) {
state.indentLevel = levels[levels.length - 1];
}

@@ -241,3 +235,3 @@ }

function pushRule(
rules: typeof ParseRulesType,
rules: typeof ParseRules,
state: State,

@@ -282,3 +276,3 @@ ruleKind: RuleKind,

if (step.separator) {
const separator = step.separator;
const { separator } = step;
state.needsSeparator = !state.needsSeparator;

@@ -355,3 +349,3 @@ // If the separator was optional, then give it an opportunity to repeat.

function lex(
lexRules: Partial<typeof LexRulesType>,
lexRules: Partial<typeof LexRules>,
stream: CharacterStream,

@@ -358,0 +352,0 @@ ): Token | null | undefined {

@@ -255,3 +255,2 @@ /**

// eslint-disable-next-line no-redeclare
export type FileChangeTypeKind = {

@@ -300,3 +299,2 @@ Created: 1;

// eslint-disable-next-line no-redeclare
export type CompletionItemKind =

@@ -303,0 +301,0 @@ | 1

@@ -31,3 +31,3 @@ import {

if (definition.kind === 'OperationDefinition') {
const variableDefinitions = definition.variableDefinitions;
const { variableDefinitions } = definition;
if (variableDefinitions) {

@@ -41,7 +41,8 @@ variableDefinitions.forEach(({ variable, type }) => {

variableToType[variable.name.value] = inputType;
} else if (type.kind === Kind.NAMED_TYPE) {
} else if (
type.kind === Kind.NAMED_TYPE &&
// in the experimental stream defer branch we are using, it seems typeFromAST() doesn't recognize Floats?
if (type.name.value === 'Float') {
variableToType[variable.name.value] = GraphQLFloat;
}
type.name.value === 'Float'
) {
variableToType[variable.name.value] = GraphQLFloat;
}

@@ -48,0 +49,0 @@ });

@@ -25,3 +25,3 @@ /**

parsedOperation = parse(operationString);
} catch (error) {
} catch {
return [];

@@ -28,0 +28,0 @@ }

@@ -1,2 +0,1 @@

/* eslint-disable no-redeclare */
/**

@@ -3,0 +2,0 @@ * Copyright (c) 2021 GraphQL Contributors.

@@ -32,7 +32,7 @@ /**

return this.start.character <= position.character;
} else if (this.end.line === position.line) {
}
if (this.end.line === position.line) {
return this.end.character >= position.character;
} else {
return this.start.line <= position.line && this.end.line >= position.line;
}
return this.start.line <= position.line && this.end.line >= position.line;
};

@@ -39,0 +39,0 @@ }

@@ -86,3 +86,3 @@ /**

return errors.filter(error => {
if (error.message.indexOf('Unknown directive') !== -1 && error.nodes) {
if (error.message.includes('Unknown directive') && error.nodes) {
const node = error.nodes[0];

@@ -89,0 +89,0 @@ if (node && node.kind === Kind.DIRECTIVE) {

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

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

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

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

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc