@camera.ui/browser 0.0.70 → 0.0.72

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 (42) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/types/packages/client/browser/src/proxy/cameraDevice.d.ts +12 -4
  3. package/dist/types/packages/client/browser/src/proxy/deviceManager.d.ts +9 -6
  4. package/dist/types/packages/client/browser/src/proxy/pluginsManager.d.ts +4 -1
  5. package/dist/types/packages/client/browser/src/proxy/systemManager.d.ts +4 -1
  6. package/dist/types/packages/client/browser/src/socket.d.ts +6 -1
  7. package/dist/types/{server/src/camera/streaming/browser/browser-peer-connection.d.ts → packages/client/browser/src/streaming/peer-connection.d.ts} +4 -5
  8. package/dist/types/{server/src/camera/streaming/browser/browser-streaming-session.d.ts → packages/client/browser/src/streaming/streaming-session.d.ts} +6 -6
  9. package/dist/types/{server/src/camera/streaming/browser/webrtc-browser-connection.d.ts → packages/client/browser/src/streaming/webrtc-connection.d.ts} +6 -7
  10. package/dist/types/packages/client/browser/src/types.d.ts +26 -2
  11. package/dist/types/server/src/api.d.ts +5 -5
  12. package/dist/types/server/src/decoder/index.d.ts +4 -5
  13. package/dist/types/server/src/decoder/types.d.ts +39 -0
  14. package/dist/types/server/src/decoder/worker/index.d.ts +27 -3
  15. package/dist/types/server/src/{camera/base → devices/camera}/cameraDevice.d.ts +5 -5
  16. package/dist/types/server/src/{camera/controller.d.ts → devices/camera/controller/index.d.ts} +6 -6
  17. package/dist/types/server/src/{camera → devices/camera/controller}/types.d.ts +23 -23
  18. package/dist/types/server/src/{camera/base → devices/camera}/index.d.ts +17 -15
  19. package/dist/types/server/src/{camera → devices/camera}/streaming/peer-connection.d.ts +5 -5
  20. package/dist/types/server/src/{camera → devices/camera}/streaming/streaming-session.d.ts +3 -3
  21. package/dist/types/server/src/{camera → devices/camera}/streaming/webrtc-connection.d.ts +4 -4
  22. package/dist/types/server/src/go2rtc/index.d.ts +2 -2
  23. package/dist/types/server/src/nats/index.d.ts +2 -2
  24. package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +3 -3
  25. package/dist/types/server/src/nats/proxy/deviceManager.d.ts +1 -1
  26. package/dist/types/server/src/nats/types.d.ts +14 -24
  27. package/dist/types/server/src/nats/websocket.d.ts +3 -2
  28. package/dist/types/server/src/plugins/base.d.ts +2 -2
  29. package/dist/types/server/src/plugins/index.d.ts +2 -0
  30. package/dist/types/server/src/plugins/node/proxy/cameraDevice.d.ts +6 -5
  31. package/dist/types/server/src/plugins/node/proxy/deviceManager.d.ts +2 -2
  32. package/dist/types/server/src/plugins/node/proxy/queue.d.ts +1 -1
  33. package/dist/types/server/src/plugins/plugin.d.ts +1 -1
  34. package/dist/types/server/{bin/python.d.ts → src/utils/pythonInstaller.d.ts} +6 -2
  35. package/dist/types/shared/types/index.d.ts +2 -4
  36. package/package.json +3 -3
  37. package/dist/types/server/src/camera/base/cameraDeviceBrowser.d.ts +0 -6
  38. package/dist/types/server/src/decoder/worker/runtime/base/index.d.ts +0 -36
  39. package/dist/types/server/src/decoder/worker/runtime/child-process/index.d.ts +0 -17
  40. package/dist/types/server/src/decoder/worker/runtime/worker-thread/index.d.ts +0 -22
  41. /package/dist/types/server/src/{camera/utils → utils}/subscribed.d.ts +0 -0
  42. /package/dist/types/server/src/utils/{index.d.ts → utils.d.ts} +0 -0
