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

graphql-language-service-utils

Package Overview
Dependencies
Maintainers
13
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 2.6.3 to 2.7.0-canary-1a140c54.0

dist/collectVariables.d.ts

3

dist/index.d.ts
export { getFragmentDependencies, getFragmentDependenciesForAST, } from './fragmentDependencies';
export { getVariablesJSONSchema, JSONSchema6, JSONSchema6TypeName, } from './getVariablesJSONSchema';
export { getASTNodeAtPosition, pointToOffset } from './getASTNodeAtPosition';
export { Position, Range, locToRange, offsetToPosition } from './Range';
export { validateWithCustomRules } from './validateWithCustomRules';
export { collectVariables, VariableToType } from './collectVariables';
export { default as getOperationFacts, getOperationASTFacts, getQueryFacts, OperationFacts, QueryFacts, } from './getOperationFacts';
//# sourceMappingURL=index.d.ts.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateWithCustomRules = exports.offsetToPosition = exports.locToRange = exports.Range = exports.Position = exports.pointToOffset = exports.getASTNodeAtPosition = exports.getFragmentDependenciesForAST = exports.getFragmentDependencies = void 0;
exports.getQueryFacts = exports.getOperationASTFacts = exports.getOperationFacts = exports.collectVariables = exports.validateWithCustomRules = exports.offsetToPosition = exports.locToRange = exports.Range = exports.Position = exports.pointToOffset = exports.getASTNodeAtPosition = exports.getVariablesJSONSchema = exports.getFragmentDependenciesForAST = exports.getFragmentDependencies = void 0;
var fragmentDependencies_1 = require("./fragmentDependencies");
Object.defineProperty(exports, "getFragmentDependencies", { enumerable: true, get: function () { return fragmentDependencies_1.getFragmentDependencies; } });
Object.defineProperty(exports, "getFragmentDependenciesForAST", { enumerable: true, get: function () { return fragmentDependencies_1.getFragmentDependenciesForAST; } });
var getVariablesJSONSchema_1 = require("./getVariablesJSONSchema");
Object.defineProperty(exports, "getVariablesJSONSchema", { enumerable: true, get: function () { return getVariablesJSONSchema_1.getVariablesJSONSchema; } });
var getASTNodeAtPosition_1 = require("./getASTNodeAtPosition");

@@ -17,2 +22,8 @@ Object.defineProperty(exports, "getASTNodeAtPosition", { enumerable: true, get: function () { return getASTNodeAtPosition_1.getASTNodeAtPosition; } });

Object.defineProperty(exports, "validateWithCustomRules", { enumerable: true, get: function () { return validateWithCustomRules_1.validateWithCustomRules; } });
var collectVariables_1 = require("./collectVariables");
Object.defineProperty(exports, "collectVariables", { enumerable: true, get: function () { return collectVariables_1.collectVariables; } });
var getOperationFacts_1 = require("./getOperationFacts");
Object.defineProperty(exports, "getOperationFacts", { enumerable: true, get: function () { return __importDefault(getOperationFacts_1).default; } });
Object.defineProperty(exports, "getOperationASTFacts", { enumerable: true, get: function () { return getOperationFacts_1.getOperationASTFacts; } });
Object.defineProperty(exports, "getQueryFacts", { enumerable: true, get: function () { return getOperationFacts_1.getQueryFacts; } });
//# sourceMappingURL=index.js.map

2

dist/validateWithCustomRules.d.ts
import { ValidationRule, DocumentNode, GraphQLError, GraphQLSchema } from 'graphql';
export declare function validateWithCustomRules(schema: GraphQLSchema, ast: DocumentNode, customRules?: Array<ValidationRule> | null, isRelayCompatMode?: boolean): Array<GraphQLError>;
export declare function validateWithCustomRules(schema: GraphQLSchema, ast: DocumentNode, customRules?: Array<ValidationRule> | null, isRelayCompatMode?: boolean, isSchemaDocument?: boolean): Array<GraphQLError>;
//# sourceMappingURL=validateWithCustomRules.d.ts.map

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

