@convex-dev/crons 0.1.3 → 0.1.5

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 CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/@convex-dev%2Fcrons.svg)](https://badge.fury.io/js/@convex-dev%2Fcrons)
4
4
 
5
- **Note: Convex Components are currently in beta.**
6
-
7
5
  <!-- START: Include on https://convex.dev/components -->
8
6
 
9
7
  This Convex component provides functionality for registering and managing cron
@@ -11,6 +9,24 @@ jobs at runtime. Convex comes with built-in support for cron jobs but they must
11
9
  be statically defined at deployment time. This library allows for dynamic
12
10
  registration of cron jobs at runtime.
13
11
 
12
+ ```ts
13
+ // Register a cron to run once per day.
14
+ const daily = await crons.register(
15
+ ctx,
16
+ { kind: "cron", cronspec: "0 0 * * *" },
17
+ internal.example.logStuff,
18
+ { message: "daily cron" }
19
+ );
20
+
21
+ // Register a cron to run every hour.
22
+ const hourly = await crons.register(
23
+ ctx,
24
+ { kind: "interval", ms: 3600000 },
25
+ internal.example.logStuff,
26
+ { message: "hourly cron" }
27
+ );
28
+ ```
29
+
14
30
  It supports intervals in milliseconds as well as cron schedules with the same
15
31
  format as the unix `cron` command:
16
32
 
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -1,3 +1,3 @@
1
1
  {
2
- "type": "commonjs"
2
+ "type": "module"
3
3
  }
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "email": "support@convex.dev",
8
8
  "url": "https://github.com/get-convex/crons/issues"
9
9
  },
10
- "version": "0.1.3",
10
+ "version": "0.1.5",
11
11
  "license": "Apache-2.0",
12
12
  "keywords": [
13
13
  "convex",
@@ -20,7 +20,7 @@
20
20
  "scripts": {
21
21
  "build": "npm run build:esm && npm run build:cjs",
22
22
  "build:esm": "tsc --project ./esm.json && echo '{\\n \"type\": \"module\"\\n}' > dist/esm/package.json",
23
- "build:cjs": "tsc --project ./commonjs.json && echo '{\\n \"type\": \"commonjs\"\\n}' > dist/esm/package.json",
23
+ "build:cjs": "tsc --project ./commonjs.json && echo '{\\n \"type\": \"commonjs\"\\n}' > dist/commonjs/package.json",
24
24
  "typecheck": "tsc --noEmit",
25
25
  "prepare": "npm run build"
26
26
  },