@webtypen/webframez-core 0.3.50 → 0.3.52
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.
|
@@ -209,6 +209,7 @@ class BackupManager {
|
|
|
209
209
|
options: source.options || {},
|
|
210
210
|
backupKey: context.backupKey,
|
|
211
211
|
backupId: context.backupId,
|
|
212
|
+
log: context.log,
|
|
212
213
|
});
|
|
213
214
|
return {
|
|
214
215
|
connection: source.connection,
|
|
@@ -304,7 +305,11 @@ class BackupManager {
|
|
|
304
305
|
this.log(options, "File copy finished");
|
|
305
306
|
for (const source of normalizeArray(backupType.databases)) {
|
|
306
307
|
this.log(options, `Backing up database '${source.connection || "default"}'`);
|
|
307
|
-
result.databases.push(yield this.backupDatabase(source, contentDir, {
|
|
308
|
+
result.databases.push(yield this.backupDatabase(source, contentDir, {
|
|
309
|
+
backupKey: key,
|
|
310
|
+
backupId: id,
|
|
311
|
+
log: (message, payload) => this.log(options, message, payload),
|
|
312
|
+
}));
|
|
308
313
|
this.log(options, `Database '${source.connection || "default"}' backup finished`);
|
|
309
314
|
}
|
|
310
315
|
result.artifact = this.buildArtifact(key, backupType, workRunDir, contentDir, now, id, options);
|
|
@@ -15,6 +15,9 @@ export declare class QueueWorkerCommand extends ConsoleCommand {
|
|
|
15
15
|
jobsFailed: number;
|
|
16
16
|
lastJob: any;
|
|
17
17
|
log(message: string): void;
|
|
18
|
+
private formatAutomationCommand;
|
|
19
|
+
private formatAutomationExecution;
|
|
20
|
+
private logRegisteredAutomation;
|
|
18
21
|
handle(): Promise<void>;
|
|
19
22
|
init(): boolean;
|
|
20
23
|
canStart(): boolean;
|
|
@@ -49,6 +49,47 @@ class QueueWorkerCommand extends ConsoleCommand_1.ConsoleCommand {
|
|
|
49
49
|
.tz(this.workerConfig.timezone ? this.workerConfig.timezone : "Europe/Berlin")
|
|
50
50
|
.format("YY-MM-DD HH:mm:ss")}] ${message}`);
|
|
51
51
|
}
|
|
52
|
+
formatAutomationCommand(automation) {
|
|
53
|
+
if (automation.jobclass === "BackupRunJob" && automation.payload && automation.payload.backupKey) {
|
|
54
|
+
return `backup:run ${automation.payload.backupKey}`;
|
|
55
|
+
}
|
|
56
|
+
return automation.jobclass || "unknown";
|
|
57
|
+
}
|
|
58
|
+
formatAutomationExecution(execution) {
|
|
59
|
+
if (!Array.isArray(execution)) {
|
|
60
|
+
return "invalid execution";
|
|
61
|
+
}
|
|
62
|
+
const [type, value, options] = execution;
|
|
63
|
+
const suffix = options && options.identifier ? ` (${options.identifier})` : "";
|
|
64
|
+
if (type === "daily") {
|
|
65
|
+
return `daily at ${value}${suffix}`;
|
|
66
|
+
}
|
|
67
|
+
if (type === "every_hour") {
|
|
68
|
+
return `every hour at minute ${value !== undefined && value !== null ? value : 0}${suffix}`;
|
|
69
|
+
}
|
|
70
|
+
if (type === "every_x_mins") {
|
|
71
|
+
return `every ${value} minute(s)${suffix}`;
|
|
72
|
+
}
|
|
73
|
+
if (value !== undefined && value !== null) {
|
|
74
|
+
return `${type} at ${value}${suffix}`;
|
|
75
|
+
}
|
|
76
|
+
return `${type}${suffix}`;
|
|
77
|
+
}
|
|
78
|
+
logRegisteredAutomation() {
|
|
79
|
+
const automations = this.getWorkerAutomation();
|
|
80
|
+
if (!automations || automations.length < 1) {
|
|
81
|
+
this.log("Registered automations: none");
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
this.log("Registered automations:");
|
|
85
|
+
for (const automation of automations) {
|
|
86
|
+
const command = this.formatAutomationCommand(automation);
|
|
87
|
+
const executions = automation.executions && Array.isArray(automation.executions) && automation.executions.length > 0
|
|
88
|
+
? automation.executions.map((execution) => this.formatAutomationExecution(execution)).join(", ")
|
|
89
|
+
: "no executions";
|
|
90
|
+
this.log(`- ${command}: ${executions}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
52
93
|
handle() {
|
|
53
94
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54
95
|
const workerKey = this.getOption("worker");
|
|
@@ -80,6 +121,7 @@ class QueueWorkerCommand extends ConsoleCommand_1.ConsoleCommand {
|
|
|
80
121
|
});
|
|
81
122
|
try {
|
|
82
123
|
this.log("Queue started");
|
|
124
|
+
this.logRegisteredAutomation();
|
|
83
125
|
yield this.run();
|
|
84
126
|
}
|
|
85
127
|
catch (e) {
|
package/package.json
CHANGED