@@ -1,8 +1,7 @@
1
1
  import type { Camera } from '../api/database/types.js';
2
- import type { CameraDevice } from '../camera/base/cameraDevice.js';
3
- import type { BrowserCameraDevice } from '../camera/base/cameraDeviceBrowser.js';
4
- import type { CameraConfig, FfmpegOptions, OnSetEvent, PrebufferType, StateValues, StreamInfo } from '../camera/types.js';
5
2
  import type { FrameMetadata, FrameSession } from '../decoder/types.js';
3
+ import type { CameraDevice } from '../devices/camera/cameraDevice.js';
4
+ import type { CameraConfig, FfmpegOptions, PrebufferType, SetValues, StateValues, StreamInfo } from '../devices/camera/controller/types.js';
6
5
  import type { BasePlugin } from '../plugins/base.js';
7
6
  import type { CameraStorage } from '../plugins/node/cameraStorage.js';
8
7
  import type { CameraExtension } from '../plugins/types.js';
@@ -42,9 +41,9 @@ export interface ProxyAuth {
42
41
  };
43
42
  }
44
43
  export interface MethodNamesByManager {
45
- systemManager: SystemManagerBrowserProxyMethodNames;
46
- deviceManager: DeviceManagerBrowserProxyMethodNames;
47
- pluginsManager: PluginsManagerBrowserProxyMethodNames;
44
+ systemManager: SystemManagerProxyMethodNames;
45
+ deviceManager: DeviceManagerProxyMethodNames;
46
+ pluginsManager: PluginsManagerProxyMethodNames;
48
47
  cameraDevice: CameraDeviceProxyMethodNames;
49
48
  }
50
49
  export type ManagerNames = keyof MethodNamesByManager;
@@ -144,9 +143,9 @@ export interface CameraDeviceProxyMethods {
144
143
  cameraId: string;
145
144
  pluginId: string;
146
145
  }): Promise<void>;
