@tachybase/module-cron 1.3.18 → 1.3.20
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/client/cron-jobs-table/CronJobsTable.schema.d.ts +2 -3
- package/dist/client/index.js +3 -3
- package/dist/externalVersion.js +7 -7
- package/dist/node_modules/cron-parser/LICENSE +1 -1
- package/dist/node_modules/cron-parser/lib/date.js +252 -0
- package/dist/node_modules/cron-parser/lib/expression.js +1002 -0
- package/dist/node_modules/cron-parser/lib/field_compactor.js +70 -0
- package/dist/node_modules/cron-parser/lib/field_stringify.js +58 -0
- package/dist/node_modules/cron-parser/lib/parser.js +1 -0
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/cron-parser/types/common.d.ts +131 -0
- package/dist/node_modules/cron-parser/types/index.d.ts +45 -0
- package/dist/node_modules/cron-parser/types/ts3/index.d.ts +28 -0
- package/dist/server/service/StaticScheduleTrigger.d.ts +1 -1
- package/package.json +10 -10
- package/dist/node_modules/cron-parser/dist/CronDate.js +0 -497
- package/dist/node_modules/cron-parser/dist/CronExpression.js +0 -376
- package/dist/node_modules/cron-parser/dist/CronExpressionParser.js +0 -384
- package/dist/node_modules/cron-parser/dist/CronFieldCollection.js +0 -371
- package/dist/node_modules/cron-parser/dist/CronFileParser.js +0 -109
- package/dist/node_modules/cron-parser/dist/fields/CronDayOfMonth.js +0 -44
- package/dist/node_modules/cron-parser/dist/fields/CronDayOfWeek.js +0 -51
- package/dist/node_modules/cron-parser/dist/fields/CronField.js +0 -183
- package/dist/node_modules/cron-parser/dist/fields/CronHour.js +0 -40
- package/dist/node_modules/cron-parser/dist/fields/CronMinute.js +0 -40
- package/dist/node_modules/cron-parser/dist/fields/CronMonth.js +0 -44
- package/dist/node_modules/cron-parser/dist/fields/CronSecond.js +0 -40
- package/dist/node_modules/cron-parser/dist/fields/index.js +0 -24
- package/dist/node_modules/cron-parser/dist/fields/types.js +0 -2
- package/dist/node_modules/cron-parser/dist/index.js +0 -1
- package/dist/node_modules/cron-parser/dist/types/CronDate.d.ts +0 -273
- package/dist/node_modules/cron-parser/dist/types/CronExpression.d.ts +0 -110
- package/dist/node_modules/cron-parser/dist/types/CronExpressionParser.d.ts +0 -70
- package/dist/node_modules/cron-parser/dist/types/CronFieldCollection.d.ts +0 -153
- package/dist/node_modules/cron-parser/dist/types/CronFileParser.d.ts +0 -30
- package/dist/node_modules/cron-parser/dist/types/fields/CronDayOfMonth.d.ts +0 -25
- package/dist/node_modules/cron-parser/dist/types/fields/CronDayOfWeek.d.ts +0 -30
- package/dist/node_modules/cron-parser/dist/types/fields/CronField.d.ts +0 -114
- package/dist/node_modules/cron-parser/dist/types/fields/CronHour.d.ts +0 -23
- package/dist/node_modules/cron-parser/dist/types/fields/CronMinute.d.ts +0 -23
- package/dist/node_modules/cron-parser/dist/types/fields/CronMonth.d.ts +0 -24
- package/dist/node_modules/cron-parser/dist/types/fields/CronSecond.d.ts +0 -23
- package/dist/node_modules/cron-parser/dist/types/fields/index.d.ts +0 -8
- package/dist/node_modules/cron-parser/dist/types/fields/types.d.ts +0 -18
- package/dist/node_modules/cron-parser/dist/types/index.d.ts +0 -8
- package/dist/node_modules/cron-parser/dist/types/utils/random.d.ts +0 -10
- package/dist/node_modules/cron-parser/dist/utils/random.js +0 -38
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { CronDate } from './CronDate';
|
|
2
|
-
import { CronFieldCollection } from './CronFieldCollection';
|
|
3
|
-
export type CronExpressionOptions = {
|
|
4
|
-
currentDate?: Date | string | number | CronDate;
|
|
5
|
-
endDate?: Date | string | number | CronDate;
|
|
6
|
-
startDate?: Date | string | number | CronDate;
|
|
7
|
-
tz?: string;
|
|
8
|
-
expression?: string;
|
|
9
|
-
hashSeed?: string;
|
|
10
|
-
strict?: boolean;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Class representing a Cron expression.
|
|
14
|
-
*/
|
|
15
|
-
export declare class CronExpression {
|
|
16
|
-
#private;
|
|
17
|
-
/**
|
|
18
|
-
* Creates a new CronExpression instance.
|
|
19
|
-
*
|
|
20
|
-
* @param {CronFieldCollection} fields - Cron fields.
|
|
21
|
-
* @param {CronExpressionOptions} options - Parser options.
|
|
22
|
-
*/
|
|
23
|
-
constructor(fields: CronFieldCollection, options: CronExpressionOptions);
|
|
24
|
-
/**
|
|
25
|
-
* Getter for the cron fields.
|
|
26
|
-
*
|
|
27
|
-
* @returns {CronFieldCollection} Cron fields.
|
|
28
|
-
*/
|
|
29
|
-
get fields(): CronFieldCollection;
|
|
30
|
-
/**
|
|
31
|
-
* Converts cron fields back to a CronExpression instance.
|
|
32
|
-
*
|
|
33
|
-
* @public
|
|
34
|
-
* @param {Record<string, number[]>} fields - The input cron fields object.
|
|
35
|
-
* @param {CronExpressionOptions} [options] - Optional parsing options.
|
|
36
|
-
* @returns {CronExpression} - A new CronExpression instance.
|
|
37
|
-
*/
|
|
38
|
-
static fieldsToExpression(fields: CronFieldCollection, options?: CronExpressionOptions): CronExpression;
|
|
39
|
-
/**
|
|
40
|
-
* Find the next scheduled date based on the cron expression.
|
|
41
|
-
* @returns {CronDate} - The next scheduled date or an ES6 compatible iterator object.
|
|
42
|
-
* @memberof CronExpression
|
|
43
|
-
* @public
|
|
44
|
-
*/
|
|
45
|
-
next(): CronDate;
|
|
46
|
-
/**
|
|
47
|
-
* Find the previous scheduled date based on the cron expression.
|
|
48
|
-
* @returns {CronDate} - The previous scheduled date or an ES6 compatible iterator object.
|
|
49
|
-
* @memberof CronExpression
|
|
50
|
-
* @public
|
|
51
|
-
*/
|
|
52
|
-
prev(): CronDate;
|
|
53
|
-
/**
|
|
54
|
-
* Check if there is a next scheduled date based on the current date and cron expression.
|
|
55
|
-
* @returns {boolean} - Returns true if there is a next scheduled date, false otherwise.
|
|
56
|
-
* @memberof CronExpression
|
|
57
|
-
* @public
|
|
58
|
-
*/
|
|
59
|
-
hasNext(): boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Check if there is a previous scheduled date based on the current date and cron expression.
|
|
62
|
-
* @returns {boolean} - Returns true if there is a previous scheduled date, false otherwise.
|
|
63
|
-
* @memberof CronExpression
|
|
64
|
-
* @public
|
|
65
|
-
*/
|
|
66
|
-
hasPrev(): boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Iterate over a specified number of steps and optionally execute a callback function for each step.
|
|
69
|
-
* @param {number} steps - The number of steps to iterate. Positive value iterates forward, negative value iterates backward.
|
|
70
|
-
* @returns {CronDate[]} - An array of iterator fields or CronDate objects.
|
|
71
|
-
* @memberof CronExpression
|
|
72
|
-
* @public
|
|
73
|
-
*/
|
|
74
|
-
take(limit: number): CronDate[];
|
|
75
|
-
/**
|
|
76
|
-
* Reset the iterators current date to a new date or the initial date.
|
|
77
|
-
* @param {Date | CronDate} [newDate] - Optional new date to reset to. If not provided, it will reset to the initial date.
|
|
78
|
-
* @memberof CronExpression
|
|
79
|
-
* @public
|
|
80
|
-
*/
|
|
81
|
-
reset(newDate?: Date | CronDate): void;
|
|
82
|
-
/**
|
|
83
|
-
* Generate a string representation of the cron expression.
|
|
84
|
-
* @param {boolean} [includeSeconds=false] - Whether to include the seconds field in the string representation.
|
|
85
|
-
* @returns {string} - The string representation of the cron expression.
|
|
86
|
-
* @memberof CronExpression
|
|
87
|
-
* @public
|
|
88
|
-
*/
|
|
89
|
-
stringify(includeSeconds?: boolean): string;
|
|
90
|
-
/**
|
|
91
|
-
* Check if the cron expression includes the given date
|
|
92
|
-
* @param {Date|CronDate} date
|
|
93
|
-
* @returns {boolean}
|
|
94
|
-
*/
|
|
95
|
-
includesDate(date: Date | CronDate): boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Returns the string representation of the cron expression.
|
|
98
|
-
* @returns {CronDate} - The next schedule date.
|
|
99
|
-
*/
|
|
100
|
-
toString(): string;
|
|
101
|
-
/**
|
|
102
|
-
* Returns an iterator for iterating through future CronDate instances
|
|
103
|
-
*
|
|
104
|
-
* @name Symbol.iterator
|
|
105
|
-
* @memberof CronExpression
|
|
106
|
-
* @returns {Iterator<CronDate>} An iterator object for CronExpression that returns CronDate values.
|
|
107
|
-
*/
|
|
108
|
-
[Symbol.iterator](): Iterator<CronDate>;
|
|
109
|
-
}
|
|
110
|
-
export default CronExpression;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { CronExpression, CronExpressionOptions } from './CronExpression';
|
|
2
|
-
export declare enum PredefinedExpressions {
|
|
3
|
-
'@yearly' = "0 0 0 1 1 *",
|
|
4
|
-
'@annually' = "0 0 0 1 1 *",
|
|
5
|
-
'@monthly' = "0 0 0 1 * *",
|
|
6
|
-
'@weekly' = "0 0 0 * * 0",
|
|
7
|
-
'@daily' = "0 0 0 * * *",
|
|
8
|
-
'@hourly' = "0 0 * * * *",
|
|
9
|
-
'@minutely' = "0 * * * * *",
|
|
10
|
-
'@secondly' = "* * * * * *",
|
|
11
|
-
'@weekdays' = "0 0 0 * * 1-5",
|
|
12
|
-
'@weekends' = "0 0 0 * * 0,6"
|
|
13
|
-
}
|
|
14
|
-
export declare enum CronUnit {
|
|
15
|
-
Second = "Second",
|
|
16
|
-
Minute = "Minute",
|
|
17
|
-
Hour = "Hour",
|
|
18
|
-
DayOfMonth = "DayOfMonth",
|
|
19
|
-
Month = "Month",
|
|
20
|
-
DayOfWeek = "DayOfWeek"
|
|
21
|
-
}
|
|
22
|
-
export declare enum Months {
|
|
23
|
-
jan = 1,
|
|
24
|
-
feb = 2,
|
|
25
|
-
mar = 3,
|
|
26
|
-
apr = 4,
|
|
27
|
-
may = 5,
|
|
28
|
-
jun = 6,
|
|
29
|
-
jul = 7,
|
|
30
|
-
aug = 8,
|
|
31
|
-
sep = 9,
|
|
32
|
-
oct = 10,
|
|
33
|
-
nov = 11,
|
|
34
|
-
dec = 12
|
|
35
|
-
}
|
|
36
|
-
export declare enum DayOfWeek {
|
|
37
|
-
sun = 0,
|
|
38
|
-
mon = 1,
|
|
39
|
-
tue = 2,
|
|
40
|
-
wed = 3,
|
|
41
|
-
thu = 4,
|
|
42
|
-
fri = 5,
|
|
43
|
-
sat = 6
|
|
44
|
-
}
|
|
45
|
-
export type RawCronFields = {
|
|
46
|
-
second: string;
|
|
47
|
-
minute: string;
|
|
48
|
-
hour: string;
|
|
49
|
-
dayOfMonth: string;
|
|
50
|
-
month: string;
|
|
51
|
-
dayOfWeek: string;
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Static class that parses a cron expression and returns a CronExpression object.
|
|
55
|
-
* @static
|
|
56
|
-
* @class CronExpressionParser
|
|
57
|
-
*/
|
|
58
|
-
export declare class CronExpressionParser {
|
|
59
|
-
#private;
|
|
60
|
-
/**
|
|
61
|
-
* Parses a cron expression and returns a CronExpression object.
|
|
62
|
-
* @param {string} expression - The cron expression to parse.
|
|
63
|
-
* @param {CronExpressionOptions} [options={}] - The options to use when parsing the expression.
|
|
64
|
-
* @param {boolean} [options.strict=false] - If true, will throw an error if the expression contains both dayOfMonth and dayOfWeek.
|
|
65
|
-
* @param {CronDate} [options.currentDate=new CronDate(undefined, 'UTC')] - The date to use when calculating the next/previous occurrence.
|
|
66
|
-
*
|
|
67
|
-
* @returns {CronExpression} A CronExpression object.
|
|
68
|
-
*/
|
|
69
|
-
static parse(expression: string, options?: CronExpressionOptions): CronExpression;
|
|
70
|
-
}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { CronSecond, CronMinute, CronHour, CronDayOfMonth, CronMonth, CronDayOfWeek, CronField, SerializedCronField, CronChars } from './fields';
|
|
2
|
-
import { SixtyRange, HourRange, DayOfMonthRange, MonthRange, DayOfWeekRange } from './fields/types';
|
|
3
|
-
export type FieldRange = {
|
|
4
|
-
start: number | CronChars;
|
|
5
|
-
count: number;
|
|
6
|
-
end?: number;
|
|
7
|
-
step?: number;
|
|
8
|
-
};
|
|
9
|
-
export type CronFields = {
|
|
10
|
-
second: CronSecond;
|
|
11
|
-
minute: CronMinute;
|
|
12
|
-
hour: CronHour;
|
|
13
|
-
dayOfMonth: CronDayOfMonth;
|
|
14
|
-
month: CronMonth;
|
|
15
|
-
dayOfWeek: CronDayOfWeek;
|
|
16
|
-
};
|
|
17
|
-
export type CronFieldOverride = {
|
|
18
|
-
second?: CronSecond | SixtyRange[];
|
|
19
|
-
minute?: CronMinute | SixtyRange[];
|
|
20
|
-
hour?: CronHour | HourRange[];
|
|
21
|
-
dayOfMonth?: CronDayOfMonth | DayOfMonthRange[];
|
|
22
|
-
month?: CronMonth | MonthRange[];
|
|
23
|
-
dayOfWeek?: CronDayOfWeek | DayOfWeekRange[];
|
|
24
|
-
};
|
|
25
|
-
export type SerializedCronFields = {
|
|
26
|
-
second: SerializedCronField;
|
|
27
|
-
minute: SerializedCronField;
|
|
28
|
-
hour: SerializedCronField;
|
|
29
|
-
dayOfMonth: SerializedCronField;
|
|
30
|
-
month: SerializedCronField;
|
|
31
|
-
dayOfWeek: SerializedCronField;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Represents a complete set of cron fields.
|
|
35
|
-
* @class CronFieldCollection
|
|
36
|
-
*/
|
|
37
|
-
export declare class CronFieldCollection {
|
|
38
|
-
#private;
|
|
39
|
-
/**
|
|
40
|
-
* Creates a new CronFieldCollection instance by partially overriding fields from an existing one.
|
|
41
|
-
* @param {CronFieldCollection} base - The base CronFieldCollection to copy fields from
|
|
42
|
-
* @param {CronFieldOverride} fields - The fields to override, can be CronField instances or raw values
|
|
43
|
-
* @returns {CronFieldCollection} A new CronFieldCollection instance
|
|
44
|
-
* @example
|
|
45
|
-
* const base = new CronFieldCollection({
|
|
46
|
-
* second: new CronSecond([0]),
|
|
47
|
-
* minute: new CronMinute([0]),
|
|
48
|
-
* hour: new CronHour([12]),
|
|
49
|
-
* dayOfMonth: new CronDayOfMonth([1]),
|
|
50
|
-
* month: new CronMonth([1]),
|
|
51
|
-
* dayOfWeek: new CronDayOfWeek([1])
|
|
52
|
-
* });
|
|
53
|
-
*
|
|
54
|
-
* // Using CronField instances
|
|
55
|
-
* const modified1 = CronFieldCollection.from(base, {
|
|
56
|
-
* hour: new CronHour([15]),
|
|
57
|
-
* minute: new CronMinute([30])
|
|
58
|
-
* });
|
|
59
|
-
*
|
|
60
|
-
* // Using raw values
|
|
61
|
-
* const modified2 = CronFieldCollection.from(base, {
|
|
62
|
-
* hour: [15], // Will create new CronHour
|
|
63
|
-
* minute: [30] // Will create new CronMinute
|
|
64
|
-
* });
|
|
65
|
-
*/
|
|
66
|
-
static from(base: CronFieldCollection, fields: CronFieldOverride): CronFieldCollection;
|
|
67
|
-
/**
|
|
68
|
-
* Resolves a field value, either using the provided CronField instance or creating a new one from raw values.
|
|
69
|
-
* @param constructor - The constructor for creating new field instances
|
|
70
|
-
* @param baseField - The base field to use if no override is provided
|
|
71
|
-
* @param fieldValue - The override value, either a CronField instance or raw values
|
|
72
|
-
* @returns The resolved CronField instance
|
|
73
|
-
* @private
|
|
74
|
-
*/
|
|
75
|
-
private static resolveField;
|
|
76
|
-
/**
|
|
77
|
-
* CronFieldCollection constructor. Initializes the cron fields with the provided values.
|
|
78
|
-
* @param {CronFields} param0 - The cron fields values
|
|
79
|
-
* @throws {Error} if validation fails
|
|
80
|
-
* @example
|
|
81
|
-
* const cronFields = new CronFieldCollection({
|
|
82
|
-
* second: new CronSecond([0]),
|
|
83
|
-
* minute: new CronMinute([0, 30]),
|
|
84
|
-
* hour: new CronHour([9]),
|
|
85
|
-
* dayOfMonth: new CronDayOfMonth([15]),
|
|
86
|
-
* month: new CronMonth([1]),
|
|
87
|
-
* dayOfWeek: new CronDayOfTheWeek([1, 2, 3, 4, 5]),
|
|
88
|
-
* })
|
|
89
|
-
*
|
|
90
|
-
* console.log(cronFields.second.values); // [0]
|
|
91
|
-
* console.log(cronFields.minute.values); // [0, 30]
|
|
92
|
-
* console.log(cronFields.hour.values); // [9]
|
|
93
|
-
* console.log(cronFields.dayOfMonth.values); // [15]
|
|
94
|
-
* console.log(cronFields.month.values); // [1]
|
|
95
|
-
* console.log(cronFields.dayOfWeek.values); // [1, 2, 3, 4, 5]
|
|
96
|
-
*/
|
|
97
|
-
constructor({ second, minute, hour, dayOfMonth, month, dayOfWeek }: CronFields);
|
|
98
|
-
/**
|
|
99
|
-
* Returns the second field.
|
|
100
|
-
* @returns {CronSecond}
|
|
101
|
-
*/
|
|
102
|
-
get second(): CronSecond;
|
|
103
|
-
/**
|
|
104
|
-
* Returns the minute field.
|
|
105
|
-
* @returns {CronMinute}
|
|
106
|
-
*/
|
|
107
|
-
get minute(): CronMinute;
|
|
108
|
-
/**
|
|
109
|
-
* Returns the hour field.
|
|
110
|
-
* @returns {CronHour}
|
|
111
|
-
*/
|
|
112
|
-
get hour(): CronHour;
|
|
113
|
-
/**
|
|
114
|
-
* Returns the day of the month field.
|
|
115
|
-
* @returns {CronDayOfMonth}
|
|
116
|
-
*/
|
|
117
|
-
get dayOfMonth(): CronDayOfMonth;
|
|
118
|
-
/**
|
|
119
|
-
* Returns the month field.
|
|
120
|
-
* @returns {CronMonth}
|
|
121
|
-
*/
|
|
122
|
-
get month(): CronMonth;
|
|
123
|
-
/**
|
|
124
|
-
* Returns the day of the week field.
|
|
125
|
-
* @returns {CronDayOfWeek}
|
|
126
|
-
*/
|
|
127
|
-
get dayOfWeek(): CronDayOfWeek;
|
|
128
|
-
/**
|
|
129
|
-
* Returns a string representation of the cron fields.
|
|
130
|
-
* @param {(number | CronChars)[]} input - The cron fields values
|
|
131
|
-
* @static
|
|
132
|
-
* @returns {FieldRange[]} - The compacted cron fields
|
|
133
|
-
*/
|
|
134
|
-
static compactField(input: (number | CronChars)[]): FieldRange[];
|
|
135
|
-
/**
|
|
136
|
-
* Returns a string representation of the cron fields.
|
|
137
|
-
* @param {CronField} field - The cron field to stringify
|
|
138
|
-
* @static
|
|
139
|
-
* @returns {string} - The stringified cron field
|
|
140
|
-
*/
|
|
141
|
-
stringifyField(field: CronField): string;
|
|
142
|
-
/**
|
|
143
|
-
* Returns a string representation of the cron field values.
|
|
144
|
-
* @param {boolean} includeSeconds - Whether to include seconds in the output
|
|
145
|
-
* @returns {string} The formatted cron string
|
|
146
|
-
*/
|
|
147
|
-
stringify(includeSeconds?: boolean): string;
|
|
148
|
-
/**
|
|
149
|
-
* Returns a serialized representation of the cron fields values.
|
|
150
|
-
* @returns {SerializedCronFields} An object containing the cron field values
|
|
151
|
-
*/
|
|
152
|
-
serialize(): SerializedCronFields;
|
|
153
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { CronExpression } from './CronExpression';
|
|
2
|
-
export type CronFileParserResult = {
|
|
3
|
-
variables: {
|
|
4
|
-
[key: string]: string;
|
|
5
|
-
};
|
|
6
|
-
expressions: CronExpression[];
|
|
7
|
-
errors: {
|
|
8
|
-
[key: string]: unknown;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Parser for crontab files that handles both synchronous and asynchronous operations.
|
|
13
|
-
*/
|
|
14
|
-
export declare class CronFileParser {
|
|
15
|
-
#private;
|
|
16
|
-
/**
|
|
17
|
-
* Parse a crontab file asynchronously
|
|
18
|
-
* @param filePath Path to crontab file
|
|
19
|
-
* @returns Promise resolving to parse results
|
|
20
|
-
* @throws If file cannot be read
|
|
21
|
-
*/
|
|
22
|
-
static parseFile(filePath: string): Promise<CronFileParserResult>;
|
|
23
|
-
/**
|
|
24
|
-
* Parse a crontab file synchronously
|
|
25
|
-
* @param filePath Path to crontab file
|
|
26
|
-
* @returns Parse results
|
|
27
|
-
* @throws If file cannot be read
|
|
28
|
-
*/
|
|
29
|
-
static parseFileSync(filePath: string): CronFileParserResult;
|
|
30
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { CronField, CronFieldOptions } from './CronField';
|
|
2
|
-
import { CronChars, CronMax, CronMin, DayOfMonthRange } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Represents the "day of the month" field within a cron expression.
|
|
5
|
-
* @class CronDayOfMonth
|
|
6
|
-
* @extends CronField
|
|
7
|
-
*/
|
|
8
|
-
export declare class CronDayOfMonth extends CronField {
|
|
9
|
-
static get min(): CronMin;
|
|
10
|
-
static get max(): CronMax;
|
|
11
|
-
static get chars(): CronChars[];
|
|
12
|
-
static get validChars(): RegExp;
|
|
13
|
-
/**
|
|
14
|
-
* CronDayOfMonth constructor. Initializes the "day of the month" field with the provided values.
|
|
15
|
-
* @param {DayOfMonthRange[]} values - Values for the "day of the month" field
|
|
16
|
-
* @param {CronFieldOptions} [options] - Options provided by the parser
|
|
17
|
-
* @throws {Error} if validation fails
|
|
18
|
-
*/
|
|
19
|
-
constructor(values: DayOfMonthRange[], options?: CronFieldOptions);
|
|
20
|
-
/**
|
|
21
|
-
* Returns an array of allowed values for the "day of the month" field.
|
|
22
|
-
* @returns {DayOfMonthRange[]}
|
|
23
|
-
*/
|
|
24
|
-
get values(): DayOfMonthRange[];
|
|
25
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { CronField, CronFieldOptions } from './CronField';
|
|
2
|
-
import { CronChars, CronMax, CronMin, DayOfWeekRange } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Represents the "day of the week" field within a cron expression.
|
|
5
|
-
* @class CronDayOfTheWeek
|
|
6
|
-
* @extends CronField
|
|
7
|
-
*/
|
|
8
|
-
export declare class CronDayOfWeek extends CronField {
|
|
9
|
-
static get min(): CronMin;
|
|
10
|
-
static get max(): CronMax;
|
|
11
|
-
static get chars(): readonly CronChars[];
|
|
12
|
-
static get validChars(): RegExp;
|
|
13
|
-
/**
|
|
14
|
-
* CronDayOfTheWeek constructor. Initializes the "day of the week" field with the provided values.
|
|
15
|
-
* @param {DayOfWeekRange[]} values - Values for the "day of the week" field
|
|
16
|
-
* @param {CronFieldOptions} [options] - Options provided by the parser
|
|
17
|
-
*/
|
|
18
|
-
constructor(values: DayOfWeekRange[], options?: CronFieldOptions);
|
|
19
|
-
/**
|
|
20
|
-
* Returns an array of allowed values for the "day of the week" field.
|
|
21
|
-
* @returns {DayOfWeekRange[]}
|
|
22
|
-
*/
|
|
23
|
-
get values(): DayOfWeekRange[];
|
|
24
|
-
/**
|
|
25
|
-
* Returns the nth day of the week if specified in the cron expression.
|
|
26
|
-
* This is used for the '#' character in the cron expression.
|
|
27
|
-
* @returns {number} The nth day of the week (1-5) or 0 if not specified.
|
|
28
|
-
*/
|
|
29
|
-
get nthDay(): number;
|
|
30
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { CronChars, CronConstraints, CronFieldType, CronMax, CronMin } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Represents the serialized form of a cron field.
|
|
4
|
-
* @typedef {Object} SerializedCronField
|
|
5
|
-
* @property {boolean} wildcard - Indicates if the field is a wildcard.
|
|
6
|
-
* @property {(number|string)[]} values - The values of the field.
|
|
7
|
-
*/
|
|
8
|
-
export type SerializedCronField = {
|
|
9
|
-
wildcard: boolean;
|
|
10
|
-
values: (number | string)[];
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Represents the options for a cron field.
|
|
14
|
-
* @typedef {Object} CronFieldOptions
|
|
15
|
-
* @property {string} rawValue - The raw value of the field.
|
|
16
|
-
* @property {boolean} [wildcard] - Indicates if the field is a wildcard.
|
|
17
|
-
* @property {number} [nthDayOfWeek] - The nth day of the week.
|
|
18
|
-
*/
|
|
19
|
-
export type CronFieldOptions = {
|
|
20
|
-
rawValue?: string;
|
|
21
|
-
wildcard?: boolean;
|
|
22
|
-
nthDayOfWeek?: number;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Represents a field within a cron expression.
|
|
26
|
-
* This is a base class and should not be instantiated directly.
|
|
27
|
-
* @class CronField
|
|
28
|
-
*/
|
|
29
|
-
export declare abstract class CronField {
|
|
30
|
-
#private;
|
|
31
|
-
protected readonly options: CronFieldOptions & {
|
|
32
|
-
rawValue: string;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Returns the minimum value allowed for this field.
|
|
36
|
-
*/
|
|
37
|
-
static get min(): CronMin;
|
|
38
|
-
/**
|
|
39
|
-
* Returns the maximum value allowed for this field.
|
|
40
|
-
*/
|
|
41
|
-
static get max(): CronMax;
|
|
42
|
-
/**
|
|
43
|
-
* Returns the allowed characters for this field.
|
|
44
|
-
*/
|
|
45
|
-
static get chars(): readonly CronChars[];
|
|
46
|
-
/**
|
|
47
|
-
* Returns the regular expression used to validate this field.
|
|
48
|
-
*/
|
|
49
|
-
static get validChars(): RegExp;
|
|
50
|
-
/**
|
|
51
|
-
* Returns the constraints for this field.
|
|
52
|
-
*/
|
|
53
|
-
static get constraints(): CronConstraints;
|
|
54
|
-
/**
|
|
55
|
-
* CronField constructor. Initializes the field with the provided values.
|
|
56
|
-
* @param {number[] | string[]} values - Values for this field
|
|
57
|
-
* @param {CronFieldOptions} [options] - Options provided by the parser
|
|
58
|
-
* @throws {TypeError} if the constructor is called directly
|
|
59
|
-
* @throws {Error} if validation fails
|
|
60
|
-
*/
|
|
61
|
-
protected constructor(values: (number | string)[], options?: CronFieldOptions);
|
|
62
|
-
/**
|
|
63
|
-
* Returns the minimum value allowed for this field.
|
|
64
|
-
* @returns {number}
|
|
65
|
-
*/
|
|
66
|
-
get min(): number;
|
|
67
|
-
/**
|
|
68
|
-
* Returns the maximum value allowed for this field.
|
|
69
|
-
* @returns {number}
|
|
70
|
-
*/
|
|
71
|
-
get max(): number;
|
|
72
|
-
/**
|
|
73
|
-
* Returns an array of allowed special characters for this field.
|
|
74
|
-
* @returns {string[]}
|
|
75
|
-
*/
|
|
76
|
-
get chars(): readonly string[];
|
|
77
|
-
/**
|
|
78
|
-
* Indicates whether this field has a "last" character.
|
|
79
|
-
* @returns {boolean}
|
|
80
|
-
*/
|
|
81
|
-
get hasLastChar(): boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Indicates whether this field has a "question mark" character.
|
|
84
|
-
* @returns {boolean}
|
|
85
|
-
*/
|
|
86
|
-
get hasQuestionMarkChar(): boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Indicates whether this field is a wildcard.
|
|
89
|
-
* @returns {boolean}
|
|
90
|
-
*/
|
|
91
|
-
get isWildcard(): boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Returns an array of allowed values for this field.
|
|
94
|
-
* @returns {CronFieldType}
|
|
95
|
-
*/
|
|
96
|
-
get values(): CronFieldType;
|
|
97
|
-
/**
|
|
98
|
-
* Helper function to sort values in ascending order.
|
|
99
|
-
* @param {number | string} a - First value to compare
|
|
100
|
-
* @param {number | string} b - Second value to compare
|
|
101
|
-
* @returns {number} - A negative, zero, or positive value, depending on the sort order
|
|
102
|
-
*/
|
|
103
|
-
static sorter(a: number | string, b: number | string): number;
|
|
104
|
-
/**
|
|
105
|
-
* Serializes the field to an object.
|
|
106
|
-
* @returns {SerializedCronField}
|
|
107
|
-
*/
|
|
108
|
-
serialize(): SerializedCronField;
|
|
109
|
-
/**
|
|
110
|
-
* Validates the field values against the allowed range and special characters.
|
|
111
|
-
* @throws {Error} if validation fails
|
|
112
|
-
*/
|
|
113
|
-
validate(): void;
|
|
114
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { CronField, CronFieldOptions } from './CronField';
|
|
2
|
-
import { CronChars, CronMax, CronMin, HourRange } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Represents the "hour" field within a cron expression.
|
|
5
|
-
* @class CronHour
|
|
6
|
-
* @extends CronField
|
|
7
|
-
*/
|
|
8
|
-
export declare class CronHour extends CronField {
|
|
9
|
-
static get min(): CronMin;
|
|
10
|
-
static get max(): CronMax;
|
|
11
|
-
static get chars(): readonly CronChars[];
|
|
12
|
-
/**
|
|
13
|
-
* CronHour constructor. Initializes the "hour" field with the provided values.
|
|
14
|
-
* @param {HourRange[]} values - Values for the "hour" field
|
|
15
|
-
* @param {CronFieldOptions} [options] - Options provided by the parser
|
|
16
|
-
*/
|
|
17
|
-
constructor(values: HourRange[], options?: CronFieldOptions);
|
|
18
|
-
/**
|
|
19
|
-
* Returns an array of allowed values for the "hour" field.
|
|
20
|
-
* @returns {HourRange[]}
|
|
21
|
-
*/
|
|
22
|
-
get values(): HourRange[];
|
|
23
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { CronField, CronFieldOptions } from './CronField';
|
|
2
|
-
import { CronChars, CronMax, CronMin, SixtyRange } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Represents the "second" field within a cron expression.
|
|
5
|
-
* @class CronSecond
|
|
6
|
-
* @extends CronField
|
|
7
|
-
*/
|
|
8
|
-
export declare class CronMinute extends CronField {
|
|
9
|
-
static get min(): CronMin;
|
|
10
|
-
static get max(): CronMax;
|
|
11
|
-
static get chars(): readonly CronChars[];
|
|
12
|
-
/**
|
|
13
|
-
* CronSecond constructor. Initializes the "second" field with the provided values.
|
|
14
|
-
* @param {SixtyRange[]} values - Values for the "second" field
|
|
15
|
-
* @param {CronFieldOptions} [options] - Options provided by the parser
|
|
16
|
-
*/
|
|
17
|
-
constructor(values: SixtyRange[], options?: CronFieldOptions);
|
|
18
|
-
/**
|
|
19
|
-
* Returns an array of allowed values for the "second" field.
|
|
20
|
-
* @returns {SixtyRange[]}
|
|
21
|
-
*/
|
|
22
|
-
get values(): SixtyRange[];
|
|
23
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { CronField, CronFieldOptions } from './CronField';
|
|
2
|
-
import { CronChars, CronMax, CronMin, MonthRange } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Represents the "day of the month" field within a cron expression.
|
|
5
|
-
* @class CronDayOfMonth
|
|
6
|
-
* @extends CronField
|
|
7
|
-
*/
|
|
8
|
-
export declare class CronMonth extends CronField {
|
|
9
|
-
static get min(): CronMin;
|
|
10
|
-
static get max(): CronMax;
|
|
11
|
-
static get chars(): readonly CronChars[];
|
|
12
|
-
static get daysInMonth(): readonly number[];
|
|
13
|
-
/**
|
|
14
|
-
* CronDayOfMonth constructor. Initializes the "day of the month" field with the provided values.
|
|
15
|
-
* @param {MonthRange[]} values - Values for the "day of the month" field
|
|
16
|
-
* @param {CronFieldOptions} [options] - Options provided by the parser
|
|
17
|
-
*/
|
|
18
|
-
constructor(values: MonthRange[], options?: CronFieldOptions);
|
|
19
|
-
/**
|
|
20
|
-
* Returns an array of allowed values for the "day of the month" field.
|
|
21
|
-
* @returns {MonthRange[]}
|
|
22
|
-
*/
|
|
23
|
-
get values(): MonthRange[];
|
|
24
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { CronChars, CronMax, CronMin, SixtyRange } from './types';
|
|
2
|
-
import { CronField, CronFieldOptions } from './CronField';
|
|
3
|
-
/**
|
|
4
|
-
* Represents the "second" field within a cron expression.
|
|
5
|
-
* @class CronSecond
|
|
6
|
-
* @extends CronField
|
|
7
|
-
*/
|
|
8
|
-
export declare class CronSecond extends CronField {
|
|
9
|
-
static get min(): CronMin;
|
|
10
|
-
static get max(): CronMax;
|
|
11
|
-
static get chars(): readonly CronChars[];
|
|
12
|
-
/**
|
|
13
|
-
* CronSecond constructor. Initializes the "second" field with the provided values.
|
|
14
|
-
* @param {SixtyRange[]} values - Values for the "second" field
|
|
15
|
-
* @param {CronFieldOptions} [options] - Options provided by the parser
|
|
16
|
-
*/
|
|
17
|
-
constructor(values: SixtyRange[], options?: CronFieldOptions);
|
|
18
|
-
/**
|
|
19
|
-
* Returns an array of allowed values for the "second" field.
|
|
20
|
-
* @returns {SixtyRange[]}
|
|
21
|
-
*/
|
|
22
|
-
get values(): SixtyRange[];
|
|
23
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type RangeFrom<LENGTH extends number, ACC extends unknown[] = []> = ACC['length'] extends LENGTH ? ACC : RangeFrom<LENGTH, [...ACC, 1]>;
|
|
2
|
-
export type IntRange<FROM extends number[], TO extends number, ACC extends number = never> = FROM['length'] extends TO ? ACC | TO : IntRange<[...FROM, 1], TO, ACC | FROM['length']>;
|
|
3
|
-
export type SixtyRange = IntRange<RangeFrom<0>, 59>;
|
|
4
|
-
export type HourRange = IntRange<RangeFrom<0>, 23>;
|
|
5
|
-
export type DayOfMonthRange = IntRange<RangeFrom<1>, 31> | 'L';
|
|
6
|
-
export type MonthRange = IntRange<RangeFrom<1>, 12>;
|
|
7
|
-
export type DayOfWeekRange = IntRange<RangeFrom<0>, 7>;
|
|
8
|
-
export type CronFieldType = SixtyRange[] | HourRange[] | DayOfMonthRange[] | MonthRange[] | DayOfWeekRange[];
|
|
9
|
-
export type CronChars = 'L' | 'W';
|
|
10
|
-
export type CronMin = 0 | 1;
|
|
11
|
-
export type CronMax = 7 | 12 | 23 | 31 | 59;
|
|
12
|
-
export type ParseRangeResponse = number[] | string[] | number | string;
|
|
13
|
-
export type CronConstraints = {
|
|
14
|
-
min: CronMin;
|
|
15
|
-
max: CronMax;
|
|
16
|
-
chars: readonly CronChars[];
|
|
17
|
-
validChars: RegExp;
|
|
18
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { CronExpressionParser } from './CronExpressionParser';
|
|
2
|
-
export { CronDate } from './CronDate';
|
|
3
|
-
export { CronFieldCollection } from './CronFieldCollection';
|
|
4
|
-
export { CronExpression, CronExpressionOptions } from './CronExpression';
|
|
5
|
-
export { CronExpressionParser } from './CronExpressionParser';
|
|
6
|
-
export { CronFileParser, CronFileParserResult } from './CronFileParser';
|
|
7
|
-
export * from './fields';
|
|
8
|
-
export default CronExpressionParser;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A type representing a Pseudorandom Number Generator, similar to Math.random()
|
|
3
|
-
*/
|
|
4
|
-
export type PRNG = () => number;
|
|
5
|
-
/**
|
|
6
|
-
* Generates a PRNG using a given seed. When not provided, the seed is randomly generated
|
|
7
|
-
* @param {string} str A string to derive the seed from
|
|
8
|
-
* @returns {PRNG} A random number generator correctly seeded
|
|
9
|
-
*/
|
|
10
|
-
export declare function seededRandom(str?: string): PRNG;
|