@prisma/composer-prisma-cloud 0.2.0 → 0.3.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.
Files changed (101) hide show
  1. package/dist/buckets-main.mjs +795 -0
  2. package/dist/buckets-main.mjs.map +1 -0
  3. package/dist/compute-main.mjs +559 -0
  4. package/dist/compute-main.mjs.map +1 -0
  5. package/dist/control.d.mts +34 -5
  6. package/dist/control.d.mts.map +1 -0
  7. package/dist/control.mjs +98 -1280
  8. package/dist/control.mjs.map +1 -1
  9. package/dist/cron/index.d.mts +54 -4
  10. package/dist/cron/index.d.mts.map +1 -0
  11. package/dist/cron/index.mjs +145 -42
  12. package/dist/cron/index.mjs.map +1 -1
  13. package/dist/cron/scheduler-entrypoint.mjs +637 -529
  14. package/dist/cron/scheduler-entrypoint.mjs.map +1 -1
  15. package/dist/cron/scheduler-service.mjs +145 -42
  16. package/dist/cron/scheduler-service.mjs.map +1 -1
  17. package/dist/email/email-entrypoint.mjs +19738 -0
  18. package/dist/email/email-entrypoint.mjs.map +1 -0
  19. package/dist/email/email-service.mjs +565 -0
  20. package/dist/email/email-service.mjs.map +1 -0
  21. package/dist/email/index.d.mts +282 -0
  22. package/dist/email/index.d.mts.map +1 -0
  23. package/dist/email/index.mjs +652 -0
  24. package/dist/email/index.mjs.map +1 -0
  25. package/dist/email/testing.d.mts +22 -0
  26. package/dist/email/testing.d.mts.map +1 -0
  27. package/dist/email/testing.mjs +1321 -0
  28. package/dist/email/testing.mjs.map +1 -0
  29. package/dist/get-port-BYnpbW5H.mjs +111 -0
  30. package/dist/get-port-BYnpbW5H.mjs.map +1 -0
  31. package/dist/index.d.mts +37 -6
  32. package/dist/index.d.mts.map +1 -0
  33. package/dist/index.mjs +70 -45
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/local-target.d.mts +12 -0
  36. package/dist/local-target.d.mts.map +1 -0
  37. package/dist/local-target.mjs +6185 -0
  38. package/dist/local-target.mjs.map +1 -0
  39. package/dist/param-BTzY0ne5-CW6ojZ3E.mjs +66 -0
  40. package/dist/param-BTzY0ne5-CW6ojZ3E.mjs.map +1 -0
  41. package/dist/pg-connection-CadPZuEK-CF3FsSQu.mjs +79 -0
  42. package/dist/pg-connection-CadPZuEK-CF3FsSQu.mjs.map +1 -0
  43. package/dist/postgres-main.mjs +602 -0
  44. package/dist/postgres-main.mjs.map +1 -0
  45. package/dist/preflight-names-BPL-qsZF-BfoRgbgb.mjs +1252 -0
  46. package/dist/preflight-names-BPL-qsZF-BfoRgbgb.mjs.map +1 -0
  47. package/dist/{prisma-next-DlU01kXJ-2sP5mQb6.mjs → prisma-next-BvBwGCIt-DssgnctU.mjs} +21 -80
  48. package/dist/prisma-next-BvBwGCIt-DssgnctU.mjs.map +1 -0
  49. package/dist/prisma-next.d.mts +14 -5
  50. package/dist/prisma-next.d.mts.map +1 -0
  51. package/dist/prisma-next.mjs +1 -1
  52. package/dist/provisioned-edges-C1wSO3cx-YC5C19f9.mjs +151 -0
  53. package/dist/provisioned-edges-C1wSO3cx-YC5C19f9.mjs.map +1 -0
  54. package/dist/secret-rz_ZqNeq-_xd97Jd9.mjs +47 -0
  55. package/dist/secret-rz_ZqNeq-_xd97Jd9.mjs.map +1 -0
  56. package/dist/segments-NpKN-46R-C_LQ2urs.mjs +1454 -0
  57. package/dist/segments-NpKN-46R-C_LQ2urs.mjs.map +1 -0
  58. package/dist/{serializer-CX4VYdf_-KKGoAxfx.mjs → serializer-CJiOhF2d-DJUjQj1i.mjs} +34 -44
  59. package/dist/serializer-CJiOhF2d-DJUjQj1i.mjs.map +1 -0
  60. package/dist/serializer-Cx5slrV4-xJfH6EWS.d.mts.map +1 -0
  61. package/dist/storage/index.d.mts +52 -5
  62. package/dist/storage/index.d.mts.map +1 -0
  63. package/dist/storage/index.mjs +158 -47
  64. package/dist/storage/index.mjs.map +1 -1
  65. package/dist/storage/storage-entrypoint.mjs +370 -271
  66. package/dist/storage/storage-entrypoint.mjs.map +1 -1
  67. package/dist/storage/storage-service.mjs +158 -47
  68. package/dist/storage/storage-service.mjs.map +1 -1
  69. package/dist/storage/testing.d.mts +7 -6
  70. package/dist/storage/testing.d.mts.map +1 -0
  71. package/dist/storage/testing.mjs +4 -21
  72. package/dist/storage/testing.mjs.map +1 -1
  73. package/dist/streams/index.d.mts +56 -84
  74. package/dist/streams/index.d.mts.map +1 -0
  75. package/dist/streams/index.mjs +158 -47
  76. package/dist/streams/index.mjs.map +1 -1
  77. package/dist/streams/streams-entrypoint.mjs +366 -250
  78. package/dist/streams/streams-entrypoint.mjs.map +1 -1
  79. package/dist/streams/streams-service.mjs +158 -47
  80. package/dist/streams/streams-service.mjs.map +1 -1
  81. package/dist/streams/testing.d.mts.map +1 -0
  82. package/dist/testing.d.mts.map +1 -0
  83. package/dist/testing.mjs +1 -1
  84. package/dist/testing.mjs.map +1 -1
  85. package/package.json +34 -20
  86. package/src/exports/control.ts +1 -0
  87. package/src/exports/cron.ts +1 -0
  88. package/src/exports/email-testing.ts +1 -0
  89. package/src/exports/email.ts +1 -0
  90. package/src/exports/index.ts +1 -0
  91. package/src/exports/local-target.ts +1 -0
  92. package/src/exports/prisma-next.ts +1 -0
  93. package/src/exports/storage-testing.ts +1 -0
  94. package/src/exports/storage.ts +1 -0
  95. package/src/exports/streams-testing.ts +1 -0
  96. package/src/exports/streams.ts +1 -0
  97. package/src/exports/testing.ts +1 -0
  98. package/dist/prisma-next-DlU01kXJ-2sP5mQb6.mjs.map +0 -1
  99. package/dist/provisioned-edges-DIQAR4q4-Bn9op-JG.mjs +0 -151
  100. package/dist/provisioned-edges-DIQAR4q4-Bn9op-JG.mjs.map +0 -1
  101. package/dist/serializer-CX4VYdf_-KKGoAxfx.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"control.mjs","names":["Config","attempt","managementClientLayer","Prisma.Bucket","Prisma.BucketKey","Prisma.ComputeService","Prisma.EnvironmentVariable","Prisma.packageComputeArtifact","Prisma.Deployment","Prisma.Database","Prisma.Connection","Prisma.ServiceKey","Prisma.COMPUTE_REGIONS","Prisma.providers","Prisma.ServiceKeyProvider"],"sources":["../../../1-prisma-cloud/0-lowering/lowering/dist/http-CJM0E6rj.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/buckets.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/compute.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/postgres.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/index.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/state.mjs","../../../1-prisma-cloud/1-extensions/target/dist/control.mjs"],"sourcesContent":["import { createManagementApiClient } from \"@prisma/management-api-sdk\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as Config from \"effect/Config\";\nimport * as Data from \"effect/Data\";\n//#region src/credentials.ts\n/**\n* The Prisma service token used to authenticate Management API calls. Kept\n* as a Redacted value so it never lands in logs or error output.\n*/\nvar PrismaCredentials = class extends Context.Service()(\"PrismaCredentials\") {};\n/** Resolve the token from the `PRISMA_SERVICE_TOKEN` environment variable. */\nconst fromEnv = () => Layer.effect(PrismaCredentials, Effect.gen(function* () {\n\treturn { token: yield* Config.redacted(\"PRISMA_SERVICE_TOKEN\") };\n}));\n//#endregion\n//#region src/client.ts\n/**\n* The typed Prisma Management API client, built once from the resolved\n* credentials. Providers yield this in their outer Effect and call it inside\n* `reconcile` / `delete`.\n*/\nvar ManagementClient = class extends Context.Service()(\"PrismaManagementClient\") {};\nconst layer = () => Layer.effect(ManagementClient, Effect.gen(function* () {\n\tconst { token } = yield* PrismaCredentials;\n\treturn createManagementApiClient({ token: Redacted.value(token) });\n}));\n//#endregion\n//#region src/http.ts\n/** A non-2xx response from the Management API (or a transport failure). */\nvar PrismaApiError = class extends Data.TaggedError(\"PrismaApiError\") {};\nconst attempt = (f) => Effect.tryPromise({\n\ttry: f,\n\tcatch: (cause) => new PrismaApiError({\n\t\tstatus: 0,\n\t\tmessage: String(cause)\n\t})\n});\nconst fail = (r) => Effect.fail(new PrismaApiError({\n\tstatus: r.response.status,\n\tmessage: JSON.stringify(r.error)\n}));\n/** Unwrap `data`, failing on any API error. Preserves the SDK's response type. */\nconst call = (f) => attempt(f).pipe(Effect.flatMap((r) => r.error !== void 0 || r.data === void 0 ? fail(r) : Effect.succeed(r.data)));\n/** Unwrap `data`, mapping a 404 to `undefined` (resource gone / not found). */\nconst callOptional = (f) => attempt(f).pipe(Effect.flatMap((r) => r.response.status === 404 ? Effect.succeed(void 0) : r.error !== void 0 ? fail(r) : Effect.succeed(r.data)));\n/** Fire-and-forget a call, tolerating a 404 (already deleted). */\nconst callVoid = (f) => attempt(f).pipe(Effect.flatMap((r) => r.response.status === 404 || r.error === void 0 ? Effect.void : fail(r)));\n//#endregion\nexport { ManagementClient as a, fromEnv as c, callVoid as i, call as n, layer as o, callOptional as r, PrismaCredentials as s, PrismaApiError as t };\n\n//# sourceMappingURL=http-CJM0E6rj.mjs.map","import { a as ManagementClient, i as callVoid, n as call, r as callOptional } from \"./http-CJM0E6rj.mjs\";\nimport * as Effect from \"effect/Effect\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as Provider from \"alchemy/Provider\";\nimport { Resource } from \"alchemy\";\n//#region src/buckets/Bucket.ts\n/** A Prisma **Object Store bucket** inside a project. */\nconst Bucket = Resource(\"Prisma.Bucket\");\nconst BucketProvider = () => Provider.effect(Bucket, Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\treturn {\n\t\tstables: [\"id\"],\n\t\tlist: () => Effect.succeed([]),\n\t\treconcile: Effect.fn(function* ({ news, output }) {\n\t\t\tconst observed = output?.id ? yield* callOptional(() => client.GET(\"/v1/buckets/{bucketId}\", { params: { path: { bucketId: output.id } } })) : void 0;\n\t\t\tif (observed) return {\n\t\t\t\tid: observed.data.id,\n\t\t\t\tname: observed.data.name\n\t\t\t};\n\t\t\tconst created = yield* call(() => client.POST(\"/v1/buckets\", { body: {\n\t\t\t\tprojectId: news.projectId,\n\t\t\t\tname: news.name,\n\t\t\t\t...news.branchId !== void 0 ? { branchId: news.branchId } : {}\n\t\t\t} }));\n\t\t\treturn {\n\t\t\t\tid: created.data.id,\n\t\t\t\tname: created.data.name\n\t\t\t};\n\t\t}),\n\t\tdelete: Effect.fn(function* ({ output }) {\n\t\t\tyield* callVoid(() => client.DELETE(\"/v1/buckets/{bucketId}\", { params: { path: { bucketId: output.id } } }));\n\t\t}),\n\t\tread: Effect.fn(function* ({ output }) {\n\t\t\tif (!output?.id) return void 0;\n\t\t\tconst b = yield* callOptional(() => client.GET(\"/v1/buckets/{bucketId}\", { params: { path: { bucketId: output.id } } }));\n\t\t\treturn b ? {\n\t\t\t\tid: b.data.id,\n\t\t\t\tname: b.data.name\n\t\t\t} : void 0;\n\t\t})\n\t};\n}));\n//#endregion\n//#region src/buckets/BucketKey.ts\n/** A **bucket access key** for a Prisma Object Store bucket — yields the S3 credentials. */\nconst BucketKey = Resource(\"Prisma.BucketKey\");\nconst BucketKeyProvider = () => Provider.effect(BucketKey, Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\treturn {\n\t\tstables: [\n\t\t\t\"id\",\n\t\t\t\"bucketId\",\n\t\t\t\"secretAccessKey\",\n\t\t\t\"accessKeyId\",\n\t\t\t\"endpoint\",\n\t\t\t\"bucketName\"\n\t\t],\n\t\tlist: () => Effect.succeed([]),\n\t\treconcile: Effect.fn(function* ({ news, output }) {\n\t\t\tif (output?.id) return output;\n\t\t\tconst created = yield* call(() => client.POST(\"/v1/buckets/{bucketId}/keys\", {\n\t\t\t\tparams: { path: { bucketId: news.bucketId } },\n\t\t\t\tbody: {\n\t\t\t\t\tname: news.name,\n\t\t\t\t\trole: news.role\n\t\t\t\t}\n\t\t\t}));\n\t\t\treturn {\n\t\t\t\tid: created.data.id,\n\t\t\t\tbucketId: news.bucketId,\n\t\t\t\taccessKeyId: created.data.accessKeyId,\n\t\t\t\tsecretAccessKey: Redacted.make(created.data.secretAccessKey),\n\t\t\t\tendpoint: created.data.endpoint,\n\t\t\t\tbucketName: created.data.bucketName\n\t\t\t};\n\t\t}),\n\t\tdelete: Effect.fn(function* ({ output }) {\n\t\t\tyield* callVoid(() => client.DELETE(\"/v1/buckets/{bucketId}/keys/{keyId}\", { params: { path: {\n\t\t\t\tbucketId: output.bucketId,\n\t\t\t\tkeyId: output.id\n\t\t\t} } }));\n\t\t})\n\t};\n}));\n//#endregion\nexport { Bucket, BucketKey, BucketKeyProvider, BucketProvider };\n\n//# sourceMappingURL=buckets.mjs.map","import { a as ManagementClient, i as callVoid, n as call, r as callOptional, t as PrismaApiError } from \"./http-CJM0E6rj.mjs\";\nimport * as Effect from \"effect/Effect\";\nimport * as Provider from \"alchemy/Provider\";\nimport { Resource } from \"alchemy\";\nimport * as Schedule from \"effect/Schedule\";\nimport * as fs from \"node:fs\";\nimport * as crypto$1 from \"node:crypto\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport * as zlib from \"node:zlib\";\n//#region src/compute/ComputeService.ts\n/**\n* Stopping a deployment before the app that owns it can be\n* deleted is asynchronous on the platform's side: DELETE can 409 with this\n* message while the deployment is still winding down. Retrying blindly on\n* every API error would mask real failures (bad auth, a genuinely conflicting\n* state, etc.), so this only matches the platform's specific \"not delete-safe\n* yet\" wording — everything else fails immediately, as before.\n*/\nconst isDeleteNotSafeYet = (error) => error.message.includes(\"did not reach a delete-safe state\");\n/**\n* Backs off exponentially from 2s, capped at 5 minutes total — long enough\n* for the platform to finish stopping the deployment, short enough to still\n* fail loudly (rather than hang forever) if it never does.\n*/\nconst deleteSafeRetrySchedule = Schedule.both(Schedule.exponential(\"2 seconds\", 2), Schedule.during(\"5 minutes\"));\n/** Every region Prisma Compute serves — the runtime source of truth; `ComputeRegion` is derived from it so the two can never drift. */\nconst COMPUTE_REGIONS = [\n\t\"us-east-1\",\n\t\"us-west-1\",\n\t\"eu-west-3\",\n\t\"eu-central-1\",\n\t\"ap-northeast-1\",\n\t\"ap-southeast-1\"\n];\n/** A Prisma **Compute service** — the stable app identity behind a project. */\nconst ComputeService = Resource(\"Prisma.ComputeService\");\nconst ComputeServiceProvider = () => Provider.effect(ComputeService, Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\treturn {\n\t\tstables: [\"id\"],\n\t\tlist: () => Effect.succeed([]),\n\t\treconcile: Effect.fn(function* ({ news, output }) {\n\t\t\tconst observed = output?.id ? yield* callOptional(() => client.GET(\"/v1/apps/{appId}\", { params: { path: { appId: output.id } } })) : void 0;\n\t\t\tif (observed) return {\n\t\t\t\tid: observed.data.id,\n\t\t\t\tname: observed.data.name,\n\t\t\t\tendpointDomain: observed.data.appEndpointDomain\n\t\t\t};\n\t\t\tconst created = yield* call(() => client.POST(\"/v1/apps\", { body: {\n\t\t\t\tdisplayName: news.name,\n\t\t\t\tprojectId: news.projectId,\n\t\t\t\t...news.region && { regionId: news.region },\n\t\t\t\t...news.branchId !== void 0 && { branchId: news.branchId }\n\t\t\t} }));\n\t\t\treturn {\n\t\t\t\tid: created.data.id,\n\t\t\t\tname: created.data.name,\n\t\t\t\tendpointDomain: created.data.appEndpointDomain\n\t\t\t};\n\t\t}),\n\t\tdelete: Effect.fn(function* ({ output }) {\n\t\t\tyield* callVoid(() => client.DELETE(\"/v1/apps/{appId}\", { params: { path: { appId: output.id } } })).pipe(Effect.retry({\n\t\t\t\tschedule: deleteSafeRetrySchedule,\n\t\t\t\twhile: isDeleteNotSafeYet\n\t\t\t}));\n\t\t}),\n\t\tread: Effect.fn(function* ({ output }) {\n\t\t\tif (!output?.id) return void 0;\n\t\t\tconst s = yield* callOptional(() => client.GET(\"/v1/apps/{appId}\", { params: { path: { appId: output.id } } }));\n\t\t\treturn s ? {\n\t\t\t\tid: s.data.id,\n\t\t\t\tname: s.data.name,\n\t\t\t\tendpointDomain: s.data.appEndpointDomain\n\t\t\t} : void 0;\n\t\t})\n\t};\n}));\n//#endregion\n//#region src/compute/Deployment.ts\n/**\n* A **deployment** of a Prisma app — creates a deployment, uploads\n* its artifact, starts the VM, waits for it to run, then promotes it to the\n* app's stable endpoint.\n*/\nconst Deployment = Resource(\"Prisma.Deployment\");\nconst DeploymentProvider = () => Provider.effect(Deployment, Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\tconst waitForRunning = (deploymentId) => call(() => client.GET(\"/v1/deployments/{deploymentId}\", { params: { path: { deploymentId } } })).pipe(Effect.flatMap((v) => v.data.status === \"running\" ? Effect.void : Effect.fail(new PrismaApiError({\n\t\tstatus: 409,\n\t\tmessage: `deployment ${deploymentId} is ${v.data.status}, not running`\n\t}))), Effect.retry(Schedule.both(Schedule.spaced(\"2 seconds\"), Schedule.during(\"2 minutes\"))));\n\treturn {\n\t\tstables: [],\n\t\tlist: () => Effect.succeed([]),\n\t\treconcile: Effect.fn(function* ({ news }) {\n\t\t\tconst created = yield* call(() => client.POST(\"/v1/apps/{appId}/deployments\", {\n\t\t\t\tparams: { path: { appId: news.computeServiceId } },\n\t\t\t\tbody: news.port !== void 0 ? { portMapping: { http: news.port } } : {}\n\t\t\t}));\n\t\t\tconst deploymentId = created.data.id;\n\t\t\tif (created.data.uploadUrl) {\n\t\t\t\tconst uploadUrl = created.data.uploadUrl;\n\t\t\t\tconst artifact = yield* Effect.try({\n\t\t\t\t\ttry: () => fs.readFileSync(news.artifactPath),\n\t\t\t\t\tcatch: (cause) => new PrismaApiError({\n\t\t\t\t\t\tstatus: 0,\n\t\t\t\t\t\tmessage: `failed to read artifact ${news.artifactPath}: ${String(cause)}`\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t\tyield* Effect.tryPromise({\n\t\t\t\t\ttry: async () => {\n\t\t\t\t\t\tconst res = await fetch(uploadUrl, {\n\t\t\t\t\t\t\tmethod: \"PUT\",\n\t\t\t\t\t\t\tbody: artifact\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (!res.ok) throw new PrismaApiError({\n\t\t\t\t\t\t\tstatus: res.status,\n\t\t\t\t\t\t\tmessage: `artifact upload failed: ${res.status} ${res.statusText}`\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\tcatch: (cause) => cause instanceof PrismaApiError ? cause : new PrismaApiError({\n\t\t\t\t\t\tstatus: 0,\n\t\t\t\t\t\tmessage: String(cause)\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t}\n\t\t\tyield* call(() => client.POST(\"/v1/deployments/{deploymentId}/start\", { params: { path: { deploymentId } } }));\n\t\t\tyield* waitForRunning(deploymentId);\n\t\t\tconst deployedUrl = (yield* call(() => client.POST(\"/v1/apps/{appId}/promote\", {\n\t\t\t\tparams: { path: { appId: news.computeServiceId } },\n\t\t\t\tbody: { deploymentId }\n\t\t\t}))).data.appEndpointDomain;\n\t\t\treturn {\n\t\t\t\tdeploymentId,\n\t\t\t\t...deployedUrl !== void 0 && { deployedUrl }\n\t\t\t};\n\t\t}),\n\t\tdelete: Effect.fn(function* () {}),\n\t\tread: Effect.fn(function* ({ output }) {\n\t\t\tif (!output?.deploymentId) return void 0;\n\t\t\tconst v = yield* callOptional(() => client.GET(\"/v1/deployments/{deploymentId}\", { params: { path: { deploymentId: output.deploymentId } } }));\n\t\t\treturn v ? {\n\t\t\t\tdeploymentId: v.data.id,\n\t\t\t\t...v.data.previewDomain && { deployedUrl: v.data.previewDomain }\n\t\t\t} : void 0;\n\t\t})\n\t};\n}));\n//#endregion\n//#region src/compute/EnvironmentVariable.ts\n/**\n* A project-scoped **environment variable** that Compute injects into the\n* project's services from their attached branch (e.g. wiring one module's URL into\n* another).\n*/\nconst EnvironmentVariable = Resource(\"Prisma.EnvironmentVariable\");\nconst EnvironmentVariableProvider = () => Provider.effect(EnvironmentVariable, Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\treturn {\n\t\tstables: [\"id\"],\n\t\tlist: () => Effect.succeed([]),\n\t\treconcile: Effect.fn(function* ({ news, output }) {\n\t\t\tconst cls = news.class ?? \"production\";\n\t\t\tlet id = output?.id;\n\t\t\tif (id !== void 0) {\n\t\t\t\tconst priorId = id;\n\t\t\t\tif (!(yield* callOptional(() => client.GET(\"/v1/environment-variables/{envVarId}\", { params: { path: { envVarId: priorId } } })))) id = void 0;\n\t\t\t}\n\t\t\tif (id === void 0) {\n\t\t\t\tconst matchId = (yield* call(() => client.GET(\"/v1/environment-variables\", { params: { query: {\n\t\t\t\t\tprojectId: news.projectId,\n\t\t\t\t\tclass: cls,\n\t\t\t\t\tkey: news.key\n\t\t\t\t} } }))).data?.[0]?.id;\n\t\t\t\tif (matchId !== void 0) {\n\t\t\t\t\tif (!(news.key === \"DATABASE_URL\" || news.key === \"DATABASE_URL_POOLED\")) throw new Error(`EnvironmentVariable \"${news.key}\" (project \"${news.projectId}\", class \"${cls}\") exists but is untracked in this deploy state — refusing to overwrite a reserved COMPOSER_ key. Restore this deploy's hosted state, or remove the variable to let this deploy recreate it.`);\n\t\t\t\t\tid = matchId;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (id !== void 0) {\n\t\t\t\tconst targetId = id;\n\t\t\t\tyield* call(() => client.PATCH(\"/v1/environment-variables/{envVarId}\", {\n\t\t\t\t\tparams: { path: { envVarId: targetId } },\n\t\t\t\t\tbody: { value: news.value }\n\t\t\t\t}));\n\t\t\t\treturn {\n\t\t\t\t\tid,\n\t\t\t\t\tkey: news.key\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst created = yield* call(() => client.POST(\"/v1/environment-variables\", { body: {\n\t\t\t\tprojectId: news.projectId,\n\t\t\t\tclass: cls,\n\t\t\t\tkey: news.key,\n\t\t\t\tvalue: news.value,\n\t\t\t\t...news.branchId ? { branchId: news.branchId } : {}\n\t\t\t} }));\n\t\t\treturn {\n\t\t\t\tid: created.data.id,\n\t\t\t\tkey: created.data.key\n\t\t\t};\n\t\t}),\n\t\tdelete: Effect.fn(function* ({ output }) {\n\t\t\tyield* callVoid(() => client.DELETE(\"/v1/environment-variables/{envVarId}\", { params: { path: { envVarId: output.id } } }));\n\t\t}),\n\t\tread: Effect.fn(function* ({ output }) {\n\t\t\tif (!output?.id) return void 0;\n\t\t\tconst v = yield* callOptional(() => client.GET(\"/v1/environment-variables/{envVarId}\", { params: { path: { envVarId: output.id } } }));\n\t\t\treturn v ? {\n\t\t\t\tid: v.data.id,\n\t\t\t\tkey: v.data.key\n\t\t\t} : void 0;\n\t\t})\n\t};\n}));\n//#endregion\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*/\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}\n/** All files under `dir`, as dir-relative POSIX paths, in sorted order. A\n* symlink is a hard error: deploy bundles must be flat (ADR-0005), and the\n* user's build owns flattening — dereferencing here would relink the tree and\n* risk packaging files from outside it. */\nfunction walkFiles(dir) {\n\tconst out = [];\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()) throw new Error(`bundle contains a symlink at ${rel} — deploy bundles must be flat; materialize links in your build (e.g. cp -RL) so the tree is self-contained.`);\n\t\t\tif (entry.isDirectory()) visit(rel);\n\t\t\telse out.push(rel);\n\t\t}\n\t};\n\tvisit(\"\");\n\treturn out.sort();\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 ustarHeader(relPath, size) {\n\tconst { name, prefix } = splitUstarPath(relPath);\n\tconst buf = Buffer.alloc(512);\n\tbuf.write(name, 0, 100, \"utf8\");\n\tbuf.write(octal(420, 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(\"0\", 156, 1, \"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((a, b) => a.relPath.localeCompare(b.relPath));\n\tconst chunks = [];\n\tfor (const entry of sorted) {\n\t\tchunks.push(ustarHeader(entry.relPath, entry.content.length));\n\t\tchunks.push(entry.content);\n\t\tconst pad = (512 - entry.content.length % 512) % 512;\n\t\tif (pad > 0) chunks.push(Buffer.alloc(pad));\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 bootstrap = `import main from \"./${resolveEntry(opts.bundleDir, opts.bundleEntry)}\";\\nawait main.run(${JSON.stringify(opts.address)}, () => import(${JSON.stringify(`./${opts.appEntry}`)}));\\n`;\n\tconst manifest = `${JSON.stringify({\n\t\tmanifestVersion: MANIFEST_VERSION,\n\t\tentrypoint: \"bootstrap.js\"\n\t}, null, 2)}\\n`;\n\tconst files = walkFiles(opts.bundleDir).map((relPath) => ({\n\t\trelPath,\n\t\tcontent: fs.readFileSync(path.join(opts.bundleDir, relPath))\n\t}));\n\tfiles.push({\n\t\trelPath: \"bootstrap.js\",\n\t\tcontent: Buffer.from(bootstrap, \"utf8\")\n\t});\n\tfiles.push({\n\t\trelPath: \"compute.manifest.json\",\n\t\tcontent: Buffer.from(manifest, \"utf8\")\n\t});\n\tfiles.push({\n\t\trelPath: \"bunfig.toml\",\n\t\tcontent: Buffer.from(\"[install]\\nauto = \\\"disable\\\"\\n\", \"utf8\")\n\t});\n\tconst gz = createDeterministicTarGz(files);\n\tconst sha256 = crypto$1.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$1.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\n//#region src/compute/ServiceKey.ts\n/**\n* The `ServiceKey` Alchemy resource (ADR-0030) — mints a random 256-bit key\n* ONCE at create and keeps it STABLE across deploys, so an unchanged edge\n* no-ops on redeploy. Same mint-once-stable lifecycle as `S3Credentials`\n* (`packages/1-prisma-cloud/1-extensions/target/src/s3-credentials-resource.ts`):\n* Web Crypto only (`crypto.getRandomValues` — no `node:` import), persisted in\n* Alchemy state; on every later apply the provider returns the persisted\n* attributes (`reconcile`'s `output`) unchanged. One resource per RPC edge;\n* rotation is destroy/recreate.\n*/\n/** The `ServiceKey` resource constructor — `yield* Prisma.ServiceKey(id, {})` in the lowering. */\nconst ServiceKey = Resource(\"PrismaCloud.ServiceKey\");\n/** A fresh 256-bit key as 64 lowercase hex chars (Web Crypto — no node import). */\nfunction mintServiceKey() {\n\tconst bytes = crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(32));\n\treturn { value: Array.from(bytes, (b) => b.toString(16).padStart(2, \"0\")).join(\"\") };\n}\n/**\n* The `ServiceKey` provider service. `reconcile` runs for create and update;\n* it returns the persisted `output` when present (a redeploy reuses the\n* stored key — the no-op property) and mints a fresh key only on first\n* create. Nothing to enumerate (`list` → `[]`) or tear down (`delete` →\n* no-op; the key lives only in state).\n*/\nconst serviceKeyProviderService = {\n\tlist: () => Effect.succeed([]),\n\treconcile: ({ output }) => Effect.sync(() => output ?? mintServiceKey()),\n\tdelete: () => Effect.void\n};\n/** The `ServiceKey` provider layer — merged into the Prisma Cloud extension's `providers()`. */\nconst ServiceKeyProvider = () => Provider.effect(ServiceKey, Effect.succeed(serviceKeyProviderService));\n//#endregion\nexport { COMPUTE_REGIONS, ComputeService, ComputeServiceProvider, Deployment, DeploymentProvider, EnvironmentVariable, EnvironmentVariableProvider, ServiceKey, ServiceKeyProvider, deleteSafeRetrySchedule, isDeleteNotSafeYet, mintServiceKey, packageComputeArtifact, serviceKeyProviderService };\n\n//# sourceMappingURL=compute.mjs.map","import { a as ManagementClient, i as callVoid, n as call, r as callOptional, t as PrismaApiError } from \"./http-CJM0E6rj.mjs\";\nimport * as Effect from \"effect/Effect\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as Provider from \"alchemy/Provider\";\nimport { Resource } from \"alchemy\";\n//#region src/postgres/Connection.ts\n/** A **connection** to a Prisma Postgres database — yields the connection string. */\nconst Connection = Resource(\"Prisma.Connection\");\nconst ConnectionProvider = () => Provider.effect(Connection, Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\treturn {\n\t\tstables: [\"id\", \"connectionString\"],\n\t\tlist: () => Effect.succeed([]),\n\t\treconcile: Effect.fn(function* ({ news, output }) {\n\t\t\tif (output?.id) return output;\n\t\t\tconst created = yield* call(() => client.POST(\"/v1/databases/{databaseId}/connections\", {\n\t\t\t\tparams: { path: { databaseId: news.databaseId } },\n\t\t\t\tbody: { name: news.name }\n\t\t\t}));\n\t\t\tconst endpoints = created.data.endpoints;\n\t\t\tconst dsn = endpoints?.direct?.connectionString ?? endpoints?.pooled?.connectionString;\n\t\t\tif (dsn === void 0) return yield* Effect.fail(new PrismaApiError({\n\t\t\t\tstatus: 0,\n\t\t\t\tmessage: `connection ${created.data.id} returned no direct/pooled connection string`\n\t\t\t}));\n\t\t\treturn {\n\t\t\t\tid: created.data.id,\n\t\t\t\tconnectionString: Redacted.make(dsn)\n\t\t\t};\n\t\t}),\n\t\tdelete: Effect.fn(function* ({ output }) {\n\t\t\tyield* callVoid(() => client.DELETE(\"/v1/connections/{id}\", { params: { path: { id: output.id } } }));\n\t\t})\n\t};\n}));\n//#endregion\n//#region src/postgres/Database.ts\n/** A Prisma **Postgres database** inside a project. */\nconst Database = Resource(\"Prisma.Database\");\nconst DatabaseProvider = () => Provider.effect(Database, Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\treturn {\n\t\tstables: [\"id\"],\n\t\tlist: () => Effect.succeed([]),\n\t\treconcile: Effect.fn(function* ({ news, output }) {\n\t\t\tconst observed = output?.id ? yield* callOptional(() => client.GET(\"/v1/databases/{databaseId}\", { params: { path: { databaseId: output.id } } })) : void 0;\n\t\t\tif (!observed) {\n\t\t\t\tconst created = yield* call(() => client.POST(\"/v1/databases\", { body: {\n\t\t\t\t\tprojectId: news.projectId,\n\t\t\t\t\tname: news.name,\n\t\t\t\t\tregion: news.region,\n\t\t\t\t\t...news.isDefault !== void 0 && { isDefault: news.isDefault },\n\t\t\t\t\t...news.branchId !== void 0 && { branchId: news.branchId }\n\t\t\t\t} }));\n\t\t\t\treturn {\n\t\t\t\t\tid: created.data.id,\n\t\t\t\t\tname: created.data.name\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst result = {\n\t\t\t\tid: observed.data.id,\n\t\t\t\tname: observed.data.name\n\t\t\t};\n\t\t\tif (news.branchId !== void 0) {\n\t\t\t\tconst branchId = news.branchId;\n\t\t\t\tyield* call(() => client.PATCH(\"/v1/databases/{databaseId}\", {\n\t\t\t\t\tparams: { path: { databaseId: result.id } },\n\t\t\t\t\tbody: { branchId }\n\t\t\t\t}));\n\t\t\t}\n\t\t\treturn result;\n\t\t}),\n\t\tdelete: Effect.fn(function* ({ output }) {\n\t\t\tyield* callVoid(() => client.DELETE(\"/v1/databases/{databaseId}\", { params: { path: { databaseId: output.id } } }));\n\t\t}),\n\t\tread: Effect.fn(function* ({ output }) {\n\t\t\tif (!output?.id) return void 0;\n\t\t\tconst d = yield* callOptional(() => client.GET(\"/v1/databases/{databaseId}\", { params: { path: { databaseId: output.id } } }));\n\t\t\treturn d ? {\n\t\t\t\tid: d.data.id,\n\t\t\t\tname: d.data.name\n\t\t\t} : void 0;\n\t\t})\n\t};\n}));\n//#endregion\n//#region src/postgres/Project.ts\n/** A Prisma Developer Platform **Project** — the container for databases and compute services. */\nconst Project = Resource(\"Prisma.Project\");\nconst ProjectProvider = () => Provider.effect(Project, Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\treturn {\n\t\tstables: [\"id\"],\n\t\tlist: () => Effect.succeed([]),\n\t\treconcile: Effect.fn(function* ({ news, output }) {\n\t\t\tconst observed = output?.id ? yield* callOptional(() => client.GET(\"/v1/projects/{id}\", { params: { path: { id: output.id } } })) : void 0;\n\t\t\tif (observed) return {\n\t\t\t\tid: observed.data.id,\n\t\t\t\tname: observed.data.name\n\t\t\t};\n\t\t\tconst created = yield* call(() => client.POST(\"/v1/projects\", { body: {\n\t\t\t\tname: news.name,\n\t\t\t\tworkspaceId: news.workspaceId\n\t\t\t} }));\n\t\t\treturn {\n\t\t\t\tid: created.data.id,\n\t\t\t\tname: created.data.name\n\t\t\t};\n\t\t}),\n\t\tdelete: Effect.fn(function* ({ output }) {\n\t\t\tyield* callVoid(() => client.DELETE(\"/v1/projects/{id}\", { params: { path: { id: output.id } } }));\n\t\t}),\n\t\tread: Effect.fn(function* ({ output }) {\n\t\t\tif (!output?.id) return void 0;\n\t\t\tconst p = yield* callOptional(() => client.GET(\"/v1/projects/{id}\", { params: { path: { id: output.id } } }));\n\t\t\treturn p ? {\n\t\t\t\tid: p.data.id,\n\t\t\t\tname: p.data.name\n\t\t\t} : void 0;\n\t\t})\n\t};\n}));\n//#endregion\nexport { Connection, ConnectionProvider, Database, DatabaseProvider, Project, ProjectProvider };\n\n//# sourceMappingURL=postgres.mjs.map","import { a as ManagementClient, c as fromEnv, i as callVoid, n as call, o as layer, s as PrismaCredentials } from \"./http-CJM0E6rj.mjs\";\nimport { Bucket, BucketKey, BucketKeyProvider, BucketProvider } from \"./buckets.mjs\";\nimport { COMPUTE_REGIONS, ComputeService, ComputeServiceProvider, Deployment, DeploymentProvider, EnvironmentVariable, EnvironmentVariableProvider, ServiceKey, ServiceKeyProvider, deleteSafeRetrySchedule, isDeleteNotSafeYet, mintServiceKey, packageComputeArtifact, serviceKeyProviderService } from \"./compute.mjs\";\nimport { Connection, ConnectionProvider, Database, DatabaseProvider, Project, ProjectProvider } from \"./postgres.mjs\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Data from \"effect/Data\";\nimport * as Provider from \"alchemy/Provider\";\n//#region src/container.ts\n/** Raised with `ensure: false` when the app's Project (or a named stage's Branch) doesn't exist. */\nvar ContainerNotFoundError = class extends Data.TaggedError(\"ContainerNotFoundError\") {};\nconst listAllProjects = (client) => Effect.gen(function* () {\n\tconst projects = [];\n\tlet cursor;\n\tfor (;;) {\n\t\tconst query = cursor === void 0 ? {} : { cursor };\n\t\tconst page = yield* call(() => client.GET(\"/v1/projects\", { params: { query } }));\n\t\tprojects.push(...page.data);\n\t\tif (!page.pagination.hasMore || page.pagination.nextCursor === null) break;\n\t\tcursor = page.pagination.nextCursor;\n\t}\n\treturn projects;\n});\n/**\n* Workspace ids circulate in two shapes: `wksp_`-prefixed and bare. Compare\n* bare-to-bare so a `wksp_`-prefixed API id still matches a bare configured\n* one (the same normalization `state/bootstrap.ts` applies to the same\n* `/v1/projects` listing).\n*/\nconst bareWorkspaceId = (id) => id.startsWith(\"wksp_\") ? id.slice(5) : id;\n/**\n* Finds the app's Project by name in the workspace — PDP allows duplicate\n* project names, so more than one can match; the oldest wins. Creates one\n* if none match, unless `ensure` is `false` (find-only — `destroy`), in\n* which case an absent Project fails with `ContainerNotFoundError`. No\n* ownership marker and no `--project` override (both deferred — see\n* ADR-0019).\n*/\nconst resolveProject = (client, workspaceId, appName, ensure) => Effect.gen(function* () {\n\tconst oldest = (yield* listAllProjects(client)).filter((p) => bareWorkspaceId(p.workspace.id) === bareWorkspaceId(workspaceId) && p.name === appName).sort((a, b) => a.createdAt.localeCompare(b.createdAt))[0];\n\tif (oldest !== void 0) return oldest.id;\n\tif (!ensure) return yield* Effect.fail(new ContainerNotFoundError({ appName }));\n\treturn (yield* call(() => client.POST(\"/v1/projects\", { body: {\n\t\tname: appName,\n\t\tworkspaceId\n\t} }))).data.id;\n});\nconst findBranchId = (client, projectId, gitName) => call(() => client.GET(\"/v1/projects/{projectId}/branches\", { params: {\n\tpath: { projectId },\n\tquery: { gitName }\n} })).pipe(Effect.map((page) => page.data[0]?.id));\n/**\n* Finds the stage's Branch by its exact `gitName`, creating it if absent\n* unless `ensure` is `false` (find-only — `destroy`), in which case an\n* absent Branch fails with `ContainerNotFoundError`. The Management API has\n* no server-side \"create-or-return\" idempotency (`POST\n* /v1/projects/:id/branches` 409s on a duplicate `gitName`, with no request\n* field to make that a no-op), so idempotency is client-side: observe\n* first, and on a racing 409 from create, re-observe rather than fail.\n*/\nconst resolveBranch = (client, projectId, gitName, appName, ensure) => Effect.gen(function* () {\n\tconst existing = yield* findBranchId(client, projectId, gitName);\n\tif (existing !== void 0) return existing;\n\tif (!ensure) return yield* Effect.fail(new ContainerNotFoundError({\n\t\tappName,\n\t\tstage: gitName\n\t}));\n\treturn yield* call(() => client.POST(\"/v1/projects/{projectId}/branches\", {\n\t\tparams: { path: { projectId } },\n\t\tbody: { gitName }\n\t})).pipe(Effect.map((r) => r.data.id), Effect.catch((err) => err.status === 409 ? findBranchId(client, projectId, gitName).pipe(Effect.flatMap((id) => id === void 0 ? Effect.fail(err) : Effect.succeed(id))) : Effect.fail(err)));\n});\n/**\n* Resolves the two containers a stage's deploy runs into (ADR-0019): the\n* app's **Project**, found-or-created by name, and — for a named stage\n* only — its **Branch**, found-or-created by `gitName`. The default stage\n* (no `stage`) creates no Branch; `branchId` is omitted. With `ensure:\n* false` (`destroy`), nothing is created — an absent Project or Branch\n* fails with `ContainerNotFoundError` instead.\n*/\nconst resolveContainer = (opts) => Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\tconst ensure = opts.ensure ?? true;\n\tconst projectId = yield* resolveProject(client, opts.workspaceId, opts.appName, ensure);\n\tif (opts.stage === void 0) return { projectId };\n\treturn {\n\t\tprojectId,\n\t\tbranchId: yield* resolveBranch(client, projectId, opts.stage, opts.appName, ensure)\n\t};\n});\n/**\n* Soft-deletes a Branch. Tolerates a 404 (already gone). The API refuses if\n* the Branch still has live members or is the production/default Branch —\n* that surfaces as a `PrismaApiError`.\n*/\nconst deleteBranch = (branchId) => Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\tyield* callVoid(() => client.DELETE(\"/v1/branches/{branchId}\", { params: { path: { branchId } } }));\n});\n/**\n* Deletes a Project. Tolerates a 404 (already gone). The API refuses with a\n* 400 if the Project still has live dependencies (e.g. another stage's\n* Branch/resources) — that surfaces as a `PrismaApiError`.\n*/\nconst deleteProject = (projectId) => Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\tyield* callVoid(() => client.DELETE(\"/v1/projects/{id}\", { params: { path: { id: projectId } } }));\n});\n//#endregion\n//#region src/providers.ts\n/** The collection of Prisma resource providers. */\nvar Providers = class extends Provider.ProviderCollection()(\"Prisma\") {};\n/**\n* The Prisma provider bundle: every resource provider, the Management API\n* client, and env-based credentials. Plug into a stack with\n* `{ providers: Prisma.providers() }`.\n*/\nconst providers = () => Layer.effect(Providers, Provider.collection([\n\tProject,\n\tDatabase,\n\tConnection,\n\tComputeService,\n\tDeployment,\n\tEnvironmentVariable,\n\tBucket,\n\tBucketKey\n])).pipe(Layer.provide(Layer.mergeAll(ProjectProvider(), DatabaseProvider(), ConnectionProvider(), ComputeServiceProvider(), DeploymentProvider(), EnvironmentVariableProvider(), BucketProvider(), BucketKeyProvider())), Layer.provideMerge(layer()), Layer.provideMerge(fromEnv()), Layer.orDie);\n//#endregion\nexport { Bucket, BucketKey, BucketKeyProvider, BucketProvider, COMPUTE_REGIONS, ComputeService, ComputeServiceProvider, Connection, ConnectionProvider, ContainerNotFoundError, Database, DatabaseProvider, Deployment, DeploymentProvider, EnvironmentVariable, EnvironmentVariableProvider, ManagementClient, PrismaCredentials, Project, ProjectProvider, Providers, ServiceKey, ServiceKeyProvider, deleteBranch, deleteProject, deleteSafeRetrySchedule, fromEnv, isDeleteNotSafeYet, layer as managementClientLayer, mintServiceKey, packageComputeArtifact, providers, resolveContainer, serviceKeyProviderService };\n\n//# sourceMappingURL=index.mjs.map","import { a as ManagementClient, c as fromEnv, i as callVoid, n as call, o as layer, t as PrismaApiError } from \"./http-CJM0E6rj.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 { Stack } from \"alchemy\";\nimport * as Schedule from \"effect/Schedule\";\nimport postgres from \"postgres\";\nimport { STATE_STORE_VERSION, State, StateStoreError, encodeState, reviveStateRecursive } from \"alchemy/State\";\nimport { blindCast } from \"@internal/foundation/casts\";\n//#region src/state/discovery.ts\n/** The framework-owned database a stage's deploy state lives in — a child of that stage's Branch (ADR-0034). */\nconst STATE_DATABASE_NAME = \"prisma-composer-state\";\n/** Every connection created against a state database carries this prefix — see `cleanupAgedConnections`. */\nconst CONNECTION_NAME_PREFIX = \"prisma-composer-state-\";\nconst listAllBranches = (client, projectId) => Effect.gen(function* () {\n\tconst branches = [];\n\tlet cursor;\n\tfor (;;) {\n\t\tconst query = cursor === void 0 ? {} : { cursor };\n\t\tconst page = yield* call(() => client.GET(\"/v1/projects/{projectId}/branches\", { params: {\n\t\t\tpath: { projectId },\n\t\t\tquery\n\t\t} }));\n\t\tbranches.push(...page.data);\n\t\tif (!page.pagination.hasMore || page.pagination.nextCursor === null) break;\n\t\tcursor = page.pagination.nextCursor;\n\t}\n\treturn branches;\n});\n/**\n* The project's implicit default Branch — every live Project owns exactly\n* one (a platform invariant). The list endpoint has no `isDefault` filter, so\n* this pages through every Branch and picks it out client-side. Never creates\n* one: its absence means the platform's invariant is broken, which is not\n* something a deploy can repair.\n*/\nconst resolveDefaultBranchId = (client, projectId) => Effect.gen(function* () {\n\tconst found = (yield* listAllBranches(client, projectId)).find((b) => b.isDefault);\n\tif (found !== void 0) return found.id;\n\treturn yield* Effect.fail(new PrismaApiError({\n\t\tstatus: 0,\n\t\tmessage: `project ${projectId} has no default Branch — the platform guarantees every live Project owns one; contact support.`\n\t}));\n});\n/** A named stage carries its `branchId`; production omits it, and its state lives on the Project's default Branch. */\nconst resolveBranchId = (client, container) => container.branchId !== void 0 ? Effect.succeed(container.branchId) : resolveDefaultBranchId(client, container.projectId);\n/**\n* Every database on this Branch. Uses the flat `GET /v1/databases`, which\n* accepts `projectId` and `branchId` together — the project-scoped listing\n* has no branch filter at all.\n*/\nconst listAllDatabasesOnBranch = (client, projectId, branchId) => Effect.gen(function* () {\n\tconst databases = [];\n\tlet cursor;\n\tfor (;;) {\n\t\tconst query = cursor === void 0 ? {\n\t\t\tprojectId,\n\t\t\tbranchId\n\t\t} : {\n\t\t\tprojectId,\n\t\t\tbranchId,\n\t\t\tcursor\n\t\t};\n\t\tconst page = yield* call(() => client.GET(\"/v1/databases\", { params: { query } }));\n\t\tdatabases.push(...page.data);\n\t\tif (!page.pagination.hasMore || page.pagination.nextCursor === null) break;\n\t\tcursor = page.pagination.nextCursor;\n\t}\n\treturn databases;\n});\n/**\n* Databases on this Branch named `prisma-composer-state`, oldest first,\n* excluding the Branch's own default database. The default database is always\n* the user's, never ours to adopt or delete. A name match alone proves\n* nothing — the platform allows duplicate names — so every caller must still\n* verify ownership before acting on a candidate.\n*/\nconst listStateDatabaseCandidates = (client, projectId, branchId) => listAllDatabasesOnBranch(client, projectId, branchId).pipe(Effect.map((databases) => databases.filter((d) => d.name === \"prisma-composer-state\" && !d.isDefault).sort((a, b) => a.createdAt.localeCompare(b.createdAt))));\n/**\n* Creates a fresh Postgres connection and reads its connection string. Reads\n* `endpoints.direct.connectionString` only — never `endpoints.pooled`, and\n* never the deprecated top-level `connectionString`/`url` (PRO-212), neither\n* of which the platform guarantees.\n*\n* The connection string is returned only when the connection is created and\n* cannot be read back afterwards, which is why every run creates a fresh\n* connection instead of reusing one.\n*/\nconst createConnection = (client, databaseId) => call(() => client.POST(\"/v1/databases/{databaseId}/connections\", {\n\tparams: { path: { databaseId } },\n\tbody: { name: `${CONNECTION_NAME_PREFIX}${Date.now()}` }\n})).pipe(Effect.flatMap((r) => {\n\tconst created = r.data;\n\tconst dsn = created.endpoints.direct?.connectionString;\n\treturn dsn === void 0 ? Effect.fail(new PrismaApiError({\n\t\tstatus: 0,\n\t\tmessage: `connection ${created.id} returned no endpoints.direct.connectionString (PRO-212)`\n\t})) : Effect.succeed(Redacted.make(dsn));\n}));\n//#endregion\n//#region src/state/errors.ts\n/** Collapses any thrown value (postgres.js failures included) into a {@link StateStoreError}. */\nconst toStateStoreError = (cause) => cause instanceof Error ? new StateStoreError({\n\tmessage: cause.message,\n\tcause\n}) : new StateStoreError({ message: String(cause) });\n/**\n* An operator-facing failure from the hosted-state bootstrap pipeline\n* (branch/database discovery, connection creation, schema migration, or lock\n* acquisition) — what a deployer actually sees, instead of a raw Effect\n* 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 driver/API error object as `cause`: a\n* postgres.js connection failure's `.message`/properties are not verified to\n* omit the DSN or credentials, so only the extracted message text survives\n* into the operator-facing error.\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/schema.ts\n/**\n* The well-known marker row written into every database this store owns.\n* Its presence proves the database is genuinely Prisma App's state store, not\n* a same-named project squatting on the discovery query (see `bootstrap.ts`\n* `verifyOwnership` — PDP allows duplicate project names).\n*/\nconst STATE_META_MARKER = \"prisma-composer-state-v1\";\n/**\n* Idempotent schema migration for the Prisma-hosted state store — safe to run\n* on every deploy, since `create table if not exists` no-ops once the tables\n* exist. Run this against `sql` before serving a {@link StateService} built\n* by `makePrismaStateService` over the same client.\n*/\nconst migratePrismaState = (sql) => Effect.tryPromise({\n\ttry: async () => {\n\t\tawait sql`\n create table if not exists alchemy_resource_state (\n stack text not null,\n stage text not null,\n fqn text not null,\n value jsonb not null,\n updated_at timestamptz not null default now(),\n primary key (stack, stage, fqn)\n )\n `;\n\t\tawait sql`\n create table if not exists alchemy_stack_output (\n stack text not null,\n stage text not null,\n value jsonb not null,\n updated_at timestamptz not null default now(),\n primary key (stack, stage)\n )\n `;\n\t\tawait sql`\n create table if not exists prisma_app_state_meta (\n marker text primary key,\n created_at timestamptz not null default now()\n )\n `;\n\t\tawait sql`\n insert into prisma_app_state_meta (marker) values (${STATE_META_MARKER})\n on conflict (marker) do nothing\n `;\n\t},\n\tcatch: toStateStoreError\n});\n//#endregion\n//#region src/state/bootstrap.ts\nconst CONNECTION_MAX_AGE_MS = 1440 * 60 * 1e3;\n/**\n* Creates the state database on the stage's Branch, using the flat endpoint\n* because it is the only one that accepts a `branchId`. The platform still\n* creates the row on the project's default Branch and attaches it afterwards,\n* so a failed attach can leave a database behind on the default Branch. It\n* checks the Branch exists before creating, and this is one request instead of\n* two, so that window is much narrower than attaching from here — but it is\n* narrowed, not closed.\n*\n* `isDefault` is left at the API's `false` default: the state database must\n* never be the stage's default database, which belongs to the user.\n*/\nconst createStateDatabase = (client, projectId, branchId) => call(() => client.POST(\"/v1/databases\", { body: {\n\tprojectId,\n\tname: STATE_DATABASE_NAME,\n\tregion: \"inherit\",\n\tbranchId\n} })).pipe(Effect.map((created) => ({\n\tid: created.data.id,\n\tname: created.data.name,\n\tisDefault: created.data.isDefault,\n\tcreatedAt: created.data.createdAt\n})));\nconst listAllConnections = (client, databaseId) => Effect.gen(function* () {\n\tconst connections = [];\n\tlet cursor;\n\tfor (;;) {\n\t\tconst query = cursor === void 0 ? {} : { cursor };\n\t\tconst page = yield* call(() => client.GET(\"/v1/databases/{databaseId}/connections\", { params: {\n\t\t\tpath: { databaseId },\n\t\t\tquery\n\t\t} }));\n\t\tconnections.push(...page.data);\n\t\tif (!page.pagination.hasMore || page.pagination.nextCursor === null) break;\n\t\tcursor = page.pagination.nextCursor;\n\t}\n\treturn connections;\n});\nconst deleteConnection = (client, connectionId) => callVoid(() => client.DELETE(\"/v1/connections/{id}\", { params: { path: { id: connectionId } } }));\n/**\n* Every deploy creates a fresh connection (`createConnection`) and nothing ever\n* closes it, so the state database otherwise accumulates one connection\n* resource per run without bound. Best-effort, never blocks bootstrap: lists\n* this database's connections, deletes the ones matching our naming pattern\n* older than the age threshold, and swallows any failure (a transient API\n* error here must never fail the deploy it's cleaning up after).\n*/\nconst cleanupAgedConnections = (client, databaseId) => Effect.gen(function* () {\n\tconst connections = yield* listAllConnections(client, databaseId);\n\tconst cutoff = Date.now() - CONNECTION_MAX_AGE_MS;\n\tconst aged = connections.filter((c) => c.name.startsWith(\"prisma-composer-state-\") && Date.parse(c.createdAt) < cutoff);\n\tyield* Effect.forEach(aged, (c) => deleteConnection(client, c.id), { discard: true });\n}).pipe(Effect.ignore);\n/**\n* PDP allows duplicate database names, so a database named `prisma-composer-state`\n* found by listing is not proof it's ours — it could be an unrelated\n* database that happens to share the name (a squatter, deliberate or not).\n* Connects to the candidate and inspects its tables:\n*\n* - our marker table with our marker row present → `ours`, adopt outright.\n* - our state tables (`alchemy_resource_state`/`alchemy_stack_output`) but no\n* marker → `legacy`: a database from before this ownership check existed.\n* The real, currently-in-use workspace state is in this shape today, so it\n* must keep working — adopt it, and `migratePrismaState` (idempotent)\n* writes the marker on the way in.\n* - no tables at all → `empty`, a freshly-created database — adopt.\n* - anything else → `squatter`: foreign data occupies the name; refuse it.\n*/\nconst verifyOwnership = (connectionString) => Effect.tryPromise({\n\ttry: async () => {\n\t\tconst sql = postgres(Redacted.value(connectionString), {\n\t\t\tmax: 1,\n\t\t\tonnotice: () => {}\n\t\t});\n\t\ttry {\n\t\t\tconst rows = await sql`\n select tablename from pg_tables where schemaname = 'public'\n `;\n\t\t\tconst tables = new Set(rows.map((row) => row.tablename));\n\t\t\tif (tables.has(\"prisma_app_state_meta\")) return (await sql`\n select marker from prisma_app_state_meta where marker = ${\"prisma-composer-state-v1\"}\n `).length > 0 ? { kind: \"ours\" } : {\n\t\t\t\tkind: \"squatter\",\n\t\t\t\ttables: [...tables]\n\t\t\t};\n\t\t\tif (tables.has(\"alchemy_resource_state\") || tables.has(\"alchemy_stack_output\")) return { kind: \"legacy\" };\n\t\t\treturn tables.size === 0 ? { kind: \"empty\" } : {\n\t\t\t\tkind: \"squatter\",\n\t\t\t\ttables: [...tables]\n\t\t\t};\n\t\t} finally {\n\t\t\tawait sql.end({ timeout: 5 });\n\t\t}\n\t},\n\tcatch: (cause) => new PrismaApiError({\n\t\tstatus: 0,\n\t\tmessage: `ownership verification failed: ${cause instanceof Error ? cause.message : String(cause)}`\n\t})\n});\n/**\n* Finds the Branch's `prisma-composer-state` database, verifying ownership\n* rather than trusting the name alone (PDP allows duplicate names — see\n* `verifyOwnership`). Finding none creates one, with nothing to verify: only\n* this run can have touched a database it just created.\n*\n* Candidates are tried oldest first, so repeated runs pick the same one. The\n* first that verifies as ours is used. A candidate that fails verification is\n* skipped. If every candidate fails, bootstrap fails and names each rejected\n* database id, so an operator knows which to rename or remove.\n*/\nconst resolveStateDatabase = (client, projectId, branchId, verify) => Effect.gen(function* () {\n\tconst candidates = yield* listStateDatabaseCandidates(client, projectId, branchId);\n\tif (candidates.length === 0) {\n\t\tconst database = yield* createStateDatabase(client, projectId, branchId);\n\t\tconst connectionString = yield* createConnection(client, database.id);\n\t\tconsole.error(`hosted state: provisioned state database ${database.id} on branch ${branchId} (project ${projectId})`);\n\t\treturn {\n\t\t\tdatabase,\n\t\t\tconnectionString\n\t\t};\n\t}\n\tconst rejected = [];\n\tfor (const candidate of candidates) {\n\t\tconst connectionString = yield* createConnection(client, candidate.id);\n\t\tconst verdict = yield* verify(connectionString);\n\t\tif (verdict.kind === \"squatter\") {\n\t\t\trejected.push(`${candidate.id} (foreign tables: ${verdict.tables.join(\", \")})`);\n\t\t\tcontinue;\n\t\t}\n\t\tconsole.error(`hosted state: using state database ${candidate.id} on branch ${branchId} (${verdict.kind}) — ${candidates.length} candidate(s) named ${STATE_DATABASE_NAME}`);\n\t\treturn {\n\t\t\tdatabase: candidate,\n\t\t\tconnectionString\n\t\t};\n\t}\n\treturn yield* Effect.fail(new PrismaApiError({\n\t\tstatus: 0,\n\t\tmessage: `found ${candidates.length} database(s) named \"${STATE_DATABASE_NAME}\" on branch ${branchId}, but none verified as Composer's state store: ${rejected.join(\"; \")}. Rename or remove the offending database(s).`\n\t}));\n});\n/**\n* Resolves the stage's Branch, find-or-creates its `prisma-composer-state`\n* database, and creates a fresh connection — the automatic bootstrap every\n* deploy runs once, needing nothing beyond the service token and the\n* Project/Branch ids the CLI already resolved.\n*/\nconst bootstrapStateConnection = (container) => bootstrapStateConnectionWith(container, verifyOwnership);\n/**\n* Identical to {@link bootstrapStateConnection}, except the ownership check is\n* a parameter so `bootstrap.test.ts` can supply a fake instead of opening a\n* real Postgres connection.\n*/\nconst bootstrapStateConnectionWith = (container, verify) => Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\tconst branchId = yield* resolveBranchId(client, container);\n\tconst { database, connectionString } = yield* resolveStateDatabase(client, container.projectId, branchId, verify);\n\tyield* cleanupAgedConnections(client, database.id);\n\treturn {\n\t\tprojectId: container.projectId,\n\t\tdatabaseId: database.id,\n\t\tconnectionString\n\t};\n});\n//#endregion\n//#region src/state/delete.ts\nconst deleteDatabase = (client, databaseId) => callVoid(() => client.DELETE(\"/v1/databases/{databaseId}\", { params: { path: { databaseId } } }));\n/**\n* Removes the stage's state database, so the CLI's destroy leaves nothing\n* behind: for a named stage the Branch cannot be deleted while this database\n* is still a live member, and for production it would otherwise outlive the\n* stage and hold a quota slot.\n*\n* Every candidate is checked for our ownership marker before deletion —\n* deleting by name alone would destroy a user's database that happens to\n* share the name. All owned candidates are removed, not just the first: a\n* crashed earlier run can leave duplicates, and they are all ours. Finding\n* none succeeds, which is what makes a retried destroy a no-op.\n*/\nconst deleteStateDatabase = (container) => deleteStateDatabaseWith(container, verifyOwnership);\n/**\n* Identical to {@link deleteStateDatabase}, except the ownership check is a\n* parameter so tests can supply a fake instead of opening a real Postgres\n* connection.\n*/\nconst deleteStateDatabaseWith = (container, verify) => Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\tconst branchId = yield* resolveBranchId(client, container);\n\tconst candidates = yield* listStateDatabaseCandidates(client, container.projectId, branchId);\n\tfor (const candidate of candidates) {\n\t\tconst verdict = yield* verify(yield* createConnection(client, candidate.id));\n\t\tif (verdict.kind === \"squatter\") {\n\t\t\tconsole.warn(`hosted state: left database ${candidate.id} on branch ${branchId} alone — it is named ${STATE_DATABASE_NAME} but holds unrelated data (tables: ${verdict.tables.join(\", \")}).`);\n\t\t\tcontinue;\n\t\t}\n\t\tyield* deleteDatabase(client, candidate.id);\n\t\tconsole.error(`hosted state: removed state database ${candidate.id} from branch ${branchId}`);\n\t}\n});\n//#endregion\n//#region src/state/transient.ts\n/** Codes for \"can't reach the host yet\" — DNS/refusal, not a mid-session drop. */\nconst ESTABLISHMENT_CODES = /* @__PURE__ */ new Set([\n\t\"ECONNREFUSED\",\n\t\"ENOTFOUND\",\n\t\"EAI_AGAIN\"\n]);\n/** Connection-establishment failure messages (no useful `err.code`). `upstream database` is PPg's edge proxy while a cold/idle upstream warms up. */\nconst ESTABLISHMENT_MESSAGE_FRAGMENTS = [\"upstream database\", \"connection refused\"];\n/**\n* Whether a failure is a connection-establishment error against a warming\n* upstream (retry), as opposed to a lost lease, a mid-session drop, or a real\n* query error (all of which must surface at once). Unwraps a\n* {@link StateStoreError} to its driver `cause` so a code-only error still\n* classifies.\n*/\nconst isColdStartConnectError = (error) => {\n\tif (typeof error !== \"object\" || error === null) return false;\n\tconst code = \"code\" in error && typeof error.code === \"string\" ? error.code : void 0;\n\tif (code !== void 0 && ESTABLISHMENT_CODES.has(code)) return true;\n\tconst message = \"message\" in error && typeof error.message === \"string\" ? error.message.toLowerCase() : \"\";\n\tif (ESTABLISHMENT_MESSAGE_FRAGMENTS.some((fragment) => message.includes(fragment))) return true;\n\tconst cause = \"cause\" in error ? error.cause : void 0;\n\treturn cause !== void 0 && cause !== error && isColdStartConnectError(cause);\n};\n/** The same ~2-minute budget the bootstrap migration uses (`layer.ts`): retry every 5s, up to 2 minutes. */\nconst COLD_START_SCHEDULE = Schedule.both(Schedule.spaced(\"5 seconds\"), Schedule.during(\"2 minutes\"));\n/**\n* Retries a state operation past a cold-start connection rejection only; every\n* other failure surfaces immediately. `schedule` is injectable so tests drive\n* it without real delay.\n*/\nconst retryColdStart = (operation, schedule = COLD_START_SCHEDULE) => Effect.retry(operation, {\n\twhile: isColdStartConnectError,\n\tschedule\n});\n//#endregion\n//#region src/state/lock.ts\n/** Another deploy already holds the lock for this stack/stage. Never queued — fails immediately. */\nvar StateLockContentionError = class extends Data.TaggedError(\"StateLockContentionError\") {\n\tget message() {\n\t\treturn `another deploy holds the state lock for ${this.stack}/${this.stage}`;\n\t}\n};\nconst lockKey = (stack, stage) => `prisma-composer:${stack}/${stage}`;\n/**\n* Acquires a session-scoped Postgres advisory lock on a reserved\n* connection pulled from `sql`'s pool — session (not transaction) scope,\n* because a transaction-scoped lock releases at the first commit and a\n* deploy spans many. Held for the run's whole lifetime; contention fails\n* immediately rather than queuing. If the process crashes, the reserved\n* connection drops and Postgres auto-releases the session lock — no\n* explicit crash-recovery bookkeeping needed.\n*/\nconst acquireStateLock = (sql, stack, stage) => Effect.gen(function* () {\n\tconst key = lockKey(stack, stage);\n\tconst reserved = yield* Effect.tryPromise({\n\t\ttry: () => sql.reserve(),\n\t\tcatch: toStateStoreError\n\t});\n\tconst acquired = yield* Effect.tryPromise({\n\t\ttry: async () => {\n\t\t\treturn (await reserved`\n select\n pg_try_advisory_lock(hashtextextended(${key}, 0)) as acquired,\n pg_backend_pid() as pid\n `)[0];\n\t\t},\n\t\tcatch: toStateStoreError\n\t});\n\tif (acquired?.acquired !== true) {\n\t\treserved.release();\n\t\treturn yield* Effect.fail(new StateLockContentionError({\n\t\t\tstack,\n\t\t\tstage\n\t\t}));\n\t}\n\tconst lockPid = acquired.pid;\n\tconst checkLive = retryColdStart(Effect.tryPromise({\n\t\ttry: async () => {\n\t\t\treturn (await sql`\n select exists (\n select 1 from pg_locks\n where locktype = 'advisory'\n and pid = ${lockPid}\n and objsubid = 1\n and granted\n and ((classid::bigint << 32) | (objid::bigint & 4294967295))\n = hashtextextended(${key}, 0)\n ) as live\n `)[0]?.live ?? false;\n\t\t},\n\t\tcatch: toStateStoreError\n\t}).pipe(Effect.flatMap((live) => live ? Effect.void : Effect.fail(new StateStoreError({ message: `the state lock for ${stack}/${stage} was lost mid-run; refusing to continue unlocked` })))));\n\tconst release = async () => {\n\t\ttry {\n\t\t\tawait reserved`select pg_advisory_unlock(hashtextextended(${key}, 0))`;\n\t\t} catch {} finally {\n\t\t\treserved.release();\n\t\t}\n\t};\n\treturn {\n\t\tcheckLive,\n\t\trelease\n\t};\n});\n//#endregion\n//#region src/state/service.ts\nconst attempt = (f) => retryColdStart(Effect.tryPromise({\n\ttry: f,\n\tcatch: toStateStoreError\n}));\n/**\n* Wraps an already-`encodeState`d value as a jsonb-typed bind parameter.\n* Must go through `sql.json(...)` (not `JSON.stringify(...)::jsonb`) —\n* postgres.js re-serializes the parameter once it learns the server-inferred\n* type is jsonb, so a pre-stringified value passed through a `::jsonb` cast\n* gets JSON-encoded *twice* and lands as a jsonb string instead of an\n* object. `sql.json` gives postgres.js the raw value up front and declares\n* the jsonb oid itself, so it is serialized exactly once.\n*/\nconst jsonParam = (sql, value) => sql.json(blindCast(encodeState(value)));\n/**\n* `reviveStateRecursive` is typed to return `unknown` — the caller is\n* expected to know the shape it revived. Here the shape is known by\n* construction: every row was written by `set()`, which persists a value\n* through `encodeState` first, so reviving it recovers a `PersistedState`.\n*/\nconst revivePersistedState = (value) => blindCast(reviveStateRecursive(value));\n/** Same reasoning as {@link revivePersistedState}, narrowed by the SQL status filter. */\nconst reviveReplacedResourceState = (value) => blindCast(reviveStateRecursive(value));\n/**\n* Builds alchemy's `StateService` over a caller-supplied postgres.js client,\n* against the two-table schema `migratePrismaState` creates. The caller owns\n* the client's lifecycle (connection pooling, reconnects, `.end()`); this\n* factory only issues queries.\n*/\nconst makePrismaStateService = (sql) => ({\n\tid: \"prisma-postgres\",\n\tgetVersion: () => Effect.succeed(STATE_STORE_VERSION),\n\tlistStacks: () => attempt(() => sql`\n select stack from alchemy_resource_state\n union\n select stack from alchemy_stack_output\n order by stack\n `).pipe(Effect.map((rows) => rows.map((row) => row.stack))),\n\tlistStages: (stack) => attempt(() => sql`\n select stage from alchemy_resource_state where stack = ${stack}\n union\n select stage from alchemy_stack_output where stack = ${stack}\n order by stage\n `).pipe(Effect.map((rows) => rows.map((row) => row.stage))),\n\tget: (request) => attempt(() => sql`\n select value from alchemy_resource_state\n where stack = ${request.stack} and stage = ${request.stage} and fqn = ${request.fqn}\n `).pipe(Effect.map((rows) => {\n\t\tconst row = rows[0];\n\t\treturn row === void 0 ? void 0 : revivePersistedState(row.value);\n\t})),\n\tgetReplacedResources: (request) => attempt(() => sql`\n select value from alchemy_resource_state\n where stack = ${request.stack} and stage = ${request.stage}\n and value ->> 'status' = 'replaced'\n `).pipe(Effect.map((rows) => rows.map((row) => reviveReplacedResourceState(row.value)))),\n\tset: (request) => attempt(() => sql`\n insert into alchemy_resource_state (stack, stage, fqn, value, updated_at)\n values (\n ${request.stack}, ${request.stage}, ${request.fqn},\n ${jsonParam(sql, request.value)}, now()\n )\n on conflict (stack, stage, fqn) do update\n set value = excluded.value, updated_at = excluded.updated_at\n `).pipe(Effect.map(() => request.value)),\n\tdelete: (request) => attempt(() => sql`\n delete from alchemy_resource_state\n where stack = ${request.stack} and stage = ${request.stage} and fqn = ${request.fqn}\n `).pipe(Effect.asVoid),\n\tdeleteStack: (request) => attempt(async () => {\n\t\tif (request.stage === void 0) {\n\t\t\tawait sql`delete from alchemy_resource_state where stack = ${request.stack}`;\n\t\t\tawait sql`delete from alchemy_stack_output where stack = ${request.stack}`;\n\t\t} else {\n\t\t\tawait sql`\n delete from alchemy_resource_state\n where stack = ${request.stack} and stage = ${request.stage}\n `;\n\t\t\tawait sql`\n delete from alchemy_stack_output\n where stack = ${request.stack} and stage = ${request.stage}\n `;\n\t\t}\n\t}),\n\tlist: (request) => attempt(() => sql`\n select fqn from alchemy_resource_state\n where stack = ${request.stack} and stage = ${request.stage}\n order by fqn\n `).pipe(Effect.map((rows) => rows.map((row) => row.fqn))),\n\tgetOutput: (request) => attempt(() => sql`\n select value from alchemy_stack_output\n where stack = ${request.stack} and stage = ${request.stage}\n `).pipe(Effect.map((rows) => {\n\t\tconst row = rows[0];\n\t\treturn row === void 0 ? void 0 : reviveStateRecursive(row.value);\n\t})),\n\tsetOutput: (request) => attempt(() => sql`\n insert into alchemy_stack_output (stack, stage, value, updated_at)\n values (${request.stack}, ${request.stage}, ${jsonParam(sql, request.value)}, now())\n on conflict (stack, stage) do update\n set value = excluded.value, updated_at = excluded.updated_at\n `).pipe(Effect.map(() => request.value))\n});\n/**\n* How long a passing lease check is trusted before the next storage\n* operation re-verifies it. A deploy issues many state ops in quick\n* succession, and each raw `checkLive` is a `pg_locks` round-trip; without\n* amortization the guard roughly doubles the store's traffic. The cost of the\n* window is bounded: a lease lost mid-window is detected within this many ms,\n* not instantly — an accepted tradeoff on top of the already-accepted\n* non-atomic (TOCTOU) gap between the check and the operation.\n*/\nconst LEASE_CHECK_TTL_MS = 5e3;\n/**\n* Amortizes a lease check over a short TTL: a *passing* check is trusted for\n* `ttlMs`, so a burst of operations inside the window does one round-trip, not\n* one per op. A *failing* check is never cached — it propagates immediately\n* and leaves the last-good timestamp untouched, so the very next op re-checks.\n* The `lastOkAt` state is captured per call, so each store (each layer) gets\n* its own window — two stores in one process never share a cached success.\n*/\nconst amortizeCheck = (checkLive, ttlMs, now) => {\n\tlet lastOkAt;\n\treturn Effect.suspend(() => {\n\t\tif (lastOkAt !== void 0 && now() - lastOkAt < ttlMs) return Effect.void;\n\t\treturn checkLive.pipe(Effect.tap(() => Effect.sync(() => {\n\t\t\tlastOkAt = now();\n\t\t})));\n\t});\n};\n/**\n* Wraps a {@link StateService} so every method that touches storage first\n* re-verifies the state lock's lease via `checkLive`. Used to enforce \"a\n* dropped lock connection fails loudly\" — see {@link ../lock.ts}. The check is\n* amortized over a short TTL (see {@link amortizeCheck}), so a run of\n* back-to-back operations does not fire one `pg_locks` round-trip per call.\n*\n* Reads are gated too, not just writes: a lost lease means a concurrent\n* deploy may already be mutating this stack's rows, so a read could return\n* stale or conflicting data — untrustworthy either way, not just the writes.\n* The check is best-effort and not atomic with the operation it guards (the\n* lease could be lost in the gap between `checkLive` passing and the wrapped\n* call executing, or within the TTL window); that residual race is accepted.\n*\n* `getVersion` is excluded: it returns a compile-time constant\n* (`STATE_STORE_VERSION`), so guarding it would only add a pointless\n* reserved-connection round-trip.\n*\n* `now` is injectable so tests can advance the clock deterministically; it\n* defaults to `Date.now` (fine in library runtime code — only Workflow\n* scripts forbid it).\n*/\nconst guardStateService = (service, checkLive, now = Date.now) => {\n\tconst guard = amortizeCheck(checkLive, LEASE_CHECK_TTL_MS, now);\n\treturn {\n\t\tid: service.id,\n\t\tgetVersion: () => service.getVersion(),\n\t\tlistStacks: () => guard.pipe(Effect.andThen(service.listStacks())),\n\t\tlistStages: (stack) => guard.pipe(Effect.andThen(service.listStages(stack))),\n\t\tget: (request) => guard.pipe(Effect.andThen(service.get(request))),\n\t\tgetReplacedResources: (request) => guard.pipe(Effect.andThen(service.getReplacedResources(request))),\n\t\tset: (request) => guard.pipe(Effect.andThen(service.set(request))),\n\t\tdelete: (request) => guard.pipe(Effect.andThen(service.delete(request))),\n\t\tdeleteStack: (request) => guard.pipe(Effect.andThen(service.deleteStack(request))),\n\t\tlist: (request) => guard.pipe(Effect.andThen(service.list(request))),\n\t\tgetOutput: (request) => guard.pipe(Effect.andThen(service.getOutput(request))),\n\t\tsetOutput: (request) => guard.pipe(Effect.andThen(service.setOutput(request)))\n\t};\n};\n//#endregion\n//#region src/state/layer.ts\n/**\n* The hosted Alchemy state store. On layer init (scoped, once per stack\n* run): resolve the stage's Branch, find-or-create its `prisma-composer-state`\n* database, create a fresh connection, migrate the schema, and acquire the\n* (stack, stage) advisory lock — see `bootstrap.ts` and `lock.ts`. The\n* Management API plumbing (`ManagementClient`, `PrismaCredentials`) is\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/lock/migration failure is wrapped into an operator-facing\n* `HostedStateBootstrapError` (naming the Project/Branch and the step that\n* failed, never the raw driver/API error — see `errors.ts`) before dying the\n* layer (loud, immediate, unrecoverable) rather than surfacing as a typed\n* error — matching core's `LowerOptions.state: Layer.Layer<State, never,\n* StackServices>` contract and alchemy's own convention (e.g. a missing\n* state store is `Effect.die` in `Stack.make`).\n*/\nconst prismaStateLayer = (ids) => {\n\tconst { projectId, branchId } = ids;\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 { connectionString } = yield* bootstrapStateConnection(branchId === void 0 ? { projectId } : {\n\t\t\tprojectId,\n\t\t\tbranchId\n\t\t}).pipe(Effect.provide(layer().pipe(Layer.provide(fromEnv()))), Effect.mapError(bootstrapError(\"resolving the state database on the stage branch\")));\n\t\tconst sql = postgres(Redacted.value(connectionString), {\n\t\t\tmax: 5,\n\t\t\tonnotice: () => {}\n\t\t});\n\t\tyield* Effect.addFinalizer(() => Effect.promise(() => sql.end({ timeout: 5 })));\n\t\tyield* migratePrismaState(sql).pipe(Effect.retry(Schedule.both(Schedule.spaced(\"5 seconds\"), Schedule.during(\"2 minutes\"))), Effect.mapError(bootstrapError(\"schema migration\")));\n\t\tconst lock = yield* acquireStateLock(sql, stack.name, stack.stage).pipe(Effect.mapError(bootstrapError(\"lock acquisition\")));\n\t\tyield* Effect.addFinalizer(() => Effect.promise(() => lock.release()));\n\t\tconst service = guardStateService(makePrismaStateService(sql), lock.checkLive);\n\t\treturn Effect.succeed(service);\n\t})).pipe(Layer.orDie);\n};\n//#endregion\nexport { deleteStateDatabase, deleteStateDatabaseWith, makePrismaStateService, migratePrismaState, prismaStateLayer, verifyOwnership };\n\n//# sourceMappingURL=state.mjs.map","import { a as paramName, i as paramBindingFor, o as RESERVED_PROVIDER_PARAMS, r as isEnvParamSource, s as STREAMS_API_KEY, t as provisionedEdges } from \"./provisioned-edges-DIQAR4q4.mjs\";\nimport { a as encodeParamPointer, f as secretName, i as encode, o as paramEntries, s as secretPointerRows, t as configKey } from \"./serializer-CX4VYdf_.mjs\";\nimport { i as withConnectionRetry, n as normalizeSslMode } from \"./pg-connection-CadPZuEK.mjs\";\nimport { n as isPnPostgresResourceNode } from \"./prisma-next-DlU01kXJ.mjs\";\nimport { isParamSource, paramManifest, provisionManifest } from \"@internal/core\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport { RPC_PEER_KEY } from \"@internal/service-rpc\";\nimport * as Prisma from \"@internal/lowering\";\nimport { ManagementClient, deleteBranch, deleteProject, fromEnv, managementClientLayer, resolveContainer } from \"@internal/lowering\";\nimport { deleteStateDatabaseWith, prismaStateLayer, verifyOwnership } from \"@internal/lowering/state\";\nimport * as Output from \"alchemy/Output\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Redacted from \"effect/Redacted\";\nimport { Resource } from \"alchemy\";\nimport * as Provider from \"alchemy/Provider\";\nimport pg from \"pg\";\nimport { loadConfig } from \"@prisma-next/config-loader\";\nimport { resolve } from \"pathe\";\nimport { readRef } from \"@prisma-next/migration-tools/refs\";\nimport { APP_SPACE_ID, readContractSpaceHeadRef, spaceMigrationDirectory, spaceRefsDirectory } from \"@prisma-next/migration-tools/spaces\";\nimport { createPostgresControlClient } from \"@prisma-next/postgres/control\";\n//#region src/container.ts\nconst PRISMA_CLOUD_EXTENSION_ID = \"@prisma/composer-prisma-cloud\";\nvar PrismaCloudContainer = class {\n\tinput;\n\tprojectId;\n\tbranchId;\n\tconstructor(input, projectId, branchId) {\n\t\tthis.input = input;\n\t\tthis.projectId = projectId;\n\t\tthis.branchId = branchId;\n\t}\n\tserialize() {\n\t\treturn JSON.stringify({\n\t\t\tinput: this.input,\n\t\t\tprojectId: this.projectId,\n\t\t\t...this.branchId !== void 0 ? { branchId: this.branchId } : {}\n\t\t});\n\t}\n};\n/** `instanceof` — parent-side instances and child-side deserialized instances are both constructed by this module. */\nfunction isPrismaCloudContainer(value) {\n\treturn value instanceof PrismaCloudContainer;\n}\n/** Narrow-or-throw for hook inputs. */\nfunction prismaCloudContainerOf(value) {\n\tif (!isPrismaCloudContainer(value)) throw new Error(\"the Prisma Cloud container was not resolved — the extension's container descriptor did not run.\");\n\treturn value;\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction invalidPayloadError(reason) {\n\treturn /* @__PURE__ */ new Error(`${PRISMA_CLOUD_EXTENSION_ID}: invalid container transport payload — ${reason}.`);\n}\n/** Reconstructs a `PrismaCloudContainer` from `serialize()`'s JSON output — real narrowing, no casts. */\nfunction deserialize(serialized) {\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(serialized);\n\t} catch (error) {\n\t\tthrow invalidPayloadError(`not valid JSON (${error instanceof Error ? error.message : String(error)})`);\n\t}\n\tif (!isRecord(parsed)) throw invalidPayloadError(\"not an object\");\n\tconst input = parsed[\"input\"];\n\tif (!isRecord(input)) throw invalidPayloadError(\"\\\"input\\\" is not an object\");\n\tconst appName = input[\"appName\"];\n\tif (typeof appName !== \"string\") throw invalidPayloadError(\"\\\"input.appName\\\" is not a string\");\n\tconst stage = input[\"stage\"];\n\tif (stage !== void 0 && typeof stage !== \"string\") throw invalidPayloadError(\"\\\"input.stage\\\" is not a string or absent\");\n\tconst projectId = parsed[\"projectId\"];\n\tif (typeof projectId !== \"string\") throw invalidPayloadError(\"\\\"projectId\\\" is not a string\");\n\tconst branchId = parsed[\"branchId\"];\n\tif (branchId !== void 0 && typeof branchId !== \"string\") throw invalidPayloadError(\"\\\"branchId\\\" is not a string or absent\");\n\treturn new PrismaCloudContainer({\n\t\tappName,\n\t\tstage\n\t}, projectId, branchId);\n}\nconst workspaceRequiredError = () => /* @__PURE__ */ new Error(\"environment variable PRISMA_WORKSPACE_ID is required.\");\nconst tokenRequiredError$2 = () => /* @__PURE__ */ new Error(\"environment variable PRISMA_SERVICE_TOKEN is required.\");\nfunction requireWorkspaceId() {\n\tconst workspaceId = process.env[\"PRISMA_WORKSPACE_ID\"];\n\tif (workspaceId === void 0 || workspaceId.length === 0) throw workspaceRequiredError();\n\treturn workspaceId;\n}\nfunction requireTokenUnlessInjected(deps) {\n\tif (deps?.client === void 0 && (process.env[\"PRISMA_SERVICE_TOKEN\"] ?? \"\").length === 0) throw tokenRequiredError$2();\n}\nasync function ensureContainer(input, deps) {\n\tconst workspaceId = requireWorkspaceId();\n\trequireTokenUnlessInjected(deps);\n\tconst program = resolveContainer({\n\t\tworkspaceId,\n\t\tappName: input.appName,\n\t\t...input.stage !== void 0 ? { stage: input.stage } : {},\n\t\tensure: true\n\t}).pipe(Effect.map((c) => ({\n\t\tok: true,\n\t\tcontainer: c\n\t})), Effect.catchTag(\"PrismaApiError\", (e) => Effect.succeed({\n\t\tok: false,\n\t\tmessage: `Prisma Management API error resolving containers: ${e.message}.`\n\t})));\n\tconst provided = deps?.client !== void 0 ? program.pipe(Effect.provideService(ManagementClient, deps.client)) : program.pipe(Effect.provide(managementClientLayer().pipe(Layer.provide(fromEnv()))));\n\tconst outcome = await Effect.runPromise(provided);\n\tif (!outcome.ok) throw new Error(outcome.message);\n\treturn new PrismaCloudContainer(input, outcome.container.projectId, outcome.container.branchId);\n}\nasync function locateContainer(input, deps) {\n\tconst workspaceId = requireWorkspaceId();\n\trequireTokenUnlessInjected(deps);\n\tconst program = resolveContainer({\n\t\tworkspaceId,\n\t\tappName: input.appName,\n\t\t...input.stage !== void 0 ? { stage: input.stage } : {},\n\t\tensure: false\n\t}).pipe(Effect.map((c) => ({\n\t\tok: true,\n\t\tcontainer: c\n\t})), Effect.catchTag(\"ContainerNotFoundError\", () => Effect.succeed({ ok: false })), Effect.catchTag(\"PrismaApiError\", (e) => Effect.fail(/* @__PURE__ */ new Error(`Prisma Management API error resolving containers: ${e.message}.`))));\n\tconst provided = deps?.client !== void 0 ? program.pipe(Effect.provideService(ManagementClient, deps.client)) : program.pipe(Effect.provide(managementClientLayer().pipe(Layer.provide(fromEnv()))));\n\tconst outcome = await Effect.runPromise(provided);\n\tif (!outcome.ok) return void 0;\n\treturn new PrismaCloudContainer(input, outcome.container.projectId, outcome.container.branchId);\n}\n/**\n* Soft-deletes a named stage's Branch after a successful `alchemy destroy`\n* has removed its members — the Management API refuses to delete a Branch\n* that still has live members.\n*/\nasync function removeStageBranch(branchId, deps) {\n\trequireTokenUnlessInjected(deps);\n\tconst program = deleteBranch(branchId).pipe(Effect.map(() => ({ ok: true })), Effect.catchTag(\"PrismaApiError\", (e) => Effect.succeed({\n\t\tok: false,\n\t\tmessage: `Failed to delete the stage Branch: ${e.message}.`\n\t})));\n\tconst provided = deps?.client !== void 0 ? program.pipe(Effect.provideService(ManagementClient, deps.client)) : program.pipe(Effect.provide(managementClientLayer().pipe(Layer.provide(fromEnv()))));\n\tconst outcome = await Effect.runPromise(provided);\n\tif (!outcome.ok) throw new Error(outcome.message);\n}\n/**\n* Best-effort cleanup after a successful `--production` destroy: removes\n* the app's Project so hand-run stacks don't accumulate as empty Projects\n* (they eventually hit the workspace's plan limit). Unlike `removeStageBranch`,\n* this never throws: the destroy itself already succeeded, and the API's own\n* 400 (\"still has dependencies\") is the only check that matters — failing\n* the command over a cleanup step would be worse than leaving a Project shell.\n*/\nasync function removeAppProject(projectId, deps) {\n\tif (deps?.client === void 0 && (process.env[\"PRISMA_SERVICE_TOKEN\"] ?? \"\").length === 0) {\n\t\tconsole.warn(`Skipped removing the Project (${projectId}): PRISMA_SERVICE_TOKEN is not set.`);\n\t\treturn;\n\t}\n\tconst program = deleteProject(projectId).pipe(Effect.map(() => ({ ok: true })), Effect.catchTag(\"PrismaApiError\", (e) => Effect.succeed({\n\t\tok: false,\n\t\terror: e\n\t})));\n\tconst provided = deps?.client !== void 0 ? program.pipe(Effect.provideService(ManagementClient, deps.client)) : program.pipe(Effect.provide(managementClientLayer().pipe(Layer.provide(fromEnv()))));\n\tconst outcome = await Effect.runPromise(provided);\n\tif (outcome.ok) {\n\t\tconsole.log(`Removed the Project (${projectId}) — nothing was left in it.`);\n\t\treturn;\n\t}\n\tif (outcome.error.status === 400) {\n\t\tconsole.log(`Kept the Project (${projectId}) — it still has another stage's resources.`);\n\t\treturn;\n\t}\n\tconsole.warn(`Could not remove the Project (${projectId}) after destroy: ${outcome.error.message}.`);\n}\nfunction containerDescriptor(deps) {\n\treturn {\n\t\tensure: (input) => ensureContainer(input, deps),\n\t\tlocate: (input) => locateContainer(input, deps),\n\t\tremove: (instance) => instance.input.stage !== void 0 ? removeStageBranch(instance.branchId ?? missingBranchId(instance), deps) : removeAppProject(instance.projectId, deps),\n\t\tdeserialize\n\t};\n}\n/** Defensive: a named-stage container always resolves a Branch together with its stage — `ensure`/`locate`/`deserialize` never produce one without the other. */\nfunction missingBranchId(instance) {\n\tthrow new Error(`${PRISMA_CLOUD_EXTENSION_ID}: a named-stage (\"${instance.input.stage}\") container instance is missing its branchId — this is a bug in ensure/locate/deserialize.`);\n}\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\");\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//#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 BucketKey is minted for the bucket: it is the reveal-once credential\n* 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.Bucket(`${id}-bucket`, {\n\t\t\tprojectId: projectIdOf(application),\n\t\t\tname: id,\n\t\t\t...branchId !== void 0 ? { branchId } : {}\n\t\t});\n\t\tconst key = yield* Prisma.BucketKey(`${id}-key`, {\n\t\t\tbucketId: bkt.id,\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.id\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* 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\treturn {\n\t\t\t\tserviceId: (yield* Prisma.ComputeService(`${id}-svc`, {\n\t\t\t\t\tprojectId,\n\t\t\t\t\tname: id,\n\t\t\t\t\tregion: o.region ?? \"us-east-1\",\n\t\t\t\t\t...branchId !== void 0 ? { branchId } : {}\n\t\t\t\t})).id,\n\t\t\t\tprojectId\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 records = [];\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\trecords.push(yield* Prisma.EnvironmentVariable(`${key}-var`, {\n\t\t\t\t\tprojectId,\n\t\t\t\t\tkey,\n\t\t\t\t\tvalue: rowValue,\n\t\t\t\t\tclass: cls,\n\t\t\t\t\t...branch\n\t\t\t\t}));\n\t\t\t}\n\t\t\tfor (const { key, name } of secretPointerRows(svc, address, graph.secrets)) records.push(yield* Prisma.EnvironmentVariable(`${key}-var`, {\n\t\t\t\tprojectId,\n\t\t\t\tkey,\n\t\t\t\tvalue: name,\n\t\t\t\tclass: cls,\n\t\t\t\t...branch\n\t\t\t}));\n\t\t\tif (svc.expose !== void 0 && Object.keys(svc.expose).length > 0) {\n\t\t\t\tconst refsByBrand = /* @__PURE__ */ new Map();\n\t\t\t\tfor (const edge of provisionedEdges(graph)) {\n\t\t\t\t\tif (edge.providerAddress !== address) continue;\n\t\t\t\t\tconst ref = ctx.provisioned.get(edge.edgeId);\n\t\t\t\t\tif (ref === void 0) continue;\n\t\t\t\t\tconst refs = refsByBrand.get(edge.brand) ?? [];\n\t\t\t\t\trefs.push(ref);\n\t\t\t\t\trefsByBrand.set(edge.brand, refs);\n\t\t\t\t}\n\t\t\t\tfor (const [brand, entry] of o.providerParams) {\n\t\t\t\t\tconst raw = entry.value(refsByBrand.get(brand) ?? []);\n\t\t\t\t\tif (raw === void 0) continue;\n\t\t\t\t\tconst key = configKey(address, {\n\t\t\t\t\t\towner: \"service\",\n\t\t\t\t\t\tname: entry.name\n\t\t\t\t\t});\n\t\t\t\t\tconst value = Output.isOutput(raw) ? Output.map(raw, (v) => encode(\"service\", v)) : encode(\"service\", raw);\n\t\t\t\t\trecords.push(yield* Prisma.EnvironmentVariable(`${key}-var`, {\n\t\t\t\t\t\tprojectId,\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tvalue,\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}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tenvironment: records,\n\t\t\t\tport: typeof config.service[\"port\"] === \"number\" ? config.service[\"port\"] : 3e3\n\t\t\t};\n\t\t}),\n\t\tpackage: ({ id }, { assembled, address }) => Effect.try(() => Prisma.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 deployment = yield* Prisma.Deployment(`${id}-deploy`, {\n\t\t\t\tcomputeServiceId: provisioned.serviceId,\n\t\t\t\tartifactPath: artifact.path,\n\t\t\t\tartifactHash: artifact.sha256,\n\t\t\t\tenvironment: serialized.environment,\n\t\t\t\tport: serialized.port\n\t\t\t});\n\t\t\treturn {\n\t\t\t\toutputs: {\n\t\t\t\t\turl: deployment.deployedUrl,\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.deployedUrl\n\t\t\t\t}]\n\t\t\t};\n\t\t})\n\t};\n}\n//#endregion\n//#region src/pg-warm-resource.ts\n/**\n* The `PgWarm` Alchemy resource (slice 3, FT-5226) — warm a freshly-provisioned\n* Prisma Postgres database at apply-time so it is ready by deploy-end, and the\n* first real connection (a service's runtime client, or the migration) doesn't\n* eat the cold-start reject.\n*\n* The DB `url` is a lazy `Output` at lowering time, so warming must be an\n* apply-time tracked resource (same pattern as `PnMigration`): its `reconcile`\n* receives the RESOLVED url and connects with `withConnectionRetry` + `select 1`,\n* riding out the cold-start. Shared by BOTH the bare-`postgres` and the\n* `prisma-next` lowerings; keyed on the connection `url`, so an unchanged\n* redeploy is a no-op (warming is idempotent anyway).\n*\n* Deploy-time only: imports `pg` directly + `alchemy`. Imported by `control.ts`\n* and tests, never by `index.ts` / the `./prisma-next` authoring entry — the\n* isolation invariants hold.\n*/\n/** The `PgWarm` resource constructor — `yield* PgWarm(id, { url })` in a lowering. */\nconst PgWarm = Resource(\"PrismaCloud.PgWarm\");\n/** Connect (retrying the cold-start) and run `select 1`, then release the connection. */\nasync function warmDatabase(url) {\n\tawait withConnectionRetry(async () => {\n\t\tconst client = new pg.Client({ connectionString: normalizeSslMode(url) });\n\t\tawait client.connect();\n\t\ttry {\n\t\t\tawait client.query(\"select 1\");\n\t\t} finally {\n\t\t\tawait client.end();\n\t\t}\n\t});\n}\n/**\n* The `PgWarm` provider service. `reconcile` warms the DB (retrying the\n* cold-start) and echoes the `url` so a downstream resource that reads\n* `warm.url` runs only after the DB is warm. Idempotent — safe on redeploy;\n* nothing to enumerate (`list` → `[]`) or tear down (`delete` → no-op; the DB's\n* own deletion handles teardown). Exported so tests can drive it directly.\n*/\nconst pgWarmProviderService = {\n\tlist: () => Effect.succeed([]),\n\treconcile: ({ news }) => Effect.tryPromise({\n\t\ttry: () => warmDatabase(news.url),\n\t\tcatch: (error) => error\n\t}).pipe(Effect.map(() => ({ url: news.url }))),\n\tdelete: () => Effect.void\n};\n/** The `PgWarm` provider layer — merged into the extension descriptor's `providers()`. */\nconst PgWarmProvider = () => Provider.effect(PgWarm, Effect.succeed(pgWarmProviderService));\n//#endregion\n//#region src/descriptors/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 postgresDescriptor(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 db = yield* Prisma.Database(`${id}-db`, {\n\t\t\tprojectId: projectIdOf(application),\n\t\t\tname: id,\n\t\t\tregion: o.region ?? \"us-east-1\",\n\t\t\t...branchId !== void 0 ? { branchId } : {}\n\t\t});\n\t\tconst conn = yield* Prisma.Connection(`${id}-conn`, {\n\t\t\tdatabaseId: db.id,\n\t\t\tname: id\n\t\t});\n\t\tconst url = Output.map(conn.connectionString, (value) => Redacted.value(value));\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.id\n\t\t\t}]\n\t\t};\n\t});\n\treturn Object.assign(lowering, { kind: \"resource\" });\n}\n//#endregion\n//#region src/pn-config.ts\n/**\n* Resolves a `pnPostgres` resource's `prisma-next.config.ts` path to the\n* on-disk migrations directory the control client's `migrate`/`dbInit` needs\n* (ADR-0022, slice 2). Deploy-time only: loads PN's config (via c12) and\n* applies PN's own convention — `migrations.dir`, or the default `migrations/`,\n* relative to the config file's directory (mirrors the CLI's\n* `resolveMigrationPaths`). Imported by `control.ts` + tests, never by\n* `index.ts` / the `./prisma-next` authoring entry.\n*\n* `pathe` (not `node:path`) does the path work so the shipped source carries no\n* `node:` import — the same discipline `control.ts` already follows by\n* delegating fs/tar to `@internal/lowering` (invariant 5).\n*/\n/** The absolute migrations directory PN reads authored migration packages from. */\nasync function resolveMigrationsDir(configPath) {\n\treturn resolve(configPath, \"..\", (await loadConfig(configPath)).migrations?.dir ?? \"migrations\");\n}\n//#endregion\n//#region src/prisma-next-migrate.ts\n/**\n* The Prisma Next migration step of the deploy lowering (ADR-0022, slice 2) —\n* the safety-critical decision that brings a live database to a target REF\n* using ONLY Prisma Next's authored migrations.\n*\n* Deploy-time only: this module imports `@prisma-next/postgres/control` (which\n* transitively pulls PN's control/migration machinery + `pg`). It is imported\n* by the deploy descriptors and this package's tests, NEVER by `index.ts` / the\n* `./prisma-next` authoring entry — so it never lands in an app runtime bundle\n* (the index-isolation invariant holds).\n*\n* The target is a ref `{ hash, invariants }` — not a bare `storageHash`. A\n* ref's `invariants` are named postconditions established by `data`-class\n* migration steps (e.g. a backfill), recorded monotonically on the live\n* marker. Keying on the hash alone would make a pure data-invariant change an\n* A→A self-edge the deploy wrongly skips. The decision, given the live marker\n* and the target ref (see {@link decideMigrationAction}):\n* - marker at ref.hash AND ref.invariants ⊆ marker.invariants → no-op\n* - no marker (fresh DB) AND no required invariants → `dbInit`\n* - otherwise → `migrate`\n*\n* `dbInit` is additive-only synthesis — it NEVER runs app-space data steps —\n* so it is only correct when the ref requires no invariants; a fresh DB whose\n* target carries invariants goes through `migrate`, which walks the AUTHORED\n* graph (including the invariant-bearing data migrations) from empty.\n*\n* Never `dbUpdate`: synthesized diff-and-apply plans are never run against a\n* deployed database. A no-authored-path (`MIGRATION_PATH_NOT_FOUND`) or a\n* runner failure fails the deploy as a typed `PnMigrationError` (not swallowed).\n* PN applies each migration in its own transaction, so a failed apply is atomic\n* and resume-safe — the marker and schema are left as the last committed step.\n*/\n/** A deploy-failing migration error — surfaced, never swallowed. */\nvar PnMigrationError = class extends Error {\n\tcode;\n\t/** PN's structured explanation, when present. */\n\twhy;\n\tconstructor(code, summary, why) {\n\t\tsuper(`prisma-next migrate (${code}): ${summary}`);\n\t\tthis.name = \"PnMigrationError\";\n\t\tthis.code = code;\n\t\tthis.why = why;\n\t}\n};\n/**\n* The target `storageHash` a contract heads to — `contractJson.storage.storageHash`.\n* Read defensively: `contractJson` crosses the boundary as `unknown`.\n*/\nfunction targetStorageHash(contractJson) {\n\tif (typeof contractJson === \"object\" && contractJson !== null && \"storage\" in contractJson) {\n\t\tconst storage = contractJson.storage;\n\t\tif (typeof storage === \"object\" && storage !== null && \"storageHash\" in storage) {\n\t\t\tconst hash = storage.storageHash;\n\t\t\tif (typeof hash === \"string\" && hash.length > 0) return hash;\n\t\t}\n\t}\n\tthrow new PnMigrationError(\"INIT_FAILED\", \"the contract has no storage.storageHash — cannot determine the target schema version\");\n}\n/**\n* Resolve the deploy's target ref from the migrations dir.\n*\n* - `targetRef` named: read `migrations/app/refs/<name>.json` — fail loudly\n* (`TARGET_REF_NOT_FOUND`) when the ref doesn't exist or can't be parsed.\n* - Default: the app space's head. PN synthesizes the app head from the\n* emitted contract — `{ hash: contract.storage.storageHash, invariants: [] }`\n* (`contract emit` writes no app-space `refs/head.json` today; extension\n* spaces have one on disk). When a future PN version does emit one, the\n* on-disk `head.json` wins — read via `readContractSpaceHeadRef`, exactly\n* the loader PN's own migrate uses.\n*/\nasync function resolveTargetRef(migrationsDir, contractJson, targetRef) {\n\tif (targetRef !== void 0) {\n\t\tconst refsDir = spaceRefsDirectory(spaceMigrationDirectory(migrationsDir, APP_SPACE_ID));\n\t\ttry {\n\t\t\tconst ref = await readRef(refsDir, targetRef);\n\t\t\treturn {\n\t\t\t\thash: ref.hash,\n\t\t\t\tinvariants: ref.invariants\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tthrow new PnMigrationError(\"TARGET_REF_NOT_FOUND\", `targetRef \"${targetRef}\" could not be read from ${refsDir}`, error instanceof Error ? error.message : String(error));\n\t\t}\n\t}\n\tconst head = await readContractSpaceHeadRef(migrationsDir, APP_SPACE_ID);\n\tif (head !== null) return {\n\t\thash: head.hash,\n\t\tinvariants: head.invariants\n\t};\n\treturn {\n\t\thash: targetStorageHash(contractJson),\n\t\tinvariants: []\n\t};\n}\n/**\n* The pure migration decision, mirroring PN's own verifier: the database is\n* AT the target when the marker's hash equals the ref's hash AND every ref\n* invariant is on the marker (marker invariants are monotonic). `dbInit` is\n* additive-only synthesis, so it is chosen only for a fresh DB whose\n* effective required invariants (`ref.invariants − marker.invariants`) are\n* empty; anything else — different hash, missing invariant (the A→A\n* data-only self-edge), or a fresh DB with required invariants — walks the\n* authored graph via `migrate`.\n*/\nfunction decideMigrationAction(marker, ref) {\n\tconst markerInvariants = new Set(marker?.invariants ?? []);\n\tconst missing = ref.invariants.filter((id) => !markerInvariants.has(id));\n\tif (marker !== null && marker.storageHash === ref.hash && missing.length === 0) return \"noop\";\n\tif (marker === null && missing.length === 0) return \"init\";\n\treturn \"migrate\";\n}\n/**\n* Bring the database at `url` to the target ref via PN's authored migrations.\n* Reads the live marker, decides no-op / init / migrate\n* ({@link decideMigrationAction}), applies, and throws a typed\n* {@link PnMigrationError} on a no-path or runner failure. `migrationsDir` is\n* the on-disk migrations root and `ref` the resolved target\n* ({@link resolveTargetRef} — both resolved by the lowering, which also keys\n* the PnMigration resource on them). `refName` (the resource's `targetRef`,\n* when set) is threaded into `migrate` so PN targets the named ref's hash and\n* plans an invariant-bearing path.\n*/\nasync function applyPnMigration(opts) {\n\tconst connection = normalizeSslMode(opts.url);\n\treturn withConnectionRetry(() => runMigration(connection, opts.contractJson, opts.migrationsDir, opts.ref, opts.refName), { shouldRetry: (error) => !(error instanceof PnMigrationError) });\n}\nasync function runMigration(connection, contractJson, migrationsDir, ref, refName) {\n\tconst client = createPostgresControlClient({ connection });\n\tawait client.connect();\n\ttry {\n\t\tconst marker = await client.readMarker();\n\t\tconst markerHashBefore = marker?.storageHash ?? null;\n\t\tconst action = decideMigrationAction(marker, ref);\n\t\tif (action === \"noop\") return {\n\t\t\taction,\n\t\t\ttargetHash: ref.hash,\n\t\t\tmarkerHashBefore\n\t\t};\n\t\tif (action === \"init\") {\n\t\t\tconst result = await client.dbInit({\n\t\t\t\tcontract: contractJson,\n\t\t\t\tmode: \"apply\",\n\t\t\t\tmigrationsDir\n\t\t\t});\n\t\t\tif (!result.ok) throw new PnMigrationError(\"INIT_FAILED\", result.failure.summary, result.failure.why);\n\t\t\treturn {\n\t\t\t\taction,\n\t\t\t\ttargetHash: ref.hash,\n\t\t\t\tmarkerHashBefore\n\t\t\t};\n\t\t}\n\t\tconst result = await client.migrate({\n\t\t\tcontract: contractJson,\n\t\t\tmigrationsDir,\n\t\t\t...refName !== void 0 ? {\n\t\t\t\trefHash: ref.hash,\n\t\t\t\trefInvariants: ref.invariants,\n\t\t\t\trefName\n\t\t\t} : {}\n\t\t});\n\t\tif (!result.ok) throw new PnMigrationError(result.failure.code === \"MIGRATION_PATH_NOT_FOUND\" ? \"MIGRATION_PATH_NOT_FOUND\" : \"RUNNER_FAILED\", result.failure.summary, result.failure.why);\n\t\treturn {\n\t\t\taction,\n\t\t\ttargetHash: ref.hash,\n\t\t\tmarkerHashBefore\n\t\t};\n\t} finally {\n\t\tawait client.close();\n\t}\n}\n//#endregion\n//#region src/pn-migration-resource.ts\n/**\n* The `PnMigration` Alchemy resource (ADR-0022, slice 2 D2) — the migration\n* step modeled as a tracked resource so it participates in deploy state: keyed\n* on the target REF identity (`targetHash` + sorted `invariants`), an\n* unchanged redeploy is an Alchemy-level no-op (on top of the marker read),\n* and a contract change — or a DATA-ONLY change that adds a ref invariant at\n* the same hash — re-runs the migration.\n*\n* Its provider's `reconcile` receives the RESOLVED props at apply-time — in\n* particular the concrete DB `url` (a lazy `Output` until the Connection\n* provisions) — and delegates to the proven `applyPnMigration` decision. The\n* provider is a standalone `Provider<PnMigration>` layer; the extension\n* descriptor merges it into its `providers()` (`Layer.merge(Prisma.providers(),\n* PnMigrationProvider())`), and Alchemy resolves it at apply via a direct\n* provider-tag lookup (`tryFindProviderByType`) — no change to `@internal/lowering`.\n*\n* Deploy-time only: imports `@prisma-next/postgres/control` (via the helper) +\n* `alchemy`. Imported by `control.ts` and tests, never by `index.ts` / the\n* `./prisma-next` authoring entry — index isolation holds.\n*/\n/** The `PnMigration` resource constructor — `yield* PnMigration(id, props)` in the lowering. */\nconst PnMigration = Resource(\"PrismaNext.Migration\");\n/**\n* The `PnMigration` provider service. `reconcile` runs for both create and\n* update (Alchemy's unified lifecycle); `applyPnMigration` is idempotent via\n* the live marker read, so it is safe to run for either — the marker decides\n* no-op / init / migrate. A migration has nothing to enumerate (`list` → `[]`)\n* and nothing to tear down on its own (`delete` → no-op; the DB's own deletion\n* handles teardown). Exported so tests can drive `reconcile` directly, without\n* building an Effect layer.\n*/\nconst pnMigrationProviderService = {\n\tlist: () => Effect.succeed([]),\n\treconcile: ({ news }) => Effect.tryPromise({\n\t\ttry: () => applyPnMigration({\n\t\t\turl: news.url,\n\t\t\tcontractJson: news.contractJson,\n\t\t\tmigrationsDir: news.migrationsDir,\n\t\t\tref: {\n\t\t\t\thash: news.targetHash,\n\t\t\t\tinvariants: news.invariants\n\t\t\t},\n\t\t\t...news.refName !== void 0 ? { refName: news.refName } : {}\n\t\t}),\n\t\tcatch: (error) => error\n\t}).pipe(Effect.map((outcome) => ({\n\t\tstorageHash: outcome.targetHash,\n\t\tinvariants: news.invariants\n\t}))),\n\tdelete: () => Effect.void\n};\n/** The `PnMigration` provider layer — merged into the extension descriptor's `providers()`. */\nconst PnMigrationProvider = () => Provider.effect(PnMigration, Effect.succeed(pnMigrationProviderService));\n//#endregion\n//#region src/descriptors/prisma-next.ts\n/**\n* The migration is a tracked `PnMigration` 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 prismaNextDescriptor(o) {\n\tconst lowering = ({ id, node, application }) => Effect.gen(function* () {\n\t\tvalidateName(id, \"resource name (from provision id)\");\n\t\tconst branchId = cloudApplicationOf(application).branchId;\n\t\tconst db = yield* Prisma.Database(`${id}-db`, {\n\t\t\tprojectId: projectIdOf(application),\n\t\t\tname: id,\n\t\t\tregion: o.region ?? \"us-east-1\",\n\t\t\t...branchId !== void 0 ? { branchId } : {}\n\t\t});\n\t\tconst conn = yield* Prisma.Connection(`${id}-conn`, {\n\t\t\tdatabaseId: db.id,\n\t\t\tname: id\n\t\t});\n\t\tconst url = Output.map(conn.connectionString, (value) => Redacted.value(value));\n\t\tif (!isPnPostgresResourceNode(node)) throw new Error(`prisma-next lowering received a non-prisma-next node (${id}).`);\n\t\tconst contractJson = node.provides.__cmp.contractJson;\n\t\tconst migrationsDir = yield* Effect.promise(() => resolveMigrationsDir(node.config));\n\t\tconst ref = yield* Effect.promise(() => resolveTargetRef(migrationsDir, contractJson, node.targetRef));\n\t\tconst warm = yield* PgWarm(`${id}-warm`, { url });\n\t\tyield* PnMigration(`${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\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.id\n\t\t\t}]\n\t\t};\n\t});\n\treturn Object.assign(lowering, { kind: \"resource\" });\n}\n//#endregion\n//#region src/s3-credentials-resource.ts\n/**\n* The `S3Credentials` Alchemy resource (S5) — mints a random SigV4 key pair\n* ONCE at create and keeps it STABLE across deploys, so an unchanged module\n* no-ops on redeploy. The pair is generated with the Web Crypto global\n* (`crypto.getRandomValues` — no `node:` import, matching this package's\n* runtime-coupling invariant) and persisted in Alchemy state; on every later\n* apply the provider returns the persisted attributes (`reconcile`'s `output`)\n* unchanged — the same way the postgres resource keeps a Connection stable.\n* Rotation is destroy/recreate (a platform ask, not solved here).\n*\n* Deploy-time only: imports `alchemy`. Imported by `control.ts` and tests,\n* never by `index.ts` / the authoring entry.\n*/\n/** The `S3Credentials` resource constructor — `yield* S3Credentials(id, {})` in the lowering. */\nconst S3Credentials = Resource(\"PrismaCloud.S3Credentials\");\nfunction randomBytes(n) {\n\treturn crypto.getRandomValues(new Uint8Array(n));\n}\nfunction toHexUpper(bytes) {\n\treturn Array.from(bytes, (b) => b.toString(16).padStart(2, \"0\")).join(\"\").toUpperCase();\n}\n/** A fresh SigV4 key pair: an AKIA-prefixed id and a 40-char base64 secret. */\nfunction mintKeyPair() {\n\treturn {\n\t\taccessKeyId: `AKIA${toHexUpper(randomBytes(8))}`,\n\t\tsecretAccessKey: btoa(String.fromCharCode(...randomBytes(30)))\n\t};\n}\n/**\n* The `S3Credentials` provider service. `reconcile` runs for create and update;\n* it returns the persisted `output` when present (a redeploy reuses the stored\n* pair — the no-op property) and mints a fresh pair only on first create.\n* Nothing to enumerate (`list` → `[]`) or tear down (`delete` → no-op; the pair\n* lives only in state). Exported so tests can drive it directly.\n*/\nconst s3CredentialsProviderService = {\n\tlist: () => Effect.succeed([]),\n\treconcile: ({ output }) => Effect.sync(() => output ?? mintKeyPair()),\n\tdelete: () => Effect.void\n};\n/** The `S3Credentials` provider layer — merged into the extension descriptor's `providers()`. */\nconst S3CredentialsProvider = () => Provider.effect(S3Credentials, Effect.succeed(s3CredentialsProviderService));\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 bucket = config.service[\"bucket\"];\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 a 'bucket' param\");\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/preflight.ts\n/**\n* Deploy preflight (ADR-0029, extended for env-sourced params): before Alchemy\n* runs, verify every secret binding AND every env-sourced param binding in the\n* app's manifests (each a platform env-var NAME) exists on Prisma Cloud for\n* the target stage. A literal-bound param never touches the platform — only\n* `envParam(...)` sources are checked here.\n* A name absent on the platform but present in the deploy shell is provisioned\n* via a direct Management API POST — NEVER an Alchemy resource, so the value\n* never lands in hosted deploy state. A name absent from both fails the deploy,\n* listing exactly what is missing and where to set it.\n*\n* Control-plane only (imported by control.ts → prisma-composer.config.ts); runs\n* in the CLI parent, so it builds its own Management API client from env — the\n* same credential path `container.ts`'s `ensure`/`locate` use.\n*/\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}\nasync function existsOnPlatform(client, projectId, branchId, key) {\n\tconst cls = classFor(branchId);\n\tconst visible = (row) => branchId === void 0 || row.branchId === null || row.branchId === branchId;\n\tlet cursor = null;\n\tdo {\n\t\tconst res = await listEnvVars(client, cursor === null ? {\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\tconst page = res.data;\n\t\tif (page === void 0) return false;\n\t\tif (page.data.some(visible)) return true;\n\t\tcursor = page.pagination.hasMore ? page.pagination.nextCursor : null;\n\t} while (cursor !== null);\n\treturn false;\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 writes config rows to,\n* EnvironmentVariable.ts). A 409 means a 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}\nconst tokenRequiredError$1 = () => /* @__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$1() {\n\tif ((process.env[\"PRISMA_SERVICE_TOKEN\"] ?? \"\").length === 0) throw tokenRequiredError$1();\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`. Aggregates the target-agnostic\n* manifests (core's `provisionManifest` for secrets, `paramManifest` filtered\n* to env-sourced bindings for params), checks each pointer name against the\n* platform, fills from the shell where possible, and fails loudly on anything\n* absent from both. Accepts an injected client for tests; otherwise builds one\n* from env.\n*/\nasync function runPreflight(input, deps) {\n\tconst { projectId, branchId } = prismaCloudContainerOf(input.container);\n\tconst names = /* @__PURE__ */ new Map();\n\tfor (const binding of provisionManifest(input.graph)) {\n\t\tconst name = secretName(binding);\n\t\tif (!names.has(name)) names.set(name, {\n\t\t\tname,\n\t\t\tserviceAddress: binding.serviceAddress\n\t\t});\n\t}\n\tfor (const binding of paramManifest(input.graph)) {\n\t\tif (!isEnvParamSource(binding.binding)) continue;\n\t\tconst name = paramName(binding);\n\t\tif (!names.has(name)) names.set(name, {\n\t\t\tname,\n\t\t\tserviceAddress: binding.serviceAddress\n\t\t});\n\t}\n\tif (names.size === 0) return;\n\tconst client = deps?.client ?? await managementClient$1();\n\tconst missing = [];\n\tfor (const meta of names.values()) {\n\t\tif (await existsOnPlatform(client, projectId, branchId, meta.name)) continue;\n\t\tconst shellValue = process.env[meta.name];\n\t\tif (shellValue !== void 0 && shellValue.length > 0) {\n\t\t\tawait fillMissing(client, projectId, branchId, meta.name, shellValue);\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}\n//#endregion\n//#region src/teardown.ts\nconst tokenRequiredError = () => /* @__PURE__ */ new Error(\"environment variable PRISMA_SERVICE_TOKEN is required for destroy teardown.\");\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 `teardown`. Removes the stage's state database,\n* with failure handling that differs by stage because the consequences do:\n*\n* - **Named stage: throw.** The Branch delete that follows would fail anyway —\n* the platform refuses a Branch that still has a database attached — so\n* failing here names the actual cause instead of a confusing symptom.\n* - **Production: warn and continue.** Nothing blocks the Project delete on\n* this; removing the database only stops production's state outliving\n* production and holding a quota slot. That is a cleanup step, and a cleanup\n* step must not fail the command.\n*\n* Accepts an injected client and ownership verifier for tests; otherwise\n* builds a client from env and verifies against the real database.\n*/\nasync function runTeardown(input, deps) {\n\tconst { projectId, branchId } = prismaCloudContainerOf(input.container);\n\tconst isNamedStage = branchId !== void 0;\n\ttry {\n\t\tconst client = deps?.client ?? await managementClient();\n\t\tawait Effect.runPromise(deleteStateDatabaseWith({\n\t\t\tprojectId,\n\t\t\t...branchId !== void 0 ? { branchId } : {}\n\t\t}, deps?.verify ?? verifyOwnership).pipe(Effect.provideService(ManagementClient, client)));\n\t} catch (error) {\n\t\tconst reason = error instanceof Error ? error.message : String(error);\n\t\tif (isNamedStage) throw new Error(`Failed to delete the deploy-state database: ${reason}`);\n\t\tconsole.warn(`Could not remove production's deploy-state database: ${reason}`);\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/** 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 } = prismaCloudContainerOf(container);\n\t\treturn prismaStateLayer(branchId !== void 0 ? {\n\t\t\tprojectId,\n\t\t\tbranchId\n\t\t} : { projectId });\n\t}\n});\nconst KNOWN_REGION_SET = new Set(Prisma.COMPUTE_REGIONS);\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 brands: 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(refs)` — 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([[RPC_PEER_KEY, rpcAcceptedKeysValue], [STREAMS_API_KEY, streamsApiKeyValue]]);\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(refs)`, so\n* `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\tvalue\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, failing fast with the exact\n* variable name.\n*/\nfunction resolveOptions(opts) {\n\tconst workspaceId = opts.workspaceId ?? process.env[\"PRISMA_WORKSPACE_ID\"];\n\tif (workspaceId === void 0 || workspaceId.length === 0) throw new Error(\"prismaCloud(): environment variable PRISMA_WORKSPACE_ID is required.\");\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.COMPUTE_REGIONS.join(\", \")}).`);\n\treturn {\n\t\tworkspaceId,\n\t\tregion,\n\t\tproviderParams: PROVIDER_PARAMS\n\t};\n}\n/** The Prisma Cloud extension descriptor — `prisma-composer.config.ts` lists it under `extensions`. */\nconst prismaCloud = (opts = {}) => {\n\tconst o = resolveOptions(opts);\n\treturn {\n\t\tid: PRISMA_CLOUD_EXTENSION_ID,\n\t\tcontainer: containerDescriptor(),\n\t\tproviders: () => asProvidersLayer(Layer.mergeAll(Prisma.providers(), PgWarmProvider(), PnMigrationProvider(), S3CredentialsProvider(), Prisma.ServiceKeyProvider())),\n\t\tpreflight: (input) => runPreflight(input),\n\t\tteardown: (input) => runTeardown(input),\n\t\tapplication: { provision: (ctx) => Effect.gen(function* () {\n\t\t\tconst { projectId, branchId } = prismaCloudContainerOf(ctx.container);\n\t\t\tfor (const key of [\"DATABASE_URL\", \"DATABASE_URL_POOLED\"]) yield* Prisma.EnvironmentVariable(`${key}-poison`, {\n\t\t\t\tprojectId,\n\t\t\t\tkey,\n\t\t\t\tvalue: \"-\",\n\t\t\t\tclass: branchId ? \"preview\" : \"production\",\n\t\t\t\t...branchId !== void 0 ? { branchId } : {}\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tprojectId,\n\t\t\t\tbranchId\n\t\t\t};\n\t\t}) },\n\t\tprovisions: PROVISIONERS,\n\t\tnodes: {\n\t\t\tpostgres: postgresDescriptor(o),\n\t\t\t\"prisma-next\": prismaNextDescriptor(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};\n};\n//#endregion\nexport { PROVIDER_PARAMS, buildProviderParams, prismaCloud, prismaState };\n\n//# source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5L,OAAO;EACN;EACA;EACA,gBAAgB;CACjB;AACD;;AAEA,MAAM,eAAe,OAAO,CAAC,MAAM;CAClC,MAAM,IAAI,eAAe,IAAI;CAC7B,OAAO;EACN,IAAI;EACJ,WAAW,oBAAoB;EAC/B,iBAAiB,iBAAiB,MAAM,SAASC,UAAiB,GAAG,eAAe,GAAG,oBAAoB,GAAG,sBAAsB,GAAGC,mBAA0B,CAAC,CAAC;EACnK,YAAY,UAAU,aAAa,KAAK;EACxC,WAAW,UAAU,YAAY,KAAK;EACtC,aAAa,EAAE,YAAY,QAAQ,OAAO,IAAI,aAAa;GAC1D,MAAM,EAAE,WAAW,aAAa,uBAAuB,IAAI,SAAS;GACpE,KAAK,MAAM,OAAO,CAAC,gBAAgB,qBAAqB,GAAG,OAAOR,oBAA2B,GAAG,IAAI,UAAU;IAC7G;IACA;IACA,OAAO;IACP,OAAO,WAAW,YAAY;IAC9B,GAAG,aAAa,KAAK,IAAI,EAAE,SAAS,IAAI,CAAC;GAC1C,CAAC;GACD,OAAO;IACN;IACA;GACD;EACD,CAAC,EAAE;EACH,YAAY;EACZ,OAAO;GACN,UAAU,mBAAmB,CAAC;GAC9B,eAAe,qBAAqB,CAAC;GACrC,SAAS,kBAAkB,CAAC;GAC5B,aAAa,wBAAwB,CAAC;GACtC,YAAY,kBAAkB,CAAC;GAC/B,IAAI,iBAAiB,CAAC;EACvB;CACD;AACD"}
