Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-language-service-interface

Package Overview
Dependencies
Maintainers
3
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-language-service-interface - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

41

dist/getAutocompleteSuggestions.js

@@ -32,4 +32,4 @@ 'use strict';

function getAutocompleteSuggestions(schema, queryText, cursor) {
var token = getTokenAtPosition(queryText, cursor);
function getAutocompleteSuggestions(schema, queryText, cursor, contextToken) {
var token = contextToken || getTokenAtPosition(queryText, cursor);

@@ -252,5 +252,4 @@ var state = token.state.kind === 'Invalid' ? token.state.prevState : token.state;

if (state.prevState && state.prevState.kind) {
var stateKind = state.prevState.kind;
var directives = schema.getDirectives().filter(function (directive) {
return canUseDirective(stateKind, directive);
return canUseDirective(state.prevState, directive);
});

@@ -335,3 +334,7 @@ return (0, _autocompleteUtils.hintList)(token, directives.map(function (directive) {

function canUseDirective(kind, directive) {
function canUseDirective(state, directive) {
if (!state || !state.kind) {
return false;
}
var kind = state.kind;
var locations = directive.locations;

@@ -354,2 +357,30 @@ switch (kind) {

return locations.indexOf('INLINE_FRAGMENT') !== -1;
// Schema Definitions
case 'SchemaDef':
return locations.indexOf('SCHEMA') !== -1;
case 'ScalarDef':
return locations.indexOf('SCALAR') !== -1;
case 'ObjectTypeDef':
return locations.indexOf('OBJECT') !== -1;
case 'FieldDef':
return locations.indexOf('FIELD_DEFINITION') !== -1;
case 'InterfaceDef':
return locations.indexOf('INTERFACE') !== -1;
case 'UnionDef':
return locations.indexOf('UNION') !== -1;
case 'EnumDef':
return locations.indexOf('ENUM') !== -1;
case 'EnumValue':
return locations.indexOf('ENUM_VALUE') !== -1;
case 'InputDef':
return locations.indexOf('INPUT_OBJECT') !== -1;
case 'InputValueDef':
var prevStateKind = state.prevState && state.prevState.kind;
switch (prevStateKind) {
case 'ArgumentsDef':
return locations.indexOf('ARGUMENT_DEFINITION') !== -1;
case 'InputDef':
return locations.indexOf('INPUT_FIELD_DEFINITION') !== -1;
}
}

@@ -356,0 +387,0 @@ return false;

2

package.json
{
"name": "graphql-language-service-interface",
"repository": "https://github.com/graphql/graphql-language-service",
"version": "0.0.2",
"version": "0.0.3",
"description": "Interface to the GraphQL Language Service",

@@ -6,0 +6,0 @@ "contributors": [

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