graphql 15.5.3 → 15.7.1
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/error/GraphQLError.d.ts +16 -12
- package/error/GraphQLError.js +59 -96
- package/error/GraphQLError.js.flow +47 -96
- package/error/GraphQLError.mjs +58 -96
- package/error/formatError.js +1 -1
- package/error/formatError.js.flow +1 -1
- package/error/formatError.mjs +1 -1
- package/error/index.d.ts +5 -1
- package/index.d.ts +2 -0
- package/language/index.d.ts +1 -0
- package/language/visitor.d.ts +9 -0
- package/package.json +1 -1
- package/type/introspection.js +30 -21
- package/type/introspection.js.flow +11 -1
- package/type/introspection.mjs +30 -21
- package/version.js +3 -3
- package/version.js.flow +3 -3
- package/version.mjs +3 -3
package/error/GraphQLError.d.ts
CHANGED
|
@@ -4,6 +4,19 @@ import { ASTNode } from '../language/ast';
|
|
|
4
4
|
import { Source } from '../language/source';
|
|
5
5
|
import { SourceLocation } from '../language/location';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Custom extensions
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* Use a unique identifier name for your extension, for example the name of
|
|
12
|
+
* your library or project. Do not use a shortened identifier as this increases
|
|
13
|
+
* the risk of conflicts. We recommend you add at most one extension field,
|
|
14
|
+
* an object which can contain all the values you need.
|
|
15
|
+
*/
|
|
16
|
+
export interface GraphQLErrorExtensions {
|
|
17
|
+
[attributeName: string]: any;
|
|
18
|
+
}
|
|
19
|
+
|
|
7
20
|
/**
|
|
8
21
|
* A GraphQLError describes an Error found during the parse, validate, or
|
|
9
22
|
* execute phases of performing a GraphQL operation. In addition to a message
|
|
@@ -18,18 +31,9 @@ export class GraphQLError extends Error {
|
|
|
18
31
|
positions?: Maybe<ReadonlyArray<number>>,
|
|
19
32
|
path?: Maybe<ReadonlyArray<string | number>>,
|
|
20
33
|
originalError?: Maybe<Error>,
|
|
21
|
-
extensions?: Maybe<
|
|
34
|
+
extensions?: Maybe<GraphQLErrorExtensions>,
|
|
22
35
|
);
|
|
23
36
|
|
|
24
|
-
/**
|
|
25
|
-
* A message describing the Error for debugging purposes.
|
|
26
|
-
*
|
|
27
|
-
* Enumerable, and appears in the result of JSON.stringify().
|
|
28
|
-
*
|
|
29
|
-
* Note: should be treated as readonly, despite invariant usage.
|
|
30
|
-
*/
|
|
31
|
-
message: string;
|
|
32
|
-
|
|
33
37
|
/**
|
|
34
38
|
* An array of { line, column } locations within the source GraphQL document
|
|
35
39
|
* which correspond to this error.
|
|
@@ -72,12 +76,12 @@ export class GraphQLError extends Error {
|
|
|
72
76
|
/**
|
|
73
77
|
* The original error thrown from a field resolver during execution.
|
|
74
78
|
*/
|
|
75
|
-
readonly originalError:
|
|
79
|
+
readonly originalError: Error | undefined | null;
|
|
76
80
|
|
|
77
81
|
/**
|
|
78
82
|
* Extension fields to add to the formatted error.
|
|
79
83
|
*/
|
|
80
|
-
readonly extensions: { [key: string]: any }
|
|
84
|
+
readonly extensions: { [key: string]: any };
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
/**
|
package/error/GraphQLError.js
CHANGED
|
@@ -18,6 +18,12 @@ var _printLocation = require("../language/printLocation.js");
|
|
|
18
18
|
|
|
19
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
20
|
|
|
21
|
+
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; }
|
|
22
|
+
|
|
23
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
24
|
+
|
|
25
|
+
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; }
|
|
26
|
+
|
|
21
27
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
22
28
|
|
|
23
29
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -55,14 +61,6 @@ var GraphQLError = /*#__PURE__*/function (_Error) {
|
|
|
55
61
|
|
|
56
62
|
var _super = _createSuper(GraphQLError);
|
|
57
63
|
|
|
58
|
-
/**
|
|
59
|
-
* A message describing the Error for debugging purposes.
|
|
60
|
-
*
|
|
61
|
-
* Enumerable, and appears in the result of JSON.stringify().
|
|
62
|
-
*
|
|
63
|
-
* Note: should be treated as readonly, despite invariant usage.
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
64
|
/**
|
|
67
65
|
* An array of { line, column } locations within the source GraphQL document
|
|
68
66
|
* which correspond to this error.
|
|
@@ -105,117 +103,78 @@ var GraphQLError = /*#__PURE__*/function (_Error) {
|
|
|
105
103
|
* Extension fields to add to the formatted error.
|
|
106
104
|
*/
|
|
107
105
|
function GraphQLError(message, nodes, source, positions, path, originalError, extensions) {
|
|
108
|
-
var
|
|
106
|
+
var _nodeLocations, _nodeLocations2, _nodeLocations3;
|
|
109
107
|
|
|
110
108
|
var _this;
|
|
111
109
|
|
|
112
110
|
_classCallCheck(this, GraphQLError);
|
|
113
111
|
|
|
114
|
-
_this = _super.call(this, message);
|
|
112
|
+
_this = _super.call(this, message);
|
|
113
|
+
_this.name = 'GraphQLError';
|
|
114
|
+
_this.originalError = originalError !== null && originalError !== void 0 ? originalError : undefined; // Compute list of blame nodes.
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
_this.nodes = undefinedIfEmpty(Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined);
|
|
117
|
+
var nodeLocations = [];
|
|
117
118
|
|
|
119
|
+
for (var _i2 = 0, _ref3 = (_this$nodes = _this.nodes) !== null && _this$nodes !== void 0 ? _this$nodes : []; _i2 < _ref3.length; _i2++) {
|
|
120
|
+
var _this$nodes;
|
|
118
121
|
|
|
119
|
-
|
|
122
|
+
var _ref4 = _ref3[_i2];
|
|
123
|
+
var loc = _ref4.loc;
|
|
120
124
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
_source = (_nodes$0$loc = _nodes[0].loc) === null || _nodes$0$loc === void 0 ? void 0 : _nodes$0$loc.source;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
var _positions = positions;
|
|
128
|
-
|
|
129
|
-
if (!_positions && _nodes) {
|
|
130
|
-
_positions = _nodes.reduce(function (list, node) {
|
|
131
|
-
if (node.loc) {
|
|
132
|
-
list.push(node.loc.start);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return list;
|
|
136
|
-
}, []);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (_positions && _positions.length === 0) {
|
|
140
|
-
_positions = undefined;
|
|
125
|
+
if (loc != null) {
|
|
126
|
+
nodeLocations.push(loc);
|
|
127
|
+
}
|
|
141
128
|
}
|
|
142
129
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if (positions && source) {
|
|
146
|
-
_locations = positions.map(function (pos) {
|
|
147
|
-
return (0, _location.getLocation)(source, pos);
|
|
148
|
-
});
|
|
149
|
-
} else if (_nodes) {
|
|
150
|
-
_locations = _nodes.reduce(function (list, node) {
|
|
151
|
-
if (node.loc) {
|
|
152
|
-
list.push((0, _location.getLocation)(node.loc.source, node.loc.start));
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return list;
|
|
156
|
-
}, []);
|
|
157
|
-
}
|
|
130
|
+
nodeLocations = undefinedIfEmpty(nodeLocations); // Compute locations in the source for the given nodes/positions.
|
|
158
131
|
|
|
159
|
-
|
|
132
|
+
_this.source = source !== null && source !== void 0 ? source : (_nodeLocations = nodeLocations) === null || _nodeLocations === void 0 ? void 0 : _nodeLocations[0].source;
|
|
133
|
+
_this.positions = positions !== null && positions !== void 0 ? positions : (_nodeLocations2 = nodeLocations) === null || _nodeLocations2 === void 0 ? void 0 : _nodeLocations2.map(function (loc) {
|
|
134
|
+
return loc.start;
|
|
135
|
+
});
|
|
136
|
+
_this.locations = positions && source ? positions.map(function (pos) {
|
|
137
|
+
return (0, _location.getLocation)(source, pos);
|
|
138
|
+
}) : (_nodeLocations3 = nodeLocations) === null || _nodeLocations3 === void 0 ? void 0 : _nodeLocations3.map(function (loc) {
|
|
139
|
+
return (0, _location.getLocation)(loc.source, loc.start);
|
|
140
|
+
});
|
|
141
|
+
_this.path = path !== null && path !== void 0 ? path : undefined;
|
|
142
|
+
_this.extensions = extensions !== null && extensions !== void 0 ? extensions : {};
|
|
143
|
+
var originalExtensions = originalError === null || originalError === void 0 ? void 0 : originalError.extensions;
|
|
160
144
|
|
|
161
|
-
if (
|
|
162
|
-
|
|
145
|
+
if ((0, _isObjectLike.default)(originalExtensions)) {
|
|
146
|
+
_this.extensions = _objectSpread({}, originalExtensions);
|
|
147
|
+
} // By being enumerable, JSON.stringify will include bellow properties in the resulting output.
|
|
148
|
+
// This ensures that the simplest possible GraphQL service adheres to the spec.
|
|
163
149
|
|
|
164
|
-
if ((0, _isObjectLike.default)(originalExtensions)) {
|
|
165
|
-
_extensions = originalExtensions;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
150
|
|
|
169
151
|
Object.defineProperties(_assertThisInitialized(_this), {
|
|
170
|
-
name: {
|
|
171
|
-
value: 'GraphQLError'
|
|
172
|
-
},
|
|
173
152
|
message: {
|
|
174
|
-
|
|
175
|
-
// By being enumerable, JSON.stringify will include `message` in the
|
|
176
|
-
// resulting output. This ensures that the simplest possible GraphQL
|
|
177
|
-
// service adheres to the spec.
|
|
178
|
-
enumerable: true,
|
|
179
|
-
writable: true
|
|
153
|
+
enumerable: true
|
|
180
154
|
},
|
|
181
155
|
locations: {
|
|
182
|
-
|
|
183
|
-
// in JSON.stringify() when not provided.
|
|
184
|
-
value: (_locations2 = _locations) !== null && _locations2 !== void 0 ? _locations2 : undefined,
|
|
185
|
-
// By being enumerable, JSON.stringify will include `locations` in the
|
|
186
|
-
// resulting output. This ensures that the simplest possible GraphQL
|
|
187
|
-
// service adheres to the spec.
|
|
188
|
-
enumerable: _locations != null
|
|
156
|
+
enumerable: _this.locations != null
|
|
189
157
|
},
|
|
190
158
|
path: {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
enumerable:
|
|
159
|
+
enumerable: _this.path != null
|
|
160
|
+
},
|
|
161
|
+
extensions: {
|
|
162
|
+
enumerable: _this.extensions != null && Object.keys(_this.extensions).length > 0
|
|
163
|
+
},
|
|
164
|
+
name: {
|
|
165
|
+
enumerable: false
|
|
198
166
|
},
|
|
199
167
|
nodes: {
|
|
200
|
-
|
|
168
|
+
enumerable: false
|
|
201
169
|
},
|
|
202
170
|
source: {
|
|
203
|
-
|
|
171
|
+
enumerable: false
|
|
204
172
|
},
|
|
205
173
|
positions: {
|
|
206
|
-
|
|
174
|
+
enumerable: false
|
|
207
175
|
},
|
|
208
176
|
originalError: {
|
|
209
|
-
|
|
210
|
-
},
|
|
211
|
-
extensions: {
|
|
212
|
-
// Coercing falsy values to undefined ensures they will not be included
|
|
213
|
-
// in JSON.stringify() when not provided.
|
|
214
|
-
value: (_extensions2 = _extensions) !== null && _extensions2 !== void 0 ? _extensions2 : undefined,
|
|
215
|
-
// By being enumerable, JSON.stringify will include `path` in the
|
|
216
|
-
// resulting output. This ensures that the simplest possible GraphQL
|
|
217
|
-
// service adheres to the spec.
|
|
218
|
-
enumerable: _extensions != null
|
|
177
|
+
enumerable: false
|
|
219
178
|
}
|
|
220
179
|
}); // Include (non-enumerable) stack trace.
|
|
221
180
|
|
|
@@ -258,28 +217,32 @@ var GraphQLError = /*#__PURE__*/function (_Error) {
|
|
|
258
217
|
|
|
259
218
|
return GraphQLError;
|
|
260
219
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
220
|
+
|
|
221
|
+
exports.GraphQLError = GraphQLError;
|
|
222
|
+
|
|
223
|
+
function undefinedIfEmpty(array) {
|
|
224
|
+
return array === undefined || array.length === 0 ? undefined : array;
|
|
225
|
+
}
|
|
261
226
|
/**
|
|
262
227
|
* Prints a GraphQLError to a string, representing useful location information
|
|
263
228
|
* about the error's position in the source.
|
|
264
229
|
*/
|
|
265
230
|
|
|
266
231
|
|
|
267
|
-
exports.GraphQLError = GraphQLError;
|
|
268
|
-
|
|
269
232
|
function printError(error) {
|
|
270
233
|
var output = error.message;
|
|
271
234
|
|
|
272
235
|
if (error.nodes) {
|
|
273
|
-
for (var
|
|
274
|
-
var node = _error$nodes2[
|
|
236
|
+
for (var _i4 = 0, _error$nodes2 = error.nodes; _i4 < _error$nodes2.length; _i4++) {
|
|
237
|
+
var node = _error$nodes2[_i4];
|
|
275
238
|
|
|
276
239
|
if (node.loc) {
|
|
277
240
|
output += '\n\n' + (0, _printLocation.printLocation)(node.loc);
|
|
278
241
|
}
|
|
279
242
|
}
|
|
280
243
|
} else if (error.source && error.locations) {
|
|
281
|
-
for (var
|
|
282
|
-
var location = _error$locations2[
|
|
244
|
+
for (var _i6 = 0, _error$locations2 = error.locations; _i6 < _error$locations2.length; _i6++) {
|
|
245
|
+
var location = _error$locations2[_i6];
|
|
283
246
|
output += '\n\n' + (0, _printLocation.printSourceLocation)(error.source, location);
|
|
284
247
|
}
|
|
285
248
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
// @flow strict
|
|
2
|
-
// FIXME:
|
|
3
|
-
// flowlint uninitialized-instance-property:off
|
|
4
|
-
|
|
5
2
|
import isObjectLike from '../jsutils/isObjectLike';
|
|
6
3
|
import { SYMBOL_TO_STRING_TAG } from '../polyfills/symbols';
|
|
7
4
|
|
|
@@ -18,15 +15,6 @@ import { printLocation, printSourceLocation } from '../language/printLocation';
|
|
|
18
15
|
* GraphQL document and/or execution result that correspond to the Error.
|
|
19
16
|
*/
|
|
20
17
|
export class GraphQLError extends Error {
|
|
21
|
-
/**
|
|
22
|
-
* A message describing the Error for debugging purposes.
|
|
23
|
-
*
|
|
24
|
-
* Enumerable, and appears in the result of JSON.stringify().
|
|
25
|
-
*
|
|
26
|
-
* Note: should be treated as readonly, despite invariant usage.
|
|
27
|
-
*/
|
|
28
|
-
message: string;
|
|
29
|
-
|
|
30
18
|
/**
|
|
31
19
|
* An array of { line, column } locations within the source GraphQL document
|
|
32
20
|
* which correspond to this error.
|
|
@@ -69,12 +57,12 @@ export class GraphQLError extends Error {
|
|
|
69
57
|
/**
|
|
70
58
|
* The original error thrown from a field resolver during execution.
|
|
71
59
|
*/
|
|
72
|
-
+originalError:
|
|
60
|
+
+originalError: Error | void | null;
|
|
73
61
|
|
|
74
62
|
/**
|
|
75
63
|
* Extension fields to add to the formatted error.
|
|
76
64
|
*/
|
|
77
|
-
+extensions: { [key: string]: mixed, ... }
|
|
65
|
+
+extensions: { [key: string]: mixed, ... };
|
|
78
66
|
|
|
79
67
|
constructor(
|
|
80
68
|
message: string,
|
|
@@ -87,103 +75,60 @@ export class GraphQLError extends Error {
|
|
|
87
75
|
) {
|
|
88
76
|
super(message);
|
|
89
77
|
|
|
78
|
+
this.name = 'GraphQLError';
|
|
79
|
+
this.originalError = originalError ?? undefined;
|
|
80
|
+
|
|
90
81
|
// Compute list of blame nodes.
|
|
91
|
-
|
|
92
|
-
? nodes
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
82
|
+
this.nodes = undefinedIfEmpty(
|
|
83
|
+
Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined,
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
let nodeLocations = [];
|
|
87
|
+
for (const { loc } of this.nodes ?? []) {
|
|
88
|
+
if (loc != null) {
|
|
89
|
+
nodeLocations.push(loc);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
nodeLocations = undefinedIfEmpty(nodeLocations);
|
|
98
93
|
|
|
99
94
|
// Compute locations in the source for the given nodes/positions.
|
|
100
|
-
|
|
101
|
-
if (!_source && _nodes) {
|
|
102
|
-
_source = _nodes[0].loc?.source;
|
|
103
|
-
}
|
|
95
|
+
this.source = source ?? nodeLocations?.[0].source;
|
|
104
96
|
|
|
105
|
-
|
|
106
|
-
if (!_positions && _nodes) {
|
|
107
|
-
_positions = _nodes.reduce((list, node) => {
|
|
108
|
-
if (node.loc) {
|
|
109
|
-
list.push(node.loc.start);
|
|
110
|
-
}
|
|
111
|
-
return list;
|
|
112
|
-
}, []);
|
|
113
|
-
}
|
|
114
|
-
if (_positions && _positions.length === 0) {
|
|
115
|
-
_positions = undefined;
|
|
116
|
-
}
|
|
97
|
+
this.positions = positions ?? nodeLocations?.map((loc) => loc.start);
|
|
117
98
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
_locations = _nodes.reduce((list, node) => {
|
|
123
|
-
if (node.loc) {
|
|
124
|
-
list.push(getLocation(node.loc.source, node.loc.start));
|
|
125
|
-
}
|
|
126
|
-
return list;
|
|
127
|
-
}, []);
|
|
128
|
-
}
|
|
99
|
+
this.locations =
|
|
100
|
+
positions && source
|
|
101
|
+
? positions.map((pos) => getLocation(source, pos))
|
|
102
|
+
: nodeLocations?.map((loc) => getLocation(loc.source, loc.start));
|
|
129
103
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
104
|
+
this.path = path ?? undefined;
|
|
105
|
+
|
|
106
|
+
this.extensions = extensions ?? {};
|
|
107
|
+
|
|
108
|
+
const originalExtensions = originalError?.extensions;
|
|
109
|
+
if (isObjectLike(originalExtensions)) {
|
|
110
|
+
this.extensions = { ...originalExtensions };
|
|
136
111
|
}
|
|
137
112
|
|
|
113
|
+
// By being enumerable, JSON.stringify will include bellow properties in the resulting output.
|
|
114
|
+
// This ensures that the simplest possible GraphQL service adheres to the spec.
|
|
138
115
|
Object.defineProperties((this: any), {
|
|
139
|
-
|
|
140
|
-
message: {
|
|
141
|
-
value: message,
|
|
142
|
-
// By being enumerable, JSON.stringify will include `message` in the
|
|
143
|
-
// resulting output. This ensures that the simplest possible GraphQL
|
|
144
|
-
// service adheres to the spec.
|
|
145
|
-
enumerable: true,
|
|
146
|
-
writable: true,
|
|
147
|
-
},
|
|
116
|
+
message: { enumerable: true },
|
|
148
117
|
locations: {
|
|
149
|
-
|
|
150
|
-
// in JSON.stringify() when not provided.
|
|
151
|
-
value: _locations ?? undefined,
|
|
152
|
-
// By being enumerable, JSON.stringify will include `locations` in the
|
|
153
|
-
// resulting output. This ensures that the simplest possible GraphQL
|
|
154
|
-
// service adheres to the spec.
|
|
155
|
-
enumerable: _locations != null,
|
|
118
|
+
enumerable: this.locations != null,
|
|
156
119
|
},
|
|
157
120
|
path: {
|
|
158
|
-
|
|
159
|
-
// in JSON.stringify() when not provided.
|
|
160
|
-
value: path ?? undefined,
|
|
161
|
-
// By being enumerable, JSON.stringify will include `path` in the
|
|
162
|
-
// resulting output. This ensures that the simplest possible GraphQL
|
|
163
|
-
// service adheres to the spec.
|
|
164
|
-
enumerable: path != null,
|
|
165
|
-
},
|
|
166
|
-
nodes: {
|
|
167
|
-
value: _nodes ?? undefined,
|
|
168
|
-
},
|
|
169
|
-
source: {
|
|
170
|
-
value: _source ?? undefined,
|
|
171
|
-
},
|
|
172
|
-
positions: {
|
|
173
|
-
value: _positions ?? undefined,
|
|
174
|
-
},
|
|
175
|
-
originalError: {
|
|
176
|
-
value: originalError,
|
|
121
|
+
enumerable: this.path != null,
|
|
177
122
|
},
|
|
178
123
|
extensions: {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
value: _extensions ?? undefined,
|
|
182
|
-
// By being enumerable, JSON.stringify will include `path` in the
|
|
183
|
-
// resulting output. This ensures that the simplest possible GraphQL
|
|
184
|
-
// service adheres to the spec.
|
|
185
|
-
enumerable: _extensions != null,
|
|
124
|
+
enumerable:
|
|
125
|
+
this.extensions != null && Object.keys(this.extensions).length > 0,
|
|
186
126
|
},
|
|
127
|
+
name: { enumerable: false },
|
|
128
|
+
nodes: { enumerable: false },
|
|
129
|
+
source: { enumerable: false },
|
|
130
|
+
positions: { enumerable: false },
|
|
131
|
+
originalError: { enumerable: false },
|
|
187
132
|
});
|
|
188
133
|
|
|
189
134
|
// Include (non-enumerable) stack trace.
|
|
@@ -219,6 +164,12 @@ export class GraphQLError extends Error {
|
|
|
219
164
|
}
|
|
220
165
|
}
|
|
221
166
|
|
|
167
|
+
function undefinedIfEmpty<T>(
|
|
168
|
+
array: $ReadOnlyArray<T> | void,
|
|
169
|
+
): $ReadOnlyArray<T> | void {
|
|
170
|
+
return array === undefined || array.length === 0 ? undefined : array;
|
|
171
|
+
}
|
|
172
|
+
|
|
222
173
|
/**
|
|
223
174
|
* Prints a GraphQLError to a string, representing useful location information
|
|
224
175
|
* about the error's position in the source.
|
package/error/GraphQLError.mjs
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
2
|
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
3
9
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
10
|
|
|
5
11
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -26,8 +32,6 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
|
|
|
26
32
|
|
|
27
33
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
28
34
|
|
|
29
|
-
// FIXME:
|
|
30
|
-
// flowlint uninitialized-instance-property:off
|
|
31
35
|
import isObjectLike from "../jsutils/isObjectLike.mjs";
|
|
32
36
|
import { SYMBOL_TO_STRING_TAG } from "../polyfills/symbols.mjs";
|
|
33
37
|
import { getLocation } from "../language/location.mjs";
|
|
@@ -44,14 +48,6 @@ export var GraphQLError = /*#__PURE__*/function (_Error) {
|
|
|
44
48
|
|
|
45
49
|
var _super = _createSuper(GraphQLError);
|
|
46
50
|
|
|
47
|
-
/**
|
|
48
|
-
* A message describing the Error for debugging purposes.
|
|
49
|
-
*
|
|
50
|
-
* Enumerable, and appears in the result of JSON.stringify().
|
|
51
|
-
*
|
|
52
|
-
* Note: should be treated as readonly, despite invariant usage.
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
51
|
/**
|
|
56
52
|
* An array of { line, column } locations within the source GraphQL document
|
|
57
53
|
* which correspond to this error.
|
|
@@ -94,117 +90,78 @@ export var GraphQLError = /*#__PURE__*/function (_Error) {
|
|
|
94
90
|
* Extension fields to add to the formatted error.
|
|
95
91
|
*/
|
|
96
92
|
function GraphQLError(message, nodes, source, positions, path, originalError, extensions) {
|
|
97
|
-
var
|
|
93
|
+
var _nodeLocations, _nodeLocations2, _nodeLocations3;
|
|
98
94
|
|
|
99
95
|
var _this;
|
|
100
96
|
|
|
101
97
|
_classCallCheck(this, GraphQLError);
|
|
102
98
|
|
|
103
|
-
_this = _super.call(this, message);
|
|
99
|
+
_this = _super.call(this, message);
|
|
100
|
+
_this.name = 'GraphQLError';
|
|
101
|
+
_this.originalError = originalError !== null && originalError !== void 0 ? originalError : undefined; // Compute list of blame nodes.
|
|
104
102
|
|
|
105
|
-
|
|
103
|
+
_this.nodes = undefinedIfEmpty(Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined);
|
|
104
|
+
var nodeLocations = [];
|
|
106
105
|
|
|
106
|
+
for (var _i2 = 0, _ref3 = (_this$nodes = _this.nodes) !== null && _this$nodes !== void 0 ? _this$nodes : []; _i2 < _ref3.length; _i2++) {
|
|
107
|
+
var _this$nodes;
|
|
107
108
|
|
|
108
|
-
|
|
109
|
+
var _ref4 = _ref3[_i2];
|
|
110
|
+
var loc = _ref4.loc;
|
|
109
111
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
_source = (_nodes$0$loc = _nodes[0].loc) === null || _nodes$0$loc === void 0 ? void 0 : _nodes$0$loc.source;
|
|
112
|
+
if (loc != null) {
|
|
113
|
+
nodeLocations.push(loc);
|
|
114
|
+
}
|
|
114
115
|
}
|
|
115
116
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (!_positions && _nodes) {
|
|
119
|
-
_positions = _nodes.reduce(function (list, node) {
|
|
120
|
-
if (node.loc) {
|
|
121
|
-
list.push(node.loc.start);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return list;
|
|
125
|
-
}, []);
|
|
126
|
-
}
|
|
117
|
+
nodeLocations = undefinedIfEmpty(nodeLocations); // Compute locations in the source for the given nodes/positions.
|
|
127
118
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
119
|
+
_this.source = source !== null && source !== void 0 ? source : (_nodeLocations = nodeLocations) === null || _nodeLocations === void 0 ? void 0 : _nodeLocations[0].source;
|
|
120
|
+
_this.positions = positions !== null && positions !== void 0 ? positions : (_nodeLocations2 = nodeLocations) === null || _nodeLocations2 === void 0 ? void 0 : _nodeLocations2.map(function (loc) {
|
|
121
|
+
return loc.start;
|
|
122
|
+
});
|
|
123
|
+
_this.locations = positions && source ? positions.map(function (pos) {
|
|
124
|
+
return getLocation(source, pos);
|
|
125
|
+
}) : (_nodeLocations3 = nodeLocations) === null || _nodeLocations3 === void 0 ? void 0 : _nodeLocations3.map(function (loc) {
|
|
126
|
+
return getLocation(loc.source, loc.start);
|
|
127
|
+
});
|
|
128
|
+
_this.path = path !== null && path !== void 0 ? path : undefined;
|
|
129
|
+
_this.extensions = extensions !== null && extensions !== void 0 ? extensions : {};
|
|
130
|
+
var originalExtensions = originalError === null || originalError === void 0 ? void 0 : originalError.extensions;
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
if (isObjectLike(originalExtensions)) {
|
|
133
|
+
_this.extensions = _objectSpread({}, originalExtensions);
|
|
134
|
+
} // By being enumerable, JSON.stringify will include bellow properties in the resulting output.
|
|
135
|
+
// This ensures that the simplest possible GraphQL service adheres to the spec.
|
|
133
136
|
|
|
134
|
-
if (positions && source) {
|
|
135
|
-
_locations = positions.map(function (pos) {
|
|
136
|
-
return getLocation(source, pos);
|
|
137
|
-
});
|
|
138
|
-
} else if (_nodes) {
|
|
139
|
-
_locations = _nodes.reduce(function (list, node) {
|
|
140
|
-
if (node.loc) {
|
|
141
|
-
list.push(getLocation(node.loc.source, node.loc.start));
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return list;
|
|
145
|
-
}, []);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
var _extensions = extensions;
|
|
149
|
-
|
|
150
|
-
if (_extensions == null && originalError != null) {
|
|
151
|
-
var originalExtensions = originalError.extensions;
|
|
152
|
-
|
|
153
|
-
if (isObjectLike(originalExtensions)) {
|
|
154
|
-
_extensions = originalExtensions;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
137
|
|
|
158
138
|
Object.defineProperties(_assertThisInitialized(_this), {
|
|
159
|
-
name: {
|
|
160
|
-
value: 'GraphQLError'
|
|
161
|
-
},
|
|
162
139
|
message: {
|
|
163
|
-
|
|
164
|
-
// By being enumerable, JSON.stringify will include `message` in the
|
|
165
|
-
// resulting output. This ensures that the simplest possible GraphQL
|
|
166
|
-
// service adheres to the spec.
|
|
167
|
-
enumerable: true,
|
|
168
|
-
writable: true
|
|
140
|
+
enumerable: true
|
|
169
141
|
},
|
|
170
142
|
locations: {
|
|
171
|
-
|
|
172
|
-
// in JSON.stringify() when not provided.
|
|
173
|
-
value: (_locations2 = _locations) !== null && _locations2 !== void 0 ? _locations2 : undefined,
|
|
174
|
-
// By being enumerable, JSON.stringify will include `locations` in the
|
|
175
|
-
// resulting output. This ensures that the simplest possible GraphQL
|
|
176
|
-
// service adheres to the spec.
|
|
177
|
-
enumerable: _locations != null
|
|
143
|
+
enumerable: _this.locations != null
|
|
178
144
|
},
|
|
179
145
|
path: {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
enumerable:
|
|
146
|
+
enumerable: _this.path != null
|
|
147
|
+
},
|
|
148
|
+
extensions: {
|
|
149
|
+
enumerable: _this.extensions != null && Object.keys(_this.extensions).length > 0
|
|
150
|
+
},
|
|
151
|
+
name: {
|
|
152
|
+
enumerable: false
|
|
187
153
|
},
|
|
188
154
|
nodes: {
|
|
189
|
-
|
|
155
|
+
enumerable: false
|
|
190
156
|
},
|
|
191
157
|
source: {
|
|
192
|
-
|
|
158
|
+
enumerable: false
|
|
193
159
|
},
|
|
194
160
|
positions: {
|
|
195
|
-
|
|
161
|
+
enumerable: false
|
|
196
162
|
},
|
|
197
163
|
originalError: {
|
|
198
|
-
|
|
199
|
-
},
|
|
200
|
-
extensions: {
|
|
201
|
-
// Coercing falsy values to undefined ensures they will not be included
|
|
202
|
-
// in JSON.stringify() when not provided.
|
|
203
|
-
value: (_extensions2 = _extensions) !== null && _extensions2 !== void 0 ? _extensions2 : undefined,
|
|
204
|
-
// By being enumerable, JSON.stringify will include `path` in the
|
|
205
|
-
// resulting output. This ensures that the simplest possible GraphQL
|
|
206
|
-
// service adheres to the spec.
|
|
207
|
-
enumerable: _extensions != null
|
|
164
|
+
enumerable: false
|
|
208
165
|
}
|
|
209
166
|
}); // Include (non-enumerable) stack trace.
|
|
210
167
|
|
|
@@ -247,25 +204,30 @@ export var GraphQLError = /*#__PURE__*/function (_Error) {
|
|
|
247
204
|
|
|
248
205
|
return GraphQLError;
|
|
249
206
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
207
|
+
|
|
208
|
+
function undefinedIfEmpty(array) {
|
|
209
|
+
return array === undefined || array.length === 0 ? undefined : array;
|
|
210
|
+
}
|
|
250
211
|
/**
|
|
251
212
|
* Prints a GraphQLError to a string, representing useful location information
|
|
252
213
|
* about the error's position in the source.
|
|
253
214
|
*/
|
|
254
215
|
|
|
216
|
+
|
|
255
217
|
export function printError(error) {
|
|
256
218
|
var output = error.message;
|
|
257
219
|
|
|
258
220
|
if (error.nodes) {
|
|
259
|
-
for (var
|
|
260
|
-
var node = _error$nodes2[
|
|
221
|
+
for (var _i4 = 0, _error$nodes2 = error.nodes; _i4 < _error$nodes2.length; _i4++) {
|
|
222
|
+
var node = _error$nodes2[_i4];
|
|
261
223
|
|
|
262
224
|
if (node.loc) {
|
|
263
225
|
output += '\n\n' + printLocation(node.loc);
|
|
264
226
|
}
|
|
265
227
|
}
|
|
266
228
|
} else if (error.source && error.locations) {
|
|
267
|
-
for (var
|
|
268
|
-
var location = _error$locations2[
|
|
229
|
+
for (var _i6 = 0, _error$locations2 = error.locations; _i6 < _error$locations2.length; _i6++) {
|
|
230
|
+
var location = _error$locations2[_i6];
|
|
269
231
|
output += '\n\n' + printSourceLocation(error.source, location);
|
|
270
232
|
}
|
|
271
233
|
}
|
package/error/formatError.js
CHANGED
|
@@ -21,7 +21,7 @@ function formatError(error) {
|
|
|
21
21
|
var locations = error.locations;
|
|
22
22
|
var path = error.path;
|
|
23
23
|
var extensions = error.extensions;
|
|
24
|
-
return extensions ? {
|
|
24
|
+
return extensions && Object.keys(extensions).length > 0 ? {
|
|
25
25
|
message: message,
|
|
26
26
|
locations: locations,
|
|
27
27
|
path: path,
|
|
@@ -16,7 +16,7 @@ export function formatError(error: GraphQLError): GraphQLFormattedError {
|
|
|
16
16
|
const path = error.path;
|
|
17
17
|
const extensions = error.extensions;
|
|
18
18
|
|
|
19
|
-
return extensions
|
|
19
|
+
return extensions && Object.keys(extensions).length > 0
|
|
20
20
|
? { message, locations, path, extensions }
|
|
21
21
|
: { message, locations, path };
|
|
22
22
|
}
|
package/error/formatError.mjs
CHANGED
|
@@ -12,7 +12,7 @@ export function formatError(error) {
|
|
|
12
12
|
var locations = error.locations;
|
|
13
13
|
var path = error.path;
|
|
14
14
|
var extensions = error.extensions;
|
|
15
|
-
return extensions ? {
|
|
15
|
+
return extensions && Object.keys(extensions).length > 0 ? {
|
|
16
16
|
message: message,
|
|
17
17
|
locations: locations,
|
|
18
18
|
path: path,
|
package/error/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {
|
|
2
|
+
GraphQLError,
|
|
3
|
+
GraphQLErrorExtensions,
|
|
4
|
+
printError,
|
|
5
|
+
} from './GraphQLError';
|
|
2
6
|
export { syntaxError } from './syntaxError';
|
|
3
7
|
export { locatedError } from './locatedError';
|
|
4
8
|
export { formatError, GraphQLFormattedError } from './formatError';
|
package/index.d.ts
CHANGED
|
@@ -230,6 +230,7 @@ export {
|
|
|
230
230
|
Visitor,
|
|
231
231
|
VisitFn,
|
|
232
232
|
VisitorKeyMap,
|
|
233
|
+
ASTVisitorKeyMap,
|
|
233
234
|
// AST nodes
|
|
234
235
|
ASTNode,
|
|
235
236
|
ASTKindToNode,
|
|
@@ -363,6 +364,7 @@ export {
|
|
|
363
364
|
printError,
|
|
364
365
|
formatError,
|
|
365
366
|
GraphQLFormattedError,
|
|
367
|
+
GraphQLErrorExtensions,
|
|
366
368
|
} from './error/index';
|
|
367
369
|
|
|
368
370
|
// Utilities for operating on GraphQL type schema and parsed sources.
|
package/language/index.d.ts
CHANGED
package/language/visitor.d.ts
CHANGED
|
@@ -49,9 +49,18 @@ export type VisitFn<TAnyNode, TVisitedNode = TAnyNode> = (
|
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* A KeyMap describes each the traversable properties of each kind of node.
|
|
52
|
+
*
|
|
53
|
+
* @deprecated Please using ASTVisitorKeyMap instead
|
|
52
54
|
*/
|
|
53
55
|
export type VisitorKeyMap<T> = { [P in keyof T]: ReadonlyArray<keyof T[P]> };
|
|
54
56
|
|
|
57
|
+
/**
|
|
58
|
+
* A KeyMap describes each the traversable properties of each kind of node.
|
|
59
|
+
*/
|
|
60
|
+
export type ASTVisitorKeyMap = {
|
|
61
|
+
[P in keyof ASTKindToNode]?: ReadonlyArray<keyof ASTKindToNode[P]>;
|
|
62
|
+
};
|
|
63
|
+
|
|
55
64
|
// TODO: Should be `[]`, but that requires TypeScript@3
|
|
56
65
|
type EmptyTuple = Array<never>;
|
|
57
66
|
|
package/package.json
CHANGED
package/type/introspection.js
CHANGED
|
@@ -107,8 +107,17 @@ var __Directive = new _definition.GraphQLObjectType({
|
|
|
107
107
|
},
|
|
108
108
|
args: {
|
|
109
109
|
type: new _definition.GraphQLNonNull(new _definition.GraphQLList(new _definition.GraphQLNonNull(__InputValue))),
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
args: {
|
|
111
|
+
includeDeprecated: {
|
|
112
|
+
type: _scalars.GraphQLBoolean,
|
|
113
|
+
defaultValue: false
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
resolve: function resolve(field, _ref) {
|
|
117
|
+
var includeDeprecated = _ref.includeDeprecated;
|
|
118
|
+
return includeDeprecated ? field.args : field.args.filter(function (arg) {
|
|
119
|
+
return arg.deprecationReason == null;
|
|
120
|
+
});
|
|
112
121
|
}
|
|
113
122
|
}
|
|
114
123
|
};
|
|
@@ -273,8 +282,8 @@ var __Type = new _definition.GraphQLObjectType({
|
|
|
273
282
|
defaultValue: false
|
|
274
283
|
}
|
|
275
284
|
},
|
|
276
|
-
resolve: function resolve(type,
|
|
277
|
-
var includeDeprecated =
|
|
285
|
+
resolve: function resolve(type, _ref2) {
|
|
286
|
+
var includeDeprecated = _ref2.includeDeprecated;
|
|
278
287
|
|
|
279
288
|
if ((0, _definition.isObjectType)(type) || (0, _definition.isInterfaceType)(type)) {
|
|
280
289
|
var fields = (0, _objectValues.default)(type.getFields());
|
|
@@ -294,8 +303,8 @@ var __Type = new _definition.GraphQLObjectType({
|
|
|
294
303
|
},
|
|
295
304
|
possibleTypes: {
|
|
296
305
|
type: new _definition.GraphQLList(new _definition.GraphQLNonNull(__Type)),
|
|
297
|
-
resolve: function resolve(type, _args, _context,
|
|
298
|
-
var schema =
|
|
306
|
+
resolve: function resolve(type, _args, _context, _ref3) {
|
|
307
|
+
var schema = _ref3.schema;
|
|
299
308
|
|
|
300
309
|
if ((0, _definition.isAbstractType)(type)) {
|
|
301
310
|
return schema.getPossibleTypes(type);
|
|
@@ -310,8 +319,8 @@ var __Type = new _definition.GraphQLObjectType({
|
|
|
310
319
|
defaultValue: false
|
|
311
320
|
}
|
|
312
321
|
},
|
|
313
|
-
resolve: function resolve(type,
|
|
314
|
-
var includeDeprecated =
|
|
322
|
+
resolve: function resolve(type, _ref4) {
|
|
323
|
+
var includeDeprecated = _ref4.includeDeprecated;
|
|
315
324
|
|
|
316
325
|
if ((0, _definition.isEnumType)(type)) {
|
|
317
326
|
var values = type.getValues();
|
|
@@ -329,8 +338,8 @@ var __Type = new _definition.GraphQLObjectType({
|
|
|
329
338
|
defaultValue: false
|
|
330
339
|
}
|
|
331
340
|
},
|
|
332
|
-
resolve: function resolve(type,
|
|
333
|
-
var includeDeprecated =
|
|
341
|
+
resolve: function resolve(type, _ref5) {
|
|
342
|
+
var includeDeprecated = _ref5.includeDeprecated;
|
|
334
343
|
|
|
335
344
|
if ((0, _definition.isInputObjectType)(type)) {
|
|
336
345
|
var values = (0, _objectValues.default)(type.getFields());
|
|
@@ -377,8 +386,8 @@ var __Field = new _definition.GraphQLObjectType({
|
|
|
377
386
|
defaultValue: false
|
|
378
387
|
}
|
|
379
388
|
},
|
|
380
|
-
resolve: function resolve(field,
|
|
381
|
-
var includeDeprecated =
|
|
389
|
+
resolve: function resolve(field, _ref6) {
|
|
390
|
+
var includeDeprecated = _ref6.includeDeprecated;
|
|
382
391
|
return includeDeprecated ? field.args : field.args.filter(function (arg) {
|
|
383
392
|
return arg.deprecationReason == null;
|
|
384
393
|
});
|
|
@@ -555,8 +564,8 @@ var SchemaMetaFieldDef = {
|
|
|
555
564
|
type: new _definition.GraphQLNonNull(__Schema),
|
|
556
565
|
description: 'Access the current type schema of this server.',
|
|
557
566
|
args: [],
|
|
558
|
-
resolve: function resolve(_source, _args, _context,
|
|
559
|
-
var schema =
|
|
567
|
+
resolve: function resolve(_source, _args, _context, _ref7) {
|
|
568
|
+
var schema = _ref7.schema;
|
|
560
569
|
return schema;
|
|
561
570
|
},
|
|
562
571
|
isDeprecated: false,
|
|
@@ -578,9 +587,9 @@ var TypeMetaFieldDef = {
|
|
|
578
587
|
extensions: undefined,
|
|
579
588
|
astNode: undefined
|
|
580
589
|
}],
|
|
581
|
-
resolve: function resolve(_source,
|
|
582
|
-
var name =
|
|
583
|
-
var schema =
|
|
590
|
+
resolve: function resolve(_source, _ref8, _context, _ref9) {
|
|
591
|
+
var name = _ref8.name;
|
|
592
|
+
var schema = _ref9.schema;
|
|
584
593
|
return schema.getType(name);
|
|
585
594
|
},
|
|
586
595
|
isDeprecated: false,
|
|
@@ -594,8 +603,8 @@ var TypeNameMetaFieldDef = {
|
|
|
594
603
|
type: new _definition.GraphQLNonNull(_scalars.GraphQLString),
|
|
595
604
|
description: 'The name of the current Object type at runtime.',
|
|
596
605
|
args: [],
|
|
597
|
-
resolve: function resolve(_source, _args, _context,
|
|
598
|
-
var parentType =
|
|
606
|
+
resolve: function resolve(_source, _args, _context, _ref10) {
|
|
607
|
+
var parentType = _ref10.parentType;
|
|
599
608
|
return parentType.name;
|
|
600
609
|
},
|
|
601
610
|
isDeprecated: false,
|
|
@@ -608,8 +617,8 @@ var introspectionTypes = Object.freeze([__Schema, __Directive, __DirectiveLocati
|
|
|
608
617
|
exports.introspectionTypes = introspectionTypes;
|
|
609
618
|
|
|
610
619
|
function isIntrospectionType(type) {
|
|
611
|
-
return introspectionTypes.some(function (
|
|
612
|
-
var name =
|
|
620
|
+
return introspectionTypes.some(function (_ref11) {
|
|
621
|
+
var name = _ref11.name;
|
|
613
622
|
return type.name === name;
|
|
614
623
|
});
|
|
615
624
|
}
|
|
@@ -107,7 +107,17 @@ export const __Directive = new GraphQLObjectType({
|
|
|
107
107
|
type: new GraphQLNonNull(
|
|
108
108
|
new GraphQLList(new GraphQLNonNull(__InputValue)),
|
|
109
109
|
),
|
|
110
|
-
|
|
110
|
+
args: {
|
|
111
|
+
includeDeprecated: {
|
|
112
|
+
type: GraphQLBoolean,
|
|
113
|
+
defaultValue: false,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
resolve(field, { includeDeprecated }) {
|
|
117
|
+
return includeDeprecated
|
|
118
|
+
? field.args
|
|
119
|
+
: field.args.filter((arg) => arg.deprecationReason == null);
|
|
120
|
+
},
|
|
111
121
|
},
|
|
112
122
|
}: GraphQLFieldConfigMap<GraphQLDirective, mixed>),
|
|
113
123
|
});
|
package/type/introspection.mjs
CHANGED
|
@@ -86,8 +86,17 @@ export var __Directive = new GraphQLObjectType({
|
|
|
86
86
|
},
|
|
87
87
|
args: {
|
|
88
88
|
type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__InputValue))),
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
args: {
|
|
90
|
+
includeDeprecated: {
|
|
91
|
+
type: GraphQLBoolean,
|
|
92
|
+
defaultValue: false
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
resolve: function resolve(field, _ref) {
|
|
96
|
+
var includeDeprecated = _ref.includeDeprecated;
|
|
97
|
+
return includeDeprecated ? field.args : field.args.filter(function (arg) {
|
|
98
|
+
return arg.deprecationReason == null;
|
|
99
|
+
});
|
|
91
100
|
}
|
|
92
101
|
}
|
|
93
102
|
};
|
|
@@ -246,8 +255,8 @@ export var __Type = new GraphQLObjectType({
|
|
|
246
255
|
defaultValue: false
|
|
247
256
|
}
|
|
248
257
|
},
|
|
249
|
-
resolve: function resolve(type,
|
|
250
|
-
var includeDeprecated =
|
|
258
|
+
resolve: function resolve(type, _ref2) {
|
|
259
|
+
var includeDeprecated = _ref2.includeDeprecated;
|
|
251
260
|
|
|
252
261
|
if (isObjectType(type) || isInterfaceType(type)) {
|
|
253
262
|
var fields = objectValues(type.getFields());
|
|
@@ -267,8 +276,8 @@ export var __Type = new GraphQLObjectType({
|
|
|
267
276
|
},
|
|
268
277
|
possibleTypes: {
|
|
269
278
|
type: new GraphQLList(new GraphQLNonNull(__Type)),
|
|
270
|
-
resolve: function resolve(type, _args, _context,
|
|
271
|
-
var schema =
|
|
279
|
+
resolve: function resolve(type, _args, _context, _ref3) {
|
|
280
|
+
var schema = _ref3.schema;
|
|
272
281
|
|
|
273
282
|
if (isAbstractType(type)) {
|
|
274
283
|
return schema.getPossibleTypes(type);
|
|
@@ -283,8 +292,8 @@ export var __Type = new GraphQLObjectType({
|
|
|
283
292
|
defaultValue: false
|
|
284
293
|
}
|
|
285
294
|
},
|
|
286
|
-
resolve: function resolve(type,
|
|
287
|
-
var includeDeprecated =
|
|
295
|
+
resolve: function resolve(type, _ref4) {
|
|
296
|
+
var includeDeprecated = _ref4.includeDeprecated;
|
|
288
297
|
|
|
289
298
|
if (isEnumType(type)) {
|
|
290
299
|
var values = type.getValues();
|
|
@@ -302,8 +311,8 @@ export var __Type = new GraphQLObjectType({
|
|
|
302
311
|
defaultValue: false
|
|
303
312
|
}
|
|
304
313
|
},
|
|
305
|
-
resolve: function resolve(type,
|
|
306
|
-
var includeDeprecated =
|
|
314
|
+
resolve: function resolve(type, _ref5) {
|
|
315
|
+
var includeDeprecated = _ref5.includeDeprecated;
|
|
307
316
|
|
|
308
317
|
if (isInputObjectType(type)) {
|
|
309
318
|
var values = objectValues(type.getFields());
|
|
@@ -347,8 +356,8 @@ export var __Field = new GraphQLObjectType({
|
|
|
347
356
|
defaultValue: false
|
|
348
357
|
}
|
|
349
358
|
},
|
|
350
|
-
resolve: function resolve(field,
|
|
351
|
-
var includeDeprecated =
|
|
359
|
+
resolve: function resolve(field, _ref6) {
|
|
360
|
+
var includeDeprecated = _ref6.includeDeprecated;
|
|
352
361
|
return includeDeprecated ? field.args : field.args.filter(function (arg) {
|
|
353
362
|
return arg.deprecationReason == null;
|
|
354
363
|
});
|
|
@@ -513,8 +522,8 @@ export var SchemaMetaFieldDef = {
|
|
|
513
522
|
type: new GraphQLNonNull(__Schema),
|
|
514
523
|
description: 'Access the current type schema of this server.',
|
|
515
524
|
args: [],
|
|
516
|
-
resolve: function resolve(_source, _args, _context,
|
|
517
|
-
var schema =
|
|
525
|
+
resolve: function resolve(_source, _args, _context, _ref7) {
|
|
526
|
+
var schema = _ref7.schema;
|
|
518
527
|
return schema;
|
|
519
528
|
},
|
|
520
529
|
isDeprecated: false,
|
|
@@ -535,9 +544,9 @@ export var TypeMetaFieldDef = {
|
|
|
535
544
|
extensions: undefined,
|
|
536
545
|
astNode: undefined
|
|
537
546
|
}],
|
|
538
|
-
resolve: function resolve(_source,
|
|
539
|
-
var name =
|
|
540
|
-
var schema =
|
|
547
|
+
resolve: function resolve(_source, _ref8, _context, _ref9) {
|
|
548
|
+
var name = _ref8.name;
|
|
549
|
+
var schema = _ref9.schema;
|
|
541
550
|
return schema.getType(name);
|
|
542
551
|
},
|
|
543
552
|
isDeprecated: false,
|
|
@@ -550,8 +559,8 @@ export var TypeNameMetaFieldDef = {
|
|
|
550
559
|
type: new GraphQLNonNull(GraphQLString),
|
|
551
560
|
description: 'The name of the current Object type at runtime.',
|
|
552
561
|
args: [],
|
|
553
|
-
resolve: function resolve(_source, _args, _context,
|
|
554
|
-
var parentType =
|
|
562
|
+
resolve: function resolve(_source, _args, _context, _ref10) {
|
|
563
|
+
var parentType = _ref10.parentType;
|
|
555
564
|
return parentType.name;
|
|
556
565
|
},
|
|
557
566
|
isDeprecated: false,
|
|
@@ -561,8 +570,8 @@ export var TypeNameMetaFieldDef = {
|
|
|
561
570
|
};
|
|
562
571
|
export var introspectionTypes = Object.freeze([__Schema, __Directive, __DirectiveLocation, __Type, __Field, __InputValue, __EnumValue, __TypeKind]);
|
|
563
572
|
export function isIntrospectionType(type) {
|
|
564
|
-
return introspectionTypes.some(function (
|
|
565
|
-
var name =
|
|
573
|
+
return introspectionTypes.some(function (_ref11) {
|
|
574
|
+
var name = _ref11.name;
|
|
566
575
|
return type.name === name;
|
|
567
576
|
});
|
|
568
577
|
}
|
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 = '15.
|
|
16
|
+
var version = '15.7.1';
|
|
17
17
|
/**
|
|
18
18
|
* An object containing the components of the GraphQL.js version string
|
|
19
19
|
*/
|
|
@@ -21,8 +21,8 @@ var version = '15.5.3';
|
|
|
21
21
|
exports.version = version;
|
|
22
22
|
var versionInfo = Object.freeze({
|
|
23
23
|
major: 15,
|
|
24
|
-
minor:
|
|
25
|
-
patch:
|
|
24
|
+
minor: 7,
|
|
25
|
+
patch: 1,
|
|
26
26
|
preReleaseTag: null
|
|
27
27
|
});
|
|
28
28
|
exports.versionInfo = versionInfo;
|
package/version.js.flow
CHANGED
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
/**
|
|
8
8
|
* A string containing the version of the GraphQL.js library
|
|
9
9
|
*/
|
|
10
|
-
export const version = '15.
|
|
10
|
+
export const version = '15.7.1';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* An object containing the components of the GraphQL.js version string
|
|
14
14
|
*/
|
|
15
15
|
export const versionInfo = Object.freeze({
|
|
16
16
|
major: 15,
|
|
17
|
-
minor:
|
|
18
|
-
patch:
|
|
17
|
+
minor: 7,
|
|
18
|
+
patch: 1,
|
|
19
19
|
preReleaseTag: null,
|
|
20
20
|
});
|
package/version.mjs
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* A string containing the version of the GraphQL.js library
|
|
8
8
|
*/
|
|
9
|
-
export var version = '15.
|
|
9
|
+
export var version = '15.7.1';
|
|
10
10
|
/**
|
|
11
11
|
* An object containing the components of the GraphQL.js version string
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
export var versionInfo = Object.freeze({
|
|
15
15
|
major: 15,
|
|
16
|
-
minor:
|
|
17
|
-
patch:
|
|
16
|
+
minor: 7,
|
|
17
|
+
patch: 1,
|
|
18
18
|
preReleaseTag: null
|
|
19
19
|
});
|