@camstack/server 1.2.928 → 1.2.929
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 +6 -0
- package/package.json +10 -8
- package/system/dist/addon-id-CVg1_r5E.mjs +39 -0
- package/system/dist/addon-id-Di0lNJ89.js +50 -0
- package/system/dist/addon-pages.cap-Df9FQwN1.js +49 -0
- package/system/dist/addon-pages.cap-DksUlE8j.mjs +44 -0
- package/system/dist/addon-settings.cap-3-TIIMq_.mjs +592 -0
- package/system/dist/addon-settings.cap-DAiE0Nb0.js +651 -0
- package/system/dist/addon-utils.mjs +1 -1
- package/system/dist/addon-widgets.cap-C4jxflbF.js +200 -0
- package/system/dist/addon-widgets.cap-D9m48X78.mjs +183 -0
- package/system/dist/base-addon-DD5dIfcZ.js +4624 -0
- package/system/dist/base-addon-Md14i7pe.mjs +4505 -0
- package/system/dist/base-device-2sL1DMm1.js +1103 -0
- package/system/dist/base-device-IuM1AwXZ.mjs +1098 -0
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +8 -6
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +6 -4
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +8 -6
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +7 -5
- package/system/dist/builtins/alerts/alerts.addon.js +113 -56
- package/system/dist/builtins/alerts/alerts.addon.mjs +60 -3
- package/system/dist/builtins/autotrack/index.js +21 -17
- package/system/dist/builtins/autotrack/index.mjs +5 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +14 -11
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +8 -5
- package/system/dist/builtins/calendars/calendars.addon.js +8 -6
- package/system/dist/builtins/calendars/calendars.addon.mjs +3 -1
- package/system/dist/builtins/camera-grid/index.js +615 -58
- package/system/dist/builtins/camera-grid/index.mjs +558 -1
- package/system/dist/builtins/composer/composer.addon.js +788 -209
- package/system/dist/builtins/composer/composer.addon.mjs +583 -4
- package/system/dist/builtins/console-logging/index.js +4 -3
- package/system/dist/builtins/console-logging/index.mjs +2 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +7887 -381
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +7511 -5
- package/system/dist/builtins/core-notifier/core-notifier.addon.js +731 -21
- package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +711 -1
- package/system/dist/builtins/device-history/device-history.addon.js +110 -31
- package/system/dist/builtins/device-history/device-history.addon.mjs +81 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +12806 -227
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +12583 -5
- package/system/dist/builtins/hub-forwarder/index.js +4 -3
- package/system/dist/builtins/hub-forwarder/index.mjs +2 -1
- package/system/dist/builtins/keychain/index.js +31 -28
- package/system/dist/builtins/keychain/index.mjs +7 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +15 -12
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +4 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +140 -39
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +106 -6
- package/system/dist/builtins/local-network/local-network.addon.js +43 -39
- package/system/dist/builtins/local-network/local-network.addon.mjs +7 -3
- package/system/dist/builtins/loki-logging/index.js +23 -17
- package/system/dist/builtins/loki-logging/index.mjs +7 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +156 -15
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +151 -10
- package/system/dist/builtins/platform-probe/index.js +25 -23
- package/system/dist/builtins/platform-probe/index.mjs +12 -10
- package/system/dist/builtins/record-entries/index.js +9 -7
- package/system/dist/builtins/record-entries/index.mjs +3 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +4 -4
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +97 -44
- package/system/dist/builtins/snapshot/index.mjs +54 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +5 -4
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +21 -20
- 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/sqlite-settings.addon.js +87 -61
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +29 -3
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +81 -72
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +10 -1
- package/system/dist/builtins/system-config/system-config.addon.js +17 -14
- package/system/dist/builtins/system-config/system-config.addon.mjs +118 -115
- package/system/dist/builtins/winston-logging/index.js +7 -5
- package/system/dist/builtins/winston-logging/index.mjs +3 -1
- package/system/dist/calendars.cap-CaFlShS9.js +155 -0
- package/system/dist/calendars.cap-_C4eD4fi.mjs +138 -0
- package/system/dist/camstack-error-DJ-TUAi1.js +23 -0
- package/system/dist/camstack-error-viZYfcj9.mjs +18 -0
- package/system/dist/cap-call-context-Bd76CbOW.js +95 -0
- package/system/dist/cap-call-context-DNwdgGSQ.mjs +78 -0
- package/system/dist/capability-definition-C2rJdVeX.mjs +177 -0
- package/system/dist/capability-definition-HCmTem8c.js +242 -0
- package/system/dist/{capture-engine-BcuwOSXv.js → capture-engine-DZ0LIUqA.js} +5 -4
- package/system/dist/{capture-engine-Bz7eXFjT.mjs → capture-engine-DiwbjoWp.mjs} +2 -1
- package/system/dist/command-origin-claim-Cief660O.js +35 -0
- package/system/dist/command-origin-claim-D1Wy7Qld.mjs +24 -0
- package/system/dist/composition-sources-Caqv7O7z.mjs +391 -0
- package/system/dist/composition-sources-CgnHjm8Q.js +408 -0
- package/system/dist/{constants-D2etJ02O.js → constants-Ba3FTIHl.js} +1 -1
- package/system/dist/constants-C860Y6U4.js +26 -0
- package/system/dist/{constants-BcUTQd1M.mjs → constants-DB4piTD5.mjs} +1 -1
- package/system/dist/constants-DCLpoF4L.mjs +21 -0
- package/system/dist/coral-accelerators-7o8hqvcN.js +564 -0
- package/system/dist/coral-accelerators-BKcXP59c.mjs +521 -0
- package/system/dist/core-blocks.cap-C6iKAZ-x.mjs +17986 -0
- package/system/dist/core-blocks.cap-LEMqVwxO.js +18705 -0
- package/system/dist/{custom-action-registry-N7flBDwT.mjs → custom-action-registry-B9zFBNVa.mjs} +37 -37
- package/system/dist/custom-actions-BFUSalC9.mjs +25 -0
- package/system/dist/custom-actions-D92NRi2c.js +36 -0
- package/system/dist/database-snapshot.cap-DF38e-0P.js +162 -0
- package/system/dist/database-snapshot.cap-dhrc9xnY.mjs +133 -0
- package/system/dist/declared-device-BWphj9WE.js +303 -0
- package/system/dist/declared-device-CKERA1Hi.mjs +286 -0
- package/system/dist/{device-ca-ExMN3xW3.mjs → device-ca-BLM6fccc.mjs} +2 -1
- package/system/dist/{device-ca-CU8zh9Pi.js → device-ca-C5kJE6mL.js} +7 -6
- package/system/dist/device-certificate-Cddm4Idn.mjs +91 -0
- package/system/dist/device-certificate-CguVACQO.js +162 -0
- package/system/dist/device-identifiers-BQg9EQi1.js +600 -0
- package/system/dist/device-identifiers-iSuQCKmK.mjs +529 -0
- package/system/dist/device-kind-BJ2pfsjw.mjs +78 -0
- package/system/dist/device-kind-CsSiv_YF.js +101 -0
- package/system/dist/device-manager.cap-2abwVLCM.js +2874 -0
- package/system/dist/device-manager.cap-CFZSPfUh.mjs +2749 -0
- package/system/dist/device-provider.cap-3Uvk6f5-.mjs +331 -0
- package/system/dist/device-provider.cap-D7TV2kVH.js +366 -0
- package/system/dist/{device-row-store-CeW_GWh9.mjs → device-row-store-YF3jtmkk.mjs} +4 -1
- package/system/dist/{device-row-store-BMIR-n3m.js → device-row-store-doTfMOqn.js} +12 -9
- package/system/dist/device-transitions.cap-B5w5PYU_.js +860 -0
- package/system/dist/device-transitions.cap-DojcwEuX.mjs +819 -0
- package/system/dist/device-type-CbQsnFdC.js +477 -0
- package/system/dist/device-type-DgEvK3ch.mjs +454 -0
- package/system/dist/entry-kind-D9MuVJCK.mjs +44 -0
- package/system/dist/entry-kind-cq90c--V.js +55 -0
- package/system/dist/error.cap-CSM_SRfR.mjs +3423 -0
- package/system/dist/error.cap-DBhgPeWK.js +3848 -0
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/history-catalog-BKRarIL_.js +831 -0
- package/system/dist/history-catalog-BwTeQ4Mr.mjs +802 -0
- package/system/dist/{hub-identity-Csxx2Q8k.js → hub-identity-BMdR3Mw9.js} +2 -2
- package/system/dist/{hub-identity-CYC1820R.mjs → hub-identity-DjMN9Ac2.mjs} +10 -10
- package/system/dist/{hub-mdns-ciao-By5577HM.js → hub-mdns-ciao--0v1TKME.js} +5 -5
- package/system/dist/{hub-mdns-ciao-CCDxM5qz.mjs → hub-mdns-ciao-DBrtHOcc.mjs} +2 -2
- package/system/dist/index.js +763 -151
- package/system/dist/index.mjs +832 -220
- package/system/dist/integration-instances.cap-Cl9O-k4h.mjs +538 -0
- package/system/dist/integration-instances.cap-dJIxg2_s.js +549 -0
- package/system/dist/keychain-admin.cap-Db_oFX4H.js +425 -0
- package/system/dist/keychain-admin.cap-GtM7gVGG.mjs +396 -0
- package/system/dist/l10n-Bu6aUvSY.mjs +10 -0
- package/system/dist/l10n-CGMvp7NF.js +15 -0
- package/system/dist/labels-DX5S8deC.js +81 -0
- package/system/dist/labels-DsBcU7md.mjs +64 -0
- package/system/dist/{legacy-integration-rows-door-CVwOo5aq.js → legacy-integration-rows-door-B1nzxxr5.js} +2 -2
- package/system/dist/{legacy-integration-rows-door-D9tQOUzh.mjs → legacy-integration-rows-door-nTvo_6jQ.mjs} +1 -1
- package/system/dist/log-destination.cap-CxZzAVaR.mjs +143 -0
- package/system/dist/log-destination.cap-DELPJkZ0.js +148 -0
- package/system/dist/low-power-sleep.cap-7lfVU41N.js +103 -0
- package/system/dist/low-power-sleep.cap-tGPmaZ_V.mjs +92 -0
- package/system/dist/mask-shape-Ci8Co9w0.mjs +57 -0
- package/system/dist/mask-shape-CmPA2fst.js +92 -0
- package/system/dist/metrics-provider.cap-BNmcHDkQ.mjs +405 -0
- package/system/dist/metrics-provider.cap-BcmQUt6l.js +410 -0
- package/system/dist/migration-BMjgkyG2.js +380 -0
- package/system/dist/migration-DRJAtdy7.mjs +321 -0
- package/system/dist/network-access.cap-B5TWLDCC.js +1099 -0
- package/system/dist/network-access.cap-BJnGbE6n.mjs +1004 -0
- package/system/dist/notification-rules.cap-B__YBgnG.js +3422 -0
- package/system/dist/notification-rules.cap-D9ArZlwx.mjs +3357 -0
- package/system/dist/ops-log-CB4pIdqi.mjs +64 -0
- package/system/dist/ops-log-pxt9176Z.js +81 -0
- package/system/dist/pinned-binary-BOhOSNff.js +28 -0
- package/system/dist/pinned-binary-CrIRAi4G.mjs +23 -0
- package/system/dist/platform-probe.cap-1WrMhWHx.js +250 -0
- package/system/dist/platform-probe.cap-BFeqFLtQ.mjs +233 -0
- package/system/dist/prefix-walk-B4b2-9aK.mjs +790 -0
- package/system/dist/prefix-walk-DC0ljmbB.js +843 -0
- package/system/dist/ptz-autotrack.cap-BW7w0zHD.js +229 -0
- package/system/dist/ptz-autotrack.cap-DT2GypXw.mjs +224 -0
- package/system/dist/quantity-D3g5SxsZ.mjs +114 -0
- package/system/dist/quantity-lY1KiTSZ.js +143 -0
- package/system/dist/raw-secret-migration-DxuBFtvi.js +50 -0
- package/system/dist/raw-secret-migration-iv88mLoc.mjs +39 -0
- package/system/dist/record-entries.cap-sMUhTvTU.mjs +75 -0
- package/system/dist/record-entries.cap-ti1C046R.js +80 -0
- package/system/dist/record-kind-DoBfYHCs.js +203 -0
- package/system/dist/record-kind-ub6NXqfh.mjs +162 -0
- package/system/dist/recording-archive.cap-7OrIn9e5.mjs +1299 -0
- package/system/dist/recording-archive.cap-D7bo-QSM.js +1328 -0
- package/system/dist/records.cap-ClcWV64i.js +329 -0
- package/system/dist/records.cap-CwLT2ByG.mjs +294 -0
- package/system/dist/relocate-CdVQAk-w.js +804 -0
- package/system/dist/relocate-CoZZTui1.mjs +661 -0
- package/system/dist/rename-composition-block-7WIICIDq.mjs +33525 -0
- package/system/dist/rename-composition-block-CcWLwVhG.js +34692 -0
- package/system/dist/{restore-archive-BJfyu0sG.mjs → restore-archive-CjAyKpgX.mjs} +96 -94
- package/system/dist/{restore-archive-CIFvqOze.js → restore-archive-CkTkv3Ss.js} +6 -4
- package/system/dist/scoped-settings-CylSSq_8.js +955 -0
- package/system/dist/scoped-settings-DVWUIP7Z.mjs +650 -0
- package/system/dist/server-name-BIhLuHvX.mjs +35 -0
- package/system/dist/server-name-OALNvpqC.js +52 -0
- package/system/dist/settings-store.cap-Ci4F2zul.mjs +569 -0
- package/system/dist/settings-store.cap-wlJhCspr.js +640 -0
- package/system/dist/snapshot.cap-3suPdBHV.js +250 -0
- package/system/dist/snapshot.cap-Bs8Oyaqh.mjs +245 -0
- package/system/dist/source-info-DGB7SdB_.mjs +190 -0
- package/system/dist/source-info-DtWf4k2j.js +225 -0
- package/system/dist/storage-admin.cap-BSv1NjKJ.mjs +883 -0
- package/system/dist/storage-admin.cap-he0OqvVM.js +906 -0
- package/system/dist/storage-location-CBT8GCD6.mjs +163 -0
- package/system/dist/storage-location-CTweDMZf.js +198 -0
- package/system/dist/storage-location-mode-B21UVRRX.mjs +167 -0
- package/system/dist/storage-location-mode-CS4sMzo-.js +232 -0
- package/system/dist/storage-migration.cap-CyyATY_p.js +330 -0
- package/system/dist/storage-migration.cap-D7QqGobp.mjs +313 -0
- package/system/dist/storage-occupancy.cap-2rmnS58Z.js +622 -0
- package/system/dist/storage-occupancy.cap-CqBztTl9.mjs +611 -0
- package/system/dist/storage-provider.cap-Bw0CfxVc.js +213 -0
- package/system/dist/storage-provider.cap-CMeck2w4.mjs +202 -0
- package/system/dist/stream-catalog.cap-Bp7SkgIf.mjs +6560 -0
- package/system/dist/stream-catalog.cap-D3uwePiA.js +6763 -0
- package/system/dist/streaming-shared-B8cXatuU.mjs +431 -0
- package/system/dist/streaming-shared-DQwFZOSi.js +526 -0
- package/system/dist/system-reasons-Be_k1W8g.js +25 -0
- package/system/dist/system-reasons-CYj4qwyS.mjs +20 -0
- package/system/dist/tag-BxLazvVb.js +2138 -0
- package/system/dist/tag-uZBAq6ox.mjs +2073 -0
- package/system/dist/user-management.cap-B9QDu8NE.js +825 -0
- package/system/dist/user-management.cap-DBIi77sB.mjs +766 -0
- package/system/dist/vector-store.cap-DnyfrYDn.js +330 -0
- package/system/dist/vector-store.cap-h2GHWQ1t.mjs +319 -0
- package/system/dist/{wal-maintenance-CTrCPzds.mjs → wal-maintenance-BG01rOn9.mjs} +0 -0
- package/system/dist/{wal-maintenance-dq7T3quB.js → wal-maintenance-DyrebYKF.js} +0 -0
- package/system/dist/zod-secret-DS7mj1bk.js +78 -0
- package/system/dist/zod-secret-zY4nM61M.mjs +73 -0
- package/system/package.json +1 -1
- package/system/dist/composition-sources-BI614LJx.mjs +0 -141
- package/system/dist/composition-sources-v_kkb8A9.js +0 -152
- package/system/dist/coral-accelerators-BSVsBVzt.js +0 -250
- package/system/dist/coral-accelerators-BW3OcrLD.mjs +0 -231
- package/system/dist/dist-BCHMSqzc.mjs +0 -143467
- package/system/dist/dist-BZfvhfS1.js +0 -146970
- package/system/dist/prefix-walk-DAOBSyH1.mjs +0 -88
- package/system/dist/prefix-walk-Dv6MLZlM.js +0 -99
- package/system/dist/rename-composition-block-C9HuBrKS.js +0 -112
- package/system/dist/rename-composition-block-DtaYmYAR.mjs +0 -101
|
@@ -0,0 +1,860 @@
|
|
|
1
|
+
const require_capability_definition = require("./capability-definition-HCmTem8c.js");
|
|
2
|
+
const require_command_origin_claim = require("./command-origin-claim-Cief660O.js");
|
|
3
|
+
const require_system_reasons = require("./system-reasons-Be_k1W8g.js");
|
|
4
|
+
const require_quantity = require("./quantity-lY1KiTSZ.js");
|
|
5
|
+
const require_device_type = require("./device-type-CbQsnFdC.js");
|
|
6
|
+
const require_l10n = require("./l10n-CGMvp7NF.js");
|
|
7
|
+
let zod = require("zod");
|
|
8
|
+
//#region ../types/dist/esm/audit/device-transition.mjs
|
|
9
|
+
/**
|
|
10
|
+
* One recorded device transition (D1022): a status field of a device went from
|
|
11
|
+
* one value to another, with who or what asked for it.
|
|
12
|
+
*
|
|
13
|
+
* `from` is `null` when the hub mirror had not seen the field before (unknown,
|
|
14
|
+
* never a made-up value - D393). `outcome` says how the actor was decided:
|
|
15
|
+
* a command matched the change (`confirmed`), nothing asked so the device did it
|
|
16
|
+
* (`device`), the command found the target already held (`already`), the command
|
|
17
|
+
* produced no change in its window (`unconfirmed`) or threw (`failed`).
|
|
18
|
+
*/
|
|
19
|
+
/** A status value as a transition carries it. */
|
|
20
|
+
var TransitionValueSchema = /* @__PURE__ */ zod.z.union([
|
|
21
|
+
/* @__PURE__ */ zod.z.string(),
|
|
22
|
+
/* @__PURE__ */ zod.z.number(),
|
|
23
|
+
/* @__PURE__ */ zod.z.boolean(),
|
|
24
|
+
/* @__PURE__ */ zod.z.null(),
|
|
25
|
+
/* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown())
|
|
26
|
+
]);
|
|
27
|
+
/** Who asked. `device` is the fallback: nothing the hub observed asked for the change. */
|
|
28
|
+
var TransitionActorSchema = /* @__PURE__ */ zod.z.discriminatedUnion("kind", [
|
|
29
|
+
/* @__PURE__ */ zod.z.object({
|
|
30
|
+
kind: /* @__PURE__ */ zod.z.literal("user"),
|
|
31
|
+
userId: /* @__PURE__ */ zod.z.string(),
|
|
32
|
+
username: /* @__PURE__ */ zod.z.string(),
|
|
33
|
+
credential: /* @__PURE__ */ zod.z.enum([
|
|
34
|
+
"session",
|
|
35
|
+
"token",
|
|
36
|
+
"integration"
|
|
37
|
+
]),
|
|
38
|
+
credentialId: /* @__PURE__ */ zod.z.string().optional()
|
|
39
|
+
}),
|
|
40
|
+
/* @__PURE__ */ zod.z.object({
|
|
41
|
+
kind: /* @__PURE__ */ zod.z.literal("addon"),
|
|
42
|
+
addonId: /* @__PURE__ */ zod.z.string(),
|
|
43
|
+
nodeId: /* @__PURE__ */ zod.z.string().optional(),
|
|
44
|
+
/** The ecosystem principal an exporter relayed, when it reported one. */
|
|
45
|
+
onBehalf: /* @__PURE__ */ require_command_origin_claim.OnBehalfSchema.optional()
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ zod.z.object({
|
|
48
|
+
kind: /* @__PURE__ */ zod.z.literal("action"),
|
|
49
|
+
addonId: /* @__PURE__ */ zod.z.string(),
|
|
50
|
+
actionId: /* @__PURE__ */ zod.z.string(),
|
|
51
|
+
runId: /* @__PURE__ */ zod.z.string(),
|
|
52
|
+
automationId: /* @__PURE__ */ zod.z.string().optional()
|
|
53
|
+
}),
|
|
54
|
+
/* @__PURE__ */ zod.z.object({
|
|
55
|
+
kind: /* @__PURE__ */ zod.z.literal("scheduler"),
|
|
56
|
+
addonId: /* @__PURE__ */ zod.z.string(),
|
|
57
|
+
schedulerId: /* @__PURE__ */ zod.z.string()
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ zod.z.object({
|
|
60
|
+
kind: /* @__PURE__ */ zod.z.literal("composition"),
|
|
61
|
+
owner: /* @__PURE__ */ zod.z.string()
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ zod.z.object({
|
|
64
|
+
kind: /* @__PURE__ */ zod.z.literal("node"),
|
|
65
|
+
nodeId: /* @__PURE__ */ zod.z.string()
|
|
66
|
+
}),
|
|
67
|
+
/* @__PURE__ */ zod.z.object({ kind: /* @__PURE__ */ zod.z.literal("device") })
|
|
68
|
+
]);
|
|
69
|
+
/** The actor kinds, for a filter. */
|
|
70
|
+
var TransitionActorKindSchema = /* @__PURE__ */ zod.z.enum([
|
|
71
|
+
"user",
|
|
72
|
+
"addon",
|
|
73
|
+
"action",
|
|
74
|
+
"scheduler",
|
|
75
|
+
"composition",
|
|
76
|
+
"node",
|
|
77
|
+
"device"
|
|
78
|
+
]);
|
|
79
|
+
var TransitionOutcomeSchema = /* @__PURE__ */ zod.z.enum([
|
|
80
|
+
"confirmed",
|
|
81
|
+
"device",
|
|
82
|
+
"already",
|
|
83
|
+
"unconfirmed",
|
|
84
|
+
"failed"
|
|
85
|
+
]);
|
|
86
|
+
/** The command a transition is attributed to. `args` are redacted and capped before they get here. */
|
|
87
|
+
var TransitionCommandSchema = /* @__PURE__ */ zod.z.object({
|
|
88
|
+
commandId: /* @__PURE__ */ zod.z.string(),
|
|
89
|
+
method: /* @__PURE__ */ zod.z.string(),
|
|
90
|
+
args: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown()),
|
|
91
|
+
requestedAt: /* @__PURE__ */ zod.z.number(),
|
|
92
|
+
/** Milliseconds from the command to the change it caused; `null` when no change was seen. */
|
|
93
|
+
matchedAfterMs: /* @__PURE__ */ zod.z.number().nullable(),
|
|
94
|
+
error: /* @__PURE__ */ zod.z.string().optional()
|
|
95
|
+
});
|
|
96
|
+
var DeviceTransitionSchema = /* @__PURE__ */ zod.z.object({
|
|
97
|
+
/** `${deviceId}:${at}:${seq}` - the write is idempotent on it. */
|
|
98
|
+
id: /* @__PURE__ */ zod.z.string(),
|
|
99
|
+
deviceId: /* @__PURE__ */ zod.z.number().int(),
|
|
100
|
+
at: /* @__PURE__ */ zod.z.number(),
|
|
101
|
+
capName: /* @__PURE__ */ zod.z.string(),
|
|
102
|
+
field: /* @__PURE__ */ zod.z.string(),
|
|
103
|
+
from: TransitionValueSchema,
|
|
104
|
+
to: TransitionValueSchema,
|
|
105
|
+
outcome: TransitionOutcomeSchema,
|
|
106
|
+
actor: TransitionActorSchema,
|
|
107
|
+
command: /* @__PURE__ */ TransitionCommandSchema.optional()
|
|
108
|
+
});
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region ../types/dist/esm/capabilities/device-history.cap.mjs
|
|
111
|
+
/**
|
|
112
|
+
* device-history — the ONE mechanism for numeric history (D850).
|
|
113
|
+
*
|
|
114
|
+
* A device value is recorded because its capability says so (the `history`
|
|
115
|
+
* block of a `*.cap.ts`, captured hub-side from `DeviceStateChanged`); any
|
|
116
|
+
* other series is DECLARED by the addon that produces it and fed with points
|
|
117
|
+
* (`record`) or closed five-minute buckets (`recordBuckets`). Rollups 5m / 1h /
|
|
118
|
+
* 1d are computed here and nowhere else. Storage is `history.db` (D851).
|
|
119
|
+
*
|
|
120
|
+
* Who the PRODUCER is: `declareSeries`, `record` and `recordBuckets` are owner
|
|
121
|
+
* checked against the `callerAddonId` the transport stamps into a call that
|
|
122
|
+
* crossed a process (never in an input schema, so a session cannot supply it).
|
|
123
|
+
* A call with no stamp is refused `not-owner`. The methods are `admin` so a
|
|
124
|
+
* non-admin session never reaches them; an addon's `ctx.api` call bypasses the
|
|
125
|
+
* tier by design.
|
|
126
|
+
*/
|
|
127
|
+
/** Whose history: a real device, or a cluster node (load, memory). */
|
|
128
|
+
var DeviceHistorySubjectSchema = /* @__PURE__ */ zod.z.discriminatedUnion("kind", [/* @__PURE__ */ zod.z.object({
|
|
129
|
+
kind: /* @__PURE__ */ zod.z.literal("device"),
|
|
130
|
+
deviceId: /* @__PURE__ */ zod.z.number().int()
|
|
131
|
+
}), /* @__PURE__ */ zod.z.object({
|
|
132
|
+
kind: /* @__PURE__ */ zod.z.literal("node"),
|
|
133
|
+
nodeId: /* @__PURE__ */ zod.z.string().min(1)
|
|
134
|
+
})]);
|
|
135
|
+
/**
|
|
136
|
+
* `enum` stores a STATE as the ordinal of its value in the series' value list
|
|
137
|
+
* (`DeviceHistorySeriesInfo.values`, append-only, so an ordinal never changes
|
|
138
|
+
* meaning); a rollup keeps the time spent in each state (`states`).
|
|
139
|
+
*/
|
|
140
|
+
var DeviceHistoryKindSchema = /* @__PURE__ */ zod.z.enum([
|
|
141
|
+
"gauge",
|
|
142
|
+
"counter",
|
|
143
|
+
"boolean",
|
|
144
|
+
"enum"
|
|
145
|
+
]);
|
|
146
|
+
/** What a PRODUCER may declare. `enum` is cap-only: its value list is the cap field's. */
|
|
147
|
+
var DeviceHistoryProducerKindSchema = /* @__PURE__ */ zod.z.enum([
|
|
148
|
+
"gauge",
|
|
149
|
+
"counter",
|
|
150
|
+
"boolean"
|
|
151
|
+
]);
|
|
152
|
+
/**
|
|
153
|
+
* A key computed at READ time from stored series of the same device, never
|
|
154
|
+
* stored itself. Energy (kWh per bucket) comes from the power meter's
|
|
155
|
+
* `energy` counter when the device has one, else from integrating its
|
|
156
|
+
* `power` gauge over time.
|
|
157
|
+
*/
|
|
158
|
+
var DEVICE_HISTORY_ENERGY_KEY = "derived:energy.kwh";
|
|
159
|
+
var DeviceHistoryResolutionSchema = /* @__PURE__ */ zod.z.enum([
|
|
160
|
+
"raw",
|
|
161
|
+
"5m",
|
|
162
|
+
"1h",
|
|
163
|
+
"1d"
|
|
164
|
+
]);
|
|
165
|
+
/** Why a producer's point or bucket was not stored. Counted, never silent (D391). */
|
|
166
|
+
var DeviceHistoryRefusalReasonSchema = /* @__PURE__ */ zod.z.enum([
|
|
167
|
+
"undeclared",
|
|
168
|
+
"not-owner",
|
|
169
|
+
"opted-out",
|
|
170
|
+
"not-a-real-device",
|
|
171
|
+
"rate",
|
|
172
|
+
"ingest-mismatch",
|
|
173
|
+
"out-of-range"
|
|
174
|
+
]);
|
|
175
|
+
var RefusalSchema = /* @__PURE__ */ zod.z.object({
|
|
176
|
+
key: /* @__PURE__ */ zod.z.string(),
|
|
177
|
+
reason: DeviceHistoryRefusalReasonSchema,
|
|
178
|
+
count: /* @__PURE__ */ zod.z.number().int()
|
|
179
|
+
});
|
|
180
|
+
var IngestResultSchema = /* @__PURE__ */ zod.z.object({
|
|
181
|
+
accepted: /* @__PURE__ */ zod.z.number().int(),
|
|
182
|
+
refused: /* @__PURE__ */ zod.z.array(RefusalSchema).readonly()
|
|
183
|
+
});
|
|
184
|
+
var SeriesInfoSchema = /* @__PURE__ */ zod.z.object({
|
|
185
|
+
key: /* @__PURE__ */ zod.z.string(),
|
|
186
|
+
scope: /* @__PURE__ */ zod.z.string(),
|
|
187
|
+
kind: DeviceHistoryKindSchema,
|
|
188
|
+
/** `null` is unknown (a `unitFrom` series whose device does not state a unit right now), never a guess. */
|
|
189
|
+
unit: /* @__PURE__ */ zod.z.string().nullable(),
|
|
190
|
+
displayName: /* @__PURE__ */ zod.z.string(),
|
|
191
|
+
source: /* @__PURE__ */ zod.z.enum([
|
|
192
|
+
"cap",
|
|
193
|
+
"addon",
|
|
194
|
+
"derived"
|
|
195
|
+
]),
|
|
196
|
+
/** `enum`: the value of each ordinal (index = ordinal); `null` for every other kind. */
|
|
197
|
+
values: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).readonly().nullable(),
|
|
198
|
+
firstTs: /* @__PURE__ */ zod.z.number(),
|
|
199
|
+
lastTs: /* @__PURE__ */ zod.z.number()
|
|
200
|
+
});
|
|
201
|
+
var QueryPointSchema = /* @__PURE__ */ zod.z.object({
|
|
202
|
+
/** Raw: the point's time. Rollup: the bucket start. */
|
|
203
|
+
t: /* @__PURE__ */ zod.z.number(),
|
|
204
|
+
samples: /* @__PURE__ */ zod.z.number().int(),
|
|
205
|
+
/** `sum / samples`. */
|
|
206
|
+
mean: /* @__PURE__ */ zod.z.number().nullable(),
|
|
207
|
+
/** Time-weighted mean (`tw_sum / tw_ms`); `null` for bucket-ingested series. For a boolean: the fraction of time true. */
|
|
208
|
+
twMean: /* @__PURE__ */ zod.z.number().nullable(),
|
|
209
|
+
min: /* @__PURE__ */ zod.z.number(),
|
|
210
|
+
max: /* @__PURE__ */ zod.z.number(),
|
|
211
|
+
/** `null` is unknown, never zero (D393). For an `enum` series: the ordinal of {@link state}. */
|
|
212
|
+
last: /* @__PURE__ */ zod.z.number().nullable(),
|
|
213
|
+
/**
|
|
214
|
+
* The increase over the point: a `counter`'s growth since the previous point
|
|
215
|
+
* or bucket (a drop is a reset, counted from zero), and for
|
|
216
|
+
* {@link DEVICE_HISTORY_ENERGY_KEY} the kWh used in the bucket. `null` for
|
|
217
|
+
* every other kind, and when it cannot be known.
|
|
218
|
+
*/
|
|
219
|
+
delta: /* @__PURE__ */ zod.z.number().nullable(),
|
|
220
|
+
/** `enum`: the state in force at the end of the point (the name of `last`); `null` otherwise. */
|
|
221
|
+
state: /* @__PURE__ */ zod.z.string().nullable(),
|
|
222
|
+
/** `enum` rollup: milliseconds spent in each state inside the bucket; `null` for raw points and other kinds. */
|
|
223
|
+
states: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.number()).nullable()
|
|
224
|
+
});
|
|
225
|
+
var QuerySeriesSchema = /* @__PURE__ */ zod.z.object({
|
|
226
|
+
scope: /* @__PURE__ */ zod.z.string(),
|
|
227
|
+
/** The last point STRICTLY BEFORE `from` in the chosen tier, so a step chart can start at the held value. */
|
|
228
|
+
before: /* @__PURE__ */ zod.z.object({
|
|
229
|
+
t: /* @__PURE__ */ zod.z.number(),
|
|
230
|
+
value: /* @__PURE__ */ zod.z.number().nullable(),
|
|
231
|
+
state: /* @__PURE__ */ zod.z.string().nullable()
|
|
232
|
+
}).nullable(),
|
|
233
|
+
points: /* @__PURE__ */ zod.z.array(QueryPointSchema).readonly(),
|
|
234
|
+
/** A derived key: the stored key its points were computed from; `null` for a stored series. */
|
|
235
|
+
derivedFrom: /* @__PURE__ */ zod.z.string().nullable()
|
|
236
|
+
});
|
|
237
|
+
/** The window part of a query, shared by the device and node forms. */
|
|
238
|
+
var QueryWindowShape = {
|
|
239
|
+
key: /* @__PURE__ */ zod.z.string(),
|
|
240
|
+
scope: /* @__PURE__ */ zod.z.string().optional(),
|
|
241
|
+
from: /* @__PURE__ */ zod.z.number(),
|
|
242
|
+
to: /* @__PURE__ */ zod.z.number(),
|
|
243
|
+
resolution: /* @__PURE__ */ zod.z.union([DeviceHistoryResolutionSchema, /* @__PURE__ */ zod.z.literal("auto")]).default("auto"),
|
|
244
|
+
maxPoints: /* @__PURE__ */ zod.z.number().int().positive().max(5e3).default(1e3)
|
|
245
|
+
};
|
|
246
|
+
var QueryResultSchema = /* @__PURE__ */ zod.z.object({
|
|
247
|
+
resolution: DeviceHistoryResolutionSchema,
|
|
248
|
+
series: /* @__PURE__ */ zod.z.array(QuerySeriesSchema).readonly(),
|
|
249
|
+
truncated: /* @__PURE__ */ zod.z.boolean()
|
|
250
|
+
});
|
|
251
|
+
/** One read of a batch: a device's key or a node's key (exactly one subject). */
|
|
252
|
+
var QueryManyItemSchema = /* @__PURE__ */ zod.z.union([/* @__PURE__ */ zod.z.object({
|
|
253
|
+
deviceId: /* @__PURE__ */ zod.z.number().int(),
|
|
254
|
+
key: /* @__PURE__ */ zod.z.string(),
|
|
255
|
+
scope: /* @__PURE__ */ zod.z.string().optional()
|
|
256
|
+
}), /* @__PURE__ */ zod.z.object({
|
|
257
|
+
forNodeId: /* @__PURE__ */ zod.z.string().min(1),
|
|
258
|
+
key: /* @__PURE__ */ zod.z.string(),
|
|
259
|
+
scope: /* @__PURE__ */ zod.z.string().optional()
|
|
260
|
+
})]);
|
|
261
|
+
var QueryManyEntrySchema = /* @__PURE__ */ zod.z.discriminatedUnion("ok", [/* @__PURE__ */ zod.z.object({
|
|
262
|
+
ok: /* @__PURE__ */ zod.z.literal(true),
|
|
263
|
+
result: QueryResultSchema
|
|
264
|
+
}), /* @__PURE__ */ zod.z.object({
|
|
265
|
+
ok: /* @__PURE__ */ zod.z.literal(false),
|
|
266
|
+
error: /* @__PURE__ */ zod.z.string()
|
|
267
|
+
})]);
|
|
268
|
+
var TierStatusSchema = /* @__PURE__ */ zod.z.object({
|
|
269
|
+
tier: DeviceHistoryResolutionSchema,
|
|
270
|
+
/** `null` until the first background count answered. */
|
|
271
|
+
rows: /* @__PURE__ */ zod.z.number().int().nullable(),
|
|
272
|
+
/** `rows` times a fixed per-row estimate — approximate, labelled so. */
|
|
273
|
+
approxBytes: /* @__PURE__ */ zod.z.number().nullable(),
|
|
274
|
+
countedAt: /* @__PURE__ */ zod.z.number().nullable()
|
|
275
|
+
});
|
|
276
|
+
/** Operator/diagnostic view: rows per tier, last runs, refusals and drops since boot. */
|
|
277
|
+
/**
|
|
278
|
+
* Why a series is orphan. `device-gone`: its device is absent from the
|
|
279
|
+
* successful device listings (the departure clock). `undeclared`: its `cap:`
|
|
280
|
+
* key is declared by no capability any more (a field a cap removed).
|
|
281
|
+
*/
|
|
282
|
+
var DeviceHistoryOrphanReasonSchema = /* @__PURE__ */ zod.z.enum(["device-gone", "undeclared"]);
|
|
283
|
+
/** Rows held per stored tier. */
|
|
284
|
+
var TierRowsSchema = /* @__PURE__ */ zod.z.object({
|
|
285
|
+
raw: /* @__PURE__ */ zod.z.number().int(),
|
|
286
|
+
"5m": /* @__PURE__ */ zod.z.number().int(),
|
|
287
|
+
"1h": /* @__PURE__ */ zod.z.number().int(),
|
|
288
|
+
"1d": /* @__PURE__ */ zod.z.number().int()
|
|
289
|
+
});
|
|
290
|
+
var OrphanSeriesSchema = /* @__PURE__ */ zod.z.object({
|
|
291
|
+
seriesId: /* @__PURE__ */ zod.z.number().int(),
|
|
292
|
+
deviceId: /* @__PURE__ */ zod.z.number().int(),
|
|
293
|
+
key: /* @__PURE__ */ zod.z.string(),
|
|
294
|
+
scope: /* @__PURE__ */ zod.z.string(),
|
|
295
|
+
/** The metric's display name; `null` when its metric row is gone too. */
|
|
296
|
+
displayName: /* @__PURE__ */ zod.z.string().nullable(),
|
|
297
|
+
reason: DeviceHistoryOrphanReasonSchema,
|
|
298
|
+
/** `device-gone`: since when the device has been absent; `null` otherwise. */
|
|
299
|
+
missingSince: /* @__PURE__ */ zod.z.number().nullable(),
|
|
300
|
+
firstTs: /* @__PURE__ */ zod.z.number(),
|
|
301
|
+
lastTs: /* @__PURE__ */ zod.z.number(),
|
|
302
|
+
rows: TierRowsSchema
|
|
303
|
+
});
|
|
304
|
+
var DeviceHistoryOrphanDeleteRefusalSchema = /* @__PURE__ */ zod.z.enum([
|
|
305
|
+
"not-found",
|
|
306
|
+
"not-orphan",
|
|
307
|
+
"failed"
|
|
308
|
+
]);
|
|
309
|
+
var OrphanDeleteEntrySchema = /* @__PURE__ */ zod.z.discriminatedUnion("ok", [/* @__PURE__ */ zod.z.object({
|
|
310
|
+
seriesId: /* @__PURE__ */ zod.z.number().int(),
|
|
311
|
+
ok: /* @__PURE__ */ zod.z.literal(true),
|
|
312
|
+
deleted: TierRowsSchema
|
|
313
|
+
}), /* @__PURE__ */ zod.z.object({
|
|
314
|
+
seriesId: /* @__PURE__ */ zod.z.number().int(),
|
|
315
|
+
ok: /* @__PURE__ */ zod.z.literal(false),
|
|
316
|
+
reason: DeviceHistoryOrphanDeleteRefusalSchema
|
|
317
|
+
})]);
|
|
318
|
+
var OrphanListSchema = /* @__PURE__ */ zod.z.object({
|
|
319
|
+
series: /* @__PURE__ */ zod.z.array(OrphanSeriesSchema).readonly(),
|
|
320
|
+
/** More orphans exist than {@link DEVICE_HISTORY_ORPHAN_LIST_MAX}. */
|
|
321
|
+
truncated: /* @__PURE__ */ zod.z.boolean()
|
|
322
|
+
});
|
|
323
|
+
var DeviceHistoryRangeDeleteRefusalSchema = /* @__PURE__ */ zod.z.enum([
|
|
324
|
+
"invalid-range",
|
|
325
|
+
"range-too-large",
|
|
326
|
+
"series-not-found",
|
|
327
|
+
"not-a-point-series"
|
|
328
|
+
]);
|
|
329
|
+
var RollupRowsSchema = /* @__PURE__ */ zod.z.object({
|
|
330
|
+
"5m": /* @__PURE__ */ zod.z.number().int(),
|
|
331
|
+
"1h": /* @__PURE__ */ zod.z.number().int(),
|
|
332
|
+
"1d": /* @__PURE__ */ zod.z.number().int()
|
|
333
|
+
});
|
|
334
|
+
/**
|
|
335
|
+
* What a time-range delete did, or WOULD do (`dryRun`). `rows` is what was
|
|
336
|
+
* removed: raw points inside the range, and the rollup rows covering it (those
|
|
337
|
+
* are removed and rebuilt from what remains, so a gap leaves no stale value).
|
|
338
|
+
* `rewritten` is how many rollup rows were rebuilt from the remaining points;
|
|
339
|
+
* `null` on a dry run, which cannot know before it has deleted.
|
|
340
|
+
*/
|
|
341
|
+
var RangeDeleteResultSchema = /* @__PURE__ */ zod.z.discriminatedUnion("ok", [/* @__PURE__ */ zod.z.object({
|
|
342
|
+
ok: /* @__PURE__ */ zod.z.literal(true),
|
|
343
|
+
dryRun: /* @__PURE__ */ zod.z.boolean(),
|
|
344
|
+
seriesId: /* @__PURE__ */ zod.z.number().int(),
|
|
345
|
+
rows: TierRowsSchema,
|
|
346
|
+
rewritten: /* @__PURE__ */ RollupRowsSchema.nullable()
|
|
347
|
+
}), /* @__PURE__ */ zod.z.object({
|
|
348
|
+
ok: /* @__PURE__ */ zod.z.literal(false),
|
|
349
|
+
reason: DeviceHistoryRangeDeleteRefusalSchema
|
|
350
|
+
})]);
|
|
351
|
+
var DeviceHistoryStatusSchema = /* @__PURE__ */ zod.z.object({
|
|
352
|
+
startedAt: /* @__PURE__ */ zod.z.number(),
|
|
353
|
+
/** The store is declared, series loaded and the first reconcile has answered. */
|
|
354
|
+
ready: /* @__PURE__ */ zod.z.boolean(),
|
|
355
|
+
series: /* @__PURE__ */ zod.z.number().int(),
|
|
356
|
+
metrics: /* @__PURE__ */ zod.z.number().int(),
|
|
357
|
+
optedOutDevices: /* @__PURE__ */ zod.z.number().int(),
|
|
358
|
+
tiers: /* @__PURE__ */ zod.z.array(TierStatusSchema).readonly(),
|
|
359
|
+
capture: /* @__PURE__ */ zod.z.object({
|
|
360
|
+
eventsSeen: /* @__PURE__ */ zod.z.number().int(),
|
|
361
|
+
pointsEmitted: /* @__PURE__ */ zod.z.number().int(),
|
|
362
|
+
pointsWritten: /* @__PURE__ */ zod.z.number().int(),
|
|
363
|
+
pointsDropped: /* @__PURE__ */ zod.z.number().int(),
|
|
364
|
+
bufferDepth: /* @__PURE__ */ zod.z.number().int(),
|
|
365
|
+
trailingEmitted: /* @__PURE__ */ zod.z.number().int(),
|
|
366
|
+
reconciledPoints: /* @__PURE__ */ zod.z.number().int(),
|
|
367
|
+
reconcileRuns: /* @__PURE__ */ zod.z.number().int(),
|
|
368
|
+
reconcileFailures: /* @__PURE__ */ zod.z.number().int(),
|
|
369
|
+
lastReconcileAt: /* @__PURE__ */ zod.z.number().nullable(),
|
|
370
|
+
lastFlushAt: /* @__PURE__ */ zod.z.number().nullable(),
|
|
371
|
+
flushFailures: /* @__PURE__ */ zod.z.number().int(),
|
|
372
|
+
skipped: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.number().int())
|
|
373
|
+
}),
|
|
374
|
+
ingest: /* @__PURE__ */ zod.z.object({
|
|
375
|
+
accepted: /* @__PURE__ */ zod.z.number().int(),
|
|
376
|
+
refused: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.number().int())
|
|
377
|
+
}),
|
|
378
|
+
rollup: /* @__PURE__ */ zod.z.object({
|
|
379
|
+
last5mAt: /* @__PURE__ */ zod.z.number().nullable(),
|
|
380
|
+
last1hAt: /* @__PURE__ */ zod.z.number().nullable(),
|
|
381
|
+
last1dAt: /* @__PURE__ */ zod.z.number().nullable(),
|
|
382
|
+
errors: /* @__PURE__ */ zod.z.number().int(),
|
|
383
|
+
dirty5m: /* @__PURE__ */ zod.z.number().int(),
|
|
384
|
+
dirty1h: /* @__PURE__ */ zod.z.number().int(),
|
|
385
|
+
dirty1d: /* @__PURE__ */ zod.z.number().int()
|
|
386
|
+
}),
|
|
387
|
+
retention: /* @__PURE__ */ zod.z.object({
|
|
388
|
+
lastRunAt: /* @__PURE__ */ zod.z.number().nullable(),
|
|
389
|
+
deleted: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.number().int()),
|
|
390
|
+
purgedSeries: /* @__PURE__ */ zod.z.number().int()
|
|
391
|
+
}),
|
|
392
|
+
directory: /* @__PURE__ */ zod.z.object({
|
|
393
|
+
devices: /* @__PURE__ */ zod.z.number().int(),
|
|
394
|
+
lastRefreshAt: /* @__PURE__ */ zod.z.number().nullable()
|
|
395
|
+
})
|
|
396
|
+
});
|
|
397
|
+
var deviceHistoryCapability = {
|
|
398
|
+
name: "device-history",
|
|
399
|
+
scope: "system",
|
|
400
|
+
mode: "singleton",
|
|
401
|
+
methods: {
|
|
402
|
+
/**
|
|
403
|
+
* The series a DEVICE has, and their span. `deviceId` is a flat top-level field
|
|
404
|
+
* on purpose: the generated device selector (and so the scope gate) only sees
|
|
405
|
+
* top-level ids, and a nested `subject.deviceId` would let a principal limited
|
|
406
|
+
* to one device read another's history. Node series are the admin-only
|
|
407
|
+
* `listNodeSeries` / `queryNode`.
|
|
408
|
+
*/
|
|
409
|
+
listSeries: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ deviceId: /* @__PURE__ */ zod.z.number().int() }), /* @__PURE__ */ zod.z.array(SeriesInfoSchema).readonly()),
|
|
410
|
+
/**
|
|
411
|
+
* A NODE's series. The subject is `forNodeId`, never `nodeId`: a top-level
|
|
412
|
+
* `nodeId` is the cap ROUTING key, and `nodeId: 'agent-a'` sent the
|
|
413
|
+
* read to that agent, which hosts no device-history.
|
|
414
|
+
*/
|
|
415
|
+
listNodeSeries: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ forNodeId: /* @__PURE__ */ zod.z.string().min(1) }), /* @__PURE__ */ zod.z.array(SeriesInfoSchema).readonly(), { auth: "admin" }),
|
|
416
|
+
/**
|
|
417
|
+
* One series (or every scope of it) at one resolution. `auto` picks the
|
|
418
|
+
* finest tier whose retention covers `from` and whose point count fits
|
|
419
|
+
* `maxPoints`; when even the coarsest tier does not fit, the newest
|
|
420
|
+
* `maxPoints` points are returned and `truncated` is true. A series fed by
|
|
421
|
+
* closed buckets has no raw rows, so `auto` never answers it from raw; nor
|
|
422
|
+
* {@link DEVICE_HISTORY_ENERGY_KEY}, which is computed from rollups.
|
|
423
|
+
*/
|
|
424
|
+
query: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
425
|
+
deviceId: /* @__PURE__ */ zod.z.number().int(),
|
|
426
|
+
...QueryWindowShape
|
|
427
|
+
}), QueryResultSchema),
|
|
428
|
+
queryNode: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
429
|
+
forNodeId: /* @__PURE__ */ zod.z.string().min(1),
|
|
430
|
+
...QueryWindowShape
|
|
431
|
+
}), QueryResultSchema, { auth: "admin" }),
|
|
432
|
+
/**
|
|
433
|
+
* Several reads over ONE window, answered in order (one entry per item).
|
|
434
|
+
* Admin-only: its subjects are nested in `items`, where the device scope
|
|
435
|
+
* gate cannot see them — a principal limited to one device uses `query`.
|
|
436
|
+
*/
|
|
437
|
+
queryMany: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
438
|
+
items: /* @__PURE__ */ zod.z.array(QueryManyItemSchema).min(1).max(24),
|
|
439
|
+
from: QueryWindowShape.from,
|
|
440
|
+
to: QueryWindowShape.to,
|
|
441
|
+
resolution: QueryWindowShape.resolution,
|
|
442
|
+
maxPoints: QueryWindowShape.maxPoints
|
|
443
|
+
}), /* @__PURE__ */ zod.z.object({ results: /* @__PURE__ */ zod.z.array(QueryManyEntrySchema).readonly() }), { auth: "admin" }),
|
|
444
|
+
/** Producer: declare (idempotent) a series key this addon owns: `addon:<callerAddonId>/<name>`. */
|
|
445
|
+
declareSeries: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
446
|
+
name: /* @__PURE__ */ zod.z.string().regex(/^[a-z0-9-]+$/),
|
|
447
|
+
subjectKind: /* @__PURE__ */ zod.z.enum(["device", "node"]),
|
|
448
|
+
kind: DeviceHistoryProducerKindSchema,
|
|
449
|
+
unit: /* @__PURE__ */ zod.z.string().optional(),
|
|
450
|
+
displayName: /* @__PURE__ */ zod.z.string().min(1),
|
|
451
|
+
ingest: /* @__PURE__ */ zod.z.enum(["points", "buckets"])
|
|
452
|
+
}), /* @__PURE__ */ zod.z.object({ key: /* @__PURE__ */ zod.z.string() }), {
|
|
453
|
+
kind: "mutation",
|
|
454
|
+
auth: "admin"
|
|
455
|
+
}),
|
|
456
|
+
/** Producer: points. Low rate: at most one per 10 s per series, sustained. */
|
|
457
|
+
record: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ points: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.object({
|
|
458
|
+
key: /* @__PURE__ */ zod.z.string(),
|
|
459
|
+
subject: DeviceHistorySubjectSchema,
|
|
460
|
+
scope: /* @__PURE__ */ zod.z.string().default(""),
|
|
461
|
+
ts: /* @__PURE__ */ zod.z.number(),
|
|
462
|
+
value: /* @__PURE__ */ zod.z.number()
|
|
463
|
+
})).max(5e3) }), IngestResultSchema, {
|
|
464
|
+
kind: "mutation",
|
|
465
|
+
auth: "admin"
|
|
466
|
+
}),
|
|
467
|
+
/** Producer: CLOSED five-minute buckets. Idempotent upsert keyed (series, bucketStart). */
|
|
468
|
+
recordBuckets: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ buckets: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.object({
|
|
469
|
+
key: /* @__PURE__ */ zod.z.string(),
|
|
470
|
+
subject: DeviceHistorySubjectSchema,
|
|
471
|
+
scope: /* @__PURE__ */ zod.z.string().default(""),
|
|
472
|
+
bucketStart: /* @__PURE__ */ zod.z.number(),
|
|
473
|
+
samples: /* @__PURE__ */ zod.z.number().int().positive(),
|
|
474
|
+
sum: /* @__PURE__ */ zod.z.number(),
|
|
475
|
+
min: /* @__PURE__ */ zod.z.number(),
|
|
476
|
+
max: /* @__PURE__ */ zod.z.number(),
|
|
477
|
+
last: /* @__PURE__ */ zod.z.number().nullable(),
|
|
478
|
+
lastTs: /* @__PURE__ */ zod.z.number().nullable()
|
|
479
|
+
})).max(5e3) }), IngestResultSchema, {
|
|
480
|
+
kind: "mutation",
|
|
481
|
+
auth: "admin"
|
|
482
|
+
}),
|
|
483
|
+
/** Per-device opt-out. This addon IS the authority: the switch stores nothing elsewhere (D62). */
|
|
484
|
+
getDeviceEnabled: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ deviceId: /* @__PURE__ */ zod.z.number().int() }), /* @__PURE__ */ zod.z.object({ enabled: /* @__PURE__ */ zod.z.boolean() })),
|
|
485
|
+
setDeviceEnabled: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
486
|
+
deviceId: /* @__PURE__ */ zod.z.number().int(),
|
|
487
|
+
enabled: /* @__PURE__ */ zod.z.boolean()
|
|
488
|
+
}), /* @__PURE__ */ zod.z.object({ enabled: /* @__PURE__ */ zod.z.boolean() }), {
|
|
489
|
+
kind: "mutation",
|
|
490
|
+
auth: "admin"
|
|
491
|
+
}),
|
|
492
|
+
getStatus: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), DeviceHistoryStatusSchema, { auth: "admin" }),
|
|
493
|
+
/**
|
|
494
|
+
* Device series no longer linked to a device (D917): the device is absent
|
|
495
|
+
* from the listings, or the key is declared by no capability. REPORTED,
|
|
496
|
+
* never purged by this judgement; each entry counts its rows per tier
|
|
497
|
+
* (a primary-key range per series). Ordered by device, key, scope.
|
|
498
|
+
*/
|
|
499
|
+
listOrphanSeries: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), OrphanListSchema, { auth: "admin" }),
|
|
500
|
+
/**
|
|
501
|
+
* Delete orphan series by id. Each id is re-judged NOW: a series that is
|
|
502
|
+
* not orphan (its device came back) is refused `not-orphan`, an unknown id
|
|
503
|
+
* `not-found`. Deletes tier by tier in the retention slices, then the
|
|
504
|
+
* series row; one entry per id, in order.
|
|
505
|
+
*/
|
|
506
|
+
deleteOrphanSeries: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ seriesIds: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.number().int()).min(1).max(50) }), /* @__PURE__ */ zod.z.object({ results: /* @__PURE__ */ zod.z.array(OrphanDeleteEntrySchema).readonly() }), {
|
|
507
|
+
kind: "mutation",
|
|
508
|
+
auth: "admin"
|
|
509
|
+
}),
|
|
510
|
+
/**
|
|
511
|
+
* Delete the points of ONE device series with a timestamp in
|
|
512
|
+
* `[fromMs, toMs]` (both inclusive, `fromMs < toMs`) — for a spurious
|
|
513
|
+
* reading an operator has judged wrong. The rollup rows covering the
|
|
514
|
+
* range (and the bucket that held the deleted value forward) are removed
|
|
515
|
+
* and rebuilt from the points that remain. `dryRun: true` deletes nothing
|
|
516
|
+
* and returns the counts a real run would remove. Only a series fed by
|
|
517
|
+
* points has a range to delete; a bucket-fed series is refused
|
|
518
|
+
* `not-a-point-series`. `scope` is the series' scope ('' for most).
|
|
519
|
+
*/
|
|
520
|
+
deleteSeriesRange: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
521
|
+
deviceId: /* @__PURE__ */ zod.z.number().int(),
|
|
522
|
+
key: /* @__PURE__ */ zod.z.string().min(1),
|
|
523
|
+
scope: /* @__PURE__ */ zod.z.string(),
|
|
524
|
+
fromMs: /* @__PURE__ */ zod.z.number().int().nonnegative(),
|
|
525
|
+
toMs: /* @__PURE__ */ zod.z.number().int().nonnegative(),
|
|
526
|
+
dryRun: /* @__PURE__ */ zod.z.boolean()
|
|
527
|
+
}), RangeDeleteResultSchema, {
|
|
528
|
+
kind: "mutation",
|
|
529
|
+
auth: "admin"
|
|
530
|
+
})
|
|
531
|
+
},
|
|
532
|
+
vocabulary: { notOperatorFacing: "recorded history of device state — read by charts, not actuated" }
|
|
533
|
+
};
|
|
534
|
+
//#endregion
|
|
535
|
+
//#region ../types/dist/esm/capabilities/device-removal-hook.cap.mjs
|
|
536
|
+
/**
|
|
537
|
+
* `device-removal-hook` — the reliable way an addon learns a device was DELETED,
|
|
538
|
+
* so it can delete what it keeps for that device (D865).
|
|
539
|
+
*
|
|
540
|
+
* ## Why an event was not enough
|
|
541
|
+
*
|
|
542
|
+
* `DeviceUnregistered` is telemetry and may be dropped (D8, D11). An addon that
|
|
543
|
+
* hung its per-device clean-up on it left durable garbage whenever the event was
|
|
544
|
+
* lost, the addon was down, or it was restarting at that moment — footage,
|
|
545
|
+
* analytics rows and settings of device 4483 outlived the device. Loss of this
|
|
546
|
+
* signal corrupts durable state, so it travels by RPC with a recorded fact
|
|
547
|
+
* behind it (D8: "if loss would corrupt durable state, use RPC plus a reconcile").
|
|
548
|
+
*
|
|
549
|
+
* ## The three pieces
|
|
550
|
+
*
|
|
551
|
+
* 1. device-manager records a TOMBSTONE per deleted device
|
|
552
|
+
* (`deviceManager.listDeletedSince`). The tombstone is written by the delete
|
|
553
|
+
* path only — a device that is unregistered, offline or whose provider is
|
|
554
|
+
* restarting is NOT deleted and gets none.
|
|
555
|
+
* 2. After a delete, device-manager calls `onDeviceRemoved` on EVERY provider of
|
|
556
|
+
* this collection, one by one, with bounded retries, logged.
|
|
557
|
+
* 3. An implementer that was down asks `deviceManager.listDeletedSince` at start
|
|
558
|
+
* (and periodically) and runs its own `onDeviceRemoved` for each tombstone it
|
|
559
|
+
* may have missed. Reconcile is driven by tombstones, never by "the device is
|
|
560
|
+
* not in the current list": a failed or partial list read must not destroy data.
|
|
561
|
+
*
|
|
562
|
+
* ## Contract for an implementer
|
|
563
|
+
*
|
|
564
|
+
* - **Idempotent.** It is called again by a retry, by a reconcile and by the
|
|
565
|
+
* admin cleanup of data that predates tombstones. A device with nothing left
|
|
566
|
+
* answers zero counts.
|
|
567
|
+
* - **One key per store** in `counts`, deleted rows/files per store, so the log
|
|
568
|
+
* line and the admin dry run can say where the data was.
|
|
569
|
+
* - **Training datasets are NOT device data** and are never deleted by a hook.
|
|
570
|
+
* - **Per-device SETTINGS are not hooked.** Configuration lives in the standard
|
|
571
|
+
* per-device store (`ctx.settings.*DeviceStore`), which device-manager clears
|
|
572
|
+
* for every addon centrally at delete time. This hook is for device DATA
|
|
573
|
+
* that is not settings: footage, event media, analytics rows, history.
|
|
574
|
+
* - A provider that cannot tell is allowed to throw; the caller retries it.
|
|
575
|
+
*
|
|
576
|
+
* `listDeviceData` is the read side of the admin "Clean data of deleted devices"
|
|
577
|
+
* action: which device ids this addon holds data for, and how much per store. It
|
|
578
|
+
* never deletes. device-manager decides which of those ids are absent from the
|
|
579
|
+
* fleet, from TWO consistent reads of the device list (D49).
|
|
580
|
+
*/
|
|
581
|
+
/** What a hook is told about the deletion. */
|
|
582
|
+
var DeviceRemovedInputSchema = /* @__PURE__ */ zod.z.object({
|
|
583
|
+
deviceId: /* @__PURE__ */ zod.z.number().int().positive(),
|
|
584
|
+
/** Epoch ms the device was deleted (the tombstone's `deletedAt`). */
|
|
585
|
+
deletedAt: /* @__PURE__ */ zod.z.number(),
|
|
586
|
+
/** The addon that owned the device, as device-manager last knew it. */
|
|
587
|
+
providerAddonId: /* @__PURE__ */ zod.z.string()
|
|
588
|
+
});
|
|
589
|
+
/** Rows/files/refs deleted, per store this implementer owns. */
|
|
590
|
+
var DeviceRemovedResultSchema = /* @__PURE__ */ zod.z.object({ counts: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.number().int().nonnegative()) });
|
|
591
|
+
/** One (store, device) pair an implementer holds data for. */
|
|
592
|
+
var DeviceDataEntrySchema = /* @__PURE__ */ zod.z.object({
|
|
593
|
+
store: /* @__PURE__ */ zod.z.string(),
|
|
594
|
+
deviceId: /* @__PURE__ */ zod.z.number().int().positive(),
|
|
595
|
+
/** Rows (or files) held for the device in the store. */
|
|
596
|
+
count: /* @__PURE__ */ zod.z.number().int().nonnegative()
|
|
597
|
+
});
|
|
598
|
+
var deviceRemovalHookCapability = {
|
|
599
|
+
name: "device-removal-hook",
|
|
600
|
+
scope: "system",
|
|
601
|
+
mode: "collection",
|
|
602
|
+
internal: true,
|
|
603
|
+
methods: {
|
|
604
|
+
/** Delete everything this addon keeps for the deleted device. Idempotent. */
|
|
605
|
+
onDeviceRemoved: /* @__PURE__ */ require_capability_definition.method(DeviceRemovedInputSchema, DeviceRemovedResultSchema, {
|
|
606
|
+
kind: "mutation",
|
|
607
|
+
auth: "admin"
|
|
608
|
+
}),
|
|
609
|
+
/** Which devices this addon holds data for, per store. Reads only. */
|
|
610
|
+
listDeviceData: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), /* @__PURE__ */ zod.z.array(DeviceDataEntrySchema).readonly(), { auth: "admin" })
|
|
611
|
+
},
|
|
612
|
+
/** In-process only — enumerated through `addons.listCapabilityProviders`. */
|
|
613
|
+
mount: { kind: "skip" },
|
|
614
|
+
vocabulary: { notOperatorFacing: require_system_reasons.NOT_A_DEVICE.INTERNAL }
|
|
615
|
+
};
|
|
616
|
+
//#endregion
|
|
617
|
+
//#region ../types/dist/esm/capabilities/device-runs.cap.mjs
|
|
618
|
+
/**
|
|
619
|
+
* device-runs - the durable record of ONE run of a device: a washing cycle, a
|
|
620
|
+
* dishwasher cycle, later a mow or a clean (D992).
|
|
621
|
+
*
|
|
622
|
+
* A run is a DOCUMENT (opened at one instant, closed at another, carrying what
|
|
623
|
+
* was measured over it), never a sample - device-history keeps the numbers over
|
|
624
|
+
* time and its `device-runs` provider keeps these documents beside them, because
|
|
625
|
+
* the energy of a run is a question about device-history's own series. The
|
|
626
|
+
* record is written from the `running-state` flip on `DeviceStateChanged`; it
|
|
627
|
+
* survives a restart (the open row is on disk) and a missed flip (boot compares
|
|
628
|
+
* the open rows against the live snapshots).
|
|
629
|
+
*
|
|
630
|
+
* Every measurement is `number | null` and `null` means "could not be
|
|
631
|
+
* measured", never `0` (D393). A run closed by the boot reconcile because the
|
|
632
|
+
* device stopped while nobody was watching has `outcome: 'unknown'`.
|
|
633
|
+
*/
|
|
634
|
+
var DeviceRunKindSchema = /* @__PURE__ */ zod.z.enum([
|
|
635
|
+
"appliance",
|
|
636
|
+
"mower",
|
|
637
|
+
"vacuum"
|
|
638
|
+
]);
|
|
639
|
+
var DeviceRunStateSchema = /* @__PURE__ */ zod.z.enum(["open", "closed"]);
|
|
640
|
+
var DeviceRunOutcomeSchema = /* @__PURE__ */ zod.z.enum([
|
|
641
|
+
"completed",
|
|
642
|
+
"aborted",
|
|
643
|
+
"error",
|
|
644
|
+
"unknown"
|
|
645
|
+
]);
|
|
646
|
+
/** What opened or closed the run. `reconcile` is the boot comparison against live state. */
|
|
647
|
+
var DeviceRunSourceSchema = /* @__PURE__ */ zod.z.enum([
|
|
648
|
+
"running-state",
|
|
649
|
+
"activity",
|
|
650
|
+
"reconcile"
|
|
651
|
+
]);
|
|
652
|
+
/** How the energy of a run was obtained; `null` when it could not be. */
|
|
653
|
+
var DeviceRunEnergyMethodSchema = /* @__PURE__ */ zod.z.enum(["counter-delta", "history-integral"]);
|
|
654
|
+
var DeviceRunPhaseSchema = /* @__PURE__ */ zod.z.object({
|
|
655
|
+
phase: /* @__PURE__ */ zod.z.string(),
|
|
656
|
+
at: /* @__PURE__ */ zod.z.number()
|
|
657
|
+
});
|
|
658
|
+
/** What an appliance run measured. Every number is `null` when unknown, never `0`. */
|
|
659
|
+
var ApplianceRunDetailSchema = /* @__PURE__ */ zod.z.object({
|
|
660
|
+
kind: /* @__PURE__ */ zod.z.literal("appliance"),
|
|
661
|
+
/** kWh used over the run. */
|
|
662
|
+
energyKwh: /* @__PURE__ */ zod.z.number().nullable().meta(/* @__PURE__ */ require_quantity.readingMeta("energy")),
|
|
663
|
+
energyMethod: /* @__PURE__ */ DeviceRunEnergyMethodSchema.nullable(),
|
|
664
|
+
/** Highest power seen while the run was open. */
|
|
665
|
+
peakW: /* @__PURE__ */ zod.z.number().nullable().meta(/* @__PURE__ */ require_quantity.readingMeta("power")),
|
|
666
|
+
/** Time-weighted mean power while the run was open. */
|
|
667
|
+
avgW: /* @__PURE__ */ zod.z.number().nullable().meta(/* @__PURE__ */ require_quantity.readingMeta("power")),
|
|
668
|
+
/** The program the appliance said it ran when the run opened. */
|
|
669
|
+
program: /* @__PURE__ */ zod.z.string().nullable(),
|
|
670
|
+
remainingAtStartSec: /* @__PURE__ */ zod.z.number().nullable().meta(/* @__PURE__ */ require_quantity.readingMeta("duration")),
|
|
671
|
+
/** The last phase the device reported before the run closed. */
|
|
672
|
+
finalPhase: /* @__PURE__ */ zod.z.string().nullable(),
|
|
673
|
+
/**
|
|
674
|
+
* The meter's energy counter when the run opened; `null` when the meter had
|
|
675
|
+
* not said (or the run was opened late, by the boot reconcile). It lives in
|
|
676
|
+
* the row so a run that outlives a restart still ends with `end - start`.
|
|
677
|
+
*/
|
|
678
|
+
energyStartKwh: /* @__PURE__ */ zod.z.number().nullable().meta(/* @__PURE__ */ require_quantity.readingMeta("energy")),
|
|
679
|
+
/** Milliseconds of power readings behind `avgW` - the weight a restart resumes the mean with. */
|
|
680
|
+
powerObservedMs: /* @__PURE__ */ zod.z.number()
|
|
681
|
+
});
|
|
682
|
+
/** The kind-specific block; a later phase adds a branch, nothing else changes. */
|
|
683
|
+
var DeviceRunDetailSchema = /* @__PURE__ */ zod.z.discriminatedUnion("kind", [ApplianceRunDetailSchema]);
|
|
684
|
+
var DeviceRunSchema = /* @__PURE__ */ zod.z.object({
|
|
685
|
+
/** `${deviceId}:${startedAt}`. */
|
|
686
|
+
runId: /* @__PURE__ */ zod.z.string(),
|
|
687
|
+
deviceId: /* @__PURE__ */ zod.z.number().int(),
|
|
688
|
+
kind: DeviceRunKindSchema,
|
|
689
|
+
state: DeviceRunStateSchema,
|
|
690
|
+
startedAt: /* @__PURE__ */ zod.z.number(),
|
|
691
|
+
endedAt: /* @__PURE__ */ zod.z.number().nullable(),
|
|
692
|
+
durationMs: /* @__PURE__ */ zod.z.number().nullable(),
|
|
693
|
+
outcome: /* @__PURE__ */ DeviceRunOutcomeSchema.nullable(),
|
|
694
|
+
startSource: DeviceRunSourceSchema,
|
|
695
|
+
endSource: /* @__PURE__ */ DeviceRunSourceSchema.nullable(),
|
|
696
|
+
/** Where the device's running bit came from (`running-state.source`); `null` when it did not say. */
|
|
697
|
+
runningSource: /* @__PURE__ */ zod.z.enum(["native", "assigned"]).nullable(),
|
|
698
|
+
phases: /* @__PURE__ */ zod.z.array(DeviceRunPhaseSchema),
|
|
699
|
+
detail: DeviceRunDetailSchema
|
|
700
|
+
});
|
|
701
|
+
var deviceRunsCapability = {
|
|
702
|
+
name: "device-runs",
|
|
703
|
+
scope: "device",
|
|
704
|
+
mode: "singleton",
|
|
705
|
+
kind: "wrapper",
|
|
706
|
+
defaultActive: true,
|
|
707
|
+
deviceTypes: [
|
|
708
|
+
require_device_type.DeviceType.Washer,
|
|
709
|
+
require_device_type.DeviceType.Dryer,
|
|
710
|
+
require_device_type.DeviceType.Dishwasher
|
|
711
|
+
],
|
|
712
|
+
methods: {
|
|
713
|
+
/** Runs of a device, newest first. `limit` is bounded; page with `cursor`. */
|
|
714
|
+
listRuns: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
715
|
+
deviceId: /* @__PURE__ */ zod.z.number().int(),
|
|
716
|
+
outcome: /* @__PURE__ */ DeviceRunOutcomeSchema.optional(),
|
|
717
|
+
atFrom: /* @__PURE__ */ zod.z.number().optional(),
|
|
718
|
+
atTo: /* @__PURE__ */ zod.z.number().optional(),
|
|
719
|
+
limit: /* @__PURE__ */ zod.z.number().int().positive().max(200).default(50),
|
|
720
|
+
cursor: /* @__PURE__ */ zod.z.string().optional()
|
|
721
|
+
}), /* @__PURE__ */ zod.z.object({
|
|
722
|
+
runs: /* @__PURE__ */ zod.z.array(DeviceRunSchema).readonly(),
|
|
723
|
+
nextCursor: /* @__PURE__ */ zod.z.string().nullable()
|
|
724
|
+
})),
|
|
725
|
+
getRun: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
726
|
+
deviceId: /* @__PURE__ */ zod.z.number().int(),
|
|
727
|
+
runId: /* @__PURE__ */ zod.z.string()
|
|
728
|
+
}), /* @__PURE__ */ DeviceRunSchema.nullable()),
|
|
729
|
+
/** The run open right now, or `null` (answered: there is none). */
|
|
730
|
+
getCurrentRun: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ deviceId: /* @__PURE__ */ zod.z.number().int() }), /* @__PURE__ */ DeviceRunSchema.nullable())
|
|
731
|
+
},
|
|
732
|
+
events: {
|
|
733
|
+
onRunOpened: {
|
|
734
|
+
data: DeviceRunSchema,
|
|
735
|
+
notOperatorFacing: "the durable record of a run that the running-state start flip already announces"
|
|
736
|
+
},
|
|
737
|
+
onRunClosed: {
|
|
738
|
+
data: DeviceRunSchema,
|
|
739
|
+
notOperatorFacing: "the durable record of a run that the running-state finish flip already announces"
|
|
740
|
+
}
|
|
741
|
+
},
|
|
742
|
+
vocabulary: {
|
|
743
|
+
noun: /* @__PURE__ */ require_l10n.t("Runs", "Esecuzioni"),
|
|
744
|
+
order: 2130
|
|
745
|
+
}
|
|
746
|
+
};
|
|
747
|
+
//#endregion
|
|
748
|
+
//#region ../types/dist/esm/capabilities/device-transitions.cap.mjs
|
|
749
|
+
/** Why a row of a `record` batch was not written. */
|
|
750
|
+
var TransitionRefusalReasonSchema = /* @__PURE__ */ zod.z.enum(["not-kernel", "invalid"]);
|
|
751
|
+
var TransitionRecordResultSchema = /* @__PURE__ */ zod.z.object({
|
|
752
|
+
written: /* @__PURE__ */ zod.z.number().int().nonnegative(),
|
|
753
|
+
refused: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.object({
|
|
754
|
+
id: /* @__PURE__ */ zod.z.string(),
|
|
755
|
+
reason: TransitionRefusalReasonSchema
|
|
756
|
+
})).readonly()
|
|
757
|
+
});
|
|
758
|
+
var TransitionsStatusSchema = /* @__PURE__ */ zod.z.object({
|
|
759
|
+
/** Rows in the ledger; `null` until counted. */
|
|
760
|
+
rows: /* @__PURE__ */ zod.z.number().int().nullable(),
|
|
761
|
+
lastWriteAt: /* @__PURE__ */ zod.z.number().nullable(),
|
|
762
|
+
/** Refused rows since start, by reason. */
|
|
763
|
+
refused: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.number())
|
|
764
|
+
});
|
|
765
|
+
var deviceTransitionsCapability = {
|
|
766
|
+
name: "device-transitions",
|
|
767
|
+
scope: "device",
|
|
768
|
+
mode: "singleton",
|
|
769
|
+
kind: "wrapper",
|
|
770
|
+
defaultActive: true,
|
|
771
|
+
deviceTypes: /* @__PURE__ */ Object.values(require_device_type.DeviceType).filter((type) => type !== require_device_type.DeviceType.Container),
|
|
772
|
+
methods: {
|
|
773
|
+
/**
|
|
774
|
+
* Transitions of a device, newest first. `limit` is bounded; page with `cursor`.
|
|
775
|
+
* At most ONE of `capName`, `actorKind`, `outcome` per call - each is served by its own index.
|
|
776
|
+
*/
|
|
777
|
+
listTransitions: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
778
|
+
deviceId: /* @__PURE__ */ zod.z.number().int(),
|
|
779
|
+
capName: /* @__PURE__ */ zod.z.string().optional(),
|
|
780
|
+
actorKind: /* @__PURE__ */ TransitionActorKindSchema.optional(),
|
|
781
|
+
outcome: /* @__PURE__ */ TransitionOutcomeSchema.optional(),
|
|
782
|
+
atFrom: /* @__PURE__ */ zod.z.number().optional(),
|
|
783
|
+
atTo: /* @__PURE__ */ zod.z.number().optional(),
|
|
784
|
+
limit: /* @__PURE__ */ zod.z.number().int().positive().max(200).default(50),
|
|
785
|
+
cursor: /* @__PURE__ */ zod.z.string().optional()
|
|
786
|
+
}), /* @__PURE__ */ zod.z.object({
|
|
787
|
+
transitions: /* @__PURE__ */ zod.z.array(DeviceTransitionSchema).readonly(),
|
|
788
|
+
nextCursor: /* @__PURE__ */ zod.z.string().nullable()
|
|
789
|
+
})),
|
|
790
|
+
getTransition: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
791
|
+
deviceId: /* @__PURE__ */ zod.z.number().int(),
|
|
792
|
+
id: /* @__PURE__ */ zod.z.string()
|
|
793
|
+
}), /* @__PURE__ */ DeviceTransitionSchema.nullable()),
|
|
794
|
+
/** The fleet page, newest first. At most ONE of `actorKind`, `outcome` per call. */
|
|
795
|
+
listRecentTransitions: /* @__PURE__ */ require_capability_definition.systemMethod(/* @__PURE__ */ zod.z.object({
|
|
796
|
+
actorKind: /* @__PURE__ */ TransitionActorKindSchema.optional(),
|
|
797
|
+
outcome: /* @__PURE__ */ TransitionOutcomeSchema.optional(),
|
|
798
|
+
atFrom: /* @__PURE__ */ zod.z.number().optional(),
|
|
799
|
+
atTo: /* @__PURE__ */ zod.z.number().optional(),
|
|
800
|
+
limit: /* @__PURE__ */ zod.z.number().int().positive().max(200).default(50),
|
|
801
|
+
cursor: /* @__PURE__ */ zod.z.string().optional()
|
|
802
|
+
}), /* @__PURE__ */ zod.z.object({
|
|
803
|
+
transitions: /* @__PURE__ */ zod.z.array(DeviceTransitionSchema).readonly(),
|
|
804
|
+
nextCursor: /* @__PURE__ */ zod.z.string().nullable()
|
|
805
|
+
}), { auth: "admin" }),
|
|
806
|
+
/** Kernel write: device-manager delivers a batch. Refused for any other caller. */
|
|
807
|
+
record: /* @__PURE__ */ require_capability_definition.systemMethod(/* @__PURE__ */ zod.z.object({ transitions: /* @__PURE__ */ zod.z.array(DeviceTransitionSchema).max(500) }), TransitionRecordResultSchema, {
|
|
808
|
+
kind: "mutation",
|
|
809
|
+
auth: "admin"
|
|
810
|
+
}),
|
|
811
|
+
getStatus: /* @__PURE__ */ require_capability_definition.systemMethod(/* @__PURE__ */ zod.z.object({}), TransitionsStatusSchema, { auth: "admin" })
|
|
812
|
+
},
|
|
813
|
+
vocabulary: {
|
|
814
|
+
noun: /* @__PURE__ */ require_l10n.t("Transitions", "Transizioni"),
|
|
815
|
+
order: 2140
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
//#endregion
|
|
819
|
+
Object.defineProperty(exports, "DEVICE_HISTORY_ENERGY_KEY", {
|
|
820
|
+
enumerable: true,
|
|
821
|
+
get: function() {
|
|
822
|
+
return DEVICE_HISTORY_ENERGY_KEY;
|
|
823
|
+
}
|
|
824
|
+
});
|
|
825
|
+
Object.defineProperty(exports, "DeviceRunSchema", {
|
|
826
|
+
enumerable: true,
|
|
827
|
+
get: function() {
|
|
828
|
+
return DeviceRunSchema;
|
|
829
|
+
}
|
|
830
|
+
});
|
|
831
|
+
Object.defineProperty(exports, "DeviceTransitionSchema", {
|
|
832
|
+
enumerable: true,
|
|
833
|
+
get: function() {
|
|
834
|
+
return DeviceTransitionSchema;
|
|
835
|
+
}
|
|
836
|
+
});
|
|
837
|
+
Object.defineProperty(exports, "deviceHistoryCapability", {
|
|
838
|
+
enumerable: true,
|
|
839
|
+
get: function() {
|
|
840
|
+
return deviceHistoryCapability;
|
|
841
|
+
}
|
|
842
|
+
});
|
|
843
|
+
Object.defineProperty(exports, "deviceRemovalHookCapability", {
|
|
844
|
+
enumerable: true,
|
|
845
|
+
get: function() {
|
|
846
|
+
return deviceRemovalHookCapability;
|
|
847
|
+
}
|
|
848
|
+
});
|
|
849
|
+
Object.defineProperty(exports, "deviceRunsCapability", {
|
|
850
|
+
enumerable: true,
|
|
851
|
+
get: function() {
|
|
852
|
+
return deviceRunsCapability;
|
|
853
|
+
}
|
|
854
|
+
});
|
|
855
|
+
Object.defineProperty(exports, "deviceTransitionsCapability", {
|
|
856
|
+
enumerable: true,
|
|
857
|
+
get: function() {
|
|
858
|
+
return deviceTransitionsCapability;
|
|
859
|
+
}
|
|
860
|
+
});
|