@membranehq/sdk 0.26.1 → 0.27.1

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.
package/dist/bundle.js CHANGED
@@ -4983,7 +4983,7 @@
4983
4983
  var hexTable = (function () {
4984
4984
  var array = [];
4985
4985
  for (var i = 0; i < 256; ++i) {
4986
- array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
4986
+ array[array.length] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase();
4987
4987
  }
4988
4988
 
4989
4989
  return array;
@@ -4999,7 +4999,7 @@
4999
4999
 
5000
5000
  for (var j = 0; j < obj.length; ++j) {
5001
5001
  if (typeof obj[j] !== 'undefined') {
5002
- compacted.push(obj[j]);
5002
+ compacted[compacted.length] = obj[j];
5003
5003
  }
5004
5004
  }
5005
5005
 
@@ -5027,13 +5027,19 @@
5027
5027
 
5028
5028
  if (typeof source !== 'object' && typeof source !== 'function') {
5029
5029
  if (isArray(target)) {
5030
- target.push(source);
5030
+ var nextIndex = target.length;
5031
+ if (options && typeof options.arrayLimit === 'number' && nextIndex > options.arrayLimit) {
5032
+ return markOverflow(arrayToObject(target.concat(source), options), nextIndex);
5033
+ }
5034
+ target[nextIndex] = source;
5031
5035
  } else if (target && typeof target === 'object') {
5032
5036
  if (isOverflow(target)) {
5033
5037
  // Add at next numeric index for overflow objects
5034
5038
  var newIndex = getMaxIndex(target) + 1;
5035
5039
  target[newIndex] = source;
5036
5040
  setMaxIndex(target, newIndex);
5041
+ } else if (options && options.strictMerge) {
5042
+ return [target, source];
5037
5043
  } else if (
5038
5044
  (options && (options.plainObjects || options.allowPrototypes))
5039
5045
  || !has.call(Object.prototype, source)
@@ -5060,7 +5066,11 @@
5060
5066
  }
5061
5067
  return markOverflow(result, getMaxIndex(source) + 1);
5062
5068
  }
5063
- return [target].concat(source);
5069
+ var combined = [target].concat(source);
5070
+ if (options && typeof options.arrayLimit === 'number' && combined.length > options.arrayLimit) {
5071
+ return markOverflow(arrayToObject(combined, options), combined.length - 1);
5072
+ }
5073
+ return combined;
5064
5074
  }
5065
5075
 
5066
5076
  var mergeTarget = target;
@@ -5075,7 +5085,7 @@
5075
5085
  if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
5076
5086
  target[i] = merge(targetItem, item, options);
5077
5087
  } else {
5078
- target.push(item);
5088
+ target[target.length] = item;
5079
5089
  }
5080
5090
  } else {
5081
5091
  target[i] = item;
@@ -5092,6 +5102,17 @@
5092
5102
  } else {
5093
5103
  acc[key] = value;
5094
5104
  }
5105
+
5106
+ if (isOverflow(source) && !isOverflow(acc)) {
5107
+ markOverflow(acc, getMaxIndex(source));
5108
+ }
5109
+ if (isOverflow(acc)) {
5110
+ var keyNum = parseInt(key, 10);
5111
+ if (String(keyNum) === key && keyNum >= 0 && keyNum > getMaxIndex(acc)) {
5112
+ setMaxIndex(acc, keyNum);
5113
+ }
5114
+ }
5115
+
5095
5116
  return acc;
5096
5117
  }, mergeTarget);
5097
5118
  };
@@ -5208,8 +5229,8 @@
5208
5229
  var key = keys[j];
5209
5230
  var val = obj[key];
5210
5231
  if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
5211
- queue.push({ obj: obj, prop: key });
5212
- refs.push(val);
5232
+ queue[queue.length] = { obj: obj, prop: key };
5233
+ refs[refs.length] = val;
5213
5234
  }
5214
5235
  }
5215
5236
  }
@@ -5251,7 +5272,7 @@
5251
5272
  if (isArray(val)) {
5252
5273
  var mapped = [];
5253
5274
  for (var i = 0; i < val.length; i += 1) {
5254
- mapped.push(fn(val[i]));
5275
+ mapped[mapped.length] = fn(val[i]);
5255
5276
  }
5256
5277
  return mapped;
5257
5278
  }
@@ -5268,6 +5289,7 @@
5268
5289
  isBuffer: isBuffer,
5269
5290
  isOverflow: isOverflow,
5270
5291
  isRegExp: isRegExp,
