@tachybase/module-cron 1.3.18 → 1.3.19

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.
Files changed (47) hide show
  1. package/dist/client/cron-jobs-table/CronJobsTable.schema.d.ts +2 -3
  2. package/dist/client/index.js +3 -3
  3. package/dist/externalVersion.js +7 -7
  4. package/dist/node_modules/cron-parser/LICENSE +1 -1
  5. package/dist/node_modules/cron-parser/lib/date.js +252 -0
  6. package/dist/node_modules/cron-parser/lib/expression.js +1002 -0
  7. package/dist/node_modules/cron-parser/lib/field_compactor.js +70 -0
  8. package/dist/node_modules/cron-parser/lib/field_stringify.js +58 -0
  9. package/dist/node_modules/cron-parser/lib/parser.js +1 -0
  10. package/dist/node_modules/cron-parser/package.json +1 -1
  11. package/dist/node_modules/cron-parser/types/common.d.ts +131 -0
  12. package/dist/node_modules/cron-parser/types/index.d.ts +45 -0
  13. package/dist/node_modules/cron-parser/types/ts3/index.d.ts +28 -0
  14. package/dist/server/service/StaticScheduleTrigger.d.ts +1 -1
  15. package/package.json +10 -10
  16. package/dist/node_modules/cron-parser/dist/CronDate.js +0 -497
  17. package/dist/node_modules/cron-parser/dist/CronExpression.js +0 -376
  18. package/dist/node_modules/cron-parser/dist/CronExpressionParser.js +0 -384
  19. package/dist/node_modules/cron-parser/dist/CronFieldCollection.js +0 -371
  20. package/dist/node_modules/cron-parser/dist/CronFileParser.js +0 -109
  21. package/dist/node_modules/cron-parser/dist/fields/CronDayOfMonth.js +0 -44
  22. package/dist/node_modules/cron-parser/dist/fields/CronDayOfWeek.js +0 -51
  23. package/dist/node_modules/cron-parser/dist/fields/CronField.js +0 -183
  24. package/dist/node_modules/cron-parser/dist/fields/CronHour.js +0 -40
  25. package/dist/node_modules/cron-parser/dist/fields/CronMinute.js +0 -40
  26. package/dist/node_modules/cron-parser/dist/fields/CronMonth.js +0 -44
  27. package/dist/node_modules/cron-parser/dist/fields/CronSecond.js +0 -40
  28. package/dist/node_modules/cron-parser/dist/fields/index.js +0 -24
  29. package/dist/node_modules/cron-parser/dist/fields/types.js +0 -2
  30. package/dist/node_modules/cron-parser/dist/index.js +0 -1
  31. package/dist/node_modules/cron-parser/dist/types/CronDate.d.ts +0 -273
  32. package/dist/node_modules/cron-parser/dist/types/CronExpression.d.ts +0 -110
  33. package/dist/node_modules/cron-parser/dist/types/CronExpressionParser.d.ts +0 -70
  34. package/dist/node_modules/cron-parser/dist/types/CronFieldCollection.d.ts +0 -153
  35. package/dist/node_modules/cron-parser/dist/types/CronFileParser.d.ts +0 -30
  36. package/dist/node_modules/cron-parser/dist/types/fields/CronDayOfMonth.d.ts +0 -25
  37. package/dist/node_modules/cron-parser/dist/types/fields/CronDayOfWeek.d.ts +0 -30
  38. package/dist/node_modules/cron-parser/dist/types/fields/CronField.d.ts +0 -114
  39. package/dist/node_modules/cron-parser/dist/types/fields/CronHour.d.ts +0 -23
  40. package/dist/node_modules/cron-parser/dist/types/fields/CronMinute.d.ts +0 -23
  41. package/dist/node_modules/cron-parser/dist/types/fields/CronMonth.d.ts +0 -24
  42. package/dist/node_modules/cron-parser/dist/types/fields/CronSecond.d.ts +0 -23
  43. package/dist/node_modules/cron-parser/dist/types/fields/index.d.ts +0 -8
  44. package/dist/node_modules/cron-parser/dist/types/fields/types.d.ts +0 -18
  45. package/dist/node_modules/cron-parser/dist/types/index.d.ts +0 -8
  46. package/dist/node_modules/cron-parser/dist/types/utils/random.d.ts +0 -10
  47. package/dist/node_modules/cron-parser/dist/utils/random.js +0 -38
