@camera.ui/browser 0.0.110 → 0.0.112
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/LICENSE.md +1 -1
- package/README.md +10 -1
- package/dist/index.d.ts +1269 -0
- package/dist/index.js +4179 -0
- package/package.json +55 -36
- package/CHANGELOG.md +0 -8
- package/dist/bundle.js +0 -2
- package/dist/bundle.js.LICENSE.txt +0 -23
- package/dist/types/packages/client/browser/src/api.d.ts +0 -8
- package/dist/types/packages/client/browser/src/client.d.ts +0 -23
- package/dist/types/packages/client/browser/src/index.d.ts +0 -2
- package/dist/types/packages/client/browser/src/proxy/cameraDevice.d.ts +0 -30
- package/dist/types/packages/client/browser/src/proxy/coreManager.d.ts +0 -16
- package/dist/types/packages/client/browser/src/proxy/deviceManager.d.ts +0 -18
- package/dist/types/packages/client/browser/src/proxy/index.d.ts +0 -3
- package/dist/types/packages/client/browser/src/socket.d.ts +0 -15
- package/dist/types/packages/client/browser/src/streaming/go2rts-session.d.ts +0 -71
- package/dist/types/packages/client/browser/src/types.d.ts +0 -58
- package/dist/types/packages/client/browser/src/utils.d.ts +0 -12
- package/dist/types/packages/common/src/nats/messageQueue.d.ts +0 -48
- package/dist/types/packages/common/src/nats/nats.d.ts +0 -30
- package/dist/types/packages/common/src/nats/packer.d.ts +0 -2
- package/dist/types/packages/common/src/utils/subscribed.d.ts +0 -18
- package/dist/types/packages/plugineer/src/polyglot/node/camera/index.d.ts +0 -91
- package/dist/types/packages/plugineer/src/polyglot/node/camera/interfaces/camera.d.ts +0 -8
- package/dist/types/packages/plugineer/src/polyglot/node/camera/interfaces/ptz.d.ts +0 -11
- package/dist/types/packages/plugineer/src/polyglot/node/camera/iou.d.ts +0 -2
- package/dist/types/packages/plugineer/src/polyglot/node/camera/polygon.d.ts +0 -4
- package/dist/types/packages/plugineer/src/polyglot/node/camera/types.d.ts +0 -18
- package/dist/types/packages/plugineer/src/polyglot/node/plugins/schema.d.ts +0 -62
- package/dist/types/packages/plugineer/src/polyglot/node/plugins/types.d.ts +0 -135
- package/dist/types/packages/plugineer/src/types.d.ts +0 -4
- package/dist/types/packages/types/src/index.d.ts +0 -730
- package/dist/types/server/src/api/controllers/api.controller.d.ts +0 -7
- package/dist/types/server/src/api/controllers/auth.controller.d.ts +0 -16
- 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 -38
- 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 -11
- package/dist/types/server/src/api/controllers/plugins.controller.d.ts +0 -48
- package/dist/types/server/src/api/controllers/system.controller.d.ts +0 -23
- package/dist/types/server/src/api/controllers/users.controller.d.ts +0 -28
- package/dist/types/server/src/api/database/checks.d.ts +0 -55
- package/dist/types/server/src/api/database/constants.d.ts +0 -8
- package/dist/types/server/src/api/database/index.d.ts +0 -30
- package/dist/types/server/src/api/database/migration.d.ts +0 -15
- package/dist/types/server/src/api/database/selfcheck.d.ts +0 -48
- package/dist/types/server/src/api/database/types.d.ts +0 -88
- package/dist/types/server/src/api/go2rtc/api/application.d.ts +0 -9
- package/dist/types/server/src/api/go2rtc/api/config.d.ts +0 -8
- package/dist/types/server/src/api/go2rtc/api/index.d.ts +0 -1
- package/dist/types/server/src/api/go2rtc/api/snapshot.d.ts +0 -8
- package/dist/types/server/src/api/go2rtc/api/streams.d.ts +0 -12
- package/dist/types/server/src/api/go2rtc/index.d.ts +0 -14
- package/dist/types/server/src/api/go2rtc/queue.d.ts +0 -10
- package/dist/types/server/src/api/go2rtc/types.d.ts +0 -92
- package/dist/types/server/src/api/index.d.ts +0 -22
- 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/middlewares/socketAuth.middleware.d.ts +0 -41
- package/dist/types/server/src/api/plugins/header.plugin.d.ts +0 -2
- 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 -20
- 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/schemas/backup.schema.d.ts +0 -211
- package/dist/types/server/src/api/schemas/cameras.schema.d.ts +0 -980
- package/dist/types/server/src/api/schemas/config.schema.d.ts +0 -114
- package/dist/types/server/src/api/schemas/go2rtc.schema.d.ts +0 -703
- package/dist/types/server/src/api/schemas/plugins.schema.d.ts +0 -72
- package/dist/types/server/src/api/schemas/system.schema.d.ts +0 -17
- package/dist/types/server/src/api/schemas/users.schema.d.ts +0 -1013
- package/dist/types/server/src/api/services/auth.service.d.ts +0 -24
- package/dist/types/server/src/api/services/backup.service.d.ts +0 -11
- package/dist/types/server/src/api/services/cameras.service.d.ts +0 -54
- package/dist/types/server/src/api/services/plugins.service.d.ts +0 -38
- package/dist/types/server/src/api/services/system.service.d.ts +0 -13
- package/dist/types/server/src/api/services/users.service.d.ts +0 -25
- package/dist/types/server/src/api/types/index.d.ts +0 -610
- package/dist/types/server/src/api/utils/cameraSource.d.ts +0 -6
- package/dist/types/server/src/api/utils/cert.d.ts +0 -11
- package/dist/types/server/src/api/utils/constants.d.ts +0 -13
- package/dist/types/server/src/api/utils/fetch.d.ts +0 -1
- package/dist/types/server/src/api/utils/moveFiles.d.ts +0 -4
- package/dist/types/server/src/api/utils/parse.d.ts +0 -2
- package/dist/types/server/src/api/websocket/go2rtc.d.ts +0 -21
- package/dist/types/server/src/api/websocket/index.d.ts +0 -16
- package/dist/types/server/src/api/websocket/nsp/logs.d.ts +0 -19
- package/dist/types/server/src/api/websocket/nsp/main.d.ts +0 -9
- package/dist/types/server/src/api/websocket/nsp/metrics.d.ts +0 -24
- package/dist/types/server/src/api/websocket/nsp/notifications.d.ts +0 -12
- package/dist/types/server/src/api/websocket/nsp/plugins.d.ts +0 -13
- package/dist/types/server/src/api/websocket/nsp/proxy.d.ts +0 -27
- package/dist/types/server/src/api/websocket/nsp/server.d.ts +0 -26
- package/dist/types/server/src/api/websocket/nsp/status.d.ts +0 -15
- package/dist/types/server/src/api/websocket/types.d.ts +0 -41
- package/dist/types/server/src/api.d.ts +0 -29
- package/dist/types/server/src/camera/controller.d.ts +0 -61
- package/dist/types/server/src/camera/frameWorker.d.ts +0 -45
- package/dist/types/server/src/camera/types.d.ts +0 -11
- package/dist/types/server/src/go2rtc/index.d.ts +0 -25
- package/dist/types/server/src/go2rtc/types.d.ts +0 -14
- package/dist/types/server/src/main.d.ts +0 -25
- package/dist/types/server/src/nats/index.d.ts +0 -40
- package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +0 -22
- package/dist/types/server/src/nats/proxy/coreManager.d.ts +0 -14
- package/dist/types/server/src/nats/proxy/deviceManager.d.ts +0 -14
- package/dist/types/server/src/nats/server.d.ts +0 -38
- package/dist/types/server/src/nats/types.d.ts +0 -18
- package/dist/types/server/src/nats/utils.d.ts +0 -2
- package/dist/types/server/src/plugins/index.d.ts +0 -33
- package/dist/types/server/src/plugins/plugin.d.ts +0 -35
- package/dist/types/server/src/plugins/schema.d.ts +0 -34
- package/dist/types/server/src/plugins/types.d.ts +0 -7
- package/dist/types/server/src/plugins/worker.d.ts +0 -55
- package/dist/types/server/src/services/config/constants.d.ts +0 -6
- package/dist/types/server/src/services/config/index.d.ts +0 -67
- package/dist/types/server/src/services/config/types.d.ts +0 -156
- package/dist/types/server/src/services/logger/index.d.ts +0 -16
- package/dist/types/server/src/types.d.ts +0 -31
- package/dist/types/shared/types/index.d.ts +0 -21
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { BaseCameraDevice } from '../../../../../packages/plugineer/src/polyglot/node/camera/index.js';
|
|
2
|
-
import { CameraInterface } from '../../../../../packages/plugineer/src/polyglot/node/camera/interfaces/camera.js';
|
|
3
|
-
import { CameraPTZInterface } from '../../../../../packages/plugineer/src/polyglot/node/camera/interfaces/ptz.js';
|
|
4
|
-
import { Go2RTCSession } from '../streaming/go2rts-session.js';
|
|
5
|
-
import type { Camera, CameraInternalSource, CameraSource } from '../../../../../shared/types/index.js';
|
|
6
|
-
import type { SocketService } from '../socket.js';
|
|
7
|
-
import type { BaseLogger, CameraDevice, Go2RTCSessionOptions } from '../types.js';
|
|
8
|
-
export declare class CameraDeviceProxy extends BaseCameraDevice implements CameraDevice {
|
|
9
|
-
private socketService;
|
|
10
|
-
private socket;
|
|
11
|
-
private pluginName;
|
|
12
|
-
private subject;
|
|
13
|
-
private _started;
|
|
14
|
-
get started(): boolean;
|
|
15
|
-
protected cameraDelegate: CameraInterface;
|
|
16
|
-
protected ptzDelegate: CameraPTZInterface;
|
|
17
|
-
get sources(): CameraSource[];
|
|
18
|
-
get internalSources(): CameraInternalSource[];
|
|
19
|
-
constructor(camera: Camera, socketService: SocketService, logger: BaseLogger);
|
|
20
|
-
start(): Promise<void>;
|
|
21
|
-
stop(): void;
|
|
22
|
-
close(): void;
|
|
23
|
-
connect(): Promise<void>;
|
|
24
|
-
disconnect(): Promise<void>;
|
|
25
|
-
createWebRTCSession(options: Go2RTCSessionOptions): Go2RTCSession;
|
|
26
|
-
refreshStates(): Promise<void>;
|
|
27
|
-
cleanup(): Promise<void>;
|
|
28
|
-
private listenToMessages;
|
|
29
|
-
private onRequest;
|
|
30
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { CoreManager as CoreManagerInterface, FfmpegArgs, IceServer } from '../../../../../shared/types/index.js';
|
|
2
|
-
import type { SocketService } from '../socket.js';
|
|
3
|
-
import type { BaseLogger } from '../types.js';
|
|
4
|
-
export declare class CoreManager implements CoreManagerInterface {
|
|
5
|
-
private socketService;
|
|
6
|
-
private socket;
|
|
7
|
-
private logger;
|
|
8
|
-
private pluginName;
|
|
9
|
-
private subject;
|
|
10
|
-
constructor(socketService: SocketService, logger: BaseLogger);
|
|
11
|
-
getFFmpegPath(): Promise<string>;
|
|
12
|
-
getHwaccelInfo(targetCodec: 'h264' | 'h265'): Promise<FfmpegArgs>;
|
|
13
|
-
getServerAddresses(): Promise<string[]>;
|
|
14
|
-
getIceServers(): Promise<IceServer[]>;
|
|
15
|
-
private onRequest;
|
|
16
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { SocketService } from '../socket.js';
|
|
2
|
-
import type { BaseLogger, CameraDevice } from '../types.js';
|
|
3
|
-
interface DeviceManagerBrowserProxyMethods {
|
|
4
|
-
getCameraByName(name: string): Promise<CameraDevice | undefined>;
|
|
5
|
-
getCameraById(id: string): Promise<CameraDevice | undefined>;
|
|
6
|
-
}
|
|
7
|
-
export declare class DeviceManager implements DeviceManagerBrowserProxyMethods {
|
|
8
|
-
private socketService;
|
|
9
|
-
private socket;
|
|
10
|
-
private logger;
|
|
11
|
-
private pluginName;
|
|
12
|
-
private subject;
|
|
13
|
-
constructor(socketService: SocketService, logger: BaseLogger);
|
|
14
|
-
getCameraById(id: string): Promise<CameraDevice | undefined>;
|
|
15
|
-
getCameraByName(name: string): Promise<CameraDevice | undefined>;
|
|
16
|
-
private onRequest;
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Manager } from 'socket.io-client';
|
|
2
|
-
import type { Socket } from 'socket.io-client';
|
|
3
|
-
export declare class SocketService {
|
|
4
|
-
socket: Socket;
|
|
5
|
-
private token;
|
|
6
|
-
private endpoint;
|
|
7
|
-
private socketList;
|
|
8
|
-
constructor(endpoint: string, token: string);
|
|
9
|
-
close(): void;
|
|
10
|
-
getSocket(id: string, forceNew?: boolean): {
|
|
11
|
-
manager: Manager;
|
|
12
|
-
socket: Socket;
|
|
13
|
-
};
|
|
14
|
-
private createManager;
|
|
15
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { VideoStreamingMode } from '../../../../../shared/types/index.js';
|
|
2
|
-
import type { SocketService } from '../socket.js';
|
|
3
|
-
import type { BaseLogger, CameraDevice, Go2RTCSessionOptions } from '../types.js';
|
|
4
|
-
export declare class Go2RTCSession extends EventTarget {
|
|
5
|
-
private cameraDevice;
|
|
6
|
-
private socketService;
|
|
7
|
-
private logger;
|
|
8
|
-
private options;
|
|
9
|
-
private videoPlayer;
|
|
10
|
-
private socket;
|
|
11
|
-
private streamId;
|
|
12
|
-
hasBackchannel: boolean;
|
|
13
|
-
hasAudio: boolean;
|
|
14
|
-
closed: boolean;
|
|
15
|
-
private pc;
|
|
16
|
-
private micTransceiver;
|
|
17
|
-
private buf;
|
|
18
|
-
private mediaSource;
|
|
19
|
-
private sourceBuffer;
|
|
20
|
-
private bufLen;
|
|
21
|
-
private mseCodecs;
|
|
22
|
-
private videoPlayerMp4?;
|
|
23
|
-
private media;
|
|
24
|
-
private codecList;
|
|
25
|
-
private wsReconnectTimeout?;
|
|
26
|
-
private webrtcConnectTimeout?;
|
|
27
|
-
private webrtcReconnectTimeout?;
|
|
28
|
-
private wsReconnectTimer?;
|
|
29
|
-
private webrtcReconnectTimer;
|
|
30
|
-
private webrtcTimeoutTimer;
|
|
31
|
-
private _finishLoading;
|
|
32
|
-
private _firstFrameReceived;
|
|
33
|
-
private animationFrameId?;
|
|
34
|
-
private isAutoSwitching;
|
|
35
|
-
get mode(): VideoStreamingMode;
|
|
36
|
-
private get logPrefix();
|
|
37
|
-
constructor(cameraDevice: CameraDevice, socketService: SocketService, logger: BaseLogger, options: Go2RTCSessionOptions);
|
|
38
|
-
connect(customMode?: VideoStreamingMode): void;
|
|
39
|
-
disconnect(): void;
|
|
40
|
-
reconnect(customMode?: VideoStreamingMode): Promise<void>;
|
|
41
|
-
reset(): void;
|
|
42
|
-
close(): void;
|
|
43
|
-
toggleMicrophone(track: MediaStreamTrack | null): Promise<void>;
|
|
44
|
-
private onWsOpen;
|
|
45
|
-
private onWsClose;
|
|
46
|
-
private onWsMessage;
|
|
47
|
-
private requestWebrtc;
|
|
48
|
-
private onWebrtcData;
|
|
49
|
-
private requestMse;
|
|
50
|
-
private onMseData;
|
|
51
|
-
private onMseBuffer;
|
|
52
|
-
private requestAuto;
|
|
53
|
-
private requestMjpeg;
|
|
54
|
-
private onMjpegBuffer;
|
|
55
|
-
private requestMp4;
|
|
56
|
-
private onMp4Buffer;
|
|
57
|
-
private requestHls;
|
|
58
|
-
private onHlsData;
|
|
59
|
-
private handleAutoMode;
|
|
60
|
-
private evaluateStreamQuality;
|
|
61
|
-
private evaluateMSEQuality;
|
|
62
|
-
private onStreamInfo;
|
|
63
|
-
private play;
|
|
64
|
-
private onFirstFrameWebrtc;
|
|
65
|
-
private onFirstFrame;
|
|
66
|
-
private onFinishLoading;
|
|
67
|
-
private setMode;
|
|
68
|
-
private createCodecsList;
|
|
69
|
-
private parseCodecs;
|
|
70
|
-
private btoaBinary;
|
|
71
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { Observable, Subject } from 'rxjs';
|
|
2
|
-
import type { BaseCameraDevice } from '../../../../packages/plugineer/src/polyglot/node/camera/index.js';
|
|
3
|
-
import type { VideoStreamingMode } from '../../../../shared/types/index.js';
|
|
4
|
-
import type { Go2RTCSession } from './streaming/go2rts-session.js';
|
|
5
|
-
export type { AudioSetEvent, AudioState, BatterySetEvent, BatteryState, CameraDetectionSettings, CameraRoles, CameraSource, CameraZone, Detection, DetectionZone, DoorbellState, LightSetEvent, LightState, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, Point, SirenSetEvent, SirenState, VideoStreamingMode, ZoneFilter, ZoneType, } from '../../../../shared/types/index.js';
|
|
6
|
-
export type { Go2RTCSession } from './streaming/go2rts-session.js';
|
|
7
|
-
export type CameraUiClientConfig = WithCredentials | WithToken;
|
|
8
|
-
export interface BasicBrowserPeerConnection {
|
|
9
|
-
enableMicrophone(track: MediaStreamTrack): void;
|
|
10
|
-
disableMicrophone(): void;
|
|
11
|
-
createOffer(): Promise<RTCSessionDescriptionInit>;
|
|
12
|
-
acceptAnswer(answer: {
|
|
13
|
-
type: 'answer';
|
|
14
|
-
sdp: string;
|
|
15
|
-
}): Promise<void>;
|
|
16
|
-
addIceCandidate(candidate: Partial<RTCIceCandidate>): Promise<void>;
|
|
17
|
-
onIceCandidate: Subject<RTCIceCandidate>;
|
|
18
|
-
onConnectionState: Observable<RTCPeerConnectionState>;
|
|
19
|
-
close(): void;
|
|
20
|
-
}
|
|
21
|
-
export interface CameraDevice extends BaseCameraDevice {
|
|
22
|
-
readonly started: boolean;
|
|
23
|
-
start(): Promise<void>;
|
|
24
|
-
stop(): void;
|
|
25
|
-
close(): void;
|
|
26
|
-
createWebRTCSession(options: Go2RTCSessionOptions): Go2RTCSession;
|
|
27
|
-
}
|
|
28
|
-
export interface Go2RTCSessionOptions {
|
|
29
|
-
sourceName: string;
|
|
30
|
-
mode: VideoStreamingMode;
|
|
31
|
-
videoElement: HTMLVideoElement;
|
|
32
|
-
wsReconnectTimeout?: number;
|
|
33
|
-
webrtcConnectTimeout?: number;
|
|
34
|
-
}
|
|
35
|
-
export interface BaseLogger {
|
|
36
|
-
log: (...args: any[]) => void;
|
|
37
|
-
error: (...args: any[]) => void;
|
|
38
|
-
warn: (...args: any[]) => void;
|
|
39
|
-
success: (...args: any[]) => void;
|
|
40
|
-
debug: (...args: any[]) => void;
|
|
41
|
-
trace: (...args: any[]) => void;
|
|
42
|
-
attention: (...args: any[]) => void;
|
|
43
|
-
}
|
|
44
|
-
interface BaseConfig {
|
|
45
|
-
endpoint: string;
|
|
46
|
-
skipCheck?: boolean;
|
|
47
|
-
logger?: BaseLogger;
|
|
48
|
-
}
|
|
49
|
-
interface WithCredentials extends BaseConfig {
|
|
50
|
-
username: string;
|
|
51
|
-
password: string;
|
|
52
|
-
token?: never;
|
|
53
|
-
}
|
|
54
|
-
interface WithToken extends BaseConfig {
|
|
55
|
-
username?: never;
|
|
56
|
-
password?: never;
|
|
57
|
-
token: string;
|
|
58
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const isMobile: () => boolean;
|
|
2
|
-
export declare const isAndroid: () => boolean;
|
|
3
|
-
export declare const isIphone: () => boolean;
|
|
4
|
-
export declare const isIpad: () => boolean;
|
|
5
|
-
export declare const isAppleMobile: () => boolean;
|
|
6
|
-
export declare const iosVersion: () => number[] | undefined;
|
|
7
|
-
export declare const isSafari: () => boolean;
|
|
8
|
-
export declare const safariVersion: () => RegExpExecArray | null;
|
|
9
|
-
export declare const isFirefox: () => boolean;
|
|
10
|
-
export declare const isChrome: () => boolean;
|
|
11
|
-
export declare const isTouch: () => boolean;
|
|
12
|
-
export declare const generateUUID: () => string;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { CameraDelegates, LoggerService } from '@camera.ui/types';
|
|
2
|
-
import type { ProxyConnection, ProxySubscription } from './nats.js';
|
|
3
|
-
export declare const NATS_SERVER_SUBJECT = "camera.ui-server";
|
|
4
|
-
export interface DeserializedError {
|
|
5
|
-
name: string;
|
|
6
|
-
message: string;
|
|
7
|
-
stack: string;
|
|
8
|
-
}
|
|
9
|
-
export declare class RemoteError extends Error {
|
|
10
|
-
constructor(error: DeserializedError, cause: Omit<ProxyMessageStructure, 'error'>);
|
|
11
|
-
}
|
|
12
|
-
export interface QueueItem {
|
|
13
|
-
message: ProxyMessageStructure;
|
|
14
|
-
resolve: (response: any) => void;
|
|
15
|
-
reject: (error: RemoteError) => void;
|
|
16
|
-
}
|
|
17
|
-
export interface ProxyMessageStructure {
|
|
18
|
-
requestId: string;
|
|
19
|
-
cameraId?: string;
|
|
20
|
-
targetId: string;
|
|
21
|
-
targetName?: string;
|
|
22
|
-
pluginId: string;
|
|
23
|
-
type: 'request' | 'reply';
|
|
24
|
-
proxy: 'device' | 'camera' | 'plugin' | 'core';
|
|
25
|
-
client: 'cameraFn' | 'pluginFn' | 'deviceFn' | 'storageFn' | 'coreFn' | keyof CameraDelegates;
|
|
26
|
-
fn: string;
|
|
27
|
-
args: any[];
|
|
28
|
-
timeout: number;
|
|
29
|
-
timestamp: number;
|
|
30
|
-
response?: any;
|
|
31
|
-
error?: DeserializedError;
|
|
32
|
-
}
|
|
33
|
-
export declare class MessageQueue {
|
|
34
|
-
private logger;
|
|
35
|
-
private type;
|
|
36
|
-
private publisher;
|
|
37
|
-
private subscriber;
|
|
38
|
-
private requestHandler;
|
|
39
|
-
private aborted;
|
|
40
|
-
private isProcessing;
|
|
41
|
-
private queue;
|
|
42
|
-
private pendingResponses;
|
|
43
|
-
constructor(type: 'server' | 'client', publisher: ProxyConnection, subscriber: ProxySubscription, logger: LoggerService, requestHandler: (message: ProxyMessageStructure) => void);
|
|
44
|
-
abortQueue(): void;
|
|
45
|
-
enqueue(message: ProxyMessageStructure): Promise<any>;
|
|
46
|
-
private processQueue;
|
|
47
|
-
private onMessage;
|
|
48
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import type { Msg, NatsConnection, Subscription as NatsSubscription, RequestOptions } from 'nats';
|
|
3
|
-
export interface AuthConfig {
|
|
4
|
-
user: string;
|
|
5
|
-
password: string;
|
|
6
|
-
}
|
|
7
|
-
export declare interface ProxySubscription {
|
|
8
|
-
on(event: 'message', listener: (message: Msg) => void): this;
|
|
9
|
-
emit(event: 'message', message: Msg): boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare class ProxySubscription extends EventEmitter implements ProxySubscription {
|
|
12
|
-
readonly subscriber: NatsSubscription;
|
|
13
|
-
constructor(subscriber: NatsSubscription);
|
|
14
|
-
listen(): Promise<void>;
|
|
15
|
-
close(): void;
|
|
16
|
-
}
|
|
17
|
-
export declare class ProxyConnection {
|
|
18
|
-
private name;
|
|
19
|
-
private servers;
|
|
20
|
-
private auth;
|
|
21
|
-
private publisher?;
|
|
22
|
-
private subscribers;
|
|
23
|
-
private closed;
|
|
24
|
-
constructor(name: string, servers: string[], auth: AuthConfig);
|
|
25
|
-
connect(): Promise<NatsConnection>;
|
|
26
|
-
subscribe(subject: string, skipListening?: boolean): ProxySubscription;
|
|
27
|
-
publish(subject: string, message: any): void;
|
|
28
|
-
request(subject: string, message: any, opts?: RequestOptions): Promise<any>;
|
|
29
|
-
close(): Promise<void>;
|
|
30
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Subscribed as SubscribedInterface } from '@camera.ui/types';
|
|
2
|
-
import type { Subscription } from 'rxjs';
|
|
3
|
-
export declare class Subscribed {
|
|
4
|
-
private readonly subscriptions;
|
|
5
|
-
private readonly additionalSubscriptions;
|
|
6
|
-
protected addSubscriptions(...subscriptions: Subscription[]): void;
|
|
7
|
-
protected addAdditionalSubscriptions(...subscriptions: Subscription[]): void;
|
|
8
|
-
protected unsubscribe(): void;
|
|
9
|
-
protected unsubscribeAdditional(): void;
|
|
10
|
-
}
|
|
11
|
-
export declare class SubscribedPublic implements SubscribedInterface {
|
|
12
|
-
private readonly subscriptions;
|
|
13
|
-
private readonly additionalSubscriptions;
|
|
14
|
-
addSubscriptions(...subscriptions: Subscription[]): void;
|
|
15
|
-
addAdditionalSubscriptions(...subscriptions: Subscription[]): void;
|
|
16
|
-
unsubscribe(): void;
|
|
17
|
-
unsubscribeAdditional(): void;
|
|
18
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { Subscribed } from '@camera.ui/common/utils';
|
|
2
|
-
import TTLCache from '@isaacs/ttlcache';
|
|
3
|
-
import { BehaviorSubject } from 'rxjs';
|
|
4
|
-
import type { AudioSetEvent, AudioState, BatterySetEvent, BatteryState, Camera, CameraDelegate, CameraDetectionSettings, CameraFrameWorkerSettings, CameraInformation, CameraInput, CameraInternalSource, CameraPTZDelegate, CameraSource, CameraType, DetectionZone, DoorbellSetEvent, DoorbellState, LightSetEvent, LightState, LoggerService, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, SetValues, SirenSetEvent, SirenState, StateValues } from '@camera.ui/types';
|
|
5
|
-
import type { Observable } from 'rxjs';
|
|
6
|
-
export declare abstract class BaseCameraDevice extends Subscribed {
|
|
7
|
-
readonly logger: LoggerService;
|
|
8
|
-
protected snapshotCache: TTLCache<string, ArrayBuffer>;
|
|
9
|
-
protected cameraSubject: BehaviorSubject<Camera>;
|
|
10
|
-
protected cameraState: BehaviorSubject<boolean>;
|
|
11
|
-
protected lightState: BehaviorSubject<LightState>;
|
|
12
|
-
protected motionState: BehaviorSubject<MotionState>;
|
|
13
|
-
protected audioState: BehaviorSubject<AudioState>;
|
|
14
|
-
protected objectState: BehaviorSubject<ObjectState>;
|
|
15
|
-
protected doorbellState: BehaviorSubject<DoorbellState>;
|
|
16
|
-
protected sirenState: BehaviorSubject<SirenState>;
|
|
17
|
-
protected batteryState: BehaviorSubject<BatteryState>;
|
|
18
|
-
readonly onConnected: Observable<boolean>;
|
|
19
|
-
readonly onLightSwitched: Observable<LightState>;
|
|
20
|
-
readonly onMotionDetected: Observable<MotionState>;
|
|
21
|
-
readonly onAudioDetected: Observable<AudioState>;
|
|
22
|
-
readonly onObjectDetected: Observable<ObjectState>;
|
|
23
|
-
readonly onDoorbellPressed: Observable<DoorbellState>;
|
|
24
|
-
readonly onSirenDetected: Observable<SirenState>;
|
|
25
|
-
readonly onBatteryChanged: Observable<BatteryState>;
|
|
26
|
-
protected abstract cameraDelegate: CameraDelegate;
|
|
27
|
-
protected abstract ptzDelegate: CameraPTZDelegate;
|
|
28
|
-
protected get cameraObject(): Camera;
|
|
29
|
-
get id(): string;
|
|
30
|
-
get nativeId(): string | undefined;
|
|
31
|
-
get pluginId(): string;
|
|
32
|
-
get connected(): boolean;
|
|
33
|
-
get disabled(): boolean;
|
|
34
|
-
get name(): string;
|
|
35
|
-
get type(): CameraType;
|
|
36
|
-
get info(): CameraInformation;
|
|
37
|
-
get isCloud(): boolean;
|
|
38
|
-
get hasLight(): boolean;
|
|
39
|
-
get hasSiren(): boolean;
|
|
40
|
-
get hasBinarySensor(): boolean;
|
|
41
|
-
get hasBattery(): boolean;
|
|
42
|
-
get hasMotionDetector(): boolean;
|
|
43
|
-
get extendedMotionDetector(): boolean;
|
|
44
|
-
get hasAudioDetector(): boolean;
|
|
45
|
-
get hasObjectDetector(): boolean;
|
|
46
|
-
get hasPtz(): boolean;
|
|
47
|
-
get snapshotTTL(): number;
|
|
48
|
-
get detectionZones(): DetectionZone[];
|
|
49
|
-
get detectionSettings(): CameraDetectionSettings;
|
|
50
|
-
get frameWorkerSettings(): CameraFrameWorkerSettings;
|
|
51
|
-
get streamSource(): CameraSource;
|
|
52
|
-
get snapshotSource(): CameraInput | undefined;
|
|
53
|
-
get highResolutionSource(): CameraSource | undefined;
|
|
54
|
-
get midResolutionSource(): CameraSource | undefined;
|
|
55
|
-
get lowResolutionSource(): CameraSource | undefined;
|
|
56
|
-
get ptz(): CameraPTZDelegate;
|
|
57
|
-
abstract get sources(): CameraSource[];
|
|
58
|
-
abstract get internalSources(): CameraInternalSource[];
|
|
59
|
-
constructor(camera: Camera, logger: LoggerService);
|
|
60
|
-
protected abstract cleanup(): void;
|
|
61
|
-
getValue<T extends keyof StateValues>(stateName: T): StateValues[T];
|
|
62
|
-
snapshot(forceNew?: boolean): Promise<ArrayBuffer | undefined>;
|
|
63
|
-
onStateChange<T extends keyof StateValues>(stateName: T): Observable<{
|
|
64
|
-
newState: StateValues[T];
|
|
65
|
-
oldState: StateValues[T];
|
|
66
|
-
}>;
|
|
67
|
-
onPropertyChange<T extends keyof Camera>(property: T | T[]): Observable<{
|
|
68
|
-
property: T;
|
|
69
|
-
oldData: Camera[T];
|
|
70
|
-
newData: Camera[T];
|
|
71
|
-
}>;
|
|
72
|
-
protected removeAllListeners(): void;
|
|
73
|
-
protected updateCamera(updatedCamera: Camera): void;
|
|
74
|
-
protected updateCameraState(state: boolean): void;
|
|
75
|
-
protected updateStateInternal<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], skipCheck?: boolean, skipDetectionsCheck?: boolean): void;
|
|
76
|
-
protected checkStateInternal<T extends keyof SetValues>(stateName: T, event: SetValues[T], skipDetectionsCheck?: boolean): {
|
|
77
|
-
changed: boolean;
|
|
78
|
-
event: StateValues[T];
|
|
79
|
-
};
|
|
80
|
-
protected stateChanged<T extends keyof SetValues>(oldState?: SetValues[T], newState?: SetValues[T], type?: keyof StateValues): boolean;
|
|
81
|
-
protected getAudioState(event: AudioSetEvent, ignoreLastEvet?: boolean): AudioState;
|
|
82
|
-
protected getMotionState(event: MotionSetEvent, ignoreLastEvet?: boolean): MotionState;
|
|
83
|
-
protected getObjectState(event: ObjectSetEvent, ignoreLastEvet?: boolean): ObjectState;
|
|
84
|
-
protected getDoorbellState(event: DoorbellSetEvent, ignoreLastEvet?: boolean): DoorbellState;
|
|
85
|
-
protected getLightState(event: LightSetEvent, ignoreLastEvet?: boolean): LightState;
|
|
86
|
-
protected getSirenState(event: SirenSetEvent, ignoreLastEvet?: boolean): SirenState;
|
|
87
|
-
protected getBatteryState(event: BatterySetEvent, ignoreLastEvet?: boolean): BatteryState;
|
|
88
|
-
protected cleanState<T extends keyof StateValues>(state: StateValues[T] | SetValues[T]): SetValues[T];
|
|
89
|
-
private isStateEvent;
|
|
90
|
-
private createStateObservable;
|
|
91
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { CameraDelegate } from '@camera.ui/types';
|
|
2
|
-
export declare class CameraInterface implements CameraDelegate {
|
|
3
|
-
delegate?: CameraDelegate;
|
|
4
|
-
private onRequest;
|
|
5
|
-
constructor(onRequest: (client: any, fn: string, args?: any[], timeout?: number) => Promise<any>);
|
|
6
|
-
snapshot(): Promise<ArrayBuffer | undefined>;
|
|
7
|
-
private _onRequest;
|
|
8
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { CameraPTZDelegate } from '@camera.ui/types';
|
|
2
|
-
export declare class CameraPTZInterface implements CameraPTZDelegate {
|
|
3
|
-
delegate?: CameraPTZDelegate;
|
|
4
|
-
private onRequest;
|
|
5
|
-
constructor(onRequest: (client: any, fn: string, args?: any[], timeout?: number) => Promise<any>);
|
|
6
|
-
moveAbsolute(pan: number, tilt: number, zoom: number): Promise<void>;
|
|
7
|
-
moveRelative(pan: number, tilt: number, zoom: number): Promise<void>;
|
|
8
|
-
moveContinuous(pan: number, tilt: number, zoom: number): Promise<void>;
|
|
9
|
-
stop(): Promise<void>;
|
|
10
|
-
private _onRequest;
|
|
11
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { CameraDetectionSettings, Detection, DetectionZone } from '@camera.ui/types';
|
|
2
|
-
export declare const convertZonePointsToPixels: (zone: DetectionZone, detection: Detection) => DetectionZone;
|
|
3
|
-
export declare const convertBoundingBoxToPixels: (detection: Detection) => Detection;
|
|
4
|
-
export declare const areDetectionsValid: (detections: Detection[], zones: DetectionZone[], activitySettings: CameraDetectionSettings) => Detection[];
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { AudioSetEvent, AudioState, BatterySetEvent, BatteryState, DoorbellSetEvent, DoorbellState, FrameData, FrameMetadata, LightSetEvent, LightState, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, SirenSetEvent, SirenState } from '@camera.ui/types';
|
|
2
|
-
import type { CameraInterface } from './interfaces/camera.js';
|
|
3
|
-
import type { CameraPTZInterface } from './interfaces/ptz.js';
|
|
4
|
-
export interface FrameState extends MotionState {
|
|
5
|
-
frameData: FrameData;
|
|
6
|
-
metadata: FrameMetadata;
|
|
7
|
-
}
|
|
8
|
-
export type States = LightState | MotionState | AudioState | ObjectState | DoorbellState | SirenState | BatteryState;
|
|
9
|
-
export type Sets = LightSetEvent | MotionSetEvent | AudioSetEvent | ObjectSetEvent | DoorbellSetEvent | SirenSetEvent | BatterySetEvent;
|
|
10
|
-
export interface CameraInterfaces {
|
|
11
|
-
readonly cameraDelegate: CameraInterface;
|
|
12
|
-
readonly ptzDelegate: CameraPTZInterface;
|
|
13
|
-
}
|
|
14
|
-
export type DelegateMethods = {
|
|
15
|
-
[K in keyof CameraInterfaces]: {
|
|
16
|
-
[M in keyof CameraInterfaces[K]]: M extends string ? M : never;
|
|
17
|
-
}[keyof CameraInterfaces[K]];
|
|
18
|
-
}[keyof CameraInterfaces];
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { JsonSchema, JsonSchemaArray, JsonSchemaBoolean, JsonSchemaButton, JsonSchemaEnum, JsonSchemaForm, JsonSchemaNumber, JsonSchemaObject, JsonSchemaObjectWithButtons, JsonSchemaString, RootSchema } from '@camera.ui/types';
|
|
2
|
-
/**
|
|
3
|
-
* Generate a JSON object from a given Root JSON schema.
|
|
4
|
-
*
|
|
5
|
-
* @param rootSchema - The Root JSON schema.
|
|
6
|
-
* @returns - The generated JSON object.
|
|
7
|
-
*/
|
|
8
|
-
export declare const generateJsonFromRootSchema: (rootSchema: RootSchema) => Record<string, any>;
|
|
9
|
-
/**
|
|
10
|
-
* Generate a JSON object from a JSON schema.
|
|
11
|
-
*
|
|
12
|
-
* @param jsonSchema - The JSON schema.
|
|
13
|
-
* @returns - The generated JSON object.
|
|
14
|
-
*/
|
|
15
|
-
export declare const generateJsonFromSchema: (jsonSchema: JsonSchema) => any;
|
|
16
|
-
/**
|
|
17
|
-
* Removes all functions from a given Plugin JSON schema form.
|
|
18
|
-
*
|
|
19
|
-
* @param schemaForm - The Plugin JSON schema form from which the functions should be removed.
|
|
20
|
-
* @returns - The Plugin JSON schema form without functions.
|
|
21
|
-
*/
|
|
22
|
-
export declare const removeFunctionsFromSchemaForm: (schemaForm: JsonSchemaForm) => JsonSchemaForm;
|
|
23
|
-
/**
|
|
24
|
-
* Removes all functions from a given Plugin JSON schema.
|
|
25
|
-
*
|
|
26
|
-
* @param jsonSchema - The JSON schema from which the functions should be removed.
|
|
27
|
-
* @returns - The JSON schema without functions.
|
|
28
|
-
*/
|
|
29
|
-
export declare const removeFunctionsFromSchema: (jsonSchema: JsonSchema) => JsonSchema;
|
|
30
|
-
/**
|
|
31
|
-
* Converts a config path to a schema path.
|
|
32
|
-
*
|
|
33
|
-
* @param configPath - The config path to be converted.
|
|
34
|
-
* @returns - The converted schema path.
|
|
35
|
-
*/
|
|
36
|
-
export declare const configPathToSchemaPath: (configPath: string) => string;
|
|
37
|
-
/**
|
|
38
|
-
* Converts a schema path to a config path.
|
|
39
|
-
*
|
|
40
|
-
* @param schemaPath - The schema path to be converted.
|
|
41
|
-
* @returns - The converted config path.
|
|
42
|
-
*/
|
|
43
|
-
export declare const schemaPathToConfigPath: (schemaPath: string) => string;
|
|
44
|
-
/**
|
|
45
|
-
* Recursively searches a JSON object for a specific, potentially nested key path and returns its value.
|
|
46
|
-
*
|
|
47
|
-
* @param obj - The JSON object to be searched.
|
|
48
|
-
* @param path - The key path to search for.
|
|
49
|
-
* @returns - The value of the searched key path, if found, otherwise undefined.
|
|
50
|
-
*/
|
|
51
|
-
export declare const getValueByPath: (obj: Record<any, any> | undefined, path: string) => any;
|
|
52
|
-
export declare const isStringType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaString;
|
|
53
|
-
export declare const isNumberType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaNumber;
|
|
54
|
-
export declare const isBooleanType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaBoolean;
|
|
55
|
-
export declare const isEnumType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaEnum;
|
|
56
|
-
export declare const isObjectType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaObject;
|
|
57
|
-
export declare const isObjectTypeWithButtons: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaObjectWithButtons;
|
|
58
|
-
export declare const isArrayType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaArray;
|
|
59
|
-
export declare const isButtonType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaButton;
|
|
60
|
-
export declare const isValidableStringType: (jsonSchema: JsonSchema) => jsonSchema is JsonSchemaString;
|
|
61
|
-
export declare const isJsonSchema: (value: any) => value is JsonSchema;
|
|
62
|
-
export declare const isPrimitiveType: (value: any) => value is JsonSchemaString | JsonSchemaNumber | JsonSchemaBoolean | JsonSchemaEnum;
|