@camera.ui/browser 0.0.69 → 0.0.70

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.
Files changed (78) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/types/packages/client/browser/src/proxy/cameraDevice.d.ts +1 -2
  3. package/dist/types/server/bin/python.d.ts +43 -0
  4. package/dist/types/server/src/api/database/index.d.ts +24 -0
  5. package/dist/types/server/src/api/database/types.d.ts +12 -34
  6. package/dist/types/server/src/api/go2rtc/api/application.d.ts +9 -0
  7. package/dist/types/server/src/api/go2rtc/api/config.d.ts +9 -0
  8. package/dist/types/server/src/api/go2rtc/api/index.d.ts +2 -0
  9. package/dist/types/server/src/api/go2rtc/api/snapshot.d.ts +8 -0
  10. package/dist/types/server/src/api/go2rtc/api/streams.d.ts +11 -0
  11. package/dist/types/server/src/api/go2rtc/index.d.ts +13 -0
  12. package/dist/types/server/src/api/go2rtc/queue.d.ts +10 -0
  13. package/dist/types/server/src/api/middlewares/socketAuth.middleware.d.ts +41 -0
  14. package/dist/types/server/src/api/services/auth.service.d.ts +20 -0
  15. package/dist/types/server/src/api/services/cameras.service.d.ts +54 -0
  16. package/dist/types/server/src/api/services/plugins.service.d.ts +25 -0
  17. package/dist/types/server/src/api/services/users.service.d.ts +13 -0
  18. package/dist/types/server/src/api/utils/constants.d.ts +15 -0
  19. package/dist/types/server/src/api/websocket/index.d.ts +15 -0
  20. package/dist/types/server/src/api/websocket/nsp/frame.d.ts +10 -0
  21. package/dist/types/server/src/api/websocket/nsp/logs.d.ts +11 -0
  22. package/dist/types/server/src/api/websocket/nsp/metrics.d.ts +33 -0
  23. package/dist/types/server/src/api/websocket/nsp/notifications.d.ts +11 -0
  24. package/dist/types/server/src/api/websocket/nsp/plugins.d.ts +13 -0
  25. package/dist/types/server/src/api/websocket/nsp/server.d.ts +9 -0
  26. package/dist/types/server/src/api/websocket/nsp/status.d.ts +20 -0
  27. package/dist/types/server/src/api/websocket/nsp/streams.d.ts +15 -0
  28. package/dist/types/server/src/api/{ws → websocket}/types.d.ts +1 -1
  29. package/dist/types/server/src/api.d.ts +44 -0
  30. package/dist/types/server/src/camera/base/cameraDevice.d.ts +1 -0
  31. package/dist/types/server/src/camera/base/cameraDeviceBrowser.d.ts +1 -0
  32. package/dist/types/server/src/camera/base/index.d.ts +16 -1
  33. package/dist/types/server/src/camera/controller.d.ts +27 -0
  34. package/dist/types/server/src/camera/types.d.ts +27 -20
  35. package/dist/types/server/src/decoder/index.d.ts +11 -0
  36. package/dist/types/server/src/decoder/types.d.ts +4 -0
  37. package/dist/types/server/src/decoder/worker/index.d.ts +3 -0
  38. package/dist/types/server/src/decoder/worker/runtime/base/index.d.ts +36 -0
  39. package/dist/types/server/src/decoder/worker/runtime/child-process/index.d.ts +17 -0
  40. package/dist/types/server/src/decoder/worker/runtime/worker-thread/index.d.ts +22 -0
  41. package/dist/types/server/src/go2rtc/index.d.ts +25 -0
  42. package/dist/types/server/src/nats/constants.d.ts +1 -0
  43. package/dist/types/server/src/nats/index.d.ts +34 -0
  44. package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +96 -0
  45. package/dist/types/server/src/nats/proxy/deviceManager.d.ts +31 -0
  46. package/dist/types/server/src/nats/proxy/index.d.ts +4 -0
  47. package/dist/types/server/src/nats/proxy/pluginsManager.d.ts +12 -0
  48. package/dist/types/server/src/nats/proxy/systemManager.d.ts +8 -0
  49. package/dist/types/server/src/nats/queue.d.ts +17 -0
  50. package/dist/types/server/src/nats/server.d.ts +33 -0
  51. package/dist/types/server/src/nats/types.d.ts +15 -7
  52. package/dist/types/server/src/nats/utils.d.ts +4 -0
  53. package/dist/types/server/src/nats/websocket.d.ts +22 -0
  54. package/dist/types/server/src/plugins/base.d.ts +7 -0
  55. package/dist/types/server/src/plugins/index.d.ts +29 -0
  56. package/dist/types/server/src/plugins/node/api.d.ts +42 -0
  57. package/dist/types/server/src/plugins/node/cameraStorage.d.ts +108 -0
  58. package/dist/types/server/src/plugins/node/config.d.ts +104 -0
  59. package/dist/types/server/src/plugins/node/logger.d.ts +14 -0
  60. package/dist/types/server/src/plugins/node/proxy/cameraDevice.d.ts +44 -0
  61. package/dist/types/server/src/plugins/node/proxy/deviceManager.d.ts +47 -0
  62. package/dist/types/server/src/plugins/node/proxy/index.d.ts +4 -0
  63. package/dist/types/server/src/plugins/node/proxy/pluginsManager.d.ts +38 -0
  64. package/dist/types/server/src/plugins/node/proxy/queue.d.ts +18 -0
  65. package/dist/types/server/src/plugins/node/proxy/systemManager.d.ts +36 -0
  66. package/dist/types/server/src/plugins/node/schema.d.ts +268 -0
  67. package/dist/types/server/src/plugins/node/storageController.d.ts +28 -0
  68. package/dist/types/server/src/plugins/plugin.d.ts +42 -0
  69. package/dist/types/server/src/plugins/types.d.ts +2 -2
  70. package/dist/types/server/src/plugins/worker-ipc.d.ts +22 -0
  71. package/dist/types/server/src/plugins/worker.d.ts +30 -0
  72. package/dist/types/server/src/services/config/constants.d.ts +6 -0
  73. package/dist/types/server/src/services/config/index.d.ts +60 -0
  74. package/dist/types/server/src/services/logger/index.d.ts +28 -0
  75. package/dist/types/server/src/utils/index.d.ts +6 -0
  76. package/dist/types/shared/types/index.d.ts +1 -1
  77. package/package.json +2 -1
  78. package/.eslintrc.cjs +0 -44
