@camera.ui/browser 0.0.90 → 0.0.92
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 +6 -6
- package/dist/types/packages/client/browser/src/proxy/coreManager.d.ts +2 -1
- package/dist/types/packages/client/browser/src/proxy/deviceManager.d.ts +1 -2
- package/dist/types/packages/client/browser/src/types.d.ts +11 -3
- package/dist/types/packages/common/src/messaging/index.d.ts +48 -0
- package/dist/types/packages/common/src/nats/index.d.ts +30 -0
- package/dist/types/{server/src → packages/plugineer/src/polyglot/node}/camera/index.d.ts +4 -9
- package/dist/types/packages/plugineer/src/polyglot/node/camera/interfaces/camera.d.ts +8 -0
- package/dist/types/packages/plugineer/src/polyglot/node/camera/interfaces/prebuffer.d.ts +9 -0
- package/dist/types/{server/src → packages/plugineer/src/polyglot/node}/camera/interfaces/ptz.d.ts +3 -5
- package/dist/types/{server/src → packages/plugineer/src/polyglot/node}/camera/iou.d.ts +1 -1
- package/dist/types/{server/src → packages/plugineer/src/polyglot/node}/camera/polygon.d.ts +1 -2
- package/dist/types/{server → packages/plugineer}/src/polyglot/node/plugins/schema.d.ts +2 -2
- package/dist/types/server/src/api/database/constants.d.ts +8 -0
- package/dist/types/server/src/api/database/index.d.ts +0 -8
- package/dist/types/server/src/api/database/types.d.ts +6 -6
- package/dist/types/server/src/api/schemas/cameras.schema.d.ts +117 -117
- package/dist/types/server/src/api/schemas/config.schema.d.ts +6 -6
- package/dist/types/server/src/api/schemas/go2rtc.schema.d.ts +84 -84
- package/dist/types/server/src/api/schemas/users.schema.d.ts +150 -150
- package/dist/types/server/src/api/types/index.d.ts +1 -1
- package/dist/types/server/src/api/websocket/nsp/metrics.d.ts +5 -1
- package/dist/types/server/src/api.d.ts +1 -7
- package/dist/types/server/src/camera/controller.d.ts +4 -9
- package/dist/types/server/src/camera/types.d.ts +27 -22
- package/dist/types/server/src/decoder/worker.d.ts +1 -1
- package/dist/types/server/src/nats/index.d.ts +3 -4
- package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +3 -4
- package/dist/types/server/src/nats/proxy/coreManager.d.ts +3 -3
- package/dist/types/server/src/nats/proxy/deviceManager.d.ts +5 -5
- package/dist/types/server/src/nats/types.d.ts +6 -42
- package/dist/types/server/src/plugins/interfaces/base.d.ts +1 -1
- package/dist/types/server/src/plugins/plugin.d.ts +1 -1
- package/dist/types/server/src/plugins/types.d.ts +36 -3
- package/dist/types/server/src/services/config/index.d.ts +3 -2
- package/dist/types/server/src/services/logger/index.d.ts +4 -16
- package/dist/types/shared/types/index.d.ts +5 -3
- package/package.json +5 -3
- package/dist/types/server/src/camera/device.d.ts +0 -29
- package/dist/types/server/src/camera/interfaces/camera.d.ts +0 -10
- package/dist/types/server/src/camera/interfaces/prebuffer.d.ts +0 -11
- package/dist/types/server/src/camera/streaming/peer-connection.d.ts +0 -54
- package/dist/types/server/src/camera/streaming/webrtc-connection.d.ts +0 -35
- package/dist/types/server/src/camera/streaming/werift-session.d.ts +0 -41
- package/dist/types/server/src/camera/videoFrame.d.ts +0 -24
- package/dist/types/server/src/nats/connection.d.ts +0 -17
- package/dist/types/server/src/nats/constants.d.ts +0 -1
- package/dist/types/server/src/nats/error.d.ts +0 -9
- package/dist/types/server/src/nats/messageQueue.d.ts +0 -20
- package/dist/types/server/src/nats/subscription.d.ts +0 -12
- package/dist/types/server/src/polyglot/node/plugins/cameraStorage.d.ts +0 -107
- package/dist/types/server/src/polyglot/node/plugins/configService.d.ts +0 -104
- package/dist/types/server/src/polyglot/node/plugins/pluginApi.d.ts +0 -35
- package/dist/types/server/src/polyglot/node/plugins/pluginLogger.d.ts +0 -18
- package/dist/types/server/src/polyglot/node/plugins/proxy/cameraDevice.d.ts +0 -69
- package/dist/types/server/src/polyglot/node/plugins/proxy/coreManager.d.ts +0 -40
- package/dist/types/server/src/polyglot/node/plugins/proxy/deviceManager.d.ts +0 -47
- package/dist/types/server/src/polyglot/node/plugins/storageController.d.ts +0 -30
- package/dist/types/server/src/utils/ffmpeg.d.ts +0 -2
- package/dist/types/server/src/utils/network.d.ts +0 -12
- package/dist/types/server/src/utils/npm.d.ts +0 -1
- package/dist/types/server/src/utils/pythonInstaller.d.ts +0 -48
- package/dist/types/server/src/utils/utils.d.ts +0 -10
- /package/dist/types/{server/src/utils/packer.d.ts → packages/common/src/packer/index.d.ts} +0 -0
- /package/dist/types/{server → packages/common}/src/utils/subscribed.d.ts +0 -0
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { ReplaySubject, Subject } from 'rxjs';
|
|
2
|
-
import { Subscribed } from '../../utils/subscribed.js';
|
|
3
|
-
import type { Observable } from 'rxjs';
|
|
4
|
-
import type { RtpPacket } from 'werift';
|
|
5
|
-
import type { CameraDevice } from '../device.js';
|
|
6
|
-
import type { BaseLogger } from '../types.js';
|
|
7
|
-
import type { StreamingConnectionOptions } from './peer-connection.js';
|
|
8
|
-
export declare class WebrtcConnection extends Subscribed {
|
|
9
|
-
readonly onCameraConnected: ReplaySubject<void>;
|
|
10
|
-
readonly onCallAnswered: ReplaySubject<string>;
|
|
11
|
-
readonly onCallEnded: ReplaySubject<void>;
|
|
12
|
-
readonly onError: ReplaySubject<void>;
|
|
13
|
-
readonly onMessage: ReplaySubject<{
|
|
14
|
-
method: string;
|
|
15
|
-
}>;
|
|
16
|
-
readonly onWsOpen: Observable<unknown>;
|
|
17
|
-
readonly onAudioRtp: Subject<RtpPacket>;
|
|
18
|
-
readonly onVideoRtp: Subject<RtpPacket>;
|
|
19
|
-
private readonly pc;
|
|
20
|
-
private readonly ws;
|
|
21
|
-
private readonly onOfferSent;
|
|
22
|
-
private hasEnded;
|
|
23
|
-
private cameraDevice;
|
|
24
|
-
private sourceName;
|
|
25
|
-
private logger;
|
|
26
|
-
private get logPrefix();
|
|
27
|
-
constructor(cameraDevice: CameraDevice, sourceName: string, logger: BaseLogger, options: StreamingConnectionOptions);
|
|
28
|
-
sendAudioPacket(rtp: RtpPacket): void;
|
|
29
|
-
stop(): void;
|
|
30
|
-
requestKeyFrame(): void;
|
|
31
|
-
private initiateCall;
|
|
32
|
-
private handleMessage;
|
|
33
|
-
private sendMessage;
|
|
34
|
-
private callEnded;
|
|
35
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { ReplaySubject, Subject } from 'rxjs';
|
|
2
|
-
import { RtpPacket } from 'werift';
|
|
3
|
-
import type { Subscription } from 'rxjs';
|
|
4
|
-
import type { CameraDevice } from '../device.js';
|
|
5
|
-
import type { BaseLogger, FfmpegOptions, SpawnInput } from '../types.js';
|
|
6
|
-
import type { WebrtcConnection } from './webrtc-connection.js';
|
|
7
|
-
declare class Subscribed {
|
|
8
|
-
private readonly subscriptions;
|
|
9
|
-
private readonly additionalSubscriptions;
|
|
10
|
-
addSubscriptions(...subscriptions: Subscription[]): void;
|
|
11
|
-
addAdditionalSubscriptions(...subscriptions: Subscription[]): void;
|
|
12
|
-
unsubscribe(): void;
|
|
13
|
-
unsubscribeAdditional(): void;
|
|
14
|
-
}
|
|
15
|
-
export declare class WeriftSession extends Subscribed {
|
|
16
|
-
readonly onCallEnded: ReplaySubject<void>;
|
|
17
|
-
readonly onVideoRtp: Subject<RtpPacket>;
|
|
18
|
-
readonly onAudioRtp: Subject<RtpPacket>;
|
|
19
|
-
private readonly audioSplitter;
|
|
20
|
-
private readonly videoSplitter;
|
|
21
|
-
private readonly returnAudioSplitter;
|
|
22
|
-
private readonly onUsingOpus;
|
|
23
|
-
private hasEnded;
|
|
24
|
-
private cameraDevice;
|
|
25
|
-
private connection;
|
|
26
|
-
private logger;
|
|
27
|
-
get isUsingOpus(): Promise<boolean>;
|
|
28
|
-
constructor(cameraDevice: CameraDevice, logger: BaseLogger, connection: WebrtcConnection);
|
|
29
|
-
reservePort(bufferPorts?: number): Promise<number>;
|
|
30
|
-
startTranscoding(ffmpegOptions: FfmpegOptions): Promise<void>;
|
|
31
|
-
transcodeReturnAudio(ffmpegOptions: {
|
|
32
|
-
ffmpegPath: string;
|
|
33
|
-
input: SpawnInput[];
|
|
34
|
-
}): Promise<void>;
|
|
35
|
-
stop(): void;
|
|
36
|
-
sendAudioPacket(rtp: RtpPacket): void;
|
|
37
|
-
requestKeyFrame(): void;
|
|
38
|
-
private bindToConnection;
|
|
39
|
-
private callEnded;
|
|
40
|
-
}
|
|
41
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
import type { MotionState } from './types.js';
|
|
4
|
-
export declare class VideoFrame implements VideoFrameMethods {
|
|
5
|
-
readonly frameData: FrameData;
|
|
6
|
-
readonly metadata: FrameMetadata;
|
|
7
|
-
private frameGeneratorSubject;
|
|
8
|
-
private publisher;
|
|
9
|
-
private prebufferDuration;
|
|
10
|
-
get inputWidth(): number;
|
|
11
|
-
get inputHeight(): number;
|
|
12
|
-
get inputFormat(): DecoderFormat;
|
|
13
|
-
constructor(cameraId: string, publisher: ProxyConnection, frameData: FrameData, metadata: FrameMetadata, prebufferDuration: number);
|
|
14
|
-
toBuffer(options?: ImageOptions): Promise<FrameBuffer>;
|
|
15
|
-
toImage(options?: ImageOptions): Promise<FrameImage>;
|
|
16
|
-
save(path: string, options?: ImageOptions): Promise<void>;
|
|
17
|
-
private send;
|
|
18
|
-
private validateOptions;
|
|
19
|
-
private getImageInformation;
|
|
20
|
-
}
|
|
21
|
-
export declare class MotionFrame extends VideoFrame implements MotionFrameMethods {
|
|
22
|
-
readonly motion: MotionState;
|
|
23
|
-
constructor(cameraId: string, publisher: ProxyConnection, frameData: FrameData, motionState: MotionState, metadata: FrameMetadata);
|
|
24
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const NATS_SERVER_SUBJECT = "camera.ui-server";
|
|
@@ -1,9 +0,0 @@
|
|
|
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,20 +0,0 @@
|
|
|
1
|
-
import type { BaseLogger } from '../camera/types.js';
|
|
2
|
-
import type { ProxyConnection } from './connection.js';
|
|
3
|
-
import type { ProxySubscription } from './subscription.js';
|
|
4
|
-
import type { ProxyMessageStructure } from './types.js';
|
|
5
|
-
export declare class MessageQueue {
|
|
6
|
-
private logger;
|
|
7
|
-
private type;
|
|
8
|
-
private publisher;
|
|
9
|
-
private subscriber;
|
|
10
|
-
private requestHandler;
|
|
11
|
-
private aborted;
|
|
12
|
-
private isProcessing;
|
|
13
|
-
private queue;
|
|
14
|
-
private pendingResponses;
|
|
15
|
-
constructor(type: 'server' | 'client', publisher: ProxyConnection, subscriber: ProxySubscription, logger: BaseLogger, requestHandler: (message: ProxyMessageStructure) => void);
|
|
16
|
-
abortQueue(): void;
|
|
17
|
-
enqueue(message: ProxyMessageStructure): Promise<any>;
|
|
18
|
-
private processQueue;
|
|
19
|
-
private onMessage;
|
|
20
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
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,107 +0,0 @@
|
|
|
1
|
-
import type { RootDatabase } from 'lmdb';
|
|
2
|
-
import type { JsonSchema, JsonSchemaForm, SchemaConfig } from '../../../plugins/types.js';
|
|
3
|
-
import type { API } from './pluginApi.js';
|
|
4
|
-
export declare class CameraStorage<T extends Record<string, any> = Record<string, any>> {
|
|
5
|
-
private cameraId;
|
|
6
|
-
private instance;
|
|
7
|
-
private api;
|
|
8
|
-
private pluginDb;
|
|
9
|
-
schema: JsonSchemaForm;
|
|
10
|
-
values: T;
|
|
11
|
-
constructor(api: API, pluginDb: RootDatabase<Record<string, any>, 'config'>, instance: any, cameraId: string, schema?: JsonSchemaForm);
|
|
12
|
-
/**
|
|
13
|
-
* Initialize the storage.
|
|
14
|
-
* This will load the configuration from the database.
|
|
15
|
-
*/
|
|
16
|
-
initializeStorage(): void;
|
|
17
|
-
/**
|
|
18
|
-
* Get a value from the configuration by its key/path.
|
|
19
|
-
* If the schema has an onGet function, the onGet function will be called.
|
|
20
|
-
* If the onGet functions is undefined, the value from the configuration will be returned.
|
|
21
|
-
* If the schema has a default value, and the configuration value is undefined, the default value will be returned.
|
|
22
|
-
*
|
|
23
|
-
* @param path - The path to the configuration value.
|
|
24
|
-
* @returns The value from the configuration.
|
|
25
|
-
*/
|
|
26
|
-
getValue<T = string>(path: string): Promise<T> | undefined;
|
|
27
|
-
getValue<T = string>(path: string, defaultValue: T): Promise<T>;
|
|
28
|
-
/**
|
|
29
|
-
* Set a new value for a given key/path in the configuration.
|
|
30
|
-
* If the schema of the value has an onSet function, and the value has changed, the onSet function will be called.
|
|
31
|
-
* If the schema of the value is declared as storable, the value will be saved to the database.
|
|
32
|
-
*
|
|
33
|
-
* @param path - The path to the configuration value.
|
|
34
|
-
* @param newValue - The new value to set.
|
|
35
|
-
*/
|
|
36
|
-
setValue<T = string>(path: string, newValue: T): Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
* Check if a value exists by its config path/key.
|
|
39
|
-
*
|
|
40
|
-
* @param path - The path to the value to check.
|
|
41
|
-
* @returns True if the value exists, false otherwise.
|
|
42
|
-
*/
|
|
43
|
-
hasValue(path: string): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Get the root schema and configuration.
|
|
46
|
-
* This will also call the onGet functions for the schema.
|
|
47
|
-
*
|
|
48
|
-
* @returns The root schema and configuration.
|
|
49
|
-
*/
|
|
50
|
-
getConfig(): Promise<SchemaConfig>;
|
|
51
|
-
/**
|
|
52
|
-
* Set a new configuration.
|
|
53
|
-
* If the schema of a value which has been changed has an onSet function, the onSet function will be called.
|
|
54
|
-
*
|
|
55
|
-
* @param newConfig - The new configuration to set.
|
|
56
|
-
*/
|
|
57
|
-
setConfig(newConfig: T): Promise<void>;
|
|
58
|
-
/**
|
|
59
|
-
* Add a new schema to the existing schema.
|
|
60
|
-
* It will also add the value to the configuration.
|
|
61
|
-
* If the schema is declared as storable, the value will be saved to the database.
|
|
62
|
-
*
|
|
63
|
-
* @param schema - The new schema to add.
|
|
64
|
-
* @param path - The path to the schema to add.
|
|
65
|
-
*/
|
|
66
|
-
addSchema(schema: JsonSchemaForm): Promise<void>;
|
|
67
|
-
addSchema(path: string, schema: JsonSchema): Promise<void>;
|
|
68
|
-
/**
|
|
69
|
-
* Remove a schema by its config path/key from the existing schema.
|
|
70
|
-
* It will also remove the value from the configuration.
|
|
71
|
-
* If the schema is declared as storable, the value will be removed from the database.
|
|
72
|
-
*
|
|
73
|
-
* @param path - The path to the schema to remove.
|
|
74
|
-
*/
|
|
75
|
-
removeSchema(path: string): void;
|
|
76
|
-
/**
|
|
77
|
-
* Change a schema by its config path/key from the existing schema.
|
|
78
|
-
* It will also change the value from the configuration.
|
|
79
|
-
* If the schema is declared as storable, the value will be saved to the database.
|
|
80
|
-
*
|
|
81
|
-
* @param path - The path to the schema to change.
|
|
82
|
-
* @param schema - The new schema to set.
|
|
83
|
-
*/
|
|
84
|
-
changeSchema(path: string, newSchema: Partial<JsonSchema>): Promise<void>;
|
|
85
|
-
/**
|
|
86
|
-
* Get a schema by its config path/key.
|
|
87
|
-
*
|
|
88
|
-
* @param path - The path to the schema to get.
|
|
89
|
-
* @returns The schema.
|
|
90
|
-
*/
|
|
91
|
-
getSchema<T>(path: string): T | undefined;
|
|
92
|
-
/**
|
|
93
|
-
* Check if a schema exists by its config path/key.
|
|
94
|
-
*
|
|
95
|
-
* @param path - The path to the schema to check.
|
|
96
|
-
* @returns True if the schema exists, false otherwise.
|
|
97
|
-
*/
|
|
98
|
-
hasSchema(path: string): boolean;
|
|
99
|
-
private resolveOnGetFunctions;
|
|
100
|
-
private resolveOnGetFunctionsForObject;
|
|
101
|
-
private resolveOnGetFunctionsForSchema;
|
|
102
|
-
private triggerOnSetForChanges;
|
|
103
|
-
private filterStorableValues;
|
|
104
|
-
private containsStorableSchema;
|
|
105
|
-
private saveDb;
|
|
106
|
-
private close;
|
|
107
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import type { Path } from 'object-path';
|
|
2
|
-
import type { JSONValue, PluginConfig } from '../../../plugins/types.js';
|
|
3
|
-
export declare class PluginConfigService {
|
|
4
|
-
private config;
|
|
5
|
-
private configFile;
|
|
6
|
-
constructor(configFile: string);
|
|
7
|
-
/**
|
|
8
|
-
* Get key (Path) from config.json
|
|
9
|
-
*
|
|
10
|
-
* @param key - Key to lookup for
|
|
11
|
-
* @param defaultValue - Default value if `key` not exist
|
|
12
|
-
* @param validate - Validate the value of the `key` and replace with `defaultValue` if it is not valid
|
|
13
|
-
* @param refresh - Re-Read config.json before lookup for the `key`
|
|
14
|
-
* @param writeIfNotValid - Optional parameter, if true, the changes will be written to the file, if the value of the `key` is not valid and is replaced by the `defaultValue`
|
|
15
|
-
*
|
|
16
|
-
* @returns `value` for the given `key` or `defaultValue`
|
|
17
|
-
*/
|
|
18
|
-
get(key: Path, defaultValue: JSONValue, validate: Function, refresh?: boolean, writeIfNotValid?: boolean): any;
|
|
19
|
-
get(key: Path, defaultValue?: unknown, validate?: Function, refresh?: boolean, writeIfNotValid?: boolean): any;
|
|
20
|
-
/**
|
|
21
|
-
* Test key (Path) existence
|
|
22
|
-
*
|
|
23
|
-
* @param key - Key to lookup for
|
|
24
|
-
* @param refresh - Re-Read config.json before lookup for the `key`
|
|
25
|
-
*/
|
|
26
|
-
has(key: Path, refresh?: boolean): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Set a value if it doesn't exist, do nothing if it does
|
|
29
|
-
*
|
|
30
|
-
* @param key - Key whose existence is to be checked
|
|
31
|
-
* @param defaultValue - Default value if `key` not exist
|
|
32
|
-
* @param write - Optional parameter, if true, the changes will be written to the file.
|
|
33
|
-
*/
|
|
34
|
-
ensureExists(key: Path, defaultValue: JSONValue, write?: boolean): void;
|
|
35
|
-
/**
|
|
36
|
-
* Set a key (Path) to a value
|
|
37
|
-
*
|
|
38
|
-
* @param key - Key
|
|
39
|
-
* @param value - Value to set for they given `key`
|
|
40
|
-
* @param write - Optional parameter, if true, the changes will be written to the file.
|
|
41
|
-
*/
|
|
42
|
-
set(key: Path, value: any, write?: boolean): void;
|
|
43
|
-
/**
|
|
44
|
-
* Insert an item in an array path
|
|
45
|
-
*
|
|
46
|
-
* @param key - Key to the array
|
|
47
|
-
* @param value - Value to insert in the array
|
|
48
|
-
* @param at - Index
|
|
49
|
-
* @param write - Optional parameter, if true, the changes will be written to the file.
|
|
50
|
-
*/
|
|
51
|
-
insert(key: Path, value: any, at?: number, write?: boolean): void;
|
|
52
|
-
/**
|
|
53
|
-
* Create (if path isn't an array) and push the value to it. Can push unlimited number of values
|
|
54
|
-
*
|
|
55
|
-
* @param key - Key to the array
|
|
56
|
-
* @param write - Optional parameter, if true, the changes will be written to the file.
|
|
57
|
-
* @param items - Values to push in to the array
|
|
58
|
-
*/
|
|
59
|
-
push(key: Path, write?: boolean, ...items: any[]): void;
|
|
60
|
-
/**
|
|
61
|
-
* Deletes a member from object or array
|
|
62
|
-
*
|
|
63
|
-
* @param key - Key to lookup for
|
|
64
|
-
* @param write - Optional parameter, if true, the changes will be written to the file.
|
|
65
|
-
*/
|
|
66
|
-
delete(key: Path, write?: boolean): void;
|
|
67
|
-
/**
|
|
68
|
-
* @param refresh - Re-Read config.json
|
|
69
|
-
*
|
|
70
|
-
* @returns config.json
|
|
71
|
-
*/
|
|
72
|
-
all(refresh?: boolean): PluginConfig;
|
|
73
|
-
/**
|
|
74
|
-
* @param config - New config.json
|
|
75
|
-
* @param write - Optional parameter, if true, the changes will be written to the file.
|
|
76
|
-
*/
|
|
77
|
-
replace(config: PluginConfig, write?: boolean): void;
|
|
78
|
-
/**
|
|
79
|
-
* Updates a specific value in a nested object structure by a given path and key.
|
|
80
|
-
*
|
|
81
|
-
* @param path - The path to the nested object.
|
|
82
|
-
* @param searchKey - The key to search for.
|
|
83
|
-
* @param searchValue - The value to match the searchKey.
|
|
84
|
-
* @param targetKey - The key of the value to be updated.
|
|
85
|
-
* @param newValue - The new value to be set.
|
|
86
|
-
* @param write - Optional parameter, if true, the changes will be written to the file.
|
|
87
|
-
*/
|
|
88
|
-
updateValue(path: string, searchKey: string, searchValue: any, targetKey: string, newValue: any, write?: boolean): void;
|
|
89
|
-
/**
|
|
90
|
-
* Replaces a specific item in a nested object structure by a given path and key.
|
|
91
|
-
* If the item does not exist, it will be added.
|
|
92
|
-
* If the path does not exist, it will be created.
|
|
93
|
-
*
|
|
94
|
-
* @param path - The path to the nested object.
|
|
95
|
-
* @param searchKey - The key to search for.
|
|
96
|
-
* @param searchValue - The value to match the searchKey.
|
|
97
|
-
* @param newItem - The new item to replace the old one. If the item does not exist, it will be added.
|
|
98
|
-
* @param write - Optional parameter, if true, the changes will be written to the file.
|
|
99
|
-
*/
|
|
100
|
-
replaceOrAddItem(path: string, searchKey: string, searchValue: any, newItem: any, write?: boolean): void;
|
|
101
|
-
private init;
|
|
102
|
-
private read;
|
|
103
|
-
private write;
|
|
104
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'node:events';
|
|
2
|
-
import { PluginConfigService } from './configService.js';
|
|
3
|
-
import { StorageController } from './storageController.js';
|
|
4
|
-
import type { RootDatabase } from 'lmdb';
|
|
5
|
-
import type { AuthConfig } from '../../../decoder/types.js';
|
|
6
|
-
import type { PluginInfo } from '../../../plugins/types.js';
|
|
7
|
-
import type { PluginLogger } from './pluginLogger.js';
|
|
8
|
-
import type { CoreManager } from './proxy/coreManager.js';
|
|
9
|
-
import type { DeviceManager } from './proxy/deviceManager.js';
|
|
10
|
-
export declare interface PluginAPI {
|
|
11
|
-
on(event: 'finishLaunching', listener: () => void): this;
|
|
12
|
-
on(event: 'shutdown', listener: () => void): this;
|
|
13
|
-
once(event: 'finishLaunching', listener: () => void): this;
|
|
14
|
-
once(event: 'shutdown', listener: () => void): this;
|
|
15
|
-
off(event: 'finishLaunching', listener: () => void): this;
|
|
16
|
-
off(event: 'shutdown', listener: () => void): this;
|
|
17
|
-
removeListener(event: 'finishLaunching', listener: () => void): this;
|
|
18
|
-
removeListener(event: 'shutdown', listener: () => void): this;
|
|
19
|
-
removeAllListeners(event?: string): this;
|
|
20
|
-
readonly coreManager: CoreManager;
|
|
21
|
-
readonly deviceManager: DeviceManager;
|
|
22
|
-
readonly storageController: StorageController;
|
|
23
|
-
readonly configService: PluginConfigService;
|
|
24
|
-
readonly storagePath: string;
|
|
25
|
-
readonly configFile: string;
|
|
26
|
-
}
|
|
27
|
-
export declare class API extends EventEmitter implements PluginAPI {
|
|
28
|
-
readonly coreManager: CoreManager;
|
|
29
|
-
readonly deviceManager: DeviceManager;
|
|
30
|
-
readonly storageController: StorageController;
|
|
31
|
-
readonly configService: PluginConfigService;
|
|
32
|
-
readonly storagePath: string;
|
|
33
|
-
readonly configFile: string;
|
|
34
|
-
constructor(plugin: PluginInfo, storagePath: string, configFile: string, logger: PluginLogger, proxyEndpoints: string[], auth: AuthConfig, pluginDb: RootDatabase<Record<string, any>, 'config'>);
|
|
35
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare class PluginLogger {
|
|
2
|
-
private _prefix;
|
|
3
|
-
private _loggerPrefix;
|
|
4
|
-
private _disableTimestamps;
|
|
5
|
-
debugEnabled: boolean;
|
|
6
|
-
traceEnabled: boolean;
|
|
7
|
-
private get prefix();
|
|
8
|
-
constructor(prefix: string, disableTimestamps: boolean);
|
|
9
|
-
log(...args: any[]): void;
|
|
10
|
-
error(...args: any[]): void;
|
|
11
|
-
warn(...args: any[]): void;
|
|
12
|
-
attention(...args: any[]): void;
|
|
13
|
-
debug(...args: any[]): void;
|
|
14
|
-
trace(...args: any[]): void;
|
|
15
|
-
private formatMessage;
|
|
16
|
-
private formattedArgs;
|
|
17
|
-
private formatDateTime;
|
|
18
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { CameraDevice } from '../../../../camera/device.js';
|
|
2
|
-
import { CameraInterface } from '../../../../camera/interfaces/camera.js';
|
|
3
|
-
import { CameraPrebufferInterface } from '../../../../camera/interfaces/prebuffer.js';
|
|
4
|
-
import { CameraPTZInterface } from '../../../../camera/interfaces/ptz.js';
|
|
5
|
-
import { MotionFrame, VideoFrame } from '../../../../camera/videoFrame.js';
|
|
6
|
-
import type { Camera } from '../../../../api/database/types.js';
|
|
7
|
-
import type { CameraConfigInputSettings, CameraDelegates, CameraSource, SetValues } from '../../../../camera/types.js';
|
|
8
|
-
import type { AuthConfig, VideoFrame as VideoFrameImp } from '../../../../decoder/types.js';
|
|
9
|
-
import type { CameraDeviceProxyMethods } from '../../../../nats/types.js';
|
|
10
|
-
import type { PluginInfo } from '../../../../plugins/types.js';
|
|
11
|
-
import type { MethodKeys, MethodType } from '../../../../types.js';
|
|
12
|
-
import type { API } from '../pluginApi.js';
|
|
13
|
-
import type { PluginLogger } from '../pluginLogger.js';
|
|
14
|
-
export declare class CameraDeviceProxy extends CameraDevice {
|
|
15
|
-
private api;
|
|
16
|
-
private initialized;
|
|
17
|
-
private subject;
|
|
18
|
-
private cameraSubscriberSubject;
|
|
19
|
-
private cameraPluginSubscriberSubject;
|
|
20
|
-
private frameSubject;
|
|
21
|
-
private motionFrameSubject;
|
|
22
|
-
private signalingSubject;
|
|
23
|
-
private signalingTargetSubject;
|
|
24
|
-
private publisher?;
|
|
25
|
-
private cameraPublisher?;
|
|
26
|
-
private framePublisher?;
|
|
27
|
-
private motionFramePublisher?;
|
|
28
|
-
private signalingPublisher?;
|
|
29
|
-
private subscriber?;
|
|
30
|
-
private cameraSubscriber?;
|
|
31
|
-
private cameraPluginSubscriber?;
|
|
32
|
-
private signalingSubscriber?;
|
|
33
|
-
private frameSubscribers;
|
|
34
|
-
private motionFrameSubscribers;
|
|
35
|
-
private messageQueue?;
|
|
36
|
-
private activeRequests;
|
|
37
|
-
private activeMotionRequests;
|
|
38
|
-
private auth;
|
|
39
|
-
private proxyEndpoints;
|
|
40
|
-
private plugin;
|
|
41
|
-
protected cameraDelegate: CameraInterface;
|
|
42
|
-
protected ptzDelegate: CameraPTZInterface;
|
|
43
|
-
protected prebufferDelegate: CameraPrebufferInterface;
|
|
44
|
-
get sources(): CameraSource[];
|
|
45
|
-
constructor(api: API, logger: PluginLogger, camera: Camera, plugin: PluginInfo, proxyEndpoints: string[], auth: AuthConfig);
|
|
46
|
-
init(): Promise<void>;
|
|
47
|
-
setDelegate<T extends keyof CameraDelegates>(name: T, delegate: CameraDelegates[T]): void;
|
|
48
|
-
connect(): Promise<void>;
|
|
49
|
-
disconnect(): Promise<void>;
|
|
50
|
-
getFrames(prebufferDuration?: number): AsyncIterableIterator<VideoFrame>;
|
|
51
|
-
getMotionFrames(): AsyncIterableIterator<MotionFrame>;
|
|
52
|
-
updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], frame?: VideoFrameImp): Promise<void>;
|
|
53
|
-
addCameraSource(source: CameraConfigInputSettings): Promise<void>;
|
|
54
|
-
updateCameraSource(sourceId: string, source: Partial<CameraConfigInputSettings>): Promise<void>;
|
|
55
|
-
removeCameraSource(sourceId: string): Promise<void>;
|
|
56
|
-
refreshStates(): Promise<void>;
|
|
57
|
-
cleanup(): Promise<void>;
|
|
58
|
-
private onMotionFrame;
|
|
59
|
-
private connectToDecoder;
|
|
60
|
-
private getMetadata;
|
|
61
|
-
private disconnectFromDecoder;
|
|
62
|
-
private closeFrameSubscribers;
|
|
63
|
-
private closeMotionFrameSubscibers;
|
|
64
|
-
private requestHandler;
|
|
65
|
-
private onProxyMessage;
|
|
66
|
-
private onSignalingMessage;
|
|
67
|
-
onRequest<T extends MethodKeys<CameraDeviceProxyMethods>>(client: 'cameraFn', fn: T, args?: Parameters<MethodType<CameraDeviceProxyMethods, T>>, timeout?: number): Promise<Awaited<ReturnType<MethodType<CameraDeviceProxyMethods, T>>>>;
|
|
68
|
-
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>>>>;
|
|
69
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'node:events';
|
|
2
|
-
import type { AuthConfig } from '../../../../decoder/types.js';
|
|
3
|
-
import type { CoreManagerProxyEventCallbacks, CoreManagerProxyMethods } from '../../../../nats/types.js';
|
|
4
|
-
import type { PluginInfo } from '../../../../plugins/types.js';
|
|
5
|
-
import type { IceServer } from '../../../../services/config/types.js';
|
|
6
|
-
import type { API } from '../pluginApi.js';
|
|
7
|
-
import type { PluginLogger } from '../pluginLogger.js';
|
|
8
|
-
export declare interface CoreManager extends CoreManagerProxyMethods {
|
|
9
|
-
on<E extends keyof CoreManagerProxyEventCallbacks>(event: E, listener: CoreManagerProxyEventCallbacks[E]): this;
|
|
10
|
-
once<E extends keyof CoreManagerProxyEventCallbacks>(event: E, listener: CoreManagerProxyEventCallbacks[E]): this;
|
|
11
|
-
off<E extends keyof CoreManagerProxyEventCallbacks>(event: E, listener: CoreManagerProxyEventCallbacks[E]): this;
|
|
12
|
-
removeListener<E extends keyof CoreManagerProxyEventCallbacks>(event: E, listener: CoreManagerProxyEventCallbacks[E]): this;
|
|
13
|
-
removeAllListeners<E extends keyof CoreManagerProxyEventCallbacks>(event?: E): this;
|
|
14
|
-
}
|
|
15
|
-
export declare class CoreManagerProxy extends EventEmitter implements CoreManager {
|
|
16
|
-
private api;
|
|
17
|
-
private logger;
|
|
18
|
-
private initialized;
|
|
19
|
-
private subject;
|
|
20
|
-
private cmSubject;
|
|
21
|
-
private publisher?;
|
|
22
|
-
private dmPublisher?;
|
|
23
|
-
private subscriber?;
|
|
24
|
-
private dmSubscriber?;
|
|
25
|
-
private messageQueue?;
|
|
26
|
-
private auth;
|
|
27
|
-
private proxyEndpoints;
|
|
28
|
-
private plugin;
|
|
29
|
-
constructor(api: API, logger: PluginLogger, plugin: PluginInfo, proxyEndpoints: string[], auth: AuthConfig);
|
|
30
|
-
init(): Promise<void>;
|
|
31
|
-
getFFmpegPath(): Promise<string>;
|
|
32
|
-
getServerAddresses(): Promise<string[]>;
|
|
33
|
-
getIceServers(): Promise<IceServer[]>;
|
|
34
|
-
emit(): boolean;
|
|
35
|
-
private requestHandler;
|
|
36
|
-
private emitEvent;
|
|
37
|
-
private onProxyMessage;
|
|
38
|
-
private onRequest;
|
|
39
|
-
private close;
|
|
40
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'node:events';
|
|
2
|
-
import { CameraDeviceProxy } from './cameraDevice.js';
|
|
3
|
-
import type { CameraDevice } from '../../../../camera/device.js';
|
|
4
|
-
import type { CameraConfig } from '../../../../camera/types.js';
|
|
5
|
-
import type { AuthConfig } from '../../../../decoder/types.js';
|
|
6
|
-
import type { DeviceManagerProxyEventCallbacks, DeviceManagerProxyMethods } from '../../../../nats/types.js';
|
|
7
|
-
import type { PluginInfo } from '../../../../plugins/types.js';
|
|
8
|
-
import type { API } from '../pluginApi.js';
|
|
9
|
-
import type { PluginLogger } from '../pluginLogger.js';
|
|
10
|
-
export declare interface DeviceManager extends DeviceManagerProxyMethods {
|
|
11
|
-
on<E extends keyof DeviceManagerProxyEventCallbacks>(event: E, listener: DeviceManagerProxyEventCallbacks[E]): this;
|
|
12
|
-
once<E extends keyof DeviceManagerProxyEventCallbacks>(event: E, listener: DeviceManagerProxyEventCallbacks[E]): this;
|
|
13
|
-
off<E extends keyof DeviceManagerProxyEventCallbacks>(event: E, listener: DeviceManagerProxyEventCallbacks[E]): this;
|
|
14
|
-
removeListener<E extends keyof DeviceManagerProxyEventCallbacks>(event: E, listener: DeviceManagerProxyEventCallbacks[E]): this;
|
|
15
|
-
removeAllListeners<E extends keyof DeviceManagerProxyEventCallbacks>(event?: E): this;
|
|
16
|
-
}
|
|
17
|
-
export declare class DeviceManagerProxy extends EventEmitter implements DeviceManager {
|
|
18
|
-
private api;
|
|
19
|
-
private logger;
|
|
20
|
-
private initialized;
|
|
21
|
-
private subject;
|
|
22
|
-
private dmSubject;
|
|
23
|
-
private publisher?;
|
|
24
|
-
private dmPublisher?;
|
|
25
|
-
private subscriber?;
|
|
26
|
-
private dmSubscriber?;
|
|
27
|
-
private messageQueue?;
|
|
28
|
-
private auth;
|
|
29
|
-
private proxyEndpoints;
|
|
30
|
-
private plugin;
|
|
31
|
-
private devices;
|
|
32
|
-
constructor(api: API, logger: PluginLogger, plugin: PluginInfo, proxyEndpoints: string[], auth: AuthConfig);
|
|
33
|
-
init(): Promise<void>;
|
|
34
|
-
getCameraById(id: string): Promise<CameraDevice | undefined>;
|
|
35
|
-
getCameraByName(name: string): Promise<CameraDevice | undefined>;
|
|
36
|
-
createCamera(cameraConfig: CameraConfig): Promise<CameraDevice>;
|
|
37
|
-
removeCameraByName(name: string): Promise<void>;
|
|
38
|
-
removeCameraById(id: string): Promise<void>;
|
|
39
|
-
emit(): boolean;
|
|
40
|
-
configureCameras(cameraDevices: CameraDeviceProxy[]): void;
|
|
41
|
-
private requestHandler;
|
|
42
|
-
private emitEvent;
|
|
43
|
-
private onProxyMessage;
|
|
44
|
-
private onRequest;
|
|
45
|
-
private addOrGetCamera;
|
|
46
|
-
private close;
|
|
47
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { CameraStorage } from './cameraStorage.js';
|
|
2
|
-
import type { RootDatabase } from 'lmdb';
|
|
3
|
-
import type { JsonSchemaForm } from '../../../plugins/types.js';
|
|
4
|
-
import type { API } from './pluginApi.js';
|
|
5
|
-
export declare class StorageController {
|
|
6
|
-
private api;
|
|
7
|
-
private pluginDb;
|
|
8
|
-
private cameraStorages;
|
|
9
|
-
constructor(api: API, pluginDb: RootDatabase<Record<string, any>, 'config'>);
|
|
10
|
-
/**
|
|
11
|
-
* Create a camera storage instance
|
|
12
|
-
*
|
|
13
|
-
* @param instance - The plugin instance
|
|
14
|
-
* @param cameraId - The camera id
|
|
15
|
-
* @param schema - The plugin schema
|
|
16
|
-
*/
|
|
17
|
-
createCameraStorage<T extends Record<string, any> = Record<string, any>>(instance: any, cameraId: string, schema?: JsonSchemaForm): CameraStorage<T>;
|
|
18
|
-
/**
|
|
19
|
-
* Get a camera storage instance
|
|
20
|
-
*
|
|
21
|
-
* @param cameraId - The camera id
|
|
22
|
-
*/
|
|
23
|
-
getCameraStorage<T extends Record<string, any> = Record<string, any>>(cameraId: string): CameraStorage<T> | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Remove a camera storage instance
|
|
26
|
-
*
|
|
27
|
-
* @param cameraId - The camera id
|
|
28
|
-
*/
|
|
29
|
-
removeCameraStorage(cameraId: string): void;
|
|
30
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Systeminformation } from 'systeminformation';
|
|
2
|
-
export type IPVersion = 'ipv4' | 'ipv6';
|
|
3
|
-
export interface UsableNetworkAddress {
|
|
4
|
-
address: string;
|
|
5
|
-
isPrivate: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare const isIPv4EmbeddedIPv6: (ip: string) => boolean;
|
|
8
|
-
export declare const extractPureIPAddress: (address: string) => string;
|
|
9
|
-
export declare const isValidNetworkAddress: (ip: string) => boolean;
|
|
10
|
-
export declare const isInternalNetworkAddress: (ip: string) => boolean;
|
|
11
|
-
export declare const fetchViableNetworkAddresses: () => UsableNetworkAddress[];
|
|
12
|
-
export declare const getSystemNetworkInterfaces: () => Promise<Systeminformation.NetworkInterfacesData[]>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getNpmPath: () => string[];
|