@camera.ui/browser 0.0.36 → 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.
@@ -1,15 +1,16 @@
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;
@@ -17,7 +18,7 @@ export declare class DeviceManager implements DeviceManagerProxyMethods, DeviceM
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,8 +1,10 @@
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;
@@ -12,7 +14,7 @@ export declare class PluginsManager implements PluginsManagerProxyMethods, Plugi
12
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;
@@ -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;
@@ -11,7 +14,7 @@ export declare class SystemManager implements SystemManagerProxyMethods, SystemM
11
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;
@@ -13,52 +13,54 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
13
13
  private pluginsService;
14
14
  private messageQueue;
15
15
  constructor(messageQueue: MessageQueue);
16
+ connect(data: {
17
+ cameraId: string;
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>;
16
26
  reboot(data: {
17
27
  cameraId: string;
18
- pluginId: string;
28
+ pluginId?: string;
19
29
  ws?: boolean | undefined;
20
30
  }): Promise<void>;
21
31
  getStreamInfo(data: {
22
32
  sourceName: string;
23
33
  cameraId: string;
24
- pluginId: string;
34
+ pluginId?: string;
25
35
  ws?: boolean | undefined;
26
36
  }): Promise<StreamInfo | undefined>;
27
37
  isPrebuffering(data: {
28
38
  sourceName: string;
29
39
  type: PrebufferType;
30
40
  cameraId: string;
31
- pluginId: string;
41
+ pluginId?: string;
32
42
  ws?: boolean | undefined;
33
43
  }): Promise<boolean>;
34
44
  getPrebufferRawUrl(data: {
35
45
  sourceName: string;
36
46
  type: PrebufferType;
37
47
  cameraId: string;
38
- pluginId: string;
48
+ pluginId?: string;
39
49
  ws?: boolean | undefined;
40
50
  }): Promise<string | undefined>;
41
- getFffmpegPath(data: {
42
- cameraId: string;
43
- pluginId: string;
44
- ws?: boolean;
45
- }): string;
46
- getIceServers(data: {
47
- cameraId: string;
48
- pluginId: string;
49
- ws?: boolean;
50
- }): IceServer[];
51
+ getFffmpegPath(): string;
52
+ getIceServers(): IceServer[];
51
53
  snapshot(data: {
52
54
  forceNew?: boolean;
53
55
  cameraId: string;
54
- pluginId: string;
56
+ pluginId?: string;
55
57
  ws?: boolean;
56
58
  }): Promise<ArrayBuffer>;
57
59
  streamVideo(data: {
58
60
  sourceName: string;
59
61
  options: FfmpegOptions;
60
62
  cameraId: string;
61
- pluginId: string;
63
+ pluginId?: string;
62
64
  ws?: boolean;
63
65
  }): Promise<void>;
64
66
  recordToFile(data: {
@@ -66,19 +68,19 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
66
68
  outputPath: string;
67
69
  duration?: number;
68
70
  cameraId: string;
69
- pluginId: string;
71
+ pluginId?: string;
70
72
  ws?: boolean;
71
73
  }): Promise<void>;
72
74
  updateState<T extends keyof StateValues>(data: {
73
75
  stateName: T;
74
76
  eventData: OnSetEvent<T>;
75
77
  cameraId: string;
76
- pluginId: string;
78
+ pluginId?: string;
77
79
  ws?: boolean;
78
80
  }): Promise<void>;
79
81
  refreshStates(data: {
80
82
  cameraId: string;
81
- pluginId: string;
83
+ pluginId?: string;
82
84
  ws?: boolean;
83
85
  }): Promise<{
84
86
  camera: Camera;
@@ -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
  }
@@ -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,56 +147,66 @@ export interface CameraDeviceListenerStatePayload<K extends keyof StateValues> {
147
147
  };
148
148
  }
149
149
  export interface CameraDeviceListenerMessagePayload {
150
- type: 'removed' | 'updated';
150
+ type: 'removed' | 'updated' | 'cameraState';
151
151
  data?: any;
152
152
  }
153
153
  export interface CameraDeviceProxyMethods {
154
+ connect(data: {
155
+ cameraId: string;
156
+ pluginId?: string;
157
+ ws?: boolean;
158
+ }): Promise<void>;
159
+ disconnect(data: {
160
+ cameraId: string;
161
+ pluginId?: string;
162
+ ws?: boolean;
163
+ }): Promise<void>;
154
164
  reboot(data: {
155
165
  cameraId: string;
156
- pluginId: string;
166
+ pluginId?: string;
157
167
  ws?: boolean;
158
168
  }): Promise<void>;
159
169
  isPrebuffering(data: {
160
170
  sourceName: string;
161
171
  type: PrebufferType;
162
172
  cameraId: string;
163
- pluginId: string;
173
+ pluginId?: string;
164
174
  ws?: boolean;
165
175
  }): Promise<boolean>;
166
176
  getPrebufferRawUrl(data: {
167
177
  sourceName: string;
168
178
  type: PrebufferType;
169
179
  cameraId: string;
170
- pluginId: string;
180
+ pluginId?: string;
171
181
  ws?: boolean;
172
182
  }): Promise<string | undefined>;
173
183
  getStreamInfo(data: {
174
184
  sourceName: string;
175
185
  cameraId: string;
176
- pluginId: string;
186
+ pluginId?: string;
177
187
  ws?: boolean;
178
188
  }): Promise<StreamInfo | undefined>;
179
189
  getFffmpegPath(data: {
180
190
  cameraId: string;
181
- pluginId: string;
191
+ pluginId?: string;
182
192
  ws?: boolean;
183
193
  }): string;
184
194
  getIceServers(data: {
185
195
  cameraId: string;
186
- pluginId: string;
196
+ pluginId?: string;
187
197
  ws?: boolean;
188
198
  }): IceServer[];
189
199
  snapshot(data: {
190
200
  forceNew?: boolean;
191
201
  cameraId: string;
192
- pluginId: string;
202
+ pluginId?: string;
193
203
  ws?: boolean;
194
204
  }): Promise<ArrayBuffer>;
195
205
  streamVideo(data: {
196
206
  sourceName: string;
197
207
  options: FfmpegOptions;
198
208
  cameraId: string;
199
- pluginId: string;
209
+ pluginId?: string;
200
210
  ws?: boolean;
201
211
  }): Promise<void>;
202
212
  recordToFile(data: {
@@ -204,19 +214,19 @@ export interface CameraDeviceProxyMethods {
204
214
  outputPath: string;
205
215
  duration?: number;
206
216
  cameraId: string;
207
- pluginId: string;
217
+ pluginId?: string;
208
218
  ws?: boolean;
209
219
  }): Promise<void>;
210
220
  updateState<T extends keyof StateValues>(data: {
211
221
  stateName: T;
212
222
  eventData: OnSetEvent<T>;
213
223
  cameraId: string;
214
- pluginId: string;
224
+ pluginId?: string;
215
225
  ws?: boolean;
216
226
  }): void;
217
227
  refreshStates(data: {
218
228
  cameraId: string;
219
- pluginId: string;
229
+ pluginId?: string;
220
230
  ws?: boolean;
221
231
  }): Promise<{
222
232
  camera: Camera;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camera.ui/browser",
3
- "version": "0.0.36",
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",
@@ -29,7 +29,7 @@
29
29
  "rimraf": "^5.0.5",
30
30
  "ts-loader": "^9.5.1",
31
31
  "typescript": "^5.4.2",
32
- "updates": "^15.1.2",
32
+ "updates": "^15.3.1",
33
33
  "utf-8-validate": "^6.0.3",
34
34
  "webpack": "^5.90.3",
35
35
  "webpack-cli": "^5.1.4"
@@ -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
- }