@camera.ui/browser 0.0.34 → 0.0.36
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 +27 -15
- package/dist/client/node/src/proxy/cameraDevice/cameraDevice.node.d.ts +12 -7
- package/dist/src/api/database/types.d.ts +37 -27
- 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 +475 -13
- package/dist/src/api/schemas/config.schema.d.ts +12 -9
- package/dist/src/api/services/cameras.service.d.ts +16 -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/api/ws/nsp/status.d.ts +10 -2
- package/dist/src/api/ws/nsp/streams.d.ts +0 -15
- package/dist/src/api/ws/types.d.ts +14 -0
- package/dist/src/api.d.ts +3 -2
- package/dist/src/camera/index.d.ts +32 -19
- package/dist/src/camera/streaming/peer-connection.d.ts +5 -7
- package/dist/src/camera/streaming/streaming-session.d.ts +3 -3
- package/dist/src/camera/streaming/webrtc-connection.d.ts +4 -4
- package/dist/src/camera/types.d.ts +77 -19
- package/dist/src/go2rtc/index.d.ts +1 -0
- package/dist/src/plugins/cameraStorage.d.ts +4 -1
- package/dist/src/plugins/index.d.ts +0 -3
- package/dist/src/plugins/plugin.d.ts +1 -1
- package/dist/src/plugins/schema.d.ts +3 -3
- package/dist/src/plugins/types.d.ts +23 -13
- package/dist/src/proxy/client/cameraDevice.d.ts +20 -14
- 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 +10 -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 +62 -34
- 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 +8 -9
- package/dist/src/proxy/types.d.ts +81 -106
- package/dist/src/services/config/index.d.ts +0 -1
- package/dist/src/services/config/types.d.ts +2 -1
- package/dist/src/services/logger/index.d.ts +5 -4
- package/package.json +4 -4
- /package/dist/src/camera/{subscribed.d.ts → utils/subscribed.d.ts} +0 -0
|
@@ -1,82 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type { CameraConfig, OnSetEvent, StateValues, CameraDevice, FfmpegOptions, PrebufferType } from '../camera/types';
|
|
1
|
+
import type { Camera } from '../api/database/types';
|
|
2
|
+
import type { CameraExtension } from '../plugins/types';
|
|
3
|
+
import type { CameraConfig, OnSetEvent, StateValues, CameraDevice, FfmpegOptions, PrebufferType, StreamInfo } 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' | 'cameraPrebufferDelegate' | '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;
|
|
@@ -179,66 +150,54 @@ export interface CameraDeviceListenerMessagePayload {
|
|
|
179
150
|
type: 'removed' | 'updated';
|
|
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
|
-
|
|
194
|
-
sourceName: string;
|
|
195
|
-
prebuffer?: boolean;
|
|
154
|
+
reboot(data: {
|
|
196
155
|
cameraId: string;
|
|
197
156
|
pluginId: string;
|
|
198
|
-
|
|
199
|
-
|
|
157
|
+
ws?: boolean;
|
|
158
|
+
}): Promise<void>;
|
|
159
|
+
isPrebuffering(data: {
|
|
200
160
|
sourceName: string;
|
|
201
|
-
address: string;
|
|
202
161
|
type: PrebufferType;
|
|
203
162
|
cameraId: string;
|
|
204
163
|
pluginId: string;
|
|
205
|
-
|
|
206
|
-
|
|
164
|
+
ws?: boolean;
|
|
165
|
+
}): Promise<boolean>;
|
|
166
|
+
getPrebufferRawUrl(data: {
|
|
207
167
|
sourceName: string;
|
|
208
168
|
type: PrebufferType;
|
|
209
169
|
cameraId: string;
|
|
210
170
|
pluginId: string;
|
|
211
|
-
|
|
212
|
-
|
|
171
|
+
ws?: boolean;
|
|
172
|
+
}): Promise<string | undefined>;
|
|
173
|
+
getStreamInfo(data: {
|
|
174
|
+
sourceName: string;
|
|
213
175
|
cameraId: string;
|
|
214
176
|
pluginId: string;
|
|
215
|
-
|
|
177
|
+
ws?: boolean;
|
|
178
|
+
}): Promise<StreamInfo | undefined>;
|
|
216
179
|
getFffmpegPath(data: {
|
|
217
180
|
cameraId: string;
|
|
218
181
|
pluginId: string;
|
|
182
|
+
ws?: boolean;
|
|
219
183
|
}): string;
|
|
220
184
|
getIceServers(data: {
|
|
221
185
|
cameraId: string;
|
|
222
186
|
pluginId: string;
|
|
187
|
+
ws?: boolean;
|
|
223
188
|
}): IceServer[];
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
eventData: OnSetEvent<T>;
|
|
227
|
-
cameraId: string;
|
|
228
|
-
pluginId: string;
|
|
229
|
-
}): void;
|
|
230
|
-
refreshStates(data: {
|
|
189
|
+
snapshot(data: {
|
|
190
|
+
forceNew?: boolean;
|
|
231
191
|
cameraId: string;
|
|
232
192
|
pluginId: string;
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
states: StateValues;
|
|
236
|
-
} | undefined;
|
|
193
|
+
ws?: boolean;
|
|
194
|
+
}): Promise<ArrayBuffer>;
|
|
237
195
|
streamVideo(data: {
|
|
238
196
|
sourceName: string;
|
|
239
197
|
options: FfmpegOptions;
|
|
240
198
|
cameraId: string;
|
|
241
199
|
pluginId: string;
|
|
200
|
+
ws?: boolean;
|
|
242
201
|
}): Promise<void>;
|
|
243
202
|
recordToFile(data: {
|
|
244
203
|
sourceName: string;
|
|
@@ -246,7 +205,23 @@ export interface CameraDeviceProxyMethods {
|
|
|
246
205
|
duration?: number;
|
|
247
206
|
cameraId: string;
|
|
248
207
|
pluginId: string;
|
|
208
|
+
ws?: boolean;
|
|
249
209
|
}): Promise<void>;
|
|
210
|
+
updateState<T extends keyof StateValues>(data: {
|
|
211
|
+
stateName: T;
|
|
212
|
+
eventData: OnSetEvent<T>;
|
|
213
|
+
cameraId: string;
|
|
214
|
+
pluginId: string;
|
|
215
|
+
ws?: boolean;
|
|
216
|
+
}): void;
|
|
217
|
+
refreshStates(data: {
|
|
218
|
+
cameraId: string;
|
|
219
|
+
pluginId: string;
|
|
220
|
+
ws?: boolean;
|
|
221
|
+
}): Promise<{
|
|
222
|
+
camera: Camera;
|
|
223
|
+
states: StateValues;
|
|
224
|
+
}>;
|
|
250
225
|
}
|
|
251
226
|
export type CameraDeviceProxyMethodNames = MethodKeys<CameraDeviceProxyMethods>;
|
|
252
227
|
export type CameraDeviceProxyEventCallbacks = {
|
|
@@ -23,13 +23,14 @@ export interface PluginsSettings {
|
|
|
23
23
|
}
|
|
24
24
|
export interface IConfig {
|
|
25
25
|
port: number;
|
|
26
|
+
insecurePort: number;
|
|
26
27
|
tempFile?: string;
|
|
27
28
|
ssl: IConfigSSL;
|
|
28
29
|
logger: Logger;
|
|
29
30
|
settings: Partial<InterfaceSettings>;
|
|
30
31
|
plugins: Partial<PluginsSettings>;
|
|
31
32
|
}
|
|
32
|
-
export type LoggingLevel = 'info' | 'debug' | 'warn' | 'error' | '
|
|
33
|
+
export type LoggingLevel = 'info' | 'debug' | 'warn' | 'error' | 'trace';
|
|
33
34
|
export interface Logger {
|
|
34
35
|
level?: LoggingLevel;
|
|
35
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
|
|
20
|
+
private _traceLogging;
|
|
20
21
|
private _disableTimestamps;
|
|
21
22
|
notifications: UiNotification[];
|
|
22
23
|
get debugEnabled(): boolean;
|
|
23
24
|
set debugEnabled(state: boolean);
|
|
24
|
-
get
|
|
25
|
-
set
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "0.0.36",
|
|
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.
|
|
32
|
-
"updates": "^15.1.
|
|
31
|
+
"typescript": "^5.4.2",
|
|
32
|
+
"updates": "^15.1.2",
|
|
33
33
|
"utf-8-validate": "^6.0.3",
|
|
34
|
-
"webpack": "^5.
|
|
34
|
+
"webpack": "^5.90.3",
|
|
35
35
|
"webpack-cli": "^5.1.4"
|
|
36
36
|
},
|
|
37
37
|
"bugs": {
|
|
File without changes
|