@camera.ui/browser 0.0.88 → 0.0.89

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 (26) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/types/server/src/api/database/index.d.ts +1 -2
  3. package/dist/types/server/src/api/database/types.d.ts +7 -2
  4. package/dist/types/server/src/api/go2rtc/api/streams.d.ts +2 -1
  5. package/dist/types/server/src/api/go2rtc/types.d.ts +44 -0
  6. package/dist/types/server/src/api/schemas/cameras.schema.d.ts +102 -102
  7. package/dist/types/server/src/api/schemas/config.schema.d.ts +24 -96
  8. package/dist/types/server/src/api/schemas/go2rtc.schema.d.ts +81 -81
  9. package/dist/types/server/src/api/schemas/users.schema.d.ts +158 -158
  10. package/dist/types/server/src/api/services/cameras.service.d.ts +1 -5
  11. package/dist/types/server/src/api/types/index.d.ts +5 -0
  12. package/dist/types/server/src/camera/iou.d.ts +2 -0
  13. package/dist/types/server/src/camera/streaming/peer-connection.d.ts +4 -2
  14. package/dist/types/server/src/camera/streaming/webrtc-connection.d.ts +2 -0
  15. package/dist/types/server/src/camera/streaming/werift-session.d.ts +1 -1
  16. package/dist/types/server/src/camera/types.d.ts +2 -1
  17. package/dist/types/server/src/plugins/worker.d.ts +1 -0
  18. package/dist/types/server/src/polyglot/node/plugins/cameraStorage.d.ts +3 -3
  19. package/dist/types/server/src/polyglot/node/plugins/configService.d.ts +1 -1
  20. package/dist/types/server/src/polyglot/node/plugins/pluginApi.d.ts +3 -2
  21. package/dist/types/server/src/polyglot/node/plugins/proxy/cameraDevice.d.ts +4 -4
  22. package/dist/types/server/src/polyglot/node/plugins/storageController.d.ts +3 -1
  23. package/dist/types/server/src/services/config/index.d.ts +6 -3
  24. package/dist/types/server/src/services/config/types.d.ts +8 -8
  25. package/dist/types/server/src/types.d.ts +3 -0
  26. package/package.json +3 -3
@@ -1,8 +1,6 @@
1
1
  import type { CameraExtension } from '../../plugins/types.js';
2
+ import type { DeepPartial } from '../../types.js';
2
3
  import type { Camera, CameraInputSettings, CameraZone, DBCamera } from '../database/types.js';