@@ -9,9 +9,8 @@ export declare class CameraDeviceProxy extends BrowserCameraDevice {
9
9
  disconnect(): Promise<void>;
10
10
  reboot(): Promise<void>;
11
11
  getIceServers(): Promise<IceServer[]>;
12
- snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
13
12
  updateState<T extends keyof StateValues>(stateName: T, eventData: OnSetEvent<T>): Promise<void>;
14
13
  refreshStates(): Promise<void>;
15
14
  cleanup(): Promise<void>;
16
- private listenToChanges;
15
+ private listenToMessages;
17
16
  }
@@ -0,0 +1,43 @@
1
+ import { PortablePython } from '@bjia56/portable-python';
2
+ export declare const SERVER_PY_VERSION = "3.11";
3
+ export declare class PythonInstaller {
4
+ static readonly versions: string[];
5
+ readonly python: PortablePython;
6
+ readonly venvPath?: string;
7
+ readonly installPath: string;
8
+ private _version;
9
+ private identifier;
10
+ private logger;
11
+ private configService;
12
+ get isInstalled(): boolean;
13
+ get pluginPythonPath(): string;
14
+ get serverPythonPath(): string;
15
+ get pluginPackagesPath(): string;
16
+ get serverPackagesPath(): string;
17
+ get version(): string;
18
+ private get logPrefix();
19
+ constructor(identifier: string, venvDir?: string, version?: string);
20
+ install(): Promise<void>;
21
+ installPluginPython(): Promise<void>;
22
+ uninstall(): Promise<void>;
23
+ updatePluginDependencies(requirementsPath: string): Promise<void>;
24
+ updateServerDependencies(): Promise<void>;
25
+ installPluginPackages(pkgs: string[]): Promise<string>;
26
+ installServerPackages(pkgs: string[]): Promise<string>;
27
+ uninstallPluginPackages(pkgs: string[]): Promise<string>;
28
+ uninstallServerPackages(pkgs: string[]): Promise<string>;
29
+ private installPluginRequirements;
30
+ private installServerRequirements;
31
+ private updateRequirements;
32
+ private analyzeDependencies;
33
+ private updateDependencies;
34
+ private installRequirements;
35
+ private installPackages;
36
+ private uninstallPackages;
37
+ private getInstalledPackages;
38
+ private ensureVenv;
39
+ private createVenv;
40
+ private removeVenv;
41
+ private cleanPackageName;
42
+ private difference;
43
+ }
@@ -0,0 +1,24 @@
1
+ import { Database as DB, RootDatabase as RootDB } from 'lmdb';
2
+ import type { FastifyInstance } from 'fastify';
3
+ import type { Plugin } from '../../plugins/plugin.js';
4
+ import type { DBAuth, DBCamera, DBPlugin, DBSettings, DBUser } from './types.js';
5
+ export declare class Database {
6
+ private db;
7
+ authDB: RootDB<DBAuth, 'auth'>;
8
+ camerasDB: DB<DBCamera[], 'cameras'>;
9
+ pluginsDB: DB<DBPlugin[], 'plugins'>;
10
+ settingsDB: DB<DBSettings, 'settings'>;
11
+ usersDB: DB<DBUser[], 'users'>;
12
+ private initialized;
13
+ private app;
14
+ private configService;
15
+ private logger;
16
+ constructor(app: FastifyInstance);
17
+ close(): Promise<void>;
18
+ initialize(): Promise<Database>;
19
+ updateCameras(): Promise<void>;
20
+ createPluginDatabase(plugin: Plugin): Promise<void>;
21
+ private ensureDatabases;
22
+ private updateConfig;
23
+ private generateAdmin;
24
+ }
@@ -1,21 +1,20 @@
1
1
  import type { ClientData, JwtTokenEncoded } from '../types/index.js';
