@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
@@ -4,6 +4,7 @@ export declare class CameraUiClient {
4
4
  private api;
5
5
  private socketService?;
6
6
  private config;
7
+ private logger;
7
8
  private token?;
8
9
  private deviceManager?;
9
10
  private pluginsManager?;
@@ -1,11 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import type { SocketService } from '../../socket';
3
- import type { Camera, CameraDevice, StateValue, StateValues, OnSetEvent, CameraInput, LightState, MotionState, AudioState, ObjectState, DoorbellState, SirenState } from '../../../../../shared/types';
4
- export declare interface CameraDeviceClient {
5
- createSession(cameraInput: CameraInput, options?: {}): Promise<any>;
6
- streamVideo(cameraInput: CameraInput, options: {}): Promise<any>;
7
- recordToFile(cameraInput: CameraInput, outputPath: string, duration?: number): Promise<void>;
8
- }
3
+ import type { Camera, CameraDevice, StateValue, StateValues, OnSetEvent, PrebufferType, LightState, MotionState, AudioState, ObjectState, DoorbellState, SirenState, BaseLogger, FfmpegOptions, Input, CameraInput } from '../../../../../shared/types';
9
4
  export declare class CameraDeviceClient implements CameraDevice {
10
5
  private socketService;
11
6
  private cameraSubject;
@@ -21,15 +16,30 @@ export declare class CameraDeviceClient implements CameraDevice {
21
16
  onObjectDetected: Observable<ObjectState>;
22
17
  onDoorbellPressed: Observable<DoorbellState>;
23
18
  onSirenDetected: Observable<SirenState>;
19
+ logger: BaseLogger;
24
20
  get id(): string;
25
21
  get nativeId(): string | undefined;
26
- get pluginId(): string;
22
+ get disabled(): boolean;
27
23
  get name(): string;
28
24
  get type(): string;
29
25
  get model(): string;
30
- get sources(): CameraInput[];
31
- constructor(camera: Camera, socketService: SocketService);
26
+ get isCloud(): boolean;
27
+ get hasLight(): boolean;
28
+ get hasSiren(): boolean;
29
+ get hasMotionDetector(): boolean;
30
+ get hasAudioDetector(): boolean;
31
+ get hasObjectDetector(): boolean;
32
+ get hasPtz(): boolean;
33
+ get sources(): Input[];
34
+ constructor(camera: Camera, socketService: SocketService, logger: BaseLogger);
35
+ snapshot(source?: CameraInput | Input): Promise<ArrayBuffer>;
36
+ setPrebufferSource(sourceName: string, address: string | null, type: PrebufferType): Promise<void>;
37
+ getFfmpegPath(): Promise<string>;
38
+ getIceServers(): Promise<RTCIceServer[]>;
32
39
  getValue<T extends keyof StateValues>(stateName: T): StateValue<T>;
40
+ createSession(): Promise<any>;
41
+ streamVideo(sourceName: string, options: FfmpegOptions): Promise<any>;
42
+ recordToFile(sourceName: string, outputPath: string, duration?: number): Promise<void>;
33
43
  updateState<T extends keyof StateValues>(stateName: T, eventData: OnSetEvent<T>, isRemote?: boolean): Promise<void>;
34
44
  onStateChange<T extends keyof StateValues>(stateName: T): Observable<{
35
45
  newState: StateValues[T];
@@ -42,6 +52,7 @@ export declare class CameraDeviceClient implements CameraDevice {
42
52
  removeAllListeners(): void;
43
53
  refreshStates(): Promise<void>;
44
54
  private updateCamera;
55
+ private updateSources;
45
56
  private unsubscribe;
46
57
  private createStateObservable;
47
58
  private listenToChanges;
@@ -1,9 +1,11 @@
1
1
  import { CameraDeviceHub } from '../../../../../src/camera';
2
2
  import type { SocketService } from '../../socket';
3
- import type { Camera, StateValues, OnSetEvent } from '../../../../../shared/types';
3
+ import type { Camera, StateValues, OnSetEvent, BaseLogger, IceServer } from '../../../../../shared/types';
4
4
  export declare class CameraDeviceClient extends CameraDeviceHub {
5
5
  private socketService;
6
- constructor(camera: Camera, socketService: SocketService);
6
+ constructor(camera: Camera, socketService: SocketService, logger: BaseLogger);
7
+ getFfmpegPath(): Promise<string>;
8
+ getIceServers(): Promise<IceServer[]>;
7
9
  updateState<T extends keyof StateValues>(stateName: T, eventData: OnSetEvent<T>): Promise<void>;
8
10
  refreshStates(): Promise<void>;
9
11
  removeAllListeners(): void;
@@ -1,9 +1,10 @@
1
1
  import type { SocketService } from '../socket';
2
- import type { DeviceManagerProxyMethods, DeviceManagerProxyEventCallbacks, CameraConfig, CameraDevice } from '../../../../shared/types';
2
+ import type { DeviceManagerProxyMethods, DeviceManagerProxyEventCallbacks, CameraConfig, CameraDevice, BaseLogger } from '../../../../shared/types';
3
3
  export declare class DeviceManagerClient implements DeviceManagerProxyMethods {
4
4
  private socketService;
5
5
  private devices;
6
- constructor(socketService: SocketService);
6
+ private logger;
7
+ constructor(socketService: SocketService, logger: BaseLogger);
7
8
  getCameraByName(name: string): Promise<CameraDevice | undefined>;
8
9
  getCameraById(id: string): Promise<CameraDevice | undefined>;
9
10
  createCamera(camera: CameraConfig): Promise<CameraDevice>;
@@ -1,9 +1,13 @@
1
1
  import { Manager, type Socket } from 'socket.io-client';
2
+ import type { CameraDeviceProxyMethodNames, DeviceManagerProxyMethodNames, PluginsManagerProxyMethodNames, SystemManagerProxyMethodNames } from '../../../shared/types';
3
+ type ManagerMethodNames = DeviceManagerProxyMethodNames | SystemManagerProxyMethodNames | PluginsManagerProxyMethodNames;
4
+ type MethodNames<T> = T extends 'manager' ? ManagerMethodNames : T extends 'cameraDevice' ? CameraDeviceProxyMethodNames : never;
2
5
  export declare class SocketService {
3
6
  manager: Manager;
4
7
  private token;
5
8
  constructor(endpoint: string, token: string);
6
- sendRequest(managerType: string, methodName: string, args: any[]): Promise<any>;
9
+ sendRequest<T extends 'manager' | 'cameraDevice'>(managerType: T, methodName: MethodNames<T>, args: any[]): Promise<any>;
7
10
  getSocket(): Socket;
8
11
  close(): void;
9
12
  }
13
+ export {};
@@ -1,22 +1,24 @@
1
1
  import type { DeviceManagerClient, PluginsManagerClient, SystemManagerClient } from './proxy';
2
- export type { BasicPeerConnection, CameraConfig, CameraDevice, Camera, CameraInput, Go2RtcIceCandidateMessage, Go2RtcOfferMessage, Go2RtcAnswerMessage, Go2RtcIncomingMessage, Go2RtcOutgoingMessage, LightState, MotionState, AudioState, ObjectState, DoorbellState, SirenState, } from '../../../shared/types';
2
+ import type { BaseLogger } from '../../../shared/types';
3
+ export type { BaseLogger, BasicPeerConnection, CameraConfig, CameraDevice, Camera, CameraInput, FfmpegOptions, Go2RtcIceCandidateMessage, Go2RtcOfferMessage, Go2RtcAnswerMessage, Go2RtcIncomingMessage, Go2RtcOutgoingMessage, LightState, MotionState, AudioState, ObjectState, DoorbellState, SirenState, } from '../../../shared/types';
3
4
  export type CameraUiClientConfig = WithCredentials | WithToken;
4
5
  export interface API {
5
6
  deviceManager: DeviceManagerClient;
6
7
  pluginsManager: PluginsManagerClient;
7
8
  systemManager: SystemManagerClient;
8
9
  }
9
- type WithCredentials = {
10
+ interface BaseConfig {
10
11
  endpoint: string;
11
12
  skipCheck?: boolean;
13
+ logger?: BaseLogger;
14
+ }
15
+ interface WithCredentials extends BaseConfig {
12
16
  username: string;
13
17
  password: string;
14
18
  token?: never;
15
- };
16
- type WithToken = {
17
- endpoint: string;
18
- skipCheck?: boolean;
19
+ }
20
+ interface WithToken extends BaseConfig {
19
21
  username?: never;
20
22
  password?: never;
21
23
  token: string;
22
- };
24
+ }
@@ -73,6 +73,9 @@ export interface BaseCamera {
73
73
  pluginId: string;
74
74
  name: string;
75
75
  disabled: boolean;
76
+ isCloud: boolean;
77
+ hasLight: boolean;
78
+ hasSiren: boolean;
76
79
  model: string;
77
80
  type: CameraType;
78
81
  }
@@ -83,8 +86,15 @@ export interface DBCamera extends BaseCamera {
83
86
  recording: CameraRecordingSettings;
84
87
  }
85
88
  export interface Camera extends BaseCamera {
89
+ hasAudioDetector: boolean;
90
+ hasMotionDetector: boolean;
91
+ hasObjectDetector: boolean;
92
+ hasPtz: boolean;
86
93
  sources: CameraInput[];
87
94
  }
95
+ export type CameraPrivateProperties = '_id' | 'nativeId' | 'pluginId' | 'hasLight' | 'hasSiren' | 'isCloud';
96
+ export interface CameraPublicProperties extends Omit<Camera, CameraPrivateProperties> {
97
+ }
88
98
  export type CameraType = 'camera' | 'doorbell';
89
99
  export interface CameraBranding {
90
100
  model: string;
@@ -98,7 +108,7 @@ export interface CameraExtensions {
98
108
  hub?: string[];
99
109
  prebuffer?: string;
100
110
  motionDetection?: string;
101
- soundDetection?: string;
111
+ audioDetection?: string;
102
112
  objectDetection?: string;
103
113
  intercom?: string;
104
114
  ptz?: string;
@@ -135,16 +145,21 @@ export interface Go2RtcFFMPEGSource {
135
145
  aac: string;
136
146
  opus: string;
137
147
  }
138
- export interface Go2RtcSources {
148
+ export interface Go2RtcPrebufferSource {
149
+ stream?: string;
150
+ recording?: string;
151
+ }
152
+ export interface StreamSources {
139
153
  webrtc: string;
140
154
  rtsp: Go2RtcRTSPSource;
141
- ffmpeg: Go2RtcFFMPEGSource;
142
- endpoint: Go2RtcEndpoint;
155
+ transcoded: Go2RtcFFMPEGSource;
156
+ prebuffer: Go2RtcPrebufferSource;
157
+ endpoints: Go2RtcEndpoint;
143
158
  }
144
159
  export interface CameraInput {
145
160
  name: string;
146
161
  roles: CameraRoles[];
147
- sources: Go2RtcSources;
162
+ sources: StreamSources;
148
163
  }
149
164
  export type CameraRoles = 'detect' | 'record' | 'stream' | 'snapshot' | 'none';
150
165
  export interface CameraUiSettings {
@@ -1,6 +1,6 @@
1
- import type { ApplicationResponse } from '../types';
1
+ import type { ApplicationResponse, ExitData } from '../types';
2
2
  declare class ApplicationService {
3
- close(query: any): Promise<void>;
3
+ close(data: ExitData): Promise<void>;
4
4
  info(): Promise<ApplicationResponse>;
5
5
  restart(): Promise<void>;
6
6
  }
@@ -1,6 +1,7 @@
1
+ import type { SourceData } from '../types';
1
2
  declare class SnapshotService {
2
- jpeg(data: any): Promise<string>;
3
- mp4(data: any): Promise<string>;
3
+ jpeg(data: SourceData): Promise<string>;
4
+ mp4(data: SourceData): Promise<string>;
4
5
  }
5
6
  declare const _default: SnapshotService;
6
7
  export default _default;
@@ -1,10 +1,11 @@
1
1
  import type { AxiosResponse } from 'axios';
2
+ import type { StreamData, SourceData, IntercomData } from '../types';
2
3
  declare class StreamsService {
3
- createStream(data: any): Promise<AxiosResponse>;
4
- deleteStream(data: any): Promise<AxiosResponse>;
5
- getStreamInfo(data: any): Promise<AxiosResponse>;
6
- sendStreamToDst(data: any): Promise<AxiosResponse>;
7
- updateStreamSource(data: any): Promise<AxiosResponse>;
4
+ createStream(data: StreamData): Promise<AxiosResponse>;
5
+ deleteStream(data: SourceData): Promise<AxiosResponse>;
6
+ getStreamInfo(data: SourceData): Promise<AxiosResponse>;
7
+ sendStreamToDst(data: IntercomData): Promise<AxiosResponse>;
8
+ updateStreamSource(data: StreamData): Promise<AxiosResponse>;
8
9
  }
9
10
  declare const _default: StreamsService;
10
11
  export default _default;
@@ -41,3 +41,17 @@ export interface OnvifSource {
41
41
  name: string;
42
42
  url: string;
43
43
  }
44
+ export interface ExitData {
45
+ code: number;
46
+ }
47
+ export interface SourceData {
48
+ src: string;
49
+ }
50
+ export interface StreamData {
51
+ src: string;
52
+ name: string;
53
+ }
54
+ export interface IntercomData {
55
+ src: string;
56
+ dst: string;
57
+ }
@@ -34,9 +34,8 @@ export declare const extensionsSettingsSchema: zod.ZodObject<{
34
34
  hub: zod.ZodOptional<zod.ZodArray<zod.ZodString, "many">>;
35
35
  prebuffer: zod.ZodOptional<zod.ZodString>;
36
36
  motionDetection: zod.ZodOptional<zod.ZodString>;
37
- soundDetection: zod.ZodOptional<zod.ZodString>;
37
+ audioDetection: zod.ZodOptional<zod.ZodString>;
38
38
  objectDetection: zod.ZodOptional<zod.ZodString>;
39
- intercom: zod.ZodOptional<zod.ZodString>;
40
39
  ptz: zod.ZodOptional<zod.ZodString>;
41
40
  plugins: zod.ZodArray<zod.ZodString, "many">;
42
41
  }, "strict", zod.ZodTypeAny, {
@@ -44,18 +43,16 @@ export declare const extensionsSettingsSchema: zod.ZodObject<{
44
43
  hub?: string[] | undefined;
45
44
  prebuffer?: string | undefined;
46
45
  motionDetection?: string | undefined;
47
- soundDetection?: string | undefined;
46
+ audioDetection?: string | undefined;
48
47
  objectDetection?: string | undefined;
49
- intercom?: string | undefined;
50
48
  ptz?: string | undefined;
51
49
  }, {
52
50
  plugins: string[];
53
51
  hub?: string[] | undefined;
54
52
  prebuffer?: string | undefined;
55
53
  motionDetection?: string | undefined;
56
- soundDetection?: string | undefined;
54
+ audioDetection?: string | undefined;
57
55
  objectDetection?: string | undefined;
58
- intercom?: string | undefined;
59
56
  ptz?: string | undefined;
60
57
  }>;
61
58
  export declare const streamingModeSchema: zod.ZodUnion<[zod.ZodLiteral<"mse">, zod.ZodLiteral<"webrtc">, zod.ZodLiteral<"webrtc/tcp">, zod.ZodLiteral<"mjpeg">, zod.ZodLiteral<"hls">, zod.ZodLiteral<"mp4">]>;
@@ -72,9 +69,12 @@ export declare const createCameraSchema: zod.ZodObject<{
72
69
  nativeId: zod.ZodOptional<zod.ZodString>;
73
70
  pluginId: zod.ZodDefault<zod.ZodString>;
74
71
  disabled: zod.ZodDefault<zod.ZodBoolean>;
75
- model: zod.ZodDefault<zod.ZodOptional<zod.ZodString>>;
76
- type: zod.ZodDefault<zod.ZodUnion<[zod.ZodLiteral<"camera">, zod.ZodLiteral<"doorbell">]>>;
77
72
  name: zod.ZodString;
73
+ type: zod.ZodDefault<zod.ZodUnion<[zod.ZodLiteral<"camera">, zod.ZodLiteral<"doorbell">]>>;
74
+ isCloud: zod.ZodDefault<zod.ZodBoolean>;
75
+ hasLight: zod.ZodDefault<zod.ZodBoolean>;
76
+ hasSiren: zod.ZodDefault<zod.ZodBoolean>;
77
+ model: zod.ZodDefault<zod.ZodOptional<zod.ZodString>>;
78
78
  sources: zod.ZodArray<zod.ZodObject<{
79
79
  name: zod.ZodEffects<zod.ZodString, string, string>;
80
80
  roles: zod.ZodEffects<zod.ZodArray<zod.ZodUnion<[zod.ZodLiteral<"detect">, zod.ZodLiteral<"record">, zod.ZodLiteral<"stream">, zod.ZodLiteral<"snapshot">, zod.ZodLiteral<"none">]>, "many">, ("detect" | "record" | "stream" | "snapshot" | "none")[], ("detect" | "record" | "stream" | "snapshot" | "none")[]>;
@@ -92,9 +92,8 @@ export declare const createCameraSchema: zod.ZodObject<{
92
92
  hub: zod.ZodOptional<zod.ZodArray<zod.ZodString, "many">>;
93
93
  prebuffer: zod.ZodOptional<zod.ZodString>;
94
94
  motionDetection: zod.ZodOptional<zod.ZodString>;
95
- soundDetection: zod.ZodOptional<zod.ZodString>;
95
+ audioDetection: zod.ZodOptional<zod.ZodString>;
96
96
  objectDetection: zod.ZodOptional<zod.ZodString>;
97
- intercom: zod.ZodOptional<zod.ZodString>;
98
97
  ptz: zod.ZodOptional<zod.ZodString>;
99
98
  plugins: zod.ZodArray<zod.ZodString, "many">;
100
99
  }, "strict", zod.ZodTypeAny, {
@@ -102,18 +101,16 @@ export declare const createCameraSchema: zod.ZodObject<{
102
101
  hub?: string[] | undefined;
103
102
  prebuffer?: string | undefined;
104
103
  motionDetection?: string | undefined;
105
- soundDetection?: string | undefined;
104
+ audioDetection?: string | undefined;
106
105
  objectDetection?: string | undefined;
107
- intercom?: string | undefined;
108
106
  ptz?: string | undefined;
109
107
  }, {
110
108
  plugins: string[];
111
109
  hub?: string[] | undefined;
112
110
  prebuffer?: string | undefined;
113
111
  motionDetection?: string | undefined;
114
- soundDetection?: string | undefined;
112
+ audioDetection?: string | undefined;
115
113
  objectDetection?: string | undefined;
116
- intercom?: string | undefined;
117
114
  ptz?: string | undefined;
118
115
  }>>;
119
116
  recording: zod.ZodDefault<zod.ZodObject<{
@@ -136,6 +133,9 @@ export declare const createCameraSchema: zod.ZodObject<{
136
133
  type: "camera" | "doorbell";
137
134
  pluginId: string;
138
135
  disabled: boolean;
136
+ isCloud: boolean;
137
+ hasLight: boolean;
138
+ hasSiren: boolean;
139
139
  model: string;
140
140
  sources: {
141
141
  name: string;
@@ -147,9 +147,8 @@ export declare const createCameraSchema: zod.ZodObject<{
147
147
  hub?: string[] | undefined;
148
148
  prebuffer?: string | undefined;
149
149
  motionDetection?: string | undefined;
150
- soundDetection?: string | undefined;
150
+ audioDetection?: string | undefined;
151
151
  objectDetection?: string | undefined;
152
- intercom?: string | undefined;
153
152
  ptz?: string | undefined;
154
153
  };
155
154
  recording: {
@@ -170,16 +169,18 @@ export declare const createCameraSchema: zod.ZodObject<{
170
169
  nativeId?: string | undefined;
171
170
  pluginId?: string | undefined;
172
171
  disabled?: boolean | undefined;
173
- model?: string | undefined;
174
172
  type?: "camera" | "doorbell" | undefined;
173
+ isCloud?: boolean | undefined;
174
+ hasLight?: boolean | undefined;
175
+ hasSiren?: boolean | undefined;
176
+ model?: string | undefined;
175
177
  extensions?: {
176
178
  plugins: string[];
177
179
  hub?: string[] | undefined;
178
180
  prebuffer?: string | undefined;
179
181
  motionDetection?: string | undefined;
180
- soundDetection?: string | undefined;
182
+ audioDetection?: string | undefined;
181
183
  objectDetection?: string | undefined;
182
- intercom?: string | undefined;
183
184
  ptz?: string | undefined;
184
185
  } | undefined;
185
186
  recording?: {
@@ -211,27 +212,24 @@ export declare const patchCameraSchema: zod.ZodObject<{
211
212
  hub: zod.ZodOptional<zod.ZodOptional<zod.ZodArray<zod.ZodString, "many">>>;
212
213
  prebuffer: zod.ZodOptional<zod.ZodOptional<zod.ZodString>>;
213
214
  motionDetection: zod.ZodOptional<zod.ZodOptional<zod.ZodString>>;
214
- soundDetection: zod.ZodOptional<zod.ZodOptional<zod.ZodString>>;
215
+ audioDetection: zod.ZodOptional<zod.ZodOptional<zod.ZodString>>;
215
216
  objectDetection: zod.ZodOptional<zod.ZodOptional<zod.ZodString>>;
216
- intercom: zod.ZodOptional<zod.ZodOptional<zod.ZodString>>;
217
217
  ptz: zod.ZodOptional<zod.ZodOptional<zod.ZodString>>;
218
218
  plugins: zod.ZodOptional<zod.ZodArray<zod.ZodString, "many">>;
219
219
  }, "strict", zod.ZodTypeAny, {
220
220
  hub?: string[] | undefined;
221
221
  prebuffer?: string | undefined;
222
222
  motionDetection?: string | undefined;
223
- soundDetection?: string | undefined;
223
+ audioDetection?: string | undefined;
224
224
  objectDetection?: string | undefined;
225
- intercom?: string | undefined;
226
225
  ptz?: string | undefined;
227
226
  plugins?: string[] | undefined;
228
227
  }, {
229
228
  hub?: string[] | undefined;
230
229
  prebuffer?: string | undefined;
231
230
  motionDetection?: string | undefined;
232
- soundDetection?: string | undefined;
231
+ audioDetection?: string | undefined;
233
232
  objectDetection?: string | undefined;
234
- intercom?: string | undefined;
235
233
  ptz?: string | undefined;
236
234
  plugins?: string[] | undefined;
237
235
  }>>;
@@ -263,9 +261,8 @@ export declare const patchCameraSchema: zod.ZodObject<{
263
261
  hub?: string[] | undefined;
264
262
  prebuffer?: string | undefined;
265
263
  motionDetection?: string | undefined;
266
- soundDetection?: string | undefined;
264
+ audioDetection?: string | undefined;
267
265
  objectDetection?: string | undefined;
268
- intercom?: string | undefined;
269
266
  ptz?: string | undefined;
270
267
  plugins?: string[] | undefined;
271
268
  } | undefined;
@@ -289,9 +286,8 @@ export declare const patchCameraSchema: zod.ZodObject<{
289
286
  hub?: string[] | undefined;
290
287
  prebuffer?: string | undefined;
291
288
  motionDetection?: string | undefined;
292
- soundDetection?: string | undefined;
289
+ audioDetection?: string | undefined;
293
290
  objectDetection?: string | undefined;
294
- intercom?: string | undefined;
295
291
  ptz?: string | undefined;
296
292
  plugins?: string[] | undefined;
297
293
  } | undefined;
@@ -61,9 +61,9 @@ export declare const mqttSchema: zod.ZodObject<{
61
61
  key?: string | undefined;
62
62
  }>>>;
63
63
  }, "strict", zod.ZodTypeAny, {
64
+ enabled: boolean;
64
65
  host: string;
65
66
  port: number;
66
- enabled: boolean;
67
67
  topicPrefix: string;
68
68
  clientId: string;
69
69
  tls: {
@@ -161,11 +161,11 @@ export declare const patchConfigSchema: zod.ZodObject<{
161
161
  snapshotCache?: number | undefined;
162
162
  }>>;
163
163
  }, "strict", zod.ZodTypeAny, {
164
- port: number;
165
164
  plugins: {
166
165
  sudo?: boolean | undefined;
167
166
  disabledPlugins?: string[] | undefined;
168
167
  };
168
+ port: number;
169
169
  ssl: {
170
170
  certFile: string;
171
171
  keyFile: string;
@@ -1,5 +1,6 @@
1
1
  import type { DBCamera, Camera } from '../database/types';
2
2
  import { type CameraExtension } from '../../plugins/types';
3
+ import type { PrebufferType } from '../../camera/types';
3
4
  type DeepPartial<T> = T extends object ? {
4
5
  [P in keyof T]?: DeepPartial<T[P]>;
5
6
  } : T;
@@ -12,6 +13,7 @@ export default class CamerasService {
12
13
  private pluginsService;
13
14
  constructor();
14
15
  createCamera(cameraData: DBCamera): Promise<DBCamera>;
16
+ createCameraSource(cameraName: string, sourceName: string, address: string | null, type: PrebufferType): Promise<string>;
15
17
  createTransformedCamera(cameraData: DBCamera): Promise<Camera>;
16
18
  list(): Promise<DBCamera[]>;
17
19
  listTransformed(): Promise<Camera[]>;
@@ -30,11 +32,12 @@ export default class CamerasService {
30
32
  disableExtensionByName(cameraname: string, pluginName: string, type?: CameraExtension): Promise<DBCamera | undefined>;
31
33
  addExtensionByName(cameraname: string, pluginName: string): Promise<DBCamera | undefined>;
32
34
  removeExtensionByName(cameraname: string, pluginName: string): Promise<DBCamera | undefined>;
35
+ removeExtension(pluginName: string): Promise<void>;
33
36
  removeByName(cameraname: string): Promise<void>;
34
37
  removeById(id: string): Promise<void>;
35
38
  removeByPluginId(pluginId: string): Promise<void>;
36
39
  removeByPluginIdAndName(cameraname: string, pluginId: string): Promise<void>;
37
40
  removeAll(): Promise<void>;
38
- transformCamera(camera: DBCamera): Camera;
41
+ private transformCamera;
39
42
  }
40
43
  export {};
@@ -0,0 +1,15 @@
1
+ export declare const HOST_CERT_FILENAME = "camera.ui.cert.pem";
2
+ export declare const HOST_KEY_FILENAME = "camera.ui.key.pem";
3
+ export declare const ROOT_CERT_FILENAME = "camera.ui.root.cert.pem";
4
+ export declare const ROOT_KEY_FILENAME = "camera.ui.root.key.pem";
5
+ export declare const P12_FILENAME = "camera.ui.p12";
6
+ export declare const P12_PASSWORD = "camera.ui";
7
+ export declare const DEFAULTS: {
8
+ C: string;
9
+ ST: string;
10
+ L: string;
11
+ O: string;
12
+ OU: string;
13
+ CN: string;
14
+ ROOT_CN: string;
15
+ };
package/dist/src/api.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  /// <reference types="node" />
2
2
  import EventEmitter from 'events';
3
+ import { CameraDeviceHub } from './camera';
3
4
  import type { PluginLogger } from './services/logger';
4
5
  import type { PluginContract } from './plugins/types';
5
6
  import type { PluginConfigService } from './plugins/config';
6
7
  import type { BasePlugin } from './plugins/base';
7
- import type { Storage } from './plugins/storage';
8
+ import type { Storage } from './plugins/storageController';
8
9
  import type { Camera } from './api/database/types';
9
10
  import type { DeviceManager, PluginsManager, SystemManager } from './proxy/client';
10
- import type { CameraDevice } from './camera/types';
11
11
  export interface PluginInitializer {
12
12
  (api: API): void | Promise<void>;
13
13
  }
@@ -54,7 +54,7 @@ export declare class CameraUiAPI extends EventEmitter implements API {
54
54
  constructor();
55
55
  configureCameras(): Promise<void>;
56
56
  addCamera(camera: Camera): void;
57
- getCamera(cameraId: string): CameraDevice | undefined;
58
- updateCamera(cameraData: Camera): Promise<void>;
57
+ getCamera(cameraId: string): CameraDeviceHub | undefined;
58
+ updateCamera(cameraData: Camera): void;
59
59
  removeCamera(cameraId: string): Promise<void>;
60
60
  }
@@ -1,14 +1,11 @@
1
- import 'reflect-metadata';
2
1
  import { Observable } from 'rxjs';
3
2
  import { StreamingSession } from './streaming/streaming-session';
4
- import type { Camera, CameraInput } from '../api/database/types';
5
- import type { StateValues, OnSetEvent, LightState, MotionState, AudioState, ObjectState, DoorbellState, SirenState, StreamingConnectionOptions, FfmpegOptions } from './types';
6
- import type { CameraDevice } from './types';
7
- import type { Logger, PluginLogger } from '../services/logger';
3
+ import type { Camera, CameraInput, CameraPublicProperties } from '../api/database/types';
4
+ import type { ProxyServer } from '../proxy';
5
+ import type { CameraDevice, BaseLogger, Input } from './types';
6
+ import type { IceServer } from '../services/config/types';
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
- private isWorker;
10
- private ffmpegPath;
11
- private logger;
12
9
  private proxy?;
13
10
  private cameraSubject;
14
11
  private lightState;
@@ -23,28 +20,41 @@ export declare class CameraDeviceHub implements CameraDevice {
23
20
  onObjectDetected: Observable<ObjectState>;
24
21
  onDoorbellPressed: Observable<DoorbellState>;
25
22
  onSirenDetected: Observable<SirenState>;
23
+ logger: BaseLogger;
26
24
  get id(): string;
27
25
  get nativeId(): string | undefined;
28
- get pluginId(): string;
26
+ get disabled(): boolean;
29
27
  get name(): string;
30
28
  get type(): string;
31
29
  get model(): string;
32
- get sources(): CameraInput[];
33
- constructor(camera: Camera, logger: Logger | PluginLogger | Console);
30
+ get isCloud(): boolean;
31
+ get hasLight(): boolean;
32
+ get hasSiren(): boolean;
33
+ get hasMotionDetector(): boolean;
34
+ get hasAudioDetector(): boolean;
35
+ get hasObjectDetector(): boolean;
36
+ get hasPtz(): boolean;
37
+ get sources(): Input[];
38
+ constructor(camera: Camera, logger?: BaseLogger, proxy?: ProxyServer);
39
+ snapshot(source?: CameraInput | Input): Promise<ArrayBuffer>;
40
+ setPrebufferSource(sourceName: string, address: string | null, type: PrebufferType): Promise<void>;
41
+ getFfmpegPath(): Promise<string>;
42
+ getIceServers(): Promise<IceServer[]>;
34
43
  getValue<T extends keyof StateValues>(stateName: T): StateValues[T];
35
- createSession(cameraInput: CameraInput, options?: StreamingConnectionOptions): Promise<StreamingSession>;
36
- streamVideo(cameraInput: CameraInput, options: FfmpegOptions): Promise<StreamingSession>;
37
- recordToFile(cameraInput: CameraInput, outputPath: string, duration?: number): Promise<void>;
38
- updateState<T extends keyof StateValues>(stateName: T, eventData: OnSetEvent<T>): void;
44
+ createSession(sourceName: string, options?: StreamingConnectionOptions): Promise<StreamingSession>;
45
+ streamVideo(sourceName: string, options: FfmpegOptions): Promise<StreamingSession>;
46
+ recordToFile(sourceName: string, outputPath: string, duration?: number): Promise<void>;
47
+ updateState<T extends keyof StateValues>(stateName: T, eventData: OnSetEvent<T>): Promise<void>;
39
48
  onStateChange<T extends keyof StateValues>(stateName: T): Observable<{
40
49
  newState: StateValues[T];
41
50
  oldState: StateValues[T];
42
51
  }>;
43
- onPropertyChange<T extends keyof Camera>(property: T): Observable<{
52
+ onPropertyChange<T extends keyof CameraPublicProperties>(property: T): Observable<{
44
53
  oldState: Camera[T];
45
54
  newState: Camera[T];
46
55
  }>;
47
56
  updateCamera(camera: Camera): void;
57
+ updateSources(sources: CameraInput[]): void;
48
58
  removeCamera(): void;
49
59
  removeAllListeners(): void;
50
60
  private createStateObservable;
@@ -1,25 +1,25 @@
1
1
  import { ReplaySubject, Subject } from 'rxjs';
2
- import { MediaStreamTrack } from 'werift';
2
+ import { MediaStreamTrack, RTCSessionDescription } from 'werift';
3
3
  import { Subscribed } from '../subscribed';
4
4
  import type { WebSocket } from 'ws';
5
5
  import type { RtpPacket, RtcpPacket, RTCIceCandidate } from 'werift';
6
- import type { BasicPeerConnection } from '../types';
7
- import type { Logger, PluginLogger } from '../../services/logger';
6
+ import type { BasicPeerConnection, CameraDevice } from '../types';
7
+ import type { IceServer } from '../../services/config/types';
8
8
  export declare class WeriftPeerConnection extends Subscribed implements BasicPeerConnection {
9
9
  onAudioRtp: Subject<RtpPacket>;
10
10
  onAudioRtcp: Subject<RtcpPacket>;
11
11
  onVideoRtp: Subject<RtpPacket>;
12
12
  onVideoRtcp: Subject<RtcpPacket>;
13
13
  onIceCandidate: Subject<RTCIceCandidate>;
14
- onConnectionState: ReplaySubject<"closed" | "connected" | "disconnected" | "connecting" | "failed" | "new">;
14
+ onConnectionState: ReplaySubject<"closed" | "failed" | "disconnected" | "new" | "connecting" | "connected">;
15
15
  returnAudioTrack: MediaStreamTrack;
16
16
  private pc;
17
17
  private ws?;
18
- private cameraName;
18
+ private cameraDevice;
19
19
  private logger;
20
20
  private onRequestKeyFrame;
21
- constructor(cameraName: string, logger: Logger | PluginLogger | Console, ws?: WebSocket);
22
- createOffer(): Promise<import("werift").RTCSessionDescription>;
21
+ constructor(cameraDevice: CameraDevice, iceServers: IceServer[], ws?: WebSocket);
22
+ createOffer(): Promise<RTCSessionDescription>;
23
23
  acceptAnswer(answer: {
24
24
  type: 'answer';
25
25
  sdp: string;