@lighthouse/common 6.9.2 → 6.10.0-canary.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/dist/scheduling/helpers/generateRepeatingSchedule.js +37 -1
- package/dist/scheduling/helpers/generateScheduleEnd.js +13 -1
- package/dist/scheduling/strategies/getNext.js +25 -0
- package/dist/scheduling/strategies/getNextWeekday.js +31 -0
- package/lib/scheduling/helpers/generateRepeatingSchedule.js +59 -21
- package/lib/scheduling/helpers/generateRepeatingSchedule.js.map +1 -1
- package/lib/scheduling/helpers/generateScheduleEnd.js +13 -1
- package/lib/scheduling/helpers/generateScheduleEnd.js.map +1 -1
- package/lib/scheduling/strategies/getNext.js +31 -4
- package/lib/scheduling/strategies/getNext.js.map +1 -1
- package/lib/scheduling/strategies/getNextWeekday.js +33 -1
- package/lib/scheduling/strategies/getNextWeekday.js.map +1 -1
- package/package.json +1 -1
- package/debug-storybook.log +0 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.complyingServiceIntervalUnits = void 0;
|
|
7
8
|
exports.generateRepeatingSchedule = generateRepeatingSchedule;
|
|
8
9
|
var _fp = require("lodash/fp");
|
|
10
|
+
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
9
11
|
var _ = require(".");
|
|
10
12
|
var _scheduling = require("../scheduling.types");
|
|
11
13
|
var _generators = require("../generators");
|
|
@@ -47,7 +49,17 @@ function* generateRepeatingSchedule(props) {
|
|
|
47
49
|
end,
|
|
48
50
|
start
|
|
49
51
|
});
|
|
50
|
-
|
|
52
|
+
console.log('[generateRepeatingSchedule] INIT:', {
|
|
53
|
+
start: _momentTimezone.default.tz(start, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
54
|
+
end: _momentTimezone.default.tz(end, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
55
|
+
isStartAndEndValid,
|
|
56
|
+
frequencyUnit,
|
|
57
|
+
timezone
|
|
58
|
+
});
|
|
59
|
+
if (!isStartAndEndValid) {
|
|
60
|
+
console.log('[generateRepeatingSchedule] INVALID START/END - RETURNING EARLY');
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
51
63
|
const serviceIntervalSequence = (0, _generators.serviceIntervalsGenerator)({
|
|
52
64
|
end,
|
|
53
65
|
serviceHours,
|
|
@@ -58,7 +70,20 @@ function* generateRepeatingSchedule(props) {
|
|
|
58
70
|
// all service intervals otherwise service interval is from the start and end
|
|
59
71
|
const complyToServiceHours = (0, _fp.includes)(frequencyUnit, complyingServiceIntervalUnits);
|
|
60
72
|
const serviceIntervals = complyToServiceHours ? [...serviceIntervalSequence] : [[start, end]];
|
|
73
|
+
console.log('[generateRepeatingSchedule] SERVICE_INTERVALS:', {
|
|
74
|
+
count: serviceIntervals.length,
|
|
75
|
+
complyToServiceHours,
|
|
76
|
+
intervals: serviceIntervals.slice(0, 3).map(interval => ({
|
|
77
|
+
start: _momentTimezone.default.tz(interval[0], timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
78
|
+
end: _momentTimezone.default.tz(interval[1], timezone).format('YYYY-MM-DD HH:mm:ss Z')
|
|
79
|
+
}))
|
|
80
|
+
});
|
|
81
|
+
let serviceIntervalIndex = 0;
|
|
61
82
|
for (const serviceInterval of serviceIntervals) {
|
|
83
|
+
console.log(`[generateRepeatingSchedule] PROCESSING_SERVICE_INTERVAL[${serviceIntervalIndex}]:`, {
|
|
84
|
+
start: _momentTimezone.default.tz(serviceInterval[0], timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
85
|
+
end: _momentTimezone.default.tz(serviceInterval[1], timezone).format('YYYY-MM-DD HH:mm:ss Z')
|
|
86
|
+
});
|
|
62
87
|
yield {
|
|
63
88
|
interval: serviceInterval,
|
|
64
89
|
type: _scheduling.IntervalTypes.Service
|
|
@@ -69,16 +94,27 @@ function* generateRepeatingSchedule(props) {
|
|
|
69
94
|
strategy,
|
|
70
95
|
timezone
|
|
71
96
|
});
|
|
97
|
+
let occurrenceCount = 0;
|
|
72
98
|
for (const occurrenceInterval of occurrenceIntervalsSequence) {
|
|
99
|
+
console.log(`[generateRepeatingSchedule] OCCURRENCE[${occurrenceCount}]:`, {
|
|
100
|
+
start: _momentTimezone.default.tz(occurrenceInterval[0], timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
101
|
+
end: _momentTimezone.default.tz(occurrenceInterval[1], timezone).format('YYYY-MM-DD HH:mm:ss Z')
|
|
102
|
+
});
|
|
73
103
|
yield {
|
|
74
104
|
interval: occurrenceInterval,
|
|
75
105
|
type: _scheduling.IntervalTypes.Occurrence
|
|
76
106
|
};
|
|
107
|
+
occurrenceCount++;
|
|
77
108
|
}
|
|
109
|
+
console.log(`[generateRepeatingSchedule] SERVICE_INTERVAL[${serviceIntervalIndex}] COMPLETED:`, {
|
|
110
|
+
occurrenceCount
|
|
111
|
+
});
|
|
78
112
|
|
|
79
113
|
// NOTE: we must reset isInitial to true following the first service
|
|
80
114
|
// interval otherwise the occurrence will not start exactly on the next
|
|
81
115
|
// service interval start time
|
|
82
116
|
isInitial = true;
|
|
117
|
+
serviceIntervalIndex++;
|
|
83
118
|
}
|
|
119
|
+
console.log('[generateRepeatingSchedule] COMPLETE');
|
|
84
120
|
}
|
|
@@ -26,6 +26,18 @@ function generateScheduleEnd({
|
|
|
26
26
|
// NOTE: if frequency unit less than a week we must set end to jump a week
|
|
27
27
|
// plus the interval length of the schedule frequency
|
|
28
28
|
// so that we can ensure that we are within a service interval
|
|
29
|
-
|
|
29
|
+
// MODIFIED FOR TESTING: Changed from 2 weeks to 1 hour for testing endless generation bug
|
|
30
|
+
const end = isFrequencyLessThanWeek ? mStart.add(1, _scheduling.Unit.Hour).valueOf() : mStart.add(frequencyValue * 2, frequencyUnit).valueOf();
|
|
31
|
+
console.log('[generateScheduleEnd] START:', {
|
|
32
|
+
start: _momentTimezone.default.tz(start, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
33
|
+
frequency: `${frequencyValue}${frequencyUnit}`,
|
|
34
|
+
isFrequencyLessThanWeek,
|
|
35
|
+
timezone
|
|
36
|
+
});
|
|
37
|
+
console.log('[generateScheduleEnd] END CALCULATED:', {
|
|
38
|
+
end: _momentTimezone.default.tz(end, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
39
|
+
endTimestamp: end,
|
|
40
|
+
durationFromStart: `${(0, _momentTimezone.default)(end).diff((0, _momentTimezone.default)(start), 'hours')} hours`
|
|
41
|
+
});
|
|
30
42
|
return end;
|
|
31
43
|
}
|
|
@@ -32,6 +32,16 @@ function* getNext({
|
|
|
32
32
|
} = frequency;
|
|
33
33
|
let initial = isInitial;
|
|
34
34
|
let dateCursor = initial ? _momentTimezone.default.tz(start, timezone).valueOf() : _momentTimezone.default.tz(start, timezone).add(1, _scheduling.Unit.Millisecond).valueOf();
|
|
35
|
+
console.log('[getNext] START:', {
|
|
36
|
+
strategy: type,
|
|
37
|
+
start: _momentTimezone.default.tz(start, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
38
|
+
end: _momentTimezone.default.tz(end, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
39
|
+
dateCursor: _momentTimezone.default.tz(dateCursor, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
40
|
+
isInitial,
|
|
41
|
+
frequency: `${frequencyValue}${frequencyUnit}`,
|
|
42
|
+
duration: `${durationValue}${durationUnit}`
|
|
43
|
+
});
|
|
44
|
+
let occurrenceCount = 0;
|
|
35
45
|
while (dateCursor < end) {
|
|
36
46
|
let nextOccurrenceStart;
|
|
37
47
|
let nextOccurrenceEnd;
|
|
@@ -49,12 +59,27 @@ function* getNext({
|
|
|
49
59
|
nextOccurrenceStart = _momentTimezone.default.max(earliestNextOccurrenceStart, nextOccurrenceStartByBackCalculation).valueOf();
|
|
50
60
|
}
|
|
51
61
|
if (nextOccurrenceEnd <= nextOccurrenceStart || nextOccurrenceEnd > end) {
|
|
62
|
+
console.log('[getNext] BOUNDARY CHECK FAILED:', {
|
|
63
|
+
occurrenceCount,
|
|
64
|
+
nextOccurrenceStart: _momentTimezone.default.tz(nextOccurrenceStart, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
65
|
+
nextOccurrenceEnd: _momentTimezone.default.tz(nextOccurrenceEnd, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
66
|
+
end: _momentTimezone.default.tz(end, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
67
|
+
condition: `(${nextOccurrenceEnd} <= ${nextOccurrenceStart}) || (${nextOccurrenceEnd} > ${end})`
|
|
68
|
+
});
|
|
52
69
|
return;
|
|
53
70
|
}
|
|
54
71
|
if (nextOccurrenceStart >= start) {
|
|
55
72
|
const nextOccurrence = [nextOccurrenceStart, nextOccurrenceEnd - 1];
|
|
73
|
+
console.log(`[getNext] OCCURRENCE[${occurrenceCount}]:`, {
|
|
74
|
+
start: _momentTimezone.default.tz(nextOccurrenceStart, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
75
|
+
end: _momentTimezone.default.tz(nextOccurrenceEnd - 1, timezone).format('YYYY-MM-DD HH:mm:ss Z')
|
|
76
|
+
});
|
|
56
77
|
yield nextOccurrence;
|
|
78
|
+
occurrenceCount++;
|
|
57
79
|
}
|
|
58
80
|
dateCursor = nextOccurrenceEnd;
|
|
59
81
|
}
|
|
82
|
+
console.log('[getNext] COMPLETE:', {
|
|
83
|
+
occurrenceCount
|
|
84
|
+
});
|
|
60
85
|
}
|
|
@@ -32,20 +32,51 @@ function* getNextWeekday({
|
|
|
32
32
|
} = frequency;
|
|
33
33
|
let initial = isInitial;
|
|
34
34
|
let dateCursor = initial ? _momentTimezone.default.tz(start, timezone).startOf(_scheduling.Unit.Week).valueOf() : _momentTimezone.default.tz(start, timezone).add(frequencyValue, frequencyUnit).startOf(_scheduling.Unit.Week).valueOf();
|
|
35
|
+
console.log('[getNextWeekday] START:', {
|
|
36
|
+
start: _momentTimezone.default.tz(start, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
37
|
+
end: _momentTimezone.default.tz(end, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
38
|
+
dateCursor: _momentTimezone.default.tz(dateCursor, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
39
|
+
isInitial,
|
|
40
|
+
frequency: `${frequencyValue}${frequencyUnit}`,
|
|
41
|
+
duration: `${durationValue}${durationUnit}`,
|
|
42
|
+
weekdays
|
|
43
|
+
});
|
|
44
|
+
let occurrenceCount = 0;
|
|
45
|
+
let weekIteration = 0;
|
|
35
46
|
while (dateCursor < end) {
|
|
47
|
+
console.log(`[getNextWeekday] WEEK_ITERATION[${weekIteration}]:`, {
|
|
48
|
+
dateCursor: _momentTimezone.default.tz(dateCursor, timezone).format('YYYY-MM-DD')
|
|
49
|
+
});
|
|
36
50
|
for (const weekday of weekdays) {
|
|
37
51
|
const nextOccurrenceEnd = _momentTimezone.default.tz(dateCursor, timezone).isoWeekday(weekday).add(1, _scheduling.Unit.Day).startOf(_scheduling.Unit.Day).valueOf();
|
|
38
52
|
const nextOccurrenceStart = _momentTimezone.default.tz(nextOccurrenceEnd, timezone).subtract(durationValue, durationUnit).valueOf();
|
|
39
53
|
if (nextOccurrenceEnd <= nextOccurrenceStart || nextOccurrenceEnd > end) {
|
|
54
|
+
console.log('[getNextWeekday] BOUNDARY CHECK FAILED:', {
|
|
55
|
+
occurrenceCount,
|
|
56
|
+
weekday,
|
|
57
|
+
nextOccurrenceStart: _momentTimezone.default.tz(nextOccurrenceStart, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
58
|
+
nextOccurrenceEnd: _momentTimezone.default.tz(nextOccurrenceEnd, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
59
|
+
end: _momentTimezone.default.tz(end, timezone).format('YYYY-MM-DD HH:mm:ss Z')
|
|
60
|
+
});
|
|
40
61
|
return;
|
|
41
62
|
}
|
|
42
63
|
if (nextOccurrenceStart >= start) {
|
|
43
64
|
const nextOccurrence = [nextOccurrenceStart, nextOccurrenceEnd - 1];
|
|
65
|
+
console.log(`[getNextWeekday] OCCURRENCE[${occurrenceCount}]:`, {
|
|
66
|
+
weekday,
|
|
67
|
+
start: _momentTimezone.default.tz(nextOccurrenceStart, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
68
|
+
end: _momentTimezone.default.tz(nextOccurrenceEnd - 1, timezone).format('YYYY-MM-DD HH:mm:ss Z')
|
|
69
|
+
});
|
|
44
70
|
yield nextOccurrence;
|
|
71
|
+
occurrenceCount++;
|
|
45
72
|
initial = false;
|
|
46
73
|
}
|
|
47
74
|
}
|
|
48
75
|
const nextDateCursor = _momentTimezone.default.tz(dateCursor, timezone).add(1, _scheduling.Unit.Week).valueOf();
|
|
49
76
|
dateCursor = nextDateCursor;
|
|
77
|
+
weekIteration++;
|
|
50
78
|
}
|
|
79
|
+
console.log('[getNextWeekday] COMPLETE:', {
|
|
80
|
+
occurrenceCount
|
|
81
|
+
});
|
|
51
82
|
}
|
|
@@ -5,6 +5,7 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
|
|
|
5
5
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
6
6
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7
7
|
import { includes } from 'lodash/fp';
|
|
8
|
+
import moment from 'moment-timezone';
|
|
8
9
|
import { generateScheduleEnd, hasValidStartAndEnd } from '.';
|
|
9
10
|
import { IntervalTypes, Unit } from '../scheduling.types';
|
|
10
11
|
import { occurrenceIntervalsGenerator, serviceIntervalsGenerator } from '../generators';
|
|
@@ -14,7 +15,7 @@ export var complyingServiceIntervalUnits = [Unit.Second, Unit.Minute, Unit.Hour]
|
|
|
14
15
|
* Generates repeating schedule service and occurrence intervals
|
|
15
16
|
*/
|
|
16
17
|
export function generateRepeatingSchedule(props) {
|
|
17
|
-
var serviceHours, start, strategy, end, isInitial, frequency, frequencyUnit, timezone, isStartAndEndValid, serviceIntervalSequence, complyToServiceHours, serviceIntervals, _iterator, _step, serviceInterval, occurrenceIntervalsSequence, _iterator2, _step2, occurrenceInterval, _t, _t2;
|
|
18
|
+
var serviceHours, start, strategy, end, isInitial, frequency, frequencyUnit, timezone, isStartAndEndValid, serviceIntervalSequence, complyToServiceHours, serviceIntervals, serviceIntervalIndex, _iterator, _step, serviceInterval, occurrenceIntervalsSequence, occurrenceCount, _iterator2, _step2, occurrenceInterval, _t, _t2;
|
|
18
19
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
19
20
|
while (1) switch (_context.prev = _context.next) {
|
|
20
21
|
case 0:
|
|
@@ -33,10 +34,18 @@ export function generateRepeatingSchedule(props) {
|
|
|
33
34
|
end: end,
|
|
34
35
|
start: start
|
|
35
36
|
});
|
|
37
|
+
console.log('[generateRepeatingSchedule] INIT:', {
|
|
38
|
+
start: moment.tz(start, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
39
|
+
end: moment.tz(end, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
40
|
+
isStartAndEndValid: isStartAndEndValid,
|
|
41
|
+
frequencyUnit: frequencyUnit,
|
|
42
|
+
timezone: timezone
|
|
43
|
+
});
|
|
36
44
|
if (isStartAndEndValid) {
|
|
37
45
|
_context.next = 1;
|
|
38
46
|
break;
|
|
39
47
|
}
|
|
48
|
+
console.log('[generateRepeatingSchedule] INVALID START/END - RETURNING EARLY');
|
|
40
49
|
return _context.abrupt("return", []);
|
|
41
50
|
case 1:
|
|
42
51
|
serviceIntervalSequence = serviceIntervalsGenerator({
|
|
@@ -47,15 +56,30 @@ export function generateRepeatingSchedule(props) {
|
|
|
47
56
|
// all service intervals otherwise service interval is from the start and end
|
|
48
57
|
complyToServiceHours = includes(frequencyUnit, complyingServiceIntervalUnits);
|
|
49
58
|
serviceIntervals = complyToServiceHours ? _toConsumableArray(serviceIntervalSequence) : [[start, end]];
|
|
59
|
+
console.log('[generateRepeatingSchedule] SERVICE_INTERVALS:', {
|
|
60
|
+
count: serviceIntervals.length,
|
|
61
|
+
complyToServiceHours: complyToServiceHours,
|
|
62
|
+
intervals: serviceIntervals.slice(0, 3).map(function (interval) {
|
|
63
|
+
return {
|
|
64
|
+
start: moment.tz(interval[0], timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
65
|
+
end: moment.tz(interval[1], timezone).format('YYYY-MM-DD HH:mm:ss Z')
|
|
66
|
+
};
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
serviceIntervalIndex = 0;
|
|
50
70
|
_iterator = _createForOfIteratorHelper(serviceIntervals);
|
|
51
71
|
_context.prev = 2;
|
|
52
72
|
_iterator.s();
|
|
53
73
|
case 3:
|
|
54
74
|
if ((_step = _iterator.n()).done) {
|
|
55
|
-
_context.next =
|
|
75
|
+
_context.next = 14;
|
|
56
76
|
break;
|
|
57
77
|
}
|
|
58
78
|
serviceInterval = _step.value;
|
|
79
|
+
console.log("[generateRepeatingSchedule] PROCESSING_SERVICE_INTERVAL[".concat(serviceIntervalIndex, "]:"), {
|
|
80
|
+
start: moment.tz(serviceInterval[0], timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
81
|
+
end: moment.tz(serviceInterval[1], timezone).format('YYYY-MM-DD HH:mm:ss Z')
|
|
82
|
+
});
|
|
59
83
|
_context.next = 4;
|
|
60
84
|
return {
|
|
61
85
|
interval: serviceInterval,
|
|
@@ -68,57 +92,71 @@ export function generateRepeatingSchedule(props) {
|
|
|
68
92
|
strategy: strategy,
|
|
69
93
|
timezone: timezone
|
|
70
94
|
});
|
|
95
|
+
occurrenceCount = 0;
|
|
71
96
|
_iterator2 = _createForOfIteratorHelper(occurrenceIntervalsSequence);
|
|
72
97
|
_context.prev = 5;
|
|
73
98
|
_iterator2.s();
|
|
74
99
|
case 6:
|
|
75
100
|
if ((_step2 = _iterator2.n()).done) {
|
|
76
|
-
_context.next =
|
|
101
|
+
_context.next = 9;
|
|
77
102
|
break;
|
|
78
103
|
}
|
|
79
104
|
occurrenceInterval = _step2.value;
|
|
105
|
+
console.log("[generateRepeatingSchedule] OCCURRENCE[".concat(occurrenceCount, "]:"), {
|
|
106
|
+
start: moment.tz(occurrenceInterval[0], timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
107
|
+
end: moment.tz(occurrenceInterval[1], timezone).format('YYYY-MM-DD HH:mm:ss Z')
|
|
108
|
+
});
|
|
80
109
|
_context.next = 7;
|
|
81
110
|
return {
|
|
82
111
|
interval: occurrenceInterval,
|
|
83
112
|
type: IntervalTypes.Occurrence
|
|
84
113
|
};
|
|
85
114
|
case 7:
|
|
86
|
-
|
|
87
|
-
break;
|
|
115
|
+
occurrenceCount++;
|
|
88
116
|
case 8:
|
|
89
|
-
_context.next =
|
|
117
|
+
_context.next = 6;
|
|
90
118
|
break;
|
|
91
119
|
case 9:
|
|
92
|
-
_context.
|
|
93
|
-
|
|
94
|
-
_iterator2.e(_t);
|
|
120
|
+
_context.next = 11;
|
|
121
|
+
break;
|
|
95
122
|
case 10:
|
|
96
123
|
_context.prev = 10;
|
|
97
|
-
|
|
98
|
-
|
|
124
|
+
_t = _context["catch"](5);
|
|
125
|
+
_iterator2.e(_t);
|
|
99
126
|
case 11:
|
|
127
|
+
_context.prev = 11;
|
|
128
|
+
_iterator2.f();
|
|
129
|
+
return _context.finish(11);
|
|
130
|
+
case 12:
|
|
131
|
+
console.log("[generateRepeatingSchedule] SERVICE_INTERVAL[".concat(serviceIntervalIndex, "] COMPLETED:"), {
|
|
132
|
+
occurrenceCount: occurrenceCount
|
|
133
|
+
});
|
|
134
|
+
|
|
100
135
|
// NOTE: we must reset isInitial to true following the first service
|
|
101
136
|
// interval otherwise the occurrence will not start exactly on the next
|
|
102
137
|
// service interval start time
|
|
103
138
|
isInitial = true;
|
|
104
|
-
|
|
105
|
-
_context.next = 3;
|
|
106
|
-
break;
|
|
139
|
+
serviceIntervalIndex++;
|
|
107
140
|
case 13:
|
|
108
|
-
_context.next =
|
|
141
|
+
_context.next = 3;
|
|
109
142
|
break;
|
|
110
143
|
case 14:
|
|
111
|
-
_context.
|
|
112
|
-
|
|
113
|
-
_iterator.e(_t2);
|
|
144
|
+
_context.next = 16;
|
|
145
|
+
break;
|
|
114
146
|
case 15:
|
|
115
147
|
_context.prev = 15;
|
|
116
|
-
|
|
117
|
-
|
|
148
|
+
_t2 = _context["catch"](2);
|
|
149
|
+
_iterator.e(_t2);
|
|
118
150
|
case 16:
|
|
151
|
+
_context.prev = 16;
|
|
152
|
+
_iterator.f();
|
|
153
|
+
return _context.finish(16);
|
|
154
|
+
case 17:
|
|
155
|
+
console.log('[generateRepeatingSchedule] COMPLETE');
|
|
156
|
+
case 18:
|
|
119
157
|
case "end":
|
|
120
158
|
return _context.stop();
|
|
121
159
|
}
|
|
122
|
-
}, _marked, null, [[2,
|
|
160
|
+
}, _marked, null, [[2, 15, 16, 17], [5, 10, 11, 12]]);
|
|
123
161
|
}
|
|
124
162
|
//# sourceMappingURL=generateRepeatingSchedule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateRepeatingSchedule.js","names":["generateRepeatingSchedule","_createForOfIteratorHelper","r","e","t","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","_n","F","s","n","done","value","f","TypeError","o","a","u","call","next","return","_arrayLikeToArray","toString","slice","constructor","name","from","test","includes","generateScheduleEnd","hasValidStartAndEnd","IntervalTypes","Unit","occurrenceIntervalsGenerator","serviceIntervalsGenerator","complyingServiceIntervalUnits","Second","Minute","Hour","props","serviceHours","start","strategy","end","isInitial","frequency","frequencyUnit","timezone","isStartAndEndValid","serviceIntervalSequence","complyToServiceHours","serviceIntervals","_iterator","_step","serviceInterval","occurrenceIntervalsSequence","_iterator2","_step2","occurrenceInterval","_t","_t2","_regeneratorRuntime","wrap","_context","prev","options","unit","abrupt","_toConsumableArray","interval","type","Service","Occurrence","finish","stop","_marked"],"sources":["../../../src/scheduling/helpers/generateRepeatingSchedule.ts"],"sourcesContent":["import { includes } from 'lodash/fp'\n\nimport { generateScheduleEnd, hasValidStartAndEnd } from '.'\nimport {\n IntervalTypes,\n ScheduleIntervalsGenerator,\n Unit,\n} from '../scheduling.types'\nimport {\n occurrenceIntervalsGenerator,\n serviceIntervalsGenerator,\n} from '../generators'\n\nexport const complyingServiceIntervalUnits = [\n Unit.Second,\n Unit.Minute,\n Unit.Hour,\n]\n\n/**\n * Generates repeating schedule service and occurrence intervals\n */\nexport function* generateRepeatingSchedule(props: ScheduleIntervalsGenerator) {\n const { serviceHours, start, strategy } = props\n let { end, isInitial } = props\n\n // NOTE support never ending repeating schedule where no end date defined by\n // setting a custom end date using the frequency unit and value\n const {\n options: { frequency },\n } = strategy\n const { unit: frequencyUnit } = frequency\n const { timezone } = serviceHours\n\n end = end || generateScheduleEnd({ frequency, start, timezone })\n\n const isStartAndEndValid = hasValidStartAndEnd({ end, start })\n\n if (!isStartAndEndValid) return []\n\n const serviceIntervalSequence = serviceIntervalsGenerator({\n end,\n serviceHours,\n start,\n })\n\n // NOTE: when repeating and is complying to service hours we iterate through\n // all service intervals otherwise service interval is from the start and end\n const complyToServiceHours = includes(\n frequencyUnit,\n complyingServiceIntervalUnits\n )\n\n const serviceIntervals = complyToServiceHours\n ? [...serviceIntervalSequence]\n : [[start, end]]\n\n for (const serviceInterval of serviceIntervals) {\n yield { interval: serviceInterval, type: IntervalTypes.Service }\n\n const occurrenceIntervalsSequence = occurrenceIntervalsGenerator({\n isInitial,\n serviceInterval,\n strategy,\n timezone,\n })\n\n for (const occurrenceInterval of occurrenceIntervalsSequence) {\n yield { interval: occurrenceInterval, type: IntervalTypes.Occurrence }\n }\n\n // NOTE: we must reset isInitial to true following the first service\n // interval otherwise the occurrence will not start exactly on the next\n // service interval start time\n isInitial = true\n }\n}\n"],"mappings":";;oDAsBiBA,yBAAyB;AAAA,SAAAC,2BAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,yBAAAC,MAAA,IAAAH,CAAA,CAAAG,MAAA,CAAAC,QAAA,KAAAJ,CAAA,qBAAAE,CAAA,QAAAG,KAAA,CAAAC,OAAA,CAAAN,CAAA,MAAAE,CAAA,GAAAK,2BAAA,CAAAP,CAAA,MAAAC,CAAA,IAAAD,CAAA,uBAAAA,CAAA,CAAAQ,MAAA,IAAAN,CAAA,KAAAF,CAAA,GAAAE,CAAA,OAAAO,EAAA,MAAAC,CAAA,YAAAA,EAAA,eAAAC,CAAA,EAAAD,CAAA,EAAAE,CAAA,WAAAA,EAAA,WAAAH,EAAA,IAAAT,CAAA,CAAAQ,MAAA,KAAAK,IAAA,WAAAA,IAAA,MAAAC,KAAA,EAAAd,CAAA,CAAAS,EAAA,UAAAR,CAAA,WAAAA,EAAAD,CAAA,UAAAA,CAAA,KAAAe,CAAA,EAAAL,CAAA,gBAAAM,SAAA,iJAAAC,CAAA,EAAAC,CAAA,OAAAC,CAAA,gBAAAR,CAAA,WAAAA,EAAA,IAAAT,CAAA,GAAAA,CAAA,CAAAkB,IAAA,CAAApB,CAAA,MAAAY,CAAA,WAAAA,EAAA,QAAAZ,CAAA,GAAAE,CAAA,CAAAmB,IAAA,WAAAH,CAAA,GAAAlB,CAAA,CAAAa,IAAA,EAAAb,CAAA,KAAAC,CAAA,WAAAA,EAAAD,CAAA,IAAAmB,CAAA,OAAAF,CAAA,GAAAjB,CAAA,KAAAe,CAAA,WAAAA,E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,QAAA;QAAAP,UAAA,CAAAzD,CAAA,CAAA4D,EAAA;MAAA;QAAAI,QAAA,CAAAC,IAAA;QAAAR,UAAA,CAAA3C,CAAA;QAAA,OAAAkD,QAAA,CAAAU,MAAA;MAAA;QAGxE;QACA;QACA;QACA7B,SAAS,GAAG,IAAI;MAAA;QAAAmB,QAAA,CAAA5C,IAAA;QAAA;MAAA;QAAA4C,QAAA,CAAA5C,IAAA;QAAA;MAAA;QAAA4C,QAAA,CAAAC,IAAA;QAAAJ,GAAA,GAAAG,QAAA;QAAAX,SAAA,CAAArD,CAAA,CAAA6D,GAAA;MAAA;QAAAG,QAAA,CAAAC,IAAA;QAAAZ,SAAA,CAAAvC,CAAA;QAAA,OAAAkD,QAAA,CAAAU,MAAA;MAAA;MAAA;QAAA,OAAAV,QAAA,CAAAW,IAAA;IAAA;EAAA,GAAAC,OAAA;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"generateRepeatingSchedule.js","names":["generateRepeatingSchedule","_createForOfIteratorHelper","r","e","t","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","_n","F","s","n","done","value","f","TypeError","o","a","u","call","next","return","_arrayLikeToArray","toString","slice","constructor","name","from","test","includes","moment","generateScheduleEnd","hasValidStartAndEnd","IntervalTypes","Unit","occurrenceIntervalsGenerator","serviceIntervalsGenerator","complyingServiceIntervalUnits","Second","Minute","Hour","props","serviceHours","start","strategy","end","isInitial","frequency","frequencyUnit","timezone","isStartAndEndValid","serviceIntervalSequence","complyToServiceHours","serviceIntervals","serviceIntervalIndex","_iterator","_step","serviceInterval","occurrenceIntervalsSequence","occurrenceCount","_iterator2","_step2","occurrenceInterval","_t","_t2","_regeneratorRuntime","wrap","_context","prev","options","unit","console","log","tz","format","abrupt","_toConsumableArray","count","intervals","map","interval","concat","type","Service","Occurrence","finish","stop","_marked"],"sources":["../../../src/scheduling/helpers/generateRepeatingSchedule.ts"],"sourcesContent":["import { includes } from 'lodash/fp'\nimport moment from 'moment-timezone'\n\nimport { generateScheduleEnd, hasValidStartAndEnd } from '.'\nimport {\n IntervalTypes,\n ScheduleIntervalsGenerator,\n Unit,\n} from '../scheduling.types'\nimport {\n occurrenceIntervalsGenerator,\n serviceIntervalsGenerator,\n} from '../generators'\n\nexport const complyingServiceIntervalUnits = [\n Unit.Second,\n Unit.Minute,\n Unit.Hour,\n]\n\n/**\n * Generates repeating schedule service and occurrence intervals\n */\nexport function* generateRepeatingSchedule(props: ScheduleIntervalsGenerator) {\n const { serviceHours, start, strategy } = props\n let { end, isInitial } = props\n\n // NOTE support never ending repeating schedule where no end date defined by\n // setting a custom end date using the frequency unit and value\n const {\n options: { frequency },\n } = strategy\n const { unit: frequencyUnit } = frequency\n const { timezone } = serviceHours\n\n end = end || generateScheduleEnd({ frequency, start, timezone })\n\n const isStartAndEndValid = hasValidStartAndEnd({ end, start })\n\n console.log('[generateRepeatingSchedule] INIT:', {\n start: moment.tz(start, timezone).format('YYYY-MM-DD HH:mm:ss Z'),\n end: moment.tz(end, timezone).format('YYYY-MM-DD HH:mm:ss Z'),\n isStartAndEndValid,\n frequencyUnit,\n timezone,\n })\n\n if (!isStartAndEndValid) {\n console.log(\n '[generateRepeatingSchedule] INVALID START/END - RETURNING EARLY'\n )\n return []\n }\n\n const serviceIntervalSequence = serviceIntervalsGenerator({\n end,\n serviceHours,\n start,\n })\n\n // NOTE: when repeating and is complying to service hours we iterate through\n // all service intervals otherwise service interval is from the start and end\n const complyToServiceHours = includes(\n frequencyUnit,\n complyingServiceIntervalUnits\n )\n\n const serviceIntervals = complyToServiceHours\n ? [...serviceIntervalSequence]\n : [[start, end]]\n\n console.log('[generateRepeatingSchedule] SERVICE_INTERVALS:', {\n count: serviceIntervals.length,\n complyToServiceHours,\n intervals: serviceIntervals.slice(0, 3).map((interval) => ({\n start: moment.tz(interval[0], timezone).format('YYYY-MM-DD HH:mm:ss Z'),\n end: moment.tz(interval[1], timezone).format('YYYY-MM-DD HH:mm:ss Z'),\n })),\n })\n\n let serviceIntervalIndex = 0\n for (const serviceInterval of serviceIntervals) {\n console.log(\n `[generateRepeatingSchedule] PROCESSING_SERVICE_INTERVAL[${serviceIntervalIndex}]:`,\n {\n start: moment\n .tz(serviceInterval[0], timezone)\n .format('YYYY-MM-DD HH:mm:ss Z'),\n end: moment\n .tz(serviceInterval[1], timezone)\n .format('YYYY-MM-DD HH:mm:ss Z'),\n }\n )\n\n yield { interval: serviceInterval, type: IntervalTypes.Service }\n\n const occurrenceIntervalsSequence = occurrenceIntervalsGenerator({\n isInitial,\n serviceInterval,\n strategy,\n timezone,\n })\n\n let occurrenceCount = 0\n for (const occurrenceInterval of occurrenceIntervalsSequence) {\n console.log(\n `[generateRepeatingSchedule] OCCURRENCE[${occurrenceCount}]:`,\n {\n start: moment\n .tz(occurrenceInterval[0], timezone)\n .format('YYYY-MM-DD HH:mm:ss Z'),\n end: moment\n .tz(occurrenceInterval[1], timezone)\n .format('YYYY-MM-DD HH:mm:ss Z'),\n }\n )\n yield { interval: occurrenceInterval, type: IntervalTypes.Occurrence }\n occurrenceCount++\n }\n\n console.log(\n `[generateRepeatingSchedule] SERVICE_INTERVAL[${serviceIntervalIndex}] COMPLETED:`,\n {\n occurrenceCount,\n }\n )\n\n // NOTE: we must reset isInitial to true following the first service\n // interval otherwise the occurrence will not start exactly on the next\n // service interval start time\n isInitial = true\n serviceIntervalIndex++\n }\n\n console.log('[generateRepeatingSchedule] COMPLETE')\n}\n"],"mappings":";;oDAuBiBA,yBAAyB;AAAA,SAAAC,2BAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,yBAAAC,MAAA,IAAAH,CAAA,CAAAG,MAAA,CAAAC,QAAA,KAAAJ,CAAA,qBAAAE,CAAA,QAAAG,KAAA,CAAAC,OAAA,CAAAN,CAAA,MAAAE,CAAA,GAAAK,2BAAA,CAAAP,CAAA,MAAAC,CAAA,IAAAD,CAAA,uBAAAA,CAAA,CAAAQ,MAAA,IAAAN,CAAA,KAAAF,CAAA,GAAAE,CAAA,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A9C,CAAA;QAAA,OAAAqD,QAAA,CAAAkB,MAAA;MAAA;QAGnBd,OAAO,CAACC,GAAG,iDAAAS,MAAA,CACuC3B,oBAAoB,mBACpE;UACEK,eAAe,EAAfA;QACF,CACF,CAAC;;QAED;QACA;QACA;QACAb,SAAS,GAAG,IAAI;QAChBQ,oBAAoB,EAAE;MAAA;QAAAa,QAAA,CAAA/C,IAAA;QAAA;MAAA;QAAA+C,QAAA,CAAA/C,IAAA;QAAA;MAAA;QAAA+C,QAAA,CAAAC,IAAA;QAAAJ,GAAA,GAAAG,QAAA;QAAAZ,SAAA,CAAAvD,CAAA,CAAAgE,GAAA;MAAA;QAAAG,QAAA,CAAAC,IAAA;QAAAb,SAAA,CAAAzC,CAAA;QAAA,OAAAqD,QAAA,CAAAkB,MAAA;MAAA;QAGxBd,OAAO,CAACC,GAAG,CAAC,sCAAsC,CAAC;MAAA;MAAA;QAAA,OAAAL,QAAA,CAAAmB,IAAA;IAAA;EAAA,GAAAC,OAAA;AAAA","ignoreList":[]}
|
|
@@ -16,7 +16,19 @@ export function generateScheduleEnd(_ref) {
|
|
|
16
16
|
// NOTE: if frequency unit less than a week we must set end to jump a week
|
|
17
17
|
// plus the interval length of the schedule frequency
|
|
18
18
|
// so that we can ensure that we are within a service interval
|
|
19
|
-
|
|
19
|
+
// MODIFIED FOR TESTING: Changed from 2 weeks to 1 hour for testing endless generation bug
|
|
20
|
+
var end = isFrequencyLessThanWeek ? mStart.add(1, Unit.Hour).valueOf() : mStart.add(frequencyValue * 2, frequencyUnit).valueOf();
|
|
21
|
+
console.log('[generateScheduleEnd] START:', {
|
|
22
|
+
start: moment.tz(start, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
23
|
+
frequency: "".concat(frequencyValue).concat(frequencyUnit),
|
|
24
|
+
isFrequencyLessThanWeek: isFrequencyLessThanWeek,
|
|
25
|
+
timezone: timezone
|
|
26
|
+
});
|
|
27
|
+
console.log('[generateScheduleEnd] END CALCULATED:', {
|
|
28
|
+
end: moment.tz(end, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
29
|
+
endTimestamp: end,
|
|
30
|
+
durationFromStart: "".concat(moment(end).diff(moment(start), 'hours'), " hours")
|
|
31
|
+
});
|
|
20
32
|
return end;
|
|
21
33
|
}
|
|
22
34
|
//# sourceMappingURL=generateScheduleEnd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateScheduleEnd.js","names":["includes","moment","Unit","generateScheduleEnd","_ref","frequency","start","timezone","frequencyUnit","unit","frequencyValue","value","isFrequencyLessThanWeek","Millisecond","Second","Minute","Hour","Day","mStart","tz","end","add","
|
|
1
|
+
{"version":3,"file":"generateScheduleEnd.js","names":["includes","moment","Unit","generateScheduleEnd","_ref","frequency","start","timezone","frequencyUnit","unit","frequencyValue","value","isFrequencyLessThanWeek","Millisecond","Second","Minute","Hour","Day","mStart","tz","end","add","valueOf","console","log","format","concat","endTimestamp","durationFromStart","diff"],"sources":["../../../src/scheduling/helpers/generateScheduleEnd.ts"],"sourcesContent":["import { includes } from 'lodash/fp'\nimport moment from 'moment-timezone'\n\nimport { Period, Unit } from '../scheduling.types'\n\ninterface GenerateScheduleEnd {\n readonly frequency: Period\n readonly start: number\n readonly timezone: string\n}\n\n/**\n * Generates a schedule end datetime based on the start and frequency\n */\nexport function generateScheduleEnd({\n frequency,\n start,\n timezone,\n}: GenerateScheduleEnd): number {\n const { unit: frequencyUnit, value: frequencyValue } = frequency\n\n const isFrequencyLessThanWeek = includes(frequencyUnit, [\n Unit.Millisecond,\n Unit.Second,\n Unit.Minute,\n Unit.Hour,\n Unit.Day,\n ])\n\n const mStart = moment.tz(start, timezone)\n\n // NOTE: if frequency unit less than a week we must set end to jump a week\n // plus the interval length of the schedule frequency\n // so that we can ensure that we are within a service interval\n // MODIFIED FOR TESTING: Changed from 2 weeks to 1 hour for testing endless generation bug\n const end = isFrequencyLessThanWeek\n ? mStart.add(1, Unit.Hour).valueOf()\n : mStart.add(frequencyValue * 2, frequencyUnit).valueOf()\n\n console.log('[generateScheduleEnd] START:', {\n start: moment.tz(start, timezone).format('YYYY-MM-DD HH:mm:ss Z'),\n frequency: `${frequencyValue}${frequencyUnit}`,\n isFrequencyLessThanWeek,\n timezone,\n })\n\n console.log('[generateScheduleEnd] END CALCULATED:', {\n end: moment.tz(end, timezone).format('YYYY-MM-DD HH:mm:ss Z'),\n endTimestamp: end,\n durationFromStart: `${moment(end).diff(moment(start), 'hours')} hours`,\n })\n\n return end\n}\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,WAAW;AACpC,OAAOC,MAAM,MAAM,iBAAiB;AAEpC,SAAiBC,IAAI,QAAQ,qBAAqB;AAQlD;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAAAC,IAAA,EAIH;EAAA,IAH9BC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;EAER,IAAcC,aAAa,GAA4BH,SAAS,CAAxDI,IAAI;IAAwBC,cAAc,GAAKL,SAAS,CAAnCM,KAAK;EAElC,IAAMC,uBAAuB,GAAGZ,QAAQ,CAACQ,aAAa,EAAE,CACtDN,IAAI,CAACW,WAAW,EAChBX,IAAI,CAACY,MAAM,EACXZ,IAAI,CAACa,MAAM,EACXb,IAAI,CAACc,IAAI,EACTd,IAAI,CAACe,GAAG,CACT,CAAC;EAEF,IAAMC,MAAM,GAAGjB,MAAM,CAACkB,EAAE,CAACb,KAAK,EAAEC,QAAQ,CAAC;;EAEzC;EACA;EACA;EACA;EACA,IAAMa,GAAG,GAAGR,uBAAuB,GAC/BM,MAAM,CAACG,GAAG,CAAC,CAAC,EAAEnB,IAAI,CAACc,IAAI,CAAC,CAACM,OAAO,CAAC,CAAC,GAClCJ,MAAM,CAACG,GAAG,CAACX,cAAc,GAAG,CAAC,EAAEF,aAAa,CAAC,CAACc,OAAO,CAAC,CAAC;EAE3DC,OAAO,CAACC,GAAG,CAAC,8BAA8B,EAAE;IAC1ClB,KAAK,EAAEL,MAAM,CAACkB,EAAE,CAACb,KAAK,EAAEC,QAAQ,CAAC,CAACkB,MAAM,CAAC,uBAAuB,CAAC;IACjEpB,SAAS,KAAAqB,MAAA,CAAKhB,cAAc,EAAAgB,MAAA,CAAGlB,aAAa,CAAE;IAC9CI,uBAAuB,EAAvBA,uBAAuB;IACvBL,QAAQ,EAARA;EACF,CAAC,CAAC;EAEFgB,OAAO,CAACC,GAAG,CAAC,uCAAuC,EAAE;IACnDJ,GAAG,EAAEnB,MAAM,CAACkB,EAAE,CAACC,GAAG,EAAEb,QAAQ,CAAC,CAACkB,MAAM,CAAC,uBAAuB,CAAC;IAC7DE,YAAY,EAAEP,GAAG;IACjBQ,iBAAiB,KAAAF,MAAA,CAAKzB,MAAM,CAACmB,GAAG,CAAC,CAACS,IAAI,CAAC5B,MAAM,CAACK,KAAK,CAAC,EAAE,OAAO,CAAC;EAChE,CAAC,CAAC;EAEF,OAAOc,GAAG;AACZ","ignoreList":[]}
|
|
@@ -13,7 +13,7 @@ export function getNext(_ref) {
|
|
|
13
13
|
timezone = _ref.timezone,
|
|
14
14
|
type = _ref.type;
|
|
15
15
|
return /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
16
|
-
var duration, frequency, durationUnit, durationValue, frequencyUnit, frequencyValue, initial, dateCursor, nextOccurrenceStart, nextOccurrenceEnd, nextOccurrenceStartByBackCalculation, earliestNextOccurrenceStart, nextOccurrence;
|
|
16
|
+
var duration, frequency, durationUnit, durationValue, frequencyUnit, frequencyValue, initial, dateCursor, occurrenceCount, nextOccurrenceStart, nextOccurrenceEnd, nextOccurrenceStartByBackCalculation, earliestNextOccurrenceStart, nextOccurrence;
|
|
17
17
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
18
18
|
while (1) switch (_context.prev = _context.next) {
|
|
19
19
|
case 0:
|
|
@@ -22,9 +22,19 @@ export function getNext(_ref) {
|
|
|
22
22
|
frequencyUnit = frequency.unit, frequencyValue = frequency.value;
|
|
23
23
|
initial = isInitial;
|
|
24
24
|
dateCursor = initial ? moment.tz(start, timezone).valueOf() : moment.tz(start, timezone).add(1, Unit.Millisecond).valueOf();
|
|
25
|
+
console.log('[getNext] START:', {
|
|
26
|
+
strategy: type,
|
|
27
|
+
start: moment.tz(start, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
28
|
+
end: moment.tz(end, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
29
|
+
dateCursor: moment.tz(dateCursor, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
30
|
+
isInitial: isInitial,
|
|
31
|
+
frequency: "".concat(frequencyValue).concat(frequencyUnit),
|
|
32
|
+
duration: "".concat(durationValue).concat(durationUnit)
|
|
33
|
+
});
|
|
34
|
+
occurrenceCount = 0;
|
|
25
35
|
case 1:
|
|
26
36
|
if (!(dateCursor < end)) {
|
|
27
|
-
_context.next =
|
|
37
|
+
_context.next = 5;
|
|
28
38
|
break;
|
|
29
39
|
}
|
|
30
40
|
nextOccurrenceStart = void 0;
|
|
@@ -44,20 +54,37 @@ export function getNext(_ref) {
|
|
|
44
54
|
_context.next = 2;
|
|
45
55
|
break;
|
|
46
56
|
}
|
|
57
|
+
console.log('[getNext] BOUNDARY CHECK FAILED:', {
|
|
58
|
+
occurrenceCount: occurrenceCount,
|
|
59
|
+
nextOccurrenceStart: moment.tz(nextOccurrenceStart, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
60
|
+
nextOccurrenceEnd: moment.tz(nextOccurrenceEnd, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
61
|
+
end: moment.tz(end, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
62
|
+
condition: "(".concat(nextOccurrenceEnd, " <= ").concat(nextOccurrenceStart, ") || (").concat(nextOccurrenceEnd, " > ").concat(end, ")")
|
|
63
|
+
});
|
|
47
64
|
return _context.abrupt("return");
|
|
48
65
|
case 2:
|
|
49
66
|
if (!(nextOccurrenceStart >= start)) {
|
|
50
|
-
_context.next =
|
|
67
|
+
_context.next = 4;
|
|
51
68
|
break;
|
|
52
69
|
}
|
|
53
70
|
nextOccurrence = [nextOccurrenceStart, nextOccurrenceEnd - 1];
|
|
71
|
+
console.log("[getNext] OCCURRENCE[".concat(occurrenceCount, "]:"), {
|
|
72
|
+
start: moment.tz(nextOccurrenceStart, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
73
|
+
end: moment.tz(nextOccurrenceEnd - 1, timezone).format('YYYY-MM-DD HH:mm:ss Z')
|
|
74
|
+
});
|
|
54
75
|
_context.next = 3;
|
|
55
76
|
return nextOccurrence;
|
|
56
77
|
case 3:
|
|
78
|
+
occurrenceCount++;
|
|
79
|
+
case 4:
|
|
57
80
|
dateCursor = nextOccurrenceEnd;
|
|
58
81
|
_context.next = 1;
|
|
59
82
|
break;
|
|
60
|
-
case
|
|
83
|
+
case 5:
|
|
84
|
+
console.log('[getNext] COMPLETE:', {
|
|
85
|
+
occurrenceCount: occurrenceCount
|
|
86
|
+
});
|
|
87
|
+
case 6:
|
|
61
88
|
case "end":
|
|
62
89
|
return _context.stop();
|
|
63
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNext.js","names":["moment","StrategyTypes","Unit","getNext","_ref","end","isInitial","options","start","timezone","type","_regeneratorRuntime","mark","_callee","duration","frequency","durationUnit","durationValue","frequencyUnit","frequencyValue","initial","dateCursor","nextOccurrenceStart","nextOccurrenceEnd","nextOccurrenceStartByBackCalculation","earliestNextOccurrenceStart","nextOccurrence","wrap","_context","prev","next","unit","value","tz","valueOf","add","Millisecond","Stopwatch","subtract","max","abrupt","stop"],"sources":["../../../src/scheduling/strategies/getNext.ts"],"sourcesContent":["import moment from 'moment-timezone'\n\nimport { GetNext, Interval, StrategyTypes, Unit } from '../scheduling.types'\n\n/**\n * Generates next occurrence interval for stopwatch and window strategy\n */\nexport function* getNext({\n end,\n isInitial,\n options,\n start,\n timezone,\n type,\n}: GetNext): IterableIterator<Interval> {\n const { duration, frequency } = options\n const { unit: durationUnit, value: durationValue } = duration\n const { unit: frequencyUnit, value: frequencyValue } = frequency\n\n let initial: boolean = isInitial\n\n let dateCursor: number = initial\n ? moment.tz(start, timezone).valueOf()\n : moment
|
|
1
|
+
{"version":3,"file":"getNext.js","names":["moment","StrategyTypes","Unit","getNext","_ref","end","isInitial","options","start","timezone","type","_regeneratorRuntime","mark","_callee","duration","frequency","durationUnit","durationValue","frequencyUnit","frequencyValue","initial","dateCursor","occurrenceCount","nextOccurrenceStart","nextOccurrenceEnd","nextOccurrenceStartByBackCalculation","earliestNextOccurrenceStart","nextOccurrence","wrap","_context","prev","next","unit","value","tz","valueOf","add","Millisecond","console","log","strategy","format","concat","Stopwatch","subtract","max","condition","abrupt","stop"],"sources":["../../../src/scheduling/strategies/getNext.ts"],"sourcesContent":["import moment from 'moment-timezone'\n\nimport { GetNext, Interval, StrategyTypes, Unit } from '../scheduling.types'\n\n/**\n * Generates next occurrence interval for stopwatch and window strategy\n */\nexport function* getNext({\n end,\n isInitial,\n options,\n start,\n timezone,\n type,\n}: GetNext): IterableIterator<Interval> {\n const { duration, frequency } = options\n const { unit: durationUnit, value: durationValue } = duration\n const { unit: frequencyUnit, value: frequencyValue } = frequency\n\n let initial: boolean = isInitial\n\n let dateCursor: number = initial\n ? moment.tz(start, timezone).valueOf()\n : moment.tz(start, timezone).add(1, Unit.Millisecond).valueOf()\n\n console.log('[getNext] START:', {\n strategy: type,\n start: moment.tz(start, timezone).format('YYYY-MM-DD HH:mm:ss Z'),\n end: moment.tz(end, timezone).format('YYYY-MM-DD HH:mm:ss Z'),\n dateCursor: moment.tz(dateCursor, timezone).format('YYYY-MM-DD HH:mm:ss Z'),\n isInitial,\n frequency: `${frequencyValue}${frequencyUnit}`,\n duration: `${durationValue}${durationUnit}`,\n })\n\n let occurrenceCount = 0\n while (dateCursor < end) {\n let nextOccurrenceStart: number\n let nextOccurrenceEnd: number\n\n if (type === StrategyTypes.Stopwatch) {\n nextOccurrenceStart = dateCursor\n nextOccurrenceEnd = moment\n .tz(dateCursor, timezone)\n .add(durationValue, durationUnit)\n .valueOf()\n } else {\n nextOccurrenceEnd = moment\n .tz(dateCursor, timezone)\n .add(frequencyValue, frequencyUnit)\n .valueOf()\n\n const nextOccurrenceStartByBackCalculation = moment\n .tz(nextOccurrenceEnd, timezone)\n .subtract(durationValue, durationUnit)\n\n const earliestNextOccurrenceStart = moment.tz(dateCursor, timezone)\n\n // NOTE: this is to ensure that the next occurrence start is always\n // greater than or equal to the date cursor. Moment js handles month addition and subtraction\n // with estimations (Dec 31st + 2 months gives Feb 28th/29th). This can lead to inaccurate start times when calculating forwards then backwards at the end of the month.\n nextOccurrenceStart = moment\n .max(earliestNextOccurrenceStart, nextOccurrenceStartByBackCalculation)\n .valueOf()\n }\n\n if (nextOccurrenceEnd <= nextOccurrenceStart || nextOccurrenceEnd > end) {\n console.log('[getNext] BOUNDARY CHECK FAILED:', {\n occurrenceCount,\n nextOccurrenceStart: moment\n .tz(nextOccurrenceStart, timezone)\n .format('YYYY-MM-DD HH:mm:ss Z'),\n nextOccurrenceEnd: moment\n .tz(nextOccurrenceEnd, timezone)\n .format('YYYY-MM-DD HH:mm:ss Z'),\n end: moment.tz(end, timezone).format('YYYY-MM-DD HH:mm:ss Z'),\n condition: `(${nextOccurrenceEnd} <= ${nextOccurrenceStart}) || (${nextOccurrenceEnd} > ${end})`,\n })\n return\n }\n\n if (nextOccurrenceStart >= start) {\n const nextOccurrence = [nextOccurrenceStart, nextOccurrenceEnd - 1]\n\n console.log(`[getNext] OCCURRENCE[${occurrenceCount}]:`, {\n start: moment\n .tz(nextOccurrenceStart, timezone)\n .format('YYYY-MM-DD HH:mm:ss Z'),\n end: moment\n .tz(nextOccurrenceEnd - 1, timezone)\n .format('YYYY-MM-DD HH:mm:ss Z'),\n })\n\n yield nextOccurrence\n occurrenceCount++\n }\n\n dateCursor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Ec,OAAO,CAACC,GAAG,yBAAAG,MAAA,CAAyBpB,eAAe,SAAM;YACvDd,KAAK,EAAER,MAAM,CACVkC,EAAE,CAACX,mBAAmB,EAAEd,QAAQ,CAAC,CACjCgC,MAAM,CAAC,uBAAuB,CAAC;YAClCpC,GAAG,EAAEL,MAAM,CACRkC,EAAE,CAACV,iBAAiB,GAAG,CAAC,EAAEf,QAAQ,CAAC,CACnCgC,MAAM,CAAC,uBAAuB;UACnC,CAAC,CAAC;UAAAZ,QAAA,CAAAE,IAAA;UAEF,OAAMJ,cAAc;QAAA;UACpBL,eAAe,EAAE;QAAA;UAGnBD,UAAU,GAAGG,iBAAiB;UAAAK,QAAA,CAAAE,IAAA;UAAA;QAAA;UAGhCO,OAAO,CAACC,GAAG,CAAC,qBAAqB,EAAE;YAAEjB,eAAe,EAAfA;UAAgB,CAAC,CAAC;QAAA;QAAA;UAAA,OAAAO,QAAA,CAAAmB,IAAA;MAAA;IAAA,GAAAnC,OAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -15,7 +15,7 @@ export function getNextWeekday(_ref) {
|
|
|
15
15
|
start = _ref.start,
|
|
16
16
|
timezone = _ref.timezone;
|
|
17
17
|
return /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
18
|
-
var duration, frequency, weekdays, durationUnit, durationValue, frequencyUnit, frequencyValue, initial, dateCursor, _iterator, _step, weekday, nextOccurrenceEnd, nextOccurrenceStart, nextOccurrence, nextDateCursor, _t;
|
|
18
|
+
var duration, frequency, weekdays, durationUnit, durationValue, frequencyUnit, frequencyValue, initial, dateCursor, occurrenceCount, weekIteration, _iterator, _step, weekday, nextOccurrenceEnd, nextOccurrenceStart, nextOccurrence, nextDateCursor, _t;
|
|
19
19
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
20
20
|
while (1) switch (_context.prev = _context.next) {
|
|
21
21
|
case 0:
|
|
@@ -24,11 +24,25 @@ export function getNextWeekday(_ref) {
|
|
|
24
24
|
frequencyUnit = frequency.unit, frequencyValue = frequency.value;
|
|
25
25
|
initial = isInitial;
|
|
26
26
|
dateCursor = initial ? moment.tz(start, timezone).startOf(Unit.Week).valueOf() : moment.tz(start, timezone).add(frequencyValue, frequencyUnit).startOf(Unit.Week).valueOf();
|
|
27
|
+
console.log('[getNextWeekday] START:', {
|
|
28
|
+
start: moment.tz(start, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
29
|
+
end: moment.tz(end, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
30
|
+
dateCursor: moment.tz(dateCursor, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
31
|
+
isInitial: isInitial,
|
|
32
|
+
frequency: "".concat(frequencyValue).concat(frequencyUnit),
|
|
33
|
+
duration: "".concat(durationValue).concat(durationUnit),
|
|
34
|
+
weekdays: weekdays
|
|
35
|
+
});
|
|
36
|
+
occurrenceCount = 0;
|
|
37
|
+
weekIteration = 0;
|
|
27
38
|
case 1:
|
|
28
39
|
if (!(dateCursor < end)) {
|
|
29
40
|
_context.next = 11;
|
|
30
41
|
break;
|
|
31
42
|
}
|
|
43
|
+
console.log("[getNextWeekday] WEEK_ITERATION[".concat(weekIteration, "]:"), {
|
|
44
|
+
dateCursor: moment.tz(dateCursor, timezone).format('YYYY-MM-DD')
|
|
45
|
+
});
|
|
32
46
|
_iterator = _createForOfIteratorHelper(weekdays);
|
|
33
47
|
_context.prev = 2;
|
|
34
48
|
_iterator.s();
|
|
@@ -44,6 +58,13 @@ export function getNextWeekday(_ref) {
|
|
|
44
58
|
_context.next = 4;
|
|
45
59
|
break;
|
|
46
60
|
}
|
|
61
|
+
console.log('[getNextWeekday] BOUNDARY CHECK FAILED:', {
|
|
62
|
+
occurrenceCount: occurrenceCount,
|
|
63
|
+
weekday: weekday,
|
|
64
|
+
nextOccurrenceStart: moment.tz(nextOccurrenceStart, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
65
|
+
nextOccurrenceEnd: moment.tz(nextOccurrenceEnd, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
66
|
+
end: moment.tz(end, timezone).format('YYYY-MM-DD HH:mm:ss Z')
|
|
67
|
+
});
|
|
47
68
|
return _context.abrupt("return");
|
|
48
69
|
case 4:
|
|
49
70
|
if (!(nextOccurrenceStart >= start)) {
|
|
@@ -51,9 +72,15 @@ export function getNextWeekday(_ref) {
|
|
|
51
72
|
break;
|
|
52
73
|
}
|
|
53
74
|
nextOccurrence = [nextOccurrenceStart, nextOccurrenceEnd - 1];
|
|
75
|
+
console.log("[getNextWeekday] OCCURRENCE[".concat(occurrenceCount, "]:"), {
|
|
76
|
+
weekday: weekday,
|
|
77
|
+
start: moment.tz(nextOccurrenceStart, timezone).format('YYYY-MM-DD HH:mm:ss Z'),
|
|
78
|
+
end: moment.tz(nextOccurrenceEnd - 1, timezone).format('YYYY-MM-DD HH:mm:ss Z')
|
|
79
|
+
});
|
|
54
80
|
_context.next = 5;
|
|
55
81
|
return nextOccurrence;
|
|
56
82
|
case 5:
|
|
83
|
+
occurrenceCount++;
|
|
57
84
|
initial = false;
|
|
58
85
|
case 6:
|
|
59
86
|
_context.next = 3;
|
|
@@ -72,9 +99,14 @@ export function getNextWeekday(_ref) {
|
|
|
72
99
|
case 10:
|
|
73
100
|
nextDateCursor = moment.tz(dateCursor, timezone).add(1, Unit.Week).valueOf();
|
|
74
101
|
dateCursor = nextDateCursor;
|
|
102
|
+
weekIteration++;
|
|
75
103
|
_context.next = 1;
|
|
76
104
|
break;
|
|
77
105
|
case 11:
|
|
106
|
+
console.log('[getNextWeekday] COMPLETE:', {
|
|
107
|
+
occurrenceCount: occurrenceCount
|
|
108
|
+
});
|
|
109
|
+
case 12:
|
|
78
110
|
case "end":
|
|
79
111
|
return _context.stop();
|
|
80
112
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNextWeekday.js","names":["moment","Unit","getNextWeekday","_ref","end","isInitial","options","start","timezone","_regeneratorRuntime","mark","_callee","duration","frequency","weekdays","durationUnit","durationValue","frequencyUnit","frequencyValue","initial","dateCursor","_iterator","_step","weekday","nextOccurrenceEnd","nextOccurrenceStart","nextOccurrence","nextDateCursor","_t","wrap","_context","prev","next","unit","value","tz","startOf","Week","valueOf","add","_createForOfIteratorHelper","s","n","done","isoWeekday","Day","subtract","abrupt","e","f","finish","stop"],"sources":["../../../src/scheduling/strategies/getNextWeekday.ts"],"sourcesContent":["import moment from 'moment-timezone'\n\nimport { GetNext, Interval, Unit } from '../scheduling.types'\n\n/**\n * Generates next occurrence interval for weekdays strategy\n */\nexport function* getNextWeekday({\n end,\n isInitial,\n options,\n start,\n timezone,\n}: GetNext): IterableIterator<Interval> {\n const { duration, frequency, weekdays } = options\n const { unit: durationUnit, value: durationValue } = duration\n const { unit: frequencyUnit, value: frequencyValue } = frequency\n\n let initial: boolean = isInitial\n\n let dateCursor: number = initial\n ? moment
|
|
1
|
+
{"version":3,"file":"getNextWeekday.js","names":["moment","Unit","getNextWeekday","_ref","end","isInitial","options","start","timezone","_regeneratorRuntime","mark","_callee","duration","frequency","weekdays","durationUnit","durationValue","frequencyUnit","frequencyValue","initial","dateCursor","occurrenceCount","weekIteration","_iterator","_step","weekday","nextOccurrenceEnd","nextOccurrenceStart","nextOccurrence","nextDateCursor","_t","wrap","_context","prev","next","unit","value","tz","startOf","Week","valueOf","add","console","log","format","concat","_createForOfIteratorHelper","s","n","done","isoWeekday","Day","subtract","abrupt","e","f","finish","stop"],"sources":["../../../src/scheduling/strategies/getNextWeekday.ts"],"sourcesContent":["import moment from 'moment-timezone'\n\nimport { GetNext, Interval, Unit } from '../scheduling.types'\n\n/**\n * Generates next occurrence interval for weekdays strategy\n */\nexport function* getNextWeekday({\n end,\n isInitial,\n options,\n start,\n timezone,\n}: GetNext): IterableIterator<Interval> {\n const { duration, frequency, weekdays } = options\n const { unit: durationUnit, value: durationValue } = duration\n const { unit: frequencyUnit, value: frequencyValue } = frequency\n\n let initial: boolean = isInitial\n\n let dateCursor: number = initial\n ? moment.tz(start, timezone).startOf(Unit.Week).valueOf()\n : moment\n .tz(start, timezone)\n .add(frequencyValue, frequencyUnit)\n .startOf(Unit.Week)\n .valueOf()\n\n console.log('[getNextWeekday] START:', {\n start: moment.tz(start, timezone).format('YYYY-MM-DD HH:mm:ss Z'),\n end: moment.tz(end, timezone).format('YYYY-MM-DD HH:mm:ss Z'),\n dateCursor: moment.tz(dateCursor, timezone).format('YYYY-MM-DD HH:mm:ss Z'),\n isInitial,\n frequency: `${frequencyValue}${frequencyUnit}`,\n duration: `${durationValue}${durationUnit}`,\n weekdays,\n })\n\n let occurrenceCount = 0\n let weekIteration = 0\n while (dateCursor < end) {\n console.log(`[getNextWeekday] WEEK_ITERATION[${weekIteration}]:`, {\n dateCursor: moment.tz(dateCursor, timezone).format('YYYY-MM-DD'),\n })\n\n for (const weekday of weekdays) {\n const nextOccurrenceEnd: number = moment\n .tz(dateCursor, timezone)\n .isoWeekday(weekday)\n .add(1, Unit.Day)\n .startOf(Unit.Day)\n .valueOf()\n\n const nextOccurrenceStart: number = moment\n .tz(nextOccurrenceEnd, timezone)\n .subtract(durationValue, durationUnit)\n .valueOf()\n\n if (nextOccurrenceEnd <= nextOccurrenceStart || nextOccurrenceEnd > end) {\n console.log('[getNextWeekday] BOUNDARY CHECK FAILED:', {\n occurrenceCount,\n weekday,\n nextOccurrenceStart: moment\n .tz(nextOccurrenceStart, timezone)\n .format('YYYY-MM-DD HH:mm:ss Z'),\n nextOccurrenceEnd: moment\n .tz(nextOccurrenceEnd, timezone)\n .format('YYYY-MM-DD HH:mm:ss Z'),\n end: moment.tz(end, timezone).format('YYYY-MM-DD HH:mm:ss Z'),\n })\n return\n }\n\n if (nextOccurrenceStart >= start) {\n const nextOccurrence: Interval = [\n nextOccurrenceStart,\n nextOccurrenceEnd - 1,\n ]\n\n console.log(`[getNextWeekday] OCCURRENCE[${occurrenceCount}]:`, {\n weekday,\n start: moment\n .tz(nextOccurrenceStart, timezone)\n .format('YYYY-MM-DD HH:mm:ss Z'),\n end: moment\n .tz(nextOccurrenceEnd - 1, timezone)\n .format('YYYY-MM-DD HH:mm:ss Z'),\n })\n\n yield nextOccurrence\n occurrenceCount++\n\n initial = false\n }\n }\n\n const nextDateCursor: number = moment\n .tz(dateCursor, timezone)\n .add(1, Unit.Week)\n .valueOf()\n\n dateCursor = nextDateCursor\n weekIteration++\n }\n\n console.log('[getNextWeekday] COMPLETE:', { occurrenceCount })\n}\n"],"mappings":";;;;AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAEpC,SAA4BC,IAAI,QAAQ,qBAAqB;;AAE7D;AACA;AACA;AACA,OAAO,SAAUC,cAAcA,CAAAC,IAAA;EAAA,IAC7BC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IACHC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IACPC,KAAK,GAAAJ,IAAA,CAALI,KAAK;IACLC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;EAAA,oBAAAC,mBAAA,CAAAC,IAAA,UAAAC,QAAA;IAAA,IAAAC,QAAA,EAAAC,SAAA,EAAAC,QAAA,EAAAC,YAAA,EAAAC,aAAA,EAAAC,aAAA,EAAAC,cAAA,EAAAC,OAAA,EAAAC,UAAA,EAAAC,eAAA,EAAAC,aAAA,EAAAC,SAAA,EAAAC,KAAA,EAAAC,OAAA,EAAAC,iBAAA,EAAAC,mBAAA,EAAAC,cAAA,EAAAC,cAAA,EAAAC,EAAA;IAAA,OAAArB,mBAAA,CAAAsB,IAAA,WAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAEAtB,QAAQ,GAA0BN,OAAO,CAAzCM,QAAQ,EAAEC,SAAS,GAAeP,OAAO,CAA/BO,SAAS,EAAEC,QAAQ,GAAKR,OAAO,CAApBQ,QAAQ;UACvBC,YAAY,GAA2BH,QAAQ,CAArDuB,IAAI,EAAuBnB,aAAa,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