Socket
Socket
Sign inDemoInstall

graphql

Package Overview
Dependencies
Maintainers
7
Versions
259
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.5.0 to 16.6.0

4

execution/subscribe.d.ts

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

export declare function createSourceEventStream(
args: ExecutionArgs,
): Promise<AsyncIterable<unknown> | ExecutionResult>;
/** @deprecated will be removed in next major version in favor of named arguments */
export declare function createSourceEventStream(
schema: GraphQLSchema,

@@ -61,0 +65,0 @@ document: DocumentNode,

73

execution/subscribe.js

@@ -57,21 +57,3 @@ 'use strict';

);
const {
schema,
document,
rootValue,
contextValue,
variableValues,
operationName,
fieldResolver,
subscribeFieldResolver,
} = args;
const resultOrStream = await createSourceEventStream(
schema,
document,
rootValue,
contextValue,
variableValues,
operationName,
subscribeFieldResolver,
);
const resultOrStream = await createSourceEventStream(args);

@@ -88,11 +70,3 @@ if (!(0, _isAsyncIterable.isAsyncIterable)(resultOrStream)) {

const mapSourceToResponse = (payload) =>
(0, _execute.execute)({
schema,
document,
rootValue: payload,
contextValue,
variableValues,
operationName,
fieldResolver,
}); // Map every source value to a ExecutionResult value as described above.
(0, _execute.execute)({ ...args, rootValue: payload }); // Map every source value to a ExecutionResult value as described above.

@@ -104,2 +78,21 @@ return (0, _mapAsyncIterator.mapAsyncIterator)(

}
function toNormalizedArgs(args) {
const firstArg = args[0];
if (firstArg && 'document' in firstArg) {
return firstArg;
}
return {
schema: firstArg,
// FIXME: when underlying TS bug fixed, see https://github.com/microsoft/TypeScript/issues/31613
document: args[1],
rootValue: args[2],
contextValue: args[3],
variableValues: args[4],
operationName: args[5],
subscribeFieldResolver: args[6],
};
}
/**

@@ -134,25 +127,11 @@ * Implements the "CreateSourceEventStream" algorithm described in the

async function createSourceEventStream(
schema,
document,
rootValue,
contextValue,
variableValues,
operationName,
subscribeFieldResolver,
) {
// If arguments are missing or incorrectly typed, this is an internal
async function createSourceEventStream(...rawArgs) {
const args = toNormalizedArgs(rawArgs);
const { schema, document, variableValues } = args; // If arguments are missing or incorrectly typed, this is an internal
// developer mistake which should throw an early error.
(0, _execute.assertValidExecutionArguments)(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments,
// a "Response" with only errors is returned.
const exeContext = (0, _execute.buildExecutionContext)({
schema,
document,
rootValue,
contextValue,
variableValues,
operationName,
subscribeFieldResolver,
}); // Return early errors if execution context failed.
const exeContext = (0, _execute.buildExecutionContext)(args); // Return early errors if execution context failed.

@@ -159,0 +138,0 @@ if (!('schema' in exeContext)) {

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

}
export declare enum OperationTypeNode {
declare enum OperationTypeNode {
QUERY = 'query',

@@ -188,2 +188,3 @@ MUTATION = 'mutation',

}
export { OperationTypeNode };
export interface VariableDefinitionNode {

@@ -190,0 +191,0 @@ readonly kind: Kind.VARIABLE_DEFINITION;

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

let OperationTypeNode;
var OperationTypeNode;
exports.OperationTypeNode = OperationTypeNode;

@@ -220,0 +220,0 @@

/**
* The set of allowed directive location values.
*/
export declare enum DirectiveLocation {
declare enum DirectiveLocation {
/** Request Definitions */

@@ -27,2 +27,3 @@ QUERY = 'QUERY',

}
export { DirectiveLocation };
/**

@@ -29,0 +30,0 @@ * The enum type representing the directive location values.

@@ -11,9 +11,3 @@ 'use strict';

*/
let DirectiveLocation;
/**
* The enum type representing the directive location values.
*
* @deprecated Please use `DirectiveLocation`. Will be remove in v17.
*/
var DirectiveLocation;
exports.DirectiveLocation = DirectiveLocation;

@@ -42,1 +36,6 @@

})(DirectiveLocation || (exports.DirectiveLocation = DirectiveLocation = {}));
/**
* The enum type representing the directive location values.
*
* @deprecated Please use `DirectiveLocation`. Will be remove in v17.
*/
/**
* The set of allowed kind values for AST nodes.
*/
export declare enum Kind {
declare enum Kind {
/** Name */

@@ -60,2 +60,3 @@ NAME = 'Name',

}
export { Kind };
/**

@@ -62,0 +63,0 @@ * The enum type representing the possible kind values of AST nodes.

@@ -11,9 +11,3 @@ 'use strict';

*/
let Kind;
/**
* The enum type representing the possible kind values of AST nodes.
*
* @deprecated Please use `Kind`. Will be remove in v17.
*/
var Kind;
exports.Kind = Kind;

@@ -66,1 +60,6 @@

})(Kind || (exports.Kind = Kind = {}));
/**
* The enum type representing the possible kind values of AST nodes.
*
* @deprecated Please use `Kind`. Will be remove in v17.
*/

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