2
- export interface DBSettings {
3
- readonly _id: string;
4
- _rev?: string;
5
- settings: DBSetting;
6
- }
7
- export interface DBSetting {
8
- }
9
- export interface DBTokens {
10
- readonly _id: string;
11
- _rev?: string;
2
+ export interface DBAuth {
12
3
  tokens: JwtTokenEncoded[];
13
4
  clients: ClientData[];
14
5
  }
15
- export interface DBUsers {
6
+ export interface DBCamera extends BaseCamera {
7
+ sources: CameraInputSettings[];
8
+ extensions: CameraExtensions;
9
+ interface: CameraUiSettings;
10
+ recording: CameraRecordingSettings;
11
+ }
12
+ export interface DBPlugin {
16
13
  readonly _id: string;
17
- _rev?: string;
18
- users: DBUser[];
14
+ pluginName: string;
15
+ storage: DBPluginStorage;
16
+ }
17
+ export interface DBSettings {
19
18
  }
20
19
  export interface DBUser {
21
20
  readonly _id: string;
@@ -44,16 +43,6 @@ export interface DBCamviewLayoutCamera {
44
43
  readonly _id: string;
45
44
  name: string;
46
45
  }
47
- export interface DBPlugins {
48
- readonly _id: string;
49
- _rev?: string;
50
- plugins: DBPlugin[];
51
- }
52
- export interface DBPlugin {
53
- readonly _id: string;
54
- pluginName: string;
55
- storage: DBPluginStorage;
56
- }
57
46
  export interface DBPluginStorage {
58
47
  [key: string]: {
59
48
  config: DBPluginStorageValue;
@@ -62,11 +51,6 @@ export interface DBPluginStorage {
62
51
  export interface DBPluginStorageValue {
63
52
  [key: string]: any;
64
53
  }
65
- export interface DBCameras {
66
- readonly _id: string;
67
- _rev?: string;
68
- cameras: DBCamera[];
69
- }
70
54
  export interface BaseCamera {
71
55
  readonly _id: string;
72
56
  nativeId?: string;
@@ -84,12 +68,6 @@ export interface BaseCamera {
84
68
  objectZones: CameraZone[];
85
69
  motionTimeout: number;
86
70
  }
87
- export interface DBCamera extends BaseCamera {
88
- sources: CameraInputSettings[];
89
- extensions: CameraExtensions;
90
- interface: CameraUiSettings;
91
- recording: CameraRecordingSettings;
92
- }
93
71
  export interface Camera extends BaseCamera {
94
72
  hasAudioDetector: boolean;
95
73
  hasMotionDetector: boolean;
@@ -0,0 +1,9 @@
1
+ import { RequestQueue } from '../queue.js';
2
+ import type { ApplicationResponse, ExitData } from '../types.js';
3
+ export declare class ApplicationApi {
4
+ private requestQueue;
5
+ constructor(requestQueue: RequestQueue);
6
+ close(data: ExitData): Promise<void>;
7
+ info(): Promise<ApplicationResponse>;
8
+ restart(): Promise<void>;
9
+ }
@@ -0,0 +1,9 @@
1
+ import { RequestQueue } from '../queue.js';
2
+ import type { AxiosResponse } from 'axios';
3
+ export declare class ConfigApi {
4
+ private requestQueue;
5
+ constructor(requestQueue: RequestQueue);
6
+ getConfig(): Promise<AxiosResponse>;
7
+ rewriteConfig(data: Record<string, any>): Promise<AxiosResponse>;
8
+ mergeConfig(data: Record<string, any>): Promise<AxiosResponse>;
9
+ }
@@ -0,0 +1,2 @@
1
+ import { type AxiosInstance } from 'axios';
2
+ export declare const axiosInstance: () => AxiosInstance;
@@ -0,0 +1,8 @@
1
+ import { RequestQueue } from '../queue.js';
2
+ import type { SourceData } from '../types.js';
3
+ export declare class SnapshotApi {
4
+ private requestQueue;
5
+ constructor(requestQueue: RequestQueue);
6
+ jpeg(data: SourceData): Promise<ArrayBuffer>;
7
+ mp4(data: SourceData): Promise<ArrayBuffer>;
8
+ }
@@ -0,0 +1,11 @@
1
+ import { RequestQueue } from '../queue.js';
2
+ import type { AxiosResponse } from 'axios';
3
+ import type { SourceData, StreamData } from '../types.js';
4
+ export declare class StreamsApi {
5
+ private requestQueue;
6
+ constructor(requestQueue: RequestQueue);
7
+ createStream(data: StreamData): Promise<AxiosResponse>;
8
+ deleteStream(data: SourceData): Promise<AxiosResponse>;
9
+ getStreamInfo(data: SourceData): Promise<AxiosResponse>;
10
+ updateStreamSource(data: StreamData): Promise<AxiosResponse>;
11
+ }
@@ -0,0 +1,13 @@
1
+ import { ApplicationApi } from './api/application.js';
2
+ import { ConfigApi } from './api/config.js';
3
+ import { SnapshotApi } from './api/snapshot.js';
4
+ import { StreamsApi } from './api/streams.js';
5
+ export declare class Go2RtcApi {
6
+ private requestQueue;
7
+ applicationApi: ApplicationApi;
8
+ configApi: ConfigApi;
9
+ snapshotApi: SnapshotApi;
10
+ streamsApi: StreamsApi;
11
+ constructor();
12
+ clear(): void;
13
+ }
@@ -0,0 +1,10 @@
1
+ type RequestFunction = () => Promise<any>;
2
+ export declare class RequestQueue {
3
+ private queue;
4
+ private isProcessing;
5
+ constructor();
6
+ enqueue(requestFunc: RequestFunction): Promise<any>;
7
+ clear(): void;
8
+ private processQueue;
9
+ }
10
+ export {};
@@ -0,0 +1,41 @@
1
+ import type { Algorithm } from 'jsonwebtoken';
2
+ import type { Socket } from 'socket.io';
3
+ export declare class UnauthorizedError extends Error {
4
+ inner: {
5
+ message: string;
6
+ };
7
+ data: {
8
+ message: string;
9
+ code: string;
10
+ type: 'UnauthorizedError';
11
+ };
12
+ constructor(code: string, error: {
13
+ message: string;
14
+ });
15
+ }
16
+ export declare const isUnauthorizedError: (error: unknown) => error is UnauthorizedError;
17
+ declare module 'socket.io' {
18
+ interface Socket extends ExtendedSocket {
19
+ }
20
+ }
21
+ interface ExtendedSocket {
22
+ encodedToken?: string;
23
+ decodedToken?: any;
24
+ user?: any;
25
+ }
26
+ type SocketIOMiddleware = (socket: Socket, next: (error?: UnauthorizedError) => void) => void;
27
+ interface CompleteDecodedToken {
28
+ header: {
29
+ alg: Algorithm;
30
+ [key: string]: any;
31
+ };
32
+ payload: any;
33
+ }
34
+ type SecretCallback = (decodedToken: CompleteDecodedToken) => Promise<string> | string;
35
+ export interface AuthorizeOptions {
36
+ secret: string | SecretCallback;
37
+ algorithms?: Algorithm[];
38
+ onAuthentication?: (decodedToken: any) => Promise<any> | any;
39
+ }
40
+ export declare const authorize: (options: AuthorizeOptions) => SocketIOMiddleware;
41
+ export {};
@@ -0,0 +1,20 @@
1
+ import type { ClientData, JwtTokenClientData, JwtTokenEncoded } from '../types/index.js';
2
+ export declare class AuthService {
3
+ private configService;
4
+ private dbs;
5
+ constructor();
6
+ findById(id: string): JwtTokenEncoded | undefined;
7
+ findByRefreshToken(refresh_token: string): JwtTokenEncoded | undefined;
8
+ findByToken(access_token: string): JwtTokenEncoded | undefined;
9
+ clientDataById(id: string): ClientData | undefined;
10
+ clientDataByToken(acces_token: string): ClientData | undefined;
11
+ insert(jwtToken: JwtTokenEncoded, clientData?: ClientData): Promise<void>;
12
+ invalidateAll(): Promise<void>;
13
+ invalidateById(id: string): Promise<void>;
14
+ invalidateByRefreshToken(refresh_token: string): Promise<void>;
15
+ invalidateByToken(access_token: string): Promise<void>;
16
+ listTokens(): JwtTokenEncoded[];
17
+ listClientData(): Promise<ClientData[]>;
18
+ listTokensAndClientData(): JwtTokenClientData[];
19
+ patchTokenByRefreshToken(refresh_token: string, newJwtToken: JwtTokenEncoded): Promise<void>;
20
+ }
@@ -0,0 +1,54 @@
1
+ import { type CameraExtension } from '../../plugins/types.js';
2
+ import type { Camera, CameraZone, DBCamera } from '../database/types.js';
3
+ type DeepPartial<T> = T extends object ? {
4
+ [P in keyof T]?: DeepPartial<T[P]>;
5
+ } : T;
6
+ export declare class CamerasService {
7
+ private configService;
8
+ private api;
9
+ private dbs;
10
+ private go2rtcApi;
11
+ private usersService;
12
+ private pluginsService;
13
+ constructor();
14
+ createCamera(cameraData: DBCamera): Promise<DBCamera>;
15
+ createTransformedCamera(cameraData: DBCamera): Promise<Camera>;
16
+ createZone(cameraname: string, zoneData: CameraZone, zoneType: 'motion' | 'object'): Promise<DBCamera | undefined>;
17
+ patchZoneByName(cameraname: string, zonename: string, zoneData: CameraZone, zoneType: 'motion' | 'object'): Promise<DBCamera | undefined>;
18
+ removeZoneByName(cameraname: string, zonename: string, zoneType: 'motion' | 'object'): Promise<void>;
19
+ createCameraSource(cameraname: string, sourceName: string, address: string): Promise<void>;
20
+ resetCameraSource(cameraname: string, sourceName: string): Promise<void>;
21
+ list(): DBCamera[];
22
+ listTransformed(): Camera[];
23
+ listByPluginId(pluginId: string): DBCamera[];
24
+ listTransformedByPluginId(pluginId: string): Camera[];
25
+ listByExtension(pluginName: string): DBCamera[];
26
+ listTransformedByExtension(pluginName: string, extensions: CameraExtension[]): Camera[];
27
+ findById(id: string): DBCamera | undefined;
28
+ findTransformedById(id: string): Camera | undefined;
29
+ findByName(cameraname: string): DBCamera | undefined;
30
+ findTransformedByName(cameraname: string): Camera | undefined;
31
+ findByPluginAndName(cameraname: string, pluginId: string): DBCamera | undefined;
32
+ findTransformedByPluginAndName(cameraname: string, pluginId: string): Camera | undefined;
33
+ patchCameraByName(cameraname: string, cameraData: DeepPartial<DBCamera>): Promise<DBCamera | undefined>;
34
+ enableExtensionByName(cameraname: string, pluginName: string, extensionType: CameraExtension): Promise<DBCamera | undefined>;
35
+ disableExtensionByName(cameraname: string, pluginName: string, extensionType: CameraExtension): Promise<DBCamera | undefined>;
36
+ addExtensionByName(cameraname: string, pluginName: string): Promise<DBCamera | undefined>;
37
+ removeExtensionByName(cameraname: string, pluginName: string): Promise<DBCamera | undefined>;
38
+ removeExtension(pluginName: string): Promise<void>;
39
+ removeByName(cameraname: string): Promise<void>;
40
+ removeById(id: string): Promise<void>;
41
+ removeByPluginId(pluginId: string): Promise<void>;
42
+ removeByPluginIdAndName(cameraname: string, pluginId: string): Promise<void>;
43
+ removeAll(): Promise<void>;
44
+ transformCamera(camera: DBCamera): Camera;
45
+ cameraSourcesChanged(oldCamera: DBCamera, newCamera: DBCamera): boolean;
46
+ private addCameraSources;
47
+ private removeCameraSources;
48
+ private generateWsUrls;
49
+ private generateRTSPUrls;
50
+ private generateFFmpegUrls;
51
+ private generateWWWUrls;
52
+ private extensionIsEnabled;
53
+ }
54
+ export {};
@@ -0,0 +1,25 @@
1
+ import type { Plugin } from '../../plugins/plugin.js';
2
+ import type { PluginWorker } from '../../plugins/worker.js';
3
+ import type { DBPlugin } from '../database/types.js';
4
+ export declare class PluginsService {
5
+ private configService;
6
+ private dbs;
7
+ private pluginManager;
8
+ constructor();
9
+ listPlugins(): Plugin[];
10
+ listPluginProcesses(): PluginWorker[];
11
+ getPluginByName(pluginName: string): Plugin | undefined;
12
+ getPluginById(id: string): Plugin | undefined;
13
+ getPluginProcessByName(pluginName: string): PluginWorker | undefined;
14
+ getPluginProcessById(id: string): PluginWorker | undefined;
15
+ installedPlugins(): Plugin[];
16
+ installedPluginProcesses(): PluginWorker[];
17
+ listPluginDb(): DBPlugin[];
18
+ getPluginDbByName(pluginName: string): DBPlugin | undefined;
19
+ getPluginDbById(id: string): DBPlugin | undefined;
20
+ insertPluginDb(pluginName: string): Promise<DBPlugin>;
21
+ removePluginDbByName(pluginName: string): Promise<void>;
22
+ removePluginDbById(id: string): Promise<void>;
23
+ removeAllPluginsDb(): Promise<void>;
24
+ removeOrphanPluginsDb(): Promise<void>;
25
+ }
@@ -0,0 +1,13 @@
1
+ import type { DBUser } from '../database/types.js';
2
+ export declare class UsersService {
3
+ private configService;
4
+ private dbs;
5
+ constructor();
6
+ createUser(userData: DBUser): Promise<DBUser>;
7
+ findById(id: string): DBUser | undefined;
8
+ findByName(username: string): DBUser | undefined;
9
+ list(): DBUser[];
10
+ patchUser(username: string, userData: Partial<DBUser>): Promise<DBUser | undefined>;
11
+ removeByName(username: string): Promise<void>;
12
+ removeAll(): Promise<void>;
13
+ }
@@ -0,0 +1,15 @@
1
+ export declare const HOST_CERT_FILENAME = "camera.ui.cert.pem";
2
+ export declare const HOST_KEY_FILENAME = "camera.ui.key.pem";
3
+ export declare const ROOT_CERT_FILENAME = "camera.ui.root.cert.pem";
4
+ export declare const ROOT_KEY_FILENAME = "camera.ui.root.key.pem";
5
+ export declare const P12_FILENAME = "camera.ui.p12";
6
+ export declare const P12_PASSWORD = "camera.ui";
7
+ export declare const DEFAULTS: {
8
+ C: string;
9
+ ST: string;
10
+ L: string;
11
+ O: string;
12
+ OU: string;
13
+ CN: string;
14
+ ROOT_CN: string;
15
+ };
@@ -0,0 +1,15 @@
1
+ import { Server } from 'socket.io';
2
+ import type { FastifyInstance } from 'fastify';
3
+ import type { ServerOptions } from 'socket.io';
4
+ import type { SocketNsp, SocketNspMap } from './types.js';
5
+ export declare class SocketService {
6
+ io: Server;
7
+ namespaces: Map<SocketNsp, SocketNspMap>;
8
+ adminNsp: SocketNsp[];
9
+ private logger;
10
+ private authService;
11
+ private configService;
12
+ constructor(app: FastifyInstance, opts: Partial<ServerOptions>);
13
+ private registerNamespaces;
14
+ private setupConnection;
15
+ }
@@ -0,0 +1,10 @@
1
+ import type { Namespace, Server, Socket } from 'socket.io';
2
+ import type { SocketNsp } from '../types.js';
3
+ export declare class FrameNamespace {
4
+ nsp: Namespace;
5
+ nspName: SocketNsp;
6
+ readonly connectedClients: Map<string, Set<Socket>>;
7
+ private decoder;
8
+ constructor(io: Server);
9
+ private handleConnection;
10
+ }
@@ -0,0 +1,11 @@
1
+ import type { Namespace, Server, Socket } from 'socket.io';
2
+ import type { SocketNsp } from '../types.js';
3
+ export declare class LogsNamespace {
4
+ nsp: Namespace;
5
+ nspName: SocketNsp;
6
+ private nativeTail?;
7
+ private configService;
8
+ constructor(io: Server);
9
+ connect(socket: Socket, filter?: string[]): void;
10
+ private tailLogFromFileNative;
11
+ }
@@ -0,0 +1,33 @@
1
+ import type { Namespace, Server } from 'socket.io';
2
+ import type { CpuInfo, CpuTempInfo, MemoryInfo, NetworkInfo, PluginProcessesInfo, ProcessesInfo, SocketNsp } from '../types.js';
3
+ export declare class MetricsNamespace {
4
+ nsp: Namespace;
5
+ nspName: SocketNsp;
6
+ private logger;
7
+ private configService;
8
+ private pluginManager;
9
+ private go2rtc;
10
+ private cpuHistory;
11
+ private cpuTempHistory;
12
+ private memHistory;
13
+ private networkHistory;
14
+ private processServerHistory;
15
+ private processGo2RtcHistory;
16
+ private processPluginsHistory;
17
+ private memoryInfo?;
18
+ constructor(io: Server);
19
+ getProcessesInfo(payload: any, callback?: Function): Promise<ProcessesInfo>;
20
+ getPluginsProcessesInfo(payload: any, callback?: Function): Promise<PluginProcessesInfo>;
21
+ getServerCpuInfo(payload?: any, callback?: Function): Promise<CpuInfo>;
22
+ getServerMemoryInfo(payload?: any, callback?: Function): Promise<MemoryInfo>;
23
+ getCpuTempInfo(payload?: any, callback?: Function): Promise<CpuTempInfo>;
24
+ getNetworkUsageInfo(payload?: any, callback?: Function): Promise<NetworkInfo>;
25
+ private getCpuTemp;
26
+ private getProcesses;
27
+ private getCpuLoad;
28
+ private getCpuLoadAlt;
29
+ private getCpuTempLegacy;
30
+ private getCpuTempAlt;
31
+ private getMemoryUsage;
32
+ private getCurrentNetworkUsage;
33
+ }
@@ -0,0 +1,11 @@
1
+ import type { Namespace, Server, Socket } from 'socket.io';
2
+ import type { SocketNsp } from '../types.js';
3
+ export declare class NotificationsNamespace {
4
+ nsp: Namespace;
5
+ nspName: SocketNsp;
6
+ private logger;
7
+ constructor(io: Server);
8
+ clearNotifications(): Promise<void>;
9
+ getNotifications(socket: Socket): Promise<void>;
10
+ removeNotification(id?: string): Promise<void>;
11
+ }
@@ -0,0 +1,13 @@
1
+ import type { Namespace, Server } from 'socket.io';
2
+ import type { PLUGIN_STATUS } from '../../../plugins/types.js';
3
+ import type { SocketNsp } from '../types.js';
4
+ export declare class PluginsNamespace {
5
+ nsp: Namespace;
6
+ nspName: SocketNsp;
7
+ private pluginManager;
8
+ constructor(io: Server);
9
+ pluginStatus(pluginName: string, callback?: Function): Promise<void | {
10
+ pluginName: string;
11
+ status: PLUGIN_STATUS;
12
+ }>;
13
+ }
@@ -0,0 +1,9 @@
1
+ import type { Namespace, Server, Socket } from 'socket.io';
2
+ import type { SocketNsp } from '../types.js';
3
+ export declare class ServerNamespace {
4
+ nsp: Namespace;
5
+ nspName: SocketNsp;
6
+ private logger;
7
+ constructor(io: Server);
8
+ checkUpdate(socket?: Socket): Promise<void>;
9
+ }
@@ -0,0 +1,20 @@
1
+ import type { Namespace, Server, Socket } from 'socket.io';
2
+ import { PLUGIN_STATUS } from '../../../plugins/types.js';
3
+ import { RUNTIME_STATUS } from '../../../services/config/types.js';
4
+ import type { SocketNsp } from '../types.js';
5
+ export declare class StatusNamespace {
6
+ nsp: Namespace;
7
+ nspName: SocketNsp;
8
+ private configService;
9
+ private pluginManager;
10
+ private go2rtc;
11
+ constructor(io: Server);
12
+ watchStats(socket: Socket, payload: any, callback?: Function): {
13
+ name: string;
14
+ status: RUNTIME_STATUS;
15
+ }[];
16
+ watchPluginStats(socket: Socket, payload: any, callback?: Function): {
17
+ name: string;
18
+ status: PLUGIN_STATUS;
19
+ }[];
20
+ }
@@ -0,0 +1,15 @@
1
+ import type { Namespace, Server } from 'socket.io';
2
+ import type { SocketNsp } from '../types.js';
3
+ export declare class StreamsNamespace {
4
+ nsp: Namespace;
5
+ nspName: SocketNsp;
6
+ private bridges;
7
+ private logger;
8
+ private configService;
9
+ constructor(io: Server);
10
+ private connectBridge;
11
+ private sendMessage;
12
+ private closeBridge;
13
+ private onEnd;
14
+ private onDestroy;
15
+ }
@@ -2,7 +2,7 @@ import { PLUGIN_STATUS } from '../../plugins/types.js';
2
2
  import type { Namespace } from 'socket.io';
3
3
  import type { WebSocket } from 'ws';
4
4
  import type { VideoStreamingMode } from '../database/types.js';
5
- export type SocketNsp = '/camera.ui' | '/metrics' | '/logs' | '/status' | '/notifications' | '/streams' | '/plugins' | '/proxy';
5
+ export type SocketNsp = '/camera.ui' | '/metrics' | '/logs' | '/status' | '/notifications' | '/streams' | '/plugins' | '/proxy' | '/frame';
6
6
  export interface SocketNspMap {
7
7
  nsp: Namespace;
8
8
  [key: string]: any;
@@ -0,0 +1,44 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import 'reflect-metadata';
3
+ import { EventEmitter } from 'node:events';
4
+ import { CameraController } from './camera/controller.js';
5
+ import type { Camera, CameraExtensions } from './api/database/types.js';
6
+ import type { StreamManager } from './decoder/worker/index.js';
7
+ import type { BasePlugin } from './plugins/base.js';
8
+ import type { API } from './plugins/node/api.js';
9
+ import type { PluginLogger } from './plugins/node/logger.js';
10
+ import type { CameraExtension } from './plugins/types.js';
11
+ export interface PluginConstructor {
12
+ new (logger: PluginLogger, api: API): BasePlugin;
13
+ }
14
+ export declare const enum API_EVENT {
15
+ FINISH_LAUNCHING = "finishLaunching",
16
+ SHUTDOWN = "shutdown"
17
+ }
18
+ export declare interface CameraUiAPI {
19
+ on(event: 'finishLaunching', listener: () => void): this;
20
+ on(event: 'shutdown', listener: () => void): this;
21
+ emit(event: 'finishLaunching'): boolean;
22
+ emit(event: 'shutdown'): boolean;
23
+ }
24
+ export declare class CameraUiAPI extends EventEmitter {
25
+ private camerasMap;
26
+ constructor();
27
+ configureCameras(): Promise<void>;
28
+ addCamera(camera: Camera): Promise<{
29
+ controller: CameraController;
30
+ manager: StreamManager;
31
+ }>;
32
+ getCamera(cameraId: string): {
33
+ controller: CameraController;
34
+ manager: StreamManager;
35
+ } | undefined;
36
+ getCameras(pluginId?: string): {
37
+ controller: CameraController;
38
+ manager: StreamManager;
39
+ }[];
40
+ updateCamera(camera: Camera, extensions: CameraExtensions): void;
41
+ removeCamera(camera: Camera, extensions: CameraExtensions): Promise<void>;
42
+ selectCamera(pluginId: string, camera: Camera, extension: CameraExtension): void;
43
+ deselectCamera(pluginId: string, camera: Camera, extension: CameraExtension): void;
44
+ }
@@ -12,6 +12,7 @@ export declare abstract class CameraDevice extends BaseCameraDevice {
12
12
  set prebufferDelegate(delegate: CameraPrebufferDelegate);
13
13
  abstract generateFrames(): AsyncIterableIterator<Frame>;
14
14
  abstract getFfmpegPath(): Promise<string>;
15
+ snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
15
16
  createSession(sourceName: string, options?: StreamingConnectionOptions): Promise<StreamingSession>;
16
17
  streamVideo(sourceName: string, options: FfmpegOptions): Promise<StreamingSession>;
17
18
  recordToFile(sourceName: string, outputPath: string, duration?: number): Promise<void>;
@@ -1,5 +1,6 @@
1
1
  import { BrowserStreamingSession } from '../streaming/browser/browser-streaming-session.js';
2
2
  import { BaseCameraDevice } from './index.js';
3
3
  export declare abstract class BrowserCameraDevice extends BaseCameraDevice {
4
+ snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
4
5
  createSession(sourceName: string, videoElement: HTMLVideoElement): Promise<BrowserStreamingSession>;
5
6
  }