@lafken/schedule 0.12.24 → 0.12.26

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.
@@ -44,6 +44,63 @@ export interface EventCronProps {
44
44
  * - Each field can be a number, '*', '?', a range `${number}-${number}`
45
45
  */
46
46
  schedule: string | ScheduleTime;
47
+ /**
48
+ * Timezone in which the schedule expression is evaluated.
49
+ *
50
+ * Accepts an IANA timezone name (e.g. `'America/Santiago'`, `'UTC'`).
51
+ * If omitted, the schedule is evaluated in UTC.
52
+ *
53
+ * Maps to the `scheduleExpressionTimezone` attribute of the EventBridge
54
+ * Scheduler resource. Note that the timezone is independent from the cron
55
+ * expression itself.
56
+ *
57
+ * @example
58
+ * timezone: 'America/Santiago'
59
+ */
60
+ timezone?: string;
61
+ /**
62
+ * Human-readable description of the schedule.
63
+ *
64
+ * Useful for documentation purposes; shown in the AWS console.
65
+ */
66
+ description?: string;
67
+ /**
68
+ * State of the schedule.
69
+ *
70
+ * Allows pausing the schedule without deleting it:
71
+ * - `'enabled'` (default): the schedule is active.
72
+ * - `'disabled'`: the schedule will not trigger its target.
73
+ */
74
+ state?: 'enabled' | 'disabled';
75
+ /**
76
+ * Date and time, in ISO 8601 format, after which the schedule can begin
77
+ * invoking its target.
78
+ *
79
+ * @example
80
+ * startDate: '2026-07-01T00:00:00Z'
81
+ */
82
+ startDate?: string;
83
+ /**
84
+ * Date and time, in ISO 8601 format, before which the schedule can invoke
85
+ * its target. After this point the schedule stops triggering.
86
+ *
87
+ * @example
88
+ * endDate: '2026-12-31T23:59:59Z'
89
+ */
90
+ endDate?: string;
91
+ /**
92
+ * Maximum flexible time window, in minutes, within which the schedule can be
93
+ * invoked.
94
+ *
95
+ * When provided, the schedule runs in `FLEXIBLE` mode and EventBridge may
96
+ * invoke the target at any point inside this window (useful to spread load
97
+ * and avoid thundering-herd effects). If omitted, the schedule runs in `OFF`
98
+ * mode and triggers at the exact scheduled time.
99
+ *
100
+ * @example
101
+ * flexibleWindowMinutes: 15
102
+ */
103
+ flexibleWindowMinutes?: number;
47
104
  /**
48
105
  * Defines which EventBridge Scheduler attributes should be exported.
49
106
  *
@@ -22,7 +22,17 @@ class Cron extends resolver_1.lafkenResource.make(scheduler_schedule_1.Scheduler
22
22
  super(scope, `${handler.name}-cron`, {
23
23
  name: handler.name,
24
24
  scheduleExpression: Cron.buildScheduleExpression(handler.schedule),
25
- flexibleTimeWindow: { mode: 'OFF' },
25
+ scheduleExpressionTimezone: handler.timezone,
26
+ description: handler.description,
27
+ state: handler.state?.toUpperCase(),
28
+ startDate: handler.startDate,
29
+ endDate: handler.endDate,
30
+ flexibleTimeWindow: handler.flexibleWindowMinutes
31
+ ? {
32
+ mode: 'FLEXIBLE',
33
+ maximumWindowInMinutes: handler.flexibleWindowMinutes,
34
+ }
35
+ : { mode: 'OFF' },
26
36
  target: {
27
37
  arn: lambdaHandler.arn,
28
38
  roleArn: schedulerRole.arn,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lafken/schedule",
3
- "version": "0.12.24",
3
+ "version": "0.12.26",
4
4
  "private": false,
5
5
  "description": "Define EventBridge scheduled rules and cron jobs using TypeScript decorators with Lafken",
6
6
  "keywords": [
@@ -50,7 +50,7 @@
50
50
  ],
51
51
  "dependencies": {
52
52
  "reflect-metadata": "^0.2.2",
53
- "@lafken/resolver": "0.12.24"
53
+ "@lafken/resolver": "0.12.26"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@cdktn/provider-aws": "^24.4.0",
@@ -63,7 +63,7 @@
63
63
  "typescript": "6.0.3",
64
64
  "unplugin-swc": "^1.5.9",
65
65
  "vitest": "^4.1.8",
66
- "@lafken/common": "0.12.24"
66
+ "@lafken/common": "0.12.26"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "@cdktn/provider-aws": ">=23.0.0",