@salesforce/lds-ads-bridge 1.294.0 → 1.296.0

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/dist/adsBridge.js CHANGED
@@ -12,11 +12,11 @@
12
12
  * *******************************************************************************************
13
13
  */
14
14
  /* proxy-compat-disable */
15
- import { RECORD_ID_PREFIX, RECORD_FIELDS_KEY_JUNCTION, ingestRecord, keyBuilderRecord, keyBuilderObjectInfo } from 'force/ldsAdaptersUiapi';
16
- import { withDefaultLuvio } from 'force/ldsEngine';
15
+ import { ingestRecord, keyBuilderRecord, keyBuilderObjectInfo } from 'force/ldsAdaptersUiapi';
16
+ import { register, withDefaultLuvio } from 'force/ldsEngine';
17
17
 
18
- const { push } = Array.prototype;
19
- const { keys } = Object;
18
+ const { push: push$1 } = Array.prototype;
19
+ const { keys: keys$1 } = Object;
20
20
  const { hasOwnProperty } = Object.prototype;
21
21
  const { parse, stringify } = JSON;
22
22
 
@@ -24,9 +24,4298 @@ const ADS_BRIDGE_ADD_RECORDS_DURATION = 'ads-bridge-add-records-duration';
24
24
  const ADS_BRIDGE_EMIT_RECORD_CHANGED_DURATION = 'ads-bridge-emit-record-changed-duration';
25
25
  const ADS_BRIDGE_EVICT_DURATION = 'ads-bridge-evict-duration';
26
26
 
