@camstack/server 1.2.943 → 1.2.945
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.
- package/CHANGELOG.md +26 -0
- package/closure-pins.json +350 -0
- package/dist/api/core/auth-sessions.procedures.js +18 -0
- package/dist/api/core/auth.router.js +19 -6
- package/dist/api/server-upload.js +17 -1
- package/dist/api/trpc/generated-cap-mounts.js +18 -1
- package/dist/api/trpc/generated-cap-routers.js +2662 -2542
- package/dist/auth/native-return.js +9 -3
- package/dist/auth/sso-routes.js +5 -1
- package/dist/core/addon/instance-lifecycle.js +4 -1
- package/dist/core/auth/handoff-code.service.js +35 -1
- package/dist/server-root/index.js +313 -70
- package/package.json +15 -11
- package/system/assets/apps-aggregator/icon.svg +5 -0
- package/system/dist/{action-index-B_cLRwXJ.js → action-index-Bcnb-jyg.js} +9 -1
- package/system/dist/{action-index-B1fgpQBt.mjs → action-index-DwPHO2nz.mjs} +9 -1
- package/system/dist/{addon-settings.cap-CZ4MC7ha.mjs → addon-settings.cap-CHpmuaQG.mjs} +1 -1
- package/system/dist/{addon-settings.cap-DrLdMFIe.js → addon-settings.cap-nZVHPo3X.js} +1 -1
- package/system/dist/{alert-episode-Be--PngO.mjs → alert-episode-D-1VUUkZ.mjs} +1 -1
- package/system/dist/{alert-episode-Bqktmt-i.js → alert-episode-DaQ3prSe.js} +1 -1
- package/system/dist/apps.cap-Bqb9NpYx.mjs +130 -0
- package/system/dist/apps.cap-CLjgnuUe.js +141 -0
- package/system/dist/{base-addon-CRsXtYFG.js → base-addon-BG7p06Hb.js} +136 -15
- package/system/dist/{base-addon-BcS6r1cT.mjs → base-addon-BcVoYZbC.mjs} +136 -15
- package/system/dist/{base-device-DAdWzDOl.js → base-device-DeSNiwZ4.js} +4 -4
- package/system/dist/{base-device-DJXF5eDN.mjs → base-device-w_MD0Bf4.mjs} +4 -4
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/alerts/alerts.addon.js +3 -3
- package/system/dist/builtins/alerts/alerts.addon.mjs +3 -3
- package/system/dist/builtins/apps-aggregator/aggregate-apps.d.ts +24 -0
- package/system/dist/builtins/apps-aggregator/apps-aggregator.addon.d.ts +16 -0
- package/system/dist/builtins/apps-aggregator/apps-aggregator.addon.js +109 -0
- package/system/dist/builtins/apps-aggregator/apps-aggregator.addon.mjs +103 -0
- package/system/dist/builtins/apps-aggregator/index.d.ts +1 -0
- package/system/dist/builtins/apps-aggregator/index.js +8 -0
- package/system/dist/builtins/apps-aggregator/index.mjs +2 -0
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +3 -3
- package/system/dist/builtins/camera-grid/index.mjs +3 -3
- package/system/dist/builtins/composer/composer.addon.js +7 -7
- package/system/dist/builtins/composer/composer.addon.mjs +7 -7
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/actions-store.d.ts +2 -0
- package/system/dist/builtins/core-blocks/block-supervisor.d.ts +16 -4
- package/system/dist/builtins/core-blocks/core-block-store.d.ts +2 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +1018 -323
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +986 -291
- package/system/dist/builtins/core-blocks/migrations/index.d.ts +5 -2
- package/system/dist/builtins/core-blocks/migrations/tag-ids.d.ts +42 -0
- package/system/dist/builtins/core-blocks/migrations/tags-as-records.d.ts +47 -0
- package/system/dist/builtins/core-blocks/record-kinds.d.ts +12 -1
- package/system/dist/builtins/core-blocks/runs-api.d.ts +3 -1
- package/system/dist/builtins/core-blocks/runs-ledger.d.ts +3 -1
- package/system/dist/builtins/core-blocks/scheduler/scheduler-store.d.ts +2 -0
- package/system/dist/builtins/core-blocks/tags-service.d.ts +52 -27
- package/system/dist/builtins/core-blocks/tags-wiring.d.ts +2 -0
- package/system/dist/builtins/core-notifier/core-notifier.addon.js +76 -67
- package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +76 -67
- package/system/dist/builtins/device-history/device-history.addon.js +4 -4
- package/system/dist/builtins/device-history/device-history.addon.mjs +4 -4
- package/system/dist/builtins/device-manager/device-manager.addon.js +1618 -755
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +1604 -741
- package/system/dist/builtins/device-manager/device-meta-actions.d.ts +13 -136
- package/system/dist/builtins/device-manager/device-meta-types.d.ts +5 -1
- package/system/dist/builtins/device-manager/device-provider-context.d.ts +9 -0
- package/system/dist/builtins/device-manager/device-row-store.d.ts +21 -4
- package/system/dist/builtins/device-manager/device-search.d.ts +6 -0
- package/system/dist/builtins/device-manager/location-alignment.d.ts +9 -2
- package/system/dist/builtins/device-manager/migrate-device.d.ts +7 -2
- package/system/dist/builtins/device-manager/migrate-hardware-state.d.ts +132 -1
- package/system/dist/builtins/device-manager/migrations/device-tag-ids.d.ts +25 -0
- package/system/dist/builtins/device-manager/migrations/index.d.ts +16 -0
- package/system/dist/builtins/device-manager/migrations/orphan-children.d.ts +33 -0
- package/system/dist/builtins/device-manager/migrations/ports.d.ts +17 -0
- package/system/dist/builtins/device-manager/migrations/rooms-as-records.d.ts +52 -0
- package/system/dist/builtins/device-manager/record-kinds.d.ts +3 -1
- package/system/dist/builtins/device-manager/removal-cleanup.d.ts +7 -0
- package/system/dist/builtins/device-manager/room-actions.d.ts +27 -0
- package/system/dist/builtins/device-manager/room-store.d.ts +19 -0
- package/system/dist/builtins/device-manager/tag-names.d.ts +32 -0
- package/system/dist/builtins/device-manager/wireable-enum-catalog.d.ts +18 -0
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +3 -3
- package/system/dist/builtins/keychain/index.mjs +3 -3
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
- package/system/dist/builtins/local-network/local-network.addon.js +2 -2
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/loki-logging/index.js +2 -2
- package/system/dist/builtins/loki-logging/index.mjs +2 -2
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +1 -1
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/migrations/migration-engine.d.ts +3 -1
- package/system/dist/builtins/sqlite-storage/migrations/migrations-provider.d.ts +1 -0
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +15 -10
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +15 -10
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/system-config/system-config.addon.js +2 -2
- package/system/dist/builtins/system-config/system-config.addon.mjs +2 -2
- package/system/dist/builtins/winston-logging/index.js +2 -2
- package/system/dist/builtins/winston-logging/index.mjs +2 -2
- package/system/dist/{command-catalog-C29hVOOg.js → command-catalog-A_ONlLfF.js} +1 -1
- package/system/dist/{command-catalog-xAeqxbZk.mjs → command-catalog-CZDlLhxO.mjs} +1 -1
- package/system/dist/{composition-sources-Do5qM6EB.js → composition-sources-D1nPv7dJ.js} +1 -1
- package/system/dist/{composition-sources-C327LGFn.mjs → composition-sources-DubMf_ii.mjs} +1 -1
- package/system/dist/{core-blocks.cap-CdTGUKtr.js → core-blocks.cap-DEYCvF9J.js} +125 -373
- package/system/dist/{core-blocks.cap-DLkEfV5b.mjs → core-blocks.cap-sW5HLDlB.mjs} +109 -327
- package/system/dist/{device-manager.cap-DJs8izI6.js → device-manager.cap-B9qVf7ag.js} +163 -22
- package/system/dist/{device-manager.cap-eYrj1Ezp.mjs → device-manager.cap-CV4KGp3e.mjs} +134 -17
- package/system/dist/{error.cap-CU1FB6uE.mjs → error.cap-B8l7L8e4.mjs} +7 -1
- package/system/dist/{error.cap-BuKbL3Ac.js → error.cap-BqlvgBJd.js} +7 -1
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/index.js +8 -8
- package/system/dist/index.mjs +7 -7
- package/system/dist/{legacy-integration-rows-door-CdqYAj-o.js → legacy-integration-rows-door-BK8eoGlF.js} +1 -1
- package/system/dist/{legacy-integration-rows-door-LSgpClpX.mjs → legacy-integration-rows-door-CwzC5XNk.mjs} +1 -1
- package/system/dist/{migration-DGAc6ywR.mjs → migration-BvbfW9g-.mjs} +6 -0
- package/system/dist/{migration-BOQlFZCN.js → migration-CHPdAdNh.js} +6 -0
- package/system/dist/{prefix-walk-Mtij0NNT.mjs → named-entity-store-Cq2oVrN5.mjs} +195 -89
- package/system/dist/{prefix-walk-BFnw8NBu.js → named-entity-store-O_hi1y_o.js} +244 -90
- package/system/dist/{notification-rules.cap-BUIuYPlQ.mjs → notification-rules.cap-ClvK6QT1.mjs} +10 -5
- package/system/dist/{notification-rules.cap-BJKUjizS.js → notification-rules.cap-uSLoe2pA.js} +10 -5
- package/system/dist/{notification-targets-DMW7xgR2.js → notification-targets-ChqpBbtR.js} +2 -2
- package/system/dist/{notification-targets-4bGYH5J7.mjs → notification-targets-DUA6-F2t.mjs} +2 -2
- package/system/dist/{device-row-store-CTocYKqC.mjs → record-kinds-BD2xv4Pd.mjs} +222 -93
- package/system/dist/{device-row-store-C0P2H18h.js → record-kinds-BV8Gcpsx.js} +246 -93
- package/system/dist/records/named-entity-store.d.ts +60 -0
- package/system/dist/{rename-composition-block-D9Uc1AF7.js → rename-composition-block-C60O0P16.js} +137 -33
- package/system/dist/{rename-composition-block-Cdh-dRmY.mjs → rename-composition-block-DcX3vkwS.mjs} +137 -33
- package/system/dist/{retention-source.cap-C6Hy0hlM.js → retention-source.cap-A-TMhU5O.js} +1 -1
- package/system/dist/{retention-source.cap-550kkyp5.mjs → retention-source.cap-Ct07pM30.mjs} +1 -1
- package/system/dist/{storage-admin.cap-Ci4QbL6P.mjs → storage-admin.cap-C54s9_B9.mjs} +8 -2
- package/system/dist/{storage-admin.cap-DqW1ol4j.js → storage-admin.cap-DSPHi7ut.js} +8 -2
- package/system/dist/{stream-catalog.cap-CjEQFknc.js → stream-catalog.cap-7WPsugOy.js} +1 -1
- package/system/dist/{stream-catalog.cap-DVniDdRD.mjs → stream-catalog.cap-CzwRDaqT.mjs} +1 -1
- package/system/dist/{tag-BxLazvVb.js → tag-BLraBqvp.js} +12 -0
- package/system/dist/{tag-uZBAq6ox.mjs → tag-DU8pm9Bi.mjs} +7 -1
- package/system/dist/time-window-B6UhCArd.js +679 -0
- package/system/dist/time-window-BnUBULgu.mjs +578 -0
- package/system/dist/{wal-maintenance-BgYiAy5b.js → wal-maintenance-CkPfVApC.js} +0 -0
- package/system/dist/{wal-maintenance-Bey5ChBb.mjs → wal-maintenance-u84_1sVl.mjs} +0 -0
- package/system/package.json +16 -1
- /package/system/dist/{constants-Ba3FTIHl.js → constants-Ba3FTIHl2.js} +0 -0
- /package/system/dist/{constants-DB4piTD5.mjs → constants-DB4piTD52.mjs} +0 -0
|
@@ -461,7 +461,9 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
461
461
|
* only way to keep the broker dialable. Camera providers (Reolink
|
|
462
462
|
* Baichuan native, …) subscribe and respond by re-running their publish
|
|
463
463
|
* pipeline.
|
|
464
|
-
* Payload: `{ deviceId, camStreamId, brokerId }`.
|
|
464
|
+
* Payload: `{ deviceId, camStreamId, brokerId, reason? }`. `reason` is
|
|
465
|
+
* `'source-silent'` when a no-packet watchdog asked: a still-listening cached
|
|
466
|
+
* server is then the dead one and must be recreated.
|
|
465
467
|
*/
|
|
466
468
|
EventCategory["StreamBrokerOnRequestStreamSourceRefresh"] = "stream-broker.onRequestStreamSourceRefresh";
|
|
467
469
|
/**
|
|
@@ -1321,7 +1323,8 @@ function typeOf(field) {
|
|
|
1321
1323
|
case "timezone":
|
|
1322
1324
|
case "datetime": return "string";
|
|
1323
1325
|
case "number":
|
|
1324
|
-
case "slider":
|
|
1326
|
+
case "slider":
|
|
1327
|
+
case "duration": return "number";
|
|
1325
1328
|
case "boolean": return "boolean";
|
|
1326
1329
|
default: return "other";
|
|
1327
1330
|
}
|
|
@@ -1435,12 +1438,41 @@ async function guarded(work) {
|
|
|
1435
1438
|
};
|
|
1436
1439
|
}
|
|
1437
1440
|
}
|
|
1441
|
+
var WAITING_REASON = /^dependency-(?:pending|blocked):(.+)$/;
|
|
1442
|
+
/**
|
|
1443
|
+
* What an owner keeps between runs: the steps blocked only on a predecessor not yet applied.
|
|
1444
|
+
* The engine announces every applied id (`migration.applied`); {@link releasedBy} says which
|
|
1445
|
+
* waiting steps that frees, so the owner runs them again without a restart or a timer.
|
|
1446
|
+
*/
|
|
1447
|
+
var MigrationDependencyWaits = class {
|
|
1448
|
+
waiting = /* @__PURE__ */ new Map();
|
|
1449
|
+
/** Replace what is waiting for the ids this run judged (a step that moved on stops waiting). */
|
|
1450
|
+
record(report, judged) {
|
|
1451
|
+
for (const id of judged) this.waiting.delete(id);
|
|
1452
|
+
for (const entry of report.awaiting) this.waiting.set(entry.id, entry.on);
|
|
1453
|
+
}
|
|
1454
|
+
/** Waiting steps whose predecessor is among `applied`; they stop waiting (the rerun re-records). */
|
|
1455
|
+
releasedBy(applied) {
|
|
1456
|
+
const freed = [...this.waiting].filter(([, on]) => applied.includes(on)).map(([id]) => id);
|
|
1457
|
+
for (const id of freed) this.waiting.delete(id);
|
|
1458
|
+
return freed;
|
|
1459
|
+
}
|
|
1460
|
+
get size() {
|
|
1461
|
+
return this.waiting.size;
|
|
1462
|
+
}
|
|
1463
|
+
};
|
|
1464
|
+
/** The ids a `migration.applied` event carries; anything else yields none. */
|
|
1465
|
+
function appliedIdsOf(data) {
|
|
1466
|
+
if (typeof data !== "object" || data === null || !("ids" in data) || !Array.isArray(data.ids)) return [];
|
|
1467
|
+
return data.ids.filter((id) => typeof id === "string");
|
|
1468
|
+
}
|
|
1438
1469
|
var NOT_RUN = {
|
|
1439
1470
|
declared: false,
|
|
1440
1471
|
snapshot: null,
|
|
1441
1472
|
applied: [],
|
|
1442
1473
|
failed: [],
|
|
1443
1474
|
blocked: [],
|
|
1475
|
+
awaiting: [],
|
|
1444
1476
|
skipped: [],
|
|
1445
1477
|
blockOwner: []
|
|
1446
1478
|
};
|
|
@@ -1460,7 +1492,8 @@ async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
|
1460
1492
|
declaration = await host.declareOwner({
|
|
1461
1493
|
owner,
|
|
1462
1494
|
metas: migrations.map((m) => m.meta),
|
|
1463
|
-
...options.retired === void 0 ? {} : { retired: [...options.retired] }
|
|
1495
|
+
...options.retired === void 0 ? {} : { retired: [...options.retired] },
|
|
1496
|
+
...options.complete === void 0 ? {} : { complete: options.complete }
|
|
1464
1497
|
});
|
|
1465
1498
|
} catch (err) {
|
|
1466
1499
|
log.error("the migration engine refused or could not take this addon catalogue — none ran", { meta: { error: require_scoped_settings.errMsg(err) } });
|
|
@@ -1472,6 +1505,7 @@ async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
|
1472
1505
|
const applied = [];
|
|
1473
1506
|
const failed = [];
|
|
1474
1507
|
const blocked = [];
|
|
1508
|
+
const awaiting = [];
|
|
1475
1509
|
const skipped = [];
|
|
1476
1510
|
const settle = (id, status) => {
|
|
1477
1511
|
if (status === "applied") applied.push(id);
|
|
@@ -1481,10 +1515,12 @@ async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
|
1481
1515
|
};
|
|
1482
1516
|
const selected = options.only === void 0 ? null : new Set(options.only);
|
|
1483
1517
|
const deferred = /* @__PURE__ */ new Set();
|
|
1518
|
+
const settledEarlier = new Set(options.settledEarlier ?? []);
|
|
1484
1519
|
const deferredBy = (reason) => {
|
|
1485
1520
|
if (selected === null || reason === null) return null;
|
|
1486
1521
|
const dep = /^dependency-(?:pending|blocked):(.+)$/.exec(reason)?.[1];
|
|
1487
1522
|
if (dep === void 0 || !byId.has(dep)) return null;
|
|
1523
|
+
if (settledEarlier.has(dep)) return null;
|
|
1488
1524
|
return !selected.has(dep) || deferred.has(dep) ? dep : null;
|
|
1489
1525
|
};
|
|
1490
1526
|
for (const step of declaration.steps) {
|
|
@@ -1518,6 +1554,11 @@ async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
|
1518
1554
|
reason: gate.reason
|
|
1519
1555
|
}
|
|
1520
1556
|
});
|
|
1557
|
+
const on = WAITING_REASON.exec(gate.reason ?? "")?.[1];
|
|
1558
|
+
if (on !== void 0) awaiting.push({
|
|
1559
|
+
id: step.id,
|
|
1560
|
+
on
|
|
1561
|
+
});
|
|
1521
1562
|
settle(step.id, gate.state === "pending" ? "blocked" : gate.state);
|
|
1522
1563
|
continue;
|
|
1523
1564
|
}
|
|
@@ -1550,6 +1591,7 @@ async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
|
1550
1591
|
applied,
|
|
1551
1592
|
failed,
|
|
1552
1593
|
blocked,
|
|
1594
|
+
awaiting,
|
|
1553
1595
|
skipped,
|
|
1554
1596
|
blockOwner
|
|
1555
1597
|
};
|
|
@@ -3249,6 +3291,7 @@ var BaseAddon = class {
|
|
|
3249
3291
|
});
|
|
3250
3292
|
await this.hydrateSwitches();
|
|
3251
3293
|
const result = await this.onInitialize();
|
|
3294
|
+
this.catalogueOpen = false;
|
|
3252
3295
|
await this.moveLateInstanceKinds();
|
|
3253
3296
|
await this.adoptUnrowed();
|
|
3254
3297
|
if (this.switchesHydrated) {
|
|
@@ -3296,7 +3339,14 @@ var BaseAddon = class {
|
|
|
3296
3339
|
registrySwitchSpec = null;
|
|
3297
3340
|
/** The instance kinds whose switch move this process already ran (or tried), by record kind name. */
|
|
3298
3341
|
switchMoved = /* @__PURE__ */ new Set();
|
|
3299
|
-
|
|
3342
|
+
/**
|
|
3343
|
+
* Every migration any `runMigrations` call of this process declared, by id. The engine replaces
|
|
3344
|
+
* an owner's catalogue on each declare, so each call carries the union, phased to its own ids.
|
|
3345
|
+
*/
|
|
3346
|
+
declaredAll = /* @__PURE__ */ new Map();
|
|
3347
|
+
/** True until `initialize` has run `onInitialize`: more kinds and calls may still declare. */
|
|
3348
|
+
catalogueOpen = true;
|
|
3349
|
+
declaredIncomplete = false;
|
|
3300
3350
|
/**
|
|
3301
3351
|
* Every switch migration this process added to a declaration so far, by id. The engine replaces
|
|
3302
3352
|
* an owner's catalogue on each declare, so a later one (a late kind) carries them all: dropping
|
|
@@ -3360,34 +3410,105 @@ var BaseAddon = class {
|
|
|
3360
3410
|
*/
|
|
3361
3411
|
async moveLateInstanceKinds() {
|
|
3362
3412
|
const late = servedInstanceKindsOf(this.ctx.id).filter((k) => !this.switchMoved.has(k.kind.name));
|
|
3363
|
-
if (late.length === 0)
|
|
3413
|
+
if (late.length === 0) {
|
|
3414
|
+
if (!this.declaredIncomplete) return;
|
|
3415
|
+
try {
|
|
3416
|
+
await this.runBound([], { only: [] });
|
|
3417
|
+
} catch (err) {
|
|
3418
|
+
if (err instanceof AddonMigrationsBlockedError) throw err;
|
|
3419
|
+
this.ctx.logger.error("the closing migration declare failed", { meta: { error: require_scoped_settings.errMsg(err) } });
|
|
3420
|
+
}
|
|
3421
|
+
return;
|
|
3422
|
+
}
|
|
3364
3423
|
try {
|
|
3365
3424
|
const only = late.map((k) => bodySwitchToRegistryId(this.ctx.id, "2026-11-19", k.kind.name));
|
|
3366
|
-
await this.runBound(
|
|
3425
|
+
await this.runBound([], { only });
|
|
3367
3426
|
} catch (err) {
|
|
3368
3427
|
if (err instanceof AddonMigrationsBlockedError) throw err;
|
|
3369
3428
|
this.ctx.logger.error("the late instance switch move failed", { meta: { error: require_scoped_settings.errMsg(err) } });
|
|
3370
3429
|
}
|
|
3371
3430
|
}
|
|
3431
|
+
/** Steps blocked only on another owner's step that has not applied yet (run again when it does). */
|
|
3432
|
+
migrationWaits = new MigrationDependencyWaits();
|
|
3433
|
+
migrationWatch = false;
|
|
3434
|
+
/** Every id announced applied since the subscription: closes the in-flight-run window. */
|
|
3435
|
+
migrationAppliedSeen = /* @__PURE__ */ new Set();
|
|
3436
|
+
migrationRerunTail = Promise.resolve();
|
|
3437
|
+
/**
|
|
3438
|
+
* The engine announces every applied step (`migration.applied`). Subscribed BEFORE the first
|
|
3439
|
+
* declare, so a predecessor that lands between this owner's read and its subscription is not
|
|
3440
|
+
* missed; a step the engine blocked on one runs when that predecessor applies, with no restart.
|
|
3441
|
+
*/
|
|
3442
|
+
watchAppliedMigrations() {
|
|
3443
|
+
if (this.migrationWatch) return;
|
|
3444
|
+
this.migrationWatch = true;
|
|
3445
|
+
this.subscribe({ category: EventCategory.MigrationApplied }, (event) => {
|
|
3446
|
+
const ids = appliedIdsOf(event.data);
|
|
3447
|
+
for (const id of ids) this.migrationAppliedSeen.add(id);
|
|
3448
|
+
this.releaseBlockedMigrations(ids);
|
|
3449
|
+
});
|
|
3450
|
+
}
|
|
3451
|
+
/**
|
|
3452
|
+
* Run again the waiting steps whose predecessor is among `applied`. The event is a hint (D8):
|
|
3453
|
+
* a dropped one leaves the step blocked until this addon's next boot, which reads the ledger.
|
|
3454
|
+
*/
|
|
3455
|
+
releaseBlockedMigrations(applied) {
|
|
3456
|
+
const freed = this.migrationWaits.releasedBy(applied);
|
|
3457
|
+
if (freed.length === 0) return;
|
|
3458
|
+
this.migrationRerunTail = this.migrationRerunTail.catch(() => void 0).then(async () => {
|
|
3459
|
+
this.ctx.logger.info("a migration predecessor applied — running the blocked steps", { meta: { ids: freed } });
|
|
3460
|
+
await this.runBound([], { only: freed });
|
|
3461
|
+
}).then(() => void 0, (err) => {
|
|
3462
|
+
this.ctx.logger.error("the blocked migration steps could not run again", { meta: {
|
|
3463
|
+
ids: freed,
|
|
3464
|
+
error: require_scoped_settings.errMsg(err)
|
|
3465
|
+
} });
|
|
3466
|
+
});
|
|
3467
|
+
}
|
|
3372
3468
|
async runBound(declared, options) {
|
|
3373
|
-
this.
|
|
3469
|
+
this.watchAppliedMigrations();
|
|
3470
|
+
const priorIds = new Set([...this.declaredAll.keys(), ...this.switchDeclared.keys()]);
|
|
3374
3471
|
const added = this.registrySwitchBound();
|
|
3375
3472
|
for (const m of added) this.switchDeclared.set(m.meta.id, m);
|
|
3376
|
-
const
|
|
3377
|
-
const
|
|
3473
|
+
for (const m of declared) this.declaredAll.set(m.meta.id, m);
|
|
3474
|
+
const migrations = [...this.declaredAll.values(), ...[...this.switchDeclared.values()].filter((m) => !this.declaredAll.has(m.meta.id))];
|
|
3475
|
+
const settledEarlier = [...priorIds].filter((id) => !declared.some((d) => d.meta.id === id));
|
|
3476
|
+
const own = settledEarlier.length === 0 ? options ?? {} : {
|
|
3378
3477
|
...options,
|
|
3379
|
-
only
|
|
3478
|
+
...options?.only === void 0 ? { only: declared.map((m) => m.meta.id) } : {},
|
|
3479
|
+
settledEarlier
|
|
3380
3480
|
};
|
|
3381
|
-
const
|
|
3382
|
-
...
|
|
3383
|
-
|
|
3481
|
+
const widened = own?.only === void 0 || added.length === 0 ? own : {
|
|
3482
|
+
...own,
|
|
3483
|
+
only: [...new Set([...own.only, ...added.map((m) => m.meta.id)])]
|
|
3484
|
+
};
|
|
3485
|
+
if (this.catalogueOpen) this.declaredIncomplete = true;
|
|
3486
|
+
const declare = {
|
|
3487
|
+
...this.retiredMigrationIds.length === 0 ? widened ?? {} : {
|
|
3488
|
+
...widened,
|
|
3489
|
+
retired: this.retiredMigrationIds
|
|
3490
|
+
},
|
|
3491
|
+
complete: !this.catalogueOpen
|
|
3384
3492
|
};
|
|
3385
3493
|
const api = this.ctx.api.migrations;
|
|
3386
|
-
const
|
|
3494
|
+
const host = {
|
|
3387
3495
|
declareOwner: (input) => api.declareOwner.mutate(input),
|
|
3388
3496
|
startMigration: (input) => api.startMigration.mutate(input),
|
|
3389
3497
|
finishMigration: (input) => api.finishMigration.mutate(input)
|
|
3390
|
-
}
|
|
3498
|
+
};
|
|
3499
|
+
const report = await runAddonMigrations(host, migrations, this.ctx.logger, declare);
|
|
3500
|
+
if (declare.complete === false && !this.catalogueOpen) await runAddonMigrations(host, [...new Map([...this.declaredAll, ...this.switchDeclared]).values()], this.ctx.logger, {
|
|
3501
|
+
...this.retiredMigrationIds.length === 0 ? {} : { retired: this.retiredMigrationIds },
|
|
3502
|
+
only: [],
|
|
3503
|
+
complete: true
|
|
3504
|
+
});
|
|
3505
|
+
this.migrationWaits.record(report, [
|
|
3506
|
+
...report.applied,
|
|
3507
|
+
...report.failed,
|
|
3508
|
+
...report.blocked,
|
|
3509
|
+
...report.skipped
|
|
3510
|
+
]);
|
|
3511
|
+
this.releaseBlockedMigrations([...this.migrationAppliedSeen]);
|
|
3391
3512
|
if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
|
|
3392
3513
|
await this.hydrateSwitches();
|
|
3393
3514
|
await this.adoptUnrowed();
|
|
@@ -461,7 +461,9 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
461
461
|
* only way to keep the broker dialable. Camera providers (Reolink
|
|
462
462
|
* Baichuan native, …) subscribe and respond by re-running their publish
|
|
463
463
|
* pipeline.
|
|
464
|
-
* Payload: `{ deviceId, camStreamId, brokerId }`.
|
|
464
|
+
* Payload: `{ deviceId, camStreamId, brokerId, reason? }`. `reason` is
|
|
465
|
+
* `'source-silent'` when a no-packet watchdog asked: a still-listening cached
|
|
466
|
+
* server is then the dead one and must be recreated.
|
|
465
467
|
*/
|
|
466
468
|
EventCategory["StreamBrokerOnRequestStreamSourceRefresh"] = "stream-broker.onRequestStreamSourceRefresh";
|
|
467
469
|
/**
|
|
@@ -1321,7 +1323,8 @@ function typeOf(field) {
|
|
|
1321
1323
|
case "timezone":
|
|
1322
1324
|
case "datetime": return "string";
|
|
1323
1325
|
case "number":
|
|
1324
|
-
case "slider":
|
|
1326
|
+
case "slider":
|
|
1327
|
+
case "duration": return "number";
|
|
1325
1328
|
case "boolean": return "boolean";
|
|
1326
1329
|
default: return "other";
|
|
1327
1330
|
}
|
|
@@ -1435,12 +1438,41 @@ async function guarded(work) {
|
|
|
1435
1438
|
};
|
|
1436
1439
|
}
|
|
1437
1440
|
}
|
|
1441
|
+
var WAITING_REASON = /^dependency-(?:pending|blocked):(.+)$/;
|
|
1442
|
+
/**
|
|
1443
|
+
* What an owner keeps between runs: the steps blocked only on a predecessor not yet applied.
|
|
1444
|
+
* The engine announces every applied id (`migration.applied`); {@link releasedBy} says which
|
|
1445
|
+
* waiting steps that frees, so the owner runs them again without a restart or a timer.
|
|
1446
|
+
*/
|
|
1447
|
+
var MigrationDependencyWaits = class {
|
|
1448
|
+
waiting = /* @__PURE__ */ new Map();
|
|
1449
|
+
/** Replace what is waiting for the ids this run judged (a step that moved on stops waiting). */
|
|
1450
|
+
record(report, judged) {
|
|
1451
|
+
for (const id of judged) this.waiting.delete(id);
|
|
1452
|
+
for (const entry of report.awaiting) this.waiting.set(entry.id, entry.on);
|
|
1453
|
+
}
|
|
1454
|
+
/** Waiting steps whose predecessor is among `applied`; they stop waiting (the rerun re-records). */
|
|
1455
|
+
releasedBy(applied) {
|
|
1456
|
+
const freed = [...this.waiting].filter(([, on]) => applied.includes(on)).map(([id]) => id);
|
|
1457
|
+
for (const id of freed) this.waiting.delete(id);
|
|
1458
|
+
return freed;
|
|
1459
|
+
}
|
|
1460
|
+
get size() {
|
|
1461
|
+
return this.waiting.size;
|
|
1462
|
+
}
|
|
1463
|
+
};
|
|
1464
|
+
/** The ids a `migration.applied` event carries; anything else yields none. */
|
|
1465
|
+
function appliedIdsOf(data) {
|
|
1466
|
+
if (typeof data !== "object" || data === null || !("ids" in data) || !Array.isArray(data.ids)) return [];
|
|
1467
|
+
return data.ids.filter((id) => typeof id === "string");
|
|
1468
|
+
}
|
|
1438
1469
|
var NOT_RUN = {
|
|
1439
1470
|
declared: false,
|
|
1440
1471
|
snapshot: null,
|
|
1441
1472
|
applied: [],
|
|
1442
1473
|
failed: [],
|
|
1443
1474
|
blocked: [],
|
|
1475
|
+
awaiting: [],
|
|
1444
1476
|
skipped: [],
|
|
1445
1477
|
blockOwner: []
|
|
1446
1478
|
};
|
|
@@ -1460,7 +1492,8 @@ async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
|
1460
1492
|
declaration = await host.declareOwner({
|
|
1461
1493
|
owner,
|
|
1462
1494
|
metas: migrations.map((m) => m.meta),
|
|
1463
|
-
...options.retired === void 0 ? {} : { retired: [...options.retired] }
|
|
1495
|
+
...options.retired === void 0 ? {} : { retired: [...options.retired] },
|
|
1496
|
+
...options.complete === void 0 ? {} : { complete: options.complete }
|
|
1464
1497
|
});
|
|
1465
1498
|
} catch (err) {
|
|
1466
1499
|
log.error("the migration engine refused or could not take this addon catalogue — none ran", { meta: { error: errMsg(err) } });
|
|
@@ -1472,6 +1505,7 @@ async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
|
1472
1505
|
const applied = [];
|
|
1473
1506
|
const failed = [];
|
|
1474
1507
|
const blocked = [];
|
|
1508
|
+
const awaiting = [];
|
|
1475
1509
|
const skipped = [];
|
|
1476
1510
|
const settle = (id, status) => {
|
|
1477
1511
|
if (status === "applied") applied.push(id);
|
|
@@ -1481,10 +1515,12 @@ async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
|
1481
1515
|
};
|
|
1482
1516
|
const selected = options.only === void 0 ? null : new Set(options.only);
|
|
1483
1517
|
const deferred = /* @__PURE__ */ new Set();
|
|
1518
|
+
const settledEarlier = new Set(options.settledEarlier ?? []);
|
|
1484
1519
|
const deferredBy = (reason) => {
|
|
1485
1520
|
if (selected === null || reason === null) return null;
|
|
1486
1521
|
const dep = /^dependency-(?:pending|blocked):(.+)$/.exec(reason)?.[1];
|
|
1487
1522
|
if (dep === void 0 || !byId.has(dep)) return null;
|
|
1523
|
+
if (settledEarlier.has(dep)) return null;
|
|
1488
1524
|
return !selected.has(dep) || deferred.has(dep) ? dep : null;
|
|
1489
1525
|
};
|
|
1490
1526
|
for (const step of declaration.steps) {
|
|
@@ -1518,6 +1554,11 @@ async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
|
1518
1554
|
reason: gate.reason
|
|
1519
1555
|
}
|
|
1520
1556
|
});
|
|
1557
|
+
const on = WAITING_REASON.exec(gate.reason ?? "")?.[1];
|
|
1558
|
+
if (on !== void 0) awaiting.push({
|
|
1559
|
+
id: step.id,
|
|
1560
|
+
on
|
|
1561
|
+
});
|
|
1521
1562
|
settle(step.id, gate.state === "pending" ? "blocked" : gate.state);
|
|
1522
1563
|
continue;
|
|
1523
1564
|
}
|
|
@@ -1550,6 +1591,7 @@ async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
|
1550
1591
|
applied,
|
|
1551
1592
|
failed,
|
|
1552
1593
|
blocked,
|
|
1594
|
+
awaiting,
|
|
1553
1595
|
skipped,
|
|
1554
1596
|
blockOwner
|
|
1555
1597
|
};
|
|
@@ -3249,6 +3291,7 @@ var BaseAddon = class {
|
|
|
3249
3291
|
});
|
|
3250
3292
|
await this.hydrateSwitches();
|
|
3251
3293
|
const result = await this.onInitialize();
|
|
3294
|
+
this.catalogueOpen = false;
|
|
3252
3295
|
await this.moveLateInstanceKinds();
|
|
3253
3296
|
await this.adoptUnrowed();
|
|
3254
3297
|
if (this.switchesHydrated) {
|
|
@@ -3296,7 +3339,14 @@ var BaseAddon = class {
|
|
|
3296
3339
|
registrySwitchSpec = null;
|
|
3297
3340
|
/** The instance kinds whose switch move this process already ran (or tried), by record kind name. */
|
|
3298
3341
|
switchMoved = /* @__PURE__ */ new Set();
|
|
3299
|
-
|
|
3342
|
+
/**
|
|
3343
|
+
* Every migration any `runMigrations` call of this process declared, by id. The engine replaces
|
|
3344
|
+
* an owner's catalogue on each declare, so each call carries the union, phased to its own ids.
|
|
3345
|
+
*/
|
|
3346
|
+
declaredAll = /* @__PURE__ */ new Map();
|
|
3347
|
+
/** True until `initialize` has run `onInitialize`: more kinds and calls may still declare. */
|
|
3348
|
+
catalogueOpen = true;
|
|
3349
|
+
declaredIncomplete = false;
|
|
3300
3350
|
/**
|
|
3301
3351
|
* Every switch migration this process added to a declaration so far, by id. The engine replaces
|
|
3302
3352
|
* an owner's catalogue on each declare, so a later one (a late kind) carries them all: dropping
|
|
@@ -3360,34 +3410,105 @@ var BaseAddon = class {
|
|
|
3360
3410
|
*/
|
|
3361
3411
|
async moveLateInstanceKinds() {
|
|
3362
3412
|
const late = servedInstanceKindsOf(this.ctx.id).filter((k) => !this.switchMoved.has(k.kind.name));
|
|
3363
|
-
if (late.length === 0)
|
|
3413
|
+
if (late.length === 0) {
|
|
3414
|
+
if (!this.declaredIncomplete) return;
|
|
3415
|
+
try {
|
|
3416
|
+
await this.runBound([], { only: [] });
|
|
3417
|
+
} catch (err) {
|
|
3418
|
+
if (err instanceof AddonMigrationsBlockedError) throw err;
|
|
3419
|
+
this.ctx.logger.error("the closing migration declare failed", { meta: { error: errMsg(err) } });
|
|
3420
|
+
}
|
|
3421
|
+
return;
|
|
3422
|
+
}
|
|
3364
3423
|
try {
|
|
3365
3424
|
const only = late.map((k) => bodySwitchToRegistryId(this.ctx.id, "2026-11-19", k.kind.name));
|
|
3366
|
-
await this.runBound(
|
|
3425
|
+
await this.runBound([], { only });
|
|
3367
3426
|
} catch (err) {
|
|
3368
3427
|
if (err instanceof AddonMigrationsBlockedError) throw err;
|
|
3369
3428
|
this.ctx.logger.error("the late instance switch move failed", { meta: { error: errMsg(err) } });
|
|
3370
3429
|
}
|
|
3371
3430
|
}
|
|
3431
|
+
/** Steps blocked only on another owner's step that has not applied yet (run again when it does). */
|
|
3432
|
+
migrationWaits = new MigrationDependencyWaits();
|
|
3433
|
+
migrationWatch = false;
|
|
3434
|
+
/** Every id announced applied since the subscription: closes the in-flight-run window. */
|
|
3435
|
+
migrationAppliedSeen = /* @__PURE__ */ new Set();
|
|
3436
|
+
migrationRerunTail = Promise.resolve();
|
|
3437
|
+
/**
|
|
3438
|
+
* The engine announces every applied step (`migration.applied`). Subscribed BEFORE the first
|
|
3439
|
+
* declare, so a predecessor that lands between this owner's read and its subscription is not
|
|
3440
|
+
* missed; a step the engine blocked on one runs when that predecessor applies, with no restart.
|
|
3441
|
+
*/
|
|
3442
|
+
watchAppliedMigrations() {
|
|
3443
|
+
if (this.migrationWatch) return;
|
|
3444
|
+
this.migrationWatch = true;
|
|
3445
|
+
this.subscribe({ category: EventCategory.MigrationApplied }, (event) => {
|
|
3446
|
+
const ids = appliedIdsOf(event.data);
|
|
3447
|
+
for (const id of ids) this.migrationAppliedSeen.add(id);
|
|
3448
|
+
this.releaseBlockedMigrations(ids);
|
|
3449
|
+
});
|
|
3450
|
+
}
|
|
3451
|
+
/**
|
|
3452
|
+
* Run again the waiting steps whose predecessor is among `applied`. The event is a hint (D8):
|
|
3453
|
+
* a dropped one leaves the step blocked until this addon's next boot, which reads the ledger.
|
|
3454
|
+
*/
|
|
3455
|
+
releaseBlockedMigrations(applied) {
|
|
3456
|
+
const freed = this.migrationWaits.releasedBy(applied);
|
|
3457
|
+
if (freed.length === 0) return;
|
|
3458
|
+
this.migrationRerunTail = this.migrationRerunTail.catch(() => void 0).then(async () => {
|
|
3459
|
+
this.ctx.logger.info("a migration predecessor applied — running the blocked steps", { meta: { ids: freed } });
|
|
3460
|
+
await this.runBound([], { only: freed });
|
|
3461
|
+
}).then(() => void 0, (err) => {
|
|
3462
|
+
this.ctx.logger.error("the blocked migration steps could not run again", { meta: {
|
|
3463
|
+
ids: freed,
|
|
3464
|
+
error: errMsg(err)
|
|
3465
|
+
} });
|
|
3466
|
+
});
|
|
3467
|
+
}
|
|
3372
3468
|
async runBound(declared, options) {
|
|
3373
|
-
this.
|
|
3469
|
+
this.watchAppliedMigrations();
|
|
3470
|
+
const priorIds = new Set([...this.declaredAll.keys(), ...this.switchDeclared.keys()]);
|
|
3374
3471
|
const added = this.registrySwitchBound();
|
|
3375
3472
|
for (const m of added) this.switchDeclared.set(m.meta.id, m);
|
|
3376
|
-
const
|
|
3377
|
-
const
|
|
3473
|
+
for (const m of declared) this.declaredAll.set(m.meta.id, m);
|
|
3474
|
+
const migrations = [...this.declaredAll.values(), ...[...this.switchDeclared.values()].filter((m) => !this.declaredAll.has(m.meta.id))];
|
|
3475
|
+
const settledEarlier = [...priorIds].filter((id) => !declared.some((d) => d.meta.id === id));
|
|
3476
|
+
const own = settledEarlier.length === 0 ? options ?? {} : {
|
|
3378
3477
|
...options,
|
|
3379
|
-
only
|
|
3478
|
+
...options?.only === void 0 ? { only: declared.map((m) => m.meta.id) } : {},
|
|
3479
|
+
settledEarlier
|
|
3380
3480
|
};
|
|
3381
|
-
const
|
|
3382
|
-
...
|
|
3383
|
-
|
|
3481
|
+
const widened = own?.only === void 0 || added.length === 0 ? own : {
|
|
3482
|
+
...own,
|
|
3483
|
+
only: [...new Set([...own.only, ...added.map((m) => m.meta.id)])]
|
|
3484
|
+
};
|
|
3485
|
+
if (this.catalogueOpen) this.declaredIncomplete = true;
|
|
3486
|
+
const declare = {
|
|
3487
|
+
...this.retiredMigrationIds.length === 0 ? widened ?? {} : {
|
|
3488
|
+
...widened,
|
|
3489
|
+
retired: this.retiredMigrationIds
|
|
3490
|
+
},
|
|
3491
|
+
complete: !this.catalogueOpen
|
|
3384
3492
|
};
|
|
3385
3493
|
const api = this.ctx.api.migrations;
|
|
3386
|
-
const
|
|
3494
|
+
const host = {
|
|
3387
3495
|
declareOwner: (input) => api.declareOwner.mutate(input),
|
|
3388
3496
|
startMigration: (input) => api.startMigration.mutate(input),
|
|
3389
3497
|
finishMigration: (input) => api.finishMigration.mutate(input)
|
|
3390
|
-
}
|
|
3498
|
+
};
|
|
3499
|
+
const report = await runAddonMigrations(host, migrations, this.ctx.logger, declare);
|
|
3500
|
+
if (declare.complete === false && !this.catalogueOpen) await runAddonMigrations(host, [...new Map([...this.declaredAll, ...this.switchDeclared]).values()], this.ctx.logger, {
|
|
3501
|
+
...this.retiredMigrationIds.length === 0 ? {} : { retired: this.retiredMigrationIds },
|
|
3502
|
+
only: [],
|
|
3503
|
+
complete: true
|
|
3504
|
+
});
|
|
3505
|
+
this.migrationWaits.record(report, [
|
|
3506
|
+
...report.applied,
|
|
3507
|
+
...report.failed,
|
|
3508
|
+
...report.blocked,
|
|
3509
|
+
...report.skipped
|
|
3510
|
+
]);
|
|
3511
|
+
this.releaseBlockedMigrations([...this.migrationAppliedSeen]);
|
|
3391
3512
|
if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
|
|
3392
3513
|
await this.hydrateSwitches();
|
|
3393
3514
|
await this.adoptUnrowed();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const require_stream_catalog_cap = require("./stream-catalog.cap-
|
|
2
|
-
const require_base_addon = require("./base-addon-
|
|
1
|
+
const require_stream_catalog_cap = require("./stream-catalog.cap-7WPsugOy.js");
|
|
2
|
+
const require_base_addon = require("./base-addon-BG7p06Hb.js");
|
|
3
3
|
const require_scoped_settings = require("./scoped-settings-CylSSq_8.js");
|
|
4
4
|
const require_zod_secret = require("./zod-secret-DS7mj1bk.js");
|
|
5
5
|
const require_device_identifiers = require("./device-identifiers-BQg9EQi1.js");
|
|
6
6
|
const require_source_info = require("./source-info-DtWf4k2j.js");
|
|
7
|
-
const require_error_cap = require("./error.cap-
|
|
8
|
-
const require_alert_episode = require("./alert-episode-
|
|
7
|
+
const require_error_cap = require("./error.cap-BqlvgBJd.js");
|
|
8
|
+
const require_alert_episode = require("./alert-episode-DaQ3prSe.js");
|
|
9
9
|
//#region ../types/dist/esm/device/device-config.mjs
|
|
10
10
|
var DeviceConfig = class DeviceConfig {
|
|
11
11
|
schema;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { E as deviceStatusCapability, w as featureProbeCapability } from "./stream-catalog.cap-
|
|
2
|
-
import { p as createEvent } from "./base-addon-
|
|
1
|
+
import { E as deviceStatusCapability, w as featureProbeCapability } from "./stream-catalog.cap-CzwRDaqT.mjs";
|
|
2
|
+
import { p as createEvent } from "./base-addon-BcVoYZbC.mjs";
|
|
3
3
|
import { Z as errMsg } from "./scoped-settings-DVWUIP7Z.mjs";
|
|
4
4
|
import { t as collectZodSecretPaths } from "./zod-secret-zY4nM61M.mjs";
|
|
5
5
|
import { a as isEmptyIdentifiers, s as normaliseIdentifiers, t as DEVICE_IDENTIFIER_KEYS } from "./device-identifiers-iSuQCKmK.mjs";
|
|
6
6
|
import { i as mergeSourceInfo, o as synthesizeSourceInfo, r as extractSourceInfoFromMetadata, t as SOURCE_INFO_METADATA_KEY } from "./source-info-DGB7SdB_.mjs";
|
|
7
|
-
import { i as errorCapability, r as ERROR_STATUS_COLD } from "./error.cap-
|
|
8
|
-
import { t as DEVICE_ERROR_ALERT_CATEGORY } from "./alert-episode-
|
|
7
|
+
import { i as errorCapability, r as ERROR_STATUS_COLD } from "./error.cap-B8l7L8e4.mjs";
|
|
8
|
+
import { t as DEVICE_ERROR_ALERT_CATEGORY } from "./alert-episode-D-1VUUkZ.mjs";
|
|
9
9
|
//#region ../types/dist/esm/device/device-config.mjs
|
|
10
10
|
var DeviceConfig = class DeviceConfig {
|
|
11
11
|
schema;
|
|
@@ -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_base_addon = require("../../base-addon-
|
|
6
|
+
const require_base_addon = require("../../base-addon-BG7p06Hb.js");
|
|
7
7
|
const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
|
|
8
8
|
const require_addon_pages_cap = require("../../addon-pages.cap-B3gHFDYW.js");
|
|
9
9
|
const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as EventCategory, t as BaseAddon } from "../../base-addon-
|
|
1
|
+
import { b as EventCategory, t as BaseAddon } from "../../base-addon-BcVoYZbC.mjs";
|
|
2
2
|
import { Z as errMsg } from "../../scoped-settings-DVWUIP7Z.mjs";
|
|
3
3
|
import { t as addonPagesCapability } from "../../addon-pages.cap-BLNN6ypr.mjs";
|
|
4
4
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
@@ -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_base_addon = require("../../base-addon-
|
|
6
|
+
const require_base_addon = require("../../base-addon-BG7p06Hb.js");
|
|
7
7
|
const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
|
|
8
8
|
const require_addon_widgets_cap = require("../../addon-widgets.cap-DuCe2VRj.js");
|
|
9
9
|
const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as EventCategory, t as BaseAddon } from "../../base-addon-
|
|
1
|
+
import { b as EventCategory, t as BaseAddon } from "../../base-addon-BcVoYZbC.mjs";
|
|
2
2
|
import { Z as errMsg } from "../../scoped-settings-DVWUIP7Z.mjs";
|
|
3
3
|
import { t as addonWidgetsCapability } from "../../addon-widgets.cap-BbmWMzIH.mjs";
|
|
4
4
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
@@ -3,12 +3,12 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_base_addon = require("../../base-addon-
|
|
6
|
+
const require_base_addon = require("../../base-addon-BG7p06Hb.js");
|
|
7
7
|
const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
|
|
8
8
|
const require_record_kind = require("../../record-kind-DoBfYHCs.js");
|
|
9
|
-
const require_core_blocks_cap = require("../../core-blocks.cap-
|
|
9
|
+
const require_core_blocks_cap = require("../../core-blocks.cap-DEYCvF9J.js");
|
|
10
10
|
const require_compile = require("../../compile-SpeAhaZ6.js");
|
|
11
|
-
const require_alert_episode = require("../../alert-episode-
|
|
11
|
+
const require_alert_episode = require("../../alert-episode-DaQ3prSe.js");
|
|
12
12
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
13
13
|
const require_log_redactor = require("../../log-redactor-BhIEMaG9.js");
|
|
14
14
|
let node_fs = require("node:fs");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { b as EventCategory, p as createEvent, t as BaseAddon } from "../../base-addon-
|
|
1
|
+
import { b as EventCategory, p as createEvent, t as BaseAddon } from "../../base-addon-BcVoYZbC.mjs";
|
|
2
2
|
import { Z as errMsg } from "../../scoped-settings-DVWUIP7Z.mjs";
|
|
3
3
|
import { s as defineRecordKinds } from "../../record-kind-ub6NXqfh.mjs";
|
|
4
|
-
import { n as CORE_BLOCK_ADDON_PREFIX } from "../../core-blocks.cap-
|
|
4
|
+
import { n as CORE_BLOCK_ADDON_PREFIX } from "../../core-blocks.cap-sW5HLDlB.mjs";
|
|
5
5
|
import { it as alertsCapability, rt as AlertSchema } from "../../compile-OBMHlqD-.mjs";
|
|
6
|
-
import { a as isAlertEpisodeOpen, i as alertEpisodeRank, n as alertEpisodeId, r as alertEpisodePayload } from "../../alert-episode-
|
|
6
|
+
import { a as isAlertEpisodeOpen, i as alertEpisodeRank, n as alertEpisodeId, r as alertEpisodePayload } from "../../alert-episode-D-1VUUkZ.mjs";
|
|
7
7
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
8
8
|
import { a as redactLogText } from "../../log-redactor-XLDrPzOi.mjs";
|
|
9
9
|
import * as fs$1 from "node:fs";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AppDeclaration, AppInfo, IAppSourceProvider } from "@camstack/types";
|
|
2
|
+
/** Per-source ceiling: one dead provider must not stall the shell's app list. */
|
|
3
|
+
export declare const APPS_PER_SOURCE_TIMEOUT_MS = 2500;
|
|
4
|
+
export interface AppsCaller {
|
|
5
|
+
readonly isAdmin: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface AppsLogger {
|
|
8
|
+
warn(message: string, context?: {
|
|
9
|
+
readonly meta?: Readonly<Record<string, unknown>>;
|
|
10
|
+
}): void;
|
|
11
|
+
}
|
|
12
|
+
export type AppSourceEntry = IAppSourceProvider & {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Merge every `app-source` provider into the caller's list (D1096): stamp the
|
|
17
|
+
* provider id, drop what the caller's role may not see, order by `order`.
|
|
18
|
+
* A provider that fails or times out is logged with its reason and answered
|
|
19
|
+
* from its last good snapshot (`lastGood`, owned by the caller) or skipped when
|
|
20
|
+
* it has none. The same app reported by several nodes (a collection registers
|
|
21
|
+
* one provider per node) is listed once, keyed on `(addonId, app.id)`, the
|
|
22
|
+
* first provider winning: the hub-local one precedes remote ones.
|
|
23
|
+
*/
|
|
24
|
+
export declare function aggregateApps(sources: readonly AppSourceEntry[], caller: AppsCaller, logger: AppsLogger, lastGood?: Map<string, readonly AppDeclaration[]>): Promise<readonly AppInfo[]>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apps Aggregator — hub-local builtin that owns the singleton `apps` cap (D1096).
|
|
3
|
+
*
|
|
4
|
+
* Walks every `app-source` (collection) provider, stamps each app with the
|
|
5
|
+
* provider's addon id and filters by the caller's role. The shell reads it; no
|
|
6
|
+
* app id is spelled anywhere else.
|
|
7
|
+
*/
|
|
8
|
+
import { BaseAddon, type ProviderRegistration } from "@camstack/types";
|
|
9
|
+
export declare class AppsAggregatorAddon extends BaseAddon {
|
|
10
|
+
readonly id = "apps-aggregator";
|
|
11
|
+
/** Last good declarations per source, the fallback for a transient failure. */
|
|
12
|
+
private readonly lastGood;
|
|
13
|
+
constructor();
|
|
14
|
+
protected onInitialize(): Promise<ProviderRegistration[]>;
|
|
15
|
+
}
|
|
16
|
+
export default AppsAggregatorAddon;
|