@prisma/composer-cli 0.34.0-dev.5 → 0.34.0-dev.7

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 (39) hide show
  1. package/dist/{dev-current-hGle--BH-DHFSz_ur.mjs → dev-current-BB02pfSh-vMKS1rYi.mjs} +6 -6
  2. package/dist/{dev-current-hGle--BH-DHFSz_ur.mjs.map → dev-current-BB02pfSh-vMKS1rYi.mjs.map} +1 -1
  3. package/dist/{dist-D1c-3NFX.mjs → dist-B9-nLeho.mjs} +2 -2
  4. package/dist/{dist-D1c-3NFX.mjs.map → dist-B9-nLeho.mjs.map} +1 -1
  5. package/dist/{execute-deploy-destroy-iO4yn-3Q-5rmMfeg8.mjs → execute-deploy-destroy-DwcoZIks-CiW-dlB1.mjs} +7 -13
  6. package/dist/execute-deploy-destroy-DwcoZIks-CiW-dlB1.mjs.map +1 -0
  7. package/dist/{execute-dev-DQMSVQn9-DL5eWfNL.mjs → execute-dev-BHRWoEnd-DrGMSTD3.mjs} +7 -7
  8. package/dist/{execute-dev-DQMSVQn9-DL5eWfNL.mjs.map → execute-dev-BHRWoEnd-DrGMSTD3.mjs.map} +1 -1
  9. package/dist/{execute-dev-current-C8e554e4-CR_Z_5cs.mjs → execute-dev-current-D4RkOtPA-BFoZ0cXm.mjs} +6 -6
  10. package/dist/{execute-dev-current-C8e554e4-CR_Z_5cs.mjs.map → execute-dev-current-D4RkOtPA-BFoZ0cXm.mjs.map} +1 -1
  11. package/dist/{family-CsvN_3rK-CxpRZHs6.d.mts → family-xJ6y4fXc-CFBu6q4b.d.mts} +29 -28
  12. package/dist/family-xJ6y4fXc-CFBu6q4b.d.mts.map +1 -0
  13. package/dist/family.d.mts +35 -4
  14. package/dist/family.d.mts.map +1 -1
  15. package/dist/family.mjs +86 -6
  16. package/dist/family.mjs.map +1 -1
  17. package/dist/{generate-dev-stack-CfneNj97-YWn8z26x.mjs → generate-dev-stack-CfneNj97-Yx3Z2-9u.mjs} +2 -2
  18. package/dist/{generate-dev-stack-CfneNj97-YWn8z26x.mjs.map → generate-dev-stack-CfneNj97-Yx3Z2-9u.mjs.map} +1 -1
  19. package/dist/list-deployed-D2oBL0V5.mjs +354 -0
  20. package/dist/list-deployed-D2oBL0V5.mjs.map +1 -0
  21. package/dist/{local-target-Pro_jmzo.mjs → local-target-CK8gvYV4.mjs} +2 -2
  22. package/dist/{local-target-Pro_jmzo.mjs.map → local-target-CK8gvYV4.mjs.map} +1 -1
  23. package/dist/{pipeline-C06OEvKd-B_vvzzSY.mjs → pipeline-BmWt-Nhb-Bos4TFXR.mjs} +24 -4
  24. package/dist/{pipeline-C06OEvKd-B_vvzzSY.mjs.map → pipeline-BmWt-Nhb-Bos4TFXR.mjs.map} +1 -1
  25. package/dist/{composer-config-ehUUVHtU-Db7akNFy.mjs → run-alchemy-Dl_MWw4g-DaWV9tkH.mjs} +318 -318
  26. package/dist/run-alchemy-Dl_MWw4g-DaWV9tkH.mjs.map +1 -0
  27. package/dist/testing.d.mts +1 -1
  28. package/dist/testing.mjs +2 -2
  29. package/dist/testing.mjs.map +1 -1
  30. package/dist/validate-stage-DxRW3MwT-DOWCXHa_.mjs +13 -0
  31. package/dist/validate-stage-DxRW3MwT-DOWCXHa_.mjs.map +1 -0
  32. package/package.json +9 -7
  33. package/src/exports/family.ts +8 -1
  34. package/src/family/deploy-list.ts +96 -0
  35. package/src/family/deployed-nodes.ts +55 -0
  36. package/src/family/list-deployed.ts +64 -0
  37. package/dist/composer-config-ehUUVHtU-Db7akNFy.mjs.map +0 -1
  38. package/dist/execute-deploy-destroy-iO4yn-3Q-5rmMfeg8.mjs.map +0 -1
  39. package/dist/family-CsvN_3rK-CxpRZHs6.d.mts.map +0 -1
