Skip to content

Commit 9a155b9

Browse files
author
Travis CI
committed
Deploy e6c36e0 to NPM branch
1 parent 98cbdd9 commit 9a155b9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3540
-1123
lines changed

error/printError.js

Lines changed: 59 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,57 @@ function printError(error) {
2424
var printedLocations = [];
2525

2626
if (error.nodes) {
27-
error.nodes.forEach(function (node) {
28-
if (node.loc) {
29-
printedLocations.push(highlightSourceAtLocation(node.loc.source, (0, _location.getLocation)(node.loc.source, node.loc.start)));
27+
var _iteratorNormalCompletion = true;
28+
var _didIteratorError = false;
29+
var _iteratorError = undefined;
30+
31+
try {
32+
for (var _iterator = error.nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
33+
var node = _step.value;
34+
35+
if (node.loc) {
36+
printedLocations.push(highlightSourceAtLocation(node.loc.source, (0, _location.getLocation)(node.loc.source, node.loc.start)));
37+
}
3038
}
31-
});
39+
} catch (err) {
40+
_didIteratorError = true;
41+
_iteratorError = err;
42+
} finally {
43+
try {
44+
if (!_iteratorNormalCompletion && _iterator.return != null) {
45+
_iterator.return();
46+
}
47+
} finally {
48+
if (_didIteratorError) {
49+
throw _iteratorError;
50+
}
51+
}
52+
}
3253
} else if (error.source && error.locations) {
3354
var source = error.source;
34-
error.locations.forEach(function (location) {
35-
printedLocations.push(highlightSourceAtLocation(source, location));
36-
});
55+
var _iteratorNormalCompletion2 = true;
56+
var _didIteratorError2 = false;
57+
var _iteratorError2 = undefined;
58+
59+
try {
60+
for (var _iterator2 = error.locations[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
61+
var location = _step2.value;
62+
printedLocations.push(highlightSourceAtLocation(source, location));
63+
}
64+
} catch (err) {
65+
_didIteratorError2 = true;
66+
_iteratorError2 = err;
67+
} finally {
68+
try {
69+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
70+
_iterator2.return();
71+
}
72+
} finally {
73+
if (_didIteratorError2) {
74+
throw _iteratorError2;
75+
}
76+
}
77+
}
3778
}
3879

3980
return printedLocations.length === 0 ? error.message : [error.message].concat(printedLocations).join('\n\n') + '\n';
@@ -64,27 +105,27 @@ function printPrefixedLines(lines) {
64105
return line !== undefined;
65106
});
66107
var padLen = 0;
67-
var _iteratorNormalCompletion = true;
68-
var _didIteratorError = false;
69-
var _iteratorError = undefined;
108+
var _iteratorNormalCompletion3 = true;
109+
var _didIteratorError3 = false;
110+
var _iteratorError3 = undefined;
70111

71112
try {
72-
for (var _iterator = existingLines[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
73-
var _ref4 = _step.value;
113+
for (var _iterator3 = existingLines[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
114+
var _ref4 = _step3.value;
74115
var prefix = _ref4[0];
75116
padLen = Math.max(padLen, prefix.length);
76117
}
77118
} catch (err) {
78-
_didIteratorError = true;
79-
_iteratorError = err;
119+
_didIteratorError3 = true;
120+
_iteratorError3 = err;
80121
} finally {
81122
try {
82-
if (!_iteratorNormalCompletion && _iterator.return != null) {
83-
_iterator.return();
123+
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
124+
_iterator3.return();
84125
}
85126
} finally {
86-
if (_didIteratorError) {
87-
throw _iteratorError;
127+
if (_didIteratorError3) {
128+
throw _iteratorError3;
88129
}
89130
}
90131
}

error/printError.js.flow

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import type { GraphQLError } from './GraphQLError';
1919
export function printError(error: GraphQLError): string {
2020
const printedLocations = [];
2121
if (error.nodes) {
22-
error.nodes.forEach(node => {
22+
for (const node of error.nodes) {
2323
if (node.loc) {
2424
printedLocations.push(
2525
highlightSourceAtLocation(
@@ -28,12 +28,12 @@ export function printError(error: GraphQLError): string {
2828
),
2929
);
3030
}
31-
});
31+
}
3232
} else if (error.source && error.locations) {
3333
const source = error.source;
34-
error.locations.forEach(location => {
34+
for (const location of error.locations) {
3535
printedLocations.push(highlightSourceAtLocation(source, location));
36-
});
36+
}
3737
}
3838
return printedLocations.length === 0
3939
? error.message

error/printError.mjs

Lines changed: 59 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,57 @@ export function printError(error) {
1616
var printedLocations = [];
1717

1818
if (error.nodes) {
19-
error.nodes.forEach(function (node) {
20-
if (node.loc) {
21-
printedLocations.push(highlightSourceAtLocation(node.loc.source, getLocation(node.loc.source, node.loc.start)));
19+
var _iteratorNormalCompletion = true;
20+
var _didIteratorError = false;
21+
var _iteratorError = undefined;
22+
23+
try {
24+
for (var _iterator = error.nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
25+
var node = _step.value;
26+
27+
if (node.loc) {
28+
printedLocations.push(highlightSourceAtLocation(node.loc.source, getLocation(node.loc.source, node.loc.start)));
29+
}
2230
}
23-
});
31+
} catch (err) {
32+
_didIteratorError = true;
33+
_iteratorError = err;
34+
} finally {
35+
try {
36+
if (!_iteratorNormalCompletion && _iterator.return != null) {
37+
_iterator.return();
38+
}
39+
} finally {
40+
if (_didIteratorError) {
41+
throw _iteratorError;
42+
}
43+
}
44+
}
2445
} else if (error.source && error.locations) {
2546
var source = error.source;
26-
error.locations.forEach(function (location) {
27-
printedLocations.push(highlightSourceAtLocation(source, location));
28-
});
47+
var _iteratorNormalCompletion2 = true;
48+
var _didIteratorError2 = false;
49+
var _iteratorError2 = undefined;
50+
51+
try {
52+
for (var _iterator2 = error.locations[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
53+
var location = _step2.value;
54+
printedLocations.push(highlightSourceAtLocation(source, location));
55+
}
56+
} catch (err) {
57+
_didIteratorError2 = true;
58+
_iteratorError2 = err;
59+
} finally {
60+
try {
61+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
62+
_iterator2.return();
63+
}
64+
} finally {
65+
if (_didIteratorError2) {
66+
throw _iteratorError2;
67+
}
68+
}
69+
}
2970
}
3071

3172
return printedLocations.length === 0 ? error.message : [error.message].concat(printedLocations).join('\n\n') + '\n';
@@ -55,27 +96,27 @@ function printPrefixedLines(lines) {
5596
return line !== undefined;
5697
});
5798
var padLen = 0;
58-
var _iteratorNormalCompletion = true;
59-
var _didIteratorError = false;
60-
var _iteratorError = undefined;
99+
var _iteratorNormalCompletion3 = true;
100+
var _didIteratorError3 = false;
101+
var _iteratorError3 = undefined;
61102

62103
try {
63-
for (var _iterator = existingLines[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
64-
var _ref4 = _step.value;
104+
for (var _iterator3 = existingLines[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
105+
var _ref4 = _step3.value;
65106
var prefix = _ref4[0];
66107
padLen = Math.max(padLen, prefix.length);
67108
}
68109
} catch (err) {
69-
_didIteratorError = true;
70-
_iteratorError = err;
110+
_didIteratorError3 = true;
111+
_iteratorError3 = err;
71112
} finally {
72113
try {
73-
if (!_iteratorNormalCompletion && _iterator.return != null) {
74-
_iterator.return();
114+
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
115+
_iterator3.return();
75116
}
76117
} finally {
77-
if (_didIteratorError) {
78-
throw _iteratorError;
118+
if (_didIteratorError3) {
119+
throw _iteratorError3;
79120
}
80121
}
81122
}

execution/values.js

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function getVariableValues(schema, varDefNodes, inputs) {
5353
var errors = [];
5454
var coercedValues = {};
5555

56-
var _loop = function _loop(i) {
56+
for (var i = 0; i < varDefNodes.length; i++) {
5757
var varDefNode = varDefNodes[i];
5858
var varName = varDefNode.variable.name.value;
5959
var varType = (0, _typeFromAST.typeFromAST)(schema, varDefNode.type);
@@ -86,20 +86,37 @@ function getVariableValues(schema, varDefNodes, inputs) {
8686
var coercionErrors = coerced.errors;
8787

8888
if (coercionErrors) {
89-
coercionErrors.forEach(function (error) {
90-
error.message = "Variable \"$".concat(varName, "\" got invalid ") + "value ".concat((0, _inspect.default)(value), "; ").concat(error.message);
91-
});
89+
var _iteratorNormalCompletion = true;
90+
var _didIteratorError = false;
91+
var _iteratorError = undefined;
92+
93+
try {
94+
for (var _iterator = coercionErrors[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
95+
var error = _step.value;
96+
error.message = "Variable \"$".concat(varName, "\" got invalid ") + "value ".concat((0, _inspect.default)(value), "; ").concat(error.message);
97+
}
98+
} catch (err) {
99+
_didIteratorError = true;
100+
_iteratorError = err;
101+
} finally {
102+
try {
103+
if (!_iteratorNormalCompletion && _iterator.return != null) {
104+
_iterator.return();
105+
}
106+
} finally {
107+
if (_didIteratorError) {
108+
throw _iteratorError;
109+
}
110+
}
111+
}
112+
92113
errors.push.apply(errors, coercionErrors);
93114
} else {
94115
coercedValues[varName] = coerced.value;
95116
}
96117
}
97118
}
98119
}
99-
};
100-
101-
for (var i = 0; i < varDefNodes.length; i++) {
102-
_loop(i);
103120
}
104121

105122
return errors.length === 0 ? {

execution/values.js.flow

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ export function getVariableValues(
9696
const coerced = coerceValue(value, varType, varDefNode);
9797
const coercionErrors = coerced.errors;
9898
if (coercionErrors) {
99-
coercionErrors.forEach(error => {
99+
for (const error of coercionErrors) {
100100
error.message =
101101
`Variable "$${varName}" got invalid ` +
102102
`value ${inspect(value)}; ${error.message}`;
103-
});
103+
}
104104
errors.push(...coercionErrors);
105105
} else {
106106
coercedValues[varName] = coerced.value;

execution/values.mjs

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function getVariableValues(schema, varDefNodes, inputs) {
3131
var errors = [];
3232
var coercedValues = {};
3333

34-
var _loop = function _loop(i) {
34+
for (var i = 0; i < varDefNodes.length; i++) {
3535
var varDefNode = varDefNodes[i];
3636
var varName = varDefNode.variable.name.value;
3737
var varType = typeFromAST(schema, varDefNode.type);
@@ -64,20 +64,37 @@ export function getVariableValues(schema, varDefNodes, inputs) {
6464
var coercionErrors = coerced.errors;
6565

6666
if (coercionErrors) {
67-
coercionErrors.forEach(function (error) {
68-
error.message = "Variable \"$".concat(varName, "\" got invalid ") + "value ".concat(inspect(value), "; ").concat(error.message);
69-
});
67+
var _iteratorNormalCompletion = true;
68+
var _didIteratorError = false;
69+
var _iteratorError = undefined;
70+
71+
try {
72+
for (var _iterator = coercionErrors[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
73+
var error = _step.value;
74+
error.message = "Variable \"$".concat(varName, "\" got invalid ") + "value ".concat(inspect(value), "; ").concat(error.message);
75+
}
76+
} catch (err) {
77+
_didIteratorError = true;
78+
_iteratorError = err;
79+
} finally {
80+
try {
81+
if (!_iteratorNormalCompletion && _iterator.return != null) {
82+
_iterator.return();
83+
}
84+
} finally {
85+
if (_didIteratorError) {
86+
throw _iteratorError;
87+
}
88+
}
89+
}
90+
7091
errors.push.apply(errors, coercionErrors);
7192
} else {
7293
coercedValues[varName] = coerced.value;
7394
}
7495
}
7596
}
7697
}
77-
};
78-
79-
for (var i = 0; i < varDefNodes.length; i++) {
80-
_loop(i);
8198
}
8299

83100
return errors.length === 0 ? {

0 commit comments

Comments
 (0)