@camera.ui/browser 0.0.5 → 0.0.30

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 (47) hide show
  1. package/README.md +1 -1
  2. package/dist/bundle.browser.js +1 -1
  3. package/dist/client/node/src/client.d.ts +1 -0
  4. package/dist/client/node/src/proxy/cameraDevice/cameraDevice.browser.d.ts +20 -9
  5. package/dist/client/node/src/proxy/cameraDevice/cameraDevice.node.d.ts +4 -2
  6. package/dist/client/node/src/proxy/deviceManager.d.ts +3 -2
  7. package/dist/client/node/src/socket.d.ts +5 -1
  8. package/dist/client/node/src/types.d.ts +9 -7
  9. package/dist/src/api/database/types.d.ts +20 -5
  10. package/dist/src/api/go2rtc/api/application.d.ts +2 -2
  11. package/dist/src/api/go2rtc/api/snapshot.d.ts +3 -2
  12. package/dist/src/api/go2rtc/api/streams.d.ts +6 -5
  13. package/dist/src/api/go2rtc/types.d.ts +14 -0
  14. package/dist/src/api/schemas/cameras.schema.d.ts +25 -29
  15. package/dist/src/api/schemas/config.schema.d.ts +2 -2
  16. package/dist/src/api/services/cameras.service.d.ts +4 -1
  17. package/dist/src/api/utils/constants.d.ts +15 -0
  18. package/dist/src/api.d.ts +4 -4
  19. package/dist/src/camera/index.d.ts +26 -16
  20. package/dist/src/camera/streaming/peer-connection.d.ts +7 -7
  21. package/dist/src/camera/streaming/streaming-session.d.ts +5 -7
  22. package/dist/src/camera/streaming/webrtc-connection.d.ts +7 -9
  23. package/dist/src/camera/types.d.ts +34 -8
  24. package/dist/src/plugins/base.d.ts +1 -1
  25. package/dist/src/plugins/index.d.ts +7 -2
  26. package/dist/src/plugins/plugin.d.ts +5 -2
  27. package/dist/src/plugins/types.d.ts +5 -1
  28. package/dist/src/plugins/worker.d.ts +1 -0
  29. package/dist/src/proxy/client/cameraDevice.d.ts +9 -14
  30. package/dist/src/proxy/client/deviceManager.d.ts +4 -12
  31. package/dist/src/proxy/client/pluginsManager.d.ts +3 -11
  32. package/dist/src/proxy/client/queue.d.ts +11 -0
  33. package/dist/src/proxy/client/systemManager.d.ts +3 -11
  34. package/dist/src/proxy/constants.d.ts +7 -0
  35. package/dist/src/proxy/index.d.ts +12 -6
  36. package/dist/src/proxy/proxies/camera.d.ts +35 -9
  37. package/dist/src/proxy/proxies/plugin.d.ts +3 -23
  38. package/dist/src/proxy/proxies/server.d.ts +6 -6
  39. package/dist/src/proxy/queue.d.ts +15 -0
  40. package/dist/src/proxy/types.d.ts +62 -6
  41. package/dist/src/proxy/ws/index.d.ts +0 -9
  42. package/dist/src/services/config/constants.d.ts +6 -0
  43. package/dist/src/services/config/index.d.ts +1 -1
  44. package/dist/src/services/logger/index.d.ts +2 -0
  45. package/package.json +3 -3
  46. package/dist/src/api/utils/cert.d.ts +0 -17
  47. /package/dist/src/plugins/{storage.d.ts → storageController.d.ts} +0 -0
@@ -1,17 +1,34 @@
1
1
  /// <reference types="node" />
2
- import type { Camera } from '../api/database/types';
2
+ import type { Camera, CameraInput } from '../api/database/types';
3
3
  import type { BasePlugin, CameraStorage } from '../plugins/types';
4
- import type { CameraConfig, OnSetEvent, StateValues, CameraDevice } from '../camera/types';
4
+ import type { CameraConfig, OnSetEvent, StateValues, CameraDevice, FfmpegOptions, PrebufferType } from '../camera/types';
5
+ import type { IceServer } from '../services/config/types';
5
6
  export type MethodKeys<T> = {
6
7
  [K in keyof T]: T[K] extends Function ? K : never;
7
8
  }[keyof T];
