@camstack/system 1.2.422 → 1.2.424

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 (89) hide show
  1. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  2. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  3. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/alerts/alerts.addon.js +1 -1
  6. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  7. package/dist/builtins/autotrack/index.js +1 -1
  8. package/dist/builtins/autotrack/index.mjs +1 -1
  9. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  10. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  11. package/dist/builtins/calendars/calendars.addon.js +1 -1
  12. package/dist/builtins/calendars/calendars.addon.mjs +1 -1
  13. package/dist/builtins/camera-grid/index.js +1 -1
  14. package/dist/builtins/camera-grid/index.mjs +1 -1
  15. package/dist/builtins/composer/composer.addon.js +2 -2
  16. package/dist/builtins/composer/composer.addon.mjs +2 -2
  17. package/dist/builtins/console-logging/index.js +1 -1
  18. package/dist/builtins/console-logging/index.mjs +1 -1
  19. package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  20. package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  21. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  22. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  23. package/dist/builtins/hub-forwarder/index.js +1 -1
  24. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  25. package/dist/builtins/keychain/index.js +3 -3
  26. package/dist/builtins/keychain/index.mjs +3 -3
  27. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  28. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  29. package/dist/builtins/local-auth/local-auth.addon.js +2 -2
  30. package/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  31. package/dist/builtins/local-network/local-network.addon.js +1 -1
  32. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  33. package/dist/builtins/loki-logging/index.js +1 -1
  34. package/dist/builtins/loki-logging/index.mjs +1 -1
  35. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  36. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  37. package/dist/builtins/platform-probe/index.js +1 -1
  38. package/dist/builtins/platform-probe/index.mjs +1 -1
  39. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  40. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  41. package/dist/builtins/snapshot/index.js +1 -1
  42. package/dist/builtins/snapshot/index.mjs +1 -1
  43. package/dist/builtins/sqlite-storage/file-host-client.d.ts +59 -0
  44. package/dist/builtins/sqlite-storage/file-host-handlers.d.ts +23 -0
  45. package/dist/builtins/sqlite-storage/file-host-protocol.d.ts +151 -0
  46. package/dist/builtins/sqlite-storage/file-host-worker.d.ts +1 -0
  47. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  48. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  49. package/dist/builtins/sqlite-storage/index.js +21 -20
  50. package/dist/builtins/sqlite-storage/index.mjs +2 -1
  51. package/dist/builtins/sqlite-storage/owned-sqlite-file.d.ts +136 -0
  52. package/dist/builtins/sqlite-storage/placement-errors.d.ts +60 -0
  53. package/dist/builtins/sqlite-storage/placement-router.d.ts +80 -0
  54. package/dist/builtins/sqlite-storage/retired-collections.d.ts +7 -0
  55. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +68 -8
  56. package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +23 -26
  57. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
  58. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
  59. package/dist/builtins/sqlite-storage/vector-provider.d.ts +24 -0
  60. package/dist/builtins/sqlite-storage/wal-maintenance.d.ts +17 -0
  61. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +3 -1
  62. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +3 -1
  63. package/dist/builtins/system-config/system-config.addon.js +2 -2
  64. package/dist/builtins/system-config/system-config.addon.mjs +2 -2
  65. package/dist/builtins/winston-logging/index.js +1 -1
  66. package/dist/builtins/winston-logging/index.mjs +1 -1
  67. package/dist/{composition-sources-BstNkBVe.js → composition-sources-BWNs-ZeH.js} +1 -1
  68. package/dist/{composition-sources-f_VjTBgs.mjs → composition-sources-tRG7nKWK.mjs} +1 -1
  69. package/dist/{constants-CY4vXTV-.js → constants-BBWZlnpQ.js} +1 -1
  70. package/dist/{constants-iLQM7god.mjs → constants-DHhhVjkt.mjs} +1 -1
  71. package/dist/{dist-CHsJCqrf.mjs → dist-B-NmfvVC.mjs} +97 -14
  72. package/dist/{dist-FSNJUw7p.js → dist-CiUKtVkX.js} +102 -13
  73. package/dist/file-host-worker.js +144 -0
  74. package/dist/file-host-worker.mjs +144 -0
  75. package/dist/index.js +9 -8
  76. package/dist/index.mjs +6 -5
  77. package/dist/{jwt-signing-key-DUVvfILp.mjs → jwt-signing-key-CUpweD22.mjs} +1 -1
  78. package/dist/{jwt-signing-key-CPha_bf7.js → jwt-signing-key-nwRpRgf_.js} +1 -1
  79. package/dist/{restore-archive-J_BsGRBy.mjs → restore-archive-CFmPVlWQ.mjs} +1 -1
  80. package/dist/{restore-archive-BwGWspP1.js → restore-archive-DA-aJtg7.js} +1 -1
  81. package/dist/{retired-settings-keys-BuQBYfu0.js → retired-settings-keys-D62kN_hT.js} +1 -1
  82. package/dist/{retired-settings-keys-3SMjMqj0.mjs → retired-settings-keys-DCGEI4Vi.mjs} +1 -1
  83. package/dist/sqlite-snapshot-worker.js +1 -1
  84. package/dist/sqlite-snapshot-worker.mjs +1 -1
  85. package/dist/wal-checkpoint-worker.js +1 -1
  86. package/dist/wal-checkpoint-worker.mjs +1 -1
  87. package/dist/wal-maintenance-BlqNqaQ3.mjs +0 -0
  88. package/dist/wal-maintenance-BzdCQGjH.js +0 -0
  89. package/package.json +1 -1
@@ -15133,8 +15133,23 @@ var BulkRecordSchema = zod.z.object({
15133
15133
  data: zod.z.record(zod.z.string(), zod.z.unknown())
15134
15134
  });
