@prisma/composer-prisma-cloud 0.2.0-dev.12 → 0.2.0-dev.13
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/dist/buckets-main.mjs +795 -0
- package/dist/buckets-main.mjs.map +1 -0
- package/dist/compute-main.mjs +532 -0
- package/dist/compute-main.mjs.map +1 -0
- package/dist/control.mjs +41 -1257
- package/dist/control.mjs.map +1 -1
- package/dist/cron/index.mjs +2 -3
- package/dist/cron/index.mjs.map +1 -1
- package/dist/cron/scheduler-entrypoint.mjs.map +1 -1
- package/dist/cron/scheduler-service.mjs +2 -3
- package/dist/cron/scheduler-service.mjs.map +1 -1
- package/dist/email/email-entrypoint.mjs.map +1 -1
- package/dist/email/email-service.mjs +2 -3
- package/dist/email/email-service.mjs.map +1 -1
- package/dist/email/index.mjs +2 -3
- package/dist/email/index.mjs.map +1 -1
- package/dist/email/testing.mjs.map +1 -1
- package/dist/get-port-BYnpbW5H.mjs +111 -0
- package/dist/get-port-BYnpbW5H.mjs.map +1 -0
- package/dist/index.mjs +4 -2
- package/dist/index.mjs.map +1 -1
- package/dist/local-target.d.mts +12 -0
- package/dist/local-target.d.mts.map +1 -0
- package/dist/local-target.mjs +6129 -0
- package/dist/local-target.mjs.map +1 -0
- package/dist/param-BTzY0ne5-CW6ojZ3E.mjs +66 -0
- package/dist/param-BTzY0ne5-CW6ojZ3E.mjs.map +1 -0
- package/dist/pg-connection-CadPZuEK-CF3FsSQu.mjs +79 -0
- package/dist/pg-connection-CadPZuEK-CF3FsSQu.mjs.map +1 -0
- package/dist/postgres-main.mjs +402 -0
- package/dist/postgres-main.mjs.map +1 -0
- package/dist/preflight-names-BPL-qsZF-BfoRgbgb.mjs +1252 -0
- package/dist/preflight-names-BPL-qsZF-BfoRgbgb.mjs.map +1 -0
- package/dist/{prisma-next-BvBwGCIt-CSauMX4l.mjs → prisma-next-BvBwGCIt-DssgnctU.mjs} +3 -78
- package/dist/prisma-next-BvBwGCIt-DssgnctU.mjs.map +1 -0
- package/dist/prisma-next.mjs +1 -1
- package/dist/{provisioned-edges-B_XS1Mz--NFJgcXK7.mjs → provisioned-edges-C1wSO3cx-YC5C19f9.mjs} +5 -65
- package/dist/provisioned-edges-C1wSO3cx-YC5C19f9.mjs.map +1 -0
- package/dist/secret-rz_ZqNeq-_xd97Jd9.mjs +47 -0
- package/dist/secret-rz_ZqNeq-_xd97Jd9.mjs.map +1 -0
- package/dist/segments-NpKN-46R-B01DmCqy.mjs +1441 -0
- package/dist/segments-NpKN-46R-B01DmCqy.mjs.map +1 -0
- package/dist/{serializer-D8_84XWO-DA2B6YbX.mjs → serializer-CJiOhF2d-DJUjQj1i.mjs} +4 -44
- package/dist/serializer-CJiOhF2d-DJUjQj1i.mjs.map +1 -0
- package/dist/storage/index.mjs +2 -3
- package/dist/storage/index.mjs.map +1 -1
- package/dist/storage/storage-entrypoint.mjs.map +1 -1
- package/dist/storage/storage-service.mjs +2 -3
- package/dist/storage/storage-service.mjs.map +1 -1
- package/dist/streams/index.mjs +2 -3
- package/dist/streams/index.mjs.map +1 -1
- package/dist/streams/streams-entrypoint.mjs.map +1 -1
- package/dist/streams/streams-service.mjs +2 -3
- package/dist/streams/streams-service.mjs.map +1 -1
- package/dist/testing.mjs +1 -1
- package/dist/testing.mjs.map +1 -1
- package/package.json +21 -15
- package/src/exports/local-target.ts +1 -0
- package/dist/prisma-next-BvBwGCIt-CSauMX4l.mjs.map +0 -1
- package/dist/provisioned-edges-B_XS1Mz--NFJgcXK7.mjs.map +0 -1
- package/dist/serializer-D8_84XWO-DA2B6YbX.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute-main.mjs","names":["getPort"],"sources":["../../../1-prisma-cloud/0-lowering/dev-emulators/dist/compute-main.mjs"],"sourcesContent":["import { c as readOwnVersion, f as StateFile, p as readJsonFile, t as isValidSegment } from \"./segments-NpKN-46R.mjs\";\nimport * as fs from \"node:fs\";\nimport { spawn } from \"node:child_process\";\nimport * as path from \"node:path\";\nimport getPort, { portNumbers } from \"get-port\";\nimport * as http from \"node:http\";\n//#region src/compute-main.ts\n/**\n* The Compute emulator daemon (local-dev spec § 2 `compute-main.ts`): a small\n* local counterpart of the platform's compute service. Owns service child\n* processes (spawned `bun bootstrap.js` from a real packaged artifact),\n* supervises them (crash backoff, held after repeated fast crashes), and\n* serves a loopback JSON admin API plus per-service log streaming.\n*\n* Runs as its own OS process, started by `daemon.ts`'s `ensureDaemon` via\n* `process.execPath <this file> --port <n> --state-dir <dir>`. Everything it\n* needs travels on argv and each request's own body — it reads no\n* environment variable of its own.\n*/\nconst MIN_SERVICE_PORT = 3e3;\nconst MAX_SERVICE_PORT = 65535;\nconst TERMINATE_GRACE_MS = 5e3;\nconst STABLE_UPTIME_MS = 3e4;\nconst BASE_BACKOFF_MS = 1e3;\nconst MAX_BACKOFF_MS = 3e4;\nconst MAX_CONSECUTIVE_FAST_EXITS = 5;\nconst LOG_POLL_INTERVAL_MS = 100;\nconst APPS_STATE_MODE = 384;\nconst BUN_NOT_FOUND_MESSAGE = \"local dev runs services under bun — the Prisma Compute runtime — and `bun` was not found on PATH. Install it: https://bun.sh.\";\nfunction isServiceStatus(value) {\n\treturn value === \"running\" || value === \"backoff\" || value === \"held\" || value === \"stopped\";\n}\nfunction isStringRecord(value) {\n\treturn typeof value === \"object\" && value !== null && Object.values(value).every((v) => typeof v === \"string\");\n}\nfunction isServiceRecord(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tif (!(\"id\" in value) || typeof value.id !== \"string\") return false;\n\tif (!(\"address\" in value) || typeof value.address !== \"string\") return false;\n\tif (!(\"port\" in value) || typeof value.port !== \"number\") return false;\n\tif (!(\"status\" in value) || !isServiceStatus(value.status)) return false;\n\tif (!(\"logPath\" in value) || typeof value.logPath !== \"string\") return false;\n\tif (\"pid\" in value && value.pid !== void 0 && typeof value.pid !== \"number\") return false;\n\tif (\"lastExitCode\" in value && value.lastExitCode !== void 0 && typeof value.lastExitCode !== \"number\") return false;\n\tif (\"artifactHash\" in value && value.artifactHash !== void 0 && typeof value.artifactHash !== \"string\") return false;\n\tif (\"artifactDir\" in value && value.artifactDir !== void 0 && typeof value.artifactDir !== \"string\") return false;\n\tif (\"env\" in value && value.env !== void 0 && !isStringRecord(value.env)) return false;\n\treturn true;\n}\nfunction isAppRecord(value) {\n\treturn typeof value === \"object\" && value !== null && \"services\" in value && typeof value.services === \"object\" && value.services !== null && Object.values(value.services).every(isServiceRecord);\n}\nfunction isAppsState(value) {\n\treturn typeof value === \"object\" && value !== null && Object.values(value).every(isAppRecord);\n}\nfunction isDeploymentBody(value) {\n\treturn typeof value === \"object\" && value !== null && \"address\" in value && typeof value.address === \"string\" && \"artifactDir\" in value && typeof value.artifactDir === \"string\" && \"artifactHash\" in value && typeof value.artifactHash === \"string\" && \"env\" in value && isStringRecord(value.env) && \"port\" in value && typeof value.port === \"number\";\n}\nfunction sleep(ms) {\n\treturn new Promise((resolve) => setTimeout(resolve, ms));\n}\n/** Append-only per-service log file — child stdout/stderr plus `[emulator]` supervision lines. No rotation in v1. */\nvar ServiceLog = class {\n\tfilePath;\n\tfd;\n\tconstructor(filePath) {\n\t\tthis.filePath = filePath;\n\t}\n\tensureOpen() {\n\t\tif (this.fd === void 0) {\n\t\t\tfs.mkdirSync(path.dirname(this.filePath), { recursive: true });\n\t\t\tthis.fd = fs.openSync(this.filePath, \"a\");\n\t\t}\n\t\treturn this.fd;\n\t}\n\twriteRaw(chunk) {\n\t\tfs.writeSync(this.ensureOpen(), chunk);\n\t}\n\twriteLine(line) {\n\t\tfs.writeSync(this.ensureOpen(), `${line}\\n`);\n\t}\n\t/** Closes the fd if one was ever opened. Idempotent. */\n\tclose() {\n\t\tif (this.fd === void 0) return;\n\t\tfs.closeSync(this.fd);\n\t\tthis.fd = void 0;\n\t}\n};\nfunction parseArgs(argv) {\n\tlet port;\n\tlet stateDir;\n\tfor (let i = 0; i < argv.length; i++) if (argv[i] === \"--port\") port = Number(argv[i + 1]);\n\telse if (argv[i] === \"--state-dir\") stateDir = argv[i + 1];\n\tif (port === void 0 || Number.isNaN(port)) throw new Error(\"compute-main: --port <n> is required\");\n\tif (stateDir === void 0) throw new Error(\"compute-main: --state-dir <dir> is required\");\n\treturn {\n\t\tport,\n\t\tstateDir\n\t};\n}\n/** Resolves `bun` from THIS request's env PATH — never the daemon's own. POSIX-only (Windows is out of scope). */\nfunction resolveBunOnPath(env) {\n\tconst pathVar = env[\"PATH\"];\n\tif (!pathVar) return void 0;\n\tfor (const dir of pathVar.split(path.delimiter)) {\n\t\tif (dir === \"\") continue;\n\t\tconst candidate = path.join(dir, \"bun\");\n\t\ttry {\n\t\t\tfs.accessSync(candidate, fs.constants.X_OK);\n\t\t\treturn candidate;\n\t\t} catch {}\n\t}\n}\nfunction main() {\n\tconst { port, stateDir } = parseArgs(process.argv.slice(2));\n\tconst ownVersion = readOwnVersion();\n\tconst appsJsonPath = path.join(stateDir, \"apps.json\");\n\tconst stateFile = new StateFile(appsJsonPath, APPS_STATE_MODE);\n\tlet state = {};\n\tconst runtimes = /* @__PURE__ */ new Map();\n\tfunction runtimeKey(app, id) {\n\t\treturn `${app}/${id}`;\n\t}\n\tfunction getRuntime(app, id) {\n\t\tconst key = runtimeKey(app, id);\n\t\tlet rt = runtimes.get(key);\n\t\tif (!rt) {\n\t\t\trt = {\n\t\t\t\tchild: void 0,\n\t\t\t\tconsecutiveFastExits: 0,\n\t\t\t\tstartedAt: void 0,\n\t\t\t\tstableTimer: void 0,\n\t\t\t\tbackoffTimer: void 0,\n\t\t\t\texpectedExit: false,\n\t\t\t\tlog: void 0\n\t\t\t};\n\t\t\truntimes.set(key, rt);\n\t\t}\n\t\treturn rt;\n\t}\n\tfunction serviceLogPath(app, id) {\n\t\treturn path.join(stateDir, \"logs\", app, `${id}.log`);\n\t}\n\tfunction getLog(app, id, logPath) {\n\t\tconst rt = getRuntime(app, id);\n\t\tif (!rt.log) rt.log = new ServiceLog(logPath);\n\t\treturn rt.log;\n\t}\n\tfunction schedulePersist() {\n\t\tstateFile.write(state);\n\t}\n\tfunction clearStableTimer(rt) {\n\t\tif (rt.stableTimer) clearTimeout(rt.stableTimer);\n\t\trt.stableTimer = void 0;\n\t}\n\tfunction clearBackoffTimer(rt) {\n\t\tif (rt.backoffTimer) clearTimeout(rt.backoffTimer);\n\t\trt.backoffTimer = void 0;\n\t}\n\tfunction usedServicePorts() {\n\t\tconst ports = /* @__PURE__ */ new Set();\n\t\tfor (const app of Object.values(state)) for (const svc of Object.values(app.services)) ports.add(svc.port);\n\t\treturn ports;\n\t}\n\t/**\n\t* The smallest genuinely free port at or above `MIN_SERVICE_PORT`,\n\t* excluding this daemon's own persisted allocations — persistence and\n\t* the range policy stay ours; whether a candidate is actually bindable\n\t* is `get-port`'s (spec § 2's dependency razor).\n\t*/\n\tasync function smallestUnusedServicePort() {\n\t\treturn getPort({\n\t\t\tport: portNumbers(MIN_SERVICE_PORT, MAX_SERVICE_PORT),\n\t\t\texclude: usedServicePorts()\n\t\t});\n\t}\n\tasync function getOrCreateService(app, id) {\n\t\tlet appRec = state[app];\n\t\tif (!appRec) {\n\t\t\tappRec = { services: {} };\n\t\t\tstate[app] = appRec;\n\t\t}\n\t\tlet svc = appRec.services[id];\n\t\tif (svc) return svc;\n\t\tsvc = {\n\t\t\tid,\n\t\t\taddress: id,\n\t\t\tport: await smallestUnusedServicePort(),\n\t\t\tstatus: \"stopped\",\n\t\t\tlogPath: serviceLogPath(app, id)\n\t\t};\n\t\tappRec.services[id] = svc;\n\t\tschedulePersist();\n\t\treturn svc;\n\t}\n\tfunction waitForExit(child) {\n\t\treturn new Promise((resolve) => {\n\t\t\tchild.once(\"exit\", () => resolve());\n\t\t});\n\t}\n\t/** SIGTERM, wait up to `graceMs`, SIGKILL. Marks the exit as expected so supervision doesn't fire. */\n\tasync function killChild(rt, graceMs) {\n\t\tconst child = rt.child;\n\t\tif (!child || child.pid === void 0) return;\n\t\trt.expectedExit = true;\n\t\tconst exited = waitForExit(child);\n\t\tchild.kill(\"SIGTERM\");\n\t\tconst timedOut = Symbol(\"timeout\");\n\t\tif (await Promise.race([exited.then(() => void 0), sleep(graceMs).then(() => timedOut)]) === timedOut) {\n\t\t\tchild.kill(\"SIGKILL\");\n\t\t\tawait exited;\n\t\t}\n\t}\n\tfunction handleChildExit(app, id, svc, rt, code) {\n\t\tclearStableTimer(rt);\n\t\trt.child = void 0;\n\t\tdelete svc.pid;\n\t\tif (code !== null) svc.lastExitCode = code;\n\t\tif (rt.expectedExit) {\n\t\t\trt.expectedExit = false;\n\t\t\tschedulePersist();\n\t\t\treturn;\n\t\t}\n\t\tconst uptime = rt.startedAt !== void 0 ? Date.now() - rt.startedAt : 0;\n\t\tif (uptime >= STABLE_UPTIME_MS) rt.consecutiveFastExits = 0;\n\t\tconst attemptNumber = rt.consecutiveFastExits;\n\t\tif (uptime < STABLE_UPTIME_MS) rt.consecutiveFastExits += 1;\n\t\tif (rt.consecutiveFastExits >= MAX_CONSECUTIVE_FAST_EXITS) {\n\t\t\tsvc.status = \"held\";\n\t\t\tschedulePersist();\n\t\t\tgetLog(app, id, svc.logPath).writeLine(`[emulator] held after ${String(MAX_CONSECUTIVE_FAST_EXITS)} consecutive fast exits — send a new deployment to resume`);\n\t\t\treturn;\n\t\t}\n\t\tconst delayMs = Math.min(MAX_BACKOFF_MS, BASE_BACKOFF_MS * 2 ** attemptNumber);\n\t\tsvc.status = \"backoff\";\n\t\tschedulePersist();\n\t\tgetLog(app, id, svc.logPath).writeLine(`[emulator] exited (code ${code === null ? \"null\" : String(code)}) — restarting in ${String(delayMs / 1e3)}s`);\n\t\trt.backoffTimer = setTimeout(() => {\n\t\t\trt.backoffTimer = void 0;\n\t\t\tspawnService(app, id, svc, rt);\n\t\t}, delayMs);\n\t}\n\tasync function spawnService(app, id, svc, rt) {\n\t\tconst env = svc.env ?? {};\n\t\tconst artifactDir = svc.artifactDir ?? \".\";\n\t\tconst bunPath = resolveBunOnPath(env);\n\t\tif (!bunPath) {\n\t\t\tsvc.status = \"stopped\";\n\t\t\tdelete svc.pid;\n\t\t\tschedulePersist();\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tmessage: BUN_NOT_FOUND_MESSAGE\n\t\t\t};\n\t\t}\n\t\tconst log = getLog(app, id, svc.logPath);\n\t\tconst child = spawn(bunPath, [\"bootstrap.js\"], {\n\t\t\tcwd: artifactDir,\n\t\t\tenv,\n\t\t\tstdio: [\n\t\t\t\t\"ignore\",\n\t\t\t\t\"pipe\",\n\t\t\t\t\"pipe\"\n\t\t\t]\n\t\t});\n\t\trt.child = child;\n\t\trt.expectedExit = false;\n\t\trt.startedAt = Date.now();\n\t\tclearStableTimer(rt);\n\t\trt.stableTimer = setTimeout(() => {\n\t\t\trt.consecutiveFastExits = 0;\n\t\t}, STABLE_UPTIME_MS);\n\t\tchild.stdout?.on(\"data\", (chunk) => log.writeRaw(chunk));\n\t\tchild.stderr?.on(\"data\", (chunk) => log.writeRaw(chunk));\n\t\tchild.on(\"exit\", (code) => handleChildExit(app, id, svc, rt, code));\n\t\tsvc.status = \"running\";\n\t\tif (child.pid !== void 0) svc.pid = child.pid;\n\t\tschedulePersist();\n\t\treturn { ok: true };\n\t}\n\tasync function stopService(svc, rt) {\n\t\tclearBackoffTimer(rt);\n\t\tclearStableTimer(rt);\n\t\tawait killChild(rt, TERMINATE_GRACE_MS);\n\t\tsvc.status = \"stopped\";\n\t\tdelete svc.pid;\n\t\tschedulePersist();\n\t}\n\t/**\n\t* The session-resume signal: Alchemy's no-op reconcile never fires a\n\t* deployment PUT, so nothing else restarts a service a previous session\n\t* stopped. Reuses the exact deployment-PUT start rules — same spawn\n\t* path, same supervision reset, and an explicit resume clears `held`\n\t* the same way a deployment PUT does — but from the service's already\n\t* STORED deployment spec, since no new one arrives with a start.\n\t*/\n\tasync function startService(app, id, svc) {\n\t\tif (svc.artifactHash === void 0) return;\n\t\tif (svc.status === \"running\") return;\n\t\tconst rt = getRuntime(app, id);\n\t\tclearBackoffTimer(rt);\n\t\tclearStableTimer(rt);\n\t\trt.consecutiveFastExits = 0;\n\t\tawait spawnService(app, id, svc, rt);\n\t}\n\tfunction json(res, status, body) {\n\t\tconst text = JSON.stringify(body);\n\t\tres.writeHead(status, { \"content-type\": \"application/json\" });\n\t\tres.end(text);\n\t}\n\tfunction text(res, status, body) {\n\t\tres.writeHead(status, { \"content-type\": \"text/plain; charset=utf-8\" });\n\t\tres.end(body);\n\t}\n\tfunction badSegment(res, segment) {\n\t\ttext(res, 400, `invalid path segment \"${segment}\": must match /^[a-z0-9][a-z0-9-]*$/ and be at most 63 characters`);\n\t}\n\tfunction readBody(req) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst chunks = [];\n\t\t\treq.on(\"data\", (chunk) => chunks.push(chunk));\n\t\t\treq.on(\"end\", () => resolve(Buffer.concat(chunks)));\n\t\t\treq.on(\"error\", reject);\n\t\t});\n\t}\n\tfunction serviceView(svc) {\n\t\treturn {\n\t\t\tid: svc.id,\n\t\t\taddress: svc.address,\n\t\t\tport: svc.port,\n\t\t\turl: `http://localhost:${String(svc.port)}`,\n\t\t\tstatus: svc.status,\n\t\t\t...svc.pid !== void 0 ? { pid: svc.pid } : {},\n\t\t\t...svc.lastExitCode !== void 0 ? { lastExitCode: svc.lastExitCode } : {},\n\t\t\t...svc.artifactHash !== void 0 ? { artifactHash: svc.artifactHash } : {},\n\t\t\tlogPath: svc.logPath\n\t\t};\n\t}\n\tfunction envEquals(a, b) {\n\t\tif (!a) return false;\n\t\tconst aKeys = Object.keys(a);\n\t\tconst bKeys = Object.keys(b);\n\t\tif (aKeys.length !== bKeys.length) return false;\n\t\treturn aKeys.every((k) => a[k] === b[k]);\n\t}\n\tasync function handleDeployment(req, res, app, id) {\n\t\tconst raw = await readBody(req);\n\t\tlet parsed;\n\t\ttry {\n\t\t\tparsed = JSON.parse(raw.toString(\"utf8\"));\n\t\t} catch {\n\t\t\treturn text(res, 400, \"malformed JSON body\");\n\t\t}\n\t\tif (!isDeploymentBody(parsed)) return text(res, 400, \"malformed deployment body\");\n\t\tconst svc = await getOrCreateService(app, id);\n\t\tconst rt = getRuntime(app, id);\n\t\tconst changed = svc.artifactHash !== parsed.artifactHash || !envEquals(svc.env, parsed.env);\n\t\tif (svc.status === \"running\") {\n\t\t\tif (!changed) {\n\t\t\t\tres.writeHead(204);\n\t\t\t\tres.end();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tawait killChild(rt, TERMINATE_GRACE_MS);\n\t\t} else clearBackoffTimer(rt);\n\t\tsvc.address = parsed.address;\n\t\tsvc.port = parsed.port;\n\t\tclearStableTimer(rt);\n\t\trt.consecutiveFastExits = 0;\n\t\tsvc.artifactHash = parsed.artifactHash;\n\t\tsvc.env = parsed.env;\n\t\tsvc.artifactDir = parsed.artifactDir;\n\t\tschedulePersist();\n\t\tconst result = await spawnService(app, id, svc, rt);\n\t\tif (!result.ok) return text(res, 500, result.message ?? \"failed to start the service\");\n\t\tres.writeHead(204);\n\t\tres.end();\n\t}\n\tfunction handleFollowLogs(res, logPath) {\n\t\tfs.mkdirSync(path.dirname(logPath), { recursive: true });\n\t\tif (!fs.existsSync(logPath)) fs.closeSync(fs.openSync(logPath, \"a\"));\n\t\tres.writeHead(200, { \"content-type\": \"text/plain; charset=utf-8\" });\n\t\tlet offset = 0;\n\t\tlet stopped = false;\n\t\tlet timer;\n\t\tconst tick = () => {\n\t\t\tif (stopped) return;\n\t\t\tlet stat;\n\t\t\ttry {\n\t\t\t\tstat = fs.statSync(logPath);\n\t\t\t} catch {\n\t\t\t\tstat = void 0;\n\t\t\t}\n\t\t\tif (stat && stat.size > offset) {\n\t\t\t\tconst fd = fs.openSync(logPath, \"r\");\n\t\t\t\tconst buf = Buffer.alloc(stat.size - offset);\n\t\t\t\tfs.readSync(fd, buf, 0, buf.length, offset);\n\t\t\t\tfs.closeSync(fd);\n\t\t\t\toffset = stat.size;\n\t\t\t\tres.write(buf);\n\t\t\t}\n\t\t\tif (!stopped) timer = setTimeout(tick, LOG_POLL_INTERVAL_MS);\n\t\t};\n\t\ttick();\n\t\tconst stop = () => {\n\t\t\tstopped = true;\n\t\t\tif (timer) clearTimeout(timer);\n\t\t};\n\t\tres.on(\"close\", stop);\n\t}\n\tasync function handleRequest(req, res) {\n\t\tconst url = new URL(req.url ?? \"/\", `http://127.0.0.1:${String(port)}`);\n\t\tconst method = req.method ?? \"GET\";\n\t\tconst segments = url.pathname.split(\"/\").filter((s) => s.length > 0).map((s) => decodeURIComponent(s));\n\t\tif (method === \"GET\" && segments.length === 1 && segments[0] === \"health\") return json(res, 200, { version: ownVersion });\n\t\tif (segments[0] === \"apps\" && segments.length >= 2) {\n\t\t\tconst app = segments[1];\n\t\t\tif (app === void 0 || !isValidSegment(app)) return badSegment(res, app ?? \"\");\n\t\t\tif (method === \"PUT\" && segments.length === 4 && segments[2] === \"services\") {\n\t\t\t\tconst id = segments[3];\n\t\t\t\tif (id === void 0 || !isValidSegment(id)) return badSegment(res, id ?? \"\");\n\t\t\t\tconst svc = await getOrCreateService(app, id);\n\t\t\t\treturn json(res, 200, {\n\t\t\t\t\tport: svc.port,\n\t\t\t\t\turl: `http://localhost:${String(svc.port)}`\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (method === \"PUT\" && segments.length === 5 && segments[2] === \"services\" && segments[4] === \"deployment\") {\n\t\t\t\tconst id = segments[3];\n\t\t\t\tif (id === void 0 || !isValidSegment(id)) return badSegment(res, id ?? \"\");\n\t\t\t\treturn handleDeployment(req, res, app, id);\n\t\t\t}\n\t\t\tif (method === \"GET\" && segments.length === 3 && segments[2] === \"services\") {\n\t\t\t\tconst appRec = state[app];\n\t\t\t\treturn json(res, 200, appRec ? Object.values(appRec.services).map(serviceView) : []);\n\t\t\t}\n\t\t\tif (method === \"GET\" && segments.length === 5 && segments[2] === \"services\" && segments[4] === \"logs\") {\n\t\t\t\tconst id = segments[3];\n\t\t\t\tif (id === void 0 || !isValidSegment(id)) return badSegment(res, id ?? \"\");\n\t\t\t\tconst svc = state[app]?.services[id];\n\t\t\t\tif (!svc) return text(res, 404, `no such service \"${id}\" in app \"${app}\"`);\n\t\t\t\tif (url.searchParams.get(\"follow\") === \"1\") {\n\t\t\t\t\thandleFollowLogs(res, svc.logPath);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst content = fs.existsSync(svc.logPath) ? fs.readFileSync(svc.logPath) : Buffer.alloc(0);\n\t\t\t\tres.writeHead(200, { \"content-type\": \"text/plain; charset=utf-8\" });\n\t\t\t\tres.end(content);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (method === \"POST\" && segments.length === 3 && segments[2] === \"stop\") {\n\t\t\t\tconst appRec = state[app];\n\t\t\t\tif (appRec) await Promise.all(Object.entries(appRec.services).map(([id, svc]) => stopService(svc, getRuntime(app, id))));\n\t\t\t\tres.writeHead(204);\n\t\t\t\tres.end();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (method === \"POST\" && segments.length === 3 && segments[2] === \"start\") {\n\t\t\t\tconst appRec = state[app];\n\t\t\t\tif (appRec) await Promise.all(Object.entries(appRec.services).map(([id, svc]) => startService(app, id, svc)));\n\t\t\t\tres.writeHead(204);\n\t\t\t\tres.end();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (method === \"DELETE\" && segments.length === 2) {\n\t\t\t\tconst appRec = state[app];\n\t\t\t\tif (appRec) {\n\t\t\t\t\tawait Promise.all(Object.entries(appRec.services).map(([id, svc]) => stopService(svc, getRuntime(app, id))));\n\t\t\t\t\tfor (const id of Object.keys(appRec.services)) {\n\t\t\t\t\t\tconst key = runtimeKey(app, id);\n\t\t\t\t\t\truntimes.get(key)?.log?.close();\n\t\t\t\t\t\truntimes.delete(key);\n\t\t\t\t\t}\n\t\t\t\t\tdelete state[app];\n\t\t\t\t\tschedulePersist();\n\t\t\t\t}\n\t\t\t\tawait fs.promises.rm(path.join(stateDir, \"logs\", app), {\n\t\t\t\t\trecursive: true,\n\t\t\t\t\tforce: true\n\t\t\t\t});\n\t\t\t\tres.writeHead(204);\n\t\t\t\tres.end();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tres.writeHead(404);\n\t\tres.end();\n\t}\n\tconst server = http.createServer((req, res) => {\n\t\thandleRequest(req, res).catch((err) => {\n\t\t\tif (!res.headersSent) res.writeHead(500, { \"content-type\": \"text/plain\" });\n\t\t\tres.end(err instanceof Error ? err.message : String(err));\n\t\t});\n\t});\n\tlet shuttingDown = false;\n\tasync function shutdown() {\n\t\tif (shuttingDown) return;\n\t\tshuttingDown = true;\n\t\tconst kills = [];\n\t\tfor (const rt of runtimes.values()) {\n\t\t\tclearBackoffTimer(rt);\n\t\t\tclearStableTimer(rt);\n\t\t\tif (rt.child) kills.push(killChild(rt, TERMINATE_GRACE_MS));\n\t\t}\n\t\tawait Promise.all(kills);\n\t\tawait stateFile.flush();\n\t\tserver.close();\n\t\tprocess.exit(0);\n\t}\n\tprocess.on(\"SIGTERM\", () => void shutdown());\n\tprocess.on(\"SIGINT\", () => void shutdown());\n\treadJsonFile(appsJsonPath, isAppsState).then((loaded) => {\n\t\tif (loaded) {\n\t\t\tfor (const appRec of Object.values(loaded)) for (const svc of Object.values(appRec.services)) if (svc.status === \"running\" || svc.status === \"backoff\") {\n\t\t\t\tsvc.status = \"stopped\";\n\t\t\t\tdelete svc.pid;\n\t\t\t}\n\t\t\tstate = loaded;\n\t\t}\n\t\tserver.listen(port, \"127.0.0.1\", () => {\n\t\t\tconsole.log(`[dev-emulators] compute-main listening on 127.0.0.1:${String(port)}`);\n\t\t});\n\t}).catch((err) => {\n\t\tconsole.error(\"compute-main: failed to load state\", err);\n\t\tprocess.exit(1);\n\t});\n}\nmain();\n//#endregion\nexport {};\n\n//# sourceMappingURL=compute-main.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,MAAM,mBAAmB;AACzB,MAAM,mBAAmB;AACzB,MAAM,qBAAqB;AAC3B,MAAM,mBAAmB;AACzB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