9
+ export interface ClientQueueItem {
10
+ requestId: string;
11
+ message: any;
12
+ resolve: (response: any) => void;
13
+ 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
+ timeout?: number;
22
+ onResponse?: (response: any) => void;
23
+ onError?: (error: Error) => void;
24
+ }
8
25
  export interface RequestPayload {
9
26
  fn: string;
10
27
  data: Record<string, any>;
11
28
  requestId: string;
12
29
  }
13
30
  export interface QueueRequestItem {
14
- payload: RequestPayload;
31
+ payload: CameraDeviceProxyMessageStructure | ProxyMessageStructure;
15
32
  resolve: (value: any) => void;
16
33
  reject: (reason?: any) => void;
17
34
  timeout: NodeJS.Timeout;
@@ -40,7 +57,7 @@ export type CameraId = string;
40
57
  export type PluginId = string;
41
58
  export type TargetID = CameraId | PluginId | 'all';
42
59
  export interface PendingMessagePayload {
43
- replyTo: string;
60
+ requestId: string;
44
61
  response?: any;
45
62
  }
46
63
  export interface ListenerMessagePayload {
@@ -82,7 +99,9 @@ export interface ApiProxyMethods {
82
99
  pluginId: string;
83
100
  }): Promise<void>;
84
101
  }
85
- export interface SystemProxyMethods {
102
+ export interface WsManagerClientMessage {
103
+ method: ProxyMethodNames;
104
+ args: any[];
86
105
  }
87
106
  export interface DeviceManagerListenerMessagePayload {
88
107
  type: keyof DeviceManagerProxyEventCallbacks;
@@ -170,14 +189,47 @@ export interface CameraDeviceProxyMessageStructure {
170
189
  timestamp: number;
171
190
  }
172
191
  export interface CameraDeviceProxyMethods {
192
+ setPrebufferSource(data: {
193
+ sourceName: string;
194
+ address: string | null;
195
+ type: PrebufferType;
196
+ cameraId: string;
197
+ pluginId: string;
198
+ }): Promise<void>;
199
+ getFffmpegPath(data: {
200
+ cameraId: string;
201
+ pluginId: string;
202
+ }): string;
203
+ getIceServers(data: {
204
+ cameraId: string;
205
+ pluginId: string;
206
+ }): IceServer[];
173
207
  updateState<T extends keyof StateValues>(data: {
174
208
  stateName: T;
175
209
  eventData: OnSetEvent<T>;
176
210
  cameraId: string;
211
+ pluginId: string;
177
212
  }): void;
178
213
  refreshStates(data: {
179
214
  cameraId: string;
180
- }): StateValues | undefined;
215
+ pluginId: string;
216
+ }): {
217
+ sources: CameraInput[];
218
+ states: StateValues;
219
+ } | undefined;
220
+ streamVideo(data: {
221
+ sourceName: string;
222
+ options: FfmpegOptions;
223
+ cameraId: string;
224
+ pluginId: string;
225
+ }): Promise<void>;
226
+ recordToFile(data: {
227
+ sourceName: string;
228
+ outputPath: string;
229
+ duration?: number;
230
+ cameraId: string;
231
+ pluginId: string;
232
+ }): Promise<void>;
181
233
  }
182
234
  export type CameraDeviceProxyMethodNames = MethodKeys<CameraDeviceProxyMethods>;
