@camera.ui/browser 0.0.33 → 0.0.35

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 (36) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/client/node/src/proxy/cameraDevice/cameraDevice.browser.d.ts +21 -9
  3. package/dist/client/node/src/proxy/cameraDevice/cameraDevice.node.d.ts +4 -1
  4. package/dist/src/api/database/types.d.ts +51 -17
  5. package/dist/src/api/go2rtc/api/application.d.ts +4 -3
  6. package/dist/src/api/go2rtc/api/config.d.ts +9 -0
  7. package/dist/src/api/go2rtc/api/snapshot.d.ts +6 -5
  8. package/dist/src/api/go2rtc/api/streams.d.ts +5 -5
  9. package/dist/src/api/go2rtc/index.d.ts +13 -3
  10. package/dist/src/api/go2rtc/queue.d.ts +10 -0
  11. package/dist/src/api/schemas/cameras.schema.d.ts +363 -7
  12. package/dist/src/api/schemas/config.schema.d.ts +3 -0
  13. package/dist/src/api/schemas/go2rtc.schema.d.ts +2 -2
  14. package/dist/src/api/services/cameras.service.d.ts +20 -7
  15. package/dist/src/api/services/plugins.service.d.ts +2 -0
  16. package/dist/src/api/types/index.d.ts +22 -3
  17. package/dist/src/camera/index.d.ts +23 -10
  18. package/dist/src/camera/types.d.ts +35 -17
  19. package/dist/src/plugins/cameraStorage.d.ts +24 -15
  20. package/dist/src/plugins/index.d.ts +0 -3
  21. package/dist/src/plugins/plugin.d.ts +1 -1
  22. package/dist/src/plugins/types.d.ts +16 -6
  23. package/dist/src/proxy/client/cameraDevice.d.ts +11 -8
  24. package/dist/src/proxy/client/deviceManager.d.ts +13 -12
  25. package/dist/src/proxy/client/pluginsManager.d.ts +9 -12
  26. package/dist/src/proxy/client/queue.d.ts +9 -6
  27. package/dist/src/proxy/client/systemManager.d.ts +9 -9
  28. package/dist/src/proxy/index.d.ts +13 -10
  29. package/dist/src/proxy/proxies/camera.d.ts +52 -21
  30. package/dist/src/proxy/proxies/plugin.d.ts +5 -4
  31. package/dist/src/proxy/proxies/server.d.ts +4 -9
  32. package/dist/src/proxy/queue.d.ts +9 -10
  33. package/dist/src/proxy/types.d.ts +70 -87
  34. package/dist/src/services/config/index.d.ts +2 -2
  35. package/dist/src/services/config/types.d.ts +2 -1
  36. package/package.json +2 -2
@@ -1,13 +1,14 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { StreamingSession } from './streaming/streaming-session';
3
- import type { Camera, CameraInput, CameraPublicProperties } from '../api/database/types';
3
+ import type { Camera, CameraSource, CameraPrebufferInput, CameraPublicProperties, CameraZone } from '../api/database/types';
4
4
  import type { ProxyServer } from '../proxy';
5
- import type { CameraDevice, BaseLogger, Input } from './types';
5
+ import type { CameraDevice, BaseLogger, CameraDelegate } from './types';
6
6
  import type { IceServer } from '../services/config/types';
7
7
  import type { StateValues, OnSetEvent, LightState, MotionState, AudioState, ObjectState, DoorbellState, SirenState, StreamingConnectionOptions, FfmpegOptions, PrebufferType } from './types';
