@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
|
@@ -6939,6 +6939,24 @@ var DEFAULT_RETENTION_COUNT = 7;
|
|
|
6939
6939
|
var DEFAULT_CRON = "0 3 * * *";
|
|
6940
6940
|
var SCHEDULE_TICK_MS = 6e4;
|
|
6941
6941
|
/**
|
|
6942
|
+
* Build the human-facing archive label. Every archive always carries
|
|
6943
|
+
* the destination id and the creation date — useful in restore wizards
|
|
6944
|
+
* + cross-destination listings where UUIDs are unreadable.
|
|
6945
|
+
*
|
|
6946
|
+
* Format: `${destinationId} · ${YYYY-MM-DD HH:mm}[${suffix}]`. Suffix is
|
|
6947
|
+
* an optional operator-provided tag (e.g. "before-migration") appended
|
|
6948
|
+
* after another middot. UTC is intentional — labels are also written
|
|
6949
|
+
* into the per-location manifest which travels across timezones with
|
|
6950
|
+
* the backup.
|
|
6951
|
+
*/
|
|
6952
|
+
function formatArchiveLabel(destinationId, createdAt, suffix) {
|
|
6953
|
+
const d = new Date(createdAt);
|
|
6954
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
6955
|
+
const stamp = `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())} ${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}`;
|
|
6956
|
+
const trimmed = suffix?.trim();
|
|
6957
|
+
return trimmed ? `${destinationId} · ${stamp} · ${trimmed}` : `${destinationId} · ${stamp}`;
|
|
6958
|
+
}
|
|
6959
|
+
/**
|
|
6942
6960
|
* Chunk size for the read-stream that feeds the chunked upload pipe.
|
|
6943
6961
|
* 8 MiB matches Scrypted's prebuffer block size and stays well under
|
|
6944
6962
|
* the WS frame limit (16 MiB on tRPC) with headroom.
|
|
@@ -7174,6 +7192,7 @@ var BackupOrchestratorAddon = class extends BaseAddon {
|
|
|
7174
7192
|
});
|
|
7175
7193
|
try {
|
|
7176
7194
|
const entries = [];
|
|
7195
|
+
const createdAt = Date.now();
|
|
7177
7196
|
for (const dest of targets) try {
|
|
7178
7197
|
const policy = policies.get(dest.id) ?? this.fallbackPolicy(dest.id);
|
|
7179
7198
|
const stored = await this.uploadAndIndex({
|
|
@@ -7184,7 +7203,8 @@ var BackupOrchestratorAddon = class extends BaseAddon {
|
|
|
7184
7203
|
sizeBytes: result.sizeBytes,
|
|
7185
7204
|
archiveManifest: result.manifest,
|
|
7186
7205
|
retentionCount: policy.retentionCount,
|
|
7187
|
-
|
|
7206
|
+
createdAt,
|
|
7207
|
+
label: formatArchiveLabel(dest.id, createdAt, input?.label)
|
|
7188
7208
|
});
|
|
7189
7209
|
entries.push(stored);
|
|
7190
7210
|
this.ctx.eventBus.emit({
|
|
@@ -7251,13 +7271,12 @@ var BackupOrchestratorAddon = class extends BaseAddon {
|
|
|
7251
7271
|
} catch {}
|
|
7252
7272
|
throw err;
|
|
7253
7273
|
}
|
|
7254
|
-
const createdAt = Date.now();
|
|
7255
7274
|
const entry = buildArchiveEntry({
|
|
7256
7275
|
id: input.archiveId,
|
|
7257
7276
|
filename: input.archiveFilename,
|
|
7258
|
-
createdAt,
|
|
7277
|
+
createdAt: input.createdAt,
|
|
7259
7278
|
sizeBytes: input.sizeBytes,
|
|
7260
|
-
|
|
7279
|
+
label: input.label,
|
|
7261
7280
|
manifest: input.archiveManifest
|
|
7262
7281
|
});
|
|
7263
7282
|
await this.manifestLock.run(input.locationId, async () => {
|
|
@@ -7284,9 +7303,9 @@ var BackupOrchestratorAddon = class extends BaseAddon {
|
|
|
7284
7303
|
return {
|
|
7285
7304
|
id: input.archiveId,
|
|
7286
7305
|
destinationId: input.locationId,
|
|
7287
|
-
createdAt,
|
|
7306
|
+
createdAt: input.createdAt,
|
|
7288
7307
|
sizeBytes: input.sizeBytes,
|
|
7289
|
-
|
|
7308
|
+
label: input.label,
|
|
7290
7309
|
locations: [...input.archiveManifest.locations]
|
|
7291
7310
|
};
|
|
7292
7311
|
}
|
|
@@ -7529,10 +7548,7 @@ var BackupOrchestratorAddon = class extends BaseAddon {
|
|
|
7529
7548
|
cron: p.cron,
|
|
7530
7549
|
dueAt: due
|
|
7531
7550
|
} });
|
|
7532
|
-
await this.triggerBackup({
|
|
7533
|
-
destinations: [p.locationId],
|
|
7534
|
-
label: `auto-${p.cron.replace(/\s+/g, "_")}`
|
|
7535
|
-
});
|
|
7551
|
+
await this.triggerBackup({ destinations: [p.locationId] });
|
|
7536
7552
|
} catch (err) {
|
|
7537
7553
|
this.ctx.logger.error("Scheduled backup failed", { meta: {
|
|
7538
7554
|
locationId: p.locationId,
|