@camera.ui/browser 0.0.101 → 0.0.103

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 (40) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/types/packages/client/browser/src/types.d.ts +1 -0
  3. package/dist/types/packages/plugineer/src/polyglot/node/camera/index.d.ts +2 -1
  4. package/dist/types/packages/plugineer/src/polyglot/node/camera/polygon.d.ts +1 -2
  5. package/dist/types/packages/plugineer/src/polyglot/node/plugins/types.d.ts +4 -0
  6. package/dist/types/packages/types/src/index.d.ts +5 -1
  7. package/dist/types/server/src/api/database/checks.d.ts +55 -0
  8. package/dist/types/server/src/api/database/index.d.ts +2 -1
  9. package/dist/types/server/src/api/database/migration.d.ts +1 -0
  10. package/dist/types/server/src/api/database/selfcheck.d.ts +48 -0
  11. package/dist/types/server/src/api/schemas/cameras.schema.d.ts +37 -37
  12. package/dist/types/server/src/api/schemas/users.schema.d.ts +48 -48
  13. package/dist/types/server/src/api/services/cameras.service.d.ts +1 -0
  14. package/dist/types/server/src/api/services/plugins.service.d.ts +1 -0
  15. package/dist/types/server/src/api/types/index.d.ts +2 -6
  16. package/dist/types/server/src/api/websocket/nsp/logs.d.ts +7 -1
  17. package/dist/types/server/src/api/websocket/nsp/metrics.d.ts +1 -1
  18. package/dist/types/server/src/api/websocket/nsp/status.d.ts +1 -1
  19. package/dist/types/server/src/api.d.ts +5 -14
  20. package/dist/types/server/src/camera/controller.d.ts +16 -3
  21. package/dist/types/server/src/{decoder/worker.d.ts → camera/frameWorker.d.ts} +9 -6
  22. package/dist/types/server/src/nats/index.d.ts +3 -2
  23. package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +2 -1
  24. package/dist/types/server/src/nats/proxy/coreManager.d.ts +1 -1
  25. package/dist/types/server/src/nats/proxy/deviceManager.d.ts +1 -1
  26. package/dist/types/server/src/nats/types.d.ts +1 -1
  27. package/dist/types/server/src/nats/utils.d.ts +1 -1
  28. package/dist/types/server/src/plugins/index.d.ts +2 -4
  29. package/dist/types/server/src/plugins/plugin.d.ts +5 -0
  30. package/dist/types/server/src/plugins/worker.d.ts +20 -2
  31. package/dist/types/server/src/services/config/constants.d.ts +1 -0
  32. package/dist/types/server/src/services/config/index.d.ts +11 -2
  33. package/dist/types/server/src/services/config/types.d.ts +7 -0
  34. package/dist/types/shared/types/index.d.ts +1 -2
  35. package/package.json +3 -3
  36. package/dist/types/server/src/decoder/index.d.ts +0 -11
  37. package/dist/types/server/src/decoder/types.d.ts +0 -7
  38. /package/dist/types/packages/{plugineer/src/utils → common/src/nats}/messageQueue.d.ts +0 -0
  39. /package/dist/types/packages/{plugineer/src/utils → common/src/nats}/nats.d.ts +0 -0
  40. /package/dist/types/packages/{plugineer/src/utils → common/src/nats}/packer.d.ts +0 -0
@@ -1,7 +1,7 @@
1
1
  import { Subscribed } from '@camera.ui/common';
2
2
  import { PLUGIN_STATUS } from '@camera.ui/plugineer';
