graphql 14.5.4 → 14.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/execution/values.js +1 -3
- package/execution/values.js.flow +1 -3
- package/execution/values.mjs +1 -3
- package/language/lexer.js +6 -0
- package/language/lexer.js.flow +10 -0
- package/language/lexer.mjs +6 -0
- package/language/printLocation.js +1 -1
- package/language/printLocation.js.flow +3 -1
- package/language/printLocation.mjs +1 -1
- package/package.json +1 -1
- package/type/definition.d.ts +1 -0
- package/type/directives.d.ts +1 -3
- package/type/scalars.d.ts +1 -1
- package/utilities/findBreakingChanges.js +22 -1
- package/utilities/findBreakingChanges.js.flow +15 -1
- package/utilities/findBreakingChanges.mjs +21 -1
- package/validation/ValidationContext.js.flow +1 -1
- package/version.js +2 -2
- package/version.js.flow +2 -2
- package/version.mjs +2 -2
package/execution/values.js
CHANGED
|
@@ -86,9 +86,7 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
|
|
|
86
86
|
if (!hasOwnProperty(inputs, varName)) {
|
|
87
87
|
if (varDefNode.defaultValue) {
|
|
88
88
|
coercedValues[varName] = (0, _valueFromAST.valueFromAST)(varDefNode.defaultValue, varType);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if ((0, _definition.isNonNullType)(varType)) {
|
|
89
|
+
} else if ((0, _definition.isNonNullType)(varType)) {
|
|
92
90
|
var _varTypeStr = (0, _inspect.default)(varType);
|
|
93
91
|
|
|
94
92
|
onError(new _GraphQLError.GraphQLError("Variable \"$".concat(varName, "\" of required type \"").concat(_varTypeStr, "\" was not provided."), varDefNode));
|
package/execution/values.js.flow
CHANGED
|
@@ -96,9 +96,7 @@ function coerceVariableValues(
|
|
|
96
96
|
if (!hasOwnProperty(inputs, varName)) {
|
|
97
97
|
if (varDefNode.defaultValue) {
|
|
98
98
|
coercedValues[varName] = valueFromAST(varDefNode.defaultValue, varType);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (isNonNullType(varType)) {
|
|
99
|
+
} else if (isNonNullType(varType)) {
|
|
102
100
|
const varTypeStr = inspect(varType);
|
|
103
101
|
onError(
|
|
104
102
|
new GraphQLError(
|
package/execution/values.mjs
CHANGED
|
@@ -65,9 +65,7 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
|
|
|
65
65
|
if (!hasOwnProperty(inputs, varName)) {
|
|
66
66
|
if (varDefNode.defaultValue) {
|
|
67
67
|
coercedValues[varName] = valueFromAST(varDefNode.defaultValue, varType);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (isNonNullType(varType)) {
|
|
68
|
+
} else if (isNonNullType(varType)) {
|
|
71
69
|
var _varTypeStr = inspect(varType);
|
|
72
70
|
|
|
73
71
|
onError(new GraphQLError("Variable \"$".concat(varName, "\" of required type \"").concat(_varTypeStr, "\" was not provided."), varDefNode));
|
package/language/lexer.js
CHANGED
|
@@ -393,6 +393,12 @@ function readNumber(source, start, firstCode, line, col, prev) {
|
|
|
393
393
|
}
|
|
394
394
|
|
|
395
395
|
position = readDigits(source, position, code);
|
|
396
|
+
code = body.charCodeAt(position);
|
|
397
|
+
} // Numbers cannot be followed by . or e
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
if (code === 46 || code === 69 || code === 101) {
|
|
401
|
+
throw (0, _syntaxError.syntaxError)(source, position, "Invalid number, expected digit but got: ".concat(printCharCode(code), "."));
|
|
396
402
|
}
|
|
397
403
|
|
|
398
404
|
return new Tok(isFloat ? _tokenKind.TokenKind.FLOAT : _tokenKind.TokenKind.INT, start, position, line, col, prev, body.slice(start, position));
|
package/language/lexer.js.flow
CHANGED
|
@@ -444,6 +444,16 @@ function readNumber(source, start, firstCode, line, col, prev): Token {
|
|
|
444
444
|
code = body.charCodeAt(++position);
|
|
445
445
|
}
|
|
446
446
|
position = readDigits(source, position, code);
|
|
447
|
+
code = body.charCodeAt(position);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// Numbers cannot be followed by . or e
|
|
451
|
+
if (code === 46 || code === 69 || code === 101) {
|
|
452
|
+
throw syntaxError(
|
|
453
|
+
source,
|
|
454
|
+
position,
|
|
455
|
+
`Invalid number, expected digit but got: ${printCharCode(code)}.`,
|
|
456
|
+
);
|
|
447
457
|
}
|
|
448
458
|
|
|
449
459
|
return new Tok(
|
package/language/lexer.mjs
CHANGED
|
@@ -379,6 +379,12 @@ function readNumber(source, start, firstCode, line, col, prev) {
|
|
|
379
379
|
}
|
|
380
380
|
|
|
381
381
|
position = readDigits(source, position, code);
|
|
382
|
+
code = body.charCodeAt(position);
|
|
383
|
+
} // Numbers cannot be followed by . or e
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
if (code === 46 || code === 69 || code === 101) {
|
|
387
|
+
throw syntaxError(source, position, "Invalid number, expected digit but got: ".concat(printCharCode(code), "."));
|
|
382
388
|
}
|
|
383
389
|
|
|
384
390
|
return new Tok(isFloat ? TokenKind.FLOAT : TokenKind.INT, start, position, line, col, prev, body.slice(start, position));
|
|
@@ -62,7 +62,7 @@ function printPrefixedLines(lines) {
|
|
|
62
62
|
return existingLines.map(function (_ref3) {
|
|
63
63
|
var prefix = _ref3[0],
|
|
64
64
|
line = _ref3[1];
|
|
65
|
-
return lpad(padLen, prefix) + ' | ' + line;
|
|
65
|
+
return lpad(padLen, prefix) + (line ? ' | ' + line : ' |');
|
|
66
66
|
}).join('\n');
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -72,7 +72,9 @@ function printPrefixedLines(lines: $ReadOnlyArray<[string, string]>): string {
|
|
|
72
72
|
|
|
73
73
|
const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length));
|
|
74
74
|
return existingLines
|
|
75
|
-
.map(
|
|
75
|
+
.map(
|
|
76
|
+
([prefix, line]) => lpad(padLen, prefix) + (line ? ' | ' + line : ' |'),
|
|
77
|
+
)
|
|
76
78
|
.join('\n');
|
|
77
79
|
}
|
|
78
80
|
|
|
@@ -53,7 +53,7 @@ function printPrefixedLines(lines) {
|
|
|
53
53
|
return existingLines.map(function (_ref3) {
|
|
54
54
|
var prefix = _ref3[0],
|
|
55
55
|
line = _ref3[1];
|
|
56
|
-
return lpad(padLen, prefix) + ' | ' + line;
|
|
56
|
+
return lpad(padLen, prefix) + (line ? ' | ' + line : ' |');
|
|
57
57
|
}).join('\n');
|
|
58
58
|
}
|
|
59
59
|
|
package/package.json
CHANGED
package/type/definition.d.ts
CHANGED
package/type/directives.d.ts
CHANGED
|
@@ -67,6 +67,4 @@ export const GraphQLDeprecatedDirective: GraphQLDirective;
|
|
|
67
67
|
*/
|
|
68
68
|
export const specifiedDirectives: ReadonlyArray<GraphQLDirective>;
|
|
69
69
|
|
|
70
|
-
export function isSpecifiedDirective(
|
|
71
|
-
directive: any,
|
|
72
|
-
): directive is GraphQLDirective;
|
|
70
|
+
export function isSpecifiedDirective(directive: any): boolean;
|
package/type/scalars.d.ts
CHANGED
|
@@ -17,12 +17,20 @@ var _invariant = _interopRequireDefault(require("../jsutils/invariant"));
|
|
|
17
17
|
|
|
18
18
|
var _printer = require("../language/printer");
|
|
19
19
|
|
|
20
|
+
var _visitor = require("../language/visitor");
|
|
21
|
+
|
|
20
22
|
var _definition = require("../type/definition");
|
|
21
23
|
|
|
22
24
|
var _astFromValue = require("./astFromValue");
|
|
23
25
|
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
27
|
|
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
29
|
+
|
|
30
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
31
|
+
|
|
32
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
33
|
+
|
|
26
34
|
var BreakingChangeType = Object.freeze({
|
|
27
35
|
TYPE_REMOVED: 'TYPE_REMOVED',
|
|
28
36
|
TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND',
|
|
@@ -342,6 +350,9 @@ function findArgChanges(oldType, oldField, newField) {
|
|
|
342
350
|
description: "".concat(oldType.name, ".").concat(oldField.name, " arg ").concat(_oldArg.name, " defaultValue was removed.")
|
|
343
351
|
});
|
|
344
352
|
} else {
|
|
353
|
+
// Since we looking only for client's observable changes we should
|
|
354
|
+
// compare default values in the same representation as they are
|
|
355
|
+
// represented inside introspection.
|
|
345
356
|
var oldValueStr = stringifyValue(_oldArg.defaultValue, _oldArg.type);
|
|
346
357
|
var newValueStr = stringifyValue(newArg.defaultValue, newArg.type);
|
|
347
358
|
|
|
@@ -447,7 +458,17 @@ function stringifyValue(value, type) {
|
|
|
447
458
|
|
|
448
459
|
/* istanbul ignore next */
|
|
449
460
|
ast != null || (0, _invariant.default)(0);
|
|
450
|
-
|
|
461
|
+
var sortedAST = (0, _visitor.visit)(ast, {
|
|
462
|
+
ObjectValue: function ObjectValue(objectNode) {
|
|
463
|
+
var fields = [].concat(objectNode.fields).sort(function (fieldA, fieldB) {
|
|
464
|
+
return fieldA.name.value.localeCompare(fieldB.name.value);
|
|
465
|
+
});
|
|
466
|
+
return _objectSpread({}, objectNode, {
|
|
467
|
+
fields: fields
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
return (0, _printer.print)(sortedAST);
|
|
451
472
|
}
|
|
452
473
|
|
|
453
474
|
function diff(oldArray, newArray) {
|
|
@@ -7,6 +7,7 @@ import inspect from '../jsutils/inspect';
|
|
|
7
7
|
import invariant from '../jsutils/invariant';
|
|
8
8
|
|
|
9
9
|
import { print } from '../language/printer';
|
|
10
|
+
import { visit } from '../language/visitor';
|
|
10
11
|
|
|
11
12
|
import { type GraphQLSchema } from '../type/schema';
|
|
12
13
|
import {
|
|
@@ -395,6 +396,9 @@ function findArgChanges(
|
|
|
395
396
|
description: `${oldType.name}.${oldField.name} arg ${oldArg.name} defaultValue was removed.`,
|
|
396
397
|
});
|
|
397
398
|
} else {
|
|
399
|
+
// Since we looking only for client's observable changes we should
|
|
400
|
+
// compare default values in the same representation as they are
|
|
401
|
+
// represented inside introspection.
|
|
398
402
|
const oldValueStr = stringifyValue(oldArg.defaultValue, oldArg.type);
|
|
399
403
|
const newValueStr = stringifyValue(newArg.defaultValue, newArg.type);
|
|
400
404
|
|
|
@@ -518,7 +522,17 @@ function typeKindName(type: GraphQLNamedType): string {
|
|
|
518
522
|
function stringifyValue(value: mixed, type: GraphQLInputType): string {
|
|
519
523
|
const ast = astFromValue(value, type);
|
|
520
524
|
invariant(ast != null);
|
|
521
|
-
|
|
525
|
+
|
|
526
|
+
const sortedAST = visit(ast, {
|
|
527
|
+
ObjectValue(objectNode) {
|
|
528
|
+
const fields = [...objectNode.fields].sort((fieldA, fieldB) =>
|
|
529
|
+
fieldA.name.value.localeCompare(fieldB.name.value),
|
|
530
|
+
);
|
|
531
|
+
return { ...objectNode, fields };
|
|
532
|
+
},
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
return print(sortedAST);
|
|
522
536
|
}
|
|
523
537
|
|
|
524
538
|
function diff<T: { name: string, ... }>(
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
4
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
1
7
|
import objectValues from '../polyfills/objectValues';
|
|
2
8
|
import keyMap from '../jsutils/keyMap';
|
|
3
9
|
import inspect from '../jsutils/inspect';
|
|
4
10
|
import invariant from '../jsutils/invariant';
|
|
5
11
|
import { print } from '../language/printer';
|
|
12
|
+
import { visit } from '../language/visitor';
|
|
6
13
|
import { isScalarType, isObjectType, isInterfaceType, isUnionType, isEnumType, isInputObjectType, isNonNullType, isListType, isNamedType, isRequiredArgument, isRequiredInputField } from '../type/definition';
|
|
7
14
|
import { astFromValue } from './astFromValue';
|
|
8
15
|
export var BreakingChangeType = Object.freeze({
|
|
@@ -321,6 +328,9 @@ function findArgChanges(oldType, oldField, newField) {
|
|
|
321
328
|
description: "".concat(oldType.name, ".").concat(oldField.name, " arg ").concat(_oldArg.name, " defaultValue was removed.")
|
|
322
329
|
});
|
|
323
330
|
} else {
|
|
331
|
+
// Since we looking only for client's observable changes we should
|
|
332
|
+
// compare default values in the same representation as they are
|
|
333
|
+
// represented inside introspection.
|
|
324
334
|
var oldValueStr = stringifyValue(_oldArg.defaultValue, _oldArg.type);
|
|
325
335
|
var newValueStr = stringifyValue(newArg.defaultValue, newArg.type);
|
|
326
336
|
|
|
@@ -426,7 +436,17 @@ function stringifyValue(value, type) {
|
|
|
426
436
|
|
|
427
437
|
/* istanbul ignore next */
|
|
428
438
|
ast != null || invariant(0);
|
|
429
|
-
|
|
439
|
+
var sortedAST = visit(ast, {
|
|
440
|
+
ObjectValue: function ObjectValue(objectNode) {
|
|
441
|
+
var fields = [].concat(objectNode.fields).sort(function (fieldA, fieldB) {
|
|
442
|
+
return fieldA.name.value.localeCompare(fieldB.name.value);
|
|
443
|
+
});
|
|
444
|
+
return _objectSpread({}, objectNode, {
|
|
445
|
+
fields: fields
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
return print(sortedAST);
|
|
430
450
|
}
|
|
431
451
|
|
|
432
452
|
function diff(oldArray, newArray) {
|
|
@@ -149,7 +149,7 @@ export class SDLValidationContext extends ASTValidationContext {
|
|
|
149
149
|
constructor(
|
|
150
150
|
ast: DocumentNode,
|
|
151
151
|
schema: ?GraphQLSchema,
|
|
152
|
-
onError
|
|
152
|
+
onError?: (err: GraphQLError) => void,
|
|
153
153
|
): void {
|
|
154
154
|
super(ast, onError);
|
|
155
155
|
this._schema = schema;
|
package/version.js
CHANGED
|
@@ -13,7 +13,7 @@ exports.versionInfo = exports.version = void 0;
|
|
|
13
13
|
/**
|
|
14
14
|
* A string containing the version of the GraphQL.js library
|
|
15
15
|
*/
|
|
16
|
-
var version = '14.5.
|
|
16
|
+
var version = '14.5.8';
|
|
17
17
|
/**
|
|
18
18
|
* An object containing the components of the GraphQL.js version string
|
|
19
19
|
*/
|
|
@@ -22,7 +22,7 @@ exports.version = version;
|
|
|
22
22
|
var versionInfo = Object.freeze({
|
|
23
23
|
major: 14,
|
|
24
24
|
minor: 5,
|
|
25
|
-
patch:
|
|
25
|
+
patch: 8,
|
|
26
26
|
preReleaseTag: null
|
|
27
27
|
});
|
|
28
28
|
exports.versionInfo = versionInfo;
|
package/version.js.flow
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* A string containing the version of the GraphQL.js library
|
|
10
10
|
*/
|
|
11
|
-
export const version = '14.5.
|
|
11
|
+
export const version = '14.5.8';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* An object containing the components of the GraphQL.js version string
|
|
@@ -16,6 +16,6 @@ export const version = '14.5.4';
|
|
|
16
16
|
export const versionInfo = Object.freeze({
|
|
17
17
|
major: 14,
|
|
18
18
|
minor: 5,
|
|
19
|
-
patch:
|
|
19
|
+
patch: 8,
|
|
20
20
|
preReleaseTag: null,
|
|
21
21
|
});
|
package/version.mjs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* A string containing the version of the GraphQL.js library
|
|
8
8
|
*/
|
|
9
|
-
export var version = '14.5.
|
|
9
|
+
export var version = '14.5.8';
|
|
10
10
|
/**
|
|
11
11
|
* An object containing the components of the GraphQL.js version string
|
|
12
12
|
*/
|
|
@@ -14,6 +14,6 @@ export var version = '14.5.4';
|
|
|
14
14
|
export var versionInfo = Object.freeze({
|
|
15
15
|
major: 14,
|
|
16
16
|
minor: 5,
|
|
17
|
-
patch:
|
|
17
|
+
patch: 8,
|
|
18
18
|
preReleaseTag: null
|
|
19
19
|
});
|