@camera.ui/browser 0.0.77 → 0.0.80

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 (82) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/types/packages/client/browser/src/proxy/cameraDevice.d.ts +21 -7
  3. package/dist/types/packages/client/browser/src/proxy/deviceManager.d.ts +4 -0
  4. package/dist/types/packages/client/browser/src/socket.d.ts +7 -7
  5. package/dist/types/packages/client/browser/src/streaming/go2rts-session.d.ts +54 -0
  6. package/dist/types/packages/client/browser/src/types.d.ts +11 -8
  7. package/dist/types/packages/client/browser/src/utils.d.ts +12 -0
  8. package/dist/types/server/src/api/controllers/users.controller.d.ts +9 -3
  9. package/dist/types/server/src/api/database/index.d.ts +10 -3
  10. package/dist/types/server/src/api/database/types.d.ts +35 -29
  11. package/dist/types/server/src/api/go2rtc/api/config.d.ts +3 -4
  12. package/dist/types/server/src/api/go2rtc/api/index.d.ts +1 -2
  13. package/dist/types/server/src/api/go2rtc/api/streams.d.ts +5 -6
  14. package/dist/types/server/src/api/go2rtc/types.d.ts +5 -2
  15. package/dist/types/server/src/api/index.d.ts +7 -9
  16. package/dist/types/server/src/api/middlewares/pagination.middleware.d.ts +1 -1
  17. package/dist/types/server/src/api/plugins/logger.plugin.d.ts +7 -0
  18. package/dist/types/server/src/api/routes/index.d.ts +1 -2
  19. package/dist/types/server/src/api/schemas/backup.schema.d.ts +53 -155
  20. package/dist/types/server/src/api/schemas/cameras.schema.d.ts +201 -142
  21. package/dist/types/server/src/api/schemas/config.schema.d.ts +20 -20
  22. package/dist/types/server/src/api/schemas/go2rtc.schema.d.ts +60 -60
  23. package/dist/types/server/src/api/schemas/users.schema.d.ts +242 -136
  24. package/dist/types/server/src/api/services/cameras.service.d.ts +9 -7
  25. package/dist/types/server/src/api/services/plugins.service.d.ts +1 -0
  26. package/dist/types/server/src/api/services/users.service.d.ts +6 -2
  27. package/dist/types/server/src/api/types/index.d.ts +34 -8
  28. package/dist/types/server/src/api/utils/fetch.d.ts +2 -0
  29. package/dist/types/server/src/api/websocket/nsp/status.d.ts +1 -1
  30. package/dist/types/server/src/api/websocket/types.d.ts +1 -15
  31. package/dist/types/server/src/api.d.ts +1 -2
  32. package/dist/types/server/src/camera/controller.d.ts +23 -12
  33. package/dist/types/server/src/camera/device.d.ts +7 -16
  34. package/dist/types/server/src/camera/index.d.ts +31 -22
  35. package/dist/types/server/src/camera/interfaces/audioDetection.d.ts +10 -0
  36. package/dist/types/server/src/camera/interfaces/camera.d.ts +19 -0
  37. package/dist/types/server/src/camera/interfaces/motionDetection.d.ts +10 -0
  38. package/dist/types/server/src/camera/interfaces/objectDetection.d.ts +10 -0
  39. package/dist/types/server/src/camera/interfaces/prebuffer.d.ts +11 -0
  40. package/dist/types/server/src/camera/interfaces/ptz.d.ts +13 -0
  41. package/dist/types/server/src/camera/polygon.d.ts +3 -2
  42. package/dist/types/server/src/camera/streaming/peer-connection.d.ts +1 -1
  43. package/dist/types/server/src/camera/streaming/webrtc-connection.d.ts +2 -1
  44. package/dist/types/server/src/camera/streaming/{streaming-session.d.ts → werift-session.d.ts} +1 -1
  45. package/dist/types/server/src/camera/types.d.ts +60 -21
  46. package/dist/types/server/src/camera/videoFrame.d.ts +10 -11
  47. package/dist/types/server/src/decoder/types.d.ts +31 -22
  48. package/dist/types/server/src/decoder/worker.d.ts +4 -4
  49. package/dist/types/server/src/nats/index.d.ts +1 -1
  50. package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +30 -36
  51. package/dist/types/server/src/nats/proxy/deviceManager.d.ts +1 -1
  52. package/dist/types/server/src/nats/proxy/pluginsManager.d.ts +1 -1
  53. package/dist/types/server/src/nats/proxy/systemManager.d.ts +1 -1
  54. package/dist/types/server/src/nats/server.d.ts +10 -7
  55. package/dist/types/server/src/nats/types.d.ts +27 -53
  56. package/dist/types/server/src/nats/websocket.d.ts +9 -5
  57. package/dist/types/server/src/plugins/base.d.ts +2 -3
  58. package/dist/types/server/src/plugins/index.d.ts +1 -0
  59. package/dist/types/server/src/plugins/types.d.ts +22 -5
  60. package/dist/types/server/src/plugins/worker.d.ts +1 -0
  61. package/dist/types/server/src/polyglot/node/plugins/api.d.ts +1 -2
  62. package/dist/types/server/src/polyglot/node/plugins/cameraStorage.d.ts +2 -2
  63. package/dist/types/server/src/polyglot/node/plugins/proxy/cameraDevice.d.ts +35 -14
  64. package/dist/types/server/src/polyglot/node/plugins/proxy/deviceManager.d.ts +5 -5
  65. package/dist/types/server/src/polyglot/node/plugins/proxy/pluginsManager.d.ts +5 -5
  66. package/dist/types/server/src/polyglot/node/plugins/proxy/systemManager.d.ts +5 -5
  67. package/dist/types/server/src/polyglot/node/plugins/schema.d.ts +10 -2
  68. package/dist/types/server/src/polyglot/node/plugins/storageController.d.ts +1 -1
  69. package/dist/types/server/src/services/config/constants.d.ts +0 -2
  70. package/dist/types/server/src/services/config/index.d.ts +29 -36
  71. package/dist/types/server/src/services/config/types.d.ts +1 -1
  72. package/dist/types/server/src/types.d.ts +4 -0
  73. package/dist/types/server/src/utils/packer.d.ts +2 -0
  74. package/dist/types/server/src/utils/pythonInstaller.d.ts +1 -1
  75. package/dist/types/server/src/utils/utils.d.ts +5 -0
  76. package/dist/types/shared/types/index.d.ts +5 -0
  77. package/package.json +10 -14
  78. package/dist/types/packages/client/browser/src/streaming/peer-connection.d.ts +0 -24
  79. package/dist/types/packages/client/browser/src/streaming/streaming-session.d.ts +0 -25
  80. package/dist/types/packages/client/browser/src/streaming/webrtc-connection.d.ts +0 -26
  81. package/dist/types/server/src/api/utils/axios.d.ts +0 -2
  82. package/dist/types/server/src/api/websocket/nsp/streams.d.ts +0 -15
