strata-storage 2.4.3 → 2.5.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/AI-INTEGRATION-GUIDE.md +115 -261
- package/README.md +426 -182
- package/android/AGENTS.md +34 -0
- package/android/CLAUDE.md +51 -0
- package/android/src/main/java/com/strata/storage/SQLiteStorage.java +35 -0
- package/android/src/main/java/com/stratastorage/StrataStoragePlugin.java +191 -27
- package/dist/README.md +426 -182
- package/dist/adapters/capacitor/FilesystemAdapter.d.ts.map +1 -1
- package/dist/adapters/capacitor/FilesystemAdapter.js +2 -1
- package/dist/adapters/capacitor/PreferencesAdapter.d.ts.map +1 -1
- package/dist/adapters/capacitor/PreferencesAdapter.js +2 -1
- package/dist/adapters/capacitor/SecureAdapter.d.ts.map +1 -1
- package/dist/adapters/capacitor/SecureAdapter.js +2 -1
- package/dist/adapters/capacitor/SqliteAdapter.d.ts.map +1 -1
- package/dist/adapters/capacitor/SqliteAdapter.js +2 -1
- package/dist/adapters/web/CacheAdapter.d.ts.map +1 -1
- package/dist/adapters/web/CacheAdapter.js +11 -3
- package/dist/adapters/web/CookieAdapter.d.ts +37 -1
- package/dist/adapters/web/CookieAdapter.d.ts.map +1 -1
- package/dist/adapters/web/CookieAdapter.js +89 -9
- package/dist/adapters/web/IndexedDBAdapter.d.ts.map +1 -1
- package/dist/adapters/web/IndexedDBAdapter.js +10 -2
- package/dist/adapters/web/LocalStorageAdapter.d.ts +31 -0
- package/dist/adapters/web/LocalStorageAdapter.d.ts.map +1 -1
- package/dist/adapters/web/LocalStorageAdapter.js +92 -19
- package/dist/adapters/web/MemoryAdapter.d.ts +24 -0
- package/dist/adapters/web/MemoryAdapter.d.ts.map +1 -1
- package/dist/adapters/web/MemoryAdapter.js +69 -18
- package/dist/adapters/web/SessionStorageAdapter.d.ts +24 -0
- package/dist/adapters/web/SessionStorageAdapter.d.ts.map +1 -1
- package/dist/adapters/web/SessionStorageAdapter.js +71 -9
- package/dist/adapters/web/URLAdapter.d.ts +59 -0
- package/dist/adapters/web/URLAdapter.d.ts.map +1 -0
- package/dist/adapters/web/URLAdapter.js +234 -0
- package/dist/adapters/web/index.d.ts +1 -0
- package/dist/adapters/web/index.d.ts.map +1 -1
- package/dist/adapters/web/index.js +1 -0
- package/dist/android/AGENTS.md +34 -0
- package/dist/android/CLAUDE.md +51 -0
- package/dist/android/src/main/java/com/strata/storage/SQLiteStorage.java +35 -0
- package/dist/android/src/main/java/com/stratastorage/StrataStoragePlugin.java +191 -27
- package/dist/capacitor.d.ts.map +1 -1
- package/dist/capacitor.js +2 -1
- package/dist/core/BaseAdapter.d.ts +8 -0
- package/dist/core/BaseAdapter.d.ts.map +1 -1
- package/dist/core/BaseAdapter.js +34 -14
- package/dist/core/Strata.d.ts +56 -2
- package/dist/core/Strata.d.ts.map +1 -1
- package/dist/core/Strata.js +501 -53
- package/dist/features/encryption.d.ts.map +1 -1
- package/dist/features/encryption.js +3 -2
- package/dist/features/integrity.d.ts +16 -0
- package/dist/features/integrity.d.ts.map +1 -0
- package/dist/features/integrity.js +28 -0
- package/dist/features/observer.d.ts.map +1 -1
- package/dist/features/observer.js +2 -1
- package/dist/features/query.d.ts +7 -1
- package/dist/features/query.d.ts.map +1 -1
- package/dist/features/query.js +9 -2
- package/dist/features/sync.d.ts.map +1 -1
- package/dist/features/sync.js +4 -3
- package/dist/index.d.ts +35 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +55 -30
- package/dist/integrations/angular/index.d.ts +158 -0
- package/dist/integrations/angular/index.d.ts.map +1 -0
- package/dist/integrations/angular/index.js +395 -0
- package/dist/integrations/index.d.ts +15 -0
- package/dist/integrations/index.d.ts.map +1 -0
- package/dist/integrations/index.js +18 -0
- package/dist/integrations/react/index.d.ts +75 -0
- package/dist/integrations/react/index.d.ts.map +1 -0
- package/dist/integrations/react/index.js +191 -0
- package/dist/integrations/vue/index.d.ts +103 -0
- package/dist/integrations/vue/index.d.ts.map +1 -0
- package/dist/integrations/vue/index.js +274 -0
- package/dist/ios/AGENTS.md +33 -0
- package/dist/ios/CLAUDE.md +49 -0
- package/dist/ios/Plugin/KeychainStorage.swift +139 -50
- package/dist/ios/Plugin/SQLiteStorage.swift +40 -0
- package/dist/ios/Plugin/StrataStoragePlugin.m +23 -0
- package/dist/ios/Plugin/StrataStoragePlugin.swift +201 -52
- package/dist/package.json +21 -5
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +2 -1
- package/dist/types/index.d.ts +58 -9
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +0 -13
- package/dist/utils/errors.d.ts +7 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +15 -3
- package/dist/utils/index.d.ts +63 -5
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +109 -16
- package/dist/utils/logger.d.ts +31 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +63 -0
- package/ios/AGENTS.md +33 -0
- package/ios/CLAUDE.md +49 -0
- package/ios/Plugin/KeychainStorage.swift +139 -50
- package/ios/Plugin/SQLiteStorage.swift +40 -0
- package/ios/Plugin/StrataStoragePlugin.m +23 -0
- package/ios/Plugin/StrataStoragePlugin.swift +201 -52
- package/package.json +31 -20
- package/scripts/build.js +16 -5
- package/scripts/configure.js +2 -6
- package/scripts/postinstall.js +2 -2
- package/Readme.md +0 -271
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/features/encryption.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAClC,SAAS,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GA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tE;;OAEG;IACG,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAiCtF;;OAEG;YACW,SAAS;IA8CvB;;OAEG;IACH,OAAO,CAAC,cAAc;IAStB;;OAEG;IACH,OAAO,CAAC,cAAc;IAStB;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,gBAAgB,CAAC,MAAM,GAAE,MAAW,GAAG,MAAM;IAc7C;;OAEG;IACG,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAU1C"}
|
|
@@ -35,9 +35,10 @@ export class EncryptionManager {
|
|
|
35
35
|
const dataStr = JSON.stringify(data);
|
|
36
36
|
const encoder = new TextEncoder();
|
|
37
37
|
const dataBuffer = encoder.encode(dataStr);
|
|
38
|
-
// Generate salt and IV
|
|
38
|
+
// Generate salt and IV. GCM uses a 12-byte nonce; CBC requires a 16-byte IV.
|
|
39
39
|
const salt = crypto.getRandomValues(new Uint8Array(this.config.saltLength));
|
|
40
|
-
const
|
|
40
|
+
const ivLength = this.config.algorithm === 'AES-CBC' ? 16 : 12;
|
|
41
|
+
const iv = crypto.getRandomValues(new Uint8Array(ivLength));
|
|
41
42
|
// Derive key from password
|
|
42
43
|
const key = await this.deriveKey(password, salt);
|
|
43
44
|
// Encrypt data
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integrity feature — fast, zero-dependency checksums to detect data corruption.
|
|
3
|
+
*
|
|
4
|
+
* Uses FNV-1a (32-bit) over the serialized value. This is NOT cryptographic and
|
|
5
|
+
* is not meant to resist tampering — it cheaply detects accidental corruption
|
|
6
|
+
* (truncated writes, bit flips, partial storage). For tamper resistance, use
|
|
7
|
+
* the encryption feature instead.
|
|
8
|
+
*/
|
|
9
|
+
/** Compute an FNV-1a (32-bit) checksum of an arbitrary serializable value. */
|
|
10
|
+
export declare function computeChecksum(value: unknown): string;
|
|
11
|
+
/**
|
|
12
|
+
* Verify a value against an expected checksum. Returns true when no checksum was
|
|
13
|
+
* stored (nothing to verify) so this is safe to call unconditionally.
|
|
14
|
+
*/
|
|
15
|
+
export declare function verifyChecksum(value: unknown, expected: string | undefined): boolean;
|
|
16
|
+
//# sourceMappingURL=integrity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrity.d.ts","sourceRoot":"","sources":["../../src/features/integrity.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,8EAA8E;AAC9E,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAQtD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAGpF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integrity feature — fast, zero-dependency checksums to detect data corruption.
|
|
3
|
+
*
|
|
4
|
+
* Uses FNV-1a (32-bit) over the serialized value. This is NOT cryptographic and
|
|
5
|
+
* is not meant to resist tampering — it cheaply detects accidental corruption
|
|
6
|
+
* (truncated writes, bit flips, partial storage). For tamper resistance, use
|
|
7
|
+
* the encryption feature instead.
|
|
8
|
+
*/
|
|
9
|
+
import { serialize } from "../utils/index.js";
|
|
10
|
+
/** Compute an FNV-1a (32-bit) checksum of an arbitrary serializable value. */
|
|
11
|
+
export function computeChecksum(value) {
|
|
12
|
+
const str = serialize(value);
|
|
13
|
+
let hash = 0x811c9dc5; // FNV-1a 32-bit offset basis
|
|
14
|
+
for (let i = 0; i < str.length; i++) {
|
|
15
|
+
hash ^= str.charCodeAt(i);
|
|
16
|
+
hash = Math.imul(hash, 0x01000193); // FNV prime, kept in 32-bit range
|
|
17
|
+
}
|
|
18
|
+
return (hash >>> 0).toString(16).padStart(8, '0');
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Verify a value against an expected checksum. Returns true when no checksum was
|
|
22
|
+
* stored (nothing to verify) so this is safe to call unconditionally.
|
|
23
|
+
*/
|
|
24
|
+
export function verifyChecksum(value, expected) {
|
|
25
|
+
if (!expected)
|
|
26
|
+
return true;
|
|
27
|
+
return computeChecksum(value) === expected;
|
|
28
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observer.d.ts","sourceRoot":"","sources":["../../src/features/observer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"observer.d.ts","sourceRoot":"","sources":["../../src/features/observer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG9D,qBAAa,eAAe;IAC1B,OAAO,CAAC,SAAS,CAAoC;IAErD;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,IAAI;IAKjD;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAU/B;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Storage Observer - Watch for storage changes
|
|
3
3
|
*/
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
4
5
|
export class StorageObserver {
|
|
5
6
|
observers = new Set();
|
|
6
7
|
/**
|
|
@@ -19,7 +20,7 @@ export class StorageObserver {
|
|
|
19
20
|
callback(event);
|
|
20
21
|
}
|
|
21
22
|
catch (error) {
|
|
22
|
-
|
|
23
|
+
logger.error('Error in storage observer:', error);
|
|
23
24
|
}
|
|
24
25
|
});
|
|
25
26
|
}
|
package/dist/features/query.d.ts
CHANGED
|
@@ -40,7 +40,13 @@ export declare class QueryEngine {
|
|
|
40
40
|
*/
|
|
41
41
|
private compare;
|
|
42
42
|
/**
|
|
43
|
-
* Match regex pattern
|
|
43
|
+
* Match regex pattern.
|
|
44
|
+
*
|
|
45
|
+
* Security: when the operand is a string it is compiled via `safeRegExp`,
|
|
46
|
+
* which caps the pattern length (ReDoS mitigation) and surfaces a typed
|
|
47
|
+
* `ValidationError` for invalid input instead of a raw `SyntaxError`. A
|
|
48
|
+
* pre-built `RegExp` operand is used as-is (the caller already owns it).
|
|
49
|
+
* Matching semantics for valid patterns are unchanged.
|
|
44
50
|
*/
|
|
45
51
|
private matchesRegex;
|
|
46
52
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/features/query.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/features/query.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,SAAS,CAAC;AAG9D;;GAEG;AACH,qBAAa,WAAW;IACtB;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,GAAG,OAAO;IAwB3D;;OAEG;IACH,OAAO,CAAC,YAAY;IAIpB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IASxB;;OAEG;IACH,OAAO,CAAC,eAAe;IA2DvB;;OAEG;IACH,OAAO,CAAC,aAAa;IAkBrB;;OAEG;IACH,OAAO,CAAC,cAAc;IAmBtB;;OAEG;IACH,OAAO,CAAC,MAAM;IA+Bd;;OAEG;IACH,OAAO,CAAC,OAAO;IAyBf;;;;;;;;OAQG;IACH,OAAO,CAAC,YAAY;IAOpB;;OAEG;IACH,OAAO,CAAC,OAAO;IASf;;OAEG;IACH,OAAO,CAAC,WAAW;IAcnB;;OAEG;IACH,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;IAoBxD;;OAEG;IACH,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IA2B5E;;OAEG;IACH,OAAO,CAAC,cAAc;IAetB;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAc1B;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,WAAW,CAE/C"}
|
package/dist/features/query.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Query Engine Feature
|
|
3
3
|
* Zero-dependency implementation of MongoDB-like query operators
|
|
4
4
|
*/
|
|
5
|
+
import { safeRegExp } from "../utils/index.js";
|
|
5
6
|
/**
|
|
6
7
|
* Query engine for advanced data filtering
|
|
7
8
|
*/
|
|
@@ -188,12 +189,18 @@ export class QueryEngine {
|
|
|
188
189
|
return String(a).localeCompare(String(b));
|
|
189
190
|
}
|
|
190
191
|
/**
|
|
191
|
-
* Match regex pattern
|
|
192
|
+
* Match regex pattern.
|
|
193
|
+
*
|
|
194
|
+
* Security: when the operand is a string it is compiled via `safeRegExp`,
|
|
195
|
+
* which caps the pattern length (ReDoS mitigation) and surfaces a typed
|
|
196
|
+
* `ValidationError` for invalid input instead of a raw `SyntaxError`. A
|
|
197
|
+
* pre-built `RegExp` operand is used as-is (the caller already owns it).
|
|
198
|
+
* Matching semantics for valid patterns are unchanged.
|
|
192
199
|
*/
|
|
193
200
|
matchesRegex(value, pattern) {
|
|
194
201
|
if (typeof value !== 'string')
|
|
195
202
|
return false;
|
|
196
|
-
const regex = pattern instanceof RegExp ? pattern :
|
|
203
|
+
const regex = pattern instanceof RegExp ? pattern : safeRegExp(pattern);
|
|
197
204
|
return regex.test(value);
|
|
198
205
|
}
|
|
199
206
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/features/sync.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/features/sync.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,KAAK,EAEV,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB,kBAAkB,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAAC;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,YAAY;IAC3C,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,OAAO,CAAC,CAAmB;IACnC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAuE;IACxF,OAAO,CAAC,cAAc,CAAyD;gBAEnE,MAAM,GAAE,UAAe;IAYnC;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAYjC;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,GAAG,IAAI;IAuBrD;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,oBAAoB,GAAG,mBAAmB;IAY9D;;OAEG;IACH,KAAK,IAAI,IAAI;IAuBb;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAInC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA6B7B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA+C1B;;OAEG;IACH,OAAO,CAAC,WAAW;IAcnB;;OAEG;IACH,OAAO,CAAC,UAAU;IAIlB;;OAEG;IACH,OAAO,CAAC,cAAc;IAItB;;OAEG;IACH,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO;CAyB5C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,WAAW,CAElE"}
|
package/dist/features/sync.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Zero-dependency implementation using BroadcastChannel and storage events
|
|
4
4
|
*/
|
|
5
5
|
import { EventEmitter } from "../utils/index.js";
|
|
6
|
+
import { logger } from "../utils/logger.js";
|
|
6
7
|
/**
|
|
7
8
|
* Cross-tab synchronization manager
|
|
8
9
|
*/
|
|
@@ -118,11 +119,11 @@ export class SyncManager extends EventEmitter {
|
|
|
118
119
|
});
|
|
119
120
|
};
|
|
120
121
|
this.channel.onmessageerror = (event) => {
|
|
121
|
-
|
|
122
|
+
logger.error('Sync message error:', event);
|
|
122
123
|
};
|
|
123
124
|
}
|
|
124
125
|
catch (error) {
|
|
125
|
-
|
|
126
|
+
logger.warn('Failed to set up BroadcastChannel:', error);
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
/**
|
|
@@ -180,7 +181,7 @@ export class SyncManager extends EventEmitter {
|
|
|
180
181
|
this.channel.postMessage(message);
|
|
181
182
|
}
|
|
182
183
|
catch (error) {
|
|
183
|
-
|
|
184
|
+
logger.error('Failed to send sync message:', error);
|
|
184
185
|
}
|
|
185
186
|
}
|
|
186
187
|
// Storage events are automatic when using localStorage
|
package/dist/index.d.ts
CHANGED
|
@@ -7,17 +7,50 @@ export { IndexedDBAdapter } from './adapters/web/IndexedDBAdapter';
|
|
|
7
7
|
export { CookieAdapter } from './adapters/web/CookieAdapter';
|
|
8
8
|
export { CacheAdapter } from './adapters/web/CacheAdapter';
|
|
9
9
|
export { MemoryAdapter } from './adapters/web/MemoryAdapter';
|
|
10
|
+
export { URLAdapter, type URLAdapterConfig } from './adapters/web/URLAdapter';
|
|
10
11
|
export { EncryptionManager } from './features/encryption';
|
|
11
12
|
export { CompressionManager } from './features/compression';
|
|
12
13
|
export { TTLManager } from './features/ttl';
|
|
13
14
|
export { QueryEngine } from './features/query';
|
|
14
15
|
export { SyncManager } from './features/sync';
|
|
15
16
|
export { StorageObserver } from './features/observer';
|
|
16
|
-
export
|
|
17
|
+
export { computeChecksum, verifyChecksum } from './features/integrity';
|
|
18
|
+
export { StrataError, StorageError, IntegrityError, QuotaExceededError, EncryptionError, CompressionError, SerializationError, ValidationError, NotSupportedError, AdapterNotAvailableError, } from './utils/errors';
|
|
19
|
+
export type { StorageType, StorageOptions, StorageValue, StorageAdapter, AdapterConfig, QueryOptions, SyncConfig, EncryptionConfig, CompressionConfig, ObserverCallback, StorageEvent, StorageCapabilities, StorageMetadata, TTLConfig, StrataConfig, StorageChange, SubscriptionCallback, UnsubscribeFunction, } from './types';
|
|
17
20
|
export { isValidKey, isValidValue, serializeValue, deserializeValue, generateId, createError, retry, debounce, throttle, } from './utils';
|
|
18
21
|
import { Strata } from './core/Strata';
|
|
22
|
+
import type { StrataConfig } from './types';
|
|
23
|
+
/**
|
|
24
|
+
* Register the standard web storage adapters on a Strata instance: memory,
|
|
25
|
+
* localStorage, sessionStorage, indexedDB, cookies, and cache. Exported so any
|
|
26
|
+
* custom instance can opt into the same default set. Returns the same instance
|
|
27
|
+
* for chaining.
|
|
28
|
+
*/
|
|
29
|
+
export declare function registerWebAdapters(strata: Strata): Strata;
|
|
30
|
+
/**
|
|
31
|
+
* Create a ready-to-use Strata instance with the standard web adapters
|
|
32
|
+
* pre-registered — the framework-agnostic, Zustand-style entry point. Create it
|
|
33
|
+
* once anywhere and use it everywhere; NO Provider required.
|
|
34
|
+
*
|
|
35
|
+
* The instance initializes lazily on first use (each operation awaits readiness
|
|
36
|
+
* internally), so you can call get/set/subscribe immediately after creating it.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* import { defineStorage } from 'strata-storage';
|
|
41
|
+
* export const storage = defineStorage({ defaultStorages: ['localStorage'] });
|
|
42
|
+
* await storage.set('user', { id: 1 });
|
|
43
|
+
* const user = await storage.get('user');
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function defineStorage(config?: StrataConfig): Strata;
|
|
19
47
|
declare const storage: Strata;
|
|
20
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Force initialization of the default `storage` singleton and await readiness.
|
|
50
|
+
* Optional — every operation auto-awaits readiness — but handy when you want
|
|
51
|
+
* adapters ready before a burst of calls. Idempotent.
|
|
52
|
+
*/
|
|
53
|
+
declare function ensureInitialized(): Promise<void>;
|
|
21
54
|
export { storage, ensureInitialized };
|
|
22
55
|
export default storage;
|
|
23
56
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,o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c,EAAE,MAAM,sBAAsB,CAAC;AAGvE,OAAO,EACL,WAAW,EACX,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,WAAW,EACX,cAAc,EACd,YAAY,EACZ,cAAc,EACd,aAAa,EACb,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,UAAU,EACV,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,GACT,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAQvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAY1D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAE3D;AAID,QAAA,MAAM,OAAO,QAEX,CAAC;AAEH;;;;GAIG;AACH,iBAAe,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAEhD;AAGD,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAGtC,eAAe,OAAO,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export { IndexedDBAdapter } from "./adapters/web/IndexedDBAdapter.js";
|
|
|
9
9
|
export { CookieAdapter } from "./adapters/web/CookieAdapter.js";
|
|
10
10
|
export { CacheAdapter } from "./adapters/web/CacheAdapter.js";
|
|
11
11
|
export { MemoryAdapter } from "./adapters/web/MemoryAdapter.js";
|
|
12
|
+
export { URLAdapter } from "./adapters/web/URLAdapter.js";
|
|
12
13
|
// Core features
|
|
13
14
|
export { EncryptionManager } from "./features/encryption.js";
|
|
14
15
|
export { CompressionManager } from "./features/compression.js";
|
|
@@ -16,6 +17,9 @@ export { TTLManager } from "./features/ttl.js";
|
|
|
16
17
|
export { QueryEngine } from "./features/query.js";
|
|
17
18
|
export { SyncManager } from "./features/sync.js";
|
|
18
19
|
export { StorageObserver } from "./features/observer.js";
|
|
20
|
+
export { computeChecksum, verifyChecksum } from "./features/integrity.js";
|
|
21
|
+
// Error classes (exported as values so consumers can use `instanceof`)
|
|
22
|
+
export { StrataError, StorageError, IntegrityError, QuotaExceededError, EncryptionError, CompressionError, SerializationError, ValidationError, NotSupportedError, AdapterNotAvailableError, } from "./utils/errors.js";
|
|
19
23
|
// Utils
|
|
20
24
|
export { isValidKey, isValidValue, serializeValue, deserializeValue, generateId, createError, retry, debounce, throttle, } from "./utils/index.js";
|
|
21
25
|
// Create and export a default storage instance that works immediately
|
|
@@ -26,38 +30,59 @@ import { IndexedDBAdapter } from "./adapters/web/IndexedDBAdapter.js";
|
|
|
26
30
|
import { CookieAdapter } from "./adapters/web/CookieAdapter.js";
|
|
27
31
|
import { CacheAdapter } from "./adapters/web/CacheAdapter.js";
|
|
28
32
|
import { MemoryAdapter } from "./adapters/web/MemoryAdapter.js";
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
import { logger } from "./utils/logger.js";
|
|
34
|
+
/**
|
|
35
|
+
* Register the standard web storage adapters on a Strata instance: memory,
|
|
36
|
+
* localStorage, sessionStorage, indexedDB, cookies, and cache. Exported so any
|
|
37
|
+
* custom instance can opt into the same default set. Returns the same instance
|
|
38
|
+
* for chaining.
|
|
39
|
+
*/
|
|
40
|
+
export function registerWebAdapters(strata) {
|
|
41
|
+
try {
|
|
42
|
+
strata.registerAdapter(new MemoryAdapter()); // always-available fallback
|
|
43
|
+
strata.registerAdapter(new LocalStorageAdapter());
|
|
44
|
+
strata.registerAdapter(new SessionStorageAdapter());
|
|
45
|
+
strata.registerAdapter(new IndexedDBAdapter());
|
|
46
|
+
strata.registerAdapter(new CookieAdapter());
|
|
47
|
+
strata.registerAdapter(new CacheAdapter());
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
logger.warn('Strata Storage adapter registration warning:', error);
|
|
51
|
+
}
|
|
52
|
+
return strata;
|
|
44
53
|
}
|
|
45
|
-
|
|
46
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Create a ready-to-use Strata instance with the standard web adapters
|
|
56
|
+
* pre-registered — the framework-agnostic, Zustand-style entry point. Create it
|
|
57
|
+
* once anywhere and use it everywhere; NO Provider required.
|
|
58
|
+
*
|
|
59
|
+
* The instance initializes lazily on first use (each operation awaits readiness
|
|
60
|
+
* internally), so you can call get/set/subscribe immediately after creating it.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* import { defineStorage } from 'strata-storage';
|
|
65
|
+
* export const storage = defineStorage({ defaultStorages: ['localStorage'] });
|
|
66
|
+
* await storage.set('user', { id: 1 });
|
|
67
|
+
* const user = await storage.get('user');
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export function defineStorage(config) {
|
|
71
|
+
return registerWebAdapters(new Strata(config));
|
|
72
|
+
}
|
|
73
|
+
// Default singleton — created via the same factory so behavior is identical.
|
|
74
|
+
// It initializes lazily on first use, so importing the package has no I/O cost.
|
|
75
|
+
const storage = defineStorage({
|
|
76
|
+
defaultStorages: ['memory', 'localStorage', 'sessionStorage', 'indexedDB'],
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* Force initialization of the default `storage` singleton and await readiness.
|
|
80
|
+
* Optional — every operation auto-awaits readiness — but handy when you want
|
|
81
|
+
* adapters ready before a burst of calls. Idempotent.
|
|
82
|
+
*/
|
|
83
|
+
async function ensureInitialized() {
|
|
84
|
+
await storage.initialize();
|
|
47
85
|
}
|
|
48
|
-
// Initialize the storage instance
|
|
49
|
-
let initializationPromise = null;
|
|
50
|
-
const ensureInitialized = async () => {
|
|
51
|
-
if (!initializationPromise) {
|
|
52
|
-
initializationPromise = storage.initialize().catch((error) => {
|
|
53
|
-
console.warn('Strata Storage initialization warning:', error);
|
|
54
|
-
// Continue working even if some adapters fail
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
return initializationPromise;
|
|
58
|
-
};
|
|
59
|
-
// Start initialization immediately but don't block module loading
|
|
60
|
-
ensureInitialized();
|
|
61
86
|
// Export the ready-to-use storage instance
|
|
62
87
|
export { storage, ensureInitialized };
|
|
63
88
|
// Default export for convenience
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular integration for Strata Storage
|
|
3
|
+
*/
|
|
4
|
+
import { InjectionToken } from '@angular/core';
|
|
5
|
+
import type { OnDestroy, ModuleWithProviders, PipeTransform, OnInit, Provider } from '@angular/core';
|
|
6
|
+
import { NgControl } from '@angular/forms';
|
|
7
|
+
import { Observable } from 'rxjs';
|
|
8
|
+
import { Strata } from '@/core/Strata';
|
|
9
|
+
import type { StrataConfig, StorageOptions, StorageChange, QueryCondition } from '@/types';
|
|
10
|
+
export declare const STRATA_CONFIG: InjectionToken<StrataConfig>;
|
|
11
|
+
export declare const STRATA_INSTANCE: InjectionToken<Strata>;
|
|
12
|
+
/**
|
|
13
|
+
* Strata Service - Main service for storage operations
|
|
14
|
+
*/
|
|
15
|
+
export declare class StrataService implements OnDestroy {
|
|
16
|
+
private strata;
|
|
17
|
+
private destroy$;
|
|
18
|
+
private initialized$;
|
|
19
|
+
private changes$;
|
|
20
|
+
constructor(instance?: Strata, config?: StrataConfig);
|
|
21
|
+
private initialize;
|
|
22
|
+
/**
|
|
23
|
+
* Wait for initialization
|
|
24
|
+
*/
|
|
25
|
+
get ready$(): Observable<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* Get storage changes observable
|
|
28
|
+
*/
|
|
29
|
+
get changes(): Observable<StorageChange>;
|
|
30
|
+
/**
|
|
31
|
+
* Get a value from storage
|
|
32
|
+
*/
|
|
33
|
+
get<T = unknown>(key: string, options?: StorageOptions): Observable<T | null>;
|
|
34
|
+
/**
|
|
35
|
+
* Set a value in storage
|
|
36
|
+
*/
|
|
37
|
+
set<T = unknown>(key: string, value: T, options?: StorageOptions): Observable<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Remove a value from storage
|
|
40
|
+
*/
|
|
41
|
+
remove(key: string, options?: StorageOptions): Observable<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Check if key exists
|
|
44
|
+
*/
|
|
45
|
+
has(key: string, options?: StorageOptions): Observable<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Clear storage
|
|
48
|
+
*/
|
|
49
|
+
clear(options?: StorageOptions): Observable<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Get all keys
|
|
52
|
+
*/
|
|
53
|
+
keys(pattern?: string | RegExp, options?: StorageOptions): Observable<string[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Query storage
|
|
56
|
+
*/
|
|
57
|
+
query<T = unknown>(condition: QueryCondition, options?: StorageOptions): Observable<Array<{
|
|
58
|
+
key: string;
|
|
59
|
+
value: T;
|
|
60
|
+
}>>;
|
|
61
|
+
/**
|
|
62
|
+
* Get storage size
|
|
63
|
+
*/
|
|
64
|
+
size(detailed?: boolean): Observable<{
|
|
65
|
+
total: number;
|
|
66
|
+
count: number;
|
|
67
|
+
}>;
|
|
68
|
+
/**
|
|
69
|
+
* Watch a specific key
|
|
70
|
+
*/
|
|
71
|
+
watch<T = unknown>(key: string, options?: StorageOptions): Observable<T | null>;
|
|
72
|
+
/**
|
|
73
|
+
* Get TTL for a key
|
|
74
|
+
*/
|
|
75
|
+
getTTL(key: string, options?: StorageOptions): Observable<number | null>;
|
|
76
|
+
/**
|
|
77
|
+
* Extend TTL
|
|
78
|
+
*/
|
|
79
|
+
extendTTL(key: string, extension: number, options?: StorageOptions): Observable<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Make key persistent
|
|
82
|
+
*/
|
|
83
|
+
persist(key: string, options?: StorageOptions): Observable<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Generate secure password
|
|
86
|
+
*/
|
|
87
|
+
generatePassword(length?: number): string;
|
|
88
|
+
/**
|
|
89
|
+
* Hash data
|
|
90
|
+
*/
|
|
91
|
+
hash(data: string): Observable<string>;
|
|
92
|
+
ngOnDestroy(): void;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Storage pipe for template usage
|
|
96
|
+
*/
|
|
97
|
+
export declare class StoragePipe implements PipeTransform {
|
|
98
|
+
private strata;
|
|
99
|
+
private value;
|
|
100
|
+
private key;
|
|
101
|
+
private subscription;
|
|
102
|
+
constructor(strata: StrataService);
|
|
103
|
+
transform(key: string, defaultValue?: unknown): unknown;
|
|
104
|
+
ngOnDestroy(): void;
|
|
105
|
+
private dispose;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* TTL pipe for displaying time to live
|
|
109
|
+
*/
|
|
110
|
+
export declare class TTLPipe implements PipeTransform {
|
|
111
|
+
private strata;
|
|
112
|
+
private ttl;
|
|
113
|
+
private key;
|
|
114
|
+
private subscription;
|
|
115
|
+
constructor(strata: StrataService);
|
|
116
|
+
transform(key: string): string | null;
|
|
117
|
+
ngOnDestroy(): void;
|
|
118
|
+
private dispose;
|
|
119
|
+
private formatTTL;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Storage directive for form inputs
|
|
123
|
+
*/
|
|
124
|
+
export declare class StorageDirective implements OnInit, OnDestroy {
|
|
125
|
+
private control;
|
|
126
|
+
private strata;
|
|
127
|
+
key: string;
|
|
128
|
+
strataOptions?: StorageOptions;
|
|
129
|
+
strataDebounce: number;
|
|
130
|
+
private subscription;
|
|
131
|
+
private timeout;
|
|
132
|
+
constructor(control: NgControl, strata: StrataService);
|
|
133
|
+
ngOnInit(): void;
|
|
134
|
+
onValueChange(value: unknown): void;
|
|
135
|
+
ngOnDestroy(): void;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Strata Module
|
|
139
|
+
*/
|
|
140
|
+
export declare class StrataModule {
|
|
141
|
+
static forRoot(config?: StrataConfig): ModuleWithProviders<StrataModule>;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Standalone-Angular provider — supply a pre-created Strata instance (the
|
|
145
|
+
* provider-free, no-NgModule pattern) or a config object. Use it in
|
|
146
|
+
* bootstrapApplication() or a component's `providers`.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* import { defineStorage } from 'strata-storage';
|
|
151
|
+
* import { provideStrata } from 'strata-storage/angular';
|
|
152
|
+
* const storage = defineStorage();
|
|
153
|
+
* bootstrapApplication(AppComponent, { providers: [provideStrata(storage)] });
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
export declare function provideStrata(instanceOrConfig?: Strata | StrataConfig): Provider[];
|
|
157
|
+
export type { Strata, StrataConfig, StorageOptions, StorageChange };
|
|
158
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/angular/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAEL,cAAc,EAQf,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,SAAS,EACT,mBAAmB,EACnB,aAAa,EACb,MAAM,EACN,QAAQ,EACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAA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