@camera.ui/browser 0.0.69 → 0.0.71

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 (78) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/types/packages/client/browser/src/proxy/cameraDevice.d.ts +3 -4
  3. package/dist/types/server/src/api/database/index.d.ts +24 -0
  4. package/dist/types/server/src/api/database/types.d.ts +12 -34
  5. package/dist/types/server/src/api/go2rtc/api/application.d.ts +9 -0
  6. package/dist/types/server/src/api/go2rtc/api/config.d.ts +9 -0
  7. package/dist/types/server/src/api/go2rtc/api/index.d.ts +2 -0
  8. package/dist/types/server/src/api/go2rtc/api/snapshot.d.ts +8 -0
  9. package/dist/types/server/src/api/go2rtc/api/streams.d.ts +11 -0
  10. package/dist/types/server/src/api/go2rtc/index.d.ts +13 -0
  11. package/dist/types/server/src/api/go2rtc/queue.d.ts +10 -0
  12. package/dist/types/server/src/api/middlewares/socketAuth.middleware.d.ts +41 -0
  13. package/dist/types/server/src/api/services/auth.service.d.ts +20 -0
  14. package/dist/types/server/src/api/services/cameras.service.d.ts +54 -0
  15. package/dist/types/server/src/api/services/plugins.service.d.ts +25 -0
  16. package/dist/types/server/src/api/services/users.service.d.ts +13 -0
  17. package/dist/types/server/src/api/utils/constants.d.ts +15 -0
  18. package/dist/types/server/src/api/websocket/index.d.ts +15 -0
  19. package/dist/types/server/src/api/websocket/nsp/frame.d.ts +10 -0
  20. package/dist/types/server/src/api/websocket/nsp/logs.d.ts +11 -0
  21. package/dist/types/server/src/api/websocket/nsp/metrics.d.ts +33 -0
  22. package/dist/types/server/src/api/websocket/nsp/notifications.d.ts +11 -0
  23. package/dist/types/server/src/api/websocket/nsp/plugins.d.ts +13 -0
  24. package/dist/types/server/src/api/websocket/nsp/server.d.ts +9 -0
  25. package/dist/types/server/src/api/websocket/nsp/status.d.ts +20 -0
  26. package/dist/types/server/src/api/websocket/nsp/streams.d.ts +15 -0
  27. package/dist/types/server/src/api/{ws → websocket}/types.d.ts +1 -1
  28. package/dist/types/server/src/api.d.ts +44 -0
  29. package/dist/types/server/src/camera/base/cameraDevice.d.ts +2 -1
  30. package/dist/types/server/src/camera/base/cameraDeviceBrowser.d.ts +1 -0
  31. package/dist/types/server/src/camera/base/index.d.ts +18 -2
  32. package/dist/types/server/src/camera/controller.d.ts +27 -0
  33. package/dist/types/server/src/camera/types.d.ts +37 -21
  34. package/dist/types/server/src/decoder/index.d.ts +11 -0
  35. package/dist/types/server/src/decoder/types.d.ts +4 -0
  36. package/dist/types/server/src/decoder/worker/index.d.ts +3 -0
  37. package/dist/types/server/src/decoder/worker/runtime/base/index.d.ts +36 -0
  38. package/dist/types/server/src/decoder/worker/runtime/child-process/index.d.ts +17 -0
  39. package/dist/types/server/src/decoder/worker/runtime/worker-thread/index.d.ts +22 -0
  40. package/dist/types/server/src/go2rtc/index.d.ts +25 -0
  41. package/dist/types/server/src/nats/constants.d.ts +1 -0
  42. package/dist/types/server/src/nats/index.d.ts +34 -0
  43. package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +96 -0
  44. package/dist/types/server/src/nats/proxy/deviceManager.d.ts +31 -0
  45. package/dist/types/server/src/nats/proxy/index.d.ts +4 -0
  46. package/dist/types/server/src/nats/proxy/pluginsManager.d.ts +12 -0
  47. package/dist/types/server/src/nats/proxy/systemManager.d.ts +8 -0
  48. package/dist/types/server/src/nats/queue.d.ts +17 -0
  49. package/dist/types/server/src/nats/server.d.ts +33 -0
  50. package/dist/types/server/src/nats/types.d.ts +18 -10
  51. package/dist/types/server/src/nats/utils.d.ts +4 -0
  52. package/dist/types/server/src/nats/websocket.d.ts +22 -0
  53. package/dist/types/server/src/plugins/base.d.ts +7 -0
  54. package/dist/types/server/src/plugins/index.d.ts +31 -0
  55. package/dist/types/server/src/plugins/node/api.d.ts +42 -0
  56. package/dist/types/server/src/plugins/node/cameraStorage.d.ts +108 -0
  57. package/dist/types/server/src/plugins/node/config.d.ts +104 -0
  58. package/dist/types/server/src/plugins/node/logger.d.ts +14 -0
  59. package/dist/types/server/src/plugins/node/proxy/cameraDevice.d.ts +45 -0
  60. package/dist/types/server/src/plugins/node/proxy/deviceManager.d.ts +47 -0
  61. package/dist/types/server/src/plugins/node/proxy/index.d.ts +4 -0
  62. package/dist/types/server/src/plugins/node/proxy/pluginsManager.d.ts +38 -0
  63. package/dist/types/server/src/plugins/node/proxy/queue.d.ts +18 -0
  64. package/dist/types/server/src/plugins/node/proxy/systemManager.d.ts +36 -0
  65. package/dist/types/server/src/plugins/node/schema.d.ts +268 -0
  66. package/dist/types/server/src/plugins/node/storageController.d.ts +28 -0
  67. package/dist/types/server/src/plugins/plugin.d.ts +42 -0
  68. package/dist/types/server/src/plugins/types.d.ts +2 -2
  69. package/dist/types/server/src/plugins/worker-ipc.d.ts +22 -0
  70. package/dist/types/server/src/plugins/worker.d.ts +30 -0
  71. package/dist/types/server/src/services/config/constants.d.ts +6 -0
  72. package/dist/types/server/src/services/config/index.d.ts +60 -0
  73. package/dist/types/server/src/services/logger/index.d.ts +28 -0
  74. package/dist/types/server/src/utils/pythonInstaller.d.ts +47 -0
  75. package/dist/types/server/src/utils/utils.d.ts +6 -0
  76. package/dist/types/shared/types/index.d.ts +1 -1
  77. package/package.json +4 -3
  78. package/.eslintrc.cjs +0 -44
