@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.
Files changed (46) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/client/node/src/proxy/cameraDevice/cameraDevice.browser.d.ts +27 -15
  3. package/dist/client/node/src/proxy/cameraDevice/cameraDevice.node.d.ts +12 -7
  4. package/dist/src/api/database/types.d.ts +37 -27
  5. package/dist/src/api/go2rtc/api/application.d.ts +4 -3
  6. package/dist/src/api/go2rtc/api/config.d.ts +4 -3
  7. package/dist/src/api/go2rtc/api/snapshot.d.ts +4 -3
  8. package/dist/src/api/go2rtc/api/streams.d.ts +5 -5
  9. package/dist/src/api/go2rtc/index.d.ts +13 -4
  10. package/dist/src/api/go2rtc/queue.d.ts +10 -0
  11. package/dist/src/api/schemas/cameras.schema.d.ts +475 -13
  12. package/dist/src/api/schemas/config.schema.d.ts +12 -9
  13. package/dist/src/api/services/cameras.service.d.ts +16 -7
  14. package/dist/src/api/services/plugins.service.d.ts +2 -0
  15. package/dist/src/api/types/index.d.ts +22 -3
  16. package/dist/src/api/ws/nsp/status.d.ts +10 -2
  17. package/dist/src/api/ws/nsp/streams.d.ts +0 -15
  18. package/dist/src/api/ws/types.d.ts +14 -0
  19. package/dist/src/api.d.ts +3 -2
  20. package/dist/src/camera/index.d.ts +32 -19
  21. package/dist/src/camera/streaming/peer-connection.d.ts +5 -7
  22. package/dist/src/camera/streaming/streaming-session.d.ts +3 -3
  23. package/dist/src/camera/streaming/webrtc-connection.d.ts +4 -4
  24. package/dist/src/camera/types.d.ts +77 -19
  25. package/dist/src/go2rtc/index.d.ts +1 -0
  26. package/dist/src/plugins/cameraStorage.d.ts +4 -1
  27. package/dist/src/plugins/index.d.ts +0 -3
  28. package/dist/src/plugins/plugin.d.ts +1 -1
  29. package/dist/src/plugins/schema.d.ts +3 -3
  30. package/dist/src/plugins/types.d.ts +23 -13
  31. package/dist/src/proxy/client/cameraDevice.d.ts +20 -14
  32. package/dist/src/proxy/client/deviceManager.d.ts +13 -12
  33. package/dist/src/proxy/client/pluginsManager.d.ts +9 -12
  34. package/dist/src/proxy/client/queue.d.ts +10 -7
  35. package/dist/src/proxy/client/systemManager.d.ts +9 -9
  36. package/dist/src/proxy/index.d.ts +13 -7
  37. package/dist/src/proxy/proxies/camera.d.ts +62 -34
  38. package/dist/src/proxy/proxies/plugin.d.ts +5 -4
  39. package/dist/src/proxy/proxies/server.d.ts +4 -9
  40. package/dist/src/proxy/queue.d.ts +8 -9
  41. package/dist/src/proxy/types.d.ts +81 -106
  42. package/dist/src/services/config/index.d.ts +0 -1
  43. package/dist/src/services/config/types.d.ts +2 -1
  44. package/dist/src/services/logger/index.d.ts +5 -4
  45. package/package.json +4 -4
  46. /package/dist/src/camera/{subscribed.d.ts → utils/subscribed.d.ts} +0 -0