3
- import type { AuthConfig } from '@camera.ui/plugineer';
4
- import type { CameraController } from '../camera/controller.js';
3
+ import type { AuthConfig } from '@camera.ui/common';
4
+ import type { CameraController } from './controller.js';
5
5
  export declare class FrameWorker extends Subscribed {
6
6
  readonly frameWorkerId: string;
7
7
  name: string;
@@ -11,10 +11,11 @@ export declare class FrameWorker extends Subscribed {
11
11
  private publisher?;
12
12
  private subscriber?;
13
13
  private coreManager;
14
- private logger;
14
+ private frameWorkerLogger;
15
+ private processLogger;
15
16
  private configService;
16
17
  private socketService;
17
- private cameraDevice;
18
+ private cameraController;
18
19
  private frameWorker?;
19
20
  private initialized;
20
21
  private stopped;
@@ -25,16 +26,18 @@ export declare class FrameWorker extends Subscribed {
25
26
  private py;
26
27
  private _status;
27
28
  get status(): PLUGIN_STATUS;
28
- constructor(cameraDevice: CameraController, proxyEndpoints: string[], auth: AuthConfig);
29
+ constructor(cameraController: CameraController, proxyEndpoints: string[], auth: AuthConfig);
29
30
  start(): Promise<void>;
30
31
  close(): Promise<void>;
31
32
  restart(): Promise<void>;
32
33
  getPID(): number;
33
34
  private startWorker;
34
35
  private restartWorker;
36
+ private reset;
35
37
  private killWorker;
36
38
  private sendMessage;
37
39
  private onChildMessage;
38
40
  private setStatus;
39
- private getLogPrefix;
41
+ private internalLog;
42
+ private createPythonPath;
40
43
  }
@@ -1,9 +1,10 @@
1
- import { ProxyConnection } from '@camera.ui/plugineer';
1
+ import { ProxyConnection } from '@camera.ui/common';
2
2
  import { CameraDeviceProxy } from './proxy/cameraDevice.js';
3
3
  import { CoreManagerProxy } from './proxy/coreManager.js';
4
4
  import { DeviceManagerProxy } from './proxy/deviceManager.js';
5
5
  import { NatsServer } from './server.js';
6
- import type { CameraDeviceListenerMessagePayload, CoreManagerProxyEvents, DeviceManagerProxyEvents, ProxySubscription } from '@camera.ui/plugineer';
6
+ import type { ProxySubscription } from '@camera.ui/common';
7
+ import type { CameraDeviceListenerMessagePayload, CoreManagerProxyEvents, DeviceManagerProxyEvents } from '@camera.ui/plugineer';
7
8
  import type { CameraStorage, StateValues } from '@camera.ui/types';
8
9
  import type { MethodKeys, MethodType } from '../types.js';
9
10
  import type { PluginMap, ProxyAuth } from './types.js';
@@ -1,4 +1,5 @@
1
- import type { CameraDeviceProxyMethods, CameraInterfaces, MessageQueue, ProxyMessageStructure, RefreshedStates } from '@camera.ui/plugineer';
1
+ import type { MessageQueue, ProxyMessageStructure } from '@camera.ui/common';
2
+ import type { CameraDeviceProxyMethods, CameraInterfaces, RefreshedStates } from '@camera.ui/plugineer';
2
3
  import type { CameraConfigInputSettings, ProbeStream, SetValues } from '@camera.ui/types';
3
4
  import type { MethodKeys, MethodType } from '../../types.js';
4
5
  export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
@@ -1,4 +1,4 @@
1
- import type { MessageQueue, ProxyMessageStructure } from '@camera.ui/plugineer';
1
+ import type { MessageQueue, ProxyMessageStructure } from '@camera.ui/common';
2
2
  import type { CoreManager, FfmpegArgs, IceServer } from '@camera.ui/types';
3
3
  export declare class CoreManagerProxy implements CoreManager {
4
4
  private configService;
@@ -1,4 +1,4 @@
1
- import type { MessageQueue, ProxyMessageStructure } from '@camera.ui/plugineer';
1
+ import type { MessageQueue, ProxyMessageStructure } from '@camera.ui/common';
2
2
  import type { Camera, CameraConfig, DeviceManager } from '@camera.ui/types';
3
3
  export declare class DeviceManagerProxy implements DeviceManager {
4
4
  private camerasService;
@@ -1,4 +1,4 @@
1
- import type { AuthConfig } from '@camera.ui/plugineer';
1
+ import type { AuthConfig } from '@camera.ui/common';
2
2
  import type { AudioDetectionPlugin, BasePlugin, MotionDetectionPlugin, ObjectDetectionPlugin } from '@camera.ui/types';
3
3
  import type { VideoStreamingMode } from '../api/database/types.js';
4
4
  export interface ProxyAuth {
@@ -1,2 +1,2 @@
1
- import type { AuthConfig } from '@camera.ui/plugineer';
1
+ import type { AuthConfig } from '@camera.ui/common';
2
2
  export declare function generateCredentials(): AuthConfig;
@@ -1,16 +1,14 @@
1
1
  import 'reflect-metadata';
2
2
  import { Plugin } from './plugin.js';
3
- import { PluginWorker } from './worker.js';
4
3
  import type { IPackageJson } from '../api/types/index.js';
5
4
  export declare class PluginManager {
6
5
  private logger;
7
6
  private api;
8
7
  private configService;
9
- private pythonVersionsToInstall;
10
8
  installedPythonVersions: Set<string>;
11
- plugins: Map<string, Plugin>;
12
- pluginWorkers: Map<string, PluginWorker>;
13
9
  searchPaths: Set<string>;
10
+ plugins: Map<string, Plugin>;
11
+ pluginIdentifiers: Set<string>;
14
12
  constructor();
15
13
  static isQualifiedPluginIdentifier(pluginName: string): boolean;
16
14
  static extractPluginScope(pluginName: string): string | undefined;
@@ -1,5 +1,7 @@
1
1
  import { PythonInstaller } from '@camera.ui/plugineer';
2
+ import { PluginWorker } from './worker.js';
2
3
  import type { PluginContract } from '@camera.ui/plugineer';
4
+ import type { CameraExtension } from '@camera.ui/types';
3
5
  import type { CameraUiPlugin, IPackageJson } from '../api/types/index.js';
4
6
  export declare class Plugin {
5
7
  private logger;
@@ -19,11 +21,14 @@ export declare class Plugin {
19
21
  readonly configFile: string;
20
22
  readonly storagePath: string;
21
23
  readonly py: PythonInstaller;
24
+ readonly logPath: string;
25
+ readonly worker: PluginWorker;
22
26
  get contract(): PluginContract;
23
27
  get info(): CameraUiPlugin;
24
28
  set info(value: CameraUiPlugin);
25
29
  get disabled(): boolean;
26
30
  set disabled(value: boolean);
31
+ get type(): CameraExtension[];
27
32
  constructor(pluginName: string, installPath: string, packageJSON: IPackageJson, pluginId: string, scope?: string);
28
33
  load(): Promise<void>;
29
34
  reparsePackageJson(): void;
@@ -4,8 +4,11 @@ export declare class PluginWorker {
4
4
  plugin: Plugin;
5
5
  private pluginWorker?;
6
6
  private proxyServer;
7
+ private logStream?;
7
8
  private api;
8
- private logger;
9
+ private mainLogger;
10
+ private pluginLogger;
11
+ private processLogger;
9
12
  private configService;
10
13
  private socketService;
11
14
  private pluginManager;
@@ -15,16 +18,22 @@ export declare class PluginWorker {
15
18
  private targetSubject;
16
19
  private started;
17
20
  private shuttingDown;
21
+ private truncateInterval?;
22
+ private truncateIntervalMs;
23
+ private logBuffer;
18
24
  private _status;
19
25
  get status(): PLUGIN_STATUS;
20
26
  constructor(plugin: Plugin);
21
27
  start(): Promise<void>;
22
28
  teardown(): Promise<void>;
23
- destroy(): void;
29
+ destroy(): Promise<void>;
24
30
  restart(): Promise<void>;
31
+ disable(): void;
25
32
  getPID(): number;
26
33
  isRunning(): boolean;
27
34
  isReady(): boolean;
35
+ cleanup(): Promise<void>;
36
+ writeLog(...args: any[]): void;
28
37
  private gatherDevices;
29
38
  private kill;
30
39
  private setStatus;
@@ -33,5 +42,14 @@ export declare class PluginWorker {
33
42
  private reset;
34
43
  private updatePython;
35
44
  private onChildMessage;
45
+ private createPythonPath;
46
+ private handleLogData;
47
+ private processLogEntry;
48
+ private writeProcessLog;
49
+ private internalLog;
50
+ private createLogStream;
51
+ private closeLogStream;
52
+ private removeLogStream;
53
+ private truncateLog;
36
54
  private cleanedProcessEnv;
37
55
  }
@@ -1,5 +1,6 @@
1
1
  import type { IceServer } from '@camera.ui/types';
2
2
  import type { Go2RtcConfig, IConfig } from './types.js';
3
+ export declare const PROCESS_IDENTIFIER = "--id=camera.ui";
3
4
  export declare const APP_NAME: any;
4
5
  export declare const DEFAULT_ICE_SERVERS: IceServer[];
5
6
  export declare const DEFAULT_CONFIG: IConfig;
@@ -1,9 +1,11 @@
1
1
  import 'reflect-metadata';
2
2
  import type { LoggerOptions } from '@camera.ui/common/logger';
3
+ import type { ProcInfo } from '../../api/database/checks.js';
3
4
  import type { DeepPartial } from '../../types.js';
4
- import type { Go2RtcConfig, IConfig, Secrets } from './types.js';
5
+ import type { EnvironmentInfo, Go2RtcConfig, IConfig, Secrets } from './types.js';
5
6
  export declare class ConfigService {
6
7
  static get VERSION(): string;
8
+ static get ENVIRONMENT(): EnvironmentInfo;
7
9
  static readonly NODE_VERSION: string;
8
10
  static readonly MIN_NODE_VERSION: string;
9
11
  static readonly INSTALL_PATH: string | null;
@@ -15,12 +17,15 @@ export declare class ConfigService {
15
17
  readonly SECRETS: Secrets;
16
18
  readonly HOME_PATH: string;
17
19
  readonly STORAGE_PATH: string;
20
+ readonly LOGS_PATH: string;
21
+ readonly PIDS_FILE: string;
18
22
  readonly DATABASE_PATH: string;
19
23
  readonly TOKENS_PATH: string;
20
24
  readonly USERS_STORAGE_PATH: string;
21
- readonly TMP_DIR: string;
25
+ readonly TMP_PATH: string;
22
26
  readonly PLUGINS_STORAGE_PATH: string;
23
27
  readonly PLUGINS_INSTALL_PATH: string;
28
+ readonly REPORTS_FILE: string;
24
29
  readonly LOG_FILE: string;
25
30
  readonly CONFIG_FILE: string;
26
31
  readonly SECRETS_FILE: string;
@@ -42,6 +47,10 @@ export declare class ConfigService {
42
47
  writeGo2RtcConfigApi(newConfig?: DeepPartial<Go2RtcConfig>): Promise<void>;
43
48
  mergeGo2RtcConfig(): Promise<void>;
44
49
  updateGo2RtcWebRtcFilter(serverAddresses: string[], oldAddresses?: string[], api?: boolean): Promise<void>;
50
+ addProc(proc: ProcInfo): void;
51
+ removeProcByPID(pid?: number): void;
52
+ getProcs(): ProcInfo[];
53
+ setProcs(pids: ProcInfo[]): void;
45
54
  private defaultConfig;
46
55
  private defaultGo2RtcConfig;
47
56
  private readConfig;
@@ -1,4 +1,11 @@
1
1
  import type { IceServer } from '@camera.ui/types';
2
+ export interface EnvironmentInfo {
3
+ development: boolean;
4
+ docker: boolean;
5
+ electron: boolean;
6
+ homeassistant: boolean;
7
+ serviceMode: boolean;
8
+ }
2
9
  export interface Secrets {
3
10
  jwtAccessKey: string;
4
11
  jwtRefreshKey: string;
@@ -1,8 +1,8 @@
1
+ export type * from '../../packages/common/src/nats/messageQueue.js';
1
2
  export { Subscribed as SubscribedImp } from '../../packages/common/src/utils/subscribed.js';
2
3
  export * from '../../packages/plugineer/src/polyglot/node/camera/polygon.js';
3
4
  export * from '../../packages/plugineer/src/polyglot/node/plugins/schema.js';
4
5
  export * from '../../packages/plugineer/src/polyglot/node/plugins/types.js';
5
- export type * from '../../packages/plugineer/src/utils/messageQueue.js';
6
6
  export * from '../../packages/types/src/index.js';
7
7
  export type * from '../../server/src/api/database/types.js';
8
8
  export type * from '../../server/src/api/go2rtc/types.js';
@@ -13,7 +13,6 @@ export * from '../../server/src/api/schemas/users.schema.js';
13
13
  export type * from '../../server/src/api/types/index.js';
14
14
  export type * from '../../server/src/api/websocket/types.js';
15
15
  export type * from '../../server/src/camera/types.js';
16
- export type * from '../../server/src/decoder/types.js';
17
16
  export * from '../../server/src/go2rtc/types.js';
18
17
  export type * from '../../server/src/nats/types.js';
19
18
  export * from '../../server/src/plugins/types.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camera.ui/browser",
3
- "version": "0.0.101",
3
+ "version": "0.0.103",
4
4
  "description": "camera.ui browser client",
5
5
  "author": "seydx (https://github.com/seydx/camera.ui)",
6
6
  "module": "./dist/bundle.js",
@@ -33,8 +33,8 @@
33
33
  "@rushstack/eslint-patch": "^1.10.4",
34
34
  "@swc/register": "^0.1.10",
35
35
  "@types/webrtc": "^0.0.44",
36
- "@typescript-eslint/eslint-plugin": "^8.8.1",
37
- "@typescript-eslint/parser": "^8.8.1",
36
+ "@typescript-eslint/eslint-plugin": "^8.10.0",
37
+ "@typescript-eslint/parser": "^8.10.0",
38
38
  "bufferutil": "^4.0.8",
39
39
  "eslint": "^8.57.0",
40
40
  "eslint-config-prettier": "^9.1.0",
@@ -1,11 +0,0 @@
1
- import { FrameWorker } from './worker.js';
2
- import type { CameraController } from '../camera/controller.js';
3
- export declare class FrameManager {
4
- frameWorkers: Map<string, FrameWorker>;
5
- private api;
6
- private proxyServer;
7
- private logger;
8
- constructor();
9
- addCamera(camera: CameraController): Promise<FrameWorker>;
10
- removeCamera(camera: CameraController): Promise<void>;
11
- }
@@ -1,7 +0,0 @@
1
- export interface HardwareSource {
2
- name: string;
3
- url: string;
4
- }
5
- export interface HardwareResponse {
6
- sources: HardwareSource[];
7
- }