@procedures/schedule 0.4.0 → 0.6.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/CHANGELOG.md +33 -0
- package/README.md +55 -5
- package/dist/.tsbuildinfo +1 -1
- package/dist/cron.d.ts +36 -6
- package/dist/cron.d.ts.map +1 -1
- package/dist/cron.js +265 -41
- package/dist/cron.js.map +1 -1
- package/dist/errors.d.ts +4 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/module.d.ts +5 -0
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +8 -2
- package/dist/module.js.map +1 -1
- package/dist/procedures/schedule/add.d.ts +5 -2
- package/dist/procedures/schedule/add.d.ts.map +1 -1
- package/dist/procedures/schedule/add.js +15 -10
- package/dist/procedures/schedule/add.js.map +1 -1
- package/dist/procedures/schedule/list.js +1 -1
- package/dist/procedures/schedule/list.js.map +1 -1
- package/dist/procedures/schedule/next.d.ts +1 -1
- package/dist/procedures/schedule/next.d.ts.map +1 -1
- package/dist/procedures/schedule/next.js +2 -2
- package/dist/procedures/schedule/next.js.map +1 -1
- package/dist/programs.d.ts +3 -1
- package/dist/programs.d.ts.map +1 -1
- package/dist/programs.js.map +1 -1
- package/dist/scheduler.d.ts +9 -0
- package/dist/scheduler.d.ts.map +1 -1
- package/dist/scheduler.js +11 -6
- package/dist/scheduler.js.map +1 -1
- package/dist/store.d.ts +50 -5
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +161 -26
- package/dist/store.js.map +1 -1
- package/dist/types.d.ts +8 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/cron.ts +277 -48
- package/src/errors.ts +4 -0
- package/src/index.ts +10 -2
- package/src/module.ts +13 -2
- package/src/procedures/schedule/add.ts +15 -10
- package/src/procedures/schedule/list.ts +1 -1
- package/src/procedures/schedule/next.ts +3 -3
- package/src/programs.ts +3 -1
- package/src/scheduler.ts +16 -6
- package/src/store.ts +166 -24
- package/src/types.ts +8 -4
package/dist/cron.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Cron expressions (roadmap R46): the parse and the next times.
|
|
3
3
|
*
|
|
4
|
-
* This package parses cron itself. The format is small, and
|
|
5
|
-
* zone database or a second format that this package does not need.
|
|
4
|
+
* This package parses cron itself. The format is small, and `Intl` gives the offsets of each time
|
|
5
|
+
* zone. A dependency gives a time zone database or a second format that this package does not need.
|
|
6
6
|
*
|
|
7
7
|
* - 5 fields: minute (0-59), hour (0-23), day of the month (1-31), month (1-12), day of the week
|
|
8
8
|
* (0-7, with 0 and 7 for Sunday).
|
|
@@ -13,8 +13,16 @@
|
|
|
13
13
|
* - The days, as in Vixie cron: when the two day fields have a limit (they do not start with
|
|
14
14
|
* `*`), a day matches when one of the two matches. Else the field with a limit decides.
|
|
15
15
|
*
|
|
16
|
-
* The
|
|
17
|
-
*
|
|
16
|
+
* The time zone is `utc`, `local` (the time zone of the host) or an IANA name, for example
|
|
17
|
+
* `Europe/Berlin`. The changes of daylight saving time follow Vixie cron:
|
|
18
|
+
*
|
|
19
|
+
* - A fixed time has no `*` at the start of its minute field and of its hour field: `30 2 * * *`.
|
|
20
|
+
* - A fixed time in the hour that does not exist runs once, at the first minute after the change.
|
|
21
|
+
* Two such times of one expression give one run.
|
|
22
|
+
* - A fixed time in the hour that occurs twice runs once, at its first occurrence.
|
|
23
|
+
* - An expression with `*` at the start of its minute field or of its hour field follows the
|
|
24
|
+
* clock. It has no run for a time that does not exist, and it runs at the two occurrences of a
|
|
25
|
+
* time that occurs twice. Thus `0 * * * *` runs each hour of real time.
|
|
18
26
|
*/
|
|
19
27
|
import type { ScheduleTimeZone } from "./types.js";
|
|
20
28
|
/** A parsed cron expression. */
|
|
@@ -30,18 +38,40 @@ export interface CronExpression {
|
|
|
30
38
|
readonly dayLimited: boolean;
|
|
31
39
|
/** True when the field of the day of the week does not start with `*`. */
|
|
32
40
|
readonly weekdayLimited: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* True when the minute field and the hour field do not start with `*`. A fixed time obeys the
|
|
43
|
+
* rules of Vixie cron for the changes of daylight saving time (see the comment of the file).
|
|
44
|
+
*/
|
|
45
|
+
readonly fixedTime: boolean;
|
|
33
46
|
}
|
|
34
47
|
/** The names of the expressions that are one name. */
|
|
35
48
|
export declare const CRON_NAMES: Readonly<Record<string, string>>;
|
|
36
49
|
/** This function parses a cron expression. It throws a `BAD_CRON` error that tells the problem. */
|
|
37
50
|
export declare function parseCron(text: string): CronExpression;
|
|
51
|
+
/**
|
|
52
|
+
* This function checks a time zone and gives its name: `utc`, `local`, or an IANA name that `Intl`
|
|
53
|
+
* knows. A name that differs from the name of `Intl` only by the case gets the case of `Intl`. The
|
|
54
|
+
* function throws a `BAD_TIME_ZONE` error for another name.
|
|
55
|
+
*/
|
|
56
|
+
export declare function checkTimeZone(timeZone: string): ScheduleTimeZone;
|
|
57
|
+
/** This function gives the IANA name of the time zone of the process, from `Intl`. */
|
|
58
|
+
export declare function hostTimeZone(): string;
|
|
38
59
|
/**
|
|
39
60
|
* This function gives the first time of the expression after `after` (milliseconds since 1970),
|
|
40
|
-
* or undefined when the expression has no time in the next 9 years.
|
|
61
|
+
* or undefined when the expression has no time in the next 9 years. The time zone is `utc`,
|
|
62
|
+
* `local` or an IANA name. An unknown name gives a `BAD_TIME_ZONE` error.
|
|
41
63
|
*/
|
|
42
64
|
export declare function nextTime(cron: CronExpression, after: number, timeZone?: ScheduleTimeZone): number | undefined;
|
|
43
65
|
/** This function gives the next `count` times of the expression after `after`. */
|
|
44
66
|
export declare function nextTimes(cron: CronExpression, after: number, count: number, timeZone?: ScheduleTimeZone): number[];
|
|
45
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* The ISO text of a time in a time zone: `2026-10-17T09:00:00Z` in UTC, or with the offset of the
|
|
69
|
+
* zone at that time: `2026-10-17T09:00:00+02:00`. An offset of 0 gives `Z`.
|
|
70
|
+
*/
|
|
46
71
|
export declare function formatTime(time: number, timeZone?: ScheduleTimeZone): string;
|
|
72
|
+
/**
|
|
73
|
+
* This function gives the time zone of a computation. The zone `local` becomes `local` (the zone
|
|
74
|
+
* of the process) or the zone that the host gives for it.
|
|
75
|
+
*/
|
|
76
|
+
export declare function zoneFor(timeZone: ScheduleTimeZone, local: string | undefined): ScheduleTimeZone;
|
|
47
77
|
//# sourceMappingURL=cron.d.ts.map
|
package/dist/cron.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron.d.ts","sourceRoot":"","sources":["../src/cron.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cron.d.ts","sourceRoot":"","sources":["../src/cron.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,gCAAgC;AAChC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,6CAA6C;IAC7C,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,0EAA0E;IAC1E,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAsBD,sDAAsD;AACtD,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQtD,CAAC;AAoDH,mGAAmG;AACnG,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAkBtD;AAeD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAoBhE;AAED,sFAAsF;AACtF,wBAAgB,YAAY,IAAI,MAAM,CAErC;AA0ND;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,gBAA0B,GAAG,MAAM,GAAG,SAAS,CAKtH;AAED,kFAAkF;AAClF,wBAAgB,SAAS,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,gBAA0B,GAAG,MAAM,EAAE,CAU5H;AAID;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,gBAA0B,GAAG,MAAM,CAMrF;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,gBAAgB,CAE/F"}
|
package/dist/cron.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Cron expressions (roadmap R46): the parse and the next times.
|
|
3
3
|
*
|
|
4
|
-
* This package parses cron itself. The format is small, and
|
|
5
|
-
* zone database or a second format that this package does not need.
|
|
4
|
+
* This package parses cron itself. The format is small, and `Intl` gives the offsets of each time
|
|
5
|
+
* zone. A dependency gives a time zone database or a second format that this package does not need.
|
|
6
6
|
*
|
|
7
7
|
* - 5 fields: minute (0-59), hour (0-23), day of the month (1-31), month (1-12), day of the week
|
|
8
8
|
* (0-7, with 0 and 7 for Sunday).
|
|
@@ -13,8 +13,16 @@
|
|
|
13
13
|
* - The days, as in Vixie cron: when the two day fields have a limit (they do not start with
|
|
14
14
|
* `*`), a day matches when one of the two matches. Else the field with a limit decides.
|
|
15
15
|
*
|
|
16
|
-
* The
|
|
17
|
-
*
|
|
16
|
+
* The time zone is `utc`, `local` (the time zone of the host) or an IANA name, for example
|
|
17
|
+
* `Europe/Berlin`. The changes of daylight saving time follow Vixie cron:
|
|
18
|
+
*
|
|
19
|
+
* - A fixed time has no `*` at the start of its minute field and of its hour field: `30 2 * * *`.
|
|
20
|
+
* - A fixed time in the hour that does not exist runs once, at the first minute after the change.
|
|
21
|
+
* Two such times of one expression give one run.
|
|
22
|
+
* - A fixed time in the hour that occurs twice runs once, at its first occurrence.
|
|
23
|
+
* - An expression with `*` at the start of its minute field or of its hour field follows the
|
|
24
|
+
* clock. It has no run for a time that does not exist, and it runs at the two occurrences of a
|
|
25
|
+
* time that occurs twice. Thus `0 * * * *` runs each hour of real time.
|
|
18
26
|
*/
|
|
19
27
|
import { ScheduleError } from "./errors.js";
|
|
20
28
|
const MONTHS = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
|
|
@@ -112,22 +120,95 @@ export function parseCron(text) {
|
|
|
112
120
|
weekdays,
|
|
113
121
|
dayLimited: !fields[2].startsWith("*"),
|
|
114
122
|
weekdayLimited: !fields[4].startsWith("*"),
|
|
123
|
+
fixedTime: !fields[0].startsWith("*") && !fields[1].startsWith("*"),
|
|
115
124
|
};
|
|
116
125
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
// =============================================================================
|
|
127
|
+
// Time zones
|
|
128
|
+
// =============================================================================
|
|
129
|
+
const MINUTE = 60_000;
|
|
130
|
+
const DAY = 86_400_000;
|
|
131
|
+
/** The form of an IANA name: `Europe/Berlin`, `UTC`, `Etc/GMT+5`. An offset such as `+05:30` is not one. */
|
|
132
|
+
const IANA_NAME = /^[A-Za-z][A-Za-z0-9_+-]*(\/[A-Za-z0-9_+-]+)*$/;
|
|
133
|
+
/** The names that `checkTimeZone` accepted, with its result: a file store examines each schedule at each read. */
|
|
134
|
+
const checked = new Map();
|
|
135
|
+
/**
|
|
136
|
+
* This function checks a time zone and gives its name: `utc`, `local`, or an IANA name that `Intl`
|
|
137
|
+
* knows. A name that differs from the name of `Intl` only by the case gets the case of `Intl`. The
|
|
138
|
+
* function throws a `BAD_TIME_ZONE` error for another name.
|
|
139
|
+
*/
|
|
140
|
+
export function checkTimeZone(timeZone) {
|
|
141
|
+
if (timeZone === "utc" || timeZone === "local")
|
|
142
|
+
return timeZone;
|
|
143
|
+
const known = checked.get(timeZone);
|
|
144
|
+
if (known !== undefined)
|
|
145
|
+
return known;
|
|
146
|
+
let resolved;
|
|
147
|
+
if (timeZone.length <= 100 && IANA_NAME.test(timeZone)) {
|
|
148
|
+
try {
|
|
149
|
+
resolved = new Intl.DateTimeFormat("en-US", { timeZone }).resolvedOptions().timeZone;
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
resolved = undefined;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (resolved === undefined) {
|
|
156
|
+
throw new ScheduleError("BAD_TIME_ZONE", `The time zone ${JSON.stringify(timeZone)} is not utc, local or an IANA name that Intl knows, for example Europe/Berlin`);
|
|
157
|
+
}
|
|
158
|
+
const name = resolved.toLowerCase() === timeZone.toLowerCase() ? resolved : timeZone;
|
|
159
|
+
// The cache stays small: a process uses few zones
|
|
160
|
+
if (checked.size >= 1000)
|
|
161
|
+
checked.clear();
|
|
162
|
+
checked.set(timeZone, name);
|
|
163
|
+
return name;
|
|
164
|
+
}
|
|
165
|
+
/** This function gives the IANA name of the time zone of the process, from `Intl`. */
|
|
166
|
+
export function hostTimeZone() {
|
|
167
|
+
return new Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
|
|
168
|
+
}
|
|
169
|
+
/** The offsets of one time zone of `Intl`. */
|
|
170
|
+
class Zone {
|
|
171
|
+
format;
|
|
172
|
+
constructor(name) {
|
|
173
|
+
this.format = new Intl.DateTimeFormat("en-US", {
|
|
174
|
+
timeZone: name,
|
|
175
|
+
hourCycle: "h23",
|
|
176
|
+
year: "numeric",
|
|
177
|
+
month: "numeric",
|
|
178
|
+
day: "numeric",
|
|
179
|
+
hour: "numeric",
|
|
180
|
+
minute: "numeric",
|
|
181
|
+
second: "numeric",
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
/** This method gives the offset of the zone at a time: the wall time minus the time, in milliseconds. */
|
|
185
|
+
offset(time) {
|
|
186
|
+
const value = {};
|
|
187
|
+
for (const part of this.format.formatToParts(time))
|
|
188
|
+
if (part.type !== "literal")
|
|
189
|
+
value[part.type] = Number(part.value);
|
|
190
|
+
const wall = Date.UTC(value.year ?? 1970, (value.month ?? 1) - 1, value.day ?? 1, (value.hour ?? 0) % 24, value.minute ?? 0, value.second ?? 0);
|
|
191
|
+
return wall - Math.floor(time / 1000) * 1000;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/** The zones, by the name in lower case: `Intl` ignores the case of a name. */
|
|
195
|
+
const zones = new Map();
|
|
196
|
+
/** The zone of a name. It throws `BAD_TIME_ZONE` for a name that `Intl` does not know. */
|
|
197
|
+
function zoneOf(timeZone) {
|
|
198
|
+
const key = timeZone.toLowerCase();
|
|
199
|
+
let zone = zones.get(key);
|
|
200
|
+
if (zone === undefined) {
|
|
201
|
+
zone = new Zone(checkTimeZone(timeZone));
|
|
202
|
+
zones.set(key, zone);
|
|
203
|
+
}
|
|
204
|
+
return zone;
|
|
205
|
+
}
|
|
206
|
+
/** The IANA name of a time zone that is not `utc`: `local` is the time zone of the host. */
|
|
207
|
+
const ianaName = (timeZone) => (timeZone === "local" ? hostTimeZone() : timeZone);
|
|
208
|
+
function fieldsOf(wall) {
|
|
209
|
+
const date = new Date(wall);
|
|
210
|
+
return { year: date.getUTCFullYear(), month: date.getUTCMonth() + 1, day: date.getUTCDate(), hour: date.getUTCHours(), minute: date.getUTCMinutes(), weekday: date.getUTCDay() };
|
|
211
|
+
}
|
|
131
212
|
/** The years that a search covers: Feb 29 can be 8 years away (2096 to 2104). */
|
|
132
213
|
const SEARCH_YEARS = 9;
|
|
133
214
|
/** True when the day of the fields matches the two day fields. */
|
|
@@ -143,33 +224,167 @@ function dayMatches(cron, fields) {
|
|
|
143
224
|
return true;
|
|
144
225
|
}
|
|
145
226
|
/**
|
|
146
|
-
* This function gives the first time of the expression after `after` (
|
|
147
|
-
* or undefined when the expression has no time in the next 9 years.
|
|
227
|
+
* This function gives the first wall time of the expression after the wall time `after` (a whole
|
|
228
|
+
* minute), or undefined when the expression has no wall time in the next 9 years.
|
|
148
229
|
*/
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const lastYear = calendar.fields(after).year + SEARCH_YEARS;
|
|
230
|
+
function nextWall(cron, after) {
|
|
231
|
+
let wall = after + MINUTE;
|
|
232
|
+
const lastYear = fieldsOf(after).year + SEARCH_YEARS;
|
|
153
233
|
for (let step = 0; step < 1_000_000; step++) {
|
|
154
|
-
const fields =
|
|
234
|
+
const fields = fieldsOf(wall);
|
|
155
235
|
if (fields.year > lastYear)
|
|
156
236
|
return undefined;
|
|
157
|
-
let next;
|
|
158
237
|
if (!cron.months.has(fields.month))
|
|
159
|
-
|
|
238
|
+
wall = Date.UTC(fields.year, fields.month, 1);
|
|
160
239
|
else if (!dayMatches(cron, fields))
|
|
161
|
-
|
|
240
|
+
wall = Date.UTC(fields.year, fields.month - 1, fields.day + 1);
|
|
162
241
|
else if (!cron.hours.has(fields.hour))
|
|
163
|
-
|
|
242
|
+
wall = Date.UTC(fields.year, fields.month - 1, fields.day, fields.hour + 1);
|
|
164
243
|
else if (!cron.minutes.has(fields.minute))
|
|
165
|
-
|
|
244
|
+
wall += MINUTE;
|
|
166
245
|
else
|
|
167
|
-
return
|
|
168
|
-
// A change of the clock can give a time that is not later: go one minute on
|
|
169
|
-
time = next > time ? next : time + 60_000;
|
|
246
|
+
return wall;
|
|
170
247
|
}
|
|
171
248
|
return undefined;
|
|
172
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* This function gives the first minute in `(from, to]` with another offset than `from`. The
|
|
252
|
+
* offsets of `from` and `to` differ, and one change of the offset is between them.
|
|
253
|
+
*/
|
|
254
|
+
function changeIn(zone, from, to) {
|
|
255
|
+
const offset = zone.offset(from);
|
|
256
|
+
let low = from;
|
|
257
|
+
let high = to;
|
|
258
|
+
while (high - low > MINUTE) {
|
|
259
|
+
const middle = low + Math.floor((high - low) / 2 / MINUTE) * MINUTE;
|
|
260
|
+
if (zone.offset(middle) === offset)
|
|
261
|
+
low = middle;
|
|
262
|
+
else
|
|
263
|
+
high = middle;
|
|
264
|
+
}
|
|
265
|
+
return high;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* The times of a wall time, sorted: one time, two times in the hour that occurs twice, or none in
|
|
269
|
+
* the hour that does not exist. For none, `change` is the time of the change: its wall time is
|
|
270
|
+
* the first wall time after the gap.
|
|
271
|
+
*/
|
|
272
|
+
function timesOf(zone, wall) {
|
|
273
|
+
// The offsets a day before and a day after: a change of the clock near the wall time is between them
|
|
274
|
+
const before = zone.offset(wall - DAY);
|
|
275
|
+
const after = zone.offset(wall + DAY);
|
|
276
|
+
const times = [...new Set([wall - before, wall - after])].filter((time) => time + zone.offset(time) === wall).sort((a, b) => a - b);
|
|
277
|
+
if (times.length > 0 || before >= after)
|
|
278
|
+
return { times };
|
|
279
|
+
return { times, change: changeIn(zone, wall - after, wall - before) };
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* The highest wall time of the minutes up to the minute `time`. After a change back, the clock
|
|
283
|
+
* shows an hour a second time, and this wall time stays above the wall time of `time`.
|
|
284
|
+
*/
|
|
285
|
+
function highWall(zone, time) {
|
|
286
|
+
const offset = zone.offset(time);
|
|
287
|
+
const earlier = zone.offset(time - DAY);
|
|
288
|
+
if (earlier <= offset)
|
|
289
|
+
return time + offset;
|
|
290
|
+
const change = changeIn(zone, time - DAY, time);
|
|
291
|
+
return Math.max(time + offset, change - MINUTE + earlier);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* The next time of a fixed time after the minute `after`. Each wall time runs at the first time
|
|
295
|
+
* whose wall time is the same or later. Thus a wall time in a gap runs at the change, and a wall
|
|
296
|
+
* time that occurs twice runs at its first occurrence. The wall times after the highest wall time
|
|
297
|
+
* of `after` are the wall times that did not run.
|
|
298
|
+
*/
|
|
299
|
+
function nextFixed(cron, zone, after) {
|
|
300
|
+
let wall = highWall(zone, after);
|
|
301
|
+
for (let step = 0; step < 1000; step++) {
|
|
302
|
+
const next = nextWall(cron, wall);
|
|
303
|
+
if (next === undefined)
|
|
304
|
+
return undefined;
|
|
305
|
+
const { times, change } = timesOf(zone, next);
|
|
306
|
+
if (times.length > 0)
|
|
307
|
+
return times[0];
|
|
308
|
+
if (change !== undefined)
|
|
309
|
+
return change;
|
|
310
|
+
wall = next;
|
|
311
|
+
}
|
|
312
|
+
return undefined;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* The next time of an expression that follows the clock, after the minute `after`: the first time
|
|
316
|
+
* whose wall time matches. A wall time in a gap has no time. A wall time that occurs twice has two.
|
|
317
|
+
*/
|
|
318
|
+
function nextByClock(cron, zone, after) {
|
|
319
|
+
// The first occurrences: the wall times after the highest wall time
|
|
320
|
+
let first;
|
|
321
|
+
let wall = highWall(zone, after);
|
|
322
|
+
for (let step = 0; step < 1000 && first === undefined; step++) {
|
|
323
|
+
const next = nextWall(cron, wall);
|
|
324
|
+
if (next === undefined)
|
|
325
|
+
break;
|
|
326
|
+
const { times, change } = timesOf(zone, next);
|
|
327
|
+
if (times.length > 0)
|
|
328
|
+
first = times[0];
|
|
329
|
+
// A wall time in a gap has no time: the search goes on after the gap
|
|
330
|
+
else
|
|
331
|
+
wall = change === undefined ? next : change + zone.offset(change) - MINUTE;
|
|
332
|
+
}
|
|
333
|
+
const second = secondOccurrence(cron, zone, after);
|
|
334
|
+
if (first === undefined)
|
|
335
|
+
return second;
|
|
336
|
+
return second === undefined ? first : Math.min(first, second);
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* The first time after the minute `after` in the hour that the clock shows a second time, when a
|
|
340
|
+
* change back is near `after`, or undefined.
|
|
341
|
+
*/
|
|
342
|
+
function secondOccurrence(cron, zone, after) {
|
|
343
|
+
const offset = zone.offset(after);
|
|
344
|
+
const earlier = zone.offset(after - DAY);
|
|
345
|
+
const later = zone.offset(after + DAY);
|
|
346
|
+
let change;
|
|
347
|
+
let shift;
|
|
348
|
+
let repeated;
|
|
349
|
+
if (earlier > offset) {
|
|
350
|
+
change = changeIn(zone, after - DAY, after);
|
|
351
|
+
shift = earlier - offset;
|
|
352
|
+
repeated = offset;
|
|
353
|
+
}
|
|
354
|
+
else if (later < offset) {
|
|
355
|
+
change = changeIn(zone, after, after + DAY);
|
|
356
|
+
shift = offset - later;
|
|
357
|
+
repeated = later;
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
return undefined;
|
|
361
|
+
}
|
|
362
|
+
// The second occurrences are the times from the change to the end of the shift, with the offset `repeated`
|
|
363
|
+
const end = change + shift;
|
|
364
|
+
const start = Math.max(after + MINUTE, change);
|
|
365
|
+
if (start >= end)
|
|
366
|
+
return undefined;
|
|
367
|
+
const wall = nextWall(cron, start + repeated - MINUTE);
|
|
368
|
+
if (wall === undefined)
|
|
369
|
+
return undefined;
|
|
370
|
+
const time = wall - repeated;
|
|
371
|
+
return time < end ? time : undefined;
|
|
372
|
+
}
|
|
373
|
+
// =============================================================================
|
|
374
|
+
// The next times
|
|
375
|
+
// =============================================================================
|
|
376
|
+
/**
|
|
377
|
+
* This function gives the first time of the expression after `after` (milliseconds since 1970),
|
|
378
|
+
* or undefined when the expression has no time in the next 9 years. The time zone is `utc`,
|
|
379
|
+
* `local` or an IANA name. An unknown name gives a `BAD_TIME_ZONE` error.
|
|
380
|
+
*/
|
|
381
|
+
export function nextTime(cron, after, timeZone = "local") {
|
|
382
|
+
const minute = Math.floor(after / MINUTE) * MINUTE;
|
|
383
|
+
if (timeZone === "utc")
|
|
384
|
+
return nextWall(cron, minute);
|
|
385
|
+
const zone = zoneOf(ianaName(timeZone));
|
|
386
|
+
return cron.fixedTime ? nextFixed(cron, zone, minute) : nextByClock(cron, zone, minute);
|
|
387
|
+
}
|
|
173
388
|
/** This function gives the next `count` times of the expression after `after`. */
|
|
174
389
|
export function nextTimes(cron, after, count, timeZone = "local") {
|
|
175
390
|
const times = [];
|
|
@@ -183,15 +398,24 @@ export function nextTimes(cron, after, count, timeZone = "local") {
|
|
|
183
398
|
}
|
|
184
399
|
return times;
|
|
185
400
|
}
|
|
186
|
-
const pad = (value
|
|
187
|
-
/**
|
|
401
|
+
const pad = (value) => String(value).padStart(2, "0");
|
|
402
|
+
/**
|
|
403
|
+
* The ISO text of a time in a time zone: `2026-10-17T09:00:00Z` in UTC, or with the offset of the
|
|
404
|
+
* zone at that time: `2026-10-17T09:00:00+02:00`. An offset of 0 gives `Z`.
|
|
405
|
+
*/
|
|
188
406
|
export function formatTime(time, timeZone = "local") {
|
|
189
|
-
const date = new Date(time);
|
|
190
407
|
if (timeZone === "utc")
|
|
191
|
-
return `${
|
|
192
|
-
const offset =
|
|
193
|
-
const
|
|
194
|
-
const zone =
|
|
195
|
-
return `${
|
|
408
|
+
return `${new Date(time).toISOString().slice(0, 19)}Z`;
|
|
409
|
+
const offset = zoneOf(ianaName(timeZone)).offset(time);
|
|
410
|
+
const minutes = Math.round(offset / MINUTE);
|
|
411
|
+
const zone = minutes === 0 ? "Z" : `${minutes > 0 ? "+" : "-"}${pad(Math.floor(Math.abs(minutes) / 60))}:${pad(Math.abs(minutes) % 60)}`;
|
|
412
|
+
return `${new Date(time + offset).toISOString().slice(0, 19)}${zone}`;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* This function gives the time zone of a computation. The zone `local` becomes `local` (the zone
|
|
416
|
+
* of the process) or the zone that the host gives for it.
|
|
417
|
+
*/
|
|
418
|
+
export function zoneFor(timeZone, local) {
|
|
419
|
+
return timeZone === "local" && local !== undefined ? local : timeZone;
|
|
196
420
|
}
|
|
197
421
|
//# sourceMappingURL=cron.js.map
|
package/dist/cron.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron.js","sourceRoot":"","sources":["../src/cron.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAkB5C,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AACpG,MAAM,IAAI,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAW/D,MAAM,MAAM,GAAyB;IACnC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;IACnC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;IACjC,EAAE,IAAI,EAAE,kBAAkB,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;IAC7C,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,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AAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC;IAC/E,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;IACzI,OAAO,GAAG,IAAI,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC;AACxE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,QAA0B,EAAE,KAAyB;IAC3E,OAAO,QAAQ,KAAK,OAAO,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AACxE,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
export type ScheduleErrorCode =
|
|
6
6
|
/** The cron expression is not correct, or it has no time in the next 9 years. */
|
|
7
7
|
"BAD_CRON"
|
|
8
|
+
/** The time zone is not `utc`, `local` or an IANA name that `Intl` knows. */
|
|
9
|
+
| "BAD_TIME_ZONE"
|
|
10
|
+
/** Another process holds the lock file of a `FileScheduleStore` for longer than the wait. */
|
|
11
|
+
| "LOCKED"
|
|
8
12
|
/** A schedule of the name exists, and the input does not replace it. */
|
|
9
13
|
| "EXISTS"
|
|
10
14
|
/** No stored program has the key: not in the registry, not in the program store. */
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,uCAAuC;AACvC,MAAM,MAAM,iBAAiB;AAC3B,iFAAiF;AAC/E,UAAU;AACZ,wEAAwE;GACtE,QAAQ;AACV,oFAAoF;GAClF,WAAW;AACb,+DAA+D;GAC7D,eAAe;AACjB,wDAAwD;GACtD,WAAW,CAAC;AAEhB,iCAAiC;AACjC,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAkB,IAAI,mBAAmB;IACzC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IAEjC,YAAY,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,EAGnD;CACF"}
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,uCAAuC;AACvC,MAAM,MAAM,iBAAiB;AAC3B,iFAAiF;AAC/E,UAAU;AACZ,6EAA6E;GAC3E,eAAe;AACjB,6FAA6F;GAC3F,QAAQ;AACV,wEAAwE;GACtE,QAAQ;AACV,oFAAoF;GAClF,WAAW;AACb,+DAA+D;GAC7D,eAAe;AACjB,wDAAwD;GACtD,WAAW,CAAC;AAEhB,iCAAiC;AACjC,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAkB,IAAI,mBAAmB;IACzC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IAEjC,YAAY,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,EAGnD;CACF"}
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAmBH,iCAAiC;AACjC,MAAM,OAAO,aAAc,SAAQ,KAAK;IACpB,IAAI,GAAG,eAAe,CAAC;IAChC,IAAI,CAAoB;IAEjC,YAAY,IAAuB,EAAE,OAAe;QAClD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from "./module.js";
|
|
2
2
|
export * from "./types.js";
|
|
3
3
|
export { scheduleAdd, scheduleList, scheduleRemove, scheduleNext, viewOf } from "./procedures/schedule/index.js";
|
|
4
|
-
export { CRON_NAMES, formatTime, nextTime, nextTimes, parseCron, type CronExpression } from "./cron.js";
|
|
4
|
+
export { checkTimeZone, CRON_NAMES, formatTime, hostTimeZone, nextTime, nextTimes, parseCron, zoneFor, type CronExpression } from "./cron.js";
|
|
5
5
|
export { ScheduleError, type ScheduleErrorCode } from "./errors.js";
|
|
6
|
-
export { checkSchedule, defaultScheduleStore, FileScheduleStore, MemoryScheduleStore, type ScheduleStore } from "./store.js";
|
|
6
|
+
export { checkSchedule, DEFAULT_LOCK_STALE_MS, defaultScheduleStore, FileScheduleStore, MemoryScheduleStore, type FileScheduleStoreOptions, type ScheduleStore, } from "./store.js";
|
|
7
7
|
export { DEFAULT_SCHEDULE_SETTINGS, findProgram, PROGRAM_KEY, type ScheduleSettings } from "./programs.js";
|
|
8
8
|
export { DEFAULT_RUN_TIMEOUT_MS, Scheduler, type ScheduleRunEvent, type SchedulerOptions } from "./scheduler.js";
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAEjH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAEjH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAC9I,OAAO,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC3G,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,9 +3,9 @@ export * from "./module.js";
|
|
|
3
3
|
export * from "./types.js";
|
|
4
4
|
export { scheduleAdd, scheduleList, scheduleRemove, scheduleNext, viewOf } from "./procedures/schedule/index.js";
|
|
5
5
|
// The cron expressions, the stores and the scheduler (roadmap R46)
|
|
6
|
-
export { CRON_NAMES, formatTime, nextTime, nextTimes, parseCron } from "./cron.js";
|
|
6
|
+
export { checkTimeZone, CRON_NAMES, formatTime, hostTimeZone, nextTime, nextTimes, parseCron, zoneFor } from "./cron.js";
|
|
7
7
|
export { ScheduleError } from "./errors.js";
|
|
8
|
-
export { checkSchedule, defaultScheduleStore, FileScheduleStore, MemoryScheduleStore } from "./store.js";
|
|
8
|
+
export { checkSchedule, DEFAULT_LOCK_STALE_MS, defaultScheduleStore, FileScheduleStore, MemoryScheduleStore, } from "./store.js";
|
|
9
9
|
export { DEFAULT_SCHEDULE_SETTINGS, findProgram, PROGRAM_KEY } from "./programs.js";
|
|
10
10
|
export { DEFAULT_RUN_TIMEOUT_MS, Scheduler } from "./scheduler.js";
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACjH,mEAAmE;AACnE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAuB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACjH,mEAAmE;AACnE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAuB,MAAM,WAAW,CAAC;AAC9I,OAAO,EAAE,aAAa,EAA0B,MAAM,aAAa,CAAC;AACpE,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,GAGpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,WAAW,EAAyB,MAAM,eAAe,CAAC;AAC3G,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAgD,MAAM,gBAAgB,CAAC"}
|
package/dist/module.d.ts
CHANGED
|
@@ -21,6 +21,11 @@ export interface ScheduleModuleOptions {
|
|
|
21
21
|
readonly store?: ScheduleStore | undefined;
|
|
22
22
|
/** The wall time, in milliseconds since 1970. The default is `Date.now`. A test gives the time of its fake clock. */
|
|
23
23
|
readonly now?: (() => number) | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* The IANA time zone of the schedules with the time zone `local`, for example `Europe/Berlin`.
|
|
26
|
+
* The default is the time zone of the process. A host gives the same zone to its `Scheduler`.
|
|
27
|
+
*/
|
|
28
|
+
readonly timeZone?: string | undefined;
|
|
24
29
|
}
|
|
25
30
|
/**
|
|
26
31
|
* This function gives the module of this package with the store of the host. Without options, it
|
package/dist/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EASL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EASL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAC;AAO5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAgKhD;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,eAAqG,CAAC;eAEpH,cAAc;AAE7B,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACpC,kFAAkF;IAClF,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAC3C,qHAAqH;IACrH,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,MAAM,CAAC,GAAG,SAAS,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,qBAA0B,GAAG,eAAe,CAQzF;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,GAAE,iBAAsC,EAAE,OAAO,GAAE,qBAA0B,GAAG,IAAI,CAEtI"}
|
package/dist/module.js
CHANGED
|
@@ -13,12 +13,17 @@ import { scheduleAdd } from "./procedures/schedule/add.js";
|
|
|
13
13
|
import { scheduleList } from "./procedures/schedule/list.js";
|
|
14
14
|
import { scheduleRemove } from "./procedures/schedule/remove.js";
|
|
15
15
|
import { scheduleNext } from "./procedures/schedule/next.js";
|
|
16
|
+
import { checkTimeZone } from "./cron.js";
|
|
16
17
|
import { DEFAULT_SCHEDULE_SETTINGS, PROGRAM_KEY } from "./programs.js";
|
|
17
18
|
// =============================================================================
|
|
18
19
|
// Schemas
|
|
19
20
|
// =============================================================================
|
|
20
21
|
const cron = z.string().min(1).max(200).describe("The cron expression: 5 fields (minute hour day month weekday), or @hourly, @daily, @weekly, @monthly, @yearly");
|
|
21
|
-
const timeZone = z
|
|
22
|
+
const timeZone = z
|
|
23
|
+
.string()
|
|
24
|
+
.min(1)
|
|
25
|
+
.max(100)
|
|
26
|
+
.describe("The time zone of the expression: utc, local (default) or an IANA name such as Europe/Berlin");
|
|
22
27
|
const scheduleId = z
|
|
23
28
|
.string()
|
|
24
29
|
.regex(/^[A-Za-z0-9._:-]{1,200}$/, "Letters, digits, and . _ : -")
|
|
@@ -35,7 +40,7 @@ const view = z.object({
|
|
|
35
40
|
cron: z.string(),
|
|
36
41
|
program: z.string(),
|
|
37
42
|
input: z.unknown().optional(),
|
|
38
|
-
timeZone: z.
|
|
43
|
+
timeZone: z.string().describe("The time zone: utc, local or an IANA name"),
|
|
39
44
|
createdAt: z.number().describe("When the schedule was added, in milliseconds since 1970"),
|
|
40
45
|
capability: z
|
|
41
46
|
.custom((value) => value !== null && typeof value === "object")
|
|
@@ -161,6 +166,7 @@ export function createScheduleModule(options = {}) {
|
|
|
161
166
|
const settings = {
|
|
162
167
|
store: options.store ?? DEFAULT_SCHEDULE_SETTINGS.store,
|
|
163
168
|
now: options.now ?? DEFAULT_SCHEDULE_SETTINGS.now,
|
|
169
|
+
...(options.timeZone !== undefined ? { timeZone: checkTimeZone(options.timeZone) } : {}),
|
|
164
170
|
};
|
|
165
171
|
return defineModule("@procedures/schedule", scheduleProcedures(settings));
|
|
166
172
|
}
|