@andersbakken/fisk 5.0.0 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7708,7 +7708,7 @@ function push(dest, name, elem) {
7708
7708
  * @return {Object} The parsed object
7709
7709
  * @public
7710
7710
  */
7711
- function parse$b(header) {
7711
+ function parse$a(header) {
7712
7712
  const offers = Object.create(null);
7713
7713
 
7714
7714
  if (header === undefined || header === '') return offers;
@@ -7859,7 +7859,7 @@ function parse$b(header) {
7859
7859
  * @return {String} A string representing the given object
7860
7860
  * @public
7861
7861
  */
7862
- function format$4(extensions) {
7862
+ function format$3(extensions) {
7863
7863
  return Object.keys(extensions)
7864
7864
  .map((extension) => {
7865
7865
  let configurations = extensions[extension];
@@ -7883,7 +7883,7 @@ function format$4(extensions) {
7883
7883
  .join(', ');
7884
7884
  }
7885
7885
 
7886
- var extension = { format: format$4, parse: parse$b };
7886
+ var extension = { format: format$3, parse: parse$a };
7887
7887
 
7888
7888
  /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Readable$" }] */
7889
7889
 
@@ -7907,7 +7907,7 @@ const {
7907
7907
  NOOP
7908
7908
  } = constants;
7909
7909
  const { addEventListener, removeEventListener } = eventTarget;
7910
- const { format: format$3, parse: parse$a } = extension;
7910
+ const { format: format$2, parse: parse$9 } = extension;
7911
7911
  const { toBuffer } = bufferUtilExports;
7912
7912
 
7913
7913
  const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];
@@ -8541,7 +8541,7 @@ function initAsClient(websocket, address, protocols, options) {
8541
8541
  false,
8542
8542
  opts.maxPayload
8543
8543
  );
8544
- opts.headers['Sec-WebSocket-Extensions'] = format$3({
8544
+ opts.headers['Sec-WebSocket-Extensions'] = format$2({
8545
8545
  [PerMessageDeflate$1.extensionName]: perMessageDeflate.offer()
8546
8546
  });
8547
8547
  }
@@ -8732,7 +8732,7 @@ function initAsClient(websocket, address, protocols, options) {
8732
8732
  let extensions;
8733
8733
 
8734
8734
  try {
8735
- extensions = parse$a(secWebSocketExtensions);
8735
+ extensions = parse$9(secWebSocketExtensions);
8736
8736
  } catch (err) {
8737
8737
  const message = 'Invalid Sec-WebSocket-Extensions header';
8738
8738
  abortHandshake$1(websocket, socket, message);
@@ -9267,7 +9267,7 @@ const { createHash } = crypto__default["default"];
9267
9267
 
9268
9268
  const PerMessageDeflate = permessageDeflate;
9269
9269
  const WebSocket$1 = websocket;
9270
- const { format: format$2, parse: parse$9 } = extension;
9270
+ const { format: format$1, parse: parse$8 } = extension;
9271
9271
  const { GUID, kWebSocket } = constants;
9272
9272
 
9273
9273
  const keyRegex = /^[+/0-9A-Za-z]{22}==$/;
@@ -9490,7 +9490,7 @@ class WebSocketServer extends EventEmitter {
9490
9490
  );
9491
9491
 
9492
9492
  try {
9493
- const offers = parse$9(req.headers['sec-websocket-extensions']);
9493
+ const offers = parse$8(req.headers['sec-websocket-extensions']);
9494
9494
 
9495
9495
  if (offers[PerMessageDeflate.extensionName]) {
9496
9496
  perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]);
@@ -9591,7 +9591,7 @@ class WebSocketServer extends EventEmitter {
9591
9591
 
9592
9592
  if (extensions[PerMessageDeflate.extensionName]) {
9593
9593
  const params = extensions[PerMessageDeflate.extensionName].params;
9594
- const value = format$2({
9594
+ const value = format$1({
9595
9595
  [PerMessageDeflate.extensionName]: [params]
9596
9596
  });
9597
9597
  headers.push(`Sec-WebSocket-Extensions: ${value}`);
@@ -10258,10 +10258,10 @@ function DeprecationError (namespace, message, stack) {
10258
10258
  return error
10259
10259
  }
10260
10260
 
10261
- var bytesExports = {};
10261
+ var bytesExports$1 = {};
10262
10262
  var bytes$1 = {
10263
- get exports(){ return bytesExports; },
10264
- set exports(v){ bytesExports = v; },
10263
+ get exports(){ return bytesExports$1; },
10264
+ set exports(v){ bytesExports$1 = v; },
10265
10265
  };
10266
10266
 
10267
10267
  /*!
@@ -10271,166 +10271,174 @@ var bytes$1 = {
10271
10271
  * MIT Licensed
10272
10272
  */
10273
10273
 
10274
- /**
10275
- * Module exports.
10276
- * @public
10277
- */
10274
+ var hasRequiredBytes;
10278
10275
 
10279
- bytes$1.exports = bytes;
10280
- bytesExports.format = format$1;
10281
- bytesExports.parse = parse$8;
10276
+ function requireBytes () {
10277
+ if (hasRequiredBytes) return bytesExports$1;
10278
+ hasRequiredBytes = 1;
10282
10279
 
10283
- /**
10284
- * Module variables.
10285
- * @private
10286
- */
10280
+ /**
10281
+ * Module exports.
10282
+ * @public
10283
+ */
10287
10284
 
10288
- var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
10285
+ bytes$1.exports = bytes;
10286
+ bytesExports$1.format = format;
10287
+ bytesExports$1.parse = parse;
10289
10288
 
10290
- var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
10289
+ /**
10290
+ * Module variables.
10291
+ * @private
10292
+ */
10291
10293
 
10292
- var map = {
10293
- b: 1,
10294
- kb: 1 << 10,
10295
- mb: 1 << 20,
10296
- gb: 1 << 30,
10297
- tb: Math.pow(1024, 4),
10298
- pb: Math.pow(1024, 5),
10299
- };
10294
+ var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
10300
10295
 
10301
- var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
10296
+ var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
10302
10297
 
10303
- /**
10304
- * Convert the given value in bytes into a string or parse to string to an integer in bytes.
10305
- *
10306
- * @param {string|number} value
10307
- * @param {{
10308
- * case: [string],
10309
- * decimalPlaces: [number]
10310
- * fixedDecimals: [boolean]
10311
- * thousandsSeparator: [string]
10312
- * unitSeparator: [string]
10313
- * }} [options] bytes options.
10314
- *
10315
- * @returns {string|number|null}
10316
- */
10298
+ var map = {
10299
+ b: 1,
10300
+ kb: 1 << 10,
10301
+ mb: 1 << 20,
10302
+ gb: 1 << 30,
10303
+ tb: Math.pow(1024, 4),
10304
+ pb: Math.pow(1024, 5),
10305
+ };
10317
10306
 
10318
- function bytes(value, options) {
10319
- if (typeof value === 'string') {
10320
- return parse$8(value);
10321
- }
10307
+ var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
10322
10308
 
10323
- if (typeof value === 'number') {
10324
- return format$1(value, options);
10325
- }
10309
+ /**
10310
+ * Convert the given value in bytes into a string or parse to string to an integer in bytes.
10311
+ *
10312
+ * @param {string|number} value
10313
+ * @param {{
10314
+ * case: [string],
10315
+ * decimalPlaces: [number]
10316
+ * fixedDecimals: [boolean]
10317
+ * thousandsSeparator: [string]
10318
+ * unitSeparator: [string]
10319
+ * }} [options] bytes options.
10320
+ *
10321
+ * @returns {string|number|null}
10322
+ */
10326
10323
 
10327
- return null;
10328
- }
10324
+ function bytes(value, options) {
10325
+ if (typeof value === 'string') {
10326
+ return parse(value);
10327
+ }
10329
10328
 
10330
- /**
10331
- * Format the given value in bytes into a string.
10332
- *
10333
- * If the value is negative, it is kept as such. If it is a float,
10334
- * it is rounded.
10335
- *
10336
- * @param {number} value
10337
- * @param {object} [options]
10338
- * @param {number} [options.decimalPlaces=2]
10339
- * @param {number} [options.fixedDecimals=false]
10340
- * @param {string} [options.thousandsSeparator=]
10341
- * @param {string} [options.unit=]
10342
- * @param {string} [options.unitSeparator=]
10343
- *
10344
- * @returns {string|null}
10345
- * @public
10346
- */
10329
+ if (typeof value === 'number') {
10330
+ return format(value, options);
10331
+ }
10347
10332
 
10348
- function format$1(value, options) {
10349
- if (!Number.isFinite(value)) {
10350
- return null;
10351
- }
10333
+ return null;
10334
+ }
10352
10335
 
10353
- var mag = Math.abs(value);
10354
- var thousandsSeparator = (options && options.thousandsSeparator) || '';
10355
- var unitSeparator = (options && options.unitSeparator) || '';
10356
- var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
10357
- var fixedDecimals = Boolean(options && options.fixedDecimals);
10358
- var unit = (options && options.unit) || '';
10359
-
10360
- if (!unit || !map[unit.toLowerCase()]) {
10361
- if (mag >= map.pb) {
10362
- unit = 'PB';
10363
- } else if (mag >= map.tb) {
10364
- unit = 'TB';
10365
- } else if (mag >= map.gb) {
10366
- unit = 'GB';
10367
- } else if (mag >= map.mb) {
10368
- unit = 'MB';
10369
- } else if (mag >= map.kb) {
10370
- unit = 'KB';
10371
- } else {
10372
- unit = 'B';
10373
- }
10374
- }
10336
+ /**
10337
+ * Format the given value in bytes into a string.
10338
+ *
10339
+ * If the value is negative, it is kept as such. If it is a float,
10340
+ * it is rounded.
10341
+ *
10342
+ * @param {number} value
10343
+ * @param {object} [options]
10344
+ * @param {number} [options.decimalPlaces=2]
10345
+ * @param {number} [options.fixedDecimals=false]
10346
+ * @param {string} [options.thousandsSeparator=]
10347
+ * @param {string} [options.unit=]
10348
+ * @param {string} [options.unitSeparator=]
10349
+ *
10350
+ * @returns {string|null}
10351
+ * @public
10352
+ */
10375
10353
 
10376
- var val = value / map[unit.toLowerCase()];
10377
- var str = val.toFixed(decimalPlaces);
10354
+ function format(value, options) {
10355
+ if (!Number.isFinite(value)) {
10356
+ return null;
10357
+ }
10378
10358
 
10379
- if (!fixedDecimals) {
10380
- str = str.replace(formatDecimalsRegExp, '$1');
10381
- }
10359
+ var mag = Math.abs(value);
10360
+ var thousandsSeparator = (options && options.thousandsSeparator) || '';
10361
+ var unitSeparator = (options && options.unitSeparator) || '';
10362
+ var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
10363
+ var fixedDecimals = Boolean(options && options.fixedDecimals);
10364
+ var unit = (options && options.unit) || '';
10365
+
10366
+ if (!unit || !map[unit.toLowerCase()]) {
10367
+ if (mag >= map.pb) {
10368
+ unit = 'PB';
10369
+ } else if (mag >= map.tb) {
10370
+ unit = 'TB';
10371
+ } else if (mag >= map.gb) {
10372
+ unit = 'GB';
10373
+ } else if (mag >= map.mb) {
10374
+ unit = 'MB';
10375
+ } else if (mag >= map.kb) {
10376
+ unit = 'KB';
10377
+ } else {
10378
+ unit = 'B';
10379
+ }
10380
+ }
10382
10381
 
10383
- if (thousandsSeparator) {
10384
- str = str.split('.').map(function (s, i) {
10385
- return i === 0
10386
- ? s.replace(formatThousandsRegExp, thousandsSeparator)
10387
- : s
10388
- }).join('.');
10389
- }
10382
+ var val = value / map[unit.toLowerCase()];
10383
+ var str = val.toFixed(decimalPlaces);
10390
10384
 
10391
- return str + unitSeparator + unit;
10392
- }
10385
+ if (!fixedDecimals) {
10386
+ str = str.replace(formatDecimalsRegExp, '$1');
10387
+ }
10393
10388
 
10394
- /**
10395
- * Parse the string value into an integer in bytes.
10396
- *
10397
- * If no unit is given, it is assumed the value is in bytes.
10398
- *
10399
- * @param {number|string} val
10400
- *
10401
- * @returns {number|null}
10402
- * @public
10403
- */
10389
+ if (thousandsSeparator) {
10390
+ str = str.split('.').map(function (s, i) {
10391
+ return i === 0
10392
+ ? s.replace(formatThousandsRegExp, thousandsSeparator)
10393
+ : s
10394
+ }).join('.');
10395
+ }
10404
10396
 
10405
- function parse$8(val) {
10406
- if (typeof val === 'number' && !isNaN(val)) {
10407
- return val;
10408
- }
10397
+ return str + unitSeparator + unit;
10398
+ }
10409
10399
 
10410
- if (typeof val !== 'string') {
10411
- return null;
10412
- }
10400
+ /**
10401
+ * Parse the string value into an integer in bytes.
10402
+ *
10403
+ * If no unit is given, it is assumed the value is in bytes.
10404
+ *
10405
+ * @param {number|string} val
10406
+ *
10407
+ * @returns {number|null}
10408
+ * @public
10409
+ */
10413
10410
 
10414
- // Test if the string passed is valid
10415
- var results = parseRegExp.exec(val);
10416
- var floatValue;
10417
- var unit = 'b';
10411
+ function parse(val) {
10412
+ if (typeof val === 'number' && !isNaN(val)) {
10413
+ return val;
10414
+ }
10418
10415
 
10419
- if (!results) {
10420
- // Nothing could be extracted from the given string
10421
- floatValue = parseInt(val, 10);
10422
- unit = 'b';
10423
- } else {
10424
- // Retrieve the value and the unit
10425
- floatValue = parseFloat(results[1]);
10426
- unit = results[4].toLowerCase();
10427
- }
10416
+ if (typeof val !== 'string') {
10417
+ return null;
10418
+ }
10428
10419
 
10429
- if (isNaN(floatValue)) {
10430
- return null;
10431
- }
10420
+ // Test if the string passed is valid
10421
+ var results = parseRegExp.exec(val);
10422
+ var floatValue;
10423
+ var unit = 'b';
10424
+
10425
+ if (!results) {
10426
+ // Nothing could be extracted from the given string
10427
+ floatValue = parseInt(val, 10);
10428
+ unit = 'b';
10429
+ } else {
10430
+ // Retrieve the value and the unit
10431
+ floatValue = parseFloat(results[1]);
10432
+ unit = results[4].toLowerCase();
10433
+ }
10432
10434
 
10433
- return Math.floor(map[unit] * floatValue);
10435
+ if (isNaN(floatValue)) {
10436
+ return null;
10437
+ }
10438
+
10439
+ return Math.floor(map[unit] * floatValue);
10440
+ }
10441
+ return bytesExports$1;
10434
10442
  }
10435
10443
 
10436
10444
  var contentType = {};
@@ -23600,7 +23608,7 @@ function requireRawBody () {
23600
23608
  */
23601
23609
 
23602
23610
  var asyncHooks = tryRequireAsyncHooks();
23603
- var bytes = bytesExports;
23611
+ var bytes = requireBytes();
23604
23612
  var createError = requireHttpErrors();
23605
23613
  var iconv = requireLib$1();
23606
23614
  var unpipe = requireUnpipe();
@@ -35978,7 +35986,7 @@ function requireJson () {
35978
35986
  * @private
35979
35987
  */
35980
35988
 
35981
- var bytes = bytesExports;
35989
+ var bytes = requireBytes();
35982
35990
  var contentType = requireContentType();
35983
35991
  var createError = requireHttpErrors();
35984
35992
  var debug = requireSrc()('body-parser:json');
@@ -36124,11 +36132,7 @@ function requireJson () {
36124
36132
  var partial = '';
36125
36133
 
36126
36134
  if (index !== -1) {
36127
- partial = str.substring(0, index) + JSON_SYNTAX_CHAR;
36128
-
36129
- for (var i = index + 1; i < str.length; i++) {
36130
- partial += JSON_SYNTAX_CHAR;
36131
- }
36135
+ partial = str.substring(0, index) + new Array(str.length - index + 1).join(JSON_SYNTAX_CHAR);
36132
36136
  }
36133
36137
 
36134
36138
  try {
@@ -36231,7 +36235,7 @@ function requireRaw () {
36231
36235
  * Module dependencies.
36232
36236
  */
36233
36237
 
36234
- var bytes = bytesExports;
36238
+ var bytes = requireBytes();
36235
36239
  var debug = requireSrc()('body-parser:raw');
36236
36240
  var read = requireRead();
36237
36241
  var typeis = requireTypeIs();
@@ -36340,7 +36344,7 @@ function requireText () {
36340
36344
  * Module dependencies.
36341
36345
  */
36342
36346
 
36343
- var bytes = bytesExports;
36347
+ var bytes = requireBytes();
36344
36348
  var contentType = requireContentType();
36345
36349
  var debug = requireSrc()('body-parser:text');
36346
36350
  var read = requireRead();
@@ -38466,7 +38470,7 @@ function requireUtils () {
38466
38470
  var hexTable = (function () {
38467
38471
  var array = [];
38468
38472
  for (var i = 0; i < 256; ++i) {
38469
- array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
38473
+ array[array.length] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase();
38470
38474
  }
38471
38475
 
38472
38476
  return array;
@@ -38482,7 +38486,7 @@ function requireUtils () {
38482
38486
 
38483
38487
  for (var j = 0; j < obj.length; ++j) {
38484
38488
  if (typeof obj[j] !== 'undefined') {
38485
- compacted.push(obj[j]);
38489
+ compacted[compacted.length] = obj[j];
38486
38490
  }
38487
38491
  }
38488
38492
 
@@ -38510,13 +38514,19 @@ function requireUtils () {
38510
38514
 
38511
38515
  if (typeof source !== 'object' && typeof source !== 'function') {
38512
38516
  if (isArray(target)) {
38513
- target.push(source);
38517
+ var nextIndex = target.length;
38518
+ if (options && typeof options.arrayLimit === 'number' && nextIndex > options.arrayLimit) {
38519
+ return markOverflow(arrayToObject(target.concat(source), options), nextIndex);
38520
+ }
38521
+ target[nextIndex] = source;
38514
38522
  } else if (target && typeof target === 'object') {
38515
38523
  if (isOverflow(target)) {
38516
38524
  // Add at next numeric index for overflow objects
38517
38525
  var newIndex = getMaxIndex(target) + 1;
38518
38526
  target[newIndex] = source;
38519
38527
  setMaxIndex(target, newIndex);
38528
+ } else if (options && options.strictMerge) {
38529
+ return [target, source];
38520
38530
  } else if (
38521
38531
  (options && (options.plainObjects || options.allowPrototypes))
38522
38532
  || !has.call(Object.prototype, source)
@@ -38543,7 +38553,11 @@ function requireUtils () {
38543
38553
  }
38544
38554
  return markOverflow(result, getMaxIndex(source) + 1);
38545
38555
  }
38546
- return [target].concat(source);
38556
+ var combined = [target].concat(source);
38557
+ if (options && typeof options.arrayLimit === 'number' && combined.length > options.arrayLimit) {
38558
+ return markOverflow(arrayToObject(combined, options), combined.length - 1);
38559
+ }
38560
+ return combined;
38547
38561
  }
38548
38562
 
38549
38563
  var mergeTarget = target;
@@ -38558,7 +38572,7 @@ function requireUtils () {
38558
38572
  if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
38559
38573
  target[i] = merge(targetItem, item, options);
38560
38574
  } else {
38561
- target.push(item);
38575
+ target[target.length] = item;
38562
38576
  }
38563
38577
  } else {
38564
38578
  target[i] = item;
@@ -38575,6 +38589,17 @@ function requireUtils () {
38575
38589
  } else {
38576
38590
  acc[key] = value;
38577
38591
  }
38592
+
38593
+ if (isOverflow(source) && !isOverflow(acc)) {
38594
+ markOverflow(acc, getMaxIndex(source));
38595
+ }
38596
+ if (isOverflow(acc)) {
38597
+ var keyNum = parseInt(key, 10);
38598
+ if (String(keyNum) === key && keyNum >= 0 && keyNum > getMaxIndex(acc)) {
38599
+ setMaxIndex(acc, keyNum);
38600
+ }
38601
+ }
38602
+
38578
38603
  return acc;
38579
38604
  }, mergeTarget);
38580
38605
  };
@@ -38691,8 +38716,8 @@ function requireUtils () {
38691
38716
  var key = keys[j];
38692
38717
  var val = obj[key];
38693
38718
  if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
38694
- queue.push({ obj: obj, prop: key });
38695
- refs.push(val);
38719
+ queue[queue.length] = { obj: obj, prop: key };
38720
+ refs[refs.length] = val;
38696
38721
  }
38697
38722
  }
38698
38723
  }
@@ -38734,7 +38759,7 @@ function requireUtils () {
38734
38759
  if (isArray(val)) {
38735
38760
  var mapped = [];
38736
38761
  for (var i = 0; i < val.length; i += 1) {
38737
- mapped.push(fn(val[i]));
38762
+ mapped[mapped.length] = fn(val[i]);
38738
38763
  }
38739
38764
  return mapped;
38740
38765
  }
@@ -38751,6 +38776,7 @@ function requireUtils () {
38751
38776
  isBuffer: isBuffer,
38752
38777
  isOverflow: isOverflow,
38753
38778
  isRegExp: isRegExp,
38779
+ markOverflow: markOverflow,
38754
38780
  maybeMap: maybeMap,
38755
38781
  merge: merge
38756
38782
  };
@@ -38882,7 +38908,7 @@ function requireStringify () {
38882
38908
 
38883
38909
  if (obj === null) {
38884
38910
  if (strictNullHandling) {
38885
- return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix;
38911
+ return formatter(encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix);
38886
38912
  }
38887
38913
 
38888
38914
  obj = '';
@@ -38906,7 +38932,9 @@ function requireStringify () {
38906
38932
  if (generateArrayPrefix === 'comma' && isArray(obj)) {
38907
38933
  // we need to join elements in
38908
38934
  if (encodeValuesOnly && encoder) {
38909
- obj = utils.maybeMap(obj, encoder);
38935
+ obj = utils.maybeMap(obj, function (v) {
38936
+ return v == null ? v : encoder(v);
38937
+ });
38910
38938
  }
38911
38939
  objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
38912
38940
  } else if (isArray(filter)) {
@@ -39076,6 +39104,11 @@ function requireStringify () {
39076
39104
  var sideChannel = getSideChannel();
39077
39105
  for (var i = 0; i < objKeys.length; ++i) {
39078
39106
  var key = objKeys[i];
39107
+
39108
+ if (typeof key === 'undefined' || key === null) {
39109
+ continue;
39110
+ }
39111
+
39079
39112
  var value = obj[key];
39080
39113
 
39081
39114
  if (options.skipNulls && value === null) {
@@ -39109,10 +39142,10 @@ function requireStringify () {
39109
39142
  if (options.charsetSentinel) {
39110
39143
  if (options.charset === 'iso-8859-1') {
39111
39144
  // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
39112
- prefix += 'utf8=%26%2310003%3B&';
39145
+ prefix += 'utf8=%26%2310003%3B' + options.delimiter;
39113
39146
  } else {
39114
39147
  // encodeURIComponent('✓')
39115
- prefix += 'utf8=%E2%9C%93&';
39148
+ prefix += 'utf8=%E2%9C%93' + options.delimiter;
39116
39149
  }
39117
39150
  }
39118
39151
 
@@ -39153,6 +39186,7 @@ function requireParse () {
39153
39186
  parseArrays: true,
39154
39187
  plainObjects: false,
39155
39188
  strictDepth: false,
39189
+ strictMerge: true,
39156
39190
  strictNullHandling: false,
39157
39191
  throwOnLimitExceeded: false
39158
39192
  };
@@ -39191,13 +39225,13 @@ function requireParse () {
39191
39225
  var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
39192
39226
  cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
39193
39227
 
39194
- var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
39228
+ var limit = options.parameterLimit === Infinity ? void undefined : options.parameterLimit;
39195
39229
  var parts = cleanStr.split(
39196
39230
  options.delimiter,
39197
- options.throwOnLimitExceeded ? limit + 1 : limit
39231
+ options.throwOnLimitExceeded && typeof limit !== 'undefined' ? limit + 1 : limit
39198
39232
  );
39199
39233
 
39200
- if (options.throwOnLimitExceeded && parts.length > limit) {
39234
+ if (options.throwOnLimitExceeded && typeof limit !== 'undefined' && parts.length > limit) {
39201
39235
  throw new RangeError('Parameter limit exceeded. Only ' + limit + ' parameter' + (limit === 1 ? '' : 's') + ' allowed.');
39202
39236
  }
39203
39237
 
@@ -39258,9 +39292,16 @@ function requireParse () {
39258
39292
  val = isArray(val) ? [val] : val;
39259
39293
  }
39260
39294
 
39295
+ if (options.comma && isArray(val) && val.length > options.arrayLimit) {
39296
+ if (options.throwOnLimitExceeded) {
39297
+ throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
39298
+ }
39299
+ val = utils.combine([], val, options.arrayLimit, options.plainObjects);
39300
+ }
39301
+
39261
39302
  if (key !== null) {
39262
39303
  var existing = has.call(obj, key);
39263
- if (existing && options.duplicates === 'combine') {
39304
+ if (existing && (options.duplicates === 'combine' || part.indexOf('[]=') > -1)) {
39264
39305
  obj[key] = utils.combine(
39265
39306
  obj[key],
39266
39307
  val,
@@ -39308,17 +39349,21 @@ function requireParse () {
39308
39349
  var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
39309
39350
  var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, '.') : cleanRoot;
39310
39351
  var index = parseInt(decodedRoot, 10);
39311
- if (!options.parseArrays && decodedRoot === '') {
39312
- obj = { 0: leaf };
39313
- } else if (
39314
- !isNaN(index)
39352
+ var isValidArrayIndex = !isNaN(index)
39315
39353
  && root !== decodedRoot
39316
39354
  && String(index) === decodedRoot
39317
39355
  && index >= 0
39318
- && (options.parseArrays && index <= options.arrayLimit)
39319
- ) {
39356
+ && options.parseArrays;
39357
+ if (!options.parseArrays && decodedRoot === '') {
39358
+ obj = { 0: leaf };
39359
+ } else if (isValidArrayIndex && index < options.arrayLimit) {
39320
39360
  obj = [];
39321
39361
  obj[index] = leaf;
39362
+ } else if (isValidArrayIndex && options.throwOnLimitExceeded) {
39363
+ throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
39364
+ } else if (isValidArrayIndex) {
39365
+ obj[index] = leaf;
39366
+ utils.markOverflow(obj, index);
39322
39367
  } else if (decodedRoot !== '__proto__') {
39323
39368
  obj[decodedRoot] = leaf;
39324
39369
  }
@@ -39330,9 +39375,12 @@ function requireParse () {
39330
39375
  return leaf;
39331
39376
  };
39332
39377
 
39333
- var splitKeyIntoSegments = function splitKeyIntoSegments(givenKey, options) {
39334
- var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
39378
+ // Split a key like "a[b][c[]]" into ['a', '[b]', '[c[]]'] while preserving
39379
+ // qs parse semantics for depth/prototype guards.
39380
+ var splitKeyIntoSegments = function splitKeyIntoSegments(originalKey, options) {
39381
+ var key = options.allowDots ? originalKey.replace(/\.([^.[]+)/g, '[$1]') : originalKey;
39335
39382
 
39383
+ // depth <= 0 keeps the whole key as one segment
39336
39384
  if (options.depth <= 0) {
39337
39385
  if (!options.plainObjects && has.call(Object.prototype, key)) {
39338
39386
  if (!options.allowPrototypes) {
@@ -39343,14 +39391,11 @@ function requireParse () {
39343
39391
  return [key];
39344
39392
  }
39345
39393
 
39346
- var brackets = /(\[[^[\]]*])/;
39347
- var child = /(\[[^[\]]*])/g;
39348
-
39349
- var segment = brackets.exec(key);
39350
- var parent = segment ? key.slice(0, segment.index) : key;
39351
-
39352
- var keys = [];
39394
+ var segments = [];
39353
39395
 
39396
+ // parent before the first '[' (may be empty if key starts with '[')
39397
+ var first = key.indexOf('[');
39398
+ var parent = first >= 0 ? key.slice(0, first) : key;
39354
39399
  if (parent) {
39355
39400
  if (!options.plainObjects && has.call(Object.prototype, parent)) {
39356
39401
  if (!options.allowPrototypes) {
@@ -39358,32 +39403,62 @@ function requireParse () {
39358
39403
  }
39359
39404
  }
39360
39405
 
39361
- keys.push(parent);
39406
+ segments[segments.length] = parent;
39362
39407
  }
39363
39408
 
39364
- var i = 0;
39365
- while ((segment = child.exec(key)) !== null && i < options.depth) {
39366
- i += 1;
39409
+ var n = key.length;
39410
+ var open = first;
39411
+ var collected = 0;
39367
39412
 
39368
- var segmentContent = segment[1].slice(1, -1);
39369
- if (!options.plainObjects && has.call(Object.prototype, segmentContent)) {
39370
- if (!options.allowPrototypes) {
39371
- return;
39413
+ while (open >= 0 && collected < options.depth) {
39414
+ var level = 1;
39415
+ var i = open + 1;
39416
+ var close = -1;
39417
+
39418
+ // balance nested '[' and ']' inside this bracket group using a nesting level counter
39419
+ while (i < n && close < 0) {
39420
+ var cu = key.charCodeAt(i);
39421
+ if (cu === 0x5B) { // '['
39422
+ level += 1;
39423
+ } else if (cu === 0x5D) { // ']'
39424
+ level -= 1;
39425
+ if (level === 0) {
39426
+ close = i; // found matching close; loop will exit by condition
39427
+ }
39372
39428
  }
39429
+ i += 1;
39430
+ }
39431
+
39432
+ if (close < 0) {
39433
+ // Unterminated group: wrap the raw remainder in one bracket pair so it stays
39434
+ // a single literal segment (e.g. "[[]b" -> "[[]b]"); we do not infer missing ']'.
39435
+ segments[segments.length] = '[' + key.slice(open) + ']';
39436
+ return segments;
39373
39437
  }
39374
39438
 
39375
- keys.push(segment[1]);
39439
+ var seg = key.slice(open, close + 1);
39440
+ // prototype guard for the content of this group
39441
+ var content = seg.slice(1, -1);
39442
+ if (!options.plainObjects && has.call(Object.prototype, content) && !options.allowPrototypes) {
39443
+ return;
39444
+ }
39445
+
39446
+ segments[segments.length] = seg;
39447
+ collected += 1;
39448
+
39449
+ // find the next '[' after this balanced group
39450
+ open = key.indexOf('[', close + 1);
39376
39451
  }
39377
39452
 
39378
- if (segment) {
39453
+ if (open >= 0) {
39379
39454
  if (options.strictDepth === true) {
39380
39455
  throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');
39381
39456
  }
39382
39457
 
39383
- keys.push('[' + key.slice(segment.index) + ']');
39458
+ segments[segments.length] = '[' + key.slice(open) + ']';
39384
39459
  }
39385
39460
 
39386
- return keys;
39461
+ return segments;
39387
39462
  };
39388
39463
 
39389
39464
  var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
@@ -39456,6 +39531,7 @@ function requireParse () {
39456
39531
  parseArrays: opts.parseArrays !== false,
39457
39532
  plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
39458
39533
  strictDepth: typeof opts.strictDepth === 'boolean' ? !!opts.strictDepth : defaults.strictDepth,
39534
+ strictMerge: typeof opts.strictMerge === 'boolean' ? !!opts.strictMerge : defaults.strictMerge,
39459
39535
  strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling,
39460
39536
  throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === 'boolean' ? opts.throwOnLimitExceeded : false
39461
39537
  };
@@ -39527,7 +39603,7 @@ function requireUrlencoded () {
39527
39603
  * @private
39528
39604
  */
39529
39605
 
39530
- var bytes = bytesExports;
39606
+ var bytes = requireBytes();
39531
39607
  var contentType = requireContentType();
39532
39608
  var createError = requireHttpErrors();
39533
39609
  var debug = requireSrc()('body-parser:urlencoded');
@@ -39721,16 +39797,15 @@ function requireUrlencoded () {
39721
39797
 
39722
39798
  function parameterCount (body, limit) {
39723
39799
  var count = 0;
39724
- var index = 0;
39800
+ var index = -1;
39725
39801
 
39726
- while ((index = body.indexOf('&', index)) !== -1) {
39802
+ do {
39727
39803
  count++;
39728
- index++;
39729
-
39730
- if (count === limit) {
39804
+ if (count > limit) {
39731
39805
  return undefined
39732
39806
  }
39733
- }
39807
+ index = body.indexOf('&', index + 1);
39808
+ } while (index !== -1)
39734
39809
 
39735
39810
  return count
39736
39811
  }
@@ -42579,6 +42654,7 @@ function pathToRegexp(path, keys, options) {
42579
42654
  pos = offset + match.length;
42580
42655
 
42581
42656
  if (match === '*') {
42657
+ backtrack = '';
42582
42658
  extraOffset += 3;
42583
42659
  return '(.*)';
42584
42660
  }
@@ -42608,6 +42684,7 @@ function pathToRegexp(path, keys, options) {
42608
42684
  + ')'
42609
42685
  + optional;
42610
42686
 
42687
+ backtrack = '';
42611
42688
  extraOffset += result.length - match.length;
42612
42689
 
42613
42690
  return result;
@@ -51491,7 +51568,8 @@ function trustSingle (subnet) {
51491
51568
 
51492
51569
  function parseExtendedQueryString(str) {
51493
51570
  return qs.parse(str, {
51494
- allowPrototypes: true
51571
+ allowPrototypes: true,
51572
+ arrayLimit: 1000
51495
51573
  });
51496
51574
  }
51497
51575
 
@@ -56404,6 +56482,9 @@ function common$1(option) {
56404
56482
  };
56405
56483
  }
56406
56484
 
56485
+ var bytesExports = requireBytes();
56486
+ var bytes = /*@__PURE__*/getDefaultExportFromCjs(bytesExports);
56487
+
56407
56488
  var compareVersionsExports = {};
56408
56489
  var compareVersions$1 = {
56409
56490
  get exports(){ return compareVersionsExports; },
@@ -57914,7 +57995,7 @@ const option = options({
57914
57995
  const common = common$1(option);
57915
57996
  let nextCommandId = 0;
57916
57997
  const server = new Server(option, common.Version);
57917
- const clientMinimumVersion = "4.0.53";
57998
+ const clientMinimumVersion = "4.0.69";
57918
57999
  const serverStartTime = Date.now();
57919
58000
  process.on("unhandledRejection", (reason, p) => {
57920
58001
  console.error("Unhandled Rejection at: Promise", p, "reason:", reason === null || reason === void 0 ? void 0 : reason.stack);
@@ -58180,7 +58261,7 @@ function purgeEnvironmentsToMaxSize() {
58180
58261
  return new Promise((resolve) => {
58181
58262
  let max = option("max-environment-size");
58182
58263
  if (typeof max === "string") {
58183
- max = bytesExports.parse(max);
58264
+ max = bytes.parse(max);
58184
58265
  }
58185
58266
  else if (typeof max !== "number") {
58186
58267
  max = 0;
@@ -58286,7 +58367,7 @@ function environmentsInfo() {
58286
58367
  const ret = Object.assign({}, Environments.instance.environments);
58287
58368
  ret.maxSize = option("max-environment-size") || 0;
58288
58369
  const max = option("max-environment-size");
58289
- ret.maxSizeBytes = max ? bytesExports.parse(String(max)) || 0 : 0;
58370
+ ret.maxSizeBytes = max ? bytes.parse(String(max)) || 0 : 0;
58290
58371
  let usedSizeBytes = 0;
58291
58372
  for (const hsh in Environments.instance.environments) {
58292
58373
  const env = Environments.instance.environments[hsh];
@@ -58294,7 +58375,7 @@ function environmentsInfo() {
58294
58375
  usedSizeBytes += env.size;
58295
58376
  }
58296
58377
  }
58297
- ret.usedSize = bytesExports.format(usedSizeBytes);
58378
+ ret.usedSize = bytes.format(usedSizeBytes);
58298
58379
  ret.links = Environments.instance.linksInfo();
58299
58380
  ret.usedSizeBytes = usedSizeBytes;
58300
58381
  return ret;