147
- updateState<T extends keyof StateValues>(data: {
146
+ updateState<T extends keyof SetValues>(data: {
148
147
  stateName: T;
149
- eventData: OnSetEvent<T>;
148
+ eventData: SetValues[T];
150
149
  cameraId: string;
151
150
  pluginId: string;
152
151
  }): void;
@@ -164,17 +163,14 @@ export interface DeviceManagerListenerMessagePayload {
164
163
  type: keyof DeviceManagerProxyEventCallbacks;
165
164
  data: any;
166
165
  }
167
- export interface DeviceManagerBrowserProxyMethods {
168
- getCameraByName(name: string): Promise<CameraDevice | BrowserCameraDevice | undefined>;
169
- getCameraById(id: string): Promise<CameraDevice | BrowserCameraDevice | undefined>;
170
- }
171
- export interface DeviceManagerProxyMethods extends DeviceManagerBrowserProxyMethods {
166
+ export interface DeviceManagerProxyMethods {
167
+ getCameraByName(name: string): Promise<CameraDevice | undefined>;
168
+ getCameraById(id: string): Promise<CameraDevice | undefined>;
172
169
  createCamera(camera: CameraConfig): Promise<CameraDevice>;
173
170
  removeCameraByName(name: string): Promise<void>;
174
171
  removeCameraById(id: string): Promise<void>;
175
172
  }
176
173
  export type DeviceManagerProxyMethodNames = MethodKeys<DeviceManagerProxyMethods>;
177
- export type DeviceManagerBrowserProxyMethodNames = MethodKeys<DeviceManagerBrowserProxyMethods>;
178
174
  export interface DeviceManagerProxyEvents {
179
175
  cameraSelected: {
180
176
  camera: Camera;
@@ -189,9 +185,9 @@ export interface DeviceManagerProxyEvents {
189
185
  };
190
186
  }
191
187
  export interface DeviceManagerProxyEventCallbacks {
192
- cameraSelected: ((camera: CameraDevice, extension: CameraExtension) => void) | ((camera: BrowserCameraDevice, extension: CameraExtension) => void);
188
+ cameraSelected: (camera: CameraDevice, extension: CameraExtension) => void;
193
189
  cameraDeselected: (cameraId: string, extension: CameraExtension) => void;
194
- cameraUpdated: ((cameraId: string, camera: CameraDevice) => void) | ((cameraId: string, camera: BrowserCameraDevice) => void);
190
+ cameraUpdated: (cameraId: string, camera: CameraDevice) => void;
195
191
  }
196
192
  export interface DeviceManagerProxyGenericEvent<K extends keyof DeviceManagerProxyEvents> {
197
193
  type: K;
@@ -201,12 +197,9 @@ export interface SystemManagerListenerMessagePayload {
201
197
  type: keyof SystemManagerProxyEventCallbacks;
202
198
  data: any;
203
199
  }
204
- export interface SystemManagerBrowserProxyMethods {
205
- }
206
- export interface SystemManagerProxyMethods extends SystemManagerBrowserProxyMethods {
200
+ export interface SystemManagerProxyMethods {
207
201
  }
208
202
  export type SystemManagerProxyMethodNames = MethodKeys<SystemManagerProxyMethods>;
209
- export type SystemManagerBrowserProxyMethodNames = MethodKeys<SystemManagerBrowserProxyMethods>;
210
203
  export interface SystemManagerProxyMethodsListener {
211
204
  listen<E extends keyof SystemManagerProxyEventCallbacks>(eventType: E, callback: SystemManagerProxyEventCallbacks[E]): void;
212
205
  removeListener<E extends keyof SystemManagerProxyEventCallbacks>(eventType: E, callbackToRemove: SystemManagerProxyEventCallbacks[E]): void;
@@ -223,12 +216,9 @@ export interface PluginsManagerListenerMessagePayload {
223
216
  type: keyof PluginsManagerProxyEventCallbacks;
224
217
  data: any;
225
218
  }
226
- export interface PluginsManagerBrowserProxyMethods {
227
- }
228
- export interface PluginsManagerProxyMethods extends PluginsManagerBrowserProxyMethods {
219
+ export interface PluginsManagerProxyMethods {
229
220
  }
230
221
  export type PluginsManagerProxyMethodNames = MethodKeys<PluginsManagerProxyMethods>;
231
- export type PluginsManagerBrowserProxyMethodNames = MethodKeys<PluginsManagerBrowserProxyMethods>;
232
222
  export interface PluginsManagerProxyMethodsListener {
233
223
  listen<E extends keyof PluginsManagerProxyEventCallbacks>(eventType: E, callback: PluginsManagerProxyEventCallbacks[E]): void;
234
224
  removeListener<E extends keyof PluginsManagerProxyEventCallbacks>(eventType: E, callbackToRemove: PluginsManagerProxyEventCallbacks[E]): void;
@@ -1,11 +1,12 @@
1
1
  import type { Namespace, Server } from 'socket.io';
2
2
  import type { SocketNsp } from '../api/websocket/types.js';
3
- import { StateValues } from '../camera/types.js';
3
+ import type { StateValues } from '../devices/camera/controller/types.js';
4
4
  import type { CameraDeviceListenerMessagePayload } from './types.js';
5
5
  export declare class WebsocketProxy {
6
6
  nsp: Namespace;
7
7
  nspName: SocketNsp;
8
8
  private proxy;
9
+ private camerasService;
9
10
  constructor(io: Server);
10
11
  init(): void;
11
12
  publishCameraEvent<K extends keyof StateValues>(cameraId: string, stateName: K, data: {
@@ -17,6 +18,6 @@ export declare class WebsocketProxy {
17
18
  private isSystemManagerMethod;
18
19
  private isDeviceManagerMethod;
19
20
  private isPluginsManagerMethod;
20
- private isCameraManagerMethod;
21
+ private isCameraProxyMethod;
21
22
  private isCameraState;
22
23
  }
@@ -1,7 +1,7 @@
1
- import type { CameraDevice } from '../camera/base/cameraDevice.js';
1
+ import type { CameraDevice } from '../devices/camera/cameraDevice.js';
2
2
  export declare abstract class BasePlugin {
3
3
  abstract onFormSubmit(actionId: string, payload: any): Promise<{
4
4
  toast?: string;
5
5
  }>;
6
- abstract configureCameras(cameras: CameraDevice[]): Promise<void>;
6
+ abstract configureCameras(cameras: CameraDevice[]): void;
7
7
  }
@@ -6,6 +6,7 @@ export declare class PluginManager {
6
6
  private logger;
7
7
  private api;
8
8
  private configService;
9
+ private pythonVersionsToInstall;
9
10
  plugins: Map<string, Plugin>;
10
11
  pluginWorkers: Map<string, PluginWorker>;
11
12
  searchPaths: Set<string>;
@@ -22,6 +23,7 @@ export declare class PluginManager {
22
23
  startPluginChild(pluginName: string): Promise<void>;
23
24
  stopPluginChild(pluginName: string): Promise<void>;
24
25
  initializePlugins(): Promise<void>;
26
+ installRequiredPythonEnvs(): Promise<void>;
25
27
  private loadInstalledPlugins;
26
28
  private removeOrphanedPlugins;
27
29
  private loadDefaultPaths;
@@ -1,7 +1,7 @@
1
- import { CameraDevice } from '../../../camera/base/cameraDevice.js';
1
+ import { CameraDevice } from '../../../devices/camera/cameraDevice.js';
2
2
  import type { Camera } from '../../../api/database/types.js';
3
- import type { CameraSource, OnSetEvent, StateValues } from '../../../camera/types.js';
4
- import type { Frame } from '../../../decoder/types.js';
3
+ import type { VideoFrame } from '../../../decoder/types.js';
4
+ import type { CameraSource, SetValues } from '../../../devices/camera/controller/types.js';
5
5
  import type { IceServer } from '../../../services/config/types.js';
6
6
  import type { PluginAPI } from '../api.js';
7
7
  import type { PluginLogger } from '../logger.js';
@@ -31,13 +31,14 @@ export declare class CameraDeviceProxy extends CameraDevice {
31
31
  connect(): Promise<void>;
32
32
  disconnect(): Promise<void>;
33
33
  reboot(): Promise<void>;
34
- generateFrames(): AsyncIterableIterator<Frame>;
34
+ generateFrames(): AsyncIterableIterator<VideoFrame>;
35
35
  getFfmpegPath(): Promise<string>;
36
36
  getIceServers(): Promise<IceServer[]>;
37
- updateState<T extends keyof StateValues>(stateName: T, eventData: OnSetEvent<T>): Promise<void>;
37
+ updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T]): Promise<void>;
38
38
  refreshStates(): Promise<void>;
39
39
  cleanup(): Promise<void>;
40
40
  private connectToServer;
41
+ private closeFrameSubscriber;
41
42
  private requestHandler;
42
43
  private listenToMessages;
43
44
  private onRequest;
@@ -1,8 +1,8 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  import { EventEmitter } from 'node:events';
3
3
  import { CameraDeviceProxy } from './cameraDevice.js';
4
- import type { CameraDevice } from '../../../camera/base/cameraDevice.js';
5
- import type { CameraConfig } from '../../../camera/types.js';
4
+ import type { CameraDevice } from '../../../devices/camera/cameraDevice.js';
5
+ import type { CameraConfig } from '../../../devices/camera/controller/types.js';
6
6
  import type { DeviceManagerProxyEventCallbacks, DeviceManagerProxyMethods } from '../../../nats/types.js';
7
7
  import type { PluginAPI } from '../api.js';
8
8
  import type { PluginLogger } from '../logger.js';
@@ -1,5 +1,5 @@
1
1
  import { type NatsConnection, type Subscription } from 'nats';
2
- import type { BaseLogger } from '../../../camera/types.js';
2
+ import type { BaseLogger } from '../../../devices/camera/controller/types.js';
3
3
  import type { ProxyMessageStructure } from '../../../nats/types.js';
4
4
  export declare class ClientMessageQueue {
5
5
  private logger;
@@ -1,4 +1,4 @@
1
- import { PythonInstaller } from '../../bin/python.js';
1
+ import { PythonInstaller } from '../utils/pythonInstaller.js';
2
2
  import { PluginConfigService } from './node/config.js';
3
3
  import type { PluginConstructor } from '../api.js';
4
4
  import type { CameraUiPlugin, IPackageJson } from '../api/types/index.js';
@@ -5,10 +5,10 @@ export declare class PythonInstaller {
5
5
  readonly python: PortablePython;
6
6
  readonly venvPath?: string;
7
7
  readonly installPath: string;
8
- private _version;
9
8
  private identifier;
10
9
  private logger;
11
10
  private configService;
11
+ private needsUpdate;
12
12
  get isInstalled(): boolean;
13
13
  get pluginPythonPath(): string;
14
14
  get serverPythonPath(): string;
@@ -24,6 +24,8 @@ export declare class PythonInstaller {
24
24
  updateServerDependencies(): Promise<void>;
25
25
  installPluginPackages(pkgs: string[]): Promise<string>;
26
26
  installServerPackages(pkgs: string[]): Promise<string>;
27
+ reinstallPluginPackes(pkgs: string[]): Promise<string>;
28
+ reinstallServerPackages(pkgs: string[]): Promise<string>;
27
29
  uninstallPluginPackages(pkgs: string[]): Promise<string>;
28
30
  uninstallServerPackages(pkgs: string[]): Promise<string>;
29
31
  private installPluginRequirements;
@@ -34,10 +36,12 @@ export declare class PythonInstaller {
34
36
  private installRequirements;
35
37
  private installPackages;
36
38
  private uninstallPackages;
37
- private getInstalledPackages;
39
+ private reinstallPackages;
38
40
  private ensureVenv;
39
41
  private createVenv;
40
42
  private removeVenv;
43
+ private removeOldVersions;
44
+ private getMajorMinorVersion;
41
45
  private cleanPackageName;
42
46
  private difference;
43
47
  }
@@ -1,12 +1,10 @@
1
1
  export type * from '../../server/src/api/database/types.js';
2
2
  export type * from '../../server/src/api/types/index.js';
3
3
  export type * from '../../server/src/api/websocket/types.js';
4
- export * from '../../server/src/camera/base/cameraDeviceBrowser.js';
5
- export * from '../../server/src/camera/streaming/browser/browser-streaming-session.js';
6
- export * from '../../server/src/camera/streaming/browser/webrtc-browser-connection.js';
7
- export type * from '../../server/src/camera/types.js';
8
4
  export type * from '../../server/src/decoder/types.js';
5
+ export type * from '../../server/src/devices/camera/controller/types.js';
9
6
  export * from '../../server/src/go2rtc/types.js';
10
7
  export type * from '../../server/src/nats/types.js';
11
8
  export * from '../../server/src/plugins/types.js';
12
9
  export * from '../../server/src/services/config/types.js';
10
+ 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.70",
3
+ "version": "0.0.72",
4
4
  "description": "camera.ui browser client",
5
5
  "author": "seydx (https://github.com/seydx/camera.ui)",
6
6
  "module": "./dist/bundle.js",
@@ -31,7 +31,7 @@
31
31
  "socket.io-client": "^4.7.5"
32
32
  },
33
33
  "devDependencies": {
34
- "@rushstack/eslint-patch": "^1.10.2",
34
+ "@rushstack/eslint-patch": "^1.10.3",
35
35
  "@swc/register": "^0.1.10",
36
36
  "@types/webrtc": "^0.0.43",
37
37
  "@typescript-eslint/eslint-plugin": "^7.9.0",
@@ -44,7 +44,7 @@
44
44
  "rimraf": "^5.0.7",
45
45
  "ts-loader": "^9.5.1",
46
46
  "typescript": "^5.4.5",
47
- "updates": "^16.0.1",
47
+ "updates": "^16.1.1",
48
48
  "utf-8-validate": "^6.0.4",
49
49
  "webpack": "^5.91.0",
50
50
  "webpack-cli": "^5.1.4"
@@ -1,6 +0,0 @@
1
- import { BrowserStreamingSession } from '../streaming/browser/browser-streaming-session.js';
2
- import { BaseCameraDevice } from './index.js';
3
- export declare abstract class BrowserCameraDevice extends BaseCameraDevice {
4
- snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
5
- createSession(sourceName: string, videoElement: HTMLVideoElement): Promise<BrowserStreamingSession>;
6
- }
@@ -1,36 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
- import { Subscribed } from '../../../../camera/utils/subscribed.js';
4
- import type { ChildProcess } from 'node:child_process';
5
- import type { Worker } from 'node:worker_threads';
6
- import type { CameraController } from '../../../../camera/controller.js';
7
- import type { ConfigService } from '../../../../services/config/index.js';
8
- import type { Logger } from '../../../../services/logger/index.js';
9
- import type { FrameMetadata, MainMessage, MainToWorkerMessage, MainToWorkerResponse, WorkerToMainMessage } from '../../../types.js';
10
- export declare abstract class StreamManager<T extends Worker | ChildProcess = any> extends Subscribed {
11
- token: string;
12
- protected readonly logger: Logger;
13
- protected readonly configService: ConfigService;
14
- protected readonly camera: CameraController;
15
- protected frameWorker?: T;
16
- protected stopped: boolean;
17
- protected auth: {
18
- user: string;
19
- pass: string;
20
- };
21
- constructor(camera: CameraController, auth: {
22
- user: string;
23
- pass: string;
24
- });
25
- abstract listen(): Promise<void>;
26
- abstract close(): Promise<void>;
27
- abstract workerPID(): number;
28
- getMetadata(): Promise<FrameMetadata>;
29
- startVideoSession(): Promise<void>;
30
- stopVideoSession(): Promise<void>;
31
- protected onMessage(workerMessage: WorkerToMainMessage): Promise<void>;
32
- protected abstract sendMessage(message: MainMessage, skipResponse?: boolean, data?: Record<string, any>): Promise<any>;
33
- protected abstract sendReponse(response: MainToWorkerResponse): void;
34
- protected abstract send(message: MainToWorkerMessage | MainToWorkerResponse): void;
35
- protected getLogPrefix(): string;
36
- }
@@ -1,17 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- import { ChildProcess } from 'node:child_process';
3
- import { StreamManager } from '../base/index.js';
4
- import type { CameraController } from '../../../../camera/controller.js';
5
- import type { MainMessage, MainToWorkerMessage, MainToWorkerResponse } from '../../../types.js';
6
- export declare class StreamProcess extends StreamManager<ChildProcess> {
7
- constructor(camera: CameraController, auth: {
8
- user: string;
9
- pass: string;
10
- });
11
- listen(): Promise<void>;
12
- close(): Promise<void>;
13
- workerPID(): number;
14
- protected sendMessage(message: MainMessage, skipResponse?: boolean, data?: Record<string, any>): Promise<any>;
15
- protected sendReponse(response: MainToWorkerResponse): void;
16
- protected send(message: MainToWorkerMessage | MainToWorkerResponse): void;
17
- }
@@ -1,22 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- import { Worker } from 'node:worker_threads';
3
- import { StreamManager } from '../base/index.js';
4
- import type { CameraController } from '../../../../camera/controller.js';
5
- import type { MainMessage, MainToWorkerMessage, MainToWorkerResponse } from '../../../types.js';
6
- export declare class StreamWorker extends StreamManager<Worker> {
7
- private channel1;
8
- private channel2;
9
- private messageFromMain;
10
- private messageToMain;
11
- private responseToMain;
12
- constructor(camera: CameraController, auth: {
13
- user: string;
14
- pass: string;
15
- });
16
- listen(): Promise<void>;
17
- close(): Promise<void>;
18
- workerPID(): number;
19
- protected sendMessage(message: MainMessage, skipResponse?: boolean, data?: Record<string, any>): Promise<any>;
20
- protected sendReponse(response: MainToWorkerResponse): void;
21
- protected send(message: MainToWorkerMessage | MainToWorkerResponse): void;
22
- }