@@ -0,0 +1,268 @@
1
+ import { z, type ZodTypeAny } from 'zod';
2
+ import type { JsonSchema, JsonSchemaAnyOf, JsonSchemaArray, JsonSchemaBoolean, JsonSchemaButton, JsonSchemaEnum, JsonSchemaNumber, JsonSchemaObject, JsonSchemaObjectWithButtons, JsonSchemaString, PluginJsonSchema, PluginJsonSchemaForm, PluginRootSchema, RootSchema } from '../types.js';
3
+ type RootZodSchema = z.ZodObject<Record<string, ZodTypeAny>, 'strict', ZodTypeAny, {
4
+ [x: string]: any;
5
+ }, {
6
+ [x: string]: any;
7
+ }>;
8
+ type OptionalZodString = z.ZodOptional<z.ZodString> | z.ZodString | z.ZodOptional<z.ZodEffects<z.ZodString, string, string>> | z.ZodEffects<z.ZodString, string, string>;
9
+ type OptionalZodNumber = z.ZodOptional<z.ZodNumber> | z.ZodNumber | z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>> | z.ZodEffects<z.ZodNumber, number, number>;
10
+ type OptionalZodBoolean = z.ZodOptional<z.ZodBoolean> | z.ZodBoolean;
11
+ type OptionalZodZobject = z.ZodOptional<z.ZodObject<Record<string, z.ZodTypeAny>, 'strict', z.ZodTypeAny, {
12
+ [x: string]: any;
13
+ }, {
14
+ [x: string]: any;
15
+ }>> | z.ZodObject<Record<string, z.ZodTypeAny>, 'strict', z.ZodTypeAny, {
16
+ [x: string]: any;
17
+ }, {
18
+ [x: string]: any;
19
+ }> | z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>> | z.ZodRecord<z.ZodString, z.ZodAny>;
20
+ type OptionalZodArray = z.ZodOptional<z.ZodType<any, any, any>> | z.ZodType<any, any, any>;
21
+ type OptionalZodEnum = z.ZodOptional<z.ZodUnion<[z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]]>> | z.ZodUnion<[z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]]> | z.ZodEffects<z.ZodAny, any, any> | z.ZodUnion<any>;
22
+ type OptionalZodEnumMultiple = z.ZodOptional<z.ZodArray<z.ZodUnion<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>, 'many'>> | z.ZodArray<z.ZodUnion<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>, 'many'> | z.ZodEffects<z.ZodAny, any, any> | z.ZodUnion<any>;
23
+ type ZodAny = z.ZodType<any, any, any>;
24
+ /**
25
+ * Generate root JSON schema from value.
26
+ *
27
+ * @param value - Value.
28
+ * @returns - Root JSON schema.
29
+ */
30
+ export declare const generateRootSchema: (value: Record<string, any>) => RootSchema;
31
+ /**
32
+ * Generate JSON schema from value.
33
+ *
34
+ * @param value - Value.
35
+ * @returns - JSON schema.
36
+ */
37
+ export declare const generateSchema: (value: any) => JsonSchema;
38
+ /**
39
+ * Generate a JSON object from a given Root JSON schema.
40
+ *
41
+ * @param rootSchema - The Root JSON schema.
42
+ * @returns - The generated JSON object.
43
+ */
44
+ export declare const generateJsonFromRootSchema: (rootSchema: RootSchema | PluginRootSchema) => Record<string, any>;
45
+ /**
46
+ * Generate a JSON object from a JSON schema.
47
+ *
48
+ * @param jsonSchema - The JSON schema.
49
+ * @returns - The generated JSON object.
50
+ */
51
+ export declare const generateJsonFromSchema: (jsonSchema: JsonSchema | PluginJsonSchema) => any;
52
+ /**
53
+ * Generate a JSON object from a given JSON schema and use values from a config file.
54
+ *
55
+ * @param jsonSchema - The JSON schema.
56
+ * @param config - The config file with values to use.
57
+ * @returns - The generated JSON object.
58
+ */
59
+ export declare const generateJsonFromSchemaWithConfig: (jsonSchema: JsonSchema | PluginJsonSchema, config: Record<string, any>, path?: string) => any;
60
+ /**
61
+ * Removes all functions from a given Plugin JSON schema form.
62
+ *
63
+ * @param schemaForm - The Plugin JSON schema form from which the functions should be removed.
64
+ * @returns - The Plugin JSON schema form without functions.
65
+ */
66
+ export declare const removeFunctionsFromSchemaForm: (schemaForm: PluginJsonSchemaForm) => PluginJsonSchemaForm;
67
+ /**
68
+ * Removes all functions from a given Plugin JSON schema.
69
+ *
70
+ * @param jsonSchema - The JSON schema from which the functions should be removed.
71
+ * @returns - The JSON schema without functions.
72
+ */
73
+ export declare const removeFunctionsFromSchema: (jsonSchema: PluginJsonSchema) => PluginJsonSchema;
74
+ /**
75
+ * Converts a config path to a schema path.
76
+ *
77
+ * @param configPath - The config path to be converted.
78
+ * @returns - The converted schema path.
79
+ */
80
+ export declare const configPathToSchemaPath: (configPath: string) => string;
81
+ /**
82
+ * Converts a schema path to a config path.
83
+ *
84
+ * @param schemaPath - The schema path to be converted.
85
+ * @returns - The converted config path.
86
+ */
87
+ export declare const schemaPathToConfigPath: (schemaPath: string) => string;
88
+ /**
89
+ * Recursively searches a JSON object for a specific, potentially nested key path and returns its value.
90
+ *
91
+ * @param obj - The JSON object to be searched.
92
+ * @param path - The key path to search for.
93
+ * @returns - The value of the searched key path, if found, otherwise undefined.
94
+ */
95
+ export declare const getValueByPath: (obj: any, path: string) => any;
96
+ /**
97
+ * Generates a Zod schema from a given JSON schema.
98
+ *
99
+ * @param jsonSchema - The JSON schema from which the Zod schema should be generated.
100
+ * @returns - The generated Zod schema.
101
+ */
102
+ export declare const generateZodSchemaFromRoot: (rootSchema: RootSchema) => RootZodSchema;
103
+ /**
104
+ * Generates a Zod schema from a given JSON schema.
105
+ *
106
+ * @param jsonSchema - The JSON schema from which the Zod schema should be generated.
107
+ * @param initial - A boolean indicating whether this is the initial call to the function.
108
+ * This is used for handling nested schemas.
109
+ * @returns - The generated Zod schema.
110
+ */
111
+ export declare const generateZodSchema: (jsonSchema: JsonSchema) => ZodAny;
112
+ /**
113
+ * Generates a JSON schema for a number.
114
+ *
115
+ * @param value - The number for which the JSON schema should be generated.
116
+ * @returns - The generated JSON schema for the number.
117
+ */
118
+ export declare const generateNumberSchema: () => JsonSchemaNumber;
119
+ /**
120
+ * Generates a JSON schema for a boolean.
121
+ *
122
+ * @param value - The boolean for which the JSON schema should be generated.
123
+ * @returns - The generated JSON schema for the boolean.
124
+ */
125
+ export declare const genereateBooleanSchema: () => JsonSchemaBoolean;
126
+ /**
127
+ * Generates a JSON schema for a string.
128
+ *
129
+ * @param value - The string for which the JSON schema should be generated.
130
+ * @returns - The generated JSON schema for the string.
131
+ */
132
+ export declare const generateStringSchema: (value: string) => JsonSchemaString;
133
+ /**
134
+ * Generates a JSON schema for an enum.
135
+ *
136
+ * @param value - The enum for which the JSON schema should be generated.
137
+ * @param type - The type of the enum.
138
+ * @returns - The generated JSON schema for the enum.
139
+ */
140
+ export declare const generateEnumSchema: (value: string[]) => JsonSchemaEnum;
141
+ /**
142
+ * Generates a JSON schema for an object.
143
+ *
144
+ * @param value - The object for which the JSON schema should be generated.
145
+ * @returns - The generated JSON schema for the object.
146
+ */
147
+ export declare const generateObjectSchema: (value: Record<string, any>) => JsonSchemaObject;
148
+ /**
149
+ * Generates a JSON schema for an object including up to two buttons.
150
+ *
151
+ * @param value - The object for which the JSON schema should be generated.
152
+ * @param buttons - Array of min one button and up to two buttons to be included in the schema.
153
+ * @returns - The generated JSON schema for the object.
154
+ */
155
+ export declare const generateObjectSchemaWithButtons: (value: Record<string, any>, buttons: [JsonSchemaButton, JsonSchemaButton?]) => JsonSchemaObjectWithButtons;
156
+ /**
157
+ * Generates a JSON schema for an array.
158
+ *
159
+ * @param array - The array for which the JSON schema should be generated.
160
+ * @returns - The generated JSON schema for the array.
161
+ */
162
+ export declare const generateArraySchema: (array: any[]) => JsonSchemaArray;
163
+ /**
164
+ * Checks if the given JSON schema is of string type.
165
+ *
166
+ * @param jsonSchema - The JSON schema to check.
167
+ * @returns - True if the JSON schema is of string type, false otherwise.
168
+ */
169
+ export declare const isStringType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaString;
170
+ /**
171
+ * Checks if the given JSON schema is of number type.
172
+ *
173
+ * @param jsonSchema - The JSON schema to check.
174
+ * @returns - True if the JSON schema is of number type, false otherwise.
175
+ */
176
+ export declare const isNumberType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaNumber;
177
+ /**
178
+ * Checks if the given JSON schema is of boolean type.
179
+ *
180
+ * @param jsonSchema - The JSON schema to check.
181
+ * @returns - True if the JSON schema is of boolean type, false otherwise.
182
+ */
183
+ export declare const isBooleanType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaBoolean;
184
+ /**
185
+ * Checks if the given JSON schema is of enum type.
186
+ *
187
+ * @param jsonSchema - The JSON schema to check.
188
+ * @returns - True if the JSON schema is of enum type, false otherwise.
189
+ */
190
+ export declare const isEnumType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaEnum;
191
+ /**
192
+ * Checks if the given JSON schema is of object type.
193
+ *
194
+ * @param jsonSchema - The JSON schema to check.
195
+ * @returns - True if the JSON schema is of object type, false otherwise.
196
+ */
197
+ export declare const isObjectType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaObject;
198
+ /**
199
+ * Checks if the given JSON schema is of object type with buttons.
200
+ *
201
+ * @param jsonSchema - The JSON schema to check.
202
+ * @returns - True if the JSON schema is of object type with buttons, false otherwise.
203
+ */
204
+ export declare const isObjectTypeWithButtons: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaObjectWithButtons;
205
+ /**
206
+ * Checks if the given JSON schema is of array type.
207
+ *
208
+ * @param jsonSchema - The JSON schema to check.
209
+ * @returns - True if the JSON schema is of array type, false otherwise.
210
+ */
211
+ export declare const isArrayType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaArray;
212
+ /**
213
+ * Checks if the given value is a JSON AnyOf Schema.
214
+ *
215
+ * @param value - The value to check.
216
+ * @returns - True if the value is a JSON AnyOf schema, false otherwise.
217
+ */
218
+ export declare const isAnyOfSchema: (value: any) => value is JsonSchemaAnyOf;
219
+ /**
220
+ * Checks if the given value is a JSON Primitive schema.
221
+ *
222
+ * @param value - The value to check.
223
+ * @returns - True if the value is a JSON schema, false otherwise.
224
+ */
225
+ export declare const isPrimitiveType: (value: any) => value is JsonSchemaString | JsonSchemaNumber | JsonSchemaBoolean | JsonSchemaEnum;
226
+ /**
227
+ * Creates a Zod string schema from a given JSON schema.
228
+ *
229
+ * @param jsonSchema - The JSON schema from which the Zod schema should be created.
230
+ * @returns - The created Zod string schema.
231
+ */
232
+ export declare const createZodStringSchema: (jsonSchema: JsonSchemaString) => OptionalZodString;
233
+ /**
234
+ * Creates a Zod number schema from a given JSON schema.
235
+ *
236
+ * @param jsonSchema - The JSON schema from which the Zod schema should be created.
237
+ * @returns - The created Zod number schema.
238
+ */
239
+ export declare const createZodNumberSchema: (jsonSchema: JsonSchemaNumber) => OptionalZodNumber;
240
+ /**
241
+ * Creates a Zod boolean schema from a given JSON schema.
242
+ *
243
+ * @param jsonSchema - The JSON schema from which the Zod schema should be created.
244
+ * @returns - The created Zod boolean schema.
245
+ */
246
+ export declare const createZodBooleanSchema: (jsonSchema: JsonSchemaBoolean) => OptionalZodBoolean;
247
+ /**
248
+ * Creates a Zod union schema from a given JSON schema.
249
+ *
250
+ * @param jsonSchema - The JSON schema from which the Zod schema should be created.
251
+ * @returns - The created Zod union schema.
252
+ */
253
+ export declare const createEnumSchema: (jsonSchema: JsonSchemaEnum) => OptionalZodEnum | OptionalZodEnumMultiple;
254
+ /**
255
+ * Creates a Zod object schema from a given JSON schema.
256
+ *
257
+ * @param jsonSchema - The JSON schema from which the Zod schema should be created.
258
+ * @returns - The created Zod object schema.
259
+ */
260
+ export declare const createZodObjectSchema: (jsonSchema: JsonSchemaObject) => OptionalZodZobject;
261
+ /**
262
+ * Creates a Zod array schema from a given JSON schema.
263
+ *
264
+ * @param jsonSchema - The JSON schema from which the Zod schema should be created.
265
+ * @returns - The created Zod array schema.
266
+ */
267
+ export declare const createZodArraySchema: (jsonSchema: JsonSchemaArray) => OptionalZodArray;
268
+ export {};
@@ -0,0 +1,28 @@
1
+ import { CameraStorage } from './cameraStorage.js';
2
+ import type { PluginJsonSchemaForm } from '../types.js';
3
+ import type { PluginAPI } from './api.js';
4
+ export declare class StorageController {
5
+ private api;
6
+ private cameraStorages;
7
+ constructor(api: PluginAPI);
8
+ /**
9
+ * Create a camera storage instance
10
+ *
11
+ * @param instance - The plugin instance
12
+ * @param cameraId - The camera id
13
+ * @param schema - The plugin schema
14
+ */
15
+ createCameraStorage(instance: any, cameraId: string, schema?: PluginJsonSchemaForm): Promise<CameraStorage>;
16
+ /**
17
+ * Get a camera storage instance
18
+ *
19
+ * @param cameraId - The camera id
20
+ */
21
+ getCameraStorage(cameraId: string): CameraStorage | undefined;
22
+ /**
23
+ * Remove a camera storage instance
24
+ *
25
+ * @param cameraId - The camera id
26
+ */
27
+ removeCameraStorage(cameraId: string): void;
28
+ }
@@ -0,0 +1,42 @@
1
+ import { PythonInstaller } from '../utils/pythonInstaller.js';
2
+ import { PluginConfigService } from './node/config.js';
3
+ import type { PluginConstructor } from '../api.js';
4
+ import type { CameraUiPlugin, IPackageJson } from '../api/types/index.js';
5
+ import type { PluginContract } from './types.js';
6
+ export interface Context {
7
+ engines?: Record<string, string>;
8
+ dependencies?: Record<string, string>;
9
+ }
10
+ export declare class Plugin {
11
+ private logger;
12
+ private configService;
13
+ private _disabled;
14
+ private _info;
15
+ private _contract;
16
+ readonly main: string;
17
+ readonly id: string;
18
+ readonly pluginName: string;
19
+ readonly displayName: string;
20
+ readonly scope?: string;
21
+ readonly isPython: boolean;
22
+ readonly isESM: boolean;
23
+ readonly isSymLink: boolean;
24
+ readonly installPath: string;
25
+ readonly pythonInstallPath: string;
26
+ readonly configFile: string;
27
+ readonly storagePath: string;
28
+ readonly py: PythonInstaller;
29
+ readonly config: PluginConfigService;
30
+ pluginConstructor?: PluginConstructor;
31
+ private loadContext?;
32
+ get contract(): PluginContract;
33
+ get info(): CameraUiPlugin;
34
+ set info(value: CameraUiPlugin);
35
+ get disabled(): boolean;
36
+ set disabled(value: boolean);
37
+ constructor(pluginName: string, installPath: string, packageJSON: IPackageJson, pluginId: string, scope?: string, storagePath?: string);
38
+ load(): Promise<void>;
39
+ reparsePackageJson(): void;
40
+ private parsePackageJson;
41
+ private parseContract;
42
+ }
@@ -72,8 +72,8 @@ export interface JsonBaseSchema<T = any> {
72
72
  }
