@camstack/system 1.2.108 → 1.2.110

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 (56) 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/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  8. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  9. package/dist/builtins/console-logging/index.js +1 -1
  10. package/dist/builtins/console-logging/index.mjs +1 -1
  11. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  12. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  13. package/dist/builtins/device-manager/device-manager.addon.js +22 -3
  14. package/dist/builtins/device-manager/device-manager.addon.mjs +22 -3
  15. package/dist/builtins/device-manager/device-row-store.d.ts +20 -1
  16. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  17. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  18. package/dist/builtins/hub-forwarder/index.js +1 -1
  19. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  20. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  21. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  22. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  23. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  24. package/dist/builtins/local-network/local-network.addon.js +1 -1
  25. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  26. package/dist/builtins/loki-logging/index.js +1 -1
  27. package/dist/builtins/loki-logging/index.mjs +1 -1
  28. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  29. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  30. package/dist/builtins/platform-probe/index.js +1 -1
  31. package/dist/builtins/platform-probe/index.mjs +1 -1
  32. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  33. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  34. package/dist/builtins/snapshot/index.js +1 -1
  35. package/dist/builtins/snapshot/index.mjs +1 -1
  36. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  37. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  38. package/dist/builtins/sqlite-storage/integration-registry.d.ts +15 -12
  39. package/dist/builtins/sqlite-storage/retired-collections.d.ts +52 -0
  40. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +22 -0
  41. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +102 -2
  42. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +102 -2
  43. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  44. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  45. package/dist/builtins/system-config/system-config.addon.js +1 -1
  46. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  47. package/dist/builtins/winston-logging/index.js +1 -1
  48. package/dist/builtins/winston-logging/index.mjs +1 -1
  49. package/dist/{dist-Ctfhlrtl.js → dist-CQkr5Kw0.js} +31 -51
  50. package/dist/{dist-_oC_QkQA.mjs → dist-CW4Cims4.mjs} +31 -51
  51. package/dist/index.js +12 -293
  52. package/dist/index.mjs +12 -293
  53. package/dist/kernel/host-externals.d.ts +1 -1
  54. package/dist/{retired-settings-keys-pNmoHPTg.js → retired-settings-keys-DCESas5O.js} +1 -1
  55. package/dist/{retired-settings-keys-Bsjf7HQ-.mjs → retired-settings-keys-DGgOxOir.mjs} +1 -1
  56. package/package.json +1 -2
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM$1, r as __exportAll, t as __commonJSMin$1 } from "./chunk-CNf5ZN-e.mjs";
2
- import { At as asNumber, B as extractNestedAddonId, Bt as parseJsonUnknown$1, Dt as ReadinessTimeoutError, Et as ReadinessRegistry, Ft as expandCapMethods, Gt as EventCategory$1, H as isArrayOutputSchema, Ht as resolveCapMount, J as lifecycleJobSchema, K as isVoidInput, Mt as createEvent, Nt as emitDownForOwnedCaps, Q as looseSchema, St as DEVICE_STATUS_METHOD, U as isCollectionArrayMethod, Ut as scopeKey, Vt as readinessKey, W as isObjectInput, Z as logLevelAtMost, bt as DATAPLANE_SECRET_HEADER$1, d as METHOD_ACCESS_MAP, f as RUNTIME_DEFAULTS, it as procedureAuthKey, jt as asString$1, kt as asJsonObject$1, ot as scopesAllowAddon, q as kebabToCamel, st as scopesAllowDeviceCap, t as ALL_CAPABILITY_DEFINITIONS, tt as objectInputDeclaresAddonId, vt as errMsg$1, xt as DEVICE_SETTINGS_CONTRIBUTION_METHODS, y as addonSettingsCapability, zt as parseJsonObject } from "./dist-_oC_QkQA.mjs";
2
+ import { At as asNumber, B as extractNestedAddonId, Bt as parseJsonUnknown$1, Dt as ReadinessTimeoutError, Et as ReadinessRegistry, Ft as expandCapMethods, Gt as EventCategory$1, H as isArrayOutputSchema, Ht as resolveCapMount, J as lifecycleJobSchema, K as isVoidInput, Mt as createEvent, Nt as emitDownForOwnedCaps, Q as looseSchema, St as DEVICE_STATUS_METHOD, U as isCollectionArrayMethod, Ut as scopeKey, Vt as readinessKey, W as isObjectInput, Z as logLevelAtMost, bt as DATAPLANE_SECRET_HEADER$1, d as METHOD_ACCESS_MAP, f as RUNTIME_DEFAULTS, it as procedureAuthKey, jt as asString$1, kt as asJsonObject$1, ot as scopesAllowAddon, q as kebabToCamel, st as scopesAllowDeviceCap, t as ALL_CAPABILITY_DEFINITIONS, tt as objectInputDeclaresAddonId, vt as errMsg$1, xt as DEVICE_SETTINGS_CONTRIBUTION_METHODS, y as addonSettingsCapability, zt as parseJsonObject } from "./dist-CW4Cims4.mjs";
3
3
  import { AlertCenterAddon } from "./builtins/alerts/alerts.addon.mjs";
