@objectstack/driver-memory 3.0.10 → 3.1.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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +16 -0
- package/dist/index.d.mts +151 -1
- package/dist/index.d.ts +151 -1
- package/dist/index.js +337 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +332 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +4 -1
- package/src/memory-driver.test.ts +1 -1
- package/src/memory-driver.ts +229 -0
- package/src/persistence/file-adapter.ts +103 -0
- package/src/persistence/index.ts +4 -0
- package/src/persistence/local-storage-adapter.ts +60 -0
- package/src/persistence/persistence.test.ts +298 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @objectstack/driver-memory@3.0
|
|
2
|
+
> @objectstack/driver-memory@3.1.0 build /home/runner/work/spec/spec/packages/plugins/driver-memory
|
|
3
3
|
> tsup --config ../../../tsup.config.ts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
14
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[
|
|
15
|
-
[32mESM[39m ⚡️ Build success in
|
|
16
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
17
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
18
|
-
[32mCJS[39m ⚡️ Build success in
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m49.23 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m97.21 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 160ms
|
|
16
|
+
[32mCJS[39m [1mdist/index.js [22m[32m50.91 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m97.27 KB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 163ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
22
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 17419ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m13.73 KB[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m13.73 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @objectstack/driver-memory
|
|
2
2
|
|
|
3
|
+
## 3.1.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [0088830]
|
|
8
|
+
- @objectstack/spec@3.1.0
|
|
9
|
+
- @objectstack/core@3.1.0
|
|
10
|
+
|
|
11
|
+
## 3.0.11
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [92d9d99]
|
|
16
|
+
- @objectstack/spec@3.0.11
|
|
17
|
+
- @objectstack/core@3.0.11
|
|
18
|
+
|
|
3
19
|
## 3.0.10
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,19 @@ import { QueryInput, DriverOptions, Cube, AnalyticsQuery } from '@objectstack/sp
|
|
|
2
2
|
import { DriverInterface, Logger } from '@objectstack/core';
|
|
3
3
|
import { IAnalyticsService, AnalyticsResult, CubeMeta } from '@objectstack/spec/contracts';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Persistence adapter interface.
|
|
7
|
+
* Matches the PersistenceAdapterSchema contract from @objectstack/spec.
|
|
8
|
+
*/
|
|
9
|
+
interface PersistenceAdapterInterface {
|
|
10
|
+
load(): Promise<Record<string, any[]> | null>;
|
|
11
|
+
save(db: Record<string, any[]>): Promise<void>;
|
|
12
|
+
flush(): Promise<void>;
|
|
13
|
+
/** Optional: Start periodic auto-save (used by FileSystemPersistenceAdapter). */
|
|
14
|
+
startAutoSave?(): void;
|
|
15
|
+
/** Optional: Stop auto-save timer and flush pending writes. */
|
|
16
|
+
stopAutoSave?(): Promise<void>;
|
|
17
|
+
}
|
|
5
18
|
/**
|
|
6
19
|
* Configuration options for the InMemory driver.
|
|
7
20
|
* Aligned with @objectstack/spec MemoryConfigSchema.
|
|
@@ -13,6 +26,28 @@ interface InMemoryDriverConfig {
|
|
|
13
26
|
strictMode?: boolean;
|
|
14
27
|
/** Optional: Logger instance */
|
|
15
28
|
logger?: Logger;
|
|
29
|
+
/**
|
|
30
|
+
* Persistence configuration. Defaults to `'auto'`.
|
|
31
|
+
* - `'auto'` (default) — Auto-detect environment (browser → localStorage, Node.js → file, serverless → disabled)
|
|
32
|
+
* - `'file'` — File-system persistence with defaults (Node.js only)
|
|
33
|
+
* - `'local'` — localStorage persistence with defaults (Browser only)
|
|
34
|
+
* - `{ type: 'file', path?: string, autoSaveInterval?: number }` — File-system with options
|
|
35
|
+
* - `{ type: 'local', key?: string }` — localStorage with options
|
|
36
|
+
* - `{ type: 'auto', path?: string, key?: string, autoSaveInterval?: number }` — Auto-detect with options
|
|
37
|
+
* - `{ adapter: PersistenceAdapterInterface }` — Custom adapter
|
|
38
|
+
* - `false` — Disable persistence (pure in-memory)
|
|
39
|
+
*
|
|
40
|
+
* ⚠️ In serverless environments (Vercel, AWS Lambda, Netlify, etc.),
|
|
41
|
+
* auto mode disables file persistence to prevent silent data loss.
|
|
42
|
+
* Use `persistence: false` or supply a custom adapter for serverless deployments.
|
|
43
|
+
*/
|
|
44
|
+
persistence?: string | false | {
|
|
45
|
+
type?: 'file' | 'local' | 'auto';
|
|
46
|
+
path?: string;
|
|
47
|
+
key?: string;
|
|
48
|
+
autoSaveInterval?: number;
|
|
49
|
+
adapter?: PersistenceAdapterInterface;
|
|
50
|
+
};
|
|
16
51
|
}
|
|
17
52
|
/**
|
|
18
53
|
* In-Memory Driver for ObjectStack
|
|
@@ -38,6 +73,7 @@ declare class InMemoryDriver implements DriverInterface {
|
|
|
38
73
|
private logger;
|
|
39
74
|
private idCounters;
|
|
40
75
|
private transactions;
|
|
76
|
+
private persistenceAdapter;
|
|
41
77
|
constructor(config?: InMemoryDriverConfig);
|
|
42
78
|
install(ctx: any): void;
|
|
43
79
|
supports: {
|
|
@@ -164,6 +200,120 @@ declare class InMemoryDriver implements DriverInterface {
|
|
|
164
200
|
private projectFields;
|
|
165
201
|
private getTable;
|
|
166
202
|
private generateId;
|
|
203
|
+
/**
|
|
204
|
+
* Mark the database as dirty, triggering persistence save.
|
|
205
|
+
*/
|
|
206
|
+
private markDirty;
|
|
207
|
+
/**
|
|
208
|
+
* Flush pending persistence writes to ensure data is safely stored.
|
|
209
|
+
*/
|
|
210
|
+
flush(): Promise<void>;
|
|
211
|
+
/**
|
|
212
|
+
* Detect whether the current runtime is a browser environment.
|
|
213
|
+
*/
|
|
214
|
+
private isBrowserEnvironment;
|
|
215
|
+
/**
|
|
216
|
+
* Detect whether the current runtime is a serverless/edge environment.
|
|
217
|
+
*
|
|
218
|
+
* Checks well-known environment variables set by serverless platforms:
|
|
219
|
+
* - `VERCEL` / `VERCEL_ENV` — Vercel Functions / Edge
|
|
220
|
+
* - `AWS_LAMBDA_FUNCTION_NAME` — AWS Lambda
|
|
221
|
+
* - `NETLIFY` — Netlify Functions
|
|
222
|
+
* - `FUNCTIONS_WORKER_RUNTIME` — Azure Functions
|
|
223
|
+
* - `K_SERVICE` — Google Cloud Run / Cloud Functions
|
|
224
|
+
* - `FUNCTION_TARGET` — Google Cloud Functions (Node.js)
|
|
225
|
+
* - `DENO_DEPLOYMENT_ID` — Deno Deploy
|
|
226
|
+
*
|
|
227
|
+
* Returns `false` when `process` or `process.env` is unavailable
|
|
228
|
+
* (e.g. browser or edge runtimes without a Node.js process object).
|
|
229
|
+
*/
|
|
230
|
+
private isServerlessEnvironment;
|
|
231
|
+
private static readonly SERVERLESS_PERSISTENCE_WARNING;
|
|
232
|
+
/**
|
|
233
|
+
* Initialize the persistence adapter based on configuration.
|
|
234
|
+
* Defaults to 'auto' when persistence is not specified.
|
|
235
|
+
* Use `persistence: false` to explicitly disable persistence.
|
|
236
|
+
*
|
|
237
|
+
* In serverless environments (Vercel, AWS Lambda, etc.), auto mode disables
|
|
238
|
+
* file-system persistence and emits a warning. Use `persistence: false` or
|
|
239
|
+
* supply a custom adapter for serverless-safe operation.
|
|
240
|
+
*/
|
|
241
|
+
private initPersistence;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* FileSystemPersistenceAdapter
|
|
246
|
+
*
|
|
247
|
+
* Persists the in-memory database to a JSON file on disk.
|
|
248
|
+
* Supports atomic writes (write to temp file then rename) and auto-save with dirty tracking.
|
|
249
|
+
*
|
|
250
|
+
* Node.js only — will throw if used in non-Node.js environments.
|
|
251
|
+
*/
|
|
252
|
+
declare class FileSystemPersistenceAdapter {
|
|
253
|
+
private readonly filePath;
|
|
254
|
+
private readonly autoSaveInterval;
|
|
255
|
+
private dirty;
|
|
256
|
+
private timer;
|
|
257
|
+
private currentDb;
|
|
258
|
+
constructor(options?: {
|
|
259
|
+
path?: string;
|
|
260
|
+
autoSaveInterval?: number;
|
|
261
|
+
});
|
|
262
|
+
/**
|
|
263
|
+
* Load persisted data from disk.
|
|
264
|
+
* Returns null if no file exists.
|
|
265
|
+
*/
|
|
266
|
+
load(): Promise<Record<string, any[]> | null>;
|
|
267
|
+
/**
|
|
268
|
+
* Save data to disk using atomic write (temp file + rename).
|
|
269
|
+
*/
|
|
270
|
+
save(db: Record<string, any[]>): Promise<void>;
|
|
271
|
+
/**
|
|
272
|
+
* Flush pending writes to disk immediately.
|
|
273
|
+
*/
|
|
274
|
+
flush(): Promise<void>;
|
|
275
|
+
/**
|
|
276
|
+
* Start the auto-save timer.
|
|
277
|
+
*/
|
|
278
|
+
startAutoSave(): void;
|
|
279
|
+
/**
|
|
280
|
+
* Stop the auto-save timer and flush pending writes.
|
|
281
|
+
*/
|
|
282
|
+
stopAutoSave(): Promise<void>;
|
|
283
|
+
/**
|
|
284
|
+
* Atomic write: write to temp file, then rename.
|
|
285
|
+
*/
|
|
286
|
+
private writeToDisk;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* LocalStoragePersistenceAdapter
|
|
291
|
+
*
|
|
292
|
+
* Persists the in-memory database to browser localStorage.
|
|
293
|
+
* Synchronous storage with a ~5MB size limit warning.
|
|
294
|
+
*
|
|
295
|
+
* Browser only — will throw if used in non-browser environments.
|
|
296
|
+
*/
|
|
297
|
+
declare class LocalStoragePersistenceAdapter {
|
|
298
|
+
private readonly storageKey;
|
|
299
|
+
private static readonly SIZE_WARNING_BYTES;
|
|
300
|
+
constructor(options?: {
|
|
301
|
+
key?: string;
|
|
302
|
+
});
|
|
303
|
+
/**
|
|
304
|
+
* Load persisted data from localStorage.
|
|
305
|
+
* Returns null if no data exists.
|
|
306
|
+
*/
|
|
307
|
+
load(): Promise<Record<string, any[]> | null>;
|
|
308
|
+
/**
|
|
309
|
+
* Save data to localStorage.
|
|
310
|
+
* Warns if data size approaches the ~5MB localStorage limit.
|
|
311
|
+
*/
|
|
312
|
+
save(db: Record<string, any[]>): Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* Flush is a no-op for localStorage (writes are synchronous).
|
|
315
|
+
*/
|
|
316
|
+
flush(): Promise<void>;
|
|
167
317
|
}
|
|
168
318
|
|
|
169
319
|
/**
|
|
@@ -237,4 +387,4 @@ declare const _default: {
|
|
|
237
387
|
onEnable: (context: any) => Promise<void>;
|
|
238
388
|
};
|
|
239
389
|
|
|
240
|
-
export { InMemoryDriver, type InMemoryDriverConfig, type MemoryAnalyticsConfig, MemoryAnalyticsService, _default as default };
|
|
390
|
+
export { FileSystemPersistenceAdapter, InMemoryDriver, type InMemoryDriverConfig, LocalStoragePersistenceAdapter, type MemoryAnalyticsConfig, MemoryAnalyticsService, type PersistenceAdapterInterface, _default as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,19 @@ import { QueryInput, DriverOptions, Cube, AnalyticsQuery } from '@objectstack/sp
|
|
|
2
2
|
import { DriverInterface, Logger } from '@objectstack/core';
|
|
3
3
|
import { IAnalyticsService, AnalyticsResult, CubeMeta } from '@objectstack/spec/contracts';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Persistence adapter interface.
|
|
7
|
+
* Matches the PersistenceAdapterSchema contract from @objectstack/spec.
|
|
8
|
+
*/
|
|
9
|
+
interface PersistenceAdapterInterface {
|
|
10
|
+
load(): Promise<Record<string, any[]> | null>;
|
|
11
|
+
save(db: Record<string, any[]>): Promise<void>;
|
|
12
|
+
flush(): Promise<void>;
|
|
13
|
+
/** Optional: Start periodic auto-save (used by FileSystemPersistenceAdapter). */
|
|
14
|
+
startAutoSave?(): void;
|
|
15
|
+
/** Optional: Stop auto-save timer and flush pending writes. */
|
|
16
|
+
stopAutoSave?(): Promise<void>;
|
|
17
|
+
}
|
|
5
18
|
/**
|
|
6
19
|
* Configuration options for the InMemory driver.
|
|
7
20
|
* Aligned with @objectstack/spec MemoryConfigSchema.
|
|
@@ -13,6 +26,28 @@ interface InMemoryDriverConfig {
|
|
|
13
26
|
strictMode?: boolean;
|
|
14
27
|
/** Optional: Logger instance */
|
|
15
28
|
logger?: Logger;
|
|
29
|
+
/**
|
|
30
|
+
* Persistence configuration. Defaults to `'auto'`.
|
|
31
|
+
* - `'auto'` (default) — Auto-detect environment (browser → localStorage, Node.js → file, serverless → disabled)
|
|
32
|
+
* - `'file'` — File-system persistence with defaults (Node.js only)
|
|
33
|
+
* - `'local'` — localStorage persistence with defaults (Browser only)
|
|
34
|
+
* - `{ type: 'file', path?: string, autoSaveInterval?: number }` — File-system with options
|
|
35
|
+
* - `{ type: 'local', key?: string }` — localStorage with options
|
|
36
|
+
* - `{ type: 'auto', path?: string, key?: string, autoSaveInterval?: number }` — Auto-detect with options
|
|
37
|
+
* - `{ adapter: PersistenceAdapterInterface }` — Custom adapter
|
|
38
|
+
* - `false` — Disable persistence (pure in-memory)
|
|
39
|
+
*
|
|
40
|
+
* ⚠️ In serverless environments (Vercel, AWS Lambda, Netlify, etc.),
|
|
41
|
+
* auto mode disables file persistence to prevent silent data loss.
|
|
42
|
+
* Use `persistence: false` or supply a custom adapter for serverless deployments.
|
|
43
|
+
*/
|
|
44
|
+
persistence?: string | false | {
|
|
45
|
+
type?: 'file' | 'local' | 'auto';
|
|
46
|
+
path?: string;
|
|
47
|
+
key?: string;
|
|
48
|
+
autoSaveInterval?: number;
|
|
49
|
+
adapter?: PersistenceAdapterInterface;
|
|
50
|
+
};
|
|
16
51
|
}
|
|
17
52
|
/**
|
|
18
53
|
* In-Memory Driver for ObjectStack
|
|
@@ -38,6 +73,7 @@ declare class InMemoryDriver implements DriverInterface {
|
|
|
38
73
|
private logger;
|
|
39
74
|
private idCounters;
|
|
40
75
|
private transactions;
|
|
76
|
+
private persistenceAdapter;
|
|
41
77
|
constructor(config?: InMemoryDriverConfig);
|
|
42
78
|
install(ctx: any): void;
|
|
43
79
|
supports: {
|
|
@@ -164,6 +200,120 @@ declare class InMemoryDriver implements DriverInterface {
|
|
|
164
200
|
private projectFields;
|
|
165
201
|
private getTable;
|
|
166
202
|
private generateId;
|
|
203
|
+
/**
|
|
204
|
+
* Mark the database as dirty, triggering persistence save.
|
|
205
|
+
*/
|
|
206
|
+
private markDirty;
|
|
207
|
+
/**
|
|
208
|
+
* Flush pending persistence writes to ensure data is safely stored.
|
|
209
|
+
*/
|
|
210
|
+
flush(): Promise<void>;
|
|
211
|
+
/**
|
|
212
|
+
* Detect whether the current runtime is a browser environment.
|
|
213
|
+
*/
|
|
214
|
+
private isBrowserEnvironment;
|
|
215
|
+
/**
|
|
216
|
+
* Detect whether the current runtime is a serverless/edge environment.
|
|
217
|
+
*
|
|
218
|
+
* Checks well-known environment variables set by serverless platforms:
|
|
219
|
+
* - `VERCEL` / `VERCEL_ENV` — Vercel Functions / Edge
|
|
220
|
+
* - `AWS_LAMBDA_FUNCTION_NAME` — AWS Lambda
|
|
221
|
+
* - `NETLIFY` — Netlify Functions
|
|
222
|
+
* - `FUNCTIONS_WORKER_RUNTIME` — Azure Functions
|
|
223
|
+
* - `K_SERVICE` — Google Cloud Run / Cloud Functions
|
|
224
|
+
* - `FUNCTION_TARGET` — Google Cloud Functions (Node.js)
|
|
225
|
+
* - `DENO_DEPLOYMENT_ID` — Deno Deploy
|
|
226
|
+
*
|
|
227
|
+
* Returns `false` when `process` or `process.env` is unavailable
|
|
228
|
+
* (e.g. browser or edge runtimes without a Node.js process object).
|
|
229
|
+
*/
|
|
230
|
+
private isServerlessEnvironment;
|
|
231
|
+
private static readonly SERVERLESS_PERSISTENCE_WARNING;
|
|
232
|
+
/**
|
|
233
|
+
* Initialize the persistence adapter based on configuration.
|
|
234
|
+
* Defaults to 'auto' when persistence is not specified.
|
|
235
|
+
* Use `persistence: false` to explicitly disable persistence.
|
|
236
|
+
*
|
|
237
|
+
* In serverless environments (Vercel, AWS Lambda, etc.), auto mode disables
|
|
238
|
+
* file-system persistence and emits a warning. Use `persistence: false` or
|
|
239
|
+
* supply a custom adapter for serverless-safe operation.
|
|
240
|
+
*/
|
|
241
|
+
private initPersistence;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* FileSystemPersistenceAdapter
|
|
246
|
+
*
|
|
247
|
+
* Persists the in-memory database to a JSON file on disk.
|
|
248
|
+
* Supports atomic writes (write to temp file then rename) and auto-save with dirty tracking.
|
|
249
|
+
*
|
|
250
|
+
* Node.js only — will throw if used in non-Node.js environments.
|
|
251
|
+
*/
|
|
252
|
+
declare class FileSystemPersistenceAdapter {
|
|
253
|
+
private readonly filePath;
|
|
254
|
+
private readonly autoSaveInterval;
|
|
255
|
+
private dirty;
|
|
256
|
+
private timer;
|
|
257
|
+
private currentDb;
|
|
258
|
+
constructor(options?: {
|
|
259
|
+
path?: string;
|
|
260
|
+
autoSaveInterval?: number;
|
|
261
|
+
});
|
|
262
|
+
/**
|
|
263
|
+
* Load persisted data from disk.
|
|
264
|
+
* Returns null if no file exists.
|
|
265
|
+
*/
|
|
266
|
+
load(): Promise<Record<string, any[]> | null>;
|
|
267
|
+
/**
|
|
268
|
+
* Save data to disk using atomic write (temp file + rename).
|
|
269
|
+
*/
|
|
270
|
+
save(db: Record<string, any[]>): Promise<void>;
|
|
271
|
+
/**
|
|
272
|
+
* Flush pending writes to disk immediately.
|
|
273
|
+
*/
|
|
274
|
+
flush(): Promise<void>;
|
|
275
|
+
/**
|
|
276
|
+
* Start the auto-save timer.
|
|
277
|
+
*/
|
|
278
|
+
startAutoSave(): void;
|
|
279
|
+
/**
|
|
280
|
+
* Stop the auto-save timer and flush pending writes.
|
|
281
|
+
*/
|
|
282
|
+
stopAutoSave(): Promise<void>;
|
|
283
|
+
/**
|
|
284
|
+
* Atomic write: write to temp file, then rename.
|
|
285
|
+
*/
|
|
286
|
+
private writeToDisk;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* LocalStoragePersistenceAdapter
|
|
291
|
+
*
|
|
292
|
+
* Persists the in-memory database to browser localStorage.
|
|
293
|
+
* Synchronous storage with a ~5MB size limit warning.
|
|
294
|
+
*
|
|
295
|
+
* Browser only — will throw if used in non-browser environments.
|
|
296
|
+
*/
|
|
297
|
+
declare class LocalStoragePersistenceAdapter {
|
|
298
|
+
private readonly storageKey;
|
|
299
|
+
private static readonly SIZE_WARNING_BYTES;
|
|
300
|
+
constructor(options?: {
|
|
301
|
+
key?: string;
|
|
302
|
+
});
|
|
303
|
+
/**
|
|
304
|
+
* Load persisted data from localStorage.
|
|
305
|
+
* Returns null if no data exists.
|
|
306
|
+
*/
|
|
307
|
+
load(): Promise<Record<string, any[]> | null>;
|
|
308
|
+
/**
|
|
309
|
+
* Save data to localStorage.
|
|
310
|
+
* Warns if data size approaches the ~5MB localStorage limit.
|
|
311
|
+
*/
|
|
312
|
+
save(db: Record<string, any[]>): Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* Flush is a no-op for localStorage (writes are synchronous).
|
|
315
|
+
*/
|
|
316
|
+
flush(): Promise<void>;
|
|
167
317
|
}
|
|
168
318
|
|
|
169
319
|
/**
|
|
@@ -237,4 +387,4 @@ declare const _default: {
|
|
|
237
387
|
onEnable: (context: any) => Promise<void>;
|
|
238
388
|
};
|
|
239
389
|
|
|
240
|
-
export { InMemoryDriver, type InMemoryDriverConfig, type MemoryAnalyticsConfig, MemoryAnalyticsService, _default as default };
|
|
390
|
+
export { FileSystemPersistenceAdapter, InMemoryDriver, type InMemoryDriverConfig, LocalStoragePersistenceAdapter, type MemoryAnalyticsConfig, MemoryAnalyticsService, type PersistenceAdapterInterface, _default as default };
|