UNPKG

run402-mcp

Version:

MCP server for Run402 — full-stack backend infrastructure for AI agents: Postgres, auth, storage, serverless functions and atomic deploys. Paid with x402/MPP. Includes $0.03 image generation.

106 lines • 4.56 kB
export function defineConfig(config) { return config; } export function dir(path, options = {}) { return { __source: "local-dir", path, ...(options.prefix !== undefined ? { prefix: options.prefix } : {}), ...(options.ignore !== undefined ? { ignore: [...options.ignore] } : {}), ...(options.includeSensitive !== undefined ? { includeSensitive: options.includeSensitive } : {}), }; } export function file(path, options = {}) { return { __source: "fs-file", path, ...(options.contentType !== undefined ? { contentType: options.contentType } : options.content_type !== undefined ? { contentType: options.content_type } : {}), ...(options.content_type !== undefined ? { content_type: options.content_type } : {}), }; } export function sqlFile(path, options = {}) { if (options.id !== undefined && options.name !== undefined) { throw new TypeError("sqlFile options must use either id or name, not both."); } return { ...(options.name !== undefined ? { name: options.name } : { id: options.id ?? defaultIdFromPath(path) }), sql_file: path, ...(options.checksum !== undefined ? { checksum: options.checksum } : {}), ...(options.transaction !== undefined ? { transaction: options.transaction } : {}), }; } export function nodeFunction(path, options = {}) { return { runtime: options.runtime ?? "node22", source: file(path), ...(options.entrypoint !== undefined ? { entrypoint: options.entrypoint } : {}), ...(options.config !== undefined ? { config: options.config } : {}), ...(options.deps !== undefined ? { deps: [...options.deps] } : {}), ...(options.triggers !== undefined ? { triggers: options.triggers.map((trigger) => ({ ...trigger })) } : {}), ...(options.schedule !== undefined ? { schedule: options.schedule } : {}), ...(options.class !== undefined ? { class: options.class } : {}), ...(options.capabilities !== undefined ? { capabilities: [...options.capabilities] } : {}), ...(options.requireAuth !== undefined ? { requireAuth: options.requireAuth } : {}), ...(options.requireRole !== undefined ? { requireRole: options.requireRole } : {}), }; } export function scheduleTrigger(id, cron, options) { if (!options || typeof options !== "object") { throw new TypeError("scheduleTrigger options are required."); } return { id, type: "schedule", cron, ...(options.timezone !== undefined ? { timezone: options.timezone } : {}), ...(options.misfirePolicy !== undefined ? { misfire_policy: options.misfirePolicy } : options.misfire_policy !== undefined ? { misfire_policy: options.misfire_policy } : {}), ...(options.overlapPolicy !== undefined ? { overlap_policy: options.overlapPolicy } : options.overlap_policy !== undefined ? { overlap_policy: options.overlap_policy } : {}), run: { event_type: options.run.event_type, ...(options.run.payload !== undefined ? { payload: options.run.payload } : {}), ...(options.run.retry !== undefined ? { retry: options.run.retry } : {}), ...(options.run.expires_after_seconds !== undefined ? { expires_after_seconds: options.run.expires_after_seconds } : {}), }, }; } export function emailTrigger(id, mailbox, options) { if (!options || typeof options !== "object") { throw new TypeError("emailTrigger options are required."); } return { id, type: "email", mailbox, events: [...options.events], run: { event_type: options.run.event_type, ...(options.run.payload !== undefined ? { payload: options.run.payload } : {}), ...(options.run.retry !== undefined ? { retry: options.run.retry } : {}), ...(options.run.expires_after_seconds !== undefined ? { expires_after_seconds: options.run.expires_after_seconds } : {}), }, }; } function defaultIdFromPath(path) { const normalized = path.replaceAll("\\", "/"); const base = normalized.split("/").filter(Boolean).at(-1) ?? normalized; return base.replace(/\.[^.]*$/, "") || base; } //# sourceMappingURL=config.js.map