@geekmidas/cloud 9.2.1 → 9.3.0
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 +3 -3
- package/package.json +3 -3
- package/src/sst/Cron.ts +2 -9
- package/src/sst/__type-tests__/manifest.type-test.ts +5 -1
- package/src/sst/index.ts +0 -1
package/README.md
CHANGED
|
@@ -96,11 +96,11 @@ settings while custom authorizers require a `handler`.
|
|
|
96
96
|
### Cron
|
|
97
97
|
|
|
98
98
|
Wraps `sst.aws.CronV2` (`sst.aws.Cron` is deprecated). `processor` is a
|
|
99
|
-
`Function` (or anything with an `arn`); `schedule` is a typed `
|
|
100
|
-
`
|
|
99
|
+
`Function` (or anything with an `arn`); `schedule` is a typed `cron(…)` /
|
|
100
|
+
`at(…)`.
|
|
101
101
|
|
|
102
102
|
```ts
|
|
103
|
-
const cron = new Cron(stack, 'Nightly', { processor: fn, schedule: '
|
|
103
|
+
const cron = new Cron(stack, 'Nightly', { processor: fn, schedule: 'cron(0 0 * * ? *)' });
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
### From a `gkm build` manifest
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geekmidas/cloud",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"lodash.snakecase": "~4.1.1",
|
|
42
|
-
"@geekmidas/envkit": "9.
|
|
43
|
-
"@geekmidas/manifest": "9.
|
|
42
|
+
"@geekmidas/envkit": "9.3.0",
|
|
43
|
+
"@geekmidas/manifest": "9.3.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/lodash.get": "~4.4.9",
|
package/src/sst/Cron.ts
CHANGED
|
@@ -24,16 +24,9 @@ export type CronExpressionDay =
|
|
|
24
24
|
export type CronString =
|
|
25
25
|
`${CronExpressionValue} ${CronExpressionValue} ${CronExpressionValue} ${CronExpressionValue} ${CronExpressionDay} ${CronExpressionValue}`;
|
|
26
26
|
export type CronExpression = `cron(${CronString})`;
|
|
27
|
-
export type CronRate = `rate(${number} ${
|
|
28
|
-
| 'minute'
|
|
29
|
-
| 'minutes'
|
|
30
|
-
| 'hour'
|
|
31
|
-
| 'hours'
|
|
32
|
-
| 'day'
|
|
33
|
-
| 'days'})`;
|
|
34
27
|
/** One-time `at(…)` schedule (e.g. `at(2025-06-01T10:00:00)`). */
|
|
35
28
|
export type CronAt = `at(${string})`;
|
|
36
|
-
export type CronSchedule = CronExpression |
|
|
29
|
+
export type CronSchedule = CronExpression | CronAt;
|
|
37
30
|
|
|
38
31
|
/**
|
|
39
32
|
* `Cron` — wraps `sst.aws.CronV2` to invoke a `Function` on a schedule.
|
|
@@ -108,6 +101,6 @@ export interface CronProps
|
|
|
108
101
|
extends Omit<sst.aws.CronV2Args, 'function' | 'schedule'> {
|
|
109
102
|
/** The function invoked on schedule — a `Function` (or anything with an `arn`). */
|
|
110
103
|
processor: Function | { arn: $util.Input<string> };
|
|
111
|
-
/** Cron `
|
|
104
|
+
/** Cron `cron(…)` or `at(…)` schedule, fully type-checked. */
|
|
112
105
|
schedule: CronSchedule;
|
|
113
106
|
}
|
|
@@ -36,7 +36,11 @@ const manifest = {
|
|
|
36
36
|
{ name: 'worker', handler: 'worker.handler', environment: ['DB_URL'] },
|
|
37
37
|
],
|
|
38
38
|
crons: [
|
|
39
|
-
{
|
|
39
|
+
{
|
|
40
|
+
name: 'nightly',
|
|
41
|
+
handler: 'nightly.handler',
|
|
42
|
+
schedule: 'cron(0 0 * * ? *)',
|
|
43
|
+
},
|
|
40
44
|
],
|
|
41
45
|
} as const satisfies Manifest;
|
|
42
46
|
|