@camstack/core 0.1.13 → 0.1.15
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/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +220 -0
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js.map +1 -0
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +9 -0
- package/dist/builtins/addon-pages-aggregator/index.js +222 -0
- package/dist/builtins/addon-pages-aggregator/index.js.map +1 -0
- package/dist/builtins/addon-pages-aggregator/index.mjs +9 -0
- package/dist/builtins/addon-pages-aggregator/index.mjs.map +1 -0
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +200 -0
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js.map +1 -0
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +9 -0
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs.map +1 -0
- package/dist/builtins/addon-widgets-aggregator/index.js +202 -0
- package/dist/builtins/addon-widgets-aggregator/index.js.map +1 -0
- package/dist/builtins/addon-widgets-aggregator/index.mjs +9 -0
- package/dist/builtins/addon-widgets-aggregator/index.mjs.map +1 -0
- package/dist/builtins/alerts/alerts.addon.js +443 -0
- package/dist/builtins/alerts/alerts.addon.js.map +1 -0
- package/dist/builtins/alerts/alerts.addon.mjs +9 -0
- package/dist/builtins/alerts/alerts.addon.mjs.map +1 -0
- package/dist/builtins/alerts/index.js +443 -0
- package/dist/builtins/alerts/index.js.map +1 -0
- package/dist/builtins/alerts/index.mjs +8 -0
- package/dist/builtins/alerts/index.mjs.map +1 -0
- package/dist/builtins/console-logging/index.js +242 -0
- package/dist/builtins/console-logging/index.js.map +1 -0
- package/dist/builtins/console-logging/index.mjs +11 -0
- package/dist/builtins/console-logging/index.mjs.map +1 -0
- package/dist/builtins/device-manager/device-manager.addon.js +2155 -0
- package/dist/builtins/device-manager/device-manager.addon.js.map +1 -0
- package/dist/builtins/device-manager/device-manager.addon.mjs +9 -0
- package/dist/builtins/device-manager/device-manager.addon.mjs.map +1 -0
- package/dist/builtins/device-manager/index.js +2157 -0
- package/dist/builtins/device-manager/index.js.map +1 -0
- package/dist/builtins/device-manager/index.mjs +10 -0
- package/dist/builtins/device-manager/index.mjs.map +1 -0
- package/dist/builtins/hub-forwarder/index.js +297 -0
- package/dist/builtins/hub-forwarder/index.js.map +1 -0
- package/dist/builtins/hub-forwarder/index.mjs +11 -0
- package/dist/builtins/hub-forwarder/index.mjs.map +1 -0
- package/dist/builtins/local-auth/index.js +623 -0
- package/dist/builtins/local-auth/index.js.map +1 -0
- package/dist/builtins/local-auth/index.mjs +8 -0
- package/dist/builtins/local-auth/index.mjs.map +1 -0
- package/dist/builtins/local-auth/local-auth.addon.js +623 -0
- package/dist/builtins/local-auth/local-auth.addon.js.map +1 -0
- package/dist/builtins/local-auth/local-auth.addon.mjs +9 -0
- package/dist/builtins/local-auth/local-auth.addon.mjs.map +1 -0
- package/dist/builtins/local-backup/index.js +53 -68
- package/dist/builtins/local-backup/index.js.map +1 -1
- package/dist/builtins/local-backup/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +898 -0
- package/dist/builtins/native-metrics/native-metrics.addon.js.map +1 -0
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +7 -0
- package/dist/builtins/native-metrics/native-metrics.addon.mjs.map +1 -0
- package/dist/builtins/snapshot/index.js +504 -0
- package/dist/builtins/snapshot/index.js.map +1 -0
- package/dist/builtins/snapshot/index.mjs +477 -0
- package/dist/builtins/snapshot/index.mjs.map +1 -0
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +16 -166
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js.map +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/index.js +554 -621
- package/dist/builtins/sqlite-storage/index.js.map +1 -1
- package/dist/builtins/sqlite-storage/index.mjs +9 -11
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +368 -130
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js.map +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +1 -1
- package/dist/builtins/system-config/index.js +189 -0
- package/dist/builtins/system-config/index.js.map +1 -0
- package/dist/builtins/system-config/index.mjs +10 -0
- package/dist/builtins/system-config/index.mjs.map +1 -0
- package/dist/builtins/system-config/system-config.addon.js +187 -0
- package/dist/builtins/system-config/system-config.addon.js.map +1 -0
- package/dist/builtins/system-config/system-config.addon.mjs +9 -0
- package/dist/builtins/system-config/system-config.addon.mjs.map +1 -0
- package/dist/builtins/winston-logging/index.js +185 -65
- package/dist/builtins/winston-logging/index.js.map +1 -1
- package/dist/builtins/winston-logging/index.mjs +2 -1
- package/dist/chunk-2CIYKDRN.mjs +1 -0
- package/dist/chunk-2CIYKDRN.mjs.map +1 -0
- package/dist/chunk-2F76X6NL.mjs +136 -0
- package/dist/chunk-2F76X6NL.mjs.map +1 -0
- package/dist/chunk-2QUFBZ7M.mjs +1 -0
- package/dist/chunk-2QUFBZ7M.mjs.map +1 -0
- package/dist/chunk-3BK2Y7GY.mjs +593 -0
- package/dist/chunk-3BK2Y7GY.mjs.map +1 -0
- package/dist/chunk-4OOHFJHT.mjs +421 -0
- package/dist/chunk-4OOHFJHT.mjs.map +1 -0
- package/dist/chunk-4XHB7IHT.mjs +809 -0
- package/dist/chunk-4XHB7IHT.mjs.map +1 -0
- package/dist/{chunk-2F3XZYRW.mjs → chunk-6M2HSSTQ.mjs} +16 -7
- package/dist/chunk-6M2HSSTQ.mjs.map +1 -0
- package/dist/{chunk-SO4LROOT.mjs → chunk-7FI7SQS7.mjs} +54 -69
- package/dist/chunk-7FI7SQS7.mjs.map +1 -0
- package/dist/chunk-ED57RCQE.mjs +171 -0
- package/dist/chunk-ED57RCQE.mjs.map +1 -0
- package/dist/chunk-FZN56HGQ.mjs +626 -0
- package/dist/chunk-FZN56HGQ.mjs.map +1 -0
- package/dist/chunk-GL4OOB25.mjs +51 -0
- package/dist/chunk-GL4OOB25.mjs.map +1 -0
- package/dist/chunk-KDG2NTDB.mjs +137 -0
- package/dist/chunk-KDG2NTDB.mjs.map +1 -0
- package/dist/chunk-NRBQWBDM.mjs +191 -0
- package/dist/chunk-NRBQWBDM.mjs.map +1 -0
- package/dist/chunk-O4V246GG.mjs +2137 -0
- package/dist/chunk-O4V246GG.mjs.map +1 -0
- package/dist/chunk-QT57H266.mjs +163 -0
- package/dist/chunk-QT57H266.mjs.map +1 -0
- package/dist/chunk-QX4RH25I.mjs +141 -0
- package/dist/chunk-QX4RH25I.mjs.map +1 -0
- package/dist/chunk-TB562PZX.mjs +86 -0
- package/dist/chunk-TB562PZX.mjs.map +1 -0
- package/dist/chunk-TDYPZXK5.mjs +1 -0
- package/dist/chunk-TDYPZXK5.mjs.map +1 -0
- package/dist/chunk-UJI4LN5P.mjs +36 -0
- package/dist/chunk-UJI4LN5P.mjs.map +1 -0
- package/dist/chunk-W6RTHQGP.mjs +1 -0
- package/dist/chunk-W6RTHQGP.mjs.map +1 -0
- package/dist/chunk-ZELBCPDC.mjs +369 -0
- package/dist/chunk-ZELBCPDC.mjs.map +1 -0
- package/dist/index.d.mts +1103 -544
- package/dist/index.d.ts +1103 -544
- package/dist/index.js +7032 -6033
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +568 -2226
- package/dist/index.mjs.map +1 -1
- package/dist/resource-monitor-UZUGPIAU.mjs +9 -0
- package/dist/resource-monitor-UZUGPIAU.mjs.map +1 -0
- package/dist/storage-location-manager-HFNB3PCS.mjs +7 -0
- package/dist/storage-location-manager-HFNB3PCS.mjs.map +1 -0
- package/package.json +123 -2
- package/dist/builtins/local-backup/index.d.mts +0 -42
- package/dist/builtins/local-backup/index.d.ts +0 -42
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.d.mts +0 -2
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.d.ts +0 -2
- package/dist/builtins/sqlite-storage/index.d.mts +0 -4
- package/dist/builtins/sqlite-storage/index.d.ts +0 -4
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.mts +0 -2
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +0 -2
- package/dist/builtins/winston-logging/index.d.mts +0 -30
- package/dist/builtins/winston-logging/index.d.ts +0 -30
- package/dist/chunk-2F3XZYRW.mjs.map +0 -1
- package/dist/chunk-LQFPAEQF.mjs +0 -147
- package/dist/chunk-LQFPAEQF.mjs.map +0 -1
- package/dist/chunk-R3DIIBBX.mjs +0 -532
- package/dist/chunk-R3DIIBBX.mjs.map +0 -1
- package/dist/chunk-SMNR44VG.mjs +0 -386
- package/dist/chunk-SMNR44VG.mjs.map +0 -1
- package/dist/chunk-SO4LROOT.mjs.map +0 -1
- package/dist/chunk-SPA4JBKN.mjs +0 -175
- package/dist/chunk-SPA4JBKN.mjs.map +0 -1
- package/dist/dist-3BY63UQ5.mjs +0 -2151
- package/dist/dist-3BY63UQ5.mjs.map +0 -1
- package/dist/filesystem-storage.addon-C42r589X.d.mts +0 -57
- package/dist/filesystem-storage.addon-C42r589X.d.ts +0 -57
- package/dist/sql-schema-CKz78rId.d.mts +0 -97
- package/dist/sql-schema-CKz78rId.d.ts +0 -97
- package/dist/sqlite-settings.addon-KwG-uKMP.d.mts +0 -79
- package/dist/sqlite-settings.addon-KwG-uKMP.d.ts +0 -79
- package/dist/storage-location-manager-KKDQNAKA.mjs +0 -7
- /package/dist/{storage-location-manager-KKDQNAKA.mjs.map → builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"addons": [
|
|
31
31
|
{
|
|
32
32
|
"id": "filesystem-storage",
|
|
33
|
+
"name": "Filesystem Storage",
|
|
33
34
|
"entry": "./dist/builtins/sqlite-storage/filesystem-storage.addon.js",
|
|
34
35
|
"capabilities": [
|
|
35
36
|
{
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
},
|
|
41
42
|
{
|
|
42
43
|
"id": "sqlite-settings",
|
|
44
|
+
"name": "SQLite Settings",
|
|
43
45
|
"entry": "./dist/builtins/sqlite-storage/sqlite-settings.addon.js",
|
|
44
46
|
"capabilities": [
|
|
45
47
|
{
|
|
@@ -50,6 +52,7 @@
|
|
|
50
52
|
},
|
|
51
53
|
{
|
|
52
54
|
"id": "winston-logging",
|
|
55
|
+
"name": "Winston Logging",
|
|
53
56
|
"entry": "./dist/builtins/winston-logging/index.js",
|
|
54
57
|
"capabilities": [
|
|
55
58
|
{
|
|
@@ -58,8 +61,31 @@
|
|
|
58
61
|
}
|
|
59
62
|
]
|
|
60
63
|
},
|
|
64
|
+
{
|
|
65
|
+
"id": "console-logging",
|
|
66
|
+
"name": "Console Logging",
|
|
67
|
+
"entry": "./dist/builtins/console-logging/index.js",
|
|
68
|
+
"capabilities": [
|
|
69
|
+
{
|
|
70
|
+
"name": "log-destination",
|
|
71
|
+
"mode": "collection"
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"id": "hub-forwarder",
|
|
77
|
+
"name": "Hub Log Forwarder",
|
|
78
|
+
"entry": "./dist/builtins/hub-forwarder/index.js",
|
|
79
|
+
"capabilities": [
|
|
80
|
+
{
|
|
81
|
+
"name": "log-destination",
|
|
82
|
+
"mode": "collection"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
},
|
|
61
86
|
{
|
|
62
87
|
"id": "local-backup",
|
|
88
|
+
"name": "Local Backup",
|
|
63
89
|
"entry": "./dist/builtins/local-backup/index.js",
|
|
64
90
|
"capabilities": [
|
|
65
91
|
{
|
|
@@ -67,6 +93,100 @@
|
|
|
67
93
|
"mode": "collection"
|
|
68
94
|
}
|
|
69
95
|
]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"id": "metrics-native",
|
|
99
|
+
"name": "Native Metrics",
|
|
100
|
+
"entry": "./dist/builtins/native-metrics/native-metrics.addon.js",
|
|
101
|
+
"capabilities": [
|
|
102
|
+
{
|
|
103
|
+
"name": "metrics-provider",
|
|
104
|
+
"mode": "singleton"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"id": "snapshot",
|
|
110
|
+
"name": "Snapshot",
|
|
111
|
+
"entry": "./dist/builtins/snapshot/index.js",
|
|
112
|
+
"capabilities": [
|
|
113
|
+
{
|
|
114
|
+
"name": "snapshot",
|
|
115
|
+
"mode": "singleton"
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"id": "alert-center",
|
|
121
|
+
"name": "Alert Center",
|
|
122
|
+
"entry": "./dist/builtins/alerts/index.js",
|
|
123
|
+
"capabilities": [
|
|
124
|
+
{
|
|
125
|
+
"name": "alerts",
|
|
126
|
+
"mode": "collection"
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"id": "system-config",
|
|
132
|
+
"name": "System Config",
|
|
133
|
+
"description": "Exposes cluster-wide yml-backed configuration sections (server, auth, ffmpeg, logging, recording, retention) via the three-level settings API. Hub-only.",
|
|
134
|
+
"entry": "./dist/builtins/system-config/index.js",
|
|
135
|
+
"protected": true
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"id": "addon-pages-aggregator",
|
|
139
|
+
"name": "Addon Pages Aggregator",
|
|
140
|
+
"description": "Hub-local singleton that aggregates `addon-pages-source` (collection) providers and emits the public `addon-pages.listPages` surface with versioned bundleUrls.",
|
|
141
|
+
"entry": "./dist/builtins/addon-pages-aggregator/index.js",
|
|
142
|
+
"protected": true,
|
|
143
|
+
"capabilities": [
|
|
144
|
+
{
|
|
145
|
+
"name": "addon-pages"
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"id": "addon-widgets-aggregator",
|
|
151
|
+
"name": "Addon Widgets Aggregator",
|
|
152
|
+
"description": "Hub-local singleton that aggregates `addon-widgets-source` (collection) providers and emits the public `addon-widgets.listWidgets` surface with versioned bundleUrls.",
|
|
153
|
+
"entry": "./dist/builtins/addon-widgets-aggregator/index.js",
|
|
154
|
+
"protected": true,
|
|
155
|
+
"capabilities": [
|
|
156
|
+
{
|
|
157
|
+
"name": "addon-widgets"
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"id": "device-manager",
|
|
163
|
+
"name": "Device Manager",
|
|
164
|
+
"description": "Hub-side singleton that unifies device persistence and management. Uses ctx.settings for storage — no direct SQLite access. Replaces device-persistence cap (Phase 2 will delete device-persistence once all consumers are migrated).",
|
|
165
|
+
"entry": "./dist/builtins/device-manager/index.js",
|
|
166
|
+
"protected": true,
|
|
167
|
+
"capabilities": [
|
|
168
|
+
{
|
|
169
|
+
"name": "device-manager"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"name": "device-state"
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"id": "local-auth",
|
|
178
|
+
"name": "Local Auth",
|
|
179
|
+
"description": "Built-in local username/password authentication. Implements the auth-provider capability as the default login path. OIDC and other providers can register alongside via the same capability.",
|
|
180
|
+
"entry": "./dist/builtins/local-auth/index.js",
|
|
181
|
+
"protected": true,
|
|
182
|
+
"capabilities": [
|
|
183
|
+
{
|
|
184
|
+
"name": "auth-provider"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"name": "user-management"
|
|
188
|
+
}
|
|
189
|
+
]
|
|
70
190
|
}
|
|
71
191
|
]
|
|
72
192
|
},
|
|
@@ -86,7 +206,6 @@
|
|
|
86
206
|
"bcryptjs": "^2.4.3",
|
|
87
207
|
"better-sqlite3": "^12.8.0",
|
|
88
208
|
"jsonwebtoken": "^9.0.0",
|
|
89
|
-
"systeminformation": "^5.31.5",
|
|
90
209
|
"winston": "^3.19.0",
|
|
91
210
|
"winston-daily-rotate-file": "^5.0.0"
|
|
92
211
|
},
|
|
@@ -94,8 +213,10 @@
|
|
|
94
213
|
"@camstack/types": "^0.1.0"
|
|
95
214
|
},
|
|
96
215
|
"devDependencies": {
|
|
216
|
+
"@camstack/addon-test-integration": "*",
|
|
97
217
|
"@camstack/types": "*",
|
|
98
218
|
"@types/bcryptjs": "^2.4.6",
|
|
219
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
99
220
|
"@types/jsonwebtoken": "^9.0.0",
|
|
100
221
|
"tsup": "^8.0.0",
|
|
101
222
|
"typescript": "~5.9.0",
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { IScopedLogger, IEventBus, IStorageLocation, BackupManifest, ICamstackAddon, IConfigurable, AddonManifest, AddonContext, CapabilityProviderMap, ConfigUISchema } from '@camstack/types';
|
|
2
|
-
export { BackupManifest } from '@camstack/types';
|
|
3
|
-
|
|
4
|
-
interface BackupConfig {
|
|
5
|
-
readonly backupDir: string;
|
|
6
|
-
readonly retentionCount: number;
|
|
7
|
-
}
|
|
8
|
-
declare class LocalBackupService {
|
|
9
|
-
private readonly config;
|
|
10
|
-
private readonly logger;
|
|
11
|
-
private readonly eventBus;
|
|
12
|
-
private readonly storage;
|
|
13
|
-
private manifests;
|
|
14
|
-
constructor(config: BackupConfig, logger: IScopedLogger, eventBus: IEventBus, storage: IStorageLocation);
|
|
15
|
-
/** Create a backup of specified locations */
|
|
16
|
-
backup(options?: {
|
|
17
|
-
locations?: string[];
|
|
18
|
-
label?: string;
|
|
19
|
-
}): Promise<BackupManifest>;
|
|
20
|
-
/** Restore from a backup */
|
|
21
|
-
restore(backupId: string): Promise<void>;
|
|
22
|
-
/** List all backups sorted by timestamp descending */
|
|
23
|
-
list(): readonly BackupManifest[];
|
|
24
|
-
/** Delete a specific backup */
|
|
25
|
-
delete(backupId: string): Promise<void>;
|
|
26
|
-
private pruneOldBackups;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
declare class LocalBackupAddon implements ICamstackAddon, IConfigurable {
|
|
30
|
-
readonly manifest: AddonManifest;
|
|
31
|
-
private service;
|
|
32
|
-
private currentConfig;
|
|
33
|
-
initialize(context: AddonContext): Promise<void>;
|
|
34
|
-
shutdown(): Promise<void>;
|
|
35
|
-
getService(): LocalBackupService;
|
|
36
|
-
getCapabilityProvider<K extends keyof CapabilityProviderMap>(name: K): CapabilityProviderMap[K] | null;
|
|
37
|
-
getConfigSchema(): ConfigUISchema;
|
|
38
|
-
getConfig(): Record<string, unknown>;
|
|
39
|
-
onConfigChange(config: Record<string, unknown>): Promise<void>;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export { type BackupConfig, LocalBackupAddon, LocalBackupService, LocalBackupAddon as default };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { IScopedLogger, IEventBus, IStorageLocation, BackupManifest, ICamstackAddon, IConfigurable, AddonManifest, AddonContext, CapabilityProviderMap, ConfigUISchema } from '@camstack/types';
|
|
2
|
-
export { BackupManifest } from '@camstack/types';
|
|
3
|
-
|
|
4
|
-
interface BackupConfig {
|
|
5
|
-
readonly backupDir: string;
|
|
6
|
-
readonly retentionCount: number;
|
|
7
|
-
}
|
|
8
|
-
declare class LocalBackupService {
|
|
9
|
-
private readonly config;
|
|
10
|
-
private readonly logger;
|
|
11
|
-
private readonly eventBus;
|
|
12
|
-
private readonly storage;
|
|
13
|
-
private manifests;
|
|
14
|
-
constructor(config: BackupConfig, logger: IScopedLogger, eventBus: IEventBus, storage: IStorageLocation);
|
|
15
|
-
/** Create a backup of specified locations */
|
|
16
|
-
backup(options?: {
|
|
17
|
-
locations?: string[];
|
|
18
|
-
label?: string;
|
|
19
|
-
}): Promise<BackupManifest>;
|
|
20
|
-
/** Restore from a backup */
|
|
21
|
-
restore(backupId: string): Promise<void>;
|
|
22
|
-
/** List all backups sorted by timestamp descending */
|
|
23
|
-
list(): readonly BackupManifest[];
|
|
24
|
-
/** Delete a specific backup */
|
|
25
|
-
delete(backupId: string): Promise<void>;
|
|
26
|
-
private pruneOldBackups;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
declare class LocalBackupAddon implements ICamstackAddon, IConfigurable {
|
|
30
|
-
readonly manifest: AddonManifest;
|
|
31
|
-
private service;
|
|
32
|
-
private currentConfig;
|
|
33
|
-
initialize(context: AddonContext): Promise<void>;
|
|
34
|
-
shutdown(): Promise<void>;
|
|
35
|
-
getService(): LocalBackupService;
|
|
36
|
-
getCapabilityProvider<K extends keyof CapabilityProviderMap>(name: K): CapabilityProviderMap[K] | null;
|
|
37
|
-
getConfigSchema(): ConfigUISchema;
|
|
38
|
-
getConfig(): Record<string, unknown>;
|
|
39
|
-
onConfigChange(config: Record<string, unknown>): Promise<void>;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export { type BackupConfig, LocalBackupAddon, LocalBackupService, LocalBackupAddon as default };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { F as FilesystemStorageAddon, a as FilesystemStorageProvider, F as default } from '../../filesystem-storage.addon-C42r589X.mjs';
|
|
2
|
-
export { S as SqliteSettingsAddon, a as SqliteSettingsBackend } from '../../sqlite-settings.addon-KwG-uKMP.mjs';
|
|
3
|
-
export { A as AddonTableSchema, C as CORE_TABLE_DDL, F as FileSystemStorage, S as SettingsStore, a as SqliteStorageAddon, b as SqliteStorageProvider, c as addonTableToDdl } from '../../sql-schema-CKz78rId.mjs';
|
|
4
|
-
import '@camstack/types';
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { F as FilesystemStorageAddon, a as FilesystemStorageProvider, F as default } from '../../filesystem-storage.addon-C42r589X.js';
|
|
2
|
-
export { S as SqliteSettingsAddon, a as SqliteSettingsBackend } from '../../sqlite-settings.addon-KwG-uKMP.js';
|
|
3
|
-
export { A as AddonTableSchema, C as CORE_TABLE_DDL, F as FileSystemStorage, S as SettingsStore, a as SqliteStorageAddon, b as SqliteStorageProvider, c as addonTableToDdl } from '../../sql-schema-CKz78rId.js';
|
|
4
|
-
import '@camstack/types';
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ILogDestination, LogEntry, LogFilter, ICamstackAddon, IConfigurable, AddonManifest, AddonContext, CapabilityProviderMap, ConfigUISchema } from '@camstack/types';
|
|
2
|
-
|
|
3
|
-
interface WinstonConfig {
|
|
4
|
-
readonly level: string;
|
|
5
|
-
readonly retentionDays: number;
|
|
6
|
-
/** Resolved absolute path to the logs directory (replaces the old dataPath field). */
|
|
7
|
-
readonly logsDir: string;
|
|
8
|
-
}
|
|
9
|
-
declare class WinstonDestination implements ILogDestination {
|
|
10
|
-
private logger;
|
|
11
|
-
initialize(config?: WinstonConfig): Promise<void>;
|
|
12
|
-
write(entry: LogEntry): void;
|
|
13
|
-
query(_filter: LogFilter): Promise<readonly LogEntry[]>;
|
|
14
|
-
shutdown(): Promise<void>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
declare class WinstonLoggingAddon implements ICamstackAddon, IConfigurable {
|
|
18
|
-
readonly manifest: AddonManifest;
|
|
19
|
-
private destination;
|
|
20
|
-
private currentConfig;
|
|
21
|
-
initialize(context: AddonContext): Promise<void>;
|
|
22
|
-
shutdown(): Promise<void>;
|
|
23
|
-
getDestination(): WinstonDestination;
|
|
24
|
-
getCapabilityProvider<K extends keyof CapabilityProviderMap>(name: K): CapabilityProviderMap[K] | null;
|
|
25
|
-
getConfigSchema(): ConfigUISchema;
|
|
26
|
-
getConfig(): Record<string, unknown>;
|
|
27
|
-
onConfigChange(config: Record<string, unknown>): Promise<void>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { WinstonDestination, WinstonLoggingAddon, WinstonLoggingAddon as default };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ILogDestination, LogEntry, LogFilter, ICamstackAddon, IConfigurable, AddonManifest, AddonContext, CapabilityProviderMap, ConfigUISchema } from '@camstack/types';
|
|
2
|
-
|
|
3
|
-
interface WinstonConfig {
|
|
4
|
-
readonly level: string;
|
|
5
|
-
readonly retentionDays: number;
|
|
6
|
-
/** Resolved absolute path to the logs directory (replaces the old dataPath field). */
|
|
7
|
-
readonly logsDir: string;
|
|
8
|
-
}
|
|
9
|
-
declare class WinstonDestination implements ILogDestination {
|
|
10
|
-
private logger;
|
|
11
|
-
initialize(config?: WinstonConfig): Promise<void>;
|
|
12
|
-
write(entry: LogEntry): void;
|
|
13
|
-
query(_filter: LogFilter): Promise<readonly LogEntry[]>;
|
|
14
|
-
shutdown(): Promise<void>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
declare class WinstonLoggingAddon implements ICamstackAddon, IConfigurable {
|
|
18
|
-
readonly manifest: AddonManifest;
|
|
19
|
-
private destination;
|
|
20
|
-
private currentConfig;
|
|
21
|
-
initialize(context: AddonContext): Promise<void>;
|
|
22
|
-
shutdown(): Promise<void>;
|
|
23
|
-
getDestination(): WinstonDestination;
|
|
24
|
-
getCapabilityProvider<K extends keyof CapabilityProviderMap>(name: K): CapabilityProviderMap[K] | null;
|
|
25
|
-
getConfigSchema(): ConfigUISchema;
|
|
26
|
-
getConfig(): Record<string, unknown>;
|
|
27
|
-
onConfigChange(config: Record<string, unknown>): Promise<void>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { WinstonDestination, WinstonLoggingAddon, WinstonLoggingAddon as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/storage/storage-location-manager.ts","../src/storage/fs-storage-backend.ts"],"sourcesContent":["import { join, isAbsolute } from 'node:path'\nimport { FsStorageBackend, type IStorageBackend } from './fs-storage-backend.js'\n\nexport type StorageLocationName = 'data' | 'media' | 'recordings' | 'models' | 'cache' | 'logs'\n\nexport class StorageLocationManager {\n private readonly backends: Map<StorageLocationName, IStorageBackend> = new Map()\n private readonly dataPath: string\n\n constructor(dataPath: string) {\n this.dataPath = dataPath\n }\n\n /** Initialize all locations with default paths */\n async initializeDefaults(): Promise<void> {\n const defaults: Record<StorageLocationName, string> = {\n data: join(this.dataPath, 'db'),\n media: join(this.dataPath, 'media'),\n recordings: join(this.dataPath, 'recordings'),\n models: join(this.dataPath, 'models'),\n cache: '/tmp/camstack-cache',\n logs: join(this.dataPath, 'logs'),\n }\n\n for (const [name, path] of Object.entries(defaults)) {\n const backend = new FsStorageBackend(path)\n await backend.initialize()\n this.backends.set(name as StorageLocationName, backend)\n }\n }\n\n /** Override a specific location's backend path */\n async setLocationPath(name: StorageLocationName, basePath: string): Promise<void> {\n const resolved = isAbsolute(basePath) ? basePath : join(this.dataPath, basePath)\n const backend = new FsStorageBackend(resolved)\n await backend.initialize()\n this.backends.set(name, backend)\n }\n\n /** Get the backend for a location */\n getBackend(name: StorageLocationName): IStorageBackend {\n const backend = this.backends.get(name)\n if (!backend) throw new Error(`Storage location \"${name}\" not initialized`)\n return backend\n }\n\n /** Resolve a path within a location */\n resolve(location: StorageLocationName, subpath: string): string {\n return this.getBackend(location).resolve(subpath)\n }\n\n /** Check if all locations are available */\n getStatus(): Array<{ name: StorageLocationName; available: boolean; path: string }> {\n return Array.from(this.backends.entries()).map(([name, backend]) => ({\n name,\n available: backend.isAvailable(),\n path: backend.basePath,\n }))\n }\n\n /** All location names */\n getLocationNames(): StorageLocationName[] {\n return Array.from(this.backends.keys())\n }\n}\n","import { existsSync, mkdirSync, accessSync, constants } from 'node:fs'\nimport { join, resolve, isAbsolute } from 'node:path'\n\nexport interface IStorageBackend {\n /** Backend type identifier */\n readonly type: string\n /** Base path of this backend */\n readonly basePath: string\n /** Resolve a subpath to an absolute path */\n resolve(subpath: string): string\n /** Check if the backend path exists and is writable */\n isAvailable(): boolean\n /** Ensure base directory exists (mkdir -p equivalent) */\n initialize(): Promise<void>\n}\n\nexport class FsStorageBackend implements IStorageBackend {\n readonly type = 'local'\n readonly basePath: string\n\n constructor(basePath: string) {\n this.basePath = resolve(basePath)\n }\n\n resolve(subpath: string): string {\n if (isAbsolute(subpath)) return subpath\n return join(this.basePath, subpath)\n }\n\n isAvailable(): boolean {\n try {\n if (!existsSync(this.basePath)) return false\n accessSync(this.basePath, constants.W_OK)\n return true\n } catch {\n return false\n }\n }\n\n async initialize(): Promise<void> {\n mkdirSync(this.basePath, { recursive: true })\n }\n}\n"],"mappings":";AAAA,SAAS,QAAAA,OAAM,cAAAC,mBAAkB;;;ACAjC,SAAS,YAAY,WAAW,YAAY,iBAAiB;AAC7D,SAAS,MAAM,SAAS,kBAAkB;AAenC,IAAM,mBAAN,MAAkD;AAAA,EAC9C,OAAO;AAAA,EACP;AAAA,EAET,YAAY,UAAkB;AAC5B,SAAK,WAAW,QAAQ,QAAQ;AAAA,EAClC;AAAA,EAEA,QAAQ,SAAyB;AAC/B,QAAI,WAAW,OAAO,EAAG,QAAO;AAChC,WAAO,KAAK,KAAK,UAAU,OAAO;AAAA,EACpC;AAAA,EAEA,cAAuB;AACrB,QAAI;AACF,UAAI,CAAC,WAAW,KAAK,QAAQ,EAAG,QAAO;AACvC,iBAAW,KAAK,UAAU,UAAU,IAAI;AACxC,aAAO;AAAA,IACT,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AAAA,EAEA,MAAM,aAA4B;AAChC,cAAU,KAAK,UAAU,EAAE,WAAW,KAAK,CAAC;AAAA,EAC9C;AACF;;;ADrCO,IAAM,yBAAN,M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ACA,WAAW,QAAQ,YAAY;AAAA,MAC/B,MAAM,QAAQ;AAAA,IAChB,EAAE;AAAA,EACJ;AAAA;AAAA,EAGA,mBAA0C;AACxC,WAAO,MAAM,KAAK,KAAK,SAAS,KAAK,CAAC;AAAA,EACxC;AACF;","names":["join","isAbsolute","join","isAbsolute"]}
|
package/dist/chunk-LQFPAEQF.mjs
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
// src/builtins/winston-logging/winston-destination.ts
|
|
2
|
-
import * as winston from "winston";
|
|
3
|
-
import DailyRotateFile from "winston-daily-rotate-file";
|
|
4
|
-
import * as path from "path";
|
|
5
|
-
function formatScope(scope) {
|
|
6
|
-
if (scope.length === 0) return "";
|
|
7
|
-
const [first, ...rest] = scope;
|
|
8
|
-
const restFormatted = rest.map((s) => `[${s}]`).join("");
|
|
9
|
-
return `(${first})${restFormatted}`;
|
|
10
|
-
}
|
|
11
|
-
var WinstonDestination = class {
|
|
12
|
-
logger = null;
|
|
13
|
-
async initialize(config) {
|
|
14
|
-
const {
|
|
15
|
-
level = "info",
|
|
16
|
-
retentionDays = 30,
|
|
17
|
-
logsDir = path.join("camstack-data", "logs")
|
|
18
|
-
} = config ?? {};
|
|
19
|
-
const consoleFormat = winston.format.combine(
|
|
20
|
-
winston.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
|
|
21
|
-
winston.format.colorize(),
|
|
22
|
-
winston.format.printf(({ timestamp, level: lvl, message, scope }) => {
|
|
23
|
-
const scopeStr = scope ? ` ${scope}` : "";
|
|
24
|
-
return `${timestamp} [${lvl}]${scopeStr} - ${message}`;
|
|
25
|
-
})
|
|
26
|
-
);
|
|
27
|
-
const fileFormat = winston.format.combine(
|
|
28
|
-
winston.format.timestamp(),
|
|
29
|
-
winston.format.json()
|
|
30
|
-
);
|
|
31
|
-
this.logger = winston.createLogger({
|
|
32
|
-
level,
|
|
33
|
-
transports: [
|
|
34
|
-
new winston.transports.Console({
|
|
35
|
-
format: consoleFormat
|
|
36
|
-
}),
|
|
37
|
-
new DailyRotateFile({
|
|
38
|
-
dirname: logsDir,
|
|
39
|
-
filename: "camstack-%DATE%.log",
|
|
40
|
-
datePattern: "YYYY-MM-DD",
|
|
41
|
-
maxFiles: `${retentionDays}d`,
|
|
42
|
-
format: fileFormat
|
|
43
|
-
})
|
|
44
|
-
]
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
write(entry) {
|
|
48
|
-
if (!this.logger) return;
|
|
49
|
-
const scope = formatScope(entry.scope);
|
|
50
|
-
const meta = entry.meta ?? {};
|
|
51
|
-
this.logger.log({
|
|
52
|
-
level: entry.level,
|
|
53
|
-
message: entry.message,
|
|
54
|
-
scope,
|
|
55
|
-
timestamp: entry.timestamp.toISOString(),
|
|
56
|
-
...meta
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
async query(_filter) {
|
|
60
|
-
return [];
|
|
61
|
-
}
|
|
62
|
-
async shutdown() {
|
|
63
|
-
if (!this.logger) return;
|
|
64
|
-
await new Promise((resolve) => {
|
|
65
|
-
this.logger.on("finish", resolve);
|
|
66
|
-
this.logger.end();
|
|
67
|
-
});
|
|
68
|
-
this.logger = null;
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
// src/builtins/winston-logging/winston-logging.addon.ts
|
|
73
|
-
var WinstonLoggingAddon = class {
|
|
74
|
-
manifest = {
|
|
75
|
-
id: "winston-logging",
|
|
76
|
-
name: "Winston Logging",
|
|
77
|
-
version: "1.0.0",
|
|
78
|
-
capabilities: ["log-destination"]
|
|
79
|
-
};
|
|
80
|
-
destination = null;
|
|
81
|
-
currentConfig = {
|
|
82
|
-
level: "info",
|
|
83
|
-
retentionDays: 30
|
|
84
|
-
};
|
|
85
|
-
async initialize(context) {
|
|
86
|
-
this.currentConfig = {
|
|
87
|
-
level: context.addonConfig.level ?? this.currentConfig.level,
|
|
88
|
-
retentionDays: context.addonConfig.retentionDays ?? this.currentConfig.retentionDays
|
|
89
|
-
};
|
|
90
|
-
const logsDir = context.locationPaths.logs;
|
|
91
|
-
this.destination = new WinstonDestination();
|
|
92
|
-
await this.destination.initialize({ ...this.currentConfig, logsDir });
|
|
93
|
-
context.logger.info("Winston logging initialized");
|
|
94
|
-
}
|
|
95
|
-
async shutdown() {
|
|
96
|
-
await this.destination?.shutdown();
|
|
97
|
-
}
|
|
98
|
-
getDestination() {
|
|
99
|
-
if (!this.destination) throw new Error("Winston not initialized");
|
|
100
|
-
return this.destination;
|
|
101
|
-
}
|
|
102
|
-
getCapabilityProvider(name) {
|
|
103
|
-
if (name === "log-destination" && this.destination) {
|
|
104
|
-
return this.destination;
|
|
105
|
-
}
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
getConfigSchema() {
|
|
109
|
-
return {
|
|
110
|
-
sections: [
|
|
111
|
-
{
|
|
112
|
-
id: "winston-retention",
|
|
113
|
-
title: "Log Retention",
|
|
114
|
-
description: "How long Winston keeps rotated log files on disk.",
|
|
115
|
-
columns: 1,
|
|
116
|
-
fields: [
|
|
117
|
-
{
|
|
118
|
-
type: "number",
|
|
119
|
-
key: "retentionDays",
|
|
120
|
-
label: "Retention (days)",
|
|
121
|
-
description: "Number of days to keep rotated log files before deletion",
|
|
122
|
-
min: 1,
|
|
123
|
-
max: 365,
|
|
124
|
-
step: 1,
|
|
125
|
-
unit: "days"
|
|
126
|
-
}
|
|
127
|
-
]
|
|
128
|
-
}
|
|
129
|
-
]
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
getConfig() {
|
|
133
|
-
return { ...this.currentConfig };
|
|
134
|
-
}
|
|
135
|
-
async onConfigChange(config) {
|
|
136
|
-
this.currentConfig = {
|
|
137
|
-
level: config.level ?? this.currentConfig.level,
|
|
138
|
-
retentionDays: config.retentionDays ?? this.currentConfig.retentionDays
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
export {
|
|
144
|
-
WinstonDestination,
|
|
145
|
-
WinstonLoggingAddon
|
|
146
|
-
};
|
|
147
|
-
//# sourceMappingURL=chunk-LQFPAEQF.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/builtins/winston-logging/winston-destination.ts","../src/builtins/winston-logging/winston-logging.addon.ts"],"sourcesContent":["import * as winston from 'winston'\nimport DailyRotateFile from 'winston-daily-rotate-file'\nimport * as path from 'node:path'\nimport type { ILogDestination, LogEntry, LogFilter } from '@camstack/types'\n\ninterface WinstonConfig {\n readonly level: string\n readonly retentionDays: number\n /** Resolved absolute path to the logs directory (replaces the old dataPath field). */\n readonly logsDir: string\n}\n\nfunction formatScope(scope: readonly string[]): string {\n if (scope.length === 0) return ''\n const [first, ...rest] = scope\n const restFormatted = rest.map((s) => `[${s}]`).join('')\n return `(${first})${restFormatted}`\n}\n\nexport class WinstonDestination implements ILogDestination {\n private logger: winston.Logger | null = null\n\n async initialize(config?: WinstonConfig): Promise<void> {\n const {\n level = 'info',\n retentionDays = 30,\n logsDir = path.join('camstack-data', 'logs'),\n } = config ?? {}\n\n const consoleFormat = winston.format.combine(\n winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),\n winston.format.colorize(),\n winston.format.printf(({ timestamp, level: lvl, message, scope }) => {\n const scopeStr = scope ? ` ${scope}` : ''\n return `${timestamp} [${lvl}]${scopeStr} - ${message}`\n }),\n )\n\n const fileFormat = winston.format.combine(\n winston.format.timestamp(),\n winston.format.json(),\n )\n\n this.logger = winston.createLogger({\n level,\n transports: [\n new winston.transports.Console({\n format: consoleFormat,\n }),\n new DailyRotateFile({\n dirname: logsDir,\n filename: 'camstack-%DATE%.log',\n datePattern: 'YYYY-MM-DD',\n maxFiles: `${retentionDays}d`,\n format: fileFormat,\n }),\n ],\n })\n }\n\n write(entry: LogEntry): void {\n if (!this.logger) return\n\n const scope = formatScope(entry.scope)\n const meta = entry.meta ?? {}\n\n this.logger.log({\n level: entry.level,\n message: entry.message,\n scope,\n timestamp: entry.timestamp.toISOString(),\n ...meta,\n })\n }\n\n async query(_filter: LogFilter): Promise<readonly LogEntry[]> {\n // File-based log querying is not implemented; use structured storage for log queries\n return []\n }\n\n async shutdown(): Promise<void> {\n if (!this.logger) return\n\n await new Promise<void>((resolve) => {\n this.logger!.on('finish', resolve)\n this.logger!.end()\n })\n this.logger = null\n }\n}\n","import type {\n ICamstackAddon,\n AddonManifest,\n AddonContext,\n IConfigurable,\n ConfigUISchema,\n CapabilityProviderMap,\n} from '@camstack/types'\nimport { WinstonDestination } from './winston-destination'\n\nexport class WinstonLoggingAddon implements ICamstackAddon, IConfigurable {\n readonly manifest: AddonManifest = {\n id: 'winston-logging',\n name: 'Winston Logging',\n version: '1.0.0',\n capabilities: ['log-destination'],\n }\n\n private destination: WinstonDestination | null = null\n private currentConfig = {\n level: 'info',\n retentionDays: 30,\n }\n\n async initialize(context: AddonContext): Promise<void> {\n this.currentConfig = {\n level: (context.addonConfig.level as string) ?? this.currentConfig.level,\n retentionDays: (context.addonConfig.retentionDays as number) ?? this.currentConfig.retentionDays,\n }\n const logsDir = context.locationPaths.logs\n this.destination = new WinstonDestination()\n await this.destination.initialize({ ...this.currentConfig, logsDir })\n context.logger.info('Winston logging initialized')\n }\n\n async shutdown(): Promise<void> {\n await this.destination?.shutdown()\n }\n\n getDestination(): WinstonDestination {\n if (!this.destination) throw new Error('Winston not initialized')\n return this.destination\n }\n\n getCapabilityProvider<K extends keyof CapabilityProviderMap>(\n name: K,\n ): CapabilityProviderMap[K] | null {\n if (name === 'log-destination' && this.destination) {\n return this.destination as unknown as CapabilityProviderMap[K]\n }\n return null\n }\n\n getConfigSchema(): ConfigUISchema {\n return {\n sections: [\n {\n id: 'winston-retention',\n title: 'Log Retention',\n description: 'How long Winston keeps rotated log files on disk.',\n columns: 1,\n fields: [\n {\n type: 'number',\n key: 'retentionDays',\n label: 'Retention (days)',\n description: 'Number of days to keep rotated log files before deletion',\n min: 1,\n max: 365,\n step: 1,\n unit: 'days',\n },\n ],\n },\n ],\n }\n }\n\n getConfig(): Record<string, unknown> {\n return { ...this.currentConfig }\n }\n\n async onConfigChange(config: Record<string, unknown>): Promise<void> {\n this.currentConfig = {\n level: (config.level as string) ?? this.currentConfig.level,\n retentionDays: (config.retentionDays as number) ?? this.currentConfig.retentionDays,\n }\n }\n}\n"],"mappings":";AAAA,YAAY,aAAa;AACzB,OAAO,qBAAqB;AAC5B,YAAY,UAAU;AAUtB,SAAS,YAAY,OAAkC;AACrD,MAAI,MAAM,WAAW,EAAG,QAAO;AAC/B,QAAM,CAAC,OAAO,GAAG,IAAI,IAAI;AACzB,QAAM,gBAAgB,KAAK,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE;AACvD,SAAO,IAAI,KAAK,IAAI,aAAa;AACnC;AAEO,IAAM,qBAAN,MAAoD;AAAA,EACjD,SAAgC;AAAA,EAExC,MAAM,WAAW,QAAuC;AACtD,UAAM;AAAA,MACJ,QAAQ;AAAA,MACR,gBAAgB;AAAA,MAChB,UAAe,UAAK,iBAAiB,MAAM;AAAA,IAC7C,IAAI,UAAU,CAAC;AAEf,UAAM,gBAAwB,eAAO;AAAA,MAC3B,eAAO,UAAU,EAAE,QAAQ,sBAAsB,CAAC;AAAA,MAClD,eAAO,SAAS;AAAA,MAChB,eAAO,OAAO,CAAC,EAAE,WAAW,OAAO,KAAK,SAAS,MAAM,MAAM;AACnE,cAAM,WAAW,QAAQ,IAAI,KAAK,KAAK;AACvC,eAAO,GAAG,SAAS,KAAK,GAAG,IAAI,QAAQ,MAAM,OAAO;AAAA,MACtD,CAAC;AAAA,IACH;AAEA,UAAM,aAAqB,eAAO;AAAA,MACxB,eAAO,UAAU;AAAA,MACjB,eAAO,KAAK;AAAA,IACtB;AAEA,SAAK,SAAiB,qBAAa;AAAA,MACjC;AAAA,MACA,YAAY;AAAA,QACV,IAAY,mBAAW,QAAQ;AAAA,UAC7B,QAAQ;AAAA,QACV,CAAC;AAAA,QACD,IAAI,gBAAgB;A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