run402 4.165.0 → 4.167.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.
Files changed (313) hide show
  1. package/lib/app-repo-tokens.mjs +1 -2
  2. package/lib/app-repos.mjs +2 -2
  3. package/lib/apps.mjs +1 -3
  4. package/lib/archives.mjs +0 -6
  5. package/lib/argparse.mjs +10 -53
  6. package/lib/assets.mjs +11 -42
  7. package/lib/auth.mjs +4 -48
  8. package/lib/billing.mjs +8 -8
  9. package/lib/branches.mjs +3 -5
  10. package/lib/buzz-notifications.mjs +2 -21
  11. package/lib/buzz.mjs +4 -5
  12. package/lib/cache.mjs +0 -20
  13. package/lib/cdn.mjs +0 -7
  14. package/lib/claims.mjs +2 -4
  15. package/lib/contacts.mjs +3 -9
  16. package/lib/contracts.mjs +0 -28
  17. package/lib/credentials.mjs +2 -5
  18. package/lib/deliveries.mjs +0 -1
  19. package/lib/deploy-v2.mjs +20 -102
  20. package/lib/domains.mjs +6 -73
  21. package/lib/email.mjs +73 -64
  22. package/lib/errors.mjs +6 -13
  23. package/lib/escalations.mjs +2 -4
  24. package/lib/events.mjs +1 -3
  25. package/lib/feedback.mjs +1 -34
  26. package/lib/functions.mjs +12 -26
  27. package/lib/grants.mjs +0 -7
  28. package/lib/identity.mjs +1 -7
  29. package/lib/image.mjs +1 -2
  30. package/lib/init.mjs +0 -3
  31. package/lib/jobs.mjs +2 -2
  32. package/lib/logs.mjs +2 -5
  33. package/lib/messages.mjs +3 -3
  34. package/lib/orgs.mjs +3 -3
  35. package/lib/projects.mjs +3 -50
  36. package/lib/remote-helper-session.mjs +1 -2
  37. package/lib/repos.mjs +7 -39
  38. package/lib/rooms.mjs +2 -3
  39. package/lib/snapshots.mjs +2 -7
  40. package/lib/stripe.mjs +9 -16
  41. package/lib/subscriptions.mjs +0 -3
  42. package/lib/transfer.mjs +16 -67
  43. package/lib/up.mjs +0 -16
  44. package/lib/webhooks.mjs +1 -13
  45. package/lib/whoami.mjs +0 -8
  46. package/package.json +1 -1
  47. package/sdk/dist/app-up.js +1 -0
  48. package/sdk/dist/app-up.js.map +1 -1
  49. package/sdk/dist/ci-credentials.d.ts.map +1 -1
  50. package/sdk/dist/ci-credentials.js +6 -0
  51. package/sdk/dist/ci-credentials.js.map +1 -1
  52. package/sdk/dist/control-plane-credentials.d.ts.map +1 -1
  53. package/sdk/dist/control-plane-credentials.js +2 -0
  54. package/sdk/dist/control-plane-credentials.js.map +1 -1
  55. package/sdk/dist/index.d.ts.map +1 -1
  56. package/sdk/dist/index.js +7 -0
  57. package/sdk/dist/index.js.map +1 -1
  58. package/sdk/dist/jcs.d.ts.map +1 -1
  59. package/sdk/dist/jcs.js +1 -0
  60. package/sdk/dist/jcs.js.map +1 -1
  61. package/sdk/dist/namespaces/admin.d.ts +1 -1
  62. package/sdk/dist/namespaces/admin.d.ts.map +1 -1
  63. package/sdk/dist/namespaces/admin.js +0 -5
  64. package/sdk/dist/namespaces/admin.js.map +1 -1
  65. package/sdk/dist/namespaces/agent.d.ts.map +1 -1
  66. package/sdk/dist/namespaces/agent.js +1 -0
  67. package/sdk/dist/namespaces/agent.js.map +1 -1
  68. package/sdk/dist/namespaces/ai.d.ts.map +1 -1
  69. package/sdk/dist/namespaces/ai.js +1 -0
  70. package/sdk/dist/namespaces/ai.js.map +1 -1
  71. package/sdk/dist/namespaces/app-repos.d.ts.map +1 -1
  72. package/sdk/dist/namespaces/app-repos.js +5 -4
  73. package/sdk/dist/namespaces/app-repos.js.map +1 -1
  74. package/sdk/dist/namespaces/archives.d.ts.map +1 -1
  75. package/sdk/dist/namespaces/archives.js +6 -3
  76. package/sdk/dist/namespaces/archives.js.map +1 -1
  77. package/sdk/dist/namespaces/assets-validation.d.ts +14 -19
  78. package/sdk/dist/namespaces/assets-validation.d.ts.map +1 -1
  79. package/sdk/dist/namespaces/assets-validation.js +27 -50
  80. package/sdk/dist/namespaces/assets-validation.js.map +1 -1
  81. package/sdk/dist/namespaces/assets.d.ts.map +1 -1
  82. package/sdk/dist/namespaces/assets.js +11 -28
  83. package/sdk/dist/namespaces/assets.js.map +1 -1
  84. package/sdk/dist/namespaces/assets.types.d.ts +0 -2
  85. package/sdk/dist/namespaces/assets.types.d.ts.map +1 -1
  86. package/sdk/dist/namespaces/assets.types.js +0 -2
  87. package/sdk/dist/namespaces/assets.types.js.map +1 -1
  88. package/sdk/dist/namespaces/auth.d.ts.map +1 -1
  89. package/sdk/dist/namespaces/auth.js +30 -51
  90. package/sdk/dist/namespaces/auth.js.map +1 -1
  91. package/sdk/dist/namespaces/billing.d.ts.map +1 -1
  92. package/sdk/dist/namespaces/billing.js +12 -41
  93. package/sdk/dist/namespaces/billing.js.map +1 -1
  94. package/sdk/dist/namespaces/branches.js +1 -0
  95. package/sdk/dist/namespaces/branches.js.map +1 -1
  96. package/sdk/dist/namespaces/buzz.d.ts.map +1 -1
  97. package/sdk/dist/namespaces/buzz.js +3 -6
  98. package/sdk/dist/namespaces/buzz.js.map +1 -1
  99. package/sdk/dist/namespaces/cache.d.ts.map +1 -1
  100. package/sdk/dist/namespaces/cache.js +0 -4
  101. package/sdk/dist/namespaces/cache.js.map +1 -1
  102. package/sdk/dist/namespaces/ci.d.ts.map +1 -1
  103. package/sdk/dist/namespaces/ci.js +24 -90
  104. package/sdk/dist/namespaces/ci.js.map +1 -1
  105. package/sdk/dist/namespaces/contracts.d.ts.map +1 -1
  106. package/sdk/dist/namespaces/contracts.js +10 -32
  107. package/sdk/dist/namespaces/contracts.js.map +1 -1
  108. package/sdk/dist/namespaces/credentials.d.ts.map +1 -1
  109. package/sdk/dist/namespaces/credentials.js +13 -8
  110. package/sdk/dist/namespaces/credentials.js.map +1 -1
  111. package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
  112. package/sdk/dist/namespaces/deploy.js +156 -649
  113. package/sdk/dist/namespaces/deploy.js.map +1 -1
  114. package/sdk/dist/namespaces/domains.d.ts.map +1 -1
  115. package/sdk/dist/namespaces/domains.js +1 -0
  116. package/sdk/dist/namespaces/domains.js.map +1 -1
  117. package/sdk/dist/namespaces/email.d.ts +22 -2
  118. package/sdk/dist/namespaces/email.d.ts.map +1 -1
  119. package/sdk/dist/namespaces/email.js +23 -78
  120. package/sdk/dist/namespaces/email.js.map +1 -1
  121. package/sdk/dist/namespaces/errors.d.ts.map +1 -1
  122. package/sdk/dist/namespaces/errors.js +9 -0
  123. package/sdk/dist/namespaces/errors.js.map +1 -1
  124. package/sdk/dist/namespaces/escalations.d.ts.map +1 -1
  125. package/sdk/dist/namespaces/escalations.js +15 -0
  126. package/sdk/dist/namespaces/escalations.js.map +1 -1
  127. package/sdk/dist/namespaces/events.d.ts.map +1 -1
  128. package/sdk/dist/namespaces/events.js +2 -0
  129. package/sdk/dist/namespaces/events.js.map +1 -1
  130. package/sdk/dist/namespaces/functions.d.ts +2 -2
  131. package/sdk/dist/namespaces/functions.d.ts.map +1 -1
  132. package/sdk/dist/namespaces/functions.js +39 -154
  133. package/sdk/dist/namespaces/functions.js.map +1 -1
  134. package/sdk/dist/namespaces/grants.d.ts.map +1 -1
  135. package/sdk/dist/namespaces/grants.js +12 -0
  136. package/sdk/dist/namespaces/grants.js.map +1 -1
  137. package/sdk/dist/namespaces/identity-links.d.ts.map +1 -1
  138. package/sdk/dist/namespaces/identity-links.js +7 -3
  139. package/sdk/dist/namespaces/identity-links.js.map +1 -1
  140. package/sdk/dist/namespaces/identity-links.protocol.d.ts.map +1 -1
  141. package/sdk/dist/namespaces/identity-links.protocol.js +1 -0
  142. package/sdk/dist/namespaces/identity-links.protocol.js.map +1 -1
  143. package/sdk/dist/namespaces/live.js +2 -0
  144. package/sdk/dist/namespaces/live.js.map +1 -1
  145. package/sdk/dist/namespaces/org.d.ts.map +1 -1
  146. package/sdk/dist/namespaces/org.js +22 -9
  147. package/sdk/dist/namespaces/org.js.map +1 -1
  148. package/sdk/dist/namespaces/projects.d.ts.map +1 -1
  149. package/sdk/dist/namespaces/projects.js +3 -0
  150. package/sdk/dist/namespaces/projects.js.map +1 -1
  151. package/sdk/dist/namespaces/push.d.ts.map +1 -1
  152. package/sdk/dist/namespaces/push.js +6 -0
  153. package/sdk/dist/namespaces/push.js.map +1 -1
  154. package/sdk/dist/namespaces/repos.d.ts +7 -37
  155. package/sdk/dist/namespaces/repos.d.ts.map +1 -1
  156. package/sdk/dist/namespaces/repos.js +61 -63
  157. package/sdk/dist/namespaces/repos.js.map +1 -1
  158. package/sdk/dist/namespaces/rooms.d.ts.map +1 -1
  159. package/sdk/dist/namespaces/rooms.js +4 -0
  160. package/sdk/dist/namespaces/rooms.js.map +1 -1
  161. package/sdk/dist/namespaces/secrets.d.ts.map +1 -1
  162. package/sdk/dist/namespaces/secrets.js +1 -12
  163. package/sdk/dist/namespaces/secrets.js.map +1 -1
  164. package/sdk/dist/namespaces/snapshots.d.ts.map +1 -1
  165. package/sdk/dist/namespaces/snapshots.js +5 -0
  166. package/sdk/dist/namespaces/snapshots.js.map +1 -1
  167. package/sdk/dist/namespaces/subdomains.d.ts.map +1 -1
  168. package/sdk/dist/namespaces/subdomains.js +1 -0
  169. package/sdk/dist/namespaces/subdomains.js.map +1 -1
  170. package/sdk/dist/namespaces/transfers.d.ts.map +1 -1
  171. package/sdk/dist/namespaces/transfers.js +17 -28
  172. package/sdk/dist/namespaces/transfers.js.map +1 -1
  173. package/sdk/dist/namespaces/vault.crypto.d.ts.map +1 -1
  174. package/sdk/dist/namespaces/vault.crypto.js +1 -0
  175. package/sdk/dist/namespaces/vault.crypto.js.map +1 -1
  176. package/sdk/dist/namespaces/wallets.d.ts.map +1 -1
  177. package/sdk/dist/namespaces/wallets.js +6 -0
  178. package/sdk/dist/namespaces/wallets.js.map +1 -1
  179. package/sdk/dist/node/actions-node.d.ts.map +1 -1
  180. package/sdk/dist/node/actions-node.js +16 -0
  181. package/sdk/dist/node/actions-node.js.map +1 -1
  182. package/sdk/dist/node/archives-node.d.ts.map +1 -1
  183. package/sdk/dist/node/archives-node.js +17 -0
  184. package/sdk/dist/node/archives-node.js.map +1 -1
  185. package/sdk/dist/node/assets-node.d.ts.map +1 -1
  186. package/sdk/dist/node/assets-node.js +5 -3
  187. package/sdk/dist/node/assets-node.js.map +1 -1
  188. package/sdk/dist/node/bearer-redeem-key.d.ts.map +1 -1
  189. package/sdk/dist/node/bearer-redeem-key.js +1 -0
  190. package/sdk/dist/node/bearer-redeem-key.js.map +1 -1
  191. package/sdk/dist/node/buzz-doctor.d.ts.map +1 -1
  192. package/sdk/dist/node/buzz-doctor.js +3 -0
  193. package/sdk/dist/node/buzz-doctor.js.map +1 -1
  194. package/sdk/dist/node/ci.d.ts.map +1 -1
  195. package/sdk/dist/node/ci.js +1 -0
  196. package/sdk/dist/node/ci.js.map +1 -1
  197. package/sdk/dist/node/credentials.d.ts.map +1 -1
  198. package/sdk/dist/node/credentials.js +1 -0
  199. package/sdk/dist/node/credentials.js.map +1 -1
  200. package/sdk/dist/node/deploy-manifest.d.ts.map +1 -1
  201. package/sdk/dist/node/deploy-manifest.js +90 -222
  202. package/sdk/dist/node/deploy-manifest.js.map +1 -1
  203. package/sdk/dist/node/dev-session.d.ts.map +1 -1
  204. package/sdk/dist/node/dev-session.js +4 -0
  205. package/sdk/dist/node/dev-session.js.map +1 -1
  206. package/sdk/dist/node/doctor.d.ts.map +1 -1
  207. package/sdk/dist/node/doctor.js +1 -0
  208. package/sdk/dist/node/doctor.js.map +1 -1
  209. package/sdk/dist/node/files.d.ts.map +1 -1
  210. package/sdk/dist/node/files.js +5 -0
  211. package/sdk/dist/node/files.js.map +1 -1
  212. package/sdk/dist/node/index.d.ts.map +1 -1
  213. package/sdk/dist/node/index.js +1 -0
  214. package/sdk/dist/node/index.js.map +1 -1
  215. package/sdk/dist/node/init.d.ts.map +1 -1
  216. package/sdk/dist/node/init.js +2 -0
  217. package/sdk/dist/node/init.js.map +1 -1
  218. package/sdk/dist/node/lightning-wallet.d.ts.map +1 -1
  219. package/sdk/dist/node/lightning-wallet.js +1 -0
  220. package/sdk/dist/node/lightning-wallet.js.map +1 -1
  221. package/sdk/dist/node/manifest-export.d.ts.map +1 -1
  222. package/sdk/dist/node/manifest-export.js +1 -0
  223. package/sdk/dist/node/manifest-export.js.map +1 -1
  224. package/sdk/dist/node/mpp-pay-executor.d.ts.map +1 -1
  225. package/sdk/dist/node/mpp-pay-executor.js +1 -0
  226. package/sdk/dist/node/mpp-pay-executor.js.map +1 -1
  227. package/sdk/dist/node/org-adopt.d.ts.map +1 -1
  228. package/sdk/dist/node/org-adopt.js +4 -0
  229. package/sdk/dist/node/org-adopt.js.map +1 -1
  230. package/sdk/dist/node/org-context.d.ts.map +1 -1
  231. package/sdk/dist/node/org-context.js +5 -0
  232. package/sdk/dist/node/org-context.js.map +1 -1
  233. package/sdk/dist/node/paid-fetch.d.ts.map +1 -1
  234. package/sdk/dist/node/paid-fetch.js +2 -0
  235. package/sdk/dist/node/paid-fetch.js.map +1 -1
  236. package/sdk/dist/node/payment-attempts.d.ts.map +1 -1
  237. package/sdk/dist/node/payment-attempts.js +4 -0
  238. package/sdk/dist/node/payment-attempts.js.map +1 -1
  239. package/sdk/dist/node/signers/index.d.ts.map +1 -1
  240. package/sdk/dist/node/signers/index.js +2 -0
  241. package/sdk/dist/node/signers/index.js.map +1 -1
  242. package/sdk/dist/node/signers/kms.d.ts.map +1 -1
  243. package/sdk/dist/node/signers/kms.js +7 -0
  244. package/sdk/dist/node/signers/kms.js.map +1 -1
  245. package/sdk/dist/node/target-profile.d.ts.map +1 -1
  246. package/sdk/dist/node/target-profile.js +4 -0
  247. package/sdk/dist/node/target-profile.js.map +1 -1
  248. package/sdk/dist/node/vault-apply.d.ts.map +1 -1
  249. package/sdk/dist/node/vault-apply.js +6 -0
  250. package/sdk/dist/node/vault-apply.js.map +1 -1
  251. package/sdk/dist/node/vault-byo-config.d.ts.map +1 -1
  252. package/sdk/dist/node/vault-byo-config.js +1 -0
  253. package/sdk/dist/node/vault-byo-config.js.map +1 -1
  254. package/sdk/dist/node/vault-byo-probe.d.ts.map +1 -1
  255. package/sdk/dist/node/vault-byo-probe.js +1 -0
  256. package/sdk/dist/node/vault-byo-probe.js.map +1 -1
  257. package/sdk/dist/node/vault-creation-journal.d.ts.map +1 -1
  258. package/sdk/dist/node/vault-creation-journal.js +1 -0
  259. package/sdk/dist/node/vault-creation-journal.js.map +1 -1
  260. package/sdk/dist/node/vault-deploy.d.ts.map +1 -1
  261. package/sdk/dist/node/vault-deploy.js +7 -0
  262. package/sdk/dist/node/vault-deploy.js.map +1 -1
  263. package/sdk/dist/node/vault-handoff.d.ts.map +1 -1
  264. package/sdk/dist/node/vault-handoff.js +1 -0
  265. package/sdk/dist/node/vault-handoff.js.map +1 -1
  266. package/sdk/dist/node/vault-keystore.d.ts.map +1 -1
  267. package/sdk/dist/node/vault-keystore.js +2 -0
  268. package/sdk/dist/node/vault-keystore.js.map +1 -1
  269. package/sdk/dist/node/vault-member-bundle.d.ts.map +1 -1
  270. package/sdk/dist/node/vault-member-bundle.js +1 -0
  271. package/sdk/dist/node/vault-member-bundle.js.map +1 -1
  272. package/sdk/dist/node/vault-mirror-backend.d.ts.map +1 -1
  273. package/sdk/dist/node/vault-mirror-backend.js +1 -0
  274. package/sdk/dist/node/vault-mirror-backend.js.map +1 -1
  275. package/sdk/dist/node/vault-mirror-config.d.ts.map +1 -1
  276. package/sdk/dist/node/vault-mirror-config.js +1 -0
  277. package/sdk/dist/node/vault-mirror-config.js.map +1 -1
  278. package/sdk/dist/node/vault-mirror.d.ts.map +1 -1
  279. package/sdk/dist/node/vault-mirror.js +1 -0
  280. package/sdk/dist/node/vault-mirror.js.map +1 -1
  281. package/sdk/dist/node/vault-prune.d.ts.map +1 -1
  282. package/sdk/dist/node/vault-prune.js +1 -0
  283. package/sdk/dist/node/vault-prune.js.map +1 -1
  284. package/sdk/dist/node/vault-publication.d.ts +1 -2
  285. package/sdk/dist/node/vault-publication.d.ts.map +1 -1
  286. package/sdk/dist/node/vault-publication.js +2 -0
  287. package/sdk/dist/node/vault-publication.js.map +1 -1
  288. package/sdk/dist/node/vault-recover.d.ts.map +1 -1
  289. package/sdk/dist/node/vault-recover.js +1 -0
  290. package/sdk/dist/node/vault-recover.js.map +1 -1
  291. package/sdk/dist/node/vault-restore.d.ts.map +1 -1
  292. package/sdk/dist/node/vault-restore.js +3 -0
  293. package/sdk/dist/node/vault-restore.js.map +1 -1
  294. package/sdk/dist/node/vault-snapshot.d.ts.map +1 -1
  295. package/sdk/dist/node/vault-snapshot.js +6 -0
  296. package/sdk/dist/node/vault-snapshot.js.map +1 -1
  297. package/sdk/dist/node/vault-writer-state.d.ts.map +1 -1
  298. package/sdk/dist/node/vault-writer-state.js +1 -0
  299. package/sdk/dist/node/vault-writer-state.js.map +1 -1
  300. package/sdk/dist/node/wallets-send.d.ts.map +1 -1
  301. package/sdk/dist/node/wallets-send.js +4 -0
  302. package/sdk/dist/node/wallets-send.js.map +1 -1
  303. package/sdk/dist/node/wallets.d.ts.map +1 -1
  304. package/sdk/dist/node/wallets.js +17 -0
  305. package/sdk/dist/node/wallets.js.map +1 -1
  306. package/sdk/dist/project-id.d.ts.map +1 -1
  307. package/sdk/dist/project-id.js +1 -0
  308. package/sdk/dist/project-id.js.map +1 -1
  309. package/sdk/dist/validation.d.ts +0 -5
  310. package/sdk/dist/validation.d.ts.map +1 -1
  311. package/sdk/dist/validation.js +2 -40
  312. package/sdk/dist/validation.js.map +1 -1
  313. package/vault-surface.json +1 -1