27
+ // For use by callers within this module to instrument interesting things.
28
+ let instrumentation$1 = {
29
+ timerMetricAddDuration: (_metricName, _valueInMs) => { },
30
+ };
31
+ /**
32
+ * Allows external modules (typically a runtime environment) to set
33
+ * instrumentation hooks for this module. Note that the hooks are
34
+ * incremental - hooks not suppiled in newInstrumentation will retain
35
+ * their previous values. The default instrumentation hooks are no-ops.
36
+ *
37
+ * @param newInstrumentation instrumentation hooks to be overridden
38
+ */
39
+ function instrument$1(newInstrumentation) {
40
+ instrumentation$1 = Object.assign(instrumentation$1, newInstrumentation);
41
+ }
42
+
43
+ var SnapshotState;
44
+ (function (SnapshotState) {
45
+ SnapshotState["Fulfilled"] = "Fulfilled";
46
+ SnapshotState["Unfulfilled"] = "Unfulfilled";
47
+ SnapshotState["Error"] = "Error";
48
+ SnapshotState["Pending"] = "Pending";
49
+ SnapshotState["Stale"] = "Stale";
50
+ })(SnapshotState || (SnapshotState = {}));
51
+
52
+ Promise.resolve();
53
+
54
+ var StoreErrorStatus;
55
+ (function (StoreErrorStatus) {
56
+ StoreErrorStatus[StoreErrorStatus["RESOURCE_NOT_FOUND"] = 404] = "RESOURCE_NOT_FOUND";
57
+ })(StoreErrorStatus || (StoreErrorStatus = {}));
58
+ var StoreRecordType;
59
+ (function (StoreRecordType) {
60
+ StoreRecordType["Error"] = "error";
61
+ })(StoreRecordType || (StoreRecordType = {}));
62
+ var StoreLinkStateValues$1;
63
+ (function (StoreLinkStateValues) {
64
+ StoreLinkStateValues[StoreLinkStateValues["NotPresent"] = 0] = "NotPresent";
65
+ StoreLinkStateValues[StoreLinkStateValues["RefNotPresent"] = 1] = "RefNotPresent";
66
+ StoreLinkStateValues[StoreLinkStateValues["RefPresent"] = 2] = "RefPresent";
67
+ StoreLinkStateValues[StoreLinkStateValues["Null"] = 3] = "Null";
68
+ StoreLinkStateValues[StoreLinkStateValues["Missing"] = 4] = "Missing";
69
+ StoreLinkStateValues[StoreLinkStateValues["Pending"] = 5] = "Pending";
70
+ })(StoreLinkStateValues$1 || (StoreLinkStateValues$1 = {}));
71
+ var StoreResolveResultState;
72
+ (function (StoreResolveResultState) {
73
+ StoreResolveResultState[StoreResolveResultState["Found"] = 0] = "Found";
74
+ StoreResolveResultState[StoreResolveResultState["Error"] = 1] = "Error";
75
+ StoreResolveResultState[StoreResolveResultState["Null"] = 2] = "Null";
76
+ StoreResolveResultState[StoreResolveResultState["NotPresent"] = 3] = "NotPresent";
77
+ StoreResolveResultState[StoreResolveResultState["Stale"] = 4] = "Stale";
78
+ })(StoreResolveResultState || (StoreResolveResultState = {}));
79
+ var HttpStatusCode;
80
+ (function (HttpStatusCode) {
81
+ HttpStatusCode[HttpStatusCode["Ok"] = 200] = "Ok";
82
+ HttpStatusCode[HttpStatusCode["Created"] = 201] = "Created";
83
+ HttpStatusCode[HttpStatusCode["NoContent"] = 204] = "NoContent";
84
+ HttpStatusCode[HttpStatusCode["NotModified"] = 304] = "NotModified";
85
+ HttpStatusCode[HttpStatusCode["BadRequest"] = 400] = "BadRequest";
86
+ HttpStatusCode[HttpStatusCode["Unauthorized"] = 401] = "Unauthorized";
87
+ HttpStatusCode[HttpStatusCode["Forbidden"] = 403] = "Forbidden";
88
+ HttpStatusCode[HttpStatusCode["NotFound"] = 404] = "NotFound";
89
+ HttpStatusCode[HttpStatusCode["ServerError"] = 500] = "ServerError";
90
+ HttpStatusCode[HttpStatusCode["GatewayTimeout"] = 504] = "GatewayTimeout";
91
+ })(HttpStatusCode || (HttpStatusCode = {}));
92
+ var GraphNodeType;
93
+ (function (GraphNodeType) {
94
+ GraphNodeType["Link"] = "Link";
95
+ GraphNodeType["Node"] = "Node";
96
+ GraphNodeType["Error"] = "Error";
97
+ GraphNodeType["Locked"] = "Locked";
98
+ })(GraphNodeType || (GraphNodeType = {}));
99
+
100
+ var StoreLinkStateValues;
101
+ (function (StoreLinkStateValues) {
102
+ StoreLinkStateValues[StoreLinkStateValues["NotPresent"] = 0] = "NotPresent";
103
+ StoreLinkStateValues[StoreLinkStateValues["RefNotPresent"] = 1] = "RefNotPresent";
104
+ StoreLinkStateValues[StoreLinkStateValues["RefPresent"] = 2] = "RefPresent";
105
+ StoreLinkStateValues[StoreLinkStateValues["Null"] = 3] = "Null";
106
+ StoreLinkStateValues[StoreLinkStateValues["Missing"] = 4] = "Missing";
107
+ StoreLinkStateValues[StoreLinkStateValues["Pending"] = 5] = "Pending";
108
+ })(StoreLinkStateValues || (StoreLinkStateValues = {}));
109
+ var FragmentReadResultState;
110
+ (function (FragmentReadResultState) {
111
+ FragmentReadResultState[FragmentReadResultState["Missing"] = 0] = "Missing";
112
+ FragmentReadResultState[FragmentReadResultState["Success"] = 1] = "Success";
113
+ FragmentReadResultState[FragmentReadResultState["Error"] = 2] = "Error";
114
+ })(FragmentReadResultState || (FragmentReadResultState = {}));
115
+ ({
116
+ state: FragmentReadResultState.Missing,
117
+ });
118
+
119
+ var ResourceParamType;
120
+ (function (ResourceParamType) {
121
+ ResourceParamType[ResourceParamType["UrlParameter"] = 0] = "UrlParameter";
122
+ ResourceParamType[ResourceParamType["QueryParameter"] = 1] = "QueryParameter";
123
+ ResourceParamType[ResourceParamType["Body"] = 2] = "Body";
124
+ ResourceParamType[ResourceParamType["Header"] = 3] = "Header";
125
+ })(ResourceParamType || (ResourceParamType = {}));
126
+ var TypeCheckShapes;
127
+ (function (TypeCheckShapes) {
128
+ TypeCheckShapes[TypeCheckShapes["String"] = 0] = "String";
129
+ TypeCheckShapes[TypeCheckShapes["Boolean"] = 1] = "Boolean";
130
+ TypeCheckShapes[TypeCheckShapes["Number"] = 2] = "Number";
131
+ TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
132
+ TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
133
+ })(TypeCheckShapes || (TypeCheckShapes = {}));
134
+ // engine version: 0.154.20-1c52d927
135
+
136
+ /**
137
+ * Returns true if the value acts like a Promise, i.e. has a "then" function,
138
+ * otherwise returns false.
139
+ */
140
+ // eslint-disable-next-line no-redeclare
141
+
142
+ function _typeof$4(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$4 = function _typeof(obj) { return typeof obj; }; } else { _typeof$4 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$4(obj); }
143
+
144
+ /**
145
+ * Return true if `value` is object-like. A value is object-like if it's not
146
+ * `null` and has a `typeof` result of "object".
147
+ */
148
+ function isObjectLike(value) {
149
+ return _typeof$4(value) == 'object' && value !== null;
150
+ }
151
+
152
+ // In ES2015 (or a polyfilled) environment, this will be Symbol.iterator
153
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
154
+ var SYMBOL_ITERATOR = typeof Symbol === 'function' && Symbol.iterator != null ? Symbol.iterator : '@@iterator'; // In ES2017 (or a polyfilled) environment, this will be Symbol.asyncIterator
155
+
156
+ var SYMBOL_TO_STRING_TAG = typeof Symbol === 'function' && Symbol.toStringTag != null ? Symbol.toStringTag : '@@toStringTag';
157
+
158
+ /**
159
+ * Represents a location in a Source.
160
+ */
161
+
162
+ /**
163
+ * Takes a Source and a UTF-8 character offset, and returns the corresponding
164
+ * line and column as a SourceLocation.
165
+ */
166
+ function getLocation(source, position) {
167
+ var lineRegexp = /\r\n|[\n\r]/g;
168
+ var line = 1;
169
+ var column = position + 1;
170
+ var match;
171
+
172
+ while ((match = lineRegexp.exec(source.body)) && match.index < position) {
173
+ line += 1;
174
+ column = position + 1 - (match.index + match[0].length);
175
+ }
176
+
177
+ return {
178
+ line: line,
179
+ column: column
180
+ };
181
+ }
182
+
183
+ /**
184
+ * Render a helpful description of the location in the GraphQL Source document.
185
+ */
186
+
187
+ function printLocation(location) {
188
+ return printSourceLocation(location.source, getLocation(location.source, location.start));
189
+ }
190
+ /**
191
+ * Render a helpful description of the location in the GraphQL Source document.
192
+ */
193
+
194
+ function printSourceLocation(source, sourceLocation) {
195
+ var firstLineColumnOffset = source.locationOffset.column - 1;
196
+ var body = whitespace(firstLineColumnOffset) + source.body;
197
+ var lineIndex = sourceLocation.line - 1;
198
+ var lineOffset = source.locationOffset.line - 1;
199
+ var lineNum = sourceLocation.line + lineOffset;
200
+ var columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0;
201
+ var columnNum = sourceLocation.column + columnOffset;
202
+ var locationStr = "".concat(source.name, ":").concat(lineNum, ":").concat(columnNum, "\n");
203
+ var lines = body.split(/\r\n|[\n\r]/g);
204
+ var locationLine = lines[lineIndex]; // Special case for minified documents
205
+
206
+ if (locationLine.length > 120) {
207
+ var subLineIndex = Math.floor(columnNum / 80);
208
+ var subLineColumnNum = columnNum % 80;
209
+ var subLines = [];
210
+
211
+ for (var i = 0; i < locationLine.length; i += 80) {
212
+ subLines.push(locationLine.slice(i, i + 80));
213
+ }
214
+
215
+ return locationStr + printPrefixedLines([["".concat(lineNum), subLines[0]]].concat(subLines.slice(1, subLineIndex + 1).map(function (subLine) {
216
+ return ['', subLine];
217
+ }), [[' ', whitespace(subLineColumnNum - 1) + '^'], ['', subLines[subLineIndex + 1]]]));
218
+ }
219
+
220
+ return locationStr + printPrefixedLines([// Lines specified like this: ["prefix", "string"],
221
+ ["".concat(lineNum - 1), lines[lineIndex - 1]], ["".concat(lineNum), locationLine], ['', whitespace(columnNum - 1) + '^'], ["".concat(lineNum + 1), lines[lineIndex + 1]]]);
222
+ }
223
+
224
+ function printPrefixedLines(lines) {
225
+ var existingLines = lines.filter(function (_ref) {
226
+ _ref[0];
227
+ var line = _ref[1];
228
+ return line !== undefined;
229
+ });
230
+ var padLen = Math.max.apply(Math, existingLines.map(function (_ref2) {
231
+ var prefix = _ref2[0];
232
+ return prefix.length;
233
+ }));
234
+ return existingLines.map(function (_ref3) {
235
+ var prefix = _ref3[0],
236
+ line = _ref3[1];
237
+ return leftPad(padLen, prefix) + (line ? ' | ' + line : ' |');
238
+ }).join('\n');
239
+ }
240
+
241
+ function whitespace(len) {
242
+ return Array(len + 1).join(' ');
243
+ }
244
+
245
+ function leftPad(len, str) {
246
+ return whitespace(len - str.length) + str;
247
+ }
248
+
249
+ function _typeof$3(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$3 = function _typeof(obj) { return typeof obj; }; } else { _typeof$3 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$3(obj); }
250
+
251
+ function ownKeys$1(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; }
252
+
253
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
254
+
255
+ function _defineProperty$2(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; }
256
+
257
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
258
+
259
+ function _defineProperties$4(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); } }
260
+
261
+ function _createClass$4(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$4(Constructor.prototype, protoProps); if (staticProps) _defineProperties$4(Constructor, staticProps); return Constructor; }
262
+
263
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
264
+
265
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
266
+
267
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof$3(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
268
+
269
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
270
+
271
+ function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
272
+
273
+ function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
274
+
275
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
276
+
277
+ function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
278
+
279
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
280
+
281
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
282
+ /**
283
+ * A GraphQLError describes an Error found during the parse, validate, or
284
+ * execute phases of performing a GraphQL operation. In addition to a message
285
+ * and stack trace, it also includes information about the locations in a
286
+ * GraphQL document and/or execution result that correspond to the Error.
287
+ */
288
+
289
+ var GraphQLError = /*#__PURE__*/function (_Error) {
290
+ _inherits(GraphQLError, _Error);
291
+
292
+ var _super = _createSuper(GraphQLError);
293
+
294
+ /**
295
+ * An array of { line, column } locations within the source GraphQL document
296
+ * which correspond to this error.
297
+ *
298
+ * Errors during validation often contain multiple locations, for example to
299
+ * point out two things with the same name. Errors during execution include a
300
+ * single location, the field which produced the error.
301
+ *
302
+ * Enumerable, and appears in the result of JSON.stringify().
303
+ */
304
+
305
+ /**
306
+ * An array describing the JSON-path into the execution response which
307
+ * corresponds to this error. Only included for errors during execution.
308
+ *
309
+ * Enumerable, and appears in the result of JSON.stringify().
310
+ */
311
+
312
+ /**
313
+ * An array of GraphQL AST Nodes corresponding to this error.
314
+ */
315
+
316
+ /**
317
+ * The source GraphQL document for the first location of this error.
318
+ *
319
+ * Note that if this Error represents more than one node, the source may not
320
+ * represent nodes after the first node.
321
+ */
322
+
323
+ /**
324
+ * An array of character offsets within the source GraphQL document
325
+ * which correspond to this error.
326
+ */
327
+
328
+ /**
329
+ * The original error thrown from a field resolver during execution.
330
+ */
331
+
332
+ /**
333
+ * Extension fields to add to the formatted error.
334
+ */
335
+ function GraphQLError(message, nodes, source, positions, path, originalError, extensions) {
336
+ var _nodeLocations, _nodeLocations2, _nodeLocations3;
337
+
338
+ var _this;
339
+
340
+ _classCallCheck(this, GraphQLError);
341
+
342
+ _this = _super.call(this, message);
343
+ _this.name = 'GraphQLError';
344
+ _this.originalError = originalError !== null && originalError !== void 0 ? originalError : undefined; // Compute list of blame nodes.
345
+
346
+ _this.nodes = undefinedIfEmpty(Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined);
347
+ var nodeLocations = [];
348
+
349
+ for (var _i2 = 0, _ref3 = (_this$nodes = _this.nodes) !== null && _this$nodes !== void 0 ? _this$nodes : []; _i2 < _ref3.length; _i2++) {
350
+ var _this$nodes;
351
+
352
+ var _ref4 = _ref3[_i2];
353
+ var loc = _ref4.loc;
354
+
355
+ if (loc != null) {
356
+ nodeLocations.push(loc);
357
+ }
358
+ }
359
+
360
+ nodeLocations = undefinedIfEmpty(nodeLocations); // Compute locations in the source for the given nodes/positions.
361
+
362
+ _this.source = source !== null && source !== void 0 ? source : (_nodeLocations = nodeLocations) === null || _nodeLocations === void 0 ? void 0 : _nodeLocations[0].source;
363
+ _this.positions = positions !== null && positions !== void 0 ? positions : (_nodeLocations2 = nodeLocations) === null || _nodeLocations2 === void 0 ? void 0 : _nodeLocations2.map(function (loc) {
364
+ return loc.start;
365
+ });
366
+ _this.locations = positions && source ? positions.map(function (pos) {
367
+ return getLocation(source, pos);
368
+ }) : (_nodeLocations3 = nodeLocations) === null || _nodeLocations3 === void 0 ? void 0 : _nodeLocations3.map(function (loc) {
369
+ return getLocation(loc.source, loc.start);
370
+ });
371
+ _this.path = path !== null && path !== void 0 ? path : undefined;
372
+ var originalExtensions = originalError === null || originalError === void 0 ? void 0 : originalError.extensions;
373
+
374
+ if (extensions == null && isObjectLike(originalExtensions)) {
375
+ _this.extensions = _objectSpread$1({}, originalExtensions);
376
+ } else {
377
+ _this.extensions = extensions !== null && extensions !== void 0 ? extensions : {};
378
+ } // By being enumerable, JSON.stringify will include bellow properties in the resulting output.
379
+ // This ensures that the simplest possible GraphQL service adheres to the spec.
380
+
381
+
382
+ Object.defineProperties(_assertThisInitialized(_this), {
383
+ message: {
384
+ enumerable: true
385
+ },
386
+ locations: {
387
+ enumerable: _this.locations != null
388
+ },
389
+ path: {
390
+ enumerable: _this.path != null
391
+ },
392
+ extensions: {
393
+ enumerable: _this.extensions != null && Object.keys(_this.extensions).length > 0
394
+ },
395
+ name: {
396
+ enumerable: false
397
+ },
398
+ nodes: {
399
+ enumerable: false
400
+ },
401
+ source: {
402
+ enumerable: false
403
+ },
404
+ positions: {
405
+ enumerable: false
406
+ },
407
+ originalError: {
408
+ enumerable: false
409
+ }
410
+ }); // Include (non-enumerable) stack trace.
411
+
412
+ if (originalError !== null && originalError !== void 0 && originalError.stack) {
413
+ Object.defineProperty(_assertThisInitialized(_this), 'stack', {
414
+ value: originalError.stack,
415
+ writable: true,
416
+ configurable: true
417
+ });
418
+ return _possibleConstructorReturn(_this);
419
+ } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
420
+
421
+
422
+ if (Error.captureStackTrace) {
423
+ Error.captureStackTrace(_assertThisInitialized(_this), GraphQLError);
424
+ } else {
425
+ Object.defineProperty(_assertThisInitialized(_this), 'stack', {
426
+ value: Error().stack,
427
+ writable: true,
428
+ configurable: true
429
+ });
430
+ }
431
+
432
+ return _this;
433
+ }
434
+
435
+ _createClass$4(GraphQLError, [{
436
+ key: "toString",
437
+ value: function toString() {
438
+ return printError(this);
439
+ } // FIXME: workaround to not break chai comparisons, should be remove in v16
440
+ // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
441
+
442
+ }, {
443
+ key: SYMBOL_TO_STRING_TAG,
444
+ get: function get() {
445
+ return 'Object';
446
+ }
447
+ }]);
448
+
449
+ return GraphQLError;
450
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
451
+
452
+ function undefinedIfEmpty(array) {
453
+ return array === undefined || array.length === 0 ? undefined : array;
454
+ }
455
+ /**
456
+ * Prints a GraphQLError to a string, representing useful location information
457
+ * about the error's position in the source.
458
+ */
459
+
460
+
461
+ function printError(error) {
462
+ var output = error.message;
463
+
464
+ if (error.nodes) {
465
+ for (var _i4 = 0, _error$nodes2 = error.nodes; _i4 < _error$nodes2.length; _i4++) {
466
+ var node = _error$nodes2[_i4];
467
+
468
+ if (node.loc) {
469
+ output += '\n\n' + printLocation(node.loc);
470
+ }
471
+ }
472
+ } else if (error.source && error.locations) {
473
+ for (var _i6 = 0, _error$locations2 = error.locations; _i6 < _error$locations2.length; _i6++) {
474
+ var location = _error$locations2[_i6];
475
+ output += '\n\n' + printSourceLocation(error.source, location);
476
+ }
477
+ }
478
+
479
+ return output;
480
+ }
481
+
482
+ /**
483
+ * The set of allowed kind values for AST nodes.
484
+ */
485
+ var Kind = Object.freeze({
486
+ // Name
487
+ NAME: 'Name',
488
+ // Document
489
+ DOCUMENT: 'Document',
490
+ OPERATION_DEFINITION: 'OperationDefinition',
491
+ VARIABLE_DEFINITION: 'VariableDefinition',
492
+ SELECTION_SET: 'SelectionSet',
493
+ FIELD: 'Field',
494
+ ARGUMENT: 'Argument',
495
+ // Fragments
496
+ FRAGMENT_SPREAD: 'FragmentSpread',
497
+ INLINE_FRAGMENT: 'InlineFragment',
498
+ FRAGMENT_DEFINITION: 'FragmentDefinition',
499
+ // Values
500
+ VARIABLE: 'Variable',
501
+ INT: 'IntValue',
502
+ FLOAT: 'FloatValue',
503
+ STRING: 'StringValue',
504
+ BOOLEAN: 'BooleanValue',
505
+ NULL: 'NullValue',
506
+ ENUM: 'EnumValue',
507
+ LIST: 'ListValue',
508
+ OBJECT: 'ObjectValue',
509
+ OBJECT_FIELD: 'ObjectField',
510
+ // Directives
511
+ DIRECTIVE: 'Directive',
512
+ // Types
513
+ NAMED_TYPE: 'NamedType',
514
+ LIST_TYPE: 'ListType',
515
+ NON_NULL_TYPE: 'NonNullType',
516
+ // Type System Definitions
517
+ SCHEMA_DEFINITION: 'SchemaDefinition',
518
+ OPERATION_TYPE_DEFINITION: 'OperationTypeDefinition',
519
+ // Type Definitions
520
+ SCALAR_TYPE_DEFINITION: 'ScalarTypeDefinition',
521
+ OBJECT_TYPE_DEFINITION: 'ObjectTypeDefinition',
522
+ FIELD_DEFINITION: 'FieldDefinition',
523
+ INPUT_VALUE_DEFINITION: 'InputValueDefinition',
524
+ INTERFACE_TYPE_DEFINITION: 'InterfaceTypeDefinition',
525
+ UNION_TYPE_DEFINITION: 'UnionTypeDefinition',
526
+ ENUM_TYPE_DEFINITION: 'EnumTypeDefinition',
527
+ ENUM_VALUE_DEFINITION: 'EnumValueDefinition',
528
+ INPUT_OBJECT_TYPE_DEFINITION: 'InputObjectTypeDefinition',
529
+ // Directive Definitions
530
+ DIRECTIVE_DEFINITION: 'DirectiveDefinition',
531
+ // Type System Extensions
532
+ SCHEMA_EXTENSION: 'SchemaExtension',
533
+ // Type Extensions
534
+ SCALAR_TYPE_EXTENSION: 'ScalarTypeExtension',
535
+ OBJECT_TYPE_EXTENSION: 'ObjectTypeExtension',
536
+ INTERFACE_TYPE_EXTENSION: 'InterfaceTypeExtension',
537
+ UNION_TYPE_EXTENSION: 'UnionTypeExtension',
538
+ ENUM_TYPE_EXTENSION: 'EnumTypeExtension',
539
+ INPUT_OBJECT_TYPE_EXTENSION: 'InputObjectTypeExtension'
540
+ });
541
+ /**
542
+ * The enum type representing the possible kind values of AST nodes.
543
+ */
544
+
545
+ function invariant(condition, message) {
546
+ var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js')
547
+
548
+ if (!booleanCondition) {
549
+ throw new Error(message != null ? message : 'Unexpected invariant triggered.');
550
+ }
551
+ }
552
+
553
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
554
+ var nodejsCustomInspectSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for('nodejs.util.inspect.custom') : undefined;
555
+ var nodejsCustomInspectSymbol$1 = nodejsCustomInspectSymbol;
556
+
557
+ /**
558
+ * The `defineInspect()` function defines `inspect()` prototype method as alias of `toJSON`
559
+ */
560
+
561
+ function defineInspect(classObject) {
562
+ var fn = classObject.prototype.toJSON;
563
+ typeof fn === 'function' || invariant(0);
564
+ classObject.prototype.inspect = fn; // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2317')
565
+
566
+ if (nodejsCustomInspectSymbol$1) {
567
+ classObject.prototype[nodejsCustomInspectSymbol$1] = fn;
568
+ }
569
+ }
570
+
571
+ /**
572
+ * Contains a range of UTF-8 character offsets and token references that
573
+ * identify the region of the source from which the AST derived.
574
+ */
575
+ var Location = /*#__PURE__*/function () {
576
+ /**
577
+ * The character offset at which this Node begins.
578
+ */
579
+
580
+ /**
581
+ * The character offset at which this Node ends.
582
+ */
583
+
584
+ /**
585
+ * The Token at which this Node begins.
586
+ */
587
+
588
+ /**
589
+ * The Token at which this Node ends.
590
+ */
591
+
592
+ /**
593
+ * The Source document the AST represents.
594
+ */
595
+ function Location(startToken, endToken, source) {
596
+ this.start = startToken.start;
597
+ this.end = endToken.end;
598
+ this.startToken = startToken;
599
+ this.endToken = endToken;
600
+ this.source = source;
601
+ }
602
+
603
+ var _proto = Location.prototype;
604
+
605
+ _proto.toJSON = function toJSON() {
606
+ return {
607
+ start: this.start,
608
+ end: this.end
609
+ };
610
+ };
611
+
612
+ return Location;
613
+ }(); // Print a simplified form when appearing in `inspect` and `util.inspect`.
614
+
615
+ defineInspect(Location);
616
+ /**
617
+ * Represents a range of characters represented by a lexical token
618
+ * within a Source.
619
+ */
620
+
621
+ var Token = /*#__PURE__*/function () {
622
+ /**
623
+ * The kind of Token.
624
+ */
625
+
626
+ /**
627
+ * The character offset at which this Node begins.
628
+ */
629
+
630
+ /**
631
+ * The character offset at which this Node ends.
632
+ */
633
+
634
+ /**
635
+ * The 1-indexed line number on which this Token appears.
636
+ */
637
+
638
+ /**
639
+ * The 1-indexed column number at which this Token begins.
640
+ */
641
+
642
+ /**
643
+ * For non-punctuation tokens, represents the interpreted value of the token.
644
+ */
645
+
646
+ /**
647
+ * Tokens exist as nodes in a double-linked-list amongst all tokens
648
+ * including ignored tokens. <SOF> is always the first node and <EOF>
649
+ * the last.
650
+ */
651
+ function Token(kind, start, end, line, column, prev, value) {
652
+ this.kind = kind;
653
+ this.start = start;
654
+ this.end = end;
655
+ this.line = line;
656
+ this.column = column;
657
+ this.value = value;
658
+ this.prev = prev;
659
+ this.next = null;
660
+ }
661
+
662
+ var _proto2 = Token.prototype;
663
+
664
+ _proto2.toJSON = function toJSON() {
665
+ return {
666
+ kind: this.kind,
667
+ value: this.value,
668
+ line: this.line,
669
+ column: this.column
670
+ };
671
+ };
672
+
673
+ return Token;
674
+ }(); // Print a simplified form when appearing in `inspect` and `util.inspect`.
675
+
676
+ defineInspect(Token);
677
+ /**
678
+ * @internal
679
+ */
680
+
681
+ function isNode(maybeNode) {
682
+ return maybeNode != null && typeof maybeNode.kind === 'string';
683
+ }
684
+ /**
685
+ * The enum type representing the token kinds values.
686
+ */
687
+
688
+ function _typeof$2(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$2 = function _typeof(obj) { return typeof obj; }; } else { _typeof$2 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$2(obj); }
689
+ var MAX_ARRAY_LENGTH = 10;
690
+ var MAX_RECURSIVE_DEPTH = 2;
691
+ /**
692
+ * Used to print values in error messages.
693
+ */
694
+
695
+ function inspect(value) {
696
+ return formatValue(value, []);
697
+ }
698
+
699
+ function formatValue(value, seenValues) {
700
+ switch (_typeof$2(value)) {
701
+ case 'string':
702
+ return JSON.stringify(value);
703
+
704
+ case 'function':
705
+ return value.name ? "[function ".concat(value.name, "]") : '[function]';
706
+
707
+ case 'object':
708
+ if (value === null) {
709
+ return 'null';
710
+ }
711
+
712
+ return formatObjectValue(value, seenValues);
713
+
714
+ default:
715
+ return String(value);
716
+ }
717
+ }
718
+
719
+ function formatObjectValue(value, previouslySeenValues) {
720
+ if (previouslySeenValues.indexOf(value) !== -1) {
721
+ return '[Circular]';
722
+ }
723
+
724
+ var seenValues = [].concat(previouslySeenValues, [value]);
725
+ var customInspectFn = getCustomFn(value);
726
+
727
+ if (customInspectFn !== undefined) {
728
+ var customValue = customInspectFn.call(value); // check for infinite recursion
729
+
730
+ if (customValue !== value) {
731
+ return typeof customValue === 'string' ? customValue : formatValue(customValue, seenValues);
732
+ }
733
+ } else if (Array.isArray(value)) {
734
+ return formatArray(value, seenValues);
735
+ }
736
+
737
+ return formatObject(value, seenValues);
738
+ }
739
+
740
+ function formatObject(object, seenValues) {
741
+ var keys = Object.keys(object);
742
+
743
+ if (keys.length === 0) {
744
+ return '{}';
745
+ }
746
+
747
+ if (seenValues.length > MAX_RECURSIVE_DEPTH) {
748
+ return '[' + getObjectTag(object) + ']';
749
+ }
750
+
751
+ var properties = keys.map(function (key) {
752
+ var value = formatValue(object[key], seenValues);
753
+ return key + ': ' + value;
754
+ });
755
+ return '{ ' + properties.join(', ') + ' }';
756
+ }
757
+
758
+ function formatArray(array, seenValues) {
759
+ if (array.length === 0) {
760
+ return '[]';
761
+ }
762
+
763
+ if (seenValues.length > MAX_RECURSIVE_DEPTH) {
764
+ return '[Array]';
765
+ }
766
+
767
+ var len = Math.min(MAX_ARRAY_LENGTH, array.length);
768
+ var remaining = array.length - len;
769
+ var items = [];
770
+
771
+ for (var i = 0; i < len; ++i) {
772
+ items.push(formatValue(array[i], seenValues));
773
+ }
774
+
775
+ if (remaining === 1) {
776
+ items.push('... 1 more item');
777
+ } else if (remaining > 1) {
778
+ items.push("... ".concat(remaining, " more items"));
779
+ }
780
+
781
+ return '[' + items.join(', ') + ']';
782
+ }
783
+
784
+ function getCustomFn(object) {
785
+ var customInspectFn = object[String(nodejsCustomInspectSymbol$1)];
786
+
787
+ if (typeof customInspectFn === 'function') {
788
+ return customInspectFn;
789
+ }
790
+
791
+ if (typeof object.inspect === 'function') {
792
+ return object.inspect;
793
+ }
794
+ }
795
+
796
+ function getObjectTag(object) {
797
+ var tag = Object.prototype.toString.call(object).replace(/^\[object /, '').replace(/]$/, '');
798
+
799
+ if (tag === 'Object' && typeof object.constructor === 'function') {
800
+ var name = object.constructor.name;
801
+
802
+ if (typeof name === 'string' && name !== '') {
803
+ return name;
804
+ }
805
+ }
806
+
807
+ return tag;
808
+ }
809
+
810
+ function devAssert(condition, message) {
811
+ var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js')
812
+
813
+ if (!booleanCondition) {
814
+ throw new Error(message);
815
+ }
816
+ }
817
+
818
+ function _typeof$1(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); }
819
+ /**
820
+ * A replacement for instanceof which includes an error warning when multi-realm
821
+ * constructors are detected.
822
+ */
823
+
824
+ // See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production
825
+ // See: https://webpack.js.org/guides/production/
826
+ var instanceOf = process.env.NODE_ENV === 'production' ? // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
827
+ // eslint-disable-next-line no-shadow
828
+ function instanceOf(value, constructor) {
829
+ return value instanceof constructor;
830
+ } : // eslint-disable-next-line no-shadow
831
+ function instanceOf(value, constructor) {
832
+ if (value instanceof constructor) {
833
+ return true;
834
+ }
835
+
836
+ if (_typeof$1(value) === 'object' && value !== null) {
837
+ var _value$constructor;
838
+
839
+ var className = constructor.prototype[Symbol.toStringTag];
840
+ var valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library.
841
+ Symbol.toStringTag in value ? value[Symbol.toStringTag] : (_value$constructor = value.constructor) === null || _value$constructor === void 0 ? void 0 : _value$constructor.name;
842
+
843
+ if (className === valueClassName) {
844
+ var stringifiedValue = inspect(value);
845
+ throw new Error("Cannot use ".concat(className, " \"").concat(stringifiedValue, "\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results."));
846
+ }
847
+ }
848
+
849
+ return false;
850
+ };
851
+
852
+ /**
853
+ * The set of allowed directive location values.
854
+ */
855
+ var DirectiveLocation = Object.freeze({
856
+ // Request Definitions
857
+ QUERY: 'QUERY',
858
+ MUTATION: 'MUTATION',
859
+ SUBSCRIPTION: 'SUBSCRIPTION',
860
+ FIELD: 'FIELD',
861
+ FRAGMENT_DEFINITION: 'FRAGMENT_DEFINITION',
862
+ FRAGMENT_SPREAD: 'FRAGMENT_SPREAD',
863
+ INLINE_FRAGMENT: 'INLINE_FRAGMENT',
864
+ VARIABLE_DEFINITION: 'VARIABLE_DEFINITION',
865
+ // Type System Definitions
866
+ SCHEMA: 'SCHEMA',
867
+ SCALAR: 'SCALAR',
868
+ OBJECT: 'OBJECT',
869
+ FIELD_DEFINITION: 'FIELD_DEFINITION',
870
+ ARGUMENT_DEFINITION: 'ARGUMENT_DEFINITION',
871
+ INTERFACE: 'INTERFACE',
872
+ UNION: 'UNION',
873
+ ENUM: 'ENUM',
874
+ ENUM_VALUE: 'ENUM_VALUE',
875
+ INPUT_OBJECT: 'INPUT_OBJECT',
876
+ INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION'
877
+ });
878
+ /**
879
+ * Print a block string in the indented block form by adding a leading and
880
+ * trailing blank line. However, if a block string starts with whitespace and is
881
+ * a single-line, adding a leading blank line would strip that whitespace.
882
+ *
883
+ * @internal
884
+ */
885
+
886
+ function printBlockString(value) {
887
+ var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
888
+ var preferMultipleLines = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
889
+ var isSingleLine = value.indexOf('\n') === -1;
890
+ var hasLeadingSpace = value[0] === ' ' || value[0] === '\t';
891
+ var hasTrailingQuote = value[value.length - 1] === '"';
892
+ var hasTrailingSlash = value[value.length - 1] === '\\';
893
+ var printAsMultipleLines = !isSingleLine || hasTrailingQuote || hasTrailingSlash || preferMultipleLines;
894
+ var result = ''; // Format a multi-line block quote to account for leading space.
895
+
896
+ if (printAsMultipleLines && !(isSingleLine && hasLeadingSpace)) {
897
+ result += '\n' + indentation;
898
+ }
899
+
900
+ result += indentation ? value.replace(/\n/g, '\n' + indentation) : value;
901
+
902
+ if (printAsMultipleLines) {
903
+ result += '\n';
904
+ }
905
+
906
+ return '"""' + result.replace(/"""/g, '\\"""') + '"""';
907
+ }
908
+
909
+ /**
910
+ * A visitor is provided to visit, it contains the collection of
911
+ * relevant functions to be called during the visitor's traversal.
912
+ */
913
+
914
+ var QueryDocumentKeys = {
915
+ Name: [],
916
+ Document: ['definitions'],
917
+ OperationDefinition: ['name', 'variableDefinitions', 'directives', 'selectionSet'],
918
+ VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'],
919
+ Variable: ['name'],
920
+ SelectionSet: ['selections'],
921
+ Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'],
922
+ Argument: ['name', 'value'],
923
+ FragmentSpread: ['name', 'directives'],
924
+ InlineFragment: ['typeCondition', 'directives', 'selectionSet'],
925
+ FragmentDefinition: ['name', // Note: fragment variable definitions are experimental and may be changed
926
+ // or removed in the future.
927
+ 'variableDefinitions', 'typeCondition', 'directives', 'selectionSet'],
928
+ IntValue: [],
929
+ FloatValue: [],
930
+ StringValue: [],
931
+ BooleanValue: [],
932
+ NullValue: [],
933
+ EnumValue: [],
934
+ ListValue: ['values'],
935
+ ObjectValue: ['fields'],
936
+ ObjectField: ['name', 'value'],
937
+ Directive: ['name', 'arguments'],
938
+ NamedType: ['name'],
939
+ ListType: ['type'],
940
+ NonNullType: ['type'],
941
+ SchemaDefinition: ['description', 'directives', 'operationTypes'],
942
+ OperationTypeDefinition: ['type'],
943
+ ScalarTypeDefinition: ['description', 'name', 'directives'],
944
+ ObjectTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'],
945
+ FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'],
946
+ InputValueDefinition: ['description', 'name', 'type', 'defaultValue', 'directives'],
947
+ InterfaceTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'],
948
+ UnionTypeDefinition: ['description', 'name', 'directives', 'types'],
949
+ EnumTypeDefinition: ['description', 'name', 'directives', 'values'],
950
+ EnumValueDefinition: ['description', 'name', 'directives'],
951
+ InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'],
952
+ DirectiveDefinition: ['description', 'name', 'arguments', 'locations'],
953
+ SchemaExtension: ['directives', 'operationTypes'],
954
+ ScalarTypeExtension: ['name', 'directives'],
955
+ ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'],
956
+ InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'],
957
+ UnionTypeExtension: ['name', 'directives', 'types'],
958
+ EnumTypeExtension: ['name', 'directives', 'values'],
959
+ InputObjectTypeExtension: ['name', 'directives', 'fields']
960
+ };
961
+ var BREAK = Object.freeze({});
962
+ /**
963
+ * visit() will walk through an AST using a depth-first traversal, calling
964
+ * the visitor's enter function at each node in the traversal, and calling the
965
+ * leave function after visiting that node and all of its child nodes.
966
+ *
967
+ * By returning different values from the enter and leave functions, the
968
+ * behavior of the visitor can be altered, including skipping over a sub-tree of
969
+ * the AST (by returning false), editing the AST by returning a value or null
970
+ * to remove the value, or to stop the whole traversal by returning BREAK.
971
+ *
972
+ * When using visit() to edit an AST, the original AST will not be modified, and
973
+ * a new version of the AST with the changes applied will be returned from the
974
+ * visit function.
975
+ *
976
+ * const editedAST = visit(ast, {
977
+ * enter(node, key, parent, path, ancestors) {
978
+ * // @return
979
+ * // undefined: no action
980
+ * // false: skip visiting this node
981
+ * // visitor.BREAK: stop visiting altogether
982
+ * // null: delete this node
983
+ * // any value: replace this node with the returned value
984
+ * },
985
+ * leave(node, key, parent, path, ancestors) {
986
+ * // @return
987
+ * // undefined: no action
988
+ * // false: no action
989
+ * // visitor.BREAK: stop visiting altogether
990
+ * // null: delete this node
991
+ * // any value: replace this node with the returned value
992
+ * }
993
+ * });
994
+ *
995
+ * Alternatively to providing enter() and leave() functions, a visitor can
996
+ * instead provide functions named the same as the kinds of AST nodes, or
997
+ * enter/leave visitors at a named key, leading to four permutations of the
998
+ * visitor API:
999
+ *
1000
+ * 1) Named visitors triggered when entering a node of a specific kind.
1001
+ *
1002
+ * visit(ast, {
1003
+ * Kind(node) {
1004
+ * // enter the "Kind" node
1005
+ * }
1006
+ * })
1007
+ *
1008
+ * 2) Named visitors that trigger upon entering and leaving a node of
1009
+ * a specific kind.
1010
+ *
1011
+ * visit(ast, {
1012
+ * Kind: {
1013
+ * enter(node) {
1014
+ * // enter the "Kind" node
1015
+ * }
1016
+ * leave(node) {
1017
+ * // leave the "Kind" node
1018
+ * }
1019
+ * }
1020
+ * })
1021
+ *
1022
+ * 3) Generic visitors that trigger upon entering and leaving any node.
1023
+ *
1024
+ * visit(ast, {
1025
+ * enter(node) {
1026
+ * // enter any node
1027
+ * },
1028
+ * leave(node) {
1029
+ * // leave any node
1030
+ * }
1031
+ * })
1032
+ *
1033
+ * 4) Parallel visitors for entering and leaving nodes of a specific kind.
1034
+ *
1035
+ * visit(ast, {
1036
+ * enter: {
1037
+ * Kind(node) {
1038
+ * // enter the "Kind" node
1039
+ * }
1040
+ * },
1041
+ * leave: {
1042
+ * Kind(node) {
1043
+ * // leave the "Kind" node
1044
+ * }
1045
+ * }
1046
+ * })
1047
+ */
1048
+
1049
+ function visit(root, visitor) {
1050
+ var visitorKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : QueryDocumentKeys;
1051
+
1052
+ /* eslint-disable no-undef-init */
1053
+ var stack = undefined;
1054
+ var inArray = Array.isArray(root);
1055
+ var keys = [root];
1056
+ var index = -1;
1057
+ var edits = [];
1058
+ var node = undefined;
1059
+ var key = undefined;
1060
+ var parent = undefined;
1061
+ var path = [];
1062
+ var ancestors = [];
1063
+ var newRoot = root;
1064
+ /* eslint-enable no-undef-init */
1065
+
1066
+ do {
1067
+ index++;
1068
+ var isLeaving = index === keys.length;
1069
+ var isEdited = isLeaving && edits.length !== 0;
1070
+
1071
+ if (isLeaving) {
1072
+ key = ancestors.length === 0 ? undefined : path[path.length - 1];
1073
+ node = parent;
1074
+ parent = ancestors.pop();
1075
+
1076
+ if (isEdited) {
1077
+ if (inArray) {
1078
+ node = node.slice();
1079
+ } else {
1080
+ var clone = {};
1081
+
1082
+ for (var _i2 = 0, _Object$keys2 = Object.keys(node); _i2 < _Object$keys2.length; _i2++) {
1083
+ var k = _Object$keys2[_i2];
1084
+ clone[k] = node[k];
1085
+ }
1086
+
1087
+ node = clone;
1088
+ }
1089
+
1090
+ var editOffset = 0;
1091
+
1092
+ for (var ii = 0; ii < edits.length; ii++) {
1093
+ var editKey = edits[ii][0];
1094
+ var editValue = edits[ii][1];
1095
+
1096
+ if (inArray) {
1097
+ editKey -= editOffset;
1098
+ }
1099
+
1100
+ if (inArray && editValue === null) {
1101
+ node.splice(editKey, 1);
1102
+ editOffset++;
1103
+ } else {
1104
+ node[editKey] = editValue;
1105
+ }
1106
+ }
1107
+ }
1108
+
1109
+ index = stack.index;
1110
+ keys = stack.keys;
1111
+ edits = stack.edits;
1112
+ inArray = stack.inArray;
1113
+ stack = stack.prev;
1114
+ } else {
1115
+ key = parent ? inArray ? index : keys[index] : undefined;
1116
+ node = parent ? parent[key] : newRoot;
1117
+
1118
+ if (node === null || node === undefined) {
1119
+ continue;
1120
+ }
1121
+
1122
+ if (parent) {
1123
+ path.push(key);
1124
+ }
1125
+ }
1126
+
1127
+ var result = void 0;
1128
+
1129
+ if (!Array.isArray(node)) {
1130
+ if (!isNode(node)) {
1131
+ throw new Error("Invalid AST Node: ".concat(inspect(node), "."));
1132
+ }
1133
+
1134
+ var visitFn = getVisitFn(visitor, node.kind, isLeaving);
1135
+
1136
+ if (visitFn) {
1137
+ result = visitFn.call(visitor, node, key, parent, path, ancestors);
1138
+
1139
+ if (result === BREAK) {
1140
+ break;
1141
+ }
1142
+
1143
+ if (result === false) {
1144
+ if (!isLeaving) {
1145
+ path.pop();
1146
+ continue;
1147
+ }
1148
+ } else if (result !== undefined) {
1149
+ edits.push([key, result]);
1150
+
1151
+ if (!isLeaving) {
1152
+ if (isNode(result)) {
1153
+ node = result;
1154
+ } else {
1155
+ path.pop();
1156
+ continue;
1157
+ }
1158
+ }
1159
+ }
1160
+ }
1161
+ }
1162
+
1163
+ if (result === undefined && isEdited) {
1164
+ edits.push([key, node]);
1165
+ }
1166
+
1167
+ if (isLeaving) {
1168
+ path.pop();
1169
+ } else {
1170
+ var _visitorKeys$node$kin;
1171
+
1172
+ stack = {
1173
+ inArray: inArray,
1174
+ index: index,
1175
+ keys: keys,
1176
+ edits: edits,
1177
+ prev: stack
1178
+ };
1179
+ inArray = Array.isArray(node);
1180
+ keys = inArray ? node : (_visitorKeys$node$kin = visitorKeys[node.kind]) !== null && _visitorKeys$node$kin !== void 0 ? _visitorKeys$node$kin : [];
1181
+ index = -1;
1182
+ edits = [];
1183
+
1184
+ if (parent) {
1185
+ ancestors.push(parent);
1186
+ }
1187
+
1188
+ parent = node;
1189
+ }
1190
+ } while (stack !== undefined);
1191
+
1192
+ if (edits.length !== 0) {
1193
+ newRoot = edits[edits.length - 1][1];
1194
+ }
1195
+
1196
+ return newRoot;
1197
+ }
1198
+ /**
1199
+ * Given a visitor instance, if it is leaving or not, and a node kind, return
1200
+ * the function the visitor runtime should call.
1201
+ */
1202
+
1203
+ function getVisitFn(visitor, kind, isLeaving) {
1204
+ var kindVisitor = visitor[kind];
1205
+
1206
+ if (kindVisitor) {
1207
+ if (!isLeaving && typeof kindVisitor === 'function') {
1208
+ // { Kind() {} }
1209
+ return kindVisitor;
1210
+ }
1211
+
1212
+ var kindSpecificVisitor = isLeaving ? kindVisitor.leave : kindVisitor.enter;
1213
+
1214
+ if (typeof kindSpecificVisitor === 'function') {
1215
+ // { Kind: { enter() {}, leave() {} } }
1216
+ return kindSpecificVisitor;
1217
+ }
1218
+ } else {
1219
+ var specificVisitor = isLeaving ? visitor.leave : visitor.enter;
1220
+
1221
+ if (specificVisitor) {
1222
+ if (typeof specificVisitor === 'function') {
1223
+ // { enter() {}, leave() {} }
1224
+ return specificVisitor;
1225
+ }
1226
+
1227
+ var specificKindVisitor = specificVisitor[kind];
1228
+
1229
+ if (typeof specificKindVisitor === 'function') {
1230
+ // { enter: { Kind() {} }, leave: { Kind() {} } }
1231
+ return specificKindVisitor;
1232
+ }
1233
+ }
1234
+ }
1235
+ }
1236
+
1237
+ /* eslint-disable no-redeclare */
1238
+ // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
1239
+ var objectValues = Object.values || function (obj) {
1240
+ return Object.keys(obj).map(function (key) {
1241
+ return obj[key];
1242
+ });
1243
+ };
1244
+
1245
+ var objectValues$1 = objectValues;
1246
+
1247
+ /* eslint-disable no-redeclare */
1248
+ // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
1249
+ var objectEntries = Object.entries || function (obj) {
1250
+ return Object.keys(obj).map(function (key) {
1251
+ return [key, obj[key]];
1252
+ });
1253
+ };
1254
+
1255
+ var objectEntries$1 = objectEntries;
1256
+
1257
+ /**
1258
+ * Creates a keyed JS object from an array, given a function to produce the keys
1259
+ * for each value in the array.
1260
+ *
1261
+ * This provides a convenient lookup for the array items if the key function
1262
+ * produces unique results.
1263
+ *
1264
+ * const phoneBook = [
1265
+ * { name: 'Jon', num: '555-1234' },
1266
+ * { name: 'Jenny', num: '867-5309' }
1267
+ * ]
1268
+ *
1269
+ * // { Jon: { name: 'Jon', num: '555-1234' },
1270
+ * // Jenny: { name: 'Jenny', num: '867-5309' } }
1271
+ * const entriesByName = keyMap(
1272
+ * phoneBook,
1273
+ * entry => entry.name
1274
+ * )
1275
+ *
1276
+ * // { name: 'Jenny', num: '857-6309' }
1277
+ * const jennyEntry = entriesByName['Jenny']
1278
+ *
1279
+ */
1280
+ function keyMap(list, keyFn) {
1281
+ return list.reduce(function (map, item) {
1282
+ map[keyFn(item)] = item;
1283
+ return map;
1284
+ }, Object.create(null));
1285
+ }
1286
+
1287
+ /**
1288
+ * Creates an object map with the same keys as `map` and values generated by
1289
+ * running each value of `map` thru `fn`.
1290
+ */
1291
+ function mapValue(map, fn) {
1292
+ var result = Object.create(null);
1293
+
1294
+ for (var _i2 = 0, _objectEntries2 = objectEntries$1(map); _i2 < _objectEntries2.length; _i2++) {
1295
+ var _ref2 = _objectEntries2[_i2];
1296
+ var _key = _ref2[0];
1297
+ var _value = _ref2[1];
1298
+ result[_key] = fn(_value, _key);
1299
+ }
1300
+
1301
+ return result;
1302
+ }
1303
+
1304
+ function toObjMap(obj) {
1305
+ /* eslint-enable no-redeclare */
1306
+ if (Object.getPrototypeOf(obj) === null) {
1307
+ return obj;
1308
+ }
1309
+
1310
+ var map = Object.create(null);
1311
+
1312
+ for (var _i2 = 0, _objectEntries2 = objectEntries$1(obj); _i2 < _objectEntries2.length; _i2++) {
1313
+ var _ref2 = _objectEntries2[_i2];
1314
+ var key = _ref2[0];
1315
+ var value = _ref2[1];
1316
+ map[key] = value;
1317
+ }
1318
+
1319
+ return map;
1320
+ }
1321
+
1322
+ /**
1323
+ * Creates a keyed JS object from an array, given a function to produce the keys
1324
+ * and a function to produce the values from each item in the array.
1325
+ *
1326
+ * const phoneBook = [
1327
+ * { name: 'Jon', num: '555-1234' },
1328
+ * { name: 'Jenny', num: '867-5309' }
1329
+ * ]
1330
+ *
1331
+ * // { Jon: '555-1234', Jenny: '867-5309' }
1332
+ * const phonesByName = keyValMap(
1333
+ * phoneBook,
1334
+ * entry => entry.name,
1335
+ * entry => entry.num
1336
+ * )
1337
+ *
1338
+ */
1339
+ function keyValMap(list, keyFn, valFn) {
1340
+ return list.reduce(function (map, item) {
1341
+ map[keyFn(item)] = valFn(item);
1342
+ return map;
1343
+ }, Object.create(null));
1344
+ }
1345
+
1346
+ var MAX_SUGGESTIONS = 5;
1347
+ /**
1348
+ * Given [ A, B, C ] return ' Did you mean A, B, or C?'.
1349
+ */
1350
+
1351
+ // eslint-disable-next-line no-redeclare
1352
+ function didYouMean(firstArg, secondArg) {
1353
+ var _ref = typeof firstArg === 'string' ? [firstArg, secondArg] : [undefined, firstArg],
1354
+ subMessage = _ref[0],
1355
+ suggestionsArg = _ref[1];
1356
+
1357
+ var message = ' Did you mean ';
1358
+
1359
+ if (subMessage) {
1360
+ message += subMessage + ' ';
1361
+ }
1362
+
1363
+ var suggestions = suggestionsArg.map(function (x) {
1364
+ return "\"".concat(x, "\"");
1365
+ });
1366
+
1367
+ switch (suggestions.length) {
1368
+ case 0:
1369
+ return '';
1370
+
1371
+ case 1:
1372
+ return message + suggestions[0] + '?';
1373
+
1374
+ case 2:
1375
+ return message + suggestions[0] + ' or ' + suggestions[1] + '?';
1376
+ }
1377
+
1378
+ var selected = suggestions.slice(0, MAX_SUGGESTIONS);
1379
+ var lastItem = selected.pop();
1380
+ return message + selected.join(', ') + ', or ' + lastItem + '?';
1381
+ }
1382
+
1383
+ /**
1384
+ * Returns the first argument it receives.
1385
+ */
1386
+ function identityFunc(x) {
1387
+ return x;
1388
+ }
1389
+
1390
+ /**
1391
+ * Returns a number indicating whether a reference string comes before, or after,
1392
+ * or is the same as the given string in natural sort order.
1393
+ *
1394
+ * See: https://en.wikipedia.org/wiki/Natural_sort_order
1395
+ *
1396
+ */
1397
+ function naturalCompare(aStr, bStr) {
1398
+ var aIdx = 0;
1399
+ var bIdx = 0;
1400
+
1401
+ while (aIdx < aStr.length && bIdx < bStr.length) {
1402
+ var aChar = aStr.charCodeAt(aIdx);
1403
+ var bChar = bStr.charCodeAt(bIdx);
1404
+
1405
+ if (isDigit(aChar) && isDigit(bChar)) {
1406
+ var aNum = 0;
1407
+
1408
+ do {
1409
+ ++aIdx;
1410
+ aNum = aNum * 10 + aChar - DIGIT_0;
1411
+ aChar = aStr.charCodeAt(aIdx);
1412
+ } while (isDigit(aChar) && aNum > 0);
1413
+
1414
+ var bNum = 0;
1415
+
1416
+ do {
1417
+ ++bIdx;
1418
+ bNum = bNum * 10 + bChar - DIGIT_0;
1419
+ bChar = bStr.charCodeAt(bIdx);
1420
+ } while (isDigit(bChar) && bNum > 0);
1421
+
1422
+ if (aNum < bNum) {
1423
+ return -1;
1424
+ }
1425
+
1426
+ if (aNum > bNum) {
1427
+ return 1;
1428
+ }
1429
+ } else {
1430
+ if (aChar < bChar) {
1431
+ return -1;
1432
+ }
1433
+
1434
+ if (aChar > bChar) {
1435
+ return 1;
1436
+ }
1437
+
1438
+ ++aIdx;
1439
+ ++bIdx;
1440
+ }
1441
+ }
1442
+
1443
+ return aStr.length - bStr.length;
1444
+ }
1445
+ var DIGIT_0 = 48;
1446
+ var DIGIT_9 = 57;
1447
+
1448
+ function isDigit(code) {
1449
+ return !isNaN(code) && DIGIT_0 <= code && code <= DIGIT_9;
1450
+ }
1451
+
1452
+ /**
1453
+ * Given an invalid input string and a list of valid options, returns a filtered
1454
+ * list of valid options sorted based on their similarity with the input.
1455
+ */
1456
+
1457
+ function suggestionList(input, options) {
1458
+ var optionsByDistance = Object.create(null);
1459
+ var lexicalDistance = new LexicalDistance(input);
1460
+ var threshold = Math.floor(input.length * 0.4) + 1;
1461
+
1462
+ for (var _i2 = 0; _i2 < options.length; _i2++) {
1463
+ var option = options[_i2];
1464
+ var distance = lexicalDistance.measure(option, threshold);
1465
+
1466
+ if (distance !== undefined) {
1467
+ optionsByDistance[option] = distance;
1468
+ }
1469
+ }
1470
+
1471
+ return Object.keys(optionsByDistance).sort(function (a, b) {
1472
+ var distanceDiff = optionsByDistance[a] - optionsByDistance[b];
1473
+ return distanceDiff !== 0 ? distanceDiff : naturalCompare(a, b);
1474
+ });
1475
+ }
1476
+ /**
1477
+ * Computes the lexical distance between strings A and B.
1478
+ *
1479
+ * The "distance" between two strings is given by counting the minimum number
1480
+ * of edits needed to transform string A into string B. An edit can be an
1481
+ * insertion, deletion, or substitution of a single character, or a swap of two
1482
+ * adjacent characters.
1483
+ *
1484
+ * Includes a custom alteration from Damerau-Levenshtein to treat case changes
1485
+ * as a single edit which helps identify mis-cased values with an edit distance
1486
+ * of 1.
1487
+ *
1488
+ * This distance can be useful for detecting typos in input or sorting
1489
+ */
1490
+
1491
+ var LexicalDistance = /*#__PURE__*/function () {
1492
+ function LexicalDistance(input) {
1493
+ this._input = input;
1494
+ this._inputLowerCase = input.toLowerCase();
1495
+ this._inputArray = stringToArray(this._inputLowerCase);
1496
+ this._rows = [new Array(input.length + 1).fill(0), new Array(input.length + 1).fill(0), new Array(input.length + 1).fill(0)];
1497
+ }
1498
+
1499
+ var _proto = LexicalDistance.prototype;
1500
+
1501
+ _proto.measure = function measure(option, threshold) {
1502
+ if (this._input === option) {
1503
+ return 0;
1504
+ }
1505
+
1506
+ var optionLowerCase = option.toLowerCase(); // Any case change counts as a single edit
1507
+
1508
+ if (this._inputLowerCase === optionLowerCase) {
1509
+ return 1;
1510
+ }
1511
+
1512
+ var a = stringToArray(optionLowerCase);
1513
+ var b = this._inputArray;
1514
+
1515
+ if (a.length < b.length) {
1516
+ var tmp = a;
1517
+ a = b;
1518
+ b = tmp;
1519
+ }
1520
+
1521
+ var aLength = a.length;
1522
+ var bLength = b.length;
1523
+
1524
+ if (aLength - bLength > threshold) {
1525
+ return undefined;
1526
+ }
1527
+
1528
+ var rows = this._rows;
1529
+
1530
+ for (var j = 0; j <= bLength; j++) {
1531
+ rows[0][j] = j;
1532
+ }
1533
+
1534
+ for (var i = 1; i <= aLength; i++) {
1535
+ var upRow = rows[(i - 1) % 3];
1536
+ var currentRow = rows[i % 3];
1537
+ var smallestCell = currentRow[0] = i;
1538
+
1539
+ for (var _j = 1; _j <= bLength; _j++) {
1540
+ var cost = a[i - 1] === b[_j - 1] ? 0 : 1;
1541
+ var currentCell = Math.min(upRow[_j] + 1, // delete
1542
+ currentRow[_j - 1] + 1, // insert
1543
+ upRow[_j - 1] + cost // substitute
1544
+ );
1545
+
1546
+ if (i > 1 && _j > 1 && a[i - 1] === b[_j - 2] && a[i - 2] === b[_j - 1]) {
1547
+ // transposition
1548
+ var doubleDiagonalCell = rows[(i - 2) % 3][_j - 2];
1549
+ currentCell = Math.min(currentCell, doubleDiagonalCell + 1);
1550
+ }
1551
+
1552
+ if (currentCell < smallestCell) {
1553
+ smallestCell = currentCell;
1554
+ }
1555
+
1556
+ currentRow[_j] = currentCell;
1557
+ } // Early exit, since distance can't go smaller than smallest element of the previous row.
1558
+
1559
+
1560
+ if (smallestCell > threshold) {
1561
+ return undefined;
1562
+ }
1563
+ }
1564
+
1565
+ var distance = rows[aLength % 3][bLength];
1566
+ return distance <= threshold ? distance : undefined;
1567
+ };
1568
+
1569
+ return LexicalDistance;
1570
+ }();
1571
+
1572
+ function stringToArray(str) {
1573
+ var strLength = str.length;
1574
+ var array = new Array(strLength);
1575
+
1576
+ for (var i = 0; i < strLength; ++i) {
1577
+ array[i] = str.charCodeAt(i);
1578
+ }
1579
+
1580
+ return array;
1581
+ }
1582
+
1583
+ /**
1584
+ * Converts an AST into a string, using one set of reasonable
1585
+ * formatting rules.
1586
+ */
1587
+
1588
+ function print(ast) {
1589
+ return visit(ast, {
1590
+ leave: printDocASTReducer
1591
+ });
1592
+ }
1593
+ var MAX_LINE_LENGTH = 80; // TODO: provide better type coverage in future
1594
+
1595
+ var printDocASTReducer = {
1596
+ Name: function Name(node) {
1597
+ return node.value;
1598
+ },
1599
+ Variable: function Variable(node) {
1600
+ return '$' + node.name;
1601
+ },
1602
+ // Document
1603
+ Document: function Document(node) {
1604
+ return join(node.definitions, '\n\n') + '\n';
1605
+ },
1606
+ OperationDefinition: function OperationDefinition(node) {
1607
+ var op = node.operation;
1608
+ var name = node.name;
1609
+ var varDefs = wrap('(', join(node.variableDefinitions, ', '), ')');
1610
+ var directives = join(node.directives, ' ');
1611
+ var selectionSet = node.selectionSet; // Anonymous queries with no directives or variable definitions can use
1612
+ // the query short form.
1613
+
1614
+ return !name && !directives && !varDefs && op === 'query' ? selectionSet : join([op, join([name, varDefs]), directives, selectionSet], ' ');
1615
+ },
1616
+ VariableDefinition: function VariableDefinition(_ref) {
1617
+ var variable = _ref.variable,
1618
+ type = _ref.type,
1619
+ defaultValue = _ref.defaultValue,
1620
+ directives = _ref.directives;
1621
+ return variable + ': ' + type + wrap(' = ', defaultValue) + wrap(' ', join(directives, ' '));
1622
+ },
1623
+ SelectionSet: function SelectionSet(_ref2) {
1624
+ var selections = _ref2.selections;
1625
+ return block(selections);
1626
+ },
1627
+ Field: function Field(_ref3) {
1628
+ var alias = _ref3.alias,
1629
+ name = _ref3.name,
1630
+ args = _ref3.arguments,
1631
+ directives = _ref3.directives,
1632
+ selectionSet = _ref3.selectionSet;
1633
+ var prefix = wrap('', alias, ': ') + name;
1634
+ var argsLine = prefix + wrap('(', join(args, ', '), ')');
1635
+
1636
+ if (argsLine.length > MAX_LINE_LENGTH) {
1637
+ argsLine = prefix + wrap('(\n', indent(join(args, '\n')), '\n)');
1638
+ }
1639
+
1640
+ return join([argsLine, join(directives, ' '), selectionSet], ' ');
1641
+ },
1642
+ Argument: function Argument(_ref4) {
1643
+ var name = _ref4.name,
1644
+ value = _ref4.value;
1645
+ return name + ': ' + value;
1646
+ },
1647
+ // Fragments
1648
+ FragmentSpread: function FragmentSpread(_ref5) {
1649
+ var name = _ref5.name,
1650
+ directives = _ref5.directives;
1651
+ return '...' + name + wrap(' ', join(directives, ' '));
1652
+ },
1653
+ InlineFragment: function InlineFragment(_ref6) {
1654
+ var typeCondition = _ref6.typeCondition,
1655
+ directives = _ref6.directives,
1656
+ selectionSet = _ref6.selectionSet;
1657
+ return join(['...', wrap('on ', typeCondition), join(directives, ' '), selectionSet], ' ');
1658
+ },
1659
+ FragmentDefinition: function FragmentDefinition(_ref7) {
1660
+ var name = _ref7.name,
1661
+ typeCondition = _ref7.typeCondition,
1662
+ variableDefinitions = _ref7.variableDefinitions,
1663
+ directives = _ref7.directives,
1664
+ selectionSet = _ref7.selectionSet;
1665
+ return (// Note: fragment variable definitions are experimental and may be changed
1666
+ // or removed in the future.
1667
+ "fragment ".concat(name).concat(wrap('(', join(variableDefinitions, ', '), ')'), " ") + "on ".concat(typeCondition, " ").concat(wrap('', join(directives, ' '), ' ')) + selectionSet
1668
+ );
1669
+ },
1670
+ // Value
1671
+ IntValue: function IntValue(_ref8) {
1672
+ var value = _ref8.value;
1673
+ return value;
1674
+ },
1675
+ FloatValue: function FloatValue(_ref9) {
1676
+ var value = _ref9.value;
1677
+ return value;
1678
+ },
1679
+ StringValue: function StringValue(_ref10, key) {
1680
+ var value = _ref10.value,
1681
+ isBlockString = _ref10.block;
1682
+ return isBlockString ? printBlockString(value, key === 'description' ? '' : ' ') : JSON.stringify(value);
1683
+ },
1684
+ BooleanValue: function BooleanValue(_ref11) {
1685
+ var value = _ref11.value;
1686
+ return value ? 'true' : 'false';
1687
+ },
1688
+ NullValue: function NullValue() {
1689
+ return 'null';
1690
+ },
1691
+ EnumValue: function EnumValue(_ref12) {
1692
+ var value = _ref12.value;
1693
+ return value;
1694
+ },
1695
+ ListValue: function ListValue(_ref13) {
1696
+ var values = _ref13.values;
1697
+ return '[' + join(values, ', ') + ']';
1698
+ },
1699
+ ObjectValue: function ObjectValue(_ref14) {
1700
+ var fields = _ref14.fields;
1701
+ return '{' + join(fields, ', ') + '}';
1702
+ },
1703
+ ObjectField: function ObjectField(_ref15) {
1704
+ var name = _ref15.name,
1705
+ value = _ref15.value;
1706
+ return name + ': ' + value;
1707
+ },
1708
+ // Directive
1709
+ Directive: function Directive(_ref16) {
1710
+ var name = _ref16.name,
1711
+ args = _ref16.arguments;
1712
+ return '@' + name + wrap('(', join(args, ', '), ')');
1713
+ },
1714
+ // Type
1715
+ NamedType: function NamedType(_ref17) {
1716
+ var name = _ref17.name;
1717
+ return name;
1718
+ },
1719
+ ListType: function ListType(_ref18) {
1720
+ var type = _ref18.type;
1721
+ return '[' + type + ']';
1722
+ },
1723
+ NonNullType: function NonNullType(_ref19) {
1724
+ var type = _ref19.type;
1725
+ return type + '!';
1726
+ },
1727
+ // Type System Definitions
1728
+ SchemaDefinition: addDescription(function (_ref20) {
1729
+ var directives = _ref20.directives,
1730
+ operationTypes = _ref20.operationTypes;
1731
+ return join(['schema', join(directives, ' '), block(operationTypes)], ' ');
1732
+ }),
1733
+ OperationTypeDefinition: function OperationTypeDefinition(_ref21) {
1734
+ var operation = _ref21.operation,
1735
+ type = _ref21.type;
1736
+ return operation + ': ' + type;
1737
+ },
1738
+ ScalarTypeDefinition: addDescription(function (_ref22) {
1739
+ var name = _ref22.name,
1740
+ directives = _ref22.directives;
1741
+ return join(['scalar', name, join(directives, ' ')], ' ');
1742
+ }),
1743
+ ObjectTypeDefinition: addDescription(function (_ref23) {
1744
+ var name = _ref23.name,
1745
+ interfaces = _ref23.interfaces,
1746
+ directives = _ref23.directives,
1747
+ fields = _ref23.fields;
1748
+ return join(['type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' ');
1749
+ }),
1750
+ FieldDefinition: addDescription(function (_ref24) {
1751
+ var name = _ref24.name,
1752
+ args = _ref24.arguments,
1753
+ type = _ref24.type,
1754
+ directives = _ref24.directives;
1755
+ return name + (hasMultilineItems(args) ? wrap('(\n', indent(join(args, '\n')), '\n)') : wrap('(', join(args, ', '), ')')) + ': ' + type + wrap(' ', join(directives, ' '));
1756
+ }),
1757
+ InputValueDefinition: addDescription(function (_ref25) {
1758
+ var name = _ref25.name,
1759
+ type = _ref25.type,
1760
+ defaultValue = _ref25.defaultValue,
1761
+ directives = _ref25.directives;
1762
+ return join([name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], ' ');
1763
+ }),
1764
+ InterfaceTypeDefinition: addDescription(function (_ref26) {
1765
+ var name = _ref26.name,
1766
+ interfaces = _ref26.interfaces,
1767
+ directives = _ref26.directives,
1768
+ fields = _ref26.fields;
1769
+ return join(['interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' ');
1770
+ }),
1771
+ UnionTypeDefinition: addDescription(function (_ref27) {
1772
+ var name = _ref27.name,
1773
+ directives = _ref27.directives,
1774
+ types = _ref27.types;
1775
+ return join(['union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' ');
1776
+ }),
1777
+ EnumTypeDefinition: addDescription(function (_ref28) {
1778
+ var name = _ref28.name,
1779
+ directives = _ref28.directives,
1780
+ values = _ref28.values;
1781
+ return join(['enum', name, join(directives, ' '), block(values)], ' ');
1782
+ }),
1783
+ EnumValueDefinition: addDescription(function (_ref29) {
1784
+ var name = _ref29.name,
1785
+ directives = _ref29.directives;
1786
+ return join([name, join(directives, ' ')], ' ');
1787
+ }),
1788
+ InputObjectTypeDefinition: addDescription(function (_ref30) {
1789
+ var name = _ref30.name,
1790
+ directives = _ref30.directives,
1791
+ fields = _ref30.fields;
1792
+ return join(['input', name, join(directives, ' '), block(fields)], ' ');
1793
+ }),
1794
+ DirectiveDefinition: addDescription(function (_ref31) {
1795
+ var name = _ref31.name,
1796
+ args = _ref31.arguments,
1797
+ repeatable = _ref31.repeatable,
1798
+ locations = _ref31.locations;
1799
+ return 'directive @' + name + (hasMultilineItems(args) ? wrap('(\n', indent(join(args, '\n')), '\n)') : wrap('(', join(args, ', '), ')')) + (repeatable ? ' repeatable' : '') + ' on ' + join(locations, ' | ');
1800
+ }),
1801
+ SchemaExtension: function SchemaExtension(_ref32) {
1802
+ var directives = _ref32.directives,
1803
+ operationTypes = _ref32.operationTypes;
1804
+ return join(['extend schema', join(directives, ' '), block(operationTypes)], ' ');
1805
+ },
1806
+ ScalarTypeExtension: function ScalarTypeExtension(_ref33) {
1807
+ var name = _ref33.name,
1808
+ directives = _ref33.directives;
1809
+ return join(['extend scalar', name, join(directives, ' ')], ' ');
1810
+ },
1811
+ ObjectTypeExtension: function ObjectTypeExtension(_ref34) {
1812
+ var name = _ref34.name,
1813
+ interfaces = _ref34.interfaces,
1814
+ directives = _ref34.directives,
1815
+ fields = _ref34.fields;
1816
+ return join(['extend type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' ');
1817
+ },
1818
+ InterfaceTypeExtension: function InterfaceTypeExtension(_ref35) {
1819
+ var name = _ref35.name,
1820
+ interfaces = _ref35.interfaces,
1821
+ directives = _ref35.directives,
1822
+ fields = _ref35.fields;
1823
+ return join(['extend interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' ');
1824
+ },
1825
+ UnionTypeExtension: function UnionTypeExtension(_ref36) {
1826
+ var name = _ref36.name,
1827
+ directives = _ref36.directives,
1828
+ types = _ref36.types;
1829
+ return join(['extend union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' ');
1830
+ },
1831
+ EnumTypeExtension: function EnumTypeExtension(_ref37) {
1832
+ var name = _ref37.name,
1833
+ directives = _ref37.directives,
1834
+ values = _ref37.values;
1835
+ return join(['extend enum', name, join(directives, ' '), block(values)], ' ');
1836
+ },
1837
+ InputObjectTypeExtension: function InputObjectTypeExtension(_ref38) {
1838
+ var name = _ref38.name,
1839
+ directives = _ref38.directives,
1840
+ fields = _ref38.fields;
1841
+ return join(['extend input', name, join(directives, ' '), block(fields)], ' ');
1842
+ }
1843
+ };
1844
+
1845
+ function addDescription(cb) {
1846
+ return function (node) {
1847
+ return join([node.description, cb(node)], '\n');
1848
+ };
1849
+ }
1850
+ /**
1851
+ * Given maybeArray, print an empty string if it is null or empty, otherwise
1852
+ * print all items together separated by separator if provided
1853
+ */
1854
+
1855
+
1856
+ function join(maybeArray) {
1857
+ var _maybeArray$filter$jo;
1858
+
1859
+ var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
1860
+ return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter(function (x) {
1861
+ return x;
1862
+ }).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : '';
1863
+ }
1864
+ /**
1865
+ * Given array, print each item on its own line, wrapped in an
1866
+ * indented "{ }" block.
1867
+ */
1868
+
1869
+
1870
+ function block(array) {
1871
+ return wrap('{\n', indent(join(array, '\n')), '\n}');
1872
+ }
1873
+ /**
1874
+ * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string.
1875
+ */
1876
+
1877
+
1878
+ function wrap(start, maybeString) {
1879
+ var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
1880
+ return maybeString != null && maybeString !== '' ? start + maybeString + end : '';
1881
+ }
1882
+
1883
+ function indent(str) {
1884
+ return wrap(' ', str.replace(/\n/g, '\n '));
1885
+ }
1886
+
1887
+ function isMultiline(str) {
1888
+ return str.indexOf('\n') !== -1;
1889
+ }
1890
+
1891
+ function hasMultilineItems(maybeArray) {
1892
+ return maybeArray != null && maybeArray.some(isMultiline);
1893
+ }
1894
+
1895
+ /**
1896
+ * Produces a JavaScript value given a GraphQL Value AST.
1897
+ *
1898
+ * Unlike `valueFromAST()`, no type is provided. The resulting JavaScript value
1899
+ * will reflect the provided GraphQL value AST.
1900
+ *
1901
+ * | GraphQL Value | JavaScript Value |
1902
+ * | -------------------- | ---------------- |
1903
+ * | Input Object | Object |
1904
+ * | List | Array |
1905
+ * | Boolean | Boolean |
1906
+ * | String / Enum | String |
1907
+ * | Int / Float | Number |
1908
+ * | Null | null |
1909
+ *
1910
+ */
1911
+ function valueFromASTUntyped(valueNode, variables) {
1912
+ switch (valueNode.kind) {
1913
+ case Kind.NULL:
1914
+ return null;
1915
+
1916
+ case Kind.INT:
1917
+ return parseInt(valueNode.value, 10);
1918
+
1919
+ case Kind.FLOAT:
1920
+ return parseFloat(valueNode.value);
1921
+
1922
+ case Kind.STRING:
1923
+ case Kind.ENUM:
1924
+ case Kind.BOOLEAN:
1925
+ return valueNode.value;
1926
+
1927
+ case Kind.LIST:
1928
+ return valueNode.values.map(function (node) {
1929
+ return valueFromASTUntyped(node, variables);
1930
+ });
1931
+
1932
+ case Kind.OBJECT:
1933
+ return keyValMap(valueNode.fields, function (field) {
1934
+ return field.name.value;
1935
+ }, function (field) {
1936
+ return valueFromASTUntyped(field.value, variables);
1937
+ });
1938
+
1939
+ case Kind.VARIABLE:
1940
+ return variables === null || variables === void 0 ? void 0 : variables[valueNode.name.value];
1941
+ } // istanbul ignore next (Not reachable. All possible value nodes have been considered)
1942
+
1943
+
1944
+ invariant(0, 'Unexpected value node: ' + inspect(valueNode));
1945
+ }
1946
+
1947
+ function _defineProperties$2(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); } }
1948
+
1949
+ function _createClass$2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); if (staticProps) _defineProperties$2(Constructor, staticProps); return Constructor; }
1950
+ function isType(type) {
1951
+ return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isInputObjectType(type) || isListType(type) || isNonNullType(type);
1952
+ }
1953
+ function assertType(type) {
1954
+ if (!isType(type)) {
1955
+ throw new Error("Expected ".concat(inspect(type), " to be a GraphQL type."));
1956
+ }
1957
+
1958
+ return type;
1959
+ }
1960
+ /**
1961
+ * There are predicates for each kind of GraphQL type.
1962
+ */
1963
+
1964
+ // eslint-disable-next-line no-redeclare
1965
+ function isScalarType(type) {
1966
+ return instanceOf(type, GraphQLScalarType);
1967
+ }
1968
+ // eslint-disable-next-line no-redeclare
1969
+ function isObjectType(type) {
1970
+ return instanceOf(type, GraphQLObjectType);
1971
+ }
1972
+ // eslint-disable-next-line no-redeclare
1973
+ function isInterfaceType(type) {
1974
+ return instanceOf(type, GraphQLInterfaceType);
1975
+ }
1976
+ // eslint-disable-next-line no-redeclare
1977
+ function isUnionType(type) {
1978
+ return instanceOf(type, GraphQLUnionType);
1979
+ }
1980
+ // eslint-disable-next-line no-redeclare
1981
+ function isEnumType(type) {
1982
+ return instanceOf(type, GraphQLEnumType);
1983
+ }
1984
+ // eslint-disable-next-line no-redeclare
1985
+ function isInputObjectType(type) {
1986
+ return instanceOf(type, GraphQLInputObjectType);
1987
+ }
1988
+ // eslint-disable-next-line no-redeclare
1989
+ function isListType(type) {
1990
+ return instanceOf(type, GraphQLList);
1991
+ }
1992
+ // eslint-disable-next-line no-redeclare
1993
+ function isNonNullType(type) {
1994
+ return instanceOf(type, GraphQLNonNull);
1995
+ }
1996
+ /**
1997
+ * These types may describe types which may be leaf values.
1998
+ */
1999
+
2000
+ function isLeafType(type) {
2001
+ return isScalarType(type) || isEnumType(type);
2002
+ }
2003
+ /**
2004
+ * These types may describe the parent context of a selection set.
2005
+ */
2006
+
2007
+ function isAbstractType(type) {
2008
+ return isInterfaceType(type) || isUnionType(type);
2009
+ }
2010
+ /**
2011
+ * List Type Wrapper
2012
+ *
2013
+ * A list is a wrapping type which points to another type.
2014
+ * Lists are often created within the context of defining the fields of
2015
+ * an object type.
2016
+ *
2017
+ * Example:
2018
+ *
2019
+ * const PersonType = new GraphQLObjectType({
2020
+ * name: 'Person',
2021
+ * fields: () => ({
2022
+ * parents: { type: new GraphQLList(PersonType) },
2023
+ * children: { type: new GraphQLList(PersonType) },
2024
+ * })
2025
+ * })
2026
+ *
2027
+ */
2028
+ // FIXME: workaround to fix issue with Babel parser
2029
+
2030
+ /* ::
2031
+ declare class GraphQLList<+T: GraphQLType> {
2032
+ +ofType: T;
2033
+ static <T>(ofType: T): GraphQLList<T>;
2034
+ // Note: constructors cannot be used for covariant types. Drop the "new".
2035
+ constructor(ofType: GraphQLType): void;
2036
+ }
2037
+ */
2038
+
2039
+ function GraphQLList(ofType) {
2040
+ // istanbul ignore else (to be removed in v16.0.0)
2041
+ if (this instanceof GraphQLList) {
2042
+ this.ofType = assertType(ofType);
2043
+ } else {
2044
+ return new GraphQLList(ofType);
2045
+ }
2046
+ } // Need to cast through any to alter the prototype.
2047
+
2048
+ GraphQLList.prototype.toString = function toString() {
2049
+ return '[' + String(this.ofType) + ']';
2050
+ };
2051
+
2052
+ GraphQLList.prototype.toJSON = function toJSON() {
2053
+ return this.toString();
2054
+ };
2055
+
2056
+ Object.defineProperty(GraphQLList.prototype, SYMBOL_TO_STRING_TAG, {
2057
+ get: function get() {
2058
+ return 'GraphQLList';
2059
+ }
2060
+ }); // Print a simplified form when appearing in `inspect` and `util.inspect`.
2061
+
2062
+ defineInspect(GraphQLList);
2063
+ /**
2064
+ * Non-Null Type Wrapper
2065
+ *
2066
+ * A non-null is a wrapping type which points to another type.
2067
+ * Non-null types enforce that their values are never null and can ensure
2068
+ * an error is raised if this ever occurs during a request. It is useful for
2069
+ * fields which you can make a strong guarantee on non-nullability, for example
2070
+ * usually the id field of a database row will never be null.
2071
+ *
2072
+ * Example:
2073
+ *
2074
+ * const RowType = new GraphQLObjectType({
2075
+ * name: 'Row',
2076
+ * fields: () => ({
2077
+ * id: { type: new GraphQLNonNull(GraphQLString) },
2078
+ * })
2079
+ * })
2080
+ *
2081
+ * Note: the enforcement of non-nullability occurs within the executor.
2082
+ */
2083
+ // FIXME: workaround to fix issue with Babel parser
2084
+
2085
+ /* ::
2086
+ declare class GraphQLNonNull<+T: GraphQLNullableType> {
2087
+ +ofType: T;
2088
+ static <T>(ofType: T): GraphQLNonNull<T>;
2089
+ // Note: constructors cannot be used for covariant types. Drop the "new".
2090
+ constructor(ofType: GraphQLType): void;
2091
+ }
2092
+ */
2093
+
2094
+ function GraphQLNonNull(ofType) {
2095
+ // istanbul ignore else (to be removed in v16.0.0)
2096
+ if (this instanceof GraphQLNonNull) {
2097
+ this.ofType = assertNullableType(ofType);
2098
+ } else {
2099
+ return new GraphQLNonNull(ofType);
2100
+ }
2101
+ } // Need to cast through any to alter the prototype.
2102
+
2103
+ GraphQLNonNull.prototype.toString = function toString() {
2104
+ return String(this.ofType) + '!';
2105
+ };
2106
+
2107
+ GraphQLNonNull.prototype.toJSON = function toJSON() {
2108
+ return this.toString();
2109
+ };
2110
+
2111
+ Object.defineProperty(GraphQLNonNull.prototype, SYMBOL_TO_STRING_TAG, {
2112
+ get: function get() {
2113
+ return 'GraphQLNonNull';
2114
+ }
2115
+ }); // Print a simplified form when appearing in `inspect` and `util.inspect`.
2116
+
2117
+ defineInspect(GraphQLNonNull);
2118
+ /**
2119
+ * These types can all accept null as a value.
2120
+ */
2121
+
2122
+ function isNullableType(type) {
2123
+ return isType(type) && !isNonNullType(type);
2124
+ }
2125
+ function assertNullableType(type) {
2126
+ if (!isNullableType(type)) {
2127
+ throw new Error("Expected ".concat(inspect(type), " to be a GraphQL nullable type."));
2128
+ }
2129
+
2130
+ return type;
2131
+ }
2132
+ /**
2133
+ * Used while defining GraphQL types to allow for circular references in
2134
+ * otherwise immutable type definitions.
2135
+ */
2136
+
2137
+ function resolveThunk(thunk) {
2138
+ // $FlowFixMe[incompatible-use]
2139
+ return typeof thunk === 'function' ? thunk() : thunk;
2140
+ }
2141
+
2142
+ function undefineIfEmpty(arr) {
2143
+ return arr && arr.length > 0 ? arr : undefined;
2144
+ }
2145
+ /**
2146
+ * Scalar Type Definition
2147
+ *
2148
+ * The leaf values of any request and input values to arguments are
2149
+ * Scalars (or Enums) and are defined with a name and a series of functions
2150
+ * used to parse input from ast or variables and to ensure validity.
2151
+ *
2152
+ * If a type's serialize function does not return a value (i.e. it returns
2153
+ * `undefined`) then an error will be raised and a `null` value will be returned
2154
+ * in the response. If the serialize function returns `null`, then no error will
2155
+ * be included in the response.
2156
+ *
2157
+ * Example:
2158
+ *
2159
+ * const OddType = new GraphQLScalarType({
2160
+ * name: 'Odd',
2161
+ * serialize(value) {
2162
+ * if (value % 2 === 1) {
2163
+ * return value;
2164
+ * }
2165
+ * }
2166
+ * });
2167
+ *
2168
+ */
2169
+
2170
+
2171
+ var GraphQLScalarType = /*#__PURE__*/function () {
2172
+ function GraphQLScalarType(config) {
2173
+ var _config$parseValue, _config$serialize, _config$parseLiteral;
2174
+
2175
+ var parseValue = (_config$parseValue = config.parseValue) !== null && _config$parseValue !== void 0 ? _config$parseValue : identityFunc;
2176
+ this.name = config.name;
2177
+ this.description = config.description;
2178
+ this.specifiedByUrl = config.specifiedByUrl;
2179
+ this.serialize = (_config$serialize = config.serialize) !== null && _config$serialize !== void 0 ? _config$serialize : identityFunc;
2180
+ this.parseValue = parseValue;
2181
+ this.parseLiteral = (_config$parseLiteral = config.parseLiteral) !== null && _config$parseLiteral !== void 0 ? _config$parseLiteral : function (node, variables) {
2182
+ return parseValue(valueFromASTUntyped(node, variables));
2183
+ };
2184
+ this.extensions = config.extensions && toObjMap(config.extensions);
2185
+ this.astNode = config.astNode;
2186
+ this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
2187
+ typeof config.name === 'string' || devAssert(0, 'Must provide name.');
2188
+ config.specifiedByUrl == null || typeof config.specifiedByUrl === 'string' || devAssert(0, "".concat(this.name, " must provide \"specifiedByUrl\" as a string, ") + "but got: ".concat(inspect(config.specifiedByUrl), "."));
2189
+ config.serialize == null || typeof config.serialize === 'function' || devAssert(0, "".concat(this.name, " must provide \"serialize\" function. If this custom Scalar is also used as an input type, ensure \"parseValue\" and \"parseLiteral\" functions are also provided."));
2190
+
2191
+ if (config.parseLiteral) {
2192
+ typeof config.parseValue === 'function' && typeof config.parseLiteral === 'function' || devAssert(0, "".concat(this.name, " must provide both \"parseValue\" and \"parseLiteral\" functions."));
2193
+ }
2194
+ }
2195
+
2196
+ var _proto = GraphQLScalarType.prototype;
2197
+
2198
+ _proto.toConfig = function toConfig() {
2199
+ var _this$extensionASTNod;
2200
+
2201
+ return {
2202
+ name: this.name,
2203
+ description: this.description,
2204
+ specifiedByUrl: this.specifiedByUrl,
2205
+ serialize: this.serialize,
2206
+ parseValue: this.parseValue,
2207
+ parseLiteral: this.parseLiteral,
2208
+ extensions: this.extensions,
2209
+ astNode: this.astNode,
2210
+ extensionASTNodes: (_this$extensionASTNod = this.extensionASTNodes) !== null && _this$extensionASTNod !== void 0 ? _this$extensionASTNod : []
2211
+ };
2212
+ };
2213
+
2214
+ _proto.toString = function toString() {
2215
+ return this.name;
2216
+ };
2217
+
2218
+ _proto.toJSON = function toJSON() {
2219
+ return this.toString();
2220
+ } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
2221
+ ;
2222
+
2223
+ _createClass$2(GraphQLScalarType, [{
2224
+ key: SYMBOL_TO_STRING_TAG,
2225
+ get: function get() {
2226
+ return 'GraphQLScalarType';
2227
+ }
2228
+ }]);
2229
+
2230
+ return GraphQLScalarType;
2231
+ }(); // Print a simplified form when appearing in `inspect` and `util.inspect`.
2232
+
2233
+ defineInspect(GraphQLScalarType);
2234
+
2235
+ /**
2236
+ * Object Type Definition
2237
+ *
2238
+ * Almost all of the GraphQL types you define will be object types. Object types
2239
+ * have a name, but most importantly describe their fields.
2240
+ *
2241
+ * Example:
2242
+ *
2243
+ * const AddressType = new GraphQLObjectType({
2244
+ * name: 'Address',
2245
+ * fields: {
2246
+ * street: { type: GraphQLString },
2247
+ * number: { type: GraphQLInt },
2248
+ * formatted: {
2249
+ * type: GraphQLString,
2250
+ * resolve(obj) {
2251
+ * return obj.number + ' ' + obj.street
2252
+ * }
2253
+ * }
2254
+ * }
2255
+ * });
2256
+ *
2257
+ * When two types need to refer to each other, or a type needs to refer to
2258
+ * itself in a field, you can use a function expression (aka a closure or a
2259
+ * thunk) to supply the fields lazily.
2260
+ *
2261
+ * Example:
2262
+ *
2263
+ * const PersonType = new GraphQLObjectType({
2264
+ * name: 'Person',
2265
+ * fields: () => ({
2266
+ * name: { type: GraphQLString },
2267
+ * bestFriend: { type: PersonType },
2268
+ * })
2269
+ * });
2270
+ *
2271
+ */
2272
+ var GraphQLObjectType = /*#__PURE__*/function () {
2273
+ function GraphQLObjectType(config) {
2274
+ this.name = config.name;
2275
+ this.description = config.description;
2276
+ this.isTypeOf = config.isTypeOf;
2277
+ this.extensions = config.extensions && toObjMap(config.extensions);
2278
+ this.astNode = config.astNode;
2279
+ this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
2280
+ this._fields = defineFieldMap.bind(undefined, config);
2281
+ this._interfaces = defineInterfaces.bind(undefined, config);
2282
+ typeof config.name === 'string' || devAssert(0, 'Must provide name.');
2283
+ config.isTypeOf == null || typeof config.isTypeOf === 'function' || devAssert(0, "".concat(this.name, " must provide \"isTypeOf\" as a function, ") + "but got: ".concat(inspect(config.isTypeOf), "."));
2284
+ }
2285
+
2286
+ var _proto2 = GraphQLObjectType.prototype;
2287
+
2288
+ _proto2.getFields = function getFields() {
2289
+ if (typeof this._fields === 'function') {
2290
+ this._fields = this._fields();
2291
+ }
2292
+
2293
+ return this._fields;
2294
+ };
2295
+
2296
+ _proto2.getInterfaces = function getInterfaces() {
2297
+ if (typeof this._interfaces === 'function') {
2298
+ this._interfaces = this._interfaces();
2299
+ }
2300
+
2301
+ return this._interfaces;
2302
+ };
2303
+
2304
+ _proto2.toConfig = function toConfig() {
2305
+ return {
2306
+ name: this.name,
2307
+ description: this.description,
2308
+ interfaces: this.getInterfaces(),
2309
+ fields: fieldsToFieldsConfig(this.getFields()),
2310
+ isTypeOf: this.isTypeOf,
2311
+ extensions: this.extensions,
2312
+ astNode: this.astNode,
2313
+ extensionASTNodes: this.extensionASTNodes || []
2314
+ };
2315
+ };
2316
+
2317
+ _proto2.toString = function toString() {
2318
+ return this.name;
2319
+ };
2320
+
2321
+ _proto2.toJSON = function toJSON() {
2322
+ return this.toString();
2323
+ } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
2324
+ ;
2325
+
2326
+ _createClass$2(GraphQLObjectType, [{
2327
+ key: SYMBOL_TO_STRING_TAG,
2328
+ get: function get() {
2329
+ return 'GraphQLObjectType';
2330
+ }
2331
+ }]);
2332
+
2333
+ return GraphQLObjectType;
2334
+ }(); // Print a simplified form when appearing in `inspect` and `util.inspect`.
2335
+
2336
+ defineInspect(GraphQLObjectType);
2337
+
2338
+ function defineInterfaces(config) {
2339
+ var _resolveThunk;
2340
+
2341
+ var interfaces = (_resolveThunk = resolveThunk(config.interfaces)) !== null && _resolveThunk !== void 0 ? _resolveThunk : [];
2342
+ Array.isArray(interfaces) || devAssert(0, "".concat(config.name, " interfaces must be an Array or a function which returns an Array."));
2343
+ return interfaces;
2344
+ }
2345
+
2346
+ function defineFieldMap(config) {
2347
+ var fieldMap = resolveThunk(config.fields);
2348
+ isPlainObj(fieldMap) || devAssert(0, "".concat(config.name, " fields must be an object with field names as keys or a function which returns such an object."));
2349
+ return mapValue(fieldMap, function (fieldConfig, fieldName) {
2350
+ var _fieldConfig$args;
2351
+
2352
+ isPlainObj(fieldConfig) || devAssert(0, "".concat(config.name, ".").concat(fieldName, " field config must be an object."));
2353
+ !('isDeprecated' in fieldConfig) || devAssert(0, "".concat(config.name, ".").concat(fieldName, " should provide \"deprecationReason\" instead of \"isDeprecated\"."));
2354
+ fieldConfig.resolve == null || typeof fieldConfig.resolve === 'function' || devAssert(0, "".concat(config.name, ".").concat(fieldName, " field resolver must be a function if ") + "provided, but got: ".concat(inspect(fieldConfig.resolve), "."));
2355
+ var argsConfig = (_fieldConfig$args = fieldConfig.args) !== null && _fieldConfig$args !== void 0 ? _fieldConfig$args : {};
2356
+ isPlainObj(argsConfig) || devAssert(0, "".concat(config.name, ".").concat(fieldName, " args must be an object with argument names as keys."));
2357
+ var args = objectEntries$1(argsConfig).map(function (_ref) {
2358
+ var argName = _ref[0],
2359
+ argConfig = _ref[1];
2360
+ return {
2361
+ name: argName,
2362
+ description: argConfig.description,
2363
+ type: argConfig.type,
2364
+ defaultValue: argConfig.defaultValue,
2365
+ deprecationReason: argConfig.deprecationReason,
2366
+ extensions: argConfig.extensions && toObjMap(argConfig.extensions),
2367
+ astNode: argConfig.astNode
2368
+ };
2369
+ });
2370
+ return {
2371
+ name: fieldName,
2372
+ description: fieldConfig.description,
2373
+ type: fieldConfig.type,
2374
+ args: args,
2375
+ resolve: fieldConfig.resolve,
2376
+ subscribe: fieldConfig.subscribe,
2377
+ isDeprecated: fieldConfig.deprecationReason != null,
2378
+ deprecationReason: fieldConfig.deprecationReason,
2379
+ extensions: fieldConfig.extensions && toObjMap(fieldConfig.extensions),
2380
+ astNode: fieldConfig.astNode
2381
+ };
2382
+ });
2383
+ }
2384
+
2385
+ function isPlainObj(obj) {
2386
+ return isObjectLike(obj) && !Array.isArray(obj);
2387
+ }
2388
+
2389
+ function fieldsToFieldsConfig(fields) {
2390
+ return mapValue(fields, function (field) {
2391
+ return {
2392
+ description: field.description,
2393
+ type: field.type,
2394
+ args: argsToArgsConfig(field.args),
2395
+ resolve: field.resolve,
2396
+ subscribe: field.subscribe,
2397
+ deprecationReason: field.deprecationReason,
2398
+ extensions: field.extensions,
2399
+ astNode: field.astNode
2400
+ };
2401
+ });
2402
+ }
2403
+ /**
2404
+ * @internal
2405
+ */
2406
+
2407
+
2408
+ function argsToArgsConfig(args) {
2409
+ return keyValMap(args, function (arg) {
2410
+ return arg.name;
2411
+ }, function (arg) {
2412
+ return {
2413
+ description: arg.description,
2414
+ type: arg.type,
2415
+ defaultValue: arg.defaultValue,
2416
+ deprecationReason: arg.deprecationReason,
2417
+ extensions: arg.extensions,
2418
+ astNode: arg.astNode
2419
+ };
2420
+ });
2421
+ }
2422
+
2423
+ /**
2424
+ * Interface Type Definition
2425
+ *
2426
+ * When a field can return one of a heterogeneous set of types, a Interface type
2427
+ * is used to describe what types are possible, what fields are in common across
2428
+ * all types, as well as a function to determine which type is actually used
2429
+ * when the field is resolved.
2430
+ *
2431
+ * Example:
2432
+ *
2433
+ * const EntityType = new GraphQLInterfaceType({
2434
+ * name: 'Entity',
2435
+ * fields: {
2436
+ * name: { type: GraphQLString }
2437
+ * }
2438
+ * });
2439
+ *
2440
+ */
2441
+ var GraphQLInterfaceType = /*#__PURE__*/function () {
2442
+ function GraphQLInterfaceType(config) {
2443
+ this.name = config.name;
2444
+ this.description = config.description;
2445
+ this.resolveType = config.resolveType;
2446
+ this.extensions = config.extensions && toObjMap(config.extensions);
2447
+ this.astNode = config.astNode;
2448
+ this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
2449
+ this._fields = defineFieldMap.bind(undefined, config);
2450
+ this._interfaces = defineInterfaces.bind(undefined, config);
2451
+ typeof config.name === 'string' || devAssert(0, 'Must provide name.');
2452
+ config.resolveType == null || typeof config.resolveType === 'function' || devAssert(0, "".concat(this.name, " must provide \"resolveType\" as a function, ") + "but got: ".concat(inspect(config.resolveType), "."));
2453
+ }
2454
+
2455
+ var _proto3 = GraphQLInterfaceType.prototype;
2456
+
2457
+ _proto3.getFields = function getFields() {
2458
+ if (typeof this._fields === 'function') {
2459
+ this._fields = this._fields();
2460
+ }
2461
+
2462
+ return this._fields;
2463
+ };
2464
+
2465
+ _proto3.getInterfaces = function getInterfaces() {
2466
+ if (typeof this._interfaces === 'function') {
2467
+ this._interfaces = this._interfaces();
2468
+ }
2469
+
2470
+ return this._interfaces;
2471
+ };
2472
+
2473
+ _proto3.toConfig = function toConfig() {
2474
+ var _this$extensionASTNod2;
2475
+
2476
+ return {
2477
+ name: this.name,
2478
+ description: this.description,
2479
+ interfaces: this.getInterfaces(),
2480
+ fields: fieldsToFieldsConfig(this.getFields()),
2481
+ resolveType: this.resolveType,
2482
+ extensions: this.extensions,
2483
+ astNode: this.astNode,
2484
+ extensionASTNodes: (_this$extensionASTNod2 = this.extensionASTNodes) !== null && _this$extensionASTNod2 !== void 0 ? _this$extensionASTNod2 : []
2485
+ };
2486
+ };
2487
+
2488
+ _proto3.toString = function toString() {
2489
+ return this.name;
2490
+ };
2491
+
2492
+ _proto3.toJSON = function toJSON() {
2493
+ return this.toString();
2494
+ } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
2495
+ ;
2496
+
2497
+ _createClass$2(GraphQLInterfaceType, [{
2498
+ key: SYMBOL_TO_STRING_TAG,
2499
+ get: function get() {
2500
+ return 'GraphQLInterfaceType';
2501
+ }
2502
+ }]);
2503
+
2504
+ return GraphQLInterfaceType;
2505
+ }(); // Print a simplified form when appearing in `inspect` and `util.inspect`.
2506
+
2507
+ defineInspect(GraphQLInterfaceType);
2508
+
2509
+ /**
2510
+ * Union Type Definition
2511
+ *
2512
+ * When a field can return one of a heterogeneous set of types, a Union type
2513
+ * is used to describe what types are possible as well as providing a function
2514
+ * to determine which type is actually used when the field is resolved.
2515
+ *
2516
+ * Example:
2517
+ *
2518
+ * const PetType = new GraphQLUnionType({
2519
+ * name: 'Pet',
2520
+ * types: [ DogType, CatType ],
2521
+ * resolveType(value) {
2522
+ * if (value instanceof Dog) {
2523
+ * return DogType;
2524
+ * }
2525
+ * if (value instanceof Cat) {
2526
+ * return CatType;
2527
+ * }
2528
+ * }
2529
+ * });
2530
+ *
2531
+ */
2532
+ var GraphQLUnionType = /*#__PURE__*/function () {
2533
+ function GraphQLUnionType(config) {
2534
+ this.name = config.name;
2535
+ this.description = config.description;
2536
+ this.resolveType = config.resolveType;
2537
+ this.extensions = config.extensions && toObjMap(config.extensions);
2538
+ this.astNode = config.astNode;
2539
+ this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
2540
+ this._types = defineTypes.bind(undefined, config);
2541
+ typeof config.name === 'string' || devAssert(0, 'Must provide name.');
2542
+ config.resolveType == null || typeof config.resolveType === 'function' || devAssert(0, "".concat(this.name, " must provide \"resolveType\" as a function, ") + "but got: ".concat(inspect(config.resolveType), "."));
2543
+ }
2544
+
2545
+ var _proto4 = GraphQLUnionType.prototype;
2546
+
2547
+ _proto4.getTypes = function getTypes() {
2548
+ if (typeof this._types === 'function') {
2549
+ this._types = this._types();
2550
+ }
2551
+
2552
+ return this._types;
2553
+ };
2554
+
2555
+ _proto4.toConfig = function toConfig() {
2556
+ var _this$extensionASTNod3;
2557
+
2558
+ return {
2559
+ name: this.name,
2560
+ description: this.description,
2561
+ types: this.getTypes(),
2562
+ resolveType: this.resolveType,
2563
+ extensions: this.extensions,
2564
+ astNode: this.astNode,
2565
+ extensionASTNodes: (_this$extensionASTNod3 = this.extensionASTNodes) !== null && _this$extensionASTNod3 !== void 0 ? _this$extensionASTNod3 : []
2566
+ };
2567
+ };
2568
+
2569
+ _proto4.toString = function toString() {
2570
+ return this.name;
2571
+ };
2572
+
2573
+ _proto4.toJSON = function toJSON() {
2574
+ return this.toString();
2575
+ } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
2576
+ ;
2577
+
2578
+ _createClass$2(GraphQLUnionType, [{
2579
+ key: SYMBOL_TO_STRING_TAG,
2580
+ get: function get() {
2581
+ return 'GraphQLUnionType';
2582
+ }
2583
+ }]);
2584
+
2585
+ return GraphQLUnionType;
2586
+ }(); // Print a simplified form when appearing in `inspect` and `util.inspect`.
2587
+
2588
+ defineInspect(GraphQLUnionType);
2589
+
2590
+ function defineTypes(config) {
2591
+ var types = resolveThunk(config.types);
2592
+ Array.isArray(types) || devAssert(0, "Must provide Array of types or a function which returns such an array for Union ".concat(config.name, "."));
2593
+ return types;
2594
+ }
2595
+
2596
+ /**
2597
+ * Enum Type Definition
2598
+ *
2599
+ * Some leaf values of requests and input values are Enums. GraphQL serializes
2600
+ * Enum values as strings, however internally Enums can be represented by any
2601
+ * kind of type, often integers.
2602
+ *
2603
+ * Example:
2604
+ *
2605
+ * const RGBType = new GraphQLEnumType({
2606
+ * name: 'RGB',
2607
+ * values: {
2608
+ * RED: { value: 0 },
2609
+ * GREEN: { value: 1 },
2610
+ * BLUE: { value: 2 }
2611
+ * }
2612
+ * });
2613
+ *
2614
+ * Note: If a value is not provided in a definition, the name of the enum value
2615
+ * will be used as its internal value.
2616
+ */
2617
+ var GraphQLEnumType
2618
+ /* <T> */
2619
+ = /*#__PURE__*/function () {
2620
+ function GraphQLEnumType(config) {
2621
+ this.name = config.name;
2622
+ this.description = config.description;
2623
+ this.extensions = config.extensions && toObjMap(config.extensions);
2624
+ this.astNode = config.astNode;
2625
+ this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
2626
+ this._values = defineEnumValues(this.name, config.values);
2627
+ this._valueLookup = new Map(this._values.map(function (enumValue) {
2628
+ return [enumValue.value, enumValue];
2629
+ }));
2630
+ this._nameLookup = keyMap(this._values, function (value) {
2631
+ return value.name;
2632
+ });
2633
+ typeof config.name === 'string' || devAssert(0, 'Must provide name.');
2634
+ }
2635
+
2636
+ var _proto5 = GraphQLEnumType.prototype;
2637
+
2638
+ _proto5.getValues = function getValues() {
2639
+ return this._values;
2640
+ };
2641
+
2642
+ _proto5.getValue = function getValue(name) {
2643
+ return this._nameLookup[name];
2644
+ };
2645
+
2646
+ _proto5.serialize = function serialize(outputValue) {
2647
+ var enumValue = this._valueLookup.get(outputValue);
2648
+
2649
+ if (enumValue === undefined) {
2650
+ throw new GraphQLError("Enum \"".concat(this.name, "\" cannot represent value: ").concat(inspect(outputValue)));
2651
+ }
2652
+
2653
+ return enumValue.name;
2654
+ };
2655
+
2656
+ _proto5.parseValue = function parseValue(inputValue)
2657
+ /* T */
2658
+ {
2659
+ if (typeof inputValue !== 'string') {
2660
+ var valueStr = inspect(inputValue);
2661
+ throw new GraphQLError("Enum \"".concat(this.name, "\" cannot represent non-string value: ").concat(valueStr, ".") + didYouMeanEnumValue(this, valueStr));
2662
+ }
2663
+
2664
+ var enumValue = this.getValue(inputValue);
2665
+
2666
+ if (enumValue == null) {
2667
+ throw new GraphQLError("Value \"".concat(inputValue, "\" does not exist in \"").concat(this.name, "\" enum.") + didYouMeanEnumValue(this, inputValue));
2668
+ }
2669
+
2670
+ return enumValue.value;
2671
+ };
2672
+
2673
+ _proto5.parseLiteral = function parseLiteral(valueNode, _variables)
2674
+ /* T */
2675
+ {
2676
+ // Note: variables will be resolved to a value before calling this function.
2677
+ if (valueNode.kind !== Kind.ENUM) {
2678
+ var valueStr = print(valueNode);
2679
+ throw new GraphQLError("Enum \"".concat(this.name, "\" cannot represent non-enum value: ").concat(valueStr, ".") + didYouMeanEnumValue(this, valueStr), valueNode);
2680
+ }
2681
+
2682
+ var enumValue = this.getValue(valueNode.value);
2683
+
2684
+ if (enumValue == null) {
2685
+ var _valueStr = print(valueNode);
2686
+
2687
+ throw new GraphQLError("Value \"".concat(_valueStr, "\" does not exist in \"").concat(this.name, "\" enum.") + didYouMeanEnumValue(this, _valueStr), valueNode);
2688
+ }
2689
+
2690
+ return enumValue.value;
2691
+ };
2692
+
2693
+ _proto5.toConfig = function toConfig() {
2694
+ var _this$extensionASTNod4;
2695
+
2696
+ var values = keyValMap(this.getValues(), function (value) {
2697
+ return value.name;
2698
+ }, function (value) {
2699
+ return {
2700
+ description: value.description,
2701
+ value: value.value,
2702
+ deprecationReason: value.deprecationReason,
2703
+ extensions: value.extensions,
2704
+ astNode: value.astNode
2705
+ };
2706
+ });
2707
+ return {
2708
+ name: this.name,
2709
+ description: this.description,
2710
+ values: values,
2711
+ extensions: this.extensions,
2712
+ astNode: this.astNode,
2713
+ extensionASTNodes: (_this$extensionASTNod4 = this.extensionASTNodes) !== null && _this$extensionASTNod4 !== void 0 ? _this$extensionASTNod4 : []
2714
+ };
2715
+ };
2716
+
2717
+ _proto5.toString = function toString() {
2718
+ return this.name;
2719
+ };
2720
+
2721
+ _proto5.toJSON = function toJSON() {
2722
+ return this.toString();
2723
+ } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
2724
+ ;
2725
+
2726
+ _createClass$2(GraphQLEnumType, [{
2727
+ key: SYMBOL_TO_STRING_TAG,
2728
+ get: function get() {
2729
+ return 'GraphQLEnumType';
2730
+ }
2731
+ }]);
2732
+
2733
+ return GraphQLEnumType;
2734
+ }(); // Print a simplified form when appearing in `inspect` and `util.inspect`.
2735
+
2736
+ defineInspect(GraphQLEnumType);
2737
+
2738
+ function didYouMeanEnumValue(enumType, unknownValueStr) {
2739
+ var allNames = enumType.getValues().map(function (value) {
2740
+ return value.name;
2741
+ });
2742
+ var suggestedValues = suggestionList(unknownValueStr, allNames);
2743
+ return didYouMean('the enum value', suggestedValues);
2744
+ }
2745
+
2746
+ function defineEnumValues(typeName, valueMap) {
2747
+ isPlainObj(valueMap) || devAssert(0, "".concat(typeName, " values must be an object with value names as keys."));
2748
+ return objectEntries$1(valueMap).map(function (_ref2) {
2749
+ var valueName = _ref2[0],
2750
+ valueConfig = _ref2[1];
2751
+ isPlainObj(valueConfig) || devAssert(0, "".concat(typeName, ".").concat(valueName, " must refer to an object with a \"value\" key ") + "representing an internal value but got: ".concat(inspect(valueConfig), "."));
2752
+ !('isDeprecated' in valueConfig) || devAssert(0, "".concat(typeName, ".").concat(valueName, " should provide \"deprecationReason\" instead of \"isDeprecated\"."));
2753
+ return {
2754
+ name: valueName,
2755
+ description: valueConfig.description,
2756
+ value: valueConfig.value !== undefined ? valueConfig.value : valueName,
2757
+ isDeprecated: valueConfig.deprecationReason != null,
2758
+ deprecationReason: valueConfig.deprecationReason,
2759
+ extensions: valueConfig.extensions && toObjMap(valueConfig.extensions),
2760
+ astNode: valueConfig.astNode
2761
+ };
2762
+ });
2763
+ }
2764
+
2765
+ /**
2766
+ * Input Object Type Definition
2767
+ *
2768
+ * An input object defines a structured collection of fields which may be
2769
+ * supplied to a field argument.
2770
+ *
2771
+ * Using `NonNull` will ensure that a value must be provided by the query
2772
+ *
2773
+ * Example:
2774
+ *
2775
+ * const GeoPoint = new GraphQLInputObjectType({
2776
+ * name: 'GeoPoint',
2777
+ * fields: {
2778
+ * lat: { type: new GraphQLNonNull(GraphQLFloat) },
2779
+ * lon: { type: new GraphQLNonNull(GraphQLFloat) },
2780
+ * alt: { type: GraphQLFloat, defaultValue: 0 },
2781
+ * }
2782
+ * });
2783
+ *
2784
+ */
2785
+ var GraphQLInputObjectType = /*#__PURE__*/function () {
2786
+ function GraphQLInputObjectType(config) {
2787
+ this.name = config.name;
2788
+ this.description = config.description;
2789
+ this.extensions = config.extensions && toObjMap(config.extensions);
2790
+ this.astNode = config.astNode;
2791
+ this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
2792
+ this._fields = defineInputFieldMap.bind(undefined, config);
2793
+ typeof config.name === 'string' || devAssert(0, 'Must provide name.');
2794
+ }
2795
+
2796
+ var _proto6 = GraphQLInputObjectType.prototype;
2797
+
2798
+ _proto6.getFields = function getFields() {
2799
+ if (typeof this._fields === 'function') {
2800
+ this._fields = this._fields();
2801
+ }
2802
+
2803
+ return this._fields;
2804
+ };
2805
+
2806
+ _proto6.toConfig = function toConfig() {
2807
+ var _this$extensionASTNod5;
2808
+
2809
+ var fields = mapValue(this.getFields(), function (field) {
2810
+ return {
2811
+ description: field.description,
2812
+ type: field.type,
2813
+ defaultValue: field.defaultValue,
2814
+ deprecationReason: field.deprecationReason,
2815
+ extensions: field.extensions,
2816
+ astNode: field.astNode
2817
+ };
2818
+ });
2819
+ return {
2820
+ name: this.name,
2821
+ description: this.description,
2822
+ fields: fields,
2823
+ extensions: this.extensions,
2824
+ astNode: this.astNode,
2825
+ extensionASTNodes: (_this$extensionASTNod5 = this.extensionASTNodes) !== null && _this$extensionASTNod5 !== void 0 ? _this$extensionASTNod5 : []
2826
+ };
2827
+ };
2828
+
2829
+ _proto6.toString = function toString() {
2830
+ return this.name;
2831
+ };
2832
+
2833
+ _proto6.toJSON = function toJSON() {
2834
+ return this.toString();
2835
+ } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
2836
+ ;
2837
+
2838
+ _createClass$2(GraphQLInputObjectType, [{
2839
+ key: SYMBOL_TO_STRING_TAG,
2840
+ get: function get() {
2841
+ return 'GraphQLInputObjectType';
2842
+ }
2843
+ }]);
2844
+
2845
+ return GraphQLInputObjectType;
2846
+ }(); // Print a simplified form when appearing in `inspect` and `util.inspect`.
2847
+
2848
+ defineInspect(GraphQLInputObjectType);
2849
+
2850
+ function defineInputFieldMap(config) {
2851
+ var fieldMap = resolveThunk(config.fields);
2852
+ isPlainObj(fieldMap) || devAssert(0, "".concat(config.name, " fields must be an object with field names as keys or a function which returns such an object."));
2853
+ return mapValue(fieldMap, function (fieldConfig, fieldName) {
2854
+ !('resolve' in fieldConfig) || devAssert(0, "".concat(config.name, ".").concat(fieldName, " field has a resolve property, but Input Types cannot define resolvers."));
2855
+ return {
2856
+ name: fieldName,
2857
+ description: fieldConfig.description,
2858
+ type: fieldConfig.type,
2859
+ defaultValue: fieldConfig.defaultValue,
2860
+ deprecationReason: fieldConfig.deprecationReason,
2861
+ extensions: fieldConfig.extensions && toObjMap(fieldConfig.extensions),
2862
+ astNode: fieldConfig.astNode
2863
+ };
2864
+ });
2865
+ }
2866
+
2867
+ /* eslint-disable no-redeclare */
2868
+ // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
2869
+ var isFinitePolyfill = Number.isFinite || function (value) {
2870
+ return typeof value === 'number' && isFinite(value);
2871
+ };
2872
+
2873
+ var isFinite$1 = isFinitePolyfill;
2874
+
2875
+ 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); }
2876
+ /**
2877
+ * Safer version of `Array.from` that return `null` if value isn't convertible to array.
2878
+ * Also protects against Array-like objects without items.
2879
+ *
2880
+ * @example
2881
+ *
2882
+ * safeArrayFrom([ 1, 2, 3 ]) // [1, 2, 3]
2883
+ * safeArrayFrom('ABC') // null
2884
+ * safeArrayFrom({ length: 1 }) // null
2885
+ * safeArrayFrom({ length: 1, 0: 'Alpha' }) // ['Alpha']
2886
+ * safeArrayFrom({ key: 'value' }) // null
2887
+ * safeArrayFrom(new Map()) // []
2888
+ *
2889
+ */
2890
+
2891
+ function safeArrayFrom(collection) {
2892
+ var mapFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (item) {
2893
+ return item;
2894
+ };
2895
+
2896
+ if (collection == null || _typeof(collection) !== 'object') {
2897
+ return null;
2898
+ }
2899
+
2900
+ if (Array.isArray(collection)) {
2901
+ return collection.map(mapFn);
2902
+ } // Is Iterable?
2903
+
2904
+
2905
+ var iteratorMethod = collection[SYMBOL_ITERATOR];
2906
+
2907
+ if (typeof iteratorMethod === 'function') {
2908
+ // $FlowFixMe[incompatible-use]
2909
+ var iterator = iteratorMethod.call(collection);
2910
+ var result = [];
2911
+ var step;
2912
+
2913
+ for (var i = 0; !(step = iterator.next()).done; ++i) {
2914
+ result.push(mapFn(step.value, i));
2915
+ }
2916
+
2917
+ return result;
2918
+ } // Is Array like?
2919
+
2920
+
2921
+ var length = collection.length;
2922
+
2923
+ if (typeof length === 'number' && length >= 0 && length % 1 === 0) {
2924
+ var _result = [];
2925
+
2926
+ for (var _i = 0; _i < length; ++_i) {
2927
+ if (!Object.prototype.hasOwnProperty.call(collection, _i)) {
2928
+ return null;
2929
+ }
2930
+
2931
+ _result.push(mapFn(collection[String(_i)], _i));
2932
+ }
2933
+
2934
+ return _result;
2935
+ }
2936
+
2937
+ return null;
2938
+ }
2939
+
2940
+ /* eslint-disable no-redeclare */
2941
+ // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
2942
+ var isInteger = Number.isInteger || function (value) {
2943
+ return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;
2944
+ };
2945
+
2946
+ var isInteger$1 = isInteger;
2947
+
2948
+ // 32-bit signed integer, providing the broadest support across platforms.
2949
+ //
2950
+ // n.b. JavaScript's integers are safe between -(2^53 - 1) and 2^53 - 1 because
2951
+ // they are internally represented as IEEE 754 doubles.
2952
+
2953
+ var MAX_INT = 2147483647;
2954
+ var MIN_INT = -2147483648;
2955
+
2956
+ function serializeInt(outputValue) {
2957
+ var coercedValue = serializeObject(outputValue);
2958
+
2959
+ if (typeof coercedValue === 'boolean') {
2960
+ return coercedValue ? 1 : 0;
2961
+ }
2962
+
2963
+ var num = coercedValue;
2964
+
2965
+ if (typeof coercedValue === 'string' && coercedValue !== '') {
2966
+ num = Number(coercedValue);
2967
+ }
2968
+
2969
+ if (!isInteger$1(num)) {
2970
+ throw new GraphQLError("Int cannot represent non-integer value: ".concat(inspect(coercedValue)));
2971
+ }
2972
+
2973
+ if (num > MAX_INT || num < MIN_INT) {
2974
+ throw new GraphQLError('Int cannot represent non 32-bit signed integer value: ' + inspect(coercedValue));
2975
+ }
2976
+
2977
+ return num;
2978
+ }
2979
+
2980
+ function coerceInt(inputValue) {
2981
+ if (!isInteger$1(inputValue)) {
2982
+ throw new GraphQLError("Int cannot represent non-integer value: ".concat(inspect(inputValue)));
2983
+ }
2984
+
2985
+ if (inputValue > MAX_INT || inputValue < MIN_INT) {
2986
+ throw new GraphQLError("Int cannot represent non 32-bit signed integer value: ".concat(inputValue));
2987
+ }
2988
+
2989
+ return inputValue;
2990
+ }
2991
+
2992
+ var GraphQLInt = new GraphQLScalarType({
2993
+ name: 'Int',
2994
+ description: 'The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.',
2995
+ serialize: serializeInt,
2996
+ parseValue: coerceInt,
2997
+ parseLiteral: function parseLiteral(valueNode) {
2998
+ if (valueNode.kind !== Kind.INT) {
2999
+ throw new GraphQLError("Int cannot represent non-integer value: ".concat(print(valueNode)), valueNode);
3000
+ }
3001
+
3002
+ var num = parseInt(valueNode.value, 10);
3003
+
3004
+ if (num > MAX_INT || num < MIN_INT) {
3005
+ throw new GraphQLError("Int cannot represent non 32-bit signed integer value: ".concat(valueNode.value), valueNode);
3006
+ }
3007
+
3008
+ return num;
3009
+ }
3010
+ });
3011
+
3012
+ function serializeFloat(outputValue) {
3013
+ var coercedValue = serializeObject(outputValue);
3014
+
3015
+ if (typeof coercedValue === 'boolean') {
3016
+ return coercedValue ? 1 : 0;
3017
+ }
3018
+
3019
+ var num = coercedValue;
3020
+
3021
+ if (typeof coercedValue === 'string' && coercedValue !== '') {
3022
+ num = Number(coercedValue);
3023
+ }
3024
+
3025
+ if (!isFinite$1(num)) {
3026
+ throw new GraphQLError("Float cannot represent non numeric value: ".concat(inspect(coercedValue)));
3027
+ }
3028
+
3029
+ return num;
3030
+ }
3031
+
3032
+ function coerceFloat(inputValue) {
3033
+ if (!isFinite$1(inputValue)) {
3034
+ throw new GraphQLError("Float cannot represent non numeric value: ".concat(inspect(inputValue)));
3035
+ }
3036
+
3037
+ return inputValue;
3038
+ }
3039
+
3040
+ var GraphQLFloat = new GraphQLScalarType({
3041
+ name: 'Float',
3042
+ description: 'The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).',
3043
+ serialize: serializeFloat,
3044
+ parseValue: coerceFloat,
3045
+ parseLiteral: function parseLiteral(valueNode) {
3046
+ if (valueNode.kind !== Kind.FLOAT && valueNode.kind !== Kind.INT) {
3047
+ throw new GraphQLError("Float cannot represent non numeric value: ".concat(print(valueNode)), valueNode);
3048
+ }
3049
+
3050
+ return parseFloat(valueNode.value);
3051
+ }
3052
+ }); // Support serializing objects with custom valueOf() or toJSON() functions -
3053
+ // a common way to represent a complex value which can be represented as
3054
+ // a string (ex: MongoDB id objects).
3055
+
3056
+ function serializeObject(outputValue) {
3057
+ if (isObjectLike(outputValue)) {
3058
+ if (typeof outputValue.valueOf === 'function') {
3059
+ var valueOfResult = outputValue.valueOf();
3060
+
3061
+ if (!isObjectLike(valueOfResult)) {
3062
+ return valueOfResult;
3063
+ }
3064
+ }
3065
+
3066
+ if (typeof outputValue.toJSON === 'function') {
3067
+ // $FlowFixMe[incompatible-use]
3068
+ return outputValue.toJSON();
3069
+ }
3070
+ }
3071
+
3072
+ return outputValue;
3073
+ }
3074
+
3075
+ function serializeString(outputValue) {
3076
+ var coercedValue = serializeObject(outputValue); // Serialize string, boolean and number values to a string, but do not
3077
+ // attempt to coerce object, function, symbol, or other types as strings.
3078
+
3079
+ if (typeof coercedValue === 'string') {
3080
+ return coercedValue;
3081
+ }
3082
+
3083
+ if (typeof coercedValue === 'boolean') {
3084
+ return coercedValue ? 'true' : 'false';
3085
+ }
3086
+
3087
+ if (isFinite$1(coercedValue)) {
3088
+ return coercedValue.toString();
3089
+ }
3090
+
3091
+ throw new GraphQLError("String cannot represent value: ".concat(inspect(outputValue)));
3092
+ }
3093
+
3094
+ function coerceString(inputValue) {
3095
+ if (typeof inputValue !== 'string') {
3096
+ throw new GraphQLError("String cannot represent a non string value: ".concat(inspect(inputValue)));
3097
+ }
3098
+
3099
+ return inputValue;
3100
+ }
3101
+
3102
+ var GraphQLString = new GraphQLScalarType({
3103
+ name: 'String',
3104
+ description: 'The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.',
3105
+ serialize: serializeString,
3106
+ parseValue: coerceString,
3107
+ parseLiteral: function parseLiteral(valueNode) {
3108
+ if (valueNode.kind !== Kind.STRING) {
3109
+ throw new GraphQLError("String cannot represent a non string value: ".concat(print(valueNode)), valueNode);
3110
+ }
3111
+
3112
+ return valueNode.value;
3113
+ }
3114
+ });
3115
+
3116
+ function serializeBoolean(outputValue) {
3117
+ var coercedValue = serializeObject(outputValue);
3118
+
3119
+ if (typeof coercedValue === 'boolean') {
3120
+ return coercedValue;
3121
+ }
3122
+
3123
+ if (isFinite$1(coercedValue)) {
3124
+ return coercedValue !== 0;
3125
+ }
3126
+
3127
+ throw new GraphQLError("Boolean cannot represent a non boolean value: ".concat(inspect(coercedValue)));
3128
+ }
3129
+
3130
+ function coerceBoolean(inputValue) {
3131
+ if (typeof inputValue !== 'boolean') {
3132
+ throw new GraphQLError("Boolean cannot represent a non boolean value: ".concat(inspect(inputValue)));
3133
+ }
3134
+
3135
+ return inputValue;
3136
+ }
3137
+
3138
+ var GraphQLBoolean = new GraphQLScalarType({
3139
+ name: 'Boolean',
3140
+ description: 'The `Boolean` scalar type represents `true` or `false`.',
3141
+ serialize: serializeBoolean,
3142
+ parseValue: coerceBoolean,
3143
+ parseLiteral: function parseLiteral(valueNode) {
3144
+ if (valueNode.kind !== Kind.BOOLEAN) {
3145
+ throw new GraphQLError("Boolean cannot represent a non boolean value: ".concat(print(valueNode)), valueNode);
3146
+ }
3147
+
3148
+ return valueNode.value;
3149
+ }
3150
+ });
3151
+
3152
+ function serializeID(outputValue) {
3153
+ var coercedValue = serializeObject(outputValue);
3154
+
3155
+ if (typeof coercedValue === 'string') {
3156
+ return coercedValue;
3157
+ }
3158
+
3159
+ if (isInteger$1(coercedValue)) {
3160
+ return String(coercedValue);
3161
+ }
3162
+
3163
+ throw new GraphQLError("ID cannot represent value: ".concat(inspect(outputValue)));
3164
+ }
3165
+
3166
+ function coerceID(inputValue) {
3167
+ if (typeof inputValue === 'string') {
3168
+ return inputValue;
3169
+ }
3170
+
3171
+ if (isInteger$1(inputValue)) {
3172
+ return inputValue.toString();
3173
+ }
3174
+
3175
+ throw new GraphQLError("ID cannot represent value: ".concat(inspect(inputValue)));
3176
+ }
3177
+
3178
+ var GraphQLID = new GraphQLScalarType({
3179
+ name: 'ID',
3180
+ description: 'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.',
3181
+ serialize: serializeID,
3182
+ parseValue: coerceID,
3183
+ parseLiteral: function parseLiteral(valueNode) {
3184
+ if (valueNode.kind !== Kind.STRING && valueNode.kind !== Kind.INT) {
3185
+ throw new GraphQLError('ID cannot represent a non-string and non-integer value: ' + print(valueNode), valueNode);
3186
+ }
3187
+
3188
+ return valueNode.value;
3189
+ }
3190
+ });
3191
+ var specifiedScalarTypes = Object.freeze([GraphQLString, GraphQLInt, GraphQLFloat, GraphQLBoolean, GraphQLID]);
3192
+
3193
+ /**
3194
+ * Produces a GraphQL Value AST given a JavaScript object.
3195
+ * Function will match JavaScript/JSON values to GraphQL AST schema format
3196
+ * by using suggested GraphQLInputType. For example:
3197
+ *
3198
+ * astFromValue("value", GraphQLString)
3199
+ *
3200
+ * A GraphQL type must be provided, which will be used to interpret different
3201
+ * JavaScript values.
3202
+ *
3203
+ * | JSON Value | GraphQL Value |
3204
+ * | ------------- | -------------------- |
3205
+ * | Object | Input Object |
3206
+ * | Array | List |
3207
+ * | Boolean | Boolean |
3208
+ * | String | String / Enum Value |
3209
+ * | Number | Int / Float |
3210
+ * | Mixed | Enum Value |
3211
+ * | null | NullValue |
3212
+ *
3213
+ */
3214
+
3215
+ function astFromValue(value, type) {
3216
+ if (isNonNullType(type)) {
3217
+ var astValue = astFromValue(value, type.ofType);
3218
+
3219
+ if ((astValue === null || astValue === void 0 ? void 0 : astValue.kind) === Kind.NULL) {
3220
+ return null;
3221
+ }
3222
+
3223
+ return astValue;
3224
+ } // only explicit null, not undefined, NaN
3225
+
3226
+
3227
+ if (value === null) {
3228
+ return {
3229
+ kind: Kind.NULL
3230
+ };
3231
+ } // undefined
3232
+
3233
+
3234
+ if (value === undefined) {
3235
+ return null;
3236
+ } // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but
3237
+ // the value is not an array, convert the value using the list's item type.
3238
+
3239
+
3240
+ if (isListType(type)) {
3241
+ var itemType = type.ofType;
3242
+ var items = safeArrayFrom(value);
3243
+
3244
+ if (items != null) {
3245
+ var valuesNodes = [];
3246
+
3247
+ for (var _i2 = 0; _i2 < items.length; _i2++) {
3248
+ var item = items[_i2];
3249
+ var itemNode = astFromValue(item, itemType);
3250
+
3251
+ if (itemNode != null) {
3252
+ valuesNodes.push(itemNode);
3253
+ }
3254
+ }
3255
+
3256
+ return {
3257
+ kind: Kind.LIST,
3258
+ values: valuesNodes
3259
+ };
3260
+ }
3261
+
3262
+ return astFromValue(value, itemType);
3263
+ } // Populate the fields of the input object by creating ASTs from each value
3264
+ // in the JavaScript object according to the fields in the input type.
3265
+
3266
+
3267
+ if (isInputObjectType(type)) {
3268
+ if (!isObjectLike(value)) {
3269
+ return null;
3270
+ }
3271
+
3272
+ var fieldNodes = [];
3273
+
3274
+ for (var _i4 = 0, _objectValues2 = objectValues$1(type.getFields()); _i4 < _objectValues2.length; _i4++) {
3275
+ var field = _objectValues2[_i4];
3276
+ var fieldValue = astFromValue(value[field.name], field.type);
3277
+
3278
+ if (fieldValue) {
3279
+ fieldNodes.push({
3280
+ kind: Kind.OBJECT_FIELD,
3281
+ name: {
3282
+ kind: Kind.NAME,
3283
+ value: field.name
3284
+ },
3285
+ value: fieldValue
3286
+ });
3287
+ }
3288
+ }
3289
+
3290
+ return {
3291
+ kind: Kind.OBJECT,
3292
+ fields: fieldNodes
3293
+ };
3294
+ } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
3295
+
3296
+
3297
+ if (isLeafType(type)) {
3298
+ // Since value is an internally represented value, it must be serialized
3299
+ // to an externally represented value before converting into an AST.
3300
+ var serialized = type.serialize(value);
3301
+
3302
+ if (serialized == null) {
3303
+ return null;
3304
+ } // Others serialize based on their corresponding JavaScript scalar types.
3305
+
3306
+
3307
+ if (typeof serialized === 'boolean') {
3308
+ return {
3309
+ kind: Kind.BOOLEAN,
3310
+ value: serialized
3311
+ };
3312
+ } // JavaScript numbers can be Int or Float values.
3313
+
3314
+
3315
+ if (typeof serialized === 'number' && isFinite$1(serialized)) {
3316
+ var stringNum = String(serialized);
3317
+ return integerStringRegExp.test(stringNum) ? {
3318
+ kind: Kind.INT,
3319
+ value: stringNum
3320
+ } : {
3321
+ kind: Kind.FLOAT,
3322
+ value: stringNum
3323
+ };
3324
+ }
3325
+
3326
+ if (typeof serialized === 'string') {
3327
+ // Enum types use Enum literals.
3328
+ if (isEnumType(type)) {
3329
+ return {
3330
+ kind: Kind.ENUM,
3331
+ value: serialized
3332
+ };
3333
+ } // ID types can use Int literals.
3334
+
3335
+
3336
+ if (type === GraphQLID && integerStringRegExp.test(serialized)) {
3337
+ return {
3338
+ kind: Kind.INT,
3339
+ value: serialized
3340
+ };
3341
+ }
3342
+
3343
+ return {
3344
+ kind: Kind.STRING,
3345
+ value: serialized
3346
+ };
3347
+ }
3348
+
3349
+ throw new TypeError("Cannot convert value to AST: ".concat(inspect(serialized), "."));
3350
+ } // istanbul ignore next (Not reachable. All possible input types have been considered)
3351
+
3352
+
3353
+ invariant(0, 'Unexpected input type: ' + inspect(type));
3354
+ }
3355
+ /**
3356
+ * IntValue:
3357
+ * - NegativeSign? 0
3358
+ * - NegativeSign? NonZeroDigit ( Digit+ )?
3359
+ */
3360
+
3361
+ var integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/;
3362
+
3363
+ var __Schema = new GraphQLObjectType({
3364
+ name: '__Schema',
3365
+ description: 'A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.',
3366
+ fields: function fields() {
3367
+ return {
3368
+ description: {
3369
+ type: GraphQLString,
3370
+ resolve: function resolve(schema) {
3371
+ return schema.description;
3372
+ }
3373
+ },
3374
+ types: {
3375
+ description: 'A list of all types supported by this server.',
3376
+ type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__Type))),
3377
+ resolve: function resolve(schema) {
3378
+ return objectValues$1(schema.getTypeMap());
3379
+ }
3380
+ },
3381
+ queryType: {
3382
+ description: 'The type that query operations will be rooted at.',
3383
+ type: new GraphQLNonNull(__Type),
3384
+ resolve: function resolve(schema) {
3385
+ return schema.getQueryType();
3386
+ }
3387
+ },
3388
+ mutationType: {
3389
+ description: 'If this server supports mutation, the type that mutation operations will be rooted at.',
3390
+ type: __Type,
3391
+ resolve: function resolve(schema) {
3392
+ return schema.getMutationType();
3393
+ }
3394
+ },
3395
+ subscriptionType: {
3396
+ description: 'If this server support subscription, the type that subscription operations will be rooted at.',
3397
+ type: __Type,
3398
+ resolve: function resolve(schema) {
3399
+ return schema.getSubscriptionType();
3400
+ }
3401
+ },
3402
+ directives: {
3403
+ description: 'A list of all directives supported by this server.',
3404
+ type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__Directive))),
3405
+ resolve: function resolve(schema) {
3406
+ return schema.getDirectives();
3407
+ }
3408
+ }
3409
+ };
3410
+ }
3411
+ });
3412
+ var __Directive = new GraphQLObjectType({
3413
+ name: '__Directive',
3414
+ description: "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.",
3415
+ fields: function fields() {
3416
+ return {
3417
+ name: {
3418
+ type: new GraphQLNonNull(GraphQLString),
3419
+ resolve: function resolve(directive) {
3420
+ return directive.name;
3421
+ }
3422
+ },
3423
+ description: {
3424
+ type: GraphQLString,
3425
+ resolve: function resolve(directive) {
3426
+ return directive.description;
3427
+ }
3428
+ },
3429
+ isRepeatable: {
3430
+ type: new GraphQLNonNull(GraphQLBoolean),
3431
+ resolve: function resolve(directive) {
3432
+ return directive.isRepeatable;
3433
+ }
3434
+ },
3435
+ locations: {
3436
+ type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__DirectiveLocation))),
3437
+ resolve: function resolve(directive) {
3438
+ return directive.locations;
3439
+ }
3440
+ },
3441
+ args: {
3442
+ type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__InputValue))),
3443
+ args: {
3444
+ includeDeprecated: {
3445
+ type: GraphQLBoolean,
3446
+ defaultValue: false
3447
+ }
3448
+ },
3449
+ resolve: function resolve(field, _ref) {
3450
+ var includeDeprecated = _ref.includeDeprecated;
3451
+ return includeDeprecated ? field.args : field.args.filter(function (arg) {
3452
+ return arg.deprecationReason == null;
3453
+ });
3454
+ }
3455
+ }
3456
+ };
3457
+ }
3458
+ });
3459
+ var __DirectiveLocation = new GraphQLEnumType({
3460
+ name: '__DirectiveLocation',
3461
+ description: 'A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.',
3462
+ values: {
3463
+ QUERY: {
3464
+ value: DirectiveLocation.QUERY,
3465
+ description: 'Location adjacent to a query operation.'
3466
+ },
3467
+ MUTATION: {
3468
+ value: DirectiveLocation.MUTATION,
3469
+ description: 'Location adjacent to a mutation operation.'
3470
+ },
3471
+ SUBSCRIPTION: {
3472
+ value: DirectiveLocation.SUBSCRIPTION,
3473
+ description: 'Location adjacent to a subscription operation.'
3474
+ },
3475
+ FIELD: {
3476
+ value: DirectiveLocation.FIELD,
3477
+ description: 'Location adjacent to a field.'
3478
+ },
3479
+ FRAGMENT_DEFINITION: {
3480
+ value: DirectiveLocation.FRAGMENT_DEFINITION,
3481
+ description: 'Location adjacent to a fragment definition.'
3482
+ },
3483
+ FRAGMENT_SPREAD: {
3484
+ value: DirectiveLocation.FRAGMENT_SPREAD,
3485
+ description: 'Location adjacent to a fragment spread.'
3486
+ },
3487
+ INLINE_FRAGMENT: {
3488
+ value: DirectiveLocation.INLINE_FRAGMENT,
3489
+ description: 'Location adjacent to an inline fragment.'
3490
+ },
3491
+ VARIABLE_DEFINITION: {
3492
+ value: DirectiveLocation.VARIABLE_DEFINITION,
3493
+ description: 'Location adjacent to a variable definition.'
3494
+ },
3495
+ SCHEMA: {
3496
+ value: DirectiveLocation.SCHEMA,
3497
+ description: 'Location adjacent to a schema definition.'
3498
+ },
3499
+ SCALAR: {
3500
+ value: DirectiveLocation.SCALAR,
3501
+ description: 'Location adjacent to a scalar definition.'
3502
+ },
3503
+ OBJECT: {
3504
+ value: DirectiveLocation.OBJECT,
3505
+ description: 'Location adjacent to an object type definition.'
3506
+ },
3507
+ FIELD_DEFINITION: {
3508
+ value: DirectiveLocation.FIELD_DEFINITION,
3509
+ description: 'Location adjacent to a field definition.'
3510
+ },
3511
+ ARGUMENT_DEFINITION: {
3512
+ value: DirectiveLocation.ARGUMENT_DEFINITION,
3513
+ description: 'Location adjacent to an argument definition.'
3514
+ },
3515
+ INTERFACE: {
3516
+ value: DirectiveLocation.INTERFACE,
3517
+ description: 'Location adjacent to an interface definition.'
3518
+ },
3519
+ UNION: {
3520
+ value: DirectiveLocation.UNION,
3521
+ description: 'Location adjacent to a union definition.'
3522
+ },
3523
+ ENUM: {
3524
+ value: DirectiveLocation.ENUM,
3525
+ description: 'Location adjacent to an enum definition.'
3526
+ },
3527
+ ENUM_VALUE: {
3528
+ value: DirectiveLocation.ENUM_VALUE,
3529
+ description: 'Location adjacent to an enum value definition.'
3530
+ },
3531
+ INPUT_OBJECT: {
3532
+ value: DirectiveLocation.INPUT_OBJECT,
3533
+ description: 'Location adjacent to an input object type definition.'
3534
+ },
3535
+ INPUT_FIELD_DEFINITION: {
3536
+ value: DirectiveLocation.INPUT_FIELD_DEFINITION,
3537
+ description: 'Location adjacent to an input object field definition.'
3538
+ }
3539
+ }
3540
+ });
3541
+ var __Type = new GraphQLObjectType({
3542
+ name: '__Type',
3543
+ description: 'The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByUrl`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.',
3544
+ fields: function fields() {
3545
+ return {
3546
+ kind: {
3547
+ type: new GraphQLNonNull(__TypeKind),
3548
+ resolve: function resolve(type) {
3549
+ if (isScalarType(type)) {
3550
+ return TypeKind.SCALAR;
3551
+ }
3552
+
3553
+ if (isObjectType(type)) {
3554
+ return TypeKind.OBJECT;
3555
+ }
3556
+
3557
+ if (isInterfaceType(type)) {
3558
+ return TypeKind.INTERFACE;
3559
+ }
3560
+
3561
+ if (isUnionType(type)) {
3562
+ return TypeKind.UNION;
3563
+ }
3564
+
3565
+ if (isEnumType(type)) {
3566
+ return TypeKind.ENUM;
3567
+ }
3568
+
3569
+ if (isInputObjectType(type)) {
3570
+ return TypeKind.INPUT_OBJECT;
3571
+ }
3572
+
3573
+ if (isListType(type)) {
3574
+ return TypeKind.LIST;
3575
+ } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
3576
+
3577
+
3578
+ if (isNonNullType(type)) {
3579
+ return TypeKind.NON_NULL;
3580
+ } // istanbul ignore next (Not reachable. All possible types have been considered)
3581
+
3582
+
3583
+ invariant(0, "Unexpected type: \"".concat(inspect(type), "\"."));
3584
+ }
3585
+ },
3586
+ name: {
3587
+ type: GraphQLString,
3588
+ resolve: function resolve(type) {
3589
+ return type.name !== undefined ? type.name : undefined;
3590
+ }
3591
+ },
3592
+ description: {
3593
+ type: GraphQLString,
3594
+ resolve: function resolve(type) {
3595
+ return type.description !== undefined ? type.description : undefined;
3596
+ }
3597
+ },
3598
+ specifiedByUrl: {
3599
+ type: GraphQLString,
3600
+ resolve: function resolve(obj) {
3601
+ return obj.specifiedByUrl !== undefined ? obj.specifiedByUrl : undefined;
3602
+ }
3603
+ },
3604
+ fields: {
3605
+ type: new GraphQLList(new GraphQLNonNull(__Field)),
3606
+ args: {
3607
+ includeDeprecated: {
3608
+ type: GraphQLBoolean,
3609
+ defaultValue: false
3610
+ }
3611
+ },
3612
+ resolve: function resolve(type, _ref2) {
3613
+ var includeDeprecated = _ref2.includeDeprecated;
3614
+
3615
+ if (isObjectType(type) || isInterfaceType(type)) {
3616
+ var fields = objectValues$1(type.getFields());
3617
+ return includeDeprecated ? fields : fields.filter(function (field) {
3618
+ return field.deprecationReason == null;
3619
+ });
3620
+ }
3621
+ }
3622
+ },
3623
+ interfaces: {
3624
+ type: new GraphQLList(new GraphQLNonNull(__Type)),
3625
+ resolve: function resolve(type) {
3626
+ if (isObjectType(type) || isInterfaceType(type)) {
3627
+ return type.getInterfaces();
3628
+ }
3629
+ }
3630
+ },
3631
+ possibleTypes: {
3632
+ type: new GraphQLList(new GraphQLNonNull(__Type)),
3633
+ resolve: function resolve(type, _args, _context, _ref3) {
3634
+ var schema = _ref3.schema;
3635
+
3636
+ if (isAbstractType(type)) {
3637
+ return schema.getPossibleTypes(type);
3638
+ }
3639
+ }
3640
+ },
3641
+ enumValues: {
3642
+ type: new GraphQLList(new GraphQLNonNull(__EnumValue)),
3643
+ args: {
3644
+ includeDeprecated: {
3645
+ type: GraphQLBoolean,
3646
+ defaultValue: false
3647
+ }
3648
+ },
3649
+ resolve: function resolve(type, _ref4) {
3650
+ var includeDeprecated = _ref4.includeDeprecated;
3651
+
3652
+ if (isEnumType(type)) {
3653
+ var values = type.getValues();
3654
+ return includeDeprecated ? values : values.filter(function (field) {
3655
+ return field.deprecationReason == null;
3656
+ });
3657
+ }
3658
+ }
3659
+ },
3660
+ inputFields: {
3661
+ type: new GraphQLList(new GraphQLNonNull(__InputValue)),
3662
+ args: {
3663
+ includeDeprecated: {
3664
+ type: GraphQLBoolean,
3665
+ defaultValue: false
3666
+ }
3667
+ },
3668
+ resolve: function resolve(type, _ref5) {
3669
+ var includeDeprecated = _ref5.includeDeprecated;
3670
+
3671
+ if (isInputObjectType(type)) {
3672
+ var values = objectValues$1(type.getFields());
3673
+ return includeDeprecated ? values : values.filter(function (field) {
3674
+ return field.deprecationReason == null;
3675
+ });
3676
+ }
3677
+ }
3678
+ },
3679
+ ofType: {
3680
+ type: __Type,
3681
+ resolve: function resolve(type) {
3682
+ return type.ofType !== undefined ? type.ofType : undefined;
3683
+ }
3684
+ }
3685
+ };
3686
+ }
3687
+ });
3688
+ var __Field = new GraphQLObjectType({
3689
+ name: '__Field',
3690
+ description: 'Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.',
3691
+ fields: function fields() {
3692
+ return {
3693
+ name: {
3694
+ type: new GraphQLNonNull(GraphQLString),
3695
+ resolve: function resolve(field) {
3696
+ return field.name;
3697
+ }
3698
+ },
3699
+ description: {
3700
+ type: GraphQLString,
3701
+ resolve: function resolve(field) {
3702
+ return field.description;
3703
+ }
3704
+ },
3705
+ args: {
3706
+ type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__InputValue))),
3707
+ args: {
3708
+ includeDeprecated: {
3709
+ type: GraphQLBoolean,
3710
+ defaultValue: false
3711
+ }
3712
+ },
3713
+ resolve: function resolve(field, _ref6) {
3714
+ var includeDeprecated = _ref6.includeDeprecated;
3715
+ return includeDeprecated ? field.args : field.args.filter(function (arg) {
3716
+ return arg.deprecationReason == null;
3717
+ });
3718
+ }
3719
+ },
3720
+ type: {
3721
+ type: new GraphQLNonNull(__Type),
3722
+ resolve: function resolve(field) {
3723
+ return field.type;
3724
+ }
3725
+ },
3726
+ isDeprecated: {
3727
+ type: new GraphQLNonNull(GraphQLBoolean),
3728
+ resolve: function resolve(field) {
3729
+ return field.deprecationReason != null;
3730
+ }
3731
+ },
3732
+ deprecationReason: {
3733
+ type: GraphQLString,
3734
+ resolve: function resolve(field) {
3735
+ return field.deprecationReason;
3736
+ }
3737
+ }
3738
+ };
3739
+ }
3740
+ });
3741
+ var __InputValue = new GraphQLObjectType({
3742
+ name: '__InputValue',
3743
+ description: 'Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.',
3744
+ fields: function fields() {
3745
+ return {
3746
+ name: {
3747
+ type: new GraphQLNonNull(GraphQLString),
3748
+ resolve: function resolve(inputValue) {
3749
+ return inputValue.name;
3750
+ }
3751
+ },
3752
+ description: {
3753
+ type: GraphQLString,
3754
+ resolve: function resolve(inputValue) {
3755
+ return inputValue.description;
3756
+ }
3757
+ },
3758
+ type: {
3759
+ type: new GraphQLNonNull(__Type),
3760
+ resolve: function resolve(inputValue) {
3761
+ return inputValue.type;
3762
+ }
3763
+ },
3764
+ defaultValue: {
3765
+ type: GraphQLString,
3766
+ description: 'A GraphQL-formatted string representing the default value for this input value.',
3767
+ resolve: function resolve(inputValue) {
3768
+ var type = inputValue.type,
3769
+ defaultValue = inputValue.defaultValue;
3770
+ var valueAST = astFromValue(defaultValue, type);
3771
+ return valueAST ? print(valueAST) : null;
3772
+ }
3773
+ },
3774
+ isDeprecated: {
3775
+ type: new GraphQLNonNull(GraphQLBoolean),
3776
+ resolve: function resolve(field) {
3777
+ return field.deprecationReason != null;
3778
+ }
3779
+ },
3780
+ deprecationReason: {
3781
+ type: GraphQLString,
3782
+ resolve: function resolve(obj) {
3783
+ return obj.deprecationReason;
3784
+ }
3785
+ }
3786
+ };
3787
+ }
3788
+ });
3789
+ var __EnumValue = new GraphQLObjectType({
3790
+ name: '__EnumValue',
3791
+ description: 'One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.',
3792
+ fields: function fields() {
3793
+ return {
3794
+ name: {
3795
+ type: new GraphQLNonNull(GraphQLString),
3796
+ resolve: function resolve(enumValue) {
3797
+ return enumValue.name;
3798
+ }
3799
+ },
3800
+ description: {
3801
+ type: GraphQLString,
3802
+ resolve: function resolve(enumValue) {
3803
+ return enumValue.description;
3804
+ }
3805
+ },
3806
+ isDeprecated: {
3807
+ type: new GraphQLNonNull(GraphQLBoolean),
3808
+ resolve: function resolve(enumValue) {
3809
+ return enumValue.deprecationReason != null;
3810
+ }
3811
+ },
3812
+ deprecationReason: {
3813
+ type: GraphQLString,
3814
+ resolve: function resolve(enumValue) {
3815
+ return enumValue.deprecationReason;
3816
+ }
3817
+ }
3818
+ };
3819
+ }
3820
+ });
3821
+ var TypeKind = Object.freeze({
3822
+ SCALAR: 'SCALAR',
3823
+ OBJECT: 'OBJECT',
3824
+ INTERFACE: 'INTERFACE',
3825
+ UNION: 'UNION',
3826
+ ENUM: 'ENUM',
3827
+ INPUT_OBJECT: 'INPUT_OBJECT',
3828
+ LIST: 'LIST',
3829
+ NON_NULL: 'NON_NULL'
3830
+ });
3831
+ var __TypeKind = new GraphQLEnumType({
3832
+ name: '__TypeKind',
3833
+ description: 'An enum describing what kind of type a given `__Type` is.',
3834
+ values: {
3835
+ SCALAR: {
3836
+ value: TypeKind.SCALAR,
3837
+ description: 'Indicates this type is a scalar.'
3838
+ },
3839
+ OBJECT: {
3840
+ value: TypeKind.OBJECT,
3841
+ description: 'Indicates this type is an object. `fields` and `interfaces` are valid fields.'
3842
+ },
3843
+ INTERFACE: {
3844
+ value: TypeKind.INTERFACE,
3845
+ description: 'Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields.'
3846
+ },
3847
+ UNION: {
3848
+ value: TypeKind.UNION,
3849
+ description: 'Indicates this type is a union. `possibleTypes` is a valid field.'
3850
+ },
3851
+ ENUM: {
3852
+ value: TypeKind.ENUM,
3853
+ description: 'Indicates this type is an enum. `enumValues` is a valid field.'
3854
+ },
3855
+ INPUT_OBJECT: {
3856
+ value: TypeKind.INPUT_OBJECT,
3857
+ description: 'Indicates this type is an input object. `inputFields` is a valid field.'
3858
+ },
3859
+ LIST: {
3860
+ value: TypeKind.LIST,
3861
+ description: 'Indicates this type is a list. `ofType` is a valid field.'
3862
+ },
3863
+ NON_NULL: {
3864
+ value: TypeKind.NON_NULL,
3865
+ description: 'Indicates this type is a non-null. `ofType` is a valid field.'
3866
+ }
3867
+ }
3868
+ });
3869
+ /**
3870
+ * Note that these are GraphQLField and not GraphQLFieldConfig,
3871
+ * so the format for args is different.
3872
+ */
3873
+
3874
+ ({
3875
+ name: '__schema',
3876
+ type: new GraphQLNonNull(__Schema),
3877
+ description: 'Access the current type schema of this server.',
3878
+ args: [],
3879
+ resolve: function resolve(_source, _args, _context, _ref7) {
3880
+ var schema = _ref7.schema;
3881
+ return schema;
3882
+ },
3883
+ isDeprecated: false,
3884
+ deprecationReason: undefined,
3885
+ extensions: undefined,
3886
+ astNode: undefined
3887
+ });
3888
+ ({
3889
+ name: '__type',
3890
+ type: __Type,
3891
+ description: 'Request the type information of a single type.',
3892
+ args: [{
3893
+ name: 'name',
3894
+ description: undefined,
3895
+ type: new GraphQLNonNull(GraphQLString),
3896
+ defaultValue: undefined,
3897
+ deprecationReason: undefined,
3898
+ extensions: undefined,
3899
+ astNode: undefined
3900
+ }],
3901
+ resolve: function resolve(_source, _ref8, _context, _ref9) {
3902
+ var name = _ref8.name;
3903
+ var schema = _ref9.schema;
3904
+ return schema.getType(name);
3905
+ },
3906
+ isDeprecated: false,
3907
+ deprecationReason: undefined,
3908
+ extensions: undefined,
3909
+ astNode: undefined
3910
+ });
3911
+ ({
3912
+ name: '__typename',
3913
+ type: new GraphQLNonNull(GraphQLString),
3914
+ description: 'The name of the current Object type at runtime.',
3915
+ args: [],
3916
+ resolve: function resolve(_source, _args, _context, _ref10) {
3917
+ var parentType = _ref10.parentType;
3918
+ return parentType.name;
3919
+ },
3920
+ isDeprecated: false,
3921
+ deprecationReason: undefined,
3922
+ extensions: undefined,
3923
+ astNode: undefined
3924
+ });
3925
+ var introspectionTypes = Object.freeze([__Schema, __Directive, __DirectiveLocation, __Type, __Field, __InputValue, __EnumValue, __TypeKind]);
3926
+
3927
+ function _defineProperties$1(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); } }
3928
+
3929
+ function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
3930
+ /**
3931
+ * Directives are used by the GraphQL runtime as a way of modifying execution
3932
+ * behavior. Type system creators will usually not create these directly.
3933
+ */
3934
+
3935
+ var GraphQLDirective = /*#__PURE__*/function () {
3936
+ function GraphQLDirective(config) {
3937
+ var _config$isRepeatable, _config$args;
3938
+
3939
+ this.name = config.name;
3940
+ this.description = config.description;
3941
+ this.locations = config.locations;
3942
+ this.isRepeatable = (_config$isRepeatable = config.isRepeatable) !== null && _config$isRepeatable !== void 0 ? _config$isRepeatable : false;
3943
+ this.extensions = config.extensions && toObjMap(config.extensions);
3944
+ this.astNode = config.astNode;
3945
+ config.name || devAssert(0, 'Directive must be named.');
3946
+ Array.isArray(config.locations) || devAssert(0, "@".concat(config.name, " locations must be an Array."));
3947
+ var args = (_config$args = config.args) !== null && _config$args !== void 0 ? _config$args : {};
3948
+ isObjectLike(args) && !Array.isArray(args) || devAssert(0, "@".concat(config.name, " args must be an object with argument names as keys."));
3949
+ this.args = objectEntries$1(args).map(function (_ref) {
3950
+ var argName = _ref[0],
3951
+ argConfig = _ref[1];
3952
+ return {
3953
+ name: argName,
3954
+ description: argConfig.description,
3955
+ type: argConfig.type,
3956
+ defaultValue: argConfig.defaultValue,
3957
+ deprecationReason: argConfig.deprecationReason,
3958
+ extensions: argConfig.extensions && toObjMap(argConfig.extensions),
3959
+ astNode: argConfig.astNode
3960
+ };
3961
+ });
3962
+ }
3963
+
3964
+ var _proto = GraphQLDirective.prototype;
3965
+
3966
+ _proto.toConfig = function toConfig() {
3967
+ return {
3968
+ name: this.name,
3969
+ description: this.description,
3970
+ locations: this.locations,
3971
+ args: argsToArgsConfig(this.args),
3972
+ isRepeatable: this.isRepeatable,
3973
+ extensions: this.extensions,
3974
+ astNode: this.astNode
3975
+ };
3976
+ };
3977
+
3978
+ _proto.toString = function toString() {
3979
+ return '@' + this.name;
3980
+ };
3981
+
3982
+ _proto.toJSON = function toJSON() {
3983
+ return this.toString();
3984
+ } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
3985
+ ;
3986
+
3987
+ _createClass$1(GraphQLDirective, [{
3988
+ key: SYMBOL_TO_STRING_TAG,
3989
+ get: function get() {
3990
+ return 'GraphQLDirective';
3991
+ }
3992
+ }]);
3993
+
3994
+ return GraphQLDirective;
3995
+ }(); // Print a simplified form when appearing in `inspect` and `util.inspect`.
3996
+
3997
+ defineInspect(GraphQLDirective);
3998
+
3999
+ /**
4000
+ * Used to conditionally include fields or fragments.
4001
+ */
4002
+ new GraphQLDirective({
4003
+ name: 'include',
4004
+ description: 'Directs the executor to include this field or fragment only when the `if` argument is true.',
4005
+ locations: [DirectiveLocation.FIELD, DirectiveLocation.FRAGMENT_SPREAD, DirectiveLocation.INLINE_FRAGMENT],
4006
+ args: {
4007
+ if: {
4008
+ type: new GraphQLNonNull(GraphQLBoolean),
4009
+ description: 'Included when true.'
4010
+ }
4011
+ }
4012
+ });
4013
+ /**
4014
+ * Used to conditionally skip (exclude) fields or fragments.
4015
+ */
4016
+
4017
+ new GraphQLDirective({
4018
+ name: 'skip',
4019
+ description: 'Directs the executor to skip this field or fragment when the `if` argument is true.',
4020
+ locations: [DirectiveLocation.FIELD, DirectiveLocation.FRAGMENT_SPREAD, DirectiveLocation.INLINE_FRAGMENT],
4021
+ args: {
4022
+ if: {
4023
+ type: new GraphQLNonNull(GraphQLBoolean),
4024
+ description: 'Skipped when true.'
4025
+ }
4026
+ }
4027
+ });
4028
+ /**
4029
+ * Constant string used for default reason for a deprecation.
4030
+ */
4031
+
4032
+ var DEFAULT_DEPRECATION_REASON = 'No longer supported';
4033
+ /**
4034
+ * Used to declare element of a GraphQL schema as deprecated.
4035
+ */
4036
+
4037
+ new GraphQLDirective({
4038
+ name: 'deprecated',
4039
+ description: 'Marks an element of a GraphQL schema as no longer supported.',
4040
+ locations: [DirectiveLocation.FIELD_DEFINITION, DirectiveLocation.ARGUMENT_DEFINITION, DirectiveLocation.INPUT_FIELD_DEFINITION, DirectiveLocation.ENUM_VALUE],
4041
+ args: {
4042
+ reason: {
4043
+ type: GraphQLString,
4044
+ description: 'Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).',
4045
+ defaultValue: DEFAULT_DEPRECATION_REASON
4046
+ }
4047
+ }
4048
+ });
4049
+ /**
4050
+ * Used to provide a URL for specifying the behaviour of custom scalar definitions.
4051
+ */
4052
+
4053
+ new GraphQLDirective({
4054
+ name: 'specifiedBy',
4055
+ description: 'Exposes a URL that specifies the behaviour of this scalar.',
4056
+ locations: [DirectiveLocation.SCALAR],
4057
+ args: {
4058
+ url: {
4059
+ type: new GraphQLNonNull(GraphQLString),
4060
+ description: 'The URL that specifies the behaviour of this scalar.'
4061
+ }
4062
+ }
4063
+ });
4064
+ [].concat(specifiedScalarTypes, introspectionTypes).map(function (type) {
4065
+ return type.name;
4066
+ });
4067
+
4068
+ var _defKindToExtKind;
4069
+
4070
+ function _defineProperty$1(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; }
4071
+ (_defKindToExtKind = {}, _defineProperty$1(_defKindToExtKind, Kind.SCALAR_TYPE_DEFINITION, Kind.SCALAR_TYPE_EXTENSION), _defineProperty$1(_defKindToExtKind, Kind.OBJECT_TYPE_DEFINITION, Kind.OBJECT_TYPE_EXTENSION), _defineProperty$1(_defKindToExtKind, Kind.INTERFACE_TYPE_DEFINITION, Kind.INTERFACE_TYPE_EXTENSION), _defineProperty$1(_defKindToExtKind, Kind.UNION_TYPE_DEFINITION, Kind.UNION_TYPE_EXTENSION), _defineProperty$1(_defKindToExtKind, Kind.ENUM_TYPE_DEFINITION, Kind.ENUM_TYPE_EXTENSION), _defineProperty$1(_defKindToExtKind, Kind.INPUT_OBJECT_TYPE_DEFINITION, Kind.INPUT_OBJECT_TYPE_EXTENSION), _defKindToExtKind);
4072
+ keyMap(specifiedScalarTypes.concat(introspectionTypes), function (type) {
4073
+ return type.name;
4074
+ });
4075
+
4076
+ /**
4077
+ * Copyright (c) 2022, Salesforce, Inc.,
4078
+ * All rights reserved.
4079
+ * For full license text, see the LICENSE.txt file
4080
+ */
4081
+
4082
+
4083
+ /**
4084
+ * Defines configuration for the module with a default value which can be overridden by the runtime environment.
4085
+ */
4086
+ /**
4087
+ * Environment Aware GraphQLBatch adapter
4088
+ */
4089
+ let environmentAwareGraphQLBatchAdapter = undefined;
4090
+ /**
4091
+ * Draft-aware GraphQL adapter
4092
+ */
4093
+ let draftAwareGraphQLAdapter = undefined;
4094
+ /**
4095
+ * Draft-aware createRecord adapter
4096
+ */
4097
+ let draftAwareCreateRecordAdapter = undefined;
4098
+ /**
4099
+ * Draft-aware updateRecord adapter
4100
+ */
4101
+ let draftAwareUpdateRecordAdapter = undefined;
4102
+ /**
4103
+ * Draft-aware deleteRecord adapter
4104
+ */
4105
+ let draftAwareDeleteRecordAdapter = undefined;
4106
+ /**
4107
+ * Draft-aware createContentDocumentAndVersion adapter
4108
+ */
4109
+ let draftAwareCreateContentDocumentAndVersionAdapter = undefined;
4110
+ /**
4111
+ * Draft-aware createContentVersion adapter
4112
+ */
4113
+ let draftAwareCreateContentVersionAdapter = undefined;
4114
+ /**
4115
+ * Depth to which tracked fields will be added to a request that results from a cache miss.
4116
+ * A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
4117
+ * be reached by following 1 relationship from the root record, etc.
4118
+ * @defaultValue '5', replicates the current behavior
4119
+ */
4120
+ let trackedFieldDepthOnCacheMiss = 5;
4121
+ /**
4122
+ * Depth to which tracked fields will be added to a request that results from a merge conflict
4123
+ * A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
4124
+ * be reached by following 1 relationship from the root record, etc.
4125
+ * @defaultValue '5', replicates the current behavior
4126
+ */
4127
+ let trackedFieldDepthOnCacheMergeConflict = 5;
4128
+ /**
4129
+ * Depth to which tracked fields will be added to a request that results from a notify change invocation by the consumer
4130
+ * A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
4131
+ * be reached by following 1 relationship from the root record, etc.
4132
+ * @defaultValue '5', replicates the current behavior
4133
+ */
4134
+ let trackedFieldDepthOnNotifyChange = 5;
4135
+ /**
4136
+ * Determines if we will only fetch the 'Id' field for the leaf relationship record
4137
+ * @defaultValue 'false', replicates the current behavior and fetches all fields in the store for the leaf relationship record
4138
+ */
4139
+ let trackedFieldLeafNodeIdAndNameOnly = false;
4140
+ /**
4141
+ * One store enabled Get Object Info adapter
4142
+ */
4143
+ let oneStoreGetObjectInfoAdapter = undefined;
4144
+ /**
4145
+ * One store enabled Get Object Infos adapter
4146
+ */
4147
+ let oneStoreGetObjectInfosAdapter = undefined;
4148
+ /**
4149
+ * Determines when to include PDL strategies for Related Lists
4150
+ */
4151
+ let relatedListsPredictionsEnabled = false;
4152
+ /**
4153
+ * Defines the configuration API and is exposed internally as well as externally.
4154
+ * Configuration for one store enabled REST adapters only.
4155
+ */
4156
+ const configurationForOneStoreEnabledAdapters = {
4157
+ setGetObjectInfoAdapter: function (adapter) {
4158
+ oneStoreGetObjectInfoAdapter = adapter;
4159
+ },
4160
+ getGetObjectInfoAdapter: function () {
4161
+ return oneStoreGetObjectInfoAdapter;
4162
+ },
4163
+ setGetObjectInfosAdapter: function (adapter) {
4164
+ oneStoreGetObjectInfosAdapter = adapter;
4165
+ },
4166
+ getGetObjectInfosAdapter: function () {
4167
+ return oneStoreGetObjectInfosAdapter;
4168
+ },
4169
+ };
4170
+ /**
4171
+ * Defines the configuration API and is exposed internally as well as externally.
4172
+ * Configuration for REST adapters only.
4173
+ */
4174
+ const configurationForRestAdapters = {
4175
+ setTrackedFieldDepthOnCacheMiss: function (trackedFieldDepthOnCacheMissParam) {
4176
+ trackedFieldDepthOnCacheMiss = trackedFieldDepthOnCacheMissParam;
4177
+ },
4178
+ getTrackedFieldDepthOnCacheMiss: function () {
4179
+ return trackedFieldDepthOnCacheMiss;
4180
+ },
4181
+ setTrackedFieldDepthOnCacheMergeConflict: function (trackedFieldDepthOnCacheMergeConflictParam) {
4182
+ trackedFieldDepthOnCacheMergeConflict = trackedFieldDepthOnCacheMergeConflictParam;
4183
+ },
4184
+ getTrackedFieldDepthOnCacheMergeConflict: function () {
4185
+ return trackedFieldDepthOnCacheMergeConflict;
4186
+ },
4187
+ setTrackedFieldDepthOnNotifyChange: function (trackedFieldDepthOnNotifyChangeParam) {
4188
+ trackedFieldDepthOnNotifyChange = trackedFieldDepthOnNotifyChangeParam;
4189
+ },
4190
+ getTrackedFieldDepthOnNotifyChange: function () {
4191
+ return trackedFieldDepthOnNotifyChange;
4192
+ },
4193
+ setTrackedFieldLeafNodeIdAndNameOnly: function (trackedFieldLeafNodeIdAndNameOnlyParam) {
4194
+ trackedFieldLeafNodeIdAndNameOnly = trackedFieldLeafNodeIdAndNameOnlyParam;
4195
+ },
4196
+ getTrackedFieldLeafNodeIdAndNameOnly: function () {
4197
+ return trackedFieldLeafNodeIdAndNameOnly;
4198
+ },
4199
+ // createRecord
4200
+ setDraftAwareCreateRecordAdapter: function (adapter) {
4201
+ draftAwareCreateRecordAdapter = adapter;
4202
+ },
4203
+ getDraftAwareCreateRecordAdapter: function () {
4204
+ return draftAwareCreateRecordAdapter;
4205
+ },
4206
+ // updateRecord
4207
+ setDraftAwareUpdateRecordAdapter: function (adapter) {
4208
+ draftAwareUpdateRecordAdapter = adapter;
4209
+ },
4210
+ getDraftAwareUpdateRecordAdapter: function () {
4211
+ return draftAwareUpdateRecordAdapter;
4212
+ },
4213
+ // deleteRecord
4214
+ setDraftAwareDeleteRecordAdapter: function (adapter) {
4215
+ draftAwareDeleteRecordAdapter = adapter;
4216
+ },
4217
+ getDraftAwareDeleteRecordAdapter: function () {
4218
+ return draftAwareDeleteRecordAdapter;
4219
+ },
4220
+ // createContentDocumentAndVersion
4221
+ setDraftAwareCreateContentDocumentAndVersionAdapter: function (adapter) {
4222
+ draftAwareCreateContentDocumentAndVersionAdapter = adapter;
4223
+ },
4224
+ getDraftAwareCreateContentDocumentAndVersionAdapter: function () {
4225
+ return draftAwareCreateContentDocumentAndVersionAdapter;
4226
+ },
4227
+ setRelatedListsPredictionsEnabled: function (f) {
4228
+ relatedListsPredictionsEnabled = f;
4229
+ },
4230
+ areRelatedListsPredictionsEnabled: function () {
4231
+ return relatedListsPredictionsEnabled === true;
4232
+ },
4233
+ // createContentVersion
4234
+ setDraftAwareCreateContentVersionAdapter: function (adapter) {
4235
+ draftAwareCreateContentVersionAdapter = adapter;
4236
+ },
4237
+ getDraftAwareCreateContentVersionAdapter: function () {
4238
+ return draftAwareCreateContentVersionAdapter;
4239
+ },
4240
+ ...configurationForOneStoreEnabledAdapters,
4241
+ };
4242
+ /**
4243
+ * Defines the configuration API and is exposed internally as well as externally.
4244
+ * Configuration for GraphQL adapters only.
4245
+ */
4246
+ const configurationForGraphQLAdapters = {
4247
+ setDraftAwareGraphQLAdapter: function (adapter) {
4248
+ draftAwareGraphQLAdapter = adapter;
4249
+ },
4250
+ getDraftAwareGraphQLAdapter: function () {
4251
+ return draftAwareGraphQLAdapter;
4252
+ },
4253
+ setEnvironmentAwareGraphQLBatchAdapter: function (adapter) {
4254
+ environmentAwareGraphQLBatchAdapter = adapter;
4255
+ },
4256
+ getEnvironmentAwareGraphQLBatchAdapter: function () {
4257
+ return environmentAwareGraphQLBatchAdapter;
4258
+ },
4259
+ };
4260
+ const registrations = new Set();
4261
+ /**
4262
+ * lds-adapter-uiapi is special. The non-SFDC bundle combines REST and GQL adapters,
4263
+ * yet for SFDC those are separate bundles. So non-SFDC bundle (./main.ts) registers
4264
+ * both REST and GQL configs. We want each SFDC bundle to register (we don't want one
4265
+ * SFDC bundle to assume the other is being loaded and therefore the other one will
4266
+ * take care of registration) but we don't want to double register either.
4267
+ *
4268
+ * So we make this function that memoizes if it's been called before and only
4269
+ * actually registers once.
4270
+ */
4271
+ function ensureRegisteredOnce(registration) {
4272
+ const { id } = registration;
4273
+ if (!registrations.has(id)) {
4274
+ register(registration);
4275
+ registrations.add(id);
4276
+ }
4277
+ }
4278
+
27
4279
  // For use by callers within this module to instrument interesting things.
28
4280
  let instrumentation = {
29
- timerMetricAddDuration: (_metricName, _valueInMs) => { },
4281
+ /**
4282
+ * Called when a set of record conflicts has been fully resolved. The
4283
+ * parameter indicates the number of server requests that were needed
4284
+ * to fully resolve all the record conflicts.
4285
+ */
4286
+ recordConflictsResolved: (_serverRequestCount) => { },
4287
+ /**
4288
+ * Called during merging of incoming and existing FieldValues.
4289
+ * Called when the incoming FieldValue display value is null.
4290
+ *
4291
+ * Note: Temporary instrumentation to capture distribution and frequency, W-8990630
4292
+ * Flipped to counter metric due to W-9611107
4293
+ */
4294
+ nullDisplayValueConflict: (_fieldInfo) => { },
4295
+ /**
4296
+ * SFDC Throttling
4297
+ * getRecordNotifyChange and notifyRecordUpdateAvailable are both throttled
4298
+ */
4299
+ getRecordNotifyChangeAllowed: () => { },
4300
+ getRecordNotifyChangeDropped: () => { },
4301
+ notifyRecordUpdateAvailableAllowed: () => { },
4302
+ notifyRecordUpdateAvailableDropped: () => { },
4303
+ /**
4304
+ * RecordRepresentation merge
4305
+ * Called when records change apiName
4306
+ */
4307
+ recordApiNameChanged: (_existingApiName, _incomingApiName) => { },
4308
+ recordTypeIdIsNull: (_apiName) => { },
4309
+ /**
4310
+ * RecordRepresentation merge
4311
+ * Called when either incoming or existing RecordRepresentation has a weakEtag=0
4312
+ */
4313
+ weakEtagZero: (_incomingWeakEtagZero, _existingWeakEtagZero, _apiName) => { },
4314
+ /**
4315
+ * getRecord notifyChangeFactory
4316
+ * Called when dispatchResourceRequest is resolved/rejected
4317
+ */
4318
+ getRecordNotifyChangeNetworkResult: (_uniqueWeakEtags, _error) => { },
30
4319
  };
31
4320
  /**
32
4321
  * Allows external modules (typically a runtime environment) to set
@@ -39,6 +4328,479 @@ let instrumentation = {
39
4328
  function instrument(newInstrumentation) {
40
4329
  instrumentation = Object.assign(instrumentation, newInstrumentation);
41
4330
  }
4331
+ const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
4332
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
4333
+ return {
4334
+ name,
4335
+ required,
4336
+ resourceType,
4337
+ typeCheckShape,
4338
+ isArrayShape,
4339
+ coerceFn,
4340
+ };
4341
+ }
4342
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
4343
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
4344
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
4345
+ return {
4346
+ displayName,
4347
+ parameters: {
4348
+ required,
4349
+ optional,
4350
+ }
4351
+ };
4352
+ }
4353
+
4354
+ const { assign, create, freeze, isFrozen, keys } = Object;
4355
+ const { isArray } = Array;
4356
+ const { concat, filter, includes, push, reduce } = Array.prototype;
4357
+
4358
+ function isString(value) {
4359
+ return typeof value === 'string';
4360
+ }
4361
+ /**
4362
+ * @param value The array to dedupe
4363
+ * @returns An array without duplicates.
4364
+ */
4365
+ function dedupe(value) {
4366
+ const result = {};
4367
+ for (let i = 0, len = value.length; i < len; i += 1) {
4368
+ result[value[i]] = true;
4369
+ }
4370
+ return keys(result);
4371
+ }
4372
+
4373
+ function isObjectId(unknown) {
4374
+ if (typeof unknown !== 'object' || unknown === null) {
4375
+ return false;
4376
+ }
4377
+ return isString(unknown.objectApiName);
4378
+ }
4379
+
4380
+ /**
4381
+ * Returns the object API name.
4382
+ * @param value The value from which to get the object API name.
4383
+ * @returns The object API name.
4384
+ */
4385
+ function getObjectApiName$1(value) {
4386
+ // Note: tightening validation logic changes behavior from userland getting
4387
+ // a server-provided error to the adapter noop'ing. In 224 we decided to not
4388
+ // change the behavior.
4389
+ if (typeof value === 'string') {
4390
+ const trimmed = value.trim();
4391
+ if (trimmed.length > 0) {
4392
+ return trimmed;
4393
+ }
4394
+ }
4395
+ else if (isObjectId(value)) {
4396
+ return value.objectApiName.trim();
4397
+ }
4398
+ return undefined;
4399
+ }
4400
+
4401
+ function isFieldId(unknown) {
4402
+ if (typeof unknown !== 'object' || unknown === null) {
4403
+ return false;
4404
+ }
4405
+ const value = unknown;
4406
+ return isString(value.objectApiName) && isString(value.fieldApiName);
4407
+ }
4408
+
4409
+ /**
4410
+ * Returns the field API name, qualified with an object name if possible.
4411
+ * @param value The value from which to get the qualified field API name.
4412
+ * @param onlyQualifiedFieldNames - Whether or not this function should skip fieldApiName that do not include the delimiter '.'
4413
+ * @return The qualified field API name.
4414
+ */
4415
+ function getFieldApiName(value, onlyQualifiedFieldNames = false) {
4416
+ // Note: tightening validation logic changes behavior from userland getting
4417
+ // a server-provided error to the adapter noop'ing. In 224 we decided to not
4418
+ // change the behavior. In 250 we decided to add the 'onlyQualifiedFieldName' flag to tighten the logic
4419
+ // optionally to avoid issues with persisted invalid field names.
4420
+ if (isString(value)) {
4421
+ const trimmed = value.trim();
4422
+ if (trimmed.length > 0 && (onlyQualifiedFieldNames ? trimmed.indexOf('.') > -1 : true)) {
4423
+ return trimmed;
4424
+ }
4425
+ }
4426
+ else if (isFieldId(value)) {
4427
+ return value.objectApiName + '.' + value.fieldApiName;
4428
+ }
4429
+ return undefined;
4430
+ }
4431
+
4432
+ /**
4433
+ * Returns the field API name.
4434
+ * @param value The value from which to get the field API name.
4435
+ * @param options Option bag. onlyQualifiedFieldNames is a boolean that allows this function to skip returning invalid FieldApiNames.
4436
+ * @returns The field API name.
4437
+ */
4438
+ function getFieldApiNamesArray(value, options = { onlyQualifiedFieldNames: false }) {
4439
+ const valueArray = isArray(value) ? value : [value];
4440
+ const array = [];
4441
+ for (let i = 0, len = valueArray.length; i < len; i += 1) {
4442
+ const item = valueArray[i];
4443
+ const apiName = getFieldApiName(item, options.onlyQualifiedFieldNames);
4444
+ if (apiName === undefined) {
4445
+ if (options.onlyQualifiedFieldNames) {
4446
+ continue; // Just skips invalid field names rather than failing to return an array at all
4447
+ }
4448
+ return undefined;
4449
+ }
4450
+ push.call(array, apiName);
4451
+ }
4452
+ if (array.length === 0) {
4453
+ return undefined;
4454
+ }
4455
+ return dedupe(array).sort();
4456
+ }
4457
+ freeze({
4458
+ name: '',
4459
+ children: {},
4460
+ });
4461
+
4462
+ ObjectCreate$1(null);
4463
+
4464
+ ObjectCreate$1(null);
4465
+
4466
+ const adapterName$$ = 'getListUiByApiName';
4467
+ const getListUiByApiName_ConfigPropertyMetadata = [
4468
+ generateParamConfigMetadata('listViewApiName', true, 0 /* UrlParameter */, 0 /* String */),
4469
+ generateParamConfigMetadata('objectApiName', true, 0 /* UrlParameter */, 0 /* String */, false, getObjectApiName$1),
4470
+ generateParamConfigMetadata('fields', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
4471
+ generateParamConfigMetadata('optionalFields', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
4472
+ generateParamConfigMetadata('pageSize', false, 1 /* QueryParameter */, 3 /* Integer */),
4473
+ generateParamConfigMetadata('pageToken', false, 1 /* QueryParameter */, 0 /* String */),
4474
+ generateParamConfigMetadata('sortBy', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
4475
+ ];
4476
+ const getListUiByApiName_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$$, getListUiByApiName_ConfigPropertyMetadata);
4477
+
4478
+ const adapterName$_ = 'getListUiByListViewId';
4479
+ const getListUiByListViewId_ConfigPropertyMetadata = [
4480
+ generateParamConfigMetadata('listViewId', true, 0 /* UrlParameter */, 0 /* String */),
4481
+ generateParamConfigMetadata('fields', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
4482
+ generateParamConfigMetadata('optionalFields', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
4483
+ generateParamConfigMetadata('pageSize', false, 1 /* QueryParameter */, 3 /* Integer */),
4484
+ generateParamConfigMetadata('pageToken', false, 1 /* QueryParameter */, 0 /* String */),
4485
+ generateParamConfigMetadata('sortBy', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
4486
+ ];
4487
+ const getListUiByListViewId_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$_, getListUiByListViewId_ConfigPropertyMetadata);
4488
+
4489
+ const adapterName$Y = 'getMruListUi';
4490
+ const getMruListUi_ConfigPropertyMetadata = [
4491
+ generateParamConfigMetadata('objectApiName', true, 0 /* UrlParameter */, 0 /* String */, false, getObjectApiName$1),
4492
+ generateParamConfigMetadata('fields', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
4493
+ generateParamConfigMetadata('optionalFields', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
4494
+ generateParamConfigMetadata('pageSize', false, 1 /* QueryParameter */, 3 /* Integer */),
4495
+ generateParamConfigMetadata('pageToken', false, 1 /* QueryParameter */, 0 /* String */),
4496
+ generateParamConfigMetadata('sortBy', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
4497
+ ];
4498
+ const getMruListUi_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$Y, getMruListUi_ConfigPropertyMetadata);
4499
+ // make local copies of the adapter configs so we can ignore other getListUi config parameters to match
4500
+ // lds222 behavior
4501
+ ({
4502
+ ...getMruListUi_ConfigPropertyNames,
4503
+ parameters: {
4504
+ ...getMruListUi_ConfigPropertyNames.parameters,
4505
+ optional: [
4506
+ ...getMruListUi_ConfigPropertyNames.parameters.optional,
4507
+ 'listViewApiName',
4508
+ 'listViewId',
4509
+ ],
4510
+ },
4511
+ });
4512
+ // make local copies of the adapter configs so we can have them ignore each other's config parameters
4513
+ // to match lds222 behavior
4514
+ ({
4515
+ ...getListUiByApiName_ConfigPropertyNames,
4516
+ parameters: {
4517
+ ...getListUiByApiName_ConfigPropertyNames.parameters,
4518
+ optional: [...getListUiByApiName_ConfigPropertyNames.parameters.optional, 'listViewId'],
4519
+ },
4520
+ });
4521
+ ({
4522
+ ...getListUiByListViewId_ConfigPropertyNames,
4523
+ parameters: {
4524
+ ...getListUiByListViewId_ConfigPropertyNames.parameters,
4525
+ optional: [
4526
+ ...getListUiByListViewId_ConfigPropertyNames.parameters.optional,
4527
+ 'listViewApiName',
4528
+ 'objectApiName',
4529
+ ],
4530
+ },
4531
+ });
4532
+
4533
+ var DiscriminatorValues$5;
4534
+ (function (DiscriminatorValues) {
4535
+ DiscriminatorValues["EmptySpace"] = "EmptySpace";
4536
+ DiscriminatorValues["ReportChart"] = "ReportChart";
4537
+ DiscriminatorValues["VisualforcePage"] = "VisualforcePage";
4538
+ DiscriminatorValues["Canvas"] = "Canvas";
4539
+ DiscriminatorValues["Field"] = "Field";
4540
+ DiscriminatorValues["CustomLink"] = "CustomLink";
4541
+ })(DiscriminatorValues$5 || (DiscriminatorValues$5 = {}));
4542
+
4543
+ var LayoutMode;
4544
+ (function (LayoutMode) {
4545
+ LayoutMode["View"] = "View";
4546
+ LayoutMode["Edit"] = "Edit";
4547
+ LayoutMode["Create"] = "Create";
4548
+ })(LayoutMode || (LayoutMode = {}));
4549
+
4550
+ LayoutMode.View;
4551
+
4552
+ var FormFactor;
4553
+ (function (FormFactor) {
4554
+ FormFactor["Large"] = "Large";
4555
+ FormFactor["Medium"] = "Medium";
4556
+ FormFactor["Small"] = "Small";
4557
+ })(FormFactor || (FormFactor = {}));
4558
+
4559
+ ObjectCreate$1(null);
4560
+
4561
+ var LayoutType;
4562
+ (function (LayoutType) {
4563
+ LayoutType["Full"] = "Full";
4564
+ LayoutType["Compact"] = "Compact";
4565
+ })(LayoutType || (LayoutType = {}));
4566
+
4567
+ ObjectCreate$1(null);
4568
+
4569
+ ObjectCreate$1(null);
4570
+
4571
+ const VERSION$1O = "8d2032474fb4fabdf5cf4042be9042d9";
4572
+ const select$20 = function WorkStepPicklistValueAttributeRepresentationSelect() {
4573
+ const { selections: AbstractPicklistValueAttributesRepresentationSelections } = select$1Y();
4574
+ return {
4575
+ kind: 'Fragment',
4576
+ version: VERSION$1O,
4577
+ private: [],
4578
+ selections: [
4579
+ ...AbstractPicklistValueAttributesRepresentationSelections,
4580
+ {
4581
+ name: 'sortOrder',
4582
+ kind: 'Scalar'
4583
+ },
4584
+ {
4585
+ name: 'statusCode',
4586
+ kind: 'Scalar'
4587
+ }
4588
+ ]
4589
+ };
4590
+ };
4591
+
4592
+ const VERSION$1N = "53893a219bc0888951863f2c44317cac";
4593
+ const select$1$ = function LeadStatusPicklistValueAttributesRepresentationSelect() {
4594
+ const { selections: AbstractPicklistValueAttributesRepresentationSelections } = select$1Y();
4595
+ return {
4596
+ kind: 'Fragment',
4597
+ version: VERSION$1N,
4598
+ private: [],
4599
+ selections: [
4600
+ ...AbstractPicklistValueAttributesRepresentationSelections,
4601
+ {
4602
+ name: 'converted',
4603
+ kind: 'Scalar'
4604
+ }
4605
+ ]
4606
+ };
4607
+ };
4608
+
4609
+ const VERSION$1M = "4818ec07c499784571c1012ead048c88";
4610
+ const select$1_ = function CaseStatusPicklistValueAttributesRepresentationSelect() {
4611
+ const { selections: AbstractPicklistValueAttributesRepresentationSelections } = select$1Y();
4612
+ return {
4613
+ kind: 'Fragment',
4614
+ version: VERSION$1M,
4615
+ private: [],
4616
+ selections: [
4617
+ ...AbstractPicklistValueAttributesRepresentationSelections,
4618
+ {
4619
+ name: 'closed',
4620
+ kind: 'Scalar'
4621
+ }
4622
+ ]
4623
+ };
4624
+ };
4625
+
4626
+ const VERSION$1L = "950a3a962acbd2b128f937d4c055a9d6";
4627
+ const select$1Z = function OpportunityStagePicklistValueAttributesRepresentationSelect() {
4628
+ const { selections: AbstractPicklistValueAttributesRepresentationSelections } = select$1Y();
4629
+ return {
4630
+ kind: 'Fragment',
4631
+ version: VERSION$1L,
4632
+ private: [],
4633
+ selections: [
4634
+ ...AbstractPicklistValueAttributesRepresentationSelections,
4635
+ {
4636
+ name: 'closed',
4637
+ kind: 'Scalar'
4638
+ },
4639
+ {
4640
+ name: 'defaultProbability',
4641
+ kind: 'Scalar'
4642
+ },
4643
+ {
4644
+ name: 'forecastCategoryName',
4645
+ kind: 'Scalar'
4646
+ },
4647
+ {
4648
+ name: 'won',
4649
+ kind: 'Scalar'
4650
+ }
4651
+ ]
4652
+ };
4653
+ };
4654
+
4655
+ var DiscriminatorValues$4;
4656
+ (function (DiscriminatorValues) {
4657
+ DiscriminatorValues["WorkStepStatus"] = "WorkStepStatus";
4658
+ DiscriminatorValues["LeadStatus"] = "LeadStatus";
4659
+ DiscriminatorValues["CaseStatus"] = "CaseStatus";
4660
+ DiscriminatorValues["OpportunityStage"] = "OpportunityStage";
4661
+ })(DiscriminatorValues$4 || (DiscriminatorValues$4 = {}));
4662
+ const VERSION$1K = "bd523b2343366edfc25a2dbee2c4e986";
4663
+ const selectChildren$2 = function AbstractPicklistValueAttributesRepresentationSelectChildren() {
4664
+ const workStepPicklistValueAttributeRepresentationSelections = select$20();
4665
+ const leadStatusPicklistValueAttributesRepresentationSelections = select$1$();
4666
+ const caseStatusPicklistValueAttributesRepresentationSelections = select$1_();
4667
+ const opportunityStagePicklistValueAttributesRepresentationSelections = select$1Z();
4668
+ return {
4669
+ kind: 'Fragment',
4670
+ union: true,
4671
+ discriminator: 'picklistAtrributesValueType',
4672
+ unionSelections: {
4673
+ [DiscriminatorValues$4.WorkStepStatus]: workStepPicklistValueAttributeRepresentationSelections,
4674
+ [DiscriminatorValues$4.LeadStatus]: leadStatusPicklistValueAttributesRepresentationSelections,
4675
+ [DiscriminatorValues$4.CaseStatus]: caseStatusPicklistValueAttributesRepresentationSelections,
4676
+ [DiscriminatorValues$4.OpportunityStage]: opportunityStagePicklistValueAttributesRepresentationSelections
4677
+ }
4678
+ };
4679
+ };
4680
+ const select$1Y = function AbstractPicklistValueAttributesRepresentationSelect() {
4681
+ return {
4682
+ kind: 'Fragment',
4683
+ version: VERSION$1K,
4684
+ private: [],
4685
+ selections: [
4686
+ {
4687
+ name: 'picklistAtrributesValueType',
4688
+ kind: 'Scalar'
4689
+ }
4690
+ ]
4691
+ };
4692
+ };
4693
+
4694
+ const VERSION$1J = "9e2a16a80378487f557124c771201cf9";
4695
+ const select$1X = function PicklistValueRepresentationSelect() {
4696
+ const AbstractPicklistValueAttributesRepresentation__unionSelections = selectChildren$2();
4697
+ return {
4698
+ kind: 'Fragment',
4699
+ version: VERSION$1J,
4700
+ private: [],
4701
+ selections: [
4702
+ {
4703
+ kind: 'Object',
4704
+ name: 'attributes',
4705
+ discriminator: AbstractPicklistValueAttributesRepresentation__unionSelections.discriminator,
4706
+ union: true,
4707
+ nullable: true,
4708
+ unionSelections: AbstractPicklistValueAttributesRepresentation__unionSelections.unionSelections
4709
+ },
4710
+ {
4711
+ name: 'label',
4712
+ kind: 'Scalar'
4713
+ },
4714
+ {
4715
+ name: 'validFor',
4716
+ kind: 'Scalar',
4717
+ plural: true
4718
+ },
4719
+ {
4720
+ name: 'value',
4721
+ kind: 'Scalar'
4722
+ }
4723
+ ]
4724
+ };
4725
+ };
4726
+ const VERSION$1I = "0a361a49370acb4c6a31721a2057649a";
4727
+ const select$1W = function PicklistValuesRepresentationSelect() {
4728
+ const { selections: PicklistValueRepresentation__selections, opaque: PicklistValueRepresentation__opaque, } = select$1X();
4729
+ return {
4730
+ kind: 'Fragment',
4731
+ version: VERSION$1I,
4732
+ private: [
4733
+ 'eTag'
4734
+ ],
4735
+ selections: [
4736
+ {
4737
+ name: 'controllerValues',
4738
+ kind: 'Scalar',
4739
+ map: true
4740
+ },
4741
+ {
4742
+ name: 'defaultValue',
4743
+ kind: 'Object',
4744
+ nullable: true,
4745
+ selections: PicklistValueRepresentation__selections
4746
+ },
4747
+ {
4748
+ name: 'url',
4749
+ kind: 'Scalar'
4750
+ },
4751
+ {
4752
+ name: 'values',
4753
+ kind: 'Object',
4754
+ plural: true,
4755
+ selections: PicklistValueRepresentation__selections
4756
+ }
4757
+ ]
4758
+ };
4759
+ };
4760
+
4761
+ select$1W().selections;
4762
+
4763
+ var DiscriminatorValues$3;
4764
+ (function (DiscriminatorValues) {
4765
+ DiscriminatorValues["Photo"] = "Photo";
4766
+ DiscriminatorValues["Theme"] = "Theme";
4767
+ })(DiscriminatorValues$3 || (DiscriminatorValues$3 = {}));
4768
+
4769
+ ObjectCreate$1(null);
4770
+
4771
+ ObjectCreate$1(null);
4772
+
4773
+ ObjectCreate$1(null);
4774
+
4775
+ ObjectCreate$1(null);
4776
+
4777
+ var DiscriminatorValues$1;
4778
+ (function (DiscriminatorValues) {
4779
+ DiscriminatorValues["Text"] = "Text";
4780
+ DiscriminatorValues["Select"] = "Select";
4781
+ })(DiscriminatorValues$1 || (DiscriminatorValues$1 = {}));
4782
+
4783
+ var DiscriminatorValues;
4784
+ (function (DiscriminatorValues) {
4785
+ DiscriminatorValues["Field"] = "Field";
4786
+ DiscriminatorValues["DataCategory"] = "DataCategory";
4787
+ })(DiscriminatorValues || (DiscriminatorValues = {}));
4788
+
4789
+ const API_NAMESPACE = 'UiApi';
4790
+ const RECORD_REPRESENTATION_NAME = 'RecordRepresentation';
4791
+ const RECORD_ID_PREFIX = `${API_NAMESPACE}::${RECORD_REPRESENTATION_NAME}:`;
4792
+ const RECORD_FIELDS_KEY_JUNCTION = '__fields__';
4793
+ // The rest of this is copy-pasted. Sorry.
4794
+ ObjectCreate$1(null);
4795
+ ensureRegisteredOnce({
4796
+ id: '@salesforce/lds-adapters-uiapi-mobile',
4797
+ configuration: {
4798
+ ...configurationForRestAdapters,
4799
+ ...configurationForGraphQLAdapters,
4800
+ ...configurationForOneStoreEnabledAdapters,
4801
+ },
4802
+ instrument,
4803
+ });
42
4804
 
43
4805
  /**
44
4806
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -175,7 +4937,7 @@ function fixRecordTypes(luvio, record) {
175
4937
  }
176
4938
  }
177
4939
  // recurse on nested records
178
- const fieldKeys = keys(record.fields);
4940
+ const fieldKeys = keys$1(record.fields);
179
4941
  const fieldKeysLen = fieldKeys.length;
180
4942
  for (let i = 0; i < fieldKeysLen; ++i) {
181
4943
  const fieldValue = record.fields[fieldKeys[i]].value;
@@ -246,7 +5008,7 @@ class AdsBridge {
246
5008
  if (didIngestRecord === true) {
247
5009
  luvio.storeBroadcast();
248
5010
  }
249
- instrumentation.timerMetricAddDuration(ADS_BRIDGE_ADD_RECORDS_DURATION, Date.now() - startTime);
5011
+ instrumentation$1.timerMetricAddDuration(ADS_BRIDGE_ADD_RECORDS_DURATION, Date.now() - startTime);
250
5012
  });
251
5013
  }
252
5014
  /**
@@ -259,7 +5021,7 @@ class AdsBridge {
259
5021
  return this.lockLdsRecordEmit(() => {
260
5022
  luvio.storeEvict(key);
261
5023
  luvio.storeBroadcast();
262
- instrumentation.timerMetricAddDuration(ADS_BRIDGE_EVICT_DURATION, Date.now() - startTime);
5024
+ instrumentation$1.timerMetricAddDuration(ADS_BRIDGE_EVICT_DURATION, Date.now() - startTime);
263
5025
  return Promise.resolve();
264
5026
  });
265
5027
  }
@@ -281,7 +5043,7 @@ class AdsBridge {
281
5043
  // Prefix all the fields with the record API name.
282
5044
  const qualifiedFieldNames = [];
283
5045
  for (let i = 0, len = fieldNames.length; i < len; i++) {
284
- push.call(qualifiedFieldNames, `${apiName}.${fieldNames[i]}`);
5046
+ push$1.call(qualifiedFieldNames, `${apiName}.${fieldNames[i]}`);
285
5047
  }
286
5048
  return Promise.resolve(qualifiedFieldNames);
287
5049
  }
@@ -342,7 +5104,7 @@ class AdsBridge {
342
5104
  if (shouldEmit === true) {
343
5105
  callback(adsRecordMap, adsObjectMap);
344
5106
  }
345
- instrumentation.timerMetricAddDuration(ADS_BRIDGE_EMIT_RECORD_CHANGED_DURATION, Date.now() - startTime);
5107
+ instrumentation$1.timerMetricAddDuration(ADS_BRIDGE_EMIT_RECORD_CHANGED_DURATION, Date.now() - startTime);
346
5108
  }
347
5109
  }
348
5110
 
@@ -370,5 +5132,5 @@ function withAdsBridge(callback) {
370
5132
  callbacks.push(callback);
371
5133
  }
372
5134
 
373
- export { instrument, withAdsBridge };
374
- // version: 1.294.0-06a44f23f
5135
+ export { instrument$1 as instrument, withAdsBridge };
5136
+ // version: 1.296.0-ad26368c0