1
+ {"version":3,"file":"control.mjs","names":["Prisma.Bucket","Prisma.BucketKey","Prisma.ComputeService","Prisma.EnvironmentVariable","Prisma.packageComputeArtifact","Prisma.Deployment","Prisma.Database","Prisma.Connection","managementClientLayer","Prisma.ServiceKey","Prisma.COMPUTE_REGIONS","Prisma.providers","Prisma.ServiceKeyProvider"],"sources":["../../../1-prisma-cloud/0-lowering/lowering/dist/state.mjs","../../../1-prisma-cloud/1-extensions/target/dist/control.mjs"],"sourcesContent":["import { a as ManagementClient, c as fromEnv, i as callVoid, n as call, o as layer, t as PrismaApiError } from \"./http-CJM0E6rj.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 { Stack } from \"alchemy\";\nimport * as Schedule from \"effect/Schedule\";\nimport postgres from \"postgres\";\nimport { STATE_STORE_VERSION, State, StateStoreError, encodeState, reviveStateRecursive } from \"alchemy/State\";\nimport { blindCast } from \"@internal/foundation/casts\";\n//#region src/state/discovery.ts\n/** The framework-owned database a stage's deploy state lives in — a child of that stage's Branch (ADR-0034). */\nconst STATE_DATABASE_NAME = \"prisma-composer-state\";\n/** Every connection created against a state database carries this prefix — see `cleanupAgedConnections`. */\nconst CONNECTION_NAME_PREFIX = \"prisma-composer-state-\";\nconst listAllBranches = (client, projectId) => Effect.gen(function* () {\n\tconst branches = [];\n\tlet cursor;\n\tfor (;;) {\n\t\tconst query = cursor === void 0 ? {} : { cursor };\n\t\tconst page = yield* call(() => client.GET(\"/v1/projects/{projectId}/branches\", { params: {\n\t\t\tpath: { projectId },\n\t\t\tquery\n\t\t} }));\n\t\tbranches.push(...page.data);\n\t\tif (!page.pagination.hasMore || page.pagination.nextCursor === null) break;\n\t\tcursor = page.pagination.nextCursor;\n\t}\n\treturn branches;\n});\n/**\n* The project's implicit default Branch — every live Project owns exactly\n* one (a platform invariant). The list endpoint has no `isDefault` filter, so\n* this pages through every Branch and picks it out client-side. Never creates\n* one: its absence means the platform's invariant is broken, which is not\n* something a deploy can repair.\n*/\nconst resolveDefaultBranchId = (client, projectId) => Effect.gen(function* () {\n\tconst found = (yield* listAllBranches(client, projectId)).find((b) => b.isDefault);\n\tif (found !== void 0) return found.id;\n\treturn yield* Effect.fail(new PrismaApiError({\n\t\tstatus: 0,\n\t\tmessage: `project ${projectId} has no default Branch — the platform guarantees every live Project owns one; contact support.`\n\t}));\n});\n/** A named stage carries its `branchId`; production omits it, and its state lives on the Project's default Branch. */\nconst resolveBranchId = (client, container) => container.branchId !== void 0 ? Effect.succeed(container.branchId) : resolveDefaultBranchId(client, container.projectId);\n/**\n* Every database on this Branch. Uses the flat `GET /v1/databases`, which\n* accepts `projectId` and `branchId` together — the project-scoped listing\n* has no branch filter at all.\n*/\nconst listAllDatabasesOnBranch = (client, projectId, branchId) => Effect.gen(function* () {\n\tconst databases = [];\n\tlet cursor;\n\tfor (;;) {\n\t\tconst query = cursor === void 0 ? {\n\t\t\tprojectId,\n\t\t\tbranchId\n\t\t} : {\n\t\t\tprojectId,\n\t\t\tbranchId,\n\t\t\tcursor\n\t\t};\n\t\tconst page = yield* call(() => client.GET(\"/v1/databases\", { params: { query } }));\n\t\tdatabases.push(...page.data);\n\t\tif (!page.pagination.hasMore || page.pagination.nextCursor === null) break;\n\t\tcursor = page.pagination.nextCursor;\n\t}\n\treturn databases;\n});\n/**\n* Databases on this Branch named `prisma-composer-state`, oldest first,\n* excluding the Branch's own default database. The default database is always\n* the user's, never ours to adopt or delete. A name match alone proves\n* nothing — the platform allows duplicate names — so every caller must still\n* verify ownership before acting on a candidate.\n*/\nconst listStateDatabaseCandidates = (client, projectId, branchId) => listAllDatabasesOnBranch(client, projectId, branchId).pipe(Effect.map((databases) => databases.filter((d) => d.name === \"prisma-composer-state\" && !d.isDefault).sort((a, b) => a.createdAt.localeCompare(b.createdAt))));\n/**\n* Creates a fresh Postgres connection and reads its connection string. Reads\n* `endpoints.direct.connectionString` only — never `endpoints.pooled`, and\n* never the deprecated top-level `connectionString`/`url` (PRO-212), neither\n* of which the platform guarantees.\n*\n* The connection string is returned only when the connection is created and\n* cannot be read back afterwards, which is why every run creates a fresh\n* connection instead of reusing one.\n*/\nconst createConnection = (client, databaseId) => call(() => client.POST(\"/v1/databases/{databaseId}/connections\", {\n\tparams: { path: { databaseId } },\n\tbody: { name: `${CONNECTION_NAME_PREFIX}${Date.now()}` }\n})).pipe(Effect.flatMap((r) => {\n\tconst created = r.data;\n\tconst dsn = created.endpoints.direct?.connectionString;\n\treturn dsn === void 0 ? Effect.fail(new PrismaApiError({\n\t\tstatus: 0,\n\t\tmessage: `connection ${created.id} returned no endpoints.direct.connectionString (PRO-212)`\n\t})) : Effect.succeed(Redacted.make(dsn));\n}));\n//#endregion\n//#region src/state/errors.ts\n/** Collapses any thrown value (postgres.js failures included) into a {@link StateStoreError}. */\nconst toStateStoreError = (cause) => cause instanceof Error ? new StateStoreError({\n\tmessage: cause.message,\n\tcause\n}) : new StateStoreError({ message: String(cause) });\n/**\n* An operator-facing failure from the hosted-state bootstrap pipeline\n* (branch/database discovery, connection creation, schema migration, or lock\n* acquisition) — what a deployer actually sees, instead of a raw Effect\n* 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 driver/API error object as `cause`: a\n* postgres.js connection failure's `.message`/properties are not verified to\n* omit the DSN or credentials, so only the extracted message text survives\n* into the operator-facing error.\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/schema.ts\n/**\n* The well-known marker row written into every database this store owns.\n* Its presence proves the database is genuinely Prisma App's state store, not\n* a same-named project squatting on the discovery query (see `bootstrap.ts`\n* `verifyOwnership` — PDP allows duplicate project names).\n*/\nconst STATE_META_MARKER = \"prisma-composer-state-v1\";\n/**\n* Idempotent schema migration for the Prisma-hosted state store — safe to run\n* on every deploy, since `create table if not exists` no-ops once the tables\n* exist. Run this against `sql` before serving a {@link StateService} built\n* by `makePrismaStateService` over the same client.\n*/\nconst migratePrismaState = (sql) => Effect.tryPromise({\n\ttry: async () => {\n\t\tawait sql`\n create table if not exists alchemy_resource_state (\n stack text not null,\n stage text not null,\n fqn text not null,\n value jsonb not null,\n updated_at timestamptz not null default now(),\n primary key (stack, stage, fqn)\n )\n `;\n\t\tawait sql`\n create table if not exists alchemy_stack_output (\n stack text not null,\n stage text not null,\n value jsonb not null,\n updated_at timestamptz not null default now(),\n primary key (stack, stage)\n )\n `;\n\t\tawait sql`\n create table if not exists prisma_app_state_meta (\n marker text primary key,\n created_at timestamptz not null default now()\n )\n `;\n\t\tawait sql`\n insert into prisma_app_state_meta (marker) values (${STATE_META_MARKER})\n on conflict (marker) do nothing\n `;\n\t},\n\tcatch: toStateStoreError\n});\n//#endregion\n//#region src/state/bootstrap.ts\nconst CONNECTION_MAX_AGE_MS = 1440 * 60 * 1e3;\n/**\n* Creates the state database on the stage's Branch, using the flat endpoint\n* because it is the only one that accepts a `branchId`. The platform still\n* creates the row on the project's default Branch and attaches it afterwards,\n* so a failed attach can leave a database behind on the default Branch. It\n* checks the Branch exists before creating, and this is one request instead of\n* two, so that window is much narrower than attaching from here — but it is\n* narrowed, not closed.\n*\n* `isDefault` is left at the API's `false` default: the state database must\n* never be the stage's default database, which belongs to the user.\n*/\nconst createStateDatabase = (client, projectId, branchId) => call(() => client.POST(\"/v1/databases\", { body: {\n\tprojectId,\n\tname: STATE_DATABASE_NAME,\n\tregion: \"inherit\",\n\tbranchId\n} })).pipe(Effect.map((created) => ({\n\tid: created.data.id,\n\tname: created.data.name,\n\tisDefault: created.data.isDefault,\n\tcreatedAt: created.data.createdAt\n})));\nconst listAllConnections = (client, databaseId) => Effect.gen(function* () {\n\tconst connections = [];\n\tlet cursor;\n\tfor (;;) {\n\t\tconst query = cursor === void 0 ? {} : { cursor };\n\t\tconst page = yield* call(() => client.GET(\"/v1/databases/{databaseId}/connections\", { params: {\n\t\t\tpath: { databaseId },\n\t\t\tquery\n\t\t} }));\n\t\tconnections.push(...page.data);\n\t\tif (!page.pagination.hasMore || page.pagination.nextCursor === null) break;\n\t\tcursor = page.pagination.nextCursor;\n\t}\n\treturn connections;\n});\nconst deleteConnection = (client, connectionId) => callVoid(() => client.DELETE(\"/v1/connections/{id}\", { params: { path: { id: connectionId } } }));\n/**\n* Every deploy creates a fresh connection (`createConnection`) and nothing ever\n* closes it, so the state database otherwise accumulates one connection\n* resource per run without bound. Best-effort, never blocks bootstrap: lists\n* this database's connections, deletes the ones matching our naming pattern\n* older than the age threshold, and swallows any failure (a transient API\n* error here must never fail the deploy it's cleaning up after).\n*/\nconst cleanupAgedConnections = (client, databaseId) => Effect.gen(function* () {\n\tconst connections = yield* listAllConnections(client, databaseId);\n\tconst cutoff = Date.now() - CONNECTION_MAX_AGE_MS;\n\tconst aged = connections.filter((c) => c.name.startsWith(\"prisma-composer-state-\") && Date.parse(c.createdAt) < cutoff);\n\tyield* Effect.forEach(aged, (c) => deleteConnection(client, c.id), { discard: true });\n}).pipe(Effect.ignore);\n/**\n* PDP allows duplicate database names, so a database named `prisma-composer-state`\n* found by listing is not proof it's ours — it could be an unrelated\n* database that happens to share the name (a squatter, deliberate or not).\n* Connects to the candidate and inspects its tables:\n*\n* - our marker table with our marker row present → `ours`, adopt outright.\n* - our state tables (`alchemy_resource_state`/`alchemy_stack_output`) but no\n* marker → `legacy`: a database from before this ownership check existed.\n* The real, currently-in-use workspace state is in this shape today, so it\n* must keep working — adopt it, and `migratePrismaState` (idempotent)\n* writes the marker on the way in.\n* - no tables at all → `empty`, a freshly-created database — adopt.\n* - anything else → `squatter`: foreign data occupies the name; refuse it.\n*/\nconst verifyOwnership = (connectionString) => Effect.tryPromise({\n\ttry: async () => {\n\t\tconst sql = postgres(Redacted.value(connectionString), {\n\t\t\tmax: 1,\n\t\t\tonnotice: () => {}\n\t\t});\n\t\ttry {\n\t\t\tconst rows = await sql`\n select tablename from pg_tables where schemaname = 'public'\n `;\n\t\t\tconst tables = new Set(rows.map((row) => row.tablename));\n\t\t\tif (tables.has(\"prisma_app_state_meta\")) return (await sql`\n select marker from prisma_app_state_meta where marker = ${\"prisma-composer-state-v1\"}\n `).length > 0 ? { kind: \"ours\" } : {\n\t\t\t\tkind: \"squatter\",\n\t\t\t\ttables: [...tables]\n\t\t\t};\n\t\t\tif (tables.has(\"alchemy_resource_state\") || tables.has(\"alchemy_stack_output\")) return { kind: \"legacy\" };\n\t\t\treturn tables.size === 0 ? { kind: \"empty\" } : {\n\t\t\t\tkind: \"squatter\",\n\t\t\t\ttables: [...tables]\n\t\t\t};\n\t\t} finally {\n\t\t\tawait sql.end({ timeout: 5 });\n\t\t}\n\t},\n\tcatch: (cause) => new PrismaApiError({\n\t\tstatus: 0,\n\t\tmessage: `ownership verification failed: ${cause instanceof Error ? cause.message : String(cause)}`\n\t})\n});\n/**\n* Finds the Branch's `prisma-composer-state` database, verifying ownership\n* rather than trusting the name alone (PDP allows duplicate names — see\n* `verifyOwnership`). Finding none creates one, with nothing to verify: only\n* this run can have touched a database it just created.\n*\n* Candidates are tried oldest first, so repeated runs pick the same one. The\n* first that verifies as ours is used. A candidate that fails verification is\n* skipped. If every candidate fails, bootstrap fails and names each rejected\n* database id, so an operator knows which to rename or remove.\n*/\nconst resolveStateDatabase = (client, projectId, branchId, verify) => Effect.gen(function* () {\n\tconst candidates = yield* listStateDatabaseCandidates(client, projectId, branchId);\n\tif (candidates.length === 0) {\n\t\tconst database = yield* createStateDatabase(client, projectId, branchId);\n\t\tconst connectionString = yield* createConnection(client, database.id);\n\t\tconsole.error(`hosted state: provisioned state database ${database.id} on branch ${branchId} (project ${projectId})`);\n\t\treturn {\n\t\t\tdatabase,\n\t\t\tconnectionString\n\t\t};\n\t}\n\tconst rejected = [];\n\tfor (const candidate of candidates) {\n\t\tconst connectionString = yield* createConnection(client, candidate.id);\n\t\tconst verdict = yield* verify(connectionString);\n\t\tif (verdict.kind === \"squatter\") {\n\t\t\trejected.push(`${candidate.id} (foreign tables: ${verdict.tables.join(\", \")})`);\n\t\t\tcontinue;\n\t\t}\n\t\tconsole.error(`hosted state: using state database ${candidate.id} on branch ${branchId} (${verdict.kind}) — ${candidates.length} candidate(s) named ${STATE_DATABASE_NAME}`);\n\t\treturn {\n\t\t\tdatabase: candidate,\n\t\t\tconnectionString\n\t\t};\n\t}\n\treturn yield* Effect.fail(new PrismaApiError({\n\t\tstatus: 0,\n\t\tmessage: `found ${candidates.length} database(s) named \"${STATE_DATABASE_NAME}\" on branch ${branchId}, but none verified as Composer's state store: ${rejected.join(\"; \")}. Rename or remove the offending database(s).`\n\t}));\n});\n/**\n* Resolves the stage's Branch, find-or-creates its `prisma-composer-state`\n* database, and creates a fresh connection — the automatic bootstrap every\n* deploy runs once, needing nothing beyond the service token and the\n* Project/Branch ids the CLI already resolved.\n*/\nconst bootstrapStateConnection = (container) => bootstrapStateConnectionWith(container, verifyOwnership);\n/**\n* Identical to {@link bootstrapStateConnection}, except the ownership check is\n* a parameter so `bootstrap.test.ts` can supply a fake instead of opening a\n* real Postgres connection.\n*/\nconst bootstrapStateConnectionWith = (container, verify) => Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\tconst branchId = yield* resolveBranchId(client, container);\n\tconst { database, connectionString } = yield* resolveStateDatabase(client, container.projectId, branchId, verify);\n\tyield* cleanupAgedConnections(client, database.id);\n\treturn {\n\t\tprojectId: container.projectId,\n\t\tdatabaseId: database.id,\n\t\tconnectionString\n\t};\n});\n//#endregion\n//#region src/state/delete.ts\nconst deleteDatabase = (client, databaseId) => callVoid(() => client.DELETE(\"/v1/databases/{databaseId}\", { params: { path: { databaseId } } }));\n/**\n* Removes the stage's state database, so the CLI's destroy leaves nothing\n* behind: for a named stage the Branch cannot be deleted while this database\n* is still a live member, and for production it would otherwise outlive the\n* stage and hold a quota slot.\n*\n* Every candidate is checked for our ownership marker before deletion —\n* deleting by name alone would destroy a user's database that happens to\n* share the name. All owned candidates are removed, not just the first: a\n* crashed earlier run can leave duplicates, and they are all ours. Finding\n* none succeeds, which is what makes a retried destroy a no-op.\n*/\nconst deleteStateDatabase = (container) => deleteStateDatabaseWith(container, verifyOwnership);\n/**\n* Identical to {@link deleteStateDatabase}, except the ownership check is a\n* parameter so tests can supply a fake instead of opening a real Postgres\n* connection.\n*/\nconst deleteStateDatabaseWith = (container, verify) => Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\tconst branchId = yield* resolveBranchId(client, container);\n\tconst candidates = yield* listStateDatabaseCandidates(client, container.projectId, branchId);\n\tfor (const candidate of candidates) {\n\t\tconst verdict = yield* verify(yield* createConnection(client, candidate.id));\n\t\tif (verdict.kind === \"squatter\") {\n\t\t\tconsole.warn(`hosted state: left database ${candidate.id} on branch ${branchId} alone — it is named ${STATE_DATABASE_NAME} but holds unrelated data (tables: ${verdict.tables.join(\", \")}).`);\n\t\t\tcontinue;\n\t\t}\n\t\tyield* deleteDatabase(client, candidate.id);\n\t\tconsole.error(`hosted state: removed state database ${candidate.id} from branch ${branchId}`);\n\t}\n});\n//#endregion\n//#region src/state/transient.ts\n/** Codes for \"can't reach the host yet\" — DNS/refusal, not a mid-session drop. */\nconst ESTABLISHMENT_CODES = /* @__PURE__ */ new Set([\n\t\"ECONNREFUSED\",\n\t\"ENOTFOUND\",\n\t\"EAI_AGAIN\"\n]);\n/** Connection-establishment failure messages (no useful `err.code`). `upstream database` is PPg's edge proxy while a cold/idle upstream warms up. */\nconst ESTABLISHMENT_MESSAGE_FRAGMENTS = [\"upstream database\", \"connection refused\"];\n/**\n* Whether a failure is a connection-establishment error against a warming\n* upstream (retry), as opposed to a lost lease, a mid-session drop, or a real\n* query error (all of which must surface at once). Unwraps a\n* {@link StateStoreError} to its driver `cause` so a code-only error still\n* classifies.\n*/\nconst isColdStartConnectError = (error) => {\n\tif (typeof error !== \"object\" || error === null) return false;\n\tconst code = \"code\" in error && typeof error.code === \"string\" ? error.code : void 0;\n\tif (code !== void 0 && ESTABLISHMENT_CODES.has(code)) return true;\n\tconst message = \"message\" in error && typeof error.message === \"string\" ? error.message.toLowerCase() : \"\";\n\tif (ESTABLISHMENT_MESSAGE_FRAGMENTS.some((fragment) => message.includes(fragment))) return true;\n\tconst cause = \"cause\" in error ? error.cause : void 0;\n\treturn cause !== void 0 && cause !== error && isColdStartConnectError(cause);\n};\n/** The same ~2-minute budget the bootstrap migration uses (`layer.ts`): retry every 5s, up to 2 minutes. */\nconst COLD_START_SCHEDULE = Schedule.both(Schedule.spaced(\"5 seconds\"), Schedule.during(\"2 minutes\"));\n/**\n* Retries a state operation past a cold-start connection rejection only; every\n* other failure surfaces immediately. `schedule` is injectable so tests drive\n* it without real delay.\n*/\nconst retryColdStart = (operation, schedule = COLD_START_SCHEDULE) => Effect.retry(operation, {\n\twhile: isColdStartConnectError,\n\tschedule\n});\n//#endregion\n//#region src/state/lock.ts\n/** Another deploy already holds the lock for this stack/stage. Never queued — fails immediately. */\nvar StateLockContentionError = class extends Data.TaggedError(\"StateLockContentionError\") {\n\tget message() {\n\t\treturn `another deploy holds the state lock for ${this.stack}/${this.stage}`;\n\t}\n};\nconst lockKey = (stack, stage) => `prisma-composer:${stack}/${stage}`;\n/**\n* Acquires a session-scoped Postgres advisory lock on a reserved\n* connection pulled from `sql`'s pool — session (not transaction) scope,\n* because a transaction-scoped lock releases at the first commit and a\n* deploy spans many. Held for the run's whole lifetime; contention fails\n* immediately rather than queuing. If the process crashes, the reserved\n* connection drops and Postgres auto-releases the session lock — no\n* explicit crash-recovery bookkeeping needed.\n*/\nconst acquireStateLock = (sql, stack, stage) => Effect.gen(function* () {\n\tconst key = lockKey(stack, stage);\n\tconst reserved = yield* Effect.tryPromise({\n\t\ttry: () => sql.reserve(),\n\t\tcatch: toStateStoreError\n\t});\n\tconst acquired = yield* Effect.tryPromise({\n\t\ttry: async () => {\n\t\t\treturn (await reserved`\n select\n pg_try_advisory_lock(hashtextextended(${key}, 0)) as acquired,\n pg_backend_pid() as pid\n `)[0];\n\t\t},\n\t\tcatch: toStateStoreError\n\t});\n\tif (acquired?.acquired !== true) {\n\t\treserved.release();\n\t\treturn yield* Effect.fail(new StateLockContentionError({\n\t\t\tstack,\n\t\t\tstage\n\t\t}));\n\t}\n\tconst lockPid = acquired.pid;\n\tconst checkLive = retryColdStart(Effect.tryPromise({\n\t\ttry: async () => {\n\t\t\treturn (await sql`\n select exists (\n select 1 from pg_locks\n where locktype = 'advisory'\n and pid = ${lockPid}\n and objsubid = 1\n and granted\n and ((classid::bigint << 32) | (objid::bigint & 4294967295))\n = hashtextextended(${key}, 0)\n ) as live\n `)[0]?.live ?? false;\n\t\t},\n\t\tcatch: toStateStoreError\n\t}).pipe(Effect.flatMap((live) => live ? Effect.void : Effect.fail(new StateStoreError({ message: `the state lock for ${stack}/${stage} was lost mid-run; refusing to continue unlocked` })))));\n\tconst release = async () => {\n\t\ttry {\n\t\t\tawait reserved`select pg_advisory_unlock(hashtextextended(${key}, 0))`;\n\t\t} catch {} finally {\n\t\t\treserved.release();\n\t\t}\n\t};\n\treturn {\n\t\tcheckLive,\n\t\trelease\n\t};\n});\n//#endregion\n//#region src/state/service.ts\nconst attempt = (f) => retryColdStart(Effect.tryPromise({\n\ttry: f,\n\tcatch: toStateStoreError\n}));\n/**\n* Wraps an already-`encodeState`d value as a jsonb-typed bind parameter.\n* Must go through `sql.json(...)` (not `JSON.stringify(...)::jsonb`) —\n* postgres.js re-serializes the parameter once it learns the server-inferred\n* type is jsonb, so a pre-stringified value passed through a `::jsonb` cast\n* gets JSON-encoded *twice* and lands as a jsonb string instead of an\n* object. `sql.json` gives postgres.js the raw value up front and declares\n* the jsonb oid itself, so it is serialized exactly once.\n*/\nconst jsonParam = (sql, value) => sql.json(blindCast(encodeState(value)));\n/**\n* `reviveStateRecursive` is typed to return `unknown` — the caller is\n* expected to know the shape it revived. Here the shape is known by\n* construction: every row was written by `set()`, which persists a value\n* through `encodeState` first, so reviving it recovers a `PersistedState`.\n*/\nconst revivePersistedState = (value) => blindCast(reviveStateRecursive(value));\n/** Same reasoning as {@link revivePersistedState}, narrowed by the SQL status filter. */\nconst reviveReplacedResourceState = (value) => blindCast(reviveStateRecursive(value));\n/**\n* Builds alchemy's `StateService` over a caller-supplied postgres.js client,\n* against the two-table schema `migratePrismaState` creates. The caller owns\n* the client's lifecycle (connection pooling, reconnects, `.end()`); this\n* factory only issues queries.\n*/\nconst makePrismaStateService = (sql) => ({\n\tid: \"prisma-postgres\",\n\tgetVersion: () => Effect.succeed(STATE_STORE_VERSION),\n\tlistStacks: () => attempt(() => sql`\n select stack from alchemy_resource_state\n union\n select stack from alchemy_stack_output\n order by stack\n `).pipe(Effect.map((rows) => rows.map((row) => row.stack))),\n\tlistStages: (stack) => attempt(() => sql`\n select stage from alchemy_resource_state where stack = ${stack}\n union\n select stage from alchemy_stack_output where stack = ${stack}\n order by stage\n `).pipe(Effect.map((rows) => rows.map((row) => row.stage))),\n\tget: (request) => attempt(() => sql`\n select value from alchemy_resource_state\n where stack = ${request.stack} and stage = ${request.stage} and fqn = ${request.fqn}\n `).pipe(Effect.map((rows) => {\n\t\tconst row = rows[0];\n\t\treturn row === void 0 ? void 0 : revivePersistedState(row.value);\n\t})),\n\tgetReplacedResources: (request) => attempt(() => sql`\n select value from alchemy_resource_state\n where stack = ${request.stack} and stage = ${request.stage}\n and value ->> 'status' = 'replaced'\n `).pipe(Effect.map((rows) => rows.map((row) => reviveReplacedResourceState(row.value)))),\n\tset: (request) => attempt(() => sql`\n insert into alchemy_resource_state (stack, stage, fqn, value, updated_at)\n values (\n ${request.stack}, ${request.stage}, ${request.fqn},\n ${jsonParam(sql, request.value)}, now()\n )\n on conflict (stack, stage, fqn) do update\n set value = excluded.value, updated_at = excluded.updated_at\n `).pipe(Effect.map(() => request.value)),\n\tdelete: (request) => attempt(() => sql`\n delete from alchemy_resource_state\n where stack = ${request.stack} and stage = ${request.stage} and fqn = ${request.fqn}\n `).pipe(Effect.asVoid),\n\tdeleteStack: (request) => attempt(async () => {\n\t\tif (request.stage === void 0) {\n\t\t\tawait sql`delete from alchemy_resource_state where stack = ${request.stack}`;\n\t\t\tawait sql`delete from alchemy_stack_output where stack = ${request.stack}`;\n\t\t} else {\n\t\t\tawait sql`\n delete from alchemy_resource_state\n where stack = ${request.stack} and stage = ${request.stage}\n `;\n\t\t\tawait sql`\n delete from alchemy_stack_output\n where stack = ${request.stack} and stage = ${request.stage}\n `;\n\t\t}\n\t}),\n\tlist: (request) => attempt(() => sql`\n select fqn from alchemy_resource_state\n where stack = ${request.stack} and stage = ${request.stage}\n order by fqn\n `).pipe(Effect.map((rows) => rows.map((row) => row.fqn))),\n\tgetOutput: (request) => attempt(() => sql`\n select value from alchemy_stack_output\n where stack = ${request.stack} and stage = ${request.stage}\n `).pipe(Effect.map((rows) => {\n\t\tconst row = rows[0];\n\t\treturn row === void 0 ? void 0 : reviveStateRecursive(row.value);\n\t})),\n\tsetOutput: (request) => attempt(() => sql`\n insert into alchemy_stack_output (stack, stage, value, updated_at)\n values (${request.stack}, ${request.stage}, ${jsonParam(sql, request.value)}, now())\n on conflict (stack, stage) do update\n set value = excluded.value, updated_at = excluded.updated_at\n `).pipe(Effect.map(() => request.value))\n});\n/**\n* How long a passing lease check is trusted before the next storage\n* operation re-verifies it. A deploy issues many state ops in quick\n* succession, and each raw `checkLive` is a `pg_locks` round-trip; without\n* amortization the guard roughly doubles the store's traffic. The cost of the\n* window is bounded: a lease lost mid-window is detected within this many ms,\n* not instantly — an accepted tradeoff on top of the already-accepted\n* non-atomic (TOCTOU) gap between the check and the operation.\n*/\nconst LEASE_CHECK_TTL_MS = 5e3;\n/**\n* Amortizes a lease check over a short TTL: a *passing* check is trusted for\n* `ttlMs`, so a burst of operations inside the window does one round-trip, not\n* one per op. A *failing* check is never cached — it propagates immediately\n* and leaves the last-good timestamp untouched, so the very next op re-checks.\n* The `lastOkAt` state is captured per call, so each store (each layer) gets\n* its own window — two stores in one process never share a cached success.\n*/\nconst amortizeCheck = (checkLive, ttlMs, now) => {\n\tlet lastOkAt;\n\treturn Effect.suspend(() => {\n\t\tif (lastOkAt !== void 0 && now() - lastOkAt < ttlMs) return Effect.void;\n\t\treturn checkLive.pipe(Effect.tap(() => Effect.sync(() => {\n\t\t\tlastOkAt = now();\n\t\t})));\n\t});\n};\n/**\n* Wraps a {@link StateService} so every method that touches storage first\n* re-verifies the state lock's lease via `checkLive`. Used to enforce \"a\n* dropped lock connection fails loudly\" — see {@link ../lock.ts}. The check is\n* amortized over a short TTL (see {@link amortizeCheck}), so a run of\n* back-to-back operations does not fire one `pg_locks` round-trip per call.\n*\n* Reads are gated too, not just writes: a lost lease means a concurrent\n* deploy may already be mutating this stack's rows, so a read could return\n* stale or conflicting data — untrustworthy either way, not just the writes.\n* The check is best-effort and not atomic with the operation it guards (the\n* lease could be lost in the gap between `checkLive` passing and the wrapped\n* call executing, or within the TTL window); that residual race is accepted.\n*\n* `getVersion` is excluded: it returns a compile-time constant\n* (`STATE_STORE_VERSION`), so guarding it would only add a pointless\n* reserved-connection round-trip.\n*\n* `now` is injectable so tests can advance the clock deterministically; it\n* defaults to `Date.now` (fine in library runtime code — only Workflow\n* scripts forbid it).\n*/\nconst guardStateService = (service, checkLive, now = Date.now) => {\n\tconst guard = amortizeCheck(checkLive, LEASE_CHECK_TTL_MS, now);\n\treturn {\n\t\tid: service.id,\n\t\tgetVersion: () => service.getVersion(),\n\t\tlistStacks: () => guard.pipe(Effect.andThen(service.listStacks())),\n\t\tlistStages: (stack) => guard.pipe(Effect.andThen(service.listStages(stack))),\n\t\tget: (request) => guard.pipe(Effect.andThen(service.get(request))),\n\t\tgetReplacedResources: (request) => guard.pipe(Effect.andThen(service.getReplacedResources(request))),\n\t\tset: (request) => guard.pipe(Effect.andThen(service.set(request))),\n\t\tdelete: (request) => guard.pipe(Effect.andThen(service.delete(request))),\n\t\tdeleteStack: (request) => guard.pipe(Effect.andThen(service.deleteStack(request))),\n\t\tlist: (request) => guard.pipe(Effect.andThen(service.list(request))),\n\t\tgetOutput: (request) => guard.pipe(Effect.andThen(service.getOutput(request))),\n\t\tsetOutput: (request) => guard.pipe(Effect.andThen(service.setOutput(request)))\n\t};\n};\n//#endregion\n//#region src/state/layer.ts\n/**\n* The hosted Alchemy state store. On layer init (scoped, once per stack\n* run): resolve the stage's Branch, find-or-create its `prisma-composer-state`\n* database, create a fresh connection, migrate the schema, and acquire the\n* (stack, stage) advisory lock — see `bootstrap.ts` and `lock.ts`. The\n* Management API plumbing (`ManagementClient`, `PrismaCredentials`) is\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/lock/migration failure is wrapped into an operator-facing\n* `HostedStateBootstrapError` (naming the Project/Branch and the step that\n* failed, never the raw driver/API error — see `errors.ts`) before dying the\n* layer (loud, immediate, unrecoverable) rather than surfacing as a typed\n* error — matching core's `LowerOptions.state: Layer.Layer<State, never,\n* StackServices>` contract and alchemy's own convention (e.g. a missing\n* state store is `Effect.die` in `Stack.make`).\n*/\nconst prismaStateLayer = (ids) => {\n\tconst { projectId, branchId } = ids;\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 { connectionString } = yield* bootstrapStateConnection(branchId === void 0 ? { projectId } : {\n\t\t\tprojectId,\n\t\t\tbranchId\n\t\t}).pipe(Effect.provide(layer().pipe(Layer.provide(fromEnv()))), Effect.mapError(bootstrapError(\"resolving the state database on the stage branch\")));\n\t\tconst sql = postgres(Redacted.value(connectionString), {\n\t\t\tmax: 5,\n\t\t\tonnotice: () => {}\n\t\t});\n\t\tyield* Effect.addFinalizer(() => Effect.promise(() => sql.end({ timeout: 5 })));\n\t\tyield* migratePrismaState(sql).pipe(Effect.retry(Schedule.both(Schedule.spaced(\"5 seconds\"), Schedule.during(\"2 minutes\"))), Effect.mapError(bootstrapError(\"schema migration\")));\n\t\tconst lock = yield* acquireStateLock(sql, stack.name, stack.stage).pipe(Effect.mapError(bootstrapError(\"lock acquisition\")));\n\t\tyield* Effect.addFinalizer(() => Effect.promise(() => lock.release()));\n\t\tconst service = guardStateService(makePrismaStateService(sql), lock.checkLive);\n\t\treturn Effect.succeed(service);\n\t})).pipe(Layer.orDie);\n};\n//#endregion\nexport { deleteStateDatabase, deleteStateDatabaseWith, makePrismaStateService, migratePrismaState, prismaStateLayer, verifyOwnership };\n\n//# sourceMappingURL=state.mjs.map","import { a as encode, l as secretPointerRows, n as configKey, o as encodeParamPointer, s as paramEntries } from \"./serializer-CJiOhF2d.mjs\";\nimport { n as RESERVED_PROVIDER_PARAMS, o as SELF_ORIGIN, r as STREAMS_API_KEY, t as provisionedEdges } from \"./provisioned-edges-C1wSO3cx.mjs\";\nimport { i as paramName, r as paramBindingFor } from \"./param-BTzY0ne5.mjs\";\nimport { a as PnMigrationProvider, c as PgWarmProvider, d as containerDescriptor, i as PnMigration, l as PRISMA_CLOUD_EXTENSION_ID, n as S3Credentials, o as resolveTargetRef, p as prismaCloudContainerOf, r as S3CredentialsProvider, s as PgWarm, t as collectPreflightNames } from \"./preflight-names-BPL-qsZF.mjs\";\nimport { n as isPnPostgresResourceNode } from \"./prisma-next-BvBwGCIt.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 { ManagementClient, fromEnv, managementClientLayer } from \"@internal/lowering\";\nimport { deleteStateDatabaseWith, prismaStateLayer, verifyOwnership } from \"@internal/lowering/state\";\nimport * as Output from \"alchemy/Output\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Redacted from \"effect/Redacted\";\nimport { loadConfig } from \"@prisma-next/config-loader\";\nimport { resolve } from \"pathe\";\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\");\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//#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 BucketKey is minted for the bucket: it is the reveal-once credential\n* 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.Bucket(`${id}-bucket`, {\n\t\t\tprojectId: projectIdOf(application),\n\t\t\tname: id,\n\t\t\t...branchId !== void 0 ? { branchId } : {}\n\t\t});\n\t\tconst key = yield* Prisma.BucketKey(`${id}-key`, {\n\t\t\tbucketId: bkt.id,\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.id\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* 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.ComputeService(`${id}-svc`, {\n\t\t\t\tprojectId,\n\t\t\t\tname: id,\n\t\t\t\tregion: 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.id,\n\t\t\t\tprojectId,\n\t\t\t\tendpointDomain: svc.endpointDomain\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 records = [];\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\trecords.push(yield* Prisma.EnvironmentVariable(`${key}-var`, {\n\t\t\t\t\tprojectId,\n\t\t\t\t\tkey,\n\t\t\t\t\tvalue: rowValue,\n\t\t\t\t\tclass: cls,\n\t\t\t\t\t...branch\n\t\t\t\t}));\n\t\t\t}\n\t\t\tfor (const { key, name } of secretPointerRows(svc, address, graph.secrets)) records.push(yield* Prisma.EnvironmentVariable(`${key}-var`, {\n\t\t\t\tprojectId,\n\t\t\t\tkey,\n\t\t\t\tvalue: name,\n\t\t\t\tclass: cls,\n\t\t\t\t...branch\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\trecords.push(yield* Prisma.EnvironmentVariable(`${key}-var`, {\n\t\t\t\t\tprojectId,\n\t\t\t\t\tkey,\n\t\t\t\t\tvalue,\n\t\t\t\t\tclass: cls,\n\t\t\t\t\t...branch\n\t\t\t\t}));\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tenvironment: records,\n\t\t\t\tport: typeof config.service[\"port\"] === \"number\" ? config.service[\"port\"] : 3e3\n\t\t\t};\n\t\t}),\n\t\tpackage: ({ id }, { assembled, address }) => Effect.try(() => Prisma.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 deployment = yield* Prisma.Deployment(`${id}-deploy`, {\n\t\t\t\tcomputeServiceId: provisioned.serviceId,\n\t\t\t\tartifactPath: artifact.path,\n\t\t\t\tartifactHash: artifact.sha256,\n\t\t\t\tenvironment: serialized.environment,\n\t\t\t\tport: serialized.port\n\t\t\t});\n\t\t\treturn {\n\t\t\t\toutputs: {\n\t\t\t\t\turl: deployment.deployedUrl,\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.deployedUrl\n\t\t\t\t}]\n\t\t\t};\n\t\t})\n\t};\n}\n//#endregion\n//#region src/descriptors/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 postgresDescriptor(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 db = yield* Prisma.Database(`${id}-db`, {\n\t\t\tprojectId: projectIdOf(application),\n\t\t\tname: id,\n\t\t\tregion: o().region ?? \"us-east-1\",\n\t\t\t...branchId !== void 0 ? { branchId } : {}\n\t\t});\n\t\tconst conn = yield* Prisma.Connection(`${id}-conn`, {\n\t\t\tdatabaseId: db.id,\n\t\t\tname: id\n\t\t});\n\t\tconst url = Output.map(conn.connectionString, (value) => Redacted.value(value));\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.id\n\t\t\t}]\n\t\t};\n\t});\n\treturn Object.assign(lowering, { kind: \"resource\" });\n}\n//#endregion\n//#region src/pn-config.ts\n/**\n* Resolves a `pnPostgres` resource's `prisma-next.config.ts` path to the\n* on-disk migrations directory the control client's `migrate`/`dbInit` needs\n* (ADR-0022, slice 2). Deploy-time only: loads PN's config (via c12) and\n* applies PN's own convention — `migrations.dir`, or the default `migrations/`,\n* relative to the config file's directory (mirrors the CLI's\n* `resolveMigrationPaths`). Imported by `control.ts` + tests, never by\n* `index.ts` / the `./prisma-next` authoring entry.\n*\n* `pathe` (not `node:path`) does the path work so the shipped source carries no\n* `node:` import — the same discipline `control.ts` already follows by\n* delegating fs/tar to `@internal/lowering` (invariant 5).\n*/\n/** The absolute migrations directory PN reads authored migration packages from. */\nasync function resolveMigrationsDir(configPath) {\n\treturn resolve(configPath, \"..\", (await loadConfig(configPath)).migrations?.dir ?? \"migrations\");\n}\n//#endregion\n//#region src/descriptors/prisma-next.ts\n/**\n* The migration is a tracked `PnMigration` 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 prismaNextDescriptor(o) {\n\tconst lowering = ({ id, node, application }) => Effect.gen(function* () {\n\t\tvalidateName(id, \"resource name (from provision id)\");\n\t\tconst branchId = cloudApplicationOf(application).branchId;\n\t\tconst db = yield* Prisma.Database(`${id}-db`, {\n\t\t\tprojectId: projectIdOf(application),\n\t\t\tname: id,\n\t\t\tregion: o().region ?? \"us-east-1\",\n\t\t\t...branchId !== void 0 ? { branchId } : {}\n\t\t});\n\t\tconst conn = yield* Prisma.Connection(`${id}-conn`, {\n\t\t\tdatabaseId: db.id,\n\t\t\tname: id\n\t\t});\n\t\tconst url = Output.map(conn.connectionString, (value) => Redacted.value(value));\n\t\tif (!isPnPostgresResourceNode(node)) throw new Error(`prisma-next lowering received a non-prisma-next node (${id}).`);\n\t\tconst contractJson = node.provides.__cmp.contractJson;\n\t\tconst migrationsDir = yield* Effect.promise(() => resolveMigrationsDir(node.config));\n\t\tconst ref = yield* Effect.promise(() => resolveTargetRef(migrationsDir, contractJson, node.targetRef));\n\t\tconst warm = yield* PgWarm(`${id}-warm`, { url });\n\t\tyield* PnMigration(`${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\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.id\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 bucket = config.service[\"bucket\"];\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 a 'bucket' param\");\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/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}\nasync function existsOnPlatform(client, projectId, branchId, key) {\n\tconst cls = classFor(branchId);\n\tconst visible = (row) => branchId === void 0 || row.branchId === null || row.branchId === branchId;\n\tlet cursor = null;\n\tdo {\n\t\tconst res = await listEnvVars(client, cursor === null ? {\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\tconst page = res.data;\n\t\tif (page === void 0) return false;\n\t\tif (page.data.some(visible)) return true;\n\t\tcursor = page.pagination.hasMore ? page.pagination.nextCursor : null;\n\t} while (cursor !== null);\n\treturn false;\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 writes config rows to,\n* EnvironmentVariable.ts). A 409 means a 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}\nconst tokenRequiredError$1 = () => /* @__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$1() {\n\tif ((process.env[\"PRISMA_SERVICE_TOKEN\"] ?? \"\").length === 0) throw tokenRequiredError$1();\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`. Aggregates the target-agnostic\n* manifests (core's `provisionManifest` for secrets, `paramManifest` filtered\n* to env-sourced bindings for params), checks each pointer name against the\n* platform, fills from the shell where possible, and fails loudly on anything\n* absent from both. Accepts an injected client for tests; otherwise builds one\n* 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;\n\tconst client = deps?.client ?? await managementClient$1();\n\tconst missing = [];\n\tfor (const meta of names.values()) {\n\t\tif (await existsOnPlatform(client, projectId, branchId, meta.name)) continue;\n\t\tconst shellValue = process.env[meta.name];\n\t\tif (shellValue !== void 0 && shellValue.length > 0) {\n\t\t\tawait fillMissing(client, projectId, branchId, meta.name, shellValue);\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}\n//#endregion\n//#region src/teardown.ts\nconst tokenRequiredError = () => /* @__PURE__ */ new Error(\"environment variable PRISMA_SERVICE_TOKEN is required for destroy teardown.\");\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 `teardown`. Removes the stage's state database,\n* with failure handling that differs by stage because the consequences do:\n*\n* - **Named stage: throw.** The Branch delete that follows would fail anyway —\n* the platform refuses a Branch that still has a database attached — so\n* failing here names the actual cause instead of a confusing symptom.\n* - **Production: warn and continue.** Nothing blocks the Project delete on\n* this; removing the database only stops production's state outliving\n* production and holding a quota slot. That is a cleanup step, and a cleanup\n* step must not fail the command.\n*\n* Accepts an injected client and ownership verifier for tests; otherwise\n* builds a client from env and verifies against the real database.\n*/\nasync function runTeardown(input, deps) {\n\tconst { projectId, branchId } = prismaCloudContainerOf(input.container);\n\tconst isNamedStage = branchId !== void 0;\n\ttry {\n\t\tconst client = deps?.client ?? await managementClient();\n\t\tawait Effect.runPromise(deleteStateDatabaseWith({\n\t\t\tprojectId,\n\t\t\t...branchId !== void 0 ? { branchId } : {}\n\t\t}, deps?.verify ?? verifyOwnership).pipe(Effect.provideService(ManagementClient, client)));\n\t} catch (error) {\n\t\tconst reason = error instanceof Error ? error.message : String(error);\n\t\tif (isNamedStage) throw new Error(`Failed to delete the deploy-state database: ${reason}`);\n\t\tconsole.warn(`Could not remove production's deploy-state database: ${reason}`);\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(`ComputeService for \"${address}\" reported no endpointDomain 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 } = prismaCloudContainerOf(container);\n\t\treturn prismaStateLayer(branchId !== void 0 ? {\n\t\t\tprojectId,\n\t\t\tbranchId\n\t\t} : { projectId });\n\t}\n});\nconst KNOWN_REGION_SET = new Set(Prisma.COMPUTE_REGIONS);\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.COMPUTE_REGIONS.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) {\n\tlet cached;\n\treturn () => {\n\t\tcached ??= resolveOptions(opts);\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 o = lazyOptions(opts);\n\treturn {\n\t\tid: PRISMA_CLOUD_EXTENSION_ID,\n\t\tcontainer: containerDescriptor(),\n\t\tproviders: () => asProvidersLayer(Layer.mergeAll(Prisma.providers(), PgWarmProvider(), PnMigrationProvider(), S3CredentialsProvider(), Prisma.ServiceKeyProvider())),\n\t\tpreflight: (input) => runPreflight(input),\n\t\tteardown: (input) => runTeardown(input),\n\t\tapplication: { provision: (ctx) => Effect.gen(function* () {\n\t\t\tconst { projectId, branchId } = prismaCloudContainerOf(ctx.container);\n\t\t\tfor (const key of [\"DATABASE_URL\", \"DATABASE_URL_POOLED\"]) yield* Prisma.EnvironmentVariable(`${key}-poison`, {\n\t\t\t\tprojectId,\n\t\t\t\tkey,\n\t\t\t\tvalue: \"-\",\n\t\t\t\tclass: branchId ? \"preview\" : \"production\",\n\t\t\t\t...branchId !== void 0 ? { branchId } : {}\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tprojectId,\n\t\t\t\tbranchId\n\t\t\t};\n\t\t}) },\n\t\tprovisions: PROVISIONERS,\n\t\tnodes: {\n\t\t\tpostgres: postgresDescriptor(o),\n\t\t\t\"prisma-next\": prismaNextDescriptor(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":";;;;;;;;;;;;;;;;;;;;;AAYA,MAAM,sBAAsB;;AAE5B,MAAM,yBAAyB;AAC/B,MAAM,mBAAmB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