@camstack/core 0.1.0 → 0.1.2

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.
Files changed (68) hide show
  1. package/dist/builtins/local-backup/index.d.mts +42 -0
  2. package/dist/builtins/local-backup/index.d.ts +42 -0
  3. package/dist/builtins/local-backup/index.js +188 -0
  4. package/dist/builtins/local-backup/index.js.map +1 -0
  5. package/dist/builtins/local-backup/index.mjs +11 -0
  6. package/dist/builtins/local-backup/index.mjs.map +1 -0
  7. package/dist/builtins/sqlite-storage/filesystem-storage.addon.d.mts +2 -0
  8. package/dist/builtins/sqlite-storage/filesystem-storage.addon.d.ts +2 -0
  9. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +210 -0
  10. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js.map +1 -0
  11. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +10 -0
  12. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs.map +1 -0
  13. package/dist/builtins/sqlite-storage/index.d.mts +4 -0
  14. package/dist/builtins/sqlite-storage/index.d.ts +4 -0
  15. package/dist/builtins/sqlite-storage/index.js +1025 -0
  16. package/dist/builtins/sqlite-storage/index.js.map +1 -0
  17. package/dist/builtins/sqlite-storage/index.mjs +31 -0
  18. package/dist/builtins/sqlite-storage/index.mjs.map +1 -0
  19. package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.mts +2 -0
  20. package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +2 -0
  21. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +317 -0
  22. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js.map +1 -0
  23. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +10 -0
  24. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs.map +1 -0
  25. package/dist/builtins/winston-logging/index.d.mts +30 -0
  26. package/dist/builtins/winston-logging/index.d.ts +30 -0
  27. package/dist/builtins/winston-logging/index.js +185 -0
  28. package/dist/builtins/winston-logging/index.js.map +1 -0
  29. package/dist/builtins/winston-logging/index.mjs +11 -0
  30. package/dist/builtins/winston-logging/index.mjs.map +1 -0
  31. package/dist/chunk-2F3XZYRW.mjs +89 -0
  32. package/dist/chunk-2F3XZYRW.mjs.map +1 -0
  33. package/dist/chunk-LQFPAEQF.mjs +147 -0
  34. package/dist/chunk-LQFPAEQF.mjs.map +1 -0
  35. package/dist/chunk-QEMJH3KY.mjs +48 -0
  36. package/dist/chunk-QEMJH3KY.mjs.map +1 -0
  37. package/dist/chunk-R3DIIBBX.mjs +532 -0
  38. package/dist/chunk-R3DIIBBX.mjs.map +1 -0
  39. package/dist/chunk-SO4LROOT.mjs +150 -0
  40. package/dist/chunk-SO4LROOT.mjs.map +1 -0
  41. package/dist/chunk-SPA4JBKN.mjs +175 -0
  42. package/dist/chunk-SPA4JBKN.mjs.map +1 -0
  43. package/dist/chunk-YXNXYYHL.mjs +282 -0
  44. package/dist/chunk-YXNXYYHL.mjs.map +1 -0
  45. package/dist/dist-N7SR63RN.mjs +3515 -0
  46. package/dist/dist-N7SR63RN.mjs.map +1 -0
  47. package/dist/filesystem-storage.addon-C42r589X.d.mts +57 -0
  48. package/dist/filesystem-storage.addon-C42r589X.d.ts +57 -0
  49. package/dist/index.d.mts +1064 -101
  50. package/dist/index.d.ts +1064 -101
  51. package/dist/index.js +14673 -560
  52. package/dist/index.js.map +1 -1
  53. package/dist/index.mjs +6360 -534
  54. package/dist/index.mjs.map +1 -1
  55. package/dist/onnxruntime_binding-6Q6HXASN.node +0 -0
  56. package/dist/onnxruntime_binding-EKZT2NRK.node +0 -0
  57. package/dist/onnxruntime_binding-P6S7V3CI.node +0 -0
  58. package/dist/onnxruntime_binding-PJNNIIUO.node +0 -0
  59. package/dist/onnxruntime_binding-UN6SPTQK.node +0 -0
  60. package/dist/sql-schema-CKz78rId.d.mts +97 -0
  61. package/dist/sql-schema-CKz78rId.d.ts +97 -0
  62. package/dist/sqlite-settings.addon-DigoKwpZ.d.mts +70 -0
  63. package/dist/sqlite-settings.addon-DigoKwpZ.d.ts +70 -0
  64. package/dist/storage-location-manager-UQRGHTCA.mjs +8 -0
  65. package/dist/storage-location-manager-UQRGHTCA.mjs.map +1 -0
  66. package/dist/wrapper-Y55ADNM5.mjs +3652 -0
  67. package/dist/wrapper-Y55ADNM5.mjs.map +1 -0
  68. package/package.json +77 -6
