@andersbakken/fisk 5.0.1 → 5.0.3

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.
@@ -2508,7 +2508,7 @@ function push$1(dest, name, elem) {
2508
2508
  * @return {Object} The parsed object
2509
2509
  * @public
2510
2510
  */
2511
- function parse$e(header) {
2511
+ function parse$d(header) {
2512
2512
  const offers = Object.create(null);
2513
2513
 
2514
2514
  if (header === undefined || header === '') return offers;
@@ -2659,7 +2659,7 @@ function parse$e(header) {
2659
2659
  * @return {String} A string representing the given object
2660
2660
  * @public
2661
2661
  */
2662
- function format$6(extensions) {
2662
+ function format$5(extensions) {
2663
2663
  return Object.keys(extensions)
2664
2664
  .map((extension) => {
2665
2665
  let configurations = extensions[extension];
@@ -2683,7 +2683,7 @@ function format$6(extensions) {
2683
2683
  .join(', ');
2684
2684
  }
2685
2685
 
2686
- var extension = { format: format$6, parse: parse$e };
2686
+ var extension = { format: format$5, parse: parse$d };
2687
2687
 
2688
2688
  /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Readable$" }] */
2689
2689
 
@@ -2707,7 +2707,7 @@ const {
2707
2707
  NOOP
2708
2708
  } = constants$1;
2709
2709
  const { addEventListener, removeEventListener } = eventTarget;
2710
- const { format: format$5, parse: parse$d } = extension;
2710
+ const { format: format$4, parse: parse$c } = extension;
2711
2711
  const { toBuffer } = bufferUtilExports;
2712
2712
 
2713
2713
  const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];
@@ -3341,7 +3341,7 @@ function initAsClient(websocket, address, protocols, options) {
3341
3341
  false,
3342
3342
  opts.maxPayload
3343
3343
  );
3344
- opts.headers['Sec-WebSocket-Extensions'] = format$5({
3344
+ opts.headers['Sec-WebSocket-Extensions'] = format$4({
3345
3345
  [PerMessageDeflate$1.extensionName]: perMessageDeflate.offer()
3346
3346
  });
3347
3347
  }
@@ -3532,7 +3532,7 @@ function initAsClient(websocket, address, protocols, options) {
3532
3532
  let extensions;
3533
3533
 
3534
3534
  try {
3535
- extensions = parse$d(secWebSocketExtensions);
3535
+ extensions = parse$c(secWebSocketExtensions);
3536
3536
  } catch (err) {
3537
3537
  const message = 'Invalid Sec-WebSocket-Extensions header';
3538
3538
  abortHandshake$1(websocket, socket, message);
@@ -4067,7 +4067,7 @@ const { createHash } = require$$5__default["default"];
4067
4067
 
4068
4068
  const PerMessageDeflate = permessageDeflate;
4069
4069
  const WebSocket$1 = websocket;
4070
- const { format: format$4, parse: parse$c } = extension;
4070
+ const { format: format$3, parse: parse$b } = extension;
4071
4071
  const { GUID, kWebSocket } = constants$1;
4072
4072
 
4073
4073
  const keyRegex = /^[+/0-9A-Za-z]{22}==$/;
@@ -4290,7 +4290,7 @@ class WebSocketServer extends EventEmitter$1 {
4290
4290
  );
4291
4291
 
4292
4292
  try {
4293
- const offers = parse$c(req.headers['sec-websocket-extensions']);
4293
+ const offers = parse$b(req.headers['sec-websocket-extensions']);
4294
4294
 
4295
4295
  if (offers[PerMessageDeflate.extensionName]) {
4296
4296
  perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]);
@@ -4391,7 +4391,7 @@ class WebSocketServer extends EventEmitter$1 {
4391
4391
 
4392
4392
  if (extensions[PerMessageDeflate.extensionName]) {
4393
4393
  const params = extensions[PerMessageDeflate.extensionName].params;
4394
- const value = format$4({
4394
+ const value = format$3({
4395
4395
  [PerMessageDeflate.extensionName]: [params]
4396
4396
  });
4397
4397
  headers.push(`Sec-WebSocket-Extensions: ${value}`);
@@ -9512,10 +9512,10 @@ function DeprecationError (namespace, message, stack) {
9512
9512
  return error
9513
9513
  }
9514
9514
 
9515
- var bytesExports = {};
9515
+ var bytesExports$1 = {};
9516
9516
  var bytes$1 = {
9517
- get exports(){ return bytesExports; },
9518
- set exports(v){ bytesExports = v; },
9517
+ get exports(){ return bytesExports$1; },
9518
+ set exports(v){ bytesExports$1 = v; },
9519
9519
  };
9520
9520
 
9521
9521
  /*!
@@ -9525,166 +9525,174 @@ var bytes$1 = {
9525
9525
  * MIT Licensed
9526
9526
  */
9527
9527
 
9528
- /**
9529
- * Module exports.
9530
- * @public
9531
- */
9528
+ var hasRequiredBytes;
9532
9529
 
9533
- bytes$1.exports = bytes;
9534
- bytesExports.format = format$3;
9535
- bytesExports.parse = parse$b;
9530
+ function requireBytes () {
9531
+ if (hasRequiredBytes) return bytesExports$1;
9532
+ hasRequiredBytes = 1;
9536
9533
 
9537
- /**
9538
- * Module variables.
9539
- * @private
9540
- */
9534
+ /**
9535
+ * Module exports.
9536
+ * @public
9537
+ */
9541
9538
 
9542
- var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
9539
+ bytes$1.exports = bytes;
9540
+ bytesExports$1.format = format;
9541
+ bytesExports$1.parse = parse;
9543
9542
 
9544
- var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
9543
+ /**
9544
+ * Module variables.
9545
+ * @private
9546
+ */
9545
9547
 
9546
- var map = {
9547
- b: 1,
9548
- kb: 1 << 10,
9549
- mb: 1 << 20,
9550
- gb: 1 << 30,
9551
- tb: Math.pow(1024, 4),
9552
- pb: Math.pow(1024, 5),
9553
- };
9548
+ var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
9554
9549
 
9555
- var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
9550
+ var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
9556
9551
 
9557
- /**
9558
- * Convert the given value in bytes into a string or parse to string to an integer in bytes.
9559
- *
9560
- * @param {string|number} value
9561
- * @param {{
9562
- * case: [string],
9563
- * decimalPlaces: [number]
9564
- * fixedDecimals: [boolean]
9565
- * thousandsSeparator: [string]
9566
- * unitSeparator: [string]
9567
- * }} [options] bytes options.
9568
- *
9569
- * @returns {string|number|null}
9570
- */
9552
+ var map = {
9553
+ b: 1,
9554
+ kb: 1 << 10,
9555
+ mb: 1 << 20,
9556
+ gb: 1 << 30,
9557
+ tb: Math.pow(1024, 4),
9558
+ pb: Math.pow(1024, 5),
9559
+ };
9571
9560
 
9572
- function bytes(value, options) {
9573
- if (typeof value === 'string') {
9574
- return parse$b(value);
9575
- }
9561
+ var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
9576
9562
 
9577
- if (typeof value === 'number') {
9578
- return format$3(value, options);
9579
- }
9563
+ /**
9564
+ * Convert the given value in bytes into a string or parse to string to an integer in bytes.
9565
+ *
9566
+ * @param {string|number} value
9567
+ * @param {{
9568
+ * case: [string],
9569
+ * decimalPlaces: [number]
9570
+ * fixedDecimals: [boolean]
9571
+ * thousandsSeparator: [string]
9572
+ * unitSeparator: [string]
9573
+ * }} [options] bytes options.
9574
+ *
9575
+ * @returns {string|number|null}
9576
+ */
9580
9577
 
9581
- return null;
9582
- }
9578
+ function bytes(value, options) {
9579
+ if (typeof value === 'string') {
9580
+ return parse(value);
9581
+ }
9583
9582
 
9584
- /**
9585
- * Format the given value in bytes into a string.
9586
- *
9587
- * If the value is negative, it is kept as such. If it is a float,
9588
- * it is rounded.
9589
- *
9590
- * @param {number} value
9591
- * @param {object} [options]
9592
- * @param {number} [options.decimalPlaces=2]
9593
- * @param {number} [options.fixedDecimals=false]
9594
- * @param {string} [options.thousandsSeparator=]
9595
- * @param {string} [options.unit=]
9596
- * @param {string} [options.unitSeparator=]
9597
- *
9598
- * @returns {string|null}
9599
- * @public
9600
- */
9583
+ if (typeof value === 'number') {
9584
+ return format(value, options);
9585
+ }
9601
9586
 
9602
- function format$3(value, options) {
9603
- if (!Number.isFinite(value)) {
9604
- return null;
9605
- }
9587
+ return null;
9588
+ }
9606
9589
 
9607
- var mag = Math.abs(value);
9608
- var thousandsSeparator = (options && options.thousandsSeparator) || '';
9609
- var unitSeparator = (options && options.unitSeparator) || '';
9610
- var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
9611
- var fixedDecimals = Boolean(options && options.fixedDecimals);
9612
- var unit = (options && options.unit) || '';
9613
-
9614
- if (!unit || !map[unit.toLowerCase()]) {
9615
- if (mag >= map.pb) {
9616
- unit = 'PB';
9617
- } else if (mag >= map.tb) {
9618
- unit = 'TB';
9619
- } else if (mag >= map.gb) {
9620
- unit = 'GB';
9621
- } else if (mag >= map.mb) {
9622
- unit = 'MB';
9623
- } else if (mag >= map.kb) {
9624
- unit = 'KB';
9625
- } else {
9626
- unit = 'B';
9627
- }
9628
- }
9590
+ /**
9591
+ * Format the given value in bytes into a string.
9592
+ *
9593
+ * If the value is negative, it is kept as such. If it is a float,
9594
+ * it is rounded.
9595
+ *
9596
+ * @param {number} value
9597
+ * @param {object} [options]
9598
+ * @param {number} [options.decimalPlaces=2]
9599
+ * @param {number} [options.fixedDecimals=false]
9600
+ * @param {string} [options.thousandsSeparator=]
9601
+ * @param {string} [options.unit=]
9602
+ * @param {string} [options.unitSeparator=]
9603
+ *
9604
+ * @returns {string|null}
9605
+ * @public
9606
+ */
9629
9607
 
9630
- var val = value / map[unit.toLowerCase()];
9631
- var str = val.toFixed(decimalPlaces);
9608
+ function format(value, options) {
9609
+ if (!Number.isFinite(value)) {
9610
+ return null;
9611
+ }
9632
9612
 
9633
- if (!fixedDecimals) {
9634
- str = str.replace(formatDecimalsRegExp, '$1');
9635
- }
9613
+ var mag = Math.abs(value);
9614
+ var thousandsSeparator = (options && options.thousandsSeparator) || '';
9615
+ var unitSeparator = (options && options.unitSeparator) || '';
9616
+ var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
9617
+ var fixedDecimals = Boolean(options && options.fixedDecimals);
9618
+ var unit = (options && options.unit) || '';
9619
+
9620
+ if (!unit || !map[unit.toLowerCase()]) {
9621
+ if (mag >= map.pb) {
9622
+ unit = 'PB';
9623
+ } else if (mag >= map.tb) {
9624
+ unit = 'TB';
9625
+ } else if (mag >= map.gb) {
9626
+ unit = 'GB';
9627
+ } else if (mag >= map.mb) {
9628
+ unit = 'MB';
9629
+ } else if (mag >= map.kb) {
9630
+ unit = 'KB';
9631
+ } else {
9632
+ unit = 'B';
9633
+ }
9634
+ }
9636
9635
 
9637
- if (thousandsSeparator) {
9638
- str = str.split('.').map(function (s, i) {
9639
- return i === 0
9640
- ? s.replace(formatThousandsRegExp, thousandsSeparator)
9641
- : s
9642
- }).join('.');
9643
- }
9636
+ var val = value / map[unit.toLowerCase()];
9637
+ var str = val.toFixed(decimalPlaces);
9644
9638
 
9645
- return str + unitSeparator + unit;
9646
- }
9639
+ if (!fixedDecimals) {
9640
+ str = str.replace(formatDecimalsRegExp, '$1');
9641
+ }
9647
9642
 
9648
- /**
9649
- * Parse the string value into an integer in bytes.
9650
- *
9651
- * If no unit is given, it is assumed the value is in bytes.
9652
- *
9653
- * @param {number|string} val
9654
- *
9655
- * @returns {number|null}
9656
- * @public
9657
- */
9643
+ if (thousandsSeparator) {
9644
+ str = str.split('.').map(function (s, i) {
9645
+ return i === 0
9646
+ ? s.replace(formatThousandsRegExp, thousandsSeparator)
9647
+ : s
9648
+ }).join('.');
9649
+ }
9658
9650
 
9659
- function parse$b(val) {
9660
- if (typeof val === 'number' && !isNaN(val)) {
9661
- return val;
9662
- }
9651
+ return str + unitSeparator + unit;
9652
+ }
9663
9653
 
9664
- if (typeof val !== 'string') {
9665
- return null;
9666
- }
9654
+ /**
9655
+ * Parse the string value into an integer in bytes.
9656
+ *
9657
+ * If no unit is given, it is assumed the value is in bytes.
9658
+ *
9659
+ * @param {number|string} val
9660
+ *
9661
+ * @returns {number|null}
9662
+ * @public
9663
+ */
9664
+
9665
+ function parse(val) {
9666
+ if (typeof val === 'number' && !isNaN(val)) {
9667
+ return val;
9668
+ }
9667
9669
 
9668
- // Test if the string passed is valid
9669
- var results = parseRegExp.exec(val);
9670
- var floatValue;
9671
- var unit = 'b';
9670
+ if (typeof val !== 'string') {
9671
+ return null;
9672
+ }
9672
9673
 
9673
- if (!results) {
9674
- // Nothing could be extracted from the given string
9675
- floatValue = parseInt(val, 10);
9676
- unit = 'b';
9677
- } else {
9678
- // Retrieve the value and the unit
9679
- floatValue = parseFloat(results[1]);
9680
- unit = results[4].toLowerCase();
9681
- }
9674
+ // Test if the string passed is valid
9675
+ var results = parseRegExp.exec(val);
9676
+ var floatValue;
9677
+ var unit = 'b';
9682
9678
 
9683
- if (isNaN(floatValue)) {
9684
- return null;
9685
- }
9679
+ if (!results) {
9680
+ // Nothing could be extracted from the given string
9681
+ floatValue = parseInt(val, 10);
9682
+ unit = 'b';
9683
+ } else {
9684
+ // Retrieve the value and the unit
9685
+ floatValue = parseFloat(results[1]);
9686
+ unit = results[4].toLowerCase();
9687
+ }
9686
9688
 
9687
- return Math.floor(map[unit] * floatValue);
9689
+ if (isNaN(floatValue)) {
9690
+ return null;
9691
+ }
9692
+
9693
+ return Math.floor(map[unit] * floatValue);
9694
+ }
9695
+ return bytesExports$1;
9688
9696
  }
9689
9697
 
9690
9698
  var contentType = {};
@@ -22805,7 +22813,7 @@ function requireRawBody () {
22805
22813
  */
22806
22814
 
22807
22815
  var asyncHooks = tryRequireAsyncHooks();
22808
- var bytes = bytesExports;
22816
+ var bytes = requireBytes();
22809
22817
  var createError = httpErrorsExports;
22810
22818
  var iconv = requireLib();
22811
22819
  var unpipe = unpipe_1;
@@ -35154,7 +35162,7 @@ function requireJson () {
35154
35162
  * @private
35155
35163
  */
35156
35164
 
35157
- var bytes = bytesExports;
35165
+ var bytes = requireBytes();
35158
35166
  var contentType$1 = contentType;
35159
35167
  var createError = httpErrorsExports;
35160
35168
  var debug = requireSrc$1()('body-parser:json');
@@ -35300,11 +35308,7 @@ function requireJson () {
35300
35308
  var partial = '';
35301
35309
 
35302
35310
  if (index !== -1) {
35303
- partial = str.substring(0, index) + JSON_SYNTAX_CHAR;
35304
-
35305
- for (var i = index + 1; i < str.length; i++) {
35306
- partial += JSON_SYNTAX_CHAR;
35307
- }
35311
+ partial = str.substring(0, index) + new Array(str.length - index + 1).join(JSON_SYNTAX_CHAR);
35308
35312
  }
35309
35313
 
35310
35314
  try {
@@ -35407,7 +35411,7 @@ function requireRaw () {
35407
35411
  * Module dependencies.
35408
35412
  */
35409
35413
 
35410
- var bytes = bytesExports;
35414
+ var bytes = requireBytes();
35411
35415
  var debug = requireSrc$1()('body-parser:raw');
35412
35416
  var read = requireRead();
35413
35417
  var typeis = typeIsExports;
@@ -35516,7 +35520,7 @@ function requireText () {
35516
35520
  * Module dependencies.
35517
35521
  */
35518
35522
 
35519
- var bytes = bytesExports;
35523
+ var bytes = requireBytes();
35520
35524
  var contentType$1 = contentType;
35521
35525
  var debug = requireSrc$1()('body-parser:text');
35522
35526
  var read = requireRead();
@@ -37358,7 +37362,7 @@ var setMaxIndex = function setMaxIndex(obj, maxIndex) {
37358
37362
  var hexTable = (function () {
37359
37363
  var array = [];
37360
37364
  for (var i = 0; i < 256; ++i) {
37361
- array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
37365
+ array[array.length] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase();
37362
37366
  }
37363
37367
 
37364
37368
  return array;
@@ -37374,7 +37378,7 @@ var compactQueue = function compactQueue(queue) {
37374
37378
 
37375
37379
  for (var j = 0; j < obj.length; ++j) {
37376
37380
  if (typeof obj[j] !== 'undefined') {
37377
- compacted.push(obj[j]);
37381
+ compacted[compacted.length] = obj[j];
37378
37382
  }
37379
37383
  }
37380
37384
 
@@ -37402,13 +37406,19 @@ var merge$3 = function merge(target, source, options) {
37402
37406
 
37403
37407
  if (typeof source !== 'object' && typeof source !== 'function') {
37404
37408
  if (isArray$3(target)) {
37405
- target.push(source);
37409
+ var nextIndex = target.length;
37410
+ if (options && typeof options.arrayLimit === 'number' && nextIndex > options.arrayLimit) {
37411
+ return markOverflow(arrayToObject(target.concat(source), options), nextIndex);
37412
+ }
37413
+ target[nextIndex] = source;
37406
37414
  } else if (target && typeof target === 'object') {
37407
37415
  if (isOverflow(target)) {
37408
37416
  // Add at next numeric index for overflow objects
37409
37417
  var newIndex = getMaxIndex(target) + 1;
37410
37418
  target[newIndex] = source;
37411
37419
  setMaxIndex(target, newIndex);
37420
+ } else if (options && options.strictMerge) {
37421
+ return [target, source];
37412
37422
  } else if (
37413
37423
  (options && (options.plainObjects || options.allowPrototypes))
37414
37424
  || !has$2.call(Object.prototype, source)
@@ -37435,7 +37445,11 @@ var merge$3 = function merge(target, source, options) {
37435
37445
  }
37436
37446
  return markOverflow(result, getMaxIndex(source) + 1);
37437
37447
  }
37438
- return [target].concat(source);
37448
+ var combined = [target].concat(source);
37449
+ if (options && typeof options.arrayLimit === 'number' && combined.length > options.arrayLimit) {
37450
+ return markOverflow(arrayToObject(combined, options), combined.length - 1);
37451
+ }
37452
+ return combined;
37439
37453
  }
37440
37454
 
37441
37455
  var mergeTarget = target;
@@ -37450,7 +37464,7 @@ var merge$3 = function merge(target, source, options) {
37450
37464
  if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
37451
37465
  target[i] = merge(targetItem, item, options);
37452
37466
  } else {
37453
- target.push(item);
37467
+ target[target.length] = item;
37454
37468
  }
37455
37469
  } else {
37456
37470
  target[i] = item;
@@ -37467,6 +37481,17 @@ var merge$3 = function merge(target, source, options) {
37467
37481
  } else {
37468
37482
  acc[key] = value;
37469
37483
  }
37484
+
37485
+ if (isOverflow(source) && !isOverflow(acc)) {
37486
+ markOverflow(acc, getMaxIndex(source));
37487
+ }
37488
+ if (isOverflow(acc)) {
37489
+ var keyNum = parseInt(key, 10);
37490
+ if (String(keyNum) === key && keyNum >= 0 && keyNum > getMaxIndex(acc)) {
37491
+ setMaxIndex(acc, keyNum);
37492
+ }
37493
+ }
37494
+
37470
37495
  return acc;
37471
37496
  }, mergeTarget);
37472
37497
  };
@@ -37583,8 +37608,8 @@ var compact = function compact(value) {
37583
37608
  var key = keys[j];
37584
37609
  var val = obj[key];
37585
37610
  if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
37586
- queue.push({ obj: obj, prop: key });
37587
- refs.push(val);
37611
+ queue[queue.length] = { obj: obj, prop: key };
37612
+ refs[refs.length] = val;
37588
37613
  }
37589
37614
  }
37590
37615
  }
@@ -37626,7 +37651,7 @@ var maybeMap = function maybeMap(val, fn) {
37626
37651
  if (isArray$3(val)) {
37627
37652
  var mapped = [];
37628
37653
  for (var i = 0; i < val.length; i += 1) {
37629
- mapped.push(fn(val[i]));
37654
+ mapped[mapped.length] = fn(val[i]);
37630
37655
  }
37631
37656
  return mapped;
37632
37657
  }
@@ -37643,6 +37668,7 @@ var utils$d = {
37643
37668
  isBuffer: isBuffer$1,
37644
37669
  isOverflow: isOverflow,
37645
37670
  isRegExp: isRegExp,
37671
+ markOverflow: markOverflow,
37646
37672
  maybeMap: maybeMap,
37647
37673
  merge: merge$3
37648
37674
  };
@@ -37765,7 +37791,7 @@ var stringify$2 = function stringify(
37765
37791
 
37766
37792
  if (obj === null) {
37767
37793
  if (strictNullHandling) {
37768
- return encoder && !encodeValuesOnly ? encoder(prefix, defaults$5.encoder, charset, 'key', format) : prefix;
37794
+ return formatter(encoder && !encodeValuesOnly ? encoder(prefix, defaults$5.encoder, charset, 'key', format) : prefix);
37769
37795
  }
37770
37796
 
37771
37797
  obj = '';
@@ -37789,7 +37815,9 @@ var stringify$2 = function stringify(
37789
37815
  if (generateArrayPrefix === 'comma' && isArray$2(obj)) {
37790
37816
  // we need to join elements in
37791
37817
  if (encodeValuesOnly && encoder) {
37792
- obj = utils$c.maybeMap(obj, encoder);
37818
+ obj = utils$c.maybeMap(obj, function (v) {
37819
+ return v == null ? v : encoder(v);
37820
+ });
37793
37821
  }
37794
37822
  objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
37795
37823
  } else if (isArray$2(filter)) {
@@ -37959,6 +37987,11 @@ var stringify_1 = function (object, opts) {
37959
37987
  var sideChannel = getSideChannel();
37960
37988
  for (var i = 0; i < objKeys.length; ++i) {
37961
37989
  var key = objKeys[i];
37990
+
37991
+ if (typeof key === 'undefined' || key === null) {
37992
+ continue;
37993
+ }
37994
+
37962
37995
  var value = obj[key];
37963
37996
 
37964
37997
  if (options.skipNulls && value === null) {
@@ -37992,10 +38025,10 @@ var stringify_1 = function (object, opts) {
37992
38025
  if (options.charsetSentinel) {
37993
38026
  if (options.charset === 'iso-8859-1') {
37994
38027
  // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
37995
- prefix += 'utf8=%26%2310003%3B&';
38028
+ prefix += 'utf8=%26%2310003%3B' + options.delimiter;
37996
38029
  } else {
37997
38030
  // encodeURIComponent('✓')
37998
- prefix += 'utf8=%E2%9C%93&';
38031
+ prefix += 'utf8=%E2%9C%93' + options.delimiter;
37999
38032
  }
38000
38033
  }
38001
38034
 
@@ -38027,6 +38060,7 @@ var defaults$4 = {
38027
38060
  parseArrays: true,
38028
38061
  plainObjects: false,
38029
38062
  strictDepth: false,
38063
+ strictMerge: true,
38030
38064
  strictNullHandling: false,
38031
38065
  throwOnLimitExceeded: false
38032
38066
  };
@@ -38065,13 +38099,13 @@ var parseValues = function parseQueryStringValues(str, options) {
38065
38099
  var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
38066
38100
  cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
38067
38101
 
38068
- var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
38102
+ var limit = options.parameterLimit === Infinity ? void undefined : options.parameterLimit;
38069
38103
  var parts = cleanStr.split(
38070
38104
  options.delimiter,
38071
- options.throwOnLimitExceeded ? limit + 1 : limit
38105
+ options.throwOnLimitExceeded && typeof limit !== 'undefined' ? limit + 1 : limit
38072
38106
  );
38073
38107
 
38074
- if (options.throwOnLimitExceeded && parts.length > limit) {
38108
+ if (options.throwOnLimitExceeded && typeof limit !== 'undefined' && parts.length > limit) {
38075
38109
  throw new RangeError('Parameter limit exceeded. Only ' + limit + ' parameter' + (limit === 1 ? '' : 's') + ' allowed.');
38076
38110
  }
38077
38111
 
@@ -38132,9 +38166,16 @@ var parseValues = function parseQueryStringValues(str, options) {
38132
38166
  val = isArray$1(val) ? [val] : val;
38133
38167
  }
38134
38168
 
38169
+ if (options.comma && isArray$1(val) && val.length > options.arrayLimit) {
38170
+ if (options.throwOnLimitExceeded) {
38171
+ throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
38172
+ }
38173
+ val = utils$b.combine([], val, options.arrayLimit, options.plainObjects);
38174
+ }
38175
+
38135
38176
  if (key !== null) {
38136
38177
  var existing = has.call(obj, key);
38137
- if (existing && options.duplicates === 'combine') {
38178
+ if (existing && (options.duplicates === 'combine' || part.indexOf('[]=') > -1)) {
38138
38179
  obj[key] = utils$b.combine(
38139
38180
  obj[key],
38140
38181
  val,
@@ -38182,17 +38223,21 @@ var parseObject = function (chain, val, options, valuesParsed) {
38182
38223
  var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
38183
38224
  var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, '.') : cleanRoot;
38184
38225
  var index = parseInt(decodedRoot, 10);
38185
- if (!options.parseArrays && decodedRoot === '') {
38186
- obj = { 0: leaf };
38187
- } else if (
38188
- !isNaN(index)
38226
+ var isValidArrayIndex = !isNaN(index)
38189
38227
  && root !== decodedRoot
38190
38228
  && String(index) === decodedRoot
38191
38229
  && index >= 0
38192
- && (options.parseArrays && index <= options.arrayLimit)
38193
- ) {
38230
+ && options.parseArrays;
38231
+ if (!options.parseArrays && decodedRoot === '') {
38232
+ obj = { 0: leaf };
38233
+ } else if (isValidArrayIndex && index < options.arrayLimit) {
38194
38234
  obj = [];
38195
38235
  obj[index] = leaf;
38236
+ } else if (isValidArrayIndex && options.throwOnLimitExceeded) {
38237
+ throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
38238
+ } else if (isValidArrayIndex) {
38239
+ obj[index] = leaf;
38240
+ utils$b.markOverflow(obj, index);
38196
38241
  } else if (decodedRoot !== '__proto__') {
38197
38242
  obj[decodedRoot] = leaf;
38198
38243
  }
@@ -38204,9 +38249,12 @@ var parseObject = function (chain, val, options, valuesParsed) {
38204
38249
  return leaf;
38205
38250
  };
38206
38251
 
38207
- var splitKeyIntoSegments = function splitKeyIntoSegments(givenKey, options) {
38208
- var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
38252
+ // Split a key like "a[b][c[]]" into ['a', '[b]', '[c[]]'] while preserving
38253
+ // qs parse semantics for depth/prototype guards.
38254
+ var splitKeyIntoSegments = function splitKeyIntoSegments(originalKey, options) {
38255
+ var key = options.allowDots ? originalKey.replace(/\.([^.[]+)/g, '[$1]') : originalKey;
38209
38256
 
38257
+ // depth <= 0 keeps the whole key as one segment
38210
38258
  if (options.depth <= 0) {
38211
38259
  if (!options.plainObjects && has.call(Object.prototype, key)) {
38212
38260
  if (!options.allowPrototypes) {
@@ -38217,14 +38265,11 @@ var splitKeyIntoSegments = function splitKeyIntoSegments(givenKey, options) {
38217
38265
  return [key];
38218
38266
  }
38219
38267
 
38220
- var brackets = /(\[[^[\]]*])/;
38221
- var child = /(\[[^[\]]*])/g;
38222
-
38223
- var segment = brackets.exec(key);
38224
- var parent = segment ? key.slice(0, segment.index) : key;
38225
-
38226
- var keys = [];
38268
+ var segments = [];
38227
38269
 
38270
+ // parent before the first '[' (may be empty if key starts with '[')
38271
+ var first = key.indexOf('[');
38272
+ var parent = first >= 0 ? key.slice(0, first) : key;
38228
38273
  if (parent) {
38229
38274
  if (!options.plainObjects && has.call(Object.prototype, parent)) {
38230
38275
  if (!options.allowPrototypes) {
@@ -38232,32 +38277,62 @@ var splitKeyIntoSegments = function splitKeyIntoSegments(givenKey, options) {
38232
38277
  }
38233
38278
  }
38234
38279
 
38235
- keys.push(parent);
38280
+ segments[segments.length] = parent;
38236
38281
  }
38237
38282
 
38238
- var i = 0;
38239
- while ((segment = child.exec(key)) !== null && i < options.depth) {
38240
- i += 1;
38283
+ var n = key.length;
38284
+ var open = first;
38285
+ var collected = 0;
38241
38286
 
38242
- var segmentContent = segment[1].slice(1, -1);
38243
- if (!options.plainObjects && has.call(Object.prototype, segmentContent)) {
38244
- if (!options.allowPrototypes) {
38245
- return;
38287
+ while (open >= 0 && collected < options.depth) {
38288
+ var level = 1;
38289
+ var i = open + 1;
38290
+ var close = -1;
38291
+
38292
+ // balance nested '[' and ']' inside this bracket group using a nesting level counter
38293
+ while (i < n && close < 0) {
38294
+ var cu = key.charCodeAt(i);
38295
+ if (cu === 0x5B) { // '['
38296
+ level += 1;
38297
+ } else if (cu === 0x5D) { // ']'
38298
+ level -= 1;
38299
+ if (level === 0) {
38300
+ close = i; // found matching close; loop will exit by condition
38301
+ }
38246
38302
  }
38303
+ i += 1;
38247
38304
  }
38248
38305
 
38249
- keys.push(segment[1]);
38306
+ if (close < 0) {
38307
+ // Unterminated group: wrap the raw remainder in one bracket pair so it stays
38308
+ // a single literal segment (e.g. "[[]b" -> "[[]b]"); we do not infer missing ']'.
38309
+ segments[segments.length] = '[' + key.slice(open) + ']';
38310
+ return segments;
38311
+ }
38312
+
38313
+ var seg = key.slice(open, close + 1);
38314
+ // prototype guard for the content of this group
38315
+ var content = seg.slice(1, -1);
38316
+ if (!options.plainObjects && has.call(Object.prototype, content) && !options.allowPrototypes) {
38317
+ return;
38318
+ }
38319
+
38320
+ segments[segments.length] = seg;
38321
+ collected += 1;
38322
+
38323
+ // find the next '[' after this balanced group
38324
+ open = key.indexOf('[', close + 1);
38250
38325
  }
38251
38326
 
38252
- if (segment) {
38327
+ if (open >= 0) {
38253
38328
  if (options.strictDepth === true) {
38254
38329
  throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');
38255
38330
  }
38256
38331
 
38257
- keys.push('[' + key.slice(segment.index) + ']');
38332
+ segments[segments.length] = '[' + key.slice(open) + ']';
38258
38333
  }
38259
38334
 
38260
- return keys;
38335
+ return segments;
38261
38336
  };
38262
38337
 
38263
38338
  var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
@@ -38330,6 +38405,7 @@ var normalizeParseOptions = function normalizeParseOptions(opts) {
38330
38405
  parseArrays: opts.parseArrays !== false,
38331
38406
  plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults$4.plainObjects,
38332
38407
  strictDepth: typeof opts.strictDepth === 'boolean' ? !!opts.strictDepth : defaults$4.strictDepth,
38408
+ strictMerge: typeof opts.strictMerge === 'boolean' ? !!opts.strictMerge : defaults$4.strictMerge,
38333
38409
  strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults$4.strictNullHandling,
38334
38410
  throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === 'boolean' ? opts.throwOnLimitExceeded : false
38335
38411
  };
@@ -38390,7 +38466,7 @@ function requireUrlencoded () {
38390
38466
  * @private
38391
38467
  */
38392
38468
 
38393
- var bytes = bytesExports;
38469
+ var bytes = requireBytes();
38394
38470
  var contentType$1 = contentType;
38395
38471
  var createError = httpErrorsExports;
38396
38472
  var debug = requireSrc$1()('body-parser:urlencoded');
@@ -38584,16 +38660,15 @@ function requireUrlencoded () {
38584
38660
 
38585
38661
  function parameterCount (body, limit) {
38586
38662
  var count = 0;
38587
- var index = 0;
38663
+ var index = -1;
38588
38664
 
38589
- while ((index = body.indexOf('&', index)) !== -1) {
38665
+ do {
38590
38666
  count++;
38591
- index++;
38592
-
38593
- if (count === limit) {
38667
+ if (count > limit) {
38594
38668
  return undefined
38595
38669
  }
38596
- }
38670
+ index = body.indexOf('&', index + 1);
38671
+ } while (index !== -1)
38597
38672
 
38598
38673
  return count
38599
38674
  }
@@ -41428,6 +41503,7 @@ function pathToRegexp(path, keys, options) {
41428
41503
  pos = offset + match.length;
41429
41504
 
41430
41505
  if (match === '*') {
41506
+ backtrack = '';
41431
41507
  extraOffset += 3;
41432
41508
  return '(.*)';
41433
41509
  }
@@ -41457,6 +41533,7 @@ function pathToRegexp(path, keys, options) {
41457
41533
  + ')'
41458
41534
  + optional;
41459
41535
 
41536
+ backtrack = '';
41460
41537
  extraOffset += result.length - match.length;
41461
41538
 
41462
41539
  return result;
@@ -50340,7 +50417,8 @@ function trustSingle (subnet) {
50340
50417
 
50341
50418
  function parseExtendedQueryString(str) {
50342
50419
  return qs.parse(str, {
50343
- allowPrototypes: true
50420
+ allowPrototypes: true,
50421
+ arrayLimit: 1000
50344
50422
  });
50345
50423
  }
50346
50424
 
@@ -58120,6 +58198,13 @@ function requireFollowRedirects () {
58120
58198
  useNativeURL = error.code === "ERR_INVALID_URL";
58121
58199
  }
58122
58200
 
58201
+ // HTTP headers to drop across HTTP/HTTPS and domain boundaries
58202
+ var sensitiveHeaders = [
58203
+ "Authorization",
58204
+ "Proxy-Authorization",
58205
+ "Cookie",
58206
+ ];
58207
+
58123
58208
  // URL fields to preserve in copy operations
58124
58209
  var preservedUrlFields = [
58125
58210
  "auth",
@@ -58201,6 +58286,11 @@ function requireFollowRedirects () {
58201
58286
  }
58202
58287
  };
58203
58288
 
58289
+ // Create filter for sensitive HTTP headers
58290
+ this._headerFilter = new RegExp("^(?:" +
58291
+ sensitiveHeaders.concat(options.sensitiveHeaders).map(escapeRegex).join("|") +
58292
+ ")$", "i");
58293
+
58204
58294
  // Perform the first request
58205
58295
  this._performRequest();
58206
58296
  }
@@ -58384,6 +58474,9 @@ function requireFollowRedirects () {
58384
58474
  if (!options.headers) {
58385
58475
  options.headers = {};
58386
58476
  }
58477
+ if (!isArray(options.sensitiveHeaders)) {
58478
+ options.sensitiveHeaders = [];
58479
+ }
58387
58480
 
58388
58481
  // Since http.request treats host as an alias of hostname,
58389
58482
  // but the url module interprets host as hostname plus port,
@@ -58566,7 +58659,7 @@ function requireFollowRedirects () {
58566
58659
  redirectUrl.protocol !== "https:" ||
58567
58660
  redirectUrl.host !== currentHost &&
58568
58661
  !isSubdomain(redirectUrl.host, currentHost)) {
58569
- removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers);
58662
+ removeMatchingHeaders(this._headerFilter, this._options.headers);
58570
58663
  }
58571
58664
 
58572
58665
  // Evaluate the beforeRedirect callback
@@ -58759,6 +58852,10 @@ function requireFollowRedirects () {
58759
58852
  return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
58760
58853
  }
58761
58854
 
58855
+ function isArray(value) {
58856
+ return value instanceof Array;
58857
+ }
58858
+
58762
58859
  function isString(value) {
58763
58860
  return typeof value === "string" || value instanceof String;
58764
58861
  }
@@ -58775,6 +58872,10 @@ function requireFollowRedirects () {
58775
58872
  return URL && value instanceof URL;
58776
58873
  }
58777
58874
 
58875
+ function escapeRegex(regex) {
58876
+ return regex.replace(/[\]\\/()*+?.$]/g, "\\$&");
58877
+ }
58878
+
58778
58879
  // Exports
58779
58880
  followRedirects.exports = wrap({ http: http, https: https });
58780
58881
  followRedirectsExports.wrap = wrap;
@@ -60013,6 +60114,9 @@ axiosExports.default = axios$1;
60013
60114
 
60014
60115
  var axios = /*@__PURE__*/getDefaultExportFromCjs(axiosExports$1);
60015
60116
 
60117
+ var bytesExports = requireBytes();
60118
+ var bytes = /*@__PURE__*/getDefaultExportFromCjs(bytesExports);
60119
+
60016
60120
  if (process.argv.includes("--help") || process.argv.includes("-h")) {
60017
60121
  console.log(`Usage: fisk-builder [options]
60018
60122
 
@@ -60190,7 +60294,7 @@ const environments = {};
60190
60294
  const client = new Client(option, common.Version);
60191
60295
  client.on("objectCache", (enabled) => {
60192
60296
  const size = option("object-cache-size");
60193
- const objectCacheSize = typeof size === "number" ? size : bytesExports.parse(String(size));
60297
+ const objectCacheSize = typeof size === "number" ? size : bytes.parse(String(size));
60194
60298
  // console.log("got object cache", enabled, objectCacheSize, option("object-cache-size"));
60195
60299
  if (enabled && objectCacheSize) {
60196
60300
  const objectCacheDir = option.string("object-cache-dir") || path__default["default"].join(common.cacheDir(), "objectcache");
@@ -60526,7 +60630,7 @@ client.on("getEnvironments", (message) => {
60526
60630
  return;
60527
60631
  }
60528
60632
  console.log("Got finish", env);
60529
- exec("tar xf '" + file + "'", { cwd: dir })
60633
+ exec("tar xf env.tar.gz", { cwd: dir })
60530
60634
  .then(() => {
60531
60635
  const json = path__default["default"].join(dir, "environment.json");
60532
60636
  console.log("Writing json file", json);