@atlantjs/arch 14.0.4 → 15.1.0
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/@tool-box/utils/validators/is-schedule.d.ts +1 -1
- package/@tool-box/utils/validators/is-schedule.js +2 -2
- package/index.d.ts +2 -3
- package/index.js +5 -8
- package/objects/{schedule/schedule.edge.d.ts → scheduling/scheduling.edge.d.ts} +34 -83
- package/objects/{schedule/schedule.edge.failure.d.ts → scheduling/scheduling.edge.failure.d.ts} +1 -1
- package/objects/{schedule/schedule.edge.failure.js → scheduling/scheduling.edge.failure.js} +4 -4
- package/objects/{schedule/schedule.edge.js → scheduling/scheduling.edge.js} +94 -139
- package/objects/time/time.edge.d.ts +2 -0
- package/objects/time/time.edge.js +21 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/objects/@common/edges/cron-expression.edge.d.ts +0 -34
- package/objects/@common/edges/cron-expression.edge.js +0 -96
|
@@ -5,6 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.TimeEdge = void 0;
|
|
7
7
|
const moment_1 = __importDefault(require("moment"));
|
|
8
|
+
const guardian_1 = require("../../@tool-box/utils/type-guard/guardian");
|
|
9
|
+
const scheduling_edge_1 = require("../scheduling/scheduling.edge");
|
|
8
10
|
class TimeEdge {
|
|
9
11
|
constructor(value) {
|
|
10
12
|
this.value = value;
|
|
@@ -41,6 +43,25 @@ class TimeEdge {
|
|
|
41
43
|
toTotalMinutes() {
|
|
42
44
|
return this.getHours() * 60 + this.getMinutes();
|
|
43
45
|
}
|
|
46
|
+
fromScheduling(date) {
|
|
47
|
+
let scheduledFor;
|
|
48
|
+
if (guardian_1._.isNotUndefined(date)) {
|
|
49
|
+
const minute = date.getMinutes();
|
|
50
|
+
const hour = date.getHours();
|
|
51
|
+
const day = date.getDate();
|
|
52
|
+
const month = date.getMonth() + 1;
|
|
53
|
+
const dayOfWeek = date.getDay();
|
|
54
|
+
const cron = `${minute} ${hour} ${day} ${month} ${dayOfWeek}`;
|
|
55
|
+
scheduledFor = new scheduling_edge_1.SchedulingEdge(cron);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const minute = this.getMinutes();
|
|
59
|
+
const hour = this.getHours();
|
|
60
|
+
const cron = `${minute} ${hour} * * *`;
|
|
61
|
+
scheduledFor = new scheduling_edge_1.SchedulingEdge(cron);
|
|
62
|
+
}
|
|
63
|
+
return scheduledFor;
|
|
64
|
+
}
|
|
44
65
|
/**
|
|
45
66
|
* Retorna o tempo total convertido em segundos.
|
|
46
67
|
* @returns Total de segundos representados pelo tempo
|