@@ -0,0 +1,1025 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/builtins/sqlite-storage/index.ts
31
+ var sqlite_storage_exports = {};
32
+ __export(sqlite_storage_exports, {
33
+ CORE_TABLE_DDL: () => CORE_TABLE_DDL,
34
+ FileSystemStorage: () => FileSystemStorage,
35
+ FilesystemStorageAddon: () => FilesystemStorageAddon,
36
+ FilesystemStorageProvider: () => FilesystemStorageProvider,
37
+ SettingsStore: () => SettingsStore,
38
+ SqliteSettingsAddon: () => SqliteSettingsAddon,
39
+ SqliteSettingsBackend: () => SqliteSettingsBackend,
40
+ SqliteStorageAddon: () => SqliteStorageAddon,
41
+ SqliteStorageProvider: () => SqliteStorageProvider,
42
+ addonTableToDdl: () => addonTableToDdl,
43
+ default: () => FilesystemStorageAddon
44
+ });
45
+ module.exports = __toCommonJS(sqlite_storage_exports);
46
+
47
+ // src/builtins/sqlite-storage/filesystem-storage-provider.ts
48
+ var fs = __toESM(require("fs"));
49
+ var path = __toESM(require("path"));
50
+ var STORAGE_LOCATION_TYPES = [
51
+ "recordings-high",
52
+ "recordings-low",
53
+ "recordings-clips",
54
+ "event-images",
55
+ "models",
56
+ "addons-data",
57
+ "cache",
58
+ "logs"
59
+ ];
60
+ var DEFAULT_LOCATION_SUBDIRS = {
61
+ "recordings-high": "recordings-high",
62
+ "recordings-low": "recordings-low",
63
+ "recordings-clips": "recordings-clips",
64
+ "event-images": "event-images",
65
+ "models": "models",
66
+ "addons-data": "addons-data",
67
+ "cache": "/tmp/camstack-cache",
68
+ "logs": "logs"
69
+ };
70
+ var FilesystemStorageProvider = class {
71
+ id = "local";
72
+ name = "Local Filesystem";
73
+ supportedLocations = [...STORAGE_LOCATION_TYPES];
74
+ rootPath;
75
+ locationPaths;
76
+ constructor(rootPath, overrides) {
77
+ this.rootPath = path.resolve(rootPath);
78
+ this.locationPaths = /* @__PURE__ */ new Map();
79
+ for (const loc of STORAGE_LOCATION_TYPES) {
80
+ const override = overrides?.[loc];
81
+ if (override) {
82
+ this.locationPaths.set(loc, path.resolve(override));
83
+ } else {
84
+ const subdir = DEFAULT_LOCATION_SUBDIRS[loc];
85
+ this.locationPaths.set(
86
+ loc,
87
+ path.isAbsolute(subdir) ? subdir : path.join(this.rootPath, subdir)
88
+ );
89
+ }
90
+ }
91
+ }
92
+ resolve(location, relativePath) {
93
+ const base = this.locationPaths.get(location);
94
+ if (!base) throw new Error(`Unknown storage location: ${location}`);
95
+ return path.join(base, relativePath);
96
+ }
97
+ async write(location, relativePath, data) {
98
+ const filePath = this.resolve(location, relativePath);
99
+ await fs.promises.mkdir(path.dirname(filePath), { recursive: true });
100
+ if (Buffer.isBuffer(data)) {
101
+ await fs.promises.writeFile(filePath, data);
102
+ } else {
103
+ const writeStream = fs.createWriteStream(filePath);
104
+ await new Promise((resolve2, reject) => {
105
+ data.pipe(writeStream);
106
+ writeStream.on("finish", resolve2);
107
+ writeStream.on("error", reject);
108
+ });
109
+ }
110
+ }
111
+ async read(location, relativePath) {
112
+ return fs.promises.readFile(this.resolve(location, relativePath));
113
+ }
114
+ async exists(location, relativePath) {
115
+ try {
116
+ await fs.promises.access(this.resolve(location, relativePath));
117
+ return true;
118
+ } catch {
119
+ return false;
120
+ }
121
+ }
122
+ async list(location, prefix) {
123
+ const base = this.locationPaths.get(location);
124
+ if (!base) return [];
125
+ const dir = prefix ? path.join(base, prefix) : base;
126
+ try {
127
+ const entries = await fs.promises.readdir(dir, { withFileTypes: true });
128
+ return entries.map((e) => prefix ? `${prefix}/${e.name}` : e.name);
129
+ } catch {
130
+ return [];
131
+ }
132
+ }
133
+ async delete(location, relativePath) {
134
+ const filePath = this.resolve(location, relativePath);
135
+ await fs.promises.rm(filePath, { force: true });
136
+ }
137
+ async getAvailableSpace(location) {
138
+ const base = this.locationPaths.get(location);
139
+ if (!base) return null;
140
+ try {
141
+ const stats = await fs.promises.statfs(base);
142
+ return stats.bavail * stats.bsize;
143
+ } catch {
144
+ return null;
145
+ }
146
+ }
147
+ async initialize() {
148
+ for (const [, dirPath] of this.locationPaths) {
149
+ await fs.promises.mkdir(dirPath, { recursive: true });
150
+ }
151
+ }
152
+ async shutdown() {
153
+ }
154
+ /** Get the resolved path for a location type */
155
+ getLocationPath(location) {
156
+ const p = this.locationPaths.get(location);
157
+ if (!p) throw new Error(`Unknown storage location: ${location}`);
158
+ return p;
159
+ }
160
+ /** Get the root path */
161
+ getRootPath() {
162
+ return this.rootPath;
163
+ }
164
+ };
165
+
166
+ // src/builtins/sqlite-storage/filesystem-storage.addon.ts
167
+ var FilesystemStorageAddon = class {
168
+ manifest = {
169
+ id: "filesystem-storage",
170
+ name: "Local Filesystem Storage",
171
+ version: "1.0.0",
172
+ capabilities: [{ name: "storage", mode: "collection" }]
173
+ };
174
+ provider = null;
175
+ currentConfig = {
176
+ rootPath: "camstack-data"
177
+ };
178
+ async initialize(context) {
179
+ const rootPath = context.addonConfig.rootPath ?? this.currentConfig.rootPath;
180
+ this.currentConfig.rootPath = rootPath;
181
+ const overrides = {};
182
+ for (const key of Object.keys(context.addonConfig)) {
183
+ if (key.startsWith("override.")) {
184
+ const loc = key.slice("override.".length);
185
+ overrides[loc] = context.addonConfig[key];
186
+ }
187
+ }
188
+ this.provider = new FilesystemStorageProvider(rootPath, overrides);
189
+ await this.provider.initialize();
190
+ context.logger.info(`Filesystem storage initialized at ${this.provider.getRootPath()}`);
191
+ }
192
+ async shutdown() {
193
+ await this.provider?.shutdown();
194
+ }
195
+ getCapabilityProvider(name) {
196
+ if (name === "storage" && this.provider) {
197
+ return this.provider;
198
+ }
199
+ return null;
200
+ }
201
+ getProvider() {
202
+ return this.provider;
203
+ }
204
+ getConfigSchema() {
205
+ return { sections: [] };
206
+ }
207
+ getConfig() {
208
+ return { ...this.currentConfig };
209
+ }
210
+ async onConfigChange(config) {
211
+ this.currentConfig.rootPath = config.rootPath ?? this.currentConfig.rootPath;
212
+ }
213
+ };
214
+
215
+ // src/builtins/sqlite-storage/sqlite-settings-backend.ts
216
+ var import_better_sqlite3 = __toESM(require("better-sqlite3"));
217
+ var import_node_crypto = require("crypto");
218
+ var SqliteSettingsBackend = class {
219
+ constructor(dbPath, runtimeDefaults) {
220
+ this.dbPath = dbPath;
221
+ this.runtimeDefaults = runtimeDefaults ?? {};
222
+ }
223
+ db = null;
224
+ ensuredTables = /* @__PURE__ */ new Set();
225
+ runtimeDefaults;
226
+ async initialize() {
227
+ const dir = this.dbPath.substring(0, this.dbPath.lastIndexOf("/"));
228
+ if (dir) {
229
+ const fs3 = await import("fs");
230
+ fs3.mkdirSync(dir, { recursive: true });
231
+ }
232
+ this.db = new import_better_sqlite3.default(this.dbPath);
233
+ this.db.pragma("journal_mode = WAL");
234
+ this.db.pragma("foreign_keys = ON");
235
+ const isEmpty = await this.isEmpty("system-settings");
236
+ if (isEmpty) {
237
+ await this.seedDefaults();
238
+ }
239
+ }
240
+ async shutdown() {
241
+ this.db?.close();
242
+ this.db = null;
243
+ }
244
+ // ---------------------------------------------------------------------------
245
+ // ISettingsBackend implementation
246
+ // ---------------------------------------------------------------------------
247
+ async get(collection, key) {
248
+ this.ensureTable(collection);
249
+ const row = this.getDb().prepare(`SELECT data FROM "${collection}" WHERE id = ?`).get(key);
250
+ if (!row) return void 0;
251
+ return JSON.parse(row.data);
252
+ }
253
+ async set(collection, key, value) {
254
+ this.ensureTable(collection);
255
+ this.getDb().prepare(`INSERT INTO "${collection}" (id, data) VALUES (?, ?) ON CONFLICT(id) DO UPDATE SET data = excluded.data`).run(key, JSON.stringify(value));
256
+ }
257
+ async query(collection, filter) {
258
+ this.ensureTable(collection);
259
+ let sql = `SELECT id, data FROM "${collection}"`;
260
+ const params = [];
261
+ const whereClauses = [];
262
+ if (filter?.where) {
263
+ for (const [field, value] of Object.entries(filter.where)) {
264
+ if (field === "id") {
265
+ whereClauses.push("id = ?");
266
+ params.push(value);
267
+ } else {
268
+ whereClauses.push(`json_extract(data, '$.${field}') = ?`);
269
+ params.push(typeof value === "object" ? JSON.stringify(value) : value);
270
+ }
271
+ }
272
+ }
273
+ if (filter?.whereIn) {
274
+ for (const [field, values] of Object.entries(filter.whereIn)) {
275
+ const placeholders = values.map(() => "?").join(", ");
276
+ if (field === "id") {
277
+ whereClauses.push(`id IN (${placeholders})`);
278
+ } else {
279
+ whereClauses.push(`json_extract(data, '$.${field}') IN (${placeholders})`);
280
+ }
281
+ params.push(...values);
282
+ }
283
+ }
284
+ if (filter?.whereBetween) {
285
+ for (const [field, [low, high]] of Object.entries(filter.whereBetween)) {
286
+ if (field === "id") {
287
+ whereClauses.push("id BETWEEN ? AND ?");
288
+ } else {
289
+ whereClauses.push(`json_extract(data, '$.${field}') BETWEEN ? AND ?`);
290
+ }
291
+ params.push(low, high);
292
+ }
293
+ }
294
+ if (whereClauses.length > 0) {
295
+ sql += ` WHERE ${whereClauses.join(" AND ")}`;
296
+ }
297
+ if (filter?.orderBy) {
298
+ const dir = filter.orderBy.direction === "desc" ? "DESC" : "ASC";
299
+ if (filter.orderBy.field === "id") {
300
+ sql += ` ORDER BY id ${dir}`;
301
+ } else {
302
+ sql += ` ORDER BY json_extract(data, '$.${filter.orderBy.field}') ${dir}`;
303
+ }
304
+ }
305
+ if (filter?.limit) {
306
+ sql += ` LIMIT ?`;
307
+ params.push(filter.limit);
308
+ }
309
+ if (filter?.offset) {
310
+ sql += ` OFFSET ?`;
311
+ params.push(filter.offset);
312
+ }
313
+ const rows = this.getDb().prepare(sql).all(...params);
314
+ return rows.map((row) => ({
315
+ id: row.id,
316
+ data: JSON.parse(row.data)
317
+ }));
318
+ }
319
+ async insert(collection, record) {
320
+ this.ensureTable(collection);
321
+ const id = record.id || (0, import_node_crypto.randomUUID)();
322
+ this.getDb().prepare(`INSERT INTO "${collection}" (id, data) VALUES (?, ?)`).run(id, JSON.stringify(record.data));
323
+ }
324
+ async update(collection, id, data) {
325
+ this.ensureTable(collection);
326
+ this.getDb().prepare(`UPDATE "${collection}" SET data = ? WHERE id = ?`).run(JSON.stringify(data), id);
327
+ }
328
+ async delete(collection, key) {
329
+ this.ensureTable(collection);
330
+ this.getDb().prepare(`DELETE FROM "${collection}" WHERE id = ?`).run(key);
331
+ }
332
+ async count(collection, filter) {
333
+ this.ensureTable(collection);
334
+ if (!filter) {
335
+ const row = this.getDb().prepare(`SELECT COUNT(*) AS cnt FROM "${collection}"`).get();
336
+ return row?.cnt ?? 0;
337
+ }
338
+ const rows = await this.query(collection, { ...filter, limit: void 0, offset: void 0 });
339
+ return rows.length;
340
+ }
341
+ async isEmpty(collection) {
342
+ this.ensureTable(collection);
343
+ const row = this.getDb().prepare(`SELECT COUNT(*) AS cnt FROM "${collection}"`).get();
344
+ return (row?.cnt ?? 0) === 0;
345
+ }
346
+ // ---------------------------------------------------------------------------
347
+ // Legacy SettingsStore compatibility (used by ConfigManager.setSettingsStore)
348
+ // ---------------------------------------------------------------------------
349
+ /** Get a system setting by dot-notation key */
350
+ getSystem(key) {
351
+ this.ensureTable("system-settings");
352
+ const row = this.getDb().prepare('SELECT data FROM "system-settings" WHERE id = ?').get(key);
353
+ if (!row) return void 0;
354
+ return JSON.parse(row.data);
355
+ }
356
+ /** Set a system setting */
357
+ setSystem(key, value) {
358
+ this.ensureTable("system-settings");
359
+ this.getDb().prepare('INSERT INTO "system-settings" (id, data) VALUES (?, ?) ON CONFLICT(id) DO UPDATE SET data = excluded.data').run(key, JSON.stringify(value));
360
+ }
361
+ /** Get all system settings as flat key-value */
362
+ getAllSystem() {
363
+ this.ensureTable("system-settings");
364
+ const rows = this.getDb().prepare('SELECT id, data FROM "system-settings"').all();
365
+ return Object.fromEntries(rows.map((r) => [r.id, JSON.parse(r.data)]));
366
+ }
367
+ /** Get all settings for an addon */
368
+ getAllAddon(addonId) {
369
+ this.ensureTable("addon-settings");
370
+ const rows = this.getDb().prepare(`SELECT id, data FROM "addon-settings" WHERE json_extract(data, '$.addonId') = ?`).all(addonId);
371
+ if (rows.length === 0) return {};
372
+ const result = {};
373
+ for (const row of rows) {
374
+ const parsed = JSON.parse(row.data);
375
+ const key = row.id.startsWith(`${addonId}.`) ? row.id.slice(addonId.length + 1) : row.id;
376
+ result[key] = parsed.value ?? parsed;
377
+ }
378
+ return result;
379
+ }
380
+ /** Bulk-set all settings for an addon */
381
+ setAllAddon(addonId, config) {
382
+ this.ensureTable("addon-settings");
383
+ const db = this.getDb();
384
+ const deleteStmt = db.prepare(`DELETE FROM "addon-settings" WHERE id LIKE ? || '%'`);
385
+ const insertStmt = db.prepare('INSERT INTO "addon-settings" (id, data) VALUES (?, ?)');
386
+ db.transaction(() => {
387
+ deleteStmt.run(`${addonId}.`);
388
+ for (const [key, value] of Object.entries(config)) {
389
+ insertStmt.run(`${addonId}.${key}`, JSON.stringify({ addonId, key, value }));
390
+ }
391
+ })();
392
+ }
393
+ /** Get all settings for a provider */
394
+ getAllProvider(providerId) {
395
+ return this.getAllScoped("provider-settings", providerId);
396
+ }
397
+ /** Set a provider setting */
398
+ setProvider(providerId, key, value) {
399
+ this.setScopedKey("provider-settings", providerId, key, value);
400
+ }
401
+ /** Get all settings for a device */
402
+ getAllDevice(deviceId) {
403
+ return this.getAllScoped("device-settings", deviceId);
404
+ }
405
+ /** Set a device setting */
406
+ setDevice(deviceId, key, value) {
407
+ this.setScopedKey("device-settings", deviceId, key, value);
408
+ }
409
+ /** Seed system-settings with runtime defaults (first boot) */
410
+ async seedDefaults() {
411
+ this.ensureTable("system-settings");
412
+ const insert = this.getDb().prepare(
413
+ 'INSERT OR IGNORE INTO "system-settings" (id, data) VALUES (?, ?)'
414
+ );
415
+ this.getDb().transaction(() => {
416
+ for (const [key, value] of Object.entries(this.runtimeDefaults)) {
417
+ insert.run(key, JSON.stringify(value));
418
+ }
419
+ })();
420
+ }
421
+ // ---------------------------------------------------------------------------
422
+ // Private helpers
423
+ // ---------------------------------------------------------------------------
424
+ getDb() {
425
+ if (!this.db) throw new Error("SqliteSettingsBackend not initialized \u2014 call initialize() first");
426
+ return this.db;
427
+ }
428
+ ensureTable(collection) {
429
+ if (this.ensuredTables.has(collection)) return;
430
+ this.getDb().exec(
431
+ `CREATE TABLE IF NOT EXISTS "${collection}" (id TEXT PRIMARY KEY, data TEXT NOT NULL)`
432
+ );
433
+ this.ensuredTables.add(collection);
434
+ }
435
+ getAllScoped(collection, scopeId) {
436
+ this.ensureTable(collection);
437
+ const rows = this.getDb().prepare(`SELECT id, data FROM "${collection}" WHERE id LIKE ? || '.%'`).all(scopeId);
438
+ const result = {};
439
+ for (const row of rows) {
440
+ const key = row.id.slice(scopeId.length + 1);
441
+ const parsed = JSON.parse(row.data);
442
+ result[key] = parsed.value ?? parsed;
443
+ }
444
+ return result;
445
+ }
446
+ setScopedKey(collection, scopeId, key, value) {
447
+ this.ensureTable(collection);
448
+ this.getDb().prepare(`INSERT INTO "${collection}" (id, data) VALUES (?, ?) ON CONFLICT(id) DO UPDATE SET data = excluded.data`).run(`${scopeId}.${key}`, JSON.stringify({ scopeId, key, value }));
449
+ }
450
+ };
451
+
452
+ // src/builtins/sqlite-storage/sqlite-settings.addon.ts
453
+ var SqliteSettingsAddon = class {
454
+ manifest = {
455
+ id: "sqlite-settings",
456
+ name: "SQLite Settings",
457
+ version: "1.0.0",
458
+ capabilities: [{ name: "settings-store", mode: "singleton" }]
459
+ };
460
+ backend = null;
461
+ async initialize(context) {
462
+ const dbPath = context.storageProvider ? context.storageProvider.resolve("addons-data", `${context.id.replace("addon:", "")}/camstack.db`) : context.dataDir ? `${context.dataDir}/camstack.db` : "camstack-data/addons-data/sqlite-settings/camstack.db";
463
+ const runtimeDefaults = context.addonConfig._runtimeDefaults ?? {};
464
+ this.backend = new SqliteSettingsBackend(dbPath, runtimeDefaults);
465
+ await this.backend.initialize();
466
+ context.logger.info(`SQLite settings initialized at ${dbPath}`);
467
+ }
468
+ async shutdown() {
469
+ await this.backend?.shutdown();
470
+ }
471
+ getBackend() {
472
+ return this.backend;
473
+ }
474
+ getCapabilityProvider(name) {
475
+ if (name === "settings-store" && this.backend) {
476
+ return this.backend;
477
+ }
478
+ return null;
479
+ }
480
+ getConfigSchema() {
481
+ return { sections: [] };
482
+ }
483
+ getConfig() {
484
+ return {};
485
+ }
486
+ async onConfigChange(_config) {
487
+ }
488
+ };
489
+
490
+ // src/builtins/sqlite-storage/sqlite-storage.provider.ts
491
+ var import_better_sqlite32 = __toESM(require("better-sqlite3"));
492
+ var fs2 = __toESM(require("fs"));
493
+ var path2 = __toESM(require("path"));
494
+ var import_node_crypto2 = require("crypto");
495
+ var LOCATION_TYPES = {
496
+ // New location names (from StorageLocationManager)
497
+ data: "structured",
498
+ // settings, events, trails — SQL only
499
+ media: "files",
500
+ // crops, snapshots, thumbnails — files only
501
+ recordings: "files",
502
+ // video segments — files only
503
+ models: "files",
504
+ // ONNX/TFLite models — files only
505
+ cache: "files",
506
+ // temp files — files only
507
+ logs: "files",
508
+ // Winston log files — files only
509
+ // Legacy location names (backward compat)
510
+ config: "structured",
511
+ events: "structured",
512
+ addon: "both"
513
+ };
514
+ var SqliteStructuredStorage = class {
515
+ constructor(db) {
516
+ this.db = db;
517
+ }
518
+ ensuredTables = /* @__PURE__ */ new Set();
519
+ ensureTable(collection) {
520
+ if (this.ensuredTables.has(collection)) return;
521
+ this.db.exec(
522
+ `CREATE TABLE IF NOT EXISTS "${collection}" (id TEXT PRIMARY KEY, data TEXT)`
523
+ );
524
+ this.ensuredTables.add(collection);
525
+ }
526
+ async insert(record) {
527
+ this.ensureTable(record.collection);
528
+ const id = record.id || (0, import_node_crypto2.randomUUID)();
529
+ const newRecord = {
530
+ collection: record.collection,
531
+ id,
532
+ data: record.data
533
+ };
534
+ this.db.prepare(`INSERT INTO "${record.collection}" (id, data) VALUES (?, ?)`).run(id, JSON.stringify(newRecord.data));
535
+ return newRecord;
536
+ }
537
+ async query(collection, filter) {
538
+ this.ensureTable(collection);
539
+ const { sql, params } = this.buildSelect(collection, filter);
540
+ const rows = this.db.prepare(sql).all(...params);
541
+ return rows.map((row) => ({
542
+ collection,
543
+ id: row.id,
544
+ data: JSON.parse(row.data)
545
+ }));
546
+ }
547
+ async update(collection, id, data) {
548
+ this.ensureTable(collection);
549
+ this.db.prepare(`UPDATE "${collection}" SET data = ? WHERE id = ?`).run(JSON.stringify(data), id);
550
+ return { collection, id, data };
551
+ }
552
+ async delete(collection, id) {
553
+ this.ensureTable(collection);
554
+ this.db.prepare(`DELETE FROM "${collection}" WHERE id = ?`).run(id);
555
+ }
556
+ async count(collection, filter) {
557
+ this.ensureTable(collection);
558
+ const { sql, params } = this.buildCount(collection, filter);
559
+ const row = this.db.prepare(sql).get(...params);
560
+ return row.cnt;
561
+ }
562
+ buildWhereClause(filter) {
563
+ if (!filter) return { clause: "", params: [] };
564
+ const conditions = [];
565
+ const params = [];
566
+ if (filter.where) {
567
+ for (const [field, value] of Object.entries(filter.where)) {
568
+ if (field === "id") {
569
+ conditions.push("id = ?");
570
+ params.push(value);
571
+ } else {
572
+ conditions.push(`json_extract(data, '$.${field}') = ?`);
573
+ params.push(value);
574
+ }
575
+ }
576
+ }
577
+ if (filter.whereIn) {
578
+ for (const [field, values] of Object.entries(filter.whereIn)) {
579
+ const placeholders = values.map(() => "?").join(", ");
580
+ if (field === "id") {
581
+ conditions.push(`id IN (${placeholders})`);
582
+ } else {
583
+ conditions.push(`json_extract(data, '$.${field}') IN (${placeholders})`);
584
+ }
585
+ params.push(...values);
586
+ }
587
+ }
588
+ if (filter.whereBetween) {
589
+ for (const [field, [low, high]] of Object.entries(filter.whereBetween)) {
590
+ if (field === "id") {
591
+ conditions.push("id BETWEEN ? AND ?");
592
+ } else {
593
+ conditions.push(`json_extract(data, '$.${field}') BETWEEN ? AND ?`);
594
+ }
595
+ params.push(low, high);
596
+ }
597
+ }
598
+ const clause = conditions.length > 0 ? ` WHERE ${conditions.join(" AND ")}` : "";
599
+ return { clause, params };
600
+ }
601
+ buildSelect(collection, filter) {
602
+ const { clause, params } = this.buildWhereClause(filter);
603
+ let sql = `SELECT id, data FROM "${collection}"${clause}`;
604
+ if (filter?.orderBy) {
605
+ const dir = filter.orderBy.direction === "desc" ? "DESC" : "ASC";
606
+ if (filter.orderBy.field === "id") {
607
+ sql += ` ORDER BY id ${dir}`;
608
+ } else {
609
+ sql += ` ORDER BY json_extract(data, '$.${filter.orderBy.field}') ${dir}`;
610
+ }
611
+ }
612
+ if (filter?.limit !== void 0) {
613
+ sql += ` LIMIT ?`;
614
+ params.push(filter.limit);
615
+ }
616
+ if (filter?.offset !== void 0) {
617
+ sql += ` OFFSET ?`;
618
+ params.push(filter.offset);
619
+ }
620
+ return { sql, params };
621
+ }
622
+ buildCount(collection, filter) {
623
+ const { clause, params } = this.buildWhereClause(filter);
624
+ return { sql: `SELECT COUNT(*) as cnt FROM "${collection}"${clause}`, params };
625
+ }
626
+ };
627
+ var FileSystemStorage = class {
628
+ constructor(basePath) {
629
+ this.basePath = basePath;
630
+ }
631
+ async readFile(filePath) {
632
+ const fullPath = path2.join(this.basePath, filePath);
633
+ return fs2.promises.readFile(fullPath);
634
+ }
635
+ async writeFile(filePath, data) {
636
+ const fullPath = path2.join(this.basePath, filePath);
637
+ fs2.mkdirSync(path2.dirname(fullPath), { recursive: true });
638
+ await fs2.promises.writeFile(fullPath, data);
639
+ }
640
+ async deleteFile(filePath) {
641
+ const fullPath = path2.join(this.basePath, filePath);
642
+ await fs2.promises.unlink(fullPath);
643
+ }
644
+ async listFiles(prefix) {
645
+ const searchDir = prefix ? path2.join(this.basePath, prefix) : this.basePath;
646
+ try {
647
+ const entries = await fs2.promises.readdir(searchDir, { recursive: true });
648
+ const files = [];
649
+ for (const entry of entries) {
650
+ const entryStr = String(entry);
651
+ const relative = prefix ? path2.join(prefix, entryStr) : entryStr;
652
+ const fullPath = path2.join(this.basePath, relative);
653
+ try {
654
+ const stat = await fs2.promises.stat(fullPath);
655
+ if (stat.isFile()) {
656
+ files.push(relative);
657
+ }
658
+ } catch {
659
+ }
660
+ }
661
+ return files;
662
+ } catch {
663
+ return [];
664
+ }
665
+ }
666
+ async getFileUrl(_path) {
667
+ return null;
668
+ }
669
+ async exists(filePath) {
670
+ const fullPath = path2.join(this.basePath, filePath);
671
+ try {
672
+ await fs2.promises.access(fullPath, fs2.constants.F_OK);
673
+ return true;
674
+ } catch {
675
+ return false;
676
+ }
677
+ }
678
+ };
679
+ var SqliteStorageProvider = class {
680
+ mainDb = null;
681
+ sharedStructured = null;
682
+ locations = /* @__PURE__ */ new Map();
683
+ async initialize() {
684
+ }
685
+ /**
686
+ * Configure all storage locations.
687
+ * ONE single SQLite database (camstack.db) is used for ALL structured storage.
688
+ * File-based locations use the filesystem at their configured path.
689
+ */
690
+ async configure(config) {
691
+ const dataPath = config.locations["data"] ?? config.locations["config"] ?? Object.values(config.locations)[0];
692
+ if (!dataPath) throw new Error("No data path configured for SQLite storage");
693
+ fs2.mkdirSync(dataPath, { recursive: true });
694
+ const dbPath = path2.join(dataPath, "camstack.db");
695
+ this.mainDb = new import_better_sqlite32.default(dbPath);
696
+ this.mainDb.pragma("journal_mode = WAL");
697
+ this.sharedStructured = new SqliteStructuredStorage(this.mainDb);
698
+ for (const [name, dirPath] of Object.entries(config.locations)) {
699
+ const locationName = name;
700
+ const locationType = LOCATION_TYPES[name] ?? "files";
701
+ fs2.mkdirSync(dirPath, { recursive: true });
702
+ const location = {};
703
+ if (locationType === "structured" || locationType === "both") {
704
+ location.structured = this.sharedStructured;
705
+ }
706
+ if (locationType === "files" || locationType === "both") {
707
+ location.files = new FileSystemStorage(dirPath);
708
+ }
709
+ this.locations.set(locationName, location);
710
+ }
711
+ }
712
+ getLocation(name) {
713
+ const location = this.locations.get(name);
714
+ if (!location) {
715
+ throw new Error(`Storage location "${name}" not found`);
716
+ }
717
+ return location;
718
+ }
719
+ async shutdown() {
720
+ if (this.mainDb) {
721
+ this.mainDb.close();
722
+ this.mainDb = null;
723
+ this.sharedStructured = null;
724
+ }
725
+ this.locations.clear();
726
+ }
727
+ async export(_locationName) {
728
+ throw new Error("Export not yet implemented");
729
+ }
730
+ async import(_locationName, _data) {
731
+ throw new Error("Import not yet implemented");
732
+ }
733
+ };
734
+
735
+ // src/builtins/sqlite-storage/sqlite-storage.addon.ts
736
+ var SqliteStorageAddon = class {
737
+ manifest = {
738
+ id: "sqlite-storage",
739
+ name: "SQLite Storage",
740
+ version: "1.0.0",
741
+ capabilities: ["storage"]
742
+ };
743
+ provider = null;
744
+ async initialize(context) {
745
+ const storageConfig = {
746
+ locations: { ...context.locationPaths }
747
+ };
748
+ this.provider = new SqliteStorageProvider();
749
+ await this.provider.configure(storageConfig);
750
+ context.logger.info("SQLite storage initialized");
751
+ }
752
+ async shutdown() {
753
+ await this.provider?.shutdown();
754
+ }
755
+ getProvider() {
756
+ if (!this.provider) throw new Error("SQLite storage not initialized");
757
+ return this.provider;
758
+ }
759
+ getCapabilityProvider(name) {
760
+ if (name === "storage" && this.provider) {
761
+ return this.provider;
762
+ }
763
+ return null;
764
+ }
765
+ getConfigSchema() {
766
+ return {
767
+ sections: []
768
+ };
769
+ }
770
+ getConfig() {
771
+ return {};
772
+ }
773
+ async onConfigChange(_config) {
774
+ }
775
+ };
776
+
777
+ // src/builtins/sqlite-storage/settings-store.ts
778
+ var import_better_sqlite33 = __toESM(require("better-sqlite3"));
779
+
780
+ // src/builtins/sqlite-storage/sql-schema.ts
781
+ var CORE_TABLE_DDL = [
782
+ // Settings tables
783
+ `CREATE TABLE IF NOT EXISTS system_settings (
784
+ key TEXT PRIMARY KEY,
785
+ value JSON NOT NULL,
786
+ updated_at INTEGER NOT NULL DEFAULT (unixepoch())
787
+ )`,
788
+ `CREATE TABLE IF NOT EXISTS addon_settings (
789
+ addon_id TEXT NOT NULL,
790
+ key TEXT NOT NULL,
791
+ value JSON NOT NULL,
792
+ updated_at INTEGER NOT NULL DEFAULT (unixepoch()),
793
+ PRIMARY KEY (addon_id, key)
794
+ )`,
795
+ `CREATE TABLE IF NOT EXISTS provider_settings (
796
+ provider_id TEXT NOT NULL,
797
+ key TEXT NOT NULL,
798
+ value JSON NOT NULL,
799
+ updated_at INTEGER NOT NULL DEFAULT (unixepoch()),
800
+ PRIMARY KEY (provider_id, key)
801
+ )`,
802
+ `CREATE TABLE IF NOT EXISTS device_settings (
803
+ device_id TEXT NOT NULL,
804
+ key TEXT NOT NULL,
805
+ value JSON NOT NULL,
806
+ updated_at INTEGER NOT NULL DEFAULT (unixepoch()),
807
+ PRIMARY KEY (device_id, key)
808
+ )`,
809
+ // Detection events
810
+ `CREATE TABLE IF NOT EXISTS detection_events (
811
+ id TEXT PRIMARY KEY,
812
+ timestamp INTEGER NOT NULL,
813
+ device_id TEXT NOT NULL,
814
+ class_name TEXT NOT NULL,
815
+ score REAL NOT NULL,
816
+ severity TEXT NOT NULL,
817
+ track_id TEXT,
818
+ zones JSON,
819
+ recognition JSON,
820
+ media_files JSON,
821
+ data JSON
822
+ )`,
823
+ `CREATE INDEX IF NOT EXISTS idx_det_device_ts ON detection_events(device_id, timestamp)`,
824
+ `CREATE INDEX IF NOT EXISTS idx_det_class_ts ON detection_events(class_name, timestamp)`,
825
+ // Audio levels
826
+ `CREATE TABLE IF NOT EXISTS audio_levels (
827
+ id TEXT PRIMARY KEY,
828
+ timestamp INTEGER NOT NULL,
829
+ device_id TEXT NOT NULL,
830
+ dbfs REAL NOT NULL,
831
+ rms REAL NOT NULL,
832
+ state TEXT NOT NULL
833
+ )`,
834
+ `CREATE INDEX IF NOT EXISTS idx_audio_device_ts ON audio_levels(device_id, timestamp)`,
835
+ // Track trails
836
+ `CREATE TABLE IF NOT EXISTS track_trails (
837
+ track_id TEXT PRIMARY KEY,
838
+ device_id TEXT NOT NULL,
839
+ class_name TEXT NOT NULL,
840
+ first_seen INTEGER NOT NULL,
841
+ last_seen INTEGER NOT NULL,
842
+ positions JSON NOT NULL,
843
+ snapshots JSON,
844
+ total_distance REAL,
845
+ zones_visited JSON
846
+ )`,
847
+ `CREATE INDEX IF NOT EXISTS idx_trails_device_ts ON track_trails(device_id, first_seen)`
848
+ ];
849
+ function addonTableToDdl(schema) {
850
+ const pks = schema.columns.filter((c) => c.primaryKey).map((c) => c.name);
851
+ const colDefs = schema.columns.map((c) => {
852
+ const parts = [c.name, c.type];
853
+ if (c.notNull) parts.push("NOT NULL");
854
+ return parts.join(" ");
855
+ });
856
+ let ddl = `CREATE TABLE IF NOT EXISTS ${schema.name} (
857
+ ${colDefs.join(",\n ")}`;
858
+ if (pks.length > 0) {
859
+ ddl += `,
860
+ PRIMARY KEY (${pks.join(", ")})`;
861
+ }
862
+ ddl += "\n)";
863
+ const stmts = [ddl];
864
+ for (const idx of schema.indexes ?? []) {
865
+ const unique = idx.unique ? "UNIQUE " : "";
866
+ stmts.push(`CREATE ${unique}INDEX IF NOT EXISTS ${idx.name} ON ${schema.name}(${idx.columns.join(", ")})`);
867
+ }
868
+ return stmts;
869
+ }
870
+
871
+ // src/builtins/sqlite-storage/settings-store.ts
872
+ var import_kernel = require("@camstack/kernel");
873
+ var SettingsStore = class {
874
+ db;
875
+ constructor(dbPath) {
876
+ this.db = new import_better_sqlite33.default(dbPath);
877
+ this.db.pragma("journal_mode = WAL");
878
+ this.db.pragma("foreign_keys = ON");
879
+ this.initTables();
880
+ }
881
+ // ---------------------------------------------------------------------------
882
+ // System settings
883
+ // ---------------------------------------------------------------------------
884
+ getSystem(key) {
885
+ const row = this.db.prepare("SELECT value FROM system_settings WHERE key = ?").get(key);
886
+ if (row === void 0) return void 0;
887
+ return JSON.parse(row.value);
888
+ }
889
+ setSystem(key, value) {
890
+ this.db.prepare(
891
+ `INSERT INTO system_settings (key, value, updated_at) VALUES (?, json(?), unixepoch())
892
+ ON CONFLICT(key) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at`
893
+ ).run(key, JSON.stringify(value));
894
+ }
895
+ getAllSystem() {
896
+ const rows = this.db.prepare("SELECT key, value FROM system_settings").all();
897
+ return Object.fromEntries(rows.map((r) => [r.key, JSON.parse(r.value)]));
898
+ }
899
+ // ---------------------------------------------------------------------------
900
+ // Addon settings
901
+ // ---------------------------------------------------------------------------
902
+ getAddon(addonId, key) {
903
+ const row = this.db.prepare(
904
+ "SELECT value FROM addon_settings WHERE addon_id = ? AND key = ?"
905
+ ).get(addonId, key);
906
+ if (row === void 0) return void 0;
907
+ return JSON.parse(row.value);
908
+ }
909
+ setAddon(addonId, key, value) {
910
+ this.db.prepare(
911
+ `INSERT INTO addon_settings (addon_id, key, value, updated_at) VALUES (?, ?, json(?), unixepoch())
912
+ ON CONFLICT(addon_id, key) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at`
913
+ ).run(addonId, key, JSON.stringify(value));
914
+ }
915
+ getAllAddon(addonId) {
916
+ const rows = this.db.prepare(
917
+ "SELECT key, value FROM addon_settings WHERE addon_id = ?"
918
+ ).all(addonId);
919
+ return Object.fromEntries(rows.map((r) => [r.key, JSON.parse(r.value)]));
920
+ }
921
+ /** Bulk-replace all keys for an addon (within a transaction). */
922
+ setAllAddon(addonId, config) {
923
+ const deleteStmt = this.db.prepare("DELETE FROM addon_settings WHERE addon_id = ?");
924
+ const insertStmt = this.db.prepare(
925
+ `INSERT INTO addon_settings (addon_id, key, value, updated_at) VALUES (?, ?, json(?), unixepoch())`
926
+ );
927
+ this.db.transaction(() => {
928
+ deleteStmt.run(addonId);
929
+ for (const [key, value] of Object.entries(config)) {
930
+ insertStmt.run(addonId, key, JSON.stringify(value));
931
+ }
932
+ })();
933
+ }
934
+ // ---------------------------------------------------------------------------
935
+ // Provider settings
936
+ // ---------------------------------------------------------------------------
937
+ getProvider(providerId, key) {
938
+ const row = this.db.prepare(
939
+ "SELECT value FROM provider_settings WHERE provider_id = ? AND key = ?"
940
+ ).get(providerId, key);
941
+ if (row === void 0) return void 0;
942
+ return JSON.parse(row.value);
943
+ }
944
+ setProvider(providerId, key, value) {
945
+ this.db.prepare(
946
+ `INSERT INTO provider_settings (provider_id, key, value, updated_at) VALUES (?, ?, json(?), unixepoch())
947
+ ON CONFLICT(provider_id, key) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at`
948
+ ).run(providerId, key, JSON.stringify(value));
949
+ }
950
+ getAllProvider(providerId) {
951
+ const rows = this.db.prepare(
952
+ "SELECT key, value FROM provider_settings WHERE provider_id = ?"
953
+ ).all(providerId);
954
+ return Object.fromEntries(rows.map((r) => [r.key, JSON.parse(r.value)]));
955
+ }
956
+ // ---------------------------------------------------------------------------
957
+ // Device settings
958
+ // ---------------------------------------------------------------------------
959
+ getDevice(deviceId, key) {
960
+ const row = this.db.prepare(
961
+ "SELECT value FROM device_settings WHERE device_id = ? AND key = ?"
962
+ ).get(deviceId, key);
963
+ if (row === void 0) return void 0;
964
+ return JSON.parse(row.value);
965
+ }
966
+ setDevice(deviceId, key, value) {
967
+ this.db.prepare(
968
+ `INSERT INTO device_settings (device_id, key, value, updated_at) VALUES (?, ?, json(?), unixepoch())
969
+ ON CONFLICT(device_id, key) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at`
970
+ ).run(deviceId, key, JSON.stringify(value));
971
+ }
972
+ getAllDevice(deviceId) {
973
+ const rows = this.db.prepare(
974
+ "SELECT key, value FROM device_settings WHERE device_id = ?"
975
+ ).all(deviceId);
976
+ return Object.fromEntries(rows.map((r) => [r.key, JSON.parse(r.value)]));
977
+ }
978
+ // ---------------------------------------------------------------------------
979
+ // Lifecycle
980
+ // ---------------------------------------------------------------------------
981
+ /** Close the SQLite connection (call on shutdown). */
982
+ close() {
983
+ this.db.close();
984
+ }
985
+ /** Check if system_settings is empty (used for first-boot seeding). */
986
+ isSystemSettingsEmpty() {
987
+ const row = this.db.prepare("SELECT COUNT(*) AS cnt FROM system_settings").get();
988
+ return (row?.cnt ?? 0) === 0;
989
+ }
990
+ /** Seed system_settings with RUNTIME_DEFAULTS (only on first boot). */
991
+ seedDefaults() {
992
+ const insert = this.db.prepare(
993
+ `INSERT OR IGNORE INTO system_settings (key, value, updated_at) VALUES (?, json(?), unixepoch())`
994
+ );
995
+ this.db.transaction(() => {
996
+ for (const [key, value] of Object.entries(import_kernel.RUNTIME_DEFAULTS)) {
997
+ insert.run(key, JSON.stringify(value));
998
+ }
999
+ })();
1000
+ }
1001
+ // ---------------------------------------------------------------------------
1002
+ // Private helpers
1003
+ // ---------------------------------------------------------------------------
1004
+ initTables() {
1005
+ this.db.transaction(() => {
1006
+ for (const stmt of CORE_TABLE_DDL) {
1007
+ this.db.prepare(stmt).run();
1008
+ }
1009
+ })();
1010
+ }
1011
+ };
1012
+ // Annotate the CommonJS export names for ESM import in node:
1013
+ 0 && (module.exports = {
1014
+ CORE_TABLE_DDL,
1015
+ FileSystemStorage,
1016
+ FilesystemStorageAddon,
1017
+ FilesystemStorageProvider,
1018
+ SettingsStore,
1019
+ SqliteSettingsAddon,
1020
+ SqliteSettingsBackend,
1021
+ SqliteStorageAddon,
1022
+ SqliteStorageProvider,
1023
+ addonTableToDdl
1024
+ });
1025
+ //# sourceMappingURL=index.js.map