5292
+ markOverflow: markOverflow,
5271
5293
  maybeMap: maybeMap,
5272
5294
  merge: merge
5273
5295
  };
@@ -5670,6 +5692,7 @@
5670
5692
  parseArrays: true,
5671
5693
  plainObjects: false,
5672
5694
  strictDepth: false,
5695
+ strictMerge: true,
5673
5696
  strictNullHandling: false,
5674
5697
  throwOnLimitExceeded: false
5675
5698
  };
@@ -5708,7 +5731,7 @@
5708
5731
  var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
5709
5732
  cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
5710
5733
 
5711
- var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
5734
+ var limit = options.parameterLimit === Infinity ? void undefined : options.parameterLimit;
5712
5735
  var parts = cleanStr.split(
5713
5736
  options.delimiter,
5714
5737
  options.throwOnLimitExceeded ? limit + 1 : limit
@@ -5775,9 +5798,16 @@
5775
5798
  val = isArray(val) ? [val] : val;
5776
5799
  }
5777
5800
 
5801
+ if (options.comma && isArray(val) && val.length > options.arrayLimit) {
5802
+ if (options.throwOnLimitExceeded) {
5803
+ throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
5804
+ }
5805
+ val = utils.combine([], val, options.arrayLimit, options.plainObjects);
5806
+ }
5807
+
5778
5808
  if (key !== null) {
5779
5809
  var existing = has.call(obj, key);
5780
- if (existing && options.duplicates === 'combine') {
5810
+ if (existing && (options.duplicates === 'combine' || part.indexOf('[]=') > -1)) {
5781
5811
  obj[key] = utils.combine(
5782
5812
  obj[key],
5783
5813
  val,
@@ -5825,17 +5855,21 @@
5825
5855
  var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
5826
5856
  var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, '.') : cleanRoot;
5827
5857
  var index = parseInt(decodedRoot, 10);
5828
- if (!options.parseArrays && decodedRoot === '') {
5829
- obj = { 0: leaf };
5830
- } else if (
5831
- !isNaN(index)
5858
+ var isValidArrayIndex = !isNaN(index)
5832
5859
  && root !== decodedRoot
5833
5860
  && String(index) === decodedRoot
5834
5861
  && index >= 0
5835
- && (options.parseArrays && index <= options.arrayLimit)
5836
- ) {
5862
+ && options.parseArrays;
5863
+ if (!options.parseArrays && decodedRoot === '') {
5864
+ obj = { 0: leaf };
5865
+ } else if (isValidArrayIndex && index < options.arrayLimit) {
5837
5866
  obj = [];
5838
5867
  obj[index] = leaf;
5868
+ } else if (isValidArrayIndex && options.throwOnLimitExceeded) {
5869
+ throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
5870
+ } else if (isValidArrayIndex) {
5871
+ obj[index] = leaf;
5872
+ utils.markOverflow(obj, index);
5839
5873
  } else if (decodedRoot !== '__proto__') {
5840
5874
  obj[decodedRoot] = leaf;
5841
5875
  }
@@ -5875,7 +5909,7 @@
5875
5909
  }
5876
5910
  }
5877
5911
 
5878
- keys.push(parent);
5912
+ keys[keys.length] = parent;
5879
5913
  }
5880
5914
 
5881
5915
  var i = 0;
@@ -5889,7 +5923,7 @@
5889
5923
  }
5890
5924
  }
5891
5925
 
5892
- keys.push(segment[1]);
5926
+ keys[keys.length] = segment[1];
5893
5927
  }
5894
5928
 
5895
5929
  if (segment) {
@@ -5897,7 +5931,7 @@
5897
5931
  throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');
5898
5932
  }
5899
5933
 
5900
- keys.push('[' + key.slice(segment.index) + ']');
5934
+ keys[keys.length] = '[' + key.slice(segment.index) + ']';
5901
5935
  }
5902
5936
 
5903
5937
  return keys;
@@ -5973,6 +6007,7 @@
5973
6007
  parseArrays: opts.parseArrays !== false,
5974
6008
  plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
5975
6009
  strictDepth: typeof opts.strictDepth === 'boolean' ? !!opts.strictDepth : defaults.strictDepth,
6010
+ strictMerge: typeof opts.strictMerge === 'boolean' ? !!opts.strictMerge : defaults.strictMerge,
5976
6011
  strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling,
5977
6012
  throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === 'boolean' ? opts.throwOnLimitExceeded : false
5978
6013
  };