package/lib/contacts.mjs CHANGED
@@ -26,7 +26,6 @@ import { sessionProofs } from "./session-proofs.mjs";
26
26
  import { getSdk } from "./sdk.mjs";
27
27
  import { reportSdkError, fail } from "./sdk-errors.mjs";
28
28
  import {
29
- assertAllowedValue,
30
29
  assertKnownFlags,
31
30
  flagValue,
32
31
  normalizeArgv,
@@ -34,7 +33,7 @@ import {
34
33
  requirePositionalCount,
35
34
  failUnknownSubcommand,
36
35
  hasHelp,
37
- parseIntegerFlag,
36
+ parseIntegerArg,
38
37
  } from "./argparse.mjs";
39
38
  import { resolveOrgId } from "./org-context.mjs";
40
39
 
@@ -337,7 +336,6 @@ async function rehearse(parsedArgs) {
337
336
  const orgId = flagValue(parsedArgs, "--org");
338
337
  const event = flagValue(parsedArgs, "--event");
339
338
  if (!event) fail({ code: "BAD_USAGE", message: `--event is required with --org: one of ${REHEARSABLE_EVENTS.join(", ")}` });
340
- assertAllowedValue(event, REHEARSABLE_EVENTS, "--event");
341
339
  try {
342
340
  const data = await getSdk().org(orgId).testNotification({ eventType: event });
343
341
  console.log(JSON.stringify(data, null, 2));
@@ -360,17 +358,13 @@ async function test(args) {
360
358
  fail({ code: "BAD_USAGE", message: `Unexpected argument for notifications test: ${extra[0]}` });
361
359
  }
362
360
  const source = flagValue(parsedArgs, "--source");
363
- if (source !== null) assertAllowedValue(source, ["app", "platform"], "--source");
364
361
  const eventType = flagValue(parsedArgs, "--type");
365
362
  walletAuthHeaders("/agent/v1/notifications/test");
366
363
  const opts = {};
367
364
  if (source) opts.source = source;
368
365
  if (eventType) opts.eventType = eventType;
369
366
  const severity = flagValue(parsedArgs, "--severity");
370
- if (severity !== null) {
371
- assertAllowedValue(severity, ["info", "notice", "warn", "critical"], "--severity");
372
- opts.severity = severity;
373
- }
367
+ if (severity !== null) opts.severity = severity;
374
368
  try {
375
369
  const data = await getSdk().admin.testNotification(opts);
376
370
  console.log(JSON.stringify(data, null, 2));
@@ -482,7 +476,7 @@ export async function run(sub, args) {
482
476
  });
483
477
  try {
484
478
  const levelRaw = flagValue(a, "--level");
485
- const level = levelRaw != null ? parseIntegerFlag("--level", levelRaw, { min: 1, max: 10 }) : undefined;
479
+ const level = levelRaw != null ? parseIntegerArg("--level", levelRaw) : undefined;
486
480
  const created = await getSdk().escalations.addContact(await resolveOrgId(a), {
487
481
  email: positionals[0],
488
482
  ...(level !== undefined ? { level } : {}),
package/lib/contracts.mjs CHANGED
@@ -1,13 +1,11 @@
1
1
  import { getSdk } from "./sdk.mjs";
2
2
  import { reportSdkError, fail, parseFlagJson } from "./sdk-errors.mjs";
3
3
  import {
4
- assertAllowedValue,
5
4
  assertKnownFlags,
6
5
  flagValue,
7
6
  normalizeArgv,
8
7
  positionalArgs,
9
8
  resolveProjectSelector,
10
- validateEvmAddress,
11
9
  failUnknownSubcommand,
12
10
  } from "./argparse.mjs";
13
11
 
@@ -214,15 +212,6 @@ Examples:
214
212
  function hasFlag(args, flag) {
215
213
  return args.includes(flag);
216
214
  }
217
- function validateWeiFlag(flag, value) {
218
- if (!/^\d+$/.test(String(value))) {
219
- fail({
220
- code: "BAD_FLAG",
221
- message: `${flag} must be a decimal non-negative integer string in wei`,
222
- details: { flag, value: String(value) },
223
- });
224
- }
225
- }
226
215
 
227
216
  async function provisionSigner(projectId, args) {
228
217
  const parsedArgs = normalizeArgv(args);
@@ -239,9 +228,7 @@ async function provisionSigner(projectId, args) {
239
228
  message: "Missing --chain (base-mainnet or base-sepolia)",
240
229
  });
241
230
  }
242
- assertAllowedValue(chain, ["base-mainnet", "base-sepolia"], "--chain");
243
231
  const recovery = flagValue(parsedArgs, "--recovery");
244
- if (recovery) validateEvmAddress(recovery, "--recovery");
245
232
  // Soft default of one signer — confirm if project already has one.
246
233
  let activeSigners = null;
247
234
  try {
@@ -316,7 +303,6 @@ async function setRecovery(projectId, signerId, args) {
316
303
  message: "Provide --address 0x... or --clear",
317
304
  });
318
305
  }
319
- if (address) validateEvmAddress(address, "--address");
320
306
  try {
321
307
  await getSdk().contracts.setRecovery(projectId, signerId, clear ? null : address);
322
308
  console.log(JSON.stringify({ signer_id: signerId, recovery_address: clear ? null : address, updated: true }));
@@ -337,7 +323,6 @@ async function setAlert(projectId, signerId, args) {
337
323
  if (!threshold) {
338
324
  fail({ code: "BAD_USAGE", message: "Missing --threshold-wei <n>" });
339
325
  }
340
- validateWeiFlag("--threshold-wei", threshold);
341
326
  try {
342
327
  await getSdk().contracts.setLowBalanceAlert(projectId, signerId, threshold);
343
328
  console.log(JSON.stringify({ signer_id: signerId, threshold_wei: threshold, updated: true }));
@@ -368,11 +353,8 @@ async function call(projectId, signerId, args) {
368
353
  hint: "Cost: chain gas + $0.000005 signing fee.",
369
354
  });
370
355
  }
371
- assertAllowedValue(chain, ["base-mainnet", "base-sepolia"], "--chain");
372
- if (value !== null) validateWeiFlag("--value-wei", value);
373
356
  const abiFragment = parseFlagJson("--abi", abi);
374
357
  const callArgs = parseFlagJson("--args", argsJson);
375
- validateEvmAddress(to, "--to");
376
358
  try {
377
359
  const data = await getSdk().contracts.call(projectId, {
378
360
  signerId,
@@ -430,11 +412,6 @@ async function transfersCreate(projectId, signerId, args) {
430
412
  hint: "--amount is in the asset's base units as a decimal string (USDC: 6 decimals, so 100000 is $0.10). Cost: one $0.000005 signing fee, no gas.",
431
413
  });
432
414
  }
433
- assertAllowedValue(chain, ["base-mainnet", "base-sepolia"], "--chain");
434
- validateEvmAddress(to, "--to");
435
- if (!/^[1-9][0-9]*$/.test(amount)) {
436
- fail({ code: "BAD_USAGE", message: "--amount must be a positive integer in the asset's base units." });
437
- }
438
415
  try {
439
416
  const data = await getSdk().contracts.transfer(projectId, {
440
417
  signerId, chain, asset, to, amount, idempotencyKey: idempotency ?? undefined,
@@ -492,8 +469,6 @@ async function deploy(projectId, signerId, args) {
492
469
  hint: "Cost: chain gas + $0.000005 signing fee. Returns deterministic CREATE address synchronously.",
493
470
  });
494
471
  }
495
- assertAllowedValue(chain, ["base-mainnet", "base-sepolia"], "--chain");
496
- if (value !== null) validateWeiFlag("--value-wei", value);
497
472
  try {
498
473
  const data = await getSdk().contracts.deploy(projectId, {
499
474
  signerId,
@@ -527,10 +502,8 @@ async function read(args) {
527
502
  message: "Required flags: --chain, --to, --abi, --fn, --args",
528
503
  });
529
504
  }
530
- assertAllowedValue(chain, ["base-mainnet", "base-sepolia"], "--chain");
531
505
  const abiFragment = parseFlagJson("--abi", abi);
532
506
  const callArgs = parseFlagJson("--args", argsJson);
533
- validateEvmAddress(to, "--to");
534
507
  try {
535
508
  const data = await getSdk().contracts.read({
536
509
  chain,
@@ -576,7 +549,6 @@ async function drain(projectId, signerId, args) {
576
549
  hint: "Cost: chain gas + $0.000005 signing fee.",
577
550
  });
578
551
  }
579
- validateEvmAddress(to, "--to");
580
552
  try {
581
553
  const data = await getSdk().contracts.drain(projectId, signerId, to);
582
554
  console.log(JSON.stringify(data, null, 2));
@@ -429,9 +429,9 @@ async function issue(args) {
429
429
  command: "run402 credentials issue --kind <anon|service> --name <name> [--project <project_id>] [--import]",
430
430
  missing: "",
431
431
  });
432
- if (kind !== "anon" && kind !== "service") {
432
+ if (!kind) {
433
433
  fail({
434
- message: 'Missing or invalid --kind. Use "anon" (tenant-facing) or "service" (privileged).',
434
+ message: 'Missing --kind. Use "anon" (tenant-facing) or "service" (privileged).',
435
435
  code: "BAD_USAGE",
436
436
  hint: "run402 credentials issue --kind service --name ci-deploy",
437
437
  });
@@ -570,9 +570,6 @@ async function token(args) {
570
570
  command: "run402 credentials token [--project <project_id>]",
571
571
  missing: "",
572
572
  });
573
- if (kind && kind !== "anon" && kind !== "service") {
574
- fail({ message: '--kind must be "anon" or "service".', code: "BAD_USAGE" });
575
- }
576
573
  try {
577
574
  const res = await getSdk().credentials.mintToken(projectId, kind ? { kind } : {});
578
575
  console.log(JSON.stringify(res, null, 2));
@@ -16,7 +16,6 @@ import { walletAuthHeaders } from "./config.mjs";
16
16
  import { getSdk } from "./sdk.mjs";
17
17
  import { reportSdkError, fail } from "./sdk-errors.mjs";
18
18
  import {
19
- assertAllowedValue,
20
19
  assertKnownFlags,
21
20
  flagValue,
22
21
  normalizeArgv,
package/lib/deploy-v2.mjs CHANGED
@@ -520,9 +520,6 @@ async function rehearseCmd(rawArgs) {
520
520
  // When --teardown is absent, omit it from the request body entirely — the
521
521
  // gateway defaults to on_pass (passed rehearsals delete their branch).
522
522
  const teardown = flagValue(args, "--teardown") ?? undefined;
523
- if (teardown !== undefined && !["keep", "on_pass", "always"].includes(teardown)) {
524
- fail({ code: "BAD_USAGE", message: "--teardown must be one of: on_pass, keep, always", details: { flag: "--teardown", value: teardown } });
525
- }
526
523
  const project = flagValue(args, "--project") ?? undefined;
527
524
  // A grant key is a complete deploy credential and the gateway explicitly
528
525
  // supports rehearsing with one (the route rejects only CI sessions).
@@ -743,13 +740,6 @@ function parsePromoteArgs(args) {
743
740
  details: { example: "run402 deploy promote rel_abc123" },
744
741
  });
745
742
  }
746
- if (typeof opts.releaseId !== "string" || !opts.releaseId.startsWith("rel_")) {
747
- fail({
748
- code: "BAD_USAGE",
749
- message: `Invalid release id: '${opts.releaseId}' (expected rel_*)`,
750
- details: { release_id: opts.releaseId },
751
- });
752
- }
753
743
 
754
744
  return opts;
755
745
  }
@@ -1250,65 +1240,6 @@ async function deployCmd(args) {
1250
1240
  await mergeAstroReleaseSlice(spec, opts.dir);
1251
1241
  }
1252
1242
 
1253
- // Reject empty specs client-side. Without this guard,
1254
- // `run402 deploy --spec '{}'` (and `--manifest <empty>`) would silently
1255
- // send an empty ReleaseSpec to /apply/v1/plans with no signal that nothing
1256
- // was deployed.
1257
- //
1258
- // `deploy` is v2-only — only meaningful keys are the v2 ReleaseSpec
1259
- // shape (database, site, functions, secrets, subdomains, domains) plus
1260
- // the `assets` slice, which the Node manifest adapter accepts on its own
1261
- // (an assets-only manifest is a valid apply).
1262
- // For object-typed sections the "container is non-empty" check isn't enough
1263
- // — `functions:{replace:{}}` has one key but ships nothing. We recurse one
1264
- // level so any object whose own values are all empty containers is still
1265
- // empty. `site.replace` is the exception: an empty one is a real deploy.
1266
- const meaningful = ["database", "site", "functions", "secrets", "subdomains", "routes", "checks", "i18n", "assets"];
1267
- // A field set to null inside a section clears something (a role gate,
1268
- // `functions.patch.set.<name>.require_role: null`), so it is content, as the
1269
- // SDK counts it; a section that is itself null is not (`i18n` aside, below).
1270
- function hasContent(v, nested = false) {
1271
- if (v === undefined) return false;
1272
- if (v === null) return nested;
1273
- if (Array.isArray(v)) return v.length > 0;
1274
- if (typeof v === "object") {
1275
- const keys = Object.keys(v);
1276
- if (keys.length === 0) return false;
1277
- return keys.some((k) => hasContent(v[k], true));
1278
- }
1279
- if (typeof v === "string") return v.length > 0;
1280
- return true;
1281
- }
1282
- function hasDeployableSection(key, value) {
1283
- if (key === "routes" && value && typeof value === "object" && !Array.isArray(value) &&
1284
- Object.prototype.hasOwnProperty.call(value, "replace") && Array.isArray(value.replace)) {
1285
- return true;
1286
- }
1287
- // `i18n: null` clears the slice — that's a valid deploy on its own.
1288
- if (key === "i18n" && value === null) return true;
1289
- // An explicit `site.replace`, even `{}`, takes the static files offline.
1290
- if (key === "site" && value && typeof value === "object" && !Array.isArray(value) &&
1291
- value.replace && typeof value.replace === "object" && !Array.isArray(value.replace)) {
1292
- return true;
1293
- }
1294
- return hasContent(value);
1295
- }
1296
- const hasMeaningfulContent = executableManifest || (
1297
- spec && typeof spec === "object" && !Array.isArray(spec) &&
1298
- meaningful.some((key) => hasDeployableSection(key, spec[key]))
1299
- );
1300
- if (!hasMeaningfulContent) {
1301
- fail({
1302
- code: "MANIFEST_EMPTY",
1303
- message: `Manifest contains no deployable sections. Expected at least one of: ${meaningful.join(", ")}`,
1304
- hint: "Did you mean to write a 'site.replace' or 'database.migrations' block? See https://run402.com/schemas/manifest.v1.json",
1305
- details: {
1306
- field: source,
1307
- ...(manifestPath ? { path: manifestPath } : {}),
1308
- meaningful_keys: meaningful,
1309
- },
1310
- });
1311
- }
1312
1243
 
1313
1244
  const manifestProject = spec?.project ?? spec?.project_id;
1314
1245
  if (opts.project && manifestProject && manifestProject !== opts.project) {
@@ -1955,32 +1886,13 @@ async function listCmd(args) {
1955
1886
  });
1956
1887
  const opts = {
1957
1888
  project: parsed.flags["--project"] ?? null,
1958
- limit: parsed.flags["--limit"] === undefined ? null : parsePositiveInt(parsed.flags["--limit"], "--limit"),
1889
+ limit: parsed.flags["--limit"] === undefined ? null : parseWholeNumber(parsed.flags["--limit"], "--limit"),
1959
1890
  };
1960
1891
 
1961
1892
  const project = resolveProjectId(opts.project);
1962
- // NOT ungated for grant keys, deliberately: /apply/v1/operations (list) is
1963
- // `apikeyAuth` only — unlike get/events/resume/promote, which accept a
1964
- // grant-key bearer. Listing every operation on a project is broader than
1965
- // the per-operation reads a deploy credential is scoped to. If this is
1966
- // ever widened, widen the ROUTE first, then this guard.
1967
- //
1968
- // The refusal is correct; the REMEDY must still be honest. Falling through
1969
- // to NO_WALLET would tell a grant-key holder to run `run402 init`, which
1970
- // is wrong for a credential that is wallet-less by design — the same
1971
- // misleading-remedy shape removed from the payment path in 4.11.2.
1972
- if (grantKeyFromEnv()) {
1973
- fail({
1974
- code: "GRANT_KEY_SCOPE_INSUFFICIENT",
1975
- message: "Listing deploy operations is not available to a grant key.",
1976
- hint: "Use `run402 deploy status <operation_id>`, `deploy events <operation_id>` or `deploy verify <operation_id>` for a specific operation, which a grant key CAN read. A full listing needs the project apikey or the owner wallet.",
1977
- details: { command: "deploy list", credential: "grant_key", route: "GET /apply/v1/operations" },
1978
- next_actions: [
1979
- { type: "run_command", command: "run402 deploy status <operation_id>", why: "Per-operation reads are within a grant key's deploy scope." },
1980
- ],
1981
- });
1982
- }
1983
- walletAuthHeaders("/apply/v1/operations");
1893
+ // A grant key goes to the gateway like any other credential; the gateway
1894
+ // decides whether it may list operations and its refusal is printed as given.
1895
+ if (!grantKeyFromEnv()) walletAuthHeaders("/apply/v1/operations");
1984
1896
 
1985
1897
  try {
1986
1898
  const sdkOpts = { project };
@@ -2148,7 +2060,7 @@ async function releasesGetCmd(args) {
2148
2060
  project: parsed.flags["--project"] ?? null,
2149
2061
  siteLimit: parsed.flags["--site-limit"] === undefined
2150
2062
  ? null
2151
- : parsePositiveInt(parsed.flags["--site-limit"], "--site-limit"),
2063
+ : parseWholeNumber(parsed.flags["--site-limit"], "--site-limit"),
2152
2064
  };
2153
2065
 
2154
2066
  const project = resolveProjectId(opts.project);
@@ -2177,7 +2089,7 @@ async function releasesActiveCmd(args) {
2177
2089
  project: parsed.flags["--project"] ?? null,
2178
2090
  siteLimit: parsed.flags["--site-limit"] === undefined
2179
2091
  ? null
2180
- : parsePositiveInt(parsed.flags["--site-limit"], "--site-limit"),
2092
+ : parseWholeNumber(parsed.flags["--site-limit"], "--site-limit"),
2181
2093
  };
2182
2094
 
2183
2095
  const project = resolveProjectId(opts.project);
@@ -2206,7 +2118,7 @@ async function releasesDiffCmd(args) {
2206
2118
  project: parsed.flags["--project"] ?? null,
2207
2119
  from: parsed.flags["--from"] ?? null,
2208
2120
  to: parsed.flags["--to"] ?? null,
2209
- limit: parsed.flags["--limit"] === undefined ? null : parsePositiveInt(parsed.flags["--limit"], "--limit"),
2121
+ limit: parsed.flags["--limit"] === undefined ? null : parseWholeNumber(parsed.flags["--limit"], "--limit"),
2210
2122
  };
2211
2123
  if (!opts.from || !opts.to) {
2212
2124
  fail({
@@ -2215,13 +2127,6 @@ async function releasesDiffCmd(args) {
2215
2127
  hint: "run402 deploy releases diff --from empty --to active",
2216
2128
  });
2217
2129
  }
2218
- if (opts.to === "empty") {
2219
- fail({
2220
- code: "BAD_USAGE",
2221
- message: "--to cannot be empty. Use active or a release id.",
2222
- details: { flag: "--to", value: opts.to },
2223
- });
2224
- }
2225
2130
 
2226
2131
  const project = resolveProjectId(opts.project);
2227
2132
 
@@ -2404,6 +2309,19 @@ function expectPositionals(positionals, { command, min = 0, max = min, missing =
2404
2309
  return positionals;
2405
2310
  }
2406
2311
 
2312
+ // A count the gateway receives (--limit, --site-limit): the CLI checks only that
2313
+ // it is a whole number; any range is the gateway's to judge.
2314
+ function parseWholeNumber(value, flag) {
2315
+ if (typeof value !== "string" || !/^\d+$/.test(value) || !Number.isSafeInteger(Number.parseInt(value, 10))) {
2316
+ fail({
2317
+ code: "BAD_USAGE",
2318
+ message: `${flag} must be a whole number.`,
2319
+ details: { flag, value },
2320
+ });
2321
+ }
2322
+ return Number.parseInt(value, 10);
2323
+ }
2324
+
2407
2325
  function parsePositiveInt(value, flag) {
2408
2326
  if (typeof value !== "string" || !/^\d+$/.test(value)) {
2409
2327
  fail({
package/lib/domains.mjs CHANGED
@@ -167,43 +167,17 @@ function normalizeReceiveStrategy(value) {
167
167
  "full-receive-takeover": "full_receive_takeover",
168
168
  full_receive_takeover: "full_receive_takeover",
169
169
  };
170
- const normalized = map[value];
171
- if (!normalized) {
172
- fail({
173
- code: "BAD_FLAG",
174
- message: "--receive-strategy must be one of: auto, outbound-only, forwarding, subdomain, full-mx.",
175
- details: { flag: "--receive-strategy", value },
176
- });
177
- }
178
- return normalized;
170
+ // A spelling the CLI does not know passes through; the gateway judges it.
171
+ return map[value] ?? value;
179
172
  }
180
173
 
181
174
  function parseMailboxAddressMode(value) {
182
175
  if (!value) return null;
183
- const allowed = ["primary", "alias", "managed", "none"];
184
- if (value.includes(",") || !allowed.includes(value)) {
185
- fail({
186
- code: "BAD_FLAG",
187
- message: "--mailbox-addresses must be one of: primary, alias, managed, none.",
188
- hint: "Use `--mailbox-addresses primary --addresses info,legal`, not `--mailbox-addresses info,legal`.",
189
- details: { flag: "--mailbox-addresses", value, replacement_flag: "--addresses" },
190
- });
191
- }
192
176
  return value;
193
177
  }
194
178
 
195
- const MAILBOX_SLUG_RE = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/;
196
-
197
179
  function parseCatchAll(value) {
198
180
  if (value === undefined || value === null) return null;
199
- if (!MAILBOX_SLUG_RE.test(value)) {
200
- fail({
201
- code: "BAD_FLAG",
202
- message: "--catch-all must be a mailbox slug (lowercase letters, digits, hyphens).",
203
- hint: "Use the slug of an active mailbox of the project, e.g. --catch-all letters.",
204
- details: { flag: "--catch-all", value },
205
- });
206
- }
207
181
  return value;
208
182
  }
209
183
 
@@ -226,16 +200,7 @@ function desiredFromConnectFlags(domain, parsed) {
226
200
  const desired = {};
227
201
  const authority = flagValue(parsed, "--authority");
228
202
  if (authority) {
229
- const wire = CONNECT_AUTHORITY_WIRE[authority];
230
- if (!wire) {
231
- fail({
232
- code: "BAD_FLAG",
233
- message: "--authority on connect must be manual-dns or hosted-zone.",
234
- hint: "auto, provider-connect, and delegated-subdomain select how an apply runs; use them on `run402 domains apply`.",
235
- details: { flag: "--authority", value: authority },
236
- });
237
- }
238
- desired.authority = wire;
203
+ desired.authority = CONNECT_AUTHORITY_WIRE[authority] ?? authority;
239
204
  }
240
205
  const web = parsed.includes("--web") || flagValue(parsed, "--web-target") || parsed.includes("--primary-web") || parsed.includes("--web-alias");
241
206
  if (web) {
@@ -250,17 +215,7 @@ function desiredFromConnectFlags(domain, parsed) {
250
215
  const emailReceive = parsed.includes("--email-receive");
251
216
  const catchAll = parseCatchAll(flagValue(parsed, "--catch-all"));
252
217
  let mailboxMode = parseMailboxAddressMode(flagValue(parsed, "--mailbox-addresses"));
253
- if (catchAll) {
254
- if (mailboxMode && mailboxMode !== "primary") {
255
- fail({
256
- code: "BAD_FLAG",
257
- message: "--catch-all needs --mailbox-addresses primary (or no --mailbox-addresses).",
258
- hint: "A catch-all receives beside all mailboxes at their slugs; drop --mailbox-addresses or set it to primary.",
259
- details: { flag: "--catch-all", conflicting_flag: "--mailbox-addresses", value: mailboxMode },
260
- });
261
- }
262
- mailboxMode = "primary";
263
- }
218
+ if (catchAll && !mailboxMode) mailboxMode = "primary";
264
219
  if (emailSend || emailReceive || mailboxMode) {
265
220
  const email = {};
266
221
  if (emailSend) email.send = { enabled: true };
@@ -277,13 +232,6 @@ function desiredFromConnectFlags(domain, parsed) {
277
232
  }
278
233
  if (mailboxMode) {
279
234
  const locals = parseAddresses(flagValue(parsed, "--addresses"));
280
- if ((mailboxMode === "primary" || mailboxMode === "alias") && locals.length === 0 && !catchAll) {
281
- fail({
282
- code: "BAD_FLAG",
283
- message: "--addresses is required when --mailbox-addresses is primary or alias.",
284
- details: { flag: "--addresses", domain },
285
- });
286
- }
287
235
  const create = parsed.includes("--create-mailboxes")
288
236
  ? true
289
237
  : parsed.includes("--no-create-mailboxes") ? false : false;
@@ -298,26 +246,11 @@ function desiredFromConnectFlags(domain, parsed) {
298
246
  };
299
247
  }
300
248
  const activation = flagValue(parsed, "--activation");
301
- if (activation) {
302
- if (!["automatic_when_ready", "manual"].includes(activation)) {
303
- fail({
304
- code: "BAD_FLAG",
305
- message: "--activation must be automatic_when_ready or manual.",
306
- details: { flag: "--activation", value: activation },
307
- });
308
- }
309
- email.activation = activation;
310
- }
249
+ if (activation) email.activation = activation;
311
250
  desired.email = email;
312
251
  }
313
252
 
314
- if (!desired.web && !desired.email) {
315
- fail({
316
- code: "BAD_USAGE",
317
- message: "No desired domain capability selected.",
318
- hint: "Use --web, --email-send, --email-receive, --mailbox-addresses, and/or --catch-all.",
319
- });
320
- }
253
+
321
254
  return desired;
322
255
  }
323
256