@camera.ui/browser 0.0.91 → 0.0.92

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 (64) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/types/packages/client/browser/src/proxy/cameraDevice.d.ts +6 -6
  3. package/dist/types/packages/client/browser/src/proxy/coreManager.d.ts +2 -1
  4. package/dist/types/packages/client/browser/src/proxy/deviceManager.d.ts +1 -2
  5. package/dist/types/packages/client/browser/src/types.d.ts +11 -3
  6. package/dist/types/packages/common/src/messaging/index.d.ts +48 -0
  7. package/dist/types/packages/common/src/nats/index.d.ts +30 -0
  8. package/dist/types/{server/src → packages/plugineer/src/polyglot/node}/camera/index.d.ts +4 -5
  9. package/dist/types/packages/plugineer/src/polyglot/node/camera/interfaces/camera.d.ts +8 -0
  10. package/dist/types/{server/src → packages/plugineer/src/polyglot/node}/camera/interfaces/prebuffer.d.ts +3 -5
  11. package/dist/types/{server/src → packages/plugineer/src/polyglot/node}/camera/interfaces/ptz.d.ts +3 -5
  12. package/dist/types/{server/src → packages/plugineer/src/polyglot/node}/camera/iou.d.ts +1 -1
  13. package/dist/types/{server/src → packages/plugineer/src/polyglot/node}/camera/polygon.d.ts +1 -2
  14. package/dist/types/{server → packages/plugineer}/src/polyglot/node/plugins/schema.d.ts +1 -1
  15. package/dist/types/server/src/api/database/constants.d.ts +8 -0
  16. package/dist/types/server/src/api/database/index.d.ts +0 -8
  17. package/dist/types/server/src/api/database/types.d.ts +6 -6
  18. package/dist/types/server/src/api/schemas/cameras.schema.d.ts +117 -117
  19. package/dist/types/server/src/api/schemas/config.schema.d.ts +6 -6
  20. package/dist/types/server/src/api/schemas/go2rtc.schema.d.ts +84 -84
  21. package/dist/types/server/src/api/schemas/users.schema.d.ts +150 -150
  22. package/dist/types/server/src/api/types/index.d.ts +1 -1
  23. package/dist/types/server/src/api.d.ts +1 -7
  24. package/dist/types/server/src/camera/controller.d.ts +4 -5
  25. package/dist/types/server/src/camera/types.d.ts +24 -11
  26. package/dist/types/server/src/decoder/worker.d.ts +1 -1
  27. package/dist/types/server/src/nats/index.d.ts +3 -4
  28. package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +2 -2
  29. package/dist/types/server/src/nats/proxy/coreManager.d.ts +3 -3
  30. package/dist/types/server/src/nats/proxy/deviceManager.d.ts +5 -5
  31. package/dist/types/server/src/nats/types.d.ts +5 -34
  32. package/dist/types/server/src/plugins/interfaces/base.d.ts +1 -1
  33. package/dist/types/server/src/plugins/plugin.d.ts +1 -1
  34. package/dist/types/server/src/plugins/types.d.ts +36 -3
  35. package/dist/types/server/src/services/config/index.d.ts +2 -0
  36. package/dist/types/server/src/services/logger/index.d.ts +4 -16
  37. package/dist/types/shared/types/index.d.ts +5 -3
  38. package/package.json +1 -1
  39. package/dist/types/server/src/camera/device.d.ts +0 -29
  40. package/dist/types/server/src/camera/interfaces/camera.d.ts +0 -10
  41. package/dist/types/server/src/camera/streaming/peer-connection.d.ts +0 -55
  42. package/dist/types/server/src/camera/streaming/webrtc-connection.d.ts +0 -35
  43. package/dist/types/server/src/camera/streaming/werift-session.d.ts +0 -41
  44. package/dist/types/server/src/camera/videoFrame.d.ts +0 -24
  45. package/dist/types/server/src/nats/connection.d.ts +0 -17
  46. package/dist/types/server/src/nats/constants.d.ts +0 -1
  47. package/dist/types/server/src/nats/error.d.ts +0 -9
  48. package/dist/types/server/src/nats/messageQueue.d.ts +0 -20
  49. package/dist/types/server/src/nats/subscription.d.ts +0 -12
  50. package/dist/types/server/src/polyglot/node/plugins/cameraStorage.d.ts +0 -107
  51. package/dist/types/server/src/polyglot/node/plugins/configService.d.ts +0 -104
  52. package/dist/types/server/src/polyglot/node/plugins/pluginApi.d.ts +0 -35
  53. package/dist/types/server/src/polyglot/node/plugins/pluginLogger.d.ts +0 -18
  54. package/dist/types/server/src/polyglot/node/plugins/proxy/cameraDevice.d.ts +0 -69
  55. package/dist/types/server/src/polyglot/node/plugins/proxy/coreManager.d.ts +0 -40
  56. package/dist/types/server/src/polyglot/node/plugins/proxy/deviceManager.d.ts +0 -47
  57. package/dist/types/server/src/polyglot/node/plugins/storageController.d.ts +0 -30
  58. package/dist/types/server/src/utils/ffmpeg.d.ts +0 -2
  59. package/dist/types/server/src/utils/network.d.ts +0 -12
  60. package/dist/types/server/src/utils/npm.d.ts +0 -4
  61. package/dist/types/server/src/utils/pythonInstaller.d.ts +0 -48
  62. package/dist/types/server/src/utils/utils.d.ts +0 -10
  63. /package/dist/types/{server/src/utils/packer.d.ts → packages/common/src/packer/index.d.ts} +0 -0
  64. /package/dist/types/{server → packages/common}/src/utils/subscribed.d.ts +0 -0