73
73
  export interface PluginJsonBaseSchema<T = any> extends JsonBaseSchema<T> {
74
74
  store?: boolean;
75
- onSet?: (newValue: any, oldValue: any) => Promise<void> | void;
76
- onGet?: () => any | Promise<any>;
75
+ onSet?: (newValue: any, oldValue: any) => Promise<void>;
76
+ onGet?: () => Promise<any>;
77
77
  }
78
78
  export interface JsonSchemaString extends JsonBaseSchema<string> {
79
79
  type: 'string';
@@ -0,0 +1,22 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { EventEmitter } from 'node:events';
3
+ import type { ProcessMessage, ProcessResponse } from './types.js';
4
+ export declare interface WorkerIPC {
5
+ on(event: 'message', listener: (message: ProcessResponse) => void): this;
6
+ }
7
+ export declare class WorkerIPC extends EventEmitter {
8
+ private publisher?;
9
+ private subscriber?;
10
+ private id;
11
+ private subject;
12
+ private targetSubject;
13
+ private auth;
14
+ constructor(id: string, auth: {
15
+ user: string;
16
+ pass: string;
17
+ });
18
+ listen(): Promise<void>;
19
+ close(): Promise<void>;
20
+ sendMessage(message: ProcessMessage): void;
21
+ private listenToMessages;
22
+ }
@@ -0,0 +1,30 @@
1
+ import { PLUGIN_STATUS } from './types.js';
2
+ import type { Plugin } from './plugin.js';
3
+ export declare class PluginWorker {
4
+ plugin: Plugin;
5
+ private pluginWorker?;
6
+ private proxyServer;
7
+ private ipc;
8
+ private api;
9
+ private logger;
10
+ private configService;
11
+ private socketService;
12
+ private started;
13
+ private shuttingDown;
14
+ private _status;
15
+ get status(): PLUGIN_STATUS;
16
+ constructor(plugin: Plugin);
17
+ start(): Promise<void>;
18
+ teardown(): Promise<void>;
19
+ restart(): Promise<void>;
20
+ getPID(): number;
21
+ isRunning(): boolean;
22
+ private gatherDevices;
23
+ private kill;
24
+ private setStatus;
25
+ private sendMessage;
26
+ private handleClose;
27
+ private reset;
28
+ private updatePython;
29
+ private cleanedProcessEnv;
30
+ }
@@ -0,0 +1,6 @@
1
+ import type { RTCIceServer } from 'werift';
2
+ import type { Go2RtcConfig, IConfig, IceServer } from './types.js';
3
+ export declare const DEFAULT_ICE_SERVERS: IceServer[];
4
+ export declare const DEFAULT_WERIFT_ICE_SERVERS: RTCIceServer[];
5
+ export declare const DEFAULT_CONFIG: IConfig;
6
+ export declare const DEFAULT_GO2RTC_CONFIG: Go2RtcConfig;
@@ -0,0 +1,60 @@
1
+ import 'reflect-metadata';
2
+ import type { Go2RtcConfig, IConfig, Secrets } from './types.js';
3
+ export declare class ConfigService {
4
+ private logger;
5
+ private _config;
6
+ private _go2rtcConfig;
7
+ CAMERAS_ID: string;
8
+ DATABASE_ID: string;
9
+ PLUGINS_ID: string;
10
+ USER_PLUGINS_ID: string;
11
+ SETTINGS_ID: string;
12
+ TOKENS_ID: string;
13
+ USERS_ID: string;
14
+ SECRETS: Secrets;
15
+ static IS_DEV: boolean;
16
+ static IS_DOCKER: boolean;
17
+ static IS_ELECTRON: boolean;
18
+ static IS_HA: boolean;
19
+ static IS_STANDARD: boolean;
20
+ static IS_SERVICE: boolean;
21
+ SERVER_PATH: string;
22
+ INTERFACE_PATH: string;
23
+ static VERSION: string;
24
+ static MIN_NODE_VERSION: string;
25
+ static NODE_VERSION: string;
26
+ HOME_PATH: string;
27
+ STORAGE_PATH: string;
28
+ DATABASE_PATH: string;
29
+ USERS_STORAGE_PATH: string;
30
+ PLUGINS_STORAGE_PATH: string;
31
+ PLUGINS_INSTALL_PATH: string;
32
+ PLUGINS_PJSON_FILE: string;
33
+ LOG_FILE: string;
34
+ CONFIG_FILE: string;
35
+ SECRETS_FILE: string;
36
+ PYTHON_BINARY: string;
37
+ GO2RTC_BINARY: string;
38
+ GO2RTC_CONFIG_FILE: string;
39
+ NATS_BINARY: string;
40
+ UI_PORT: number;
41
+ UI_ELECTRON_PORT: number;
42
+ get config(): IConfig;
43
+ set config(newConfig: IConfig);
44
+ get go2rtcConfig(): Go2RtcConfig;
45
+ set go2rtcConfig(newConfig: Go2RtcConfig);
46
+ constructor();
47
+ read(): void;
48
+ writeConfig(newConfig?: IConfig): void;
49
+ writeGo2RtcConfigFile(newConfig?: Go2RtcConfig): void;
50
+ writeGo2RtcConfigApi(newConfig?: Go2RtcConfig): Promise<void>;
51
+ mergeGo2RtcConfig(): Promise<void>;
52
+ private defaultConfig;
53
+ private defaultGo2RtcConfig;
54
+ private readConfig;
55
+ private readGo2RtcConfig;
56
+ private updateConfig;
57
+ private updateGo2RtcConfig;
58
+ private updateSecrets;
59
+ static extractVersion(str: string): string | null;
60
+ }
@@ -0,0 +1,28 @@
1
+ import 'reflect-metadata';
2
+ import type { Socket } from 'socket.io';
3
+ import type { UiNotification } from '../../api/types/index.js';
4
+ import type { LoggingLevel } from '../config/types.js';
5
+ export declare class Logger {
6
+ private _loggerPrefix;
7
+ private _debugEnabled;
8
+ private _traceLogging;
9
+ private _disableTimestamps;
10
+ notifications: UiNotification[];
11
+ get debugEnabled(): boolean;
12
+ set debugEnabled(state: boolean);
13
+ get traceLogging(): boolean;
14
+ set traceLogging(state: boolean);
15
+ get disableTimestamps(): boolean;
16
+ set disableTimestamps(state: boolean);
17
+ get prefix(): string;
18
+ constructor();
19
+ log(...args: any[]): void;
20
+ error(...args: any[]): void;
21
+ warn(...args: any[]): void;
22
+ attention(...args: any[]): void;
23
+ debug(...args: any[]): void;
24
+ trace(...args: any[]): void;
25
+ notify(title: string, text: string, type: LoggingLevel, link: string, socket?: Socket): Promise<void>;
26
+ private setNotification;
27
+ private formatDateTime;
28
+ }
@@ -0,0 +1,47 @@
1
+ import { PortablePython } from '@bjia56/portable-python';
2
+ export declare const SERVER_PY_VERSION = "3.11";
3
+ export declare class PythonInstaller {
4
+ static readonly versions: string[];
5
+ readonly python: PortablePython;
6
+ readonly venvPath?: string;
7
+ readonly installPath: string;
8
+ private identifier;
9
+ private logger;
10
+ private configService;
11
+ private needsUpdate;
12
+ get isInstalled(): boolean;
13
+ get pluginPythonPath(): string;
14
+ get serverPythonPath(): string;
15
+ get pluginPackagesPath(): string;
16
+ get serverPackagesPath(): string;
17
+ get version(): string;
18
+ private get logPrefix();
19
+ constructor(identifier: string, venvDir?: string, version?: string);
20
+ install(): Promise<void>;
21
+ installPluginPython(): Promise<void>;
22
+ uninstall(): Promise<void>;
23
+ updatePluginDependencies(requirementsPath: string): Promise<void>;
24
+ updateServerDependencies(): Promise<void>;
25
+ installPluginPackages(pkgs: string[]): Promise<string>;
26
+ installServerPackages(pkgs: string[]): Promise<string>;
27
+ reinstallPluginPackes(pkgs: string[]): Promise<string>;
28
+ reinstallServerPackages(pkgs: string[]): Promise<string>;
29
+ uninstallPluginPackages(pkgs: string[]): Promise<string>;
30
+ uninstallServerPackages(pkgs: string[]): Promise<string>;
31
+ private installPluginRequirements;
32
+ private installServerRequirements;
33
+ private updateRequirements;
34
+ private analyzeDependencies;
35
+ private updateDependencies;
36
+ private installRequirements;
37
+ private installPackages;
38
+ private uninstallPackages;
39
+ private reinstallPackages;
40
+ private ensureVenv;
41
+ private createVenv;
42
+ private removeVenv;
43
+ private removeOldVersions;
44
+ private getMajorMinorVersion;
45
+ private cleanPackageName;
46
+ private difference;
47
+ }
@@ -0,0 +1,6 @@
1
+ import type { JwtTokenDecoded } from '../api/types/index.js';
2
+ export declare const toQuery: (data: any) => string;
3
+ export declare const toData: (query: string) => Record<string, any>;
4
+ export declare const isJson: (str: any) => boolean;
5
+ export declare const parseJwt: (access_token: string) => JwtTokenDecoded;
6
+ export declare const sleep: (ms: number) => Promise<void>;
@@ -1,6 +1,6 @@
1
1
  export type * from '../../server/src/api/database/types.js';
2
2
  export type * from '../../server/src/api/types/index.js';
3
- export type * from '../../server/src/api/ws/types.js';
3
+ export type * from '../../server/src/api/websocket/types.js';
4
4
  export * from '../../server/src/camera/base/cameraDeviceBrowser.js';
5
5
  export * from '../../server/src/camera/streaming/browser/browser-streaming-session.js';
6
6
  export * from '../../server/src/camera/streaming/browser/webrtc-browser-connection.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camera.ui/browser",
3
- "version": "0.0.69",
3
+ "version": "0.0.71",
4
4
  "description": "camera.ui browser client",
5
5
  "author": "seydx (https://github.com/seydx/camera.ui)",
6
6
  "module": "./dist/bundle.js",
@@ -26,11 +26,12 @@
26
26
  "axios": "^1.6.8",
27
27
  "lodash.clonedeep": "^4.5.0",
28
28
  "lodash.isequal": "^4.5.0",
29
+ "lru-cache": "^10.2.2",
29
30
  "rxjs": "^7.8.1",
30
31
  "socket.io-client": "^4.7.5"
31
32
  },
