@camera.ui/browser 0.0.81 → 0.0.82
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/client.d.ts +1 -7
- package/dist/types/packages/client/browser/src/proxy/cameraDevice.d.ts +1 -7
- package/dist/types/packages/client/browser/src/proxy/index.d.ts +0 -2
- package/dist/types/packages/client/browser/src/streaming/go2rts-session.d.ts +2 -0
- package/dist/types/server/src/api/controllers/cameras.controller.d.ts +2 -1
- package/dist/types/server/src/api/controllers/plugins.controller.d.ts +6 -1
- package/dist/types/server/src/api/controllers/users.controller.d.ts +8 -1
- package/dist/types/server/src/api/database/index.d.ts +11 -8
- package/dist/types/server/src/api/database/migration.d.ts +12 -0
- package/dist/types/server/src/api/database/types.d.ts +22 -2
- package/dist/types/server/src/api/schemas/backup.schema.d.ts +15 -15
- package/dist/types/server/src/api/schemas/cameras.schema.d.ts +79 -79
- package/dist/types/server/src/api/schemas/config.schema.d.ts +11 -11
- package/dist/types/server/src/api/schemas/go2rtc.schema.d.ts +60 -60
- package/dist/types/server/src/api/schemas/plugins.schema.d.ts +50 -0
- package/dist/types/server/src/api/schemas/users.schema.d.ts +499 -112
- package/dist/types/server/src/api/services/backup.service.d.ts +2 -1
- package/dist/types/server/src/api/services/cameras.service.d.ts +0 -1
- package/dist/types/server/src/api/services/users.service.d.ts +12 -3
- package/dist/types/server/src/api/types/index.d.ts +40 -29
- package/dist/types/server/src/api/utils/parse.d.ts +2 -0
- package/dist/types/server/src/api.d.ts +1 -1
- package/dist/types/server/src/camera/controller.d.ts +2 -7
- package/dist/types/server/src/camera/index.d.ts +6 -8
- package/dist/types/server/src/camera/interfaces/camera.d.ts +1 -0
- package/dist/types/server/src/camera/types.d.ts +1 -18
- package/dist/types/server/src/decoder/types.d.ts +10 -1
- package/dist/types/server/src/nats/index.d.ts +7 -6
- package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +8 -19
- package/dist/types/server/src/nats/proxy/deviceManager.d.ts +6 -21
- package/dist/types/server/src/nats/proxy/index.d.ts +0 -2
- package/dist/types/server/src/nats/types.d.ts +33 -76
- package/dist/types/server/src/plugins/interfaces/audioDetection.d.ts +7 -0
- package/dist/types/server/src/plugins/{base.d.ts → interfaces/base.d.ts} +2 -2
- package/dist/types/server/src/plugins/interfaces/motionDetection.d.ts +6 -0
- package/dist/types/server/src/plugins/interfaces/objectDetection.d.ts +7 -0
- package/dist/types/server/src/plugins/types.d.ts +12 -5
- package/dist/types/server/src/polyglot/node/plugins/api.d.ts +2 -6
- package/dist/types/server/src/polyglot/node/plugins/proxy/cameraDevice.d.ts +4 -15
- package/dist/types/server/src/polyglot/node/plugins/proxy/index.d.ts +0 -2
- package/dist/types/server/src/polyglot/node/plugins/schema.d.ts +14 -10
- package/dist/types/server/src/utils/utils.d.ts +1 -2
- package/package.json +3 -3
- package/dist/types/packages/client/browser/src/proxy/pluginsManager.d.ts +0 -10
- package/dist/types/packages/client/browser/src/proxy/systemManager.d.ts +0 -10
- package/dist/types/server/src/camera/interfaces/audioDetection.d.ts +0 -10
- package/dist/types/server/src/camera/interfaces/motionDetection.d.ts +0 -10
- package/dist/types/server/src/camera/interfaces/objectDetection.d.ts +0 -10
- package/dist/types/server/src/nats/proxy/pluginsManager.d.ts +0 -12
- package/dist/types/server/src/nats/proxy/systemManager.d.ts +0 -8
- package/dist/types/server/src/polyglot/node/plugins/proxy/pluginsManager.d.ts +0 -39
- package/dist/types/server/src/polyglot/node/plugins/proxy/systemManager.d.ts +0 -37
- /package/dist/types/server/src/nats/{queue.d.ts → messageQueue.d.ts} +0 -0
- /package/dist/types/server/src/polyglot/node/plugins/proxy/{queue.d.ts → messageQueue.d.ts} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MultipartFile } from '@fastify/multipart';
|
|
2
|
+
import type { BackupInfo, UiLocalStorage } from '../types/index.js';
|
|
2
3
|
export declare class BackupService {
|
|
3
4
|
private logger;
|
|
4
5
|
private configService;
|
|
@@ -16,7 +16,6 @@ export declare class CamerasService {
|
|
|
16
16
|
patchZoneByName(cameraname: string, zonename: string, zoneData: CameraZone): Promise<DBCamera | undefined>;
|
|
17
17
|
removeZoneByName(cameraname: string, zonename: string): Promise<void>;
|
|
18
18
|
createCameraSource(cameraname: string, sourceName: string, source: string): Promise<void>;
|
|
19
|
-
resetCameraSource(cameraname: string, sourceName: string): Promise<void>;
|
|
20
19
|
list(): DBCamera[];
|
|
21
20
|
listTransformed(): Camera[];
|
|
22
21
|
listByPluginId(pluginId: string): DBCamera[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DBCamviewLayout, DBUser } from '../database/types.js';
|
|
1
|
+
import type { DBCameraShortcut, DBCamviewLayout, DBUser } from '../database/types.js';
|
|
2
2
|
export declare class UsersService {
|
|
3
3
|
private dbs;
|
|
4
4
|
constructor();
|
|
@@ -9,8 +9,17 @@ export declare class UsersService {
|
|
|
9
9
|
patchUser(username: string, userData?: Partial<DBUser>): Promise<DBUser | undefined>;
|
|
10
10
|
removeByName(username: string): Promise<void>;
|
|
11
11
|
removeAll(): Promise<void>;
|
|
12
|
+
createShortcut(username: string, cameraId: string, shortcutData: DBCameraShortcut): Promise<DBCameraShortcut[] | undefined>;
|
|
13
|
+
patchShortcutById(username: string, cameraId: string, shortcutId: string, shortcutData?: Partial<DBCameraShortcut>): Promise<DBCameraShortcut[] | undefined>;
|
|
14
|
+
removeShortcutById(username: string, cameraId: string, shortcutId: string): Promise<DBCameraShortcut[] | undefined>;
|
|
15
|
+
removeAllShortcuts(username: string, cameraId: string): Promise<DBCameraShortcut[] | undefined>;
|
|
12
16
|
createView(username: string, viewData: DBCamviewLayout): Promise<DBCamviewLayout>;
|
|
13
|
-
patchViewById(username: string,
|
|
14
|
-
removeViewById(username: string,
|
|
17
|
+
patchViewById(username: string, viewid: string, viewData?: Partial<DBCamviewLayout>): Promise<DBCamviewLayout | undefined>;
|
|
18
|
+
removeViewById(username: string, viewid: string): Promise<DBCamviewLayout[] | undefined>;
|
|
15
19
|
removeAllViews(username: string): Promise<DBCamviewLayout[] | undefined>;
|
|
20
|
+
resetPreferences(username: string): Promise<void>;
|
|
21
|
+
resetAllPreferences(): Promise<void>;
|
|
22
|
+
removeCameraFromPreferences(cameraId: string): Promise<void>;
|
|
23
|
+
removeCameraFromAllShortcuts(cameraId: string): Promise<void>;
|
|
24
|
+
removeCameraFromAllViews(cameraId: string): Promise<void>;
|
|
16
25
|
}
|
|
@@ -7,7 +7,8 @@ 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 {
|
|
10
|
+
import type { DetectAudioInput, DetectMotionInput, DetectObjectInput } from '../schemas/plugins.schema.js';
|
|
11
|
+
import type { CreateShortcutInput, CreateUserInput, CreateViewInput, LoginUserInput, PatchShortcutInput, PatchUserInput, PatchViewInput } from '../schemas/users.schema.js';
|
|
11
12
|
export interface BusboyFileStream extends Readable {
|
|
12
13
|
truncated: boolean;
|
|
13
14
|
bytesRead: number;
|
|
@@ -173,32 +174,6 @@ export interface PaginationQuery {
|
|
|
173
174
|
page?: number;
|
|
174
175
|
pageSize?: number;
|
|
175
176
|
}
|
|
176
|
-
export type Multipart = MultipartFile | MultipartValue;
|
|
177
|
-
export interface MultipartFile {
|
|
178
|
-
type: 'file';
|
|
179
|
-
toBuffer: () => Promise<Buffer>;
|
|
180
|
-
file: BusboyFileStream;
|
|
181
|
-
fieldname: string;
|
|
182
|
-
filename: string;
|
|
183
|
-
encoding: string;
|
|
184
|
-
mimetype: string;
|
|
185
|
-
fields: MultipartFields;
|
|
186
|
-
_buf?: Buffer;
|
|
187
|
-
value: Buffer;
|
|
188
|
-
}
|
|
189
|
-
export interface MultipartValue<T = unknown> {
|
|
190
|
-
type: 'field';
|
|
191
|
-
value: T;
|
|
192
|
-
fieldname: string;
|
|
193
|
-
mimetype: string;
|
|
194
|
-
encoding: string;
|
|
195
|
-
fieldnameTruncated: boolean;
|
|
196
|
-
valueTruncated: boolean;
|
|
197
|
-
fields: MultipartFields;
|
|
198
|
-
}
|
|
199
|
-
export interface MultipartFields {
|
|
200
|
-
[fieldname: string]: Multipart | Multipart[] | undefined;
|
|
201
|
-
}
|
|
202
177
|
export type PaginationRequest = {
|
|
203
178
|
Querystring: PaginationQuery;
|
|
204
179
|
};
|
|
@@ -238,6 +213,11 @@ export type CamerasParamsRequest = {
|
|
|
238
213
|
cameraname: string;
|
|
239
214
|
};
|
|
240
215
|
};
|
|
216
|
+
export type CamerasParamsIdRequest = {
|
|
217
|
+
Params: {
|
|
218
|
+
cameraid: string;
|
|
219
|
+
};
|
|
220
|
+
};
|
|
241
221
|
export type CameraZonesParamsRequest = {
|
|
242
222
|
Params: {
|
|
243
223
|
zonename: string;
|
|
@@ -329,6 +309,23 @@ export type PluginsActionRequest = {
|
|
|
329
309
|
payload: any;
|
|
330
310
|
};
|
|
331
311
|
};
|
|
312
|
+
export type PluginsDetectMotionRequest = {
|
|
313
|
+
Body: DetectMotionInput;
|
|
314
|
+
};
|
|
315
|
+
export type PluginsDetectObjectRequest = {
|
|
316
|
+
Body: DetectObjectInput;
|
|
317
|
+
};
|
|
318
|
+
export type PluginsDetectAudioRequest = {
|
|
319
|
+
Body: DetectAudioInput;
|
|
320
|
+
};
|
|
321
|
+
export interface PluginsInterfaceQueryType {
|
|
322
|
+
type: 'objectDetection' | 'motionDetection' | 'audioDetection';
|
|
323
|
+
}
|
|
324
|
+
export type PluginsInterfaceQuery = {
|
|
325
|
+
Querystring: {
|
|
326
|
+
type: PluginsInterfaceQueryType;
|
|
327
|
+
};
|
|
328
|
+
};
|
|
332
329
|
export type UsersParamsRequest = {
|
|
333
330
|
Params: {
|
|
334
331
|
username: string;
|
|
@@ -346,7 +343,7 @@ export type UsersPatchRequest = {
|
|
|
346
343
|
};
|
|
347
344
|
export type ViewsParamsRequest = {
|
|
348
345
|
Params: {
|
|
349
|
-
|
|
346
|
+
viewid: string;
|
|
350
347
|
};
|
|
351
348
|
};
|
|
352
349
|
export type ViewsInsertRequest = {
|
|
@@ -355,6 +352,17 @@ export type ViewsInsertRequest = {
|
|
|
355
352
|
export type ViewsPatchRequest = {
|
|
356
353
|
Body: PatchViewInput;
|
|
357
354
|
};
|
|
355
|
+
export type ShortcutParamsRequest = {
|
|
356
|
+
Params: {
|
|
357
|
+
shortcutid: string;
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
export type ShortcutInsertRequest = {
|
|
361
|
+
Body: CreateShortcutInput;
|
|
362
|
+
};
|
|
363
|
+
export type ShortcutPatchRequest = {
|
|
364
|
+
Body: PatchShortcutInput;
|
|
365
|
+
};
|
|
358
366
|
export type BackupCreateRequest = {
|
|
359
367
|
Body: {
|
|
360
368
|
localStorage: Partial<UiLocalStorage>;
|
|
@@ -376,7 +384,7 @@ export interface ConsoleSettings {
|
|
|
376
384
|
export type CamviewSettingsLayoutMode = 'dnd' | 'view';
|
|
377
385
|
export interface CamviewSettings {
|
|
378
386
|
dragDisabled?: boolean;
|
|
379
|
-
|
|
387
|
+
viewid?: string;
|
|
380
388
|
}
|
|
381
389
|
export interface UiSettingsLocalStorage {
|
|
382
390
|
config: ConfigSettings;
|
|
@@ -562,6 +570,9 @@ export interface CameraUiPlugin {
|
|
|
562
570
|
'camera.ui'?: string;
|
|
563
571
|
node?: string;
|
|
564
572
|
};
|
|
573
|
+
'camera.ui'?: PluginContract;
|
|
574
|
+
isPython: boolean;
|
|
575
|
+
isNode: boolean;
|
|
565
576
|
}
|
|
566
577
|
export interface FrameWorker {
|
|
567
578
|
name: string;
|
|
@@ -3,7 +3,7 @@ import { EventEmitter } from 'node:events';
|
|
|
3
3
|
import { CameraController } from './camera/controller.js';
|
|
4
4
|
import type { Camera, CameraExtensions } from './api/database/types.js';
|
|
5
5
|
import type { FrameWorker } from './decoder/worker.js';
|
|
6
|
-
import type { BasePlugin } from './plugins/base.js';
|
|
6
|
+
import type { BasePlugin } from './plugins/interfaces/base.js';
|
|
7
7
|
import type { CameraExtension } from './plugins/types.js';
|
|
8
8
|
import type { API } from './polyglot/node/plugins/api.js';
|
|
9
9
|
import type { PluginLogger } from './polyglot/node/plugins/logger.js';
|
|
@@ -1,7 +1,4 @@
|
|
|
1
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
2
|
import { CameraPrebufferInterface } from './interfaces/prebuffer.js';
|
|
6
3
|
import { CameraPTZInterface } from './interfaces/ptz.js';
|
|
7
4
|
import type { Camera } from '../api/database/types.js';
|
|
@@ -17,11 +14,8 @@ export declare class CameraController extends BaseCameraDevice {
|
|
|
17
14
|
private doorbellTimeoutDuration;
|
|
18
15
|
private prebufferStateSubscriptions;
|
|
19
16
|
cameraDelegate: CameraDelegate;
|
|
20
|
-
prebufferDelegate: CameraPrebufferInterface;
|
|
17
|
+
protected prebufferDelegate: CameraPrebufferInterface;
|
|
21
18
|
ptzDelegate: CameraPTZInterface;
|
|
22
|
-
audioDetectorDelegate: CameraAudioDetectionInterface;
|
|
23
|
-
motionDetectorDelegate: CameraMotionDetectionInterface;
|
|
24
|
-
objectDetectorDelegate: CameraObjectDetectionInterface;
|
|
25
19
|
get camera(): Camera;
|
|
26
20
|
get sources(): CameraSource[];
|
|
27
21
|
constructor(camera: Camera, logger: BaseLogger, proxy: ProxyServer);
|
|
@@ -42,5 +36,6 @@ export declare class CameraController extends BaseCameraDevice {
|
|
|
42
36
|
private subscribeToObjectState;
|
|
43
37
|
private subscribeToDoorbellState;
|
|
44
38
|
private triggerProxyEvent;
|
|
39
|
+
private proxyRequest;
|
|
45
40
|
private isCameraEvent;
|
|
46
41
|
}
|
|
@@ -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,
|
|
7
|
+
import type { AudioSetEvent, AudioState, BaseLogger, BatterySetEvent, BatteryState, CameraConfigInputSettings, CameraDelegate, 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;
|
|
@@ -39,11 +39,8 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
39
39
|
readonly onSirenDetected: Observable<SirenState>;
|
|
40
40
|
readonly onBatteryChanged: Observable<BatteryState>;
|
|
41
41
|
abstract cameraDelegate: CameraDelegate;
|
|
42
|
-
abstract prebufferDelegate: CameraPrebufferDelegate;
|
|
42
|
+
protected abstract prebufferDelegate: CameraPrebufferDelegate;
|
|
43
43
|
abstract ptzDelegate: CameraPTZDelegate;
|
|
44
|
-
abstract motionDetectorDelegate: CameraMotionDetectionDelegate;
|
|
45
|
-
abstract audioDetectorDelegate: CameraAudioDetectionDelegate;
|
|
46
|
-
abstract objectDetectorDelegate: CameraObjectDetectionDelegate;
|
|
47
44
|
protected get cameraObject(): Camera;
|
|
48
45
|
get id(): string;
|
|
49
46
|
get nativeId(): string | undefined;
|
|
@@ -68,9 +65,10 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
68
65
|
get frameWorkerSettings(): CameraFrameWorkerSettings;
|
|
69
66
|
get sources(): CameraSource[];
|
|
70
67
|
get streamSource(): CameraSource;
|
|
71
|
-
get snapshotSource(): CameraSource;
|
|
72
|
-
get
|
|
73
|
-
get
|
|
68
|
+
get snapshotSource(): CameraSource | undefined;
|
|
69
|
+
get highResolutionSource(): CameraSource | undefined;
|
|
70
|
+
get midResolutionSource(): CameraSource | undefined;
|
|
71
|
+
get lowResolutionSource(): CameraSource | undefined;
|
|
74
72
|
constructor(camera: Camera, logger: BaseLogger);
|
|
75
73
|
getValue<T extends keyof StateValues>(stateName: T): StateValues[T];
|
|
76
74
|
snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
|
|
@@ -5,6 +5,7 @@ export declare class CameraInterface extends CameraDelegate {
|
|
|
5
5
|
private onRequest;
|
|
6
6
|
private logger;
|
|
7
7
|
constructor(onRequest: (client: any, fn: string, args?: any[], timeout?: number) => Promise<any>, logger: BaseLogger);
|
|
8
|
+
snapshot(): Promise<ArrayBuffer>;
|
|
8
9
|
reboot(): Promise<void>;
|
|
9
10
|
private _onRequest;
|
|
10
11
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
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
4
|
import type { CameraInterface } from './interfaces/camera.js';
|
|
6
|
-
import type { CameraMotionDetectionInterface } from './interfaces/motionDetection.js';
|
|
7
|
-
import type { CameraObjectDetectionInterface } from './interfaces/objectDetection.js';
|
|
8
5
|
import type { CameraPrebufferInterface } from './interfaces/prebuffer.js';
|
|
9
6
|
import type { CameraPTZInterface } from './interfaces/ptz.js';
|
|
10
7
|
export interface BaseLogger {
|
|
@@ -182,6 +179,7 @@ export type StateValue<T extends keyof StateValues> = StateValues[T];
|
|
|
182
179
|
export type SetValue<T extends keyof SetValues> = SetValues[T];
|
|
183
180
|
export type OnChangeCallback<T extends keyof StateValues> = (newEvent: StateValues[T], oldEvent: StateValues[T]) => void;
|
|
184
181
|
export declare abstract class CameraDelegate {
|
|
182
|
+
abstract snapshot(): Promise<ArrayBuffer>;
|
|
185
183
|
abstract reboot(): Promise<void>;
|
|
186
184
|
}
|
|
187
185
|
export declare abstract class CameraPrebufferDelegate {
|
|
@@ -193,28 +191,13 @@ export declare abstract class CameraPTZDelegate {
|
|
|
193
191
|
abstract moveContinuous(pan: number, tilt: number, zoom: number): Promise<void>;
|
|
194
192
|
abstract stop(): Promise<void>;
|
|
195
193
|
}
|
|
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
194
|
export interface CameraInterfaces {
|
|
206
195
|
readonly cameraDelegate: CameraInterface;
|
|
207
196
|
readonly prebufferDelegate: CameraPrebufferInterface;
|
|
208
197
|
readonly ptzDelegate: CameraPTZInterface;
|
|
209
|
-
readonly motionDetectorDelegate: CameraMotionDetectionInterface;
|
|
210
|
-
readonly objectDetectorDelegate: CameraObjectDetectionInterface;
|
|
211
|
-
readonly audioDetectorDelegate: CameraAudioDetectionInterface;
|
|
212
198
|
}
|
|
213
199
|
export interface CameraDelegates {
|
|
214
200
|
readonly cameraDelegate: CameraDelegate;
|
|
215
201
|
readonly prebufferDelegate: CameraPrebufferDelegate;
|
|
216
202
|
readonly ptzDelegate: CameraPTZDelegate;
|
|
217
|
-
readonly motionDetectorDelegate: CameraMotionDetectionDelegate;
|
|
218
|
-
readonly objectDetectorDelegate: CameraObjectDetectionDelegate;
|
|
219
|
-
readonly audioDetectorDelegate: CameraAudioDetectionDelegate;
|
|
220
203
|
}
|
|
@@ -2,6 +2,15 @@ import type { ChildProcess } from 'node:child_process';
|
|
|
2
2
|
import type { Sharp } from 'sharp';
|
|
3
3
|
import type { MotionState } from '../camera/types.js';
|
|
4
4
|
export type DecoderFormat = 'yuv' | 'rgb';
|
|
5
|
+
export interface ImageMetadata {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
export interface AudioMetadata {
|
|
10
|
+
channels: number;
|
|
11
|
+
sampleRate: number;
|
|
12
|
+
format: string;
|
|
13
|
+
}
|
|
5
14
|
export interface FrameMetadata {
|
|
6
15
|
format: DecoderFormat;
|
|
7
16
|
frameSize: number;
|
|
@@ -30,7 +39,7 @@ export interface ImageOptions {
|
|
|
30
39
|
crop?: ImageCrop;
|
|
31
40
|
resize?: ImageResize;
|
|
32
41
|
}
|
|
33
|
-
export interface
|
|
42
|
+
export interface ProcessPrebufferedImageRequest {
|
|
34
43
|
frameData: FrameData;
|
|
35
44
|
metadata: FrameMetadata;
|
|
36
45
|
options: ImageOptions;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { CameraDeviceProxy } from './proxy/cameraDevice.js';
|
|
2
|
-
import { DeviceManagerProxy
|
|
2
|
+
import { DeviceManagerProxy } from './proxy/index.js';
|
|
3
3
|
import { NatsServer } from './server.js';
|
|
4
4
|
import type { NatsConnection, Subscription } from 'nats';
|
|
5
5
|
import type { StateValues } from '../camera/types.js';
|
|
6
|
-
import type {
|
|
6
|
+
import type { CameraStorage } from '../polyglot/node/plugins/cameraStorage.js';
|
|
7
|
+
import type { MethodKeys, MethodType } from '../types.js';
|
|
8
|
+
import type { CameraDeviceListenerMessagePayload, DeviceManagerProxyEvents, PluginMap, ProxyAuth } from './types.js';
|
|
7
9
|
import type { WebsocketProxy } from './websocket.js';
|
|
8
10
|
export declare class ProxyServer {
|
|
9
11
|
private api;
|
|
10
12
|
private logger;
|
|
11
13
|
deviceManagerProxy?: DeviceManagerProxy;
|
|
12
|
-
pluginsManagerProxy?: PluginsManagerProxy;
|
|
13
|
-
systemManagerProxy?: SystemManagerProxy;
|
|
14
14
|
cameraDeviceProxy?: CameraDeviceProxy;
|
|
15
15
|
websocketProxy?: WebsocketProxy;
|
|
16
16
|
server: NatsServer;
|
|
17
17
|
publisher?: NatsConnection;
|
|
18
18
|
subscriber?: Subscription;
|
|
19
|
+
private pluginsService?;
|
|
19
20
|
private messageQueue?;
|
|
20
21
|
private initialized;
|
|
21
22
|
auth: ProxyAuth;
|
|
@@ -23,12 +24,12 @@ export declare class ProxyServer {
|
|
|
23
24
|
initialize(): Promise<void>;
|
|
24
25
|
close(): Promise<void>;
|
|
25
26
|
publishDeviceManagerEvent<K extends keyof DeviceManagerProxyEvents>(targetId: string, type: K, data: DeviceManagerProxyEvents[K]): void;
|
|
26
|
-
publishSystemManagerEvent<K extends keyof SystemManagerProxyEvents>(targetId: string, type: K, data: SystemManagerProxyEvents[K]): void;
|
|
27
|
-
publishPluginsManagerEvent<K extends keyof PluginsManagerProxyEvents>(targetId: string, type: K, data: PluginsManagerProxyEvents[K]): void;
|
|
28
27
|
publishCameraEvent<K extends keyof StateValues>(cameraId: string, stateName: K, data: {
|
|
29
28
|
newEvent: StateValues[K];
|
|
30
29
|
oldEvent: StateValues[K];
|
|
31
30
|
}, targetId?: string): void;
|
|
32
31
|
publishCameraEvent(cameraId: string, type: CameraDeviceListenerMessagePayload['type'], data?: any, targetId?: string): void;
|
|
32
|
+
requestPluginFn<T extends keyof PluginMap, K extends MethodKeys<PluginMap[T]>>(pluginType: T, pluginId: string, fn: K, args: Parameters<MethodType<PluginMap[T], K>>, timeout?: number): Promise<Awaited<ReturnType<MethodType<PluginMap[T], K>>>>;
|
|
33
|
+
requestStorageFn<T extends MethodKeys<CameraStorage>>(pluginId: string, cameraId: string, fn: T, args: Parameters<MethodType<CameraStorage, T>>, timeout?: number): Promise<Awaited<ReturnType<MethodType<CameraStorage, T>>>>;
|
|
33
34
|
private isCameraState;
|
|
34
35
|
}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import type { Camera } from '../../api/database/types.js';
|
|
2
|
-
import type {
|
|
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';
|
|
2
|
+
import type { CameraConfigInputSettings, CameraInterfaces, Container, PrebufferState, SetValues, StateValues } from '../../camera/types.js';
|
|
9
3
|
import type { IceServer } from '../../services/config/types.js';
|
|
10
4
|
import type { MethodKeys, MethodType } from '../../types.js';
|
|
11
|
-
import type { MessageQueue } from '../
|
|
5
|
+
import type { MessageQueue } from '../messageQueue.js';
|
|
12
6
|
import type { CameraDeviceProxyMethods, ProxyMessageStructure } from '../types.js';
|
|
13
7
|
export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
|
|
14
8
|
private api;
|
|
@@ -17,25 +11,20 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
|
|
|
17
11
|
private pluginsService;
|
|
18
12
|
private messageQueue;
|
|
19
13
|
constructor(messageQueue: MessageQueue);
|
|
20
|
-
connect(cameraId: string): void;
|
|
21
|
-
disconnect(cameraId: string): void;
|
|
14
|
+
connect(cameraId: string, pluginId: string): void;
|
|
15
|
+
disconnect(cameraId: string, pluginId: string): void;
|
|
22
16
|
getFfmpegPath(): string;
|
|
23
17
|
getIceServers(): IceServer[];
|
|
24
|
-
updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], cameraId: string): Promise<void>;
|
|
18
|
+
updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], cameraId: string, pluginId: string): Promise<void>;
|
|
25
19
|
updatePrebufferState(sourceId: string, container: Container, state: PrebufferState, cameraId: string, pluginId: string): Promise<void>;
|
|
26
20
|
addCameraSource(source: CameraConfigInputSettings, cameraId: string, pluginId: string): Promise<void>;
|
|
27
|
-
updateCameraSource(
|
|
28
|
-
removeCameraSource(
|
|
21
|
+
updateCameraSource(sourceId: string, source: Partial<CameraConfigInputSettings>, cameraId: string, pluginId: string): Promise<void>;
|
|
22
|
+
removeCameraSource(sourceId: string, cameraId: string, pluginId: string): Promise<void>;
|
|
29
23
|
refreshStates(cameraId: string): {
|
|
30
24
|
camera: Camera;
|
|
31
25
|
states: StateValues;
|
|
32
26
|
cameraState: boolean;
|
|
33
27
|
};
|
|
34
|
-
onRequest<T extends MethodKeys<
|
|
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>>>;
|
|
28
|
+
onRequest<T extends keyof CameraInterfaces, K extends MethodKeys<CameraInterfaces[T]>>(cameraId: string, client: T, fn: K, ...args: Parameters<MethodType<CameraInterfaces[T], K>>): Promise<Awaited<ReturnType<MethodType<CameraInterfaces[T], K>>>>;
|
|
40
29
|
handleMessage(message: ProxyMessageStructure): Promise<void | ProxyMessageStructure>;
|
|
41
30
|
}
|
|
@@ -1,31 +1,16 @@
|
|
|
1
1
|
import type { Camera } from '../../api/database/types.js';
|
|
2
2
|
import type { CameraConfig } from '../../camera/types.js';
|
|
3
|
-
import type { MessageQueue } from '../
|
|
3
|
+
import type { MessageQueue } from '../messageQueue.js';
|
|
4
4
|
import type { DeviceManagerServerProxyMethods, ProxyMessageStructure } from '../types.js';
|
|
5
5
|
export declare class DeviceManagerProxy implements DeviceManagerServerProxyMethods {
|
|
6
6
|
private camerasService;
|
|
7
7
|
private pluginsService;
|
|
8
8
|
private messageQueue;
|
|
9
9
|
constructor(messageQueue: MessageQueue);
|
|
10
|
-
getCameraByName(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
id: string;
|
|
16
|
-
pluginId: string;
|
|
17
|
-
}): Camera | void;
|
|
18
|
-
createCamera(data: {
|
|
19
|
-
camera: CameraConfig;
|
|
20
|
-
pluginId: string;
|
|
21
|
-
}): Promise<Camera>;
|
|
22
|
-
removeCameraByName(data: {
|
|
23
|
-
name: string;
|
|
24
|
-
pluginId: string;
|
|
25
|
-
}): Promise<void>;
|
|
26
|
-
removeCameraById(data: {
|
|
27
|
-
id: string;
|
|
28
|
-
pluginId: string;
|
|
29
|
-
}): Promise<void>;
|
|
10
|
+
getCameraByName(cameraName: string, pluginId: string): Camera | undefined;
|
|
11
|
+
getCameraById(cameraId: string, pluginId: string): Camera | void;
|
|
12
|
+
createCamera(cameraConfig: CameraConfig, pluginId: string): Promise<Camera>;
|
|
13
|
+
removeCameraByName(cameraName: string, pluginId: string): Promise<void>;
|
|
14
|
+
removeCameraById(cameraId: string, pluginId: string): Promise<void>;
|
|
30
15
|
handleMessage(message: ProxyMessageStructure): Promise<void | ProxyMessageStructure>;
|
|
31
16
|
}
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import type { Camera, VideoStreamingMode } from '../api/database/types.js';
|
|
2
2
|
import type { CameraDevice } from '../camera/device.js';
|
|
3
3
|
import type { CameraConfig, CameraConfigInputSettings, CameraDelegates, Container, PrebufferState, SetValues, StateValues } from '../camera/types.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { AudioDetectionPlugin } from '../plugins/interfaces/audioDetection.js';
|
|
5
|
+
import type { BasePlugin } from '../plugins/interfaces/base.js';
|
|
6
|
+
import type { MotionDetectionPlugin } from '../plugins/interfaces/motionDetection.js';
|
|
7
|
+
import type { ObjectDetectionPlugin } from '../plugins/interfaces/objectDetection.js';
|
|
5
8
|
import type { CameraExtension } from '../plugins/types.js';
|
|
6
|
-
import type { CameraStorage } from '../polyglot/node/plugins/cameraStorage.js';
|
|
7
9
|
import type { IceServer } from '../services/config/types.js';
|
|
8
10
|
import type { MethodKeys } from '../types.js';
|
|
9
11
|
export interface QueueItem {
|
|
10
12
|
message: ProxyMessageStructure;
|
|
11
13
|
resolve: (response: any) => void;
|
|
12
|
-
reject: (error:
|
|
14
|
+
reject: (error: RemoteError) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface DeserializedError {
|
|
17
|
+
name: string;
|
|
18
|
+
message: string;
|
|
19
|
+
stack: string;
|
|
20
|
+
}
|
|
21
|
+
export declare class RemoteError extends Error {
|
|
22
|
+
constructor(error: DeserializedError, cause: Omit<ProxyMessageStructure, 'error'>);
|
|
13
23
|
}
|
|
14
24
|
export interface ProxyMessageStructure {
|
|
15
25
|
requestId: string;
|
|
@@ -18,14 +28,14 @@ export interface ProxyMessageStructure {
|
|
|
18
28
|
targetName?: string;
|
|
19
29
|
pluginId: string;
|
|
20
30
|
type: 'request' | 'reply';
|
|
21
|
-
proxy: '
|
|
22
|
-
client: 'cameraFn' | 'pluginFn' | '
|
|
31
|
+
proxy: 'device' | 'camera' | 'plugin';
|
|
32
|
+
client: 'cameraFn' | 'pluginFn' | 'deviceFn' | 'storageFn' | keyof CameraDelegates;
|
|
23
33
|
fn: string;
|
|
24
34
|
args: any[];
|
|
25
35
|
timeout: number;
|
|
26
36
|
timestamp: number;
|
|
27
37
|
response?: any;
|
|
28
|
-
error?:
|
|
38
|
+
error?: DeserializedError;
|
|
29
39
|
}
|
|
30
40
|
export interface ProxyAuth {
|
|
31
41
|
cluster: {
|
|
@@ -43,30 +53,11 @@ export interface StreamPayload {
|
|
|
43
53
|
value: string;
|
|
44
54
|
}
|
|
45
55
|
export interface DeviceManagerServerProxyMethods {
|
|
46
|
-
createCamera(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
name: string;
|
|
52
|
-
pluginId: string;
|
|
53
|
-
}): Camera | void;
|
|
54
|
-
getCameraById(data: {
|
|
55
|
-
id: string;
|
|
56
|
-
pluginId: string;
|
|
57
|
-
}): Camera | void;
|
|
58
|
-
removeCameraByName(data: {
|
|
59
|
-
name: string;
|
|
60
|
-
pluginId: string;
|
|
61
|
-
}): Promise<void>;
|
|
62
|
-
removeCameraById(data: {
|
|
63
|
-
id: string;
|
|
64
|
-
pluginId: string;
|
|
65
|
-
}): Promise<void>;
|
|
66
|
-
}
|
|
67
|
-
export interface SystemManagerServerProxyMethods {
|
|
68
|
-
}
|
|
69
|
-
export interface PluginsManagerServerProxyMethods {
|
|
56
|
+
createCamera(camera: CameraConfig): Promise<Camera>;
|
|
57
|
+
getCameraByName(name: string): Camera | void;
|
|
58
|
+
getCameraById(id: string): Camera | void;
|
|
59
|
+
removeCameraByName(name: string): Promise<void>;
|
|
60
|
+
removeCameraById(id: string): Promise<void>;
|
|
70
61
|
}
|
|
71
62
|
export interface CameraDeviceProxyMethods {
|
|
72
63
|
connect(): void;
|
|
@@ -81,8 +72,8 @@ export interface CameraDeviceProxyMethods {
|
|
|
81
72
|
cameraState: boolean;
|
|
82
73
|
};
|
|
83
74
|
addCameraSource(source: CameraConfigInputSettings): Promise<void>;
|
|
84
|
-
updateCameraSource(
|
|
85
|
-
removeCameraSource(
|
|
75
|
+
updateCameraSource(sourceId: string, source: Partial<CameraConfigInputSettings>): Promise<void>;
|
|
76
|
+
removeCameraSource(sourceId: string): Promise<void>;
|
|
86
77
|
}
|
|
87
78
|
export type CameraDeviceProxyMethodNames = MethodKeys<CameraDeviceProxyMethods>;
|
|
88
79
|
export interface DeviceManagerListenerMessagePayload {
|
|
@@ -90,11 +81,11 @@ export interface DeviceManagerListenerMessagePayload {
|
|
|
90
81
|
data: DeviceManagerProxyEvents['cameraSelected'] | DeviceManagerProxyEvents['cameraDeselected'];
|
|
91
82
|
}
|
|
92
83
|
export interface DeviceManagerProxyMethods {
|
|
93
|
-
getCameraByName(
|
|
94
|
-
getCameraById(
|
|
95
|
-
createCamera(
|
|
96
|
-
removeCameraByName(
|
|
97
|
-
removeCameraById(
|
|
84
|
+
getCameraByName(cameraName: string): Promise<CameraDevice | undefined>;
|
|
85
|
+
getCameraById(cameraId: string): Promise<CameraDevice | undefined>;
|
|
86
|
+
createCamera(cameraConfig: CameraConfig): Promise<CameraDevice>;
|
|
87
|
+
removeCameraByName(cameraName: string): Promise<void>;
|
|
88
|
+
removeCameraById(cameraId: string): Promise<void>;
|
|
98
89
|
}
|
|
99
90
|
export type DeviceManagerProxyMethodNames = MethodKeys<DeviceManagerProxyMethods>;
|
|
100
91
|
export interface DeviceManagerProxyEvents {
|
|
@@ -115,46 +106,12 @@ export interface DeviceManagerProxyGenericEvent<K extends keyof DeviceManagerPro
|
|
|
115
106
|
type: K;
|
|
116
107
|
data: DeviceManagerProxyEvents[K];
|
|
117
108
|
}
|
|
118
|
-
export interface
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
export type SystemManagerProxyMethodNames = MethodKeys<SystemManagerProxyMethods>;
|
|
125
|
-
export interface SystemManagerProxyMethodsListener {
|
|
126
|
-
listen<E extends keyof SystemManagerProxyEventCallbacks>(eventType: E, callback: SystemManagerProxyEventCallbacks[E]): void;
|
|
127
|
-
removeListener<E extends keyof SystemManagerProxyEventCallbacks>(eventType: E, callbackToRemove: SystemManagerProxyEventCallbacks[E]): void;
|
|
128
|
-
removeAllListeners<E extends keyof SystemManagerProxyEventCallbacks>(eventType?: E): void;
|
|
129
|
-
}
|
|
130
|
-
export interface SystemManagerProxyEvents {
|
|
131
|
-
}
|
|
132
|
-
export type SystemManagerProxyEventCallbacks = {};
|
|
133
|
-
export interface SystemManagerProxyGenericEvent<K extends keyof SystemManagerProxyEvents> {
|
|
134
|
-
type: K;
|
|
135
|
-
data: SystemManagerProxyEvents[K];
|
|
136
|
-
}
|
|
137
|
-
export interface PluginsManagerListenerMessagePayload {
|
|
138
|
-
type: keyof PluginsManagerProxyEventCallbacks;
|
|
139
|
-
data: any;
|
|
140
|
-
}
|
|
141
|
-
export interface PluginsManagerProxyMethods {
|
|
142
|
-
}
|
|
143
|
-
export type PluginsManagerProxyMethodNames = MethodKeys<PluginsManagerProxyMethods>;
|
|
144
|
-
export interface PluginsManagerProxyMethodsListener {
|
|
145
|
-
listen<E extends keyof PluginsManagerProxyEventCallbacks>(eventType: E, callback: PluginsManagerProxyEventCallbacks[E]): void;
|
|
146
|
-
removeListener<E extends keyof PluginsManagerProxyEventCallbacks>(eventType: E, callbackToRemove: PluginsManagerProxyEventCallbacks[E]): void;
|
|
147
|
-
removeAllListeners<E extends keyof PluginsManagerProxyEventCallbacks>(eventType?: E): void;
|
|
148
|
-
}
|
|
149
|
-
export interface PluginsManagerProxyEvents {
|
|
150
|
-
}
|
|
151
|
-
export type PluginsManagerProxyEventCallbacks = {};
|
|
152
|
-
export interface PluginsManagerProxyGenericEvent<K extends keyof PluginsManagerProxyEvents> {
|
|
153
|
-
type: K;
|
|
154
|
-
data: PluginsManagerProxyEvents[K];
|
|
109
|
+
export interface PluginMap {
|
|
110
|
+
base: BasePlugin;
|
|
111
|
+
motionDetection: MotionDetectionPlugin;
|
|
112
|
+
objectDetection: ObjectDetectionPlugin;
|
|
113
|
+
audioDetection: AudioDetectionPlugin;
|
|
155
114
|
}
|
|
156
|
-
export type CallablePluginStorageMethods = Pick<CameraStorage, 'getConfig' | 'setConfig'>;
|
|
157
|
-
export type CallablePluginMethods = Pick<BasePlugin, 'onFormSubmit'>;
|
|
158
115
|
export interface CameraDeviceListenerStatePayload<K extends keyof StateValues> {
|
|
159
116
|
stateName: K;
|
|
160
117
|
data: {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BasePlugin } from './base.js';
|
|
2
|
+
import type { AudioMetadata } from '../../decoder/types.js';
|
|
3
|
+
import type { AudioDetectionPluginResponse, RootSchema } from '../types.js';
|
|
4
|
+
export declare abstract class AudioDetectionPlugin extends BasePlugin {
|
|
5
|
+
abstract interfaceSchema(): RootSchema | void;
|
|
6
|
+
abstract detectAudio(audioPath: string, metadata: AudioMetadata, config: Record<string, any>): Promise<AudioDetectionPluginResponse>;
|
|
7
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CameraDevice } from '
|
|
2
|
-
import type { FormSubmitResponse } from '
|
|
1
|
+
import type { CameraDevice } from '../../camera/device.js';
|
|
2
|
+
import type { FormSubmitResponse } from '../types.js';
|
|
3
3
|
export declare abstract class BasePlugin {
|
|
4
4
|
abstract onFormSubmit(actionId: string, payload: any): Promise<FormSubmitResponse | void>;
|
|
5
5
|
abstract configureCameras(cameras: CameraDevice[]): void;
|