@camera.ui/browser 0.0.110 → 0.0.111

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 (133) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/bundle.js.LICENSE.txt +11 -20
  3. package/dist/types/packages/client/browser/src/client.d.ts +5 -7
  4. package/dist/types/packages/client/browser/src/proxy/cameraDevice.d.ts +20 -24
  5. package/dist/types/packages/client/browser/src/proxy/coreManager.d.ts +10 -12
  6. package/dist/types/packages/client/browser/src/proxy/deviceManager.d.ts +10 -12
  7. package/dist/types/packages/client/browser/src/proxy.d.ts +7 -0
  8. package/dist/types/packages/client/browser/src/streaming/config.d.ts +21 -0
  9. package/dist/types/packages/client/browser/src/streaming/go2rts-session.d.ts +255 -40
  10. package/dist/types/packages/client/browser/src/streaming/types.d.ts +38 -0
  11. package/dist/types/packages/client/browser/src/types.d.ts +6 -8
  12. package/dist/types/packages/types/src/index.d.ts +302 -220
  13. package/dist/types/server/src/api/database/types.d.ts +17 -25
  14. package/dist/types/server/src/api/go2rtc/types.d.ts +66 -11
  15. package/dist/types/server/src/api/schemas/backup.schema.d.ts +24 -24
  16. package/dist/types/server/src/api/schemas/cameras.schema.d.ts +1407 -523
  17. package/dist/types/server/src/api/schemas/config.schema.d.ts +30 -42
  18. package/dist/types/server/src/api/schemas/go2rtc.schema.d.ts +186 -154
  19. package/dist/types/server/src/api/schemas/plugins.schema.d.ts +17 -17
  20. package/dist/types/server/src/api/schemas/storage.schema.d.ts +22 -0
  21. package/dist/types/server/src/api/schemas/system.schema.d.ts +171 -3
  22. package/dist/types/server/src/api/schemas/users.schema.d.ts +162 -318
  23. package/dist/types/server/src/api/types/index.d.ts +48 -46
  24. package/dist/types/server/src/api/websocket/types.d.ts +4 -2
  25. package/dist/types/server/src/camera/classes.d.ts +2 -0
  26. package/dist/types/{packages/plugineer/src/polyglot/node → server/src}/camera/index.d.ts +31 -30
  27. package/dist/types/server/src/camera/interfaces.d.ts +17 -0
  28. package/dist/types/server/src/camera/types.d.ts +16 -10
  29. package/dist/types/server/src/go2rtc/types.d.ts +5 -4
  30. package/dist/types/server/src/manager/types.d.ts +15 -0
  31. package/dist/types/server/src/plugins/schema.d.ts +27 -34
  32. package/dist/types/server/src/plugins/types.d.ts +43 -1
  33. package/dist/types/server/src/rpc/namespaces.d.ts +35 -0
  34. package/dist/types/server/src/rpc/types.d.ts +111 -0
  35. package/dist/types/server/src/services/config/defaults.d.ts +12 -0
  36. package/dist/types/server/src/services/config/types.d.ts +10 -4
  37. package/dist/types/server/src/types.d.ts +3 -0
  38. package/dist/types/shared/types/index.d.ts +9 -8
  39. package/package.json +19 -16
  40. package/dist/types/packages/client/browser/src/socket.d.ts +0 -15
  41. package/dist/types/packages/common/src/nats/messageQueue.d.ts +0 -48
  42. package/dist/types/packages/common/src/nats/nats.d.ts +0 -30
  43. package/dist/types/packages/common/src/nats/packer.d.ts +0 -2
  44. package/dist/types/packages/plugineer/src/polyglot/node/camera/interfaces/camera.d.ts +0 -8
  45. package/dist/types/packages/plugineer/src/polyglot/node/camera/interfaces/ptz.d.ts +0 -11
  46. package/dist/types/packages/plugineer/src/polyglot/node/camera/types.d.ts +0 -18
  47. package/dist/types/packages/plugineer/src/polyglot/node/plugins/schema.d.ts +0 -62
  48. package/dist/types/packages/plugineer/src/polyglot/node/plugins/types.d.ts +0 -135
  49. package/dist/types/packages/plugineer/src/types.d.ts +0 -4
  50. package/dist/types/server/src/api/controllers/api.controller.d.ts +0 -7
  51. package/dist/types/server/src/api/controllers/auth.controller.d.ts +0 -16
  52. package/dist/types/server/src/api/controllers/backup.controller.d.ts +0 -10
  53. package/dist/types/server/src/api/controllers/cameras.controller.d.ts +0 -38
  54. package/dist/types/server/src/api/controllers/config.controller.d.ts +0 -14
  55. package/dist/types/server/src/api/controllers/files.controller.d.ts +0 -8
  56. package/dist/types/server/src/api/controllers/frameWorkers.controller.d.ts +0 -11
  57. package/dist/types/server/src/api/controllers/plugins.controller.d.ts +0 -48
  58. package/dist/types/server/src/api/controllers/system.controller.d.ts +0 -23
  59. package/dist/types/server/src/api/controllers/users.controller.d.ts +0 -28
  60. package/dist/types/server/src/api/database/checks.d.ts +0 -55
  61. package/dist/types/server/src/api/database/constants.d.ts +0 -8
  62. package/dist/types/server/src/api/database/index.d.ts +0 -30
  63. package/dist/types/server/src/api/database/migration.d.ts +0 -15
  64. package/dist/types/server/src/api/database/selfcheck.d.ts +0 -48
  65. package/dist/types/server/src/api/go2rtc/api/application.d.ts +0 -9
  66. package/dist/types/server/src/api/go2rtc/api/config.d.ts +0 -8
  67. package/dist/types/server/src/api/go2rtc/api/index.d.ts +0 -1
  68. package/dist/types/server/src/api/go2rtc/api/snapshot.d.ts +0 -8
  69. package/dist/types/server/src/api/go2rtc/api/streams.d.ts +0 -12
  70. package/dist/types/server/src/api/go2rtc/index.d.ts +0 -14
  71. package/dist/types/server/src/api/go2rtc/queue.d.ts +0 -10
  72. package/dist/types/server/src/api/index.d.ts +0 -22
  73. package/dist/types/server/src/api/middlewares/authPermission.middleware.d.ts +0 -5
  74. package/dist/types/server/src/api/middlewares/authValidation.middleware.d.ts +0 -4
  75. package/dist/types/server/src/api/middlewares/pagination.middleware.d.ts +0 -3
  76. package/dist/types/server/src/api/middlewares/socketAuth.middleware.d.ts +0 -41
  77. package/dist/types/server/src/api/plugins/header.plugin.d.ts +0 -2
  78. package/dist/types/server/src/api/plugins/socket.plugin.d.ts +0 -11
  79. package/dist/types/server/src/api/plugins/system.plugin.d.ts +0 -20
  80. package/dist/types/server/src/api/plugins/useragent.plugin.d.ts +0 -8
  81. package/dist/types/server/src/api/routes/api.routes.d.ts +0 -2
  82. package/dist/types/server/src/api/routes/auth.routes.d.ts +0 -2
  83. package/dist/types/server/src/api/routes/backup.routes.d.ts +0 -2
  84. package/dist/types/server/src/api/routes/cameras.routes.d.ts +0 -2
  85. package/dist/types/server/src/api/routes/config.routes.d.ts +0 -2
  86. package/dist/types/server/src/api/routes/files.routes.d.ts +0 -2
  87. package/dist/types/server/src/api/routes/frameWorkers.routes.d.ts +0 -2
  88. package/dist/types/server/src/api/routes/index.d.ts +0 -6
  89. package/dist/types/server/src/api/routes/plugins.routes.d.ts +0 -2
  90. package/dist/types/server/src/api/routes/system.routes.d.ts +0 -2
  91. package/dist/types/server/src/api/routes/users.routes.d.ts +0 -2
  92. package/dist/types/server/src/api/services/auth.service.d.ts +0 -24
  93. package/dist/types/server/src/api/services/backup.service.d.ts +0 -11
  94. package/dist/types/server/src/api/services/cameras.service.d.ts +0 -54
  95. package/dist/types/server/src/api/services/plugins.service.d.ts +0 -38
  96. package/dist/types/server/src/api/services/system.service.d.ts +0 -13
  97. package/dist/types/server/src/api/services/users.service.d.ts +0 -25
  98. package/dist/types/server/src/api/utils/cameraSource.d.ts +0 -6
  99. package/dist/types/server/src/api/utils/cert.d.ts +0 -11
  100. package/dist/types/server/src/api/utils/constants.d.ts +0 -13
  101. package/dist/types/server/src/api/utils/fetch.d.ts +0 -1
  102. package/dist/types/server/src/api/utils/moveFiles.d.ts +0 -4
  103. package/dist/types/server/src/api/utils/parse.d.ts +0 -2
  104. package/dist/types/server/src/api/websocket/go2rtc.d.ts +0 -21
  105. package/dist/types/server/src/api/websocket/index.d.ts +0 -16
  106. package/dist/types/server/src/api/websocket/nsp/logs.d.ts +0 -19
  107. package/dist/types/server/src/api/websocket/nsp/main.d.ts +0 -9
  108. package/dist/types/server/src/api/websocket/nsp/metrics.d.ts +0 -24
  109. package/dist/types/server/src/api/websocket/nsp/notifications.d.ts +0 -12
  110. package/dist/types/server/src/api/websocket/nsp/plugins.d.ts +0 -13
  111. package/dist/types/server/src/api/websocket/nsp/proxy.d.ts +0 -27
  112. package/dist/types/server/src/api/websocket/nsp/server.d.ts +0 -26
  113. package/dist/types/server/src/api/websocket/nsp/status.d.ts +0 -15
  114. package/dist/types/server/src/api.d.ts +0 -29
  115. package/dist/types/server/src/camera/controller.d.ts +0 -61
  116. package/dist/types/server/src/camera/frameWorker.d.ts +0 -45
  117. package/dist/types/server/src/go2rtc/index.d.ts +0 -25
  118. package/dist/types/server/src/main.d.ts +0 -25
  119. package/dist/types/server/src/nats/index.d.ts +0 -40
  120. package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +0 -22
  121. package/dist/types/server/src/nats/proxy/coreManager.d.ts +0 -14
  122. package/dist/types/server/src/nats/proxy/deviceManager.d.ts +0 -14
  123. package/dist/types/server/src/nats/server.d.ts +0 -38
  124. package/dist/types/server/src/nats/types.d.ts +0 -18
  125. package/dist/types/server/src/nats/utils.d.ts +0 -2
  126. package/dist/types/server/src/plugins/index.d.ts +0 -33
  127. package/dist/types/server/src/plugins/plugin.d.ts +0 -35
  128. package/dist/types/server/src/plugins/worker.d.ts +0 -55
  129. package/dist/types/server/src/services/config/constants.d.ts +0 -6
  130. package/dist/types/server/src/services/config/index.d.ts +0 -67
  131. package/dist/types/server/src/services/logger/index.d.ts +0 -16
  132. /package/dist/types/{packages/plugineer/src/polyglot/node → server/src}/camera/iou.d.ts +0 -0
  133. /package/dist/types/{packages/plugineer/src/polyglot/node → server/src}/camera/polygon.d.ts +0 -0