8
8
  export declare class CameraDeviceHub implements CameraDevice {
9
9
  private proxy?;
10
10
  private cameraSubject;
11
+ private prebufferSubject;
11
12
  private lightState;
12
13
  private motionState;
13
14
  private audioState;
@@ -21,8 +22,10 @@ export declare class CameraDeviceHub implements CameraDevice {
21
22
  onDoorbellPressed: Observable<DoorbellState>;
22
23
  onSirenDetected: Observable<SirenState>;
23
24
  logger: BaseLogger;
25
+ delegate?: CameraDelegate;
24
26
  get id(): string;
25
27
  get nativeId(): string | undefined;
28
+ get pluginId(): string;
26
29
  get disabled(): boolean;
27
30
  get name(): string;
28
31
  get type(): string;
@@ -34,31 +37,41 @@ export declare class CameraDeviceHub implements CameraDevice {
34
37
  get hasAudioDetector(): boolean;
35
38
  get hasObjectDetector(): boolean;
36
39
  get hasPtz(): boolean;
37
- get sources(): Input[];
40
+ get motionZones(): CameraZone[];
41
+ get objectZones(): CameraZone[];
42
+ get sources(): CameraSource[];
38
43
  constructor(camera: Camera, logger?: BaseLogger, proxy?: ProxyServer);
39
- snapshot(sourceName?: string): Promise<ArrayBuffer>;
40
- setPrebufferSource(sourceName: string, address: string | null, type: PrebufferType, initialData?: boolean): Promise<void>;
44
+ getStreamSource(): CameraSource;
45
+ getSnapshotSource(): CameraSource;
46
+ getRecordingSource(): CameraSource;
47
+ getDetectionSource(): CameraSource;
48
+ configureDelegate(delegate: CameraDelegate): void;
49
+ snapshot(prebuffer?: boolean): Promise<ArrayBuffer>;
50
+ setPrebufferSource(sourceIdOrName: string, address: string, type: PrebufferType): Promise<void>;
51
+ removePrebufferSource(sourceIdOrName: string, type: 'recording' | 'stream'): Promise<void>;
52
+ removePrebufferSources(): Promise<void>;
41
53
  getFfmpegPath(): Promise<string>;
42
54
  getIceServers(): Promise<IceServer[]>;
43
- getValue<T extends keyof StateValues>(stateName: T): StateValues[T];
44
55
  createSession(sourceName: string, options?: StreamingConnectionOptions): Promise<StreamingSession>;
45
56
  streamVideo(sourceName: string, options: FfmpegOptions): Promise<StreamingSession>;
46
57
  recordToFile(sourceName: string, outputPath: string, duration?: number): Promise<void>;
58
+ getValue<T extends keyof StateValues>(stateName: T): StateValues[T];
47
59
  updateState<T extends keyof StateValues>(stateName: T, eventData: OnSetEvent<T>): Promise<void>;
48
60
  onStateChange<T extends keyof StateValues>(stateName: T): Observable<{
49
61
  newState: StateValues[T];
50
62
  oldState: StateValues[T];
51
63
  }>;
52
64
  onPropertyChange<T extends keyof CameraPublicProperties>(property: T): Observable<{
53
- oldState: Camera[T];
54
- newState: Camera[T];
65
+ oldData: Camera[T];
66
+ newData: Camera[T];
55
67
  }>;
56
- updateCamera(camera: Camera): void;
57
- updateSources(sources: CameraInput[]): void;
68
+ updateCamera(updatedCamera: Camera): void;
69
+ updatePrebufferSources(sources: CameraPrebufferInput[]): void;
58
70
  removeCamera(): void;
59
71
  removeAllListeners(): void;
60
72
  private createStateObservable;
61
73
  private subscribeToCameraChanges;
74
+ private subscribeToSourceChanges;
62
75
  private subscribeToStateChanges;
63
76
  private triggerProxyEvent;
64
77
  }
@@ -1,6 +1,8 @@
1
+ /// <reference types="pouchdb-core" />
2
+ /// <reference types="node" />
1
3
  import type { Observable, Subject } from 'rxjs';
2
4
  import type { ConnectionState, RTCIceCandidate } from 'werift';
3
- import type { CameraInput, Camera, CameraPublicProperties, CameraInputSettings } from '../api/database/types';
5
+ import type { Camera, CameraPublicProperties, CameraInputSettings, CameraZone, CameraSource } from '../api/database/types';
4
6
  import type { StreamingSession } from './streaming/streaming-session';
5
7
  export type SpawnInput = string | number;
6
8
  export type PrebufferType = 'recording' | 'stream';
@@ -35,9 +37,16 @@ export interface BasicPeerConnection {
35
37
  }
36
38
  export interface CameraDevice {
37
39
  id: string;
40
+ pluginId: string;
41
+ nativeId?: string;
38
42
  disabled: boolean;
39
43
  name: string;
40
- nativeId?: string;
44
+ type: string;
45
+ model: string;
46
+ sources: CameraSource[];
47
+ motionZones: CameraZone[];
48
+ objectZones: CameraZone[];
49
+ logger: BaseLogger;
41
50
  isCloud: boolean;
42
51
  hasLight: boolean;
43
52
  hasSiren: boolean;
@@ -45,35 +54,44 @@ export interface CameraDevice {
45
54
  hasAudioDetector: boolean;
46
55
  hasObjectDetector: boolean;
47
56
  hasPtz: boolean;
48
- type: string;
49
- model: string;
50
- sources: Input[];
51
- logger: BaseLogger;
52
57
  onLightDetected: Observable<LightState>;
53
58
  onMotionDetected: Observable<MotionState>;
54
59
  onAudioDetected: Observable<AudioState>;
55
60
  onObjectDetected: Observable<ObjectState>;
56
61
  onDoorbellPressed: Observable<DoorbellState>;
57
62
  onSirenDetected: Observable<SirenState>;
58
- snapshot(sourceName?: string): Promise<ArrayBuffer>;
59
- setPrebufferSource(sourceName: string, address: string | null, type: 'recording' | 'stream'): Promise<void>;
63
+ getStreamSource(): CameraSource;
64
+ getSnapshotSource(): CameraSource;
65
+ getRecordingSource(): CameraSource;
66
+ getDetectionSource(): CameraSource;
67
+ configureDelegate(delegate: CameraDelegate): void;
68
+ snapshot(prebuffer?: boolean): Promise<ArrayBuffer>;
69
+ setPrebufferSource(sourceName: string, address: string, type: 'recording' | 'stream'): Promise<void>;
70
+ removePrebufferSource(sourceName: string, type: 'recording' | 'stream'): Promise<void>;
71
+ removePrebufferSources(): Promise<void>;
60
72
  getFfmpegPath(): Promise<string>;
61
73
  getIceServers(): Promise<RTCIceServer[]>;
62
- getValue<T extends keyof StateValues>(stateName: T): StateValue<T>;
63
74
  createSession(sourceName: string, options?: StreamingConnectionOptions): Promise<StreamingSession>;
64
75
  streamVideo(sourceName: string, options: FfmpegOptions): Promise<StreamingSession>;
65
76
  recordToFile(sourceName: string, outputPath: string, duration?: number): Promise<void>;
77
+ getValue<T extends keyof StateValues>(stateName: T): StateValue<T>;
66
78
  updateState<T extends keyof StateValues>(stateName: T, eventData: OnSetEvent<T>): Promise<void>;
67
79
  onStateChange<T extends keyof StateValues>(stateName: T): Observable<{
68
80
  newState: StateValues[T];
69
81
  oldState: StateValues[T];
70
82
  }>;
71
83
  onPropertyChange<T extends keyof CameraPublicProperties>(property: T): Observable<{
72
- oldState: Camera[T];
73
- newState: Camera[T];
84
+ oldData: Camera[T];
85
+ newData: Camera[T];
74
86
  }>;
75
87
  removeAllListeners(): void;
76
88
  }
89
+ export interface CameraDelegate {
90
+ snapshotRequest(requestId: string): Promise<Buffer>;
91
+ prepareStream(requestId: string): Promise<void>;
92
+ onOffer(requestId: string, sdp: string): Promise<string>;
93
+ onCandidates(requestId: string, candidates: string): Promise<void>;
94
+ }
77
95
  export type Sdp = string;
78
96
  export type IceCandiate = string;
79
97
  export interface Go2RtcOfferMessage {
@@ -94,7 +112,7 @@ export interface ErrorMessage {
94
112
  }
95
113
  export type Go2RtcIncomingMessage = Go2RtcAnswerMessage | Go2RtcIceCandidateMessage | ErrorMessage;
96
114
  export type Go2RtcOutgoingMessage = Go2RtcOfferMessage | Go2RtcIceCandidateMessage;
97
- export interface CameraConfig {
115
+ export interface BaseCameraConfig {
98
116
  name: string;
99
117
  nativeId?: string;
100
118
  isCloud?: boolean;
@@ -102,12 +120,12 @@ export interface CameraConfig {
102
120
  hasSiren?: boolean;
103
121
  disabled?: boolean;
104
122
  model?: string;
105
- sources: CameraInputSettings[];
106
- }
107
- export interface Input extends CameraInput {
108
- readonly isStreamPrebuffering?: boolean;
109
- readonly isRecordingPrebuffering?: boolean;
110
123
  }
124
+ export type CameraConfig = (BaseCameraConfig & {
125
+ sources?: Omit<CameraInputSettings, '_id'>[];
126
+ }) | (BaseCameraConfig & {
127
+ delegate?: CameraDelegate;
128
+ });
111
129
  export interface BaseState {
112
130
  timestamp: number;
113
131
  lastTriggered: number;
@@ -1,11 +1,11 @@
1
1
  import type { API } from '../api';
2
2
  import type { PluginJsonSchemaForm, PluginJsonSchema, CameraStorage as CameraStorageMethods, SchemaConfig } from './types';
3
3
  export declare class CameraStorage implements CameraStorageMethods {
4
- schema: PluginJsonSchemaForm;
5
4
  private cameraId;
6
5
  private instance;
7
6
  private api;
8
7
  private db;
8
+ private _schema;
9
9
  private _values;
10
10
  constructor(api: API, instance: any, cameraId: string, schema?: PluginJsonSchemaForm);
11
11
  /**
@@ -13,6 +13,17 @@ export declare class CameraStorage implements CameraStorageMethods {
13
13
  * This will load the configuration from the database.
14
14
  */
15
15
  initializeStorage(): Promise<void>;
16
+ /**
17
+ * Get a value from the configuration by its key/path.
18
+ * If the schema has an onGet function, the onGet function will be called.
19
+ * If the onGet functions is undefined, the value from the configuration will be returned.
20
+ * If the schema has a default value, and the configuration value is undefined, the default value will be returned.
21
+ *
22
+ * @param path - The path to the configuration value.
23
+ * @returns The value from the configuration.
24
+ */
25
+ getValue<T = string>(path: string, defaultValue: T): Promise<T> | T;
26
+ getValue<T = string>(path: string, defaultValue?: T): Promise<T> | T | undefined;
16
27
  /**
17
28
  * Set a new value for a given key/path in the configuration.
18
29
  * If the schema of the value has an onSet function, and the value has changed, the onSet function will be called.
@@ -23,15 +34,12 @@ export declare class CameraStorage implements CameraStorageMethods {
23
34
  */
24
35
  setValue<T = string>(path: string, newValue: T): Promise<void>;
25
36
  /**
26
- * Get a value from the configuration by its key/path.
27
- * If the schema has an onGet function, the onGet function will be called.
28
- * If the onGet functions is undefined, the value from the configuration will be returned.
29
- * If the schema has a default value, and the configuration value is undefined, the default value will be returned.
37
+ * Check if a value exists by its config path/key.
30
38
  *
31
- * @param path - The path to the configuration value.
32
- * @returns The value from the configuration.
39
+ * @param path - The path to the value to check.
40
+ * @returns True if the value exists, false otherwise.
33
41
  */
34
- getValue<T = string>(path: string): T | Promise<T> | undefined;
42
+ hasValue(path: string): boolean;
35
43
  /**
36
44
  * Get the root schema and configuration.
37
45
  * This will also call the onGet functions for the schema.
@@ -73,6 +81,13 @@ export declare class CameraStorage implements CameraStorageMethods {
73
81
  * @param schema - The new schema to set.
74
82
  */
75
83
  changeSchema(path: string, newSchema: Partial<PluginJsonSchema>): Promise<void>;
84
+ /**
85
+ * Get a schema by its config path/key.
86
+ *
87
+ * @param path - The path to the schema to get.
88
+ * @returns The schema.
89
+ */
90
+ getSchema<T>(path: string): T | undefined;
76
91
  /**
77
92
  * Check if a schema exists by its config path/key.
78
93
  *
@@ -80,13 +95,6 @@ export declare class CameraStorage implements CameraStorageMethods {
80
95
  * @returns True if the schema exists, false otherwise.
81
96
  */
82
97
  hasSchema(path: string): boolean;
83
- /**
84
- * Check if a value exists by its config path/key.
85
- *
86
- * @param path - The path to the value to check.
87
- * @returns True if the value exists, false otherwise.
88
- */
89
- hasValue(path: string): boolean;
90
98
  private resolveOnGetFunctions;
91
99
  private resolveOnGetFunctionsForObject;
92
100
  private resolveOnGetFunctionsForSchema;
@@ -94,4 +102,5 @@ export declare class CameraStorage implements CameraStorageMethods {
94
102
  private filterStorableValues;
95
103
  private containsStorableSchema;
96
104
  private saveDb;
105
+ private removeDb;
97
106
  }
@@ -31,9 +31,6 @@ export declare class PluginManager {
31
31
  stopPluginChild(pluginName: string): Promise<void>;
32
32
  private loadInstalledPlugins;
33
33
  private removeOrphanedPlugins;
34
- private buildDependencyGraph;
35
- private groupPlugins;
36
- private topologicalSort;
37
34
  private handlePluginRegistration;
38
35
  private loadDefaultPaths;
39
36
  private addNpmPrefixToSearchPaths;
@@ -16,7 +16,7 @@ export interface Context {
16
16
  * Represents a loaded camera.ui plugin.
17
17
  */
18
18
  export declare class Plugin {
19
- _disabled: boolean;
19
+ private _disabled;
20
20
  private logger;
21
21
  private configService;
22
22
  private _info;
@@ -26,14 +26,21 @@ export interface JSONObject {
26
26
  }
27
27
  export type JSONArray = JSONValue[];
28
28
  export type PluginConfig = Record<string, any>;
29
- export type CameraExtension = 'hub' | 'prebuffer' | 'motionDetection' | 'objectDetection' | 'audioDetection' | 'ptz';
30
29
  export declare const CAMERA_EXTENSIONS: CameraExtension[];
31
- export interface PluginContract {
30
+ export type CameraExtension = 'hub' | 'prebuffer' | 'motionDetection' | 'objectDetection' | 'audioDetection' | 'ptz';
31
+ type ExtensionOrSupport = {
32
+ extension: CameraExtension;
33
+ supportAdditionalCameras?: never;
34
+ } | {
35
+ extension?: never;
36
+ supportAdditionalCameras?: boolean;
37
+ };
38
+ export interface PluginContractBase {
32
39
  pluginName: string;
33
- builtIns?: CameraExtension[];
34
- extension?: CameraExtension;
40
+ builtIns?: Exclude<CameraExtension, 'hub'>[];
35
41
  dependencies?: string[];
36
42
  }
43
+ export type PluginContract = PluginContractBase & ExtensionOrSupport;
37
44
  export declare const enum PLUGIN_STATUS {
38
45
  READY = "ready",
39
46
  STARTING = "starting",
@@ -54,7 +61,6 @@ export interface PluginStorage {
54
61
  }
55
62
  export interface ZmqInfo {
56
63
  zmqRouterAddress: string;
57
- zmqReqAddress: string;
58
64
  zmqPubAddress: string;
59
65
  zmqPublicKey: string;
60
66
  }
@@ -87,7 +93,7 @@ export interface JsonBaseSchema<T = any> {
87
93
  }
88
94
  export interface PluginJsonBaseSchema<T = any> extends JsonBaseSchema<T> {
89
95
  store?: boolean;
90
- onSet?: (newValue: any, oldValue: any) => void | Promise<void>;
96
+ onSet?: (newValue: any, oldValue: any) => Promise<void> | void;
91
97
  onGet?: () => any | Promise<any>;
92
98
  }
93
99
  export interface JsonSchemaString extends JsonBaseSchema<string> {
@@ -130,10 +136,12 @@ export interface PluginJsonSchemaEnum extends PluginJsonBaseSchema<string | numb
130
136
  }
131
137
  export interface JsonSchemaObject extends JsonBaseSchema {
132
138
  type: 'object';
139
+ opened?: boolean;
133
140
  properties?: JsonSchemaForm;
134
141
  }
135
142
  export interface PluginJsonSchemaObject extends PluginJsonBaseSchema {
136
143
  type: 'object';
144
+ opened?: boolean;
137
145
  properties?: PluginJsonSchemaForm;
138
146
  }
139
147
  export interface JsonSchemaObjectWithButtons extends JsonSchemaObject {
@@ -144,6 +152,7 @@ export interface JsonSchemaAnyOf {
144
152
  }
145
153
  export interface JsonSchemaArray extends JsonBaseSchema {
146
154
  type: 'array';
155
+ opened?: boolean;
147
156
  items?: JsonSchema | JsonSchemaAnyOf;
148
157
  }
149
158
  export interface JsonSchemaButton {
@@ -164,3 +173,4 @@ export interface RootSchema {
164
173
  export interface PluginRootSchema {
165
174
  schema: PluginJsonSchemaForm;
166
175
  }
176
+ export {};
@@ -1,24 +1,27 @@
1
1
  import { CameraDeviceHub } from '../../camera';
2
2
  import type { Camera } from '../../api/database/types';
3
- import type { StateValues, OnSetEvent, BaseLogger, PrebufferType } from '../../camera/types';
3
+ import type { StateValues, OnSetEvent, PrebufferType, CameraDelegate } from '../../camera/types';
4
4
  import type { IceServer } from '../../services/config/types';
5
5
  export declare class CameraDeviceClientProxy extends CameraDeviceHub {
6
- private targetId;
7
- private targetName;
8
- private clientTargetId;
9
- private subTargetId;
10
- private pluginId;
6
+ private removed;
11
7
  private api;
12
- private client;
8
+ private dealer;
13
9
  private subscriber;
14
10
  private messageQueue;
11
+ private dealerId;
12
+ private subscriberId;
13
+ private pluginID;
15
14
  private close?;
16
- constructor(camera: Camera, logger: BaseLogger, pluginId: string, pluginName: string, reqServerAddress: string, pubServerAddress: string, serverPublicKey: string);
15
+ constructor(camera: Camera, pluginId: string, pluginName: string, routerAddress: string, publisherAddress: string, serverPublicKey: string);
16
+ configureDelegate(delegate: CameraDelegate): void;
17
17
  setPrebufferSource(sourceName: string, address: string | null, type: PrebufferType): Promise<void>;
18
+ removePrebufferSource(sourceName: string, type: 'recording' | 'stream'): Promise<void>;
19
+ removePrebufferSources(): Promise<void>;
18
20
  getFfmpegPath(): Promise<string>;
19
21
  getIceServers(): Promise<IceServer[]>;
20
22
  updateState<T extends keyof StateValues>(stateName: T, eventData: OnSetEvent<T>): Promise<void>;
21
23
  refreshStates(): Promise<void>;
24
+ private handleRouterRequest;
22
25
  private listenToSubscriberEvents;
23
26
  private onRequest;
24
27
  }
@@ -1,23 +1,23 @@
1
1
  import { CameraDeviceClientProxy } from '../client/cameraDevice';
2
- import type { CameraConfig, CameraDevice, BaseLogger } from '../../camera/types';
3
- import type { DeviceManagerProxyMethods, DeviceManagerProxyEventCallbacks } from '../types';
4
- export declare class DeviceManager implements DeviceManagerProxyMethods {
5
- private pluginId;
6
- private pluginName;
7
- private clientTargetId;
8
- private subTargetId;
2
+ import type { CameraConfig, CameraDevice } from '../../camera/types';
3
+ import type { DeviceManagerProxyMethods, DeviceManagerProxyEventCallbacks, DeviceManagerProxyMethodsListener } from '../types';
4
+ export declare class DeviceManager implements DeviceManagerProxyMethods, DeviceManagerProxyMethodsListener {
9
5
  private api;
10
6
  private logger;
11
- private client;
7
+ private dealer;
12
8
  private subscriber;
13
9
  private messageQueue;
14
- private reqServerAddress;
15
- private pubServerAddress;
10
+ private routerAddress;
11
+ private publisherAddress;
16
12
  private serverPublicKey;
13
+ private pluginId;
14
+ private pluginName;
15
+ private dealerId;
16
+ private subscriberId;
17
17
  private MAX_LISTENERS_PER_EVENT;
18
18
  private devices;
19
19
  private eventListeners;
20
- constructor(logger: BaseLogger, pluginId: string, pluginName: string, reqServerAddress: string, pubServerAddress: string, serverPublicKey: string, cameraDevices?: CameraDeviceClientProxy[]);
20
+ constructor(pluginId: string, pluginName: string, routerAddress: string, publisherAddress: string, serverPublicKey: string, cameraDevices?: CameraDeviceClientProxy[]);
21
21
  getCameraById(id: string): Promise<CameraDevice | undefined>;
22
22
  getCameraByName(name: string): Promise<CameraDevice | undefined>;
23
23
  createCamera(cameraConfig: CameraConfig): Promise<CameraDevice>;
@@ -26,7 +26,8 @@ export declare class DeviceManager implements DeviceManagerProxyMethods {
26
26
  listen<E extends keyof DeviceManagerProxyEventCallbacks>(eventType: E, callback: DeviceManagerProxyEventCallbacks[E]): void;
27
27
  removeListener<E extends keyof DeviceManagerProxyEventCallbacks>(eventType: E, callbackToRemove: DeviceManagerProxyEventCallbacks[E]): void;
28
28
  removeAllListeners<E extends keyof DeviceManagerProxyEventCallbacks>(eventType?: E): void;
29
+ private handleRouterRequest;
29
30
  private listenToSubscriberEvents;
30
31
  private onRequest;
31
- private addCamera;
32
+ private addOrGetCamera;
32
33
  }
@@ -1,26 +1,23 @@
1
- import type { BaseLogger } from '../../camera/types';
2
- import type { PluginsManagerProxyMethods, PluginsManagerProxyEventCallbacks } from '../types';
3
- export declare class PluginsManager implements PluginsManagerProxyMethods {
4
- private pluginId;
5
- private pluginName;
6
- private clientTargetId;
7
- private subTargetId;
8
- private dealerTargetId;
1
+ import type { PluginsManagerProxyMethods, PluginsManagerProxyMethodsListener, PluginsManagerProxyEventCallbacks } from '../types';
2
+ export declare class PluginsManager implements PluginsManagerProxyMethods, PluginsManagerProxyMethodsListener {
9
3
  private api;
10
4
  private logger;
11
5
  private plugin?;
12
- private client;
13
- private subscriber;
14
6
  private dealer;
7
+ private subscriber;
15
8
  private messageQueue;
9
+ private pluginId;
10
+ private pluginName;
11
+ private dealerId;
12
+ private subscriberId;
16
13
  private MAX_LISTENERS_PER_EVENT;
17
14
  private eventListeners;
18
- constructor(logger: BaseLogger, pluginId: string, pluginName: string, reqServerAddress: string, pubServerAddress: string, routerAddress: string, serverPublicKey: string);
15
+ constructor(pluginId: string, pluginName: string, routerAddress: string, publisherAddress: string, serverPublicKey: string);
19
16
  listen<E extends keyof PluginsManagerProxyEventCallbacks>(eventType: E, callback: PluginsManagerProxyEventCallbacks[E]): void;
20
17
  removeListener<E extends keyof PluginsManagerProxyEventCallbacks>(eventType: E, callbackToRemove: PluginsManagerProxyEventCallbacks[E]): void;
21
18
  removeAllListeners<E extends keyof PluginsManagerProxyEventCallbacks>(eventType?: E): void;
19
+ private handleRouterRequest;
22
20
  private listenToSubscriberEvents;
23
- private listenToRouterRequests;
24
21
  private onRequest;
25
22
  private isPluginMessage;
26
23
  private isStorageMessage;
@@ -1,11 +1,14 @@
1
- import { Request } from 'zeromq';
1
+ import { Dealer } from 'zeromq';
2
+ import type { ProxyMessageStructure } from '../types';
2
3
  export declare class ClientMessageQueue {
3
- private requestClient;
4
- private queue;
4
+ private logger;
5
+ private dealer;
6
+ private requestHandler;
5
7
  private isProcessing;
8
+ private queue;
6
9
  private pendingResponses;
7
- constructor(requestClient: Request);
8
- enqueue(message: any, timeout?: number): Promise<any>;
10
+ constructor(requestHandler: (message: ProxyMessageStructure) => void, dealer: Dealer);
11
+ enqueue(message: ProxyMessageStructure): Promise<any>;
9
12
  private processQueue;
10
- private listenToReplies;
13
+ private listenToRouter;
11
14
  }
@@ -1,21 +1,21 @@
1
- import type { BaseLogger } from '../../camera/types';
2
- import type { SystemManagerProxyMethods, SystemManagerProxyEventCallbacks } from '../types';
3
- export declare class SystemManager implements SystemManagerProxyMethods {
4
- private pluginId;
5
- private pluginName;
6
- private clientTargetId;
7
- private subTargetId;
1
+ import type { SystemManagerProxyMethods, SystemManagerProxyMethodsListener, SystemManagerProxyEventCallbacks } from '../types';
2
+ export declare class SystemManager implements SystemManagerProxyMethods, SystemManagerProxyMethodsListener {
8
3
  private api;
9
4
  private logger;
10
- private client;
5
+ private dealer;
11
6
  private subscriber;
12
7
  private messageQueue;
8
+ private pluginId;
9
+ private pluginName;
10
+ private dealerId;
11
+ private subscriberId;
13
12
  private MAX_LISTENERS_PER_EVENT;
14
13
  private eventListeners;
15
- constructor(logger: BaseLogger, pluginId: string, pluginName: string, reqServerAddress: string, pubServerAddress: string, serverPublicKey: string);
14
+ constructor(pluginId: string, pluginName: string, routerAddress: string, publisherAddress: string, serverPublicKey: string);
16
15
  listen<E extends keyof SystemManagerProxyEventCallbacks>(eventType: E, callback: SystemManagerProxyEventCallbacks[E]): void;
17
16
  removeListener<E extends keyof SystemManagerProxyEventCallbacks>(eventType: E, callbackToRemove: SystemManagerProxyEventCallbacks[E]): void;
18
17
  removeAllListeners<E extends keyof SystemManagerProxyEventCallbacks>(eventType?: E): void;
18
+ private handleRouterRequest;
19
19
  private listenToSubscriberEvents;
20
20
  private onRequest;
21
21
  }
@@ -1,26 +1,29 @@
1
- import { Reply, Router, Publisher } from 'zeromq';
1
+ import { Router, Publisher } from 'zeromq';
2
2
  import { ServerProxy } from './proxies/server';
3
3
  import { CameraDeviceProxy } from './proxies/camera';
4
4
  import { PluginProxy } from './proxies/plugin';
5
5
  import type { ProxyBridge } from './ws';
6
- import type { ProxyEvents, TargetID, QueueItem } from './types';
6
+ import type { StateValues } from '../camera/types';
7
+ import type { DeviceManagerProxyEvents, SystemManagerProxyEvents, PluginsManagerProxyEvents, CameraDeviceListenerMessagePayload } from './types';
7
8
  export declare class ProxyServer {
8
9
  server?: ServerProxy;
9
10
  camera?: CameraDeviceProxy;
10
11
  plugin?: PluginProxy;
11
- private logger;
12
12
  private configService;
13
13
  router: Router;
14
- reqServer: Reply;
15
- pubServer: Publisher;
14
+ publisher: Publisher;
16
15
  socketBridge?: ProxyBridge;
17
16
  private messageQueue;
18
17
  constructor();
19
18
  initialize(): Promise<void>;
20
19
  close(): Promise<void>;
21
- sendMessage(item: QueueItem): Promise<void>;
22
- publishEvent<K extends keyof ProxyEvents>(targetId: TargetID, type: K, data: ProxyEvents[K]): Promise<void>;
23
- private listenToRequestMessages;
24
- private listenToRouterMessages;
25
- private isProxyMessage;
20
+ publishDeviceManagerEvent<K extends keyof DeviceManagerProxyEvents>(targetId: string, type: K, data: DeviceManagerProxyEvents[K]): Promise<void>;
21
+ publishSystemManagerEvent<K extends keyof SystemManagerProxyEvents>(targetId: string, type: K, data: SystemManagerProxyEvents[K]): Promise<void>;
22
+ publishPluginsManagerEvent<K extends keyof PluginsManagerProxyEvents>(targetId: string, type: K, data: PluginsManagerProxyEvents[K]): Promise<void>;
23
+ publishCameraEvent<K extends keyof StateValues>(cameraId: string, stateName: K, data: {
24
+ newEvent: StateValues[K];
25
+ oldEvent: StateValues[K];
26
+ }): Promise<void>;
27
+ publishCameraEvent(cameraId: string, type: CameraDeviceListenerMessagePayload['type'], data?: any): Promise<void>;
28
+ private isCameraState;
26
29
  }