@@ -1,7 +1,6 @@
1
1
  import type { CameraDevice } from '../camera/device.js';
2
+ import type { FormSubmitResponse } from './types.js';
2
3
  export declare abstract class BasePlugin {
3
- abstract onFormSubmit(actionId: string, payload: any): Promise<{
4
- toast?: string;
5
- }>;
4
+ abstract onFormSubmit(actionId: string, payload: any): Promise<FormSubmitResponse | void>;
6
5
  abstract configureCameras(cameras: CameraDevice[]): void;
7
6
  }
@@ -26,6 +26,7 @@ export declare class PluginManager {
26
26
  installRequiredPythonEnvs(): Promise<void>;
27
27
  private loadInstalledPlugins;
28
28
  private removeOrphanedPlugins;
29
+ private handleDisabledPlugins;
29
30
  private loadDefaultPaths;
30
31
  private addNpmPrefixToSearchPaths;
31
32
  }
@@ -11,7 +11,8 @@ export interface JSONObject {
11
11
  export type JSONArray = JSONValue[];
12
12
  export type PluginConfig = Record<string, any>;
13
13
  export declare const CAMERA_EXTENSIONS: CameraExtension[];
14
- export type CameraExtension = 'hub' | 'prebuffer' | 'motionDetection' | 'objectDetection' | 'audioDetection' | 'ptz' | 'intercom';
14
+ export type CameraExtensionWithoutHub = 'prebuffer' | 'motionDetection' | 'objectDetection' | 'audioDetection' | 'ptz';
15
+ export type CameraExtension = CameraExtensionWithoutHub | 'hub';
15
16
  type ExtensionOrSupport = {
16
17
  extension: CameraExtension;
17
18
  supportAdditionalCameras?: never;
@@ -20,7 +21,7 @@ type ExtensionOrSupport = {
20
21
  supportAdditionalCameras?: boolean;
21
22
  };
22
23
  export interface PluginContractBase {
23
- builtIns?: Exclude<CameraExtension, 'hub'>[];
24
+ builtIns?: CameraExtensionWithoutHub[];
24
25
  dependencies?: string[];
25
26
  pythonVersion?: string;
26
27
  }
@@ -44,9 +45,14 @@ export interface PluginStorage {
44
45
  storagePath: string;
45
46
  configFile: string;
46
47
  }
48
+ export interface PluginInfo {
49
+ id: string;
50
+ name: string;
51
+ contract: PluginContract;
52
+ }
47
53
  export interface ProcessLoadMessage {
48
54
  cameras: Camera[];
49
- pluginId: string;
55
+ plugin: PluginInfo;
50
56
  storage: PluginStorage;
51
57
  }
52
58
  export interface ProcessMessage {
@@ -77,7 +83,7 @@ export interface PluginJsonBaseSchema<T = any> extends JsonBaseSchema<T> {
77
83
  }
78
84
  export interface JsonSchemaString extends JsonBaseSchema<string> {
79
85
  type: 'string';
80
- format?: 'date-time' | 'date' | 'time' | 'email' | 'uuid' | 'ipv4' | 'ipv6' | 'password' | 'qrCode';
86
+ format?: 'date-time' | 'date' | 'time' | 'email' | 'uuid' | 'ipv4' | 'ipv6' | 'password' | 'qrCode' | 'image';
81
87
  minLength?: number;
82
88
  maxLength?: number;
83
89
  }
@@ -126,7 +132,7 @@ export interface PluginJsonSchemaObject extends PluginJsonBaseSchema {
126
132
  properties?: PluginJsonSchemaForm;
127
133
  }
128
134
  export interface JsonSchemaObjectWithButtons extends JsonSchemaObject {
129
- buttons?: [JsonSchemaButton, JsonSchemaButton?];
135
+ buttons: [JsonSchemaButton, JsonSchemaButton?];
130
136
  }
131
137
  export interface JsonSchemaAnyOf {
132
138
  anyOf: JsonSchema[];
@@ -154,4 +160,15 @@ export interface RootSchema {
154
160
  export interface PluginRootSchema {
155
161
  schema: PluginJsonSchemaForm;
156
162
  }
163
+ export interface ToastMessage {
164
+ type: 'info' | 'success' | 'warning' | 'error';
165
+ message: string;
166
+ }
167
+ export interface FormSubmitSchema {
168
+ config: JsonSchemaObjectWithButtons;
169
+ }
170
+ export interface FormSubmitResponse {
171
+ toast?: ToastMessage;
172
+ schema?: FormSubmitSchema;
173
+ }
157
174
  export {};
@@ -22,6 +22,7 @@ export declare class PluginWorker {
22
22
  restart(): Promise<void>;
23
23
  getPID(): number;
24
24
  isRunning(): boolean;
25
+ isReady(): boolean;
25
26
  private gatherDevices;
26
27
  private kill;
27
28
  private setStatus;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import { EventEmitter } from 'node:events';
3
2
  import { DeviceManager, PluginsManager, SystemManager } from './proxy/index.js';
4
3
  import { StorageController } from './storageController.js';
@@ -34,7 +33,7 @@ export declare class PluginAPI extends EventEmitter implements API {
34
33
  readonly storagePath: string;
35
34
  readonly configFile: string;
36
35
  readonly plugin: BasePlugin;
37
- constructor(plugin: Plugin, logger: PluginLogger, proxyPort: number, auth: {
36
+ constructor(plugin: Plugin, logger: PluginLogger, proxyEndpoints: string[], auth: {
38
37
  user: string;
39
38
  pass: string;
40
39
  });
@@ -13,7 +13,7 @@ export declare class CameraStorage {
13
13
  * Initialize the storage.
14
14
  * This will load the configuration from the database.
15
15
  */
16
- initializeStorage(): Promise<void>;
16
+ initializeStorage(): void;
17
17
  /**
18
18
  * Get a value from the configuration by its key/path.
19
19
  * If the schema has an onGet function, the onGet function will be called.
@@ -72,7 +72,7 @@ export declare class CameraStorage {
72
72
  *
73
73
  * @param path - The path to the schema to remove.
74
74
  */
75
- removeSchema(path: string): Promise<void>;
75
+ removeSchema(path: string): void;
76
76
  /**
77
77
  * Change a schema by its config path/key from the existing schema.
78
78
  * It will also change the value from the configuration.
@@ -1,54 +1,69 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import { CameraDevice } from '../../../../camera/device.js';
2
+ import { CameraAudioDetectionInterface } from '../../../../camera/interfaces/audioDetection.js';
3
+ import { CameraMotionDetectionInterface } from '../../../../camera/interfaces/motionDetection.js';
4
+ import { CameraObjectDetectionInterface } from '../../../../camera/interfaces/objectDetection.js';
5
+ import { CameraPrebufferInterface } from '../../../../camera/interfaces/prebuffer.js';
6
+ import { CameraPTZInterface } from '../../../../camera/interfaces/ptz.js';
3
7
  import { MotionFrame, VideoFrame } from '../../../../camera/videoFrame.js';
4
8
  import type { Camera } from '../../../../api/database/types.js';
5
- import type { CameraSource, SetValues } from '../../../../camera/types.js';
9
+ import type { CameraAudioDetectionDelegate, CameraConfigInputSettings, CameraDelegate, CameraDelegates, CameraMotionDetectionDelegate, CameraObjectDetectionDelegate, CameraPrebufferDelegate, CameraPTZDelegate, CameraSource, SetValues } from '../../../../camera/types.js';
10
+ import type { VideoFrame as VideoFrameImp } from '../../../../decoder/types.js';
11
+ import type { CameraDeviceProxyMethods } from '../../../../nats/types.js';
12
+ import type { PluginInfo } from '../../../../plugins/types.js';
6
13
  import type { IceServer } from '../../../../services/config/types.js';
14
+ import type { MethodKeys, MethodType } from '../../../../types.js';
7
15
  import type { PluginAPI } from '../api.js';
8
16
  import type { PluginLogger } from '../logger.js';
9
17
  export declare class CameraDeviceProxy extends CameraDevice {
10
18
  private api;
11
19
  private initialized;
12
20
  private subject;
13
- private subjectMotionFrame;
14
21
  private cameraSubscriberSubject;
15
22
  private cameraPluginSubscriberSubject;
16
23
  private frameSubject;
17
- private framePrebufferSubject;
18
24
  private motionFrameSubject;
19
25
  private signalingSubject;
20
26
  private signalingTargetSubject;
21
27
  private publisher?;
28
+ private cameraPublisher?;
22
29
  private framePublisher?;
30
+ private motionFramePublisher?;
31
+ private signalingPublisher?;
23
32
  private subscriber?;
24
33
  private cameraSubscriber?;
25
34
  private cameraPluginSubscriber?;
26
35
  private signalingSubscriber?;
27
36
  private frameSubscriber?;
28
- private prebufferFrameSubsciber?;
29
37
  private motionFrameSubscriber?;
30
38
  private messageQueue?;
31
39
  private activeRequests;
32
40
  private activeMotionRequests;
33
41
  private auth;
34
- private proxyPort;
35
- private pluginID;
36
- private pluginName;
42
+ private proxyEndpoints;
43
+ private plugin;
44
+ private cameraDelegate;
45
+ prebufferDelegate: CameraPrebufferInterface;
46
+ ptzDelegate: CameraPTZInterface;
47
+ audioDetectorDelegate: CameraAudioDetectionInterface;
48
+ motionDetectorDelegate: CameraMotionDetectionInterface;
49
+ objectDetectorDelegate: CameraObjectDetectionInterface;
37
50
  get sources(): CameraSource[];
38
- constructor(api: PluginAPI, logger: PluginLogger, camera: Camera, pluginId: string, pluginName: string, proxyPort: number, auth: {
51
+ constructor(api: PluginAPI, logger: PluginLogger, camera: Camera, plugin: PluginInfo, proxyEndpoints: string[], auth: {
39
52
  user: string;
40
53
  pass: string;
41
54
  });
42
55
  init(): Promise<void>;
56
+ setDelegate<T extends keyof CameraDelegates>(name: T, delegate: CameraDelegates[T]): void;
43
57
  connect(): Promise<void>;
44
58
  disconnect(): Promise<void>;
45
- reboot(): Promise<void>;
46
- getFrames(): AsyncIterableIterator<VideoFrame>;
59
+ getFrames(prebufferDuration?: number): AsyncIterableIterator<VideoFrame>;
47
60
  getMotionFrames(): AsyncIterableIterator<MotionFrame>;
48
- getPrebufferedFrames(): AsyncIterableIterator<VideoFrame>;
49
61
  getFfmpegPath(): Promise<string>;
50
62
  getIceServers(): Promise<IceServer[]>;
51
- updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], frame?: Buffer): Promise<void>;
63
+ updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], frame?: VideoFrameImp): Promise<void>;
64
+ addCameraSource(source: CameraConfigInputSettings): Promise<void>;
65
+ updateCameraSource(sourceId: string, source: Partial<CameraConfigInputSettings>): Promise<void>;
66
+ removeCameraSource(sourceId: string): Promise<void>;
52
67
  refreshStates(): Promise<void>;
53
68
  cleanup(): Promise<void>;
54
69
  private onMotionFrame;
@@ -60,5 +75,11 @@ export declare class CameraDeviceProxy extends CameraDevice {
60
75
  private requestHandler;
61
76
  private listenToMessages;
62
77
  private listenToSignalingMessages;
63
- private onRequest;
78
+ onRequest<T extends keyof CameraDeviceProxyMethods>(client: 'cameraFn', fn: T, args?: Record<string, any>, timeout?: number): Promise<any>;
79
+ onRequest<T extends MethodKeys<CameraDelegate>>(client: 'cameraDelegate', fn: T, args?: Parameters<MethodType<CameraDelegate, T>>, timeout?: number): Promise<any>;
80
+ onRequest<T extends MethodKeys<CameraPrebufferDelegate>>(client: 'prebufferDelegate', fn: T, args?: Parameters<MethodType<CameraPrebufferDelegate, T>>, timeout?: number): Promise<any>;
81
+ onRequest<T extends MethodKeys<CameraPTZDelegate>>(client: 'ptzDelegate', fn: T, args?: Parameters<MethodType<CameraPTZDelegate, T>>, timeout?: number): Promise<any>;
82
+ onRequest<T extends MethodKeys<CameraMotionDetectionDelegate>>(client: 'motionDetectorDelegate', fn: T, args?: Parameters<MethodType<CameraMotionDetectionDelegate, T>>, timeout?: number): Promise<any>;
83
+ onRequest<T extends MethodKeys<CameraObjectDetectionDelegate>>(client: 'objectDetectorDelegate', fn: T, args?: Parameters<MethodType<CameraObjectDetectionDelegate, T>>, timeout?: number): Promise<any>;
84
+ onRequest<T extends MethodKeys<CameraAudioDetectionDelegate>>(client: 'audioDetectorDelegate', fn: T, args?: Parameters<MethodType<CameraAudioDetectionDelegate, T>>, timeout?: number): Promise<any>;
64
85
  }
@@ -1,9 +1,9 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import { EventEmitter } from 'node:events';
3
2
  import { CameraDeviceProxy } from './cameraDevice.js';
4
3
  import type { CameraDevice } from '../../../../camera/device.js';
5
4
  import type { CameraConfig } from '../../../../camera/types.js';
6
5
  import type { DeviceManagerProxyEventCallbacks, DeviceManagerProxyMethods } from '../../../../nats/types.js';
6
+ import type { PluginInfo } from '../../../../plugins/types.js';
7
7
  import type { PluginAPI } from '../api.js';
8
8
  import type { PluginLogger } from '../logger.js';
9
9
  export declare interface DeviceManager extends DeviceManagerProxyMethods {
@@ -20,15 +20,15 @@ export declare class DeviceManager extends EventEmitter implements DeviceManager
20
20
  private subject;
21
21
  private dmSubject;
22
22
  private publisher?;
23
+ private dmPublisher?;
23
24
  private subscriber?;
24
25
  private dmSubscriber?;
25
26
  private messageQueue?;
26
27
  private auth;
27
- private proxyPort;
28
- private pluginId;
29
- private pluginName;
28
+ private proxyEndpoints;
29
+ private plugin;
30
30
  private devices;
31
- constructor(api: PluginAPI, logger: PluginLogger, pluginId: string, pluginName: string, proxyPort: number, auth: {
31
+ constructor(api: PluginAPI, logger: PluginLogger, plugin: PluginInfo, proxyEndpoints: string[], auth: {
32
32
  user: string;
33
33
  pass: string;
34
34
  });
@@ -1,6 +1,6 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import { EventEmitter } from 'node:events';
3
2
  import type { PluginsManagerProxyEventCallbacks, PluginsManagerProxyMethods } from '../../../../nats/types.js';
3
+ import type { PluginInfo } from '../../../../plugins/types.js';
4
4
  import type { PluginAPI } from '../api.js';
5
5
  import type { PluginLogger } from '../logger.js';
6
6
  export declare interface PluginsManager extends PluginsManagerProxyMethods {
@@ -17,14 +17,14 @@ export declare class PluginsManager extends EventEmitter implements PluginsManag
17
17
  private subject;
18
18
  private pmSubject;
19
19
  private publisher?;
20
+ private pmPublisher?;
20
21
  private subscriber?;
21
22
  private pmSubscriber?;
22
23
  private messageQueue?;
23
24
  private auth;
24
- private proxyPort;
25
- private pluginId;
26
- private pluginName;
27
- constructor(api: PluginAPI, logger: PluginLogger, pluginId: string, pluginName: string, proxyPort: number, auth: {
25
+ private proxyEndpoints;
26
+ private plugin;
27
+ constructor(api: PluginAPI, logger: PluginLogger, plugin: PluginInfo, proxyEndpoints: string[], auth: {
28
28
  user: string;
29
29
  pass: string;
30
30
  });
@@ -1,6 +1,6 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import { EventEmitter } from 'node:events';
3
2
  import type { SystemManagerProxyEventCallbacks, SystemManagerProxyMethods } from '../../../../nats/types.js';
3
+ import type { PluginInfo } from '../../../../plugins/types.js';
4
4
  import type { PluginAPI } from '../api.js';
5
5
  import type { PluginLogger } from '../logger.js';
6
6
  export declare interface SystemManager extends SystemManagerProxyMethods {
@@ -17,14 +17,14 @@ export declare class SystemManager extends EventEmitter implements SystemManager
17
17
  private subject;
18
18
  private smSubject;
19
19
  private publisher?;
20
+ private smPublisher?;
20
21
  private subscriber?;
21
22
  private smSubscriber?;
22
23
  private messageQueue?;
23
24
  private auth;
24
- private proxyPort;
25
- private pluginId;
26
- private pluginName;
27
- constructor(api: PluginAPI, logger: PluginLogger, pluginId: string, pluginName: string, proxyPort: number, auth: {
25
+ private proxyEndpoints;
26
+ private plugin;
27
+ constructor(api: PluginAPI, logger: PluginLogger, plugin: PluginInfo, proxyEndpoints: string[], auth: {
28
28
  user: string;
29
29
  pass: string;
30
30
  });
@@ -1,4 +1,5 @@
1
- import { z, type ZodTypeAny } from 'zod';
1
+ import { z } from 'zod';
2
+ import type { ZodTypeAny } from 'zod';
2
3
  import type { JsonSchema, JsonSchemaAnyOf, JsonSchemaArray, JsonSchemaBoolean, JsonSchemaButton, JsonSchemaEnum, JsonSchemaNumber, JsonSchemaObject, JsonSchemaObjectWithButtons, JsonSchemaString, PluginJsonSchema, PluginJsonSchemaForm, PluginRootSchema, RootSchema } from '../../../plugins/types.js';
3
4
  type RootZodSchema = z.ZodObject<Record<string, ZodTypeAny>, 'strict', ZodTypeAny, {
4
5
  [x: string]: any;
@@ -71,6 +72,13 @@ export declare const removeFunctionsFromSchemaForm: (schemaForm: PluginJsonSchem
71
72
  * @returns - The JSON schema without functions.
72
73
  */
73
74
  export declare const removeFunctionsFromSchema: (jsonSchema: PluginJsonSchema) => PluginJsonSchema;
75
+ /**
76
+ * Checks if a given JSON schema is readonly.
77
+ *
78
+ * @param jsonSchema - The JSON schema to check.
79
+ * @returns - True if the JSON schema is readonly, false otherwise.
80
+ */
81
+ export declare const schameIsReadonly: (jsonSchema: JsonSchema | PluginJsonSchema) => boolean;
74
82
  /**
75
83
  * Converts a config path to a schema path.
76
84
  *
@@ -137,7 +145,7 @@ export declare const generateStringSchema: (value: string) => JsonSchemaString;
137
145
  * @param type - The type of the enum.
138
146
  * @returns - The generated JSON schema for the enum.
139
147
  */
140
- export declare const generateEnumSchema: (value: string[]) => JsonSchemaEnum;
148
+ export declare const generateEnumSchema: (value: (string | number | boolean)[]) => JsonSchemaEnum;
141
149
  /**
142
150
  * Generates a JSON schema for an object.
143
151
  *
@@ -12,7 +12,7 @@ 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): Promise<CameraStorage>;
15
+ createCameraStorage(instance: any, cameraId: string, schema?: PluginJsonSchemaForm): CameraStorage;
16
16
  /**
17
17
  * Get a camera storage instance
18
18
  *
@@ -1,6 +1,4 @@
1
- import type { RTCIceServer } from 'werift';
2
1
  import type { Go2RtcConfig, IConfig, IceServer } from './types.js';
3
2
  export declare const DEFAULT_ICE_SERVERS: IceServer[];
4
- export declare const DEFAULT_WERIFT_ICE_SERVERS: RTCIceServer[];
5
3
  export declare const DEFAULT_CONFIG: IConfig;
6
4
  export declare const DEFAULT_GO2RTC_CONFIG: Go2RtcConfig;
@@ -1,49 +1,43 @@
1
1
  import 'reflect-metadata';
2
2
  import type { Go2RtcConfig, IConfig, Secrets } from './types.js';
3
3
  export declare class ConfigService {
4
+ static readonly IS_DEV: boolean;
5
+ static readonly IS_DOCKER: boolean;
6
+ static readonly IS_ELECTRON: boolean;
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;
12
+ static readonly NODE_VERSION: string;
13
+ static readonly SERVER_PATH: string;
14
+ static readonly INTERFACE_PATH: string;
4
15
  private logger;
5
16
  private _config;
6
17
  private _go2rtcConfig;
7
- CAMERAS_ID: string;
8
- DATABASE_ID: string;
9
- PLUGINS_ID: string;
10
- USER_PLUGINS_ID: string;
11
- SETTINGS_ID: string;
12
- TOKENS_ID: string;
13
- USERS_ID: string;
14
- SECRETS: Secrets;
15
- static IS_DEV: boolean;
16
- static IS_DOCKER: boolean;
17
- static IS_ELECTRON: boolean;
18
- static IS_HA: boolean;
19
- static IS_STANDARD: boolean;
20
- static IS_SERVICE: boolean;
21
- SERVER_PATH: string;
22
- INTERFACE_PATH: string;
23
- static VERSION: string;
24
- static MIN_NODE_VERSION: string;
25
- static NODE_VERSION: string;
26
- HOME_PATH: string;
27
- STORAGE_PATH: string;
28
- DATABASE_PATH: string;
29
- USERS_STORAGE_PATH: string;
30
- PLUGINS_STORAGE_PATH: string;
31
- PLUGINS_INSTALL_PATH: string;
32
- PLUGINS_PJSON_FILE: string;
33
- LOG_FILE: string;
34
- CONFIG_FILE: string;
35
- SECRETS_FILE: string;
36
- PYTHON_BINARY: string;
37
- GO2RTC_BINARY: string;
38
- GO2RTC_CONFIG_FILE: string;
39
- NATS_BINARY: string;
40
- UI_PORT: number;
41
- UI_ELECTRON_PORT: number;
18
+ readonly SECRETS: Secrets;
19
+ readonly HOME_PATH: string;
20
+ readonly STORAGE_PATH: string;
21
+ readonly DATABASE_PATH: string;
22
+ readonly USERS_STORAGE_PATH: string;
23
+ readonly TMP_DIR: string;
24
+ readonly PLUGINS_STORAGE_PATH: string;
25
+ readonly PLUGINS_INSTALL_PATH: string;
26
+ readonly PLUGINS_PJSON_FILE: string;
27
+ readonly LOG_FILE: string;
28
+ readonly CONFIG_FILE: string;
29
+ readonly SECRETS_FILE: string;
30
+ readonly GO2RTC_BINARY: string;
31
+ readonly GO2RTC_CONFIG_FILE: string;
32
+ readonly NATS_BINARY: string;
33
+ readonly UI_PORT: number;
34
+ readonly UI_ELECTRON_PORT: number;
42
35
  get config(): IConfig;
43
36
  set config(newConfig: IConfig);
44
37
  get go2rtcConfig(): Go2RtcConfig;
45
38
  set go2rtcConfig(newConfig: Go2RtcConfig);
46
39
  constructor();
40
+ static extractVersion(str: string): string | null;
47
41
  read(): void;
48
42
  writeConfig(newConfig?: IConfig): void;
49
43
  writeGo2RtcConfigFile(newConfig?: Go2RtcConfig): void;
@@ -56,5 +50,4 @@ export declare class ConfigService {
56
50
  private updateConfig;
57
51
  private updateGo2RtcConfig;
58
52
  private updateSecrets;
59
- static extractVersion(str: string): string | null;
60
53
  }
@@ -24,7 +24,7 @@ export interface PluginsSettings {
24
24
  }
25
25
  export interface IConfig {
26
26
  port: number;
27
- insecurePort: number;
27
+ localPort: number;
28
28
  tempFile?: string;
29
29
  ssl: IConfigSSL;
30
30
  logger: Logger;
@@ -0,0 +1,4 @@
1
+ export type MethodKeys<T> = keyof {
2
+ [K in keyof T as T[K] extends (...args: any) => any ? K : never]: any;
3
+ };
4
+ export type MethodType<T, K extends keyof T> = T[K] extends (...args: any) => any ? T[K] : never;
@@ -0,0 +1,2 @@
1
+ export declare const pack: (message: any) => Buffer;
2
+ export declare const unpack: <T = any>(message: Buffer | Uint8Array) => T;
@@ -18,7 +18,7 @@ export declare class PythonInstaller {
18
18
  get version(): string;
19
19
  private get logPrefix();
20
20
  constructor(identifier: string, venvDir?: string, version?: string);
21
- install(): Promise<void>;
21
+ install(type: 'plugin' | 'server'): Promise<void>;
22
22
  installPluginPython(): Promise<void>;
23
23
  uninstall(): Promise<void>;
24
24
  updatePluginDependencies(requirementsPath: string): Promise<void>;
@@ -1,6 +1,11 @@
1
1
  import type { JwtTokenDecoded } from '../api/types/index.js';
2
+ export type Customizer<TObject, TSource> = (objValue: any, srcValue: any, key: string, object: TObject, source: TSource, stack: any[]) => any;
2
3
  export declare const toQuery: (data: any) => string;
3
4
  export declare const toData: (query: string) => Record<string, any>;
4
5
  export declare const isJson: (str: any) => boolean;
5
6
  export declare const parseJwt: (access_token: string) => JwtTokenDecoded;
6
7
  export declare const sleep: (ms: number) => Promise<void>;
8
+ export declare const isEqual: (first: any, second: any, ignoreOrder?: boolean) => boolean;
9
+ export declare const mergeWith: <TObject, TSource>(object: TObject, source: TSource, customizer: Customizer<TObject, TSource>, stack?: any[]) => TObject & TSource;
10
+ export declare const orderBy: (array: any[], keys: string[], orders: ("asc" | "desc")[]) => any[];
11
+ export declare const structuredClone: <T>(obj: T) => T;
@@ -1,4 +1,7 @@
1
1
  export type * from '../../server/src/api/database/types.js';
2
+ export * from '../../server/src/api/schemas/cameras.schema.js';
3
+ export * from '../../server/src/api/schemas/plugins.schema.js';
4
+ export * from '../../server/src/api/schemas/users.schema.js';
2
5
  export type * from '../../server/src/api/types/index.js';
3
6
  export type * from '../../server/src/api/websocket/types.js';
4
7
  export * from '../../server/src/camera/polygon.js';
@@ -7,6 +10,8 @@ export type * from '../../server/src/decoder/types.js';
7
10
  export * from '../../server/src/go2rtc/types.js';
8
11
  export type * from '../../server/src/nats/types.js';
9
12
  export * from '../../server/src/plugins/types.js';
13
+ export * from '../../server/src/polyglot/node/plugins/schema.js';
10
14
  export * from '../../server/src/services/config/types.js';
15
+ export type * from '../../server/src/types.js';
11
16
  export { names as cocoLabels } from '../../server/src/utils/cocoLabels.json';
12
17
  export * from '../../server/src/utils/subscribed.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camera.ui/browser",
3
- "version": "0.0.77",
3
+ "version": "0.0.80",
4
4
  "description": "camera.ui browser client",
5
5
  "author": "seydx (https://github.com/seydx/camera.ui)",
6
6
  "module": "./dist/bundle.js",
@@ -24,31 +24,27 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "axios": "^1.7.2",
27
- "lodash.clonedeep": "^4.5.0",
28
- "lodash.isequal": "^4.5.0",
29
- "lru-cache": "^10.2.2",
27
+ "lru-cache": "^11.0.0",
30
28
  "rxjs": "^7.8.1",
31
29
  "socket.io-client": "^4.7.5"
32
30
  },
33
31
  "devDependencies": {
34
32
  "@rushstack/eslint-patch": "^1.10.3",
35
33
  "@swc/register": "^0.1.10",
36
- "@types/lodash.clonedeep": "^4.5.9",
37
- "@types/lodash.isequal": "^4.5.8",
38
34
  "@types/webrtc": "^0.0.43",
39
- "@typescript-eslint/eslint-plugin": "^7.12.0",
40
- "@typescript-eslint/parser": "^7.12.0",
35
+ "@typescript-eslint/eslint-plugin": "^7.16.1",
36
+ "@typescript-eslint/parser": "^7.16.1",
41
37
  "bufferutil": "^4.0.8",
42
38
  "eslint": "^8.57.0",
43
39
  "eslint-config-prettier": "^9.1.0",
44
- "eslint-plugin-prettier": "^5.1.3",
45
- "prettier": "^3.3.0",
46
- "rimraf": "^5.0.7",
40
+ "eslint-plugin-prettier": "^5.2.1",
41
+ "prettier": "^3.3.3",
42
+ "rimraf": "^6.0.1",
47
43
  "ts-loader": "^9.5.1",
48
- "typescript": "^5.4.5",
49
- "updates": "^16.2.0",
44
+ "typescript": "^5.5.3",
45
+ "updates": "^16.2.1",
50
46
  "utf-8-validate": "^6.0.4",
51
- "webpack": "^5.91.0",
47
+ "webpack": "^5.93.0",
52
48
  "webpack-cli": "^5.1.4"
53
49
  },
54
50
  "bugs": {
@@ -1,24 +0,0 @@
1
- import { ReplaySubject, Subject } from 'rxjs';
2
- import { Subscribed } from '../../../../../shared/types/index.js';
3
- import type { BaseLogger, IceServer } from '../../../../../shared/types/index.js';
4
- import type { BasicBrowserPeerConnection, CameraDevice } from '../types.js';
5
- export declare class BasicPeerConnection extends Subscribed implements BasicBrowserPeerConnection {
6
- onIceCandidate: Subject<RTCIceCandidate>;
7
- onConnectionState: ReplaySubject<RTCPeerConnectionState>;
8
- videoTransceiver: RTCRtpTransceiver;
9
- audioTransceiver: RTCRtpTransceiver;
10
- private cameraDevice;
11
- private logger;
12
- private pc;
13
- private videoElement;
14
- constructor(cameraDevice: CameraDevice, videoElement: HTMLVideoElement, iceServers: IceServer[], logger: BaseLogger);
15
- enableMicrophone(track: MediaStreamTrack): void;
16
- disableMicrophone(): void;
17
- createOffer(): Promise<RTCSessionDescriptionInit>;
18
- acceptAnswer(answer: {
19
- type: 'answer';
20
- sdp: string;
21
- }): Promise<void>;
22
- addIceCandidate(candidate: RTCIceCandidateInit): Promise<void>;
23
- close(): void;
24
- }
@@ -1,25 +0,0 @@
1
- import { ReplaySubject } from 'rxjs';
2
- import { Subscribed } from '../../../../../shared/types/index.js';
3
- import type { Observable } from 'rxjs';
4
- import type { BaseLogger } from '../../../../../shared/types/index.js';
5
- import type { CameraDevice } from '../types.js';
6
- import type { WebrtcConnection } from './webrtc-connection.js';
7
- export declare class StreamingSession extends Subscribed {
8
- readonly onCallAnswered: ReplaySubject<void>;
9
- readonly onCallEnded: ReplaySubject<void>;
10
- private onUsingOpus;
11
- private micState;
12
- private hasEnded;
13
- private cameraDevice;
14
- private connection;
15
- private logger;
16
- onMicrophoneEnabled: Observable<boolean>;
17
- get isUsingOpus(): Promise<boolean>;
18
- constructor(cameraDevice: CameraDevice, logger: BaseLogger, connection: WebrtcConnection);
19
- enableMicrophone(track: MediaStreamTrack): void;
20
- disableMicrophone(): void;
21
- stop(): void;
22
- private createStateObservable;
23
- private bindToConnection;
24
- private callEnded;
25
- }
@@ -1,26 +0,0 @@
1
- import { ReplaySubject, type Observable } from 'rxjs';
2
- import { Subscribed } from '../../../../../shared/types/index.js';
3
- import { BasicPeerConnection } from './peer-connection.js';
4
- import type { BaseLogger, IceServer } from '../../../../../shared/types/index.js';
5
- import type { CameraDevice } from '../types.js';
6
- export declare class WebrtcConnection extends Subscribed {
7
- readonly onCallAnswered: ReplaySubject<string>;
8
- readonly onCallEnded: ReplaySubject<void>;
9
- readonly onError: ReplaySubject<void>;
10
- readonly onMessage: ReplaySubject<{
11
- method: string;
12
- }>;
13
- readonly onWsOpen: Observable<unknown>;
14
- readonly pc: BasicPeerConnection;
15
- private readonly ws;
16
- private readonly onOfferSent;
17
- private hasEnded;
18
- private cameraDevice;
19
- private logger;
20
- constructor(cameraDevice: CameraDevice, sourceName: string, videoElement: HTMLVideoElement, iceServers: IceServer[], logger: BaseLogger);
21
- stop(): void;
22
- private initiateCall;
23
- private handleMessage;
24
- private sendMessage;
25
- private callEnded;
26
- }
@@ -1,2 +0,0 @@
1
- declare const axiosInstance: import("axios").AxiosInstance;
2
- export default axiosInstance;