@camera.ui/browser 0.0.35 → 0.0.37

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 (45) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/client/node/src/proxy/cameraDevice/cameraDevice.browser.d.ts +30 -18
  3. package/dist/client/node/src/proxy/cameraDevice/cameraDevice.node.d.ts +10 -7
  4. package/dist/shared/types/index.d.ts +2 -0
  5. package/dist/src/api/database/types.d.ts +7 -25
  6. package/dist/src/api/schemas/cameras.schema.d.ts +112 -6
  7. package/dist/src/api/schemas/config.schema.d.ts +9 -9
  8. package/dist/src/api/services/cameras.service.d.ts +1 -2
  9. package/dist/src/api/ws/nsp/status.d.ts +10 -2
  10. package/dist/src/api/ws/nsp/streams.d.ts +0 -15
  11. package/dist/src/api/ws/types.d.ts +14 -0
  12. package/dist/src/api.d.ts +9 -36
  13. package/dist/src/camera/index.d.ts +35 -22
  14. package/dist/src/camera/streaming/browser/browser-peer-connection.d.ts +22 -0
  15. package/dist/src/camera/streaming/browser/browser-streaming-session.d.ts +17 -0
  16. package/dist/src/camera/streaming/browser/webrtc-browser-connection.d.ts +26 -0
  17. package/dist/src/camera/streaming/peer-connection.d.ts +5 -7
  18. package/dist/src/camera/streaming/streaming-session.d.ts +3 -3
  19. package/dist/src/camera/streaming/webrtc-connection.d.ts +4 -4
  20. package/dist/src/camera/types.d.ts +77 -23
  21. package/dist/src/go2rtc/index.d.ts +1 -0
  22. package/dist/src/plugins/api.d.ts +31 -0
  23. package/dist/src/plugins/base.d.ts +7 -11
  24. package/dist/src/plugins/cameraStorage.d.ts +5 -4
  25. package/dist/src/plugins/index.d.ts +0 -4
  26. package/dist/src/plugins/plugin.d.ts +2 -6
  27. package/dist/src/plugins/schema.d.ts +3 -3
  28. package/dist/src/plugins/storageController.d.ts +2 -2
  29. package/dist/src/plugins/types.d.ts +8 -21
  30. package/dist/src/plugins/worker.d.ts +0 -2
  31. package/dist/src/proxy/client/cameraDevice.d.ts +16 -11
  32. package/dist/src/proxy/client/deviceManager.d.ts +7 -5
  33. package/dist/src/proxy/client/pluginsManager.d.ts +5 -3
  34. package/dist/src/proxy/client/queue.d.ts +2 -0
  35. package/dist/src/proxy/client/systemManager.d.ts +5 -2
  36. package/dist/src/proxy/index.d.ts +2 -2
  37. package/dist/src/proxy/proxies/camera.d.ts +57 -47
  38. package/dist/src/proxy/proxies/plugin.d.ts +3 -2
  39. package/dist/src/proxy/queue.d.ts +2 -0
  40. package/dist/src/proxy/types.d.ts +50 -36
  41. package/dist/src/services/config/types.d.ts +1 -1
  42. package/dist/src/services/logger/index.d.ts +5 -4
  43. package/package.json +4 -4
  44. package/dist/src/plugins/child.d.ts +0 -18
  45. /package/dist/src/camera/{subscribed.d.ts → utils/subscribed.d.ts} +0 -0
@@ -1,5 +1,4 @@
1
1
  import type { Camera } from '../api/database/types';
2
- import type { CameraDevice } from '../camera/types';
3
2
  export type PluginGraph = Map<string, string[]>;
4
3
  export type PluginCycles = Map<string, string[]>;
5
4
  export type PluginGroups = Map<string, string[]>;
@@ -7,18 +6,6 @@ export interface SchemaConfig {
7
6
  rootSchema: PluginRootSchema;
8
7
  config: Record<string, any>;
9
8
  }
10
- export interface CameraStorage {
11
- setValue<T = string>(path: string, newValue: T): Promise<void>;
12
- getValue<T = string>(path: string): T | Promise<T> | undefined;
13
- getConfig(): Promise<SchemaConfig>;
14
- setConfig(config: Record<string, any>): Promise<void>;
15
- }
16
- export interface BasePlugin {
17
- onFormSubmit(actionId: string, payload: any): Promise<{
18
- toast?: string;
19
- } | void>;
20
- configureCameras(cameras: CameraDevice[]): void;
21
- }
22
9
  export declare const PLUGIN_IDENTIFIER_PATTERN: RegExp;
