swagger-client 3.37.8 → 3.38.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.
@@ -58,10 +58,9 @@ __webpack_require__.r(__webpack_exports__);
58
58
  /* harmony import */ var _oas3_parameter_builders_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(42276);
59
59
  /* harmony import */ var _oas3_build_request_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(53044);
60
60
  /* harmony import */ var _swagger2_build_request_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(77768);
61
- /* harmony import */ var _helpers_index_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(50324);
62
- /* harmony import */ var _helpers_index_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(47555);
63
- /* harmony import */ var _helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(50918);
64
- /* harmony import */ var _helpers_cookie_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(48009);
61
+ /* harmony import */ var _helpers_index_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(55971);
62
+ /* harmony import */ var _helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(50918);
63
+ /* harmony import */ var _helpers_cookie_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(48009);
65
64
 
66
65
 
67
66
 
@@ -79,6 +78,8 @@ __webpack_require__.r(__webpack_exports__);
79
78
 
80
79
 
81
80
  const arrayOrEmpty = ar => Array.isArray(ar) ? ar : [];
81
+ const HTTP_METHOD_TOKEN = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
82
+ const isValidHttpMethod = method => typeof method === 'string' && HTTP_METHOD_TOKEN.test(method);
82
83
  const findObjectOrArraySchema = (schema, {
83
84
  recurse = true,
84
85
  depth = 1
@@ -198,7 +199,7 @@ function execute({
198
199
  const http = userHttp || fetch || _http_index_js__WEBPACK_IMPORTED_MODULE_9__["default"]; // Default to _our_ http
199
200
 
200
201
  if (pathName && method && !operationId) {
201
- operationId = (0,_helpers_index_js__WEBPACK_IMPORTED_MODULE_16__["default"])(pathName, method);
202
+ operationId = (0,_helpers_index_js__WEBPACK_IMPORTED_MODULE_15__.idFromPathMethodLegacy)(pathName, method);
202
203
  }
203
204
  const request = self.buildRequest({
204
205
  spec,
@@ -238,7 +239,7 @@ function buildRequest(options) {
238
239
  parameterBuilders,
239
240
  baseURL
240
241
  } = options;
241
- const specIsOAS3 = (0,_helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_17__.isOpenAPI3)(spec);
242
+ const specIsOAS3 = (0,_helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_16__.isOpenAPI3)(spec);
242
243
  if (!parameterBuilders) {
243
244
  // user did not provide custom parameter builders
244
245
  if (specIsOAS3) {
@@ -270,7 +271,7 @@ function buildRequest(options) {
270
271
  if (userFetch) {
271
272
  req.userFetch = userFetch;
272
273
  }
273
- const operationRaw = (0,_helpers_index_js__WEBPACK_IMPORTED_MODULE_15__["default"])(spec, operationId);
274
+ const operationRaw = (0,_helpers_index_js__WEBPACK_IMPORTED_MODULE_15__.getOperationRaw)(spec, operationId);
274
275
  if (!operationRaw) {
275
276
  throw new OperationNotFoundError(`Operation ${operationId} not found`);
276
277
  }
@@ -279,6 +280,9 @@ function buildRequest(options) {
279
280
  method,
280
281
  pathName
281
282
  } = operationRaw;
283
+ if (!isValidHttpMethod(method)) {
284
+ throw new Error('Invalid HTTP method');
285
+ }
282
286
  baseURL = baseURL ?? baseUrl({
283
287
  spec,
284
288
  scheme,
@@ -287,6 +291,7 @@ function buildRequest(options) {
287
291
  serverVariables,
288
292
  pathName,
289
293
  method,
294
+ operation,
290
295
  serverVariableEncoder
291
296
  });
292
297
  req.url += baseURL;
@@ -301,7 +306,9 @@ function buildRequest(options) {
301
306
  return req;
302
307
  }
303
308
  req.url += pathName; // Have not yet replaced the path parameters
304
- req.method = `${method}`.toUpperCase();
309
+ // Standard operations are normalized by eachOperation; additionalOperations
310
+ // must retain the exact HTTP method token defined by the OAS 3.2 document.
311
+ req.method = method;
305
312
  parameters = parameters || {};
306
313
  const path = spec.paths[pathName] || {};
307
314
  if (responseContentType) {
@@ -390,7 +397,7 @@ function buildRequest(options) {
390
397
  // If the cookie convenience object exists in our request,
391
398
  // serialize its content and then delete the cookie object.
392
399
  if (req.cookies && Object.keys(req.cookies).length > 0) {
393
- const cookieString = (0,_helpers_cookie_js__WEBPACK_IMPORTED_MODULE_18__.serialize)(req.cookies);
400
+ const cookieString = (0,_helpers_cookie_js__WEBPACK_IMPORTED_MODULE_17__.serialize)(req.cookies);
394
401
  if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_3__["default"])(req.headers.Cookie)) {
395
402
  req.headers.Cookie += `; ${cookieString}`;
396
403
  } else {
@@ -412,7 +419,7 @@ const stripNonAlpha = str => str ? str.replace(/\W/g, '') : null;
412
419
 
413
420
  // be careful when modifying this! it is a publicly-exposed method.
414
421
  function baseUrl(obj) {
415
- const specIsOAS3 = (0,_helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_17__.isOpenAPI3)(obj.spec);
422
+ const specIsOAS3 = (0,_helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_16__.isOpenAPI3)(obj.spec);
416
423
  return specIsOAS3 ? oas3BaseUrl(obj) : swagger2BaseUrl(obj);
417
424
  }
418
425
  const isNonEmptyServerList = value => Array.isArray(value) && value.length > 0;
@@ -420,6 +427,7 @@ function oas3BaseUrl({
420
427
  spec,
421
428
  pathName,
422
429
  method,
430
+ operation,
423
431
  server,
424
432
  contextUrl,
425
433
  serverVariables = {},
@@ -430,7 +438,7 @@ function oas3BaseUrl({
430
438
  let selectedServerObj;
431
439
 
432
440
  // compute the servers (this will be taken care of by ApiDOM refrator plugins in future
433
- const operationLevelServers = spec?.paths?.[pathName]?.[(method || '').toLowerCase()]?.servers;
441
+ const operationLevelServers = operation?.servers ?? spec?.paths?.[pathName]?.[(method || '').toLowerCase()]?.servers;
434
442
  const pathItemLevelServers = spec?.paths?.[pathName]?.servers;
435
443
  const rootLevelServers = spec?.servers;
436
444
  servers = isNonEmptyServerList(operationLevelServers) // eslint-disable-line no-nested-ternary
@@ -1392,6 +1400,9 @@ __webpack_require__.r(__webpack_exports__);
1392
1400
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1393
1401
  /* harmony export */ "default": () => (/* binding */ eachOperation)
1394
1402
  /* harmony export */ });
1403
+ /* harmony import */ var _openapi_predicates_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(50918);
1404
+
1405
+
1395
1406
  // iterate over each operation, and fire a callback with details
1396
1407
  // `find=true` will stop iterating, when the cb returns truthy
1397
1408
  function eachOperation(spec, cb, find) {
@@ -1401,13 +1412,14 @@ function eachOperation(spec, cb, find) {
1401
1412
  const {
1402
1413
  paths
1403
1414
  } = spec;
1415
+ const supportsAdditionalOperations = (0,_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_0__.isOpenAPI32)(spec);
1404
1416
 
1405
1417
  // Iterate over the spec, collecting operations
1406
1418
  // eslint-disable-next-line no-restricted-syntax, guard-for-in
1407
1419
  for (const pathName in paths) {
1408
1420
  // eslint-disable-next-line no-restricted-syntax, guard-for-in
1409
1421
  for (const method in paths[pathName]) {
1410
- if (method.toUpperCase() === 'PARAMETERS') {
1422
+ if (method.toUpperCase() === 'PARAMETERS' || method === 'additionalOperations') {
1411
1423
  continue; // eslint-disable-line no-continue
1412
1424
  }
1413
1425
  const operation = paths[pathName][method];
@@ -1425,6 +1437,28 @@ function eachOperation(spec, cb, find) {
1425
1437
  return operationObj;
1426
1438
  }
1427
1439
  }
1440
+ const {
1441
+ additionalOperations
1442
+ } = paths[pathName];
1443
+ if (supportsAdditionalOperations && additionalOperations && typeof additionalOperations === 'object') {
1444
+ // eslint-disable-next-line no-restricted-syntax
1445
+ for (const method of Object.keys(additionalOperations)) {
1446
+ const operation = additionalOperations[method];
1447
+ if (!operation || typeof operation !== 'object') {
1448
+ continue; // eslint-disable-line no-continue
1449
+ }
1450
+ const operationObj = {
1451
+ spec,
1452
+ pathName,
1453
+ method,
1454
+ operation
1455
+ };
1456
+ const cbValue = cb(operationObj);
1457
+ if (find && cbValue) {
1458
+ return operationObj;
1459
+ }
1460
+ }
1461
+ }
1428
1462
  }
1429
1463
  return undefined;
1430
1464
  }
@@ -1495,6 +1529,7 @@ __webpack_require__.r(__webpack_exports__);
1495
1529
  /* harmony export */ });
1496
1530
  /* harmony import */ var _replace_special_chars_with_underscore_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(47891);
1497
1531
 
1532
+ const STANDARD_HTTP_METHODS = new Set(['connect', 'delete', 'get', 'head', 'options', 'patch', 'post', 'put', 'query', 'trace']);
1498
1533
  function idFromPathMethod(pathName, method, {
1499
1534
  v2OperationIdCompatibilityMode
1500
1535
  } = {}) {
@@ -1503,7 +1538,8 @@ function idFromPathMethod(pathName, method, {
1503
1538
  res = res || `${pathName.substring(1)}_${method}`;
1504
1539
  return res.replace(/((_){2,})/g, '_').replace(/^(_)*/g, '').replace(/([_])*$/g, '');
1505
1540
  }
1506
- return `${method.toLowerCase()}${(0,_replace_special_chars_with_underscore_js__WEBPACK_IMPORTED_MODULE_0__["default"])(pathName)}`;
1541
+ const normalizedMethod = STANDARD_HTTP_METHODS.has(method.toLowerCase()) ? method.toLowerCase() : method;
1542
+ return `${normalizedMethod}${(0,_replace_special_chars_with_underscore_js__WEBPACK_IMPORTED_MODULE_0__["default"])(pathName)}`;
1507
1543
  }
1508
1544
 
1509
1545
  /***/ },
@@ -1520,6 +1556,37 @@ function idFromPathMethodLegacy(pathName, method) {
1520
1556
  return `${method.toLowerCase()}-${pathName}`;
1521
1557
  }
1522
1558
 
1559
+ /***/ },
1560
+
1561
+ /***/ 55971
1562
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1563
+
1564
+ "use strict";
1565
+ __webpack_require__.r(__webpack_exports__);
1566
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1567
+ /* harmony export */ eachOperation: () => (/* reexport safe */ _each_operation_js__WEBPACK_IMPORTED_MODULE_0__["default"]),
1568
+ /* harmony export */ findOperation: () => (/* reexport safe */ _find_operation_js__WEBPACK_IMPORTED_MODULE_1__["default"]),
1569
+ /* harmony export */ getOperationRaw: () => (/* reexport safe */ _get_operation_raw_js__WEBPACK_IMPORTED_MODULE_2__["default"]),
1570
+ /* harmony export */ idFromPathMethod: () => (/* reexport safe */ _id_from_path_method_index_js__WEBPACK_IMPORTED_MODULE_4__["default"]),
1571
+ /* harmony export */ idFromPathMethodLegacy: () => (/* reexport safe */ _id_from_path_method_legacy_js__WEBPACK_IMPORTED_MODULE_5__["default"]),
1572
+ /* harmony export */ isHttpUrl: () => (/* reexport safe */ _is_http_url_js__WEBPACK_IMPORTED_MODULE_6__["default"]),
1573
+ /* harmony export */ opId: () => (/* reexport safe */ _op_id_js__WEBPACK_IMPORTED_MODULE_3__["default"])
1574
+ /* harmony export */ });
1575
+ /* harmony import */ var _each_operation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28686);
1576
+ /* harmony import */ var _find_operation_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71356);
1577
+ /* harmony import */ var _get_operation_raw_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(50324);
1578
+ /* harmony import */ var _op_id_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(37896);
1579
+ /* harmony import */ var _id_from_path_method_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(30658);
1580
+ /* harmony import */ var _id_from_path_method_legacy_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(47555);
1581
+ /* harmony import */ var _is_http_url_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(42396);
1582
+
1583
+
1584
+
1585
+
1586
+
1587
+
1588
+
1589
+
1523
1590
  /***/ },
1524
1591
 
1525
1592
  /***/ 42396
@@ -2193,8 +2260,7 @@ __webpack_require__.r(__webpack_exports__);
2193
2260
  /* harmony export */ mapTagOperations: () => (/* binding */ mapTagOperations),
2194
2261
  /* harmony export */ self: () => (/* binding */ self)
2195
2262
  /* harmony export */ });
2196
- /* harmony import */ var _helpers_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28686);
2197
- /* harmony import */ var _helpers_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(37896);
2263
+ /* harmony import */ var _helpers_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55971);
2198
2264
 
2199
2265
  const nullFn = () => null;
2200
2266
  const normalizeArray = arg => Array.isArray(arg) ? arg : [arg];
@@ -2290,7 +2356,7 @@ function mapTagOperations({
2290
2356
  }) {
2291
2357
  const operationIdCounter = {};
2292
2358
  const tagOperations = {}; // Will house all tags + operations
2293
- (0,_helpers_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(spec, ({
2359
+ (0,_helpers_index_js__WEBPACK_IMPORTED_MODULE_0__.eachOperation)(spec, ({
2294
2360
  pathName,
2295
2361
  method,
2296
2362
  operation
@@ -2302,7 +2368,7 @@ function mapTagOperations({
2302
2368
  }
2303
2369
  tagOperations[tag] = tagOperations[tag] || {};
2304
2370
  const tagObj = tagOperations[tag];
2305
- const id = (0,_helpers_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(operation, pathName, method, {
2371
+ const id = (0,_helpers_index_js__WEBPACK_IMPORTED_MODULE_0__.opId)(operation, pathName, method, {
2306
2372
  v2OperationIdCompatibilityMode
2307
2373
  });
2308
2374
  const cbResult = cb({
@@ -54441,7 +54507,7 @@ function requireOmap() {
54441
54507
  const _toString = Object.prototype.toString;
54442
54508
  function resolveYamlOmap(data) {
54443
54509
  if (data === null) return true;
54444
- const objectKeys = [];
54510
+ const objectKeys = {};
54445
54511
  const object = data;
54446
54512
  for (let index = 0, length = object.length; index < length; index += 1) {
54447
54513
  const pair = object[index];
@@ -54455,8 +54521,8 @@ function requireOmap() {
54455
54521
  }
54456
54522
  }
54457
54523
  if (!pairHasKey) return false;
54458
- if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
54459
- else return false;
54524
+ if (_hasOwnProperty.call(objectKeys, pairKey)) return false;
54525
+ Object.defineProperty(objectKeys, pairKey, { value: true });
54460
54526
  }
54461
54527
  return true;
54462
54528
  }
@@ -56649,557 +56715,400 @@ const {
56649
56715
  "use strict";
56650
56716
  __webpack_require__.r(__webpack_exports__);
56651
56717
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
56652
- /* harmony export */ "default": () => (/* binding */ src_default)
56718
+ /* harmony export */ "default": () => (/* binding */ traverse)
56653
56719
  /* harmony export */ });
56654
- function _array_like_to_array(arr, len) {
56655
- if (len == null || len > arr.length) len = arr.length;
56656
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
56657
- return arr2;
56658
- }
56659
- function _array_with_holes(arr) {
56660
- if (Array.isArray(arr)) return arr;
56661
- }
56662
- function _class_call_check(instance, Constructor) {
56663
- if (!(instance instanceof Constructor)) {
56664
- throw new TypeError("Cannot call a class as a function");
56665
- }
56666
- }
56667
- function _defineProperties(target, props) {
56668
- for(var i = 0; i < props.length; i++){
56669
- var descriptor = props[i];
56670
- descriptor.enumerable = descriptor.enumerable || false;
56671
- descriptor.configurable = true;
56672
- if ("value" in descriptor) descriptor.writable = true;
56673
- Object.defineProperty(target, descriptor.key, descriptor);
56674
- }
56675
- }
56676
- function _create_class(Constructor, protoProps, staticProps) {
56677
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
56678
- if (staticProps) _defineProperties(Constructor, staticProps);
56679
- return Constructor;
56680
- }
56681
- function _instanceof(left, right) {
56682
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
56683
- return !!right[Symbol.hasInstance](left);
56684
- } else {
56685
- return left instanceof right;
56686
- }
56687
- }
56688
- function _iterable_to_array_limit(arr, i) {
56689
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
56690
- if (_i == null) return;
56691
- var _arr = [];
56692
- var _n = true;
56693
- var _d = false;
56694
- var _s, _e;
56695
- try {
56696
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
56697
- _arr.push(_s.value);
56698
- if (i && _arr.length === i) break;
56699
- }
56700
- } catch (err) {
56701
- _d = true;
56702
- _e = err;
56703
- } finally{
56704
- try {
56705
- if (!_n && _i["return"] != null) _i["return"]();
56706
- } finally{
56707
- if (_d) throw _e;
56708
- }
56709
- }
56710
- return _arr;
56711
- }
56712
- function _non_iterable_rest() {
56713
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
56714
- }
56715
- function _sliced_to_array(arr, i) {
56716
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
56717
- }
56718
- function _type_of(obj) {
56719
- "@swc/helpers - typeof";
56720
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
56720
+ //#region packages/neotraverse/src/legacy/index.ts
56721
+ const to_string = (obj) => Object.prototype.toString.call(obj);
56722
+ const is_typed_array = (value) => ArrayBuffer.isView(value) && !(value instanceof DataView);
56723
+ const is_array = Array.isArray;
56724
+ const is_boxed_primitive = (obj) => {
56725
+ const tag = to_string(obj);
56726
+ return tag === "[object Boolean]" || tag === "[object Number]" || tag === "[object String]";
56727
+ };
56728
+ const gopd = Object.getOwnPropertyDescriptor;
56729
+ const is_property_enumerable = Object.prototype.propertyIsEnumerable;
56730
+ const get_own_property_symbols = Object.getOwnPropertySymbols;
56731
+ const has_own_property = Object.prototype.hasOwnProperty;
56732
+ const is_unsafe_key = (key) => key === "__proto__" || key === "constructor" || key === "prototype";
56733
+ function safe_set(dst, key, value) {
56734
+ if (key === "__proto__") Object.defineProperty(dst, key, {
56735
+ value,
56736
+ writable: true,
56737
+ enumerable: true,
56738
+ configurable: true
56739
+ });
56740
+ else dst[key] = value;
56721
56741
  }
56722
- function _unsupported_iterable_to_array(o, minLen) {
56723
- if (!o) return;
56724
- if (typeof o === "string") return _array_like_to_array(o, minLen);
56725
- var n = Object.prototype.toString.call(o).slice(8, -1);
56726
- if (n === "Object" && o.constructor) n = o.constructor.name;
56727
- if (n === "Map" || n === "Set") return Array.from(n);
56728
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
56742
+ function assert_within_depth(depth, max_depth) {
56743
+ if (max_depth !== void 0 && depth > max_depth) throw new RangeError(`neotraverse: maximum traversal depth (${max_depth}) exceeded`);
56729
56744
  }
56730
- var __typeError = function(msg) {
56731
- throw TypeError(msg);
56732
- };
56733
- var __accessCheck = function(obj, member, msg) {
56734
- return member.has(obj) || __typeError("Cannot " + msg);
56735
- };
56736
- var __privateGet = function(obj, member, getter) {
56737
- return __accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj);
56738
- };
56739
- var __privateAdd = function(obj, member, value) {
56740
- return member.has(obj) ? __typeError("Cannot add the same private member more than once") : _instanceof(member, WeakSet) ? member.add(obj) : member.set(obj, value);
56741
- };
56742
- var __privateSet = function(obj, member, value, setter) {
56743
- return __accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value;
56744
- };
56745
- // src/index.ts
56746
- var to_string = function(obj) {
56747
- return Object.prototype.toString.call(obj);
56748
- };
56749
- var is_typed_array = function(value) {
56750
- return ArrayBuffer.isView(value) && !_instanceof(value, DataView);
56751
- };
56752
- var is_date = function(obj) {
56753
- return to_string(obj) === "[object Date]";
56754
- };
56755
- var is_regexp = function(obj) {
56756
- return to_string(obj) === "[object RegExp]";
56757
- };
56758
- var is_error = function(obj) {
56759
- return to_string(obj) === "[object Error]";
56760
- };
56761
- var is_boolean = function(obj) {
56762
- return to_string(obj) === "[object Boolean]";
56763
- };
56764
- var is_number = function(obj) {
56765
- return to_string(obj) === "[object Number]";
56766
- };
56767
- var is_string = function(obj) {
56768
- return to_string(obj) === "[object String]";
56769
- };
56770
- var is_array = Array.isArray;
56771
- var gopd = Object.getOwnPropertyDescriptor;
56772
- var is_property_enumerable = Object.prototype.propertyIsEnumerable;
56773
- var get_own_property_symbols = Object.getOwnPropertySymbols;
56774
- var has_own_property = Object.prototype.hasOwnProperty;
56775
56745
  function own_enumerable_keys(obj) {
56776
- var res = Object.keys(obj);
56777
- var symbols = get_own_property_symbols(obj);
56778
- for(var i = 0; i < symbols.length; i++){
56779
- if (is_property_enumerable.call(obj, symbols[i])) {
56780
- res.push(symbols[i]);
56781
- }
56782
- }
56783
- return res;
56746
+ const res = Object.keys(obj);
56747
+ const symbols = get_own_property_symbols(obj);
56748
+ for (let i = 0; i < symbols.length; i++) if (is_property_enumerable.call(obj, symbols[i])) res.push(symbols[i]);
56749
+ return res;
56784
56750
  }
56785
- function is_writable(object, key) {
56786
- var _gopd;
56787
- return !((_gopd = gopd(object, key)) === null || _gopd === void 0 ? void 0 : _gopd.writable);
56751
+ function is_non_writable(object, key) {
56752
+ var _gopd;
56753
+ return !((_gopd = gopd(object, key)) === null || _gopd === void 0 ? void 0 : _gopd.writable);
56788
56754
  }
56789
56755
  function copy(src, options) {
56790
- if ((typeof src === "undefined" ? "undefined" : _type_of(src)) === "object" && src !== null) {
56791
- var dst;
56792
- if (is_array(src)) {
56793
- dst = [];
56794
- } else if (is_date(src)) {
56795
- dst = new Date(src.getTime ? src.getTime() : src);
56796
- } else if (is_regexp(src)) {
56797
- dst = new RegExp(src);
56798
- } else if (is_error(src)) {
56799
- dst = {
56800
- message: src.message
56801
- };
56802
- } else if (is_boolean(src) || is_number(src) || is_string(src)) {
56803
- dst = Object(src);
56804
- } else if (is_typed_array(src)) {
56805
- return src.slice();
56806
- } else {
56807
- dst = Object.create(Object.getPrototypeOf(src));
56808
- }
56809
- var iterator_function = options.includeSymbols ? own_enumerable_keys : Object.keys;
56810
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
56811
- try {
56812
- for(var _iterator = iterator_function(src)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
56813
- var key = _step.value;
56814
- dst[key] = src[key];
56815
- }
56816
- } catch (err) {
56817
- _didIteratorError = true;
56818
- _iteratorError = err;
56819
- } finally{
56820
- try {
56821
- if (!_iteratorNormalCompletion && _iterator.return != null) {
56822
- _iterator.return();
56823
- }
56824
- } finally{
56825
- if (_didIteratorError) {
56826
- throw _iteratorError;
56827
- }
56828
- }
56829
- }
56830
- return dst;
56831
- }
56832
- return src;
56756
+ if (typeof src === "object" && src !== null) {
56757
+ let dst;
56758
+ if (is_array(src)) dst = [];
56759
+ else if (is_typed_array(src)) return src.slice();
56760
+ else if (is_boxed_primitive(src)) return Object(src);
56761
+ else {
56762
+ const tag = to_string(src);
56763
+ if (tag === "[object Date]" && typeof src.getTime === "function") dst = new Date(src.getTime());
56764
+ else if (tag === "[object RegExp]" && typeof src.source === "string") dst = new RegExp(src);
56765
+ else if (tag === "[object Error]") dst = { message: src.message };
56766
+ else dst = Object.create(Object.getPrototypeOf(src));
56767
+ }
56768
+ const iterator_function = options.includeSymbols ? own_enumerable_keys : Object.keys;
56769
+ for (const key of iterator_function(src)) safe_set(dst, key, src[key]);
56770
+ return dst;
56771
+ }
56772
+ return src;
56833
56773
  }
56834
- var empty_null = {
56835
- includeSymbols: false,
56836
- immutable: false
56774
+ const empty_null = {
56775
+ includeSymbols: false,
56776
+ immutable: false
56837
56777
  };
56838
- function walk(root, cb) {
56839
- var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : empty_null;
56840
- var path = [];
56841
- var parents = [];
56842
- var alive = true;
56843
- var iterator_function = options.includeSymbols ? own_enumerable_keys : Object.keys;
56844
- var immutable = !!options.immutable;
56845
- return function walker(node_) {
56846
- var node = immutable ? copy(node_, options) : node_;
56847
- var modifiers = {};
56848
- var keep_going = true;
56849
- var state = {
56850
- node: node,
56851
- node_: node_,
56852
- path: [].concat(path),
56853
- parent: parents[parents.length - 1],
56854
- parents: parents,
56855
- key: path[path.length - 1],
56856
- isRoot: path.length === 0,
56857
- level: path.length,
56858
- circular: void 0,
56859
- isLeaf: false,
56860
- notLeaf: true,
56861
- notRoot: true,
56862
- isFirst: false,
56863
- isLast: false,
56864
- update: function update(x) {
56865
- var stopHere = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
56866
- if (!state.isRoot) {
56867
- state.parent.node[state.key] = x;
56868
- }
56869
- state.node = x;
56870
- if (stopHere) {
56871
- keep_going = false;
56872
- }
56873
- },
56874
- delete: function _delete(stopHere) {
56875
- delete state.parent.node[state.key];
56876
- if (stopHere) {
56877
- keep_going = false;
56878
- }
56879
- },
56880
- remove: function remove(stopHere) {
56881
- if (is_array(state.parent.node)) {
56882
- state.parent.node.splice(state.key, 1);
56883
- } else {
56884
- delete state.parent.node[state.key];
56885
- }
56886
- if (stopHere) {
56887
- keep_going = false;
56888
- }
56889
- },
56890
- keys: null,
56891
- before: function before(f) {
56892
- modifiers.before = f;
56893
- },
56894
- after: function after(f) {
56895
- modifiers.after = f;
56896
- },
56897
- pre: function pre(f) {
56898
- modifiers.pre = f;
56899
- },
56900
- post: function post(f) {
56901
- modifiers.post = f;
56902
- },
56903
- stop: function stop() {
56904
- alive = false;
56905
- },
56906
- block: function block() {
56907
- keep_going = false;
56908
- }
56909
- };
56910
- if (!alive) {
56911
- return state;
56912
- }
56913
- function update_state() {
56914
- if (_type_of(state.node) === "object" && state.node !== null) {
56915
- if (!state.keys || state.node_ !== state.node) {
56916
- state.keys = iterator_function(state.node);
56917
- }
56918
- state.isLeaf = state.keys.length === 0;
56919
- for(var i = 0; i < parents.length; i++){
56920
- if (parents[i].node_ === node_) {
56921
- state.circular = parents[i];
56922
- break;
56923
- }
56924
- }
56925
- } else {
56926
- state.isLeaf = true;
56927
- state.keys = null;
56928
- }
56929
- state.notLeaf = !state.isLeaf;
56930
- state.notRoot = !state.isRoot;
56931
- }
56932
- update_state();
56933
- var ret = cb.call(state, state.node);
56934
- if (ret !== void 0 && state.update) {
56935
- state.update(ret);
56936
- }
56937
- if (modifiers.before) {
56938
- modifiers.before.call(state, state.node);
56939
- }
56940
- if (!keep_going) {
56941
- return state;
56942
- }
56943
- if (_type_of(state.node) === "object" && state.node !== null && !state.circular) {
56944
- parents.push(state);
56945
- update_state();
56946
- var _state_keys;
56947
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
56948
- try {
56949
- for(var _iterator = Object.entries((_state_keys = state.keys) !== null && _state_keys !== void 0 ? _state_keys : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
56950
- var _step_value = _sliced_to_array(_step.value, 2), index = _step_value[0], key = _step_value[1];
56951
- var _state_keys1;
56952
- path.push(key);
56953
- if (modifiers.pre) {
56954
- modifiers.pre.call(state, state.node[key], key);
56955
- }
56956
- var child = walker(state.node[key]);
56957
- if (immutable && has_own_property.call(state.node, key) && !is_writable(state.node, key)) {
56958
- state.node[key] = child.node;
56959
- }
56960
- child.isLast = ((_state_keys1 = state.keys) === null || _state_keys1 === void 0 ? void 0 : _state_keys1.length) ? +index === state.keys.length - 1 : false;
56961
- child.isFirst = +index === 0;
56962
- if (modifiers.post) {
56963
- modifiers.post.call(state, child);
56964
- }
56965
- path.pop();
56966
- }
56967
- } catch (err) {
56968
- _didIteratorError = true;
56969
- _iteratorError = err;
56970
- } finally{
56971
- try {
56972
- if (!_iteratorNormalCompletion && _iterator.return != null) {
56973
- _iterator.return();
56974
- }
56975
- } finally{
56976
- if (_didIteratorError) {
56977
- throw _iteratorError;
56978
- }
56979
- }
56980
- }
56981
- parents.pop();
56982
- }
56983
- if (modifiers.after) {
56984
- modifiers.after.call(state, state.node);
56985
- }
56986
- return state;
56987
- }(root).node;
56988
- }
56989
- var _value, _options;
56990
- var Traverse = /*#__PURE__*/ function() {
56991
- "use strict";
56992
- function Traverse(obj) {
56993
- var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : empty_null;
56994
- _class_call_check(this, Traverse);
56995
- // ! Have to keep these public as legacy mode requires them
56996
- __privateAdd(this, _value);
56997
- __privateAdd(this, _options);
56998
- __privateSet(this, _value, obj);
56999
- __privateSet(this, _options, options);
57000
- }
57001
- _create_class(Traverse, [
57002
- {
57003
- /**
57004
- * Get the element at the array `path`.
57005
- */ key: "get",
57006
- value: function get(paths) {
57007
- var node = __privateGet(this, _value);
57008
- for(var i = 0; node && i < paths.length; i++){
57009
- var key = paths[i];
57010
- if (!has_own_property.call(node, key) || !__privateGet(this, _options).includeSymbols && (typeof key === "undefined" ? "undefined" : _type_of(key)) === "symbol") {
57011
- return void 0;
57012
- }
57013
- node = node[key];
57014
- }
57015
- return node;
57016
- }
57017
- },
57018
- {
57019
- /**
57020
- * Return whether the element at the array `path` exists.
57021
- */ key: "has",
57022
- value: function has(paths) {
57023
- var node = __privateGet(this, _value);
57024
- for(var i = 0; node && i < paths.length; i++){
57025
- var key = paths[i];
57026
- if (!has_own_property.call(node, key) || !__privateGet(this, _options).includeSymbols && (typeof key === "undefined" ? "undefined" : _type_of(key)) === "symbol") {
57027
- return false;
57028
- }
57029
- node = node[key];
57030
- }
57031
- return true;
57032
- }
57033
- },
57034
- {
57035
- /**
57036
- * Set the element at the array `path` to `value`.
57037
- */ key: "set",
57038
- value: function set(path, value) {
57039
- var node = __privateGet(this, _value);
57040
- var i = 0;
57041
- for(i = 0; i < path.length - 1; i++){
57042
- var key = path[i];
57043
- if (!has_own_property.call(node, key)) {
57044
- node[key] = {};
57045
- }
57046
- node = node[key];
57047
- }
57048
- node[path[i]] = value;
57049
- return value;
57050
- }
57051
- },
57052
- {
57053
- /**
57054
- * Execute `fn` for each node in the object and return a new object with the results of the walk. To update nodes in the result use `this.update(value)`.
57055
- */ key: "map",
57056
- value: function map(cb) {
57057
- return walk(__privateGet(this, _value), cb, {
57058
- immutable: true,
57059
- includeSymbols: !!__privateGet(this, _options).includeSymbols
57060
- });
57061
- }
57062
- },
57063
- {
57064
- /**
57065
- * Execute `fn` for each node in the object but unlike `.map()`, when `this.update()` is called it updates the object in-place.
57066
- */ key: "forEach",
57067
- value: function forEach(cb) {
57068
- __privateSet(this, _value, walk(__privateGet(this, _value), cb, __privateGet(this, _options)));
57069
- return __privateGet(this, _value);
57070
- }
57071
- },
57072
- {
57073
- /**
57074
- * For each node in the object, perform a [left-fold](http://en.wikipedia.org/wiki/Fold_(higher-order_function)) with the return value of `fn(acc, node)`.
57075
- *
57076
- * If `init` isn't specified, `init` is set to the root object for the first step and the root element is skipped.
57077
- */ key: "reduce",
57078
- value: function reduce(cb, init) {
57079
- var skip = arguments.length === 1;
57080
- var acc = skip ? __privateGet(this, _value) : init;
57081
- this.forEach(function(x) {
57082
- if (!this.isRoot || !skip) {
57083
- acc = cb.call(this, acc, x);
57084
- }
57085
- });
57086
- return acc;
57087
- }
57088
- },
57089
- {
57090
- /**
57091
- * Return an `Array` of every possible non-cyclic path in the object.
57092
- * Paths are `Array`s of string keys.
57093
- */ key: "paths",
57094
- value: function paths() {
57095
- var acc = [];
57096
- this.forEach(function() {
57097
- acc.push(this.path);
57098
- });
57099
- return acc;
57100
- }
57101
- },
57102
- {
57103
- /**
57104
- * Return an `Array` of every node in the object.
57105
- */ key: "nodes",
57106
- value: function nodes() {
57107
- var acc = [];
57108
- this.forEach(function() {
57109
- acc.push(this.node);
57110
- });
57111
- return acc;
57112
- }
57113
- },
57114
- {
57115
- /**
57116
- * Create a deep clone of the object.
57117
- */ key: "clone",
57118
- value: function clone() {
57119
- var parents = [];
57120
- var nodes = [];
57121
- var options = __privateGet(this, _options);
57122
- if (is_typed_array(__privateGet(this, _value))) {
57123
- return __privateGet(this, _value).slice();
57124
- }
57125
- return function clone(src) {
57126
- for(var i = 0; i < parents.length; i++){
57127
- if (parents[i] === src) {
57128
- return nodes[i];
57129
- }
57130
- }
57131
- if ((typeof src === "undefined" ? "undefined" : _type_of(src)) === "object" && src !== null) {
57132
- var dst = copy(src, options);
57133
- parents.push(src);
57134
- nodes.push(dst);
57135
- var iteratorFunction = options.includeSymbols ? own_enumerable_keys : Object.keys;
57136
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
57137
- try {
57138
- for(var _iterator = iteratorFunction(src)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
57139
- var key = _step.value;
57140
- dst[key] = clone(src[key]);
57141
- }
57142
- } catch (err) {
57143
- _didIteratorError = true;
57144
- _iteratorError = err;
57145
- } finally{
57146
- try {
57147
- if (!_iteratorNormalCompletion && _iterator.return != null) {
57148
- _iterator.return();
57149
- }
57150
- } finally{
57151
- if (_didIteratorError) {
57152
- throw _iteratorError;
57153
- }
57154
- }
57155
- }
57156
- parents.pop();
57157
- nodes.pop();
57158
- return dst;
57159
- }
57160
- return src;
57161
- }(__privateGet(this, _value));
57162
- }
57163
- }
57164
- ]);
57165
- return Traverse;
57166
- }();
57167
- _value = new WeakMap();
57168
- _options = new WeakMap();
57169
- var traverse = function(obj, options) {
57170
- return new Traverse(obj, options);
56778
+ function walk(root, cb, options = empty_null) {
56779
+ const path = [];
56780
+ const parents = [];
56781
+ let alive = true;
56782
+ const iterator_function = options.includeSymbols ? own_enumerable_keys : Object.keys;
56783
+ const immutable = !!options.immutable;
56784
+ const max_depth = options.maxDepth;
56785
+ return (function walker(node_) {
56786
+ assert_within_depth(path.length, max_depth);
56787
+ const node = immutable ? copy(node_, options) : node_;
56788
+ const modifiers = {};
56789
+ let keep_going = true;
56790
+ const state = {
56791
+ node,
56792
+ node_,
56793
+ path: path.slice(),
56794
+ parent: parents[parents.length - 1],
56795
+ parents,
56796
+ key: path[path.length - 1],
56797
+ isRoot: path.length === 0,
56798
+ level: path.length,
56799
+ circular: void 0,
56800
+ isLeaf: false,
56801
+ notLeaf: true,
56802
+ notRoot: true,
56803
+ isFirst: false,
56804
+ isLast: false,
56805
+ update: function(x, stopHere = false) {
56806
+ if (!state.isRoot) safe_set(state.parent.node, state.key, x);
56807
+ state.node = x;
56808
+ if (stopHere) keep_going = false;
56809
+ },
56810
+ delete: function(stopHere) {
56811
+ delete state.parent.node[state.key];
56812
+ if (stopHere) keep_going = false;
56813
+ },
56814
+ remove: function(stopHere) {
56815
+ if (is_array(state.parent.node)) state.parent.node.splice(state.key, 1);
56816
+ else delete state.parent.node[state.key];
56817
+ if (stopHere) keep_going = false;
56818
+ },
56819
+ keys: null,
56820
+ before: function(f) {
56821
+ modifiers.before = f;
56822
+ },
56823
+ after: function(f) {
56824
+ modifiers.after = f;
56825
+ },
56826
+ pre: function(f) {
56827
+ modifiers.pre = f;
56828
+ },
56829
+ post: function(f) {
56830
+ modifiers.post = f;
56831
+ },
56832
+ stop: function() {
56833
+ alive = false;
56834
+ },
56835
+ block: function() {
56836
+ keep_going = false;
56837
+ }
56838
+ };
56839
+ if (!alive) return state;
56840
+ function update_state() {
56841
+ if (typeof state.node === "object" && state.node !== null) {
56842
+ if (!state.keys || state.node_ !== state.node) state.keys = iterator_function(state.node);
56843
+ state.isLeaf = state.keys.length === 0;
56844
+ for (let i = 0; i < parents.length; i++) if (parents[i].node_ === node_) {
56845
+ state.circular = parents[i];
56846
+ break;
56847
+ }
56848
+ } else {
56849
+ state.isLeaf = true;
56850
+ state.keys = null;
56851
+ }
56852
+ state.notLeaf = !state.isLeaf;
56853
+ state.notRoot = !state.isRoot;
56854
+ }
56855
+ update_state();
56856
+ const ret = cb.call(state, state.node);
56857
+ if (ret !== void 0 && state.update) state.update(ret);
56858
+ if (modifiers.before) modifiers.before.call(state, state.node);
56859
+ if (!keep_going) return state;
56860
+ if (typeof state.node === "object" && state.node !== null && !state.circular) {
56861
+ var _state$keys;
56862
+ parents.push(state);
56863
+ update_state();
56864
+ const keys = (_state$keys = state.keys) !== null && _state$keys !== void 0 ? _state$keys : [];
56865
+ for (let index = 0; index < keys.length; index++) {
56866
+ const key = keys[index];
56867
+ path.push(key);
56868
+ if (modifiers.pre) modifiers.pre.call(state, state.node[key], key);
56869
+ const child = walker(state.node[key]);
56870
+ if (immutable && has_own_property.call(state.node, key) && !is_non_writable(state.node, key)) safe_set(state.node, key, child.node);
56871
+ child.isLast = index === keys.length - 1;
56872
+ child.isFirst = index === 0;
56873
+ if (modifiers.post) modifiers.post.call(state, child);
56874
+ path.pop();
56875
+ }
56876
+ parents.pop();
56877
+ }
56878
+ if (modifiers.after) modifiers.after.call(state, state.node);
56879
+ return state;
56880
+ })(root).node;
56881
+ }
56882
+ /**
56883
+ * @deprecated Import `Traverse` from `neotraverse/modern` instead
56884
+ *
56885
+ * @see https://neotraverse.puruvj.dev/legacy.html#methods
56886
+ */
56887
+ var Traverse = class {
56888
+ constructor(obj, options = empty_null) {
56889
+ this._value = obj;
56890
+ this._options = options;
56891
+ }
56892
+ /**
56893
+ * Get the element at the array `path`.
56894
+ *
56895
+ * @see https://neotraverse.puruvj.dev/legacy.html#methods
56896
+ */
56897
+ get(paths) {
56898
+ let node = this._value;
56899
+ for (let i = 0; node && i < paths.length; i++) {
56900
+ const key = paths[i];
56901
+ if (!has_own_property.call(node, key) || !this._options.includeSymbols && typeof key === "symbol") return;
56902
+ node = node[key];
56903
+ }
56904
+ return node;
56905
+ }
56906
+ /**
56907
+ * Return whether the element at the array `path` exists.
56908
+ *
56909
+ * @see https://neotraverse.puruvj.dev/legacy.html#methods
56910
+ */
56911
+ has(paths) {
56912
+ let node = this._value;
56913
+ for (let i = 0; node && i < paths.length; i++) {
56914
+ const key = paths[i];
56915
+ if (!has_own_property.call(node, key) || !this._options.includeSymbols && typeof key === "symbol") return false;
56916
+ node = node[key];
56917
+ }
56918
+ return true;
56919
+ }
56920
+ /**
56921
+ * Set the element at the array `path` to `value`.
56922
+ *
56923
+ * @see https://neotraverse.puruvj.dev/legacy.html#methods
56924
+ */
56925
+ set(path, value) {
56926
+ let node = this._value;
56927
+ let i = 0;
56928
+ for (i = 0; i < path.length - 1; i++) {
56929
+ const key = path[i];
56930
+ if (is_unsafe_key(key)) return value;
56931
+ if (!has_own_property.call(node, key)) node[key] = {};
56932
+ node = node[key];
56933
+ }
56934
+ if (is_unsafe_key(path[i])) return value;
56935
+ node[path[i]] = value;
56936
+ return value;
56937
+ }
56938
+ /**
56939
+ * Execute `fn` for each node in the object and return a new object with the results of the walk. To update nodes in the result use `this.update(value)`.
56940
+ *
56941
+ * @see https://neotraverse.puruvj.dev/legacy.html#methods
56942
+ */
56943
+ map(cb) {
56944
+ return walk(this._value, cb, {
56945
+ immutable: true,
56946
+ includeSymbols: !!this._options.includeSymbols,
56947
+ maxDepth: this._options.maxDepth
56948
+ });
56949
+ }
56950
+ /**
56951
+ * Execute `fn` for each node in the object but unlike `.map()`, when `this.update()` is called it updates the object in-place.
56952
+ *
56953
+ * @see https://neotraverse.puruvj.dev/legacy.html#methods
56954
+ */
56955
+ forEach(cb) {
56956
+ this._value = walk(this._value, cb, this._options);
56957
+ return this._value;
56958
+ }
56959
+ /**
56960
+ * For each node in the object, perform a [left-fold](http://en.wikipedia.org/wiki/Fold_(higher-order_function)) with the return value of `fn(acc, node)`.
56961
+ *
56962
+ * If `init` isn't specified, `init` is set to the root object for the first step and the root element is skipped.
56963
+ *
56964
+ * @see https://neotraverse.puruvj.dev/legacy.html#methods
56965
+ */
56966
+ reduce(cb, init) {
56967
+ const skip = arguments.length === 1;
56968
+ let acc = skip ? this._value : init;
56969
+ this.forEach(function(x) {
56970
+ if (!this.isRoot || !skip) acc = cb.call(this, acc, x);
56971
+ });
56972
+ return acc;
56973
+ }
56974
+ /**
56975
+ * Return an `Array` of every possible non-cyclic path in the object.
56976
+ * Paths are `Array`s of string keys.
56977
+ *
56978
+ * @see https://neotraverse.puruvj.dev/legacy.html#methods
56979
+ */
56980
+ paths() {
56981
+ const acc = [];
56982
+ this.forEach(function() {
56983
+ acc.push(this.path);
56984
+ });
56985
+ return acc;
56986
+ }
56987
+ /**
56988
+ * Return an `Array` of every node in the object.
56989
+ *
56990
+ * @see https://neotraverse.puruvj.dev/legacy.html#methods
56991
+ */
56992
+ nodes() {
56993
+ const acc = [];
56994
+ this.forEach(function() {
56995
+ acc.push(this.node);
56996
+ });
56997
+ return acc;
56998
+ }
56999
+ /**
57000
+ * Create a deep clone of the object.
57001
+ *
57002
+ * @see https://neotraverse.puruvj.dev/legacy.html#methods
57003
+ */
57004
+ clone() {
57005
+ const parents = [];
57006
+ const nodes = [];
57007
+ const options = this._options;
57008
+ const max_depth = options.maxDepth;
57009
+ if (is_typed_array(this._value)) return this._value.slice();
57010
+ return (function clone(src) {
57011
+ assert_within_depth(parents.length, max_depth);
57012
+ for (let i = 0; i < parents.length; i++) if (parents[i] === src) return nodes[i];
57013
+ if (typeof src === "object" && src !== null) {
57014
+ const dst = copy(src, options);
57015
+ if (is_typed_array(src) || is_boxed_primitive(src)) return dst;
57016
+ parents.push(src);
57017
+ nodes.push(dst);
57018
+ const iteratorFunction = options.includeSymbols ? own_enumerable_keys : Object.keys;
57019
+ for (const key of iteratorFunction(src)) safe_set(dst, key, clone(src[key]));
57020
+ parents.pop();
57021
+ nodes.pop();
57022
+ return dst;
57023
+ }
57024
+ return src;
57025
+ })(this._value);
57026
+ }
57171
57027
  };
57172
- traverse.get = function(obj, paths, options) {
57173
- return new Traverse(obj, options).get(paths);
57028
+ const traverse = (obj, options) => {
57029
+ return new Traverse(obj, options);
57174
57030
  };
57175
- traverse.set = function(obj, path, value, options) {
57176
- return new Traverse(obj, options).set(path, value);
57031
+ /**
57032
+ * Get the element at the array `path`.
57033
+ *
57034
+ * @see https://neotraverse.puruvj.dev/guide/api/core.html#get
57035
+ */
57036
+ traverse.get = (obj, paths, options) => {
57037
+ return new Traverse(obj, options).get(paths);
57177
57038
  };
57178
- traverse.has = function(obj, paths, options) {
57179
- return new Traverse(obj, options).has(paths);
57039
+ /**
57040
+ * Set the element at the array `path` to `value`.
57041
+ *
57042
+ * @see https://neotraverse.puruvj.dev/guide/api/core.html#get
57043
+ */
57044
+ traverse.set = (obj, path, value, options) => {
57045
+ return new Traverse(obj, options).set(path, value);
57180
57046
  };
57181
- traverse.map = function(obj, cb, options) {
57182
- return new Traverse(obj, options).map(cb);
57047
+ /**
57048
+ * Return whether the element at the array `path` exists.
57049
+ *
57050
+ * @see https://neotraverse.puruvj.dev/guide/api/core.html#get
57051
+ */
57052
+ traverse.has = (obj, paths, options) => {
57053
+ return new Traverse(obj, options).has(paths);
57183
57054
  };
57184
- traverse.forEach = function(obj, cb, options) {
57185
- return new Traverse(obj, options).forEach(cb);
57055
+ /**
57056
+ * Execute `fn` for each node in the object and return a new object with the results of the walk. To update nodes in the result use `this.update(value)`.
57057
+ *
57058
+ * @see https://neotraverse.puruvj.dev/guide/api/core.html#map
57059
+ */
57060
+ traverse.map = (obj, cb, options) => {
57061
+ return new Traverse(obj, options).map(cb);
57186
57062
  };
57187
- traverse.reduce = function(obj, cb, init, options) {
57188
- return new Traverse(obj, options).reduce(cb, init);
57063
+ /**
57064
+ * Execute `fn` for each node in the object but unlike `.map()`, when `this.update()` is called it updates the object in-place.
57065
+ *
57066
+ * @see https://neotraverse.puruvj.dev/guide/api/core.html#forEach
57067
+ */
57068
+ traverse.forEach = (obj, cb, options) => {
57069
+ return new Traverse(obj, options).forEach(cb);
57189
57070
  };
57190
- traverse.paths = function(obj, options) {
57191
- return new Traverse(obj, options).paths();
57071
+ /**
57072
+ * For each node in the object, perform a [left-fold](http://en.wikipedia.org/wiki/Fold_(higher-order_function)) with the return value of `fn(acc, node)`.
57073
+ *
57074
+ * If `init` isn't specified, `init` is set to the root object for the first step and the root element is skipped.
57075
+ *
57076
+ * @see https://neotraverse.puruvj.dev/guide/api/core.html#reduce
57077
+ */
57078
+ traverse.reduce = (obj, cb, init, options) => {
57079
+ return new Traverse(obj, options).reduce(cb, init);
57192
57080
  };
57193
- traverse.nodes = function(obj, options) {
57194
- return new Traverse(obj, options).nodes();
57081
+ /**
57082
+ * Return an `Array` of every possible non-cyclic path in the object.
57083
+ * Paths are `Array`s of string keys.
57084
+ *
57085
+ * @see https://neotraverse.puruvj.dev/guide/api/core.html#paths
57086
+ */
57087
+ traverse.paths = (obj, options) => {
57088
+ return new Traverse(obj, options).paths();
57195
57089
  };
57196
- traverse.clone = function(obj, options) {
57197
- return new Traverse(obj, options).clone();
57090
+ /**
57091
+ * Return an `Array` of every node in the object.
57092
+ *
57093
+ * @see https://neotraverse.puruvj.dev/guide/api/core.html#paths
57094
+ */
57095
+ traverse.nodes = (obj, options) => {
57096
+ return new Traverse(obj, options).nodes();
57198
57097
  };
57199
- var src_default = traverse;
57200
- // src/legacy.cts
57098
+ /**
57099
+ * Create a deep clone of the object.
57100
+ *
57101
+ * @see https://neotraverse.puruvj.dev/guide/api/core.html#clone
57102
+ */
57103
+ traverse.clone = (obj, options) => {
57104
+ return new Traverse(obj, options).clone();
57105
+ };
57106
+
57107
+ //#endregion
57108
+ //#region packages/neotraverse/src/legacy/legacy.cts
57201
57109
 
57202
57110
 
57111
+ //#endregion
57203
57112
 
57204
57113
 
57205
57114
  /***/ },
@@ -66454,18 +66363,17 @@ __webpack_require__.r(__webpack_exports__);
66454
66363
  /* harmony import */ var _resolver_strategies_openapi_3_2_apidom_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(12359);
66455
66364
  /* harmony import */ var _interfaces_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(77281);
66456
66365
  /* harmony import */ var _execute_index_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(32729);
66457
- /* harmony import */ var _helpers_index_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(37896);
66458
- /* harmony import */ var _helpers_index_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(42396);
66459
- /* harmony import */ var _helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(50918);
66460
- /* harmony import */ var _resolver_apidom_reference_resolve_resolvers_http_swagger_client_index_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(636);
66461
- /* harmony import */ var _resolver_apidom_reference_parse_parsers_json_index_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(92263);
66462
- /* harmony import */ var _resolver_apidom_reference_parse_parsers_yaml_1_2_index_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(12787);
66463
- /* harmony import */ var _resolver_apidom_reference_parse_parsers_openapi_json_3_1_index_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(89742);
66464
- /* harmony import */ var _resolver_apidom_reference_parse_parsers_openapi_yaml_3_1_index_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(49575);
66465
- /* harmony import */ var _resolver_apidom_reference_parse_parsers_openapi_json_3_2_index_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(90643);
66466
- /* harmony import */ var _resolver_apidom_reference_parse_parsers_openapi_yaml_3_2_index_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(93282);
66467
- /* harmony import */ var _resolver_apidom_reference_dereference_strategies_openapi_3_1_swagger_client_index_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(13764);
66468
- /* harmony import */ var _resolver_apidom_reference_dereference_strategies_openapi_3_2_swagger_client_index_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(12315);
66366
+ /* harmony import */ var _helpers_index_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(55971);
66367
+ /* harmony import */ var _helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(50918);
66368
+ /* harmony import */ var _resolver_apidom_reference_resolve_resolvers_http_swagger_client_index_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(636);
66369
+ /* harmony import */ var _resolver_apidom_reference_parse_parsers_json_index_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(92263);
66370
+ /* harmony import */ var _resolver_apidom_reference_parse_parsers_yaml_1_2_index_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(12787);
66371
+ /* harmony import */ var _resolver_apidom_reference_parse_parsers_openapi_json_3_1_index_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(89742);
66372
+ /* harmony import */ var _resolver_apidom_reference_parse_parsers_openapi_yaml_3_1_index_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(49575);
66373
+ /* harmony import */ var _resolver_apidom_reference_parse_parsers_openapi_json_3_2_index_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(90643);
66374
+ /* harmony import */ var _resolver_apidom_reference_parse_parsers_openapi_yaml_3_2_index_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(93282);
66375
+ /* harmony import */ var _resolver_apidom_reference_dereference_strategies_openapi_3_1_swagger_client_index_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(13764);
66376
+ /* harmony import */ var _resolver_apidom_reference_dereference_strategies_openapi_3_2_swagger_client_index_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(12315);
66469
66377
  /* eslint-disable camelcase */
66470
66378
 
66471
66379
 
@@ -66512,29 +66420,29 @@ Swagger.clearCache = _resolver_strategies_openapi_2_index_js__WEBPACK_IMPORTED_M
66512
66420
  Swagger.makeApisTagOperation = _interfaces_js__WEBPACK_IMPORTED_MODULE_10__.makeApisTagOperation;
66513
66421
  Swagger.buildRequest = _execute_index_js__WEBPACK_IMPORTED_MODULE_11__.buildRequest;
66514
66422
  Swagger.helpers = {
66515
- opId: _helpers_index_js__WEBPACK_IMPORTED_MODULE_12__["default"]
66423
+ opId: _helpers_index_js__WEBPACK_IMPORTED_MODULE_12__.opId
66516
66424
  };
66517
66425
  Swagger.getBaseUrl = _execute_index_js__WEBPACK_IMPORTED_MODULE_11__.baseUrl;
66518
66426
  Swagger.apidom = {
66519
66427
  resolve: {
66520
66428
  resolvers: {
66521
- HTTPResolverSwaggerClient: _resolver_apidom_reference_resolve_resolvers_http_swagger_client_index_js__WEBPACK_IMPORTED_MODULE_15__["default"]
66429
+ HTTPResolverSwaggerClient: _resolver_apidom_reference_resolve_resolvers_http_swagger_client_index_js__WEBPACK_IMPORTED_MODULE_14__["default"]
66522
66430
  }
66523
66431
  },
66524
66432
  parse: {
66525
66433
  parsers: {
66526
- JsonParser: _resolver_apidom_reference_parse_parsers_json_index_js__WEBPACK_IMPORTED_MODULE_16__["default"],
66527
- YamlParser: _resolver_apidom_reference_parse_parsers_yaml_1_2_index_js__WEBPACK_IMPORTED_MODULE_17__["default"],
66528
- OpenApiJson3_1Parser: _resolver_apidom_reference_parse_parsers_openapi_json_3_1_index_js__WEBPACK_IMPORTED_MODULE_18__["default"],
66529
- OpenApiYaml3_1Parser: _resolver_apidom_reference_parse_parsers_openapi_yaml_3_1_index_js__WEBPACK_IMPORTED_MODULE_19__["default"],
66530
- OpenApiJson3_2Parser: _resolver_apidom_reference_parse_parsers_openapi_json_3_2_index_js__WEBPACK_IMPORTED_MODULE_20__["default"],
66531
- OpenApiYaml3_2Parser: _resolver_apidom_reference_parse_parsers_openapi_yaml_3_2_index_js__WEBPACK_IMPORTED_MODULE_21__["default"]
66434
+ JsonParser: _resolver_apidom_reference_parse_parsers_json_index_js__WEBPACK_IMPORTED_MODULE_15__["default"],
66435
+ YamlParser: _resolver_apidom_reference_parse_parsers_yaml_1_2_index_js__WEBPACK_IMPORTED_MODULE_16__["default"],
66436
+ OpenApiJson3_1Parser: _resolver_apidom_reference_parse_parsers_openapi_json_3_1_index_js__WEBPACK_IMPORTED_MODULE_17__["default"],
66437
+ OpenApiYaml3_1Parser: _resolver_apidom_reference_parse_parsers_openapi_yaml_3_1_index_js__WEBPACK_IMPORTED_MODULE_18__["default"],
66438
+ OpenApiJson3_2Parser: _resolver_apidom_reference_parse_parsers_openapi_json_3_2_index_js__WEBPACK_IMPORTED_MODULE_19__["default"],
66439
+ OpenApiYaml3_2Parser: _resolver_apidom_reference_parse_parsers_openapi_yaml_3_2_index_js__WEBPACK_IMPORTED_MODULE_20__["default"]
66532
66440
  }
66533
66441
  },
66534
66442
  dereference: {
66535
66443
  strategies: {
66536
- OpenApi3_1SwaggerClientDereferenceStrategy: _resolver_apidom_reference_dereference_strategies_openapi_3_1_swagger_client_index_js__WEBPACK_IMPORTED_MODULE_22__["default"],
66537
- OpenApi3_2SwaggerClientDereferenceStrategy: _resolver_apidom_reference_dereference_strategies_openapi_3_2_swagger_client_index_js__WEBPACK_IMPORTED_MODULE_23__["default"]
66444
+ OpenApi3_1SwaggerClientDereferenceStrategy: _resolver_apidom_reference_dereference_strategies_openapi_3_1_swagger_client_index_js__WEBPACK_IMPORTED_MODULE_21__["default"],
66445
+ OpenApi3_2SwaggerClientDereferenceStrategy: _resolver_apidom_reference_dereference_strategies_openapi_3_2_swagger_client_index_js__WEBPACK_IMPORTED_MODULE_22__["default"]
66538
66446
  }
66539
66447
  }
66540
66448
  };
@@ -66601,7 +66509,7 @@ Swagger.prototype.applyDefaults = function applyDefaults() {
66601
66509
  spec
66602
66510
  } = this;
66603
66511
  const specUrl = this.url;
66604
- if ((0,_helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_14__.isOpenAPI2)(spec) && (0,_helpers_index_js__WEBPACK_IMPORTED_MODULE_13__["default"])(specUrl)) {
66512
+ if ((0,_helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_13__.isOpenAPI2)(spec) && (0,_helpers_index_js__WEBPACK_IMPORTED_MODULE_12__.isHttpUrl)(specUrl)) {
66605
66513
  const parsed = new URL(specUrl);
66606
66514
  if (!spec.host) {
66607
66515
  spec.host = parsed.host;
@@ -66612,7 +66520,7 @@ Swagger.prototype.applyDefaults = function applyDefaults() {
66612
66520
  if (!spec.basePath) {
66613
66521
  spec.basePath = '/';
66614
66522
  }
66615
- } else if ((0,_helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_14__.isOpenAPI3)(spec)) {
66523
+ } else if ((0,_helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_13__.isOpenAPI3)(spec)) {
66616
66524
  const isEmptyServerList = Array.isArray(spec.servers) && spec.servers.length === 0;
66617
66525
  if (!spec.servers || isEmptyServerList) {
66618
66526
  spec.servers = [_constants_js__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_OPENAPI_3_SERVER];