@camstack/sdk 1.2.93 → 1.2.95
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/dist/camera.d.ts +1 -3
- package/dist/detection.d.ts +1 -1
- package/dist/index.cjs +1 -333
- package/dist/index.d.ts +1 -5
- package/dist/index.js +2 -322
- package/dist/nvr.d.ts +1 -1
- package/dist/timeline.d.ts +2 -2
- package/dist/types.d.ts +3 -3
- package/package.json +1 -1
- package/dist/devices.d.ts +0 -147
- package/dist/features.d.ts +0 -31
package/dist/camera.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Camera & PTZ types — shared between CamStack app and proxy.
|
|
3
3
|
*/
|
|
4
|
-
/** Camera source type discriminator. */
|
|
5
|
-
export type CameraSourceType = 'scrypted' | 'frigate' | 'onvif' | 'rtsp' | 'camstack';
|
|
6
4
|
/** Streaming method. */
|
|
7
5
|
export type StreamMethod = 'webrtc' | 'mjpeg';
|
|
8
|
-
/**
|
|
6
|
+
/** PTZ command. */
|
|
9
7
|
export interface PanTiltZoomCommand {
|
|
10
8
|
movement?: 'Relative' | 'Absolute' | 'Continuous' | 'Home' | 'Preset';
|
|
11
9
|
pan?: number;
|
package/dist/detection.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1410,7 +1410,7 @@ async function raceFastestEndpoint(candidates, timeoutMs) {
|
|
|
1410
1410
|
//#region src/detection.ts
|
|
1411
1411
|
/**
|
|
1412
1412
|
* Detection classes — shared between CamStack app and proxy.
|
|
1413
|
-
* Aligned with
|
|
1413
|
+
* Aligned with the shared detection-class taxonomy.
|
|
1414
1414
|
*/
|
|
1415
1415
|
var DetectionClass = /* @__PURE__ */ function(DetectionClass) {
|
|
1416
1416
|
DetectionClass["Motion"] = "motion";
|
|
@@ -1719,336 +1719,8 @@ function getClassesForTimelinePreset(preset, customClasses) {
|
|
|
1719
1719
|
}
|
|
1720
1720
|
}
|
|
1721
1721
|
//#endregion
|
|
1722
|
-
//#region src/devices.ts
|
|
1723
|
-
/**
|
|
1724
|
-
* Maps raw device types from Scrypted (PascalCase) and Home Assistant (lowercase domains)
|
|
1725
|
-
* to canonical CamStack device types.
|
|
1726
|
-
*/
|
|
1727
|
-
var RAW_TO_CANONICAL = {
|
|
1728
|
-
Light: "light",
|
|
1729
|
-
Switch: "switch",
|
|
1730
|
-
WindowCovering: "cover",
|
|
1731
|
-
Lock: "lock",
|
|
1732
|
-
SecuritySystem: "alarm",
|
|
1733
|
-
Buttons: "button",
|
|
1734
|
-
Select: "select",
|
|
1735
|
-
Siren: "siren",
|
|
1736
|
-
Sensor: "sensor",
|
|
1737
|
-
Entry: "entry",
|
|
1738
|
-
Program: "script",
|
|
1739
|
-
MediaPlayer: "media_player",
|
|
1740
|
-
Outlet: "switch",
|
|
1741
|
-
light: "light",
|
|
1742
|
-
switch: "switch",
|
|
1743
|
-
input_boolean: "switch",
|
|
1744
|
-
cover: "cover",
|
|
1745
|
-
lock: "lock",
|
|
1746
|
-
alarm_control_panel: "alarm",
|
|
1747
|
-
input_button: "button",
|
|
1748
|
-
button: "button",
|
|
1749
|
-
input_select: "select",
|
|
1750
|
-
select: "select",
|
|
1751
|
-
siren: "siren",
|
|
1752
|
-
sensor: "sensor",
|
|
1753
|
-
media_player: "media_player",
|
|
1754
|
-
script: "script"
|
|
1755
|
-
};
|
|
1756
|
-
/**
|
|
1757
|
-
* Extended HA domain → type map (includes non-eligible domains for display/categorization).
|
|
1758
|
-
* Superset of RAW_TO_CANONICAL for HA-specific domains.
|
|
1759
|
-
*/
|
|
1760
|
-
var HA_DOMAIN_TYPE_MAP = {
|
|
1761
|
-
light: "light",
|
|
1762
|
-
switch: "switch",
|
|
1763
|
-
input_boolean: "switch",
|
|
1764
|
-
cover: "cover",
|
|
1765
|
-
lock: "lock",
|
|
1766
|
-
alarm_control_panel: "alarm",
|
|
1767
|
-
input_button: "button",
|
|
1768
|
-
button: "button",
|
|
1769
|
-
input_select: "select",
|
|
1770
|
-
select: "select",
|
|
1771
|
-
siren: "siren",
|
|
1772
|
-
sensor: "sensor",
|
|
1773
|
-
binary_sensor: "sensor",
|
|
1774
|
-
media_player: "media_player",
|
|
1775
|
-
script: "script",
|
|
1776
|
-
climate: "climate",
|
|
1777
|
-
camera: "camera",
|
|
1778
|
-
fan: "fan",
|
|
1779
|
-
vacuum: "vacuum",
|
|
1780
|
-
automation: "automation",
|
|
1781
|
-
scene: "scene",
|
|
1782
|
-
input_number: "sensor",
|
|
1783
|
-
person: "person",
|
|
1784
|
-
device_tracker: "tracker",
|
|
1785
|
-
weather: "weather",
|
|
1786
|
-
water_heater: "climate"
|
|
1787
|
-
};
|
|
1788
|
-
/**
|
|
1789
|
-
* Extended Scrypted type → canonical map (includes non-eligible types for display).
|
|
1790
|
-
* Superset of RAW_TO_CANONICAL for Scrypted-specific types.
|
|
1791
|
-
*/
|
|
1792
|
-
var SCRYPTED_TYPE_TO_CANONICAL = {
|
|
1793
|
-
Light: "light",
|
|
1794
|
-
Switch: "switch",
|
|
1795
|
-
WindowCovering: "cover",
|
|
1796
|
-
Lock: "lock",
|
|
1797
|
-
SecuritySystem: "alarm",
|
|
1798
|
-
Buttons: "button",
|
|
1799
|
-
Select: "select",
|
|
1800
|
-
Siren: "siren",
|
|
1801
|
-
Sensor: "sensor",
|
|
1802
|
-
Entry: "entry",
|
|
1803
|
-
Program: "script",
|
|
1804
|
-
MediaPlayer: "media_player",
|
|
1805
|
-
Camera: "camera",
|
|
1806
|
-
Doorbell: "doorbell",
|
|
1807
|
-
Fan: "fan",
|
|
1808
|
-
Outlet: "switch"
|
|
1809
|
-
};
|
|
1810
|
-
/** Normalize raw type (Scrypted or HA) to canonical key for filtering and display. */
|
|
1811
|
-
function getCanonicalDeviceType(rawType) {
|
|
1812
|
-
const canonical = RAW_TO_CANONICAL[rawType];
|
|
1813
|
-
if (canonical) return canonical;
|
|
1814
|
-
return RAW_TO_CANONICAL[rawType.toLowerCase()] ?? null;
|
|
1815
|
-
}
|
|
1816
|
-
/** Scrypted device types eligible for device control in CamStack. PascalCase. */
|
|
1817
|
-
var ELIGIBLE_SCRYPTED_DEVICE_TYPES = [
|
|
1818
|
-
"Entry",
|
|
1819
|
-
"Light",
|
|
1820
|
-
"Switch",
|
|
1821
|
-
"Lock",
|
|
1822
|
-
"SecuritySystem",
|
|
1823
|
-
"Buttons",
|
|
1824
|
-
"WindowCovering",
|
|
1825
|
-
"Siren",
|
|
1826
|
-
"Sensor",
|
|
1827
|
-
"Select",
|
|
1828
|
-
"Program"
|
|
1829
|
-
];
|
|
1830
|
-
/** Set version for O(1) lookup. */
|
|
1831
|
-
var ELIGIBLE_SCRYPTED_DEVICE_TYPES_SET = new Set(ELIGIBLE_SCRYPTED_DEVICE_TYPES);
|
|
1832
|
-
/** Home Assistant domains eligible for device control in CamStack. */
|
|
1833
|
-
var ELIGIBLE_HA_DOMAINS = [
|
|
1834
|
-
"light",
|
|
1835
|
-
"switch",
|
|
1836
|
-
"input_boolean",
|
|
1837
|
-
"cover",
|
|
1838
|
-
"lock",
|
|
1839
|
-
"alarm_control_panel",
|
|
1840
|
-
"input_button",
|
|
1841
|
-
"button",
|
|
1842
|
-
"input_select",
|
|
1843
|
-
"select",
|
|
1844
|
-
"siren",
|
|
1845
|
-
"media_player",
|
|
1846
|
-
"script"
|
|
1847
|
-
];
|
|
1848
|
-
/** Set version for O(1) lookup. */
|
|
1849
|
-
var ELIGIBLE_HA_DOMAINS_SET = new Set(ELIGIBLE_HA_DOMAINS);
|
|
1850
|
-
//#endregion
|
|
1851
|
-
//#region src/features.ts
|
|
1852
|
-
var FEATURE_MATRIX = [
|
|
1853
|
-
{
|
|
1854
|
-
id: "liveStream",
|
|
1855
|
-
label: "Live Stream",
|
|
1856
|
-
sources: {
|
|
1857
|
-
frigate: true,
|
|
1858
|
-
scrypted: true,
|
|
1859
|
-
rtsp: true
|
|
1860
|
-
},
|
|
1861
|
-
adapterMethod: "getLiveStream"
|
|
1862
|
-
},
|
|
1863
|
-
{
|
|
1864
|
-
id: "multiResolution",
|
|
1865
|
-
label: "Multi-Resolution",
|
|
1866
|
-
sources: {
|
|
1867
|
-
frigate: true,
|
|
1868
|
-
scrypted: true,
|
|
1869
|
-
rtsp: false
|
|
1870
|
-
},
|
|
1871
|
-
adapterMethod: "getResolutions"
|
|
1872
|
-
},
|
|
1873
|
-
{
|
|
1874
|
-
id: "motion",
|
|
1875
|
-
label: "Motion Detection",
|
|
1876
|
-
sources: {
|
|
1877
|
-
frigate: false,
|
|
1878
|
-
scrypted: true,
|
|
1879
|
-
rtsp: false
|
|
1880
|
-
},
|
|
1881
|
-
adapterMethod: "getMotion"
|
|
1882
|
-
},
|
|
1883
|
-
{
|
|
1884
|
-
id: "objectDetection",
|
|
1885
|
-
label: "Object Detection",
|
|
1886
|
-
sources: {
|
|
1887
|
-
frigate: false,
|
|
1888
|
-
scrypted: true,
|
|
1889
|
-
rtsp: false
|
|
1890
|
-
},
|
|
1891
|
-
adapterMethod: "getObjectDetections"
|
|
1892
|
-
},
|
|
1893
|
-
{
|
|
1894
|
-
id: "audioVolume",
|
|
1895
|
-
label: "Audio Level",
|
|
1896
|
-
sources: {
|
|
1897
|
-
frigate: false,
|
|
1898
|
-
scrypted: true,
|
|
1899
|
-
rtsp: false
|
|
1900
|
-
},
|
|
1901
|
-
adapterMethod: "getAudioVolume"
|
|
1902
|
-
},
|
|
1903
|
-
{
|
|
1904
|
-
id: "audioVolumes",
|
|
1905
|
-
label: "Audio Volumes (dBFS)",
|
|
1906
|
-
sources: {
|
|
1907
|
-
frigate: false,
|
|
1908
|
-
scrypted: true,
|
|
1909
|
-
rtsp: false
|
|
1910
|
-
},
|
|
1911
|
-
adapterMethod: "getAudioVolumes"
|
|
1912
|
-
},
|
|
1913
|
-
{
|
|
1914
|
-
id: "ptz",
|
|
1915
|
-
label: "PTZ Control",
|
|
1916
|
-
sources: {
|
|
1917
|
-
frigate: false,
|
|
1918
|
-
scrypted: true,
|
|
1919
|
-
rtsp: false
|
|
1920
|
-
},
|
|
1921
|
-
adapterMethod: "getPTZ"
|
|
1922
|
-
},
|
|
1923
|
-
{
|
|
1924
|
-
id: "intercom",
|
|
1925
|
-
label: "Intercom (Mic)",
|
|
1926
|
-
sources: {
|
|
1927
|
-
frigate: false,
|
|
1928
|
-
scrypted: true,
|
|
1929
|
-
rtsp: false
|
|
1930
|
-
},
|
|
1931
|
-
adapterMethod: "getIntercomSupport"
|
|
1932
|
-
},
|
|
1933
|
-
{
|
|
1934
|
-
id: "deviceStatus",
|
|
1935
|
-
label: "Device Status",
|
|
1936
|
-
sources: {
|
|
1937
|
-
frigate: false,
|
|
1938
|
-
scrypted: true,
|
|
1939
|
-
rtsp: false
|
|
1940
|
-
},
|
|
1941
|
-
adapterMethod: "getStatus"
|
|
1942
|
-
},
|
|
1943
|
-
{
|
|
1944
|
-
id: "timeline",
|
|
1945
|
-
label: "Detection Timeline",
|
|
1946
|
-
sources: {
|
|
1947
|
-
frigate: true,
|
|
1948
|
-
scrypted: true,
|
|
1949
|
-
rtsp: false
|
|
1950
|
-
},
|
|
1951
|
-
adapterMethod: "getCameraDayData"
|
|
1952
|
-
},
|
|
1953
|
-
{
|
|
1954
|
-
id: "clusteredTimeline",
|
|
1955
|
-
label: "Clustered Timeline",
|
|
1956
|
-
sources: {
|
|
1957
|
-
frigate: true,
|
|
1958
|
-
scrypted: true,
|
|
1959
|
-
rtsp: false
|
|
1960
|
-
},
|
|
1961
|
-
requiresBackend: true,
|
|
1962
|
-
adapterMethod: "getClusteredDayData"
|
|
1963
|
-
},
|
|
1964
|
-
{
|
|
1965
|
-
id: "detectionClasses",
|
|
1966
|
-
label: "Detection Classes",
|
|
1967
|
-
sources: {
|
|
1968
|
-
frigate: true,
|
|
1969
|
-
scrypted: true,
|
|
1970
|
-
rtsp: false
|
|
1971
|
-
},
|
|
1972
|
-
adapterMethod: "getDetectionClasses"
|
|
1973
|
-
},
|
|
1974
|
-
{
|
|
1975
|
-
id: "videoClips",
|
|
1976
|
-
label: "Video Clips",
|
|
1977
|
-
sources: {
|
|
1978
|
-
frigate: true,
|
|
1979
|
-
scrypted: true,
|
|
1980
|
-
rtsp: false
|
|
1981
|
-
},
|
|
1982
|
-
adapterMethod: "getVideoClips"
|
|
1983
|
-
},
|
|
1984
|
-
{
|
|
1985
|
-
id: "nvrPlayback",
|
|
1986
|
-
label: "NVR Playback",
|
|
1987
|
-
sources: {
|
|
1988
|
-
frigate: true,
|
|
1989
|
-
scrypted: true,
|
|
1990
|
-
rtsp: false
|
|
1991
|
-
},
|
|
1992
|
-
adapterMethod: "getNvrPlaybackSupported"
|
|
1993
|
-
},
|
|
1994
|
-
{
|
|
1995
|
-
id: "nvrScrub",
|
|
1996
|
-
label: "NVR Scrub/Seek",
|
|
1997
|
-
sources: {
|
|
1998
|
-
frigate: false,
|
|
1999
|
-
scrypted: true,
|
|
2000
|
-
rtsp: false
|
|
2001
|
-
},
|
|
2002
|
-
adapterMethod: "seekRecordingStream"
|
|
2003
|
-
},
|
|
2004
|
-
{
|
|
2005
|
-
id: "recordingThumbnail",
|
|
2006
|
-
label: "Recording Thumbnails",
|
|
2007
|
-
sources: {
|
|
2008
|
-
frigate: true,
|
|
2009
|
-
scrypted: true,
|
|
2010
|
-
rtsp: false
|
|
2011
|
-
},
|
|
2012
|
-
adapterMethod: "getRecordingStreamThumbnail"
|
|
2013
|
-
},
|
|
2014
|
-
{
|
|
2015
|
-
id: "nvrSeekToLive",
|
|
2016
|
-
label: "Seek to Live",
|
|
2017
|
-
sources: {
|
|
2018
|
-
frigate: false,
|
|
2019
|
-
scrypted: true,
|
|
2020
|
-
rtsp: false
|
|
2021
|
-
},
|
|
2022
|
-
adapterMethod: "seekNvrToLive"
|
|
2023
|
-
}
|
|
2024
|
-
];
|
|
2025
|
-
/** Check if a feature is available for a given source type and platform. */
|
|
2026
|
-
function isFeatureAvailable(featureId, source, platform) {
|
|
2027
|
-
const entry = FEATURE_MATRIX.find((f) => f.id === featureId);
|
|
2028
|
-
if (!entry) return false;
|
|
2029
|
-
if (!entry.sources[source]) return false;
|
|
2030
|
-
if (entry.platforms && entry.platforms[platform] === false) return false;
|
|
2031
|
-
return true;
|
|
2032
|
-
}
|
|
2033
|
-
/** Get all features supported by a source type. */
|
|
2034
|
-
function getSourceFeatures(source) {
|
|
2035
|
-
return FEATURE_MATRIX.filter((f) => f.sources[source]);
|
|
2036
|
-
}
|
|
2037
|
-
/** Get all features that require the backend proxy. */
|
|
2038
|
-
function getBackendRequiredFeatures() {
|
|
2039
|
-
return FEATURE_MATRIX.filter((f) => f.requiresBackend);
|
|
2040
|
-
}
|
|
2041
|
-
//#endregion
|
|
2042
1722
|
exports.DEFAULT_ENABLED_CLASSES = DEFAULT_ENABLED_CLASSES;
|
|
2043
1723
|
exports.DetectionClass = DetectionClass;
|
|
2044
|
-
exports.ELIGIBLE_HA_DOMAINS = ELIGIBLE_HA_DOMAINS;
|
|
2045
|
-
exports.ELIGIBLE_HA_DOMAINS_SET = ELIGIBLE_HA_DOMAINS_SET;
|
|
2046
|
-
exports.ELIGIBLE_SCRYPTED_DEVICE_TYPES = ELIGIBLE_SCRYPTED_DEVICE_TYPES;
|
|
2047
|
-
exports.ELIGIBLE_SCRYPTED_DEVICE_TYPES_SET = ELIGIBLE_SCRYPTED_DEVICE_TYPES_SET;
|
|
2048
|
-
exports.FEATURE_MATRIX = FEATURE_MATRIX;
|
|
2049
|
-
exports.HA_DOMAIN_TYPE_MAP = HA_DOMAIN_TYPE_MAP;
|
|
2050
|
-
exports.RAW_TO_CANONICAL = RAW_TO_CANONICAL;
|
|
2051
|
-
exports.SCRYPTED_TYPE_TO_CANONICAL = SCRYPTED_TYPE_TO_CANONICAL;
|
|
2052
1724
|
exports.System = System;
|
|
2053
1725
|
exports.TIMELINE_PRESET_ALL = TIMELINE_PRESET_ALL;
|
|
2054
1726
|
exports.TIMELINE_PRESET_CRITICAL = TIMELINE_PRESET_CRITICAL;
|
|
@@ -2061,17 +1733,13 @@ exports.defaultDetectionClasses = defaultDetectionClasses;
|
|
|
2061
1733
|
exports.detectionClassesDefaultMap = detectionClassesDefaultMap;
|
|
2062
1734
|
exports.doorbellClasses = doorbellClasses;
|
|
2063
1735
|
exports.faceClasses = faceClasses;
|
|
2064
|
-
exports.getBackendRequiredFeatures = getBackendRequiredFeatures;
|
|
2065
|
-
exports.getCanonicalDeviceType = getCanonicalDeviceType;
|
|
2066
1736
|
exports.getClassesForTimelinePreset = getClassesForTimelinePreset;
|
|
2067
1737
|
exports.getParentClass = getParentClass;
|
|
2068
1738
|
exports.getParentDetectionClass = getParentDetectionClass;
|
|
2069
|
-
exports.getSourceFeatures = getSourceFeatures;
|
|
2070
1739
|
exports.isAnimalClassname = isAnimalClassname;
|
|
2071
1740
|
exports.isAudioClassname = isAudioClassname;
|
|
2072
1741
|
exports.isDoorbellClassname = isDoorbellClassname;
|
|
2073
1742
|
exports.isFaceClassname = isFaceClassname;
|
|
2074
|
-
exports.isFeatureAvailable = isFeatureAvailable;
|
|
2075
1743
|
exports.isLabelDetection = isLabelDetection;
|
|
2076
1744
|
exports.isMotionClassname = isMotionClassname;
|
|
2077
1745
|
exports.isPackageClassname = isPackageClassname;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,10 +6,6 @@ export type { BackendAppRouter as AppRouter } from './backend-router.js';
|
|
|
6
6
|
export type { BackendConnectionState } from './types.js';
|
|
7
7
|
export { DetectionClass, animalClasses, personClasses, vehicleClasses, faceClasses, licensePlateClasses, motionClasses, packageClasses, audioClasses, audioLabelClasses, doorbellClasses, sensorLabelClasses, detectionClassesDefaultMap, isFaceClassname, isPlateClassname, isAnimalClassname, isPersonClassname, isVehicleClassname, isMotionClassname, isDoorbellClassname, isPackageClassname, isAudioClassname, isSensorLabelClassname, isLabelDetection, getParentClass, getParentDetectionClass, defaultDetectionClasses, DEFAULT_ENABLED_CLASSES, TIMELINE_PRESET_CRITICAL, TIMELINE_PRESET_IMPORTANT, TIMELINE_PRESET_ALL, getClassesForTimelinePreset, } from './detection.js';
|
|
8
8
|
export type { TimelineEventPreset } from './detection.js';
|
|
9
|
-
export { RAW_TO_CANONICAL, HA_DOMAIN_TYPE_MAP, SCRYPTED_TYPE_TO_CANONICAL, getCanonicalDeviceType, ELIGIBLE_SCRYPTED_DEVICE_TYPES, ELIGIBLE_SCRYPTED_DEVICE_TYPES_SET, ELIGIBLE_HA_DOMAINS, ELIGIBLE_HA_DOMAINS_SET, } from './devices.js';
|
|
10
|
-
export type { CanonicalDeviceType, DeviceCommandAction, AssociatedDeviceState, Device, DeviceAction, DeviceActionParam, DeviceCommand, CommandResult, AssociatedDeviceSource, EligibleDevice, } from './devices.js';
|
|
11
9
|
export type { TimelineEventSeverity, MotionFragmentType, DetectionEvent, MotionItem, TimelineArtifact, AudioLevelSegment, TimelineRecordingSegment, CameraDayDataResponse, ClusteredDayDataResponse, TimelineCluster, DetectionGroup, ClusteredDayDataQuery, GroupedEventsQuery, GroupedEventsResult, ClusterEventsQuery, ClusterEventsResult, ReelEvent, ReelEventsQuery, ReelEventsResult, } from './timeline.js';
|
|
12
|
-
export type {
|
|
13
|
-
export { FEATURE_MATRIX, isFeatureAvailable, getSourceFeatures, getBackendRequiredFeatures, } from './features.js';
|
|
14
|
-
export type { FeatureId, PlatformId, SourceType, FeatureEntry, } from './features.js';
|
|
10
|
+
export type { StreamMethod, PanTiltZoomCommand, PanTiltZoomCapabilities, CameraAccessorySwitchKind, CameraStatusEntry, CamerasStatusResult, } from './camera.js';
|
|
15
11
|
export type { StreamSourceEntry, NvrCamera, CameraAccessory, StreamInfo, NormalizedBoundingBox, DetectionData, EventSnapshotData, NvrEvent, RecordingSegment, MotionBucket, LiveDetection, LiveMotionData, LiveDetectionData, LiveAudioData, LiveMotionEvent, LiveDetectionEvent, LiveAudioEvent, LiveGenericEvent, LiveReviewEvent, LiveEvent, LiveEventType, VideoClipsQuery, NvrVideoClip, VideoClipsResult, VideoClipUrlResult, CameraDayData, CameraStatus, EventsQuery, MotionQuery, RecordingsQuery, NvrConfig, ProviderConfigs, } from './nvr.js';
|
package/dist/index.js
CHANGED
|
@@ -1409,7 +1409,7 @@ async function raceFastestEndpoint(candidates, timeoutMs) {
|
|
|
1409
1409
|
//#region src/detection.ts
|
|
1410
1410
|
/**
|
|
1411
1411
|
* Detection classes — shared between CamStack app and proxy.
|
|
1412
|
-
* Aligned with
|
|
1412
|
+
* Aligned with the shared detection-class taxonomy.
|
|
1413
1413
|
*/
|
|
1414
1414
|
var DetectionClass = /* @__PURE__ */ function(DetectionClass) {
|
|
1415
1415
|
DetectionClass["Motion"] = "motion";
|
|
@@ -1718,324 +1718,4 @@ function getClassesForTimelinePreset(preset, customClasses) {
|
|
|
1718
1718
|
}
|
|
1719
1719
|
}
|
|
1720
1720
|
//#endregion
|
|
1721
|
-
|
|
1722
|
-
/**
|
|
1723
|
-
* Maps raw device types from Scrypted (PascalCase) and Home Assistant (lowercase domains)
|
|
1724
|
-
* to canonical CamStack device types.
|
|
1725
|
-
*/
|
|
1726
|
-
var RAW_TO_CANONICAL = {
|
|
1727
|
-
Light: "light",
|
|
1728
|
-
Switch: "switch",
|
|
1729
|
-
WindowCovering: "cover",
|
|
1730
|
-
Lock: "lock",
|
|
1731
|
-
SecuritySystem: "alarm",
|
|
1732
|
-
Buttons: "button",
|
|
1733
|
-
Select: "select",
|
|
1734
|
-
Siren: "siren",
|
|
1735
|
-
Sensor: "sensor",
|
|
1736
|
-
Entry: "entry",
|
|
1737
|
-
Program: "script",
|
|
1738
|
-
MediaPlayer: "media_player",
|
|
1739
|
-
Outlet: "switch",
|
|
1740
|
-
light: "light",
|
|
1741
|
-
switch: "switch",
|
|
1742
|
-
input_boolean: "switch",
|
|
1743
|
-
cover: "cover",
|
|
1744
|
-
lock: "lock",
|
|
1745
|
-
alarm_control_panel: "alarm",
|
|
1746
|
-
input_button: "button",
|
|
1747
|
-
button: "button",
|
|
1748
|
-
input_select: "select",
|
|
1749
|
-
select: "select",
|
|
1750
|
-
siren: "siren",
|
|
1751
|
-
sensor: "sensor",
|
|
1752
|
-
media_player: "media_player",
|
|
1753
|
-
script: "script"
|
|
1754
|
-
};
|
|
1755
|
-
/**
|
|
1756
|
-
* Extended HA domain → type map (includes non-eligible domains for display/categorization).
|
|
1757
|
-
* Superset of RAW_TO_CANONICAL for HA-specific domains.
|
|
1758
|
-
*/
|
|
1759
|
-
var HA_DOMAIN_TYPE_MAP = {
|
|
1760
|
-
light: "light",
|
|
1761
|
-
switch: "switch",
|
|
1762
|
-
input_boolean: "switch",
|
|
1763
|
-
cover: "cover",
|
|
1764
|
-
lock: "lock",
|
|
1765
|
-
alarm_control_panel: "alarm",
|
|
1766
|
-
input_button: "button",
|
|
1767
|
-
button: "button",
|
|
1768
|
-
input_select: "select",
|
|
1769
|
-
select: "select",
|
|
1770
|
-
siren: "siren",
|
|
1771
|
-
sensor: "sensor",
|
|
1772
|
-
binary_sensor: "sensor",
|
|
1773
|
-
media_player: "media_player",
|
|
1774
|
-
script: "script",
|
|
1775
|
-
climate: "climate",
|
|
1776
|
-
camera: "camera",
|
|
1777
|
-
fan: "fan",
|
|
1778
|
-
vacuum: "vacuum",
|
|
1779
|
-
automation: "automation",
|
|
1780
|
-
scene: "scene",
|
|
1781
|
-
input_number: "sensor",
|
|
1782
|
-
person: "person",
|
|
1783
|
-
device_tracker: "tracker",
|
|
1784
|
-
weather: "weather",
|
|
1785
|
-
water_heater: "climate"
|
|
1786
|
-
};
|
|
1787
|
-
/**
|
|
1788
|
-
* Extended Scrypted type → canonical map (includes non-eligible types for display).
|
|
1789
|
-
* Superset of RAW_TO_CANONICAL for Scrypted-specific types.
|
|
1790
|
-
*/
|
|
1791
|
-
var SCRYPTED_TYPE_TO_CANONICAL = {
|
|
1792
|
-
Light: "light",
|
|
1793
|
-
Switch: "switch",
|
|
1794
|
-
WindowCovering: "cover",
|
|
1795
|
-
Lock: "lock",
|
|
1796
|
-
SecuritySystem: "alarm",
|
|
1797
|
-
Buttons: "button",
|
|
1798
|
-
Select: "select",
|
|
1799
|
-
Siren: "siren",
|
|
1800
|
-
Sensor: "sensor",
|
|
1801
|
-
Entry: "entry",
|
|
1802
|
-
Program: "script",
|
|
1803
|
-
MediaPlayer: "media_player",
|
|
1804
|
-
Camera: "camera",
|
|
1805
|
-
Doorbell: "doorbell",
|
|
1806
|
-
Fan: "fan",
|
|
1807
|
-
Outlet: "switch"
|
|
1808
|
-
};
|
|
1809
|
-
/** Normalize raw type (Scrypted or HA) to canonical key for filtering and display. */
|
|
1810
|
-
function getCanonicalDeviceType(rawType) {
|
|
1811
|
-
const canonical = RAW_TO_CANONICAL[rawType];
|
|
1812
|
-
if (canonical) return canonical;
|
|
1813
|
-
return RAW_TO_CANONICAL[rawType.toLowerCase()] ?? null;
|
|
1814
|
-
}
|
|
1815
|
-
/** Scrypted device types eligible for device control in CamStack. PascalCase. */
|
|
1816
|
-
var ELIGIBLE_SCRYPTED_DEVICE_TYPES = [
|
|
1817
|
-
"Entry",
|
|
1818
|
-
"Light",
|
|
1819
|
-
"Switch",
|
|
1820
|
-
"Lock",
|
|
1821
|
-
"SecuritySystem",
|
|
1822
|
-
"Buttons",
|
|
1823
|
-
"WindowCovering",
|
|
1824
|
-
"Siren",
|
|
1825
|
-
"Sensor",
|
|
1826
|
-
"Select",
|
|
1827
|
-
"Program"
|
|
1828
|
-
];
|
|
1829
|
-
/** Set version for O(1) lookup. */
|
|
1830
|
-
var ELIGIBLE_SCRYPTED_DEVICE_TYPES_SET = new Set(ELIGIBLE_SCRYPTED_DEVICE_TYPES);
|
|
1831
|
-
/** Home Assistant domains eligible for device control in CamStack. */
|
|
1832
|
-
var ELIGIBLE_HA_DOMAINS = [
|
|
1833
|
-
"light",
|
|
1834
|
-
"switch",
|
|
1835
|
-
"input_boolean",
|
|
1836
|
-
"cover",
|
|
1837
|
-
"lock",
|
|
1838
|
-
"alarm_control_panel",
|
|
1839
|
-
"input_button",
|
|
1840
|
-
"button",
|
|
1841
|
-
"input_select",
|
|
1842
|
-
"select",
|
|
1843
|
-
"siren",
|
|
1844
|
-
"media_player",
|
|
1845
|
-
"script"
|
|
1846
|
-
];
|
|
1847
|
-
/** Set version for O(1) lookup. */
|
|
1848
|
-
var ELIGIBLE_HA_DOMAINS_SET = new Set(ELIGIBLE_HA_DOMAINS);
|
|
1849
|
-
//#endregion
|
|
1850
|
-
//#region src/features.ts
|
|
1851
|
-
var FEATURE_MATRIX = [
|
|
1852
|
-
{
|
|
1853
|
-
id: "liveStream",
|
|
1854
|
-
label: "Live Stream",
|
|
1855
|
-
sources: {
|
|
1856
|
-
frigate: true,
|
|
1857
|
-
scrypted: true,
|
|
1858
|
-
rtsp: true
|
|
1859
|
-
},
|
|
1860
|
-
adapterMethod: "getLiveStream"
|
|
1861
|
-
},
|
|
1862
|
-
{
|
|
1863
|
-
id: "multiResolution",
|
|
1864
|
-
label: "Multi-Resolution",
|
|
1865
|
-
sources: {
|
|
1866
|
-
frigate: true,
|
|
1867
|
-
scrypted: true,
|
|
1868
|
-
rtsp: false
|
|
1869
|
-
},
|
|
1870
|
-
adapterMethod: "getResolutions"
|
|
1871
|
-
},
|
|
1872
|
-
{
|
|
1873
|
-
id: "motion",
|
|
1874
|
-
label: "Motion Detection",
|
|
1875
|
-
sources: {
|
|
1876
|
-
frigate: false,
|
|
1877
|
-
scrypted: true,
|
|
1878
|
-
rtsp: false
|
|
1879
|
-
},
|
|
1880
|
-
adapterMethod: "getMotion"
|
|
1881
|
-
},
|
|
1882
|
-
{
|
|
1883
|
-
id: "objectDetection",
|
|
1884
|
-
label: "Object Detection",
|
|
1885
|
-
sources: {
|
|
1886
|
-
frigate: false,
|
|
1887
|
-
scrypted: true,
|
|
1888
|
-
rtsp: false
|
|
1889
|
-
},
|
|
1890
|
-
adapterMethod: "getObjectDetections"
|
|
1891
|
-
},
|
|
1892
|
-
{
|
|
1893
|
-
id: "audioVolume",
|
|
1894
|
-
label: "Audio Level",
|
|
1895
|
-
sources: {
|
|
1896
|
-
frigate: false,
|
|
1897
|
-
scrypted: true,
|
|
1898
|
-
rtsp: false
|
|
1899
|
-
},
|
|
1900
|
-
adapterMethod: "getAudioVolume"
|
|
1901
|
-
},
|
|
1902
|
-
{
|
|
1903
|
-
id: "audioVolumes",
|
|
1904
|
-
label: "Audio Volumes (dBFS)",
|
|
1905
|
-
sources: {
|
|
1906
|
-
frigate: false,
|
|
1907
|
-
scrypted: true,
|
|
1908
|
-
rtsp: false
|
|
1909
|
-
},
|
|
1910
|
-
adapterMethod: "getAudioVolumes"
|
|
1911
|
-
},
|
|
1912
|
-
{
|
|
1913
|
-
id: "ptz",
|
|
1914
|
-
label: "PTZ Control",
|
|
1915
|
-
sources: {
|
|
1916
|
-
frigate: false,
|
|
1917
|
-
scrypted: true,
|
|
1918
|
-
rtsp: false
|
|
1919
|
-
},
|
|
1920
|
-
adapterMethod: "getPTZ"
|
|
1921
|
-
},
|
|
1922
|
-
{
|
|
1923
|
-
id: "intercom",
|
|
1924
|
-
label: "Intercom (Mic)",
|
|
1925
|
-
sources: {
|
|
1926
|
-
frigate: false,
|
|
1927
|
-
scrypted: true,
|
|
1928
|
-
rtsp: false
|
|
1929
|
-
},
|
|
1930
|
-
adapterMethod: "getIntercomSupport"
|
|
1931
|
-
},
|
|
1932
|
-
{
|
|
1933
|
-
id: "deviceStatus",
|
|
1934
|
-
label: "Device Status",
|
|
1935
|
-
sources: {
|
|
1936
|
-
frigate: false,
|
|
1937
|
-
scrypted: true,
|
|
1938
|
-
rtsp: false
|
|
1939
|
-
},
|
|
1940
|
-
adapterMethod: "getStatus"
|
|
1941
|
-
},
|
|
1942
|
-
{
|
|
1943
|
-
id: "timeline",
|
|
1944
|
-
label: "Detection Timeline",
|
|
1945
|
-
sources: {
|
|
1946
|
-
frigate: true,
|
|
1947
|
-
scrypted: true,
|
|
1948
|
-
rtsp: false
|
|
1949
|
-
},
|
|
1950
|
-
adapterMethod: "getCameraDayData"
|
|
1951
|
-
},
|
|
1952
|
-
{
|
|
1953
|
-
id: "clusteredTimeline",
|
|
1954
|
-
label: "Clustered Timeline",
|
|
1955
|
-
sources: {
|
|
1956
|
-
frigate: true,
|
|
1957
|
-
scrypted: true,
|
|
1958
|
-
rtsp: false
|
|
1959
|
-
},
|
|
1960
|
-
requiresBackend: true,
|
|
1961
|
-
adapterMethod: "getClusteredDayData"
|
|
1962
|
-
},
|
|
1963
|
-
{
|
|
1964
|
-
id: "detectionClasses",
|
|
1965
|
-
label: "Detection Classes",
|
|
1966
|
-
sources: {
|
|
1967
|
-
frigate: true,
|
|
1968
|
-
scrypted: true,
|
|
1969
|
-
rtsp: false
|
|
1970
|
-
},
|
|
1971
|
-
adapterMethod: "getDetectionClasses"
|
|
1972
|
-
},
|
|
1973
|
-
{
|
|
1974
|
-
id: "videoClips",
|
|
1975
|
-
label: "Video Clips",
|
|
1976
|
-
sources: {
|
|
1977
|
-
frigate: true,
|
|
1978
|
-
scrypted: true,
|
|
1979
|
-
rtsp: false
|
|
1980
|
-
},
|
|
1981
|
-
adapterMethod: "getVideoClips"
|
|
1982
|
-
},
|
|
1983
|
-
{
|
|
1984
|
-
id: "nvrPlayback",
|
|
1985
|
-
label: "NVR Playback",
|
|
1986
|
-
sources: {
|
|
1987
|
-
frigate: true,
|
|
1988
|
-
scrypted: true,
|
|
1989
|
-
rtsp: false
|
|
1990
|
-
},
|
|
1991
|
-
adapterMethod: "getNvrPlaybackSupported"
|
|
1992
|
-
},
|
|
1993
|
-
{
|
|
1994
|
-
id: "nvrScrub",
|
|
1995
|
-
label: "NVR Scrub/Seek",
|
|
1996
|
-
sources: {
|
|
1997
|
-
frigate: false,
|
|
1998
|
-
scrypted: true,
|
|
1999
|
-
rtsp: false
|
|
2000
|
-
},
|
|
2001
|
-
adapterMethod: "seekRecordingStream"
|
|
2002
|
-
},
|
|
2003
|
-
{
|
|
2004
|
-
id: "recordingThumbnail",
|
|
2005
|
-
label: "Recording Thumbnails",
|
|
2006
|
-
sources: {
|
|
2007
|
-
frigate: true,
|
|
2008
|
-
scrypted: true,
|
|
2009
|
-
rtsp: false
|
|
2010
|
-
},
|
|
2011
|
-
adapterMethod: "getRecordingStreamThumbnail"
|
|
2012
|
-
},
|
|
2013
|
-
{
|
|
2014
|
-
id: "nvrSeekToLive",
|
|
2015
|
-
label: "Seek to Live",
|
|
2016
|
-
sources: {
|
|
2017
|
-
frigate: false,
|
|
2018
|
-
scrypted: true,
|
|
2019
|
-
rtsp: false
|
|
2020
|
-
},
|
|
2021
|
-
adapterMethod: "seekNvrToLive"
|
|
2022
|
-
}
|
|
2023
|
-
];
|
|
2024
|
-
/** Check if a feature is available for a given source type and platform. */
|
|
2025
|
-
function isFeatureAvailable(featureId, source, platform) {
|
|
2026
|
-
const entry = FEATURE_MATRIX.find((f) => f.id === featureId);
|
|
2027
|
-
if (!entry) return false;
|
|
2028
|
-
if (!entry.sources[source]) return false;
|
|
2029
|
-
if (entry.platforms && entry.platforms[platform] === false) return false;
|
|
2030
|
-
return true;
|
|
2031
|
-
}
|
|
2032
|
-
/** Get all features supported by a source type. */
|
|
2033
|
-
function getSourceFeatures(source) {
|
|
2034
|
-
return FEATURE_MATRIX.filter((f) => f.sources[source]);
|
|
2035
|
-
}
|
|
2036
|
-
/** Get all features that require the backend proxy. */
|
|
2037
|
-
function getBackendRequiredFeatures() {
|
|
2038
|
-
return FEATURE_MATRIX.filter((f) => f.requiresBackend);
|
|
2039
|
-
}
|
|
2040
|
-
//#endregion
|
|
2041
|
-
export { DEFAULT_ENABLED_CLASSES, DetectionClass, ELIGIBLE_HA_DOMAINS, ELIGIBLE_HA_DOMAINS_SET, ELIGIBLE_SCRYPTED_DEVICE_TYPES, ELIGIBLE_SCRYPTED_DEVICE_TYPES_SET, FEATURE_MATRIX, HA_DOMAIN_TYPE_MAP, RAW_TO_CANONICAL, SCRYPTED_TYPE_TO_CANONICAL, System, TIMELINE_PRESET_ALL, TIMELINE_PRESET_CRITICAL, TIMELINE_PRESET_IMPORTANT, animalClasses, audioClasses, audioLabelClasses, createSystem, defaultDetectionClasses, detectionClassesDefaultMap, doorbellClasses, faceClasses, getBackendRequiredFeatures, getCanonicalDeviceType, getClassesForTimelinePreset, getParentClass, getParentDetectionClass, getSourceFeatures, isAnimalClassname, isAudioClassname, isDoorbellClassname, isFaceClassname, isFeatureAvailable, isLabelDetection, isMotionClassname, isPackageClassname, isPersonClassname, isPlateClassname, isSensorLabelClassname, isVehicleClassname, licensePlateClasses, motionClasses, packageClasses, personClasses, raceFastestEndpoint, sensorLabelClasses, vehicleClasses };
|
|
1721
|
+
export { DEFAULT_ENABLED_CLASSES, DetectionClass, System, TIMELINE_PRESET_ALL, TIMELINE_PRESET_CRITICAL, TIMELINE_PRESET_IMPORTANT, animalClasses, audioClasses, audioLabelClasses, createSystem, defaultDetectionClasses, detectionClassesDefaultMap, doorbellClasses, faceClasses, getClassesForTimelinePreset, getParentClass, getParentDetectionClass, isAnimalClassname, isAudioClassname, isDoorbellClassname, isFaceClassname, isLabelDetection, isMotionClassname, isPackageClassname, isPersonClassname, isPlateClassname, isSensorLabelClassname, isVehicleClassname, licensePlateClasses, motionClasses, packageClasses, personClasses, raceFastestEndpoint, sensorLabelClasses, vehicleClasses };
|
package/dist/nvr.d.ts
CHANGED
|
@@ -155,7 +155,7 @@ export interface LiveDetectionData {
|
|
|
155
155
|
detections: LiveDetection[];
|
|
156
156
|
/** Input frame dimensions [width, height] in pixels (for reference). */
|
|
157
157
|
inputDimensions?: [number, number];
|
|
158
|
-
/** Event ID from the NVR
|
|
158
|
+
/** Event ID from the NVR. */
|
|
159
159
|
eventId?: string;
|
|
160
160
|
/** Provider-specific extra data. */
|
|
161
161
|
[key: string]: unknown;
|
package/dist/timeline.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Names are unified: the proxy's naming convention is canonical.
|
|
5
5
|
* The app re-exports aliases for backward compatibility where needed.
|
|
6
6
|
*/
|
|
7
|
-
/**
|
|
7
|
+
/** Severity: alert = notable, detection = regular. */
|
|
8
8
|
export type TimelineEventSeverity = 'alert' | 'detection';
|
|
9
9
|
/** Motion fragment type: start/end from event boundaries, update from motion API. */
|
|
10
10
|
export type MotionFragmentType = 'start' | 'end' | 'update';
|
|
@@ -47,7 +47,7 @@ export interface MotionItem {
|
|
|
47
47
|
dBFS?: number;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
* Rule artifact for timeline
|
|
50
|
+
* Rule artifact for timeline.
|
|
51
51
|
* Unified from app's TimelineArtifactItem and proxy's TimelineArtifact.
|
|
52
52
|
*/
|
|
53
53
|
export interface TimelineArtifact {
|
package/dist/types.d.ts
CHANGED
|
@@ -15,20 +15,20 @@ export interface ProviderInfo {
|
|
|
15
15
|
export interface ProxyClientConfig {
|
|
16
16
|
/**
|
|
17
17
|
* Primary proxy URL (e.g. "http://192.168.1.100:4000").
|
|
18
|
-
* Can also be an array of URLs to race
|
|
18
|
+
* Can also be an array of URLs to race.
|
|
19
19
|
* The first successful connection wins.
|
|
20
20
|
*/
|
|
21
21
|
proxyUrl: string | string[];
|
|
22
22
|
/** Optional auth token for admin endpoints. */
|
|
23
23
|
token?: string;
|
|
24
|
-
/** Transport: "websocket" (default
|
|
24
|
+
/** Transport: "websocket" (default) or "http" (REST fallback). */
|
|
25
25
|
transport?: 'websocket' | 'http';
|
|
26
26
|
/** Connection timeout per URL in ms (default: 10000). */
|
|
27
27
|
connectTimeoutMs?: number;
|
|
28
28
|
}
|
|
29
29
|
export interface DirectClientConfig {
|
|
30
30
|
directUrl: string;
|
|
31
|
-
type: '
|
|
31
|
+
type: 'direct';
|
|
32
32
|
username?: string;
|
|
33
33
|
password?: string;
|
|
34
34
|
}
|
package/package.json
CHANGED
package/dist/devices.d.ts
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Device types, mappings, and filtering constants — shared between CamStack app and proxy.
|
|
3
|
-
*
|
|
4
|
-
* Covers:
|
|
5
|
-
* - Canonical device type normalization (Scrypted PascalCase + HA domains → canonical)
|
|
6
|
-
* - Eligible device type lists for Scrypted and Home Assistant
|
|
7
|
-
* - Unified Device / DeviceCommand / CommandResult interfaces
|
|
8
|
-
* - AssociatedDeviceState shape
|
|
9
|
-
*/
|
|
10
|
-
export type CanonicalDeviceType = 'light' | 'switch' | 'cover' | 'lock' | 'alarm' | 'button' | 'select' | 'siren' | 'sensor' | 'entry' | 'media_player' | 'script';
|
|
11
|
-
/**
|
|
12
|
-
* Maps raw device types from Scrypted (PascalCase) and Home Assistant (lowercase domains)
|
|
13
|
-
* to canonical CamStack device types.
|
|
14
|
-
*/
|
|
15
|
-
export declare const RAW_TO_CANONICAL: Record<string, CanonicalDeviceType>;
|
|
16
|
-
/**
|
|
17
|
-
* Extended HA domain → type map (includes non-eligible domains for display/categorization).
|
|
18
|
-
* Superset of RAW_TO_CANONICAL for HA-specific domains.
|
|
19
|
-
*/
|
|
20
|
-
export declare const HA_DOMAIN_TYPE_MAP: Record<string, string>;
|
|
21
|
-
/**
|
|
22
|
-
* Extended Scrypted type → canonical map (includes non-eligible types for display).
|
|
23
|
-
* Superset of RAW_TO_CANONICAL for Scrypted-specific types.
|
|
24
|
-
*/
|
|
25
|
-
export declare const SCRYPTED_TYPE_TO_CANONICAL: Record<string, string>;
|
|
26
|
-
/** Normalize raw type (Scrypted or HA) to canonical key for filtering and display. */
|
|
27
|
-
export declare function getCanonicalDeviceType(rawType: string): CanonicalDeviceType | null;
|
|
28
|
-
/** Scrypted device types eligible for device control in CamStack. PascalCase. */
|
|
29
|
-
export declare const ELIGIBLE_SCRYPTED_DEVICE_TYPES: readonly ["Entry", "Light", "Switch", "Lock", "SecuritySystem", "Buttons", "WindowCovering", "Siren", "Sensor", "Select", "Program"];
|
|
30
|
-
/** Set version for O(1) lookup. */
|
|
31
|
-
export declare const ELIGIBLE_SCRYPTED_DEVICE_TYPES_SET: Set<string>;
|
|
32
|
-
/** Home Assistant domains eligible for device control in CamStack. */
|
|
33
|
-
export declare const ELIGIBLE_HA_DOMAINS: readonly ["light", "switch", "input_boolean", "cover", "lock", "alarm_control_panel", "input_button", "button", "input_select", "select", "siren", "media_player", "script"];
|
|
34
|
-
/** Set version for O(1) lookup. */
|
|
35
|
-
export declare const ELIGIBLE_HA_DOMAINS_SET: Set<string>;
|
|
36
|
-
/** All device command actions supported by CamStack. */
|
|
37
|
-
export type DeviceCommandAction = 'turnOn' | 'turnOff' | 'openEntry' | 'closeEntry' | 'stopEntry' | 'lock' | 'unlock' | 'disarm' | 'arm' | 'pressButton' | 'selectOption' | 'volumeUp' | 'volumeDown' | 'volumeMute';
|
|
38
|
-
/**
|
|
39
|
-
* State snapshot shape for an associated device.
|
|
40
|
-
* Used by both app (AssociatedDeviceStateSnapshot) and proxy (Device.state).
|
|
41
|
-
*/
|
|
42
|
-
export interface AssociatedDeviceState {
|
|
43
|
-
name?: string;
|
|
44
|
-
type?: string;
|
|
45
|
-
interfaces?: string[];
|
|
46
|
-
on?: boolean;
|
|
47
|
-
hasBrightnessControl?: boolean;
|
|
48
|
-
brightness?: number;
|
|
49
|
-
lockState?: string;
|
|
50
|
-
securitySystemState?: {
|
|
51
|
-
mode?: string;
|
|
52
|
-
supportedModes?: string[];
|
|
53
|
-
};
|
|
54
|
-
buttons?: string[];
|
|
55
|
-
entryOpen?: boolean | 'jammed';
|
|
56
|
-
value?: string;
|
|
57
|
-
options?: string[];
|
|
58
|
-
volumeLevel?: number;
|
|
59
|
-
isVolumeMuted?: boolean;
|
|
60
|
-
coverSupportsStop?: boolean;
|
|
61
|
-
coverPosition?: number;
|
|
62
|
-
}
|
|
63
|
-
/** A device from an automation system (Scrypted, Home Assistant, etc.). */
|
|
64
|
-
export interface Device {
|
|
65
|
-
id: string;
|
|
66
|
-
name: string;
|
|
67
|
-
/**
|
|
68
|
-
* Canonical device type (lowercase): "light", "switch", "cover", "lock",
|
|
69
|
-
* "alarm", "button", "select", "siren", "sensor", "entry", "media_player",
|
|
70
|
-
* "script", "camera", "nvr".
|
|
71
|
-
*/
|
|
72
|
-
type: string;
|
|
73
|
-
/** Original type from the source system (e.g. Scrypted "WindowCovering", HA domain "cover"). */
|
|
74
|
-
rawType?: string;
|
|
75
|
-
/** Provider that owns this device. */
|
|
76
|
-
providerId?: string;
|
|
77
|
-
model?: string;
|
|
78
|
-
manufacturer?: string;
|
|
79
|
-
firmware?: string;
|
|
80
|
-
online: boolean;
|
|
81
|
-
interfaces: string[];
|
|
82
|
-
/** Current state (key-value pairs, device-type-dependent). See AssociatedDeviceState. */
|
|
83
|
-
state: Record<string, unknown>;
|
|
84
|
-
/** Available actions for this device (defined by the provider). */
|
|
85
|
-
actions?: DeviceAction[];
|
|
86
|
-
/** Child devices (e.g. NVR → camera channels). */
|
|
87
|
-
children?: Device[];
|
|
88
|
-
}
|
|
89
|
-
/** A command to send to a device. */
|
|
90
|
-
export interface DeviceCommand {
|
|
91
|
-
deviceId: string;
|
|
92
|
-
command: string;
|
|
93
|
-
params?: Record<string, unknown>;
|
|
94
|
-
}
|
|
95
|
-
/** Result of a command execution. */
|
|
96
|
-
export interface CommandResult {
|
|
97
|
-
success: boolean;
|
|
98
|
-
error?: string;
|
|
99
|
-
state?: Record<string, unknown>;
|
|
100
|
-
}
|
|
101
|
-
/** Device source type (integration that provides the device). */
|
|
102
|
-
export type AssociatedDeviceSource = 'scrypted' | 'ha';
|
|
103
|
-
/** Eligible device summary (for device picker UI). */
|
|
104
|
-
export interface EligibleDevice {
|
|
105
|
-
id: string;
|
|
106
|
-
name: string;
|
|
107
|
-
type: string;
|
|
108
|
-
source: AssociatedDeviceSource;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* An action that can be performed on a device.
|
|
112
|
-
* Actions are declared by the provider and rendered dynamically in the UI.
|
|
113
|
-
*/
|
|
114
|
-
export interface DeviceAction {
|
|
115
|
-
/** Unique action ID (e.g. "toggle", "setBrightness", "ptzMove", "reboot"). */
|
|
116
|
-
id: string;
|
|
117
|
-
/** Display label (e.g. "Toggle", "Set Brightness", "Move Camera"). */
|
|
118
|
-
label: string;
|
|
119
|
-
/** Action category for UI grouping. */
|
|
120
|
-
category?: 'power' | 'control' | 'ptz' | 'media' | 'system' | 'custom';
|
|
121
|
-
/** Icon hint (lucide icon name or emoji). */
|
|
122
|
-
icon?: string;
|
|
123
|
-
/** Parameters this action accepts. */
|
|
124
|
-
params?: DeviceActionParam[];
|
|
125
|
-
/** Whether this action is destructive (shown with warning). */
|
|
126
|
-
destructive?: boolean;
|
|
127
|
-
}
|
|
128
|
-
/** A parameter for a device action. */
|
|
129
|
-
export interface DeviceActionParam {
|
|
130
|
-
/** Parameter key. */
|
|
131
|
-
key: string;
|
|
132
|
-
/** Display label. */
|
|
133
|
-
label: string;
|
|
134
|
-
/** Type for UI rendering. */
|
|
135
|
-
type: 'boolean' | 'number' | 'string' | 'select' | 'slider';
|
|
136
|
-
/** Default value. */
|
|
137
|
-
default?: unknown;
|
|
138
|
-
/** For select type: available options. */
|
|
139
|
-
options?: {
|
|
140
|
-
value: string;
|
|
141
|
-
label: string;
|
|
142
|
-
}[];
|
|
143
|
-
/** For slider/number: min/max/step. */
|
|
144
|
-
min?: number;
|
|
145
|
-
max?: number;
|
|
146
|
-
step?: number;
|
|
147
|
-
}
|
package/dist/features.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Feature capability matrix — shared between CamStack app and proxy.
|
|
3
|
-
*
|
|
4
|
-
* Maps each app feature to:
|
|
5
|
-
* - Which source types (Frigate, Scrypted, RTSP) support it
|
|
6
|
-
* - Which platforms (iOS, Android, Web, Scrypted embed) it works on
|
|
7
|
-
* - Whether the camstack-server backend is required
|
|
8
|
-
* - The ICameraSource method that enables the feature
|
|
9
|
-
*/
|
|
10
|
-
export type FeatureId = 'liveStream' | 'multiResolution' | 'motion' | 'objectDetection' | 'audioVolume' | 'audioVolumes' | 'ptz' | 'intercom' | 'deviceStatus' | 'timeline' | 'clusteredTimeline' | 'detectionClasses' | 'videoClips' | 'nvrPlayback' | 'nvrScrub' | 'recordingThumbnail' | 'nvrSeekToLive';
|
|
11
|
-
export type PlatformId = 'ios' | 'android' | 'web' | 'scryptedEmbed';
|
|
12
|
-
export type SourceType = 'frigate' | 'scrypted' | 'rtsp';
|
|
13
|
-
export interface FeatureEntry {
|
|
14
|
-
id: FeatureId;
|
|
15
|
-
label: string;
|
|
16
|
-
/** Which source types support this feature. */
|
|
17
|
-
sources: Partial<Record<SourceType, boolean>>;
|
|
18
|
-
/** Platform availability overrides. When omitted, all platforms are supported. */
|
|
19
|
-
platforms?: Partial<Record<PlatformId, boolean>>;
|
|
20
|
-
/** True when this feature needs the camstack-server backend. */
|
|
21
|
-
requiresBackend?: boolean;
|
|
22
|
-
/** The ICameraSource method name that enables this feature at runtime. */
|
|
23
|
-
adapterMethod?: string;
|
|
24
|
-
}
|
|
25
|
-
export declare const FEATURE_MATRIX: FeatureEntry[];
|
|
26
|
-
/** Check if a feature is available for a given source type and platform. */
|
|
27
|
-
export declare function isFeatureAvailable(featureId: FeatureId, source: SourceType, platform: PlatformId): boolean;
|
|
28
|
-
/** Get all features supported by a source type. */
|
|
29
|
-
export declare function getSourceFeatures(source: SourceType): FeatureEntry[];
|
|
30
|
-
/** Get all features that require the backend proxy. */
|
|
31
|
-
export declare function getBackendRequiredFeatures(): FeatureEntry[];
|