react-native-nitro-storage 0.5.8 → 0.6.0

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +384 -0
  2. package/README.md +178 -10
  3. package/android/src/main/AndroidManifest.xml +9 -0
  4. package/android/src/main/java/com/nitrostorage/NitroStorageInitializer.kt +38 -0
  5. package/app.plugin.js +3 -47
  6. package/cpp/bindings/HybridStorage.cpp +25 -9
  7. package/cpp/bindings/HybridStorage.hpp +5 -0
  8. package/lib/commonjs/index.js +19 -2
  9. package/lib/commonjs/index.js.map +1 -1
  10. package/lib/commonjs/index.web.js +19 -2
  11. package/lib/commonjs/index.web.js.map +1 -1
  12. package/lib/commonjs/shared.js.map +1 -1
  13. package/lib/commonjs/storage-core.js +306 -10
  14. package/lib/commonjs/storage-core.js.map +1 -1
  15. package/lib/commonjs/storage-events.js.map +1 -1
  16. package/lib/commonjs/storage-hooks.js +16 -1
  17. package/lib/commonjs/storage-hooks.js.map +1 -1
  18. package/lib/commonjs/testing.js +267 -0
  19. package/lib/commonjs/testing.js.map +1 -0
  20. package/lib/module/index.js +5 -1
  21. package/lib/module/index.js.map +1 -1
  22. package/lib/module/index.web.js +5 -1
  23. package/lib/module/index.web.js.map +1 -1
  24. package/lib/module/shared.js.map +1 -1
  25. package/lib/module/storage-core.js +307 -11
  26. package/lib/module/storage-core.js.map +1 -1
  27. package/lib/module/storage-events.js.map +1 -1
  28. package/lib/module/storage-hooks.js +15 -2
  29. package/lib/module/storage-hooks.js.map +1 -1
  30. package/lib/module/testing.js +188 -0
  31. package/lib/module/testing.js.map +1 -0
  32. package/lib/typescript/index.d.ts +22 -4
  33. package/lib/typescript/index.d.ts.map +1 -1
  34. package/lib/typescript/index.web.d.ts +22 -4
  35. package/lib/typescript/index.web.d.ts.map +1 -1
  36. package/lib/typescript/shared.d.ts +1 -0
  37. package/lib/typescript/shared.d.ts.map +1 -1
  38. package/lib/typescript/storage-core.d.ts +51 -2
  39. package/lib/typescript/storage-core.d.ts.map +1 -1
  40. package/lib/typescript/storage-events.d.ts +1 -1
  41. package/lib/typescript/storage-events.d.ts.map +1 -1
  42. package/lib/typescript/storage-hooks.d.ts +18 -1
  43. package/lib/typescript/storage-hooks.d.ts.map +1 -1
  44. package/lib/typescript/testing.d.ts +148 -0
  45. package/lib/typescript/testing.d.ts.map +1 -0
  46. package/package.json +8 -1
  47. package/src/index.ts +16 -2
  48. package/src/index.web.ts +16 -2
  49. package/src/shared.ts +1 -0
  50. package/src/storage-core.ts +446 -11
  51. package/src/storage-events.ts +2 -0
  52. package/src/storage-hooks.ts +42 -3
  53. package/src/testing.ts +270 -0
package/src/index.ts CHANGED
@@ -58,7 +58,7 @@ export type {
58
58
  StorageEventListener,
59
59
  StorageKeyChangeEvent,
60
60
  } from "./storage-events";
61
- export type { StorageSetter } from "./storage-hooks";
61
+ export type { StorageActions, StorageSetter } from "./storage-hooks";
62
62
  export type {
63
63
  WebDiskStorageBackend,
64
64
  WebSecureStorageBackend,
@@ -67,9 +67,13 @@ export type {
67
67
  WebStorageScope,
68
68
  } from "./web-storage-backend";
69
69
  export type {
70
+ SetItemConfig,
71
+ SetStorageItem,
70
72
  StorageBatchSetItem,
73
+ StorageClearOptions,
71
74
  StorageItem,
72
75
  StorageItemConfig,
76
+ StorageKeyRef,
73
77
  TransactionContext,
74
78
  } from "./storage-core";
75
79
 
@@ -307,6 +311,10 @@ export const storage = {
307
311
  };
308
312
 
309
313
  export const createStorageItem = core.createStorageItem;
314
+ export const memoryItem = core.memoryItem;
315
+ export const diskItem = core.diskItem;
316
+ export const secureItem = core.secureItem;
317
+ export const createSetItem = core.createSetItem;
310
318
  export const getBatch = core.getBatch;
311
319
  export const setBatch = core.setBatch;
312
320
  export const removeBatch = core.removeBatch;
@@ -341,5 +349,11 @@ export async function flushWebStorageBackends(): Promise<void> {
341
349
  // Native platforms do not use web storage backends.
342
350
  }
343
351
 
344
- export { useStorage, useStorageSelector, useSetStorage } from "./storage-hooks";
352
+ export {
353
+ useSetStorage,
354
+ useStorage,
355
+ useStorageActions,
356
+ useStorageSelector,
357
+ useStorageValue,
358
+ } from "./storage-hooks";
345
359
  export { createIndexedDBBackend } from "./indexeddb-backend";
package/src/index.web.ts CHANGED
@@ -57,7 +57,7 @@ export type {
57
57
  StorageEventListener,
58
58
  StorageKeyChangeEvent,
59
59
  } from "./storage-events";
60
- export type { StorageSetter } from "./storage-hooks";
60
+ export type { StorageActions, StorageSetter } from "./storage-hooks";
61
61
  export type {
62
62
  WebDiskStorageBackend,
63
63
  WebSecureStorageBackend,
@@ -66,9 +66,13 @@ export type {
66
66
  WebStorageScope,
67
67
  } from "./web-storage-backend";
68
68
  export type {
69
+ SetItemConfig,
70
+ SetStorageItem,
69
71
  StorageBatchSetItem,
72
+ StorageClearOptions,
70
73
  StorageItem,
71
74
  StorageItemConfig,
75
+ StorageKeyRef,
72
76
  TransactionContext,
73
77
  } from "./storage-core";
74
78
 
@@ -818,6 +822,10 @@ export const storage = {
818
822
  };
819
823
 
820
824
  export const createStorageItem = core.createStorageItem;
825
+ export const memoryItem = core.memoryItem;
826
+ export const diskItem = core.diskItem;
827
+ export const secureItem = core.secureItem;
828
+ export const createSetItem = core.createSetItem;
821
829
  export const getBatch = core.getBatch;
822
830
  export const setBatch = core.setBatch;
823
831
  export const removeBatch = core.removeBatch;
@@ -886,5 +894,11 @@ export async function flushWebStorageBackends(): Promise<void> {
886
894
  await Promise.all(flushes);
887
895
  }
888
896
 
889
- export { useStorage, useStorageSelector, useSetStorage } from "./storage-hooks";
897
+ export {
898
+ useSetStorage,
899
+ useStorage,
900
+ useStorageActions,
901
+ useStorageSelector,
902
+ useStorageValue,
903
+ } from "./storage-hooks";
890
904
  export { createIndexedDBBackend } from "./indexeddb-backend";
package/src/shared.ts CHANGED
@@ -241,6 +241,7 @@ export type SecureAuthStorageConfig<K extends string = string> = Record<
241
241
  biometric?: boolean;
242
242
  biometricLevel?: BiometricLevel;
243
243
  accessControl?: AccessControl;
244
+ renameFrom?: string | readonly string[];
244
245
  }
245
246
  >;
246
247