react-native-onyx 3.0.105 → 3.0.106

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/OnyxUtils.js CHANGED
@@ -183,7 +183,7 @@ function initStoreValues(keys, initialKeyStates, evictableKeys) {
183
183
  }
184
184
  }
185
185
  function sendActionToDevTools(method, key, value, mergedValue = undefined) {
186
- DevTools_1.default.registerAction(utils_1.default.formatActionName(method, key), value, key ? { [key]: mergedValue || value } : value);
186
+ DevTools_1.default.registerAction(utils_1.default.formatActionName(method, key), value, key ? { [key]: mergedValue !== undefined ? mergedValue : value } : value);
187
187
  }
188
188
  /**
189
189
  * Takes a collection of items (eg. {testKey_1:{a:'a'}, testKey_2:{b:'b'}})
@@ -32,6 +32,20 @@ const StorageErrorClass = {
32
32
  UNKNOWN: 'unknown',
33
33
  };
34
34
  exports.StorageErrorClass = StorageErrorClass;
35
+ /**
36
+ * Serializes non-Error thrown values for classifier matching. JSON.stringify is preferred for plain
37
+ * objects, but it throws on circular structures and returns undefined for BigInt/function/symbol, so
38
+ * fall back to String() to keep normalization from throwing before classifyError runs.
39
+ */
40
+ function serializeThrownValue(error) {
41
+ var _a;
42
+ try {
43
+ return (_a = JSON.stringify(error)) !== null && _a !== void 0 ? _a : String(error);
44
+ }
45
+ catch (_b) {
46
+ return String(error);
47
+ }
48
+ }
35
49
  /**
36
50
  * Normalizes any thrown value into a lowercased `{name, message}` pair for matching. Shared by every
37
51
  * provider's classifier so they all extract the error the same way.
@@ -39,7 +53,16 @@ exports.StorageErrorClass = StorageErrorClass;
39
53
  function getErrorParts(error) {
40
54
  var _a, _b;
41
55
  if (error instanceof Error || (typeof DOMException !== 'undefined' && error instanceof DOMException)) {
42
- return { name: ((_a = error.name) !== null && _a !== void 0 ? _a : '').toLowerCase(), message: ((_b = error.message) !== null && _b !== void 0 ? _b : '').toLowerCase() };
56
+ return {
57
+ name: ((_a = error.name) !== null && _a !== void 0 ? _a : '').toLowerCase(),
58
+ message: ((_b = error.message) !== null && _b !== void 0 ? _b : '').toLowerCase(),
59
+ };
60
+ }
61
+ if (typeof error === 'string') {
62
+ return { name: '', message: error.toLowerCase() };
63
+ }
64
+ if (error === null || error === undefined) {
65
+ return { name: '', message: '' };
43
66
  }
44
- return { name: '', message: String(error !== null && error !== void 0 ? error : '').toLowerCase() };
67
+ return { name: '', message: serializeThrownValue(error).toLowerCase() };
45
68
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-onyx",
3
- "version": "3.0.105",
3
+ "version": "3.0.106",
4
4
  "author": "Expensify, Inc.",
5
5
  "homepage": "https://expensify.com",
6
6
  "description": "State management for React Native",