@@ -50,7 +50,7 @@ export interface ClientData {
50
50
  address?: string;
51
51
  device?: string;
52
52
  }
53
- export declare enum REFRESH_TOKEN {
53
+ export declare const enum REFRESH_TOKEN {
54
54
  EXPIRES_IN = "7d"
55
55
  }
56
56
  export declare const PAGINATION_DEFAULTS: PaginationQuery;
@@ -3,14 +3,8 @@ import { EventEmitter } from 'node:events';
3
3
  import { CameraController } from './camera/controller.js';
4
4
  import type { Camera, CameraExtensions } from './api/database/types.js';
5
5
  import type { FrameWorker } from './decoder/worker.js';
6
- import type { BasePlugin } from './plugins/interfaces/base.js';
7
6
  import type { CameraExtension } from './plugins/types.js';
8
- import type { API } from './polyglot/node/plugins/pluginApi.js';
9
- import type { PluginLogger } from './polyglot/node/plugins/pluginLogger.js';
10
- export interface PluginConstructor {
11
- new (logger: PluginLogger, api: API): BasePlugin;
12
- }
13
- export declare const enum API_EVENT {
7
+ export declare enum API_EVENT {
14
8
  FINISH_LAUNCHING = "finishLaunching",
15
9
  SHUTDOWN = "shutdown"
16
10
  }
@@ -1,10 +1,9 @@
1
- import { CameraDevice } from './device.js';
2
- import { CameraPrebufferInterface } from './interfaces/prebuffer.js';
3
- import { CameraPTZInterface } from './interfaces/ptz.js';
1
+ import { CameraDevice, CameraPrebufferInterface, CameraPTZInterface } from '@camera.ui/plugineer';
2
+ import type { Logger } from '@camera.ui/common/logger';
4
3
  import type { Camera } from '../api/database/types.js';
5
4
  import type { MotionFrame, VideoFrame } from '../decoder/types.js';
6
5
  import type { ProxyServer } from '../nats/index.js';
7
- import type { BaseLogger, CameraConfigInputSettings, CameraDelegate, CameraSource, SetValues } from './types.js';
6
+ import type { CameraConfigInputSettings, CameraDelegate, CameraSource, SetValues } from './types.js';
8
7
  export declare class CameraController extends CameraDevice {
9
8
  proxy: ProxyServer;
10
9
  private motionTimeout?;
@@ -17,7 +16,7 @@ export declare class CameraController extends CameraDevice {
17
16
  protected prebufferDelegate: CameraPrebufferInterface;
18
17
  get camera(): Camera;
19
18
  get sources(): CameraSource[];
20
- constructor(camera: Camera, logger: BaseLogger, proxy: ProxyServer);
19
+ constructor(camera: Camera, logger: Logger, proxy: ProxyServer);
21
20
  setDelegate(): void;
22
21
  getFrames(): AsyncIterableIterator<VideoFrame>;
23
22
  getMotionFrames(): AsyncIterableIterator<MotionFrame>;
@@ -1,16 +1,7 @@
1
+ import type { CameraInterface, CameraPrebufferInterface, CameraPTZInterface } from '@camera.ui/plugineer';
1
2
  import type { CameraInformation, CameraInput, CameraInputSettings, Point, ZoneFilter, ZoneType } from '../api/database/types.js';
2
3
  import type { FrameData, FrameMetadata } from '../decoder/types.js';
3
- import type { CameraInterface } from './interfaces/camera.js';
4
- import type { CameraPrebufferInterface } from './interfaces/prebuffer.js';
5
- import type { CameraPTZInterface } from './interfaces/ptz.js';
6
- export interface BaseLogger {
7
- log: (...args: any[]) => void;
8
- error: (...args: any[]) => void;
9
- warn: (...args: any[]) => void;
10
- debug: (...args: any[]) => void;
11
- trace: (...args: any[]) => void;
12
- attention: (...args: any[]) => void;
13
- }
4
+ import type { JsonSchema, JsonSchemaForm, SchemaConfig } from '../plugins/types.js';
14
5
  export type SpawnInput = string | number;
15
6
  export interface FfmpegOptions {
16
7
  ffmpegPath: string;
@@ -199,3 +190,25 @@ export interface CameraDelegates {
199
190
  readonly prebufferDelegate: CameraPrebufferDelegate;
200
191
  readonly ptzDelegate: CameraPTZDelegate;
201
192
  }
193
+ export interface CameraStorage<T extends Record<string, any> = Record<string, any>> {
194
+ schema: JsonSchemaForm;
195
+ values: T;
196
+ initializeStorage(): void;
197
+ getValue<U = string>(path: string): Promise<U> | undefined;
198
+ getValue<U = string>(path: string, defaultValue: U): Promise<U>;
199
+ setValue<U = string>(path: string, newValue: U): Promise<void>;
200
+ hasValue(path: string): boolean;
201
+ getConfig(): Promise<SchemaConfig>;
202
+ setConfig(newConfig: T): Promise<void>;
203
+ addSchema(schema: JsonSchemaForm): Promise<void>;
204
+ addSchema(path: string, schema: JsonSchema): Promise<void>;
205
+ removeSchema(path: string): void;
206
+ changeSchema(path: string, newSchema: Partial<JsonSchema>): Promise<void>;
207
+ getSchema<U>(path: string): U | undefined;
208
+ hasSchema(path: string): boolean;
209
+ }
210
+ export interface StorageController {
211
+ createCameraStorage<T extends Record<string, any> = Record<string, any>>(instance: any, cameraId: string, schema?: JsonSchemaForm): CameraStorage<T>;
212
+ getCameraStorage<T extends Record<string, any> = Record<string, any>>(cameraId: string): CameraStorage<T> | undefined;
213
+ removeCameraStorage(cameraId: string): void;
214
+ }
@@ -1,5 +1,5 @@
1
+ import { Subscribed } from '@camera.ui/common';
1
2
  import { PLUGIN_STATUS } from '../plugins/types.js';
2
- 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 {
@@ -1,12 +1,11 @@
1
- import { ProxyConnection } from './connection.js';
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 { StateValues } from '../camera/types.js';
7
- import type { CameraStorage } from '../polyglot/node/plugins/cameraStorage.js';
6
+ import type { ProxySubscription } from '@camera.ui/common';
7
+ import type { CameraStorage, StateValues } from '../camera/types.js';
8
8
  import type { MethodKeys, MethodType } from '../types.js';
9
- import type { ProxySubscription } from './subscription.js';
10
9
  import type { CameraDeviceListenerMessagePayload, CoreManagerProxyEvents, DeviceManagerProxyEvents, PluginMap, ProxyAuth } from './types.js';
11
10
  import type { WebsocketProxy } from './websocket.js';
12
11
  export declare class ProxyServer {
@@ -1,7 +1,7 @@
1
+ import type { MessageQueue, ProxyMessageStructure } from '@camera.ui/common/messaging';
1
2
  import type { CameraConfigInputSettings, CameraInterfaces, SetValues } from '../../camera/types.js';
2
3
  import type { MethodKeys, MethodType } from '../../types.js';
3
- import type { MessageQueue } from '../messageQueue.js';
4
- import type { CameraDeviceProxyMethods, ProxyMessageStructure, RefreshedStates } from '../types.js';
4
+ import type { CameraDeviceProxyMethods, RefreshedStates } from '../types.js';
5
5
  export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
6
6
  private api;
7
7
  private configService;
@@ -1,7 +1,7 @@
1
+ import type { MessageQueue, ProxyMessageStructure } from '@camera.ui/common/messaging';
1
2
  import type { IceServer } from '../../services/config/types.js';
2
- import type { MessageQueue } from '../messageQueue.js';
3
- import type { CoreManagerProxyMethods, ProxyMessageStructure } from '../types.js';
4
- export declare class CoreManagerProxy implements CoreManagerProxyMethods {
3
+ import type { CoreManager } from '../types.js';
4
+ export declare class CoreManagerProxy implements CoreManager {
5
5
  private configService;
6
6
  private pluginsService;
7
7
  private systemService;
@@ -1,14 +1,14 @@
1
+ import type { MessageQueue, ProxyMessageStructure } from '@camera.ui/common/messaging';
1
2
  import type { Camera } from '../../api/database/types.js';
2
3
  import type { CameraConfig } from '../../camera/types.js';
3
- import type { MessageQueue } from '../messageQueue.js';
4
- import type { DeviceManagerServerProxyMethods, ProxyMessageStructure } from '../types.js';
5
- export declare class DeviceManagerProxy implements DeviceManagerServerProxyMethods {
4
+ import type { DeviceManager } from '../types.js';
5
+ export declare class DeviceManagerProxy implements DeviceManager {
6
6
  private camerasService;
7
7
  private pluginsService;
8
8
  private messageQueue;
9
9
  constructor(messageQueue: MessageQueue);
10
- getCameraByName(cameraName: string): Camera | undefined;
11
- getCameraById(cameraId: string): Camera | void;
10
+ getCameraByName(cameraName: string): Promise<any>;
11
+ getCameraById(cameraId: string): Promise<any>;
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>;
@@ -1,6 +1,6 @@
1
+ import type { CameraDevice } from '@camera.ui/plugineer';
1
2
  import type { Camera, DBSystem, VideoStreamingMode } from '../api/database/types.js';
2
- import type { CameraDevice } from '../camera/device.js';
3
- import type { CameraConfig, CameraConfigInputSettings, CameraDelegates, SetValues, StateValues } from '../camera/types.js';
3
+ import type { CameraConfig, CameraConfigInputSettings, SetValues, StateValues } from '../camera/types.js';
4
4
  import type { AuthConfig } from '../decoder/types.js';
5
5
  import type { AudioDetectionPlugin } from '../plugins/interfaces/audioDetection.js';
6
6
  import type { BasePlugin } from '../plugins/interfaces/base.js';
@@ -8,28 +8,6 @@ import type { MotionDetectionPlugin } from '../plugins/interfaces/motionDetectio
8
8
  import type { ObjectDetectionPlugin } from '../plugins/interfaces/objectDetection.js';
9
9
  import type { CameraExtension } from '../plugins/types.js';
10
10
  import type { IceServer } from '../services/config/types.js';
11
- import type { DeserializedError, RemoteError } from './error.js';
12
- export interface QueueItem {
13
- message: ProxyMessageStructure;
14
- resolve: (response: any) => void;
15
- reject: (error: RemoteError) => void;
16
- }
17
- export interface ProxyMessageStructure {
18
- requestId: string;
19
- cameraId?: string;
20
- targetId: string;
21
- targetName?: string;
22
- pluginId: string;
23
- type: 'request' | 'reply';
24
- proxy: 'device' | 'camera' | 'plugin' | 'core';
25
- client: 'cameraFn' | 'pluginFn' | 'deviceFn' | 'storageFn' | 'coreFn' | keyof CameraDelegates;
26
- fn: string;
27
- args: any[];
28
- timeout: number;
29
- timestamp: number;
30
- response?: any;
31
- error?: DeserializedError;
32
- }
33
11
  export interface ProxyAuth {
34
12
  cluster: AuthConfig;
35
13
  server: AuthConfig;
@@ -64,17 +42,10 @@ export interface CameraDeviceListenerMessagePayload {
64
42
  type: 'removed' | 'updated' | 'cameraState';
65
43
  data?: any;
66
44
  }
67
- export interface DeviceManagerServerProxyMethods {
68
- createCamera(camera: CameraConfig): Promise<Camera>;
69
- getCameraByName(name: string): Camera | void;
70
- getCameraById(id: string): Camera | void;
71
- removeCameraByName(name: string): Promise<void>;
72
- removeCameraById(id: string): Promise<void>;
73
- }
74
- export interface DeviceManagerProxyMethods {
45
+ export interface DeviceManager {
46
+ createCamera(cameraConfig: CameraConfig): Promise<CameraDevice>;
75
47
  getCameraByName(cameraName: string): Promise<CameraDevice | undefined>;
76
48
  getCameraById(cameraId: string): Promise<CameraDevice | undefined>;
77
- createCamera(cameraConfig: CameraConfig): Promise<CameraDevice>;
78
49
  removeCameraByName(cameraName: string): Promise<void>;
79
50
  removeCameraById(cameraId: string): Promise<void>;
80
51
  }
@@ -100,7 +71,7 @@ export interface DeviceManagerProxyGenericEvent<K extends keyof DeviceManagerPro
100
71
  type: K;
101
72
  data: DeviceManagerProxyEvents[K];
102
73
  }
103
- export interface CoreManagerProxyMethods {
74
+ export interface CoreManager {
104
75
  getFFmpegPath(): Promise<string>;
105
76
  getServerAddresses(): Promise<string[]>;
106
77
  getIceServers(): Promise<IceServer[]>;
@@ -1,4 +1,4 @@
1
- import type { CameraDevice } from '../../camera/device.js';
1
+ import type { CameraDevice } from '@camera.ui/plugineer';
2
2
  import type { FormSubmitResponse } from '../types.js';
3
3
  export declare abstract class BasePlugin {
4
4
  abstract onFormSubmit(actionId: string, payload: any): Promise<FormSubmitResponse | void>;
@@ -1,4 +1,4 @@
1
- import { PythonInstaller } from '../utils/pythonInstaller.js';
1
+ import { PythonInstaller } from '@camera.ui/common/python';
2
2
  import type { CameraUiPlugin, IPackageJson } from '../api/types/index.js';
3
3
  import type { PluginContract } from './types.js';
4
4
  export declare class Plugin {
@@ -1,5 +1,7 @@
1
+ import type { Path } from 'object-path';
1
2
  import type { Camera } from '../api/database/types.js';
2
- import type { Detection } from '../camera/types.js';
3
+ import type { Detection, StorageController } from '../camera/types.js';
4
+ import type { CoreManager, DeviceManager } from '../nats/types.js';
3
5
  export interface Context {
4
6
  engines?: Record<string, string>;
5
7
  dependencies?: Record<string, string>;
@@ -31,7 +33,7 @@ export interface PluginContractBase {
31
33
  pythonVersion?: string;
32
34
  }
33
35
  export type PluginContract = PluginContractBase & ExtensionOrSupport;
34
- export declare const enum PLUGIN_STATUS {
36
+ export declare enum PLUGIN_STATUS {
35
37
  READY = "ready",
36
38
  STARTING = "starting",
37
39
  STARTED = "started",
@@ -40,7 +42,7 @@ export declare const enum PLUGIN_STATUS {
40
42
  UNKNOWN = "unknown",
41
43
  DISABLED = "disabled"
42
44
  }
43
- export declare const enum PLUGIN_COMMAND {
45
+ export declare enum PLUGIN_COMMAND {
44
46
  START = "start",
45
47
  STOP = "stop"
46
48
  }
@@ -151,4 +153,35 @@ export interface ObjectDetectionPluginResponse {
151
153
  export interface AudioDetectionPluginResponse {
152
154
  detected: boolean;
153
155
  }
156
+ export interface PluginAPI {
157
+ on(event: 'finishLaunching', listener: () => void): this;
158
+ on(event: 'shutdown', listener: () => void): this;
159
+ once(event: 'finishLaunching', listener: () => void): this;
160
+ once(event: 'shutdown', listener: () => void): this;
161
+ off(event: 'finishLaunching', listener: () => void): this;
162
+ off(event: 'shutdown', listener: () => void): this;
163
+ removeListener(event: 'finishLaunching', listener: () => void): this;
164
+ removeListener(event: 'shutdown', listener: () => void): this;
165
+ removeAllListeners(event?: string): this;
166
+ readonly coreManager: CoreManager;
167
+ readonly deviceManager: DeviceManager;
168
+ readonly storageController: StorageController;
169
+ readonly configService: PluginConfigService;
170
+ readonly storagePath: string;
171
+ readonly configFile: string;
172
+ }
173
+ export interface PluginConfigService {
174
+ get(key: Path, defaultValue: JSONValue, validate: Function, refresh?: boolean, writeIfNotValid?: boolean): any;
175
+ get(key: Path, defaultValue?: unknown, validate?: Function, refresh?: boolean, writeIfNotValid?: boolean): any;
176
+ has(key: Path, refresh?: boolean): boolean;
177
+ ensureExists(key: Path, defaultValue: JSONValue, write?: boolean): void;
178
+ set(key: Path, value: any, write?: boolean): void;
179
+ insert(key: Path, value: any, at?: number, write?: boolean): void;
180
+ push(key: Path, write?: boolean, ...items: any[]): void;
181
+ delete(key: Path, write?: boolean): void;
182
+ all(refresh?: boolean): PluginConfig;
183
+ replace(config: PluginConfig, write?: boolean): void;
184
+ updateValue(path: string, searchKey: string, searchValue: any, targetKey: string, newValue: any, write?: boolean): void;
185
+ replaceOrAddItem(path: string, searchKey: string, searchValue: any, newItem: any, write?: boolean): void;
186
+ }
154
187
  export {};
@@ -1,4 +1,5 @@
1
1
  import 'reflect-metadata';
2
+ import type { LoggerOptions } from '@camera.ui/common/logger';
2
3
  import type { DeepPartial } from '../../types.js';
3
4
  import type { Go2RtcConfig, IConfig, Secrets } from './types.js';
4
5
  export declare class ConfigService {
@@ -38,6 +39,7 @@ export declare class ConfigService {
38
39
  set config(newConfig: IConfig);
39
40
  get go2rtcConfig(): Go2RtcConfig;
40
41
  set go2rtcConfig(newConfig: Go2RtcConfig);
42
+ get loggerOptions(): LoggerOptions;
41
43
  constructor(homePath?: string);
42
44
  static extractVersion(str: string): string | null;
43
45
  read(): void;
@@ -1,23 +1,11 @@
1
1
  import 'reflect-metadata';
2
+ import { Logger } from '@camera.ui/common/logger';
3
+ import type { LoggerOptions } from '@camera.ui/common/logger';
2
4
  import type { UiNotification } from '../../api/types/index.js';
3
5
  import type { LoggingLevel } from '../config/types.js';
4
- export declare class Logger {
5
- private _loggerPrefix;
6
- debugEnabled: boolean;
7
- traceEnabled: boolean;
8
- disableTimestamps: boolean;
6
+ export declare class LoggerService extends Logger {
9
7
  notifications: UiNotification[];
10
- get prefix(): string;
11
- constructor();
12
- log(...args: any[]): void;
13
- error(...args: any[]): void;
14
- warn(...args: any[]): void;
15
- attention(...args: any[]): void;
16
- debug(...args: any[]): void;
17
- trace(...args: any[]): void;
8
+ constructor(options?: LoggerOptions);
18
9
  notify(title: string, text: string, type: LoggingLevel, link: string): Promise<void>;
19
- formatMessage(level: 'log' | 'warn' | 'error' | 'debug' | 'trace' | 'attention', ...args: any[]): string[];
20
- private formattedArgs;
21
- private formatDateTime;
22
10
  private checkIfNotificationExists;
23
11
  }
@@ -1,3 +1,7 @@
1
+ export type * from '../../packages/common/src/messaging/index.js';
2
+ export * from '../../packages/common/src/utils/subscribed.js';
3
+ export * from '../../packages/plugineer/src/polyglot/node/camera/polygon.js';
4
+ export * from '../../packages/plugineer/src/polyglot/node/plugins/schema.js';
1
5
  export type * from '../../server/src/api/database/types.js';
2
6
  export * from '../../server/src/api/schemas/cameras.schema.js';
3
7
  export * from '../../server/src/api/schemas/plugins.schema.js';
@@ -5,14 +9,12 @@ export * from '../../server/src/api/schemas/system.schema.js';
5
9
  export * from '../../server/src/api/schemas/users.schema.js';
6
10
  export type * from '../../server/src/api/types/index.js';
7
11
  export type * from '../../server/src/api/websocket/types.js';
8
- export * from '../../server/src/camera/polygon.js';
9
12
  export type * from '../../server/src/camera/types.js';
10
13
  export type * from '../../server/src/decoder/types.js';
11
14
  export * from '../../server/src/go2rtc/types.js';
12
15
  export type * from '../../server/src/nats/types.js';
16
+ export * from '../../server/src/plugins/interfaces/base.js';
13
17
  export * from '../../server/src/plugins/types.js';
14
- export * from '../../server/src/polyglot/node/plugins/schema.js';
15
18
  export * from '../../server/src/services/config/types.js';
16
19
  export type * from '../../server/src/types.js';
17
20
  export { names as cocoLabels } from '../../server/src/utils/cocoLabels.json';
18
- 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.91",
3
+ "version": "0.0.92",
4
4
  "description": "camera.ui browser client",
5
5
  "author": "seydx (https://github.com/seydx/camera.ui)",
6
6
  "module": "./dist/bundle.js",
@@ -1,29 +0,0 @@
1
- import { BehaviorSubject } from 'rxjs';
2
- import { BaseCameraDevice } from './index.js';
3
- import { WeriftSession } from './streaming/werift-session.js';
4
- import type { Observable } from 'rxjs';
5
- import type { MotionFrame, VideoFrame } from '../decoder/types.js';
6
- import type { StreamingConnectionOptions } from './streaming/peer-connection.js';
7
- import type { AudioSetEvent, BatterySetEvent, CameraConfigInputSettings, CameraDelegates, DoorbellSetEvent, FrameState, LightSetEvent, MotionSetEvent, ObjectSetEvent, SirenSetEvent } from './types.js';
8
- export declare abstract class CameraDevice extends BaseCameraDevice {
9
- protected readonly frameState: BehaviorSubject<FrameState>;
10
- protected readonly onFrame: Observable<FrameState>;
11
- abstract setDelegate<T extends keyof CameraDelegates>(name: T, delegate: CameraDelegates[T]): void;
12
- abstract connect(): Promise<void>;
13
- abstract disconnect(): Promise<void>;
14
- abstract getFrames(prebufferDuration?: number): AsyncIterableIterator<VideoFrame>;
15
- abstract getMotionFrames(): AsyncIterableIterator<MotionFrame>;
16
- abstract updateState(stateName: 'light', eventData: LightSetEvent): Promise<void>;
17
- abstract updateState(stateName: 'motion', eventData: MotionSetEvent, frame?: VideoFrame): Promise<void>;
18
- abstract updateState(stateName: 'audio', eventData: AudioSetEvent): Promise<void>;
19
- abstract updateState(stateName: 'object', eventData: ObjectSetEvent): Promise<void>;
20
- abstract updateState(stateName: 'doorbell', eventData: DoorbellSetEvent): Promise<void>;
21
- abstract updateState(stateName: 'siren', eventData: SirenSetEvent): Promise<void>;
22
- abstract updateState(stateName: 'battery', eventData: BatterySetEvent): Promise<void>;
23
- abstract addCameraSource(source: CameraConfigInputSettings): Promise<void>;
24
- abstract updateCameraSource(sourceId: string, source: Partial<CameraConfigInputSettings>): Promise<void>;
25
- abstract removeCameraSource(sourceId: string): Promise<void>;
26
- createSession(sourceName: string, options?: StreamingConnectionOptions): Promise<WeriftSession>;
27
- protected removeAllListeners(): void;
28
- private createMotionFrameObservable;
29
- }
@@ -1,10 +0,0 @@
1
- import { CameraDelegate } from '../types.js';
2
- import type { BaseLogger } from '../types.js';
3
- export declare class CameraInterface extends CameraDelegate {
4
- delegate?: CameraDelegate;
5
- private onRequest;
6
- private logger;
7
- constructor(onRequest: (client: any, fn: string, args?: any[], timeout?: number) => Promise<any>, logger: BaseLogger);
8
- snapshot(): Promise<ArrayBuffer | undefined>;
9
- private _onRequest;
10
- }
@@ -1,55 +0,0 @@
1
- import { ReplaySubject, Subject } from 'rxjs';
2
- import { MediaStreamTrack } from 'werift';
3
- import { Subscribed } from '../../utils/subscribed.js';
4
- import type { Observable } from 'rxjs';
5
- import type { ConnectionState, RTCIceCandidate, RTCSessionDescription, RtcpPacket, RtpPacket, RTCIceCandidate as WeriftRTCICECandidate } from 'werift';
6
- import type { IceServer } from '../../services/config/types.js';
7
- import type { CameraDevice } from '../device.js';
8
- import type { BaseLogger } from '../types.js';
9
- export interface BasicPeerConnection {
10
- createOffer(): Promise<RTCSessionDescription>;
11
- acceptAnswer(answer: {
12
- type: 'answer';
13
- sdp: string;
14
- }): Promise<void>;
15
- addIceCandidate(candidate: Partial<WeriftRTCICECandidate>): Promise<void>;
16
- onIceCandidate: Subject<WeriftRTCICECandidate>;
17
- onConnectionState: Observable<ConnectionState>;
18
- close(): void;
19
- requestKeyFrame?: () => void;
20
- }
21
- export type PeerConnectionAudioCodecs = 'opus' | 'g722' | 'pcmu' | 'pcma';
22
- export type PeerConnectionVideoCodecs = 'vp8' | 'vp9' | 'h264' | 'av1';
23
- export interface StreamingConnectionOptions {
24
- createPeerConnection?: () => BasicPeerConnection;
25
- iceServers?: IceServer[];
26
- preferredAudioCodecs?: PeerConnectionAudioCodecs[];
27
- preferredVideoCodecs?: PeerConnectionVideoCodecs[];
28
- onlyTalkback?: boolean;
29
- }
30
- export declare class WeriftPeerConnection extends Subscribed implements BasicPeerConnection {
31
- onAudioRtp: Subject<RtpPacket>;
32
- onAudioRtcp: Subject<RtcpPacket>;
33
- onVideoRtp: Subject<RtpPacket>;
34
- onVideoRtcp: Subject<RtcpPacket>;
35
- onIceCandidate: Subject<RTCIceCandidate>;
36
- onConnectionState: ReplaySubject<"connected" | "disconnected" | "closed" | "failed" | "new" | "connecting">;
37
- returnAudioTrack: MediaStreamTrack;
38
- private onRequestKeyFrame;
39
- private cameraDevice;
40
- private sourceName;
41
- private logger;
42
- private options;
43
- private pc;
44
- private get logPrefix();
45
- constructor(cameraDevice: CameraDevice, options: StreamingConnectionOptions, logger: BaseLogger, sourceName: string);
46
- createOffer(): Promise<RTCSessionDescription>;
47
- acceptAnswer(answer: {
48
- type: 'answer';
49
- sdp: string;
50
- }): Promise<void>;
51
- addIceCandidate(candidate: RTCIceCandidate): Promise<void>;
52
- requestKeyFrame(): void;
53
- close(): void;
54
- private createPeerCoonection;
55
- }
@@ -1,35 +0,0 @@
1
- import { ReplaySubject, Subject } from 'rxjs';
2
- import { Subscribed } from '../../utils/subscribed.js';
3
- import type { Observable } from 'rxjs';
4
- import type { RtpPacket } from 'werift';
5
- import type { CameraDevice } from '../device.js';
6
- import type { BaseLogger } from '../types.js';
7
- import type { StreamingConnectionOptions } from './peer-connection.js';
8
- export declare class WebrtcConnection extends Subscribed {
9
- readonly onCameraConnected: ReplaySubject<void>;
10
- readonly onCallAnswered: ReplaySubject<string>;
11
- readonly onCallEnded: ReplaySubject<void>;
12
- readonly onError: ReplaySubject<void>;
13
- readonly onMessage: ReplaySubject<{
14
- method: string;
15
- }>;
16
- readonly onWsOpen: Observable<unknown>;
17
- readonly onAudioRtp: Subject<RtpPacket>;
18
- readonly onVideoRtp: Subject<RtpPacket>;
19
- private readonly pc;
20
- private readonly ws;
21
- private readonly onOfferSent;
22
- private hasEnded;
23
- private cameraDevice;
24
- private sourceName;
25
- private logger;
26
- private get logPrefix();
27
- constructor(cameraDevice: CameraDevice, sourceName: string, logger: BaseLogger, options: StreamingConnectionOptions);
28
- sendAudioPacket(rtp: RtpPacket): void;
29
- stop(): void;
30
- requestKeyFrame(): void;
31
- private initiateCall;
32
- private handleMessage;
33
- private sendMessage;
34
- private callEnded;
35
- }
@@ -1,41 +0,0 @@
1
- import { ReplaySubject, Subject } from 'rxjs';
2
- import { RtpPacket } from 'werift';
3
- import type { Subscription } from 'rxjs';
4
- import type { CameraDevice } from '../device.js';
5
- import type { BaseLogger, FfmpegOptions, SpawnInput } from '../types.js';
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
- }
15
- export declare class WeriftSession extends Subscribed {
16
- readonly onCallEnded: ReplaySubject<void>;
17
- readonly onVideoRtp: Subject<RtpPacket>;
18
- readonly onAudioRtp: Subject<RtpPacket>;
19
- private readonly audioSplitter;
20
- private readonly videoSplitter;
21
- private readonly returnAudioSplitter;
22
- private readonly onUsingOpus;
23
- private hasEnded;
24
- private cameraDevice;
25
- private connection;
26
- private logger;
27
- get isUsingOpus(): Promise<boolean>;
28
- constructor(cameraDevice: CameraDevice, logger: BaseLogger, connection: WebrtcConnection);
29
- reservePort(bufferPorts?: number): Promise<number>;
30
- startTranscoding(ffmpegOptions: FfmpegOptions): Promise<void>;
31
- transcodeReturnAudio(ffmpegOptions: {
32
- ffmpegPath: string;
33
- input: SpawnInput[];
34
- }): Promise<void>;
35
- stop(): void;
36
- sendAudioPacket(rtp: RtpPacket): void;
37
- requestKeyFrame(): void;
38
- private bindToConnection;
39
- private callEnded;
40
- }
41
- export {};
@@ -1,24 +0,0 @@
1
- import type { DecoderFormat, FrameBuffer, FrameData, FrameImage, FrameMetadata, ImageOptions, MotionFrame as MotionFrameMethods, VideoFrame as VideoFrameMethods } from '../decoder/types.js';
2
- import type { ProxyConnection } from '../nats/connection.js';
3
- import type { MotionState } from './types.js';
4
- export declare class VideoFrame implements VideoFrameMethods {
5
- readonly frameData: FrameData;
6
- readonly metadata: FrameMetadata;
7
- private frameGeneratorSubject;
8
- private publisher;
9
- private prebufferDuration;
10
- get inputWidth(): number;
11
- get inputHeight(): number;
12
- get inputFormat(): DecoderFormat;
13
- constructor(cameraId: string, publisher: ProxyConnection, frameData: FrameData, metadata: FrameMetadata, prebufferDuration: number);
14
- toBuffer(options?: ImageOptions): Promise<FrameBuffer>;
15
- toImage(options?: ImageOptions): Promise<FrameImage>;
16
- save(path: string, options?: ImageOptions): Promise<void>;
17
- private send;
18
- private validateOptions;
19
- private getImageInformation;
20
- }
21
- export declare class MotionFrame extends VideoFrame implements MotionFrameMethods {
22
- readonly motion: MotionState;
23
- constructor(cameraId: string, publisher: ProxyConnection, frameData: FrameData, motionState: MotionState, metadata: FrameMetadata);
24
- }
@@ -1,17 +0,0 @@
1
- import { ProxySubscription } from './subscription.js';
2
- import type { NatsConnection, RequestOptions } from 'nats';
3
- import type { AuthConfig } from '../decoder/types.js';
4
- export declare class ProxyConnection {
5
- private name;
6
- private servers;
7
- private auth;
8
- private publisher?;
9
- private subscribers;
10
- private closed;
11
- constructor(name: string, servers: string[], auth: AuthConfig);
12
- connect(): Promise<NatsConnection>;
13
- subscribe(subject: string, skipListening?: boolean): ProxySubscription;
14
- publish(subject: string, message: any): void;
15
- request(subject: string, message: any, opts?: RequestOptions): Promise<any>;
16
- close(): Promise<void>;
17
- }
@@ -1 +0,0 @@
1
- export declare const NATS_SERVER_SUBJECT = "camera.ui-server";
@@ -1,9 +0,0 @@
1
- import type { ProxyMessageStructure } from './types.js';
2
- export interface DeserializedError {
3
- name: string;
4
- message: string;
5
- stack: string;
6
- }
7
- export declare class RemoteError extends Error {
8
- constructor(error: DeserializedError, cause: Omit<ProxyMessageStructure, 'error'>);
9
- }
@@ -1,20 +0,0 @@
1
- import type { BaseLogger } from '../camera/types.js';
2
- import type { ProxyConnection } from './connection.js';
3
- import type { ProxySubscription } from './subscription.js';
4
- import type { ProxyMessageStructure } from './types.js';
5
- export declare class MessageQueue {
6
- private logger;
7
- private type;
8
- private publisher;
9
- private subscriber;
10
- private requestHandler;
11
- private aborted;
12
- private isProcessing;
13
- private queue;
14
- private pendingResponses;
15
- constructor(type: 'server' | 'client', publisher: ProxyConnection, subscriber: ProxySubscription, logger: BaseLogger, requestHandler: (message: ProxyMessageStructure) => void);
16
- abortQueue(): void;
17
- enqueue(message: ProxyMessageStructure): Promise<any>;
18
- private processQueue;
19
- private onMessage;
20
- }