@camstack/types 0.1.1 → 0.1.2
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.
- package/dist/index.d.mts +3757 -108
- package/dist/index.d.ts +3757 -108
- package/dist/index.js +377 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +369 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -4
package/dist/index.js
CHANGED
|
@@ -28,28 +28,59 @@ __export(src_exports, {
|
|
|
28
28
|
DEFAULT_LOCATION_SUBPATHS: () => DEFAULT_LOCATION_SUBPATHS,
|
|
29
29
|
DEFAULT_RETENTION: () => DEFAULT_RETENTION,
|
|
30
30
|
DETECTION_TYPES: () => DETECTION_TYPES,
|
|
31
|
+
DEVICE_TYPE_INFO: () => DEVICE_TYPE_INFO,
|
|
32
|
+
DeviceType: () => DeviceType,
|
|
31
33
|
HF_BASE_URL: () => HF_BASE_URL,
|
|
32
34
|
HF_REPO: () => HF_REPO,
|
|
33
35
|
MACRO_LABELS: () => MACRO_LABELS,
|
|
36
|
+
READ_ONLY_SECTIONS: () => READ_ONLY_SECTIONS,
|
|
34
37
|
RECOGNITION_TYPES: () => RECOGNITION_TYPES,
|
|
38
|
+
SETTINGS_TABS: () => SETTINGS_TABS,
|
|
35
39
|
SUB_DETECTION_TYPES: () => SUB_DETECTION_TYPES,
|
|
40
|
+
SYSTEM_SETTINGS_SCHEMAS: () => SYSTEM_SETTINGS_SCHEMAS,
|
|
36
41
|
cosineSimilarity: () => cosineSimilarity,
|
|
37
42
|
createAnalysisContext: () => createAnalysisContext,
|
|
38
43
|
enrichContext: () => enrichContext,
|
|
39
|
-
|
|
44
|
+
getSystemSettingsSchema: () => getSystemSettingsSchema,
|
|
45
|
+
hfModelUrl: () => hfModelUrl,
|
|
46
|
+
resolveTranslation: () => resolveTranslation
|
|
40
47
|
});
|
|
41
48
|
module.exports = __toCommonJS(src_exports);
|
|
42
49
|
|
|
43
50
|
// src/interfaces/storage-backend.ts
|
|
44
51
|
var DEFAULT_LOCATION_SUBPATHS = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
recordings: "recordings",
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
"recordings-high": "recordings-high",
|
|
53
|
+
"recordings-low": "recordings-low",
|
|
54
|
+
"recordings-clips": "recordings-clips",
|
|
55
|
+
"event-images": "event-images",
|
|
56
|
+
"models": "models",
|
|
57
|
+
"addons-data": "addons-data",
|
|
58
|
+
"cache": "/tmp/camstack-cache",
|
|
59
|
+
"logs": "logs"
|
|
51
60
|
};
|
|
52
61
|
|
|
62
|
+
// src/interfaces/addon-i18n.ts
|
|
63
|
+
function resolveTranslation(provider, locale, key) {
|
|
64
|
+
if (provider.getTranslations) {
|
|
65
|
+
const map = provider.getTranslations(locale);
|
|
66
|
+
if (map && key in map) return map[key];
|
|
67
|
+
if (locale !== "en") {
|
|
68
|
+
const fallback = provider.getTranslations("en");
|
|
69
|
+
if (fallback && key in fallback) return fallback[key];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (provider.getTranslationBundle) {
|
|
73
|
+
const bundle = provider.getTranslationBundle();
|
|
74
|
+
const map = bundle[locale];
|
|
75
|
+
if (map && key in map) return map[key];
|
|
76
|
+
if (locale !== "en") {
|
|
77
|
+
const fallback = bundle["en"];
|
|
78
|
+
if (fallback && key in fallback) return fallback[key];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return key;
|
|
82
|
+
}
|
|
83
|
+
|
|
53
84
|
// src/interfaces/feature-flags.ts
|
|
54
85
|
var DEFAULT_FEATURES = {
|
|
55
86
|
streaming: true,
|
|
@@ -99,6 +130,328 @@ var DEFAULT_RETENTION = {
|
|
|
99
130
|
snapshotsDays: 14
|
|
100
131
|
};
|
|
101
132
|
|
|
133
|
+
// src/schemas/system-settings-schemas.ts
|
|
134
|
+
var READ_ONLY_SECTIONS = /* @__PURE__ */ new Set([
|
|
135
|
+
"server"
|
|
136
|
+
]);
|
|
137
|
+
var SETTINGS_TABS = [
|
|
138
|
+
{ id: "server", label: "Server" },
|
|
139
|
+
{ id: "logging", label: "Logs" },
|
|
140
|
+
{ id: "recording", label: "Recording" },
|
|
141
|
+
{ id: "ffmpeg", label: "FFmpeg" },
|
|
142
|
+
{ id: "detection", label: "Detection" },
|
|
143
|
+
{ id: "auth", label: "Auth" },
|
|
144
|
+
{ id: "retention", label: "Retention" }
|
|
145
|
+
];
|
|
146
|
+
var SERVER_SCHEMA = {
|
|
147
|
+
sections: [
|
|
148
|
+
{
|
|
149
|
+
id: "server-info",
|
|
150
|
+
title: "Server",
|
|
151
|
+
description: "Core server connection settings (read-only)",
|
|
152
|
+
columns: 2,
|
|
153
|
+
fields: [
|
|
154
|
+
{
|
|
155
|
+
type: "info",
|
|
156
|
+
key: "server-restart-note",
|
|
157
|
+
label: "Restart required",
|
|
158
|
+
content: "Server settings are read-only. Change them in config.yaml and restart.",
|
|
159
|
+
variant: "warning"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
type: "text",
|
|
163
|
+
key: "port",
|
|
164
|
+
label: "Port",
|
|
165
|
+
disabled: true,
|
|
166
|
+
description: "Listening port"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
type: "text",
|
|
170
|
+
key: "host",
|
|
171
|
+
label: "Host",
|
|
172
|
+
disabled: true,
|
|
173
|
+
description: "Bind address"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
type: "text",
|
|
177
|
+
key: "dataPath",
|
|
178
|
+
label: "Data Path",
|
|
179
|
+
disabled: true,
|
|
180
|
+
description: "Root data directory",
|
|
181
|
+
span: 2
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
};
|
|
187
|
+
var STORAGE_SCHEMA = {
|
|
188
|
+
sections: []
|
|
189
|
+
};
|
|
190
|
+
var LOGGING_SCHEMA = {
|
|
191
|
+
sections: [
|
|
192
|
+
{
|
|
193
|
+
id: "logging-settings",
|
|
194
|
+
title: "Logging",
|
|
195
|
+
description: "Global log verbosity. Retention is managed per log-destination addon.",
|
|
196
|
+
columns: 1,
|
|
197
|
+
fields: [
|
|
198
|
+
{
|
|
199
|
+
type: "select",
|
|
200
|
+
key: "level",
|
|
201
|
+
label: "Log Level",
|
|
202
|
+
options: [
|
|
203
|
+
{ value: "debug", label: "Debug" },
|
|
204
|
+
{ value: "info", label: "Info" },
|
|
205
|
+
{ value: "warn", label: "Warn" },
|
|
206
|
+
{ value: "error", label: "Error" }
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
};
|
|
213
|
+
var RECORDING_SCHEMA = {
|
|
214
|
+
sections: [
|
|
215
|
+
{
|
|
216
|
+
id: "recording-settings",
|
|
217
|
+
title: "Recording",
|
|
218
|
+
description: "Video recording segment and retention defaults",
|
|
219
|
+
columns: 2,
|
|
220
|
+
fields: [
|
|
221
|
+
{
|
|
222
|
+
type: "number",
|
|
223
|
+
key: "segmentDurationSeconds",
|
|
224
|
+
label: "Segment Duration",
|
|
225
|
+
description: "Length of each recording segment",
|
|
226
|
+
min: 1,
|
|
227
|
+
max: 60,
|
|
228
|
+
step: 1,
|
|
229
|
+
unit: "seconds"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
type: "number",
|
|
233
|
+
key: "defaultRetentionDays",
|
|
234
|
+
label: "Default Retention",
|
|
235
|
+
description: "Days to keep recordings before auto-delete",
|
|
236
|
+
min: 1,
|
|
237
|
+
max: 365,
|
|
238
|
+
step: 1,
|
|
239
|
+
unit: "days"
|
|
240
|
+
}
|
|
241
|
+
]
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
};
|
|
245
|
+
var FFMPEG_SCHEMA = {
|
|
246
|
+
sections: [
|
|
247
|
+
{
|
|
248
|
+
id: "ffmpeg-settings",
|
|
249
|
+
title: "FFmpeg",
|
|
250
|
+
description: "FFmpeg binary and hardware acceleration settings",
|
|
251
|
+
columns: 2,
|
|
252
|
+
fields: [
|
|
253
|
+
{
|
|
254
|
+
type: "text",
|
|
255
|
+
key: "binaryPath",
|
|
256
|
+
label: "Binary Path",
|
|
257
|
+
description: "Path to ffmpeg executable",
|
|
258
|
+
placeholder: "ffmpeg",
|
|
259
|
+
span: 2
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
type: "select",
|
|
263
|
+
key: "hwAccel",
|
|
264
|
+
label: "Hardware Acceleration",
|
|
265
|
+
description: "GPU decoding/encoding backend",
|
|
266
|
+
options: [
|
|
267
|
+
{ value: "auto", label: "Auto-detect" },
|
|
268
|
+
{ value: "none", label: "None (CPU only)" },
|
|
269
|
+
{ value: "videotoolbox", label: "VideoToolbox (macOS)" },
|
|
270
|
+
{ value: "vaapi", label: "VA-API (Linux Intel/AMD)" },
|
|
271
|
+
{ value: "qsv", label: "QSV (Intel Quick Sync)" },
|
|
272
|
+
{ value: "cuda", label: "CUDA (NVIDIA)" }
|
|
273
|
+
]
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
type: "number",
|
|
277
|
+
key: "threadCount",
|
|
278
|
+
label: "Thread Count",
|
|
279
|
+
description: "0 = auto (let FFmpeg decide)",
|
|
280
|
+
min: 0,
|
|
281
|
+
max: 16,
|
|
282
|
+
step: 1
|
|
283
|
+
}
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
]
|
|
287
|
+
};
|
|
288
|
+
var DETECTION_SCHEMA = {
|
|
289
|
+
sections: [
|
|
290
|
+
{
|
|
291
|
+
id: "detection-fps",
|
|
292
|
+
title: "Frame Rates",
|
|
293
|
+
description: "Default analysis frame rates for new cameras",
|
|
294
|
+
columns: 2,
|
|
295
|
+
fields: [
|
|
296
|
+
{
|
|
297
|
+
type: "number",
|
|
298
|
+
key: "defaultMotionFps",
|
|
299
|
+
label: "Motion FPS",
|
|
300
|
+
description: "Frames per second for motion detection",
|
|
301
|
+
min: 1,
|
|
302
|
+
max: 30,
|
|
303
|
+
step: 1,
|
|
304
|
+
unit: "fps"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
type: "number",
|
|
308
|
+
key: "defaultDetectionFps",
|
|
309
|
+
label: "Detection FPS",
|
|
310
|
+
description: "Frames per second for object detection",
|
|
311
|
+
min: 1,
|
|
312
|
+
max: 30,
|
|
313
|
+
step: 1,
|
|
314
|
+
unit: "fps"
|
|
315
|
+
}
|
|
316
|
+
]
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
id: "detection-thresholds",
|
|
320
|
+
title: "Thresholds",
|
|
321
|
+
description: "Default confidence and cooldown for detections",
|
|
322
|
+
columns: 2,
|
|
323
|
+
fields: [
|
|
324
|
+
{
|
|
325
|
+
type: "slider",
|
|
326
|
+
key: "defaultConfidenceThreshold",
|
|
327
|
+
label: "Confidence Threshold",
|
|
328
|
+
description: "Minimum confidence to trigger a detection event",
|
|
329
|
+
min: 0.1,
|
|
330
|
+
max: 1,
|
|
331
|
+
step: 0.05,
|
|
332
|
+
showValue: true
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
type: "number",
|
|
336
|
+
key: "defaultCooldownSeconds",
|
|
337
|
+
label: "Cooldown",
|
|
338
|
+
description: "Seconds between duplicate events",
|
|
339
|
+
min: 0,
|
|
340
|
+
max: 300,
|
|
341
|
+
step: 1,
|
|
342
|
+
unit: "seconds"
|
|
343
|
+
}
|
|
344
|
+
]
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
id: "detection-tracker",
|
|
348
|
+
title: "Tracker",
|
|
349
|
+
description: "SORT/IoU tracker parameters",
|
|
350
|
+
columns: 3,
|
|
351
|
+
fields: [
|
|
352
|
+
{
|
|
353
|
+
type: "number",
|
|
354
|
+
key: "trackerMaxAgeFrames",
|
|
355
|
+
label: "Max Age",
|
|
356
|
+
description: "Frames before a lost track is removed",
|
|
357
|
+
min: 1,
|
|
358
|
+
max: 120,
|
|
359
|
+
step: 1,
|
|
360
|
+
unit: "frames"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
type: "number",
|
|
364
|
+
key: "trackerMinHits",
|
|
365
|
+
label: "Min Hits",
|
|
366
|
+
description: "Consecutive detections to confirm a track",
|
|
367
|
+
min: 1,
|
|
368
|
+
max: 20,
|
|
369
|
+
step: 1
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
type: "slider",
|
|
373
|
+
key: "trackerIouThreshold",
|
|
374
|
+
label: "IoU Threshold",
|
|
375
|
+
description: "Minimum IoU to associate detection with track",
|
|
376
|
+
min: 0.1,
|
|
377
|
+
max: 0.9,
|
|
378
|
+
step: 0.05,
|
|
379
|
+
showValue: true
|
|
380
|
+
}
|
|
381
|
+
]
|
|
382
|
+
}
|
|
383
|
+
]
|
|
384
|
+
};
|
|
385
|
+
var AUTH_SCHEMA = {
|
|
386
|
+
sections: [
|
|
387
|
+
{
|
|
388
|
+
id: "auth-settings",
|
|
389
|
+
title: "Authentication",
|
|
390
|
+
description: "Token and session settings",
|
|
391
|
+
columns: 1,
|
|
392
|
+
fields: [
|
|
393
|
+
{
|
|
394
|
+
type: "text",
|
|
395
|
+
key: "tokenExpiry",
|
|
396
|
+
label: "Token Expiry",
|
|
397
|
+
description: "JWT token lifetime (e.g. 24h, 7d, 1h)",
|
|
398
|
+
placeholder: "24h"
|
|
399
|
+
}
|
|
400
|
+
]
|
|
401
|
+
}
|
|
402
|
+
]
|
|
403
|
+
};
|
|
404
|
+
var RETENTION_SCHEMA = {
|
|
405
|
+
sections: [
|
|
406
|
+
{
|
|
407
|
+
id: "retention-settings",
|
|
408
|
+
title: "Retention",
|
|
409
|
+
description: "Data retention periods for analytics data",
|
|
410
|
+
columns: 1,
|
|
411
|
+
fields: [
|
|
412
|
+
{
|
|
413
|
+
type: "slider",
|
|
414
|
+
key: "detectionEventsDays",
|
|
415
|
+
label: "Detection Events Retention",
|
|
416
|
+
min: 1,
|
|
417
|
+
max: 365,
|
|
418
|
+
unit: "days",
|
|
419
|
+
showValue: true,
|
|
420
|
+
span: 1
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
type: "slider",
|
|
424
|
+
key: "audioLevelsDays",
|
|
425
|
+
label: "Audio Levels Retention",
|
|
426
|
+
min: 1,
|
|
427
|
+
max: 90,
|
|
428
|
+
unit: "days",
|
|
429
|
+
showValue: true,
|
|
430
|
+
span: 1
|
|
431
|
+
}
|
|
432
|
+
]
|
|
433
|
+
}
|
|
434
|
+
]
|
|
435
|
+
};
|
|
436
|
+
var SYSTEM_SETTINGS_SCHEMAS = {
|
|
437
|
+
server: SERVER_SCHEMA,
|
|
438
|
+
storage: STORAGE_SCHEMA,
|
|
439
|
+
logging: LOGGING_SCHEMA,
|
|
440
|
+
recording: RECORDING_SCHEMA,
|
|
441
|
+
ffmpeg: FFMPEG_SCHEMA,
|
|
442
|
+
detection: DETECTION_SCHEMA,
|
|
443
|
+
auth: AUTH_SCHEMA,
|
|
444
|
+
retention: RETENTION_SCHEMA,
|
|
445
|
+
// These sections have no UI form — managed programmatically or addon-specific
|
|
446
|
+
streaming: { sections: [] },
|
|
447
|
+
backup: { sections: [] },
|
|
448
|
+
features: { sections: [] },
|
|
449
|
+
addons: { sections: [] }
|
|
450
|
+
};
|
|
451
|
+
function getSystemSettingsSchema(section) {
|
|
452
|
+
return SYSTEM_SETTINGS_SCHEMAS[section];
|
|
453
|
+
}
|
|
454
|
+
|
|
102
455
|
// src/constants.ts
|
|
103
456
|
var HF_REPO = "camstack/camstack-models";
|
|
104
457
|
var HF_BASE_URL = `https://huggingface.co/${HF_REPO}/resolve/main`;
|
|
@@ -235,6 +588,15 @@ var COCO_TO_MACRO = {
|
|
|
235
588
|
},
|
|
236
589
|
preserveOriginal: true
|
|
237
590
|
};
|
|
591
|
+
|
|
592
|
+
// src/types/device-type.ts
|
|
593
|
+
var DeviceType = /* @__PURE__ */ ((DeviceType2) => {
|
|
594
|
+
DeviceType2["Camera"] = "camera";
|
|
595
|
+
return DeviceType2;
|
|
596
|
+
})(DeviceType || {});
|
|
597
|
+
var DEVICE_TYPE_INFO = {
|
|
598
|
+
["camera" /* Camera */]: { type: "camera" /* Camera */, label: "Camera", icon: "camera" }
|
|
599
|
+
};
|
|
238
600
|
// Annotate the CommonJS export names for ESM import in node:
|
|
239
601
|
0 && (module.exports = {
|
|
240
602
|
BINARY_FRAME_HEADER_SIZE,
|
|
@@ -245,14 +607,21 @@ var COCO_TO_MACRO = {
|
|
|
245
607
|
DEFAULT_LOCATION_SUBPATHS,
|
|
246
608
|
DEFAULT_RETENTION,
|
|
247
609
|
DETECTION_TYPES,
|
|
610
|
+
DEVICE_TYPE_INFO,
|
|
611
|
+
DeviceType,
|
|
248
612
|
HF_BASE_URL,
|
|
249
613
|
HF_REPO,
|
|
250
614
|
MACRO_LABELS,
|
|
615
|
+
READ_ONLY_SECTIONS,
|
|
251
616
|
RECOGNITION_TYPES,
|
|
617
|
+
SETTINGS_TABS,
|
|
252
618
|
SUB_DETECTION_TYPES,
|
|
619
|
+
SYSTEM_SETTINGS_SCHEMAS,
|
|
253
620
|
cosineSimilarity,
|
|
254
621
|
createAnalysisContext,
|
|
255
622
|
enrichContext,
|
|
256
|
-
|
|
623
|
+
getSystemSettingsSchema,
|
|
624
|
+
hfModelUrl,
|
|
625
|
+
resolveTranslation
|
|
257
626
|
});
|
|
258
627
|
//# sourceMappingURL=index.js.map
|