@prisma/composer-prisma-cloud 0.16.0 → 0.17.0-dev.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"control.mjs","names":["fs","path","os","REPORT_DEADLINE_MS","isRecord","os","isRecord","managementClientLayer","Builds.buildReporter","Prisma.ServiceKey","Prisma.providers","Prisma.ServiceKeyProvider","Prisma.claimDatabaseUrlKeys"],"sources":["../../../1-prisma-cloud/0-lowering/lowering/dist/artifact-CoKVIyRH.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/resources-CXUKkcyA.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/state.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/builds.mjs","../../../1-prisma-cloud/1-extensions/target/dist/control.mjs"],"sourcesContent":["import * as crypto from \"node:crypto\";\nimport * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport * as zlib from \"node:zlib\";\nimport { isWithin } from \"@internal/bundle-paths\";\n//#region src/compute/artifact.ts\n/**\n* Assembles a Prisma Compute artifact: the app-built bundle plus the\n* extension-printed bootstrap and manifest, tarred and gzipped deterministically\n* (fixed mtimes, sorted entry order) so an unchanged service noops on\n* redeploy — a rebuild is the only thing that changes the hash. Lives here\n* (not in @prisma/composer-prisma-cloud/control) because it needs node:fs/node:zlib,\n* which the extension's shipped src may never import (invariant 5).\n*/\n/** The content type every Composer compute artifact is uploaded with (a deterministic tar.gz). */\nconst ARTIFACT_CONTENT_TYPE = \"application/gzip\";\nconst MANIFEST_VERSION = \"1\";\n/** Finds main.js/main.mjs in a bundle dir when no explicit entry is given. */\nfunction resolveEntry(bundleDir, entry) {\n\tif (entry !== void 0) return entry;\n\tconst found = fs.readdirSync(bundleDir).find((f) => /^main\\.m?js$/.test(f));\n\tif (found === void 0) throw new Error(`no main.js/main.mjs found in bundle dir ${bundleDir}`);\n\treturn found;\n}\nfunction compareArchivePaths(left, right) {\n\treturn Buffer.compare(Buffer.from(left.relPath, \"utf8\"), Buffer.from(right.relPath, \"utf8\"));\n}\n/** All files and safe symlinks under `dir`, as dir-relative POSIX paths, in\n* sorted order. Symlinks are preserved as links — never dereferenced — after\n* their real target is proven to remain inside the bundle root. This accepts\n* framework-produced trees such as Next standalone while retaining ADR-0005's\n* boundary against packaging arbitrary files from the deploy machine. */\nfunction walkEntries(dir) {\n\tconst out = [];\n\tconst realRoot = fs.realpathSync(dir);\n\tconst visit = (sub) => {\n\t\tfor (const entry of fs.readdirSync(path.join(dir, sub), { withFileTypes: true })) {\n\t\t\tconst rel = sub.length > 0 ? `${sub}/${entry.name}` : entry.name;\n\t\t\tif (entry.isSymbolicLink()) {\n\t\t\t\tconst symlinkPath = path.join(dir, ...rel.split(\"/\"));\n\t\t\t\tconst target = fs.readlinkSync(symlinkPath);\n\t\t\t\tif (path.sep === \"/\" && target.includes(\"\\\\\")) throw new Error(`bundle symlink at ${rel} has an unsupported backslash target: ${target}`);\n\t\t\t\tlet realTarget;\n\t\t\t\ttry {\n\t\t\t\t\trealTarget = fs.realpathSync(path.resolve(path.dirname(symlinkPath), target));\n\t\t\t\t} catch {\n\t\t\t\t\tthrow new Error(`bundle symlink at ${rel} is dangling: ${target}`);\n\t\t\t\t}\n\t\t\t\tif (!isWithin(realRoot, realTarget)) throw new Error(`bundle symlink at ${rel} escapes the bundle root: ${target} — deploy artifacts may only preserve links whose targets are inside the assembled bundle.`);\n\t\t\t\tconst linkname = (path.isAbsolute(target) ? path.relative(fs.realpathSync(path.dirname(symlinkPath)), realTarget) : target).split(path.sep).join(\"/\");\n\t\t\t\tif (!isWithin(dir, path.resolve(path.dirname(symlinkPath), ...linkname.split(\"/\")))) throw new Error(`bundle symlink at ${rel} has a target that leaves the bundle: ${linkname} — its resolved target is inside the bundle, but the link path itself walks outside and re-enters, which every extractor rejects. Point the link at the in-bundle path directly.`);\n\t\t\t\tout.push({\n\t\t\t\t\trelPath: rel,\n\t\t\t\t\ttype: \"symlink\",\n\t\t\t\t\tlinkname\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (entry.isDirectory()) visit(rel);\n\t\t\telse if (entry.isFile()) {\n\t\t\t\tconst mode = fs.statSync(path.join(dir, ...rel.split(\"/\"))).mode;\n\t\t\t\tout.push({\n\t\t\t\t\trelPath: rel,\n\t\t\t\t\ttype: \"file\",\n\t\t\t\t\texecutable: (mode & 64) !== 0\n\t\t\t\t});\n\t\t\t} else throw new Error(`bundle contains an unsupported filesystem entry: ${rel}`);\n\t\t}\n\t};\n\tvisit(\"\");\n\treturn out.sort(compareArchivePaths);\n}\nfunction octal(value, length) {\n\treturn `${value.toString(8).padStart(length - 1, \"0\")}\\0`;\n}\n/** Splits a path into ustar's name (<=100 bytes) + prefix (<=155 bytes) fields. */\nfunction splitUstarPath(relPath) {\n\tif (Buffer.byteLength(relPath, \"utf8\") <= 100) return {\n\t\tname: relPath,\n\t\tprefix: \"\"\n\t};\n\tfor (let i = relPath.length - 1; i >= 0; i--) {\n\t\tif (relPath[i] !== \"/\") continue;\n\t\tconst prefix = relPath.slice(0, i);\n\t\tconst name = relPath.slice(i + 1);\n\t\tif (Buffer.byteLength(prefix, \"utf8\") <= 155 && Buffer.byteLength(name, \"utf8\") <= 100) return {\n\t\t\tname,\n\t\t\tprefix\n\t\t};\n\t}\n\tthrow new Error(`path too long for a ustar tar entry: ${relPath}`);\n}\nfunction paxRecord(key, value) {\n\tconst payload = ` ${key}=${value}\\n`;\n\tlet length = Buffer.byteLength(payload, \"utf8\") + 1;\n\twhile (true) {\n\t\tconst record = `${length}${payload}`;\n\t\tconst actualLength = Buffer.byteLength(record, \"utf8\");\n\t\tif (actualLength === length) return record;\n\t\tlength = actualLength;\n\t}\n}\nfunction ustarPathOrPlaceholder(relPath) {\n\ttry {\n\t\tsplitUstarPath(relPath);\n\t\treturn { path: relPath };\n\t} catch {\n\t\treturn {\n\t\t\tpath: `PaxEntries/${crypto.createHash(\"sha256\").update(relPath).digest(\"hex\").slice(0, 32)}`,\n\t\t\tpaxPath: relPath\n\t\t};\n\t}\n}\nfunction ustarHeader(relPath, size, options) {\n\tconst { name, prefix } = splitUstarPath(relPath);\n\tconst buf = Buffer.alloc(512);\n\tbuf.write(name, 0, 100, \"utf8\");\n\tbuf.write(octal(options.mode, 8), 100, 8, \"utf8\");\n\tbuf.write(octal(0, 8), 108, 8, \"utf8\");\n\tbuf.write(octal(0, 8), 116, 8, \"utf8\");\n\tbuf.write(octal(size, 12), 124, 12, \"utf8\");\n\tbuf.write(octal(0, 12), 136, 12, \"utf8\");\n\tbuf.write(\" \", 148, 8, \"utf8\");\n\tbuf.write(options.typeflag, 156, 1, \"utf8\");\n\tif (options.linkname !== void 0) buf.write(options.linkname, 157, 100, \"utf8\");\n\tbuf.write(\"ustar\\0\", 257, 6, \"utf8\");\n\tbuf.write(\"00\", 263, 2, \"utf8\");\n\tbuf.write(prefix, 345, 155, \"utf8\");\n\tlet sum = 0;\n\tfor (const b of buf) sum += b;\n\tbuf.write(`${sum.toString(8).padStart(6, \"0\")}\\0 `, 148, 8, \"utf8\");\n\treturn buf;\n}\nfunction createDeterministicTarGz(entries) {\n\tconst sorted = [...entries].sort(compareArchivePaths);\n\tconst chunks = [];\n\tfor (const entry of sorted) {\n\t\tconst archivePath = ustarPathOrPlaceholder(entry.relPath);\n\t\tconst pax = [archivePath.paxPath === void 0 ? \"\" : paxRecord(\"path\", archivePath.paxPath)];\n\t\tif (entry.type === \"symlink\" && Buffer.byteLength(entry.linkname, \"utf8\") > 100) pax.push(paxRecord(\"linkpath\", entry.linkname));\n\t\tconst paxContent = Buffer.from(pax.join(\"\"), \"utf8\");\n\t\tif (paxContent.length > 0) {\n\t\t\tconst digest = crypto.createHash(\"sha256\").update(entry.relPath).digest(\"hex\").slice(0, 32);\n\t\t\tchunks.push(ustarHeader(`PaxHeaders/${digest}`, paxContent.length, {\n\t\t\t\tmode: 420,\n\t\t\t\ttypeflag: \"x\"\n\t\t\t}));\n\t\t\tchunks.push(paxContent);\n\t\t\tconst paxPad = (512 - paxContent.length % 512) % 512;\n\t\t\tif (paxPad > 0) chunks.push(Buffer.alloc(paxPad));\n\t\t}\n\t\tif (entry.type === \"symlink\") chunks.push(ustarHeader(archivePath.path, 0, {\n\t\t\tmode: 511,\n\t\t\ttypeflag: \"2\",\n\t\t\tlinkname: Buffer.byteLength(entry.linkname, \"utf8\") <= 100 ? entry.linkname : \"././@LongSymLink\"\n\t\t}));\n\t\telse {\n\t\t\tchunks.push(ustarHeader(archivePath.path, entry.content.length, {\n\t\t\t\tmode: entry.mode,\n\t\t\t\ttypeflag: \"0\"\n\t\t\t}));\n\t\t\tchunks.push(entry.content);\n\t\t\tconst pad = (512 - entry.content.length % 512) % 512;\n\t\t\tif (pad > 0) chunks.push(Buffer.alloc(pad));\n\t\t}\n\t}\n\tchunks.push(Buffer.alloc(1024));\n\treturn zlib.gzipSync(Buffer.concat(chunks));\n}\n/**\n* Prints the bootstrap + manifest and tars them with the bundle into a\n* deterministic artifact. If bundleDir doesn't exist (e.g. `alchemy destroy`\n* run before any build), returns a placeholder rather than throwing — the\n* artifact is never read on destroy.\n*/\nfunction packageComputeArtifact(opts) {\n\tif (!fs.existsSync(opts.bundleDir)) return {\n\t\tpath: \"\",\n\t\tsha256: \"absent\"\n\t};\n\tconst entryFile = resolveEntry(opts.bundleDir, opts.bundleEntry);\n\tconst bootstrapData = `${JSON.stringify({\n\t\tmoduleEntrypoint: `./${entryFile}`,\n\t\tappEntrypoint: `./${opts.appEntry}`,\n\t\taddress: opts.address\n\t}, null, 2)}\\n`;\n\tconst bootstrap = `import { readFile } from \"node:fs/promises\";\n\nconst boot = JSON.parse(\n await readFile(new URL(\"./compute.bootstrap.json\", import.meta.url), \"utf8\"),\n);\n\n// Compute currently boots JavaScript with Bun. Its URL and URLSearchParams\n// implementations accept Object.defineProperty but reject assignment to\n// Node's custom-inspect symbol. SvelteKit assigns that symbol while creating a\n// tracked request URL, so install a narrow setter that materializes the same\n// own property Node would. Remove this compatibility shim when the upstream\n// Alchemy Compute runtime owns the equivalent normalization.\nif (process.versions.bun !== undefined) {\n const inspect = Symbol.for(\"nodejs.util.inspect.custom\");\n for (const constructor of [URL, URLSearchParams]) {\n const inherited = constructor.prototype[inspect];\n Object.defineProperty(constructor.prototype, inspect, {\n configurable: true,\n get() { return inherited; },\n set(value) {\n Object.defineProperty(this, inspect, { configurable: true, value, writable: true });\n },\n });\n }\n}\n\nconst main = (await import(boot.moduleEntrypoint)).default;\nawait main.run(boot.address, () => import(boot.appEntrypoint));\n`;\n\tconst manifest = `${JSON.stringify({\n\t\tmanifestVersion: MANIFEST_VERSION,\n\t\tentrypoint: \"bootstrap.js\",\n\t\taddress: opts.address\n\t}, null, 2)}\\n`;\n\tconst files = walkEntries(opts.bundleDir).map((entry) => entry.type === \"symlink\" ? entry : {\n\t\trelPath: entry.relPath,\n\t\ttype: \"file\",\n\t\tcontent: fs.readFileSync(path.join(opts.bundleDir, ...entry.relPath.split(\"/\"))),\n\t\tmode: entry.executable ? 493 : 420\n\t});\n\tfiles.push({\n\t\trelPath: \"bootstrap.js\",\n\t\ttype: \"file\",\n\t\tcontent: Buffer.from(bootstrap, \"utf8\"),\n\t\tmode: 420\n\t});\n\tfiles.push({\n\t\trelPath: \"compute.bootstrap.json\",\n\t\ttype: \"file\",\n\t\tcontent: Buffer.from(bootstrapData, \"utf8\"),\n\t\tmode: 420\n\t});\n\tfiles.push({\n\t\trelPath: \"compute.manifest.json\",\n\t\ttype: \"file\",\n\t\tcontent: Buffer.from(manifest, \"utf8\"),\n\t\tmode: 420\n\t});\n\tfiles.push({\n\t\trelPath: \"bunfig.toml\",\n\t\ttype: \"file\",\n\t\tcontent: Buffer.from(\"[install]\\nauto = \\\"disable\\\"\\n\", \"utf8\"),\n\t\tmode: 420\n\t});\n\tconst gz = createDeterministicTarGz(files);\n\tconst sha256 = crypto.createHash(\"sha256\").update(gz).digest(\"hex\");\n\tconst outDir = path.join(os.tmpdir(), `prisma-composer-compute-${String(os.userInfo().uid)}`, sha256.slice(0, 16));\n\tfs.mkdirSync(outDir, { recursive: true });\n\tconst outPath = path.join(outDir, `${opts.id}.tar.gz`);\n\tconst tmpPath = path.join(outDir, `.${opts.id}.${crypto.randomUUID()}.tmp`);\n\tfs.writeFileSync(tmpPath, gz);\n\tfs.renameSync(tmpPath, outPath);\n\treturn {\n\t\tpath: outPath,\n\t\tsha256\n\t};\n}\n//#endregion\nexport { packageComputeArtifact as n, ARTIFACT_CONTENT_TYPE as t };\n\n//# sourceMappingURL=artifact-CoKVIyRH.mjs.map","//#region src/builds/api.ts\n/**\n* Reporting is observability, so no call may stall the deploy: every request\n* carries this deadline, and an expired one is warned and dropped like any\n* other failure.\n*/\nconst REPORT_DEADLINE_MS = 1e4;\nfunction buildsApi(options) {\n\tconst { client, warn } = options;\n\t/** Runs one call, turning every failure — transport or refusal — into a warning and `undefined`. */\n\tconst send = async (call, describe) => {\n\t\tlet result;\n\t\ttry {\n\t\t\tresult = await call();\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\twarn(`Could not reach Prisma Cloud to ${describe}: ${detail}`);\n\t\t\treturn;\n\t\t}\n\t\tif (!result.response.ok) {\n\t\t\tconst detail = result.error === void 0 ? \"\" : `: ${JSON.stringify(result.error)}`;\n\t\t\twarn(`Prisma Cloud refused to ${describe} (HTTP ${String(result.response.status)})${detail}`);\n\t\t\treturn;\n\t\t}\n\t\treturn result.data ?? {};\n\t};\n\treturn {\n\t\tasync create(body) {\n\t\t\tconst created = await send(() => client.POST(\"/v1/builds\", {\n\t\t\t\tbody,\n\t\t\t\tsignal: AbortSignal.timeout(REPORT_DEADLINE_MS)\n\t\t\t}), \"record this deploy\");\n\t\t\tif (created === void 0) return void 0;\n\t\t\tconst id = created.data?.id;\n\t\t\tif (id === void 0 || id.length === 0) {\n\t\t\t\twarn(\"Prisma Cloud recorded this deploy but returned no build id.\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn id;\n\t\t},\n\t\tasync update(id, body) {\n\t\t\treturn await send(() => client.PATCH(\"/v1/builds/{buildId}\", {\n\t\t\t\tparams: { path: { buildId: id } },\n\t\t\t\tbody,\n\t\t\t\tsignal: AbortSignal.timeout(REPORT_DEADLINE_MS)\n\t\t\t}), \"update this deploy's build\") !== void 0;\n\t\t},\n\t\tasync reportResource(id, resourceType, resourceId, action) {\n\t\t\treturn await send(() => client.PUT(\"/v1/builds/{buildId}/resources/{resourceType}/{resourceId}\", {\n\t\t\t\tparams: { path: {\n\t\t\t\t\tbuildId: id,\n\t\t\t\t\tresourceType,\n\t\t\t\t\tresourceId\n\t\t\t\t} },\n\t\t\t\tbody: { action },\n\t\t\t\tsignal: AbortSignal.timeout(REPORT_DEADLINE_MS)\n\t\t\t}), `record the ${resourceType} this deploy ${action === \"acted_on\" ? \"acted on\" : action}`) !== void 0;\n\t\t}\n\t};\n}\n//#endregion\n//#region src/builds/resources.ts\n/** Names the build a run belongs to. Set by the CLI on the alchemy child, or by a CI runner that created the build itself. */\nconst BUILD_ID_ENV = \"PRISMA_BUILD_ID\";\n/**\n* Alchemy resource type → platform resource type, keyed by upstream\n* `alchemy/Prisma`'s type-ids and attribute names — the shapes the state\n* store actually writes since the upstream provider adoption.\n*\n* Two resources are deliberately absent. `Prisma.BucketAccessKey` has no\n* platform resource type to map onto. `PrismaCloud.ServiceKey` is a value\n* this deploy mints locally, not a platform resource at all — the platform's\n* `service_key` is what `Prisma.Connection` creates.\n*\n* Anything not listed — `PgWarm`, and every resource another extension\n* contributes — is not a Prisma Cloud resource and is not reported.\n*/\nconst PLATFORM_RESOURCES = {\n\t\"Prisma.Project\": {\n\t\ttype: \"project\",\n\t\tidField: \"projectId\"\n\t},\n\t\"Prisma.Database\": {\n\t\ttype: \"database\",\n\t\tidField: \"databaseId\"\n\t},\n\t\"Prisma.Connection\": {\n\t\ttype: \"service_key\",\n\t\tidField: \"connectionId\"\n\t},\n\t\"Prisma.Bucket\": {\n\t\ttype: \"bucket\",\n\t\tidField: \"bucketId\"\n\t},\n\t\"Prisma.App\": {\n\t\ttype: \"app\",\n\t\tidField: \"appId\"\n\t},\n\t\"Prisma.Deployment\": {\n\t\ttype: \"deployment\",\n\t\tidField: \"deploymentId\"\n\t},\n\t\"Prisma.EnvironmentVariable\": {\n\t\ttype: \"config_variable\",\n\t\tidField: \"environmentVariableId\"\n\t}\n};\n/**\n* Terminal status → what the run did to the resource. The intermediate\n* statuses (`creating`, `updating`, `replacing`) are skipped: they say work\n* started, not that it landed, and the terminal write follows immediately.\n*\n* `updated` maps to `acted_on` rather than to nothing, because a reconcile\n* that changed no field is still this run acting on that resource — a\n* migration against an untouched database is an action on it.\n*/\nconst ACTION_BY_STATUS = {\n\tcreated: \"created\",\n\tupdated: \"acted_on\",\n\tdeleting: \"deleted\"\n};\nconst isRecord = (value) => typeof value === \"object\" && value !== null;\n/**\n* What a persisted state record says this run did, or `undefined` when it\n* says nothing reportable. Reads defensively: the record crosses a wire and\n* carries resources from every extension, not only this one's.\n*/\nfunction reportableResource(value) {\n\tif (!isRecord(value)) return void 0;\n\tif (value[\"kind\"] === \"action\") return void 0;\n\tif (value[\"adopting\"] === true) return void 0;\n\tconst resourceType = value[\"resourceType\"];\n\tif (typeof resourceType !== \"string\") return void 0;\n\tconst mapping = PLATFORM_RESOURCES[resourceType];\n\tif (mapping === void 0) return void 0;\n\tconst status = value[\"status\"];\n\tconst action = typeof status === \"string\" ? ACTION_BY_STATUS[status] : void 0;\n\tif (action === void 0) return void 0;\n\tconst attr = value[\"attr\"];\n\tif (!isRecord(attr)) return void 0;\n\tconst id = attr[mapping.idField];\n\tif (typeof id !== \"string\" || id.length === 0) return void 0;\n\treturn {\n\t\ttype: mapping.type,\n\t\tid,\n\t\taction\n\t};\n}\n/**\n* The most a drain will wait, total. Every real report already carries the\n* api layer's per-request deadline, so this never fires for the shipped\n* `BuildsApi`; it is the backstop that keeps the state layer's finalizer —\n* and therefore the deploy lease release — bounded against any implementation.\n*/\nconst DRAIN_DEADLINE_MS = 15e3;\nfunction resourceReporter(api, buildId, warn = (message) => console.warn(message), drainDeadlineMs = DRAIN_DEADLINE_MS) {\n\tconst inFlight = /* @__PURE__ */ new Set();\n\tconst reported = /* @__PURE__ */ new Set();\n\treturn {\n\t\tobserve(value) {\n\t\t\tconst resource = reportableResource(value);\n\t\t\tif (resource === void 0) return;\n\t\t\tconst key = `${resource.type}:${resource.id}:${resource.action}`;\n\t\t\tif (reported.has(key)) return;\n\t\t\treported.add(key);\n\t\t\tconst sent = api.reportResource(buildId, resource.type, resource.id, resource.action).finally(() => inFlight.delete(sent));\n\t\t\tinFlight.add(sent);\n\t\t},\n\t\tasync drain() {\n\t\t\tconst deadline = Date.now() + drainDeadlineMs;\n\t\t\twhile (inFlight.size > 0) {\n\t\t\t\tconst remaining = deadline - Date.now();\n\t\t\t\tif (remaining <= 0) {\n\t\t\t\t\twarn(`Abandoned ${inFlight.size} in-flight resource report(s) after ${drainDeadlineMs}ms.`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tawait Promise.race([Promise.allSettled([...inFlight]), new Promise((resolve) => setTimeout(resolve, remaining).unref?.())]);\n\t\t\t\tif (Date.now() >= deadline && inFlight.size > 0) {\n\t\t\t\t\twarn(`Abandoned ${inFlight.size} in-flight resource report(s) after ${drainDeadlineMs}ms.`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n}\n//#endregion\nexport { buildsApi as i, reportableResource as n, resourceReporter as r, BUILD_ID_ENV as t };\n\n//# sourceMappingURL=resources-CXUKkcyA.mjs.map","import { n as fromEnv, r as managementApiBaseUrl, t as PrismaCredentials } from \"./credentials-DhT4a38W.mjs\";\nimport { c as collectPages, d as PrismaApiError, f as call, m as layer, p as ManagementClient, s as resolveDefaultBranchId, t as RESERVED_DATABASE_URL_KEYS } from \"./database-url-claim-m_nGXIHa.mjs\";\nimport { t as ARTIFACT_CONTENT_TYPE } from \"./artifact-CoKVIyRH.mjs\";\nimport { i as buildsApi, r as resourceReporter, t as BUILD_ID_ENV } from \"./resources-CXUKkcyA.mjs\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as Data from \"effect/Data\";\nimport * as os from \"node:os\";\nimport { Stack } from \"alchemy\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport { State, makeHttpStateStore } from \"alchemy/State\";\nimport * as FetchHttpClient from \"effect/unstable/http/FetchHttpClient\";\nimport * as HttpClientRequest from \"effect/unstable/http/HttpClientRequest\";\nimport * as Headers from \"effect/unstable/http/Headers\";\n//#region src/builds/state-store.ts\n/**\n* Reports on the way out of a successful `set`, never before it: a write that\n* failed leaves the resource unrecorded here, and claiming otherwise would\n* make the build's provenance a guess.\n*/\nfunction withResourceReporting(inner, api, buildId, warn) {\n\tconst reporter = resourceReporter(api, buildId, warn);\n\treturn {\n\t\tstore: {\n\t\t\t...inner,\n\t\t\tset(request) {\n\t\t\t\treturn inner.set(request).pipe(Effect.tap(() => Effect.sync(() => reporter.observe(request.value))));\n\t\t\t}\n\t\t},\n\t\treporter\n\t};\n}\n//#endregion\n//#region src/state/empty-scope.ts\n/**\n* Whether the platform state API holds any resources for (stack, stage).\n* Requires the live deploy lease — the listing runs under it, like every\n* state operation.\n*/\nconst scopeOccupied = (client, scope, lease) => call(() => client.GET(\"/v1/projects/{projectId}/branches/{branchId}/alchemy-state/state/stacks/{stack}/stages/{stage}/resources\", { params: {\n\tpath: {\n\t\tprojectId: scope.projectId,\n\t\tbranchId: scope.branchId,\n\t\tstack: scope.stack,\n\t\tstage: scope.stage\n\t},\n\theader: { \"alchemy-state-lease-id\": Redacted.value(lease.leaseId) }\n} })).pipe(Effect.map((fqns) => fqns.length > 0));\nconst listBranchResources = (client, projectId, branchId) => Effect.gen(function* () {\n\tconst query = (cursor) => cursor === void 0 ? {\n\t\tprojectId,\n\t\tbranchId\n\t} : {\n\t\tprojectId,\n\t\tbranchId,\n\t\tcursor\n\t};\n\tconst apps = yield* collectPages(`apps on branch ${branchId}`, (cursor) => call(() => client.GET(\"/v1/apps\", { params: { query: query(cursor) } })));\n\tconst databases = yield* collectPages(`databases on branch ${branchId}`, (cursor) => call(() => client.GET(\"/v1/databases\", { params: { query: query(cursor) } })));\n\tconst buckets = yield* collectPages(`buckets on branch ${branchId}`, (cursor) => call(() => client.GET(\"/v1/buckets\", { params: { query: query(cursor) } })));\n\treturn [\n\t\t...apps.map((r) => ({\n\t\t\tkind: \"app\",\n\t\t\tname: r.name\n\t\t})),\n\t\t...databases.map((r) => ({\n\t\t\tkind: \"database\",\n\t\t\tname: r.name\n\t\t})),\n\t\t...buckets.map((r) => ({\n\t\t\tkind: \"bucket\",\n\t\t\tname: r.name\n\t\t}))\n\t];\n});\n/**\n* The empty-scope-with-live-resources case: the platform state API holds no\n* resources for (stack, stage) while the platform already has Compute apps,\n* databases, or buckets on the target Branch — this stage predates the\n* platform state API (its state lives in a legacy `prisma-composer-state`\n* database, which is never read; there is no automatic migration), or the\n* deploy targets a project that already runs something. Deploying would\n* recreate every resource and die in per-resource `already_exists` failures —\n* so fail once, up front. A genuinely fresh deploy sees an empty Branch and\n* passes. Connections are not counted: they are children of databases, which\n* are. Local dev never reaches this — the dev stack pins\n* `state: localState()` (generate-dev-stack.ts).\n*/\nconst failOnEmptyScopeWithLiveResources = (projectId, branchId, stack, stage) => Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\tconst resources = yield* listBranchResources(client, projectId, branchId);\n\tif (resources.length === 0) return;\n\tconst names = resources.map((r) => `${r.kind} \"${r.name}\"`).join(\", \");\n\treturn yield* Effect.fail(new PrismaApiError({\n\t\tstatus: 0,\n\t\tmessage: `the platform state API holds no deploy state for stage \"${stage}\" (stack \"${stack}\"), but the platform already has ${String(resources.length)} resource(s) on the target branch ${branchId}: ${names}. This stage predates the platform state API. With no state, a deploy would recreate every resource and fail with already_exists, and a destroy would remove nothing. Destroy the stage with the previous version of composer, or delete the stage (its branch — or the project, for production) in the Prisma Console or via the Management API — then redeploy fresh. If those resources are another deployment's, remove them or deploy into a different project. Then retry.`\n\t}));\n});\n//#endregion\n//#region src/state/errors.ts\n/**\n* An operator-facing failure from the hosted-state bootstrap pipeline\n* (branch resolution, lease acquisition, or the migration guard) — what a\n* deployer actually sees, instead of a raw Effect defect.\n*/\nvar HostedStateBootstrapError = class extends Data.TaggedError(\"HostedStateBootstrapError\") {\n\tget message() {\n\t\treturn `hosted-state bootstrap failed in ${this.container}: ${this.step} — ${this.reason}`;\n\t}\n};\n/**\n* Builds a {@link HostedStateBootstrapError} from whatever the failed step\n* threw. Never retains the raw API error object as `cause`: only the\n* extracted message text survives into the operator-facing error, so a\n* credential or lease id carried on the raw error can never leak.\n*/\nconst hostedStateBootstrapError = (container, step, cause) => new HostedStateBootstrapError({\n\tcontainer,\n\tstep,\n\treason: cause instanceof Error ? cause.message : String(cause)\n});\n//#endregion\n//#region src/state/lease.ts\n/** The header every state operation and lease call carries. Its value is a capability token — never log it. */\nconst LEASE_HEADER = \"Alchemy-State-Lease-Id\";\n/**\n* Adds the lease header to effect's redacted header names (alongside the\n* defaults such as `authorization`), so a logged failed request renders the\n* lease id as `<redacted>`. Merged into the state layer's outputs.\n*/\nconst redactLeaseHeader = Layer.effect(Headers.CurrentRedactedNames, Effect.gen(function* () {\n\treturn [...yield* Headers.CurrentRedactedNames, LEASE_HEADER];\n}));\nconst LEASE_PATH = \"/v1/projects/{projectId}/branches/{branchId}/alchemy-state/lease\";\n/** The server names the current holder in its 409 message; pass it through verbatim, hint appended. */\nconst serverErrorText = (error) => error.error.hint === void 0 ? error.error.message : `${error.error.message} ${error.error.hint}`;\nconst transportError = (cause) => new PrismaApiError({\n\tstatus: 0,\n\tmessage: String(cause)\n});\n/** Best-effort `user@host`, echoed in the contention error a blocked deploy sees. */\nconst holderDescription = () => {\n\ttry {\n\t\treturn `${os.userInfo().username}@${os.hostname()}`;\n\t} catch {\n\t\treturn \"unknown\";\n\t}\n};\n/**\n* Acquires the (stack, stage) deploy lease. Contention (409) fails fast with\n* the server's message naming the current holder — no queueing, no retry.\n* The server's default TTL (60s) applies; no `ttlSeconds` is sent.\n*/\nconst acquireDeployLease = (client, scope) => Effect.tryPromise({\n\ttry: () => client.POST(LEASE_PATH, {\n\t\tparams: { path: {\n\t\t\tprojectId: scope.projectId,\n\t\t\tbranchId: scope.branchId\n\t\t} },\n\t\tbody: {\n\t\t\tstack: scope.stack,\n\t\t\tstage: scope.stage,\n\t\t\tholderDescription: holderDescription()\n\t\t}\n\t}),\n\tcatch: transportError\n}).pipe(Effect.flatMap((r) => {\n\tconst status = r.response.status;\n\tif (r.error !== void 0) return Effect.fail(new PrismaApiError({\n\t\tstatus,\n\t\tmessage: serverErrorText(r.error)\n\t}));\n\tif (r.data !== void 0) return Effect.succeed({\n\t\tleaseId: Redacted.make(r.data.data.leaseId),\n\t\texpiresAt: r.data.data.expiresAt\n\t});\n\treturn Effect.fail(new PrismaApiError({\n\t\tstatus,\n\t\tmessage: `lease acquisition returned HTTP ${String(status)} with no error body`\n\t}));\n}));\n/**\n* Extends the lease on a fixed cadence (TTL/3) until interrupted. A 404 means\n* the lease was lost — log one loud warning and stop; enforcement is\n* server-side, so the run's next state operation fails with 409. Any other\n* heartbeat failure is ignored and the next tick retries; the heartbeat never\n* fails the run.\n*/\nconst heartbeatDeployLease = (client, scope, lease, every = \"20 seconds\") => Effect.gen(function* () {\n\twhile (true) {\n\t\tyield* Effect.sleep(every);\n\t\tif ((yield* Effect.tryPromise(() => client.PATCH(LEASE_PATH, { params: {\n\t\t\tpath: {\n\t\t\t\tprojectId: scope.projectId,\n\t\t\t\tbranchId: scope.branchId\n\t\t\t},\n\t\t\theader: { \"alchemy-state-lease-id\": Redacted.value(lease.leaseId) }\n\t\t} })).pipe(Effect.map((r) => r.response.status), Effect.catch(() => Effect.succeed(0)))) === 404) {\n\t\t\tyield* Effect.logWarning(`the deploy lease for stage \"${scope.stage}\" was lost (heartbeat returned 404) — another deploy may have taken over; the next state operation of this run will fail.`);\n\t\t\treturn;\n\t\t}\n\t}\n});\n/**\n* Releases the lease on clean exit. Never fails: a 404 (lease already\n* expired or replaced) or any other failure is logged, not thrown — the run\n* already completed.\n*/\nconst releaseDeployLease = (client, scope, lease) => Effect.tryPromise(() => client.DELETE(LEASE_PATH, { params: {\n\tpath: {\n\t\tprojectId: scope.projectId,\n\t\tbranchId: scope.branchId\n\t},\n\theader: { \"alchemy-state-lease-id\": Redacted.value(lease.leaseId) }\n} })).pipe(Effect.flatMap((r) => {\n\tconst status = r.response.status;\n\tif (status === 404) return Effect.logWarning(`releasing the deploy lease for stage \"${scope.stage}\" returned 404 — it had already expired or been replaced.`);\n\tif (status >= 200 && status < 300) return Effect.void;\n\treturn Effect.logWarning(`releasing the deploy lease for stage \"${scope.stage}\" returned HTTP ${String(status)} — the lease stays live until its TTL expires.`);\n}), Effect.catch((cause) => Effect.logWarning(`releasing the deploy lease for stage \"${scope.stage}\" failed: ${String(cause)}`)));\n//#endregion\n//#region src/state/legacy-resources.ts\n/**\n* One-time, on-read rewrite of legacy Composer state rows into the shapes\n* upstream alchemy's `Prisma.*` providers expect, so their `read`/`diff`\n* adopts the deployed resources instead of planning a create. Old rows carry\n* hand-rolled attributes (`{id, name}`, `{id, connectionString}`, …); upstream\n* expects `{projectId, …}` / `{databaseId, …}` / etc. Fields old rows never\n* carried are left absent — upstream recomputes them from observed API state.\n* Legacy `DATABASE_URL` claim rows are retired ({@link retireDatabaseUrlClaimRow}).\n*\n* Operator-visible one-time effects of the first migrated deploy (branch-stage\n* database rename + default-connection rotation, one fresh deployment per\n* service) are documented in docs/guides/deploying.md. Hosted state only:\n* local dev state is cleared with `prisma-composer dev --fresh` instead.\n*/\nconst isRecord = (value) => typeof value === \"object\" && value !== null;\nconst EPOCH = \"1970-01-01T00:00:00.000Z\";\n/** Where a legacy row recorded no region: the only region Composer's descriptors ever defaulted to. */\nconst DEFAULT_REGION = \"us-east-1\";\n/**\n* The reserved keys older Composer versions claimed through tracked\n* EnvironmentVariable resources. Today the claim is a create-only API call\n* outside deploy state (database-url-claim.ts, whose key set this is), so the\n* tracked rows those versions left behind are disposed of here.\n*/\nconst CLAIMED_DATABASE_URL_KEYS = new Set(RESERVED_DATABASE_URL_KEYS);\nconst FAMILY_BY_LEGACY_TYPE = {\n\t\"Prisma.Project\": \"Project\",\n\t\"Prisma.Database\": \"Database\",\n\t\"Prisma.Connection\": \"Connection\",\n\t\"Prisma.ComputeService\": \"App\",\n\t\"Prisma.Deployment\": \"Deployment\",\n\t\"Prisma.EnvironmentVariable\": \"EnvironmentVariable\",\n\t\"Prisma.Bucket\": \"Bucket\",\n\t\"Prisma.BucketKey\": \"BucketAccessKey\",\n\t\"PrismaComposer.Project\": \"Project\",\n\t\"PrismaComposer.Database\": \"Database\",\n\t\"PrismaComposer.Connection\": \"Connection\",\n\t\"PrismaComposer.ComputeService\": \"App\",\n\t\"PrismaComposer.Deployment\": \"Deployment\",\n\t\"PrismaComposer.EnvironmentVariable\": \"EnvironmentVariable\",\n\t\"PrismaComposer.Bucket\": \"Bucket\",\n\t\"PrismaComposer.BucketKey\": \"BucketAccessKey\"\n};\n/** The type-id upstream registers each family under. */\nconst UPSTREAM_TYPE = {\n\tProject: \"Prisma.Project\",\n\tDatabase: \"Prisma.Database\",\n\tConnection: \"Prisma.Connection\",\n\tApp: \"Prisma.App\",\n\tDeployment: \"Prisma.Deployment\",\n\tEnvironmentVariable: \"Prisma.EnvironmentVariable\",\n\tBucket: \"Prisma.Bucket\",\n\tBucketAccessKey: \"Prisma.BucketAccessKey\"\n};\n/**\n* Four of the six families keep the type-id they always had, so the type-id\n* alone cannot say whether a row is legacy or already upstream's. Each shape\n* is told apart by a props field only the legacy one has, which is also what\n* makes the whole rewrite idempotent.\n*/\nconst isLegacyProps = (family, props) => {\n\tswitch (family) {\n\t\tcase \"Project\": return \"workspaceId\" in props;\n\t\tcase \"Database\": return \"projectId\" in props && !(\"project\" in props);\n\t\tcase \"Connection\": return \"databaseId\" in props && !(\"database\" in props);\n\t\tcase \"App\": return \"projectId\" in props && !(\"project\" in props);\n\t\tcase \"Deployment\": return \"computeServiceId\" in props;\n\t\tcase \"EnvironmentVariable\": return \"projectId\" in props && !(\"project\" in props);\n\t\tcase \"Bucket\": return \"projectId\" in props && !(\"project\" in props);\n\t\tcase \"BucketAccessKey\": return \"bucketId\" in props && !(\"bucket\" in props);\n\t}\n};\nconst migrateProps = (family, props) => {\n\tif (!isRecord(props) || !isLegacyProps(family, props)) return props;\n\tswitch (family) {\n\t\tcase \"Project\": return { name: props[\"name\"] };\n\t\tcase \"Database\": return {\n\t\t\tproject: props[\"projectId\"],\n\t\t\tname: props[\"name\"],\n\t\t\tregion: props[\"region\"],\n\t\t\t...props[\"branchId\"] !== void 0 ? { branchId: props[\"branchId\"] } : {}\n\t\t};\n\t\tcase \"Connection\": return {\n\t\t\tdatabase: props[\"databaseId\"],\n\t\t\tname: props[\"name\"]\n\t\t};\n\t\tcase \"App\": return {\n\t\t\tproject: props[\"projectId\"],\n\t\t\tdisplayName: props[\"name\"],\n\t\t\tregionId: props[\"region\"] ?? DEFAULT_REGION,\n\t\t\t...props[\"branchId\"] !== void 0 ? { branchId: props[\"branchId\"] } : {}\n\t\t};\n\t\tcase \"Deployment\": return {\n\t\t\tapp: props[\"computeServiceId\"],\n\t\t\tartifactPath: props[\"artifactPath\"],\n\t\t\tartifactContentType: ARTIFACT_CONTENT_TYPE,\n\t\t\t...props[\"port\"] !== void 0 ? { portMapping: { http: props[\"port\"] } } : {},\n\t\t\tstart: true,\n\t\t\tpromote: true\n\t\t};\n\t\tcase \"EnvironmentVariable\": {\n\t\t\tconst value = props[\"value\"];\n\t\t\treturn {\n\t\t\t\tproject: props[\"projectId\"],\n\t\t\t\tkey: props[\"key\"],\n\t\t\t\tclass: props[\"class\"] ?? \"production\",\n\t\t\t\tvalue: Redacted.isRedacted(value) ? value : Redacted.make(String(value ?? \"\")),\n\t\t\t\t...props[\"branchId\"] !== void 0 ? { branchId: props[\"branchId\"] } : {}\n\t\t\t};\n\t\t}\n\t\tcase \"Bucket\": return {\n\t\t\tproject: props[\"projectId\"],\n\t\t\tname: props[\"name\"],\n\t\t\t...props[\"branchId\"] !== void 0 ? { branchId: props[\"branchId\"] } : {}\n\t\t};\n\t\tcase \"BucketAccessKey\": return {\n\t\t\tbucket: props[\"bucketId\"],\n\t\t\tname: props[\"name\"],\n\t\t\trole: props[\"role\"]\n\t\t};\n\t}\n};\n/**\n* A legacy claim row (an EnvironmentVariable resource an older Composer\n* persisted for a reserved DATABASE_URL key) names a variable Composer must\n* stop managing. Deleting one\n* for real is not safe: the legacy adoption matched on `{projectId, class,\n* key}` with no branch id, so the recorded scope may not equal the live\n* variable's, and upstream's delete refuses — loudly, mid-deploy — on a scope\n* mismatch. Whether the live variable is the platform's own system-managed\n* template or the `\"-\"` placeholder Composer wrote over it depends on the\n* stage, and neither is Composer's to remove.\n*\n* Two halves, doing different jobs:\n*\n* · `removalPolicy: \"retain\"` on the ROW. Alchemy's engine honors it before\n* the provider is ever consulted: it drops the state row, makes no API\n* call, and reports the resource as `retained` rather than `deleted` —\n* which is the truthful verb, and the one an operator reading the deploy\n* log needs to see.\n* · An `environmentVariableId` the engine reads as \"not a cloud resource\"\n* (`isPrismaDevId`). This governs what the PROVIDER would do if it were\n* ever handed these attributes on some other path: nothing.\n*/\nconst retireDatabaseUrlClaimRow = (row, key) => ({\n\t...row,\n\tremovalPolicy: \"retain\",\n\tattr: {\n\t\tenvironmentVariableId: `dev:legacy-claim-${key}`,\n\t\tkey\n\t}\n});\n/**\n* The reserved key a legacy claim row named, from whichever half of the row still carries it\n* — for LEGACY rows only. Upstream's own `EnvironmentVariable` rows share this\n* type-id, so without the props-shape check a live, upstream-managed\n* `DATABASE_URL` variable would be retired from state on every read.\n*/\nconst claimedKeyOf = (family, props, attr) => {\n\tif (family !== \"EnvironmentVariable\") return void 0;\n\tif (!isRecord(props) || !isLegacyProps(family, props)) return void 0;\n\tconst fromAttr = isRecord(attr) ? attr[\"key\"] : void 0;\n\tconst fromProps = isRecord(props) ? props[\"key\"] : void 0;\n\tconst key = typeof fromAttr === \"string\" ? fromAttr : fromProps;\n\treturn typeof key === \"string\" && CLAIMED_DATABASE_URL_KEYS.has(key) ? key : void 0;\n};\nconst migrateAttr = (family, attr, props) => {\n\tif (!isRecord(attr)) return attr;\n\tconst oldProps = isRecord(props) ? props : {};\n\tswitch (family) {\n\t\tcase \"Project\":\n\t\t\tif (typeof attr[\"id\"] !== \"string\" || \"projectId\" in attr) return attr;\n\t\t\treturn {\n\t\t\t\tprojectId: attr[\"id\"],\n\t\t\t\tprojectName: attr[\"name\"],\n\t\t\t\tworkspaceId: oldProps[\"workspaceId\"] ?? \"\",\n\t\t\t\tcreatedAt: EPOCH,\n\t\t\t\tdefaultRegion: null\n\t\t\t};\n\t\tcase \"Database\":\n\t\t\tif (typeof attr[\"id\"] !== \"string\" || \"databaseId\" in attr) return attr;\n\t\t\treturn {\n\t\t\t\tdatabaseId: attr[\"id\"],\n\t\t\t\tdatabaseName: attr[\"name\"] ?? oldProps[\"name\"],\n\t\t\t\tprojectId: oldProps[\"projectId\"],\n\t\t\t\tstatus: \"ready\",\n\t\t\t\tregion: oldProps[\"region\"] ?? null,\n\t\t\t\tisDefault: oldProps[\"isDefault\"] ?? false,\n\t\t\t\tbranchId: oldProps[\"branchId\"] ?? null,\n\t\t\t\tdefaultConnectionId: null,\n\t\t\t\tcreatedAt: EPOCH\n\t\t\t};\n\t\tcase \"Connection\":\n\t\t\tif (typeof attr[\"id\"] !== \"string\" || \"connectionId\" in attr) return attr;\n\t\t\treturn {\n\t\t\t\tconnectionId: attr[\"id\"],\n\t\t\t\tconnectionName: oldProps[\"name\"],\n\t\t\t\tdatabaseId: oldProps[\"databaseId\"],\n\t\t\t\tkind: \"postgres\",\n\t\t\t\tcreatedAt: EPOCH,\n\t\t\t\tdirectConnectionString: attr[\"connectionString\"],\n\t\t\t\tdatabaseUrl: attr[\"connectionString\"]\n\t\t\t};\n\t\tcase \"App\":\n\t\t\tif (typeof attr[\"id\"] !== \"string\" || \"appId\" in attr) return attr;\n\t\t\treturn {\n\t\t\t\tappId: attr[\"id\"],\n\t\t\t\tname: attr[\"name\"] ?? oldProps[\"name\"],\n\t\t\t\tprojectId: oldProps[\"projectId\"],\n\t\t\t\tregionId: oldProps[\"region\"] ?? DEFAULT_REGION,\n\t\t\t\tbranchId: oldProps[\"branchId\"] ?? null,\n\t\t\t\tlatestDeploymentId: null,\n\t\t\t\t...attr[\"endpointDomain\"] !== void 0 ? { appEndpointDomain: attr[\"endpointDomain\"] } : {},\n\t\t\t\tcreatedAt: EPOCH\n\t\t\t};\n\t\tcase \"Deployment\":\n\t\t\tif (typeof attr[\"deploymentId\"] !== \"string\" || \"appId\" in attr) return attr;\n\t\t\treturn {\n\t\t\t\tdeploymentId: attr[\"deploymentId\"],\n\t\t\t\tappId: oldProps[\"computeServiceId\"],\n\t\t\t\tstatus: void 0,\n\t\t\t\tpreviewDomain: void 0,\n\t\t\t\tappEndpointDomain: attr[\"deployedUrl\"],\n\t\t\t\tcreatedAt: void 0\n\t\t\t};\n\t\tcase \"EnvironmentVariable\":\n\t\t\tif (typeof attr[\"id\"] !== \"string\" || \"environmentVariableId\" in attr) return attr;\n\t\t\treturn {\n\t\t\t\tenvironmentVariableId: attr[\"id\"],\n\t\t\t\tprojectId: oldProps[\"projectId\"],\n\t\t\t\tbranchId: oldProps[\"branchId\"] ?? null,\n\t\t\t\tclass: oldProps[\"class\"] ?? \"production\",\n\t\t\t\tkey: attr[\"key\"] ?? oldProps[\"key\"],\n\t\t\t\tvalue: Redacted.make(\"\"),\n\t\t\t\tvalueKid: \"\",\n\t\t\t\tisManagedBySystem: false,\n\t\t\t\tcreatedAt: EPOCH,\n\t\t\t\tupdatedAt: EPOCH\n\t\t\t};\n\t\tcase \"Bucket\":\n\t\t\tif (typeof attr[\"id\"] !== \"string\" || \"bucketId\" in attr) return attr;\n\t\t\treturn {\n\t\t\t\tbucketId: attr[\"id\"],\n\t\t\t\tname: attr[\"name\"],\n\t\t\t\tprojectId: oldProps[\"projectId\"],\n\t\t\t\tcreatedAt: EPOCH\n\t\t\t};\n\t\tcase \"BucketAccessKey\": {\n\t\t\tif (typeof attr[\"id\"] !== \"string\" || \"bucketAccessKeyId\" in attr) return attr;\n\t\t\tconst secret = attr[\"secretAccessKey\"];\n\t\t\treturn {\n\t\t\t\tbucketAccessKeyId: attr[\"id\"],\n\t\t\t\tbucketId: attr[\"bucketId\"],\n\t\t\t\taccessKeyId: attr[\"accessKeyId\"],\n\t\t\t\tsecretAccessKey: Redacted.isRedacted(secret) ? secret : Redacted.make(String(secret ?? \"\")),\n\t\t\t\tendpoint: attr[\"endpoint\"],\n\t\t\t\tbucketName: attr[\"bucketName\"]\n\t\t\t};\n\t\t}\n\t}\n};\n/**\n* Type-id renames where the props/attr shapes are unchanged: rewriting the\n* `resourceType` (here and on any nested `old` row) is the whole migration.\n*/\nconst RENAMED_TYPES = { \"PrismaNext.Migration\": \"PrismaOrm.Migration\" };\nconst renameResourceType = (row, renamed) => {\n\tconst migrated = {\n\t\t...row,\n\t\tresourceType: renamed\n\t};\n\tconst old = row[\"old\"];\n\tif (isRecord(old) && typeof old[\"resourceType\"] === \"string\") migrated[\"old\"] = migrateResourceRow(old);\n\treturn migrated;\n};\nconst migrateResourceRow = (row) => {\n\tconst resourceType = row[\"resourceType\"];\n\tif (typeof resourceType !== \"string\") return row;\n\tconst renamed = RENAMED_TYPES[resourceType];\n\tif (renamed !== void 0) return renameResourceType(row, renamed);\n\tconst family = FAMILY_BY_LEGACY_TYPE[resourceType];\n\tif (family === void 0) return row;\n\tconst migrated = {\n\t\t...row,\n\t\tresourceType: UPSTREAM_TYPE[family],\n\t\t...\"props\" in row ? { props: migrateProps(family, row[\"props\"]) } : {},\n\t\t...\"attr\" in row ? { attr: migrateAttr(family, row[\"attr\"], row[\"props\"]) } : {}\n\t};\n\tconst old = row[\"old\"];\n\tif (isRecord(old)) migrated[\"old\"] = typeof old[\"resourceType\"] === \"string\" ? migrateResourceRow(old) : {\n\t\t...old,\n\t\t...\"props\" in old ? { props: migrateProps(family, old[\"props\"]) } : {},\n\t\t...\"attr\" in old ? { attr: migrateAttr(family, old[\"attr\"], old[\"props\"]) } : {}\n\t};\n\tconst claimedKey = claimedKeyOf(family, row[\"props\"], row[\"attr\"]);\n\tif (claimedKey !== void 0) return retireDatabaseUrlClaimRow(migrated, claimedKey);\n\treturn migrated;\n};\n/**\n* Maps a revived state value from a legacy Composer resource shape to the\n* upstream shape. Rows of other resource types (and action rows) pass through\n* untouched; the function is idempotent, so already-migrated rows pass\n* through too.\n*/\nconst migrateLegacyResourceState = (value) => {\n\tif (!isRecord(value) || value[\"kind\"] === \"action\") return value;\n\treturn migrateResourceRow(value);\n};\n//#endregion\n//#region src/state/layer.ts\n/**\n* The hosted Alchemy state store: alchemy's stock HTTP state client pointed\n* at the platform state API\n* (`/v1/projects/{projectId}/branches/{branchId}/alchemy-state`). On layer\n* init (scoped, once per stack run): resolve the stage's Branch, acquire the\n* (stack, stage) deploy lease, fork its heartbeat, run the migration guard,\n* and build the stock store. Finalizers (reverse order): interrupt the\n* heartbeat, release the lease. The Management API plumbing\n* (`ManagementClient`, `PrismaCredentials`) and the store's `HttpClient` are\n* provided internally, so the returned layer's only requirements are the\n* ones alchemy itself already provides to every state store\n* (`StackServices`).\n*\n* Any bootstrap failure is wrapped into an operator-facing\n* `HostedStateBootstrapError` (naming the Project/Branch and the step that\n* failed — see `errors.ts`) before dying the layer (loud, immediate,\n* unrecoverable) rather than surfacing as a typed error — matching core's\n* `LowerOptions.state: Layer.Layer<State, never, StackServices>` contract\n* and alchemy's own convention (e.g. a missing state store is `Effect.die`\n* in `Stack.make`).\n*/\nconst prismaStateLayer = (ids) => Layer.unwrap(managementApiBaseUrl().pipe(Effect.map((origin) => stateLayerAgainst(origin, ids)))).pipe(Layer.orDie);\n/**\n* The stock service with legacy Composer resource rows rewritten to the\n* upstream providers' shapes as they are read (see legacy-resources.ts) —\n* reads only; rows written by this version are already upstream-shaped.\n*/\nconst migrateRowsOnRead = (service) => ({\n\t...service,\n\tget: (request) => Effect.map(service.get(request), (value) => value === void 0 ? void 0 : blindCast(migrateLegacyResourceState(value))),\n\tgetReplacedResources: (request) => Effect.map(service.getReplacedResources(request), (rows) => rows.map((row) => blindCast(migrateLegacyResourceState(row))))\n});\n/** `prismaStateLayer` with the API origin injectable — split out so tests can point it at a fake state API. */\nconst stateLayerAgainst = (apiOrigin, ids) => {\n\tconst { projectId, branchId, defaultBranchId } = ids;\n\tconst dependencies = layer({ apiOrigin }).pipe(Layer.provideMerge(fromEnv()));\n\treturn Layer.effect(State, Effect.gen(function* () {\n\t\tconst stack = yield* Stack;\n\t\tconst container = branchId === void 0 ? projectId : `${projectId}/${branchId}`;\n\t\tconst bootstrapError = (step) => (cause) => hostedStateBootstrapError(container, step, cause);\n\t\tconst mgmt = yield* ManagementClient;\n\t\tconst { token } = yield* PrismaCredentials;\n\t\tconst stateBranchId = branchId ?? defaultBranchId ?? (yield* resolveDefaultBranchId(mgmt, projectId).pipe(Effect.mapError(bootstrapError(\"resolving the stage branch\"))));\n\t\tconst scope = {\n\t\t\tprojectId,\n\t\t\tbranchId: stateBranchId,\n\t\t\tstack: stack.name,\n\t\t\tstage: stack.stage\n\t\t};\n\t\tconst lease = yield* acquireDeployLease(mgmt, scope).pipe(Effect.mapError(bootstrapError(\"acquiring the deploy lease\")));\n\t\tyield* Effect.addFinalizer(() => releaseDeployLease(mgmt, scope, lease));\n\t\tyield* Effect.forkScoped(heartbeatDeployLease(mgmt, scope, lease));\n\t\tif (!(yield* scopeOccupied(mgmt, scope, lease).pipe(Effect.mapError(bootstrapError(\"probing the deploy state scope\"))))) yield* failOnEmptyScopeWithLiveResources(projectId, stateBranchId, stack.name, stack.stage).pipe(Effect.provideService(ManagementClient, mgmt), Effect.mapError(bootstrapError(\"checking the empty deploy state scope\")));\n\t\tconst service = yield* makeHttpStateStore({\n\t\t\turl: `${apiOrigin}/v1/projects/${projectId}/branches/${stateBranchId}/alchemy-state`,\n\t\t\tauthToken: Redacted.value(token),\n\t\t\ttransformClient: (req) => HttpClientRequest.setHeader(req, LEASE_HEADER, Redacted.value(lease.leaseId)),\n\t\t\tid: \"prisma-postgres\"\n\t\t}).pipe(Effect.provide(FetchHttpClient.layer));\n\t\tconst migrated = migrateRowsOnRead(service);\n\t\tconst buildId = process.env[BUILD_ID_ENV];\n\t\tif (buildId === void 0 || buildId.length === 0) return Effect.succeed(migrated);\n\t\tconst { store, reporter } = withResourceReporting(migrated, buildsApi({\n\t\t\tclient: mgmt,\n\t\t\twarn: (message) => {\n\t\t\t\tconsole.warn(message);\n\t\t\t}\n\t\t}), buildId);\n\t\tyield* Effect.addFinalizer(() => Effect.promise(() => reporter.drain()));\n\t\treturn Effect.succeed(store);\n\t}).pipe(Effect.provide(dependencies))).pipe(Layer.orDie, Layer.merge(redactLeaseHeader));\n};\n//#endregion\nexport { prismaStateLayer };\n\n//# sourceMappingURL=state.mjs.map","import { r as managementApiBaseUrl } from \"./credentials-DhT4a38W.mjs\";\nimport { i as buildsApi, n as reportableResource, r as resourceReporter, t as BUILD_ID_ENV } from \"./resources-CXUKkcyA.mjs\";\nimport { createManagementApiClient } from \"@prisma/management-api-sdk\";\nimport * as Effect from \"effect/Effect\";\nimport { createHash } from \"node:crypto\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport { execFileSync } from \"node:child_process\";\n//#region src/builds/application-topology.ts\n/**\n* The application-topology submission (pdp-control-plane\n* `projects/branch-topology/spec.md`): composes the wire body from the\n* authored view Load keeps on the Graph, hashes it, and PUTs it to the\n* Branch. Best-effort like every report in this package — a refused or\n* unreachable platform costs a warning, never the deploy, and the platform\n* keeps the Branch's previous topology.\n*\n* Everything on the wire is identified by LOGICAL id — the node's address in\n* the declaration. Row ids are recreated on every deploy and never appear.\n* `kind` is the platform's structural enum; `type`, `contractKind`, `style`,\n* and `family` values are this tool's vocabulary, stored uninterpreted.\n*/\n/** The producer out-ports whose edges are request/response communication (@prisma/composer/service-rpc's contract kind). */\nconst REQUEST_RESPONSE_CONTRACT_KINDS = /* @__PURE__ */ new Set([\"rpc\"]);\nconst endpointKey = (endpoint) => `${endpoint.node}\u0000${endpoint.direction}\u0000${endpoint.name}`;\nconst endpointBody = (endpoint) => ({\n\tlogicalId: endpoint.node,\n\tdirection: endpoint.direction,\n\tname: endpoint.name\n});\n/**\n* Composes the wire body from the Graph's authored view. Flat-view\n* dependency-slot nodes are the ports' flat representation and stay off the\n* wire; every module/service/resource node goes on it, with its stated\n* parent. An edge's `family` comes from the spec's resolution walk done\n* client-side: follow the source endpoint through module boundaries (a\n* module port's own one incoming edge) until a service or resource —\n* `data` when the producer is a resource, `communication` otherwise, styled\n* `request-response` when the producing port carries the rpc contract kind.\n*/\nfunction composeApplicationTopology(graph) {\n\tconst kinds = /* @__PURE__ */ new Map();\n\tconst nodes = [];\n\tfor (const entry of graph.nodes) {\n\t\tconst node = entry.node;\n\t\tif (node.kind !== \"module\" && node.kind !== \"service\" && node.kind !== \"resource\") continue;\n\t\tkinds.set(entry.id, node.kind);\n\t\tnodes.push({\n\t\t\tlogicalId: entry.id,\n\t\t\tparentLogicalId: entry.parent ?? null,\n\t\t\tkind: node.kind,\n\t\t\t...node.kind === \"module\" ? {} : { type: node.type }\n\t\t});\n\t}\n\tconst ports = graph.ports.map((port) => ({\n\t\tlogicalId: port.node,\n\t\tdirection: port.direction,\n\t\tname: port.name,\n\t\t...port.contractKind !== void 0 ? { contractKind: port.contractKind } : {}\n\t}));\n\tconst incoming = /* @__PURE__ */ new Map();\n\tfor (const edge of graph.authoredEdges) incoming.set(endpointKey(edge.to), edge);\n\tconst contractKindByPort = /* @__PURE__ */ new Map();\n\tfor (const port of graph.ports) contractKindByPort.set(endpointKey(port), port.contractKind);\n\tconst resolveProducer = (from) => {\n\t\tlet current = from;\n\t\tconst seen = /* @__PURE__ */ new Set();\n\t\twhile (kinds.get(current.node) === \"module\") {\n\t\t\tconst key = endpointKey(current);\n\t\t\tif (seen.has(key)) return void 0;\n\t\t\tseen.add(key);\n\t\t\tconst feeding = incoming.get(key);\n\t\t\tif (feeding === void 0) return void 0;\n\t\t\tcurrent = feeding.from;\n\t\t}\n\t\treturn current;\n\t};\n\treturn {\n\t\tnodes,\n\t\tports,\n\t\tedges: graph.authoredEdges.map((edge) => {\n\t\t\tconst producer = resolveProducer(edge.from);\n\t\t\tconst producerContractKind = producer === void 0 ? void 0 : contractKindByPort.get(endpointKey(producer));\n\t\t\tconst style = producerContractKind !== void 0 && REQUEST_RESPONSE_CONTRACT_KINDS.has(producerContractKind) ? \"request-response\" : void 0;\n\t\t\treturn {\n\t\t\t\tfrom: endpointBody(edge.from),\n\t\t\t\tto: endpointBody(edge.to),\n\t\t\t\tfamily: producer !== void 0 && kinds.get(producer.node) === \"resource\" ? \"data\" : \"communication\",\n\t\t\t\t...style !== void 0 ? { style } : {}\n\t\t\t};\n\t\t})\n\t};\n}\nconst compareStrings = (a, b) => a < b ? -1 : a > b ? 1 : 0;\n/**\n* The content hash the platform stores opaquely: sha256 over a canonical\n* JSON form — entries sorted, keys in a fixed order, absent optionals\n* omitted — so the same declared graph always hashes the same whatever\n* order Load emitted it in. The Build Run records the same value\n* (`applicationTopologyContentHash`), and equal hashes are how the platform\n* links a run to the graph it deployed — a value match, never a row\n* reference.\n*/\nfunction applicationTopologyContentHash(topology) {\n\tconst canonical = {\n\t\tnodes: topology.nodes.map((node) => ({\n\t\t\tlogicalId: node.logicalId,\n\t\t\tparentLogicalId: node.parentLogicalId,\n\t\t\tkind: node.kind,\n\t\t\t...node.type !== void 0 ? { type: node.type } : {}\n\t\t})).sort((a, b) => compareStrings(a.logicalId, b.logicalId)),\n\t\tports: topology.ports.map((port) => ({\n\t\t\tlogicalId: port.logicalId,\n\t\t\tdirection: port.direction,\n\t\t\tname: port.name,\n\t\t\t...port.contractKind !== void 0 ? { contractKind: port.contractKind } : {}\n\t\t})).sort((a, b) => compareStrings(a.logicalId, b.logicalId) || compareStrings(a.direction, b.direction) || compareStrings(a.name, b.name)),\n\t\tedges: topology.edges.map((edge) => ({\n\t\t\tfrom: {\n\t\t\t\tlogicalId: edge.from.logicalId,\n\t\t\t\tdirection: edge.from.direction,\n\t\t\t\tname: edge.from.name\n\t\t\t},\n\t\t\tto: {\n\t\t\t\tlogicalId: edge.to.logicalId,\n\t\t\t\tdirection: edge.to.direction,\n\t\t\t\tname: edge.to.name\n\t\t\t},\n\t\t\tfamily: edge.family,\n\t\t\t...edge.style !== void 0 ? { style: edge.style } : {}\n\t\t})).sort((a, b) => compareStrings(a.to.logicalId, b.to.logicalId) || compareStrings(a.to.direction, b.to.direction) || compareStrings(a.to.name, b.to.name))\n\t};\n\treturn `sha256:${createHash(\"sha256\").update(JSON.stringify(canonical)).digest(\"hex\")}`;\n}\n/** Same deadline as the build reports (api.ts): reporting is observability, so no call may stall the deploy. */\nconst REPORT_DEADLINE_MS = 1e4;\nfunction applicationTopologyApi(options) {\n\tconst { client, warn } = options;\n\treturn { async replace(projectId, branchId, submission) {\n\t\tconst describe = \"record this deploy's application topology\";\n\t\tlet result;\n\t\ttry {\n\t\t\tresult = await blindCast(client.PUT)(\"/v1/projects/{projectId}/branches/{branchId}/application-topology\", {\n\t\t\t\tparams: { path: {\n\t\t\t\t\tprojectId,\n\t\t\t\t\tbranchId\n\t\t\t\t} },\n\t\t\t\tbody: submission,\n\t\t\t\tsignal: AbortSignal.timeout(REPORT_DEADLINE_MS)\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\twarn(`Could not reach Prisma Cloud to ${describe}: ${detail}`);\n\t\t\treturn false;\n\t\t}\n\t\tif (!result.response.ok) {\n\t\t\tconst detail = result.error === void 0 ? \"\" : `: ${JSON.stringify(result.error)}`;\n\t\t\twarn(`Prisma Cloud refused to ${describe} (HTTP ${String(result.response.status)})${detail}`);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t} };\n}\n//#endregion\n//#region src/builds/run-identity.ts\n/**\n* Who is deploying, and from what commit — the identity a build is reported\n* under.\n*\n* `commitSha` and `branchName` are required by the platform, and Composer has\n* no other reason to read git, so this is the only place it does. A deploy\n* from a directory that is not a git checkout has neither, and is reported\n* not at all rather than reported with placeholder values: the Console keeps\n* whatever it is told, and \"unknown\" would sit in a workspace's deploy\n* history permanently.\n*/\nconst DIGITS = /^[0-9]+$/;\nconst nonEmpty$1 = (value) => value !== void 0 && value.length > 0 ? value : void 0;\nfunction git(args, cwd) {\n\ttry {\n\t\tconst out = execFileSync(\"git\", [...args], {\n\t\t\tcwd,\n\t\t\tencoding: \"utf8\",\n\t\t\tstdio: [\n\t\t\t\t\"ignore\",\n\t\t\t\t\"pipe\",\n\t\t\t\t\"ignore\"\n\t\t\t],\n\t\t\ttimeout: 5e3\n\t\t});\n\t\treturn nonEmpty$1(out.trim());\n\t} catch {\n\t\treturn;\n\t}\n}\n/**\n* The GitHub Actions run this is executing inside, when all three parts are\n* present and are the digits the platform's dedup key requires. Partial or\n* malformed input yields nothing rather than half an identity: the key joins\n* its parts with `:`, so a part that is not digits could let two different\n* runs spell the same key.\n*/\nfunction githubRunIdentity(env) {\n\tif (env[\"GITHUB_ACTIONS\"] !== \"true\") return void 0;\n\tconst repositoryId = nonEmpty$1(env[\"GITHUB_REPOSITORY_ID\"]);\n\tconst runId = nonEmpty$1(env[\"GITHUB_RUN_ID\"]);\n\tconst attempt = nonEmpty$1(env[\"GITHUB_RUN_ATTEMPT\"]) ?? \"1\";\n\tif (repositoryId === void 0 || !DIGITS.test(repositoryId)) return void 0;\n\tif (runId === void 0 || !DIGITS.test(runId)) return void 0;\n\tif (!DIGITS.test(attempt)) return void 0;\n\tconst runAttempt = Number.parseInt(attempt, 10);\n\tif (!Number.isInteger(runAttempt) || runAttempt < 1) return void 0;\n\treturn {\n\t\tprovider: \"github\",\n\t\trepositoryId,\n\t\trunId,\n\t\trunAttempt\n\t};\n}\nfunction githubRunUrl(env) {\n\tconst server = nonEmpty$1(env[\"GITHUB_SERVER_URL\"]) ?? \"https://github.com\";\n\tconst repository = nonEmpty$1(env[\"GITHUB_REPOSITORY\"]);\n\tconst runId = nonEmpty$1(env[\"GITHUB_RUN_ID\"]);\n\tif (repository === void 0 || runId === void 0) return void 0;\n\treturn `${server}/${repository}/actions/runs/${runId}/attempts/${nonEmpty$1(env[\"GITHUB_RUN_ATTEMPT\"]) ?? \"1\"}`;\n}\n/**\n* The branch this ran on. Inside a pull-request workflow `GITHUB_REF_NAME` is\n* the synthetic merge ref (`123/merge`), so the head branch is preferred —\n* it is the name a person would recognise in the Console.\n*/\nfunction branchName(env, cwd) {\n\tconst fromEnv = nonEmpty$1(env[\"GITHUB_HEAD_REF\"]) ?? nonEmpty$1(env[\"GITHUB_REF_NAME\"]);\n\tif (fromEnv !== void 0) return fromEnv;\n\tconst head = git([\n\t\t\"rev-parse\",\n\t\t\"--abbrev-ref\",\n\t\t\"HEAD\"\n\t], cwd);\n\treturn head === \"HEAD\" ? void 0 : head;\n}\n/**\n* The identity to report this run under, or `undefined` when there is not\n* enough to report one honestly.\n*/\nfunction resolveRunIdentity(cwd, env) {\n\tconst commitSha = nonEmpty$1(env[\"GITHUB_SHA\"]) ?? git([\"rev-parse\", \"HEAD\"], cwd);\n\tconst branch = branchName(env, cwd);\n\tif (commitSha === void 0 || branch === void 0) return void 0;\n\tconst runIdentity = githubRunIdentity(env);\n\treturn {\n\t\tsource: runIdentity === void 0 ? \"cli\" : \"ci\",\n\t\tcommitSha,\n\t\tbranchName: branch,\n\t\trunIdentity,\n\t\texternalLogUrl: runIdentity === void 0 ? void 0 : githubRunUrl(env)\n\t};\n}\n//#endregion\n//#region src/builds/reporter.ts\n/** An empty string is how a shell spells \"unset\", so it must not be mistaken for a build id. */\nconst nonEmpty = (value) => value !== void 0 && value.length > 0 ? value : void 0;\nfunction buildReporter(options) {\n\treturn { begin: async (input) => {\n\t\ttry {\n\t\t\treturn await beginSession(input, options);\n\t\t} catch (error) {\n\t\t\t(options.warn ?? ((message) => console.warn(message)))(`Could not start build reporting: ${error instanceof Error ? error.message : String(error)}`);\n\t\t\treturn;\n\t\t}\n\t} };\n}\nasync function beginSession(input, options) {\n\tconst env = options.env ?? process.env;\n\tconst warn = options.warn ?? ((message) => console.warn(message));\n\tconst injected = input.credentials?.client;\n\tconst token = env[\"PRISMA_SERVICE_TOKEN\"];\n\tif (options.api === void 0 && options.topology === void 0 && injected === void 0 && (token === void 0 || token.length === 0)) return;\n\tlet client;\n\tconst clientOf = () => client ??= injected ?? createManagementApiClient({\n\t\ttoken: token ?? \"\",\n\t\tbaseUrl: options.origin ?? Effect.runSync(managementApiBaseUrl(options.env))\n\t});\n\tconst api = options.api ?? buildsApi({\n\t\tclient: clientOf(),\n\t\twarn\n\t});\n\tconst topologyApi = options.topology ?? applicationTopologyApi({\n\t\tclient: clientOf(),\n\t\twarn\n\t});\n\tlet submission;\n\ttry {\n\t\tconst body = composeApplicationTopology(input.graph);\n\t\tsubmission = {\n\t\t\tbody,\n\t\t\tcontentHash: applicationTopologyContentHash(body)\n\t\t};\n\t} catch (error) {\n\t\twarn(`Could not compose this deploy's application topology: ${error instanceof Error ? error.message : String(error)}`);\n\t\tsubmission = void 0;\n\t}\n\tconst identity = resolveRunIdentity(input.cwd, env);\n\tif (identity === void 0) {\n\t\twarn(`\\nNot recording this deploy in Prisma Cloud: ${input.cwd} has no commit and branch to report it under. Deploy from a git checkout to see it in the Console.`);\n\t\treturn sessionWithoutBuild(topologyApi, submission, options.refsOf);\n\t}\n\tconst joined = nonEmpty(input.reportId) ?? nonEmpty(env[\"PRISMA_BUILD_ID\"]);\n\tconst buildId = joined !== void 0 ? joined : await api.create({\n\t\tsource: identity.source,\n\t\tcommitSha: identity.commitSha,\n\t\tbranchName: identity.branchName,\n\t\t...identity.runIdentity !== void 0 ? { runIdentity: identity.runIdentity } : {},\n\t\t...identity.externalLogUrl !== void 0 ? { externalLogUrl: identity.externalLogUrl } : {}\n\t});\n\tif (buildId === void 0) return sessionWithoutBuild(topologyApi, submission, options.refsOf);\n\tawait api.update(buildId, {\n\t\tphase: \"deploy\",\n\t\tstate: \"running\"\n\t});\n\treturn session(api, topologyApi, buildId, submission, options.refsOf, warn);\n}\n/**\n* The app this run deployed and where it can be reached — but only when the\n* run deployed exactly one compute service.\n*\n* `Build.appId` and `Build.deployedUrl` are each one value, and an app with\n* several services has no single answer. Picking the first would put an\n* arbitrary service's address in the Console and quietly imply it was the\n* app's. Single-service apps are the common case and get a working link;\n* multi-service apps get neither, and their services are all reported through\n* the resources endpoint regardless.\n*\n* Both fields are fill-only, so this is safe to send on a build whose creator\n* already set them to the same values, and a genuine disagreement is a 409\n* the caller logs.\n*/\nfunction deployedApp(entities) {\n\tconst services = entities.filter((entity) => entity.kind === \"compute-service\");\n\tconst only = services.length === 1 ? services[0] : void 0;\n\tif (only === void 0) return {};\n\treturn {\n\t\tappId: only.id,\n\t\t...only.url !== void 0 ? { deployedUrl: only.url } : {}\n\t};\n}\n/**\n* The topology half of `attach`, shared with build-less sessions: replaces\n* the stage Branch's application topology, once per deploy, after the Branch\n* exists and before any resource is created (attach's position in the\n* pipeline). A container that resolves no stage Branch has nowhere to submit\n* to, and the API's own failure handling already warned — nothing here\n* throws past it.\n*/\nasync function submitTopology(topologyApi, submission, refs) {\n\tif (submission === void 0 || refs.stageBranchId === void 0) return;\n\tawait topologyApi.replace(refs.projectId, refs.stageBranchId, {\n\t\tcontentHash: submission.contentHash,\n\t\t...submission.body\n\t});\n}\n/**\n* The session for a deploy whose Build never came to be — no repository to\n* report under, or a create the platform refused. The declared topology\n* depends on neither, so `attach` still submits it; everything else is a\n* no-op.\n*/\nfunction sessionWithoutBuild(topologyApi, submission, refsOf) {\n\treturn {\n\t\tchildEnv: () => ({}),\n\t\tasync attach(input) {\n\t\t\tif (input.container === void 0) return;\n\t\t\tawait submitTopology(topologyApi, submission, refsOf(input.container));\n\t\t},\n\t\tfinish: async () => {}\n\t};\n}\nfunction session(api, topologyApi, buildId, submission, refsOf, warn) {\n\tlet finished = false;\n\treturn {\n\t\tchildEnv: () => ({ [BUILD_ID_ENV]: buildId }),\n\t\t/**\n\t\t* Attaches the build to the Project and Branch this deploy resolved,\n\t\t* stamping the topology's content hash on the same update, then submits\n\t\t* the declared topology to the stage Branch. The hash rides the attach\n\t\t* update rather than a call of its own because it must not travel alone\n\t\t* yet: until the platform accepts the field, its validator strips it and\n\t\t* then rejects the emptied body (\"at least one field must be given\") —\n\t\t* observed live on 2026-08-21. Folded in, the update stays valid today\n\t\t* and the hash starts landing the moment the field is accepted. It is\n\t\t* sent whether or not the submission lands — the run acted on this graph\n\t\t* either way; equal hashes are a value match, not a reference to the\n\t\t* stored topology.\n\t\t*/\n\t\tasync attach(input) {\n\t\t\tif (input.container === void 0) return;\n\t\t\tconst refs = refsOf(input.container);\n\t\t\tconst { projectId, branchId } = refs;\n\t\t\tawait api.update(buildId, {\n\t\t\t\tprojectId,\n\t\t\t\t...branchId !== void 0 ? { branchId } : {},\n\t\t\t\t...submission !== void 0 ? { applicationTopologyContentHash: submission.contentHash } : {}\n\t\t\t});\n\t\t\tawait submitTopology(topologyApi, submission, refs);\n\t\t},\n\t\tasync finish(outcome) {\n\t\t\tif (finished) return;\n\t\t\tfinished = true;\n\t\t\ttry {\n\t\t\t\tawait api.update(buildId, {\n\t\t\t\t\tstate: outcome.ok ? \"succeeded\" : outcome.cancelled ? \"cancelled\" : \"failed\",\n\t\t\t\t\t...outcome.failingStep !== void 0 && !outcome.cancelled ? { failingStep: outcome.failingStep } : {},\n\t\t\t\t\t...outcome.errorMessage !== void 0 && !outcome.cancelled ? { errorMessage: outcome.errorMessage } : {},\n\t\t\t\t\t...deployedApp(outcome.entities)\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\twarn(`Could not report this deploy's outcome: ${error instanceof Error ? error.message : String(error)}`);\n\t\t\t}\n\t\t}\n\t};\n}\n//#endregion\nexport { BUILD_ID_ENV, applicationTopologyApi, applicationTopologyContentHash, buildReporter, buildsApi, composeApplicationTopology, reportableResource, resolveRunIdentity, resourceReporter };\n\n//# sourceMappingURL=builds.mjs.map","import { c as paramName, s as paramBindingFor } from \"./secret-Dgyg1WyG.mjs\";\nimport { a as encode, c as paramEntries, d as serializeInput, n as configKey, o as encodeParamPointer, r as decodeParamPointer, s as isParamPointerRow } from \"./serializer-DTCrRl7S.mjs\";\nimport { n as RESERVED_PROVIDER_PARAMS, o as SELF_ORIGIN, r as STREAMS_API_KEY, t as provisionedEdges } from \"./provisioned-edges-DKsBi7uK.mjs\";\nimport { n as requiredPackHeadOf } from \"./required-pack-head-CMMJ2LaU.mjs\";\nimport { _ as prismaCloudContainerOf, a as PgWarmProvider, c as resolveTargetRef, d as GeneratedParam, f as GeneratedParamProvider, h as containerDescriptor, i as PgWarm, l as packHeadRefHashes, n as S3CredentialsProvider, o as OrmMigration, p as PRISMA_CLOUD_EXTENSION_ID, r as collectPreflightNames, s as OrmMigrationProvider, t as S3Credentials, u as resolveOrmConfig } from \"./s3-credentials-resource-D_qSGYMM.mjs\";\nimport { r as isPostgresResourceNode } from \"./orm-postgres-ChW2Ewj7.mjs\";\nimport { isParamSource } from \"@internal/core\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport { RPC_PEER_KEY } from \"@internal/service-rpc\";\nimport * as Prisma from \"@internal/lowering\";\nimport { ARTIFACT_CONTENT_TYPE, ManagementClient, appAfterEnvironment, drivePagesAsync, fromEnv, managementClientLayer, packageComputeArtifact } from \"@internal/lowering\";\nimport { prismaStateLayer } from \"@internal/lowering/state\";\nimport * as Output from \"alchemy/Output\";\nimport * as Prisma$1 from \"alchemy/Prisma\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as Builds from \"@internal/lowering/builds\";\nimport { readPreflightPayload } from \"@internal/core/config\";\nconst PRISMA_NAME_MIN = 3;\nconst PRISMA_NAME_MAX = 65;\nfunction validateName(value, source) {\n\tif (value.length < PRISMA_NAME_MIN || value.length > PRISMA_NAME_MAX) throw new Error(`prisma-cloud: ${source} \"${value}\" (${value.length} characters) is not a valid Prisma resource name — Prisma requires ${PRISMA_NAME_MIN}–${PRISMA_NAME_MAX} characters. Rename the provision id (or the deploy --name) to fit.`);\n}\nfunction isCloudApplication(value) {\n\treturn typeof value === \"object\" && value !== null && \"projectId\" in value && typeof value.projectId === \"string\" && \"branchId\" in value && (value.branchId === void 0 || typeof value.branchId === \"string\") && \"defaultBranchId\" in value && (value.defaultBranchId === void 0 || typeof value.defaultBranchId === \"string\") && \"branchless\" in value && typeof value.branchless === \"boolean\";\n}\n/** Narrows `ctx.application`, which core hands over as `unknown`, to this extension's own product; throws naming the hook when it hasn't run. */\nfunction cloudApplicationOf(application) {\n\tif (!isCloudApplication(application)) throw new Error(\"prisma-cloud: ctx.application is not this extension's application product — the prismaCloud() application hook must run before any node lowers.\");\n\treturn application;\n}\nfunction projectIdOf(application) {\n\treturn cloudApplicationOf(application).projectId;\n}\n/**\n* The Branch a database attaches to. Upstream treats an omitted branch as\n* desired-unassigned (`branchId` PATCHed back to `null` on reconcile), so a\n* deploy container carrying neither id is a broken transport; only a\n* `branchless` (dev) container returns `undefined`.\n*/\nfunction attachmentBranchIdOf(application, id) {\n\tconst app = cloudApplicationOf(application);\n\tconst branchId = app.branchId ?? app.defaultBranchId;\n\tif (branchId === void 0 && !app.branchless) throw new Error(`prisma-cloud: cannot attach database \"${id}\" to a Branch — the resolved container carries neither a stage Branch id nor the project's default Branch id. Container resolution (ADR-0019) always provides one for a deploy; this is a bug in the container transport.`);\n\treturn branchId;\n}\n/**\n* Upstream refuses an explicit display name combined with branch attachment\n* at create (create-then-attach, no idempotency key), so attached databases\n* take the generated physical name; only the branchless (dev) container takes\n* the `name` arm. The returned `url` is direct, not pooled — PgWarm and the\n* migration flows need a direct connection.\n*/\nconst stageDatabase = ({ id, application, region }) => Effect.gen(function* () {\n\tconst branchId = attachmentBranchIdOf(application, id);\n\tconst db = yield* Prisma$1.Database(`${id}-db`, {\n\t\tproject: projectIdOf(application),\n\t\tregion: region ?? \"us-east-1\",\n\t\t...branchId !== void 0 ? { branchId } : { name: id }\n\t});\n\tconst conn = yield* Prisma$1.Connection(`${id}-conn`, {\n\t\tdatabase: db,\n\t\tname: id\n\t});\n\treturn {\n\t\tdb,\n\t\turl: Output.map(conn.directConnectionString, (value) => {\n\t\t\tif (value === void 0) throw new Error(`prisma-cloud: connection \"${id}-conn\" returned no direct connection string.`);\n\t\t\treturn Redacted.value(value);\n\t\t})\n\t};\n});\n//#endregion\n//#region src/descriptors/bucket.ts\n/**\n* One Bucket per module-provisioned bucket resource — `id` is the module\n* provision id, so a resource shared by several consumers is created exactly\n* once. A BucketAccessKey is minted for the bucket: it is the reveal-once\n* credential carrier, and its attributes (endpoint, bucketName, accessKeyId,\n* secretAccessKey) become the four S3Config outputs consumers resolve by name.\n*/\nfunction bucketDescriptor(_o) {\n\tconst lowering = ({ id, application }) => Effect.gen(function* () {\n\t\tvalidateName(id, \"resource name (from provision id)\");\n\t\tconst branchId = cloudApplicationOf(application).branchId;\n\t\tconst bkt = yield* Prisma$1.Bucket(`${id}-bucket`, {\n\t\t\tproject: projectIdOf(application),\n\t\t\tname: id,\n\t\t\t...branchId !== void 0 ? { branchId } : {}\n\t\t});\n\t\tconst key = yield* Prisma$1.BucketAccessKey(`${id}-key`, {\n\t\t\tbucket: bkt.bucketId,\n\t\t\tname: id,\n\t\t\trole: \"read_write\"\n\t\t});\n\t\tconst secretAccessKey = Output.map(key.secretAccessKey, (v) => Redacted.value(v));\n\t\treturn {\n\t\t\toutputs: {\n\t\t\t\turl: key.endpoint,\n\t\t\t\tbucket: key.bucketName,\n\t\t\t\taccessKeyId: key.accessKeyId,\n\t\t\t\tsecretAccessKey\n\t\t\t},\n\t\t\tentities: [{\n\t\t\t\tkind: \"bucket\",\n\t\t\t\tid: bkt.bucketId\n\t\t\t}]\n\t\t};\n\t});\n\treturn Object.assign(lowering, { kind: \"resource\" });\n}\n//#endregion\n//#region src/descriptors/compute.ts\n/** The `compute` node kind's descriptor: the four service hooks — provision, serialize, package, deploy. */\n/**\n* Every env-var value goes to the platform wrapped in `Redacted`: the\n* Management API never reads a value back, so alchemy persists the desired one\n* in state to repair drift, and `Redacted` is what keeps it out of the\n* serialized state row. A value that is still an unresolved deploy-time\n* reference is wrapped inside the map, at the same point it becomes a string.\n*/\nconst envValue = (value) => Output.isOutput(value) ? Output.map(value, Redacted.make) : Redacted.make(value);\n/**\n* Returns the PRECISE descriptor type, not the erased `NodeDescriptor`: the\n* registry in control.ts erases it on assignment anyway (method bivariance),\n* but s3-store composes over these hooks and needs their P/S to stay visible.\n* Annotating this `NodeDescriptor` would force s3-store to cast them back.\n*/\nfunction computeDescriptor(o) {\n\treturn {\n\t\tkind: \"service\",\n\t\tprovision: ({ id, application }) => Effect.gen(function* () {\n\t\t\tvalidateName(id, \"service name (from provision id)\");\n\t\t\tconst projectId = projectIdOf(application);\n\t\t\tconst branchId = cloudApplicationOf(application).branchId;\n\t\t\tconst svc = yield* Prisma$1.App(`${id}-svc`, {\n\t\t\t\tproject: projectId,\n\t\t\t\tdisplayName: id,\n\t\t\t\tregionId: o().region ?? \"us-east-1\",\n\t\t\t\t...branchId !== void 0 ? { branchId } : {}\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tserviceId: svc.appId,\n\t\t\t\tprojectId,\n\t\t\t\tendpointDomain: svc.appEndpointDomain\n\t\t\t};\n\t\t}),\n\t\tserialize: (ctx, provisioned, config) => Effect.gen(function* () {\n\t\t\tconst { address, node, graph } = ctx;\n\t\t\tconst branchId = cloudApplicationOf(ctx.application).branchId;\n\t\t\tconst cls = branchId ? \"preview\" : \"production\";\n\t\t\tconst branch = branchId !== void 0 ? { branchId } : {};\n\t\t\tconst projectId = provisioned.projectId;\n\t\t\tconst svc = node;\n\t\t\tconst rows = [];\n\t\t\tfor (const d of paramEntries(svc)) {\n\t\t\t\tconst value = d.owner === \"service\" ? config.service[d.name] : config.inputs[d.owner.input]?.[d.name];\n\t\t\t\tif (value === void 0) continue;\n\t\t\t\tconst key = configKey(address, d);\n\t\t\t\tconst rowValue = d.owner === \"service\" && isParamSource(value) ? encodeParamPointer(paramName(paramBindingFor(graph.params, address, d.name))) : encode(d.owner, value);\n\t\t\t\tconst wrapped = envValue(rowValue);\n\t\t\t\tconst record = yield* Prisma$1.EnvironmentVariable(`${key}-var`, {\n\t\t\t\t\tproject: projectId,\n\t\t\t\t\tkey,\n\t\t\t\t\tvalue: wrapped,\n\t\t\t\t\tclass: cls,\n\t\t\t\t\t...branch\n\t\t\t\t});\n\t\t\t\tconst pointer = d.owner === \"service\" && isParamPointerRow(rowValue) ? decodeParamPointer(rowValue) : void 0;\n\t\t\t\trows.push({\n\t\t\t\t\trecord,\n\t\t\t\t\tkey,\n\t\t\t\t\tvalue: wrapped,\n\t\t\t\t\t...pointer !== void 0 ? { pointers: [pointer] } : {}\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst inputRow = serializeInput(svc, address, graph.inputBindings.find((b) => b.serviceAddress === address)?.binding);\n\t\t\tif (inputRow !== void 0) {\n\t\t\t\tconst inputValue = envValue(inputRow.value);\n\t\t\t\trows.push({\n\t\t\t\t\trecord: yield* Prisma$1.EnvironmentVariable(`${inputRow.key}-var`, {\n\t\t\t\t\t\tproject: projectId,\n\t\t\t\t\t\tkey: inputRow.key,\n\t\t\t\t\t\tvalue: inputValue,\n\t\t\t\t\t\tclass: cls,\n\t\t\t\t\t\t...branch\n\t\t\t\t\t}),\n\t\t\t\t\tkey: inputRow.key,\n\t\t\t\t\tvalue: inputValue,\n\t\t\t\t\tpointers: inputRow.secrets\n\t\t\t\t});\n\t\t\t\tfor (const leaf of inputRow.generated) {\n\t\t\t\t\tconst resource = yield* GeneratedParam(`${inputRow.key}:${leaf.path}-generated`, { bytes: leaf.bytes });\n\t\t\t\t\tconst generatedValue = envValue(resource.value);\n\t\t\t\t\trows.push({\n\t\t\t\t\t\trecord: yield* Prisma$1.EnvironmentVariable(`${leaf.varName}-var`, {\n\t\t\t\t\t\t\tproject: projectId,\n\t\t\t\t\t\t\tkey: leaf.varName,\n\t\t\t\t\t\t\tvalue: generatedValue,\n\t\t\t\t\t\t\tclass: cls,\n\t\t\t\t\t\t\t...branch\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tkey: leaf.varName,\n\t\t\t\t\t\tvalue: generatedValue\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst exposes = svc.expose !== void 0 && Object.keys(svc.expose).length > 0;\n\t\t\tconst refsByBrand = /* @__PURE__ */ new Map();\n\t\t\tif (exposes) for (const edge of provisionedEdges(graph)) {\n\t\t\t\tif (edge.providerAddress !== address) continue;\n\t\t\t\tconst ref = ctx.provisioned.get(edge.edgeId);\n\t\t\t\tif (ref === void 0) continue;\n\t\t\t\tconst refs = refsByBrand.get(edge.brand) ?? [];\n\t\t\t\trefs.push(ref);\n\t\t\t\trefsByBrand.set(edge.brand, refs);\n\t\t\t}\n\t\t\tfor (const [brand, entry] of o().providerParams) {\n\t\t\t\tconst raw = \"valueForService\" in entry ? entry.valueForService(provisioned, address) : exposes ? entry.value(refsByBrand.get(brand) ?? []) : void 0;\n\t\t\t\tif (raw === void 0) continue;\n\t\t\t\tconst key = configKey(address, {\n\t\t\t\t\towner: \"service\",\n\t\t\t\t\tname: entry.name\n\t\t\t\t});\n\t\t\t\tconst value = Output.isOutput(raw) ? Output.map(raw, (v) => encode(\"service\", v)) : encode(\"service\", raw);\n\t\t\t\tconst providerValue = envValue(value);\n\t\t\t\trows.push({\n\t\t\t\t\trecord: yield* Prisma$1.EnvironmentVariable(`${key}-var`, {\n\t\t\t\t\t\tproject: projectId,\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tvalue: providerValue,\n\t\t\t\t\t\tclass: cls,\n\t\t\t\t\t\t...branch\n\t\t\t\t\t}),\n\t\t\t\t\tkey,\n\t\t\t\t\tvalue: providerValue\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst port = typeof config.service[\"port\"] === \"number\" ? config.service[\"port\"] : 3e3;\n\t\t\treturn {\n\t\t\t\tenvironment: rows.map((r) => r.record),\n\t\t\t\ttriggers: Object.fromEntries(rows.map((r) => [r.key, r.value])),\n\t\t\t\tpointers: [...new Set(rows.flatMap((r) => r.pointers ?? []))],\n\t\t\t\tport,\n\t\t\t\t...inputRow !== void 0 ? { input: inputRow } : {}\n\t\t\t};\n\t\t}),\n\t\tpackage: ({ id }, { assembled, address }) => Effect.try(() => packageComputeArtifact({\n\t\t\tid,\n\t\t\tbundleDir: assembled.dir,\n\t\t\tappEntry: assembled.entry,\n\t\t\taddress\n\t\t})),\n\t\tdeploy: ({ id }, provisioned, artifact, serialized) => Effect.gen(function* () {\n\t\t\tconst pointerUpdatedAt = o().pointerUpdatedAt;\n\t\t\tconst triggers = {\n\t\t\t\t...serialized.triggers,\n\t\t\t\t...Object.fromEntries(serialized.pointers.map((name) => [`${name}:updatedAt`, pointerUpdatedAt(name) ?? \"?\"]))\n\t\t\t};\n\t\t\tconst deployment = yield* Prisma$1.Deployment(`${id}-deploy`, {\n\t\t\t\tapp: appAfterEnvironment(provisioned.serviceId, serialized.environment),\n\t\t\t\tartifactPath: artifact.path,\n\t\t\t\tartifactContentType: ARTIFACT_CONTENT_TYPE,\n\t\t\t\ttriggers,\n\t\t\t\tportMapping: { http: serialized.port },\n\t\t\t\tstart: true,\n\t\t\t\tpromote: true\n\t\t\t});\n\t\t\tconst inputDetails = serialized.input !== void 0 ? { details: {\n\t\t\t\tinput: serialized.input.value,\n\t\t\t\t...serialized.input.absent.length > 0 ? { absent: serialized.input.absent.join(\"\\n\") } : {}\n\t\t\t} } : {};\n\t\t\treturn {\n\t\t\t\toutputs: {\n\t\t\t\t\turl: deployment.appEndpointDomain,\n\t\t\t\t\tprojectId: provisioned.projectId\n\t\t\t\t},\n\t\t\t\tentities: [{\n\t\t\t\t\tkind: \"compute-service\",\n\t\t\t\t\tid: provisioned.serviceId,\n\t\t\t\t\turl: deployment.appEndpointDomain,\n\t\t\t\t\t...inputDetails\n\t\t\t\t}]\n\t\t\t};\n\t\t})\n\t};\n}\n//#endregion\n//#region src/preflight.ts\n/** production for the default stage; preview for a named stage — matching how the pack writes config rows. */\nconst classFor = (branchId) => branchId === void 0 ? \"production\" : \"preview\";\n/**\n* One page of the env-var list. The query is `blindCast` to `never` because\n* openapi-fetch types this path's query as `never` (an SDK path/operation\n* mismatch); that same workaround defeats the client's response-type inference,\n* so the result is projected to the small shape we actually read.\n*/\nasync function listEnvVars(client, query) {\n\treturn blindCast(await client.GET(\"/v1/environment-variables\", { params: { query: blindCast(query) } }));\n}\n/**\n* What the platform holds for `key` in the target stage's scope. Default stage\n* → any production-class template. Named stage → a preview template (branchId\n* null) OR this branch's own override — the platform's preview materialization\n* (pdp-data-model.md). Metadata read only; env-var values are write-only.\n*\n* The whole list is walked rather than short-circuiting on the first visible\n* row, because the newest `updatedAt` across every visible row is the rotation\n* signal the compute deploy hook fingerprints on: stopping early would make\n* that timestamp depend on where the page boundary happened to fall, and a\n* fingerprint that moves for that reason would redeploy for no reason. A key\n* with more rows than one page (a template plus many per-branch overrides) is\n* rare, so this costs one request in practice.\n*/\nasync function readPlatformVariable(client, projectId, branchId, key) {\n\tconst cls = classFor(branchId);\n\tconst visible = (row) => branchId === void 0 || row.branchId === null || row.branchId === branchId;\n\tlet exists = false;\n\tlet latest;\n\tawait drivePagesAsync(`environment variables named \"${key}\"`, async (cursor) => {\n\t\tconst res = await listEnvVars(client, cursor === void 0 ? {\n\t\t\tprojectId,\n\t\t\tclass: cls,\n\t\t\tkey\n\t\t} : {\n\t\t\tprojectId,\n\t\t\tclass: cls,\n\t\t\tkey,\n\t\t\tcursor\n\t\t});\n\t\tif (res.error !== void 0) throw listFailedError(key, res.error);\n\t\treturn res.data ?? {\n\t\t\tdata: [],\n\t\t\tpagination: {\n\t\t\t\tnextCursor: null,\n\t\t\t\thasMore: false\n\t\t\t}\n\t\t};\n\t}, (data) => {\n\t\tfor (const row of data) {\n\t\t\tif (!visible(row)) continue;\n\t\t\texists = true;\n\t\t\tif (latest === void 0 || Date.parse(row.updatedAt) > Date.parse(latest)) latest = row.updatedAt;\n\t\t}\n\t\treturn false;\n\t});\n\treturn latest === void 0 ? { exists } : {\n\t\texists,\n\t\tupdatedAt: latest\n\t};\n}\n/**\n* Provision `key`=`value` directly via the Management API for the target\n* stage's scope (a production template for the default stage; a preview branch\n* override for a named stage — the same scope the pack's config rows are\n* written to, through alchemy's `Prisma.EnvironmentVariable`). A 409 means a\n* concurrent deploy already provisioned\n* it — tolerated. The value is never logged.\n*/\nasync function fillMissing(client, projectId, branchId, key, value) {\n\tconst res = await client.POST(\"/v1/environment-variables\", { body: {\n\t\tprojectId,\n\t\tclass: classFor(branchId),\n\t\tkey,\n\t\tvalue,\n\t\t...branchId !== void 0 ? { branchId } : {}\n\t} });\n\tif (res.error !== void 0 && res.response.status !== 409) throw fillFailedError(key, res.error);\n\treturn res.data?.data.updatedAt;\n}\nconst tokenRequiredError = () => /* @__PURE__ */ new Error(\"environment variable PRISMA_SERVICE_TOKEN is required for deploy preflight.\");\nconst listFailedError = (key, error) => /* @__PURE__ */ new Error(`deploy preflight: Prisma Management API error listing \"${key}\": ${JSON.stringify(error)}.`);\nconst fillFailedError = (key, error) => /* @__PURE__ */ new Error(`deploy preflight: failed to provision \"${key}\" from the deploy shell: ${JSON.stringify(error)}.`);\nfunction missingError(missing, branchId, stage) {\n\tconst scope = branchId === void 0 ? \"the production class (project-level template)\" : `the preview class of stage \"${stage ?? branchId}\" (branch override or template)`;\n\tconst lines = missing.map((m) => ` - ${m.name} (required by service \"${m.serviceAddress}\")`);\n\treturn /* @__PURE__ */ new Error(`Deploy preflight failed — ${missing.length} env var(s) (secret or env-sourced param) are not provisioned on Prisma Cloud for ${scope}, and are absent from the deploy shell:\\n${lines.join(\"\\n\")}\\n\\nSet each in the deploy shell environment (the CLI will provision it on deploy), or create it on the platform (Prisma Console or the Management API) in ${scope}.`);\n}\nasync function managementClient() {\n\tif ((process.env[\"PRISMA_SERVICE_TOKEN\"] ?? \"\").length === 0) throw tokenRequiredError();\n\treturn Effect.runPromise(Effect.gen(function* () {\n\t\treturn yield* ManagementClient;\n\t}).pipe(Effect.provide(managementClientLayer().pipe(Layer.provide(fromEnv())))));\n}\n/**\n* The Prisma Cloud extension's `preflight`. Uses the shared name collector\n* (`collectPreflightNames`, ADR-0042) — every service's input-binding\n* `envSecret` leaf, plus `paramManifest` filtered to env-sourced reserved\n* params — checks each platform name against the platform, fills from the\n* shell where possible, and fails loudly on anything absent from both.\n* `envParam` leaves of an input binding are NOT checked here — they resolve\n* from the deploy shell at serialize, and an unset one is an omitted key the\n* schema arbitrates. Uses the caller's client (`input.credentials`), then an\n* injected one for tests, then a client built from env.\n*/\nasync function runPreflight(input, deps) {\n\tconst { projectId, branchId } = prismaCloudContainerOf(input.container);\n\tconst collected = collectPreflightNames(input.graph);\n\tconst names = /* @__PURE__ */ new Map();\n\tfor (const meta of [...collected.secrets, ...collected.envParams]) if (!names.has(meta.name)) names.set(meta.name, meta);\n\tif (names.size === 0) return /* @__PURE__ */ new Map();\n\tconst client = input.credentials?.client ?? deps?.client ?? await managementClient();\n\tconst missing = [];\n\tconst updatedAt = /* @__PURE__ */ new Map();\n\tfor (const meta of names.values()) {\n\t\tconst platform = await readPlatformVariable(client, projectId, branchId, meta.name);\n\t\tif (platform.exists) {\n\t\t\tif (platform.updatedAt !== void 0) updatedAt.set(meta.name, platform.updatedAt);\n\t\t\tcontinue;\n\t\t}\n\t\tconst shellValue = process.env[meta.name];\n\t\tif (shellValue !== void 0 && shellValue.length > 0) {\n\t\t\tconst filled = await fillMissing(client, projectId, branchId, meta.name, shellValue);\n\t\t\tif (filled !== void 0) updatedAt.set(meta.name, filled);\n\t\t\tcontinue;\n\t\t}\n\t\tmissing.push(meta);\n\t}\n\tif (missing.length > 0) throw missingError(missing, branchId, input.stage);\n\treturn updatedAt;\n}\n/**\n* The extension-pack half of the deploy preflight: every dependency edge\n* whose required contract carries a `requiredPackHead` must be wired to a\n* `postgres` resource whose `prisma.config.ts` lists that pack at the\n* required head hash. Enforced HERE — at deploy time, before the migration\n* step constructs — because wireability (`dataContract().satisfies`)\n* deliberately says yes to every required pack head (the authoring-side\n* contract value cannot see the resource's config), and boot time would be\n* too late: the service would be down after a green deploy. Invoked from the\n* `postgres` descriptor's lowering, beside the migration-step\n* construction.\n*/\nasync function runPackPreflight(graph) {\n\tfor (const edge of graph.edges) {\n\t\tif (edge.kind !== \"dependency\") continue;\n\t\tconst consumer = graph.nodes.find((n) => n.id === edge.to)?.node;\n\t\tif (consumer === void 0 || consumer.kind !== \"service\") continue;\n\t\tconst slot = consumer.inputs[edge.input];\n\t\tif (slot === void 0) continue;\n\t\tconst requirement = requiredPackHeadOf(slot.required);\n\t\tif (requirement === void 0) continue;\n\t\tconst node = graph.nodes.find((n) => n.id === edge.from)?.node;\n\t\tconst provider = node !== void 0 && (node.kind === \"resource\" || node.kind === \"service\") && isPostgresResourceNode(node) ? node : void 0;\n\t\tif (provider === void 0) throw new Error(`service \"${edge.to}\" requires extension pack \"${requirement.packId}\", which only a postgres resource can carry.`);\n\t\tconst { extensionPacks } = await resolveOrmConfig(provider.config);\n\t\tconst pack = extensionPacks.find((p) => p.id === requirement.packId);\n\t\tif (pack === void 0) throw new Error(`postgres database \"${provider.name}\" does not list extension pack \"${requirement.packId}\" in its prisma.config.ts extensions — service \"${edge.to}\" requires it. Add the pack and run migration plan.`);\n\t\tconst head = pack.contractSpace?.headRef.hash;\n\t\tif (head !== requirement.headHash) throw new Error(`postgres database \"${provider.name}\" lists extension pack \"${requirement.packId}\" at head ${head ?? \"(no contract space)\"}, but service \"${edge.to}\" requires ${requirement.headHash}. Upgrade the pack and run migration plan.`);\n\t}\n}\n//#endregion\n//#region src/descriptors/orm-postgres.ts\n/**\n* The migration is a tracked `OrmMigration` Alchemy resource keyed on the\n* target REF identity (hash + sorted invariants): unchanged redeploy is a\n* no-op, a contract or ref-invariant change re-migrates.\n*/\nfunction postgresDescriptor(o) {\n\tconst lowering = ({ id, node, application, graph }) => Effect.gen(function* () {\n\t\tvalidateName(id, \"resource name (from provision id)\");\n\t\tconst { db, url } = yield* stageDatabase({\n\t\t\tid,\n\t\t\tapplication,\n\t\t\tregion: o().region\n\t\t});\n\t\tif (!isPostgresResourceNode(node)) throw new Error(`postgres lowering received a non-postgres node (${id}).`);\n\t\tconst contractJson = node.provides.__cmp.contractJson;\n\t\tconst { migrationsDir, extensionPacks } = yield* Effect.promise(() => resolveOrmConfig(node.config));\n\t\tconst ref = yield* Effect.promise(() => resolveTargetRef(migrationsDir, contractJson, node.targetRef));\n\t\tyield* Effect.promise(() => runPackPreflight(graph));\n\t\tconst warm = yield* PgWarm(`${id}-warm`, { url });\n\t\tyield* OrmMigration(`${id}-migrate`, {\n\t\t\turl: warm.url,\n\t\t\tcontractJson,\n\t\t\tmigrationsDir,\n\t\t\ttargetHash: ref.hash,\n\t\t\tinvariants: [...ref.invariants].sort(),\n\t\t\tpackHeadRefHashes: packHeadRefHashes(extensionPacks),\n\t\t\tconfigPath: node.config,\n\t\t\t...node.targetRef !== void 0 ? { refName: node.targetRef } : {}\n\t\t});\n\t\treturn {\n\t\t\toutputs: { url: warm.url },\n\t\t\tentities: [{\n\t\t\t\tkind: \"postgres-database\",\n\t\t\t\tid: db.databaseId\n\t\t\t}]\n\t\t};\n\t});\n\treturn Object.assign(lowering, { kind: \"resource\" });\n}\n//#endregion\n//#region src/descriptors/raw-postgres.ts\n/**\n* One Database per module-provisioned postgres resource — `id` is the\n* module provision id, so a resource shared by several consumers is created\n* exactly once.\n*/\nfunction rawPostgresDescriptor(o) {\n\tconst lowering = ({ id, application }) => Effect.gen(function* () {\n\t\tvalidateName(id, \"resource name (from provision id)\");\n\t\tconst { db, url } = yield* stageDatabase({\n\t\t\tid,\n\t\t\tapplication,\n\t\t\tregion: o().region\n\t\t});\n\t\treturn {\n\t\t\toutputs: { url: (yield* PgWarm(`${id}-warm`, { url })).url },\n\t\t\tentities: [{\n\t\t\t\tkind: \"postgres-database\",\n\t\t\t\tid: db.databaseId\n\t\t\t}]\n\t\t};\n\t});\n\treturn Object.assign(lowering, { kind: \"resource\" });\n}\n//#endregion\n//#region src/descriptors/s3-credentials.ts\n/**\n* One `S3Credentials` resource per provisioned credentials node — `id` is the\n* module provision id, so a pair shared by the storage service is minted once\n* and kept stable across deploys (the resource's provider preserves it).\n* `_o` is unused today (the mint needs no region/project) but kept for symmetry\n* with the other descriptors' signature.\n*/\nfunction s3CredentialsDescriptor(_o) {\n\tconst lowering = ({ id }) => Effect.gen(function* () {\n\t\tconst creds = yield* S3Credentials(`${id}-creds`, {});\n\t\treturn {\n\t\t\toutputs: {\n\t\t\t\taccessKeyId: creds.accessKeyId,\n\t\t\t\tsecretAccessKey: creds.secretAccessKey\n\t\t\t},\n\t\t\tentities: []\n\t\t};\n\t});\n\treturn Object.assign(lowering, { kind: \"resource\" });\n}\n//#endregion\n//#region src/descriptors/s3-store.ts\nfunction s3StoreDescriptor(o) {\n\tconst base = computeDescriptor(o);\n\treturn {\n\t\tkind: \"service\",\n\t\tprovision: base.provision,\n\t\tpackage: base.package,\n\t\tserialize: (ctx, provisioned, config) => Effect.gen(function* () {\n\t\t\tconst serialized = yield* base.serialize(ctx, provisioned, config);\n\t\t\tconst credentials = config.inputs[\"credentials\"] ?? {};\n\t\t\tconst document = serialized.input !== void 0 ? JSON.parse(serialized.input.value) : void 0;\n\t\t\tconst bucket = typeof document === \"object\" && document !== null && \"bucket\" in document ? document.bucket : void 0;\n\t\t\tif (credentials[\"accessKeyId\"] === void 0 || credentials[\"secretAccessKey\"] === void 0 || bucket === void 0) throw new Error(\"s3-store service must wire a 'credentials' dependency and declare a 'bucket' input key\");\n\t\t\treturn {\n\t\t\t\t...serialized,\n\t\t\t\tbucket,\n\t\t\t\taccessKeyId: credentials[\"accessKeyId\"],\n\t\t\t\tsecretAccessKey: credentials[\"secretAccessKey\"]\n\t\t\t};\n\t\t}),\n\t\tdeploy: (ctx, provisioned, artifact, serialized) => Effect.gen(function* () {\n\t\t\tconst deployed = yield* base.deploy(ctx, provisioned, artifact, serialized);\n\t\t\treturn {\n\t\t\t\t...deployed,\n\t\t\t\toutputs: {\n\t\t\t\t\t...deployed.outputs,\n\t\t\t\t\tbucket: serialized.bucket,\n\t\t\t\t\taccessKeyId: serialized.accessKeyId,\n\t\t\t\t\tsecretAccessKey: serialized.secretAccessKey\n\t\t\t\t}\n\t\t\t};\n\t\t})\n\t};\n}\n//#endregion\n//#region src/reporting/reporter.ts\nfunction prismaCloudReporter() {\n\treturn Builds.buildReporter({ refsOf: (container) => {\n\t\tconst { projectId, branchId, defaultBranchId } = prismaCloudContainerOf(container);\n\t\treturn {\n\t\t\tprojectId,\n\t\t\tbranchId,\n\t\t\tstageBranchId: branchId ?? defaultBranchId\n\t\t};\n\t} });\n}\n//#endregion\n//#region src/control/pointer-timestamps.ts\n/**\n* Carries, on the framework's preflight transport, when each platform\n* variable a Composer row points at was last written — read by preflight in\n* the CLI process, needed by the environment fingerprint in the alchemy\n* process (which re-imports the config from scratch). ISO timestamps only,\n* never values: the Management API returns none and the child's environment\n* is not a place to put one.\n*/\n/** The CLI-process side: what `preflight` hands the framework, or undefined when the deploy read no pointed variable at all. */\nfunction serializePointerUpdatedAt(timestamps) {\n\tif (timestamps.size === 0) return void 0;\n\tconst sorted = [...timestamps].sort(([a], [b]) => a < b ? -1 : 1);\n\treturn JSON.stringify(Object.fromEntries(sorted));\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n/**\n* The alchemy-process side: the timestamps the CLI process transported. An\n* absent payload is the normal case for `prisma-composer dev` and for any run\n* with no pointed variables, and reads as an empty map; a payload that is\n* present but unreadable is a framework bug and throws rather than silently\n* costing the deploy its rotation signal.\n*/\nfunction deserializePointerUpdatedAt(payload) {\n\tconst timestamps = /* @__PURE__ */ new Map();\n\tif (payload === void 0) return timestamps;\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(payload);\n\t} catch (error) {\n\t\tthrow payloadError(error instanceof Error ? error.message : String(error));\n\t}\n\tif (!isRecord(parsed)) throw payloadError(\"it is not a JSON object\");\n\tfor (const [name, updatedAt] of Object.entries(parsed)) {\n\t\tif (typeof updatedAt !== \"string\") throw payloadError(`\"${name}\" is not a string timestamp`);\n\t\ttimestamps.set(name, updatedAt);\n\t}\n\treturn timestamps;\n}\nconst payloadError = (reason) => /* @__PURE__ */ new Error(`prisma-cloud: the deploy preflight's rotation timestamps did not survive the transport into the alchemy process — ${reason}. This is a framework bug; re-running the deploy will not fix it.`);\n/**\n* The pointer lookup the node descriptors close over: `own` — filled by\n* `preflight` — in the CLI process, and the transported payload in the alchemy\n* process, where `own` is empty because that process never runs a preflight.\n* A name in neither reads as unknown, which is every name under\n* `prisma-composer dev`.\n*/\nfunction pointerUpdatedAtLookup(own, env) {\n\tlet transported;\n\treturn (name) => {\n\t\tconst mine = own.get(name);\n\t\tif (mine !== void 0) return mine;\n\t\ttransported ??= deserializePointerUpdatedAt(readPreflightPayload(PRISMA_CLOUD_EXTENSION_ID, env));\n\t\treturn transported.get(name);\n\t};\n}\n//#endregion\n//#region src/control/extension.ts\n/** The Prisma Cloud–hosted deploy state store; its implementation lives in @internal/lowering. */\n/**\n* ADR-0031's registered provisioner for RPC_PEER_KEY: mints one `ServiceKey`\n* resource per edge (ADR-0030) and forwards its value as the opaque ref core\n* writes into the consumer's `serviceKey` param. The resource id keeps the\n* `servicekey-${edgeId}` scheme byte-identical to slice 2's, so an existing\n* deploy's keys are found, not re-minted. Defined here, not in service-keys.ts:\n* that module is also reachable from the runtime/authoring side, which must\n* never import `@internal/lowering` or `effect`.\n*/\nconst serviceKeyProvisioner = { provision: (edge) => Effect.gen(function* () {\n\treturn (yield* Prisma.ServiceKey(`servicekey-${edge.edgeId}`, {})).value;\n}) };\n/**\n* `ctx.provisioned`'s refs are typed `unknown` — core forwards a provisioner's\n* ref without inspecting it. Each provider param below is the sole reader of\n* its own provisioner's output, so the shape is asserted here, once, rather\n* than checked.\n*/\nconst asKeyOutputs = (refs) => refs.map((ref) => blindCast(ref));\n/**\n* RPC's deploy-side `value(refs)` (ADR-0030): the provider stores a SET — one\n* key per inbound edge — into the accepted-keys var `serve()` reads. Paired\n* with the provisioner above: mint per edge, aggregate every edge.\n*\n* Zero consumers still emits, and that is the whole point of #100: an ABSENT\n* var means \"never provisioned\" and passes every caller through, so a deployed\n* provider nobody wired must say \"[]\" — deny everything — rather than say\n* nothing. Written as a literal because `Output.all()` with no arguments has\n* nothing to resolve.\n*/\nconst rpcAcceptedKeysValue = (refs) => refs.length > 0 ? Output.all(...asKeyOutputs(refs)) : [];\n/**\n* ADR-0031's registered provisioner for STREAMS_API_KEY — the same `ServiceKey`\n* mint, keyed PER PROVIDER instead of per edge: the resource id is the\n* provider's address, so every consumer edge of one streams module resolves to\n* the same resource and therefore the same stable value. That is what\n* `@prisma/streams-server` requires (it authenticates a single `API_KEY`), and\n* cardinality is exactly what ADR-0031 leaves to the provisioner. Making it\n* per-edge later is this id's shape plus an accepted-set provider param — no\n* new resource, no core change.\n*/\nconst streamsApiKeyProvisioner = { provision: (edge) => Effect.gen(function* () {\n\treturn (yield* Prisma.ServiceKey(`streamskey-${edge.providerAddress}`, {})).value;\n}) };\n/**\n* Streams' deploy-side `value(refs)`: ONE value, not a set —\n* `@prisma/streams-server` authenticates a single `API_KEY`, which is why the\n* provisioner above mints per provider. That pairing is the invariant this\n* param depends on, so it asserts rather than trusts it: a future per-edge\n* flip without a paired accepted-set param here would otherwise ship\n* whichever key came first and leave every other consumer 401ing, silently.\n* The refs are lazy Outputs (not comparable at serialize time); inside\n* `Output.map` they are resolved strings, the same seam RPC's set aggregates\n* on.\n*\n* Zero consumers emits NOTHING — the streams counterpart to RPC's \"[]\".\n* `@prisma/streams-server` has no deny-all mode: it either authenticates a key\n* or runs --no-auth, so there is no value here that means \"refuse everyone\".\n* Writing no key is what fails closed — the entrypoint refuses to boot with\n* a named error rather than serve unauthenticated.\n*/\nconst streamsApiKeyValue = (refs) => {\n\tif (refs.length === 0) return void 0;\n\treturn Output.map(Output.all(...asKeyOutputs(refs)), (vals) => {\n\t\tconst distinct = [...new Set(vals)];\n\t\tif (distinct.length > 1) throw new Error(`a streams provider was provisioned ${distinct.length} distinct keys across its ${refs.length} inbound bindings, but it can only be given one (@prisma/streams-server authenticates a single API_KEY). Its provisioner must mint per provider, not per edge — or this param must store an accepted-key set, once the server accepts one.`);\n\t\treturn distinct[0] ?? \"\";\n\t});\n};\n/**\n* Origin's deploy-side value function (service-derived): the provisioned\n* service's own `endpointDomain`, verbatim — `https://…`, no trailing slash,\n* no normalization. Every compute service gets this row, exposing or not.\n* The undefined guard is a deploy-time invariant check, not a policy: the\n* Management API always reports an endpoint domain post-PRO-200, so a missing\n* one means the platform predates the fix — fail the deploy loudly rather\n* than write a row origin() would trust. The raw string is JSON-encoded by\n* the descriptor's generic loop, like every other reserved provider param.\n*/\nconst selfOriginValue = (provisioned, address) => Output.map(provisioned.endpointDomain, (v) => {\n\tif (v === void 0) throw new Error(`the App for \"${address}\" reported no endpoint domain at provision — cannot resolve the service's own origin (Management API predates the PRO-200 fix?)`);\n\treturn v;\n});\n/** The user-facing state descriptor: `state: prismaState()` in `prisma-composer.config.ts` (ADR-0017). */\nconst prismaState = () => ({\n\textension: PRISMA_CLOUD_EXTENSION_ID,\n\tcreate: (container) => {\n\t\tconst { projectId, branchId, defaultBranchId } = prismaCloudContainerOf(container);\n\t\treturn prismaStateLayer({\n\t\t\tprojectId,\n\t\t\t...branchId !== void 0 ? { branchId } : {},\n\t\t\t...defaultBranchId !== void 0 ? { defaultBranchId } : {}\n\t\t});\n\t}\n});\nconst KNOWN_REGION_SET = new Set(Prisma$1.KNOWN_REGION_IDS);\nfunction isComputeRegion(value) {\n\treturn KNOWN_REGION_SET.has(value);\n}\n/** Prisma.providers()'s ProviderCollection doesn't structurally unify with Alchemy's inferred providers Layer (a @internal/lowering typings gap); it satisfies it at runtime. */\nfunction asProvidersLayer(layer) {\n\treturn layer;\n}\n/**\n* This extension's brands, each with the two halves ADR-0031 splits: the\n* PROVISIONER core resolves a mint through, and the reserved PROVIDER PARAM\n* that stores the minted values on the provider. So this file stays the only\n* place a brand is named — `descriptors/compute.ts` just looks a provider\n* param up by brand.\n*\n* `__tests__/provider-params.test.ts` asserts this map's brands are exactly\n* `PROVIDER_PARAMS`'s edge-derived brands (a service-derived param like the\n* origin mints nothing, so it has no provisioner): a brand minted here with no provider param\n* below would leave the value it mints written to consumers while no\n* provider ever stores an accepted-keys row for it — `serve()` (or the\n* equivalent runtime reader) then sees an absent var and passes every caller\n* through.\n*/\nconst PROVISIONERS = /* @__PURE__ */ new Map([[RPC_PEER_KEY, serviceKeyProvisioner], [STREAMS_API_KEY, streamsApiKeyProvisioner]]);\n/**\n* Every brand's deploy-side value function — the only per-brand thing this\n* file still holds directly. `PROVIDER_PARAMS` below is built by mapping\n* `RESERVED_PROVIDER_PARAMS` (`provider-params.ts`, the boot-side list) onto\n* this map, so a param can exist on the deploy side only if it already\n* exists on the boot side: `RESERVED_PROVIDER_PARAMS` is the single source of\n* which reserved provider params exist at all, closing the drift the old\n* name-comparison test only detected after the fact.\n*/\nconst PROVIDER_PARAM_VALUES = /* @__PURE__ */ new Map([\n\t[RPC_PEER_KEY, { value: rpcAcceptedKeysValue }],\n\t[STREAMS_API_KEY, { value: streamsApiKeyValue }],\n\t[SELF_ORIGIN, { valueForService: selfOriginValue }]\n]);\n/**\n* Builds the deploy-side registry from the boot-side list, keyed by brand —\n* throws if a boot-side entry has no registered deploy-side value function,\n* so `RESERVED_PROVIDER_PARAMS` stays the single source of which reserved\n* provider params exist: deploy can no longer write a row boot never\n* stashes. Exported (rather than inlined into `PROVIDER_PARAMS` below) so\n* `__tests__/provider-params.test.ts` can drive it directly with a\n* deliberately incomplete value map and watch it throw.\n*/\nfunction buildProviderParams(entries, values) {\n\treturn new Map(entries.map((entry) => {\n\t\tconst value = values.get(entry.brand);\n\t\tif (value === void 0) throw new Error(`prisma-cloud: reserved provider param \"${entry.name}\" (provider-params.ts) has no registered deploy-side value() in control.ts's PROVIDER_PARAM_VALUES — every param in RESERVED_PROVIDER_PARAMS must have one.`);\n\t\treturn [entry.brand, {\n\t\t\t...entry,\n\t\t\t...value\n\t\t}];\n\t}));\n}\nconst PROVIDER_PARAMS = buildProviderParams(RESERVED_PROVIDER_PARAMS, PROVIDER_PARAM_VALUES);\n/**\n* Resolves the factory's env-or-option inputs. Deliberately does NOT require\n* `PRISMA_WORKSPACE_ID`: nothing in this file reads `ResolvedCloudOptions.workspaceId`\n* downstream — it exists only so a caller MAY pin an explicit workspace, and\n* the real workspace check for a real deploy lives where the value actually\n* matters, `container.ts`'s `ensureContainer`/`locateContainer`. Region\n* validation stays eager-on-call (a garbage `PRISMA_REGION` still fails\n* loudly), but an ABSENT one resolves to `undefined` without touching\n* anything else — required for `prisma-composer dev`, which never sets\n* `PRISMA_REGION` and must not fail on its absence (local-dev spec § 5).\n*/\nfunction resolveOptions(opts) {\n\tconst workspaceId = opts.workspaceId ?? process.env[\"PRISMA_WORKSPACE_ID\"] ?? \"\";\n\tif (opts.region !== void 0) return {\n\t\tworkspaceId,\n\t\tregion: opts.region,\n\t\tproviderParams: PROVIDER_PARAMS\n\t};\n\tconst region = process.env[\"PRISMA_REGION\"];\n\tif (region === void 0 || region.length === 0) return {\n\t\tworkspaceId,\n\t\tproviderParams: PROVIDER_PARAMS\n\t};\n\tif (!isComputeRegion(region)) throw new Error(`prismaCloud(): environment variable PRISMA_REGION=\"${region}\" is not a known region (expected one of: ${Prisma$1.KNOWN_REGION_IDS.join(\", \")}).`);\n\treturn {\n\t\tworkspaceId,\n\t\tregion,\n\t\tproviderParams: PROVIDER_PARAMS\n\t};\n}\n/**\n* A memoized thunk over `resolveOptions` — evaluated at FIRST LOWERING USE\n* (inside a node descriptor's `provision`/`serialize`), never at `prismaCloud()`\n* construction. The node descriptors take this thunk, not a resolved value\n* (local-dev spec § 5): `prismaCloud()` itself must construct with no\n* environment present, since it also builds the `localTarget` descriptor, which must\n* never require `PRISMA_WORKSPACE_ID`/`PRISMA_REGION`/`PRISMA_SERVICE_TOKEN`.\n*/\nfunction lazyOptions(opts, pointerUpdatedAt) {\n\tlet cached;\n\treturn () => {\n\t\tcached ??= {\n\t\t\t...resolveOptions(opts),\n\t\t\tpointerUpdatedAt\n\t\t};\n\t\treturn cached;\n\t};\n}\n/** The Prisma Cloud extension descriptor — `prisma-composer.config.ts` lists it under `extensions`. */\nconst prismaCloud = (opts = {}) => {\n\tconst preflightTimestamps = /* @__PURE__ */ new Map();\n\tconst o = lazyOptions(opts, pointerUpdatedAtLookup(preflightTimestamps, process.env));\n\treturn {\n\t\tid: PRISMA_CLOUD_EXTENSION_ID,\n\t\tcontainer: containerDescriptor(),\n\t\tproviders: () => asProvidersLayer(Layer.mergeAll(Prisma.providers(), PgWarmProvider(), OrmMigrationProvider(), S3CredentialsProvider(), GeneratedParamProvider(), Prisma.ServiceKeyProvider())),\n\t\tpreflight: (input) => runPreflight(input).then((timestamps) => {\n\t\t\tfor (const [name, updatedAt] of timestamps) preflightTimestamps.set(name, updatedAt);\n\t\t\treturn serializePointerUpdatedAt(timestamps);\n\t\t}),\n\t\treporter: prismaCloudReporter(),\n\t\tapplication: { provision: (ctx) => Effect.gen(function* () {\n\t\t\tconst { projectId, branchId, defaultBranchId, branchless } = prismaCloudContainerOf(ctx.container);\n\t\t\tyield* Prisma.claimDatabaseUrlKeys(projectId);\n\t\t\treturn {\n\t\t\t\tprojectId,\n\t\t\t\tbranchId,\n\t\t\t\tdefaultBranchId,\n\t\t\t\tbranchless\n\t\t\t};\n\t\t}) },\n\t\tprovisions: PROVISIONERS,\n\t\tnodes: {\n\t\t\t\"raw-postgres\": rawPostgresDescriptor(o),\n\t\t\tpostgres: postgresDescriptor(o),\n\t\t\tcompute: computeDescriptor(o),\n\t\t\tcredentials: s3CredentialsDescriptor(o),\n\t\t\t\"s3-store\": s3StoreDescriptor(o),\n\t\t\ts3: bucketDescriptor(o)\n\t\t},\n\t\tlocalTarget: () => import(\"@prisma/composer-prisma-cloud/local-target\").then((m) => m.localTargetDescriptor())\n\t};\n};\n//#endregion\nexport { PROVIDER_PARAMS, buildProviderParams, prismaCloud, prismaState };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,wBAAwB;AAC9B,MAAM,mBAAmB;;AAEzB,SAAS,aAAa,WAAW,OAAO;CACvC,IAAI,UAAU,KAAK,GAAG,OAAO;CAC7B,MAAM,QAAQA,KAAG,YAAY,SAAS,CAAC,CAAC,MAAM,MAAM,eAAe,KAAK,CAAC,CAAC;CAC1E,IAAI,UAAU,KAAK,GAAG,MAAM,IAAI,MAAM,2CAA2C,WAAW;CAC5F,OAAO;AACR;AACA,SAAS,oBAAoB,MAAM,OAAO;CACzC,OAAO,OAAO,QAAQ,OAAO,KAAK,KAAK,SAAS,MAAM,GAAG,OAAO,KAAK,MAAM,SAAS,MAAM,CAAC;AAC5F;;;;;;AAMA,SAAS,YAAY,KAAK;CACzB,MAAM,MAAM,CAAC;CACb,MAAM,WAAWA,KAAG,aAAa,GAAG;CACpC,MAAM,SAAS,QAAQ;EACtB,KAAK,MAAM,SAASA,KAAG,YAAYC,OAAK,KAAK,KAAK,GAAG,GAAG,EAAE,eAAe,KAAK,CAAC,GAAG;GACjF,MAAM,MAAM,IAAI,SAAS,IAAI,GAAG,IAAI,GAAG,MAAM,SAAS,MAAM;GAC5D,IAAI,MAAM,eAAe,GAAG;IAC3B,MAAM,cAAcA,OAAK,KAAK,KAAK,GAAG,IAAI,MAAM,GAAG,CAAC;IACpD,MAAM,SAASD,KAAG,aAAa,WAAW;IAC1C,IAAIC,OAAK,QAAQ,OAAO,OAAO,S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AAa,wBAAwB,CAAC;GACtC,YAAY,kBAAkB,CAAC;GAC/B,IAAI,iBAAiB,CAAC;EACvB;EACA,mBAAmB,OAAO,6CAA6C,CAAC,MAAM,MAAM,EAAE,sBAAsB,CAAC;CAC9G;AACD"}
1
+ {"version":3,"file":"control.mjs","names":["fs","path","os","REPORT_DEADLINE_MS","isRecord","os","isRecord","managementClientLayer","Builds.buildReporter","Prisma.ServiceKey","Prisma.providers","Prisma.ServiceKeyProvider","Prisma.claimDatabaseUrlKeys"],"sources":["../../../1-prisma-cloud/0-lowering/lowering/dist/artifact-CoKVIyRH.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/resources-CXUKkcyA.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/state.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/builds.mjs","../../../1-prisma-cloud/1-extensions/target/dist/control.mjs"],"sourcesContent":["import * as crypto from \"node:crypto\";\nimport * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport * as zlib from \"node:zlib\";\nimport { isWithin } from \"@internal/bundle-paths\";\n//#region src/compute/artifact.ts\n/**\n* Assembles a Prisma Compute artifact: the app-built bundle plus the\n* extension-printed bootstrap and manifest, tarred and gzipped deterministically\n* (fixed mtimes, sorted entry order) so an unchanged service noops on\n* redeploy — a rebuild is the only thing that changes the hash. Lives here\n* (not in @prisma/composer-prisma-cloud/control) because it needs node:fs/node:zlib,\n* which the extension's shipped src may never import (invariant 5).\n*/\n/** The content type every Composer compute artifact is uploaded with (a deterministic tar.gz). */\nconst ARTIFACT_CONTENT_TYPE = \"application/gzip\";\nconst MANIFEST_VERSION = \"1\";\n/** Finds main.js/main.mjs in a bundle dir when no explicit entry is given. */\nfunction resolveEntry(bundleDir, entry) {\n\tif (entry !== void 0) return entry;\n\tconst found = fs.readdirSync(bundleDir).find((f) => /^main\\.m?js$/.test(f));\n\tif (found === void 0) throw new Error(`no main.js/main.mjs found in bundle dir ${bundleDir}`);\n\treturn found;\n}\nfunction compareArchivePaths(left, right) {\n\treturn Buffer.compare(Buffer.from(left.relPath, \"utf8\"), Buffer.from(right.relPath, \"utf8\"));\n}\n/** All files and safe symlinks under `dir`, as dir-relative POSIX paths, in\n* sorted order. Symlinks are preserved as links — never dereferenced — after\n* their real target is proven to remain inside the bundle root. This accepts\n* framework-produced trees such as Next standalone while retaining ADR-0005's\n* boundary against packaging arbitrary files from the deploy machine. */\nfunction walkEntries(dir) {\n\tconst out = [];\n\tconst realRoot = fs.realpathSync(dir);\n\tconst visit = (sub) => {\n\t\tfor (const entry of fs.readdirSync(path.join(dir, sub), { withFileTypes: true })) {\n\t\t\tconst rel = sub.length > 0 ? `${sub}/${entry.name}` : entry.name;\n\t\t\tif (entry.isSymbolicLink()) {\n\t\t\t\tconst symlinkPath = path.join(dir, ...rel.split(\"/\"));\n\t\t\t\tconst target = fs.readlinkSync(symlinkPath);\n\t\t\t\tif (path.sep === \"/\" && target.includes(\"\\\\\")) throw new Error(`bundle symlink at ${rel} has an unsupported backslash target: ${target}`);\n\t\t\t\tlet realTarget;\n\t\t\t\ttry {\n\t\t\t\t\trealTarget = fs.realpathSync(path.resolve(path.dirname(symlinkPath), target));\n\t\t\t\t} catch {\n\t\t\t\t\tthrow new Error(`bundle symlink at ${rel} is dangling: ${target}`);\n\t\t\t\t}\n\t\t\t\tif (!isWithin(realRoot, realTarget)) throw new Error(`bundle symlink at ${rel} escapes the bundle root: ${target} — deploy artifacts may only preserve links whose targets are inside the assembled bundle.`);\n\t\t\t\tconst linkname = (path.isAbsolute(target) ? path.relative(fs.realpathSync(path.dirname(symlinkPath)), realTarget) : target).split(path.sep).join(\"/\");\n\t\t\t\tif (!isWithin(dir, path.resolve(path.dirname(symlinkPath), ...linkname.split(\"/\")))) throw new Error(`bundle symlink at ${rel} has a target that leaves the bundle: ${linkname} — its resolved target is inside the bundle, but the link path itself walks outside and re-enters, which every extractor rejects. Point the link at the in-bundle path directly.`);\n\t\t\t\tout.push({\n\t\t\t\t\trelPath: rel,\n\t\t\t\t\ttype: \"symlink\",\n\t\t\t\t\tlinkname\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (entry.isDirectory()) visit(rel);\n\t\t\telse if (entry.isFile()) {\n\t\t\t\tconst mode = fs.statSync(path.join(dir, ...rel.split(\"/\"))).mode;\n\t\t\t\tout.push({\n\t\t\t\t\trelPath: rel,\n\t\t\t\t\ttype: \"file\",\n\t\t\t\t\texecutable: (mode & 64) !== 0\n\t\t\t\t});\n\t\t\t} else throw new Error(`bundle contains an unsupported filesystem entry: ${rel}`);\n\t\t}\n\t};\n\tvisit(\"\");\n\treturn out.sort(compareArchivePaths);\n}\nfunction octal(value, length) {\n\treturn `${value.toString(8).padStart(length - 1, \"0\")}\\0`;\n}\n/** Splits a path into ustar's name (<=100 bytes) + prefix (<=155 bytes) fields. */\nfunction splitUstarPath(relPath) {\n\tif (Buffer.byteLength(relPath, \"utf8\") <= 100) return {\n\t\tname: relPath,\n\t\tprefix: \"\"\n\t};\n\tfor (let i = relPath.length - 1; i >= 0; i--) {\n\t\tif (relPath[i] !== \"/\") continue;\n\t\tconst prefix = relPath.slice(0, i);\n\t\tconst name = relPath.slice(i + 1);\n\t\tif (Buffer.byteLength(prefix, \"utf8\") <= 155 && Buffer.byteLength(name, \"utf8\") <= 100) return {\n\t\t\tname,\n\t\t\tprefix\n\t\t};\n\t}\n\tthrow new Error(`path too long for a ustar tar entry: ${relPath}`);\n}\nfunction paxRecord(key, value) {\n\tconst payload = ` ${key}=${value}\\n`;\n\tlet length = Buffer.byteLength(payload, \"utf8\") + 1;\n\twhile (true) {\n\t\tconst record = `${length}${payload}`;\n\t\tconst actualLength = Buffer.byteLength(record, \"utf8\");\n\t\tif (actualLength === length) return record;\n\t\tlength = actualLength;\n\t}\n}\nfunction ustarPathOrPlaceholder(relPath) {\n\ttry {\n\t\tsplitUstarPath(relPath);\n\t\treturn { path: relPath };\n\t} catch {\n\t\treturn {\n\t\t\tpath: `PaxEntries/${crypto.createHash(\"sha256\").update(relPath).digest(\"hex\").slice(0, 32)}`,\n\t\t\tpaxPath: relPath\n\t\t};\n\t}\n}\nfunction ustarHeader(relPath, size, options) {\n\tconst { name, prefix } = splitUstarPath(relPath);\n\tconst buf = Buffer.alloc(512);\n\tbuf.write(name, 0, 100, \"utf8\");\n\tbuf.write(octal(options.mode, 8), 100, 8, \"utf8\");\n\tbuf.write(octal(0, 8), 108, 8, \"utf8\");\n\tbuf.write(octal(0, 8), 116, 8, \"utf8\");\n\tbuf.write(octal(size, 12), 124, 12, \"utf8\");\n\tbuf.write(octal(0, 12), 136, 12, \"utf8\");\n\tbuf.write(\" \", 148, 8, \"utf8\");\n\tbuf.write(options.typeflag, 156, 1, \"utf8\");\n\tif (options.linkname !== void 0) buf.write(options.linkname, 157, 100, \"utf8\");\n\tbuf.write(\"ustar\\0\", 257, 6, \"utf8\");\n\tbuf.write(\"00\", 263, 2, \"utf8\");\n\tbuf.write(prefix, 345, 155, \"utf8\");\n\tlet sum = 0;\n\tfor (const b of buf) sum += b;\n\tbuf.write(`${sum.toString(8).padStart(6, \"0\")}\\0 `, 148, 8, \"utf8\");\n\treturn buf;\n}\nfunction createDeterministicTarGz(entries) {\n\tconst sorted = [...entries].sort(compareArchivePaths);\n\tconst chunks = [];\n\tfor (const entry of sorted) {\n\t\tconst archivePath = ustarPathOrPlaceholder(entry.relPath);\n\t\tconst pax = [archivePath.paxPath === void 0 ? \"\" : paxRecord(\"path\", archivePath.paxPath)];\n\t\tif (entry.type === \"symlink\" && Buffer.byteLength(entry.linkname, \"utf8\") > 100) pax.push(paxRecord(\"linkpath\", entry.linkname));\n\t\tconst paxContent = Buffer.from(pax.join(\"\"), \"utf8\");\n\t\tif (paxContent.length > 0) {\n\t\t\tconst digest = crypto.createHash(\"sha256\").update(entry.relPath).digest(\"hex\").slice(0, 32);\n\t\t\tchunks.push(ustarHeader(`PaxHeaders/${digest}`, paxContent.length, {\n\t\t\t\tmode: 420,\n\t\t\t\ttypeflag: \"x\"\n\t\t\t}));\n\t\t\tchunks.push(paxContent);\n\t\t\tconst paxPad = (512 - paxContent.length % 512) % 512;\n\t\t\tif (paxPad > 0) chunks.push(Buffer.alloc(paxPad));\n\t\t}\n\t\tif (entry.type === \"symlink\") chunks.push(ustarHeader(archivePath.path, 0, {\n\t\t\tmode: 511,\n\t\t\ttypeflag: \"2\",\n\t\t\tlinkname: Buffer.byteLength(entry.linkname, \"utf8\") <= 100 ? entry.linkname : \"././@LongSymLink\"\n\t\t}));\n\t\telse {\n\t\t\tchunks.push(ustarHeader(archivePath.path, entry.content.length, {\n\t\t\t\tmode: entry.mode,\n\t\t\t\ttypeflag: \"0\"\n\t\t\t}));\n\t\t\tchunks.push(entry.content);\n\t\t\tconst pad = (512 - entry.content.length % 512) % 512;\n\t\t\tif (pad > 0) chunks.push(Buffer.alloc(pad));\n\t\t}\n\t}\n\tchunks.push(Buffer.alloc(1024));\n\treturn zlib.gzipSync(Buffer.concat(chunks));\n}\n/**\n* Prints the bootstrap + manifest and tars them with the bundle into a\n* deterministic artifact. If bundleDir doesn't exist (e.g. `alchemy destroy`\n* run before any build), returns a placeholder rather than throwing — the\n* artifact is never read on destroy.\n*/\nfunction packageComputeArtifact(opts) {\n\tif (!fs.existsSync(opts.bundleDir)) return {\n\t\tpath: \"\",\n\t\tsha256: \"absent\"\n\t};\n\tconst entryFile = resolveEntry(opts.bundleDir, opts.bundleEntry);\n\tconst bootstrapData = `${JSON.stringify({\n\t\tmoduleEntrypoint: `./${entryFile}`,\n\t\tappEntrypoint: `./${opts.appEntry}`,\n\t\taddress: opts.address\n\t}, null, 2)}\\n`;\n\tconst bootstrap = `import { readFile } from \"node:fs/promises\";\n\nconst boot = JSON.parse(\n await readFile(new URL(\"./compute.bootstrap.json\", import.meta.url), \"utf8\"),\n);\n\n// Compute currently boots JavaScript with Bun. Its URL and URLSearchParams\n// implementations accept Object.defineProperty but reject assignment to\n// Node's custom-inspect symbol. SvelteKit assigns that symbol while creating a\n// tracked request URL, so install a narrow setter that materializes the same\n// own property Node would. Remove this compatibility shim when the upstream\n// Alchemy Compute runtime owns the equivalent normalization.\nif (process.versions.bun !== undefined) {\n const inspect = Symbol.for(\"nodejs.util.inspect.custom\");\n for (const constructor of [URL, URLSearchParams]) {\n const inherited = constructor.prototype[inspect];\n Object.defineProperty(constructor.prototype, inspect, {\n configurable: true,\n get() { return inherited; },\n set(value) {\n Object.defineProperty(this, inspect, { configurable: true, value, writable: true });\n },\n });\n }\n}\n\nconst main = (await import(boot.moduleEntrypoint)).default;\nawait main.run(boot.address, () => import(boot.appEntrypoint));\n`;\n\tconst manifest = `${JSON.stringify({\n\t\tmanifestVersion: MANIFEST_VERSION,\n\t\tentrypoint: \"bootstrap.js\",\n\t\taddress: opts.address\n\t}, null, 2)}\\n`;\n\tconst files = walkEntries(opts.bundleDir).map((entry) => entry.type === \"symlink\" ? entry : {\n\t\trelPath: entry.relPath,\n\t\ttype: \"file\",\n\t\tcontent: fs.readFileSync(path.join(opts.bundleDir, ...entry.relPath.split(\"/\"))),\n\t\tmode: entry.executable ? 493 : 420\n\t});\n\tfiles.push({\n\t\trelPath: \"bootstrap.js\",\n\t\ttype: \"file\",\n\t\tcontent: Buffer.from(bootstrap, \"utf8\"),\n\t\tmode: 420\n\t});\n\tfiles.push({\n\t\trelPath: \"compute.bootstrap.json\",\n\t\ttype: \"file\",\n\t\tcontent: Buffer.from(bootstrapData, \"utf8\"),\n\t\tmode: 420\n\t});\n\tfiles.push({\n\t\trelPath: \"compute.manifest.json\",\n\t\ttype: \"file\",\n\t\tcontent: Buffer.from(manifest, \"utf8\"),\n\t\tmode: 420\n\t});\n\tfiles.push({\n\t\trelPath: \"bunfig.toml\",\n\t\ttype: \"file\",\n\t\tcontent: Buffer.from(\"[install]\\nauto = \\\"disable\\\"\\n\", \"utf8\"),\n\t\tmode: 420\n\t});\n\tconst gz = createDeterministicTarGz(files);\n\tconst sha256 = crypto.createHash(\"sha256\").update(gz).digest(\"hex\");\n\tconst outDir = path.join(os.tmpdir(), `prisma-composer-compute-${String(os.userInfo().uid)}`, sha256.slice(0, 16));\n\tfs.mkdirSync(outDir, { recursive: true });\n\tconst outPath = path.join(outDir, `${opts.id}.tar.gz`);\n\tconst tmpPath = path.join(outDir, `.${opts.id}.${crypto.randomUUID()}.tmp`);\n\tfs.writeFileSync(tmpPath, gz);\n\tfs.renameSync(tmpPath, outPath);\n\treturn {\n\t\tpath: outPath,\n\t\tsha256\n\t};\n}\n//#endregion\nexport { packageComputeArtifact as n, ARTIFACT_CONTENT_TYPE as t };\n\n//# sourceMappingURL=artifact-CoKVIyRH.mjs.map","//#region src/builds/api.ts\n/**\n* Reporting is observability, so no call may stall the deploy: every request\n* carries this deadline, and an expired one is warned and dropped like any\n* other failure.\n*/\nconst REPORT_DEADLINE_MS = 1e4;\nfunction buildsApi(options) {\n\tconst { client, warn } = options;\n\t/** Runs one call, turning every failure — transport or refusal — into a warning and `undefined`. */\n\tconst send = async (call, describe) => {\n\t\tlet result;\n\t\ttry {\n\t\t\tresult = await call();\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\twarn(`Could not reach Prisma Cloud to ${describe}: ${detail}`);\n\t\t\treturn;\n\t\t}\n\t\tif (!result.response.ok) {\n\t\t\tconst detail = result.error === void 0 ? \"\" : `: ${JSON.stringify(result.error)}`;\n\t\t\twarn(`Prisma Cloud refused to ${describe} (HTTP ${String(result.response.status)})${detail}`);\n\t\t\treturn;\n\t\t}\n\t\treturn result.data ?? {};\n\t};\n\treturn {\n\t\tasync create(body) {\n\t\t\tconst created = await send(() => client.POST(\"/v1/builds\", {\n\t\t\t\tbody,\n\t\t\t\tsignal: AbortSignal.timeout(REPORT_DEADLINE_MS)\n\t\t\t}), \"record this deploy\");\n\t\t\tif (created === void 0) return void 0;\n\t\t\tconst id = created.data?.id;\n\t\t\tif (id === void 0 || id.length === 0) {\n\t\t\t\twarn(\"Prisma Cloud recorded this deploy but returned no build id.\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn id;\n\t\t},\n\t\tasync update(id, body) {\n\t\t\treturn await send(() => client.PATCH(\"/v1/builds/{buildId}\", {\n\t\t\t\tparams: { path: { buildId: id } },\n\t\t\t\tbody,\n\t\t\t\tsignal: AbortSignal.timeout(REPORT_DEADLINE_MS)\n\t\t\t}), \"update this deploy's build\") !== void 0;\n\t\t},\n\t\tasync reportResource(id, resourceType, resourceId, action) {\n\t\t\treturn await send(() => client.PUT(\"/v1/builds/{buildId}/resources/{resourceType}/{resourceId}\", {\n\t\t\t\tparams: { path: {\n\t\t\t\t\tbuildId: id,\n\t\t\t\t\tresourceType,\n\t\t\t\t\tresourceId\n\t\t\t\t} },\n\t\t\t\tbody: { action },\n\t\t\t\tsignal: AbortSignal.timeout(REPORT_DEADLINE_MS)\n\t\t\t}), `record the ${resourceType} this deploy ${action === \"acted_on\" ? \"acted on\" : action}`) !== void 0;\n\t\t}\n\t};\n}\n//#endregion\n//#region src/builds/resources.ts\n/** Names the build a run belongs to. Set by the CLI on the alchemy child, or by a CI runner that created the build itself. */\nconst BUILD_ID_ENV = \"PRISMA_BUILD_ID\";\n/**\n* Alchemy resource type → platform resource type, keyed by upstream\n* `alchemy/Prisma`'s type-ids and attribute names — the shapes the state\n* store actually writes since the upstream provider adoption.\n*\n* Two resources are deliberately absent. `Prisma.BucketAccessKey` has no\n* platform resource type to map onto. `PrismaCloud.ServiceKey` is a value\n* this deploy mints locally, not a platform resource at all — the platform's\n* `service_key` is what `Prisma.Connection` creates.\n*\n* Anything not listed — `PgWarm`, and every resource another extension\n* contributes — is not a Prisma Cloud resource and is not reported.\n*/\nconst PLATFORM_RESOURCES = {\n\t\"Prisma.Project\": {\n\t\ttype: \"project\",\n\t\tidField: \"projectId\"\n\t},\n\t\"Prisma.Database\": {\n\t\ttype: \"database\",\n\t\tidField: \"databaseId\"\n\t},\n\t\"Prisma.Connection\": {\n\t\ttype: \"service_key\",\n\t\tidField: \"connectionId\"\n\t},\n\t\"Prisma.Bucket\": {\n\t\ttype: \"bucket\",\n\t\tidField: \"bucketId\"\n\t},\n\t\"Prisma.App\": {\n\t\ttype: \"app\",\n\t\tidField: \"appId\"\n\t},\n\t\"Prisma.Deployment\": {\n\t\ttype: \"deployment\",\n\t\tidField: \"deploymentId\"\n\t},\n\t\"Prisma.EnvironmentVariable\": {\n\t\ttype: \"config_variable\",\n\t\tidField: \"environmentVariableId\"\n\t}\n};\n/**\n* Terminal status → what the run did to the resource. The intermediate\n* statuses (`creating`, `updating`, `replacing`) are skipped: they say work\n* started, not that it landed, and the terminal write follows immediately.\n*\n* `updated` maps to `acted_on` rather than to nothing, because a reconcile\n* that changed no field is still this run acting on that resource — a\n* migration against an untouched database is an action on it.\n*/\nconst ACTION_BY_STATUS = {\n\tcreated: \"created\",\n\tupdated: \"acted_on\",\n\tdeleting: \"deleted\"\n};\nconst isRecord = (value) => typeof value === \"object\" && value !== null;\n/**\n* What a persisted state record says this run did, or `undefined` when it\n* says nothing reportable. Reads defensively: the record crosses a wire and\n* carries resources from every extension, not only this one's.\n*/\nfunction reportableResource(value) {\n\tif (!isRecord(value)) return void 0;\n\tif (value[\"kind\"] === \"action\") return void 0;\n\tif (value[\"adopting\"] === true) return void 0;\n\tconst resourceType = value[\"resourceType\"];\n\tif (typeof resourceType !== \"string\") return void 0;\n\tconst mapping = PLATFORM_RESOURCES[resourceType];\n\tif (mapping === void 0) return void 0;\n\tconst status = value[\"status\"];\n\tconst action = typeof status === \"string\" ? ACTION_BY_STATUS[status] : void 0;\n\tif (action === void 0) return void 0;\n\tconst attr = value[\"attr\"];\n\tif (!isRecord(attr)) return void 0;\n\tconst id = attr[mapping.idField];\n\tif (typeof id !== \"string\" || id.length === 0) return void 0;\n\treturn {\n\t\ttype: mapping.type,\n\t\tid,\n\t\taction\n\t};\n}\n/**\n* The most a drain will wait, total. Every real report already carries the\n* api layer's per-request deadline, so this never fires for the shipped\n* `BuildsApi`; it is the backstop that keeps the state layer's finalizer —\n* and therefore the deploy lease release — bounded against any implementation.\n*/\nconst DRAIN_DEADLINE_MS = 15e3;\nfunction resourceReporter(api, buildId, warn = (message) => console.warn(message), drainDeadlineMs = DRAIN_DEADLINE_MS) {\n\tconst inFlight = /* @__PURE__ */ new Set();\n\tconst reported = /* @__PURE__ */ new Set();\n\treturn {\n\t\tobserve(value) {\n\t\t\tconst resource = reportableResource(value);\n\t\t\tif (resource === void 0) return;\n\t\t\tconst key = `${resource.type}:${resource.id}:${resource.action}`;\n\t\t\tif (reported.has(key)) return;\n\t\t\treported.add(key);\n\t\t\tconst sent = api.reportResource(buildId, resource.type, resource.id, resource.action).finally(() => inFlight.delete(sent));\n\t\t\tinFlight.add(sent);\n\t\t},\n\t\tasync drain() {\n\t\t\tconst deadline = Date.now() + drainDeadlineMs;\n\t\t\twhile (inFlight.size > 0) {\n\t\t\t\tconst remaining = deadline - Date.now();\n\t\t\t\tif (remaining <= 0) {\n\t\t\t\t\twarn(`Abandoned ${inFlight.size} in-flight resource report(s) after ${drainDeadlineMs}ms.`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tawait Promise.race([Promise.allSettled([...inFlight]), new Promise((resolve) => setTimeout(resolve, remaining).unref?.())]);\n\t\t\t\tif (Date.now() >= deadline && inFlight.size > 0) {\n\t\t\t\t\twarn(`Abandoned ${inFlight.size} in-flight resource report(s) after ${drainDeadlineMs}ms.`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n}\n//#endregion\nexport { buildsApi as i, reportableResource as n, resourceReporter as r, BUILD_ID_ENV as t };\n\n//# sourceMappingURL=resources-CXUKkcyA.mjs.map","import { n as fromEnv, r as managementApiBaseUrl, t as PrismaCredentials } from \"./credentials-DhT4a38W.mjs\";\nimport { c as collectPages, d as PrismaApiError, f as call, m as layer, p as ManagementClient, s as resolveDefaultBranchId, t as RESERVED_DATABASE_URL_KEYS } from \"./database-url-claim-m_nGXIHa.mjs\";\nimport { t as ARTIFACT_CONTENT_TYPE } from \"./artifact-CoKVIyRH.mjs\";\nimport { i as buildsApi, r as resourceReporter, t as BUILD_ID_ENV } from \"./resources-CXUKkcyA.mjs\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as Data from \"effect/Data\";\nimport * as os from \"node:os\";\nimport { Stack } from \"alchemy\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport { State, makeHttpStateStore } from \"alchemy/State\";\nimport * as FetchHttpClient from \"effect/unstable/http/FetchHttpClient\";\nimport * as HttpClientRequest from \"effect/unstable/http/HttpClientRequest\";\nimport * as Headers from \"effect/unstable/http/Headers\";\n//#region src/builds/state-store.ts\n/**\n* Reports on the way out of a successful `set`, never before it: a write that\n* failed leaves the resource unrecorded here, and claiming otherwise would\n* make the build's provenance a guess.\n*/\nfunction withResourceReporting(inner, api, buildId, warn) {\n\tconst reporter = resourceReporter(api, buildId, warn);\n\treturn {\n\t\tstore: {\n\t\t\t...inner,\n\t\t\tset(request) {\n\t\t\t\treturn inner.set(request).pipe(Effect.tap(() => Effect.sync(() => reporter.observe(request.value))));\n\t\t\t}\n\t\t},\n\t\treporter\n\t};\n}\n//#endregion\n//#region src/state/empty-scope.ts\n/**\n* Whether the platform state API holds any resources for (stack, stage).\n* Requires the live deploy lease — the listing runs under it, like every\n* state operation.\n*/\nconst scopeOccupied = (client, scope, lease) => call(() => client.GET(\"/v1/projects/{projectId}/branches/{branchId}/alchemy-state/state/stacks/{stack}/stages/{stage}/resources\", { params: {\n\tpath: {\n\t\tprojectId: scope.projectId,\n\t\tbranchId: scope.branchId,\n\t\tstack: scope.stack,\n\t\tstage: scope.stage\n\t},\n\theader: { \"alchemy-state-lease-id\": Redacted.value(lease.leaseId) }\n} })).pipe(Effect.map((fqns) => fqns.length > 0));\nconst listBranchResources = (client, projectId, branchId) => Effect.gen(function* () {\n\tconst query = (cursor) => cursor === void 0 ? {\n\t\tprojectId,\n\t\tbranchId\n\t} : {\n\t\tprojectId,\n\t\tbranchId,\n\t\tcursor\n\t};\n\tconst apps = yield* collectPages(`apps on branch ${branchId}`, (cursor) => call(() => client.GET(\"/v1/apps\", { params: { query: query(cursor) } })));\n\tconst databases = yield* collectPages(`databases on branch ${branchId}`, (cursor) => call(() => client.GET(\"/v1/databases\", { params: { query: query(cursor) } })));\n\tconst buckets = yield* collectPages(`buckets on branch ${branchId}`, (cursor) => call(() => client.GET(\"/v1/buckets\", { params: { query: query(cursor) } })));\n\treturn [\n\t\t...apps.map((r) => ({\n\t\t\tkind: \"app\",\n\t\t\tname: r.name\n\t\t})),\n\t\t...databases.map((r) => ({\n\t\t\tkind: \"database\",\n\t\t\tname: r.name\n\t\t})),\n\t\t...buckets.map((r) => ({\n\t\t\tkind: \"bucket\",\n\t\t\tname: r.name\n\t\t}))\n\t];\n});\n/**\n* The empty-scope-with-live-resources case: the platform state API holds no\n* resources for (stack, stage) while the platform already has Compute apps,\n* databases, or buckets on the target Branch — this stage predates the\n* platform state API (its state lives in a legacy `prisma-composer-state`\n* database, which is never read; there is no automatic migration), or the\n* deploy targets a project that already runs something. Deploying would\n* recreate every resource and die in per-resource `already_exists` failures —\n* so fail once, up front. A genuinely fresh deploy sees an empty Branch and\n* passes. Connections are not counted: they are children of databases, which\n* are. Local dev never reaches this — the dev stack pins\n* `state: localState()` (generate-dev-stack.ts).\n*/\nconst failOnEmptyScopeWithLiveResources = (projectId, branchId, stack, stage) => Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\tconst resources = yield* listBranchResources(client, projectId, branchId);\n\tif (resources.length === 0) return;\n\tconst names = resources.map((r) => `${r.kind} \"${r.name}\"`).join(\", \");\n\treturn yield* Effect.fail(new PrismaApiError({\n\t\tstatus: 0,\n\t\tmessage: `the platform state API holds no deploy state for stage \"${stage}\" (stack \"${stack}\"), but the platform already has ${String(resources.length)} resource(s) on the target branch ${branchId}: ${names}. This stage predates the platform state API. With no state, a deploy would recreate every resource and fail with already_exists, and a destroy would remove nothing. Destroy the stage with the previous version of composer, or delete the stage (its branch — or the project, for production) in the Prisma Console or via the Management API — then redeploy fresh. If those resources are another deployment's, remove them or deploy into a different project. Then retry.`\n\t}));\n});\n//#endregion\n//#region src/state/errors.ts\n/**\n* An operator-facing failure from the hosted-state bootstrap pipeline\n* (branch resolution, lease acquisition, or the migration guard) — what a\n* deployer actually sees, instead of a raw Effect defect.\n*/\nvar HostedStateBootstrapError = class extends Data.TaggedError(\"HostedStateBootstrapError\") {\n\tget message() {\n\t\treturn `hosted-state bootstrap failed in ${this.container}: ${this.step} — ${this.reason}`;\n\t}\n};\n/**\n* Builds a {@link HostedStateBootstrapError} from whatever the failed step\n* threw. Never retains the raw API error object as `cause`: only the\n* extracted message text survives into the operator-facing error, so a\n* credential or lease id carried on the raw error can never leak.\n*/\nconst hostedStateBootstrapError = (container, step, cause) => new HostedStateBootstrapError({\n\tcontainer,\n\tstep,\n\treason: cause instanceof Error ? cause.message : String(cause)\n});\n//#endregion\n//#region src/state/lease.ts\n/** The header every state operation and lease call carries. Its value is a capability token — never log it. */\nconst LEASE_HEADER = \"Alchemy-State-Lease-Id\";\n/**\n* Adds the lease header to effect's redacted header names (alongside the\n* defaults such as `authorization`), so a logged failed request renders the\n* lease id as `<redacted>`. Merged into the state layer's outputs.\n*/\nconst redactLeaseHeader = Layer.effect(Headers.CurrentRedactedNames, Effect.gen(function* () {\n\treturn [...yield* Headers.CurrentRedactedNames, LEASE_HEADER];\n}));\nconst LEASE_PATH = \"/v1/projects/{projectId}/branches/{branchId}/alchemy-state/lease\";\n/** The server names the current holder in its 409 message; pass it through verbatim, hint appended. */\nconst serverErrorText = (error) => error.error.hint === void 0 ? error.error.message : `${error.error.message} ${error.error.hint}`;\nconst transportError = (cause) => new PrismaApiError({\n\tstatus: 0,\n\tmessage: String(cause)\n});\n/** Best-effort `user@host`, echoed in the contention error a blocked deploy sees. */\nconst holderDescription = () => {\n\ttry {\n\t\treturn `${os.userInfo().username}@${os.hostname()}`;\n\t} catch {\n\t\treturn \"unknown\";\n\t}\n};\n/**\n* Acquires the (stack, stage) deploy lease. Contention (409) fails fast with\n* the server's message naming the current holder — no queueing, no retry.\n* The server's default TTL (60s) applies; no `ttlSeconds` is sent.\n*/\nconst acquireDeployLease = (client, scope) => Effect.tryPromise({\n\ttry: () => client.POST(LEASE_PATH, {\n\t\tparams: { path: {\n\t\t\tprojectId: scope.projectId,\n\t\t\tbranchId: scope.branchId\n\t\t} },\n\t\tbody: {\n\t\t\tstack: scope.stack,\n\t\t\tstage: scope.stage,\n\t\t\tholderDescription: holderDescription()\n\t\t}\n\t}),\n\tcatch: transportError\n}).pipe(Effect.flatMap((r) => {\n\tconst status = r.response.status;\n\tif (r.error !== void 0) return Effect.fail(new PrismaApiError({\n\t\tstatus,\n\t\tmessage: serverErrorText(r.error)\n\t}));\n\tif (r.data !== void 0) return Effect.succeed({\n\t\tleaseId: Redacted.make(r.data.data.leaseId),\n\t\texpiresAt: r.data.data.expiresAt\n\t});\n\treturn Effect.fail(new PrismaApiError({\n\t\tstatus,\n\t\tmessage: `lease acquisition returned HTTP ${String(status)} with no error body`\n\t}));\n}));\n/**\n* Extends the lease on a fixed cadence (TTL/3) until interrupted. A 404 means\n* the lease was lost — log one loud warning and stop; enforcement is\n* server-side, so the run's next state operation fails with 409. Any other\n* heartbeat failure is ignored and the next tick retries; the heartbeat never\n* fails the run.\n*/\nconst heartbeatDeployLease = (client, scope, lease, every = \"20 seconds\") => Effect.gen(function* () {\n\twhile (true) {\n\t\tyield* Effect.sleep(every);\n\t\tif ((yield* Effect.tryPromise(() => client.PATCH(LEASE_PATH, { params: {\n\t\t\tpath: {\n\t\t\t\tprojectId: scope.projectId,\n\t\t\t\tbranchId: scope.branchId\n\t\t\t},\n\t\t\theader: { \"alchemy-state-lease-id\": Redacted.value(lease.leaseId) }\n\t\t} })).pipe(Effect.map((r) => r.response.status), Effect.catch(() => Effect.succeed(0)))) === 404) {\n\t\t\tyield* Effect.logWarning(`the deploy lease for stage \"${scope.stage}\" was lost (heartbeat returned 404) — another deploy may have taken over; the next state operation of this run will fail.`);\n\t\t\treturn;\n\t\t}\n\t}\n});\n/**\n* Releases the lease on clean exit. Never fails: a 404 (lease already\n* expired or replaced) or any other failure is logged, not thrown — the run\n* already completed.\n*/\nconst releaseDeployLease = (client, scope, lease) => Effect.tryPromise(() => client.DELETE(LEASE_PATH, { params: {\n\tpath: {\n\t\tprojectId: scope.projectId,\n\t\tbranchId: scope.branchId\n\t},\n\theader: { \"alchemy-state-lease-id\": Redacted.value(lease.leaseId) }\n} })).pipe(Effect.flatMap((r) => {\n\tconst status = r.response.status;\n\tif (status === 404) return Effect.logWarning(`releasing the deploy lease for stage \"${scope.stage}\" returned 404 — it had already expired or been replaced.`);\n\tif (status >= 200 && status < 300) return Effect.void;\n\treturn Effect.logWarning(`releasing the deploy lease for stage \"${scope.stage}\" returned HTTP ${String(status)} — the lease stays live until its TTL expires.`);\n}), Effect.catch((cause) => Effect.logWarning(`releasing the deploy lease for stage \"${scope.stage}\" failed: ${String(cause)}`)));\n//#endregion\n//#region src/state/legacy-resources.ts\n/**\n* One-time, on-read rewrite of legacy Composer state rows into the shapes\n* upstream alchemy's `Prisma.*` providers expect, so their `read`/`diff`\n* adopts the deployed resources instead of planning a create. Old rows carry\n* hand-rolled attributes (`{id, name}`, `{id, connectionString}`, …); upstream\n* expects `{projectId, …}` / `{databaseId, …}` / etc. Fields old rows never\n* carried are left absent — upstream recomputes them from observed API state.\n* Legacy `DATABASE_URL` claim rows are retired ({@link retireDatabaseUrlClaimRow}).\n*\n* Operator-visible one-time effects of the first migrated deploy (branch-stage\n* database rename + default-connection rotation, one fresh deployment per\n* service) are documented in docs/guides/deploying.md. Hosted state only:\n* local dev state is cleared with `prisma-composer dev --fresh` instead.\n*/\nconst isRecord = (value) => typeof value === \"object\" && value !== null;\nconst EPOCH = \"1970-01-01T00:00:00.000Z\";\n/** Where a legacy row recorded no region: the only region Composer's descriptors ever defaulted to. */\nconst DEFAULT_REGION = \"us-east-1\";\n/**\n* The reserved keys older Composer versions claimed through tracked\n* EnvironmentVariable resources. Today the claim is a create-only API call\n* outside deploy state (database-url-claim.ts, whose key set this is), so the\n* tracked rows those versions left behind are disposed of here.\n*/\nconst CLAIMED_DATABASE_URL_KEYS = new Set(RESERVED_DATABASE_URL_KEYS);\nconst FAMILY_BY_LEGACY_TYPE = {\n\t\"Prisma.Project\": \"Project\",\n\t\"Prisma.Database\": \"Database\",\n\t\"Prisma.Connection\": \"Connection\",\n\t\"Prisma.ComputeService\": \"App\",\n\t\"Prisma.Deployment\": \"Deployment\",\n\t\"Prisma.EnvironmentVariable\": \"EnvironmentVariable\",\n\t\"Prisma.Bucket\": \"Bucket\",\n\t\"Prisma.BucketKey\": \"BucketAccessKey\",\n\t\"PrismaComposer.Project\": \"Project\",\n\t\"PrismaComposer.Database\": \"Database\",\n\t\"PrismaComposer.Connection\": \"Connection\",\n\t\"PrismaComposer.ComputeService\": \"App\",\n\t\"PrismaComposer.Deployment\": \"Deployment\",\n\t\"PrismaComposer.EnvironmentVariable\": \"EnvironmentVariable\",\n\t\"PrismaComposer.Bucket\": \"Bucket\",\n\t\"PrismaComposer.BucketKey\": \"BucketAccessKey\"\n};\n/** The type-id upstream registers each family under. */\nconst UPSTREAM_TYPE = {\n\tProject: \"Prisma.Project\",\n\tDatabase: \"Prisma.Database\",\n\tConnection: \"Prisma.Connection\",\n\tApp: \"Prisma.App\",\n\tDeployment: \"Prisma.Deployment\",\n\tEnvironmentVariable: \"Prisma.EnvironmentVariable\",\n\tBucket: \"Prisma.Bucket\",\n\tBucketAccessKey: \"Prisma.BucketAccessKey\"\n};\n/**\n* Four of the six families keep the type-id they always had, so the type-id\n* alone cannot say whether a row is legacy or already upstream's. Each shape\n* is told apart by a props field only the legacy one has, which is also what\n* makes the whole rewrite idempotent.\n*/\nconst isLegacyProps = (family, props) => {\n\tswitch (family) {\n\t\tcase \"Project\": return \"workspaceId\" in props;\n\t\tcase \"Database\": return \"projectId\" in props && !(\"project\" in props);\n\t\tcase \"Connection\": return \"databaseId\" in props && !(\"database\" in props);\n\t\tcase \"App\": return \"projectId\" in props && !(\"project\" in props);\n\t\tcase \"Deployment\": return \"computeServiceId\" in props;\n\t\tcase \"EnvironmentVariable\": return \"projectId\" in props && !(\"project\" in props);\n\t\tcase \"Bucket\": return \"projectId\" in props && !(\"project\" in props);\n\t\tcase \"BucketAccessKey\": return \"bucketId\" in props && !(\"bucket\" in props);\n\t}\n};\nconst migrateProps = (family, props) => {\n\tif (!isRecord(props) || !isLegacyProps(family, props)) return props;\n\tswitch (family) {\n\t\tcase \"Project\": return { name: props[\"name\"] };\n\t\tcase \"Database\": return {\n\t\t\tproject: props[\"projectId\"],\n\t\t\tname: props[\"name\"],\n\t\t\tregion: props[\"region\"],\n\t\t\t...props[\"branchId\"] !== void 0 ? { branchId: props[\"branchId\"] } : {}\n\t\t};\n\t\tcase \"Connection\": return {\n\t\t\tdatabase: props[\"databaseId\"],\n\t\t\tname: props[\"name\"]\n\t\t};\n\t\tcase \"App\": return {\n\t\t\tproject: props[\"projectId\"],\n\t\t\tdisplayName: props[\"name\"],\n\t\t\tregionId: props[\"region\"] ?? DEFAULT_REGION,\n\t\t\t...props[\"branchId\"] !== void 0 ? { branchId: props[\"branchId\"] } : {}\n\t\t};\n\t\tcase \"Deployment\": return {\n\t\t\tapp: props[\"computeServiceId\"],\n\t\t\tartifactPath: props[\"artifactPath\"],\n\t\t\tartifactContentType: ARTIFACT_CONTENT_TYPE,\n\t\t\t...props[\"port\"] !== void 0 ? { portMapping: { http: props[\"port\"] } } : {},\n\t\t\tstart: true,\n\t\t\tpromote: true\n\t\t};\n\t\tcase \"EnvironmentVariable\": {\n\t\t\tconst value = props[\"value\"];\n\t\t\treturn {\n\t\t\t\tproject: props[\"projectId\"],\n\t\t\t\tkey: props[\"key\"],\n\t\t\t\tclass: props[\"class\"] ?? \"production\",\n\t\t\t\tvalue: Redacted.isRedacted(value) ? value : Redacted.make(String(value ?? \"\")),\n\t\t\t\t...props[\"branchId\"] !== void 0 ? { branchId: props[\"branchId\"] } : {}\n\t\t\t};\n\t\t}\n\t\tcase \"Bucket\": return {\n\t\t\tproject: props[\"projectId\"],\n\t\t\tname: props[\"name\"],\n\t\t\t...props[\"branchId\"] !== void 0 ? { branchId: props[\"branchId\"] } : {}\n\t\t};\n\t\tcase \"BucketAccessKey\": return {\n\t\t\tbucket: props[\"bucketId\"],\n\t\t\tname: props[\"name\"],\n\t\t\trole: props[\"role\"]\n\t\t};\n\t}\n};\n/**\n* A legacy claim row (an EnvironmentVariable resource an older Composer\n* persisted for a reserved DATABASE_URL key) names a variable Composer must\n* stop managing. Deleting one\n* for real is not safe: the legacy adoption matched on `{projectId, class,\n* key}` with no branch id, so the recorded scope may not equal the live\n* variable's, and upstream's delete refuses — loudly, mid-deploy — on a scope\n* mismatch. Whether the live variable is the platform's own system-managed\n* template or the `\"-\"` placeholder Composer wrote over it depends on the\n* stage, and neither is Composer's to remove.\n*\n* Two halves, doing different jobs:\n*\n* · `removalPolicy: \"retain\"` on the ROW. Alchemy's engine honors it before\n* the provider is ever consulted: it drops the state row, makes no API\n* call, and reports the resource as `retained` rather than `deleted` —\n* which is the truthful verb, and the one an operator reading the deploy\n* log needs to see.\n* · An `environmentVariableId` the engine reads as \"not a cloud resource\"\n* (`isPrismaDevId`). This governs what the PROVIDER would do if it were\n* ever handed these attributes on some other path: nothing.\n*/\nconst retireDatabaseUrlClaimRow = (row, key) => ({\n\t...row,\n\tremovalPolicy: \"retain\",\n\tattr: {\n\t\tenvironmentVariableId: `dev:legacy-claim-${key}`,\n\t\tkey\n\t}\n});\n/**\n* The reserved key a legacy claim row named, from whichever half of the row still carries it\n* — for LEGACY rows only. Upstream's own `EnvironmentVariable` rows share this\n* type-id, so without the props-shape check a live, upstream-managed\n* `DATABASE_URL` variable would be retired from state on every read.\n*/\nconst claimedKeyOf = (family, props, attr) => {\n\tif (family !== \"EnvironmentVariable\") return void 0;\n\tif (!isRecord(props) || !isLegacyProps(family, props)) return void 0;\n\tconst fromAttr = isRecord(attr) ? attr[\"key\"] : void 0;\n\tconst fromProps = isRecord(props) ? props[\"key\"] : void 0;\n\tconst key = typeof fromAttr === \"string\" ? fromAttr : fromProps;\n\treturn typeof key === \"string\" && CLAIMED_DATABASE_URL_KEYS.has(key) ? key : void 0;\n};\nconst migrateAttr = (family, attr, props) => {\n\tif (!isRecord(attr)) return attr;\n\tconst oldProps = isRecord(props) ? props : {};\n\tswitch (family) {\n\t\tcase \"Project\":\n\t\t\tif (typeof attr[\"id\"] !== \"string\" || \"projectId\" in attr) return attr;\n\t\t\treturn {\n\t\t\t\tprojectId: attr[\"id\"],\n\t\t\t\tprojectName: attr[\"name\"],\n\t\t\t\tworkspaceId: oldProps[\"workspaceId\"] ?? \"\",\n\t\t\t\tcreatedAt: EPOCH,\n\t\t\t\tdefaultRegion: null\n\t\t\t};\n\t\tcase \"Database\":\n\t\t\tif (typeof attr[\"id\"] !== \"string\" || \"databaseId\" in attr) return attr;\n\t\t\treturn {\n\t\t\t\tdatabaseId: attr[\"id\"],\n\t\t\t\tdatabaseName: attr[\"name\"] ?? oldProps[\"name\"],\n\t\t\t\tprojectId: oldProps[\"projectId\"],\n\t\t\t\tstatus: \"ready\",\n\t\t\t\tregion: oldProps[\"region\"] ?? null,\n\t\t\t\tisDefault: oldProps[\"isDefault\"] ?? false,\n\t\t\t\tbranchId: oldProps[\"branchId\"] ?? null,\n\t\t\t\tdefaultConnectionId: null,\n\t\t\t\tcreatedAt: EPOCH\n\t\t\t};\n\t\tcase \"Connection\":\n\t\t\tif (typeof attr[\"id\"] !== \"string\" || \"connectionId\" in attr) return attr;\n\t\t\treturn {\n\t\t\t\tconnectionId: attr[\"id\"],\n\t\t\t\tconnectionName: oldProps[\"name\"],\n\t\t\t\tdatabaseId: oldProps[\"databaseId\"],\n\t\t\t\tkind: \"postgres\",\n\t\t\t\tcreatedAt: EPOCH,\n\t\t\t\tdirectConnectionString: attr[\"connectionString\"],\n\t\t\t\tdatabaseUrl: attr[\"connectionString\"]\n\t\t\t};\n\t\tcase \"App\":\n\t\t\tif (typeof attr[\"id\"] !== \"string\" || \"appId\" in attr) return attr;\n\t\t\treturn {\n\t\t\t\tappId: attr[\"id\"],\n\t\t\t\tname: attr[\"name\"] ?? oldProps[\"name\"],\n\t\t\t\tprojectId: oldProps[\"projectId\"],\n\t\t\t\tregionId: oldProps[\"region\"] ?? DEFAULT_REGION,\n\t\t\t\tbranchId: oldProps[\"branchId\"] ?? null,\n\t\t\t\tlatestDeploymentId: null,\n\t\t\t\t...attr[\"endpointDomain\"] !== void 0 ? { appEndpointDomain: attr[\"endpointDomain\"] } : {},\n\t\t\t\tcreatedAt: EPOCH\n\t\t\t};\n\t\tcase \"Deployment\":\n\t\t\tif (typeof attr[\"deploymentId\"] !== \"string\" || \"appId\" in attr) return attr;\n\t\t\treturn {\n\t\t\t\tdeploymentId: attr[\"deploymentId\"],\n\t\t\t\tappId: oldProps[\"computeServiceId\"],\n\t\t\t\tstatus: void 0,\n\t\t\t\tpreviewDomain: void 0,\n\t\t\t\tappEndpointDomain: attr[\"deployedUrl\"],\n\t\t\t\tcreatedAt: void 0\n\t\t\t};\n\t\tcase \"EnvironmentVariable\":\n\t\t\tif (typeof attr[\"id\"] !== \"string\" || \"environmentVariableId\" in attr) return attr;\n\t\t\treturn {\n\t\t\t\tenvironmentVariableId: attr[\"id\"],\n\t\t\t\tprojectId: oldProps[\"projectId\"],\n\t\t\t\tbranchId: oldProps[\"branchId\"] ?? null,\n\t\t\t\tclass: oldProps[\"class\"] ?? \"production\",\n\t\t\t\tkey: attr[\"key\"] ?? oldProps[\"key\"],\n\t\t\t\tvalue: Redacted.make(\"\"),\n\t\t\t\tvalueKid: \"\",\n\t\t\t\tisManagedBySystem: false,\n\t\t\t\tcreatedAt: EPOCH,\n\t\t\t\tupdatedAt: EPOCH\n\t\t\t};\n\t\tcase \"Bucket\":\n\t\t\tif (typeof attr[\"id\"] !== \"string\" || \"bucketId\" in attr) return attr;\n\t\t\treturn {\n\t\t\t\tbucketId: attr[\"id\"],\n\t\t\t\tname: attr[\"name\"],\n\t\t\t\tprojectId: oldProps[\"projectId\"],\n\t\t\t\tcreatedAt: EPOCH\n\t\t\t};\n\t\tcase \"BucketAccessKey\": {\n\t\t\tif (typeof attr[\"id\"] !== \"string\" || \"bucketAccessKeyId\" in attr) return attr;\n\t\t\tconst secret = attr[\"secretAccessKey\"];\n\t\t\treturn {\n\t\t\t\tbucketAccessKeyId: attr[\"id\"],\n\t\t\t\tbucketId: attr[\"bucketId\"],\n\t\t\t\taccessKeyId: attr[\"accessKeyId\"],\n\t\t\t\tsecretAccessKey: Redacted.isRedacted(secret) ? secret : Redacted.make(String(secret ?? \"\")),\n\t\t\t\tendpoint: attr[\"endpoint\"],\n\t\t\t\tbucketName: attr[\"bucketName\"]\n\t\t\t};\n\t\t}\n\t}\n};\n/**\n* Type-id renames where the props/attr shapes are unchanged: rewriting the\n* `resourceType` (here and on any nested `old` row) is the whole migration.\n*/\nconst RENAMED_TYPES = { \"PrismaNext.Migration\": \"PrismaOrm.Migration\" };\nconst renameResourceType = (row, renamed) => {\n\tconst migrated = {\n\t\t...row,\n\t\tresourceType: renamed\n\t};\n\tconst old = row[\"old\"];\n\tif (isRecord(old) && typeof old[\"resourceType\"] === \"string\") migrated[\"old\"] = migrateResourceRow(old);\n\treturn migrated;\n};\nconst migrateResourceRow = (row) => {\n\tconst resourceType = row[\"resourceType\"];\n\tif (typeof resourceType !== \"string\") return row;\n\tconst renamed = RENAMED_TYPES[resourceType];\n\tif (renamed !== void 0) return renameResourceType(row, renamed);\n\tconst family = FAMILY_BY_LEGACY_TYPE[resourceType];\n\tif (family === void 0) return row;\n\tconst migrated = {\n\t\t...row,\n\t\tresourceType: UPSTREAM_TYPE[family],\n\t\t...\"props\" in row ? { props: migrateProps(family, row[\"props\"]) } : {},\n\t\t...\"attr\" in row ? { attr: migrateAttr(family, row[\"attr\"], row[\"props\"]) } : {}\n\t};\n\tconst old = row[\"old\"];\n\tif (isRecord(old)) migrated[\"old\"] = typeof old[\"resourceType\"] === \"string\" ? migrateResourceRow(old) : {\n\t\t...old,\n\t\t...\"props\" in old ? { props: migrateProps(family, old[\"props\"]) } : {},\n\t\t...\"attr\" in old ? { attr: migrateAttr(family, old[\"attr\"], old[\"props\"]) } : {}\n\t};\n\tconst claimedKey = claimedKeyOf(family, row[\"props\"], row[\"attr\"]);\n\tif (claimedKey !== void 0) return retireDatabaseUrlClaimRow(migrated, claimedKey);\n\treturn migrated;\n};\n/**\n* Maps a revived state value from a legacy Composer resource shape to the\n* upstream shape. Rows of other resource types (and action rows) pass through\n* untouched; the function is idempotent, so already-migrated rows pass\n* through too.\n*/\nconst migrateLegacyResourceState = (value) => {\n\tif (!isRecord(value) || value[\"kind\"] === \"action\") return value;\n\treturn migrateResourceRow(value);\n};\n//#endregion\n//#region src/state/layer.ts\n/**\n* The hosted Alchemy state store: alchemy's stock HTTP state client pointed\n* at the platform state API\n* (`/v1/projects/{projectId}/branches/{branchId}/alchemy-state`). On layer\n* init (scoped, once per stack run): resolve the stage's Branch, acquire the\n* (stack, stage) deploy lease, fork its heartbeat, run the migration guard,\n* and build the stock store. Finalizers (reverse order): interrupt the\n* heartbeat, release the lease. The Management API plumbing\n* (`ManagementClient`, `PrismaCredentials`) and the store's `HttpClient` are\n* provided internally, so the returned layer's only requirements are the\n* ones alchemy itself already provides to every state store\n* (`StackServices`).\n*\n* Any bootstrap failure is wrapped into an operator-facing\n* `HostedStateBootstrapError` (naming the Project/Branch and the step that\n* failed — see `errors.ts`) before dying the layer (loud, immediate,\n* unrecoverable) rather than surfacing as a typed error — matching core's\n* `LowerOptions.state: Layer.Layer<State, never, StackServices>` contract\n* and alchemy's own convention (e.g. a missing state store is `Effect.die`\n* in `Stack.make`).\n*/\nconst prismaStateLayer = (ids) => Layer.unwrap(managementApiBaseUrl().pipe(Effect.map((origin) => stateLayerAgainst(origin, ids)))).pipe(Layer.orDie);\n/**\n* The stock service with legacy Composer resource rows rewritten to the\n* upstream providers' shapes as they are read (see legacy-resources.ts) —\n* reads only; rows written by this version are already upstream-shaped.\n*/\nconst migrateRowsOnRead = (service) => ({\n\t...service,\n\tget: (request) => Effect.map(service.get(request), (value) => value === void 0 ? void 0 : blindCast(migrateLegacyResourceState(value))),\n\tgetReplacedResources: (request) => Effect.map(service.getReplacedResources(request), (rows) => rows.map((row) => blindCast(migrateLegacyResourceState(row))))\n});\n/** `prismaStateLayer` with the API origin injectable — split out so tests can point it at a fake state API. */\nconst stateLayerAgainst = (apiOrigin, ids) => {\n\tconst { projectId, branchId, defaultBranchId } = ids;\n\tconst dependencies = layer({ apiOrigin }).pipe(Layer.provideMerge(fromEnv()));\n\treturn Layer.effect(State, Effect.gen(function* () {\n\t\tconst stack = yield* Stack;\n\t\tconst container = branchId === void 0 ? projectId : `${projectId}/${branchId}`;\n\t\tconst bootstrapError = (step) => (cause) => hostedStateBootstrapError(container, step, cause);\n\t\tconst mgmt = yield* ManagementClient;\n\t\tconst { token } = yield* PrismaCredentials;\n\t\tconst stateBranchId = branchId ?? defaultBranchId ?? (yield* resolveDefaultBranchId(mgmt, projectId).pipe(Effect.mapError(bootstrapError(\"resolving the stage branch\"))));\n\t\tconst scope = {\n\t\t\tprojectId,\n\t\t\tbranchId: stateBranchId,\n\t\t\tstack: stack.name,\n\t\t\tstage: stack.stage\n\t\t};\n\t\tconst lease = yield* acquireDeployLease(mgmt, scope).pipe(Effect.mapError(bootstrapError(\"acquiring the deploy lease\")));\n\t\tyield* Effect.addFinalizer(() => releaseDeployLease(mgmt, scope, lease));\n\t\tyield* Effect.forkScoped(heartbeatDeployLease(mgmt, scope, lease));\n\t\tif (!(yield* scopeOccupied(mgmt, scope, lease).pipe(Effect.mapError(bootstrapError(\"probing the deploy state scope\"))))) yield* failOnEmptyScopeWithLiveResources(projectId, stateBranchId, stack.name, stack.stage).pipe(Effect.provideService(ManagementClient, mgmt), Effect.mapError(bootstrapError(\"checking the empty deploy state scope\")));\n\t\tconst service = yield* makeHttpStateStore({\n\t\t\turl: `${apiOrigin}/v1/projects/${projectId}/branches/${stateBranchId}/alchemy-state`,\n\t\t\tauthToken: Redacted.value(token),\n\t\t\ttransformClient: (req) => HttpClientRequest.setHeader(req, LEASE_HEADER, Redacted.value(lease.leaseId)),\n\t\t\tid: \"prisma-postgres\"\n\t\t}).pipe(Effect.provide(FetchHttpClient.layer));\n\t\tconst migrated = migrateRowsOnRead(service);\n\t\tconst buildId = process.env[BUILD_ID_ENV];\n\t\tif (buildId === void 0 || buildId.length === 0) return Effect.succeed(migrated);\n\t\tconst { store, reporter } = withResourceReporting(migrated, buildsApi({\n\t\t\tclient: mgmt,\n\t\t\twarn: (message) => {\n\t\t\t\tconsole.warn(message);\n\t\t\t}\n\t\t}), buildId);\n\t\tyield* Effect.addFinalizer(() => Effect.promise(() => reporter.drain()));\n\t\treturn Effect.succeed(store);\n\t}).pipe(Effect.provide(dependencies))).pipe(Layer.orDie, Layer.merge(redactLeaseHeader));\n};\n//#endregion\nexport { prismaStateLayer };\n\n//# sourceMappingURL=state.mjs.map","import { r as managementApiBaseUrl } from \"./credentials-DhT4a38W.mjs\";\nimport { i as buildsApi, n as reportableResource, r as resourceReporter, t as BUILD_ID_ENV } from \"./resources-CXUKkcyA.mjs\";\nimport { createManagementApiClient } from \"@prisma/management-api-sdk\";\nimport * as Effect from \"effect/Effect\";\nimport { createHash } from \"node:crypto\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport { execFileSync } from \"node:child_process\";\n//#region src/builds/application-topology.ts\n/**\n* The application-topology submission (pdp-control-plane\n* `projects/branch-topology/spec.md`): composes the wire body from the\n* authored view Load keeps on the Graph, hashes it, and PUTs it to the\n* Branch. Best-effort like every report in this package — a refused or\n* unreachable platform costs a warning, never the deploy, and the platform\n* keeps the Branch's previous topology.\n*\n* Everything on the wire is identified by LOGICAL id — the node's address in\n* the declaration. Row ids are recreated on every deploy and never appear.\n* `kind` is the platform's structural enum; `type`, `contractKind`, `style`,\n* and `family` values are this tool's vocabulary, stored uninterpreted.\n*/\n/** The producer out-ports whose edges are request/response communication (@prisma/composer/service-rpc's contract kind). */\nconst REQUEST_RESPONSE_CONTRACT_KINDS = /* @__PURE__ */ new Set([\"rpc\"]);\nconst endpointKey = (endpoint) => `${endpoint.node}\u0000${endpoint.direction}\u0000${endpoint.name}`;\nconst endpointBody = (endpoint) => ({\n\tlogicalId: endpoint.node,\n\tdirection: endpoint.direction,\n\tname: endpoint.name\n});\n/**\n* Composes the wire body from the Graph's authored view. Flat-view\n* dependency-slot nodes are the ports' flat representation and stay off the\n* wire; every module/service/resource node goes on it, with its stated\n* parent. An edge's `family` comes from the spec's resolution walk done\n* client-side: follow the source endpoint through module boundaries (a\n* module port's own one incoming edge) until a service or resource —\n* `data` when the producer is a resource, `communication` otherwise, styled\n* `request-response` when the producing port carries the rpc contract kind.\n*/\nfunction composeApplicationTopology(graph) {\n\tconst kinds = /* @__PURE__ */ new Map();\n\tconst nodes = [];\n\tfor (const entry of graph.nodes) {\n\t\tconst node = entry.node;\n\t\tif (node.kind !== \"module\" && node.kind !== \"service\" && node.kind !== \"resource\") continue;\n\t\tkinds.set(entry.id, node.kind);\n\t\tnodes.push({\n\t\t\tlogicalId: entry.id,\n\t\t\tparentLogicalId: entry.parent ?? null,\n\t\t\tkind: node.kind,\n\t\t\t...node.kind === \"module\" ? {} : { type: node.type }\n\t\t});\n\t}\n\tconst ports = graph.ports.map((port) => ({\n\t\tlogicalId: port.node,\n\t\tdirection: port.direction,\n\t\tname: port.name,\n\t\t...port.contractKind !== void 0 ? { contractKind: port.contractKind } : {}\n\t}));\n\tconst incoming = /* @__PURE__ */ new Map();\n\tfor (const edge of graph.authoredEdges) incoming.set(endpointKey(edge.to), edge);\n\tconst contractKindByPort = /* @__PURE__ */ new Map();\n\tfor (const port of graph.ports) contractKindByPort.set(endpointKey(port), port.contractKind);\n\tconst resolveProducer = (from) => {\n\t\tlet current = from;\n\t\tconst seen = /* @__PURE__ */ new Set();\n\t\twhile (kinds.get(current.node) === \"module\") {\n\t\t\tconst key = endpointKey(current);\n\t\t\tif (seen.has(key)) return void 0;\n\t\t\tseen.add(key);\n\t\t\tconst feeding = incoming.get(key);\n\t\t\tif (feeding === void 0) return void 0;\n\t\t\tcurrent = feeding.from;\n\t\t}\n\t\treturn current;\n\t};\n\treturn {\n\t\tnodes,\n\t\tports,\n\t\tedges: graph.authoredEdges.map((edge) => {\n\t\t\tconst producer = resolveProducer(edge.from);\n\t\t\tconst producerContractKind = producer === void 0 ? void 0 : contractKindByPort.get(endpointKey(producer));\n\t\t\tconst style = producerContractKind !== void 0 && REQUEST_RESPONSE_CONTRACT_KINDS.has(producerContractKind) ? \"request-response\" : void 0;\n\t\t\treturn {\n\t\t\t\tfrom: endpointBody(edge.from),\n\t\t\t\tto: endpointBody(edge.to),\n\t\t\t\tfamily: producer !== void 0 && kinds.get(producer.node) === \"resource\" ? \"data\" : \"communication\",\n\t\t\t\t...style !== void 0 ? { style } : {}\n\t\t\t};\n\t\t})\n\t};\n}\nconst compareStrings = (a, b) => a < b ? -1 : a > b ? 1 : 0;\n/**\n* The content hash the platform stores opaquely: sha256 over a canonical\n* JSON form — entries sorted, keys in a fixed order, absent optionals\n* omitted — so the same declared graph always hashes the same whatever\n* order Load emitted it in. The Build Run records the same value\n* (`applicationTopologyContentHash`), and equal hashes are how the platform\n* links a run to the graph it deployed — a value match, never a row\n* reference.\n*/\nfunction applicationTopologyContentHash(topology) {\n\tconst canonical = {\n\t\tnodes: topology.nodes.map((node) => ({\n\t\t\tlogicalId: node.logicalId,\n\t\t\tparentLogicalId: node.parentLogicalId,\n\t\t\tkind: node.kind,\n\t\t\t...node.type !== void 0 ? { type: node.type } : {}\n\t\t})).sort((a, b) => compareStrings(a.logicalId, b.logicalId)),\n\t\tports: topology.ports.map((port) => ({\n\t\t\tlogicalId: port.logicalId,\n\t\t\tdirection: port.direction,\n\t\t\tname: port.name,\n\t\t\t...port.contractKind !== void 0 ? { contractKind: port.contractKind } : {}\n\t\t})).sort((a, b) => compareStrings(a.logicalId, b.logicalId) || compareStrings(a.direction, b.direction) || compareStrings(a.name, b.name)),\n\t\tedges: topology.edges.map((edge) => ({\n\t\t\tfrom: {\n\t\t\t\tlogicalId: edge.from.logicalId,\n\t\t\t\tdirection: edge.from.direction,\n\t\t\t\tname: edge.from.name\n\t\t\t},\n\t\t\tto: {\n\t\t\t\tlogicalId: edge.to.logicalId,\n\t\t\t\tdirection: edge.to.direction,\n\t\t\t\tname: edge.to.name\n\t\t\t},\n\t\t\tfamily: edge.family,\n\t\t\t...edge.style !== void 0 ? { style: edge.style } : {}\n\t\t})).sort((a, b) => compareStrings(a.to.logicalId, b.to.logicalId) || compareStrings(a.to.direction, b.to.direction) || compareStrings(a.to.name, b.to.name))\n\t};\n\treturn `sha256:${createHash(\"sha256\").update(JSON.stringify(canonical)).digest(\"hex\")}`;\n}\n/** Same deadline as the build reports (api.ts): reporting is observability, so no call may stall the deploy. */\nconst REPORT_DEADLINE_MS = 1e4;\nfunction applicationTopologyApi(options) {\n\tconst { client, warn } = options;\n\treturn { async replace(projectId, branchId, submission) {\n\t\tconst describe = \"record this deploy's application topology\";\n\t\tlet result;\n\t\ttry {\n\t\t\tresult = await blindCast(client.PUT)(\"/v1/projects/{projectId}/branches/{branchId}/application-topology\", {\n\t\t\t\tparams: { path: {\n\t\t\t\t\tprojectId,\n\t\t\t\t\tbranchId\n\t\t\t\t} },\n\t\t\t\tbody: submission,\n\t\t\t\tsignal: AbortSignal.timeout(REPORT_DEADLINE_MS)\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\twarn(`Could not reach Prisma Cloud to ${describe}: ${detail}`);\n\t\t\treturn false;\n\t\t}\n\t\tif (!result.response.ok) {\n\t\t\tconst detail = result.error === void 0 ? \"\" : `: ${JSON.stringify(result.error)}`;\n\t\t\twarn(`Prisma Cloud refused to ${describe} (HTTP ${String(result.response.status)})${detail}`);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t} };\n}\n//#endregion\n//#region src/builds/run-identity.ts\n/**\n* Who is deploying, and from what commit — the identity a build is reported\n* under.\n*\n* `commitSha` and `branchName` are required by the platform, and Composer has\n* no other reason to read git, so this is the only place it does. A deploy\n* from a directory that is not a git checkout has neither, and is reported\n* not at all rather than reported with placeholder values: the Console keeps\n* whatever it is told, and \"unknown\" would sit in a workspace's deploy\n* history permanently.\n*/\nconst DIGITS = /^[0-9]+$/;\nconst nonEmpty$1 = (value) => value !== void 0 && value.length > 0 ? value : void 0;\nfunction git(args, cwd) {\n\ttry {\n\t\tconst out = execFileSync(\"git\", [...args], {\n\t\t\tcwd,\n\t\t\tencoding: \"utf8\",\n\t\t\tstdio: [\n\t\t\t\t\"ignore\",\n\t\t\t\t\"pipe\",\n\t\t\t\t\"ignore\"\n\t\t\t],\n\t\t\ttimeout: 5e3\n\t\t});\n\t\treturn nonEmpty$1(out.trim());\n\t} catch {\n\t\treturn;\n\t}\n}\n/**\n* The GitHub Actions run this is executing inside, when all three parts are\n* present and are the digits the platform's dedup key requires. Partial or\n* malformed input yields nothing rather than half an identity: the key joins\n* its parts with `:`, so a part that is not digits could let two different\n* runs spell the same key.\n*/\nfunction githubRunIdentity(env) {\n\tif (env[\"GITHUB_ACTIONS\"] !== \"true\") return void 0;\n\tconst repositoryId = nonEmpty$1(env[\"GITHUB_REPOSITORY_ID\"]);\n\tconst runId = nonEmpty$1(env[\"GITHUB_RUN_ID\"]);\n\tconst attempt = nonEmpty$1(env[\"GITHUB_RUN_ATTEMPT\"]) ?? \"1\";\n\tif (repositoryId === void 0 || !DIGITS.test(repositoryId)) return void 0;\n\tif (runId === void 0 || !DIGITS.test(runId)) return void 0;\n\tif (!DIGITS.test(attempt)) return void 0;\n\tconst runAttempt = Number.parseInt(attempt, 10);\n\tif (!Number.isInteger(runAttempt) || runAttempt < 1) return void 0;\n\treturn {\n\t\tprovider: \"github\",\n\t\trepositoryId,\n\t\trunId,\n\t\trunAttempt\n\t};\n}\nfunction githubRunUrl(env) {\n\tconst server = nonEmpty$1(env[\"GITHUB_SERVER_URL\"]) ?? \"https://github.com\";\n\tconst repository = nonEmpty$1(env[\"GITHUB_REPOSITORY\"]);\n\tconst runId = nonEmpty$1(env[\"GITHUB_RUN_ID\"]);\n\tif (repository === void 0 || runId === void 0) return void 0;\n\treturn `${server}/${repository}/actions/runs/${runId}/attempts/${nonEmpty$1(env[\"GITHUB_RUN_ATTEMPT\"]) ?? \"1\"}`;\n}\n/**\n* The branch this ran on. Inside a pull-request workflow `GITHUB_REF_NAME` is\n* the synthetic merge ref (`123/merge`), so the head branch is preferred —\n* it is the name a person would recognise in the Console.\n*/\nfunction branchName(env, cwd) {\n\tconst fromEnv = nonEmpty$1(env[\"GITHUB_HEAD_REF\"]) ?? nonEmpty$1(env[\"GITHUB_REF_NAME\"]);\n\tif (fromEnv !== void 0) return fromEnv;\n\tconst head = git([\n\t\t\"rev-parse\",\n\t\t\"--abbrev-ref\",\n\t\t\"HEAD\"\n\t], cwd);\n\treturn head === \"HEAD\" ? void 0 : head;\n}\n/**\n* The identity to report this run under, or `undefined` when there is not\n* enough to report one honestly.\n*/\nfunction resolveRunIdentity(cwd, env) {\n\tconst commitSha = nonEmpty$1(env[\"GITHUB_SHA\"]) ?? git([\"rev-parse\", \"HEAD\"], cwd);\n\tconst branch = branchName(env, cwd);\n\tif (commitSha === void 0 || branch === void 0) return void 0;\n\tconst runIdentity = githubRunIdentity(env);\n\treturn {\n\t\tsource: runIdentity === void 0 ? \"cli\" : \"ci\",\n\t\tcommitSha,\n\t\tbranchName: branch,\n\t\trunIdentity,\n\t\texternalLogUrl: runIdentity === void 0 ? void 0 : githubRunUrl(env)\n\t};\n}\n//#endregion\n//#region src/builds/reporter.ts\n/** An empty string is how a shell spells \"unset\", so it must not be mistaken for a build id. */\nconst nonEmpty = (value) => value !== void 0 && value.length > 0 ? value : void 0;\nfunction buildReporter(options) {\n\treturn { begin: async (input) => {\n\t\ttry {\n\t\t\treturn await beginSession(input, options);\n\t\t} catch (error) {\n\t\t\t(options.warn ?? ((message) => console.warn(message)))(`Could not start build reporting: ${error instanceof Error ? error.message : String(error)}`);\n\t\t\treturn;\n\t\t}\n\t} };\n}\nasync function beginSession(input, options) {\n\tconst env = options.env ?? process.env;\n\tconst warn = options.warn ?? ((message) => console.warn(message));\n\tconst injected = input.credentials?.client;\n\tconst token = env[\"PRISMA_SERVICE_TOKEN\"];\n\tif (options.api === void 0 && options.topology === void 0 && injected === void 0 && (token === void 0 || token.length === 0)) return;\n\tlet client;\n\tconst clientOf = () => client ??= injected ?? createManagementApiClient({\n\t\ttoken: token ?? \"\",\n\t\tbaseUrl: options.origin ?? Effect.runSync(managementApiBaseUrl(options.env))\n\t});\n\tconst api = options.api ?? buildsApi({\n\t\tclient: clientOf(),\n\t\twarn\n\t});\n\tconst topologyApi = options.topology ?? applicationTopologyApi({\n\t\tclient: clientOf(),\n\t\twarn\n\t});\n\tlet submission;\n\ttry {\n\t\tconst body = composeApplicationTopology(input.graph);\n\t\tsubmission = {\n\t\t\tbody,\n\t\t\tcontentHash: applicationTopologyContentHash(body)\n\t\t};\n\t} catch (error) {\n\t\twarn(`Could not compose this deploy's application topology: ${error instanceof Error ? error.message : String(error)}`);\n\t\tsubmission = void 0;\n\t}\n\tconst identity = resolveRunIdentity(input.cwd, env);\n\tif (identity === void 0) {\n\t\twarn(`\\nNot recording this deploy in Prisma Cloud: ${input.cwd} has no commit and branch to report it under. Deploy from a git checkout to see it in the Console.`);\n\t\treturn sessionWithoutBuild(topologyApi, submission, options.refsOf);\n\t}\n\tconst joined = nonEmpty(input.reportId) ?? nonEmpty(env[\"PRISMA_BUILD_ID\"]);\n\tconst buildId = joined !== void 0 ? joined : await api.create({\n\t\tsource: identity.source,\n\t\tcommitSha: identity.commitSha,\n\t\tbranchName: identity.branchName,\n\t\t...identity.runIdentity !== void 0 ? { runIdentity: identity.runIdentity } : {},\n\t\t...identity.externalLogUrl !== void 0 ? { externalLogUrl: identity.externalLogUrl } : {}\n\t});\n\tif (buildId === void 0) return sessionWithoutBuild(topologyApi, submission, options.refsOf);\n\tawait api.update(buildId, {\n\t\tphase: \"deploy\",\n\t\tstate: \"running\"\n\t});\n\treturn session(api, topologyApi, buildId, submission, options.refsOf, warn);\n}\n/**\n* The app this run deployed and where it can be reached — but only when the\n* run deployed exactly one compute service.\n*\n* `Build.appId` and `Build.deployedUrl` are each one value, and an app with\n* several services has no single answer. Picking the first would put an\n* arbitrary service's address in the Console and quietly imply it was the\n* app's. Single-service apps are the common case and get a working link;\n* multi-service apps get neither, and their services are all reported through\n* the resources endpoint regardless.\n*\n* Both fields are fill-only, so this is safe to send on a build whose creator\n* already set them to the same values, and a genuine disagreement is a 409\n* the caller logs.\n*/\nfunction deployedApp(entities) {\n\tconst services = entities.filter((entity) => entity.kind === \"compute-service\");\n\tconst only = services.length === 1 ? services[0] : void 0;\n\tif (only === void 0) return {};\n\treturn {\n\t\tappId: only.id,\n\t\t...only.url !== void 0 ? { deployedUrl: only.url } : {}\n\t};\n}\n/**\n* The topology half of `attach`, shared with build-less sessions: replaces\n* the stage Branch's application topology, once per deploy, after the Branch\n* exists and before any resource is created (attach's position in the\n* pipeline). A container that resolves no stage Branch has nowhere to submit\n* to, and the API's own failure handling already warned — nothing here\n* throws past it.\n*/\nasync function submitTopology(topologyApi, submission, refs) {\n\tif (submission === void 0 || refs.stageBranchId === void 0) return;\n\tawait topologyApi.replace(refs.projectId, refs.stageBranchId, {\n\t\tcontentHash: submission.contentHash,\n\t\t...submission.body\n\t});\n}\n/**\n* The session for a deploy whose Build never came to be — no repository to\n* report under, or a create the platform refused. The declared topology\n* depends on neither, so `attach` still submits it; everything else is a\n* no-op.\n*/\nfunction sessionWithoutBuild(topologyApi, submission, refsOf) {\n\treturn {\n\t\tchildEnv: () => ({}),\n\t\tasync attach(input) {\n\t\t\tif (input.container === void 0) return;\n\t\t\tawait submitTopology(topologyApi, submission, refsOf(input.container));\n\t\t},\n\t\tfinish: async () => {}\n\t};\n}\nfunction session(api, topologyApi, buildId, submission, refsOf, warn) {\n\tlet finished = false;\n\treturn {\n\t\tchildEnv: () => ({ [BUILD_ID_ENV]: buildId }),\n\t\t/**\n\t\t* Attaches the build to the Project and Branch this deploy resolved,\n\t\t* stamping the topology's content hash on the same update, then submits\n\t\t* the declared topology to the stage Branch. The hash rides the attach\n\t\t* update rather than a call of its own because it must not travel alone\n\t\t* yet: until the platform accepts the field, its validator strips it and\n\t\t* then rejects the emptied body (\"at least one field must be given\") —\n\t\t* observed live on 2026-08-21. Folded in, the update stays valid today\n\t\t* and the hash starts landing the moment the field is accepted. It is\n\t\t* sent whether or not the submission lands — the run acted on this graph\n\t\t* either way; equal hashes are a value match, not a reference to the\n\t\t* stored topology.\n\t\t*/\n\t\tasync attach(input) {\n\t\t\tif (input.container === void 0) return;\n\t\t\tconst refs = refsOf(input.container);\n\t\t\tconst { projectId, branchId } = refs;\n\t\t\tawait api.update(buildId, {\n\t\t\t\tprojectId,\n\t\t\t\t...branchId !== void 0 ? { branchId } : {},\n\t\t\t\t...submission !== void 0 ? { applicationTopologyContentHash: submission.contentHash } : {}\n\t\t\t});\n\t\t\tawait submitTopology(topologyApi, submission, refs);\n\t\t},\n\t\tasync finish(outcome) {\n\t\t\tif (finished) return;\n\t\t\tfinished = true;\n\t\t\ttry {\n\t\t\t\tawait api.update(buildId, {\n\t\t\t\t\tstate: outcome.ok ? \"succeeded\" : outcome.cancelled ? \"cancelled\" : \"failed\",\n\t\t\t\t\t...outcome.failingStep !== void 0 && !outcome.cancelled ? { failingStep: outcome.failingStep } : {},\n\t\t\t\t\t...outcome.errorMessage !== void 0 && !outcome.cancelled ? { errorMessage: outcome.errorMessage } : {},\n\t\t\t\t\t...deployedApp(outcome.entities)\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\twarn(`Could not report this deploy's outcome: ${error instanceof Error ? error.message : String(error)}`);\n\t\t\t}\n\t\t}\n\t};\n}\n//#endregion\nexport { BUILD_ID_ENV, applicationTopologyApi, applicationTopologyContentHash, buildReporter, buildsApi, composeApplicationTopology, reportableResource, resolveRunIdentity, resourceReporter };\n\n//# sourceMappingURL=builds.mjs.map","import { c as paramName, s as paramBindingFor } from \"./secret-Dgyg1WyG.mjs\";\nimport { a as encode, c as paramEntries, d as serializeInput, n as configKey, o as encodeParamPointer, r as decodeParamPointer, s as isParamPointerRow } from \"./serializer-DTCrRl7S.mjs\";\nimport { n as RESERVED_PROVIDER_PARAMS, o as SELF_ORIGIN, r as STREAMS_API_KEY, t as provisionedEdges } from \"./provisioned-edges-DKsBi7uK.mjs\";\nimport { n as requiredPackHeadOf } from \"./required-pack-head-CMMJ2LaU.mjs\";\nimport { _ as prismaCloudContainerOf, a as PgWarmProvider, c as resolveTargetRef, d as GeneratedParam, f as GeneratedParamProvider, h as containerDescriptor, i as PgWarm, l as packHeadRefHashes, n as S3CredentialsProvider, o as OrmMigration, p as PRISMA_CLOUD_EXTENSION_ID, r as collectPreflightNames, s as OrmMigrationProvider, t as S3Credentials, u as resolveOrmConfig } from \"./s3-credentials-resource-D_qSGYMM.mjs\";\nimport { r as isPostgresResourceNode } from \"./orm-postgres-ChW2Ewj7.mjs\";\nimport { isParamSource } from \"@internal/core\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport { RPC_PEER_KEY } from \"@internal/service-rpc\";\nimport * as Prisma from \"@internal/lowering\";\nimport { ARTIFACT_CONTENT_TYPE, ManagementClient, appAfterEnvironment, drivePagesAsync, fromEnv, managementClientLayer, packageComputeArtifact } from \"@internal/lowering\";\nimport { prismaStateLayer } from \"@internal/lowering/state\";\nimport * as Output from \"alchemy/Output\";\nimport * as Prisma$1 from \"alchemy/Prisma\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as Builds from \"@internal/lowering/builds\";\nimport { readPreflightPayload } from \"@internal/core/config\";\nconst PRISMA_NAME_MIN = 3;\nconst PRISMA_NAME_MAX = 65;\nfunction validateName(value, source) {\n\tif (value.length < PRISMA_NAME_MIN || value.length > PRISMA_NAME_MAX) throw new Error(`prisma-cloud: ${source} \"${value}\" (${value.length} characters) is not a valid Prisma resource name — Prisma requires ${PRISMA_NAME_MIN}–${PRISMA_NAME_MAX} characters. Rename the provision id (or the deploy --name) to fit.`);\n}\nfunction isCloudApplication(value) {\n\treturn typeof value === \"object\" && value !== null && \"projectId\" in value && typeof value.projectId === \"string\" && \"branchId\" in value && (value.branchId === void 0 || typeof value.branchId === \"string\") && \"defaultBranchId\" in value && (value.defaultBranchId === void 0 || typeof value.defaultBranchId === \"string\") && \"branchless\" in value && typeof value.branchless === \"boolean\";\n}\n/** Narrows `ctx.application`, which core hands over as `unknown`, to this extension's own product; throws naming the hook when it hasn't run. */\nfunction cloudApplicationOf(application) {\n\tif (!isCloudApplication(application)) throw new Error(\"prisma-cloud: ctx.application is not this extension's application product — the prismaCloud() application hook must run before any node lowers.\");\n\treturn application;\n}\nfunction projectIdOf(application) {\n\treturn cloudApplicationOf(application).projectId;\n}\n/**\n* The Branch a database attaches to. Upstream treats an omitted branch as\n* desired-unassigned (`branchId` PATCHed back to `null` on reconcile), so a\n* deploy container carrying neither id is a broken transport; only a\n* `branchless` (dev) container returns `undefined`.\n*/\nfunction attachmentBranchIdOf(application, id) {\n\tconst app = cloudApplicationOf(application);\n\tconst branchId = app.branchId ?? app.defaultBranchId;\n\tif (branchId === void 0 && !app.branchless) throw new Error(`prisma-cloud: cannot attach database \"${id}\" to a Branch — the resolved container carries neither a stage Branch id nor the project's default Branch id. Container resolution (ADR-0019) always provides one for a deploy; this is a bug in the container transport.`);\n\treturn branchId;\n}\n/**\n* Upstream refuses an explicit display name combined with branch attachment\n* at create (create-then-attach, no idempotency key), so attached databases\n* take the generated physical name; only the branchless (dev) container takes\n* the `name` arm. The returned `url` is direct, not pooled — PgWarm and the\n* migration flows need a direct connection.\n*/\nconst stageDatabase = ({ id, application, region }) => Effect.gen(function* () {\n\tconst branchId = attachmentBranchIdOf(application, id);\n\tconst db = yield* Prisma$1.Database(`${id}-db`, {\n\t\tproject: projectIdOf(application),\n\t\tregion: region ?? \"us-east-1\",\n\t\t...branchId !== void 0 ? { branchId } : { name: id }\n\t});\n\tconst conn = yield* Prisma$1.Connection(`${id}-conn`, {\n\t\tdatabase: db,\n\t\tname: id\n\t});\n\treturn {\n\t\tdb,\n\t\turl: Output.map(conn.directConnectionString, (value) => {\n\t\t\tif (value === void 0) throw new Error(`prisma-cloud: connection \"${id}-conn\" returned no direct connection string.`);\n\t\t\treturn Redacted.value(value);\n\t\t})\n\t};\n});\n//#endregion\n//#region src/descriptors/bucket.ts\n/**\n* One Bucket per module-provisioned bucket resource — `id` is the module\n* provision id, so a resource shared by several consumers is created exactly\n* once. A BucketAccessKey is minted for the bucket: it is the reveal-once\n* credential carrier, and its attributes (endpoint, bucketName, accessKeyId,\n* secretAccessKey) become the four S3Config outputs consumers resolve by name.\n*/\nfunction bucketDescriptor(_o) {\n\tconst lowering = ({ id, application }) => Effect.gen(function* () {\n\t\tvalidateName(id, \"resource name (from provision id)\");\n\t\tconst branchId = cloudApplicationOf(application).branchId;\n\t\tconst bkt = yield* Prisma$1.Bucket(`${id}-bucket`, {\n\t\t\tproject: projectIdOf(application),\n\t\t\tname: id,\n\t\t\t...branchId !== void 0 ? { branchId } : {}\n\t\t});\n\t\tconst key = yield* Prisma$1.BucketAccessKey(`${id}-key`, {\n\t\t\tbucket: bkt.bucketId,\n\t\t\tname: id,\n\t\t\trole: \"read_write\"\n\t\t});\n\t\tconst secretAccessKey = Output.map(key.secretAccessKey, (v) => Redacted.value(v));\n\t\treturn {\n\t\t\toutputs: {\n\t\t\t\turl: key.endpoint,\n\t\t\t\tbucket: key.bucketName,\n\t\t\t\taccessKeyId: key.accessKeyId,\n\t\t\t\tsecretAccessKey\n\t\t\t},\n\t\t\tentities: [{\n\t\t\t\tkind: \"bucket\",\n\t\t\t\tid: bkt.bucketId\n\t\t\t}]\n\t\t};\n\t});\n\treturn Object.assign(lowering, { kind: \"resource\" });\n}\n//#endregion\n//#region src/descriptors/compute.ts\n/** The `compute` node kind's descriptor: the four service hooks — provision, serialize, package, deploy. */\n/**\n* Every env-var value goes to the platform wrapped in `Redacted`: the\n* Management API never reads a value back, so alchemy persists the desired one\n* in state to repair drift, and `Redacted` is what keeps it out of the\n* serialized state row. A value that is still an unresolved deploy-time\n* reference is wrapped inside the map, at the same point it becomes a string.\n*/\nconst envValue = (value) => Output.isOutput(value) ? Output.map(value, Redacted.make) : Redacted.make(value);\n/**\n* Returns the PRECISE descriptor type, not the erased `NodeDescriptor`: the\n* registry in control.ts erases it on assignment anyway (method bivariance),\n* but s3-store composes over these hooks and needs their P/S to stay visible.\n* Annotating this `NodeDescriptor` would force s3-store to cast them back.\n*/\nfunction computeDescriptor(o) {\n\treturn {\n\t\tkind: \"service\",\n\t\tprovision: ({ id, application }) => Effect.gen(function* () {\n\t\t\tvalidateName(id, \"service name (from provision id)\");\n\t\t\tconst projectId = projectIdOf(application);\n\t\t\tconst branchId = cloudApplicationOf(application).branchId;\n\t\t\tconst svc = yield* Prisma$1.App(`${id}-svc`, {\n\t\t\t\tproject: projectId,\n\t\t\t\tdisplayName: id,\n\t\t\t\tregionId: o().region ?? \"us-east-1\",\n\t\t\t\t...branchId !== void 0 ? { branchId } : {}\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tserviceId: svc.appId,\n\t\t\t\tprojectId,\n\t\t\t\tendpointDomain: svc.appEndpointDomain\n\t\t\t};\n\t\t}),\n\t\tserialize: (ctx, provisioned, config) => Effect.gen(function* () {\n\t\t\tconst { address, node, graph } = ctx;\n\t\t\tconst branchId = cloudApplicationOf(ctx.application).branchId;\n\t\t\tconst cls = branchId ? \"preview\" : \"production\";\n\t\t\tconst branch = branchId !== void 0 ? { branchId } : {};\n\t\t\tconst projectId = provisioned.projectId;\n\t\t\tconst svc = node;\n\t\t\tconst rows = [];\n\t\t\tfor (const d of paramEntries(svc)) {\n\t\t\t\tconst value = d.owner === \"service\" ? config.service[d.name] : config.inputs[d.owner.input]?.[d.name];\n\t\t\t\tif (value === void 0) continue;\n\t\t\t\tconst key = configKey(address, d);\n\t\t\t\tconst rowValue = d.owner === \"service\" && isParamSource(value) ? encodeParamPointer(paramName(paramBindingFor(graph.params, address, d.name))) : encode(d.owner, value);\n\t\t\t\tconst wrapped = envValue(rowValue);\n\t\t\t\tconst record = yield* Prisma$1.EnvironmentVariable(`${key}-var`, {\n\t\t\t\t\tproject: projectId,\n\t\t\t\t\tkey,\n\t\t\t\t\tvalue: wrapped,\n\t\t\t\t\tclass: cls,\n\t\t\t\t\t...branch\n\t\t\t\t});\n\t\t\t\tconst pointer = d.owner === \"service\" && isParamPointerRow(rowValue) ? decodeParamPointer(rowValue) : void 0;\n\t\t\t\trows.push({\n\t\t\t\t\trecord,\n\t\t\t\t\tkey,\n\t\t\t\t\tvalue: wrapped,\n\t\t\t\t\t...pointer !== void 0 ? { pointers: [pointer] } : {}\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst inputRow = serializeInput(svc, address, graph.inputBindings.find((b) => b.serviceAddress === address)?.binding);\n\t\t\tif (inputRow !== void 0) {\n\t\t\t\tconst inputValue = envValue(inputRow.value);\n\t\t\t\trows.push({\n\t\t\t\t\trecord: yield* Prisma$1.EnvironmentVariable(`${inputRow.key}-var`, {\n\t\t\t\t\t\tproject: projectId,\n\t\t\t\t\t\tkey: inputRow.key,\n\t\t\t\t\t\tvalue: inputValue,\n\t\t\t\t\t\tclass: cls,\n\t\t\t\t\t\t...branch\n\t\t\t\t\t}),\n\t\t\t\t\tkey: inputRow.key,\n\t\t\t\t\tvalue: inputValue,\n\t\t\t\t\tpointers: inputRow.secrets\n\t\t\t\t});\n\t\t\t\tfor (const leaf of inputRow.generated) {\n\t\t\t\t\tconst resource = yield* GeneratedParam(`${inputRow.key}:${leaf.path}-generated`, { bytes: leaf.bytes });\n\t\t\t\t\tconst generatedValue = envValue(resource.value);\n\t\t\t\t\trows.push({\n\t\t\t\t\t\trecord: yield* Prisma$1.EnvironmentVariable(`${leaf.varName}-var`, {\n\t\t\t\t\t\t\tproject: projectId,\n\t\t\t\t\t\t\tkey: leaf.varName,\n\t\t\t\t\t\t\tvalue: generatedValue,\n\t\t\t\t\t\t\tclass: cls,\n\t\t\t\t\t\t\t...branch\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tkey: leaf.varName,\n\t\t\t\t\t\tvalue: generatedValue\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst exposes = svc.expose !== void 0 && Object.keys(svc.expose).length > 0;\n\t\t\tconst refsByBrand = /* @__PURE__ */ new Map();\n\t\t\tif (exposes) for (const edge of provisionedEdges(graph)) {\n\t\t\t\tif (edge.providerAddress !== address) continue;\n\t\t\t\tconst ref = ctx.provisioned.get(edge.edgeId);\n\t\t\t\tif (ref === void 0) continue;\n\t\t\t\tconst refs = refsByBrand.get(edge.brand) ?? [];\n\t\t\t\trefs.push(ref);\n\t\t\t\trefsByBrand.set(edge.brand, refs);\n\t\t\t}\n\t\t\tfor (const [brand, entry] of o().providerParams) {\n\t\t\t\tconst raw = \"valueForService\" in entry ? entry.valueForService(provisioned, address) : exposes ? entry.value(refsByBrand.get(brand) ?? []) : void 0;\n\t\t\t\tif (raw === void 0) continue;\n\t\t\t\tconst key = configKey(address, {\n\t\t\t\t\towner: \"service\",\n\t\t\t\t\tname: entry.name\n\t\t\t\t});\n\t\t\t\tconst value = Output.isOutput(raw) ? Output.map(raw, (v) => encode(\"service\", v)) : encode(\"service\", raw);\n\t\t\t\tconst providerValue = envValue(value);\n\t\t\t\trows.push({\n\t\t\t\t\trecord: yield* Prisma$1.EnvironmentVariable(`${key}-var`, {\n\t\t\t\t\t\tproject: projectId,\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tvalue: providerValue,\n\t\t\t\t\t\tclass: cls,\n\t\t\t\t\t\t...branch\n\t\t\t\t\t}),\n\t\t\t\t\tkey,\n\t\t\t\t\tvalue: providerValue\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst port = typeof config.service[\"port\"] === \"number\" ? config.service[\"port\"] : 3e3;\n\t\t\treturn {\n\t\t\t\tenvironment: rows.map((r) => r.record),\n\t\t\t\ttriggers: Object.fromEntries(rows.map((r) => [r.key, r.value])),\n\t\t\t\tpointers: [...new Set(rows.flatMap((r) => r.pointers ?? []))],\n\t\t\t\tport,\n\t\t\t\t...inputRow !== void 0 ? { input: inputRow } : {}\n\t\t\t};\n\t\t}),\n\t\tpackage: ({ id }, { assembled, address }) => Effect.try(() => packageComputeArtifact({\n\t\t\tid,\n\t\t\tbundleDir: assembled.dir,\n\t\t\tappEntry: assembled.entry,\n\t\t\taddress\n\t\t})),\n\t\tdeploy: ({ id }, provisioned, artifact, serialized) => Effect.gen(function* () {\n\t\t\tconst pointerUpdatedAt = o().pointerUpdatedAt;\n\t\t\tconst triggers = {\n\t\t\t\t...serialized.triggers,\n\t\t\t\t...Object.fromEntries(serialized.pointers.map((name) => [`${name}:updatedAt`, pointerUpdatedAt(name) ?? \"?\"]))\n\t\t\t};\n\t\t\tconst deployment = yield* Prisma$1.Deployment(`${id}-deploy`, {\n\t\t\t\tapp: appAfterEnvironment(provisioned.serviceId, serialized.environment),\n\t\t\t\tartifactPath: artifact.path,\n\t\t\t\tartifactContentType: ARTIFACT_CONTENT_TYPE,\n\t\t\t\ttriggers,\n\t\t\t\tportMapping: { http: serialized.port },\n\t\t\t\tstart: true,\n\t\t\t\tpromote: true\n\t\t\t});\n\t\t\tconst inputDetails = serialized.input !== void 0 ? { details: {\n\t\t\t\tinput: serialized.input.value,\n\t\t\t\t...serialized.input.absent.length > 0 ? { absent: serialized.input.absent.join(\"\\n\") } : {}\n\t\t\t} } : {};\n\t\t\treturn {\n\t\t\t\toutputs: {\n\t\t\t\t\turl: deployment.appEndpointDomain,\n\t\t\t\t\tprojectId: provisioned.projectId\n\t\t\t\t},\n\t\t\t\tentities: [{\n\t\t\t\t\tkind: \"compute-service\",\n\t\t\t\t\tid: provisioned.serviceId,\n\t\t\t\t\turl: deployment.appEndpointDomain,\n\t\t\t\t\t...inputDetails\n\t\t\t\t}]\n\t\t\t};\n\t\t})\n\t};\n}\n//#endregion\n//#region src/preflight.ts\n/** production for the default stage; preview for a named stage — matching how the pack writes config rows. */\nconst classFor = (branchId) => branchId === void 0 ? \"production\" : \"preview\";\n/**\n* One page of the env-var list. The query is `blindCast` to `never` because\n* openapi-fetch types this path's query as `never` (an SDK path/operation\n* mismatch); that same workaround defeats the client's response-type inference,\n* so the result is projected to the small shape we actually read.\n*/\nasync function listEnvVars(client, query) {\n\treturn blindCast(await client.GET(\"/v1/environment-variables\", { params: { query: blindCast(query) } }));\n}\n/**\n* What the platform holds for `key` in the target stage's scope. Default stage\n* → any production-class template. Named stage → a preview template (branchId\n* null) OR this branch's own override — the platform's preview materialization\n* (pdp-data-model.md). Metadata read only; env-var values are write-only.\n*\n* The whole list is walked rather than short-circuiting on the first visible\n* row, because the newest `updatedAt` across every visible row is the rotation\n* signal the compute deploy hook fingerprints on: stopping early would make\n* that timestamp depend on where the page boundary happened to fall, and a\n* fingerprint that moves for that reason would redeploy for no reason. A key\n* with more rows than one page (a template plus many per-branch overrides) is\n* rare, so this costs one request in practice.\n*/\nasync function readPlatformVariable(client, projectId, branchId, key) {\n\tconst cls = classFor(branchId);\n\tconst visible = (row) => branchId === void 0 || row.branchId === null || row.branchId === branchId;\n\tlet exists = false;\n\tlet latest;\n\tawait drivePagesAsync(`environment variables named \"${key}\"`, async (cursor) => {\n\t\tconst res = await listEnvVars(client, cursor === void 0 ? {\n\t\t\tprojectId,\n\t\t\tclass: cls,\n\t\t\tkey\n\t\t} : {\n\t\t\tprojectId,\n\t\t\tclass: cls,\n\t\t\tkey,\n\t\t\tcursor\n\t\t});\n\t\tif (res.error !== void 0) throw listFailedError(key, res.error);\n\t\treturn res.data ?? {\n\t\t\tdata: [],\n\t\t\tpagination: {\n\t\t\t\tnextCursor: null,\n\t\t\t\thasMore: false\n\t\t\t}\n\t\t};\n\t}, (data) => {\n\t\tfor (const row of data) {\n\t\t\tif (!visible(row)) continue;\n\t\t\texists = true;\n\t\t\tif (latest === void 0 || Date.parse(row.updatedAt) > Date.parse(latest)) latest = row.updatedAt;\n\t\t}\n\t\treturn false;\n\t});\n\treturn latest === void 0 ? { exists } : {\n\t\texists,\n\t\tupdatedAt: latest\n\t};\n}\n/**\n* Provision `key`=`value` directly via the Management API for the target\n* stage's scope (a production template for the default stage; a preview branch\n* override for a named stage — the same scope the pack's config rows are\n* written to, through alchemy's `Prisma.EnvironmentVariable`). A 409 means a\n* concurrent deploy already provisioned\n* it — tolerated. The value is never logged.\n*/\nasync function fillMissing(client, projectId, branchId, key, value) {\n\tconst res = await client.POST(\"/v1/environment-variables\", { body: {\n\t\tprojectId,\n\t\tclass: classFor(branchId),\n\t\tkey,\n\t\tvalue,\n\t\t...branchId !== void 0 ? { branchId } : {}\n\t} });\n\tif (res.error !== void 0 && res.response.status !== 409) throw fillFailedError(key, res.error);\n\treturn res.data?.data.updatedAt;\n}\nconst tokenRequiredError = () => /* @__PURE__ */ new Error(\"environment variable PRISMA_SERVICE_TOKEN is required for deploy preflight.\");\nconst listFailedError = (key, error) => /* @__PURE__ */ new Error(`deploy preflight: Prisma Management API error listing \"${key}\": ${JSON.stringify(error)}.`);\nconst fillFailedError = (key, error) => /* @__PURE__ */ new Error(`deploy preflight: failed to provision \"${key}\" from the deploy shell: ${JSON.stringify(error)}.`);\nfunction missingError(missing, projectId, branchId, stage) {\n\tconst lines = missing.map((m) => ` - ${m.name} (used by service \"${m.serviceAddress}\")`);\n\tconst countPhrase = missing.length === 1 ? \"1 required setting has\" : `${missing.length} required settings have`;\n\tconst scopeFlag = branchId === void 0 ? \"--role production\" : `--branch \"${stage ?? branchId}\"`;\n\tconst commands = missing.map((m) => `prisma project env add ${m.name}=\"<value>\" --project ${projectId} ${scopeFlag}`);\n\tconst runStep = commands.length === 1 ? `Run: ${commands[0]}` : `Run, once per setting:\\n${commands.map((cmd) => ` ${cmd}`).join(\"\\n\")}`;\n\tconst consoleStep = branchId === void 0 ? \"add each one under Production. Those values apply when the default branch deploys to production.\" : `add each one under Preview. Preview values apply to every branch deploy, including \"${stage ?? branchId}\".`;\n\treturn /* @__PURE__ */ new Error(`Deploy failed. ${countPhrase} no value:\\n${lines.join(\"\\n\")}\\n\\nSet the value in one of these two places, then deploy again:\n - ${runStep}\\n - Or in the Prisma Console: open the project, go to Environment variables, and ${consoleStep}`);\n}\nasync function managementClient() {\n\tif ((process.env[\"PRISMA_SERVICE_TOKEN\"] ?? \"\").length === 0) throw tokenRequiredError();\n\treturn Effect.runPromise(Effect.gen(function* () {\n\t\treturn yield* ManagementClient;\n\t}).pipe(Effect.provide(managementClientLayer().pipe(Layer.provide(fromEnv())))));\n}\n/**\n* The Prisma Cloud extension's `preflight`. Uses the shared name collector\n* (`collectPreflightNames`, ADR-0042) — every service's input-binding\n* `envSecret` leaf, plus `paramManifest` filtered to env-sourced reserved\n* params — checks each platform name against the platform, fills from the\n* shell where possible, and fails loudly on anything absent from both.\n* `envParam` leaves of an input binding are NOT checked here — they resolve\n* from the deploy shell at serialize, and an unset one is an omitted key the\n* schema arbitrates. Uses the caller's client (`input.credentials`), then an\n* injected one for tests, then a client built from env.\n*/\nasync function runPreflight(input, deps) {\n\tconst { projectId, branchId } = prismaCloudContainerOf(input.container);\n\tconst collected = collectPreflightNames(input.graph);\n\tconst names = /* @__PURE__ */ new Map();\n\tfor (const meta of [...collected.secrets, ...collected.envParams]) if (!names.has(meta.name)) names.set(meta.name, meta);\n\tif (names.size === 0) return /* @__PURE__ */ new Map();\n\tconst client = input.credentials?.client ?? deps?.client ?? await managementClient();\n\tconst missing = [];\n\tconst updatedAt = /* @__PURE__ */ new Map();\n\tfor (const meta of names.values()) {\n\t\tconst platform = await readPlatformVariable(client, projectId, branchId, meta.name);\n\t\tif (platform.exists) {\n\t\t\tif (platform.updatedAt !== void 0) updatedAt.set(meta.name, platform.updatedAt);\n\t\t\tcontinue;\n\t\t}\n\t\tconst shellValue = process.env[meta.name];\n\t\tif (shellValue !== void 0 && shellValue.length > 0) {\n\t\t\tconst filled = await fillMissing(client, projectId, branchId, meta.name, shellValue);\n\t\t\tif (filled !== void 0) updatedAt.set(meta.name, filled);\n\t\t\tcontinue;\n\t\t}\n\t\tmissing.push(meta);\n\t}\n\tif (missing.length > 0) throw missingError(missing, projectId, branchId, input.stage);\n\treturn updatedAt;\n}\n/**\n* The extension-pack half of the deploy preflight: every dependency edge\n* whose required contract carries a `requiredPackHead` must be wired to a\n* `postgres` resource whose `prisma.config.ts` lists that pack at the\n* required head hash. Enforced HERE — at deploy time, before the migration\n* step constructs — because wireability (`dataContract().satisfies`)\n* deliberately says yes to every required pack head (the authoring-side\n* contract value cannot see the resource's config), and boot time would be\n* too late: the service would be down after a green deploy. Invoked from the\n* `postgres` descriptor's lowering, beside the migration-step\n* construction.\n*/\nasync function runPackPreflight(graph) {\n\tfor (const edge of graph.edges) {\n\t\tif (edge.kind !== \"dependency\") continue;\n\t\tconst consumer = graph.nodes.find((n) => n.id === edge.to)?.node;\n\t\tif (consumer === void 0 || consumer.kind !== \"service\") continue;\n\t\tconst slot = consumer.inputs[edge.input];\n\t\tif (slot === void 0) continue;\n\t\tconst requirement = requiredPackHeadOf(slot.required);\n\t\tif (requirement === void 0) continue;\n\t\tconst node = graph.nodes.find((n) => n.id === edge.from)?.node;\n\t\tconst provider = node !== void 0 && (node.kind === \"resource\" || node.kind === \"service\") && isPostgresResourceNode(node) ? node : void 0;\n\t\tif (provider === void 0) throw new Error(`service \"${edge.to}\" requires extension pack \"${requirement.packId}\", which only a postgres resource can carry.`);\n\t\tconst { extensionPacks } = await resolveOrmConfig(provider.config);\n\t\tconst pack = extensionPacks.find((p) => p.id === requirement.packId);\n\t\tif (pack === void 0) throw new Error(`postgres database \"${provider.name}\" does not list extension pack \"${requirement.packId}\" in its prisma.config.ts extensions — service \"${edge.to}\" requires it. Add the pack and run migration plan.`);\n\t\tconst head = pack.contractSpace?.headRef.hash;\n\t\tif (head !== requirement.headHash) throw new Error(`postgres database \"${provider.name}\" lists extension pack \"${requirement.packId}\" at head ${head ?? \"(no contract space)\"}, but service \"${edge.to}\" requires ${requirement.headHash}. Upgrade the pack and run migration plan.`);\n\t}\n}\n//#endregion\n//#region src/descriptors/orm-postgres.ts\n/**\n* The migration is a tracked `OrmMigration` Alchemy resource keyed on the\n* target REF identity (hash + sorted invariants): unchanged redeploy is a\n* no-op, a contract or ref-invariant change re-migrates.\n*/\nfunction postgresDescriptor(o) {\n\tconst lowering = ({ id, node, application, graph }) => Effect.gen(function* () {\n\t\tvalidateName(id, \"resource name (from provision id)\");\n\t\tconst { db, url } = yield* stageDatabase({\n\t\t\tid,\n\t\t\tapplication,\n\t\t\tregion: o().region\n\t\t});\n\t\tif (!isPostgresResourceNode(node)) throw new Error(`postgres lowering received a non-postgres node (${id}).`);\n\t\tconst contractJson = node.provides.__cmp.contractJson;\n\t\tconst { migrationsDir, extensionPacks } = yield* Effect.promise(() => resolveOrmConfig(node.config));\n\t\tconst ref = yield* Effect.promise(() => resolveTargetRef(migrationsDir, contractJson, node.targetRef));\n\t\tyield* Effect.promise(() => runPackPreflight(graph));\n\t\tconst warm = yield* PgWarm(`${id}-warm`, { url });\n\t\tyield* OrmMigration(`${id}-migrate`, {\n\t\t\turl: warm.url,\n\t\t\tcontractJson,\n\t\t\tmigrationsDir,\n\t\t\ttargetHash: ref.hash,\n\t\t\tinvariants: [...ref.invariants].sort(),\n\t\t\tpackHeadRefHashes: packHeadRefHashes(extensionPacks),\n\t\t\tconfigPath: node.config,\n\t\t\t...node.targetRef !== void 0 ? { refName: node.targetRef } : {}\n\t\t});\n\t\treturn {\n\t\t\toutputs: { url: warm.url },\n\t\t\tentities: [{\n\t\t\t\tkind: \"postgres-database\",\n\t\t\t\tid: db.databaseId\n\t\t\t}]\n\t\t};\n\t});\n\treturn Object.assign(lowering, { kind: \"resource\" });\n}\n//#endregion\n//#region src/descriptors/raw-postgres.ts\n/**\n* One Database per module-provisioned postgres resource — `id` is the\n* module provision id, so a resource shared by several consumers is created\n* exactly once.\n*/\nfunction rawPostgresDescriptor(o) {\n\tconst lowering = ({ id, application }) => Effect.gen(function* () {\n\t\tvalidateName(id, \"resource name (from provision id)\");\n\t\tconst { db, url } = yield* stageDatabase({\n\t\t\tid,\n\t\t\tapplication,\n\t\t\tregion: o().region\n\t\t});\n\t\treturn {\n\t\t\toutputs: { url: (yield* PgWarm(`${id}-warm`, { url })).url },\n\t\t\tentities: [{\n\t\t\t\tkind: \"postgres-database\",\n\t\t\t\tid: db.databaseId\n\t\t\t}]\n\t\t};\n\t});\n\treturn Object.assign(lowering, { kind: \"resource\" });\n}\n//#endregion\n//#region src/descriptors/s3-credentials.ts\n/**\n* One `S3Credentials` resource per provisioned credentials node — `id` is the\n* module provision id, so a pair shared by the storage service is minted once\n* and kept stable across deploys (the resource's provider preserves it).\n* `_o` is unused today (the mint needs no region/project) but kept for symmetry\n* with the other descriptors' signature.\n*/\nfunction s3CredentialsDescriptor(_o) {\n\tconst lowering = ({ id }) => Effect.gen(function* () {\n\t\tconst creds = yield* S3Credentials(`${id}-creds`, {});\n\t\treturn {\n\t\t\toutputs: {\n\t\t\t\taccessKeyId: creds.accessKeyId,\n\t\t\t\tsecretAccessKey: creds.secretAccessKey\n\t\t\t},\n\t\t\tentities: []\n\t\t};\n\t});\n\treturn Object.assign(lowering, { kind: \"resource\" });\n}\n//#endregion\n//#region src/descriptors/s3-store.ts\nfunction s3StoreDescriptor(o) {\n\tconst base = computeDescriptor(o);\n\treturn {\n\t\tkind: \"service\",\n\t\tprovision: base.provision,\n\t\tpackage: base.package,\n\t\tserialize: (ctx, provisioned, config) => Effect.gen(function* () {\n\t\t\tconst serialized = yield* base.serialize(ctx, provisioned, config);\n\t\t\tconst credentials = config.inputs[\"credentials\"] ?? {};\n\t\t\tconst document = serialized.input !== void 0 ? JSON.parse(serialized.input.value) : void 0;\n\t\t\tconst bucket = typeof document === \"object\" && document !== null && \"bucket\" in document ? document.bucket : void 0;\n\t\t\tif (credentials[\"accessKeyId\"] === void 0 || credentials[\"secretAccessKey\"] === void 0 || bucket === void 0) throw new Error(\"s3-store service must wire a 'credentials' dependency and declare a 'bucket' input key\");\n\t\t\treturn {\n\t\t\t\t...serialized,\n\t\t\t\tbucket,\n\t\t\t\taccessKeyId: credentials[\"accessKeyId\"],\n\t\t\t\tsecretAccessKey: credentials[\"secretAccessKey\"]\n\t\t\t};\n\t\t}),\n\t\tdeploy: (ctx, provisioned, artifact, serialized) => Effect.gen(function* () {\n\t\t\tconst deployed = yield* base.deploy(ctx, provisioned, artifact, serialized);\n\t\t\treturn {\n\t\t\t\t...deployed,\n\t\t\t\toutputs: {\n\t\t\t\t\t...deployed.outputs,\n\t\t\t\t\tbucket: serialized.bucket,\n\t\t\t\t\taccessKeyId: serialized.accessKeyId,\n\t\t\t\t\tsecretAccessKey: serialized.secretAccessKey\n\t\t\t\t}\n\t\t\t};\n\t\t})\n\t};\n}\n//#endregion\n//#region src/reporting/reporter.ts\nfunction prismaCloudReporter() {\n\treturn Builds.buildReporter({ refsOf: (container) => {\n\t\tconst { projectId, branchId, defaultBranchId } = prismaCloudContainerOf(container);\n\t\treturn {\n\t\t\tprojectId,\n\t\t\tbranchId,\n\t\t\tstageBranchId: branchId ?? defaultBranchId\n\t\t};\n\t} });\n}\n//#endregion\n//#region src/control/pointer-timestamps.ts\n/**\n* Carries, on the framework's preflight transport, when each platform\n* variable a Composer row points at was last written — read by preflight in\n* the CLI process, needed by the environment fingerprint in the alchemy\n* process (which re-imports the config from scratch). ISO timestamps only,\n* never values: the Management API returns none and the child's environment\n* is not a place to put one.\n*/\n/** The CLI-process side: what `preflight` hands the framework, or undefined when the deploy read no pointed variable at all. */\nfunction serializePointerUpdatedAt(timestamps) {\n\tif (timestamps.size === 0) return void 0;\n\tconst sorted = [...timestamps].sort(([a], [b]) => a < b ? -1 : 1);\n\treturn JSON.stringify(Object.fromEntries(sorted));\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n/**\n* The alchemy-process side: the timestamps the CLI process transported. An\n* absent payload is the normal case for `prisma-composer dev` and for any run\n* with no pointed variables, and reads as an empty map; a payload that is\n* present but unreadable is a framework bug and throws rather than silently\n* costing the deploy its rotation signal.\n*/\nfunction deserializePointerUpdatedAt(payload) {\n\tconst timestamps = /* @__PURE__ */ new Map();\n\tif (payload === void 0) return timestamps;\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(payload);\n\t} catch (error) {\n\t\tthrow payloadError(error instanceof Error ? error.message : String(error));\n\t}\n\tif (!isRecord(parsed)) throw payloadError(\"it is not a JSON object\");\n\tfor (const [name, updatedAt] of Object.entries(parsed)) {\n\t\tif (typeof updatedAt !== \"string\") throw payloadError(`\"${name}\" is not a string timestamp`);\n\t\ttimestamps.set(name, updatedAt);\n\t}\n\treturn timestamps;\n}\nconst payloadError = (reason) => /* @__PURE__ */ new Error(`prisma-cloud: the deploy preflight's rotation timestamps did not survive the transport into the alchemy process — ${reason}. This is a framework bug; re-running the deploy will not fix it.`);\n/**\n* The pointer lookup the node descriptors close over: `own` — filled by\n* `preflight` — in the CLI process, and the transported payload in the alchemy\n* process, where `own` is empty because that process never runs a preflight.\n* A name in neither reads as unknown, which is every name under\n* `prisma-composer dev`.\n*/\nfunction pointerUpdatedAtLookup(own, env) {\n\tlet transported;\n\treturn (name) => {\n\t\tconst mine = own.get(name);\n\t\tif (mine !== void 0) return mine;\n\t\ttransported ??= deserializePointerUpdatedAt(readPreflightPayload(PRISMA_CLOUD_EXTENSION_ID, env));\n\t\treturn transported.get(name);\n\t};\n}\n//#endregion\n//#region src/control/extension.ts\n/** The Prisma Cloud–hosted deploy state store; its implementation lives in @internal/lowering. */\n/**\n* ADR-0031's registered provisioner for RPC_PEER_KEY: mints one `ServiceKey`\n* resource per edge (ADR-0030) and forwards its value as the opaque ref core\n* writes into the consumer's `serviceKey` param. The resource id keeps the\n* `servicekey-${edgeId}` scheme byte-identical to slice 2's, so an existing\n* deploy's keys are found, not re-minted. Defined here, not in service-keys.ts:\n* that module is also reachable from the runtime/authoring side, which must\n* never import `@internal/lowering` or `effect`.\n*/\nconst serviceKeyProvisioner = { provision: (edge) => Effect.gen(function* () {\n\treturn (yield* Prisma.ServiceKey(`servicekey-${edge.edgeId}`, {})).value;\n}) };\n/**\n* `ctx.provisioned`'s refs are typed `unknown` — core forwards a provisioner's\n* ref without inspecting it. Each provider param below is the sole reader of\n* its own provisioner's output, so the shape is asserted here, once, rather\n* than checked.\n*/\nconst asKeyOutputs = (refs) => refs.map((ref) => blindCast(ref));\n/**\n* RPC's deploy-side `value(refs)` (ADR-0030): the provider stores a SET — one\n* key per inbound edge — into the accepted-keys var `serve()` reads. Paired\n* with the provisioner above: mint per edge, aggregate every edge.\n*\n* Zero consumers still emits, and that is the whole point of #100: an ABSENT\n* var means \"never provisioned\" and passes every caller through, so a deployed\n* provider nobody wired must say \"[]\" — deny everything — rather than say\n* nothing. Written as a literal because `Output.all()` with no arguments has\n* nothing to resolve.\n*/\nconst rpcAcceptedKeysValue = (refs) => refs.length > 0 ? Output.all(...asKeyOutputs(refs)) : [];\n/**\n* ADR-0031's registered provisioner for STREAMS_API_KEY — the same `ServiceKey`\n* mint, keyed PER PROVIDER instead of per edge: the resource id is the\n* provider's address, so every consumer edge of one streams module resolves to\n* the same resource and therefore the same stable value. That is what\n* `@prisma/streams-server` requires (it authenticates a single `API_KEY`), and\n* cardinality is exactly what ADR-0031 leaves to the provisioner. Making it\n* per-edge later is this id's shape plus an accepted-set provider param — no\n* new resource, no core change.\n*/\nconst streamsApiKeyProvisioner = { provision: (edge) => Effect.gen(function* () {\n\treturn (yield* Prisma.ServiceKey(`streamskey-${edge.providerAddress}`, {})).value;\n}) };\n/**\n* Streams' deploy-side `value(refs)`: ONE value, not a set —\n* `@prisma/streams-server` authenticates a single `API_KEY`, which is why the\n* provisioner above mints per provider. That pairing is the invariant this\n* param depends on, so it asserts rather than trusts it: a future per-edge\n* flip without a paired accepted-set param here would otherwise ship\n* whichever key came first and leave every other consumer 401ing, silently.\n* The refs are lazy Outputs (not comparable at serialize time); inside\n* `Output.map` they are resolved strings, the same seam RPC's set aggregates\n* on.\n*\n* Zero consumers emits NOTHING — the streams counterpart to RPC's \"[]\".\n* `@prisma/streams-server` has no deny-all mode: it either authenticates a key\n* or runs --no-auth, so there is no value here that means \"refuse everyone\".\n* Writing no key is what fails closed — the entrypoint refuses to boot with\n* a named error rather than serve unauthenticated.\n*/\nconst streamsApiKeyValue = (refs) => {\n\tif (refs.length === 0) return void 0;\n\treturn Output.map(Output.all(...asKeyOutputs(refs)), (vals) => {\n\t\tconst distinct = [...new Set(vals)];\n\t\tif (distinct.length > 1) throw new Error(`a streams provider was provisioned ${distinct.length} distinct keys across its ${refs.length} inbound bindings, but it can only be given one (@prisma/streams-server authenticates a single API_KEY). Its provisioner must mint per provider, not per edge — or this param must store an accepted-key set, once the server accepts one.`);\n\t\treturn distinct[0] ?? \"\";\n\t});\n};\n/**\n* Origin's deploy-side value function (service-derived): the provisioned\n* service's own `endpointDomain`, verbatim — `https://…`, no trailing slash,\n* no normalization. Every compute service gets this row, exposing or not.\n* The undefined guard is a deploy-time invariant check, not a policy: the\n* Management API always reports an endpoint domain post-PRO-200, so a missing\n* one means the platform predates the fix — fail the deploy loudly rather\n* than write a row origin() would trust. The raw string is JSON-encoded by\n* the descriptor's generic loop, like every other reserved provider param.\n*/\nconst selfOriginValue = (provisioned, address) => Output.map(provisioned.endpointDomain, (v) => {\n\tif (v === void 0) throw new Error(`the App for \"${address}\" reported no endpoint domain at provision — cannot resolve the service's own origin (Management API predates the PRO-200 fix?)`);\n\treturn v;\n});\n/** The user-facing state descriptor: `state: prismaState()` in `prisma-composer.config.ts` (ADR-0017). */\nconst prismaState = () => ({\n\textension: PRISMA_CLOUD_EXTENSION_ID,\n\tcreate: (container) => {\n\t\tconst { projectId, branchId, defaultBranchId } = prismaCloudContainerOf(container);\n\t\treturn prismaStateLayer({\n\t\t\tprojectId,\n\t\t\t...branchId !== void 0 ? { branchId } : {},\n\t\t\t...defaultBranchId !== void 0 ? { defaultBranchId } : {}\n\t\t});\n\t}\n});\nconst KNOWN_REGION_SET = new Set(Prisma$1.KNOWN_REGION_IDS);\nfunction isComputeRegion(value) {\n\treturn KNOWN_REGION_SET.has(value);\n}\n/** Prisma.providers()'s ProviderCollection doesn't structurally unify with Alchemy's inferred providers Layer (a @internal/lowering typings gap); it satisfies it at runtime. */\nfunction asProvidersLayer(layer) {\n\treturn layer;\n}\n/**\n* This extension's brands, each with the two halves ADR-0031 splits: the\n* PROVISIONER core resolves a mint through, and the reserved PROVIDER PARAM\n* that stores the minted values on the provider. So this file stays the only\n* place a brand is named — `descriptors/compute.ts` just looks a provider\n* param up by brand.\n*\n* `__tests__/provider-params.test.ts` asserts this map's brands are exactly\n* `PROVIDER_PARAMS`'s edge-derived brands (a service-derived param like the\n* origin mints nothing, so it has no provisioner): a brand minted here with no provider param\n* below would leave the value it mints written to consumers while no\n* provider ever stores an accepted-keys row for it — `serve()` (or the\n* equivalent runtime reader) then sees an absent var and passes every caller\n* through.\n*/\nconst PROVISIONERS = /* @__PURE__ */ new Map([[RPC_PEER_KEY, serviceKeyProvisioner], [STREAMS_API_KEY, streamsApiKeyProvisioner]]);\n/**\n* Every brand's deploy-side value function — the only per-brand thing this\n* file still holds directly. `PROVIDER_PARAMS` below is built by mapping\n* `RESERVED_PROVIDER_PARAMS` (`provider-params.ts`, the boot-side list) onto\n* this map, so a param can exist on the deploy side only if it already\n* exists on the boot side: `RESERVED_PROVIDER_PARAMS` is the single source of\n* which reserved provider params exist at all, closing the drift the old\n* name-comparison test only detected after the fact.\n*/\nconst PROVIDER_PARAM_VALUES = /* @__PURE__ */ new Map([\n\t[RPC_PEER_KEY, { value: rpcAcceptedKeysValue }],\n\t[STREAMS_API_KEY, { value: streamsApiKeyValue }],\n\t[SELF_ORIGIN, { valueForService: selfOriginValue }]\n]);\n/**\n* Builds the deploy-side registry from the boot-side list, keyed by brand —\n* throws if a boot-side entry has no registered deploy-side value function,\n* so `RESERVED_PROVIDER_PARAMS` stays the single source of which reserved\n* provider params exist: deploy can no longer write a row boot never\n* stashes. Exported (rather than inlined into `PROVIDER_PARAMS` below) so\n* `__tests__/provider-params.test.ts` can drive it directly with a\n* deliberately incomplete value map and watch it throw.\n*/\nfunction buildProviderParams(entries, values) {\n\treturn new Map(entries.map((entry) => {\n\t\tconst value = values.get(entry.brand);\n\t\tif (value === void 0) throw new Error(`prisma-cloud: reserved provider param \"${entry.name}\" (provider-params.ts) has no registered deploy-side value() in control.ts's PROVIDER_PARAM_VALUES — every param in RESERVED_PROVIDER_PARAMS must have one.`);\n\t\treturn [entry.brand, {\n\t\t\t...entry,\n\t\t\t...value\n\t\t}];\n\t}));\n}\nconst PROVIDER_PARAMS = buildProviderParams(RESERVED_PROVIDER_PARAMS, PROVIDER_PARAM_VALUES);\n/**\n* Resolves the factory's env-or-option inputs. Deliberately does NOT require\n* `PRISMA_WORKSPACE_ID`: nothing in this file reads `ResolvedCloudOptions.workspaceId`\n* downstream — it exists only so a caller MAY pin an explicit workspace, and\n* the real workspace check for a real deploy lives where the value actually\n* matters, `container.ts`'s `ensureContainer`/`locateContainer`. Region\n* validation stays eager-on-call (a garbage `PRISMA_REGION` still fails\n* loudly), but an ABSENT one resolves to `undefined` without touching\n* anything else — required for `prisma-composer dev`, which never sets\n* `PRISMA_REGION` and must not fail on its absence (local-dev spec § 5).\n*/\nfunction resolveOptions(opts) {\n\tconst workspaceId = opts.workspaceId ?? process.env[\"PRISMA_WORKSPACE_ID\"] ?? \"\";\n\tif (opts.region !== void 0) return {\n\t\tworkspaceId,\n\t\tregion: opts.region,\n\t\tproviderParams: PROVIDER_PARAMS\n\t};\n\tconst region = process.env[\"PRISMA_REGION\"];\n\tif (region === void 0 || region.length === 0) return {\n\t\tworkspaceId,\n\t\tproviderParams: PROVIDER_PARAMS\n\t};\n\tif (!isComputeRegion(region)) throw new Error(`prismaCloud(): environment variable PRISMA_REGION=\"${region}\" is not a known region (expected one of: ${Prisma$1.KNOWN_REGION_IDS.join(\", \")}).`);\n\treturn {\n\t\tworkspaceId,\n\t\tregion,\n\t\tproviderParams: PROVIDER_PARAMS\n\t};\n}\n/**\n* A memoized thunk over `resolveOptions` — evaluated at FIRST LOWERING USE\n* (inside a node descriptor's `provision`/`serialize`), never at `prismaCloud()`\n* construction. The node descriptors take this thunk, not a resolved value\n* (local-dev spec § 5): `prismaCloud()` itself must construct with no\n* environment present, since it also builds the `localTarget` descriptor, which must\n* never require `PRISMA_WORKSPACE_ID`/`PRISMA_REGION`/`PRISMA_SERVICE_TOKEN`.\n*/\nfunction lazyOptions(opts, pointerUpdatedAt) {\n\tlet cached;\n\treturn () => {\n\t\tcached ??= {\n\t\t\t...resolveOptions(opts),\n\t\t\tpointerUpdatedAt\n\t\t};\n\t\treturn cached;\n\t};\n}\n/** The Prisma Cloud extension descriptor — `prisma-composer.config.ts` lists it under `extensions`. */\nconst prismaCloud = (opts = {}) => {\n\tconst preflightTimestamps = /* @__PURE__ */ new Map();\n\tconst o = lazyOptions(opts, pointerUpdatedAtLookup(preflightTimestamps, process.env));\n\treturn {\n\t\tid: PRISMA_CLOUD_EXTENSION_ID,\n\t\tcontainer: containerDescriptor(),\n\t\tproviders: () => asProvidersLayer(Layer.mergeAll(Prisma.providers(), PgWarmProvider(), OrmMigrationProvider(), S3CredentialsProvider(), GeneratedParamProvider(), Prisma.ServiceKeyProvider())),\n\t\tpreflight: (input) => runPreflight(input).then((timestamps) => {\n\t\t\tfor (const [name, updatedAt] of timestamps) preflightTimestamps.set(name, updatedAt);\n\t\t\treturn serializePointerUpdatedAt(timestamps);\n\t\t}),\n\t\treporter: prismaCloudReporter(),\n\t\tapplication: { provision: (ctx) => Effect.gen(function* () {\n\t\t\tconst { projectId, branchId, defaultBranchId, branchless } = prismaCloudContainerOf(ctx.container);\n\t\t\tyield* Prisma.claimDatabaseUrlKeys(projectId);\n\t\t\treturn {\n\t\t\t\tprojectId,\n\t\t\t\tbranchId,\n\t\t\t\tdefaultBranchId,\n\t\t\t\tbranchless\n\t\t\t};\n\t\t}) },\n\t\tprovisions: PROVISIONERS,\n\t\tnodes: {\n\t\t\t\"raw-postgres\": rawPostgresDescriptor(o),\n\t\t\tpostgres: postgresDescriptor(o),\n\t\t\tcompute: computeDescriptor(o),\n\t\t\tcredentials: s3CredentialsDescriptor(o),\n\t\t\t\"s3-store\": s3StoreDescriptor(o),\n\t\t\ts3: bucketDescriptor(o)\n\t\t},\n\t\tlocalTarget: () => import(\"@prisma/composer-prisma-cloud/local-target\").then((m) => m.localTargetDescriptor())\n\t};\n};\n//#endregion\nexport { PROVIDER_PARAMS, buildProviderParams, prismaCloud, prismaState };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,wBAAwB;AAC9B,MAAM,mBAAmB;;AAEzB,SAAS,aAAa,WAAW,OAAO;CACvC,IAAI,UAAU,KAAK,GAAG,OAAO;CAC7B,MAAM,QAAQA,KAAG,YAAY,SAAS,CAAC,CAAC,MAAM,MAAM,eAAe,KAAK,CAAC,CAAC;CAC1E,IAAI,UAAU,KAAK,GAAG,MAAM,IAAI,MAAM,2CAA2C,WAAW;CAC5F,OAAO;AACR;AACA,SAAS,oBAAoB,MAAM,OAAO;CACzC,OAAO,OAAO,QAAQ,OAAO,KAAK,KAAK,SAAS,MAAM,GAAG,OAAO,KAAK,MAAM,SAAS,MAAM,CAAC;AAC5F;;;;;;AAMA,SAAS,YAAY,KAAK;CACzB,MAAM,MAAM,CAAC;CACb,MAAM,WAAWA,KAAG,aAAa,GAAG;CACpC,MAAM,SAAS,QAAQ;EACtB,KAAK,MAAM,SAASA,KAAG,YAAYC,OAAK,KAAK,KA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