@marqeta/ux-toolkit-sdk-javascript 2.21.0 → 2.21.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.
@@ -4,6 +4,9 @@ function _array_like_to_array(arr, len) {
4
4
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5
5
  return arr2;
6
6
  }
7
+ function _array_with_holes(arr) {
8
+ if (Array.isArray(arr)) return arr;
9
+ }
7
10
  function _array_without_holes(arr) {
8
11
  if (Array.isArray(arr)) return _array_like_to_array(arr);
9
12
  }
@@ -103,6 +106,33 @@ function _instanceof(left, right) {
103
106
  function _iterable_to_array(iter) {
104
107
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
105
108
  }
109
+ function _iterable_to_array_limit(arr, i) {
110
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
111
+ if (_i == null) return;
112
+ var _arr = [];
113
+ var _n = true;
114
+ var _d = false;
115
+ var _s, _e;
116
+ try {
117
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
118
+ _arr.push(_s.value);
119
+ if (i && _arr.length === i) break;
120
+ }
121
+ } catch (err) {
122
+ _d = true;
123
+ _e = err;
124
+ } finally{
125
+ try {
126
+ if (!_n && _i["return"] != null) _i["return"]();
127
+ } finally{
128
+ if (_d) throw _e;
129
+ }
130
+ }
131
+ return _arr;
132
+ }
133
+ function _non_iterable_rest() {
134
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
135
+ }
106
136
  function _non_iterable_spread() {
107
137
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
108
138
  }
@@ -158,6 +188,9 @@ function _set_prototype_of(o, p) {
158
188
  };
159
189
  return _set_prototype_of(o, p);
160
190
  }
191
+ function _sliced_to_array(arr, i) {
192
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
193
+ }
161
194
  function _to_consumable_array(arr) {
162
195
  return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
163
196
  }
@@ -793,7 +826,7 @@ var _PinnedReactNativeFetchHttpClient = /*#__PURE__*/ function(_chunkZZJHSEG4js_
793
826
  ];
794
827
  case 5:
795
828
  cuiApiPinnedHashes = _state.sent();
796
- console.error("PinnedReactNativeFetchHttpClient request failed: ".concat(method, " ").concat(path, "; hashes: ").concat(JSON.stringify(cuiApiPinnedHashes), "; certs: ").concat(JSON.stringify(cuiApiPinnedCerts)), error);
829
+ console.error("PinnedReactNativeFetchHttpClient request failed: ".concat(method, " ").concat(path, "; hashes: ").concat(JSON.stringify(cuiApiPinnedHashes), "; certs: ").concat(JSON.stringify(cuiApiPinnedCerts)), _this.errorReplacer(error));
797
830
  if (!_optionalChain([
798
831
  error,
799
832
  'optionalAccess',
@@ -932,6 +965,38 @@ var _PinnedReactNativeFetchHttpClient = /*#__PURE__*/ function(_chunkZZJHSEG4js_
932
965
  return responseText;
933
966
  }
934
967
  }
968
+ },
969
+ {
970
+ key: "errorReplacer",
971
+ value: function errorReplacer(value) {
972
+ var _this = this;
973
+ var visited = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : /* @__PURE__ */ new WeakSet(), depth = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
974
+ if (depth > 10 || visited.has(value)) {
975
+ return "[Circular Reference or Max Depth Exceeded]";
976
+ }
977
+ if (_instanceof(value, Error)) {
978
+ return _object_spread({
979
+ name: value.name,
980
+ message: value.message,
981
+ stack: value.stack
982
+ }, Object.getOwnPropertyNames(value).reduce(function(acc, prop) {
983
+ acc[prop] = value[prop];
984
+ return acc;
985
+ }, {}));
986
+ } else if (_instanceof(value, Object)) {
987
+ visited.add(value);
988
+ var result = Object.fromEntries(Object.entries(value).map(function(param) {
989
+ var _param = _sliced_to_array(param, 2), objKey = _param[0], objValue = _param[1];
990
+ return [
991
+ objKey,
992
+ (typeof objValue === "undefined" ? "undefined" : _type_of(objValue)) === "object" && objValue !== null ? _this.errorReplacer(objValue, visited, depth + 1) : objValue
993
+ ];
994
+ }));
995
+ visited.delete(value);
996
+ return result;
997
+ }
998
+ return value;
999
+ }
935
1000
  }
936
1001
  ]);
937
1002
  return _PinnedReactNativeFetchHttpClient;
