@camstack/system 1.2.464 → 1.2.466

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 (92) hide show
  1. package/dist/addon-runner.js +1 -0
  2. package/dist/addon-runner.mjs +1 -0
  3. package/dist/addon-utils.mjs +1 -1
  4. package/dist/{agent-https-B9gbXoJI.mjs → agent-https-DDzIuZY_.mjs} +1 -1
  5. package/dist/{agent-https-DhFIbEwN.js → agent-https-OIvfjiTx.js} +1 -1
  6. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  7. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +4 -4
  8. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  9. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +5 -5
  10. package/dist/builtins/alerts/alerts.addon.d.ts +7 -0
  11. package/dist/builtins/alerts/alerts.addon.js +65 -2
  12. package/dist/builtins/alerts/alerts.addon.mjs +65 -2
  13. package/dist/builtins/autotrack/index.js +1 -1
  14. package/dist/builtins/autotrack/index.mjs +1 -1
  15. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  16. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +5 -5
  17. package/dist/builtins/calendars/calendars.addon.js +1 -1
  18. package/dist/builtins/calendars/calendars.addon.mjs +1 -1
  19. package/dist/builtins/camera-grid/index.js +1 -1
  20. package/dist/builtins/camera-grid/index.mjs +1 -1
  21. package/dist/builtins/composer/composer.addon.js +2 -2
  22. package/dist/builtins/composer/composer.addon.mjs +2 -2
  23. package/dist/builtins/console-logging/index.js +1 -1
  24. package/dist/builtins/console-logging/index.mjs +1 -1
  25. package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  26. package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  27. package/dist/builtins/device-history/device-history.addon.js +1 -1
  28. package/dist/builtins/device-history/device-history.addon.mjs +1 -1
  29. package/dist/builtins/device-manager/device-manager.addon.js +1 -1
  30. package/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  31. package/dist/builtins/hub-forwarder/index.js +1 -1
  32. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  33. package/dist/builtins/keychain/index.js +3 -3
  34. package/dist/builtins/keychain/index.mjs +3 -3
  35. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  36. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  37. package/dist/builtins/local-auth/auth-schema.d.ts +0 -2
  38. package/dist/builtins/local-auth/local-auth.addon.d.ts +0 -1
  39. package/dist/builtins/local-auth/local-auth.addon.js +23 -178
  40. package/dist/builtins/local-auth/local-auth.addon.mjs +27 -181
  41. package/dist/builtins/local-auth/record-kinds.d.ts +1 -6
  42. package/dist/builtins/local-network/local-network.addon.js +2 -2
  43. package/dist/builtins/local-network/local-network.addon.mjs +2 -2
  44. package/dist/builtins/loki-logging/index.js +1 -1
  45. package/dist/builtins/loki-logging/index.mjs +1 -1
  46. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  47. package/dist/builtins/native-metrics/native-metrics.addon.mjs +10 -10
  48. package/dist/builtins/platform-probe/index.js +1 -1
  49. package/dist/builtins/platform-probe/index.mjs +8 -8
  50. package/dist/builtins/record-entries/index.js +1 -1
  51. package/dist/builtins/record-entries/index.mjs +1 -1
  52. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  53. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  54. package/dist/builtins/snapshot/index.js +1 -1
  55. package/dist/builtins/snapshot/index.mjs +1 -1
  56. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  57. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +20 -20
  58. package/dist/builtins/sqlite-storage/index.js +1 -1
  59. package/dist/builtins/sqlite-storage/index.mjs +1 -1
  60. package/dist/builtins/sqlite-storage/records/records-engine.d.ts +11 -0
  61. package/dist/builtins/sqlite-storage/records/records-provider.d.ts +7 -2
  62. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +25 -15
  63. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +25 -15
  64. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  65. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  66. package/dist/builtins/system-config/system-config.addon.js +3 -3
  67. package/dist/builtins/system-config/system-config.addon.mjs +115 -115
  68. package/dist/builtins/winston-logging/index.js +1 -1
  69. package/dist/builtins/winston-logging/index.mjs +1 -1
  70. package/dist/{composition-sources-oXvmbMHX.js → composition-sources-DqHwltDV.js} +1 -1
  71. package/dist/{composition-sources-CGtooHSL.mjs → composition-sources-f74jlgRO.mjs} +1 -1
  72. package/dist/{constants-5mrGZxwS.js → constants-CdgJF4V6.js} +1 -1
  73. package/dist/{constants-CdutnpL9.mjs → constants-Dknv37yZ.mjs} +1 -1
  74. package/dist/{coral-accelerators-D_S1Fo5h.mjs → coral-accelerators-Qhn5TOYZ.mjs} +5 -5
  75. package/dist/{custom-action-registry-BGYDjTqY.mjs → custom-action-registry-DZSCLBuT.mjs} +37 -37
  76. package/dist/{device-ca-DZHKlZlD.mjs → device-ca-B16Mr3EY.mjs} +1 -1
  77. package/dist/{device-ca-B3xUzps7.js → device-ca-DpvQ5wrb.js} +1 -1
  78. package/dist/{dist-C2OBCa-A.mjs → dist-CfjkLTZV.mjs} +281 -66
  79. package/dist/{dist-D9aw_d0G.js → dist-QyW9hVO2.js} +298 -71
  80. package/dist/file-host-worker.js +1 -1
  81. package/dist/file-host-worker.mjs +1 -1
  82. package/dist/{hub-mdns-ciao-CFlhVKK6.js → hub-mdns-ciao-CWkX17zX.js} +2 -2
  83. package/dist/{hub-mdns-ciao-Bm09NrMS.mjs → hub-mdns-ciao-CtHQEnb3.mjs} +2 -2
  84. package/dist/index.d.ts +0 -2
  85. package/dist/index.js +8 -8
  86. package/dist/index.mjs +228 -227
  87. package/dist/{restore-archive-D6sS7Gt2.mjs → restore-archive-BmHNBgte.mjs} +94 -94
  88. package/dist/{restore-archive-6zkRREHO.js → restore-archive-DMgpNgX5.js} +1 -1
  89. package/dist/{wal-maintenance-jXcOxm2T.js → wal-maintenance-BIpPCYDi.js} +0 -0
  90. package/dist/{wal-maintenance-Dg6IzSgz.mjs → wal-maintenance-Bs_X-di6.mjs} +0 -0
  91. package/package.json +1 -1
  92. package/dist/auth/api-key-manager.d.ts +0 -19