@@ -0,0 +1,111 @@
1
+ import type { AuthConfig } from '@camera.ui/rpc-common';
2
+ import type { Camera, CameraDevice, CameraExtension, StateValues } from '@camera.ui/types';
3
+ import type { PluginCapabilities } from '../camera/types.js';
4
+ export interface ProxyAuth {
5
+ cluster: AuthConfig;
6
+ server: AuthConfig;
7
+ }
8
+ export interface NatsAuthConfig {
9
+ timeout: number;
10
+ user: string;
11
+ password: string;
12
+ }
13
+ export interface NatsTLSConfig {
14
+ cert_file: string;
15
+ key_file: string;
16
+ ca_file: string;
17
+ timeout: number;
18
+ verify?: boolean;
19
+ insecure?: boolean;
20
+ }
21
+ export interface NatsWsAuthConfig {
22
+ timeout: number;
23
+ username: string;
24
+ password: string;
25
+ }
26
+ export interface NatsWsTLSConfig {
27
+ cert_file: string;
28
+ key_file: string;
29
+ }
30
+ export interface NatsClusterConfig {
31
+ host: string;
32
+ port: number;
33
+ name: string;
34
+ routes: string[];
35
+ tls: NatsTLSConfig;
36
+ authorization: NatsAuthConfig;
37
+ }
38
+ export interface NatsWebsocketConfig {
39
+ host: string;
40
+ port: number;
41
+ authorization: NatsWsAuthConfig;
42
+ tls: NatsWsTLSConfig;
43
+ }
44
+ export interface NatsConfig {
45
+ host: string;
46
+ port: number;
47
+ http?: number;
48
+ server_name: string;
49
+ cluster: NatsClusterConfig;
50
+ authorization: NatsAuthConfig;
51
+ tls: NatsTLSConfig;
52
+ websocket?: NatsWebsocketConfig;
53
+ max_pending?: number;
54
+ max_payload?: number;
55
+ max_control_line?: number;
56
+ disable_sublist_cache?: boolean;
57
+ no_fast_producer_stall?: boolean;
58
+ write_deadline?: string;
59
+ }
60
+ export interface DeviceManagerListenerMessagePayload {
61
+ type: keyof DeviceManagerProxyEventCallbacks;
62
+ data: DeviceManagerProxyEvents[keyof DeviceManagerProxyEvents];
63
+ }
64
+ export interface DeviceManagerProxyEvents {
65
+ cameraSelected: {
66
+ camera: Camera;
67
+ extension: CameraExtension;
68
+ };
69
+ cameraDeselected: {
70
+ camera: Camera;
71
+ extension: CameraExtension;
72
+ };
73
+ }
74
+ export interface DeviceManagerProxyEventCallbacks {
75
+ cameraSelected: (camera: CameraDevice, extension: CameraExtension) => void;
76
+ cameraDeselected: (cameraId: string, extension: CameraExtension) => void;
77
+ }
78
+ export interface DeviceManagerProxyGenericEvent<K extends keyof DeviceManagerProxyEvents> {
79
+ type: K;
80
+ data: DeviceManagerProxyEvents[K];
81
+ }
82
+ export interface CoreManagerListenerMessagePayload {
83
+ type: keyof CoreManagerProxyEventCallbacks;
84
+ data: CoreManagerProxyEvents[keyof CoreManagerProxyEvents];
85
+ }
86
+ export interface CoreManagerProxyEvents {
87
+ }
88
+ export interface CoreManagerProxyEventCallbacks {
89
+ }
90
+ export interface CoreManagerProxyGenericEvent<K extends keyof CoreManagerProxyEvents> {
91
+ type: K;
92
+ data: CoreManagerProxyEvents[K];
93
+ }
94
+ export interface CameraDeviceListenerStatePayload<K extends keyof StateValues> {
95
+ stateName: K;
96
+ data: {
97
+ newEvent: StateValues[K];
98
+ oldEvent: StateValues[K];
99
+ };
100
+ }
101
+ export interface CameraDeviceListenerMessagePayload {
102
+ type: 'removed' | 'updated' | 'cameraState' | 'frameWorkerState' | 'capabilities';
103
+ data?: any;
104
+ }
105
+ export interface RefreshedStates {
106
+ camera: Camera;
107
+ states: StateValues;
108
+ cameraState: boolean;
109
+ frameWorkerState: boolean;
110
+ capabilities: PluginCapabilities[];
111
+ }
@@ -0,0 +1,12 @@
1
+ import type { API, Ffmpeg, IConfigSSL, Log, Logger, PluginsSettings, RTMP, RTSP, SRTP, Webrtc } from './types.js';
2
+ export declare const DEFAULT_CONFIG_PORT = 3443;
3
+ export declare const DEFAULT_CONFIG_SSL: IConfigSSL;
4
+ export declare const DEFAULT_CONFIG_LOGGER: Logger;
5
+ export declare const DEFAULT_CONFIG_PLUGINS: PluginsSettings;
6
+ export declare const DEFAULT_GO2RTC_CONFIG_LOGGER: Partial<Log>;
7
+ export declare const DEFAULT_GO2RTC_CONFIG_API: API;
8
+ export declare const DEFAULT_GO2RTC_CONFIG_RTSP: RTSP;
9
+ export declare const DEFAULT_GO2RTC_CONFIG_SRTP: SRTP;
10
+ export declare const DEFAULT_GO2RTC_CONFIG_RTMP: RTMP;
11
+ export declare const DEFAULT_GO2RTC_CONFIG_WEBRTC: Webrtc;
12
+ export declare const DEFAULT_GO2RTC_CONFIG_FFMPEG: Ffmpeg;
@@ -22,9 +22,6 @@ export declare const enum RUNTIME_STATUS {
22
22
  ERROR = "error",
23
23
  UNKNOWN = "unknown"
24
24
  }