@@ -0,0 +1,354 @@
1
+ import { a as notOk, c as CliStructuredError, o as ok } from "./run-alchemy-Dl_MWw4g-DaWV9tkH.mjs";
2
+ import { n as resolveAppIdentity } from "./pipeline-BmWt-Nhb-Bos4TFXR.mjs";
3
+ import { t as validateStageName } from "./validate-stage-DxRW3MwT-DOWCXHa_.mjs";
4
+ import "effect/Layer";
5
+ import * as Context from "effect/Context";
6
+ import * as Effect from "effect/Effect";
7
+ import "effect/Config";
8
+ import "@prisma/management-api-sdk";
9
+ import "effect/Redacted";
10
+ import * as Data from "effect/Data";
11
+ Context.Service()("PrismaComposerCredentials");
12
+ //#endregion
13
+ //#region ../../1-prisma-cloud/0-lowering/lowering/dist/container-CBwmCl4q.mjs
14
+ /**
15
+ * The typed Prisma Management API client, built once from the resolved
16
+ * credentials. Providers yield this in their outer Effect and call it inside
17
+ * `reconcile` / `delete`.
18
+ */
19
+ var ManagementClient = class extends Context.Service()("PrismaManagementClient") {};
20
+ /** A non-2xx response from the Management API (or a transport failure). */
21
+ var PrismaApiError = class extends Data.TaggedError("PrismaApiError") {};
22
+ const attempt = (f) => Effect.tryPromise({
23
+ try: f,
24
+ catch: (cause) => new PrismaApiError({
25
+ status: 0,
26
+ message: String(cause)
27
+ })
28
+ });
29
+ const fail = (r) => Effect.fail(new PrismaApiError({
30
+ status: r.response.status,
31
+ message: JSON.stringify(r.error)
32
+ }));
33
+ /** Unwrap `data`, failing on any API error. Preserves the SDK's response type. */
34
+ const call = (f) => attempt(f).pipe(Effect.flatMap((r) => r.error !== void 0 || r.data === void 0 ? fail(r) : Effect.succeed(r.data)));
35
+ /** Unwrap `data`, mapping a 404 to `undefined` (resource gone / not found). */
36
+ const 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)));
37
+ /** Far beyond any real collection size per listing; hitting it means the API's pagination is broken. */
38
+ const MAX_PAGES = 1e3;
39
+ const brokenPaginationError = (description, reason) => new PrismaApiError({
40
+ status: 0,
41
+ message: `listing ${description} ${reason} — the Management API pagination appears broken; refusing to continue with a possibly incomplete listing.`
42
+ });
43
+ /** {@link drivePages} in its most common shape: every page's rows, accumulated. */
44
+ const collectPages = (description, fetchPage) => Effect.gen(function* () {
45
+ const rows = [];
46
+ yield* drivePages(description, fetchPage, (data) => {
47
+ rows.push(...data);
48
+ return false;
49
+ });
50
+ return rows;
51
+ });
52
+ /**
53
+ * Drives a cursor-paginated Management API listing with a guard against
54
+ * broken pagination: a cursor that does not advance, more pages reported
55
+ * without a cursor to fetch them with, or more than {@link MAX_PAGES} pages,
56
+ * FAILS instead of hanging forever or returning a listing known to be
57
+ * incomplete. `onPage` receives each page's rows as they arrive; returning
58
+ * `true` stops early (the caller found what it wanted).
59
+ */
60
+ const drivePages = (description, fetchPage, onPage) => Effect.gen(function* () {
61
+ let cursor;
62
+ for (let pageCount = 0;; pageCount++) {
63
+ if (pageCount >= MAX_PAGES) return yield* Effect.fail(brokenPaginationError(description, `did not finish within ${String(MAX_PAGES)} pages`));
64
+ const page = yield* fetchPage(cursor);
65
+ if (onPage(page.data)) return;
66
+ if (!page.pagination.hasMore) return;
67
+ const next = page.pagination.nextCursor;
68
+ if (next === null) return yield* Effect.fail(brokenPaginationError(description, "reported more pages but returned no cursor"));
69
+ if (next === cursor) return yield* Effect.fail(brokenPaginationError(description, "returned a non-advancing cursor"));
70
+ cursor = next;
71
+ }
72
+ });
73
+ /** Raised with `ensure: false` when the app's Project (or a named stage's Branch) doesn't exist. */
74
+ var ContainerNotFoundError = class extends Data.TaggedError("ContainerNotFoundError") {};
75
+ const listAllProjects = (client) => collectPages("projects", (cursor) => call(() => client.GET("/v1/projects", { params: { query: cursor === void 0 ? {} : { cursor } } })));
76
+ /**
77
+ * Workspace ids circulate in two shapes: `wksp_`-prefixed and bare. Compare
78
+ * bare-to-bare so a `wksp_`-prefixed API id still matches a bare configured
79
+ * one (the same normalization `state/bootstrap.ts` applies to the same
80
+ * `/v1/projects` listing).
81
+ */
82
+ const bareWorkspaceId = (id) => id.startsWith("wksp_") ? id.slice(5) : id;
83
+ /**
84
+ * Finds the app's Project by logical id or name in the workspace, creating
85
+ * one if absent. Logical id match (exact, workspace-unique) is preferred over
86
+ * display-name match (oldest-wins fallback for projects without a logical id).
87
+ * Creates one if none match, unless `ensure` is `false` (find-only —
88
+ * `destroy`), in which case an absent Project fails with
89
+ * `ContainerNotFoundError`. No ownership marker and no `--project` override
90
+ * (both deferred — see ADR-0019).
91
+ */
92
+ const resolveProject = (client, workspaceId, appName, ensure, region) => Effect.gen(function* () {
93
+ const workspaceProjects = (yield* listAllProjects(client)).filter((p) => bareWorkspaceId(p.workspace.id) === bareWorkspaceId(workspaceId));
94
+ const logicalIdMatch = workspaceProjects.find((p) => p.logicalId != null && p.logicalId === appName);
95
+ if (logicalIdMatch !== void 0) return logicalIdMatch.id;
96
+ const nameMatch = workspaceProjects.filter((p) => p.name === appName).sort((a, b) => a.createdAt.localeCompare(b.createdAt))[0];
97
+ if (nameMatch !== void 0) return nameMatch.id;
98
+ if (!ensure) return yield* Effect.fail(new ContainerNotFoundError({ appName }));
99
+ if (region === void 0) return yield* Effect.fail(new PrismaApiError({
100
+ status: 0,
101
+ message: `project "${appName}" does not exist yet and no deploy region is configured. Set the region via prismaCloud({ region: '<id>' }) in your config, or set the PRISMA_REGION environment variable`
102
+ }));
103
+ return (yield* call(() => client.POST("/v1/projects", { body: {
104
+ name: appName,
105
+ workspaceId,
106
+ createDatabase: false,
107
+ logicalId: appName,
108
+ region
109
+ } })).pipe(Effect.catch((err) => err.status === 409 ? Effect.fail(new PrismaApiError({
110
+ status: 409,
111
+ message: "a project with this name already exists in the workspace; rename your Composer module or free the name."
112
+ })) : Effect.fail(err)))).data.id;
113
+ });
114
+ /**
115
+ * The project's implicit default Branch — every live Project owns exactly
116
+ * one (a platform invariant). The list endpoint has no `isDefault` filter,
117
+ * so this pages through the Branches (bounded — drivePages) and returns as
118
+ * soon as a page contains it. Never creates one: its absence means the
119
+ * platform's invariant is broken, which is not something a deploy can
120
+ * repair.
121
+ */
122
+ const resolveDefaultBranchId = (client, projectId) => Effect.gen(function* () {
123
+ let found;
124
+ yield* drivePages(`branches of project ${projectId}`, (cursor) => call(() => client.GET("/v1/projects/{projectId}/branches", { params: {
125
+ path: { projectId },
126
+ query: cursor === void 0 ? {} : { cursor }
127
+ } })), (data) => {
128
+ found = data.find((b) => b.isDefault)?.id;
129
+ return found !== void 0;
130
+ });
131
+ if (found !== void 0) return found;
132
+ return yield* Effect.fail(new PrismaApiError({
133
+ status: 0,
134
+ message: `project ${projectId} has no default Branch — the platform guarantees every live Project owns one; contact support.`
135
+ }));
136
+ });
137
+ const findBranchId = (client, projectId, gitName) => call(() => client.GET("/v1/projects/{projectId}/branches", { params: {
138
+ path: { projectId },
139
+ query: { gitName }
140
+ } })).pipe(Effect.map((page) => page.data[0]?.id));
141
+ /**
142
+ * Finds the stage's Branch by its exact `gitName`, creating it if absent
143
+ * unless `ensure` is `false` (find-only — `destroy`), in which case an
144
+ * absent Branch fails with `ContainerNotFoundError`. The Management API has
145
+ * no server-side "create-or-return" idempotency (`POST
146
+ * /v1/projects/:id/branches` 409s on a duplicate `gitName`, with no request
147
+ * field to make that a no-op), so idempotency is client-side: observe
148
+ * first, and on a racing 409 from create, re-observe rather than fail.
149
+ */
150
+ const resolveBranch = (client, projectId, gitName, appName, ensure) => Effect.gen(function* () {
151
+ const existing = yield* findBranchId(client, projectId, gitName);
152
+ if (existing !== void 0) return existing;
153
+ if (!ensure) return yield* Effect.fail(new ContainerNotFoundError({
154
+ appName,
155
+ stage: gitName
156
+ }));
157
+ return yield* call(() => client.POST("/v1/projects/{projectId}/branches", {
158
+ params: { path: { projectId } },
159
+ body: { gitName }
160
+ })).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)));
161
+ });
162
+ /**
163
+ * Resolves the two containers a stage's deploy runs into (ADR-0019): the
164
+ * app's **Project**, found-or-created by name, and — for a named stage
165
+ * only — its **Branch**, found-or-created by `gitName`. The default stage
166
+ * (no `stage`) creates no Branch; `branchId` is omitted, and the project's
167
+ * default Branch's id is read into `defaultBranchId` instead. With `ensure:
168
+ * false` (`destroy`), nothing is created — an absent Project or Branch
169
+ * fails with `ContainerNotFoundError` instead.
170
+ */
171
+ const resolveContainer = (opts) => Effect.gen(function* () {
172
+ const client = yield* ManagementClient;
173
+ const ensure = opts.ensure ?? true;
174
+ const projectId = yield* resolveProject(client, opts.workspaceId, opts.appName, ensure, opts.region);
175
+ if (opts.stage === void 0) return {
176
+ projectId,
177
+ defaultBranchId: yield* resolveDefaultBranchId(client, projectId)
178
+ };
179
+ return {
180
+ projectId,
181
+ branchId: yield* resolveBranch(client, projectId, opts.stage, opts.appName, ensure)
182
+ };
183
+ });
184
+ //#endregion
185
+ //#region ../../1-prisma-cloud/0-lowering/lowering/dist/deployed.mjs
186
+ const program = (input) => Effect.gen(function* () {
187
+ const container = yield* resolveContainer({
188
+ workspaceId: input.workspaceId,
189
+ appName: input.appName,
190
+ ensure: false,
191
+ ...input.stage === void 0 ? {} : { stage: input.stage }
192
+ });
193
+ const { projectId } = container;
194
+ const branchId = container.branchId ?? container.defaultBranchId;
195
+ if (branchId === void 0) return yield* Effect.die(/* @__PURE__ */ new Error(`project ${projectId} resolved no stage Branch`));
196
+ const client = yield* ManagementClient;
197
+ const topology = yield* callOptional(() => client.GET("/v1/projects/{projectId}/branches/{branchId}/application-topology", { params: { path: {
198
+ projectId,
199
+ branchId
200
+ } } }));
201
+ if (topology === void 0 || topology.data.nodes.length === 0) return {
202
+ projectId,
203
+ branchId,
204
+ nodes: [],
205
+ services: [],
206
+ databases: [],
207
+ buckets: []
208
+ };
209
+ const query = (cursor) => cursor === void 0 ? {
210
+ projectId,
211
+ branchId
212
+ } : {
213
+ projectId,
214
+ branchId,
215
+ cursor
216
+ };
217
+ const services = yield* collectPages(`services of branch ${branchId}`, (cursor) => call(() => client.GET("/v1/services", { params: { query: query(cursor) } })));
218
+ const databases = yield* collectPages(`databases of branch ${branchId}`, (cursor) => call(() => client.GET("/v1/databases", { params: { query: query(cursor) } })));
219
+ const buckets = yield* collectPages(`buckets of branch ${branchId}`, (cursor) => call(() => client.GET("/v1/buckets", { params: { query: query(cursor) } })));
220
+ return {
221
+ projectId,
222
+ branchId,
223
+ nodes: topology.data.nodes.map(({ logicalId, parentLogicalId, kind, type }) => ({
224
+ logicalId,
225
+ parentLogicalId,
226
+ kind,
227
+ ...type === void 0 ? {} : { type }
228
+ })),
229
+ services: services.map(({ id, logicalId, appEndpointDomain }) => ({
230
+ id,
231
+ logicalId,
232
+ appEndpointDomain
233
+ })),
234
+ databases: databases.map(({ id, logicalId }) => ({
235
+ id,
236
+ logicalId
237
+ })),
238
+ buckets: buckets.map(({ id, logicalId }) => ({
239
+ id,
240
+ logicalId
241
+ }))
242
+ };
243
+ });
244
+ /**
245
+ * Reads what a stage has deployed: its Project and Branch by the same
246
+ * find-only lookup `destroy` uses, the application topology the last deploy
247
+ * wrote, and the Branch's services, databases and buckets. `undefined` when
248
+ * there is no Project or no Branch. Rejects on any other Management API
249
+ * failure.
250
+ */
251
+ async function readDeployedStage(client, input) {
252
+ return Effect.runPromise(program(input).pipe(Effect.catchTag("ContainerNotFoundError", () => Effect.succeed(void 0)), Effect.catchTag("PrismaApiError", (error) => Effect.fail(/* @__PURE__ */ new Error(`Prisma Management API error: ${error.message}.`))), Effect.provideService(ManagementClient, client)));
253
+ }
254
+ /** The platform row each Prisma Cloud resource type deploys to. A type missing here, such as an S3 credentials resource, has no row. */
255
+ const RESOURCE_ROW_KINDS = /* @__PURE__ */ new Map([
256
+ ["postgres", "database"],
257
+ ["raw-postgres", "database"],
258
+ ["s3", "bucket"]
259
+ ]);
260
+ //#endregion
261
+ //#region src/family/deployed-nodes.ts
262
+ function kindOf(node) {
263
+ if (node.parentLogicalId === null) return "project";
264
+ if (node.kind === "resource") {
265
+ if (node.type === void 0) return "resource";
266
+ const rowKind = RESOURCE_ROW_KINDS.get(node.type);
267
+ if (rowKind === "database") return "postgres";
268
+ return rowKind ?? node.type;
269
+ }
270
+ return node.kind;
271
+ }
272
+ function rowId(rows, logicalId) {
273
+ return rows.find((row) => row.logicalId === logicalId)?.id ?? null;
274
+ }
275
+ function deployedNode(stage, node) {
276
+ const kind = kindOf(node);
277
+ const address = node.logicalId;
278
+ switch (kind) {
279
+ case "project": return {
280
+ address,
281
+ kind,
282
+ platformId: stage.projectId,
283
+ url: null
284
+ };
285
+ case "service": {
286
+ const row = stage.services.find((service) => service.logicalId === address);
287
+ return {
288
+ address,
289
+ kind,
290
+ platformId: row?.id ?? null,
291
+ url: row?.appEndpointDomain ?? null
292
+ };
293
+ }
294
+ case "postgres": return {
295
+ address,
296
+ kind,
297
+ platformId: rowId(stage.databases, address),
298
+ url: null
299
+ };
300
+ case "bucket": return {
301
+ address,
302
+ kind,
303
+ platformId: rowId(stage.buckets, address),
304
+ url: null
305
+ };
306
+ default: return {
307
+ address,
308
+ kind,
309
+ platformId: null,
310
+ url: null
311
+ };
312
+ }
313
+ }
314
+ /** Every node of the stage's topology, in topology order, joined by `logicalId` to the platform row it deployed to. The root's row is the Project. */
315
+ function deployedNodes(stage) {
316
+ return stage.nodes.map((node) => deployedNode(stage, node));
317
+ }
318
+ //#endregion
319
+ //#region src/family/list-deployed.ts
320
+ function notFound(app, stage) {
321
+ return new CliStructuredError("DEPLOY.TARGET_NOT_FOUND", `Nothing deployed for ${app}${stage === void 0 ? "" : `/${stage}`}.`, { fix: "Deploy it first." });
322
+ }
323
+ function lookupFailed(error) {
324
+ return new CliStructuredError("DEPLOY.CONTAINER_FAILED", error instanceof Error ? error.message : String(error), { cause: error });
325
+ }
326
+ /** Every node the app has deployed on the stage, or `DEPLOY.TARGET_NOT_FOUND` when the stage has no Project, Branch or topology. */
327
+ async function listDeployed(input) {
328
+ let app;
329
+ try {
330
+ if (input.stage !== void 0) validateStageName(input.stage);
331
+ app = (await resolveAppIdentity(input.entry, input.name, input.cwd, input.config)).name;
332
+ } catch (error) {
333
+ if (CliStructuredError.is(error)) return notOk(error);
334
+ throw error;
335
+ }
336
+ if (input.workspaceId === void 0) return notOk(lookupFailed(/* @__PURE__ */ new Error("environment variable PRISMA_WORKSPACE_ID is required.")));
337
+ let stage;
338
+ try {
339
+ stage = await readDeployedStage(input.client, {
340
+ workspaceId: input.workspaceId,
341
+ appName: app,
342
+ stage: input.stage
343
+ });
344
+ } catch (error) {
345
+ return notOk(lookupFailed(error));
346
+ }
347
+ const nodes = stage === void 0 ? [] : deployedNodes(stage);
348
+ if (nodes.length === 0) return notOk(notFound(app, input.stage));
349
+ return ok(nodes);
350
+ }
351
+ //#endregion
352
+ export { listDeployed };
353
+
354
+ //# sourceMappingURL=list-deployed-D2oBL0V5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-deployed-D2oBL0V5.mjs","names":[],"sources":["../../../1-prisma-cloud/0-lowering/lowering/dist/credentials-CVP8rTgb.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/container-CBwmCl4q.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/deployed.mjs","../src/family/deployed-nodes.ts","../src/family/list-deployed.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Config from \"effect/Config\";\n//#region package.json\nvar version = \"0.34.0-dev.7\";\n//#endregion\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()(\"PrismaComposerCredentials\") {};\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}));\nconst DEFAULT_BASE_URL = \"https://api.prisma.io\";\nconst isLoopbackHost = (hostname) => hostname === \"localhost\" || hostname.endsWith(\".localhost\") || hostname === \"127.0.0.1\" || hostname === \"[::1]\";\n/** Same validation as upstream alchemy's `PrismaEnvironment`: an HTTP(S) origin, HTTPS unless loopback, no credentials, no path/query/fragment. */\nconst normalizeBaseUrl = (value) => Effect.try({\n\ttry: () => {\n\t\tconst url = new URL(value);\n\t\tif (url.protocol !== \"https:\" && url.protocol !== \"http:\") throw new Error(\"Prisma Management API URL must use HTTP or HTTPS.\");\n\t\tif (url.username.length > 0 || url.password.length > 0) throw new Error(\"Prisma Management API URL must not contain credentials.\");\n\t\tif (url.protocol === \"http:\" && !isLoopbackHost(url.hostname)) throw new Error(\"Prisma Management API URL must use HTTPS unless it targets a loopback host.\");\n\t\tif (url.pathname !== \"/\" && url.pathname !== \"\" || url.search.length > 0 || url.hash.length > 0) throw new Error(\"Prisma Management API URL must be an origin without a path, query, or fragment.\");\n\t\treturn url.origin;\n\t},\n\tcatch: (cause) => cause instanceof Error ? cause : /* @__PURE__ */ new Error(`Invalid Prisma Management API URL: ${String(cause)}`)\n});\n/**\n* Headers the Management API records in its deploy analytics: which tool sent\n* the request, and whether it ran in GitHub Actions. The API behaves the same\n* without them.\n*/\nconst deploySourceHeaders = () => ({\n\t\"x-prisma-deploy-source\": process.env[\"GITHUB_ACTIONS\"] === \"true\" ? \"github-action\" : \"composer\",\n\t\"x-prisma-client-name\": \"composer\",\n\t\"x-prisma-client-version\": version\n});\n/**\n* The Management API origin every Prisma-Cloud client in this package uses —\n* Composer's own SDK client AND upstream alchemy's postgres providers resolve\n* it through this one function, so `PRISMA_API_URL` can never point them at\n* different hosts. Mirrors upstream alchemy's `PrismaEnvironment` resolution:\n* `PRISMA_API_URL`, then `PRISMA_MANAGEMENT_API_URL`, then the public origin,\n* normalized and validated identically.\n*/\nconst managementApiBaseUrl = (env) => env !== void 0 ? normalizeBaseUrl(env[\"PRISMA_API_URL\"] || env[\"PRISMA_MANAGEMENT_API_URL\"] || DEFAULT_BASE_URL) : Config.String(\"PRISMA_API_URL\").pipe(Config.orElse(() => Config.String(\"PRISMA_MANAGEMENT_API_URL\")), Config.withDefault(DEFAULT_BASE_URL), Effect.flatMap(normalizeBaseUrl));\n//#endregion\nexport { managementApiBaseUrl as i, deploySourceHeaders as n, fromEnv as r, PrismaCredentials as t };\n\n//# sourceMappingURL=credentials-CVP8rTgb.mjs.map","import { i as managementApiBaseUrl, n as deploySourceHeaders, t as PrismaCredentials } from \"./credentials-CVP8rTgb.mjs\";\nimport { 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 Data from \"effect/Data\";\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\") {};\n/**\n* By default the base URL comes from `managementApiBaseUrl()` — the SAME\n* resolver upstream's providers use (see providers.ts), so `PRISMA_API_URL`\n* can never split the postgres family and the compute/bucket/state clients\n* across hosts. `apiOrigin` overrides it (tests point it at a fake).\n*/\nconst layer = (options) => Layer.effect(ManagementClient, Effect.gen(function* () {\n\tconst { token } = yield* PrismaCredentials;\n\tconst baseUrl = options?.apiOrigin ?? (yield* managementApiBaseUrl());\n\treturn createManagementApiClient({\n\t\ttoken: Redacted.value(token),\n\t\tbaseUrl,\n\t\theaders: deploySourceHeaders()\n\t});\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/**\n* Fire a CREATE call, tolerating a 409 (it already exists). Gives the caller\n* create-only semantics: the thing is created when absent, and an existing one\n* — whoever created it — is left exactly as it is.\n*/\nconst callCreateOnly = (f) => attempt(f).pipe(Effect.flatMap((r) => r.response.status === 409 || r.error === void 0 ? Effect.void : fail(r)));\n//#endregion\n//#region src/pagination.ts\n/** Far beyond any real collection size per listing; hitting it means the API's pagination is broken. */\nconst MAX_PAGES = 1e3;\nconst brokenPaginationError = (description, reason) => new PrismaApiError({\n\tstatus: 0,\n\tmessage: `listing ${description} ${reason} — the Management API pagination appears broken; refusing to continue with a possibly incomplete listing.`\n});\n/** {@link drivePages} in its most common shape: every page's rows, accumulated. */\nconst collectPages = (description, fetchPage) => Effect.gen(function* () {\n\tconst rows = [];\n\tyield* drivePages(description, fetchPage, (data) => {\n\t\trows.push(...data);\n\t\treturn false;\n\t});\n\treturn rows;\n});\n/**\n* Drives a cursor-paginated Management API listing with a guard against\n* broken pagination: a cursor that does not advance, more pages reported\n* without a cursor to fetch them with, or more than {@link MAX_PAGES} pages,\n* FAILS instead of hanging forever or returning a listing known to be\n* incomplete. `onPage` receives each page's rows as they arrive; returning\n* `true` stops early (the caller found what it wanted).\n*/\nconst drivePages = (description, fetchPage, onPage) => Effect.gen(function* () {\n\tlet cursor;\n\tfor (let pageCount = 0;; pageCount++) {\n\t\tif (pageCount >= MAX_PAGES) return yield* Effect.fail(brokenPaginationError(description, `did not finish within ${String(MAX_PAGES)} pages`));\n\t\tconst page = yield* fetchPage(cursor);\n\t\tif (onPage(page.data)) return;\n\t\tif (!page.pagination.hasMore) return;\n\t\tconst next = page.pagination.nextCursor;\n\t\tif (next === null) return yield* Effect.fail(brokenPaginationError(description, \"reported more pages but returned no cursor\"));\n\t\tif (next === cursor) return yield* Effect.fail(brokenPaginationError(description, \"returned a non-advancing cursor\"));\n\t\tcursor = next;\n\t}\n});\n/**\n* {@link drivePages} for Promise-based callers (e.g. target's preflight,\n* which speaks the SDK's `{data, error}` shape directly). Same guard, same\n* errors; deliberately a sibling loop rather than a wrapper, because routing\n* a Promise fetch through Effect and back (`Effect.tryPromise` +\n* `runPromise`) would re-wrap the caller's own thrown errors. `fetchPage`\n* rejections propagate untouched.\n*/\nasync function drivePagesAsync(description, fetchPage, onPage) {\n\tlet cursor;\n\tfor (let pageCount = 0;; pageCount++) {\n\t\tif (pageCount >= MAX_PAGES) throw brokenPaginationError(description, `did not finish within ${String(MAX_PAGES)} pages`);\n\t\tconst page = await fetchPage(cursor);\n\t\tif (onPage(page.data)) return;\n\t\tif (!page.pagination.hasMore) return;\n\t\tconst next = page.pagination.nextCursor;\n\t\tif (next === null) throw brokenPaginationError(description, \"reported more pages but returned no cursor\");\n\t\tif (next === cursor) throw brokenPaginationError(description, \"returned a non-advancing cursor\");\n\t\tcursor = next;\n\t}\n}\n//#endregion\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) => collectPages(\"projects\", (cursor) => call(() => client.GET(\"/v1/projects\", { params: { query: cursor === void 0 ? {} : { cursor } } })));\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 logical id or name in the workspace, creating\n* one if absent. Logical id match (exact, workspace-unique) is preferred over\n* display-name match (oldest-wins fallback for projects without a logical id).\n* Creates one if none match, unless `ensure` is `false` (find-only —\n* `destroy`), in which case an absent Project fails with\n* `ContainerNotFoundError`. No ownership marker and no `--project` override\n* (both deferred — see ADR-0019).\n*/\nconst resolveProject = (client, workspaceId, appName, ensure, region) => Effect.gen(function* () {\n\tconst workspaceProjects = (yield* listAllProjects(client)).filter((p) => bareWorkspaceId(p.workspace.id) === bareWorkspaceId(workspaceId));\n\tconst logicalIdMatch = workspaceProjects.find((p) => p.logicalId != null && p.logicalId === appName);\n\tif (logicalIdMatch !== void 0) return logicalIdMatch.id;\n\tconst nameMatch = workspaceProjects.filter((p) => p.name === appName).sort((a, b) => a.createdAt.localeCompare(b.createdAt))[0];\n\tif (nameMatch !== void 0) return nameMatch.id;\n\tif (!ensure) return yield* Effect.fail(new ContainerNotFoundError({ appName }));\n\tif (region === void 0) return yield* Effect.fail(new PrismaApiError({\n\t\tstatus: 0,\n\t\tmessage: `project \"${appName}\" does not exist yet and no deploy region is configured. Set the region via prismaCloud({ region: '<id>' }) in your config, or set the PRISMA_REGION environment variable`\n\t}));\n\treturn (yield* call(() => client.POST(\"/v1/projects\", { body: {\n\t\tname: appName,\n\t\tworkspaceId,\n\t\tcreateDatabase: false,\n\t\tlogicalId: appName,\n\t\tregion\n\t} })).pipe(Effect.catch((err) => err.status === 409 ? Effect.fail(new PrismaApiError({\n\t\tstatus: 409,\n\t\tmessage: \"a project with this name already exists in the workspace; rename your Composer module or free the name.\"\n\t})) : Effect.fail(err)))).data.id;\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,\n* so this pages through the Branches (bounded — drivePages) and returns as\n* soon as a page contains it. Never creates one: its absence means the\n* platform's invariant is broken, which is not something a deploy can\n* repair.\n*/\nconst resolveDefaultBranchId = (client, projectId) => Effect.gen(function* () {\n\tlet found;\n\tyield* drivePages(`branches of project ${projectId}`, (cursor) => call(() => client.GET(\"/v1/projects/{projectId}/branches\", { params: {\n\t\tpath: { projectId },\n\t\tquery: cursor === void 0 ? {} : { cursor }\n\t} })), (data) => {\n\t\tfound = data.find((b) => b.isDefault)?.id;\n\t\treturn found !== void 0;\n\t});\n\tif (found !== void 0) return found;\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});\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, and the project's\n* default Branch's id is read into `defaultBranchId` instead. 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, opts.region);\n\tif (opts.stage === void 0) return {\n\t\tprojectId,\n\t\tdefaultBranchId: yield* resolveDefaultBranchId(client, projectId)\n\t};\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\nexport { resolveDefaultBranchId as a, drivePagesAsync as c, callCreateOnly as d, callOptional as f, resolveContainer as i, PrismaApiError as l, layer as m, deleteBranch as n, collectPages as o, ManagementClient as p, deleteProject as r, drivePages as s, ContainerNotFoundError as t, call as u };\n\n//# sourceMappingURL=container-CBwmCl4q.mjs.map","import { f as callOptional, i as resolveContainer, o as collectPages, p as ManagementClient, u as call } from \"./container-CBwmCl4q.mjs\";\nimport * as Effect from \"effect/Effect\";\n//#region src/deployed.ts\nconst program = (input) => Effect.gen(function* () {\n\tconst container = yield* resolveContainer({\n\t\tworkspaceId: input.workspaceId,\n\t\tappName: input.appName,\n\t\tensure: false,\n\t\t...input.stage === void 0 ? {} : { stage: input.stage }\n\t});\n\tconst { projectId } = container;\n\tconst branchId = container.branchId ?? container.defaultBranchId;\n\tif (branchId === void 0) return yield* Effect.die(/* @__PURE__ */ new Error(`project ${projectId} resolved no stage Branch`));\n\tconst client = yield* ManagementClient;\n\tconst topology = yield* callOptional(() => client.GET(\"/v1/projects/{projectId}/branches/{branchId}/application-topology\", { params: { path: {\n\t\tprojectId,\n\t\tbranchId\n\t} } }));\n\tif (topology === void 0 || topology.data.nodes.length === 0) return {\n\t\tprojectId,\n\t\tbranchId,\n\t\tnodes: [],\n\t\tservices: [],\n\t\tdatabases: [],\n\t\tbuckets: []\n\t};\n\tconst query = (cursor) => cursor === void 0 ? {\n\t\tprojectId,\n\t\tbranchId\n\t} : {\n\t\tprojectId,\n\t\tbranchId,\n\t\tcursor\n\t};\n\tconst services = yield* collectPages(`services of branch ${branchId}`, (cursor) => call(() => client.GET(\"/v1/services\", { params: { query: query(cursor) } })));\n\tconst databases = yield* collectPages(`databases of branch ${branchId}`, (cursor) => call(() => client.GET(\"/v1/databases\", { params: { query: query(cursor) } })));\n\tconst buckets = yield* collectPages(`buckets of branch ${branchId}`, (cursor) => call(() => client.GET(\"/v1/buckets\", { params: { query: query(cursor) } })));\n\treturn {\n\t\tprojectId,\n\t\tbranchId,\n\t\tnodes: topology.data.nodes.map(({ logicalId, parentLogicalId, kind, type }) => ({\n\t\t\tlogicalId,\n\t\t\tparentLogicalId,\n\t\t\tkind,\n\t\t\t...type === void 0 ? {} : { type }\n\t\t})),\n\t\tservices: services.map(({ id, logicalId, appEndpointDomain }) => ({\n\t\t\tid,\n\t\t\tlogicalId,\n\t\t\tappEndpointDomain\n\t\t})),\n\t\tdatabases: databases.map(({ id, logicalId }) => ({\n\t\t\tid,\n\t\t\tlogicalId\n\t\t})),\n\t\tbuckets: buckets.map(({ id, logicalId }) => ({\n\t\t\tid,\n\t\t\tlogicalId\n\t\t}))\n\t};\n});\n/**\n* Reads what a stage has deployed: its Project and Branch by the same\n* find-only lookup `destroy` uses, the application topology the last deploy\n* wrote, and the Branch's services, databases and buckets. `undefined` when\n* there is no Project or no Branch. Rejects on any other Management API\n* failure.\n*/\nasync function readDeployedStage(client, input) {\n\treturn Effect.runPromise(program(input).pipe(Effect.catchTag(\"ContainerNotFoundError\", () => Effect.succeed(void 0)), Effect.catchTag(\"PrismaApiError\", (error) => Effect.fail(/* @__PURE__ */ new Error(`Prisma Management API error: ${error.message}.`))), Effect.provideService(ManagementClient, client)));\n}\n//#endregion\n//#region src/resource-rows.ts\n/** The platform row each Prisma Cloud resource type deploys to. A type missing here, such as an S3 credentials resource, has no row. */\nconst RESOURCE_ROW_KINDS = /* @__PURE__ */ new Map([\n\t[\"postgres\", \"database\"],\n\t[\"raw-postgres\", \"database\"],\n\t[\"s3\", \"bucket\"]\n]);\n//#endregion\nexport { RESOURCE_ROW_KINDS, readDeployedStage };\n\n//# sourceMappingURL=deployed.mjs.map","import { type DeployedStage, RESOURCE_ROW_KINDS } from '@internal/lowering/deployed';\n\n/** One row of `deploy list`: a topology node and the platform row it deployed to. */\nexport interface DeployedNode {\n readonly address: string;\n readonly kind: string;\n readonly platformId: string | null;\n readonly url: string | null;\n}\n\ntype TopologyNode = DeployedStage['nodes'][number];\n\nfunction kindOf(node: TopologyNode): string {\n if (node.parentLogicalId === null) return 'project';\n if (node.kind === 'resource') {\n if (node.type === undefined) return 'resource';\n const rowKind = RESOURCE_ROW_KINDS.get(node.type);\n if (rowKind === 'database') return 'postgres';\n return rowKind ?? node.type;\n }\n return node.kind;\n}\n\nfunction rowId(rows: readonly { id: string; logicalId: string | null }[], logicalId: string) {\n return rows.find((row) => row.logicalId === logicalId)?.id ?? null;\n}\n\nfunction deployedNode(stage: DeployedStage, node: TopologyNode): DeployedNode {\n const kind = kindOf(node);\n const address = node.logicalId;\n switch (kind) {\n case 'project':\n return { address, kind, platformId: stage.projectId, url: null };\n case 'service': {\n const row = stage.services.find((service) => service.logicalId === address);\n return {\n address,\n kind,\n platformId: row?.id ?? null,\n url: row?.appEndpointDomain ?? null,\n };\n }\n case 'postgres':\n return { address, kind, platformId: rowId(stage.databases, address), url: null };\n case 'bucket':\n return { address, kind, platformId: rowId(stage.buckets, address), url: null };\n default:\n return { address, kind, platformId: null, url: null };\n }\n}\n\n/** Every node of the stage's topology, in topology order, joined by `logicalId` to the platform row it deployed to. The root's row is the Project. */\nexport function deployedNodes(stage: DeployedStage): DeployedNode[] {\n return stage.nodes.map((node) => deployedNode(stage, node));\n}\n","import { resolveAppIdentity, validateStageName } from '@internal/cli/app-identity';\nimport type { ComposerConfigSource } from '@internal/cli/control';\nimport { CliStructuredError } from '@internal/foundation/errors';\nimport { notOk, ok, type Result } from '@internal/foundation/result';\nimport { readDeployedStage } from '@internal/lowering/deployed';\nimport type { ManagementApiClient } from '@prisma/cli-engine';\nimport { type DeployedNode, deployedNodes } from './deployed-nodes.ts';\n\nexport interface ListDeployedInput {\n readonly config: ComposerConfigSource;\n readonly entry: string | undefined;\n readonly name: string | undefined;\n readonly stage: string | undefined;\n readonly cwd: string;\n readonly workspaceId: string | undefined;\n readonly client: ManagementApiClient;\n}\n\nfunction notFound(app: string, stage: string | undefined): CliStructuredError {\n return new CliStructuredError(\n 'DEPLOY.TARGET_NOT_FOUND',\n `Nothing deployed for ${app}${stage === undefined ? '' : `/${stage}`}.`,\n { fix: 'Deploy it first.' },\n );\n}\n\nfunction lookupFailed(error: unknown): CliStructuredError {\n return new CliStructuredError(\n 'DEPLOY.CONTAINER_FAILED',\n error instanceof Error ? error.message : String(error),\n { cause: error },\n );\n}\n\n/** Every node the app has deployed on the stage, or `DEPLOY.TARGET_NOT_FOUND` when the stage has no Project, Branch or topology. */\nexport async function listDeployed(\n input: ListDeployedInput,\n): Promise<Result<readonly DeployedNode[], CliStructuredError>> {\n let app: string;\n try {\n if (input.stage !== undefined) validateStageName(input.stage);\n app = (await resolveAppIdentity(input.entry, input.name, input.cwd, input.config)).name;\n } catch (error) {\n if (CliStructuredError.is(error)) return notOk(error);\n throw error;\n }\n if (input.workspaceId === undefined) {\n return notOk(lookupFailed(new Error('environment variable PRISMA_WORKSPACE_ID is required.')));\n }\n\n let stage: Awaited<ReturnType<typeof readDeployedStage>>;\n try {\n stage = await readDeployedStage(input.client, {\n workspaceId: input.workspaceId,\n appName: app,\n stage: input.stage,\n });\n } catch (error) {\n return notOk(lookupFailed(error));\n }\n const nodes = stage === undefined ? [] : deployedNodes(stage);\n if (nodes.length === 0) return notOk(notFound(app, input.stage));\n return ok(nodes);\n}\n"],"mappings":";;;;;;;;;;AAYsC,QAAQ,QAAQ,CAAC,CAAC,2BAA2B;;;;;;;;ACCnF,IAAI,mBAAmB,cAAc,QAAQ,QAAQ,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC;;AAmBlF,IAAI,iBAAiB,cAAc,KAAK,YAAY,gBAAgB,CAAC,CAAC,CAAC;AACvE,MAAM,WAAW,MAAM,OAAO,WAAW;CACxC,KAAK;CACL,QAAQ,UAAU,IAAI,eAAe;EACpC,QAAQ;EACR,SAAS,OAAO,KAAK;CACtB,CAAC;AACF,CAAC;AACD,MAAM,QAAQ,MAAM,OAAO,KAAK,IAAI,eAAe;CAClD,QAAQ,EAAE,SAAS;CACnB,SAAS,KAAK,UAAU,EAAE,KAAK;AAChC,CAAC,CAAC;;AAEF,MAAM,QAAQ,MAAM,QAAQ,CAAC,CAAC,CAAC,KAAK,OAAO,SAAS,MAAM,EAAE,UAAU,KAAK,KAAK,EAAE,SAAS,KAAK,IAAI,KAAK,CAAC,IAAI,OAAO,QAAQ,EAAE,IAAI,CAAC,CAAC;;AAErI,MAAM,gBAAgB,MAAM,QAAQ,CAAC,CAAC,CAAC,KAAK,OAAO,SAAS,MAAM,EAAE,SAAS,WAAW,MAAM,OAAO,QAAQ,KAAK,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,KAAK,CAAC,IAAI,OAAO,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AI;CACJ,IAAI;EACF,IAAI,MAAM,UAAU,KAAA,GAAW,kBAAkB,MAAM,KAAK;EAC5D,OAAO,MAAM,mBAAmB,MAAM,OAAO,MAAM,MAAM,MAAM,KAAK,MAAM,MAAM,EAAA,CAAG;CACrF,SAAS,OAAO;EACd,IAAI,mBAAmB,GAAG,KAAK,GAAG,OAAO,MAAM,KAAK;EACpD,MAAM;CACR;CACA,IAAI,MAAM,gBAAgB,KAAA,GACxB,OAAO,MAAM,6BAAa,IAAI,MAAM,uDAAuD,CAAC,CAAC;CAG/F,IAAI;CACJ,IAAI;EACF,QAAQ,MAAM,kBAAkB,MAAM,QAAQ;GAC5C,aAAa,MAAM;GACnB,SAAS;GACT,OAAO,MAAM;EACf,CAAC;CACH,SAAS,OAAO;EACd,OAAO,MAAM,aAAa,KAAK,CAAC;CAClC;CACA,MAAM,QAAQ,UAAU,KAAA,IAAY,CAAC,IAAI,cAAc,KAAK;CAC5D,IAAI,MAAM,WAAW,GAAG,OAAO,MAAM,SAAS,KAAK,MAAM,KAAK,CAAC;CAC/D,OAAO,GAAG,KAAK;AACjB"}
@@ -1,4 +1,4 @@
1
- import { u as CliStructuredError } from "./composer-config-ehUUVHtU-Db7akNFy.mjs";
1
+ import { c as CliStructuredError } from "./run-alchemy-Dl_MWw4g-DaWV9tkH.mjs";
2
2
  import "effect/Layer";
