react-native-nitro-storage 0.10.0 → 0.10.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/CHANGELOG.md +12 -0
- package/README.md +6 -6
- package/android/build.gradle +3 -1
- package/lib/commonjs/core/durability.js +2 -3
- package/lib/commonjs/core/durability.js.map +1 -1
- package/lib/commonjs/storage-core.js +57 -48
- package/lib/commonjs/storage-core.js.map +1 -1
- package/lib/module/core/durability.js +2 -3
- package/lib/module/core/durability.js.map +1 -1
- package/lib/module/storage-core.js +57 -48
- package/lib/module/storage-core.js.map +1 -1
- package/lib/typescript/core/durability.d.ts +2 -3
- package/lib/typescript/core/durability.d.ts.map +1 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/index.web.d.ts.map +1 -1
- package/lib/typescript/storage-core.d.ts.map +1 -1
- package/lib/typescript/testing.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/core/durability.ts +4 -7
- package/src/storage-core.ts +61 -58
|
@@ -158,18 +158,6 @@ export function createStorageCore(buildAdapter) {
|
|
|
158
158
|
function recordMetric(operation, scope, durationMs, keysCount = 1) {
|
|
159
159
|
metrics.record(operation, scope, durationMs, keysCount);
|
|
160
160
|
}
|
|
161
|
-
function readPendingSecureWrite(key) {
|
|
162
|
-
return durability.readPendingSecureWrite(key);
|
|
163
|
-
}
|
|
164
|
-
function readPendingDiskWrite(key) {
|
|
165
|
-
return durability.readPendingDiskWrite(key);
|
|
166
|
-
}
|
|
167
|
-
function hasPendingDiskWrite(key) {
|
|
168
|
-
return durability.hasPendingDiskWrite(key);
|
|
169
|
-
}
|
|
170
|
-
function hasPendingSecureWrite(key) {
|
|
171
|
-
return durability.hasPendingSecureWrite(key);
|
|
172
|
-
}
|
|
173
161
|
function clearPendingDiskWrite(key) {
|
|
174
162
|
durability.clearPendingDiskWrite(key);
|
|
175
163
|
}
|
|
@@ -202,11 +190,17 @@ export function createStorageCore(buildAdapter) {
|
|
|
202
190
|
const value = memoryStore.get(key);
|
|
203
191
|
return typeof value === "string" ? value : undefined;
|
|
204
192
|
}
|
|
205
|
-
if (scope === StorageScope.Disk
|
|
206
|
-
|
|
193
|
+
if (scope === StorageScope.Disk) {
|
|
194
|
+
const pending = durability.getPendingDiskWrite(key);
|
|
195
|
+
if (pending !== undefined) {
|
|
196
|
+
return pending.value;
|
|
197
|
+
}
|
|
207
198
|
}
|
|
208
|
-
if (scope === StorageScope.Secure
|
|
209
|
-
|
|
199
|
+
if (scope === StorageScope.Secure) {
|
|
200
|
+
const pending = durability.getPendingSecureWrite(key);
|
|
201
|
+
if (pending !== undefined) {
|
|
202
|
+
return pending.value;
|
|
203
|
+
}
|
|
210
204
|
}
|
|
211
205
|
return adapter.backend.get(key, scope);
|
|
212
206
|
}
|
|
@@ -222,13 +216,17 @@ export function createStorageCore(buildAdapter) {
|
|
|
222
216
|
const value = memoryStore.get(key);
|
|
223
217
|
return typeof value === "string" ? unescapeCollidingRawValue(value) : undefined;
|
|
224
218
|
}
|
|
225
|
-
if (scope === StorageScope.Disk
|
|
226
|
-
const pending =
|
|
227
|
-
|
|
219
|
+
if (scope === StorageScope.Disk) {
|
|
220
|
+
const pending = durability.getPendingDiskWrite(key);
|
|
221
|
+
if (pending !== undefined) {
|
|
222
|
+
return pending.value === undefined ? undefined : unescapeCollidingRawValue(pending.value);
|
|
223
|
+
}
|
|
228
224
|
}
|
|
229
|
-
if (scope === StorageScope.Secure
|
|
230
|
-
const pending =
|
|
231
|
-
|
|
225
|
+
if (scope === StorageScope.Secure) {
|
|
226
|
+
const pending = durability.getPendingSecureWrite(key);
|
|
227
|
+
if (pending !== undefined) {
|
|
228
|
+
return pending.value === undefined ? undefined : unescapeCollidingRawValue(pending.value);
|
|
229
|
+
}
|
|
232
230
|
}
|
|
233
231
|
const raw = adapter.backend.get(key, scope);
|
|
234
232
|
return raw === undefined ? undefined : unescapeCollidingRawValue(raw);
|
|
@@ -906,24 +904,28 @@ export function createStorageCore(buildAdapter) {
|
|
|
906
904
|
return typeof memoryStored === "string" ? unescapeCollidingRawValue(memoryStored) : memoryStored;
|
|
907
905
|
}
|
|
908
906
|
if (nonMemoryScope === StorageScope.Disk) {
|
|
909
|
-
|
|
910
|
-
|
|
907
|
+
const pending = durability.getPendingDiskWrite(storageKey);
|
|
908
|
+
if (pending !== undefined) {
|
|
909
|
+
return pending.value;
|
|
911
910
|
}
|
|
912
911
|
}
|
|
913
912
|
if (nonMemoryScope === StorageScope.Secure && !isBiometric) {
|
|
914
|
-
|
|
915
|
-
|
|
913
|
+
const pending = durability.getPendingSecureWrite(storageKey);
|
|
914
|
+
if (pending !== undefined) {
|
|
915
|
+
return pending.value;
|
|
916
916
|
}
|
|
917
917
|
}
|
|
918
918
|
migrateRenamesIfNeeded();
|
|
919
919
|
if (nonMemoryScope === StorageScope.Disk) {
|
|
920
|
-
|
|
921
|
-
|
|
920
|
+
const pending = durability.getPendingDiskWrite(storageKey);
|
|
921
|
+
if (pending !== undefined) {
|
|
922
|
+
return pending.value;
|
|
922
923
|
}
|
|
923
924
|
}
|
|
924
925
|
if (nonMemoryScope === StorageScope.Secure && !isBiometric) {
|
|
925
|
-
|
|
926
|
-
|
|
926
|
+
const pending = durability.getPendingSecureWrite(storageKey);
|
|
927
|
+
if (pending !== undefined) {
|
|
928
|
+
return pending.value;
|
|
927
929
|
}
|
|
928
930
|
}
|
|
929
931
|
if (readCache) {
|
|
@@ -1111,19 +1113,22 @@ export function createStorageCore(buildAdapter) {
|
|
|
1111
1113
|
const records = getItemStateKeys().map(key => {
|
|
1112
1114
|
let pending;
|
|
1113
1115
|
if (nonMemoryScope === StorageScope.Disk) {
|
|
1114
|
-
|
|
1116
|
+
const pendingWrite = durability.getPendingDiskWrite(key);
|
|
1117
|
+
if (pendingWrite !== undefined) {
|
|
1115
1118
|
pending = {
|
|
1116
|
-
value:
|
|
1119
|
+
value: pendingWrite.value
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
} else if (nonMemoryScope === StorageScope.Secure && !isBiometric) {
|
|
1123
|
+
const pendingWrite = durability.getPendingSecureWrite(key);
|
|
1124
|
+
if (pendingWrite !== undefined) {
|
|
1125
|
+
pending = {
|
|
1126
|
+
value: pendingWrite.value,
|
|
1127
|
+
...(pendingWrite.accessControl === undefined ? {} : {
|
|
1128
|
+
accessControl: pendingWrite.accessControl
|
|
1129
|
+
})
|
|
1117
1130
|
};
|
|
1118
1131
|
}
|
|
1119
|
-
} else if (nonMemoryScope === StorageScope.Secure && !isBiometric && durability.hasPendingSecureWrite(key)) {
|
|
1120
|
-
const accessControl = durability.readPendingSecureAccessControl(key);
|
|
1121
|
-
pending = {
|
|
1122
|
-
value: durability.readPendingSecureWrite(key),
|
|
1123
|
-
...(accessControl === undefined ? {} : {
|
|
1124
|
-
accessControl
|
|
1125
|
-
})
|
|
1126
|
-
};
|
|
1127
1132
|
}
|
|
1128
1133
|
return {
|
|
1129
1134
|
key,
|
|
@@ -1676,13 +1681,15 @@ export function createStorageCore(buildAdapter) {
|
|
|
1676
1681
|
if (isMemory) return memoryStore.has(storageKey);
|
|
1677
1682
|
if (isBiometric) return adapter.backend.hasSecureBiometric(storageKey);
|
|
1678
1683
|
if (nonMemoryScope === StorageScope.Disk) {
|
|
1679
|
-
|
|
1680
|
-
|
|
1684
|
+
const pending = durability.getPendingDiskWrite(storageKey);
|
|
1685
|
+
if (pending !== undefined) {
|
|
1686
|
+
return pending.value !== undefined;
|
|
1681
1687
|
}
|
|
1682
1688
|
}
|
|
1683
1689
|
if (nonMemoryScope === StorageScope.Secure) {
|
|
1684
|
-
|
|
1685
|
-
|
|
1690
|
+
const pending = durability.getPendingSecureWrite(storageKey);
|
|
1691
|
+
if (pending !== undefined) {
|
|
1692
|
+
return pending.value !== undefined;
|
|
1686
1693
|
}
|
|
1687
1694
|
}
|
|
1688
1695
|
return adapter.backend.has(storageKey, config.scope);
|
|
@@ -1801,14 +1808,16 @@ export function createStorageCore(buildAdapter) {
|
|
|
1801
1808
|
const keyIndexes = [];
|
|
1802
1809
|
items.forEach((item, index) => {
|
|
1803
1810
|
if (scope === StorageScope.Disk) {
|
|
1804
|
-
|
|
1805
|
-
|
|
1811
|
+
const pending = durability.getPendingDiskWrite(item.key);
|
|
1812
|
+
if (pending !== undefined) {
|
|
1813
|
+
rawValues[index] = pending.value;
|
|
1806
1814
|
return;
|
|
1807
1815
|
}
|
|
1808
1816
|
}
|
|
1809
1817
|
if (scope === StorageScope.Secure) {
|
|
1810
|
-
|
|
1811
|
-
|
|
1818
|
+
const pending = durability.getPendingSecureWrite(item.key);
|
|
1819
|
+
if (pending !== undefined) {
|
|
1820
|
+
rawValues[index] = pending.value;
|
|
1812
1821
|
return;
|
|
1813
1822
|
}
|
|
1814
1823
|
}
|