@etainabl/nodejs-sdk 1.2.9 → 1.2.11
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/cjs/reporting.js +5 -2
- package/dist/mjs/reporting.js +5 -2
- package/package.json +1 -1
- package/src/reporting.ts +8 -2
package/dist/cjs/reporting.js
CHANGED
|
@@ -23,7 +23,7 @@ const getNextRunTime = (startDate, schedule, taskTime) => {
|
|
|
23
23
|
const isSaturday = targetDate.isoWeekday() === 6;
|
|
24
24
|
// The weekday or weekend chosen should be within the same month as the target date
|
|
25
25
|
if (schedule.frequencyDay === 'weekdays' && !isWeekday) {
|
|
26
|
-
if (targetDate.date() / 7 < 2) {
|
|
26
|
+
if ((targetDate.date() / 7) < 2) {
|
|
27
27
|
targetDate.add(isSaturday ? 2 : 1, 'days');
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
@@ -31,7 +31,7 @@ const getNextRunTime = (startDate, schedule, taskTime) => {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
else if (schedule.frequencyDay === 'weekends' && isWeekday) {
|
|
34
|
-
if (targetDate.date() / 7 < 2) {
|
|
34
|
+
if ((targetDate.date() / 7) < 2) {
|
|
35
35
|
targetDate.isoWeekday(6);
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
@@ -53,6 +53,9 @@ const getScheduledReportRunTimes = (schedule, limit = 1, taskTime = (0, moment_1
|
|
|
53
53
|
if (includeStartDate) {
|
|
54
54
|
runTimes = [originalStartDate];
|
|
55
55
|
}
|
|
56
|
+
if (schedule.frequency === 'once') {
|
|
57
|
+
return runTimes;
|
|
58
|
+
}
|
|
56
59
|
const scheduleRunTimes = Array.from(Array(includeStartDate ? limit - 1 : limit).keys()).map(() => {
|
|
57
60
|
const nextRunTime = getNextRunTime(startDate, schedule, taskTime);
|
|
58
61
|
startDate = nextRunTime.hour(originalStartDate.hour()).minute(originalStartDate.minute());
|
package/dist/mjs/reporting.js
CHANGED
|
@@ -17,7 +17,7 @@ const getNextRunTime = (startDate, schedule, taskTime) => {
|
|
|
17
17
|
const isSaturday = targetDate.isoWeekday() === 6;
|
|
18
18
|
// The weekday or weekend chosen should be within the same month as the target date
|
|
19
19
|
if (schedule.frequencyDay === 'weekdays' && !isWeekday) {
|
|
20
|
-
if (targetDate.date() / 7 < 2) {
|
|
20
|
+
if ((targetDate.date() / 7) < 2) {
|
|
21
21
|
targetDate.add(isSaturday ? 2 : 1, 'days');
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
@@ -25,7 +25,7 @@ const getNextRunTime = (startDate, schedule, taskTime) => {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
else if (schedule.frequencyDay === 'weekends' && isWeekday) {
|
|
28
|
-
if (targetDate.date() / 7 < 2) {
|
|
28
|
+
if ((targetDate.date() / 7) < 2) {
|
|
29
29
|
targetDate.isoWeekday(6);
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
@@ -47,6 +47,9 @@ export const getScheduledReportRunTimes = (schedule, limit = 1, taskTime = momen
|
|
|
47
47
|
if (includeStartDate) {
|
|
48
48
|
runTimes = [originalStartDate];
|
|
49
49
|
}
|
|
50
|
+
if (schedule.frequency === 'once') {
|
|
51
|
+
return runTimes;
|
|
52
|
+
}
|
|
50
53
|
const scheduleRunTimes = Array.from(Array(includeStartDate ? limit - 1 : limit).keys()).map(() => {
|
|
51
54
|
const nextRunTime = getNextRunTime(startDate, schedule, taskTime);
|
|
52
55
|
startDate = nextRunTime.hour(originalStartDate.hour()).minute(originalStartDate.minute());
|
package/package.json
CHANGED
package/src/reporting.ts
CHANGED
|
@@ -21,13 +21,13 @@ const getNextRunTime = (startDate: moment.Moment, schedule: any, taskTime: momen
|
|
|
21
21
|
|
|
22
22
|
// The weekday or weekend chosen should be within the same month as the target date
|
|
23
23
|
if (schedule.frequencyDay === 'weekdays' && !isWeekday) {
|
|
24
|
-
if (targetDate.date() / 7 < 2) {
|
|
24
|
+
if ((targetDate.date() / 7) < 2) {
|
|
25
25
|
targetDate.add(isSaturday ? 2 : 1, 'days');
|
|
26
26
|
} else {
|
|
27
27
|
targetDate.subtract(isSaturday ? 1 : 2, 'days');
|
|
28
28
|
}
|
|
29
29
|
} else if (schedule.frequencyDay === 'weekends' && isWeekday) {
|
|
30
|
-
if (targetDate.date() / 7 < 2) {
|
|
30
|
+
if ((targetDate.date() / 7) < 2) {
|
|
31
31
|
targetDate.isoWeekday(6);
|
|
32
32
|
} else {
|
|
33
33
|
targetDate.isoWeekday(0);
|
|
@@ -55,6 +55,12 @@ export const getScheduledReportRunTimes = (schedule: any, limit = 1, taskTime =
|
|
|
55
55
|
if (includeStartDate) {
|
|
56
56
|
runTimes = [originalStartDate];
|
|
57
57
|
}
|
|
58
|
+
|
|
59
|
+
const [, freq] = schedule.frequency.split('|');
|
|
60
|
+
if (freq === 'once') {
|
|
61
|
+
return runTimes;
|
|
62
|
+
}
|
|
63
|
+
|
|
58
64
|
|
|
59
65
|
const scheduleRunTimes = Array.from(Array(includeStartDate ? limit - 1 : limit).keys()).map(() => {
|
|
60
66
|
const nextRunTime = getNextRunTime(startDate, schedule, taskTime);
|