3
3
  import "alchemy/State/LocalState";
4
4
  //#region ../../0-framework/1-core/core/dist/app-config-CGJHcFb-.mjs
@@ -45,4 +45,4 @@ async function resolveLocalTargets(config) {
45
45
  //#endregion
46
46
  export { DEV_DIR as n, resolveLocalTargets as t };
47
47
 
48
- //# sourceMappingURL=local-target-Pro_jmzo.mjs.map
48
+ //# sourceMappingURL=local-target-CK8gvYV4.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"local-target-Pro_jmzo.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/app-config-CGJHcFb-.mjs","../../../0-framework/1-core/core/dist/local-target.mjs"],"sourcesContent":["//#region src/control/app-config.ts\n/** `<cwd>/.prisma-composer/dev` — the dev instance's app-scoped state directory (ADR-0041, ADR-0004's tool-state rule). \"dev\" names the user-facing feature/dir (naming, operator 2026-07-23) — this constant's name and value are unchanged by the localTarget rename. */\nconst DEV_DIR = \".prisma-composer/dev\";\n/**\n* True when an extension only participates in assembly (every `nodes` entry\n* is `kind: 'build'`, and it declares none of `providers`/`application`/\n* `provisions`/`container`) — it owns no resources or services, so it has\n* nothing to emulate and is exempt from local-target-capability requirements\n* (ADR-0041). Shared by `localTargetProviders` and every local-target hook\n* iteration.\n*/\nfunction isBuildOnlyExtension(extension) {\n\treturn Object.values(extension.nodes).every((node) => node.kind === \"build\") && extension.providers === void 0 && extension.application === void 0 && extension.provisions === void 0 && extension.container === void 0;\n}\n/** Typed identity — exists so the `composer` section of `prisma.config.ts` gets checked against PrismaAppConfig where it is written. */\nfunction defineConfig(config) {\n\treturn config;\n}\n//#endregion\nexport { defineConfig as n, isBuildOnlyExtension as r, DEV_DIR as t };\n\n//# sourceMappingURL=app-config-CGJHcFb-.mjs.map","import { r as isBuildOnlyExtension, t as DEV_DIR } from \"./app-config-CGJHcFb-.mjs\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport * as Layer from \"effect/Layer\";\nimport { localState } from \"alchemy/State/LocalState\";\n//#region src/control/local-target.ts\n/** The local-target stack's own provider aggregation (ADR-0041; naming, operator 2026-07-23 — the seam is `localTarget`, \"dev\" names the user-facing feature only) — the local-target counterpart of `deploy.ts`'s `mergedProviders`, kept in its own module so `lower()` learns nothing about it (deploy.ts's REVISED — operator review of #162). */\nfunction noLocalTargetSupportError(id) {\n\treturn new CliStructuredError(\"DEV.TARGET_UNSUPPORTED\", `extension \"${id}\" has no dev support — it declares no \\`localTarget\\` descriptor (ADR-0041).`);\n}\n/**\n* Resolves every non-build-only configured extension's lazy `localTarget`\n* thunk, once (ADR-0041's lazy local-target reference — operator directive:\n* the production control entry carries only the thunk, never the\n* descriptor, so resolving it is this module's job, not something a deploy\n* path ever does). A build-only extension (`isBuildOnlyExtension`) owns no\n* resources or services and is skipped entirely — never even checked for a\n* `localTarget` thunk. Every other configured extension must be\n* local-target-capable, or the dev command cannot bring the app up at all,\n* so a missing thunk throws naming the extension. The generated dev stack\n* module calls this once and threads the resolved map through every\n* subsequent hook, including `localTargetProviders`.\n*/\nasync function resolveLocalTargets(config) {\n\tconst entries = await Promise.all(config.extensions.flatMap((extension) => {\n\t\tif (isBuildOnlyExtension(extension)) return [];\n\t\tif (extension.localTarget === void 0) throw noLocalTargetSupportError(extension.id);\n\t\treturn [extension.localTarget().then((descriptor) => [extension.id, descriptor])];\n\t}));\n\treturn new Map(entries);\n}\n/**\n* All configured extensions' local-target providers merged, config array\n* order (ADR-0041), from the ALREADY-RESOLVED descriptor map\n* (`resolveLocalTargets`'s product — this function itself never touches a\n* `localTarget` thunk). The generated dev stack module is this\n* aggregator's one caller, passing the result as `LowerOptions.providers`.\n*/\nfunction localTargetProviders(resolved, containers, devDir) {\n\tconst [first, ...rest] = [...resolved.entries()].map(([id, descriptor]) => descriptor.providers({\n\t\tcontainer: containers.get(id),\n\t\tdevDir\n\t}));\n\treturn first === void 0 ? Layer.empty : Layer.mergeAll(first, ...rest);\n}\n/** The state store `prisma dev` converges against: Alchemy's file store in the app's working directory. */\nfunction devState() {\n\treturn localState();\n}\n//#endregion\nexport { DEV_DIR, devState, localTargetProviders, resolveLocalTargets };\n\n//# sourceMappingURL=local-target.mjs.map"],"mappings":";;;;;AAEA,MAAM,UAAU;;;;;;;;;AAShB,SAAS,qBAAqB,WAAW;CACxC,OAAO,OAAO,OAAO,UAAU,KAAK,CAAC,CAAC,OAAO,SAAS,KAAK,SAAS,OAAO,KAAK,UAAU,cAAc,KAAK,KAAK,UAAU,gBAAgB,KAAK,KAAK,UAAU,eAAe,KAAK,KAAK,UAAU,cAAc,KAAK;AACvN;;;;ACPA,SAAS,0BAA0B,IAAI;CACtC,OAAO,IAAI,mBAAmB,0BAA0B,cAAc,GAAG,6EAA6E;AACvJ;;;;;;;;;;;;;;AAcA,eAAe,oBAAoB,QAAQ;CAC1C,MAAM,UAAU,MAAM,QAAQ,IAAI,OAAO,WAAW,SAAS,cAAc;EAC1E,IAAI,qBAAqB,SAAS,GAAG,OAAO,CAAC;EAC7C,IAAI,UAAU,gBAAgB,KAAK,GAAG,MAAM,0BAA0B,UAAU,EAAE;EAClF,OAAO,CAAC,UAAU,YAAY,CAAC,CAAC,MAAM,eAAe,CAAC,UAAU,IAAI,UAAU,CAAC,CAAC;CACjF,CAAC,CAAC;CACF,OAAO,IAAI,IAAI,OAAO;AACvB"}
1
+ {"version":3,"file":"local-target-CK8gvYV4.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/app-config-CGJHcFb-.mjs","../../../0-framework/1-core/core/dist/local-target.mjs"],"sourcesContent":["//#region src/control/app-config.ts\n/** `<cwd>/.prisma-composer/dev` — the dev instance's app-scoped state directory (ADR-0041, ADR-0004's tool-state rule). \"dev\" names the user-facing feature/dir (naming, operator 2026-07-23) — this constant's name and value are unchanged by the localTarget rename. */\nconst DEV_DIR = \".prisma-composer/dev\";\n/**\n* True when an extension only participates in assembly (every `nodes` entry\n* is `kind: 'build'`, and it declares none of `providers`/`application`/\n* `provisions`/`container`) — it owns no resources or services, so it has\n* nothing to emulate and is exempt from local-target-capability requirements\n* (ADR-0041). Shared by `localTargetProviders` and every local-target hook\n* iteration.\n*/\nfunction isBuildOnlyExtension(extension) {\n\treturn Object.values(extension.nodes).every((node) => node.kind === \"build\") && extension.providers === void 0 && extension.application === void 0 && extension.provisions === void 0 && extension.container === void 0;\n}\n/** Typed identity — exists so the `composer` section of `prisma.config.ts` gets checked against PrismaAppConfig where it is written. */\nfunction defineConfig(config) {\n\treturn config;\n}\n//#endregion\nexport { defineConfig as n, isBuildOnlyExtension as r, DEV_DIR as t };\n\n//# sourceMappingURL=app-config-CGJHcFb-.mjs.map","import { r as isBuildOnlyExtension, t as DEV_DIR } from \"./app-config-CGJHcFb-.mjs\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport * as Layer from \"effect/Layer\";\nimport { localState } from \"alchemy/State/LocalState\";\n//#region src/control/local-target.ts\n/** The local-target stack's own provider aggregation (ADR-0041; naming, operator 2026-07-23 — the seam is `localTarget`, \"dev\" names the user-facing feature only) — the local-target counterpart of `deploy.ts`'s `mergedProviders`, kept in its own module so `lower()` learns nothing about it (deploy.ts's REVISED — operator review of #162). */\nfunction noLocalTargetSupportError(id) {\n\treturn new CliStructuredError(\"DEV.TARGET_UNSUPPORTED\", `extension \"${id}\" has no dev support — it declares no \\`localTarget\\` descriptor (ADR-0041).`);\n}\n/**\n* Resolves every non-build-only configured extension's lazy `localTarget`\n* thunk, once (ADR-0041's lazy local-target reference — operator directive:\n* the production control entry carries only the thunk, never the\n* descriptor, so resolving it is this module's job, not something a deploy\n* path ever does). A build-only extension (`isBuildOnlyExtension`) owns no\n* resources or services and is skipped entirely — never even checked for a\n* `localTarget` thunk. Every other configured extension must be\n* local-target-capable, or the dev command cannot bring the app up at all,\n* so a missing thunk throws naming the extension. The generated dev stack\n* module calls this once and threads the resolved map through every\n* subsequent hook, including `localTargetProviders`.\n*/\nasync function resolveLocalTargets(config) {\n\tconst entries = await Promise.all(config.extensions.flatMap((extension) => {\n\t\tif (isBuildOnlyExtension(extension)) return [];\n\t\tif (extension.localTarget === void 0) throw noLocalTargetSupportError(extension.id);\n\t\treturn [extension.localTarget().then((descriptor) => [extension.id, descriptor])];\n\t}));\n\treturn new Map(entries);\n}\n/**\n* All configured extensions' local-target providers merged, config array\n* order (ADR-0041), from the ALREADY-RESOLVED descriptor map\n* (`resolveLocalTargets`'s product — this function itself never touches a\n* `localTarget` thunk). The generated dev stack module is this\n* aggregator's one caller, passing the result as `LowerOptions.providers`.\n*/\nfunction localTargetProviders(resolved, containers, devDir) {\n\tconst [first, ...rest] = [...resolved.entries()].map(([id, descriptor]) => descriptor.providers({\n\t\tcontainer: containers.get(id),\n\t\tdevDir\n\t}));\n\treturn first === void 0 ? Layer.empty : Layer.mergeAll(first, ...rest);\n}\n/** The state store `prisma dev` converges against: Alchemy's file store in the app's working directory. */\nfunction devState() {\n\treturn localState();\n}\n//#endregion\nexport { DEV_DIR, devState, localTargetProviders, resolveLocalTargets };\n\n//# sourceMappingURL=local-target.mjs.map"],"mappings":";;;;;AAEA,MAAM,UAAU;;;;;;;;;AAShB,SAAS,qBAAqB,WAAW;CACxC,OAAO,OAAO,OAAO,UAAU,KAAK,CAAC,CAAC,OAAO,SAAS,KAAK,SAAS,OAAO,KAAK,UAAU,cAAc,KAAK,KAAK,UAAU,gBAAgB,KAAK,KAAK,UAAU,eAAe,KAAK,KAAK,UAAU,cAAc,KAAK;AACvN;;;;ACPA,SAAS,0BAA0B,IAAI;CACtC,OAAO,IAAI,mBAAmB,0BAA0B,cAAc,GAAG,6EAA6E;AACvJ;;;;;;;;;;;;;;AAcA,eAAe,oBAAoB,QAAQ;CAC1C,MAAM,UAAU,MAAM,QAAQ,IAAI,OAAO,WAAW,SAAS,cAAc;EAC1E,IAAI,qBAAqB,SAAS,GAAG,OAAO,CAAC;EAC7C,IAAI,UAAU,gBAAgB,KAAK,GAAG,MAAM,0BAA0B,UAAU,EAAE;EAClF,OAAO,CAAC,UAAU,YAAY,CAAC,CAAC,MAAM,eAAe,CAAC,UAAU,IAAI,UAAU,CAAC,CAAC;CACjF,CAAC,CAAC;CACF,OAAO,IAAI,IAAI,OAAO;AACvB"}
@@ -1,4 +1,4 @@
1
- import { h as blindCast, m as InternalError, n as configFileMissing, r as entryMissing, t as checkComposerConfig, u as CliStructuredError } from "./composer-config-ehUUVHtU-Db7akNFy.mjs";
1
+ import { c as CliStructuredError, d as checkComposerConfig, f as configFileMissing, l as InternalError, p as entryMissing, u as blindCast } from "./run-alchemy-Dl_MWw4g-DaWV9tkH.mjs";
2
2
  import * as mod from "node:module";
