@camstack/server 1.2.769 → 1.2.770

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 (99) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/api/core/cap-providers.js +4 -193
  3. package/dist/api/trpc/generated-cap-routers.js +40 -30
  4. package/dist/core/addon/integration-visibility.js +0 -5
  5. package/package.json +35 -15
  6. package/system/dist/addon-utils.mjs +1 -1
  7. package/system/dist/{agent-https-C_rkCAus.mjs → agent-https-BGRPCKwT.mjs} +1 -1
  8. package/system/dist/{agent-https-Cw5Wc_ip.js → agent-https-mq6d71iq.js} +1 -1
  9. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  10. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +4 -4
  11. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  12. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +5 -5
  13. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  14. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  15. package/system/dist/builtins/autotrack/index.js +1 -1
  16. package/system/dist/builtins/autotrack/index.mjs +1 -1
  17. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  18. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +5 -5
  19. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  20. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  21. package/system/dist/builtins/camera-grid/index.js +1 -1
  22. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  23. package/system/dist/builtins/composer/composer.addon.js +3 -3
  24. package/system/dist/builtins/composer/composer.addon.mjs +3 -3
  25. package/system/dist/builtins/console-logging/index.js +1 -1
  26. package/system/dist/builtins/console-logging/index.mjs +1 -1
  27. package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
  28. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
  29. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  30. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  31. package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
  32. package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  33. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  34. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  35. package/system/dist/builtins/keychain/index.js +17 -10
  36. package/system/dist/builtins/keychain/index.mjs +17 -10
  37. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  38. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  39. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  40. package/system/dist/builtins/local-auth/local-auth.addon.mjs +5 -5
  41. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  42. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  43. package/system/dist/builtins/loki-logging/index.js +1 -1
  44. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  45. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  46. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +10 -10
  47. package/system/dist/builtins/platform-probe/index.js +1 -1
  48. package/system/dist/builtins/platform-probe/index.mjs +10 -10
  49. package/system/dist/builtins/record-entries/index.js +1 -1
  50. package/system/dist/builtins/record-entries/index.mjs +1 -1
  51. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  52. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  53. package/system/dist/builtins/snapshot/index.js +1 -1
  54. package/system/dist/builtins/snapshot/index.mjs +1 -1
  55. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  56. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +20 -20
  57. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  58. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  59. package/system/dist/builtins/sqlite-storage/integration-record-kinds.d.ts +3 -10
  60. package/system/dist/builtins/sqlite-storage/integration-registry.d.ts +1 -11
  61. package/system/dist/builtins/sqlite-storage/integration-rows-ports.d.ts +13 -15
  62. package/system/dist/builtins/sqlite-storage/migrations/legacy-integration-rows-door.d.ts +31 -0
  63. package/system/dist/builtins/sqlite-storage/migrations/migrations-provider.d.ts +39 -1
  64. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +48 -5
  65. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +48 -5
  66. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  67. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  68. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  69. package/system/dist/builtins/system-config/system-config.addon.mjs +115 -115
  70. package/system/dist/builtins/winston-logging/index.js +1 -1
  71. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  72. package/system/dist/{capture-engine-DXSWU1PY.js → capture-engine--FQ8NUHh.js} +1 -1
  73. package/system/dist/{capture-engine-Kl46lSBi.mjs → capture-engine-Cmx7DIzV.mjs} +1 -1
  74. package/system/dist/{composition-sources-ClCP809M.mjs → composition-sources-Bd09D5f4.mjs} +1 -1
  75. package/system/dist/{composition-sources-Cq0IeRv9.js → composition-sources-cvZAN87H.js} +1 -1
  76. package/system/dist/{constants-CDxTuuXp.mjs → constants-Dce28BAx.mjs} +1 -1
  77. package/system/dist/{constants-CI5ySMIj.js → constants-gM9xHjyj.js} +1 -1
  78. package/system/dist/{coral-accelerators-BW3OcrLD.mjs → coral-accelerators-DBlgWB8k.mjs} +6 -6
  79. package/system/dist/{custom-action-registry-BIJZBObd.mjs → custom-action-registry-oHl1xltx.mjs} +37 -37
  80. package/system/dist/{device-ca-DPvU-3TE.js → device-ca-BmeH6Y9E.js} +1 -1
  81. package/system/dist/{device-ca-uRLJ8-jZ.mjs → device-ca-DcMuT-Yp.mjs} +1 -1
  82. package/system/dist/{dist-C_SNsYGY.mjs → dist-C3WXy3Ix.mjs} +78 -55
  83. package/system/dist/{dist-BDixk7cu.js → dist-Dtw1sIeQ.js} +78 -55
  84. package/system/dist/file-host-worker.js +1 -1
  85. package/system/dist/file-host-worker.mjs +1 -1
  86. package/system/dist/{hub-mdns-ciao-7uRbexmH.js → hub-mdns-ciao-C49eqyby.js} +2 -2
  87. package/system/dist/{hub-mdns-ciao-ea1EwFAF.mjs → hub-mdns-ciao-Dfue_0kR.mjs} +2 -2
  88. package/system/dist/index.d.ts +1 -1
  89. package/system/dist/index.js +42 -230
  90. package/system/dist/index.mjs +262 -450
  91. package/system/dist/legacy-integration-rows-door-B8_XCqUX.js +290 -0
  92. package/system/dist/legacy-integration-rows-door-DK42Bh2Q.mjs +255 -0
  93. package/system/dist/migrations/hub/2026-11-05-drop-integration-settings.d.ts +16 -0
  94. package/system/dist/{restore-archive-D0y_tFM2.mjs → restore-archive-C0YDO-qd.mjs} +94 -94
  95. package/system/dist/{restore-archive-CpTnlXUA.js → restore-archive-DuktQtye.js} +1 -1
  96. package/system/dist/{wal-maintenance-Dy4gxMdb.js → wal-maintenance-BEo-y-cQ.js} +0 -0
  97. package/system/dist/{wal-maintenance-BvxzVfje.mjs → wal-maintenance-DhuvKiGK.mjs} +0 -0
  98. package/system/package.json +1 -1
  99. package/dist/api/core/integration-secrets.js +0 -96
