@camera.ui/browser 0.0.74 → 0.0.75
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/bundle.js +1 -1
- package/dist/types/packages/client/browser/src/types.d.ts +1 -1
- package/dist/types/server/src/api/controllers/cameras.controller.d.ts +5 -5
- package/dist/types/server/src/api/database/types.d.ts +22 -5
- package/dist/types/server/src/api/schemas/cameras.schema.d.ts +192 -158
- package/dist/types/server/src/api/schemas/go2rtc.schema.d.ts +6 -6
- package/dist/types/server/src/api/schemas/users.schema.d.ts +2 -2
- package/dist/types/server/src/api/services/cameras.service.d.ts +4 -3
- package/dist/types/server/src/api/types/index.d.ts +0 -5
- package/dist/types/server/src/api.d.ts +1 -1
- package/dist/types/server/src/camera/{controller/index.d.ts → controller.d.ts} +7 -6
- package/dist/types/server/src/camera/{cameraDevice.d.ts → device.d.ts} +1 -1
- package/dist/types/server/src/camera/index.d.ts +10 -12
- package/dist/types/server/src/camera/polygon.d.ts +3 -0
- package/dist/types/server/src/camera/streaming/peer-connection.d.ts +2 -2
- package/dist/types/server/src/camera/streaming/streaming-session.d.ts +2 -2
- package/dist/types/server/src/camera/streaming/webrtc-connection.d.ts +2 -2
- package/dist/types/server/src/camera/{controller/types.d.ts → types.d.ts} +12 -8
- package/dist/types/server/src/camera/videoFrame.d.ts +18 -0
- package/dist/types/server/src/decoder/index.d.ts +1 -12
- package/dist/types/server/src/decoder/types.d.ts +14 -5
- package/dist/types/server/src/decoder/worker.d.ts +6 -14
- package/dist/types/server/src/nats/constants.d.ts +0 -1
- package/dist/types/server/src/nats/index.d.ts +2 -2
- package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +1 -6
- package/dist/types/server/src/nats/proxy/deviceManager.d.ts +1 -1
- package/dist/types/server/src/nats/server.d.ts +4 -2
- package/dist/types/server/src/nats/types.d.ts +5 -9
- package/dist/types/server/src/nats/websocket.d.ts +1 -1
- package/dist/types/server/src/plugins/base.d.ts +1 -1
- package/dist/types/server/src/polyglot/node/plugins/api.d.ts +1 -1
- package/dist/types/server/src/polyglot/node/plugins/proxy/cameraDevice.d.ts +17 -16
- package/dist/types/server/src/polyglot/node/plugins/proxy/deviceManager.d.ts +9 -7
- package/dist/types/server/src/polyglot/node/plugins/proxy/pluginsManager.d.ts +6 -5
- package/dist/types/server/src/polyglot/node/plugins/proxy/queue.d.ts +1 -1
- package/dist/types/server/src/polyglot/node/plugins/proxy/systemManager.d.ts +6 -5
- package/dist/types/shared/types/index.d.ts +2 -1
- package/package.json +3 -3
|
@@ -17,11 +17,11 @@ export declare const logSchema: zod.ZodObject<{
|
|
|
17
17
|
streams: zod.ZodUnion<[zod.ZodLiteral<"info">, zod.ZodLiteral<"debug">, zod.ZodLiteral<"trace">, zod.ZodLiteral<"warn">, zod.ZodLiteral<"error">, zod.ZodLiteral<"fatal">]>;
|
|
18
18
|
webrtc: zod.ZodUnion<[zod.ZodLiteral<"info">, zod.ZodLiteral<"debug">, zod.ZodLiteral<"trace">, zod.ZodLiteral<"warn">, zod.ZodLiteral<"error">, zod.ZodLiteral<"fatal">]>;
|
|
19
19
|
}, "strict", zod.ZodTypeAny, {
|
|
20
|
+
mp4: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
20
21
|
rtsp: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
21
22
|
webrtc: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
22
23
|
mjpeg: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
23
24
|
hls: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
24
|
-
mp4: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
25
25
|
level: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
26
26
|
format: string;
|
|
27
27
|
api: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
@@ -33,11 +33,11 @@ export declare const logSchema: zod.ZodObject<{
|
|
|
33
33
|
hass: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
34
34
|
streams: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
35
35
|
}, {
|
|
36
|
+
mp4: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
36
37
|
rtsp: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
37
38
|
webrtc: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
38
39
|
mjpeg: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
39
40
|
hls: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
40
|
-
mp4: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
41
41
|
api: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
42
42
|
exec: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
43
43
|
ngrok: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
|
|
@@ -270,11 +270,11 @@ export declare const patchGo2RtcSchema: zod.ZodObject<{
|
|
|
270
270
|
streams: zod.ZodOptional<zod.ZodUnion<[zod.ZodLiteral<"info">, zod.ZodLiteral<"debug">, zod.ZodLiteral<"trace">, zod.ZodLiteral<"warn">, zod.ZodLiteral<"error">, zod.ZodLiteral<"fatal">]>>;
|
|
271
271
|
webrtc: zod.ZodOptional<zod.ZodUnion<[zod.ZodLiteral<"info">, zod.ZodLiteral<"debug">, zod.ZodLiteral<"trace">, zod.ZodLiteral<"warn">, zod.ZodLiteral<"error">, zod.ZodLiteral<"fatal">]>>;
|
|
272
272
|
}, "strict", zod.ZodTypeAny, {
|
|
273
|
+
mp4?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
273
274
|
rtsp?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
274
275
|
webrtc?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
275
276
|
mjpeg?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
276
277
|
hls?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
277
|
-
mp4?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
278
278
|
level?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
279
279
|
format?: string | undefined;
|
|
280
280
|
api?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
@@ -286,11 +286,11 @@ export declare const patchGo2RtcSchema: zod.ZodObject<{
|
|
|
286
286
|
hass?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
287
287
|
streams?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
288
288
|
}, {
|
|
289
|
+
mp4?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
289
290
|
rtsp?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
290
291
|
webrtc?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
291
292
|
mjpeg?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
292
293
|
hls?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
293
|
-
mp4?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
294
294
|
level?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
295
295
|
format?: string | undefined;
|
|
296
296
|
api?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
@@ -490,11 +490,11 @@ export declare const patchGo2RtcSchema: zod.ZodObject<{
|
|
|
490
490
|
output: string;
|
|
491
491
|
};
|
|
492
492
|
log: {
|
|
493
|
+
mp4?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
493
494
|
rtsp?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
494
495
|
webrtc?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
495
496
|
mjpeg?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
496
497
|
hls?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
497
|
-
mp4?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
498
498
|
level?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
499
499
|
format?: string | undefined;
|
|
500
500
|
api?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
@@ -581,11 +581,11 @@ export declare const patchGo2RtcSchema: zod.ZodObject<{
|
|
|
581
581
|
output?: string | undefined;
|
|
582
582
|
}) | undefined;
|
|
583
583
|
log?: {
|
|
584
|
+
mp4?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
584
585
|
rtsp?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
585
586
|
webrtc?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
586
587
|
mjpeg?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
587
588
|
hls?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
588
|
-
mp4?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
589
589
|
level?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
590
590
|
format?: string | undefined;
|
|
591
591
|
api?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
|
|
@@ -243,8 +243,8 @@ export declare const createUserSchema: zod.ZodEffects<zod.ZodObject<{
|
|
|
243
243
|
};
|
|
244
244
|
}>>;
|
|
245
245
|
}, "strict", zod.ZodTypeAny, {
|
|
246
|
-
password: string;
|
|
247
246
|
_id: string;
|
|
247
|
+
password: string;
|
|
248
248
|
preferences: {
|
|
249
249
|
camview: {
|
|
250
250
|
grids: {
|
|
@@ -287,8 +287,8 @@ export declare const createUserSchema: zod.ZodEffects<zod.ZodObject<{
|
|
|
287
287
|
oneLogin?: boolean | undefined;
|
|
288
288
|
firstLogin?: boolean | undefined;
|
|
289
289
|
}>, {
|
|
290
|
-
password: string;
|
|
291
290
|
_id: string;
|
|
291
|
+
password: string;
|
|
292
292
|
preferences: {
|
|
293
293
|
camview: {
|
|
294
294
|
grids: {
|
|
@@ -13,9 +13,9 @@ export declare class CamerasService {
|
|
|
13
13
|
constructor();
|
|
14
14
|
createCamera(cameraData: DBCamera): Promise<DBCamera>;
|
|
15
15
|
createTransformedCamera(cameraData: DBCamera): Promise<Camera>;
|
|
16
|
-
createZone(cameraname: string, zoneData: CameraZone
|
|
17
|
-
patchZoneByName(cameraname: string, zonename: string, zoneData: CameraZone
|
|
18
|
-
removeZoneByName(cameraname: string, zonename: string
|
|
16
|
+
createZone(cameraname: string, zoneData: CameraZone): Promise<DBCamera | undefined>;
|
|
17
|
+
patchZoneByName(cameraname: string, zonename: string, zoneData: CameraZone): Promise<DBCamera | undefined>;
|
|
18
|
+
removeZoneByName(cameraname: string, zonename: string): Promise<void>;
|
|
19
19
|
createCameraSource(cameraname: string, sourceName: string, address: string): Promise<void>;
|
|
20
20
|
resetCameraSource(cameraname: string, sourceName: string): Promise<void>;
|
|
21
21
|
list(): DBCamera[];
|
|
@@ -50,5 +50,6 @@ export declare class CamerasService {
|
|
|
50
50
|
private generateFFmpegUrls;
|
|
51
51
|
private generateWWWUrls;
|
|
52
52
|
private extensionIsEnabled;
|
|
53
|
+
private convertToDetectionZones;
|
|
53
54
|
}
|
|
54
55
|
export {};
|
|
@@ -249,11 +249,6 @@ export type CamerasExtensionsRequest = {
|
|
|
249
249
|
type: CameraExtension;
|
|
250
250
|
};
|
|
251
251
|
};
|
|
252
|
-
export type CameraZonesTypeRequest = {
|
|
253
|
-
Querystring: {
|
|
254
|
-
type: 'motion' | 'object';
|
|
255
|
-
};
|
|
256
|
-
};
|
|
257
252
|
export type CameraZoneInsertPatchRequest = {
|
|
258
253
|
Body: CameraZone;
|
|
259
254
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import 'reflect-metadata';
|
|
3
3
|
import { EventEmitter } from 'node:events';
|
|
4
|
-
import { CameraController } from './camera/controller
|
|
4
|
+
import { CameraController } from './camera/controller.js';
|
|
5
5
|
import type { Camera, CameraExtensions } from './api/database/types.js';
|
|
6
6
|
import type { FrameWorker } from './decoder/worker.js';
|
|
7
7
|
import type { BasePlugin } from './plugins/base.js';
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { CameraDevice } from '
|
|
2
|
-
import type { Camera } from '
|
|
3
|
-
import type { VideoFrame } from '
|
|
4
|
-
import type { ProxyServer } from '
|
|
5
|
-
import type { IceServer } from '
|
|
6
|
-
import type { BaseLogger } from './types.js';
|
|
1
|
+
import { CameraDevice } from './device.js';
|
|
2
|
+
import type { Camera } from '../api/database/types.js';
|
|
3
|
+
import type { VideoFrame } from '../decoder/types.js';
|
|
4
|
+
import type { ProxyServer } from '../nats/index.js';
|
|
5
|
+
import type { IceServer } from '../services/config/types.js';
|
|
6
|
+
import type { BaseLogger, CameraSource } from './types.js';
|
|
7
7
|
export declare class CameraController extends CameraDevice {
|
|
8
8
|
private proxy;
|
|
9
9
|
private motionTimeout?;
|
|
10
10
|
private doorbellTimeout?;
|
|
11
11
|
private doorbellTimeoutDuration;
|
|
12
12
|
private prebufferStateSubscriptions;
|
|
13
|
+
get sources(): CameraSource[];
|
|
13
14
|
constructor(camera: Camera, logger: BaseLogger, proxy: ProxyServer);
|
|
14
15
|
connect(): Promise<void>;
|
|
15
16
|
disconnect(): Promise<void>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseCameraDevice } from './index.js';
|
|
2
2
|
import { StreamingSession } from './streaming/streaming-session.js';
|
|
3
3
|
import type { VideoFrame } from '../decoder/types.js';
|
|
4
|
-
import type { CameraDelegate, CameraPrebufferDelegate, FfmpegOptions } from './controller/types.js';
|
|
5
4
|
import type { StreamingConnectionOptions } from './streaming/peer-connection.js';
|
|
5
|
+
import type { CameraDelegate, CameraPrebufferDelegate, FfmpegOptions } from './types.js';
|
|
6
6
|
export declare abstract class CameraDevice extends BaseCameraDevice {
|
|
7
7
|
private _delegate?;
|
|
8
8
|
private _prebufferDelegate?;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { LRUCache } from 'lru-cache';
|
|
2
2
|
import { BehaviorSubject } from 'rxjs';
|
|
3
3
|
import type { Observable, Subscription } from 'rxjs';
|
|
4
|
-
import type { Camera, CameraInformation, CameraPublicProperties, CameraType
|
|
4
|
+
import type { Camera, CameraActivitySettings, CameraInformation, CameraPublicProperties, CameraType } from '../api/database/types.js';
|
|
5
5
|
import type { IceServer } from '../services/config/types.js';
|
|
6
|
-
import type { AudioSetEvent, AudioState, BaseLogger, BatterySetEvent, BatteryState, CameraSource, DoorbellSetEvent, DoorbellState, LightSetEvent, LightState, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, PrebufferContainer, PrebufferState, SetValues, Sets, SirenSetEvent, SirenState, StateValues, States } from './
|
|
6
|
+
import type { AudioSetEvent, AudioState, BaseLogger, BatterySetEvent, BatteryState, CameraSource, DetectionZone, DoorbellSetEvent, DoorbellState, LightSetEvent, LightState, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, PrebufferContainer, PrebufferState, SetValues, Sets, SirenSetEvent, SirenState, StateValues, States } from './types.js';
|
|
7
7
|
declare class Subscribed {
|
|
8
8
|
private readonly subscriptions;
|
|
9
9
|
private readonly additionalSubscriptions;
|
|
@@ -56,8 +56,8 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
56
56
|
get hasPtz(): boolean;
|
|
57
57
|
get hasPrebuffer(): boolean;
|
|
58
58
|
get hasIntercom(): boolean;
|
|
59
|
-
get
|
|
60
|
-
get
|
|
59
|
+
get activityZones(): DetectionZone[];
|
|
60
|
+
get activitySettings(): CameraActivitySettings;
|
|
61
61
|
get sources(): CameraSource[];
|
|
62
62
|
get streamSource(): CameraSource;
|
|
63
63
|
get snapshotSource(): CameraSource;
|
|
@@ -71,7 +71,7 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
71
71
|
abstract getIceServers(): Promise<IceServer[]>;
|
|
72
72
|
protected abstract cleanup(): void;
|
|
73
73
|
getValue<T extends keyof StateValues>(stateName: T): StateValues[T];
|
|
74
|
-
updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T]): Promise<void>;
|
|
74
|
+
updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], skipCheck?: boolean): Promise<void>;
|
|
75
75
|
onStateChange<T extends keyof StateValues>(stateName: T): Observable<{
|
|
76
76
|
newState: StateValues[T];
|
|
77
77
|
oldState: StateValues[T];
|
|
@@ -81,6 +81,10 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
81
81
|
newData: Camera[T];
|
|
82
82
|
}>;
|
|
83
83
|
removeAllListeners(): void;
|
|
84
|
+
protected checkStateInternal<T extends keyof SetValues>(stateName: T, event: SetValues[T]): {
|
|
85
|
+
changed: boolean;
|
|
86
|
+
event: SetValues[T];
|
|
87
|
+
};
|
|
84
88
|
protected getAudioState(event: AudioSetEvent): AudioState;
|
|
85
89
|
protected getMotionState(event: MotionSetEvent): MotionState;
|
|
86
90
|
protected getObjectState(event: ObjectSetEvent): ObjectState;
|
|
@@ -95,13 +99,7 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
95
99
|
protected cameraSourcePrebufferState(sourceId: string, container: PrebufferContainer): PrebufferState;
|
|
96
100
|
private createStateObservable;
|
|
97
101
|
protected createPrebufferStateObservable(sourceId: string, container: PrebufferContainer): Observable<PrebufferState>;
|
|
98
|
-
protected stateChanged<T extends keyof SetValues>(oldState?: SetValues[T], newState?: SetValues[T]): boolean;
|
|
99
|
-
protected isAudioState(state: Sets): state is AudioSetEvent;
|
|
100
|
-
protected isMotionState(state: Sets): state is MotionSetEvent;
|
|
101
|
-
protected isObjectState(state: Sets): state is ObjectSetEvent;
|
|
102
|
-
protected isSirenState(state: Sets): state is SirenSetEvent;
|
|
103
|
-
protected isBatteryState(state: Sets): state is BatterySetEvent;
|
|
104
|
-
protected isGenericState(state: Sets): state is DoorbellSetEvent;
|
|
102
|
+
protected stateChanged<T extends keyof SetValues>(oldState?: SetValues[T], newState?: SetValues[T], type?: keyof StateValues): boolean;
|
|
105
103
|
protected isStateEvent(state: States | Sets): state is States;
|
|
106
104
|
}
|
|
107
105
|
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Detection, DetectionZone } from './types.js';
|
|
2
|
+
export declare const areObjectDetectionsValid: (detections: Detection[], zones: DetectionZone[]) => Detection[];
|
|
3
|
+
export declare const areMotionDetectionsValid: (detections: Detection[], zones: DetectionZone[]) => Detection[];
|
|
@@ -4,8 +4,8 @@ import { Subscribed } from '../../utils/subscribed.js';
|
|
|
4
4
|
import type { Observable } from 'rxjs';
|
|
5
5
|
import type { ConnectionState, RTCIceCandidate, RTCSessionDescription, RtcpPacket, RtpPacket, RTCIceCandidate as WeriftRTCICECandidate } from 'werift';
|
|
6
6
|
import type { IceServer } from '../../services/config/types.js';
|
|
7
|
-
import type { CameraDevice } from '../
|
|
8
|
-
import type { BaseLogger } from '../
|
|
7
|
+
import type { CameraDevice } from '../device.js';
|
|
8
|
+
import type { BaseLogger } from '../types.js';
|
|
9
9
|
export interface BasicPeerConnection {
|
|
10
10
|
createOffer(): Promise<RTCSessionDescription>;
|
|
11
11
|
acceptAnswer(answer: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReplaySubject, Subject } from 'rxjs';
|
|
2
2
|
import { RtpPacket } from 'werift';
|
|
3
3
|
import { Subscribed } from '../../utils/subscribed.js';
|
|
4
|
-
import type { CameraDevice } from '../
|
|
5
|
-
import type { BaseLogger, FfmpegOptions, SpawnInput } from '../
|
|
4
|
+
import type { CameraDevice } from '../device.js';
|
|
5
|
+
import type { BaseLogger, FfmpegOptions, SpawnInput } from '../types.js';
|
|
6
6
|
import type { WebrtcConnection } from './webrtc-connection.js';
|
|
7
7
|
export declare class StreamingSession extends Subscribed {
|
|
8
8
|
readonly onCallEnded: ReplaySubject<void>;
|
|
@@ -2,8 +2,8 @@ import { ReplaySubject, Subject, type Observable } from 'rxjs';
|
|
|
2
2
|
import { Subscribed } from '../../utils/subscribed.js';
|
|
3
3
|
import type { RtpPacket } from 'werift';
|
|
4
4
|
import type { IceServer } from '../../services/config/types.js';
|
|
5
|
-
import type { CameraDevice } from '../
|
|
6
|
-
import type { BaseLogger } from '../
|
|
5
|
+
import type { CameraDevice } from '../device.js';
|
|
6
|
+
import type { BaseLogger } from '../types.js';
|
|
7
7
|
import type { StreamingConnectionOptions } from './peer-connection.js';
|
|
8
8
|
export declare class WebrtcConnection extends Subscribed {
|
|
9
9
|
readonly onCameraConnected: ReplaySubject<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import type { Observable } from 'rxjs';
|
|
3
|
-
import type { CameraInformation, CameraInput, CameraInputSettings } from '
|
|
3
|
+
import type { CameraInformation, CameraInput, CameraInputSettings, Point, ZoneFilter, ZoneType } from '../api/database/types.js';
|
|
4
4
|
export interface BaseLogger {
|
|
5
5
|
log: (...args: any[]) => void;
|
|
6
6
|
error: (...args: any[]) => void;
|
|
@@ -98,7 +98,7 @@ export type CameraConfig = (BaseCameraConfig & {
|
|
|
98
98
|
}) | (BaseCameraConfig & {
|
|
99
99
|
delegate?: CameraDelegate;
|
|
100
100
|
});
|
|
101
|
-
export interface
|
|
101
|
+
export interface Detection {
|
|
102
102
|
id?: string;
|
|
103
103
|
label: string;
|
|
104
104
|
confidence: number;
|
|
@@ -108,24 +108,28 @@ export interface BaseDetection {
|
|
|
108
108
|
origWidth: number;
|
|
109
109
|
origHeight: number;
|
|
110
110
|
}
|
|
111
|
-
export interface
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
export interface DetectionZone {
|
|
112
|
+
name: string;
|
|
113
|
+
points: Point[];
|
|
114
|
+
type: ZoneType;
|
|
115
|
+
filter: ZoneFilter;
|
|
116
|
+
classes: string[];
|
|
117
|
+
isPrivacyMask: boolean;
|
|
114
118
|
}
|
|
115
119
|
export interface BaseState<T extends LightState | AudioState | MotionState | ObjectState | SirenState | BatteryState | DoorbellState> {
|
|
116
120
|
timestamp: string;
|
|
117
121
|
lastEvent?: Omit<T, 'lastEvent'>;
|
|
118
122
|
}
|
|
119
123
|
export interface MotionSetEvent {
|
|
120
|
-
state
|
|
121
|
-
detections:
|
|
124
|
+
state?: boolean;
|
|
125
|
+
detections: Detection[];
|
|
122
126
|
}
|
|
123
127
|
export interface AudioSetEvent {
|
|
124
128
|
state: boolean;
|
|
125
129
|
db?: number;
|
|
126
130
|
}
|
|
127
131
|
export interface ObjectSetEvent {
|
|
128
|
-
detections:
|
|
132
|
+
detections: Detection[];
|
|
129
133
|
}
|
|
130
134
|
export interface LightSetEvent {
|
|
131
135
|
state: boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import { type NatsConnection } from 'nats';
|
|
3
|
+
import type { Sharp } from 'sharp';
|
|
4
|
+
import type { FrameMetadata, ImageOptions, VideoFrame } from '../decoder/types.js';
|
|
5
|
+
export declare class VideoFrameUtil implements VideoFrame {
|
|
6
|
+
private frameGeneratorSubject;
|
|
7
|
+
private publisher;
|
|
8
|
+
private imageBuffer;
|
|
9
|
+
private _metadata;
|
|
10
|
+
get metadata(): FrameMetadata;
|
|
11
|
+
get inputWidth(): number;
|
|
12
|
+
get inputHeight(): number;
|
|
13
|
+
get inputFormat(): string;
|
|
14
|
+
constructor(cameraId: string, publisher: NatsConnection, imageBuffer: Buffer, metadata: FrameMetadata);
|
|
15
|
+
toBuffer(options?: ImageOptions): Promise<Buffer>;
|
|
16
|
+
toImage(options?: ImageOptions): Promise<Sharp>;
|
|
17
|
+
private send;
|
|
18
|
+
}
|
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
import { FrameWorker } from './worker.js';
|
|
2
|
-
import type { CameraController } from '../camera/controller
|
|
2
|
+
import type { CameraController } from '../camera/controller.js';
|
|
3
3
|
export declare class FrameManager {
|
|
4
4
|
frameWorkers: Map<string, FrameWorker>;
|
|
5
|
-
private initialized;
|
|
6
5
|
private api;
|
|
7
6
|
private proxyServer;
|
|
8
7
|
private logger;
|
|
9
|
-
private publisher?;
|
|
10
|
-
private subscriber?;
|
|
11
|
-
private subject;
|
|
12
8
|
constructor();
|
|
13
|
-
init(): Promise<void>;
|
|
14
9
|
addCamera(camera: CameraController): Promise<FrameWorker>;
|
|
15
10
|
removeCamera(camera: CameraController): Promise<void>;
|
|
16
|
-
private handleConnectMessage;
|
|
17
|
-
private handleDisconnectMessage;
|
|
18
|
-
private disconnectClient;
|
|
19
|
-
private disconnectAllClients;
|
|
20
|
-
private startPingPongForClient;
|
|
21
|
-
private listenToMessages;
|
|
22
11
|
}
|
|
@@ -60,9 +60,10 @@ export interface BaseFrameWorkerConfig {
|
|
|
60
60
|
user: string;
|
|
61
61
|
pass: string;
|
|
62
62
|
};
|
|
63
|
+
proxyPort: number;
|
|
63
64
|
}
|
|
64
|
-
export type WorkerMessage = 'started' | 'getFFmpegArgs';
|
|
65
|
-
export type MainMessage = '
|
|
65
|
+
export type WorkerMessage = 'started' | 'getFFmpegArgs' | 'updateClient' | 'removeClient' | 'clearClients';
|
|
66
|
+
export type MainMessage = 'setCameraName' | 'recoverClients';
|
|
66
67
|
export interface MainToWorkerMessage {
|
|
67
68
|
message: MainMessage;
|
|
68
69
|
data: Record<string, any>;
|
|
@@ -78,15 +79,15 @@ export interface MainToWorkerResponse {
|
|
|
78
79
|
response?: Record<string, any>;
|
|
79
80
|
}
|
|
80
81
|
export interface SignalingRequest {
|
|
81
|
-
type: 'connect' | 'disconnect';
|
|
82
|
+
type: 'connect' | 'disconnect' | 'metadata';
|
|
82
83
|
requestId: string;
|
|
83
84
|
cameraId: string;
|
|
84
85
|
pluginId: string;
|
|
85
86
|
}
|
|
86
87
|
export interface SignalingResponse {
|
|
87
|
-
type: 'connected' | 'disconnected' | '
|
|
88
|
+
type: 'connected' | 'disconnected' | 'metadata';
|
|
88
89
|
requestId: string;
|
|
89
|
-
|
|
90
|
+
metadata?: FrameMetadata;
|
|
90
91
|
}
|
|
91
92
|
export interface PingMessage {
|
|
92
93
|
type: 'ping';
|
|
@@ -109,3 +110,11 @@ export interface FfmpegArgs {
|
|
|
109
110
|
hwaccelFilter: string;
|
|
110
111
|
threads: string;
|
|
111
112
|
}
|
|
113
|
+
export interface FrameWorkerClient {
|
|
114
|
+
pluginId: string;
|
|
115
|
+
requestIds: string[];
|
|
116
|
+
}
|
|
117
|
+
export interface RecoveredClient {
|
|
118
|
+
pluginId: string;
|
|
119
|
+
requestIds: string[];
|
|
120
|
+
}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { Subscribed } from '../utils/subscribed.js';
|
|
2
|
-
import type { CameraController } from '../camera/controller
|
|
3
|
-
import type { FrameMetadata } from './types.js';
|
|
4
|
-
interface FrameWorkerClient {
|
|
5
|
-
pluginId: string;
|
|
6
|
-
requestIds: string[];
|
|
7
|
-
}
|
|
2
|
+
import type { CameraController } from '../camera/controller.js';
|
|
8
3
|
export declare class FrameWorker extends Subscribed {
|
|
9
4
|
token: string;
|
|
10
|
-
readonly clients
|
|
5
|
+
private readonly clients;
|
|
11
6
|
private subject;
|
|
12
7
|
private ipcSubject;
|
|
13
8
|
private frameWorkerId;
|
|
@@ -20,23 +15,20 @@ export declare class FrameWorker extends Subscribed {
|
|
|
20
15
|
private initialized;
|
|
21
16
|
private stopped;
|
|
22
17
|
private auth;
|
|
18
|
+
private proxyPort;
|
|
23
19
|
private ffmpegArgs;
|
|
24
20
|
private py;
|
|
25
|
-
constructor(camera: CameraController, auth: {
|
|
21
|
+
constructor(camera: CameraController, proxyPort: number, auth: {
|
|
26
22
|
user: string;
|
|
27
23
|
pass: string;
|
|
28
24
|
});
|
|
29
25
|
init(): Promise<void>;
|
|
30
26
|
close(): Promise<void>;
|
|
31
27
|
workerPID(): number;
|
|
32
|
-
getMetadata(): Promise<FrameMetadata>;
|
|
33
|
-
addClient(pluginId: string, requestId: string): Promise<void>;
|
|
34
|
-
removeClient(pluginId: string, requestId: string): Promise<void>;
|
|
35
|
-
private startVideoSession;
|
|
36
|
-
private stopVideoSession;
|
|
37
28
|
private startWorker;
|
|
29
|
+
private restartWorker;
|
|
30
|
+
private killWorker;
|
|
38
31
|
private sendMessage;
|
|
39
32
|
private listenToMessages;
|
|
40
33
|
private getLogPrefix;
|
|
41
34
|
}
|
|
42
|
-
export {};
|
|
@@ -2,7 +2,7 @@ import { type NatsConnection, type Subscription } from 'nats';
|
|
|
2
2
|
import { CameraDeviceProxy } from './proxy/cameraDevice.js';
|
|
3
3
|
import { DeviceManagerProxy, PluginsManagerProxy, SystemManagerProxy } from './proxy/index.js';
|
|
4
4
|
import { NatsServer } from './server.js';
|
|
5
|
-
import type { StateValues } from '../camera/
|
|
5
|
+
import type { StateValues } from '../camera/types.js';
|
|
6
6
|
import type { CameraDeviceListenerMessagePayload, DeviceManagerProxyEvents, PluginsManagerProxyEvents, ProxyAuth, SystemManagerProxyEvents } from './types.js';
|
|
7
7
|
import type { WebsocketProxy } from './websocket.js';
|
|
8
8
|
export declare class ProxyServer {
|
|
@@ -16,7 +16,7 @@ export declare class ProxyServer {
|
|
|
16
16
|
server: NatsServer;
|
|
17
17
|
publisher?: NatsConnection;
|
|
18
18
|
subscriber?: Subscription;
|
|
19
|
-
private messageQueue
|
|
19
|
+
private messageQueue?;
|
|
20
20
|
private initialized;
|
|
21
21
|
auth: ProxyAuth;
|
|
22
22
|
constructor();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import type { Camera } from '../../api/database/types.js';
|
|
3
|
-
import type { CameraDelegate, CameraPrebufferDelegate, FfmpegOptions, PrebufferContainer, PrebufferState, SetValues, StateValues, StreamInfo } from '../../camera/
|
|
4
|
-
import type { FrameMetadata } from '../../decoder/types.js';
|
|
3
|
+
import type { CameraDelegate, CameraPrebufferDelegate, FfmpegOptions, PrebufferContainer, PrebufferState, SetValues, StateValues, StreamInfo } from '../../camera/types.js';
|
|
5
4
|
import type { IceServer } from '../../services/config/types.js';
|
|
6
5
|
import type { MessageQueue } from '../queue.js';
|
|
7
6
|
import type { CameraDeviceProxyMethods, ProxyMessageStructure } from '../types.js';
|
|
@@ -30,10 +29,6 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
|
|
|
30
29
|
cameraId: string;
|
|
31
30
|
pluginId: string;
|
|
32
31
|
}): Promise<StreamInfo | undefined>;
|
|
33
|
-
getFrameMetadata(data: {
|
|
34
|
-
cameraId: string;
|
|
35
|
-
pluginId: string;
|
|
36
|
-
}): Promise<FrameMetadata>;
|
|
37
32
|
getFfmpegPath(): string;
|
|
38
33
|
getIceServers(): IceServer[];
|
|
39
34
|
snapshot(data: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Camera } from '../../api/database/types.js';
|
|
2
|
-
import type { CameraConfig } from '../../camera/
|
|
2
|
+
import type { CameraConfig } from '../../camera/types.js';
|
|
3
3
|
import type { MessageQueue } from '../queue.js';
|
|
4
4
|
import type { DeviceManagerServerProxyMethods, ProxyMessageStructure } from '../types.js';
|
|
5
5
|
export declare class DeviceManagerProxy implements DeviceManagerServerProxyMethods {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { RUNTIME_STATUS } from '../services/config/types.js';
|
|
2
2
|
import type { ProxyAuth } from './types.js';
|
|
3
3
|
export declare class NatsServer {
|
|
4
|
-
readonly serverPort = 4222;
|
|
5
4
|
private readonly clusterAmount;
|
|
6
5
|
private readonly auth;
|
|
7
|
-
private
|
|
6
|
+
private _serverPort;
|
|
7
|
+
private _clusterPort;
|
|
8
8
|
private serverProcess?;
|
|
9
9
|
private clusterProcesses;
|
|
10
10
|
private logger;
|
|
@@ -15,6 +15,8 @@ export declare class NatsServer {
|
|
|
15
15
|
private shuttingDown;
|
|
16
16
|
private _status;
|
|
17
17
|
get status(): RUNTIME_STATUS;
|
|
18
|
+
get serverPort(): number;
|
|
19
|
+
get clusterPort(): number;
|
|
18
20
|
constructor(auth: ProxyAuth);
|
|
19
21
|
start(): Promise<void>;
|
|
20
22
|
private startServer;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Camera } from '../api/database/types.js';
|
|
2
|
-
import type { CameraDevice } from '../camera/
|
|
3
|
-
import type { CameraConfig, FfmpegOptions, PrebufferContainer, PrebufferState, SetValues, StateValues, StreamInfo } from '../camera/
|
|
4
|
-
import type { FrameMetadata } from '../decoder/types.js';
|
|
2
|
+
import type { CameraDevice } from '../camera/device.js';
|
|
3
|
+
import type { CameraConfig, FfmpegOptions, PrebufferContainer, PrebufferState, SetValues, StateValues, StreamInfo } from '../camera/types.js';
|
|
5
4
|
import type { BasePlugin } from '../plugins/base.js';
|
|
6
5
|
import type { CameraExtension } from '../plugins/types.js';
|
|
7
6
|
import type { CameraStorage } from '../polyglot/node/plugins/cameraStorage.js';
|
|
@@ -97,10 +96,6 @@ export interface CameraDeviceProxyMethods {
|
|
|
97
96
|
cameraId: string;
|
|
98
97
|
pluginId: string;
|
|
99
98
|
}): Promise<StreamInfo | undefined>;
|
|
100
|
-
getFrameMetadata(data: {
|
|
101
|
-
cameraId: string;
|
|
102
|
-
pluginId: string;
|
|
103
|
-
}): Promise<FrameMetadata>;
|
|
104
99
|
getFfmpegPath(data: {
|
|
105
100
|
cameraId: string;
|
|
106
101
|
pluginId: string;
|
|
@@ -152,7 +147,7 @@ export interface CameraDeviceProxyMethods {
|
|
|
152
147
|
export type CameraDeviceProxyMethodNames = MethodKeys<CameraDeviceProxyMethods>;
|
|
153
148
|
export interface DeviceManagerListenerMessagePayload {
|
|
154
149
|
type: keyof DeviceManagerProxyEventCallbacks;
|
|
155
|
-
data:
|
|
150
|
+
data: DeviceManagerProxyEvents['cameraSelected'] | DeviceManagerProxyEvents['cameraDeselected'] | DeviceManagerProxyEvents['cameraUpdated'];
|
|
156
151
|
}
|
|
157
152
|
export interface DeviceManagerProxyMethods {
|
|
158
153
|
getCameraByName(name: string): Promise<CameraDevice | undefined>;
|
|
@@ -173,12 +168,13 @@ export interface DeviceManagerProxyEvents {
|
|
|
173
168
|
};
|
|
174
169
|
cameraUpdated: {
|
|
175
170
|
camera: Camera;
|
|
171
|
+
extension: CameraExtension;
|
|
176
172
|
};
|
|
177
173
|
}
|
|
178
174
|
export interface DeviceManagerProxyEventCallbacks {
|
|
179
175
|
cameraSelected: (camera: CameraDevice, extension: CameraExtension) => void;
|
|
180
176
|
cameraDeselected: (cameraId: string, extension: CameraExtension) => void;
|
|
181
|
-
cameraUpdated: (cameraId: string,
|
|
177
|
+
cameraUpdated: (cameraId: string, extension: CameraExtension) => void;
|
|
182
178
|
}
|
|
183
179
|
export interface DeviceManagerProxyGenericEvent<K extends keyof DeviceManagerProxyEvents> {
|
|
184
180
|
type: K;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Namespace, Server } from 'socket.io';
|
|
2
2
|
import type { SocketNsp } from '../api/websocket/types.js';
|
|
3
|
-
import type { StateValues } from '../camera/
|
|
3
|
+
import type { StateValues } from '../camera/types.js';
|
|
4
4
|
import type { CameraDeviceListenerMessagePayload } from './types.js';
|
|
5
5
|
export declare class WebsocketProxy {
|
|
6
6
|
nsp: Namespace;
|
|
@@ -34,7 +34,7 @@ export declare class PluginAPI extends EventEmitter implements API {
|
|
|
34
34
|
readonly storagePath: string;
|
|
35
35
|
readonly configFile: string;
|
|
36
36
|
readonly plugin: BasePlugin;
|
|
37
|
-
constructor(plugin: Plugin, logger: PluginLogger, auth: {
|
|
37
|
+
constructor(plugin: Plugin, logger: PluginLogger, proxyPort: number, auth: {
|
|
38
38
|
user: string;
|
|
39
39
|
pass: string;
|
|
40
40
|
});
|