🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

graphql

Package Overview
Dependencies
Maintainers
6
Versions
298
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql - npm Package Compare versions

Comparing version
16.13.2
to
16.14.0
+1
-0
index.d.ts

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

InputObjectTypeExtensionNode,
DirectiveExtensionNode,
SchemaCoordinateNode,

@@ -285,0 +286,0 @@ TypeCoordinateNode,

@@ -138,2 +138,3 @@ import type { Kind } from './kinds';

| InputObjectTypeExtensionNode
| DirectiveExtensionNode
| TypeCoordinateNode

@@ -484,2 +485,3 @@ | MemberCoordinateNode

readonly arguments?: ReadonlyArray<InputValueDefinitionNode>;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
readonly repeatable: boolean;

@@ -491,3 +493,4 @@ readonly locations: ReadonlyArray<NameNode>;

| SchemaExtensionNode
| TypeExtensionNode;
| TypeExtensionNode
| DirectiveExtensionNode;
export interface SchemaExtensionNode {

@@ -550,2 +553,8 @@ readonly kind: Kind.SCHEMA_EXTENSION;

}
export interface DirectiveExtensionNode {
readonly kind: Kind.DIRECTIVE_EXTENSION;
readonly loc?: Location;
readonly name: NameNode;
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
}
/** Schema Coordinates */

@@ -552,0 +561,0 @@ export declare type SchemaCoordinateNode =

@@ -203,4 +203,11 @@ 'use strict';

InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'],
DirectiveDefinition: ['description', 'name', 'arguments', 'locations'],
DirectiveDefinition: [
'description',
'name',
'arguments',
'directives',
'locations',
],
SchemaExtension: ['directives', 'operationTypes'],
DirectiveExtension: ['name', 'directives'],
ScalarTypeExtension: ['name', 'directives'],

@@ -207,0 +214,0 @@ ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'],

@@ -187,4 +187,11 @@ /**

InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'],
DirectiveDefinition: ['description', 'name', 'arguments', 'locations'],
DirectiveDefinition: [
'description',
'name',
'arguments',
'directives',
'locations',
],
SchemaExtension: ['directives', 'operationTypes'],
DirectiveExtension: ['name', 'directives'],
ScalarTypeExtension: ['name', 'directives'],

@@ -191,0 +198,0 @@ ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'],

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

INPUT_FIELD_DEFINITION = 'INPUT_FIELD_DEFINITION',
DIRECTIVE_DEFINITION = 'DIRECTIVE_DEFINITION',
}

@@ -28,0 +29,0 @@ export { DirectiveLocation };

@@ -34,2 +34,3 @@ 'use strict';

DirectiveLocation['INPUT_FIELD_DEFINITION'] = 'INPUT_FIELD_DEFINITION';
DirectiveLocation['DIRECTIVE_DEFINITION'] = 'DIRECTIVE_DEFINITION';
})(DirectiveLocation || (exports.DirectiveLocation = DirectiveLocation = {}));

@@ -36,0 +37,0 @@ /**

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

DirectiveLocation['INPUT_FIELD_DEFINITION'] = 'INPUT_FIELD_DEFINITION';
DirectiveLocation['DIRECTIVE_DEFINITION'] = 'DIRECTIVE_DEFINITION';
})(DirectiveLocation || (DirectiveLocation = {}));

@@ -28,0 +29,0 @@

@@ -89,2 +89,3 @@ export { Source } from './source';

InputObjectTypeExtensionNode,
DirectiveExtensionNode,
SchemaCoordinateNode,

@@ -91,0 +92,0 @@ TypeCoordinateNode,

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

SCHEMA_EXTENSION = 'SchemaExtension',
DIRECTIVE_EXTENSION = 'DirectiveExtension',
/** Type Extensions */

@@ -54,0 +55,0 @@ SCALAR_TYPE_EXTENSION = 'ScalarTypeExtension',

@@ -52,2 +52,3 @@ 'use strict';

Kind['SCHEMA_EXTENSION'] = 'SchemaExtension';
Kind['DIRECTIVE_EXTENSION'] = 'DirectiveExtension';
Kind['SCALAR_TYPE_EXTENSION'] = 'ScalarTypeExtension';

@@ -54,0 +55,0 @@ Kind['OBJECT_TYPE_EXTENSION'] = 'ObjectTypeExtension';

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

