graphql 15.6.0 → 15.7.2
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 +62 -98
- package/error/GraphQLError.js.flow +48 -96
- package/error/GraphQLError.mjs +61 -98
- 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 +1 -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,79 @@ 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);
|
|
115
|
-
|
|
116
|
-
|
|
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.
|
|
117
115
|
|
|
116
|
+
_this.nodes = undefinedIfEmpty(Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined);
|
|
117
|
+
var nodeLocations = [];
|
|
118
118
|
|
|
119
|
-
var
|
|
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;
|
|
120
121
|
|
|
121
|
-
|
|
122
|
-
var
|
|
122
|
+
var _ref4 = _ref3[_i2];
|
|
123
|
+
var loc = _ref4.loc;
|
|
123
124
|
|
|
124
|
-
|
|
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;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
var _locations;
|
|
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
|
-
}, []);
|
|
125
|
+
if (loc != null) {
|
|
126
|
+
nodeLocations.push(loc);
|
|
127
|
+
}
|
|
157
128
|
}
|
|
158
129
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
130
|
+
nodeLocations = undefinedIfEmpty(nodeLocations); // Compute locations in the source for the given nodes/positions.
|
|
131
|
+
|
|
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
|
+
var originalExtensions = originalError === null || originalError === void 0 ? void 0 : originalError.extensions;
|
|
143
|
+
|
|
144
|
+
if (extensions == null && (0, _isObjectLike.default)(originalExtensions)) {
|
|
145
|
+
_this.extensions = _objectSpread({}, originalExtensions);
|
|
146
|
+
} else {
|
|
147
|
+
_this.extensions = extensions !== null && extensions !== void 0 ? extensions : {};
|
|
148
|
+
} // By being enumerable, JSON.stringify will include bellow properties in the resulting output.
|
|
149
|
+
// This ensures that the simplest possible GraphQL service adheres to the spec.
|
|
163
150
|
|
|
164
|
-
if ((0, _isObjectLike.default)(originalExtensions)) {
|
|
165
|
-
_extensions = originalExtensions;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
151
|
|
|
169
152
|
Object.defineProperties(_assertThisInitialized(_this), {
|
|
170
|
-
name: {
|
|
171
|
-
value: 'GraphQLError'
|
|
172
|
-
},
|
|
173
153
|
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
|
|
154
|
+
enumerable: true
|
|
180
155
|
},
|
|
181
156
|
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
|
|
157
|
+
enumerable: _this.locations != null
|
|
189
158
|
},
|
|
190
159
|
path: {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
enumerable:
|
|
160
|
+
enumerable: _this.path != null
|
|
161
|
+
},
|
|
162
|
+
extensions: {
|
|
163
|
+
enumerable: _this.extensions != null && Object.keys(_this.extensions).length > 0
|
|
164
|
+
},
|
|
165
|
+
name: {
|
|
166
|
+
enumerable: false
|
|
198
167
|
},
|
|
199
168
|
nodes: {
|
|
200
|
-
|
|
169
|
+
enumerable: false
|
|
201
170
|
},
|
|
202
171
|
source: {
|
|
203
|
-
|
|
172
|
+
enumerable: false
|
|
204
173
|
},
|
|
205
174
|
positions: {
|
|
206
|
-
|
|
175
|
+
enumerable: false
|
|
207
176
|
},
|
|
208
177
|
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
|
|
178
|
+
enumerable: false
|
|
219
179
|
}
|
|
220
180
|
}); // Include (non-enumerable) stack trace.
|
|
221
181
|
|
|
@@ -258,28 +218,32 @@ var GraphQLError = /*#__PURE__*/function (_Error) {
|
|
|
258
218
|
|
|
259
219
|
return GraphQLError;
|
|
260
220
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
221
|
+
|
|
222
|
+
exports.GraphQLError = GraphQLError;
|
|
223
|
+
|
|
224
|
+
function undefinedIfEmpty(array) {
|
|
225
|
+
return array === undefined || array.length === 0 ? undefined : array;
|
|
226
|
+
}
|
|
261
227
|
/**
|
|
262
228
|
* Prints a GraphQLError to a string, representing useful location information
|
|
263
229
|
* about the error's position in the source.
|
|
264
230
|
*/
|
|
265
231
|
|
|
266
232
|
|
|
267
|
-
exports.GraphQLError = GraphQLError;
|
|
268
|
-
|
|
269
233
|
function printError(error) {
|
|
270
234
|
var output = error.message;
|
|
271
235
|
|
|
272
236
|
if (error.nodes) {
|
|
273
|
-
for (var
|
|
274
|
-
var node = _error$nodes2[
|
|
237
|
+
for (var _i4 = 0, _error$nodes2 = error.nodes; _i4 < _error$nodes2.length; _i4++) {
|
|
238
|
+
var node = _error$nodes2[_i4];
|
|
275
239
|
|
|
276
240
|
if (node.loc) {
|
|
277
241
|
output += '\n\n' + (0, _printLocation.printLocation)(node.loc);
|
|
278
242
|
}
|
|
279
243
|
}
|
|
280
244
|
} else if (error.source && error.locations) {
|
|
281
|
-
for (var
|
|
282
|
-
var location = _error$locations2[
|
|
245
|
+
for (var _i6 = 0, _error$locations2 = error.locations; _i6 < _error$locations2.length; _i6++) {
|
|
246
|
+
var location = _error$locations2[_i6];
|
|
283
247
|
output += '\n\n' + (0, _printLocation.printSourceLocation)(error.source, location);
|
|
284
248
|
}
|
|
285
249
|
}
|
|
@@ -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,61 @@ 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
|
+
const originalExtensions = originalError?.extensions;
|
|
107
|
+
|
|
108
|
+
if (extensions == null && isObjectLike(originalExtensions)) {
|
|
109
|
+
this.extensions = { ...originalExtensions };
|
|
110
|
+
} else {
|
|
111
|
+
this.extensions = extensions ?? {};
|
|
136
112
|
}
|
|
137
113
|
|
|
114
|
+
// By being enumerable, JSON.stringify will include bellow properties in the resulting output.
|
|
115
|
+
// This ensures that the simplest possible GraphQL service adheres to the spec.
|
|
138
116
|
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
|
-
},
|
|
117
|
+
message: { enumerable: true },
|
|
148
118
|
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,
|
|
119
|
+
enumerable: this.locations != null,
|
|
156
120
|
},
|
|
157
121
|
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,
|
|
122
|
+
enumerable: this.path != null,
|
|
177
123
|
},
|
|
178
124
|
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,
|
|
125
|
+
enumerable:
|
|
126
|
+
this.extensions != null && Object.keys(this.extensions).length > 0,
|
|
186
127
|
},
|
|
128
|
+
name: { enumerable: false },
|
|
129
|
+
nodes: { enumerable: false },
|
|
130
|
+
source: { enumerable: false },
|
|
131
|
+
positions: { enumerable: false },
|
|
132
|
+
originalError: { enumerable: false },
|
|
187
133
|
});
|
|
188
134
|
|
|
189
135
|
// Include (non-enumerable) stack trace.
|
|
@@ -219,6 +165,12 @@ export class GraphQLError extends Error {
|
|
|
219
165
|
}
|
|
220
166
|
}
|
|
221
167
|
|
|
168
|
+
function undefinedIfEmpty<T>(
|
|
169
|
+
array: $ReadOnlyArray<T> | void,
|
|
170
|
+
): $ReadOnlyArray<T> | void {
|
|
171
|
+
return array === undefined || array.length === 0 ? undefined : array;
|
|
172
|
+
}
|
|
173
|
+
|
|
222
174
|
/**
|
|
223
175
|
* Prints a GraphQLError to a string, representing useful location information
|
|
224
176
|
* 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,79 @@ 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
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
var _source = source;
|
|
109
|
-
|
|
110
|
-
if (!_source && _nodes) {
|
|
111
|
-
var _nodes$0$loc;
|
|
112
|
-
|
|
113
|
-
_source = (_nodes$0$loc = _nodes[0].loc) === null || _nodes$0$loc === void 0 ? void 0 : _nodes$0$loc.source;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
var _positions = positions;
|
|
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
|
-
}
|
|
103
|
+
_this.nodes = undefinedIfEmpty(Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined);
|
|
104
|
+
var nodeLocations = [];
|
|
127
105
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
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;
|
|
131
108
|
|
|
132
|
-
|
|
109
|
+
var _ref4 = _ref3[_i2];
|
|
110
|
+
var loc = _ref4.loc;
|
|
133
111
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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
|
-
}, []);
|
|
112
|
+
if (loc != null) {
|
|
113
|
+
nodeLocations.push(loc);
|
|
114
|
+
}
|
|
146
115
|
}
|
|
147
116
|
|
|
148
|
-
|
|
117
|
+
nodeLocations = undefinedIfEmpty(nodeLocations); // Compute locations in the source for the given nodes/positions.
|
|
118
|
+
|
|
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
|
+
var originalExtensions = originalError === null || originalError === void 0 ? void 0 : originalError.extensions;
|
|
130
|
+
|
|
131
|
+
if (extensions == null && isObjectLike(originalExtensions)) {
|
|
132
|
+
_this.extensions = _objectSpread({}, originalExtensions);
|
|
133
|
+
} else {
|
|
134
|
+
_this.extensions = extensions !== null && extensions !== void 0 ? extensions : {};
|
|
135
|
+
} // By being enumerable, JSON.stringify will include bellow properties in the resulting output.
|
|
136
|
+
// This ensures that the simplest possible GraphQL service adheres to the spec.
|
|
149
137
|
|
|
150
|
-
if (_extensions == null && originalError != null) {
|
|
151
|
-
var originalExtensions = originalError.extensions;
|
|
152
|
-
|
|
153
|
-
if (isObjectLike(originalExtensions)) {
|
|
154
|
-
_extensions = originalExtensions;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
138
|
|
|
158
139
|
Object.defineProperties(_assertThisInitialized(_this), {
|
|
159
|
-
name: {
|
|
160
|
-
value: 'GraphQLError'
|
|
161
|
-
},
|
|
162
140
|
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
|
|
141
|
+
enumerable: true
|
|
169
142
|
},
|
|
170
143
|
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
|
|
144
|
+
enumerable: _this.locations != null
|
|
178
145
|
},
|
|
179
146
|
path: {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
enumerable:
|
|
147
|
+
enumerable: _this.path != null
|
|
148
|
+
},
|
|
149
|
+
extensions: {
|
|
150
|
+
enumerable: _this.extensions != null && Object.keys(_this.extensions).length > 0
|
|
151
|
+
},
|
|
152
|
+
name: {
|
|
153
|
+
enumerable: false
|
|
187
154
|
},
|
|
188
155
|
nodes: {
|
|
189
|
-
|
|
156
|
+
enumerable: false
|
|
190
157
|
},
|
|
191
158
|
source: {
|
|
192
|
-
|
|
159
|
+
enumerable: false
|
|
193
160
|
},
|
|
194
161
|
positions: {
|
|
195
|
-
|
|
162
|
+
enumerable: false
|
|
196
163
|
},
|
|
197
164
|
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
|
|
165
|
+
enumerable: false
|
|
208
166
|
}
|
|
209
167
|
}); // Include (non-enumerable) stack trace.
|
|
210
168
|
|
|
@@ -247,25 +205,30 @@ export var GraphQLError = /*#__PURE__*/function (_Error) {
|
|
|
247
205
|
|
|
248
206
|
return GraphQLError;
|
|
249
207
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
208
|
+
|
|
209
|
+
function undefinedIfEmpty(array) {
|
|
210
|
+
return array === undefined || array.length === 0 ? undefined : array;
|
|
211
|
+
}
|
|
250
212
|
/**
|
|
251
213
|
* Prints a GraphQLError to a string, representing useful location information
|
|
252
214
|
* about the error's position in the source.
|
|
253
215
|
*/
|
|
254
216
|
|
|
217
|
+
|
|
255
218
|
export function printError(error) {
|
|
256
219
|
var output = error.message;
|
|
257
220
|
|
|
258
221
|
if (error.nodes) {
|
|
259
|
-
for (var
|
|
260
|
-
var node = _error$nodes2[
|
|
222
|
+
for (var _i4 = 0, _error$nodes2 = error.nodes; _i4 < _error$nodes2.length; _i4++) {
|
|
223
|
+
var node = _error$nodes2[_i4];
|
|
261
224
|
|
|
262
225
|
if (node.loc) {
|
|
263
226
|
output += '\n\n' + printLocation(node.loc);
|
|
264
227
|
}
|
|
265
228
|
}
|
|
266
229
|
} else if (error.source && error.locations) {
|
|
267
|
-
for (var
|
|
268
|
-
var location = _error$locations2[
|
|
230
|
+
for (var _i6 = 0, _error$locations2 = error.locations; _i6 < _error$locations2.length; _i6++) {
|
|
231
|
+
var location = _error$locations2[_i6];
|
|
269
232
|
output += '\n\n' + printSourceLocation(error.source, location);
|
|
270
233
|
}
|
|
271
234
|
}
|
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
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.2';
|
|
17
17
|
/**
|
|
18
18
|
* An object containing the components of the GraphQL.js version string
|
|
19
19
|
*/
|
|
@@ -21,8 +21,8 @@ var version = '15.6.0';
|
|
|
21
21
|
exports.version = version;
|
|
22
22
|
var versionInfo = Object.freeze({
|
|
23
23
|
major: 15,
|
|
24
|
-
minor:
|
|
25
|
-
patch:
|
|
24
|
+
minor: 7,
|
|
25
|
+
patch: 2,
|
|
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.2';
|
|
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: 2,
|
|
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.2';
|
|
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: 2,
|
|
18
18
|
preReleaseTag: null
|
|
19
19
|
});
|