@@ -1,4 +1,4 @@
1
- import { $r as errMsg, Ca as EventCategory, Dt as batteryCapability, Et as bareAddonId, Hn as memoizePinnedFfmpeg, Qr as DeviceType, Xr as DeviceFeature, Xt as deriveBatteryPresence, ei as BaseAddon, ia as nodePin, kr as streamQualityLabel, s as BatteryStatusSchema, xr as snapshotCapability } from "../../dist-C2OBCa-A.mjs";
1
+ import { $r as BaseAddon, Et as batteryCapability, Or as streamQualityLabel, Qr as errMsg, Ta as EventCategory, Tt as bareAddonId, Vn as memoizePinnedFfmpeg, Yr as DeviceFeature, Yt as deriveBatteryPresence, Zr as DeviceType, br as snapshotCapability, o as BatteryStatusSchema, oa as nodePin } from "../../dist-CfjkLTZV.mjs";
2
2
  import { i as renderCourtesyOverlayJpeg, n as courtesyCacheKey, r as renderCourtesyJpeg } from "../../snapshot-courtesy-CyFs1M3I.mjs";
3
3
  import { z } from "zod";
4
4
  import { randomUUID } from "node:crypto";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-D9aw_d0G.js");
6
+ const require_dist = require("../../dist-QyW9hVO2.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  let node_fs_promises = require("node:fs/promises");
9
9
  let node_path = require("node:path");
@@ -1,10 +1,10 @@
1
- import { Dr as storageProviderCapability, ei as BaseAddon, pn as filesystemBrowseCapability } from "../../dist-C2OBCa-A.mjs";
1
+ import { $r as BaseAddon, Er as storageProviderCapability, fn as filesystemBrowseCapability } from "../../dist-CfjkLTZV.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { mkdir, readdir, realpath, statfs } from "node:fs/promises";
4
4
  import * as path$1 from "node:path";
5
5
  import { basename, dirname, isAbsolute, join, resolve, sep } from "node:path";
6
6
  import { homedir } from "node:os";
7
- import * as fs from "node:fs";
7
+ import * as fs$1 from "node:fs";
8
8
  //#region src/builtins/sqlite-storage/path-guard.ts
9
9
  /**
10
10
  * Guards for the filesystem-browse cap. Pure + synchronous so they are
@@ -169,16 +169,16 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
169
169
  error: "config.basePath must be a non-empty string"
170
170
  };
171
171
  try {
172
- const stat = await fs.promises.stat(basePath).catch(() => null);
172
+ const stat = await fs$1.promises.stat(basePath).catch(() => null);
173
173
  if (stat) {
174
174
  if (!stat.isDirectory()) return {
175
175
  ok: false,
176
176
  error: `Path "${basePath}" exists but is not a directory`
177
177
  };
178
- await fs.promises.access(basePath, fs.constants.W_OK);
178
+ await fs$1.promises.access(basePath, fs$1.constants.W_OK);
179
179
  return { ok: true };
180
180
  }
181
- await fs.promises.mkdir(basePath, { recursive: true });
181
+ await fs$1.promises.mkdir(basePath, { recursive: true });
182
182
  return { ok: true };
183
183
  } catch (err) {
184
184
  return {
@@ -192,12 +192,12 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
192
192
  }
193
193
  async write({ location, relativePath, data }) {
194
194
  const filePath = safeResolve(getBasePath(location), relativePath);
195
- await fs.promises.mkdir(path$1.dirname(filePath), { recursive: true });
196
- await fs.promises.writeFile(filePath, data);
195
+ await fs$1.promises.mkdir(path$1.dirname(filePath), { recursive: true });
196
+ await fs$1.promises.writeFile(filePath, data);
197
197
  }
198
198
  async read({ location, relativePath }) {
199
199
  const filePath = safeResolve(getBasePath(location), relativePath);
200
- const buf = await fs.promises.readFile(filePath);
200
+ const buf = await fs$1.promises.readFile(filePath);
201
201
  const out = new Uint8Array(new ArrayBuffer(buf.byteLength));
202
202
  out.set(buf);
203
203
  return out;
@@ -205,7 +205,7 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
205
205
  async exists({ location, relativePath }) {
206
206
  const filePath = safeResolve(getBasePath(location), relativePath);
207
207
  try {
208
- await fs.promises.access(filePath);
208
+ await fs$1.promises.access(filePath);
209
209
  return true;
210
210
  } catch {
211
211
  return false;
@@ -215,25 +215,25 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
215
215
  const base = getBasePath(location);
216
216
  const dir = prefix ? safeResolve(base, prefix) : path$1.resolve(base);
217
217
  try {
218
- return (await fs.promises.readdir(dir, { withFileTypes: true })).map((e) => prefix ? `${prefix}/${e.name}` : e.name);
218
+ return (await fs$1.promises.readdir(dir, { withFileTypes: true })).map((e) => prefix ? `${prefix}/${e.name}` : e.name);
219
219
  } catch {
220
220
  return [];
221
221
  }
222
222
  }
223
223
  async delete({ location, relativePath }) {
224
224
  const filePath = safeResolve(getBasePath(location), relativePath);
225
- await fs.promises.rm(filePath, { force: true });
225
+ await fs$1.promises.rm(filePath, { force: true });
226
226
  }
227
227
  async getAvailableSpace({ location }) {
228
228
  const base = path$1.resolve(getBasePath(location));
229
229
  try {
230
230
  let target = base;
231
- while (!fs.existsSync(target)) {
231
+ while (!fs$1.existsSync(target)) {
232
232
  const parent = path$1.dirname(target);
233
233
  if (!parent || parent === target) return null;
234
234
  target = parent;
235
235
  }
236
- const stats = await fs.promises.statfs(target);
236
+ const stats = await fs$1.promises.statfs(target);
237
237
  return stats.bavail * stats.bsize;
238
238
  } catch {
239
239
  return null;
@@ -242,9 +242,9 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
242
242
  async beginUpload({ location, relativePath }) {
243
243
  const target = safeResolve(getBasePath(location), relativePath);
244
244
  const partial = `${target}.partial`;
245
- await fs.promises.mkdir(path$1.dirname(target), { recursive: true });
246
- await fs.promises.unlink(partial).catch(() => {});
247
- const stream = fs.createWriteStream(partial);
245
+ await fs$1.promises.mkdir(path$1.dirname(target), { recursive: true });
246
+ await fs$1.promises.unlink(partial).catch(() => {});
247
+ const stream = fs$1.createWriteStream(partial);
248
248
  const uploadId = randomUUID();
249
249
  const session = {
250
250
  stream,
@@ -285,7 +285,7 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
285
285
  session.stream.end(() => resolve());
286
286
  session.stream.on("error", reject);
287
287
  });
288
- await fs.promises.rename(session.partial, session.target);
288
+ await fs$1.promises.rename(session.partial, session.target);
289
289
  clearTimeout(session.timer);
290
290
  this.uploads.delete(uploadId);
291
291
  }
@@ -295,14 +295,14 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
295
295
  try {
296
296
  session.stream.destroy();
297
297
  } catch {}
298
- await fs.promises.unlink(session.partial).catch(() => {});
298
+ await fs$1.promises.unlink(session.partial).catch(() => {});
299
299
  clearTimeout(session.timer);
300
300
  this.uploads.delete(uploadId);
301
301
  }
302
302
  async beginDownload({ location, relativePath }) {
303
303
  const target = safeResolve(getBasePath(location), relativePath);
304
- const stat = await fs.promises.stat(target);
305
- const fd = await fs.promises.open(target, "r");
304
+ const stat = await fs$1.promises.stat(target);
305
+ const fd = await fs$1.promises.open(target, "r");
306
306
  const downloadId = randomUUID();
307
307
  const session = {
308
308
  fd,
@@ -4,7 +4,7 @@ Object.defineProperties(exports, {
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
6
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./filesystem-storage.addon.js");
7
- const require_wal_maintenance = require("../../wal-maintenance-jXcOxm2T.js");
7
+ const require_wal_maintenance = require("../../wal-maintenance-BIpPCYDi.js");
8
8
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./sqlite-settings.addon.js");
9
9
  //#region src/builtins/sqlite-storage/config-store.ts
10
10
  var ConfigStore = class {
@@ -1,5 +1,5 @@
1
1
  import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./filesystem-storage.addon.mjs";
2
- import { A as SQLITE_MMAP_CEILING_BYTES, B as SQLITE_SLOW_CALL_MS, F as sqlitePageCacheKibFor, H as sqliteEngineStorm, I as SQLITE_ENGINE_STORM_WALL_SHARE, L as SQLITE_PROFILE_REPORT_FLOOR_MS, M as SQLITE_PAGE_CACHE_CEILING_KIB, N as SQLITE_PAGE_CACHE_FLOOR_KIB, P as sqliteMmapSizeFor, R as SQLITE_PROFILE_REPORT_INTERVAL_MS, V as SqliteOpProfiler, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, j as SQLITE_MMAP_FLOOR_BYTES, k as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as SQLITE_PROFILE_TOP_N } from "../../wal-maintenance-Dg6IzSgz.mjs";
2
+ import { A as SQLITE_MMAP_CEILING_BYTES, B as SQLITE_SLOW_CALL_MS, F as sqlitePageCacheKibFor, H as sqliteEngineStorm, I as SQLITE_ENGINE_STORM_WALL_SHARE, L as SQLITE_PROFILE_REPORT_FLOOR_MS, M as SQLITE_PAGE_CACHE_CEILING_KIB, N as SQLITE_PAGE_CACHE_FLOOR_KIB, P as sqliteMmapSizeFor, R as SQLITE_PROFILE_REPORT_INTERVAL_MS, V as SqliteOpProfiler, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, j as SQLITE_MMAP_FLOOR_BYTES, k as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as SQLITE_PROFILE_TOP_N } from "../../wal-maintenance-Bs_X-di6.mjs";
3
3
  import { SqliteSettingsAddon } from "./sqlite-settings.addon.mjs";
4
4
  //#region src/builtins/sqlite-storage/config-store.ts
5
5
  var ConfigStore = class {
@@ -60,8 +60,19 @@ export declare class RecordsEngine implements RecordsEngineOps {
60
60
  put(input: OwnedInput<"put">): Promise<RecordsOutput<"put">>;
61
61
  putMany(input: OwnedInput<"putMany">): Promise<RecordsOutput<"putMany">>;
62
62
  patch(input: OwnedInput<"patch">): Promise<RecordsOutput<"patch">>;
63
+ /** One patch, inside the caller's transaction (shared with `transact`). */
64
+ private patchRecord;
63
65
  private refsOfRows;
64
66
  delete(input: OwnedInput<"delete">): Promise<RecordsOutput<"delete">>;
67
+ /** One delete (shared with `transact`). */
68
+ private deleteRecord;
69
+ /**
70
+ * Several put / patch / delete in ONE SQLite transaction. The scope rule
71
+ * (one file, one `transactFamily`) is checked before a row moves; each op then
72
+ * runs the very code of the single-row write, so secrets, indexes and size
73
+ * bounds behave exactly as there. Any op throwing rolls the whole call back.
74
+ */
75
+ transact(input: OwnedInput<"transact">): Promise<RecordsOutput<"transact">>;
65
76
  deleteMany(input: OwnedInput<"deleteMany">): Promise<RecordsOutput<"deleteMany">>;
66
77
  /** Delete the rows `selectSql` names, in batches, yielding between them. */
67
78
  private deleteBatched;
@@ -10,8 +10,7 @@
10
10
  * declaration. A kind declared for another file than the one it lives in is
11
11
  * refused (the engine never moves data, D853).
12
12
  * - **No adoption** (D900): the records migration is closed. A declaration
13
- * reads no legacy table, and a retired `adoptsFrom` an older addon still
14
- * sends is dropped before the catalog stores the declaration.
13
+ * reads no legacy table.
15
14
  */
16
15
  import { type IRecordsProvider, type IScopedLogger, type IStorageAdminProvider, type StorageKind } from "@camstack/types";
17
16
  import type { PlacementRouter } from "../placement-router.js";
@@ -46,6 +45,12 @@ export declare class RecordsProvider implements IRecordsProvider, AdminRecords {
46
45
  histogram(input: Parameters<IRecordsProvider["histogram"]>[0]): ReturnType<IRecordsProvider["histogram"]>;
47
46
  aggregate(input: Parameters<IRecordsProvider["aggregate"]>[0]): ReturnType<IRecordsProvider["aggregate"]>;
48
47
  deleteWhere(input: Parameters<IRecordsProvider["deleteWhere"]>[0]): ReturnType<IRecordsProvider["deleteWhere"]>;
48
+ /**
49
+ * All ops must resolve to ONE file (`records/transact-refused` `cross-file`
50
+ * otherwise); that file's engine then checks the family and runs one SQLite
51
+ * transaction.
52
+ */
53
+ transact(input: Parameters<IRecordsProvider["transact"]>[0]): ReturnType<IRecordsProvider["transact"]>;
49
54
  allocateId(input: Parameters<IRecordsProvider["allocateId"]>[0]): ReturnType<IRecordsProvider["allocateId"]>;
50
55
  /** The D865 hook body: every file that holds kinds of this owner. */
51
56
  deleteDevice(input: Parameters<IRecordsProvider["deleteDevice"]>[0]): ReturnType<IRecordsProvider["deleteDevice"]>;
@@ -3,9 +3,9 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-D9aw_d0G.js");
6
+ const require_dist = require("../../dist-QyW9hVO2.js");
7
7
  const require_retired_settings_keys = require("../../retired-settings-keys-CGUqX-Oz.js");
8
- const require_wal_maintenance = require("../../wal-maintenance-jXcOxm2T.js");
8
+ const require_wal_maintenance = require("../../wal-maintenance-BIpPCYDi.js");
9
9
  const require_sqlite_snapshot_protocol = require("../../sqlite-snapshot-protocol-B9OndqZv.js");
10
10
  const require_wal_checkpoint_policy = require("../../wal-checkpoint-policy-d2z2qPqx.js");
11
11
  let node_fs_promises = require("node:fs/promises");
@@ -1245,8 +1245,7 @@ var PlacementRouter = class {
1245
1245
  * declaration. A kind declared for another file than the one it lives in is
1246
1246
  * refused (the engine never moves data, D853).
1247
1247
  * - **No adoption** (D900): the records migration is closed. A declaration
1248
- * reads no legacy table, and a retired `adoptsFrom` an older addon still
1249
- * sends is dropped before the catalog stores the declaration.
1248
+ * reads no legacy table.
1250
1249
  */
1251
1250
  /** The caller the transport stamped, or a refusal. */
1252
1251
  function recordsCallerOf(input) {
@@ -1257,16 +1256,6 @@ function recordsCallerOf(input) {
1257
1256
  function keyOf(owner, kind) {
1258
1257
  return `${owner}\u0000${kind}`;
1259
1258
  }
1260
- /**
1261
- * A declaration as the catalog stores it: the retired `adoptsFrom` (D900) left
1262
- * out, so the row an older addon's redeclaration writes no longer carries it.
1263
- */
1264
- function withoutRetiredKeys(declaration) {
1265
- return {
1266
- ...declaration,
1267
- adoptsFrom: void 0
1268
- };
1269
- }
1270
1259
  var RecordsProvider = class {
1271
1260
  router;
1272
1261
  logger;
@@ -1300,7 +1289,7 @@ var RecordsProvider = class {
1300
1289
  const owner = recordsCallerOf(input);
1301
1290
  const byDatabase = /* @__PURE__ */ new Map();
1302
1291
  const parsed = /* @__PURE__ */ new Map();
1303
- for (const [kind, raw] of Object.entries(input.kinds)) parsed.set(kind, withoutRetiredKeys(require_dist.RecordKindDeclarationSchema.parse(raw)));
1292
+ for (const [kind, raw] of Object.entries(input.kinds)) parsed.set(kind, require_dist.RecordKindDeclarationSchema.parse(raw));
1304
1293
  await this.assertFamiliesInOneFile(owner, parsed);
1305
1294
  for (const [kind, declaration] of parsed) {
1306
1295
  const known = this.placement.get(keyOf(owner, kind));
@@ -1444,6 +1433,27 @@ var RecordsProvider = class {
1444
1433
  owner
1445
1434
  });
1446
1435
  }
1436
+ /**
1437
+ * All ops must resolve to ONE file (`records/transact-refused` `cross-file`
1438
+ * otherwise); that file's engine then checks the family and runs one SQLite
1439
+ * transaction.
1440
+ */
1441
+ async transact(input) {
1442
+ const owner = recordsCallerOf(input);
1443
+ const files = /* @__PURE__ */ new Map();
1444
+ for (const op of input.ops) {
1445
+ const database = this.placement.get(keyOf(owner, op.kind));
1446
+ if (database === void 0) throw new require_dist.UnknownRecordKindError(`"${owner}" declared no kind "${op.kind}"`);
1447
+ files.set(database, [...files.get(database) ?? [], op.kind]);
1448
+ }
1449
+ if (files.size > 1) throw new require_dist.TransactRefusedError(`cross-file: the ops span more than one database file (${[...files.entries()].map(([db, kinds]) => `${[...new Set(kinds)].join("+")}@${db}`).join(", ")}); a transaction lives in ONE file`);
1450
+ const first = input.ops[0];
1451
+ if (first === void 0) throw new require_dist.InvalidRecordError("transact: no ops");
1452
+ return (await this.fileOf(owner, first.kind)).records("transact", {
1453
+ ...input,
1454
+ owner
1455
+ });
1456
+ }
1447
1457
  async allocateId(input) {
1448
1458
  const owner = recordsCallerOf(input);
1449
1459
  return (await this.fileOf(owner, input.kind)).records("allocateId", {
@@ -1,6 +1,6 @@
1
- import { $r as errMsg, C as DATABASE_SNAPSHOT_TIMEOUT_MS, Cr as storageAdminCapability, Et as bareAddonId, Gt as dataStoreProviderCapability, Ir as vectorStoreCapability, Kt as databaseSnapshotCapability, S as DATABASE_SNAPSHOT_SUFFIX, Si as RecordKindDeclarationSchema, di as NoCallerError, ei as BaseAddon, gi as RECORD_SWEEP_INTERVAL_MS, ki as UnknownRecordKindError, oa as normalizeSecretOwner, oi as DeclarationRefusedError, rr as recordsCapability, w as DATA_STORE_DATABASES, x as DATABASE_SNAPSHOT_PARTIAL_SUFFIX, yi as RUNTIME_DEFAULTS } from "../../dist-C2OBCa-A.mjs";
1
+ import { $r as BaseAddon, Ai as UnknownRecordKindError, C as DATA_STORE_DATABASES, Fr as vectorStoreCapability, Gt as databaseSnapshotCapability, Oi as TransactRefusedError, Qr as errMsg, S as DATABASE_SNAPSHOT_TIMEOUT_MS, Sr as storageAdminCapability, Tt as bareAddonId, Wt as dataStoreProviderCapability, ai as DeclarationRefusedError, b as DATABASE_SNAPSHOT_PARTIAL_SUFFIX, ca as normalizeSecretOwner, hi as RECORD_SWEEP_INTERVAL_MS, li as InvalidRecordError, nr as recordsCapability, ui as NoCallerError, vi as RUNTIME_DEFAULTS, x as DATABASE_SNAPSHOT_SUFFIX, xi as RecordKindDeclarationSchema } from "../../dist-CfjkLTZV.mjs";
2
2
  import { r as retiredKeyStoreOf, t as purgeRetiredSettingsKeys } from "../../retired-settings-keys-C_Kjp-Bj.mjs";
3
- import { C as RecordsEngine, D as callVector, E as callRecords, O as controlTargetOf, S as trustResult, T as callData, _ as collectTransferables, a as WalMaintenance, c as vectorProviderOfOwnedFile, d as CrossDatabaseTransactError, f as DatabaseBusyError, l as SqliteSettingsBackend, m as rehydrateError, o as createVectorIndex, p as DuplicatePlacementError, s as vectorProviderOf, u as CollectionPlacementError, v as isFileHostMessage, w as callControl } from "../../wal-maintenance-Dg6IzSgz.mjs";
3
+ import { C as RecordsEngine, D as callVector, E as callRecords, O as controlTargetOf, S as trustResult, T as callData, _ as collectTransferables, a as WalMaintenance, c as vectorProviderOfOwnedFile, d as CrossDatabaseTransactError, f as DatabaseBusyError, l as SqliteSettingsBackend, m as rehydrateError, o as createVectorIndex, p as DuplicatePlacementError, s as vectorProviderOf, u as CollectionPlacementError, v as isFileHostMessage, w as callControl } from "../../wal-maintenance-Bs_X-di6.mjs";
4
4
  import { r as isSnapshotWorkerMessage } from "../../sqlite-snapshot-protocol-2QaTouWV.mjs";
5
5
  import { a as isWorkerMessage, t as WAL_CHECKPOINT_LARGE_PASS_FRAMES } from "../../wal-checkpoint-policy-BahrTtyD.mjs";
6
6
  import { createRequire } from "node:module";
@@ -1239,8 +1239,7 @@ var PlacementRouter = class {
1239
1239
  * declaration. A kind declared for another file than the one it lives in is
1240
1240
  * refused (the engine never moves data, D853).
1241
1241
  * - **No adoption** (D900): the records migration is closed. A declaration
1242
- * reads no legacy table, and a retired `adoptsFrom` an older addon still
1243
- * sends is dropped before the catalog stores the declaration.
1242
+ * reads no legacy table.
1244
1243
  */
1245
1244
  /** The caller the transport stamped, or a refusal. */
1246
1245
  function recordsCallerOf(input) {
@@ -1251,16 +1250,6 @@ function recordsCallerOf(input) {
1251
1250
  function keyOf(owner, kind) {
1252
1251
  return `${owner}\u0000${kind}`;
1253
1252
  }
1254
- /**
1255
- * A declaration as the catalog stores it: the retired `adoptsFrom` (D900) left
1256
- * out, so the row an older addon's redeclaration writes no longer carries it.
1257
- */
1258
- function withoutRetiredKeys(declaration) {
1259
- return {
1260
- ...declaration,
1261
- adoptsFrom: void 0
1262
- };
1263
- }
1264
1253
  var RecordsProvider = class {
1265
1254
  router;
1266
1255
  logger;
@@ -1294,7 +1283,7 @@ var RecordsProvider = class {
1294
1283
  const owner = recordsCallerOf(input);
1295
1284
  const byDatabase = /* @__PURE__ */ new Map();
1296
1285
  const parsed = /* @__PURE__ */ new Map();
1297
- for (const [kind, raw] of Object.entries(input.kinds)) parsed.set(kind, withoutRetiredKeys(RecordKindDeclarationSchema.parse(raw)));
1286
+ for (const [kind, raw] of Object.entries(input.kinds)) parsed.set(kind, RecordKindDeclarationSchema.parse(raw));
1298
1287
  await this.assertFamiliesInOneFile(owner, parsed);
1299
1288
  for (const [kind, declaration] of parsed) {
1300
1289
  const known = this.placement.get(keyOf(owner, kind));
@@ -1438,6 +1427,27 @@ var RecordsProvider = class {
1438
1427
  owner
1439
1428
  });
1440
1429
  }
1430
+ /**
1431
+ * All ops must resolve to ONE file (`records/transact-refused` `cross-file`
1432
+ * otherwise); that file's engine then checks the family and runs one SQLite
1433
+ * transaction.
1434
+ */
1435
+ async transact(input) {
1436
+ const owner = recordsCallerOf(input);
1437
+ const files = /* @__PURE__ */ new Map();
1438
+ for (const op of input.ops) {
1439
+ const database = this.placement.get(keyOf(owner, op.kind));
1440
+ if (database === void 0) throw new UnknownRecordKindError(`"${owner}" declared no kind "${op.kind}"`);
1441
+ files.set(database, [...files.get(database) ?? [], op.kind]);
1442
+ }
1443
+ if (files.size > 1) throw new TransactRefusedError(`cross-file: the ops span more than one database file (${[...files.entries()].map(([db, kinds]) => `${[...new Set(kinds)].join("+")}@${db}`).join(", ")}); a transaction lives in ONE file`);
1444
+ const first = input.ops[0];
1445
+ if (first === void 0) throw new InvalidRecordError("transact: no ops");
1446
+ return (await this.fileOf(owner, first.kind)).records("transact", {
1447
+ ...input,
1448
+ owner
1449
+ });
1450
+ }
1441
1451
  async allocateId(input) {
1442
1452
  const owner = recordsCallerOf(input);
1443
1453
  return (await this.fileOf(owner, input.kind)).records("allocateId", {
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-D9aw_d0G.js");
6
+ const require_dist = require("../../dist-QyW9hVO2.js");
7
7
  const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
8
8
  let zod = require("zod");
9
9
  let node_crypto = require("node:crypto");
@@ -1,4 +1,4 @@
1
- import { $i as isSecretMarker, Bn as mayReadLocation, Ca as EventCategory, En as isLocationEnabled, Ii as collectSecretConfigKeys, Lr as withLocationMode, Nn as legacyModeOf, Tr as storageMigrationCapability, Ui as defineRecordKinds, Vn as mayWriteToLocation, Wn as modeMayWrite, _i as REDACTED_SECRET, _n as gbToBytes, aa as normalizeNodeId, ba as transformSecretWrite, dr as resolveLocationMode, dt as StorageLocationModeSchema, ei as BaseAddon, ft as StorageLocationTypeSchema, ha as secretTreeFromPaths, ln as evictionPolicyOfLocation, pa as resolveSecretMarkers, pt as StorageMigrationJobSchema, q as LegacyStorageLocationDefaultSchema, sa as parseJsonObject, ut as StorageCleanupJobSchema, vr as settingsStoreCapability, wr as storageCapability } from "../../dist-C2OBCa-A.mjs";
1
+ import { $r as BaseAddon, Bn as mayWriteToLocation, Cr as storageCapability, Gi as defineRecordKinds, Ir as withLocationMode, K as LegacyStorageLocationDefaultSchema, Mn as legacyModeOf, Ri as collectSecretConfigKeys, Sa as transformSecretWrite, Ta as EventCategory, Tn as isLocationEnabled, Un as modeMayWrite, _a as secretTreeFromPaths, _r as settingsStoreCapability, cn as evictionPolicyOfLocation, dt as StorageLocationTypeSchema, ft as StorageMigrationJobSchema, gi as REDACTED_SECRET, gn as gbToBytes, ha as resolveSecretMarkers, la as parseJsonObject, lt as StorageCleanupJobSchema, sa as normalizeNodeId, ta as isSecretMarker, ur as resolveLocationMode, ut as StorageLocationModeSchema, wr as storageMigrationCapability, zn as mayReadLocation } from "../../dist-CfjkLTZV.mjs";
2
2
  import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
3
3
  import { z } from "zod";
4
4
  import { randomUUID } from "node:crypto";
@@ -3,11 +3,11 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-D9aw_d0G.js");
6
+ const require_dist = require("../../dist-QyW9hVO2.js");
7
7
  const require_safe_buffer$1 = require("../../safe-buffer-D3aoa-7X.js");
8
8
  const require_x509_es = require("../../x509.es-C4cOo48M.js");
9
- const require_agent_https = require("../../agent-https-DhFIbEwN.js");
10
- const require_constants$8 = require("../../constants-5mrGZxwS.js");
9
+ const require_agent_https = require("../../agent-https-OIvfjiTx.js");
10
+ const require_constants$8 = require("../../constants-CdgJF4V6.js");
11
11
  const require_src$1 = require("../../src-CnAqG6EF.js");
12
12
  let zod = require("zod");
13
13
  let node_crypto = require("node:crypto");