4
4
  import "./builtins/alerts/index.mjs";
5
5
  import { t as formatLogLine } from "./formatter-B7qW8bPJ.mjs";
@@ -2144,13 +2144,9 @@ function readInfo(raw) {
2144
2144
  return {};
2145
2145
  }
2146
2146
  var integrationCounter = 0;
2147
- var deviceCounter = 0;
2148
2147
  function nextIntegrationId() {
2149
2148
  return `int_${String(++integrationCounter).padStart(4, "0")}`;
2150
2149
  }
2151
- function nextDeviceId() {
2152
- return `dev_${String(++deviceCounter).padStart(4, "0")}`;
2153
- }
2154
2150
  var INTEGRATIONS_COLUMNS = [
2155
2151
  {
2156
2152
  name: "id",
@@ -2217,95 +2213,6 @@ var INTEGRATION_SETTINGS_COLUMNS = [
2217
2213
  defaultValue: "string"
2218
2214
  }
2219
2215
  ];
2220
- var DEVICES_COLUMNS = [
2221
- {
2222
- name: "id",
2223
- type: "TEXT",
2224
- primaryKey: true
2225
- },
2226
- {
2227
- name: "integration_id",
2228
- type: "TEXT",
2229
- notNull: true
2230
- },
2231
- {
2232
- name: "stable_id",
2233
- type: "TEXT",
2234
- notNull: true,
2235
- unique: true
2236
- },
2237
- {
2238
- name: "type",
2239
- type: "TEXT",
2240
- notNull: true,
2241
- defaultValue: "camera"
2242
- },
2243
- {
2244
- name: "name",
2245
- type: "TEXT",
2246
- notNull: true
2247
- },
2248
- {
2249
- name: "enabled",
2250
- type: "INTEGER",
2251
- notNull: true,
2252
- defaultValue: 1
2253
- },
2254
- {
2255
- name: "info",
2256
- type: "JSON",
2257
- notNull: true,
2258
- defaultValue: "{}"
2259
- },
2260
- {
2261
- name: "created_at",
2262
- type: "INTEGER",
2263
- notNull: true
2264
- },
2265
- {
2266
- name: "updated_at",
2267
- type: "INTEGER",
2268
- notNull: true
2269
- }
2270
- ];
2271
- var DEVICES_INDEXES = [
2272
- {
2273
- name: "idx_devices_integration",
2274
- columns: ["integration_id"]
2275
- },
2276
- {
2277
- name: "idx_devices_stable",
2278
- columns: ["stable_id"],
2279
- unique: true
2280
- },
2281
- {
2282
- name: "idx_devices_type",
2283
- columns: ["type"]
2284
- }
2285
- ];
2286
- var DEVICE_SETTINGS_COLUMNS = [
2287
- {
2288
- name: "device_id",
2289
- type: "TEXT",
2290
- notNull: true
2291
- },
2292
- {
2293
- name: "key",
2294
- type: "TEXT",
2295
- notNull: true
2296
- },
2297
- {
2298
- name: "value",
2299
- type: "TEXT",
2300
- notNull: true
2301
- },
2302
- {
2303
- name: "value_type",
2304
- type: "TEXT",
2305
- notNull: true,
2306
- defaultValue: "string"
2307
- }
2308
- ];
2309
2216
  /**
2310
2217
  * @durable class=config owner=integration-registry
2311
2218
  * write="`createIntegration` — an operator adds a provider, or an addon declares
@@ -2324,29 +2231,19 @@ var INTEGRATIONS = "integrations";
2324
2231
  */
2325
2232
  var INTEGRATION_SETTINGS = "integration_settings";
2326
2233
  /**
2327
- * `stable_id` carries a UNIQUE column constraint AND a UNIQUE index
2328
- * (`idx_devices_stable`): that pair is what stops a provider re-announcing the
2329
- * same physical camera from creating a second device row. An insert that
2330
- * collides throws rather than duplicating.
2234
+ * The persisted INTEGRATIONS one row per provider instance an operator (or a
2235
+ * declaring addon) added, plus that instance's settings.
2331
2236
  *
2332
- * @durable class=config owner=integration-registry
2333
- * write="`createDevice` a provider adopts a device under a stable id;
2334
- * `updateDevice` rewrites name/enabled/info"
2335
- * retention="`deleteDevice`, or the cascade in `deleteIntegration`. Nothing ages
2336
- * out. The `dev_NNNN` counter resumes from the highest surviving row at boot,
2337
- * so wiping the table restarts numbering and re-adopted cameras come back
2338
- * under DIFFERENT ids than every stored track and rule refers to."
2339
- */
2340
- var DEVICES = "devices";
2341
- /**
2342
- * @durable class=config owner=integration-registry
2343
- * write="`setDeviceSetting` — one row per (device_id, key), deleted and
2344
- * re-inserted on every write; per-camera operator intent lands here"
2345
- * retention="cascade only — `deleteDevice` and `deleteIntegration` remove a
2346
- * device's rows. No sweep; losing the table silently reverts every camera to
2347
- * its defaults."
2237
+ * It had a device half once: `devices` + `device_settings_kv`, `dev_NNNN` ids,
2238
+ * `createDevice` / `listCameras` / `setDeviceSetting`. It was removed on
2239
+ * 2026-08-19 with both tables ([D183](../../../../../docs/decisions/adr-0183-code-that-is-deleted-takes-its-tables-with-it.md)):
2240
+ * measured on the reference hub it held 0 rows against 974 live devices, no
2241
+ * production caller ever reached it, and its id-space could not be reconciled
2242
+ * with the numeric ids every track, rule and binding in the system uses. The
2243
+ * fleet is `device-manager:devices`. Do not add a device method here — the
2244
+ * device authority is the device-manager, and a second one that agrees with
2245
+ * nothing is how this half came to exist.
2348
2246
  */
2349
- var DEVICE_SETTINGS = "device_settings_kv";
2350
2247
  var IntegrationRegistry = class IntegrationRegistry {
2351
2248
  store;
2352
2249
  constructor(backend) {
@@ -2362,15 +2259,6 @@ var IntegrationRegistry = class IntegrationRegistry {
2362
2259
  collection: INTEGRATION_SETTINGS,
2363
2260
  columns: INTEGRATION_SETTINGS_COLUMNS
2364
2261
  });
2365
- await this.store.declareCollection({
2366
- collection: DEVICES,
2367
- columns: DEVICES_COLUMNS,
2368
- indexes: DEVICES_INDEXES
2369
- });
2370
- await this.store.declareCollection({
2371
- collection: DEVICE_SETTINGS,
2372
- columns: DEVICE_SETTINGS_COLUMNS
2373
- });
2374
2262
  const ints = await this.store.query({
2375
2263
  collection: INTEGRATIONS,
2376
2264
  filter: {
@@ -2385,20 +2273,6 @@ var IntegrationRegistry = class IntegrationRegistry {
2385
2273
  const num = parseInt(ints[0].id.replace("int_", ""), 10);
2386
2274
  if (!isNaN(num)) integrationCounter = num;
2387
2275
  }
2388
- const devs = await this.store.query({
2389
- collection: DEVICES,
2390
- filter: {
2391
- orderBy: {
2392
- field: "id",
2393
- direction: "desc"
2394
- },
2395
- limit: 1
2396
- }
2397
- });
2398
- if (devs[0]) {
2399
- const num = parseInt(devs[0].id.replace("dev_", ""), 10);
2400
- if (!isNaN(num)) deviceCounter = num;
2401
- }
2402
2276
  }
2403
2277
  async createIntegration(input) {
2404
2278
  const id = nextIntegrationId();
@@ -2482,15 +2356,6 @@ var IntegrationRegistry = class IntegrationRegistry {
2482
2356
  async deleteIntegration(id) {
2483
2357
  const integration = await this.getIntegration(id);
2484
2358
  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`);
2485
- const devices = await this.listDevices(id);
2486
- for (const d of devices) await this.store.deleteWhere({
2487
- collection: DEVICE_SETTINGS,
2488
- filter: { where: { device_id: d.id } }
2489
- });
2490
- await this.store.deleteWhere({
2491
- collection: DEVICES,
2492
- filter: { where: { integration_id: id } }
2493
- });
2494
2359
  await this.store.deleteWhere({
2495
2360
  collection: INTEGRATION_SETTINGS,
2496
2361
  filter: { where: { integration_id: id } }
@@ -2535,139 +2400,6 @@ var IntegrationRegistry = class IntegrationRegistry {
2535
2400
  async setIntegrationSettings(integrationId, settings) {
2536
2401
  for (const [key, value] of Object.entries(settings)) await this.setIntegrationSetting(integrationId, key, value);
2537
2402
  }
2538
- async createDevice(input) {
2539
- const id = nextDeviceId();
2540
- const now = Math.floor(Date.now() / 1e3);
2541
- await this.store.insert({
2542
- collection: DEVICES,
2543
- record: {
2544
- id,
2545
- data: {
2546
- integration_id: input.integrationId,
2547
- stable_id: input.stableId,
2548
- type: input.type,
2549
- name: input.name,
2550
- enabled: input.enabled !== false ? 1 : 0,
2551
- info: input.info ?? {},
2552
- created_at: now,
2553
- updated_at: now
2554
- }
2555
- }
2556
- });
2557
- if (input.settings) await this.setDeviceSettings(id, input.settings);
2558
- return {
2559
- id,
2560
- integrationId: input.integrationId,
2561
- stableId: input.stableId,
2562
- type: input.type,
2563
- name: input.name,
2564
- enabled: input.enabled !== false,
2565
- info: input.info ?? {},
2566
- createdAt: now,
2567
- updatedAt: now
2568
- };
2569
- }
2570
- async getDevice(id) {
2571
- const rows = await this.store.query({
2572
- collection: DEVICES,
2573
- filter: {
2574
- where: { id },
2575
- limit: 1
2576
- }
2577
- });
2578
- return rows[0] ? this.mapDevice(rows[0].data) : null;
2579
- }
2580
- async getDeviceByStableId(stableId) {
2581
- const rows = await this.store.query({
2582
- collection: DEVICES,
2583
- filter: {
2584
- where: { stable_id: stableId },
2585
- limit: 1
2586
- }
2587
- });
2588
- return rows[0] ? this.mapDevice(rows[0].data) : null;
2589
- }
2590
- async listDevices(integrationId) {
2591
- return (await this.store.query({
2592
- collection: DEVICES,
2593
- filter: {
2594
- ...integrationId ? { where: { integration_id: integrationId } } : {},
2595
- orderBy: {
2596
- field: "created_at",
2597
- direction: "asc"
2598
- }
2599
- }
2600
- })).map((r) => this.mapDevice(r.data));
2601
- }
2602
- async listCameras() {
2603
- return (await this.store.query({
2604
- collection: DEVICES,
2605
- filter: {
2606
- where: { type: "camera" },
2607
- orderBy: {
2608
- field: "created_at",
2609
- direction: "asc"
2610
- }
2611
- }
2612
- })).map((r) => this.mapDevice(r.data));
2613
- }
2614
- async updateDevice(id, updates) {
2615
- const updateRow = { updated_at: Math.floor(Date.now() / 1e3) };
2616
- if (updates.name !== void 0) updateRow["name"] = updates.name;
2617
- if (updates.enabled !== void 0) updateRow["enabled"] = updates.enabled ? 1 : 0;
2618
- if (updates.info !== void 0) updateRow["info"] = updates.info;
2619
- await this.store.updateWhere({
2620
- collection: DEVICES,
2621
- filter: { where: { id } },
2622
- data: updateRow
2623
- });
2624
- return this.getDevice(id);
2625
- }
2626
- async deleteDevice(id) {
2627
- await this.store.deleteWhere({
2628
- collection: DEVICE_SETTINGS,
2629
- filter: { where: { device_id: id } }
2630
- });
2631
- await this.store.deleteWhere({
2632
- collection: DEVICES,
2633
- filter: { where: { id } }
2634
- });
2635
- return true;
2636
- }
2637
- async getDeviceSettings(deviceId) {
2638
- const result = {};
2639
- const rows = await this.store.query({
2640
- collection: DEVICE_SETTINGS,
2641
- filter: { where: { device_id: deviceId } }
2642
- });
2643
- for (const row of rows) result[String(row.data["key"])] = deserializeSetting(row.data["value"], String(row.data["value_type"]));
2644
- return result;
2645
- }
2646
- async setDeviceSetting(deviceId, key, value) {
2647
- const s = serializeSetting(value);
2648
- await this.store.deleteWhere({
2649
- collection: DEVICE_SETTINGS,
2650
- filter: { where: {
2651
- device_id: deviceId,
2652
- key
2653
- } }
2654
- });
2655
- await this.store.insert({
2656
- collection: DEVICE_SETTINGS,
2657
- record: {
2658
- id: `${deviceId}:${key}`,
2659
- data: {
2660
- device_id: deviceId,
2661
- key,
2662
- value: s.value,
2663
- value_type: s.valueType
2664
- }
2665
- }
2666
- });
2667
- }
2668
- async setDeviceSettings(deviceId, settings) {
2669
- for (const [key, value] of Object.entries(settings)) await this.setDeviceSetting(deviceId, key, value);
2670
- }
2671
2403
  mapIntegration(row) {
2672
2404
  return {
2673
2405
  id: String(row["id"]),
@@ -2679,19 +2411,6 @@ var IntegrationRegistry = class IntegrationRegistry {
2679
2411
  updatedAt: Number(row["updated_at"])
2680
2412
  };
2681
2413
  }
2682
- mapDevice(row) {
2683
- return {
2684
- id: String(row["id"]),
2685
- integrationId: String(row["integration_id"]),
2686
- stableId: String(row["stable_id"]),
2687
- type: String(row["type"]),
2688
- name: String(row["name"]),
2689
- enabled: row["enabled"] === 1,
2690
- info: readInfo(row["info"]),
2691
- createdAt: Number(row["created_at"]),
2692
- updatedAt: Number(row["updated_at"])
2693
- };
2694
- }
2695
2414
  };
2696
2415
  //#endregion
2697
2416
  //#region src/kernel/deps/ensure-native-prebuilds.ts
@@ -2,7 +2,7 @@
2
2
  * The bare specifiers an ESM addon may leave unbundled and expect the HOST
3
3
  * framework to provide. Self-contained addons (the standard) inline
4
4
  * @camstack/types, @camstack/sdk, zod, @trpc/* — so for them only
5
- * @camstack/system + @camstack/shm-ring survive. Framework-mode (legacy)
5
+ * @camstack/system survives as genuinely host-provided. Framework-mode (legacy)
6
6
  * addons additionally leave the types/sdk/zod/trpc set external. Listing the
7
7
  * full union here lets one resolver hook serve both modes: for a self-contained
8
8
  * addon the extra entries simply never appear as live imports.
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-Ctfhlrtl.js");
1
+ const require_dist = require("./dist-CQkr5Kw0.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 { kt as asJsonObject } from "./dist-_oC_QkQA.mjs";
1
+ import { kt as asJsonObject } from "./dist-CW4Cims4.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?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.2.108",
3
+ "version": "1.2.110",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",
@@ -349,7 +349,6 @@
349
349
  },
350
350
  "dependencies": {
351
351
  "@camstack/sdk": "*",
352
- "@camstack/shm-ring": "*",
353
352
  "@camstack/types": "*",
354
353
  "@msgpack/msgpack": "^3.1.3",
355
354
  "@trpc/client": "^11.16.0",