@tachybase/module-cron 1.3.16 → 1.3.18

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 (48) hide show
  1. package/dist/client/cron-jobs-table/CronJobsTable.schema.d.ts +3 -2
  2. package/dist/client/index.js +3 -3
  3. package/dist/externalVersion.js +7 -7
  4. package/dist/index.js +4 -4
  5. package/dist/node_modules/cron-parser/LICENSE +1 -1
  6. package/dist/node_modules/cron-parser/dist/CronDate.js +497 -0
  7. package/dist/node_modules/cron-parser/dist/CronExpression.js +376 -0
  8. package/dist/node_modules/cron-parser/dist/CronExpressionParser.js +384 -0
  9. package/dist/node_modules/cron-parser/dist/CronFieldCollection.js +371 -0
  10. package/dist/node_modules/cron-parser/dist/CronFileParser.js +109 -0
  11. package/dist/node_modules/cron-parser/dist/fields/CronDayOfMonth.js +44 -0
  12. package/dist/node_modules/cron-parser/dist/fields/CronDayOfWeek.js +51 -0
  13. package/dist/node_modules/cron-parser/dist/fields/CronField.js +183 -0
  14. package/dist/node_modules/cron-parser/dist/fields/CronHour.js +40 -0
  15. package/dist/node_modules/cron-parser/dist/fields/CronMinute.js +40 -0
  16. package/dist/node_modules/cron-parser/dist/fields/CronMonth.js +44 -0
  17. package/dist/node_modules/cron-parser/dist/fields/CronSecond.js +40 -0
  18. package/dist/node_modules/cron-parser/dist/fields/index.js +24 -0
  19. package/dist/node_modules/cron-parser/dist/fields/types.js +2 -0
  20. package/dist/node_modules/cron-parser/dist/index.js +1 -0
  21. package/dist/node_modules/cron-parser/dist/types/CronDate.d.ts +273 -0
  22. package/dist/node_modules/cron-parser/dist/types/CronExpression.d.ts +110 -0
  23. package/dist/node_modules/cron-parser/dist/types/CronExpressionParser.d.ts +70 -0
  24. package/dist/node_modules/cron-parser/dist/types/CronFieldCollection.d.ts +153 -0
  25. package/dist/node_modules/cron-parser/dist/types/CronFileParser.d.ts +30 -0
  26. package/dist/node_modules/cron-parser/dist/types/fields/CronDayOfMonth.d.ts +25 -0
  27. package/dist/node_modules/cron-parser/dist/types/fields/CronDayOfWeek.d.ts +30 -0
  28. package/dist/node_modules/cron-parser/dist/types/fields/CronField.d.ts +114 -0
  29. package/dist/node_modules/cron-parser/dist/types/fields/CronHour.d.ts +23 -0
  30. package/dist/node_modules/cron-parser/dist/types/fields/CronMinute.d.ts +23 -0
  31. package/dist/node_modules/cron-parser/dist/types/fields/CronMonth.d.ts +24 -0
  32. package/dist/node_modules/cron-parser/dist/types/fields/CronSecond.d.ts +23 -0
  33. package/dist/node_modules/cron-parser/dist/types/fields/index.d.ts +8 -0
  34. package/dist/node_modules/cron-parser/dist/types/fields/types.d.ts +18 -0
  35. package/dist/node_modules/cron-parser/dist/types/index.d.ts +8 -0
  36. package/dist/node_modules/cron-parser/dist/types/utils/random.d.ts +10 -0
  37. package/dist/node_modules/cron-parser/dist/utils/random.js +38 -0
  38. package/dist/node_modules/cron-parser/package.json +1 -1
  39. package/dist/server/service/StaticScheduleTrigger.d.ts +1 -1
  40. package/package.json +10 -10
  41. package/dist/node_modules/cron-parser/lib/date.js +0 -252
  42. package/dist/node_modules/cron-parser/lib/expression.js +0 -1002
  43. package/dist/node_modules/cron-parser/lib/field_compactor.js +0 -70
  44. package/dist/node_modules/cron-parser/lib/field_stringify.js +0 -58
  45. package/dist/node_modules/cron-parser/lib/parser.js +0 -1
  46. package/dist/node_modules/cron-parser/types/common.d.ts +0 -131
  47. package/dist/node_modules/cron-parser/types/index.d.ts +0 -45
  48. package/dist/node_modules/cron-parser/types/ts3/index.d.ts +0 -28
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.seededRandom = seededRandom;
4
+ /**
5
+ * Computes a numeric hash from a given string
6
+ * @param {string} str A value to hash
7
+ * @returns {number} A numeric hash computed from the given value
8
+ */
9
+ function xfnv1a(str) {
10
+ let h = 2166136261 >>> 0;
11
+ for (let i = 0; i < str.length; i++) {
12
+ h ^= str.charCodeAt(i);
13
+ h = Math.imul(h, 16777619);
14
+ }
15
+ return () => h >>> 0;
16
+ }
17
+ /**
18
+ * Initialize a new PRNG using a given seed
19
+ * @param {number} seed The seed used to initialize the PRNG
20
+ * @returns {PRNG} A random number generator
21
+ */
22
+ function mulberry32(seed) {
23
+ return () => {
24
+ let t = (seed += 0x6d2b79f5);
25
+ t = Math.imul(t ^ (t >>> 15), t | 1);
26
+ t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
27
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
28
+ };
29
+ }
30
+ /**
31
+ * Generates a PRNG using a given seed. When not provided, the seed is randomly generated
32
+ * @param {string} str A string to derive the seed from
33
+ * @returns {PRNG} A random number generator correctly seeded
34
+ */
35
+ function seededRandom(str) {
36
+ const seed = str ? xfnv1a(str)() : Math.floor(Math.random() * 10_000_000_000);
37
+ return mulberry32(seed);
38
+ }
@@ -1 +1 @@
1
- {"name":"cron-parser","version":"4.9.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"types/index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^3.2.1"},"devDependencies":{"eslint":"^8.27.0","sinon":"^15.0.1","tap":"^16.3.3","tsd":"^0.26.0"},"engines":{"node":">=12.0.0"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"files":["lib","types","LICENSE","README.md"],"_lastModified":"2025-07-02T03:56:12.103Z"}
1
+ {"name":"cron-parser","version":"5.3.0","description":"Node.js library for parsing crontab instructions","main":"dist/index.js","types":"dist/types/index.d.ts","type":"commonjs","scripts":{"clean":"rimraf dist","bench":"cross-env node -r ts-node/register benchmarks/index.ts","bench:pattern":"cross-env node -r ts-node/register benchmarks/pattern.ts","bench:clean":"rimraf benchmarks/versions && rimraf benchmarks/results","build":"npm run clean && tsc -p tsconfig.json","prepublishOnly":"npm run build","prepare":"husky && npm run build","precommit":"lint-staged","lint":"eslint .","lint:fix":"eslint --fix .","lint:debug":"cross-env DEBUG=eslint:cli-engine eslint .","format":"prettier --write \"**/*.{ts,js,json,md}\"","format:check":"prettier --check \"**/*.{ts,js,json,md}\"","test:unit":"cross-env TZ=UTC jest","test:coverage":"cross-env TZ=UTC jest --coverage","generate-badges":"jest-coverage-badges","test:types":"npm run build && tsd","test":"cross-env TZ=UTC npm run lint && npm run test:types && npm run test:coverage && npm run generate-badges","docs":"rimraf docs && typedoc --out docs --readme none --name 'CronParser' src"},"files":["dist","LICENSE","README.md"],"dependencies":{"luxon":"^3.6.1"},"devDependencies":{"@tsd/typescript":"^5.8.2","@types/jest":"^29.5.14","@types/luxon":"^3.6.2","@types/node":"^22.14.0","@typescript-eslint/eslint-plugin":"^8.29.0","@typescript-eslint/parser":"^8.29.0","chalk":"^5.4.1","cli-table3":"^0.6.5","cross-env":"^7.0.3","eslint":"^9.23.0","eslint-config-prettier":"^10.1.1","eslint-plugin-prettier":"^5.2.6","husky":"^9.1.7","jest":"^29.7.0","jest-coverage-badges":"^1.0.0","lint-staged":"^15.5.0","prettier":"^3.5.3","rimraf":"^6.0.1","sinon":"^20.0.0","ts-jest":"^29.3.1","ts-node":"^10.9.2","tsd":"^0.31.2","typedoc":"^0.28.1","typescript":"^5.8.2"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{ts,js,json}":["prettier --write"]},"engines":{"node":">=18"},"browser":{"fs":false,"fs/promises":false},"tsd":{"directory":"tests"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>","Michael Hobbs <michael.lee.hobbs@gmail.com>"],"license":"MIT","_lastModified":"2025-07-17T07:52:37.042Z"}
@@ -7,7 +7,7 @@ export declare class StaticScheduleTrigger {
7
7
  private timers;
8
8
  load(): Promise<void>;
9
9
  inspect(cronJobs: CronJobModel[]): void;
10
- getNextTime(cronJob: CronJobModel, currentDate: Date, nextSecond?: boolean): number;
10
+ getNextTime(cronJob: CronJobModel, currentDate: Date, nextSecond?: boolean): any;
11
11
  schedule(cronJob: CronJobModel, nextTime: number, toggle?: boolean): void;
12
12
  trigger(cronJobId: number, time: number): Promise<void>;
13
13
  on(cronJob: CronJobModel): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tachybase/module-cron",
3
3
  "displayName": "Cron job",
4
- "version": "1.3.16",
4
+ "version": "1.3.18",
5
5
  "description": "Schedule tasks to run at specific times, using a workflow approach",
6
6
  "keywords": [
7
7
  "System management"
@@ -10,18 +10,18 @@
10
10
  "dependencies": {},
11
11
  "devDependencies": {
12
12
  "antd": "5.22.5",
13
- "cron-parser": "4.9.0",
13
+ "cron-parser": "5.3.0",
14
14
  "react-js-cron": "^3.2.0"
15
15
  },
16
16
  "peerDependencies": {
17
- "@tachybase/actions": "1.3.16",
18
- "@tachybase/database": "1.3.16",
19
- "@tachybase/client": "1.3.16",
20
- "@tachybase/schema": "1.3.16",
21
- "@tachybase/module-workflow": "1.3.16",
22
- "@tachybase/server": "1.3.16",
23
- "@tachybase/test": "1.3.16",
24
- "@tachybase/utils": "1.3.16"
17
+ "@tachybase/actions": "1.3.18",
18
+ "@tachybase/client": "1.3.18",
19
+ "@tachybase/database": "1.3.18",
20
+ "@tachybase/module-workflow": "1.3.18",
21
+ "@tachybase/schema": "1.3.18",
22
+ "@tachybase/server": "1.3.18",
23
+ "@tachybase/test": "1.3.18",
24
+ "@tachybase/utils": "1.3.18"
25
25
  },
26
26
  "description.zh-CN": "安排任务在特定时间运行,采用工作流的方式",
27
27
  "displayName.zh-CN": "定时任务",
@@ -1,252 +0,0 @@
1
- 'use strict';
2
-
3
- var luxon = require('luxon');
4
-
5
- CronDate.prototype.addYear = function() {
6
- this._date = this._date.plus({ years: 1 });
7
- };
8
-
9
- CronDate.prototype.addMonth = function() {
10
- this._date = this._date.plus({ months: 1 }).startOf('month');
11
- };
12
-
13
- CronDate.prototype.addDay = function() {
14
- this._date = this._date.plus({ days: 1 }).startOf('day');
15
- };
16
-
17
- CronDate.prototype.addHour = function() {
18
- var prev = this._date;
19
- this._date = this._date.plus({ hours: 1 }).startOf('hour');
20
- if (this._date <= prev) {
21
- this._date = this._date.plus({ hours: 1 });
22
- }
23
- };
24
-
25
- CronDate.prototype.addMinute = function() {
26
- var prev = this._date;
27
- this._date = this._date.plus({ minutes: 1 }).startOf('minute');
28
- if (this._date < prev) {
29
- this._date = this._date.plus({ hours: 1 });
30
- }
31
- };
32
-
33
- CronDate.prototype.addSecond = function() {
34
- var prev = this._date;
35
- this._date = this._date.plus({ seconds: 1 }).startOf('second');
36
- if (this._date < prev) {
37
- this._date = this._date.plus({ hours: 1 });
38
- }
39
- };
40
-
41
- CronDate.prototype.subtractYear = function() {
42
- this._date = this._date.minus({ years: 1 });
43
- };
44
-
45
- CronDate.prototype.subtractMonth = function() {
46
- this._date = this._date
47
- .minus({ months: 1 })
48
- .endOf('month')
49
- .startOf('second');
50
- };
51
-
52
- CronDate.prototype.subtractDay = function() {
53
- this._date = this._date
54
- .minus({ days: 1 })
55
- .endOf('day')
56
- .startOf('second');
57
- };
58
-
59
- CronDate.prototype.subtractHour = function() {
60
- var prev = this._date;
61
- this._date = this._date
62
- .minus({ hours: 1 })
63
- .endOf('hour')
64
- .startOf('second');
65
- if (this._date >= prev) {
66
- this._date = this._date.minus({ hours: 1 });
67
- }
68
- };
69
-
70
- CronDate.prototype.subtractMinute = function() {
71
- var prev = this._date;
72
- this._date = this._date.minus({ minutes: 1 })
73
- .endOf('minute')
74
- .startOf('second');
75
- if (this._date > prev) {
76
- this._date = this._date.minus({ hours: 1 });
77
- }
78
- };
79
-
80
- CronDate.prototype.subtractSecond = function() {
81
- var prev = this._date;
82
- this._date = this._date
83
- .minus({ seconds: 1 })
84
- .startOf('second');
85
- if (this._date > prev) {
86
- this._date = this._date.minus({ hours: 1 });
87
- }
88
- };
89
-
90
- CronDate.prototype.getDate = function() {
91
- return this._date.day;
92
- };
93
-
94
- CronDate.prototype.getFullYear = function() {
95
- return this._date.year;
96
- };
97
-
98
- CronDate.prototype.getDay = function() {
99
- var weekday = this._date.weekday;
100
- return weekday == 7 ? 0 : weekday;
101
- };
102
-
103
- CronDate.prototype.getMonth = function() {
104
- return this._date.month - 1;
105
- };
106
-
107
- CronDate.prototype.getHours = function() {
108
- return this._date.hour;
109
- };
110
-
111
- CronDate.prototype.getMinutes = function() {
112
- return this._date.minute;
113
- };
114
-
115
- CronDate.prototype.getSeconds = function() {
116
- return this._date.second;
117
- };
118
-
119
- CronDate.prototype.getMilliseconds = function() {
120
- return this._date.millisecond;
121
- };
122
-
123
- CronDate.prototype.getTime = function() {
124
- return this._date.valueOf();
125
- };
126
-
127
- CronDate.prototype.getUTCDate = function() {
128
- return this._getUTC().day;
129
- };
130
-
131
- CronDate.prototype.getUTCFullYear = function() {
132
- return this._getUTC().year;
133
- };
134
-
135
- CronDate.prototype.getUTCDay = function() {
136
- var weekday = this._getUTC().weekday;
137
- return weekday == 7 ? 0 : weekday;
138
- };
139
-
140
- CronDate.prototype.getUTCMonth = function() {
141
- return this._getUTC().month - 1;
142
- };
143
-
144
- CronDate.prototype.getUTCHours = function() {
145
- return this._getUTC().hour;
146
- };
147
-
148
- CronDate.prototype.getUTCMinutes = function() {
149
- return this._getUTC().minute;
150
- };
151
-
152
- CronDate.prototype.getUTCSeconds = function() {
153
- return this._getUTC().second;
154
- };
155
-
156
- CronDate.prototype.toISOString = function() {
157
- return this._date.toUTC().toISO();
158
- };
159
-
160
- CronDate.prototype.toJSON = function() {
161
- return this._date.toJSON();
162
- };
163
-
164
- CronDate.prototype.setDate = function(d) {
165
- this._date = this._date.set({ day: d });
166
- };
167
-
168
- CronDate.prototype.setFullYear = function(y) {
169
- this._date = this._date.set({ year: y });
170
- };
171
-
172
- CronDate.prototype.setDay = function(d) {
173
- this._date = this._date.set({ weekday: d });
174
- };
175
-
176
- CronDate.prototype.setMonth = function(m) {
177
- this._date = this._date.set({ month: m + 1 });
178
- };
179
-
180
- CronDate.prototype.setHours = function(h) {
181
- this._date = this._date.set({ hour: h });
182
- };
183
-
184
- CronDate.prototype.setMinutes = function(m) {
185
- this._date = this._date.set({ minute: m });
186
- };
187
-
188
- CronDate.prototype.setSeconds = function(s) {
189
- this._date = this._date.set({ second: s });
190
- };
191
-
192
- CronDate.prototype.setMilliseconds = function(s) {
193
- this._date = this._date.set({ millisecond: s });
194
- };
195
-
196
- CronDate.prototype._getUTC = function() {
197
- return this._date.toUTC();
198
- };
199
-
200
- CronDate.prototype.toString = function() {
201
- return this.toDate().toString();
202
- };
203
-
204
- CronDate.prototype.toDate = function() {
205
- return this._date.toJSDate();
206
- };
207
-
208
- CronDate.prototype.isLastDayOfMonth = function() {
209
- //next day
210
- var newDate = this._date.plus({ days: 1 }).startOf('day');
211
- return this._date.month !== newDate.month;
212
- };
213
-
214
- /**
215
- * Returns true when the current weekday is the last occurrence of this weekday
216
- * for the present month.
217
- */
218
- CronDate.prototype.isLastWeekdayOfMonth = function() {
219
- // Check this by adding 7 days to the current date and seeing if it's
220
- // a different month
221
- var newDate = this._date.plus({ days: 7 }).startOf('day');
222
- return this._date.month !== newDate.month;
223
- };
224
-
225
- function CronDate (timestamp, tz) {
226
- var dateOpts = { zone: tz };
227
- if (!timestamp) {
228
- this._date = luxon.DateTime.local();
229
- } else if (timestamp instanceof CronDate) {
230
- this._date = timestamp._date;
231
- } else if (timestamp instanceof Date) {
232
- this._date = luxon.DateTime.fromJSDate(timestamp, dateOpts);
233
- } else if (typeof timestamp === 'number') {
234
- this._date = luxon.DateTime.fromMillis(timestamp, dateOpts);
235
- } else if (typeof timestamp === 'string') {
236
- this._date = luxon.DateTime.fromISO(timestamp, dateOpts);
237
- this._date.isValid || (this._date = luxon.DateTime.fromRFC2822(timestamp, dateOpts));
238
- this._date.isValid || (this._date = luxon.DateTime.fromSQL(timestamp, dateOpts));
239
- // RFC2822-like format without the required timezone offset (used in tests)
240
- this._date.isValid || (this._date = luxon.DateTime.fromFormat(timestamp, 'EEE, d MMM yyyy HH:mm:ss', dateOpts));
241
- }
242
-
243
- if (!this._date || !this._date.isValid) {
244
- throw new Error('CronDate: unhandled timestamp: ' + JSON.stringify(timestamp));
245
- }
246
-
247
- if (tz && tz !== this._date.zoneName) {
248
- this._date = this._date.setZone(tz);
249
- }
250
- }
251
-
252
- module.exports = CronDate;