@camera.ui/browser 0.0.33 → 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.
Files changed (36) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/client/node/src/proxy/cameraDevice/cameraDevice.browser.d.ts +21 -9
  3. package/dist/client/node/src/proxy/cameraDevice/cameraDevice.node.d.ts +4 -1
  4. package/dist/src/api/database/types.d.ts +51 -17
  5. package/dist/src/api/go2rtc/api/application.d.ts +4 -3
  6. package/dist/src/api/go2rtc/api/config.d.ts +9 -0
  7. package/dist/src/api/go2rtc/api/snapshot.d.ts +6 -5
  8. package/dist/src/api/go2rtc/api/streams.d.ts +5 -5
  9. package/dist/src/api/go2rtc/index.d.ts +13 -3
  10. package/dist/src/api/go2rtc/queue.d.ts +10 -0
  11. package/dist/src/api/schemas/cameras.schema.d.ts +363 -7
  12. package/dist/src/api/schemas/config.schema.d.ts +3 -0
  13. package/dist/src/api/schemas/go2rtc.schema.d.ts +2 -2
  14. package/dist/src/api/services/cameras.service.d.ts +20 -7
  15. package/dist/src/api/services/plugins.service.d.ts +2 -0
  16. package/dist/src/api/types/index.d.ts +22 -3
  17. package/dist/src/camera/index.d.ts +23 -10
  18. package/dist/src/camera/types.d.ts +35 -17
  19. package/dist/src/plugins/cameraStorage.d.ts +24 -15
  20. package/dist/src/plugins/index.d.ts +0 -3
  21. package/dist/src/plugins/plugin.d.ts +1 -1
  22. package/dist/src/plugins/types.d.ts +16 -6
  23. package/dist/src/proxy/client/cameraDevice.d.ts +11 -8
  24. package/dist/src/proxy/client/deviceManager.d.ts +13 -12
  25. package/dist/src/proxy/client/pluginsManager.d.ts +9 -12
  26. package/dist/src/proxy/client/queue.d.ts +9 -6
  27. package/dist/src/proxy/client/systemManager.d.ts +9 -9
  28. package/dist/src/proxy/index.d.ts +13 -10
  29. package/dist/src/proxy/proxies/camera.d.ts +52 -21
  30. package/dist/src/proxy/proxies/plugin.d.ts +5 -4
  31. package/dist/src/proxy/proxies/server.d.ts +4 -9
  32. package/dist/src/proxy/queue.d.ts +9 -10
  33. package/dist/src/proxy/types.d.ts +70 -87
  34. package/dist/src/services/config/index.d.ts +2 -2
  35. package/dist/src/services/config/types.d.ts +2 -1
  36. package/package.json +2 -2
