@camstack/addon-provider-homematic 1.2.173 → 1.2.175
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 +13 -0
- package/dist/{MotionZonesSettings-CqnDpyqc.mjs → MotionZonesSettings-CovCElVu.mjs} +2 -2
- package/dist/{PrivacyMaskSettings-6tkdoeER.mjs → PrivacyMaskSettings-rppcqOKk.mjs} +4 -4
- package/dist/{SceneMonitorEditor-BmdszbmG.mjs → SceneMonitorEditor-pLU11CrP.mjs} +3 -3
- package/dist/_stub.js +162 -162
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-Bn2cfWur.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-CmnwYR1R.mjs} +4 -4
- package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DHKRjZRN.mjs +26 -0
- package/dist/addon.js +1833 -836
- package/dist/addon.mjs +1833 -836
- package/dist/{hostInit-CTd-Vj1N.mjs → hostInit-C9STmTzd.mjs} +3 -3
- package/dist/{player-overlays-DjlHnIwB.mjs → player-overlays-Dq97wYPZ.mjs} +1 -1
- package/dist/remoteEntry.js +1 -1
- package/dist/{responsive-cQr14mMl.mjs → responsive-OpRUtaZs.mjs} +1 -1
- package/dist/{scene-monitor-copy-CJJ7MbTH.mjs → scene-monitor-copy-BBuVH6QD.mjs} +1 -1
- package/dist/{square-Co7N2v2G.mjs → square-CxQ2Du6f.mjs} +1 -1
- package/dist/{trash-2-DJnz9xs3.mjs → trash-2-BPDQvo53.mjs} +1 -1
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-Db3ekXR3.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-BMNsGta0.mjs} +1 -1
- package/package.json +5 -2
- package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BhTBBkpt.mjs +0 -26
package/dist/addon.js
CHANGED
|
@@ -8,7 +8,7 @@ let crypto$1 = require("crypto");
|
|
|
8
8
|
let fs_promises = require("fs/promises");
|
|
9
9
|
let path = require("path");
|
|
10
10
|
let node_os = require("node:os");
|
|
11
|
-
//#region ../types/dist/event-category-
|
|
11
|
+
//#region ../types/dist/event-category-CaURIwQA.mjs
|
|
12
12
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
13
13
|
EventCategory["SystemBoot"] = "system.boot";
|
|
14
14
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -724,6 +724,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
724
724
|
EventCategory["NotificationRuleBroken"] = "notification.rule-broken";
|
|
725
725
|
/** The clear of {@link NotificationRuleBroken}: the rule loads and names nothing deleted. */
|
|
726
726
|
EventCategory["NotificationRuleRepaired"] = "notification.rule-repaired";
|
|
727
|
+
/** A migration failed or was blocked; the Alert Center re-reads the ledger. */
|
|
728
|
+
EventCategory["MigrationFailed"] = "migration.failed";
|
|
729
|
+
/** A migration applied or a failure cleared; the Alert Center re-reads the ledger. */
|
|
730
|
+
EventCategory["MigrationApplied"] = "migration.applied";
|
|
727
731
|
EventCategory["DeviceUpdated"] = "device.updated";
|
|
728
732
|
/**
|
|
729
733
|
* Transport-level connectivity. Emitted by the device driver when
|
|
@@ -786,6 +790,378 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
786
790
|
return EventCategory;
|
|
787
791
|
}({});
|
|
788
792
|
//#endregion
|
|
793
|
+
//#region ../types/dist/device-type-CEqjmUnR.mjs
|
|
794
|
+
/**
|
|
795
|
+
import { errMsg } from '@camstack/types'
|
|
796
|
+
* Extract a human-readable message from an unknown error value.
|
|
797
|
+
* Replaces the ubiquitous `errMsg(err)` pattern.
|
|
798
|
+
*/
|
|
799
|
+
function errMsg(err) {
|
|
800
|
+
if (err instanceof Error) return err.message;
|
|
801
|
+
if (typeof err === "string") return err;
|
|
802
|
+
return String(err);
|
|
803
|
+
}
|
|
804
|
+
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
805
|
+
DeviceType["Camera"] = "camera";
|
|
806
|
+
DeviceType["Hub"] = "hub";
|
|
807
|
+
DeviceType["Light"] = "light";
|
|
808
|
+
DeviceType["Siren"] = "siren";
|
|
809
|
+
DeviceType["Switch"] = "switch";
|
|
810
|
+
DeviceType["Sensor"] = "sensor";
|
|
811
|
+
DeviceType["Thermostat"] = "thermostat";
|
|
812
|
+
/** Air-conditioner / heat-pump climate device (HVAC) — shares the
|
|
813
|
+
* `climate-control` cap surface with `Thermostat` but renders a
|
|
814
|
+
* dedicated AC-appropriate control UI (mode chips, fan speed,
|
|
815
|
+
* independent vertical/horizontal swing). Sources: native Gree, and
|
|
816
|
+
* reusable by other AC integrations. */
|
|
817
|
+
DeviceType["Climate"] = "climate";
|
|
818
|
+
DeviceType["Button"] = "button";
|
|
819
|
+
/** Generic stateless event emitter — carries a device's EXACT declared
|
|
820
|
+
* event vocabulary verbatim (no normalization). Installed with the
|
|
821
|
+
* `event-emitter` cap. Sources: HA `event.*` entities (structured) and
|
|
822
|
+
* HA bus events (e.g. `zha_event`, generic). */
|
|
823
|
+
DeviceType["EventEmitter"] = "event-emitter";
|
|
824
|
+
/** Firmware/software update entity — current vs available version,
|
|
825
|
+
* updatable flag, update state, and an install action. Installed with
|
|
826
|
+
* the `update` cap. Sources: Homematic firmware-update channels (and
|
|
827
|
+
* reusable by other providers, e.g. HA `update.*` entities). */
|
|
828
|
+
DeviceType["Update"] = "update";
|
|
829
|
+
DeviceType["Generic"] = "generic";
|
|
830
|
+
/** Generic notification delivery target (HA `notify.<service>`, future
|
|
831
|
+
* Telegram / Discord / ntfy / SMTP, …). One device per delivery
|
|
832
|
+
* endpoint; the `notifier` cap defines the send surface. */
|
|
833
|
+
DeviceType["Notifier"] = "notifier";
|
|
834
|
+
/** Pre-recorded action sequence with optional parameters
|
|
835
|
+
* (HA `script.*`). Runnable via `script-runner` cap. */
|
|
836
|
+
DeviceType["Script"] = "script";
|
|
837
|
+
/** Automation rule (HA `automation.*`) — enable/disable + manual
|
|
838
|
+
* trigger surface exposed via `automation-control` cap. */
|
|
839
|
+
DeviceType["Automation"] = "automation";
|
|
840
|
+
/** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
|
|
841
|
+
DeviceType["Lock"] = "lock";
|
|
842
|
+
/** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
|
|
843
|
+
* `valve.*`). `cover` cap with sub-roles for variant. */
|
|
844
|
+
DeviceType["Cover"] = "cover";
|
|
845
|
+
/** Pipe / water / gas valve with open/close/stop and optional
|
|
846
|
+
* position (HA `valve.*`). `valve` cap — a cover-sibling actuator
|
|
847
|
+
* modelled on the same open/closed lifecycle. */
|
|
848
|
+
DeviceType["Valve"] = "valve";
|
|
849
|
+
/** Humidifier / dehumidifier with on/off + target humidity + mode
|
|
850
|
+
* (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
|
|
851
|
+
* modelled on the same target / mode lifecycle. */
|
|
852
|
+
DeviceType["Humidifier"] = "humidifier";
|
|
853
|
+
/** Water heater / boiler with target temperature + operation mode +
|
|
854
|
+
* away mode (HA `water_heater.*`). `water-heater` cap — a
|
|
855
|
+
* climate-family actuator. */
|
|
856
|
+
DeviceType["WaterHeater"] = "water-heater";
|
|
857
|
+
/** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
|
|
858
|
+
DeviceType["Fan"] = "fan";
|
|
859
|
+
/** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
|
|
860
|
+
* the camera surface — those use `Camera`. `media-player` cap. */
|
|
861
|
+
DeviceType["MediaPlayer"] = "media-player";
|
|
862
|
+
/** Security panel / alarm system (HA `alarm_control_panel.*`).
|
|
863
|
+
* `alarm-panel` cap. */
|
|
864
|
+
DeviceType["AlarmPanel"] = "alarm-panel";
|
|
865
|
+
/** Generic user-settable input (HA `number` / `input_number` / `select`
|
|
866
|
+
* / `input_select` / `text` / `input_text` / `input_datetime`).
|
|
867
|
+
* Sub-type via `DeviceRole`: NumericControl / SelectControl /
|
|
868
|
+
* TextControl / DateTimeControl. */
|
|
869
|
+
DeviceType["Control"] = "control";
|
|
870
|
+
/** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
|
|
871
|
+
* `presence` cap. */
|
|
872
|
+
DeviceType["Presence"] = "presence";
|
|
873
|
+
/** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
|
|
874
|
+
* `weather` cap. */
|
|
875
|
+
DeviceType["Weather"] = "weather";
|
|
876
|
+
/** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
|
|
877
|
+
DeviceType["Vacuum"] = "vacuum";
|
|
878
|
+
/** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
|
|
879
|
+
* `lawn-mower-control` cap. */
|
|
880
|
+
DeviceType["LawnMower"] = "lawn-mower";
|
|
881
|
+
/** Physical HA device group — parent container for entity-children
|
|
882
|
+
* adopted from a single HA device entry. Not renderable as a
|
|
883
|
+
* standalone device; exists only to anchor child entities. */
|
|
884
|
+
DeviceType["Container"] = "container";
|
|
885
|
+
/** Single still-image entity (HA `image.*`). Read-only display of an
|
|
886
|
+
* `entity_picture` signed URL the browser loads directly. `image` cap. */
|
|
887
|
+
DeviceType["Image"] = "image";
|
|
888
|
+
/** Smart pet feeder — cloud-connected food dispenser with a bowl food
|
|
889
|
+
* level, battery, desiccant life, feeding state and manual-feed /
|
|
890
|
+
* call-pet / maintenance actions. Installed with the `pet-feeder` cap;
|
|
891
|
+
* dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
|
|
892
|
+
* native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
|
|
893
|
+
* integrations sharing the same food/desiccant/hopper surface. */
|
|
894
|
+
DeviceType["PetFeeder"] = "pet-feeder";
|
|
895
|
+
/** Pet water fountain — tank level, water drunk, pump and its duty cycle.
|
|
896
|
+
* Installed with the `pet-fountain` cap. Reaches CamStack as loose entities
|
|
897
|
+
* of a container and is BUILT as a composed device (D967). */
|
|
898
|
+
DeviceType["PetFountain"] = "pet-fountain";
|
|
899
|
+
/** Built-in dishwasher — program lifecycle, door / remote-start gates,
|
|
900
|
+
* salt and rinse-aid levels. Installed with the `dishwasher` cap.
|
|
901
|
+
* Sources: native Bosch Home Connect, reusable by similar integrations.
|
|
902
|
+
* A plug-built dishwasher carries running-state and power instead. */
|
|
903
|
+
DeviceType["Dishwasher"] = "dishwasher";
|
|
904
|
+
/** Washing machine. A plug-built one is running while its power stays
|
|
905
|
+
* above a threshold. No program cap — that surface is the dishwasher's. */
|
|
906
|
+
DeviceType["Washer"] = "washer";
|
|
907
|
+
/** Tumble dryer. Same plug-built running surface as {@link Washer}. */
|
|
908
|
+
DeviceType["Dryer"] = "dryer";
|
|
909
|
+
/** The physical bridge box of a vendor ecosystem (Velux KLF-200, and later
|
|
910
|
+
* other radio-to-IP bridges). It carries the box's own facts (firmware,
|
|
911
|
+
* address, connection state) and the actions the box really supports
|
|
912
|
+
* (`reboot`, `device-admin-link`). Products are NOT its children — they are
|
|
913
|
+
* adopted beside it — and its connection settings stay on the integration. */
|
|
914
|
+
DeviceType["Gateway"] = "gateway";
|
|
915
|
+
return DeviceType;
|
|
916
|
+
}({});
|
|
917
|
+
var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
918
|
+
DeviceFeature["BatteryOperated"] = "battery-operated";
|
|
919
|
+
DeviceFeature["Rebootable"] = "rebootable";
|
|
920
|
+
/**
|
|
921
|
+
* Device supports an on-demand re-sync of its derived spec with its
|
|
922
|
+
* upstream source — drives the generic Re-sync button. The owning
|
|
923
|
+
* provider implements the action via the `device-adoption.resync` cap.
|
|
924
|
+
*/
|
|
925
|
+
DeviceFeature["Resyncable"] = "resyncable";
|
|
926
|
+
DeviceFeature["NativeSnapshot"] = "native-snapshot";
|
|
927
|
+
DeviceFeature["DoorbellButton"] = "doorbell-button";
|
|
928
|
+
DeviceFeature["TwoWayAudio"] = "two-way-audio";
|
|
929
|
+
DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
|
|
930
|
+
/**
|
|
931
|
+
* Camera supports the on-firmware autotrack subsystem (subject-
|
|
932
|
+
* following). Distinct from `PanTiltZoom` because not every PTZ
|
|
933
|
+
* camera ships autotrack — the admin UI uses this flag to gate
|
|
934
|
+
* the autotrack toggle / settings card without re-deriving from
|
|
935
|
+
* the cap registry. Mirrors `ptz-autotrack` cap registration:
|
|
936
|
+
* driver sets this feature when probe confirms the firmware
|
|
937
|
+
* surface, and registers the cap in the same code path.
|
|
938
|
+
*/
|
|
939
|
+
DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
|
|
940
|
+
/**
|
|
941
|
+
* Accessory exposes a "trigger on motion" toggle — the parent camera's
|
|
942
|
+
* motion detection automatically activates this device. Mirrors
|
|
943
|
+
* `motion-trigger` cap registration: drivers set this feature in the
|
|
944
|
+
* same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
|
|
945
|
+
*
|
|
946
|
+
* Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
|
|
947
|
+
* fast scalar without binding fetch), notifier rules, and `listAll`
|
|
948
|
+
* filters that want "all devices with on-motion behaviour".
|
|
949
|
+
*/
|
|
950
|
+
DeviceFeature["MotionTrigger"] = "motion-trigger";
|
|
951
|
+
/** Light supports rgb-triplet color via `color` cap. */
|
|
952
|
+
DeviceFeature["LightColorRgb"] = "light-color-rgb";
|
|
953
|
+
/** Light supports HSV color via `color` cap. */
|
|
954
|
+
DeviceFeature["LightColorHsv"] = "light-color-hsv";
|
|
955
|
+
/** Light supports color-temperature (mired) via `color` cap. */
|
|
956
|
+
DeviceFeature["LightColorMired"] = "light-color-mired";
|
|
957
|
+
/** Thermostat supports a `heat_cool` dual setpoint (targetLow +
|
|
958
|
+
* targetHigh). Gates the range slider UI. */
|
|
959
|
+
DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
|
|
960
|
+
/** Thermostat exposes target humidity and/or current humidity
|
|
961
|
+
* readings. Gates the humidity controls. */
|
|
962
|
+
DeviceFeature["ClimateHumidity"] = "climate-humidity";
|
|
963
|
+
/** Thermostat exposes a fan-mode selector. */
|
|
964
|
+
DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
|
|
965
|
+
/** Thermostat exposes preset modes (eco / away / sleep / vendor). */
|
|
966
|
+
DeviceFeature["ClimatePreset"] = "climate-preset";
|
|
967
|
+
/** Thermostat exposes a vertical louver swing toggle. Gates the
|
|
968
|
+
* vertical-swing switch in the climate UI. Independent of horizontal. */
|
|
969
|
+
DeviceFeature["ClimateSwingVertical"] = "climate-swing-vertical";
|
|
970
|
+
/** Thermostat exposes a horizontal louver swing toggle. Gates the
|
|
971
|
+
* horizontal-swing switch in the climate UI. Independent of vertical. */
|
|
972
|
+
DeviceFeature["ClimateSwingHorizontal"] = "climate-swing-horizontal";
|
|
973
|
+
/** Cover exposes intermediate position control (0..100). Gates the
|
|
974
|
+
* position slider UI. */
|
|
975
|
+
DeviceFeature["CoverPositionable"] = "cover-positionable";
|
|
976
|
+
/** Cover exposes slat-tilt control. Gates the tilt slider UI. */
|
|
977
|
+
DeviceFeature["CoverTilt"] = "cover-tilt";
|
|
978
|
+
/** Valve exposes intermediate position control (0..100). Gates the
|
|
979
|
+
* position slider / drag surface UI. */
|
|
980
|
+
DeviceFeature["ValvePositionable"] = "valve-positionable";
|
|
981
|
+
/** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
|
|
982
|
+
DeviceFeature["FanSpeed"] = "fan-speed";
|
|
983
|
+
/** Fan exposes a preset mode selector. */
|
|
984
|
+
DeviceFeature["FanPreset"] = "fan-preset";
|
|
985
|
+
/** Fan exposes blade direction (forward/reverse) — typical of
|
|
986
|
+
* ceiling fans. */
|
|
987
|
+
DeviceFeature["FanDirection"] = "fan-direction";
|
|
988
|
+
/** Fan exposes an oscillation toggle. */
|
|
989
|
+
DeviceFeature["FanOscillating"] = "fan-oscillating";
|
|
990
|
+
/** Lock requires a PIN code on lock/unlock. Gates the code-entry
|
|
991
|
+
* field on the UI lock-controls panel. */
|
|
992
|
+
DeviceFeature["LockPinRequired"] = "lock-pin-required";
|
|
993
|
+
/** Lock supports a latch-release ("open door") action distinct from
|
|
994
|
+
* unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
|
|
995
|
+
* `supported_features`. Gates the Open Door button in the UI. */
|
|
996
|
+
DeviceFeature["LockOpen"] = "lock-open";
|
|
997
|
+
/** Media player exposes a seek-to-position surface. */
|
|
998
|
+
DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
|
|
999
|
+
/** Media player exposes a volume-level setter. */
|
|
1000
|
+
DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
|
|
1001
|
+
/** Media player exposes a mute toggle distinct from volume=0. */
|
|
1002
|
+
DeviceFeature["MediaPlayerMute"] = "media-player-mute";
|
|
1003
|
+
/** Media player exposes a shuffle toggle. */
|
|
1004
|
+
DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
|
|
1005
|
+
/** Media player exposes a repeat mode (off / all / one). */
|
|
1006
|
+
DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
|
|
1007
|
+
/** Media player exposes a source / input selector. */
|
|
1008
|
+
DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
|
|
1009
|
+
/** Media player exposes a play-arbitrary-media surface (URL / id). */
|
|
1010
|
+
DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
|
|
1011
|
+
/** Media player exposes next-track. */
|
|
1012
|
+
DeviceFeature["MediaPlayerNext"] = "media-player-next";
|
|
1013
|
+
/** Media player exposes previous-track. */
|
|
1014
|
+
DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
|
|
1015
|
+
/** Media player exposes stop distinct from pause. */
|
|
1016
|
+
DeviceFeature["MediaPlayerStop"] = "media-player-stop";
|
|
1017
|
+
/** Alarm panel requires a PIN code on arm/disarm. */
|
|
1018
|
+
DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
|
|
1019
|
+
/** Presence device carries GPS coordinates (lat/lng/accuracy) in
|
|
1020
|
+
* addition to a textual location. */
|
|
1021
|
+
DeviceFeature["PresenceGps"] = "presence-gps";
|
|
1022
|
+
/** Notifier accepts an inline / URL image attachment. */
|
|
1023
|
+
DeviceFeature["NotifierImage"] = "notifier-image";
|
|
1024
|
+
/** Notifier accepts a priority hint (high/normal/low). */
|
|
1025
|
+
DeviceFeature["NotifierPriority"] = "notifier-priority";
|
|
1026
|
+
/** Notifier accepts a free-form `data` payload for platform-specific
|
|
1027
|
+
* fields. */
|
|
1028
|
+
DeviceFeature["NotifierData"] = "notifier-data";
|
|
1029
|
+
/** Notifier supports interactive action buttons / callbacks. */
|
|
1030
|
+
DeviceFeature["NotifierActions"] = "notifier-actions";
|
|
1031
|
+
/** Notifier supports per-call recipient targeting (multi-user). */
|
|
1032
|
+
DeviceFeature["NotifierRecipients"] = "notifier-recipients";
|
|
1033
|
+
/** Script runner accepts a variables map on each run invocation. */
|
|
1034
|
+
DeviceFeature["ScriptVariables"] = "script-variables";
|
|
1035
|
+
/** Automation `trigger` accepts a skipCondition flag — fires the
|
|
1036
|
+
* automation's actions while bypassing its condition block. */
|
|
1037
|
+
DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
|
|
1038
|
+
/** Robot vacuum exposes a live cleaning map (image child). Gates the
|
|
1039
|
+
* map tile in the vacuum UI. */
|
|
1040
|
+
DeviceFeature["VacuumHasMap"] = "vacuum-has-map";
|
|
1041
|
+
/** Robot vacuum exposes AI obstacle-detection toggles. Gates the AI
|
|
1042
|
+
* switches group. */
|
|
1043
|
+
DeviceFeature["VacuumHasAi"] = "vacuum-has-ai";
|
|
1044
|
+
/** Robot mower exposes a live mowing map (SVG image child). Gates the
|
|
1045
|
+
* mower map tile. */
|
|
1046
|
+
DeviceFeature["MowerHasMap"] = "mower-has-map";
|
|
1047
|
+
/** Robot mower exposes targeted mowing (all-area / zones / edges /
|
|
1048
|
+
* spots) — gates the Mow action + map selectors. */
|
|
1049
|
+
DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
|
|
1050
|
+
return DeviceFeature;
|
|
1051
|
+
}({});
|
|
1052
|
+
/**
|
|
1053
|
+
* Semantic role a device plays within its parent. Populated by driver
|
|
1054
|
+
* addons when creating accessory devices (Reolink siren/floodlight/
|
|
1055
|
+
* PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
|
|
1056
|
+
* admin UI to pick icons, labels, and widgets — a `Switch` with
|
|
1057
|
+
* `role: Floodlight` renders as a bulb with a brightness slider,
|
|
1058
|
+
* whereas a `Switch` with `role: Siren` renders as a klaxon.
|
|
1059
|
+
*
|
|
1060
|
+
* Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
|
|
1061
|
+
* sqlite as a nullable TEXT column — old rows keep working unchanged.
|
|
1062
|
+
*/
|
|
1063
|
+
var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
1064
|
+
DeviceRole["Siren"] = "siren";
|
|
1065
|
+
DeviceRole["Floodlight"] = "floodlight";
|
|
1066
|
+
DeviceRole["Spotlight"] = "spotlight";
|
|
1067
|
+
DeviceRole["PirSensor"] = "pir-sensor";
|
|
1068
|
+
DeviceRole["Chime"] = "chime";
|
|
1069
|
+
DeviceRole["Autotrack"] = "autotrack";
|
|
1070
|
+
DeviceRole["Nightvision"] = "nightvision";
|
|
1071
|
+
DeviceRole["PrivacyMask"] = "privacy-mask";
|
|
1072
|
+
DeviceRole["Doorbell"] = "doorbell";
|
|
1073
|
+
/** Interior blind / shade / roller blind. HA `device_class: blind|shade`. */
|
|
1074
|
+
DeviceRole["CoverBlind"] = "cover-blind";
|
|
1075
|
+
/** Exterior roller shutter. HA `device_class: shutter`; Homematic BROLL. */
|
|
1076
|
+
DeviceRole["CoverShutter"] = "cover-shutter";
|
|
1077
|
+
/** Exterior awning. HA `device_class: awning`. */
|
|
1078
|
+
DeviceRole["CoverAwning"] = "cover-awning";
|
|
1079
|
+
/** Curtain / drape. HA `device_class: curtain`. */
|
|
1080
|
+
DeviceRole["CoverCurtain"] = "cover-curtain";
|
|
1081
|
+
/** Garage door. HA `device_class: garage`. A security actuator: exports gate it. */
|
|
1082
|
+
DeviceRole["CoverGarage"] = "cover-garage";
|
|
1083
|
+
/** Gate. HA `device_class: gate`. A security actuator: exports gate it. */
|
|
1084
|
+
DeviceRole["CoverGate"] = "cover-gate";
|
|
1085
|
+
/** Door. HA `device_class: door`. A security actuator: exports gate it. */
|
|
1086
|
+
DeviceRole["CoverDoor"] = "cover-door";
|
|
1087
|
+
/** Window. HA `device_class: window`. */
|
|
1088
|
+
DeviceRole["CoverWindow"] = "cover-window";
|
|
1089
|
+
/** Virtual HA toggle (input_boolean.*) — distinguishable from a
|
|
1090
|
+
* real Switch device for UI rendering / export adapters. */
|
|
1091
|
+
DeviceRole["BinaryHelper"] = "binary-helper";
|
|
1092
|
+
/** A smart plug: a `switch` whose source says it is an outlet (HA
|
|
1093
|
+
* `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
|
|
1094
|
+
DeviceRole["Outlet"] = "outlet";
|
|
1095
|
+
/** Generic motion / occupancy / moving event source. Distinct from
|
|
1096
|
+
* the camera accessory PirSensor role: that one is a camera child;
|
|
1097
|
+
* this is a standalone HA / 3rd-party motion sensor. */
|
|
1098
|
+
DeviceRole["MotionSensor"] = "motion-sensor";
|
|
1099
|
+
DeviceRole["ContactSensor"] = "contact-sensor";
|
|
1100
|
+
DeviceRole["LeakSensor"] = "leak-sensor";
|
|
1101
|
+
DeviceRole["SmokeSensor"] = "smoke-sensor";
|
|
1102
|
+
DeviceRole["COSensor"] = "co-sensor";
|
|
1103
|
+
DeviceRole["GasSensor"] = "gas-sensor";
|
|
1104
|
+
DeviceRole["TamperSensor"] = "tamper-sensor";
|
|
1105
|
+
DeviceRole["VibrationSensor"] = "vibration-sensor";
|
|
1106
|
+
DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
|
|
1107
|
+
DeviceRole["SoundSensor"] = "sound-sensor";
|
|
1108
|
+
/** Fallback for `binary_sensor` without a known `device_class`. */
|
|
1109
|
+
DeviceRole["BinarySensor"] = "binary-sensor";
|
|
1110
|
+
DeviceRole["TemperatureSensor"] = "temperature-sensor";
|
|
1111
|
+
DeviceRole["HumiditySensor"] = "humidity-sensor";
|
|
1112
|
+
DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
|
|
1113
|
+
DeviceRole["PressureSensor"] = "pressure-sensor";
|
|
1114
|
+
/** Wind speed or direction (weather-station `wind-sensor` cap). */
|
|
1115
|
+
DeviceRole["WindSensor"] = "wind-sensor";
|
|
1116
|
+
/** Rain accumulation or rate (weather-station `rain-sensor` cap). */
|
|
1117
|
+
DeviceRole["RainSensor"] = "rain-sensor";
|
|
1118
|
+
/** UV index (weather-station `uv-sensor` cap). */
|
|
1119
|
+
DeviceRole["UvSensor"] = "uv-sensor";
|
|
1120
|
+
/** Solar irradiance W/m² (weather-station `solar-radiation-sensor` cap).
|
|
1121
|
+
* Distinct from AmbientLightSensor (lux). */
|
|
1122
|
+
DeviceRole["SolarRadiationSensor"] = "solar-radiation-sensor";
|
|
1123
|
+
/** Soil moisture % (garden/weather `soil-moisture-sensor` cap). */
|
|
1124
|
+
DeviceRole["SoilMoistureSensor"] = "soil-moisture-sensor";
|
|
1125
|
+
DeviceRole["PowerSensor"] = "power-sensor";
|
|
1126
|
+
DeviceRole["EnergySensor"] = "energy-sensor";
|
|
1127
|
+
DeviceRole["VoltageSensor"] = "voltage-sensor";
|
|
1128
|
+
DeviceRole["CurrentSensor"] = "current-sensor";
|
|
1129
|
+
DeviceRole["AirQualitySensor"] = "air-quality-sensor";
|
|
1130
|
+
/** Battery level (numeric % via `sensor` OR low-bool via
|
|
1131
|
+
* `binary_sensor` — the cap distinguishes via the value type). */
|
|
1132
|
+
DeviceRole["BatterySensor"] = "battery-sensor";
|
|
1133
|
+
/** Fallback for `sensor` numeric without a known `device_class`. */
|
|
1134
|
+
DeviceRole["NumericSensor"] = "numeric-sensor";
|
|
1135
|
+
/** String / enum state (HA `sensor` with `state_class: enum` or
|
|
1136
|
+
* `attributes.options`). */
|
|
1137
|
+
DeviceRole["EnumSensor"] = "enum-sensor";
|
|
1138
|
+
/** Date / timestamp state (HA `sensor` with `device_class: timestamp`
|
|
1139
|
+
* or `date`). The slice carries the raw ISO string verbatim (hosted on
|
|
1140
|
+
* the `enum-sensor` cap); the UI renders it locale-formatted. */
|
|
1141
|
+
DeviceRole["DateTimeSensor"] = "datetime-sensor";
|
|
1142
|
+
/** Last-resort fallback when nothing else matches. */
|
|
1143
|
+
DeviceRole["GenericSensor"] = "generic-sensor";
|
|
1144
|
+
DeviceRole["NumericControl"] = "numeric-control";
|
|
1145
|
+
DeviceRole["SelectControl"] = "select-control";
|
|
1146
|
+
DeviceRole["TextControl"] = "text-control";
|
|
1147
|
+
DeviceRole["DateTimeControl"] = "datetime-control";
|
|
1148
|
+
/** Mobile push notifier (HA `notify.mobile_app_*`) — supports
|
|
1149
|
+
* rich features (image, priority, channel routing). */
|
|
1150
|
+
DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
|
|
1151
|
+
/** Chat / messaging service (HA `notify.telegram_*`,
|
|
1152
|
+
* `notify.discord_*`, etc.). */
|
|
1153
|
+
DeviceRole["MessagingNotifier"] = "messaging-notifier";
|
|
1154
|
+
/** Email-based delivery (HA `notify.smtp`, etc.). */
|
|
1155
|
+
DeviceRole["EmailNotifier"] = "email-notifier";
|
|
1156
|
+
/** Fallback when the notifier service name doesn't match a known
|
|
1157
|
+
* pattern. */
|
|
1158
|
+
DeviceRole["GenericNotifier"] = "generic-notifier";
|
|
1159
|
+
/** Emits a pulse train (infrared or RF) on request — the `ir-transmitter`
|
|
1160
|
+
* cap. A `DeviceType.Generic` device. */
|
|
1161
|
+
DeviceRole["IrTransmitter"] = "ir-transmitter";
|
|
1162
|
+
return DeviceRole;
|
|
1163
|
+
}({});
|
|
1164
|
+
//#endregion
|
|
789
1165
|
//#region ../../node_modules/zod/v4/core/core.js
|
|
790
1166
|
var _a$1;
|
|
791
1167
|
function $constructor(name, initializer, params) {
|
|
@@ -5464,7 +5840,7 @@ var ZodIssueCode = {
|
|
|
5464
5840
|
var ZodFirstPartyTypeKind;
|
|
5465
5841
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5466
5842
|
//#endregion
|
|
5467
|
-
//#region ../types/dist/sleep-
|
|
5843
|
+
//#region ../types/dist/sleep-CSYuxssh.mjs
|
|
5468
5844
|
/**
|
|
5469
5845
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5470
5846
|
* window to float samples (D455).
|
|
@@ -5980,6 +6356,102 @@ function emitReadiness(bus, params) {
|
|
|
5980
6356
|
ts
|
|
5981
6357
|
}));
|
|
5982
6358
|
}
|
|
6359
|
+
var NOT_RUN = {
|
|
6360
|
+
declared: false,
|
|
6361
|
+
snapshot: null,
|
|
6362
|
+
applied: [],
|
|
6363
|
+
failed: [],
|
|
6364
|
+
blocked: [],
|
|
6365
|
+
skipped: [],
|
|
6366
|
+
blockOwner: []
|
|
6367
|
+
};
|
|
6368
|
+
/**
|
|
6369
|
+
* Offer `migrations` to the engine and run what it says to run, in its order. Never
|
|
6370
|
+
* throws: an unreachable or refusing engine is logged and reported `declared: false`,
|
|
6371
|
+
* because the hub (and this addon's boot) must not hang on a migration.
|
|
6372
|
+
*/
|
|
6373
|
+
async function runAddonMigrations(host, migrations, logger) {
|
|
6374
|
+
const first = migrations[0];
|
|
6375
|
+
if (first === void 0) return NOT_RUN;
|
|
6376
|
+
const owner = first.meta.owner;
|
|
6377
|
+
const log = logger.withTags({ migrationOwner: owner });
|
|
6378
|
+
const byId = new Map(migrations.map((m) => [m.meta.id, m]));
|
|
6379
|
+
let declaration;
|
|
6380
|
+
try {
|
|
6381
|
+
declaration = await host.declareOwner({
|
|
6382
|
+
owner,
|
|
6383
|
+
metas: migrations.map((m) => m.meta)
|
|
6384
|
+
});
|
|
6385
|
+
} catch (err) {
|
|
6386
|
+
log.error("the migration engine refused or could not take this addon catalogue — none ran", { meta: { error: errMsg(err) } });
|
|
6387
|
+
return {
|
|
6388
|
+
...NOT_RUN,
|
|
6389
|
+
blockOwner: migrations.filter((m) => m.meta.onFailure === "block-owner").map((m) => m.meta.id)
|
|
6390
|
+
};
|
|
6391
|
+
}
|
|
6392
|
+
const applied = [];
|
|
6393
|
+
const failed = [];
|
|
6394
|
+
const blocked = [];
|
|
6395
|
+
const skipped = [];
|
|
6396
|
+
const settle = (id, status) => {
|
|
6397
|
+
if (status === "applied") applied.push(id);
|
|
6398
|
+
else if (status === "failed") failed.push(id);
|
|
6399
|
+
else if (status === "blocked") blocked.push(id);
|
|
6400
|
+
else skipped.push(id);
|
|
6401
|
+
};
|
|
6402
|
+
for (const step of declaration.steps) {
|
|
6403
|
+
const bound = byId.get(step.id);
|
|
6404
|
+
if (bound === void 0 || step.action === "skip") {
|
|
6405
|
+
skipped.push(step.id);
|
|
6406
|
+
continue;
|
|
6407
|
+
}
|
|
6408
|
+
const tags = { migrationId: step.id };
|
|
6409
|
+
try {
|
|
6410
|
+
const gate = await host.startMigration({ id: step.id });
|
|
6411
|
+
if (!gate.proceed) {
|
|
6412
|
+
log.warn("migration not run", {
|
|
6413
|
+
tags,
|
|
6414
|
+
meta: {
|
|
6415
|
+
state: gate.state,
|
|
6416
|
+
reason: gate.reason
|
|
6417
|
+
}
|
|
6418
|
+
});
|
|
6419
|
+
settle(step.id, gate.state === "pending" ? "blocked" : gate.state);
|
|
6420
|
+
continue;
|
|
6421
|
+
}
|
|
6422
|
+
const result = await bound.execute();
|
|
6423
|
+
const outcome = await host.finishMigration({
|
|
6424
|
+
id: step.id,
|
|
6425
|
+
result
|
|
6426
|
+
});
|
|
6427
|
+
if (outcome.status === "applied") log.info("migration applied", {
|
|
6428
|
+
tags,
|
|
6429
|
+
meta: { rowsChanged: outcome.rowsChanged }
|
|
6430
|
+
});
|
|
6431
|
+
else log.error("migration failed", {
|
|
6432
|
+
tags,
|
|
6433
|
+
meta: { error: outcome.error }
|
|
6434
|
+
});
|
|
6435
|
+
settle(step.id, outcome.status);
|
|
6436
|
+
} catch (err) {
|
|
6437
|
+
log.error("migration could not be completed with the engine", {
|
|
6438
|
+
tags,
|
|
6439
|
+
meta: { error: errMsg(err) }
|
|
6440
|
+
});
|
|
6441
|
+
failed.push(step.id);
|
|
6442
|
+
}
|
|
6443
|
+
}
|
|
6444
|
+
const blockOwner = [...failed, ...blocked].filter((id) => byId.get(id)?.meta.onFailure === "block-owner");
|
|
6445
|
+
return {
|
|
6446
|
+
declared: true,
|
|
6447
|
+
snapshot: declaration.snapshot,
|
|
6448
|
+
applied,
|
|
6449
|
+
failed,
|
|
6450
|
+
blocked,
|
|
6451
|
+
skipped,
|
|
6452
|
+
blockOwner
|
|
6453
|
+
};
|
|
6454
|
+
}
|
|
5983
6455
|
/**
|
|
5984
6456
|
* Build a {@link DurableState} over a single store key. Transport-agnostic:
|
|
5985
6457
|
* `read`/`write` are the addon-store or device-store accessors. The whole
|
|
@@ -7035,6 +7507,28 @@ var BaseAddon = class {
|
|
|
7035
7507
|
return normalized;
|
|
7036
7508
|
}
|
|
7037
7509
|
/**
|
|
7510
|
+
* Run this addon's migration catalogue (D987 M3) through the hub's `migrations`
|
|
7511
|
+
* engine. Call it at the point of the boot where the data must already have the new
|
|
7512
|
+
* shape — `onInitialize`, or `onRestoreDevices` for a migration that needs the
|
|
7513
|
+
* restored devices — with the catalogue bound to the addon's ports
|
|
7514
|
+
* (`defineAddonMigrations(ADDON_MIGRATIONS, ports)`).
|
|
7515
|
+
*
|
|
7516
|
+
* An engine that cannot be reached or refuses the catalogue is logged and runs
|
|
7517
|
+
* nothing; the boot continues. A migration that FAILED (or was blocked by one)
|
|
7518
|
+
* and declares `onFailure: 'block-owner'` makes this throw, so the addon does not
|
|
7519
|
+
* serve data whose shape it cannot trust; `tolerate` migrations never do.
|
|
7520
|
+
*/
|
|
7521
|
+
async runMigrations(migrations) {
|
|
7522
|
+
const api = this.ctx.api.migrations;
|
|
7523
|
+
const report = await runAddonMigrations({
|
|
7524
|
+
declareOwner: (input) => api.declareOwner.mutate(input),
|
|
7525
|
+
startMigration: (input) => api.startMigration.mutate(input),
|
|
7526
|
+
finishMigration: (input) => api.finishMigration.mutate(input)
|
|
7527
|
+
}, migrations, this.ctx.logger);
|
|
7528
|
+
if (report.blockOwner.length > 0) throw new Error(`migration(s) ${report.blockOwner.join(", ")} did not apply and block this addon — fix or retry them (migrations.retry), then restart it`);
|
|
7529
|
+
return report;
|
|
7530
|
+
}
|
|
7531
|
+
/**
|
|
7038
7532
|
* Called by the isolated-process runner AFTER `broker.start()`.
|
|
7039
7533
|
* In-process addons never need this because the hub broker is already
|
|
7040
7534
|
* running when `initialize()` fires. For forked children the broker
|
|
@@ -8144,6 +8638,98 @@ var RecordKindDeclarationSchema = object({
|
|
|
8144
8638
|
}).strict();
|
|
8145
8639
|
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
8146
8640
|
var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
8641
|
+
object({
|
|
8642
|
+
field: string().min(1),
|
|
8643
|
+
on: literal("advance")
|
|
8644
|
+
});
|
|
8645
|
+
/**
|
|
8646
|
+
* Output schema shared by the contribution + live methods.
|
|
8647
|
+
*
|
|
8648
|
+
* Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
|
|
8649
|
+
* tabs[]) without importing from `../interfaces/config-ui.js` — a
|
|
8650
|
+
* concrete-but-lenient Zod object keeps tRPC output inference happy
|
|
8651
|
+
* (using `z.unknown()` here collapses unrelated router branches to
|
|
8652
|
+
* `unknown` when the generator re-inlines the huge AppRouter type).
|
|
8653
|
+
*
|
|
8654
|
+
* `.passthrough()` on sections/fields accepts whatever FormBuilder
|
|
8655
|
+
* extensions the caller adds (showWhen, displayScale, …) without
|
|
8656
|
+
* rebuilding every time a new field kind is introduced.
|
|
8657
|
+
*/
|
|
8658
|
+
var ContributionSectionSchema = object({
|
|
8659
|
+
id: string(),
|
|
8660
|
+
title: string(),
|
|
8661
|
+
description: string().optional(),
|
|
8662
|
+
style: _enum(["card", "accordion"]).optional(),
|
|
8663
|
+
defaultCollapsed: boolean().optional(),
|
|
8664
|
+
columns: union([
|
|
8665
|
+
literal(1),
|
|
8666
|
+
literal(2),
|
|
8667
|
+
literal(3),
|
|
8668
|
+
literal(4)
|
|
8669
|
+
]).optional(),
|
|
8670
|
+
tab: string().optional(),
|
|
8671
|
+
location: _enum([
|
|
8672
|
+
"settings",
|
|
8673
|
+
"top-tab",
|
|
8674
|
+
"hero"
|
|
8675
|
+
]).optional(),
|
|
8676
|
+
order: number().optional(),
|
|
8677
|
+
fields: array(any())
|
|
8678
|
+
});
|
|
8679
|
+
object({
|
|
8680
|
+
tabs: array(object({
|
|
8681
|
+
id: string(),
|
|
8682
|
+
label: string(),
|
|
8683
|
+
icon: string(),
|
|
8684
|
+
order: number().optional()
|
|
8685
|
+
})).optional(),
|
|
8686
|
+
sections: array(ContributionSectionSchema)
|
|
8687
|
+
}).nullable();
|
|
8688
|
+
object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
8689
|
+
deviceId: number(),
|
|
8690
|
+
patch: record(string(), unknown())
|
|
8691
|
+
}), object({ success: literal(true) });
|
|
8692
|
+
object({ deviceId: number() }), unknown().nullable();
|
|
8693
|
+
function method(input, output, options) {
|
|
8694
|
+
return {
|
|
8695
|
+
input,
|
|
8696
|
+
output,
|
|
8697
|
+
kind: options?.kind ?? "query",
|
|
8698
|
+
...options?.auth !== void 0 ? { auth: options.auth } : {},
|
|
8699
|
+
...options?.access !== void 0 ? { access: options.access } : {},
|
|
8700
|
+
...options?.role !== void 0 ? { role: options.role } : {},
|
|
8701
|
+
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
8702
|
+
timeoutMs: options?.timeoutMs
|
|
8703
|
+
};
|
|
8704
|
+
}
|
|
8705
|
+
/**
|
|
8706
|
+
* A wrapper/system-only method: served exclusively by the cap's system-level
|
|
8707
|
+
* provider (`InferProvider`), and OPTIONAL on `InferNativeProvider` so per-device
|
|
8708
|
+
* driver natives don't stub out a wrapper concern (e.g. a cross-device cache
|
|
8709
|
+
* overview). The `systemOnly: true` literal is what `InferNativeProvider` keys on.
|
|
8710
|
+
*/
|
|
8711
|
+
function systemMethod(input, output, options) {
|
|
8712
|
+
return {
|
|
8713
|
+
...method(input, output, options),
|
|
8714
|
+
systemOnly: true
|
|
8715
|
+
};
|
|
8716
|
+
}
|
|
8717
|
+
/**
|
|
8718
|
+
* A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
|
|
8719
|
+
* on `InferProvider`. The `providerOptional: true` literal is what
|
|
8720
|
+
* `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
|
|
8721
|
+
* for when this is the honest answer and when it is a soft stub.
|
|
8722
|
+
*/
|
|
8723
|
+
function optionalMethod(input, output, options) {
|
|
8724
|
+
return {
|
|
8725
|
+
...method(input, output, options),
|
|
8726
|
+
providerOptional: true
|
|
8727
|
+
};
|
|
8728
|
+
}
|
|
8729
|
+
/** Shorthand to define an event schema */
|
|
8730
|
+
function event(data) {
|
|
8731
|
+
return { data };
|
|
8732
|
+
}
|
|
8147
8733
|
var READING_QUANTITIES = [
|
|
8148
8734
|
"temperature",
|
|
8149
8735
|
"pressure",
|
|
@@ -8533,7 +9119,7 @@ var ProfileRtspEntrySchema = object({
|
|
|
8533
9119
|
/**
|
|
8534
9120
|
* The model weight formats a catalog entry can ship. Schema-free on purpose:
|
|
8535
9121
|
* `types/models.ts` builds Zod schemas from it, but a runner-closure consumer
|
|
8536
|
-
* (the model downloader in `@camstack/system`) needs only the list and must
|
|
9122
|
+
* (the model downloader in `@camstack/server/system`) needs only the list and must
|
|
8537
9123
|
* reach it through `@camstack/types/addon` without building the cap schema
|
|
8538
9124
|
* graph (D28).
|
|
8539
9125
|
*/
|
|
@@ -8545,98 +9131,6 @@ var MODEL_FORMATS = [
|
|
|
8545
9131
|
"pt",
|
|
8546
9132
|
"gguf"
|
|
8547
9133
|
];
|
|
8548
|
-
object({
|
|
8549
|
-
field: string().min(1),
|
|
8550
|
-
on: literal("advance")
|
|
8551
|
-
});
|
|
8552
|
-
/**
|
|
8553
|
-
* Output schema shared by the contribution + live methods.
|
|
8554
|
-
*
|
|
8555
|
-
* Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
|
|
8556
|
-
* tabs[]) without importing from `../interfaces/config-ui.js` — a
|
|
8557
|
-
* concrete-but-lenient Zod object keeps tRPC output inference happy
|
|
8558
|
-
* (using `z.unknown()` here collapses unrelated router branches to
|
|
8559
|
-
* `unknown` when the generator re-inlines the huge AppRouter type).
|
|
8560
|
-
*
|
|
8561
|
-
* `.passthrough()` on sections/fields accepts whatever FormBuilder
|
|
8562
|
-
* extensions the caller adds (showWhen, displayScale, …) without
|
|
8563
|
-
* rebuilding every time a new field kind is introduced.
|
|
8564
|
-
*/
|
|
8565
|
-
var ContributionSectionSchema = object({
|
|
8566
|
-
id: string(),
|
|
8567
|
-
title: string(),
|
|
8568
|
-
description: string().optional(),
|
|
8569
|
-
style: _enum(["card", "accordion"]).optional(),
|
|
8570
|
-
defaultCollapsed: boolean().optional(),
|
|
8571
|
-
columns: union([
|
|
8572
|
-
literal(1),
|
|
8573
|
-
literal(2),
|
|
8574
|
-
literal(3),
|
|
8575
|
-
literal(4)
|
|
8576
|
-
]).optional(),
|
|
8577
|
-
tab: string().optional(),
|
|
8578
|
-
location: _enum([
|
|
8579
|
-
"settings",
|
|
8580
|
-
"top-tab",
|
|
8581
|
-
"hero"
|
|
8582
|
-
]).optional(),
|
|
8583
|
-
order: number().optional(),
|
|
8584
|
-
fields: array(any())
|
|
8585
|
-
});
|
|
8586
|
-
object({
|
|
8587
|
-
tabs: array(object({
|
|
8588
|
-
id: string(),
|
|
8589
|
-
label: string(),
|
|
8590
|
-
icon: string(),
|
|
8591
|
-
order: number().optional()
|
|
8592
|
-
})).optional(),
|
|
8593
|
-
sections: array(ContributionSectionSchema)
|
|
8594
|
-
}).nullable();
|
|
8595
|
-
object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
8596
|
-
deviceId: number(),
|
|
8597
|
-
patch: record(string(), unknown())
|
|
8598
|
-
}), object({ success: literal(true) });
|
|
8599
|
-
object({ deviceId: number() }), unknown().nullable();
|
|
8600
|
-
function method(input, output, options) {
|
|
8601
|
-
return {
|
|
8602
|
-
input,
|
|
8603
|
-
output,
|
|
8604
|
-
kind: options?.kind ?? "query",
|
|
8605
|
-
...options?.auth !== void 0 ? { auth: options.auth } : {},
|
|
8606
|
-
...options?.access !== void 0 ? { access: options.access } : {},
|
|
8607
|
-
...options?.role !== void 0 ? { role: options.role } : {},
|
|
8608
|
-
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
8609
|
-
timeoutMs: options?.timeoutMs
|
|
8610
|
-
};
|
|
8611
|
-
}
|
|
8612
|
-
/**
|
|
8613
|
-
* A wrapper/system-only method: served exclusively by the cap's system-level
|
|
8614
|
-
* provider (`InferProvider`), and OPTIONAL on `InferNativeProvider` so per-device
|
|
8615
|
-
* driver natives don't stub out a wrapper concern (e.g. a cross-device cache
|
|
8616
|
-
* overview). The `systemOnly: true` literal is what `InferNativeProvider` keys on.
|
|
8617
|
-
*/
|
|
8618
|
-
function systemMethod(input, output, options) {
|
|
8619
|
-
return {
|
|
8620
|
-
...method(input, output, options),
|
|
8621
|
-
systemOnly: true
|
|
8622
|
-
};
|
|
8623
|
-
}
|
|
8624
|
-
/**
|
|
8625
|
-
* A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
|
|
8626
|
-
* on `InferProvider`. The `providerOptional: true` literal is what
|
|
8627
|
-
* `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
|
|
8628
|
-
* for when this is the honest answer and when it is a soft stub.
|
|
8629
|
-
*/
|
|
8630
|
-
function optionalMethod(input, output, options) {
|
|
8631
|
-
return {
|
|
8632
|
-
...method(input, output, options),
|
|
8633
|
-
providerOptional: true
|
|
8634
|
-
};
|
|
8635
|
-
}
|
|
8636
|
-
/** Shorthand to define an event schema */
|
|
8637
|
-
function event(data) {
|
|
8638
|
-
return { data };
|
|
8639
|
-
}
|
|
8640
9134
|
/**
|
|
8641
9135
|
* `addon-pages-source` — collection cap exposing per-provider raw page
|
|
8642
9136
|
* declarations. Every addon that contributes a UI page registers a
|
|
@@ -8917,6 +9411,7 @@ var CAP_NAMES = Object.freeze([
|
|
|
8917
9411
|
"mesh-network",
|
|
8918
9412
|
"meter",
|
|
8919
9413
|
"metrics-provider",
|
|
9414
|
+
"migrations",
|
|
8920
9415
|
"model-convert",
|
|
8921
9416
|
"model-distributor",
|
|
8922
9417
|
"motion",
|
|
@@ -8949,6 +9444,7 @@ var CAP_NAMES = Object.freeze([
|
|
|
8949
9444
|
"plate-gallery",
|
|
8950
9445
|
"platform-probe",
|
|
8951
9446
|
"power-meter",
|
|
9447
|
+
"power-source",
|
|
8952
9448
|
"presence",
|
|
8953
9449
|
"pressure-sensor",
|
|
8954
9450
|
"privacy-mask",
|
|
@@ -10300,6 +10796,13 @@ Object.freeze({
|
|
|
10300
10796
|
"valueType": "number"
|
|
10301
10797
|
}
|
|
10302
10798
|
],
|
|
10799
|
+
"power-source": [{
|
|
10800
|
+
"path": "switchOn",
|
|
10801
|
+
"valueType": "boolean"
|
|
10802
|
+
}, {
|
|
10803
|
+
"path": "offSeconds",
|
|
10804
|
+
"valueType": "number"
|
|
10805
|
+
}],
|
|
10303
10806
|
"presence": [
|
|
10304
10807
|
{
|
|
10305
10808
|
"path": "state",
|
|
@@ -10811,379 +11314,7 @@ object({
|
|
|
10811
11314
|
params: record(string(), union([string(), number()])).optional()
|
|
10812
11315
|
});
|
|
10813
11316
|
//#endregion
|
|
10814
|
-
//#region ../types/dist/
|
|
10815
|
-
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
10816
|
-
DeviceType["Camera"] = "camera";
|
|
10817
|
-
DeviceType["Hub"] = "hub";
|
|
10818
|
-
DeviceType["Light"] = "light";
|
|
10819
|
-
DeviceType["Siren"] = "siren";
|
|
10820
|
-
DeviceType["Switch"] = "switch";
|
|
10821
|
-
DeviceType["Sensor"] = "sensor";
|
|
10822
|
-
DeviceType["Thermostat"] = "thermostat";
|
|
10823
|
-
/** Air-conditioner / heat-pump climate device (HVAC) — shares the
|
|
10824
|
-
* `climate-control` cap surface with `Thermostat` but renders a
|
|
10825
|
-
* dedicated AC-appropriate control UI (mode chips, fan speed,
|
|
10826
|
-
* independent vertical/horizontal swing). Sources: native Gree, and
|
|
10827
|
-
* reusable by other AC integrations. */
|
|
10828
|
-
DeviceType["Climate"] = "climate";
|
|
10829
|
-
DeviceType["Button"] = "button";
|
|
10830
|
-
/** Generic stateless event emitter — carries a device's EXACT declared
|
|
10831
|
-
* event vocabulary verbatim (no normalization). Installed with the
|
|
10832
|
-
* `event-emitter` cap. Sources: HA `event.*` entities (structured) and
|
|
10833
|
-
* HA bus events (e.g. `zha_event`, generic). */
|
|
10834
|
-
DeviceType["EventEmitter"] = "event-emitter";
|
|
10835
|
-
/** Firmware/software update entity — current vs available version,
|
|
10836
|
-
* updatable flag, update state, and an install action. Installed with
|
|
10837
|
-
* the `update` cap. Sources: Homematic firmware-update channels (and
|
|
10838
|
-
* reusable by other providers, e.g. HA `update.*` entities). */
|
|
10839
|
-
DeviceType["Update"] = "update";
|
|
10840
|
-
DeviceType["Generic"] = "generic";
|
|
10841
|
-
/** Generic notification delivery target (HA `notify.<service>`, future
|
|
10842
|
-
* Telegram / Discord / ntfy / SMTP, …). One device per delivery
|
|
10843
|
-
* endpoint; the `notifier` cap defines the send surface. */
|
|
10844
|
-
DeviceType["Notifier"] = "notifier";
|
|
10845
|
-
/** Pre-recorded action sequence with optional parameters
|
|
10846
|
-
* (HA `script.*`). Runnable via `script-runner` cap. */
|
|
10847
|
-
DeviceType["Script"] = "script";
|
|
10848
|
-
/** Automation rule (HA `automation.*`) — enable/disable + manual
|
|
10849
|
-
* trigger surface exposed via `automation-control` cap. */
|
|
10850
|
-
DeviceType["Automation"] = "automation";
|
|
10851
|
-
/** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
|
|
10852
|
-
DeviceType["Lock"] = "lock";
|
|
10853
|
-
/** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
|
|
10854
|
-
* `valve.*`). `cover` cap with sub-roles for variant. */
|
|
10855
|
-
DeviceType["Cover"] = "cover";
|
|
10856
|
-
/** Pipe / water / gas valve with open/close/stop and optional
|
|
10857
|
-
* position (HA `valve.*`). `valve` cap — a cover-sibling actuator
|
|
10858
|
-
* modelled on the same open/closed lifecycle. */
|
|
10859
|
-
DeviceType["Valve"] = "valve";
|
|
10860
|
-
/** Humidifier / dehumidifier with on/off + target humidity + mode
|
|
10861
|
-
* (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
|
|
10862
|
-
* modelled on the same target / mode lifecycle. */
|
|
10863
|
-
DeviceType["Humidifier"] = "humidifier";
|
|
10864
|
-
/** Water heater / boiler with target temperature + operation mode +
|
|
10865
|
-
* away mode (HA `water_heater.*`). `water-heater` cap — a
|
|
10866
|
-
* climate-family actuator. */
|
|
10867
|
-
DeviceType["WaterHeater"] = "water-heater";
|
|
10868
|
-
/** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
|
|
10869
|
-
DeviceType["Fan"] = "fan";
|
|
10870
|
-
/** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
|
|
10871
|
-
* the camera surface — those use `Camera`. `media-player` cap. */
|
|
10872
|
-
DeviceType["MediaPlayer"] = "media-player";
|
|
10873
|
-
/** Security panel / alarm system (HA `alarm_control_panel.*`).
|
|
10874
|
-
* `alarm-panel` cap. */
|
|
10875
|
-
DeviceType["AlarmPanel"] = "alarm-panel";
|
|
10876
|
-
/** Generic user-settable input (HA `number` / `input_number` / `select`
|
|
10877
|
-
* / `input_select` / `text` / `input_text` / `input_datetime`).
|
|
10878
|
-
* Sub-type via `DeviceRole`: NumericControl / SelectControl /
|
|
10879
|
-
* TextControl / DateTimeControl. */
|
|
10880
|
-
DeviceType["Control"] = "control";
|
|
10881
|
-
/** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
|
|
10882
|
-
* `presence` cap. */
|
|
10883
|
-
DeviceType["Presence"] = "presence";
|
|
10884
|
-
/** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
|
|
10885
|
-
* `weather` cap. */
|
|
10886
|
-
DeviceType["Weather"] = "weather";
|
|
10887
|
-
/** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
|
|
10888
|
-
DeviceType["Vacuum"] = "vacuum";
|
|
10889
|
-
/** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
|
|
10890
|
-
* `lawn-mower-control` cap. */
|
|
10891
|
-
DeviceType["LawnMower"] = "lawn-mower";
|
|
10892
|
-
/** Physical HA device group — parent container for entity-children
|
|
10893
|
-
* adopted from a single HA device entry. Not renderable as a
|
|
10894
|
-
* standalone device; exists only to anchor child entities. */
|
|
10895
|
-
DeviceType["Container"] = "container";
|
|
10896
|
-
/** Single still-image entity (HA `image.*`). Read-only display of an
|
|
10897
|
-
* `entity_picture` signed URL the browser loads directly. `image` cap. */
|
|
10898
|
-
DeviceType["Image"] = "image";
|
|
10899
|
-
/** Smart pet feeder — cloud-connected food dispenser with a bowl food
|
|
10900
|
-
* level, battery, desiccant life, feeding state and manual-feed /
|
|
10901
|
-
* call-pet / maintenance actions. Installed with the `pet-feeder` cap;
|
|
10902
|
-
* dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
|
|
10903
|
-
* native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
|
|
10904
|
-
* integrations sharing the same food/desiccant/hopper surface. */
|
|
10905
|
-
DeviceType["PetFeeder"] = "pet-feeder";
|
|
10906
|
-
/** Pet water fountain — tank level, water drunk, pump and its duty cycle.
|
|
10907
|
-
* Installed with the `pet-fountain` cap. Reaches CamStack as loose entities
|
|
10908
|
-
* of a container and is BUILT as a composed device (D967). */
|
|
10909
|
-
DeviceType["PetFountain"] = "pet-fountain";
|
|
10910
|
-
/** Built-in dishwasher — program lifecycle, door / remote-start gates,
|
|
10911
|
-
* salt and rinse-aid levels. Installed with the `dishwasher` cap.
|
|
10912
|
-
* Sources: native Bosch Home Connect, reusable by similar integrations.
|
|
10913
|
-
* A plug-built dishwasher carries running-state and power instead. */
|
|
10914
|
-
DeviceType["Dishwasher"] = "dishwasher";
|
|
10915
|
-
/** Washing machine. A plug-built one is running while its power stays
|
|
10916
|
-
* above a threshold. No program cap — that surface is the dishwasher's. */
|
|
10917
|
-
DeviceType["Washer"] = "washer";
|
|
10918
|
-
/** Tumble dryer. Same plug-built running surface as {@link Washer}. */
|
|
10919
|
-
DeviceType["Dryer"] = "dryer";
|
|
10920
|
-
/** The physical bridge box of a vendor ecosystem (Velux KLF-200, and later
|
|
10921
|
-
* other radio-to-IP bridges). It carries the box's own facts (firmware,
|
|
10922
|
-
* address, connection state) and the actions the box really supports
|
|
10923
|
-
* (`reboot`, `device-admin-link`). Products are NOT its children — they are
|
|
10924
|
-
* adopted beside it — and its connection settings stay on the integration. */
|
|
10925
|
-
DeviceType["Gateway"] = "gateway";
|
|
10926
|
-
return DeviceType;
|
|
10927
|
-
}({});
|
|
10928
|
-
var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
10929
|
-
DeviceFeature["BatteryOperated"] = "battery-operated";
|
|
10930
|
-
DeviceFeature["Rebootable"] = "rebootable";
|
|
10931
|
-
/**
|
|
10932
|
-
* Device supports an on-demand re-sync of its derived spec with its
|
|
10933
|
-
* upstream source — drives the generic Re-sync button. The owning
|
|
10934
|
-
* provider implements the action via the `device-adoption.resync` cap.
|
|
10935
|
-
*/
|
|
10936
|
-
DeviceFeature["Resyncable"] = "resyncable";
|
|
10937
|
-
DeviceFeature["NativeSnapshot"] = "native-snapshot";
|
|
10938
|
-
DeviceFeature["DoorbellButton"] = "doorbell-button";
|
|
10939
|
-
DeviceFeature["TwoWayAudio"] = "two-way-audio";
|
|
10940
|
-
DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
|
|
10941
|
-
/**
|
|
10942
|
-
* Camera supports the on-firmware autotrack subsystem (subject-
|
|
10943
|
-
* following). Distinct from `PanTiltZoom` because not every PTZ
|
|
10944
|
-
* camera ships autotrack — the admin UI uses this flag to gate
|
|
10945
|
-
* the autotrack toggle / settings card without re-deriving from
|
|
10946
|
-
* the cap registry. Mirrors `ptz-autotrack` cap registration:
|
|
10947
|
-
* driver sets this feature when probe confirms the firmware
|
|
10948
|
-
* surface, and registers the cap in the same code path.
|
|
10949
|
-
*/
|
|
10950
|
-
DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
|
|
10951
|
-
/**
|
|
10952
|
-
* Accessory exposes a "trigger on motion" toggle — the parent camera's
|
|
10953
|
-
* motion detection automatically activates this device. Mirrors
|
|
10954
|
-
* `motion-trigger` cap registration: drivers set this feature in the
|
|
10955
|
-
* same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
|
|
10956
|
-
*
|
|
10957
|
-
* Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
|
|
10958
|
-
* fast scalar without binding fetch), notifier rules, and `listAll`
|
|
10959
|
-
* filters that want "all devices with on-motion behaviour".
|
|
10960
|
-
*/
|
|
10961
|
-
DeviceFeature["MotionTrigger"] = "motion-trigger";
|
|
10962
|
-
/** Light supports rgb-triplet color via `color` cap. */
|
|
10963
|
-
DeviceFeature["LightColorRgb"] = "light-color-rgb";
|
|
10964
|
-
/** Light supports HSV color via `color` cap. */
|
|
10965
|
-
DeviceFeature["LightColorHsv"] = "light-color-hsv";
|
|
10966
|
-
/** Light supports color-temperature (mired) via `color` cap. */
|
|
10967
|
-
DeviceFeature["LightColorMired"] = "light-color-mired";
|
|
10968
|
-
/** Thermostat supports a `heat_cool` dual setpoint (targetLow +
|
|
10969
|
-
* targetHigh). Gates the range slider UI. */
|
|
10970
|
-
DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
|
|
10971
|
-
/** Thermostat exposes target humidity and/or current humidity
|
|
10972
|
-
* readings. Gates the humidity controls. */
|
|
10973
|
-
DeviceFeature["ClimateHumidity"] = "climate-humidity";
|
|
10974
|
-
/** Thermostat exposes a fan-mode selector. */
|
|
10975
|
-
DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
|
|
10976
|
-
/** Thermostat exposes preset modes (eco / away / sleep / vendor). */
|
|
10977
|
-
DeviceFeature["ClimatePreset"] = "climate-preset";
|
|
10978
|
-
/** Thermostat exposes a vertical louver swing toggle. Gates the
|
|
10979
|
-
* vertical-swing switch in the climate UI. Independent of horizontal. */
|
|
10980
|
-
DeviceFeature["ClimateSwingVertical"] = "climate-swing-vertical";
|
|
10981
|
-
/** Thermostat exposes a horizontal louver swing toggle. Gates the
|
|
10982
|
-
* horizontal-swing switch in the climate UI. Independent of vertical. */
|
|
10983
|
-
DeviceFeature["ClimateSwingHorizontal"] = "climate-swing-horizontal";
|
|
10984
|
-
/** Cover exposes intermediate position control (0..100). Gates the
|
|
10985
|
-
* position slider UI. */
|
|
10986
|
-
DeviceFeature["CoverPositionable"] = "cover-positionable";
|
|
10987
|
-
/** Cover exposes slat-tilt control. Gates the tilt slider UI. */
|
|
10988
|
-
DeviceFeature["CoverTilt"] = "cover-tilt";
|
|
10989
|
-
/** Valve exposes intermediate position control (0..100). Gates the
|
|
10990
|
-
* position slider / drag surface UI. */
|
|
10991
|
-
DeviceFeature["ValvePositionable"] = "valve-positionable";
|
|
10992
|
-
/** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
|
|
10993
|
-
DeviceFeature["FanSpeed"] = "fan-speed";
|
|
10994
|
-
/** Fan exposes a preset mode selector. */
|
|
10995
|
-
DeviceFeature["FanPreset"] = "fan-preset";
|
|
10996
|
-
/** Fan exposes blade direction (forward/reverse) — typical of
|
|
10997
|
-
* ceiling fans. */
|
|
10998
|
-
DeviceFeature["FanDirection"] = "fan-direction";
|
|
10999
|
-
/** Fan exposes an oscillation toggle. */
|
|
11000
|
-
DeviceFeature["FanOscillating"] = "fan-oscillating";
|
|
11001
|
-
/** Lock requires a PIN code on lock/unlock. Gates the code-entry
|
|
11002
|
-
* field on the UI lock-controls panel. */
|
|
11003
|
-
DeviceFeature["LockPinRequired"] = "lock-pin-required";
|
|
11004
|
-
/** Lock supports a latch-release ("open door") action distinct from
|
|
11005
|
-
* unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
|
|
11006
|
-
* `supported_features`. Gates the Open Door button in the UI. */
|
|
11007
|
-
DeviceFeature["LockOpen"] = "lock-open";
|
|
11008
|
-
/** Media player exposes a seek-to-position surface. */
|
|
11009
|
-
DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
|
|
11010
|
-
/** Media player exposes a volume-level setter. */
|
|
11011
|
-
DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
|
|
11012
|
-
/** Media player exposes a mute toggle distinct from volume=0. */
|
|
11013
|
-
DeviceFeature["MediaPlayerMute"] = "media-player-mute";
|
|
11014
|
-
/** Media player exposes a shuffle toggle. */
|
|
11015
|
-
DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
|
|
11016
|
-
/** Media player exposes a repeat mode (off / all / one). */
|
|
11017
|
-
DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
|
|
11018
|
-
/** Media player exposes a source / input selector. */
|
|
11019
|
-
DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
|
|
11020
|
-
/** Media player exposes a play-arbitrary-media surface (URL / id). */
|
|
11021
|
-
DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
|
|
11022
|
-
/** Media player exposes next-track. */
|
|
11023
|
-
DeviceFeature["MediaPlayerNext"] = "media-player-next";
|
|
11024
|
-
/** Media player exposes previous-track. */
|
|
11025
|
-
DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
|
|
11026
|
-
/** Media player exposes stop distinct from pause. */
|
|
11027
|
-
DeviceFeature["MediaPlayerStop"] = "media-player-stop";
|
|
11028
|
-
/** Alarm panel requires a PIN code on arm/disarm. */
|
|
11029
|
-
DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
|
|
11030
|
-
/** Presence device carries GPS coordinates (lat/lng/accuracy) in
|
|
11031
|
-
* addition to a textual location. */
|
|
11032
|
-
DeviceFeature["PresenceGps"] = "presence-gps";
|
|
11033
|
-
/** Notifier accepts an inline / URL image attachment. */
|
|
11034
|
-
DeviceFeature["NotifierImage"] = "notifier-image";
|
|
11035
|
-
/** Notifier accepts a priority hint (high/normal/low). */
|
|
11036
|
-
DeviceFeature["NotifierPriority"] = "notifier-priority";
|
|
11037
|
-
/** Notifier accepts a free-form `data` payload for platform-specific
|
|
11038
|
-
* fields. */
|
|
11039
|
-
DeviceFeature["NotifierData"] = "notifier-data";
|
|
11040
|
-
/** Notifier supports interactive action buttons / callbacks. */
|
|
11041
|
-
DeviceFeature["NotifierActions"] = "notifier-actions";
|
|
11042
|
-
/** Notifier supports per-call recipient targeting (multi-user). */
|
|
11043
|
-
DeviceFeature["NotifierRecipients"] = "notifier-recipients";
|
|
11044
|
-
/** Script runner accepts a variables map on each run invocation. */
|
|
11045
|
-
DeviceFeature["ScriptVariables"] = "script-variables";
|
|
11046
|
-
/** Automation `trigger` accepts a skipCondition flag — fires the
|
|
11047
|
-
* automation's actions while bypassing its condition block. */
|
|
11048
|
-
DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
|
|
11049
|
-
/** Robot vacuum exposes a live cleaning map (image child). Gates the
|
|
11050
|
-
* map tile in the vacuum UI. */
|
|
11051
|
-
DeviceFeature["VacuumHasMap"] = "vacuum-has-map";
|
|
11052
|
-
/** Robot vacuum exposes AI obstacle-detection toggles. Gates the AI
|
|
11053
|
-
* switches group. */
|
|
11054
|
-
DeviceFeature["VacuumHasAi"] = "vacuum-has-ai";
|
|
11055
|
-
/** Robot mower exposes a live mowing map (SVG image child). Gates the
|
|
11056
|
-
* mower map tile. */
|
|
11057
|
-
DeviceFeature["MowerHasMap"] = "mower-has-map";
|
|
11058
|
-
/** Robot mower exposes targeted mowing (all-area / zones / edges /
|
|
11059
|
-
* spots) — gates the Mow action + map selectors. */
|
|
11060
|
-
DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
|
|
11061
|
-
return DeviceFeature;
|
|
11062
|
-
}({});
|
|
11063
|
-
/**
|
|
11064
|
-
* Semantic role a device plays within its parent. Populated by driver
|
|
11065
|
-
* addons when creating accessory devices (Reolink siren/floodlight/
|
|
11066
|
-
* PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
|
|
11067
|
-
* admin UI to pick icons, labels, and widgets — a `Switch` with
|
|
11068
|
-
* `role: Floodlight` renders as a bulb with a brightness slider,
|
|
11069
|
-
* whereas a `Switch` with `role: Siren` renders as a klaxon.
|
|
11070
|
-
*
|
|
11071
|
-
* Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
|
|
11072
|
-
* sqlite as a nullable TEXT column — old rows keep working unchanged.
|
|
11073
|
-
*/
|
|
11074
|
-
var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
11075
|
-
DeviceRole["Siren"] = "siren";
|
|
11076
|
-
DeviceRole["Floodlight"] = "floodlight";
|
|
11077
|
-
DeviceRole["Spotlight"] = "spotlight";
|
|
11078
|
-
DeviceRole["PirSensor"] = "pir-sensor";
|
|
11079
|
-
DeviceRole["Chime"] = "chime";
|
|
11080
|
-
DeviceRole["Autotrack"] = "autotrack";
|
|
11081
|
-
DeviceRole["Nightvision"] = "nightvision";
|
|
11082
|
-
DeviceRole["PrivacyMask"] = "privacy-mask";
|
|
11083
|
-
DeviceRole["Doorbell"] = "doorbell";
|
|
11084
|
-
/** Interior blind / shade / roller blind. HA `device_class: blind|shade`. */
|
|
11085
|
-
DeviceRole["CoverBlind"] = "cover-blind";
|
|
11086
|
-
/** Exterior roller shutter. HA `device_class: shutter`; Homematic BROLL. */
|
|
11087
|
-
DeviceRole["CoverShutter"] = "cover-shutter";
|
|
11088
|
-
/** Exterior awning. HA `device_class: awning`. */
|
|
11089
|
-
DeviceRole["CoverAwning"] = "cover-awning";
|
|
11090
|
-
/** Curtain / drape. HA `device_class: curtain`. */
|
|
11091
|
-
DeviceRole["CoverCurtain"] = "cover-curtain";
|
|
11092
|
-
/** Garage door. HA `device_class: garage`. A security actuator: exports gate it. */
|
|
11093
|
-
DeviceRole["CoverGarage"] = "cover-garage";
|
|
11094
|
-
/** Gate. HA `device_class: gate`. A security actuator: exports gate it. */
|
|
11095
|
-
DeviceRole["CoverGate"] = "cover-gate";
|
|
11096
|
-
/** Door. HA `device_class: door`. A security actuator: exports gate it. */
|
|
11097
|
-
DeviceRole["CoverDoor"] = "cover-door";
|
|
11098
|
-
/** Window. HA `device_class: window`. */
|
|
11099
|
-
DeviceRole["CoverWindow"] = "cover-window";
|
|
11100
|
-
/** Virtual HA toggle (input_boolean.*) — distinguishable from a
|
|
11101
|
-
* real Switch device for UI rendering / export adapters. */
|
|
11102
|
-
DeviceRole["BinaryHelper"] = "binary-helper";
|
|
11103
|
-
/** A smart plug: a `switch` whose source says it is an outlet (HA
|
|
11104
|
-
* `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
|
|
11105
|
-
DeviceRole["Outlet"] = "outlet";
|
|
11106
|
-
/** Generic motion / occupancy / moving event source. Distinct from
|
|
11107
|
-
* the camera accessory PirSensor role: that one is a camera child;
|
|
11108
|
-
* this is a standalone HA / 3rd-party motion sensor. */
|
|
11109
|
-
DeviceRole["MotionSensor"] = "motion-sensor";
|
|
11110
|
-
DeviceRole["ContactSensor"] = "contact-sensor";
|
|
11111
|
-
DeviceRole["LeakSensor"] = "leak-sensor";
|
|
11112
|
-
DeviceRole["SmokeSensor"] = "smoke-sensor";
|
|
11113
|
-
DeviceRole["COSensor"] = "co-sensor";
|
|
11114
|
-
DeviceRole["GasSensor"] = "gas-sensor";
|
|
11115
|
-
DeviceRole["TamperSensor"] = "tamper-sensor";
|
|
11116
|
-
DeviceRole["VibrationSensor"] = "vibration-sensor";
|
|
11117
|
-
DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
|
|
11118
|
-
DeviceRole["SoundSensor"] = "sound-sensor";
|
|
11119
|
-
/** Fallback for `binary_sensor` without a known `device_class`. */
|
|
11120
|
-
DeviceRole["BinarySensor"] = "binary-sensor";
|
|
11121
|
-
DeviceRole["TemperatureSensor"] = "temperature-sensor";
|
|
11122
|
-
DeviceRole["HumiditySensor"] = "humidity-sensor";
|
|
11123
|
-
DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
|
|
11124
|
-
DeviceRole["PressureSensor"] = "pressure-sensor";
|
|
11125
|
-
/** Wind speed or direction (weather-station `wind-sensor` cap). */
|
|
11126
|
-
DeviceRole["WindSensor"] = "wind-sensor";
|
|
11127
|
-
/** Rain accumulation or rate (weather-station `rain-sensor` cap). */
|
|
11128
|
-
DeviceRole["RainSensor"] = "rain-sensor";
|
|
11129
|
-
/** UV index (weather-station `uv-sensor` cap). */
|
|
11130
|
-
DeviceRole["UvSensor"] = "uv-sensor";
|
|
11131
|
-
/** Solar irradiance W/m² (weather-station `solar-radiation-sensor` cap).
|
|
11132
|
-
* Distinct from AmbientLightSensor (lux). */
|
|
11133
|
-
DeviceRole["SolarRadiationSensor"] = "solar-radiation-sensor";
|
|
11134
|
-
/** Soil moisture % (garden/weather `soil-moisture-sensor` cap). */
|
|
11135
|
-
DeviceRole["SoilMoistureSensor"] = "soil-moisture-sensor";
|
|
11136
|
-
DeviceRole["PowerSensor"] = "power-sensor";
|
|
11137
|
-
DeviceRole["EnergySensor"] = "energy-sensor";
|
|
11138
|
-
DeviceRole["VoltageSensor"] = "voltage-sensor";
|
|
11139
|
-
DeviceRole["CurrentSensor"] = "current-sensor";
|
|
11140
|
-
DeviceRole["AirQualitySensor"] = "air-quality-sensor";
|
|
11141
|
-
/** Battery level (numeric % via `sensor` OR low-bool via
|
|
11142
|
-
* `binary_sensor` — the cap distinguishes via the value type). */
|
|
11143
|
-
DeviceRole["BatterySensor"] = "battery-sensor";
|
|
11144
|
-
/** Fallback for `sensor` numeric without a known `device_class`. */
|
|
11145
|
-
DeviceRole["NumericSensor"] = "numeric-sensor";
|
|
11146
|
-
/** String / enum state (HA `sensor` with `state_class: enum` or
|
|
11147
|
-
* `attributes.options`). */
|
|
11148
|
-
DeviceRole["EnumSensor"] = "enum-sensor";
|
|
11149
|
-
/** Date / timestamp state (HA `sensor` with `device_class: timestamp`
|
|
11150
|
-
* or `date`). The slice carries the raw ISO string verbatim (hosted on
|
|
11151
|
-
* the `enum-sensor` cap); the UI renders it locale-formatted. */
|
|
11152
|
-
DeviceRole["DateTimeSensor"] = "datetime-sensor";
|
|
11153
|
-
/** Last-resort fallback when nothing else matches. */
|
|
11154
|
-
DeviceRole["GenericSensor"] = "generic-sensor";
|
|
11155
|
-
DeviceRole["NumericControl"] = "numeric-control";
|
|
11156
|
-
DeviceRole["SelectControl"] = "select-control";
|
|
11157
|
-
DeviceRole["TextControl"] = "text-control";
|
|
11158
|
-
DeviceRole["DateTimeControl"] = "datetime-control";
|
|
11159
|
-
/** Mobile push notifier (HA `notify.mobile_app_*`) — supports
|
|
11160
|
-
* rich features (image, priority, channel routing). */
|
|
11161
|
-
DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
|
|
11162
|
-
/** Chat / messaging service (HA `notify.telegram_*`,
|
|
11163
|
-
* `notify.discord_*`, etc.). */
|
|
11164
|
-
DeviceRole["MessagingNotifier"] = "messaging-notifier";
|
|
11165
|
-
/** Email-based delivery (HA `notify.smtp`, etc.). */
|
|
11166
|
-
DeviceRole["EmailNotifier"] = "email-notifier";
|
|
11167
|
-
/** Fallback when the notifier service name doesn't match a known
|
|
11168
|
-
* pattern. */
|
|
11169
|
-
DeviceRole["GenericNotifier"] = "generic-notifier";
|
|
11170
|
-
/** Emits a pulse train (infrared or RF) on request — the `ir-transmitter`
|
|
11171
|
-
* cap. A `DeviceType.Generic` device. */
|
|
11172
|
-
DeviceRole["IrTransmitter"] = "ir-transmitter";
|
|
11173
|
-
return DeviceRole;
|
|
11174
|
-
}({});
|
|
11175
|
-
/**
|
|
11176
|
-
import { errMsg } from '@camstack/types'
|
|
11177
|
-
* Extract a human-readable message from an unknown error value.
|
|
11178
|
-
* Replaces the ubiquitous `errMsg(err)` pattern.
|
|
11179
|
-
*/
|
|
11180
|
-
function errMsg(err) {
|
|
11181
|
-
if (err instanceof Error) return err.message;
|
|
11182
|
-
if (typeof err === "string") return err;
|
|
11183
|
-
return String(err);
|
|
11184
|
-
}
|
|
11185
|
-
//#endregion
|
|
11186
|
-
//#region ../types/dist/composition-C7WdThmP.mjs
|
|
11317
|
+
//#region ../types/dist/composition-BBzVf2xd.mjs
|
|
11187
11318
|
/**
|
|
11188
11319
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
11189
11320
|
*
|
|
@@ -12402,6 +12533,71 @@ var EventOwnerTypeSchema = _enum(EVENT_OWNER_TYPES);
|
|
|
12402
12533
|
var MediaPresenceOwnerKindSchema = _enum([...EVENT_OWNER_TYPES, "track"]);
|
|
12403
12534
|
new Set(EVENT_OWNER_TYPES);
|
|
12404
12535
|
/**
|
|
12536
|
+
* What a published package needs from the rest of the install (D989).
|
|
12537
|
+
*
|
|
12538
|
+
* One published framework package (`@camstack/server`) carries the kernel, the
|
|
12539
|
+
* builtins and the capability contracts, so "which addon runs on which
|
|
12540
|
+
* framework" is a question of version, and the answer is DECLARED by the
|
|
12541
|
+
* package that knows it:
|
|
12542
|
+
*
|
|
12543
|
+
* - an addon says the oldest server it runs on (`requires.server: ">=X"`);
|
|
12544
|
+
* - the server says the oldest addon it works with
|
|
12545
|
+
* (`requires.addons: { "@camstack/addon-x": ">=Y" }`) and the oldest shell
|
|
12546
|
+
* around it (`requires.wrapper: { desktop, image }`);
|
|
12547
|
+
* - a wrapper (the desktop app, the container starter) says which server
|
|
12548
|
+
* range it can host, and reports its own kind and version.
|
|
12549
|
+
*
|
|
12550
|
+
* The publish workflow STAMPS these after the version bump
|
|
12551
|
+
* (`scripts/ci/stamp-requires.mjs`); nobody types a number by hand.
|
|
12552
|
+
*
|
|
12553
|
+
* A requirement that cannot be checked is NOT met: a shell that reports no
|
|
12554
|
+
* version counts as below the minimum, and an unreadable running version is
|
|
12555
|
+
* named in the result (a failed read is never a pass).
|
|
12556
|
+
*/
|
|
12557
|
+
/** `>=MAJOR.MINOR.PATCH[-prerelease]` — the only range shape a requirement uses. */
|
|
12558
|
+
var MinVersionSchema = string().regex(/^>=\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/, "a minimum is written \">=X.Y.Z\"");
|
|
12559
|
+
object({
|
|
12560
|
+
/** The oldest `@camstack/server` this package runs on. */
|
|
12561
|
+
server: MinVersionSchema.optional(),
|
|
12562
|
+
/** The oldest installed version of each named addon package. */
|
|
12563
|
+
addons: record(string(), MinVersionSchema).optional(),
|
|
12564
|
+
/** The oldest shell around the server, per shell kind. */
|
|
12565
|
+
wrapper: object({
|
|
12566
|
+
desktop: MinVersionSchema.optional(),
|
|
12567
|
+
image: MinVersionSchema.optional()
|
|
12568
|
+
}).optional()
|
|
12569
|
+
});
|
|
12570
|
+
/** One unmet requirement; each names the versions on both sides. */
|
|
12571
|
+
var UnmetRequirementSchema = discriminatedUnion("kind", [
|
|
12572
|
+
object({
|
|
12573
|
+
kind: literal("server-too-old"),
|
|
12574
|
+
required: string(),
|
|
12575
|
+
/** `null` — the running server version could not be read. */
|
|
12576
|
+
running: string().nullable()
|
|
12577
|
+
}),
|
|
12578
|
+
object({
|
|
12579
|
+
kind: literal("addon-too-old"),
|
|
12580
|
+
packageName: string(),
|
|
12581
|
+
required: string(),
|
|
12582
|
+
/** `null` — the addon is not installed (or its version is unreadable). */
|
|
12583
|
+
running: string().nullable()
|
|
12584
|
+
}),
|
|
12585
|
+
object({
|
|
12586
|
+
kind: literal("wrapper-too-old"),
|
|
12587
|
+
wrapper: _enum(["desktop", "image"]),
|
|
12588
|
+
required: string(),
|
|
12589
|
+
/** `null` — the wrapper reported no version. */
|
|
12590
|
+
running: string().nullable()
|
|
12591
|
+
})
|
|
12592
|
+
]);
|
|
12593
|
+
var RequiredAddonUpdateSchema = object({
|
|
12594
|
+
packageName: string(),
|
|
12595
|
+
/** The minimum the target server declares. */
|
|
12596
|
+
required: string(),
|
|
12597
|
+
/** What this node has; `null` when the addon is not installed. */
|
|
12598
|
+
installed: string().nullable()
|
|
12599
|
+
});
|
|
12600
|
+
/**
|
|
12405
12601
|
* Which integration instance a settings form is for. An addon that serves several instances
|
|
12406
12602
|
* (`instanceMode: multiple`) can show a different form per instance — an NVR integration
|
|
12407
12603
|
* needs its connection, the default integration needs the addon's own sections.
|
|
@@ -12876,6 +13072,613 @@ var CameraSwitchGroupSchema = object({
|
|
|
12876
13072
|
fetchedAt: number()
|
|
12877
13073
|
});
|
|
12878
13074
|
/**
|
|
13075
|
+
* Query filter for settings-store collections.
|
|
13076
|
+
*/
|
|
13077
|
+
var QueryFilterSchema = object({
|
|
13078
|
+
where: record(string(), unknown()).optional(),
|
|
13079
|
+
whereIn: record(string(), array(unknown())).optional(),
|
|
13080
|
+
whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
|
|
13081
|
+
/** NULL-safe exclusion: matches rows whose field is NULL OR != the value. */
|
|
13082
|
+
whereNot: record(string(), unknown()).optional(),
|
|
13083
|
+
/** NULL-safe exclusion of a SET — `whereNot` for more than one value. An
|
|
13084
|
+
* empty list excludes nothing. See `QueryFilter.whereNotIn`. */
|
|
13085
|
+
whereNotIn: record(string(), array(unknown())).optional(),
|
|
13086
|
+
orderBy: object({
|
|
13087
|
+
field: string(),
|
|
13088
|
+
direction: _enum(["asc", "desc"])
|
|
13089
|
+
}).optional(),
|
|
13090
|
+
limit: number().optional(),
|
|
13091
|
+
offset: number().optional()
|
|
13092
|
+
});
|
|
13093
|
+
/**
|
|
13094
|
+
* The predicate half of a filter, for BULK MUTATIONS.
|
|
13095
|
+
*
|
|
13096
|
+
* Deliberately not `QueryFilterSchema`: `orderBy` / `limit` / `offset` have no
|
|
13097
|
+
* meaning for a statement that rewrites a set, and accepting them would invite
|
|
13098
|
+
* a caller to believe `limit` bounds the damage. Every field is optional here
|
|
13099
|
+
* only so the shape stays composable — the implementation REJECTS a filter
|
|
13100
|
+
* that compiles to no predicate, because that is the whole collection.
|
|
13101
|
+
*/
|
|
13102
|
+
var MutationFilterSchema = object({
|
|
13103
|
+
where: record(string(), unknown()).optional(),
|
|
13104
|
+
whereIn: record(string(), array(unknown())).optional(),
|
|
13105
|
+
whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
|
|
13106
|
+
whereNot: record(string(), unknown()).optional(),
|
|
13107
|
+
whereNotIn: record(string(), array(unknown())).optional()
|
|
13108
|
+
});
|
|
13109
|
+
/**
|
|
13110
|
+
* One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
|
|
13111
|
+
*
|
|
13112
|
+
* `as` names the slot in the result, so the SAME column may be asked twice with
|
|
13113
|
+
* two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
|
|
13114
|
+
* a `Record<column, op>` shape could not express.
|
|
13115
|
+
*/
|
|
13116
|
+
var AggregateFieldSchema = object({
|
|
13117
|
+
/** Result key. */
|
|
13118
|
+
as: string().min(1),
|
|
13119
|
+
/** Column to aggregate. Must be a real column of a declared collection. */
|
|
13120
|
+
field: string().min(1),
|
|
13121
|
+
op: _enum([
|
|
13122
|
+
"sum",
|
|
13123
|
+
"min",
|
|
13124
|
+
"max"
|
|
13125
|
+
])
|
|
13126
|
+
});
|
|
13127
|
+
/**
|
|
13128
|
+
* `COUNT(*)` plus one number per requested field.
|
|
13129
|
+
*
|
|
13130
|
+
* `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
|
|
13131
|
+
* that really is 0 are different facts, and an accounting caller that renders
|
|
13132
|
+
* "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
|
|
13133
|
+
*/
|
|
13134
|
+
var AggregateResultSchema = object({
|
|
13135
|
+
count: number().int(),
|
|
13136
|
+
values: record(string(), number().nullable())
|
|
13137
|
+
});
|
|
13138
|
+
/** A single stored record: `{ id, data }`. */
|
|
13139
|
+
var SettingsRecordSchema = object({
|
|
13140
|
+
id: string(),
|
|
13141
|
+
data: record(string(), unknown())
|
|
13142
|
+
});
|
|
13143
|
+
/**
|
|
13144
|
+
* One record of a BULK insert — {@link SettingsRecordSchema} with the id made
|
|
13145
|
+
* optional.
|
|
13146
|
+
*
|
|
13147
|
+
* A separate schema rather than loosening the shared one: every other method
|
|
13148
|
+
* on this cap addresses a row BY its id, and making that field optional
|
|
13149
|
+
* everywhere would turn a forgotten key into a silently generated one on
|
|
13150
|
+
* `update` and `delete` as well.
|
|
13151
|
+
*/
|
|
13152
|
+
var BulkRecordSchema = object({
|
|
13153
|
+
id: string().optional(),
|
|
13154
|
+
data: record(string(), unknown())
|
|
13155
|
+
});
|
|
13156
|
+
/**
|
|
13157
|
+
* The database FILES one `sqlite-settings` engine process owns (D851).
|
|
13158
|
+
* Closed on purpose: a file is a thing the engine opens, backs up and gives a
|
|
13159
|
+
* serving thread, so a new one is a code change, never a string a caller
|
|
13160
|
+
* invents. `settings` is `camstack.db` and the default for every collection
|
|
13161
|
+
* that names no file.
|
|
13162
|
+
*/
|
|
13163
|
+
var DataStoreDatabaseSchema = _enum([
|
|
13164
|
+
"settings",
|
|
13165
|
+
"events",
|
|
13166
|
+
"history"
|
|
13167
|
+
]);
|
|
13168
|
+
DataStoreDatabaseSchema.options;
|
|
13169
|
+
/**
|
|
13170
|
+
* One write inside a {@link settingsStoreCapability.methods.transact} call.
|
|
13171
|
+
* The three that a "replace this set, bump that revision" write needs, plus
|
|
13172
|
+
* the batched upsert a rollup writer needs.
|
|
13173
|
+
*/
|
|
13174
|
+
var TransactOpSchema = discriminatedUnion("op", [
|
|
13175
|
+
object({
|
|
13176
|
+
op: literal("deleteWhere"),
|
|
13177
|
+
collection: string(),
|
|
13178
|
+
filter: MutationFilterSchema
|
|
13179
|
+
}),
|
|
13180
|
+
object({
|
|
13181
|
+
op: literal("insertMany"),
|
|
13182
|
+
collection: string(),
|
|
13183
|
+
records: array(BulkRecordSchema).readonly()
|
|
13184
|
+
}),
|
|
13185
|
+
object({
|
|
13186
|
+
op: literal("update"),
|
|
13187
|
+
collection: string(),
|
|
13188
|
+
id: string(),
|
|
13189
|
+
data: record(string(), unknown())
|
|
13190
|
+
}),
|
|
13191
|
+
object({
|
|
13192
|
+
op: literal("upsertMany"),
|
|
13193
|
+
collection: string(),
|
|
13194
|
+
conflict: array(string()).readonly(),
|
|
13195
|
+
records: array(BulkRecordSchema).readonly()
|
|
13196
|
+
})
|
|
13197
|
+
]);
|
|
13198
|
+
/**
|
|
13199
|
+
* The precondition of a transaction: the row `key` of `collection` must hold
|
|
13200
|
+
* `equals` in `column`, read INSIDE the transaction.
|
|
13201
|
+
*/
|
|
13202
|
+
var TransactGuardSchema = object({
|
|
13203
|
+
collection: string(),
|
|
13204
|
+
key: string(),
|
|
13205
|
+
column: string(),
|
|
13206
|
+
equals: unknown()
|
|
13207
|
+
});
|
|
13208
|
+
/**
|
|
13209
|
+
* Column declaration for a structured (SQL-backed) collection.
|
|
13210
|
+
*
|
|
13211
|
+
* Logical types — the backend translates each to the matching SQLite
|
|
13212
|
+
* storage class and handles per-type marshaling:
|
|
13213
|
+
* - `TEXT` / `INTEGER` / `REAL` — native SQLite types, pass-through
|
|
13214
|
+
* - `JSON` — TEXT under the hood; serialised on write, parsed on read
|
|
13215
|
+
* - `BOOLEAN` — INTEGER 0/1 under the hood; coerced both directions
|
|
13216
|
+
*/
|
|
13217
|
+
var CollectionColumnSchema = object({
|
|
13218
|
+
name: string(),
|
|
13219
|
+
type: _enum([
|
|
13220
|
+
"TEXT",
|
|
13221
|
+
"INTEGER",
|
|
13222
|
+
"REAL",
|
|
13223
|
+
"JSON",
|
|
13224
|
+
"BOOLEAN"
|
|
13225
|
+
]),
|
|
13226
|
+
primaryKey: boolean().optional(),
|
|
13227
|
+
notNull: boolean().optional(),
|
|
13228
|
+
unique: boolean().optional(),
|
|
13229
|
+
/**
|
|
13230
|
+
* Column DEFAULT. Required for B2: the four `ensureTable` consumers declare
|
|
13231
|
+
* columns like `enabled INTEGER NOT NULL DEFAULT 1`, and without this the
|
|
13232
|
+
* collection surface simply cannot express their existing tables — which is
|
|
13233
|
+
* why they were still on the uncapped `table*` API.
|
|
13234
|
+
*/
|
|
13235
|
+
defaultValue: union([
|
|
13236
|
+
string(),
|
|
13237
|
+
number(),
|
|
13238
|
+
boolean()
|
|
13239
|
+
]).optional()
|
|
13240
|
+
});
|
|
13241
|
+
var CollectionIndexSchema = object({
|
|
13242
|
+
name: string(),
|
|
13243
|
+
columns: array(string()).readonly(),
|
|
13244
|
+
unique: boolean().optional()
|
|
13245
|
+
});
|
|
13246
|
+
/**
|
|
13247
|
+
* The input of `declareCollection` — ONE schema for the door and for the
|
|
13248
|
+
* engine behind it, so the two surfaces cannot drift (the dispatcher forwards
|
|
13249
|
+
* the payload untouched).
|
|
13250
|
+
*
|
|
13251
|
+
* - `database` — the file the collection lives in (D851). Absent means
|
|
13252
|
+
* `settings`. A declaration naming a file other than the one the table is
|
|
13253
|
+
* already in is REFUSED by the engine, never moved.
|
|
13254
|
+
* - `primaryKey` — a COMPOSITE key, as column names. A single name is the same
|
|
13255
|
+
* as `primaryKey: true` on that column. A composite-keyed collection has no
|
|
13256
|
+
* `id`: it is written with `insertMany` / `upsertMany` / `transact` and read
|
|
13257
|
+
* with `query` / `count` / `aggregate` / `deleteWhere`; the calls that
|
|
13258
|
+
* address one row by id are refused.
|
|
13259
|
+
* - `withoutRowid` — emit `WITHOUT ROWID`. Requires a primary key.
|
|
13260
|
+
*/
|
|
13261
|
+
var DeclareCollectionInputSchema = object({
|
|
13262
|
+
namespace: string().optional(),
|
|
13263
|
+
collection: string(),
|
|
13264
|
+
columns: array(CollectionColumnSchema).readonly(),
|
|
13265
|
+
indexes: array(CollectionIndexSchema).readonly().optional(),
|
|
13266
|
+
database: DataStoreDatabaseSchema.optional(),
|
|
13267
|
+
primaryKey: array(string()).readonly().optional(),
|
|
13268
|
+
withoutRowid: boolean().optional()
|
|
13269
|
+
});
|
|
13270
|
+
method(object({
|
|
13271
|
+
namespace: string().optional(),
|
|
13272
|
+
collection: string(),
|
|
13273
|
+
key: string()
|
|
13274
|
+
}), unknown(), { auth: "admin" }), method(object({
|
|
13275
|
+
namespace: string().optional(),
|
|
13276
|
+
collection: string(),
|
|
13277
|
+
key: string(),
|
|
13278
|
+
value: unknown()
|
|
13279
|
+
}), _void(), {
|
|
13280
|
+
kind: "mutation",
|
|
13281
|
+
auth: "admin"
|
|
13282
|
+
}), method(object({
|
|
13283
|
+
namespace: string().optional(),
|
|
13284
|
+
collection: string(),
|
|
13285
|
+
filter: QueryFilterSchema.optional(),
|
|
13286
|
+
columns: array(string()).readonly().optional()
|
|
13287
|
+
}), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
|
|
13288
|
+
namespace: string().optional(),
|
|
13289
|
+
collection: string(),
|
|
13290
|
+
/** Declared columns identifying the slot; must be covered by a UNIQUE
|
|
13291
|
+
* index on the collection. Never empty. */
|
|
13292
|
+
conflict: array(string()).readonly(),
|
|
13293
|
+
record: BulkRecordSchema
|
|
13294
|
+
}), object({
|
|
13295
|
+
/** The id the row HAS: assigned by SQLite on an insert, or the existing
|
|
13296
|
+
* row's own id on an update. */
|
|
13297
|
+
id: union([string(), number()]) }), {
|
|
13298
|
+
kind: "mutation",
|
|
13299
|
+
auth: "admin"
|
|
13300
|
+
}), method(object({
|
|
13301
|
+
namespace: string().optional(),
|
|
13302
|
+
collection: string(),
|
|
13303
|
+
conflict: array(string()).readonly(),
|
|
13304
|
+
records: array(BulkRecordSchema).readonly()
|
|
13305
|
+
}), object({ upserted: number().int() }), {
|
|
13306
|
+
kind: "mutation",
|
|
13307
|
+
auth: "admin"
|
|
13308
|
+
}), method(object({
|
|
13309
|
+
namespace: string().optional(),
|
|
13310
|
+
collection: string(),
|
|
13311
|
+
record: object({
|
|
13312
|
+
id: string().optional(),
|
|
13313
|
+
data: record(string(), unknown())
|
|
13314
|
+
})
|
|
13315
|
+
}), object({
|
|
13316
|
+
/**
|
|
13317
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
13318
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
13319
|
+
* primary key — which is the only place an auto key is knowable.
|
|
13320
|
+
*/
|
|
13321
|
+
id: union([string(), number()]) }), {
|
|
13322
|
+
kind: "mutation",
|
|
13323
|
+
auth: "admin"
|
|
13324
|
+
}), method(object({
|
|
13325
|
+
namespace: string().optional(),
|
|
13326
|
+
collection: string(),
|
|
13327
|
+
records: array(BulkRecordSchema).readonly()
|
|
13328
|
+
}), object({ inserted: number().int() }), {
|
|
13329
|
+
kind: "mutation",
|
|
13330
|
+
auth: "admin"
|
|
13331
|
+
}), method(object({
|
|
13332
|
+
namespace: string().optional(),
|
|
13333
|
+
guard: TransactGuardSchema.optional(),
|
|
13334
|
+
ops: array(TransactOpSchema).readonly()
|
|
13335
|
+
}), object({
|
|
13336
|
+
applied: boolean(),
|
|
13337
|
+
current: unknown().optional()
|
|
13338
|
+
}), {
|
|
13339
|
+
kind: "mutation",
|
|
13340
|
+
auth: "admin"
|
|
13341
|
+
}), method(object({
|
|
13342
|
+
namespace: string().optional(),
|
|
13343
|
+
collection: string(),
|
|
13344
|
+
id: string(),
|
|
13345
|
+
data: record(string(), unknown())
|
|
13346
|
+
}), _void(), {
|
|
13347
|
+
kind: "mutation",
|
|
13348
|
+
auth: "admin"
|
|
13349
|
+
}), method(object({
|
|
13350
|
+
namespace: string().optional(),
|
|
13351
|
+
collection: string(),
|
|
13352
|
+
key: string()
|
|
13353
|
+
}), _void(), {
|
|
13354
|
+
kind: "mutation",
|
|
13355
|
+
auth: "admin"
|
|
13356
|
+
}), method(object({
|
|
13357
|
+
namespace: string().optional(),
|
|
13358
|
+
collection: string(),
|
|
13359
|
+
filter: MutationFilterSchema
|
|
13360
|
+
}), object({ deleted: number().int() }), {
|
|
13361
|
+
kind: "mutation",
|
|
13362
|
+
auth: "admin"
|
|
13363
|
+
}), method(object({
|
|
13364
|
+
namespace: string().optional(),
|
|
13365
|
+
collection: string(),
|
|
13366
|
+
filter: MutationFilterSchema,
|
|
13367
|
+
data: record(string(), unknown())
|
|
13368
|
+
}), object({ updated: number().int() }), {
|
|
13369
|
+
kind: "mutation",
|
|
13370
|
+
auth: "admin"
|
|
13371
|
+
}), method(object({
|
|
13372
|
+
namespace: string().optional(),
|
|
13373
|
+
collection: string(),
|
|
13374
|
+
filter: QueryFilterSchema.optional()
|
|
13375
|
+
}), number(), { auth: "admin" }), method(object({
|
|
13376
|
+
namespace: string().optional(),
|
|
13377
|
+
collection: string(),
|
|
13378
|
+
fields: array(AggregateFieldSchema).readonly(),
|
|
13379
|
+
filter: QueryFilterSchema.optional()
|
|
13380
|
+
}), AggregateResultSchema, { auth: "admin" }), method(object({
|
|
13381
|
+
namespace: string().optional(),
|
|
13382
|
+
collection: string(),
|
|
13383
|
+
field: string(),
|
|
13384
|
+
bucketSize: number().int().positive(),
|
|
13385
|
+
origin: number().int(),
|
|
13386
|
+
filter: QueryFilterSchema.optional()
|
|
13387
|
+
}), array(object({
|
|
13388
|
+
bucket: number().int(),
|
|
13389
|
+
count: number().int()
|
|
13390
|
+
})).readonly(), { auth: "admin" }), method(object({
|
|
13391
|
+
namespace: string().optional(),
|
|
13392
|
+
collection: string()
|
|
13393
|
+
}), boolean(), { auth: "admin" }), method(DeclareCollectionInputSchema, _void(), {
|
|
13394
|
+
kind: "mutation",
|
|
13395
|
+
auth: "admin"
|
|
13396
|
+
});
|
|
13397
|
+
var MigrationIdSchema = string().regex(/^[a-z0-9-]+\/\d{4}-\d{2}-\d{2}-[a-z0-9-]+$/, "a migration id is \"<owner>/<yyyy-mm-dd>-<slug>\"");
|
|
13398
|
+
var MigrationLevelSchema = _enum([
|
|
13399
|
+
"hub-store",
|
|
13400
|
+
"addon-state",
|
|
13401
|
+
"node-config",
|
|
13402
|
+
"viewer",
|
|
13403
|
+
"addon-internal"
|
|
13404
|
+
]);
|
|
13405
|
+
var MigrationStoreSchema = _enum([
|
|
13406
|
+
"settings",
|
|
13407
|
+
"events",
|
|
13408
|
+
"history",
|
|
13409
|
+
"node-local",
|
|
13410
|
+
"addon-files"
|
|
13411
|
+
]);
|
|
13412
|
+
var MigrationScopeSchema = _enum(["cluster", "per-node"]);
|
|
13413
|
+
/** What depends on a migration while it is pending: `block-owner` is the default. */
|
|
13414
|
+
var MigrationOnFailureSchema = _enum(["block-owner", "tolerate"]);
|
|
13415
|
+
/**
|
|
13416
|
+
* `sql` is a hub-only body over the owner's connection. `plan` returns edits the
|
|
13417
|
+
* engine applies inside the migration's own transaction (hub-owned: computed in
|
|
13418
|
+
* that transaction; addon-owned: computed by the owner and shipped to the engine).
|
|
13419
|
+
* `procedure` is addon-owned work that is not SQL (keychain, integration registry,
|
|
13420
|
+
* device tombstones); the ledger records its outcome and it must be idempotent.
|
|
13421
|
+
*/
|
|
13422
|
+
var MigrationBodyKindSchema = _enum([
|
|
13423
|
+
"sql",
|
|
13424
|
+
"plan",
|
|
13425
|
+
"procedure"
|
|
13426
|
+
]);
|
|
13427
|
+
var MigrationMetaSchema = object({
|
|
13428
|
+
id: MigrationIdSchema,
|
|
13429
|
+
/** `hub`, an addon id, `node` or `viewer`. */
|
|
13430
|
+
owner: string().regex(/^[a-z0-9-]+$/),
|
|
13431
|
+
level: MigrationLevelSchema,
|
|
13432
|
+
/** Strictly increasing per owner: the order within an owner. */
|
|
13433
|
+
seq: number().int().positive(),
|
|
13434
|
+
/** Ids of any owner: the order across owners. */
|
|
13435
|
+
dependsOn: array(MigrationIdSchema),
|
|
13436
|
+
store: MigrationStoreSchema,
|
|
13437
|
+
scope: MigrationScopeSchema,
|
|
13438
|
+
onFailure: MigrationOnFailureSchema,
|
|
13439
|
+
bodyKind: MigrationBodyKindSchema,
|
|
13440
|
+
description: string().min(1),
|
|
13441
|
+
/** The marked field the migration's spec must assert survived. */
|
|
13442
|
+
fixtureMark: string().min(1)
|
|
13443
|
+
}).refine((m) => m.id.startsWith(`${m.owner}/`), {
|
|
13444
|
+
message: "the id must start with \"<owner>/\"",
|
|
13445
|
+
path: ["id"]
|
|
13446
|
+
});
|
|
13447
|
+
/** A cycle in the dependency graph, named by the ids on it. */
|
|
13448
|
+
var MigrationCycleError = class extends Error {
|
|
13449
|
+
ids;
|
|
13450
|
+
constructor(ids) {
|
|
13451
|
+
super(`migration dependsOn cycle: ${ids.join(" -> ")}`);
|
|
13452
|
+
this.ids = ids;
|
|
13453
|
+
this.name = "MigrationCycleError";
|
|
13454
|
+
}
|
|
13455
|
+
};
|
|
13456
|
+
/**
|
|
13457
|
+
* Topological order over `dependsOn` plus the implicit edge "a lower `seq` of an
|
|
13458
|
+
* owner runs first". Ties are broken by `(owner, seq)`. Throws
|
|
13459
|
+
* {@link MigrationCycleError} on a cycle. A `dependsOn` id that is not in the list
|
|
13460
|
+
* is ignored here — the catalogue schema is what refuses it.
|
|
13461
|
+
*/
|
|
13462
|
+
function orderMigrations(items) {
|
|
13463
|
+
const byId = new Map(items.map((item) => [item.id, item]));
|
|
13464
|
+
const deps = /* @__PURE__ */ new Map();
|
|
13465
|
+
const ownerSorted = /* @__PURE__ */ new Map();
|
|
13466
|
+
for (const item of items) {
|
|
13467
|
+
const list = ownerSorted.get(item.owner) ?? [];
|
|
13468
|
+
list.push(item);
|
|
13469
|
+
ownerSorted.set(item.owner, list);
|
|
13470
|
+
}
|
|
13471
|
+
for (const item of items) deps.set(item.id, new Set(item.dependsOn.filter((id) => byId.has(id))));
|
|
13472
|
+
for (const list of ownerSorted.values()) {
|
|
13473
|
+
list.sort((a, b) => a.seq - b.seq);
|
|
13474
|
+
for (let i = 1; i < list.length; i++) {
|
|
13475
|
+
const previous = list[i - 1];
|
|
13476
|
+
const current = list[i];
|
|
13477
|
+
if (previous !== void 0 && current !== void 0) deps.get(current.id)?.add(previous.id);
|
|
13478
|
+
}
|
|
13479
|
+
}
|
|
13480
|
+
const tie = (a, b) => a.owner < b.owner ? -1 : a.owner > b.owner ? 1 : a.seq - b.seq;
|
|
13481
|
+
const done = /* @__PURE__ */ new Set();
|
|
13482
|
+
const ordered = [];
|
|
13483
|
+
let remaining = [...items];
|
|
13484
|
+
while (remaining.length > 0) {
|
|
13485
|
+
const ready = remaining.filter((item) => [...deps.get(item.id) ?? []].every((dep) => done.has(dep)));
|
|
13486
|
+
if (ready.length === 0) throw new MigrationCycleError(remaining.map((item) => item.id).sort());
|
|
13487
|
+
ready.sort(tie);
|
|
13488
|
+
const next = ready[0];
|
|
13489
|
+
if (next === void 0) break;
|
|
13490
|
+
ordered.push(next);
|
|
13491
|
+
done.add(next.id);
|
|
13492
|
+
remaining = remaining.filter((item) => item.id !== next.id);
|
|
13493
|
+
}
|
|
13494
|
+
return ordered;
|
|
13495
|
+
}
|
|
13496
|
+
/** Every way a list of migrations (in declaration order) is not a catalogue. */
|
|
13497
|
+
function catalogueIssues(items) {
|
|
13498
|
+
const issues = [];
|
|
13499
|
+
const seen = /* @__PURE__ */ new Set();
|
|
13500
|
+
const known = new Set(items.map((item) => item.id));
|
|
13501
|
+
const lastSeq = /* @__PURE__ */ new Map();
|
|
13502
|
+
const seqUsed = /* @__PURE__ */ new Map();
|
|
13503
|
+
for (const item of items) {
|
|
13504
|
+
if (seen.has(item.id)) issues.push({
|
|
13505
|
+
code: "duplicate-id",
|
|
13506
|
+
ids: [item.id],
|
|
13507
|
+
message: `duplicate id ${item.id}`
|
|
13508
|
+
});
|
|
13509
|
+
seen.add(item.id);
|
|
13510
|
+
const used = seqUsed.get(item.owner) ?? /* @__PURE__ */ new Set();
|
|
13511
|
+
if (used.has(item.seq)) issues.push({
|
|
13512
|
+
code: "duplicate-seq",
|
|
13513
|
+
ids: [item.id],
|
|
13514
|
+
message: `owner ${item.owner} has two migrations with seq ${item.seq}`
|
|
13515
|
+
});
|
|
13516
|
+
else if (item.seq < (lastSeq.get(item.owner) ?? 0)) issues.push({
|
|
13517
|
+
code: "seq-order",
|
|
13518
|
+
ids: [item.id],
|
|
13519
|
+
message: `seq ${item.seq} of ${item.id} does not increase in declaration order (owner ${item.owner})`
|
|
13520
|
+
});
|
|
13521
|
+
used.add(item.seq);
|
|
13522
|
+
seqUsed.set(item.owner, used);
|
|
13523
|
+
lastSeq.set(item.owner, Math.max(item.seq, lastSeq.get(item.owner) ?? 0));
|
|
13524
|
+
for (const dep of item.dependsOn) if (!known.has(dep)) issues.push({
|
|
13525
|
+
code: "unknown-dependency",
|
|
13526
|
+
ids: [item.id, dep],
|
|
13527
|
+
message: `${item.id} dependsOn unknown id ${dep}`
|
|
13528
|
+
});
|
|
13529
|
+
}
|
|
13530
|
+
try {
|
|
13531
|
+
orderMigrations(items);
|
|
13532
|
+
} catch (err) {
|
|
13533
|
+
if (err instanceof MigrationCycleError) issues.push({
|
|
13534
|
+
code: "cycle",
|
|
13535
|
+
ids: err.ids,
|
|
13536
|
+
message: err.message
|
|
13537
|
+
});
|
|
13538
|
+
else throw err;
|
|
13539
|
+
}
|
|
13540
|
+
return issues;
|
|
13541
|
+
}
|
|
13542
|
+
array(MigrationMetaSchema).superRefine((items, ctx) => {
|
|
13543
|
+
for (const issue of catalogueIssues(items)) ctx.addIssue({
|
|
13544
|
+
code: "custom",
|
|
13545
|
+
message: `${issue.code}: ${issue.message}`
|
|
13546
|
+
});
|
|
13547
|
+
});
|
|
13548
|
+
/**
|
|
13549
|
+
* The canonical JSON (`preconditionOf`) of the value a plan read; the apply step
|
|
13550
|
+
* re-reads, and a plan whose read no longer matches is refused (the migration is
|
|
13551
|
+
* `failed`, nothing it edited is kept).
|
|
13552
|
+
*/
|
|
13553
|
+
var PreconditionSchema = string().min(1).optional();
|
|
13554
|
+
var MigrationPlanSchema = object({ edits: array(discriminatedUnion("op", [
|
|
13555
|
+
object({
|
|
13556
|
+
op: literal("setKeys"),
|
|
13557
|
+
scope: string().min(1),
|
|
13558
|
+
values: record(string(), unknown()),
|
|
13559
|
+
precondition: PreconditionSchema
|
|
13560
|
+
}),
|
|
13561
|
+
object({
|
|
13562
|
+
op: literal("deleteKeys"),
|
|
13563
|
+
scope: string().min(1),
|
|
13564
|
+
keys: array(string().min(1)).min(1),
|
|
13565
|
+
precondition: PreconditionSchema
|
|
13566
|
+
}),
|
|
13567
|
+
object({
|
|
13568
|
+
op: literal("putRow"),
|
|
13569
|
+
table: string().min(1),
|
|
13570
|
+
key: record(string(), unknown()),
|
|
13571
|
+
row: record(string(), unknown()),
|
|
13572
|
+
precondition: PreconditionSchema
|
|
13573
|
+
}),
|
|
13574
|
+
object({
|
|
13575
|
+
op: literal("deleteRow"),
|
|
13576
|
+
table: string().min(1),
|
|
13577
|
+
key: record(string(), unknown()),
|
|
13578
|
+
precondition: PreconditionSchema
|
|
13579
|
+
}),
|
|
13580
|
+
object({
|
|
13581
|
+
op: literal("upsertRecord"),
|
|
13582
|
+
kind: string().min(1),
|
|
13583
|
+
recordKey: string().min(1),
|
|
13584
|
+
value: unknown(),
|
|
13585
|
+
precondition: PreconditionSchema
|
|
13586
|
+
}),
|
|
13587
|
+
object({
|
|
13588
|
+
op: literal("deleteRecord"),
|
|
13589
|
+
kind: string().min(1),
|
|
13590
|
+
recordKey: string().min(1),
|
|
13591
|
+
precondition: PreconditionSchema
|
|
13592
|
+
})
|
|
13593
|
+
])) });
|
|
13594
|
+
/**
|
|
13595
|
+
* What a `procedure` body reports. `already-done` means the rerun observed the
|
|
13596
|
+
* work finished (a crash between the work and the ledger row, or a manual fix)
|
|
13597
|
+
* and did none of it again; the ledger records `applied` either way.
|
|
13598
|
+
*/
|
|
13599
|
+
var MigrationProcedureResultSchema = object({
|
|
13600
|
+
outcome: _enum(["done", "already-done"]),
|
|
13601
|
+
summary: record(string(), unknown())
|
|
13602
|
+
});
|
|
13603
|
+
/** What an owner hands the engine when one of its migrations ran. */
|
|
13604
|
+
var MigrationOwnerResultSchema = discriminatedUnion("kind", [
|
|
13605
|
+
object({
|
|
13606
|
+
kind: literal("plan"),
|
|
13607
|
+
plan: MigrationPlanSchema
|
|
13608
|
+
}),
|
|
13609
|
+
object({
|
|
13610
|
+
kind: literal("procedure"),
|
|
13611
|
+
result: MigrationProcedureResultSchema
|
|
13612
|
+
}),
|
|
13613
|
+
object({
|
|
13614
|
+
kind: literal("failed"),
|
|
13615
|
+
error: string().min(1)
|
|
13616
|
+
})
|
|
13617
|
+
]);
|
|
13618
|
+
/**
|
|
13619
|
+
* `held`: a restore of a pre-migration snapshot undid this id; it does not rerun
|
|
13620
|
+
* until the operator retries or a new code version ships.
|
|
13621
|
+
* `skipped-newer`: the database knows an id this code does not.
|
|
13622
|
+
*/
|
|
13623
|
+
var MigrationStatusSchema = _enum([
|
|
13624
|
+
"applied",
|
|
13625
|
+
"failed",
|
|
13626
|
+
"blocked",
|
|
13627
|
+
"running",
|
|
13628
|
+
"held",
|
|
13629
|
+
"skipped-newer"
|
|
13630
|
+
]);
|
|
13631
|
+
var MigrationLedgerEntrySchema = object({
|
|
13632
|
+
id: string(),
|
|
13633
|
+
database: DataStoreDatabaseSchema,
|
|
13634
|
+
owner: string(),
|
|
13635
|
+
level: MigrationLevelSchema,
|
|
13636
|
+
seq: number().int().nonnegative(),
|
|
13637
|
+
status: MigrationStatusSchema,
|
|
13638
|
+
attempts: number().int().nonnegative(),
|
|
13639
|
+
appliedAt: number().nullable(),
|
|
13640
|
+
codeVersion: string().nullable(),
|
|
13641
|
+
/** What the apply changed: rows per table, as the engine counted them. */
|
|
13642
|
+
planSummary: record(string(), unknown()).nullable(),
|
|
13643
|
+
progress: record(string(), unknown()).nullable(),
|
|
13644
|
+
error: string().nullable(),
|
|
13645
|
+
/** Why it is `blocked` or `held` (`dependency-failed`, `snapshot-refused`, …). */
|
|
13646
|
+
reason: string().nullable(),
|
|
13647
|
+
nodeId: string().nullable(),
|
|
13648
|
+
bootId: string().nullable()
|
|
13649
|
+
});
|
|
13650
|
+
/** A catalogued migration that is not applied, with where it stands. */
|
|
13651
|
+
var MigrationPendingEntrySchema = object({
|
|
13652
|
+
meta: MigrationMetaSchema,
|
|
13653
|
+
database: DataStoreDatabaseSchema,
|
|
13654
|
+
state: _enum([
|
|
13655
|
+
"pending",
|
|
13656
|
+
"failed",
|
|
13657
|
+
"blocked",
|
|
13658
|
+
"held"
|
|
13659
|
+
]),
|
|
13660
|
+
reason: string().nullable()
|
|
13661
|
+
});
|
|
13662
|
+
/** Rows per table before and after a dry run, and what it would have changed. */
|
|
13663
|
+
var MigrationDryRunResultSchema = object({
|
|
13664
|
+
id: string(),
|
|
13665
|
+
ok: boolean(),
|
|
13666
|
+
error: string().nullable(),
|
|
13667
|
+
rowsChanged: number().int().nonnegative(),
|
|
13668
|
+
tables: array(object({
|
|
13669
|
+
table: string(),
|
|
13670
|
+
before: number().int().nonnegative(),
|
|
13671
|
+
after: number().int().nonnegative()
|
|
13672
|
+
}))
|
|
13673
|
+
});
|
|
13674
|
+
/** One of an owner's migrations, as the engine tells the owner to treat it this boot. */
|
|
13675
|
+
var MigrationOwnerStepSchema = object({
|
|
13676
|
+
id: MigrationIdSchema,
|
|
13677
|
+
action: _enum(["run", "skip"]),
|
|
13678
|
+
/** The ledger state the engine found: `pending` has no row yet. */
|
|
13679
|
+
state: union([literal("pending"), MigrationStatusSchema])
|
|
13680
|
+
});
|
|
13681
|
+
/**
|
|
12879
13682
|
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
12880
13683
|
* gets back (cloud training, D805+).
|
|
12881
13684
|
*
|
|
@@ -16278,6 +17081,41 @@ var ACTUATOR_CAP_VOCABULARY = {
|
|
|
16278
17081
|
icon: "droplets"
|
|
16279
17082
|
}]
|
|
16280
17083
|
},
|
|
17084
|
+
"power-source": {
|
|
17085
|
+
scope: "device",
|
|
17086
|
+
noun: t("Power source", "Alimentazione"),
|
|
17087
|
+
actions: [
|
|
17088
|
+
{
|
|
17089
|
+
id: "powerSource.on",
|
|
17090
|
+
method: "powerOn",
|
|
17091
|
+
label: t("Power on", "Dai corrente"),
|
|
17092
|
+
phrase: t("Power on {device}", "Dai corrente a {device}"),
|
|
17093
|
+
icon: "power"
|
|
17094
|
+
},
|
|
17095
|
+
{
|
|
17096
|
+
id: "powerSource.off",
|
|
17097
|
+
method: "powerOff",
|
|
17098
|
+
label: t("Power off", "Togli corrente"),
|
|
17099
|
+
phrase: t("Cut the power of {device}", "Togli la corrente a {device}"),
|
|
17100
|
+
icon: "power-off"
|
|
17101
|
+
},
|
|
17102
|
+
{
|
|
17103
|
+
id: "powerSource.forceRestart",
|
|
17104
|
+
method: "forceRestart",
|
|
17105
|
+
label: t("Force restart", "Riavvio forzato"),
|
|
17106
|
+
phrase: t("Force restart {device} by cutting its power", "Riavvia {device} togliendo la corrente"),
|
|
17107
|
+
icon: "refresh-cw"
|
|
17108
|
+
}
|
|
17109
|
+
],
|
|
17110
|
+
state: [{
|
|
17111
|
+
kind: "boolean",
|
|
17112
|
+
field: "switchOn",
|
|
17113
|
+
label: t("Power switch on", "Presa accesa"),
|
|
17114
|
+
whenTrue: t("When the power of {device} comes on", "Quando arriva la corrente a {device}"),
|
|
17115
|
+
whenFalse: t("When the power of {device} is cut", "Quando manca la corrente a {device}"),
|
|
17116
|
+
icon: "power"
|
|
17117
|
+
}]
|
|
17118
|
+
},
|
|
16281
17119
|
"lock-control": {
|
|
16282
17120
|
scope: "device",
|
|
16283
17121
|
noun: t("Lock", "Serratura"),
|
|
@@ -16753,7 +17591,7 @@ var ACTUATOR_CAP_VOCABULARY = {
|
|
|
16753
17591
|
method: "setDirection",
|
|
16754
17592
|
label: t("Spin forward", "Rotazione avanti"),
|
|
16755
17593
|
phrase: t("Spin {device} forward", "Fai girare {device} in avanti"),
|
|
16756
|
-
icon: "
|
|
17594
|
+
icon: "refresh-cw",
|
|
16757
17595
|
effect: {
|
|
16758
17596
|
field: "direction",
|
|
16759
17597
|
value: "forward"
|
|
@@ -19831,6 +20669,7 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
19831
20669
|
"login-method": system(IDENTITY),
|
|
19832
20670
|
"mesh-network": system(NETWORK),
|
|
19833
20671
|
"metrics-provider": system(CLUSTER),
|
|
20672
|
+
migrations: system(INTERNAL),
|
|
19834
20673
|
"model-convert": system(ML),
|
|
19835
20674
|
"model-distributor": system(ML),
|
|
19836
20675
|
"mqtt-broker": system(NETWORK),
|
|
@@ -40033,7 +40872,8 @@ function normalizeUnit(raw) {
|
|
|
40033
40872
|
if (lower === "dbm") return "dBm";
|
|
40034
40873
|
if (lower === "dbfs") return "dBFS";
|
|
40035
40874
|
if (lower === "inhg") return "inHg";
|
|
40036
|
-
if (lower === "mm/h") return "mm/h";
|
|
40875
|
+
if (lower === "mm/h" || lower === "mm/hr") return "mm/h";
|
|
40876
|
+
if (lower === "in/h" || lower === "in/hr") return "in/h";
|
|
40037
40877
|
if (lower === "w/m²" || lower === "w/m2") return "W/m²";
|
|
40038
40878
|
if (lower === "°" || lower === "deg" || lower === "degree" || lower === "degrees") return "°";
|
|
40039
40879
|
if (lower === "kbps") return "kbps";
|
|
@@ -42252,7 +43092,7 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
|
|
|
42252
43092
|
* rebuilds without manual reload.
|
|
42253
43093
|
*
|
|
42254
43094
|
* The hub-local builtin `addon-pages-aggregator` (see
|
|
42255
|
-
* `@camstack/system/builtins/addon-pages-aggregator`) registers the
|
|
43095
|
+
* `@camstack/server/system/builtins/addon-pages-aggregator`) registers the
|
|
42256
43096
|
* provider. Splitting the public aggregator from the raw collection
|
|
42257
43097
|
* keeps both ends in codegen — there's no hand-written
|
|
42258
43098
|
* `addon-pages.router.ts` wrapper anymore.
|
|
@@ -42552,7 +43392,7 @@ method(_void(), array(WidgetMetadataSchema).readonly(), { auth: "admin" });
|
|
|
42552
43392
|
* manual reload — same scheme used by `addon-pages`.
|
|
42553
43393
|
*
|
|
42554
43394
|
* The hub-local builtin `addon-widgets-aggregator` (see
|
|
42555
|
-
* `@camstack/system/builtins/addon-widgets-aggregator`) registers the
|
|
43395
|
+
* `@camstack/server/system/builtins/addon-widgets-aggregator`) registers the
|
|
42556
43396
|
* provider. Splitting the public aggregator from the raw collection
|
|
42557
43397
|
* keeps both ends in codegen — there's no hand-written wrapper.
|
|
42558
43398
|
*/
|
|
@@ -42913,329 +43753,6 @@ method(object({
|
|
|
42913
43753
|
password: string()
|
|
42914
43754
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
42915
43755
|
/**
|
|
42916
|
-
* Query filter for settings-store collections.
|
|
42917
|
-
*/
|
|
42918
|
-
var QueryFilterSchema = object({
|
|
42919
|
-
where: record(string(), unknown()).optional(),
|
|
42920
|
-
whereIn: record(string(), array(unknown())).optional(),
|
|
42921
|
-
whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
|
|
42922
|
-
/** NULL-safe exclusion: matches rows whose field is NULL OR != the value. */
|
|
42923
|
-
whereNot: record(string(), unknown()).optional(),
|
|
42924
|
-
/** NULL-safe exclusion of a SET — `whereNot` for more than one value. An
|
|
42925
|
-
* empty list excludes nothing. See `QueryFilter.whereNotIn`. */
|
|
42926
|
-
whereNotIn: record(string(), array(unknown())).optional(),
|
|
42927
|
-
orderBy: object({
|
|
42928
|
-
field: string(),
|
|
42929
|
-
direction: _enum(["asc", "desc"])
|
|
42930
|
-
}).optional(),
|
|
42931
|
-
limit: number().optional(),
|
|
42932
|
-
offset: number().optional()
|
|
42933
|
-
});
|
|
42934
|
-
/**
|
|
42935
|
-
* The predicate half of a filter, for BULK MUTATIONS.
|
|
42936
|
-
*
|
|
42937
|
-
* Deliberately not `QueryFilterSchema`: `orderBy` / `limit` / `offset` have no
|
|
42938
|
-
* meaning for a statement that rewrites a set, and accepting them would invite
|
|
42939
|
-
* a caller to believe `limit` bounds the damage. Every field is optional here
|
|
42940
|
-
* only so the shape stays composable — the implementation REJECTS a filter
|
|
42941
|
-
* that compiles to no predicate, because that is the whole collection.
|
|
42942
|
-
*/
|
|
42943
|
-
var MutationFilterSchema = object({
|
|
42944
|
-
where: record(string(), unknown()).optional(),
|
|
42945
|
-
whereIn: record(string(), array(unknown())).optional(),
|
|
42946
|
-
whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
|
|
42947
|
-
whereNot: record(string(), unknown()).optional(),
|
|
42948
|
-
whereNotIn: record(string(), array(unknown())).optional()
|
|
42949
|
-
});
|
|
42950
|
-
/**
|
|
42951
|
-
* One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
|
|
42952
|
-
*
|
|
42953
|
-
* `as` names the slot in the result, so the SAME column may be asked twice with
|
|
42954
|
-
* two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
|
|
42955
|
-
* a `Record<column, op>` shape could not express.
|
|
42956
|
-
*/
|
|
42957
|
-
var AggregateFieldSchema = object({
|
|
42958
|
-
/** Result key. */
|
|
42959
|
-
as: string().min(1),
|
|
42960
|
-
/** Column to aggregate. Must be a real column of a declared collection. */
|
|
42961
|
-
field: string().min(1),
|
|
42962
|
-
op: _enum([
|
|
42963
|
-
"sum",
|
|
42964
|
-
"min",
|
|
42965
|
-
"max"
|
|
42966
|
-
])
|
|
42967
|
-
});
|
|
42968
|
-
/**
|
|
42969
|
-
* `COUNT(*)` plus one number per requested field.
|
|
42970
|
-
*
|
|
42971
|
-
* `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
|
|
42972
|
-
* that really is 0 are different facts, and an accounting caller that renders
|
|
42973
|
-
* "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
|
|
42974
|
-
*/
|
|
42975
|
-
var AggregateResultSchema = object({
|
|
42976
|
-
count: number().int(),
|
|
42977
|
-
values: record(string(), number().nullable())
|
|
42978
|
-
});
|
|
42979
|
-
/** A single stored record: `{ id, data }`. */
|
|
42980
|
-
var SettingsRecordSchema = object({
|
|
42981
|
-
id: string(),
|
|
42982
|
-
data: record(string(), unknown())
|
|
42983
|
-
});
|
|
42984
|
-
/**
|
|
42985
|
-
* One record of a BULK insert — {@link SettingsRecordSchema} with the id made
|
|
42986
|
-
* optional.
|
|
42987
|
-
*
|
|
42988
|
-
* A separate schema rather than loosening the shared one: every other method
|
|
42989
|
-
* on this cap addresses a row BY its id, and making that field optional
|
|
42990
|
-
* everywhere would turn a forgotten key into a silently generated one on
|
|
42991
|
-
* `update` and `delete` as well.
|
|
42992
|
-
*/
|
|
42993
|
-
var BulkRecordSchema = object({
|
|
42994
|
-
id: string().optional(),
|
|
42995
|
-
data: record(string(), unknown())
|
|
42996
|
-
});
|
|
42997
|
-
/**
|
|
42998
|
-
* The database FILES one `sqlite-settings` engine process owns (D851).
|
|
42999
|
-
* Closed on purpose: a file is a thing the engine opens, backs up and gives a
|
|
43000
|
-
* serving thread, so a new one is a code change, never a string a caller
|
|
43001
|
-
* invents. `settings` is `camstack.db` and the default for every collection
|
|
43002
|
-
* that names no file.
|
|
43003
|
-
*/
|
|
43004
|
-
var DataStoreDatabaseSchema = _enum([
|
|
43005
|
-
"settings",
|
|
43006
|
-
"events",
|
|
43007
|
-
"history"
|
|
43008
|
-
]);
|
|
43009
|
-
DataStoreDatabaseSchema.options;
|
|
43010
|
-
/**
|
|
43011
|
-
* One write inside a {@link settingsStoreCapability.methods.transact} call.
|
|
43012
|
-
* The three that a "replace this set, bump that revision" write needs, plus
|
|
43013
|
-
* the batched upsert a rollup writer needs.
|
|
43014
|
-
*/
|
|
43015
|
-
var TransactOpSchema = discriminatedUnion("op", [
|
|
43016
|
-
object({
|
|
43017
|
-
op: literal("deleteWhere"),
|
|
43018
|
-
collection: string(),
|
|
43019
|
-
filter: MutationFilterSchema
|
|
43020
|
-
}),
|
|
43021
|
-
object({
|
|
43022
|
-
op: literal("insertMany"),
|
|
43023
|
-
collection: string(),
|
|
43024
|
-
records: array(BulkRecordSchema).readonly()
|
|
43025
|
-
}),
|
|
43026
|
-
object({
|
|
43027
|
-
op: literal("update"),
|
|
43028
|
-
collection: string(),
|
|
43029
|
-
id: string(),
|
|
43030
|
-
data: record(string(), unknown())
|
|
43031
|
-
}),
|
|
43032
|
-
object({
|
|
43033
|
-
op: literal("upsertMany"),
|
|
43034
|
-
collection: string(),
|
|
43035
|
-
conflict: array(string()).readonly(),
|
|
43036
|
-
records: array(BulkRecordSchema).readonly()
|
|
43037
|
-
})
|
|
43038
|
-
]);
|
|
43039
|
-
/**
|
|
43040
|
-
* The precondition of a transaction: the row `key` of `collection` must hold
|
|
43041
|
-
* `equals` in `column`, read INSIDE the transaction.
|
|
43042
|
-
*/
|
|
43043
|
-
var TransactGuardSchema = object({
|
|
43044
|
-
collection: string(),
|
|
43045
|
-
key: string(),
|
|
43046
|
-
column: string(),
|
|
43047
|
-
equals: unknown()
|
|
43048
|
-
});
|
|
43049
|
-
/**
|
|
43050
|
-
* Column declaration for a structured (SQL-backed) collection.
|
|
43051
|
-
*
|
|
43052
|
-
* Logical types — the backend translates each to the matching SQLite
|
|
43053
|
-
* storage class and handles per-type marshaling:
|
|
43054
|
-
* - `TEXT` / `INTEGER` / `REAL` — native SQLite types, pass-through
|
|
43055
|
-
* - `JSON` — TEXT under the hood; serialised on write, parsed on read
|
|
43056
|
-
* - `BOOLEAN` — INTEGER 0/1 under the hood; coerced both directions
|
|
43057
|
-
*/
|
|
43058
|
-
var CollectionColumnSchema = object({
|
|
43059
|
-
name: string(),
|
|
43060
|
-
type: _enum([
|
|
43061
|
-
"TEXT",
|
|
43062
|
-
"INTEGER",
|
|
43063
|
-
"REAL",
|
|
43064
|
-
"JSON",
|
|
43065
|
-
"BOOLEAN"
|
|
43066
|
-
]),
|
|
43067
|
-
primaryKey: boolean().optional(),
|
|
43068
|
-
notNull: boolean().optional(),
|
|
43069
|
-
unique: boolean().optional(),
|
|
43070
|
-
/**
|
|
43071
|
-
* Column DEFAULT. Required for B2: the four `ensureTable` consumers declare
|
|
43072
|
-
* columns like `enabled INTEGER NOT NULL DEFAULT 1`, and without this the
|
|
43073
|
-
* collection surface simply cannot express their existing tables — which is
|
|
43074
|
-
* why they were still on the uncapped `table*` API.
|
|
43075
|
-
*/
|
|
43076
|
-
defaultValue: union([
|
|
43077
|
-
string(),
|
|
43078
|
-
number(),
|
|
43079
|
-
boolean()
|
|
43080
|
-
]).optional()
|
|
43081
|
-
});
|
|
43082
|
-
var CollectionIndexSchema = object({
|
|
43083
|
-
name: string(),
|
|
43084
|
-
columns: array(string()).readonly(),
|
|
43085
|
-
unique: boolean().optional()
|
|
43086
|
-
});
|
|
43087
|
-
/**
|
|
43088
|
-
* The input of `declareCollection` — ONE schema for the door and for the
|
|
43089
|
-
* engine behind it, so the two surfaces cannot drift (the dispatcher forwards
|
|
43090
|
-
* the payload untouched).
|
|
43091
|
-
*
|
|
43092
|
-
* - `database` — the file the collection lives in (D851). Absent means
|
|
43093
|
-
* `settings`. A declaration naming a file other than the one the table is
|
|
43094
|
-
* already in is REFUSED by the engine, never moved.
|
|
43095
|
-
* - `primaryKey` — a COMPOSITE key, as column names. A single name is the same
|
|
43096
|
-
* as `primaryKey: true` on that column. A composite-keyed collection has no
|
|
43097
|
-
* `id`: it is written with `insertMany` / `upsertMany` / `transact` and read
|
|
43098
|
-
* with `query` / `count` / `aggregate` / `deleteWhere`; the calls that
|
|
43099
|
-
* address one row by id are refused.
|
|
43100
|
-
* - `withoutRowid` — emit `WITHOUT ROWID`. Requires a primary key.
|
|
43101
|
-
*/
|
|
43102
|
-
var DeclareCollectionInputSchema = object({
|
|
43103
|
-
namespace: string().optional(),
|
|
43104
|
-
collection: string(),
|
|
43105
|
-
columns: array(CollectionColumnSchema).readonly(),
|
|
43106
|
-
indexes: array(CollectionIndexSchema).readonly().optional(),
|
|
43107
|
-
database: DataStoreDatabaseSchema.optional(),
|
|
43108
|
-
primaryKey: array(string()).readonly().optional(),
|
|
43109
|
-
withoutRowid: boolean().optional()
|
|
43110
|
-
});
|
|
43111
|
-
method(object({
|
|
43112
|
-
namespace: string().optional(),
|
|
43113
|
-
collection: string(),
|
|
43114
|
-
key: string()
|
|
43115
|
-
}), unknown(), { auth: "admin" }), method(object({
|
|
43116
|
-
namespace: string().optional(),
|
|
43117
|
-
collection: string(),
|
|
43118
|
-
key: string(),
|
|
43119
|
-
value: unknown()
|
|
43120
|
-
}), _void(), {
|
|
43121
|
-
kind: "mutation",
|
|
43122
|
-
auth: "admin"
|
|
43123
|
-
}), method(object({
|
|
43124
|
-
namespace: string().optional(),
|
|
43125
|
-
collection: string(),
|
|
43126
|
-
filter: QueryFilterSchema.optional(),
|
|
43127
|
-
columns: array(string()).readonly().optional()
|
|
43128
|
-
}), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
|
|
43129
|
-
namespace: string().optional(),
|
|
43130
|
-
collection: string(),
|
|
43131
|
-
/** Declared columns identifying the slot; must be covered by a UNIQUE
|
|
43132
|
-
* index on the collection. Never empty. */
|
|
43133
|
-
conflict: array(string()).readonly(),
|
|
43134
|
-
record: BulkRecordSchema
|
|
43135
|
-
}), object({
|
|
43136
|
-
/** The id the row HAS: assigned by SQLite on an insert, or the existing
|
|
43137
|
-
* row's own id on an update. */
|
|
43138
|
-
id: union([string(), number()]) }), {
|
|
43139
|
-
kind: "mutation",
|
|
43140
|
-
auth: "admin"
|
|
43141
|
-
}), method(object({
|
|
43142
|
-
namespace: string().optional(),
|
|
43143
|
-
collection: string(),
|
|
43144
|
-
conflict: array(string()).readonly(),
|
|
43145
|
-
records: array(BulkRecordSchema).readonly()
|
|
43146
|
-
}), object({ upserted: number().int() }), {
|
|
43147
|
-
kind: "mutation",
|
|
43148
|
-
auth: "admin"
|
|
43149
|
-
}), method(object({
|
|
43150
|
-
namespace: string().optional(),
|
|
43151
|
-
collection: string(),
|
|
43152
|
-
record: object({
|
|
43153
|
-
id: string().optional(),
|
|
43154
|
-
data: record(string(), unknown())
|
|
43155
|
-
})
|
|
43156
|
-
}), object({
|
|
43157
|
-
/**
|
|
43158
|
-
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
43159
|
-
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
43160
|
-
* primary key — which is the only place an auto key is knowable.
|
|
43161
|
-
*/
|
|
43162
|
-
id: union([string(), number()]) }), {
|
|
43163
|
-
kind: "mutation",
|
|
43164
|
-
auth: "admin"
|
|
43165
|
-
}), method(object({
|
|
43166
|
-
namespace: string().optional(),
|
|
43167
|
-
collection: string(),
|
|
43168
|
-
records: array(BulkRecordSchema).readonly()
|
|
43169
|
-
}), object({ inserted: number().int() }), {
|
|
43170
|
-
kind: "mutation",
|
|
43171
|
-
auth: "admin"
|
|
43172
|
-
}), method(object({
|
|
43173
|
-
namespace: string().optional(),
|
|
43174
|
-
guard: TransactGuardSchema.optional(),
|
|
43175
|
-
ops: array(TransactOpSchema).readonly()
|
|
43176
|
-
}), object({
|
|
43177
|
-
applied: boolean(),
|
|
43178
|
-
current: unknown().optional()
|
|
43179
|
-
}), {
|
|
43180
|
-
kind: "mutation",
|
|
43181
|
-
auth: "admin"
|
|
43182
|
-
}), method(object({
|
|
43183
|
-
namespace: string().optional(),
|
|
43184
|
-
collection: string(),
|
|
43185
|
-
id: string(),
|
|
43186
|
-
data: record(string(), unknown())
|
|
43187
|
-
}), _void(), {
|
|
43188
|
-
kind: "mutation",
|
|
43189
|
-
auth: "admin"
|
|
43190
|
-
}), method(object({
|
|
43191
|
-
namespace: string().optional(),
|
|
43192
|
-
collection: string(),
|
|
43193
|
-
key: string()
|
|
43194
|
-
}), _void(), {
|
|
43195
|
-
kind: "mutation",
|
|
43196
|
-
auth: "admin"
|
|
43197
|
-
}), method(object({
|
|
43198
|
-
namespace: string().optional(),
|
|
43199
|
-
collection: string(),
|
|
43200
|
-
filter: MutationFilterSchema
|
|
43201
|
-
}), object({ deleted: number().int() }), {
|
|
43202
|
-
kind: "mutation",
|
|
43203
|
-
auth: "admin"
|
|
43204
|
-
}), method(object({
|
|
43205
|
-
namespace: string().optional(),
|
|
43206
|
-
collection: string(),
|
|
43207
|
-
filter: MutationFilterSchema,
|
|
43208
|
-
data: record(string(), unknown())
|
|
43209
|
-
}), object({ updated: number().int() }), {
|
|
43210
|
-
kind: "mutation",
|
|
43211
|
-
auth: "admin"
|
|
43212
|
-
}), method(object({
|
|
43213
|
-
namespace: string().optional(),
|
|
43214
|
-
collection: string(),
|
|
43215
|
-
filter: QueryFilterSchema.optional()
|
|
43216
|
-
}), number(), { auth: "admin" }), method(object({
|
|
43217
|
-
namespace: string().optional(),
|
|
43218
|
-
collection: string(),
|
|
43219
|
-
fields: array(AggregateFieldSchema).readonly(),
|
|
43220
|
-
filter: QueryFilterSchema.optional()
|
|
43221
|
-
}), AggregateResultSchema, { auth: "admin" }), method(object({
|
|
43222
|
-
namespace: string().optional(),
|
|
43223
|
-
collection: string(),
|
|
43224
|
-
field: string(),
|
|
43225
|
-
bucketSize: number().int().positive(),
|
|
43226
|
-
origin: number().int(),
|
|
43227
|
-
filter: QueryFilterSchema.optional()
|
|
43228
|
-
}), array(object({
|
|
43229
|
-
bucket: number().int(),
|
|
43230
|
-
count: number().int()
|
|
43231
|
-
})).readonly(), { auth: "admin" }), method(object({
|
|
43232
|
-
namespace: string().optional(),
|
|
43233
|
-
collection: string()
|
|
43234
|
-
}), boolean(), { auth: "admin" }), method(DeclareCollectionInputSchema, _void(), {
|
|
43235
|
-
kind: "mutation",
|
|
43236
|
-
auth: "admin"
|
|
43237
|
-
});
|
|
43238
|
-
/**
|
|
43239
43756
|
* How long one snapshot may take end to end: the pinned copy of the whole
|
|
43240
43757
|
* database plus `PRAGMA integrity_check` over the copy, on the hub's slowest
|
|
43241
43758
|
* disk. ~800 MB at a pessimistic 10 MB/s is under 3 minutes; the bound is
|
|
@@ -45149,7 +45666,7 @@ method(object({
|
|
|
45149
45666
|
kind: "mutation",
|
|
45150
45667
|
auth: "admin"
|
|
45151
45668
|
}), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
|
|
45152
|
-
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway, DeviceType.Camera, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
|
|
45669
|
+
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway, DeviceType.Camera, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
|
|
45153
45670
|
var NUMBER = {
|
|
45154
45671
|
kind: "fixed",
|
|
45155
45672
|
result: ["number"]
|
|
@@ -46160,6 +46677,57 @@ id: union([string(), number()]) }), {
|
|
|
46160
46677
|
kind: "mutation",
|
|
46161
46678
|
auth: "admin"
|
|
46162
46679
|
});
|
|
46680
|
+
method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { auth: "admin" }), method(object({ owner: string().optional() }), object({ pending: array(MigrationPendingEntrySchema) }), { auth: "admin" }), method(object({ id: string().min(1) }), MigrationDryRunResultSchema, { auth: "admin" }), method(object({
|
|
46681
|
+
id: string().min(1),
|
|
46682
|
+
error: string().min(1)
|
|
46683
|
+
}), MigrationLedgerEntrySchema, {
|
|
46684
|
+
kind: "mutation",
|
|
46685
|
+
auth: "admin"
|
|
46686
|
+
}), method(object({ id: string().min(1) }), object({ entries: array(MigrationLedgerEntrySchema) }), {
|
|
46687
|
+
kind: "mutation",
|
|
46688
|
+
auth: "admin"
|
|
46689
|
+
}), method(object({
|
|
46690
|
+
database: DataStoreDatabaseSchema,
|
|
46691
|
+
snapshotId: string().min(1)
|
|
46692
|
+
}), object({
|
|
46693
|
+
scheduled: boolean(),
|
|
46694
|
+
held: array(string()),
|
|
46695
|
+
restartRequired: boolean()
|
|
46696
|
+
}), {
|
|
46697
|
+
kind: "mutation",
|
|
46698
|
+
auth: "admin"
|
|
46699
|
+
}), method(object({
|
|
46700
|
+
owner: string().min(1),
|
|
46701
|
+
metas: array(MigrationMetaSchema)
|
|
46702
|
+
}), object({
|
|
46703
|
+
bootId: string(),
|
|
46704
|
+
snapshot: _enum([
|
|
46705
|
+
"none",
|
|
46706
|
+
"written",
|
|
46707
|
+
"refused"
|
|
46708
|
+
]),
|
|
46709
|
+
steps: array(MigrationOwnerStepSchema)
|
|
46710
|
+
}), {
|
|
46711
|
+
kind: "mutation",
|
|
46712
|
+
auth: "admin"
|
|
46713
|
+
}), method(object({ id: string().min(1) }), object({
|
|
46714
|
+
proceed: boolean(),
|
|
46715
|
+
state: union([literal("pending"), MigrationStatusSchema]),
|
|
46716
|
+
reason: string().nullable()
|
|
46717
|
+
}), {
|
|
46718
|
+
kind: "mutation",
|
|
46719
|
+
auth: "admin"
|
|
46720
|
+
}), method(object({
|
|
46721
|
+
id: string().min(1),
|
|
46722
|
+
result: MigrationOwnerResultSchema
|
|
46723
|
+
}), object({
|
|
46724
|
+
status: MigrationStatusSchema,
|
|
46725
|
+
error: string().nullable(),
|
|
46726
|
+
rowsChanged: number().int().nonnegative()
|
|
46727
|
+
}), {
|
|
46728
|
+
kind: "mutation",
|
|
46729
|
+
auth: "admin"
|
|
46730
|
+
});
|
|
46163
46731
|
/**
|
|
46164
46732
|
* records - an addon's own facts and documents (D881): ledgers, audit rows,
|
|
46165
46733
|
* config documents, mirrors. The third storage API next to `ctx.settings`
|
|
@@ -61024,7 +61592,18 @@ var ServerUpdateActionResultSchema = object({
|
|
|
61024
61592
|
* store (D877), present when the pre-flight refused the update
|
|
61025
61593
|
* (`reason: 'addon-would-refuse'`). Optional for version skew.
|
|
61026
61594
|
*/
|
|
61027
|
-
blockers: array(UpdateBlockerSchema).optional()
|
|
61595
|
+
blockers: array(UpdateBlockerSchema).optional(),
|
|
61596
|
+
/**
|
|
61597
|
+
* The minimums the target server declares and this node does not meet
|
|
61598
|
+
* (D989), present when the update was refused with
|
|
61599
|
+
* `reason: 'requirements-unmet'`. Each names the versions on both sides.
|
|
61600
|
+
*/
|
|
61601
|
+
unmet: array(UnmetRequirementSchema).optional(),
|
|
61602
|
+
/**
|
|
61603
|
+
* The addons this node has below the minimum the staged server declares —
|
|
61604
|
+
* the ones to update WITH the server. Present on an accepted update.
|
|
61605
|
+
*/
|
|
61606
|
+
requiredAddonUpdates: array(RequiredAddonUpdateSchema).optional()
|
|
61028
61607
|
});
|
|
61029
61608
|
var LaunchOverridesSchema = object({
|
|
61030
61609
|
/** The persisted heap ceiling in MB, or `null` when none is set. */
|
|
@@ -63568,7 +64147,9 @@ var PackageUpdateSchema = object({
|
|
|
63568
64147
|
latestVersion: string(),
|
|
63569
64148
|
category: _enum(["addon", "core"]),
|
|
63570
64149
|
requiresRestart: boolean(),
|
|
63571
|
-
isSystem: boolean()
|
|
64150
|
+
isSystem: boolean(),
|
|
64151
|
+
/** Held: what the newer version needs and this node does not meet (D989). */
|
|
64152
|
+
blockedBy: array(UnmetRequirementSchema).readonly().optional()
|
|
63572
64153
|
});
|
|
63573
64154
|
var PackageVersionInfoSchema = object({
|
|
63574
64155
|
version: string(),
|
|
@@ -65024,19 +65605,19 @@ var RemoteSetConfigResultSchema = discriminatedUnion("status", [object({ status:
|
|
|
65024
65605
|
reason: _enum(["unknown-template", "not-a-media-player"]),
|
|
65025
65606
|
detail: string()
|
|
65026
65607
|
})]);
|
|
65027
|
-
var deviceInput = object({ deviceId: number().int().nonnegative() });
|
|
65608
|
+
var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
|
|
65028
65609
|
DeviceType.MediaPlayer;
|
|
65029
|
-
method(deviceInput, RemoteConfigSchema, { auth: "admin" }), method(deviceInput.extend({ config: RemoteConfigSchema }), RemoteSetConfigResultSchema, {
|
|
65610
|
+
method(deviceInput$1, RemoteConfigSchema, { auth: "admin" }), method(deviceInput$1.extend({ config: RemoteConfigSchema }), RemoteSetConfigResultSchema, {
|
|
65030
65611
|
kind: "mutation",
|
|
65031
65612
|
auth: "admin"
|
|
65032
|
-
}), method(deviceInput, RemoteCommandListSchema, { auth: "protected" }), method(deviceInput.extend({
|
|
65613
|
+
}), method(deviceInput$1, RemoteCommandListSchema, { auth: "protected" }), method(deviceInput$1.extend({
|
|
65033
65614
|
role: RemoteRoleSchema,
|
|
65034
65615
|
/** Sends in a row (volume steps). */
|
|
65035
65616
|
repeat: number().int().min(1).max(50).default(1)
|
|
65036
65617
|
}), RemoteSendResultSchema, {
|
|
65037
65618
|
kind: "mutation",
|
|
65038
65619
|
auth: "protected"
|
|
65039
|
-
}), method(deviceInput.extend({
|
|
65620
|
+
}), method(deviceInput$1.extend({
|
|
65040
65621
|
command: RemoteMediaCommandSchema,
|
|
65041
65622
|
muted: boolean().optional(),
|
|
65042
65623
|
source: string().optional(),
|
|
@@ -68859,7 +69440,7 @@ var lawnMowerControlCapability = {
|
|
|
68859
69440
|
* clients — they reverse-connect to the hub. Exposing their interfaces
|
|
68860
69441
|
* via the same surface would leak internal topology with no upside.
|
|
68861
69442
|
*
|
|
68862
|
-
* Implementation in `@camstack/system/builtins/local-network/`.
|
|
69443
|
+
* Implementation in `@camstack/server/system/builtins/local-network/`.
|
|
68863
69444
|
*/
|
|
68864
69445
|
/** Coarse classification derived from the interface name + IP range. */
|
|
68865
69446
|
var InterfaceKindEnum = _enum([
|
|
@@ -69356,6 +69937,117 @@ var lockControlCapability = {
|
|
|
69356
69937
|
* whether persisting is worth a SQLite commit. */
|
|
69357
69938
|
volatileStateFields: ["lastChangedAt"]
|
|
69358
69939
|
};
|
|
69940
|
+
var PowerSourceRefusalReasonSchema = _enum([
|
|
69941
|
+
"no-power-source",
|
|
69942
|
+
"switch-missing",
|
|
69943
|
+
"switch-offline",
|
|
69944
|
+
"switch-unknown",
|
|
69945
|
+
"restart-in-progress",
|
|
69946
|
+
"switch-call-failed"
|
|
69947
|
+
]);
|
|
69948
|
+
var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
|
|
69949
|
+
accepted: literal(false),
|
|
69950
|
+
reason: PowerSourceRefusalReasonSchema,
|
|
69951
|
+
/** One line for the operator, naming the switch. */
|
|
69952
|
+
message: string()
|
|
69953
|
+
})]);
|
|
69954
|
+
var PowerSourceInfoSchema = object({
|
|
69955
|
+
/** False when the device has no power source linked; the rest is then empty. */
|
|
69956
|
+
linked: boolean(),
|
|
69957
|
+
switchDeviceId: number().nullable(),
|
|
69958
|
+
switchName: string().nullable(),
|
|
69959
|
+
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
69960
|
+
switchOn: boolean().nullable(),
|
|
69961
|
+
switchOnline: boolean().nullable(),
|
|
69962
|
+
restartInProgress: boolean(),
|
|
69963
|
+
offSeconds: number().int()
|
|
69964
|
+
});
|
|
69965
|
+
/** The composed slice: the switch state the link mirrors, plus the stored off time. */
|
|
69966
|
+
var PowerSourceStateSchema = object({
|
|
69967
|
+
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
69968
|
+
switchOn: boolean().nullable(),
|
|
69969
|
+
offSeconds: number().int(),
|
|
69970
|
+
lastFetchedAt: number()
|
|
69971
|
+
});
|
|
69972
|
+
var POWER_SOURCE_DEVICE_TYPES = [
|
|
69973
|
+
DeviceType.Gateway,
|
|
69974
|
+
DeviceType.Hub,
|
|
69975
|
+
DeviceType.Camera,
|
|
69976
|
+
DeviceType.Sensor,
|
|
69977
|
+
DeviceType.MediaPlayer,
|
|
69978
|
+
DeviceType.Vacuum,
|
|
69979
|
+
DeviceType.Generic,
|
|
69980
|
+
DeviceType.Washer,
|
|
69981
|
+
DeviceType.Dryer,
|
|
69982
|
+
DeviceType.Dishwasher,
|
|
69983
|
+
DeviceType.PetFountain,
|
|
69984
|
+
DeviceType.Fan,
|
|
69985
|
+
DeviceType.Humidifier,
|
|
69986
|
+
DeviceType.Climate,
|
|
69987
|
+
DeviceType.WaterHeater
|
|
69988
|
+
];
|
|
69989
|
+
var powerSourceCustomize = {
|
|
69990
|
+
version: 1,
|
|
69991
|
+
targets: [{
|
|
69992
|
+
id: "switch",
|
|
69993
|
+
cardinality: "scalar",
|
|
69994
|
+
vocabulary: {
|
|
69995
|
+
cap: "power-source",
|
|
69996
|
+
stateField: "switchOn"
|
|
69997
|
+
},
|
|
69998
|
+
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
69999
|
+
apply: "add",
|
|
70000
|
+
path: "switchOn",
|
|
70001
|
+
sources: [{
|
|
70002
|
+
kind: "switch",
|
|
70003
|
+
transforms: [{ kind: "identity" }]
|
|
70004
|
+
}],
|
|
70005
|
+
companions: [{
|
|
70006
|
+
kind: "constant",
|
|
70007
|
+
path: "offSeconds",
|
|
70008
|
+
value: 10,
|
|
70009
|
+
when: "add"
|
|
70010
|
+
}, {
|
|
70011
|
+
kind: "clock",
|
|
70012
|
+
path: "lastFetchedAt",
|
|
70013
|
+
when: "always"
|
|
70014
|
+
}],
|
|
70015
|
+
sourceReport: { status: "assignment-status" }
|
|
70016
|
+
}]
|
|
70017
|
+
};
|
|
70018
|
+
var deviceInput = object({ deviceId: number().int().nonnegative() });
|
|
70019
|
+
var powerSourceCapability = {
|
|
70020
|
+
name: "power-source",
|
|
70021
|
+
scope: "device",
|
|
70022
|
+
mode: "singleton",
|
|
70023
|
+
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
70024
|
+
methods: {
|
|
70025
|
+
getStatus: systemMethod(deviceInput, PowerSourceInfoSchema, { auth: "admin" }),
|
|
70026
|
+
powerOn: systemMethod(deviceInput, PowerSourceActionResultSchema, {
|
|
70027
|
+
kind: "mutation",
|
|
70028
|
+
auth: "admin"
|
|
70029
|
+
}),
|
|
70030
|
+
powerOff: systemMethod(deviceInput, PowerSourceActionResultSchema, {
|
|
70031
|
+
kind: "mutation",
|
|
70032
|
+
auth: "admin"
|
|
70033
|
+
}),
|
|
70034
|
+
forceRestart: systemMethod(deviceInput, PowerSourceActionResultSchema, {
|
|
70035
|
+
kind: "mutation",
|
|
70036
|
+
auth: "admin"
|
|
70037
|
+
})
|
|
70038
|
+
},
|
|
70039
|
+
runtimeState: PowerSourceStateSchema,
|
|
70040
|
+
customize: powerSourceCustomize,
|
|
70041
|
+
/**
|
|
70042
|
+
* Runtime-state durability: **session** — mirrored from the linked switch on
|
|
70043
|
+
* its next report; a restored value would outlive the reading it names.
|
|
70044
|
+
*
|
|
70045
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
70046
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
70047
|
+
*/
|
|
70048
|
+
durability: "session",
|
|
70049
|
+
history: "none"
|
|
70050
|
+
};
|
|
69359
70051
|
/**
|
|
69360
70052
|
* A monotonic total between resets (D944). Energy uses `power-meter.energy`
|
|
69361
70053
|
* so dashboards keep one series; every other instantaneous reading lands here.
|
|
@@ -70636,7 +71328,7 @@ onStatusChanged: { data: object({
|
|
|
70636
71328
|
* jitter, and observed/peak bandwidth per device + per client.
|
|
70637
71329
|
*
|
|
70638
71330
|
* Implementation lives in the server's `NetworkQualityService` (thin
|
|
70639
|
-
* wrapper over the shared `NetworkQualityTracker` from `@camstack/system`).
|
|
71331
|
+
* wrapper over the shared `NetworkQualityTracker` from `@camstack/server/system`).
|
|
70640
71332
|
* The provider is registered from `trpc.router.ts` against the existing
|
|
70641
71333
|
* service instance — no addon owns this state.
|
|
70642
71334
|
*
|
|
@@ -72787,7 +73479,7 @@ var ptzAutotrackCapability = {
|
|
|
72787
73479
|
* - **Native**: the camera's own firmware autotrack, registered per device by
|
|
72788
73480
|
* the driver when the probe says it exists (Reolink: yes; Hikvision:
|
|
72789
73481
|
* model-dependent).
|
|
72790
|
-
* - **Wrapper**: the emulated implementation (`@camstack/system`'s `autotrack` builtin),
|
|
73482
|
+
* - **Wrapper**: the emulated implementation (`@camstack/server/system`'s `autotrack` builtin),
|
|
72791
73483
|
* which follows a subject with `ptz.move` pulses driven by the detection
|
|
72792
73484
|
* pipeline. `defaultActive: false` — the operator binds it per camera in
|
|
72793
73485
|
* the bindings UI.
|
|
@@ -78096,6 +78788,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
78096
78788
|
petFeeder: petFeederCapability,
|
|
78097
78789
|
petFountain: petFountainCapability,
|
|
78098
78790
|
powerMeter: powerMeterCapability,
|
|
78791
|
+
powerSource: powerSourceCapability,
|
|
78099
78792
|
presence: presenceCapability,
|
|
78100
78793
|
pressureSensor: pressureSensorCapability,
|
|
78101
78794
|
privacyMask: privacyMaskCapability,
|
|
@@ -83860,6 +84553,69 @@ Object.freeze({
|
|
|
83860
84553
|
access: "view",
|
|
83861
84554
|
role: "admin"
|
|
83862
84555
|
},
|
|
84556
|
+
"migrations.declareOwner": {
|
|
84557
|
+
capName: "migrations",
|
|
84558
|
+
capScope: "system",
|
|
84559
|
+
addonId: null,
|
|
84560
|
+
access: "create",
|
|
84561
|
+
role: "admin"
|
|
84562
|
+
},
|
|
84563
|
+
"migrations.dryRun": {
|
|
84564
|
+
capName: "migrations",
|
|
84565
|
+
capScope: "system",
|
|
84566
|
+
addonId: null,
|
|
84567
|
+
access: "view",
|
|
84568
|
+
role: "admin"
|
|
84569
|
+
},
|
|
84570
|
+
"migrations.finishMigration": {
|
|
84571
|
+
capName: "migrations",
|
|
84572
|
+
capScope: "system",
|
|
84573
|
+
addonId: null,
|
|
84574
|
+
access: "create",
|
|
84575
|
+
role: "admin"
|
|
84576
|
+
},
|
|
84577
|
+
"migrations.listLedger": {
|
|
84578
|
+
capName: "migrations",
|
|
84579
|
+
capScope: "system",
|
|
84580
|
+
addonId: null,
|
|
84581
|
+
access: "view",
|
|
84582
|
+
role: "admin"
|
|
84583
|
+
},
|
|
84584
|
+
"migrations.listPending": {
|
|
84585
|
+
capName: "migrations",
|
|
84586
|
+
capScope: "system",
|
|
84587
|
+
addonId: null,
|
|
84588
|
+
access: "view",
|
|
84589
|
+
role: "admin"
|
|
84590
|
+
},
|
|
84591
|
+
"migrations.markFailed": {
|
|
84592
|
+
capName: "migrations",
|
|
84593
|
+
capScope: "system",
|
|
84594
|
+
addonId: null,
|
|
84595
|
+
access: "create",
|
|
84596
|
+
role: "admin"
|
|
84597
|
+
},
|
|
84598
|
+
"migrations.restorePreMigration": {
|
|
84599
|
+
capName: "migrations",
|
|
84600
|
+
capScope: "system",
|
|
84601
|
+
addonId: null,
|
|
84602
|
+
access: "create",
|
|
84603
|
+
role: "admin"
|
|
84604
|
+
},
|
|
84605
|
+
"migrations.retry": {
|
|
84606
|
+
capName: "migrations",
|
|
84607
|
+
capScope: "system",
|
|
84608
|
+
addonId: null,
|
|
84609
|
+
access: "create",
|
|
84610
|
+
role: "admin"
|
|
84611
|
+
},
|
|
84612
|
+
"migrations.startMigration": {
|
|
84613
|
+
capName: "migrations",
|
|
84614
|
+
capScope: "system",
|
|
84615
|
+
addonId: null,
|
|
84616
|
+
access: "create",
|
|
84617
|
+
role: "admin"
|
|
84618
|
+
},
|
|
83863
84619
|
"modelConvert.convert": {
|
|
83864
84620
|
capName: "model-convert",
|
|
83865
84621
|
capScope: "system",
|
|
@@ -86492,6 +87248,34 @@ Object.freeze({
|
|
|
86492
87248
|
access: "view",
|
|
86493
87249
|
role: "viewer"
|
|
86494
87250
|
},
|
|
87251
|
+
"powerSource.forceRestart": {
|
|
87252
|
+
capName: "power-source",
|
|
87253
|
+
capScope: "device",
|
|
87254
|
+
addonId: null,
|
|
87255
|
+
access: "create",
|
|
87256
|
+
role: "admin"
|
|
87257
|
+
},
|
|
87258
|
+
"powerSource.getStatus": {
|
|
87259
|
+
capName: "power-source",
|
|
87260
|
+
capScope: "device",
|
|
87261
|
+
addonId: null,
|
|
87262
|
+
access: "view",
|
|
87263
|
+
role: "admin"
|
|
87264
|
+
},
|
|
87265
|
+
"powerSource.powerOff": {
|
|
87266
|
+
capName: "power-source",
|
|
87267
|
+
capScope: "device",
|
|
87268
|
+
addonId: null,
|
|
87269
|
+
access: "create",
|
|
87270
|
+
role: "admin"
|
|
87271
|
+
},
|
|
87272
|
+
"powerSource.powerOn": {
|
|
87273
|
+
capName: "power-source",
|
|
87274
|
+
capScope: "device",
|
|
87275
|
+
addonId: null,
|
|
87276
|
+
access: "create",
|
|
87277
|
+
role: "admin"
|
|
87278
|
+
},
|
|
86495
87279
|
"presence.getStatus": {
|
|
86496
87280
|
capName: "presence",
|
|
86497
87281
|
capScope: "device",
|
|
@@ -91640,6 +92424,26 @@ Object.freeze({
|
|
|
91640
92424
|
form: "single",
|
|
91641
92425
|
optional: false
|
|
91642
92426
|
}],
|
|
92427
|
+
"powerSource.forceRestart": [{
|
|
92428
|
+
name: "deviceId",
|
|
92429
|
+
form: "single",
|
|
92430
|
+
optional: false
|
|
92431
|
+
}],
|
|
92432
|
+
"powerSource.getStatus": [{
|
|
92433
|
+
name: "deviceId",
|
|
92434
|
+
form: "single",
|
|
92435
|
+
optional: false
|
|
92436
|
+
}],
|
|
92437
|
+
"powerSource.powerOff": [{
|
|
92438
|
+
name: "deviceId",
|
|
92439
|
+
form: "single",
|
|
92440
|
+
optional: false
|
|
92441
|
+
}],
|
|
92442
|
+
"powerSource.powerOn": [{
|
|
92443
|
+
name: "deviceId",
|
|
92444
|
+
form: "single",
|
|
92445
|
+
optional: false
|
|
92446
|
+
}],
|
|
91643
92447
|
"presence.getStatus": [{
|
|
91644
92448
|
name: "deviceId",
|
|
91645
92449
|
form: "single",
|
|
@@ -93949,6 +94753,88 @@ function bestLocationMatch(externalName, existing, threshold = .8) {
|
|
|
93949
94753
|
}
|
|
93950
94754
|
return best;
|
|
93951
94755
|
}
|
|
94756
|
+
/**
|
|
94757
|
+
* Closes the gap D49 leaves: an integration deleted while its provider was down never emits an
|
|
94758
|
+
* event the provider sees. An integration id absent from an ANSWERED list is only a suspect; its
|
|
94759
|
+
* devices go (through the provider's own removeDevices) when a SECOND answered read, at least
|
|
94760
|
+
* `minIntervalMs` later, still lacks it. A read that threw changes nothing; reappearing clears.
|
|
94761
|
+
*/
|
|
94762
|
+
var OrphanIntegrationSweep = class {
|
|
94763
|
+
#logger;
|
|
94764
|
+
#minIntervalMs;
|
|
94765
|
+
#now;
|
|
94766
|
+
#suspects = /* @__PURE__ */ new Map();
|
|
94767
|
+
constructor(options) {
|
|
94768
|
+
this.#logger = options.logger;
|
|
94769
|
+
this.#minIntervalMs = options.minIntervalMs ?? 6e4;
|
|
94770
|
+
this.#now = options.now ?? Date.now;
|
|
94771
|
+
}
|
|
94772
|
+
get minIntervalMs() {
|
|
94773
|
+
return this.#minIntervalMs;
|
|
94774
|
+
}
|
|
94775
|
+
async sweep(input) {
|
|
94776
|
+
if (input.listedIds === null) return {
|
|
94777
|
+
newSuspects: 0,
|
|
94778
|
+
removed: []
|
|
94779
|
+
};
|
|
94780
|
+
const listed = new Set(input.listedIds);
|
|
94781
|
+
const owners = new Set(input.ownerIds);
|
|
94782
|
+
const now = this.#now();
|
|
94783
|
+
let newSuspects = 0;
|
|
94784
|
+
const removed = [];
|
|
94785
|
+
for (const id of [...this.#suspects.keys()]) if (listed.has(id) || !owners.has(id)) {
|
|
94786
|
+
this.#suspects.delete(id);
|
|
94787
|
+
this.#logger.info("Orphan integration suspect cleared", { meta: {
|
|
94788
|
+
integrationId: id,
|
|
94789
|
+
reason: listed.has(id) ? "listed again" : "owns no devices"
|
|
94790
|
+
} });
|
|
94791
|
+
}
|
|
94792
|
+
for (const id of owners) {
|
|
94793
|
+
if (listed.has(id)) continue;
|
|
94794
|
+
const since = this.#suspects.get(id);
|
|
94795
|
+
if (since === void 0) {
|
|
94796
|
+
this.#suspects.set(id, now);
|
|
94797
|
+
newSuspects += 1;
|
|
94798
|
+
this.#logger.info("Integration owns devices but is absent from the list — suspect", { meta: {
|
|
94799
|
+
integrationId: id,
|
|
94800
|
+
minIntervalMs: this.#minIntervalMs
|
|
94801
|
+
} });
|
|
94802
|
+
continue;
|
|
94803
|
+
}
|
|
94804
|
+
if (now - since < this.#minIntervalMs) continue;
|
|
94805
|
+
try {
|
|
94806
|
+
const count = await input.removeDevices(id);
|
|
94807
|
+
this.#suspects.delete(id);
|
|
94808
|
+
removed.push(id);
|
|
94809
|
+
this.#logger.warn("Orphan integration devices removed — absent from two answered lists", { meta: {
|
|
94810
|
+
integrationId: id,
|
|
94811
|
+
removed: count,
|
|
94812
|
+
firstMissingAt: since
|
|
94813
|
+
} });
|
|
94814
|
+
} catch (err) {
|
|
94815
|
+
this.#logger.warn("Orphan integration device removal failed — kept as suspect", { meta: {
|
|
94816
|
+
integrationId: id,
|
|
94817
|
+
error: errMsg(err)
|
|
94818
|
+
} });
|
|
94819
|
+
}
|
|
94820
|
+
}
|
|
94821
|
+
return {
|
|
94822
|
+
newSuspects,
|
|
94823
|
+
removed
|
|
94824
|
+
};
|
|
94825
|
+
}
|
|
94826
|
+
};
|
|
94827
|
+
/** The integration ids that own top-level devices of one provider (a config that cannot be read is skipped). */
|
|
94828
|
+
async function collectOwnerIntegrationIds(input) {
|
|
94829
|
+
const ids = /* @__PURE__ */ new Set();
|
|
94830
|
+
for (const d of input.reg.getAllForAddon(input.addonId)) {
|
|
94831
|
+
if (d.parentDeviceId !== null) continue;
|
|
94832
|
+
const cfg = await input.devices.loadConfig(d.id).catch(() => ({}));
|
|
94833
|
+
const owner = input.ownerOf(cfg);
|
|
94834
|
+
if (owner !== null) ids.add(owner);
|
|
94835
|
+
}
|
|
94836
|
+
return [...ids];
|
|
94837
|
+
}
|
|
93952
94838
|
String.raw`(?<=^|["'(\s>,\[{])`;
|
|
93953
94839
|
var MB = 1024 * 1024;
|
|
93954
94840
|
1024 * MB, 3072 * MB;
|
|
@@ -93961,6 +94847,97 @@ object({
|
|
|
93961
94847
|
commands: record(string(), unknown())
|
|
93962
94848
|
});
|
|
93963
94849
|
//#endregion
|
|
94850
|
+
//#region src/homematic-reconciler.ts
|
|
94851
|
+
/**
|
|
94852
|
+
* Keeps one live client per enabled integration. Devices are removed ONLY on an explicit
|
|
94853
|
+
* lifecycle event naming the integration (D49): a list that failed, an empty list or an
|
|
94854
|
+
* unreadable connection changes nothing about devices and is logged, never read as "gone".
|
|
94855
|
+
*/
|
|
94856
|
+
var HomematicReconciler = class {
|
|
94857
|
+
#deps;
|
|
94858
|
+
#sweep;
|
|
94859
|
+
#rerun = null;
|
|
94860
|
+
constructor(deps) {
|
|
94861
|
+
this.#deps = deps;
|
|
94862
|
+
this.#sweep = new OrphanIntegrationSweep({
|
|
94863
|
+
logger: deps.logger,
|
|
94864
|
+
...deps.sweepOptions
|
|
94865
|
+
});
|
|
94866
|
+
}
|
|
94867
|
+
/** Upsert a client per usable enabled integration; drop the CLIENT (never devices) of one the list answered is gone. */
|
|
94868
|
+
async reconcile() {
|
|
94869
|
+
const { logger, clients } = this.#deps;
|
|
94870
|
+
let all;
|
|
94871
|
+
try {
|
|
94872
|
+
all = await this.#deps.listIntegrations();
|
|
94873
|
+
} catch (err) {
|
|
94874
|
+
logger.warn("Homematic integration reconcile skipped — the integration list did not answer", { meta: { error: errMsg(err) } });
|
|
94875
|
+
return;
|
|
94876
|
+
}
|
|
94877
|
+
const enabled = all.filter((i) => i.addonId === this.#deps.addonId && i.enabled);
|
|
94878
|
+
for (const integration of enabled) try {
|
|
94879
|
+
if (!await this.#deps.applySettings(integration)) logger.warn("Homematic integration has no usable connection — left as it is", { meta: { integrationId: integration.id } });
|
|
94880
|
+
} catch (err) {
|
|
94881
|
+
logger.warn("Homematic reconcile failed for integration — left as it is", { meta: {
|
|
94882
|
+
integrationId: integration.id,
|
|
94883
|
+
error: errMsg(err)
|
|
94884
|
+
} });
|
|
94885
|
+
}
|
|
94886
|
+
const enabledIds = new Set(enabled.map((i) => i.id));
|
|
94887
|
+
for (const id of clients.list()) if (!enabledIds.has(id)) await clients.remove(id);
|
|
94888
|
+
await this.#sweepOrphans(all.map((i) => i.id));
|
|
94889
|
+
}
|
|
94890
|
+
/** Stop the scheduled second read (addon stop). */
|
|
94891
|
+
dispose() {
|
|
94892
|
+
if (this.#rerun !== null) clearTimeout(this.#rerun);
|
|
94893
|
+
this.#rerun = null;
|
|
94894
|
+
}
|
|
94895
|
+
/**
|
|
94896
|
+
* An integration deleted while this addon was down emits nothing it sees: its id owns devices
|
|
94897
|
+
* yet is absent from the ANSWERED list. Removal needs a second answered read later, so one
|
|
94898
|
+
* re-run is scheduled when a suspect appears (bounded: one timer, no retry loop).
|
|
94899
|
+
*/
|
|
94900
|
+
async #sweepOrphans(listedIds) {
|
|
94901
|
+
const { ownerIntegrationIds, removeDevices, logger } = this.#deps;
|
|
94902
|
+
if (ownerIntegrationIds === void 0) return;
|
|
94903
|
+
try {
|
|
94904
|
+
const ownerIds = await ownerIntegrationIds();
|
|
94905
|
+
if ((await this.#sweep.sweep({
|
|
94906
|
+
ownerIds,
|
|
94907
|
+
listedIds,
|
|
94908
|
+
removeDevices
|
|
94909
|
+
})).newSuspects > 0 && this.#rerun === null) {
|
|
94910
|
+
this.#rerun = setTimeout(() => {
|
|
94911
|
+
this.#rerun = null;
|
|
94912
|
+
this.reconcile();
|
|
94913
|
+
}, this.#sweep.minIntervalMs + 1e3);
|
|
94914
|
+
this.#rerun.unref();
|
|
94915
|
+
}
|
|
94916
|
+
} catch (err) {
|
|
94917
|
+
logger.warn("Orphan integration sweep failed — devices left as they are", { meta: { error: errMsg(err) } });
|
|
94918
|
+
}
|
|
94919
|
+
}
|
|
94920
|
+
/** An explicit lifecycle event: only `deleted` / `disabled` of a named integration remove devices. */
|
|
94921
|
+
async onLifecycle(kind, integrationId) {
|
|
94922
|
+
await this.reconcile();
|
|
94923
|
+
if (kind === "enabled" || integrationId === null) return;
|
|
94924
|
+
try {
|
|
94925
|
+
const removed = await this.#deps.removeDevices(integrationId);
|
|
94926
|
+
this.#deps.logger.info("Homematic integration devices removed", { meta: {
|
|
94927
|
+
integrationId,
|
|
94928
|
+
kind,
|
|
94929
|
+
removed
|
|
94930
|
+
} });
|
|
94931
|
+
} catch (err) {
|
|
94932
|
+
this.#deps.logger.warn("Homematic integration device removal failed", { meta: {
|
|
94933
|
+
integrationId,
|
|
94934
|
+
kind,
|
|
94935
|
+
error: errMsg(err)
|
|
94936
|
+
} });
|
|
94937
|
+
}
|
|
94938
|
+
}
|
|
94939
|
+
};
|
|
94940
|
+
//#endregion
|
|
93964
94941
|
//#region src/ccu/ccu-facade.ts
|
|
93965
94942
|
function errorText(err) {
|
|
93966
94943
|
return err instanceof Error ? err.message : String(err);
|
|
@@ -121696,6 +122673,7 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
|
|
|
121696
122673
|
[DeviceType.Container]: HmContainerDevice
|
|
121697
122674
|
};
|
|
121698
122675
|
/** Live per-integration CCU sessions, or null before init / after shutdown. */
|
|
122676
|
+
integrationReconciler = null;
|
|
121699
122677
|
clients = null;
|
|
121700
122678
|
constructor() {
|
|
121701
122679
|
super({});
|
|
@@ -121785,6 +122763,8 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
|
|
|
121785
122763
|
this.ctx.logger.warn("Homematic: provider shutdown error", { meta: { error: errMsg(err) } });
|
|
121786
122764
|
}
|
|
121787
122765
|
this.clients = null;
|
|
122766
|
+
this.integrationReconciler?.dispose();
|
|
122767
|
+
this.integrationReconciler = null;
|
|
121788
122768
|
homematicFacades.clear();
|
|
121789
122769
|
await super.onShutdown();
|
|
121790
122770
|
}
|
|
@@ -121892,47 +122872,64 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
|
|
|
121892
122872
|
* devices. Idempotent; runs on boot and on every integration lifecycle event.
|
|
121893
122873
|
* Guarded: a failing read warns and returns, `onInitialize` must not fail.
|
|
121894
122874
|
*/
|
|
121895
|
-
|
|
121896
|
-
|
|
121897
|
-
|
|
121898
|
-
|
|
121899
|
-
|
|
121900
|
-
|
|
121901
|
-
|
|
121902
|
-
|
|
121903
|
-
this.ctx.logger.warn("Homematic reconcile: host missing or invalid, no session opened", { tags: { integrationId: integration.id } });
|
|
121904
|
-
continue;
|
|
122875
|
+
reconciler() {
|
|
122876
|
+
this.integrationReconciler ??= new HomematicReconciler({
|
|
122877
|
+
addonId: this.ctx.id,
|
|
122878
|
+
logger: this.ctx.logger,
|
|
122879
|
+
clients: {
|
|
122880
|
+
list: () => this.requireClients().list(),
|
|
122881
|
+
remove: async (id) => {
|
|
122882
|
+
await this.requireClients().remove(id);
|
|
121905
122883
|
}
|
|
121906
|
-
|
|
121907
|
-
|
|
121908
|
-
|
|
121909
|
-
this.ctx.
|
|
121910
|
-
|
|
121911
|
-
|
|
121912
|
-
|
|
121913
|
-
}
|
|
121914
|
-
|
|
121915
|
-
|
|
121916
|
-
|
|
121917
|
-
|
|
121918
|
-
|
|
121919
|
-
|
|
122884
|
+
},
|
|
122885
|
+
listIntegrations: () => this.ctx.api.integrations.list.query(),
|
|
122886
|
+
applySettings: async (integration) => {
|
|
122887
|
+
const connection = connectionFromSettings(await this.ctx.api.integrations.getSettings.query({ id: integration.id }));
|
|
122888
|
+
if (!connection) return false;
|
|
122889
|
+
await this.requireClients().upsert(integration.id, integration.name, connection);
|
|
122890
|
+
return true;
|
|
122891
|
+
},
|
|
122892
|
+
removeDevices: (integrationId) => this.cascadeRemoveDevicesForIntegration(integrationId),
|
|
122893
|
+
ownerIntegrationIds: () => this.ownerIntegrationIds()
|
|
122894
|
+
});
|
|
122895
|
+
return this.integrationReconciler;
|
|
122896
|
+
}
|
|
122897
|
+
/** Upsert one client per enabled integration; never removes a device (D49). */
|
|
122898
|
+
async reconcileIntegrations() {
|
|
122899
|
+
await this.reconciler().reconcile();
|
|
121920
122900
|
}
|
|
122901
|
+
/** Lifecycle events: only an explicit Deleted/Disabled naming an integration removes devices. */
|
|
121921
122902
|
subscribeIntegrationLifecycle() {
|
|
121922
|
-
const
|
|
122903
|
+
const on = (kind) => (event) => {
|
|
121923
122904
|
const addonId = event.data["addonId"];
|
|
121924
122905
|
if (typeof addonId === "string" && addonId !== this.ctx.id) return;
|
|
121925
|
-
|
|
122906
|
+
const integrationId = event.data["integrationId"];
|
|
122907
|
+
this.reconciler().onLifecycle(kind, typeof integrationId === "string" ? integrationId : null);
|
|
121926
122908
|
};
|
|
121927
|
-
this.ctx.eventBus.subscribe({ category: EventCategory.IntegrationEnabled },
|
|
121928
|
-
this.ctx.eventBus.subscribe({ category: EventCategory.IntegrationDisabled },
|
|
121929
|
-
this.ctx.eventBus.subscribe({ category: EventCategory.IntegrationDeleted },
|
|
122909
|
+
this.ctx.eventBus.subscribe({ category: EventCategory.IntegrationEnabled }, on("enabled"));
|
|
122910
|
+
this.ctx.eventBus.subscribe({ category: EventCategory.IntegrationDisabled }, on("disabled"));
|
|
122911
|
+
this.ctx.eventBus.subscribe({ category: EventCategory.IntegrationDeleted }, on("deleted"));
|
|
122912
|
+
}
|
|
122913
|
+
/** The integrations that own devices here, for the orphan sweep. */
|
|
122914
|
+
async ownerIntegrationIds() {
|
|
122915
|
+
const reg = this.ctx.kernel.deviceRegistry;
|
|
122916
|
+
const devices = this.ctx.kernel.devices;
|
|
122917
|
+
if (!reg || !devices) return [];
|
|
122918
|
+
return await collectOwnerIntegrationIds({
|
|
122919
|
+
reg,
|
|
122920
|
+
devices,
|
|
122921
|
+
addonId: this.addonId,
|
|
122922
|
+
ownerOf: (cfg) => {
|
|
122923
|
+
const owner = cfg["integrationId"];
|
|
122924
|
+
return cfg["system"] === "homematic" && typeof owner === "string" ? owner : null;
|
|
122925
|
+
}
|
|
122926
|
+
});
|
|
121930
122927
|
}
|
|
121931
122928
|
async cascadeRemoveDevicesForIntegration(integrationId) {
|
|
121932
122929
|
const reg = this.ctx.kernel.deviceRegistry;
|
|
121933
122930
|
const devices = this.ctx.kernel.devices;
|
|
121934
|
-
if (!reg || !devices) return;
|
|
121935
|
-
await cascadeRemoveDevicesForIntegration({
|
|
122931
|
+
if (!reg || !devices) return 0;
|
|
122932
|
+
return await cascadeRemoveDevicesForIntegration({
|
|
121936
122933
|
reg,
|
|
121937
122934
|
devices,
|
|
121938
122935
|
addonId: this.addonId,
|