@@ -1,183 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CronField = void 0;
4
- /**
5
- * Represents a field within a cron expression.
6
- * This is a base class and should not be instantiated directly.
7
- * @class CronField
8
- */
9
- class CronField {
10
- #hasLastChar = false;
11
- #hasQuestionMarkChar = false;
12
- #wildcard = false;
13
- #values = [];
14
- options = { rawValue: '' };
15
- /**
16
- * Returns the minimum value allowed for this field.
17
- */
18
- /* istanbul ignore next */ static get min() {
19
- /* istanbul ignore next */
20
- throw new Error('min must be overridden');
21
- }
22
- /**
23
- * Returns the maximum value allowed for this field.
24
- */
25
- /* istanbul ignore next */ static get max() {
26
- /* istanbul ignore next */
27
- throw new Error('max must be overridden');
28
- }
29
- /**
30
- * Returns the allowed characters for this field.
31
- */
32
- /* istanbul ignore next */ static get chars() {
33
- /* istanbul ignore next - this is overridden */
34
- return Object.freeze([]);
35
- }
36
- /**
37
- * Returns the regular expression used to validate this field.
38
- */
39
- static get validChars() {
40
- return /^[?,*\dH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/;
41
- }
42
- /**
43
- * Returns the constraints for this field.
44
- */
45
- static get constraints() {
46
- return { min: this.min, max: this.max, chars: this.chars, validChars: this.validChars };
47
- }
48
- /**
49
- * CronField constructor. Initializes the field with the provided values.
50
- * @param {number[] | string[]} values - Values for this field
51
- * @param {CronFieldOptions} [options] - Options provided by the parser
52
- * @throws {TypeError} if the constructor is called directly
53
- * @throws {Error} if validation fails
54
- */
55
- constructor(values, options = { rawValue: '' }) {
56
- if (!Array.isArray(values)) {
57
- throw new Error(`${this.constructor.name} Validation error, values is not an array`);
58
- }
59
- if (!(values.length > 0)) {
60
- throw new Error(`${this.constructor.name} Validation error, values contains no values`);
61
- }
62
- /* istanbul ignore next */
63
- this.options = {
64
- ...options,
65
- rawValue: options.rawValue ?? '',
66
- };
67
- this.#values = values.sort(CronField.sorter);
68
- this.#wildcard = this.options.wildcard !== undefined ? this.options.wildcard : this.#isWildcardValue();
69
- this.#hasLastChar = this.options.rawValue.includes('L');
70
- this.#hasQuestionMarkChar = this.options.rawValue.includes('?');
71
- }
72
- /**
73
- * Returns the minimum value allowed for this field.
74
- * @returns {number}
75
- */
76
- get min() {
77
- // return the static value from the child class
78
- return this.constructor.min;
79
- }
80
- /**
81
- * Returns the maximum value allowed for this field.
82
- * @returns {number}
83
- */
84
- get max() {
85
- // return the static value from the child class
86
- return this.constructor.max;
87
- }
88
- /**
89
- * Returns an array of allowed special characters for this field.
90
- * @returns {string[]}
91
- */
92
- get chars() {
93
- // return the frozen static value from the child class
94
- return this.constructor.chars;
95
- }
96
- /**
97
- * Indicates whether this field has a "last" character.
98
- * @returns {boolean}
99
- */
100
- get hasLastChar() {
101
- return this.#hasLastChar;
102
- }
103
- /**
104
- * Indicates whether this field has a "question mark" character.
105
- * @returns {boolean}
106
- */
107
- get hasQuestionMarkChar() {
108
- return this.#hasQuestionMarkChar;
109
- }
110
- /**
111
- * Indicates whether this field is a wildcard.
112
- * @returns {boolean}
113
- */
114
- get isWildcard() {
115
- return this.#wildcard;
116
- }
117
- /**
118
- * Returns an array of allowed values for this field.
119
- * @returns {CronFieldType}
120
- */
121
- get values() {
122
- return this.#values;
123
- }
124
- /**
125
- * Helper function to sort values in ascending order.
126
- * @param {number | string} a - First value to compare
127
- * @param {number | string} b - Second value to compare
128
- * @returns {number} - A negative, zero, or positive value, depending on the sort order
129
- */
130
- static sorter(a, b) {
131
- const aIsNumber = typeof a === 'number';
132
- const bIsNumber = typeof b === 'number';
133
- if (aIsNumber && bIsNumber)
134
- return a - b;
135
- if (!aIsNumber && !bIsNumber)
136
- return a.localeCompare(b);
137
- return aIsNumber ? /* istanbul ignore next - A will always be a number until L-2 is supported */ -1 : 1;
138
- }
139
- /**
140
- * Serializes the field to an object.
141
- * @returns {SerializedCronField}
142
- */
143
- serialize() {
144
- return {
145
- wildcard: this.#wildcard,
146
- values: this.#values,
147
- };
148
- }
149
- /**
150
- * Validates the field values against the allowed range and special characters.
151
- * @throws {Error} if validation fails
152
- */
153
- validate() {
154
- let badValue;
155
- const charsString = this.chars.length > 0 ? ` or chars ${this.chars.join('')}` : '';
156
- const charTest = (value) => (char) => new RegExp(`^\\d{0,2}${char}$`).test(value);
157
- const rangeTest = (value) => {
158
- badValue = value;
159
- return typeof value === 'number' ? value >= this.min && value <= this.max : this.chars.some(charTest(value));
160
- };
161
- const isValidRange = this.#values.every(rangeTest);
162
- if (!isValidRange) {
163
- throw new Error(`${this.constructor.name} Validation error, got value ${badValue} expected range ${this.min}-${this.max}${charsString}`);
164
- }
165
- // check for duplicate value in this.#values array
166
- const duplicate = this.#values.find((value, index) => this.#values.indexOf(value) !== index);
167
- if (duplicate) {
168
- throw new Error(`${this.constructor.name} Validation error, duplicate values found: ${duplicate}`);
169
- }
170
- }
171
- /**
172
- * Determines if the field is a wildcard based on the values.
173
- * When options.rawValue is not empty, it checks if the raw value is a wildcard, otherwise it checks if all values in the range are included.
174
- * @returns {boolean}
175
- */
176
- #isWildcardValue() {
177
- if (this.options.rawValue.length > 0) {
178
- return ['*', '?'].includes(this.options.rawValue);
179
- }
180
- return Array.from({ length: this.max - this.min + 1 }, (_, i) => i + this.min).every((value) => this.#values.includes(value));
181
- }
182
- }
183
- exports.CronField = CronField;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CronHour = void 0;
4
- const CronField_1 = require("./CronField");
5
- const MIN_HOUR = 0;
6
- const MAX_HOUR = 23;
7
- const HOUR_CHARS = Object.freeze([]);
8
- /**
9
- * Represents the "hour" field within a cron expression.
10
- * @class CronHour
11
- * @extends CronField
12
- */
13
- class CronHour extends CronField_1.CronField {
14
- static get min() {
15
- return MIN_HOUR;
16
- }
17
- static get max() {
18
- return MAX_HOUR;
19
- }
20
- static get chars() {
21
- return HOUR_CHARS;
22
- }
23
- /**
24
- * CronHour constructor. Initializes the "hour" field with the provided values.
25
- * @param {HourRange[]} values - Values for the "hour" field
26
- * @param {CronFieldOptions} [options] - Options provided by the parser
27
- */
28
- constructor(values, options) {
29
- super(values, options);
30
- this.validate();
31
- }
32
- /**
33
- * Returns an array of allowed values for the "hour" field.
34
- * @returns {HourRange[]}
35
- */
36
- get values() {
37
- return super.values;
38
- }
39
- }
40
- exports.CronHour = CronHour;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CronMinute = void 0;
4
- const CronField_1 = require("./CronField");
5
- const MIN_MINUTE = 0;
6
- const MAX_MINUTE = 59;
7
- const MINUTE_CHARS = Object.freeze([]);
8
- /**
9
- * Represents the "second" field within a cron expression.
10
- * @class CronSecond
11
- * @extends CronField
12
- */
13
- class CronMinute extends CronField_1.CronField {
14
- static get min() {
15
- return MIN_MINUTE;
16
- }
17
- static get max() {
18
- return MAX_MINUTE;
19
- }
20
- static get chars() {
21
- return MINUTE_CHARS;
22
- }
23
- /**
24
- * CronSecond constructor. Initializes the "second" field with the provided values.
25
- * @param {SixtyRange[]} values - Values for the "second" field
26
- * @param {CronFieldOptions} [options] - Options provided by the parser
27
- */
28
- constructor(values, options) {
29
- super(values, options);
30
- this.validate();
31
- }
32
- /**
33
- * Returns an array of allowed values for the "second" field.
34
- * @returns {SixtyRange[]}
35
- */
36
- get values() {
37
- return super.values;
38
- }
39
- }
40
- exports.CronMinute = CronMinute;
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CronMonth = void 0;
4
- const CronDate_1 = require("../CronDate");
5
- const CronField_1 = require("./CronField");
6
- const MIN_MONTH = 1;
7
- const MAX_MONTH = 12;
8
- const MONTH_CHARS = Object.freeze([]);
9
- /**
10
- * Represents the "day of the month" field within a cron expression.
11
- * @class CronDayOfMonth
12
- * @extends CronField
13
- */
14
- class CronMonth extends CronField_1.CronField {
15
- static get min() {
16
- return MIN_MONTH;
17
- }
18
- static get max() {
19
- return MAX_MONTH;
20
- }
21
- static get chars() {
22
- return MONTH_CHARS;
23
- }
24
- static get daysInMonth() {
25
- return CronDate_1.DAYS_IN_MONTH;
26
- }
27
- /**
28
- * CronDayOfMonth constructor. Initializes the "day of the month" field with the provided values.
29
- * @param {MonthRange[]} values - Values for the "day of the month" field
30
- * @param {CronFieldOptions} [options] - Options provided by the parser
31
- */
32
- constructor(values, options) {
33
- super(values, options);
34
- this.validate();
35
- }
36
- /**
37
- * Returns an array of allowed values for the "day of the month" field.
38
- * @returns {MonthRange[]}
39
- */
40
- get values() {
41
- return super.values;
42
- }
43
- }
44
- exports.CronMonth = CronMonth;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CronSecond = void 0;
4
- const CronField_1 = require("./CronField");
5
- const MIN_SECOND = 0;
6
- const MAX_SECOND = 59;
7
- const SECOND_CHARS = Object.freeze([]);
8
- /**
9
- * Represents the "second" field within a cron expression.
10
- * @class CronSecond
11
- * @extends CronField
12
- */
13
- class CronSecond extends CronField_1.CronField {
14
- static get min() {
15
- return MIN_SECOND;
16
- }
17
- static get max() {
18
- return MAX_SECOND;
19
- }
20
- static get chars() {
21
- return SECOND_CHARS;
22
- }
23
- /**
24
- * CronSecond constructor. Initializes the "second" field with the provided values.
25
- * @param {SixtyRange[]} values - Values for the "second" field
26
- * @param {CronFieldOptions} [options] - Options provided by the parser
27
- */
28
- constructor(values, options) {
29
- super(values, options);
30
- this.validate();
31
- }
32
- /**
33
- * Returns an array of allowed values for the "second" field.
34
- * @returns {SixtyRange[]}
35
- */
36
- get values() {
37
- return super.values;
38
- }
39
- }
40
- exports.CronSecond = CronSecond;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
18
- __exportStar(require("./CronDayOfMonth"), exports);
19
- __exportStar(require("./CronDayOfWeek"), exports);
20
- __exportStar(require("./CronField"), exports);
21
- __exportStar(require("./CronHour"), exports);
22
- __exportStar(require("./CronMinute"), exports);
23
- __exportStar(require("./CronMonth"), exports);
24
- __exportStar(require("./CronSecond"), exports);
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });