@camstack/system 1.2.444 → 1.2.445
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/addon-runner.js +40 -31
- package/dist/addon-runner.mjs +41 -32
- package/dist/{agent-https-DlpTMDqA.js → agent-https-CiOW0-sj.js} +810 -12
- package/dist/{agent-https-U0d4uvn2.mjs → agent-https-D4Q8iFNd.mjs} +697 -13
- package/dist/auth/admin-token-manager.d.ts +9 -3
- package/dist/auth/api-key-manager.d.ts +9 -3
- package/dist/auth/auth-audit-log.d.ts +9 -3
- package/dist/auth/device-credential-manager.d.ts +5 -1
- package/dist/auth/external-identity-manager.d.ts +8 -21
- package/dist/auth/login-session-manager.d.ts +11 -3
- package/dist/auth/scoped-token-manager.d.ts +8 -52
- package/dist/auth/totp-manager.d.ts +11 -3
- package/dist/auth/user-manager.d.ts +10 -17
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alert-store.d.ts +32 -0
- package/dist/builtins/alerts/alerts.addon.d.ts +9 -2
- package/dist/builtins/alerts/alerts.addon.js +289 -150
- package/dist/builtins/alerts/alerts.addon.mjs +288 -150
- package/dist/builtins/alerts/record-kinds.d.ts +15 -0
- package/dist/builtins/autotrack/index.js +1 -1
- package/dist/builtins/autotrack/index.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +1 -0
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +134 -193
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +134 -193
- package/dist/builtins/backup-orchestrator/destination-policy.d.ts +4 -2
- package/dist/builtins/backup-orchestrator/encryption-key-store.d.ts +4 -2
- package/dist/builtins/backup-orchestrator/record-kinds.d.ts +58 -0
- package/dist/builtins/backup-orchestrator/schedule-store.d.ts +4 -2
- package/dist/builtins/backup-orchestrator/seed-marker-store.d.ts +4 -2
- package/dist/builtins/calendars/calendar-prefs-store.d.ts +13 -5
- package/dist/builtins/calendars/calendars.addon.d.ts +2 -2
- package/dist/builtins/calendars/calendars.addon.js +67 -64
- package/dist/builtins/calendars/calendars.addon.mjs +59 -64
- package/dist/builtins/calendars/record-kinds.d.ts +18 -0
- package/dist/builtins/camera-grid/index.js +1 -1
- package/dist/builtins/camera-grid/index.mjs +1 -1
- package/dist/builtins/cluster-agent/record-kinds.d.ts +36 -0
- package/dist/builtins/composer/composer.addon.js +2 -2
- package/dist/builtins/composer/composer.addon.mjs +2 -2
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/block-settings-store.d.ts +8 -4
- package/dist/builtins/core-blocks/core-block-store.d.ts +8 -16
- package/dist/builtins/core-blocks/core-blocks.addon.js +85 -112
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +86 -113
- package/dist/builtins/core-blocks/index.mjs +1 -1
- package/dist/builtins/core-blocks/record-kinds.d.ts +26 -0
- package/dist/builtins/device-manager/device-manager.addon.js +111 -187
- package/dist/builtins/device-manager/device-manager.addon.mjs +110 -187
- package/dist/builtins/device-manager/device-tombstone-store.d.ts +9 -48
- package/dist/builtins/device-manager/record-kinds.d.ts +14 -0
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/keychain/index.js +152 -22
- package/dist/builtins/keychain/index.mjs +152 -22
- package/dist/builtins/keychain/keychain-service.d.ts +3 -2
- package/dist/builtins/keychain/keychain-store.d.ts +13 -2
- package/dist/builtins/keychain/record-kinds.d.ts +16 -0
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/auth-schema.d.ts +3 -1
- package/dist/builtins/local-auth/local-auth.addon.js +2903 -2123
- package/dist/builtins/local-auth/local-auth.addon.mjs +2904 -2124
- package/dist/builtins/local-auth/oauth-session-manager.d.ts +8 -48
- package/dist/builtins/local-auth/record-kinds.d.ts +141 -0
- package/dist/builtins/local-network/local-network.addon.js +2 -2
- package/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/record-entries/index.js +1 -1
- package/dist/builtins/record-entries/index.mjs +1 -1
- package/dist/builtins/records/legacy-table-row-count.d.ts +5 -0
- package/dist/builtins/records/phase6-declare-gate.d.ts +28 -0
- package/dist/builtins/records-isolated.d.ts +10 -0
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/index.js +1 -1
- package/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/integration-record-kinds.d.ts +30 -0
- package/dist/builtins/sqlite-storage/integration-registry.d.ts +10 -16
- package/dist/builtins/sqlite-storage/records/count-settings-array-legacy.d.ts +5 -0
- package/dist/builtins/sqlite-storage/records/count-settings-brokers-legacy.d.ts +6 -0
- package/dist/builtins/sqlite-storage/records/records-engine-types.d.ts +5 -0
- package/dist/builtins/sqlite-storage/records/records-engine.d.ts +4 -0
- package/dist/builtins/sqlite-storage/records/records-provider.d.ts +5 -1
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +17 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +111 -3
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +111 -3
- package/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +9 -1
- package/dist/builtins/storage-orchestrator/drain-state-store.d.ts +5 -2
- package/dist/builtins/storage-orchestrator/location-store.d.ts +7 -2
- package/dist/builtins/storage-orchestrator/record-kinds.d.ts +38 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +2 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +196 -5
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +195 -6
- package/dist/builtins/system-config/record-kinds.d.ts +32 -0
- package/dist/builtins/system-config/system-config.addon.js +53 -618
- package/dist/builtins/system-config/system-config.addon.mjs +29 -577
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{composition-sources-C3rKncIF.mjs → composition-sources-BMt5cFYb.mjs} +1 -1
- package/dist/{composition-sources-NAPZddic.js → composition-sources-D3fi9Xns.js} +1 -1
- package/dist/{constants-BKX2QnIg.mjs → constants-BMHCxRzb.mjs} +1 -1
- package/dist/{constants-BXiNEIeV.js → constants-Br879Axi.js} +1 -1
- package/dist/{device-ca-DT9X2S6d.js → device-ca-CnJ_va7i.js} +1 -1
- package/dist/{device-ca-jxjSL8Ov.mjs → device-ca-T8osSMos.mjs} +1 -1
- package/dist/{dist-DERK-gP5.mjs → dist-BNunRyXT.mjs} +174 -58
- package/dist/{dist-D1vECb_6.js → dist-DgOG8flk.js} +233 -57
- package/dist/file-host-worker.js +1 -1
- package/dist/file-host-worker.mjs +1 -1
- package/dist/{hub-mdns-ciao-Cah9GCIg.js → hub-mdns-ciao-BIkTHq-n.js} +2 -2
- package/dist/{hub-mdns-ciao-CRaC97V0.mjs → hub-mdns-ciao-D16oRQ9K.mjs} +2 -2
- package/dist/index.d.ts +7 -0
- package/dist/index.js +3093 -2820
- package/dist/index.mjs +3065 -2809
- package/dist/kernel/index.d.ts +2 -0
- package/dist/kernel/moleculer/event-bus.d.ts +3 -1
- package/dist/kernel/moleculer/mesh-mtls/mesh-certificate-registry.d.ts +5 -1
- package/dist/kernel/moleculer/remote-logger.d.ts +2 -2
- package/dist/kernel/transport/cap-route-resolver.d.ts +9 -38
- package/dist/phase6-declare-gate-Ci1-8uUn.js +98 -0
- package/dist/phase6-declare-gate-tkKOEitw.mjs +93 -0
- package/dist/read-all-rows-CVoO1ONM.js +29 -0
- package/dist/read-all-rows-TaPqdWNF.mjs +25 -0
- package/dist/records/read-all-rows.d.ts +6 -0
- package/dist/{restore-archive-daKyE24F.mjs → restore-archive-DR9MtO7J.mjs} +339 -9
- package/dist/{restore-archive-Dy-qKTdF.js → restore-archive-DjJnCgap.js} +353 -5
- package/dist/tls/agent-https-names.d.ts +9 -13
- package/dist/{wal-maintenance-dAv4IdzC.js → wal-maintenance-CODGqhKY.js} +0 -0
- package/dist/{wal-maintenance-zRc24mOC.mjs → wal-maintenance-CfvgtQ7C.mjs} +0 -0
- package/package.json +1 -1
|
@@ -3,7 +3,8 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-DgOG8flk.js");
|
|
7
|
+
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
7
8
|
let zod = require("zod");
|
|
8
9
|
let node_crypto = require("node:crypto");
|
|
9
10
|
let _camstack_types_node = require("@camstack/types/node");
|
|
@@ -11,6 +12,67 @@ let node_fs_promises = require("node:fs/promises");
|
|
|
11
12
|
node_fs_promises = require_chunk.__toESM(node_fs_promises);
|
|
12
13
|
let node_path = require("node:path");
|
|
13
14
|
node_path = require_chunk.__toESM(node_path);
|
|
15
|
+
//#region src/builtins/storage-orchestrator/record-kinds.ts
|
|
16
|
+
var import_read_all_rows = require_read_all_rows$1.require_read_all_rows();
|
|
17
|
+
/**
|
|
18
|
+
* Record kinds owned by storage-orchestrator (phase 4 — hub-main).
|
|
19
|
+
*/
|
|
20
|
+
var STORAGE_DRAIN_STATE_LEGACY = "storage_drain_state";
|
|
21
|
+
var StorageLocationBodySchema = zod.z.object({
|
|
22
|
+
type: require_dist.StorageLocationTypeSchema,
|
|
23
|
+
displayName: zod.z.string(),
|
|
24
|
+
providerId: zod.z.string(),
|
|
25
|
+
config: zod.z.record(zod.z.string(), zod.z.unknown()),
|
|
26
|
+
isSystem: zod.z.boolean(),
|
|
27
|
+
createdAt: zod.z.number(),
|
|
28
|
+
updatedAt: zod.z.number(),
|
|
29
|
+
nodeId: zod.z.string().optional(),
|
|
30
|
+
enabled: zod.z.boolean().optional(),
|
|
31
|
+
mode: require_dist.StorageLocationModeSchema.optional(),
|
|
32
|
+
isDefault: zod.z.boolean().optional()
|
|
33
|
+
});
|
|
34
|
+
var StorageDrainStateBodySchema = zod.z.object({
|
|
35
|
+
locationId: zod.z.string(),
|
|
36
|
+
startedAtMs: zod.z.number(),
|
|
37
|
+
startBytes: zod.z.number(),
|
|
38
|
+
capBytes: zod.z.number(),
|
|
39
|
+
lastPeerBytes: zod.z.number().nullable(),
|
|
40
|
+
lastSweepMs: zod.z.number(),
|
|
41
|
+
observedGrowthBytes: zod.z.number(),
|
|
42
|
+
observedElapsedMs: zod.z.number()
|
|
43
|
+
});
|
|
44
|
+
var _storageOrchestratorRecordKinds = require_dist.defineRecordKinds({
|
|
45
|
+
locations: {
|
|
46
|
+
schema: StorageLocationBodySchema,
|
|
47
|
+
class: "config",
|
|
48
|
+
writeTrigger: "operator create/edit/delete; boot reconcile seeds defaults and backfills in-memory locations",
|
|
49
|
+
device: "none",
|
|
50
|
+
at: "none",
|
|
51
|
+
indexes: [{
|
|
52
|
+
name: "type",
|
|
53
|
+
fields: ["type"]
|
|
54
|
+
}],
|
|
55
|
+
retention: { none: "operator delete or declaration prune only" },
|
|
56
|
+
adoptsFrom: STORAGE_LOCATIONS
|
|
57
|
+
},
|
|
58
|
+
"drain-state": {
|
|
59
|
+
schema: StorageDrainStateBodySchema,
|
|
60
|
+
class: "config",
|
|
61
|
+
writeTrigger: "pressure sweep while a location is in drain mode",
|
|
62
|
+
device: "none",
|
|
63
|
+
at: "none",
|
|
64
|
+
indexes: [{
|
|
65
|
+
name: "location_id",
|
|
66
|
+
fields: ["locationId"]
|
|
67
|
+
}],
|
|
68
|
+
retention: { none: "row deleted when location leaves drain" },
|
|
69
|
+
adoptsFrom: STORAGE_DRAIN_STATE_LEGACY
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
var storageOrchestratorRecordKinds = _storageOrchestratorRecordKinds;
|
|
73
|
+
_storageOrchestratorRecordKinds.locations;
|
|
74
|
+
_storageOrchestratorRecordKinds["drain-state"];
|
|
75
|
+
//#endregion
|
|
14
76
|
//#region src/builtins/storage-orchestrator/location-store.ts
|
|
15
77
|
/**
|
|
16
78
|
* @durable class=config owner=storage-orchestrator
|
|
@@ -125,8 +187,13 @@ var STORAGE_LOCATIONS_INDEXES = [{
|
|
|
125
187
|
var SqliteLocationStore = class {
|
|
126
188
|
store;
|
|
127
189
|
declared = false;
|
|
128
|
-
|
|
190
|
+
locationsKind;
|
|
191
|
+
constructor(store, locationsKind = null) {
|
|
129
192
|
this.store = store;
|
|
193
|
+
this.locationsKind = locationsKind;
|
|
194
|
+
}
|
|
195
|
+
static recordStoresOf(records) {
|
|
196
|
+
return records.kind(storageOrchestratorRecordKinds.locations);
|
|
130
197
|
}
|
|
131
198
|
/**
|
|
132
199
|
* Lazy `declareCollection` — keeps the constructor cheap and async-free.
|
|
@@ -134,6 +201,7 @@ var SqliteLocationStore = class {
|
|
|
134
201
|
* (and additive on shape changes), so repeated calls collapse to a no-op.
|
|
135
202
|
*/
|
|
136
203
|
async ensureDeclared() {
|
|
204
|
+
if (this.locationsKind !== null) return;
|
|
137
205
|
if (this.declared) return;
|
|
138
206
|
await this.store.declareCollection({
|
|
139
207
|
collection: STORAGE_LOCATIONS,
|
|
@@ -144,6 +212,17 @@ var SqliteLocationStore = class {
|
|
|
144
212
|
}
|
|
145
213
|
async loadAll() {
|
|
146
214
|
await this.ensureDeclared();
|
|
215
|
+
const kind = this.locationsKind;
|
|
216
|
+
if (kind !== null) {
|
|
217
|
+
const rows = await (0, import_read_all_rows.readAllRows)(kind);
|
|
218
|
+
rows.sort((a, b) => a.data.createdAt - b.data.createdAt);
|
|
219
|
+
const out = [];
|
|
220
|
+
for (const row of rows) {
|
|
221
|
+
const mapped = bodyToPersistedLocation(row.id, row.data);
|
|
222
|
+
if (mapped) out.push(mapped);
|
|
223
|
+
}
|
|
224
|
+
return out;
|
|
225
|
+
}
|
|
147
226
|
const rows = await this.store.query({
|
|
148
227
|
collection: STORAGE_LOCATIONS,
|
|
149
228
|
filter: { orderBy: {
|
|
@@ -166,6 +245,16 @@ var SqliteLocationStore = class {
|
|
|
166
245
|
*/
|
|
167
246
|
async upsert(loc) {
|
|
168
247
|
await this.ensureDeclared();
|
|
248
|
+
const kind = this.locationsKind;
|
|
249
|
+
if (kind !== null) {
|
|
250
|
+
const body = locationToBody(loc);
|
|
251
|
+
const data = storageOrchestratorRecordKinds.locations.schema.parse(body);
|
|
252
|
+
await kind.put({
|
|
253
|
+
id: loc.id,
|
|
254
|
+
data
|
|
255
|
+
});
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
169
258
|
await this.store.deleteWhere({
|
|
170
259
|
collection: STORAGE_LOCATIONS,
|
|
171
260
|
filter: { where: { id: loc.id } }
|
|
@@ -180,12 +269,49 @@ var SqliteLocationStore = class {
|
|
|
180
269
|
}
|
|
181
270
|
async delete(id) {
|
|
182
271
|
await this.ensureDeclared();
|
|
272
|
+
const kind = this.locationsKind;
|
|
273
|
+
if (kind !== null) {
|
|
274
|
+
await kind.delete(id);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
183
277
|
await this.store.deleteWhere({
|
|
184
278
|
collection: STORAGE_LOCATIONS,
|
|
185
279
|
filter: { where: { id } }
|
|
186
280
|
});
|
|
187
281
|
}
|
|
188
282
|
};
|
|
283
|
+
function locationToBody(loc) {
|
|
284
|
+
return {
|
|
285
|
+
type: loc.type,
|
|
286
|
+
displayName: loc.displayName,
|
|
287
|
+
providerId: loc.providerId,
|
|
288
|
+
config: { ...loc.config },
|
|
289
|
+
isSystem: loc.isSystem,
|
|
290
|
+
createdAt: loc.createdAt,
|
|
291
|
+
updatedAt: loc.updatedAt,
|
|
292
|
+
...loc.nodeId !== void 0 ? { nodeId: loc.nodeId } : {},
|
|
293
|
+
...loc.enabled !== void 0 ? { enabled: loc.enabled } : {},
|
|
294
|
+
...loc.mode !== void 0 ? { mode: loc.mode } : {}
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
function bodyToPersistedLocation(id, body) {
|
|
298
|
+
const parsedType = require_dist.StorageLocationTypeSchema.safeParse(body.type);
|
|
299
|
+
if (!parsedType.success || id.length === 0) return null;
|
|
300
|
+
return {
|
|
301
|
+
id,
|
|
302
|
+
type: parsedType.data,
|
|
303
|
+
displayName: body.displayName,
|
|
304
|
+
providerId: body.providerId,
|
|
305
|
+
config: { ...body.config },
|
|
306
|
+
...body.nodeId !== void 0 ? { nodeId: body.nodeId } : {},
|
|
307
|
+
...body.enabled !== void 0 ? { enabled: body.enabled } : {},
|
|
308
|
+
...body.mode !== void 0 ? { mode: body.mode } : {},
|
|
309
|
+
...require_dist.LegacyStorageLocationDefaultSchema.parse({ isDefault: body.isDefault ?? false }),
|
|
310
|
+
isSystem: body.isSystem,
|
|
311
|
+
createdAt: body.createdAt,
|
|
312
|
+
updatedAt: body.updatedAt
|
|
313
|
+
};
|
|
314
|
+
}
|
|
189
315
|
function isPlainObject(value) {
|
|
190
316
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
191
317
|
}
|
|
@@ -1333,14 +1459,45 @@ function mapState(state) {
|
|
|
1333
1459
|
observed_elapsed_ms: state.observedElapsedMs
|
|
1334
1460
|
};
|
|
1335
1461
|
}
|
|
1462
|
+
function drainStateToBody(state) {
|
|
1463
|
+
return {
|
|
1464
|
+
locationId: state.locationId,
|
|
1465
|
+
startedAtMs: state.startedAtMs,
|
|
1466
|
+
startBytes: state.startBytes,
|
|
1467
|
+
capBytes: state.capBytes,
|
|
1468
|
+
lastPeerBytes: state.lastPeerBytes,
|
|
1469
|
+
lastSweepMs: state.lastSweepMs,
|
|
1470
|
+
observedGrowthBytes: state.observedGrowthBytes,
|
|
1471
|
+
observedElapsedMs: state.observedElapsedMs
|
|
1472
|
+
};
|
|
1473
|
+
}
|
|
1474
|
+
function bodyToDrainState(body) {
|
|
1475
|
+
if (!body.locationId) return null;
|
|
1476
|
+
return {
|
|
1477
|
+
locationId: body.locationId,
|
|
1478
|
+
startedAtMs: body.startedAtMs,
|
|
1479
|
+
startBytes: body.startBytes,
|
|
1480
|
+
capBytes: body.capBytes,
|
|
1481
|
+
lastPeerBytes: body.lastPeerBytes,
|
|
1482
|
+
lastSweepMs: body.lastSweepMs,
|
|
1483
|
+
observedGrowthBytes: body.observedGrowthBytes,
|
|
1484
|
+
observedElapsedMs: body.observedElapsedMs
|
|
1485
|
+
};
|
|
1486
|
+
}
|
|
1336
1487
|
/** {@link DrainStateStore} on the `settings-store` collection surface. */
|
|
1337
1488
|
var SqliteDrainStateStore = class {
|
|
1338
1489
|
store;
|
|
1339
1490
|
declared = false;
|
|
1340
|
-
|
|
1491
|
+
drainKind;
|
|
1492
|
+
constructor(store, drainKind = null) {
|
|
1341
1493
|
this.store = store;
|
|
1494
|
+
this.drainKind = drainKind;
|
|
1495
|
+
}
|
|
1496
|
+
static recordStoresOf(records) {
|
|
1497
|
+
return records.kind(storageOrchestratorRecordKinds["drain-state"]);
|
|
1342
1498
|
}
|
|
1343
1499
|
async ensureDeclared() {
|
|
1500
|
+
if (this.drainKind !== null) return;
|
|
1344
1501
|
if (this.declared) return;
|
|
1345
1502
|
await this.store.declareCollection({
|
|
1346
1503
|
collection: STORAGE_DRAIN_STATE,
|
|
@@ -1350,6 +1507,15 @@ var SqliteDrainStateStore = class {
|
|
|
1350
1507
|
}
|
|
1351
1508
|
async load() {
|
|
1352
1509
|
await this.ensureDeclared();
|
|
1510
|
+
const kind = this.drainKind;
|
|
1511
|
+
if (kind !== null) {
|
|
1512
|
+
const out = [];
|
|
1513
|
+
for (const row of await (0, import_read_all_rows.readAllRows)(kind)) {
|
|
1514
|
+
const mapped = bodyToDrainState(row.data);
|
|
1515
|
+
if (mapped) out.push(mapped);
|
|
1516
|
+
}
|
|
1517
|
+
return out;
|
|
1518
|
+
}
|
|
1353
1519
|
const rows = await this.store.query({ collection: STORAGE_DRAIN_STATE });
|
|
1354
1520
|
const out = [];
|
|
1355
1521
|
for (const row of rows) {
|
|
@@ -1360,6 +1526,16 @@ var SqliteDrainStateStore = class {
|
|
|
1360
1526
|
}
|
|
1361
1527
|
async save(state) {
|
|
1362
1528
|
await this.ensureDeclared();
|
|
1529
|
+
const kind = this.drainKind;
|
|
1530
|
+
if (kind !== null) {
|
|
1531
|
+
const body = drainStateToBody(state);
|
|
1532
|
+
const data = storageOrchestratorRecordKinds["drain-state"].schema.parse(body);
|
|
1533
|
+
await kind.put({
|
|
1534
|
+
id: state.locationId,
|
|
1535
|
+
data
|
|
1536
|
+
});
|
|
1537
|
+
return;
|
|
1538
|
+
}
|
|
1363
1539
|
await this.store.deleteWhere({
|
|
1364
1540
|
collection: STORAGE_DRAIN_STATE,
|
|
1365
1541
|
filter: { where: { location_id: state.locationId } }
|
|
@@ -1374,6 +1550,11 @@ var SqliteDrainStateStore = class {
|
|
|
1374
1550
|
}
|
|
1375
1551
|
async clear(locationId) {
|
|
1376
1552
|
await this.ensureDeclared();
|
|
1553
|
+
const kind = this.drainKind;
|
|
1554
|
+
if (kind !== null) {
|
|
1555
|
+
await kind.delete(locationId);
|
|
1556
|
+
return;
|
|
1557
|
+
}
|
|
1377
1558
|
await this.store.deleteWhere({
|
|
1378
1559
|
collection: STORAGE_DRAIN_STATE,
|
|
1379
1560
|
filter: { where: { location_id: locationId } }
|
|
@@ -3522,6 +3703,8 @@ var PRESSURE_SWEEP_INTERVAL_MS = 6e4;
|
|
|
3522
3703
|
*/
|
|
3523
3704
|
var CAP_PROVIDER_REGISTERED_CATEGORY = "capability:provider-registered";
|
|
3524
3705
|
var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
3706
|
+
locationsKind = null;
|
|
3707
|
+
drainStateKind = null;
|
|
3525
3708
|
service = null;
|
|
3526
3709
|
pressureManager = null;
|
|
3527
3710
|
locationBandMonitor = new StorageLocationBandMonitor();
|
|
@@ -3578,6 +3761,12 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
3578
3761
|
super({});
|
|
3579
3762
|
}
|
|
3580
3763
|
async onInitialize() {
|
|
3764
|
+
const records = require_dist.normalizeNodeId(this.ctx.kernel.localNodeId) === HUB_NODE_ID ? this.ctx.records : void 0;
|
|
3765
|
+
if (records !== void 0) {
|
|
3766
|
+
await records.declare(storageOrchestratorRecordKinds);
|
|
3767
|
+
this.locationsKind = SqliteLocationStore.recordStoresOf(records);
|
|
3768
|
+
this.drainStateKind = SqliteDrainStateStore.recordStoresOf(records);
|
|
3769
|
+
}
|
|
3581
3770
|
const getProviders = () => {
|
|
3582
3771
|
const reg = this.ctx.kernel.capabilityRegistry;
|
|
3583
3772
|
if (!reg) return [];
|
|
@@ -3990,7 +4179,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
3990
4179
|
else this.ctx.logger.info("storage-orchestrator: this node boots no data-store engine — storage locations are seeded from addon declarations at every boot, and node-pinned locations live on the hub");
|
|
3991
4180
|
return null;
|
|
3992
4181
|
}
|
|
3993
|
-
return new SqliteLocationStore(engine);
|
|
4182
|
+
return new SqliteLocationStore(engine, this.locationsKind);
|
|
3994
4183
|
}
|
|
3995
4184
|
/**
|
|
3996
4185
|
* Late-wire the persistence store once a `data-store-provider` engine
|
|
@@ -4132,7 +4321,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
4132
4321
|
if (this.drainStore) return this.drainStore;
|
|
4133
4322
|
const engine = this.ctx.kernel.capabilityRegistry?.getCollection(DATA_STORE_PROVIDER_CAP_NAME)[0];
|
|
4134
4323
|
if (!engine) return null;
|
|
4135
|
-
this.drainStore = new SqliteDrainStateStore(engine);
|
|
4324
|
+
this.drainStore = new SqliteDrainStateStore(engine, this.drainStateKind);
|
|
4136
4325
|
return this.drainStore;
|
|
4137
4326
|
}
|
|
4138
4327
|
drainPlanRefusalLogged = false;
|
|
@@ -4595,6 +4784,7 @@ function parseOrphanStatus(raw) {
|
|
|
4595
4784
|
//#endregion
|
|
4596
4785
|
exports.HUB_CAP_FWD_ACTION = HUB_CAP_FWD_ACTION;
|
|
4597
4786
|
exports.HUB_CAP_FWD_SERVICE = HUB_CAP_FWD_SERVICE;
|
|
4787
|
+
exports.STORAGE_DRAIN_STATE_LEGACY = STORAGE_DRAIN_STATE_LEGACY;
|
|
4598
4788
|
exports.SqliteLocationStore = SqliteLocationStore;
|
|
4599
4789
|
exports.StorageMigrationCoordinator = StorageMigrationCoordinator;
|
|
4600
4790
|
exports.StorageOrchestratorAddon = StorageOrchestratorAddon;
|
|
@@ -4602,4 +4792,5 @@ exports.default = StorageOrchestratorAddon;
|
|
|
4602
4792
|
exports.StorageOrchestratorService = StorageOrchestratorService;
|
|
4603
4793
|
exports.buildStorageLocationRegistry = buildStorageLocationRegistry;
|
|
4604
4794
|
exports.createHubCapForwardService = createHubCapForwardService;
|
|
4795
|
+
exports.storageOrchestratorRecordKinds = storageOrchestratorRecordKinds;
|
|
4605
4796
|
exports.stripForwardedCaller = stripForwardedCaller;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { $i as
|
|
1
|
+
import { $i as resolveSecretMarkers, Di as defineRecordKinds, Gi as parseJsonObject, Li as isSecretMarker, On as modeMayWrite, Rr as BaseAddon, Tn as mayWriteToLocation, U as LegacyStorageLocationDefaultSchema, Ui as normalizeNodeId, Xt as evictionPolicyOfLocation, Yn as resolveLocationMode, _n as legacyModeOf, at as StorageLocationTypeSchema, cr as storageCapability, ei as REDACTED_SECRET, in as gbToBytes, it as StorageLocationModeSchema, la as EventCategory, lr as storageMigrationCapability, nr as settingsStoreCapability, oa as transformSecretWrite, ot as StorageMigrationJobSchema, rt as StorageCleanupJobSchema, ta as secretTreeFromPaths, un as isLocationEnabled, wn as mayReadLocation, xr as withLocationMode, yi as collectSecretConfigKeys } from "../../dist-BNunRyXT.mjs";
|
|
2
|
+
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
import { randomUUID } from "node:crypto";
|
|
4
5
|
import { containsOrEquals, physicalRootOf } from "@camstack/types/node";
|
|
@@ -6,6 +7,67 @@ import * as fs from "node:fs/promises";
|
|
|
6
7
|
import { opendir, readdir } from "node:fs/promises";
|
|
7
8
|
import * as path$1 from "node:path";
|
|
8
9
|
import path from "node:path";
|
|
10
|
+
//#region src/builtins/storage-orchestrator/record-kinds.ts
|
|
11
|
+
var import_read_all_rows = require_read_all_rows();
|
|
12
|
+
/**
|
|
13
|
+
* Record kinds owned by storage-orchestrator (phase 4 — hub-main).
|
|
14
|
+
*/
|
|
15
|
+
var STORAGE_DRAIN_STATE_LEGACY = "storage_drain_state";
|
|
16
|
+
var StorageLocationBodySchema = z.object({
|
|
17
|
+
type: StorageLocationTypeSchema,
|
|
18
|
+
displayName: z.string(),
|
|
19
|
+
providerId: z.string(),
|
|
20
|
+
config: z.record(z.string(), z.unknown()),
|
|
21
|
+
isSystem: z.boolean(),
|
|
22
|
+
createdAt: z.number(),
|
|
23
|
+
updatedAt: z.number(),
|
|
24
|
+
nodeId: z.string().optional(),
|
|
25
|
+
enabled: z.boolean().optional(),
|
|
26
|
+
mode: StorageLocationModeSchema.optional(),
|
|
27
|
+
isDefault: z.boolean().optional()
|
|
28
|
+
});
|
|
29
|
+
var StorageDrainStateBodySchema = z.object({
|
|
30
|
+
locationId: z.string(),
|
|
31
|
+
startedAtMs: z.number(),
|
|
32
|
+
startBytes: z.number(),
|
|
33
|
+
capBytes: z.number(),
|
|
34
|
+
lastPeerBytes: z.number().nullable(),
|
|
35
|
+
lastSweepMs: z.number(),
|
|
36
|
+
observedGrowthBytes: z.number(),
|
|
37
|
+
observedElapsedMs: z.number()
|
|
38
|
+
});
|
|
39
|
+
var _storageOrchestratorRecordKinds = defineRecordKinds({
|
|
40
|
+
locations: {
|
|
41
|
+
schema: StorageLocationBodySchema,
|
|
42
|
+
class: "config",
|
|
43
|
+
writeTrigger: "operator create/edit/delete; boot reconcile seeds defaults and backfills in-memory locations",
|
|
44
|
+
device: "none",
|
|
45
|
+
at: "none",
|
|
46
|
+
indexes: [{
|
|
47
|
+
name: "type",
|
|
48
|
+
fields: ["type"]
|
|
49
|
+
}],
|
|
50
|
+
retention: { none: "operator delete or declaration prune only" },
|
|
51
|
+
adoptsFrom: STORAGE_LOCATIONS
|
|
52
|
+
},
|
|
53
|
+
"drain-state": {
|
|
54
|
+
schema: StorageDrainStateBodySchema,
|
|
55
|
+
class: "config",
|
|
56
|
+
writeTrigger: "pressure sweep while a location is in drain mode",
|
|
57
|
+
device: "none",
|
|
58
|
+
at: "none",
|
|
59
|
+
indexes: [{
|
|
60
|
+
name: "location_id",
|
|
61
|
+
fields: ["locationId"]
|
|
62
|
+
}],
|
|
63
|
+
retention: { none: "row deleted when location leaves drain" },
|
|
64
|
+
adoptsFrom: STORAGE_DRAIN_STATE_LEGACY
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
var storageOrchestratorRecordKinds = _storageOrchestratorRecordKinds;
|
|
68
|
+
_storageOrchestratorRecordKinds.locations;
|
|
69
|
+
_storageOrchestratorRecordKinds["drain-state"];
|
|
70
|
+
//#endregion
|
|
9
71
|
//#region src/builtins/storage-orchestrator/location-store.ts
|
|
10
72
|
/**
|
|
11
73
|
* @durable class=config owner=storage-orchestrator
|
|
@@ -120,8 +182,13 @@ var STORAGE_LOCATIONS_INDEXES = [{
|
|
|
120
182
|
var SqliteLocationStore = class {
|
|
121
183
|
store;
|
|
122
184
|
declared = false;
|
|
123
|
-
|
|
185
|
+
locationsKind;
|
|
186
|
+
constructor(store, locationsKind = null) {
|
|
124
187
|
this.store = store;
|
|
188
|
+
this.locationsKind = locationsKind;
|
|
189
|
+
}
|
|
190
|
+
static recordStoresOf(records) {
|
|
191
|
+
return records.kind(storageOrchestratorRecordKinds.locations);
|
|
125
192
|
}
|
|
126
193
|
/**
|
|
127
194
|
* Lazy `declareCollection` — keeps the constructor cheap and async-free.
|
|
@@ -129,6 +196,7 @@ var SqliteLocationStore = class {
|
|
|
129
196
|
* (and additive on shape changes), so repeated calls collapse to a no-op.
|
|
130
197
|
*/
|
|
131
198
|
async ensureDeclared() {
|
|
199
|
+
if (this.locationsKind !== null) return;
|
|
132
200
|
if (this.declared) return;
|
|
133
201
|
await this.store.declareCollection({
|
|
134
202
|
collection: STORAGE_LOCATIONS,
|
|
@@ -139,6 +207,17 @@ var SqliteLocationStore = class {
|
|
|
139
207
|
}
|
|
140
208
|
async loadAll() {
|
|
141
209
|
await this.ensureDeclared();
|
|
210
|
+
const kind = this.locationsKind;
|
|
211
|
+
if (kind !== null) {
|
|
212
|
+
const rows = await (0, import_read_all_rows.readAllRows)(kind);
|
|
213
|
+
rows.sort((a, b) => a.data.createdAt - b.data.createdAt);
|
|
214
|
+
const out = [];
|
|
215
|
+
for (const row of rows) {
|
|
216
|
+
const mapped = bodyToPersistedLocation(row.id, row.data);
|
|
217
|
+
if (mapped) out.push(mapped);
|
|
218
|
+
}
|
|
219
|
+
return out;
|
|
220
|
+
}
|
|
142
221
|
const rows = await this.store.query({
|
|
143
222
|
collection: STORAGE_LOCATIONS,
|
|
144
223
|
filter: { orderBy: {
|
|
@@ -161,6 +240,16 @@ var SqliteLocationStore = class {
|
|
|
161
240
|
*/
|
|
162
241
|
async upsert(loc) {
|
|
163
242
|
await this.ensureDeclared();
|
|
243
|
+
const kind = this.locationsKind;
|
|
244
|
+
if (kind !== null) {
|
|
245
|
+
const body = locationToBody(loc);
|
|
246
|
+
const data = storageOrchestratorRecordKinds.locations.schema.parse(body);
|
|
247
|
+
await kind.put({
|
|
248
|
+
id: loc.id,
|
|
249
|
+
data
|
|
250
|
+
});
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
164
253
|
await this.store.deleteWhere({
|
|
165
254
|
collection: STORAGE_LOCATIONS,
|
|
166
255
|
filter: { where: { id: loc.id } }
|
|
@@ -175,12 +264,49 @@ var SqliteLocationStore = class {
|
|
|
175
264
|
}
|
|
176
265
|
async delete(id) {
|
|
177
266
|
await this.ensureDeclared();
|
|
267
|
+
const kind = this.locationsKind;
|
|
268
|
+
if (kind !== null) {
|
|
269
|
+
await kind.delete(id);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
178
272
|
await this.store.deleteWhere({
|
|
179
273
|
collection: STORAGE_LOCATIONS,
|
|
180
274
|
filter: { where: { id } }
|
|
181
275
|
});
|
|
182
276
|
}
|
|
183
277
|
};
|
|
278
|
+
function locationToBody(loc) {
|
|
279
|
+
return {
|
|
280
|
+
type: loc.type,
|
|
281
|
+
displayName: loc.displayName,
|
|
282
|
+
providerId: loc.providerId,
|
|
283
|
+
config: { ...loc.config },
|
|
284
|
+
isSystem: loc.isSystem,
|
|
285
|
+
createdAt: loc.createdAt,
|
|
286
|
+
updatedAt: loc.updatedAt,
|
|
287
|
+
...loc.nodeId !== void 0 ? { nodeId: loc.nodeId } : {},
|
|
288
|
+
...loc.enabled !== void 0 ? { enabled: loc.enabled } : {},
|
|
289
|
+
...loc.mode !== void 0 ? { mode: loc.mode } : {}
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
function bodyToPersistedLocation(id, body) {
|
|
293
|
+
const parsedType = StorageLocationTypeSchema.safeParse(body.type);
|
|
294
|
+
if (!parsedType.success || id.length === 0) return null;
|
|
295
|
+
return {
|
|
296
|
+
id,
|
|
297
|
+
type: parsedType.data,
|
|
298
|
+
displayName: body.displayName,
|
|
299
|
+
providerId: body.providerId,
|
|
300
|
+
config: { ...body.config },
|
|
301
|
+
...body.nodeId !== void 0 ? { nodeId: body.nodeId } : {},
|
|
302
|
+
...body.enabled !== void 0 ? { enabled: body.enabled } : {},
|
|
303
|
+
...body.mode !== void 0 ? { mode: body.mode } : {},
|
|
304
|
+
...LegacyStorageLocationDefaultSchema.parse({ isDefault: body.isDefault ?? false }),
|
|
305
|
+
isSystem: body.isSystem,
|
|
306
|
+
createdAt: body.createdAt,
|
|
307
|
+
updatedAt: body.updatedAt
|
|
308
|
+
};
|
|
309
|
+
}
|
|
184
310
|
function isPlainObject(value) {
|
|
185
311
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
186
312
|
}
|
|
@@ -1328,14 +1454,45 @@ function mapState(state) {
|
|
|
1328
1454
|
observed_elapsed_ms: state.observedElapsedMs
|
|
1329
1455
|
};
|
|
1330
1456
|
}
|
|
1457
|
+
function drainStateToBody(state) {
|
|
1458
|
+
return {
|
|
1459
|
+
locationId: state.locationId,
|
|
1460
|
+
startedAtMs: state.startedAtMs,
|
|
1461
|
+
startBytes: state.startBytes,
|
|
1462
|
+
capBytes: state.capBytes,
|
|
1463
|
+
lastPeerBytes: state.lastPeerBytes,
|
|
1464
|
+
lastSweepMs: state.lastSweepMs,
|
|
1465
|
+
observedGrowthBytes: state.observedGrowthBytes,
|
|
1466
|
+
observedElapsedMs: state.observedElapsedMs
|
|
1467
|
+
};
|
|
1468
|
+
}
|
|
1469
|
+
function bodyToDrainState(body) {
|
|
1470
|
+
if (!body.locationId) return null;
|
|
1471
|
+
return {
|
|
1472
|
+
locationId: body.locationId,
|
|
1473
|
+
startedAtMs: body.startedAtMs,
|
|
1474
|
+
startBytes: body.startBytes,
|
|
1475
|
+
capBytes: body.capBytes,
|
|
1476
|
+
lastPeerBytes: body.lastPeerBytes,
|
|
1477
|
+
lastSweepMs: body.lastSweepMs,
|
|
1478
|
+
observedGrowthBytes: body.observedGrowthBytes,
|
|
1479
|
+
observedElapsedMs: body.observedElapsedMs
|
|
1480
|
+
};
|
|
1481
|
+
}
|
|
1331
1482
|
/** {@link DrainStateStore} on the `settings-store` collection surface. */
|
|
1332
1483
|
var SqliteDrainStateStore = class {
|
|
1333
1484
|
store;
|
|
1334
1485
|
declared = false;
|
|
1335
|
-
|
|
1486
|
+
drainKind;
|
|
1487
|
+
constructor(store, drainKind = null) {
|
|
1336
1488
|
this.store = store;
|
|
1489
|
+
this.drainKind = drainKind;
|
|
1490
|
+
}
|
|
1491
|
+
static recordStoresOf(records) {
|
|
1492
|
+
return records.kind(storageOrchestratorRecordKinds["drain-state"]);
|
|
1337
1493
|
}
|
|
1338
1494
|
async ensureDeclared() {
|
|
1495
|
+
if (this.drainKind !== null) return;
|
|
1339
1496
|
if (this.declared) return;
|
|
1340
1497
|
await this.store.declareCollection({
|
|
1341
1498
|
collection: STORAGE_DRAIN_STATE,
|
|
@@ -1345,6 +1502,15 @@ var SqliteDrainStateStore = class {
|
|
|
1345
1502
|
}
|
|
1346
1503
|
async load() {
|
|
1347
1504
|
await this.ensureDeclared();
|
|
1505
|
+
const kind = this.drainKind;
|
|
1506
|
+
if (kind !== null) {
|
|
1507
|
+
const out = [];
|
|
1508
|
+
for (const row of await (0, import_read_all_rows.readAllRows)(kind)) {
|
|
1509
|
+
const mapped = bodyToDrainState(row.data);
|
|
1510
|
+
if (mapped) out.push(mapped);
|
|
1511
|
+
}
|
|
1512
|
+
return out;
|
|
1513
|
+
}
|
|
1348
1514
|
const rows = await this.store.query({ collection: STORAGE_DRAIN_STATE });
|
|
1349
1515
|
const out = [];
|
|
1350
1516
|
for (const row of rows) {
|
|
@@ -1355,6 +1521,16 @@ var SqliteDrainStateStore = class {
|
|
|
1355
1521
|
}
|
|
1356
1522
|
async save(state) {
|
|
1357
1523
|
await this.ensureDeclared();
|
|
1524
|
+
const kind = this.drainKind;
|
|
1525
|
+
if (kind !== null) {
|
|
1526
|
+
const body = drainStateToBody(state);
|
|
1527
|
+
const data = storageOrchestratorRecordKinds["drain-state"].schema.parse(body);
|
|
1528
|
+
await kind.put({
|
|
1529
|
+
id: state.locationId,
|
|
1530
|
+
data
|
|
1531
|
+
});
|
|
1532
|
+
return;
|
|
1533
|
+
}
|
|
1358
1534
|
await this.store.deleteWhere({
|
|
1359
1535
|
collection: STORAGE_DRAIN_STATE,
|
|
1360
1536
|
filter: { where: { location_id: state.locationId } }
|
|
@@ -1369,6 +1545,11 @@ var SqliteDrainStateStore = class {
|
|
|
1369
1545
|
}
|
|
1370
1546
|
async clear(locationId) {
|
|
1371
1547
|
await this.ensureDeclared();
|
|
1548
|
+
const kind = this.drainKind;
|
|
1549
|
+
if (kind !== null) {
|
|
1550
|
+
await kind.delete(locationId);
|
|
1551
|
+
return;
|
|
1552
|
+
}
|
|
1372
1553
|
await this.store.deleteWhere({
|
|
1373
1554
|
collection: STORAGE_DRAIN_STATE,
|
|
1374
1555
|
filter: { where: { location_id: locationId } }
|
|
@@ -3517,6 +3698,8 @@ var PRESSURE_SWEEP_INTERVAL_MS = 6e4;
|
|
|
3517
3698
|
*/
|
|
3518
3699
|
var CAP_PROVIDER_REGISTERED_CATEGORY = "capability:provider-registered";
|
|
3519
3700
|
var StorageOrchestratorAddon = class extends BaseAddon {
|
|
3701
|
+
locationsKind = null;
|
|
3702
|
+
drainStateKind = null;
|
|
3520
3703
|
service = null;
|
|
3521
3704
|
pressureManager = null;
|
|
3522
3705
|
locationBandMonitor = new StorageLocationBandMonitor();
|
|
@@ -3573,6 +3756,12 @@ var StorageOrchestratorAddon = class extends BaseAddon {
|
|
|
3573
3756
|
super({});
|
|
3574
3757
|
}
|
|
3575
3758
|
async onInitialize() {
|
|
3759
|
+
const records = normalizeNodeId(this.ctx.kernel.localNodeId) === HUB_NODE_ID ? this.ctx.records : void 0;
|
|
3760
|
+
if (records !== void 0) {
|
|
3761
|
+
await records.declare(storageOrchestratorRecordKinds);
|
|
3762
|
+
this.locationsKind = SqliteLocationStore.recordStoresOf(records);
|
|
3763
|
+
this.drainStateKind = SqliteDrainStateStore.recordStoresOf(records);
|
|
3764
|
+
}
|
|
3576
3765
|
const getProviders = () => {
|
|
3577
3766
|
const reg = this.ctx.kernel.capabilityRegistry;
|
|
3578
3767
|
if (!reg) return [];
|
|
@@ -3985,7 +4174,7 @@ var StorageOrchestratorAddon = class extends BaseAddon {
|
|
|
3985
4174
|
else this.ctx.logger.info("storage-orchestrator: this node boots no data-store engine — storage locations are seeded from addon declarations at every boot, and node-pinned locations live on the hub");
|
|
3986
4175
|
return null;
|
|
3987
4176
|
}
|
|
3988
|
-
return new SqliteLocationStore(engine);
|
|
4177
|
+
return new SqliteLocationStore(engine, this.locationsKind);
|
|
3989
4178
|
}
|
|
3990
4179
|
/**
|
|
3991
4180
|
* Late-wire the persistence store once a `data-store-provider` engine
|
|
@@ -4127,7 +4316,7 @@ var StorageOrchestratorAddon = class extends BaseAddon {
|
|
|
4127
4316
|
if (this.drainStore) return this.drainStore;
|
|
4128
4317
|
const engine = this.ctx.kernel.capabilityRegistry?.getCollection(DATA_STORE_PROVIDER_CAP_NAME)[0];
|
|
4129
4318
|
if (!engine) return null;
|
|
4130
|
-
this.drainStore = new SqliteDrainStateStore(engine);
|
|
4319
|
+
this.drainStore = new SqliteDrainStateStore(engine, this.drainStateKind);
|
|
4131
4320
|
return this.drainStore;
|
|
4132
4321
|
}
|
|
4133
4322
|
drainPlanRefusalLogged = false;
|
|
@@ -4588,4 +4777,4 @@ function parseOrphanStatus(raw) {
|
|
|
4588
4777
|
};
|
|
4589
4778
|
}
|
|
4590
4779
|
//#endregion
|
|
4591
|
-
export { StorageOrchestratorAddon, StorageOrchestratorAddon as default, stripForwardedCaller as a, SqliteLocationStore as c, createHubCapForwardService as i, HUB_CAP_FWD_ACTION as n, buildStorageLocationRegistry as o, HUB_CAP_FWD_SERVICE as r, StorageMigrationCoordinator as s, StorageOrchestratorService as t };
|
|
4780
|
+
export { StorageOrchestratorAddon, StorageOrchestratorAddon as default, stripForwardedCaller as a, SqliteLocationStore as c, createHubCapForwardService as i, STORAGE_DRAIN_STATE_LEGACY as l, HUB_CAP_FWD_ACTION as n, buildStorageLocationRegistry as o, HUB_CAP_FWD_SERVICE as r, StorageMigrationCoordinator as s, StorageOrchestratorService as t, storageOrchestratorRecordKinds as u };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Record kinds owned by `system-config` (phase 6 / §2.8 mesh + agent HTTPS names).
|
|
3
|
+
*
|
|
4
|
+
* Mesh admission keeps a RAM mirror (D857); records hold the durable copy.
|
|
5
|
+
* OPERATOR-ONLY legacy drop after verify.
|
|
6
|
+
*/
|
|
7
|
+
import { type DefinedRecordKind } from "@camstack/types";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
export type MeshNodeCertificateBody = {
|
|
10
|
+
readonly nodeId: string;
|
|
11
|
+
readonly serial: string;
|
|
12
|
+
readonly fingerprint: string;
|
|
13
|
+
readonly notBefore: number;
|
|
14
|
+
readonly notAfter: number;
|
|
15
|
+
readonly issuedAt: number;
|
|
16
|
+
readonly issuedVia: string;
|
|
17
|
+
readonly revokedAt?: number | null;
|
|
18
|
+
readonly revokedReason?: string | null;
|
|
19
|
+
};
|
|
20
|
+
export declare const MeshNodeCertificateBodySchema: z.ZodType<MeshNodeCertificateBody>;
|
|
21
|
+
export type AgentHttpsNameBody = {
|
|
22
|
+
readonly names: readonly string[];
|
|
23
|
+
readonly issuedAt: number;
|
|
24
|
+
};
|
|
25
|
+
export declare const AgentHttpsNameBodySchema: z.ZodType<AgentHttpsNameBody>;
|
|
26
|
+
export type SystemConfigRecordKindsMap = {
|
|
27
|
+
readonly "mesh-node-certificates": DefinedRecordKind<z.ZodType<MeshNodeCertificateBody>>;
|
|
28
|
+
readonly "agent-https-names": DefinedRecordKind<z.ZodType<AgentHttpsNameBody>>;
|
|
29
|
+
};
|
|
30
|
+
export declare const systemConfigRecordKinds: SystemConfigRecordKindsMap;
|
|
31
|
+
export declare const meshNodeCertificatesRecordKind: DefinedRecordKind<z.ZodType<MeshNodeCertificateBody>>;
|
|
32
|
+
export declare const agentHttpsNamesRecordKind: DefinedRecordKind<z.ZodType<AgentHttpsNameBody>>;
|