@camera.ui/browser 0.0.83 → 0.0.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -139,12 +139,12 @@ export interface CameraFrameWorkerSettings {
139
139
  resolution: CameraFrameWorkerResolution;
140
140
  }
141
141
  export interface CameraInformation {
142
- model: string;
143
- manufacturer: string;
144
- hardware: string;
145
- serialNumber: string;
146
- firmwareVersion: string;
147
- supportUrl: string;
142
+ model?: string;
143
+ manufacturer?: string;
144
+ hardware?: string;
145
+ serialNumber?: string;
146
+ firmwareVersion?: string;
147
+ supportUrl?: string;
148
148
  }
149
149
  export interface CameraExtensions {
150
150
  hub?: string[];
@@ -231,26 +231,26 @@ export declare const interfaceSettingsSchema: zod.ZodObject<{
231
231
  streamingMode: "webrtc" | "mse" | "webrtc/tcp" | "mjpeg" | "hls" | "mp4";
232
232
  }>;
233
233
  export declare const cameraInfoSchema: zod.ZodObject<{
234
- model: zod.ZodString;
235
- manufacturer: zod.ZodString;
236
- hardware: zod.ZodString;
237
- serialNumber: zod.ZodString;
238
- firmwareVersion: zod.ZodString;
239
- supportUrl: zod.ZodString;
234
+ model: zod.ZodOptional<zod.ZodString>;
235
+ manufacturer: zod.ZodOptional<zod.ZodString>;
236
+ hardware: zod.ZodOptional<zod.ZodString>;
237
+ serialNumber: zod.ZodOptional<zod.ZodString>;
238
+ firmwareVersion: zod.ZodOptional<zod.ZodString>;
239
+ supportUrl: zod.ZodOptional<zod.ZodString>;
240
240
  }, "strip", zod.ZodTypeAny, {
241
- model: string;
242
- manufacturer: string;
243
- hardware: string;
244
- serialNumber: string;
245
- firmwareVersion: string;
246
- supportUrl: string;
241
+ model?: string | undefined;
242
+ manufacturer?: string | undefined;
243
+ hardware?: string | undefined;
244
+ serialNumber?: string | undefined;
245
+ firmwareVersion?: string | undefined;
246
+ supportUrl?: string | undefined;
247
247
  }, {
248
- model: string;
249
- manufacturer: string;
250
- hardware: string;
251
- serialNumber: string;
252
- firmwareVersion: string;
253
- supportUrl: string;
248
+ model?: string | undefined;
249
+ manufacturer?: string | undefined;
250
+ hardware?: string | undefined;
251
+ serialNumber?: string | undefined;
252
+ firmwareVersion?: string | undefined;
253
+ supportUrl?: string | undefined;
254
254
  }>;
255
255
  export declare const createCameraSchema: zod.ZodObject<{
256
256
  _id: zod.ZodEffects<zod.ZodDefault<zod.ZodString>, string, string | undefined>;
@@ -265,26 +265,26 @@ export declare const createCameraSchema: zod.ZodObject<{
265
265
  hasBinarySensor: zod.ZodDefault<zod.ZodBoolean>;
266
266
  hasBattery: zod.ZodDefault<zod.ZodBoolean>;
267
267
  info: zod.ZodDefault<zod.ZodObject<{
268
- model: zod.ZodString;
269
- manufacturer: zod.ZodString;
270
- hardware: zod.ZodString;
271
- serialNumber: zod.ZodString;
272
- firmwareVersion: zod.ZodString;
273
- supportUrl: zod.ZodString;
268
+ model: zod.ZodOptional<zod.ZodString>;
269
+ manufacturer: zod.ZodOptional<zod.ZodString>;
270
+ hardware: zod.ZodOptional<zod.ZodString>;
271
+ serialNumber: zod.ZodOptional<zod.ZodString>;
272
+ firmwareVersion: zod.ZodOptional<zod.ZodString>;
273
+ supportUrl: zod.ZodOptional<zod.ZodString>;
274
274
  }, "strip", zod.ZodTypeAny, {
275
- model: string;
276
- manufacturer: string;
277
- hardware: string;
278
- serialNumber: string;
279
- firmwareVersion: string;
280
- supportUrl: string;
275
+ model?: string | undefined;
276
+ manufacturer?: string | undefined;
277
+ hardware?: string | undefined;
278
+ serialNumber?: string | undefined;
279
+ firmwareVersion?: string | undefined;
280
+ supportUrl?: string | undefined;
281
281
  }, {
282
- model: string;
283
- manufacturer: string;
284
- hardware: string;
285
- serialNumber: string;
286
- firmwareVersion: string;
287
- supportUrl: string;
282
+ model?: string | undefined;
283
+ manufacturer?: string | undefined;
284
+ hardware?: string | undefined;
285
+ serialNumber?: string | undefined;
286
+ firmwareVersion?: string | undefined;
287
+ supportUrl?: string | undefined;
288
288
  }>>;
289
289
  sources: zod.ZodEffects<zod.ZodArray<zod.ZodObject<{
290
290
  _id: zod.ZodEffects<zod.ZodDefault<zod.ZodString>, string, string | undefined>;
@@ -462,12 +462,12 @@ export declare const createCameraSchema: zod.ZodObject<{
462
462
  }>>;
463
463
  }, "strict", zod.ZodTypeAny, {
464
464
  info: {
465
- model: string;
466
- manufacturer: string;
467
- hardware: string;
468
- serialNumber: string;
469
- firmwareVersion: string;
470
- supportUrl: string;
465
+ model?: string | undefined;
466
+ manufacturer?: string | undefined;
467
+ hardware?: string | undefined;
468
+ serialNumber?: string | undefined;
469
+ firmwareVersion?: string | undefined;
470
+ supportUrl?: string | undefined;
471
471
  };
472
472
  name: string;
473
473
  extensions: {
@@ -537,12 +537,12 @@ export declare const createCameraSchema: zod.ZodObject<{
537
537
  _id?: string | undefined;
538
538
  }[];
539
539
  info?: {
540
- model: string;
541
- manufacturer: string;
542
- hardware: string;
543
- serialNumber: string;
544
- firmwareVersion: string;
545
- supportUrl: string;
540
+ model?: string | undefined;
541
+ manufacturer?: string | undefined;
542
+ hardware?: string | undefined;
543
+ serialNumber?: string | undefined;
544
+ firmwareVersion?: string | undefined;
545
+ supportUrl?: string | undefined;
546
546
  } | undefined;
547
547
  extensions?: {
548
548
  plugins: string[];
@@ -602,12 +602,12 @@ export declare const patchCameraSchema: zod.ZodObject<{
602
602
  type: zod.ZodOptional<zod.ZodUnion<[zod.ZodLiteral<"camera">, zod.ZodLiteral<"doorbell">]>>;
603
603
  name: zod.ZodOptional<zod.ZodString>;
604
604
  info: zod.ZodOptional<zod.ZodObject<{
605
- model: zod.ZodOptional<zod.ZodString>;
606
- manufacturer: zod.ZodOptional<zod.ZodString>;
607
- hardware: zod.ZodOptional<zod.ZodString>;
608
- serialNumber: zod.ZodOptional<zod.ZodString>;
609
- firmwareVersion: zod.ZodOptional<zod.ZodString>;
610
- supportUrl: zod.ZodOptional<zod.ZodString>;
605
+ model: zod.ZodOptional<zod.ZodOptional<zod.ZodString>>;
606
+ manufacturer: zod.ZodOptional<zod.ZodOptional<zod.ZodString>>;
607
+ hardware: zod.ZodOptional<zod.ZodOptional<zod.ZodString>>;
608
+ serialNumber: zod.ZodOptional<zod.ZodOptional<zod.ZodString>>;
609
+ firmwareVersion: zod.ZodOptional<zod.ZodOptional<zod.ZodString>>;
610
+ supportUrl: zod.ZodOptional<zod.ZodOptional<zod.ZodString>>;
611
611
  }, "strip", zod.ZodTypeAny, {
612
612
  model?: string | undefined;
613
613
  manufacturer?: string | undefined;
@@ -919,6 +919,13 @@ export declare const patchCameraSchema: zod.ZodObject<{
919
919
  } | undefined;
920
920
  }>;
921
921
  export declare const patchExtensionsSchema: zod.ZodRecord<zod.ZodString, zod.ZodAny>;
922
+ export declare const submitExtensionsSchema: zod.ZodObject<{
923
+ configPath: zod.ZodString;
924
+ }, "strict", zod.ZodTypeAny, {
925
+ configPath: string;
926
+ }, {
927
+ configPath: string;
928
+ }>;
922
929
  export declare const previewCameraSchema: zod.ZodObject<{
923
930
  url: zod.ZodString;
924
931
  }, "strict", zod.ZodTypeAny, {
@@ -704,6 +704,7 @@ export declare const loginUserSchema: zod.ZodObject<{
704
704
  rememberMe?: boolean | undefined;
705
705
  }>;
706
706
  export declare const patchUserSchema: zod.ZodEffects<zod.ZodObject<{
707
+ username: zod.ZodOptional<zod.ZodString>;
707
708
  password: zod.ZodOptional<zod.ZodString>;
708
709
  passwordConfirm: zod.ZodOptional<zod.ZodString>;
709
710
  role: zod.ZodOptional<zod.ZodUnion<[zod.ZodLiteral<"admin">, zod.ZodLiteral<"user">]>>;
@@ -869,6 +870,7 @@ export declare const patchUserSchema: zod.ZodEffects<zod.ZodObject<{
869
870
  }, "strict", zod.ZodTypeAny, {
870
871
  password?: string | undefined;
871
872
  upload?: MultipartFile | File | undefined;
873
+ username?: string | undefined;
872
874
  passwordConfirm?: string | undefined;
873
875
  role?: "user" | "admin" | undefined;
874
876
  sessionTimer?: number | undefined;
@@ -902,6 +904,7 @@ export declare const patchUserSchema: zod.ZodEffects<zod.ZodObject<{
902
904
  }, {
903
905
  password?: string | undefined;
904
906
  upload?: MultipartFile | File | undefined;
907
+ username?: string | undefined;
905
908
  passwordConfirm?: string | undefined;
906
909
  role?: "user" | "admin" | undefined;
907
910
  sessionTimer?: number | undefined;
@@ -935,6 +938,7 @@ export declare const patchUserSchema: zod.ZodEffects<zod.ZodObject<{
935
938
  }>, {
936
939
  password?: string | undefined;
937
940
  upload?: MultipartFile | File | undefined;
941
+ username?: string | undefined;
938
942
  passwordConfirm?: string | undefined;
939
943
  role?: "user" | "admin" | undefined;
940
944
  sessionTimer?: number | undefined;
@@ -968,6 +972,7 @@ export declare const patchUserSchema: zod.ZodEffects<zod.ZodObject<{
968
972
  }, {
969
973
  password?: string | undefined;
970
974
  upload?: MultipartFile | File | undefined;
975
+ username?: string | undefined;
971
976
  passwordConfirm?: string | undefined;
972
977
  role?: "user" | "admin" | undefined;
973
978
  sessionTimer?: number | undefined;
@@ -29,13 +29,14 @@ export declare class CamerasService {
29
29
  findByPluginAndName(cameraname: string, pluginId: string): DBCamera | undefined;
30
30
  findTransformedByPluginAndName(cameraname: string, pluginId: string): Camera | undefined;
31
31
  patchCameraByName(cameraname: string, cameraData: DeepPartial<DBCamera>): Promise<DBCamera | undefined>;
32
- enableExtensionByName(cameraname: string, pluginName: string, extensionType: CameraExtension): Promise<DBCamera | undefined>;
33
- disableExtensionByName(cameraname: string, pluginName: string, extensionType: CameraExtension): Promise<DBCamera | undefined>;
34
- addExtensionByName(cameraname: string, pluginName: string): Promise<DBCamera | undefined>;
35
- removeExtensionByName(cameraname: string, pluginName: string): Promise<DBCamera | undefined>;
36
- removeExtension(pluginName: string): Promise<void>;
32
+ enableExtensionByName(cameraname: string, pluginNameOrId: string, extensionType: CameraExtension): Promise<DBCamera | undefined>;
33
+ disableExtensionByName(cameraname: string, pluginNameOrId: string, extensionType: CameraExtension): Promise<DBCamera | undefined>;
34
+ addExtensionByName(cameraname: string, pluginNameOrId: string): Promise<DBCamera | undefined>;
35
+ removeExtensionByName(cameraname: string, pluginNameOrId: string): Promise<DBCamera | undefined>;
36
+ removeExtension(pluginNameOrId: string): Promise<void>;
37
37
  removeByName(cameraname: string): Promise<void>;
38
38
  removeById(id: string): Promise<void>;
39
+ removeByPluginName(pluginName: string): Promise<void>;
39
40
  removeByPluginId(pluginId: string): Promise<void>;
40
41
  removeByPluginIdAndName(cameraname: string, pluginId: string): Promise<void>;
41
42
  removeAll(): Promise<void>;
@@ -1,5 +1,6 @@
1
1
  import type { Readable } from 'node:stream';
2
- import type { CameraExtension, PLUGIN_STATUS, PluginContract, PluginRootSchema } from '../../plugins/types.js';
2
+ import type { AuthConfig } from '../../decoder/types.js';
3
+ import type { CameraExtension, PLUGIN_STATUS, PluginContract, RootSchema } from '../../plugins/types.js';
3
4
  import type { LoggingLevel } from '../../services/config/types.js';
4
5
  import type { CameraExtensions, CameraZone, DBCamera, DBCamviewLayout, DBRoles, DBUser } from '../database/types.js';
5
6
  import type { ApplicationResponse } from '../go2rtc/types.js';
@@ -131,7 +132,7 @@ export interface PluginExtension {
131
132
  externPlugin?: boolean;
132
133
  }
133
134
  export interface PluginExtensionConfig extends PluginExtension {
134
- rootSchema?: PluginRootSchema;
135
+ rootSchema?: RootSchema;
135
136
  config?: Record<string, any>;
136
137
  }
137
138
  export interface ExtensionsResponse {
@@ -165,6 +166,10 @@ export interface Go2RtcInfo {
165
166
  info: ApplicationResponse;
166
167
  auth: Partial<Go2RtcInfoAuth>;
167
168
  }
169
+ export interface NatsInfo {
170
+ servers: string[];
171
+ auth: AuthConfig;
172
+ }
168
173
  export interface TokenClientDataResponse {
169
174
  pagination: Pagination;
170
175
  result: JwtTokenClientData[];
@@ -250,6 +255,11 @@ export type CamerasPatchRequest = {
250
255
  export type ExtensionsPatchRequest = {
251
256
  Body: Record<string, any>;
252
257
  };
258
+ export type ExtensionsSubmitRequest = {
259
+ Body: {
260
+ configPath: string;
261
+ };
262
+ };
253
263
  export type ConfigRequest = {
254
264
  Querystring: {
255
265
  json?: boolean;
@@ -1,38 +1,20 @@
1
1
  import type { Namespace, Server } from 'socket.io';
2
- import type { CpuInfo, CpuTempInfo, FrameWorkerProcessesInfo, MemoryInfo, NetworkInfo, PluginProcessesInfo, ProcessesInfo, SocketNsp } from '../types.js';
2
+ import type { ServerProcesses, SocketNsp, WorkerProcesses } from '../types.js';
3
3
  export declare class MetricsNamespace {
4
4
  nsp: Namespace;
5
5
  nspName: SocketNsp;
6
- private logger;
7
- private configService;
8
6
  private pluginManager;
9
7
  private frameManager;
10
8
  private go2rtc;
11
9
  private natsServer;
12
- private cpuHistory;
13
- private cpuTempHistory;
14
- private memHistory;
15
- private networkHistory;
16
10
  private processServerHistory;
17
11
  private processGo2RtcHistory;
18
12
  private processNatHistory;
19
13
  private processPluginsHistory;
20
14
  private processFrameWorkerHistory;
21
- private memoryInfo?;
22
15
  constructor(io: Server);
23
- getProcessesInfo(payload: any, callback?: Function): Promise<ProcessesInfo>;
24
- getPluginsProcessesInfo(payload: any, callback?: Function): Promise<PluginProcessesInfo>;
25
- getFrameWorkerProcessesInfo(payload: any, callback?: Function): Promise<FrameWorkerProcessesInfo>;
26
- getServerCpuInfo(payload?: any, callback?: Function): Promise<CpuInfo>;
27
- getServerMemoryInfo(payload?: any, callback?: Function): Promise<MemoryInfo>;
28
- getCpuTempInfo(payload?: any, callback?: Function): Promise<CpuTempInfo>;
29
- getNetworkUsageInfo(payload?: any, callback?: Function): Promise<NetworkInfo>;
30
- private getCpuTemp;
16
+ getServerProcessesInfos(payload: any, callback?: Function): Promise<ServerProcesses>;
17
+ getPluginsProcessesInfo(payload: any, callback?: Function): Promise<WorkerProcesses>;
18
+ getFrameWorkerProcessesInfo(payload: any, callback?: Function): Promise<WorkerProcesses>;
31
19
  private getProcesses;
32
- private getCpuLoad;
33
- private getCpuLoadAlt;
34
- private getCpuTempLegacy;
35
- private getCpuTempAlt;
36
- private getMemoryUsage;
37
- private getCurrentNetworkUsage;
38
20
  }
@@ -1,7 +1,5 @@
1
- import { RUNTIME_STATUS } from '../../../services/config/types.js';
2
1
  import type { Namespace, Server, Socket } from 'socket.io';
3
- import type { PLUGIN_STATUS } from '../../../plugins/types.js';
4
- import type { SocketNsp } from '../types.js';
2
+ import type { ServerRuntime, SocketNsp, WorkerRuntime } from '../types.js';
5
3
  export declare class StatusNamespace {
6
4
  nsp: Namespace;
7
5
  nspName: SocketNsp;
@@ -11,16 +9,7 @@ export declare class StatusNamespace {
11
9
  private go2rtc;
12
10
  private natsServer;
13
11
  constructor(io: Server);
14
- watchStats(socket: Socket, payload: any, callback?: Function): {
15
- name: string;
16
- status: RUNTIME_STATUS;
17
- }[];
18
- watchPluginStats(socket: Socket, payload: any, callback?: Function): {
19
- name: string;
20
- status: PLUGIN_STATUS;
21
- }[];
22
- watchFrameWorkerStats(socket: Socket, payload: any, callback?: Function): {
23
- name: string;
24
- status: PLUGIN_STATUS;
25
- }[];
12
+ watchStats(socket: Socket, payload: any, callback?: Function): ServerRuntime;
13
+ watchPluginStats(socket: Socket, payload: any, callback?: Function): WorkerRuntime;
14
+ watchFrameWorkerStats(socket: Socket, payload: any, callback?: Function): WorkerRuntime;
26
15
  }
@@ -1,86 +1,47 @@
1
1
  import type { Namespace } from 'socket.io';
2
2
  import type { PLUGIN_STATUS } from '../../plugins/types.js';
3
+ import type { RuntimeInfo } from '../../services/config/types.js';
3
4
  export type SocketNsp = '/camera.ui' | '/metrics' | '/logs' | '/status' | '/notifications' | '/plugins' | '/proxy' | '/frame' | '/frameWorker';
4
5
  export interface SocketNspMap {
5
6
  nsp: Namespace;
6
7
  [key: string]: any;
7
8
  }
8
- export interface CpuTemperatureData {
9
- main: number;
10
- cores: number[];
11
- max: number;
12
- socket?: number[];
13
- chipset?: number;
14
- }
15
- export interface MemData {
16
- total: number;
17
- free: number;
18
- used: number;
19
- active: number;
20
- available: number;
21
- buffcache: number;
22
- buffers: number;
23
- cached: number;
24
- slab: number;
25
- swaptotal: number;
26
- swapused: number;
27
- swapfree: number;
28
- writeback: number | null;
29
- dirty: number | null;
30
- }
31
- export interface NetworkStatsData {
32
- iface: string;
33
- operstate: string;
34
- rx_bytes: number;
35
- rx_dropped: number;
36
- rx_errors: number;
37
- tx_bytes: number;
38
- tx_dropped: number;
39
- tx_errors: number;
40
- rx_sec: number;
41
- tx_sec: number;
42
- ms: number;
43
- }
44
9
  export interface ProcessInfo {
45
10
  name: string;
46
11
  pid?: number;
47
- cpuLoad: number;
48
- memLoad: number;
12
+ cpuLoad: string;
13
+ memLoad: string;
14
+ timestamp: number;
49
15
  }
50
- export interface ProcessesInfo {
16
+ export interface ServerProcessInfo {
51
17
  server: ProcessInfo;
52
18
  go2rtc: ProcessInfo;
53
19
  nats: ProcessInfo;
54
20
  }
55
- export interface PluginProcessesInfo {
56
- plugins: ProcessInfo[];
57
- }
58
- export interface FrameWorkerProcessesInfo {
59
- worker: ProcessInfo[];
60
- }
61
- export interface AllProcessesInfo extends ProcessesInfo, PluginProcessesInfo, FrameWorkerProcessesInfo {
21
+ export interface ServerProcesses {
22
+ server: ProcessInfo[];
23
+ go2rtc: ProcessInfo[];
24
+ nats: ProcessInfo[];
62
25
  }
63
- export interface CpuInfo {
64
- currentLoad: number;
65
- cpuHistory: number[];
26
+ export interface WorkerProcessInfo {
27
+ [key: string]: ProcessInfo;
66
28
  }
67
- export interface CpuTempInfo {
68
- currentTemperature: CpuTemperatureData;
69
- cpuTempHistory: CpuTemperatureData[];
29
+ export interface WorkerProcesses {
30
+ [key: string]: ProcessInfo[];
70
31
  }
71
- export interface MemoryInfo {
72
- memoryInfo?: MemData;
73
- memHistory: number[];
32
+ export interface AllProcesses extends ServerProcessInfo {
33
+ plugins: WorkerProcessInfo;
34
+ workers: WorkerProcessInfo;
74
35
  }
75
- export interface NetworkData {
76
- net: NetworkStatsData;
77
- point: number;
78
- }
79
- export interface NetworkInfo {
80
- currentNetworkLoad: NetworkData;
81
- networkHistory: NetworkData[];
82
- }
83
- export interface PluginRuntime {
36
+ export interface PluginRuntimeInfo {
84
37
  name: string;
85
38
  status: PLUGIN_STATUS;
86
39
  }
40
+ export interface ServerRuntime {
41
+ server?: RuntimeInfo;
42
+ go2rtc?: RuntimeInfo;
43
+ nats?: RuntimeInfo;
44
+ }
45
+ export interface WorkerRuntime {
46
+ [key: string]: PluginRuntimeInfo;
47
+ }
@@ -1,9 +1,17 @@
1
+ import type { Subscription } from 'rxjs';
1
2
  import { ReplaySubject, Subject } from 'rxjs';
2
3
  import { RtpPacket } from 'werift';
3
- import { Subscribed } from '../../utils/subscribed.js';
4
4
  import type { CameraDevice } from '../device.js';
5
5
  import type { BaseLogger, FfmpegOptions, SpawnInput } from '../types.js';
6
6
  import type { WebrtcConnection } from './webrtc-connection.js';
7
+ declare class Subscribed {
8
+ private readonly subscriptions;
9
+ private readonly additionalSubscriptions;
10
+ addSubscriptions(...subscriptions: Subscription[]): void;
11
+ addAdditionalSubscriptions(...subscriptions: Subscription[]): void;
12
+ unsubscribe(): void;
13
+ unsubscribeAdditional(): void;
14
+ }
7
15
  export declare class WeriftSession extends Subscribed {
8
16
  readonly onCallEnded: ReplaySubject<void>;
9
17
  readonly onVideoRtp: Subject<RtpPacket>;
@@ -29,3 +37,4 @@ export declare class WeriftSession extends Subscribed {
29
37
  private bindToConnection;
30
38
  private callEnded;
31
39
  }
40
+ export {};
@@ -3,12 +3,11 @@ import { Subscribed } from '../utils/subscribed.js';
3
3
  import type { CameraController } from '../camera/controller.js';
4
4
  import type { AuthConfig } from './types.js';
5
5
  export declare class FrameWorker extends Subscribed {
6
- token: string;
6
+ readonly frameWorkerId: string;
7
7
  name: string;
8
8
  private readonly clients;
9
9
  private subject;
10
10
  private ipcSubject;
11
- private frameWorkerId;
12
11
  private publisher?;
13
12
  private subscriber?;
14
13
  private logger;
@@ -1,10 +1,10 @@
1
+ import { ProxyConnection } from './connection.js';
1
2
  import { CameraDeviceProxy } from './proxy/cameraDevice.js';
2
3
  import { DeviceManagerProxy } from './proxy/deviceManager.js';
3
4
  import { NatsServer } from './server.js';
4
5
  import type { StateValues } from '../camera/types.js';
5
6
  import type { CameraStorage } from '../polyglot/node/plugins/cameraStorage.js';
6
7
  import type { MethodKeys, MethodType } from '../types.js';
7
- import { ProxyConnection } from './connection.js';
8
8
  import type { ProxySubscription } from './subscription.js';
9
9
  import type { CameraDeviceListenerMessagePayload, DeviceManagerProxyEvents, PluginMap, ProxyAuth } from './types.js';
10
10
  import type { WebsocketProxy } from './websocket.js';
@@ -26,5 +26,5 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
26
26
  cameraState: boolean;
27
27
  };
28
28
  onRequest<T extends keyof CameraInterfaces, K extends MethodKeys<CameraInterfaces[T]>>(cameraId: string, client: T, fn: K, ...args: Parameters<MethodType<CameraInterfaces[T], K>>): Promise<Awaited<ReturnType<MethodType<CameraInterfaces[T], K>>>>;
29
- handleMessage(message: ProxyMessageStructure): Promise<void | ProxyMessageStructure>;
29
+ requestHandler(message: ProxyMessageStructure): Promise<void | ProxyMessageStructure>;
30
30
  }
@@ -12,5 +12,5 @@ export declare class DeviceManagerProxy implements DeviceManagerServerProxyMetho
12
12
  createCamera(cameraConfig: CameraConfig, pluginId: string): Promise<Camera>;
13
13
  removeCameraByName(cameraName: string, pluginId: string): Promise<void>;
14
14
  removeCameraById(cameraId: string, pluginId: string): Promise<void>;
15
- handleMessage(message: ProxyMessageStructure): Promise<void | ProxyMessageStructure>;
15
+ requestHandler(message: ProxyMessageStructure): Promise<void | ProxyMessageStructure>;
16
16
  }
@@ -5,7 +5,7 @@ export interface Context {
5
5
  dependencies?: Record<string, string>;
6
6
  }
7
7
  export interface SchemaConfig {
8
- rootSchema: PluginRootSchema;
8
+ rootSchema: RootSchema;
9
9
  config: Record<string, any>;
10
10
  }
11
11
  export declare const PLUGIN_IDENTIFIER_PATTERN: RegExp;
@@ -68,7 +68,7 @@ export interface ProcessResponse {
68
68
  type: PLUGIN_STATUS;
69
69
  data?: ProcessErrorMessage;
70
70
  }
71
- export type JsonSchemaType = 'string' | 'number' | 'boolean' | 'object' | 'array';
71
+ export type JsonSchemaType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'button';
72
72
  export interface JsonBaseSchema<T = any> {
73
73
  type: JsonSchemaType;
74
74
  key?: string;
@@ -81,8 +81,6 @@ export interface JsonBaseSchema<T = any> {
81
81
  group?: string;
82
82
  defaultValue?: T;
83
83
  store?: boolean;
84
- }
85
- export interface PluginJsonBaseSchema<T = any> extends JsonBaseSchema<T> {
86
84
  onSet?: (newValue: any, oldValue: any) => Promise<void>;
87
85
  onGet?: () => Promise<any>;
88
86
  }
@@ -92,76 +90,47 @@ export interface JsonSchemaString extends JsonBaseSchema<string> {
92
90
  minLength?: number;
93
91
  maxLength?: number;
94
92
  }
95
- export interface PluginJsonSchemaString extends PluginJsonBaseSchema<string> {
96
- type: 'string';
97
- format?: 'date-time' | 'date' | 'time' | 'email' | 'uuid' | 'ipv4' | 'ipv6' | 'password' | 'qrCode';
98
- minLength?: number;
99
- maxLength?: number;
100
- }
101
93
  export interface JsonSchemaNumber extends JsonBaseSchema<number> {
102
94
  type: 'number';
103
95
  minimum?: number;
104
96
  maximum?: number;
105
97
  step?: number;
106
98
  }
107
- export interface PluginJsonSchemaNumber extends PluginJsonBaseSchema<number> {
108
- type: 'number';
109
- minimum?: number;
110
- maximum?: number;
111
- step?: number;
112
- }
113
99
  export interface JsonSchemaBoolean extends JsonBaseSchema<boolean> {
114
100
  type: 'boolean';
115
101
  }
116
- export interface PluginJsonSchemaBoolean extends PluginJsonBaseSchema<boolean> {
117
- type: 'boolean';
118
- }
119
102
  export interface JsonSchemaEnum extends JsonBaseSchema<string> {
120
103
  type: 'string';
121
104
  enum: string[];
122
105
  multiple?: boolean;
123
106
  }
124
- export interface PluginJsonSchemaEnum extends PluginJsonBaseSchema<string> {
125
- type: 'string';
126
- enum: string[];
127
- multiple?: boolean;
128
- }
129
107
  export interface JsonSchemaObject extends JsonBaseSchema {
130
108
  type: 'object';
131
109
  opened?: boolean;
132
110
  properties?: JsonSchemaForm;
133
111
  }
134
- export interface PluginJsonSchemaObject extends PluginJsonBaseSchema {
135
- type: 'object';
136
- opened?: boolean;
137
- properties?: PluginJsonSchemaForm;
138
- }
139
- export interface JsonSchemaObjectWithButtons extends JsonSchemaObject {
140
- buttons: [JsonSchemaButton, JsonSchemaButton?];
141
- }
142
112
  export interface JsonSchemaArray extends JsonBaseSchema {
143
113
  type: 'array';
144
114
  opened?: boolean;
145
115
  items?: JsonSchema;
146
116
  }
147
- export interface JsonSchemaButton {
117
+ export interface JsonSchemaButton extends JsonBaseSchema {
118
+ type: 'button';
119
+ }
120
+ export interface JsonSchemaObjectButton {
148
121
  label: string;
149
122
  onSubmit: string;
150
123
  }
151
- export type JsonSchema = JsonSchemaString | JsonSchemaNumber | JsonSchemaBoolean | JsonSchemaEnum | JsonSchemaObject | JsonSchemaObjectWithButtons | JsonSchemaArray;
152
- export type PluginJsonSchema = PluginJsonSchemaString | PluginJsonSchemaNumber | PluginJsonSchemaBoolean | PluginJsonSchemaEnum | PluginJsonSchemaObject;
124
+ export interface JsonSchemaObjectWithButtons extends JsonSchemaObject {
125
+ buttons: JsonSchemaObjectButton[];
126
+ }
127
+ export type JsonSchema = JsonSchemaString | JsonSchemaNumber | JsonSchemaBoolean | JsonSchemaEnum | JsonSchemaObject | JsonSchemaObjectWithButtons | JsonSchemaArray | JsonSchemaButton;
153
128
  export interface JsonSchemaForm {
154
129
  [key: string]: JsonSchema;
155
130
  }
156
- export interface PluginJsonSchemaForm {
157
- [key: string]: PluginJsonSchema;
158
- }
159
131
  export interface RootSchema {
160
132
  schema: JsonSchemaForm;
161
133
  }
162
- export interface PluginRootSchema {
163
- schema: PluginJsonSchemaForm;
164
- }
165
134
  export interface ToastMessage {
166
135
  type: 'info' | 'success' | 'warning' | 'error';
167
136
  message: string;
@@ -1,14 +1,13 @@
1
- import type { PluginJsonSchema, PluginJsonSchemaForm, SchemaConfig } from '../../../plugins/types.js';
1
+ import type { JsonSchema, JsonSchemaForm, SchemaConfig } from '../../../plugins/types.js';
2
2
  import type { API } from './pluginApi.js';
3
- export declare class CameraStorage {
3
+ export declare class CameraStorage<T extends Record<string, any> = Record<string, any>> {
4
4
  private cameraId;
5
5
  private instance;
6
6
  private api;
7
7
  private db;
8
- private _schema;
9
- private _values;
10
- get values(): Record<string, any>;
11
- constructor(api: API, instance: any, cameraId: string, schema?: PluginJsonSchemaForm);
8
+ schema: JsonSchemaForm;
9
+ values: T;
10
+ constructor(api: API, instance: any, cameraId: string, schema?: JsonSchemaForm);
12
11
  /**
13
12
  * Initialize the storage.
14
13
  * This will load the configuration from the database.
@@ -54,7 +53,7 @@ export declare class CameraStorage {
54
53
  *
55
54
  * @param newConfig - The new configuration to set.
56
55
  */
57
- setConfig(newConfig: Record<string, any>): Promise<void>;
56
+ setConfig(newConfig: T): Promise<void>;
58
57
  /**
59
58
  * Add a new schema to the existing schema.
60
59
  * It will also add the value to the configuration.
@@ -63,8 +62,8 @@ export declare class CameraStorage {
63
62
  * @param schema - The new schema to add.
64
63
  * @param path - The path to the schema to add.
65
64
  */
66
- addSchema(schema: PluginJsonSchemaForm): Promise<void>;
67
- addSchema(path: string, schema: PluginJsonSchema): Promise<void>;
65
+ addSchema(schema: JsonSchemaForm): Promise<void>;
66
+ addSchema(path: string, schema: JsonSchema): Promise<void>;
68
67
  /**
69
68
  * Remove a schema by its config path/key from the existing schema.
70
69
  * It will also remove the value from the configuration.
@@ -81,7 +80,7 @@ export declare class CameraStorage {
81
80
  * @param path - The path to the schema to change.
82
81
  * @param schema - The new schema to set.
83
82
  */
84
- changeSchema(path: string, newSchema: Partial<PluginJsonSchema>): Promise<void>;
83
+ changeSchema(path: string, newSchema: Partial<JsonSchema>): Promise<void>;
85
84
  /**
86
85
  * Get a schema by its config path/key.
87
86
  *
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import type { ZodTypeAny } from 'zod';
3
- import type { JsonSchema, JsonSchemaArray, JsonSchemaBoolean, JsonSchemaButton, JsonSchemaEnum, JsonSchemaForm, JsonSchemaNumber, JsonSchemaObject, JsonSchemaObjectWithButtons, JsonSchemaString, PluginJsonSchema, PluginJsonSchemaForm, PluginRootSchema, RootSchema } from '../../../plugins/types.js';
3
+ import type { JsonSchema, JsonSchemaArray, JsonSchemaBoolean, JsonSchemaButton, JsonSchemaEnum, JsonSchemaForm, JsonSchemaNumber, JsonSchemaObject, JsonSchemaObjectButton, JsonSchemaObjectWithButtons, JsonSchemaString, RootSchema } from '../../../plugins/types.js';
4
4
  type RootZodSchema = z.ZodObject<Record<string, ZodTypeAny>, 'strict', ZodTypeAny, {
5
5
  [x: string]: any;
6
6
  }, {
@@ -42,14 +42,14 @@ export declare const generateSchema: (value: any) => JsonSchema;
42
42
  * @param rootSchema - The Root JSON schema.
43
43
  * @returns - The generated JSON object.
44
44
  */
45
- export declare const generateJsonFromRootSchema: (rootSchema: RootSchema | PluginRootSchema) => Record<string, any>;
45
+ export declare const generateJsonFromRootSchema: (rootSchema: RootSchema) => Record<string, any>;
46
46
  /**
47
47
  * Generate a JSON object from a JSON schema.
48
48
  *
49
49
  * @param jsonSchema - The JSON schema.
50
50
  * @returns - The generated JSON object.
51
51
  */
52
- export declare const generateJsonFromSchema: (jsonSchema: JsonSchema | PluginJsonSchema) => any;
52
+ export declare const generateJsonFromSchema: (jsonSchema: JsonSchema) => any;
53
53
  /**
54
54
  * Generate a JSON object from a given JSON schema and use values from a config file.
55
55
  *
@@ -57,7 +57,7 @@ export declare const generateJsonFromSchema: (jsonSchema: JsonSchema | PluginJso
57
57
  * @param config - The config file with values to use.
58
58
  * @returns - The generated JSON object.
59
59
  */
60
- export declare const generateJsonFromSchemaWithConfig: (jsonSchema: JsonSchema | PluginJsonSchema, config: Record<string, any>, path?: string) => any;
60
+ export declare const generateJsonFromSchemaWithConfig: (jsonSchema: JsonSchema, config: Record<string, any>, path?: string) => any;
61
61
  /**
62
62
  * Generate a new config object from a given JSON schema and use values from a config file.
63
63
  * Contains only storable values.
@@ -73,22 +73,22 @@ export declare const generateStorableConfig: (jsonSchema: JsonSchemaForm | JsonS
73
73
  * @param schemaForm - The Plugin JSON schema form from which the functions should be removed.
74
74
  * @returns - The Plugin JSON schema form without functions.
75
75
  */
76
- export declare const removeFunctionsFromSchemaForm: (schemaForm: PluginJsonSchemaForm) => PluginJsonSchemaForm;
76
+ export declare const removeFunctionsFromSchemaForm: (schemaForm: JsonSchemaForm) => JsonSchemaForm;
77
77
  /**
78
78
  * Removes all functions from a given Plugin JSON schema.
79
79
  *
80
80
  * @param jsonSchema - The JSON schema from which the functions should be removed.
81
81
  * @returns - The JSON schema without functions.
82
82
  */
83
- export declare const removeFunctionsFromSchema: (jsonSchema: PluginJsonSchema) => PluginJsonSchema;
83
+ export declare const removeFunctionsFromSchema: (jsonSchema: JsonSchema) => JsonSchema;
84
84
  /**
85
85
  * Checks if a given JSON schema is readonly.
86
86
  *
87
87
  * @param jsonSchema - The JSON schema to check.
88
88
  * @returns - True if the JSON schema is readonly, false otherwise.
89
89
  */
90
- export declare const schemaIsReadonly: (jsonSchema: JsonSchema | PluginJsonSchema) => boolean;
91
- export declare const schemaIsStorable: (jsonSchema: JsonSchema | PluginJsonSchema) => boolean;
90
+ export declare const schemaIsReadonly: (jsonSchema: JsonSchema) => boolean;
91
+ export declare const schemaIsStorable: (jsonSchema: JsonSchema) => boolean;
92
92
  /**
93
93
  * Converts a config path to a schema path.
94
94
  *
@@ -170,7 +170,7 @@ export declare const generateObjectSchema: (value: Record<string, any>) => JsonS
170
170
  * @param buttons - Array of min one button and up to two buttons to be included in the schema.
171
171
  * @returns - The generated JSON schema for the object.
172
172
  */
173
- export declare const generateObjectSchemaWithButtons: (value: Record<string, any>, buttons: [JsonSchemaButton, JsonSchemaButton?]) => JsonSchemaObjectWithButtons;
173
+ export declare const generateObjectSchemaWithButtons: (value: Record<string, any>, buttons: JsonSchemaObjectButton[]) => JsonSchemaObjectWithButtons;
174
174
  /**
175
175
  * Generates a JSON schema for an array.
176
176
  *
@@ -227,6 +227,19 @@ export declare const isObjectTypeWithButtons: (jsonSchema: Partial<JsonSchema>)
227
227
  * @returns - True if the JSON schema is of array type, false otherwise.
228
228
  */
229
229
  export declare const isArrayType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaArray;
230
+ /**
231
+ * Checks if the given JSON schema is of button type.
232
+ *
233
+ * @param jsonSchema - The JSON schema to check.
234
+ * @returns - True if the JSON schema is of button type, false otherwise.
235
+ */
236
+ export declare const isButtonType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaButton;
237
+ /**
238
+ * Checks if the given value is a JSON schema.
239
+ *
240
+ * @param value - The value to check.
241
+ * @returns - True if the value is a JSON schema, false otherwise.
242
+ */
230
243
  export declare const isJsonSchema: (value: any) => value is JsonSchema;
231
244
  /**
232
245
  * Checks if the given value is a JSON Primitive schema.
@@ -1,5 +1,5 @@
1
1
  import { CameraStorage } from './cameraStorage.js';
2
- import type { PluginJsonSchemaForm } from '../../../plugins/types.js';
2
+ import type { JsonSchemaForm } from '../../../plugins/types.js';
3
3
  import type { API } from './pluginApi.js';
4
4
  export declare class StorageController {
5
5
  private api;
@@ -12,13 +12,13 @@ export declare class StorageController {
12
12
  * @param cameraId - The camera id
13
13
  * @param schema - The plugin schema
14
14
  */
15
- createCameraStorage(instance: any, cameraId: string, schema?: PluginJsonSchemaForm): CameraStorage;
15
+ createCameraStorage<T extends Record<string, any> = Record<string, any>>(instance: any, cameraId: string, schema?: JsonSchemaForm): CameraStorage<T>;
16
16
  /**
17
17
  * Get a camera storage instance
18
18
  *
19
19
  * @param cameraId - The camera id
20
20
  */
21
- getCameraStorage(cameraId: string): CameraStorage | undefined;
21
+ getCameraStorage<T extends Record<string, any> = Record<string, any>>(cameraId: string): CameraStorage<T> | undefined;
22
22
  /**
23
23
  * Remove a camera storage instance
24
24
  *
@@ -5,13 +5,14 @@ export declare class ConfigService {
5
5
  static readonly IS_DOCKER: boolean;
6
6
  static readonly IS_ELECTRON: boolean;
7
7
  static readonly IS_HA: boolean;
8
- static readonly IS_STANDARD: boolean;
9
- static readonly IS_SERVICE: boolean;
10
- static readonly VERSION: string;
11
- static readonly MIN_NODE_VERSION: string;
8
+ static readonly AS_SERVICE: boolean;
9
+ static readonly APP_NAME: string;
10
+ static get VERSION(): string;
12
11
  static readonly NODE_VERSION: string;
12
+ static readonly MIN_NODE_VERSION: string;
13
13
  static readonly SERVER_PATH: string;
14
14
  static readonly INTERFACE_PATH: string;
15
+ static readonly INSTALL_PATH: string | null;
15
16
  private logger;
16
17
  private _config;
17
18
  private _go2rtcConfig;
@@ -51,4 +52,5 @@ export declare class ConfigService {
51
52
  private updateSecrets;
52
53
  private createDirs;
53
54
  private generatePluginsPackageJson;
55
+ private getUserHomeDir;
54
56
  }
@@ -2,7 +2,7 @@ export interface Secrets {
2
2
  jwtAccessKey: string;
3
3
  jwtRefreshKey: string;
4
4
  }
5
- export interface Runtime {
5
+ export interface RuntimeInfo {
6
6
  name: string;
7
7
  status: RUNTIME_STATUS;
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camera.ui/browser",
3
- "version": "0.0.83",
3
+ "version": "0.0.84",
4
4
  "description": "camera.ui browser client",
5
5
  "author": "seydx (https://github.com/seydx/camera.ui)",
6
6
  "module": "./dist/bundle.js",