@camstack/server 1.2.943 → 1.2.944
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 +20 -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-routers.js +83 -0
- 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 +21 -11
- package/system/dist/{action-index-B1fgpQBt.mjs → action-index-DpYmsOKh.mjs} +1 -1
- package/system/dist/{action-index-B_cLRwXJ.js → action-index-Dz9rd1qa.js} +1 -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/{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/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 +1602 -760
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +1588 -746
- 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 +2 -2
- package/system/dist/builtins/keychain/index.mjs +2 -2
- 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 +1 -1
- package/system/dist/builtins/system-config/system-config.addon.mjs +1 -1
- 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-CI0tu1Nt.js} +1 -1
- package/system/dist/{command-catalog-xAeqxbZk.mjs → command-catalog-zwlIA3T5.mjs} +1 -1
- package/system/dist/{composition-sources-C327LGFn.mjs → composition-sources-CXxXfh1z.mjs} +1 -1
- package/system/dist/{composition-sources-Do5qM6EB.js → composition-sources-DNgSItK-.js} +1 -1
- package/system/dist/{core-blocks.cap-CdTGUKtr.js → core-blocks.cap-BHEok4VO.js} +125 -373
- package/system/dist/{core-blocks.cap-DLkEfV5b.mjs → core-blocks.cap-CPgZRcpj.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 +7 -7
- package/system/dist/index.mjs +6 -6
- 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-BFnw8NBu.js → named-entity-store-DFwLij9c.js} +244 -90
- package/system/dist/{prefix-walk-Mtij0NNT.mjs → named-entity-store-DOnyyFFf.mjs} +195 -89
- 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-Cdh-dRmY.mjs → rename-composition-block-C3QQ9UUE.mjs} +134 -33
- package/system/dist/{rename-composition-block-D9Uc1AF7.js → rename-composition-block-Cx3X8QSm.js} +134 -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 +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.944",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"system/assets",
|
|
19
19
|
"system/package.json",
|
|
20
20
|
"scripts/closure-postinstall.mjs",
|
|
21
|
+
"closure-pins.json",
|
|
21
22
|
".env.example",
|
|
22
23
|
"THIRD_PARTY_MODELS.md",
|
|
23
24
|
"README.md",
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
"./system/assets/*": "./system/assets/*"
|
|
45
46
|
},
|
|
46
47
|
"scripts": {
|
|
48
|
+
"prepack": "node ../../scripts/gen-closure-pins.mjs",
|
|
47
49
|
"build": "node ../../scripts/sync-system-into-server.mjs && ../../scripts/tsc7 -p tsconfig.build.json && tsup && node scripts/copy-closure-patches.mjs",
|
|
48
50
|
"postinstall": "node scripts/closure-postinstall.mjs",
|
|
49
51
|
"dev": "npx concurrently -n server,ui -c blue,magenta \"CAMSTACK_RESTART_TOUCH_FILE=src/launcher.ts tsx watch --env-file=.env --ignore=./camstack-data --ignore=../../packages/core/dist --ignore=../../packages/sdk/dist --ignore=../../packages/ui-library/dist src/launcher.ts\" \"cd ../../packages/addon-admin-ui && npx vite --port 3001\"",
|
|
@@ -66,9 +68,17 @@
|
|
|
66
68
|
],
|
|
67
69
|
"requires": {
|
|
68
70
|
"addons": {
|
|
69
|
-
"@camstack/addon-
|
|
70
|
-
"@camstack/addon-
|
|
71
|
-
"@camstack/addon-
|
|
71
|
+
"@camstack/addon-admin-ui": ">=1.2.739",
|
|
72
|
+
"@camstack/addon-agent-ui": ">=1.2.437",
|
|
73
|
+
"@camstack/addon-export-alexa": ">=1.2.207",
|
|
74
|
+
"@camstack/addon-matter-broker": ">=0.2.175",
|
|
75
|
+
"@camstack/addon-pipeline": ">=1.2.683",
|
|
76
|
+
"@camstack/addon-pipeline-orchestrator": ">=1.2.719",
|
|
77
|
+
"@camstack/addon-post-analysis": ">=1.2.725",
|
|
78
|
+
"@camstack/addon-provider-ecowitt": ">=0.2.175",
|
|
79
|
+
"@camstack/addon-provider-homeassistant": ">=1.2.702",
|
|
80
|
+
"@camstack/addon-provider-reolink": ">=1.2.261",
|
|
81
|
+
"@camstack/addon-provider-rtsp": ">=1.2.161"
|
|
72
82
|
},
|
|
73
83
|
"wrapper": {
|
|
74
84
|
"desktop": ">=0.0.1",
|
|
@@ -77,19 +87,19 @@
|
|
|
77
87
|
}
|
|
78
88
|
},
|
|
79
89
|
"dependencies": {
|
|
80
|
-
"@camstack/addon-admin-ui": "1.2.
|
|
81
|
-
"@camstack/addon-agent-ui": "1.2.
|
|
90
|
+
"@camstack/addon-admin-ui": "1.2.739",
|
|
91
|
+
"@camstack/addon-agent-ui": "1.2.437",
|
|
82
92
|
"@camstack/addon-auth": "1.2.183",
|
|
83
93
|
"@camstack/addon-benchmark": "1.2.316",
|
|
84
94
|
"@camstack/addon-decoder-nodeav": "1.2.150",
|
|
85
95
|
"@camstack/addon-notifiers": "1.2.642",
|
|
86
|
-
"@camstack/addon-pipeline": "1.2.
|
|
87
|
-
"@camstack/addon-pipeline-orchestrator": "1.2.
|
|
88
|
-
"@camstack/addon-post-analysis": "1.2.
|
|
96
|
+
"@camstack/addon-pipeline": "1.2.683",
|
|
97
|
+
"@camstack/addon-pipeline-orchestrator": "1.2.719",
|
|
98
|
+
"@camstack/addon-post-analysis": "1.2.725",
|
|
89
99
|
"@camstack/develop": "0.1.58",
|
|
90
100
|
"@camstack/sdk": "1.2.160",
|
|
91
|
-
"@camstack/types": "1.2.
|
|
92
|
-
"@camstack/ui-library": "1.2.
|
|
101
|
+
"@camstack/types": "1.2.627",
|
|
102
|
+
"@camstack/ui-library": "1.2.500",
|
|
93
103
|
"@fastify/compress": "^9.0.0",
|
|
94
104
|
"@fastify/cookie": "^11.0.2",
|
|
95
105
|
"@fastify/cors": "^11.2.0",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as EventCategory } from "./base-addon-
|
|
1
|
+
import { b as EventCategory } from "./base-addon-BcVoYZbC.mjs";
|
|
2
2
|
import { n as DeviceRole, r as DeviceType } from "./device-type-TUGqGmaI.mjs";
|
|
3
3
|
//#endregion
|
|
4
4
|
//#region ../types/dist/esm/device/cap-vocabulary/vocabulary.mjs
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_base_addon = require("./base-addon-
|
|
1
|
+
const require_base_addon = require("./base-addon-BG7p06Hb.js");
|
|
2
2
|
const require_device_type = require("./device-type-Cnc0NiSX.js");
|
|
3
3
|
//#endregion
|
|
4
4
|
//#region ../types/dist/esm/device/cap-vocabulary/vocabulary.mjs
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as SCOPED_SETTINGS_SCOPES } from "./scoped-settings-DVWUIP7Z.mjs";
|
|
2
2
|
import { c as method } from "./capability-definition-C1TLUVJR.mjs";
|
|
3
3
|
import { t as NOT_A_DEVICE } from "./system-reasons-CYj4qwyS.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { d as IconKeySchema } from "./tag-DU8pm9Bi.mjs";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
//#region ../types/dist/esm/device/location-icon.mjs
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_scoped_settings = require("./scoped-settings-CylSSq_8.js");
|
|
2
2
|
const require_capability_definition = require("./capability-definition-BEVd01Xj.js");
|
|
3
3
|
const require_system_reasons = require("./system-reasons-Be_k1W8g.js");
|
|
4
|
-
const require_tag = require("./tag-
|
|
4
|
+
const require_tag = require("./tag-BLraBqvp.js");
|
|
5
5
|
let zod = require("zod");
|
|
6
6
|
//#region ../types/dist/esm/device/location-icon.mjs
|
|
7
7
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as DeviceFaultSchema } from "./error.cap-
|
|
1
|
+
import { n as DeviceFaultSchema } from "./error.cap-B8l7L8e4.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region ../types/dist/esm/notification/alert-episode.mjs
|
|
4
4
|
/** An episode is closed once its alert is completed or dismissed. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_error_cap = require("./error.cap-
|
|
1
|
+
const require_error_cap = require("./error.cap-BqlvgBJd.js");
|
|
2
2
|
let zod = require("zod");
|
|
3
3
|
//#region ../types/dist/esm/notification/alert-episode.mjs
|
|
4
4
|
/** An episode is closed once its alert is completed or dismissed. */
|
|
@@ -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;
|