@camera.ui/browser 0.0.82 → 0.0.84
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 +7 -7
- 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 +115 -88
- package/dist/types/server/src/api/schemas/plugins.schema.d.ts +29 -32
- package/dist/types/server/src/api/schemas/users.schema.d.ts +11 -6
- package/dist/types/server/src/api/services/cameras.service.d.ts +7 -5
- package/dist/types/server/src/api/types/index.d.ts +13 -3
- package/dist/types/server/src/api/websocket/nsp/metrics.d.ts +4 -22
- package/dist/types/server/src/api/websocket/nsp/status.d.ts +4 -15
- package/dist/types/server/src/api/websocket/types.d.ts +25 -64
- 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/streaming/werift-session.d.ts +10 -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 +4 -7
- 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/cameraDevice.d.ts +1 -1
- package/dist/types/server/src/nats/proxy/deviceManager.d.ts +3 -3
- 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 +14 -41
- package/dist/types/server/src/plugins/worker.d.ts +1 -1
- package/dist/types/server/src/polyglot/node/plugins/cameraStorage.d.ts +10 -11
- 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/schema.d.ts +22 -9
- package/dist/types/server/src/polyglot/node/plugins/storageController.d.ts +5 -5
- package/dist/types/server/src/services/config/index.d.ts +9 -6
- package/dist/types/server/src/services/config/types.d.ts +5 -5
- 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,13 +1,13 @@
|
|
|
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
|
+
readonly frameWorkerId: string;
|
|
6
7
|
name: string;
|
|
7
8
|
private readonly clients;
|
|
8
9
|
private subject;
|
|
9
10
|
private ipcSubject;
|
|
10
|
-
private frameWorkerId;
|
|
11
11
|
private publisher?;
|
|
12
12
|
private subscriber?;
|
|
13
13
|
private logger;
|
|
@@ -24,10 +24,7 @@ export declare class FrameWorker extends Subscribed {
|
|
|
24
24
|
private py;
|
|
25
25
|
private _status;
|
|
26
26
|
get status(): PLUGIN_STATUS;
|
|
27
|
-
constructor(cameraDevice: CameraController, proxyEndpoints: string[], auth:
|
|
28
|
-
user: string;
|
|
29
|
-
pass: string;
|
|
30
|
-
});
|
|
27
|
+
constructor(cameraDevice: CameraController, proxyEndpoints: string[], auth: AuthConfig);
|
|
31
28
|
start(): Promise<void>;
|
|
32
29
|
close(): Promise<void>;
|
|
33
30
|
restart(): Promise<void>;
|
|
@@ -36,7 +33,7 @@ export declare class FrameWorker extends Subscribed {
|
|
|
36
33
|
private restartWorker;
|
|
37
34
|
private killWorker;
|
|
38
35
|
private sendMessage;
|
|
39
|
-
private
|
|
36
|
+
private onChildMessage;
|
|
40
37
|
private setStatus;
|
|
41
38
|
private getLogPrefix;
|
|
42
39
|
}
|
|
@@ -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
|
+
import { ProxyConnection } from './connection.js';
|
|
1
2
|
import { CameraDeviceProxy } from './proxy/cameraDevice.js';
|
|
2
|
-
import { DeviceManagerProxy } from './proxy/
|
|
3
|
+
import { DeviceManagerProxy } from './proxy/deviceManager.js';
|
|
3
4
|
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 { CameraStorage } from '../polyglot/node/plugins/cameraStorage.js';
|
|
7
7
|
import type { MethodKeys, MethodType } from '../types.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
|
}
|
|
@@ -26,5 +26,5 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
|
|
|
26
26
|
cameraState: boolean;
|
|
27
27
|
};
|
|
28
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>>>>;
|
|
29
|
-
|
|
29
|
+
requestHandler(message: ProxyMessageStructure): Promise<void | ProxyMessageStructure>;
|
|
30
30
|
}
|
|
@@ -7,10 +7,10 @@ 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>;
|
|
15
|
-
|
|
15
|
+
requestHandler(message: ProxyMessageStructure): Promise<void | ProxyMessageStructure>;
|
|
16
16
|
}
|
|
@@ -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,7 +1,11 @@
|
|
|
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
|
-
rootSchema:
|
|
8
|
+
rootSchema: RootSchema;
|
|
5
9
|
config: Record<string, any>;
|
|
6
10
|
}
|
|
7
11
|
export declare const PLUGIN_IDENTIFIER_PATTERN: RegExp;
|
|
@@ -64,7 +68,7 @@ export interface ProcessResponse {
|
|
|
64
68
|
type: PLUGIN_STATUS;
|
|
65
69
|
data?: ProcessErrorMessage;
|
|
66
70
|
}
|
|
67
|
-
export type JsonSchemaType = 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
71
|
+
export type JsonSchemaType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'button';
|
|
68
72
|
export interface JsonBaseSchema<T = any> {
|
|
69
73
|
type: JsonSchemaType;
|
|
70
74
|
key?: string;
|
|
@@ -77,8 +81,6 @@ export interface JsonBaseSchema<T = any> {
|
|
|
77
81
|
group?: string;
|
|
78
82
|
defaultValue?: T;
|
|
79
83
|
store?: boolean;
|
|
80
|
-
}
|
|
81
|
-
export interface PluginJsonBaseSchema<T = any> extends JsonBaseSchema<T> {
|
|
82
84
|
onSet?: (newValue: any, oldValue: any) => Promise<void>;
|
|
83
85
|
onGet?: () => Promise<any>;
|
|
84
86
|
}
|
|
@@ -88,76 +90,47 @@ export interface JsonSchemaString extends JsonBaseSchema<string> {
|
|
|
88
90
|
minLength?: number;
|
|
89
91
|
maxLength?: number;
|
|
90
92
|
}
|
|
91
|
-
export interface PluginJsonSchemaString extends PluginJsonBaseSchema<string> {
|
|
92
|
-
type: 'string';
|
|
93
|
-
format?: 'date-time' | 'date' | 'time' | 'email' | 'uuid' | 'ipv4' | 'ipv6' | 'password' | 'qrCode';
|
|
94
|
-
minLength?: number;
|
|
95
|
-
maxLength?: number;
|
|
96
|
-
}
|
|
97
93
|
export interface JsonSchemaNumber extends JsonBaseSchema<number> {
|
|
98
94
|
type: 'number';
|
|
99
95
|
minimum?: number;
|
|
100
96
|
maximum?: number;
|
|
101
97
|
step?: number;
|
|
102
98
|
}
|
|
103
|
-
export interface PluginJsonSchemaNumber extends PluginJsonBaseSchema<number> {
|
|
104
|
-
type: 'number';
|
|
105
|
-
minimum?: number;
|
|
106
|
-
maximum?: number;
|
|
107
|
-
step?: number;
|
|
108
|
-
}
|
|
109
99
|
export interface JsonSchemaBoolean extends JsonBaseSchema<boolean> {
|
|
110
100
|
type: 'boolean';
|
|
111
101
|
}
|
|
112
|
-
export interface PluginJsonSchemaBoolean extends PluginJsonBaseSchema<boolean> {
|
|
113
|
-
type: 'boolean';
|
|
114
|
-
}
|
|
115
102
|
export interface JsonSchemaEnum extends JsonBaseSchema<string> {
|
|
116
103
|
type: 'string';
|
|
117
104
|
enum: string[];
|
|
118
105
|
multiple?: boolean;
|
|
119
106
|
}
|
|
120
|
-
export interface PluginJsonSchemaEnum extends PluginJsonBaseSchema<string> {
|
|
121
|
-
type: 'string';
|
|
122
|
-
enum: string[];
|
|
123
|
-
multiple?: boolean;
|
|
124
|
-
}
|
|
125
107
|
export interface JsonSchemaObject extends JsonBaseSchema {
|
|
126
108
|
type: 'object';
|
|
127
109
|
opened?: boolean;
|
|
128
110
|
properties?: JsonSchemaForm;
|
|
129
111
|
}
|
|
130
|
-
export interface PluginJsonSchemaObject extends PluginJsonBaseSchema {
|
|
131
|
-
type: 'object';
|
|
132
|
-
opened?: boolean;
|
|
133
|
-
properties?: PluginJsonSchemaForm;
|
|
134
|
-
}
|
|
135
|
-
export interface JsonSchemaObjectWithButtons extends JsonSchemaObject {
|
|
136
|
-
buttons: [JsonSchemaButton, JsonSchemaButton?];
|
|
137
|
-
}
|
|
138
112
|
export interface JsonSchemaArray extends JsonBaseSchema {
|
|
139
113
|
type: 'array';
|
|
140
114
|
opened?: boolean;
|
|
141
115
|
items?: JsonSchema;
|
|
142
116
|
}
|
|
143
|
-
export interface JsonSchemaButton {
|
|
117
|
+
export interface JsonSchemaButton extends JsonBaseSchema {
|
|
118
|
+
type: 'button';
|
|
119
|
+
}
|
|
120
|
+
export interface JsonSchemaObjectButton {
|
|
144
121
|
label: string;
|
|
145
122
|
onSubmit: string;
|
|
146
123
|
}
|
|
147
|
-
export
|
|
148
|
-
|
|
124
|
+
export interface JsonSchemaObjectWithButtons extends JsonSchemaObject {
|
|
125
|
+
buttons: JsonSchemaObjectButton[];
|
|
126
|
+
}
|
|
127
|
+
export type JsonSchema = JsonSchemaString | JsonSchemaNumber | JsonSchemaBoolean | JsonSchemaEnum | JsonSchemaObject | JsonSchemaObjectWithButtons | JsonSchemaArray | JsonSchemaButton;
|
|
149
128
|
export interface JsonSchemaForm {
|
|
150
129
|
[key: string]: JsonSchema;
|
|
151
130
|
}
|
|
152
|
-
export interface PluginJsonSchemaForm {
|
|
153
|
-
[key: string]: PluginJsonSchema;
|
|
154
|
-
}
|
|
155
131
|
export interface RootSchema {
|
|
156
132
|
schema: JsonSchemaForm;
|
|
157
133
|
}
|
|
158
|
-
export interface PluginRootSchema {
|
|
159
|
-
schema: PluginJsonSchemaForm;
|
|
160
|
-
}
|
|
161
134
|
export interface ToastMessage {
|
|
162
135
|
type: 'info' | 'success' | 'warning' | 'error';
|
|
163
136
|
message: string;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
export declare class CameraStorage {
|
|
1
|
+
import type { JsonSchema, JsonSchemaForm, SchemaConfig } from '../../../plugins/types.js';
|
|
2
|
+
import type { API } from './pluginApi.js';
|
|
3
|
+
export declare class CameraStorage<T extends Record<string, any> = Record<string, any>> {
|
|
4
4
|
private cameraId;
|
|
5
5
|
private instance;
|
|
6
6
|
private api;
|
|
7
7
|
private db;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
constructor(api: PluginAPI, instance: any, cameraId: string, schema?: PluginJsonSchemaForm);
|
|
8
|
+
schema: JsonSchemaForm;
|
|
9
|
+
values: T;
|
|
10
|
+
constructor(api: API, instance: any, cameraId: string, schema?: JsonSchemaForm);
|
|
12
11
|
/**
|
|
13
12
|
* Initialize the storage.
|
|
14
13
|
* This will load the configuration from the database.
|
|
@@ -54,7 +53,7 @@ export declare class CameraStorage {
|
|
|
54
53
|
*
|
|
55
54
|
* @param newConfig - The new configuration to set.
|
|
56
55
|
*/
|
|
57
|
-
setConfig(newConfig:
|
|
56
|
+
setConfig(newConfig: T): Promise<void>;
|
|
58
57
|
/**
|
|
59
58
|
* Add a new schema to the existing schema.
|
|
60
59
|
* It will also add the value to the configuration.
|
|
@@ -63,8 +62,8 @@ export declare class CameraStorage {
|
|
|
63
62
|
* @param schema - The new schema to add.
|
|
64
63
|
* @param path - The path to the schema to add.
|
|
65
64
|
*/
|
|
66
|
-
addSchema(schema:
|
|
67
|
-
addSchema(path: string, schema:
|
|
65
|
+
addSchema(schema: JsonSchemaForm): Promise<void>;
|
|
66
|
+
addSchema(path: string, schema: JsonSchema): Promise<void>;
|
|
68
67
|
/**
|
|
69
68
|
* Remove a schema by its config path/key from the existing schema.
|
|
70
69
|
* It will also remove the value from the configuration.
|
|
@@ -81,7 +80,7 @@ export declare class CameraStorage {
|
|
|
81
80
|
* @param path - The path to the schema to change.
|
|
82
81
|
* @param schema - The new schema to set.
|
|
83
82
|
*/
|
|
84
|
-
changeSchema(path: string, newSchema: Partial<
|
|
83
|
+
changeSchema(path: string, newSchema: Partial<JsonSchema>): Promise<void>;
|
|
85
84
|
/**
|
|
86
85
|
* Get a schema by its config path/key.
|
|
87
86
|
*
|
|
@@ -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
|
}
|
|
@@ -5,13 +5,13 @@ import { CameraPTZInterface } from '../../../../camera/interfaces/ptz.js';
|
|
|
5
5
|
import { MotionFrame, VideoFrame } from '../../../../camera/videoFrame.js';
|
|
6
6
|
import type { Camera } from '../../../../api/database/types.js';
|
|
7
7
|
import type { CameraConfigInputSettings, CameraDelegates, CameraSource, SetValues } from '../../../../camera/types.js';
|
|
8
|
-
import type { VideoFrame as VideoFrameImp } from '../../../../decoder/types.js';
|
|
8
|
+
import type { AuthConfig, VideoFrame as VideoFrameImp } from '../../../../decoder/types.js';
|
|
9
9
|
import type { CameraDeviceProxyMethods } from '../../../../nats/types.js';
|
|
10
10
|
import type { PluginInfo } from '../../../../plugins/types.js';
|
|
11
11
|
import type { IceServer } from '../../../../services/config/types.js';
|
|
12
12
|
import type { MethodKeys, MethodType } from '../../../../types.js';
|
|
13
|
-
import type {
|
|
14
|
-
import type { PluginLogger } from '../
|
|
13
|
+
import type { API } from '../pluginApi.js';
|
|
14
|
+
import type { PluginLogger } from '../pluginLogger.js';
|
|
15
15
|
export declare class CameraDeviceProxy extends CameraDevice {
|
|
16
16
|
private api;
|
|
17
17
|
private initialized;
|
|
@@ -39,14 +39,11 @@ export declare class CameraDeviceProxy extends CameraDevice {
|
|
|
39
39
|
private auth;
|
|
40
40
|
private proxyEndpoints;
|
|
41
41
|
private plugin;
|
|
42
|
-
cameraDelegate: CameraInterface;
|
|
42
|
+
protected cameraDelegate: CameraInterface;
|
|
43
|
+
protected ptzDelegate: CameraPTZInterface;
|
|
43
44
|
protected prebufferDelegate: CameraPrebufferInterface;
|
|
44
|
-
ptzDelegate: CameraPTZInterface;
|
|
45
45
|
get sources(): CameraSource[];
|
|
46
|
-
constructor(api:
|
|
47
|
-
user: string;
|
|
48
|
-
pass: string;
|
|
49
|
-
});
|
|
46
|
+
constructor(api: API, logger: PluginLogger, camera: Camera, plugin: PluginInfo, proxyEndpoints: string[], auth: AuthConfig);
|
|
50
47
|
init(): Promise<void>;
|
|
51
48
|
setDelegate<T extends keyof CameraDelegates>(name: T, delegate: CameraDelegates[T]): void;
|
|
52
49
|
connect(): Promise<void>;
|
|
@@ -68,8 +65,8 @@ export declare class CameraDeviceProxy extends CameraDevice {
|
|
|
68
65
|
private closeFrameSubscriber;
|
|
69
66
|
private closeMotionFrameSubsciber;
|
|
70
67
|
private requestHandler;
|
|
71
|
-
private
|
|
72
|
-
private
|
|
68
|
+
private onProxyMessage;
|
|
69
|
+
private onSignalingMessage;
|
|
73
70
|
onRequest<T extends MethodKeys<CameraDeviceProxyMethods>>(client: 'cameraFn', fn: T, args?: Parameters<MethodType<CameraDeviceProxyMethods, T>>, timeout?: number): Promise<Awaited<ReturnType<MethodType<CameraDeviceProxyMethods, T>>>>;
|
|
74
71
|
onRequest<T extends keyof CameraDelegates, K extends MethodKeys<CameraDelegates[T]>>(client: T, fn: K, args: Parameters<MethodType<CameraDelegates[T], K>>, timeout?: number): Promise<Awaited<ReturnType<MethodType<CameraDelegates[T], K>>>>;
|
|
75
72
|
}
|