32
33
  "devDependencies": {
33
- "@rushstack/eslint-patch": "^1.10.2",
34
+ "@rushstack/eslint-patch": "^1.10.3",
34
35
  "@swc/register": "^0.1.10",
35
36
  "@types/webrtc": "^0.0.43",
36
37
  "@typescript-eslint/eslint-plugin": "^7.9.0",
@@ -43,7 +44,7 @@
43
44
  "rimraf": "^5.0.7",
44
45
  "ts-loader": "^9.5.1",
45
46
  "typescript": "^5.4.5",
46
- "updates": "^16.0.1",
47
+ "updates": "^16.1.1",
47
48
  "utf-8-validate": "^6.0.4",
48
49
  "webpack": "^5.91.0",
49
50
  "webpack-cli": "^5.1.4"
package/.eslintrc.cjs DELETED
@@ -1,44 +0,0 @@
1
- /* eslint-env node */
2
- require('@rushstack/eslint-patch/modern-module-resolution');
3
-
4
- module.exports = {
5
- root: true,
6
- env: {
7
- node: true,
8
- es2021: true,
9
- },
10
- extends: [
11
- 'eslint:recommended',
12
- 'plugin:@typescript-eslint/eslint-recommended',
13
- //'plugin:@typescript-eslint/recommended',
14
- 'plugin:prettier/recommended',
15
- ],
16
- parser: '@typescript-eslint/parser',
17
- parserOptions: {
18
- project: 'tsconfig.json',
19
- tsconfigRootDir: __dirname,
20
- ecmaVersion: 'latest',
21
- sourceType: 'module',
22
- },
23
- plugins: ['@typescript-eslint/eslint-plugin', 'prettier'],
24
- ignorePatterns: ['updates.config.js', 'dist', 'node_modules', 'binary', 'scripts', '.eslintrc.cjs', 'webpack.config.js', 'test.ts', 'empty.js'],
25
- rules: {
26
- '@typescript-eslint/await-thenable': 'error',
27
- semi: [1, 'always'],
28
- quotes: ['error', 'single'],
29
- 'comma-dangle': ['error', 'only-multiline'],
30
- 'no-multiple-empty-lines': ['warn', { max: 1, maxEOF: 0 }],
31
- 'eol-last': ['error', 'always'],
32
- 'space-before-function-paren': ['error', { named: 'never' }],
33
- 'vue/multi-word-component-names': 'off',
34
- 'vue/first-attribute-linebreak': 'off',
35
- 'vue/require-default-prop': 'off',
36
- '@typescript-eslint/no-explicit-any': 'off',
37
- 'prettier/prettier': 'error',
38
- 'no-unused-vars': 'off',
39
- 'no-case-declarations': 'off',
40
- 'no-async-promise-executor': 'off',
41
- 'no-control-regex': 'off',
42
- '@typescript-eslint/no-unused-vars': ['warn'],
43
- },
44
- };