/**
* Parser CPU and memory usage is linear to the number of tokens in a document
* however in extreme cases it becomes quadratic due to memory exhaustion.
* Parsing happens before validation so even invalid queries can burn lots of
* CPU time and memory.
* To prevent this you can set a maximum number of tokens allowed within a document.
*/
maxTokens?: number | undefined;
/**
* @deprecated will be removed in the v17.0.0

@@ -91,3 +99,3 @@ *

source: string | Source,
options?: ParseOptions,
options?: ParseOptions | undefined,
): DocumentNode;

@@ -106,3 +114,3 @@ /**

source: string | Source,
options?: ParseOptions,
options?: ParseOptions | undefined,
): ValueNode;

@@ -115,3 +123,3 @@ /**

source: string | Source,
options?: ParseOptions,
options?: ParseOptions | undefined,
): ConstValueNode;

@@ -130,3 +138,3 @@ /**

source: string | Source,
options?: ParseOptions,
options?: ParseOptions | undefined,
): TypeNode;

@@ -145,4 +153,5 @@ /**

export declare class Parser {
protected _options: Maybe<ParseOptions>;
protected _options: ParseOptions;
protected _lexer: Lexer;
protected _tokenCounter: number;
constructor(source: string | Source, options?: ParseOptions);

@@ -560,2 +569,3 @@ /**

delimitedMany<T>(delimiterKind: TokenKind, parseFn: () => T): Array<T>;
advanceLexer(): void;
}

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

class Parser {
constructor(source, options) {
constructor(source, options = {}) {
const sourceObj = (0, _source.isSource)(source)

@@ -102,2 +102,3 @@ ? source

this._options = options;
this._tokenCounter = 0;
}

@@ -437,4 +438,2 @@ /**

parseFragmentDefinition() {
var _this$_options;
const start = this._lexer.token;

@@ -445,7 +444,3 @@ this.expectKeyword('fragment'); // Legacy support for defining variables within fragments changes

if (
((_this$_options = this._options) === null || _this$_options === void 0
? void 0
: _this$_options.allowLegacyFragmentVariables) === true
) {
if (this._options.allowLegacyFragmentVariables === true) {
return this.node(start, {

@@ -511,4 +506,3 @@ kind: _kinds.Kind.FRAGMENT_DEFINITION,

case _tokenKind.TokenKind.INT:
this._lexer.advance();
this.advanceLexer();
return this.node(token, {

@@ -520,4 +514,3 @@ kind: _kinds.Kind.INT,

case _tokenKind.TokenKind.FLOAT:
this._lexer.advance();
this.advanceLexer();
return this.node(token, {

@@ -533,3 +526,3 @@ kind: _kinds.Kind.FLOAT,

case _tokenKind.TokenKind.NAME:
this._lexer.advance();
this.advanceLexer();

@@ -590,5 +583,3 @@ switch (token.value) {

const token = this._lexer.token;
this._lexer.advance();
this.advanceLexer();
return this.node(token, {

@@ -1384,9 +1375,3 @@ kind: _kinds.Kind.STRING,

node(startToken, node) {
var _this$_options2;
if (
((_this$_options2 = this._options) === null || _this$_options2 === void 0
? void 0
: _this$_options2.noLocation) !== true
) {
if (this._options.noLocation !== true) {
node.loc = new _ast.Location(

@@ -1417,4 +1402,3 @@ startToken,

if (token.kind === kind) {
this._lexer.advance();
this.advanceLexer();
return token;

@@ -1438,4 +1422,3 @@ }

if (token.kind === kind) {
this._lexer.advance();
this.advanceLexer();
return true;

@@ -1455,3 +1438,3 @@ }

if (token.kind === _tokenKind.TokenKind.NAME && token.value === value) {
this._lexer.advance();
this.advanceLexer();
} else {

@@ -1474,4 +1457,3 @@ throw (0, _syntaxError.syntaxError)(

if (token.kind === _tokenKind.TokenKind.NAME && token.value === value) {
this._lexer.advance();
this.advanceLexer();
return true;

@@ -1563,2 +1545,20 @@ }

}
advanceLexer() {
const { maxTokens } = this._options;
const token = this._lexer.advance();
if (maxTokens !== undefined && token.kind !== _tokenKind.TokenKind.EOF) {
++this._tokenCounter;
if (this._tokenCounter > maxTokens) {
throw (0, _syntaxError.syntaxError)(
this._lexer.source,
token.start,
`Document contains more that ${maxTokens} tokens. Parsing aborted.`,
);
}
}
}
}

@@ -1565,0 +1565,0 @@ /**

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

*/
export declare enum TokenKind {
declare enum TokenKind {
SOF = '<SOF>',

@@ -30,2 +30,3 @@ EOF = '<EOF>',

}
export { TokenKind };
/**

@@ -32,0 +33,0 @@ * The enum type representing the token kinds values.

@@ -12,9 +12,3 @@ 'use strict';

*/
let TokenKind;
/**
* The enum type representing the token kinds values.
*
* @deprecated Please use `TokenKind`. Will be remove in v17.
*/
var TokenKind;
exports.TokenKind = TokenKind;

@@ -46,1 +40,6 @@

})(TokenKind || (exports.TokenKind = TokenKind = {}));
/**
* The enum type representing the token kinds values.
*
* @deprecated Please use `TokenKind`. Will be remove in v17.
*/
{
"name": "graphql",
"version": "16.5.0",
"version": "16.6.0",
"description": "A Query Language and Runtime which can target any service.",

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

@@ -10,3 +10,3 @@ import type { GraphQLField, GraphQLNamedType } from './definition';

export declare const __EnumValue: GraphQLObjectType;
export declare enum TypeKind {
declare enum TypeKind {
SCALAR = 'SCALAR',

@@ -21,2 +21,3 @@ OBJECT = 'OBJECT',

}
export { TypeKind };
export declare const __TypeKind: GraphQLEnumType;

@@ -23,0 +24,0 @@ /**

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

exports.__EnumValue = __EnumValue;
let TypeKind;
var TypeKind;
exports.TypeKind = TypeKind;

@@ -499,0 +499,0 @@

import type { GraphQLSchema } from '../type/schema';
export declare enum BreakingChangeType {
declare enum BreakingChangeType {
TYPE_REMOVED = 'TYPE_REMOVED',

@@ -20,3 +20,4 @@ TYPE_CHANGED_KIND = 'TYPE_CHANGED_KIND',

}
export declare enum DangerousChangeType {
export { BreakingChangeType };
declare enum DangerousChangeType {
VALUE_ADDED_TO_ENUM = 'VALUE_ADDED_TO_ENUM',

@@ -29,2 +30,3 @@ TYPE_ADDED_TO_UNION = 'TYPE_ADDED_TO_UNION',

}
export { DangerousChangeType };
export interface BreakingChange {

@@ -31,0 +33,0 @@ type: BreakingChangeType;

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

let BreakingChangeType;
var BreakingChangeType;
exports.BreakingChangeType = BreakingChangeType;

@@ -56,3 +56,3 @@

let DangerousChangeType;
var DangerousChangeType;
exports.DangerousChangeType = DangerousChangeType;

@@ -59,0 +59,0 @@

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

*/
const version = '16.5.0';
const version = '16.6.0';
/**

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

major: 16,
minor: 5,
minor: 6,
patch: 0,

@@ -25,0 +25,0 @@ preReleaseTag: null,

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