Kind['SCHEMA_EXTENSION'] = 'SchemaExtension';
Kind['DIRECTIVE_EXTENSION'] = 'DirectiveExtension';
Kind['SCALAR_TYPE_EXTENSION'] = 'ScalarTypeExtension';

@@ -46,0 +47,0 @@ Kind['OBJECT_TYPE_EXTENSION'] = 'ObjectTypeExtension';

@@ -13,2 +13,3 @@ import type { Maybe } from '../jsutils/Maybe';

DirectiveDefinitionNode,
DirectiveExtensionNode,
DirectiveNode,

@@ -94,2 +95,13 @@ DocumentNode,

/**
* EXPERIMENTAL:
*
* If enabled, the parser will parse directives on directive definitions.
* This syntax is not part of the GraphQL specification and may change.
*
* ```graphql
* directive @foo @bar on FIELD
* ```
*/
experimentalDirectivesOnDirectiveDefinitions?: boolean;
/**
* You may override the Lexer class used to lex the source; this is used by

@@ -452,2 +464,3 @@ * schema coordinates to introduce a lexer with a restricted syntax.

* - InputObjectTypeDefinition
* - DirectiveDefinitionExtension
*/

@@ -500,2 +513,3 @@ parseTypeSystemExtension(): TypeSystemExtensionNode;

parseInputObjectTypeExtension(): InputObjectTypeExtensionNode;
parseDirectiveDefinitionExtension(): DirectiveExtensionNode;
/**

@@ -502,0 +516,0 @@ * ```

@@ -1115,2 +1115,3 @@ 'use strict';

* - InputObjectTypeDefinition
* - DirectiveDefinitionExtension
*/

@@ -1143,2 +1144,9 @@

return this.parseInputObjectTypeExtension();
case 'directive':
if (this._options.experimentalDirectivesOnDirectiveDefinitions) {
return this.parseDirectiveDefinitionExtension();
}
break;
}

@@ -1339,2 +1347,21 @@ }

}
parseDirectiveDefinitionExtension() {
const start = this._lexer.token;
this.expectKeyword('extend');
this.expectKeyword('directive');
this.expectToken(_tokenKind.TokenKind.AT);
const name = this.parseName();
const directives = this.parseConstDirectives();
if (directives.length === 0) {
throw this.unexpected();
}
return this.node(start, {
kind: _kinds.Kind.DIRECTIVE_EXTENSION,
name,
directives,
});
}
/**

@@ -1354,2 +1381,6 @@ * ```

const args = this.parseArgumentDefs();
const directives = this._options
.experimentalDirectivesOnDirectiveDefinitions
? this.parseConstDirectives()
: [];
const repeatable = this.expectOptionalKeyword('repeatable');

@@ -1363,2 +1394,3 @@ this.expectKeyword('on');

arguments: args,
directives,
repeatable,

@@ -1406,2 +1438,3 @@ locations,

* `INPUT_FIELD_DEFINITION`
* `DIRECTIVE_DEFINITION`
*/

@@ -1408,0 +1441,0 @@

@@ -1078,2 +1078,3 @@ import { syntaxError } from '../error/syntaxError.mjs';

* - InputObjectTypeDefinition
* - DirectiveDefinitionExtension
*/

@@ -1106,2 +1107,9 @@

return this.parseInputObjectTypeExtension();
case 'directive':
if (this._options.experimentalDirectivesOnDirectiveDefinitions) {
return this.parseDirectiveDefinitionExtension();
}
break;
}

@@ -1302,2 +1310,21 @@ }

}
parseDirectiveDefinitionExtension() {
const start = this._lexer.token;
this.expectKeyword('extend');
this.expectKeyword('directive');
this.expectToken(TokenKind.AT);
const name = this.parseName();
const directives = this.parseConstDirectives();
if (directives.length === 0) {
throw this.unexpected();
}
return this.node(start, {
kind: Kind.DIRECTIVE_EXTENSION,
name,
directives,
});
}
/**

@@ -1317,2 +1344,6 @@ * ```

const args = this.parseArgumentDefs();
const directives = this._options
.experimentalDirectivesOnDirectiveDefinitions
? this.parseConstDirectives()
: [];
const repeatable = this.expectOptionalKeyword('repeatable');

@@ -1326,2 +1357,3 @@ this.expectKeyword('on');

arguments: args,
directives,
repeatable,

@@ -1366,2 +1398,3 @@ locations,

* `INPUT_FIELD_DEFINITION`
* `DIRECTIVE_DEFINITION`
*/