@@ -1,9 +1,10 @@
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, Input } from '../../../../../shared/types';
3
+ import type { Camera, CameraDevice, StateValue, StateValues, OnSetEvent, PrebufferType, LightState, MotionState, AudioState, ObjectState, DoorbellState, SirenState, BaseLogger, FfmpegOptions, CameraDelegate, CameraZone, CameraSource, CameraPublicProperties } from '../../../../../shared/types';
4
4
  export declare class CameraDeviceClient implements CameraDevice {
5
5
  private socketService;
6
6
  private cameraSubject;
7
+ private prebufferSubject;
7
8
  private lightState;
8
9
  private motionState;
9
10
  private audioState;
@@ -17,8 +18,10 @@ export declare class CameraDeviceClient implements CameraDevice {
17
18
  onDoorbellPressed: Observable<DoorbellState>;
18
19
  onSirenDetected: Observable<SirenState>;
19
20
  logger: BaseLogger;
21
+ delegate?: CameraDelegate;
20
22
  get id(): string;
21
23
  get nativeId(): string | undefined;
24
+ get pluginId(): string;
22
25
  get disabled(): boolean;
23
26
  get name(): string;
24
27
  get type(): string;
@@ -30,29 +33,38 @@ export declare class CameraDeviceClient implements CameraDevice {
30
33
  get hasAudioDetector(): boolean;
31
34
  get hasObjectDetector(): boolean;
32
35
  get hasPtz(): boolean;
33
- get sources(): Input[];
36
+ get motionZones(): CameraZone[];
37
+ get objectZones(): CameraZone[];
38
+ get sources(): CameraSource[];
34
39
  constructor(camera: Camera, socketService: SocketService, logger: BaseLogger);
35
- snapshot(sourceName?: string): Promise<ArrayBuffer>;
36
- setPrebufferSource(sourceName: string, address: string | null, type: PrebufferType, initialData?: boolean): Promise<void>;
40
+ getStreamSource(): CameraSource;
41
+ getSnapshotSource(): CameraSource;
42
+ getRecordingSource(): CameraSource;
43
+ getDetectionSource(): CameraSource;
44
+ configureDelegate(delegate: CameraDelegate): void;
45
+ snapshot(prebuffer?: boolean): Promise<ArrayBuffer>;
46
+ setPrebufferSource(sourceIdOrName: string, address: string, type: PrebufferType): Promise<void>;
47
+ removePrebufferSource(sourceIdOrName: string, type: 'recording' | 'stream'): Promise<void>;
48
+ removePrebufferSources(): Promise<void>;
37
49
  getFfmpegPath(): Promise<string>;
38
50
  getIceServers(): Promise<RTCIceServer[]>;
39
- getValue<T extends keyof StateValues>(stateName: T): StateValue<T>;
40
51
  createSession(): Promise<any>;
41
52
  streamVideo(sourceName: string, options: FfmpegOptions): Promise<any>;
42
53
  recordToFile(sourceName: string, outputPath: string, duration?: number): Promise<void>;
54
+ getValue<T extends keyof StateValues>(stateName: T): StateValue<T>;
43
55
  updateState<T extends keyof StateValues>(stateName: T, eventData: OnSetEvent<T>, isRemote?: boolean): Promise<void>;
44
56
  onStateChange<T extends keyof StateValues>(stateName: T): Observable<{
45
57
  newState: StateValues[T];
46
58
  oldState: StateValues[T];
47
59
  }>;
48
- onPropertyChange<T extends keyof Camera>(property: T): Observable<{
49
- oldState: Camera[T];
50
- newState: Camera[T];
60
+ onPropertyChange<T extends keyof CameraPublicProperties>(property: T): Observable<{
61
+ oldData: Camera[T];
62
+ newData: Camera[T];
51
63
  }>;
52
64
  removeAllListeners(): void;
53
65
  refreshStates(): Promise<void>;
54
66
  private updateCamera;
55
- private updateSources;
67
+ private updatePrebufferSources;
56
68
  private unsubscribe;
57
69
  private createStateObservable;
58
70
  private listenToChanges;
@@ -1,9 +1,12 @@
1
1
  import { CameraDeviceHub } from '../../../../../src/camera';
2
2
  import type { SocketService } from '../../socket';
3
- import type { Camera, StateValues, OnSetEvent, BaseLogger, IceServer } from '../../../../../shared/types';
3
+ import type { Camera, StateValues, OnSetEvent, BaseLogger, IceServer, PrebufferType } from '../../../../../shared/types';
4
4
  export declare class CameraDeviceClient extends CameraDeviceHub {
5
5
  private socketService;
6
6
  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>;
7
10
  getFfmpegPath(): Promise<string>;
8
11
  getIceServers(): Promise<IceServer[]>;
9
12
  updateState<T extends keyof StateValues>(stateName: T, eventData: OnSetEvent<T>): Promise<void>;
@@ -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;
@@ -78,6 +78,8 @@ export interface BaseCamera {
78
78
  hasSiren: boolean;
79
79
  model: string;
80
80
  type: CameraType;
81
+ motionZones: CameraZone[];
82
+ objectZones: CameraZone[];
81
83
  }
82
84
  export interface DBCamera extends BaseCamera {
83
85
  sources: CameraInputSettings[];
@@ -92,6 +94,18 @@ export interface Camera extends BaseCamera {
92
94
  hasPtz: boolean;
93
95
  sources: CameraInput[];
94
96
  }
97
+ export interface CameraZone {
98
+ name: string;
99
+ regions: ZoneRegion[];
100
+ }
101
+ export interface ZoneRegion {
102
+ _id: string;
103
+ coords: ZoneCoord[];
104
+ }
105
+ export interface ZoneCoord {
106
+ _id: string;
107
+ points: [number, number];
108
+ }
95
109
  export type CameraPrivateProperties = '_id' | 'nativeId' | 'pluginId' | 'hasLight' | 'hasSiren' | 'isCloud';
96
110
  export interface CameraPublicProperties extends Omit<Camera, CameraPrivateProperties> {
97
111
  }
@@ -118,6 +132,7 @@ export interface CameraRecordingSettings {
118
132
  enabled: boolean;
119
133
  }
120
134
  export interface CameraInputSettings {
135
+ readonly _id: string;
121
136
  name: string;
122
137
  roles: CameraRoles[];
123
138
  urls: string[];
@@ -142,24 +157,43 @@ export interface Go2RtcEndpoint {
142
157
  mjpegHtml: string;
143
158
  }
144
159
  export interface Go2RtcFFMPEGSource {
145
- aac: string;
146
- opus: string;
160
+ h264AAC: string;
161
+ h264OPUS: string;
162
+ }
163
+ export interface PrebufferSource {
164
+ url: string;
165
+ snapshotUrl: string;
147
166
  }
148
167
  export interface Go2RtcPrebufferSource {
149
- stream?: string;
150
- recording?: string;
168
+ mpegts: PrebufferSource;
169
+ mp4: PrebufferSource;
151
170
  }
152
- export interface StreamSources {
171
+ export interface Go2RtcWSSource {
153
172
  webrtc: string;
173
+ }
174
+ export interface StreamUrls {
175
+ ws: Go2RtcWSSource;
154
176
  rtsp: Go2RtcRTSPSource;
155
177
  transcoded: Go2RtcFFMPEGSource;
156
178
  prebuffer: Go2RtcPrebufferSource;
157
- endpoints: Go2RtcEndpoint;
179
+ www: Go2RtcEndpoint;
158
180
  }
159
181
  export interface CameraInput {
182
+ readonly _id: string;
160
183
  name: string;
161
184
  roles: CameraRoles[];
162
- sources: StreamSources;
185
+ urls: StreamUrls;
186
+ }
187
+ export interface CameraPrebufferInput {
188
+ readonly _id: string;
189
+ stream: PrebufferState;
190
+ recording: PrebufferState;
191
+ }
192
+ export interface CameraSource extends CameraInput, CameraPrebufferInput {
193
+ }
194
+ export interface PrebufferState {
195
+ rawUrl?: string;
196
+ isPrebuffering: boolean;
163
197
  }
164
198
  export type CameraRoles = 'detect' | 'record' | 'stream' | 'snapshot' | 'none';
165
199
  export interface CameraUiSettings {
@@ -1,8 +1,9 @@
1
+ import { RequestQueue } from '../queue';
1
2
  import type { ApplicationResponse, ExitData } from '../types';
2
- declare class ApplicationService {
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: ApplicationService;
8
- export default _default;
@@ -0,0 +1,9 @@
1
+ import { RequestQueue } from '../queue';
2
+ import type { AxiosResponse } from 'axios';
3
+ export declare class ConfigApi {
4
+ private requestQueue;
5
+ constructor(requestQueue: RequestQueue);
6
+ getConfig(): Promise<AxiosResponse>;
7
+ rewriteConfig(data: Record<string, any>): Promise<AxiosResponse>;
8
+ mergeConfig(data: Record<string, any>): Promise<AxiosResponse>;
9
+ }
@@ -1,7 +1,8 @@
1
+ import { RequestQueue } from '../queue';
1
2
  import type { SourceData } from '../types';
2
- declare class SnapshotService {
3
- jpeg(data: SourceData): Promise<string>;
4
- mp4(data: SourceData): Promise<string>;
3
+ export declare class SnapshotApi {
4
+ private requestQueue;
5
+ constructor(requestQueue: RequestQueue);
6
+ jpeg(data: SourceData): Promise<ArrayBuffer>;
7
+ mp4(data: SourceData): Promise<ArrayBuffer>;
5
8
  }
6
- declare const _default: SnapshotService;
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 StreamsService {
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: StreamsService;
11
- export default _default;
@@ -1,3 +1,13 @@
1
- export { default as ApplicationApi } from './api/application';
2
- export { default as StreamsService } from './api/streams';
3
- export { default as SnapshotService } from './api/snapshot';
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 {};