@camera.ui/browser 0.0.82 → 0.0.83
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 +3 -7
- package/dist/types/server/src/api/database/types.d.ts +1 -1
- package/dist/types/server/src/api/go2rtc/api/streams.d.ts +4 -4
- package/dist/types/server/src/api/go2rtc/types.d.ts +6 -2
- package/dist/types/server/src/api/schemas/backup.schema.d.ts +3 -3
- package/dist/types/server/src/api/schemas/cameras.schema.d.ts +54 -34
- package/dist/types/server/src/api/schemas/plugins.schema.d.ts +29 -32
- package/dist/types/server/src/api/schemas/users.schema.d.ts +6 -6
- package/dist/types/server/src/api/services/cameras.service.d.ts +1 -0
- package/dist/types/server/src/api/types/index.d.ts +1 -1
- package/dist/types/server/src/api.d.ts +2 -2
- package/dist/types/server/src/camera/controller.d.ts +9 -4
- package/dist/types/server/src/camera/device.d.ts +15 -3
- package/dist/types/server/src/camera/index.d.ts +18 -39
- package/dist/types/server/src/camera/interfaces/camera.d.ts +0 -1
- package/dist/types/server/src/camera/types.d.ts +1 -3
- package/dist/types/server/src/camera/videoFrame.d.ts +3 -3
- package/dist/types/server/src/decoder/types.d.ts +5 -12
- package/dist/types/server/src/decoder/worker.d.ts +3 -5
- package/dist/types/server/src/nats/connection.d.ts +17 -0
- package/dist/types/server/src/nats/error.d.ts +9 -0
- package/dist/types/server/src/nats/index.d.ts +6 -4
- package/dist/types/server/src/nats/messageQueue.d.ts +7 -4
- package/dist/types/server/src/nats/proxy/deviceManager.d.ts +2 -2
- package/dist/types/server/src/nats/server.d.ts +0 -1
- package/dist/types/server/src/nats/subscription.d.ts +12 -0
- package/dist/types/server/src/nats/types.d.ts +25 -40
- package/dist/types/server/src/nats/utils.d.ts +2 -4
- package/dist/types/server/src/plugins/index.d.ts +3 -5
- package/dist/types/server/src/plugins/plugin.d.ts +4 -13
- package/dist/types/server/src/plugins/types.d.ts +4 -0
- package/dist/types/server/src/plugins/worker.d.ts +1 -1
- package/dist/types/server/src/polyglot/node/plugins/cameraStorage.d.ts +2 -2
- package/dist/types/server/src/polyglot/node/plugins/{api.d.ts → pluginApi.d.ts} +9 -12
- package/dist/types/server/src/polyglot/node/plugins/{logger.d.ts → pluginLogger.d.ts} +2 -0
- package/dist/types/server/src/polyglot/node/plugins/proxy/cameraDevice.d.ts +8 -11
- package/dist/types/server/src/polyglot/node/plugins/proxy/deviceManager.d.ts +6 -8
- package/dist/types/server/src/polyglot/node/plugins/storageController.d.ts +2 -2
- package/dist/types/server/src/services/config/index.d.ts +3 -2
- package/dist/types/server/src/services/config/types.d.ts +4 -4
- package/dist/types/server/src/services/logger/index.d.ts +2 -0
- package/dist/types/server/src/utils/ffmpeg.d.ts +2 -0
- package/dist/types/server/src/utils/pythonInstaller.d.ts +1 -1
- package/dist/types/server/src/utils/subscribed.d.ts +4 -4
- package/package.json +5 -5
- package/dist/types/server/src/api/controllers/api.controller.d.ts +0 -6
- package/dist/types/server/src/api/controllers/auth.controller.d.ts +0 -20
- package/dist/types/server/src/api/controllers/backup.controller.d.ts +0 -10
- package/dist/types/server/src/api/controllers/cameras.controller.d.ts +0 -34
- package/dist/types/server/src/api/controllers/config.controller.d.ts +0 -14
- package/dist/types/server/src/api/controllers/files.controller.d.ts +0 -8
- package/dist/types/server/src/api/controllers/frameWorkers.controller.d.ts +0 -16
- package/dist/types/server/src/api/controllers/plugins.controller.d.ts +0 -59
- package/dist/types/server/src/api/controllers/system.controller.d.ts +0 -14
- package/dist/types/server/src/api/controllers/users.controller.d.ts +0 -28
- package/dist/types/server/src/api/index.d.ts +0 -21
- package/dist/types/server/src/api/middlewares/authPermission.middleware.d.ts +0 -5
- package/dist/types/server/src/api/middlewares/authValidation.middleware.d.ts +0 -4
- package/dist/types/server/src/api/middlewares/pagination.middleware.d.ts +0 -3
- package/dist/types/server/src/api/plugins/cameraui.plugin.d.ts +0 -11
- package/dist/types/server/src/api/plugins/database.plugin.d.ts +0 -11
- package/dist/types/server/src/api/plugins/go2rtc.plugin.d.ts +0 -11
- package/dist/types/server/src/api/plugins/logger.plugin.d.ts +0 -7
- package/dist/types/server/src/api/plugins/socket.plugin.d.ts +0 -11
- package/dist/types/server/src/api/plugins/system.plugin.d.ts +0 -21
- package/dist/types/server/src/api/plugins/useragent.plugin.d.ts +0 -8
- package/dist/types/server/src/api/routes/api.routes.d.ts +0 -2
- package/dist/types/server/src/api/routes/auth.routes.d.ts +0 -2
- package/dist/types/server/src/api/routes/backup.routes.d.ts +0 -2
- package/dist/types/server/src/api/routes/cameras.routes.d.ts +0 -2
- package/dist/types/server/src/api/routes/config.routes.d.ts +0 -2
- package/dist/types/server/src/api/routes/files.routes.d.ts +0 -2
- package/dist/types/server/src/api/routes/frameWorkers.routes.d.ts +0 -2
- package/dist/types/server/src/api/routes/index.d.ts +0 -6
- package/dist/types/server/src/api/routes/plugins.routes.d.ts +0 -2
- package/dist/types/server/src/api/routes/system.routes.d.ts +0 -2
- package/dist/types/server/src/api/routes/users.routes.d.ts +0 -2
- package/dist/types/server/src/api/services/backup.service.d.ts +0 -11
- package/dist/types/server/src/api/utils/cert.d.ts +0 -11
- package/dist/types/server/src/api/utils/fetch.d.ts +0 -2
- package/dist/types/server/src/api/utils/moveFiles.d.ts +0 -1
- package/dist/types/server/src/api/utils/parse.d.ts +0 -2
- package/dist/types/server/src/decoder/ffmpeg.d.ts +0 -2
- package/dist/types/server/src/main.d.ts +0 -21
- package/dist/types/server/src/nats/proxy/index.d.ts +0 -2
- package/dist/types/server/src/polyglot/node/plugins/proxy/index.d.ts +0 -2
- package/dist/types/server/src/polyglot/node/plugins/proxy/messageQueue.d.ts +0 -20
- /package/dist/types/server/src/polyglot/node/plugins/{config.d.ts → configService.d.ts} +0 -0
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { LRUCache } from 'lru-cache';
|
|
2
2
|
import { BehaviorSubject } from 'rxjs';
|
|
3
|
-
import
|
|
3
|
+
import { Subscribed } from '../utils/subscribed.js';
|
|
4
|
+
import type { Observable } from 'rxjs';
|
|
4
5
|
import type { Camera, CameraActivitySettings, CameraFrameWorkerSettings, CameraInformation, CameraType } from '../api/database/types.js';
|
|
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,
|
|
8
|
-
declare class Subscribed {
|
|
9
|
-
private readonly subscriptions;
|
|
10
|
-
private readonly additionalSubscriptions;
|
|
11
|
-
protected addSubscriptions(...subscriptions: Subscription[]): void;
|
|
12
|
-
protected addAdditionalSubscriptions(...subscriptions: Subscription[]): void;
|
|
13
|
-
protected unsubscribe(): void;
|
|
14
|
-
protected unsubscribeAdditional(): void;
|
|
15
|
-
}
|
|
7
|
+
import type { AudioSetEvent, AudioState, BaseLogger, BatterySetEvent, BatteryState, CameraDelegate, CameraPTZDelegate, CameraPrebufferDelegate, CameraSource, Container, DetectionZone, DoorbellSetEvent, DoorbellState, LightSetEvent, LightState, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, PrebufferState, SetValues, SirenSetEvent, SirenState, StateValues } from './types.js';
|
|
16
8
|
export declare abstract class BaseCameraDevice extends Subscribed {
|
|
17
9
|
protected logger: BaseLogger;
|
|
18
10
|
protected snapshotCache: LRUCache<string, ArrayBuffer, unknown>;
|
|
@@ -38,9 +30,9 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
38
30
|
readonly onDoorbellPressed: Observable<DoorbellState>;
|
|
39
31
|
readonly onSirenDetected: Observable<SirenState>;
|
|
40
32
|
readonly onBatteryChanged: Observable<BatteryState>;
|
|
41
|
-
abstract cameraDelegate: CameraDelegate;
|
|
33
|
+
protected abstract cameraDelegate: CameraDelegate;
|
|
34
|
+
protected abstract ptzDelegate: CameraPTZDelegate;
|
|
42
35
|
protected abstract prebufferDelegate: CameraPrebufferDelegate;
|
|
43
|
-
abstract ptzDelegate: CameraPTZDelegate;
|
|
44
36
|
protected get cameraObject(): Camera;
|
|
45
37
|
get id(): string;
|
|
46
38
|
get nativeId(): string | undefined;
|
|
@@ -63,44 +55,39 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
63
55
|
get activityZones(): DetectionZone[];
|
|
64
56
|
get activitySettings(): CameraActivitySettings;
|
|
65
57
|
get frameWorkerSettings(): CameraFrameWorkerSettings;
|
|
66
|
-
get sources(): CameraSource[];
|
|
67
58
|
get streamSource(): CameraSource;
|
|
68
59
|
get snapshotSource(): CameraSource | undefined;
|
|
69
60
|
get highResolutionSource(): CameraSource | undefined;
|
|
70
61
|
get midResolutionSource(): CameraSource | undefined;
|
|
71
62
|
get lowResolutionSource(): CameraSource | undefined;
|
|
63
|
+
get ptz(): CameraPTZDelegate;
|
|
64
|
+
abstract get sources(): CameraSource[];
|
|
72
65
|
constructor(camera: Camera, logger: BaseLogger);
|
|
66
|
+
abstract getIceServers(): Promise<IceServer[]>;
|
|
67
|
+
protected abstract cleanup(): void;
|
|
73
68
|
getValue<T extends keyof StateValues>(stateName: T): StateValues[T];
|
|
74
69
|
snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
|
|
75
70
|
onStateChange<T extends keyof StateValues>(stateName: T): Observable<{
|
|
76
71
|
newState: StateValues[T];
|
|
77
72
|
oldState: StateValues[T];
|
|
78
73
|
}>;
|
|
79
|
-
abstract connect(): Promise<void>;
|
|
80
|
-
abstract disconnect(): Promise<void>;
|
|
81
|
-
abstract getIceServers(): Promise<IceServer[]>;
|
|
82
|
-
abstract updateState(stateName: 'light', eventData: LightSetEvent): Promise<void>;
|
|
83
|
-
abstract updateState(stateName: 'motion', eventData: MotionSetEvent, frame?: VideoFrame): Promise<void>;
|
|
84
|
-
abstract updateState(stateName: 'audio', eventData: AudioSetEvent): Promise<void>;
|
|
85
|
-
abstract updateState(stateName: 'object', eventData: ObjectSetEvent): Promise<void>;
|
|
86
|
-
abstract updateState(stateName: 'doorbell', eventData: DoorbellSetEvent): Promise<void>;
|
|
87
|
-
abstract updateState(stateName: 'siren', eventData: SirenSetEvent): Promise<void>;
|
|
88
|
-
abstract updateState(stateName: 'battery', eventData: BatterySetEvent): Promise<void>;
|
|
89
|
-
abstract addCameraSource(source: CameraConfigInputSettings): Promise<void>;
|
|
90
|
-
abstract updateCameraSource(sourceId: string, source: Partial<CameraConfigInputSettings>): Promise<void>;
|
|
91
|
-
abstract removeCameraSource(sourceId: string): Promise<void>;
|
|
92
|
-
protected abstract cleanup(): void;
|
|
93
|
-
protected updateStateInternal<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], skipCheck?: boolean): void;
|
|
94
74
|
onPropertyChange<T extends keyof Camera>(property: T | T[]): Observable<{
|
|
95
75
|
property: T;
|
|
96
76
|
oldData: Camera[T];
|
|
97
77
|
newData: Camera[T];
|
|
98
78
|
}>;
|
|
99
|
-
removeAllListeners(): void;
|
|
79
|
+
protected removeAllListeners(): void;
|
|
80
|
+
protected updateCamera(updatedCamera: Camera): void;
|
|
81
|
+
protected updateCameraState(state: boolean): void;
|
|
82
|
+
protected updatePrebuffer(sourceId: string, container: Container, state: PrebufferState): void;
|
|
83
|
+
protected updateStateInternal<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], skipCheck?: boolean): void;
|
|
100
84
|
protected checkStateInternal<T extends keyof SetValues>(stateName: T, event: SetValues[T]): {
|
|
101
85
|
changed: boolean;
|
|
102
86
|
event: StateValues[T];
|
|
103
87
|
};
|
|
88
|
+
protected cameraSourcePrebufferState(sourceId: string, container: Container): PrebufferState;
|
|
89
|
+
protected createPrebufferStateObservable(sourceId: string, container: Container): Observable<PrebufferState>;
|
|
90
|
+
protected stateChanged<T extends keyof SetValues>(oldState?: SetValues[T], newState?: SetValues[T], type?: keyof StateValues): boolean;
|
|
104
91
|
protected getAudioState(event: AudioSetEvent, ignoreLastEvet?: boolean): AudioState;
|
|
105
92
|
protected getMotionState(event: MotionSetEvent, ignoreLastEvet?: boolean): MotionState;
|
|
106
93
|
protected getObjectState(event: ObjectSetEvent, ignoreLastEvet?: boolean): ObjectState;
|
|
@@ -108,14 +95,6 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
108
95
|
protected getLightState(event: LightSetEvent, ignoreLastEvet?: boolean): LightState;
|
|
109
96
|
protected getSirenState(event: SirenSetEvent, ignoreLastEvet?: boolean): SirenState;
|
|
110
97
|
protected getBatteryState(event: BatterySetEvent, ignoreLastEvet?: boolean): BatteryState;
|
|
111
|
-
|
|
112
|
-
protected updatePrebuffer(sourceId: string, container: Container, state: PrebufferState): Promise<void>;
|
|
113
|
-
protected updateCameraSourcesState(): void;
|
|
114
|
-
protected updateCameraState(state: boolean): void;
|
|
115
|
-
protected cameraSourcePrebufferState(sourceId: string, container: Container): PrebufferState;
|
|
98
|
+
private isStateEvent;
|
|
116
99
|
private createStateObservable;
|
|
117
|
-
protected createPrebufferStateObservable(sourceId: string, container: Container): Observable<PrebufferState>;
|
|
118
|
-
protected stateChanged<T extends keyof SetValues>(oldState?: SetValues[T], newState?: SetValues[T], type?: keyof StateValues): boolean;
|
|
119
|
-
protected isStateEvent(state: States | Sets): state is States;
|
|
120
100
|
}
|
|
121
|
-
export {};
|
|
@@ -6,6 +6,5 @@ export declare class CameraInterface extends CameraDelegate {
|
|
|
6
6
|
private logger;
|
|
7
7
|
constructor(onRequest: (client: any, fn: string, args?: any[], timeout?: number) => Promise<any>, logger: BaseLogger);
|
|
8
8
|
snapshot(): Promise<ArrayBuffer>;
|
|
9
|
-
reboot(): Promise<void>;
|
|
10
9
|
private _onRequest;
|
|
11
10
|
}
|
|
@@ -21,8 +21,7 @@ export interface FfmpegOptions {
|
|
|
21
21
|
}
|
|
22
22
|
export type Container = 'mp4' | 'mpegts';
|
|
23
23
|
export interface BasePrebufferState {
|
|
24
|
-
|
|
25
|
-
availableDuration: number;
|
|
24
|
+
duration: number;
|
|
26
25
|
}
|
|
27
26
|
export interface PrebufferStateTrue extends BasePrebufferState {
|
|
28
27
|
state: true;
|
|
@@ -180,7 +179,6 @@ export type SetValue<T extends keyof SetValues> = SetValues[T];
|
|
|
180
179
|
export type OnChangeCallback<T extends keyof StateValues> = (newEvent: StateValues[T], oldEvent: StateValues[T]) => void;
|
|
181
180
|
export declare abstract class CameraDelegate {
|
|
182
181
|
abstract snapshot(): Promise<ArrayBuffer>;
|
|
183
|
-
abstract reboot(): Promise<void>;
|
|
184
182
|
}
|
|
185
183
|
export declare abstract class CameraPrebufferDelegate {
|
|
186
184
|
abstract getStreamInfo(sourceName: string): Promise<StreamInfo | undefined>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { NatsConnection } from 'nats';
|
|
2
1
|
import type { DecoderFormat, FrameBuffer, FrameData, FrameImage, FrameMetadata, ImageOptions, MotionFrame as MotionFrameMethods, VideoFrame as VideoFrameMethods } from '../decoder/types.js';
|
|
2
|
+
import type { ProxyConnection } from '../nats/connection.js';
|
|
3
3
|
import type { MotionState } from './types.js';
|
|
4
4
|
export declare class VideoFrame implements VideoFrameMethods {
|
|
5
5
|
readonly frameData: FrameData;
|
|
@@ -10,7 +10,7 @@ export declare class VideoFrame implements VideoFrameMethods {
|
|
|
10
10
|
get inputWidth(): number;
|
|
11
11
|
get inputHeight(): number;
|
|
12
12
|
get inputFormat(): DecoderFormat;
|
|
13
|
-
constructor(cameraId: string, publisher:
|
|
13
|
+
constructor(cameraId: string, publisher: ProxyConnection, frameData: FrameData, metadata: FrameMetadata, prebufferDuration: number);
|
|
14
14
|
toBuffer(options?: ImageOptions): Promise<FrameBuffer>;
|
|
15
15
|
toImage(options?: ImageOptions): Promise<FrameImage>;
|
|
16
16
|
save(path: string, options?: ImageOptions): Promise<void>;
|
|
@@ -20,5 +20,5 @@ export declare class VideoFrame implements VideoFrameMethods {
|
|
|
20
20
|
}
|
|
21
21
|
export declare class MotionFrame extends VideoFrame implements MotionFrameMethods {
|
|
22
22
|
readonly motion: MotionState;
|
|
23
|
-
constructor(cameraId: string, publisher:
|
|
23
|
+
constructor(cameraId: string, publisher: ProxyConnection, frameData: FrameData, motionState: MotionState, metadata: FrameMetadata);
|
|
24
24
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ChildProcess } from 'node:child_process';
|
|
2
1
|
import type { Sharp } from 'sharp';
|
|
3
2
|
import type { MotionState } from '../camera/types.js';
|
|
4
3
|
export type DecoderFormat = 'yuv' | 'rgb';
|
|
@@ -7,9 +6,7 @@ export interface ImageMetadata {
|
|
|
7
6
|
height: number;
|
|
8
7
|
}
|
|
9
8
|
export interface AudioMetadata {
|
|
10
|
-
|
|
11
|
-
sampleRate: number;
|
|
12
|
-
format: string;
|
|
9
|
+
mimeType: 'audio/mpeg' | 'audio/wav' | 'audio/ogg';
|
|
13
10
|
}
|
|
14
11
|
export interface FrameMetadata {
|
|
15
12
|
format: DecoderFormat;
|
|
@@ -72,10 +69,9 @@ export interface VideoFrame {
|
|
|
72
69
|
export interface MotionFrame extends VideoFrame {
|
|
73
70
|
motion: MotionState;
|
|
74
71
|
}
|
|
75
|
-
export interface
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
cp: ChildProcess;
|
|
72
|
+
export interface AuthConfig {
|
|
73
|
+
user: string;
|
|
74
|
+
password: string;
|
|
79
75
|
}
|
|
80
76
|
export interface BaseFrameWorkerConfig {
|
|
81
77
|
frameWorkerId: string;
|
|
@@ -84,10 +80,7 @@ export interface BaseFrameWorkerConfig {
|
|
|
84
80
|
ffmpegPath: string;
|
|
85
81
|
logLevel: string;
|
|
86
82
|
disableTimestamps: boolean;
|
|
87
|
-
auth:
|
|
88
|
-
user: string;
|
|
89
|
-
pass: string;
|
|
90
|
-
};
|
|
83
|
+
auth: AuthConfig;
|
|
91
84
|
proxyEndpoints: string[];
|
|
92
85
|
fps: number;
|
|
93
86
|
resolution: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PLUGIN_STATUS } from '../plugins/types.js';
|
|
2
2
|
import { Subscribed } from '../utils/subscribed.js';
|
|
3
3
|
import type { CameraController } from '../camera/controller.js';
|
|
4
|
+
import type { AuthConfig } from './types.js';
|
|
4
5
|
export declare class FrameWorker extends Subscribed {
|
|
5
6
|
token: string;
|
|
6
7
|
name: string;
|
|
@@ -24,10 +25,7 @@ export declare class FrameWorker extends Subscribed {
|
|
|
24
25
|
private py;
|
|
25
26
|
private _status;
|
|
26
27
|
get status(): PLUGIN_STATUS;
|
|
27
|
-
constructor(cameraDevice: CameraController, proxyEndpoints: string[], auth:
|
|
28
|
-
user: string;
|
|
29
|
-
pass: string;
|
|
30
|
-
});
|
|
28
|
+
constructor(cameraDevice: CameraController, proxyEndpoints: string[], auth: AuthConfig);
|
|
31
29
|
start(): Promise<void>;
|
|
32
30
|
close(): Promise<void>;
|
|
33
31
|
restart(): Promise<void>;
|
|
@@ -36,7 +34,7 @@ export declare class FrameWorker extends Subscribed {
|
|
|
36
34
|
private restartWorker;
|
|
37
35
|
private killWorker;
|
|
38
36
|
private sendMessage;
|
|
39
|
-
private
|
|
37
|
+
private onChildMessage;
|
|
40
38
|
private setStatus;
|
|
41
39
|
private getLogPrefix;
|
|
42
40
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ProxySubscription } from './subscription.js';
|
|
2
|
+
import type { NatsConnection, RequestOptions } from 'nats';
|
|
3
|
+
import type { AuthConfig } from '../decoder/types.js';
|
|
4
|
+
export declare class ProxyConnection {
|
|
5
|
+
private name;
|
|
6
|
+
private servers;
|
|
7
|
+
private auth;
|
|
8
|
+
private publisher?;
|
|
9
|
+
private subscribers;
|
|
10
|
+
private closed;
|
|
11
|
+
constructor(name: string, servers: string[], auth: AuthConfig);
|
|
12
|
+
connect(): Promise<NatsConnection>;
|
|
13
|
+
subscribe(subject: string, skipListening?: boolean): ProxySubscription;
|
|
14
|
+
publish(subject: string, message: any): void;
|
|
15
|
+
request(subject: string, message: any, opts?: RequestOptions): Promise<any>;
|
|
16
|
+
close(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ProxyMessageStructure } from './types.js';
|
|
2
|
+
export interface DeserializedError {
|
|
3
|
+
name: string;
|
|
4
|
+
message: string;
|
|
5
|
+
stack: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class RemoteError extends Error {
|
|
8
|
+
constructor(error: DeserializedError, cause: Omit<ProxyMessageStructure, 'error'>);
|
|
9
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { CameraDeviceProxy } from './proxy/cameraDevice.js';
|
|
2
|
-
import { DeviceManagerProxy } from './proxy/
|
|
2
|
+
import { DeviceManagerProxy } from './proxy/deviceManager.js';
|
|
3
3
|
import { NatsServer } from './server.js';
|
|
4
|
-
import type { NatsConnection, Subscription } from 'nats';
|
|
5
4
|
import type { StateValues } from '../camera/types.js';
|
|
6
5
|
import type { CameraStorage } from '../polyglot/node/plugins/cameraStorage.js';
|
|
7
6
|
import type { MethodKeys, MethodType } from '../types.js';
|
|
7
|
+
import { ProxyConnection } from './connection.js';
|
|
8
|
+
import type { ProxySubscription } from './subscription.js';
|
|
8
9
|
import type { CameraDeviceListenerMessagePayload, DeviceManagerProxyEvents, PluginMap, ProxyAuth } from './types.js';
|
|
9
10
|
import type { WebsocketProxy } from './websocket.js';
|
|
10
11
|
export declare class ProxyServer {
|
|
@@ -14,8 +15,8 @@ export declare class ProxyServer {
|
|
|
14
15
|
cameraDeviceProxy?: CameraDeviceProxy;
|
|
15
16
|
websocketProxy?: WebsocketProxy;
|
|
16
17
|
server: NatsServer;
|
|
17
|
-
publisher?:
|
|
18
|
-
subscriber?:
|
|
18
|
+
publisher?: ProxyConnection;
|
|
19
|
+
subscriber?: ProxySubscription;
|
|
19
20
|
private pluginsService?;
|
|
20
21
|
private messageQueue?;
|
|
21
22
|
private initialized;
|
|
@@ -31,5 +32,6 @@ export declare class ProxyServer {
|
|
|
31
32
|
publishCameraEvent(cameraId: string, type: CameraDeviceListenerMessagePayload['type'], data?: any, targetId?: string): void;
|
|
32
33
|
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
34
|
requestStorageFn<T extends MethodKeys<CameraStorage>>(pluginId: string, cameraId: string, fn: T, args: Parameters<MethodType<CameraStorage, T>>, timeout?: number): Promise<Awaited<ReturnType<MethodType<CameraStorage, T>>>>;
|
|
35
|
+
private requestHandler;
|
|
34
36
|
private isCameraState;
|
|
35
37
|
}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BaseLogger } from '../camera/types.js';
|
|
2
|
+
import type { ProxyConnection } from './connection.js';
|
|
3
|
+
import type { ProxySubscription } from './subscription.js';
|
|
2
4
|
import type { ProxyMessageStructure } from './types.js';
|
|
3
5
|
export declare class MessageQueue {
|
|
4
6
|
private logger;
|
|
5
|
-
private
|
|
7
|
+
private type;
|
|
6
8
|
private publisher;
|
|
7
9
|
private subscriber;
|
|
10
|
+
private requestHandler;
|
|
8
11
|
private aborted;
|
|
9
12
|
private isProcessing;
|
|
10
13
|
private queue;
|
|
11
14
|
private pendingResponses;
|
|
12
|
-
constructor(
|
|
15
|
+
constructor(type: 'server' | 'client', publisher: ProxyConnection, subscriber: ProxySubscription, logger: BaseLogger, requestHandler: (message: ProxyMessageStructure) => void);
|
|
13
16
|
abortQueue(): void;
|
|
14
17
|
enqueue(message: ProxyMessageStructure): Promise<any>;
|
|
15
18
|
private processQueue;
|
|
16
|
-
private
|
|
19
|
+
private onMessage;
|
|
17
20
|
}
|
|
@@ -7,8 +7,8 @@ export declare class DeviceManagerProxy implements DeviceManagerServerProxyMetho
|
|
|
7
7
|
private pluginsService;
|
|
8
8
|
private messageQueue;
|
|
9
9
|
constructor(messageQueue: MessageQueue);
|
|
10
|
-
getCameraByName(cameraName: string
|
|
11
|
-
getCameraById(cameraId: string
|
|
10
|
+
getCameraByName(cameraName: string): Camera | undefined;
|
|
11
|
+
getCameraById(cameraId: string): Camera | void;
|
|
12
12
|
createCamera(cameraConfig: CameraConfig, pluginId: string): Promise<Camera>;
|
|
13
13
|
removeCameraByName(cameraName: string, pluginId: string): Promise<void>;
|
|
14
14
|
removeCameraById(cameraId: string, pluginId: string): Promise<void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import type { Msg, Subscription as NatsSubscription } from 'nats';
|
|
3
|
+
export declare interface ProxySubscription {
|
|
4
|
+
on(event: 'message', listener: (message: Msg) => void): this;
|
|
5
|
+
emit(event: 'message', message: Msg): boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class ProxySubscription extends EventEmitter implements ProxySubscription {
|
|
8
|
+
readonly subscriber: NatsSubscription;
|
|
9
|
+
constructor(subscriber: NatsSubscription);
|
|
10
|
+
listen(): Promise<void>;
|
|
11
|
+
close(): void;
|
|
12
|
+
}
|
|
@@ -1,26 +1,19 @@
|
|
|
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 { AuthConfig } from '../decoder/types.js';
|
|
4
5
|
import type { AudioDetectionPlugin } from '../plugins/interfaces/audioDetection.js';
|
|
5
6
|
import type { BasePlugin } from '../plugins/interfaces/base.js';
|
|
6
7
|
import type { MotionDetectionPlugin } from '../plugins/interfaces/motionDetection.js';
|
|
7
8
|
import type { ObjectDetectionPlugin } from '../plugins/interfaces/objectDetection.js';
|
|
8
9
|
import type { CameraExtension } from '../plugins/types.js';
|
|
9
10
|
import type { IceServer } from '../services/config/types.js';
|
|
10
|
-
import type {
|
|
11
|
+
import type { DeserializedError, RemoteError } from './error.js';
|
|
11
12
|
export interface QueueItem {
|
|
12
13
|
message: ProxyMessageStructure;
|
|
13
14
|
resolve: (response: any) => void;
|
|
14
15
|
reject: (error: RemoteError) => void;
|
|
15
16
|
}
|
|
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'>);
|
|
23
|
-
}
|
|
24
17
|
export interface ProxyMessageStructure {
|
|
25
18
|
requestId: string;
|
|
26
19
|
cameraId?: string;
|
|
@@ -38,27 +31,14 @@ export interface ProxyMessageStructure {
|
|
|
38
31
|
error?: DeserializedError;
|
|
39
32
|
}
|
|
40
33
|
export interface ProxyAuth {
|
|
41
|
-
cluster:
|
|
42
|
-
|
|
43
|
-
pass: string;
|
|
44
|
-
};
|
|
45
|
-
server: {
|
|
46
|
-
user: string;
|
|
47
|
-
pass: string;
|
|
48
|
-
};
|
|
34
|
+
cluster: AuthConfig;
|
|
35
|
+
server: AuthConfig;
|
|
49
36
|
}
|
|
50
37
|
export type WebsocketClientProxyEvent = 'updateDevice' | 'updateState';
|
|
51
38
|
export interface StreamPayload {
|
|
52
39
|
type: Exclude<VideoStreamingMode, 'webrtc' | 'webrtc/tcp'> | 'webrtc/offer' | 'webrtc/candidate';
|
|
53
40
|
value: string;
|
|
54
41
|
}
|
|
55
|
-
export interface DeviceManagerServerProxyMethods {
|
|
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>;
|
|
61
|
-
}
|
|
62
42
|
export interface CameraDeviceProxyMethods {
|
|
63
43
|
connect(): void;
|
|
64
44
|
disconnect(): void;
|
|
@@ -75,10 +55,23 @@ export interface CameraDeviceProxyMethods {
|
|
|
75
55
|
updateCameraSource(sourceId: string, source: Partial<CameraConfigInputSettings>): Promise<void>;
|
|
76
56
|
removeCameraSource(sourceId: string): Promise<void>;
|
|
77
57
|
}
|
|
78
|
-
export
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
58
|
+
export interface CameraDeviceListenerStatePayload<K extends keyof StateValues> {
|
|
59
|
+
stateName: K;
|
|
60
|
+
data: {
|
|
61
|
+
newEvent: StateValues[K];
|
|
62
|
+
oldEvent: StateValues[K];
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export interface CameraDeviceListenerMessagePayload {
|
|
66
|
+
type: 'removed' | 'updated' | 'cameraState' | 'prebufferState';
|
|
67
|
+
data?: any;
|
|
68
|
+
}
|
|
69
|
+
export interface DeviceManagerServerProxyMethods {
|
|
70
|
+
createCamera(camera: CameraConfig): Promise<Camera>;
|
|
71
|
+
getCameraByName(name: string): Camera | void;
|
|
72
|
+
getCameraById(id: string): Camera | void;
|
|
73
|
+
removeCameraByName(name: string): Promise<void>;
|
|
74
|
+
removeCameraById(id: string): Promise<void>;
|
|
82
75
|
}
|
|
83
76
|
export interface DeviceManagerProxyMethods {
|
|
84
77
|
getCameraByName(cameraName: string): Promise<CameraDevice | undefined>;
|
|
@@ -87,7 +80,10 @@ export interface DeviceManagerProxyMethods {
|
|
|
87
80
|
removeCameraByName(cameraName: string): Promise<void>;
|
|
88
81
|
removeCameraById(cameraId: string): Promise<void>;
|
|
89
82
|
}
|
|
90
|
-
export
|
|
83
|
+
export interface DeviceManagerListenerMessagePayload {
|
|
84
|
+
type: keyof DeviceManagerProxyEventCallbacks;
|
|
85
|
+
data: DeviceManagerProxyEvents['cameraSelected'] | DeviceManagerProxyEvents['cameraDeselected'];
|
|
86
|
+
}
|
|
91
87
|
export interface DeviceManagerProxyEvents {
|
|
92
88
|
cameraSelected: {
|
|
93
89
|
camera: Camera;
|
|
@@ -112,14 +108,3 @@ export interface PluginMap {
|
|
|
112
108
|
objectDetection: ObjectDetectionPlugin;
|
|
113
109
|
audioDetection: AudioDetectionPlugin;
|
|
114
110
|
}
|
|
115
|
-
export interface CameraDeviceListenerStatePayload<K extends keyof StateValues> {
|
|
116
|
-
stateName: K;
|
|
117
|
-
data: {
|
|
118
|
-
newEvent: StateValues[K];
|
|
119
|
-
oldEvent: StateValues[K];
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
export interface CameraDeviceListenerMessagePayload {
|
|
123
|
-
type: 'removed' | 'updated' | 'cameraState' | 'prebufferState';
|
|
124
|
-
data?: any;
|
|
125
|
-
}
|
|
@@ -12,14 +12,14 @@ export declare class PluginManager {
|
|
|
12
12
|
searchPaths: Set<string>;
|
|
13
13
|
constructor();
|
|
14
14
|
static isQualifiedPluginIdentifier(pluginName: string): boolean;
|
|
15
|
-
static extractPluginScope(pluginName: string): string;
|
|
15
|
+
static extractPluginScope(pluginName: string): string | undefined;
|
|
16
16
|
static extractPluginName(pluginName: string): string;
|
|
17
17
|
static transformDisplaName(pluginName: string): string;
|
|
18
18
|
static loadPackageJSON(installPath: string): IPackageJson;
|
|
19
19
|
initializeInstalledPlugins(): Promise<void>;
|
|
20
20
|
initializeInstalledPlugin(plugin: Plugin): Promise<void>;
|
|
21
|
-
loadPlugin(absolutePath: string
|
|
22
|
-
removePlugin(plugin: Plugin,
|
|
21
|
+
loadPlugin(absolutePath: string): Promise<Plugin>;
|
|
22
|
+
removePlugin(plugin: Plugin, removeStorage?: boolean): Promise<void>;
|
|
23
23
|
startPluginChild(pluginName: string): Promise<void>;
|
|
24
24
|
stopPluginChild(pluginName: string): Promise<void>;
|
|
25
25
|
initializePlugins(): Promise<void>;
|
|
@@ -27,6 +27,4 @@ export declare class PluginManager {
|
|
|
27
27
|
private loadInstalledPlugins;
|
|
28
28
|
private removeOrphanedPlugins;
|
|
29
29
|
private handleDisabledPlugins;
|
|
30
|
-
private loadDefaultPaths;
|
|
31
|
-
private addNpmPrefixToSearchPaths;
|
|
32
30
|
}
|
|
@@ -1,42 +1,33 @@
|
|
|
1
|
-
import { PluginConfigService } from '../polyglot/node/plugins/config.js';
|
|
2
1
|
import { PythonInstaller } from '../utils/pythonInstaller.js';
|
|
3
|
-
import type { PluginConstructor } from '../api.js';
|
|
4
2
|
import type { CameraUiPlugin, IPackageJson } from '../api/types/index.js';
|
|
5
3
|
import type { PluginContract } from './types.js';
|
|
6
|
-
export interface Context {
|
|
7
|
-
engines?: Record<string, string>;
|
|
8
|
-
dependencies?: Record<string, string>;
|
|
9
|
-
}
|
|
10
4
|
export declare class Plugin {
|
|
11
5
|
private logger;
|
|
12
6
|
private configService;
|
|
13
7
|
private _disabled;
|
|
14
8
|
private _info;
|
|
15
9
|
private _contract;
|
|
16
|
-
|
|
10
|
+
private loadContext;
|
|
17
11
|
readonly id: string;
|
|
12
|
+
readonly main: string;
|
|
18
13
|
readonly pluginName: string;
|
|
19
14
|
readonly displayName: string;
|
|
20
15
|
readonly scope?: string;
|
|
21
16
|
readonly isPython: boolean;
|
|
22
|
-
readonly isESM: boolean;
|
|
23
17
|
readonly isSymLink: boolean;
|
|
24
18
|
readonly installPath: string;
|
|
25
|
-
readonly pythonInstallPath: string;
|
|
26
19
|
readonly configFile: string;
|
|
27
20
|
readonly storagePath: string;
|
|
28
21
|
readonly py: PythonInstaller;
|
|
29
|
-
readonly config: PluginConfigService;
|
|
30
|
-
pluginConstructor?: PluginConstructor;
|
|
31
|
-
private loadContext?;
|
|
32
22
|
get contract(): PluginContract;
|
|
33
23
|
get info(): CameraUiPlugin;
|
|
34
24
|
set info(value: CameraUiPlugin);
|
|
35
25
|
get disabled(): boolean;
|
|
36
26
|
set disabled(value: boolean);
|
|
37
|
-
constructor(pluginName: string, installPath: string, packageJSON: IPackageJson, pluginId: string, scope?: string
|
|
27
|
+
constructor(pluginName: string, installPath: string, packageJSON: IPackageJson, pluginId: string, scope?: string);
|
|
38
28
|
load(): Promise<void>;
|
|
39
29
|
reparsePackageJson(): void;
|
|
40
30
|
private parsePackageJson;
|
|
41
31
|
private parseContract;
|
|
32
|
+
private getMainFile;
|
|
42
33
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { Camera } from '../api/database/types.js';
|
|
2
2
|
import type { Detection } from '../camera/types.js';
|
|
3
|
+
export interface Context {
|
|
4
|
+
engines?: Record<string, string>;
|
|
5
|
+
dependencies?: Record<string, string>;
|
|
6
|
+
}
|
|
3
7
|
export interface SchemaConfig {
|
|
4
8
|
rootSchema: PluginRootSchema;
|
|
5
9
|
config: Record<string, any>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PluginJsonSchema, PluginJsonSchemaForm, SchemaConfig } from '../../../plugins/types.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { API } from './pluginApi.js';
|
|
3
3
|
export declare class CameraStorage {
|
|
4
4
|
private cameraId;
|
|
5
5
|
private instance;
|
|
@@ -8,7 +8,7 @@ export declare class CameraStorage {
|
|
|
8
8
|
private _schema;
|
|
9
9
|
private _values;
|
|
10
10
|
get values(): Record<string, any>;
|
|
11
|
-
constructor(api:
|
|
11
|
+
constructor(api: API, instance: any, cameraId: string, schema?: PluginJsonSchemaForm);
|
|
12
12
|
/**
|
|
13
13
|
* Initialize the storage.
|
|
14
14
|
* This will load the configuration from the database.
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
|
-
import {
|
|
2
|
+
import { PluginConfigService } from './configService.js';
|
|
3
3
|
import { StorageController } from './storageController.js';
|
|
4
|
+
import type { AuthConfig } from '../../../decoder/types.js';
|
|
4
5
|
import type { BasePlugin } from '../../../plugins/interfaces/base.js';
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
export declare interface
|
|
6
|
+
import type { PluginInfo } from '../../../plugins/types.js';
|
|
7
|
+
import type { PluginLogger } from './pluginLogger.js';
|
|
8
|
+
import type { DeviceManager } from './proxy/deviceManager.js';
|
|
9
|
+
export declare interface PluginAPI {
|
|
9
10
|
on(event: 'finishLaunching', listener: () => void): this;
|
|
10
11
|
on(event: 'shutdown', listener: () => void): this;
|
|
11
12
|
once(event: 'finishLaunching', listener: () => void): this;
|
|
@@ -21,17 +22,13 @@ export declare interface API {
|
|
|
21
22
|
readonly storagePath: string;
|
|
22
23
|
readonly configFile: string;
|
|
23
24
|
}
|
|
24
|
-
export declare class
|
|
25
|
-
private initialized;
|
|
25
|
+
export declare class API extends EventEmitter implements PluginAPI {
|
|
26
26
|
readonly deviceManager: DeviceManager;
|
|
27
27
|
readonly storageController: StorageController;
|
|
28
28
|
readonly configService: PluginConfigService;
|
|
29
29
|
readonly storagePath: string;
|
|
30
30
|
readonly configFile: string;
|
|
31
31
|
readonly plugin: BasePlugin;
|
|
32
|
-
constructor(plugin:
|
|
33
|
-
|
|
34
|
-
pass: string;
|
|
35
|
-
});
|
|
36
|
-
init(): Promise<void>;
|
|
32
|
+
constructor(plugin: PluginInfo, storagePath: string, configFile: string, logger: PluginLogger, proxyEndpoints: string[], auth: AuthConfig);
|
|
33
|
+
private loadModule;
|
|
37
34
|
}
|