@wabot-dev/framework 0.4.0 → 0.4.2
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.
|
@@ -26,7 +26,14 @@ class Entity extends Storable {
|
|
|
26
26
|
return this.createdAt;
|
|
27
27
|
}
|
|
28
28
|
update(newData) {
|
|
29
|
-
|
|
29
|
+
const protectedFields = ['id', 'createdAt', 'discardedAt'];
|
|
30
|
+
const filteredData = Object.entries(newData).reduce((acc, [key, value]) => {
|
|
31
|
+
if (value !== undefined && !protectedFields.includes(key)) {
|
|
32
|
+
acc[key] = value;
|
|
33
|
+
}
|
|
34
|
+
return acc;
|
|
35
|
+
}, {});
|
|
36
|
+
this.data = { ...this.data, ...filteredData, updatedAt: new Date().getTime() };
|
|
30
37
|
}
|
|
31
38
|
wasCreated() {
|
|
32
39
|
return !!this.data.createdAt || !!this.data.id;
|
|
@@ -24,13 +24,13 @@ class Job extends Entity {
|
|
|
24
24
|
return (now - this.data.startedAt) / 1000;
|
|
25
25
|
}
|
|
26
26
|
get successAt() {
|
|
27
|
-
return this.data.successAt != null ? new Date(this.data.successAt) :
|
|
27
|
+
return this.data.successAt != null ? new Date(this.data.successAt) : undefined;
|
|
28
28
|
}
|
|
29
29
|
get failedAt() {
|
|
30
|
-
return this.data.failedAt != null ? new Date(this.data.failedAt) :
|
|
30
|
+
return this.data.failedAt != null ? new Date(this.data.failedAt) : undefined;
|
|
31
31
|
}
|
|
32
32
|
get scheduledAt() {
|
|
33
|
-
return this.data.scheduledAt != null ? new Date(this.data.scheduledAt) :
|
|
33
|
+
return this.data.scheduledAt != null ? new Date(this.data.scheduledAt) : undefined;
|
|
34
34
|
}
|
|
35
35
|
get intentNumber() {
|
|
36
36
|
return this.data.intentNumber ?? 0;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -434,9 +434,9 @@ declare class Job extends Entity<IJobData> {
|
|
|
434
434
|
get aceptableRunningTimeSeconds(): number | undefined;
|
|
435
435
|
get stuckRetryAttempts(): number | undefined;
|
|
436
436
|
get runningSeconds(): number;
|
|
437
|
-
get successAt(): Date |
|
|
438
|
-
get failedAt(): Date |
|
|
439
|
-
get scheduledAt(): Date |
|
|
437
|
+
get successAt(): Date | undefined;
|
|
438
|
+
get failedAt(): Date | undefined;
|
|
439
|
+
get scheduledAt(): Date | undefined;
|
|
440
440
|
get intentNumber(): number;
|
|
441
441
|
wasSuccess(): boolean;
|
|
442
442
|
wasFailed(): boolean;
|