const graphql_1 = require("graphql");
function validateWithCustomRules(schema, ast, customRules, isRelayCompatMode) {
const specifiedSDLRules = [
graphql_1.LoneSchemaDefinitionRule,
graphql_1.UniqueOperationTypesRule,
graphql_1.UniqueTypeNamesRule,
graphql_1.UniqueEnumValueNamesRule,
graphql_1.UniqueFieldDefinitionNamesRule,
graphql_1.UniqueDirectiveNamesRule,
graphql_1.KnownTypeNamesRule,
graphql_1.KnownDirectivesRule,
graphql_1.UniqueDirectivesPerLocationRule,
graphql_1.PossibleTypeExtensionsRule,
graphql_1.UniqueArgumentNamesRule,
graphql_1.UniqueInputFieldNamesRule,
];
function validateWithCustomRules(schema, ast, customRules, isRelayCompatMode, isSchemaDocument) {
const rules = graphql_1.specifiedRules.filter(rule => {

@@ -19,2 +33,5 @@ if (rule === graphql_1.NoUnusedFragmentsRule || rule === graphql_1.ExecutableDefinitionsRule) {

}
if (isSchemaDocument) {
Array.prototype.push.apply(rules, specifiedSDLRules);
}
const errors = graphql_1.validate(schema, ast, rules);

@@ -21,0 +38,0 @@ return errors.filter(error => {

export { getFragmentDependencies, getFragmentDependenciesForAST, } from './fragmentDependencies';
export { getVariablesJSONSchema, JSONSchema6, JSONSchema6TypeName, } from './getVariablesJSONSchema';
export { getASTNodeAtPosition, pointToOffset } from './getASTNodeAtPosition';
export { Position, Range, locToRange, offsetToPosition } from './Range';
export { validateWithCustomRules } from './validateWithCustomRules';
export { collectVariables, VariableToType } from './collectVariables';
export { default as getOperationFacts, getOperationASTFacts, getQueryFacts, OperationFacts, QueryFacts, } from './getOperationFacts';
//# sourceMappingURL=index.d.ts.map
export { getFragmentDependencies, getFragmentDependenciesForAST, } from './fragmentDependencies';
export { getVariablesJSONSchema, } from './getVariablesJSONSchema';
export { getASTNodeAtPosition, pointToOffset } from './getASTNodeAtPosition';
export { Position, Range, locToRange, offsetToPosition } from './Range';
export { validateWithCustomRules } from './validateWithCustomRules';
export { collectVariables } from './collectVariables';
export { default as getOperationFacts, getOperationASTFacts, getQueryFacts, } from './getOperationFacts';
//# sourceMappingURL=index.js.map
import { ValidationRule, DocumentNode, GraphQLError, GraphQLSchema } from 'graphql';
export declare function validateWithCustomRules(schema: GraphQLSchema, ast: DocumentNode, customRules?: Array<ValidationRule> | null, isRelayCompatMode?: boolean): Array<GraphQLError>;
export declare function validateWithCustomRules(schema: GraphQLSchema, ast: DocumentNode, customRules?: Array<ValidationRule> | null, isRelayCompatMode?: boolean, isSchemaDocument?: boolean): Array<GraphQLError>;
//# sourceMappingURL=validateWithCustomRules.d.ts.map

@@ -1,3 +0,17 @@

import { specifiedRules, validate, NoUnusedFragmentsRule, KnownFragmentNamesRule, Kind, ExecutableDefinitionsRule, } from 'graphql';
export function validateWithCustomRules(schema, ast, customRules, isRelayCompatMode) {
import { specifiedRules, validate, NoUnusedFragmentsRule, KnownFragmentNamesRule, Kind, ExecutableDefinitionsRule, LoneSchemaDefinitionRule, UniqueOperationTypesRule, UniqueTypeNamesRule, UniqueEnumValueNamesRule, UniqueFieldDefinitionNamesRule, UniqueDirectiveNamesRule, KnownTypeNamesRule, KnownDirectivesRule, UniqueDirectivesPerLocationRule, PossibleTypeExtensionsRule, UniqueArgumentNamesRule, UniqueInputFieldNamesRule, } from 'graphql';
const specifiedSDLRules = [
LoneSchemaDefinitionRule,
UniqueOperationTypesRule,
UniqueTypeNamesRule,
UniqueEnumValueNamesRule,
UniqueFieldDefinitionNamesRule,
UniqueDirectiveNamesRule,
KnownTypeNamesRule,
KnownDirectivesRule,
UniqueDirectivesPerLocationRule,
PossibleTypeExtensionsRule,
UniqueArgumentNamesRule,
UniqueInputFieldNamesRule,
];
export function validateWithCustomRules(schema, ast, customRules, isRelayCompatMode, isSchemaDocument) {
const rules = specifiedRules.filter(rule => {

@@ -15,2 +29,5 @@ if (rule === NoUnusedFragmentsRule || rule === ExecutableDefinitionsRule) {

}
if (isSchemaDocument) {
Array.prototype.push.apply(rules, specifiedSDLRules);
}
const errors = validate(schema, ast, rules);

@@ -17,0 +34,0 @@ return errors.filter(error => {

{
"name": "graphql-language-service-utils",
"version": "2.6.3",
"version": "2.7.0-canary-1a140c54.0",
"description": "Utilities to support the GraphQL Language Service",

@@ -32,3 +32,4 @@ "contributors": [

"graphql-language-service-types": "^1.8.6",
"nullthrows": "^1.0.0"
"nullthrows": "^1.0.0",
"@types/json-schema": "7.0.9"
},

@@ -35,0 +36,0 @@ "devDependencies": {

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

/**
* Copyright (c) 2021 GraphQL Contributors.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { DocumentNode, FragmentDefinitionNode, parse, visit } from 'graphql';

@@ -2,0 +9,0 @@ import nullthrows from 'nullthrows';

@@ -15,2 +15,8 @@ /**

export {
getVariablesJSONSchema,
JSONSchema6,
JSONSchema6TypeName,
} from './getVariablesJSONSchema';
export { getASTNodeAtPosition, pointToOffset } from './getASTNodeAtPosition';

@@ -21,1 +27,11 @@

export { validateWithCustomRules } from './validateWithCustomRules';
export { collectVariables, VariableToType } from './collectVariables';
export {
default as getOperationFacts,
getOperationASTFacts,
getQueryFacts,
OperationFacts,
QueryFacts,
} from './getOperationFacts';

@@ -21,4 +21,36 @@ /**

ExecutableDefinitionsRule,
// specifiedSDLRules:
LoneSchemaDefinitionRule,
UniqueOperationTypesRule,
UniqueTypeNamesRule,
UniqueEnumValueNamesRule,
UniqueFieldDefinitionNamesRule,
UniqueDirectiveNamesRule,
KnownTypeNamesRule,
KnownDirectivesRule,
UniqueDirectivesPerLocationRule,
PossibleTypeExtensionsRule,
// KnownArgumentNamesOnDirectivesRule,
UniqueArgumentNamesRule,
UniqueInputFieldNamesRule,
// ProvidedRequiredArgumentsOnDirectivesRule,
} from 'graphql';
const specifiedSDLRules = [
LoneSchemaDefinitionRule,
UniqueOperationTypesRule,
UniqueTypeNamesRule,
UniqueEnumValueNamesRule,
UniqueFieldDefinitionNamesRule,
UniqueDirectiveNamesRule,
KnownTypeNamesRule,
KnownDirectivesRule,
UniqueDirectivesPerLocationRule,
PossibleTypeExtensionsRule,
// KnownArgumentNamesOnDirectivesRule,
UniqueArgumentNamesRule,
UniqueInputFieldNamesRule,
// ProvidedRequiredArgumentsOnDirectivesRule,
];
/**

@@ -32,2 +64,3 @@ * Validate a GraphQL Document optionally with custom validation rules.

isRelayCompatMode?: boolean,
isSchemaDocument?: boolean,
): Array<GraphQLError> {

@@ -50,3 +83,5 @@ const rules = specifiedRules.filter(rule => {

}
if (isSchemaDocument) {
Array.prototype.push.apply(rules, specifiedSDLRules);
}
const errors = validate(schema, ast, rules);

@@ -53,0 +88,0 @@ return errors.filter(error => {

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