@camstack/server 1.2.927 → 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 +12 -0
- package/package.json +11 -14
- 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-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 +3 -1
- 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 +3 -1
- package/system/dist/builtins/alerts/alerts.addon.js +113 -56
- package/system/dist/builtins/alerts/alerts.addon.mjs +58 -1
- 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 +5 -2
- 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 +103 -3
- 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 +142 -1
- package/system/dist/builtins/platform-probe/index.js +25 -23
- package/system/dist/builtins/platform-probe/index.mjs +4 -2
- 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 +2 -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/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 +6 -3
- 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-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-BBXzP6Ve.mjs → hub-identity-DjMN9Ac2.mjs} +1 -1
- package/system/dist/{hub-mdns-ciao-By5577HM.js → hub-mdns-ciao--0v1TKME.js} +5 -5
- package/system/dist/{hub-mdns-ciao-DG17NbGU.mjs → hub-mdns-ciao-DBrtHOcc.mjs} +2 -2
- package/system/dist/index.js +763 -151
- package/system/dist/index.mjs +624 -12
- 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-kwtBd00M.mjs → restore-archive-CjAyKpgX.mjs} +3 -1
- 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-DBlgWB8k.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
|
@@ -1,9 +1,588 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { i as motionCapability } from "../../stream-catalog.cap-Bp7SkgIf.mjs";
|
|
2
|
+
import { b as EventCategory, p as createEvent, t as BaseAddon } from "../../base-addon-Md14i7pe.mjs";
|
|
3
|
+
import { Z as errMsg } from "../../scoped-settings-DVWUIP7Z.mjs";
|
|
4
|
+
import { An as colorCapability, E as valveCapability, En as consumablesCapability, Jt as groupCommandsCapability, Kt as GroupCommandResultSchema, Ln as brightnessCapability, Nn as HvacModeSchema, On as composerCapability, Pn as climateControlCapability, U as RUNNING_CUSTOMIZE_DEVICE_TYPES, c as kebabToCamel, ct as petFountainWaterItem, gt as lockControlCapability, in as FanDirectionSchema, jn as parseColorInput, m as ALL_CAPABILITY_DEFINITIONS, n as renameCompositionBlock, ot as PetFountainStatusSchema, sn as fanControlCapability, st as petFountainCapability, wn as ConsumableItemSchema, xn as coverCapability, z as switchCapability } from "../../rename-composition-block-7WIICIDq.mjs";
|
|
5
|
+
import { i as isReadingQuantity } from "../../quantity-D3g5SxsZ.mjs";
|
|
6
|
+
import { i as featuresOfBoundCaps, r as DeviceType, t as DeviceFeature } from "../../device-type-DgEvK3ch.mjs";
|
|
7
|
+
import { D as COMPOSED_ITEM_FIXED_FIELDS, E as featureForwards, M as mediaPlayerCapability, O as expressionContainsBuiltinCall, T as commandedMethods, Z as compositionFieldKey, g as planComposition, p as buildCapabilityLookup } from "../../core-blocks.cap-C6iKAZ-x.mjs";
|
|
8
|
+
import { a as tryConvertUnit } from "../../addon-settings.cap-3-TIIMq_.mjs";
|
|
9
|
+
import { $ as planResetTier, A as compositionItemFieldPath, D as composedDeviceRef, G as HISTORY_FAST_MS, H as isHistoryHelper, J as MINUTE_MS, K as HISTORY_SLOW_MS, L as isForwardInputRef, M as compositionSliceKey, N as compositionSourceKey, O as composedDeviceStableId, Q as openStatistic, V as isEngineHostedHelper, W as DEFAULT_HISTORY_RETENTION, X as nextLocalMidnight, Y as historyRetentionFromSettings, Z as openReset, _ as groupTemplate, at as cloneStatefulExpressionMemory, ct as evaluateStatefulExpressionCall, et as planStatisticTier, g as sharedColorModes, gt as evaluateCount, h as runFanOut, ht as disarmRoseMemory, it as integrateReading, k as compositionFeatureEnabled, lt as toExpressionValue, m as fanOutTargets, nt as evaluateDerivative, ot as createStatefulExpressionMemory, p as declaredSeriesKind, q as HOUR_MS, rt as evaluateStatistic, st as evaluateExpressionSource, tt as statisticCadenceMs, x as COMPOSER_ADDON_ID } from "../../error.cap-CSM_SRfR.mjs";
|
|
10
|
+
import { a as normalizeUnit } from "../../source-info-DGB7SdB_.mjs";
|
|
11
|
+
import { n as normalizedNativeOwner, r as compileScalarOverride } from "../../composition-sources-Caqv7O7z.mjs";
|
|
12
|
+
import { t as DeclaredDevices } from "../../declared-device-CKERA1Hi.mjs";
|
|
13
|
+
import { t as BaseDevice } from "../../base-device-IuM1AwXZ.mjs";
|
|
14
|
+
import { i as capSeriesKey, m as parseConfirmedStateChanged, p as isRecord$4 } from "../../capture-engine-DiwbjoWp.mjs";
|
|
4
15
|
import { i as DAY_MS, t as DEFAULT_RETENTION } from "../../retention-CUOVI1p7.mjs";
|
|
5
|
-
import { n as renameCompositionBlock } from "../../rename-composition-block-DtaYmYAR.mjs";
|
|
6
16
|
import { z } from "zod";
|
|
17
|
+
//#region ../types/dist/esm/remote/remote-media-features.mjs
|
|
18
|
+
/**
|
|
19
|
+
* Which media-player surfaces a remote's BOUND roles give a device (D967
|
|
20
|
+
* amendment). A television driven by infrared reports nothing, so its surface is
|
|
21
|
+
* exactly what the operator wired: a bound `volume_up` is `VolumeStep`, never a
|
|
22
|
+
* level. One mapping, read by the composer (the device's `features`) and by an
|
|
23
|
+
* exporter deciding what to offer.
|
|
24
|
+
*/
|
|
25
|
+
var FEATURE_ROLES = [
|
|
26
|
+
[DeviceFeature.MediaPlayerPower, [
|
|
27
|
+
"power",
|
|
28
|
+
"power_on",
|
|
29
|
+
"power_off"
|
|
30
|
+
]],
|
|
31
|
+
[DeviceFeature.MediaPlayerVolumeStep, ["volume_up", "volume_down"]],
|
|
32
|
+
[DeviceFeature.MediaPlayerChannelStep, ["channel_up", "channel_down"]],
|
|
33
|
+
[DeviceFeature.MediaPlayerMute, ["mute"]],
|
|
34
|
+
[DeviceFeature.MediaPlayerStop, ["stop"]],
|
|
35
|
+
[DeviceFeature.MediaPlayerNext, ["next"]],
|
|
36
|
+
[DeviceFeature.MediaPlayerPrevious, ["previous"]]
|
|
37
|
+
];
|
|
38
|
+
/**
|
|
39
|
+
* The features the bound roles stand for, in a stable order. A source surface
|
|
40
|
+
* exists only for DECLARED sources (planning#460): a bound `input` or custom
|
|
41
|
+
* button is a button, not a source.
|
|
42
|
+
*/
|
|
43
|
+
function mediaPlayerFeaturesOfRoles(roles, declaredSources) {
|
|
44
|
+
const bound = new Set(roles);
|
|
45
|
+
const fixed = FEATURE_ROLES.filter(([, wanted]) => wanted.some((role) => bound.has(role))).map(([feature]) => feature);
|
|
46
|
+
return declaredSources > 0 ? [...fixed, DeviceFeature.MediaPlayerSelectSource] : fixed;
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region ../types/dist/esm/composition/helpers/actuator-methods.mjs
|
|
50
|
+
/**
|
|
51
|
+
* One method table per actuator type (D944). A group offers a method only
|
|
52
|
+
* when every member can take it, so a command never reaches a member that
|
|
53
|
+
* lacks the surface: the cap must be bound by every member (the primary cap of
|
|
54
|
+
* the type is the exception — a member that lacks it is simply not commanded),
|
|
55
|
+
* and a row that names a device feature needs every member to advertise it.
|
|
56
|
+
* Offline does not remove a method: capability is the binding, not liveness.
|
|
57
|
+
*/
|
|
58
|
+
var ACTUATOR_TEMPLATE_IDS = [
|
|
59
|
+
"switch",
|
|
60
|
+
"light",
|
|
61
|
+
"fan",
|
|
62
|
+
"cover",
|
|
63
|
+
"valve",
|
|
64
|
+
"lock",
|
|
65
|
+
"media-player",
|
|
66
|
+
"climate"
|
|
67
|
+
];
|
|
68
|
+
function row(cap, method, requires = null, confirm = false) {
|
|
69
|
+
return {
|
|
70
|
+
cap,
|
|
71
|
+
method,
|
|
72
|
+
requires,
|
|
73
|
+
confirm
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** The first row's cap is the type's own: always offered, members without it are skipped. */
|
|
77
|
+
var ACTUATOR_METHODS = {
|
|
78
|
+
switch: [/* @__PURE__ */ row("switch", "setState")],
|
|
79
|
+
light: [
|
|
80
|
+
/* @__PURE__ */ row("switch", "setState"),
|
|
81
|
+
/* @__PURE__ */ row("brightness", "setBrightness"),
|
|
82
|
+
/* @__PURE__ */ row("color", "setColor")
|
|
83
|
+
],
|
|
84
|
+
fan: [
|
|
85
|
+
/* @__PURE__ */ row("switch", "setState"),
|
|
86
|
+
/* @__PURE__ */ row("fan-control", "setPercentage", DeviceFeature.FanSpeed),
|
|
87
|
+
/* @__PURE__ */ row("fan-control", "setPreset", DeviceFeature.FanPreset),
|
|
88
|
+
/* @__PURE__ */ row("fan-control", "setDirection", DeviceFeature.FanDirection),
|
|
89
|
+
/* @__PURE__ */ row("fan-control", "setOscillating", DeviceFeature.FanOscillating)
|
|
90
|
+
],
|
|
91
|
+
cover: [
|
|
92
|
+
/* @__PURE__ */ row("cover", "open"),
|
|
93
|
+
/* @__PURE__ */ row("cover", "close"),
|
|
94
|
+
/* @__PURE__ */ row("cover", "stop", DeviceFeature.CoverStoppable),
|
|
95
|
+
/* @__PURE__ */ row("cover", "setPosition", DeviceFeature.CoverPositionable),
|
|
96
|
+
/* @__PURE__ */ row("cover", "setTiltPosition", DeviceFeature.CoverTilt)
|
|
97
|
+
],
|
|
98
|
+
valve: [
|
|
99
|
+
/* @__PURE__ */ row("valve", "open"),
|
|
100
|
+
/* @__PURE__ */ row("valve", "close"),
|
|
101
|
+
/* @__PURE__ */ row("valve", "setPosition", DeviceFeature.ValvePositionable)
|
|
102
|
+
],
|
|
103
|
+
lock: [/* @__PURE__ */ row("lock-control", "lock"), /* @__PURE__ */ row("lock-control", "unlock", null, true)],
|
|
104
|
+
"media-player": [
|
|
105
|
+
/* @__PURE__ */ row("media-player", "play"),
|
|
106
|
+
/* @__PURE__ */ row("media-player", "pause"),
|
|
107
|
+
/* @__PURE__ */ row("media-player", "setVolume", DeviceFeature.MediaPlayerVolume)
|
|
108
|
+
],
|
|
109
|
+
climate: [
|
|
110
|
+
/* @__PURE__ */ row("climate-control", "setMode"),
|
|
111
|
+
/* @__PURE__ */ row("climate-control", "setTarget"),
|
|
112
|
+
/* @__PURE__ */ row("climate-control", "setFanMode", DeviceFeature.ClimateFanMode)
|
|
113
|
+
]
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* The rows every member can take. An empty member list shares nothing; the
|
|
117
|
+
* caller passes a surface for every member it could read, or none at all.
|
|
118
|
+
*/
|
|
119
|
+
function sharedActuatorMethods(templateId, members) {
|
|
120
|
+
if (members.length === 0) return [];
|
|
121
|
+
const rows = ACTUATOR_METHODS[templateId];
|
|
122
|
+
const primary = rows[0]?.cap;
|
|
123
|
+
return rows.filter((item) => {
|
|
124
|
+
if (!(item.cap === primary || members.every((member) => member.caps.includes(item.cap)))) return false;
|
|
125
|
+
const needed = item.requires;
|
|
126
|
+
return needed === null || members.every((member) => member.features.includes(needed));
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
/** The device features every member has, among those the table gates on, in table order. */
|
|
130
|
+
function sharedActuatorFeatures(templateId, featureLists) {
|
|
131
|
+
if (featureLists.length === 0) return [];
|
|
132
|
+
const gated = ACTUATOR_METHODS[templateId].flatMap((item) => item.requires === null ? [] : [item.requires]);
|
|
133
|
+
return [...new Set(gated)].filter((feature) => featureLists.every((features) => features.includes(feature)));
|
|
134
|
+
}
|
|
135
|
+
var UNLOCK_CONFIRMATION = "unlocking a group of locks needs an explicit confirmation (confirm: true) — it was not given, so no lock was sent anything";
|
|
136
|
+
/**
|
|
137
|
+
* Why a call must not be fanned out, or null. Only a confirmed row passes
|
|
138
|
+
* without `confirm: true`; anything else is the caller's to refuse by name.
|
|
139
|
+
*/
|
|
140
|
+
function methodRefusal(method, args) {
|
|
141
|
+
if (method === null) return "that method is not one this group shares";
|
|
142
|
+
if (method.confirm && args.confirm !== true) return UNLOCK_CONFIRMATION;
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region ../types/dist/esm/composition/helpers/aggregate.mjs
|
|
147
|
+
function isBinaryReducer(reducer) {
|
|
148
|
+
return reducer === "any" || reducer === "all";
|
|
149
|
+
}
|
|
150
|
+
function includedValue(reducer, member, activeWhen) {
|
|
151
|
+
if (member.state !== "fresh") return null;
|
|
152
|
+
if (isBinaryReducer(reducer)) {
|
|
153
|
+
if (activeWhen !== void 0) return typeof member.value === "string" ? activeWhen.includes(member.value) : null;
|
|
154
|
+
return typeof member.value === "boolean" ? member.value : null;
|
|
155
|
+
}
|
|
156
|
+
return typeof member.value === "number" && Number.isFinite(member.value) ? member.value : null;
|
|
157
|
+
}
|
|
158
|
+
function median(values) {
|
|
159
|
+
const sorted = [...values].toSorted((a, b) => a - b);
|
|
160
|
+
const mid = Math.floor(sorted.length / 2);
|
|
161
|
+
const right = sorted[mid];
|
|
162
|
+
const left = sorted[mid - 1];
|
|
163
|
+
if (right === void 0) throw new Error("median requires at least one finite number");
|
|
164
|
+
if (sorted.length % 2 === 1) return right;
|
|
165
|
+
if (left === void 0) throw new Error("median requires at least one finite number");
|
|
166
|
+
return (left + right) / 2;
|
|
167
|
+
}
|
|
168
|
+
function reduceNumbers(reducer, values) {
|
|
169
|
+
if (reducer === "min") return Math.min(...values);
|
|
170
|
+
if (reducer === "max") return Math.max(...values);
|
|
171
|
+
if (reducer === "sum") return values.reduce((sum, value) => sum + value, 0);
|
|
172
|
+
if (reducer === "median") return median(values);
|
|
173
|
+
return values.reduce((sum, value) => sum + value, 0) / values.length;
|
|
174
|
+
}
|
|
175
|
+
function reduceBooleans(reducer, values) {
|
|
176
|
+
return reducer === "all" ? values.every((value) => value) : values.some((value) => value);
|
|
177
|
+
}
|
|
178
|
+
function countsOf(included, total) {
|
|
179
|
+
return {
|
|
180
|
+
included,
|
|
181
|
+
excluded: total - included,
|
|
182
|
+
total
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function fatalReason(members) {
|
|
186
|
+
const reasons = members.flatMap((member) => member.state === "unavailable" && member.fatal === true ? [member.reason ?? "source gone"] : []);
|
|
187
|
+
return reasons.length === 0 ? null : reasons.join("; ");
|
|
188
|
+
}
|
|
189
|
+
function emptyOutcome(empty, counts) {
|
|
190
|
+
if (empty === "null") return {
|
|
191
|
+
kind: "value",
|
|
192
|
+
value: null,
|
|
193
|
+
counts
|
|
194
|
+
};
|
|
195
|
+
return {
|
|
196
|
+
kind: "unavailable",
|
|
197
|
+
fatal: false,
|
|
198
|
+
reason: "no member included — unknown is not 0 or off",
|
|
199
|
+
counts
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
/** Pure. `members` is not mutated. An empty included set is null or unavailable, never 0 or false. */
|
|
203
|
+
function evaluateAggregate(input) {
|
|
204
|
+
const included = input.members.flatMap((member) => {
|
|
205
|
+
const value = includedValue(input.reducer, member, input.activeWhen);
|
|
206
|
+
return value === null ? [] : [value];
|
|
207
|
+
});
|
|
208
|
+
const counts = countsOf(included.length, input.members.length);
|
|
209
|
+
const gone = fatalReason(input.members);
|
|
210
|
+
if (gone !== null) return {
|
|
211
|
+
kind: "unavailable",
|
|
212
|
+
fatal: true,
|
|
213
|
+
reason: gone,
|
|
214
|
+
counts
|
|
215
|
+
};
|
|
216
|
+
if (input.publish === "included") return {
|
|
217
|
+
kind: "value",
|
|
218
|
+
value: counts.included,
|
|
219
|
+
counts
|
|
220
|
+
};
|
|
221
|
+
if (input.publish === "excluded") return {
|
|
222
|
+
kind: "value",
|
|
223
|
+
value: counts.excluded,
|
|
224
|
+
counts
|
|
225
|
+
};
|
|
226
|
+
if (input.publish === "total") return {
|
|
227
|
+
kind: "value",
|
|
228
|
+
value: counts.total,
|
|
229
|
+
counts
|
|
230
|
+
};
|
|
231
|
+
if (included.length === 0) return emptyOutcome(input.empty, counts);
|
|
232
|
+
if (isBinaryReducer(input.reducer)) {
|
|
233
|
+
const flags = included.filter((value) => typeof value === "boolean");
|
|
234
|
+
return {
|
|
235
|
+
kind: "value",
|
|
236
|
+
value: reduceBooleans(input.reducer, flags),
|
|
237
|
+
counts
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
const numbers = included.filter((value) => typeof value === "number");
|
|
241
|
+
return {
|
|
242
|
+
kind: "value",
|
|
243
|
+
value: reduceNumbers(input.reducer, numbers),
|
|
244
|
+
counts
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region ../types/dist/esm/composition/actuator-running.mjs
|
|
249
|
+
/**
|
|
250
|
+
* Switch on = device on (D933, amended): a device with an ACTUATOR switch - its
|
|
251
|
+
* own `switch`, the one that turns its function on - runs while that switch is on.
|
|
252
|
+
* A SUPPLY switch (`power-source.switchOn`, an appliance on a plug) is never a
|
|
253
|
+
* running source: the appliance keeps its power while it is idle.
|
|
254
|
+
*
|
|
255
|
+
* The default is derived from STRUCTURE (an actuator switch is present and no
|
|
256
|
+
* supply relation is), computed at plan time and never written into the stored
|
|
257
|
+
* composition: a stored composition is never rewritten silently, and an
|
|
258
|
+
* authored `running` field always wins. The operator turns the default on and
|
|
259
|
+
* off in the Customize running row ("Follow the device's switch").
|
|
260
|
+
*/
|
|
261
|
+
var RUNNING_CAP = "running-state";
|
|
262
|
+
var SWITCH_CAP = "switch";
|
|
263
|
+
var ON_FIELD = "on";
|
|
264
|
+
var CHANGED_AT_FIELD = "lastChangedAt";
|
|
265
|
+
function fieldsFeatureOf(composition, cap) {
|
|
266
|
+
const feature = composition.features.find((f) => f.cap === cap);
|
|
267
|
+
return feature !== void 0 && feature.kind === "fields" ? feature : null;
|
|
268
|
+
}
|
|
269
|
+
/** The device switch the composed `switch.on` reads, when it is one plain `from` of a switch. */
|
|
270
|
+
function actuatorSwitchRead(composition) {
|
|
271
|
+
const feature = fieldsFeatureOf(composition, SWITCH_CAP);
|
|
272
|
+
if (feature === null || !compositionFeatureEnabled(feature)) return null;
|
|
273
|
+
const field = feature.fields[ON_FIELD];
|
|
274
|
+
if (field === void 0 || field.kind !== "from" || field.cap !== SWITCH_CAP) return null;
|
|
275
|
+
return {
|
|
276
|
+
source: field.source,
|
|
277
|
+
cap: field.cap,
|
|
278
|
+
fieldPath: field.fieldPath
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function hasSupplyRelation(composition) {
|
|
282
|
+
const feature = fieldsFeatureOf(composition, "power-source");
|
|
283
|
+
return feature !== null && compositionFeatureEnabled(feature) && feature.fields["switchOn"] !== void 0;
|
|
284
|
+
}
|
|
285
|
+
/** Anything stored for running - a rule, or the opt-out - is the operator's, and the default stays out of it. */
|
|
286
|
+
function hasAuthoredRunning(composition) {
|
|
287
|
+
return fieldsFeatureOf(composition, RUNNING_CAP) !== null;
|
|
288
|
+
}
|
|
289
|
+
/** A NEW device of a type that offers "running", with an actuator switch and no supply relation. */
|
|
290
|
+
function actuatorSwitchDrivesRunning(composition) {
|
|
291
|
+
const target = composition.target;
|
|
292
|
+
if (target.kind !== "new") return false;
|
|
293
|
+
if (!RUNNING_CUSTOMIZE_DEVICE_TYPES.some((type) => type === target.type)) return false;
|
|
294
|
+
return actuatorSwitchRead(composition) !== null && !hasSupplyRelation(composition);
|
|
295
|
+
}
|
|
296
|
+
/** The `running-state` feature that reads the actuator switch: the one the scalar compiler stores. */
|
|
297
|
+
function followSwitchRunningFeature(composition, host) {
|
|
298
|
+
const read = actuatorSwitchRead(composition);
|
|
299
|
+
if (read === null) return null;
|
|
300
|
+
const compiled = compileScalarOverride({
|
|
301
|
+
draft: {
|
|
302
|
+
kind: "scalar",
|
|
303
|
+
cap: RUNNING_CAP,
|
|
304
|
+
targetId: "running",
|
|
305
|
+
source: {
|
|
306
|
+
...read.source,
|
|
307
|
+
cap: read.cap,
|
|
308
|
+
fieldPath: read.fieldPath
|
|
309
|
+
},
|
|
310
|
+
transform: { kind: "identity" }
|
|
311
|
+
},
|
|
312
|
+
device: host,
|
|
313
|
+
apply: "add",
|
|
314
|
+
sourceValueKind: "boolean",
|
|
315
|
+
changedAtField: CHANGED_AT_FIELD,
|
|
316
|
+
sourceUnit: null
|
|
317
|
+
});
|
|
318
|
+
return compiled.ok ? compiled.value : null;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* The composition the composer PLANS: the stored one, plus the derived running
|
|
322
|
+
* field when nothing is authored for it. The input is never changed; with nothing
|
|
323
|
+
* to add it is returned as it is.
|
|
324
|
+
*/
|
|
325
|
+
function withDefaultRunning(composition, blockId) {
|
|
326
|
+
if (hasAuthoredRunning(composition) || !actuatorSwitchDrivesRunning(composition)) return composition;
|
|
327
|
+
const feature = followSwitchRunningFeature(composition, composedDeviceRef(blockId));
|
|
328
|
+
return feature === null ? composition : {
|
|
329
|
+
...composition,
|
|
330
|
+
features: [...composition.features, feature]
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
//#endregion
|
|
334
|
+
//#region ../types/dist/esm/composition/evaluate-field.mjs
|
|
335
|
+
/**
|
|
336
|
+
* One composed field, evaluated from what its sources say NOW (D659).
|
|
337
|
+
*
|
|
338
|
+
* Pure. The composer calls it on every source change, and the slice-5 editor
|
|
339
|
+
* will call it for its live preview, so both see the same answer.
|
|
340
|
+
*
|
|
341
|
+
* The rules (spec §2):
|
|
342
|
+
* - a source that is offline or unreadable keeps its last value and is marked
|
|
343
|
+
* STALE; the field is stale and keeps computing (D49);
|
|
344
|
+
* - a source that is GONE makes the field UNAVAILABLE, `fatal`, and never a
|
|
345
|
+
* plausible number (D393);
|
|
346
|
+
* - a source that is unavailable but NOT gone (e.g. a cap unregistered at
|
|
347
|
+
* runtime, R7b) makes the field UNAVAILABLE, non-fatal, `value: null`: it
|
|
348
|
+
* may come back on its own, no block failure is raised for it;
|
|
349
|
+
* - an expression that fails on a value makes the field unavailable for that
|
|
350
|
+
* value, and NOT fatal: the next value may compute.
|
|
351
|
+
*
|
|
352
|
+
* `confirmed` (D663, D49): whether a NON-fatal unavailability is an ANSWER — a
|
|
353
|
+
* cap the provider unregistered and a re-read agreed, a field the source
|
|
354
|
+
* reported without, an expression that failed on a value — or only the
|
|
355
|
+
* absence of one (a failed read, a first or empty read, a source not tracked
|
|
356
|
+
* yet). Only a confirmed unavailability may hand a `release`-mode field back
|
|
357
|
+
* to the native provider; an unconfirmed one holds it on its last value.
|
|
358
|
+
* Absent means NOT confirmed. Fatal is always confirmed.
|
|
359
|
+
*
|
|
360
|
+
* When an expression has more than one unavailable binding, a FATAL one always
|
|
361
|
+
* wins the outcome, regardless of position: every binding is scanned before
|
|
362
|
+
* the field is judged, so an earlier non-fatal binding (e.g. a cap that is
|
|
363
|
+
* momentarily unregistered) can never hide a later fatal one (a deleted
|
|
364
|
+
* source) behind an early return.
|
|
365
|
+
*/
|
|
366
|
+
function describeRead(read) {
|
|
367
|
+
return `${compositionSourceKey(read.source)} ${read.cap}.${read.fieldPath}`;
|
|
368
|
+
}
|
|
369
|
+
function isConfirmed(reading) {
|
|
370
|
+
return reading.fatal || reading.confirmed === true;
|
|
371
|
+
}
|
|
372
|
+
/** Whether a non-null value is of the kind a field of `kind` holds. */
|
|
373
|
+
function valueFitsKind(value, kind) {
|
|
374
|
+
if (value === null) return true;
|
|
375
|
+
return typeof value === (kind === "enum" ? "string" : kind);
|
|
376
|
+
}
|
|
377
|
+
function fromReading(reading, read, targetKind) {
|
|
378
|
+
if (reading.state === "unavailable") return {
|
|
379
|
+
state: "unavailable",
|
|
380
|
+
value: null,
|
|
381
|
+
reason: `${describeRead(read)}: ${reading.reason}`,
|
|
382
|
+
fatal: reading.fatal,
|
|
383
|
+
confirmed: isConfirmed(reading)
|
|
384
|
+
};
|
|
385
|
+
if (targetKind !== void 0 && !valueFitsKind(reading.value, targetKind)) return {
|
|
386
|
+
state: "unavailable",
|
|
387
|
+
value: null,
|
|
388
|
+
reason: `${describeRead(read)}: source-kind-mismatch, it reads a ${typeof reading.value} and the field takes a ${targetKind}`,
|
|
389
|
+
fatal: false,
|
|
390
|
+
confirmed: true
|
|
391
|
+
};
|
|
392
|
+
return {
|
|
393
|
+
state: reading.state,
|
|
394
|
+
value: reading.value,
|
|
395
|
+
reason: reading.state === "stale" ? `${describeRead(read)}: ${reading.reason}` : null,
|
|
396
|
+
deadline: null
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
function expressionOutcome(source, read, now, stateful) {
|
|
400
|
+
const values = {};
|
|
401
|
+
const staleReasons = [];
|
|
402
|
+
let fatalUnavailable = null;
|
|
403
|
+
let nonFatalUnavailable = null;
|
|
404
|
+
for (const [name, binding] of Object.entries(source.bindings)) {
|
|
405
|
+
if (binding.kind === "literal") {
|
|
406
|
+
values[name] = binding.value;
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
const reading = read(binding);
|
|
410
|
+
if (reading.state === "unavailable") {
|
|
411
|
+
const outcome = {
|
|
412
|
+
state: "unavailable",
|
|
413
|
+
value: null,
|
|
414
|
+
reason: `binding \`${name}\` (${describeRead(binding)}): ${reading.reason}`,
|
|
415
|
+
fatal: reading.fatal,
|
|
416
|
+
confirmed: isConfirmed(reading)
|
|
417
|
+
};
|
|
418
|
+
if (reading.fatal) {
|
|
419
|
+
fatalUnavailable = outcome;
|
|
420
|
+
break;
|
|
421
|
+
}
|
|
422
|
+
if (nonFatalUnavailable === null || outcome.confirmed && !nonFatalUnavailable.confirmed) nonFatalUnavailable = outcome;
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
425
|
+
values[name] = reading.value;
|
|
426
|
+
if (reading.state === "fresh" && reading.transition !== void 0 && stateful !== void 0) stateful.expressionMemory.dwellTransition = reading.transition;
|
|
427
|
+
if (reading.state === "stale") staleReasons.push(`\`${name}\`: ${reading.reason}`);
|
|
428
|
+
}
|
|
429
|
+
const unavailable = fatalUnavailable ?? nonFatalUnavailable;
|
|
430
|
+
if (unavailable !== null) {
|
|
431
|
+
if (stateful !== void 0 && stateful.currentOutput !== void 0 && expressionContainsBuiltinCall(source.expr, "count")) return {
|
|
432
|
+
state: "stale",
|
|
433
|
+
value: evaluateCount(null, {
|
|
434
|
+
kind: "count",
|
|
435
|
+
highWater: null,
|
|
436
|
+
primed: false
|
|
437
|
+
}, stateful.currentOutput),
|
|
438
|
+
reason: `${unavailable.reason}; holding the last accumulator value`,
|
|
439
|
+
deadline: null
|
|
440
|
+
};
|
|
441
|
+
return unavailable;
|
|
442
|
+
}
|
|
443
|
+
const deadlines = [];
|
|
444
|
+
const hooks = {
|
|
445
|
+
noteDeadline: (at) => deadlines.push(at),
|
|
446
|
+
...stateful?.timerDriven === true ? { timerDriven: true } : {},
|
|
447
|
+
convert: (value, from, to) => tryConvertUnit(value, normalizeUnit(from) ?? from, normalizeUnit(to) ?? to) ?? null
|
|
448
|
+
};
|
|
449
|
+
const result = evaluateExpressionSource(source.expr, values, now, {
|
|
450
|
+
hooks,
|
|
451
|
+
...stateful === void 0 ? {} : { invokeStateful: (invocation) => evaluateStatefulExpressionCall(stateful.callPathPrefix === void 0 ? invocation : {
|
|
452
|
+
...invocation,
|
|
453
|
+
path: `${stateful.callPathPrefix}@${invocation.path}`
|
|
454
|
+
}, stateful.expressionMemory, {
|
|
455
|
+
currentOutput: stateful.currentOutput,
|
|
456
|
+
startedAtMs: stateful.startedAtMs,
|
|
457
|
+
nowMs: now
|
|
458
|
+
}, hooks) }
|
|
459
|
+
});
|
|
460
|
+
const transition = stateful?.expressionMemory.dwellTransition ?? null;
|
|
461
|
+
if (stateful !== void 0) stateful.expressionMemory.dwellTransition = null;
|
|
462
|
+
if (!result.ok) return {
|
|
463
|
+
state: "unavailable",
|
|
464
|
+
value: null,
|
|
465
|
+
reason: `the expression failed: ${result.error}`,
|
|
466
|
+
fatal: false,
|
|
467
|
+
confirmed: true,
|
|
468
|
+
expressionFailed: true
|
|
469
|
+
};
|
|
470
|
+
return {
|
|
471
|
+
state: staleReasons.length > 0 ? "stale" : "fresh",
|
|
472
|
+
value: result.value,
|
|
473
|
+
reason: staleReasons.length > 0 ? staleReasons.join("; ") : null,
|
|
474
|
+
deadline: deadlines.length > 0 ? Math.min(...deadlines) : null,
|
|
475
|
+
...transition === null ? {} : { transition }
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
function aggregateRead(reading) {
|
|
479
|
+
if (reading.state === "unavailable") return {
|
|
480
|
+
state: "unavailable",
|
|
481
|
+
fatal: reading.fatal,
|
|
482
|
+
reason: reading.reason
|
|
483
|
+
};
|
|
484
|
+
return {
|
|
485
|
+
state: reading.state,
|
|
486
|
+
value: reading.value,
|
|
487
|
+
...reading.state === "stale" ? { reason: reading.reason } : {}
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
function aggregateField(source, read) {
|
|
491
|
+
const outcome = evaluateAggregate({
|
|
492
|
+
reducer: source.reducer,
|
|
493
|
+
...source.activeWhen === void 0 ? {} : { activeWhen: source.activeWhen },
|
|
494
|
+
members: source.reads.map((item) => aggregateRead(read(item))),
|
|
495
|
+
publish: source.publish,
|
|
496
|
+
empty: source.empty
|
|
497
|
+
});
|
|
498
|
+
if (outcome.kind === "value") return {
|
|
499
|
+
state: "fresh",
|
|
500
|
+
value: outcome.value,
|
|
501
|
+
reason: null,
|
|
502
|
+
deadline: null
|
|
503
|
+
};
|
|
504
|
+
return {
|
|
505
|
+
state: "unavailable",
|
|
506
|
+
value: null,
|
|
507
|
+
reason: outcome.reason,
|
|
508
|
+
fatal: outcome.fatal,
|
|
509
|
+
confirmed: true
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
function evaluateCompositionField(input) {
|
|
513
|
+
const { source } = input;
|
|
514
|
+
switch (source.kind) {
|
|
515
|
+
case "from": return fromReading(input.read(source), source, input.targetKind);
|
|
516
|
+
case "expression": return expressionOutcome(source, input.read, input.now, input.stateful);
|
|
517
|
+
case "aggregate": return aggregateField(source, input.read);
|
|
518
|
+
case "series": return {
|
|
519
|
+
state: "unavailable",
|
|
520
|
+
value: null,
|
|
521
|
+
reason: "a series field is written from device history",
|
|
522
|
+
fatal: false,
|
|
523
|
+
confirmed: false
|
|
524
|
+
};
|
|
525
|
+
case "code": return {
|
|
526
|
+
state: "unavailable",
|
|
527
|
+
value: null,
|
|
528
|
+
reason: "code fields are not runnable in the composer — they arrive in slice 4",
|
|
529
|
+
fatal: true,
|
|
530
|
+
confirmed: true
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Workload, DeviceType.Camera, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.WeatherStation, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
|
|
535
|
+
/** True when a value is a navigable node: a plain object OR a tRPC v11 client
|
|
536
|
+
* proxy node (a callable `Proxy(noop)` → `typeof === 'function'`, NOT an
|
|
537
|
+
* object). A `typeof === 'object'`-only check REJECTS every real client proxy,
|
|
538
|
+
* so `resolveMutate` would return null and EVERY control becomes a silent
|
|
539
|
+
* no-op. Framework-free: operates on the SDK proxy shape only. */
|
|
540
|
+
function isNode(value) {
|
|
541
|
+
return value !== null && (typeof value === "object" || typeof value === "function");
|
|
542
|
+
}
|
|
543
|
+
/** Resolve `router.<method>.mutate` to a callable, or `null`. Walks the tRPC
|
|
544
|
+
* client proxy defensively (each hop guarded by `isNode`). */
|
|
545
|
+
function resolveMutate(router, method) {
|
|
546
|
+
if (!isNode(router)) return null;
|
|
547
|
+
const proc = router[method];
|
|
548
|
+
if (!isNode(proc)) return null;
|
|
549
|
+
const mutate = proc.mutate;
|
|
550
|
+
return typeof mutate === "function" ? mutate : null;
|
|
551
|
+
}
|
|
552
|
+
//#endregion
|
|
553
|
+
//#region ../types/dist/esm/helpers/process-time-zone.mjs
|
|
554
|
+
var UNKNOWN_ZONE = "Etc/Unknown";
|
|
555
|
+
/** True when `Intl.DateTimeFormat` accepts the zone and it is not `Etc/Unknown`. */
|
|
556
|
+
function isUsableTimeZone(timeZone) {
|
|
557
|
+
if (timeZone.length === 0 || timeZone === UNKNOWN_ZONE) return false;
|
|
558
|
+
try {
|
|
559
|
+
new Intl.DateTimeFormat("en-US", { timeZone });
|
|
560
|
+
return true;
|
|
561
|
+
} catch {
|
|
562
|
+
return false;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
/** The process zone when usable, else `null`. Callers choose the fallback. */
|
|
566
|
+
function usableProcessTimeZone(probe = {}) {
|
|
567
|
+
const zone = (probe.read ?? (() => Intl.DateTimeFormat().resolvedOptions().timeZone))();
|
|
568
|
+
return typeof zone === "string" && isUsableTimeZone(zone) ? zone : null;
|
|
569
|
+
}
|
|
570
|
+
var warnedRejectedZone = false;
|
|
571
|
+
/** Process zone, or `fallback` (default `UTC`); warns once with the rejected value. */
|
|
572
|
+
function processTimeZoneOr(fallback, logger, probe = {}) {
|
|
573
|
+
const usable = usableProcessTimeZone(probe);
|
|
574
|
+
if (usable !== null) return usable;
|
|
575
|
+
if (!warnedRejectedZone) {
|
|
576
|
+
warnedRejectedZone = true;
|
|
577
|
+
const read = probe.read ?? (() => Intl.DateTimeFormat().resolvedOptions().timeZone);
|
|
578
|
+
logger?.warn("the process time zone is not usable, using a fallback", { meta: {
|
|
579
|
+
rejectedTimeZone: read(),
|
|
580
|
+
fallbackTimeZone: fallback
|
|
581
|
+
} });
|
|
582
|
+
}
|
|
583
|
+
return fallback;
|
|
584
|
+
}
|
|
585
|
+
//#endregion
|
|
7
586
|
//#region src/builtins/composer/actuator-invoke.ts
|
|
8
587
|
/**
|
|
9
588
|
* Turn one fan-out call into the member's existing cap method. A bad argument
|
|
@@ -3,7 +3,8 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const
|
|
6
|
+
const require_base_addon = require("../../base-addon-DD5dIfcZ.js");
|
|
7
|
+
const require_log_destination_cap = require("../../log-destination.cap-DELPJkZ0.js");
|
|
7
8
|
const require_formatter = require("../../formatter-xbxeV4GD.js");
|
|
8
9
|
//#region src/builtins/console-logging/console-destination.ts
|
|
9
10
|
var LEVEL_RANK = {
|
|
@@ -39,7 +40,7 @@ var ConsoleDestination = class {
|
|
|
39
40
|
* LogManager keeps working as long as at least one destination is
|
|
40
41
|
* registered.
|
|
41
42
|
*/
|
|
42
|
-
var ConsoleLoggingAddon = class extends
|
|
43
|
+
var ConsoleLoggingAddon = class extends require_base_addon.BaseAddon {
|
|
43
44
|
destination = null;
|
|
44
45
|
constructor() {
|
|
45
46
|
super({ level: "info" });
|
|
@@ -49,7 +50,7 @@ var ConsoleLoggingAddon = class extends require_dist.BaseAddon {
|
|
|
49
50
|
await this.destination.initialize({ level: this.config.level });
|
|
50
51
|
this.ctx.logger.info("Console logging initialized");
|
|
51
52
|
return [{
|
|
52
|
-
capability:
|
|
53
|
+
capability: require_log_destination_cap.logDestinationCapability,
|
|
53
54
|
provider: this.destination
|
|
54
55
|
}];
|
|
55
56
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as BaseAddon } from "../../base-addon-Md14i7pe.mjs";
|
|
2
|
+
import { t as logDestinationCapability } from "../../log-destination.cap-CxZzAVaR.mjs";
|
|
2
3
|
import { t as formatLogLine } from "../../formatter-DkYZ4LXp.mjs";
|
|
3
4
|
//#region src/builtins/console-logging/console-destination.ts
|
|
4
5
|
var LEVEL_RANK = {
|