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.
- 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 +73 -64
- 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 +22 -2
- 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/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,50 @@ 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 } : {}),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return out;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Parse repeatable `--inline <content_id>=<path>[:content-type]` flags into
|
|
55
|
+
* SDK attachments with `content_id`. Argv only: the file's bytes and the id are
|
|
56
|
+
* passed on, and the gateway owns every rule (the id's form, the image types,
|
|
57
|
+
* the type of a file sent without one, and that the html shows each image).
|
|
58
|
+
*/
|
|
59
|
+
export function parseInlineImages(args) {
|
|
60
|
+
const out = [];
|
|
61
|
+
for (let i = 0; i < args.length; i++) {
|
|
62
|
+
if (args[i] !== "--inline") continue;
|
|
63
|
+
const raw = args[++i];
|
|
64
|
+
const eq = typeof raw === "string" ? raw.indexOf("=") : -1;
|
|
65
|
+
if (typeof raw !== "string" || raw.startsWith("--") || eq <= 0 || eq === raw.length - 1) {
|
|
66
|
+
fail({ code: "BAD_USAGE", message: "--inline requires a <content_id>=<path>[:content-type] value, e.g. --inline photo=./family.jpg" });
|
|
67
|
+
}
|
|
68
|
+
const contentId = raw.slice(0, eq);
|
|
69
|
+
let path = raw.slice(eq + 1);
|
|
70
|
+
let contentType;
|
|
71
|
+
const colon = path.lastIndexOf(":");
|
|
72
|
+
if (colon > 0 && ATTACH_MIME_RE.test(path.slice(colon + 1))) {
|
|
73
|
+
contentType = path.slice(colon + 1).toLowerCase();
|
|
74
|
+
path = path.slice(0, colon);
|
|
75
|
+
}
|
|
76
|
+
let bytes;
|
|
77
|
+
try {
|
|
78
|
+
bytes = readFileSync(path);
|
|
79
|
+
} catch (err) {
|
|
80
|
+
fail({
|
|
81
|
+
code: "BAD_USAGE",
|
|
82
|
+
message: `Cannot read inline image file: ${path}`,
|
|
83
|
+
details: { error: String((err && err.message) || err) },
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
out.push({
|
|
87
|
+
filename: basename(path),
|
|
88
|
+
content_base64: bytes.toString("base64"),
|
|
89
|
+
...(contentType ? { content_type: contentType } : {}),
|
|
90
|
+
content_id: contentId,
|
|
66
91
|
});
|
|
67
92
|
}
|
|
68
93
|
return out;
|
|
@@ -96,7 +121,7 @@ Subcommands:
|
|
|
96
121
|
--output is required: bytes are written
|
|
97
122
|
to the file; stdout receives a JSON
|
|
98
123
|
envelope { message_id, bytes, output }.
|
|
99
|
-
reply <message_id> --html "..."
|
|
124
|
+
reply <message_id> (--html "..." | --text "..." | both) [--subject "..."] [--from-name "..."] [--from <address>] [--project <project_id>]
|
|
100
125
|
Reply to an inbound message (threads via In-Reply-To)
|
|
101
126
|
delete [<slug|mailbox_id>] --confirm [--project <project_id>]
|
|
102
127
|
Delete the project's mailbox (irreversible)
|
|
@@ -117,8 +142,9 @@ Webhook subcommands:
|
|
|
117
142
|
|
|
118
143
|
Send modes:
|
|
119
144
|
Template: --template <name> --var key=value [--var ...] OR --vars '{"k":"v",...}'
|
|
120
|
-
Raw
|
|
121
|
-
Raw
|
|
145
|
+
Raw: --subject "..." with --html "..." and/or --text "..."
|
|
146
|
+
Raw also supports: --attach <path>[:content-type] (repeatable; max 100, 15 MB total)
|
|
147
|
+
and --inline <content_id>=<path>[:content-type] (an image shown in the body as cid:<content_id>)
|
|
122
148
|
Both modes support: --from-name "Display Name" --from <address> --project <project_id>
|
|
123
149
|
--from <address> sends as another local part of a custom domain; only that
|
|
124
150
|
domain's catch-all mailbox may use it (see 'run402 domains connect --catch-all').
|
|
@@ -150,6 +176,8 @@ Examples:
|
|
|
150
176
|
--html "<h1>Hello</h1>" --from-name "My App"
|
|
151
177
|
run402 email send --to user@example.com --subject "Your receipt" \\
|
|
152
178
|
--html "<p>Attached.</p>" --attach ./receipt.pdf
|
|
179
|
+
run402 email send --to user@example.com --subject "We found them" \\
|
|
180
|
+
--html '<img src="cid:photo"><p>The family, 1938.</p>' --inline photo=./family.jpg
|
|
153
181
|
run402 email list --limit 50
|
|
154
182
|
run402 email info
|
|
155
183
|
run402 email get msg_abc123
|
|
@@ -178,7 +206,7 @@ const SUB_HELP = {
|
|
|
178
206
|
Usage:
|
|
179
207
|
run402 email send --to <email> --template <name> --var key=value [--var ...]
|
|
180
208
|
run402 email send --to <email> --template <name> --vars '{"k":"v",...}'
|
|
181
|
-
run402 email send --to <email> --subject "..." --html "..."
|
|
209
|
+
run402 email send --to <email> --subject "..." (--html "..." | --text "..." | both) [--attach <path> ...]
|
|
182
210
|
run402 email send --to <email> --bcc <email> [--bcc <email> ...] [mode flags]
|
|
183
211
|
|
|
184
212
|
Options:
|
|
@@ -189,13 +217,20 @@ Options:
|
|
|
189
217
|
notification
|
|
190
218
|
--var key=value Template variable (repeatable)
|
|
191
219
|
--vars '<json>' All template variables as a single JSON object
|
|
192
|
-
--subject "..." Subject line (raw
|
|
193
|
-
--html "..." HTML body (raw
|
|
194
|
-
--text "..." Plain-text body (raw
|
|
195
|
-
--attach <path>[:content-type] Attach a file (raw
|
|
196
|
-
max 100, each and all together ≤ 15 MB).
|
|
197
|
-
|
|
198
|
-
|
|
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.
|
|
228
|
+
--inline <content_id>=<path>[:content-type] An image shown inside the
|
|
229
|
+
html body where it says <img src="cid:<content_id>">
|
|
230
|
+
(repeatable). PNG, JPEG or GIF; without :content-type the
|
|
231
|
+
platform reads the type from the file. The html and the
|
|
232
|
+
inline images must agree, or the send is refused with
|
|
233
|
+
what to fix. Counts toward the attachment limits.
|
|
199
234
|
--from-name "..." Display name for the From header
|
|
200
235
|
--from <address> Send as this address (sent as from_address). Only the
|
|
201
236
|
domain's catch-all mailbox may send as a local part no
|
|
@@ -213,7 +248,7 @@ Usage:
|
|
|
213
248
|
reply: `run402 email reply — Reply to an inbound message (threaded via In-Reply-To)
|
|
214
249
|
|
|
215
250
|
Usage:
|
|
216
|
-
run402 email reply <message_id> --html "..."
|
|
251
|
+
run402 email reply <message_id> (--html "..." | --text "..." | both) [options]
|
|
217
252
|
`,
|
|
218
253
|
delete: `run402 email delete — Delete the project's mailbox (irreversible)
|
|
219
254
|
|
|
@@ -573,27 +608,6 @@ async function updateMailbox(args) {
|
|
|
573
608
|
message: "Use either positional <slug|id> or --mailbox, not both.",
|
|
574
609
|
});
|
|
575
610
|
}
|
|
576
|
-
if (footerPolicy == null && inboundPolicy == null && inboundAllowlistFlag == null) {
|
|
577
|
-
fail({
|
|
578
|
-
code: "BAD_USAGE",
|
|
579
|
-
message: "Pass --footer-policy, --inbound-policy, and/or --inbound-allowlist.",
|
|
580
|
-
hint: "run402 email update <slug|id> --inbound-policy allowlist --inbound-allowlist \"*@example.com\"",
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
if (footerPolicy != null && !["run402_transparency", "none"].includes(footerPolicy)) {
|
|
584
|
-
fail({
|
|
585
|
-
code: "BAD_USAGE",
|
|
586
|
-
message: "--footer-policy must be one of: run402_transparency, none.",
|
|
587
|
-
details: { footer_policy: footerPolicy },
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
if (inboundPolicy != null && !["reply_only", "allowlist", "open"].includes(inboundPolicy)) {
|
|
591
|
-
fail({
|
|
592
|
-
code: "BAD_USAGE",
|
|
593
|
-
message: "--inbound-policy must be one of: reply_only, allowlist, open.",
|
|
594
|
-
details: { inbound_policy: inboundPolicy },
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
611
|
|
|
598
612
|
try {
|
|
599
613
|
const data = await getSdk().email.updateMailbox(projectId, {
|
|
@@ -611,7 +625,7 @@ async function updateMailbox(args) {
|
|
|
611
625
|
}
|
|
612
626
|
|
|
613
627
|
async function send(args) {
|
|
614
|
-
const valueFlags = ["--template", "--to", "--bcc", "--subject", "--html", "--text", "--from-name", "--from", "--project", "--vars", "--var", "--mailbox", "--attach"];
|
|
628
|
+
const valueFlags = ["--template", "--to", "--bcc", "--subject", "--html", "--text", "--from-name", "--from", "--project", "--vars", "--var", "--mailbox", "--attach", "--inline"];
|
|
615
629
|
validateArgs(args, valueFlags);
|
|
616
630
|
const template = strictFlagValue(args, "--template");
|
|
617
631
|
const to = strictFlagValue(args, "--to");
|
|
@@ -623,7 +637,7 @@ async function send(args) {
|
|
|
623
637
|
const mailbox = strictFlagValue(args, "--mailbox");
|
|
624
638
|
const projectId = resolveProjectId(strictFlagValue(args, "--project"));
|
|
625
639
|
const variables = parseVars(args);
|
|
626
|
-
const attachments = parseAttachments(args);
|
|
640
|
+
const attachments = [...parseAttachments(args), ...parseInlineImages(args)];
|
|
627
641
|
const bcc = parseBcc(args);
|
|
628
642
|
|
|
629
643
|
if (!to) {
|
|
@@ -648,6 +662,7 @@ async function send(args) {
|
|
|
648
662
|
message_id: data.message_id,
|
|
649
663
|
to: data.to,
|
|
650
664
|
...(data.bcc ? { bcc: data.bcc } : {}),
|
|
665
|
+
...(data.attachments_meta ? { attachments_meta: data.attachments_meta } : {}),
|
|
651
666
|
template: data.template,
|
|
652
667
|
subject: data.subject,
|
|
653
668
|
status: data.status,
|
|
@@ -671,7 +686,7 @@ async function list(args) {
|
|
|
671
686
|
const direction = strictFlagValue(args, "--direction");
|
|
672
687
|
try {
|
|
673
688
|
const data = await getSdk().email.list(projectId, {
|
|
674
|
-
limit: limit ?
|
|
689
|
+
limit: limit ? parseIntegerArg("--limit", limit) : undefined,
|
|
675
690
|
after: after ?? undefined,
|
|
676
691
|
direction: direction ?? undefined,
|
|
677
692
|
mailbox: mailbox ?? undefined,
|
|
@@ -756,12 +771,6 @@ async function reply(args) {
|
|
|
756
771
|
hint: 'run402 email reply <message_id> --html "..."',
|
|
757
772
|
});
|
|
758
773
|
}
|
|
759
|
-
if (!html && !text) {
|
|
760
|
-
fail({
|
|
761
|
-
code: "BAD_USAGE",
|
|
762
|
-
message: "Provide --html and/or --text for the reply body",
|
|
763
|
-
});
|
|
764
|
-
}
|
|
765
774
|
|
|
766
775
|
try {
|
|
767
776
|
// Fetch the original message to derive the reply-to address and subject.
|
package/lib/errors.mjs
CHANGED
|
@@ -30,17 +30,16 @@ import { getSdk } from "./sdk.mjs";
|
|
|
30
30
|
import { reportSdkError, fail } from "./sdk-errors.mjs";
|
|
31
31
|
import {
|
|
32
32
|
assertKnownFlags,
|
|
33
|
-
assertAllowedValue,
|
|
34
33
|
flagValue,
|
|
35
34
|
normalizeArgv,
|
|
36
|
-
parseIntegerFlag,
|
|
37
35
|
positionalArgs,
|
|
38
36
|
failUnknownSubcommand,
|
|
37
|
+
parseIntegerArg,
|
|
39
38
|
} from "./argparse.mjs";
|
|
40
39
|
|
|
41
|
-
/** Wire `kind` vocabulary
|
|
40
|
+
/** Wire `kind` vocabulary, listed for --help; the gateway judges the value. */
|
|
42
41
|
export const KINDS = ["uncaught", "boot_crash", "invoke_failed", "handled_5xx"];
|
|
43
|
-
/** Wire `status` vocabulary
|
|
42
|
+
/** Wire `status` vocabulary, listed for --help; the gateway judges the value. */
|
|
44
43
|
export const STATUSES = ["open", "resolved", "ignored"];
|
|
45
44
|
/** The status actions, each a POST the gateway fences. */
|
|
46
45
|
const STATUS_ACTIONS = ["resolve", "ignore", "reopen"];
|
|
@@ -325,17 +324,11 @@ async function runErrors(mode, args) {
|
|
|
325
324
|
if (since != null) opts.since = since;
|
|
326
325
|
if (until != null) opts.until = until;
|
|
327
326
|
if (fn != null) opts.function = fn;
|
|
328
|
-
if (kind != null)
|
|
329
|
-
|
|
330
|
-
opts.kind = kind;
|
|
331
|
-
}
|
|
332
|
-
if (status != null) {
|
|
333
|
-
assertAllowedValue(status, STATUSES, "--status");
|
|
334
|
-
opts.status = status;
|
|
335
|
-
}
|
|
327
|
+
if (kind != null) opts.kind = kind;
|
|
328
|
+
if (status != null) opts.status = status;
|
|
336
329
|
if (fingerprint != null) opts.fingerprint = fingerprint;
|
|
337
330
|
if (newIn != null) opts.newIn = newIn;
|
|
338
|
-
if (limit != null) opts.limit =
|
|
331
|
+
if (limit != null) opts.limit = parseIntegerArg("--limit", limit);
|
|
339
332
|
if (cursor != null) opts.cursor = cursor;
|
|
340
333
|
|
|
341
334
|
let watchConfig = null;
|
package/lib/escalations.mjs
CHANGED
|
@@ -12,12 +12,12 @@ import {
|
|
|
12
12
|
normalizeArgv,
|
|
13
13
|
hasHelp,
|
|
14
14
|
assertKnownFlags,
|
|
15
|
-
assertAllowedValue,
|
|
16
15
|
parseIntegerFlag,
|
|
17
16
|
flagValue,
|
|
18
17
|
positionalArgs,
|
|
19
18
|
requirePositionalCount,
|
|
20
19
|
failUnknownSubcommand,
|
|
20
|
+
parseIntegerArg,
|
|
21
21
|
} from "./argparse.mjs";
|
|
22
22
|
import { resolveOrgId } from "./org-context.mjs";
|
|
23
23
|
|
|
@@ -91,7 +91,6 @@ async function raise(args) {
|
|
|
91
91
|
missing: "<reason>",
|
|
92
92
|
});
|
|
93
93
|
const severity = flagValue(a, "--severity");
|
|
94
|
-
if (severity) assertAllowedValue(severity, SEVERITY, "--severity");
|
|
95
94
|
|
|
96
95
|
try {
|
|
97
96
|
const orgId = await resolveOrgId(a);
|
|
@@ -160,13 +159,12 @@ async function list(args) {
|
|
|
160
159
|
min: 0, max: 0, command: "run402 escalations list", missing: "",
|
|
161
160
|
});
|
|
162
161
|
const status = flagValue(a, "--status");
|
|
163
|
-
if (status) assertAllowedValue(status, STATUS, "--status");
|
|
164
162
|
try {
|
|
165
163
|
const orgId = await resolveOrgId(a);
|
|
166
164
|
out(await getSdk().escalations.list(orgId, {
|
|
167
165
|
...(status ? { status } : {}),
|
|
168
166
|
...(flagValue(a, "--limit") != null
|
|
169
|
-
? { limit:
|
|
167
|
+
? { limit: parseIntegerArg("--limit", flagValue(a, "--limit")) }
|
|
170
168
|
: {}),
|
|
171
169
|
...(flagValue(a, "--cursor") ? { cursor: flagValue(a, "--cursor") } : {}),
|
|
172
170
|
}));
|
package/lib/events.mjs
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import { resolveProjectId } from "./config.mjs";
|
|
16
16
|
import { getSdk } from "./sdk.mjs";
|
|
17
17
|
import { reportSdkError, fail } from "./sdk-errors.mjs";
|
|
18
|
-
import {
|
|
18
|
+
import { assertKnownFlags, flagValue, normalizeArgv, positionalArgs, failUnknownSubcommand } from "./argparse.mjs";
|
|
19
19
|
|
|
20
20
|
/** Wire `source` vocabulary (mirrors the gateway's app/platform dichotomy). */
|
|
21
21
|
export const SOURCES = ["app", "platform"];
|
|
@@ -174,13 +174,11 @@ async function list(args) {
|
|
|
174
174
|
if (cursor != null) opts.cursor = cursor;
|
|
175
175
|
if (limit != null) opts.limit = Number(limit);
|
|
176
176
|
if (source != null) {
|
|
177
|
-
assertAllowedValue(source, SOURCES, "--source");
|
|
178
177
|
opts.source = source;
|
|
179
178
|
}
|
|
180
179
|
if (type != null) opts.eventType = type;
|
|
181
180
|
const minSeverity = flagValue(a, "--min-severity");
|
|
182
181
|
if (minSeverity != null) {
|
|
183
|
-
assertAllowedValue(minSeverity, SEVERITIES, "--min-severity");
|
|
184
182
|
opts.minSeverity = minSeverity;
|
|
185
183
|
}
|
|
186
184
|
|
package/lib/feedback.mjs
CHANGED
|
@@ -46,15 +46,6 @@ Examples:
|
|
|
46
46
|
run402 feedback send "promote: yes" --project prj_abc123 --handle @hobo_hi --return-address hobo@example.com
|
|
47
47
|
`;
|
|
48
48
|
|
|
49
|
-
// Cap message body at a Twitter-ish but engineer-generous size: enough for
|
|
50
|
-
// a few paragraphs and a stack-trace excerpt, small enough that a misbehaving
|
|
51
|
-
// agent script can't dump arbitrary content into the developer inbox in one
|
|
52
|
-
// call. UTF-8 bytes (not characters) — emoji and accented chars count as
|
|
53
|
-
// multiple bytes.
|
|
54
|
-
const MESSAGE_MAX_BYTES = 8192;
|
|
55
|
-
// Mirrors the gateway's bound on return_address.
|
|
56
|
-
const RETURN_ADDRESS_MAX_CHARS = 256;
|
|
57
|
-
|
|
58
49
|
const SUB_HELP = {
|
|
59
50
|
send: `run402 feedback send — Send feedback to the Run402 developers
|
|
60
51
|
|
|
@@ -113,35 +104,11 @@ async function send(args) {
|
|
|
113
104
|
if (!text) {
|
|
114
105
|
fail({ code: "BAD_USAGE", message: "Missing message text." });
|
|
115
106
|
}
|
|
116
|
-
//
|
|
117
|
-
// a structured size error instead of being masked by a missing-wallet
|
|
118
|
-
// exit.
|
|
107
|
+
// Reported back as bytes_sent; the size cap is the gateway's.
|
|
119
108
|
const bytes = Buffer.byteLength(text, "utf-8");
|
|
120
|
-
if (bytes > MESSAGE_MAX_BYTES) {
|
|
121
|
-
fail({
|
|
122
|
-
code: "MESSAGE_TOO_LONG",
|
|
123
|
-
message: `Message is ${bytes} bytes; maximum is ${MESSAGE_MAX_BYTES} bytes (~8 KB).`,
|
|
124
|
-
hint: "Trim or summarize the message.",
|
|
125
|
-
details: { bytes, max_bytes: MESSAGE_MAX_BYTES },
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
109
|
const projectId = flagValue(args, "--project");
|
|
129
110
|
const handle = flagValue(args, "--handle");
|
|
130
|
-
if (handle && handle.length > 64) {
|
|
131
|
-
fail({
|
|
132
|
-
code: "BAD_FLAG",
|
|
133
|
-
message: `--handle must be at most 64 characters, got ${handle.length}.`,
|
|
134
|
-
details: { flag: "--handle", length: handle.length, max: 64 },
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
111
|
const returnAddress = flagValue(args, "--return-address")?.trim();
|
|
138
|
-
if (returnAddress && returnAddress.length > RETURN_ADDRESS_MAX_CHARS) {
|
|
139
|
-
fail({
|
|
140
|
-
code: "BAD_FLAG",
|
|
141
|
-
message: `--return-address must be at most ${RETURN_ADDRESS_MAX_CHARS} characters, got ${returnAddress.length}.`,
|
|
142
|
-
details: { flag: "--return-address", length: returnAddress.length, max: RETURN_ADDRESS_MAX_CHARS },
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
112
|
// Preserve the aggressive early exit when no local wallet is configured.
|
|
146
113
|
walletAuthHeaders("/feedback/v1");
|
|
147
114
|
|
package/lib/functions.mjs
CHANGED
|
@@ -2,12 +2,10 @@ import { readFileSync } from "fs";
|
|
|
2
2
|
import { findProject, API } from "./config.mjs";
|
|
3
3
|
import { getSdk } from "./sdk.mjs";
|
|
4
4
|
import { reportSdkError, fail } from "./sdk-errors.mjs";
|
|
5
|
-
import { assertKnownFlags, hasHelp, normalizeArgv, parseIntegerFlag, resolveProjectSelector, validateRegularFile, failUnknownSubcommand } from "./argparse.mjs";
|
|
5
|
+
import { assertKnownFlags, hasHelp, normalizeArgv, parseIntegerArg, parseIntegerFlag, resolveProjectSelector, validateRegularFile, failUnknownSubcommand } from "./argparse.mjs";
|
|
6
6
|
import { cliCommandAction } from "./next-actions.mjs";
|
|
7
7
|
|
|
8
|
-
export const FUNCTION_LOG_REQUEST_ID_RE = /^(?:req|fnrun|fnatt)_[A-Za-z0-9_-]{4,128}$/;
|
|
9
8
|
const ISO_DATE_TIME_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
10
|
-
export const FUNCTION_LOG_TAIL_MAX = 1000;
|
|
11
9
|
|
|
12
10
|
// Shared by `run402 functions logs` and the top-level `run402 logs` shortcut
|
|
13
11
|
// (cli/lib/logs.mjs) so the two commands validate identically.
|
|
@@ -31,17 +29,6 @@ export function parseLogSinceFlag(since, flag = "--since") {
|
|
|
31
29
|
return new Date(ms).toISOString();
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
/** `--request-id <request_id>` must be a req_ / fnrun_ / fnatt_ correlation id. */
|
|
35
|
-
export function assertLogRequestIdFlag(requestId) {
|
|
36
|
-
if (requestId !== undefined && !FUNCTION_LOG_REQUEST_ID_RE.test(requestId)) {
|
|
37
|
-
fail({
|
|
38
|
-
code: "BAD_USAGE",
|
|
39
|
-
message: `Invalid --request-id value: ${requestId}`,
|
|
40
|
-
details: { flag: "--request-id", value: requestId, expected: "req_|fnrun_|fnatt_ + 4-128 url-safe chars" },
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
32
|
/**
|
|
46
33
|
* `--app` (default) / `--platform` / `--all` → the SDK origin filter. Lambda
|
|
47
34
|
* runtime lines (INIT_START / START / END / REPORT …) are `platform`; the
|
|
@@ -437,8 +424,8 @@ async function deploy(projectId, name, args) {
|
|
|
437
424
|
const opts = { file: null, timeout: undefined, memory: undefined, deps: undefined, schedule: undefined, timezone: undefined };
|
|
438
425
|
for (let i = 0; i < args.length; i++) {
|
|
439
426
|
if (args[i] === "--file" && args[i + 1]) opts.file = args[++i];
|
|
440
|
-
if (args[i] === "--timeout") opts.timeout =
|
|
441
|
-
if (args[i] === "--memory") opts.memory =
|
|
427
|
+
if (args[i] === "--timeout") opts.timeout = parseIntegerArg("--timeout", args[++i]);
|
|
428
|
+
if (args[i] === "--memory") opts.memory = parseIntegerArg("--memory", args[++i]);
|
|
442
429
|
if (args[i] === "--deps" && args[i + 1]) opts.deps = parseDepsFlag(args[++i]);
|
|
443
430
|
if (args[i] === "--schedule" && i + 1 < args.length) opts.schedule = args[++i];
|
|
444
431
|
if (args[i] === "--timezone" && args[i + 1]) opts.timezone = args[++i];
|
|
@@ -569,7 +556,7 @@ async function logs(projectId, name, args) {
|
|
|
569
556
|
let requestId = undefined;
|
|
570
557
|
let follow = false;
|
|
571
558
|
for (let i = 0; i < args.length; i++) {
|
|
572
|
-
if (args[i] === "--tail") tail =
|
|
559
|
+
if (args[i] === "--tail") tail = parseIntegerArg("--tail", args[++i]);
|
|
573
560
|
if (args[i] === "--since" && args[i + 1]) since = args[++i];
|
|
574
561
|
if (args[i] === "--until" && args[i + 1]) until = args[++i];
|
|
575
562
|
if (args[i] === "--request-id" && args[i + 1]) requestId = args[++i];
|
|
@@ -577,11 +564,10 @@ async function logs(projectId, name, args) {
|
|
|
577
564
|
}
|
|
578
565
|
const origin = resolveLogOriginFlag(args);
|
|
579
566
|
|
|
580
|
-
//
|
|
581
|
-
//
|
|
567
|
+
// `--since` / `--until` are parsed here (ISO or epoch ms → ISO); the request
|
|
568
|
+
// id passes through as given and the gateway judges it.
|
|
582
569
|
let sinceIso = parseLogSinceFlag(since);
|
|
583
570
|
const untilIso = parseLogSinceFlag(until, "--until");
|
|
584
|
-
assertLogRequestIdFlag(requestId);
|
|
585
571
|
if (follow && untilIso !== undefined) {
|
|
586
572
|
fail({ code: "BAD_USAGE", message: "--until reads a past window; --follow streams new entries. Pass one.", details: { flag: "--until" } });
|
|
587
573
|
}
|
|
@@ -775,7 +761,7 @@ async function runsCreate(projectId, name, args) {
|
|
|
775
761
|
if (args[i] === "--expires-at") opts.expiresAt = args[++i];
|
|
776
762
|
if (args[i] === "--expires-after") opts.expiresAfter = args[++i];
|
|
777
763
|
if (args[i] === "--retry-preset") opts.retry = { ...(opts.retry || {}), preset: args[++i] };
|
|
778
|
-
if (args[i] === "--max-attempts") opts.retry = { ...(opts.retry || {}), maxAttempts:
|
|
764
|
+
if (args[i] === "--max-attempts") opts.retry = { ...(opts.retry || {}), maxAttempts: parseIntegerArg("--max-attempts", args[++i]) };
|
|
779
765
|
if (args[i] === "--wait") wait = true;
|
|
780
766
|
if (args[i] === "--timeout-ms") waitOpts.timeoutMs = parseIntegerFlag("--timeout-ms", args[++i], { min: 1 });
|
|
781
767
|
if (args[i] === "--poll-interval-ms") waitOpts.intervalMs = parseIntegerFlag("--poll-interval-ms", args[++i], { min: 0 });
|
|
@@ -804,7 +790,7 @@ async function runsList(projectId, name, args) {
|
|
|
804
790
|
if (args[i] === "--event-type") opts.eventType = args[++i];
|
|
805
791
|
if (args[i] === "--since") opts.since = args[++i];
|
|
806
792
|
if (args[i] === "--until") opts.until = args[++i];
|
|
807
|
-
if (args[i] === "--limit") opts.limit =
|
|
793
|
+
if (args[i] === "--limit") opts.limit = parseIntegerArg("--limit", args[++i]);
|
|
808
794
|
if (args[i] === "--cursor") opts.cursor = args[++i];
|
|
809
795
|
}
|
|
810
796
|
try {
|
|
@@ -835,7 +821,7 @@ async function runsLogs(projectId, runId, args) {
|
|
|
835
821
|
assertNoUnexpectedPositionals(args, valueFlags, "run402 functions runs logs <project_id> <run_id>");
|
|
836
822
|
const opts = {};
|
|
837
823
|
for (let i = 0; i < args.length; i++) {
|
|
838
|
-
if (args[i] === "--tail") opts.tail =
|
|
824
|
+
if (args[i] === "--tail") opts.tail = parseIntegerArg("--tail", args[++i]);
|
|
839
825
|
if (args[i] === "--since") opts.since = args[++i];
|
|
840
826
|
}
|
|
841
827
|
try {
|
|
@@ -869,7 +855,7 @@ async function runsRedrive(projectId, runId, args) {
|
|
|
869
855
|
const waitOpts = {};
|
|
870
856
|
for (let i = 0; i < args.length; i++) {
|
|
871
857
|
if (args[i] === "--retry-preset") opts.retry = { ...(opts.retry || {}), preset: args[++i] };
|
|
872
|
-
if (args[i] === "--max-attempts") opts.retry = { ...(opts.retry || {}), maxAttempts:
|
|
858
|
+
if (args[i] === "--max-attempts") opts.retry = { ...(opts.retry || {}), maxAttempts: parseIntegerArg("--max-attempts", args[++i]) };
|
|
873
859
|
if (args[i] === "--wait") wait = true;
|
|
874
860
|
if (args[i] === "--timeout-ms") waitOpts.timeoutMs = parseIntegerFlag("--timeout-ms", args[++i], { min: 1 });
|
|
875
861
|
if (args[i] === "--poll-interval-ms") waitOpts.intervalMs = parseIntegerFlag("--poll-interval-ms", args[++i], { min: 0 });
|
|
@@ -921,8 +907,8 @@ async function update(projectId, name, args) {
|
|
|
921
907
|
if (args[i] === "--schedule" && i + 1 < args.length) schedule = args[++i];
|
|
922
908
|
if (args[i] === "--timezone" && args[i + 1]) timezone = args[++i];
|
|
923
909
|
if (args[i] === "--schedule-remove") scheduleRemove = true;
|
|
924
|
-
if (args[i] === "--timeout") timeout =
|
|
925
|
-
if (args[i] === "--memory") memory =
|
|
910
|
+
if (args[i] === "--timeout") timeout = parseIntegerArg("--timeout", args[++i]);
|
|
911
|
+
if (args[i] === "--memory") memory = parseIntegerArg("--memory", args[++i]);
|
|
926
912
|
}
|
|
927
913
|
if (scheduleRemove && schedule !== undefined) {
|
|
928
914
|
fail({
|
package/lib/grants.mjs
CHANGED
|
@@ -158,13 +158,6 @@ async function create(args) {
|
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
if (kind && kind !== "run402_agent_key") {
|
|
162
|
-
fail({
|
|
163
|
-
code: "BAD_USAGE",
|
|
164
|
-
message: `--kind ${kind} is not a kind a grant key can be minted as. The only kind is run402_agent_key (the default).`,
|
|
165
|
-
hint: "Drop --kind. For a CI binding use: run402 ci link",
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
161
|
const policy = policyRaw != null ? parseFlagJson("--policy", policyRaw) : undefined;
|
|
169
162
|
let key;
|
|
170
163
|
if (wantsKey) {
|
package/lib/identity.mjs
CHANGED
|
@@ -48,9 +48,6 @@ function readRawEvent(args) {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
const bytes = useStdin ? readFileSync(0) : readFileSync(eventFile);
|
|
51
|
-
if (bytes.byteLength > 32 * 1024) {
|
|
52
|
-
fail({ code: "IDENTITY_LINK_INVALID_JSON", message: "Raw Nostr event exceeds the 32768-byte protocol limit" });
|
|
53
|
-
}
|
|
54
51
|
try { return new TextDecoder("utf-8", { fatal: true }).decode(bytes); }
|
|
55
52
|
catch {
|
|
56
53
|
fail({ code: "IDENTITY_LINK_INVALID_UTF8", message: "Raw Nostr event must be valid UTF-8 JSON" });
|
|
@@ -64,13 +61,10 @@ async function begin(args) {
|
|
|
64
61
|
requirePositionalCount(a, values, { min: 0, max: 0, command: "run402 identity link nostr begin --pubkey <npub|hex> --visibility public" });
|
|
65
62
|
const pubkey = requiredFlag(a, "--pubkey");
|
|
66
63
|
const visibility = requiredFlag(a, "--visibility");
|
|
67
|
-
if (visibility !== "public") {
|
|
68
|
-
fail({ code: "IDENTITY_LINK_PUBLIC_VISIBILITY_REQUIRED", message: "--visibility must be exactly public; there is no private/default identity-link mode" });
|
|
69
|
-
}
|
|
70
64
|
try {
|
|
71
65
|
const result = await getSdk({ authMode: "wallet" }).identityLinks.nostr.begin({
|
|
72
66
|
nostrPubkey: pubkey,
|
|
73
|
-
visibility
|
|
67
|
+
visibility,
|
|
74
68
|
idempotencyKey: flagValue(a, "--idempotency-key") ?? undefined,
|
|
75
69
|
});
|
|
76
70
|
console.log(JSON.stringify(result, null, 2));
|
package/lib/image.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { writeFileSync } from "fs";
|
|
2
2
|
import { getSdk } from "./sdk.mjs";
|
|
3
3
|
import { reportSdkError, fail } from "./sdk-errors.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { assertKnownFlags, flagValue, normalizeArgv, positionalArgs, failUnknownSubcommand } from "./argparse.mjs";
|
|
5
5
|
import { resolveOrg } from "./org-context.mjs";
|
|
6
6
|
import { nextAction } from "./next-actions.mjs";
|
|
7
7
|
|
|
@@ -108,7 +108,6 @@ export async function run(sub, args) {
|
|
|
108
108
|
hint: 'run402 image generate "your prompt"',
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
-
assertAllowedValue(opts.aspect, ["square", "landscape", "portrait"], "--aspect");
|
|
112
111
|
|
|
113
112
|
// The paying organization rides the ONE shared org chain (--org, then
|
|
114
113
|
// RUN402_ORG / RUN402_ROOM / RUN402_PROJECT_ID, then the .run402.json
|
package/lib/init.mjs
CHANGED
|
@@ -202,9 +202,6 @@ export async function run(args = []) {
|
|
|
202
202
|
const parsedName = parseValueFlag(args, "--name");
|
|
203
203
|
args = parsedName.args;
|
|
204
204
|
const displayName = parsedName.value;
|
|
205
|
-
if (displayName !== undefined && displayName.trim() === "") {
|
|
206
|
-
fail({ code: "BAD_USAGE", message: "--name requires a non-empty value.", details: { flag: "--name" } });
|
|
207
|
-
}
|
|
208
205
|
|
|
209
206
|
const onLine = (line) => console.error(line);
|
|
210
207
|
const parsedApiBase = parseApiBaseFlag(args);
|
package/lib/jobs.mjs
CHANGED
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
assertKnownFlags,
|
|
11
11
|
flagValue,
|
|
12
12
|
normalizeArgv,
|
|
13
|
-
parseIntegerFlag,
|
|
14
13
|
positionalArgs,
|
|
15
14
|
requirePositionalCount,
|
|
16
15
|
validateRegularFile,
|
|
17
16
|
failUnknownSubcommand,
|
|
17
|
+
parseIntegerArg,
|
|
18
18
|
} from "./argparse.mjs";
|
|
19
19
|
|
|
20
20
|
const HELP = `run402 jobs — Submit and inspect platform-managed jobs
|
|
@@ -274,7 +274,7 @@ async function logs(jobId, args = []) {
|
|
|
274
274
|
const opts = {};
|
|
275
275
|
const tail = flagValue(parsed, "--tail");
|
|
276
276
|
const since = flagValue(parsed, "--since");
|
|
277
|
-
if (tail !== null) opts.tail =
|
|
277
|
+
if (tail !== null) opts.tail = parseIntegerArg("--tail", tail);
|
|
278
278
|
if (since !== null) opts.since = parseSinceIsoFlag("--since", since);
|
|
279
279
|
|
|
280
280
|
try {
|
package/lib/logs.mjs
CHANGED
|
@@ -21,10 +21,8 @@
|
|
|
21
21
|
import { getSdk } from "./sdk.mjs";
|
|
22
22
|
import { getActiveProjectId } from "./config.mjs";
|
|
23
23
|
import { reportSdkError, fail } from "./sdk-errors.mjs";
|
|
24
|
-
import { assertKnownFlags, flagValue, normalizeArgv,
|
|
24
|
+
import { assertKnownFlags, flagValue, normalizeArgv, parseIntegerArg, positionalArgs } from "./argparse.mjs";
|
|
25
25
|
import {
|
|
26
|
-
FUNCTION_LOG_TAIL_MAX,
|
|
27
|
-
assertLogRequestIdFlag,
|
|
28
26
|
parseLogSinceFlag,
|
|
29
27
|
platformHiddenHint,
|
|
30
28
|
resolveLogOriginFlag,
|
|
@@ -131,7 +129,6 @@ export async function run(sub, args = []) {
|
|
|
131
129
|
hint: "Pass the request id from the 'x-run402-request-id' response header.",
|
|
132
130
|
});
|
|
133
131
|
}
|
|
134
|
-
assertLogRequestIdFlag(requestId);
|
|
135
132
|
|
|
136
133
|
const projectId = projectIdArg ?? process.env.RUN402_PROJECT_ID ?? getActiveProjectId() ?? undefined;
|
|
137
134
|
if (!projectId) {
|
|
@@ -142,7 +139,7 @@ export async function run(sub, args = []) {
|
|
|
142
139
|
});
|
|
143
140
|
}
|
|
144
141
|
|
|
145
|
-
const tail =
|
|
142
|
+
const tail = parseIntegerArg("--tail", tailArg, { def: 100 });
|
|
146
143
|
const since = parseLogSinceFlag(sinceArg);
|
|
147
144
|
const until = parseLogSinceFlag(untilArg, "--until");
|
|
148
145
|
|