@nlabs/arkhamjs-storage-native 3.29.2 → 3.30.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.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @nlabs/arkhamjs-storage-native
2
2
 
3
+ > **React Native Storage Integration for ArkhamJS** - Seamless AsyncStorage persistence with automatic state synchronization, compression, and encryption support for React Native applications.
4
+
3
5
  [![npm version](https://img.shields.io/npm/v/@nlabs/arkhamjs-storage-native.svg?style=flat-square)](https://www.npmjs.com/package/@nlabs/arkhamjs-storage-native)
4
6
  [![npm downloads](https://img.shields.io/npm/dm/@nlabs/arkhamjs-storage-native.svg?style=flat-square)](https://www.npmjs.com/package/@nlabs/arkhamjs-storage-native)
5
7
  [![Travis](https://img.shields.io/travis/nitrogenlabs/arkhamjs.svg?style=flat-square)](https://travis-ci.org/nitrogenlabs/arkhamjs)
@@ -8,14 +10,441 @@
8
10
  [![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](http://opensource.org/licenses/MIT)
9
11
  [![Chat](https://img.shields.io/discord/446122412715802649.svg)](https://discord.gg/Ttgev58)
10
12
 
11
- ## Installation
13
+ ## 🚀 Features
14
+
15
+ - **📱 React Native Optimized** - Built specifically for React Native AsyncStorage
16
+ - **💾 Automatic Persistence** - State automatically persists across app sessions
17
+ - **🔄 Real-Time Sync** - State changes are immediately saved to AsyncStorage
18
+ - **🎯 Selective Persistence** - Choose which parts of state to persist
19
+ - **⚡ Performance Optimized** - Debounced writes and efficient serialization
20
+ - **🔒 Encryption Support** - Optional encryption for sensitive data
21
+ - **🗜️ Compression** - Automatic compression for large state objects
22
+ - **🔧 Configurable** - Extensive options for customization
23
+ - **🌲 Tree-shakable** - Only include what you need
24
+
25
+ ## 📦 Installation
26
+
27
+ ```bash
28
+ npm install @nlabs/arkhamjs-storage-native
29
+ ```
30
+
31
+ **Peer Dependencies:**
32
+
33
+ - `react-native` (any version)
34
+ - `@react-native-async-storage/async-storage` (for React Native 0.60+)
35
+
36
+ ## 🎯 Quick Start
37
+
38
+ ### **Basic Setup**
39
+
40
+ ```js
41
+ import { Flux } from '@nlabs/arkhamjs';
42
+ import { NativeStorage } from '@nlabs/arkhamjs-storage-native';
43
+
44
+ // Initialize Flux with native storage
45
+ Flux.init({
46
+ name: 'my-app',
47
+ stores: [UserStore, CartStore],
48
+ storage: NativeStorage, // Enable AsyncStorage persistence
49
+ storageWait: 300 // Debounce storage updates by 300ms
50
+ });
51
+
52
+ // State will automatically persist across app sessions
53
+ Flux.dispatch({ type: 'ADD_USER', user: { name: 'John' } });
54
+ // User data is now saved to AsyncStorage
55
+ ```
56
+
57
+ ### **Storage Types**
58
+
59
+ ```js
60
+ import { NativeStorage } from '@nlabs/arkhamjs-storage-native';
61
+
62
+ // Use AsyncStorage (persists across app sessions)
63
+ const asyncStorage = NativeStorage.async;
64
+
65
+ // Use custom storage implementation
66
+ const customStorage = NativeStorage.create({
67
+ getItem: (key) => customGet(key),
68
+ setItem: (key, value) => customSet(key, value),
69
+ removeItem: (key) => customRemove(key)
70
+ });
71
+
72
+ Flux.init({
73
+ name: 'my-app',
74
+ stores: [UserStore],
75
+ storage: asyncStorage, // or customStorage
76
+ });
77
+ ```
78
+
79
+ ## 🔧 Configuration Options
80
+
81
+ ### **Basic Configuration**
82
+
83
+ ```js
84
+ import { NativeStorage } from '@nlabs/arkhamjs-storage-native';
85
+
86
+ Flux.init({
87
+ name: 'my-app',
88
+ stores: [UserStore],
89
+ storage: NativeStorage,
90
+
91
+ // Storage options
92
+ storageWait: 300, // Debounce storage updates (ms)
93
+ storageDebounce: true, // Enable debouncing
94
+ storageThrottle: false, // Use throttling instead of debouncing
95
+
96
+ // Persistence options
97
+ storagePersist: true, // Enable persistence
98
+ storageRestore: true, // Restore state on initialization
99
+ storageClear: false, // Clear storage on initialization
100
+
101
+ // Data options
102
+ storageSerialize: true, // Serialize data before storage
103
+ storageCompress: false, // Compress data before storage
104
+ storageEncrypt: false, // Encrypt data before storage
105
+
106
+ // Key options
107
+ storageKey: 'arkhamjs-state', // Storage key prefix
108
+ storageNamespace: 'my-app', // Namespace for storage keys
109
+ });
110
+ ```
111
+
112
+ ### **Advanced Configuration**
113
+
114
+ ```js
115
+ import { NativeStorage } from '@nlabs/arkhamjs-storage-native';
116
+
117
+ Flux.init({
118
+ name: 'my-app',
119
+ stores: [UserStore],
120
+ storage: NativeStorage,
121
+
122
+ // Selective persistence
123
+ storagePaths: [
124
+ 'user.current', // Only persist current user
125
+ 'user.preferences', // Only persist user preferences
126
+ 'cart.items' // Only persist cart items
127
+ ],
128
+
129
+ // Exclude sensitive data
130
+ storageExclude: [
131
+ 'user.password', // Don't persist passwords
132
+ 'auth.token', // Don't persist auth tokens
133
+ 'temp.*' // Don't persist temporary data
134
+ ],
135
+
136
+ // Custom serialization
137
+ storageSerialize: (state) => {
138
+ // Custom serialization logic
139
+ return JSON.stringify(state, (key, value) => {
140
+ if (key === 'password') return undefined; // Remove passwords
141
+ if (key === 'token') return undefined; // Remove tokens
142
+ return value;
143
+ });
144
+ },
145
+
146
+ // Custom deserialization
147
+ storageDeserialize: (data) => {
148
+ // Custom deserialization logic
149
+ const state = JSON.parse(data);
150
+ // Add default values or transform data
151
+ return state;
152
+ },
153
+
154
+ // Storage events
155
+ storageEvents: {
156
+ onSave: (key, value) => {
157
+ console.log(`Saved to AsyncStorage: ${key}`);
158
+ },
159
+ onLoad: (key, value) => {
160
+ console.log(`Loaded from AsyncStorage: ${key}`);
161
+ },
162
+ onError: (error) => {
163
+ console.error('Storage error:', error);
164
+ }
165
+ }
166
+ });
167
+ ```
168
+
169
+ ## 🎨 Storage Features
170
+
171
+ ### **Automatic State Persistence**
172
+
173
+ State automatically persists across app sessions:
174
+
175
+ ```js
176
+ // User logs in
177
+ Flux.dispatch({ type: 'USER_LOGIN', user: { id: 1, name: 'John' } });
178
+
179
+ // User closes app and reopens
180
+ // State is automatically restored from AsyncStorage
181
+ const user = Flux.getState('user.current'); // { id: 1, name: 'John' }
182
+ ```
183
+
184
+ ### **Selective Persistence**
185
+
186
+ Choose which parts of state to persist:
187
+
188
+ ```js
189
+ Flux.init({
190
+ name: 'my-app',
191
+ stores: [UserStore],
192
+ storage: NativeStorage,
193
+
194
+ // Only persist specific paths
195
+ storagePaths: [
196
+ 'user.current', // Persist current user
197
+ 'user.preferences', // Persist user preferences
198
+ 'cart.items', // Persist cart items
199
+ 'ui.theme' // Persist UI theme
200
+ ],
201
+
202
+ // Exclude sensitive or temporary data
203
+ storageExclude: [
204
+ 'user.password', // Don't persist passwords
205
+ 'auth.token', // Don't persist auth tokens
206
+ 'temp.*', // Don't persist temporary data
207
+ 'ui.loading' // Don't persist loading states
208
+ ]
209
+ });
210
+ ```
211
+
212
+ ### **Data Compression**
213
+
214
+ Compress large state objects to save storage space:
215
+
216
+ ```js
217
+ import { NativeStorage } from '@nlabs/arkhamjs-storage-native';
218
+
219
+ Flux.init({
220
+ name: 'my-app',
221
+ stores: [UserStore],
222
+ storage: NativeStorage,
12
223
 
13
- Using [npm](https://www.npmjs.com/):
224
+ // Enable compression for large state objects
225
+ storageCompress: true,
226
+ storageCompressThreshold: 1024, // Compress if >1KB
14
227
 
15
- ```shell
16
- npm install --save @nlabs/arkhamjs-storage-native
228
+ // Custom compression
229
+ storageCompress: (data) => {
230
+ // Use custom compression library
231
+ return customCompress(data);
232
+ },
233
+
234
+ // Custom decompression
235
+ storageDecompress: (data) => {
236
+ // Use custom decompression library
237
+ return customDecompress(data);
238
+ }
239
+ });
240
+ ```
241
+
242
+ ### **Data Encryption**
243
+
244
+ Encrypt sensitive data before storage:
245
+
246
+ ```js
247
+ import { NativeStorage } from '@nlabs/arkhamjs-storage-native';
248
+
249
+ Flux.init({
250
+ name: 'my-app',
251
+ stores: [UserStore],
252
+ storage: NativeStorage,
253
+
254
+ // Enable encryption
255
+ storageEncrypt: true,
256
+ storageEncryptKey: 'your-secret-key',
257
+
258
+ // Custom encryption
259
+ storageEncrypt: (data, key) => {
260
+ // Use custom encryption library
261
+ return customEncrypt(data, key);
262
+ },
263
+
264
+ // Custom decryption
265
+ storageDecrypt: (data, key) => {
266
+ // Use custom decryption library
267
+ return customDecrypt(data, key);
268
+ }
269
+ });
17
270
  ```
18
271
 
19
- ## Documentation
272
+ ## 🔍 Advanced Usage
273
+
274
+ ### **Custom Storage Implementation**
275
+
276
+ ```js
277
+ import { NativeStorage } from '@nlabs/arkhamjs-storage-native';
278
+ import AsyncStorage from '@react-native-async-storage/async-storage';
279
+
280
+ // Create custom storage adapter
281
+ const customStorage = NativeStorage.create({
282
+ // Required methods
283
+ getItem: async (key) => {
284
+ // Custom get implementation
285
+ return await AsyncStorage.getItem(key);
286
+ },
287
+
288
+ setItem: async (key, value) => {
289
+ // Custom set implementation
290
+ await AsyncStorage.setItem(key, value);
291
+ },
292
+
293
+ removeItem: async (key) => {
294
+ // Custom remove implementation
295
+ await AsyncStorage.removeItem(key);
296
+ },
297
+
298
+ // Optional methods
299
+ clear: async () => {
300
+ // Custom clear implementation
301
+ await AsyncStorage.clear();
302
+ },
303
+
304
+ getAllKeys: async () => {
305
+ // Custom getAllKeys implementation
306
+ return await AsyncStorage.getAllKeys();
307
+ }
308
+ });
309
+
310
+ Flux.init({
311
+ name: 'my-app',
312
+ stores: [UserStore],
313
+ storage: customStorage
314
+ });
315
+ ```
316
+
317
+ ### **Storage Migration**
318
+
319
+ ```js
320
+ import { NativeStorage } from '@nlabs/arkhamjs-storage-native';
321
+
322
+ Flux.init({
323
+ name: 'my-app',
324
+ stores: [UserStore],
325
+ storage: NativeStorage,
326
+
327
+ // Storage migration
328
+ storageMigrate: (oldData, newData) => {
329
+ // Migrate from old format to new format
330
+ if (oldData.version === 1) {
331
+ return {
332
+ ...newData,
333
+ user: {
334
+ ...newData.user,
335
+ // Migrate old user format
336
+ current: oldData.user ? { ...oldData.user, id: oldData.user.id || 1 } : null
337
+ }
338
+ };
339
+ }
340
+ return newData;
341
+ },
342
+
343
+ // Version tracking
344
+ storageVersion: 2,
345
+
346
+ // Migration events
347
+ storageEvents: {
348
+ onMigrate: (oldVersion, newVersion) => {
349
+ console.log(`Migrated from v${oldVersion} to v${newVersion}`);
350
+ }
351
+ }
352
+ });
353
+ ```
354
+
355
+ ## 🎯 Use Cases
356
+
357
+ ### **User Preferences Persistence**
358
+
359
+ ```js
360
+ import { NativeStorage } from '@nlabs/arkhamjs-storage-native';
361
+
362
+ Flux.init({
363
+ name: 'my-app',
364
+ stores: [UserStore, PreferencesStore],
365
+ storage: NativeStorage,
366
+
367
+ // Only persist user preferences
368
+ storagePaths: [
369
+ 'user.preferences.theme',
370
+ 'user.preferences.language',
371
+ 'user.preferences.notifications',
372
+ 'ui.sidebar.collapsed'
373
+ ]
374
+ });
375
+
376
+ // User preferences will persist across app sessions
377
+ Flux.dispatch({ type: 'SET_THEME', theme: 'dark' });
378
+ // Theme preference is automatically saved
379
+ ```
380
+
381
+ ### **Shopping Cart Persistence**
382
+
383
+ ```js
384
+ import { NativeStorage } from '@nlabs/arkhamjs-storage-native';
385
+
386
+ Flux.init({
387
+ name: 'my-app',
388
+ stores: [CartStore],
389
+ storage: NativeStorage,
390
+
391
+ // Persist cart items
392
+ storagePaths: ['cart.items', 'cart.total'],
393
+
394
+ // Don't persist temporary cart state
395
+ storageExclude: ['cart.loading', 'cart.error']
396
+ });
397
+
398
+ // Cart items persist if user closes app
399
+ Flux.dispatch({ type: 'CART_ADD', item: { id: 1, name: 'Product' } });
400
+ // Cart is automatically saved
401
+ ```
402
+
403
+ ### **Form Data Persistence**
404
+
405
+ ```js
406
+ import { NativeStorage } from '@nlabs/arkhamjs-storage-native';
407
+
408
+ Flux.init({
409
+ name: 'my-app',
410
+ stores: [FormStore],
411
+ storage: NativeStorage,
412
+
413
+ // Persist form data with short debounce
414
+ storageWait: 100,
415
+ storagePaths: ['form.draft'],
416
+
417
+ // Clear form data on successful submission
418
+ storageEvents: {
419
+ onAction: (action) => {
420
+ if (action.type === 'FORM_SUBMIT_SUCCESS') {
421
+ // Clear draft data
422
+ AsyncStorage.removeItem('arkhamjs-state-form.draft');
423
+ }
424
+ }
425
+ }
426
+ });
427
+
428
+ // Form data is automatically saved as user types
429
+ // Prevents data loss if user accidentally closes app
430
+ ```
431
+
432
+ ## 🔗 Related Packages
433
+
434
+ - **[@nlabs/arkhamjs](./arkhamjs/README.md)** - Core Flux framework
435
+ - **[@nlabs/arkhamjs-storage-browser](./arkhamjs-storage-browser/README.md)** - Browser storage
436
+ - **[@nlabs/arkhamjs-storage-node](./arkhamjs-storage-node/README.md)** - Node.js storage
437
+
438
+ ## 📚 Documentation
439
+
440
+ For detailed documentation and examples, visit [arkhamjs.io](https://arkhamjs.io).
441
+
442
+ ## 🤝 Community & Support
443
+
444
+ - **💬 [Discord Community](https://discord.gg/Ttgev58)** - Chat with other developers
445
+ - **🐛 [GitHub Issues](https://github.com/nitrogenlabs/arkhamjs/issues)** - Report bugs and request features
446
+ - **📖 [Documentation](https://arkhamjs.io)** - Complete API reference
447
+
448
+ ## 📄 License
20
449
 
21
- For detailed [Documentation](https://arkhamjs.io) and additional options.
450
+ MIT License - see [LICENSE](../LICENSE) file for details.
@@ -0,0 +1,10 @@
1
+ import { NativeStorageOptions } from './NativeStorage.types';
2
+ export declare class NativeStorage {
3
+ private options;
4
+ constructor(options?: NativeStorageOptions);
5
+ static delAsyncData(key: string): Promise<boolean>;
6
+ static getAsyncData(key: string): Promise<any>;
7
+ static setAsyncData(key: string, value: any): Promise<boolean>;
8
+ getStorageData(key: string): Promise<any>;
9
+ setStorageData(key: string, value: any): Promise<boolean>;
10
+ }
@@ -0,0 +1,2 @@
1
+ var l=Object.create;var o=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var u=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var p=(r,t)=>{for(var e in t)o(r,e,{get:t[e],enumerable:!0})},c=(r,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of m(t))!h.call(r,s)&&s!==e&&o(r,s,{get:()=>t[s],enumerable:!(a=g(t,s))||a.enumerable});return r};var y=(r,t,e)=>(e=r!=null?l(u(r)):{},c(t||!r||!r.__esModule?o(e,"default",{value:r,enumerable:!0}):e,r)),P=r=>c(o({},"__esModule",{value:!0}),r);var d={};p(d,{NativeStorage:()=>i});module.exports=P(d);var n=y(require("@react-native-async-storage/async-storage"),1);class i{constructor(t={}){this.options={};this.getStorageData=this.getStorageData.bind(this),this.setStorageData=this.setStorageData.bind(this),this.options={...this.options,...t}}static delAsyncData(t){try{return n.default.removeItem(t).then(()=>Promise.resolve(!0)).catch(()=>Promise.resolve(!1))}catch{return Promise.resolve(!1)}}static getAsyncData(t){try{return n.default.getItem(t).then(e=>e?JSON.parse(e):null).catch(()=>Promise.resolve(null))}catch{return Promise.resolve(null)}}static setAsyncData(t,e){const a=e!==void 0&&JSON.stringify(e);try{return n.default.setItem(t,a).then(()=>!0).catch(()=>Promise.resolve(!1))}catch{return Promise.resolve(!1)}}getStorageData(t){return i.getAsyncData(t)}setStorageData(t,e){return i.setAsyncData(t,e)}}0&&(module.exports={NativeStorage});
2
+ //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL05hdGl2ZVN0b3JhZ2UvTmF0aXZlU3RvcmFnZS50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTgtUHJlc2VudCwgTml0cm9nZW4gTGFicywgSW5jLlxuICogQ29weXJpZ2h0cyBsaWNlbnNlZCB1bmRlciB0aGUgTUlUIExpY2Vuc2UuIFNlZSB0aGUgYWNjb21wYW55aW5nIExJQ0VOU0UgZmlsZSBmb3IgdGVybXMuXG4gKi9cbmltcG9ydCBBc3luY1N0b3JhZ2UgZnJvbSAnQHJlYWN0LW5hdGl2ZS1hc3luYy1zdG9yYWdlL2FzeW5jLXN0b3JhZ2UnO1xuXG5p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FFBQVEsUUFBUSxJQUFJLENBQzdCLENBQ0YsQ0FTQSxPQUFPLGFBQWFGLEVBQWFFLEVBQXlCLENBQ3hELE1BQU1DLEVBQWVELElBQVUsUUFBYSxLQUFLLFVBQVVBLENBQUssRUFFaEUsR0FBSSxDQUNGLE9BQU8sRUFBQUQsUUFBYSxRQUFRRCxFQUFLRyxDQUFZLEVBQzFDLEtBQUssSUFBTSxFQUFJLEVBQ2YsTUFBTSxJQUFNLFFBQVEsUUFBUSxFQUFLLENBQUMsQ0FDdkMsTUFBZSxDQUNiLE9BQU8sUUFBUSxRQUFRLEVBQUssQ0FDOUIsQ0FDRixDQVFBLGVBQWVILEVBQTJCLENBQ3hDLE9BQU9KLEVBQWMsYUFBYUksQ0FBRyxDQUN2QyxDQVNBLGVBQWVBLEVBQWFFLEVBQXlCLENBQ25ELE9BQU9OLEVBQWMsYUFBYUksRUFBS0UsQ0FBSyxDQUM5QyxDQUNGIiwKICAibmFtZXMiOiBbIk5hdGl2ZVN0b3JhZ2VfZXhwb3J0cyIsICJfX2V4cG9ydCIsICJOYXRpdmVTdG9yYWdlIiwgIl9fdG9Db21tb25KUyIsICJpbXBvcnRfYXN5bmNfc3RvcmFnZSIsICJvcHRpb25zIiwgImtleSIsICJBc3luY1N0b3JhZ2UiLCAidmFsdWUiLCAidXBkYXRlZFZhbHVlIl0KfQo=
@@ -0,0 +1,2 @@
1
+ export interface NativeStorageOptions {
2
+ }
@@ -0,0 +1,2 @@
1
+ var o=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var f=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of p(e))!c.call(t,a)&&a!==r&&o(t,a,{get:()=>e[a],enumerable:!(i=n(e,a))||i.enumerable});return t};var g=t=>f(o({},"__esModule",{value:!0}),t);var s={};module.exports=g(s);
2
+ //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL05hdGl2ZVN0b3JhZ2UvTmF0aXZlU3RvcmFnZS50eXBlcy50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiZXhwb3J0IGludGVyZmFjZSBOYXRpdmVTdG9yYWdlT3B0aW9ucyB7fVxuIl0sCiAgIm1hcHBpbmdzIjogImtXQUFBLElBQUFBLEVBQUEsa0JBQUFDLEVBQUFEIiwKICAibmFtZXMiOiBbIk5hdGl2ZVN0b3JhZ2VfdHlwZXNfZXhwb3J0cyIsICJfX3RvQ29tbW9uSlMiXQp9Cg==
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { NativeStorage } from './NativeStorage/NativeStorage';
2
+ export * from './NativeStorage/NativeStorage.types';
3
+ export { NativeStorage };
package/lib/index.js ADDED
@@ -0,0 +1,2 @@
1
+ var f=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var S=(r,o)=>{for(var t in o)f(r,t,{get:o[t],enumerable:!0})},a=(r,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of v(o))!N.call(r,e)&&e!==t&&f(r,e,{get:()=>o[e],enumerable:!(i=g(o,e))||i.enumerable});return r},p=(r,o,t)=>(a(r,o,"default"),t&&a(t,o,"default"));var b=r=>a(f({},"__esModule",{value:!0}),r);var m={};S(m,{NativeStorage:()=>x.NativeStorage});module.exports=b(m);var x=require("./NativeStorage/NativeStorage");p(m,require("./NativeStorage/NativeStorage.types"),module.exports);0&&(module.exports={NativeStorage,...require("./NativeStorage/NativeStorage.types")});
2
+ //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL2luZGV4LnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyIvKipcbiAqIENvcHlyaWdodCAoYykgMjAxOC1QcmVzZW50LCBOaXRyb2dlbiBMYWJzLCBJbmMuXG4gKiBDb3B5cmlnaHRzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgTGljZW5zZS4gU2VlIHRoZSBhY2NvbXBhbnlpbmcgTElDRU5TRSBmaWxlIGZvciB0ZXJtcy5cbiAqL1xuaW1wb3J0IHtOYXRpdmVTdG9yYWdlfSBmcm9tICcuL05hdGl2ZVN0b3JhZ2UvTmF0aXZlU3RvcmFnZSc7XG5cblxuLy8gU3RvcmFnZVxuZXhwb3J0ICogZnJvbSAnLi9OYXRpdmVTdG9yYWdlL05hdGl2ZVN0b3JhZ2UudHlwZXMnO1xuXG5leHBvcnQge05hdGl2ZVN0b3JhZ2V9O1xuIl0sCiAgIm1hcHBpbmdzIjogIjhjQUFBLElBQUFBLEVBQUEsR0FBQUMsRUFBQUQsRUFBQSxvREFBQUUsRUFBQUYsR0FJQSxJQUFBRyxFQUE0Qix5Q0FJNUJDLEVBQUFKLEVBQWMsK0NBUmQiLAogICJuYW1lcyI6IFsiaW5kZXhfZXhwb3J0cyIsICJfX2V4cG9ydCIsICJfX3RvQ29tbW9uSlMiLCAiaW1wb3J0X05hdGl2ZVN0b3JhZ2UiLCAiX19yZUV4cG9ydCJdCn0K
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nlabs/arkhamjs-storage-native",
3
- "version": "3.29.2",
3
+ "version": "3.30.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -31,33 +31,39 @@
31
31
  "url": "https://github.com/nitrogenlabs/arkhamjs/issues"
32
32
  },
33
33
  "scripts": {
34
- "build": "lex compile",
34
+ "build": "lex compile --remove",
35
35
  "clean": "lex clean",
36
36
  "deploy": "lex build --remove && s3-deploy './lib/static/**' --cwd './lib/static/' --region us-east-1 --bucket arkhamjs.io/versions --gzip",
37
- "lint": "eslint ./src --ext .ts,.tsx",
37
+ "lint": "lex lint --fix",
38
38
  "prepublishOnly": "npm run build",
39
39
  "publish:major": "npm version major && npm publish",
40
40
  "publish:minor": "npm version minor && npm publish",
41
41
  "publish:patch": "npm version patch && npm publish",
42
42
  "pretest": "npm run lint",
43
43
  "test": "lex test",
44
- "update": "npm-check-updates --interactive"
44
+ "update": "lex update --interactive"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@nlabs/arkhamjs": "^3.26.0",
48
- "react": "^18.0.0 || ^19.0.0"
48
+ "react": "*"
49
+ },
50
+ "dependencies": {
51
+ "@react-native-async-storage/async-storage": "^2.2.0"
49
52
  },
50
53
  "devDependencies": {
51
54
  "@nlabs/arkhamjs": "*",
52
- "@types/jest": "^29.5.14",
53
- "@types/node": "^22.13.1",
54
- "eslint": "^9.19.0",
55
- "eslint-config-styleguidejs": "^3.2.1",
56
- "lodash": "^4.17.21",
57
- "typescript": "^5.7.3"
55
+ "@types/jest": "^30.0.0",
56
+ "@types/node": "^24.0.10",
57
+ "typescript": "^5.8.3"
58
58
  },
59
+ "files": [
60
+ "lib",
61
+ "index.js",
62
+ "index.d.ts",
63
+ "LICENSE",
64
+ "package.json",
65
+ "README.md"
66
+ ],
59
67
  "gitHead": "fc371e1e28fe0ae35d40d29a217d5f0e990ec32a",
60
- "dependencies": {
61
- "@react-native-async-storage/async-storage": "^2.1.1"
62
- }
68
+ "type": "module"
63
69
  }