strata-storage 1.0.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 +113 -0
- package/android/src/main/java/com/strata/storage/EncryptedStorage.java +65 -0
- package/android/src/main/java/com/strata/storage/SQLiteStorage.java +147 -0
- package/android/src/main/java/com/strata/storage/SharedPreferencesStorage.java +74 -0
- package/android/src/main/java/com/stratastorage/StrataStoragePlugin.java +256 -0
- package/dist/adapters/capacitor/FilesystemAdapter.d.ts +46 -0
- package/dist/adapters/capacitor/FilesystemAdapter.d.ts.map +1 -0
- package/dist/adapters/capacitor/FilesystemAdapter.js +162 -0
- package/dist/adapters/capacitor/PreferencesAdapter.d.ts +46 -0
- package/dist/adapters/capacitor/PreferencesAdapter.d.ts.map +1 -0
- package/dist/adapters/capacitor/PreferencesAdapter.js +162 -0
- package/dist/adapters/capacitor/SecureAdapter.d.ts +69 -0
- package/dist/adapters/capacitor/SecureAdapter.d.ts.map +1 -0
- package/dist/adapters/capacitor/SecureAdapter.js +214 -0
- package/dist/adapters/capacitor/SqliteAdapter.d.ts +68 -0
- package/dist/adapters/capacitor/SqliteAdapter.d.ts.map +1 -0
- package/dist/adapters/capacitor/SqliteAdapter.js +277 -0
- package/dist/adapters/capacitor/index.d.ts +9 -0
- package/dist/adapters/capacitor/index.d.ts.map +1 -0
- package/dist/adapters/capacitor/index.js +8 -0
- package/dist/adapters/web/CacheAdapter.d.ts +91 -0
- package/dist/adapters/web/CacheAdapter.d.ts.map +1 -0
- package/dist/adapters/web/CacheAdapter.js +291 -0
- package/dist/adapters/web/CookieAdapter.d.ts +77 -0
- package/dist/adapters/web/CookieAdapter.d.ts.map +1 -0
- package/dist/adapters/web/CookieAdapter.js +260 -0
- package/dist/adapters/web/IndexedDBAdapter.d.ts +78 -0
- package/dist/adapters/web/IndexedDBAdapter.d.ts.map +1 -0
- package/dist/adapters/web/IndexedDBAdapter.js +371 -0
- package/dist/adapters/web/LocalStorageAdapter.d.ts +63 -0
- package/dist/adapters/web/LocalStorageAdapter.d.ts.map +1 -0
- package/dist/adapters/web/LocalStorageAdapter.js +238 -0
- package/dist/adapters/web/MemoryAdapter.d.ts +69 -0
- package/dist/adapters/web/MemoryAdapter.d.ts.map +1 -0
- package/dist/adapters/web/MemoryAdapter.js +165 -0
- package/dist/adapters/web/SessionStorageAdapter.d.ts +53 -0
- package/dist/adapters/web/SessionStorageAdapter.d.ts.map +1 -0
- package/dist/adapters/web/SessionStorageAdapter.js +180 -0
- package/dist/adapters/web/index.d.ts +10 -0
- package/dist/adapters/web/index.d.ts.map +1 -0
- package/dist/adapters/web/index.js +9 -0
- package/dist/core/AdapterRegistry.d.ts +52 -0
- package/dist/core/AdapterRegistry.d.ts.map +1 -0
- package/dist/core/AdapterRegistry.js +102 -0
- package/dist/core/BaseAdapter.d.ts +79 -0
- package/dist/core/BaseAdapter.d.ts.map +1 -0
- package/dist/core/BaseAdapter.js +197 -0
- package/dist/core/StorageStrategy.d.ts +55 -0
- package/dist/core/StorageStrategy.d.ts.map +1 -0
- package/dist/core/StorageStrategy.js +199 -0
- package/dist/core/Strata.d.ts +122 -0
- package/dist/core/Strata.d.ts.map +1 -0
- package/dist/core/Strata.js +568 -0
- package/dist/features/compression.d.ts +65 -0
- package/dist/features/compression.d.ts.map +1 -0
- package/dist/features/compression.js +205 -0
- package/dist/features/encryption.d.ts +68 -0
- package/dist/features/encryption.d.ts.map +1 -0
- package/dist/features/encryption.js +172 -0
- package/dist/features/migration.d.ts +17 -0
- package/dist/features/migration.d.ts.map +1 -0
- package/dist/features/migration.js +43 -0
- package/dist/features/query.d.ts +75 -0
- package/dist/features/query.d.ts.map +1 -0
- package/dist/features/query.js +305 -0
- package/dist/features/sync.d.ts +87 -0
- package/dist/features/sync.d.ts.map +1 -0
- package/dist/features/sync.js +233 -0
- package/dist/features/ttl.d.ts +124 -0
- package/dist/features/ttl.d.ts.map +1 -0
- package/dist/features/ttl.js +236 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/dist/package.json +60 -0
- package/dist/plugin/definitions.d.ts +219 -0
- package/dist/plugin/definitions.d.ts.map +1 -0
- package/dist/plugin/definitions.js +5 -0
- package/dist/plugin/index.d.ts +8 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +27 -0
- package/dist/plugin/web.d.ts +24 -0
- package/dist/plugin/web.d.ts.map +1 -0
- package/dist/plugin/web.js +35 -0
- package/dist/types/index.d.ts +558 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +14 -0
- package/dist/utils/errors.d.ts +92 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +153 -0
- package/dist/utils/index.d.ts +105 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +329 -0
- package/ios/Plugin/KeychainStorage.swift +87 -0
- package/ios/Plugin/SQLiteStorage.swift +167 -0
- package/ios/Plugin/StrataStoragePlugin.swift +204 -0
- package/ios/Plugin/UserDefaultsStorage.swift +44 -0
- package/package.json +126 -0
- package/scripts/build.js +52 -0
- package/scripts/cli.js +60 -0
- package/scripts/configure.js +444 -0
- package/scripts/postinstall.js +33 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strata Storage Capacitor Plugin Definitions
|
|
3
|
+
* Interface definitions for native platform implementations
|
|
4
|
+
*/
|
|
5
|
+
import type { StorageValue } from '@/types';
|
|
6
|
+
/**
|
|
7
|
+
* Main plugin interface
|
|
8
|
+
*/
|
|
9
|
+
export interface StrataStoragePlugin {
|
|
10
|
+
/**
|
|
11
|
+
* Check if a specific storage type is available on the platform
|
|
12
|
+
*/
|
|
13
|
+
isAvailable(options: {
|
|
14
|
+
storage: NativeStorageType;
|
|
15
|
+
}): Promise<{
|
|
16
|
+
available: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Get a value from native storage
|
|
20
|
+
*/
|
|
21
|
+
get(options: NativeGetOptions): Promise<{
|
|
22
|
+
value: StorageValue | null;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Set a value in native storage
|
|
26
|
+
*/
|
|
27
|
+
set(options: NativeSetOptions): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Remove a value from native storage
|
|
30
|
+
*/
|
|
31
|
+
remove(options: NativeRemoveOptions): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Clear native storage
|
|
34
|
+
*/
|
|
35
|
+
clear(options: NativeClearOptions): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Get all keys from native storage
|
|
38
|
+
*/
|
|
39
|
+
keys(options: NativeKeysOptions): Promise<{
|
|
40
|
+
keys: string[];
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* Get storage size information
|
|
44
|
+
*/
|
|
45
|
+
size(options: NativeSizeOptions): Promise<NativeSizeResult>;
|
|
46
|
+
/**
|
|
47
|
+
* Perform native query (if supported)
|
|
48
|
+
*/
|
|
49
|
+
query?(options: NativeQueryOptions): Promise<{
|
|
50
|
+
results: Array<{
|
|
51
|
+
key: string;
|
|
52
|
+
value: unknown;
|
|
53
|
+
}>;
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* iOS-specific: Access UserDefaults
|
|
57
|
+
*/
|
|
58
|
+
getUserDefaults?(options: {
|
|
59
|
+
key: string;
|
|
60
|
+
suiteName?: string;
|
|
61
|
+
}): Promise<{
|
|
62
|
+
value: unknown;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* iOS-specific: Set UserDefaults
|
|
66
|
+
*/
|
|
67
|
+
setUserDefaults?(options: {
|
|
68
|
+
key: string;
|
|
69
|
+
value: unknown;
|
|
70
|
+
suiteName?: string;
|
|
71
|
+
}): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* iOS-specific: Access Keychain
|
|
74
|
+
*/
|
|
75
|
+
getKeychain?(options: {
|
|
76
|
+
key: string;
|
|
77
|
+
service?: string;
|
|
78
|
+
accessGroup?: string;
|
|
79
|
+
}): Promise<{
|
|
80
|
+
value: string | null;
|
|
81
|
+
}>;
|
|
82
|
+
/**
|
|
83
|
+
* iOS-specific: Set Keychain
|
|
84
|
+
*/
|
|
85
|
+
setKeychain?(options: {
|
|
86
|
+
key: string;
|
|
87
|
+
value: string;
|
|
88
|
+
service?: string;
|
|
89
|
+
accessGroup?: string;
|
|
90
|
+
accessible?: KeychainAccessible;
|
|
91
|
+
}): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Android-specific: Get encrypted preference
|
|
94
|
+
*/
|
|
95
|
+
getEncryptedPreference?(options: {
|
|
96
|
+
key: string;
|
|
97
|
+
fileName?: string;
|
|
98
|
+
}): Promise<{
|
|
99
|
+
value: unknown;
|
|
100
|
+
}>;
|
|
101
|
+
/**
|
|
102
|
+
* Android-specific: Set encrypted preference
|
|
103
|
+
*/
|
|
104
|
+
setEncryptedPreference?(options: {
|
|
105
|
+
key: string;
|
|
106
|
+
value: unknown;
|
|
107
|
+
fileName?: string;
|
|
108
|
+
}): Promise<void>;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Native storage types
|
|
112
|
+
*/
|
|
113
|
+
export type NativeStorageType = 'preferences' | 'sqlite' | 'secure' | 'filesystem';
|
|
114
|
+
/**
|
|
115
|
+
* Native get options
|
|
116
|
+
*/
|
|
117
|
+
export interface NativeGetOptions {
|
|
118
|
+
key: string;
|
|
119
|
+
storage: NativeStorageType;
|
|
120
|
+
database?: string;
|
|
121
|
+
table?: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Native set options
|
|
125
|
+
*/
|
|
126
|
+
export interface NativeSetOptions {
|
|
127
|
+
key: string;
|
|
128
|
+
value: StorageValue;
|
|
129
|
+
storage: NativeStorageType;
|
|
130
|
+
database?: string;
|
|
131
|
+
table?: string;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Native remove options
|
|
135
|
+
*/
|
|
136
|
+
export interface NativeRemoveOptions {
|
|
137
|
+
key: string;
|
|
138
|
+
storage: NativeStorageType;
|
|
139
|
+
database?: string;
|
|
140
|
+
table?: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Native clear options
|
|
144
|
+
*/
|
|
145
|
+
export interface NativeClearOptions {
|
|
146
|
+
storage: NativeStorageType;
|
|
147
|
+
database?: string;
|
|
148
|
+
table?: string;
|
|
149
|
+
pattern?: string;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Native keys options
|
|
153
|
+
*/
|
|
154
|
+
export interface NativeKeysOptions {
|
|
155
|
+
storage: NativeStorageType;
|
|
156
|
+
database?: string;
|
|
157
|
+
table?: string;
|
|
158
|
+
pattern?: string;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Native size options
|
|
162
|
+
*/
|
|
163
|
+
export interface NativeSizeOptions {
|
|
164
|
+
storage: NativeStorageType;
|
|
165
|
+
database?: string;
|
|
166
|
+
table?: string;
|
|
167
|
+
detailed?: boolean;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Native size result
|
|
171
|
+
*/
|
|
172
|
+
export interface NativeSizeResult {
|
|
173
|
+
total: number;
|
|
174
|
+
count: number;
|
|
175
|
+
detailed?: {
|
|
176
|
+
keys: number;
|
|
177
|
+
values: number;
|
|
178
|
+
metadata: number;
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Native query options
|
|
183
|
+
*/
|
|
184
|
+
export interface NativeQueryOptions {
|
|
185
|
+
storage: NativeStorageType;
|
|
186
|
+
database?: string;
|
|
187
|
+
table?: string;
|
|
188
|
+
condition: Record<string, unknown>;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* iOS Keychain accessibility options
|
|
192
|
+
*/
|
|
193
|
+
export type KeychainAccessible = 'whenUnlocked' | 'afterFirstUnlock' | 'whenUnlockedThisDeviceOnly' | 'afterFirstUnlockThisDeviceOnly' | 'whenPasscodeSetThisDeviceOnly';
|
|
194
|
+
/**
|
|
195
|
+
* Platform information
|
|
196
|
+
*/
|
|
197
|
+
export interface PlatformInfo {
|
|
198
|
+
platform: 'ios' | 'android' | 'web';
|
|
199
|
+
version: string;
|
|
200
|
+
isSimulator: boolean;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Storage permissions
|
|
204
|
+
*/
|
|
205
|
+
export interface StoragePermissions {
|
|
206
|
+
read: boolean;
|
|
207
|
+
write: boolean;
|
|
208
|
+
delete: boolean;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Migration options
|
|
212
|
+
*/
|
|
213
|
+
export interface MigrationOptions {
|
|
214
|
+
fromStorage: NativeStorageType;
|
|
215
|
+
toStorage: NativeStorageType;
|
|
216
|
+
keys?: string[];
|
|
217
|
+
transform?: (value: unknown) => unknown;
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/plugin/definitions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE;QAAE,OAAO,EAAE,iBAAiB,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAEtF;;OAEG;IACH,GAAG,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,YAAY,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IAExE;;OAEG;IACH,GAAG,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9C;;OAE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,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,iBAAiB,CAAC;IAC/B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CACzC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strata Storage Capacitor Plugin
|
|
3
|
+
* Main plugin registration and web implementation
|
|
4
|
+
*/
|
|
5
|
+
import type { StrataStoragePlugin } from './definitions';
|
|
6
|
+
export declare let StrataStorage: StrataStoragePlugin;
|
|
7
|
+
export * from './definitions';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAczD,eAAO,IAAI,aAAa,EAAE,mBAAgC,CAAC;AAiB3D,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strata Storage Capacitor Plugin
|
|
3
|
+
* Main plugin registration and web implementation
|
|
4
|
+
*/
|
|
5
|
+
// Mock implementation for when Capacitor is not available
|
|
6
|
+
const mockPlugin = {
|
|
7
|
+
isAvailable: async () => ({ available: false }),
|
|
8
|
+
get: async () => ({ value: null }),
|
|
9
|
+
set: async () => { },
|
|
10
|
+
remove: async () => { },
|
|
11
|
+
clear: async () => { },
|
|
12
|
+
keys: async () => ({ keys: [] }),
|
|
13
|
+
size: async () => ({ total: 0, count: 0 }),
|
|
14
|
+
};
|
|
15
|
+
// Export the plugin - will be initialized based on environment
|
|
16
|
+
export let StrataStorage = mockPlugin;
|
|
17
|
+
// Initialize plugin when module loads
|
|
18
|
+
if (typeof window !== 'undefined') {
|
|
19
|
+
// Check if Capacitor is available
|
|
20
|
+
const cap = window.Capacitor;
|
|
21
|
+
if (cap && cap.registerPlugin) {
|
|
22
|
+
StrataStorage = cap.registerPlugin('StrataStorage', {
|
|
23
|
+
web: () => import('./web').then((m) => new m.StrataStorageWeb()),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export * from './definitions';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strata Storage Web Implementation
|
|
3
|
+
* Web platform implementation of the Capacitor plugin
|
|
4
|
+
*/
|
|
5
|
+
import type { StrataStoragePlugin, NativeStorageType, NativeGetOptions, NativeSetOptions, NativeRemoveOptions, NativeClearOptions, NativeKeysOptions, NativeSizeOptions, NativeSizeResult } from './definitions';
|
|
6
|
+
import type { StorageValue } from '@/types';
|
|
7
|
+
export declare class StrataStorageWeb implements StrataStoragePlugin {
|
|
8
|
+
isAvailable(_options: {
|
|
9
|
+
storage: NativeStorageType;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
available: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
get(_options: NativeGetOptions): Promise<{
|
|
14
|
+
value: StorageValue | null;
|
|
15
|
+
}>;
|
|
16
|
+
set(_options: NativeSetOptions): Promise<void>;
|
|
17
|
+
remove(_options: NativeRemoveOptions): Promise<void>;
|
|
18
|
+
clear(_options: NativeClearOptions): Promise<void>;
|
|
19
|
+
keys(_options: NativeKeysOptions): Promise<{
|
|
20
|
+
keys: string[];
|
|
21
|
+
}>;
|
|
22
|
+
size(_options: NativeSizeOptions): Promise<NativeSizeResult>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../src/plugin/web.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,qBAAa,gBAAiB,YAAW,mBAAmB;IACpD,WAAW,CAAC,QAAQ,EAAE;QAAE,OAAO,EAAE,iBAAiB,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;IAMtF,GAAG,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,YAAY,GAAG,IAAI,CAAA;KAAE,CAAC;IAKxE,GAAG,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAK9C,MAAM,CAAC,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKpD,KAAK,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlD,IAAI,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAK9D,IAAI,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAInE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strata Storage Web Implementation
|
|
3
|
+
* Web platform implementation of the Capacitor plugin
|
|
4
|
+
*/
|
|
5
|
+
export class StrataStorageWeb {
|
|
6
|
+
async isAvailable(_options) {
|
|
7
|
+
// Web platform doesn't support native storage types
|
|
8
|
+
// This is handled by the web adapters instead
|
|
9
|
+
return { available: false };
|
|
10
|
+
}
|
|
11
|
+
async get(_options) {
|
|
12
|
+
// Not implemented for web - use web adapters instead
|
|
13
|
+
throw new Error('Native storage not available on web platform');
|
|
14
|
+
}
|
|
15
|
+
async set(_options) {
|
|
16
|
+
// Not implemented for web - use web adapters instead
|
|
17
|
+
throw new Error('Native storage not available on web platform');
|
|
18
|
+
}
|
|
19
|
+
async remove(_options) {
|
|
20
|
+
// Not implemented for web - use web adapters instead
|
|
21
|
+
throw new Error('Native storage not available on web platform');
|
|
22
|
+
}
|
|
23
|
+
async clear(_options) {
|
|
24
|
+
// Not implemented for web - use web adapters instead
|
|
25
|
+
throw new Error('Native storage not available on web platform');
|
|
26
|
+
}
|
|
27
|
+
async keys(_options) {
|
|
28
|
+
// Not implemented for web - use web adapters instead
|
|
29
|
+
throw new Error('Native storage not available on web platform');
|
|
30
|
+
}
|
|
31
|
+
async size(_options) {
|
|
32
|
+
// Not implemented for web - use web adapters instead
|
|
33
|
+
throw new Error('Native storage not available on web platform');
|
|
34
|
+
}
|
|
35
|
+
}
|