@cinnabun/scheduler 0.0.1 → 0.0.7

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/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # @cinnabun/scheduler
2
+
3
+ Scheduled tasks for Cinnabun. Cron-style jobs with decorators.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun add @cinnabun/scheduler
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { CinnabunApp, CinnabunFactory } from "@cinnabun/core";
15
+ import { SchedulerModule, SchedulerPlugin } from "@cinnabun/scheduler";
16
+
17
+ @CinnabunApp({
18
+ port: 3000,
19
+ scanPaths: [],
20
+ imports: [SchedulerModule.forRoot()],
21
+ plugins: [new SchedulerPlugin()],
22
+ })
23
+ class App {}
24
+
25
+ CinnabunFactory.run(App);
26
+ ```
27
+
28
+ ## Scheduled tasks
29
+
30
+ ```typescript
31
+ import { Scheduled } from "@cinnabun/scheduler";
32
+
33
+ @Service()
34
+ class CleanupService {
35
+ @Scheduled("0 0 * * *") // Every day at midnight
36
+ async cleanupExpiredSessions() {
37
+ // ...
38
+ }
39
+
40
+ @Scheduled("*/5 * * * *") // Every 5 minutes
41
+ async syncData() {
42
+ // ...
43
+ }
44
+ }
45
+ ```
46
+
47
+ ## Cron format
48
+
49
+ Cron expressions use the standard 5-field format:
50
+
51
+ ```
52
+ * * * * *
53
+ │ │ │ │ │
54
+ │ │ │ │ └─ day of week (0-7)
55
+ │ │ │ └─── month (1-12)
56
+ │ │ └───── day of month (1-31)
57
+ │ └─────── hour (0-23)
58
+ └───────── minute (0-59)
59
+ ```
60
+
61
+ ## License
62
+
63
+ MIT
@@ -1,5 +1,6 @@
1
+ import { type Constructor } from "@cinnabun/core";
1
2
  import type { SchedulerModuleOptions } from "./interfaces/scheduler-options.js";
2
3
  export declare class SchedulerModule {
3
- static forRoot(options?: SchedulerModuleOptions): Function;
4
+ static forRoot(options?: SchedulerModuleOptions): Constructor;
4
5
  static getOptions(): SchedulerModuleOptions;
5
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cinnabun/scheduler",
3
- "version": "0.0.1",
3
+ "version": "0.0.7",
4
4
  "description": "Task scheduler for Cinnabun with cron and Spring-style fixedRate/fixedDelay",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",