@@ -1368,0 +1401,0 @@

+3
-1

@@ -97,3 +97,5 @@ 'use strict';

return (
node.kind === _kinds.Kind.SCHEMA_EXTENSION || isTypeExtensionNode(node)
node.kind === _kinds.Kind.SCHEMA_EXTENSION ||
node.kind === _kinds.Kind.DIRECTIVE_EXTENSION ||
isTypeExtensionNode(node)
);

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

@@ -70,3 +70,7 @@ import { Kind } from './kinds.mjs';

export function isTypeSystemExtensionNode(node) {
return node.kind === Kind.SCHEMA_EXTENSION || isTypeExtensionNode(node);
return (
node.kind === Kind.SCHEMA_EXTENSION ||
node.kind === Kind.DIRECTIVE_EXTENSION ||
isTypeExtensionNode(node)
);
}

@@ -73,0 +77,0 @@ export function isTypeExtensionNode(node) {

@@ -243,3 +243,10 @@ 'use strict';

DirectiveDefinition: {
leave: ({ description, name, arguments: args, repeatable, locations }) =>
leave: ({
description,
name,
arguments: args,
directives,
repeatable,
locations,
}) =>
wrap('', description, '\n') +

@@ -251,2 +258,3 @@ 'directive @' +

: wrap('(', join(args, ', '), ')')) +
wrap(' ', join(directives, ' ')) +
(repeatable ? ' repeatable' : '') +

@@ -313,2 +321,6 @@ ' on ' +

},
DirectiveExtension: {
leave: ({ name, directives }) =>
join(['extend directive @' + name, join(directives, ' ')], ' '),
},
// Schema Coordinates

@@ -315,0 +327,0 @@ TypeCoordinate: {

@@ -231,3 +231,10 @@ import { printBlockString } from './blockString.mjs';

DirectiveDefinition: {
leave: ({ description, name, arguments: args, repeatable, locations }) =>
leave: ({
description,
name,
arguments: args,
directives,
repeatable,
locations,
}) =>
wrap('', description, '\n') +

@@ -239,2 +246,3 @@ 'directive @' +

: wrap('(', join(args, ', '), ')')) +
wrap(' ', join(directives, ' ')) +
(repeatable ? ' repeatable' : '') +

@@ -301,2 +309,6 @@ ' on ' +

},
DirectiveExtension: {
leave: ({ name, directives }) =>
join(['extend directive @' + name, join(directives, ' ')], ' '),
},
// Schema Coordinates