@@ -1171,7 +1171,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1171
1171
  return DeviceRole;
1172
1172
  }({});
1173
1173
  //#endregion
1174
- //#region ../types/dist/sleep-D1jjWAr8.mjs
1174
+ //#region ../types/dist/sleep-9TIHFj1w.mjs
1175
1175
  /**
1176
1176
  * The audio chunk plane's byte format, and the ONE expansion from a coded
1177
1177
  * window to float samples (D455).
@@ -3192,10 +3192,9 @@ var BaseAddon = class {
3192
3192
  *
3193
3193
  * Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
3194
3194
  * needs its connection fields, the default integration the addon's own sections. It is the
3195
- * SHAPE of the form only — the values live in `integrations.getSettings`, and the write path is
3196
- * unchanged (`integrations.setSettings` for an account integration).
3195
+ * SHAPE of the form only — the values live on the instance record.
3197
3196
  */
3198
- async integrationSettingsSchema(_instance) {
3197
+ async integrationFormSchema(_instance) {
3199
3198
  return null;
3200
3199
  }
3201
3200
  /**
@@ -3241,7 +3240,7 @@ var BaseAddon = class {
3241
3240
  * per-instance schema when it declares one, else its global schema (what they always showed).
3242
3241
  */
3243
3242
  async getIntegrationFormSchema(instance, nodeId) {
3244
- const scoped = await this.integrationSettingsSchema(instance);
3243
+ const scoped = await this.integrationFormSchema(instance);
3245
3244
  if (scoped === null) return this.getGlobalSettings(void 0, void 0, nodeId);
3246
3245
  return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
3247
3246
  }
@@ -62159,11 +62158,7 @@ var CreateIntegrationInputSchema = zod.z.object({
62159
62158
  info: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
62160
62159
  /** `stableId` of the discovery candidate the form was seeded from (D984). */
62161
62160
  originStableId: zod.z.string().optional(),
62162
- settings: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
62163
- /** Keys of `settings` the form's schema declares secret (by type) — kept in
62164
- * the keychain, not the table (D787). */
62165
- secretKeys: zod.z.array(zod.z.string()).optional(),
62166
- skipRestart: zod.z.boolean().optional()
62161
+ settings: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
62167
62162
  });
62168
62163
  var UpdateIntegrationInputSchema = zod.z.object({
62169
62164
  id: zod.z.string(),
@@ -62195,30 +62190,6 @@ var integrationsCapability = {
62195
62190
  kind: "mutation",
62196
62191
  auth: "admin"
62197
62192
  }),
62198
- getSettings: method(zod.z.object({ id: zod.z.string() }), zod.z.record(zod.z.string(), zod.z.unknown()), { auth: "admin" }),
62199
- setSettings: method(zod.z.object({
62200
- id: zod.z.string(),
62201
- settings: zod.z.record(zod.z.string(), zod.z.unknown()),
62202
- /** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
62203
- secretKeys: zod.z.array(zod.z.string()).optional(),
62204
- /** The integration's own addon applies the change in-process and asks the hub not to respawn it. */
62205
- skipRestart: zod.z.boolean().optional()
62206
- }), zod.z.object({ success: zod.z.boolean() }), {
62207
- kind: "mutation",
62208
- auth: "admin"
62209
- }),
62210
- /**
62211
- * Delete the integration's LEGACY setting rows and their keychain values, once the owning addon
62212
- * moved them into its own record and read the record back (D1007). Only the integration's own
62213
- * addon may call it; the integration itself stays. Answers counts, never a value.
62214
- */
62215
- clearSettings: method(zod.z.object({ id: zod.z.string() }), zod.z.object({
62216
- rows: zod.z.number().int().nonnegative(),
62217
- secrets: zod.z.number().int().nonnegative()
62218
- }), {
62219
- kind: "mutation",
62220
- auth: "admin"
62221
- }),
62222
62193
  getAvailableTypes: method(zod.z.void(), zod.z.array(AvailableIntegrationTypeSchema), { auth: "admin" }),
62223
62194
  testConnection: method(zod.z.object({
62224
62195
  addonId: zod.z.string(),
@@ -66256,6 +66227,51 @@ var migrationsCapability = {
66256
66227
  }), {
66257
66228
  kind: "mutation",
66258
66229
  auth: "admin"
66230
+ }),
66231
+ /**
66232
+ * Migration-only. The stored rows of one integration, markers included, on
66233
+ * the settings connection. Empty when the store is gone — a copy migration
66234
+ * on a node that already dropped it is a no-op. Deleted with the last copy
66235
+ * migration. Not a settings API.
66236
+ */
66237
+ readLegacyIntegrationRows: method(zod.z.object({ integrationId: zod.z.string().min(1) }), zod.z.record(zod.z.string(), zod.z.unknown()), { auth: "admin" }),
66238
+ /**
66239
+ * Migration-only. Delete that integration's rows. The caller releases the
66240
+ * keychain values first. `secrets` is how many marker refs the rows held.
66241
+ * A missing store deletes nothing. Deleted with the last copy migration.
66242
+ */
66243
+ clearLegacyIntegrationRows: method(zod.z.object({ integrationId: zod.z.string().min(1) }), zod.z.object({
66244
+ rows: zod.z.number().int().nonnegative(),
66245
+ secrets: zod.z.number().int().nonnegative()
66246
+ }), {
66247
+ kind: "mutation",
66248
+ auth: "admin"
66249
+ }),
66250
+ /**
66251
+ * Migration-only. Upsert the given keys and leave every other key as stored.
66252
+ * `written` is false when the store is gone. Deleted with the last copy migration.
66253
+ */
66254
+ patchLegacyIntegrationRows: method(zod.z.object({
66255
+ integrationId: zod.z.string().min(1),
66256
+ patch: zod.z.record(zod.z.string(), zod.z.unknown())
66257
+ }), zod.z.object({ written: zod.z.boolean() }), {
66258
+ kind: "mutation",
66259
+ auth: "admin"
66260
+ }),
66261
+ /**
66262
+ * Migration-only. Remove the named keys. `present` is false when the store
66263
+ * is gone; `removed` is what those keys held (markers included). Deleted
66264
+ * with the last copy migration.
66265
+ */
66266
+ deleteLegacyIntegrationRowKeys: method(zod.z.object({
66267
+ integrationId: zod.z.string().min(1),
66268
+ keys: zod.z.array(zod.z.string().min(1))
66269
+ }), zod.z.object({
66270
+ present: zod.z.boolean(),
66271
+ removed: zod.z.record(zod.z.string(), zod.z.unknown())
66272
+ }), {
66273
+ kind: "mutation",
66274
+ auth: "admin"
66259
66275
  })
66260
66276
  }
66261
66277
  };
@@ -98932,13 +98948,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
98932
98948
  access: "create",
98933
98949
  role: "admin"
98934
98950
  },