15135
15135
  /**
15136
+ * The database FILES one `sqlite-settings` engine process owns (D851).
15137
+ * Closed on purpose: a file is a thing the engine opens, backs up and gives a
15138
+ * serving thread, so a new one is a code change, never a string a caller
15139
+ * invents. `settings` is `camstack.db` and the default for every collection
15140
+ * that names no file.
15141
+ */
15142
+ var DataStoreDatabaseSchema = zod.z.enum([
15143
+ "settings",
15144
+ "events",
15145
+ "history"
15146
+ ]);
15147
+ /** Every database file, in a stable order (settings first). */
15148
+ var DATA_STORE_DATABASES = DataStoreDatabaseSchema.options;
15149
+ /**
15136
15150
  * One write inside a {@link settingsStoreCapability.methods.transact} call.
15137
- * Only the three that a "replace this set, bump that revision" write needs.
15151
+ * The three that a "replace this set, bump that revision" write needs, plus
15152
+ * the batched upsert a rollup writer needs.
15138
15153
  */
15139
15154
  var TransactOpSchema = zod.z.discriminatedUnion("op", [
15140
15155
  zod.z.object({
@@ -15152,6 +15167,12 @@ var TransactOpSchema = zod.z.discriminatedUnion("op", [
15152
15167
  collection: zod.z.string(),
15153
15168
  id: zod.z.string(),
15154
15169
  data: zod.z.record(zod.z.string(), zod.z.unknown())
15170
+ }),
15171
+ zod.z.object({
15172
+ op: zod.z.literal("upsertMany"),
15173
+ collection: zod.z.string(),
15174
+ conflict: zod.z.array(zod.z.string()).readonly(),
15175
+ records: zod.z.array(BulkRecordSchema).readonly()
15155
15176
  })
15156
15177
  ]);
15157
15178
  /**
@@ -15203,6 +15224,30 @@ var CollectionIndexSchema = zod.z.object({
15203
15224
  unique: zod.z.boolean().optional()
15204
15225
  });
15205
15226
  /**
15227
+ * The input of `declareCollection` — ONE schema for the door and for the
15228
+ * engine behind it, so the two surfaces cannot drift (the dispatcher forwards
15229
+ * the payload untouched).
15230
+ *
15231
+ * - `database` — the file the collection lives in (D851). Absent means
15232
+ * `settings`. A declaration naming a file other than the one the table is
15233
+ * already in is REFUSED by the engine, never moved.
15234
+ * - `primaryKey` — a COMPOSITE key, as column names. A single name is the same
15235
+ * as `primaryKey: true` on that column. A composite-keyed collection has no
15236
+ * `id`: it is written with `insertMany` / `upsertMany` / `transact` and read
15237
+ * with `query` / `count` / `aggregate` / `deleteWhere`; the calls that
15238
+ * address one row by id are refused.
15239
+ * - `withoutRowid` — emit `WITHOUT ROWID`. Requires a primary key.
15240
+ */
15241
+ var DeclareCollectionInputSchema = zod.z.object({
15242
+ namespace: zod.z.string().optional(),
15243
+ collection: zod.z.string(),
15244
+ columns: zod.z.array(CollectionColumnSchema).readonly(),
15245
+ indexes: zod.z.array(CollectionIndexSchema).readonly().optional(),
15246
+ database: DataStoreDatabaseSchema.optional(),
15247
+ primaryKey: zod.z.array(zod.z.string()).readonly().optional(),
15248
+ withoutRowid: zod.z.boolean().optional()
15249
+ });
15250
+ /**
15206
15251
  * settings-store — singleton capability for addon-scoped persistence.
15207
15252
  *
15208
15253
  * Every method operates within a `collection`. An optional `namespace`
@@ -15340,6 +15385,29 @@ id: zod.z.union([zod.z.string(), zod.z.number()]) }), {
15340
15385
  kind: "mutation",
15341
15386
  auth: "admin"
15342
15387
  }),
15388
+ /**
15389
+ * {@link upsert} for a BATCH, in ONE transaction on ONE prepared statement.
15390
+ *
15391
+ * The write-side twin of {@link insertMany} for rows that may already
15392
+ * exist: a rollup writer recomputes a bucket and must overwrite it, and
15393
+ * N round trips with N COMMITs is the cost {@link insertMany} was added to
15394
+ * avoid. `conflict` has the meaning it has on {@link upsert} (declared
15395
+ * columns covered by a UNIQUE index or the primary key, never empty).
15396
+ *
15397
+ * Every record of a batch must carry the SAME set of declared columns and
15398
+ * every `conflict` column: one batch is one statement shape, and a record
15399
+ * that silently bound NULL over a column it did not mention would erase
15400
+ * it. A heterogeneous batch is refused whole. **All or nothing.**
15401
+ */
15402
+ upsertMany: method(zod.z.object({
15403
+ namespace: zod.z.string().optional(),
15404
+ collection: zod.z.string(),
15405
+ conflict: zod.z.array(zod.z.string()).readonly(),
15406
+ records: zod.z.array(BulkRecordSchema).readonly()
15407
+ }), zod.z.object({ upserted: zod.z.number().int() }), {
15408
+ kind: "mutation",
15409
+ auth: "admin"
15410
+ }),
15343
15411
  /** Insert a new record. */
15344
15412
  insert: method(zod.z.object({
15345
15413
  namespace: zod.z.string().optional(),
@@ -15538,12 +15606,7 @@ id: zod.z.union([zod.z.string(), zod.z.number()]) }), {
15538
15606
  * `pipeline-analytics:object-events`) to avoid cross-addon
15539
15607
  * clashes — no automatic prefix is added.
15540
15608
  */
15541
- declareCollection: method(zod.z.object({
15542
- namespace: zod.z.string().optional(),
15543
- collection: zod.z.string(),
15544
- columns: zod.z.array(CollectionColumnSchema).readonly(),
15545
- indexes: zod.z.array(CollectionIndexSchema).readonly().optional()
15546
- }), zod.z.void(), {
15609
+ declareCollection: method(DeclareCollectionInputSchema, zod.z.void(), {
15547
15610
  kind: "mutation",
15548
15611
  auth: "admin"
15549
15612
  })
@@ -15694,6 +15757,16 @@ id: zod.z.union([zod.z.string(), zod.z.number()]) }), {
15694
15757
  kind: "mutation",
15695
15758
  auth: "admin"
15696
15759
  }),
15760
+ /** Upsert many records in ONE transaction; see the door's `upsertMany`. */
15761
+ upsertMany: method(zod.z.object({
15762
+ namespace: zod.z.string().optional(),
15763
+ collection: zod.z.string(),
15764
+ conflict: zod.z.array(zod.z.string()).readonly(),
15765
+ records: zod.z.array(BulkRecordSchema).readonly()
15766
+ }), zod.z.object({ upserted: zod.z.number().int() }), {
15767
+ kind: "mutation",
15768
+ auth: "admin"
15769
+ }),
15697
15770
  /** Insert many records in ONE transaction. All or nothing. */
15698
15771
  insertMany: method(zod.z.object({
15699
15772
  namespace: zod.z.string().optional(),
@@ -15786,12 +15859,7 @@ id: zod.z.union([zod.z.string(), zod.z.number()]) }), {
15786
15859
  collection: zod.z.string()
15787
15860
  }), zod.z.boolean(), { auth: "admin" }),
15788
15861
  /** Declare a typed (SQL-backed) collection with columns + indexes. */
15789
- declareCollection: method(zod.z.object({
15790
- namespace: zod.z.string().optional(),
15791
- collection: zod.z.string(),
15792
- columns: zod.z.array(CollectionColumnSchema).readonly(),
15793
- indexes: zod.z.array(CollectionIndexSchema).readonly().optional()
15794
- }), zod.z.void(), {
15862
+ declareCollection: method(DeclareCollectionInputSchema, zod.z.void(), {
15795
15863
  kind: "mutation",
15796
15864
  auth: "admin"
15797
15865
  })
@@ -26434,6 +26502,9 @@ var RetrainBoxReviewSchema = zod.z.object({
26434
26502
  /** The baseline was re-derived, not snapshotted (a pre-origin row). */
26435
26503
  approximate: zod.z.boolean(),
26436
26504
  origin: RetrainOriginSchema.optional(),
26505
+ /** The class / label the box carries NOW (a removed box: its origin's). Absent on an older hub. */
26506
+ macroClass: RetrainMacroClassSchema.optional(),
26507
+ label: zod.z.string().optional(),
26437
26508
  iou: zod.z.number().optional()
26438
26509
  });
26439
26510
  var RetrainFrameReviewSchema = zod.z.object({
@@ -53095,6 +53166,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
53095
53166
  addonId: null,
53096
53167
  access: "create"
53097
53168
  },
53169
+ "dataStoreProvider.upsertMany": {
53170
+ capName: "data-store-provider",
53171
+ capScope: "system",
53172
+ addonId: null,
53173
+ access: "create"
53174
+ },
53098
53175
  "dayNight.getOptions": {
53099
53176
  capName: "day-night",
53100
53177
  capScope: "device",
@@ -57943,6 +58020,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
57943
58020
  addonId: null,
57944
58021
  access: "create"
57945
58022
  },
58023
+ "settingsStore.upsertMany": {
58024
+ capName: "settings-store",
58025
+ capScope: "system",
58026
+ addonId: null,
58027
+ access: "create"
58028
+ },
57946
58029
  "smoke.getStatus": {
57947
58030
  capName: "smoke",
57948
58031
  capScope: "device",
@@ -65565,6 +65648,12 @@ Object.defineProperty(exports, "DATAPLANE_SECRET_HEADER", {
65565
65648
  return DATAPLANE_SECRET_HEADER;
65566
65649
  }
65567
65650
  });
65651
+ Object.defineProperty(exports, "DATA_STORE_DATABASES", {
65652
+ enumerable: true,
65653
+ get: function() {
65654
+ return DATA_STORE_DATABASES;
65655
+ }
65656
+ });
65568
65657
  Object.defineProperty(exports, "DAY_NAMES", {
65569
65658
  enumerable: true,
65570
65659
  get: function() {
@@ -0,0 +1,144 @@
1
+ require("./chunk-Cek0wNdY.js");
2
+ const require_wal_maintenance = require("./wal-maintenance-BzdCQGjH.js");
3
+ let node_worker_threads = require("node:worker_threads");
4
+ //#region src/builtins/sqlite-storage/file-host-worker.ts
5
+ /**
6
+ * The thread that serves ONE database file of the engine (D851): its own
7
+ * `better-sqlite3` connection hosting the same {@link SqliteSettingsBackend}
8
+ * class `camstack.db` runs on the main thread, plus — for `events` — the
9
+ * sqlite-vec index over that connection.
10
+ *
11
+ * A worker entry is a separate bundle (`dist/file-host-worker.js`, wired in
12
+ * `vite.config.ts` next to the checkpoint and snapshot workers). It imports no
13
+ * kernel code: the backend, the protocol and `@camstack/types`, nothing else.
14
+ *
15
+ * What it does NOT own: the WAL checkpoint, the `-shm` canary and the snapshot
16
+ * of this file run in their own threads, started by the main thread's
17
+ * `OwnedSqliteFile` exactly as for `camstack.db`. What it DOES own and the main
18
+ * thread cannot reach: the connection itself — so the statement profiler and
19
+ * the idle-gated `wal_checkpoint(TRUNCATE)` / `incremental_vacuum` live here.
20
+ *
21
+ * Logging: this thread has no logger of its own. Every line is posted to the
22
+ * main thread, which writes it through the runner's `Db/<databaseId>` logger
23
+ * with `tags: { database }`.
24
+ */
25
+ /** Pages handed back per idle tick on a file in incremental auto-vacuum mode. */
26
+ var INCREMENTAL_VACUUM_PAGES = 256;
27
+ /** A logger whose every line is a message to the main thread. */
28
+ function forwardingLogger(post, scope, bound) {
29
+ const send = (level) => (message, extras) => {
30
+ post({
31
+ kind: "log",
32
+ level,
33
+ message,
34
+ scope,
35
+ tags: {
36
+ ...bound,
37
+ ...extras?.tags
38
+ },
39
+ ...extras?.meta !== void 0 ? { meta: extras.meta } : {}
40
+ });
41
+ };
42
+ return {
43
+ debug: send("debug"),
44
+ info: send("info"),
45
+ warn: send("warn"),
46
+ error: send("error"),
47
+ child: (childScope) => forwardingLogger(post, childScope, bound),
48
+ withTags: (tags) => forwardingLogger(post, scope, {
49
+ ...bound,
50
+ ...tags
51
+ })
52
+ };
53
+ }
54
+ async function main() {
55
+ const port = node_worker_threads.parentPort;
56
+ if (port === null) throw new Error("file-host-worker: no parent port");
57
+ if (!require_wal_maintenance.isFileHostWorkerData(node_worker_threads.workerData)) throw new Error("file-host-worker: bad workerData");
58
+ const spec = node_worker_threads.workerData.spec;
59
+ const post = (message, transfer = []) => port.postMessage(message, [...transfer]);
60
+ const logger = forwardingLogger(post, "", { database: spec.databaseId });
61
+ let backend;
62
+ let vectorIndex = null;
63
+ let maintenance = null;
64
+ try {
65
+ backend = new require_wal_maintenance.SqliteSettingsBackend(spec.livePath, {}, logger.child("Query"), {
66
+ databaseId: spec.databaseId,
67
+ autoVacuum: spec.autoVacuum,
68
+ canonicalKv: false
69
+ });
70
+ await backend.initialize();
71
+ if (spec.loadVectorExtension) {
72
+ vectorIndex = require_wal_maintenance.createVectorIndex(backend, logger.child("VectorIndex"));
73
+ await vectorIndex.loadIndexRegistry();
74
+ }
75
+ const db = backend.getDatabase();
76
+ if (db !== null) {
77
+ maintenance = new require_wal_maintenance.WalMaintenance({
78
+ db,
79
+ dbPath: spec.livePath,
80
+ logger: logger.child("WalMaintenance"),
81
+ incrementalVacuumPages: INCREMENTAL_VACUUM_PAGES
82
+ });
83
+ maintenance.start();
84
+ }
85
+ } catch (err) {
86
+ post({
87
+ kind: "boot-failed",
88
+ error: require_wal_maintenance.serializeError(err)
89
+ });
90
+ return;
91
+ }
92
+ const dataTarget = backend;
93
+ const vectorTarget = vectorIndex === null ? null : require_wal_maintenance.vectorProviderOf(vectorIndex);
94
+ const control = require_wal_maintenance.controlTargetOf(backend, node_worker_threads.threadId);
95
+ const answer = (id, result, transfer = false) => post({
96
+ kind: "result",
97
+ id,
98
+ ok: true,
99
+ result
100
+ }, transfer ? require_wal_maintenance.collectTransferables(result) : []);
101
+ const refuse = (id, err) => {
102
+ post({
103
+ kind: "result",
104
+ id,
105
+ ok: false,
106
+ error: require_wal_maintenance.serializeError(err)
107
+ });
108
+ };
109
+ const serve = async (request) => {
110
+ try {
111
+ if (request.kind === "stop") {
112
+ maintenance?.stop();
113
+ await backend.shutdown();
114
+ answer(request.id, void 0);
115
+ port.close();
116
+ return;
117
+ }
118
+ if (request.kind === "data") {
119
+ answer(request.id, await require_wal_maintenance.callData(dataTarget, request.op, require_wal_maintenance.trustInput(request.input)));
120
+ return;
121
+ }
122
+ if (request.kind === "vector") {
123
+ if (vectorTarget === null) throw new Error(`database "${spec.databaseId}" does not serve vector calls`);
124
+ answer(request.id, await require_wal_maintenance.callVector(vectorTarget, request.op, require_wal_maintenance.trustInput(request.input)), true);
125
+ return;
126
+ }
127
+ answer(request.id, require_wal_maintenance.callControl(control, request.op, require_wal_maintenance.trustInput(request.input)));
128
+ } catch (err) {
129
+ refuse(request.id, err);
130
+ }
131
+ };
132
+ port.on("message", (message) => {
133
+ if (!require_wal_maintenance.isFileHostRequest(message)) return;
134
+ serve(message);
135
+ });
136
+ post({
137
+ kind: "ready",
138
+ declared: [...backend.declaredCollectionNames()]
139
+ });
140
+ }
141
+ main().catch((err) => {
142
+ throw err;
143
+ });
144
+ //#endregion
@@ -0,0 +1,144 @@
1
+ import { C as callControl, E as controlTargetOf, T as callVector, _ as collectTransferables, a as WalMaintenance, b as isFileHostWorkerData, c as SqliteSettingsBackend, h as serializeError, o as createVectorIndex, s as vectorProviderOf, w as callData, x as trustInput, y as isFileHostRequest } from "./wal-maintenance-BlqNqaQ3.mjs";
2
+ import { parentPort, threadId, workerData } from "node:worker_threads";
3
+ //#region src/builtins/sqlite-storage/file-host-worker.ts
4
+ /**
5
+ * The thread that serves ONE database file of the engine (D851): its own
6
+ * `better-sqlite3` connection hosting the same {@link SqliteSettingsBackend}
7
+ * class `camstack.db` runs on the main thread, plus — for `events` — the
8
+ * sqlite-vec index over that connection.
9
+ *
10
+ * A worker entry is a separate bundle (`dist/file-host-worker.js`, wired in
11
+ * `vite.config.ts` next to the checkpoint and snapshot workers). It imports no
12
+ * kernel code: the backend, the protocol and `@camstack/types`, nothing else.
13
+ *
14
+ * What it does NOT own: the WAL checkpoint, the `-shm` canary and the snapshot
15
+ * of this file run in their own threads, started by the main thread's
16
+ * `OwnedSqliteFile` exactly as for `camstack.db`. What it DOES own and the main
17
+ * thread cannot reach: the connection itself — so the statement profiler and
18
+ * the idle-gated `wal_checkpoint(TRUNCATE)` / `incremental_vacuum` live here.
19
+ *
20
+ * Logging: this thread has no logger of its own. Every line is posted to the
21
+ * main thread, which writes it through the runner's `Db/<databaseId>` logger
22
+ * with `tags: { database }`.
23
+ */
24
+ /** Pages handed back per idle tick on a file in incremental auto-vacuum mode. */
25
+ var INCREMENTAL_VACUUM_PAGES = 256;
26
+ /** A logger whose every line is a message to the main thread. */
27
+ function forwardingLogger(post, scope, bound) {
28
+ const send = (level) => (message, extras) => {
29
+ post({
30
+ kind: "log",
31
+ level,
32
+ message,
33
+ scope,
34
+ tags: {
35
+ ...bound,
36
+ ...extras?.tags
37
+ },
38
+ ...extras?.meta !== void 0 ? { meta: extras.meta } : {}
39
+ });
40
+ };
41
+ return {
42
+ debug: send("debug"),
43
+ info: send("info"),
44
+ warn: send("warn"),
45
+ error: send("error"),
46
+ child: (childScope) => forwardingLogger(post, childScope, bound),
47
+ withTags: (tags) => forwardingLogger(post, scope, {
48
+ ...bound,
49
+ ...tags
50
+ })
51
+ };
52
+ }
53
+ async function main() {
54
+ const port = parentPort;
55
+ if (port === null) throw new Error("file-host-worker: no parent port");
56
+ if (!isFileHostWorkerData(workerData)) throw new Error("file-host-worker: bad workerData");
57
+ const spec = workerData.spec;
58
+ const post = (message, transfer = []) => port.postMessage(message, [...transfer]);
59
+ const logger = forwardingLogger(post, "", { database: spec.databaseId });
60
+ let backend;
61
+ let vectorIndex = null;
62
+ let maintenance = null;
63
+ try {
64
+ backend = new SqliteSettingsBackend(spec.livePath, {}, logger.child("Query"), {
65
+ databaseId: spec.databaseId,
66
+ autoVacuum: spec.autoVacuum,
67
+ canonicalKv: false
68
+ });
69
+ await backend.initialize();
70
+ if (spec.loadVectorExtension) {
71
+ vectorIndex = createVectorIndex(backend, logger.child("VectorIndex"));
72
+ await vectorIndex.loadIndexRegistry();
73
+ }
74
+ const db = backend.getDatabase();
75
+ if (db !== null) {
76
+ maintenance = new WalMaintenance({
77
+ db,
78
+ dbPath: spec.livePath,
79
+ logger: logger.child("WalMaintenance"),
80
+ incrementalVacuumPages: INCREMENTAL_VACUUM_PAGES
81
+ });
82
+ maintenance.start();
83
+ }
84
+ } catch (err) {
85
+ post({
86
+ kind: "boot-failed",
87
+ error: serializeError(err)
88
+ });
89
+ return;
90
+ }
91
+ const dataTarget = backend;
92
+ const vectorTarget = vectorIndex === null ? null : vectorProviderOf(vectorIndex);
93
+ const control = controlTargetOf(backend, threadId);
94
+ const answer = (id, result, transfer = false) => post({
95
+ kind: "result",
96
+ id,
97
+ ok: true,
98
+ result
99
+ }, transfer ? collectTransferables(result) : []);
100
+ const refuse = (id, err) => {
101
+ post({
102
+ kind: "result",
103
+ id,
104
+ ok: false,
105
+ error: serializeError(err)
106
+ });
107
+ };
108
+ const serve = async (request) => {
109
+ try {
110
+ if (request.kind === "stop") {
111
+ maintenance?.stop();
112
+ await backend.shutdown();
113
+ answer(request.id, void 0);
114
+ port.close();
115
+ return;
116
+ }
117
+ if (request.kind === "data") {
118
+ answer(request.id, await callData(dataTarget, request.op, trustInput(request.input)));
119
+ return;
120
+ }
121
+ if (request.kind === "vector") {
122
+ if (vectorTarget === null) throw new Error(`database "${spec.databaseId}" does not serve vector calls`);
123
+ answer(request.id, await callVector(vectorTarget, request.op, trustInput(request.input)), true);
124
+ return;
125
+ }
126
+ answer(request.id, callControl(control, request.op, trustInput(request.input)));
127
+ } catch (err) {
128
+ refuse(request.id, err);
129
+ }
130
+ };
131
+ port.on("message", (message) => {
132
+ if (!isFileHostRequest(message)) return;
133
+ serve(message);
134
+ });
135
+ post({
136
+ kind: "ready",
137
+ declared: [...backend.declaredCollectionNames()]
138
+ });
139
+ }
140
+ main().catch((err) => {
141
+ throw err;
142
+ });
143
+ //#endregion
144
+ export {};
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-Cek0wNdY.js");
3
- const require_dist = require("./dist-FSNJUw7p.js");
4
- const require_jwt_signing_key = require("./jwt-signing-key-CPha_bf7.js");
3
+ const require_dist = require("./dist-CiUKtVkX.js");
4
+ const require_jwt_signing_key = require("./jwt-signing-key-nwRpRgf_.js");
5
5
  const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
6
6
  require("./builtins/alerts/index.js");
7
7
  const require_builtins_calendars_calendars_addon = require("./builtins/calendars/calendars.addon.js");
@@ -22,11 +22,12 @@ require("./builtins/local-auth/index.js");
22
22
  const require_builtins_loki_logging_index = require("./builtins/loki-logging/index.js");
23
23
  const require_builtins_native_metrics_native_metrics_addon = require("./builtins/native-metrics/native-metrics.addon.js");
24
24
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./builtins/sqlite-storage/filesystem-storage.addon.js");
25
+ const require_wal_maintenance = require("./wal-maintenance-BzdCQGjH.js");
25
26
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./builtins/sqlite-storage/sqlite-settings.addon.js");
26
27
  const require_builtins_sqlite_storage_index = require("./builtins/sqlite-storage/index.js");
27
28
  const require_builtins_storage_orchestrator_storage_orchestrator_addon = require("./builtins/storage-orchestrator/storage-orchestrator.addon.js");
28
29
  require("./builtins/storage-orchestrator/index.js");
29
- const require_constants = require("./constants-CY4vXTV-.js");
30
+ const require_constants = require("./constants-BBWZlnpQ.js");
30
31
  const require_builtins_system_config_system_config_addon = require("./builtins/system-config/system-config.addon.js");
31
32
  require("./builtins/system-config/index.js");
32
33
  const require_builtins_winston_logging_index = require("./builtins/winston-logging/index.js");
@@ -34,7 +35,7 @@ const require_custom_action_registry = require("./custom-action-registry-Bf_Ynag
34
35
  const require_tls = require("./tls-BgImdxCO.js");
35
36
  const require_platform_key_source = require("./platform-key-source-Di7HrlGR.js");
36
37
  const require_resource_monitor = require("./resource-monitor-mio9dSCT.js");
37
- const require_restore_archive = require("./restore-archive-BwGWspP1.js");
38
+ const require_restore_archive = require("./restore-archive-DA-aJtg7.js");
38
39
  let zod = require("zod");
39
40
  let node_crypto = require("node:crypto");
40
41
  node_crypto = require_chunk.__toESM(node_crypto);
@@ -11472,7 +11473,7 @@ var PREFIX_PAGE_BUDGET = 512;
11472
11473
  * be handed something that looks like a complete answer.
11473
11474
  */
11474
11475
  async function loadPrefixed(door, collection, prefix, decode = unwrapValue) {
11475
- const range = require_builtins_sqlite_storage_sqlite_settings_addon.prefixRange(prefix);
11476
+ const range = require_wal_maintenance.prefixRange(prefix);
11476
11477
  const result = {};
11477
11478
  let cursor = range?.lo ?? null;
11478
11479
  for (let page = 0;; page++) {
@@ -11528,7 +11529,7 @@ async function loadSystemSettingsPrefix(door, prefix, mayRead = () => true) {
11528
11529
  return result;
11529
11530
  }
11530
11531
  async function replacePrefixed(door, collection, prefix, values, wrap) {
11531
- const range = require_builtins_sqlite_storage_sqlite_settings_addon.prefixRange(prefix);
11532
+ const range = require_wal_maintenance.prefixRange(prefix);
11532
11533
  if (range !== null) await door.deleteWhere({
11533
11534
  collection,
11534
11535
  filter: { whereBetween: { id: [range.lo, range.hi] } }
@@ -11609,7 +11610,7 @@ function createDoorSettingsView(addonId, door, sections) {
11609
11610
  }));
11610
11611
  },
11611
11612
  async clearDeviceStore(deviceId) {
11612
- const range = require_builtins_sqlite_storage_sqlite_settings_addon.prefixRange(`${addonId}:${String(deviceId)}.`);
11613
+ const range = require_wal_maintenance.prefixRange(`${addonId}:${String(deviceId)}.`);
11613
11614
  if (range === null) return;
11614
11615
  await door.deleteWhere({
11615
11616
  collection: "addon-device-settings",
@@ -27002,7 +27003,7 @@ exports.ScopedTokenManager = require_builtins_local_auth_local_auth_addon.Scoped
27002
27003
  exports.SettingsReadUnavailableError = require_builtins_local_auth_local_auth_addon.SettingsReadUnavailableError;
27003
27004
  exports.SocketChannel = SocketChannel;
27004
27005
  exports.SqliteSettingsAddon = require_builtins_sqlite_storage_sqlite_settings_addon.SqliteSettingsAddon;
27005
- exports.SqliteSettingsBackend = require_builtins_sqlite_storage_sqlite_settings_addon.SqliteSettingsBackend;
27006
+ exports.SqliteSettingsBackend = require_wal_maintenance.SqliteSettingsBackend;
27006
27007
  exports.StagingArea = StagingArea;
27007
27008
  exports.StorageLocationManager = StorageLocationManager;
27008
27009
  exports.StorageManager = StorageManager;
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { i as __require } from "./chunk-CNf5ZN-e.mjs";
2
- import { At as extractNestedAddonId, Bt as isObjectInput, Cn as resolveMethodAuth, Dn as scopesAllowDeviceCap, Dr as emitDownForOwnedCaps, En as scopesAllowAddon, G as addonSettingsCapability, Gr as resolveCapMount, Hr as parseJsonUnknown, Ht as kebabToCamel$1, It as isArrayOutputSchema, Lt as isCollectionArrayMethod, O as LOG_LEVEL_RANK, Qt as looseSchema, Rn as supportedRuntimes, Vr as parseJsonObject, Vt as isVoidInput, Wr as readinessKey, Zt as logLevelAtMost, br as asString$1, cn as objectInputDeclaresRequiredDeviceId, dr as DEVICE_STATUS_METHOD, ei as EventCategory$1, hr as ReadinessTimeoutError, j as METHOD_ACCESS_MAP, kr as expandCapMethods, lr as DATAPLANE_SECRET_HEADER$1, mr as ReadinessRegistry, pn as procedureAuthKey, pr as RUNTIME_DEFAULTS, qr as scopeKey, qt as lifecycleJobSchema, sn as objectInputDeclaresAddonId, sr as errMsg$1, t as ALL_CAPABILITY_DEFINITIONS, ur as DEVICE_SETTINGS_CONTRIBUTION_METHODS, vr as asJsonObject$1, wr as createEvent$1, yr as asNumber } from "./dist-CHsJCqrf.mjs";
3
- import { c as staticJwtSigningKey, i as getProcessJwtSigningKeyState, n as JwtSigningKeyUnavailableError, o as processJwtSigningKey, r as SYSTEM_SECRET_OWNER, t as JWT_SIGNING_KEY_REF } from "./jwt-signing-key-DUVvfILp.mjs";
2
+ import { $t as looseSchema, Ar as expandCapMethods, Dn as scopesAllowAddon, Gr as readinessKey, Hr as parseJsonObject, Ht as isVoidInput, Jr as scopeKey, Jt as lifecycleJobSchema, K as addonSettingsCapability, Kr as resolveCapMount, Lt as isArrayOutputSchema, M as METHOD_ACCESS_MAP, On as scopesAllowDeviceCap, Or as emitDownForOwnedCaps, Qt as logLevelAtMost, Rt as isCollectionArrayMethod, Tr as createEvent$1, Ur as parseJsonUnknown, Ut as kebabToCamel$1, Vt as isObjectInput, br as asNumber, cn as objectInputDeclaresAddonId, cr as errMsg$1, dr as DEVICE_SETTINGS_CONTRIBUTION_METHODS, fr as DEVICE_STATUS_METHOD, gr as ReadinessTimeoutError, hr as ReadinessRegistry, jt as extractNestedAddonId, k as LOG_LEVEL_RANK, ln as objectInputDeclaresRequiredDeviceId, mn as procedureAuthKey, mr as RUNTIME_DEFAULTS, t as ALL_CAPABILITY_DEFINITIONS, ti as EventCategory$1, ur as DATAPLANE_SECRET_HEADER$1, wn as resolveMethodAuth, xr as asString$1, yr as asJsonObject$1, zn as supportedRuntimes } from "./dist-B-NmfvVC.mjs";
3
+ import { c as staticJwtSigningKey, i as getProcessJwtSigningKeyState, n as JwtSigningKeyUnavailableError, o as processJwtSigningKey, r as SYSTEM_SECRET_OWNER, t as JWT_SIGNING_KEY_REF } from "./jwt-signing-key-CUpweD22.mjs";
4
4
  import { AlertCenterAddon } from "./builtins/alerts/alerts.addon.mjs";
5
5
  import "./builtins/alerts/index.mjs";
6
6
  import { CalendarsAddon } from "./builtins/calendars/calendars.addon.mjs";
@@ -21,11 +21,12 @@ import "./builtins/local-auth/index.mjs";
21
21
  import { LokiDestination, LokiLoggingAddon } from "./builtins/loki-logging/index.mjs";
22
22
  import NativeMetricsAddon, { a as NativeMetricsProvider, n as nodeProcReader, r as parseProcStat } from "./builtins/native-metrics/native-metrics.addon.mjs";
23
23
  import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./builtins/sqlite-storage/filesystem-storage.addon.mjs";
24
- import { SqliteSettingsAddon, o as SqliteSettingsBackend, s as prefixRange } from "./builtins/sqlite-storage/sqlite-settings.addon.mjs";
24
+ import { c as SqliteSettingsBackend, l as prefixRange } from "./wal-maintenance-BlqNqaQ3.mjs";
25
+ import { SqliteSettingsAddon } from "./builtins/sqlite-storage/sqlite-settings.addon.mjs";
25
26
  import { ConfigStore, DeviceStore } from "./builtins/sqlite-storage/index.mjs";
26
27
  import { StorageOrchestratorAddon, a as stripForwardedCaller, i as createHubCapForwardService, n as HUB_CAP_FWD_ACTION, o as buildStorageLocationRegistry, r as HUB_CAP_FWD_SERVICE, t as StorageOrchestratorService } from "./builtins/storage-orchestrator/storage-orchestrator.addon.mjs";
27
28
  import "./builtins/storage-orchestrator/index.mjs";
28
- import { _ as getProcessClusterSecretGate, a as MESH_CA_KEY_REF, b as setProcessClusterSecretGate, d as CLUSTER_SECRET_REF, f as CLUSTER_SECRET_REJECTED_EXIT_CODE, g as clusterSecretMatches, h as checkClusterSecret, i as MESH_CA_FIELD, m as CLUSTER_SECRET_UNAVAILABLE_TYPE, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY, p as CLUSTER_SECRET_SETTINGS_KEY, u as CLUSTER_SECRET_MISMATCH_TYPE, v as hashClusterSecret, y as isClusterSecretMismatchError } from "./constants-iLQM7god.mjs";
29
+ import { _ as getProcessClusterSecretGate, a as MESH_CA_KEY_REF, b as setProcessClusterSecretGate, d as CLUSTER_SECRET_REF, f as CLUSTER_SECRET_REJECTED_EXIT_CODE, g as clusterSecretMatches, h as checkClusterSecret, i as MESH_CA_FIELD, m as CLUSTER_SECRET_UNAVAILABLE_TYPE, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY, p as CLUSTER_SECRET_SETTINGS_KEY, u as CLUSTER_SECRET_MISMATCH_TYPE, v as hashClusterSecret, y as isClusterSecretMismatchError } from "./constants-DHhhVjkt.mjs";
29
30
  import { A as AGENT_UI_UNLOCK_TTL_MS, B as isMeshAuthMode, C as generateMeshCa, D as loadMeshCa, E as issueMeshLeafFromCsr, F as parseAgentDashboardOrigins, G as setProcessMeshEnforcer, H as requestProcessMeshEnforcement, I as verifyAgentUiUnlockTicket, J as parseCidrList, K as createCidrMatcher, L as MESH_AUTH_MODE_FIELD, M as UnlockTicketJtiStore, N as isAllowedAgentDashboardReturnTo, O as AGENT_DASHBOARD_ORIGINS_FIELD, P as mintAgentUiUnlockTicket, R as getProcessMeshAuthMode, S as exportMeshPrivateKeyPem, SystemConfigAddon, T as issueMeshLeafForNode, U as setProcessMeshAuthMode, V as parseMeshAuthMode, W as setProcessMeshAuthStatusSource, Y as readCidrSetting, _ as getProcessMeshCaState, a as ServiceBroker, b as caFingerprintCompact, c as JoinTokenJtiStore, d as verifyMeshJoinToken, f as getProcessNodeMeshTransport, g as MeshCaKeeper, h as processMeshCrl, i as Errors, j as AGENT_UI_UNLOCK_VERSION, k as AGENT_UI_UNLOCK_DOMAIN, l as mintMeshJoinToken, m as MeshCrl, n as MESH_TLS_PORT_HELLO_FIELD, o as setProcessMeshTlsEnabler, p as setProcessMeshPeerTransportLookup, q as normalizeIp, r as TlsTcpTransporter, s as enrollMeshNode, u as processJoinTokenJtiStore, v as requireProcessMeshCa, w as generateMeshKeyPair, x as createMeshCsrPem, y as caFingerprint, z as getProcessMeshAuthStatus } from "./builtins/system-config/system-config.addon.mjs";
30
31
  import "./builtins/system-config/index.mjs";
31
32
  import { WinstonDestination, WinstonLoggingAddon } from "./builtins/winston-logging/index.mjs";
@@ -33,7 +34,7 @@ import { C as isModelDownloaded, T as revisionWeightUrl, _ as downloadFile, a as
33
34
  import { A as allFamiliesListenHost, C as collectCertIdentity, D as SERVER_AUTH_OID, E as MAX_LEAF_VALIDITY_DAYS, F as registerLanHttpHandler, M as bindPendingLanHttp, N as closeLanHttp, O as evaluateExistingCert, P as readLanHttpState, S as CA_COMMON_NAME, T as LEAF_RENEWAL_WINDOW_DAYS, _ as writeExtraSans, a as validateUploadedTls, b as loadTlsCert, c as registerHttpsListener, d as prepareBootTls, f as UPLOADED_CA_FILE, g as splitPemCertificates, h as readTlsMode, i as storeUploadedCertificate, j as applyLanHttp, k as DEFAULT_LAN_HTTP_PORT, l as reloadHttpsListener, m as readTlsAccessStatus, n as regenerateCertificate, o as clearHttpsListener, p as readExtraSans, r as revertToGeneratedCertificate, s as leafFingerprintOf, t as applyCertificateToListener, u as servedHttpsLeafFingerprint, v as writeTlsMode, w as CA_VALIDITY_DAYS, x as reissueTlsLeaf, y as ensureTlsCert } from "./tls-CaOLZ09W.mjs";
34
35
  import { n as getPlatformKeychainKey, r as setPlatformKeychainKey, t as clearPlatformKeychainKey } from "./platform-key-source-BWlq0jjn.mjs";
35
36
  import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-Di9daRwI.mjs";
36
- import { c as BackupKeyFormatError, d as generateBackupKeyPair, l as BackupKeyMismatchError, m as readBackupEncryptionHeader, o as SystemBackupService, r as prepareRestoreArchive, s as BackupDecryptError, t as BackupKeyRequiredError } from "./restore-archive-J_BsGRBy.mjs";
37
+ import { c as BackupKeyFormatError, d as generateBackupKeyPair, l as BackupKeyMismatchError, m as readBackupEncryptionHeader, o as SystemBackupService, r as prepareRestoreArchive, s as BackupDecryptError, t as BackupKeyRequiredError } from "./restore-archive-CFmPVlWQ.mjs";
37
38
  import { z } from "zod";
38
39
  import * as crypto$1 from "node:crypto";
39
40
  import { createHash, createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
@@ -1,4 +1,4 @@
1
- import { xr as buildSecretRef } from "./dist-CHsJCqrf.mjs";
1
+ import { Sr as buildSecretRef } from "./dist-B-NmfvVC.mjs";
2
2
  import { randomBytes } from "node:crypto";
3
3
  //#region src/auth/jwt-signing-key.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-FSNJUw7p.js");
1
+ const require_dist = require("./dist-CiUKtVkX.js");
2
2
  let node_crypto = require("node:crypto");
3
3
  //#region src/auth/jwt-signing-key.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { g as DATABASE_SNAPSHOT_SUFFIX } from "./dist-CHsJCqrf.mjs";
1
+ import { g as DATABASE_SNAPSHOT_SUFFIX } from "./dist-B-NmfvVC.mjs";
2
2
  import { createCipheriv, createDecipheriv, createHash, createPrivateKey, createPublicKey, diffieHellman, generateKeyPairSync, hkdfSync, randomBytes } from "node:crypto";
3
3
  import { Buffer as Buffer$1 } from "buffer";
4
4
  import * as fsp from "node:fs/promises";
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_dist = require("./dist-FSNJUw7p.js");
2
+ const require_dist = require("./dist-CiUKtVkX.js");
3
3
  let node_crypto = require("node:crypto");
4
4
  let buffer = require("buffer");
5
5
  let node_fs_promises = require("node:fs/promises");
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-FSNJUw7p.js");
1
+ const require_dist = require("./dist-CiUKtVkX.js");
2
2
  //#region src/builtins/sqlite-storage/retired-settings-keys.ts
3
3
  /**
4
4
  * Is THIS node the one whose settings store is the cluster's authority?
@@ -1,4 +1,4 @@
1
- import { vr as asJsonObject } from "./dist-CHsJCqrf.mjs";
1
+ import { yr as asJsonObject } from "./dist-B-NmfvVC.mjs";
2
2
  //#region src/builtins/sqlite-storage/retired-settings-keys.ts
3
3
  /**
4
4
  * Is THIS node the one whose settings store is the cluster's authority?
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-Cek0wNdY.js");
3
3
  const require_sqlite_snapshot_protocol = require("./sqlite-snapshot-protocol-B9OndqZv.js");
4
+ let node_worker_threads = require("node:worker_threads");
4
5
  let better_sqlite3 = require("better-sqlite3");
5
6
  better_sqlite3 = require_chunk.__toESM(better_sqlite3);
6
- let node_worker_threads = require("node:worker_threads");
7
7
  //#region src/builtins/sqlite-storage/sqlite-snapshot-worker.ts
8
8
  /**
9
9
  * The snapshot worker — a thread of the process that OWNS a live SQLite
@@ -1,6 +1,6 @@
1
1
  import { n as isSnapshotWorkerData, t as SnapshotRefusedError } from "./sqlite-snapshot-protocol-2QaTouWV.mjs";
2
- import Database from "better-sqlite3";
3
2
  import { isMainThread, parentPort, workerData } from "node:worker_threads";
3
+ import Database from "better-sqlite3";
4
4
  //#region src/builtins/sqlite-storage/sqlite-snapshot-worker.ts
5
5
  /**
6
6
  * The snapshot worker — a thread of the process that OWNS a live SQLite