@camstack/core 0.1.26 → 0.1.27
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/backup-orchestrator/backup-orchestrator.addon.d.ts.map +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +26 -10
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js.map +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +26 -10
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backup-orchestrator.addon.d.ts","sourceRoot":"","sources":["../../../src/builtins/backup-orchestrator/backup-orchestrator.addon.ts"],"names":[],"mappings":"AA2BA,OAAO,EACL,SAAS,EAGV,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EACV,oBAAoB,EAGrB,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"backup-orchestrator.addon.d.ts","sourceRoot":"","sources":["../../../src/builtins/backup-orchestrator/backup-orchestrator.addon.ts"],"names":[],"mappings":"AA2BA,OAAO,EACL,SAAS,EAGV,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EACV,oBAAoB,EAGrB,MAAM,iBAAiB,CAAA;AA6IxB,qBAAa,uBAAwB,SAAQ,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC3E,OAAO,CAAC,YAAY,CAAmC;IACvD,OAAO,CAAC,QAAQ,CAA8C;IAC9D,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,aAAa,CAA8B;IACnD;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB,CAAa;IACvC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6B;;cAM1C,YAAY,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;cAmD/C,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ3C;;;;;;OAMG;YACW,gBAAgB;YAqBhB,oBAAoB;IAYlC;;;;;;OAMG;YACW,mBAAmB;IAwCjC,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,iBAAiB;IAmCzB;;;;OAIG;IACH,OAAO,CAAC,WAAW;IASnB;;;;;OAKG;YACW,cAAc;IA4B5B;;;;;;;OAOG;YACW,aAAa;IA4E3B;;;;;;;;;OASG;YACW,cAAc;IA+F5B;;;;;OAKG;YACW,YAAY;IAwB1B;;;;;;;;;;;OAWG;YACW,uBAAuB;IA8BrC;;;;;OAKG;YACW,eAAe;YAqBf,UAAU;YAiBV,aAAa;IA6B3B;;;;;;;;;;OAUG;YACW,eAAe;IA4C7B;;;;;;;;OAQG;YACW,cAAc;IAU5B,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,iBAAiB;IAMzB;;;;;;;;;;;;;;OAcG;YACW,cAAc;IA6C5B,OAAO,CAAC,oBAAoB;IAmB5B;;;;OAIG;IACH,OAAO,CAAC,UAAU;CAOnB;AAoED,eAAe,uBAAuB,CAAA"}
|
|
@@ -6950,6 +6950,24 @@ var DEFAULT_RETENTION_COUNT = 7;
|
|
|
6950
6950
|
var DEFAULT_CRON = "0 3 * * *";
|
|
6951
6951
|
var SCHEDULE_TICK_MS = 6e4;
|
|
6952
6952
|
/**
|
|
6953
|
+
* Build the human-facing archive label. Every archive always carries
|
|
6954
|
+
* the destination id and the creation date — useful in restore wizards
|
|
6955
|
+
* + cross-destination listings where UUIDs are unreadable.
|
|
6956
|
+
*
|
|
6957
|
+
* Format: `${destinationId} · ${YYYY-MM-DD HH:mm}[${suffix}]`. Suffix is
|
|
6958
|
+
* an optional operator-provided tag (e.g. "before-migration") appended
|
|
6959
|
+
* after another middot. UTC is intentional — labels are also written
|
|
6960
|
+
* into the per-location manifest which travels across timezones with
|
|
6961
|
+
* the backup.
|
|
6962
|
+
*/
|
|
6963
|
+
function formatArchiveLabel(destinationId, createdAt, suffix) {
|
|
6964
|
+
const d = new Date(createdAt);
|
|
6965
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
6966
|
+
const stamp = `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())} ${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}`;
|
|
6967
|
+
const trimmed = suffix?.trim();
|
|
6968
|
+
return trimmed ? `${destinationId} · ${stamp} · ${trimmed}` : `${destinationId} · ${stamp}`;
|
|
6969
|
+
}
|
|
6970
|
+
/**
|
|
6953
6971
|
* Chunk size for the read-stream that feeds the chunked upload pipe.
|
|
6954
6972
|
* 8 MiB matches Scrypted's prebuffer block size and stays well under
|
|
6955
6973
|
* the WS frame limit (16 MiB on tRPC) with headroom.
|
|
@@ -7185,6 +7203,7 @@ var BackupOrchestratorAddon = class extends _camstack_types.BaseAddon {
|
|
|
7185
7203
|
});
|
|
7186
7204
|
try {
|
|
7187
7205
|
const entries = [];
|
|
7206
|
+
const createdAt = Date.now();
|
|
7188
7207
|
for (const dest of targets) try {
|
|
7189
7208
|
const policy = policies.get(dest.id) ?? this.fallbackPolicy(dest.id);
|
|
7190
7209
|
const stored = await this.uploadAndIndex({
|
|
@@ -7195,7 +7214,8 @@ var BackupOrchestratorAddon = class extends _camstack_types.BaseAddon {
|
|
|
7195
7214
|
sizeBytes: result.sizeBytes,
|
|
7196
7215
|
archiveManifest: result.manifest,
|
|
7197
7216
|
retentionCount: policy.retentionCount,
|
|
7198
|
-
|
|
7217
|
+
createdAt,
|
|
7218
|
+
label: formatArchiveLabel(dest.id, createdAt, input?.label)
|
|
7199
7219
|
});
|
|
7200
7220
|
entries.push(stored);
|
|
7201
7221
|
this.ctx.eventBus.emit({
|
|
@@ -7262,13 +7282,12 @@ var BackupOrchestratorAddon = class extends _camstack_types.BaseAddon {
|
|
|
7262
7282
|
} catch {}
|
|
7263
7283
|
throw err;
|
|
7264
7284
|
}
|
|
7265
|
-
const createdAt = Date.now();
|
|
7266
7285
|
const entry = buildArchiveEntry({
|
|
7267
7286
|
id: input.archiveId,
|
|
7268
7287
|
filename: input.archiveFilename,
|
|
7269
|
-
createdAt,
|
|
7288
|
+
createdAt: input.createdAt,
|
|
7270
7289
|
sizeBytes: input.sizeBytes,
|
|
7271
|
-
|
|
7290
|
+
label: input.label,
|
|
7272
7291
|
manifest: input.archiveManifest
|
|
7273
7292
|
});
|
|
7274
7293
|
await this.manifestLock.run(input.locationId, async () => {
|
|
@@ -7295,9 +7314,9 @@ var BackupOrchestratorAddon = class extends _camstack_types.BaseAddon {
|
|
|
7295
7314
|
return {
|
|
7296
7315
|
id: input.archiveId,
|
|
7297
7316
|
destinationId: input.locationId,
|
|
7298
|
-
createdAt,
|
|
7317
|
+
createdAt: input.createdAt,
|
|
7299
7318
|
sizeBytes: input.sizeBytes,
|
|
7300
|
-
|
|
7319
|
+
label: input.label,
|
|
7301
7320
|
locations: [...input.archiveManifest.locations]
|
|
7302
7321
|
};
|
|
7303
7322
|
}
|
|
@@ -7540,10 +7559,7 @@ var BackupOrchestratorAddon = class extends _camstack_types.BaseAddon {
|
|
|
7540
7559
|
cron: p.cron,
|
|
7541
7560
|
dueAt: due
|
|
7542
7561
|
} });
|
|
7543
|
-
await this.triggerBackup({
|
|
7544
|
-
destinations: [p.locationId],
|
|
7545
|
-
label: `auto-${p.cron.replace(/\s+/g, "_")}`
|
|
7546
|
-
});
|
|
7562
|
+
await this.triggerBackup({ destinations: [p.locationId] });
|
|
7547
7563
|
} catch (err) {
|
|
7548
7564
|
this.ctx.logger.error("Scheduled backup failed", { meta: {
|
|
7549
7565
|
locationId: p.locationId,
|