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
|
@@ -3,7 +3,6 @@ import { dirname, extname, isAbsolute, join, resolve as resolvePath, } from "nod
|
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
import { LocalError } from "../errors.js";
|
|
6
|
-
import { ROUTE_HTTP_METHODS } from "../namespaces/deploy.types.js";
|
|
7
6
|
function isLocalDirRef(value) {
|
|
8
7
|
return (typeof value === "object" &&
|
|
9
8
|
value !== null &&
|
|
@@ -111,6 +110,7 @@ export function manifestFileMissingError(missing, opts = {}) {
|
|
|
111
110
|
(rest > 0 ? ` and ${rest} more` : "") +
|
|
112
111
|
"."
|
|
113
112
|
: "Manifest references files that do not exist.";
|
|
113
|
+
// local-check: local_state — manifest names local files that do not exist
|
|
114
114
|
return new LocalError(message, "checking manifest file references", {
|
|
115
115
|
code: "MANIFEST_FILE_MISSING",
|
|
116
116
|
details: {
|
|
@@ -165,6 +165,7 @@ export function manifestNotFoundError(path, context) {
|
|
|
165
165
|
},
|
|
166
166
|
},
|
|
167
167
|
};
|
|
168
|
+
// local-check: local_state — manifest path does not exist locally
|
|
168
169
|
return new LocalError(`Manifest not found: ${path}. Check the --manifest path (it is resolved against the current directory) or create the file.`, context, {
|
|
169
170
|
code: "MANIFEST_NOT_FOUND",
|
|
170
171
|
details: { path },
|
|
@@ -289,7 +290,6 @@ const MANIFEST_ROUTE_ENTRY_FIELDS = new Set(["pattern", "methods", "target", "pr
|
|
|
289
290
|
const MANIFEST_FUNCTION_ROUTE_TARGET_FIELDS = new Set(["type", "name"]);
|
|
290
291
|
const MANIFEST_STATIC_ROUTE_TARGET_FIELDS = new Set(["type", "file"]);
|
|
291
292
|
const MANIFEST_REPO_ROUTE_TARGET_FIELDS = new Set(["type", "repo", "path", "requireAuth", "require_auth", "requireRole", "require_role"]);
|
|
292
|
-
const ROUTE_METHOD_SET = new Set(ROUTE_HTTP_METHODS);
|
|
293
293
|
const DATA_MANIFEST_EXTENSIONS = new Set([".json"]);
|
|
294
294
|
const EXECUTABLE_MANIFEST_EXTENSIONS = new Set([".ts", ".mts", ".cts", ".js", ".mjs", ".cjs"]);
|
|
295
295
|
const TYPESCRIPT_MANIFEST_EXTENSIONS = new Set([".ts", ".mts", ".cts"]);
|
|
@@ -323,6 +323,7 @@ export async function loadDeployManifest(path, opts = {}) {
|
|
|
323
323
|
: { ...normalized, manifestPath };
|
|
324
324
|
}
|
|
325
325
|
if (!DATA_MANIFEST_EXTENSIONS.has(extension)) {
|
|
326
|
+
// local-check: local_state — local manifest file extension unsupported
|
|
326
327
|
throw new LocalError(`Unsupported deploy manifest extension '${extension || "(none)"}'. Use .json for data manifests or pass an explicit .ts/.js executable config.`, "loading deploy manifest", {
|
|
327
328
|
code: "UNSUPPORTED_DEPLOY_MANIFEST_EXTENSION",
|
|
328
329
|
details: { path, extension },
|
|
@@ -335,6 +336,7 @@ export async function loadDeployManifest(path, opts = {}) {
|
|
|
335
336
|
catch (err) {
|
|
336
337
|
if (isMissingFileError(err))
|
|
337
338
|
throw manifestNotFoundError(manifestPath, "loading deploy manifest");
|
|
339
|
+
// local-check: local_state — local manifest file unreadable
|
|
338
340
|
throw new LocalError(`Failed to read deploy manifest '${path}': ${err.message}`, "loading deploy manifest", err);
|
|
339
341
|
}
|
|
340
342
|
let parsed;
|
|
@@ -342,6 +344,7 @@ export async function loadDeployManifest(path, opts = {}) {
|
|
|
342
344
|
parsed = JSON.parse(raw);
|
|
343
345
|
}
|
|
344
346
|
catch (err) {
|
|
347
|
+
// local-check: local_state — local manifest file is not JSON
|
|
345
348
|
throw new LocalError(`Deploy manifest is not valid JSON: ${err.message}`, "parsing deploy manifest", err);
|
|
346
349
|
}
|
|
347
350
|
const normalized = await normalizeDeployManifest(parsed, {
|
|
@@ -355,6 +358,7 @@ export async function loadExecutableDeployConfig(path, opts = {}) {
|
|
|
355
358
|
const manifestPath = isAbsolute(path) ? path : resolvePath(process.cwd(), path);
|
|
356
359
|
const extension = extname(manifestPath).toLowerCase();
|
|
357
360
|
if (!EXECUTABLE_MANIFEST_EXTENSIONS.has(extension)) {
|
|
361
|
+
// local-check: local_state — local executable config has the wrong extension
|
|
358
362
|
throw new LocalError(`Executable deploy config must use .ts, .mts, .cts, .js, .mjs, or .cjs; got '${extension || "(none)"}'.`, "loading executable deploy config", {
|
|
359
363
|
code: "UNSUPPORTED_EXECUTABLE_CONFIG_EXTENSION",
|
|
360
364
|
details: { path, extension },
|
|
@@ -381,6 +385,7 @@ export async function loadExecutableDeployConfig(path, opts = {}) {
|
|
|
381
385
|
`4.11.1 (its exports map had no require/default conditions). Fix either side: ` +
|
|
382
386
|
`upgrade @run402/sdk to >=4.11.1, or add "type": "module" to package.json.`;
|
|
383
387
|
}
|
|
388
|
+
// local-check: local_state — local executable config failed to load
|
|
384
389
|
throw new LocalError(message, "loading executable deploy config", {
|
|
385
390
|
cause: err,
|
|
386
391
|
code: "EXECUTABLE_CONFIG_LOAD_FAILED",
|
|
@@ -389,6 +394,7 @@ export async function loadExecutableDeployConfig(path, opts = {}) {
|
|
|
389
394
|
}
|
|
390
395
|
const exported = resolveExecutableConfigExport(mod);
|
|
391
396
|
if (exported === undefined) {
|
|
397
|
+
// local-check: local_state — local executable config has no usable export
|
|
392
398
|
throw new LocalError("Executable deploy config must export a default config object or a named `config` export.", "loading executable deploy config", {
|
|
393
399
|
code: "EXECUTABLE_CONFIG_INVALID_EXPORT",
|
|
394
400
|
details: { path, exports: Object.keys(mod).sort() },
|
|
@@ -409,6 +415,7 @@ export async function loadExecutableDeployConfig(path, opts = {}) {
|
|
|
409
415
|
catch (err) {
|
|
410
416
|
if (err instanceof LocalError)
|
|
411
417
|
throw err;
|
|
418
|
+
// local-check: local_state — local executable config threw while evaluating
|
|
412
419
|
throw new LocalError(`Executable deploy config '${path}' failed while evaluating: ${err.message}`, "loading executable deploy config", {
|
|
413
420
|
cause: err,
|
|
414
421
|
code: "EXECUTABLE_CONFIG_EVALUATION_FAILED",
|
|
@@ -416,6 +423,7 @@ export async function loadExecutableDeployConfig(path, opts = {}) {
|
|
|
416
423
|
});
|
|
417
424
|
}
|
|
418
425
|
if (!isRecord(value) || Array.isArray(value)) {
|
|
426
|
+
// local-check: local_state — local executable config did not resolve to an object
|
|
419
427
|
throw new LocalError("Executable deploy config export must resolve to an object.", "loading executable deploy config", {
|
|
420
428
|
code: "EXECUTABLE_CONFIG_INVALID_EXPORT",
|
|
421
429
|
details: { path, received: typeof value },
|
|
@@ -457,6 +465,7 @@ function createConfigEnv(source) {
|
|
|
457
465
|
return (name) => {
|
|
458
466
|
const value = read(name);
|
|
459
467
|
if (value === undefined || value === "") {
|
|
468
|
+
// local-check: local_state — required environment variable is unset
|
|
460
469
|
throw new LocalError(`Required environment variable ${name} is not set.`, "evaluating executable deploy config", {
|
|
461
470
|
code: "CONFIG_ENV_REQUIRED",
|
|
462
471
|
details: { name },
|
|
@@ -532,6 +541,7 @@ export async function normalizeDeployManifest(input, opts = {}) {
|
|
|
532
541
|
}
|
|
533
542
|
const VERIFY_HINT = 'Minimal valid shape: "verify": { "http": [{ "id": "home", "path": "/", "expect": { "status": 200 } }] }';
|
|
534
543
|
function verifyError(message, field) {
|
|
544
|
+
// local-check: sdk_normalization — verify is the SDK's own post-deploy check, never sent
|
|
535
545
|
return new LocalError(message, CONTEXT, {
|
|
536
546
|
code: "INVALID_VERIFY_SPEC",
|
|
537
547
|
details: { field, hint: VERIFY_HINT },
|
|
@@ -627,10 +637,12 @@ function resolveProject(manifest, opts) {
|
|
|
627
637
|
if (opts.project !== undefined &&
|
|
628
638
|
manifestProject !== undefined &&
|
|
629
639
|
opts.project !== manifestProject) {
|
|
640
|
+
// local-check: argument — override and manifest name different projects
|
|
630
641
|
throw new LocalError(`project conflict: manifest project_id=${manifestProject} but override project=${opts.project}`, CONTEXT);
|
|
631
642
|
}
|
|
632
643
|
const project = opts.project ?? manifestProject ?? opts.defaultProject;
|
|
633
644
|
if (!project) {
|
|
645
|
+
// local-check: argument — project id needed to build the request
|
|
634
646
|
throw new LocalError("Deploy manifest requires project_id. Pass a project override or set a default project before normalizing.", CONTEXT);
|
|
635
647
|
}
|
|
636
648
|
return project;
|
|
@@ -653,6 +665,7 @@ async function mapDatabase(database, opts) {
|
|
|
653
665
|
}
|
|
654
666
|
if (raw.migrations !== undefined) {
|
|
655
667
|
if (!Array.isArray(raw.migrations)) {
|
|
668
|
+
// local-check: sdk_normalization — the SDK iterates migrations to read sql files
|
|
656
669
|
throw new LocalError("Deploy manifest database.migrations must be an array", CONTEXT);
|
|
657
670
|
}
|
|
658
671
|
out.migrations = [];
|
|
@@ -670,27 +683,28 @@ async function mapMigration(migration, opts, index, seenNames) {
|
|
|
670
683
|
const hasName = Object.prototype.hasOwnProperty.call(migration, "name") && migration.name !== undefined;
|
|
671
684
|
const label = migrationLabel(migration, index);
|
|
672
685
|
if (hasId && hasName) {
|
|
686
|
+
// local-check: sdk_normalization — migration name is SDK-only, lowered to an id
|
|
673
687
|
throw new LocalError(`${label} declares both id and name; use exactly one`, CONTEXT);
|
|
674
688
|
}
|
|
675
689
|
if (!hasId && !hasName) {
|
|
690
|
+
// local-check: sdk_normalization — migration name is SDK-only, lowered to an id
|
|
676
691
|
throw new LocalError(`${label} must declare exactly one of id or name`, CONTEXT);
|
|
677
692
|
}
|
|
678
693
|
let out;
|
|
679
694
|
if (hasName) {
|
|
680
695
|
if (typeof migration.name !== "string" || !MIGRATION_NAME_RE.test(migration.name)) {
|
|
696
|
+
// local-check: sdk_normalization — migration name is SDK-only, lowered to an id
|
|
681
697
|
throw new LocalError(`${label}.name must match /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/`, CONTEXT);
|
|
682
698
|
}
|
|
683
699
|
const firstIndex = seenNames.get(migration.name);
|
|
684
700
|
if (firstIndex !== undefined) {
|
|
701
|
+
// local-check: sdk_normalization — migration name is SDK-only, lowered to an id
|
|
685
702
|
throw new LocalError(`${label}.name duplicates database.migrations[${firstIndex}].name ${JSON.stringify(migration.name)}`, CONTEXT);
|
|
686
703
|
}
|
|
687
704
|
seenNames.set(migration.name, index);
|
|
688
705
|
out = { name: migration.name };
|
|
689
706
|
}
|
|
690
707
|
else {
|
|
691
|
-
if (typeof migration.id !== "string" || migration.id.trim() === "") {
|
|
692
|
-
throw new LocalError(`${label}.id must be a non-empty string`, CONTEXT);
|
|
693
|
-
}
|
|
694
708
|
out = { id: migration.id };
|
|
695
709
|
}
|
|
696
710
|
if (migration.sql !== undefined)
|
|
@@ -705,6 +719,7 @@ async function mapMigration(migration, opts, index, seenNames) {
|
|
|
705
719
|
if (migration.sql_path !== undefined &&
|
|
706
720
|
migration.sql_file !== undefined &&
|
|
707
721
|
migration.sql_path !== migration.sql_file) {
|
|
722
|
+
// local-check: sdk_normalization — sql_path and sql_file are the SDK's own aliases
|
|
708
723
|
throw new LocalError(`${label} has both sql_path and sql_file with different values`, CONTEXT);
|
|
709
724
|
}
|
|
710
725
|
if (out.sql === undefined && sqlPath !== undefined) {
|
|
@@ -718,6 +733,7 @@ async function mapMigration(migration, opts, index, seenNames) {
|
|
|
718
733
|
const typed = manifestFileMissingError([
|
|
719
734
|
{ field_path: `database.migrations[${index}].${field}`, path: abs, kind: "migration_sql" },
|
|
720
735
|
]);
|
|
736
|
+
// local-check: local_state — local migration sql file is missing
|
|
721
737
|
throw new LocalError(`Failed to read migration ${field} '${sqlPath}' for ${label}: ${typed.message}`, CONTEXT, {
|
|
722
738
|
cause: err,
|
|
723
739
|
code: "MANIFEST_FILE_MISSING",
|
|
@@ -725,6 +741,7 @@ async function mapMigration(migration, opts, index, seenNames) {
|
|
|
725
741
|
next_actions: typed.nextActions,
|
|
726
742
|
});
|
|
727
743
|
}
|
|
744
|
+
// local-check: local_state — local migration sql file unreadable
|
|
728
745
|
throw new LocalError(`Failed to read migration ${field} '${sqlPath}' for ${label}: ${err.message}`, CONTEXT, err);
|
|
729
746
|
}
|
|
730
747
|
}
|
|
@@ -758,12 +775,8 @@ function mapFunctions(functions, opts) {
|
|
|
758
775
|
assertPlainRecord(patch.set, "Deploy manifest functions.patch.set");
|
|
759
776
|
out.patch.set = mapFunctionMap(patch.set, opts);
|
|
760
777
|
}
|
|
761
|
-
if (patch.delete !== undefined)
|
|
762
|
-
if (!Array.isArray(patch.delete)) {
|
|
763
|
-
throw new LocalError("Deploy manifest functions.patch.delete must be an array", CONTEXT);
|
|
764
|
-
}
|
|
778
|
+
if (patch.delete !== undefined)
|
|
765
779
|
out.patch.delete = patch.delete;
|
|
766
|
-
}
|
|
767
780
|
}
|
|
768
781
|
return out;
|
|
769
782
|
}
|
|
@@ -827,6 +840,7 @@ function mapFunction(fn, opts) {
|
|
|
827
840
|
// validates each entry); left out, a deploy reads the function's source.
|
|
828
841
|
if (raw.tools !== undefined) {
|
|
829
842
|
if (!Array.isArray(raw.tools)) {
|
|
843
|
+
// local-check: sdk_normalization — the SDK maps tool entries and decides whether to read source
|
|
830
844
|
throw new LocalError("Deploy manifest function tools must be an array of tool entries", CONTEXT);
|
|
831
845
|
}
|
|
832
846
|
out.tools = raw.tools.map((tool) => (tool && typeof tool === "object" && !Array.isArray(tool) ? { ...tool } : tool));
|
|
@@ -844,10 +858,9 @@ function mapFunction(fn, opts) {
|
|
|
844
858
|
if (raw.class !== undefined)
|
|
845
859
|
out.class = raw.class;
|
|
846
860
|
if (rawRecord.capabilities !== undefined) {
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
out.capabilities = [...rawRecord.capabilities];
|
|
861
|
+
out.capabilities = (Array.isArray(rawRecord.capabilities)
|
|
862
|
+
? [...rawRecord.capabilities]
|
|
863
|
+
: rawRecord.capabilities);
|
|
851
864
|
}
|
|
852
865
|
return out;
|
|
853
866
|
}
|
|
@@ -880,6 +893,7 @@ async function importConfigModule(manifestPath, extension) {
|
|
|
880
893
|
const reason = nativeError
|
|
881
894
|
? `Node's type stripping could not load it (${nativeError.message})`
|
|
882
895
|
: `this Node (${process.version}) has no built-in type stripping`;
|
|
896
|
+
// local-check: local_state — no local TypeScript loader for the config
|
|
883
897
|
throw new LocalError(`TypeScript deploy config '${manifestPath}' needs a TypeScript loader: ${reason}. Install tsx in the project (npm install --save-dev tsx), or use Node 22.18 or later with a config that only uses erasable types.`, "loading executable deploy config", {
|
|
884
898
|
cause: nativeError,
|
|
885
899
|
code: "EXECUTABLE_CONFIG_TS_LOADER_UNAVAILABLE",
|
|
@@ -1001,6 +1015,7 @@ async function withConfigTimeout(promise, path, timeoutMs) {
|
|
|
1001
1015
|
promise,
|
|
1002
1016
|
new Promise((_resolve, reject) => {
|
|
1003
1017
|
timer = setTimeout(() => {
|
|
1018
|
+
// local-check: local_state — local executable config timed out
|
|
1004
1019
|
reject(new LocalError(`Executable deploy config '${path}' did not finish within ${timeoutMs}ms.`, "loading executable deploy config", {
|
|
1005
1020
|
code: "EXECUTABLE_CONFIG_TIMEOUT",
|
|
1006
1021
|
details: { path, timeout_ms: timeoutMs },
|
|
@@ -1035,6 +1050,7 @@ function assertNoUnsupportedTypeScriptFunctionSources(value, resource) {
|
|
|
1035
1050
|
continue;
|
|
1036
1051
|
const extension = extname(source.path).toLowerCase();
|
|
1037
1052
|
if (TYPESCRIPT_FUNCTION_EXTENSIONS.has(extension)) {
|
|
1053
|
+
// local-check: local_state — local function source is unbundled TypeScript
|
|
1038
1054
|
throw new LocalError(`nodeFunction('${source.path}') points at TypeScript source. Pre-bundle it to JavaScript for now; Run402 will not upload unbundled function TypeScript.`, "loading executable deploy config", {
|
|
1039
1055
|
code: "TYPESCRIPT_FUNCTION_REQUIRES_BUNDLE",
|
|
1040
1056
|
details: { resource: `${mapResource}.${name}.source`, path: source.path },
|
|
@@ -1054,38 +1070,17 @@ function mapSite(site, opts) {
|
|
|
1054
1070
|
// nothing else is then refused as MANIFEST_EMPTY like every empty spec.
|
|
1055
1071
|
if (Object.keys(raw).length === 0)
|
|
1056
1072
|
return undefined;
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
}
|
|
1061
|
-
const publicPaths = Object.prototype.hasOwnProperty.call(raw, "public_paths")
|
|
1062
|
-
? mapSitePublicPaths(raw.public_paths)
|
|
1063
|
-
: undefined;
|
|
1064
|
-
// tenant-site-embedding: `null` clears, so presence (not truthiness) decides.
|
|
1065
|
-
const embedding = Object.prototype.hasOwnProperty.call(raw, "embedding")
|
|
1066
|
-
? { embedding: mapSiteEmbedding(raw.embedding) }
|
|
1067
|
-
: {};
|
|
1068
|
-
// site.sign_in_path: same presence rule (`null` clears to the hosted page).
|
|
1069
|
-
const signInPath = Object.prototype.hasOwnProperty.call(raw, "sign_in_path")
|
|
1070
|
-
? { sign_in_path: mapSiteSignInPath(raw.sign_in_path) }
|
|
1071
|
-
: {};
|
|
1072
|
-
// site.noindex: same presence rule (`false` or `null` clears to indexable).
|
|
1073
|
-
const noindex = Object.prototype.hasOwnProperty.call(raw, "noindex")
|
|
1074
|
-
? { noindex: mapSiteNoindex(raw.noindex) }
|
|
1075
|
-
: {};
|
|
1073
|
+
// Every key the manifest set is carried; which combinations a site may use
|
|
1074
|
+
// (replace with patch, for one) is the gateway's rule (INVALID_SPEC).
|
|
1075
|
+
const out = {};
|
|
1076
1076
|
if (Object.prototype.hasOwnProperty.call(raw, "replace")) {
|
|
1077
1077
|
if (raw.replace === undefined) {
|
|
1078
|
+
// local-check: sdk_normalization — undefined is not representable in the wire spec
|
|
1078
1079
|
throw new LocalError("Deploy manifest site.replace is undefined", CONTEXT);
|
|
1079
1080
|
}
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
: mapFileSet(raw.replace, opts),
|
|
1084
|
-
...(publicPaths ? { public_paths: publicPaths } : {}),
|
|
1085
|
-
...embedding,
|
|
1086
|
-
...signInPath,
|
|
1087
|
-
...noindex,
|
|
1088
|
-
};
|
|
1081
|
+
out.replace = isLocalDirRef(raw.replace)
|
|
1082
|
+
? resolveLocalDirRef(raw.replace, opts)
|
|
1083
|
+
: mapFileSet(raw.replace, opts);
|
|
1089
1084
|
}
|
|
1090
1085
|
if (Object.prototype.hasOwnProperty.call(raw, "patch")) {
|
|
1091
1086
|
const patch = {};
|
|
@@ -1097,29 +1092,26 @@ function mapSite(site, opts) {
|
|
|
1097
1092
|
? resolveLocalDirRef(rawPatch.put, opts)
|
|
1098
1093
|
: mapFileSet(rawPatch.put, opts);
|
|
1099
1094
|
}
|
|
1100
|
-
if (rawPatch.delete !== undefined)
|
|
1101
|
-
if (!Array.isArray(rawPatch.delete)) {
|
|
1102
|
-
throw new LocalError("Deploy manifest site.patch.delete must be an array", CONTEXT);
|
|
1103
|
-
}
|
|
1095
|
+
if (rawPatch.delete !== undefined)
|
|
1104
1096
|
patch.delete = rawPatch.delete;
|
|
1105
|
-
|
|
1106
|
-
return {
|
|
1107
|
-
patch,
|
|
1108
|
-
...(publicPaths ? { public_paths: publicPaths } : {}),
|
|
1109
|
-
...embedding,
|
|
1110
|
-
...signInPath,
|
|
1111
|
-
...noindex,
|
|
1112
|
-
};
|
|
1097
|
+
out.patch = patch;
|
|
1113
1098
|
}
|
|
1114
|
-
if (
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1099
|
+
if (Object.prototype.hasOwnProperty.call(raw, "public_paths")) {
|
|
1100
|
+
out.public_paths = mapSitePublicPaths(raw.public_paths);
|
|
1101
|
+
}
|
|
1102
|
+
// tenant-site-embedding: `null` clears, so presence (not truthiness) decides.
|
|
1103
|
+
if (Object.prototype.hasOwnProperty.call(raw, "embedding")) {
|
|
1104
|
+
out.embedding = raw.embedding;
|
|
1105
|
+
}
|
|
1106
|
+
// site.sign_in_path: same presence rule (`null` clears to the hosted page).
|
|
1107
|
+
if (Object.prototype.hasOwnProperty.call(raw, "sign_in_path")) {
|
|
1108
|
+
out.sign_in_path = raw.sign_in_path;
|
|
1109
|
+
}
|
|
1110
|
+
// site.noindex: same presence rule (`false` or `null` clears to indexable).
|
|
1111
|
+
if (Object.prototype.hasOwnProperty.call(raw, "noindex")) {
|
|
1112
|
+
out.noindex = raw.noindex;
|
|
1121
1113
|
}
|
|
1122
|
-
|
|
1114
|
+
return out;
|
|
1123
1115
|
}
|
|
1124
1116
|
function resolveLocalDirRef(ref, opts) {
|
|
1125
1117
|
return {
|
|
@@ -1130,36 +1122,24 @@ function resolveLocalDirRef(ref, opts) {
|
|
|
1130
1122
|
function mapSitePublicPaths(value) {
|
|
1131
1123
|
assertPlainRecord(value, "Deploy manifest site.public_paths");
|
|
1132
1124
|
assertKnownFields(value, "Deploy manifest site.public_paths", MANIFEST_SITE_PUBLIC_PATHS_FIELDS);
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
}
|
|
1136
|
-
if (value
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
for (const [publicPath, entry] of Object.entries(value.replace)) {
|
|
1148
|
-
const label = `Deploy manifest site.public_paths.replace[${JSON.stringify(publicPath)}]`;
|
|
1149
|
-
assertPlainRecord(entry, label);
|
|
1150
|
-
assertKnownFields(entry, label, MANIFEST_PUBLIC_STATIC_PATH_FIELDS);
|
|
1151
|
-
if (typeof entry.asset !== "string" || entry.asset.length === 0) {
|
|
1152
|
-
throw new LocalError(`${label}.asset must be a non-empty release static asset path`, CONTEXT);
|
|
1125
|
+
// The mode, and whether it takes a replace table, are the gateway's rules
|
|
1126
|
+
// (INVALID_SPEC); the manifest's values are carried as written.
|
|
1127
|
+
const out = { mode: value.mode };
|
|
1128
|
+
if (Object.prototype.hasOwnProperty.call(value, "replace")) {
|
|
1129
|
+
assertPlainRecord(value.replace, "Deploy manifest site.public_paths.replace");
|
|
1130
|
+
const replace = {};
|
|
1131
|
+
for (const [publicPath, entry] of Object.entries(value.replace)) {
|
|
1132
|
+
const label = `Deploy manifest site.public_paths.replace[${JSON.stringify(publicPath)}]`;
|
|
1133
|
+
assertPlainRecord(entry, label);
|
|
1134
|
+
assertKnownFields(entry, label, MANIFEST_PUBLIC_STATIC_PATH_FIELDS);
|
|
1135
|
+
replace[publicPath] =
|
|
1136
|
+
entry.cache_class === undefined
|
|
1137
|
+
? { asset: entry.asset }
|
|
1138
|
+
: { asset: entry.asset, cache_class: entry.cache_class };
|
|
1153
1139
|
}
|
|
1154
|
-
|
|
1155
|
-
throw new LocalError(`${label}.cache_class must be a string`, CONTEXT);
|
|
1156
|
-
}
|
|
1157
|
-
replace[publicPath] =
|
|
1158
|
-
entry.cache_class === undefined
|
|
1159
|
-
? { asset: entry.asset }
|
|
1160
|
-
: { asset: entry.asset, cache_class: entry.cache_class };
|
|
1140
|
+
out.replace = replace;
|
|
1161
1141
|
}
|
|
1162
|
-
return
|
|
1142
|
+
return out;
|
|
1163
1143
|
}
|
|
1164
1144
|
function mapAssets(assets, opts) {
|
|
1165
1145
|
assertPlainRecord(assets, "Deploy manifest assets");
|
|
@@ -1167,6 +1147,7 @@ function mapAssets(assets, opts) {
|
|
|
1167
1147
|
const out = {};
|
|
1168
1148
|
if (assets.put !== undefined) {
|
|
1169
1149
|
if (!Array.isArray(assets.put)) {
|
|
1150
|
+
// local-check: sdk_normalization — the SDK iterates put entries to resolve sources
|
|
1170
1151
|
throw new LocalError("Deploy manifest assets.put must be an array of put entries", CONTEXT);
|
|
1171
1152
|
}
|
|
1172
1153
|
const put = [];
|
|
@@ -1176,12 +1157,10 @@ function mapAssets(assets, opts) {
|
|
|
1176
1157
|
assertPlainRecord(rawEntry, label);
|
|
1177
1158
|
assertKnownFields(rawEntry, label, MANIFEST_ASSETS_PUT_ENTRY_FIELDS);
|
|
1178
1159
|
const entry = rawEntry;
|
|
1179
|
-
if (typeof entry.key !== "string" || entry.key.length === 0) {
|
|
1180
|
-
throw new LocalError(`${label}.key is required and must be a non-empty string`, CONTEXT);
|
|
1181
|
-
}
|
|
1182
1160
|
const hasSource = entry.source !== undefined;
|
|
1183
1161
|
const hasSha = entry.sha256 !== undefined;
|
|
1184
1162
|
if (hasSource === hasSha) {
|
|
1163
|
+
// local-check: sdk_normalization — source is the SDK-only input form, sha256 the wire form
|
|
1185
1164
|
throw new LocalError(`${label} must include exactly one of \`source\` or \`sha256\``, CONTEXT);
|
|
1186
1165
|
}
|
|
1187
1166
|
if (hasSource) {
|
|
@@ -1199,9 +1178,6 @@ function mapAssets(assets, opts) {
|
|
|
1199
1178
|
put.push(input);
|
|
1200
1179
|
}
|
|
1201
1180
|
else {
|
|
1202
|
-
if (typeof entry.size_bytes !== "number") {
|
|
1203
|
-
throw new LocalError(`${label}.size_bytes is required when using the wire form (sha256 set)`, CONTEXT);
|
|
1204
|
-
}
|
|
1205
1181
|
// Wire shape — typed as AssetPutEntryInput but the SDK's
|
|
1206
1182
|
// normalizeAssetSlice accepts the wire form too (it discriminates
|
|
1207
1183
|
// on the presence of `source`).
|
|
@@ -1219,34 +1195,21 @@ function mapAssets(assets, opts) {
|
|
|
1219
1195
|
out.put = put;
|
|
1220
1196
|
}
|
|
1221
1197
|
if (assets.delete !== undefined) {
|
|
1222
|
-
|
|
1223
|
-
throw new LocalError("Deploy manifest assets.delete must be an array of keys", CONTEXT);
|
|
1224
|
-
}
|
|
1225
|
-
out.delete = [...assets.delete];
|
|
1198
|
+
out.delete = (Array.isArray(assets.delete) ? [...assets.delete] : assets.delete);
|
|
1226
1199
|
}
|
|
1227
1200
|
if (assets.sync !== undefined) {
|
|
1228
1201
|
assertPlainRecord(assets.sync, "Deploy manifest assets.sync");
|
|
1229
1202
|
assertKnownFields(assets.sync, "Deploy manifest assets.sync", MANIFEST_ASSETS_SYNC_FIELDS);
|
|
1230
1203
|
const rawSync = assets.sync;
|
|
1231
|
-
|
|
1232
|
-
throw new LocalError("Deploy manifest assets.sync.prefix is required", CONTEXT);
|
|
1233
|
-
}
|
|
1234
|
-
if (rawSync.prune !== true) {
|
|
1235
|
-
throw new LocalError("Deploy manifest assets.sync.prune must be `true`", CONTEXT);
|
|
1236
|
-
}
|
|
1204
|
+
// prefix, prune and confirm are carried as written; the gateway judges them (INVALID_SPEC).
|
|
1237
1205
|
const sync = {
|
|
1238
1206
|
prefix: rawSync.prefix,
|
|
1239
|
-
prune:
|
|
1207
|
+
prune: rawSync.prune,
|
|
1240
1208
|
};
|
|
1241
1209
|
if (rawSync.confirm !== undefined) {
|
|
1242
1210
|
assertPlainRecord(rawSync.confirm, "Deploy manifest assets.sync.confirm");
|
|
1243
1211
|
assertKnownFields(rawSync.confirm, "Deploy manifest assets.sync.confirm", MANIFEST_ASSETS_SYNC_CONFIRM_FIELDS);
|
|
1244
1212
|
const confirm = rawSync.confirm;
|
|
1245
|
-
if (typeof confirm.base_revision !== "string" ||
|
|
1246
|
-
typeof confirm.delete_set_digest !== "string" ||
|
|
1247
|
-
typeof confirm.expected_delete_count !== "number") {
|
|
1248
|
-
throw new LocalError("Deploy manifest assets.sync.confirm requires base_revision (string), delete_set_digest (string), expected_delete_count (number)", CONTEXT);
|
|
1249
|
-
}
|
|
1250
1213
|
sync.confirm = {
|
|
1251
1214
|
base_revision: confirm.base_revision,
|
|
1252
1215
|
delete_set_digest: confirm.delete_set_digest,
|
|
@@ -1306,10 +1269,12 @@ function mapRoutes(routes) {
|
|
|
1306
1269
|
assertPlainRecord(routes, "Deploy manifest routes");
|
|
1307
1270
|
assertKnownFields(routes, "Deploy manifest routes", MANIFEST_ROUTES_FIELDS, routeShapeHints(routes));
|
|
1308
1271
|
if (!Object.prototype.hasOwnProperty.call(routes, "replace")) {
|
|
1272
|
+
// local-check: sdk_normalization — the SDK maps routes.replace entries
|
|
1309
1273
|
throw new LocalError("Deploy manifest routes must be null or { \"replace\": [{ \"pattern\": \"/api/*\", \"target\": { \"type\": \"function\", \"name\": \"api\" } }, { \"pattern\": \"/events\", \"methods\": [\"GET\"], \"target\": { \"type\": \"static\", \"file\": \"events.html\" } }] }. Path-keyed route maps are not supported.", CONTEXT);
|
|
1310
1274
|
}
|
|
1311
1275
|
const replace = routes.replace;
|
|
1312
1276
|
if (!Array.isArray(replace)) {
|
|
1277
|
+
// local-check: sdk_normalization — the SDK maps routes.replace entries
|
|
1313
1278
|
throw new LocalError("Deploy manifest routes.replace must be an array", CONTEXT);
|
|
1314
1279
|
}
|
|
1315
1280
|
replace.forEach((route, index) => validateManifestRouteEntry(route, index));
|
|
@@ -1346,93 +1311,18 @@ function validateManifestRouteEntry(route, index) {
|
|
|
1346
1311
|
const label = `Deploy manifest routes.replace[${index}]`;
|
|
1347
1312
|
assertPlainRecord(route, label);
|
|
1348
1313
|
assertKnownFields(route, label, MANIFEST_ROUTE_ENTRY_FIELDS);
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
}
|
|
1352
|
-
if (route.methods !== undefined) {
|
|
1353
|
-
if (!Array.isArray(route.methods)) {
|
|
1354
|
-
throw new LocalError(`${label}.methods must be an array of HTTP methods`, CONTEXT);
|
|
1355
|
-
}
|
|
1356
|
-
if (route.methods.length === 0) {
|
|
1357
|
-
throw new LocalError(`${label}.methods must not be empty; omit methods to allow all supported methods`, CONTEXT);
|
|
1358
|
-
}
|
|
1359
|
-
for (const method of route.methods) {
|
|
1360
|
-
if (typeof method !== "string" || !ROUTE_METHOD_SET.has(method)) {
|
|
1361
|
-
throw new LocalError(`${label}.methods contains unsupported method ${JSON.stringify(method)}. Supported methods: ${ROUTE_HTTP_METHODS.join(", ")}`, CONTEXT);
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
const seen = new Set();
|
|
1365
|
-
for (const method of route.methods) {
|
|
1366
|
-
if (seen.has(method)) {
|
|
1367
|
-
throw new LocalError(`${label}.methods contains duplicate method ${JSON.stringify(method)}`, CONTEXT);
|
|
1368
|
-
}
|
|
1369
|
-
seen.add(method);
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
const targetType = validateManifestRouteTarget(route.target, `${label}.target`);
|
|
1373
|
-
if (targetType === "static")
|
|
1374
|
-
validateManifestStaticRouteEntry(route, label);
|
|
1314
|
+
// pattern, methods and the target's values are carried as written; the
|
|
1315
|
+
// gateway judges and normalizes them (INVALID_SPEC).
|
|
1316
|
+
validateManifestRouteTarget(route.target, `${label}.target`);
|
|
1375
1317
|
}
|
|
1376
1318
|
function validateManifestRouteTarget(target, label) {
|
|
1377
1319
|
assertPlainRecord(target, label);
|
|
1378
|
-
if (
|
|
1379
|
-
Object.prototype.hasOwnProperty.call(target, "static")) &&
|
|
1380
|
-
!Object.prototype.hasOwnProperty.call(target, "type")) {
|
|
1381
|
-
throw new LocalError(`${label} uses unsupported target shorthand. Use { "type": "function", "name": "api" } or { "type": "static", "file": "events.html" }.`, CONTEXT);
|
|
1382
|
-
}
|
|
1383
|
-
if (target.type === undefined) {
|
|
1384
|
-
throw new LocalError(`${label}.type is required; use "function" or "static"`, CONTEXT);
|
|
1385
|
-
}
|
|
1386
|
-
if (target.type === "function") {
|
|
1320
|
+
if (target.type === "function")
|
|
1387
1321
|
assertKnownFields(target, label, MANIFEST_FUNCTION_ROUTE_TARGET_FIELDS);
|
|
1388
|
-
|
|
1389
|
-
throw new LocalError(`${label}.name is required for function route targets`, CONTEXT);
|
|
1390
|
-
}
|
|
1391
|
-
return "function";
|
|
1392
|
-
}
|
|
1393
|
-
if (target.type === "static") {
|
|
1322
|
+
else if (target.type === "static")
|
|
1394
1323
|
assertKnownFields(target, label, MANIFEST_STATIC_ROUTE_TARGET_FIELDS);
|
|
1395
|
-
|
|
1396
|
-
throw new LocalError(`${label}.file is required for static route targets`, CONTEXT);
|
|
1397
|
-
}
|
|
1398
|
-
validateManifestStaticTargetFile(target.file, `${label}.file`);
|
|
1399
|
-
return "static";
|
|
1400
|
-
}
|
|
1401
|
-
if (target.type === "repo") {
|
|
1324
|
+
else if (target.type === "repo")
|
|
1402
1325
|
assertKnownFields(target, label, MANIFEST_REPO_ROUTE_TARGET_FIELDS);
|
|
1403
|
-
if (typeof target.repo !== "string" || target.repo.length === 0) {
|
|
1404
|
-
throw new LocalError(`${label}.repo is required for repo route targets (an app repo name, e.g. "default")`, CONTEXT);
|
|
1405
|
-
}
|
|
1406
|
-
return "repo";
|
|
1407
|
-
}
|
|
1408
|
-
throw new LocalError(`${label}.type must be "function", "static" or "repo"; got ${JSON.stringify(target.type)}`, CONTEXT);
|
|
1409
|
-
}
|
|
1410
|
-
function validateManifestStaticRouteEntry(route, label) {
|
|
1411
|
-
const pattern = route.pattern;
|
|
1412
|
-
if (pattern.includes("*")) {
|
|
1413
|
-
throw new LocalError(`${label}.pattern uses a static route target, so it must be an exact path pattern; wildcard static route targets such as /docs/* are not supported`, CONTEXT);
|
|
1414
|
-
}
|
|
1415
|
-
if (route.methods === undefined) {
|
|
1416
|
-
throw new LocalError(`${label}.methods is required for static route targets; use ["GET"] or ["GET", "HEAD"]`, CONTEXT);
|
|
1417
|
-
}
|
|
1418
|
-
const methods = route.methods;
|
|
1419
|
-
const methodSet = new Set(methods);
|
|
1420
|
-
const valid = methodSet.has("GET") &&
|
|
1421
|
-
(methodSet.size === 1 || (methodSet.size === 2 && methodSet.has("HEAD")));
|
|
1422
|
-
if (!valid) {
|
|
1423
|
-
throw new LocalError(`${label}.methods for static route targets must be ["GET"] or ["GET", "HEAD"]; either form materializes effective GET plus HEAD`, CONTEXT);
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
function validateManifestStaticTargetFile(file, label) {
|
|
1427
|
-
const invalid = file.startsWith("/") ||
|
|
1428
|
-
file.includes("?") ||
|
|
1429
|
-
file.includes("#") ||
|
|
1430
|
-
file.includes("\\") ||
|
|
1431
|
-
file.endsWith("/") ||
|
|
1432
|
-
file.split("/").some((segment) => segment === "" || segment === "." || segment === "..");
|
|
1433
|
-
if (invalid) {
|
|
1434
|
-
throw new LocalError(`${label} must be a relative materialized static-site file path without leading slash, query, fragment, traversal, empty segments, backslashes, or directory shorthand`, CONTEXT);
|
|
1435
|
-
}
|
|
1436
1326
|
}
|
|
1437
1327
|
function mapFileSet(map, opts) {
|
|
1438
1328
|
assertPlainRecord(map, "Deploy manifest file map");
|
|
@@ -1463,6 +1353,7 @@ function fileEntryToContentSource(entry, opts, label) {
|
|
|
1463
1353
|
if (encoding !== undefined &&
|
|
1464
1354
|
encoding !== "utf-8" &&
|
|
1465
1355
|
encoding !== "base64") {
|
|
1356
|
+
// local-check: sdk_normalization — the SDK decodes the entry's encoding itself
|
|
1466
1357
|
throw new LocalError(`Unsupported encoding for ${label}: ${String(encoding)}`, CONTEXT);
|
|
1467
1358
|
}
|
|
1468
1359
|
const contentType = contentTypeFromManifestRecord(rec, label);
|
|
@@ -1478,6 +1369,7 @@ function fileEntryToContentSource(entry, opts, label) {
|
|
|
1478
1369
|
}
|
|
1479
1370
|
if (encoding === "base64") {
|
|
1480
1371
|
if (typeof rec.data !== "string") {
|
|
1372
|
+
// local-check: sdk_normalization — the SDK decodes base64 data itself
|
|
1481
1373
|
throw new LocalError(`Base64 file entry for ${label} must use a string data field`, CONTEXT);
|
|
1482
1374
|
}
|
|
1483
1375
|
const bytes = base64ToBytes(rec.data);
|
|
@@ -1487,6 +1379,7 @@ function fileEntryToContentSource(entry, opts, label) {
|
|
|
1487
1379
|
}
|
|
1488
1380
|
if (Object.prototype.hasOwnProperty.call(rec, "data")) {
|
|
1489
1381
|
if (rec.data === undefined) {
|
|
1382
|
+
// local-check: sdk_normalization — data key present but undefined, nothing to upload
|
|
1490
1383
|
throw new LocalError(`File entry for ${label} is missing data`, CONTEXT);
|
|
1491
1384
|
}
|
|
1492
1385
|
const data = rec.data;
|
|
@@ -1500,10 +1393,12 @@ function contentTypeFromManifestRecord(rec, label) {
|
|
|
1500
1393
|
// A manifest is a wire document: one spelling, `content_type`. `contentType`
|
|
1501
1394
|
// is the in-function JS option name only (first-deploy-agent-dx).
|
|
1502
1395
|
if (rec.contentType !== undefined) {
|
|
1396
|
+
// local-check: sdk_normalization — manifest spelling the SDK maps to contentType
|
|
1503
1397
|
throw new LocalError(`${label}.contentType is not a manifest field — spell it content_type (wire fields are snake_case; contentType is only the in-function JS option)`, CONTEXT);
|
|
1504
1398
|
}
|
|
1505
1399
|
const snake = rec.content_type;
|
|
1506
1400
|
if (snake !== undefined && typeof snake !== "string") {
|
|
1401
|
+
// local-check: sdk_normalization — content_type the SDK attaches to the upload
|
|
1507
1402
|
throw new LocalError(`${label}.content_type must be a string`, CONTEXT);
|
|
1508
1403
|
}
|
|
1509
1404
|
return typeof snake === "string" ? snake : undefined;
|
|
@@ -1538,6 +1433,7 @@ function isRecord(value) {
|
|
|
1538
1433
|
}
|
|
1539
1434
|
function assertPlainRecord(value, label) {
|
|
1540
1435
|
if (!isRecord(value) || Array.isArray(value)) {
|
|
1436
|
+
// local-check: sdk_normalization — the SDK walks this object while mapping
|
|
1541
1437
|
throw new LocalError(`${label} must be a JSON object`, CONTEXT);
|
|
1542
1438
|
}
|
|
1543
1439
|
}
|
|
@@ -1546,6 +1442,7 @@ function assertKnownFields(value, label, allowed, hints = {}) {
|
|
|
1546
1442
|
if (allowed.has(key))
|
|
1547
1443
|
continue;
|
|
1548
1444
|
const hint = hints[key] ? ` ${hints[key]}` : "";
|
|
1445
|
+
// local-check: sdk_normalization — mapping would silently drop unknown fields
|
|
1549
1446
|
throw new LocalError(`Unknown ${label} field: ${key}.${hint}`, CONTEXT);
|
|
1550
1447
|
}
|
|
1551
1448
|
}
|
|
@@ -1606,33 +1503,4 @@ async function assertAuthoringFileReferences(input, baseDir, manifestPath) {
|
|
|
1606
1503
|
if (missing.length)
|
|
1607
1504
|
throw manifestFileMissingError(missing.sort((a, b) => Number(b.kind === "migration_sql") - Number(a.kind === "migration_sql")), { manifestPath });
|
|
1608
1505
|
}
|
|
1609
|
-
/** tenant-site-embedding. Shape only; the gateway owns the catalog and names
|
|
1610
|
-
* the valid keys in its INVALID_SPEC, so a new key never needs a client release. */
|
|
1611
|
-
function mapSiteEmbedding(value) {
|
|
1612
|
-
if (value === null)
|
|
1613
|
-
return null;
|
|
1614
|
-
assertPlainRecord(value, "Deploy manifest site.embedding");
|
|
1615
|
-
assertKnownFields(value, "Deploy manifest site.embedding", new Set(["frame_ancestors"]));
|
|
1616
|
-
const keys = value.frame_ancestors;
|
|
1617
|
-
if (!Array.isArray(keys) || keys.length === 0 || keys.some((k) => typeof k !== "string")) {
|
|
1618
|
-
throw new LocalError('Deploy manifest site.embedding.frame_ancestors must be a non-empty array of embedding catalog keys (e.g. ["localhost"]); omit site.embedding to carry the previous declaration forward or set it to null to deny framing', CONTEXT);
|
|
1619
|
-
}
|
|
1620
|
-
return { frame_ancestors: keys };
|
|
1621
|
-
}
|
|
1622
|
-
/** site.sign_in_path. Shape only (string or null); the SDK's spec validation
|
|
1623
|
-
* and the gateway check the path itself. */
|
|
1624
|
-
function mapSiteSignInPath(value) {
|
|
1625
|
-
if (value === null)
|
|
1626
|
-
return null;
|
|
1627
|
-
if (typeof value !== "string") {
|
|
1628
|
-
throw new LocalError('Deploy manifest site.sign_in_path must be a same-origin path string (e.g. "/join") or null; omit it to carry the previous value forward or set it to null to use the hosted sign-in page', CONTEXT);
|
|
1629
|
-
}
|
|
1630
|
-
return value;
|
|
1631
|
-
}
|
|
1632
|
-
/** site.noindex. true, false, or null; anything else is refused here. */
|
|
1633
|
-
function mapSiteNoindex(value) {
|
|
1634
|
-
if (value === null || typeof value === "boolean")
|
|
1635
|
-
return value;
|
|
1636
|
-
throw new LocalError("Deploy manifest site.noindex must be true, false, or null; set true to add X-Robots-Tag: noindex, nofollow, nosnippet to every response of the host, false or null to make it indexable again, or omit it to carry the previous value forward", CONTEXT);
|
|
1637
|
-
}
|
|
1638
1506
|
//# sourceMappingURL=deploy-manifest.js.map
|