@@ -303,0 +315,0 @@ TypeCoordinate: {

{
"name": "graphql",
"version": "16.13.2",
"version": "16.14.0",
"description": "A Query Language and Runtime which can target any service.",

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

import type { Maybe } from '../jsutils/Maybe';
import type { DirectiveDefinitionNode } from '../language/ast';
import type {
DirectiveDefinitionNode,
DirectiveExtensionNode,
} from '../language/ast';
import { DirectiveLocation } from '../language/directiveLocation';

@@ -37,4 +40,6 @@ import type {

isRepeatable: boolean;
deprecationReason: Maybe<string>;
extensions: Readonly<GraphQLDirectiveExtensions>;
astNode: Maybe<DirectiveDefinitionNode>;
extensionASTNodes: ReadonlyArray<DirectiveExtensionNode>;
constructor(config: Readonly<GraphQLDirectiveConfig>);

@@ -52,4 +57,6 @@ get [Symbol.toStringTag](): string;

isRepeatable?: Maybe<boolean>;
deprecationReason?: Maybe<string>;
extensions?: Maybe<Readonly<GraphQLDirectiveExtensions>>;
astNode?: Maybe<DirectiveDefinitionNode>;
extensionASTNodes?: Maybe<ReadonlyArray<DirectiveExtensionNode>>;
}

@@ -60,2 +67,3 @@ interface GraphQLDirectiveNormalizedConfig extends GraphQLDirectiveConfig {

extensions: Readonly<GraphQLDirectiveExtensions>;
extensionASTNodes: ReadonlyArray<DirectiveExtensionNode>;
}

@@ -62,0 +70,0 @@ /**

@@ -69,3 +69,3 @@ 'use strict';

constructor(config) {
var _config$isRepeatable, _config$args;
var _config$isRepeatable, _config$extensionASTN, _config$args;

@@ -80,4 +80,10 @@ this.name = (0, _assertName.assertName)(config.name);

: false;
this.deprecationReason = config.deprecationReason;
this.extensions = (0, _toObjMap.toObjMap)(config.extensions);
this.astNode = config.astNode;
this.extensionASTNodes =
(_config$extensionASTN = config.extensionASTNodes) !== null &&
_config$extensionASTN !== void 0
? _config$extensionASTN
: [];
Array.isArray(config.locations) ||

@@ -111,4 +117,6 @@ (0, _devAssert.devAssert)(

isRepeatable: this.isRepeatable,
deprecationReason: this.deprecationReason,
extensions: this.extensions,
astNode: this.astNode,
extensionASTNodes: this.extensionASTNodes,
};

@@ -187,2 +195,3 @@ }

_directiveLocation.DirectiveLocation.ENUM_VALUE,
_directiveLocation.DirectiveLocation.DIRECTIVE_DEFINITION,
],

@@ -189,0 +198,0 @@ args: {

@@ -46,3 +46,3 @@ import { devAssert } from '../jsutils/devAssert.mjs';

constructor(config) {
var _config$isRepeatable, _config$args;
var _config$isRepeatable, _config$extensionASTN, _config$args;

@@ -57,4 +57,10 @@ this.name = assertName(config.name);

: false;
this.deprecationReason = config.deprecationReason;
this.extensions = toObjMap(config.extensions);
this.astNode = config.astNode;
this.extensionASTNodes =
(_config$extensionASTN = config.extensionASTNodes) !== null &&
_config$extensionASTN !== void 0
? _config$extensionASTN
: [];
Array.isArray(config.locations) ||

@@ -85,4 +91,6 @@ devAssert(false, `@${config.name} locations must be an Array.`);

isRepeatable: this.isRepeatable,
deprecationReason: this.deprecationReason,
extensions: this.extensions,
astNode: this.astNode,
extensionASTNodes: this.extensionASTNodes,
};

@@ -156,2 +164,3 @@ }

DirectiveLocation.ENUM_VALUE,
DirectiveLocation.DIRECTIVE_DEFINITION,
],

@@ -158,0 +167,0 @@ args: {

@@ -79,3 +79,14 @@ 'use strict';

),
resolve: (schema) => schema.getDirectives(),
args: {
includeDeprecated: {
type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean),
defaultValue: false,
},
},
resolve: (schema, { includeDeprecated }) =>
includeDeprecated
? schema.getDirectives()
: schema
.getDirectives()
.filter((directive) => directive.deprecationReason == null),
},

@@ -131,2 +142,10 @@ }),

},
isDeprecated: {
type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean),
resolve: (directive) => directive.deprecationReason != null,
},
deprecationReason: {
type: _scalars.GraphQLString,
resolve: (directive) => directive.deprecationReason,
},
}),

@@ -218,2 +237,6 @@ });

},
DIRECTIVE_DEFINITION: {
value: _directiveLocation.DirectiveLocation.DIRECTIVE_DEFINITION,
description: 'Location adjacent to a directive definition.',
},
},

@@ -220,0 +243,0 @@ });

@@ -61,3 +61,14 @@ import { inspect } from '../jsutils/inspect.mjs';

),
resolve: (schema) => schema.getDirectives(),
args: {
includeDeprecated: {
type: new GraphQLNonNull(GraphQLBoolean),
defaultValue: false,
},
},
resolve: (schema, { includeDeprecated }) =>
includeDeprecated
? schema.getDirectives()
: schema
.getDirectives()
.filter((directive) => directive.deprecationReason == null),
},

@@ -106,2 +117,10 @@ }),

},
isDeprecated: {
type: new GraphQLNonNull(GraphQLBoolean),
resolve: (directive) => directive.deprecationReason != null,
},
deprecationReason: {
type: GraphQLString,
resolve: (directive) => directive.deprecationReason,
},
}),

@@ -190,2 +209,6 @@ });

},
DIRECTIVE_DEFINITION: {
value: DirectiveLocation.DIRECTIVE_DEFINITION,
description: 'Location adjacent to a directive definition.',
},
},

@@ -192,0 +215,0 @@ });

@@ -108,2 +108,6 @@ 'use strict';

: options.allowLegacyFragmentVariables,
experimentalDirectivesOnDirectiveDefinitions:
options === null || options === void 0
? void 0
: options.experimentalDirectivesOnDirectiveDefinitions,
});

@@ -110,0 +114,0 @@ return buildASTSchema(document, {

@@ -90,2 +90,6 @@ import { devAssert } from '../jsutils/devAssert.mjs';

: options.allowLegacyFragmentVariables,
experimentalDirectivesOnDirectiveDefinitions:
options === null || options === void 0
? void 0
: options.experimentalDirectivesOnDirectiveDefinitions,
});

@@ -92,0 +96,0 @@ return buildASTSchema(document, {

@@ -383,2 +383,3 @@ 'use strict';

isRepeatable: directiveIntrospection.isRepeatable,
deprecationReason: directiveIntrospection.deprecationReason,
locations: directiveIntrospection.locations.slice(),

@@ -385,0 +386,0 @@ args: buildInputValueDefMap(directiveIntrospection.args),

@@ -360,2 +360,3 @@ import { devAssert } from '../jsutils/devAssert.mjs';

isRepeatable: directiveIntrospection.isRepeatable,
deprecationReason: directiveIntrospection.deprecationReason,
locations: directiveIntrospection.locations.slice(),

@@ -362,0 +363,0 @@ args: buildInputValueDefMap(directiveIntrospection.args),

@@ -81,3 +81,4 @@ 'use strict';

const typeDefs = [];
const typeExtensionsMap = Object.create(null); // New directives and types are separate because a directives and types can
const typeExtensionsMap = Object.create(null);
const directiveExtensionsMap = Object.create(null); // New directives and types are separate because a directives and types can
// have the same name. For example, a type named "skip".

@@ -105,2 +106,10 @@

directiveDefs.push(def);
} else if (def.kind === _kinds.Kind.DIRECTIVE_EXTENSION) {
const extendedDirectiveName = def.name.value;
const existingDirectiveExtensions =
directiveExtensionsMap[extendedDirectiveName];
directiveExtensionsMap[extendedDirectiveName] =
existingDirectiveExtensions
? existingDirectiveExtensions.concat([def])
: [def];
}

@@ -113,2 +122,3 @@ } // If this document contains no new types, extensions, or directives then

typeDefs.length === 0 &&
Object.keys(directiveExtensionsMap).length === 0 &&
directiveDefs.length === 0 &&

@@ -138,2 +148,8 @@ schemaExtensions.length === 0 &&

const directiveMap = Object.create(null);
for (const existingDirective of schemaConfig.directives) {
directiveMap[existingDirective.name] = extendDirective(existingDirective);
}
const operationTypes = {

@@ -150,2 +166,4 @@ // Get the extended root operation types.

const directives = Object.values(directiveMap); // will be `Array<GraphQLDirective>`
return {

@@ -162,3 +180,3 @@ description:

directives: [
...schemaConfig.directives.map(replaceDirective),
...directives.map(replaceDirective),
...directiveDefs.map(buildDirective),

@@ -422,2 +440,25 @@ ],

function extendDirective(directive) {
var _directiveExtensionsM, _config$deprecationRe;
const config = directive.toConfig();
const extensions =
(_directiveExtensionsM = directiveExtensionsMap[config.name]) !== null &&
_directiveExtensionsM !== void 0
? _directiveExtensionsM
: [];
const deprecationReason =
(_config$deprecationRe = config.deprecationReason) !== null &&
_config$deprecationRe !== void 0
? _config$deprecationRe
: extensions
.map((ext) => getDeprecationReason(ext))
.find((reason) => reason != null);
return new _directives.GraphQLDirective({
...config,
deprecationReason,
extensionASTNodes: config.extensionASTNodes.concat(extensions),
});
}
function getNamedType(node) {

@@ -453,4 +494,16 @@ var _stdTypeMap$name2;

function buildDirective(node) {
var _node$description;
var _directiveExtensionsM2, _getDeprecationReason, _node$description;
const extensions =
(_directiveExtensionsM2 = directiveExtensionsMap[node.name.value]) !==
null && _directiveExtensionsM2 !== void 0
? _directiveExtensionsM2
: [];
const deprecationReason =
(_getDeprecationReason = getDeprecationReason(node)) !== null &&
_getDeprecationReason !== void 0
? _getDeprecationReason
: extensions
.map((ext) => getDeprecationReason(ext))
.find((reason) => reason != null);
return new _directives.GraphQLDirective({

@@ -467,3 +520,5 @@ name: node.name.value,

args: buildArgumentMap(node.arguments),
deprecationReason,
astNode: node,
extensionASTNodes: extensions,
});

@@ -470,0 +525,0 @@ }

@@ -90,3 +90,4 @@ import { devAssert } from '../jsutils/devAssert.mjs';

const typeDefs = [];
const typeExtensionsMap = Object.create(null); // New directives and types are separate because a directives and types can
const typeExtensionsMap = Object.create(null);
const directiveExtensionsMap = Object.create(null); // New directives and types are separate because a directives and types can
// have the same name. For example, a type named "skip".

@@ -114,2 +115,10 @@

directiveDefs.push(def);
} else if (def.kind === Kind.DIRECTIVE_EXTENSION) {
const extendedDirectiveName = def.name.value;
const existingDirectiveExtensions =
directiveExtensionsMap[extendedDirectiveName];
directiveExtensionsMap[extendedDirectiveName] =
existingDirectiveExtensions
? existingDirectiveExtensions.concat([def])
: [def];
}

@@ -122,2 +131,3 @@ } // If this document contains no new types, extensions, or directives then

typeDefs.length === 0 &&
Object.keys(directiveExtensionsMap).length === 0 &&
directiveDefs.length === 0 &&

@@ -147,2 +157,8 @@ schemaExtensions.length === 0 &&

const directiveMap = Object.create(null);
for (const existingDirective of schemaConfig.directives) {
directiveMap[existingDirective.name] = extendDirective(existingDirective);
}
const operationTypes = {

@@ -159,2 +175,4 @@ // Get the extended root operation types.

const directives = Object.values(directiveMap); // will be `Array<GraphQLDirective>`
return {

@@ -171,3 +189,3 @@ description:

directives: [
...schemaConfig.directives.map(replaceDirective),
...directives.map(replaceDirective),
...directiveDefs.map(buildDirective),

@@ -424,2 +442,25 @@ ],

function extendDirective(directive) {
var _directiveExtensionsM, _config$deprecationRe;
const config = directive.toConfig();
const extensions =
(_directiveExtensionsM = directiveExtensionsMap[config.name]) !== null &&
_directiveExtensionsM !== void 0
? _directiveExtensionsM
: [];
const deprecationReason =
(_config$deprecationRe = config.deprecationReason) !== null &&
_config$deprecationRe !== void 0
? _config$deprecationRe
: extensions
.map((ext) => getDeprecationReason(ext))
.find((reason) => reason != null);
return new GraphQLDirective({
...config,
deprecationReason,
extensionASTNodes: config.extensionASTNodes.concat(extensions),
});
}
function getNamedType(node) {

@@ -455,4 +496,16 @@ var _stdTypeMap$name2;

function buildDirective(node) {
var _node$description;
var _directiveExtensionsM2, _getDeprecationReason, _node$description;
const extensions =
(_directiveExtensionsM2 = directiveExtensionsMap[node.name.value]) !==
null && _directiveExtensionsM2 !== void 0
? _directiveExtensionsM2
: [];
const deprecationReason =
(_getDeprecationReason = getDeprecationReason(node)) !== null &&
_getDeprecationReason !== void 0
? _getDeprecationReason
: extensions
.map((ext) => getDeprecationReason(ext))
.find((reason) => reason != null);
return new GraphQLDirective({

@@ -469,3 +522,5 @@ name: node.name.value,

args: buildArgumentMap(node.arguments),
deprecationReason,
astNode: node,
extensionASTNodes: extensions,
});

@@ -472,0 +527,0 @@ }

@@ -30,2 +30,7 @@ import type { Maybe } from '../jsutils/Maybe';

/**
* Whether target GraphQL server supports deprecation of directives.
* Default: false
*/
experimentalDirectiveDeprecation?: boolean;
/**
* Whether target GraphQL server supports `@oneOf` input objects.

@@ -35,2 +40,11 @@ * Default: false

oneOf?: boolean;
/**
* How deep to recurse into nested types, larger values will result in more
* accurate results, but have a higher load on the server.
* Some servers might restrict the maximum query depth or complexity.
* If that's the case, try decreasing this value.
*
* Default: 9
*/
typeDepth?: number;
}

@@ -188,4 +202,6 @@ /**

readonly isRepeatable?: boolean;
readonly isDeprecated?: boolean;
readonly deprecationReason?: Maybe<string>;
readonly locations: ReadonlyArray<DirectiveLocation>;
readonly args: ReadonlyArray<IntrospectionInputValue>;
}

@@ -19,3 +19,5 @@ 'use strict';

inputValueDeprecation: false,
experimentalDirectiveDeprecation: false,
oneOf: false,
typeDepth: 9,
...options,

@@ -38,3 +40,26 @@ };

function experimentalDirectiveDeprecation(str) {
return optionsWithDefault.experimentalDirectiveDeprecation ? str : '';
}
const oneOf = optionsWithDefault.oneOf ? 'isOneOf' : '';
function ofType(level, indent) {
if (level <= 0) {
return '';
}
if (level > 100) {
throw new Error(
'Please set typeDepth to a reasonable value between 0 and 100; the default is 9.',
);
}
return `
${indent}ofType {
${indent} name
${indent} kind${ofType(level - 1, indent + ' ')}
${indent}}`;
}
return `

@@ -50,6 +75,10 @@ query IntrospectionQuery {

}
directives {
directives${experimentalDirectiveDeprecation(
'(includeDeprecated: true)',
)} {
name
${descriptions}
${directiveIsRepeatable}
${experimentalDirectiveDeprecation('isDeprecated')}
${experimentalDirectiveDeprecation('deprecationReason')}
locations

@@ -109,41 +138,5 @@ args${inputDeprecation('(includeDeprecated: true)')} {

kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
}
}
}
}
}
}
}
}
}
name${ofType(optionsWithDefault.typeDepth, ' ')}
}
`;
}

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

inputValueDeprecation: false,
experimentalDirectiveDeprecation: false,
oneOf: false,
typeDepth: 9,
...options,

@@ -31,3 +33,26 @@ };

function experimentalDirectiveDeprecation(str) {
return optionsWithDefault.experimentalDirectiveDeprecation ? str : '';
}
const oneOf = optionsWithDefault.oneOf ? 'isOneOf' : '';
function ofType(level, indent) {
if (level <= 0) {
return '';
}
if (level > 100) {
throw new Error(
'Please set typeDepth to a reasonable value between 0 and 100; the default is 9.',
);
}
return `
${indent}ofType {
${indent} name
${indent} kind${ofType(level - 1, indent + ' ')}
${indent}}`;
}
return `

@@ -43,6 +68,10 @@ query IntrospectionQuery {

}
directives {
directives${experimentalDirectiveDeprecation(
'(includeDeprecated: true)',
)} {
name
${descriptions}
${directiveIsRepeatable}
${experimentalDirectiveDeprecation('isDeprecated')}
${experimentalDirectiveDeprecation('deprecationReason')}
locations

@@ -102,41 +131,5 @@ args${inputDeprecation('(includeDeprecated: true)')} {

kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
}
}
}
}
}
}
}
}
}
name${ofType(optionsWithDefault.typeDepth, ' ')}
}
`;
}

@@ -31,2 +31,3 @@ 'use strict';

inputValueDeprecation: true,
experimentalDirectiveDeprecation: true,
oneOf: true,

@@ -33,0 +34,0 @@ ...options,

@@ -21,2 +21,3 @@ import { invariant } from '../jsutils/invariant.mjs';

inputValueDeprecation: true,
experimentalDirectiveDeprecation: true,
oneOf: true,

@@ -23,0 +24,0 @@ ...options,

@@ -289,2 +289,3 @@ 'use strict';

printArgs(directive.args) +
printDeprecated(directive.deprecationReason) +
(directive.isRepeatable ? ' repeatable' : '') +

@@ -291,0 +292,0 @@ ' on ' +

@@ -265,2 +265,3 @@ import { inspect } from '../jsutils/inspect.mjs';

printArgs(directive.args) +
printDeprecated(directive.deprecationReason) +
(directive.isRepeatable ? ' repeatable' : '') +

@@ -267,0 +268,0 @@ ' on ' +

@@ -48,3 +48,7 @@ 'use strict';

if (variables == null || variables[variableName] === undefined) {
if (
variables == null ||
variables[variableName] === undefined ||
!hasOwnProperty(variables, variableName)
) {
// No valid return value.

@@ -196,4 +200,10 @@ return;

valueNode.kind === _kinds.Kind.VARIABLE &&
(variables == null || variables[valueNode.name.value] === undefined)
(variables == null ||
variables[valueNode.name.value] === undefined ||
!hasOwnProperty(variables, valueNode.name.value))
);
}
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}

@@ -42,3 +42,7 @@ import { inspect } from '../jsutils/inspect.mjs';

if (variables == null || variables[variableName] === undefined) {
if (
variables == null ||
variables[variableName] === undefined ||
!hasOwnProperty(variables, variableName)
) {
// No valid return value.

@@ -183,4 +187,10 @@ return;

valueNode.kind === Kind.VARIABLE &&
(variables == null || variables[valueNode.name.value] === undefined)
(variables == null ||
variables[valueNode.name.value] === undefined ||
!hasOwnProperty(variables, valueNode.name.value))
);
}
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}

@@ -143,2 +143,6 @@ 'use strict';

}
case _kinds.Kind.DIRECTIVE_DEFINITION:
case _kinds.Kind.DIRECTIVE_EXTENSION:
return _directiveLocation.DirectiveLocation.DIRECTIVE_DEFINITION;
// Not reachable, all possible types have been considered.

@@ -145,0 +149,0 @@

@@ -130,2 +130,6 @@ import { inspect } from '../../jsutils/inspect.mjs';

}
case Kind.DIRECTIVE_DEFINITION:
case Kind.DIRECTIVE_EXTENSION:
return DirectiveLocation.DIRECTIVE_DEFINITION;
// Not reachable, all possible types have been considered.

@@ -132,0 +136,0 @@

@@ -45,2 +45,3 @@ 'use strict';

const typeDirectivesMap = Object.create(null);
const directiveDirectivesMap = Object.create(null);
return {

@@ -72,2 +73,13 @@ // Many different AST nodes may contain directives. Rather than listing

}
} else if (
node.kind === _kinds.Kind.DIRECTIVE_DEFINITION ||
node.kind === _kinds.Kind.DIRECTIVE_EXTENSION
) {
const directiveName = node.name.value;
seenDirectives = directiveDirectivesMap[directiveName];
if (seenDirectives === undefined) {
directiveDirectivesMap[directiveName] = seenDirectives =
Object.create(null);
}
} else {

@@ -74,0 +86,0 @@ seenDirectives = Object.create(null);

@@ -38,2 +38,3 @@ import { GraphQLError } from '../../error/GraphQLError.mjs';

const typeDirectivesMap = Object.create(null);
const directiveDirectivesMap = Object.create(null);
return {

@@ -62,2 +63,13 @@ // Many different AST nodes may contain directives. Rather than listing

}
} else if (
node.kind === Kind.DIRECTIVE_DEFINITION ||
node.kind === Kind.DIRECTIVE_EXTENSION
) {
const directiveName = node.name.value;
seenDirectives = directiveDirectivesMap[directiveName];
if (seenDirectives === undefined) {
directiveDirectivesMap[directiveName] = seenDirectives =
Object.create(null);
}
} else {

@@ -64,0 +76,0 @@ seenDirectives = Object.create(null);

@@ -13,3 +13,3 @@ 'use strict';

*/
const version = '16.13.2';
const version = '16.14.0';
/**

@@ -22,6 +22,6 @@ * An object containing the components of the GraphQL.js version string

major: 16,
minor: 13,
patch: 2,
minor: 14,
patch: 0,
preReleaseTag: null,
});
exports.versionInfo = versionInfo;

@@ -7,3 +7,3 @@ // Note: This file is autogenerated using "resources/gen-version.js" script and

*/
export const version = '16.13.2';
export const version = '16.14.0';
/**

@@ -15,5 +15,5 @@ * An object containing the components of the GraphQL.js version string

major: 16,
minor: 13,
patch: 2,
minor: 14,
patch: 0,
preReleaseTag: null,
});