3
- type DeepPartial<T> = T extends object ? {
4
- [P in keyof T]?: DeepPartial<T[P]>;
5
- } : T;
6
4
  export declare class CamerasService {
7
5
  private configService;
8
6
  private api;
@@ -44,7 +42,6 @@ export declare class CamerasService {
44
42
  addCameraSources(cameraname: string, sources: CameraInputSettings[]): Promise<void>;
45
43
  removeCameraSources(cameraname: string, sources: CameraInputSettings[]): Promise<void>;
46
44
  private sourceExistAndEqual;
47
- private sourceResetted;
48
45
  private generateWsUrls;
49
46
  private generateRTSPUrls;
50
47
  private generateFFmpegUrls;
@@ -53,4 +50,3 @@ export declare class CamerasService {
53
50
  private defaultZone;
54
51
  private convertToDetectionZones;
55
52
  }
56
- export {};
@@ -219,6 +219,11 @@ export type CamerasParamsRequest = {
219
219
  cameraname: string;
220
220
  };
221
221
  };
222
+ export type CameraSourceParamsRequest = {
223
+ Params: {
224
+ sourcename: string;
225
+ };
226
+ };
222
227
  export type CamerasParamsIdRequest = {
223
228
  Params: {
224
229
  cameraid: string;
@@ -0,0 +1,2 @@
1
+ import type { Detection } from './types.js';
2
+ export declare const mergeDetections: (detections: Detection[], iouThreshold?: number) => Detection[];
@@ -28,13 +28,15 @@ export declare class WeriftPeerConnection extends Subscribed implements BasicPee
28
28
  onVideoRtp: Subject<RtpPacket>;
29
29
  onVideoRtcp: Subject<RtcpPacket>;
30
30
  onIceCandidate: Subject<RTCIceCandidate>;
31
- onConnectionState: ReplaySubject<"closed" | "failed" | "disconnected" | "new" | "connecting" | "connected">;
31
+ onConnectionState: ReplaySubject<"connected" | "disconnected" | "closed" | "failed" | "new" | "connecting">;
32
32
  returnAudioTrack: MediaStreamTrack;
33
33
  private onRequestKeyFrame;
34
34
  private cameraDevice;
35
+ private sourceName;
35
36
  private logger;
36
37
  private pc;
37
- constructor(cameraDevice: CameraDevice, iceServers: IceServer[] | undefined, logger: BaseLogger);
38
+ private get logPrefix();
39
+ constructor(cameraDevice: CameraDevice, iceServers: IceServer[] | undefined, logger: BaseLogger, sourceName: string);
38
40
  createOffer(): Promise<RTCSessionDescription>;
39
41
  acceptAnswer(answer: {
40
42
  type: 'answer';
@@ -21,7 +21,9 @@ export declare class WebrtcConnection extends Subscribed {
21
21
  private readonly onOfferSent;
22
22
  private hasEnded;
23
23
  private cameraDevice;
24
+ private sourceName;
24
25
  private logger;
26
+ private get logPrefix();
25
27
  constructor(cameraDevice: CameraDevice, sourceName: string, logger: BaseLogger, options: StreamingConnectionOptions);
26
28
  sendAudioPacket(rtp: RtpPacket): void;
27
29
  stop(): void;
@@ -1,6 +1,6 @@
1
- import type { Subscription } from 'rxjs';
2
1
  import { ReplaySubject, Subject } from 'rxjs';
3
2
  import { RtpPacket } from 'werift';
3
+ import type { Subscription } from 'rxjs';
4
4
  import type { CameraDevice } from '../device.js';
5
5
  import type { BaseLogger, FfmpegOptions, SpawnInput } from '../types.js';
6
6
  import type { WebrtcConnection } from './webrtc-connection.js';
@@ -92,11 +92,12 @@ export interface CameraConfigInputSettings extends Omit<CameraInputSettings, '_i
92
92
  export type CameraConfig = BaseCameraConfig & {
93
93
  sources: CameraConfigInputSettings[];
94
94
  };
95
+ export type BoundingBox = [number, number, number, number];
95
96
  export interface Detection {
96
97
  id?: string;
97
98
  label: ObjectClass;
98
99
  confidence: number;
99
- boundingBox: [number, number, number, number];
100
+ boundingBox: BoundingBox;
100
101
  inputWidth: number;
101
102
  inputHeight: number;
102
103
  origWidth: number;
@@ -19,6 +19,7 @@ export declare class PluginWorker {
19
19
  constructor(plugin: Plugin);
20
20
  start(): Promise<void>;
21
21
  teardown(): Promise<void>;
22
+ destroy(): void;
22
23
  restart(): Promise<void>;
23
24
  getPID(): number;
24
25
  isRunning(): boolean;
@@ -1,13 +1,14 @@
1
+ import type { RootDatabase } from 'lmdb';
1
2
  import type { JsonSchema, JsonSchemaForm, SchemaConfig } from '../../../plugins/types.js';
2
3
  import type { API } from './pluginApi.js';
3
4
  export declare class CameraStorage<T extends Record<string, any> = Record<string, any>> {
4
5
  private cameraId;
5
6
  private instance;
6
7
  private api;
7
- private db;
8
+ private pluginDb;
8
9
  schema: JsonSchemaForm;
9
10
  values: T;
10
- constructor(api: API, instance: any, cameraId: string, schema?: JsonSchemaForm);
11
+ constructor(api: API, pluginDb: RootDatabase<Record<string, any>, 'config'>, instance: any, cameraId: string, schema?: JsonSchemaForm);
11
12
  /**
12
13
  * Initialize the storage.
13
14
  * This will load the configuration from the database.
@@ -102,6 +103,5 @@ export declare class CameraStorage<T extends Record<string, any> = Record<string
102
103
  private filterStorableValues;
103
104
  private containsStorableSchema;
104
105
  private saveDb;
105
- private removeDb;
106
106
  private close;
107
107
  }
@@ -1,4 +1,4 @@
1
- import { type Path } from 'object-path';
1
+ import type { Path } from 'object-path';
2
2
  import type { JSONValue, PluginConfig } from '../../../plugins/types.js';
3
3
  export declare class PluginConfigService {
4
4
  private config;
@@ -1,10 +1,11 @@
1
1
  import { EventEmitter } from 'node:events';
2
2
  import { PluginConfigService } from './configService.js';
3
3
  import { StorageController } from './storageController.js';
4
+ import type { RootDatabase } from 'lmdb';
4
5
  import type { AuthConfig } from '../../../decoder/types.js';
5
6
  import type { PluginInfo } from '../../../plugins/types.js';
6
7
  import type { PluginLogger } from './pluginLogger.js';
7
- import { type CoreManager } from './proxy/coreManager.js';
8
+ import type { CoreManager } from './proxy/coreManager.js';
8
9
  import type { DeviceManager } from './proxy/deviceManager.js';
9
10
  export declare interface PluginAPI {
10
11
  on(event: 'finishLaunching', listener: () => void): this;
@@ -30,5 +31,5 @@ export declare class API extends EventEmitter implements PluginAPI {
30
31
  readonly configService: PluginConfigService;
31
32
  readonly storagePath: string;
32
33
  readonly configFile: string;
33
- constructor(plugin: PluginInfo, storagePath: string, configFile: string, logger: PluginLogger, proxyEndpoints: string[], auth: AuthConfig);
34
+ constructor(plugin: PluginInfo, storagePath: string, configFile: string, logger: PluginLogger, proxyEndpoints: string[], auth: AuthConfig, pluginDb: RootDatabase<Record<string, any>, 'config'>);
34
35
  }
@@ -30,8 +30,8 @@ export declare class CameraDeviceProxy extends CameraDevice {
30
30
  private cameraSubscriber?;
31
31
  private cameraPluginSubscriber?;
32
32
  private signalingSubscriber?;
33
- private frameSubscriber?;
34
- private motionFrameSubscriber?;
33
+ private frameSubscribers;
34
+ private motionFrameSubscribers;
35
35
  private messageQueue?;
36
36
  private activeRequests;
37
37
  private activeMotionRequests;
@@ -59,8 +59,8 @@ export declare class CameraDeviceProxy extends CameraDevice {
59
59
  private connectToDecoder;
60
60
  private getMetadata;
61
61
  private disconnectFromDecoder;
62
- private closeFrameSubscriber;
63
- private closeMotionFrameSubsciber;
62
+ private closeFrameSubscribers;
63
+ private closeMotionFrameSubscibers;
64
64
  private requestHandler;
65
65
  private onProxyMessage;
66
66
  private onSignalingMessage;
@@ -1,10 +1,12 @@
1
1
  import { CameraStorage } from './cameraStorage.js';
2
+ import type { RootDatabase } from 'lmdb';
2
3
  import type { JsonSchemaForm } from '../../../plugins/types.js';
3
4
  import type { API } from './pluginApi.js';
4
5
  export declare class StorageController {
5
6
  private api;
7
+ private pluginDb;
6
8
  private cameraStorages;
7
- constructor(api: API);
9
+ constructor(api: API, pluginDb: RootDatabase<Record<string, any>, 'config'>);
8
10
  /**
9
11
  * Create a camera storage instance
10
12
  *
@@ -1,4 +1,5 @@
1
1
  import 'reflect-metadata';
2
+ import type { DeepPartial } from '../../types.js';
2
3
  import type { Go2RtcConfig, IConfig, Secrets } from './types.js';
3
4
  export declare class ConfigService {
4
5
  static readonly IS_DEV: boolean;
@@ -20,6 +21,7 @@ export declare class ConfigService {
20
21
  readonly HOME_PATH: string;
21
22
  readonly STORAGE_PATH: string;
22
23
  readonly DATABASE_PATH: string;
24
+ readonly TOKENS_PATH: string;
23
25
  readonly USERS_STORAGE_PATH: string;
24
26
  readonly TMP_DIR: string;
25
27
  readonly PLUGINS_STORAGE_PATH: string;
@@ -39,10 +41,11 @@ export declare class ConfigService {
39
41
  constructor(homePath?: string);
40
42
  static extractVersion(str: string): string | null;
41
43
  read(): void;
42
- writeConfig(newConfig?: IConfig): void;
43
- writeGo2RtcConfigFile(newConfig?: Go2RtcConfig): void;
44
- writeGo2RtcConfigApi(newConfig?: Go2RtcConfig): Promise<void>;
44
+ writeConfig(newConfig?: DeepPartial<IConfig>): void;
45
+ writeGo2RtcConfigFile(newConfig?: DeepPartial<Go2RtcConfig>): void;
46
+ writeGo2RtcConfigApi(newConfig?: DeepPartial<Go2RtcConfig>): Promise<void>;
45
47
  mergeGo2RtcConfig(): Promise<void>;
48
+ updateGo2RtcWebRtcFilter(serverAddresses: string[], oldAddresses?: string[], api?: boolean): Promise<void>;
46
49
  private defaultConfig;
47
50
  private defaultGo2RtcConfig;
48
51
  private readConfig;
@@ -17,17 +17,17 @@ export declare const enum RUNTIME_STATUS {
17
17
  }
18
18
  export interface InterfaceSettings {
19
19
  snapshotCache: number;
20
+ saveSessions: boolean;
20
21
  }
21
22
  export interface PluginsSettings {
22
23
  disabledPlugins: string[];
23
24
  }
24
25
  export interface IConfig {
25
26
  port: number;
26
- tempFile?: string;
27
27
  ssl: IConfigSSL;
28
28
  logger: Logger;
29
- settings: Partial<InterfaceSettings>;
30
- plugins: Partial<PluginsSettings>;
29
+ settings: InterfaceSettings;
30
+ plugins: PluginsSettings;
31
31
  }
32
32
  export type LoggingLevel = 'info' | 'debug' | 'warn' | 'error' | 'trace';
33
33
  export interface Logger {
@@ -114,11 +114,11 @@ export interface Webrtc {
114
114
  filters?: WebrtcFilter;
115
115
  }
116
116
  export interface WebrtcFilter {
117
- candidates: string[];
118
- networks: string[];
119
- interfaces: string[];
120
- ips: string[];
121
- udp_ports: string[];
117
+ candidates?: string[];
118
+ networks?: string[];
119
+ interfaces?: string[];
120
+ ips?: string[];
121
+ udp_ports?: string[];
122
122
  }
123
123
  export interface IceServer {
124
124
  urls: string[];
@@ -2,3 +2,6 @@ export type MethodKeys<T> = keyof {
2
2
  [K in keyof T as T[K] extends (...args: any) => any ? K : never]: any;
3
3
  };
4
4
  export type MethodType<T, K extends keyof T> = T[K] extends (...args: any) => any ? T[K] : never;
5
+ export type DeepPartial<T> = T extends object ? {
6
+ [P in keyof T]?: DeepPartial<T[P]>;
7
+ } : T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camera.ui/browser",
3
- "version": "0.0.88",
3
+ "version": "0.0.89",
4
4
  "description": "camera.ui browser client",
5
5
  "author": "seydx (https://github.com/seydx/camera.ui)",
6
6
  "module": "./dist/bundle.js",
@@ -23,7 +23,7 @@
23
23
  "prepublishOnly": "npm i --package-lock-only && npm run lint && npm run format && npm run build"
24
24
  },
25
25
  "dependencies": {
26
- "axios": "^1.7.4",
26
+ "axios": "^1.7.5",
27
27
  "lru-cache": "^11.0.0",
28
28
  "rxjs": "^7.8.1",
29
29
  "socket.io-client": "^4.7.5"
@@ -44,7 +44,7 @@
44
44
  "typescript": "^5.5.4",
45
45
  "updates": "^16.4.0",
46
46
  "utf-8-validate": "^6.0.4",
47
- "webpack": "^5.93.0",
47
+ "webpack": "^5.94.0",
48
48
  "webpack-cli": "^5.1.4"
49
49
  },
50
50
  "bugs": {