23
10
  export type JSONValue = string | number | boolean | JSONObject | JSONArray;
24
11
  export interface JSONObject {
@@ -27,7 +14,7 @@ export interface JSONObject {
27
14
  export type JSONArray = JSONValue[];
28
15
  export type PluginConfig = Record<string, any>;
29
16
  export declare const CAMERA_EXTENSIONS: CameraExtension[];
30
- export type CameraExtension = 'hub' | 'prebuffer' | 'motionDetection' | 'objectDetection' | 'audioDetection' | 'ptz';
17
+ export type CameraExtension = 'hub' | 'prebuffer' | 'motionDetection' | 'objectDetection' | 'audioDetection' | 'ptz' | 'intercom';
31
18
  type ExtensionOrSupport = {
32
19
  extension: CameraExtension;
33
20
  supportAdditionalCameras?: never;
@@ -80,7 +67,7 @@ export interface ProcessResponse {
80
67
  }
81
68
  export type JsonSchemaType = 'string' | 'number' | 'boolean' | 'object' | 'array';
82
69
  export interface JsonBaseSchema<T = any> {
83
- type: string;
70
+ type: JsonSchemaType;
84
71
  key?: string;
85
72
  title?: string;
86
73
  description?: string;
@@ -124,14 +111,14 @@ export interface JsonSchemaBoolean extends JsonBaseSchema<boolean> {
124
111
  export interface PluginJsonSchemaBoolean extends PluginJsonBaseSchema<boolean> {
125
112
  type: 'boolean';
126
113
  }
127
- export interface JsonSchemaEnum extends JsonBaseSchema<string | number | boolean> {
128
- type: 'string' | 'number' | 'boolean';
129
- enum: (string | number | boolean)[];
114
+ export interface JsonSchemaEnum extends JsonBaseSchema<string> {
115
+ type: 'string';
116
+ enum: string[];
130
117
  multiple?: boolean;
131
118
  }
132
- export interface PluginJsonSchemaEnum extends PluginJsonBaseSchema<string | number | boolean> {
133
- type: 'string' | 'number' | 'boolean';
134
- enum: (string | number | boolean)[];
119
+ export interface PluginJsonSchemaEnum extends PluginJsonBaseSchema<string> {
120
+ type: 'string';
121
+ enum: string[];
135
122
  multiple?: boolean;
136
123
  }
137
124
  export interface JsonSchemaObject extends JsonBaseSchema {
@@ -8,13 +8,11 @@ export declare class PluginWorker {
8
8
  private configService;
9
9
  private socketService;
10
10
  private started;
11
- private manuallyKilled;
12
11
  private shuttingDown;
13
12
  private _status;
14
13
  get status(): PLUGIN_STATUS;
15
14
  constructor(plugin: Plugin);
16
15
  start(): Promise<void>;
17
- stop(): Promise<void>;
18
16
  teardown(): Promise<void>;
19
17
  restart(): Promise<void>;
20
18
  getPID(): number;
@@ -1,26 +1,31 @@
1
- import { CameraDeviceHub } from '../../camera';
1
+ import { CameraController } from '../../camera';
2
2
  import type { Camera } from '../../api/database/types';
3
- import type { StateValues, OnSetEvent, PrebufferType, CameraDelegate } from '../../camera/types';
4
3
  import type { IceServer } from '../../services/config/types';
5
- export declare class CameraDeviceClientProxy extends CameraDeviceHub {
6
- private removed;
4
+ import type { ZmqInfo } from '../../plugins/types';
5
+ import type { PluginAPI } from '../../plugins/api';
6
+ import type { StateValues, OnSetEvent, CameraSource } from '../../camera/types';
7
+ export declare class CameraDeviceClientProxy extends CameraController {
7
8
  private api;
9
+ private logger;
8
10
  private dealer;
9
11
  private subscriber;
10
12
  private messageQueue;
11
13
  private dealerId;
12
- private subscriberId;
14
+ private subscriberIds;
13
15
  private pluginID;
14
- private close?;
15
- constructor(camera: Camera, pluginId: string, pluginName: string, routerAddress: string, publisherAddress: string, serverPublicKey: string);
16
- configureDelegate(delegate: CameraDelegate): void;
17
- setPrebufferSource(sourceName: string, address: string | null, type: PrebufferType): Promise<void>;
18
- removePrebufferSource(sourceName: string, type: 'recording' | 'stream'): Promise<void>;
19
- removePrebufferSources(): Promise<void>;
16
+ private routerAddress;
17
+ private publisherAddress;
18
+ get sources(): CameraSource[];
19
+ constructor(api: PluginAPI, camera: Camera, pluginId: string, pluginName: string, proxy: ZmqInfo);
20
+ connect(): Promise<void>;
21
+ disconnect(): Promise<void>;
22
+ reboot(): Promise<void>;
20
23
  getFfmpegPath(): Promise<string>;
21
24
  getIceServers(): Promise<IceServer[]>;
25
+ snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
22
26
  updateState<T extends keyof StateValues>(stateName: T, eventData: OnSetEvent<T>): Promise<void>;
23
27
  refreshStates(): Promise<void>;
28
+ close(): void;
24
29
  private handleRouterRequest;
25
30
  private listenToSubscriberEvents;
26
31
  private onRequest;
@@ -1,23 +1,24 @@
1
1
  import { CameraDeviceClientProxy } from '../client/cameraDevice';
2
2
  import type { CameraConfig, CameraDevice } from '../../camera/types';
3
+ import type { PluginLogger } from '../../services/logger';
4
+ import type { ZmqInfo } from '../../plugins/types';
3
5
  import type { DeviceManagerProxyMethods, DeviceManagerProxyEventCallbacks, DeviceManagerProxyMethodsListener } from '../types';
6
+ import { PluginAPI } from '../../plugins/api';
4
7
  export declare class DeviceManager implements DeviceManagerProxyMethods, DeviceManagerProxyMethodsListener {
5
8
  private api;
6
9
  private logger;
7
10
  private dealer;
8
11
  private subscriber;
9
12
  private messageQueue;
10
- private routerAddress;
11
- private publisherAddress;
12
- private serverPublicKey;
13
+ private proxy;
13
14
  private pluginId;
14
15
  private pluginName;
15
16
  private dealerId;
16
- private subscriberId;
17
+ private subscriberIds;
17
18
  private MAX_LISTENERS_PER_EVENT;
18
19
  private devices;
19
20
  private eventListeners;
20
- constructor(pluginId: string, pluginName: string, routerAddress: string, publisherAddress: string, serverPublicKey: string, cameraDevices?: CameraDeviceClientProxy[]);
21
+ constructor(api: PluginAPI, logger: PluginLogger, pluginId: string, pluginName: string, proxy: ZmqInfo);
21
22
  getCameraById(id: string): Promise<CameraDevice | undefined>;
22
23
  getCameraByName(name: string): Promise<CameraDevice | undefined>;
23
24
  createCamera(cameraConfig: CameraConfig): Promise<CameraDevice>;
@@ -26,6 +27,7 @@ export declare class DeviceManager implements DeviceManagerProxyMethods, DeviceM
26
27
  listen<E extends keyof DeviceManagerProxyEventCallbacks>(eventType: E, callback: DeviceManagerProxyEventCallbacks[E]): void;
27
28
  removeListener<E extends keyof DeviceManagerProxyEventCallbacks>(eventType: E, callbackToRemove: DeviceManagerProxyEventCallbacks[E]): void;
28
29
  removeAllListeners<E extends keyof DeviceManagerProxyEventCallbacks>(eventType?: E): void;
30
+ configureCameras(cameraDevices: CameraDeviceClientProxy[]): void;
29
31
  private handleRouterRequest;
30
32
  private listenToSubscriberEvents;
31
33
  private onRequest;
@@ -1,18 +1,20 @@
1
+ import type { ZmqInfo } from '../../plugins/types';
2
+ import type { PluginLogger } from '../../services/logger';
1
3
  import type { PluginsManagerProxyMethods, PluginsManagerProxyMethodsListener, PluginsManagerProxyEventCallbacks } from '../types';
4
+ import type { PluginAPI } from '../../plugins/api';
2
5
  export declare class PluginsManager implements PluginsManagerProxyMethods, PluginsManagerProxyMethodsListener {
3
6
  private api;
4
7
  private logger;
5
- private plugin?;
6
8
  private dealer;
7
9
  private subscriber;
8
10
  private messageQueue;
9
11
  private pluginId;
10
12
  private pluginName;
11
13
  private dealerId;
12
- private subscriberId;
14
+ private subscriberIds;
13
15
  private MAX_LISTENERS_PER_EVENT;
14
16
  private eventListeners;
15
- constructor(pluginId: string, pluginName: string, routerAddress: string, publisherAddress: string, serverPublicKey: string);
17
+ constructor(api: PluginAPI, logger: PluginLogger, pluginId: string, pluginName: string, proxy: ZmqInfo);
16
18
  listen<E extends keyof PluginsManagerProxyEventCallbacks>(eventType: E, callback: PluginsManagerProxyEventCallbacks[E]): void;
17
19
  removeListener<E extends keyof PluginsManagerProxyEventCallbacks>(eventType: E, callbackToRemove: PluginsManagerProxyEventCallbacks[E]): void;
18
20
  removeAllListeners<E extends keyof PluginsManagerProxyEventCallbacks>(eventType?: E): void;
@@ -4,10 +4,12 @@ export declare class ClientMessageQueue {
4
4
  private logger;
5
5
  private dealer;
6
6
  private requestHandler;
7
+ private aborted;
7
8
  private isProcessing;
8
9
  private queue;
9
10
  private pendingResponses;
10
11
  constructor(requestHandler: (message: ProxyMessageStructure) => void, dealer: Dealer);
12
+ abortQueue(): void;
11
13
  enqueue(message: ProxyMessageStructure): Promise<any>;
12
14
  private processQueue;
13
15
  private listenToRouter;
@@ -1,4 +1,7 @@
1
1
  import type { SystemManagerProxyMethods, SystemManagerProxyMethodsListener, SystemManagerProxyEventCallbacks } from '../types';
2
+ import type { PluginLogger } from '../../services/logger';
3
+ import type { ZmqInfo } from '../../plugins/types';
4
+ import { PluginAPI } from '../../plugins/api';
2
5
  export declare class SystemManager implements SystemManagerProxyMethods, SystemManagerProxyMethodsListener {
3
6
  private api;
4
7
  private logger;
@@ -8,10 +11,10 @@ export declare class SystemManager implements SystemManagerProxyMethods, SystemM
8
11
  private pluginId;
9
12
  private pluginName;
10
13
  private dealerId;
11
- private subscriberId;
14
+ private subscriberIds;
12
15
  private MAX_LISTENERS_PER_EVENT;
13
16
  private eventListeners;
14
- constructor(pluginId: string, pluginName: string, routerAddress: string, publisherAddress: string, serverPublicKey: string);
17
+ constructor(api: PluginAPI, logger: PluginLogger, pluginId: string, pluginName: string, proxy: ZmqInfo);
15
18
  listen<E extends keyof SystemManagerProxyEventCallbacks>(eventType: E, callback: SystemManagerProxyEventCallbacks[E]): void;
16
19
  removeListener<E extends keyof SystemManagerProxyEventCallbacks>(eventType: E, callbackToRemove: SystemManagerProxyEventCallbacks[E]): void;
17
20
  removeAllListeners<E extends keyof SystemManagerProxyEventCallbacks>(eventType?: E): void;
@@ -23,7 +23,7 @@ export declare class ProxyServer {
23
23
  publishCameraEvent<K extends keyof StateValues>(cameraId: string, stateName: K, data: {
24
24
  newEvent: StateValues[K];
25
25
  oldEvent: StateValues[K];
26
- }): Promise<void>;
27
- publishCameraEvent(cameraId: string, type: CameraDeviceListenerMessagePayload['type'], data?: any): Promise<void>;
26
+ }, targetId?: string): Promise<void>;
27
+ publishCameraEvent(cameraId: string, type: CameraDeviceListenerMessagePayload['type'], data?: any, targetId?: string): Promise<void>;
28
28
  private isCameraState;
29
29
  }
@@ -1,11 +1,10 @@
1
1
  /// <reference types="pouchdb-core" />
2
2
  /// <reference types="node" />
3
- import type { OnSetEvent, StateValues } from '../../camera/types';
3
+ import type { OnSetEvent, StateValues, StreamInfo } from '../../camera/types';
4
4
  import type { IceServer } from '../../services/config/types';
5
- import type { FfmpegOptions, PrebufferType, CameraDelegate } from '../../camera/types';
5
+ import type { FfmpegOptions, CameraDelegate, CameraPrebufferDelegate, PrebufferType } from '../../camera/types';
6
6
  import type { CameraDeviceProxyMethods, ProxyMessageStructure } from '../types';
7
7
  import type { MessageQueue } from '../queue';
8
- import type { CameraDeviceHub } from '../../camera';
9
8
  import type { Camera } from '../../api/database/types';
10
9
  export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
11
10
  private api;
@@ -14,75 +13,86 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
14
13
  private pluginsService;
15
14
  private messageQueue;
16
15
  constructor(messageQueue: MessageQueue);
17
- snapshot(data: {
18
- prebuffer?: boolean;
16
+ connect(data: {
19
17
  cameraId: string;
20
- pluginId: string;
21
- ws?: boolean;
22
- }): Promise<ArrayBuffer>;
23
- setPrebufferSource(data: {
18
+ pluginId?: string;
19
+ ws?: boolean | undefined;
20
+ }): Promise<void>;
21
+ disconnect(data: {
22
+ cameraId: string;
23
+ pluginId?: string | undefined;
24
+ ws?: boolean | undefined;
25
+ }): Promise<void>;
26
+ reboot(data: {
27
+ cameraId: string;
28
+ pluginId?: string;
29
+ ws?: boolean | undefined;
30
+ }): Promise<void>;
31
+ getStreamInfo(data: {
32
+ sourceName: string;
33
+ cameraId: string;
34
+ pluginId?: string;
35
+ ws?: boolean | undefined;
36
+ }): Promise<StreamInfo | undefined>;
37
+ isPrebuffering(data: {
24
38
  sourceName: string;
25
- address: string;
26
39
  type: PrebufferType;
27
40
  cameraId: string;
28
- pluginId: string;
29
- ws?: boolean;
30
- }): Promise<void>;
31
- removePrebufferSource(data: {
41
+ pluginId?: string;
42
+ ws?: boolean | undefined;
43
+ }): Promise<boolean>;
44
+ getPrebufferRawUrl(data: {
32
45
  sourceName: string;
33
46
  type: PrebufferType;
34
47
  cameraId: string;
35
- pluginId: string;
36
- ws?: boolean;
37
- }): Promise<void>;
38
- removePrebufferSources(data: {
48
+ pluginId?: string;
49
+ ws?: boolean | undefined;
50
+ }): Promise<string | undefined>;
51
+ getFffmpegPath(): string;
52
+ getIceServers(): IceServer[];
53
+ snapshot(data: {
54
+ forceNew?: boolean;
39
55
  cameraId: string;
40
- pluginId: string;
56
+ pluginId?: string;
41
57
  ws?: boolean;
42
- }): Promise<void>;
43
- getFffmpegPath(data: {
58
+ }): Promise<ArrayBuffer>;
59
+ streamVideo(data: {
60
+ sourceName: string;
61
+ options: FfmpegOptions;
44
62
  cameraId: string;
45
- pluginId: string;
63
+ pluginId?: string;
46
64
  ws?: boolean;
47
- }): string;
48
- getIceServers(data: {
65
+ }): Promise<void>;
66
+ recordToFile(data: {
67
+ sourceName: string;
68
+ outputPath: string;
69
+ duration?: number;
49
70
  cameraId: string;
50
- pluginId: string;
71
+ pluginId?: string;
51
72
  ws?: boolean;
52
- }): IceServer[];
73
+ }): Promise<void>;
53
74
  updateState<T extends keyof StateValues>(data: {
54
75
  stateName: T;
55
76
  eventData: OnSetEvent<T>;
56
77
  cameraId: string;
57
- pluginId: string;
78
+ pluginId?: string;
58
79
  ws?: boolean;
59
80
  }): Promise<void>;
60
81
  refreshStates(data: {
61
82
  cameraId: string;
62
- pluginId: string;
83
+ pluginId?: string;
63
84
  ws?: boolean;
64
85
  }): Promise<{
65
86
  camera: Camera;
66
87
  states: StateValues;
67
88
  }>;
68
- streamVideo(data: {
69
- sourceName: string;
70
- options: FfmpegOptions;
71
- cameraId: string;
72
- pluginId: string;
73
- ws?: boolean;
74
- }): Promise<void>;
75
- recordToFile(data: {
76
- sourceName: string;
77
- outputPath: string;
78
- duration?: number;
79
- cameraId: string;
80
- pluginId: string;
81
- ws?: boolean;
82
- }): Promise<void>;
83
- onRequestSnapshotRequest(cameraDevice: CameraDeviceHub, ...args: Parameters<CameraDelegate['snapshotRequest']>): Promise<Buffer>;
84
- onRequestPrepareStream(cameraDevice: CameraDeviceHub, ...args: Parameters<CameraDelegate['prepareStream']>): Promise<void>;
85
- onRequestWebRTCOffer(cameraDevice: CameraDeviceHub, ...args: Parameters<CameraDelegate['onOffer']>): Promise<string>;
86
- onRequestWebRTCIceCandidates(cameraDevice: CameraDeviceHub, ...args: Parameters<CameraDelegate['onCandidates']>): Promise<void>;
89
+ onRequestReboot(pluginId: string, cameraId: string, ...args: Parameters<CameraDelegate['reboot']>): Promise<Buffer>;
90
+ onRequestGetStreamInfo(pluginId: string, cameraId: string, ...args: Parameters<CameraPrebufferDelegate['getStreamInfo']>): Promise<StreamInfo | undefined>;
91
+ onRequestIsPrebuffering(pluginId: string, cameraId: string, ...args: Parameters<CameraPrebufferDelegate['isPrebuffering']>): Promise<boolean>;
92
+ onRequestGetRawUrl(pluginId: string, cameraId: string, ...args: Parameters<CameraPrebufferDelegate['getPrebufferRawUrl']>): Promise<string | undefined>;
93
+ onRequestSnapshotRequest(pluginId: string, cameraId: string, ...args: Parameters<CameraDelegate['snapshotRequest']>): Promise<Buffer>;
94
+ onRequestPrepareStream(pluginId: string, cameraId: string, ...args: Parameters<CameraDelegate['prepareStream']>): Promise<void>;
95
+ onRequestWebRTCOffer(pluginId: string, cameraId: string, ...args: Parameters<CameraDelegate['onOffer']>): Promise<string>;
96
+ onRequestWebRTCIceCandidates(pluginId: string, cameraId: string, ...args: Parameters<CameraDelegate['onCandidates']>): Promise<void>;
87
97
  handleMessage(message: ProxyMessageStructure): Promise<void>;
88
98
  }
@@ -1,4 +1,5 @@
1
- import { type CameraStorage, type BasePlugin } from '../../plugins/types';
1
+ import type { CameraStorage } from '../../plugins/cameraStorage';
2
+ import type { BasePlugin } from '../../plugins/base';
2
3
  import type { MethodKeys, ProxyMessageStructure } from '../types';
3
4
  import type { MessageQueue } from '../queue';
4
5
  export declare class PluginProxy {
@@ -6,6 +7,6 @@ export declare class PluginProxy {
6
7
  private messageQueue;
7
8
  constructor(messageQueue: MessageQueue);
8
9
  onRequestPluginFn<K extends Exclude<MethodKeys<BasePlugin>, 'configureCameras'>>(pluginId: string, fn: K, ...args: Parameters<BasePlugin[K]>): Promise<ReturnType<BasePlugin[K]>>;
9
- onRequestStorageFn<K extends MethodKeys<CameraStorage>>(pluginId: string, cameraId: string, fn: K, ...args: Parameters<CameraStorage[K]>): Promise<ReturnType<CameraStorage[K]>>;
10
+ onRequestStorageFn<K extends MethodKeys<CameraStorage>>(pluginId: string, cameraId: string, fn: K, ...args: Parameters<CameraStorage[K]>): Promise<Awaited<ReturnType<CameraStorage[K]>>>;
10
11
  handleMessage(message: ProxyMessageStructure): Promise<void>;
11
12
  }
@@ -4,10 +4,12 @@ export declare class MessageQueue {
4
4
  private logger;
5
5
  private proxyServer;
6
6
  private router;
7
+ private aborted;
7
8
  private isProcessing;
8
9
  private queue;
9
10
  private pendingResponses;
10
11
  constructor(proxyServer: ProxyServer);
12
+ abortQueue(): void;
11
13
  enqueue(message: ProxyMessageStructure): Promise<any>;
12
14
  private processQueue;
13
15
  private listenToDealer;
@@ -1,6 +1,6 @@
1
1
  import type { Camera } from '../api/database/types';
2
2
  import type { CameraExtension } from '../plugins/types';
3
- import type { CameraConfig, OnSetEvent, StateValues, CameraDevice, FfmpegOptions, PrebufferType } from '../camera/types';
3
+ import type { CameraConfig, OnSetEvent, StateValues, CameraDevice, FfmpegOptions, PrebufferType, StreamInfo } from '../camera/types';
4
4
  import type { IceServer } from '../services/config/types';
5
5
  export type MethodKeys<T> = {
6
6
  [K in keyof T]: T[K] extends Function ? K : never;
@@ -18,7 +18,7 @@ export interface ProxyMessageStructure {
18
18
  pluginId: string;
19
19
  type: 'request' | 'reply';
20
20
  proxy: 'system' | 'device' | 'plugins' | 'camera';
21
- client: 'pluginFn' | 'pluginStorage' | 'cameraFn' | 'cameraDelegate' | 'device' | 'system';
21
+ client: 'pluginFn' | 'pluginStorage' | 'cameraFn' | 'cameraDelegate' | 'cameraPrebufferDelegate' | 'device' | 'system';
22
22
  fn: string;
23
23
  args: any;
24
24
  timeout: number;
@@ -138,7 +138,7 @@ export interface PluginsManagerProxyGenericEvent<K extends keyof PluginsManagerP
138
138
  type: K;
139
139
  data: PluginsManagerProxyEvents[K];
140
140
  }
141
- export type CameraDeviceListenerSocketEventType = 'updateDevice' | 'updateState' | 'updateOptions';
141
+ export type CameraDeviceListenerSocketEventType = 'updateDevice' | 'updateState';
142
142
  export interface CameraDeviceListenerStatePayload<K extends keyof StateValues> {
143
143
  stateName: K;
144
144
  data: {
@@ -147,67 +147,66 @@ export interface CameraDeviceListenerStatePayload<K extends keyof StateValues> {
147
147
  };
148
148
  }
149
149
  export interface CameraDeviceListenerMessagePayload {
150
- type: 'removed' | 'updated' | 'updatedSources';
150
+ type: 'removed' | 'updated' | 'cameraState';
151
151
  data?: any;
152
152
  }
153
153
  export interface CameraDeviceProxyMethods {
154
- snapshot(data: {
155
- sourceName: string;
156
- prebuffer?: boolean;
154
+ connect(data: {
157
155
  cameraId: string;
158
- pluginId: string;
156
+ pluginId?: string;
159
157
  ws?: boolean;
160
- }): Promise<ArrayBuffer>;
161
- setPrebufferSource(data: {
158
+ }): Promise<void>;
159
+ disconnect(data: {
160
+ cameraId: string;
161
+ pluginId?: string;
162
+ ws?: boolean;
163
+ }): Promise<void>;
164
+ reboot(data: {
165
+ cameraId: string;
166
+ pluginId?: string;
167
+ ws?: boolean;
168
+ }): Promise<void>;
169
+ isPrebuffering(data: {
162
170
  sourceName: string;
163
- address: string;
164
171
  type: PrebufferType;
165
172
  cameraId: string;
166
- pluginId: string;
173
+ pluginId?: string;
167
174
  ws?: boolean;
168
- }): Promise<void>;
169
- removePrebufferSource(data: {
175
+ }): Promise<boolean>;
176
+ getPrebufferRawUrl(data: {
170
177
  sourceName: string;
171
178
  type: PrebufferType;
172
179
  cameraId: string;
173
- pluginId: string;
180
+ pluginId?: string;
174
181
  ws?: boolean;
175
- }): Promise<void>;
176
- removePrebufferSources(data: {
182
+ }): Promise<string | undefined>;
183
+ getStreamInfo(data: {
184
+ sourceName: string;
177
185
  cameraId: string;
178
- pluginId: string;
186
+ pluginId?: string;
179
187
  ws?: boolean;
180
- }): Promise<void>;
188
+ }): Promise<StreamInfo | undefined>;
181
189
  getFffmpegPath(data: {
182
190
  cameraId: string;
183
- pluginId: string;
191
+ pluginId?: string;
184
192
  ws?: boolean;
185
193
  }): string;
186
194
  getIceServers(data: {
187
195
  cameraId: string;
188
- pluginId: string;
196
+ pluginId?: string;
189
197
  ws?: boolean;
190
198
  }): IceServer[];
191
- updateState<T extends keyof StateValues>(data: {
192
- stateName: T;
193
- eventData: OnSetEvent<T>;
194
- cameraId: string;
195
- pluginId: string;
196
- ws?: boolean;
197
- }): void;
198
- refreshStates(data: {
199
+ snapshot(data: {
200
+ forceNew?: boolean;
199
201
  cameraId: string;
200
- pluginId: string;
202
+ pluginId?: string;
201
203
  ws?: boolean;
202
- }): Promise<{
203
- camera: Camera;
204
- states: StateValues;
205
- }>;
204
+ }): Promise<ArrayBuffer>;
206
205
  streamVideo(data: {
207
206
  sourceName: string;
208
207
  options: FfmpegOptions;
209
208
  cameraId: string;
210
- pluginId: string;
209
+ pluginId?: string;
211
210
  ws?: boolean;
212
211
  }): Promise<void>;
213
212
  recordToFile(data: {
@@ -215,9 +214,24 @@ export interface CameraDeviceProxyMethods {
215
214
  outputPath: string;
216
215
  duration?: number;
217
216
  cameraId: string;
218
- pluginId: string;
217
+ pluginId?: string;
219
218
  ws?: boolean;
220
219
  }): Promise<void>;
220
+ updateState<T extends keyof StateValues>(data: {
221
+ stateName: T;
222
+ eventData: OnSetEvent<T>;
223
+ cameraId: string;
224
+ pluginId?: string;
225
+ ws?: boolean;
226
+ }): void;
227
+ refreshStates(data: {
228
+ cameraId: string;
229
+ pluginId?: string;
230
+ ws?: boolean;
231
+ }): Promise<{
232
+ camera: Camera;
233
+ states: StateValues;
234
+ }>;
221
235
  }
222
236
  export type CameraDeviceProxyMethodNames = MethodKeys<CameraDeviceProxyMethods>;
223
237
  export type CameraDeviceProxyEventCallbacks = {
@@ -30,7 +30,7 @@ export interface IConfig {
30
30
  settings: Partial<InterfaceSettings>;
31
31
  plugins: Partial<PluginsSettings>;
32
32
  }
33
- export type LoggingLevel = 'info' | 'debug' | 'warn' | 'error' | 'verbose';
33
+ export type LoggingLevel = 'info' | 'debug' | 'warn' | 'error' | 'trace';
34
34
  export interface Logger {
35
35
  level?: LoggingLevel;
36
36
  disableTimestamps?: boolean;
@@ -12,17 +12,18 @@ export declare class PluginLogger {
12
12
  warn(...args: any[]): void;
13
13
  attention(...args: any[]): void;
14
14
  debug(...args: any[]): void;
15
+ trace(...args: any[]): void;
15
16
  }
16
17
  export declare class Logger {
17
18
  private _loggerPrefix;
18
19
  private _debugEnabled;
19
- private _verboseLogging;
20
+ private _traceLogging;
20
21
  private _disableTimestamps;
21
22
  notifications: UiNotification[];
22
23
  get debugEnabled(): boolean;
23
24
  set debugEnabled(state: boolean);
24
- get verboseLogging(): boolean;
25
- set verboseLogging(state: boolean);
25
+ get traceLogging(): boolean;
26
+ set traceLogging(state: boolean);
26
27
  get disableTimestamps(): boolean;
27
28
  set disableTimestamps(state: boolean);
28
29
  get prefix(): string;
@@ -32,7 +33,7 @@ export declare class Logger {
32
33
  warn(...args: any[]): void;
33
34
  attention(...args: any[]): void;
34
35
  debug(...args: any[]): void;
35
- verbose(...args: any[]): void;
36
+ trace(...args: any[]): void;
36
37
  notify(title: string, text: string, type: LoggingLevel, link: string, socket?: Socket): Promise<void>;
37
38
  private setNotification;
38
39
  private formatDateTime;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camera.ui/browser",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "description": "camera.ui browser client",
5
5
  "author": "seydx (https://github.com/seydx/camera.ui)",
6
6
  "main": "./dist/bundle.js",
@@ -28,10 +28,10 @@
28
28
  "bufferutil": "^4.0.8",
29
29
  "rimraf": "^5.0.5",
30
30
  "ts-loader": "^9.5.1",
31
- "typescript": "^5.3.3",
32
- "updates": "^15.1.1",
31
+ "typescript": "^5.4.2",
32
+ "updates": "^15.3.1",
33
33
  "utf-8-validate": "^6.0.3",
34
- "webpack": "^5.90.0",
34
+ "webpack": "^5.90.3",
35
35
  "webpack-cli": "^5.1.4"
36
36
  },
37
37
  "bugs": {
@@ -1,18 +0,0 @@
1
- import 'reflect-metadata';
2
- import { Plugin } from './plugin';
3
- import { BasePlugin } from './base';
4
- export declare class PluginChild {
5
- private displayName;
6
- plugin?: Plugin;
7
- pluginConstructor?: BasePlugin;
8
- private api?;
9
- private storage?;
10
- private pluginManager?;
11
- private logger;
12
- constructor();
13
- private start;
14
- private stop;
15
- private sendMessage;
16
- private processHandler;
17
- private signalHander;
18
- }