stacks 0.58.50 → 0.58.52
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/core/actions/dist/src/deploy/index.js +2 -2
- package/core/actions/dist/src/upgrade.js +1 -1
- package/core/actions/package.json +1 -1
- package/core/actions/src/build/cli.ts +1 -1
- package/core/actions/src/build/server.ts +9 -0
- package/core/actions/src/deploy/index.ts +2 -2
- package/core/actions/tsconfig.json +3 -0
- package/core/ai/package.json +1 -1
- package/core/ai/tsconfig.json +3 -0
- package/core/alias/package.json +1 -1
- package/core/alias/tsconfig.json +3 -0
- package/core/analytics/package.json +1 -1
- package/core/analytics/tsconfig.json +3 -0
- package/core/api/package.json +1 -1
- package/core/api/tsconfig.json +3 -0
- package/core/arrays/package.json +1 -1
- package/core/arrays/tsconfig.json +3 -0
- package/core/auth/package.json +1 -1
- package/core/auth/tsconfig.json +3 -0
- package/core/buddy/dist/{chunk-91084836e95161e8.js → chunk-d52e40a990b45728.js} +152 -84
- package/core/buddy/dist/cli.js +4 -1
- package/core/buddy/dist/index.js +3 -1
- package/core/buddy/package.json +1 -1
- package/core/buddy/src/cli.ts +2 -0
- package/core/buddy/src/commands/build.ts +17 -1
- package/core/buddy/src/commands/deploy.ts +2 -2
- package/core/buddy/src/commands/index.ts +1 -0
- package/core/buddy/src/commands/list.ts +39 -0
- package/core/buddy/src/commands/setup.ts +57 -1
- package/core/buddy/tsconfig.json +3 -0
- package/core/build/package.json +1 -1
- package/core/build/tsconfig.json +3 -0
- package/core/bun-create/bud/package.json +1 -1
- package/core/bun-create/buddy/package.json +1 -1
- package/core/bun-create/stack/package.json +1 -1
- package/core/bun-create/stacks/package.json +1 -1
- package/core/bun-create/stx/package.json +2 -1
- package/core/bun-plugin-yaml/package.json +1 -1
- package/core/bun-plugin-yaml/tsconfig.json +3 -0
- package/core/cache/package.json +1 -1
- package/core/cache/tsconfig.json +3 -0
- package/core/chat/package.json +8 -8
- package/core/chat/tsconfig.json +3 -0
- package/core/cli/dist/index.js +1 -1
- package/core/cli/package.json +1 -1
- package/core/cli/tsconfig.json +3 -0
- package/core/cloud/build.ts +1 -1
- package/core/cloud/deploy.ts +10 -1
- package/core/cloud/dist/index.js +167 -807
- package/core/cloud/package.json +2 -3
- package/core/cloud/src/cloud/aws-sdk-layer/nodejs/package.json +1 -1
- package/core/cloud/src/cloud/cdn.ts +59 -6
- package/core/cloud/src/cloud/compute.ts +29 -19
- package/core/cloud/src/cloud/dns.ts +8 -0
- package/core/cloud/src/cloud/index.ts +8 -2
- package/core/cloud/src/cloud/queue.ts +46 -0
- package/core/cloud/src/cloud/router-layer/nodejs/package.json +2 -2
- package/core/cloud/src/cloud/security.ts +1 -1
- package/core/cloud/src/helpers.ts +13 -1
- package/core/cloud/tsconfig.json +3 -0
- package/core/collections/package.json +1 -1
- package/core/collections/tsconfig.json +3 -0
- package/core/config/dist/index.js +154 -83
- package/core/config/package.json +2 -2
- package/core/config/tsconfig.json +3 -0
- package/core/database/package.json +1 -1
- package/core/database/src/kysely-bun-worker/mitt.ts +1 -1
- package/core/database/tsconfig.json +3 -0
- package/core/datetime/package.json +1 -1
- package/core/datetime/tsconfig.json +3 -0
- package/core/desktop/package.json +1 -1
- package/core/desktop/tsconfig.json +3 -0
- package/core/development/package.json +1 -1
- package/core/development/tsconfig.json +3 -0
- package/core/dns/package.json +1 -1
- package/core/dns/tsconfig.json +3 -0
- package/core/docs/package.json +1 -1
- package/core/docs/tsconfig.json +3 -0
- package/core/email/package.json +12 -12
- package/core/email/tsconfig.json +3 -0
- package/core/enums/dist/index.js +1 -0
- package/core/enums/package.json +1 -1
- package/core/enums/src/index.ts +1 -0
- package/core/enums/tsconfig.json +3 -0
- package/core/env/package.json +1 -1
- package/core/env/tsconfig.json +3 -0
- package/core/error-handling/package.json +1 -1
- package/core/error-handling/tsconfig.json +3 -0
- package/core/eslint-config/package.json +3 -3
- package/core/eslint-config/src/configs/typescript.ts +1 -0
- package/core/eslint-config/src/factory.ts +1 -0
- package/core/events/package.json +1 -1
- package/core/events/src/index.ts +3 -6
- package/core/events/tsconfig.json +3 -0
- package/core/faker/package.json +1 -1
- package/core/faker/tsconfig.json +3 -0
- package/core/git/package.json +1 -1
- package/core/git/tsconfig.json +3 -0
- package/core/health/package.json +1 -1
- package/core/health/tsconfig.json +3 -0
- package/core/http/package.json +1 -1
- package/core/http/tsconfig.json +3 -0
- package/core/lint/package.json +1 -1
- package/core/lint/tsconfig.json +3 -0
- package/core/logging/package.json +1 -1
- package/core/logging/tsconfig.json +3 -0
- package/core/notifications/package.json +22 -22
- package/core/notifications/tsconfig.json +3 -0
- package/core/objects/package.json +1 -1
- package/core/objects/tsconfig.json +3 -0
- package/core/orm/package.json +1 -1
- package/core/orm/tsconfig.json +3 -0
- package/core/path/package.json +1 -1
- package/core/path/tsconfig.json +3 -0
- package/core/payments/dist/index.js +21 -3
- package/core/payments/package.json +1 -1
- package/core/payments/tsconfig.json +3 -0
- package/core/push/package.json +5 -5
- package/core/push/tsconfig.json +3 -0
- package/core/query-builder/package.json +1 -1
- package/core/query-builder/tsconfig.json +3 -0
- package/core/queue/package.json +1 -1
- package/core/queue/tsconfig.json +3 -0
- package/core/raycast/package.json +1 -1
- package/core/realtime/package.json +1 -1
- package/core/realtime/tsconfig.json +3 -0
- package/core/repl/package.json +1 -1
- package/core/repl/tsconfig.json +3 -0
- package/core/router/dist/index.js +3 -4
- package/core/router/package.json +1 -1
- package/core/router/src/router.ts +11 -11
- package/core/router/src/server.ts +4 -4
- package/core/router/tsconfig.json +3 -0
- package/core/scheduler/build.ts +1 -1
- package/core/scheduler/dist/index.js +682 -152
- package/core/scheduler/package.json +7 -4
- package/core/scheduler/src/constants.ts +81 -0
- package/core/scheduler/src/errors.ts +7 -0
- package/core/scheduler/src/index.ts +15 -317
- package/core/scheduler/src/job.ts +315 -0
- package/core/scheduler/src/schedule.ts +111 -0
- package/core/scheduler/src/time.ts +823 -0
- package/core/scheduler/src/types/cron.ts +98 -0
- package/core/scheduler/src/types/utils.ts +14 -0
- package/core/scheduler/src/utils.ts +19 -0
- package/core/scheduler/tests/cron.fuzz.ts +120 -0
- package/core/scheduler/tests/cron.test.ts +1241 -0
- package/core/scheduler/tests/crontime.test.ts +778 -0
- package/core/scheduler/tsconfig.json +3 -0
- package/core/search-engine/package.json +1 -1
- package/core/search-engine/tsconfig.json +3 -0
- package/core/security/package.json +1 -1
- package/core/security/tsconfig.json +3 -0
- package/core/server/package.json +1 -1
- package/core/server/tsconfig.json +3 -0
- package/core/signals/package.json +1 -1
- package/core/signals/tsconfig.json +3 -0
- package/core/slug/package.json +1 -1
- package/core/slug/tsconfig.json +3 -0
- package/core/sms/package.json +11 -11
- package/core/sms/tsconfig.json +3 -0
- package/core/storage/package.json +1 -1
- package/core/storage/tsconfig.json +3 -0
- package/core/strings/package.json +1 -1
- package/core/strings/tsconfig.json +3 -0
- package/core/tables/package.json +1 -1
- package/core/tables/tsconfig.json +3 -0
- package/core/testing/package.json +1 -1
- package/core/testing/tsconfig.json +3 -0
- package/core/tinker/package.json +1 -1
- package/core/tinker/tsconfig.json +3 -0
- package/core/tunnel/package.json +1 -1
- package/core/tunnel/tsconfig.json +3 -0
- package/core/types/package.json +3 -3
- package/core/types/src/app.ts +2 -2
- package/core/types/src/cli.ts +1 -1
- package/core/types/src/cloud.ts +5 -1
- package/core/types/src/cron-jobs.ts +1 -0
- package/core/types/src/queue.ts +3 -1
- package/core/types/tsconfig.json +3 -0
- package/core/ui/package.json +4 -4
- package/core/ui/tsconfig.json +3 -0
- package/core/utils/dist/index.js +1 -1
- package/core/utils/package.json +1 -1
- package/core/utils/src/promise.ts +2 -2
- package/core/utils/tsconfig.json +3 -0
- package/core/validation/package.json +1 -1
- package/core/validation/src/rules.ts +3 -3
- package/core/validation/tsconfig.json +3 -0
- package/core/vite/dist/index.js +1 -1
- package/core/vite/package.json +1 -1
- package/core/vite/tsconfig.json +3 -0
- package/core/whois/package.json +1 -1
- package/core/whois/tsconfig.json +3 -0
- package/core/x-ray/package.json +1 -1
- package/core/x-ray/tsconfig.json +3 -0
- package/core/zsh-buddy/README.md +6 -2
- package/core/zsh-buddy/buddy.plugin.zsh +109 -0
- package/core/zsh-buddy/package.json +1 -1
- package/ide/dictionary.txt +2 -0
- package/ide/vscode/package.json +1 -1
- package/package.json +1 -1
- package/buddy +0 -2
- package/core/actions/src/zip/api.ts +0 -22
- package/core/bud +0 -2
- package/core/cloud/buddy +0 -2
- package/core/cloud/src/cloud/package/README.md +0 -59
- package/core/cloud/src/cloud/package/package.json +0 -63
- package/core/scheduler/tests/example.test.ts +0 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/scheduler",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.58.
|
|
4
|
+
"version": "0.58.52",
|
|
5
5
|
"description": "The Stacks scheduler.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"license": "MIT",
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"scheduler",
|
|
20
|
+
"node-cron",
|
|
21
|
+
"jobs",
|
|
22
|
+
"bun",
|
|
20
23
|
"stacks"
|
|
21
24
|
],
|
|
22
25
|
"exports": {
|
|
@@ -45,13 +48,13 @@
|
|
|
45
48
|
"prepublishOnly": "bun --bun run build"
|
|
46
49
|
},
|
|
47
50
|
"peerDependencies": {
|
|
48
|
-
"
|
|
51
|
+
"luxon": "^3.4.4"
|
|
49
52
|
},
|
|
50
53
|
"dependencies": {
|
|
51
|
-
"
|
|
54
|
+
"luxon": "^3.4.4"
|
|
52
55
|
},
|
|
53
56
|
"devDependencies": {
|
|
54
57
|
"@stacksjs/development": "workspace:*",
|
|
55
|
-
"
|
|
58
|
+
"sinon": "^17.0.1"
|
|
56
59
|
}
|
|
57
60
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export const CONSTRAINTS = Object.freeze({
|
|
2
|
+
second: [0, 59],
|
|
3
|
+
minute: [0, 59],
|
|
4
|
+
hour: [0, 23],
|
|
5
|
+
dayOfMonth: [1, 31],
|
|
6
|
+
month: [1, 12],
|
|
7
|
+
dayOfWeek: [0, 7],
|
|
8
|
+
} as const)
|
|
9
|
+
export const MONTH_CONSTRAINTS = Object.freeze({
|
|
10
|
+
1: 31,
|
|
11
|
+
2: 29, // support leap year...not perfect
|
|
12
|
+
3: 31,
|
|
13
|
+
4: 30,
|
|
14
|
+
5: 31,
|
|
15
|
+
6: 30,
|
|
16
|
+
7: 31,
|
|
17
|
+
8: 31,
|
|
18
|
+
9: 30,
|
|
19
|
+
10: 31,
|
|
20
|
+
11: 30,
|
|
21
|
+
12: 31,
|
|
22
|
+
} as const)
|
|
23
|
+
export const PARSE_DEFAULTS = Object.freeze({
|
|
24
|
+
second: '0',
|
|
25
|
+
minute: '*',
|
|
26
|
+
hour: '*',
|
|
27
|
+
dayOfMonth: '*',
|
|
28
|
+
month: '*',
|
|
29
|
+
dayOfWeek: '*',
|
|
30
|
+
} as const)
|
|
31
|
+
export const ALIASES = Object.freeze({
|
|
32
|
+
jan: 1,
|
|
33
|
+
feb: 2,
|
|
34
|
+
mar: 3,
|
|
35
|
+
apr: 4,
|
|
36
|
+
may: 5,
|
|
37
|
+
jun: 6,
|
|
38
|
+
jul: 7,
|
|
39
|
+
aug: 8,
|
|
40
|
+
sep: 9,
|
|
41
|
+
oct: 10,
|
|
42
|
+
nov: 11,
|
|
43
|
+
dec: 12,
|
|
44
|
+
sun: 0,
|
|
45
|
+
mon: 1,
|
|
46
|
+
tue: 2,
|
|
47
|
+
wed: 3,
|
|
48
|
+
thu: 4,
|
|
49
|
+
fri: 5,
|
|
50
|
+
sat: 6,
|
|
51
|
+
} as const)
|
|
52
|
+
export const TIME_UNITS_MAP = Object.freeze({
|
|
53
|
+
SECOND: 'second',
|
|
54
|
+
MINUTE: 'minute',
|
|
55
|
+
HOUR: 'hour',
|
|
56
|
+
DAY_OF_MONTH: 'dayOfMonth',
|
|
57
|
+
MONTH: 'month',
|
|
58
|
+
DAY_OF_WEEK: 'dayOfWeek',
|
|
59
|
+
} as const)
|
|
60
|
+
export const TIME_UNITS = Object.freeze(Object.values(TIME_UNITS_MAP)) as [
|
|
61
|
+
'second',
|
|
62
|
+
'minute',
|
|
63
|
+
'hour',
|
|
64
|
+
'dayOfMonth',
|
|
65
|
+
'month',
|
|
66
|
+
'dayOfWeek',
|
|
67
|
+
]
|
|
68
|
+
export const TIME_UNITS_LEN: number = TIME_UNITS.length
|
|
69
|
+
export const PRESETS = Object.freeze({
|
|
70
|
+
'@yearly': '0 0 0 1 1 *',
|
|
71
|
+
'@monthly': '0 0 0 1 * *',
|
|
72
|
+
'@weekly': '0 0 0 * * 0',
|
|
73
|
+
'@daily': '0 0 0 * * *',
|
|
74
|
+
'@hourly': '0 0 * * * *',
|
|
75
|
+
'@minutely': '0 * * * * *',
|
|
76
|
+
'@secondly': '* * * * * *',
|
|
77
|
+
'@weekdays': '0 0 0 * * 1-5',
|
|
78
|
+
'@weekends': '0 0 0 * * 0,6',
|
|
79
|
+
} as const)
|
|
80
|
+
export const RE_WILDCARDS = /\*/g
|
|
81
|
+
export const RE_RANGE = /^(\d+)(?:-(\d+))?(?:\/(\d+))?$/g
|
|
@@ -1,321 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Schedule } from './schedule'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// }
|
|
3
|
+
export { CronJob } from './job'
|
|
4
|
+
export { CronTime } from './time'
|
|
6
5
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
everyThirtyMinutes(): this
|
|
18
|
-
hourly(): this
|
|
19
|
-
daily(): this
|
|
20
|
-
twiceDaily(hour1: number, hour2: number): this
|
|
21
|
-
weekly(): this
|
|
22
|
-
monthly(): this
|
|
23
|
-
quarterly(): this
|
|
24
|
-
yearly(): this
|
|
25
|
-
weekdays(): this
|
|
26
|
-
weekends(): this
|
|
27
|
-
mondays(): this
|
|
28
|
-
tuesdays(): this
|
|
29
|
-
wednesdays(): this
|
|
30
|
-
thursdays(): this
|
|
31
|
-
fridays(): this
|
|
32
|
-
saturdays(): this
|
|
33
|
-
sundays(): this
|
|
34
|
-
between(startTime: string, endTime: string): this
|
|
35
|
-
timezone(timezone: string): this
|
|
36
|
-
when(callback: () => boolean): this
|
|
37
|
-
at(time: string): this
|
|
38
|
-
}
|
|
6
|
+
export type {
|
|
7
|
+
CronCallback,
|
|
8
|
+
CronCommand,
|
|
9
|
+
CronContext,
|
|
10
|
+
CronJobParams,
|
|
11
|
+
CronOnCompleteCallback,
|
|
12
|
+
CronOnCompleteCommand,
|
|
13
|
+
Ranges,
|
|
14
|
+
TimeUnit,
|
|
15
|
+
} from './types/cron'
|
|
39
16
|
|
|
40
|
-
export
|
|
41
|
-
private actionName: string = ''
|
|
42
|
-
private commandName: string = ''
|
|
43
|
-
private jobName: string = ''
|
|
44
|
-
private execName: string = ''
|
|
45
|
-
private callback: () => void = () => {}
|
|
46
|
-
private whenCallback: () => boolean = () => true
|
|
47
|
-
private startTime: string = ''
|
|
48
|
-
private endTime: string = ''
|
|
49
|
-
private timezoneName: string = ''
|
|
50
|
-
private time: string = ''
|
|
17
|
+
export * from './schedule'
|
|
51
18
|
|
|
52
|
-
|
|
53
|
-
this.actionName = action
|
|
54
|
-
return this
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
command(cmd: string): this {
|
|
58
|
-
this.commandName = cmd
|
|
59
|
-
return this
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
job(job: string): this {
|
|
63
|
-
this.jobName = job
|
|
64
|
-
return this
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
exec(cmd: string): this {
|
|
68
|
-
this.execName = cmd
|
|
69
|
-
return this
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
call(callback: () => void): this {
|
|
73
|
-
this.callback = callback
|
|
74
|
-
return this
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
everyMinute(): this {
|
|
78
|
-
// implementation here
|
|
79
|
-
return this
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
everySecond(): this {
|
|
83
|
-
// implementation here
|
|
84
|
-
return this
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
everyFiveMinutes(): this {
|
|
88
|
-
// implementation here
|
|
89
|
-
return this
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
everyTenMinutes(): this {
|
|
93
|
-
// implementation here
|
|
94
|
-
return this
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
everyThirtyMinutes(): this {
|
|
98
|
-
// implementation here
|
|
99
|
-
return this
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
hourly(): this {
|
|
103
|
-
// implementation here
|
|
104
|
-
return this
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
daily(): this {
|
|
108
|
-
// implementation here
|
|
109
|
-
return this
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
twiceDaily(_hour1: number, _hour2: number): this {
|
|
113
|
-
// implementation here
|
|
114
|
-
return this
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
weekly(): this {
|
|
118
|
-
// implementation here
|
|
119
|
-
return this
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
monthly(): this {
|
|
123
|
-
// implementation here
|
|
124
|
-
return this
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
quarterly(): this {
|
|
128
|
-
// implementation here
|
|
129
|
-
return this
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
yearly(): this {
|
|
133
|
-
// implementation here
|
|
134
|
-
return this
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
weekdays(): this {
|
|
138
|
-
// implementation here
|
|
139
|
-
return this
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
weekends(): this {
|
|
143
|
-
// implementation here
|
|
144
|
-
return this
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
mondays(): this {
|
|
148
|
-
// implementation here
|
|
149
|
-
return this
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
tuesdays(): this {
|
|
153
|
-
// implementation here
|
|
154
|
-
return this
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
wednesdays(): this {
|
|
158
|
-
// implementation here
|
|
159
|
-
return this
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
thursdays(): this {
|
|
163
|
-
// implementation here
|
|
164
|
-
return this
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
fridays(): this {
|
|
168
|
-
// implementation here
|
|
169
|
-
return this
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
saturdays(): this {
|
|
173
|
-
// implementation here
|
|
174
|
-
return this
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
sundays(): this {
|
|
178
|
-
// implementation here
|
|
179
|
-
return this
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
between(startTime: string, endTime: string): this {
|
|
183
|
-
this.startTime = startTime
|
|
184
|
-
this.endTime = endTime
|
|
185
|
-
return this
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
timezone(timezone: string): this {
|
|
189
|
-
this.timezoneName = timezone
|
|
190
|
-
return this
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
when(callback: () => boolean): this {
|
|
194
|
-
this.whenCallback = callback
|
|
195
|
-
return this
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
at(time: string): this {
|
|
199
|
-
this.time = time
|
|
200
|
-
return this
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
export interface Scheduler {
|
|
205
|
-
everySecond: () => void
|
|
206
|
-
everySeconds: (seconds: number) => void
|
|
207
|
-
everyMinute: () => void
|
|
208
|
-
everyMinutes: (minutes: number) => void
|
|
209
|
-
everyTwoMinutes: () => void
|
|
210
|
-
everyThreeMinutes: () => void
|
|
211
|
-
everyFourMinutes: () => void
|
|
212
|
-
everyFiveMinutes: () => void
|
|
213
|
-
everyTenMinutes: () => void
|
|
214
|
-
everyFifteenMinutes: () => void
|
|
215
|
-
everyThirtyMinutes: () => void
|
|
216
|
-
hourly: () => void
|
|
217
|
-
hourlyAt: (minute: number) => void
|
|
218
|
-
everyOddHour: () => void
|
|
219
|
-
everyHours: (hours: number) => void
|
|
220
|
-
everyTwoHours: () => void
|
|
221
|
-
everyThreeHours: () => void
|
|
222
|
-
everyFourHours: () => void
|
|
223
|
-
everySixHours: () => void
|
|
224
|
-
daily: () => void
|
|
225
|
-
dailyAt: (hour: number, minute: number) => void
|
|
226
|
-
everyDays: (days: number) => void
|
|
227
|
-
weekly: () => void
|
|
228
|
-
quarterly: () => void
|
|
229
|
-
yearly: () => void
|
|
230
|
-
cron: (interval: string, timezone?: string) => void
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// function run(callback: Function): Scheduler {
|
|
234
|
-
export function run(callback: ((now: Date | 'manual' | 'init') => void) | string): Scheduler {
|
|
235
|
-
return {
|
|
236
|
-
everySecond: () => {
|
|
237
|
-
cron.schedule('* * * * * *', callback)
|
|
238
|
-
},
|
|
239
|
-
everySeconds: (seconds = 1) => {
|
|
240
|
-
cron.schedule(`*/${seconds} * * * * *`, callback)
|
|
241
|
-
},
|
|
242
|
-
everyMinute: () => {
|
|
243
|
-
cron.schedule('* * * * *', callback)
|
|
244
|
-
},
|
|
245
|
-
everyTwoMinutes: () => {
|
|
246
|
-
cron.schedule('*/2 * * * *', callback)
|
|
247
|
-
},
|
|
248
|
-
everyThreeMinutes: () => {
|
|
249
|
-
cron.schedule('*/3 * * * *', callback)
|
|
250
|
-
},
|
|
251
|
-
everyFourMinutes: () => {
|
|
252
|
-
cron.schedule('*/4 * * * *', callback)
|
|
253
|
-
},
|
|
254
|
-
everyFiveMinutes: () => {
|
|
255
|
-
cron.schedule('*/5 * * * *', callback)
|
|
256
|
-
},
|
|
257
|
-
everyTenMinutes: () => {
|
|
258
|
-
cron.schedule('*/10 * * * *', callback)
|
|
259
|
-
},
|
|
260
|
-
everyFifteenMinutes: () => {
|
|
261
|
-
cron.schedule('*/15 * * * *', callback)
|
|
262
|
-
},
|
|
263
|
-
everyThirtyMinutes: () => {
|
|
264
|
-
cron.schedule('*/30 * * * *', callback)
|
|
265
|
-
},
|
|
266
|
-
everyMinutes: (minutes: number) => {
|
|
267
|
-
cron.schedule(`*/${minutes} * * * *`, callback)
|
|
268
|
-
},
|
|
269
|
-
hourly: () => {
|
|
270
|
-
cron.schedule('0 * * * *', callback)
|
|
271
|
-
},
|
|
272
|
-
everyHours: (hours: number) => {
|
|
273
|
-
cron.schedule(`0 */${hours} * * *`, callback)
|
|
274
|
-
},
|
|
275
|
-
hourlyAt: (minute: number) => {
|
|
276
|
-
cron.schedule(`${minute} * * * *`, callback)
|
|
277
|
-
},
|
|
278
|
-
everyOddHour: () => {
|
|
279
|
-
cron.schedule('0 */2 * * *', callback)
|
|
280
|
-
},
|
|
281
|
-
everyTwoHours: () => {
|
|
282
|
-
cron.schedule('0 */2 * * *', callback)
|
|
283
|
-
},
|
|
284
|
-
everyThreeHours: () => {
|
|
285
|
-
cron.schedule('0 */3 * * *', callback)
|
|
286
|
-
},
|
|
287
|
-
everyFourHours: () => {
|
|
288
|
-
cron.schedule('0 */4 * * *', callback)
|
|
289
|
-
},
|
|
290
|
-
everySixHours: () => {
|
|
291
|
-
cron.schedule('0 */6 * * *', callback)
|
|
292
|
-
},
|
|
293
|
-
dailyAt: (hour: number, minute: number) => {
|
|
294
|
-
cron.schedule(`${minute} ${hour} * * *`, callback)
|
|
295
|
-
},
|
|
296
|
-
daily: () => {
|
|
297
|
-
cron.schedule('0 0 * * *', callback)
|
|
298
|
-
},
|
|
299
|
-
everyDays: (days: number) => {
|
|
300
|
-
cron.schedule(`0 0 */${days} * *`, callback)
|
|
301
|
-
},
|
|
302
|
-
weekly: () => {
|
|
303
|
-
cron.schedule('0 0 * * 0', callback)
|
|
304
|
-
},
|
|
305
|
-
quarterly: () => {
|
|
306
|
-
cron.schedule('0 0 1 */3 *', callback)
|
|
307
|
-
},
|
|
308
|
-
yearly: () => {
|
|
309
|
-
cron.schedule('0 0 1 1 *', callback)
|
|
310
|
-
},
|
|
311
|
-
cron: (interval: string, timezone?: string) => {
|
|
312
|
-
timezone ? cron.schedule(interval, callback, { scheduled: true, timezone }) : cron.schedule(interval, callback)
|
|
313
|
-
},
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
export function useScheduler() {
|
|
318
|
-
return {
|
|
319
|
-
run,
|
|
320
|
-
}
|
|
321
|
-
}
|
|
19
|
+
export default Schedule
|