stentor-time 1.61.2 → 1.61.3
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/lib/Constants.d.ts +1 -1
- package/lib/Constants.js +1 -1
- package/lib/Constants.js.map +1 -1
- package/lib/TimeConditionalCheck.d.ts +5 -6
- package/lib/TimeConditionalCheck.js +33 -26
- package/lib/TimeConditionalCheck.js.map +1 -1
- package/lib/findLastActiveMatch.d.ts +3 -3
- package/lib/findLastActiveMatch.js +20 -41
- package/lib/findLastActiveMatch.js.map +1 -1
- package/lib/findMostSpecificSchedulable.d.ts +0 -9
- package/lib/findMostSpecificSchedulable.js +32 -72
- package/lib/findMostSpecificSchedulable.js.map +1 -1
- package/lib/findSchedulableMatch.d.ts +3 -2
- package/lib/findSchedulableMatch.js +112 -51
- package/lib/findSchedulableMatch.js.map +1 -1
- package/lib/normalizeLegacyFormat.d.ts +7 -0
- package/lib/normalizeLegacyFormat.js +135 -0
- package/lib/normalizeLegacyFormat.js.map +1 -0
- package/package.json +6 -7
package/lib/Constants.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! Copyright (c) 2019, XAPPmedia */
|
|
2
|
-
export declare const SCHEDULE_DEBUG_FORMAT = "M/
|
|
2
|
+
export declare const SCHEDULE_DEBUG_FORMAT = "M/d/yyyy H:mm:ss Z";
|
package/lib/Constants.js
CHANGED
|
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SCHEDULE_DEBUG_FORMAT = void 0;
|
|
4
4
|
/*! Copyright (c) 2019, XAPPmedia */
|
|
5
5
|
// Simple format for communicating times in debug statements
|
|
6
|
-
exports.SCHEDULE_DEBUG_FORMAT = "M/
|
|
6
|
+
exports.SCHEDULE_DEBUG_FORMAT = "M/d/yyyy H:mm:ss Z";
|
|
7
7
|
//# sourceMappingURL=Constants.js.map
|
package/lib/Constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../src/Constants.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,4DAA4D;AAC/C,QAAA,qBAAqB,GAAG,
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../src/Constants.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,4DAA4D;AAC/C,QAAA,qBAAqB,GAAG,oBAAoB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConditionalCheck, DurationFormat } from "stentor-models";
|
|
2
2
|
/**
|
|
3
3
|
* Depending on the provided last active timestamp and current time, has the user
|
|
4
|
-
* been active within
|
|
4
|
+
* been active within the specified duration.
|
|
5
5
|
*
|
|
6
6
|
* @param context - Contains the last active timestamp
|
|
7
7
|
* @param amount - Duration amount
|
|
@@ -13,18 +13,17 @@ export declare function activeWithin(context: {
|
|
|
13
13
|
/**
|
|
14
14
|
* Is the current time within the provided schedule.
|
|
15
15
|
*
|
|
16
|
-
* @param start - Start date
|
|
16
|
+
* @param start - Start date string
|
|
17
17
|
* @param startFormat - Format of the start date string
|
|
18
|
-
* @param duration - Duration
|
|
18
|
+
* @param duration - Duration amount
|
|
19
19
|
* @param durationFormat - Format of the duration
|
|
20
20
|
* @param timeZone - Optional time zone
|
|
21
21
|
*/
|
|
22
22
|
export declare function fitsSchedule(start: string, startFormat: string, duration: number, durationFormat: DurationFormat, timeZone?: string): boolean;
|
|
23
23
|
/**
|
|
24
|
-
* Generate a time conditional check for the
|
|
25
|
-
* context with last active timestamp.
|
|
24
|
+
* Generate a time-based conditional check for the given context.
|
|
26
25
|
*
|
|
27
|
-
* @param context
|
|
26
|
+
* @param context - Object containing lastActiveTimestamp
|
|
28
27
|
*/
|
|
29
28
|
export declare function TimeConditionalCheck<T extends object>(context: {
|
|
30
29
|
lastActiveTimestamp: number;
|
|
@@ -4,28 +4,37 @@ exports.activeWithin = activeWithin;
|
|
|
4
4
|
exports.fitsSchedule = fitsSchedule;
|
|
5
5
|
exports.TimeConditionalCheck = TimeConditionalCheck;
|
|
6
6
|
/*! Copyright (c) 2020, XAPPmedia */
|
|
7
|
-
const Moment = require("moment");
|
|
8
|
-
const moment_range_1 = require("moment-range");
|
|
9
7
|
const stentor_logger_1 = require("stentor-logger");
|
|
10
8
|
const stentor_guards_1 = require("stentor-guards");
|
|
9
|
+
const stentor_utils_1 = require("stentor-utils");
|
|
11
10
|
const findTimeContextualMatch_1 = require("./findTimeContextualMatch");
|
|
12
11
|
const findSchedulableMatch_1 = require("./findSchedulableMatch");
|
|
13
|
-
|
|
14
|
-
const moment = (0, moment_range_1.extendMoment)(Moment);
|
|
12
|
+
const normalizeLegacyFormat_1 = require("./normalizeLegacyFormat");
|
|
15
13
|
/**
|
|
16
14
|
* Depending on the provided last active timestamp and current time, has the user
|
|
17
|
-
* been active within
|
|
15
|
+
* been active within the specified duration.
|
|
18
16
|
*
|
|
19
17
|
* @param context - Contains the last active timestamp
|
|
20
18
|
* @param amount - Duration amount
|
|
21
19
|
* @param format - Format of the duration amount
|
|
22
20
|
*/
|
|
23
21
|
function activeWithin(context, amount, format) {
|
|
24
|
-
const now =
|
|
25
|
-
const lastActive = context.lastActiveTimestamp
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
const now = Date.now();
|
|
23
|
+
const lastActive = context.lastActiveTimestamp;
|
|
24
|
+
if (typeof amount !== "number" || isNaN(amount) || amount < 0 || typeof format !== "string") {
|
|
25
|
+
(0, stentor_logger_1.log)().warn(`Invalid activeWithin params: amount=${amount}, format=${format}`);
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
let durationMs;
|
|
29
|
+
try {
|
|
30
|
+
durationMs = (0, stentor_utils_1.getDurationMs)(amount, format);
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
(0, stentor_logger_1.log)().warn(`activeWithin failed to get durationMs for ${amount} ${format}`, err);
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
const rangeStart = now - durationMs;
|
|
37
|
+
if (lastActive !== undefined && lastActive >= rangeStart && lastActive <= now) {
|
|
29
38
|
(0, stentor_logger_1.log)().debug(`User was active within ${amount} ${format}`);
|
|
30
39
|
return true;
|
|
31
40
|
}
|
|
@@ -35,40 +44,41 @@ function activeWithin(context, amount, format) {
|
|
|
35
44
|
/**
|
|
36
45
|
* Is the current time within the provided schedule.
|
|
37
46
|
*
|
|
38
|
-
* @param start - Start date
|
|
47
|
+
* @param start - Start date string
|
|
39
48
|
* @param startFormat - Format of the start date string
|
|
40
|
-
* @param duration - Duration
|
|
49
|
+
* @param duration - Duration amount
|
|
41
50
|
* @param durationFormat - Format of the duration
|
|
42
51
|
* @param timeZone - Optional time zone
|
|
43
52
|
*/
|
|
44
53
|
function fitsSchedule(start, startFormat, duration, durationFormat, timeZone) {
|
|
54
|
+
// Convert legacy Moment.js format to Luxon format
|
|
55
|
+
const normalizedFormat = (0, normalizeLegacyFormat_1.normalizeLegacyFormat)(startFormat);
|
|
45
56
|
const schedule = {
|
|
46
57
|
schedule: {
|
|
47
58
|
start: {
|
|
48
59
|
time: start,
|
|
49
|
-
format:
|
|
50
|
-
timeZone
|
|
60
|
+
format: normalizedFormat,
|
|
61
|
+
timeZone,
|
|
51
62
|
},
|
|
52
63
|
duration: {
|
|
53
64
|
amount: duration,
|
|
54
|
-
format: durationFormat
|
|
55
|
-
}
|
|
56
|
-
}
|
|
65
|
+
format: durationFormat,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
57
68
|
};
|
|
58
69
|
const fitSchedule = !!(0, findSchedulableMatch_1.findSchedulableMatch)([schedule]);
|
|
59
70
|
if (!fitSchedule) {
|
|
60
|
-
(0, stentor_logger_1.log)().debug(`Schedule starting ${start}, with format ${startFormat}, and running for ${duration} ${durationFormat} did NOT fit.
|
|
71
|
+
(0, stentor_logger_1.log)().debug(`Schedule starting ${start}, with format ${startFormat} (normalized: ${normalizedFormat}), and running for ${duration} ${durationFormat} did NOT fit. Current date ${new Date().toISOString()}`);
|
|
61
72
|
}
|
|
62
73
|
else {
|
|
63
|
-
(0, stentor_logger_1.log)().debug(`Schedule starting ${start}, with format ${startFormat}, and running for ${duration} ${durationFormat} fits.`);
|
|
74
|
+
(0, stentor_logger_1.log)().debug(`Schedule starting ${start}, with format ${startFormat} (normalized: ${normalizedFormat}), and running for ${duration} ${durationFormat} fits.`);
|
|
64
75
|
}
|
|
65
76
|
return fitSchedule;
|
|
66
77
|
}
|
|
67
78
|
/**
|
|
68
|
-
* Generate a time conditional check for the
|
|
69
|
-
* context with last active timestamp.
|
|
79
|
+
* Generate a time-based conditional check for the given context.
|
|
70
80
|
*
|
|
71
|
-
* @param context
|
|
81
|
+
* @param context - Object containing lastActiveTimestamp
|
|
72
82
|
*/
|
|
73
83
|
function TimeConditionalCheck(context) {
|
|
74
84
|
return {
|
|
@@ -76,10 +86,7 @@ function TimeConditionalCheck(context) {
|
|
|
76
86
|
check: (obj) => {
|
|
77
87
|
return !!(0, findTimeContextualMatch_1.findTimeContextualMatch)([obj], context);
|
|
78
88
|
},
|
|
79
|
-
functions: [
|
|
80
|
-
activeWithin.bind(null, context),
|
|
81
|
-
fitsSchedule
|
|
82
|
-
]
|
|
89
|
+
functions: [activeWithin.bind(null, context), fitsSchedule],
|
|
83
90
|
};
|
|
84
91
|
}
|
|
85
92
|
//# sourceMappingURL=TimeConditionalCheck.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeConditionalCheck.js","sourceRoot":"","sources":["../src/TimeConditionalCheck.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"TimeConditionalCheck.js","sourceRoot":"","sources":["../src/TimeConditionalCheck.ts"],"names":[],"mappings":";;AAkBA,oCA+BC;AAWD,oCAqCC;AAOD,oDAQC;AAhHD,oCAAoC;AACpC,mDAAqC;AAErC,mDAAkD;AAClD,iDAA8C;AAE9C,uEAAoE;AACpE,iEAA8D;AAC9D,mE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ds the most relevant contextual match.
|
|
4
4
|
*
|
|
5
|
-
* @param
|
|
6
|
-
* @param
|
|
7
|
-
* @returns
|
|
5
|
+
* @param responses
|
|
6
|
+
* @param context
|
|
7
|
+
* @returns
|
|
8
8
|
*/
|
|
9
9
|
export declare function findLastActiveMatch<T extends object>(responses: (T | LastActive<T>)[], context: {
|
|
10
10
|
lastActiveTimestamp?: number;
|
|
@@ -1,65 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findLastActiveMatch = findLastActiveMatch;
|
|
4
|
-
/*! Copyright (c)
|
|
4
|
+
/*! Copyright (c) 2025, XAPP AI */
|
|
5
5
|
const stentor_guards_1 = require("stentor-guards");
|
|
6
|
-
const
|
|
7
|
-
const moment_range_1 = require("moment-range");
|
|
8
|
-
// Add the range plugin to moment
|
|
9
|
-
const moment = (0, moment_range_1.extendMoment)(Moment);
|
|
6
|
+
const stentor_utils_1 = require("stentor-utils");
|
|
10
7
|
/**
|
|
11
8
|
* Finds the most relevant contextual match.
|
|
12
9
|
*
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
15
|
-
* @returns
|
|
10
|
+
* @param responses
|
|
11
|
+
* @param context
|
|
12
|
+
* @returns
|
|
16
13
|
*/
|
|
17
14
|
function findLastActiveMatch(responses, context) {
|
|
18
15
|
if (!Array.isArray(responses) || !context) {
|
|
19
|
-
// Exit conditions, no array or context then bail
|
|
20
16
|
return undefined;
|
|
21
17
|
}
|
|
22
|
-
const now =
|
|
23
|
-
const lastActive = context.lastActiveTimestamp
|
|
18
|
+
const now = Date.now();
|
|
19
|
+
const lastActive = context.lastActiveTimestamp;
|
|
24
20
|
let contextualResponse;
|
|
25
|
-
let
|
|
21
|
+
let smallestRangeMs;
|
|
26
22
|
for (const response of responses) {
|
|
27
|
-
// Make sure activeWithin exists, might have gotten bad data
|
|
28
23
|
if ((0, stentor_guards_1.isActiveWithin)(response)) {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// Then see if the last time we saw them is within the range
|
|
35
|
-
if (lastActive && range.contains(lastActive)) {
|
|
36
|
-
// It is in range, see if we keep it...
|
|
37
|
-
if (!withinRange) {
|
|
38
|
-
// If nothing previous, set it
|
|
24
|
+
const { amount, format } = response.activeWithin;
|
|
25
|
+
const durationMs = (0, stentor_utils_1.getDurationMs)(amount, format);
|
|
26
|
+
const rangeStart = now - durationMs;
|
|
27
|
+
if (lastActive !== undefined && lastActive >= rangeStart && lastActive <= now) {
|
|
28
|
+
if (contextualResponse === undefined || durationMs < smallestRangeMs) {
|
|
39
29
|
contextualResponse = response;
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
else if (range < withinRange) {
|
|
43
|
-
// If the new range is smaller than the previous
|
|
44
|
-
contextualResponse = response;
|
|
45
|
-
withinRange = range;
|
|
30
|
+
smallestRangeMs = durationMs;
|
|
46
31
|
}
|
|
47
32
|
}
|
|
48
33
|
}
|
|
49
34
|
else if ((0, stentor_guards_1.isHaveNotSeenWithin)(response)) {
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (lastActive && !range.contains(lastActive)) {
|
|
56
|
-
if (!withinRange) {
|
|
57
|
-
contextualResponse = response;
|
|
58
|
-
withinRange = range;
|
|
59
|
-
}
|
|
60
|
-
else if (range < withinRange) {
|
|
35
|
+
const { amount, format } = response.haveNotSeenWithin;
|
|
36
|
+
const durationMs = (0, stentor_utils_1.getDurationMs)(amount, format);
|
|
37
|
+
const rangeStart = now - durationMs;
|
|
38
|
+
if (lastActive !== undefined && (lastActive < rangeStart || lastActive > now)) {
|
|
39
|
+
if (contextualResponse === undefined || durationMs < smallestRangeMs) {
|
|
61
40
|
contextualResponse = response;
|
|
62
|
-
|
|
41
|
+
smallestRangeMs = durationMs;
|
|
63
42
|
}
|
|
64
43
|
}
|
|
65
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findLastActiveMatch.js","sourceRoot":"","sources":["../src/findLastActiveMatch.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"findLastActiveMatch.js","sourceRoot":"","sources":["../src/findLastActiveMatch.ts"],"names":[],"mappings":";;AAYA,kDAgDC;AA5DD,kCAAkC;AAClC,mDAAkF;AAElF,iDAA8C;AAE9C;;;;;;GAMG;AACH,SAAgB,mBAAmB,CACjC,SAAgC,EAChC,OAAyC;IAEzC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAC1C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAE/C,IAAI,kBAAiC,CAAC;IACtC,IAAI,eAAuB,CAAC;IAE5B,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,IAAA,+BAAc,EAAC,QAAQ,CAAC,EAAE,CAAC;YAC7B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,YAAY,CAAC;YACjD,MAAM,UAAU,GAAG,IAAA,6BAAa,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACjD,MAAM,UAAU,GAAG,GAAG,GAAG,UAAU,CAAC;YAEpC,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,IAAI,UAAU,IAAI,UAAU,IAAI,GAAG,EAAE,CAAC;gBAC9E,IAAI,kBAAkB,KAAK,SAAS,IAAI,UAAU,GAAG,eAAe,EAAE,CAAC;oBACrE,kBAAkB,GAAG,QAAQ,CAAC;oBAC9B,eAAe,GAAG,UAAU,CAAC;gBAC/B,CAAC;YACH,CAAC;QACH,CAAC;aAAM,IAAI,IAAA,oCAAmB,EAAC,QAAQ,CAAC,EAAE,CAAC;YACzC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,iBAAiB,CAAC;YACtD,MAAM,UAAU,GAAG,IAAA,6BAAa,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACjD,MAAM,UAAU,GAAG,GAAG,GAAG,UAAU,CAAC;YAEpC,IAAI,UAAU,KAAK,SAAS,IAAI,CAAC,UAAU,GAAG,UAAU,IAAI,UAAU,GAAG,GAAG,CAAC,EAAE,CAAC;gBAC9E,IAAI,kBAAkB,KAAK,SAAS,IAAI,UAAU,GAAG,eAAe,EAAE,CAAC;oBACrE,kBAAkB,GAAG,QAAQ,CAAC;oBAC9B,eAAe,GAAG,UAAU,CAAC;gBAC/B,CAAC;YACH,CAAC;QACH,CAAC;aAAM,IAAI,IAAA,4BAAW,EAAC,QAAQ,CAAC,EAAE,CAAC;YACjC,+CAA+C;YAC/C,qDAAqD;YACrD,oBAAoB;YACpB,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,kBAAkB,GAAG,QAAQ,CAAC;YAChC,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,kBAAkB,CAAC;AAC5B,CAAC"}
|
|
@@ -7,14 +7,5 @@ export interface ScheduleFormatScores {
|
|
|
7
7
|
[format: string]: ScheduleFormatScore;
|
|
8
8
|
}
|
|
9
9
|
export declare const SCHEDULE_FORMAT_SCORES: ScheduleFormatScores;
|
|
10
|
-
/**
|
|
11
|
-
* Determine schedule specificity score, the higher the value
|
|
12
|
-
* the more specific the schedule is.
|
|
13
|
-
*/
|
|
14
10
|
export declare function determineSpecificityScore<T extends object>(scheduled: Scheduled<T> | undefined): number;
|
|
15
|
-
/**
|
|
16
|
-
* Finds the most specific schedule.
|
|
17
|
-
*
|
|
18
|
-
* If the array does not contain any scheduled objects, undefined is returned.
|
|
19
|
-
*/
|
|
20
11
|
export declare function findMostSpecificSchedulable<T extends object>(schedules: (T | Scheduled<T>)[] | undefined): Scheduled<T> | undefined;
|
|
@@ -3,103 +3,63 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SCHEDULE_FORMAT_SCORES = void 0;
|
|
4
4
|
exports.determineSpecificityScore = determineSpecificityScore;
|
|
5
5
|
exports.findMostSpecificSchedulable = findMostSpecificSchedulable;
|
|
6
|
-
/*! Copyright (c)
|
|
6
|
+
/*! Copyright (c) 2025, XAPP AI */
|
|
7
7
|
const stentor_guards_1 = require("stentor-guards");
|
|
8
|
-
const moment = require("moment-timezone");
|
|
9
8
|
exports.SCHEDULE_FORMAT_SCORES = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
["A"]: { score: 1 },
|
|
28
|
-
// Minutes, applies to both m and mm
|
|
29
|
-
["m"]: { score: 1 }
|
|
9
|
+
YYYY: { score: 1 }, // moment
|
|
10
|
+
YY: { score: 1 }, // moment
|
|
11
|
+
yyyy: { score: 1 }, // luxon
|
|
12
|
+
M: { score: 1 },
|
|
13
|
+
MM: { score: 1 },
|
|
14
|
+
D: { score: 1 },
|
|
15
|
+
DD: { score: 1 },
|
|
16
|
+
dd: { score: 1 },
|
|
17
|
+
DDD: { score: 2 },
|
|
18
|
+
H: { score: 2 },
|
|
19
|
+
HH: { score: 2 },
|
|
20
|
+
h: { score: 1 },
|
|
21
|
+
hh: { score: 1 },
|
|
22
|
+
a: { score: 1 },
|
|
23
|
+
A: { score: 1 },
|
|
24
|
+
m: { score: 1 },
|
|
25
|
+
mm: { score: 1 },
|
|
30
26
|
};
|
|
31
|
-
/**
|
|
32
|
-
* Determine schedule specificity score, the higher the value
|
|
33
|
-
* the more specific the schedule is.
|
|
34
|
-
*/
|
|
35
27
|
function determineSpecificityScore(scheduled) {
|
|
36
|
-
|
|
28
|
+
var _a, _b;
|
|
37
29
|
if (!scheduled || !scheduled.schedule) {
|
|
38
30
|
return 0;
|
|
39
31
|
}
|
|
40
32
|
const schedule = scheduled.schedule;
|
|
41
33
|
const start = schedule.start;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
// If it doesn't use the defaultFormat from moment
|
|
46
|
-
// which is what we use as the default
|
|
47
|
-
format = moment.defaultFormat;
|
|
48
|
-
}
|
|
34
|
+
const format = (_a = start.format) !== null && _a !== void 0 ? _a : "yyyy-MM-dd'T'HH:mm:ssZZ";
|
|
35
|
+
const tokenRegex = /Y{2,4}|M{1,2}|D{1,4}|H{1,2}|h{1,2}|m{1,2}|s{1,2}|a|A|Z{1,2}/g;
|
|
36
|
+
const tokens = (_b = format.match(tokenRegex)) !== null && _b !== void 0 ? _b : [];
|
|
49
37
|
let score = 0;
|
|
50
|
-
// Not in the format but adds specificity
|
|
51
38
|
if (start.dayOfWeek) {
|
|
52
39
|
score += 1;
|
|
53
40
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (format.includes(key)) {
|
|
59
|
-
// add the score
|
|
60
|
-
score += formatScore.score;
|
|
41
|
+
for (const token of tokens) {
|
|
42
|
+
const tokenScore = exports.SCHEDULE_FORMAT_SCORES[token];
|
|
43
|
+
if (tokenScore) {
|
|
44
|
+
score += tokenScore.score;
|
|
61
45
|
}
|
|
62
|
-
}
|
|
46
|
+
}
|
|
63
47
|
return score;
|
|
64
48
|
}
|
|
65
|
-
/**
|
|
66
|
-
* Finds the most specific schedule.
|
|
67
|
-
*
|
|
68
|
-
* If the array does not contain any scheduled objects, undefined is returned.
|
|
69
|
-
*/
|
|
70
49
|
function findMostSpecificSchedulable(schedules) {
|
|
71
|
-
|
|
72
|
-
// doesn't exist
|
|
73
|
-
if (!schedules) {
|
|
50
|
+
if (!Array.isArray(schedules) || schedules.length === 0)
|
|
74
51
|
return undefined;
|
|
75
|
-
}
|
|
76
|
-
// empty array
|
|
77
|
-
if (schedules.length === 0) {
|
|
78
|
-
return undefined;
|
|
79
|
-
}
|
|
80
|
-
// only one in the array, just return it
|
|
81
|
-
if (schedules.length === 1) {
|
|
82
|
-
const firstItem = schedules[0];
|
|
83
|
-
if ((0, stentor_guards_1.isScheduled)(firstItem)) {
|
|
84
|
-
return firstItem;
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
return undefined;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
52
|
let mostSpecific;
|
|
91
53
|
let currentScore = 0;
|
|
92
|
-
|
|
93
|
-
if (!(0, stentor_guards_1.isScheduled)(scheduled))
|
|
94
|
-
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
54
|
+
for (const scheduled of schedules) {
|
|
55
|
+
if (!(0, stentor_guards_1.isScheduled)(scheduled))
|
|
56
|
+
continue;
|
|
97
57
|
const score = determineSpecificityScore(scheduled);
|
|
98
58
|
if (score > currentScore) {
|
|
99
59
|
mostSpecific = scheduled;
|
|
100
60
|
currentScore = score;
|
|
101
61
|
}
|
|
102
|
-
}
|
|
62
|
+
}
|
|
103
63
|
return mostSpecific;
|
|
104
64
|
}
|
|
105
65
|
//# sourceMappingURL=findMostSpecificSchedulable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findMostSpecificSchedulable.js","sourceRoot":"","sources":["../src/findMostSpecificSchedulable.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"findMostSpecificSchedulable.js","sourceRoot":"","sources":["../src/findMostSpecificSchedulable.ts"],"names":[],"mappings":";;;AAiCA,8DA2BC;AAED,kEAkBC;AAhFD,kCAAkC;AAClC,mDAA6C;AAYhC,QAAA,sBAAsB,GAAyB;IAC1D,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,SAAS;IAC7B,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,SAAS;IAC3B,IAAI,EAAE,EA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C;QACpB,KAAK,IAAI,CAAC,CAAC;IACb,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,UAAU,GAAG,8BAAsB,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,UAAU,EAAE,CAAC;YACf,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAgB,2BAA2B,CACzC,SAA2C;IAE3C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAE1E,IAAI,YAAsC,CAAC;IAC3C,IAAI,YAAY,GAAG,CAAC,CAAC;IAErB,KAAK,MAAM,SAAS,IAAI,SAAS,EAAE,CAAC;QAClC,IAAI,CAAC,IAAA,4BAAW,EAAC,SAAS,CAAC;YAAE,SAAS;QACtC,MAAM,KAAK,GAAG,yBAAyB,CAAC,SAAS,CAAC,CAAC;QACnD,IAAI,KAAK,GAAG,YAAY,EAAE,CAAC;YACzB,YAAY,GAAG,SAAS,CAAC;YACzB,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
/*! Copyright (c) 2025, XAPP AI */
|
|
2
|
+
import { DateTime } from "luxon";
|
|
1
3
|
import { Scheduled } from "stentor-models";
|
|
2
|
-
import * as moment from "moment-timezone";
|
|
3
4
|
/**
|
|
4
5
|
* Within a list of Schedulables, find a match for the provided time
|
|
5
6
|
* or current time if no time is provided.
|
|
6
7
|
*/
|
|
7
|
-
export declare function findSchedulableMatch<T extends object>(schedules: (T | Scheduled<T>)[] | undefined,
|
|
8
|
+
export declare function findSchedulableMatch<T extends object>(schedules: (T | Scheduled<T>)[] | undefined, baseNowInput?: DateTime): Scheduled<T> | undefined;
|
|
@@ -1,88 +1,149 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findSchedulableMatch = findSchedulableMatch;
|
|
4
|
-
/*! Copyright (c)
|
|
4
|
+
/*! Copyright (c) 2025, XAPP AI */
|
|
5
|
+
const luxon_1 = require("luxon");
|
|
5
6
|
const stentor_guards_1 = require("stentor-guards");
|
|
6
|
-
const moment = require("moment-timezone");
|
|
7
7
|
const findMostSpecificSchedulable_1 = require("./findMostSpecificSchedulable");
|
|
8
8
|
const stentor_logger_1 = require("stentor-logger");
|
|
9
|
+
function normalizeDurationUnit(unit) {
|
|
10
|
+
switch (unit.toLowerCase()) {
|
|
11
|
+
case "ms":
|
|
12
|
+
case "millisecond":
|
|
13
|
+
case "milliseconds":
|
|
14
|
+
return "milliseconds";
|
|
15
|
+
case "s":
|
|
16
|
+
case "second":
|
|
17
|
+
case "seconds":
|
|
18
|
+
return "seconds";
|
|
19
|
+
case "m":
|
|
20
|
+
case "minute":
|
|
21
|
+
case "minutes":
|
|
22
|
+
return "minutes";
|
|
23
|
+
case "h":
|
|
24
|
+
case "hour":
|
|
25
|
+
case "hours":
|
|
26
|
+
return "hours";
|
|
27
|
+
case "d":
|
|
28
|
+
case "day":
|
|
29
|
+
case "days":
|
|
30
|
+
return "days";
|
|
31
|
+
default:
|
|
32
|
+
throw new Error(`Invalid unit ${unit}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
9
35
|
/**
|
|
10
36
|
* Within a list of Schedulables, find a match for the provided time
|
|
11
37
|
* or current time if no time is provided.
|
|
12
38
|
*/
|
|
13
|
-
function findSchedulableMatch(schedules,
|
|
39
|
+
function findSchedulableMatch(schedules, baseNowInput = luxon_1.DateTime.now().toUTC()) {
|
|
14
40
|
if (!Array.isArray(schedules)) {
|
|
15
|
-
// bail if no schedule was passed in
|
|
16
41
|
return undefined;
|
|
17
42
|
}
|
|
43
|
+
const baseNow = baseNowInput !== null && baseNowInput !== void 0 ? baseNowInput : luxon_1.DateTime.now().toUTC();
|
|
18
44
|
const matches = [];
|
|
19
|
-
|
|
45
|
+
for (const item of schedules) {
|
|
20
46
|
if (!(0, stentor_guards_1.isScheduled)(item)) {
|
|
21
|
-
|
|
22
|
-
|
|
47
|
+
(0, stentor_logger_1.log)().debug(`Item is not scheduled: ${JSON.stringify(item)}, skipping`);
|
|
48
|
+
continue;
|
|
23
49
|
}
|
|
24
|
-
let start;
|
|
25
50
|
const { time, format, timeZone, dayOfWeek } = item.schedule.start;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
const now = timeZone ? baseNow.setZone(timeZone) : baseNow;
|
|
52
|
+
let start;
|
|
53
|
+
if (format) {
|
|
54
|
+
let patchedFormat = format;
|
|
55
|
+
const patchedTime = time;
|
|
56
|
+
// Legacy format handling: H:mm Z D
|
|
57
|
+
if (format === "H:mm Z D") {
|
|
58
|
+
const match = time.match(/^(\d{1,2}:\d{2}) ([+-]\d{4}) (\d)$/);
|
|
59
|
+
if (match) {
|
|
60
|
+
const [, timePart, offset, legacyDayOfWeek] = match;
|
|
61
|
+
// Legacy format day mapping: directly map to the target date in March 2017
|
|
62
|
+
// The 'D' token represents day-of-month, not day-of-week
|
|
63
|
+
const legacyDay = parseInt(legacyDayOfWeek);
|
|
64
|
+
const targetDate = luxon_1.DateTime.fromObject({ year: 2017, month: 3, day: legacyDay, hour: 0 }, { zone: "America/New_York" });
|
|
65
|
+
const fullDate = targetDate.toFormat("yyyy-MM-dd");
|
|
66
|
+
const [h, m] = timePart.split(":");
|
|
67
|
+
const normalizedTime = `${h.padStart(2, "0")}:${m}`;
|
|
68
|
+
const fullTime = `${fullDate} ${normalizedTime} ${offset}`;
|
|
69
|
+
const parsed = luxon_1.DateTime.fromFormat(fullTime, "yyyy-MM-dd HH:mm ZZZ", {
|
|
70
|
+
setZone: true,
|
|
71
|
+
locale: "en",
|
|
72
|
+
});
|
|
73
|
+
start = parsed;
|
|
74
|
+
}
|
|
42
75
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// 1st case, they don't give month
|
|
48
|
-
if (!format.includes("M")) {
|
|
49
|
-
const month = now.month();
|
|
50
|
-
start.month(month);
|
|
76
|
+
else {
|
|
77
|
+
// Normal format-based parsing
|
|
78
|
+
if ((format === null || format === void 0 ? void 0 : format.includes("Z")) && /\bZ\b/.test(time)) {
|
|
79
|
+
patchedFormat = format.replace("Z", "'Z'");
|
|
51
80
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
81
|
+
start = luxon_1.DateTime.fromFormat(patchedTime, patchedFormat, {
|
|
82
|
+
zone: timeZone || baseNow.zone,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
start = luxon_1.DateTime.fromISO(time, { zone: timeZone || baseNow.zone });
|
|
88
|
+
}
|
|
89
|
+
if (!start.isValid) {
|
|
90
|
+
(0, stentor_logger_1.log)().debug(`Invalid start date for schedule: time=${time}, format=${format}`, start.invalidReason, start.invalidExplanation);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
// Patch missing date parts like moment-timezone
|
|
94
|
+
if (format) {
|
|
95
|
+
const hasYear = format.includes("y") || format.includes("Y");
|
|
96
|
+
const hasMonth = format.includes("M");
|
|
97
|
+
const hasDay = format.includes("d") || format.includes("D");
|
|
98
|
+
const hasDayOfYear = format.includes("o") || format.includes("D"); // luxon uses `o` for day-of-year
|
|
99
|
+
if (!(hasYear && hasMonth && hasDay)) {
|
|
100
|
+
if (!hasYear) {
|
|
101
|
+
start = start.set({ year: now.year });
|
|
102
|
+
}
|
|
103
|
+
if (!hasDayOfYear) {
|
|
104
|
+
if (!hasMonth) {
|
|
105
|
+
start = start.set({ month: now.month });
|
|
106
|
+
}
|
|
107
|
+
if (!hasDay) {
|
|
108
|
+
start = start.set({ day: now.day });
|
|
109
|
+
}
|
|
56
110
|
}
|
|
57
111
|
}
|
|
58
112
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
113
|
+
// Compute end time
|
|
114
|
+
const durationAmount = item.schedule.duration.amount;
|
|
115
|
+
const durationFormat = item.schedule.duration.format;
|
|
116
|
+
let duration;
|
|
117
|
+
try {
|
|
118
|
+
const normalized = normalizeDurationUnit(durationFormat);
|
|
119
|
+
duration = luxon_1.Duration.fromObject({ [normalized]: durationAmount });
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
(0, stentor_logger_1.log)().debug(`Unsupported duration format: ${durationFormat}`);
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
const end = start.plus(duration);
|
|
126
|
+
// Check day of week if applicable (skip for legacy format since it's already encoded in start time)
|
|
62
127
|
let correctDayOfWeek = true;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// day of week string, make that a false
|
|
67
|
-
// This uses includes because dayOfWeek can be `0124` to denote multiple days of the week
|
|
68
|
-
if (!item.schedule.start.dayOfWeek.includes(now.weekday().toString())) {
|
|
128
|
+
if (dayOfWeek && format !== "H:mm Z D") {
|
|
129
|
+
const currentDow = now.weekday % 7; // 0 (Sun) – 6 (Sat)
|
|
130
|
+
if (!dayOfWeek.includes(currentDow.toString())) {
|
|
69
131
|
correctDayOfWeek = false;
|
|
70
132
|
}
|
|
71
133
|
}
|
|
134
|
+
// Match if now is within [start, end)
|
|
72
135
|
if (correctDayOfWeek) {
|
|
73
|
-
|
|
74
|
-
// the start but exclude the end
|
|
75
|
-
if (now.isBetween(start, end, undefined, "[)")) {
|
|
136
|
+
if (now >= start && now < end) {
|
|
76
137
|
matches.push(item);
|
|
77
138
|
}
|
|
78
139
|
else {
|
|
79
|
-
(0, stentor_logger_1.log)().debug(`Schedule starting ${time}, with format ${format}, and duration ${
|
|
140
|
+
(0, stentor_logger_1.log)().debug(`Schedule starting ${time}, with format ${format}, and duration ${durationAmount} ${durationFormat} was NOT in-between ${start.toISO()} --> ${end.toISO()}`);
|
|
80
141
|
}
|
|
81
142
|
}
|
|
82
143
|
else {
|
|
83
|
-
(0, stentor_logger_1.log)().debug(`Incorrect day of the week for schedule starting ${time}, with format ${format}, and duration ${
|
|
144
|
+
(0, stentor_logger_1.log)().debug(`Incorrect day of the week for schedule starting ${time}, with format ${format}, and duration ${durationAmount} ${durationFormat}`);
|
|
84
145
|
}
|
|
85
|
-
}
|
|
146
|
+
}
|
|
86
147
|
return (0, findMostSpecificSchedulable_1.findMostSpecificSchedulable)(matches);
|
|
87
148
|
}
|
|
88
149
|
//# sourceMappingURL=findSchedulableMatch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findSchedulableMatch.js","sourceRoot":"","sources":["../src/findSchedulableMatch.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"findSchedulableMatch.js","sourceRoot":"","sources":["../src/findSchedulableMatch.ts"],"names":[],"mappings":";;AAsCA,oDA6IC;AAnLD,kCAAkC;AAClC,iCAA2C;AAC3C,mDAA6C;AAE7C,+EAA4E;AAC5E,mDAAqC;AAErC,SAAS,qBAAqB,CAAC,IAAY;IACzC,QAAQ,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QAC3B,KAAK,IAAI,CAAC;QACV,KAAK,aAAa,CAAC;QACnB,KAAK,cAAc;YACjB,OAAO,cAAc,CAAC;QACxB,KAAK,GAAG,CAAC;QACT,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,GAAG,CAAC;QACT,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,GAAG,CA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AAE,CAAC;gBAC/C,gBAAgB,GAAG,KAAK,CAAC;YAC3B,CAAC;QACH,CAAC;QAED,sCAAsC;QACtC,IAAI,gBAAgB,EAAE,CAAC;YACrB,IAAI,GAAG,IAAI,KAAK,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC;gBAC9B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC;iBAAM,CAAC;gBACN,IAAA,oBAAG,GAAE,CAAC,KAAK,CACT,qBAAqB,IAAI,iBAAiB,MAAM,kBAAkB,cAAc,IAAI,cAAc,uBAAuB,KAAK,CAAC,KAAK,EAAE,QAAQ,GAAG,CAAC,KAAK,EAAE,EAAE,CAC5J,CAAC;YACJ,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAA,oBAAG,GAAE,CAAC,KAAK,CACT,mDAAmD,IAAI,iBAAiB,MAAM,kBAAkB,cAAc,IAAI,cAAc,EAAE,CACnI,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,IAAA,yDAA2B,EAAC,OAAO,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*! Copyright (c) 2025, XAPP AI */
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes legacy Moment.js format strings to Luxon format strings
|
|
4
|
+
* @param momentFormat - The Moment.js format string
|
|
5
|
+
* @returns The equivalent Luxon format string
|
|
6
|
+
*/
|
|
7
|
+
export declare function normalizeLegacyFormat(momentFormat: string): string;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*! Copyright (c) 2025, XAPP AI */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.normalizeLegacyFormat = normalizeLegacyFormat;
|
|
5
|
+
// Helper function to escape special regex characters
|
|
6
|
+
function escapeRegex(string) {
|
|
7
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Normalizes legacy Moment.js format strings to Luxon format strings
|
|
11
|
+
* @param momentFormat - The Moment.js format string
|
|
12
|
+
* @returns The equivalent Luxon format string
|
|
13
|
+
*/
|
|
14
|
+
function normalizeLegacyFormat(momentFormat) {
|
|
15
|
+
// Special case: handle YYYY-MM-DDTmm:ss which appears to be a typo/legacy format
|
|
16
|
+
// where mm:ss should be HH:mm (hours:minutes not minutes:seconds)
|
|
17
|
+
if (momentFormat === "YYYY-MM-DDTmm:ss") {
|
|
18
|
+
return "yyyy-MM-dd'T'HH:mm";
|
|
19
|
+
}
|
|
20
|
+
// Quick check: if format looks like it's already Luxon-style (lowercase yyyy, dd in date context), return as-is
|
|
21
|
+
// Use bounded matching to prevent ReDoS attacks
|
|
22
|
+
if (/yyyy[^M]{0,10}-MM-dd/.test(momentFormat) || /dd[^M]{0,10}-MM-yyyy/.test(momentFormat)) {
|
|
23
|
+
return momentFormat;
|
|
24
|
+
}
|
|
25
|
+
// For mixed formats with dd in date context, we need to be careful not to convert dd to weekday
|
|
26
|
+
// Use non-greedy, bounded matching to prevent ReDoS attacks
|
|
27
|
+
const hasMixedDateFormat = /(?:YYYY|yyyy)[^M]{0,10}-MM-dd/.test(momentFormat) || /dd[^M]{0,10}-MM-(?:YYYY|yyyy)/.test(momentFormat);
|
|
28
|
+
// Handle escaped characters in brackets first
|
|
29
|
+
// Limit content within brackets to prevent ReDoS attacks
|
|
30
|
+
const escapedChars = [];
|
|
31
|
+
let result = momentFormat.replace(/\[([^\]]{0,100})\]/g, (_, content) => {
|
|
32
|
+
const placeholder = `###ESC${escapedChars.length}###`;
|
|
33
|
+
escapedChars.push(content);
|
|
34
|
+
return placeholder;
|
|
35
|
+
});
|
|
36
|
+
// Define token replacements in order of precedence (longer patterns first)
|
|
37
|
+
// Use placeholder system to prevent re-processing of already converted tokens
|
|
38
|
+
// Use numbers to avoid character conflicts
|
|
39
|
+
const tokenReplacements = [
|
|
40
|
+
// 4-character tokens
|
|
41
|
+
{ moment: /YYYY/g, luxon: "@@1@@" },
|
|
42
|
+
{ moment: /MMMM/g, luxon: "@@2@@" },
|
|
43
|
+
{ moment: /dddd/g, luxon: "@@3@@" },
|
|
44
|
+
{ moment: /DDDD/g, luxon: "@@4@@" },
|
|
45
|
+
// 3-character tokens
|
|
46
|
+
{ moment: /MMM/g, luxon: "@@5@@" },
|
|
47
|
+
{ moment: /ddd/g, luxon: "@@6@@" },
|
|
48
|
+
{ moment: /DDD/g, luxon: "@@7@@" },
|
|
49
|
+
{ moment: /SSS/g, luxon: "@@8@@" },
|
|
50
|
+
{ moment: /ZZZ/g, luxon: "@@9@@" },
|
|
51
|
+
// 2-character tokens
|
|
52
|
+
{ moment: /Do/g, luxon: "@@10@@" },
|
|
53
|
+
{ moment: /DD/g, luxon: "@@11@@" }, // Day of month
|
|
54
|
+
...(hasMixedDateFormat ? [] : [{ moment: /dd/g, luxon: "@@12@@" }]), // Skip weekday conversion in date context
|
|
55
|
+
{ moment: /MM/g, luxon: "@@13@@" },
|
|
56
|
+
{ moment: /YY/g, luxon: "@@14@@" },
|
|
57
|
+
{ moment: /HH/g, luxon: "@@15@@" },
|
|
58
|
+
{ moment: /hh/g, luxon: "@@16@@" },
|
|
59
|
+
{ moment: /mm/g, luxon: "@@17@@" },
|
|
60
|
+
{ moment: /ss/g, luxon: "@@18@@" },
|
|
61
|
+
{ moment: /SS/g, luxon: "@@19@@" },
|
|
62
|
+
{ moment: /ww/g, luxon: "@@20@@" },
|
|
63
|
+
{ moment: /ZZ/g, luxon: "@@21@@" },
|
|
64
|
+
// 1-character tokens (only match when not part of words)
|
|
65
|
+
{ moment: /(?<!\w)D(?!\w)/g, luxon: "@@22@@" }, // Day of month
|
|
66
|
+
...(hasMixedDateFormat ? [] : [{ moment: /(?<!\w)d(?!\w)/g, luxon: "@@23@@" }]), // Skip weekday conversion in date context
|
|
67
|
+
{ moment: /(?<!\w)M(?!\w)/g, luxon: "@@24@@" },
|
|
68
|
+
{ moment: /(?<!\w)H(?!\w)/g, luxon: "@@25@@" },
|
|
69
|
+
{ moment: /(?<!\w)h(?!\w)/g, luxon: "@@26@@" },
|
|
70
|
+
{ moment: /(?<!\w)m(?!\w)/g, luxon: "@@27@@" },
|
|
71
|
+
{ moment: /(?<!\w)s(?!\w)/g, luxon: "@@28@@" },
|
|
72
|
+
{ moment: /(?<!\w)S(?!\w)/g, luxon: "@@29@@" },
|
|
73
|
+
{ moment: /(?<!\w)A(?!\w)/g, luxon: "@@30@@" },
|
|
74
|
+
{ moment: /(?<!\w)a(?!\w)/g, luxon: "@@31@@" },
|
|
75
|
+
{ moment: /(?<!\w)Z(?!\w)/g, luxon: "@@32@@" },
|
|
76
|
+
{ moment: /(?<!\w)Q(?!\w)/g, luxon: "@@33@@" },
|
|
77
|
+
{ moment: /(?<!\w)w(?!\w)/g, luxon: "@@34@@" },
|
|
78
|
+
{ moment: /(?<!\w)X(?!\w)/g, luxon: "@@35@@" },
|
|
79
|
+
{ moment: /(?<!\w)x(?!\w)/g, luxon: "@@36@@" },
|
|
80
|
+
];
|
|
81
|
+
// Apply replacements in order
|
|
82
|
+
for (const replacement of tokenReplacements) {
|
|
83
|
+
result = result.replace(replacement.moment, replacement.luxon);
|
|
84
|
+
}
|
|
85
|
+
// Replace numeric placeholders with actual Luxon tokens
|
|
86
|
+
const placeholderMap = {
|
|
87
|
+
"@@1@@": "yyyy", // YYYY
|
|
88
|
+
"@@2@@": "MMMM", // MMMM
|
|
89
|
+
"@@3@@": "cccc", // dddd
|
|
90
|
+
"@@4@@": "ooo", // DDDD
|
|
91
|
+
"@@5@@": "MMM", // MMM
|
|
92
|
+
"@@6@@": "ccc", // ddd
|
|
93
|
+
"@@7@@": "o", // DDD
|
|
94
|
+
"@@8@@": "SSS", // SSS
|
|
95
|
+
"@@9@@": "ZZZZ", // ZZZ
|
|
96
|
+
"@@10@@": "Do", // Do
|
|
97
|
+
"@@11@@": "dd", // DD (day of month)
|
|
98
|
+
"@@12@@": "cc", // dd (weekday)
|
|
99
|
+
"@@13@@": "MM", // MM
|
|
100
|
+
"@@14@@": "yy", // YY
|
|
101
|
+
"@@15@@": "HH", // HH
|
|
102
|
+
"@@16@@": "hh", // hh
|
|
103
|
+
"@@17@@": "mm", // mm
|
|
104
|
+
"@@18@@": "ss", // ss
|
|
105
|
+
"@@19@@": "SS", // SS
|
|
106
|
+
"@@20@@": "WW", // ww
|
|
107
|
+
"@@21@@": "ZZZ", // ZZ
|
|
108
|
+
"@@22@@": "d", // D (day of month)
|
|
109
|
+
"@@23@@": "c", // d (weekday)
|
|
110
|
+
"@@24@@": "M", // M
|
|
111
|
+
"@@25@@": "H", // H
|
|
112
|
+
"@@26@@": "h", // h
|
|
113
|
+
"@@27@@": "m", // m
|
|
114
|
+
"@@28@@": "s", // s
|
|
115
|
+
"@@29@@": "S", // S
|
|
116
|
+
"@@30@@": "a", // A
|
|
117
|
+
"@@31@@": "a", // a
|
|
118
|
+
"@@32@@": "ZZ", // Z
|
|
119
|
+
"@@33@@": "q", // Q
|
|
120
|
+
"@@34@@": "W", // w
|
|
121
|
+
"@@35@@": "X", // X
|
|
122
|
+
"@@36@@": "x", // x
|
|
123
|
+
};
|
|
124
|
+
// Replace all placeholders
|
|
125
|
+
for (const [placeholder, luxonToken] of Object.entries(placeholderMap)) {
|
|
126
|
+
result = result.replace(new RegExp(escapeRegex(placeholder), "g"), luxonToken);
|
|
127
|
+
}
|
|
128
|
+
// Restore escaped characters (Luxon uses single quotes for literals)
|
|
129
|
+
escapedChars.forEach((content, index) => {
|
|
130
|
+
const placeholder = `###ESC${index}###`;
|
|
131
|
+
result = result.replace(placeholder, `'${content}'`);
|
|
132
|
+
});
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=normalizeLegacyFormat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeLegacyFormat.js","sourceRoot":"","sources":["../src/normalizeLegacyFormat.ts"],"names":[],"mappings":";AAAA,kCAAk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QAAQ,EAAE,GAAG,EAAQ,IAAI;QACzB,QAAQ,EAAE,IAAI,EAAO,IAAI;QACzB,QAAQ,EAAE,GAAG,EAAQ,IAAI;QACzB,QAAQ,EAAE,GAAG,EAAQ,IAAI;QACzB,QAAQ,EAAE,GAAG,EAAQ,IAAI;QACzB,QAAQ,EAAE,GAAG,EAAQ,IAAI;KAC1B,CAAC;IAEF,2BAA2B;IAC3B,KAAK,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QACvE,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;IACjF,CAAC;IAED,qEAAqE;IACrE,YAAY,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;QACtC,MAAM,WAAW,GAAG,SAAS,KAAK,KAAK,CAAC;QACxC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,OAAO,GAAG,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.61.
|
|
7
|
+
"version": "1.61.3",
|
|
8
8
|
"description": "Time for 📣 stentor",
|
|
9
9
|
"types": "lib/index",
|
|
10
10
|
"main": "lib/index",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/chai": "4.3.20",
|
|
19
|
+
"@types/luxon": "3.0.0",
|
|
19
20
|
"@types/mocha": "10.0.10",
|
|
20
21
|
"@types/sinon": "17.0.4",
|
|
21
22
|
"@xapp/config": "0.2.3",
|
|
@@ -27,12 +28,10 @@
|
|
|
27
28
|
"typescript": "5.9.2"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
|
-
"
|
|
31
|
-
"moment-range": "4.0.2",
|
|
32
|
-
"moment-timezone": "0.5.48",
|
|
31
|
+
"luxon": "3.4.0",
|
|
33
32
|
"stentor-guards": "1.61.2",
|
|
34
|
-
"stentor-logger": "1.61.
|
|
35
|
-
"stentor-utils": "1.61.
|
|
33
|
+
"stentor-logger": "1.61.3",
|
|
34
|
+
"stentor-utils": "1.61.3"
|
|
36
35
|
},
|
|
37
36
|
"peerDependencies": {
|
|
38
37
|
"stentor-models": "1.x"
|
|
@@ -42,5 +41,5 @@
|
|
|
42
41
|
"clean": "rm -rf ./lib/*",
|
|
43
42
|
"test": "mocha --recursive -r ts-node/register \"./src/**/*.test.ts\""
|
|
44
43
|
},
|
|
45
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "905a49091228ace13cc4e23082f90ac83d53c9fd"
|
|
46
45
|
}
|