98935
- "integrations.clearSettings": {
98936
- capName: "integrations",
98937
- capScope: "system",
98938
- addonId: null,
98939
- access: "delete",
98940
- role: "admin"
98941
- },
98942
98951
  "integrations.create": {
98943
98952
  capName: "integrations",
98944
98953
  capScope: "system",
@@ -98974,13 +98983,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
98974
98983
  access: "view",
98975
98984
  role: "admin"
98976
98985
  },
98977
- "integrations.getSettings": {
98978
- capName: "integrations",
98979
- capScope: "system",
98980
- addonId: null,
98981
- access: "view",
98982
- role: "admin"
98983
- },
98984
98986
  "integrations.list": {
98985
98987
  capName: "integrations",
98986
98988
  capScope: "system",
@@ -98988,13 +98990,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
98988
98990
  access: "view",
98989
98991
  role: "admin"
98990
98992
  },
98991
- "integrations.setSettings": {
98992
- capName: "integrations",
98993
- capScope: "system",
98994
- addonId: null,
98995
- access: "create",
98996
- role: "admin"
98997
- },
98998
98993
  "integrations.testConnection": {
98999
98994
  capName: "integrations",
99000
98995
  capScope: "system",
@@ -99989,6 +99984,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
99989
99984
  access: "view",
99990
99985
  role: "admin"
99991
99986
  },
99987
+ "migrations.clearLegacyIntegrationRows": {
99988
+ capName: "migrations",
99989
+ capScope: "system",
99990
+ addonId: null,
99991
+ access: "delete",
99992
+ role: "admin"
99993
+ },
99992
99994
  "migrations.declareOwner": {
99993
99995
  capName: "migrations",
99994
99996
  capScope: "system",
@@ -99996,6 +99998,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
99996
99998
  access: "create",
99997
99999
  role: "admin"
99998
100000
  },
