@rpcbase/api 0.75.0 → 0.77.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 +141 -71
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9595,6 +9595,7 @@ function requireStreams() {
9595
9595
  };
9596
9596
  return streams;
9597
9597
  }
9598
+ lib$1.exports;
9598
9599
  var hasRequiredLib$1;
9599
9600
  function requireLib$1() {
9600
9601
  if (hasRequiredLib$1) return lib$1.exports;
@@ -9603,55 +9604,54 @@ function requireLib$1() {
9603
9604
  var Buffer2 = requireSafer().Buffer;
9604
9605
  var bomHandling2 = requireBomHandling();
9605
9606
  var mergeModules = requireMergeExports();
9606
- var iconv = module.exports;
9607
- iconv.encodings = null;
9608
- iconv.defaultCharUnicode = "";
9609
- iconv.defaultCharSingleByte = "?";
9610
- iconv.encode = function encode(str, encoding2, options) {
9607
+ module.exports.encodings = null;
9608
+ module.exports.defaultCharUnicode = "�";
9609
+ module.exports.defaultCharSingleByte = "?";
9610
+ module.exports.encode = function encode(str, encoding2, options) {
9611
9611
  str = "" + (str || "");
9612
- var encoder = iconv.getEncoder(encoding2, options);
9612
+ var encoder = module.exports.getEncoder(encoding2, options);
9613
9613
  var res = encoder.write(str);
9614
9614
  var trail = encoder.end();
9615
9615
  return trail && trail.length > 0 ? Buffer2.concat([res, trail]) : res;
9616
9616
  };
9617
- iconv.decode = function decode(buf, encoding2, options) {
9617
+ module.exports.decode = function decode(buf, encoding2, options) {
9618
9618
  if (typeof buf === "string") {
9619
- if (!iconv.skipDecodeWarning) {
9619
+ if (!module.exports.skipDecodeWarning) {
9620
9620
  console.error("Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding");
9621
- iconv.skipDecodeWarning = true;
9621
+ module.exports.skipDecodeWarning = true;
9622
9622
  }
9623
9623
  buf = Buffer2.from("" + (buf || ""), "binary");
9624
9624
  }
9625
- var decoder = iconv.getDecoder(encoding2, options);
9625
+ var decoder = module.exports.getDecoder(encoding2, options);
9626
9626
  var res = decoder.write(buf);
9627
9627
  var trail = decoder.end();
9628
9628
  return trail ? res + trail : res;
9629
9629
  };
9630
- iconv.encodingExists = function encodingExists(enc) {
9630
+ module.exports.encodingExists = function encodingExists(enc) {
9631
9631
  try {
9632
- iconv.getCodec(enc);
9632
+ module.exports.getCodec(enc);
9633
9633
  return true;
9634
9634
  } catch (e) {
9635
9635
  return false;
9636
9636
  }
9637
9637
  };
9638
- iconv.toEncoding = iconv.encode;
9639
- iconv.fromEncoding = iconv.decode;
9640
- iconv._codecDataCache = { __proto__: null };
9641
- iconv.getCodec = function getCodec(encoding2) {
9642
- if (!iconv.encodings) {
9638
+ module.exports.toEncoding = module.exports.encode;
9639
+ module.exports.fromEncoding = module.exports.decode;
9640
+ module.exports._codecDataCache = { __proto__: null };
9641
+ module.exports.getCodec = function getCodec(encoding2) {
9642
+ if (!module.exports.encodings) {
9643
9643
  var raw = requireEncodings();
9644
- iconv.encodings = { __proto__: null };
9645
- mergeModules(iconv.encodings, raw);
9644
+ module.exports.encodings = { __proto__: null };
9645
+ mergeModules(module.exports.encodings, raw);
9646
9646
  }
9647
- var enc = iconv._canonicalizeEncoding(encoding2);
9647
+ var enc = module.exports._canonicalizeEncoding(encoding2);
9648
9648
  var codecOptions = {};
9649
9649
  while (true) {
9650
- var codec = iconv._codecDataCache[enc];
9650
+ var codec = module.exports._codecDataCache[enc];
9651
9651
  if (codec) {
9652
9652
  return codec;
9653
9653
  }
9654
- var codecDef = iconv.encodings[enc];
9654
+ var codecDef = module.exports.encodings[enc];
9655
9655
  switch (typeof codecDef) {
9656
9656
  case "string":
9657
9657
  enc = codecDef;
@@ -9669,47 +9669,47 @@ function requireLib$1() {
9669
9669
  if (!codecOptions.encodingName) {
9670
9670
  codecOptions.encodingName = enc;
9671
9671
  }
9672
- codec = new codecDef(codecOptions, iconv);
9673
- iconv._codecDataCache[codecOptions.encodingName] = codec;
9672
+ codec = new codecDef(codecOptions, module.exports);
9673
+ module.exports._codecDataCache[codecOptions.encodingName] = codec;
9674
9674
  return codec;
9675
9675
  default:
9676
9676
  throw new Error("Encoding not recognized: '" + encoding2 + "' (searched as: '" + enc + "')");
9677
9677
  }
9678
9678
  }
9679
9679
  };
9680
- iconv._canonicalizeEncoding = function(encoding2) {
9680
+ module.exports._canonicalizeEncoding = function(encoding2) {
9681
9681
  return ("" + encoding2).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, "");
9682
9682
  };
9683
- iconv.getEncoder = function getEncoder(encoding2, options) {
9684
- var codec = iconv.getCodec(encoding2);
9683
+ module.exports.getEncoder = function getEncoder(encoding2, options) {
9684
+ var codec = module.exports.getCodec(encoding2);
9685
9685
  var encoder = new codec.encoder(options, codec);
9686
9686
  if (codec.bomAware && options && options.addBOM) {
9687
9687
  encoder = new bomHandling2.PrependBOM(encoder, options);
9688
9688
  }
9689
9689
  return encoder;
9690
9690
  };
9691
- iconv.getDecoder = function getDecoder(encoding2, options) {
9692
- var codec = iconv.getCodec(encoding2);
9691
+ module.exports.getDecoder = function getDecoder(encoding2, options) {
9692
+ var codec = module.exports.getCodec(encoding2);
9693
9693
  var decoder = new codec.decoder(options, codec);
9694
9694
  if (codec.bomAware && !(options && options.stripBOM === false)) {
9695
9695
  decoder = new bomHandling2.StripBOM(decoder, options);
9696
9696
  }
9697
9697
  return decoder;
9698
9698
  };
9699
- iconv.enableStreamingAPI = function enableStreamingAPI(streamModule2) {
9700
- if (iconv.supportsStreams) {
9699
+ module.exports.enableStreamingAPI = function enableStreamingAPI(streamModule2) {
9700
+ if (module.exports.supportsStreams) {
9701
9701
  return;
9702
9702
  }
9703
9703
  var streams2 = requireStreams()(streamModule2);
9704
- iconv.IconvLiteEncoderStream = streams2.IconvLiteEncoderStream;
9705
- iconv.IconvLiteDecoderStream = streams2.IconvLiteDecoderStream;
9706
- iconv.encodeStream = function encodeStream(encoding2, options) {
9707
- return new iconv.IconvLiteEncoderStream(iconv.getEncoder(encoding2, options), options);
9704
+ module.exports.IconvLiteEncoderStream = streams2.IconvLiteEncoderStream;
9705
+ module.exports.IconvLiteDecoderStream = streams2.IconvLiteDecoderStream;
9706
+ module.exports.encodeStream = function encodeStream(encoding2, options) {
9707
+ return new module.exports.IconvLiteEncoderStream(module.exports.getEncoder(encoding2, options), options);
9708
9708
  };
9709
- iconv.decodeStream = function decodeStream(encoding2, options) {
9710
- return new iconv.IconvLiteDecoderStream(iconv.getDecoder(encoding2, options), options);
9709
+ module.exports.decodeStream = function decodeStream(encoding2, options) {
9710
+ return new module.exports.IconvLiteDecoderStream(module.exports.getDecoder(encoding2, options), options);
9711
9711
  };
9712
- iconv.supportsStreams = true;
9712
+ module.exports.supportsStreams = true;
9713
9713
  };
9714
9714
  var streamModule;
9715
9715
  try {
@@ -9717,9 +9717,9 @@ function requireLib$1() {
9717
9717
  } catch (e) {
9718
9718
  }
9719
9719
  if (streamModule && streamModule.Transform) {
9720
- iconv.enableStreamingAPI(streamModule);
9720
+ module.exports.enableStreamingAPI(streamModule);
9721
9721
  } else {
9722
- iconv.encodeStream = iconv.decodeStream = function() {
9722
+ module.exports.encodeStream = module.exports.decodeStream = function() {
9723
9723
  throw new Error("iconv-lite Streaming API is not enabled. Use iconv.enableStreamingAPI(require('stream')); to enable it.");
9724
9724
  };
9725
9725
  }
@@ -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.75.0",
3
+ "version": "0.77.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"