run402 4.166.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.
- package/lib/app-repo-tokens.mjs +1 -2
- package/lib/app-repos.mjs +2 -2
- package/lib/apps.mjs +1 -3
- package/lib/archives.mjs +0 -6
- package/lib/argparse.mjs +10 -53
- package/lib/assets.mjs +11 -42
- package/lib/auth.mjs +4 -48
- package/lib/billing.mjs +8 -8
- package/lib/branches.mjs +3 -5
- package/lib/buzz-notifications.mjs +2 -21
- package/lib/buzz.mjs +4 -5
- package/lib/cache.mjs +0 -20
- package/lib/cdn.mjs +0 -7
- package/lib/claims.mjs +2 -4
- package/lib/contacts.mjs +3 -9
- package/lib/contracts.mjs +0 -28
- package/lib/credentials.mjs +2 -5
- package/lib/deliveries.mjs +0 -1
- package/lib/deploy-v2.mjs +20 -102
- package/lib/domains.mjs +6 -73
- package/lib/email.mjs +19 -62
- package/lib/errors.mjs +6 -13
- package/lib/escalations.mjs +2 -4
- package/lib/events.mjs +1 -3
- package/lib/feedback.mjs +1 -34
- package/lib/functions.mjs +12 -26
- package/lib/grants.mjs +0 -7
- package/lib/identity.mjs +1 -7
- package/lib/image.mjs +1 -2
- package/lib/init.mjs +0 -3
- package/lib/jobs.mjs +2 -2
- package/lib/logs.mjs +2 -5
- package/lib/messages.mjs +3 -3
- package/lib/orgs.mjs +3 -3
- package/lib/projects.mjs +3 -50
- package/lib/remote-helper-session.mjs +1 -2
- package/lib/repos.mjs +7 -39
- package/lib/rooms.mjs +2 -3
- package/lib/snapshots.mjs +2 -7
- package/lib/stripe.mjs +9 -16
- package/lib/subscriptions.mjs +0 -3
- package/lib/transfer.mjs +16 -67
- package/lib/up.mjs +0 -16
- package/lib/webhooks.mjs +1 -13
- package/lib/whoami.mjs +0 -8
- package/package.json +1 -1
- package/sdk/dist/app-up.js +1 -0
- package/sdk/dist/app-up.js.map +1 -1
- package/sdk/dist/ci-credentials.d.ts.map +1 -1
- package/sdk/dist/ci-credentials.js +6 -0
- package/sdk/dist/ci-credentials.js.map +1 -1
- package/sdk/dist/control-plane-credentials.d.ts.map +1 -1
- package/sdk/dist/control-plane-credentials.js +2 -0
- package/sdk/dist/control-plane-credentials.js.map +1 -1
- package/sdk/dist/index.d.ts.map +1 -1
- package/sdk/dist/index.js +7 -0
- package/sdk/dist/index.js.map +1 -1
- package/sdk/dist/jcs.d.ts.map +1 -1
- package/sdk/dist/jcs.js +1 -0
- package/sdk/dist/jcs.js.map +1 -1
- package/sdk/dist/namespaces/admin.d.ts +1 -1
- package/sdk/dist/namespaces/admin.d.ts.map +1 -1
- package/sdk/dist/namespaces/admin.js +0 -5
- package/sdk/dist/namespaces/admin.js.map +1 -1
- package/sdk/dist/namespaces/agent.d.ts.map +1 -1
- package/sdk/dist/namespaces/agent.js +1 -0
- package/sdk/dist/namespaces/agent.js.map +1 -1
- package/sdk/dist/namespaces/ai.d.ts.map +1 -1
- package/sdk/dist/namespaces/ai.js +1 -0
- package/sdk/dist/namespaces/ai.js.map +1 -1
- package/sdk/dist/namespaces/app-repos.d.ts.map +1 -1
- package/sdk/dist/namespaces/app-repos.js +5 -4
- package/sdk/dist/namespaces/app-repos.js.map +1 -1
- package/sdk/dist/namespaces/archives.d.ts.map +1 -1
- package/sdk/dist/namespaces/archives.js +6 -3
- package/sdk/dist/namespaces/archives.js.map +1 -1
- package/sdk/dist/namespaces/assets-validation.d.ts +14 -19
- package/sdk/dist/namespaces/assets-validation.d.ts.map +1 -1
- package/sdk/dist/namespaces/assets-validation.js +27 -50
- package/sdk/dist/namespaces/assets-validation.js.map +1 -1
- package/sdk/dist/namespaces/assets.d.ts.map +1 -1
- package/sdk/dist/namespaces/assets.js +11 -28
- package/sdk/dist/namespaces/assets.js.map +1 -1
- package/sdk/dist/namespaces/assets.types.d.ts +0 -2
- package/sdk/dist/namespaces/assets.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/assets.types.js +0 -2
- package/sdk/dist/namespaces/assets.types.js.map +1 -1
- package/sdk/dist/namespaces/auth.d.ts.map +1 -1
- package/sdk/dist/namespaces/auth.js +30 -51
- package/sdk/dist/namespaces/auth.js.map +1 -1
- package/sdk/dist/namespaces/billing.d.ts.map +1 -1
- package/sdk/dist/namespaces/billing.js +12 -41
- package/sdk/dist/namespaces/billing.js.map +1 -1
- package/sdk/dist/namespaces/branches.js +1 -0
- package/sdk/dist/namespaces/branches.js.map +1 -1
- package/sdk/dist/namespaces/buzz.d.ts.map +1 -1
- package/sdk/dist/namespaces/buzz.js +3 -6
- package/sdk/dist/namespaces/buzz.js.map +1 -1
- package/sdk/dist/namespaces/cache.d.ts.map +1 -1
- package/sdk/dist/namespaces/cache.js +0 -4
- package/sdk/dist/namespaces/cache.js.map +1 -1
- package/sdk/dist/namespaces/ci.d.ts.map +1 -1
- package/sdk/dist/namespaces/ci.js +24 -90
- package/sdk/dist/namespaces/ci.js.map +1 -1
- package/sdk/dist/namespaces/contracts.d.ts.map +1 -1
- package/sdk/dist/namespaces/contracts.js +10 -32
- package/sdk/dist/namespaces/contracts.js.map +1 -1
- package/sdk/dist/namespaces/credentials.d.ts.map +1 -1
- package/sdk/dist/namespaces/credentials.js +13 -8
- package/sdk/dist/namespaces/credentials.js.map +1 -1
- package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
- package/sdk/dist/namespaces/deploy.js +156 -649
- package/sdk/dist/namespaces/deploy.js.map +1 -1
- package/sdk/dist/namespaces/domains.d.ts.map +1 -1
- package/sdk/dist/namespaces/domains.js +1 -0
- package/sdk/dist/namespaces/domains.js.map +1 -1
- package/sdk/dist/namespaces/email.d.ts +6 -1
- package/sdk/dist/namespaces/email.d.ts.map +1 -1
- package/sdk/dist/namespaces/email.js +23 -78
- package/sdk/dist/namespaces/email.js.map +1 -1
- package/sdk/dist/namespaces/errors.d.ts.map +1 -1
- package/sdk/dist/namespaces/errors.js +9 -0
- package/sdk/dist/namespaces/errors.js.map +1 -1
- package/sdk/dist/namespaces/escalations.d.ts.map +1 -1
- package/sdk/dist/namespaces/escalations.js +15 -0
- package/sdk/dist/namespaces/escalations.js.map +1 -1
- package/sdk/dist/namespaces/events.d.ts.map +1 -1
- package/sdk/dist/namespaces/events.js +2 -0
- package/sdk/dist/namespaces/events.js.map +1 -1
- package/sdk/dist/namespaces/functions.d.ts +2 -2
- package/sdk/dist/namespaces/functions.d.ts.map +1 -1
- package/sdk/dist/namespaces/functions.js +39 -154
- package/sdk/dist/namespaces/functions.js.map +1 -1
- package/sdk/dist/namespaces/grants.d.ts.map +1 -1
- package/sdk/dist/namespaces/grants.js +12 -0
- package/sdk/dist/namespaces/grants.js.map +1 -1
- package/sdk/dist/namespaces/identity-links.d.ts.map +1 -1
- package/sdk/dist/namespaces/identity-links.js +7 -3
- package/sdk/dist/namespaces/identity-links.js.map +1 -1
- package/sdk/dist/namespaces/identity-links.protocol.d.ts.map +1 -1
- package/sdk/dist/namespaces/identity-links.protocol.js +1 -0
- package/sdk/dist/namespaces/identity-links.protocol.js.map +1 -1
- package/sdk/dist/namespaces/live.js +2 -0
- package/sdk/dist/namespaces/live.js.map +1 -1
- package/sdk/dist/namespaces/org.d.ts.map +1 -1
- package/sdk/dist/namespaces/org.js +22 -9
- package/sdk/dist/namespaces/org.js.map +1 -1
- package/sdk/dist/namespaces/projects.d.ts.map +1 -1
- package/sdk/dist/namespaces/projects.js +3 -0
- package/sdk/dist/namespaces/projects.js.map +1 -1
- package/sdk/dist/namespaces/push.d.ts.map +1 -1
- package/sdk/dist/namespaces/push.js +6 -0
- package/sdk/dist/namespaces/push.js.map +1 -1
- package/sdk/dist/namespaces/repos.d.ts +7 -37
- package/sdk/dist/namespaces/repos.d.ts.map +1 -1
- package/sdk/dist/namespaces/repos.js +61 -63
- package/sdk/dist/namespaces/repos.js.map +1 -1
- package/sdk/dist/namespaces/rooms.d.ts.map +1 -1
- package/sdk/dist/namespaces/rooms.js +4 -0
- package/sdk/dist/namespaces/rooms.js.map +1 -1
- package/sdk/dist/namespaces/secrets.d.ts.map +1 -1
- package/sdk/dist/namespaces/secrets.js +1 -12
- package/sdk/dist/namespaces/secrets.js.map +1 -1
- package/sdk/dist/namespaces/snapshots.d.ts.map +1 -1
- package/sdk/dist/namespaces/snapshots.js +5 -0
- package/sdk/dist/namespaces/snapshots.js.map +1 -1
- package/sdk/dist/namespaces/subdomains.d.ts.map +1 -1
- package/sdk/dist/namespaces/subdomains.js +1 -0
- package/sdk/dist/namespaces/subdomains.js.map +1 -1
- package/sdk/dist/namespaces/transfers.d.ts.map +1 -1
- package/sdk/dist/namespaces/transfers.js +17 -28
- package/sdk/dist/namespaces/transfers.js.map +1 -1
- package/sdk/dist/namespaces/vault.crypto.d.ts.map +1 -1
- package/sdk/dist/namespaces/vault.crypto.js +1 -0
- package/sdk/dist/namespaces/vault.crypto.js.map +1 -1
- package/sdk/dist/namespaces/wallets.d.ts.map +1 -1
- package/sdk/dist/namespaces/wallets.js +6 -0
- package/sdk/dist/namespaces/wallets.js.map +1 -1
- package/sdk/dist/node/actions-node.d.ts.map +1 -1
- package/sdk/dist/node/actions-node.js +16 -0
- package/sdk/dist/node/actions-node.js.map +1 -1
- package/sdk/dist/node/archives-node.d.ts.map +1 -1
- package/sdk/dist/node/archives-node.js +17 -0
- package/sdk/dist/node/archives-node.js.map +1 -1
- package/sdk/dist/node/assets-node.d.ts.map +1 -1
- package/sdk/dist/node/assets-node.js +5 -3
- package/sdk/dist/node/assets-node.js.map +1 -1
- package/sdk/dist/node/bearer-redeem-key.d.ts.map +1 -1
- package/sdk/dist/node/bearer-redeem-key.js +1 -0
- package/sdk/dist/node/bearer-redeem-key.js.map +1 -1
- package/sdk/dist/node/buzz-doctor.d.ts.map +1 -1
- package/sdk/dist/node/buzz-doctor.js +3 -0
- package/sdk/dist/node/buzz-doctor.js.map +1 -1
- package/sdk/dist/node/ci.d.ts.map +1 -1
- package/sdk/dist/node/ci.js +1 -0
- package/sdk/dist/node/ci.js.map +1 -1
- package/sdk/dist/node/credentials.d.ts.map +1 -1
- package/sdk/dist/node/credentials.js +1 -0
- package/sdk/dist/node/credentials.js.map +1 -1
- package/sdk/dist/node/deploy-manifest.d.ts.map +1 -1
- package/sdk/dist/node/deploy-manifest.js +90 -222
- package/sdk/dist/node/deploy-manifest.js.map +1 -1
- package/sdk/dist/node/dev-session.d.ts.map +1 -1
- package/sdk/dist/node/dev-session.js +4 -0
- package/sdk/dist/node/dev-session.js.map +1 -1
- package/sdk/dist/node/doctor.d.ts.map +1 -1
- package/sdk/dist/node/doctor.js +1 -0
- package/sdk/dist/node/doctor.js.map +1 -1
- package/sdk/dist/node/files.d.ts.map +1 -1
- package/sdk/dist/node/files.js +5 -0
- package/sdk/dist/node/files.js.map +1 -1
- package/sdk/dist/node/index.d.ts.map +1 -1
- package/sdk/dist/node/index.js +1 -0
- package/sdk/dist/node/index.js.map +1 -1
- package/sdk/dist/node/init.d.ts.map +1 -1
- package/sdk/dist/node/init.js +2 -0
- package/sdk/dist/node/init.js.map +1 -1
- package/sdk/dist/node/lightning-wallet.d.ts.map +1 -1
- package/sdk/dist/node/lightning-wallet.js +1 -0
- package/sdk/dist/node/lightning-wallet.js.map +1 -1
- package/sdk/dist/node/manifest-export.d.ts.map +1 -1
- package/sdk/dist/node/manifest-export.js +1 -0
- package/sdk/dist/node/manifest-export.js.map +1 -1
- package/sdk/dist/node/mpp-pay-executor.d.ts.map +1 -1
- package/sdk/dist/node/mpp-pay-executor.js +1 -0
- package/sdk/dist/node/mpp-pay-executor.js.map +1 -1
- package/sdk/dist/node/org-adopt.d.ts.map +1 -1
- package/sdk/dist/node/org-adopt.js +4 -0
- package/sdk/dist/node/org-adopt.js.map +1 -1
- package/sdk/dist/node/org-context.d.ts.map +1 -1
- package/sdk/dist/node/org-context.js +5 -0
- package/sdk/dist/node/org-context.js.map +1 -1
- package/sdk/dist/node/paid-fetch.d.ts.map +1 -1
- package/sdk/dist/node/paid-fetch.js +2 -0
- package/sdk/dist/node/paid-fetch.js.map +1 -1
- package/sdk/dist/node/payment-attempts.d.ts.map +1 -1
- package/sdk/dist/node/payment-attempts.js +4 -0
- package/sdk/dist/node/payment-attempts.js.map +1 -1
- package/sdk/dist/node/signers/index.d.ts.map +1 -1
- package/sdk/dist/node/signers/index.js +2 -0
- package/sdk/dist/node/signers/index.js.map +1 -1
- package/sdk/dist/node/signers/kms.d.ts.map +1 -1
- package/sdk/dist/node/signers/kms.js +7 -0
- package/sdk/dist/node/signers/kms.js.map +1 -1
- package/sdk/dist/node/target-profile.d.ts.map +1 -1
- package/sdk/dist/node/target-profile.js +4 -0
- package/sdk/dist/node/target-profile.js.map +1 -1
- package/sdk/dist/node/vault-apply.d.ts.map +1 -1
- package/sdk/dist/node/vault-apply.js +6 -0
- package/sdk/dist/node/vault-apply.js.map +1 -1
- package/sdk/dist/node/vault-byo-config.d.ts.map +1 -1
- package/sdk/dist/node/vault-byo-config.js +1 -0
- package/sdk/dist/node/vault-byo-config.js.map +1 -1
- package/sdk/dist/node/vault-byo-probe.d.ts.map +1 -1
- package/sdk/dist/node/vault-byo-probe.js +1 -0
- package/sdk/dist/node/vault-byo-probe.js.map +1 -1
- package/sdk/dist/node/vault-creation-journal.d.ts.map +1 -1
- package/sdk/dist/node/vault-creation-journal.js +1 -0
- package/sdk/dist/node/vault-creation-journal.js.map +1 -1
- package/sdk/dist/node/vault-deploy.d.ts.map +1 -1
- package/sdk/dist/node/vault-deploy.js +7 -0
- package/sdk/dist/node/vault-deploy.js.map +1 -1
- package/sdk/dist/node/vault-handoff.d.ts.map +1 -1
- package/sdk/dist/node/vault-handoff.js +1 -0
- package/sdk/dist/node/vault-handoff.js.map +1 -1
- package/sdk/dist/node/vault-keystore.d.ts.map +1 -1
- package/sdk/dist/node/vault-keystore.js +2 -0
- package/sdk/dist/node/vault-keystore.js.map +1 -1
- package/sdk/dist/node/vault-member-bundle.d.ts.map +1 -1
- package/sdk/dist/node/vault-member-bundle.js +1 -0
- package/sdk/dist/node/vault-member-bundle.js.map +1 -1
- package/sdk/dist/node/vault-mirror-backend.d.ts.map +1 -1
- package/sdk/dist/node/vault-mirror-backend.js +1 -0
- package/sdk/dist/node/vault-mirror-backend.js.map +1 -1
- package/sdk/dist/node/vault-mirror-config.d.ts.map +1 -1
- package/sdk/dist/node/vault-mirror-config.js +1 -0
- package/sdk/dist/node/vault-mirror-config.js.map +1 -1
- package/sdk/dist/node/vault-mirror.d.ts.map +1 -1
- package/sdk/dist/node/vault-mirror.js +1 -0
- package/sdk/dist/node/vault-mirror.js.map +1 -1
- package/sdk/dist/node/vault-prune.d.ts.map +1 -1
- package/sdk/dist/node/vault-prune.js +1 -0
- package/sdk/dist/node/vault-prune.js.map +1 -1
- package/sdk/dist/node/vault-publication.d.ts +1 -2
- package/sdk/dist/node/vault-publication.d.ts.map +1 -1
- package/sdk/dist/node/vault-publication.js +2 -0
- package/sdk/dist/node/vault-publication.js.map +1 -1
- package/sdk/dist/node/vault-recover.d.ts.map +1 -1
- package/sdk/dist/node/vault-recover.js +1 -0
- package/sdk/dist/node/vault-recover.js.map +1 -1
- package/sdk/dist/node/vault-restore.d.ts.map +1 -1
- package/sdk/dist/node/vault-restore.js +3 -0
- package/sdk/dist/node/vault-restore.js.map +1 -1
- package/sdk/dist/node/vault-snapshot.d.ts.map +1 -1
- package/sdk/dist/node/vault-snapshot.js +6 -0
- package/sdk/dist/node/vault-snapshot.js.map +1 -1
- package/sdk/dist/node/vault-writer-state.d.ts.map +1 -1
- package/sdk/dist/node/vault-writer-state.js +1 -0
- package/sdk/dist/node/vault-writer-state.js.map +1 -1
- package/sdk/dist/node/wallets-send.d.ts.map +1 -1
- package/sdk/dist/node/wallets-send.js +4 -0
- package/sdk/dist/node/wallets-send.js.map +1 -1
- package/sdk/dist/node/wallets.d.ts.map +1 -1
- package/sdk/dist/node/wallets.js +17 -0
- package/sdk/dist/node/wallets.js.map +1 -1
- package/sdk/dist/project-id.d.ts.map +1 -1
- package/sdk/dist/project-id.js +1 -0
- package/sdk/dist/project-id.js.map +1 -1
- package/sdk/dist/validation.d.ts +0 -5
- package/sdk/dist/validation.d.ts.map +1 -1
- package/sdk/dist/validation.js +2 -40
- package/sdk/dist/validation.js.map +1 -1
- 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
|
-
|
|
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 ?
|
|
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));
|
package/lib/credentials.mjs
CHANGED
|
@@ -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
|
|
432
|
+
if (!kind) {
|
|
433
433
|
fail({
|
|
434
|
-
message: 'Missing
|
|
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));
|
package/lib/deliveries.mjs
CHANGED
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 :
|
|
1889
|
+
limit: parsed.flags["--limit"] === undefined ? null : parseWholeNumber(parsed.flags["--limit"], "--limit"),
|
|
1959
1890
|
};
|
|
1960
1891
|
|
|
1961
1892
|
const project = resolveProjectId(opts.project);
|
|
1962
|
-
//
|
|
1963
|
-
//
|
|
1964
|
-
|
|
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
|
-
:
|
|
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
|
-
:
|
|
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 :
|
|
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
|
-
|
|
171
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
package/lib/email.mjs
CHANGED
|
@@ -3,31 +3,13 @@ import { basename } from "node:path";
|
|
|
3
3
|
import { resolveProjectId } from "./config.mjs";
|
|
4
4
|
import { getSdk } from "./sdk.mjs";
|
|
5
5
|
import { reportSdkError, fail, parseFlagJson } from "./sdk-errors.mjs";
|
|
6
|
-
import { assertKnownFlags, flagValue, normalizeArgv,
|
|
6
|
+
import { assertKnownFlags, flagValue, normalizeArgv, positionalArgs, failUnknownSubcommand, parseIntegerArg } from "./argparse.mjs";
|
|
7
7
|
import { describeRejectedValue } from "../core-dist/redact.js";
|
|
8
8
|
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
pdf: "application/pdf",
|
|
12
|
-
csv: "text/csv",
|
|
13
|
-
txt: "text/plain",
|
|
14
|
-
json: "application/json",
|
|
15
|
-
png: "image/png",
|
|
16
|
-
jpg: "image/jpeg",
|
|
17
|
-
jpeg: "image/jpeg",
|
|
18
|
-
gif: "image/gif",
|
|
19
|
-
webp: "image/webp",
|
|
20
|
-
zip: "application/zip",
|
|
21
|
-
html: "text/html",
|
|
22
|
-
xml: "application/xml",
|
|
23
|
-
};
|
|
9
|
+
// A `:content-type` suffix is recognized only when the tail after the last `:`
|
|
10
|
+
// looks like a MIME type, so a path with a colon (a Windows drive) is not split.
|
|
24
11
|
const ATTACH_MIME_RE = /^[a-z0-9][a-z0-9!#$&^_.+-]*\/[a-z0-9][a-z0-9!#$&^_.+-]*$/i;
|
|
25
12
|
|
|
26
|
-
function inferAttachmentContentType(path) {
|
|
27
|
-
const ext = (path.split(".").pop() ?? "").toLowerCase();
|
|
28
|
-
return ATTACH_EXT_CONTENT_TYPES[ext] ?? "application/octet-stream";
|
|
29
|
-
}
|
|
30
|
-
|
|
31
13
|
/**
|
|
32
14
|
* Parse repeatable `--attach <path>[:content-type]` flags into the SDK
|
|
33
15
|
* attachment shape. The `:content-type` suffix is recognized only when the tail
|
|
@@ -62,7 +44,7 @@ export function parseAttachments(args) {
|
|
|
62
44
|
out.push({
|
|
63
45
|
filename: basename(path),
|
|
64
46
|
content_base64: bytes.toString("base64"),
|
|
65
|
-
content_type: contentType
|
|
47
|
+
...(contentType ? { content_type: contentType } : {}),
|
|
66
48
|
});
|
|
67
49
|
}
|
|
68
50
|
return out;
|
|
@@ -139,7 +121,7 @@ Subcommands:
|
|
|
139
121
|
--output is required: bytes are written
|
|
140
122
|
to the file; stdout receives a JSON
|
|
141
123
|
envelope { message_id, bytes, output }.
|
|
142
|
-
reply <message_id> --html "..."
|
|
124
|
+
reply <message_id> (--html "..." | --text "..." | both) [--subject "..."] [--from-name "..."] [--from <address>] [--project <project_id>]
|
|
143
125
|
Reply to an inbound message (threads via In-Reply-To)
|
|
144
126
|
delete [<slug|mailbox_id>] --confirm [--project <project_id>]
|
|
145
127
|
Delete the project's mailbox (irreversible)
|
|
@@ -160,8 +142,8 @@ Webhook subcommands:
|
|
|
160
142
|
|
|
161
143
|
Send modes:
|
|
162
144
|
Template: --template <name> --var key=value [--var ...] OR --vars '{"k":"v",...}'
|
|
163
|
-
Raw
|
|
164
|
-
Raw
|
|
145
|
+
Raw: --subject "..." with --html "..." and/or --text "..."
|
|
146
|
+
Raw also supports: --attach <path>[:content-type] (repeatable; max 100, 15 MB total)
|
|
165
147
|
and --inline <content_id>=<path>[:content-type] (an image shown in the body as cid:<content_id>)
|
|
166
148
|
Both modes support: --from-name "Display Name" --from <address> --project <project_id>
|
|
167
149
|
--from <address> sends as another local part of a custom domain; only that
|
|
@@ -224,7 +206,7 @@ const SUB_HELP = {
|
|
|
224
206
|
Usage:
|
|
225
207
|
run402 email send --to <email> --template <name> --var key=value [--var ...]
|
|
226
208
|
run402 email send --to <email> --template <name> --vars '{"k":"v",...}'
|
|
227
|
-
run402 email send --to <email> --subject "..." --html "..."
|
|
209
|
+
run402 email send --to <email> --subject "..." (--html "..." | --text "..." | both) [--attach <path> ...]
|
|
228
210
|
run402 email send --to <email> --bcc <email> [--bcc <email> ...] [mode flags]
|
|
229
211
|
|
|
230
212
|
Options:
|
|
@@ -235,13 +217,14 @@ Options:
|
|
|
235
217
|
notification
|
|
236
218
|
--var key=value Template variable (repeatable)
|
|
237
219
|
--vars '<json>' All template variables as a single JSON object
|
|
238
|
-
--subject "..." Subject line (raw
|
|
239
|
-
--html "..." HTML body (raw
|
|
240
|
-
--text "..." Plain-text body (raw
|
|
241
|
-
--attach <path>[:content-type] Attach a file (raw
|
|
242
|
-
max 100, each and all together ≤ 15 MB).
|
|
243
|
-
|
|
244
|
-
|
|
220
|
+
--subject "..." Subject line (raw mode)
|
|
221
|
+
--html "..." HTML body (raw mode; --html, --text or both)
|
|
222
|
+
--text "..." Plain-text body (raw mode; --html, --text or both)
|
|
223
|
+
--attach <path>[:content-type] Attach a file (raw mode only; repeatable;
|
|
224
|
+
max 100, each and all together ≤ 15 MB). Without
|
|
225
|
+
:content-type the platform reads the type from the file
|
|
226
|
+
(its bytes, then its extension); the result's
|
|
227
|
+
attachments_meta names the type it used.
|
|
245
228
|
--inline <content_id>=<path>[:content-type] An image shown inside the
|
|
246
229
|
html body where it says <img src="cid:<content_id>">
|
|
247
230
|
(repeatable). PNG, JPEG or GIF; without :content-type the
|
|
@@ -265,7 +248,7 @@ Usage:
|
|
|
265
248
|
reply: `run402 email reply — Reply to an inbound message (threaded via In-Reply-To)
|
|
266
249
|
|
|
267
250
|
Usage:
|
|
268
|
-
run402 email reply <message_id> --html "..."
|
|
251
|
+
run402 email reply <message_id> (--html "..." | --text "..." | both) [options]
|
|
269
252
|
`,
|
|
270
253
|
delete: `run402 email delete — Delete the project's mailbox (irreversible)
|
|
271
254
|
|
|
@@ -625,27 +608,6 @@ async function updateMailbox(args) {
|
|
|
625
608
|
message: "Use either positional <slug|id> or --mailbox, not both.",
|
|
626
609
|
});
|
|
627
610
|
}
|
|
628
|
-
if (footerPolicy == null && inboundPolicy == null && inboundAllowlistFlag == null) {
|
|
629
|
-
fail({
|
|
630
|
-
code: "BAD_USAGE",
|
|
631
|
-
message: "Pass --footer-policy, --inbound-policy, and/or --inbound-allowlist.",
|
|
632
|
-
hint: "run402 email update <slug|id> --inbound-policy allowlist --inbound-allowlist \"*@example.com\"",
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
|
-
if (footerPolicy != null && !["run402_transparency", "none"].includes(footerPolicy)) {
|
|
636
|
-
fail({
|
|
637
|
-
code: "BAD_USAGE",
|
|
638
|
-
message: "--footer-policy must be one of: run402_transparency, none.",
|
|
639
|
-
details: { footer_policy: footerPolicy },
|
|
640
|
-
});
|
|
641
|
-
}
|
|
642
|
-
if (inboundPolicy != null && !["reply_only", "allowlist", "open"].includes(inboundPolicy)) {
|
|
643
|
-
fail({
|
|
644
|
-
code: "BAD_USAGE",
|
|
645
|
-
message: "--inbound-policy must be one of: reply_only, allowlist, open.",
|
|
646
|
-
details: { inbound_policy: inboundPolicy },
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
611
|
|
|
650
612
|
try {
|
|
651
613
|
const data = await getSdk().email.updateMailbox(projectId, {
|
|
@@ -700,6 +662,7 @@ async function send(args) {
|
|
|
700
662
|
message_id: data.message_id,
|
|
701
663
|
to: data.to,
|
|
702
664
|
...(data.bcc ? { bcc: data.bcc } : {}),
|
|
665
|
+
...(data.attachments_meta ? { attachments_meta: data.attachments_meta } : {}),
|
|
703
666
|
template: data.template,
|
|
704
667
|
subject: data.subject,
|
|
705
668
|
status: data.status,
|
|
@@ -723,7 +686,7 @@ async function list(args) {
|
|
|
723
686
|
const direction = strictFlagValue(args, "--direction");
|
|
724
687
|
try {
|
|
725
688
|
const data = await getSdk().email.list(projectId, {
|
|
726
|
-
limit: limit ?
|
|
689
|
+
limit: limit ? parseIntegerArg("--limit", limit) : undefined,
|
|
727
690
|
after: after ?? undefined,
|
|
728
691
|
direction: direction ?? undefined,
|
|
729
692
|
mailbox: mailbox ?? undefined,
|
|
@@ -808,12 +771,6 @@ async function reply(args) {
|
|
|
808
771
|
hint: 'run402 email reply <message_id> --html "..."',
|
|
809
772
|
});
|
|
810
773
|
}
|
|
811
|
-
if (!html && !text) {
|
|
812
|
-
fail({
|
|
813
|
-
code: "BAD_USAGE",
|
|
814
|
-
message: "Provide --html and/or --text for the reply body",
|
|
815
|
-
});
|
|
816
|
-
}
|
|
817
774
|
|
|
818
775
|
try {
|
|
819
776
|
// Fetch the original message to derive the reply-to address and subject.
|