@@ -1,7 +1,8 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import type { SocketService } from '../../socket';
3
- import type { Camera, CameraDevice, StateValue, StateValues, OnSetEvent, PrebufferType, LightState, MotionState, AudioState, ObjectState, DoorbellState, SirenState, BaseLogger, FfmpegOptions, CameraInput } from '../../../../../shared/types';
3
+ import type { Camera, CameraDevice, StateValue, StateValues, OnSetEvent, LightState, MotionState, AudioState, ObjectState, DoorbellState, SirenState, BatteryState, BaseLogger, FfmpegOptions, CameraDelegate, CameraZone, CameraSource, CameraPublicProperties, CameraType, CameraInformation, CameraPrebufferDelegate } from '../../../../../shared/types';
4
4
  export declare class CameraDeviceClient implements CameraDevice {
5
+ private log;
5
6
  private socketService;
6
7
  private cameraSubject;
7
8
  private lightState;
@@ -10,51 +11,62 @@ export declare class CameraDeviceClient implements CameraDevice {
10
11
  private objectState;
11
12
  private doorbellState;
12
13
  private sirenState;
13
- onLightDetected: Observable<LightState>;
14
+ private batteryState;
15
+ onLightSwitched: Observable<LightState>;
14
16
  onMotionDetected: Observable<MotionState>;
15
17
  onAudioDetected: Observable<AudioState>;
16
18
  onObjectDetected: Observable<ObjectState>;
17
19
  onDoorbellPressed: Observable<DoorbellState>;
18
20
  onSirenDetected: Observable<SirenState>;
19
- logger: BaseLogger;
21
+ onBatteryChanged: Observable<BatteryState>;
22
+ delegate?: CameraDelegate;
23
+ prebufferDelegate?: CameraPrebufferDelegate;
20
24
  get id(): string;
21
25
  get nativeId(): string | undefined;
26
+ get pluginId(): string;
22
27
  get disabled(): boolean;
23
28
  get name(): string;
24
- get type(): string;
25
- get model(): string;
29
+ get type(): CameraType;
30
+ get info(): CameraInformation;
26
31
  get isCloud(): boolean;
27
32
  get hasLight(): boolean;
28
33
  get hasSiren(): boolean;
34
+ get hasBinarySensor(): boolean;
35
+ get hasBattery(): boolean;
29
36
  get hasMotionDetector(): boolean;
30
37
  get hasAudioDetector(): boolean;
31
38
  get hasObjectDetector(): boolean;
32
39
  get hasPtz(): boolean;
33
- get sources(): CameraInput[];
40
+ get motionZones(): CameraZone[];
41
+ get objectZones(): CameraZone[];
42
+ get sources(): CameraSource[];
34
43
  constructor(camera: Camera, socketService: SocketService, logger: BaseLogger);
35
- snapshot(sourceName?: string, prebuffer?: boolean): Promise<ArrayBuffer>;
36
- setPrebufferSource(sourceName: string, address: string, type: PrebufferType): Promise<void>;
37
- removePrebufferSource(sourceName: string, type: 'recording' | 'stream'): Promise<void>;
38
- removePrebufferSources(): Promise<void>;
44
+ reboot(): Promise<void>;
45
+ getStreamSource(): CameraSource;
46
+ getSnapshotSource(): CameraSource;
47
+ getRecordingSource(): CameraSource;
48
+ getDetectionSource(): CameraSource;
49
+ configureDelegate(delegate: CameraDelegate): void;
50
+ configurePrebufferDelegate(delegate: CameraPrebufferDelegate): void;
51
+ snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
39
52
  getFfmpegPath(): Promise<string>;
40
53
  getIceServers(): Promise<RTCIceServer[]>;
41
- getValue<T extends keyof StateValues>(stateName: T): StateValue<T>;
42
54
  createSession(): Promise<any>;
43
55
  streamVideo(sourceName: string, options: FfmpegOptions): Promise<any>;
44
56
  recordToFile(sourceName: string, outputPath: string, duration?: number): Promise<void>;
57
+ getValue<T extends keyof StateValues>(stateName: T): StateValue<T>;
45
58
  updateState<T extends keyof StateValues>(stateName: T, eventData: OnSetEvent<T>, isRemote?: boolean): Promise<void>;
46
59
  onStateChange<T extends keyof StateValues>(stateName: T): Observable<{
47
60
  newState: StateValues[T];
48
61
  oldState: StateValues[T];
49
62
  }>;
50
- onPropertyChange<T extends keyof Camera>(property: T): Observable<{
51
- oldState: Camera[T];
52
- newState: Camera[T];
63
+ onPropertyChange<T extends keyof CameraPublicProperties>(property: T): Observable<{
64
+ oldData: Camera[T];
65
+ newData: Camera[T];
53
66
  }>;
54
67
  removeAllListeners(): void;
55
68
  refreshStates(): Promise<void>;
56
69
  private updateCamera;
57
- private updateSources;
58
70
  private unsubscribe;
59
71
  private createStateObservable;
60
72
  private listenToChanges;
@@ -1,16 +1,21 @@
1
- import { CameraDeviceHub } from '../../../../../src/camera';
1
+ import { CameraController } from '../../../../../src/camera';
2
+ import { StreamingSession } from '../../../../../src/camera/streaming/streaming-session';
2
3
  import type { SocketService } from '../../socket';
3
- import type { Camera, StateValues, OnSetEvent, BaseLogger, IceServer, PrebufferType } from '../../../../../shared/types';
4
- export declare class CameraDeviceClient extends CameraDeviceHub {
4
+ import type { Camera, StateValues, OnSetEvent, BaseLogger, IceServer, StreamingConnectionOptions, FfmpegOptions, CameraSource } from '../../../../../shared/types';
5
+ export declare class CameraDeviceClient extends CameraController {
5
6
  private socketService;
7
+ private logger;
8
+ get sources(): CameraSource[];
6
9
  constructor(camera: Camera, socketService: SocketService, logger: BaseLogger);
7
- setPrebufferSource(sourceName: string, address: string | null, type: PrebufferType): Promise<void>;
8
- removePrebufferSource(sourceName: string, type: 'recording' | 'stream'): Promise<void>;
9
- removePrebufferSources(): Promise<void>;
10
+ reboot(): Promise<void>;
10
11
  getFfmpegPath(): Promise<string>;
11
12
  getIceServers(): Promise<IceServer[]>;
13
+ snapshot(forceNew?: boolean | undefined): Promise<ArrayBuffer>;
14
+ createSession(sourceName: string, options?: StreamingConnectionOptions): Promise<StreamingSession>;
15
+ streamVideo(sourceName: string, options: FfmpegOptions): Promise<StreamingSession>;
16
+ recordToFile(sourceName: string, outputPath: string, duration?: number): Promise<void>;
12
17
  updateState<T extends keyof StateValues>(stateName: T, eventData: OnSetEvent<T>): Promise<void>;
13
18
  refreshStates(): Promise<void>;
14
- removeAllListeners(): void;
19
+ private close;
15
20
  private listenToChanges;
16
21
  }
@@ -1,24 +1,24 @@
1
1
  import type { JwtTokenEncoded, ClientData } from '../types';
2
2
  export interface DBSettings {
3
- _id: string;
3
+ readonly _id: string;
4
4
  _rev?: string;
5
5
  settings: DBSetting;
6
6
  }
7
7
  export interface DBSetting {
8
8
  }
9
9
  export interface DBTokens {
10
- _id: string;
10
+ readonly _id: string;
11
11
  _rev?: string;
12
12
  tokens: JwtTokenEncoded[];
13
13
  clients: ClientData[];
14
14
  }
15
15
  export interface DBUsers {
16
- _id: string;
16
+ readonly _id: string;
17
17
  _rev?: string;
18
18
  users: DBUser[];
19
19
  }
20
20
  export interface DBUser {
21
- _id: string;
21
+ readonly _id: string;
22
22
  avatar: string;
23
23
  username: string;
24
24
  password: string;
@@ -36,21 +36,21 @@ export interface DBUserPreferences {
36
36
  };
37
37
  }
38
38
  export interface DBCamviewLayout {
39
- _id: string;
39
+ readonly _id: string;
40
40
  name: string;
41
41
  cameras: DBCamviewLayoutCamera[];
42
42
  }
43
43
  export interface DBCamviewLayoutCamera {
44
- _id: string;
44
+ readonly _id: string;
45
45
  name: string;
46
46
  }
47
47
  export interface DBPlugins {
48
- _id: string;
48
+ readonly _id: string;
49
49
  _rev?: string;
50
50
  plugins: DBPlugin[];
51
51
  }
52
52
  export interface DBPlugin {
53
- _id: string;
53
+ readonly _id: string;
54
54
  pluginName: string;
55
55
  storage: DBPluginStorage;
56
56
  }
@@ -63,12 +63,12 @@ export interface DBPluginStorageValue {
63
63
  [key: string]: any;
64
64
  }
65
65
  export interface DBCameras {
66
- _id: string;
66
+ readonly _id: string;
67
67
  _rev?: string;
68
68
  cameras: DBCamera[];
69
69
  }
70
70
  export interface BaseCamera {
71
- _id: string;
71
+ readonly _id: string;
72
72
  nativeId?: string;
73
73
  pluginId: string;
74
74
  name: string;
@@ -76,8 +76,12 @@ export interface BaseCamera {
76
76
  isCloud: boolean;
77
77
  hasLight: boolean;
78
78
  hasSiren: boolean;
79
- model: string;
79
+ hasBinarySensor: boolean;
80
+ hasBattery: boolean;
81
+ info: CameraInformation;
80
82
  type: CameraType;
83
+ motionZones: CameraZone[];
84
+ objectZones: CameraZone[];
81
85
  }
82
86
  export interface DBCamera extends BaseCamera {
83
87
  sources: CameraInputSettings[];
@@ -92,11 +96,23 @@ export interface Camera extends BaseCamera {
92
96
  hasPtz: boolean;
93
97
  sources: CameraInput[];
94
98
  }
95
- export type CameraPrivateProperties = '_id' | 'nativeId' | 'pluginId' | 'hasLight' | 'hasSiren' | 'isCloud';
99
+ export interface CameraZone {
100
+ name: string;
101
+ regions: ZoneRegion[];
102
+ }
103
+ export interface ZoneRegion {
104
+ _id: string;
105
+ coords: ZoneCoord[];
106
+ }
107
+ export interface ZoneCoord {
108
+ _id: string;
109
+ points: [number, number];
110
+ }
111
+ export type CameraPrivateProperties = '_id' | 'nativeId' | 'pluginId';
96
112
  export interface CameraPublicProperties extends Omit<Camera, CameraPrivateProperties> {
97
113
  }
98
114
  export type CameraType = 'camera' | 'doorbell';
99
- export interface CameraBranding {
115
+ export interface CameraInformation {
100
116
  model: string;
101
117
  manufacturer: string;
102
118
  hardware: string;
@@ -118,6 +134,7 @@ export interface CameraRecordingSettings {
118
134
  enabled: boolean;
119
135
  }
120
136
  export interface CameraInputSettings {
137
+ readonly _id: string;
121
138
  name: string;
122
139
  roles: CameraRoles[];
123
140
  urls: string[];
@@ -145,27 +162,20 @@ export interface Go2RtcFFMPEGSource {
145
162
  aac: string;
146
163
  opus: string;
147
164
  }
148
- export interface PrebufferStreamSource {
149
- source: string;
150
- rawUrl?: string | string[] | null;
151
- snapshotUrl: string;
152
- prebuffering?: boolean;
153
- }
154
- export interface Go2RtcPrebufferSource {
155
- stream: PrebufferStreamSource;
156
- recording: PrebufferStreamSource;
157
- }
158
- export interface StreamSources {
165
+ export interface Go2RtcWSSource {
159
166
  webrtc: string;
167
+ }
168
+ export interface StreamUrls {
169
+ ws: Go2RtcWSSource;
160
170
  rtsp: Go2RtcRTSPSource;
161
171
  transcoded: Go2RtcFFMPEGSource;
162
- prebuffer: Go2RtcPrebufferSource;
163
- endpoints: Go2RtcEndpoint;
172
+ www: Go2RtcEndpoint;
164
173
  }
165
174
  export interface CameraInput {
175
+ readonly _id: string;
166
176
  name: string;
167
177
  roles: CameraRoles[];
168
- sources: StreamSources;
178
+ urls: StreamUrls;
169
179
  }
170
180
  export type CameraRoles = 'detect' | 'record' | 'stream' | 'snapshot' | 'none';
171
181
  export interface CameraUiSettings {
@@ -1,8 +1,9 @@
1
+ import { RequestQueue } from '../queue';
1
2
  import type { ApplicationResponse, ExitData } from '../types';
2
- declare class ApplicationApi {
3
+ export declare class ApplicationApi {
4
+ private requestQueue;
5
+ constructor(requestQueue: RequestQueue);
3
6
  close(data: ExitData): Promise<void>;
4
7
  info(): Promise<ApplicationResponse>;
5
8
  restart(): Promise<void>;
6
9
  }
7
- declare const _default: ApplicationApi;
8
- export default _default;
@@ -1,8 +1,9 @@
1
+ import { RequestQueue } from '../queue';
1
2
  import type { AxiosResponse } from 'axios';
2
- declare class ConfigApi {
3
+ export declare class ConfigApi {
4
+ private requestQueue;
5
+ constructor(requestQueue: RequestQueue);
3
6
  getConfig(): Promise<AxiosResponse>;
4
7
  rewriteConfig(data: Record<string, any>): Promise<AxiosResponse>;
5
8
  mergeConfig(data: Record<string, any>): Promise<AxiosResponse>;
6
9
  }
7
- declare const _default: ConfigApi;
8
- export default _default;
@@ -1,7 +1,8 @@
1
+ import { RequestQueue } from '../queue';
1
2
  import type { SourceData } from '../types';
2
- declare class SnapshotApi {
3
+ export declare class SnapshotApi {
4
+ private requestQueue;
5
+ constructor(requestQueue: RequestQueue);
3
6
  jpeg(data: SourceData): Promise<ArrayBuffer>;
4
7
  mp4(data: SourceData): Promise<ArrayBuffer>;
5
8
  }
6
- declare const _default: SnapshotApi;
7
- export default _default;
@@ -1,11 +1,11 @@
1
+ import { RequestQueue } from '../queue';
1
2
  import type { AxiosResponse } from 'axios';
2
- import type { StreamData, SourceData, IntercomData } from '../types';
3
- declare class StreamsApi {
3
+ import type { StreamData, SourceData } from '../types';
4
+ export declare class StreamsApi {
5
+ private requestQueue;
6
+ constructor(requestQueue: RequestQueue);
4
7
  createStream(data: StreamData): Promise<AxiosResponse>;
5
8
  deleteStream(data: SourceData): Promise<AxiosResponse>;
6
9
  getStreamInfo(data: SourceData): Promise<AxiosResponse>;
7
- sendStreamToDst(data: IntercomData): Promise<AxiosResponse>;
8
10
  updateStreamSource(data: StreamData): Promise<AxiosResponse>;
9
11
  }
10
- declare const _default: StreamsApi;
11
- export default _default;
@@ -1,4 +1,13 @@
1
- export { default as ApplicationApi } from './api/application';
2
- export { default as StreamsApi } from './api/streams';
3
- export { default as SnapshotApi } from './api/snapshot';
4
- export { default as ConfigApi } from './api/config';
1
+ import { ApplicationApi } from './api/application';
2
+ import { ConfigApi } from './api/config';
3
+ import { SnapshotApi } from './api/snapshot';
4
+ import { StreamsApi } from './api/streams';
5
+ export declare class Go2RtcApi {
6
+ private requestQueue;
7
+ applicationApi: ApplicationApi;
8
+ configApi: ConfigApi;
9
+ snapshotApi: SnapshotApi;
10
+ streamsApi: StreamsApi;
11
+ constructor();
12
+ clear(): void;
13
+ }
@@ -0,0 +1,10 @@
1
+ type RequestFunction = () => Promise<any>;
2
+ export declare class RequestQueue {
3
+ private queue;
4
+ private isProcessing;
5
+ constructor();
6
+ enqueue(requestFunc: RequestFunction): Promise<any>;
7
+ clear(): void;
8
+ private processQueue;
9
+ }
10
+ export {};