@shopware/api-gen 1.3.2 → 1.4.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.
@@ -20,6 +20,8 @@ import __cjs_mod__ from 'module';
20
20
  const __filename = __cjs_url__.fileURLToPath(import.meta.url);
21
21
  const __dirname = __cjs_path__.dirname(__filename);
22
22
  const require = __cjs_mod__.createRequire(import.meta.url);
23
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
24
+
23
25
  function getDefaultExportFromCjs$2 (x) {
24
26
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
25
27
  }
@@ -52,7 +54,7 @@ function getAugmentedNamespace(n) {
52
54
  var main$1 = {exports: {}};
53
55
 
54
56
  const name = "dotenv";
55
- const version$1 = "16.5.0";
57
+ const version$1 = "17.2.3";
56
58
  const description = "Loads environment variables from .env file";
57
59
  const main = "lib/main.js";
58
60
  const types = "lib/main.d.ts";
@@ -74,8 +76,8 @@ const scripts = {
74
76
  "dts-check": "tsc --project tests/types/tsconfig.json",
75
77
  lint: "standard",
76
78
  pretest: "npm run lint && npm run dts-check",
77
- test: "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
78
- "test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",
79
+ test: "tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000",
80
+ "test:coverage": "tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
79
81
  prerelease: "npm test",
80
82
  release: "standard-version"
81
83
  };
@@ -161,6 +163,46 @@ const packageJson = require$$4;
161
163
 
162
164
  const version = packageJson.version;
163
165
 
166
+ // Array of tips to display randomly
167
+ const TIPS = [
168
+ '🔐 encrypt with Dotenvx: https://dotenvx.com',
169
+ '🔐 prevent committing .env to code: https://dotenvx.com/precommit',
170
+ '🔐 prevent building .env in docker: https://dotenvx.com/prebuild',
171
+ '📡 add observability to secrets: https://dotenvx.com/ops',
172
+ '👥 sync secrets across teammates & machines: https://dotenvx.com/ops',
173
+ '🗂️ backup and recover secrets: https://dotenvx.com/ops',
174
+ '✅ audit secrets and track compliance: https://dotenvx.com/ops',
175
+ '🔄 add secrets lifecycle management: https://dotenvx.com/ops',
176
+ '🔑 add access controls to secrets: https://dotenvx.com/ops',
177
+ '🛠️ run anywhere with `dotenvx run -- yourcommand`',
178
+ '⚙️ specify custom .env file path with { path: \'/custom/path/.env\' }',
179
+ '⚙️ enable debug logging with { debug: true }',
180
+ '⚙️ override existing env vars with { override: true }',
181
+ '⚙️ suppress all logs with { quiet: true }',
182
+ '⚙️ write to custom object with { processEnv: myObject }',
183
+ '⚙️ load multiple .env files with { path: [\'.env.local\', \'.env\'] }'
184
+ ];
185
+
186
+ // Get a random tip from the tips array
187
+ function _getRandomTip () {
188
+ return TIPS[Math.floor(Math.random() * TIPS.length)]
189
+ }
190
+
191
+ function parseBoolean (value) {
192
+ if (typeof value === 'string') {
193
+ return !['false', '0', 'no', 'off', ''].includes(value.toLowerCase())
194
+ }
195
+ return Boolean(value)
196
+ }
197
+
198
+ function supportsAnsi () {
199
+ return process.stdout.isTTY // && process.env.TERM !== 'dumb'
200
+ }
201
+
202
+ function dim (text) {
203
+ return supportsAnsi() ? `\x1b[2m${text}\x1b[0m` : text
204
+ }
205
+
164
206
  const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
165
207
 
166
208
  // Parse src into an Object
@@ -203,10 +245,11 @@ function parse$1 (src) {
203
245
  }
204
246
 
205
247
  function _parseVault (options) {
206
- const vaultPath = _vaultPath(options);
248
+ options = options || {};
207
249
 
208
- // Parse .env.vault
209
- const result = DotenvModule.configDotenv({ path: vaultPath });
250
+ const vaultPath = _vaultPath(options);
251
+ options.path = vaultPath; // parse .env.vault
252
+ const result = DotenvModule.configDotenv(options);
210
253
  if (!result.parsed) {
211
254
  const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
212
255
  err.code = 'MISSING_DATA';
@@ -245,13 +288,17 @@ function _parseVault (options) {
245
288
  }
246
289
 
247
290
  function _warn (message) {
248
- console.log(`[dotenv@${version}][WARN] ${message}`);
291
+ console.error(`[dotenv@${version}][WARN] ${message}`);
249
292
  }
250
293
 
251
294
  function _debug (message) {
252
295
  console.log(`[dotenv@${version}][DEBUG] ${message}`);
253
296
  }
254
297
 
298
+ function _log (message) {
299
+ console.log(`[dotenv@${version}] ${message}`);
300
+ }
301
+
255
302
  function _dotenvKey (options) {
256
303
  // prioritize developer directly setting options.DOTENV_KEY
257
304
  if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
@@ -339,9 +386,11 @@ function _resolveHome (envPath) {
339
386
  }
340
387
 
341
388
  function _configVault (options) {
342
- const debug = Boolean(options && options.debug);
343
- if (debug) {
344
- _debug('Loading env from encrypted .env.vault');
389
+ const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || (options && options.debug));
390
+ const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || (options && options.quiet));
391
+
392
+ if (debug || !quiet) {
393
+ _log('Loading env from encrypted .env.vault');
345
394
  }
346
395
 
347
396
  const parsed = DotenvModule._parseVault(options);
@@ -359,7 +408,12 @@ function _configVault (options) {
359
408
  function configDotenv (options) {
360
409
  const dotenvPath = path.resolve(process.cwd(), '.env');
361
410
  let encoding = 'utf8';
362
- const debug = Boolean(options && options.debug);
411
+ let processEnv = process.env;
412
+ if (options && options.processEnv != null) {
413
+ processEnv = options.processEnv;
414
+ }
415
+ let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || (options && options.debug));
416
+ let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || (options && options.quiet));
363
417
 
364
418
  if (options && options.encoding) {
365
419
  encoding = options.encoding;
@@ -399,12 +453,29 @@ function configDotenv (options) {
399
453
  }
400
454
  }
401
455
 
402
- let processEnv = process.env;
403
- if (options && options.processEnv != null) {
404
- processEnv = options.processEnv;
405
- }
456
+ const populated = DotenvModule.populate(processEnv, parsedAll, options);
406
457
 
407
- DotenvModule.populate(processEnv, parsedAll, options);
458
+ // handle user settings DOTENV_CONFIG_ options inside .env file(s)
459
+ debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug);
460
+ quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
461
+
462
+ if (debug || !quiet) {
463
+ const keysCount = Object.keys(populated).length;
464
+ const shortPaths = [];
465
+ for (const filePath of optionPaths) {
466
+ try {
467
+ const relative = path.relative(process.cwd(), filePath);
468
+ shortPaths.push(relative);
469
+ } catch (e) {
470
+ if (debug) {
471
+ _debug(`Failed to load ${filePath} ${e.message}`);
472
+ }
473
+ lastError = e;
474
+ }
475
+ }
476
+
477
+ _log(`injecting env (${keysCount}) from ${shortPaths.join(',')} ${dim(`-- tip: ${_getRandomTip()}`)}`);
478
+ }
408
479
 
409
480
  if (lastError) {
410
481
  return { parsed: parsedAll, error: lastError }
@@ -467,6 +538,7 @@ function decrypt (encrypted, keyStr) {
467
538
  function populate (processEnv, parsed, options = {}) {
468
539
  const debug = Boolean(options && options.debug);
469
540
  const override = Boolean(options && options.override);
541
+ const populated = {};
470
542
 
471
543
  if (typeof parsed !== 'object') {
472
544
  const err = new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate');
@@ -479,6 +551,7 @@ function populate (processEnv, parsed, options = {}) {
479
551
  if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
480
552
  if (override === true) {
481
553
  processEnv[key] = parsed[key];
554
+ populated[key] = parsed[key];
482
555
  }
483
556
 
484
557
  if (debug) {
@@ -490,8 +563,11 @@ function populate (processEnv, parsed, options = {}) {
490
563
  }
491
564
  } else {
492
565
  processEnv[key] = parsed[key];
566
+ populated[key] = parsed[key];
493
567
  }
494
568
  }
569
+
570
+ return populated
495
571
  }
496
572
 
497
573
  const DotenvModule = {
@@ -527,6 +603,10 @@ if (process.env.DOTENV_CONFIG_PATH != null) {
527
603
  options.path = process.env.DOTENV_CONFIG_PATH;
528
604
  }
529
605
 
606
+ if (process.env.DOTENV_CONFIG_QUIET != null) {
607
+ options.quiet = process.env.DOTENV_CONFIG_QUIET;
608
+ }
609
+
530
610
  if (process.env.DOTENV_CONFIG_DEBUG != null) {
531
611
  options.debug = process.env.DOTENV_CONFIG_DEBUG;
532
612
  }
@@ -541,16 +621,22 @@ if (process.env.DOTENV_CONFIG_DOTENV_KEY != null) {
541
621
 
542
622
  var envOptions = options;
543
623
 
544
- const re = /^dotenv_config_(encoding|path|debug|override|DOTENV_KEY)=(.+)$/;
624
+ const re = /^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;
545
625
 
546
626
  var cliOptions = function optionMatcher (args) {
547
- return args.reduce(function (acc, cur) {
627
+ const options = args.reduce(function (acc, cur) {
548
628
  const matches = cur.match(re);
549
629
  if (matches) {
550
630
  acc[matches[1]] = matches[2];
551
631
  }
552
632
  return acc
553
- }, {})
633
+ }, {});
634
+
635
+ if (!('quiet' in options)) {
636
+ options.quiet = 'true';
637
+ }
638
+
639
+ return options
554
640
  };
555
641
 
556
642
  (function () {
@@ -2069,7 +2155,7 @@ picocolors.exports.createColors = createColors;
2069
2155
  var picocolorsExports = picocolors.exports;
2070
2156
  const c = /*@__PURE__*/getDefaultExportFromCjs$2(picocolorsExports);
2071
2157
 
2072
- function isPlainObject(value) {
2158
+ function isPlainObject$1(value) {
2073
2159
  if (value === null || typeof value !== "object") {
2074
2160
  return false;
2075
2161
  }
@@ -2087,7 +2173,7 @@ function isPlainObject(value) {
2087
2173
  }
2088
2174
 
2089
2175
  function _defu(baseObject, defaults, namespace = ".", merger) {
2090
- if (!isPlainObject(defaults)) {
2176
+ if (!isPlainObject$1(defaults)) {
2091
2177
  return _defu(baseObject, {}, namespace, merger);
2092
2178
  }
2093
2179
  const object = Object.assign({}, defaults);
@@ -2104,7 +2190,7 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
2104
2190
  }
2105
2191
  if (Array.isArray(value) && Array.isArray(object[key])) {
2106
2192
  object[key] = [...value, ...object[key]];
2107
- } else if (isPlainObject(value) && isPlainObject(object[key])) {
2193
+ } else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
2108
2194
  object[key] = _defu(
2109
2195
  value,
2110
2196
  object[key],
@@ -3589,24 +3675,6 @@ const plugins = {
3589
3675
  Error: ErrorPlugin
3590
3676
  };
3591
3677
 
3592
- let getPromiseValue$1 = () => 'Promise{…}';
3593
- try {
3594
- // @ts-ignore
3595
- const { getPromiseDetails, kPending, kRejected } = process.binding('util');
3596
- if (Array.isArray(getPromiseDetails(Promise.resolve()))) {
3597
- getPromiseValue$1 = (value, options) => {
3598
- const [state, innerValue] = getPromiseDetails(value);
3599
- if (state === kPending) {
3600
- return 'Promise{<pending>}';
3601
- }
3602
- return `Promise${state === kRejected ? '!' : ''}{${options.inspect(innerValue, options)}}`;
3603
- };
3604
- }
3605
- }
3606
- catch (notNode) {
3607
- /* ignore */
3608
- }
3609
-
3610
3678
  function getDefaultExportFromCjs (x) {
3611
3679
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
3612
3680
  }
@@ -5131,7 +5199,7 @@ __name(getMessage, "getMessage");
5131
5199
 
5132
5200
  // lib/chai/utils/flag.js
5133
5201
  function flag(obj, key, value) {
5134
- var flags = obj.__flags || (obj.__flags = /* @__PURE__ */ Object.create(null));
5202
+ let flags = obj.__flags || (obj.__flags = /* @__PURE__ */ Object.create(null));
5135
5203
  if (arguments.length === 3) {
5136
5204
  flags[key] = value;
5137
5205
  } else {
@@ -5142,7 +5210,7 @@ __name(flag, "flag");
5142
5210
 
5143
5211
  // lib/chai/utils/test.js
5144
5212
  function test(obj, args) {
5145
- var negate = flag(obj, "negate"), expr = args[0];
5213
+ let negate = flag(obj, "negate"), expr = args[0];
5146
5214
  return negate ? !expr : expr;
5147
5215
  }
5148
5216
  __name(test, "test");
@@ -5202,20 +5270,20 @@ var AssertionError = class _AssertionError extends Error {
5202
5270
 
5203
5271
  // lib/chai/utils/expectTypes.js
5204
5272
  function expectTypes(obj, types) {
5205
- var flagMsg = flag(obj, "message");
5206
- var ssfi = flag(obj, "ssfi");
5273
+ let flagMsg = flag(obj, "message");
5274
+ let ssfi = flag(obj, "ssfi");
5207
5275
  flagMsg = flagMsg ? flagMsg + ": " : "";
5208
5276
  obj = flag(obj, "object");
5209
5277
  types = types.map(function(t) {
5210
5278
  return t.toLowerCase();
5211
5279
  });
5212
5280
  types.sort();
5213
- var str = types.map(function(t, index) {
5214
- var art = ~["a", "e", "i", "o", "u"].indexOf(t.charAt(0)) ? "an" : "a";
5215
- var or = types.length > 1 && index === types.length - 1 ? "or " : "";
5281
+ let str = types.map(function(t, index) {
5282
+ let art = ~["a", "e", "i", "o", "u"].indexOf(t.charAt(0)) ? "an" : "a";
5283
+ let or = types.length > 1 && index === types.length - 1 ? "or " : "";
5216
5284
  return or + art + " " + t;
5217
5285
  }).join(", ");
5218
- var objType = type(obj).toLowerCase();
5286
+ let objType = type(obj).toLowerCase();
5219
5287
  if (!types.some(function(expected) {
5220
5288
  return objType === expected;
5221
5289
  })) {
@@ -5734,10 +5802,10 @@ try {
5734
5802
  var constructorMap = /* @__PURE__ */ new WeakMap();
5735
5803
  var stringTagMap = {};
5736
5804
  var baseTypesMap = {
5737
- undefined: (value, options) => options.stylize("undefined", "undefined"),
5738
- null: (value, options) => options.stylize("null", "null"),
5739
- boolean: (value, options) => options.stylize(String(value), "boolean"),
5740
- Boolean: (value, options) => options.stylize(String(value), "boolean"),
5805
+ undefined: /* @__PURE__ */ __name((value, options) => options.stylize("undefined", "undefined"), "undefined"),
5806
+ null: /* @__PURE__ */ __name((value, options) => options.stylize("null", "null"), "null"),
5807
+ boolean: /* @__PURE__ */ __name((value, options) => options.stylize(String(value), "boolean"), "boolean"),
5808
+ Boolean: /* @__PURE__ */ __name((value, options) => options.stylize(String(value), "boolean"), "Boolean"),
5741
5809
  number: inspectNumber,
5742
5810
  Number: inspectNumber,
5743
5811
  bigint: inspectBigInt,
@@ -5756,8 +5824,8 @@ var baseTypesMap = {
5756
5824
  RegExp: inspectRegExp,
5757
5825
  Promise: promise_default,
5758
5826
  // WeakSet, WeakMap are totally opaque to us
5759
- WeakSet: (value, options) => options.stylize("WeakSet{\u2026}", "special"),
5760
- WeakMap: (value, options) => options.stylize("WeakMap{\u2026}", "special"),
5827
+ WeakSet: /* @__PURE__ */ __name((value, options) => options.stylize("WeakSet{\u2026}", "special"), "WeakSet"),
5828
+ WeakMap: /* @__PURE__ */ __name((value, options) => options.stylize("WeakMap{\u2026}", "special"), "WeakMap"),
5761
5829
  Arguments: inspectArguments,
5762
5830
  Int8Array: inspectTypedArray,
5763
5831
  Uint8Array: inspectTypedArray,
@@ -5768,9 +5836,9 @@ var baseTypesMap = {
5768
5836
  Uint32Array: inspectTypedArray,
5769
5837
  Float32Array: inspectTypedArray,
5770
5838
  Float64Array: inspectTypedArray,
5771
- Generator: () => "",
5772
- DataView: () => "",
5773
- ArrayBuffer: () => "",
5839
+ Generator: /* @__PURE__ */ __name(() => "", "Generator"),
5840
+ DataView: /* @__PURE__ */ __name(() => "", "DataView"),
5841
+ ArrayBuffer: /* @__PURE__ */ __name(() => "", "ArrayBuffer"),
5774
5842
  Error: inspectObject2,
5775
5843
  HTMLCollection: inspectHTMLCollection,
5776
5844
  NodeList: inspectHTMLCollection
@@ -5943,7 +6011,7 @@ var config = {
5943
6011
 
5944
6012
  // lib/chai/utils/inspect.js
5945
6013
  function inspect2(obj, showHidden, depth, colors) {
5946
- var options = {
6014
+ let options = {
5947
6015
  colors,
5948
6016
  depth: typeof depth === "undefined" ? 2 : depth,
5949
6017
  showHidden,
@@ -5955,14 +6023,14 @@ __name(inspect2, "inspect");
5955
6023
 
5956
6024
  // lib/chai/utils/objDisplay.js
5957
6025
  function objDisplay(obj) {
5958
- var str = inspect2(obj), type3 = Object.prototype.toString.call(obj);
6026
+ let str = inspect2(obj), type3 = Object.prototype.toString.call(obj);
5959
6027
  if (config.truncateThreshold && str.length >= config.truncateThreshold) {
5960
6028
  if (type3 === "[object Function]") {
5961
6029
  return !obj.name || obj.name === "" ? "[Function]" : "[Function: " + obj.name + "]";
5962
6030
  } else if (type3 === "[object Array]") {
5963
6031
  return "[ Array(" + obj.length + ") ]";
5964
6032
  } else if (type3 === "[object Object]") {
5965
- var keys = Object.keys(obj), kstr = keys.length > 2 ? keys.splice(0, 2).join(", ") + ", ..." : keys.join(", ");
6033
+ let keys = Object.keys(obj), kstr = keys.length > 2 ? keys.splice(0, 2).join(", ") + ", ..." : keys.join(", ");
5966
6034
  return "{ Object (" + kstr + ") }";
5967
6035
  } else {
5968
6036
  return str;
@@ -5975,9 +6043,13 @@ __name(objDisplay, "objDisplay");
5975
6043
 
5976
6044
  // lib/chai/utils/getMessage.js
5977
6045
  function getMessage2(obj, args) {
5978
- var negate = flag(obj, "negate"), val = flag(obj, "object"), expected = args[3], actual = getActual(obj, args), msg = negate ? args[2] : args[1], flagMsg = flag(obj, "message");
5979
- if (typeof msg === "function")
5980
- msg = msg();
6046
+ let negate = flag(obj, "negate");
6047
+ let val = flag(obj, "object");
6048
+ let expected = args[3];
6049
+ let actual = getActual(obj, args);
6050
+ let msg = negate ? args[2] : args[1];
6051
+ let flagMsg = flag(obj, "message");
6052
+ if (typeof msg === "function") msg = msg();
5981
6053
  msg = msg || "";
5982
6054
  msg = msg.replace(/#\{this\}/g, function() {
5983
6055
  return objDisplay(val);
@@ -5992,12 +6064,12 @@ __name(getMessage2, "getMessage");
5992
6064
 
5993
6065
  // lib/chai/utils/transferFlags.js
5994
6066
  function transferFlags(assertion, object, includeAll) {
5995
- var flags = assertion.__flags || (assertion.__flags = /* @__PURE__ */ Object.create(null));
6067
+ let flags = assertion.__flags || (assertion.__flags = /* @__PURE__ */ Object.create(null));
5996
6068
  if (!object.__flags) {
5997
6069
  object.__flags = /* @__PURE__ */ Object.create(null);
5998
6070
  }
5999
6071
  includeAll = arguments.length === 3 ? includeAll : true;
6000
- for (var flag3 in flags) {
6072
+ for (let flag3 in flags) {
6001
6073
  if (includeAll || flag3 !== "object" && flag3 !== "ssfi" && flag3 !== "lockSsfi" && flag3 != "message") {
6002
6074
  object.__flags[flag3] = flags[flag3];
6003
6075
  }
@@ -6391,96 +6463,183 @@ function getPathInfo(obj, path) {
6391
6463
  __name(getPathInfo, "getPathInfo");
6392
6464
 
6393
6465
  // lib/chai/assertion.js
6394
- function Assertion(obj, msg, ssfi, lockSsfi) {
6395
- flag(this, "ssfi", ssfi || Assertion);
6396
- flag(this, "lockSsfi", lockSsfi);
6397
- flag(this, "object", obj);
6398
- flag(this, "message", msg);
6399
- flag(this, "eql", config.deepEqual || deep_eql_default);
6400
- return proxify(this);
6401
- }
6402
- __name(Assertion, "Assertion");
6403
- Object.defineProperty(Assertion, "includeStack", {
6404
- get: function() {
6466
+ var Assertion = class _Assertion {
6467
+ static {
6468
+ __name(this, "Assertion");
6469
+ }
6470
+ /** @type {{}} */
6471
+ __flags = {};
6472
+ /**
6473
+ * Creates object for chaining.
6474
+ * `Assertion` objects contain metadata in the form of flags. Three flags can
6475
+ * be assigned during instantiation by passing arguments to this constructor:
6476
+ *
6477
+ * - `object`: This flag contains the target of the assertion. For example, in
6478
+ * the assertion `expect(numKittens).to.equal(7);`, the `object` flag will
6479
+ * contain `numKittens` so that the `equal` assertion can reference it when
6480
+ * needed.
6481
+ *
6482
+ * - `message`: This flag contains an optional custom error message to be
6483
+ * prepended to the error message that's generated by the assertion when it
6484
+ * fails.
6485
+ *
6486
+ * - `ssfi`: This flag stands for "start stack function indicator". It
6487
+ * contains a function reference that serves as the starting point for
6488
+ * removing frames from the stack trace of the error that's created by the
6489
+ * assertion when it fails. The goal is to provide a cleaner stack trace to
6490
+ * end users by removing Chai's internal functions. Note that it only works
6491
+ * in environments that support `Error.captureStackTrace`, and only when
6492
+ * `Chai.config.includeStack` hasn't been set to `false`.
6493
+ *
6494
+ * - `lockSsfi`: This flag controls whether or not the given `ssfi` flag
6495
+ * should retain its current value, even as assertions are chained off of
6496
+ * this object. This is usually set to `true` when creating a new assertion
6497
+ * from within another assertion. It's also temporarily set to `true` before
6498
+ * an overwritten assertion gets called by the overwriting assertion.
6499
+ *
6500
+ * - `eql`: This flag contains the deepEqual function to be used by the assertion.
6501
+ *
6502
+ * @param {unknown} obj target of the assertion
6503
+ * @param {string} [msg] (optional) custom error message
6504
+ * @param {Function} [ssfi] (optional) starting point for removing stack frames
6505
+ * @param {boolean} [lockSsfi] (optional) whether or not the ssfi flag is locked
6506
+ */
6507
+ constructor(obj, msg, ssfi, lockSsfi) {
6508
+ flag(this, "ssfi", ssfi || _Assertion);
6509
+ flag(this, "lockSsfi", lockSsfi);
6510
+ flag(this, "object", obj);
6511
+ flag(this, "message", msg);
6512
+ flag(this, "eql", config.deepEqual || deep_eql_default);
6513
+ return proxify(this);
6514
+ }
6515
+ /** @returns {boolean} */
6516
+ static get includeStack() {
6405
6517
  console.warn(
6406
6518
  "Assertion.includeStack is deprecated, use chai.config.includeStack instead."
6407
6519
  );
6408
6520
  return config.includeStack;
6409
- },
6410
- set: function(value) {
6521
+ }
6522
+ /** @param {boolean} value */
6523
+ static set includeStack(value) {
6411
6524
  console.warn(
6412
6525
  "Assertion.includeStack is deprecated, use chai.config.includeStack instead."
6413
6526
  );
6414
6527
  config.includeStack = value;
6415
6528
  }
6416
- });
6417
- Object.defineProperty(Assertion, "showDiff", {
6418
- get: function() {
6529
+ /** @returns {boolean} */
6530
+ static get showDiff() {
6419
6531
  console.warn(
6420
6532
  "Assertion.showDiff is deprecated, use chai.config.showDiff instead."
6421
6533
  );
6422
6534
  return config.showDiff;
6423
- },
6424
- set: function(value) {
6535
+ }
6536
+ /** @param {boolean} value */
6537
+ static set showDiff(value) {
6425
6538
  console.warn(
6426
6539
  "Assertion.showDiff is deprecated, use chai.config.showDiff instead."
6427
6540
  );
6428
6541
  config.showDiff = value;
6429
6542
  }
6430
- });
6431
- Assertion.addProperty = function(name, fn) {
6432
- addProperty(this.prototype, name, fn);
6433
- };
6434
- Assertion.addMethod = function(name, fn) {
6435
- addMethod(this.prototype, name, fn);
6436
- };
6437
- Assertion.addChainableMethod = function(name, fn, chainingBehavior) {
6438
- addChainableMethod(this.prototype, name, fn, chainingBehavior);
6439
- };
6440
- Assertion.overwriteProperty = function(name, fn) {
6441
- overwriteProperty(this.prototype, name, fn);
6442
- };
6443
- Assertion.overwriteMethod = function(name, fn) {
6444
- overwriteMethod(this.prototype, name, fn);
6445
- };
6446
- Assertion.overwriteChainableMethod = function(name, fn, chainingBehavior) {
6447
- overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
6448
- };
6449
- Assertion.prototype.assert = function(expr, msg, negateMsg, expected, _actual, showDiff) {
6450
- var ok = test(this, arguments);
6451
- if (false !== showDiff)
6452
- showDiff = true;
6453
- if (void 0 === expected && void 0 === _actual)
6454
- showDiff = false;
6455
- if (true !== config.showDiff)
6456
- showDiff = false;
6457
- if (!ok) {
6458
- msg = getMessage2(this, arguments);
6459
- var actual = getActual(this, arguments);
6460
- var assertionErrorObjectProperties = {
6461
- actual,
6462
- expected,
6463
- showDiff
6464
- };
6465
- var operator = getOperator(this, arguments);
6466
- if (operator) {
6467
- assertionErrorObjectProperties.operator = operator;
6543
+ /**
6544
+ * @param {string} name
6545
+ * @param {Function} fn
6546
+ */
6547
+ static addProperty(name, fn) {
6548
+ addProperty(this.prototype, name, fn);
6549
+ }
6550
+ /**
6551
+ * @param {string} name
6552
+ * @param {Function} fn
6553
+ */
6554
+ static addMethod(name, fn) {
6555
+ addMethod(this.prototype, name, fn);
6556
+ }
6557
+ /**
6558
+ * @param {string} name
6559
+ * @param {Function} fn
6560
+ * @param {Function} chainingBehavior
6561
+ */
6562
+ static addChainableMethod(name, fn, chainingBehavior) {
6563
+ addChainableMethod(this.prototype, name, fn, chainingBehavior);
6564
+ }
6565
+ /**
6566
+ * @param {string} name
6567
+ * @param {Function} fn
6568
+ */
6569
+ static overwriteProperty(name, fn) {
6570
+ overwriteProperty(this.prototype, name, fn);
6571
+ }
6572
+ /**
6573
+ * @param {string} name
6574
+ * @param {Function} fn
6575
+ */
6576
+ static overwriteMethod(name, fn) {
6577
+ overwriteMethod(this.prototype, name, fn);
6578
+ }
6579
+ /**
6580
+ * @param {string} name
6581
+ * @param {Function} fn
6582
+ * @param {Function} chainingBehavior
6583
+ */
6584
+ static overwriteChainableMethod(name, fn, chainingBehavior) {
6585
+ overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
6586
+ }
6587
+ /**
6588
+ * ### .assert(expression, message, negateMessage, expected, actual, showDiff)
6589
+ *
6590
+ * Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass.
6591
+ *
6592
+ * @name assert
6593
+ * @param {unknown} _expr to be tested
6594
+ * @param {string | Function} msg or function that returns message to display if expression fails
6595
+ * @param {string | Function} _negateMsg or function that returns negatedMessage to display if negated expression fails
6596
+ * @param {unknown} expected value (remember to check for negation)
6597
+ * @param {unknown} _actual (optional) will default to `this.obj`
6598
+ * @param {boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails
6599
+ * @returns {void}
6600
+ */
6601
+ assert(_expr, msg, _negateMsg, expected, _actual, showDiff) {
6602
+ const ok = test(this, arguments);
6603
+ if (false !== showDiff) showDiff = true;
6604
+ if (void 0 === expected && void 0 === _actual) showDiff = false;
6605
+ if (true !== config.showDiff) showDiff = false;
6606
+ if (!ok) {
6607
+ msg = getMessage2(this, arguments);
6608
+ const actual = getActual(this, arguments);
6609
+ const assertionErrorObjectProperties = {
6610
+ actual,
6611
+ expected,
6612
+ showDiff
6613
+ };
6614
+ const operator = getOperator(this, arguments);
6615
+ if (operator) {
6616
+ assertionErrorObjectProperties.operator = operator;
6617
+ }
6618
+ throw new AssertionError(
6619
+ msg,
6620
+ assertionErrorObjectProperties,
6621
+ // @ts-expect-error Not sure what to do about these types yet
6622
+ config.includeStack ? this.assert : flag(this, "ssfi")
6623
+ );
6468
6624
  }
6469
- throw new AssertionError(
6470
- msg,
6471
- assertionErrorObjectProperties,
6472
- config.includeStack ? this.assert : flag(this, "ssfi")
6473
- );
6474
6625
  }
6475
- };
6476
- Object.defineProperty(Assertion.prototype, "_obj", {
6477
- get: function() {
6626
+ /**
6627
+ * Quick reference to stored `actual` value for plugin developers.
6628
+ *
6629
+ * @returns {unknown}
6630
+ */
6631
+ get _obj() {
6478
6632
  return flag(this, "object");
6479
- },
6480
- set: function(val) {
6633
+ }
6634
+ /**
6635
+ * Quick reference to stored `actual` value for plugin developers.
6636
+ *
6637
+ * @param {unknown} val
6638
+ */
6639
+ set _obj(val) {
6481
6640
  flag(this, "object", val);
6482
6641
  }
6483
- });
6642
+ };
6484
6643
 
6485
6644
  // lib/chai/utils/isProxyEnabled.js
6486
6645
  function isProxyEnabled() {
@@ -6497,10 +6656,9 @@ function addProperty(ctx, name, getter) {
6497
6656
  if (!isProxyEnabled() && !flag(this, "lockSsfi")) {
6498
6657
  flag(this, "ssfi", propertyGetter);
6499
6658
  }
6500
- var result = getter.call(this);
6501
- if (result !== void 0)
6502
- return result;
6503
- var newAssertion = new Assertion();
6659
+ let result = getter.call(this);
6660
+ if (result !== void 0) return result;
6661
+ let newAssertion = new Assertion();
6504
6662
  transferFlags(this, newAssertion);
6505
6663
  return newAssertion;
6506
6664
  }, "propertyGetter"),
@@ -6513,10 +6671,9 @@ __name(addProperty, "addProperty");
6513
6671
  var fnLengthDesc = Object.getOwnPropertyDescriptor(function() {
6514
6672
  }, "length");
6515
6673
  function addLengthGuard(fn, assertionName, isChainable) {
6516
- if (!fnLengthDesc.configurable)
6517
- return fn;
6674
+ if (!fnLengthDesc.configurable) return fn;
6518
6675
  Object.defineProperty(fn, "length", {
6519
- get: function() {
6676
+ get: /* @__PURE__ */ __name(function() {
6520
6677
  if (isChainable) {
6521
6678
  throw Error(
6522
6679
  "Invalid Chai property: " + assertionName + '.length. Due to a compatibility issue, "length" cannot directly follow "' + assertionName + '". Use "' + assertionName + '.lengthOf" instead.'
@@ -6525,7 +6682,7 @@ function addLengthGuard(fn, assertionName, isChainable) {
6525
6682
  throw Error(
6526
6683
  "Invalid Chai property: " + assertionName + '.length. See docs for proper usage of "' + assertionName + '".'
6527
6684
  );
6528
- }
6685
+ }, "get")
6529
6686
  });
6530
6687
  return fn;
6531
6688
  }
@@ -6533,14 +6690,14 @@ __name(addLengthGuard, "addLengthGuard");
6533
6690
 
6534
6691
  // lib/chai/utils/getProperties.js
6535
6692
  function getProperties(object) {
6536
- var result = Object.getOwnPropertyNames(object);
6693
+ let result = Object.getOwnPropertyNames(object);
6537
6694
  function addProperty2(property) {
6538
6695
  if (result.indexOf(property) === -1) {
6539
6696
  result.push(property);
6540
6697
  }
6541
6698
  }
6542
6699
  __name(addProperty2, "addProperty");
6543
- var proto = Object.getPrototypeOf(object);
6700
+ let proto = Object.getPrototypeOf(object);
6544
6701
  while (proto !== null) {
6545
6702
  Object.getOwnPropertyNames(proto).forEach(addProperty2);
6546
6703
  proto = Object.getPrototypeOf(proto);
@@ -6552,8 +6709,7 @@ __name(getProperties, "getProperties");
6552
6709
  // lib/chai/utils/proxify.js
6553
6710
  var builtins = ["__flags", "__methods", "_obj", "assert"];
6554
6711
  function proxify(obj, nonChainableMethodName) {
6555
- if (!isProxyEnabled())
6556
- return obj;
6712
+ if (!isProxyEnabled()) return obj;
6557
6713
  return new Proxy(obj, {
6558
6714
  get: /* @__PURE__ */ __name(function proxyGetter(target, property) {
6559
6715
  if (typeof property === "string" && config.proxyExcludedKeys.indexOf(property) === -1 && !Reflect.has(target, property)) {
@@ -6562,15 +6718,15 @@ function proxify(obj, nonChainableMethodName) {
6562
6718
  "Invalid Chai property: " + nonChainableMethodName + "." + property + '. See docs for proper usage of "' + nonChainableMethodName + '".'
6563
6719
  );
6564
6720
  }
6565
- var suggestion = null;
6566
- var suggestionDistance = 4;
6721
+ let suggestion = null;
6722
+ let suggestionDistance = 4;
6567
6723
  getProperties(target).forEach(function(prop) {
6568
6724
  if (
6569
6725
  // we actually mean to check `Object.prototype` here
6570
6726
  // eslint-disable-next-line no-prototype-builtins
6571
6727
  !Object.prototype.hasOwnProperty(prop) && builtins.indexOf(prop) === -1
6572
6728
  ) {
6573
- var dist = stringDistanceCapped(property, prop, suggestionDistance);
6729
+ let dist = stringDistanceCapped(property, prop, suggestionDistance);
6574
6730
  if (dist < suggestionDistance) {
6575
6731
  suggestion = prop;
6576
6732
  suggestionDistance = dist;
@@ -6597,7 +6753,7 @@ function stringDistanceCapped(strA, strB, cap) {
6597
6753
  if (Math.abs(strA.length - strB.length) >= cap) {
6598
6754
  return cap;
6599
6755
  }
6600
- var memo = [];
6756
+ let memo = [];
6601
6757
  for (let i = 0; i <= strA.length; i++) {
6602
6758
  memo[i] = Array(strB.length + 1).fill(0);
6603
6759
  memo[i][0] = i;
@@ -6606,7 +6762,7 @@ function stringDistanceCapped(strA, strB, cap) {
6606
6762
  memo[0][j] = j;
6607
6763
  }
6608
6764
  for (let i = 1; i <= strA.length; i++) {
6609
- var ch = strA.charCodeAt(i - 1);
6765
+ let ch = strA.charCodeAt(i - 1);
6610
6766
  for (let j = 1; j <= strB.length; j++) {
6611
6767
  if (Math.abs(i - j) >= cap) {
6612
6768
  memo[i][j] = cap;
@@ -6625,14 +6781,13 @@ __name(stringDistanceCapped, "stringDistanceCapped");
6625
6781
 
6626
6782
  // lib/chai/utils/addMethod.js
6627
6783
  function addMethod(ctx, name, method) {
6628
- var methodWrapper = /* @__PURE__ */ __name(function() {
6784
+ let methodWrapper = /* @__PURE__ */ __name(function() {
6629
6785
  if (!flag(this, "lockSsfi")) {
6630
6786
  flag(this, "ssfi", methodWrapper);
6631
6787
  }
6632
- var result = method.apply(this, arguments);
6633
- if (result !== void 0)
6634
- return result;
6635
- var newAssertion = new Assertion();
6788
+ let result = method.apply(this, arguments);
6789
+ if (result !== void 0) return result;
6790
+ let newAssertion = new Assertion();
6636
6791
  transferFlags(this, newAssertion);
6637
6792
  return newAssertion;
6638
6793
  }, "methodWrapper");
@@ -6643,23 +6798,22 @@ __name(addMethod, "addMethod");
6643
6798
 
6644
6799
  // lib/chai/utils/overwriteProperty.js
6645
6800
  function overwriteProperty(ctx, name, getter) {
6646
- var _get = Object.getOwnPropertyDescriptor(ctx, name), _super = /* @__PURE__ */ __name(function() {
6801
+ let _get = Object.getOwnPropertyDescriptor(ctx, name), _super = /* @__PURE__ */ __name(function() {
6647
6802
  }, "_super");
6648
- if (_get && "function" === typeof _get.get)
6649
- _super = _get.get;
6803
+ if (_get && "function" === typeof _get.get) _super = _get.get;
6650
6804
  Object.defineProperty(ctx, name, {
6651
6805
  get: /* @__PURE__ */ __name(function overwritingPropertyGetter() {
6652
6806
  if (!isProxyEnabled() && !flag(this, "lockSsfi")) {
6653
6807
  flag(this, "ssfi", overwritingPropertyGetter);
6654
6808
  }
6655
- var origLockSsfi = flag(this, "lockSsfi");
6809
+ let origLockSsfi = flag(this, "lockSsfi");
6656
6810
  flag(this, "lockSsfi", true);
6657
- var result = getter(_super).call(this);
6811
+ let result = getter(_super).call(this);
6658
6812
  flag(this, "lockSsfi", origLockSsfi);
6659
6813
  if (result !== void 0) {
6660
6814
  return result;
6661
6815
  }
6662
- var newAssertion = new Assertion();
6816
+ let newAssertion = new Assertion();
6663
6817
  transferFlags(this, newAssertion);
6664
6818
  return newAssertion;
6665
6819
  }, "overwritingPropertyGetter"),
@@ -6670,23 +6824,22 @@ __name(overwriteProperty, "overwriteProperty");
6670
6824
 
6671
6825
  // lib/chai/utils/overwriteMethod.js
6672
6826
  function overwriteMethod(ctx, name, method) {
6673
- var _method = ctx[name], _super = /* @__PURE__ */ __name(function() {
6827
+ let _method = ctx[name], _super = /* @__PURE__ */ __name(function() {
6674
6828
  throw new Error(name + " is not a function");
6675
6829
  }, "_super");
6676
- if (_method && "function" === typeof _method)
6677
- _super = _method;
6678
- var overwritingMethodWrapper = /* @__PURE__ */ __name(function() {
6830
+ if (_method && "function" === typeof _method) _super = _method;
6831
+ let overwritingMethodWrapper = /* @__PURE__ */ __name(function() {
6679
6832
  if (!flag(this, "lockSsfi")) {
6680
6833
  flag(this, "ssfi", overwritingMethodWrapper);
6681
6834
  }
6682
- var origLockSsfi = flag(this, "lockSsfi");
6835
+ let origLockSsfi = flag(this, "lockSsfi");
6683
6836
  flag(this, "lockSsfi", true);
6684
- var result = method(_super).apply(this, arguments);
6837
+ let result = method(_super).apply(this, arguments);
6685
6838
  flag(this, "lockSsfi", origLockSsfi);
6686
6839
  if (result !== void 0) {
6687
6840
  return result;
6688
6841
  }
6689
- var newAssertion = new Assertion();
6842
+ let newAssertion = new Assertion();
6690
6843
  transferFlags(this, newAssertion);
6691
6844
  return newAssertion;
6692
6845
  }, "overwritingMethodWrapper");
@@ -6700,9 +6853,8 @@ var canSetPrototype = typeof Object.setPrototypeOf === "function";
6700
6853
  var testFn = /* @__PURE__ */ __name(function() {
6701
6854
  }, "testFn");
6702
6855
  var excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) {
6703
- var propDesc = Object.getOwnPropertyDescriptor(testFn, name);
6704
- if (typeof propDesc !== "object")
6705
- return true;
6856
+ let propDesc = Object.getOwnPropertyDescriptor(testFn, name);
6857
+ if (typeof propDesc !== "object") return true;
6706
6858
  return !propDesc.configurable;
6707
6859
  });
6708
6860
  var call = Function.prototype.call;
@@ -6712,7 +6864,7 @@ function addChainableMethod(ctx, name, method, chainingBehavior) {
6712
6864
  chainingBehavior = /* @__PURE__ */ __name(function() {
6713
6865
  }, "chainingBehavior");
6714
6866
  }
6715
- var chainableBehavior = {
6867
+ let chainableBehavior = {
6716
6868
  method,
6717
6869
  chainingBehavior
6718
6870
  };
@@ -6723,31 +6875,31 @@ function addChainableMethod(ctx, name, method, chainingBehavior) {
6723
6875
  Object.defineProperty(ctx, name, {
6724
6876
  get: /* @__PURE__ */ __name(function chainableMethodGetter() {
6725
6877
  chainableBehavior.chainingBehavior.call(this);
6726
- var chainableMethodWrapper = /* @__PURE__ */ __name(function() {
6878
+ let chainableMethodWrapper = /* @__PURE__ */ __name(function() {
6727
6879
  if (!flag(this, "lockSsfi")) {
6728
6880
  flag(this, "ssfi", chainableMethodWrapper);
6729
6881
  }
6730
- var result = chainableBehavior.method.apply(this, arguments);
6882
+ let result = chainableBehavior.method.apply(this, arguments);
6731
6883
  if (result !== void 0) {
6732
6884
  return result;
6733
6885
  }
6734
- var newAssertion = new Assertion();
6886
+ let newAssertion = new Assertion();
6735
6887
  transferFlags(this, newAssertion);
6736
6888
  return newAssertion;
6737
6889
  }, "chainableMethodWrapper");
6738
6890
  addLengthGuard(chainableMethodWrapper, name, true);
6739
6891
  if (canSetPrototype) {
6740
- var prototype = Object.create(this);
6892
+ let prototype = Object.create(this);
6741
6893
  prototype.call = call;
6742
6894
  prototype.apply = apply;
6743
6895
  Object.setPrototypeOf(chainableMethodWrapper, prototype);
6744
6896
  } else {
6745
- var asserterNames = Object.getOwnPropertyNames(ctx);
6897
+ let asserterNames = Object.getOwnPropertyNames(ctx);
6746
6898
  asserterNames.forEach(function(asserterName) {
6747
6899
  if (excludeNames.indexOf(asserterName) !== -1) {
6748
6900
  return;
6749
6901
  }
6750
- var pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
6902
+ let pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
6751
6903
  Object.defineProperty(chainableMethodWrapper, asserterName, pd);
6752
6904
  });
6753
6905
  }
@@ -6761,24 +6913,24 @@ __name(addChainableMethod, "addChainableMethod");
6761
6913
 
6762
6914
  // lib/chai/utils/overwriteChainableMethod.js
6763
6915
  function overwriteChainableMethod(ctx, name, method, chainingBehavior) {
6764
- var chainableBehavior = ctx.__methods[name];
6765
- var _chainingBehavior = chainableBehavior.chainingBehavior;
6916
+ let chainableBehavior = ctx.__methods[name];
6917
+ let _chainingBehavior = chainableBehavior.chainingBehavior;
6766
6918
  chainableBehavior.chainingBehavior = /* @__PURE__ */ __name(function overwritingChainableMethodGetter() {
6767
- var result = chainingBehavior(_chainingBehavior).call(this);
6919
+ let result = chainingBehavior(_chainingBehavior).call(this);
6768
6920
  if (result !== void 0) {
6769
6921
  return result;
6770
6922
  }
6771
- var newAssertion = new Assertion();
6923
+ let newAssertion = new Assertion();
6772
6924
  transferFlags(this, newAssertion);
6773
6925
  return newAssertion;
6774
6926
  }, "overwritingChainableMethodGetter");
6775
- var _method = chainableBehavior.method;
6927
+ let _method = chainableBehavior.method;
6776
6928
  chainableBehavior.method = /* @__PURE__ */ __name(function overwritingChainableMethodWrapper() {
6777
- var result = method(_method).apply(this, arguments);
6929
+ let result = method(_method).apply(this, arguments);
6778
6930
  if (result !== void 0) {
6779
6931
  return result;
6780
6932
  }
6781
- var newAssertion = new Assertion();
6933
+ let newAssertion = new Assertion();
6782
6934
  transferFlags(this, newAssertion);
6783
6935
  return newAssertion;
6784
6936
  }, "overwritingChainableMethodWrapper");
@@ -6793,8 +6945,7 @@ __name(compareByInspect, "compareByInspect");
6793
6945
 
6794
6946
  // lib/chai/utils/getOwnEnumerablePropertySymbols.js
6795
6947
  function getOwnEnumerablePropertySymbols(obj) {
6796
- if (typeof Object.getOwnPropertySymbols !== "function")
6797
- return [];
6948
+ if (typeof Object.getOwnPropertySymbols !== "function") return [];
6798
6949
  return Object.getOwnPropertySymbols(obj).filter(function(sym) {
6799
6950
  return Object.getOwnPropertyDescriptor(obj, sym).enumerable;
6800
6951
  });
@@ -6812,21 +6963,20 @@ var isNaN2 = Number.isNaN;
6812
6963
 
6813
6964
  // lib/chai/utils/getOperator.js
6814
6965
  function isObjectType(obj) {
6815
- var objectType = type(obj);
6816
- var objectTypes = ["Array", "Object", "Function"];
6966
+ let objectType = type(obj);
6967
+ let objectTypes = ["Array", "Object", "Function"];
6817
6968
  return objectTypes.indexOf(objectType) !== -1;
6818
6969
  }
6819
6970
  __name(isObjectType, "isObjectType");
6820
6971
  function getOperator(obj, args) {
6821
- var operator = flag(obj, "operator");
6822
- var negate = flag(obj, "negate");
6823
- var expected = args[3];
6824
- var msg = negate ? args[2] : args[1];
6972
+ let operator = flag(obj, "operator");
6973
+ let negate = flag(obj, "negate");
6974
+ let expected = args[3];
6975
+ let msg = negate ? args[2] : args[1];
6825
6976
  if (operator) {
6826
6977
  return operator;
6827
6978
  }
6828
- if (typeof msg === "function")
6829
- msg = msg();
6979
+ if (typeof msg === "function") msg = msg();
6830
6980
  msg = msg || "";
6831
6981
  if (!msg) {
6832
6982
  return void 0;
@@ -6834,7 +6984,7 @@ function getOperator(obj, args) {
6834
6984
  if (/\shave\s/.test(msg)) {
6835
6985
  return void 0;
6836
6986
  }
6837
- var isObject = isObjectType(expected);
6987
+ let isObject = isObjectType(expected);
6838
6988
  if (/\snot\s/.test(msg)) {
6839
6989
  return isObject ? "notDeepStrictEqual" : "notStrictEqual";
6840
6990
  }
@@ -6914,10 +7064,9 @@ var functionTypes = {
6914
7064
  asyncgeneratorfunction: ["asyncgeneratorfunction"]
6915
7065
  };
6916
7066
  function an(type3, msg) {
6917
- if (msg)
6918
- flag2(this, "message", msg);
7067
+ if (msg) flag2(this, "message", msg);
6919
7068
  type3 = type3.toLowerCase();
6920
- var obj = flag2(this, "object"), article = ~["a", "e", "i", "o", "u"].indexOf(type3.charAt(0)) ? "an " : "a ";
7069
+ let obj = flag2(this, "object"), article = ~["a", "e", "i", "o", "u"].indexOf(type3.charAt(0)) ? "an " : "a ";
6921
7070
  const detectedType = type(obj).toLowerCase();
6922
7071
  if (functionTypes["function"].includes(type3)) {
6923
7072
  this.assert(
@@ -6945,11 +7094,10 @@ function includeChainingBehavior() {
6945
7094
  }
6946
7095
  __name(includeChainingBehavior, "includeChainingBehavior");
6947
7096
  function include(val, msg) {
6948
- if (msg)
6949
- flag2(this, "message", msg);
6950
- var obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), negate = flag2(this, "negate"), ssfi = flag2(this, "ssfi"), isDeep = flag2(this, "deep"), descriptor = isDeep ? "deep " : "", isEql = isDeep ? flag2(this, "eql") : SameValueZero;
7097
+ if (msg) flag2(this, "message", msg);
7098
+ let obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), negate = flag2(this, "negate"), ssfi = flag2(this, "ssfi"), isDeep = flag2(this, "deep"), descriptor = isDeep ? "deep " : "", isEql = isDeep ? flag2(this, "eql") : SameValueZero;
6951
7099
  flagMsg = flagMsg ? flagMsg + ": " : "";
6952
- var included = false;
7100
+ let included = false;
6953
7101
  switch (objType) {
6954
7102
  case "string":
6955
7103
  included = obj.indexOf(val) !== -1;
@@ -6987,7 +7135,7 @@ function include(val, msg) {
6987
7135
  included = obj.indexOf(val) !== -1;
6988
7136
  }
6989
7137
  break;
6990
- default:
7138
+ default: {
6991
7139
  if (val !== Object(val)) {
6992
7140
  throw new AssertionError(
6993
7141
  flagMsg + "the given combination of arguments (" + objType + " and " + type(val).toLowerCase() + ") is invalid for this assertion. You can use an array, a map, an object, a set, a string, or a weakset instead of a " + type(val).toLowerCase(),
@@ -6995,9 +7143,11 @@ function include(val, msg) {
6995
7143
  ssfi
6996
7144
  );
6997
7145
  }
6998
- var props = Object.keys(val), firstErr = null, numErrs = 0;
7146
+ let props = Object.keys(val);
7147
+ let firstErr = null;
7148
+ let numErrs = 0;
6999
7149
  props.forEach(function(prop) {
7000
- var propAssertion = new Assertion(obj);
7150
+ let propAssertion = new Assertion(obj);
7001
7151
  transferFlags(this, propAssertion, true);
7002
7152
  flag2(propAssertion, "lockSsfi", true);
7003
7153
  if (!negate || props.length === 1) {
@@ -7010,8 +7160,7 @@ function include(val, msg) {
7010
7160
  if (!check_error_exports.compatibleConstructor(err, AssertionError)) {
7011
7161
  throw err;
7012
7162
  }
7013
- if (firstErr === null)
7014
- firstErr = err;
7163
+ if (firstErr === null) firstErr = err;
7015
7164
  numErrs++;
7016
7165
  }
7017
7166
  }, this);
@@ -7019,6 +7168,7 @@ function include(val, msg) {
7019
7168
  throw firstErr;
7020
7169
  }
7021
7170
  return;
7171
+ }
7022
7172
  }
7023
7173
  this.assert(
7024
7174
  included,
@@ -7102,7 +7252,7 @@ Assertion.addProperty("NaN", function() {
7102
7252
  );
7103
7253
  });
7104
7254
  function assertExist() {
7105
- var val = flag2(this, "object");
7255
+ let val = flag2(this, "object");
7106
7256
  this.assert(
7107
7257
  val !== null && val !== void 0,
7108
7258
  "expected #{this} to exist",
@@ -7113,7 +7263,7 @@ __name(assertExist, "assertExist");
7113
7263
  Assertion.addProperty("exist", assertExist);
7114
7264
  Assertion.addProperty("exists", assertExist);
7115
7265
  Assertion.addProperty("empty", function() {
7116
- var val = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), itemsCount;
7266
+ let val = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), itemsCount;
7117
7267
  flagMsg = flagMsg ? flagMsg + ": " : "";
7118
7268
  switch (type(val).toLowerCase()) {
7119
7269
  case "array":
@@ -7131,9 +7281,10 @@ Assertion.addProperty("empty", function() {
7131
7281
  void 0,
7132
7282
  ssfi
7133
7283
  );
7134
- case "function":
7135
- var msg = flagMsg + ".empty was passed a function " + getName(val);
7284
+ case "function": {
7285
+ const msg = flagMsg + ".empty was passed a function " + getName(val);
7136
7286
  throw new AssertionError(msg.trim(), void 0, ssfi);
7287
+ }
7137
7288
  default:
7138
7289
  if (val !== Object(val)) {
7139
7290
  throw new AssertionError(
@@ -7151,7 +7302,7 @@ Assertion.addProperty("empty", function() {
7151
7302
  );
7152
7303
  });
7153
7304
  function checkArguments() {
7154
- var obj = flag2(this, "object"), type3 = type(obj);
7305
+ let obj = flag2(this, "object"), type3 = type(obj);
7155
7306
  this.assert(
7156
7307
  "Arguments" === type3,
7157
7308
  "expected #{this} to be arguments but got " + type3,
@@ -7162,11 +7313,10 @@ __name(checkArguments, "checkArguments");
7162
7313
  Assertion.addProperty("arguments", checkArguments);
7163
7314
  Assertion.addProperty("Arguments", checkArguments);
7164
7315
  function assertEqual(val, msg) {
7165
- if (msg)
7166
- flag2(this, "message", msg);
7167
- var obj = flag2(this, "object");
7316
+ if (msg) flag2(this, "message", msg);
7317
+ let obj = flag2(this, "object");
7168
7318
  if (flag2(this, "deep")) {
7169
- var prevLockSsfi = flag2(this, "lockSsfi");
7319
+ let prevLockSsfi = flag2(this, "lockSsfi");
7170
7320
  flag2(this, "lockSsfi", true);
7171
7321
  this.eql(val);
7172
7322
  flag2(this, "lockSsfi", prevLockSsfi);
@@ -7186,9 +7336,8 @@ Assertion.addMethod("equal", assertEqual);
7186
7336
  Assertion.addMethod("equals", assertEqual);
7187
7337
  Assertion.addMethod("eq", assertEqual);
7188
7338
  function assertEql(obj, msg) {
7189
- if (msg)
7190
- flag2(this, "message", msg);
7191
- var eql = flag2(this, "eql");
7339
+ if (msg) flag2(this, "message", msg);
7340
+ let eql = flag2(this, "eql");
7192
7341
  this.assert(
7193
7342
  eql(obj, flag2(this, "object")),
7194
7343
  "expected #{this} to deeply equal #{exp}",
@@ -7202,9 +7351,8 @@ __name(assertEql, "assertEql");
7202
7351
  Assertion.addMethod("eql", assertEql);
7203
7352
  Assertion.addMethod("eqls", assertEql);
7204
7353
  function assertAbove(n, msg) {
7205
- if (msg)
7206
- flag2(this, "message", msg);
7207
- var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase();
7354
+ if (msg) flag2(this, "message", msg);
7355
+ let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase();
7208
7356
  if (doLength && objType !== "map" && objType !== "set") {
7209
7357
  new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
7210
7358
  }
@@ -7221,7 +7369,7 @@ function assertAbove(n, msg) {
7221
7369
  ssfi
7222
7370
  );
7223
7371
  } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
7224
- var printObj = objType === "string" ? "'" + obj + "'" : obj;
7372
+ let printObj = objType === "string" ? "'" + obj + "'" : obj;
7225
7373
  throw new AssertionError(
7226
7374
  msgPrefix + "expected " + printObj + " to be a number or a date",
7227
7375
  void 0,
@@ -7229,7 +7377,7 @@ function assertAbove(n, msg) {
7229
7377
  );
7230
7378
  }
7231
7379
  if (doLength) {
7232
- var descriptor = "length", itemsCount;
7380
+ let descriptor = "length", itemsCount;
7233
7381
  if (objType === "map" || objType === "set") {
7234
7382
  descriptor = "size";
7235
7383
  itemsCount = obj.size;
@@ -7257,9 +7405,8 @@ Assertion.addMethod("above", assertAbove);
7257
7405
  Assertion.addMethod("gt", assertAbove);
7258
7406
  Assertion.addMethod("greaterThan", assertAbove);
7259
7407
  function assertLeast(n, msg) {
7260
- if (msg)
7261
- flag2(this, "message", msg);
7262
- var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
7408
+ if (msg) flag2(this, "message", msg);
7409
+ let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
7263
7410
  if (doLength && objType !== "map" && objType !== "set") {
7264
7411
  new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
7265
7412
  }
@@ -7268,7 +7415,7 @@ function assertLeast(n, msg) {
7268
7415
  } else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
7269
7416
  errorMessage = msgPrefix + "the argument to least must be a number";
7270
7417
  } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
7271
- var printObj = objType === "string" ? "'" + obj + "'" : obj;
7418
+ let printObj = objType === "string" ? "'" + obj + "'" : obj;
7272
7419
  errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
7273
7420
  } else {
7274
7421
  shouldThrow = false;
@@ -7277,7 +7424,7 @@ function assertLeast(n, msg) {
7277
7424
  throw new AssertionError(errorMessage, void 0, ssfi);
7278
7425
  }
7279
7426
  if (doLength) {
7280
- var descriptor = "length", itemsCount;
7427
+ let descriptor = "length", itemsCount;
7281
7428
  if (objType === "map" || objType === "set") {
7282
7429
  descriptor = "size";
7283
7430
  itemsCount = obj.size;
@@ -7305,9 +7452,8 @@ Assertion.addMethod("least", assertLeast);
7305
7452
  Assertion.addMethod("gte", assertLeast);
7306
7453
  Assertion.addMethod("greaterThanOrEqual", assertLeast);
7307
7454
  function assertBelow(n, msg) {
7308
- if (msg)
7309
- flag2(this, "message", msg);
7310
- var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
7455
+ if (msg) flag2(this, "message", msg);
7456
+ let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
7311
7457
  if (doLength && objType !== "map" && objType !== "set") {
7312
7458
  new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
7313
7459
  }
@@ -7316,7 +7462,7 @@ function assertBelow(n, msg) {
7316
7462
  } else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
7317
7463
  errorMessage = msgPrefix + "the argument to below must be a number";
7318
7464
  } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
7319
- var printObj = objType === "string" ? "'" + obj + "'" : obj;
7465
+ let printObj = objType === "string" ? "'" + obj + "'" : obj;
7320
7466
  errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
7321
7467
  } else {
7322
7468
  shouldThrow = false;
@@ -7325,7 +7471,7 @@ function assertBelow(n, msg) {
7325
7471
  throw new AssertionError(errorMessage, void 0, ssfi);
7326
7472
  }
7327
7473
  if (doLength) {
7328
- var descriptor = "length", itemsCount;
7474
+ let descriptor = "length", itemsCount;
7329
7475
  if (objType === "map" || objType === "set") {
7330
7476
  descriptor = "size";
7331
7477
  itemsCount = obj.size;
@@ -7353,9 +7499,8 @@ Assertion.addMethod("below", assertBelow);
7353
7499
  Assertion.addMethod("lt", assertBelow);
7354
7500
  Assertion.addMethod("lessThan", assertBelow);
7355
7501
  function assertMost(n, msg) {
7356
- if (msg)
7357
- flag2(this, "message", msg);
7358
- var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
7502
+ if (msg) flag2(this, "message", msg);
7503
+ let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
7359
7504
  if (doLength && objType !== "map" && objType !== "set") {
7360
7505
  new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
7361
7506
  }
@@ -7364,7 +7509,7 @@ function assertMost(n, msg) {
7364
7509
  } else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
7365
7510
  errorMessage = msgPrefix + "the argument to most must be a number";
7366
7511
  } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
7367
- var printObj = objType === "string" ? "'" + obj + "'" : obj;
7512
+ let printObj = objType === "string" ? "'" + obj + "'" : obj;
7368
7513
  errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
7369
7514
  } else {
7370
7515
  shouldThrow = false;
@@ -7373,7 +7518,7 @@ function assertMost(n, msg) {
7373
7518
  throw new AssertionError(errorMessage, void 0, ssfi);
7374
7519
  }
7375
7520
  if (doLength) {
7376
- var descriptor = "length", itemsCount;
7521
+ let descriptor = "length", itemsCount;
7377
7522
  if (objType === "map" || objType === "set") {
7378
7523
  descriptor = "size";
7379
7524
  itemsCount = obj.size;
@@ -7401,9 +7546,8 @@ Assertion.addMethod("most", assertMost);
7401
7546
  Assertion.addMethod("lte", assertMost);
7402
7547
  Assertion.addMethod("lessThanOrEqual", assertMost);
7403
7548
  Assertion.addMethod("within", function(start, finish, msg) {
7404
- if (msg)
7405
- flag2(this, "message", msg);
7406
- var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), startType = type(start).toLowerCase(), finishType = type(finish).toLowerCase(), errorMessage, shouldThrow = true, range = startType === "date" && finishType === "date" ? start.toISOString() + ".." + finish.toISOString() : start + ".." + finish;
7549
+ if (msg) flag2(this, "message", msg);
7550
+ let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), startType = type(start).toLowerCase(), finishType = type(finish).toLowerCase(), errorMessage, shouldThrow = true, range = startType === "date" && finishType === "date" ? start.toISOString() + ".." + finish.toISOString() : start + ".." + finish;
7407
7551
  if (doLength && objType !== "map" && objType !== "set") {
7408
7552
  new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
7409
7553
  }
@@ -7412,7 +7556,7 @@ Assertion.addMethod("within", function(start, finish, msg) {
7412
7556
  } else if ((!isNumeric(start) || !isNumeric(finish)) && (doLength || isNumeric(obj))) {
7413
7557
  errorMessage = msgPrefix + "the arguments to within must be numbers";
7414
7558
  } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
7415
- var printObj = objType === "string" ? "'" + obj + "'" : obj;
7559
+ let printObj = objType === "string" ? "'" + obj + "'" : obj;
7416
7560
  errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
7417
7561
  } else {
7418
7562
  shouldThrow = false;
@@ -7421,7 +7565,7 @@ Assertion.addMethod("within", function(start, finish, msg) {
7421
7565
  throw new AssertionError(errorMessage, void 0, ssfi);
7422
7566
  }
7423
7567
  if (doLength) {
7424
- var descriptor = "length", itemsCount;
7568
+ let descriptor = "length", itemsCount;
7425
7569
  if (objType === "map" || objType === "set") {
7426
7570
  descriptor = "size";
7427
7571
  itemsCount = obj.size;
@@ -7442,13 +7586,13 @@ Assertion.addMethod("within", function(start, finish, msg) {
7442
7586
  }
7443
7587
  });
7444
7588
  function assertInstanceOf(constructor, msg) {
7445
- if (msg)
7446
- flag2(this, "message", msg);
7447
- var target = flag2(this, "object");
7448
- var ssfi = flag2(this, "ssfi");
7449
- var flagMsg = flag2(this, "message");
7589
+ if (msg) flag2(this, "message", msg);
7590
+ let target = flag2(this, "object");
7591
+ let ssfi = flag2(this, "ssfi");
7592
+ let flagMsg = flag2(this, "message");
7593
+ let isInstanceOf;
7450
7594
  try {
7451
- var isInstanceOf = target instanceof constructor;
7595
+ isInstanceOf = target instanceof constructor;
7452
7596
  } catch (err) {
7453
7597
  if (err instanceof TypeError) {
7454
7598
  flagMsg = flagMsg ? flagMsg + ": " : "";
@@ -7460,7 +7604,7 @@ function assertInstanceOf(constructor, msg) {
7460
7604
  }
7461
7605
  throw err;
7462
7606
  }
7463
- var name = getName(constructor);
7607
+ let name = getName(constructor);
7464
7608
  if (name == null) {
7465
7609
  name = "an unnamed constructor";
7466
7610
  }
@@ -7474,9 +7618,8 @@ __name(assertInstanceOf, "assertInstanceOf");
7474
7618
  Assertion.addMethod("instanceof", assertInstanceOf);
7475
7619
  Assertion.addMethod("instanceOf", assertInstanceOf);
7476
7620
  function assertProperty(name, val, msg) {
7477
- if (msg)
7478
- flag2(this, "message", msg);
7479
- var isNested = flag2(this, "nested"), isOwn = flag2(this, "own"), flagMsg = flag2(this, "message"), obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), nameType = typeof name;
7621
+ if (msg) flag2(this, "message", msg);
7622
+ let isNested = flag2(this, "nested"), isOwn = flag2(this, "own"), flagMsg = flag2(this, "message"), obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), nameType = typeof name;
7480
7623
  flagMsg = flagMsg ? flagMsg + ": " : "";
7481
7624
  if (isNested) {
7482
7625
  if (nameType !== "string") {
@@ -7509,22 +7652,16 @@ function assertProperty(name, val, msg) {
7509
7652
  ssfi
7510
7653
  );
7511
7654
  }
7512
- var isDeep = flag2(this, "deep"), negate = flag2(this, "negate"), pathInfo = isNested ? getPathInfo(obj, name) : null, value = isNested ? pathInfo.value : obj[name], isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2;
7513
- var descriptor = "";
7514
- if (isDeep)
7515
- descriptor += "deep ";
7516
- if (isOwn)
7517
- descriptor += "own ";
7518
- if (isNested)
7519
- descriptor += "nested ";
7655
+ let isDeep = flag2(this, "deep"), negate = flag2(this, "negate"), pathInfo = isNested ? getPathInfo(obj, name) : null, value = isNested ? pathInfo.value : obj[name], isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2;
7656
+ let descriptor = "";
7657
+ if (isDeep) descriptor += "deep ";
7658
+ if (isOwn) descriptor += "own ";
7659
+ if (isNested) descriptor += "nested ";
7520
7660
  descriptor += "property ";
7521
- var hasProperty2;
7522
- if (isOwn)
7523
- hasProperty2 = Object.prototype.hasOwnProperty.call(obj, name);
7524
- else if (isNested)
7525
- hasProperty2 = pathInfo.exists;
7526
- else
7527
- hasProperty2 = hasProperty(obj, name);
7661
+ let hasProperty2;
7662
+ if (isOwn) hasProperty2 = Object.prototype.hasOwnProperty.call(obj, name);
7663
+ else if (isNested) hasProperty2 = pathInfo.exists;
7664
+ else hasProperty2 = hasProperty(obj, name);
7528
7665
  if (!negate || arguments.length === 1) {
7529
7666
  this.assert(
7530
7667
  hasProperty2,
@@ -7557,11 +7694,10 @@ function assertOwnPropertyDescriptor(name, descriptor, msg) {
7557
7694
  msg = descriptor;
7558
7695
  descriptor = null;
7559
7696
  }
7560
- if (msg)
7561
- flag2(this, "message", msg);
7562
- var obj = flag2(this, "object");
7563
- var actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name);
7564
- var eql = flag2(this, "eql");
7697
+ if (msg) flag2(this, "message", msg);
7698
+ let obj = flag2(this, "object");
7699
+ let actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name);
7700
+ let eql = flag2(this, "eql");
7565
7701
  if (actualDescriptor && descriptor) {
7566
7702
  this.assert(
7567
7703
  eql(descriptor, actualDescriptor),
@@ -7588,9 +7724,8 @@ function assertLengthChain() {
7588
7724
  }
7589
7725
  __name(assertLengthChain, "assertLengthChain");
7590
7726
  function assertLength(n, msg) {
7591
- if (msg)
7592
- flag2(this, "message", msg);
7593
- var obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), descriptor = "length", itemsCount;
7727
+ if (msg) flag2(this, "message", msg);
7728
+ let obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), descriptor = "length", itemsCount;
7594
7729
  switch (objType) {
7595
7730
  case "map":
7596
7731
  case "set":
@@ -7613,9 +7748,8 @@ __name(assertLength, "assertLength");
7613
7748
  Assertion.addChainableMethod("length", assertLength, assertLengthChain);
7614
7749
  Assertion.addChainableMethod("lengthOf", assertLength, assertLengthChain);
7615
7750
  function assertMatch(re, msg) {
7616
- if (msg)
7617
- flag2(this, "message", msg);
7618
- var obj = flag2(this, "object");
7751
+ if (msg) flag2(this, "message", msg);
7752
+ let obj = flag2(this, "object");
7619
7753
  this.assert(
7620
7754
  re.exec(obj),
7621
7755
  "expected #{this} to match " + re,
@@ -7626,9 +7760,8 @@ __name(assertMatch, "assertMatch");
7626
7760
  Assertion.addMethod("match", assertMatch);
7627
7761
  Assertion.addMethod("matches", assertMatch);
7628
7762
  Assertion.addMethod("string", function(str, msg) {
7629
- if (msg)
7630
- flag2(this, "message", msg);
7631
- var obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
7763
+ if (msg) flag2(this, "message", msg);
7764
+ let obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
7632
7765
  new Assertion(obj, flagMsg, ssfi, true).is.a("string");
7633
7766
  this.assert(
7634
7767
  ~obj.indexOf(str),
@@ -7637,9 +7770,9 @@ Assertion.addMethod("string", function(str, msg) {
7637
7770
  );
7638
7771
  });
7639
7772
  function assertKeys(keys) {
7640
- var obj = flag2(this, "object"), objType = type(obj), keysType = type(keys), ssfi = flag2(this, "ssfi"), isDeep = flag2(this, "deep"), str, deepStr = "", actual, ok = true, flagMsg = flag2(this, "message");
7773
+ let obj = flag2(this, "object"), objType = type(obj), keysType = type(keys), ssfi = flag2(this, "ssfi"), isDeep = flag2(this, "deep"), str, deepStr = "", actual, ok = true, flagMsg = flag2(this, "message");
7641
7774
  flagMsg = flagMsg ? flagMsg + ": " : "";
7642
- var mixedArgsMsg = flagMsg + "when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments";
7775
+ let mixedArgsMsg = flagMsg + "when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments";
7643
7776
  if (objType === "Map" || objType === "Set") {
7644
7777
  deepStr = isDeep ? "deeply " : "";
7645
7778
  actual = [];
@@ -7673,7 +7806,7 @@ function assertKeys(keys) {
7673
7806
  if (!keys.length) {
7674
7807
  throw new AssertionError(flagMsg + "keys required", void 0, ssfi);
7675
7808
  }
7676
- var len = keys.length, any = flag2(this, "any"), all = flag2(this, "all"), expected = keys, isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2;
7809
+ let len = keys.length, any = flag2(this, "any"), all = flag2(this, "all"), expected = keys, isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2;
7677
7810
  if (!any && !all) {
7678
7811
  all = true;
7679
7812
  }
@@ -7698,7 +7831,7 @@ function assertKeys(keys) {
7698
7831
  keys = keys.map(function(key) {
7699
7832
  return inspect2(key);
7700
7833
  });
7701
- var last = keys.pop();
7834
+ let last = keys.pop();
7702
7835
  if (all) {
7703
7836
  str = keys.join(", ") + ", and " + last;
7704
7837
  }
@@ -7723,9 +7856,8 @@ __name(assertKeys, "assertKeys");
7723
7856
  Assertion.addMethod("keys", assertKeys);
7724
7857
  Assertion.addMethod("key", assertKeys);
7725
7858
  function assertThrows(errorLike, errMsgMatcher, msg) {
7726
- if (msg)
7727
- flag2(this, "message", msg);
7728
- var obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), negate = flag2(this, "negate") || false;
7859
+ if (msg) flag2(this, "message", msg);
7860
+ let obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), negate = flag2(this, "negate") || false;
7729
7861
  new Assertion(obj, flagMsg, ssfi, true).is.a("function");
7730
7862
  if (isRegExp2(errorLike) || typeof errorLike === "string") {
7731
7863
  errMsgMatcher = errorLike;
@@ -7739,12 +7871,12 @@ function assertThrows(errorLike, errMsgMatcher, msg) {
7739
7871
  errorWasThrown = true;
7740
7872
  caughtErr = err;
7741
7873
  }
7742
- var everyArgIsUndefined = errorLike === void 0 && errMsgMatcher === void 0;
7743
- var everyArgIsDefined = Boolean(errorLike && errMsgMatcher);
7744
- var errorLikeFail = false;
7745
- var errMsgMatcherFail = false;
7874
+ let everyArgIsUndefined = errorLike === void 0 && errMsgMatcher === void 0;
7875
+ let everyArgIsDefined = Boolean(errorLike && errMsgMatcher);
7876
+ let errorLikeFail = false;
7877
+ let errMsgMatcherFail = false;
7746
7878
  if (everyArgIsUndefined || !everyArgIsUndefined && !negate) {
7747
- var errorLikeString = "an error";
7879
+ let errorLikeString = "an error";
7748
7880
  if (errorLike instanceof Error) {
7749
7881
  errorLikeString = "#{exp}";
7750
7882
  } else if (errorLike) {
@@ -7771,7 +7903,7 @@ function assertThrows(errorLike, errMsgMatcher, msg) {
7771
7903
  }
7772
7904
  if (errorLike && caughtErr) {
7773
7905
  if (errorLike instanceof Error) {
7774
- var isCompatibleInstance = check_error_exports.compatibleInstance(
7906
+ let isCompatibleInstance = check_error_exports.compatibleInstance(
7775
7907
  caughtErr,
7776
7908
  errorLike
7777
7909
  );
@@ -7789,7 +7921,7 @@ function assertThrows(errorLike, errMsgMatcher, msg) {
7789
7921
  }
7790
7922
  }
7791
7923
  }
7792
- var isCompatibleConstructor = check_error_exports.compatibleConstructor(
7924
+ let isCompatibleConstructor = check_error_exports.compatibleConstructor(
7793
7925
  caughtErr,
7794
7926
  errorLike
7795
7927
  );
@@ -7808,11 +7940,11 @@ function assertThrows(errorLike, errMsgMatcher, msg) {
7808
7940
  }
7809
7941
  }
7810
7942
  if (caughtErr && errMsgMatcher !== void 0 && errMsgMatcher !== null) {
7811
- var placeholder = "including";
7943
+ let placeholder = "including";
7812
7944
  if (isRegExp2(errMsgMatcher)) {
7813
7945
  placeholder = "matching";
7814
7946
  }
7815
- var isCompatibleMessage = check_error_exports.compatibleMessage(
7947
+ let isCompatibleMessage = check_error_exports.compatibleMessage(
7816
7948
  caughtErr,
7817
7949
  errMsgMatcher
7818
7950
  );
@@ -7846,9 +7978,8 @@ Assertion.addMethod("throw", assertThrows);
7846
7978
  Assertion.addMethod("throws", assertThrows);
7847
7979
  Assertion.addMethod("Throw", assertThrows);
7848
7980
  function respondTo(method, msg) {
7849
- if (msg)
7850
- flag2(this, "message", msg);
7851
- var obj = flag2(this, "object"), itself = flag2(this, "itself"), context = "function" === typeof obj && !itself ? obj.prototype[method] : obj[method];
7981
+ if (msg) flag2(this, "message", msg);
7982
+ let obj = flag2(this, "object"), itself = flag2(this, "itself"), context = "function" === typeof obj && !itself ? obj.prototype[method] : obj[method];
7852
7983
  this.assert(
7853
7984
  "function" === typeof context,
7854
7985
  "expected #{this} to respond to " + inspect2(method),
@@ -7862,10 +7993,9 @@ Assertion.addProperty("itself", function() {
7862
7993
  flag2(this, "itself", true);
7863
7994
  });
7864
7995
  function satisfy(matcher, msg) {
7865
- if (msg)
7866
- flag2(this, "message", msg);
7867
- var obj = flag2(this, "object");
7868
- var result = matcher(obj);
7996
+ if (msg) flag2(this, "message", msg);
7997
+ let obj = flag2(this, "object");
7998
+ let result = matcher(obj);
7869
7999
  this.assert(
7870
8000
  result,
7871
8001
  "expected #{this} to satisfy " + objDisplay(matcher),
@@ -7878,25 +8008,26 @@ __name(satisfy, "satisfy");
7878
8008
  Assertion.addMethod("satisfy", satisfy);
7879
8009
  Assertion.addMethod("satisfies", satisfy);
7880
8010
  function closeTo(expected, delta, msg) {
7881
- if (msg)
7882
- flag2(this, "message", msg);
7883
- var obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
8011
+ if (msg) flag2(this, "message", msg);
8012
+ let obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
7884
8013
  new Assertion(obj, flagMsg, ssfi, true).is.numeric;
7885
8014
  let message = "A `delta` value is required for `closeTo`";
7886
- if (delta == void 0)
8015
+ if (delta == void 0) {
7887
8016
  throw new AssertionError(
7888
8017
  flagMsg ? `${flagMsg}: ${message}` : message,
7889
8018
  void 0,
7890
8019
  ssfi
7891
8020
  );
8021
+ }
7892
8022
  new Assertion(delta, flagMsg, ssfi, true).is.numeric;
7893
8023
  message = "A `expected` value is required for `closeTo`";
7894
- if (expected == void 0)
8024
+ if (expected == void 0) {
7895
8025
  throw new AssertionError(
7896
8026
  flagMsg ? `${flagMsg}: ${message}` : message,
7897
8027
  void 0,
7898
8028
  ssfi
7899
8029
  );
8030
+ }
7900
8031
  new Assertion(expected, flagMsg, ssfi, true).is.numeric;
7901
8032
  const abs = /* @__PURE__ */ __name((x) => x < 0n ? -x : x, "abs");
7902
8033
  const strip = /* @__PURE__ */ __name((number) => parseFloat(parseFloat(number).toPrecision(12)), "strip");
@@ -7913,40 +8044,33 @@ function isSubsetOf(_subset, _superset, cmp, contains, ordered) {
7913
8044
  let superset = Array.from(_superset);
7914
8045
  let subset = Array.from(_subset);
7915
8046
  if (!contains) {
7916
- if (subset.length !== superset.length)
7917
- return false;
8047
+ if (subset.length !== superset.length) return false;
7918
8048
  superset = superset.slice();
7919
8049
  }
7920
8050
  return subset.every(function(elem, idx) {
7921
- if (ordered)
7922
- return cmp ? cmp(elem, superset[idx]) : elem === superset[idx];
8051
+ if (ordered) return cmp ? cmp(elem, superset[idx]) : elem === superset[idx];
7923
8052
  if (!cmp) {
7924
- var matchIdx = superset.indexOf(elem);
7925
- if (matchIdx === -1)
7926
- return false;
7927
- if (!contains)
7928
- superset.splice(matchIdx, 1);
8053
+ let matchIdx = superset.indexOf(elem);
8054
+ if (matchIdx === -1) return false;
8055
+ if (!contains) superset.splice(matchIdx, 1);
7929
8056
  return true;
7930
8057
  }
7931
- return superset.some(function(elem2, matchIdx2) {
7932
- if (!cmp(elem, elem2))
7933
- return false;
7934
- if (!contains)
7935
- superset.splice(matchIdx2, 1);
8058
+ return superset.some(function(elem2, matchIdx) {
8059
+ if (!cmp(elem, elem2)) return false;
8060
+ if (!contains) superset.splice(matchIdx, 1);
7936
8061
  return true;
7937
8062
  });
7938
8063
  });
7939
8064
  }
7940
8065
  __name(isSubsetOf, "isSubsetOf");
7941
8066
  Assertion.addMethod("members", function(subset, msg) {
7942
- if (msg)
7943
- flag2(this, "message", msg);
7944
- var obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
8067
+ if (msg) flag2(this, "message", msg);
8068
+ let obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
7945
8069
  new Assertion(obj, flagMsg, ssfi, true).to.be.iterable;
7946
8070
  new Assertion(subset, flagMsg, ssfi, true).to.be.iterable;
7947
- var contains = flag2(this, "contains");
7948
- var ordered = flag2(this, "ordered");
7949
- var subject, failMsg, failNegateMsg;
8071
+ let contains = flag2(this, "contains");
8072
+ let ordered = flag2(this, "ordered");
8073
+ let subject, failMsg, failNegateMsg;
7950
8074
  if (contains) {
7951
8075
  subject = ordered ? "an ordered superset" : "a superset";
7952
8076
  failMsg = "expected #{this} to be " + subject + " of #{exp}";
@@ -7956,7 +8080,7 @@ Assertion.addMethod("members", function(subset, msg) {
7956
8080
  failMsg = "expected #{this} to have the same " + subject + " as #{exp}";
7957
8081
  failNegateMsg = "expected #{this} to not have the same " + subject + " as #{exp}";
7958
8082
  }
7959
- var cmp = flag2(this, "deep") ? flag2(this, "eql") : void 0;
8083
+ let cmp = flag2(this, "deep") ? flag2(this, "eql") : void 0;
7960
8084
  this.assert(
7961
8085
  isSubsetOf(subset, obj, cmp, contains, ordered),
7962
8086
  failMsg,
@@ -7967,9 +8091,8 @@ Assertion.addMethod("members", function(subset, msg) {
7967
8091
  );
7968
8092
  });
7969
8093
  Assertion.addProperty("iterable", function(msg) {
7970
- if (msg)
7971
- flag2(this, "message", msg);
7972
- var obj = flag2(this, "object");
8094
+ if (msg) flag2(this, "message", msg);
8095
+ let obj = flag2(this, "object");
7973
8096
  this.assert(
7974
8097
  obj != void 0 && obj[Symbol.iterator],
7975
8098
  "expected #{this} to be an iterable",
@@ -7978,9 +8101,8 @@ Assertion.addProperty("iterable", function(msg) {
7978
8101
  );
7979
8102
  });
7980
8103
  function oneOf(list, msg) {
7981
- if (msg)
7982
- flag2(this, "message", msg);
7983
- var expected = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), contains = flag2(this, "contains"), isDeep = flag2(this, "deep"), eql = flag2(this, "eql");
8104
+ if (msg) flag2(this, "message", msg);
8105
+ let expected = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), contains = flag2(this, "contains"), isDeep = flag2(this, "deep"), eql = flag2(this, "eql");
7984
8106
  new Assertion(list, flagMsg, ssfi, true).to.be.an("array");
7985
8107
  if (contains) {
7986
8108
  this.assert(
@@ -8017,11 +8139,10 @@ function oneOf(list, msg) {
8017
8139
  __name(oneOf, "oneOf");
8018
8140
  Assertion.addMethod("oneOf", oneOf);
8019
8141
  function assertChanges(subject, prop, msg) {
8020
- if (msg)
8021
- flag2(this, "message", msg);
8022
- var fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
8142
+ if (msg) flag2(this, "message", msg);
8143
+ let fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
8023
8144
  new Assertion(fn, flagMsg, ssfi, true).is.a("function");
8024
- var initial;
8145
+ let initial;
8025
8146
  if (!prop) {
8026
8147
  new Assertion(subject, flagMsg, ssfi, true).is.a("function");
8027
8148
  initial = subject();
@@ -8030,8 +8151,8 @@ function assertChanges(subject, prop, msg) {
8030
8151
  initial = subject[prop];
8031
8152
  }
8032
8153
  fn();
8033
- var final = prop === void 0 || prop === null ? subject() : subject[prop];
8034
- var msgObj = prop === void 0 || prop === null ? initial : "." + prop;
8154
+ let final = prop === void 0 || prop === null ? subject() : subject[prop];
8155
+ let msgObj = prop === void 0 || prop === null ? initial : "." + prop;
8035
8156
  flag2(this, "deltaMsgObj", msgObj);
8036
8157
  flag2(this, "initialDeltaValue", initial);
8037
8158
  flag2(this, "finalDeltaValue", final);
@@ -8047,11 +8168,10 @@ __name(assertChanges, "assertChanges");
8047
8168
  Assertion.addMethod("change", assertChanges);
8048
8169
  Assertion.addMethod("changes", assertChanges);
8049
8170
  function assertIncreases(subject, prop, msg) {
8050
- if (msg)
8051
- flag2(this, "message", msg);
8052
- var fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
8171
+ if (msg) flag2(this, "message", msg);
8172
+ let fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
8053
8173
  new Assertion(fn, flagMsg, ssfi, true).is.a("function");
8054
- var initial;
8174
+ let initial;
8055
8175
  if (!prop) {
8056
8176
  new Assertion(subject, flagMsg, ssfi, true).is.a("function");
8057
8177
  initial = subject();
@@ -8061,8 +8181,8 @@ function assertIncreases(subject, prop, msg) {
8061
8181
  }
8062
8182
  new Assertion(initial, flagMsg, ssfi, true).is.a("number");
8063
8183
  fn();
8064
- var final = prop === void 0 || prop === null ? subject() : subject[prop];
8065
- var msgObj = prop === void 0 || prop === null ? initial : "." + prop;
8184
+ let final = prop === void 0 || prop === null ? subject() : subject[prop];
8185
+ let msgObj = prop === void 0 || prop === null ? initial : "." + prop;
8066
8186
  flag2(this, "deltaMsgObj", msgObj);
8067
8187
  flag2(this, "initialDeltaValue", initial);
8068
8188
  flag2(this, "finalDeltaValue", final);
@@ -8078,11 +8198,10 @@ __name(assertIncreases, "assertIncreases");
8078
8198
  Assertion.addMethod("increase", assertIncreases);
8079
8199
  Assertion.addMethod("increases", assertIncreases);
8080
8200
  function assertDecreases(subject, prop, msg) {
8081
- if (msg)
8082
- flag2(this, "message", msg);
8083
- var fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
8201
+ if (msg) flag2(this, "message", msg);
8202
+ let fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
8084
8203
  new Assertion(fn, flagMsg, ssfi, true).is.a("function");
8085
- var initial;
8204
+ let initial;
8086
8205
  if (!prop) {
8087
8206
  new Assertion(subject, flagMsg, ssfi, true).is.a("function");
8088
8207
  initial = subject();
@@ -8092,8 +8211,8 @@ function assertDecreases(subject, prop, msg) {
8092
8211
  }
8093
8212
  new Assertion(initial, flagMsg, ssfi, true).is.a("number");
8094
8213
  fn();
8095
- var final = prop === void 0 || prop === null ? subject() : subject[prop];
8096
- var msgObj = prop === void 0 || prop === null ? initial : "." + prop;
8214
+ let final = prop === void 0 || prop === null ? subject() : subject[prop];
8215
+ let msgObj = prop === void 0 || prop === null ? initial : "." + prop;
8097
8216
  flag2(this, "deltaMsgObj", msgObj);
8098
8217
  flag2(this, "initialDeltaValue", initial);
8099
8218
  flag2(this, "finalDeltaValue", final);
@@ -8109,14 +8228,13 @@ __name(assertDecreases, "assertDecreases");
8109
8228
  Assertion.addMethod("decrease", assertDecreases);
8110
8229
  Assertion.addMethod("decreases", assertDecreases);
8111
8230
  function assertDelta(delta, msg) {
8112
- if (msg)
8113
- flag2(this, "message", msg);
8114
- var msgObj = flag2(this, "deltaMsgObj");
8115
- var initial = flag2(this, "initialDeltaValue");
8116
- var final = flag2(this, "finalDeltaValue");
8117
- var behavior = flag2(this, "deltaBehavior");
8118
- var realDelta = flag2(this, "realDelta");
8119
- var expression;
8231
+ if (msg) flag2(this, "message", msg);
8232
+ let msgObj = flag2(this, "deltaMsgObj");
8233
+ let initial = flag2(this, "initialDeltaValue");
8234
+ let final = flag2(this, "finalDeltaValue");
8235
+ let behavior = flag2(this, "deltaBehavior");
8236
+ let realDelta = flag2(this, "realDelta");
8237
+ let expression;
8120
8238
  if (behavior === "change") {
8121
8239
  expression = Math.abs(final - initial) === Math.abs(delta);
8122
8240
  } else {
@@ -8131,8 +8249,8 @@ function assertDelta(delta, msg) {
8131
8249
  __name(assertDelta, "assertDelta");
8132
8250
  Assertion.addMethod("by", assertDelta);
8133
8251
  Assertion.addProperty("extensible", function() {
8134
- var obj = flag2(this, "object");
8135
- var isExtensible = obj === Object(obj) && Object.isExtensible(obj);
8252
+ let obj = flag2(this, "object");
8253
+ let isExtensible = obj === Object(obj) && Object.isExtensible(obj);
8136
8254
  this.assert(
8137
8255
  isExtensible,
8138
8256
  "expected #{this} to be extensible",
@@ -8140,8 +8258,8 @@ Assertion.addProperty("extensible", function() {
8140
8258
  );
8141
8259
  });
8142
8260
  Assertion.addProperty("sealed", function() {
8143
- var obj = flag2(this, "object");
8144
- var isSealed = obj === Object(obj) ? Object.isSealed(obj) : true;
8261
+ let obj = flag2(this, "object");
8262
+ let isSealed = obj === Object(obj) ? Object.isSealed(obj) : true;
8145
8263
  this.assert(
8146
8264
  isSealed,
8147
8265
  "expected #{this} to be sealed",
@@ -8149,8 +8267,8 @@ Assertion.addProperty("sealed", function() {
8149
8267
  );
8150
8268
  });
8151
8269
  Assertion.addProperty("frozen", function() {
8152
- var obj = flag2(this, "object");
8153
- var isFrozen = obj === Object(obj) ? Object.isFrozen(obj) : true;
8270
+ let obj = flag2(this, "object");
8271
+ let isFrozen = obj === Object(obj) ? Object.isFrozen(obj) : true;
8154
8272
  this.assert(
8155
8273
  isFrozen,
8156
8274
  "expected #{this} to be frozen",
@@ -8158,7 +8276,7 @@ Assertion.addProperty("frozen", function() {
8158
8276
  );
8159
8277
  });
8160
8278
  Assertion.addProperty("finite", function(_msg) {
8161
- var obj = flag2(this, "object");
8279
+ let obj = flag2(this, "object");
8162
8280
  this.assert(
8163
8281
  typeof obj === "number" && isFinite(obj),
8164
8282
  "expected #{this} to be a finite number",
@@ -8196,8 +8314,8 @@ function compareSubset(expected, actual) {
8196
8314
  }
8197
8315
  }
8198
8316
  return Object.keys(expected).every(function(key) {
8199
- var expectedValue = expected[key];
8200
- var actualValue = actual[key];
8317
+ let expectedValue = expected[key];
8318
+ let actualValue = actual[key];
8201
8319
  if (typeof expectedValue === "object" && expectedValue !== null && actualValue !== null) {
8202
8320
  return compareSubset(expectedValue, actualValue);
8203
8321
  }
@@ -8271,7 +8389,7 @@ function loadShould() {
8271
8389
  get: shouldGetter,
8272
8390
  configurable: true
8273
8391
  });
8274
- var should2 = {};
8392
+ let should2 = {};
8275
8393
  should2.fail = function(actual, expected, message, operator) {
8276
8394
  if (arguments.length < 2) {
8277
8395
  message = actual;
@@ -8317,7 +8435,7 @@ var Should = loadShould;
8317
8435
 
8318
8436
  // lib/chai/interface/assert.js
8319
8437
  function assert(express, errmsg) {
8320
- var test2 = new Assertion(null, null, assert, true);
8438
+ let test2 = new Assertion(null, null, assert, true);
8321
8439
  test2.assert(express, errmsg, "[ negation message unavailable ]");
8322
8440
  }
8323
8441
  __name(assert, "assert");
@@ -8344,7 +8462,7 @@ assert.isNotOk = function(val, msg) {
8344
8462
  new Assertion(val, msg, assert.isNotOk, true).is.not.ok;
8345
8463
  };
8346
8464
  assert.equal = function(act, exp, msg) {
8347
- var test2 = new Assertion(act, msg, assert.equal, true);
8465
+ let test2 = new Assertion(act, msg, assert.equal, true);
8348
8466
  test2.assert(
8349
8467
  exp == flag(test2, "object"),
8350
8468
  "expected #{this} to equal #{exp}",
@@ -8355,7 +8473,7 @@ assert.equal = function(act, exp, msg) {
8355
8473
  );
8356
8474
  };
8357
8475
  assert.notEqual = function(act, exp, msg) {
8358
- var test2 = new Assertion(act, msg, assert.notEqual, true);
8476
+ let test2 = new Assertion(act, msg, assert.notEqual, true);
8359
8477
  test2.assert(
8360
8478
  exp != flag(test2, "object"),
8361
8479
  "expected #{this} to not equal #{exp}",
@@ -8712,7 +8830,7 @@ assert.throws = function(fn, errorLike, errMsgMatcher, msg) {
8712
8830
  errMsgMatcher = errorLike;
8713
8831
  errorLike = null;
8714
8832
  }
8715
- var assertErr = new Assertion(fn, msg, assert.throws, true).to.throw(
8833
+ let assertErr = new Assertion(fn, msg, assert.throws, true).to.throw(
8716
8834
  errorLike,
8717
8835
  errMsgMatcher
8718
8836
  );
@@ -8729,7 +8847,7 @@ assert.doesNotThrow = function(fn, errorLike, errMsgMatcher, message) {
8729
8847
  );
8730
8848
  };
8731
8849
  assert.operator = function(val, operator, val2, msg) {
8732
- var ok;
8850
+ let ok;
8733
8851
  switch (operator) {
8734
8852
  case "==":
8735
8853
  ok = val == val2;
@@ -8763,7 +8881,7 @@ assert.operator = function(val, operator, val2, msg) {
8763
8881
  assert.operator
8764
8882
  );
8765
8883
  }
8766
- var test2 = new Assertion(ok, msg, assert.operator, true);
8884
+ let test2 = new Assertion(ok, msg, assert.operator, true);
8767
8885
  test2.assert(
8768
8886
  true === flag(test2, "object"),
8769
8887
  "expected " + inspect2(val) + " to be " + operator + " " + inspect2(val2),
@@ -8917,7 +9035,7 @@ assert.changes = function(fn, obj, prop, msg) {
8917
9035
  };
8918
9036
  assert.changesBy = function(fn, obj, prop, delta, msg) {
8919
9037
  if (arguments.length === 4 && typeof obj === "function") {
8920
- var tmpMsg = delta;
9038
+ let tmpMsg = delta;
8921
9039
  delta = prop;
8922
9040
  msg = tmpMsg;
8923
9041
  } else if (arguments.length === 3) {
@@ -8938,7 +9056,7 @@ assert.doesNotChange = function(fn, obj, prop, msg) {
8938
9056
  };
8939
9057
  assert.changesButNotBy = function(fn, obj, prop, delta, msg) {
8940
9058
  if (arguments.length === 4 && typeof obj === "function") {
8941
- var tmpMsg = delta;
9059
+ let tmpMsg = delta;
8942
9060
  delta = prop;
8943
9061
  msg = tmpMsg;
8944
9062
  } else if (arguments.length === 3) {
@@ -8956,7 +9074,7 @@ assert.increases = function(fn, obj, prop, msg) {
8956
9074
  };
8957
9075
  assert.increasesBy = function(fn, obj, prop, delta, msg) {
8958
9076
  if (arguments.length === 4 && typeof obj === "function") {
8959
- var tmpMsg = delta;
9077
+ let tmpMsg = delta;
8960
9078
  delta = prop;
8961
9079
  msg = tmpMsg;
8962
9080
  } else if (arguments.length === 3) {
@@ -8977,7 +9095,7 @@ assert.doesNotIncrease = function(fn, obj, prop, msg) {
8977
9095
  };
8978
9096
  assert.increasesButNotBy = function(fn, obj, prop, delta, msg) {
8979
9097
  if (arguments.length === 4 && typeof obj === "function") {
8980
- var tmpMsg = delta;
9098
+ let tmpMsg = delta;
8981
9099
  delta = prop;
8982
9100
  msg = tmpMsg;
8983
9101
  } else if (arguments.length === 3) {
@@ -8995,7 +9113,7 @@ assert.decreases = function(fn, obj, prop, msg) {
8995
9113
  };
8996
9114
  assert.decreasesBy = function(fn, obj, prop, delta, msg) {
8997
9115
  if (arguments.length === 4 && typeof obj === "function") {
8998
- var tmpMsg = delta;
9116
+ let tmpMsg = delta;
8999
9117
  delta = prop;
9000
9118
  msg = tmpMsg;
9001
9119
  } else if (arguments.length === 3) {
@@ -9016,7 +9134,7 @@ assert.doesNotDecrease = function(fn, obj, prop, msg) {
9016
9134
  };
9017
9135
  assert.doesNotDecreaseBy = function(fn, obj, prop, delta, msg) {
9018
9136
  if (arguments.length === 4 && typeof obj === "function") {
9019
- var tmpMsg = delta;
9137
+ let tmpMsg = delta;
9020
9138
  delta = prop;
9021
9139
  msg = tmpMsg;
9022
9140
  } else if (arguments.length === 3) {
@@ -9027,7 +9145,7 @@ assert.doesNotDecreaseBy = function(fn, obj, prop, delta, msg) {
9027
9145
  };
9028
9146
  assert.decreasesButNotBy = function(fn, obj, prop, delta, msg) {
9029
9147
  if (arguments.length === 4 && typeof obj === "function") {
9030
- var tmpMsg = delta;
9148
+ let tmpMsg = delta;
9031
9149
  delta = prop;
9032
9150
  msg = tmpMsg;
9033
9151
  } else if (arguments.length === 3) {
@@ -9367,7 +9485,7 @@ s.dim;
9367
9485
  // Extracted out of jasmine 2.5.2
9368
9486
  function equals(a, b, customTesters, strictCheck) {
9369
9487
  customTesters = customTesters || [];
9370
- return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey);
9488
+ return eq(a, b, [], [], customTesters, strictCheck ? hasKey$1 : hasDefinedKey);
9371
9489
  }
9372
9490
  function isAsymmetric(obj) {
9373
9491
  return !!obj && typeof obj === "object" && "asymmetricMatch" in obj && isA("Function", obj.asymmetricMatch);
@@ -9530,9 +9648,9 @@ function keys(obj, hasKey) {
9530
9648
  return keys.concat(Object.getOwnPropertySymbols(obj).filter((symbol) => Object.getOwnPropertyDescriptor(obj, symbol).enumerable));
9531
9649
  }
9532
9650
  function hasDefinedKey(obj, key) {
9533
- return hasKey(obj, key) && obj[key] !== undefined;
9651
+ return hasKey$1(obj, key) && obj[key] !== undefined;
9534
9652
  }
9535
- function hasKey(obj, key) {
9653
+ function hasKey$1(obj, key) {
9536
9654
  return Object.prototype.hasOwnProperty.call(obj, key);
9537
9655
  }
9538
9656
  function isA(typeName, value) {
@@ -9559,6 +9677,13 @@ if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
9559
9677
  Object.defineProperty(globalThis, ASYMMETRIC_MATCHERS_OBJECT, { get: () => asymmetricMatchers });
9560
9678
  }
9561
9679
 
9680
+ const KEYS_TO_HANDLE = ["oneOf", "anyOf", "allOf", "not", "$ref"];
9681
+ function isPlainObject(value) {
9682
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9683
+ }
9684
+ function hasKey(obj, key) {
9685
+ return key in obj;
9686
+ }
9562
9687
  const extendedDefu = createDefu((obj, key, value) => {
9563
9688
  if (Array.isArray(obj[key]) && Array.isArray(value)) {
9564
9689
  obj[key] = [.../* @__PURE__ */ new Set([...obj[key], ...value])].sort();
@@ -9571,6 +9696,21 @@ const extendedDefu = createDefu((obj, key, value) => {
9571
9696
  delete obj[key];
9572
9697
  return true;
9573
9698
  }
9699
+ if (!isPlainObject(obj)) {
9700
+ return false;
9701
+ }
9702
+ const objRecord = obj;
9703
+ function replaceKey(obj2, oldKey, newKey) {
9704
+ if (oldKey in obj2) {
9705
+ obj2[newKey] = obj2[oldKey];
9706
+ delete obj2[oldKey];
9707
+ }
9708
+ }
9709
+ for (const key2 of KEYS_TO_HANDLE) {
9710
+ if (hasKey(objRecord, key2)) {
9711
+ replaceKey(objRecord, key2, key2);
9712
+ }
9713
+ }
9574
9714
  return false;
9575
9715
  });
9576
9716
  function patchJsonSchema({
@@ -9777,6 +9917,17 @@ async function loadLocalJSONFile(path) {
9777
9917
  return void 0;
9778
9918
  }
9779
9919
 
9920
+ function getApiTypeConfig(config, apiType) {
9921
+ if (!config) {
9922
+ return {};
9923
+ }
9924
+ const apiTypeKey = `${apiType}-api`;
9925
+ const apiTypeConfig = config[apiTypeKey] || {};
9926
+ return {
9927
+ rules: apiTypeConfig.rules ?? config.rules,
9928
+ patches: apiTypeConfig.patches ?? config.patches
9929
+ };
9930
+ }
9780
9931
  const API_GEN_CONFIG_FILENAME = "api-gen.config.json";
9781
9932
  async function loadApiGenConfig(params = {}) {
9782
9933
  try {
@@ -9785,7 +9936,22 @@ async function loadApiGenConfig(params = {}) {
9785
9936
  // name: "api-gen", // file should be "api-gen.config.json"
9786
9937
  encoding: "utf-8"
9787
9938
  });
9788
- return lib.parse(config);
9939
+ const parsedConfig = lib.parse(config);
9940
+ if (parsedConfig.rules && !params.silent) {
9941
+ console.warn(
9942
+ c.yellow(
9943
+ `\u26A0\uFE0F Deprecation warning: Root-level 'rules' in ${API_GEN_CONFIG_FILENAME} is deprecated. Use 'store-api.rules' or 'admin-api.rules' instead.`
9944
+ )
9945
+ );
9946
+ }
9947
+ if (parsedConfig.patches && !params.silent) {
9948
+ console.warn(
9949
+ c.yellow(
9950
+ `\u26A0\uFE0F Deprecation warning: Root-level 'patches' in ${API_GEN_CONFIG_FILENAME} is deprecated. Use 'store-api.patches' or 'admin-api.patches' instead.`
9951
+ )
9952
+ );
9953
+ }
9954
+ return parsedConfig;
9789
9955
  } catch (error) {
9790
9956
  if (!params.silent) {
9791
9957
  console.error(
@@ -9953,12 +10119,13 @@ ${error}
9953
10119
  );
9954
10120
  }
9955
10121
 
9956
- async function generateFile(filepath, operationsMap, existingTypes, schemasMap, options) {
10122
+ async function generateFile(filepath, operationsMap, existingTypes, schemasMap, parametersMap, options) {
9957
10123
  const project = await prepareFileContent({
9958
10124
  filepath,
9959
10125
  operationsMap,
9960
10126
  existingTypes,
9961
10127
  componentsMap: schemasMap,
10128
+ parametersMap,
9962
10129
  options
9963
10130
  });
9964
10131
  await project.save();
@@ -9968,6 +10135,7 @@ async function prepareFileContent({
9968
10135
  operationsMap,
9969
10136
  existingTypes,
9970
10137
  componentsMap,
10138
+ parametersMap,
9971
10139
  options
9972
10140
  }) {
9973
10141
  const project = new Project({});
@@ -9980,6 +10148,7 @@ async function prepareFileContent({
9980
10148
  const defaultContentType = "application/json";
9981
10149
  const defaultAcceptType = "application/json";
9982
10150
  const sortedSchemaKeys = Object.keys(componentsMap).sort();
10151
+ const sortedParametersKeys = Object.keys(parametersMap).sort();
9983
10152
  const sourceFile = project.createSourceFile(
9984
10153
  filepath,
9985
10154
  (writer) => {
@@ -9990,6 +10159,15 @@ async function prepareFileContent({
9990
10159
  }
9991
10160
  writer.write("export type components =").block(() => {
9992
10161
  writer.writeLine("schemas: Schemas;");
10162
+ if (sortedParametersKeys.length) {
10163
+ writer.writeLine("parameters:").block(() => {
10164
+ for (const key of sortedParametersKeys) {
10165
+ if (parametersMap[key]) {
10166
+ writer.write(`${key}:`).write(parametersMap[key]);
10167
+ }
10168
+ }
10169
+ });
10170
+ }
9993
10171
  });
9994
10172
  writer.write("export type Schemas =").block(() => {
9995
10173
  for (const key of sortedSchemaKeys) {
@@ -10164,6 +10342,7 @@ function transformSchemaTypes(schema) {
10164
10342
  } = createVirtualFiles([{ name: "_openApi.d.ts", content: schema }]);
10165
10343
  const overridesMap = {};
10166
10344
  const componentsMap = {};
10345
+ const parametersMap = {};
10167
10346
  const existingTypes = [];
10168
10347
  const skipTypeNames = ["operations", "Schemas", "components"];
10169
10348
  function traverseThroughFileNodes(node) {
@@ -10212,10 +10391,10 @@ function transformSchemaTypes(schema) {
10212
10391
  if (sourceFile) {
10213
10392
  traverseThroughFileNodes(sourceFile);
10214
10393
  }
10215
- return [overridesMap, componentsMap, existingTypes];
10394
+ return [overridesMap, componentsMap, existingTypes, parametersMap];
10216
10395
  }
10217
10396
 
10218
- async function processAstSchemaAndOverrides([opMap, opComponents, opExistingTypes], overridingSchema, type, options) {
10397
+ async function processAstSchemaAndOverrides([opMap, opComponents, opExistingTypes, opParameters], overridingSchema, type, options) {
10219
10398
  const {
10220
10399
  sourceFiles: [sourceFile, overridesSourceFile]
10221
10400
  } = createVirtualFiles([
@@ -10238,12 +10417,14 @@ async function processAstSchemaAndOverrides([opMap, opComponents, opExistingType
10238
10417
  );
10239
10418
  const componentsMap = defu(oComponetsMap, opComponents);
10240
10419
  const existingTypes = opExistingTypes;
10420
+ const parametersMap = opParameters;
10241
10421
  const filePath = join("api-types", `${type}ApiTypes.d.ts`);
10242
10422
  await generateFile(
10243
10423
  filePath,
10244
10424
  operationsMap,
10245
10425
  existingTypes,
10246
10426
  componentsMap,
10427
+ parametersMap,
10247
10428
  options
10248
10429
  );
10249
10430
  }
@@ -10256,6 +10437,7 @@ function transformOpenApiTypes(schema) {
10256
10437
  } = createVirtualFiles([{ name: "_openApi.d.ts", content: schema }]);
10257
10438
  const operationsMap = {};
10258
10439
  const componentsMap = {};
10440
+ const parametersMap = {};
10259
10441
  const existingTypes = [];
10260
10442
  function traverseThroughFileNodes(node) {
10261
10443
  if (node.kind === ts.SyntaxKind.TypeAliasDeclaration) {
@@ -10471,6 +10653,26 @@ function transformOpenApiTypes(schema) {
10471
10653
  }
10472
10654
  }
10473
10655
  }
10656
+ const allParameters = getDeepProperty({
10657
+ type,
10658
+ names: ["parameters"],
10659
+ node,
10660
+ typeChecker
10661
+ });
10662
+ if (allParameters) {
10663
+ const parameterNames = getTypePropertyNames(allParameters);
10664
+ for (const parameterName of parameterNames) {
10665
+ const parameterCode = getDeepPropertyCode({
10666
+ type: allParameters,
10667
+ names: [parameterName],
10668
+ node,
10669
+ typeChecker
10670
+ });
10671
+ if (parameterCode) {
10672
+ parametersMap[parameterName] = parameterCode;
10673
+ }
10674
+ }
10675
+ }
10474
10676
  }
10475
10677
  const doNotMoveTypes = [
10476
10678
  "$defs",
@@ -10490,7 +10692,7 @@ function transformOpenApiTypes(schema) {
10490
10692
  if (sourceFile) {
10491
10693
  traverseThroughFileNodes(sourceFile);
10492
10694
  }
10493
- return [operationsMap, componentsMap, existingTypes];
10695
+ return [operationsMap, componentsMap, existingTypes, parametersMap];
10494
10696
  }
10495
10697
 
10496
10698
  async function generate(args) {
@@ -10523,8 +10725,9 @@ async function generate(args) {
10523
10725
  silent: true
10524
10726
  // we allow to not have the config file in this command
10525
10727
  });
10728
+ const apiTypeConfig = getApiTypeConfig(configJSON, args.apiType);
10526
10729
  const jsonOverrides = await loadJsonOverrides({
10527
- paths: configJSON?.patches,
10730
+ paths: apiTypeConfig.patches,
10528
10731
  apiType: args.apiType
10529
10732
  });
10530
10733
  if (args.debug) {
@@ -11017,7 +11220,8 @@ async function validateJson(args) {
11017
11220
  if (!configJSON) {
11018
11221
  process.exit(1);
11019
11222
  }
11020
- const rulesToProcess = configJSON.rules || [];
11223
+ const apiTypeConfig = getApiTypeConfig(configJSON, args.apiType);
11224
+ const rulesToProcess = apiTypeConfig.rules || [];
11021
11225
  if (!rulesToProcess.length) {
11022
11226
  console.error(
11023
11227
  c.red(
@@ -11028,7 +11232,7 @@ async function validateJson(args) {
11028
11232
  }
11029
11233
  const errors = [];
11030
11234
  const jsonOverrides = await loadJsonOverrides({
11031
- paths: configJSON.patches,
11235
+ paths: apiTypeConfig.patches,
11032
11236
  apiType: args.apiType
11033
11237
  });
11034
11238
  if (args.debug) {
@@ -11149,4 +11353,4 @@ async function validateJson(args) {
11149
11353
  }
11150
11354
  }
11151
11355
 
11152
- export { generate as g, loadSchema as l, validateJson as v };
11356
+ export { getAugmentedNamespace as a, commonjsGlobal as c, generate as g, loadSchema as l, validateJson as v };