25
- export interface InterfaceSettings {
26
- saveSessions: boolean;
27
- }
28
25
  export interface PluginsSettings {
29
26
  disabledPlugins: string[];
30
27
  }
@@ -32,7 +29,6 @@ export interface IConfig {
32
29
  port: number;
33
30
  ssl: IConfigSSL;
34
31
  logger: Logger;
35
- settings: InterfaceSettings;
36
32
  plugins: PluginsSettings;
37
33
  }
38
34
  export type LoggingLevel = 'info' | 'debug' | 'warn' | 'error' | 'trace';
@@ -58,6 +54,7 @@ export interface MqttTLS {
58
54
  export interface IConfigSSL {
59
55
  certFile: string;
60
56
  keyFile: string;
57
+ caFile: string;
61
58
  addresses?: string[];
62
59
  }
63
60
  export interface Go2RtcConfig {
@@ -97,6 +94,10 @@ export interface API {
97
94
  listen: string;
98
95
  username?: string;
99
96
  password?: string;
97
+ tls_listen: string;
98
+ tls_cert: string;
99
+ tls_key: string;
100
+ tls_ca: string;
100
101
  }
101
102
  export type Streams = Record<string, string | string[]>;
102
103
  export interface SRTP {
@@ -154,3 +155,8 @@ export interface ShareSettings {
154
155
  export interface Ngrok {
155
156
  command: string;
156
157
  }
158
+ export interface SSLConfig {
159
+ cert: Buffer;
160
+ key: Buffer;
161
+ ca: Buffer;
162
+ }
@@ -5,6 +5,9 @@ export type MethodType<T, K extends keyof T> = T[K] extends (...args: any) => an
5
5
  export type DeepPartial<T> = T extends object ? {
6
6
  [P in keyof T]?: DeepPartial<T[P]>;
7
7
  } : T;
8
+ export type FunctionPropertyNames<T> = {
9
+ [K in keyof T]: T[K] extends Function ? K : never;
10
+ }[keyof T];
8
11
  export interface UpdateStartedMessage {
9
12
  type: 'UPDATE_STARTED';
10
13
  version: string;
@@ -1,21 +1,22 @@
1
- export type * from '../../packages/common/src/nats/messageQueue.js';
2
- export { Subscribed as SubscribedImp } from '../../packages/common/src/utils/subscribed.js';
3
- export * from '../../packages/plugineer/src/polyglot/node/camera/polygon.js';
4
- export * from '../../packages/plugineer/src/polyglot/node/plugins/schema.js';
5
- export * from '../../packages/plugineer/src/polyglot/node/plugins/types.js';
6
- export * from '../../packages/types/src/index.js';
1
+ export { Subscribed as SubscribedImp, SubscribedPublic } from '../../packages/common/src/utils/subscribed.js';
2
+ export type * from '../../packages/types/src/index.js';
7
3
  export type * from '../../server/src/api/database/types.js';
8
4
  export type * from '../../server/src/api/go2rtc/types.js';
9
5
  export * from '../../server/src/api/schemas/cameras.schema.js';
10
6
  export * from '../../server/src/api/schemas/plugins.schema.js';
7
+ export * from '../../server/src/api/schemas/storage.schema.js';
11
8
  export * from '../../server/src/api/schemas/system.schema.js';
12
9
  export * from '../../server/src/api/schemas/users.schema.js';
13
10
  export type * from '../../server/src/api/types/index.js';
14
11
  export type * from '../../server/src/api/websocket/types.js';
15
- export type * from '../../server/src/camera/types.js';
12
+ export * from '../../server/src/camera/classes.js';
13
+ export * from '../../server/src/camera/polygon.js';
14
+ export * from '../../server/src/camera/types.js';
16
15
  export * from '../../server/src/go2rtc/types.js';
17
- export type * from '../../server/src/nats/types.js';
16
+ export type * from '../../server/src/manager/types.js';
18
17
  export * from '../../server/src/plugins/schema.js';
19
18
  export * from '../../server/src/plugins/types.js';
19
+ export * from '../../server/src/rpc/namespaces.js';
20
+ export type * from '../../server/src/rpc/types.js';
20
21
  export * from '../../server/src/services/config/types.js';
21
22
  export type * from '../../server/src/types.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camera.ui/browser",
3
- "version": "0.0.110",
3
+ "version": "0.0.111",
4
4
  "description": "camera.ui browser client",
5
5
  "author": "seydx (https://github.com/seydx/camera.ui)",
6
6
  "exports": {
@@ -25,27 +25,30 @@
25
25
  "prepublishOnly": "npm i --package-lock-only && npm run lint:fix && npm run format && npm run build"
26
26
  },
27
27
  "dependencies": {
28
+ "@camera.ui/rpc-client": "file:../../rpc/client/node",
28
29
  "@isaacs/ttlcache": "^1.4.1",
29
- "rxjs": "^7.8.1",
30
- "socket.io-client": "^4.8.1"
30
+ "rxjs": "^7.8.2"
31
31
  },
32
32
  "devDependencies": {
33
- "@stylistic/eslint-plugin": "^2.11.0",
34
- "@typescript-eslint/parser": "^8.17.0",
35
- "eslint": "^9.16.0",
36
- "globals": "^15.13.0",
37
- "prettier": "^3.4.1",
38
- "typescript-eslint": "^8.17.0",
33
+ "@camera.ui/rpc-common": "file:../../rpc/common",
34
+ "@camera.ui/types": "file:../../types",
35
+ "@stylistic/eslint-plugin": "^4.2.0",
39
36
  "@swc/register": "^0.1.10",
40
- "@types/webrtc": "^0.0.44",
41
- "bufferutil": "^4.0.8",
37
+ "@types/webrtc": "^0.0.46",
38
+ "@typescript-eslint/parser": "^8.31.1",
39
+ "bufferutil": "^4.0.9",
40
+ "eslint": "^9.25.1",
41
+ "globals": "^16.0.0",
42
+ "prettier": "^3.5.3",
42
43
  "rimraf": "^6.0.1",
43
- "ts-loader": "^9.5.1",
44
- "typescript": "^5.7.2",
45
- "updates": "^16.4.0",
44
+ "terser-webpack-plugin": "^5.3.14",
45
+ "ts-loader": "^9.5.2",
46
+ "typescript": "^5.8.3",
47
+ "typescript-eslint": "^8.31.1",
48
+ "updates": "^16.4.2",
46
49
  "utf-8-validate": "^6.0.5",
47
- "webpack": "^5.96.1",
48
- "webpack-cli": "^5.1.4"
50
+ "webpack": "^5.99.7",
51
+ "webpack-cli": "^6.0.1"
49
52
  },
50
53
  "bugs": {
51
54
  "url": "https://github.com/seydx/camera.ui/issues"
@@ -1,15 +0,0 @@
1
- import { Manager } from 'socket.io-client';
2
- import type { Socket } from 'socket.io-client';
3
- export declare class SocketService {
4
- socket: Socket;
5
- private token;
6
- private endpoint;
7
- private socketList;
8
- constructor(endpoint: string, token: string);
9
- close(): void;
10
- getSocket(id: string, forceNew?: boolean): {
11
- manager: Manager;
12
- socket: Socket;
13
- };
14
- private createManager;
15
- }
@@ -1,48 +0,0 @@
1
- import type { CameraDelegates, LoggerService } from '@camera.ui/types';
2
- import type { ProxyConnection, ProxySubscription } from './nats.js';
3
- export declare const NATS_SERVER_SUBJECT = "camera.ui-server";
4
- export interface DeserializedError {
5
- name: string;
6
- message: string;
7
- stack: string;
8
- }
9
- export declare class RemoteError extends Error {
10
- constructor(error: DeserializedError, cause: Omit<ProxyMessageStructure, 'error'>);
11
- }
12
- export interface QueueItem {
13
- message: ProxyMessageStructure;
14
- resolve: (response: any) => void;
15
- reject: (error: RemoteError) => void;
16
- }
17
- export interface ProxyMessageStructure {
18
- requestId: string;
19
- cameraId?: string;
20
- targetId: string;
21
- targetName?: string;
22
- pluginId: string;
23
- type: 'request' | 'reply';
24
- proxy: 'device' | 'camera' | 'plugin' | 'core';
25
- client: 'cameraFn' | 'pluginFn' | 'deviceFn' | 'storageFn' | 'coreFn' | keyof CameraDelegates;
26
- fn: string;
27
- args: any[];
28
- timeout: number;
29
- timestamp: number;
30
- response?: any;
31
- error?: DeserializedError;
32
- }
33
- export declare class MessageQueue {
34
- private logger;
35
- private type;
36
- private publisher;
37
- private subscriber;
38
- private requestHandler;
39
- private aborted;
40
- private isProcessing;
41
- private queue;
42
- private pendingResponses;
43
- constructor(type: 'server' | 'client', publisher: ProxyConnection, subscriber: ProxySubscription, logger: LoggerService, requestHandler: (message: ProxyMessageStructure) => void);
44
- abortQueue(): void;
45
- enqueue(message: ProxyMessageStructure): Promise<any>;
46
- private processQueue;
47
- private onMessage;
48
- }
@@ -1,30 +0,0 @@
1
- import { EventEmitter } from 'events';
2
- import type { Msg, NatsConnection, Subscription as NatsSubscription, RequestOptions } from 'nats';
3
- export interface AuthConfig {
4
- user: string;
5
- password: string;
6
- }
7
- export declare interface ProxySubscription {
8
- on(event: 'message', listener: (message: Msg) => void): this;
9
- emit(event: 'message', message: Msg): boolean;
10
- }
11
- export declare class ProxySubscription extends EventEmitter implements ProxySubscription {
12
- readonly subscriber: NatsSubscription;
13
- constructor(subscriber: NatsSubscription);
14
- listen(): Promise<void>;
15
- close(): void;
16
- }
17
- export declare class ProxyConnection {
18
- private name;
19
- private servers;
20
- private auth;
21
- private publisher?;
22
- private subscribers;
23
- private closed;
24
- constructor(name: string, servers: string[], auth: AuthConfig);
25
- connect(): Promise<NatsConnection>;
26
- subscribe(subject: string, skipListening?: boolean): ProxySubscription;
27
- publish(subject: string, message: any): void;
28
- request(subject: string, message: any, opts?: RequestOptions): Promise<any>;
29
- close(): Promise<void>;
30
- }
@@ -1,2 +0,0 @@
1
- export declare const pack: (message: any) => Buffer;
2
- export declare const unpack: <T = any>(message: Buffer | Uint8Array) => T;
@@ -1,8 +0,0 @@
1
- import type { CameraDelegate } from '@camera.ui/types';
2
- export declare class CameraInterface implements CameraDelegate {
3
- delegate?: CameraDelegate;
4
- private onRequest;
5
- constructor(onRequest: (client: any, fn: string, args?: any[], timeout?: number) => Promise<any>);
6
- snapshot(): Promise<ArrayBuffer | undefined>;
7
- private _onRequest;
8
- }
@@ -1,11 +0,0 @@
1
- import type { CameraPTZDelegate } from '@camera.ui/types';
2
- export declare class CameraPTZInterface implements CameraPTZDelegate {
3
- delegate?: CameraPTZDelegate;
4
- private onRequest;
5
- constructor(onRequest: (client: any, fn: string, args?: any[], timeout?: number) => Promise<any>);
6
- moveAbsolute(pan: number, tilt: number, zoom: number): Promise<void>;
7
- moveRelative(pan: number, tilt: number, zoom: number): Promise<void>;
8
- moveContinuous(pan: number, tilt: number, zoom: number): Promise<void>;
9
- stop(): Promise<void>;
10
- private _onRequest;
11
- }
@@ -1,18 +0,0 @@
1
- import type { AudioSetEvent, AudioState, BatterySetEvent, BatteryState, DoorbellSetEvent, DoorbellState, FrameData, FrameMetadata, LightSetEvent, LightState, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, SirenSetEvent, SirenState } from '@camera.ui/types';
2
- import type { CameraInterface } from './interfaces/camera.js';
3
- import type { CameraPTZInterface } from './interfaces/ptz.js';
4
- export interface FrameState extends MotionState {
5
- frameData: FrameData;
6
- metadata: FrameMetadata;
7
- }
8
- export type States = LightState | MotionState | AudioState | ObjectState | DoorbellState | SirenState | BatteryState;
9
- export type Sets = LightSetEvent | MotionSetEvent | AudioSetEvent | ObjectSetEvent | DoorbellSetEvent | SirenSetEvent | BatterySetEvent;
10
- export interface CameraInterfaces {
11
- readonly cameraDelegate: CameraInterface;
12
- readonly ptzDelegate: CameraPTZInterface;
13
- }
14
- export type DelegateMethods = {
15
- [K in keyof CameraInterfaces]: {
16
- [M in keyof CameraInterfaces[K]]: M extends string ? M : never;
17
- }[keyof CameraInterfaces[K]];
18
- }[keyof CameraInterfaces];
@@ -1,62 +0,0 @@
1
- import type { JsonSchema, JsonSchemaArray, JsonSchemaBoolean, JsonSchemaButton, JsonSchemaEnum, JsonSchemaForm, JsonSchemaNumber, JsonSchemaObject, JsonSchemaObjectWithButtons, JsonSchemaString, RootSchema } from '@camera.ui/types';
2
- /**
3
- * Generate a JSON object from a given Root JSON schema.
4
- *
5
- * @param rootSchema - The Root JSON schema.
6
- * @returns - The generated JSON object.
7
- */
8
- export declare const generateJsonFromRootSchema: (rootSchema: RootSchema) => Record<string, any>;
9
- /**
10
- * Generate a JSON object from a JSON schema.
11
- *
12
- * @param jsonSchema - The JSON schema.
13
- * @returns - The generated JSON object.
14
- */
15
- export declare const generateJsonFromSchema: (jsonSchema: JsonSchema) => any;
16
- /**
17
- * Removes all functions from a given Plugin JSON schema form.
18
- *
19
- * @param schemaForm - The Plugin JSON schema form from which the functions should be removed.
20
- * @returns - The Plugin JSON schema form without functions.
21
- */
22
- export declare const removeFunctionsFromSchemaForm: (schemaForm: JsonSchemaForm) => JsonSchemaForm;
23
- /**
24
- * Removes all functions from a given Plugin JSON schema.
25
- *
26
- * @param jsonSchema - The JSON schema from which the functions should be removed.
27
- * @returns - The JSON schema without functions.
28
- */
29
- export declare const removeFunctionsFromSchema: (jsonSchema: JsonSchema) => JsonSchema;
30
- /**
31
- * Converts a config path to a schema path.
32
- *
33
- * @param configPath - The config path to be converted.
34
- * @returns - The converted schema path.
35
- */
36
- export declare const configPathToSchemaPath: (configPath: string) => string;
37
- /**
38
- * Converts a schema path to a config path.
39
- *
40
- * @param schemaPath - The schema path to be converted.
41
- * @returns - The converted config path.
42
- */
43
- export declare const schemaPathToConfigPath: (schemaPath: string) => string;
44
- /**
45
- * Recursively searches a JSON object for a specific, potentially nested key path and returns its value.
46
- *
47
- * @param obj - The JSON object to be searched.
48
- * @param path - The key path to search for.
49
- * @returns - The value of the searched key path, if found, otherwise undefined.
50
- */
51
- export declare const getValueByPath: (obj: Record<any, any> | undefined, path: string) => any;
52
- export declare const isStringType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaString;
53
- export declare const isNumberType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaNumber;
54
- export declare const isBooleanType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaBoolean;
55
- export declare const isEnumType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaEnum;
56
- export declare const isObjectType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaObject;
57
- export declare const isObjectTypeWithButtons: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaObjectWithButtons;
58
- export declare const isArrayType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaArray;
59
- export declare const isButtonType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaButton;
60
- export declare const isValidableStringType: (jsonSchema: JsonSchema) => jsonSchema is JsonSchemaString;
61
- export declare const isJsonSchema: (value: any) => value is JsonSchema;
62
- export declare const isPrimitiveType: (value: any) => value is JsonSchemaString | JsonSchemaNumber | JsonSchemaBoolean | JsonSchemaEnum;
@@ -1,135 +0,0 @@
1
- import type { Camera, CameraConfigInputSettings, CameraDevice, CameraExtension, ProbeConfig, ProbeStream, SetValues, StateValues } from '@camera.ui/types';
2
- export interface ProcessLoadMessage {
3
- cameras: Camera[];
4
- plugin: PluginInfo;
5
- storage: PluginStorage;
6
- }
7
- export interface ProcessMessage {
8
- type: PLUGIN_COMMAND;
9
- data?: ProcessLoadMessage;
10
- }
11
- export interface ProcessResponse {
12
- type: PLUGIN_STATUS;
13
- data?: ProcessErrorMessage;
14
- }
15
- export declare enum API_EVENT {
16
- FINISH_LAUNCHING = "finishLaunching",
17
- SHUTDOWN = "shutdown"
18
- }
19
- export declare enum PLUGIN_STATUS {
20
- READY = "ready",
21
- STARTING = "starting",
22
- STARTED = "started",
23
- STOPPED = "stopped",
24
- ERROR = "error",
25
- UNKNOWN = "unknown",
26
- DISABLED = "disabled"
27
- }
28
- export declare enum PLUGIN_COMMAND {
29
- START = "start",
30
- STOP = "stop"
31
- }
32
- export type ProcessErrorMessage = string;
33
- export interface PluginStorage {
34
- installPath: string;
35
- storagePath: string;
36
- configFile: string;
37
- }
38
- export interface PluginInfo {
39
- id: string;
40
- name: string;
41
- contract: PluginContract;
42
- }
43
- export interface PluginOptions {
44
- extendedMotionDetection?: boolean;
45
- }
46
- export interface PluginContract {
47
- extension: CameraExtension;
48
- supportAdditionalCameras?: boolean;
49
- builtIns?: CameraExtensionWithoutHub[];
50
- options?: PluginOptions;
51
- dependencies?: string[];
52
- pythonVersion?: string;
53
- bundled?: boolean;
54
- }
55
- export type CameraExtensionWithoutHub = 'motionDetection' | 'objectDetection' | 'audioDetection' | 'ptz';
56
- export type Go2RtcIncomingMessage = Go2RtcAnswerMessage | Go2RtcIceCandidateMessage | ErrorMessage;
57
- export type Go2RtcOutgoingMessage = Go2RtcOfferMessage | Go2RtcIceCandidateMessage;
58
- export interface Go2RtcOfferMessage {
59
- type: 'webrtc/offer';
60
- value: Sdp;
61
- }
62
- export interface Go2RtcAnswerMessage {
63
- type: 'webrtc/answer';
64
- value: Sdp;
65
- }
66
- export interface Go2RtcIceCandidateMessage {
67
- type: 'webrtc/candidate';
68
- value: IceCandiate;
69
- }
70
- export type Sdp = string;
71
- export type IceCandiate = string;
72
- export interface ErrorMessage {
73
- type: 'error';
74
- value: string;
75
- }
76
- export interface DeviceManagerListenerMessagePayload {
77
- type: keyof DeviceManagerProxyEventCallbacks;
78
- data: DeviceManagerProxyEvents[keyof DeviceManagerProxyEvents];
79
- }
80
- export interface DeviceManagerProxyEvents {
81
- cameraSelected: {
82
- camera: Camera;
83
- extension: CameraExtension;
84
- };
85
- cameraDeselected: {
86
- camera: Camera;
87
- extension: CameraExtension;
88
- };
89
- }
90
- export interface DeviceManagerProxyEventCallbacks {
91
- cameraSelected: (camera: CameraDevice, extension: CameraExtension) => void;
92
- cameraDeselected: (cameraId: string, extension: CameraExtension) => void;
93
- }
94
- export interface DeviceManagerProxyGenericEvent<K extends keyof DeviceManagerProxyEvents> {
95
- type: K;
96
- data: DeviceManagerProxyEvents[K];
97
- }
98
- export interface CoreManagerListenerMessagePayload {
99
- type: keyof CoreManagerProxyEventCallbacks;
100
- data: CoreManagerProxyEvents[keyof CoreManagerProxyEvents];
101
- }
102
- export interface CoreManagerProxyEvents {
103
- }
104
- export interface CoreManagerProxyEventCallbacks {
105
- }
106
- export interface CoreManagerProxyGenericEvent<K extends keyof CoreManagerProxyEvents> {
107
- type: K;
108
- data: CoreManagerProxyEvents[K];
109
- }
110
- export interface RefreshedStates {
111
- camera: Camera;
112
- states: StateValues;
113
- cameraState: boolean;
114
- }
115
- export interface CameraDeviceProxyMethods {
116
- connect(): void;
117
- disconnect(): void;
118
- updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T]): void;
119
- refreshStates(): RefreshedStates;
120
- addCameraSource(source: CameraConfigInputSettings): Promise<void>;
121
- updateCameraSource(sourceId: string, source: Partial<CameraConfigInputSettings>): Promise<void>;
122
- removeCameraSource(sourceId: string): Promise<void>;
123
- probeStream(sourceId: string, probeConfig: ProbeConfig | undefined, refresh: boolean): Promise<ProbeStream | undefined>;
124
- }
125
- export interface CameraDeviceListenerStatePayload<K extends keyof StateValues> {
126
- stateName: K;
127
- data: {
128
- newEvent: StateValues[K];
129
- oldEvent: StateValues[K];
130
- };
131
- }
132
- export interface CameraDeviceListenerMessagePayload {
133
- type: 'removed' | 'updated' | 'cameraState';
134
- data?: any;
135
- }
@@ -1,4 +0,0 @@
1
- export type MethodKeys<T> = keyof {
2
- [K in keyof T as T[K] extends (...args: any) => any ? K : never]: any;
3
- };
4
- export type MethodType<T, K extends keyof T> = T[K] extends (...args: any) => any ? T[K] : never;
@@ -1,7 +0,0 @@
1
- import type { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
2
- export declare class ApiController {
3
- private app;
4
- constructor(app: FastifyInstance);
5
- welcome(req: FastifyRequest, reply: FastifyReply): FastifyReply;
6
- health(req: FastifyRequest, reply: FastifyReply): Promise<FastifyReply>;
7
- }
@@ -1,16 +0,0 @@
1
- import type { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
2
- import type { AuthLoginRequest, AuthNewLoginRequest, AuthParamsRequest, AuthRefreshRequest, AuthTokensRequest, JwtTokenClientData, JwtTokenEncoded, PaginationRequest } from '../types/index.js';
3
- export declare class AuthController {
4
- private app;
5
- private configService;
6
- private service;
7
- private userService;
8
- constructor(app: FastifyInstance);
9
- check(req: FastifyRequest<AuthLoginRequest>, reply: FastifyReply): FastifyReply;
10
- list(req: FastifyRequest<AuthLoginRequest & AuthTokensRequest & PaginationRequest>, reply: FastifyReply): FastifyReply | JwtTokenClientData[] | JwtTokenEncoded[];
11
- login(req: FastifyRequest<AuthNewLoginRequest>, reply: FastifyReply): Promise<FastifyReply | void>;
12
- logout(req: FastifyRequest, reply: FastifyReply): Promise<FastifyReply>;
13
- logoutByToken(req: FastifyRequest<AuthLoginRequest & AuthParamsRequest>, reply: FastifyReply): Promise<FastifyReply>;
14
- logoutAll(req: FastifyRequest<AuthLoginRequest>, reply: FastifyReply): Promise<FastifyReply>;
15
- refresh(req: FastifyRequest<AuthRefreshRequest>, reply: FastifyReply): Promise<FastifyReply>;
16
- }
@@ -1,10 +0,0 @@
1
- import type { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
2
- import type { AuthLoginRequest, BackupCreateRequest, BackupRestoreRequest } from '../types/index.js';
3
- export declare class BackupController {
4
- private app;
5
- private logger;
6
- private service;
7
- constructor(app: FastifyInstance);
8
- download(req: FastifyRequest<AuthLoginRequest & BackupCreateRequest>, reply: FastifyReply): Promise<FastifyReply | void>;
9
- restore(req: FastifyRequest<AuthLoginRequest & BackupRestoreRequest>, reply: FastifyReply): Promise<FastifyReply | void>;
10
- }