183
235
  export type CameraDeviceProxyEventCallbacks = {
@@ -187,3 +239,7 @@ export interface CameraDeviceProxyGenericEvent<K extends keyof StateValues> {
187
239
  type: K;
188
240
  data: StateValues[K];
189
241
  }
242
+ export interface WsCameraDeviceClientMessage {
243
+ method: CameraDeviceProxyMethodNames;
244
+ args: any[];
245
+ }
@@ -1,14 +1,5 @@
1
1
  import type { Server, Namespace } from 'socket.io';
2
2
  import type { SocketNsp } from '../../api/ws/types';
3
- import type { ProxyMethodNames, CameraDeviceProxyMethodNames } from '../types';
4
- export interface ManagerClientMessage {
5
- method: ProxyMethodNames;
6
- args: any[];
7
- }
8
- export interface CameraDeviceClientMessage {
9
- method: CameraDeviceProxyMethodNames;
10
- args: any[];
11
- }
12
3
  export declare class ProxyBridge {
13
4
  nsp: Namespace;
14
5
  nspName: SocketNsp;
@@ -0,0 +1,6 @@
1
+ import type { RTCIceServer } from 'werift';
2
+ import type { IceServer, IConfig, Go2RtcConfig } from './types';
3
+ export declare const DEFAULT_ICE_SERVERS: IceServer[];
4
+ export declare const DEFAULT_WERIFT_ICE_SERVERS: RTCIceServer[];
5
+ export declare const DEFAULT_CONFIG: IConfig;
6
+ export declare const DEFAULT_GO2RTC_CONFIG: Go2RtcConfig;
@@ -48,7 +48,7 @@ export declare class ConfigService {
48
48
  read(): void;
49
49
  writeConfig(newConfig?: IConfig): void;
50
50
  writeGo2RtcConfig(newConfig?: Go2RtcConfig): void;
51
- mergeGo2RtcConfig: () => Promise<void>;
51
+ mergeGo2RtcConfig(): Promise<void>;
52
52
  private defaultConfig;
53
53
  private defaultGo2RtcConfig;
54
54
  private readConfig;
@@ -10,6 +10,7 @@ export declare class PluginLogger {
10
10
  log(...args: any[]): void;
11
11
  error(...args: any[]): void;
12
12
  warn(...args: any[]): void;
13
+ attention(...args: any[]): void;
13
14
  debug(...args: any[]): void;
14
15
  }
15
16
  export declare class Logger {
@@ -29,6 +30,7 @@ export declare class Logger {
29
30
  log(...args: any[]): void;
30
31
  error(...args: any[]): void;
31
32
  warn(...args: any[]): void;
33
+ attention(...args: any[]): void;
32
34
  debug(...args: any[]): void;
33
35
  verbose(...args: any[]): void;
34
36
  notify(title: string, text: string, type: LoggingLevel, link: string, socket?: Socket): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camera.ui/browser",
3
- "version": "0.0.5",
3
+ "version": "0.0.30",
4
4
  "description": "camera.ui browser client",
5
5
  "author": "seydx (https://github.com/seydx/camera.ui)",
6
6
  "main": "./dist/bundle.browser.js",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "rxjs": "^7.8.1",
24
- "socket.io-client": "^4.7.3"
24
+ "socket.io-client": "^4.7.4"
25
25
  },
26
26
  "devDependencies": {
27
27
  "bufferutil": "^4.0.8",
@@ -29,7 +29,7 @@
29
29
  "ts-loader": "^9.5.1",
30
30
  "typescript": "^5.3.3",
31
31
  "updates": "^15.1.1",
32
- "utf-8-validate": "^5.0.10",
32
+ "utf-8-validate": "^6.0.3",
33
33
  "webpack": "^5.89.0",
34
34
  "webpack-cli": "^5.1.4"
35
35
  },
@@ -1,17 +0,0 @@
1
- import forge from 'node-forge';
2
- export interface CertKey {
3
- cert: string;
4
- certPath: string;
5
- key: string;
6
- keyPath: string;
7
- }
8
- export declare const HOST_CERT_FILENAME = "camera.ui.cert.pem";
9
- export declare const HOST_KEY_FILENAME = "camera.ui.key.pem";
10
- export declare const ROOT_CERT_FILENAME = "camera.ui.root.cert.pem";
11
- export declare const ROOT_KEY_FILENAME = "camera.ui.root.key.pem";
12
- export declare const P12_FILENAME = "camera.ui.p12";
13
- export declare const P12_PASSWORD = "camera.ui";
14
- export declare const getCert: () => CertKey;
15
- export declare const createRootCA: (customAddresses?: string[]) => CertKey;
16
- export declare const createCSR: (addresses: string[], keys: forge.pki.rsa.KeyPair) => Partial<CertKey>;
17
- export declare const createCert: (customAddresses?: string[]) => CertKey;