3
3
  import * as fs from "node:fs";
4
4
  import { existsSync } from "node:fs";
@@ -775,7 +775,7 @@ function Load(root, opts) {
775
775
  }
776
776
  blindCast(Symbol.for("prisma:secret-box"));
777
777
  //#endregion
778
- //#region ../../0-framework/3-tooling/cli/dist/pipeline-C06OEvKd.mjs
778
+ //#region ../../0-framework/3-tooling/cli/dist/pipeline-BmWt-Nhb.mjs
779
779
  /**
780
780
  * Synchronous Node resolve hook so that entry modules may import relative
781
781
  * files using the specifier forms TypeScript accepts by default —
@@ -1011,6 +1011,26 @@ function resolveEntryPath(override, source, cwd) {
1011
1011
  };
1012
1012
  }
1013
1013
  /**
1014
+ * The pipeline's front — entry load and name resolution —
1015
+ * WITHOUT Load, coverage, or assemble. `log` needs only who the app is (its
1016
+ * config and resolved name) to reach the already-running local instance; it
1017
+ * neither builds nor provisions, so it must not require the user's built
1018
+ * output the way the full pipeline does.
1019
+ */
1020
+ async function resolveAppIdentity(entry, overrideName, cwd, config) {
1021
+ const checked = checkConfigSource(config, cwd);
1022
+ const { value } = checked;
1023
+ const resolved = resolveEntryPath(entry, checked, cwd);
1024
+ const entryModule = await loadEntry(resolved.path, cwd, resolved.fix);
1025
+ const name = overrideName ?? entryModule.root.name;
1026
+ if (name.length === 0) throw new CliStructuredError("COMPOSE.NAME_MISSING", "The root node has no name.", { fix: "Name it at authoring, or pass --name." });
1027
+ assertAppName(name);
1028
+ return {
1029
+ config: value,
1030
+ name
1031
+ };
1032
+ }
1033
+ /**
1014
1034
  * Runs entry load, name resolution, Load, registry coverage, and assemble — steps 1–5 of `run()`. `onAssembleError`, when
1015
1035
  * given, lets a caller decorate an assemble failure with command-specific
1016
1036
  * guidance (destroy's "build first" hint) without this shared step knowing
@@ -1043,6 +1063,6 @@ async function runPipeline(entry, overrideName, cwd, source, deps = {}, onAssemb
1043
1063
  };
1044
1064
  }
1045
1065
  //#endregion
1046
- export { runPipeline as n, checkConfigSource as t };
1066
+ export { resolveAppIdentity as n, runPipeline as r, checkConfigSource as t };
1047
1067
 
1048
- //# sourceMappingURL=pipeline-C06OEvKd-B_vvzzSY.mjs.map
1068
+ //# sourceMappingURL=pipeline-BmWt-Nhb-Bos4TFXR.mjs.map