@rpcbase/api 0.74.0 → 0.76.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.
Files changed (2) hide show
  1. package/dist/index.js +101 -31
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -13325,10 +13325,7 @@ function requireJson() {
13325
13325
  var index = str.indexOf(char);
13326
13326
  var partial = "";
13327
13327
  if (index !== -1) {
13328
- partial = str.substring(0, index) + JSON_SYNTAX_CHAR;
13329
- for (var i = index + 1; i < str.length; i++) {
13330
- partial += JSON_SYNTAX_CHAR;
13331
- }
13328
+ partial = str.substring(0, index) + JSON_SYNTAX_CHAR.repeat(str.length - index);
13332
13329
  }
13333
13330
  try {
13334
13331
  JSON.parse(partial);
@@ -15056,8 +15053,23 @@ function requireUtils$1() {
15056
15053
  if (hasRequiredUtils$1) return utils$1;
15057
15054
  hasRequiredUtils$1 = 1;
15058
15055
  var formats2 = /* @__PURE__ */ requireFormats();
15056
+ var getSideChannel = requireSideChannel();
15059
15057
  var has = Object.prototype.hasOwnProperty;
15060
15058
  var isArray = Array.isArray;
15059
+ var overflowChannel = getSideChannel();
15060
+ var markOverflow = function markOverflow2(obj, maxIndex) {
15061
+ overflowChannel.set(obj, maxIndex);
15062
+ return obj;
15063
+ };
15064
+ var isOverflow = function isOverflow2(obj) {
15065
+ return overflowChannel.has(obj);
15066
+ };
15067
+ var getMaxIndex = function getMaxIndex2(obj) {
15068
+ return overflowChannel.get(obj);
15069
+ };
15070
+ var setMaxIndex = function setMaxIndex2(obj, maxIndex) {
15071
+ overflowChannel.set(obj, maxIndex);
15072
+ };
15061
15073
  var hexTable = (function() {
15062
15074
  var array = [];
15063
15075
  for (var i = 0; i < 256; ++i) {
@@ -15097,7 +15109,11 @@ function requireUtils$1() {
15097
15109
  if (isArray(target)) {
15098
15110
  target.push(source);
15099
15111
  } else if (target && typeof target === "object") {
15100
- if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) {
15112
+ if (isOverflow(target)) {
15113
+ var newIndex = getMaxIndex(target) + 1;
15114
+ target[newIndex] = source;
15115
+ setMaxIndex(target, newIndex);
15116
+ } else if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) {
15101
15117
  target[source] = true;
15102
15118
  }
15103
15119
  } else {
@@ -15106,6 +15122,15 @@ function requireUtils$1() {
15106
15122
  return target;
15107
15123
  }
15108
15124
  if (!target || typeof target !== "object") {
15125
+ if (isOverflow(source)) {
15126
+ var sourceKeys = Object.keys(source);
15127
+ var result = options && options.plainObjects ? { __proto__: null, 0: target } : { 0: target };
15128
+ for (var m = 0; m < sourceKeys.length; m++) {
15129
+ var oldKey = parseInt(sourceKeys[m], 10);
15130
+ result[oldKey + 1] = source[sourceKeys[m]];
15131
+ }
15132
+ return markOverflow(result, getMaxIndex(source) + 1);
15133
+ }
15109
15134
  return [target].concat(source);
15110
15135
  }
15111
15136
  var mergeTarget = target;
@@ -15228,8 +15253,18 @@ function requireUtils$1() {
15228
15253
  }
15229
15254
  return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
15230
15255
  };
15231
- var combine = function combine2(a, b) {
15232
- return [].concat(a, b);
15256
+ var combine = function combine2(a, b, arrayLimit, plainObjects) {
15257
+ if (isOverflow(a)) {
15258
+ var newIndex = getMaxIndex(a) + 1;
15259
+ a[newIndex] = b;
15260
+ setMaxIndex(a, newIndex);
15261
+ return a;
15262
+ }
15263
+ var result = [].concat(a, b);
15264
+ if (result.length > arrayLimit) {
15265
+ return markOverflow(arrayToObject(result, { plainObjects }), result.length - 1);
15266
+ }
15267
+ return result;
15233
15268
  };
15234
15269
  var maybeMap = function maybeMap2(val, fn) {
15235
15270
  if (isArray(val)) {
@@ -15249,6 +15284,7 @@ function requireUtils$1() {
15249
15284
  decode,
15250
15285
  encode,
15251
15286
  isBuffer,
15287
+ isOverflow,
15252
15288
  isRegExp,
15253
15289
  maybeMap,
15254
15290
  merge
@@ -15627,16 +15663,18 @@ function requireParse() {
15627
15663
  val = options.strictNullHandling ? null : "";
15628
15664
  } else {
15629
15665
  key = options.decoder(part.slice(0, pos), defaults.decoder, charset2, "key");
15630
- val = utils2.maybeMap(
15631
- parseArrayValue(
15632
- part.slice(pos + 1),
15633
- options,
15634
- isArray(obj[key]) ? obj[key].length : 0
15635
- ),
15636
- function(encodedVal) {
15637
- return options.decoder(encodedVal, defaults.decoder, charset2, "value");
15638
- }
15639
- );
15666
+ if (key !== null) {
15667
+ val = utils2.maybeMap(
15668
+ parseArrayValue(
15669
+ part.slice(pos + 1),
15670
+ options,
15671
+ isArray(obj[key]) ? obj[key].length : 0
15672
+ ),
15673
+ function(encodedVal) {
15674
+ return options.decoder(encodedVal, defaults.decoder, charset2, "value");
15675
+ }
15676
+ );
15677
+ }
15640
15678
  }
15641
15679
  if (val && options.interpretNumericEntities && charset2 === "iso-8859-1") {
15642
15680
  val = interpretNumericEntities(String(val));
@@ -15644,11 +15682,18 @@ function requireParse() {
15644
15682
  if (part.indexOf("[]=") > -1) {
15645
15683
  val = isArray(val) ? [val] : val;
15646
15684
  }
15647
- var existing = has.call(obj, key);
15648
- if (existing && options.duplicates === "combine") {
15649
- obj[key] = utils2.combine(obj[key], val);
15650
- } else if (!existing || options.duplicates === "last") {
15651
- obj[key] = val;
15685
+ if (key !== null) {
15686
+ var existing = has.call(obj, key);
15687
+ if (existing && options.duplicates === "combine") {
15688
+ obj[key] = utils2.combine(
15689
+ obj[key],
15690
+ val,
15691
+ options.arrayLimit,
15692
+ options.plainObjects
15693
+ );
15694
+ } else if (!existing || options.duplicates === "last") {
15695
+ obj[key] = val;
15696
+ }
15652
15697
  }
15653
15698
  }
15654
15699
  return obj;
@@ -15664,7 +15709,16 @@ function requireParse() {
15664
15709
  var obj;
15665
15710
  var root = chain[i];
15666
15711
  if (root === "[]" && options.parseArrays) {
15667
- obj = options.allowEmptyArrays && (leaf === "" || options.strictNullHandling && leaf === null) ? [] : utils2.combine([], leaf);
15712
+ if (utils2.isOverflow(leaf)) {
15713
+ obj = leaf;
15714
+ } else {
15715
+ obj = options.allowEmptyArrays && (leaf === "" || options.strictNullHandling && leaf === null) ? [] : utils2.combine(
15716
+ [],
15717
+ leaf,
15718
+ options.arrayLimit,
15719
+ options.plainObjects
15720
+ );
15721
+ }
15668
15722
  } else {
15669
15723
  obj = options.plainObjects ? { __proto__: null } : {};
15670
15724
  var cleanRoot = root.charAt(0) === "[" && root.charAt(root.length - 1) === "]" ? root.slice(1, -1) : root;
@@ -15683,14 +15737,19 @@ function requireParse() {
15683
15737
  }
15684
15738
  return leaf;
15685
15739
  };
15686
- var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
15687
- if (!givenKey) {
15688
- return;
15689
- }
15740
+ var splitKeyIntoSegments = function splitKeyIntoSegments2(givenKey, options) {
15690
15741
  var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, "[$1]") : givenKey;
15742
+ if (options.depth <= 0) {
15743
+ if (!options.plainObjects && has.call(Object.prototype, key)) {
15744
+ if (!options.allowPrototypes) {
15745
+ return;
15746
+ }
15747
+ }
15748
+ return [key];
15749
+ }
15691
15750
  var brackets = /(\[[^[\]]*])/;
15692
15751
  var child = /(\[[^[\]]*])/g;
15693
- var segment = options.depth > 0 && brackets.exec(key);
15752
+ var segment = brackets.exec(key);
15694
15753
  var parent = segment ? key.slice(0, segment.index) : key;
15695
15754
  var keys = [];
15696
15755
  if (parent) {
@@ -15702,9 +15761,10 @@ function requireParse() {
15702
15761
  keys.push(parent);
15703
15762
  }
15704
15763
  var i = 0;
15705
- while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
15764
+ while ((segment = child.exec(key)) !== null && i < options.depth) {
15706
15765
  i += 1;
15707
- if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
15766
+ var segmentContent = segment[1].slice(1, -1);
15767
+ if (!options.plainObjects && has.call(Object.prototype, segmentContent)) {
15708
15768
  if (!options.allowPrototypes) {
15709
15769
  return;
15710
15770
  }
@@ -15717,6 +15777,16 @@ function requireParse() {
15717
15777
  }
15718
15778
  keys.push("[" + key.slice(segment.index) + "]");
15719
15779
  }
15780
+ return keys;
15781
+ };
15782
+ var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
15783
+ if (!givenKey) {
15784
+ return;
15785
+ }
15786
+ var keys = splitKeyIntoSegments(givenKey, options);
15787
+ if (!keys) {
15788
+ return;
15789
+ }
15720
15790
  return parseObject(keys, val, options, valuesParsed);
15721
15791
  };
15722
15792
  var normalizeParseOptions = function normalizeParseOptions2(opts) {
@@ -15856,7 +15926,7 @@ function requireUrlencoded() {
15856
15926
  type: "parameters.too.many"
15857
15927
  });
15858
15928
  }
15859
- var arrayLimit = extended ? Math.max(100, paramCount) : 0;
15929
+ var arrayLimit = extended ? Math.max(100, paramCount) : paramCount;
15860
15930
  debug("parse " + (extended ? "extended " : "") + "urlencoding");
15861
15931
  try {
15862
15932
  return qs.parse(body, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/api",
3
- "version": "0.74.0",
3
+ "version": "0.76.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"