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
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
Breaking changes are always listed first in each release section.
|
|
8
8
|
|
|
9
|
+
## [0.10.1] - 2026-09-09
|
|
10
|
+
|
|
11
|
+
### Breaking changes
|
|
12
|
+
|
|
13
|
+
- None.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Apply the Kotlin Android plugin only when the Gradle Kotlin extension is
|
|
18
|
+
absent, so AGP 9 consumers that already ship built-in Kotlin can configure
|
|
19
|
+
the library.
|
|
20
|
+
|
|
9
21
|
## [0.10.0] - 2026-08-25
|
|
10
22
|
|
|
11
23
|
### Breaking changes
|
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/react-native-nitro-storage)
|
|
5
5
|
[](https://github.com/JoaoPauloCMarra/react-native-nitro-storage/actions/workflows/ci.yml)
|
|
6
6
|
[](https://github.com/JoaoPauloCMarra/react-native-nitro-storage/blob/main/LICENSE)
|
|
7
|
-
[](https://reactnative.dev/docs/0.86/getting-started-without-a-framework)
|
|
8
|
+
[](https://docs.expo.dev/versions/v57.0.0/)
|
|
9
9
|
[](https://nitro.margelo.com/)
|
|
10
10
|
[](https://www.typescriptlang.org/)
|
|
11
11
|
|
|
@@ -65,11 +65,11 @@ Peer dependencies:
|
|
|
65
65
|
|
|
66
66
|
Nitro peer requirement: `react-native-nitro-modules >=0.37.0 <0.38.0`.
|
|
67
67
|
|
|
68
|
-
The package gate uses React Native `0.86.
|
|
68
|
+
The package gate uses React Native `0.86.3` and the Strict TypeScript API.
|
|
69
69
|
`check:ci` also compiles the public source against React Native `0.87.0`'s
|
|
70
70
|
Strict TypeScript API; this does not change the runtime baseline. The Expo
|
|
71
|
-
example uses Expo SDK `57.0.
|
|
72
|
-
`0.86.
|
|
71
|
+
example uses Expo SDK `57.0.21`, React Native
|
|
72
|
+
`0.86.3`, React `19.2.3`, and Nitro Modules `0.37.1`, which is the React Native
|
|
73
73
|
version supported by that Expo SDK. Do not override Expo's React Native version.
|
|
74
74
|
|
|
75
75
|
When upgrading from 0.8.x or 0.9.x, upgrade Nitro Modules to the 0.37.x range
|
|
@@ -77,7 +77,7 @@ before installing this package, then rebuild the native app so the generated
|
|
|
77
77
|
Nitro bindings and native runtime use the same major-minor version:
|
|
78
78
|
|
|
79
79
|
```sh
|
|
80
|
-
bun add react-native-nitro-modules@0.37.
|
|
80
|
+
bun add react-native-nitro-modules@0.37.1 react-native-nitro-storage@0.10.1
|
|
81
81
|
bunx expo prebuild
|
|
82
82
|
```
|
|
83
83
|
|
package/android/build.gradle
CHANGED
|
@@ -15,7 +15,9 @@ def reactNativeArchitectures() {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
apply plugin: "com.android.library"
|
|
18
|
-
|
|
18
|
+
if (project.extensions.findByName("kotlin") == null) {
|
|
19
|
+
apply plugin: "org.jetbrains.kotlin.android"
|
|
20
|
+
}
|
|
19
21
|
// Apply autolinking script for Nitro
|
|
20
22
|
apply from: "../nitrogen/generated/android/NitroStorage+autolinking.gradle"
|
|
21
23
|
|
|
@@ -169,9 +169,8 @@ function createDurabilityCoordinator(options) {
|
|
|
169
169
|
isDiskWritesAsync: () => diskWritesAsync,
|
|
170
170
|
hasPendingDiskWrite: key => pendingDiskWrites.has(key),
|
|
171
171
|
hasPendingSecureWrite: key => pendingSecureWrites.has(key),
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
readPendingSecureAccessControl: key => pendingSecureWrites.get(key)?.accessControl,
|
|
172
|
+
getPendingDiskWrite: key => pendingDiskWrites.get(key),
|
|
173
|
+
getPendingSecureWrite: key => pendingSecureWrites.get(key),
|
|
175
174
|
clearPendingDiskWrite: key => {
|
|
176
175
|
pendingDiskWrites.delete(key);
|
|
177
176
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_shared","require","_Storage","createDurabilityCoordinator","options","pendingDiskWrites","Map","nextGeneration","diskFlushScheduled","diskWritesAsync","pendingSecureWrites","secureFlushScheduled","securePromotionsInProgress","Set","clearPendingWrites","pendingWrites","writes","forEach","write","get","key","delete","restorePendingWrites","has","set","flushDiskWrites","size","Array","from","values","setWrites","filter","value","undefined","removeWrites","length","backend","setBatch","map","StorageScope","Disk","error","removeBatch","flushSecureWrites","groupedSetWrites","accessControl","push","resolvedAccessControl","resolveSecureDefaultAccessControl","existingGroup","group","setSecureAccessControl","Secure","scheduleDiskWrite","pendingWrite","generation","runMicrotask","scheduleSecureWrite","runSecurePromotion","promotion","Error","add","setDiskWritesAsync","enabled","isDiskWritesAsync","hasPendingDiskWrite","hasPendingSecureWrite","
|
|
1
|
+
{"version":3,"names":["_shared","require","_Storage","createDurabilityCoordinator","options","pendingDiskWrites","Map","nextGeneration","diskFlushScheduled","diskWritesAsync","pendingSecureWrites","secureFlushScheduled","securePromotionsInProgress","Set","clearPendingWrites","pendingWrites","writes","forEach","write","get","key","delete","restorePendingWrites","has","set","flushDiskWrites","size","Array","from","values","setWrites","filter","value","undefined","removeWrites","length","backend","setBatch","map","StorageScope","Disk","error","removeBatch","flushSecureWrites","groupedSetWrites","accessControl","push","resolvedAccessControl","resolveSecureDefaultAccessControl","existingGroup","group","setSecureAccessControl","Secure","scheduleDiskWrite","pendingWrite","generation","runMicrotask","scheduleSecureWrite","runSecurePromotion","promotion","Error","add","setDiskWritesAsync","enabled","isDiskWritesAsync","hasPendingDiskWrite","hasPendingSecureWrite","getPendingDiskWrite","getPendingSecureWrite","clearPendingDiskWrite","clearPendingSecureWrite","clearPendingDiskWriteIf","clearPendingSecureWriteIf","clearAllPendingDiskWrites","clear","clearAllPendingSecureWrites"],"sourceRoot":"../../../src","sources":["core/durability.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAiCO,SAASE,2BAA2BA,CAACC,OAG3C,EAAyB;EAGxB,MAAMC,iBAAiB,GAAG,IAAIC,GAAG,CAA2B,CAAC;EAC7D,IAAIC,cAAc,GAAG,CAAC;EACtB,IAAIC,kBAAkB,GAAG,KAAK;EAC9B,IAAIC,eAAe,GAAG,KAAK;EAC3B,MAAMC,mBAAmB,GAAG,IAAIJ,GAAG,CAA6B,CAAC;EACjE,IAAIK,oBAAoB,GAAG,KAAK;EAChC,MAAMC,0BAA0B,GAAG,IAAIC,GAAG,CAAS,CAAC;EAEpD,SAASC,kBAAkBA,CACzBC,aAA6B,EAC7BC,MAAoB,EACd;IACNA,MAAM,CAACC,OAAO,CAAEC,KAAK,IAAK;MACxB,IAAIH,aAAa,CAACI,GAAG,CAACD,KAAK,CAACE,GAAG,CAAC,KAAKF,KAAK,EAAE;QAC1CH,aAAa,CAACM,MAAM,CAACH,KAAK,CAACE,GAAG,CAAC;MACjC;IACF,CAA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IAAKf,iBAAiB,CAACkB,GAAG,CAACH,GAAG,CAAC;IACxD8C,qBAAqB,EAAG9C,GAAG,IAAKV,mBAAmB,CAACa,GAAG,CAACH,GAAG,CAAC;IAC5D+C,mBAAmB,EAAG/C,GAAG,IAAKf,iBAAiB,CAACc,GAAG,CAACC,GAAG,CAAC;IACxDgD,qBAAqB,EAAGhD,GAAG,IAAKV,mBAAmB,CAACS,GAAG,CAACC,GAAG,CAAC;IAC5DiD,qBAAqB,EAAGjD,GAAG,IAAK;MAC9Bf,iBAAiB,CAACgB,MAAM,CAACD,GAAG,CAAC;IAC/B,CAAC;IACDkD,uBAAuB,EAAGlD,GAAG,IAAK;MAChCV,mBAAmB,CAACW,MAAM,CAACD,GAAG,CAAC;IACjC,CAAC;IACDmD,uBAAuB,EAAGrD,KAAK,IAAK;MAClC,IAAIb,iBAAiB,CAACc,GAAG,CAACD,KAAK,CAACE,GAAG,CAAC,KAAKF,KAAK,EAAE;QAC9Cb,iBAAiB,CAACgB,MAAM,CAACH,KAAK,CAACE,GAAG,CAAC;MACrC;IACF,CAAC;IACDoD,yBAAyB,EAAGtD,KAAK,IAAK;MACpC,IAAIR,mBAAmB,CAACS,GAAG,CAACD,KAAK,CAACE,GAAG,CAAC,KAAKF,KAAK,EAAE;QAChDR,mBAAmB,CAACW,MAAM,CAACH,KAAK,CAACE,GAAG,CAAC;MACvC;IACF,CAAC;IACDqD,yBAAyB,EAAEA,CAAA,KAAM;MAC/BpE,iBAAiB,CAACqE,KAAK,CAAC,CAAC;IAC3B,CAAC;IACDC,2BAA2B,EAAEA,CAAA,KAAM;MACjCjE,mBAAmB,CAACgE,KAAK,CAAC,CAAC;IAC7B,CAAC;IACDrB,iBAAiB;IACjBI,mBAAmB;IACnBhC,eAAe;IACfkB,iBAAiB;IACjBe;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -162,18 +162,6 @@ function createStorageCore(buildAdapter) {
|
|
|
162
162
|
function recordMetric(operation, scope, durationMs, keysCount = 1) {
|
|
163
163
|
metrics.record(operation, scope, durationMs, keysCount);
|
|
164
164
|
}
|
|
165
|
-
function readPendingSecureWrite(key) {
|
|
166
|
-
return durability.readPendingSecureWrite(key);
|
|
167
|
-
}
|
|
168
|
-
function readPendingDiskWrite(key) {
|
|
169
|
-
return durability.readPendingDiskWrite(key);
|
|
170
|
-
}
|
|
171
|
-
function hasPendingDiskWrite(key) {
|
|
172
|
-
return durability.hasPendingDiskWrite(key);
|
|
173
|
-
}
|
|
174
|
-
function hasPendingSecureWrite(key) {
|
|
175
|
-
return durability.hasPendingSecureWrite(key);
|
|
176
|
-
}
|
|
177
165
|
function clearPendingDiskWrite(key) {
|
|
178
166
|
durability.clearPendingDiskWrite(key);
|
|
179
167
|
}
|
|
@@ -206,11 +194,17 @@ function createStorageCore(buildAdapter) {
|
|
|
206
194
|
const value = memoryStore.get(key);
|
|
207
195
|
return typeof value === "string" ? value : undefined;
|
|
208
196
|
}
|
|
209
|
-
if (scope === _Storage.StorageScope.Disk
|
|
210
|
-
|
|
197
|
+
if (scope === _Storage.StorageScope.Disk) {
|
|
198
|
+
const pending = durability.getPendingDiskWrite(key);
|
|
199
|
+
if (pending !== undefined) {
|
|
200
|
+
return pending.value;
|
|
201
|
+
}
|
|
211
202
|
}
|
|
212
|
-
if (scope === _Storage.StorageScope.Secure
|
|
213
|
-
|
|
203
|
+
if (scope === _Storage.StorageScope.Secure) {
|
|
204
|
+
const pending = durability.getPendingSecureWrite(key);
|
|
205
|
+
if (pending !== undefined) {
|
|
206
|
+
return pending.value;
|
|
207
|
+
}
|
|
214
208
|
}
|
|
215
209
|
return adapter.backend.get(key, scope);
|
|
216
210
|
}
|
|
@@ -226,13 +220,17 @@ function createStorageCore(buildAdapter) {
|
|
|
226
220
|
const value = memoryStore.get(key);
|
|
227
221
|
return typeof value === "string" ? (0, _internal.unescapeCollidingRawValue)(value) : undefined;
|
|
228
222
|
}
|
|
229
|
-
if (scope === _Storage.StorageScope.Disk
|
|
230
|
-
const pending =
|
|
231
|
-
|
|
223
|
+
if (scope === _Storage.StorageScope.Disk) {
|
|
224
|
+
const pending = durability.getPendingDiskWrite(key);
|
|
225
|
+
if (pending !== undefined) {
|
|
226
|
+
return pending.value === undefined ? undefined : (0, _internal.unescapeCollidingRawValue)(pending.value);
|
|
227
|
+
}
|
|
232
228
|
}
|
|
233
|
-
if (scope === _Storage.StorageScope.Secure
|
|
234
|
-
const pending =
|
|
235
|
-
|
|
229
|
+
if (scope === _Storage.StorageScope.Secure) {
|
|
230
|
+
const pending = durability.getPendingSecureWrite(key);
|
|
231
|
+
if (pending !== undefined) {
|
|
232
|
+
return pending.value === undefined ? undefined : (0, _internal.unescapeCollidingRawValue)(pending.value);
|
|
233
|
+
}
|
|
236
234
|
}
|
|
237
235
|
const raw = adapter.backend.get(key, scope);
|
|
238
236
|
return raw === undefined ? undefined : (0, _internal.unescapeCollidingRawValue)(raw);
|
|
@@ -910,24 +908,28 @@ function createStorageCore(buildAdapter) {
|
|
|
910
908
|
return typeof memoryStored === "string" ? (0, _internal.unescapeCollidingRawValue)(memoryStored) : memoryStored;
|
|
911
909
|
}
|
|
912
910
|
if (nonMemoryScope === _Storage.StorageScope.Disk) {
|
|
913
|
-
|
|
914
|
-
|
|
911
|
+
const pending = durability.getPendingDiskWrite(storageKey);
|
|
912
|
+
if (pending !== undefined) {
|
|
913
|
+
return pending.value;
|
|
915
914
|
}
|
|
916
915
|
}
|
|
917
916
|
if (nonMemoryScope === _Storage.StorageScope.Secure && !isBiometric) {
|
|
918
|
-
|
|
919
|
-
|
|
917
|
+
const pending = durability.getPendingSecureWrite(storageKey);
|
|
918
|
+
if (pending !== undefined) {
|
|
919
|
+
return pending.value;
|
|
920
920
|
}
|
|
921
921
|
}
|
|
922
922
|
migrateRenamesIfNeeded();
|
|
923
923
|
if (nonMemoryScope === _Storage.StorageScope.Disk) {
|
|
924
|
-
|
|
925
|
-
|
|
924
|
+
const pending = durability.getPendingDiskWrite(storageKey);
|
|
925
|
+
if (pending !== undefined) {
|
|
926
|
+
return pending.value;
|
|
926
927
|
}
|
|
927
928
|
}
|
|
928
929
|
if (nonMemoryScope === _Storage.StorageScope.Secure && !isBiometric) {
|
|
929
|
-
|
|
930
|
-
|
|
930
|
+
const pending = durability.getPendingSecureWrite(storageKey);
|
|
931
|
+
if (pending !== undefined) {
|
|
932
|
+
return pending.value;
|
|
931
933
|
}
|
|
932
934
|
}
|
|
933
935
|
if (readCache) {
|
|
@@ -1115,19 +1117,22 @@ function createStorageCore(buildAdapter) {
|
|
|
1115
1117
|
const records = getItemStateKeys().map(key => {
|
|
1116
1118
|
let pending;
|
|
1117
1119
|
if (nonMemoryScope === _Storage.StorageScope.Disk) {
|
|
1118
|
-
|
|
1120
|
+
const pendingWrite = durability.getPendingDiskWrite(key);
|
|
1121
|
+
if (pendingWrite !== undefined) {
|
|
1119
1122
|
pending = {
|
|
1120
|
-
value:
|
|
1123
|
+
value: pendingWrite.value
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1126
|
+
} else if (nonMemoryScope === _Storage.StorageScope.Secure && !isBiometric) {
|
|
1127
|
+
const pendingWrite = durability.getPendingSecureWrite(key);
|
|
1128
|
+
if (pendingWrite !== undefined) {
|
|
1129
|
+
pending = {
|
|
1130
|
+
value: pendingWrite.value,
|
|
1131
|
+
...(pendingWrite.accessControl === undefined ? {} : {
|
|
1132
|
+
accessControl: pendingWrite.accessControl
|
|
1133
|
+
})
|
|
1121
1134
|
};
|
|
1122
1135
|
}
|
|
1123
|
-
} else if (nonMemoryScope === _Storage.StorageScope.Secure && !isBiometric && durability.hasPendingSecureWrite(key)) {
|
|
1124
|
-
const accessControl = durability.readPendingSecureAccessControl(key);
|
|
1125
|
-
pending = {
|
|
1126
|
-
value: durability.readPendingSecureWrite(key),
|
|
1127
|
-
...(accessControl === undefined ? {} : {
|
|
1128
|
-
accessControl
|
|
1129
|
-
})
|
|
1130
|
-
};
|
|
1131
1136
|
}
|
|
1132
1137
|
return {
|
|
1133
1138
|
key,
|
|
@@ -1680,13 +1685,15 @@ function createStorageCore(buildAdapter) {
|
|
|
1680
1685
|
if (isMemory) return memoryStore.has(storageKey);
|
|
1681
1686
|
if (isBiometric) return adapter.backend.hasSecureBiometric(storageKey);
|
|
1682
1687
|
if (nonMemoryScope === _Storage.StorageScope.Disk) {
|
|
1683
|
-
|
|
1684
|
-
|
|
1688
|
+
const pending = durability.getPendingDiskWrite(storageKey);
|
|
1689
|
+
if (pending !== undefined) {
|
|
1690
|
+
return pending.value !== undefined;
|
|
1685
1691
|
}
|
|
1686
1692
|
}
|
|
1687
1693
|
if (nonMemoryScope === _Storage.StorageScope.Secure) {
|
|
1688
|
-
|
|
1689
|
-
|
|
1694
|
+
const pending = durability.getPendingSecureWrite(storageKey);
|
|
1695
|
+
if (pending !== undefined) {
|
|
1696
|
+
return pending.value !== undefined;
|
|
1690
1697
|
}
|
|
1691
1698
|
}
|
|
1692
1699
|
return adapter.backend.has(storageKey, config.scope);
|
|
@@ -1805,14 +1812,16 @@ function createStorageCore(buildAdapter) {
|
|
|
1805
1812
|
const keyIndexes = [];
|
|
1806
1813
|
items.forEach((item, index) => {
|
|
1807
1814
|
if (scope === _Storage.StorageScope.Disk) {
|
|
1808
|
-
|
|
1809
|
-
|
|
1815
|
+
const pending = durability.getPendingDiskWrite(item.key);
|
|
1816
|
+
if (pending !== undefined) {
|
|
1817
|
+
rawValues[index] = pending.value;
|
|
1810
1818
|
return;
|
|
1811
1819
|
}
|
|
1812
1820
|
}
|
|
1813
1821
|
if (scope === _Storage.StorageScope.Secure) {
|
|
1814
|
-
|
|
1815
|
-
|
|
1822
|
+
const pending = durability.getPendingSecureWrite(item.key);
|
|
1823
|
+
if (pending !== undefined) {
|
|
1824
|
+
rawValues[index] = pending.value;
|
|
1816
1825
|
return;
|
|
1817
1826
|
}
|
|
1818
1827
|
}
|