@@ -3,6 +3,9 @@ function _array_like_to_array(arr, len) {
3
3
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
4
  return arr2;
5
5
  }
6
+ function _array_with_holes(arr) {
7
+ if (Array.isArray(arr)) return arr;
8
+ }
6
9
  function _array_without_holes(arr) {
7
10
  if (Array.isArray(arr)) return _array_like_to_array(arr);
8
11
  }
@@ -102,6 +105,33 @@ function _instanceof(left, right) {
102
105
  function _iterable_to_array(iter) {
103
106
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
104
107
  }
108
+ function _iterable_to_array_limit(arr, i) {
109
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
110
+ if (_i == null) return;
111
+ var _arr = [];
112
+ var _n = true;
113
+ var _d = false;
114
+ var _s, _e;
115
+ try {
116
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
117
+ _arr.push(_s.value);
118
+ if (i && _arr.length === i) break;
119
+ }
120
+ } catch (err) {
121
+ _d = true;
122
+ _e = err;
123
+ } finally{
124
+ try {
125
+ if (!_n && _i["return"] != null) _i["return"]();
126
+ } finally{
127
+ if (_d) throw _e;
128
+ }
129
+ }
130
+ return _arr;
131
+ }
132
+ function _non_iterable_rest() {
133
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
134
+ }
105
135
  function _non_iterable_spread() {
106
136
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
107
137
  }
@@ -157,6 +187,9 @@ function _set_prototype_of(o, p) {
157
187
  };
158
188
  return _set_prototype_of(o, p);
159
189
  }
190
+ function _sliced_to_array(arr, i) {
191
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
192
+ }
160
193
  function _to_consumable_array(arr) {
161
194
  return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
162
195
  }
@@ -760,7 +793,7 @@ var _PinnedReactNativeFetchHttpClient = /*#__PURE__*/ function(BaseHttpClient) {
760
793
  ];
761
794
  case 5:
762
795
  cuiApiPinnedHashes = _state.sent();
763
- console.error("PinnedReactNativeFetchHttpClient request failed: ".concat(method, " ").concat(path, "; hashes: ").concat(JSON.stringify(cuiApiPinnedHashes), "; certs: ").concat(JSON.stringify(cuiApiPinnedCerts)), error);
796
+ console.error("PinnedReactNativeFetchHttpClient request failed: ".concat(method, " ").concat(path, "; hashes: ").concat(JSON.stringify(cuiApiPinnedHashes), "; certs: ").concat(JSON.stringify(cuiApiPinnedCerts)), _this.errorReplacer(error));
764
797
  if (!(error === null || error === void 0 ? void 0 : error.bodyString)) return [
765
798
  3,
766
799
  9
@@ -881,6 +914,38 @@ var _PinnedReactNativeFetchHttpClient = /*#__PURE__*/ function(BaseHttpClient) {
881
914
  return responseText;
882
915
  }
883
916
  }
917
+ },
918
+ {
919
+ key: "errorReplacer",
920
+ value: function errorReplacer(value) {
921
+ var _this = this;
922
+ var visited = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : /* @__PURE__ */ new WeakSet(), depth = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
923
+ if (depth > 10 || visited.has(value)) {
924
+ return "[Circular Reference or Max Depth Exceeded]";
925
+ }
926
+ if (_instanceof(value, Error)) {
927
+ return _object_spread({
928
+ name: value.name,
929
+ message: value.message,
930
+ stack: value.stack
931
+ }, Object.getOwnPropertyNames(value).reduce(function(acc, prop) {
932
+ acc[prop] = value[prop];
933
+ return acc;
934
+ }, {}));
935
+ } else if (_instanceof(value, Object)) {
936
+ visited.add(value);
937
+ var result = Object.fromEntries(Object.entries(value).map(function(param) {
938
+ var _param = _sliced_to_array(param, 2), objKey = _param[0], objValue = _param[1];
939
+ return [
940
+ objKey,
941
+ (typeof objValue === "undefined" ? "undefined" : _type_of(objValue)) === "object" && objValue !== null ? _this.errorReplacer(objValue, visited, depth + 1) : objValue
942
+ ];
943
+ }));
944
+ visited.delete(value);
945
+ return result;
946
+ }
947
+ return value;
948
+ }
884
949
  }
885
950
  ]);
886
951
  return _PinnedReactNativeFetchHttpClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marqeta/ux-toolkit-sdk-javascript",
3
- "version": "2.21.0",
3
+ "version": "2.21.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",