@camstack/addon-provider-bosch 0.1.34 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/{account-integration-offline-R-1-uYH5.mjs → account-integration-offline-Bt3N9Zdk.mjs} +1 -1
- package/dist/{account-integration-offline-B7f80oHo.js → account-integration-offline-De_H_EsP.js} +1 -1
- package/dist/{dist-BV6iLwfA.mjs → dist-CkMPcvma.mjs} +1919 -1115
- package/dist/{dist-DOr0p9V1.js → dist-CyZFf49n.js} +1918 -1114
- package/dist/home-connect/addon.js +2 -2
- package/dist/home-connect/addon.mjs +2 -2
- package/dist/homecom/addon.js +2 -2
- package/dist/homecom/addon.mjs +2 -2
- package/dist/shc/addon.js +1 -1
- package/dist/shc/addon.mjs +1 -1
- package/package.json +5 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require("node:crypto");
|
|
2
|
-
//#region ../types/dist/event-category-
|
|
2
|
+
//#region ../types/dist/event-category-CaURIwQA.mjs
|
|
3
3
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
4
4
|
EventCategory["SystemBoot"] = "system.boot";
|
|
5
5
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -715,6 +715,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
715
715
|
EventCategory["NotificationRuleBroken"] = "notification.rule-broken";
|
|
716
716
|
/** The clear of {@link NotificationRuleBroken}: the rule loads and names nothing deleted. */
|
|
717
717
|
EventCategory["NotificationRuleRepaired"] = "notification.rule-repaired";
|
|
718
|
+
/** A migration failed or was blocked; the Alert Center re-reads the ledger. */
|
|
719
|
+
EventCategory["MigrationFailed"] = "migration.failed";
|
|
720
|
+
/** A migration applied or a failure cleared; the Alert Center re-reads the ledger. */
|
|
721
|
+
EventCategory["MigrationApplied"] = "migration.applied";
|
|
718
722
|
EventCategory["DeviceUpdated"] = "device.updated";
|
|
719
723
|
/**
|
|
720
724
|
* Transport-level connectivity. Emitted by the device driver when
|
|
@@ -777,6 +781,378 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
777
781
|
return EventCategory;
|
|
778
782
|
}({});
|
|
779
783
|
//#endregion
|
|
784
|
+
//#region ../types/dist/device-type-CEqjmUnR.mjs
|
|
785
|
+
/**
|
|
786
|
+
import { errMsg } from '@camstack/types'
|
|
787
|
+
* Extract a human-readable message from an unknown error value.
|
|
788
|
+
* Replaces the ubiquitous `errMsg(err)` pattern.
|
|
789
|
+
*/
|
|
790
|
+
function errMsg(err) {
|
|
791
|
+
if (err instanceof Error) return err.message;
|
|
792
|
+
if (typeof err === "string") return err;
|
|
793
|
+
return String(err);
|
|
794
|
+
}
|
|
795
|
+
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
796
|
+
DeviceType["Camera"] = "camera";
|
|
797
|
+
DeviceType["Hub"] = "hub";
|
|
798
|
+
DeviceType["Light"] = "light";
|
|
799
|
+
DeviceType["Siren"] = "siren";
|
|
800
|
+
DeviceType["Switch"] = "switch";
|
|
801
|
+
DeviceType["Sensor"] = "sensor";
|
|
802
|
+
DeviceType["Thermostat"] = "thermostat";
|
|
803
|
+
/** Air-conditioner / heat-pump climate device (HVAC) — shares the
|
|
804
|
+
* `climate-control` cap surface with `Thermostat` but renders a
|
|
805
|
+
* dedicated AC-appropriate control UI (mode chips, fan speed,
|
|
806
|
+
* independent vertical/horizontal swing). Sources: native Gree, and
|
|
807
|
+
* reusable by other AC integrations. */
|
|
808
|
+
DeviceType["Climate"] = "climate";
|
|
809
|
+
DeviceType["Button"] = "button";
|
|
810
|
+
/** Generic stateless event emitter — carries a device's EXACT declared
|
|
811
|
+
* event vocabulary verbatim (no normalization). Installed with the
|
|
812
|
+
* `event-emitter` cap. Sources: HA `event.*` entities (structured) and
|
|
813
|
+
* HA bus events (e.g. `zha_event`, generic). */
|
|
814
|
+
DeviceType["EventEmitter"] = "event-emitter";
|
|
815
|
+
/** Firmware/software update entity — current vs available version,
|
|
816
|
+
* updatable flag, update state, and an install action. Installed with
|
|
817
|
+
* the `update` cap. Sources: Homematic firmware-update channels (and
|
|
818
|
+
* reusable by other providers, e.g. HA `update.*` entities). */
|
|
819
|
+
DeviceType["Update"] = "update";
|
|
820
|
+
DeviceType["Generic"] = "generic";
|
|
821
|
+
/** Generic notification delivery target (HA `notify.<service>`, future
|
|
822
|
+
* Telegram / Discord / ntfy / SMTP, …). One device per delivery
|
|
823
|
+
* endpoint; the `notifier` cap defines the send surface. */
|
|
824
|
+
DeviceType["Notifier"] = "notifier";
|
|
825
|
+
/** Pre-recorded action sequence with optional parameters
|
|
826
|
+
* (HA `script.*`). Runnable via `script-runner` cap. */
|
|
827
|
+
DeviceType["Script"] = "script";
|
|
828
|
+
/** Automation rule (HA `automation.*`) — enable/disable + manual
|
|
829
|
+
* trigger surface exposed via `automation-control` cap. */
|
|
830
|
+
DeviceType["Automation"] = "automation";
|
|
831
|
+
/** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
|
|
832
|
+
DeviceType["Lock"] = "lock";
|
|
833
|
+
/** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
|
|
834
|
+
* `valve.*`). `cover` cap with sub-roles for variant. */
|
|
835
|
+
DeviceType["Cover"] = "cover";
|
|
836
|
+
/** Pipe / water / gas valve with open/close/stop and optional
|
|
837
|
+
* position (HA `valve.*`). `valve` cap — a cover-sibling actuator
|
|
838
|
+
* modelled on the same open/closed lifecycle. */
|
|
839
|
+
DeviceType["Valve"] = "valve";
|
|
840
|
+
/** Humidifier / dehumidifier with on/off + target humidity + mode
|
|
841
|
+
* (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
|
|
842
|
+
* modelled on the same target / mode lifecycle. */
|
|
843
|
+
DeviceType["Humidifier"] = "humidifier";
|
|
844
|
+
/** Water heater / boiler with target temperature + operation mode +
|
|
845
|
+
* away mode (HA `water_heater.*`). `water-heater` cap — a
|
|
846
|
+
* climate-family actuator. */
|
|
847
|
+
DeviceType["WaterHeater"] = "water-heater";
|
|
848
|
+
/** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
|
|
849
|
+
DeviceType["Fan"] = "fan";
|
|
850
|
+
/** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
|
|
851
|
+
* the camera surface — those use `Camera`. `media-player` cap. */
|
|
852
|
+
DeviceType["MediaPlayer"] = "media-player";
|
|
853
|
+
/** Security panel / alarm system (HA `alarm_control_panel.*`).
|
|
854
|
+
* `alarm-panel` cap. */
|
|
855
|
+
DeviceType["AlarmPanel"] = "alarm-panel";
|
|
856
|
+
/** Generic user-settable input (HA `number` / `input_number` / `select`
|
|
857
|
+
* / `input_select` / `text` / `input_text` / `input_datetime`).
|
|
858
|
+
* Sub-type via `DeviceRole`: NumericControl / SelectControl /
|
|
859
|
+
* TextControl / DateTimeControl. */
|
|
860
|
+
DeviceType["Control"] = "control";
|
|
861
|
+
/** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
|
|
862
|
+
* `presence` cap. */
|
|
863
|
+
DeviceType["Presence"] = "presence";
|
|
864
|
+
/** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
|
|
865
|
+
* `weather` cap. */
|
|
866
|
+
DeviceType["Weather"] = "weather";
|
|
867
|
+
/** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
|
|
868
|
+
DeviceType["Vacuum"] = "vacuum";
|
|
869
|
+
/** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
|
|
870
|
+
* `lawn-mower-control` cap. */
|
|
871
|
+
DeviceType["LawnMower"] = "lawn-mower";
|
|
872
|
+
/** Physical HA device group — parent container for entity-children
|
|
873
|
+
* adopted from a single HA device entry. Not renderable as a
|
|
874
|
+
* standalone device; exists only to anchor child entities. */
|
|
875
|
+
DeviceType["Container"] = "container";
|
|
876
|
+
/** Single still-image entity (HA `image.*`). Read-only display of an
|
|
877
|
+
* `entity_picture` signed URL the browser loads directly. `image` cap. */
|
|
878
|
+
DeviceType["Image"] = "image";
|
|
879
|
+
/** Smart pet feeder — cloud-connected food dispenser with a bowl food
|
|
880
|
+
* level, battery, desiccant life, feeding state and manual-feed /
|
|
881
|
+
* call-pet / maintenance actions. Installed with the `pet-feeder` cap;
|
|
882
|
+
* dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
|
|
883
|
+
* native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
|
|
884
|
+
* integrations sharing the same food/desiccant/hopper surface. */
|
|
885
|
+
DeviceType["PetFeeder"] = "pet-feeder";
|
|
886
|
+
/** Pet water fountain — tank level, water drunk, pump and its duty cycle.
|
|
887
|
+
* Installed with the `pet-fountain` cap. Reaches CamStack as loose entities
|
|
888
|
+
* of a container and is BUILT as a composed device (D967). */
|
|
889
|
+
DeviceType["PetFountain"] = "pet-fountain";
|
|
890
|
+
/** Built-in dishwasher — program lifecycle, door / remote-start gates,
|
|
891
|
+
* salt and rinse-aid levels. Installed with the `dishwasher` cap.
|
|
892
|
+
* Sources: native Bosch Home Connect, reusable by similar integrations.
|
|
893
|
+
* A plug-built dishwasher carries running-state and power instead. */
|
|
894
|
+
DeviceType["Dishwasher"] = "dishwasher";
|
|
895
|
+
/** Washing machine. A plug-built one is running while its power stays
|
|
896
|
+
* above a threshold. No program cap — that surface is the dishwasher's. */
|
|
897
|
+
DeviceType["Washer"] = "washer";
|
|
898
|
+
/** Tumble dryer. Same plug-built running surface as {@link Washer}. */
|
|
899
|
+
DeviceType["Dryer"] = "dryer";
|
|
900
|
+
/** The physical bridge box of a vendor ecosystem (Velux KLF-200, and later
|
|
901
|
+
* other radio-to-IP bridges). It carries the box's own facts (firmware,
|
|
902
|
+
* address, connection state) and the actions the box really supports
|
|
903
|
+
* (`reboot`, `device-admin-link`). Products are NOT its children — they are
|
|
904
|
+
* adopted beside it — and its connection settings stay on the integration. */
|
|
905
|
+
DeviceType["Gateway"] = "gateway";
|
|
906
|
+
return DeviceType;
|
|
907
|
+
}({});
|
|
908
|
+
var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
909
|
+
DeviceFeature["BatteryOperated"] = "battery-operated";
|
|
910
|
+
DeviceFeature["Rebootable"] = "rebootable";
|
|
911
|
+
/**
|
|
912
|
+
* Device supports an on-demand re-sync of its derived spec with its
|
|
913
|
+
* upstream source — drives the generic Re-sync button. The owning
|
|
914
|
+
* provider implements the action via the `device-adoption.resync` cap.
|
|
915
|
+
*/
|
|
916
|
+
DeviceFeature["Resyncable"] = "resyncable";
|
|
917
|
+
DeviceFeature["NativeSnapshot"] = "native-snapshot";
|
|
918
|
+
DeviceFeature["DoorbellButton"] = "doorbell-button";
|
|
919
|
+
DeviceFeature["TwoWayAudio"] = "two-way-audio";
|
|
920
|
+
DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
|
|
921
|
+
/**
|
|
922
|
+
* Camera supports the on-firmware autotrack subsystem (subject-
|
|
923
|
+
* following). Distinct from `PanTiltZoom` because not every PTZ
|
|
924
|
+
* camera ships autotrack — the admin UI uses this flag to gate
|
|
925
|
+
* the autotrack toggle / settings card without re-deriving from
|
|
926
|
+
* the cap registry. Mirrors `ptz-autotrack` cap registration:
|
|
927
|
+
* driver sets this feature when probe confirms the firmware
|
|
928
|
+
* surface, and registers the cap in the same code path.
|
|
929
|
+
*/
|
|
930
|
+
DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
|
|
931
|
+
/**
|
|
932
|
+
* Accessory exposes a "trigger on motion" toggle — the parent camera's
|
|
933
|
+
* motion detection automatically activates this device. Mirrors
|
|
934
|
+
* `motion-trigger` cap registration: drivers set this feature in the
|
|
935
|
+
* same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
|
|
936
|
+
*
|
|
937
|
+
* Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
|
|
938
|
+
* fast scalar without binding fetch), notifier rules, and `listAll`
|
|
939
|
+
* filters that want "all devices with on-motion behaviour".
|
|
940
|
+
*/
|
|
941
|
+
DeviceFeature["MotionTrigger"] = "motion-trigger";
|
|
942
|
+
/** Light supports rgb-triplet color via `color` cap. */
|
|
943
|
+
DeviceFeature["LightColorRgb"] = "light-color-rgb";
|
|
944
|
+
/** Light supports HSV color via `color` cap. */
|
|
945
|
+
DeviceFeature["LightColorHsv"] = "light-color-hsv";
|
|
946
|
+
/** Light supports color-temperature (mired) via `color` cap. */
|
|
947
|
+
DeviceFeature["LightColorMired"] = "light-color-mired";
|
|
948
|
+
/** Thermostat supports a `heat_cool` dual setpoint (targetLow +
|
|
949
|
+
* targetHigh). Gates the range slider UI. */
|
|
950
|
+
DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
|
|
951
|
+
/** Thermostat exposes target humidity and/or current humidity
|
|
952
|
+
* readings. Gates the humidity controls. */
|
|
953
|
+
DeviceFeature["ClimateHumidity"] = "climate-humidity";
|
|
954
|
+
/** Thermostat exposes a fan-mode selector. */
|
|
955
|
+
DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
|
|
956
|
+
/** Thermostat exposes preset modes (eco / away / sleep / vendor). */
|
|
957
|
+
DeviceFeature["ClimatePreset"] = "climate-preset";
|
|
958
|
+
/** Thermostat exposes a vertical louver swing toggle. Gates the
|
|
959
|
+
* vertical-swing switch in the climate UI. Independent of horizontal. */
|
|
960
|
+
DeviceFeature["ClimateSwingVertical"] = "climate-swing-vertical";
|
|
961
|
+
/** Thermostat exposes a horizontal louver swing toggle. Gates the
|
|
962
|
+
* horizontal-swing switch in the climate UI. Independent of vertical. */
|
|
963
|
+
DeviceFeature["ClimateSwingHorizontal"] = "climate-swing-horizontal";
|
|
964
|
+
/** Cover exposes intermediate position control (0..100). Gates the
|
|
965
|
+
* position slider UI. */
|
|
966
|
+
DeviceFeature["CoverPositionable"] = "cover-positionable";
|
|
967
|
+
/** Cover exposes slat-tilt control. Gates the tilt slider UI. */
|
|
968
|
+
DeviceFeature["CoverTilt"] = "cover-tilt";
|
|
969
|
+
/** Valve exposes intermediate position control (0..100). Gates the
|
|
970
|
+
* position slider / drag surface UI. */
|
|
971
|
+
DeviceFeature["ValvePositionable"] = "valve-positionable";
|
|
972
|
+
/** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
|
|
973
|
+
DeviceFeature["FanSpeed"] = "fan-speed";
|
|
974
|
+
/** Fan exposes a preset mode selector. */
|
|
975
|
+
DeviceFeature["FanPreset"] = "fan-preset";
|
|
976
|
+
/** Fan exposes blade direction (forward/reverse) — typical of
|
|
977
|
+
* ceiling fans. */
|
|
978
|
+
DeviceFeature["FanDirection"] = "fan-direction";
|
|
979
|
+
/** Fan exposes an oscillation toggle. */
|
|
980
|
+
DeviceFeature["FanOscillating"] = "fan-oscillating";
|
|
981
|
+
/** Lock requires a PIN code on lock/unlock. Gates the code-entry
|
|
982
|
+
* field on the UI lock-controls panel. */
|
|
983
|
+
DeviceFeature["LockPinRequired"] = "lock-pin-required";
|
|
984
|
+
/** Lock supports a latch-release ("open door") action distinct from
|
|
985
|
+
* unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
|
|
986
|
+
* `supported_features`. Gates the Open Door button in the UI. */
|
|
987
|
+
DeviceFeature["LockOpen"] = "lock-open";
|
|
988
|
+
/** Media player exposes a seek-to-position surface. */
|
|
989
|
+
DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
|
|
990
|
+
/** Media player exposes a volume-level setter. */
|
|
991
|
+
DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
|
|
992
|
+
/** Media player exposes a mute toggle distinct from volume=0. */
|
|
993
|
+
DeviceFeature["MediaPlayerMute"] = "media-player-mute";
|
|
994
|
+
/** Media player exposes a shuffle toggle. */
|
|
995
|
+
DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
|
|
996
|
+
/** Media player exposes a repeat mode (off / all / one). */
|
|
997
|
+
DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
|
|
998
|
+
/** Media player exposes a source / input selector. */
|
|
999
|
+
DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
|
|
1000
|
+
/** Media player exposes a play-arbitrary-media surface (URL / id). */
|
|
1001
|
+
DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
|
|
1002
|
+
/** Media player exposes next-track. */
|
|
1003
|
+
DeviceFeature["MediaPlayerNext"] = "media-player-next";
|
|
1004
|
+
/** Media player exposes previous-track. */
|
|
1005
|
+
DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
|
|
1006
|
+
/** Media player exposes stop distinct from pause. */
|
|
1007
|
+
DeviceFeature["MediaPlayerStop"] = "media-player-stop";
|
|
1008
|
+
/** Alarm panel requires a PIN code on arm/disarm. */
|
|
1009
|
+
DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
|
|
1010
|
+
/** Presence device carries GPS coordinates (lat/lng/accuracy) in
|
|
1011
|
+
* addition to a textual location. */
|
|
1012
|
+
DeviceFeature["PresenceGps"] = "presence-gps";
|
|
1013
|
+
/** Notifier accepts an inline / URL image attachment. */
|
|
1014
|
+
DeviceFeature["NotifierImage"] = "notifier-image";
|
|
1015
|
+
/** Notifier accepts a priority hint (high/normal/low). */
|
|
1016
|
+
DeviceFeature["NotifierPriority"] = "notifier-priority";
|
|
1017
|
+
/** Notifier accepts a free-form `data` payload for platform-specific
|
|
1018
|
+
* fields. */
|
|
1019
|
+
DeviceFeature["NotifierData"] = "notifier-data";
|
|
1020
|
+
/** Notifier supports interactive action buttons / callbacks. */
|
|
1021
|
+
DeviceFeature["NotifierActions"] = "notifier-actions";
|
|
1022
|
+
/** Notifier supports per-call recipient targeting (multi-user). */
|
|
1023
|
+
DeviceFeature["NotifierRecipients"] = "notifier-recipients";
|
|
1024
|
+
/** Script runner accepts a variables map on each run invocation. */
|
|
1025
|
+
DeviceFeature["ScriptVariables"] = "script-variables";
|
|
1026
|
+
/** Automation `trigger` accepts a skipCondition flag — fires the
|
|
1027
|
+
* automation's actions while bypassing its condition block. */
|
|
1028
|
+
DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
|
|
1029
|
+
/** Robot vacuum exposes a live cleaning map (image child). Gates the
|
|
1030
|
+
* map tile in the vacuum UI. */
|
|
1031
|
+
DeviceFeature["VacuumHasMap"] = "vacuum-has-map";
|
|
1032
|
+
/** Robot vacuum exposes AI obstacle-detection toggles. Gates the AI
|
|
1033
|
+
* switches group. */
|
|
1034
|
+
DeviceFeature["VacuumHasAi"] = "vacuum-has-ai";
|
|
1035
|
+
/** Robot mower exposes a live mowing map (SVG image child). Gates the
|
|
1036
|
+
* mower map tile. */
|
|
1037
|
+
DeviceFeature["MowerHasMap"] = "mower-has-map";
|
|
1038
|
+
/** Robot mower exposes targeted mowing (all-area / zones / edges /
|
|
1039
|
+
* spots) — gates the Mow action + map selectors. */
|
|
1040
|
+
DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
|
|
1041
|
+
return DeviceFeature;
|
|
1042
|
+
}({});
|
|
1043
|
+
/**
|
|
1044
|
+
* Semantic role a device plays within its parent. Populated by driver
|
|
1045
|
+
* addons when creating accessory devices (Reolink siren/floodlight/
|
|
1046
|
+
* PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
|
|
1047
|
+
* admin UI to pick icons, labels, and widgets — a `Switch` with
|
|
1048
|
+
* `role: Floodlight` renders as a bulb with a brightness slider,
|
|
1049
|
+
* whereas a `Switch` with `role: Siren` renders as a klaxon.
|
|
1050
|
+
*
|
|
1051
|
+
* Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
|
|
1052
|
+
* sqlite as a nullable TEXT column — old rows keep working unchanged.
|
|
1053
|
+
*/
|
|
1054
|
+
var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
1055
|
+
DeviceRole["Siren"] = "siren";
|
|
1056
|
+
DeviceRole["Floodlight"] = "floodlight";
|
|
1057
|
+
DeviceRole["Spotlight"] = "spotlight";
|
|
1058
|
+
DeviceRole["PirSensor"] = "pir-sensor";
|
|
1059
|
+
DeviceRole["Chime"] = "chime";
|
|
1060
|
+
DeviceRole["Autotrack"] = "autotrack";
|
|
1061
|
+
DeviceRole["Nightvision"] = "nightvision";
|
|
1062
|
+
DeviceRole["PrivacyMask"] = "privacy-mask";
|
|
1063
|
+
DeviceRole["Doorbell"] = "doorbell";
|
|
1064
|
+
/** Interior blind / shade / roller blind. HA `device_class: blind|shade`. */
|
|
1065
|
+
DeviceRole["CoverBlind"] = "cover-blind";
|
|
1066
|
+
/** Exterior roller shutter. HA `device_class: shutter`; Homematic BROLL. */
|
|
1067
|
+
DeviceRole["CoverShutter"] = "cover-shutter";
|
|
1068
|
+
/** Exterior awning. HA `device_class: awning`. */
|
|
1069
|
+
DeviceRole["CoverAwning"] = "cover-awning";
|
|
1070
|
+
/** Curtain / drape. HA `device_class: curtain`. */
|
|
1071
|
+
DeviceRole["CoverCurtain"] = "cover-curtain";
|
|
1072
|
+
/** Garage door. HA `device_class: garage`. A security actuator: exports gate it. */
|
|
1073
|
+
DeviceRole["CoverGarage"] = "cover-garage";
|
|
1074
|
+
/** Gate. HA `device_class: gate`. A security actuator: exports gate it. */
|
|
1075
|
+
DeviceRole["CoverGate"] = "cover-gate";
|
|
1076
|
+
/** Door. HA `device_class: door`. A security actuator: exports gate it. */
|
|
1077
|
+
DeviceRole["CoverDoor"] = "cover-door";
|
|
1078
|
+
/** Window. HA `device_class: window`. */
|
|
1079
|
+
DeviceRole["CoverWindow"] = "cover-window";
|
|
1080
|
+
/** Virtual HA toggle (input_boolean.*) — distinguishable from a
|
|
1081
|
+
* real Switch device for UI rendering / export adapters. */
|
|
1082
|
+
DeviceRole["BinaryHelper"] = "binary-helper";
|
|
1083
|
+
/** A smart plug: a `switch` whose source says it is an outlet (HA
|
|
1084
|
+
* `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
|
|
1085
|
+
DeviceRole["Outlet"] = "outlet";
|
|
1086
|
+
/** Generic motion / occupancy / moving event source. Distinct from
|
|
1087
|
+
* the camera accessory PirSensor role: that one is a camera child;
|
|
1088
|
+
* this is a standalone HA / 3rd-party motion sensor. */
|
|
1089
|
+
DeviceRole["MotionSensor"] = "motion-sensor";
|
|
1090
|
+
DeviceRole["ContactSensor"] = "contact-sensor";
|
|
1091
|
+
DeviceRole["LeakSensor"] = "leak-sensor";
|
|
1092
|
+
DeviceRole["SmokeSensor"] = "smoke-sensor";
|
|
1093
|
+
DeviceRole["COSensor"] = "co-sensor";
|
|
1094
|
+
DeviceRole["GasSensor"] = "gas-sensor";
|
|
1095
|
+
DeviceRole["TamperSensor"] = "tamper-sensor";
|
|
1096
|
+
DeviceRole["VibrationSensor"] = "vibration-sensor";
|
|
1097
|
+
DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
|
|
1098
|
+
DeviceRole["SoundSensor"] = "sound-sensor";
|
|
1099
|
+
/** Fallback for `binary_sensor` without a known `device_class`. */
|
|
1100
|
+
DeviceRole["BinarySensor"] = "binary-sensor";
|
|
1101
|
+
DeviceRole["TemperatureSensor"] = "temperature-sensor";
|
|
1102
|
+
DeviceRole["HumiditySensor"] = "humidity-sensor";
|
|
1103
|
+
DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
|
|
1104
|
+
DeviceRole["PressureSensor"] = "pressure-sensor";
|
|
1105
|
+
/** Wind speed or direction (weather-station `wind-sensor` cap). */
|
|
1106
|
+
DeviceRole["WindSensor"] = "wind-sensor";
|
|
1107
|
+
/** Rain accumulation or rate (weather-station `rain-sensor` cap). */
|
|
1108
|
+
DeviceRole["RainSensor"] = "rain-sensor";
|
|
1109
|
+
/** UV index (weather-station `uv-sensor` cap). */
|
|
1110
|
+
DeviceRole["UvSensor"] = "uv-sensor";
|
|
1111
|
+
/** Solar irradiance W/m² (weather-station `solar-radiation-sensor` cap).
|
|
1112
|
+
* Distinct from AmbientLightSensor (lux). */
|
|
1113
|
+
DeviceRole["SolarRadiationSensor"] = "solar-radiation-sensor";
|
|
1114
|
+
/** Soil moisture % (garden/weather `soil-moisture-sensor` cap). */
|
|
1115
|
+
DeviceRole["SoilMoistureSensor"] = "soil-moisture-sensor";
|
|
1116
|
+
DeviceRole["PowerSensor"] = "power-sensor";
|
|
1117
|
+
DeviceRole["EnergySensor"] = "energy-sensor";
|
|
1118
|
+
DeviceRole["VoltageSensor"] = "voltage-sensor";
|
|
1119
|
+
DeviceRole["CurrentSensor"] = "current-sensor";
|
|
1120
|
+
DeviceRole["AirQualitySensor"] = "air-quality-sensor";
|
|
1121
|
+
/** Battery level (numeric % via `sensor` OR low-bool via
|
|
1122
|
+
* `binary_sensor` — the cap distinguishes via the value type). */
|
|
1123
|
+
DeviceRole["BatterySensor"] = "battery-sensor";
|
|
1124
|
+
/** Fallback for `sensor` numeric without a known `device_class`. */
|
|
1125
|
+
DeviceRole["NumericSensor"] = "numeric-sensor";
|
|
1126
|
+
/** String / enum state (HA `sensor` with `state_class: enum` or
|
|
1127
|
+
* `attributes.options`). */
|
|
1128
|
+
DeviceRole["EnumSensor"] = "enum-sensor";
|
|
1129
|
+
/** Date / timestamp state (HA `sensor` with `device_class: timestamp`
|
|
1130
|
+
* or `date`). The slice carries the raw ISO string verbatim (hosted on
|
|
1131
|
+
* the `enum-sensor` cap); the UI renders it locale-formatted. */
|
|
1132
|
+
DeviceRole["DateTimeSensor"] = "datetime-sensor";
|
|
1133
|
+
/** Last-resort fallback when nothing else matches. */
|
|
1134
|
+
DeviceRole["GenericSensor"] = "generic-sensor";
|
|
1135
|
+
DeviceRole["NumericControl"] = "numeric-control";
|
|
1136
|
+
DeviceRole["SelectControl"] = "select-control";
|
|
1137
|
+
DeviceRole["TextControl"] = "text-control";
|
|
1138
|
+
DeviceRole["DateTimeControl"] = "datetime-control";
|
|
1139
|
+
/** Mobile push notifier (HA `notify.mobile_app_*`) — supports
|
|
1140
|
+
* rich features (image, priority, channel routing). */
|
|
1141
|
+
DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
|
|
1142
|
+
/** Chat / messaging service (HA `notify.telegram_*`,
|
|
1143
|
+
* `notify.discord_*`, etc.). */
|
|
1144
|
+
DeviceRole["MessagingNotifier"] = "messaging-notifier";
|
|
1145
|
+
/** Email-based delivery (HA `notify.smtp`, etc.). */
|
|
1146
|
+
DeviceRole["EmailNotifier"] = "email-notifier";
|
|
1147
|
+
/** Fallback when the notifier service name doesn't match a known
|
|
1148
|
+
* pattern. */
|
|
1149
|
+
DeviceRole["GenericNotifier"] = "generic-notifier";
|
|
1150
|
+
/** Emits a pulse train (infrared or RF) on request — the `ir-transmitter`
|
|
1151
|
+
* cap. A `DeviceType.Generic` device. */
|
|
1152
|
+
DeviceRole["IrTransmitter"] = "ir-transmitter";
|
|
1153
|
+
return DeviceRole;
|
|
1154
|
+
}({});
|
|
1155
|
+
//#endregion
|
|
780
1156
|
//#region ../../node_modules/zod/v4/core/core.js
|
|
781
1157
|
var _a$1;
|
|
782
1158
|
function $constructor(name, initializer, params) {
|
|
@@ -5455,7 +5831,7 @@ var ZodIssueCode = {
|
|
|
5455
5831
|
var ZodFirstPartyTypeKind;
|
|
5456
5832
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5457
5833
|
//#endregion
|
|
5458
|
-
//#region ../types/dist/sleep-
|
|
5834
|
+
//#region ../types/dist/sleep-CSYuxssh.mjs
|
|
5459
5835
|
/**
|
|
5460
5836
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5461
5837
|
* window to float samples (D455).
|
|
@@ -5975,6 +6351,102 @@ function emitReadiness(bus, params) {
|
|
|
5975
6351
|
ts
|
|
5976
6352
|
}));
|
|
5977
6353
|
}
|
|
6354
|
+
var NOT_RUN = {
|
|
6355
|
+
declared: false,
|
|
6356
|
+
snapshot: null,
|
|
6357
|
+
applied: [],
|
|
6358
|
+
failed: [],
|
|
6359
|
+
blocked: [],
|
|
6360
|
+
skipped: [],
|
|
6361
|
+
blockOwner: []
|
|
6362
|
+
};
|
|
6363
|
+
/**
|
|
6364
|
+
* Offer `migrations` to the engine and run what it says to run, in its order. Never
|
|
6365
|
+
* throws: an unreachable or refusing engine is logged and reported `declared: false`,
|
|
6366
|
+
* because the hub (and this addon's boot) must not hang on a migration.
|
|
6367
|
+
*/
|
|
6368
|
+
async function runAddonMigrations(host, migrations, logger) {
|
|
6369
|
+
const first = migrations[0];
|
|
6370
|
+
if (first === void 0) return NOT_RUN;
|
|
6371
|
+
const owner = first.meta.owner;
|
|
6372
|
+
const log = logger.withTags({ migrationOwner: owner });
|
|
6373
|
+
const byId = new Map(migrations.map((m) => [m.meta.id, m]));
|
|
6374
|
+
let declaration;
|
|
6375
|
+
try {
|
|
6376
|
+
declaration = await host.declareOwner({
|
|
6377
|
+
owner,
|
|
6378
|
+
metas: migrations.map((m) => m.meta)
|
|
6379
|
+
});
|
|
6380
|
+
} catch (err) {
|
|
6381
|
+
log.error("the migration engine refused or could not take this addon catalogue — none ran", { meta: { error: errMsg(err) } });
|
|
6382
|
+
return {
|
|
6383
|
+
...NOT_RUN,
|
|
6384
|
+
blockOwner: migrations.filter((m) => m.meta.onFailure === "block-owner").map((m) => m.meta.id)
|
|
6385
|
+
};
|
|
6386
|
+
}
|
|
6387
|
+
const applied = [];
|
|
6388
|
+
const failed = [];
|
|
6389
|
+
const blocked = [];
|
|
6390
|
+
const skipped = [];
|
|
6391
|
+
const settle = (id, status) => {
|
|
6392
|
+
if (status === "applied") applied.push(id);
|
|
6393
|
+
else if (status === "failed") failed.push(id);
|
|
6394
|
+
else if (status === "blocked") blocked.push(id);
|
|
6395
|
+
else skipped.push(id);
|
|
6396
|
+
};
|
|
6397
|
+
for (const step of declaration.steps) {
|
|
6398
|
+
const bound = byId.get(step.id);
|
|
6399
|
+
if (bound === void 0 || step.action === "skip") {
|
|
6400
|
+
skipped.push(step.id);
|
|
6401
|
+
continue;
|
|
6402
|
+
}
|
|
6403
|
+
const tags = { migrationId: step.id };
|
|
6404
|
+
try {
|
|
6405
|
+
const gate = await host.startMigration({ id: step.id });
|
|
6406
|
+
if (!gate.proceed) {
|
|
6407
|
+
log.warn("migration not run", {
|
|
6408
|
+
tags,
|
|
6409
|
+
meta: {
|
|
6410
|
+
state: gate.state,
|
|
6411
|
+
reason: gate.reason
|
|
6412
|
+
}
|
|
6413
|
+
});
|
|
6414
|
+
settle(step.id, gate.state === "pending" ? "blocked" : gate.state);
|
|
6415
|
+
continue;
|
|
6416
|
+
}
|
|
6417
|
+
const result = await bound.execute();
|
|
6418
|
+
const outcome = await host.finishMigration({
|
|
6419
|
+
id: step.id,
|
|
6420
|
+
result
|
|
6421
|
+
});
|
|
6422
|
+
if (outcome.status === "applied") log.info("migration applied", {
|
|
6423
|
+
tags,
|
|
6424
|
+
meta: { rowsChanged: outcome.rowsChanged }
|
|
6425
|
+
});
|
|
6426
|
+
else log.error("migration failed", {
|
|
6427
|
+
tags,
|
|
6428
|
+
meta: { error: outcome.error }
|
|
6429
|
+
});
|
|
6430
|
+
settle(step.id, outcome.status);
|
|
6431
|
+
} catch (err) {
|
|
6432
|
+
log.error("migration could not be completed with the engine", {
|
|
6433
|
+
tags,
|
|
6434
|
+
meta: { error: errMsg(err) }
|
|
6435
|
+
});
|
|
6436
|
+
failed.push(step.id);
|
|
6437
|
+
}
|
|
6438
|
+
}
|
|
6439
|
+
const blockOwner = [...failed, ...blocked].filter((id) => byId.get(id)?.meta.onFailure === "block-owner");
|
|
6440
|
+
return {
|
|
6441
|
+
declared: true,
|
|
6442
|
+
snapshot: declaration.snapshot,
|
|
6443
|
+
applied,
|
|
6444
|
+
failed,
|
|
6445
|
+
blocked,
|
|
6446
|
+
skipped,
|
|
6447
|
+
blockOwner
|
|
6448
|
+
};
|
|
6449
|
+
}
|
|
5978
6450
|
/**
|
|
5979
6451
|
* Build a {@link DurableState} over a single store key. Transport-agnostic:
|
|
5980
6452
|
* `read`/`write` are the addon-store or device-store accessors. The whole
|
|
@@ -7030,6 +7502,28 @@ var BaseAddon = class {
|
|
|
7030
7502
|
return normalized;
|
|
7031
7503
|
}
|
|
7032
7504
|
/**
|
|
7505
|
+
* Run this addon's migration catalogue (D987 M3) through the hub's `migrations`
|
|
7506
|
+
* engine. Call it at the point of the boot where the data must already have the new
|
|
7507
|
+
* shape — `onInitialize`, or `onRestoreDevices` for a migration that needs the
|
|
7508
|
+
* restored devices — with the catalogue bound to the addon's ports
|
|
7509
|
+
* (`defineAddonMigrations(ADDON_MIGRATIONS, ports)`).
|
|
7510
|
+
*
|
|
7511
|
+
* An engine that cannot be reached or refuses the catalogue is logged and runs
|
|
7512
|
+
* nothing; the boot continues. A migration that FAILED (or was blocked by one)
|
|
7513
|
+
* and declares `onFailure: 'block-owner'` makes this throw, so the addon does not
|
|
7514
|
+
* serve data whose shape it cannot trust; `tolerate` migrations never do.
|
|
7515
|
+
*/
|
|
7516
|
+
async runMigrations(migrations) {
|
|
7517
|
+
const api = this.ctx.api.migrations;
|
|
7518
|
+
const report = await runAddonMigrations({
|
|
7519
|
+
declareOwner: (input) => api.declareOwner.mutate(input),
|
|
7520
|
+
startMigration: (input) => api.startMigration.mutate(input),
|
|
7521
|
+
finishMigration: (input) => api.finishMigration.mutate(input)
|
|
7522
|
+
}, migrations, this.ctx.logger);
|
|
7523
|
+
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`);
|
|
7524
|
+
return report;
|
|
7525
|
+
}
|
|
7526
|
+
/**
|
|
7033
7527
|
* Called by the isolated-process runner AFTER `broker.start()`.
|
|
7034
7528
|
* In-process addons never need this because the hub broker is already
|
|
7035
7529
|
* running when `initialize()` fires. For forked children the broker
|
|
@@ -8139,407 +8633,6 @@ var RecordKindDeclarationSchema = object({
|
|
|
8139
8633
|
}).strict();
|
|
8140
8634
|
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
8141
8635
|
var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
8142
|
-
var READING_QUANTITIES = [
|
|
8143
|
-
"temperature",
|
|
8144
|
-
"pressure",
|
|
8145
|
-
"speed",
|
|
8146
|
-
"precipitation",
|
|
8147
|
-
"precipitation-rate",
|
|
8148
|
-
"length",
|
|
8149
|
-
"area",
|
|
8150
|
-
"illuminance",
|
|
8151
|
-
"irradiance",
|
|
8152
|
-
"power",
|
|
8153
|
-
"energy",
|
|
8154
|
-
"voltage",
|
|
8155
|
-
"current",
|
|
8156
|
-
"apparent-power",
|
|
8157
|
-
"humidity",
|
|
8158
|
-
"percentage",
|
|
8159
|
-
"concentration-volume",
|
|
8160
|
-
"concentration-mass",
|
|
8161
|
-
"concentration-ppb",
|
|
8162
|
-
"volume",
|
|
8163
|
-
"duration",
|
|
8164
|
-
"duration-ms",
|
|
8165
|
-
"information",
|
|
8166
|
-
"sound-level",
|
|
8167
|
-
"signal-level",
|
|
8168
|
-
"colour-temperature",
|
|
8169
|
-
"angle",
|
|
8170
|
-
"bitrate",
|
|
8171
|
-
"rate",
|
|
8172
|
-
"mass",
|
|
8173
|
-
"index",
|
|
8174
|
-
"ratio",
|
|
8175
|
-
"count",
|
|
8176
|
-
"none",
|
|
8177
|
-
"device"
|
|
8178
|
-
];
|
|
8179
|
-
var ReadingQuantitySchema = _enum(READING_QUANTITIES);
|
|
8180
|
-
new Set(READING_QUANTITIES);
|
|
8181
|
-
/**
|
|
8182
|
-
* Stored unit symbol for a quantity. `none` means the number is dimensionless
|
|
8183
|
-
* (or an index / ratio / count). `device` means the cap has no single unit.
|
|
8184
|
-
*/
|
|
8185
|
-
var QUANTITY_BASE = {
|
|
8186
|
-
temperature: "°C",
|
|
8187
|
-
pressure: "hPa",
|
|
8188
|
-
speed: "m/s",
|
|
8189
|
-
precipitation: "mm",
|
|
8190
|
-
"precipitation-rate": "mm/h",
|
|
8191
|
-
length: "m",
|
|
8192
|
-
area: "m²",
|
|
8193
|
-
illuminance: "lx",
|
|
8194
|
-
irradiance: "W/m²",
|
|
8195
|
-
power: "W",
|
|
8196
|
-
energy: "kWh",
|
|
8197
|
-
voltage: "V",
|
|
8198
|
-
current: "A",
|
|
8199
|
-
"apparent-power": "VA",
|
|
8200
|
-
humidity: "%",
|
|
8201
|
-
percentage: "%",
|
|
8202
|
-
"concentration-volume": "ppm",
|
|
8203
|
-
"concentration-mass": "µg/m³",
|
|
8204
|
-
"concentration-ppb": "ppb",
|
|
8205
|
-
volume: "L",
|
|
8206
|
-
duration: "s",
|
|
8207
|
-
"duration-ms": "ms",
|
|
8208
|
-
information: "B",
|
|
8209
|
-
"sound-level": "dBFS",
|
|
8210
|
-
"signal-level": "dBm",
|
|
8211
|
-
"colour-temperature": "mired",
|
|
8212
|
-
angle: "°",
|
|
8213
|
-
bitrate: "kbps",
|
|
8214
|
-
rate: "fps",
|
|
8215
|
-
mass: "kg",
|
|
8216
|
-
index: "none",
|
|
8217
|
-
ratio: "none",
|
|
8218
|
-
count: "none",
|
|
8219
|
-
none: "none",
|
|
8220
|
-
device: "device"
|
|
8221
|
-
};
|
|
8222
|
-
/** The stored unit, or `undefined` when the quantity has no unit symbol. */
|
|
8223
|
-
function baseUnitOf(quantity) {
|
|
8224
|
-
const symbol = QUANTITY_BASE[quantity];
|
|
8225
|
-
if (symbol === "none" || symbol === "device") return void 0;
|
|
8226
|
-
return symbol;
|
|
8227
|
-
}
|
|
8228
|
-
function readingMeta(quantity, extras) {
|
|
8229
|
-
return {
|
|
8230
|
-
quantity,
|
|
8231
|
-
...extras?.precision !== void 0 ? { precision: extras.precision } : {},
|
|
8232
|
-
...extras?.label !== void 0 ? { label: extras.label } : {}
|
|
8233
|
-
};
|
|
8234
|
-
}
|
|
8235
|
-
/** Shared Zod schemas used across streaming capabilities. */
|
|
8236
|
-
var CamProfileSchema = _enum([
|
|
8237
|
-
"high",
|
|
8238
|
-
"mid",
|
|
8239
|
-
"low"
|
|
8240
|
-
]);
|
|
8241
|
-
/**
|
|
8242
|
-
* Which rung a per-camera consumer listens on: an explicit profile, or `auto`.
|
|
8243
|
-
*
|
|
8244
|
-
* `auto` is a REAL value, not an absent one — it means "resolve it by the rule
|
|
8245
|
-
* that consumer owns". It lives beside `CamProfile` because a rung is the only
|
|
8246
|
-
* operator-facing way to name a stream: a cam-stream id is broker-internal and
|
|
8247
|
-
* moves when a slot is reassigned, so a stored id silently stops meaning what
|
|
8248
|
-
* the operator picked. Today's one user is the audio analyser, whose rule is
|
|
8249
|
-
* "the lowest AVAILABLE native rung" (D537).
|
|
8250
|
-
*/
|
|
8251
|
-
var AudioStreamPickSchema = union([CamProfileSchema, literal("auto")]);
|
|
8252
|
-
var CamStreamKindSchema = _enum([
|
|
8253
|
-
"pull-rtsp",
|
|
8254
|
-
"pull-rtmp",
|
|
8255
|
-
"pull-http",
|
|
8256
|
-
"pull-flv",
|
|
8257
|
-
"pull-rfc4571",
|
|
8258
|
-
"push-annexb",
|
|
8259
|
-
"derived"
|
|
8260
|
-
]);
|
|
8261
|
-
var CamStreamResolutionSchema = object({
|
|
8262
|
-
width: number().int().positive().meta(readingMeta("none")),
|
|
8263
|
-
height: number().int().positive().meta(readingMeta("none"))
|
|
8264
|
-
});
|
|
8265
|
-
var CameraStreamSchema = object({
|
|
8266
|
-
/** Stable, provider-assigned id unique within the (deviceId) scope. */
|
|
8267
|
-
camStreamId: string().min(1),
|
|
8268
|
-
deviceId: number().int().nonnegative(),
|
|
8269
|
-
kind: CamStreamKindSchema,
|
|
8270
|
-
/** Required for pull-* kinds. Ignored for push-annexb. */
|
|
8271
|
-
url: string().optional(),
|
|
8272
|
-
codec: string().optional(),
|
|
8273
|
-
resolution: CamStreamResolutionSchema.optional(),
|
|
8274
|
-
fps: number().positive().optional(),
|
|
8275
|
-
/** Human label surfaced in the Admin UI "Camera Stream" dropdown. */
|
|
8276
|
-
label: string().optional(),
|
|
8277
|
-
/**
|
|
8278
|
-
* Device-level features the publisher advertised (e.g. `battery-operated`).
|
|
8279
|
-
* The broker, snapshot orchestrator, and prebuffer manager all consult
|
|
8280
|
-
* this list to derive policy — relaxed stall watchdog for battery
|
|
8281
|
-
* cams, prebuffer off by default, longer snapshot rate-limit, etc.
|
|
8282
|
-
*
|
|
8283
|
-
* Single source of truth replacing per-stream flags like the
|
|
8284
|
-
* historical `allowStall`: if the publisher knows the camera is
|
|
8285
|
-
* battery-powered, every downstream service derives the right policy
|
|
8286
|
-
* from this list.
|
|
8287
|
-
*/
|
|
8288
|
-
deviceFeatures: array(string()).optional(),
|
|
8289
|
-
/**
|
|
8290
|
-
* Whether this stream participates in the broker's automatic profile
|
|
8291
|
-
* assignment (`computeInitialAssignment`). Defaults to `true`. Publishers
|
|
8292
|
-
* use `false` when they want a stream to be SELECTABLE in the UI but not
|
|
8293
|
-
* picked by default — e.g. Reolink publishes its native Baichuan streams
|
|
8294
|
-
* as `autoEligible: true` (the recommended path) and its RTSP / RTMP
|
|
8295
|
-
* mirrors as `autoEligible: false` (still pickable per slot, just not
|
|
8296
|
-
* the auto choice). Manual `assignProfile` calls remain valid for
|
|
8297
|
-
* non-eligible streams.
|
|
8298
|
-
*/
|
|
8299
|
-
autoEligible: boolean().optional(),
|
|
8300
|
-
/**
|
|
8301
|
-
* The profile slot the PUBLISHER says this stream is: `low` for a stream
|
|
8302
|
-
* whose only sensible role is the low-bandwidth one, `high` for a main
|
|
8303
|
-
* stream. Consulted by the broker's automatic ranking
|
|
8304
|
-
* (`rankInitialAssignment`) BEFORE the pixel-count heuristic, and only there:
|
|
8305
|
-
* an operator's manual assignment still wins, and an absent hint is the
|
|
8306
|
-
* pixel-ranked default every camera had before this field existed.
|
|
8307
|
-
*
|
|
8308
|
-
* Why it exists: a camera with ONE stream ranked to `mid` — the slot no
|
|
8309
|
-
* storage class is written for on its own (`recordings` is high|mid,
|
|
8310
|
-
* `recordingsLow` is low) and the one profile scrub does not read. The robot
|
|
8311
|
-
* camera's single 720p relay is a `low` in every respect except the slot the
|
|
8312
|
-
* heuristic put it in.
|
|
8313
|
-
*/
|
|
8314
|
-
profileHint: CamProfileSchema.optional(),
|
|
8315
|
-
/**
|
|
8316
|
-
* Transport-specific opaque metadata. The broker passes it through to
|
|
8317
|
-
* the source reader without inspecting it. Currently used by
|
|
8318
|
-
* `pull-rfc4571` streams to carry the upstream SDP (so the reader can
|
|
8319
|
-
* route RTP packets to the right depacketizer without an in-band
|
|
8320
|
-
* DESCRIBE phase). Other kinds typically leave it undefined.
|
|
8321
|
-
*/
|
|
8322
|
-
metadata: record(string(), unknown()).optional()
|
|
8323
|
-
});
|
|
8324
|
-
var ProfileSlotStatusSchema = _enum([
|
|
8325
|
-
"unassigned",
|
|
8326
|
-
"idle",
|
|
8327
|
-
"connecting",
|
|
8328
|
-
"streaming",
|
|
8329
|
-
"error"
|
|
8330
|
-
]);
|
|
8331
|
-
var ProfileSlotSchema = object({
|
|
8332
|
-
deviceId: number().int().nonnegative(),
|
|
8333
|
-
profile: CamProfileSchema,
|
|
8334
|
-
/** Broker id the rest of the system addresses: `${deviceId}/${profile}`. */
|
|
8335
|
-
brokerId: string(),
|
|
8336
|
-
/** `null` when the profile is unassigned. */
|
|
8337
|
-
sourceCamStreamId: string().nullable(),
|
|
8338
|
-
status: ProfileSlotStatusSchema,
|
|
8339
|
-
resolution: CamStreamResolutionSchema.optional(),
|
|
8340
|
-
codec: string().optional(),
|
|
8341
|
-
preBufferSec: number().nonnegative().optional(),
|
|
8342
|
-
errorMessage: string().optional()
|
|
8343
|
-
});
|
|
8344
|
-
/**
|
|
8345
|
-
* Zod schema for StreamSourceEntry — the canonical stream descriptor
|
|
8346
|
-
* exposed by ICameraDevice.getStreamSources() and consumed by the broker.
|
|
8347
|
-
*/
|
|
8348
|
-
var StreamSourceEntrySchema$1 = object({
|
|
8349
|
-
id: string(),
|
|
8350
|
-
label: string(),
|
|
8351
|
-
protocol: _enum([
|
|
8352
|
-
"rtsp",
|
|
8353
|
-
"rtmp",
|
|
8354
|
-
"annexb",
|
|
8355
|
-
"http-mjpeg",
|
|
8356
|
-
"webrtc",
|
|
8357
|
-
"custom"
|
|
8358
|
-
]),
|
|
8359
|
-
url: string().optional(),
|
|
8360
|
-
resolution: object({
|
|
8361
|
-
width: number(),
|
|
8362
|
-
height: number()
|
|
8363
|
-
}).readonly().optional(),
|
|
8364
|
-
fps: number().optional(),
|
|
8365
|
-
bitrate: number().optional(),
|
|
8366
|
-
codec: string().optional(),
|
|
8367
|
-
profileHint: CamProfileSchema.optional()
|
|
8368
|
-
});
|
|
8369
|
-
object({
|
|
8370
|
-
type: string(),
|
|
8371
|
-
url: string(),
|
|
8372
|
-
videoCodec: string().optional(),
|
|
8373
|
-
audioCodec: string().optional(),
|
|
8374
|
-
metadata: record(string(), unknown()).readonly().optional()
|
|
8375
|
-
});
|
|
8376
|
-
/**
|
|
8377
|
-
* Wire schema for `FrameHandle` — a zero-pixel, serialisable reference to a
|
|
8378
|
-
* frame in a shared-memory ring (Phase 5 / D9). Mirrors the `FrameHandle` TS
|
|
8379
|
-
* interface in `interfaces/frame-handle.ts` field-for-field so a cap method
|
|
8380
|
-
* (the runner's native-crop and pipeline-executor inputs) can carry handles
|
|
8381
|
-
* over tRPC / Moleculer.
|
|
8382
|
-
*
|
|
8383
|
-
* The `satisfies` assertion below pins this schema to the interface: if a
|
|
8384
|
-
* field is added to / removed from `FrameHandle` without a matching schema
|
|
8385
|
-
* edit, `z.infer<typeof FrameHandleSchema>` stops being assignable to
|
|
8386
|
-
* `FrameHandle` and the build fails — no silent drift.
|
|
8387
|
-
*/
|
|
8388
|
-
var FrameHandleSchema = object({
|
|
8389
|
-
shmId: string(),
|
|
8390
|
-
slot: number().int().nonnegative(),
|
|
8391
|
-
seq: number().int().nonnegative(),
|
|
8392
|
-
width: number().int().positive(),
|
|
8393
|
-
height: number().int().positive(),
|
|
8394
|
-
format: _enum([
|
|
8395
|
-
"jpeg",
|
|
8396
|
-
"rgb",
|
|
8397
|
-
"bgr",
|
|
8398
|
-
"yuv420",
|
|
8399
|
-
"gray"
|
|
8400
|
-
]),
|
|
8401
|
-
pts: number(),
|
|
8402
|
-
byteLength: number().int().nonnegative(),
|
|
8403
|
-
nodeId: string(),
|
|
8404
|
-
slotCount: number().int().positive()
|
|
8405
|
-
});
|
|
8406
|
-
/**
|
|
8407
|
-
* Wire schema for a decoded audio chunk (Phase 5 / D9). Mirrors the
|
|
8408
|
-
* `DecodedAudioChunk` TS interface in `interfaces/stream-broker.ts`: PCM
|
|
8409
|
-
* sample bytes plus the track parameters a consumer needs to interpret them.
|
|
8410
|
-
*
|
|
8411
|
-
* Audio chunks are tiny (a ~500ms AudioCodecSession window is a few KB of
|
|
8412
|
-
* Float32 PCM), so unlike video frames they ship their bytes INLINE over
|
|
8413
|
-
* tRPC / Moleculer — no shared-memory plane. `data` is typed `Uint8Array`
|
|
8414
|
-
* (the wire-serialisable supertype of `Buffer`); a `Buffer` is assignable to
|
|
8415
|
-
* it.
|
|
8416
|
-
*/
|
|
8417
|
-
var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
|
|
8418
|
-
var DecodedAudioChunkSchema = object({
|
|
8419
|
-
data: _instanceof(Uint8Array),
|
|
8420
|
-
sampleRate: number().int().positive(),
|
|
8421
|
-
channels: number().int().positive(),
|
|
8422
|
-
timestamp: number(),
|
|
8423
|
-
/**
|
|
8424
|
-
* Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
|
|
8425
|
-
* byte, for any peer that never heard of this field. A coded window
|
|
8426
|
-
* (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
|
|
8427
|
-
* subscription that DECLARED it accepts one, so absence can never mean
|
|
8428
|
-
* "coded bytes a consumer will read as floats" (D455).
|
|
8429
|
-
*/
|
|
8430
|
-
format: AudioChunkFormatSchema.optional()
|
|
8431
|
-
});
|
|
8432
|
-
/**
|
|
8433
|
-
* Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). Audio ships
|
|
8434
|
-
* its bytes inline: a consumer asks the broker for the decoded audio-chunk
|
|
8435
|
-
* stream of one broker; the broker keeps a per-subscription bounded FIFO queue
|
|
8436
|
-
* the consumer drains via `pullAudioChunks`.
|
|
8437
|
-
*/
|
|
8438
|
-
var SubscribeAudioChunksInputSchema = object({
|
|
8439
|
-
brokerId: string(),
|
|
8440
|
-
/** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
|
|
8441
|
-
tag: string().optional(),
|
|
8442
|
-
/**
|
|
8443
|
-
* Byte formats this subscriber can READ, best first. The broker serves the
|
|
8444
|
-
* chunk's own format when it is in this list and expands to `f32le`
|
|
8445
|
-
* otherwise, so a subscriber is never handed bytes it cannot interpret.
|
|
8446
|
-
*
|
|
8447
|
-
* Absent (or without the source format) means `f32le` — the behaviour every
|
|
8448
|
-
* subscriber had before D455, unchanged. This is the negotiation half of
|
|
8449
|
-
* the source-bytes lever: it is what lets the broker and its consumers
|
|
8450
|
-
* deploy one at a time across three nodes.
|
|
8451
|
-
*/
|
|
8452
|
-
accept: array(AudioChunkFormatSchema).readonly().optional()
|
|
8453
|
-
});
|
|
8454
|
-
/** Result of `stream-broker.subscribeAudioChunks`. */
|
|
8455
|
-
var SubscribeAudioChunksResultSchema = object({
|
|
8456
|
-
/** Opaque id passed to `pullAudioChunks` / `unsubscribeAudioChunks`. */
|
|
8457
|
-
subscriptionId: string() });
|
|
8458
|
-
var BrokerStatsSchema = object({
|
|
8459
|
-
status: _enum([
|
|
8460
|
-
"idle",
|
|
8461
|
-
"connecting",
|
|
8462
|
-
"streaming",
|
|
8463
|
-
"error",
|
|
8464
|
-
"stopped"
|
|
8465
|
-
]),
|
|
8466
|
-
inputFps: number(),
|
|
8467
|
-
encodedSubscribers: number(),
|
|
8468
|
-
uptimeMs: number(),
|
|
8469
|
-
bitrateKbps: number(),
|
|
8470
|
-
idrIntervalMs: number(),
|
|
8471
|
-
codec: string().optional(),
|
|
8472
|
-
totalBytes: number(),
|
|
8473
|
-
packetCount: number(),
|
|
8474
|
-
rtspClients: number(),
|
|
8475
|
-
pipeClients: number(),
|
|
8476
|
-
preBufferSec: number(),
|
|
8477
|
-
preBufferMs: number(),
|
|
8478
|
-
preBufferPackets: number(),
|
|
8479
|
-
/**
|
|
8480
|
-
* Detected audio track parameters from the RTSP DESCRIBE / SDP. `null`
|
|
8481
|
-
* when the stream has no audio track or the broker is in cold start.
|
|
8482
|
-
* `supported = false` means the codec was detected but the local
|
|
8483
|
-
* decoder pipeline cannot produce PCM chunks (e.g. AAC without the
|
|
8484
|
-
* AAC pipeline wired). Surfaced in the UI device-overview so operators
|
|
8485
|
-
* can pre-pick the audio-analysis model that matches the codec.
|
|
8486
|
-
*/
|
|
8487
|
-
audio: object({
|
|
8488
|
-
codec: string(),
|
|
8489
|
-
sampleRate: number(),
|
|
8490
|
-
channels: number(),
|
|
8491
|
-
supported: boolean()
|
|
8492
|
-
}).nullable().optional(),
|
|
8493
|
-
/**
|
|
8494
|
-
* BROKER-SIDE AUDIO MUTE (D83). `true` = this broker is deliberately
|
|
8495
|
-
* distributing none of the device's audio, on live or recording.
|
|
8496
|
-
*
|
|
8497
|
-
* Present so a silent camera can be told apart from a broken one on the
|
|
8498
|
-
* stream panel itself, without cross-referencing the switch group: a
|
|
8499
|
-
* broker holding an `audio` track descriptor while `audioMuted` is true is
|
|
8500
|
-
* working exactly as asked. `audioMutedDropped` counts the audio units
|
|
8501
|
-
* thrown away since the current dial — it is how you confirm from stats
|
|
8502
|
-
* alone that the mute is on the packet path and not merely persisted.
|
|
8503
|
-
*/
|
|
8504
|
-
audioMuted: boolean().optional(),
|
|
8505
|
-
audioMutedDropped: number().optional()
|
|
8506
|
-
});
|
|
8507
|
-
/**
|
|
8508
|
-
* Exporter-facing "profile restream" entry. Returned by
|
|
8509
|
-
* `cameraStreams.getProfileRtspEntries` — one per ASSIGNED profile slot
|
|
8510
|
-
* (high/mid/low). `brokerId` is the PROFILE-keyed broker id
|
|
8511
|
-
* (`${deviceId}/${profile}`, e.g. `15/high`); its `url` is a broker
|
|
8512
|
-
* RTSP restream that aliases the profile's assigned source broker, so
|
|
8513
|
-
* every consumer dialling a profile converges on the same single pull.
|
|
8514
|
-
* `codec`/`resolution` describe the assigned SOURCE camStream (for the
|
|
8515
|
-
* `auto` resolution-closest pick). Distinct from `RtspRestreamEntry`
|
|
8516
|
-
* (raw per-camStream, live-view only).
|
|
8517
|
-
*/
|
|
8518
|
-
var ProfileRtspEntrySchema = object({
|
|
8519
|
-
profile: CamProfileSchema,
|
|
8520
|
-
/** Profile-keyed broker id, format `${deviceId}/${profile}` (e.g. `"15/high"`). */
|
|
8521
|
-
brokerId: string(),
|
|
8522
|
-
url: string(),
|
|
8523
|
-
mutedUrl: string(),
|
|
8524
|
-
enabled: boolean(),
|
|
8525
|
-
codec: string().optional(),
|
|
8526
|
-
resolution: CamStreamResolutionSchema.optional()
|
|
8527
|
-
});
|
|
8528
|
-
/**
|
|
8529
|
-
* The model weight formats a catalog entry can ship. Schema-free on purpose:
|
|
8530
|
-
* `types/models.ts` builds Zod schemas from it, but a runner-closure consumer
|
|
8531
|
-
* (the model downloader in `@camstack/system`) needs only the list and must
|
|
8532
|
-
* reach it through `@camstack/types/addon` without building the cap schema
|
|
8533
|
-
* graph (D28).
|
|
8534
|
-
*/
|
|
8535
|
-
var MODEL_FORMATS = [
|
|
8536
|
-
"onnx",
|
|
8537
|
-
"coreml",
|
|
8538
|
-
"openvino",
|
|
8539
|
-
"tflite",
|
|
8540
|
-
"pt",
|
|
8541
|
-
"gguf"
|
|
8542
|
-
];
|
|
8543
8636
|
object({
|
|
8544
8637
|
field: string().min(1),
|
|
8545
8638
|
on: literal("advance")
|
|
@@ -8632,6 +8725,407 @@ function optionalMethod(input, output, options) {
|
|
|
8632
8725
|
function event(data) {
|
|
8633
8726
|
return { data };
|
|
8634
8727
|
}
|
|
8728
|
+
var READING_QUANTITIES = [
|
|
8729
|
+
"temperature",
|
|
8730
|
+
"pressure",
|
|
8731
|
+
"speed",
|
|
8732
|
+
"precipitation",
|
|
8733
|
+
"precipitation-rate",
|
|
8734
|
+
"length",
|
|
8735
|
+
"area",
|
|
8736
|
+
"illuminance",
|
|
8737
|
+
"irradiance",
|
|
8738
|
+
"power",
|
|
8739
|
+
"energy",
|
|
8740
|
+
"voltage",
|
|
8741
|
+
"current",
|
|
8742
|
+
"apparent-power",
|
|
8743
|
+
"humidity",
|
|
8744
|
+
"percentage",
|
|
8745
|
+
"concentration-volume",
|
|
8746
|
+
"concentration-mass",
|
|
8747
|
+
"concentration-ppb",
|
|
8748
|
+
"volume",
|
|
8749
|
+
"duration",
|
|
8750
|
+
"duration-ms",
|
|
8751
|
+
"information",
|
|
8752
|
+
"sound-level",
|
|
8753
|
+
"signal-level",
|
|
8754
|
+
"colour-temperature",
|
|
8755
|
+
"angle",
|
|
8756
|
+
"bitrate",
|
|
8757
|
+
"rate",
|
|
8758
|
+
"mass",
|
|
8759
|
+
"index",
|
|
8760
|
+
"ratio",
|
|
8761
|
+
"count",
|
|
8762
|
+
"none",
|
|
8763
|
+
"device"
|
|
8764
|
+
];
|
|
8765
|
+
var ReadingQuantitySchema = _enum(READING_QUANTITIES);
|
|
8766
|
+
new Set(READING_QUANTITIES);
|
|
8767
|
+
/**
|
|
8768
|
+
* Stored unit symbol for a quantity. `none` means the number is dimensionless
|
|
8769
|
+
* (or an index / ratio / count). `device` means the cap has no single unit.
|
|
8770
|
+
*/
|
|
8771
|
+
var QUANTITY_BASE = {
|
|
8772
|
+
temperature: "°C",
|
|
8773
|
+
pressure: "hPa",
|
|
8774
|
+
speed: "m/s",
|
|
8775
|
+
precipitation: "mm",
|
|
8776
|
+
"precipitation-rate": "mm/h",
|
|
8777
|
+
length: "m",
|
|
8778
|
+
area: "m²",
|
|
8779
|
+
illuminance: "lx",
|
|
8780
|
+
irradiance: "W/m²",
|
|
8781
|
+
power: "W",
|
|
8782
|
+
energy: "kWh",
|
|
8783
|
+
voltage: "V",
|
|
8784
|
+
current: "A",
|
|
8785
|
+
"apparent-power": "VA",
|
|
8786
|
+
humidity: "%",
|
|
8787
|
+
percentage: "%",
|
|
8788
|
+
"concentration-volume": "ppm",
|
|
8789
|
+
"concentration-mass": "µg/m³",
|
|
8790
|
+
"concentration-ppb": "ppb",
|
|
8791
|
+
volume: "L",
|
|
8792
|
+
duration: "s",
|
|
8793
|
+
"duration-ms": "ms",
|
|
8794
|
+
information: "B",
|
|
8795
|
+
"sound-level": "dBFS",
|
|
8796
|
+
"signal-level": "dBm",
|
|
8797
|
+
"colour-temperature": "mired",
|
|
8798
|
+
angle: "°",
|
|
8799
|
+
bitrate: "kbps",
|
|
8800
|
+
rate: "fps",
|
|
8801
|
+
mass: "kg",
|
|
8802
|
+
index: "none",
|
|
8803
|
+
ratio: "none",
|
|
8804
|
+
count: "none",
|
|
8805
|
+
none: "none",
|
|
8806
|
+
device: "device"
|
|
8807
|
+
};
|
|
8808
|
+
/** The stored unit, or `undefined` when the quantity has no unit symbol. */
|
|
8809
|
+
function baseUnitOf(quantity) {
|
|
8810
|
+
const symbol = QUANTITY_BASE[quantity];
|
|
8811
|
+
if (symbol === "none" || symbol === "device") return void 0;
|
|
8812
|
+
return symbol;
|
|
8813
|
+
}
|
|
8814
|
+
function readingMeta(quantity, extras) {
|
|
8815
|
+
return {
|
|
8816
|
+
quantity,
|
|
8817
|
+
...extras?.precision !== void 0 ? { precision: extras.precision } : {},
|
|
8818
|
+
...extras?.label !== void 0 ? { label: extras.label } : {}
|
|
8819
|
+
};
|
|
8820
|
+
}
|
|
8821
|
+
/** Shared Zod schemas used across streaming capabilities. */
|
|
8822
|
+
var CamProfileSchema = _enum([
|
|
8823
|
+
"high",
|
|
8824
|
+
"mid",
|
|
8825
|
+
"low"
|
|
8826
|
+
]);
|
|
8827
|
+
/**
|
|
8828
|
+
* Which rung a per-camera consumer listens on: an explicit profile, or `auto`.
|
|
8829
|
+
*
|
|
8830
|
+
* `auto` is a REAL value, not an absent one — it means "resolve it by the rule
|
|
8831
|
+
* that consumer owns". It lives beside `CamProfile` because a rung is the only
|
|
8832
|
+
* operator-facing way to name a stream: a cam-stream id is broker-internal and
|
|
8833
|
+
* moves when a slot is reassigned, so a stored id silently stops meaning what
|
|
8834
|
+
* the operator picked. Today's one user is the audio analyser, whose rule is
|
|
8835
|
+
* "the lowest AVAILABLE native rung" (D537).
|
|
8836
|
+
*/
|
|
8837
|
+
var AudioStreamPickSchema = union([CamProfileSchema, literal("auto")]);
|
|
8838
|
+
var CamStreamKindSchema = _enum([
|
|
8839
|
+
"pull-rtsp",
|
|
8840
|
+
"pull-rtmp",
|
|
8841
|
+
"pull-http",
|
|
8842
|
+
"pull-flv",
|
|
8843
|
+
"pull-rfc4571",
|
|
8844
|
+
"push-annexb",
|
|
8845
|
+
"derived"
|
|
8846
|
+
]);
|
|
8847
|
+
var CamStreamResolutionSchema = object({
|
|
8848
|
+
width: number().int().positive().meta(readingMeta("none")),
|
|
8849
|
+
height: number().int().positive().meta(readingMeta("none"))
|
|
8850
|
+
});
|
|
8851
|
+
var CameraStreamSchema = object({
|
|
8852
|
+
/** Stable, provider-assigned id unique within the (deviceId) scope. */
|
|
8853
|
+
camStreamId: string().min(1),
|
|
8854
|
+
deviceId: number().int().nonnegative(),
|
|
8855
|
+
kind: CamStreamKindSchema,
|
|
8856
|
+
/** Required for pull-* kinds. Ignored for push-annexb. */
|
|
8857
|
+
url: string().optional(),
|
|
8858
|
+
codec: string().optional(),
|
|
8859
|
+
resolution: CamStreamResolutionSchema.optional(),
|
|
8860
|
+
fps: number().positive().optional(),
|
|
8861
|
+
/** Human label surfaced in the Admin UI "Camera Stream" dropdown. */
|
|
8862
|
+
label: string().optional(),
|
|
8863
|
+
/**
|
|
8864
|
+
* Device-level features the publisher advertised (e.g. `battery-operated`).
|
|
8865
|
+
* The broker, snapshot orchestrator, and prebuffer manager all consult
|
|
8866
|
+
* this list to derive policy — relaxed stall watchdog for battery
|
|
8867
|
+
* cams, prebuffer off by default, longer snapshot rate-limit, etc.
|
|
8868
|
+
*
|
|
8869
|
+
* Single source of truth replacing per-stream flags like the
|
|
8870
|
+
* historical `allowStall`: if the publisher knows the camera is
|
|
8871
|
+
* battery-powered, every downstream service derives the right policy
|
|
8872
|
+
* from this list.
|
|
8873
|
+
*/
|
|
8874
|
+
deviceFeatures: array(string()).optional(),
|
|
8875
|
+
/**
|
|
8876
|
+
* Whether this stream participates in the broker's automatic profile
|
|
8877
|
+
* assignment (`computeInitialAssignment`). Defaults to `true`. Publishers
|
|
8878
|
+
* use `false` when they want a stream to be SELECTABLE in the UI but not
|
|
8879
|
+
* picked by default — e.g. Reolink publishes its native Baichuan streams
|
|
8880
|
+
* as `autoEligible: true` (the recommended path) and its RTSP / RTMP
|
|
8881
|
+
* mirrors as `autoEligible: false` (still pickable per slot, just not
|
|
8882
|
+
* the auto choice). Manual `assignProfile` calls remain valid for
|
|
8883
|
+
* non-eligible streams.
|
|
8884
|
+
*/
|
|
8885
|
+
autoEligible: boolean().optional(),
|
|
8886
|
+
/**
|
|
8887
|
+
* The profile slot the PUBLISHER says this stream is: `low` for a stream
|
|
8888
|
+
* whose only sensible role is the low-bandwidth one, `high` for a main
|
|
8889
|
+
* stream. Consulted by the broker's automatic ranking
|
|
8890
|
+
* (`rankInitialAssignment`) BEFORE the pixel-count heuristic, and only there:
|
|
8891
|
+
* an operator's manual assignment still wins, and an absent hint is the
|
|
8892
|
+
* pixel-ranked default every camera had before this field existed.
|
|
8893
|
+
*
|
|
8894
|
+
* Why it exists: a camera with ONE stream ranked to `mid` — the slot no
|
|
8895
|
+
* storage class is written for on its own (`recordings` is high|mid,
|
|
8896
|
+
* `recordingsLow` is low) and the one profile scrub does not read. The robot
|
|
8897
|
+
* camera's single 720p relay is a `low` in every respect except the slot the
|
|
8898
|
+
* heuristic put it in.
|
|
8899
|
+
*/
|
|
8900
|
+
profileHint: CamProfileSchema.optional(),
|
|
8901
|
+
/**
|
|
8902
|
+
* Transport-specific opaque metadata. The broker passes it through to
|
|
8903
|
+
* the source reader without inspecting it. Currently used by
|
|
8904
|
+
* `pull-rfc4571` streams to carry the upstream SDP (so the reader can
|
|
8905
|
+
* route RTP packets to the right depacketizer without an in-band
|
|
8906
|
+
* DESCRIBE phase). Other kinds typically leave it undefined.
|
|
8907
|
+
*/
|
|
8908
|
+
metadata: record(string(), unknown()).optional()
|
|
8909
|
+
});
|
|
8910
|
+
var ProfileSlotStatusSchema = _enum([
|
|
8911
|
+
"unassigned",
|
|
8912
|
+
"idle",
|
|
8913
|
+
"connecting",
|
|
8914
|
+
"streaming",
|
|
8915
|
+
"error"
|
|
8916
|
+
]);
|
|
8917
|
+
var ProfileSlotSchema = object({
|
|
8918
|
+
deviceId: number().int().nonnegative(),
|
|
8919
|
+
profile: CamProfileSchema,
|
|
8920
|
+
/** Broker id the rest of the system addresses: `${deviceId}/${profile}`. */
|
|
8921
|
+
brokerId: string(),
|
|
8922
|
+
/** `null` when the profile is unassigned. */
|
|
8923
|
+
sourceCamStreamId: string().nullable(),
|
|
8924
|
+
status: ProfileSlotStatusSchema,
|
|
8925
|
+
resolution: CamStreamResolutionSchema.optional(),
|
|
8926
|
+
codec: string().optional(),
|
|
8927
|
+
preBufferSec: number().nonnegative().optional(),
|
|
8928
|
+
errorMessage: string().optional()
|
|
8929
|
+
});
|
|
8930
|
+
/**
|
|
8931
|
+
* Zod schema for StreamSourceEntry — the canonical stream descriptor
|
|
8932
|
+
* exposed by ICameraDevice.getStreamSources() and consumed by the broker.
|
|
8933
|
+
*/
|
|
8934
|
+
var StreamSourceEntrySchema$1 = object({
|
|
8935
|
+
id: string(),
|
|
8936
|
+
label: string(),
|
|
8937
|
+
protocol: _enum([
|
|
8938
|
+
"rtsp",
|
|
8939
|
+
"rtmp",
|
|
8940
|
+
"annexb",
|
|
8941
|
+
"http-mjpeg",
|
|
8942
|
+
"webrtc",
|
|
8943
|
+
"custom"
|
|
8944
|
+
]),
|
|
8945
|
+
url: string().optional(),
|
|
8946
|
+
resolution: object({
|
|
8947
|
+
width: number(),
|
|
8948
|
+
height: number()
|
|
8949
|
+
}).readonly().optional(),
|
|
8950
|
+
fps: number().optional(),
|
|
8951
|
+
bitrate: number().optional(),
|
|
8952
|
+
codec: string().optional(),
|
|
8953
|
+
profileHint: CamProfileSchema.optional()
|
|
8954
|
+
});
|
|
8955
|
+
object({
|
|
8956
|
+
type: string(),
|
|
8957
|
+
url: string(),
|
|
8958
|
+
videoCodec: string().optional(),
|
|
8959
|
+
audioCodec: string().optional(),
|
|
8960
|
+
metadata: record(string(), unknown()).readonly().optional()
|
|
8961
|
+
});
|
|
8962
|
+
/**
|
|
8963
|
+
* Wire schema for `FrameHandle` — a zero-pixel, serialisable reference to a
|
|
8964
|
+
* frame in a shared-memory ring (Phase 5 / D9). Mirrors the `FrameHandle` TS
|
|
8965
|
+
* interface in `interfaces/frame-handle.ts` field-for-field so a cap method
|
|
8966
|
+
* (the runner's native-crop and pipeline-executor inputs) can carry handles
|
|
8967
|
+
* over tRPC / Moleculer.
|
|
8968
|
+
*
|
|
8969
|
+
* The `satisfies` assertion below pins this schema to the interface: if a
|
|
8970
|
+
* field is added to / removed from `FrameHandle` without a matching schema
|
|
8971
|
+
* edit, `z.infer<typeof FrameHandleSchema>` stops being assignable to
|
|
8972
|
+
* `FrameHandle` and the build fails — no silent drift.
|
|
8973
|
+
*/
|
|
8974
|
+
var FrameHandleSchema = object({
|
|
8975
|
+
shmId: string(),
|
|
8976
|
+
slot: number().int().nonnegative(),
|
|
8977
|
+
seq: number().int().nonnegative(),
|
|
8978
|
+
width: number().int().positive(),
|
|
8979
|
+
height: number().int().positive(),
|
|
8980
|
+
format: _enum([
|
|
8981
|
+
"jpeg",
|
|
8982
|
+
"rgb",
|
|
8983
|
+
"bgr",
|
|
8984
|
+
"yuv420",
|
|
8985
|
+
"gray"
|
|
8986
|
+
]),
|
|
8987
|
+
pts: number(),
|
|
8988
|
+
byteLength: number().int().nonnegative(),
|
|
8989
|
+
nodeId: string(),
|
|
8990
|
+
slotCount: number().int().positive()
|
|
8991
|
+
});
|
|
8992
|
+
/**
|
|
8993
|
+
* Wire schema for a decoded audio chunk (Phase 5 / D9). Mirrors the
|
|
8994
|
+
* `DecodedAudioChunk` TS interface in `interfaces/stream-broker.ts`: PCM
|
|
8995
|
+
* sample bytes plus the track parameters a consumer needs to interpret them.
|
|
8996
|
+
*
|
|
8997
|
+
* Audio chunks are tiny (a ~500ms AudioCodecSession window is a few KB of
|
|
8998
|
+
* Float32 PCM), so unlike video frames they ship their bytes INLINE over
|
|
8999
|
+
* tRPC / Moleculer — no shared-memory plane. `data` is typed `Uint8Array`
|
|
9000
|
+
* (the wire-serialisable supertype of `Buffer`); a `Buffer` is assignable to
|
|
9001
|
+
* it.
|
|
9002
|
+
*/
|
|
9003
|
+
var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
|
|
9004
|
+
var DecodedAudioChunkSchema = object({
|
|
9005
|
+
data: _instanceof(Uint8Array),
|
|
9006
|
+
sampleRate: number().int().positive(),
|
|
9007
|
+
channels: number().int().positive(),
|
|
9008
|
+
timestamp: number(),
|
|
9009
|
+
/**
|
|
9010
|
+
* Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
|
|
9011
|
+
* byte, for any peer that never heard of this field. A coded window
|
|
9012
|
+
* (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
|
|
9013
|
+
* subscription that DECLARED it accepts one, so absence can never mean
|
|
9014
|
+
* "coded bytes a consumer will read as floats" (D455).
|
|
9015
|
+
*/
|
|
9016
|
+
format: AudioChunkFormatSchema.optional()
|
|
9017
|
+
});
|
|
9018
|
+
/**
|
|
9019
|
+
* Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). Audio ships
|
|
9020
|
+
* its bytes inline: a consumer asks the broker for the decoded audio-chunk
|
|
9021
|
+
* stream of one broker; the broker keeps a per-subscription bounded FIFO queue
|
|
9022
|
+
* the consumer drains via `pullAudioChunks`.
|
|
9023
|
+
*/
|
|
9024
|
+
var SubscribeAudioChunksInputSchema = object({
|
|
9025
|
+
brokerId: string(),
|
|
9026
|
+
/** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
|
|
9027
|
+
tag: string().optional(),
|
|
9028
|
+
/**
|
|
9029
|
+
* Byte formats this subscriber can READ, best first. The broker serves the
|
|
9030
|
+
* chunk's own format when it is in this list and expands to `f32le`
|
|
9031
|
+
* otherwise, so a subscriber is never handed bytes it cannot interpret.
|
|
9032
|
+
*
|
|
9033
|
+
* Absent (or without the source format) means `f32le` — the behaviour every
|
|
9034
|
+
* subscriber had before D455, unchanged. This is the negotiation half of
|
|
9035
|
+
* the source-bytes lever: it is what lets the broker and its consumers
|
|
9036
|
+
* deploy one at a time across three nodes.
|
|
9037
|
+
*/
|
|
9038
|
+
accept: array(AudioChunkFormatSchema).readonly().optional()
|
|
9039
|
+
});
|
|
9040
|
+
/** Result of `stream-broker.subscribeAudioChunks`. */
|
|
9041
|
+
var SubscribeAudioChunksResultSchema = object({
|
|
9042
|
+
/** Opaque id passed to `pullAudioChunks` / `unsubscribeAudioChunks`. */
|
|
9043
|
+
subscriptionId: string() });
|
|
9044
|
+
var BrokerStatsSchema = object({
|
|
9045
|
+
status: _enum([
|
|
9046
|
+
"idle",
|
|
9047
|
+
"connecting",
|
|
9048
|
+
"streaming",
|
|
9049
|
+
"error",
|
|
9050
|
+
"stopped"
|
|
9051
|
+
]),
|
|
9052
|
+
inputFps: number(),
|
|
9053
|
+
encodedSubscribers: number(),
|
|
9054
|
+
uptimeMs: number(),
|
|
9055
|
+
bitrateKbps: number(),
|
|
9056
|
+
idrIntervalMs: number(),
|
|
9057
|
+
codec: string().optional(),
|
|
9058
|
+
totalBytes: number(),
|
|
9059
|
+
packetCount: number(),
|
|
9060
|
+
rtspClients: number(),
|
|
9061
|
+
pipeClients: number(),
|
|
9062
|
+
preBufferSec: number(),
|
|
9063
|
+
preBufferMs: number(),
|
|
9064
|
+
preBufferPackets: number(),
|
|
9065
|
+
/**
|
|
9066
|
+
* Detected audio track parameters from the RTSP DESCRIBE / SDP. `null`
|
|
9067
|
+
* when the stream has no audio track or the broker is in cold start.
|
|
9068
|
+
* `supported = false` means the codec was detected but the local
|
|
9069
|
+
* decoder pipeline cannot produce PCM chunks (e.g. AAC without the
|
|
9070
|
+
* AAC pipeline wired). Surfaced in the UI device-overview so operators
|
|
9071
|
+
* can pre-pick the audio-analysis model that matches the codec.
|
|
9072
|
+
*/
|
|
9073
|
+
audio: object({
|
|
9074
|
+
codec: string(),
|
|
9075
|
+
sampleRate: number(),
|
|
9076
|
+
channels: number(),
|
|
9077
|
+
supported: boolean()
|
|
9078
|
+
}).nullable().optional(),
|
|
9079
|
+
/**
|
|
9080
|
+
* BROKER-SIDE AUDIO MUTE (D83). `true` = this broker is deliberately
|
|
9081
|
+
* distributing none of the device's audio, on live or recording.
|
|
9082
|
+
*
|
|
9083
|
+
* Present so a silent camera can be told apart from a broken one on the
|
|
9084
|
+
* stream panel itself, without cross-referencing the switch group: a
|
|
9085
|
+
* broker holding an `audio` track descriptor while `audioMuted` is true is
|
|
9086
|
+
* working exactly as asked. `audioMutedDropped` counts the audio units
|
|
9087
|
+
* thrown away since the current dial — it is how you confirm from stats
|
|
9088
|
+
* alone that the mute is on the packet path and not merely persisted.
|
|
9089
|
+
*/
|
|
9090
|
+
audioMuted: boolean().optional(),
|
|
9091
|
+
audioMutedDropped: number().optional()
|
|
9092
|
+
});
|
|
9093
|
+
/**
|
|
9094
|
+
* Exporter-facing "profile restream" entry. Returned by
|
|
9095
|
+
* `cameraStreams.getProfileRtspEntries` — one per ASSIGNED profile slot
|
|
9096
|
+
* (high/mid/low). `brokerId` is the PROFILE-keyed broker id
|
|
9097
|
+
* (`${deviceId}/${profile}`, e.g. `15/high`); its `url` is a broker
|
|
9098
|
+
* RTSP restream that aliases the profile's assigned source broker, so
|
|
9099
|
+
* every consumer dialling a profile converges on the same single pull.
|
|
9100
|
+
* `codec`/`resolution` describe the assigned SOURCE camStream (for the
|
|
9101
|
+
* `auto` resolution-closest pick). Distinct from `RtspRestreamEntry`
|
|
9102
|
+
* (raw per-camStream, live-view only).
|
|
9103
|
+
*/
|
|
9104
|
+
var ProfileRtspEntrySchema = object({
|
|
9105
|
+
profile: CamProfileSchema,
|
|
9106
|
+
/** Profile-keyed broker id, format `${deviceId}/${profile}` (e.g. `"15/high"`). */
|
|
9107
|
+
brokerId: string(),
|
|
9108
|
+
url: string(),
|
|
9109
|
+
mutedUrl: string(),
|
|
9110
|
+
enabled: boolean(),
|
|
9111
|
+
codec: string().optional(),
|
|
9112
|
+
resolution: CamStreamResolutionSchema.optional()
|
|
9113
|
+
});
|
|
9114
|
+
/**
|
|
9115
|
+
* The model weight formats a catalog entry can ship. Schema-free on purpose:
|
|
9116
|
+
* `types/models.ts` builds Zod schemas from it, but a runner-closure consumer
|
|
9117
|
+
* (the model downloader in `@camstack/server/system`) needs only the list and must
|
|
9118
|
+
* reach it through `@camstack/types/addon` without building the cap schema
|
|
9119
|
+
* graph (D28).
|
|
9120
|
+
*/
|
|
9121
|
+
var MODEL_FORMATS = [
|
|
9122
|
+
"onnx",
|
|
9123
|
+
"coreml",
|
|
9124
|
+
"openvino",
|
|
9125
|
+
"tflite",
|
|
9126
|
+
"pt",
|
|
9127
|
+
"gguf"
|
|
9128
|
+
];
|
|
8635
9129
|
/**
|
|
8636
9130
|
* `addon-pages-source` — collection cap exposing per-provider raw page
|
|
8637
9131
|
* declarations. Every addon that contributes a UI page registers a
|
|
@@ -8895,6 +9389,7 @@ var CAP_NAMES = Object.freeze([
|
|
|
8895
9389
|
"mesh-network",
|
|
8896
9390
|
"meter",
|
|
8897
9391
|
"metrics-provider",
|
|
9392
|
+
"migrations",
|
|
8898
9393
|
"model-convert",
|
|
8899
9394
|
"model-distributor",
|
|
8900
9395
|
"motion",
|
|
@@ -8927,6 +9422,7 @@ var CAP_NAMES = Object.freeze([
|
|
|
8927
9422
|
"plate-gallery",
|
|
8928
9423
|
"platform-probe",
|
|
8929
9424
|
"power-meter",
|
|
9425
|
+
"power-source",
|
|
8930
9426
|
"presence",
|
|
8931
9427
|
"pressure-sensor",
|
|
8932
9428
|
"privacy-mask",
|
|
@@ -10278,6 +10774,13 @@ Object.freeze({
|
|
|
10278
10774
|
"valueType": "number"
|
|
10279
10775
|
}
|
|
10280
10776
|
],
|
|
10777
|
+
"power-source": [{
|
|
10778
|
+
"path": "switchOn",
|
|
10779
|
+
"valueType": "boolean"
|
|
10780
|
+
}, {
|
|
10781
|
+
"path": "offSeconds",
|
|
10782
|
+
"valueType": "number"
|
|
10783
|
+
}],
|
|
10281
10784
|
"presence": [
|
|
10282
10785
|
{
|
|
10283
10786
|
"path": "state",
|
|
@@ -10789,379 +11292,7 @@ object({
|
|
|
10789
11292
|
params: record(string(), union([string(), number()])).optional()
|
|
10790
11293
|
});
|
|
10791
11294
|
//#endregion
|
|
10792
|
-
//#region ../types/dist/
|
|
10793
|
-
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
10794
|
-
DeviceType["Camera"] = "camera";
|
|
10795
|
-
DeviceType["Hub"] = "hub";
|
|
10796
|
-
DeviceType["Light"] = "light";
|
|
10797
|
-
DeviceType["Siren"] = "siren";
|
|
10798
|
-
DeviceType["Switch"] = "switch";
|
|
10799
|
-
DeviceType["Sensor"] = "sensor";
|
|
10800
|
-
DeviceType["Thermostat"] = "thermostat";
|
|
10801
|
-
/** Air-conditioner / heat-pump climate device (HVAC) — shares the
|
|
10802
|
-
* `climate-control` cap surface with `Thermostat` but renders a
|
|
10803
|
-
* dedicated AC-appropriate control UI (mode chips, fan speed,
|
|
10804
|
-
* independent vertical/horizontal swing). Sources: native Gree, and
|
|
10805
|
-
* reusable by other AC integrations. */
|
|
10806
|
-
DeviceType["Climate"] = "climate";
|
|
10807
|
-
DeviceType["Button"] = "button";
|
|
10808
|
-
/** Generic stateless event emitter — carries a device's EXACT declared
|
|
10809
|
-
* event vocabulary verbatim (no normalization). Installed with the
|
|
10810
|
-
* `event-emitter` cap. Sources: HA `event.*` entities (structured) and
|
|
10811
|
-
* HA bus events (e.g. `zha_event`, generic). */
|
|
10812
|
-
DeviceType["EventEmitter"] = "event-emitter";
|
|
10813
|
-
/** Firmware/software update entity — current vs available version,
|
|
10814
|
-
* updatable flag, update state, and an install action. Installed with
|
|
10815
|
-
* the `update` cap. Sources: Homematic firmware-update channels (and
|
|
10816
|
-
* reusable by other providers, e.g. HA `update.*` entities). */
|
|
10817
|
-
DeviceType["Update"] = "update";
|
|
10818
|
-
DeviceType["Generic"] = "generic";
|
|
10819
|
-
/** Generic notification delivery target (HA `notify.<service>`, future
|
|
10820
|
-
* Telegram / Discord / ntfy / SMTP, …). One device per delivery
|
|
10821
|
-
* endpoint; the `notifier` cap defines the send surface. */
|
|
10822
|
-
DeviceType["Notifier"] = "notifier";
|
|
10823
|
-
/** Pre-recorded action sequence with optional parameters
|
|
10824
|
-
* (HA `script.*`). Runnable via `script-runner` cap. */
|
|
10825
|
-
DeviceType["Script"] = "script";
|
|
10826
|
-
/** Automation rule (HA `automation.*`) — enable/disable + manual
|
|
10827
|
-
* trigger surface exposed via `automation-control` cap. */
|
|
10828
|
-
DeviceType["Automation"] = "automation";
|
|
10829
|
-
/** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
|
|
10830
|
-
DeviceType["Lock"] = "lock";
|
|
10831
|
-
/** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
|
|
10832
|
-
* `valve.*`). `cover` cap with sub-roles for variant. */
|
|
10833
|
-
DeviceType["Cover"] = "cover";
|
|
10834
|
-
/** Pipe / water / gas valve with open/close/stop and optional
|
|
10835
|
-
* position (HA `valve.*`). `valve` cap — a cover-sibling actuator
|
|
10836
|
-
* modelled on the same open/closed lifecycle. */
|
|
10837
|
-
DeviceType["Valve"] = "valve";
|
|
10838
|
-
/** Humidifier / dehumidifier with on/off + target humidity + mode
|
|
10839
|
-
* (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
|
|
10840
|
-
* modelled on the same target / mode lifecycle. */
|
|
10841
|
-
DeviceType["Humidifier"] = "humidifier";
|
|
10842
|
-
/** Water heater / boiler with target temperature + operation mode +
|
|
10843
|
-
* away mode (HA `water_heater.*`). `water-heater` cap — a
|
|
10844
|
-
* climate-family actuator. */
|
|
10845
|
-
DeviceType["WaterHeater"] = "water-heater";
|
|
10846
|
-
/** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
|
|
10847
|
-
DeviceType["Fan"] = "fan";
|
|
10848
|
-
/** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
|
|
10849
|
-
* the camera surface — those use `Camera`. `media-player` cap. */
|
|
10850
|
-
DeviceType["MediaPlayer"] = "media-player";
|
|
10851
|
-
/** Security panel / alarm system (HA `alarm_control_panel.*`).
|
|
10852
|
-
* `alarm-panel` cap. */
|
|
10853
|
-
DeviceType["AlarmPanel"] = "alarm-panel";
|
|
10854
|
-
/** Generic user-settable input (HA `number` / `input_number` / `select`
|
|
10855
|
-
* / `input_select` / `text` / `input_text` / `input_datetime`).
|
|
10856
|
-
* Sub-type via `DeviceRole`: NumericControl / SelectControl /
|
|
10857
|
-
* TextControl / DateTimeControl. */
|
|
10858
|
-
DeviceType["Control"] = "control";
|
|
10859
|
-
/** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
|
|
10860
|
-
* `presence` cap. */
|
|
10861
|
-
DeviceType["Presence"] = "presence";
|
|
10862
|
-
/** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
|
|
10863
|
-
* `weather` cap. */
|
|
10864
|
-
DeviceType["Weather"] = "weather";
|
|
10865
|
-
/** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
|
|
10866
|
-
DeviceType["Vacuum"] = "vacuum";
|
|
10867
|
-
/** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
|
|
10868
|
-
* `lawn-mower-control` cap. */
|
|
10869
|
-
DeviceType["LawnMower"] = "lawn-mower";
|
|
10870
|
-
/** Physical HA device group — parent container for entity-children
|
|
10871
|
-
* adopted from a single HA device entry. Not renderable as a
|
|
10872
|
-
* standalone device; exists only to anchor child entities. */
|
|
10873
|
-
DeviceType["Container"] = "container";
|
|
10874
|
-
/** Single still-image entity (HA `image.*`). Read-only display of an
|
|
10875
|
-
* `entity_picture` signed URL the browser loads directly. `image` cap. */
|
|
10876
|
-
DeviceType["Image"] = "image";
|
|
10877
|
-
/** Smart pet feeder — cloud-connected food dispenser with a bowl food
|
|
10878
|
-
* level, battery, desiccant life, feeding state and manual-feed /
|
|
10879
|
-
* call-pet / maintenance actions. Installed with the `pet-feeder` cap;
|
|
10880
|
-
* dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
|
|
10881
|
-
* native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
|
|
10882
|
-
* integrations sharing the same food/desiccant/hopper surface. */
|
|
10883
|
-
DeviceType["PetFeeder"] = "pet-feeder";
|
|
10884
|
-
/** Pet water fountain — tank level, water drunk, pump and its duty cycle.
|
|
10885
|
-
* Installed with the `pet-fountain` cap. Reaches CamStack as loose entities
|
|
10886
|
-
* of a container and is BUILT as a composed device (D967). */
|
|
10887
|
-
DeviceType["PetFountain"] = "pet-fountain";
|
|
10888
|
-
/** Built-in dishwasher — program lifecycle, door / remote-start gates,
|
|
10889
|
-
* salt and rinse-aid levels. Installed with the `dishwasher` cap.
|
|
10890
|
-
* Sources: native Bosch Home Connect, reusable by similar integrations.
|
|
10891
|
-
* A plug-built dishwasher carries running-state and power instead. */
|
|
10892
|
-
DeviceType["Dishwasher"] = "dishwasher";
|
|
10893
|
-
/** Washing machine. A plug-built one is running while its power stays
|
|
10894
|
-
* above a threshold. No program cap — that surface is the dishwasher's. */
|
|
10895
|
-
DeviceType["Washer"] = "washer";
|
|
10896
|
-
/** Tumble dryer. Same plug-built running surface as {@link Washer}. */
|
|
10897
|
-
DeviceType["Dryer"] = "dryer";
|
|
10898
|
-
/** The physical bridge box of a vendor ecosystem (Velux KLF-200, and later
|
|
10899
|
-
* other radio-to-IP bridges). It carries the box's own facts (firmware,
|
|
10900
|
-
* address, connection state) and the actions the box really supports
|
|
10901
|
-
* (`reboot`, `device-admin-link`). Products are NOT its children — they are
|
|
10902
|
-
* adopted beside it — and its connection settings stay on the integration. */
|
|
10903
|
-
DeviceType["Gateway"] = "gateway";
|
|
10904
|
-
return DeviceType;
|
|
10905
|
-
}({});
|
|
10906
|
-
var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
10907
|
-
DeviceFeature["BatteryOperated"] = "battery-operated";
|
|
10908
|
-
DeviceFeature["Rebootable"] = "rebootable";
|
|
10909
|
-
/**
|
|
10910
|
-
* Device supports an on-demand re-sync of its derived spec with its
|
|
10911
|
-
* upstream source — drives the generic Re-sync button. The owning
|
|
10912
|
-
* provider implements the action via the `device-adoption.resync` cap.
|
|
10913
|
-
*/
|
|
10914
|
-
DeviceFeature["Resyncable"] = "resyncable";
|
|
10915
|
-
DeviceFeature["NativeSnapshot"] = "native-snapshot";
|
|
10916
|
-
DeviceFeature["DoorbellButton"] = "doorbell-button";
|
|
10917
|
-
DeviceFeature["TwoWayAudio"] = "two-way-audio";
|
|
10918
|
-
DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
|
|
10919
|
-
/**
|
|
10920
|
-
* Camera supports the on-firmware autotrack subsystem (subject-
|
|
10921
|
-
* following). Distinct from `PanTiltZoom` because not every PTZ
|
|
10922
|
-
* camera ships autotrack — the admin UI uses this flag to gate
|
|
10923
|
-
* the autotrack toggle / settings card without re-deriving from
|
|
10924
|
-
* the cap registry. Mirrors `ptz-autotrack` cap registration:
|
|
10925
|
-
* driver sets this feature when probe confirms the firmware
|
|
10926
|
-
* surface, and registers the cap in the same code path.
|
|
10927
|
-
*/
|
|
10928
|
-
DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
|
|
10929
|
-
/**
|
|
10930
|
-
* Accessory exposes a "trigger on motion" toggle — the parent camera's
|
|
10931
|
-
* motion detection automatically activates this device. Mirrors
|
|
10932
|
-
* `motion-trigger` cap registration: drivers set this feature in the
|
|
10933
|
-
* same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
|
|
10934
|
-
*
|
|
10935
|
-
* Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
|
|
10936
|
-
* fast scalar without binding fetch), notifier rules, and `listAll`
|
|
10937
|
-
* filters that want "all devices with on-motion behaviour".
|
|
10938
|
-
*/
|
|
10939
|
-
DeviceFeature["MotionTrigger"] = "motion-trigger";
|
|
10940
|
-
/** Light supports rgb-triplet color via `color` cap. */
|
|
10941
|
-
DeviceFeature["LightColorRgb"] = "light-color-rgb";
|
|
10942
|
-
/** Light supports HSV color via `color` cap. */
|
|
10943
|
-
DeviceFeature["LightColorHsv"] = "light-color-hsv";
|
|
10944
|
-
/** Light supports color-temperature (mired) via `color` cap. */
|
|
10945
|
-
DeviceFeature["LightColorMired"] = "light-color-mired";
|
|
10946
|
-
/** Thermostat supports a `heat_cool` dual setpoint (targetLow +
|
|
10947
|
-
* targetHigh). Gates the range slider UI. */
|
|
10948
|
-
DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
|
|
10949
|
-
/** Thermostat exposes target humidity and/or current humidity
|
|
10950
|
-
* readings. Gates the humidity controls. */
|
|
10951
|
-
DeviceFeature["ClimateHumidity"] = "climate-humidity";
|
|
10952
|
-
/** Thermostat exposes a fan-mode selector. */
|
|
10953
|
-
DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
|
|
10954
|
-
/** Thermostat exposes preset modes (eco / away / sleep / vendor). */
|
|
10955
|
-
DeviceFeature["ClimatePreset"] = "climate-preset";
|
|
10956
|
-
/** Thermostat exposes a vertical louver swing toggle. Gates the
|
|
10957
|
-
* vertical-swing switch in the climate UI. Independent of horizontal. */
|
|
10958
|
-
DeviceFeature["ClimateSwingVertical"] = "climate-swing-vertical";
|
|
10959
|
-
/** Thermostat exposes a horizontal louver swing toggle. Gates the
|
|
10960
|
-
* horizontal-swing switch in the climate UI. Independent of vertical. */
|
|
10961
|
-
DeviceFeature["ClimateSwingHorizontal"] = "climate-swing-horizontal";
|
|
10962
|
-
/** Cover exposes intermediate position control (0..100). Gates the
|
|
10963
|
-
* position slider UI. */
|
|
10964
|
-
DeviceFeature["CoverPositionable"] = "cover-positionable";
|
|
10965
|
-
/** Cover exposes slat-tilt control. Gates the tilt slider UI. */
|
|
10966
|
-
DeviceFeature["CoverTilt"] = "cover-tilt";
|
|
10967
|
-
/** Valve exposes intermediate position control (0..100). Gates the
|
|
10968
|
-
* position slider / drag surface UI. */
|
|
10969
|
-
DeviceFeature["ValvePositionable"] = "valve-positionable";
|
|
10970
|
-
/** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
|
|
10971
|
-
DeviceFeature["FanSpeed"] = "fan-speed";
|
|
10972
|
-
/** Fan exposes a preset mode selector. */
|
|
10973
|
-
DeviceFeature["FanPreset"] = "fan-preset";
|
|
10974
|
-
/** Fan exposes blade direction (forward/reverse) — typical of
|
|
10975
|
-
* ceiling fans. */
|
|
10976
|
-
DeviceFeature["FanDirection"] = "fan-direction";
|
|
10977
|
-
/** Fan exposes an oscillation toggle. */
|
|
10978
|
-
DeviceFeature["FanOscillating"] = "fan-oscillating";
|
|
10979
|
-
/** Lock requires a PIN code on lock/unlock. Gates the code-entry
|
|
10980
|
-
* field on the UI lock-controls panel. */
|
|
10981
|
-
DeviceFeature["LockPinRequired"] = "lock-pin-required";
|
|
10982
|
-
/** Lock supports a latch-release ("open door") action distinct from
|
|
10983
|
-
* unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
|
|
10984
|
-
* `supported_features`. Gates the Open Door button in the UI. */
|
|
10985
|
-
DeviceFeature["LockOpen"] = "lock-open";
|
|
10986
|
-
/** Media player exposes a seek-to-position surface. */
|
|
10987
|
-
DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
|
|
10988
|
-
/** Media player exposes a volume-level setter. */
|
|
10989
|
-
DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
|
|
10990
|
-
/** Media player exposes a mute toggle distinct from volume=0. */
|
|
10991
|
-
DeviceFeature["MediaPlayerMute"] = "media-player-mute";
|
|
10992
|
-
/** Media player exposes a shuffle toggle. */
|
|
10993
|
-
DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
|
|
10994
|
-
/** Media player exposes a repeat mode (off / all / one). */
|
|
10995
|
-
DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
|
|
10996
|
-
/** Media player exposes a source / input selector. */
|
|
10997
|
-
DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
|
|
10998
|
-
/** Media player exposes a play-arbitrary-media surface (URL / id). */
|
|
10999
|
-
DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
|
|
11000
|
-
/** Media player exposes next-track. */
|
|
11001
|
-
DeviceFeature["MediaPlayerNext"] = "media-player-next";
|
|
11002
|
-
/** Media player exposes previous-track. */
|
|
11003
|
-
DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
|
|
11004
|
-
/** Media player exposes stop distinct from pause. */
|
|
11005
|
-
DeviceFeature["MediaPlayerStop"] = "media-player-stop";
|
|
11006
|
-
/** Alarm panel requires a PIN code on arm/disarm. */
|
|
11007
|
-
DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
|
|
11008
|
-
/** Presence device carries GPS coordinates (lat/lng/accuracy) in
|
|
11009
|
-
* addition to a textual location. */
|
|
11010
|
-
DeviceFeature["PresenceGps"] = "presence-gps";
|
|
11011
|
-
/** Notifier accepts an inline / URL image attachment. */
|
|
11012
|
-
DeviceFeature["NotifierImage"] = "notifier-image";
|
|
11013
|
-
/** Notifier accepts a priority hint (high/normal/low). */
|
|
11014
|
-
DeviceFeature["NotifierPriority"] = "notifier-priority";
|
|
11015
|
-
/** Notifier accepts a free-form `data` payload for platform-specific
|
|
11016
|
-
* fields. */
|
|
11017
|
-
DeviceFeature["NotifierData"] = "notifier-data";
|
|
11018
|
-
/** Notifier supports interactive action buttons / callbacks. */
|
|
11019
|
-
DeviceFeature["NotifierActions"] = "notifier-actions";
|
|
11020
|
-
/** Notifier supports per-call recipient targeting (multi-user). */
|
|
11021
|
-
DeviceFeature["NotifierRecipients"] = "notifier-recipients";
|
|
11022
|
-
/** Script runner accepts a variables map on each run invocation. */
|
|
11023
|
-
DeviceFeature["ScriptVariables"] = "script-variables";
|
|
11024
|
-
/** Automation `trigger` accepts a skipCondition flag — fires the
|
|
11025
|
-
* automation's actions while bypassing its condition block. */
|
|
11026
|
-
DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
|
|
11027
|
-
/** Robot vacuum exposes a live cleaning map (image child). Gates the
|
|
11028
|
-
* map tile in the vacuum UI. */
|
|
11029
|
-
DeviceFeature["VacuumHasMap"] = "vacuum-has-map";
|
|
11030
|
-
/** Robot vacuum exposes AI obstacle-detection toggles. Gates the AI
|
|
11031
|
-
* switches group. */
|
|
11032
|
-
DeviceFeature["VacuumHasAi"] = "vacuum-has-ai";
|
|
11033
|
-
/** Robot mower exposes a live mowing map (SVG image child). Gates the
|
|
11034
|
-
* mower map tile. */
|
|
11035
|
-
DeviceFeature["MowerHasMap"] = "mower-has-map";
|
|
11036
|
-
/** Robot mower exposes targeted mowing (all-area / zones / edges /
|
|
11037
|
-
* spots) — gates the Mow action + map selectors. */
|
|
11038
|
-
DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
|
|
11039
|
-
return DeviceFeature;
|
|
11040
|
-
}({});
|
|
11041
|
-
/**
|
|
11042
|
-
* Semantic role a device plays within its parent. Populated by driver
|
|
11043
|
-
* addons when creating accessory devices (Reolink siren/floodlight/
|
|
11044
|
-
* PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
|
|
11045
|
-
* admin UI to pick icons, labels, and widgets — a `Switch` with
|
|
11046
|
-
* `role: Floodlight` renders as a bulb with a brightness slider,
|
|
11047
|
-
* whereas a `Switch` with `role: Siren` renders as a klaxon.
|
|
11048
|
-
*
|
|
11049
|
-
* Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
|
|
11050
|
-
* sqlite as a nullable TEXT column — old rows keep working unchanged.
|
|
11051
|
-
*/
|
|
11052
|
-
var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
11053
|
-
DeviceRole["Siren"] = "siren";
|
|
11054
|
-
DeviceRole["Floodlight"] = "floodlight";
|
|
11055
|
-
DeviceRole["Spotlight"] = "spotlight";
|
|
11056
|
-
DeviceRole["PirSensor"] = "pir-sensor";
|
|
11057
|
-
DeviceRole["Chime"] = "chime";
|
|
11058
|
-
DeviceRole["Autotrack"] = "autotrack";
|
|
11059
|
-
DeviceRole["Nightvision"] = "nightvision";
|
|
11060
|
-
DeviceRole["PrivacyMask"] = "privacy-mask";
|
|
11061
|
-
DeviceRole["Doorbell"] = "doorbell";
|
|
11062
|
-
/** Interior blind / shade / roller blind. HA `device_class: blind|shade`. */
|
|
11063
|
-
DeviceRole["CoverBlind"] = "cover-blind";
|
|
11064
|
-
/** Exterior roller shutter. HA `device_class: shutter`; Homematic BROLL. */
|
|
11065
|
-
DeviceRole["CoverShutter"] = "cover-shutter";
|
|
11066
|
-
/** Exterior awning. HA `device_class: awning`. */
|
|
11067
|
-
DeviceRole["CoverAwning"] = "cover-awning";
|
|
11068
|
-
/** Curtain / drape. HA `device_class: curtain`. */
|
|
11069
|
-
DeviceRole["CoverCurtain"] = "cover-curtain";
|
|
11070
|
-
/** Garage door. HA `device_class: garage`. A security actuator: exports gate it. */
|
|
11071
|
-
DeviceRole["CoverGarage"] = "cover-garage";
|
|
11072
|
-
/** Gate. HA `device_class: gate`. A security actuator: exports gate it. */
|
|
11073
|
-
DeviceRole["CoverGate"] = "cover-gate";
|
|
11074
|
-
/** Door. HA `device_class: door`. A security actuator: exports gate it. */
|
|
11075
|
-
DeviceRole["CoverDoor"] = "cover-door";
|
|
11076
|
-
/** Window. HA `device_class: window`. */
|
|
11077
|
-
DeviceRole["CoverWindow"] = "cover-window";
|
|
11078
|
-
/** Virtual HA toggle (input_boolean.*) — distinguishable from a
|
|
11079
|
-
* real Switch device for UI rendering / export adapters. */
|
|
11080
|
-
DeviceRole["BinaryHelper"] = "binary-helper";
|
|
11081
|
-
/** A smart plug: a `switch` whose source says it is an outlet (HA
|
|
11082
|
-
* `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
|
|
11083
|
-
DeviceRole["Outlet"] = "outlet";
|
|
11084
|
-
/** Generic motion / occupancy / moving event source. Distinct from
|
|
11085
|
-
* the camera accessory PirSensor role: that one is a camera child;
|
|
11086
|
-
* this is a standalone HA / 3rd-party motion sensor. */
|
|
11087
|
-
DeviceRole["MotionSensor"] = "motion-sensor";
|
|
11088
|
-
DeviceRole["ContactSensor"] = "contact-sensor";
|
|
11089
|
-
DeviceRole["LeakSensor"] = "leak-sensor";
|
|
11090
|
-
DeviceRole["SmokeSensor"] = "smoke-sensor";
|
|
11091
|
-
DeviceRole["COSensor"] = "co-sensor";
|
|
11092
|
-
DeviceRole["GasSensor"] = "gas-sensor";
|
|
11093
|
-
DeviceRole["TamperSensor"] = "tamper-sensor";
|
|
11094
|
-
DeviceRole["VibrationSensor"] = "vibration-sensor";
|
|
11095
|
-
DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
|
|
11096
|
-
DeviceRole["SoundSensor"] = "sound-sensor";
|
|
11097
|
-
/** Fallback for `binary_sensor` without a known `device_class`. */
|
|
11098
|
-
DeviceRole["BinarySensor"] = "binary-sensor";
|
|
11099
|
-
DeviceRole["TemperatureSensor"] = "temperature-sensor";
|
|
11100
|
-
DeviceRole["HumiditySensor"] = "humidity-sensor";
|
|
11101
|
-
DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
|
|
11102
|
-
DeviceRole["PressureSensor"] = "pressure-sensor";
|
|
11103
|
-
/** Wind speed or direction (weather-station `wind-sensor` cap). */
|
|
11104
|
-
DeviceRole["WindSensor"] = "wind-sensor";
|
|
11105
|
-
/** Rain accumulation or rate (weather-station `rain-sensor` cap). */
|
|
11106
|
-
DeviceRole["RainSensor"] = "rain-sensor";
|
|
11107
|
-
/** UV index (weather-station `uv-sensor` cap). */
|
|
11108
|
-
DeviceRole["UvSensor"] = "uv-sensor";
|
|
11109
|
-
/** Solar irradiance W/m² (weather-station `solar-radiation-sensor` cap).
|
|
11110
|
-
* Distinct from AmbientLightSensor (lux). */
|
|
11111
|
-
DeviceRole["SolarRadiationSensor"] = "solar-radiation-sensor";
|
|
11112
|
-
/** Soil moisture % (garden/weather `soil-moisture-sensor` cap). */
|
|
11113
|
-
DeviceRole["SoilMoistureSensor"] = "soil-moisture-sensor";
|
|
11114
|
-
DeviceRole["PowerSensor"] = "power-sensor";
|
|
11115
|
-
DeviceRole["EnergySensor"] = "energy-sensor";
|
|
11116
|
-
DeviceRole["VoltageSensor"] = "voltage-sensor";
|
|
11117
|
-
DeviceRole["CurrentSensor"] = "current-sensor";
|
|
11118
|
-
DeviceRole["AirQualitySensor"] = "air-quality-sensor";
|
|
11119
|
-
/** Battery level (numeric % via `sensor` OR low-bool via
|
|
11120
|
-
* `binary_sensor` — the cap distinguishes via the value type). */
|
|
11121
|
-
DeviceRole["BatterySensor"] = "battery-sensor";
|
|
11122
|
-
/** Fallback for `sensor` numeric without a known `device_class`. */
|
|
11123
|
-
DeviceRole["NumericSensor"] = "numeric-sensor";
|
|
11124
|
-
/** String / enum state (HA `sensor` with `state_class: enum` or
|
|
11125
|
-
* `attributes.options`). */
|
|
11126
|
-
DeviceRole["EnumSensor"] = "enum-sensor";
|
|
11127
|
-
/** Date / timestamp state (HA `sensor` with `device_class: timestamp`
|
|
11128
|
-
* or `date`). The slice carries the raw ISO string verbatim (hosted on
|
|
11129
|
-
* the `enum-sensor` cap); the UI renders it locale-formatted. */
|
|
11130
|
-
DeviceRole["DateTimeSensor"] = "datetime-sensor";
|
|
11131
|
-
/** Last-resort fallback when nothing else matches. */
|
|
11132
|
-
DeviceRole["GenericSensor"] = "generic-sensor";
|
|
11133
|
-
DeviceRole["NumericControl"] = "numeric-control";
|
|
11134
|
-
DeviceRole["SelectControl"] = "select-control";
|
|
11135
|
-
DeviceRole["TextControl"] = "text-control";
|
|
11136
|
-
DeviceRole["DateTimeControl"] = "datetime-control";
|
|
11137
|
-
/** Mobile push notifier (HA `notify.mobile_app_*`) — supports
|
|
11138
|
-
* rich features (image, priority, channel routing). */
|
|
11139
|
-
DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
|
|
11140
|
-
/** Chat / messaging service (HA `notify.telegram_*`,
|
|
11141
|
-
* `notify.discord_*`, etc.). */
|
|
11142
|
-
DeviceRole["MessagingNotifier"] = "messaging-notifier";
|
|
11143
|
-
/** Email-based delivery (HA `notify.smtp`, etc.). */
|
|
11144
|
-
DeviceRole["EmailNotifier"] = "email-notifier";
|
|
11145
|
-
/** Fallback when the notifier service name doesn't match a known
|
|
11146
|
-
* pattern. */
|
|
11147
|
-
DeviceRole["GenericNotifier"] = "generic-notifier";
|
|
11148
|
-
/** Emits a pulse train (infrared or RF) on request — the `ir-transmitter`
|
|
11149
|
-
* cap. A `DeviceType.Generic` device. */
|
|
11150
|
-
DeviceRole["IrTransmitter"] = "ir-transmitter";
|
|
11151
|
-
return DeviceRole;
|
|
11152
|
-
}({});
|
|
11153
|
-
/**
|
|
11154
|
-
import { errMsg } from '@camstack/types'
|
|
11155
|
-
* Extract a human-readable message from an unknown error value.
|
|
11156
|
-
* Replaces the ubiquitous `errMsg(err)` pattern.
|
|
11157
|
-
*/
|
|
11158
|
-
function errMsg(err) {
|
|
11159
|
-
if (err instanceof Error) return err.message;
|
|
11160
|
-
if (typeof err === "string") return err;
|
|
11161
|
-
return String(err);
|
|
11162
|
-
}
|
|
11163
|
-
//#endregion
|
|
11164
|
-
//#region ../types/dist/composition-C7WdThmP.mjs
|
|
11295
|
+
//#region ../types/dist/composition-BBzVf2xd.mjs
|
|
11165
11296
|
/**
|
|
11166
11297
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
11167
11298
|
*
|
|
@@ -12380,6 +12511,71 @@ var EventOwnerTypeSchema = _enum(EVENT_OWNER_TYPES);
|
|
|
12380
12511
|
var MediaPresenceOwnerKindSchema = _enum([...EVENT_OWNER_TYPES, "track"]);
|
|
12381
12512
|
new Set(EVENT_OWNER_TYPES);
|
|
12382
12513
|
/**
|
|
12514
|
+
* What a published package needs from the rest of the install (D989).
|
|
12515
|
+
*
|
|
12516
|
+
* One published framework package (`@camstack/server`) carries the kernel, the
|
|
12517
|
+
* builtins and the capability contracts, so "which addon runs on which
|
|
12518
|
+
* framework" is a question of version, and the answer is DECLARED by the
|
|
12519
|
+
* package that knows it:
|
|
12520
|
+
*
|
|
12521
|
+
* - an addon says the oldest server it runs on (`requires.server: ">=X"`);
|
|
12522
|
+
* - the server says the oldest addon it works with
|
|
12523
|
+
* (`requires.addons: { "@camstack/addon-x": ">=Y" }`) and the oldest shell
|
|
12524
|
+
* around it (`requires.wrapper: { desktop, image }`);
|
|
12525
|
+
* - a wrapper (the desktop app, the container starter) says which server
|
|
12526
|
+
* range it can host, and reports its own kind and version.
|
|
12527
|
+
*
|
|
12528
|
+
* The publish workflow STAMPS these after the version bump
|
|
12529
|
+
* (`scripts/ci/stamp-requires.mjs`); nobody types a number by hand.
|
|
12530
|
+
*
|
|
12531
|
+
* A requirement that cannot be checked is NOT met: a shell that reports no
|
|
12532
|
+
* version counts as below the minimum, and an unreadable running version is
|
|
12533
|
+
* named in the result (a failed read is never a pass).
|
|
12534
|
+
*/
|
|
12535
|
+
/** `>=MAJOR.MINOR.PATCH[-prerelease]` — the only range shape a requirement uses. */
|
|
12536
|
+
var MinVersionSchema = string().regex(/^>=\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/, "a minimum is written \">=X.Y.Z\"");
|
|
12537
|
+
object({
|
|
12538
|
+
/** The oldest `@camstack/server` this package runs on. */
|
|
12539
|
+
server: MinVersionSchema.optional(),
|
|
12540
|
+
/** The oldest installed version of each named addon package. */
|
|
12541
|
+
addons: record(string(), MinVersionSchema).optional(),
|
|
12542
|
+
/** The oldest shell around the server, per shell kind. */
|
|
12543
|
+
wrapper: object({
|
|
12544
|
+
desktop: MinVersionSchema.optional(),
|
|
12545
|
+
image: MinVersionSchema.optional()
|
|
12546
|
+
}).optional()
|
|
12547
|
+
});
|
|
12548
|
+
/** One unmet requirement; each names the versions on both sides. */
|
|
12549
|
+
var UnmetRequirementSchema = discriminatedUnion("kind", [
|
|
12550
|
+
object({
|
|
12551
|
+
kind: literal("server-too-old"),
|
|
12552
|
+
required: string(),
|
|
12553
|
+
/** `null` — the running server version could not be read. */
|
|
12554
|
+
running: string().nullable()
|
|
12555
|
+
}),
|
|
12556
|
+
object({
|
|
12557
|
+
kind: literal("addon-too-old"),
|
|
12558
|
+
packageName: string(),
|
|
12559
|
+
required: string(),
|
|
12560
|
+
/** `null` — the addon is not installed (or its version is unreadable). */
|
|
12561
|
+
running: string().nullable()
|
|
12562
|
+
}),
|
|
12563
|
+
object({
|
|
12564
|
+
kind: literal("wrapper-too-old"),
|
|
12565
|
+
wrapper: _enum(["desktop", "image"]),
|
|
12566
|
+
required: string(),
|
|
12567
|
+
/** `null` — the wrapper reported no version. */
|
|
12568
|
+
running: string().nullable()
|
|
12569
|
+
})
|
|
12570
|
+
]);
|
|
12571
|
+
var RequiredAddonUpdateSchema = object({
|
|
12572
|
+
packageName: string(),
|
|
12573
|
+
/** The minimum the target server declares. */
|
|
12574
|
+
required: string(),
|
|
12575
|
+
/** What this node has; `null` when the addon is not installed. */
|
|
12576
|
+
installed: string().nullable()
|
|
12577
|
+
});
|
|
12578
|
+
/**
|
|
12383
12579
|
* Which integration instance a settings form is for. An addon that serves several instances
|
|
12384
12580
|
* (`instanceMode: multiple`) can show a different form per instance — an NVR integration
|
|
12385
12581
|
* needs its connection, the default integration needs the addon's own sections.
|
|
@@ -12854,6 +13050,613 @@ var CameraSwitchGroupSchema = object({
|
|
|
12854
13050
|
fetchedAt: number()
|
|
12855
13051
|
});
|
|
12856
13052
|
/**
|
|
13053
|
+
* Query filter for settings-store collections.
|
|
13054
|
+
*/
|
|
13055
|
+
var QueryFilterSchema = object({
|
|
13056
|
+
where: record(string(), unknown()).optional(),
|
|
13057
|
+
whereIn: record(string(), array(unknown())).optional(),
|
|
13058
|
+
whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
|
|
13059
|
+
/** NULL-safe exclusion: matches rows whose field is NULL OR != the value. */
|
|
13060
|
+
whereNot: record(string(), unknown()).optional(),
|
|
13061
|
+
/** NULL-safe exclusion of a SET — `whereNot` for more than one value. An
|
|
13062
|
+
* empty list excludes nothing. See `QueryFilter.whereNotIn`. */
|
|
13063
|
+
whereNotIn: record(string(), array(unknown())).optional(),
|
|
13064
|
+
orderBy: object({
|
|
13065
|
+
field: string(),
|
|
13066
|
+
direction: _enum(["asc", "desc"])
|
|
13067
|
+
}).optional(),
|
|
13068
|
+
limit: number().optional(),
|
|
13069
|
+
offset: number().optional()
|
|
13070
|
+
});
|
|
13071
|
+
/**
|
|
13072
|
+
* The predicate half of a filter, for BULK MUTATIONS.
|
|
13073
|
+
*
|
|
13074
|
+
* Deliberately not `QueryFilterSchema`: `orderBy` / `limit` / `offset` have no
|
|
13075
|
+
* meaning for a statement that rewrites a set, and accepting them would invite
|
|
13076
|
+
* a caller to believe `limit` bounds the damage. Every field is optional here
|
|
13077
|
+
* only so the shape stays composable — the implementation REJECTS a filter
|
|
13078
|
+
* that compiles to no predicate, because that is the whole collection.
|
|
13079
|
+
*/
|
|
13080
|
+
var MutationFilterSchema = object({
|
|
13081
|
+
where: record(string(), unknown()).optional(),
|
|
13082
|
+
whereIn: record(string(), array(unknown())).optional(),
|
|
13083
|
+
whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
|
|
13084
|
+
whereNot: record(string(), unknown()).optional(),
|
|
13085
|
+
whereNotIn: record(string(), array(unknown())).optional()
|
|
13086
|
+
});
|
|
13087
|
+
/**
|
|
13088
|
+
* One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
|
|
13089
|
+
*
|
|
13090
|
+
* `as` names the slot in the result, so the SAME column may be asked twice with
|
|
13091
|
+
* two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
|
|
13092
|
+
* a `Record<column, op>` shape could not express.
|
|
13093
|
+
*/
|
|
13094
|
+
var AggregateFieldSchema = object({
|
|
13095
|
+
/** Result key. */
|
|
13096
|
+
as: string().min(1),
|
|
13097
|
+
/** Column to aggregate. Must be a real column of a declared collection. */
|
|
13098
|
+
field: string().min(1),
|
|
13099
|
+
op: _enum([
|
|
13100
|
+
"sum",
|
|
13101
|
+
"min",
|
|
13102
|
+
"max"
|
|
13103
|
+
])
|
|
13104
|
+
});
|
|
13105
|
+
/**
|
|
13106
|
+
* `COUNT(*)` plus one number per requested field.
|
|
13107
|
+
*
|
|
13108
|
+
* `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
|
|
13109
|
+
* that really is 0 are different facts, and an accounting caller that renders
|
|
13110
|
+
* "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
|
|
13111
|
+
*/
|
|
13112
|
+
var AggregateResultSchema = object({
|
|
13113
|
+
count: number().int(),
|
|
13114
|
+
values: record(string(), number().nullable())
|
|
13115
|
+
});
|
|
13116
|
+
/** A single stored record: `{ id, data }`. */
|
|
13117
|
+
var SettingsRecordSchema = object({
|
|
13118
|
+
id: string(),
|
|
13119
|
+
data: record(string(), unknown())
|
|
13120
|
+
});
|
|
13121
|
+
/**
|
|
13122
|
+
* One record of a BULK insert — {@link SettingsRecordSchema} with the id made
|
|
13123
|
+
* optional.
|
|
13124
|
+
*
|
|
13125
|
+
* A separate schema rather than loosening the shared one: every other method
|
|
13126
|
+
* on this cap addresses a row BY its id, and making that field optional
|
|
13127
|
+
* everywhere would turn a forgotten key into a silently generated one on
|
|
13128
|
+
* `update` and `delete` as well.
|
|
13129
|
+
*/
|
|
13130
|
+
var BulkRecordSchema = object({
|
|
13131
|
+
id: string().optional(),
|
|
13132
|
+
data: record(string(), unknown())
|
|
13133
|
+
});
|
|
13134
|
+
/**
|
|
13135
|
+
* The database FILES one `sqlite-settings` engine process owns (D851).
|
|
13136
|
+
* Closed on purpose: a file is a thing the engine opens, backs up and gives a
|
|
13137
|
+
* serving thread, so a new one is a code change, never a string a caller
|
|
13138
|
+
* invents. `settings` is `camstack.db` and the default for every collection
|
|
13139
|
+
* that names no file.
|
|
13140
|
+
*/
|
|
13141
|
+
var DataStoreDatabaseSchema = _enum([
|
|
13142
|
+
"settings",
|
|
13143
|
+
"events",
|
|
13144
|
+
"history"
|
|
13145
|
+
]);
|
|
13146
|
+
DataStoreDatabaseSchema.options;
|
|
13147
|
+
/**
|
|
13148
|
+
* One write inside a {@link settingsStoreCapability.methods.transact} call.
|
|
13149
|
+
* The three that a "replace this set, bump that revision" write needs, plus
|
|
13150
|
+
* the batched upsert a rollup writer needs.
|
|
13151
|
+
*/
|
|
13152
|
+
var TransactOpSchema = discriminatedUnion("op", [
|
|
13153
|
+
object({
|
|
13154
|
+
op: literal("deleteWhere"),
|
|
13155
|
+
collection: string(),
|
|
13156
|
+
filter: MutationFilterSchema
|
|
13157
|
+
}),
|
|
13158
|
+
object({
|
|
13159
|
+
op: literal("insertMany"),
|
|
13160
|
+
collection: string(),
|
|
13161
|
+
records: array(BulkRecordSchema).readonly()
|
|
13162
|
+
}),
|
|
13163
|
+
object({
|
|
13164
|
+
op: literal("update"),
|
|
13165
|
+
collection: string(),
|
|
13166
|
+
id: string(),
|
|
13167
|
+
data: record(string(), unknown())
|
|
13168
|
+
}),
|
|
13169
|
+
object({
|
|
13170
|
+
op: literal("upsertMany"),
|
|
13171
|
+
collection: string(),
|
|
13172
|
+
conflict: array(string()).readonly(),
|
|
13173
|
+
records: array(BulkRecordSchema).readonly()
|
|
13174
|
+
})
|
|
13175
|
+
]);
|
|
13176
|
+
/**
|
|
13177
|
+
* The precondition of a transaction: the row `key` of `collection` must hold
|
|
13178
|
+
* `equals` in `column`, read INSIDE the transaction.
|
|
13179
|
+
*/
|
|
13180
|
+
var TransactGuardSchema = object({
|
|
13181
|
+
collection: string(),
|
|
13182
|
+
key: string(),
|
|
13183
|
+
column: string(),
|
|
13184
|
+
equals: unknown()
|
|
13185
|
+
});
|
|
13186
|
+
/**
|
|
13187
|
+
* Column declaration for a structured (SQL-backed) collection.
|
|
13188
|
+
*
|
|
13189
|
+
* Logical types — the backend translates each to the matching SQLite
|
|
13190
|
+
* storage class and handles per-type marshaling:
|
|
13191
|
+
* - `TEXT` / `INTEGER` / `REAL` — native SQLite types, pass-through
|
|
13192
|
+
* - `JSON` — TEXT under the hood; serialised on write, parsed on read
|
|
13193
|
+
* - `BOOLEAN` — INTEGER 0/1 under the hood; coerced both directions
|
|
13194
|
+
*/
|
|
13195
|
+
var CollectionColumnSchema = object({
|
|
13196
|
+
name: string(),
|
|
13197
|
+
type: _enum([
|
|
13198
|
+
"TEXT",
|
|
13199
|
+
"INTEGER",
|
|
13200
|
+
"REAL",
|
|
13201
|
+
"JSON",
|
|
13202
|
+
"BOOLEAN"
|
|
13203
|
+
]),
|
|
13204
|
+
primaryKey: boolean().optional(),
|
|
13205
|
+
notNull: boolean().optional(),
|
|
13206
|
+
unique: boolean().optional(),
|
|
13207
|
+
/**
|
|
13208
|
+
* Column DEFAULT. Required for B2: the four `ensureTable` consumers declare
|
|
13209
|
+
* columns like `enabled INTEGER NOT NULL DEFAULT 1`, and without this the
|
|
13210
|
+
* collection surface simply cannot express their existing tables — which is
|
|
13211
|
+
* why they were still on the uncapped `table*` API.
|
|
13212
|
+
*/
|
|
13213
|
+
defaultValue: union([
|
|
13214
|
+
string(),
|
|
13215
|
+
number(),
|
|
13216
|
+
boolean()
|
|
13217
|
+
]).optional()
|
|
13218
|
+
});
|
|
13219
|
+
var CollectionIndexSchema = object({
|
|
13220
|
+
name: string(),
|
|
13221
|
+
columns: array(string()).readonly(),
|
|
13222
|
+
unique: boolean().optional()
|
|
13223
|
+
});
|
|
13224
|
+
/**
|
|
13225
|
+
* The input of `declareCollection` — ONE schema for the door and for the
|
|
13226
|
+
* engine behind it, so the two surfaces cannot drift (the dispatcher forwards
|
|
13227
|
+
* the payload untouched).
|
|
13228
|
+
*
|
|
13229
|
+
* - `database` — the file the collection lives in (D851). Absent means
|
|
13230
|
+
* `settings`. A declaration naming a file other than the one the table is
|
|
13231
|
+
* already in is REFUSED by the engine, never moved.
|
|
13232
|
+
* - `primaryKey` — a COMPOSITE key, as column names. A single name is the same
|
|
13233
|
+
* as `primaryKey: true` on that column. A composite-keyed collection has no
|
|
13234
|
+
* `id`: it is written with `insertMany` / `upsertMany` / `transact` and read
|
|
13235
|
+
* with `query` / `count` / `aggregate` / `deleteWhere`; the calls that
|
|
13236
|
+
* address one row by id are refused.
|
|
13237
|
+
* - `withoutRowid` — emit `WITHOUT ROWID`. Requires a primary key.
|
|
13238
|
+
*/
|
|
13239
|
+
var DeclareCollectionInputSchema = object({
|
|
13240
|
+
namespace: string().optional(),
|
|
13241
|
+
collection: string(),
|
|
13242
|
+
columns: array(CollectionColumnSchema).readonly(),
|
|
13243
|
+
indexes: array(CollectionIndexSchema).readonly().optional(),
|
|
13244
|
+
database: DataStoreDatabaseSchema.optional(),
|
|
13245
|
+
primaryKey: array(string()).readonly().optional(),
|
|
13246
|
+
withoutRowid: boolean().optional()
|
|
13247
|
+
});
|
|
13248
|
+
method(object({
|
|
13249
|
+
namespace: string().optional(),
|
|
13250
|
+
collection: string(),
|
|
13251
|
+
key: string()
|
|
13252
|
+
}), unknown(), { auth: "admin" }), method(object({
|
|
13253
|
+
namespace: string().optional(),
|
|
13254
|
+
collection: string(),
|
|
13255
|
+
key: string(),
|
|
13256
|
+
value: unknown()
|
|
13257
|
+
}), _void(), {
|
|
13258
|
+
kind: "mutation",
|
|
13259
|
+
auth: "admin"
|
|
13260
|
+
}), method(object({
|
|
13261
|
+
namespace: string().optional(),
|
|
13262
|
+
collection: string(),
|
|
13263
|
+
filter: QueryFilterSchema.optional(),
|
|
13264
|
+
columns: array(string()).readonly().optional()
|
|
13265
|
+
}), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
|
|
13266
|
+
namespace: string().optional(),
|
|
13267
|
+
collection: string(),
|
|
13268
|
+
/** Declared columns identifying the slot; must be covered by a UNIQUE
|
|
13269
|
+
* index on the collection. Never empty. */
|
|
13270
|
+
conflict: array(string()).readonly(),
|
|
13271
|
+
record: BulkRecordSchema
|
|
13272
|
+
}), object({
|
|
13273
|
+
/** The id the row HAS: assigned by SQLite on an insert, or the existing
|
|
13274
|
+
* row's own id on an update. */
|
|
13275
|
+
id: union([string(), number()]) }), {
|
|
13276
|
+
kind: "mutation",
|
|
13277
|
+
auth: "admin"
|
|
13278
|
+
}), method(object({
|
|
13279
|
+
namespace: string().optional(),
|
|
13280
|
+
collection: string(),
|
|
13281
|
+
conflict: array(string()).readonly(),
|
|
13282
|
+
records: array(BulkRecordSchema).readonly()
|
|
13283
|
+
}), object({ upserted: number().int() }), {
|
|
13284
|
+
kind: "mutation",
|
|
13285
|
+
auth: "admin"
|
|
13286
|
+
}), method(object({
|
|
13287
|
+
namespace: string().optional(),
|
|
13288
|
+
collection: string(),
|
|
13289
|
+
record: object({
|
|
13290
|
+
id: string().optional(),
|
|
13291
|
+
data: record(string(), unknown())
|
|
13292
|
+
})
|
|
13293
|
+
}), object({
|
|
13294
|
+
/**
|
|
13295
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
13296
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
13297
|
+
* primary key — which is the only place an auto key is knowable.
|
|
13298
|
+
*/
|
|
13299
|
+
id: union([string(), number()]) }), {
|
|
13300
|
+
kind: "mutation",
|
|
13301
|
+
auth: "admin"
|
|
13302
|
+
}), method(object({
|
|
13303
|
+
namespace: string().optional(),
|
|
13304
|
+
collection: string(),
|
|
13305
|
+
records: array(BulkRecordSchema).readonly()
|
|
13306
|
+
}), object({ inserted: number().int() }), {
|
|
13307
|
+
kind: "mutation",
|
|
13308
|
+
auth: "admin"
|
|
13309
|
+
}), method(object({
|
|
13310
|
+
namespace: string().optional(),
|
|
13311
|
+
guard: TransactGuardSchema.optional(),
|
|
13312
|
+
ops: array(TransactOpSchema).readonly()
|
|
13313
|
+
}), object({
|
|
13314
|
+
applied: boolean(),
|
|
13315
|
+
current: unknown().optional()
|
|
13316
|
+
}), {
|
|
13317
|
+
kind: "mutation",
|
|
13318
|
+
auth: "admin"
|
|
13319
|
+
}), method(object({
|
|
13320
|
+
namespace: string().optional(),
|
|
13321
|
+
collection: string(),
|
|
13322
|
+
id: string(),
|
|
13323
|
+
data: record(string(), unknown())
|
|
13324
|
+
}), _void(), {
|
|
13325
|
+
kind: "mutation",
|
|
13326
|
+
auth: "admin"
|
|
13327
|
+
}), method(object({
|
|
13328
|
+
namespace: string().optional(),
|
|
13329
|
+
collection: string(),
|
|
13330
|
+
key: string()
|
|
13331
|
+
}), _void(), {
|
|
13332
|
+
kind: "mutation",
|
|
13333
|
+
auth: "admin"
|
|
13334
|
+
}), method(object({
|
|
13335
|
+
namespace: string().optional(),
|
|
13336
|
+
collection: string(),
|
|
13337
|
+
filter: MutationFilterSchema
|
|
13338
|
+
}), object({ deleted: number().int() }), {
|
|
13339
|
+
kind: "mutation",
|
|
13340
|
+
auth: "admin"
|
|
13341
|
+
}), method(object({
|
|
13342
|
+
namespace: string().optional(),
|
|
13343
|
+
collection: string(),
|
|
13344
|
+
filter: MutationFilterSchema,
|
|
13345
|
+
data: record(string(), unknown())
|
|
13346
|
+
}), object({ updated: number().int() }), {
|
|
13347
|
+
kind: "mutation",
|
|
13348
|
+
auth: "admin"
|
|
13349
|
+
}), method(object({
|
|
13350
|
+
namespace: string().optional(),
|
|
13351
|
+
collection: string(),
|
|
13352
|
+
filter: QueryFilterSchema.optional()
|
|
13353
|
+
}), number(), { auth: "admin" }), method(object({
|
|
13354
|
+
namespace: string().optional(),
|
|
13355
|
+
collection: string(),
|
|
13356
|
+
fields: array(AggregateFieldSchema).readonly(),
|
|
13357
|
+
filter: QueryFilterSchema.optional()
|
|
13358
|
+
}), AggregateResultSchema, { auth: "admin" }), method(object({
|
|
13359
|
+
namespace: string().optional(),
|
|
13360
|
+
collection: string(),
|
|
13361
|
+
field: string(),
|
|
13362
|
+
bucketSize: number().int().positive(),
|
|
13363
|
+
origin: number().int(),
|
|
13364
|
+
filter: QueryFilterSchema.optional()
|
|
13365
|
+
}), array(object({
|
|
13366
|
+
bucket: number().int(),
|
|
13367
|
+
count: number().int()
|
|
13368
|
+
})).readonly(), { auth: "admin" }), method(object({
|
|
13369
|
+
namespace: string().optional(),
|
|
13370
|
+
collection: string()
|
|
13371
|
+
}), boolean(), { auth: "admin" }), method(DeclareCollectionInputSchema, _void(), {
|
|
13372
|
+
kind: "mutation",
|
|
13373
|
+
auth: "admin"
|
|
13374
|
+
});
|
|
13375
|
+
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>\"");
|
|
13376
|
+
var MigrationLevelSchema = _enum([
|
|
13377
|
+
"hub-store",
|
|
13378
|
+
"addon-state",
|
|
13379
|
+
"node-config",
|
|
13380
|
+
"viewer",
|
|
13381
|
+
"addon-internal"
|
|
13382
|
+
]);
|
|
13383
|
+
var MigrationStoreSchema = _enum([
|
|
13384
|
+
"settings",
|
|
13385
|
+
"events",
|
|
13386
|
+
"history",
|
|
13387
|
+
"node-local",
|
|
13388
|
+
"addon-files"
|
|
13389
|
+
]);
|
|
13390
|
+
var MigrationScopeSchema = _enum(["cluster", "per-node"]);
|
|
13391
|
+
/** What depends on a migration while it is pending: `block-owner` is the default. */
|
|
13392
|
+
var MigrationOnFailureSchema = _enum(["block-owner", "tolerate"]);
|
|
13393
|
+
/**
|
|
13394
|
+
* `sql` is a hub-only body over the owner's connection. `plan` returns edits the
|
|
13395
|
+
* engine applies inside the migration's own transaction (hub-owned: computed in
|
|
13396
|
+
* that transaction; addon-owned: computed by the owner and shipped to the engine).
|
|
13397
|
+
* `procedure` is addon-owned work that is not SQL (keychain, integration registry,
|
|
13398
|
+
* device tombstones); the ledger records its outcome and it must be idempotent.
|
|
13399
|
+
*/
|
|
13400
|
+
var MigrationBodyKindSchema = _enum([
|
|
13401
|
+
"sql",
|
|
13402
|
+
"plan",
|
|
13403
|
+
"procedure"
|
|
13404
|
+
]);
|
|
13405
|
+
var MigrationMetaSchema = object({
|
|
13406
|
+
id: MigrationIdSchema,
|
|
13407
|
+
/** `hub`, an addon id, `node` or `viewer`. */
|
|
13408
|
+
owner: string().regex(/^[a-z0-9-]+$/),
|
|
13409
|
+
level: MigrationLevelSchema,
|
|
13410
|
+
/** Strictly increasing per owner: the order within an owner. */
|
|
13411
|
+
seq: number().int().positive(),
|
|
13412
|
+
/** Ids of any owner: the order across owners. */
|
|
13413
|
+
dependsOn: array(MigrationIdSchema),
|
|
13414
|
+
store: MigrationStoreSchema,
|
|
13415
|
+
scope: MigrationScopeSchema,
|
|
13416
|
+
onFailure: MigrationOnFailureSchema,
|
|
13417
|
+
bodyKind: MigrationBodyKindSchema,
|
|
13418
|
+
description: string().min(1),
|
|
13419
|
+
/** The marked field the migration's spec must assert survived. */
|
|
13420
|
+
fixtureMark: string().min(1)
|
|
13421
|
+
}).refine((m) => m.id.startsWith(`${m.owner}/`), {
|
|
13422
|
+
message: "the id must start with \"<owner>/\"",
|
|
13423
|
+
path: ["id"]
|
|
13424
|
+
});
|
|
13425
|
+
/** A cycle in the dependency graph, named by the ids on it. */
|
|
13426
|
+
var MigrationCycleError = class extends Error {
|
|
13427
|
+
ids;
|
|
13428
|
+
constructor(ids) {
|
|
13429
|
+
super(`migration dependsOn cycle: ${ids.join(" -> ")}`);
|
|
13430
|
+
this.ids = ids;
|
|
13431
|
+
this.name = "MigrationCycleError";
|
|
13432
|
+
}
|
|
13433
|
+
};
|
|
13434
|
+
/**
|
|
13435
|
+
* Topological order over `dependsOn` plus the implicit edge "a lower `seq` of an
|
|
13436
|
+
* owner runs first". Ties are broken by `(owner, seq)`. Throws
|
|
13437
|
+
* {@link MigrationCycleError} on a cycle. A `dependsOn` id that is not in the list
|
|
13438
|
+
* is ignored here — the catalogue schema is what refuses it.
|
|
13439
|
+
*/
|
|
13440
|
+
function orderMigrations(items) {
|
|
13441
|
+
const byId = new Map(items.map((item) => [item.id, item]));
|
|
13442
|
+
const deps = /* @__PURE__ */ new Map();
|
|
13443
|
+
const ownerSorted = /* @__PURE__ */ new Map();
|
|
13444
|
+
for (const item of items) {
|
|
13445
|
+
const list = ownerSorted.get(item.owner) ?? [];
|
|
13446
|
+
list.push(item);
|
|
13447
|
+
ownerSorted.set(item.owner, list);
|
|
13448
|
+
}
|
|
13449
|
+
for (const item of items) deps.set(item.id, new Set(item.dependsOn.filter((id) => byId.has(id))));
|
|
13450
|
+
for (const list of ownerSorted.values()) {
|
|
13451
|
+
list.sort((a, b) => a.seq - b.seq);
|
|
13452
|
+
for (let i = 1; i < list.length; i++) {
|
|
13453
|
+
const previous = list[i - 1];
|
|
13454
|
+
const current = list[i];
|
|
13455
|
+
if (previous !== void 0 && current !== void 0) deps.get(current.id)?.add(previous.id);
|
|
13456
|
+
}
|
|
13457
|
+
}
|
|
13458
|
+
const tie = (a, b) => a.owner < b.owner ? -1 : a.owner > b.owner ? 1 : a.seq - b.seq;
|
|
13459
|
+
const done = /* @__PURE__ */ new Set();
|
|
13460
|
+
const ordered = [];
|
|
13461
|
+
let remaining = [...items];
|
|
13462
|
+
while (remaining.length > 0) {
|
|
13463
|
+
const ready = remaining.filter((item) => [...deps.get(item.id) ?? []].every((dep) => done.has(dep)));
|
|
13464
|
+
if (ready.length === 0) throw new MigrationCycleError(remaining.map((item) => item.id).sort());
|
|
13465
|
+
ready.sort(tie);
|
|
13466
|
+
const next = ready[0];
|
|
13467
|
+
if (next === void 0) break;
|
|
13468
|
+
ordered.push(next);
|
|
13469
|
+
done.add(next.id);
|
|
13470
|
+
remaining = remaining.filter((item) => item.id !== next.id);
|
|
13471
|
+
}
|
|
13472
|
+
return ordered;
|
|
13473
|
+
}
|
|
13474
|
+
/** Every way a list of migrations (in declaration order) is not a catalogue. */
|
|
13475
|
+
function catalogueIssues(items) {
|
|
13476
|
+
const issues = [];
|
|
13477
|
+
const seen = /* @__PURE__ */ new Set();
|
|
13478
|
+
const known = new Set(items.map((item) => item.id));
|
|
13479
|
+
const lastSeq = /* @__PURE__ */ new Map();
|
|
13480
|
+
const seqUsed = /* @__PURE__ */ new Map();
|
|
13481
|
+
for (const item of items) {
|
|
13482
|
+
if (seen.has(item.id)) issues.push({
|
|
13483
|
+
code: "duplicate-id",
|
|
13484
|
+
ids: [item.id],
|
|
13485
|
+
message: `duplicate id ${item.id}`
|
|
13486
|
+
});
|
|
13487
|
+
seen.add(item.id);
|
|
13488
|
+
const used = seqUsed.get(item.owner) ?? /* @__PURE__ */ new Set();
|
|
13489
|
+
if (used.has(item.seq)) issues.push({
|
|
13490
|
+
code: "duplicate-seq",
|
|
13491
|
+
ids: [item.id],
|
|
13492
|
+
message: `owner ${item.owner} has two migrations with seq ${item.seq}`
|
|
13493
|
+
});
|
|
13494
|
+
else if (item.seq < (lastSeq.get(item.owner) ?? 0)) issues.push({
|
|
13495
|
+
code: "seq-order",
|
|
13496
|
+
ids: [item.id],
|
|
13497
|
+
message: `seq ${item.seq} of ${item.id} does not increase in declaration order (owner ${item.owner})`
|
|
13498
|
+
});
|
|
13499
|
+
used.add(item.seq);
|
|
13500
|
+
seqUsed.set(item.owner, used);
|
|
13501
|
+
lastSeq.set(item.owner, Math.max(item.seq, lastSeq.get(item.owner) ?? 0));
|
|
13502
|
+
for (const dep of item.dependsOn) if (!known.has(dep)) issues.push({
|
|
13503
|
+
code: "unknown-dependency",
|
|
13504
|
+
ids: [item.id, dep],
|
|
13505
|
+
message: `${item.id} dependsOn unknown id ${dep}`
|
|
13506
|
+
});
|
|
13507
|
+
}
|
|
13508
|
+
try {
|
|
13509
|
+
orderMigrations(items);
|
|
13510
|
+
} catch (err) {
|
|
13511
|
+
if (err instanceof MigrationCycleError) issues.push({
|
|
13512
|
+
code: "cycle",
|
|
13513
|
+
ids: err.ids,
|
|
13514
|
+
message: err.message
|
|
13515
|
+
});
|
|
13516
|
+
else throw err;
|
|
13517
|
+
}
|
|
13518
|
+
return issues;
|
|
13519
|
+
}
|
|
13520
|
+
array(MigrationMetaSchema).superRefine((items, ctx) => {
|
|
13521
|
+
for (const issue of catalogueIssues(items)) ctx.addIssue({
|
|
13522
|
+
code: "custom",
|
|
13523
|
+
message: `${issue.code}: ${issue.message}`
|
|
13524
|
+
});
|
|
13525
|
+
});
|
|
13526
|
+
/**
|
|
13527
|
+
* The canonical JSON (`preconditionOf`) of the value a plan read; the apply step
|
|
13528
|
+
* re-reads, and a plan whose read no longer matches is refused (the migration is
|
|
13529
|
+
* `failed`, nothing it edited is kept).
|
|
13530
|
+
*/
|
|
13531
|
+
var PreconditionSchema = string().min(1).optional();
|
|
13532
|
+
var MigrationPlanSchema = object({ edits: array(discriminatedUnion("op", [
|
|
13533
|
+
object({
|
|
13534
|
+
op: literal("setKeys"),
|
|
13535
|
+
scope: string().min(1),
|
|
13536
|
+
values: record(string(), unknown()),
|
|
13537
|
+
precondition: PreconditionSchema
|
|
13538
|
+
}),
|
|
13539
|
+
object({
|
|
13540
|
+
op: literal("deleteKeys"),
|
|
13541
|
+
scope: string().min(1),
|
|
13542
|
+
keys: array(string().min(1)).min(1),
|
|
13543
|
+
precondition: PreconditionSchema
|
|
13544
|
+
}),
|
|
13545
|
+
object({
|
|
13546
|
+
op: literal("putRow"),
|
|
13547
|
+
table: string().min(1),
|
|
13548
|
+
key: record(string(), unknown()),
|
|
13549
|
+
row: record(string(), unknown()),
|
|
13550
|
+
precondition: PreconditionSchema
|
|
13551
|
+
}),
|
|
13552
|
+
object({
|
|
13553
|
+
op: literal("deleteRow"),
|
|
13554
|
+
table: string().min(1),
|
|
13555
|
+
key: record(string(), unknown()),
|
|
13556
|
+
precondition: PreconditionSchema
|
|
13557
|
+
}),
|
|
13558
|
+
object({
|
|
13559
|
+
op: literal("upsertRecord"),
|
|
13560
|
+
kind: string().min(1),
|
|
13561
|
+
recordKey: string().min(1),
|
|
13562
|
+
value: unknown(),
|
|
13563
|
+
precondition: PreconditionSchema
|
|
13564
|
+
}),
|
|
13565
|
+
object({
|
|
13566
|
+
op: literal("deleteRecord"),
|
|
13567
|
+
kind: string().min(1),
|
|
13568
|
+
recordKey: string().min(1),
|
|
13569
|
+
precondition: PreconditionSchema
|
|
13570
|
+
})
|
|
13571
|
+
])) });
|
|
13572
|
+
/**
|
|
13573
|
+
* What a `procedure` body reports. `already-done` means the rerun observed the
|
|
13574
|
+
* work finished (a crash between the work and the ledger row, or a manual fix)
|
|
13575
|
+
* and did none of it again; the ledger records `applied` either way.
|
|
13576
|
+
*/
|
|
13577
|
+
var MigrationProcedureResultSchema = object({
|
|
13578
|
+
outcome: _enum(["done", "already-done"]),
|
|
13579
|
+
summary: record(string(), unknown())
|
|
13580
|
+
});
|
|
13581
|
+
/** What an owner hands the engine when one of its migrations ran. */
|
|
13582
|
+
var MigrationOwnerResultSchema = discriminatedUnion("kind", [
|
|
13583
|
+
object({
|
|
13584
|
+
kind: literal("plan"),
|
|
13585
|
+
plan: MigrationPlanSchema
|
|
13586
|
+
}),
|
|
13587
|
+
object({
|
|
13588
|
+
kind: literal("procedure"),
|
|
13589
|
+
result: MigrationProcedureResultSchema
|
|
13590
|
+
}),
|
|
13591
|
+
object({
|
|
13592
|
+
kind: literal("failed"),
|
|
13593
|
+
error: string().min(1)
|
|
13594
|
+
})
|
|
13595
|
+
]);
|
|
13596
|
+
/**
|
|
13597
|
+
* `held`: a restore of a pre-migration snapshot undid this id; it does not rerun
|
|
13598
|
+
* until the operator retries or a new code version ships.
|
|
13599
|
+
* `skipped-newer`: the database knows an id this code does not.
|
|
13600
|
+
*/
|
|
13601
|
+
var MigrationStatusSchema = _enum([
|
|
13602
|
+
"applied",
|
|
13603
|
+
"failed",
|
|
13604
|
+
"blocked",
|
|
13605
|
+
"running",
|
|
13606
|
+
"held",
|
|
13607
|
+
"skipped-newer"
|
|
13608
|
+
]);
|
|
13609
|
+
var MigrationLedgerEntrySchema = object({
|
|
13610
|
+
id: string(),
|
|
13611
|
+
database: DataStoreDatabaseSchema,
|
|
13612
|
+
owner: string(),
|
|
13613
|
+
level: MigrationLevelSchema,
|
|
13614
|
+
seq: number().int().nonnegative(),
|
|
13615
|
+
status: MigrationStatusSchema,
|
|
13616
|
+
attempts: number().int().nonnegative(),
|
|
13617
|
+
appliedAt: number().nullable(),
|
|
13618
|
+
codeVersion: string().nullable(),
|
|
13619
|
+
/** What the apply changed: rows per table, as the engine counted them. */
|
|
13620
|
+
planSummary: record(string(), unknown()).nullable(),
|
|
13621
|
+
progress: record(string(), unknown()).nullable(),
|
|
13622
|
+
error: string().nullable(),
|
|
13623
|
+
/** Why it is `blocked` or `held` (`dependency-failed`, `snapshot-refused`, …). */
|
|
13624
|
+
reason: string().nullable(),
|
|
13625
|
+
nodeId: string().nullable(),
|
|
13626
|
+
bootId: string().nullable()
|
|
13627
|
+
});
|
|
13628
|
+
/** A catalogued migration that is not applied, with where it stands. */
|
|
13629
|
+
var MigrationPendingEntrySchema = object({
|
|
13630
|
+
meta: MigrationMetaSchema,
|
|
13631
|
+
database: DataStoreDatabaseSchema,
|
|
13632
|
+
state: _enum([
|
|
13633
|
+
"pending",
|
|
13634
|
+
"failed",
|
|
13635
|
+
"blocked",
|
|
13636
|
+
"held"
|
|
13637
|
+
]),
|
|
13638
|
+
reason: string().nullable()
|
|
13639
|
+
});
|
|
13640
|
+
/** Rows per table before and after a dry run, and what it would have changed. */
|
|
13641
|
+
var MigrationDryRunResultSchema = object({
|
|
13642
|
+
id: string(),
|
|
13643
|
+
ok: boolean(),
|
|
13644
|
+
error: string().nullable(),
|
|
13645
|
+
rowsChanged: number().int().nonnegative(),
|
|
13646
|
+
tables: array(object({
|
|
13647
|
+
table: string(),
|
|
13648
|
+
before: number().int().nonnegative(),
|
|
13649
|
+
after: number().int().nonnegative()
|
|
13650
|
+
}))
|
|
13651
|
+
});
|
|
13652
|
+
/** One of an owner's migrations, as the engine tells the owner to treat it this boot. */
|
|
13653
|
+
var MigrationOwnerStepSchema = object({
|
|
13654
|
+
id: MigrationIdSchema,
|
|
13655
|
+
action: _enum(["run", "skip"]),
|
|
13656
|
+
/** The ledger state the engine found: `pending` has no row yet. */
|
|
13657
|
+
state: union([literal("pending"), MigrationStatusSchema])
|
|
13658
|
+
});
|
|
13659
|
+
/**
|
|
12857
13660
|
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
12858
13661
|
* gets back (cloud training, D805+).
|
|
12859
13662
|
*
|
|
@@ -16256,6 +17059,41 @@ var ACTUATOR_CAP_VOCABULARY = {
|
|
|
16256
17059
|
icon: "droplets"
|
|
16257
17060
|
}]
|
|
16258
17061
|
},
|
|
17062
|
+
"power-source": {
|
|
17063
|
+
scope: "device",
|
|
17064
|
+
noun: t("Power source", "Alimentazione"),
|
|
17065
|
+
actions: [
|
|
17066
|
+
{
|
|
17067
|
+
id: "powerSource.on",
|
|
17068
|
+
method: "powerOn",
|
|
17069
|
+
label: t("Power on", "Dai corrente"),
|
|
17070
|
+
phrase: t("Power on {device}", "Dai corrente a {device}"),
|
|
17071
|
+
icon: "power"
|
|
17072
|
+
},
|
|
17073
|
+
{
|
|
17074
|
+
id: "powerSource.off",
|
|
17075
|
+
method: "powerOff",
|
|
17076
|
+
label: t("Power off", "Togli corrente"),
|
|
17077
|
+
phrase: t("Cut the power of {device}", "Togli la corrente a {device}"),
|
|
17078
|
+
icon: "power-off"
|
|
17079
|
+
},
|
|
17080
|
+
{
|
|
17081
|
+
id: "powerSource.forceRestart",
|
|
17082
|
+
method: "forceRestart",
|
|
17083
|
+
label: t("Force restart", "Riavvio forzato"),
|
|
17084
|
+
phrase: t("Force restart {device} by cutting its power", "Riavvia {device} togliendo la corrente"),
|
|
17085
|
+
icon: "refresh-cw"
|
|
17086
|
+
}
|
|
17087
|
+
],
|
|
17088
|
+
state: [{
|
|
17089
|
+
kind: "boolean",
|
|
17090
|
+
field: "switchOn",
|
|
17091
|
+
label: t("Power switch on", "Presa accesa"),
|
|
17092
|
+
whenTrue: t("When the power of {device} comes on", "Quando arriva la corrente a {device}"),
|
|
17093
|
+
whenFalse: t("When the power of {device} is cut", "Quando manca la corrente a {device}"),
|
|
17094
|
+
icon: "power"
|
|
17095
|
+
}]
|
|
17096
|
+
},
|
|
16259
17097
|
"lock-control": {
|
|
16260
17098
|
scope: "device",
|
|
16261
17099
|
noun: t("Lock", "Serratura"),
|
|
@@ -16731,7 +17569,7 @@ var ACTUATOR_CAP_VOCABULARY = {
|
|
|
16731
17569
|
method: "setDirection",
|
|
16732
17570
|
label: t("Spin forward", "Rotazione avanti"),
|
|
16733
17571
|
phrase: t("Spin {device} forward", "Fai girare {device} in avanti"),
|
|
16734
|
-
icon: "
|
|
17572
|
+
icon: "refresh-cw",
|
|
16735
17573
|
effect: {
|
|
16736
17574
|
field: "direction",
|
|
16737
17575
|
value: "forward"
|
|
@@ -19809,6 +20647,7 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
19809
20647
|
"login-method": system(IDENTITY),
|
|
19810
20648
|
"mesh-network": system(NETWORK),
|
|
19811
20649
|
"metrics-provider": system(CLUSTER),
|
|
20650
|
+
migrations: system(INTERNAL),
|
|
19812
20651
|
"model-convert": system(ML),
|
|
19813
20652
|
"model-distributor": system(ML),
|
|
19814
20653
|
"mqtt-broker": system(NETWORK),
|
|
@@ -40011,7 +40850,8 @@ function normalizeUnit(raw) {
|
|
|
40011
40850
|
if (lower === "dbm") return "dBm";
|
|
40012
40851
|
if (lower === "dbfs") return "dBFS";
|
|
40013
40852
|
if (lower === "inhg") return "inHg";
|
|
40014
|
-
if (lower === "mm/h") return "mm/h";
|
|
40853
|
+
if (lower === "mm/h" || lower === "mm/hr") return "mm/h";
|
|
40854
|
+
if (lower === "in/h" || lower === "in/hr") return "in/h";
|
|
40015
40855
|
if (lower === "w/m²" || lower === "w/m2") return "W/m²";
|
|
40016
40856
|
if (lower === "°" || lower === "deg" || lower === "degree" || lower === "degrees") return "°";
|
|
40017
40857
|
if (lower === "kbps") return "kbps";
|
|
@@ -42230,7 +43070,7 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
|
|
|
42230
43070
|
* rebuilds without manual reload.
|
|
42231
43071
|
*
|
|
42232
43072
|
* The hub-local builtin `addon-pages-aggregator` (see
|
|
42233
|
-
* `@camstack/system/builtins/addon-pages-aggregator`) registers the
|
|
43073
|
+
* `@camstack/server/system/builtins/addon-pages-aggregator`) registers the
|
|
42234
43074
|
* provider. Splitting the public aggregator from the raw collection
|
|
42235
43075
|
* keeps both ends in codegen — there's no hand-written
|
|
42236
43076
|
* `addon-pages.router.ts` wrapper anymore.
|
|
@@ -42530,7 +43370,7 @@ method(_void(), array(WidgetMetadataSchema).readonly(), { auth: "admin" });
|
|
|
42530
43370
|
* manual reload — same scheme used by `addon-pages`.
|
|
42531
43371
|
*
|
|
42532
43372
|
* The hub-local builtin `addon-widgets-aggregator` (see
|
|
42533
|
-
* `@camstack/system/builtins/addon-widgets-aggregator`) registers the
|
|
43373
|
+
* `@camstack/server/system/builtins/addon-widgets-aggregator`) registers the
|
|
42534
43374
|
* provider. Splitting the public aggregator from the raw collection
|
|
42535
43375
|
* keeps both ends in codegen — there's no hand-written wrapper.
|
|
42536
43376
|
*/
|
|
@@ -42891,329 +43731,6 @@ method(object({
|
|
|
42891
43731
|
password: string()
|
|
42892
43732
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
42893
43733
|
/**
|
|
42894
|
-
* Query filter for settings-store collections.
|
|
42895
|
-
*/
|
|
42896
|
-
var QueryFilterSchema = object({
|
|
42897
|
-
where: record(string(), unknown()).optional(),
|
|
42898
|
-
whereIn: record(string(), array(unknown())).optional(),
|
|
42899
|
-
whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
|
|
42900
|
-
/** NULL-safe exclusion: matches rows whose field is NULL OR != the value. */
|
|
42901
|
-
whereNot: record(string(), unknown()).optional(),
|
|
42902
|
-
/** NULL-safe exclusion of a SET — `whereNot` for more than one value. An
|
|
42903
|
-
* empty list excludes nothing. See `QueryFilter.whereNotIn`. */
|
|
42904
|
-
whereNotIn: record(string(), array(unknown())).optional(),
|
|
42905
|
-
orderBy: object({
|
|
42906
|
-
field: string(),
|
|
42907
|
-
direction: _enum(["asc", "desc"])
|
|
42908
|
-
}).optional(),
|
|
42909
|
-
limit: number().optional(),
|
|
42910
|
-
offset: number().optional()
|
|
42911
|
-
});
|
|
42912
|
-
/**
|
|
42913
|
-
* The predicate half of a filter, for BULK MUTATIONS.
|
|
42914
|
-
*
|
|
42915
|
-
* Deliberately not `QueryFilterSchema`: `orderBy` / `limit` / `offset` have no
|
|
42916
|
-
* meaning for a statement that rewrites a set, and accepting them would invite
|
|
42917
|
-
* a caller to believe `limit` bounds the damage. Every field is optional here
|
|
42918
|
-
* only so the shape stays composable — the implementation REJECTS a filter
|
|
42919
|
-
* that compiles to no predicate, because that is the whole collection.
|
|
42920
|
-
*/
|
|
42921
|
-
var MutationFilterSchema = object({
|
|
42922
|
-
where: record(string(), unknown()).optional(),
|
|
42923
|
-
whereIn: record(string(), array(unknown())).optional(),
|
|
42924
|
-
whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
|
|
42925
|
-
whereNot: record(string(), unknown()).optional(),
|
|
42926
|
-
whereNotIn: record(string(), array(unknown())).optional()
|
|
42927
|
-
});
|
|
42928
|
-
/**
|
|
42929
|
-
* One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
|
|
42930
|
-
*
|
|
42931
|
-
* `as` names the slot in the result, so the SAME column may be asked twice with
|
|
42932
|
-
* two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
|
|
42933
|
-
* a `Record<column, op>` shape could not express.
|
|
42934
|
-
*/
|
|
42935
|
-
var AggregateFieldSchema = object({
|
|
42936
|
-
/** Result key. */
|
|
42937
|
-
as: string().min(1),
|
|
42938
|
-
/** Column to aggregate. Must be a real column of a declared collection. */
|
|
42939
|
-
field: string().min(1),
|
|
42940
|
-
op: _enum([
|
|
42941
|
-
"sum",
|
|
42942
|
-
"min",
|
|
42943
|
-
"max"
|
|
42944
|
-
])
|
|
42945
|
-
});
|
|
42946
|
-
/**
|
|
42947
|
-
* `COUNT(*)` plus one number per requested field.
|
|
42948
|
-
*
|
|
42949
|
-
* `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
|
|
42950
|
-
* that really is 0 are different facts, and an accounting caller that renders
|
|
42951
|
-
* "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
|
|
42952
|
-
*/
|
|
42953
|
-
var AggregateResultSchema = object({
|
|
42954
|
-
count: number().int(),
|
|
42955
|
-
values: record(string(), number().nullable())
|
|
42956
|
-
});
|
|
42957
|
-
/** A single stored record: `{ id, data }`. */
|
|
42958
|
-
var SettingsRecordSchema = object({
|
|
42959
|
-
id: string(),
|
|
42960
|
-
data: record(string(), unknown())
|
|
42961
|
-
});
|
|
42962
|
-
/**
|
|
42963
|
-
* One record of a BULK insert — {@link SettingsRecordSchema} with the id made
|
|
42964
|
-
* optional.
|
|
42965
|
-
*
|
|
42966
|
-
* A separate schema rather than loosening the shared one: every other method
|
|
42967
|
-
* on this cap addresses a row BY its id, and making that field optional
|
|
42968
|
-
* everywhere would turn a forgotten key into a silently generated one on
|
|
42969
|
-
* `update` and `delete` as well.
|
|
42970
|
-
*/
|
|
42971
|
-
var BulkRecordSchema = object({
|
|
42972
|
-
id: string().optional(),
|
|
42973
|
-
data: record(string(), unknown())
|
|
42974
|
-
});
|
|
42975
|
-
/**
|
|
42976
|
-
* The database FILES one `sqlite-settings` engine process owns (D851).
|
|
42977
|
-
* Closed on purpose: a file is a thing the engine opens, backs up and gives a
|
|
42978
|
-
* serving thread, so a new one is a code change, never a string a caller
|
|
42979
|
-
* invents. `settings` is `camstack.db` and the default for every collection
|
|
42980
|
-
* that names no file.
|
|
42981
|
-
*/
|
|
42982
|
-
var DataStoreDatabaseSchema = _enum([
|
|
42983
|
-
"settings",
|
|
42984
|
-
"events",
|
|
42985
|
-
"history"
|
|
42986
|
-
]);
|
|
42987
|
-
DataStoreDatabaseSchema.options;
|
|
42988
|
-
/**
|
|
42989
|
-
* One write inside a {@link settingsStoreCapability.methods.transact} call.
|
|
42990
|
-
* The three that a "replace this set, bump that revision" write needs, plus
|
|
42991
|
-
* the batched upsert a rollup writer needs.
|
|
42992
|
-
*/
|
|
42993
|
-
var TransactOpSchema = discriminatedUnion("op", [
|
|
42994
|
-
object({
|
|
42995
|
-
op: literal("deleteWhere"),
|
|
42996
|
-
collection: string(),
|
|
42997
|
-
filter: MutationFilterSchema
|
|
42998
|
-
}),
|
|
42999
|
-
object({
|
|
43000
|
-
op: literal("insertMany"),
|
|
43001
|
-
collection: string(),
|
|
43002
|
-
records: array(BulkRecordSchema).readonly()
|
|
43003
|
-
}),
|
|
43004
|
-
object({
|
|
43005
|
-
op: literal("update"),
|
|
43006
|
-
collection: string(),
|
|
43007
|
-
id: string(),
|
|
43008
|
-
data: record(string(), unknown())
|
|
43009
|
-
}),
|
|
43010
|
-
object({
|
|
43011
|
-
op: literal("upsertMany"),
|
|
43012
|
-
collection: string(),
|
|
43013
|
-
conflict: array(string()).readonly(),
|
|
43014
|
-
records: array(BulkRecordSchema).readonly()
|
|
43015
|
-
})
|
|
43016
|
-
]);
|
|
43017
|
-
/**
|
|
43018
|
-
* The precondition of a transaction: the row `key` of `collection` must hold
|
|
43019
|
-
* `equals` in `column`, read INSIDE the transaction.
|
|
43020
|
-
*/
|
|
43021
|
-
var TransactGuardSchema = object({
|
|
43022
|
-
collection: string(),
|
|
43023
|
-
key: string(),
|
|
43024
|
-
column: string(),
|
|
43025
|
-
equals: unknown()
|
|
43026
|
-
});
|
|
43027
|
-
/**
|
|
43028
|
-
* Column declaration for a structured (SQL-backed) collection.
|
|
43029
|
-
*
|
|
43030
|
-
* Logical types — the backend translates each to the matching SQLite
|
|
43031
|
-
* storage class and handles per-type marshaling:
|
|
43032
|
-
* - `TEXT` / `INTEGER` / `REAL` — native SQLite types, pass-through
|
|
43033
|
-
* - `JSON` — TEXT under the hood; serialised on write, parsed on read
|
|
43034
|
-
* - `BOOLEAN` — INTEGER 0/1 under the hood; coerced both directions
|
|
43035
|
-
*/
|
|
43036
|
-
var CollectionColumnSchema = object({
|
|
43037
|
-
name: string(),
|
|
43038
|
-
type: _enum([
|
|
43039
|
-
"TEXT",
|
|
43040
|
-
"INTEGER",
|
|
43041
|
-
"REAL",
|
|
43042
|
-
"JSON",
|
|
43043
|
-
"BOOLEAN"
|
|
43044
|
-
]),
|
|
43045
|
-
primaryKey: boolean().optional(),
|
|
43046
|
-
notNull: boolean().optional(),
|
|
43047
|
-
unique: boolean().optional(),
|
|
43048
|
-
/**
|
|
43049
|
-
* Column DEFAULT. Required for B2: the four `ensureTable` consumers declare
|
|
43050
|
-
* columns like `enabled INTEGER NOT NULL DEFAULT 1`, and without this the
|
|
43051
|
-
* collection surface simply cannot express their existing tables — which is
|
|
43052
|
-
* why they were still on the uncapped `table*` API.
|
|
43053
|
-
*/
|
|
43054
|
-
defaultValue: union([
|
|
43055
|
-
string(),
|
|
43056
|
-
number(),
|
|
43057
|
-
boolean()
|
|
43058
|
-
]).optional()
|
|
43059
|
-
});
|
|
43060
|
-
var CollectionIndexSchema = object({
|
|
43061
|
-
name: string(),
|
|
43062
|
-
columns: array(string()).readonly(),
|
|
43063
|
-
unique: boolean().optional()
|
|
43064
|
-
});
|
|
43065
|
-
/**
|
|
43066
|
-
* The input of `declareCollection` — ONE schema for the door and for the
|
|
43067
|
-
* engine behind it, so the two surfaces cannot drift (the dispatcher forwards
|
|
43068
|
-
* the payload untouched).
|
|
43069
|
-
*
|
|
43070
|
-
* - `database` — the file the collection lives in (D851). Absent means
|
|
43071
|
-
* `settings`. A declaration naming a file other than the one the table is
|
|
43072
|
-
* already in is REFUSED by the engine, never moved.
|
|
43073
|
-
* - `primaryKey` — a COMPOSITE key, as column names. A single name is the same
|
|
43074
|
-
* as `primaryKey: true` on that column. A composite-keyed collection has no
|
|
43075
|
-
* `id`: it is written with `insertMany` / `upsertMany` / `transact` and read
|
|
43076
|
-
* with `query` / `count` / `aggregate` / `deleteWhere`; the calls that
|
|
43077
|
-
* address one row by id are refused.
|
|
43078
|
-
* - `withoutRowid` — emit `WITHOUT ROWID`. Requires a primary key.
|
|
43079
|
-
*/
|
|
43080
|
-
var DeclareCollectionInputSchema = object({
|
|
43081
|
-
namespace: string().optional(),
|
|
43082
|
-
collection: string(),
|
|
43083
|
-
columns: array(CollectionColumnSchema).readonly(),
|
|
43084
|
-
indexes: array(CollectionIndexSchema).readonly().optional(),
|
|
43085
|
-
database: DataStoreDatabaseSchema.optional(),
|
|
43086
|
-
primaryKey: array(string()).readonly().optional(),
|
|
43087
|
-
withoutRowid: boolean().optional()
|
|
43088
|
-
});
|
|
43089
|
-
method(object({
|
|
43090
|
-
namespace: string().optional(),
|
|
43091
|
-
collection: string(),
|
|
43092
|
-
key: string()
|
|
43093
|
-
}), unknown(), { auth: "admin" }), method(object({
|
|
43094
|
-
namespace: string().optional(),
|
|
43095
|
-
collection: string(),
|
|
43096
|
-
key: string(),
|
|
43097
|
-
value: unknown()
|
|
43098
|
-
}), _void(), {
|
|
43099
|
-
kind: "mutation",
|
|
43100
|
-
auth: "admin"
|
|
43101
|
-
}), method(object({
|
|
43102
|
-
namespace: string().optional(),
|
|
43103
|
-
collection: string(),
|
|
43104
|
-
filter: QueryFilterSchema.optional(),
|
|
43105
|
-
columns: array(string()).readonly().optional()
|
|
43106
|
-
}), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
|
|
43107
|
-
namespace: string().optional(),
|
|
43108
|
-
collection: string(),
|
|
43109
|
-
/** Declared columns identifying the slot; must be covered by a UNIQUE
|
|
43110
|
-
* index on the collection. Never empty. */
|
|
43111
|
-
conflict: array(string()).readonly(),
|
|
43112
|
-
record: BulkRecordSchema
|
|
43113
|
-
}), object({
|
|
43114
|
-
/** The id the row HAS: assigned by SQLite on an insert, or the existing
|
|
43115
|
-
* row's own id on an update. */
|
|
43116
|
-
id: union([string(), number()]) }), {
|
|
43117
|
-
kind: "mutation",
|
|
43118
|
-
auth: "admin"
|
|
43119
|
-
}), method(object({
|
|
43120
|
-
namespace: string().optional(),
|
|
43121
|
-
collection: string(),
|
|
43122
|
-
conflict: array(string()).readonly(),
|
|
43123
|
-
records: array(BulkRecordSchema).readonly()
|
|
43124
|
-
}), object({ upserted: number().int() }), {
|
|
43125
|
-
kind: "mutation",
|
|
43126
|
-
auth: "admin"
|
|
43127
|
-
}), method(object({
|
|
43128
|
-
namespace: string().optional(),
|
|
43129
|
-
collection: string(),
|
|
43130
|
-
record: object({
|
|
43131
|
-
id: string().optional(),
|
|
43132
|
-
data: record(string(), unknown())
|
|
43133
|
-
})
|
|
43134
|
-
}), object({
|
|
43135
|
-
/**
|
|
43136
|
-
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
43137
|
-
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
43138
|
-
* primary key — which is the only place an auto key is knowable.
|
|
43139
|
-
*/
|
|
43140
|
-
id: union([string(), number()]) }), {
|
|
43141
|
-
kind: "mutation",
|
|
43142
|
-
auth: "admin"
|
|
43143
|
-
}), method(object({
|
|
43144
|
-
namespace: string().optional(),
|
|
43145
|
-
collection: string(),
|
|
43146
|
-
records: array(BulkRecordSchema).readonly()
|
|
43147
|
-
}), object({ inserted: number().int() }), {
|
|
43148
|
-
kind: "mutation",
|
|
43149
|
-
auth: "admin"
|
|
43150
|
-
}), method(object({
|
|
43151
|
-
namespace: string().optional(),
|
|
43152
|
-
guard: TransactGuardSchema.optional(),
|
|
43153
|
-
ops: array(TransactOpSchema).readonly()
|
|
43154
|
-
}), object({
|
|
43155
|
-
applied: boolean(),
|
|
43156
|
-
current: unknown().optional()
|
|
43157
|
-
}), {
|
|
43158
|
-
kind: "mutation",
|
|
43159
|
-
auth: "admin"
|
|
43160
|
-
}), method(object({
|
|
43161
|
-
namespace: string().optional(),
|
|
43162
|
-
collection: string(),
|
|
43163
|
-
id: string(),
|
|
43164
|
-
data: record(string(), unknown())
|
|
43165
|
-
}), _void(), {
|
|
43166
|
-
kind: "mutation",
|
|
43167
|
-
auth: "admin"
|
|
43168
|
-
}), method(object({
|
|
43169
|
-
namespace: string().optional(),
|
|
43170
|
-
collection: string(),
|
|
43171
|
-
key: string()
|
|
43172
|
-
}), _void(), {
|
|
43173
|
-
kind: "mutation",
|
|
43174
|
-
auth: "admin"
|
|
43175
|
-
}), method(object({
|
|
43176
|
-
namespace: string().optional(),
|
|
43177
|
-
collection: string(),
|
|
43178
|
-
filter: MutationFilterSchema
|
|
43179
|
-
}), object({ deleted: number().int() }), {
|
|
43180
|
-
kind: "mutation",
|
|
43181
|
-
auth: "admin"
|
|
43182
|
-
}), method(object({
|
|
43183
|
-
namespace: string().optional(),
|
|
43184
|
-
collection: string(),
|
|
43185
|
-
filter: MutationFilterSchema,
|
|
43186
|
-
data: record(string(), unknown())
|
|
43187
|
-
}), object({ updated: number().int() }), {
|
|
43188
|
-
kind: "mutation",
|
|
43189
|
-
auth: "admin"
|
|
43190
|
-
}), method(object({
|
|
43191
|
-
namespace: string().optional(),
|
|
43192
|
-
collection: string(),
|
|
43193
|
-
filter: QueryFilterSchema.optional()
|
|
43194
|
-
}), number(), { auth: "admin" }), method(object({
|
|
43195
|
-
namespace: string().optional(),
|
|
43196
|
-
collection: string(),
|
|
43197
|
-
fields: array(AggregateFieldSchema).readonly(),
|
|
43198
|
-
filter: QueryFilterSchema.optional()
|
|
43199
|
-
}), AggregateResultSchema, { auth: "admin" }), method(object({
|
|
43200
|
-
namespace: string().optional(),
|
|
43201
|
-
collection: string(),
|
|
43202
|
-
field: string(),
|
|
43203
|
-
bucketSize: number().int().positive(),
|
|
43204
|
-
origin: number().int(),
|
|
43205
|
-
filter: QueryFilterSchema.optional()
|
|
43206
|
-
}), array(object({
|
|
43207
|
-
bucket: number().int(),
|
|
43208
|
-
count: number().int()
|
|
43209
|
-
})).readonly(), { auth: "admin" }), method(object({
|
|
43210
|
-
namespace: string().optional(),
|
|
43211
|
-
collection: string()
|
|
43212
|
-
}), boolean(), { auth: "admin" }), method(DeclareCollectionInputSchema, _void(), {
|
|
43213
|
-
kind: "mutation",
|
|
43214
|
-
auth: "admin"
|
|
43215
|
-
});
|
|
43216
|
-
/**
|
|
43217
43734
|
* How long one snapshot may take end to end: the pinned copy of the whole
|
|
43218
43735
|
* database plus `PRAGMA integrity_check` over the copy, on the hub's slowest
|
|
43219
43736
|
* disk. ~800 MB at a pessimistic 10 MB/s is under 3 minutes; the bound is
|
|
@@ -45127,7 +45644,7 @@ method(object({
|
|
|
45127
45644
|
kind: "mutation",
|
|
45128
45645
|
auth: "admin"
|
|
45129
45646
|
}), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
|
|
45130
|
-
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;
|
|
45647
|
+
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;
|
|
45131
45648
|
var NUMBER = {
|
|
45132
45649
|
kind: "fixed",
|
|
45133
45650
|
result: ["number"]
|
|
@@ -46138,6 +46655,57 @@ id: union([string(), number()]) }), {
|
|
|
46138
46655
|
kind: "mutation",
|
|
46139
46656
|
auth: "admin"
|
|
46140
46657
|
});
|
|
46658
|
+
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({
|
|
46659
|
+
id: string().min(1),
|
|
46660
|
+
error: string().min(1)
|
|
46661
|
+
}), MigrationLedgerEntrySchema, {
|
|
46662
|
+
kind: "mutation",
|
|
46663
|
+
auth: "admin"
|
|
46664
|
+
}), method(object({ id: string().min(1) }), object({ entries: array(MigrationLedgerEntrySchema) }), {
|
|
46665
|
+
kind: "mutation",
|
|
46666
|
+
auth: "admin"
|
|
46667
|
+
}), method(object({
|
|
46668
|
+
database: DataStoreDatabaseSchema,
|
|
46669
|
+
snapshotId: string().min(1)
|
|
46670
|
+
}), object({
|
|
46671
|
+
scheduled: boolean(),
|
|
46672
|
+
held: array(string()),
|
|
46673
|
+
restartRequired: boolean()
|
|
46674
|
+
}), {
|
|
46675
|
+
kind: "mutation",
|
|
46676
|
+
auth: "admin"
|
|
46677
|
+
}), method(object({
|
|
46678
|
+
owner: string().min(1),
|
|
46679
|
+
metas: array(MigrationMetaSchema)
|
|
46680
|
+
}), object({
|
|
46681
|
+
bootId: string(),
|
|
46682
|
+
snapshot: _enum([
|
|
46683
|
+
"none",
|
|
46684
|
+
"written",
|
|
46685
|
+
"refused"
|
|
46686
|
+
]),
|
|
46687
|
+
steps: array(MigrationOwnerStepSchema)
|
|
46688
|
+
}), {
|
|
46689
|
+
kind: "mutation",
|
|
46690
|
+
auth: "admin"
|
|
46691
|
+
}), method(object({ id: string().min(1) }), object({
|
|
46692
|
+
proceed: boolean(),
|
|
46693
|
+
state: union([literal("pending"), MigrationStatusSchema]),
|
|
46694
|
+
reason: string().nullable()
|
|
46695
|
+
}), {
|
|
46696
|
+
kind: "mutation",
|
|
46697
|
+
auth: "admin"
|
|
46698
|
+
}), method(object({
|
|
46699
|
+
id: string().min(1),
|
|
46700
|
+
result: MigrationOwnerResultSchema
|
|
46701
|
+
}), object({
|
|
46702
|
+
status: MigrationStatusSchema,
|
|
46703
|
+
error: string().nullable(),
|
|
46704
|
+
rowsChanged: number().int().nonnegative()
|
|
46705
|
+
}), {
|
|
46706
|
+
kind: "mutation",
|
|
46707
|
+
auth: "admin"
|
|
46708
|
+
});
|
|
46141
46709
|
/**
|
|
46142
46710
|
* records - an addon's own facts and documents (D881): ledgers, audit rows,
|
|
46143
46711
|
* config documents, mirrors. The third storage API next to `ctx.settings`
|
|
@@ -60889,7 +61457,18 @@ var ServerUpdateActionResultSchema = object({
|
|
|
60889
61457
|
* store (D877), present when the pre-flight refused the update
|
|
60890
61458
|
* (`reason: 'addon-would-refuse'`). Optional for version skew.
|
|
60891
61459
|
*/
|
|
60892
|
-
blockers: array(UpdateBlockerSchema).optional()
|
|
61460
|
+
blockers: array(UpdateBlockerSchema).optional(),
|
|
61461
|
+
/**
|
|
61462
|
+
* The minimums the target server declares and this node does not meet
|
|
61463
|
+
* (D989), present when the update was refused with
|
|
61464
|
+
* `reason: 'requirements-unmet'`. Each names the versions on both sides.
|
|
61465
|
+
*/
|
|
61466
|
+
unmet: array(UnmetRequirementSchema).optional(),
|
|
61467
|
+
/**
|
|
61468
|
+
* The addons this node has below the minimum the staged server declares —
|
|
61469
|
+
* the ones to update WITH the server. Present on an accepted update.
|
|
61470
|
+
*/
|
|
61471
|
+
requiredAddonUpdates: array(RequiredAddonUpdateSchema).optional()
|
|
60893
61472
|
});
|
|
60894
61473
|
var LaunchOverridesSchema = object({
|
|
60895
61474
|
/** The persisted heap ceiling in MB, or `null` when none is set. */
|
|
@@ -63433,7 +64012,9 @@ var PackageUpdateSchema = object({
|
|
|
63433
64012
|
latestVersion: string(),
|
|
63434
64013
|
category: _enum(["addon", "core"]),
|
|
63435
64014
|
requiresRestart: boolean(),
|
|
63436
|
-
isSystem: boolean()
|
|
64015
|
+
isSystem: boolean(),
|
|
64016
|
+
/** Held: what the newer version needs and this node does not meet (D989). */
|
|
64017
|
+
blockedBy: array(UnmetRequirementSchema).readonly().optional()
|
|
63437
64018
|
});
|
|
63438
64019
|
var PackageVersionInfoSchema = object({
|
|
63439
64020
|
version: string(),
|
|
@@ -64889,19 +65470,19 @@ var RemoteSetConfigResultSchema = discriminatedUnion("status", [object({ status:
|
|
|
64889
65470
|
reason: _enum(["unknown-template", "not-a-media-player"]),
|
|
64890
65471
|
detail: string()
|
|
64891
65472
|
})]);
|
|
64892
|
-
var deviceInput = object({ deviceId: number().int().nonnegative() });
|
|
65473
|
+
var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
|
|
64893
65474
|
DeviceType.MediaPlayer;
|
|
64894
|
-
method(deviceInput, RemoteConfigSchema, { auth: "admin" }), method(deviceInput.extend({ config: RemoteConfigSchema }), RemoteSetConfigResultSchema, {
|
|
65475
|
+
method(deviceInput$1, RemoteConfigSchema, { auth: "admin" }), method(deviceInput$1.extend({ config: RemoteConfigSchema }), RemoteSetConfigResultSchema, {
|
|
64895
65476
|
kind: "mutation",
|
|
64896
65477
|
auth: "admin"
|
|
64897
|
-
}), method(deviceInput, RemoteCommandListSchema, { auth: "protected" }), method(deviceInput.extend({
|
|
65478
|
+
}), method(deviceInput$1, RemoteCommandListSchema, { auth: "protected" }), method(deviceInput$1.extend({
|
|
64898
65479
|
role: RemoteRoleSchema,
|
|
64899
65480
|
/** Sends in a row (volume steps). */
|
|
64900
65481
|
repeat: number().int().min(1).max(50).default(1)
|
|
64901
65482
|
}), RemoteSendResultSchema, {
|
|
64902
65483
|
kind: "mutation",
|
|
64903
65484
|
auth: "protected"
|
|
64904
|
-
}), method(deviceInput.extend({
|
|
65485
|
+
}), method(deviceInput$1.extend({
|
|
64905
65486
|
command: RemoteMediaCommandSchema,
|
|
64906
65487
|
muted: boolean().optional(),
|
|
64907
65488
|
source: string().optional(),
|
|
@@ -68724,7 +69305,7 @@ var lawnMowerControlCapability = {
|
|
|
68724
69305
|
* clients — they reverse-connect to the hub. Exposing their interfaces
|
|
68725
69306
|
* via the same surface would leak internal topology with no upside.
|
|
68726
69307
|
*
|
|
68727
|
-
* Implementation in `@camstack/system/builtins/local-network/`.
|
|
69308
|
+
* Implementation in `@camstack/server/system/builtins/local-network/`.
|
|
68728
69309
|
*/
|
|
68729
69310
|
/** Coarse classification derived from the interface name + IP range. */
|
|
68730
69311
|
var InterfaceKindEnum = _enum([
|
|
@@ -69221,6 +69802,117 @@ var lockControlCapability = {
|
|
|
69221
69802
|
* whether persisting is worth a SQLite commit. */
|
|
69222
69803
|
volatileStateFields: ["lastChangedAt"]
|
|
69223
69804
|
};
|
|
69805
|
+
var PowerSourceRefusalReasonSchema = _enum([
|
|
69806
|
+
"no-power-source",
|
|
69807
|
+
"switch-missing",
|
|
69808
|
+
"switch-offline",
|
|
69809
|
+
"switch-unknown",
|
|
69810
|
+
"restart-in-progress",
|
|
69811
|
+
"switch-call-failed"
|
|
69812
|
+
]);
|
|
69813
|
+
var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
|
|
69814
|
+
accepted: literal(false),
|
|
69815
|
+
reason: PowerSourceRefusalReasonSchema,
|
|
69816
|
+
/** One line for the operator, naming the switch. */
|
|
69817
|
+
message: string()
|
|
69818
|
+
})]);
|
|
69819
|
+
var PowerSourceInfoSchema = object({
|
|
69820
|
+
/** False when the device has no power source linked; the rest is then empty. */
|
|
69821
|
+
linked: boolean(),
|
|
69822
|
+
switchDeviceId: number().nullable(),
|
|
69823
|
+
switchName: string().nullable(),
|
|
69824
|
+
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
69825
|
+
switchOn: boolean().nullable(),
|
|
69826
|
+
switchOnline: boolean().nullable(),
|
|
69827
|
+
restartInProgress: boolean(),
|
|
69828
|
+
offSeconds: number().int()
|
|
69829
|
+
});
|
|
69830
|
+
/** The composed slice: the switch state the link mirrors, plus the stored off time. */
|
|
69831
|
+
var PowerSourceStateSchema = object({
|
|
69832
|
+
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
69833
|
+
switchOn: boolean().nullable(),
|
|
69834
|
+
offSeconds: number().int(),
|
|
69835
|
+
lastFetchedAt: number()
|
|
69836
|
+
});
|
|
69837
|
+
var POWER_SOURCE_DEVICE_TYPES = [
|
|
69838
|
+
DeviceType.Gateway,
|
|
69839
|
+
DeviceType.Hub,
|
|
69840
|
+
DeviceType.Camera,
|
|
69841
|
+
DeviceType.Sensor,
|
|
69842
|
+
DeviceType.MediaPlayer,
|
|
69843
|
+
DeviceType.Vacuum,
|
|
69844
|
+
DeviceType.Generic,
|
|
69845
|
+
DeviceType.Washer,
|
|
69846
|
+
DeviceType.Dryer,
|
|
69847
|
+
DeviceType.Dishwasher,
|
|
69848
|
+
DeviceType.PetFountain,
|
|
69849
|
+
DeviceType.Fan,
|
|
69850
|
+
DeviceType.Humidifier,
|
|
69851
|
+
DeviceType.Climate,
|
|
69852
|
+
DeviceType.WaterHeater
|
|
69853
|
+
];
|
|
69854
|
+
var powerSourceCustomize = {
|
|
69855
|
+
version: 1,
|
|
69856
|
+
targets: [{
|
|
69857
|
+
id: "switch",
|
|
69858
|
+
cardinality: "scalar",
|
|
69859
|
+
vocabulary: {
|
|
69860
|
+
cap: "power-source",
|
|
69861
|
+
stateField: "switchOn"
|
|
69862
|
+
},
|
|
69863
|
+
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
69864
|
+
apply: "add",
|
|
69865
|
+
path: "switchOn",
|
|
69866
|
+
sources: [{
|
|
69867
|
+
kind: "switch",
|
|
69868
|
+
transforms: [{ kind: "identity" }]
|
|
69869
|
+
}],
|
|
69870
|
+
companions: [{
|
|
69871
|
+
kind: "constant",
|
|
69872
|
+
path: "offSeconds",
|
|
69873
|
+
value: 10,
|
|
69874
|
+
when: "add"
|
|
69875
|
+
}, {
|
|
69876
|
+
kind: "clock",
|
|
69877
|
+
path: "lastFetchedAt",
|
|
69878
|
+
when: "always"
|
|
69879
|
+
}],
|
|
69880
|
+
sourceReport: { status: "assignment-status" }
|
|
69881
|
+
}]
|
|
69882
|
+
};
|
|
69883
|
+
var deviceInput = object({ deviceId: number().int().nonnegative() });
|
|
69884
|
+
var powerSourceCapability = {
|
|
69885
|
+
name: "power-source",
|
|
69886
|
+
scope: "device",
|
|
69887
|
+
mode: "singleton",
|
|
69888
|
+
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
69889
|
+
methods: {
|
|
69890
|
+
getStatus: systemMethod(deviceInput, PowerSourceInfoSchema, { auth: "admin" }),
|
|
69891
|
+
powerOn: systemMethod(deviceInput, PowerSourceActionResultSchema, {
|
|
69892
|
+
kind: "mutation",
|
|
69893
|
+
auth: "admin"
|
|
69894
|
+
}),
|
|
69895
|
+
powerOff: systemMethod(deviceInput, PowerSourceActionResultSchema, {
|
|
69896
|
+
kind: "mutation",
|
|
69897
|
+
auth: "admin"
|
|
69898
|
+
}),
|
|
69899
|
+
forceRestart: systemMethod(deviceInput, PowerSourceActionResultSchema, {
|
|
69900
|
+
kind: "mutation",
|
|
69901
|
+
auth: "admin"
|
|
69902
|
+
})
|
|
69903
|
+
},
|
|
69904
|
+
runtimeState: PowerSourceStateSchema,
|
|
69905
|
+
customize: powerSourceCustomize,
|
|
69906
|
+
/**
|
|
69907
|
+
* Runtime-state durability: **session** — mirrored from the linked switch on
|
|
69908
|
+
* its next report; a restored value would outlive the reading it names.
|
|
69909
|
+
*
|
|
69910
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
69911
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
69912
|
+
*/
|
|
69913
|
+
durability: "session",
|
|
69914
|
+
history: "none"
|
|
69915
|
+
};
|
|
69224
69916
|
/**
|
|
69225
69917
|
* A monotonic total between resets (D944). Energy uses `power-meter.energy`
|
|
69226
69918
|
* so dashboards keep one series; every other instantaneous reading lands here.
|
|
@@ -70501,7 +71193,7 @@ onStatusChanged: { data: object({
|
|
|
70501
71193
|
* jitter, and observed/peak bandwidth per device + per client.
|
|
70502
71194
|
*
|
|
70503
71195
|
* Implementation lives in the server's `NetworkQualityService` (thin
|
|
70504
|
-
* wrapper over the shared `NetworkQualityTracker` from `@camstack/system`).
|
|
71196
|
+
* wrapper over the shared `NetworkQualityTracker` from `@camstack/server/system`).
|
|
70505
71197
|
* The provider is registered from `trpc.router.ts` against the existing
|
|
70506
71198
|
* service instance — no addon owns this state.
|
|
70507
71199
|
*
|
|
@@ -72652,7 +73344,7 @@ var ptzAutotrackCapability = {
|
|
|
72652
73344
|
* - **Native**: the camera's own firmware autotrack, registered per device by
|
|
72653
73345
|
* the driver when the probe says it exists (Reolink: yes; Hikvision:
|
|
72654
73346
|
* model-dependent).
|
|
72655
|
-
* - **Wrapper**: the emulated implementation (`@camstack/system`'s `autotrack` builtin),
|
|
73347
|
+
* - **Wrapper**: the emulated implementation (`@camstack/server/system`'s `autotrack` builtin),
|
|
72656
73348
|
* which follows a subject with `ptz.move` pulses driven by the detection
|
|
72657
73349
|
* pipeline. `defaultActive: false` — the operator binds it per camera in
|
|
72658
73350
|
* the bindings UI.
|
|
@@ -78000,6 +78692,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
78000
78692
|
petFeeder: petFeederCapability,
|
|
78001
78693
|
petFountain: petFountainCapability,
|
|
78002
78694
|
powerMeter: powerMeterCapability,
|
|
78695
|
+
powerSource: powerSourceCapability,
|
|
78003
78696
|
presence: presenceCapability,
|
|
78004
78697
|
pressureSensor: pressureSensorCapability,
|
|
78005
78698
|
privacyMask: privacyMaskCapability,
|
|
@@ -83764,6 +84457,69 @@ Object.freeze({
|
|
|
83764
84457
|
access: "view",
|
|
83765
84458
|
role: "admin"
|
|
83766
84459
|
},
|
|
84460
|
+
"migrations.declareOwner": {
|
|
84461
|
+
capName: "migrations",
|
|
84462
|
+
capScope: "system",
|
|
84463
|
+
addonId: null,
|
|
84464
|
+
access: "create",
|
|
84465
|
+
role: "admin"
|
|
84466
|
+
},
|
|
84467
|
+
"migrations.dryRun": {
|
|
84468
|
+
capName: "migrations",
|
|
84469
|
+
capScope: "system",
|
|
84470
|
+
addonId: null,
|
|
84471
|
+
access: "view",
|
|
84472
|
+
role: "admin"
|
|
84473
|
+
},
|
|
84474
|
+
"migrations.finishMigration": {
|
|
84475
|
+
capName: "migrations",
|
|
84476
|
+
capScope: "system",
|
|
84477
|
+
addonId: null,
|
|
84478
|
+
access: "create",
|
|
84479
|
+
role: "admin"
|
|
84480
|
+
},
|
|
84481
|
+
"migrations.listLedger": {
|
|
84482
|
+
capName: "migrations",
|
|
84483
|
+
capScope: "system",
|
|
84484
|
+
addonId: null,
|
|
84485
|
+
access: "view",
|
|
84486
|
+
role: "admin"
|
|
84487
|
+
},
|
|
84488
|
+
"migrations.listPending": {
|
|
84489
|
+
capName: "migrations",
|
|
84490
|
+
capScope: "system",
|
|
84491
|
+
addonId: null,
|
|
84492
|
+
access: "view",
|
|
84493
|
+
role: "admin"
|
|
84494
|
+
},
|
|
84495
|
+
"migrations.markFailed": {
|
|
84496
|
+
capName: "migrations",
|
|
84497
|
+
capScope: "system",
|
|
84498
|
+
addonId: null,
|
|
84499
|
+
access: "create",
|
|
84500
|
+
role: "admin"
|
|
84501
|
+
},
|
|
84502
|
+
"migrations.restorePreMigration": {
|
|
84503
|
+
capName: "migrations",
|
|
84504
|
+
capScope: "system",
|
|
84505
|
+
addonId: null,
|
|
84506
|
+
access: "create",
|
|
84507
|
+
role: "admin"
|
|
84508
|
+
},
|
|
84509
|
+
"migrations.retry": {
|
|
84510
|
+
capName: "migrations",
|
|
84511
|
+
capScope: "system",
|
|
84512
|
+
addonId: null,
|
|
84513
|
+
access: "create",
|
|
84514
|
+
role: "admin"
|
|
84515
|
+
},
|
|
84516
|
+
"migrations.startMigration": {
|
|
84517
|
+
capName: "migrations",
|
|
84518
|
+
capScope: "system",
|
|
84519
|
+
addonId: null,
|
|
84520
|
+
access: "create",
|
|
84521
|
+
role: "admin"
|
|
84522
|
+
},
|
|
83767
84523
|
"modelConvert.convert": {
|
|
83768
84524
|
capName: "model-convert",
|
|
83769
84525
|
capScope: "system",
|
|
@@ -86396,6 +87152,34 @@ Object.freeze({
|
|
|
86396
87152
|
access: "view",
|
|
86397
87153
|
role: "viewer"
|
|
86398
87154
|
},
|
|
87155
|
+
"powerSource.forceRestart": {
|
|
87156
|
+
capName: "power-source",
|
|
87157
|
+
capScope: "device",
|
|
87158
|
+
addonId: null,
|
|
87159
|
+
access: "create",
|
|
87160
|
+
role: "admin"
|
|
87161
|
+
},
|
|
87162
|
+
"powerSource.getStatus": {
|
|
87163
|
+
capName: "power-source",
|
|
87164
|
+
capScope: "device",
|
|
87165
|
+
addonId: null,
|
|
87166
|
+
access: "view",
|
|
87167
|
+
role: "admin"
|
|
87168
|
+
},
|
|
87169
|
+
"powerSource.powerOff": {
|
|
87170
|
+
capName: "power-source",
|
|
87171
|
+
capScope: "device",
|
|
87172
|
+
addonId: null,
|
|
87173
|
+
access: "create",
|
|
87174
|
+
role: "admin"
|
|
87175
|
+
},
|
|
87176
|
+
"powerSource.powerOn": {
|
|
87177
|
+
capName: "power-source",
|
|
87178
|
+
capScope: "device",
|
|
87179
|
+
addonId: null,
|
|
87180
|
+
access: "create",
|
|
87181
|
+
role: "admin"
|
|
87182
|
+
},
|
|
86399
87183
|
"presence.getStatus": {
|
|
86400
87184
|
capName: "presence",
|
|
86401
87185
|
capScope: "device",
|
|
@@ -91544,6 +92328,26 @@ Object.freeze({
|
|
|
91544
92328
|
form: "single",
|
|
91545
92329
|
optional: false
|
|
91546
92330
|
}],
|
|
92331
|
+
"powerSource.forceRestart": [{
|
|
92332
|
+
name: "deviceId",
|
|
92333
|
+
form: "single",
|
|
92334
|
+
optional: false
|
|
92335
|
+
}],
|
|
92336
|
+
"powerSource.getStatus": [{
|
|
92337
|
+
name: "deviceId",
|
|
92338
|
+
form: "single",
|
|
92339
|
+
optional: false
|
|
92340
|
+
}],
|
|
92341
|
+
"powerSource.powerOff": [{
|
|
92342
|
+
name: "deviceId",
|
|
92343
|
+
form: "single",
|
|
92344
|
+
optional: false
|
|
92345
|
+
}],
|
|
92346
|
+
"powerSource.powerOn": [{
|
|
92347
|
+
name: "deviceId",
|
|
92348
|
+
form: "single",
|
|
92349
|
+
optional: false
|
|
92350
|
+
}],
|
|
91547
92351
|
"presence.getStatus": [{
|
|
91548
92352
|
name: "deviceId",
|
|
91549
92353
|
form: "single",
|
|
@@ -93840,7 +94644,7 @@ function oauthLandingUrl(origin, outcome) {
|
|
|
93840
94644
|
if (outcome.brokerId !== void 0) params.set("broker", outcome.brokerId);
|
|
93841
94645
|
if (outcome.integration !== void 0) params.set("integration", outcome.integration);
|
|
93842
94646
|
if (outcome.status === "error") params.set("reason", outcome.reason ?? "unknown");
|
|
93843
|
-
if (outcome.action === "disconnect") params.set("action",
|
|
94647
|
+
if (outcome.action === "disconnect" || outcome.action === "cli-login") params.set("action", outcome.action);
|
|
93844
94648
|
return `${origin === null ? "" : origin.replace(/\/+$/, "")}${OAUTH_LANDING_PATH}#${params.toString()}`;
|
|
93845
94649
|
}
|
|
93846
94650
|
var LOOPBACK_HOSTS = new Set([
|