react-native-onyx 1.0.120 → 1.0.121
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/web.development.js +118 -110
- package/dist/web.development.js.map +1 -1
- package/dist/web.min.js.map +1 -1
- package/lib/Logger.js +1 -5
- package/lib/MDTable.js +11 -14
- package/lib/Onyx.d.ts +1 -4
- package/lib/Onyx.js +237 -232
- package/lib/OnyxCache.js +12 -3
- package/lib/Str.js +1 -3
- package/lib/compose.js +6 -2
- package/lib/metrics/PerformanceUtils.js +2 -7
- package/lib/metrics/index.native.js +28 -41
- package/lib/metrics/index.web.js +4 -7
- package/lib/storage/WebStorage.js +5 -10
- package/lib/storage/__mocks__/index.js +2 -2
- package/lib/storage/providers/IDBKeyVal.js +27 -37
- package/lib/storage/providers/SQLiteStorage.js +58 -62
- package/lib/types.d.ts +1 -13
- package/lib/utils.d.ts +2 -6
- package/lib/utils.js +19 -22
- package/lib/withOnyx.d.ts +8 -32
- package/lib/withOnyx.js +37 -34
- package/package.json +6 -3
package/lib/Logger.js
CHANGED
package/lib/MDTable.js
CHANGED
|
@@ -24,17 +24,16 @@ class MDTable extends AsciTable {
|
|
|
24
24
|
toString() {
|
|
25
25
|
// Ignore modifying the first |---| for titled tables
|
|
26
26
|
let idx = this.getTitle() ? -2 : -1;
|
|
27
|
-
const ascii = super.toString()
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
idx++;
|
|
27
|
+
const ascii = super.toString().replace(/-\|/g, () => {
|
|
28
|
+
/* we replace "----|" with "---:|" to align the data to the right in MD */
|
|
29
|
+
idx++;
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
if (idx < 0 || this.leftAlignedCols.includes(idx)) {
|
|
32
|
+
return '-|';
|
|
33
|
+
}
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
return ':|';
|
|
36
|
+
});
|
|
38
37
|
|
|
39
38
|
// strip the top and the bottom row (----) to make an MD table
|
|
40
39
|
const md = ascii.split('\n').slice(1, -1).join('\n');
|
|
@@ -52,16 +51,14 @@ class MDTable extends AsciTable {
|
|
|
52
51
|
* @param {Array} [options.rows] The table can be initialized with row. Rows can also be added by `addRow`
|
|
53
52
|
* @returns {MDTable}
|
|
54
53
|
*/
|
|
55
|
-
MDTable.factory = ({
|
|
56
|
-
title, heading, leftAlignedCols = [], rows = [],
|
|
57
|
-
}) => {
|
|
54
|
+
MDTable.factory = ({title, heading, leftAlignedCols = [], rows = []}) => {
|
|
58
55
|
const table = new MDTable({title, heading, rows});
|
|
59
56
|
table.leftAlignedCols = leftAlignedCols;
|
|
60
57
|
|
|
61
58
|
/* By default we want everything aligned to the right as most values are numbers
|
|
62
|
-
|
|
59
|
+
* we just override the columns that are not right aligned */
|
|
63
60
|
heading.forEach((name, idx) => table.setAlign(idx, AsciTable.RIGHT));
|
|
64
|
-
leftAlignedCols.forEach(idx => table.setAlign(idx, AsciTable.LEFT));
|
|
61
|
+
leftAlignedCols.forEach((idx) => table.setAlign(idx, AsciTable.LEFT));
|
|
65
62
|
|
|
66
63
|
return table;
|
|
67
64
|
};
|
package/lib/Onyx.d.ts
CHANGED
|
@@ -244,10 +244,7 @@ declare function clear(keysToPreserve?: OnyxKey[]): Promise<void>;
|
|
|
244
244
|
* @param collectionKey e.g. `ONYXKEYS.COLLECTION.REPORT`
|
|
245
245
|
* @param collection Object collection keyed by individual collection member keys and values
|
|
246
246
|
*/
|
|
247
|
-
declare function mergeCollection<TKey extends CollectionKeyBase, TMap>(
|
|
248
|
-
collectionKey: TKey,
|
|
249
|
-
collection: Collection<TKey, TMap, NullishDeep<KeyValueMapping[TKey]>>,
|
|
250
|
-
): Promise<void>;
|
|
247
|
+
declare function mergeCollection<TKey extends CollectionKeyBase, TMap>(collectionKey: TKey, collection: Collection<TKey, TMap, NullishDeep<KeyValueMapping[TKey]>>): Promise<void>;
|
|
251
248
|
|
|
252
249
|
/**
|
|
253
250
|
* Insert API responses and lifecycle data into Onyx
|