run402 1.19.6 → 1.20.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/lib/functions.mjs CHANGED
@@ -8,7 +8,7 @@ Usage:
8
8
  run402 functions <subcommand> [args...]
9
9
 
10
10
  Subcommands:
11
- deploy <id> <name> --file <file> [--timeout <s>] [--memory <mb>] [--deps <pkg,...>]
11
+ deploy <id> <name> --file <file> [--timeout <s>] [--memory <mb>] [--deps <pkg,...>] [--schedule <cron>]
12
12
  Deploy a function to a project
13
13
  invoke <id> <name> [--method <M>] [--body <json>]
14
14
  Invoke a deployed function
@@ -18,6 +18,8 @@ Subcommands:
18
18
 
19
19
  Examples:
20
20
  run402 functions deploy abc123 stripe-webhook --file handler.ts
21
+ run402 functions deploy abc123 send-reminders --file remind.ts --schedule '*/15 * * * *'
22
+ run402 functions deploy abc123 send-reminders --file remind.ts --schedule '' # remove schedule
21
23
  run402 functions invoke abc123 stripe-webhook --body '{"event":"test"}'
22
24
  run402 functions logs abc123 stripe-webhook --tail 100
23
25
  run402 functions list abc123
@@ -30,12 +32,13 @@ Notes:
30
32
 
31
33
  async function deploy(projectId, name, args) {
32
34
  const p = findProject(projectId);
33
- const opts = { file: null, timeout: undefined, memory: undefined, deps: undefined };
35
+ const opts = { file: null, timeout: undefined, memory: undefined, deps: undefined, schedule: undefined };
34
36
  for (let i = 0; i < args.length; i++) {
35
37
  if (args[i] === "--file" && args[i + 1]) opts.file = args[++i];
36
38
  if (args[i] === "--timeout" && args[i + 1]) opts.timeout = parseInt(args[++i]);
37
39
  if (args[i] === "--memory" && args[i + 1]) opts.memory = parseInt(args[++i]);
38
40
  if (args[i] === "--deps" && args[i + 1]) opts.deps = args[++i].split(",");
41
+ if (args[i] === "--schedule" && i + 1 < args.length) opts.schedule = args[++i];
39
42
  }
40
43
  if (!opts.file) { console.error(JSON.stringify({ status: "error", message: "Missing --file <file>" })); process.exit(1); }
41
44
  const code = readFileSync(opts.file, "utf-8");
@@ -44,6 +47,7 @@ async function deploy(projectId, name, args) {
44
47
  if (opts.timeout) body.config.timeout = opts.timeout;
45
48
  if (opts.memory) body.config.memory = opts.memory;
46
49
  if (opts.deps) body.deps = opts.deps;
50
+ if (opts.schedule !== undefined) body.schedule = opts.schedule === "" ? null : opts.schedule;
47
51
 
48
52
  const fetchPaid = await setupPaidFetch();
49
53
  const res = await fetchPaid(`${API}/projects/v1/admin/${projectId}/functions`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run402",
3
- "version": "1.19.6",
3
+ "version": "1.20.0",
4
4
  "description": "CLI for Run402 — provision Postgres databases, deploy static sites, generate images, and manage wallets via x402 and MPP micropayments.",
5
5
  "type": "module",
6
6
  "bin": {