@camstack/sdk 0.1.23 → 0.1.25
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/index.cjs +1769 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1764 -1
- package/dist/index.js.map +1 -1
- package/dist/sdk/src/adaptive-stream.d.ts +91 -0
- package/dist/sdk/src/backend-client.d.ts +306 -0
- package/dist/sdk/src/backend-router.d.ts +5 -0
- package/dist/sdk/src/camera.d.ts +37 -0
- package/dist/sdk/src/detection.d.ts +58 -0
- package/dist/sdk/src/devices.d.ts +147 -0
- package/dist/sdk/src/features.d.ts +31 -0
- package/dist/sdk/src/index.d.ts +15 -0
- package/dist/sdk/src/nvr.d.ts +285 -0
- package/dist/sdk/src/timeline.d.ts +177 -0
- package/dist/sdk/src/types.d.ts +44 -0
- package/dist/types/src/catalogs/coco-classmap.d.ts +4 -0
- package/dist/types/src/constants.d.ts +2 -0
- package/dist/types/src/generated/addon-api.d.ts +4869 -0
- package/dist/types/src/index.d.ts +81 -0
- package/dist/types/src/interfaces/addon-i18n.d.ts +40 -0
- package/dist/types/src/interfaces/addon-routes.d.ts +49 -0
- package/dist/types/src/interfaces/addon.d.ts +293 -0
- package/dist/types/src/interfaces/advanced-notifier.d.ts +58 -0
- package/dist/types/src/interfaces/agent-protocol.d.ts +188 -0
- package/dist/types/src/interfaces/agent.d.ts +86 -0
- package/dist/types/src/interfaces/analysis-persistence.d.ts +277 -0
- package/dist/types/src/interfaces/analysis.d.ts +26 -0
- package/dist/types/src/interfaces/api-shared.d.ts +168 -0
- package/dist/types/src/interfaces/auth-provider.d.ts +38 -0
- package/dist/types/src/interfaces/auth.d.ts +46 -0
- package/dist/types/src/interfaces/camera-pipeline.d.ts +120 -0
- package/dist/types/src/interfaces/capability.d.ts +83 -0
- package/dist/types/src/interfaces/classifier.d.ts +7 -0
- package/dist/types/src/interfaces/config-ui.d.ts +151 -0
- package/dist/types/src/interfaces/context.d.ts +43 -0
- package/dist/types/src/interfaces/cropper.d.ts +7 -0
- package/dist/types/src/interfaces/decoder.d.ts +26 -0
- package/dist/types/src/interfaces/detection-addon.d.ts +14 -0
- package/dist/types/src/interfaces/detector.d.ts +7 -0
- package/dist/types/src/interfaces/device-capabilities/accessory.d.ts +13 -0
- package/dist/types/src/interfaces/device-capabilities/audio-detector.d.ts +11 -0
- package/dist/types/src/interfaces/device-capabilities/camera.d.ts +21 -0
- package/dist/types/src/interfaces/device-capabilities/doorbell.d.ts +9 -0
- package/dist/types/src/interfaces/device-capabilities/events.d.ts +46 -0
- package/dist/types/src/interfaces/device-capabilities/index.d.ts +14 -0
- package/dist/types/src/interfaces/device-capabilities/motion-sensor.d.ts +6 -0
- package/dist/types/src/interfaces/device-capabilities/native-detection.d.ts +13 -0
- package/dist/types/src/interfaces/device-capabilities/object-detector.d.ts +58 -0
- package/dist/types/src/interfaces/device-capabilities/pan-tilt-zoom.d.ts +28 -0
- package/dist/types/src/interfaces/device-capabilities/recording.d.ts +17 -0
- package/dist/types/src/interfaces/device-capabilities/siren.d.ts +7 -0
- package/dist/types/src/interfaces/device-capabilities/status-light.d.ts +6 -0
- package/dist/types/src/interfaces/device-capabilities/switch.d.ts +7 -0
- package/dist/types/src/interfaces/device-capabilities/two-way-audio.d.ts +7 -0
- package/dist/types/src/interfaces/device-capability.d.ts +13 -0
- package/dist/types/src/interfaces/device-provider.d.ts +42 -0
- package/dist/types/src/interfaces/device.d.ts +39 -0
- package/dist/types/src/interfaces/event-bus.d.ts +21 -0
- package/dist/types/src/interfaces/feature-flags.d.ts +13 -0
- package/dist/types/src/interfaces/ffmpeg.d.ts +9 -0
- package/dist/types/src/interfaces/inference-capabilities.d.ts +100 -0
- package/dist/types/src/interfaces/inference-engine.d.ts +16 -0
- package/dist/types/src/interfaces/lifecycle.d.ts +18 -0
- package/dist/types/src/interfaces/logging.d.ts +32 -0
- package/dist/types/src/interfaces/model-catalog.d.ts +24 -0
- package/dist/types/src/interfaces/network-quality.d.ts +24 -0
- package/dist/types/src/interfaces/network.d.ts +42 -0
- package/dist/types/src/interfaces/notification.d.ts +52 -0
- package/dist/types/src/interfaces/pipeline-runner.d.ts +22 -0
- package/dist/types/src/interfaces/pipeline-slot.d.ts +9 -0
- package/dist/types/src/interfaces/platform.d.ts +54 -0
- package/dist/types/src/interfaces/process.d.ts +40 -0
- package/dist/types/src/interfaces/python-env.d.ts +19 -0
- package/dist/types/src/interfaces/refiner.d.ts +7 -0
- package/dist/types/src/interfaces/repl.d.ts +25 -0
- package/dist/types/src/interfaces/repositories.d.ts +19 -0
- package/dist/types/src/interfaces/restreamer.d.ts +23 -0
- package/dist/types/src/interfaces/router.d.ts +29 -0
- package/dist/types/src/interfaces/scene-intelligence.d.ts +20 -0
- package/dist/types/src/interfaces/scoped-token.d.ts +21 -0
- package/dist/types/src/interfaces/server-analysis.d.ts +145 -0
- package/dist/types/src/interfaces/server-network.d.ts +77 -0
- package/dist/types/src/interfaces/storage-backend.d.ts +26 -0
- package/dist/types/src/interfaces/storage.d.ts +173 -0
- package/dist/types/src/interfaces/stream-broker.d.ts +91 -0
- package/dist/types/src/interfaces/streaming.d.ts +28 -0
- package/dist/types/src/interfaces/task-handler.d.ts +45 -0
- package/dist/types/src/interfaces/webrtc-provider.d.ts +10 -0
- package/dist/types/src/interfaces/worker-protocol.d.ts +109 -0
- package/dist/types/src/schemas/system-settings-schemas.d.ts +26 -0
- package/dist/types/src/types/analytics.d.ts +74 -0
- package/dist/types/src/types/benchmark.d.ts +111 -0
- package/dist/types/src/types/camera-detection.d.ts +33 -0
- package/dist/types/src/types/config.d.ts +36 -0
- package/dist/types/src/types/detection.d.ts +92 -0
- package/dist/types/src/types/device-type.d.ts +9 -0
- package/dist/types/src/types/entities.d.ts +34 -0
- package/dist/types/src/types/events.d.ts +34 -0
- package/dist/types/src/types/io.d.ts +24 -0
- package/dist/types/src/types/labels.d.ts +11 -0
- package/dist/types/src/types/live-state.d.ts +46 -0
- package/dist/types/src/types/models.d.ts +78 -0
- package/dist/types/src/types/pipeline-schema.d.ts +77 -0
- package/dist/types/src/types/pipeline.d.ts +41 -0
- package/dist/types/src/types/tracked.d.ts +20 -0
- package/dist/types/src/types/zones.d.ts +47 -0
- package/dist/types/src/utils/cosine-similarity.d.ts +2 -0
- package/dist/types/src/utils/hf-url.d.ts +1 -0
- package/package.json +6 -5
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { BackendClient, createBackendClient } from "./backend-client.js";
|
|
2
|
+
export type { BackendAppRouter } from "./backend-router.js";
|
|
3
|
+
export type { BackendAppRouter as AppRouter } from "./backend-router.js";
|
|
4
|
+
export type { BackendClientConfig } from "./types.js";
|
|
5
|
+
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";
|
|
6
|
+
export type { TimelineEventPreset } from "./detection.js";
|
|
7
|
+
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";
|
|
8
|
+
export type { CanonicalDeviceType, DeviceCommandAction, AssociatedDeviceState, Device, DeviceAction, DeviceActionParam, DeviceCommand, CommandResult, AssociatedDeviceSource, EligibleDevice, } from "./devices.js";
|
|
9
|
+
export type { TimelineEventSeverity, MotionFragmentType, DetectionEvent, MotionItem, TimelineArtifact, AudioLevelSegment, TimelineRecordingSegment, CameraDayDataResponse, ClusteredDayDataResponse, TimelineCluster, DetectionGroup, ClusteredDayDataQuery, GroupedEventsQuery, GroupedEventsResult, ClusterEventsQuery, ClusterEventsResult, ReelEvent, ReelEventsQuery, ReelEventsResult, TimelineDetectionEvent, TimelineMotionItem, TimelineArtifactItem, TimelineClusterFromServer, } from "./timeline.js";
|
|
10
|
+
export type { CameraSourceType, StreamMethod, PanTiltZoomCommand, PanTiltZoomCapabilities, CameraAccessorySwitchKind, CameraStatusEntry, CamerasStatusResult, } from "./camera.js";
|
|
11
|
+
export { FEATURE_MATRIX, isFeatureAvailable, getSourceFeatures, getBackendRequiredFeatures, } from "./features.js";
|
|
12
|
+
export type { FeatureId, PlatformId, SourceType, FeatureEntry, } from "./features.js";
|
|
13
|
+
export { selectOptimalStream, getNextEvalInterval, } from "./adaptive-stream.js";
|
|
14
|
+
export type { StreamConstraints, StreamAssignment, StreamSelectionRequest, StreamSelectionResponse, } from "./adaptive-stream.js";
|
|
15
|
+
export type { StreamOption, 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";
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NVR types — system-agnostic types used by providers and the SDK client.
|
|
3
|
+
*
|
|
4
|
+
* These are the canonical types from the proxy's providers/types.ts,
|
|
5
|
+
* now owned by the SDK so both app and proxy can share them.
|
|
6
|
+
*/
|
|
7
|
+
export interface StreamOption {
|
|
8
|
+
/** Unique identifier for this option (e.g. "auto", "cam_main", "mjpeg"). */
|
|
9
|
+
id: string;
|
|
10
|
+
/** Display label (e.g. "Auto", "High (WebRTC)", "MJPEG"). */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Streaming technology. */
|
|
13
|
+
method: "webrtc" | "mjpeg" | "hls" | "rtsp";
|
|
14
|
+
/** go2rtc stream name (required for WebRTC). */
|
|
15
|
+
streamName?: string;
|
|
16
|
+
/** Raw source URL (RTSP, etc.) — for display/copy in admin UI. */
|
|
17
|
+
sourceUrl?: string;
|
|
18
|
+
/** Group label for UI separators (e.g. "go2rtc", "Frigate", "Scrypted"). */
|
|
19
|
+
group?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface NvrCamera {
|
|
22
|
+
name: string;
|
|
23
|
+
/** Display label (may differ from internal name). */
|
|
24
|
+
label?: string;
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
hasAudio: boolean;
|
|
27
|
+
hasPtz: boolean;
|
|
28
|
+
/** Available stream names for this camera (e.g. ["cam_main", "cam_sub"]). */
|
|
29
|
+
streams: string[];
|
|
30
|
+
/** Available streaming options with method and quality info. Always includes "Auto". */
|
|
31
|
+
streamOptions: StreamOption[];
|
|
32
|
+
/** Accessories/actions available on this camera (siren, floodlight, PTZ, etc.). */
|
|
33
|
+
accessories?: CameraAccessory[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A camera accessory — a controllable feature attached to a camera.
|
|
37
|
+
* Declared by the provider, rendered dynamically in the UI.
|
|
38
|
+
*/
|
|
39
|
+
export interface CameraAccessory {
|
|
40
|
+
/** Unique accessory ID (e.g. "siren", "floodlight", "ptz", "ir_led"). */
|
|
41
|
+
id: string;
|
|
42
|
+
/** Display label (e.g. "Siren", "Floodlight"). */
|
|
43
|
+
label: string;
|
|
44
|
+
/** Accessory type determines UI rendering. */
|
|
45
|
+
type: "toggle" | "button" | "ptz" | "slider";
|
|
46
|
+
/** Lucide icon name (e.g. "siren", "lightbulb", "move", "sun"). */
|
|
47
|
+
icon: string;
|
|
48
|
+
/** Current state (for toggles: boolean, for sliders: number). */
|
|
49
|
+
state?: unknown;
|
|
50
|
+
/** For slider type: min/max/step. */
|
|
51
|
+
min?: number;
|
|
52
|
+
max?: number;
|
|
53
|
+
step?: number;
|
|
54
|
+
}
|
|
55
|
+
export interface StreamInfo {
|
|
56
|
+
name: string;
|
|
57
|
+
/** Camera this stream belongs to (if determinable). */
|
|
58
|
+
camera?: string;
|
|
59
|
+
}
|
|
60
|
+
/** Normalized bounding box in 0–1 range (provider-agnostic). */
|
|
61
|
+
export interface NormalizedBoundingBox {
|
|
62
|
+
x1: number;
|
|
63
|
+
y1: number;
|
|
64
|
+
x2: number;
|
|
65
|
+
y2: number;
|
|
66
|
+
}
|
|
67
|
+
/** Detection data attached to an event. */
|
|
68
|
+
export interface DetectionData {
|
|
69
|
+
label: string;
|
|
70
|
+
subLabel?: string;
|
|
71
|
+
/** Confidence score 0–1. */
|
|
72
|
+
score: number;
|
|
73
|
+
/** Best confidence score observed during the event. */
|
|
74
|
+
topScore?: number;
|
|
75
|
+
/** Bounding box of the detected object, normalized 0–1. */
|
|
76
|
+
boundingBox?: NormalizedBoundingBox;
|
|
77
|
+
/** Detection region, normalized 0–1. */
|
|
78
|
+
region?: NormalizedBoundingBox;
|
|
79
|
+
/** Area as fraction of frame area (0–1). */
|
|
80
|
+
area?: number;
|
|
81
|
+
/** Named zones the object is currently in. */
|
|
82
|
+
currentZones?: string[];
|
|
83
|
+
/** Named zones the object has entered during this event. */
|
|
84
|
+
enteredZones?: string[];
|
|
85
|
+
/** Attributes detected (e.g., { face: 0.64, glasses: 0.82 }). */
|
|
86
|
+
attributes?: Record<string, number>;
|
|
87
|
+
/** Current estimated speed. */
|
|
88
|
+
currentSpeed?: number;
|
|
89
|
+
/** Average estimated speed over the event. */
|
|
90
|
+
averageSpeed?: number;
|
|
91
|
+
/** Velocity angle in degrees. */
|
|
92
|
+
velocityAngle?: number;
|
|
93
|
+
/** License plate recognition result. */
|
|
94
|
+
licensePlate?: {
|
|
95
|
+
text: string;
|
|
96
|
+
score: number;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/** Snapshot metadata associated with an event. */
|
|
100
|
+
export interface EventSnapshotData {
|
|
101
|
+
boundingBox?: NormalizedBoundingBox;
|
|
102
|
+
score?: number;
|
|
103
|
+
/** Area as fraction of frame area (0–1). */
|
|
104
|
+
area?: number;
|
|
105
|
+
attributes?: Record<string, number>;
|
|
106
|
+
}
|
|
107
|
+
export interface NvrEvent {
|
|
108
|
+
id: string;
|
|
109
|
+
camera: string;
|
|
110
|
+
label: string;
|
|
111
|
+
startTime: number;
|
|
112
|
+
endTime: number | null;
|
|
113
|
+
severity?: string;
|
|
114
|
+
hasClip: boolean;
|
|
115
|
+
hasSnapshot: boolean;
|
|
116
|
+
thumbnailPath?: string;
|
|
117
|
+
snapshotPath?: string;
|
|
118
|
+
clipPath?: string;
|
|
119
|
+
detection?: DetectionData;
|
|
120
|
+
snapshot?: EventSnapshotData;
|
|
121
|
+
falsePositive?: boolean;
|
|
122
|
+
retainIndefinitely?: boolean;
|
|
123
|
+
raw?: Record<string, unknown>;
|
|
124
|
+
}
|
|
125
|
+
export interface RecordingSegment {
|
|
126
|
+
id: string;
|
|
127
|
+
camera: string;
|
|
128
|
+
startTime: number;
|
|
129
|
+
endTime: number;
|
|
130
|
+
duration: number;
|
|
131
|
+
motion?: number;
|
|
132
|
+
objects?: number;
|
|
133
|
+
dBFS?: number;
|
|
134
|
+
}
|
|
135
|
+
export interface MotionBucket {
|
|
136
|
+
camera: string;
|
|
137
|
+
startTime: number;
|
|
138
|
+
motion?: number;
|
|
139
|
+
audio?: number;
|
|
140
|
+
}
|
|
141
|
+
/** Single object detection from a live frame. */
|
|
142
|
+
export interface LiveDetection {
|
|
143
|
+
/** Detection class — the object type (person, car, dog, face, plate, etc.) */
|
|
144
|
+
className: string;
|
|
145
|
+
/** Recognized identity — face name, license plate text, sub-label. */
|
|
146
|
+
label?: string;
|
|
147
|
+
/** Detection confidence 0–1. */
|
|
148
|
+
score: number;
|
|
149
|
+
/** Label/recognition confidence 0–1 — takes precedence over score when available. */
|
|
150
|
+
labelScore?: number;
|
|
151
|
+
/** Named zones where the object currently is. */
|
|
152
|
+
zones?: string[];
|
|
153
|
+
/** Tracking/correlation ID across frames. */
|
|
154
|
+
id?: string;
|
|
155
|
+
/** Bounding box as fractions 0–1 of frame dimensions. */
|
|
156
|
+
boundingBox?: [number, number, number, number] | {
|
|
157
|
+
x: number;
|
|
158
|
+
y: number;
|
|
159
|
+
w: number;
|
|
160
|
+
h: number;
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
export interface LiveMotionData {
|
|
164
|
+
active: boolean;
|
|
165
|
+
}
|
|
166
|
+
export interface LiveDetectionData {
|
|
167
|
+
detections: LiveDetection[];
|
|
168
|
+
/** Input frame dimensions [width, height] in pixels (for reference). */
|
|
169
|
+
inputDimensions?: [number, number];
|
|
170
|
+
/** Event ID from the NVR (e.g. Frigate event ID). */
|
|
171
|
+
eventId?: string;
|
|
172
|
+
/** Provider-specific extra data. */
|
|
173
|
+
[key: string]: unknown;
|
|
174
|
+
}
|
|
175
|
+
export interface LiveAudioData {
|
|
176
|
+
/** Audio metric type (e.g. "dBFS", "rms", "audioDetected", "audioLevel"). */
|
|
177
|
+
metric: string;
|
|
178
|
+
/** Numeric value. */
|
|
179
|
+
value?: number;
|
|
180
|
+
/** dBFS level. */
|
|
181
|
+
dBFS?: number;
|
|
182
|
+
/** RMS level. */
|
|
183
|
+
rms?: number;
|
|
184
|
+
}
|
|
185
|
+
export type LiveEventType = "motion" | "detection" | "audio" | "event" | "review";
|
|
186
|
+
interface LiveEventBase {
|
|
187
|
+
camera: string;
|
|
188
|
+
timestamp: number;
|
|
189
|
+
/** Provider info — populated by onAllEvents subscription. */
|
|
190
|
+
provider?: {
|
|
191
|
+
id: string;
|
|
192
|
+
name: string;
|
|
193
|
+
type: string;
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
export interface LiveMotionEvent extends LiveEventBase {
|
|
197
|
+
type: "motion";
|
|
198
|
+
data: LiveMotionData;
|
|
199
|
+
}
|
|
200
|
+
export interface LiveDetectionEvent extends LiveEventBase {
|
|
201
|
+
type: "detection";
|
|
202
|
+
data: LiveDetectionData;
|
|
203
|
+
}
|
|
204
|
+
export interface LiveAudioEvent extends LiveEventBase {
|
|
205
|
+
type: "audio";
|
|
206
|
+
data: LiveAudioData;
|
|
207
|
+
}
|
|
208
|
+
export interface LiveGenericEvent extends LiveEventBase {
|
|
209
|
+
type: "event";
|
|
210
|
+
data: Record<string, unknown>;
|
|
211
|
+
}
|
|
212
|
+
export interface LiveReviewEvent extends LiveEventBase {
|
|
213
|
+
type: "review";
|
|
214
|
+
data: Record<string, unknown>;
|
|
215
|
+
}
|
|
216
|
+
export type LiveEvent = LiveMotionEvent | LiveDetectionEvent | LiveAudioEvent | LiveGenericEvent | LiveReviewEvent;
|
|
217
|
+
export interface VideoClipsQuery {
|
|
218
|
+
camera: string;
|
|
219
|
+
after: number;
|
|
220
|
+
before: number;
|
|
221
|
+
limit?: number;
|
|
222
|
+
offset?: number;
|
|
223
|
+
}
|
|
224
|
+
export interface NvrVideoClip {
|
|
225
|
+
id: string;
|
|
226
|
+
camera: string;
|
|
227
|
+
startTime: number;
|
|
228
|
+
endTime: number;
|
|
229
|
+
duration: number;
|
|
230
|
+
label?: string;
|
|
231
|
+
hasClip: boolean;
|
|
232
|
+
hasSnapshot: boolean;
|
|
233
|
+
source: "event" | "recording";
|
|
234
|
+
}
|
|
235
|
+
export interface VideoClipsResult {
|
|
236
|
+
clips: NvrVideoClip[];
|
|
237
|
+
total: number;
|
|
238
|
+
}
|
|
239
|
+
export interface VideoClipUrlResult {
|
|
240
|
+
url: string;
|
|
241
|
+
mimeType: string;
|
|
242
|
+
}
|
|
243
|
+
export interface CameraDayData {
|
|
244
|
+
events: NvrEvent[];
|
|
245
|
+
motion: MotionBucket[];
|
|
246
|
+
recordings: RecordingSegment[];
|
|
247
|
+
}
|
|
248
|
+
export interface CameraStatus {
|
|
249
|
+
camera: string;
|
|
250
|
+
online: boolean;
|
|
251
|
+
recording: boolean;
|
|
252
|
+
detecting: boolean;
|
|
253
|
+
motionActive: boolean;
|
|
254
|
+
}
|
|
255
|
+
export interface EventsQuery {
|
|
256
|
+
after?: number;
|
|
257
|
+
before?: number;
|
|
258
|
+
cameras?: string[];
|
|
259
|
+
limit?: number;
|
|
260
|
+
labels?: string[];
|
|
261
|
+
}
|
|
262
|
+
export interface MotionQuery {
|
|
263
|
+
after: number;
|
|
264
|
+
before: number;
|
|
265
|
+
scale?: number;
|
|
266
|
+
cameras?: string[];
|
|
267
|
+
}
|
|
268
|
+
export interface RecordingsQuery {
|
|
269
|
+
camera: string;
|
|
270
|
+
after: number;
|
|
271
|
+
before: number;
|
|
272
|
+
}
|
|
273
|
+
export interface NvrConfig {
|
|
274
|
+
type: string;
|
|
275
|
+
version?: string;
|
|
276
|
+
raw?: unknown;
|
|
277
|
+
}
|
|
278
|
+
export interface ProviderConfigs {
|
|
279
|
+
cameras: Array<{
|
|
280
|
+
id: string;
|
|
281
|
+
name: string;
|
|
282
|
+
}>;
|
|
283
|
+
enabledDetectionSources?: string[];
|
|
284
|
+
}
|
|
285
|
+
export {};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Timeline & event types — shared between CamStack app and proxy.
|
|
3
|
+
*
|
|
4
|
+
* Names are unified: the proxy's naming convention is canonical.
|
|
5
|
+
* The app re-exports aliases for backward compatibility where needed.
|
|
6
|
+
*/
|
|
7
|
+
/** Frigate severity: alert = notable, detection = regular. */
|
|
8
|
+
export type TimelineEventSeverity = "alert" | "detection";
|
|
9
|
+
/** Motion fragment type: start/end from event boundaries, update from motion API. */
|
|
10
|
+
export type MotionFragmentType = "start" | "end" | "update";
|
|
11
|
+
/**
|
|
12
|
+
* A detection event for timeline display and grouping.
|
|
13
|
+
* Unified from app's TimelineDetectionEvent and proxy's DetectionEvent.
|
|
14
|
+
*/
|
|
15
|
+
export interface DetectionEvent {
|
|
16
|
+
id?: string;
|
|
17
|
+
timestamp: number;
|
|
18
|
+
source?: string;
|
|
19
|
+
classes?: string[];
|
|
20
|
+
/** @deprecated Use `classes` instead. Kept for backward compat with some app code. */
|
|
21
|
+
detectionClasses?: string[];
|
|
22
|
+
label?: string;
|
|
23
|
+
thumbnailUrl?: string;
|
|
24
|
+
imageUrl?: string;
|
|
25
|
+
videoUrl?: string;
|
|
26
|
+
gifUrl?: string;
|
|
27
|
+
severity?: TimelineEventSeverity;
|
|
28
|
+
deviceName?: string;
|
|
29
|
+
deviceId?: string;
|
|
30
|
+
ruleType?: string;
|
|
31
|
+
croppedThumbnailUrl?: string;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Motion on/off item for timeline bar.
|
|
36
|
+
* Unified from app's TimelineMotionItem and proxy's MotionItem.
|
|
37
|
+
*/
|
|
38
|
+
export interface MotionItem {
|
|
39
|
+
timestamp: number;
|
|
40
|
+
deviceId?: string;
|
|
41
|
+
motion: "on" | "off";
|
|
42
|
+
/** Fragment type or "motion" | "audio" (AN audio thresholds). */
|
|
43
|
+
type?: MotionFragmentType | "motion" | "audio" | string;
|
|
44
|
+
/** For type "audio": level 1–5 (threshold crossed). */
|
|
45
|
+
level?: number;
|
|
46
|
+
/** For type "audio": dBFS at threshold crossing. */
|
|
47
|
+
dBFS?: number;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Rule artifact for timeline (from Scrypted AN plugin rules).
|
|
51
|
+
* Unified from app's TimelineArtifactItem and proxy's TimelineArtifact.
|
|
52
|
+
*/
|
|
53
|
+
export interface TimelineArtifact {
|
|
54
|
+
ruleName: string;
|
|
55
|
+
ruleType?: string;
|
|
56
|
+
timestamp: number;
|
|
57
|
+
imageUrl?: string;
|
|
58
|
+
gifUrl?: string;
|
|
59
|
+
videoUrl?: string;
|
|
60
|
+
}
|
|
61
|
+
/** Audio level segment for timeline bar. */
|
|
62
|
+
export interface AudioLevelSegment {
|
|
63
|
+
start: number;
|
|
64
|
+
end: number;
|
|
65
|
+
level: number;
|
|
66
|
+
dBFS?: number;
|
|
67
|
+
}
|
|
68
|
+
/** Recording segment for timeline bar (where recording exists). */
|
|
69
|
+
export interface TimelineRecordingSegment {
|
|
70
|
+
start: number;
|
|
71
|
+
end: number;
|
|
72
|
+
}
|
|
73
|
+
/** Day data for timeline (events, motion, artifacts). */
|
|
74
|
+
export interface CameraDayDataResponse {
|
|
75
|
+
events: DetectionEvent[];
|
|
76
|
+
motion: MotionItem[];
|
|
77
|
+
artifacts: TimelineArtifact[];
|
|
78
|
+
recordings?: TimelineRecordingSegment[];
|
|
79
|
+
}
|
|
80
|
+
/** Clustered day data response (server-side bucketing). */
|
|
81
|
+
export interface ClusteredDayDataResponse {
|
|
82
|
+
clusters: TimelineCluster[];
|
|
83
|
+
motion: MotionItem[];
|
|
84
|
+
artifacts: TimelineArtifact[];
|
|
85
|
+
motionSegments?: TimelineRecordingSegment[];
|
|
86
|
+
audioLevelSegments?: AudioLevelSegment[];
|
|
87
|
+
recordings?: TimelineRecordingSegment[];
|
|
88
|
+
}
|
|
89
|
+
/** A time-bucketed cluster of detection events. */
|
|
90
|
+
export interface TimelineCluster {
|
|
91
|
+
events: DetectionEvent[];
|
|
92
|
+
representative: DetectionEvent;
|
|
93
|
+
classes: string[];
|
|
94
|
+
labels: string[];
|
|
95
|
+
startMs: number;
|
|
96
|
+
endMs: number;
|
|
97
|
+
}
|
|
98
|
+
/** A group of related detection events with a representative. */
|
|
99
|
+
export interface DetectionGroup {
|
|
100
|
+
events: DetectionEvent[];
|
|
101
|
+
representative: DetectionEvent;
|
|
102
|
+
classes: string[];
|
|
103
|
+
labels: string[];
|
|
104
|
+
}
|
|
105
|
+
/** Query for clustered day data. */
|
|
106
|
+
export interface ClusteredDayDataQuery {
|
|
107
|
+
camera: string;
|
|
108
|
+
days: string[];
|
|
109
|
+
bucketMs?: number;
|
|
110
|
+
enabledClasses?: string[];
|
|
111
|
+
classFilter?: string;
|
|
112
|
+
}
|
|
113
|
+
/** Query for grouped events. */
|
|
114
|
+
export interface GroupedEventsQuery {
|
|
115
|
+
after?: number;
|
|
116
|
+
before?: number;
|
|
117
|
+
limit?: number;
|
|
118
|
+
offset?: number;
|
|
119
|
+
cameras?: string[];
|
|
120
|
+
detectionClasses?: string[];
|
|
121
|
+
eventSource?: string;
|
|
122
|
+
filter?: string;
|
|
123
|
+
groupingRange?: number;
|
|
124
|
+
}
|
|
125
|
+
/** Result of grouped events query. */
|
|
126
|
+
export interface GroupedEventsResult {
|
|
127
|
+
groups: DetectionGroup[];
|
|
128
|
+
total: number;
|
|
129
|
+
ruleArtifacts?: DetectionGroup[];
|
|
130
|
+
}
|
|
131
|
+
/** Query for events within a cluster time range. */
|
|
132
|
+
export interface ClusterEventsQuery {
|
|
133
|
+
camera: string;
|
|
134
|
+
startMs: number;
|
|
135
|
+
endMs: number;
|
|
136
|
+
}
|
|
137
|
+
/** Result of cluster events query. */
|
|
138
|
+
export interface ClusterEventsResult {
|
|
139
|
+
events: DetectionEvent[];
|
|
140
|
+
}
|
|
141
|
+
/** A reel event (carousel-friendly). All timestamps are in **seconds** (Unix epoch). */
|
|
142
|
+
export interface ReelEvent {
|
|
143
|
+
id: string;
|
|
144
|
+
camera: string;
|
|
145
|
+
cameraName: string;
|
|
146
|
+
label: string;
|
|
147
|
+
/** Unix timestamp in **seconds** (not milliseconds). */
|
|
148
|
+
startTime: number;
|
|
149
|
+
thumbnail?: string;
|
|
150
|
+
croppedThumbnailUrl?: string;
|
|
151
|
+
hasClip?: boolean;
|
|
152
|
+
gifUrl?: string;
|
|
153
|
+
videoUrl?: string;
|
|
154
|
+
imageUrl?: string;
|
|
155
|
+
classes?: string[];
|
|
156
|
+
}
|
|
157
|
+
/** Query for reel events. */
|
|
158
|
+
export interface ReelEventsQuery {
|
|
159
|
+
limit?: number;
|
|
160
|
+
offset?: number;
|
|
161
|
+
cameras?: string[];
|
|
162
|
+
eventSource?: string;
|
|
163
|
+
detectionClasses?: string[];
|
|
164
|
+
}
|
|
165
|
+
/** Result of reel events query. */
|
|
166
|
+
export interface ReelEventsResult {
|
|
167
|
+
events: ReelEvent[];
|
|
168
|
+
total: number;
|
|
169
|
+
}
|
|
170
|
+
/** @deprecated Use DetectionEvent instead. */
|
|
171
|
+
export type TimelineDetectionEvent = DetectionEvent;
|
|
172
|
+
/** @deprecated Use MotionItem instead. */
|
|
173
|
+
export type TimelineMotionItem = MotionItem;
|
|
174
|
+
/** @deprecated Use TimelineArtifact instead. */
|
|
175
|
+
export type TimelineArtifactItem = TimelineArtifact;
|
|
176
|
+
/** @deprecated Use TimelineCluster instead. */
|
|
177
|
+
export type TimelineClusterFromServer = TimelineCluster;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK client configuration types.
|
|
3
|
+
*
|
|
4
|
+
* NVR types are now in nvr.ts (shared across app and proxy).
|
|
5
|
+
*/
|
|
6
|
+
export interface HlsInfo {
|
|
7
|
+
hlsUrl: string;
|
|
8
|
+
}
|
|
9
|
+
/** Public provider info (returned by providers.list). */
|
|
10
|
+
export interface ProviderInfo {
|
|
11
|
+
id: string;
|
|
12
|
+
type: string;
|
|
13
|
+
name: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ProxyClientConfig {
|
|
16
|
+
/**
|
|
17
|
+
* Primary proxy URL (e.g. "http://192.168.1.100:4000").
|
|
18
|
+
* Can also be an array of URLs to race (like Scrypted SDK).
|
|
19
|
+
* The first successful connection wins.
|
|
20
|
+
*/
|
|
21
|
+
proxyUrl: string | string[];
|
|
22
|
+
/** Optional auth token for admin endpoints. */
|
|
23
|
+
token?: string;
|
|
24
|
+
/** Transport: "websocket" (default, like Scrypted SDK) or "http" (REST fallback). */
|
|
25
|
+
transport?: "websocket" | "http";
|
|
26
|
+
/** Connection timeout per URL in ms (default: 10000). */
|
|
27
|
+
connectTimeoutMs?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface DirectClientConfig {
|
|
30
|
+
directUrl: string;
|
|
31
|
+
type: "frigate";
|
|
32
|
+
username?: string;
|
|
33
|
+
password?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface BackendClientConfig {
|
|
36
|
+
/** Backend server URL (e.g. "http://localhost:4443") */
|
|
37
|
+
readonly serverUrl: string;
|
|
38
|
+
/** JWT token for authentication */
|
|
39
|
+
readonly token?: string;
|
|
40
|
+
/** Connection timeout in ms (default: 10000) */
|
|
41
|
+
readonly connectTimeoutMs?: number;
|
|
42
|
+
}
|
|
43
|
+
export type CamStackClientConfig = ProxyClientConfig | DirectClientConfig;
|
|
44
|
+
export declare function isProxyConfig(config: CamStackClientConfig): config is ProxyClientConfig;
|