@camera.ui/browser 0.0.101 → 0.0.102
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/types.d.ts +1 -0
- package/dist/types/packages/plugineer/src/polyglot/node/camera/index.d.ts +2 -1
- package/dist/types/packages/plugineer/src/polyglot/node/camera/polygon.d.ts +1 -2
- package/dist/types/packages/plugineer/src/polyglot/node/plugins/types.d.ts +4 -0
- package/dist/types/packages/types/src/index.d.ts +5 -1
- package/dist/types/server/src/api/database/checks.d.ts +55 -0
- package/dist/types/server/src/api/database/index.d.ts +2 -1
- package/dist/types/server/src/api/database/migration.d.ts +1 -0
- package/dist/types/server/src/api/database/selfcheck.d.ts +48 -0
- package/dist/types/server/src/api/schemas/cameras.schema.d.ts +13 -13
- package/dist/types/server/src/api/services/cameras.service.d.ts +1 -0
- package/dist/types/server/src/api/services/plugins.service.d.ts +1 -0
- package/dist/types/server/src/api/types/index.d.ts +0 -5
- package/dist/types/server/src/api/websocket/nsp/logs.d.ts +7 -1
- package/dist/types/server/src/api/websocket/nsp/metrics.d.ts +1 -1
- package/dist/types/server/src/api/websocket/nsp/status.d.ts +1 -1
- package/dist/types/server/src/api.d.ts +5 -14
- package/dist/types/server/src/camera/controller.d.ts +16 -3
- package/dist/types/server/src/{decoder/worker.d.ts → camera/frameWorker.d.ts} +8 -5
- package/dist/types/server/src/plugins/index.d.ts +2 -4
- package/dist/types/server/src/plugins/plugin.d.ts +5 -0
- package/dist/types/server/src/plugins/worker.d.ts +16 -2
- package/dist/types/server/src/services/config/constants.d.ts +1 -0
- package/dist/types/server/src/services/config/index.d.ts +11 -2
- package/dist/types/server/src/services/config/types.d.ts +7 -0
- package/dist/types/shared/types/index.d.ts +0 -1
- package/package.json +3 -3
- package/dist/types/server/src/decoder/index.d.ts +0 -11
- package/dist/types/server/src/decoder/types.d.ts +0 -7
|
@@ -35,6 +35,7 @@ export interface BaseLogger {
|
|
|
35
35
|
log: (...args: any[]) => void;
|
|
36
36
|
error: (...args: any[]) => void;
|
|
37
37
|
warn: (...args: any[]) => void;
|
|
38
|
+
success: (...args: any[]) => void;
|
|
38
39
|
debug: (...args: any[]) => void;
|
|
39
40
|
trace: (...args: any[]) => void;
|
|
40
41
|
attention: (...args: any[]) => void;
|
|
@@ -4,7 +4,7 @@ import { BehaviorSubject } from 'rxjs';
|
|
|
4
4
|
import type { AudioSetEvent, AudioState, BatterySetEvent, BatteryState, Camera, CameraActivitySettings, CameraDelegate, CameraFrameWorkerSettings, CameraInformation, CameraPTZDelegate, CameraPrebufferDelegate, CameraSource, CameraType, DetectionZone, DoorbellSetEvent, DoorbellState, LightSetEvent, LightState, LoggerService, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, SetValues, SirenSetEvent, SirenState, StateValues } from '@camera.ui/types';
|
|
5
5
|
import type { Observable } from 'rxjs';
|
|
6
6
|
export declare abstract class BaseCameraDevice extends Subscribed {
|
|
7
|
-
|
|
7
|
+
readonly logger: LoggerService;
|
|
8
8
|
protected snapshotCache: TTLCache<string, ArrayBuffer>;
|
|
9
9
|
protected cameraSubject: BehaviorSubject<Camera>;
|
|
10
10
|
protected cameraState: BehaviorSubject<boolean>;
|
|
@@ -41,6 +41,7 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
41
41
|
get hasBinarySensor(): boolean;
|
|
42
42
|
get hasBattery(): boolean;
|
|
43
43
|
get hasMotionDetector(): boolean;
|
|
44
|
+
get extendedMotionDetector(): boolean;
|
|
44
45
|
get hasAudioDetector(): boolean;
|
|
45
46
|
get hasObjectDetector(): boolean;
|
|
46
47
|
get hasPtz(): boolean;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { CameraActivitySettings, Detection, DetectionZone } from '@camera.ui/types';
|
|
2
2
|
export declare const convertZonePointsToPixels: (zone: DetectionZone, detection: Detection) => DetectionZone;
|
|
3
3
|
export declare const convertBoundingBoxToPixels: (detection: Detection) => Detection;
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const areObjectDetectionsValid: (detections: Detection[], zones: DetectionZone[], activitySettings: CameraActivitySettings) => Detection[];
|
|
4
|
+
export declare const areDetectionsValid: (detections: Detection[], zones: DetectionZone[], activitySettings: CameraActivitySettings) => Detection[];
|
|
@@ -47,8 +47,12 @@ export type ExtensionOrSupport = {
|
|
|
47
47
|
extension?: never;
|
|
48
48
|
supportAdditionalCameras?: boolean;
|
|
49
49
|
};
|
|
50
|
+
export interface PluginOptions {
|
|
51
|
+
extendedMotionDetection?: boolean;
|
|
52
|
+
}
|
|
50
53
|
export interface PluginContractBase {
|
|
51
54
|
builtIns?: CameraExtensionWithoutHub[];
|
|
55
|
+
options?: PluginOptions;
|
|
52
56
|
dependencies?: string[];
|
|
53
57
|
pythonVersion?: string;
|
|
54
58
|
}
|
|
@@ -18,7 +18,7 @@ export type DecoderFormat = 'yuv' | 'rgb';
|
|
|
18
18
|
export type ImageInputFormat = 'yuv' | 'rgb' | 'rgba' | 'gray';
|
|
19
19
|
export type ImageOutputFormat = 'rgb' | 'rgba' | 'gray';
|
|
20
20
|
export type CameraExtension = 'hub' | 'prebuffer' | 'motionDetection' | 'objectDetection' | 'audioDetection' | 'ptz';
|
|
21
|
-
export type CameraFrameWorkerDecoder = 'pillow' | 'wasm';
|
|
21
|
+
export type CameraFrameWorkerDecoder = 'pillow' | 'wasm' | 'rust';
|
|
22
22
|
export type CameraFrameWorkerResolution = '3840x2160' | '3072x1728' | '2560x1440' | '1920x1080' | '1440x1080' | '1280x720' | '960x540' | '640x480' | '640x360' | '320x240' | '320x180';
|
|
23
23
|
export type AudioCodec = 'PCMU' | 'PCMA' | 'MPEG4-GENERIC' | 'opus' | 'G722' | 'MPA' | 'PCM' | 'FLAC';
|
|
24
24
|
export type AudioFFmpegCodec = 'pcm_mulaw' | 'pcm_alaw' | 'aac' | 'libopus' | 'g722' | 'mp3' | 'pcm_s16be' | 'pcm_s16le' | 'flac';
|
|
@@ -386,6 +386,7 @@ export interface Camera extends Omit<BaseCamera, 'activityZones'> {
|
|
|
386
386
|
hasAudioDetector: boolean;
|
|
387
387
|
hasMotionDetector: boolean;
|
|
388
388
|
hasObjectDetector: boolean;
|
|
389
|
+
extendedMotionDetector: boolean;
|
|
389
390
|
hasPtz: boolean;
|
|
390
391
|
hasPrebuffer: boolean;
|
|
391
392
|
sources: CameraInput[];
|
|
@@ -407,6 +408,7 @@ export interface CameraDevice {
|
|
|
407
408
|
readonly hasBinarySensor: boolean;
|
|
408
409
|
readonly hasBattery: boolean;
|
|
409
410
|
readonly hasMotionDetector: boolean;
|
|
411
|
+
readonly extendedMotionDetector: boolean;
|
|
410
412
|
readonly hasAudioDetector: boolean;
|
|
411
413
|
readonly hasObjectDetector: boolean;
|
|
412
414
|
readonly hasPtz: boolean;
|
|
@@ -430,6 +432,7 @@ export interface CameraDevice {
|
|
|
430
432
|
readonly onDoorbellPressed: Observable<DoorbellState>;
|
|
431
433
|
readonly onSirenDetected: Observable<SirenState>;
|
|
432
434
|
readonly onBatteryChanged: Observable<BatteryState>;
|
|
435
|
+
readonly logger: LoggerService;
|
|
433
436
|
snapshot(forceNew?: boolean): Promise<ArrayBuffer | undefined>;
|
|
434
437
|
onStateChange<T extends keyof StateValues>(stateName: T): Observable<{
|
|
435
438
|
newState: StateValues[T];
|
|
@@ -602,6 +605,7 @@ export interface LoggerService {
|
|
|
602
605
|
log: (...args: any[]) => void;
|
|
603
606
|
error: (...args: any[]) => void;
|
|
604
607
|
warn: (...args: any[]) => void;
|
|
608
|
+
success: (...args: any[]) => void;
|
|
605
609
|
debug: (...args: any[]) => void;
|
|
606
610
|
trace: (...args: any[]) => void;
|
|
607
611
|
attention: (...args: any[]) => void;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface PathExistenceResult {
|
|
2
|
+
path: string;
|
|
3
|
+
exists: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface FFmpegExistenceResult {
|
|
6
|
+
path: string;
|
|
7
|
+
exists: boolean;
|
|
8
|
+
hasPermissions: boolean;
|
|
9
|
+
error?: Error;
|
|
10
|
+
}
|
|
11
|
+
export interface PathPermissionsResult {
|
|
12
|
+
path: string;
|
|
13
|
+
hasPermissions: boolean;
|
|
14
|
+
error?: Error;
|
|
15
|
+
}
|
|
16
|
+
export interface CleanedUpFilesResult {
|
|
17
|
+
path: string;
|
|
18
|
+
wasCleaned: boolean;
|
|
19
|
+
error?: Error;
|
|
20
|
+
}
|
|
21
|
+
export interface DatabaseCorruptionResult {
|
|
22
|
+
dbPath: string;
|
|
23
|
+
isCorrupt: boolean;
|
|
24
|
+
error?: Error;
|
|
25
|
+
}
|
|
26
|
+
export interface PortAvailabilityResult {
|
|
27
|
+
port: number;
|
|
28
|
+
isAvailable: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface OrphanedProcessesResult {
|
|
31
|
+
processInfo: ProcInfo;
|
|
32
|
+
killed?: boolean;
|
|
33
|
+
wasOrphaned?: boolean;
|
|
34
|
+
error?: Error;
|
|
35
|
+
}
|
|
36
|
+
export interface PathPermission {
|
|
37
|
+
path: string;
|
|
38
|
+
mode: number;
|
|
39
|
+
}
|
|
40
|
+
export interface ProcInfo {
|
|
41
|
+
pid: number;
|
|
42
|
+
startTime: number;
|
|
43
|
+
command: string;
|
|
44
|
+
args: string[];
|
|
45
|
+
titles?: string[];
|
|
46
|
+
uniqueId?: string;
|
|
47
|
+
}
|
|
48
|
+
export declare function checkPathsExist(pathsToCheck: string[]): Promise<PathExistenceResult[]>;
|
|
49
|
+
export declare function checkPathPermissions(pathsWithPermissionsToCheck: PathPermission[]): Promise<PathPermissionsResult[]>;
|
|
50
|
+
export declare function cleanUpFiles(filesToClean: string[]): Promise<CleanedUpFilesResult[]>;
|
|
51
|
+
export declare function checkDatabaseCorruption(dbPath: string): Promise<DatabaseCorruptionResult>;
|
|
52
|
+
export declare function checkPortAvailability(portsToCheck: number[]): Promise<PortAvailabilityResult[]>;
|
|
53
|
+
export declare function checkFfmpegBinary(ffmpegPaths: string[]): Promise<PathExistenceResult[]>;
|
|
54
|
+
export declare function checkOrphanedProcesses(processInfos: ProcInfo[]): Promise<OrphanedProcessesResult[]>;
|
|
55
|
+
export declare function checkInstalledFFmpegs(): Promise<FFmpegExistenceResult[]>;
|
|
@@ -2,7 +2,7 @@ import type { FastifyInstance } from 'fastify';
|
|
|
2
2
|
import type { Database as DB, RootDatabase as RootDB } from 'lmdb';
|
|
3
3
|
import type { DBAuth, DBCamera, DBPlugin, DBSettings, DBSystem, DBUser } from './types.js';
|
|
4
4
|
export declare class Database {
|
|
5
|
-
static readonly VERSION = "1.0.
|
|
5
|
+
static readonly VERSION = "1.0.4";
|
|
6
6
|
authDB: RootDB<DBAuth, 'auth'>;
|
|
7
7
|
camerasDB: DB<DBCamera[], 'cameras'>;
|
|
8
8
|
pluginsDB: DB<DBPlugin[], 'plugins'>;
|
|
@@ -11,6 +11,7 @@ export declare class Database {
|
|
|
11
11
|
systemDB: DB<DBSystem, 'system'>;
|
|
12
12
|
private lowdb;
|
|
13
13
|
private databaseMigration;
|
|
14
|
+
private selfCheck;
|
|
14
15
|
private databases;
|
|
15
16
|
private app;
|
|
16
17
|
private configService;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CleanedUpFilesResult, DatabaseCorruptionResult, FFmpegExistenceResult, OrphanedProcessesResult, PathExistenceResult, PathPermissionsResult, PortAvailabilityResult } from './checks.js';
|
|
2
|
+
export interface SelfCheckConfig {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
checks: {
|
|
5
|
+
pathsExistence: boolean;
|
|
6
|
+
pathsPermissions: boolean;
|
|
7
|
+
cleanupFiles: boolean;
|
|
8
|
+
databaseCorruption: boolean;
|
|
9
|
+
portAvailability: boolean;
|
|
10
|
+
ffmpegBinaries: boolean;
|
|
11
|
+
orphanedProcesses: boolean;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface SelfCheckResults {
|
|
15
|
+
status: 'success' | 'error' | 'disabled';
|
|
16
|
+
error?: string;
|
|
17
|
+
pathsExistence?: PathExistenceResult[];
|
|
18
|
+
pathsPermissions?: PathPermissionsResult[];
|
|
19
|
+
cleanedUpFiles?: CleanedUpFilesResult[];
|
|
20
|
+
databaseCorruption?: DatabaseCorruptionResult;
|
|
21
|
+
portAvailability?: PortAvailabilityResult[];
|
|
22
|
+
installedFFmpegs?: FFmpegExistenceResult[];
|
|
23
|
+
orphanedProcesses?: OrphanedProcessesResult[];
|
|
24
|
+
}
|
|
25
|
+
export declare class SelfCheck {
|
|
26
|
+
private logger;
|
|
27
|
+
private configService;
|
|
28
|
+
private config;
|
|
29
|
+
constructor(config?: Partial<SelfCheckConfig>);
|
|
30
|
+
run(): Promise<void>;
|
|
31
|
+
private performChecks;
|
|
32
|
+
private checkForCriticalIssues;
|
|
33
|
+
private checkForNonCriticalIssues;
|
|
34
|
+
private saveCheckReport;
|
|
35
|
+
private generateCheckReport;
|
|
36
|
+
private formatIssues;
|
|
37
|
+
private formatPathsExistence;
|
|
38
|
+
private formatPathsPermissions;
|
|
39
|
+
private formatCleanedUpFiles;
|
|
40
|
+
private formatDatabaseCorruption;
|
|
41
|
+
private formatPortAvailability;
|
|
42
|
+
private formatFfmpegBinaries;
|
|
43
|
+
private formatOrphanedProcesses;
|
|
44
|
+
private sanitizeDetails;
|
|
45
|
+
private serializeError;
|
|
46
|
+
private getPathName;
|
|
47
|
+
private isCriticalPath;
|
|
48
|
+
}
|
|
@@ -218,15 +218,15 @@ export declare const extensionsSettingsSchema: zod.ZodObject<{
|
|
|
218
218
|
}>;
|
|
219
219
|
export declare const streamingModeSchema: zod.ZodUnion<[zod.ZodLiteral<"mse">, zod.ZodLiteral<"webrtc">, zod.ZodLiteral<"webrtc/tcp">, zod.ZodLiteral<"mjpeg">, zod.ZodLiteral<"hls">, zod.ZodLiteral<"mp4">]>;
|
|
220
220
|
export declare const frameWorkerSettingsSchema: zod.ZodObject<{
|
|
221
|
-
decoder: zod.ZodUnion<[zod.ZodLiteral<"pillow">, zod.ZodLiteral<"wasm">]>;
|
|
221
|
+
decoder: zod.ZodUnion<[zod.ZodLiteral<"pillow">, zod.ZodLiteral<"wasm">, zod.ZodLiteral<"rust">]>;
|
|
222
222
|
fps: zod.ZodNumber;
|
|
223
223
|
resolution: zod.ZodUnion<[zod.ZodLiteral<"3840x2160">, zod.ZodLiteral<"3072x1728">, zod.ZodLiteral<"2560x1440">, zod.ZodLiteral<"1920x1080">, zod.ZodLiteral<"1440x1080">, zod.ZodLiteral<"1280x720">, zod.ZodLiteral<"960x540">, zod.ZodLiteral<"640x480">, zod.ZodLiteral<"640x360">, zod.ZodLiteral<"320x240">, zod.ZodLiteral<"320x180">]>;
|
|
224
224
|
}, "strip", zod.ZodTypeAny, {
|
|
225
|
-
decoder: "pillow" | "wasm";
|
|
225
|
+
decoder: "pillow" | "wasm" | "rust";
|
|
226
226
|
fps: number;
|
|
227
227
|
resolution: "3840x2160" | "3072x1728" | "2560x1440" | "1920x1080" | "1440x1080" | "1280x720" | "960x540" | "640x480" | "640x360" | "320x240" | "320x180";
|
|
228
228
|
}, {
|
|
229
|
-
decoder: "pillow" | "wasm";
|
|
229
|
+
decoder: "pillow" | "wasm" | "rust";
|
|
230
230
|
fps: number;
|
|
231
231
|
resolution: "3840x2160" | "3072x1728" | "2560x1440" | "1920x1080" | "1440x1080" | "1280x720" | "960x540" | "640x480" | "640x360" | "320x240" | "320x180";
|
|
232
232
|
}>;
|
|
@@ -468,15 +468,15 @@ export declare const createCameraSchema: zod.ZodObject<{
|
|
|
468
468
|
};
|
|
469
469
|
}>>;
|
|
470
470
|
frameWorkerSettings: zod.ZodDefault<zod.ZodObject<{
|
|
471
|
-
decoder: zod.ZodUnion<[zod.ZodLiteral<"pillow">, zod.ZodLiteral<"wasm">]>;
|
|
471
|
+
decoder: zod.ZodUnion<[zod.ZodLiteral<"pillow">, zod.ZodLiteral<"wasm">, zod.ZodLiteral<"rust">]>;
|
|
472
472
|
fps: zod.ZodNumber;
|
|
473
473
|
resolution: zod.ZodUnion<[zod.ZodLiteral<"3840x2160">, zod.ZodLiteral<"3072x1728">, zod.ZodLiteral<"2560x1440">, zod.ZodLiteral<"1920x1080">, zod.ZodLiteral<"1440x1080">, zod.ZodLiteral<"1280x720">, zod.ZodLiteral<"960x540">, zod.ZodLiteral<"640x480">, zod.ZodLiteral<"640x360">, zod.ZodLiteral<"320x240">, zod.ZodLiteral<"320x180">]>;
|
|
474
474
|
}, "strip", zod.ZodTypeAny, {
|
|
475
|
-
decoder: "pillow" | "wasm";
|
|
475
|
+
decoder: "pillow" | "wasm" | "rust";
|
|
476
476
|
fps: number;
|
|
477
477
|
resolution: "3840x2160" | "3072x1728" | "2560x1440" | "1920x1080" | "1440x1080" | "1280x720" | "960x540" | "640x480" | "640x360" | "320x240" | "320x180";
|
|
478
478
|
}, {
|
|
479
|
-
decoder: "pillow" | "wasm";
|
|
479
|
+
decoder: "pillow" | "wasm" | "rust";
|
|
480
480
|
fps: number;
|
|
481
481
|
resolution: "3840x2160" | "3072x1728" | "2560x1440" | "1920x1080" | "1440x1080" | "1280x720" | "960x540" | "640x480" | "640x360" | "320x240" | "320x180";
|
|
482
482
|
}>>;
|
|
@@ -523,7 +523,7 @@ export declare const createCameraSchema: zod.ZodObject<{
|
|
|
523
523
|
};
|
|
524
524
|
};
|
|
525
525
|
frameWorkerSettings: {
|
|
526
|
-
decoder: "pillow" | "wasm";
|
|
526
|
+
decoder: "pillow" | "wasm" | "rust";
|
|
527
527
|
fps: number;
|
|
528
528
|
resolution: "3840x2160" | "3072x1728" | "2560x1440" | "1920x1080" | "1440x1080" | "1280x720" | "960x540" | "640x480" | "640x360" | "320x240" | "320x180";
|
|
529
529
|
};
|
|
@@ -602,7 +602,7 @@ export declare const createCameraSchema: zod.ZodObject<{
|
|
|
602
602
|
};
|
|
603
603
|
} | undefined;
|
|
604
604
|
frameWorkerSettings?: {
|
|
605
|
-
decoder: "pillow" | "wasm";
|
|
605
|
+
decoder: "pillow" | "wasm" | "rust";
|
|
606
606
|
fps: number;
|
|
607
607
|
resolution: "3840x2160" | "3072x1728" | "2560x1440" | "1920x1080" | "1440x1080" | "1280x720" | "960x540" | "640x480" | "640x360" | "320x240" | "320x180";
|
|
608
608
|
} | undefined;
|
|
@@ -820,15 +820,15 @@ export declare const patchCameraSchema: zod.ZodObject<{
|
|
|
820
820
|
} | undefined;
|
|
821
821
|
}>>;
|
|
822
822
|
frameWorkerSettings: zod.ZodOptional<zod.ZodObject<{
|
|
823
|
-
decoder: zod.ZodOptional<zod.ZodUnion<[zod.ZodLiteral<"pillow">, zod.ZodLiteral<"wasm">]>>;
|
|
823
|
+
decoder: zod.ZodOptional<zod.ZodUnion<[zod.ZodLiteral<"pillow">, zod.ZodLiteral<"wasm">, zod.ZodLiteral<"rust">]>>;
|
|
824
824
|
fps: zod.ZodOptional<zod.ZodNumber>;
|
|
825
825
|
resolution: zod.ZodOptional<zod.ZodUnion<[zod.ZodLiteral<"3840x2160">, zod.ZodLiteral<"3072x1728">, zod.ZodLiteral<"2560x1440">, zod.ZodLiteral<"1920x1080">, zod.ZodLiteral<"1440x1080">, zod.ZodLiteral<"1280x720">, zod.ZodLiteral<"960x540">, zod.ZodLiteral<"640x480">, zod.ZodLiteral<"640x360">, zod.ZodLiteral<"320x240">, zod.ZodLiteral<"320x180">]>>;
|
|
826
826
|
}, "strip", zod.ZodTypeAny, {
|
|
827
|
-
decoder?: "pillow" | "wasm" | undefined;
|
|
827
|
+
decoder?: "pillow" | "wasm" | "rust" | undefined;
|
|
828
828
|
fps?: number | undefined;
|
|
829
829
|
resolution?: "3840x2160" | "3072x1728" | "2560x1440" | "1920x1080" | "1440x1080" | "1280x720" | "960x540" | "640x480" | "640x360" | "320x240" | "320x180" | undefined;
|
|
830
830
|
}, {
|
|
831
|
-
decoder?: "pillow" | "wasm" | undefined;
|
|
831
|
+
decoder?: "pillow" | "wasm" | "rust" | undefined;
|
|
832
832
|
fps?: number | undefined;
|
|
833
833
|
resolution?: "3840x2160" | "3072x1728" | "2560x1440" | "1920x1080" | "1440x1080" | "1280x720" | "960x540" | "640x480" | "640x360" | "320x240" | "320x180" | undefined;
|
|
834
834
|
}>>;
|
|
@@ -868,7 +868,7 @@ export declare const patchCameraSchema: zod.ZodObject<{
|
|
|
868
868
|
} | undefined;
|
|
869
869
|
} | undefined;
|
|
870
870
|
frameWorkerSettings?: {
|
|
871
|
-
decoder?: "pillow" | "wasm" | undefined;
|
|
871
|
+
decoder?: "pillow" | "wasm" | "rust" | undefined;
|
|
872
872
|
fps?: number | undefined;
|
|
873
873
|
resolution?: "3840x2160" | "3072x1728" | "2560x1440" | "1920x1080" | "1440x1080" | "1280x720" | "960x540" | "640x480" | "640x360" | "320x240" | "320x180" | undefined;
|
|
874
874
|
} | undefined;
|
|
@@ -931,7 +931,7 @@ export declare const patchCameraSchema: zod.ZodObject<{
|
|
|
931
931
|
} | undefined;
|
|
932
932
|
} | undefined;
|
|
933
933
|
frameWorkerSettings?: {
|
|
934
|
-
decoder?: "pillow" | "wasm" | undefined;
|
|
934
|
+
decoder?: "pillow" | "wasm" | "rust" | undefined;
|
|
935
935
|
fps?: number | undefined;
|
|
936
936
|
resolution?: "3840x2160" | "3072x1728" | "2560x1440" | "1920x1080" | "1440x1080" | "1280x720" | "960x540" | "640x480" | "640x360" | "320x240" | "320x180" | undefined;
|
|
937
937
|
} | undefined;
|
|
@@ -12,6 +12,7 @@ export declare class PluginsService {
|
|
|
12
12
|
getPluginProcessByName(pluginName: string): PluginWorker | undefined;
|
|
13
13
|
getPluginProcessById(id: string): PluginWorker | undefined;
|
|
14
14
|
installedPlugins(): Plugin[];
|
|
15
|
+
installedPluginsByIdentifier(): string[];
|
|
15
16
|
installedPluginProcesses(): PluginWorker[];
|
|
16
17
|
listPluginDb(): DBPlugin[];
|
|
17
18
|
getPluginDbByName(pluginName: string): DBPlugin | undefined;
|
|
@@ -183,11 +183,6 @@ export interface PaginationQuery {
|
|
|
183
183
|
export type PaginationRequest = {
|
|
184
184
|
Querystring: PaginationQuery;
|
|
185
185
|
};
|
|
186
|
-
export type DownloadLogRequest = {
|
|
187
|
-
Querystring: {
|
|
188
|
-
filter?: string;
|
|
189
|
-
};
|
|
190
|
-
};
|
|
191
186
|
export type AuthParamsRequest = {
|
|
192
187
|
Params: {
|
|
193
188
|
id: string;
|
|
@@ -4,8 +4,14 @@ export declare class LogsNamespace {
|
|
|
4
4
|
nsp: Namespace;
|
|
5
5
|
nspName: SocketNsp;
|
|
6
6
|
private nativeTail?;
|
|
7
|
+
private api;
|
|
7
8
|
private configService;
|
|
9
|
+
private pluginManager;
|
|
8
10
|
constructor(io: Server);
|
|
9
|
-
|
|
11
|
+
getAllLogs(socket: Socket): void;
|
|
12
|
+
getCameraLog(socket: Socket, cameraName: string): void;
|
|
13
|
+
getPluginLog(socket: Socket, pluginName: string): void;
|
|
10
14
|
private tailLogFromFileNative;
|
|
15
|
+
private removeName;
|
|
16
|
+
private removeBracketedContent;
|
|
11
17
|
}
|
|
@@ -3,8 +3,8 @@ import type { ProcessInfo, ServerProcesses, SocketNsp, WorkerProcesses } from '.
|
|
|
3
3
|
export declare class MetricsNamespace {
|
|
4
4
|
nsp: Namespace;
|
|
5
5
|
nspName: SocketNsp;
|
|
6
|
+
private api;
|
|
6
7
|
private pluginManager;
|
|
7
|
-
private frameManager;
|
|
8
8
|
private go2rtc;
|
|
9
9
|
private natsServer;
|
|
10
10
|
private processServerHistory;
|
|
@@ -3,9 +3,9 @@ import type { ServerRuntime, SocketNsp, WorkerRuntime } from '../types.js';
|
|
|
3
3
|
export declare class StatusNamespace {
|
|
4
4
|
nsp: Namespace;
|
|
5
5
|
nspName: SocketNsp;
|
|
6
|
+
private api;
|
|
6
7
|
private configService;
|
|
7
8
|
private pluginManager;
|
|
8
|
-
private frameManager;
|
|
9
9
|
private go2rtc;
|
|
10
10
|
private natsServer;
|
|
11
11
|
constructor(io: Server);
|
|
@@ -3,7 +3,6 @@ import { EventEmitter } from 'node:events';
|
|
|
3
3
|
import { CameraController } from './camera/controller.js';
|
|
4
4
|
import type { Camera, CameraExtension } from '@camera.ui/types';
|
|
5
5
|
import type { CameraExtensions } from './api/database/types.js';
|
|
6
|
-
import type { FrameWorker } from './decoder/worker.js';
|
|
7
6
|
export declare enum API_EVENT {
|
|
8
7
|
FINISH_LAUNCHING = "finishLaunching",
|
|
9
8
|
SHUTDOWN = "shutdown"
|
|
@@ -15,23 +14,15 @@ export declare interface CameraUiAPI {
|
|
|
15
14
|
emit(event: 'shutdown'): boolean;
|
|
16
15
|
}
|
|
17
16
|
export declare class CameraUiAPI extends EventEmitter {
|
|
18
|
-
private
|
|
17
|
+
private cameraControllers;
|
|
19
18
|
constructor();
|
|
20
19
|
configureCameras(): Promise<void>;
|
|
21
|
-
addCamera(camera: Camera): Promise<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}>;
|
|
25
|
-
getCamera(cameraId: string): {
|
|
26
|
-
controller: CameraController;
|
|
27
|
-
worker: FrameWorker;
|
|
28
|
-
} | undefined;
|
|
29
|
-
getCameras(pluginId?: string): {
|
|
30
|
-
controller: CameraController;
|
|
31
|
-
worker: FrameWorker;
|
|
32
|
-
}[];
|
|
20
|
+
addCamera(camera: Camera): Promise<CameraController>;
|
|
21
|
+
getCamera(cameraIdOrName: string): CameraController | undefined;
|
|
22
|
+
getCameras(pluginId?: string): CameraController[];
|
|
33
23
|
updateCamera(camera: Camera): void;
|
|
34
24
|
removeCamera(camera: Camera, extensions: CameraExtensions): Promise<void>;
|
|
35
25
|
selectCamera(pluginId: string, camera: Camera, extension: CameraExtension): void;
|
|
36
26
|
deselectCamera(pluginId: string, camera: Camera, extension: CameraExtension): void;
|
|
27
|
+
writeCameraLog(cameraId: string, msg: string): void;
|
|
37
28
|
}
|
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
import { CameraDevice, CameraPrebufferInterface, CameraPTZInterface } from '@camera.ui/plugineer';
|
|
2
2
|
import type { Logger } from '@camera.ui/common/logger';
|
|
3
3
|
import type { Camera, CameraConfigInputSettings, CameraDelegate, CameraDeviceInternalSource, CameraDeviceSource, MotionFrame, ProbeStream, SetValues, VideoFrame } from '@camera.ui/types';
|
|
4
|
-
import
|
|
4
|
+
import { FrameWorker } from './frameWorker.js';
|
|
5
5
|
export declare class CameraController extends CameraDevice {
|
|
6
|
-
readonly
|
|
6
|
+
readonly frameWorker: FrameWorker;
|
|
7
7
|
readonly streamInfos: Map<string, ProbeStream>;
|
|
8
|
+
private logStream?;
|
|
8
9
|
private motionTimeout?;
|
|
9
10
|
private objectTimeout?;
|
|
10
11
|
private objectTimeoutDuration;
|
|
11
12
|
private doorbellTimeout?;
|
|
12
13
|
private doorbellTimeoutDuration;
|
|
14
|
+
private proxyServer;
|
|
13
15
|
private go2rtcApi;
|
|
16
|
+
private configService;
|
|
17
|
+
private api;
|
|
18
|
+
private truncateInterval?;
|
|
19
|
+
private truncateIntervalMs;
|
|
14
20
|
protected cameraDelegate: CameraDelegate;
|
|
15
21
|
protected ptzDelegate: CameraPTZInterface;
|
|
16
22
|
protected prebufferDelegate: CameraPrebufferInterface;
|
|
23
|
+
get logPath(): string;
|
|
17
24
|
get streamSource(): CameraDeviceSource;
|
|
18
25
|
get camera(): Camera;
|
|
19
26
|
get sources(): CameraDeviceSource[];
|
|
20
27
|
get internalSources(): CameraDeviceInternalSource[];
|
|
21
28
|
private get _sources();
|
|
22
|
-
constructor(camera: Camera, logger: Logger
|
|
29
|
+
constructor(camera: Camera, logger: Logger);
|
|
23
30
|
setDelegate(): void;
|
|
24
31
|
getFrames(): AsyncIterableIterator<VideoFrame>;
|
|
25
32
|
getMotionFrames(): AsyncIterableIterator<MotionFrame>;
|
|
@@ -32,6 +39,8 @@ export declare class CameraController extends CameraDevice {
|
|
|
32
39
|
removeCameraSource(sourceId: string): Promise<void>;
|
|
33
40
|
updateCamera(updatedCamera: Camera): void;
|
|
34
41
|
cleanup(): void;
|
|
42
|
+
writeLog(...args: any[]): void;
|
|
43
|
+
private internalLog;
|
|
35
44
|
private subscribeToCameraState;
|
|
36
45
|
private subscribeToCameraChanges;
|
|
37
46
|
private subscribeToStateChanges;
|
|
@@ -46,4 +55,8 @@ export declare class CameraController extends CameraDevice {
|
|
|
46
55
|
private getAudioCodecProperties;
|
|
47
56
|
private getVideoCodecProperties;
|
|
48
57
|
private generateSdp;
|
|
58
|
+
private createLogStream;
|
|
59
|
+
private closeLogStream;
|
|
60
|
+
private removeLogStream;
|
|
61
|
+
private truncateLog;
|
|
49
62
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Subscribed } from '@camera.ui/common';
|
|
2
2
|
import { PLUGIN_STATUS } from '@camera.ui/plugineer';
|
|
3
3
|
import type { AuthConfig } from '@camera.ui/plugineer';
|
|
4
|
-
import type { CameraController } from '
|
|
4
|
+
import type { CameraController } from './controller.js';
|
|
5
5
|
export declare class FrameWorker extends Subscribed {
|
|
6
6
|
readonly frameWorkerId: string;
|
|
7
7
|
name: string;
|
|
@@ -11,10 +11,11 @@ export declare class FrameWorker extends Subscribed {
|
|
|
11
11
|
private publisher?;
|
|
12
12
|
private subscriber?;
|
|
13
13
|
private coreManager;
|
|
14
|
-
private
|
|
14
|
+
private frameWorkerLogger;
|
|
15
|
+
private processLogger;
|
|
15
16
|
private configService;
|
|
16
17
|
private socketService;
|
|
17
|
-
private
|
|
18
|
+
private cameraController;
|
|
18
19
|
private frameWorker?;
|
|
19
20
|
private initialized;
|
|
20
21
|
private stopped;
|
|
@@ -25,16 +26,18 @@ export declare class FrameWorker extends Subscribed {
|
|
|
25
26
|
private py;
|
|
26
27
|
private _status;
|
|
27
28
|
get status(): PLUGIN_STATUS;
|
|
28
|
-
constructor(
|
|
29
|
+
constructor(cameraController: CameraController, proxyEndpoints: string[], auth: AuthConfig);
|
|
29
30
|
start(): Promise<void>;
|
|
30
31
|
close(): Promise<void>;
|
|
31
32
|
restart(): Promise<void>;
|
|
32
33
|
getPID(): number;
|
|
33
34
|
private startWorker;
|
|
34
35
|
private restartWorker;
|
|
36
|
+
private reset;
|
|
35
37
|
private killWorker;
|
|
36
38
|
private sendMessage;
|
|
37
39
|
private onChildMessage;
|
|
38
40
|
private setStatus;
|
|
39
|
-
private
|
|
41
|
+
private internalLog;
|
|
42
|
+
private createPythonPath;
|
|
40
43
|
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import { Plugin } from './plugin.js';
|
|
3
|
-
import { PluginWorker } from './worker.js';
|
|
4
3
|
import type { IPackageJson } from '../api/types/index.js';
|
|
5
4
|
export declare class PluginManager {
|
|
6
5
|
private logger;
|
|
7
6
|
private api;
|
|
8
7
|
private configService;
|
|
9
|
-
private pythonVersionsToInstall;
|
|
10
8
|
installedPythonVersions: Set<string>;
|
|
11
|
-
plugins: Map<string, Plugin>;
|
|
12
|
-
pluginWorkers: Map<string, PluginWorker>;
|
|
13
9
|
searchPaths: Set<string>;
|
|
10
|
+
plugins: Map<string, Plugin>;
|
|
11
|
+
pluginIdentifiers: Set<string>;
|
|
14
12
|
constructor();
|
|
15
13
|
static isQualifiedPluginIdentifier(pluginName: string): boolean;
|
|
16
14
|
static extractPluginScope(pluginName: string): string | undefined;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { PythonInstaller } from '@camera.ui/plugineer';
|
|
2
|
+
import { PluginWorker } from './worker.js';
|
|
2
3
|
import type { PluginContract } from '@camera.ui/plugineer';
|
|
4
|
+
import type { CameraExtension } from '@camera.ui/types';
|
|
3
5
|
import type { CameraUiPlugin, IPackageJson } from '../api/types/index.js';
|
|
4
6
|
export declare class Plugin {
|
|
5
7
|
private logger;
|
|
@@ -19,11 +21,14 @@ export declare class Plugin {
|
|
|
19
21
|
readonly configFile: string;
|
|
20
22
|
readonly storagePath: string;
|
|
21
23
|
readonly py: PythonInstaller;
|
|
24
|
+
readonly logPath: string;
|
|
25
|
+
readonly worker: PluginWorker;
|
|
22
26
|
get contract(): PluginContract;
|
|
23
27
|
get info(): CameraUiPlugin;
|
|
24
28
|
set info(value: CameraUiPlugin);
|
|
25
29
|
get disabled(): boolean;
|
|
26
30
|
set disabled(value: boolean);
|
|
31
|
+
get type(): CameraExtension[];
|
|
27
32
|
constructor(pluginName: string, installPath: string, packageJSON: IPackageJson, pluginId: string, scope?: string);
|
|
28
33
|
load(): Promise<void>;
|
|
29
34
|
reparsePackageJson(): void;
|
|
@@ -4,8 +4,11 @@ export declare class PluginWorker {
|
|
|
4
4
|
plugin: Plugin;
|
|
5
5
|
private pluginWorker?;
|
|
6
6
|
private proxyServer;
|
|
7
|
+
private logStream?;
|
|
7
8
|
private api;
|
|
8
|
-
private
|
|
9
|
+
private mainLogger;
|
|
10
|
+
private pluginLogger;
|
|
11
|
+
private processLogger;
|
|
9
12
|
private configService;
|
|
10
13
|
private socketService;
|
|
11
14
|
private pluginManager;
|
|
@@ -15,16 +18,20 @@ export declare class PluginWorker {
|
|
|
15
18
|
private targetSubject;
|
|
16
19
|
private started;
|
|
17
20
|
private shuttingDown;
|
|
21
|
+
private truncateInterval?;
|
|
22
|
+
private truncateIntervalMs;
|
|
18
23
|
private _status;
|
|
19
24
|
get status(): PLUGIN_STATUS;
|
|
20
25
|
constructor(plugin: Plugin);
|
|
21
26
|
start(): Promise<void>;
|
|
22
27
|
teardown(): Promise<void>;
|
|
23
|
-
destroy(): void
|
|
28
|
+
destroy(): Promise<void>;
|
|
24
29
|
restart(): Promise<void>;
|
|
30
|
+
disable(): void;
|
|
25
31
|
getPID(): number;
|
|
26
32
|
isRunning(): boolean;
|
|
27
33
|
isReady(): boolean;
|
|
34
|
+
cleanup(): Promise<void>;
|
|
28
35
|
private gatherDevices;
|
|
29
36
|
private kill;
|
|
30
37
|
private setStatus;
|
|
@@ -33,5 +40,12 @@ export declare class PluginWorker {
|
|
|
33
40
|
private reset;
|
|
34
41
|
private updatePython;
|
|
35
42
|
private onChildMessage;
|
|
43
|
+
private createPythonPath;
|
|
44
|
+
writeLog(...args: any[]): void;
|
|
45
|
+
private internalLog;
|
|
46
|
+
private createLogStream;
|
|
47
|
+
private closeLogStream;
|
|
48
|
+
private removeLogStream;
|
|
49
|
+
private truncateLog;
|
|
36
50
|
private cleanedProcessEnv;
|
|
37
51
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IceServer } from '@camera.ui/types';
|
|
2
2
|
import type { Go2RtcConfig, IConfig } from './types.js';
|
|
3
|
+
export declare const PROCESS_IDENTIFIER = "--id=camera.ui";
|
|
3
4
|
export declare const APP_NAME: any;
|
|
4
5
|
export declare const DEFAULT_ICE_SERVERS: IceServer[];
|
|
5
6
|
export declare const DEFAULT_CONFIG: IConfig;
|