graphql-language-service-interface
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -35,7 +35,7 @@ 'use strict'; | ||
this._graphQLCache = cache; | ||
this._graphQLRC = cache.getGraphQLRC(); | ||
this._graphQLConfig = cache.getGraphQLConfig(); | ||
} | ||
GraphQLLanguageService.prototype.getDiagnostics = function getDiagnostics(query, uri) { | ||
var source, graphQLConfig, schema, customRules, fragmentDefinitions, fragmentDependencies, dependenciesSource, customRulesModulePath, rulesPath; | ||
var source, appName, schema, customRules, fragmentDefinitions, fragmentDependencies, dependenciesSource, customRulesModulePath, rulesPath; | ||
return regeneratorRuntime.async(function getDiagnostics$(_context) { | ||
@@ -46,3 +46,3 @@ while (1) { | ||
source = query; | ||
graphQLConfig = this._graphQLRC.getConfigByFilePath(uri); | ||
appName = this._graphQLConfig.getAppConfigNameByFilePath(uri); | ||
// If there's a matching config, proceed to prepare to run validation | ||
@@ -53,3 +53,3 @@ | ||
if (!(graphQLConfig && graphQLConfig.getSchemaPath())) { | ||
if (!this._graphQLConfig.getSchemaPath(appName)) { | ||
_context.next = 18; | ||
@@ -60,3 +60,3 @@ break; | ||
_context.next = 7; | ||
return regeneratorRuntime.awrap(this._graphQLCache.getSchema(graphQLConfig.getSchemaPath())); | ||
return regeneratorRuntime.awrap(this._graphQLCache.getSchema(this._graphQLConfig.getSchemaPath())); | ||
@@ -66,3 +66,3 @@ case 7: | ||
_context.next = 10; | ||
return regeneratorRuntime.awrap(this._graphQLCache.getFragmentDefinitions(graphQLConfig)); | ||
return regeneratorRuntime.awrap(this._graphQLCache.getFragmentDefinitions(this._graphQLConfig, appName)); | ||
@@ -84,3 +84,3 @@ case 10: | ||
// Check if there are custom validation rules to be used | ||
customRulesModulePath = graphQLConfig.getCustomValidationRulesModulePath(); | ||
customRulesModulePath = this._graphQLConfig.getCustomValidationRulesModulePath(appName); | ||
@@ -91,3 +91,3 @@ if (customRulesModulePath) { | ||
if (rulesPath) { | ||
customRules = require(rulesPath)(graphQLConfig); | ||
customRules = require(rulesPath)(this._graphQLConfig); | ||
} | ||
@@ -108,3 +108,3 @@ } | ||
GraphQLLanguageService.prototype.getAutocompleteSuggestions = function getAutocompleteSuggestions(query, position, filePath) { | ||
var graphQLConfig, schema; | ||
var appName, schema; | ||
return regeneratorRuntime.async(function getAutocompleteSuggestions$(_context2) { | ||
@@ -114,6 +114,6 @@ while (1) { | ||
case 0: | ||
graphQLConfig = this._graphQLRC.getConfigByFilePath(filePath); | ||
appName = this._graphQLConfig.getAppConfigNameByFilePath(filePath); | ||
schema = void 0; | ||
if (!(graphQLConfig && graphQLConfig.getSchemaPath())) { | ||
if (!this._graphQLConfig.getSchemaPath(appName)) { | ||
_context2.next = 7; | ||
@@ -124,3 +124,3 @@ break; | ||
_context2.next = 5; | ||
return regeneratorRuntime.awrap(this._graphQLCache.getSchema(graphQLConfig.getSchemaPath())); | ||
return regeneratorRuntime.awrap(this._graphQLCache.getSchema(this._graphQLConfig.getSchemaPath(appName))); | ||
@@ -143,3 +143,3 @@ case 5: | ||
GraphQLLanguageService.prototype.getDefinition = function getDefinition(query, position, filePath) { | ||
var graphQLConfig, ast, node; | ||
var appName, ast, node; | ||
return regeneratorRuntime.async(function getDefinition$(_context3) { | ||
@@ -149,40 +149,31 @@ while (1) { | ||
case 0: | ||
graphQLConfig = this._graphQLRC.getConfigByFilePath(filePath); | ||
if (graphQLConfig) { | ||
_context3.next = 3; | ||
break; | ||
} | ||
return _context3.abrupt('return', null); | ||
case 3: | ||
appName = this._graphQLConfig.getAppConfigNameByFilePath(filePath); | ||
ast = void 0; | ||
_context3.prev = 4; | ||
_context3.prev = 2; | ||
ast = (0, _graphql.parse)(query); | ||
_context3.next = 11; | ||
_context3.next = 9; | ||
break; | ||
case 8: | ||
_context3.prev = 8; | ||
_context3.t0 = _context3['catch'](4); | ||
case 6: | ||
_context3.prev = 6; | ||
_context3.t0 = _context3['catch'](2); | ||
return _context3.abrupt('return', null); | ||
case 11: | ||
case 9: | ||
node = (0, _graphqlLanguageServiceUtils.getASTNodeAtPosition)(query, ast, position); | ||
_context3.t1 = node ? node.kind : null; | ||
_context3.next = _context3.t1 === _kinds.FRAGMENT_SPREAD ? 15 : _context3.t1 === _kinds.FRAGMENT_DEFINITION ? 16 : _context3.t1 === _kinds.OPERATION_DEFINITION ? 16 : 17; | ||
_context3.next = _context3.t1 === _kinds.FRAGMENT_SPREAD ? 13 : _context3.t1 === _kinds.FRAGMENT_DEFINITION ? 14 : _context3.t1 === _kinds.OPERATION_DEFINITION ? 14 : 15; | ||
break; | ||
case 15: | ||
return _context3.abrupt('return', this._getDefinitionForFragmentSpread(query, ast, node, filePath, graphQLConfig)); | ||
case 13: | ||
return _context3.abrupt('return', this._getDefinitionForFragmentSpread(query, ast, node, filePath, this._graphQLConfig, appName)); | ||
case 16: | ||
case 14: | ||
return _context3.abrupt('return', (0, _getDefinition.getDefinitionQueryResultForDefinitionNode)(filePath, query, node)); | ||
case 17: | ||
case 15: | ||
return _context3.abrupt('return', null); | ||
case 18: | ||
case 16: | ||
case 'end': | ||
@@ -192,6 +183,6 @@ return _context3.stop(); | ||
} | ||
}, null, this, [[4, 8]]); | ||
}, null, this, [[2, 6]]); | ||
}; | ||
GraphQLLanguageService.prototype._getDefinitionForFragmentSpread = function _getDefinitionForFragmentSpread(query, ast, node, filePath, graphQLConfig) { | ||
GraphQLLanguageService.prototype._getDefinitionForFragmentSpread = function _getDefinitionForFragmentSpread(query, ast, node, filePath, graphQLConfig, appName) { | ||
var fragmentDefinitions, dependencies, localFragDefinitions, result; | ||
@@ -203,3 +194,3 @@ return regeneratorRuntime.async(function _getDefinitionForFragmentSpread$(_context4) { | ||
_context4.next = 2; | ||
return regeneratorRuntime.awrap(this._graphQLCache.getFragmentDefinitions(graphQLConfig)); | ||
return regeneratorRuntime.awrap(this._graphQLCache.getFragmentDefinitions(graphQLConfig, appName)); | ||
@@ -206,0 +197,0 @@ case 2: |
{ | ||
"name": "graphql-language-service-interface", | ||
"repository": "https://github.com/graphql/graphql-language-service", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Interface to the GraphQL Language Service", | ||
@@ -36,5 +36,6 @@ "contributors": [ | ||
"graphql": "^0.9.1", | ||
"graphql-language-service-parser": "^0.0.2", | ||
"graphql-language-service-types": "^0.0.7", | ||
"graphql-language-service-utils": "^0.0.2" | ||
"graphql-language-service-config": "^0.0.4", | ||
"graphql-language-service-parser": "^0.0.3", | ||
"graphql-language-service-types": "^0.0.9", | ||
"graphql-language-service-utils": "^0.0.3" | ||
}, | ||
@@ -41,0 +42,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
85030
5
1106
1
+ Addedgraphql-language-service-config@0.0.4(transitive)
+ Addedgraphql-language-service-parser@0.0.3(transitive)
+ Addedgraphql-language-service-types@0.0.9(transitive)
+ Addedgraphql-language-service-utils@0.0.3(transitive)
- Removedgraphql-language-service-parser@0.0.2(transitive)
- Removedgraphql-language-service-types@0.0.7(transitive)
- Removedgraphql-language-service-utils@0.0.2(transitive)