@camera.ui/browser 0.0.34 → 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.
- package/dist/bundle.js +1 -1
- package/dist/client/node/src/proxy/cameraDevice/cameraDevice.browser.d.ts +20 -10
- package/dist/src/api/database/types.d.ts +49 -21
- package/dist/src/api/go2rtc/api/application.d.ts +4 -3
- package/dist/src/api/go2rtc/api/config.d.ts +4 -3
- package/dist/src/api/go2rtc/api/snapshot.d.ts +4 -3
- package/dist/src/api/go2rtc/api/streams.d.ts +5 -5
- package/dist/src/api/go2rtc/index.d.ts +13 -4
- package/dist/src/api/go2rtc/queue.d.ts +10 -0
- package/dist/src/api/schemas/cameras.schema.d.ts +363 -7
- package/dist/src/api/schemas/config.schema.d.ts +3 -0
- package/dist/src/api/services/cameras.service.d.ts +17 -7
- package/dist/src/api/services/plugins.service.d.ts +2 -0
- package/dist/src/api/types/index.d.ts +22 -3
- package/dist/src/camera/index.d.ts +22 -11
- package/dist/src/camera/types.d.ts +32 -12
- package/dist/src/plugins/cameraStorage.d.ts +3 -1
- package/dist/src/plugins/index.d.ts +0 -3
- package/dist/src/plugins/plugin.d.ts +1 -1
- package/dist/src/plugins/types.d.ts +16 -6
- package/dist/src/proxy/client/cameraDevice.d.ts +9 -8
- package/dist/src/proxy/client/deviceManager.d.ts +13 -12
- package/dist/src/proxy/client/pluginsManager.d.ts +9 -12
- package/dist/src/proxy/client/queue.d.ts +8 -7
- package/dist/src/proxy/client/systemManager.d.ts +9 -9
- package/dist/src/proxy/index.d.ts +13 -7
- package/dist/src/proxy/proxies/camera.d.ts +40 -20
- package/dist/src/proxy/proxies/plugin.d.ts +5 -4
- package/dist/src/proxy/proxies/server.d.ts +4 -9
- package/dist/src/proxy/queue.d.ts +6 -9
- package/dist/src/proxy/types.d.ts +58 -87
- package/dist/src/services/config/index.d.ts +0 -1
- package/dist/src/services/config/types.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,82 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import type { BasePlugin, CameraStorage } from '../plugins/types';
|
|
1
|
+
import type { Camera } from '../api/database/types';
|
|
2
|
+
import type { CameraExtension } from '../plugins/types';
|
|
4
3
|
import type { CameraConfig, OnSetEvent, StateValues, CameraDevice, FfmpegOptions, PrebufferType } from '../camera/types';
|
|
5
4
|
import type { IceServer } from '../services/config/types';
|
|
6
5
|
export type MethodKeys<T> = {
|
|
7
6
|
[K in keyof T]: T[K] extends Function ? K : never;
|
|
8
7
|
}[keyof T];
|
|
9
|
-
export interface
|
|
10
|
-
|
|
11
|
-
message: any;
|
|
8
|
+
export interface QueueItem {
|
|
9
|
+
message: ProxyMessageStructure;
|
|
12
10
|
resolve: (response: any) => void;
|
|
13
11
|
reject: (error: Error) => void;
|
|
14
|
-
timeout: number;
|
|
15
|
-
}
|
|
16
|
-
export interface QueueItem {
|
|
17
|
-
requestType: 'router' | 'request';
|
|
18
|
-
targetId: string;
|
|
19
|
-
requestId: string;
|
|
20
|
-
message: any;
|
|
21
|
-
fn: string;
|
|
22
|
-
timeout?: number;
|
|
23
|
-
onResponse?: (response: any) => void;
|
|
24
|
-
onError?: (error: Error) => void;
|
|
25
|
-
}
|
|
26
|
-
export interface RequestPayload {
|
|
27
|
-
fn: string;
|
|
28
|
-
data: Record<string, any>;
|
|
29
|
-
requestId: string;
|
|
30
12
|
}
|
|
31
|
-
export interface
|
|
32
|
-
payload: CameraDeviceProxyMessageStructure | ProxyMessageStructure;
|
|
33
|
-
resolve: (value: any) => void;
|
|
34
|
-
reject: (reason?: any) => void;
|
|
35
|
-
timeout: NodeJS.Timeout;
|
|
36
|
-
}
|
|
37
|
-
export interface RouterDealerPayload {
|
|
38
|
-
fn: keyof BasePlugin | keyof CameraStorage;
|
|
39
|
-
args: any[];
|
|
13
|
+
export interface ProxyMessageStructure {
|
|
40
14
|
requestId: string;
|
|
41
|
-
targetId: string;
|
|
42
|
-
pluginId: string;
|
|
43
15
|
cameraId?: string;
|
|
44
|
-
}
|
|
45
|
-
export interface PluginRouterDealePayload extends RouterDealerPayload {
|
|
46
|
-
fn: keyof BasePlugin;
|
|
47
|
-
}
|
|
48
|
-
export interface StorageRouterDealerPayload extends RouterDealerPayload {
|
|
49
|
-
fn: keyof CameraStorage;
|
|
50
|
-
}
|
|
51
|
-
export interface QueueRouterDealerItem {
|
|
52
|
-
payload: RouterDealerPayload;
|
|
53
|
-
resolve: (value: any) => void;
|
|
54
|
-
reject: (reason?: any) => void;
|
|
55
|
-
timeout: NodeJS.Timeout;
|
|
56
|
-
}
|
|
57
|
-
export type CameraId = string;
|
|
58
|
-
export type PluginId = string;
|
|
59
|
-
export type TargetID = CameraId | PluginId | 'all';
|
|
60
|
-
export interface PendingMessagePayload {
|
|
61
|
-
requestId: string;
|
|
62
|
-
response?: any;
|
|
63
|
-
}
|
|
64
|
-
export interface ListenerMessagePayload {
|
|
65
|
-
type: keyof ProxyEventCallbacks;
|
|
66
|
-
data: any;
|
|
67
|
-
}
|
|
68
|
-
export interface ProxyMessageStructure {
|
|
69
16
|
targetId: string;
|
|
70
|
-
targetName
|
|
17
|
+
targetName?: string;
|
|
71
18
|
pluginId: string;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
19
|
+
type: 'request' | 'reply';
|
|
20
|
+
proxy: 'system' | 'device' | 'plugins' | 'camera';
|
|
21
|
+
client: 'pluginFn' | 'pluginStorage' | 'cameraFn' | 'cameraDelegate' | 'device' | 'system';
|
|
22
|
+
fn: string;
|
|
23
|
+
args: any;
|
|
24
|
+
timeout: number;
|
|
76
25
|
timestamp: number;
|
|
26
|
+
response?: any;
|
|
27
|
+
error?: any;
|
|
28
|
+
}
|
|
29
|
+
export interface WsManagerClientMessage {
|
|
30
|
+
method: ProxyMethodNames;
|
|
31
|
+
args: any[];
|
|
77
32
|
}
|
|
78
|
-
export type ProxyEvents = SystemManagerProxyEvents & DeviceManagerProxyEvents;
|
|
79
|
-
export type ProxyEventCallbacks = SystemManagerProxyEventCallbacks & DeviceManagerProxyEventCallbacks;
|
|
80
33
|
export type ProxyMethodNames = SystemManagerProxyMethodNames | DeviceManagerProxyMethodNames;
|
|
81
34
|
export interface ApiProxyMethods {
|
|
82
35
|
createCamera(data: {
|
|
@@ -100,10 +53,6 @@ export interface ApiProxyMethods {
|
|
|
100
53
|
pluginId: string;
|
|
101
54
|
}): Promise<void>;
|
|
102
55
|
}
|
|
103
|
-
export interface WsManagerClientMessage {
|
|
104
|
-
method: ProxyMethodNames;
|
|
105
|
-
args: any[];
|
|
106
|
-
}
|
|
107
56
|
export interface DeviceManagerListenerMessagePayload {
|
|
108
57
|
type: keyof DeviceManagerProxyEventCallbacks;
|
|
109
58
|
data: any;
|
|
@@ -114,20 +63,38 @@ export interface DeviceManagerProxyMethods {
|
|
|
114
63
|
getCameraById(id: string): Promise<CameraDevice | undefined>;
|
|
115
64
|
removeCameraByName(name: string): Promise<void>;
|
|
116
65
|
removeCameraById(id: string): Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
export interface DeviceManagerProxyMethodsListener {
|
|
117
68
|
listen<E extends keyof DeviceManagerProxyEventCallbacks>(eventType: E, callback: DeviceManagerProxyEventCallbacks[E]): void;
|
|
118
69
|
removeListener<E extends keyof DeviceManagerProxyEventCallbacks>(eventType: E, callbackToRemove: DeviceManagerProxyEventCallbacks[E]): void;
|
|
119
70
|
removeAllListeners<E extends keyof DeviceManagerProxyEventCallbacks>(eventType?: E): void;
|
|
120
71
|
}
|
|
121
72
|
export type DeviceManagerProxyMethodNames = MethodKeys<DeviceManagerProxyMethods>;
|
|
122
73
|
export interface DeviceManagerProxyEvents {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
74
|
+
cameraSelected: {
|
|
75
|
+
camera: Camera;
|
|
76
|
+
extension: CameraExtension;
|
|
77
|
+
};
|
|
78
|
+
cameraDeselected: {
|
|
79
|
+
camera: Camera;
|
|
80
|
+
extension: CameraExtension;
|
|
81
|
+
};
|
|
82
|
+
cameraAdded: {
|
|
83
|
+
camera: Camera;
|
|
84
|
+
};
|
|
85
|
+
cameraRemoved: {
|
|
86
|
+
camera: Camera;
|
|
87
|
+
};
|
|
88
|
+
cameraUpdated: {
|
|
89
|
+
camera: Camera;
|
|
90
|
+
};
|
|
126
91
|
}
|
|
127
92
|
export type DeviceManagerProxyEventCallbacks = {
|
|
93
|
+
cameraSelected: (camera: CameraDevice, extension: CameraExtension) => void;
|
|
94
|
+
cameraDeselected: (cameraId: string, extension: CameraExtension) => void;
|
|
128
95
|
cameraAdded: (camera: CameraDevice) => void;
|
|
129
|
-
cameraUpdated: (cameraId: string, camera: CameraDevice) => void;
|
|
130
96
|
cameraRemoved: (cameraId: string) => void;
|
|
97
|
+
cameraUpdated: (cameraId: string, camera: CameraDevice) => void;
|
|
131
98
|
};
|
|
132
99
|
export interface DeviceManagerProxyGenericEvent<K extends keyof DeviceManagerProxyEvents> {
|
|
133
100
|
type: K;
|
|
@@ -138,6 +105,8 @@ export interface SystemManagerListenerMessagePayload {
|
|
|
138
105
|
data: any;
|
|
139
106
|
}
|
|
140
107
|
export interface SystemManagerProxyMethods {
|
|
108
|
+
}
|
|
109
|
+
export interface SystemManagerProxyMethodsListener {
|
|
141
110
|
listen<E extends keyof SystemManagerProxyEventCallbacks>(eventType: E, callback: SystemManagerProxyEventCallbacks[E]): void;
|
|
142
111
|
removeListener<E extends keyof SystemManagerProxyEventCallbacks>(eventType: E, callbackToRemove: SystemManagerProxyEventCallbacks[E]): void;
|
|
143
112
|
removeAllListeners<E extends keyof SystemManagerProxyEventCallbacks>(eventType?: E): void;
|
|
@@ -155,6 +124,8 @@ export interface PluginsManagerListenerMessagePayload {
|
|
|
155
124
|
data: any;
|
|
156
125
|
}
|
|
157
126
|
export interface PluginsManagerProxyMethods {
|
|
127
|
+
}
|
|
128
|
+
export interface PluginsManagerProxyMethodsListener {
|
|
158
129
|
listen<E extends keyof PluginsManagerProxyEventCallbacks>(eventType: E, callback: PluginsManagerProxyEventCallbacks[E]): void;
|
|
159
130
|
removeListener<E extends keyof PluginsManagerProxyEventCallbacks>(eventType: E, callbackToRemove: PluginsManagerProxyEventCallbacks[E]): void;
|
|
160
131
|
removeAllListeners<E extends keyof PluginsManagerProxyEventCallbacks>(eventType?: E): void;
|
|
@@ -176,25 +147,16 @@ export interface CameraDeviceListenerStatePayload<K extends keyof StateValues> {
|
|
|
176
147
|
};
|
|
177
148
|
}
|
|
178
149
|
export interface CameraDeviceListenerMessagePayload {
|
|
179
|
-
type: 'removed' | 'updated';
|
|
150
|
+
type: 'removed' | 'updated' | 'updatedSources';
|
|
180
151
|
data?: any;
|
|
181
152
|
}
|
|
182
|
-
export interface CameraDeviceProxyMessageStructure {
|
|
183
|
-
targetId: string;
|
|
184
|
-
targetName: string;
|
|
185
|
-
pluginId: string;
|
|
186
|
-
cameraId?: string;
|
|
187
|
-
requestId: string;
|
|
188
|
-
fn: CameraDeviceProxyMethodNames;
|
|
189
|
-
data: any;
|
|
190
|
-
timestamp: number;
|
|
191
|
-
}
|
|
192
153
|
export interface CameraDeviceProxyMethods {
|
|
193
154
|
snapshot(data: {
|
|
194
155
|
sourceName: string;
|
|
195
156
|
prebuffer?: boolean;
|
|
196
157
|
cameraId: string;
|
|
197
158
|
pluginId: string;
|
|
159
|
+
ws?: boolean;
|
|
198
160
|
}): Promise<ArrayBuffer>;
|
|
199
161
|
setPrebufferSource(data: {
|
|
200
162
|
sourceName: string;
|
|
@@ -202,43 +164,51 @@ export interface CameraDeviceProxyMethods {
|
|
|
202
164
|
type: PrebufferType;
|
|
203
165
|
cameraId: string;
|
|
204
166
|
pluginId: string;
|
|
167
|
+
ws?: boolean;
|
|
205
168
|
}): Promise<void>;
|
|
206
169
|
removePrebufferSource(data: {
|
|
207
170
|
sourceName: string;
|
|
208
171
|
type: PrebufferType;
|
|
209
172
|
cameraId: string;
|
|
210
173
|
pluginId: string;
|
|
174
|
+
ws?: boolean;
|
|
211
175
|
}): Promise<void>;
|
|
212
176
|
removePrebufferSources(data: {
|
|
213
177
|
cameraId: string;
|
|
214
178
|
pluginId: string;
|
|
179
|
+
ws?: boolean;
|
|
215
180
|
}): Promise<void>;
|
|
216
181
|
getFffmpegPath(data: {
|
|
217
182
|
cameraId: string;
|
|
218
183
|
pluginId: string;
|
|
184
|
+
ws?: boolean;
|
|
219
185
|
}): string;
|
|
220
186
|
getIceServers(data: {
|
|
221
187
|
cameraId: string;
|
|
222
188
|
pluginId: string;
|
|
189
|
+
ws?: boolean;
|
|
223
190
|
}): IceServer[];
|
|
224
191
|
updateState<T extends keyof StateValues>(data: {
|
|
225
192
|
stateName: T;
|
|
226
193
|
eventData: OnSetEvent<T>;
|
|
227
194
|
cameraId: string;
|
|
228
195
|
pluginId: string;
|
|
196
|
+
ws?: boolean;
|
|
229
197
|
}): void;
|
|
230
198
|
refreshStates(data: {
|
|
231
199
|
cameraId: string;
|
|
232
200
|
pluginId: string;
|
|
233
|
-
|
|
234
|
-
|
|
201
|
+
ws?: boolean;
|
|
202
|
+
}): Promise<{
|
|
203
|
+
camera: Camera;
|
|
235
204
|
states: StateValues;
|
|
236
|
-
}
|
|
205
|
+
}>;
|
|
237
206
|
streamVideo(data: {
|
|
238
207
|
sourceName: string;
|
|
239
208
|
options: FfmpegOptions;
|
|
240
209
|
cameraId: string;
|
|
241
210
|
pluginId: string;
|
|
211
|
+
ws?: boolean;
|
|
242
212
|
}): Promise<void>;
|
|
243
213
|
recordToFile(data: {
|
|
244
214
|
sourceName: string;
|
|
@@ -246,6 +216,7 @@ export interface CameraDeviceProxyMethods {
|
|
|
246
216
|
duration?: number;
|
|
247
217
|
cameraId: string;
|
|
248
218
|
pluginId: string;
|
|
219
|
+
ws?: boolean;
|
|
249
220
|
}): Promise<void>;
|
|
250
221
|
}
|
|
251
222
|
export type CameraDeviceProxyMethodNames = MethodKeys<CameraDeviceProxyMethods>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camera.ui/browser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.35",
|
|
4
4
|
"description": "camera.ui browser client",
|
|
5
5
|
"author": "seydx (https://github.com/seydx/camera.ui)",
|
|
6
6
|
"main": "./dist/bundle.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"typescript": "^5.3.3",
|
|
32
32
|
"updates": "^15.1.1",
|
|
33
33
|
"utf-8-validate": "^6.0.3",
|
|
34
|
-
"webpack": "^5.
|
|
34
|
+
"webpack": "^5.90.0",
|
|
35
35
|
"webpack-cli": "^5.1.4"
|
|
36
36
|
},
|
|
37
37
|
"bugs": {
|