run402 1.30.0 → 1.31.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.
@@ -9,11 +9,15 @@ Subcommands:
9
9
  register <domain> [--project <id>] Register a custom sender domain (returns DNS records)
10
10
  status [--project <id>] Check domain verification status
11
11
  remove [--project <id>] Remove custom sender domain
12
+ inbound-enable <domain> [--project <id>] Enable inbound email (requires DKIM-verified)
13
+ inbound-disable <domain> [--project <id>] Disable inbound email
12
14
 
13
15
  Examples:
14
16
  run402 sender-domain register kysigned.com
15
17
  run402 sender-domain status
16
18
  run402 sender-domain remove
19
+ run402 sender-domain inbound-enable kysigned.com
20
+ run402 sender-domain inbound-disable kysigned.com
17
21
  `;
18
22
 
19
23
  function parseFlag(args, flag) {
@@ -82,12 +86,43 @@ async function remove(args) {
82
86
  console.log(JSON.stringify(data));
83
87
  }
84
88
 
89
+ async function inboundToggle(action, args) {
90
+ let domain = null;
91
+ let projectOpt = null;
92
+ for (let i = 0; i < args.length; i++) {
93
+ if (args[i] === "--project" && args[i + 1]) { projectOpt = args[++i]; }
94
+ else if (!args[i].startsWith("--") && !domain) { domain = args[i]; }
95
+ }
96
+ const projectId = resolveProjectId(projectOpt);
97
+ const p = findProject(projectId);
98
+
99
+ if (!domain) {
100
+ console.error(JSON.stringify({ status: "error", message: `Missing domain. Usage: run402 sender-domain inbound-${action} <domain>` }));
101
+ process.exit(1);
102
+ }
103
+
104
+ const method = action === "enable" ? "POST" : "DELETE";
105
+ const res = await fetch(`${API}/email/v1/domains/inbound`, {
106
+ method,
107
+ headers: { apikey: p.service_key, "Content-Type": "application/json" },
108
+ body: JSON.stringify({ domain }),
109
+ });
110
+ const data = await res.json();
111
+ if (!res.ok) {
112
+ console.error(JSON.stringify({ status: "error", http: res.status, ...data }));
113
+ process.exit(1);
114
+ }
115
+ console.log(JSON.stringify(data, null, 2));
116
+ }
117
+
85
118
  export async function run(sub, args) {
86
119
  if (!sub || sub === "--help" || sub === "-h") { console.log(HELP); process.exit(0); }
87
120
  switch (sub) {
88
121
  case "register": await register(args); break;
89
122
  case "status": await status(args); break;
90
123
  case "remove": await remove(args); break;
124
+ case "inbound-enable": await inboundToggle("enable", args); break;
125
+ case "inbound-disable": await inboundToggle("disable", args); break;
91
126
  default:
92
127
  console.error(`Unknown subcommand: ${sub}\n`);
93
128
  console.log(HELP);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run402",
3
- "version": "1.30.0",
3
+ "version": "1.31.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": {