100001
+ "migrations.deleteLegacyIntegrationRowKeys": {
100002
+ capName: "migrations",
100003
+ capScope: "system",
100004
+ addonId: null,
100005
+ access: "delete",
100006
+ role: "admin"
100007
+ },
99999
100008
  "migrations.dryRun": {
100000
100009
  capName: "migrations",
100001
100010
  capScope: "system",
@@ -100031,6 +100040,20 @@ var METHOD_ACCESS_MAP = Object.freeze({
100031
100040
  access: "create",
100032
100041
  role: "admin"
100033
100042
  },
100043
+ "migrations.patchLegacyIntegrationRows": {
100044
+ capName: "migrations",
100045
+ capScope: "system",
100046
+ addonId: null,
100047
+ access: "create",
100048
+ role: "admin"
100049
+ },
100050
+ "migrations.readLegacyIntegrationRows": {
100051
+ capName: "migrations",
100052
+ capScope: "system",
100053
+ addonId: null,
100054
+ access: "view",
100055
+ role: "admin"
100056
+ },
100034
100057
  "migrations.restorePreMigration": {
100035
100058
  capName: "migrations",
100036
100059
  capScope: "system",
@@ -1,5 +1,5 @@
1
1
  require("./chunk-Cek0wNdY.js");
2
- const require_wal_maintenance = require("./wal-maintenance-Dy4gxMdb.js");
2
+ const require_wal_maintenance = require("./wal-maintenance-BEo-y-cQ.js");
3
3
  let node_worker_threads = require("node:worker_threads");
4
4
  //#region src/builtins/sqlite-storage/file-host-worker.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { A as callRecords, C as isFileHostWorkerData, D as RecordsEngine, M as controlTargetOf, O as callControl, S as isFileHostRequest, a as WalMaintenance, b as collectTransferables, d as callMigrate, f as migrateTargetOf, j as callVector, k as callData, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, u as HUB_MIGRATIONS, v as serializeError, w as trustInput } from "./wal-maintenance-BvxzVfje.mjs";
1
+ import { A as callRecords, C as isFileHostWorkerData, D as RecordsEngine, M as controlTargetOf, O as callControl, S as isFileHostRequest, a as WalMaintenance, b as collectTransferables, d as callMigrate, f as migrateTargetOf, j as callVector, k as callData, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, u as HUB_MIGRATIONS, v as serializeError, w as trustInput } from "./wal-maintenance-DhuvKiGK.mjs";
2
2
  import { parentPort, threadId, workerData } from "node:worker_threads";
3
3
  //#region src/builtins/sqlite-storage/file-host-worker.ts
4
4
  /**
@@ -1,7 +1,7 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_dist = require("./dist-BDixk7cu.js");
2
+ const require_dist = require("./dist-Dtw1sIeQ.js");
3
3
  const require_x509_es = require("./x509.es-WtnRNyYS.js");
4
- const require_agent_https = require("./agent-https-Cw5Wc_ip.js");
4
+ const require_agent_https = require("./agent-https-mq6d71iq.js");
5
5
  let node_crypto = require("node:crypto");
6
6
  let _camstack_types_node = require("@camstack/types/node");
7
7
  let node_fs_promises = require("node:fs/promises");
@@ -1,7 +1,7 @@
1
1
  import { o as __toESM } from "./chunk-CNf5ZN-e.mjs";
2
- import { ac as userError } from "./dist-C_SNsYGY.mjs";
2
+ import { ac as userError } from "./dist-C3WXy3Ix.mjs";
3
3
  import { f as X509Certificate$1 } from "./x509.es-BRiJgOvu.mjs";
4
- import { D as reasonRequiresNewCa, E as evaluateExistingCert, F as readNameConstraints, N as permitsIdentity, _ as issueLeaf, b as collectCertIdentity, g as generateCa, j as isConstrainedCa, v as loadCa, y as localCaCommonName } from "./agent-https-C_rkCAus.mjs";
4
+ import { D as reasonRequiresNewCa, E as evaluateExistingCert, F as readNameConstraints, N as permitsIdentity, _ as issueLeaf, b as collectCertIdentity, g as generateCa, j as isConstrainedCa, v as loadCa, y as localCaCommonName } from "./agent-https-BGRPCKwT.mjs";
5
5
  import { X509Certificate, createPrivateKey } from "node:crypto";
6
6
  import { writeOwnerOnlyFileSync } from "@camstack/types/node";
7
7
  import { mkdir, writeFile } from "node:fs/promises";
@@ -136,7 +136,7 @@ export type { HubMdnsAnnouncement, HubMdnsHandle, HubMdnsPublisher } from "./bui
136
136
  export { IntegrationRegistry } from "./builtins/sqlite-storage/integration-registry.js";
137
137
  export { clearIntegrationRows } from "./builtins/sqlite-storage/integration-rows-ports.js";
138
138
  export type { IntegrationRecordStores } from "./builtins/sqlite-storage/integration-registry.js";
139
- export { integrationRegistryRecordKinds, INTEGRATIONS_LEGACY, INTEGRATION_SETTINGS_LEGACY } from "./builtins/sqlite-storage/integration-record-kinds.js";
139
+ export { integrationRegistryRecordKinds, INTEGRATIONS_LEGACY } from "./builtins/sqlite-storage/integration-record-kinds.js";
140
140
  export { clusterAgentRecordKinds, clusterNodeHistoryRecordKind, clusterNodeTombstoneRecordKind, ClusterNodeHistoryBodySchema, ClusterNodeTombstoneBodySchema } from "./builtins/cluster-agent/record-kinds.js";
141
141
  export type { ClusterNodeHistoryBody, ClusterNodeTombstoneBody } from "./builtins/cluster-agent/record-kinds.js";
142
142
  export { storageOrchestratorRecordKinds, STORAGE_DRAIN_STATE_LEGACY } from "./builtins/storage-orchestrator/record-kinds.js";
@@ -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-BDixk7cu.js");
4
- const require_device_ca = require("./device-ca-DPvU-3TE.js");
3
+ const require_dist = require("./dist-Dtw1sIeQ.js");
4
+ const require_device_ca = require("./device-ca-BmeH6Y9E.js");
5
5
  const require_read_all_rows$1 = require("./read-all-rows-CVoO1ONM.js");
6
6
  const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
7
7
  require("./builtins/alerts/index.js");
@@ -26,21 +26,22 @@ const require_builtins_loki_logging_index = require("./builtins/loki-logging/ind
26
26
  const require_builtins_native_metrics_native_metrics_addon = require("./builtins/native-metrics/native-metrics.addon.js");
27
27
  const require_builtins_device_history_device_history_addon = require("./builtins/device-history/device-history.addon.js");
28
28
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./builtins/sqlite-storage/filesystem-storage.addon.js");
29
- const require_wal_maintenance = require("./wal-maintenance-Dy4gxMdb.js");
29
+ const require_wal_maintenance = require("./wal-maintenance-BEo-y-cQ.js");
30
+ const require_legacy_integration_rows_door = require("./legacy-integration-rows-door-B8_XCqUX.js");
30
31
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./builtins/sqlite-storage/sqlite-settings.addon.js");
31
32
  const require_builtins_sqlite_storage_index = require("./builtins/sqlite-storage/index.js");
32
33
  const require_builtins_storage_orchestrator_storage_orchestrator_addon = require("./builtins/storage-orchestrator/storage-orchestrator.addon.js");
33
34
  require("./builtins/storage-orchestrator/index.js");
34
- const require_agent_https = require("./agent-https-Cw5Wc_ip.js");
35
- const require_constants = require("./constants-CI5ySMIj.js");
35
+ const require_agent_https = require("./agent-https-mq6d71iq.js");
36
+ const require_constants = require("./constants-gM9xHjyj.js");
36
37
  const require_builtins_system_config_system_config_addon = require("./builtins/system-config/system-config.addon.js");
37
38
  require("./builtins/system-config/index.js");
38
39
  const require_builtins_winston_logging_index = require("./builtins/winston-logging/index.js");
39
40
  const require_custom_action_registry = require("./custom-action-registry-JuMHGKEc.js");
40
- const require_hub_mdns_ciao = require("./hub-mdns-ciao-7uRbexmH.js");
41
+ const require_hub_mdns_ciao = require("./hub-mdns-ciao-C49eqyby.js");
41
42
  const require_platform_key_source = require("./platform-key-source-Di7HrlGR.js");
42
43
  const require_resource_monitor = require("./resource-monitor-mio9dSCT.js");
43
- const require_restore_archive = require("./restore-archive-CpTnlXUA.js");
44
+ const require_restore_archive = require("./restore-archive-DuktQtye.js");
44
45
  const require_coral_accelerators = require("./coral-accelerators-BSVsBVzt.js");
45
46
  let zod = require("zod");
46
47
  let node_crypto = require("node:crypto");
@@ -5674,9 +5675,11 @@ var AgentMdnsAdvertiser = class {
5674
5675
  var import_read_all_rows = require_read_all_rows$1.require_read_all_rows();
5675
5676
  /**
5676
5677
  * Record kinds owned by integration-registry (phase 4).
5678
+ *
5679
+ * An integration's configuration is the addon's own instance record. This owner
5680
+ * keeps only the registry row (id, addon, name, enabled, info).
5677
5681
  */
5678
5682
  var INTEGRATIONS_LEGACY = "integrations";
5679
- var INTEGRATION_SETTINGS_LEGACY = "integration_settings";
5680
5683
  var IntegrationBodySchema = zod.z.object({
5681
5684
  addonId: zod.z.string(),
5682
5685
  name: zod.z.string(),
@@ -5686,86 +5689,22 @@ var IntegrationBodySchema = zod.z.object({
5686
5689
  createdAt: zod.z.number(),
5687
5690
  updatedAt: zod.z.number()
5688
5691
  });
5689
- var IntegrationSettingBodySchema = zod.z.object({
5690
- integrationId: zod.z.string(),
5691
- key: zod.z.string(),
5692
- value: zod.z.string(),
5693
- valueType: zod.z.string()
5694
- });
5695
- var _integrationRegistryRecordKinds = require_dist.defineRecordKinds({
5696
- integrations: {
5697
- schema: IntegrationBodySchema,
5698
- class: "config",
5699
- writeTrigger: "createIntegration / updateIntegration / deleteIntegration",
5700
- device: "none",
5701
- at: "none",
5702
- indexes: [{
5703
- name: "addon_id",
5704
- fields: ["addonId"]
5705
- }],
5706
- retention: { none: "deleteIntegration only" }
5707
- },
5708
- "integration-settings": {
5709
- schema: IntegrationSettingBodySchema,
5710
- class: "config",
5711
- writeTrigger: "setIntegrationSetting — one row per (integrationId, key)",
5712
- device: "none",
5713
- at: "none",
5714
- indexes: [{
5715
- name: "integration_id",
5716
- fields: ["integrationId"]
5717
- }],
5718
- retention: { none: "cascade on deleteIntegration" }
5719
- }
5720
- });
5692
+ var _integrationRegistryRecordKinds = require_dist.defineRecordKinds({ integrations: {
5693
+ schema: IntegrationBodySchema,
5694
+ class: "config",
5695
+ writeTrigger: "createIntegration / updateIntegration / deleteIntegration",
5696
+ device: "none",
5697
+ at: "none",
5698
+ indexes: [{
5699
+ name: "addon_id",
5700
+ fields: ["addonId"]
5701
+ }],
5702
+ retention: { none: "deleteIntegration only" }
5703
+ } });
5721
5704
  var integrationRegistryRecordKinds = _integrationRegistryRecordKinds;
5722
5705
  _integrationRegistryRecordKinds.integrations;
5723
- _integrationRegistryRecordKinds["integration-settings"];
5724
5706
  //#endregion
5725
5707
  //#region src/builtins/sqlite-storage/integration-registry.ts
5726
- function serializeSetting(value) {
5727
- if (typeof value === "number") return {
5728
- value: String(value),
5729
- valueType: "number"
5730
- };
5731
- if (typeof value === "boolean") return {
5732
- value: String(value),
5733
- valueType: "boolean"
5734
- };
5735
- if (typeof value === "string") return {
5736
- value,
5737
- valueType: "string"
5738
- };
5739
- return {
5740
- value: JSON.stringify(value),
5741
- valueType: "json"
5742
- };
5743
- }
5744
- /**
5745
- * Decode a settings row back to its value.
5746
- *
5747
- * `raw` is `unknown`, not `string`, on purpose: the collection surface parses
5748
- * any TEXT column whose value starts with `{` or `[`, so a `json` setting
5749
- * arrives here ALREADY an object. Coercing it with `String(...)` first — which
5750
- * is what a straight port of the `table*` version did — produced the literal
5751
- * `"[object Object]"`.
5752
- */
5753
- function deserializeSetting(raw, valueType) {
5754
- if (valueType === "json") {
5755
- if (typeof raw !== "string") return raw;
5756
- try {
5757
- return JSON.parse(raw);
5758
- } catch {
5759
- return raw;
5760
- }
5761
- }
5762
- const value = String(raw);
5763
- switch (valueType) {
5764
- case "number": return Number(value);
5765
- case "boolean": return value === "true";
5766
- default: return value;
5767
- }
5768
- }
5769
5708
  /**
5770
5709
  * Read an `info` blob off a row.
5771
5710
  *
@@ -5833,29 +5772,6 @@ var INTEGRATIONS_INDEXES = [{
5833
5772
  name: "idx_integrations_addon",
5834
5773
  columns: ["addon_id"]
5835
5774
  }];
5836
- var INTEGRATION_SETTINGS_COLUMNS = [
5837
- {
5838
- name: "integration_id",
5839
- type: "TEXT",
5840
- notNull: true
5841
- },
5842
- {
5843
- name: "key",
5844
- type: "TEXT",
5845
- notNull: true
5846
- },
5847
- {
5848
- name: "value",
5849
- type: "TEXT",
5850
- notNull: true
5851
- },
5852
- {
5853
- name: "value_type",
5854
- type: "TEXT",
5855
- notNull: true,
5856
- defaultValue: "string"
5857
- }
5858
- ];
5859
5775
  /**
5860
5776
  * @durable class=config owner=integration-registry
5861
5777
  * write="`createIntegration` — an operator adds a provider, or an addon declares
@@ -5866,16 +5782,9 @@ var INTEGRATION_SETTINGS_COLUMNS = [
5866
5782
  */
5867
5783
  var INTEGRATIONS = INTEGRATIONS_LEGACY;
5868
5784
  /**
5869
- * @durable class=config owner=integration-registry
5870
- * write="`setIntegrationSetting` — one row per (integration_id, key), deleted and
5871
- * re-inserted on every write; this is the operator's per-integration intent"
5872
- * retention="cascade only — `deleteIntegration` removes the parent's rows. There
5873
- * is no sweep, so a key an addon stops declaring stays on disk forever."
5874
- */
5875
- var INTEGRATION_SETTINGS = INTEGRATION_SETTINGS_LEGACY;
5876
- /**
5877
5785
  * The persisted INTEGRATIONS — one row per provider instance an operator (or a
5878
- * declaring addon) added, plus that instance's settings.
5786
+ * declaring addon) added. The instance's configuration lives on the addon's own
5787
+ * record, not here.
5879
5788
  *
5880
5789
  * It had a device half once: `devices` + `device_settings_kv`, `dev_NNNN` ids,
5881
5790
  * `createDevice` / `listCameras` / `setDeviceSetting`. It was removed on
@@ -5907,23 +5816,14 @@ var IntegrationRegistry = class IntegrationRegistry {
5907
5816
  this.recordStores = recordStores;
5908
5817
  }
5909
5818
  static recordStoresOf(records) {
5910
- return {
5911
- integrations: records.kind(integrationRegistryRecordKinds.integrations),
5912
- settings: records.kind(integrationRegistryRecordKinds["integration-settings"])
5913
- };
5819
+ return { integrations: records.kind(integrationRegistryRecordKinds.integrations) };
5914
5820
  }
5915
5821
  async initialize() {
5916
- if (this.recordStores === void 0) {
5917
- await this.store.declareCollection({
5918
- collection: INTEGRATIONS,
5919
- columns: INTEGRATIONS_COLUMNS,
5920
- indexes: INTEGRATIONS_INDEXES
5921
- });
5922
- await this.store.declareCollection({
5923
- collection: INTEGRATION_SETTINGS,
5924
- columns: INTEGRATION_SETTINGS_COLUMNS
5925
- });
5926
- }
5822
+ if (this.recordStores === void 0) await this.store.declareCollection({
5823
+ collection: INTEGRATIONS,
5824
+ columns: INTEGRATIONS_COLUMNS,
5825
+ indexes: INTEGRATIONS_INDEXES
5826
+ });
5927
5827
  await this.resumeCounter();
5928
5828
  }
5929
5829
  async resumeCounter() {
@@ -5991,7 +5891,6 @@ var IntegrationRegistry = class IntegrationRegistry {
5991
5891
  }
5992
5892
  }
5993
5893
  });
5994
- if (input.settings) await this.setIntegrationSettings(id, input.settings);
5995
5894
  return {
5996
5895
  id,
5997
5896
  addonId: input.addonId,
@@ -6095,97 +5994,17 @@ var IntegrationRegistry = class IntegrationRegistry {
6095
5994
  async deleteIntegration(id) {
6096
5995
  const integration = await this.getIntegration(id);
6097
5996
  if (integration !== null && IntegrationRegistry.isFixed(integration)) throw new Error(`integration "${id}" is fixed — it belongs to the addon that declared it and cannot be deleted`);
6098
- const settingsKind = this.recordStores?.settings;
6099
5997
  const integrationsKind = this.recordStores?.integrations;
6100
- if (settingsKind !== void 0 && integrationsKind !== void 0) {
6101
- for (const row of await (0, import_read_all_rows.readAllRows)(settingsKind)) if (row.data.integrationId === id) await settingsKind.delete(row.id);
5998
+ if (integrationsKind !== void 0) {
6102
5999
  await integrationsKind.delete(id);
6103
6000
  return true;
6104
6001
  }
6105
- await this.store.deleteWhere({
6106
- collection: INTEGRATION_SETTINGS,
6107
- filter: { where: { integration_id: id } }
6108
- });
6109
6002
  await this.store.deleteWhere({
6110
6003
  collection: INTEGRATIONS,
6111
6004
  filter: { where: { id } }
6112
6005
  });
6113
6006
  return true;
6114
6007
  }
6115
- async getIntegrationSettings(integrationId) {
6116
- const result = {};
6117
- const kind = this.recordStores?.settings;
6118
- if (kind !== void 0) {
6119
- for (const row of await (0, import_read_all_rows.readAllRows)(kind)) {
6120
- if (row.data.integrationId !== integrationId) continue;
6121
- result[row.data.key] = deserializeSetting(row.data.value, row.data.valueType);
6122
- }
6123
- return result;
6124
- }
6125
- const rows = await this.store.query({
6126
- collection: INTEGRATION_SETTINGS,
6127
- filter: { where: { integration_id: integrationId } }
6128
- });
6129
- for (const row of rows) result[String(row.data["key"])] = deserializeSetting(row.data["value"], String(row.data["value_type"]));
6130
- return result;
6131
- }
6132
- /**
6133
- * Delete every legacy setting row of an integration and answer the keychain refs the rows
6134
- * carried, so the caller (the rows-to-record migration) releases them after the rows are gone.
6135
- * The integration itself stays.
6136
- */
6137
- async clearIntegrationSettings(integrationId) {
6138
- const refs = require_dist.collectSecretMarkerRefs(await this.getIntegrationSettings(integrationId));
6139
- const kind = this.recordStores?.settings;
6140
- if (kind !== void 0) {
6141
- for (const row of await (0, import_read_all_rows.readAllRows)(kind)) if (row.data.integrationId === integrationId) await kind.delete(row.id);
6142
- return refs;
6143
- }
6144
- await this.store.deleteWhere({
6145
- collection: INTEGRATION_SETTINGS,
6146
- filter: { where: { integration_id: integrationId } }
6147
- });
6148
- return refs;
6149
- }
6150
- async setIntegrationSetting(integrationId, key, value) {
6151
- const s = serializeSetting(value);
6152
- const rowId = `${integrationId}:${key}`;
6153
- const kind = this.recordStores?.settings;
6154
- if (kind !== void 0) {
6155
- await kind.put({
6156
- id: rowId,
6157
- data: {
6158
- integrationId,
6159
- key,
6160
- value: s.value,
6161
- valueType: s.valueType
6162
- }
6163
- });
6164
- return;
6165
- }
6166
- await this.store.deleteWhere({
6167
- collection: INTEGRATION_SETTINGS,
6168
- filter: { where: {
6169
- integration_id: integrationId,
6170
- key
6171
- } }
6172
- });
6173
- await this.store.insert({
6174
- collection: INTEGRATION_SETTINGS,
6175
- record: {
6176
- id: rowId,
6177
- data: {
6178
- integration_id: integrationId,
6179
- key,
6180
- value: s.value,
6181
- value_type: s.valueType
6182
- }
6183
- }
6184
- });
6185
- }
6186
- async setIntegrationSettings(integrationId, settings) {
6187
- for (const [key, value] of Object.entries(settings)) await this.setIntegrationSetting(integrationId, key, value);
6188
- }
6189
6008
  mapIntegration(row) {
6190
6009
  return {
6191
6010
  id: String(row["id"]),
@@ -6202,25 +6021,19 @@ var IntegrationRegistry = class IntegrationRegistry {
6202
6021
  //#endregion
6203
6022
  //#region src/builtins/sqlite-storage/integration-rows-ports.ts
6204
6023
  /**
6205
- * The system-side ports of `moveIntegrationRowsToRecords` (planning#416): the legacy
6206
- * `integration_settings` rows are read through the registry and their secrets resolved through the
6207
- * integration's OWNER keychain door (never exposed further), and cleared together with their
6208
- * keychain values. The addon's own record kind is reached through its records handle.
6024
+ * The system-side ports of `moveIntegrationRowsToRecords` (planning#416). The leftover rows are
6025
+ * read on the settings connection by the migration-only door, and their secrets are resolved
6026
+ * through the integration's OWNER keychain handle (never exposed further) and cleared together
6027
+ * with the rows. The addon's own record kind is reached through its records handle.
6209
6028
  */
6210
6029
  /**
6211
- * The hub-side "clear rows" operation: delete one integration's legacy setting rows AND the
6212
- * keychain values they pointed at (values first, so a failed delete leaves the rows to retry). The integration itself stays. A rerun on cleared rows is a
6213
- * no-op. Counts only; never a value.
6030
+ * Delete one integration's leftover rows AND the keychain values they pointed at (values first,
6031
+ * so a failed delete leaves the rows to retry). A missing store is a no-op. Counts only.
6214
6032
  */
6215
- async function clearIntegrationRows(deps, integrationId) {
6216
- const stored = await deps.registry.getIntegrationSettings(integrationId);
6217
- const refs = require_dist.collectSecretMarkerRefs(stored);
6218
- if (refs.length > 0 && deps.secrets !== null) await deps.secrets.delete(refs);
6219
- await deps.registry.clearIntegrationSettings(integrationId);
6220
- return {
6221
- rows: Object.keys(stored).length,
6222
- secrets: refs.length
6223
- };
6033
+ async function clearIntegrationRows(db, secrets, integrationId) {
6034
+ const refs = require_dist.collectSecretMarkerRefs(require_legacy_integration_rows_door.readLegacyIntegrationRows(db, integrationId));
6035
+ if (refs.length > 0 && secrets !== null) await secrets.delete(refs);
6036
+ return require_legacy_integration_rows_door.clearLegacyIntegrationRows(db, integrationId);
6224
6037
  }
6225
6038
  //#endregion
6226
6039
  //#region src/builtins/cluster-agent/record-kinds.ts
@@ -28319,7 +28132,6 @@ exports.HubNodeRegistry = HubNodeRegistry;
28319
28132
  exports.HubPairing = require_builtins_system_config_system_config_addon.HubPairing;
28320
28133
  exports.INFRA_CAPABILITIES = INFRA_CAPABILITIES;
28321
28134
  exports.INTEGRATIONS_LEGACY = INTEGRATIONS_LEGACY;
28322
- exports.INTEGRATION_SETTINGS_LEGACY = INTEGRATION_SETTINGS_LEGACY;
28323
28135
  exports.IntegrationRegistry = IntegrationRegistry;
28324
28136
  exports.InvalidCorsOriginError = require_builtins_system_config_system_config_addon.InvalidCorsOriginError;
28325
28137
  exports.JWT_SIGNING_KEY_REF = require_device_ca.JWT_SIGNING_KEY_REF;