strata-storage 2.6.0 → 2.6.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/AI-INTEGRATION-GUIDE.md +12 -3
- package/README.md +31 -9
- package/dist/README.md +31 -9
- package/dist/package.json +1 -1
- package/package.json +6 -6
package/AI-INTEGRATION-GUIDE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AI Integration Guide - strata-storage
|
|
2
2
|
|
|
3
|
-
Quick reference for AI development agents (Claude Code, Cursor, Copilot, etc.) to integrate `strata-storage` into web and mobile projects. Current version: **2.
|
|
3
|
+
Quick reference for AI development agents (Claude Code, Cursor, Copilot, etc.) to integrate `strata-storage` into web and mobile projects. Current version: **2.6.1**.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -160,15 +160,24 @@ const storage = defineStorage();
|
|
|
160
160
|
|
|
161
161
|
```typescript
|
|
162
162
|
import { defineStorage } from 'strata-storage';
|
|
163
|
-
import {
|
|
163
|
+
import {
|
|
164
|
+
PreferencesAdapter,
|
|
165
|
+
SecureStorageAdapter,
|
|
166
|
+
SqliteAdapter,
|
|
167
|
+
FilesystemAdapter,
|
|
168
|
+
} from 'strata-storage/capacitor';
|
|
164
169
|
|
|
165
170
|
const storage = defineStorage();
|
|
166
171
|
storage.registerAdapter(new PreferencesAdapter());
|
|
167
172
|
storage.registerAdapter(new SecureStorageAdapter());
|
|
173
|
+
storage.registerAdapter(new SqliteAdapter()); // 2.6.0 — multi-store (database + table)
|
|
174
|
+
storage.registerAdapter(new FilesystemAdapter()); // 2.6.0 — file-per-key, atomic writes
|
|
168
175
|
await storage.set('secret', token, { storage: 'secure' });
|
|
169
176
|
```
|
|
170
177
|
|
|
171
|
-
|
|
178
|
+
**SQLite multi-store** (2.6.0): each `new SqliteAdapter({ database, table })` is an isolated store — distinct `(database, table)` pairs map to distinct physical `.db` files / tables natively and cannot collide. **Filesystem** (2.6.0): one JSON file per key under the app's documents/files directory; `isAvailable()` now returns `true` on iOS and Android.
|
|
179
|
+
|
|
180
|
+
Native adapters depend on the downstream Capacitor project setup; follow `docs/guides/platforms/device-verification.md` to verify on a real iOS + Android device.
|
|
172
181
|
|
|
173
182
|
## Strata API (most-used methods)
|
|
174
183
|
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
[](https://www.typescriptlang.org/)
|
|
10
10
|
[](https://github.com/aoneahsan/strata-storage)
|
|
11
11
|
|
|
12
|
-
- **Version:** `2.
|
|
12
|
+
- **Version:** `2.6.1`
|
|
13
13
|
- **License:** Apache-2.0
|
|
14
14
|
- **Node.js:** `>= 24.13.0`
|
|
15
15
|
- **Module format:** ESM only
|
|
@@ -390,15 +390,22 @@ const active = await storage.query({
|
|
|
390
390
|
|
|
391
391
|
### iOS and Android (via Capacitor)
|
|
392
392
|
|
|
393
|
-
Register native adapters
|
|
393
|
+
Register the native adapters you need when running under Capacitor. All four are zero-runtime-dependency: SQLite is hand-rolled (no plugin dependency) and filesystem uses the platform's native `FileManager` / `java.io.File`.
|
|
394
394
|
|
|
395
395
|
```typescript
|
|
396
396
|
import { defineStorage } from 'strata-storage';
|
|
397
|
-
import {
|
|
397
|
+
import {
|
|
398
|
+
PreferencesAdapter,
|
|
399
|
+
SecureStorageAdapter,
|
|
400
|
+
SqliteAdapter,
|
|
401
|
+
FilesystemAdapter,
|
|
402
|
+
} from 'strata-storage/capacitor';
|
|
398
403
|
|
|
399
404
|
const storage = defineStorage();
|
|
400
|
-
storage.registerAdapter(new PreferencesAdapter());
|
|
405
|
+
storage.registerAdapter(new PreferencesAdapter()); // UserDefaults / SharedPreferences
|
|
401
406
|
storage.registerAdapter(new SecureStorageAdapter()); // Keychain / EncryptedSharedPreferences
|
|
407
|
+
storage.registerAdapter(new SqliteAdapter()); // native SQLite
|
|
408
|
+
storage.registerAdapter(new FilesystemAdapter()); // native files
|
|
402
409
|
|
|
403
410
|
await storage.set('secret', token, { storage: 'secure' });
|
|
404
411
|
```
|
|
@@ -407,10 +414,25 @@ await storage.set('secret', token, { storage: 'secure' });
|
|
|
407
414
|
|---------|-------------|-----------------|
|
|
408
415
|
| `preferences` | UserDefaults | SharedPreferences |
|
|
409
416
|
| `secure` | Keychain | EncryptedSharedPreferences |
|
|
410
|
-
| `sqlite` | SQLite | SQLite |
|
|
411
|
-
| `filesystem` | FileManager |
|
|
417
|
+
| `sqlite` | SQLite (multi-store) | SQLite (multi-store) |
|
|
418
|
+
| `filesystem` | FileManager | java.io.File |
|
|
412
419
|
|
|
413
|
-
|
|
420
|
+
**SQLite multi-store** (2.6.0+): each `SqliteAdapter` instance binds to a `(database, table)` pair, so distinct logical stores map to distinct physical SQLite files / tables and cannot collide.
|
|
421
|
+
|
|
422
|
+
```typescript
|
|
423
|
+
import { SqliteAdapter } from 'strata-storage/capacitor';
|
|
424
|
+
|
|
425
|
+
const analytics = defineStorage();
|
|
426
|
+
analytics.registerAdapter(new SqliteAdapter({ database: 'analytics', table: 'events' }));
|
|
427
|
+
|
|
428
|
+
const audit = defineStorage();
|
|
429
|
+
audit.registerAdapter(new SqliteAdapter({ database: 'audit', table: 'rows' }));
|
|
430
|
+
// → separate physical .db files; writes to `analytics` can never bleed into `audit`.
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
`await storage.size(true)` aggregates `{ total, count, byStorage, ... }`; native SQLite and filesystem additionally report a per-column byte breakdown (keys / values / metadata) when called on those adapters directly.
|
|
434
|
+
|
|
435
|
+
> **Honest note:** the native iOS/Android adapters depend on your downstream Capacitor project setup and platform configuration, and native behavior cannot be exercised by the web/Node test suite. Follow [`docs/guides/platforms/device-verification.md`](./docs/guides/platforms/device-verification.md) to verify on a real iOS and Android device after integrating.
|
|
414
436
|
|
|
415
437
|
### Firebase (optional cloud sync)
|
|
416
438
|
|
|
@@ -436,8 +458,8 @@ await storage.set('data', value, { storage: 'firestore' });
|
|
|
436
458
|
| `url` | Web | ✅ | async only | Shareable UI state, length-limited |
|
|
437
459
|
| `preferences` | Mobile | ❌ | async only | UserDefaults / SharedPreferences |
|
|
438
460
|
| `secure` | Mobile | ❌ | async only | Keychain / EncryptedSharedPreferences |
|
|
439
|
-
| `sqlite` | Mobile | ❌ | async only | Native SQLite |
|
|
440
|
-
| `filesystem` | Mobile | ❌ | async only | Native files |
|
|
461
|
+
| `sqlite` | Mobile | ❌ | async only | Native SQLite — multi-store via `(database, table)` (2.6.0+) |
|
|
462
|
+
| `filesystem` | Mobile | ❌ | async only | Native files — file-per-key with atomic writes (2.6.0+) |
|
|
441
463
|
|
|
442
464
|
"async only" means encryption and compression require the `await storage.set(...)` path — the synchronous API cannot encrypt or compress.
|
|
443
465
|
|
package/dist/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
[](https://www.typescriptlang.org/)
|
|
10
10
|
[](https://github.com/aoneahsan/strata-storage)
|
|
11
11
|
|
|
12
|
-
- **Version:** `2.
|
|
12
|
+
- **Version:** `2.6.1`
|
|
13
13
|
- **License:** Apache-2.0
|
|
14
14
|
- **Node.js:** `>= 24.13.0`
|
|
15
15
|
- **Module format:** ESM only
|
|
@@ -390,15 +390,22 @@ const active = await storage.query({
|
|
|
390
390
|
|
|
391
391
|
### iOS and Android (via Capacitor)
|
|
392
392
|
|
|
393
|
-
Register native adapters
|
|
393
|
+
Register the native adapters you need when running under Capacitor. All four are zero-runtime-dependency: SQLite is hand-rolled (no plugin dependency) and filesystem uses the platform's native `FileManager` / `java.io.File`.
|
|
394
394
|
|
|
395
395
|
```typescript
|
|
396
396
|
import { defineStorage } from 'strata-storage';
|
|
397
|
-
import {
|
|
397
|
+
import {
|
|
398
|
+
PreferencesAdapter,
|
|
399
|
+
SecureStorageAdapter,
|
|
400
|
+
SqliteAdapter,
|
|
401
|
+
FilesystemAdapter,
|
|
402
|
+
} from 'strata-storage/capacitor';
|
|
398
403
|
|
|
399
404
|
const storage = defineStorage();
|
|
400
|
-
storage.registerAdapter(new PreferencesAdapter());
|
|
405
|
+
storage.registerAdapter(new PreferencesAdapter()); // UserDefaults / SharedPreferences
|
|
401
406
|
storage.registerAdapter(new SecureStorageAdapter()); // Keychain / EncryptedSharedPreferences
|
|
407
|
+
storage.registerAdapter(new SqliteAdapter()); // native SQLite
|
|
408
|
+
storage.registerAdapter(new FilesystemAdapter()); // native files
|
|
402
409
|
|
|
403
410
|
await storage.set('secret', token, { storage: 'secure' });
|
|
404
411
|
```
|
|
@@ -407,10 +414,25 @@ await storage.set('secret', token, { storage: 'secure' });
|
|
|
407
414
|
|---------|-------------|-----------------|
|
|
408
415
|
| `preferences` | UserDefaults | SharedPreferences |
|
|
409
416
|
| `secure` | Keychain | EncryptedSharedPreferences |
|
|
410
|
-
| `sqlite` | SQLite | SQLite |
|
|
411
|
-
| `filesystem` | FileManager |
|
|
417
|
+
| `sqlite` | SQLite (multi-store) | SQLite (multi-store) |
|
|
418
|
+
| `filesystem` | FileManager | java.io.File |
|
|
412
419
|
|
|
413
|
-
|
|
420
|
+
**SQLite multi-store** (2.6.0+): each `SqliteAdapter` instance binds to a `(database, table)` pair, so distinct logical stores map to distinct physical SQLite files / tables and cannot collide.
|
|
421
|
+
|
|
422
|
+
```typescript
|
|
423
|
+
import { SqliteAdapter } from 'strata-storage/capacitor';
|
|
424
|
+
|
|
425
|
+
const analytics = defineStorage();
|
|
426
|
+
analytics.registerAdapter(new SqliteAdapter({ database: 'analytics', table: 'events' }));
|
|
427
|
+
|
|
428
|
+
const audit = defineStorage();
|
|
429
|
+
audit.registerAdapter(new SqliteAdapter({ database: 'audit', table: 'rows' }));
|
|
430
|
+
// → separate physical .db files; writes to `analytics` can never bleed into `audit`.
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
`await storage.size(true)` aggregates `{ total, count, byStorage, ... }`; native SQLite and filesystem additionally report a per-column byte breakdown (keys / values / metadata) when called on those adapters directly.
|
|
434
|
+
|
|
435
|
+
> **Honest note:** the native iOS/Android adapters depend on your downstream Capacitor project setup and platform configuration, and native behavior cannot be exercised by the web/Node test suite. Follow [`docs/guides/platforms/device-verification.md`](./docs/guides/platforms/device-verification.md) to verify on a real iOS and Android device after integrating.
|
|
414
436
|
|
|
415
437
|
### Firebase (optional cloud sync)
|
|
416
438
|
|
|
@@ -436,8 +458,8 @@ await storage.set('data', value, { storage: 'firestore' });
|
|
|
436
458
|
| `url` | Web | ✅ | async only | Shareable UI state, length-limited |
|
|
437
459
|
| `preferences` | Mobile | ❌ | async only | UserDefaults / SharedPreferences |
|
|
438
460
|
| `secure` | Mobile | ❌ | async only | Keychain / EncryptedSharedPreferences |
|
|
439
|
-
| `sqlite` | Mobile | ❌ | async only | Native SQLite |
|
|
440
|
-
| `filesystem` | Mobile | ❌ | async only | Native files |
|
|
461
|
+
| `sqlite` | Mobile | ❌ | async only | Native SQLite — multi-store via `(database, table)` (2.6.0+) |
|
|
462
|
+
| `filesystem` | Mobile | ❌ | async only | Native files — file-per-key with atomic writes (2.6.0+) |
|
|
441
463
|
|
|
442
464
|
"async only" means encryption and compression require the `await storage.set(...)` path — the synchronous API cannot encrypt or compress.
|
|
443
465
|
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strata-storage",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "Zero-dependency universal storage plugin providing a unified API for all storage operations across web, Android, and iOS platforms",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strata-storage",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "Zero-dependency universal storage plugin providing a unified API for all storage operations across web, Android, and iOS platforms",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -103,9 +103,9 @@
|
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
|
-
"@angular/common": "^21.2.
|
|
107
|
-
"@angular/core": "^21.2.
|
|
108
|
-
"@angular/forms": "^21.2.
|
|
106
|
+
"@angular/common": "^21.2.15",
|
|
107
|
+
"@angular/core": "^21.2.15",
|
|
108
|
+
"@angular/forms": "^21.2.15",
|
|
109
109
|
"@capacitor/core": "^8.3.4",
|
|
110
110
|
"@types/node": "^25.9.1",
|
|
111
111
|
"@types/react": "^19.2.15",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"@vitest/coverage-v8": "^4.1.7",
|
|
115
115
|
"eslint": "^10.4.0",
|
|
116
116
|
"eslint-config-prettier": "^10.1.8",
|
|
117
|
-
"eslint-plugin-prettier": "^5.5.
|
|
117
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
118
118
|
"jsdom": "^29.1.1",
|
|
119
119
|
"prettier": "^3.8.3",
|
|
120
120
|
"react": "^19.2.6",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"typescript": "^6.0.3",
|
|
123
123
|
"typescript-eslint": "^8.60.0",
|
|
124
124
|
"vitest": "^4.1.7",
|
|
125
|
-
"vue": "^3.5.
|
|
125
|
+
"vue": "^3.5.35",
|
|
126
126
|
"zone.js": "~0.16.0"
|
|
127
127
|
},
|
|
128
128
|
"engines": {
|