@camera.ui/browser 0.0.79 → 0.0.81
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/proxy/cameraDevice.d.ts +19 -3
- package/dist/types/packages/client/browser/src/proxy/deviceManager.d.ts +4 -0
- package/dist/types/packages/client/browser/src/socket.d.ts +2 -3
- package/dist/types/packages/client/browser/src/types.d.ts +0 -1
- package/dist/types/server/src/api/controllers/users.controller.d.ts +9 -3
- package/dist/types/server/src/api/database/index.d.ts +9 -2
- package/dist/types/server/src/api/database/types.d.ts +24 -23
- package/dist/types/server/src/api/go2rtc/api/streams.d.ts +2 -2
- package/dist/types/server/src/api/go2rtc/types.d.ts +5 -2
- package/dist/types/server/src/api/index.d.ts +6 -8
- package/dist/types/server/src/api/middlewares/pagination.middleware.d.ts +1 -1
- package/dist/types/server/src/api/plugins/logger.plugin.d.ts +7 -0
- package/dist/types/server/src/api/routes/index.d.ts +0 -1
- package/dist/types/server/src/api/schemas/backup.schema.d.ts +53 -155
- package/dist/types/server/src/api/schemas/cameras.schema.d.ts +215 -215
- package/dist/types/server/src/api/schemas/config.schema.d.ts +19 -22
- package/dist/types/server/src/api/schemas/go2rtc.schema.d.ts +66 -66
- package/dist/types/server/src/api/schemas/users.schema.d.ts +242 -136
- package/dist/types/server/src/api/services/cameras.service.d.ts +7 -7
- package/dist/types/server/src/api/services/users.service.d.ts +6 -2
- package/dist/types/server/src/api/types/index.d.ts +33 -11
- package/dist/types/server/src/api/websocket/nsp/status.d.ts +1 -1
- package/dist/types/server/src/camera/controller.d.ts +18 -10
- package/dist/types/server/src/camera/device.d.ts +5 -13
- package/dist/types/server/src/camera/index.d.ts +18 -10
- package/dist/types/server/src/camera/interfaces/audioDetection.d.ts +10 -0
- package/dist/types/server/src/camera/interfaces/camera.d.ts +10 -0
- package/dist/types/server/src/camera/interfaces/motionDetection.d.ts +10 -0
- package/dist/types/server/src/camera/interfaces/objectDetection.d.ts +10 -0
- package/dist/types/server/src/camera/interfaces/prebuffer.d.ts +11 -0
- package/dist/types/server/src/camera/interfaces/ptz.d.ts +13 -0
- package/dist/types/server/src/camera/streaming/webrtc-connection.d.ts +2 -1
- package/dist/types/server/src/camera/streaming/{streaming-session.d.ts → werift-session.d.ts} +1 -1
- package/dist/types/server/src/camera/types.d.ts +48 -15
- package/dist/types/server/src/decoder/worker.d.ts +1 -1
- package/dist/types/server/src/nats/index.d.ts +1 -1
- package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +23 -60
- package/dist/types/server/src/nats/proxy/deviceManager.d.ts +1 -1
- package/dist/types/server/src/nats/proxy/pluginsManager.d.ts +1 -1
- package/dist/types/server/src/nats/proxy/systemManager.d.ts +1 -1
- package/dist/types/server/src/nats/types.d.ts +14 -78
- package/dist/types/server/src/nats/websocket.d.ts +1 -5
- package/dist/types/server/src/plugins/base.d.ts +2 -3
- package/dist/types/server/src/plugins/types.d.ts +22 -5
- package/dist/types/server/src/plugins/worker.d.ts +1 -0
- package/dist/types/server/src/polyglot/node/plugins/proxy/cameraDevice.d.ts +29 -6
- package/dist/types/server/src/polyglot/node/plugins/proxy/deviceManager.d.ts +3 -3
- package/dist/types/server/src/polyglot/node/plugins/proxy/pluginsManager.d.ts +3 -3
- package/dist/types/server/src/polyglot/node/plugins/proxy/systemManager.d.ts +3 -3
- package/dist/types/server/src/polyglot/node/plugins/schema.d.ts +2 -1
- package/dist/types/server/src/services/config/index.d.ts +29 -36
- package/dist/types/server/src/services/config/types.d.ts +0 -1
- package/dist/types/server/src/types.d.ts +4 -0
- package/dist/types/shared/types/index.d.ts +5 -0
- package/package.json +10 -10
- package/dist/types/server/src/api/controllers/streams.controller.d.ts +0 -12
- package/dist/types/server/src/api/routes/streams.routes.d.ts +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Camera, CameraZone, DBCamera } from '../database/types.js';
|
|
1
|
+
import type { CameraExtension } from '../../plugins/types.js';
|
|
2
|
+
import type { Camera, CameraInputSettings, CameraZone, DBCamera } from '../database/types.js';
|
|
3
3
|
type DeepPartial<T> = T extends object ? {
|
|
4
4
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
5
5
|
} : T;
|
|
@@ -12,11 +12,10 @@ export declare class CamerasService {
|
|
|
12
12
|
private pluginsService;
|
|
13
13
|
constructor();
|
|
14
14
|
createCamera(cameraData: DBCamera): Promise<DBCamera>;
|
|
15
|
-
createTransformedCamera(cameraData: DBCamera): Promise<Camera>;
|
|
16
15
|
createZone(cameraname: string, zoneData: CameraZone): Promise<DBCamera | undefined>;
|
|
17
16
|
patchZoneByName(cameraname: string, zonename: string, zoneData: CameraZone): Promise<DBCamera | undefined>;
|
|
18
17
|
removeZoneByName(cameraname: string, zonename: string): Promise<void>;
|
|
19
|
-
createCameraSource(cameraname: string, sourceName: string,
|
|
18
|
+
createCameraSource(cameraname: string, sourceName: string, source: string): Promise<void>;
|
|
20
19
|
resetCameraSource(cameraname: string, sourceName: string): Promise<void>;
|
|
21
20
|
list(): DBCamera[];
|
|
22
21
|
listTransformed(): Camera[];
|
|
@@ -42,9 +41,10 @@ export declare class CamerasService {
|
|
|
42
41
|
removeByPluginIdAndName(cameraname: string, pluginId: string): Promise<void>;
|
|
43
42
|
removeAll(): Promise<void>;
|
|
44
43
|
transformCamera(camera: DBCamera): Camera;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
private
|
|
44
|
+
addCameraSources(cameraname: string, sources: CameraInputSettings[]): Promise<void>;
|
|
45
|
+
removeCameraSources(cameraname: string, sources: CameraInputSettings[]): Promise<void>;
|
|
46
|
+
private sourceExistAndEqual;
|
|
47
|
+
private sourceResetted;
|
|
48
48
|
private generateWsUrls;
|
|
49
49
|
private generateRTSPUrls;
|
|
50
50
|
private generateFFmpegUrls;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DBUser } from '../database/types.js';
|
|
1
|
+
import type { DBCamviewLayout, DBUser } from '../database/types.js';
|
|
2
2
|
export declare class UsersService {
|
|
3
3
|
private dbs;
|
|
4
4
|
constructor();
|
|
@@ -6,7 +6,11 @@ export declare class UsersService {
|
|
|
6
6
|
findById(id: string): DBUser | undefined;
|
|
7
7
|
findByName(username: string): DBUser | undefined;
|
|
8
8
|
list(): DBUser[];
|
|
9
|
-
patchUser(username: string, userData
|
|
9
|
+
patchUser(username: string, userData?: Partial<DBUser>): Promise<DBUser | undefined>;
|
|
10
10
|
removeByName(username: string): Promise<void>;
|
|
11
11
|
removeAll(): Promise<void>;
|
|
12
|
+
createView(username: string, viewData: DBCamviewLayout): Promise<DBCamviewLayout>;
|
|
13
|
+
patchViewById(username: string, viewId: string, viewData?: Partial<DBCamviewLayout>): Promise<DBCamviewLayout | undefined>;
|
|
14
|
+
removeViewById(username: string, viewId: string): Promise<DBCamviewLayout[] | undefined>;
|
|
15
|
+
removeAllViews(username: string): Promise<DBCamviewLayout[] | undefined>;
|
|
12
16
|
}
|
|
@@ -7,7 +7,7 @@ import type { RestoreBackupInput } from '../schemas/backup.schema.js';
|
|
|
7
7
|
import type { CreateCameraInput, PatchCameraInput, PreviewCameraInput } from '../schemas/cameras.schema.js';
|
|
8
8
|
import type { PatchConfigInput } from '../schemas/config.schema.js';
|
|
9
9
|
import type { PatchGo2RtcConfigInput } from '../schemas/go2rtc.schema.js';
|
|
10
|
-
import type { CreateUserInput, LoginUserInput, PatchUserInput } from '../schemas/users.schema.js';
|
|
10
|
+
import type { CreateUserInput, CreateViewInput, LoginUserInput, PatchUserInput, PatchViewInput } from '../schemas/users.schema.js';
|
|
11
11
|
export interface BusboyFileStream extends Readable {
|
|
12
12
|
truncated: boolean;
|
|
13
13
|
bytesRead: number;
|
|
@@ -114,6 +114,10 @@ export interface UsersResponse {
|
|
|
114
114
|
pagination: Pagination;
|
|
115
115
|
result: DBUser[];
|
|
116
116
|
}
|
|
117
|
+
export interface ViewsResponse {
|
|
118
|
+
pagination: Pagination;
|
|
119
|
+
result: DBCamviewLayout[];
|
|
120
|
+
}
|
|
117
121
|
export interface CamerasResponse {
|
|
118
122
|
pagination: Pagination;
|
|
119
123
|
result: DBCamera[];
|
|
@@ -340,16 +344,22 @@ export type UsersPatchRequest = {
|
|
|
340
344
|
avatar: string;
|
|
341
345
|
};
|
|
342
346
|
};
|
|
347
|
+
export type ViewsParamsRequest = {
|
|
348
|
+
Params: {
|
|
349
|
+
viewId: string;
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
export type ViewsInsertRequest = {
|
|
353
|
+
Body: CreateViewInput;
|
|
354
|
+
};
|
|
355
|
+
export type ViewsPatchRequest = {
|
|
356
|
+
Body: PatchViewInput;
|
|
357
|
+
};
|
|
343
358
|
export type BackupCreateRequest = {
|
|
344
359
|
Body: {
|
|
345
360
|
localStorage: Partial<UiLocalStorage>;
|
|
346
361
|
};
|
|
347
362
|
};
|
|
348
|
-
export type StreamsParamsNameRequest = {
|
|
349
|
-
Params: {
|
|
350
|
-
id: string;
|
|
351
|
-
};
|
|
352
|
-
};
|
|
353
363
|
export interface BackupInfo {
|
|
354
364
|
backupDirectory: string;
|
|
355
365
|
backupFile: string;
|
|
@@ -357,16 +367,28 @@ export interface BackupInfo {
|
|
|
357
367
|
}
|
|
358
368
|
export type SupportedLanguageAbbreviatons = 'de' | 'en';
|
|
359
369
|
export type SupportedThemes = 'light' | 'dark';
|
|
370
|
+
export interface ConfigSettings {
|
|
371
|
+
zoom: number;
|
|
372
|
+
}
|
|
373
|
+
export interface ConsoleSettings {
|
|
374
|
+
zoom: number;
|
|
375
|
+
}
|
|
376
|
+
export type CamviewSettingsLayoutMode = 'dnd' | 'view';
|
|
377
|
+
export interface CamviewSettings {
|
|
378
|
+
dragDisabled?: boolean;
|
|
379
|
+
viewId?: string;
|
|
380
|
+
}
|
|
381
|
+
export interface UiSettingsLocalStorage {
|
|
382
|
+
config: ConfigSettings;
|
|
383
|
+
console: ConsoleSettings;
|
|
384
|
+
camview: CamviewSettings;
|
|
385
|
+
}
|
|
360
386
|
export interface ThemeLocalStorage {
|
|
361
387
|
theme: SupportedThemes;
|
|
362
388
|
autoMode: boolean;
|
|
363
389
|
}
|
|
364
|
-
export interface CamviewLocalStorage {
|
|
365
|
-
currentLayout: DBCamviewLayout;
|
|
366
|
-
preferences: DBCamviewLayout[];
|
|
367
|
-
}
|
|
368
390
|
export interface UiLocalStorage {
|
|
369
|
-
|
|
391
|
+
ui: UiSettingsLocalStorage;
|
|
370
392
|
theme: ThemeLocalStorage;
|
|
371
393
|
locale: SupportedLanguageAbbreviatons;
|
|
372
394
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { RUNTIME_STATUS } from '../../../services/config/types.js';
|
|
1
2
|
import type { Namespace, Server, Socket } from 'socket.io';
|
|
2
3
|
import type { PLUGIN_STATUS } from '../../../plugins/types.js';
|
|
3
|
-
import { RUNTIME_STATUS } from '../../../services/config/types.js';
|
|
4
4
|
import type { SocketNsp } from '../types.js';
|
|
5
5
|
export declare class StatusNamespace {
|
|
6
6
|
nsp: Namespace;
|
|
@@ -1,29 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseCameraDevice } from './index.js';
|
|
2
|
+
import { CameraAudioDetectionInterface } from './interfaces/audioDetection.js';
|
|
3
|
+
import { CameraMotionDetectionInterface } from './interfaces/motionDetection.js';
|
|
4
|
+
import { CameraObjectDetectionInterface } from './interfaces/objectDetection.js';
|
|
5
|
+
import { CameraPrebufferInterface } from './interfaces/prebuffer.js';
|
|
6
|
+
import { CameraPTZInterface } from './interfaces/ptz.js';
|
|
2
7
|
import type { Camera } from '../api/database/types.js';
|
|
3
|
-
import type { MotionFrame, VideoFrame } from '../decoder/types.js';
|
|
4
8
|
import type { ProxyServer } from '../nats/index.js';
|
|
5
9
|
import type { IceServer } from '../services/config/types.js';
|
|
6
|
-
import type { BaseLogger, CameraSource, SetValues } from './types.js';
|
|
7
|
-
export declare class CameraController extends
|
|
8
|
-
|
|
10
|
+
import type { BaseLogger, CameraConfigInputSettings, CameraDelegate, CameraSource, SetValues } from './types.js';
|
|
11
|
+
export declare class CameraController extends BaseCameraDevice {
|
|
12
|
+
proxy: ProxyServer;
|
|
9
13
|
private motionTimeout?;
|
|
10
14
|
private objectTimeout?;
|
|
11
15
|
private objectTimeoutDuration;
|
|
12
16
|
private doorbellTimeout?;
|
|
13
17
|
private doorbellTimeoutDuration;
|
|
14
18
|
private prebufferStateSubscriptions;
|
|
19
|
+
cameraDelegate: CameraDelegate;
|
|
20
|
+
prebufferDelegate: CameraPrebufferInterface;
|
|
21
|
+
ptzDelegate: CameraPTZInterface;
|
|
22
|
+
audioDetectorDelegate: CameraAudioDetectionInterface;
|
|
23
|
+
motionDetectorDelegate: CameraMotionDetectionInterface;
|
|
24
|
+
objectDetectorDelegate: CameraObjectDetectionInterface;
|
|
15
25
|
get camera(): Camera;
|
|
16
26
|
get sources(): CameraSource[];
|
|
17
27
|
constructor(camera: Camera, logger: BaseLogger, proxy: ProxyServer);
|
|
18
28
|
connect(): Promise<void>;
|
|
19
29
|
disconnect(): Promise<void>;
|
|
20
|
-
reboot(): Promise<void>;
|
|
21
|
-
getFrames(): AsyncIterableIterator<VideoFrame>;
|
|
22
|
-
getMotionFrames(): AsyncIterableIterator<MotionFrame>;
|
|
23
|
-
getPrebufferedFrames(): AsyncIterableIterator<VideoFrame>;
|
|
24
|
-
getFfmpegPath(): Promise<string>;
|
|
25
30
|
getIceServers(): Promise<IceServer[]>;
|
|
26
31
|
updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T]): Promise<void>;
|
|
32
|
+
addCameraSource(source: CameraConfigInputSettings): Promise<void>;
|
|
33
|
+
updateCameraSource(sourceId: string, source: Partial<CameraConfigInputSettings>): Promise<void>;
|
|
34
|
+
removeCameraSource(sourceId: string): Promise<void>;
|
|
27
35
|
updateCamera(updatedCamera: Camera): void;
|
|
28
36
|
cleanup(): void;
|
|
29
37
|
private subscribeToCameraState;
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
import { BehaviorSubject } from 'rxjs';
|
|
2
2
|
import { BaseCameraDevice } from './index.js';
|
|
3
|
-
import {
|
|
3
|
+
import { WeriftSession } from './streaming/werift-session.js';
|
|
4
4
|
import type { Observable } from 'rxjs';
|
|
5
5
|
import type { MotionFrame, VideoFrame } from '../decoder/types.js';
|
|
6
6
|
import type { StreamingConnectionOptions } from './streaming/peer-connection.js';
|
|
7
|
-
import type {
|
|
7
|
+
import type { CameraDelegates, FrameState } from './types.js';
|
|
8
8
|
export declare abstract class CameraDevice extends BaseCameraDevice {
|
|
9
9
|
protected readonly frameState: BehaviorSubject<FrameState>;
|
|
10
10
|
protected readonly onFrame: Observable<FrameState>;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
set delegate(delegate: CameraDelegate);
|
|
15
|
-
get prebufferDelegate(): CameraPrebufferDelegate | undefined;
|
|
16
|
-
set prebufferDelegate(delegate: CameraPrebufferDelegate);
|
|
11
|
+
abstract setDelegate<T extends keyof CameraDelegates>(name: T, delegate: CameraDelegates[T]): void;
|
|
12
|
+
createSession(sourceName: string, options?: StreamingConnectionOptions): Promise<WeriftSession>;
|
|
13
|
+
removeAllListeners(): void;
|
|
17
14
|
abstract getFrames(prebufferDuration?: number): AsyncIterableIterator<VideoFrame>;
|
|
18
15
|
abstract getMotionFrames(): AsyncIterableIterator<MotionFrame>;
|
|
19
16
|
abstract getFfmpegPath(): Promise<string>;
|
|
20
|
-
snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
|
|
21
|
-
createSession(sourceName: string, options?: StreamingConnectionOptions): Promise<StreamingSession>;
|
|
22
|
-
streamVideo(sourceName: string, options: FfmpegOptions): Promise<StreamingSession>;
|
|
23
|
-
recordToFile(sourceName: string, outputPath: string, duration?: number): Promise<void>;
|
|
24
|
-
removeAllListeners(): void;
|
|
25
17
|
private createMotionFrameObservable;
|
|
26
18
|
}
|
|
@@ -4,7 +4,7 @@ import type { Observable, Subscription } from 'rxjs';
|
|
|
4
4
|
import type { Camera, CameraActivitySettings, CameraFrameWorkerSettings, CameraInformation, CameraType } from '../api/database/types.js';
|
|
5
5
|
import type { VideoFrame } from '../decoder/types.js';
|
|
6
6
|
import type { IceServer } from '../services/config/types.js';
|
|
7
|
-
import type { AudioSetEvent, AudioState, BaseLogger, BatterySetEvent, BatteryState, CameraSource, Container, DetectionZone, DoorbellSetEvent, DoorbellState, LightSetEvent, LightState, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, PrebufferState, SetValues, Sets, SirenSetEvent, SirenState, StateValues, States } from './types.js';
|
|
7
|
+
import type { AudioSetEvent, AudioState, BaseLogger, BatterySetEvent, BatteryState, CameraAudioDetectionDelegate, CameraConfigInputSettings, CameraDelegate, CameraMotionDetectionDelegate, CameraObjectDetectionDelegate, CameraPTZDelegate, CameraPrebufferDelegate, CameraSource, Container, DetectionZone, DoorbellSetEvent, DoorbellState, LightSetEvent, LightState, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, PrebufferState, SetValues, Sets, SirenSetEvent, SirenState, StateValues, States } from './types.js';
|
|
8
8
|
declare class Subscribed {
|
|
9
9
|
private readonly subscriptions;
|
|
10
10
|
private readonly additionalSubscriptions;
|
|
@@ -38,6 +38,13 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
38
38
|
readonly onDoorbellPressed: Observable<DoorbellState>;
|
|
39
39
|
readonly onSirenDetected: Observable<SirenState>;
|
|
40
40
|
readonly onBatteryChanged: Observable<BatteryState>;
|
|
41
|
+
abstract cameraDelegate: CameraDelegate;
|
|
42
|
+
abstract prebufferDelegate: CameraPrebufferDelegate;
|
|
43
|
+
abstract ptzDelegate: CameraPTZDelegate;
|
|
44
|
+
abstract motionDetectorDelegate: CameraMotionDetectionDelegate;
|
|
45
|
+
abstract audioDetectorDelegate: CameraAudioDetectionDelegate;
|
|
46
|
+
abstract objectDetectorDelegate: CameraObjectDetectionDelegate;
|
|
47
|
+
protected get cameraObject(): Camera;
|
|
41
48
|
get id(): string;
|
|
42
49
|
get nativeId(): string | undefined;
|
|
43
50
|
get pluginId(): string;
|
|
@@ -56,7 +63,6 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
56
63
|
get hasObjectDetector(): boolean;
|
|
57
64
|
get hasPtz(): boolean;
|
|
58
65
|
get hasPrebuffer(): boolean;
|
|
59
|
-
get hasIntercom(): boolean;
|
|
60
66
|
get activityZones(): DetectionZone[];
|
|
61
67
|
get activitySettings(): CameraActivitySettings;
|
|
62
68
|
get frameWorkerSettings(): CameraFrameWorkerSettings;
|
|
@@ -66,13 +72,15 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
66
72
|
get recordingSource(): CameraSource;
|
|
67
73
|
get detectionSource(): CameraSource;
|
|
68
74
|
constructor(camera: Camera, logger: BaseLogger);
|
|
75
|
+
getValue<T extends keyof StateValues>(stateName: T): StateValues[T];
|
|
76
|
+
snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
|
|
77
|
+
onStateChange<T extends keyof StateValues>(stateName: T): Observable<{
|
|
78
|
+
newState: StateValues[T];
|
|
79
|
+
oldState: StateValues[T];
|
|
80
|
+
}>;
|
|
69
81
|
abstract connect(): Promise<void>;
|
|
70
82
|
abstract disconnect(): Promise<void>;
|
|
71
|
-
abstract reboot(): Promise<void>;
|
|
72
|
-
abstract snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
|
|
73
83
|
abstract getIceServers(): Promise<IceServer[]>;
|
|
74
|
-
protected abstract cleanup(): void;
|
|
75
|
-
getValue<T extends keyof StateValues>(stateName: T): StateValues[T];
|
|
76
84
|
abstract updateState(stateName: 'light', eventData: LightSetEvent): Promise<void>;
|
|
77
85
|
abstract updateState(stateName: 'motion', eventData: MotionSetEvent, frame?: VideoFrame): Promise<void>;
|
|
78
86
|
abstract updateState(stateName: 'audio', eventData: AudioSetEvent): Promise<void>;
|
|
@@ -80,11 +88,11 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
80
88
|
abstract updateState(stateName: 'doorbell', eventData: DoorbellSetEvent): Promise<void>;
|
|
81
89
|
abstract updateState(stateName: 'siren', eventData: SirenSetEvent): Promise<void>;
|
|
82
90
|
abstract updateState(stateName: 'battery', eventData: BatterySetEvent): Promise<void>;
|
|
91
|
+
abstract addCameraSource(source: CameraConfigInputSettings): Promise<void>;
|
|
92
|
+
abstract updateCameraSource(sourceId: string, source: Partial<CameraConfigInputSettings>): Promise<void>;
|
|
93
|
+
abstract removeCameraSource(sourceId: string): Promise<void>;
|
|
94
|
+
protected abstract cleanup(): void;
|
|
83
95
|
protected updateStateInternal<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], skipCheck?: boolean): void;
|
|
84
|
-
onStateChange<T extends keyof StateValues>(stateName: T): Observable<{
|
|
85
|
-
newState: StateValues[T];
|
|
86
|
-
oldState: StateValues[T];
|
|
87
|
-
}>;
|
|
88
96
|
onPropertyChange<T extends keyof Camera>(property: T | T[]): Observable<{
|
|
89
97
|
property: T;
|
|
90
98
|
oldData: Camera[T];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CameraAudioDetectionDelegate } from '../types.js';
|
|
2
|
+
import type { BaseLogger } from '../types.js';
|
|
3
|
+
export declare class CameraAudioDetectionInterface extends CameraAudioDetectionDelegate {
|
|
4
|
+
delegate?: CameraAudioDetectionDelegate;
|
|
5
|
+
private onRequest;
|
|
6
|
+
private logger;
|
|
7
|
+
constructor(onRequest: (client: any, fn: string, args?: any[], timeout?: number) => Promise<any>, logger: BaseLogger);
|
|
8
|
+
detectAudio(audio: Buffer): Promise<boolean>;
|
|
9
|
+
private _onRequest;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CameraDelegate } from '../types.js';
|
|
2
|
+
import type { BaseLogger } from '../types.js';
|
|
3
|
+
export declare class CameraInterface extends CameraDelegate {
|
|
4
|
+
delegate?: CameraDelegate;
|
|
5
|
+
private onRequest;
|
|
6
|
+
private logger;
|
|
7
|
+
constructor(onRequest: (client: any, fn: string, args?: any[], timeout?: number) => Promise<any>, logger: BaseLogger);
|
|
8
|
+
reboot(): Promise<void>;
|
|
9
|
+
private _onRequest;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CameraMotionDetectionDelegate } from '../types.js';
|
|
2
|
+
import type { BaseLogger, Detection } from '../types.js';
|
|
3
|
+
export declare class CameraMotionDetectionInterface extends CameraMotionDetectionDelegate {
|
|
4
|
+
delegate?: CameraMotionDetectionDelegate;
|
|
5
|
+
private onRequest;
|
|
6
|
+
private logger;
|
|
7
|
+
constructor(onRequest: (client: any, fn: string, args?: any[], timeout?: number) => Promise<any>, logger: BaseLogger);
|
|
8
|
+
detectImage(image: Buffer): Promise<Detection[]>;
|
|
9
|
+
private _onRequest;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CameraObjectDetectionDelegate } from '../types.js';
|
|
2
|
+
import type { BaseLogger, Detection } from '../types.js';
|
|
3
|
+
export declare class CameraObjectDetectionInterface extends CameraObjectDetectionDelegate {
|
|
4
|
+
delegate?: CameraObjectDetectionDelegate;
|
|
5
|
+
private onRequest;
|
|
6
|
+
private logger;
|
|
7
|
+
constructor(onRequest: (client: any, fn: string, args?: any[], timeout?: number) => Promise<any>, logger: BaseLogger);
|
|
8
|
+
detectImage(image: Buffer): Promise<Detection[]>;
|
|
9
|
+
private _onRequest;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CameraPrebufferDelegate } from '../types.js';
|
|
2
|
+
import type { BaseLogger, Container, PrebufferState, StreamInfo } from '../types.js';
|
|
3
|
+
export declare class CameraPrebufferInterface extends CameraPrebufferDelegate {
|
|
4
|
+
delegate?: CameraPrebufferDelegate;
|
|
5
|
+
private onRequest;
|
|
6
|
+
private logger;
|
|
7
|
+
constructor(onRequest: (client: any, fn: string, args?: any[], timeout?: number) => Promise<any>, logger: BaseLogger);
|
|
8
|
+
getStreamInfo(sourceName: string): Promise<StreamInfo | undefined>;
|
|
9
|
+
updatePrebufferState(sourceId: string, container: Container, state: PrebufferState): Promise<void>;
|
|
10
|
+
private _onRequest;
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CameraPTZDelegate } from '../types.js';
|
|
2
|
+
import type { BaseLogger } from '../types.js';
|
|
3
|
+
export declare class CameraPTZInterface extends CameraPTZDelegate {
|
|
4
|
+
delegate?: CameraPTZDelegate;
|
|
5
|
+
private onRequest;
|
|
6
|
+
private logger;
|
|
7
|
+
constructor(onRequest: (client: any, fn: string, args?: any[], timeout?: number) => Promise<any>, logger: BaseLogger);
|
|
8
|
+
moveAbsolute(pan: number, tilt: number, zoom: number): Promise<void>;
|
|
9
|
+
moveRelative(pan: number, tilt: number, zoom: number): Promise<void>;
|
|
10
|
+
moveContinuous(pan: number, tilt: number, zoom: number): Promise<void>;
|
|
11
|
+
stop(): Promise<void>;
|
|
12
|
+
private _onRequest;
|
|
13
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ReplaySubject, Subject
|
|
1
|
+
import { ReplaySubject, Subject } from 'rxjs';
|
|
2
2
|
import { Subscribed } from '../../utils/subscribed.js';
|
|
3
|
+
import type { Observable } from 'rxjs';
|
|
3
4
|
import type { RtpPacket } from 'werift';
|
|
4
5
|
import type { IceServer } from '../../services/config/types.js';
|
|
5
6
|
import type { CameraDevice } from '../device.js';
|
package/dist/types/server/src/camera/streaming/{streaming-session.d.ts → werift-session.d.ts}
RENAMED
|
@@ -4,7 +4,7 @@ import { Subscribed } from '../../utils/subscribed.js';
|
|
|
4
4
|
import type { CameraDevice } from '../device.js';
|
|
5
5
|
import type { BaseLogger, FfmpegOptions, SpawnInput } from '../types.js';
|
|
6
6
|
import type { WebrtcConnection } from './webrtc-connection.js';
|
|
7
|
-
export declare class
|
|
7
|
+
export declare class WeriftSession extends Subscribed {
|
|
8
8
|
readonly onCallEnded: ReplaySubject<void>;
|
|
9
9
|
readonly onVideoRtp: Subject<RtpPacket>;
|
|
10
10
|
readonly onAudioRtp: Subject<RtpPacket>;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { Observable } from 'rxjs';
|
|
2
2
|
import type { CameraInformation, CameraInput, CameraInputSettings, Point, ZoneFilter, ZoneType } from '../api/database/types.js';
|
|
3
3
|
import type { FrameData, FrameMetadata } from '../decoder/types.js';
|
|
4
|
+
import type { CameraAudioDetectionInterface } from './interfaces/audioDetection.js';
|
|
5
|
+
import type { CameraInterface } from './interfaces/camera.js';
|
|
6
|
+
import type { CameraMotionDetectionInterface } from './interfaces/motionDetection.js';
|
|
7
|
+
import type { CameraObjectDetectionInterface } from './interfaces/objectDetection.js';
|
|
8
|
+
import type { CameraPrebufferInterface } from './interfaces/prebuffer.js';
|
|
9
|
+
import type { CameraPTZInterface } from './interfaces/ptz.js';
|
|
4
10
|
export interface BaseLogger {
|
|
5
11
|
log: (...args: any[]) => void;
|
|
6
12
|
error: (...args: any[]) => void;
|
|
@@ -35,16 +41,6 @@ export interface CameraSource extends CameraInput {
|
|
|
35
41
|
onPrebuffering(container: Container): Observable<PrebufferState>;
|
|
36
42
|
getStreamInfo(): Promise<StreamInfo | undefined>;
|
|
37
43
|
}
|
|
38
|
-
export interface CameraPrebufferDelegate {
|
|
39
|
-
getStreamInfo(sourceName: string): Promise<StreamInfo | undefined>;
|
|
40
|
-
}
|
|
41
|
-
export interface CameraDelegate {
|
|
42
|
-
snapshotRequest(requestId: string): Promise<Buffer>;
|
|
43
|
-
prepareStream(requestId: string): Promise<void>;
|
|
44
|
-
onOffer(requestId: string, sdp: string): Promise<string>;
|
|
45
|
-
onCandidates(requestId: string, candidates: string): Promise<void>;
|
|
46
|
-
reboot(): Promise<void>;
|
|
47
|
-
}
|
|
48
44
|
export interface StreamInfo {
|
|
49
45
|
audio: AudioStreamOptions;
|
|
50
46
|
video: VideoStreamOptions;
|
|
@@ -94,11 +90,11 @@ export interface BaseCameraConfig {
|
|
|
94
90
|
disabled?: boolean;
|
|
95
91
|
info?: Partial<CameraInformation>;
|
|
96
92
|
}
|
|
97
|
-
export
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
93
|
+
export interface CameraConfigInputSettings extends Omit<CameraInputSettings, '_id'> {
|
|
94
|
+
}
|
|
95
|
+
export type CameraConfig = BaseCameraConfig & {
|
|
96
|
+
sources: CameraConfigInputSettings[];
|
|
97
|
+
};
|
|
102
98
|
export interface Detection {
|
|
103
99
|
id?: string;
|
|
104
100
|
label: ObjectClass;
|
|
@@ -185,3 +181,40 @@ export type CameraStateCallbacks = {
|
|
|
185
181
|
export type StateValue<T extends keyof StateValues> = StateValues[T];
|
|
186
182
|
export type SetValue<T extends keyof SetValues> = SetValues[T];
|
|
187
183
|
export type OnChangeCallback<T extends keyof StateValues> = (newEvent: StateValues[T], oldEvent: StateValues[T]) => void;
|
|
184
|
+
export declare abstract class CameraDelegate {
|
|
185
|
+
abstract reboot(): Promise<void>;
|
|
186
|
+
}
|
|
187
|
+
export declare abstract class CameraPrebufferDelegate {
|
|
188
|
+
abstract getStreamInfo(sourceName: string): Promise<StreamInfo | undefined>;
|
|
189
|
+
}
|
|
190
|
+
export declare abstract class CameraPTZDelegate {
|
|
191
|
+
abstract moveAbsolute(pan: number, tilt: number, zoom: number): Promise<void>;
|
|
192
|
+
abstract moveRelative(pan: number, tilt: number, zoom: number): Promise<void>;
|
|
193
|
+
abstract moveContinuous(pan: number, tilt: number, zoom: number): Promise<void>;
|
|
194
|
+
abstract stop(): Promise<void>;
|
|
195
|
+
}
|
|
196
|
+
export declare abstract class CameraMotionDetectionDelegate {
|
|
197
|
+
abstract detectImage(image: Buffer): Promise<Detection[]>;
|
|
198
|
+
}
|
|
199
|
+
export declare abstract class CameraObjectDetectionDelegate {
|
|
200
|
+
abstract detectImage(image: Buffer): Promise<Detection[]>;
|
|
201
|
+
}
|
|
202
|
+
export declare abstract class CameraAudioDetectionDelegate {
|
|
203
|
+
abstract detectAudio(audio: Buffer): Promise<boolean>;
|
|
204
|
+
}
|
|
205
|
+
export interface CameraInterfaces {
|
|
206
|
+
readonly cameraDelegate: CameraInterface;
|
|
207
|
+
readonly prebufferDelegate: CameraPrebufferInterface;
|
|
208
|
+
readonly ptzDelegate: CameraPTZInterface;
|
|
209
|
+
readonly motionDetectorDelegate: CameraMotionDetectionInterface;
|
|
210
|
+
readonly objectDetectorDelegate: CameraObjectDetectionInterface;
|
|
211
|
+
readonly audioDetectorDelegate: CameraAudioDetectionInterface;
|
|
212
|
+
}
|
|
213
|
+
export interface CameraDelegates {
|
|
214
|
+
readonly cameraDelegate: CameraDelegate;
|
|
215
|
+
readonly prebufferDelegate: CameraPrebufferDelegate;
|
|
216
|
+
readonly ptzDelegate: CameraPTZDelegate;
|
|
217
|
+
readonly motionDetectorDelegate: CameraMotionDetectionDelegate;
|
|
218
|
+
readonly objectDetectorDelegate: CameraObjectDetectionDelegate;
|
|
219
|
+
readonly audioDetectorDelegate: CameraAudioDetectionDelegate;
|
|
220
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { PLUGIN_STATUS } from '../plugins/types.js';
|
|
1
2
|
import { Subscribed } from '../utils/subscribed.js';
|
|
2
3
|
import type { CameraController } from '../camera/controller.js';
|
|
3
|
-
import { PLUGIN_STATUS } from '../plugins/types.js';
|
|
4
4
|
export declare class FrameWorker extends Subscribed {
|
|
5
5
|
token: string;
|
|
6
6
|
name: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type NatsConnection, type Subscription } from 'nats';
|
|
2
1
|
import { CameraDeviceProxy } from './proxy/cameraDevice.js';
|
|
3
2
|
import { DeviceManagerProxy, PluginsManagerProxy, SystemManagerProxy } from './proxy/index.js';
|
|
4
3
|
import { NatsServer } from './server.js';
|
|
4
|
+
import type { NatsConnection, Subscription } from 'nats';
|
|
5
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';
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { Camera } from '../../api/database/types.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CameraAudioDetectionInterface } from '../../camera/interfaces/audioDetection.js';
|
|
3
|
+
import type { CameraInterface } from '../../camera/interfaces/camera.js';
|
|
4
|
+
import type { CameraMotionDetectionInterface } from '../../camera/interfaces/motionDetection.js';
|
|
5
|
+
import type { CameraObjectDetectionInterface } from '../../camera/interfaces/objectDetection.js';
|
|
6
|
+
import type { CameraPrebufferInterface } from '../../camera/interfaces/prebuffer.js';
|
|
7
|
+
import type { CameraPTZInterface } from '../../camera/interfaces/ptz.js';
|
|
8
|
+
import type { CameraConfigInputSettings, Container, PrebufferState, SetValues, StateValues } from '../../camera/types.js';
|
|
3
9
|
import type { IceServer } from '../../services/config/types.js';
|
|
10
|
+
import type { MethodKeys, MethodType } from '../../types.js';
|
|
4
11
|
import type { MessageQueue } from '../queue.js';
|
|
5
12
|
import type { CameraDeviceProxyMethods, ProxyMessageStructure } from '../types.js';
|
|
6
13
|
export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
|
|
@@ -10,69 +17,25 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
|
|
|
10
17
|
private pluginsService;
|
|
11
18
|
private messageQueue;
|
|
12
19
|
constructor(messageQueue: MessageQueue);
|
|
13
|
-
connect(
|
|
14
|
-
|
|
15
|
-
pluginId: string;
|
|
16
|
-
}): void;
|
|
17
|
-
disconnect(data: {
|
|
18
|
-
cameraId: string;
|
|
19
|
-
pluginId: string;
|
|
20
|
-
}): void;
|
|
21
|
-
reboot(data: {
|
|
22
|
-
cameraId: string;
|
|
23
|
-
pluginId: string;
|
|
24
|
-
}): Promise<void>;
|
|
25
|
-
getStreamInfo(data: {
|
|
26
|
-
sourceName: string;
|
|
27
|
-
cameraId: string;
|
|
28
|
-
pluginId: string;
|
|
29
|
-
}): Promise<StreamInfo | undefined>;
|
|
20
|
+
connect(cameraId: string): void;
|
|
21
|
+
disconnect(cameraId: string): void;
|
|
30
22
|
getFfmpegPath(): string;
|
|
31
23
|
getIceServers(): IceServer[];
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
sourceName: string;
|
|
39
|
-
options: FfmpegOptions;
|
|
40
|
-
cameraId: string;
|
|
41
|
-
pluginId: string;
|
|
42
|
-
}): Promise<void>;
|
|
43
|
-
recordToFile(data: {
|
|
44
|
-
sourceName: string;
|
|
45
|
-
outputPath: string;
|
|
46
|
-
duration?: number;
|
|
47
|
-
cameraId: string;
|
|
48
|
-
pluginId: string;
|
|
49
|
-
}): Promise<void>;
|
|
50
|
-
updateState<T extends keyof SetValues>(data: {
|
|
51
|
-
stateName: T;
|
|
52
|
-
eventData: SetValues[T];
|
|
53
|
-
cameraId: string;
|
|
54
|
-
pluginId: string;
|
|
55
|
-
}): Promise<void>;
|
|
56
|
-
updatePrebufferState(data: {
|
|
57
|
-
sourceId: string;
|
|
58
|
-
container: Container;
|
|
59
|
-
state: PrebufferState;
|
|
60
|
-
cameraId: string;
|
|
61
|
-
pluginId: string;
|
|
62
|
-
}): Promise<void>;
|
|
63
|
-
refreshStates(data: {
|
|
64
|
-
cameraId: string;
|
|
65
|
-
pluginId: string;
|
|
66
|
-
}): {
|
|
24
|
+
updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], cameraId: string): Promise<void>;
|
|
25
|
+
updatePrebufferState(sourceId: string, container: Container, state: PrebufferState, cameraId: string, pluginId: string): Promise<void>;
|
|
26
|
+
addCameraSource(source: CameraConfigInputSettings, cameraId: string, pluginId: string): Promise<void>;
|
|
27
|
+
updateCameraSource(id: string, source: Partial<CameraConfigInputSettings>, cameraId: string, pluginId: string): Promise<void>;
|
|
28
|
+
removeCameraSource(id: string, cameraId: string, pluginId: string): Promise<void>;
|
|
29
|
+
refreshStates(cameraId: string): {
|
|
67
30
|
camera: Camera;
|
|
68
31
|
states: StateValues;
|
|
69
32
|
cameraState: boolean;
|
|
70
33
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
handleMessage(message: ProxyMessageStructure): Promise<void>;
|
|
34
|
+
onRequest<T extends MethodKeys<CameraInterface>>(delegateType: 'cameraDelegate', cameraId: string, fn: T, ...args: Parameters<MethodType<CameraInterface, T>>): Promise<ReturnType<MethodType<CameraInterface, T>>>;
|
|
35
|
+
onRequest<T extends MethodKeys<CameraPrebufferInterface>>(delegateType: 'prebufferDelegate', cameraId: string, fn: T, ...args: Parameters<MethodType<CameraPrebufferInterface, T>>): Promise<ReturnType<MethodType<CameraPrebufferInterface, T>>>;
|
|
36
|
+
onRequest<T extends MethodKeys<CameraPTZInterface>>(delegateType: 'ptzDelegate', cameraId: string, fn: T, ...args: Parameters<MethodType<CameraPTZInterface, T>>): Promise<ReturnType<MethodType<CameraPTZInterface, T>>>;
|
|
37
|
+
onRequest<T extends MethodKeys<CameraMotionDetectionInterface>>(delegateType: 'motionDetectorDelegate', cameraId: string, fn: T, ...args: Parameters<MethodType<CameraMotionDetectionInterface, T>>): Promise<ReturnType<MethodType<CameraMotionDetectionInterface, T>>>;
|
|
38
|
+
onRequest<T extends MethodKeys<CameraObjectDetectionInterface>>(delegateType: 'objectDetectorDelegate', cameraId: string, fn: T, ...args: Parameters<MethodType<CameraObjectDetectionInterface, T>>): Promise<ReturnType<MethodType<CameraObjectDetectionInterface, T>>>;
|
|
39
|
+
onRequest<T extends MethodKeys<CameraAudioDetectionInterface>>(delegateType: 'audioDetectorDelegate', cameraId: string, fn: T, ...args: Parameters<MethodType<CameraAudioDetectionInterface, T>>): Promise<ReturnType<MethodType<CameraAudioDetectionInterface, T>>>;
|
|
40
|
+
handleMessage(message: ProxyMessageStructure): Promise<void | ProxyMessageStructure>;
|
|
78
41
|
}
|
|
@@ -27,5 +27,5 @@ export declare class DeviceManagerProxy implements DeviceManagerServerProxyMetho
|
|
|
27
27
|
id: string;
|
|
28
28
|
pluginId: string;
|
|
29
29
|
}): Promise<void>;
|
|
30
|
-
handleMessage(message: ProxyMessageStructure): Promise<void>;
|
|
30
|
+
handleMessage(message: ProxyMessageStructure): Promise<void | ProxyMessageStructure>;
|
|
31
31
|
}
|
|
@@ -8,5 +8,5 @@ export declare class PluginsManagerProxy implements PluginsManagerServerProxyMet
|
|
|
8
8
|
constructor(messageQueue: MessageQueue);
|
|
9
9
|
onRequestPluginFn<K extends keyof CallablePluginMethods>(pluginId: string, fn: K, ...args: Parameters<BasePlugin[K]>): Promise<ReturnType<BasePlugin[K]>>;
|
|
10
10
|
onRequestStorageFn<K extends keyof CallablePluginStorageMethods>(pluginId: string, cameraId: string, fn: K, ...args: Parameters<CameraStorage[K]>): Promise<Awaited<ReturnType<CameraStorage[K]>>>;
|
|
11
|
-
handleMessage(message: ProxyMessageStructure): Promise<void>;
|
|
11
|
+
handleMessage(message: ProxyMessageStructure): Promise<void | ProxyMessageStructure>;
|
|
12
12
|
}
|
|
@@ -4,5 +4,5 @@ export declare class SystemManagerProxy implements SystemManagerServerProxyMetho
|
|
|
4
4
|
private pluginsService;
|
|
5
5
|
private messageQueue;
|
|
6
6
|
constructor(messageQueue: MessageQueue);
|
|
7
|
-
handleMessage(message: ProxyMessageStructure): Promise<void>;
|
|
7
|
+
handleMessage(message: ProxyMessageStructure): Promise<void | ProxyMessageStructure>;
|
|
8
8
|
}
|