@boostkit/schedule 0.0.1
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/LICENSE +21 -0
- package/README.md +40 -0
- package/dist/index.d.ts +60 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +177 -0
- package/dist/index.js.map +1 -0
- package/package.json +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 BoostKit
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @boostkit/schedule
|
|
2
|
+
|
|
3
|
+
Task scheduler primitives and provider factory with cron-based artisan commands.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @boostkit/schedule
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// bootstrap/providers.ts
|
|
15
|
+
import { scheduler } from '@boostkit/schedule'
|
|
16
|
+
|
|
17
|
+
export default [
|
|
18
|
+
scheduler(),
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
import { schedule } from '@boostkit/schedule'
|
|
22
|
+
schedule.call(async () => {
|
|
23
|
+
// task body
|
|
24
|
+
}).everyFiveMinutes().description('Example task')
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## API Reference
|
|
28
|
+
|
|
29
|
+
- `ScheduledTask`
|
|
30
|
+
- `schedule` (global scheduler singleton)
|
|
31
|
+
- `scheduler()`
|
|
32
|
+
|
|
33
|
+
## Configuration
|
|
34
|
+
|
|
35
|
+
This package has no runtime config object.
|
|
36
|
+
|
|
37
|
+
## Notes
|
|
38
|
+
|
|
39
|
+
- Registers artisan commands: `schedule:run`, `schedule:work`, `schedule:list`.
|
|
40
|
+
- Uses `croner` for cron expression scheduling.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ServiceProvider, type Application } from '@boostkit/core';
|
|
2
|
+
export declare class ScheduledTask {
|
|
3
|
+
private readonly callback;
|
|
4
|
+
private _cron;
|
|
5
|
+
private _description;
|
|
6
|
+
constructor(callback: () => void | Promise<void>);
|
|
7
|
+
/** Set a raw cron expression (5-field: min hour dom month dow) */
|
|
8
|
+
cron(expression: string): this;
|
|
9
|
+
everySecond(): this;
|
|
10
|
+
everyMinute(): this;
|
|
11
|
+
everyTwoMinutes(): this;
|
|
12
|
+
everyFiveMinutes(): this;
|
|
13
|
+
everyTenMinutes(): this;
|
|
14
|
+
everyFifteenMinutes(): this;
|
|
15
|
+
everyThirtyMinutes(): this;
|
|
16
|
+
hourly(): this;
|
|
17
|
+
hourlyAt(minute: number): this;
|
|
18
|
+
daily(): this;
|
|
19
|
+
dailyAt(time: string): this;
|
|
20
|
+
twiceDaily(h1?: number, h2?: number): this;
|
|
21
|
+
weekly(): this;
|
|
22
|
+
weeklyOn(day: number, time?: string): this;
|
|
23
|
+
monthly(): this;
|
|
24
|
+
monthlyOn(day?: number, time?: string): this;
|
|
25
|
+
yearly(): this;
|
|
26
|
+
description(desc: string): this;
|
|
27
|
+
getCron(): string;
|
|
28
|
+
getDescription(): string;
|
|
29
|
+
getCallback(): () => void | Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Returns true if this task is due within the current one-minute window.
|
|
32
|
+
* Used by `schedule:run` (the system-cron entry point).
|
|
33
|
+
*/
|
|
34
|
+
isDue(): boolean;
|
|
35
|
+
}
|
|
36
|
+
declare class Scheduler {
|
|
37
|
+
private readonly _tasks;
|
|
38
|
+
/** Register a callback on the schedule and return the task for chaining. */
|
|
39
|
+
call(callback: () => void | Promise<void>): ScheduledTask;
|
|
40
|
+
getTasks(): ScheduledTask[];
|
|
41
|
+
}
|
|
42
|
+
/** Global schedule singleton — define tasks in routes/console.ts */
|
|
43
|
+
export declare const schedule: Scheduler;
|
|
44
|
+
/**
|
|
45
|
+
* Returns a ScheduleServiceProvider that registers the `schedule:run` and
|
|
46
|
+
* `schedule:work` artisan commands.
|
|
47
|
+
*
|
|
48
|
+
* Define scheduled tasks in routes/console.ts:
|
|
49
|
+
* import { schedule } from '@boostkit/schedule'
|
|
50
|
+
* schedule.call(() => Cache.forget('users:all')).everyFiveMinutes()
|
|
51
|
+
*
|
|
52
|
+
* Run via system cron (production):
|
|
53
|
+
* * * * * * cd /app && node artisan schedule:run
|
|
54
|
+
*
|
|
55
|
+
* Run in-process (dev / simple deployments):
|
|
56
|
+
* pnpm artisan schedule:work
|
|
57
|
+
*/
|
|
58
|
+
export declare function scheduler(): new (app: Application) => ServiceProvider;
|
|
59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,IAAI,OAAO;CAWjB;AAID,cAAM,SAAS;IACb,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;IAE7C,4EAA4E;IAC5E,IAAI,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,aAAa;IAMzD,QAAQ,IAAI,aAAa,EAAE;CAC5B;AAED,oEAAoE;AACpE,eAAO,MAAM,QAAQ,WAAkB,CAAA;AAIvC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,IAAI,KAAK,GAAG,EAAE,WAAW,KAAK,eAAe,CAyFrE"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { ServiceProvider, artisan } from '@boostkit/core';
|
|
2
|
+
import { Cron } from 'croner';
|
|
3
|
+
// ─── Scheduled Task ────────────────────────────────────────
|
|
4
|
+
export class ScheduledTask {
|
|
5
|
+
callback;
|
|
6
|
+
_cron = '* * * * *';
|
|
7
|
+
_description = '';
|
|
8
|
+
constructor(callback) {
|
|
9
|
+
this.callback = callback;
|
|
10
|
+
}
|
|
11
|
+
// ── Cron ───────────────────────────────────────────────
|
|
12
|
+
/** Set a raw cron expression (5-field: min hour dom month dow) */
|
|
13
|
+
cron(expression) { this._cron = expression; return this; }
|
|
14
|
+
// ── Convenience helpers ────────────────────────────────
|
|
15
|
+
everySecond() { return this.cron('* * * * * *'); }
|
|
16
|
+
everyMinute() { return this.cron('* * * * *'); }
|
|
17
|
+
everyTwoMinutes() { return this.cron('*/2 * * * *'); }
|
|
18
|
+
everyFiveMinutes() { return this.cron('*/5 * * * *'); }
|
|
19
|
+
everyTenMinutes() { return this.cron('*/10 * * * *'); }
|
|
20
|
+
everyFifteenMinutes() { return this.cron('*/15 * * * *'); }
|
|
21
|
+
everyThirtyMinutes() { return this.cron('*/30 * * * *'); }
|
|
22
|
+
hourly() { return this.cron('0 * * * *'); }
|
|
23
|
+
hourlyAt(minute) { return this.cron(`${minute} * * * *`); }
|
|
24
|
+
daily() { return this.cron('0 0 * * *'); }
|
|
25
|
+
dailyAt(time) {
|
|
26
|
+
const [h = '0', m = '0'] = time.split(':');
|
|
27
|
+
return this.cron(`${m} ${h} * * *`);
|
|
28
|
+
}
|
|
29
|
+
twiceDaily(h1 = 1, h2 = 13) { return this.cron(`0 ${h1},${h2} * * *`); }
|
|
30
|
+
weekly() { return this.cron('0 0 * * 0'); }
|
|
31
|
+
weeklyOn(day, time = '0:0') {
|
|
32
|
+
const [h = '0', m = '0'] = time.split(':');
|
|
33
|
+
return this.cron(`${m} ${h} * * ${day}`);
|
|
34
|
+
}
|
|
35
|
+
monthly() { return this.cron('0 0 1 * *'); }
|
|
36
|
+
monthlyOn(day = 1, time = '0:0') {
|
|
37
|
+
const [h = '0', m = '0'] = time.split(':');
|
|
38
|
+
return this.cron(`${m} ${h} ${day} * *`);
|
|
39
|
+
}
|
|
40
|
+
yearly() { return this.cron('0 0 1 1 *'); }
|
|
41
|
+
description(desc) { this._description = desc; return this; }
|
|
42
|
+
// ── Internal ───────────────────────────────────────────
|
|
43
|
+
getCron() { return this._cron; }
|
|
44
|
+
getDescription() { return this._description; }
|
|
45
|
+
getCallback() { return this.callback; }
|
|
46
|
+
/**
|
|
47
|
+
* Returns true if this task is due within the current one-minute window.
|
|
48
|
+
* Used by `schedule:run` (the system-cron entry point).
|
|
49
|
+
*/
|
|
50
|
+
isDue() {
|
|
51
|
+
try {
|
|
52
|
+
const job = new Cron(this._cron, { paused: true });
|
|
53
|
+
// Starting from 60 s ago, find the next scheduled run.
|
|
54
|
+
// If it falls at or before now, the task is due this minute.
|
|
55
|
+
const next = job.nextRun(new Date(Date.now() - 60_000));
|
|
56
|
+
return next !== null && next.getTime() <= Date.now();
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// ─── Scheduler Singleton ───────────────────────────────────
|
|
64
|
+
class Scheduler {
|
|
65
|
+
_tasks = [];
|
|
66
|
+
/** Register a callback on the schedule and return the task for chaining. */
|
|
67
|
+
call(callback) {
|
|
68
|
+
const task = new ScheduledTask(callback);
|
|
69
|
+
this._tasks.push(task);
|
|
70
|
+
return task;
|
|
71
|
+
}
|
|
72
|
+
getTasks() { return [...this._tasks]; }
|
|
73
|
+
}
|
|
74
|
+
/** Global schedule singleton — define tasks in routes/console.ts */
|
|
75
|
+
export const schedule = new Scheduler();
|
|
76
|
+
// ─── Service Provider Factory ──────────────────────────────
|
|
77
|
+
/**
|
|
78
|
+
* Returns a ScheduleServiceProvider that registers the `schedule:run` and
|
|
79
|
+
* `schedule:work` artisan commands.
|
|
80
|
+
*
|
|
81
|
+
* Define scheduled tasks in routes/console.ts:
|
|
82
|
+
* import { schedule } from '@boostkit/schedule'
|
|
83
|
+
* schedule.call(() => Cache.forget('users:all')).everyFiveMinutes()
|
|
84
|
+
*
|
|
85
|
+
* Run via system cron (production):
|
|
86
|
+
* * * * * * cd /app && node artisan schedule:run
|
|
87
|
+
*
|
|
88
|
+
* Run in-process (dev / simple deployments):
|
|
89
|
+
* pnpm artisan schedule:work
|
|
90
|
+
*/
|
|
91
|
+
export function scheduler() {
|
|
92
|
+
class ScheduleServiceProvider extends ServiceProvider {
|
|
93
|
+
register() { }
|
|
94
|
+
boot() {
|
|
95
|
+
// ── schedule:run ─────────────────────────────────────
|
|
96
|
+
// Intended to be called every minute by a system cron job.
|
|
97
|
+
// Runs only the tasks that are due in the current minute, then exits.
|
|
98
|
+
artisan.command('schedule:run', async () => {
|
|
99
|
+
const tasks = schedule.getTasks();
|
|
100
|
+
if (tasks.length === 0) {
|
|
101
|
+
console.log('[Schedule] No tasks registered.');
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
let ran = 0;
|
|
105
|
+
for (const task of tasks) {
|
|
106
|
+
if (!task.isDue())
|
|
107
|
+
continue;
|
|
108
|
+
const label = task.getDescription() || task.getCron();
|
|
109
|
+
process.stdout.write(`[Schedule] Running "${label}" ... `);
|
|
110
|
+
try {
|
|
111
|
+
await task.getCallback()();
|
|
112
|
+
console.log('✔');
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
console.log('✗');
|
|
116
|
+
console.error(err);
|
|
117
|
+
}
|
|
118
|
+
ran++;
|
|
119
|
+
}
|
|
120
|
+
if (ran === 0)
|
|
121
|
+
console.log('[Schedule] No tasks due.');
|
|
122
|
+
else
|
|
123
|
+
console.log(`[Schedule] ${ran} task(s) completed.`);
|
|
124
|
+
}).description('Run all scheduled tasks that are due now');
|
|
125
|
+
// ── schedule:work ─────────────────────────────────────
|
|
126
|
+
// Starts an in-process worker that runs tasks on their cron schedule.
|
|
127
|
+
// Keeps the process alive — use Ctrl+C to stop.
|
|
128
|
+
artisan.command('schedule:work', async () => {
|
|
129
|
+
const tasks = schedule.getTasks();
|
|
130
|
+
console.log(`[Schedule] Worker started — ${tasks.length} task(s) registered.`);
|
|
131
|
+
console.log('[Schedule] Press Ctrl+C to stop.\n');
|
|
132
|
+
const jobs = [];
|
|
133
|
+
for (const task of tasks) {
|
|
134
|
+
const label = task.getDescription() || task.getCron();
|
|
135
|
+
jobs.push(new Cron(task.getCron(), async () => {
|
|
136
|
+
process.stdout.write(`[Schedule] Running "${label}" ... `);
|
|
137
|
+
try {
|
|
138
|
+
await task.getCallback()();
|
|
139
|
+
console.log('✔');
|
|
140
|
+
}
|
|
141
|
+
catch (err) {
|
|
142
|
+
console.log('✗');
|
|
143
|
+
console.error(err);
|
|
144
|
+
}
|
|
145
|
+
}));
|
|
146
|
+
}
|
|
147
|
+
// Keep the process alive until Ctrl+C
|
|
148
|
+
await new Promise((resolve) => {
|
|
149
|
+
process.once('SIGINT', () => {
|
|
150
|
+
for (const job of jobs)
|
|
151
|
+
job.stop();
|
|
152
|
+
console.log('\n[Schedule] Worker stopped.');
|
|
153
|
+
resolve();
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
process.exit(0);
|
|
157
|
+
}).description('Start the schedule worker (in-process cron, Ctrl+C to stop)');
|
|
158
|
+
// ── schedule:list ─────────────────────────────────────
|
|
159
|
+
artisan.command('schedule:list', () => {
|
|
160
|
+
const tasks = schedule.getTasks();
|
|
161
|
+
if (tasks.length === 0) {
|
|
162
|
+
console.log('[Schedule] No tasks registered.');
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
console.log('\n Scheduled Tasks\n ' + '─'.repeat(50));
|
|
166
|
+
for (const task of tasks) {
|
|
167
|
+
const desc = task.getDescription();
|
|
168
|
+
console.log(` ${task.getCron().padEnd(20)} ${desc || '(no description)'}`);
|
|
169
|
+
}
|
|
170
|
+
console.log();
|
|
171
|
+
}).description('List all registered scheduled tasks');
|
|
172
|
+
console.log(`[ScheduleServiceProvider] booted — ${schedule.getTasks().length} task(s) registered`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return ScheduleServiceProvider;
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAoB,MAAM,gBAAgB,CAAA;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,8DAA8D;AAE9D,MAAM,OAAO,aAAa;IAIK;IAHrB,KAAK,GAAU,WAAW,CAAA;IAC1B,YAAY,GAAG,EAAE,CAAA;IAEzB,YAA6B,QAAoC;QAApC,aAAQ,GAAR,QAAQ,CAA4B;IAAG,CAAC;IAErE,0DAA0D;IAC1D,kEAAkE;IAClE,IAAI,CAAC,UAAkB,IAAU,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,OAAO,IAAI,CAAA,CAAC,CAAC;IAEvE,0DAA0D;IAC1D,WAAW,KAAmB,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA,CAAC,CAAC;IAC/D,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;oBACzB,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,EAAE,CAAA;oBAClC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,IAAI,IAAI,kBAAkB,EAAE,CAAC,CAAA;gBAC7E,CAAC;gBACD,OAAO,CAAC,GAAG,EAAE,CAAA;YACf,CAAC,CAAC,CAAC,WAAW,CAAC,qCAAqC,CAAC,CAAA;YAErD,OAAO,CAAC,GAAG,CAAC,sCAAsC,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,qBAAqB,CAAC,CAAA;QACpG,CAAC;KACF;IAED,OAAO,uBAAuB,CAAA;AAChC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@boostkit/schedule",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/boostkitjs/boostkit",
|
|
8
|
+
"directory": "packages/schedule"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"croner": "^9.0.0",
|
|
24
|
+
"@boostkit/core": "0.0.1"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/node": "^20.0.0",
|
|
28
|
+
"typescript": "^5.4.0"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc",
|
|
32
|
+
"dev": "tsc --watch",
|
|
33
|
+
"typecheck": "tsc --noEmit",
|
|
34
|
+
"clean": "rm -rf dist"
|
|
35
|
+
}
|
|
36
|
+
}
|