@prisma/composer-cli 0.37.0-dev.3 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/family.mjs
CHANGED
|
@@ -774,7 +774,7 @@ function createComposerFamily$1(options = {}) {
|
|
|
774
774
|
* assembled into the family here, where both domains may be imported.
|
|
775
775
|
*/
|
|
776
776
|
/** Loaded on first use, so nothing of the Management API reads loads with the family. */
|
|
777
|
-
const listDeployed = async (input) => (await import("./list-deployed-
|
|
777
|
+
const listDeployed = async (input) => (await import("./list-deployed-IL0MgmTX.mjs")).listDeployed(input);
|
|
778
778
|
const createDeployListCommand = (list) => defineCommand({
|
|
779
779
|
help: {
|
|
780
780
|
summary: "List every node the app has deployed in an environment, with its platform ID and URL.",
|
|
@@ -9,7 +9,7 @@ import "effect/Redacted";
|
|
|
9
9
|
import * as Data from "effect/Data";
|
|
10
10
|
Context.Service()("PrismaComposerCredentials");
|
|
11
11
|
//#endregion
|
|
12
|
-
//#region ../../1-prisma-cloud/0-lowering/lowering/dist/container-
|
|
12
|
+
//#region ../../1-prisma-cloud/0-lowering/lowering/dist/container-CrBfZsPj.mjs
|
|
13
13
|
/**
|
|
14
14
|
* The typed Prisma Management API client, built once from the resolved
|
|
15
15
|
* credentials. Providers yield this in their outer Effect and call it inside
|
|
@@ -377,4 +377,4 @@ async function listDeployed(input) {
|
|
|
377
377
|
//#endregion
|
|
378
378
|
export { listDeployed };
|
|
379
379
|
|
|
380
|
-
//# sourceMappingURL=list-deployed-
|
|
380
|
+
//# sourceMappingURL=list-deployed-IL0MgmTX.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-deployed-IL0MgmTX.mjs","names":[],"sources":["../../../1-prisma-cloud/0-lowering/lowering/dist/credentials-BsU3awdl.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/container-CrBfZsPj.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.38.0\";\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-BsU3awdl.mjs.map","import { i as managementApiBaseUrl, n as deploySourceHeaders, t as PrismaCredentials } from \"./credentials-BsU3awdl.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 environment's Branch) doesn't exist. */\nvar ContainerNotFoundError = class extends Data.TaggedError(\"ContainerNotFoundError\") {};\n/** The environment that maps to the Project's default Branch. */\nconst PRODUCTION_ENVIRONMENT = \"production\";\n/** Whether `environment` maps to the Project's default Branch rather than a Branch of its own. */\nfunction isProductionEnvironment(environment) {\n\treturn environment === PRODUCTION_ENVIRONMENT;\n}\n/** Raised when a name other than `production` resolves to the Project's default Branch, which would make it production under a second name. */\nvar DefaultBranchUnderAnotherNameError = class extends Data.TaggedError(\"DefaultBranchUnderAnotherNameError\") {\n\tget message() {\n\t\treturn `The environment \"${this.environment}\" names the Branch ${this.branchId}, which is this Project's default Branch, so that Branch is production. Use the environment ${PRODUCTION_ENVIRONMENT} for it, and another name for a separate environment.`;\n\t}\n};\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 findBranch = (client, projectId, gitName) => call(() => client.GET(\"/v1/projects/{projectId}/branches\", { params: {\n\tpath: { projectId },\n\tquery: { gitName }\n} })).pipe(Effect.map((page) => {\n\tconst branch = page.data[0];\n\treturn branch === void 0 ? void 0 : {\n\t\tid: branch.id,\n\t\tisDefault: branch.isDefault\n\t};\n}));\n/**\n* Finds the environment'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`. A `gitName` that finds\n* the default Branch fails with `DefaultBranchUnderAnotherNameError`. 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* findBranch(client, projectId, gitName);\n\tif (existing !== void 0) return yield* refuseDefaultBranch(existing, gitName);\n\tif (!ensure) return yield* Effect.fail(new ContainerNotFoundError({\n\t\tappName,\n\t\tenvironment: 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 ? Effect.gen(function* () {\n\t\tconst found = yield* findBranch(client, projectId, gitName);\n\t\tif (found === void 0) return yield* Effect.fail(err);\n\t\treturn yield* refuseDefaultBranch(found, gitName);\n\t}) : Effect.fail(err)));\n});\nconst refuseDefaultBranch = (branch, gitName) => branch.isDefault === true ? Effect.fail(new DefaultBranchUnderAnotherNameError({\n\tenvironment: gitName,\n\tbranchId: branch.id\n})) : Effect.succeed(branch.id);\n/**\n* Resolves the two containers an environment's deploy runs into (ADR-0019):\n* the app's **Project**, found-or-created by name, and its **Branch**. The\n* environment `production` is the Project's default Branch, read into\n* `defaultBranchId` and never created; `branchId` is omitted. Any other name\n* is the Branch with that `gitName`, found-or-created into `branchId`. With\n* `ensure: false` (`destroy`), nothing is created — an absent Project or\n* Branch 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 (isProductionEnvironment(opts.environment)) 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.environment, 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 environment'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 { layer as _, deleteProject as a, resolveDefaultBranchId as c, drivePagesAsync as d, PrismaApiError as f, ManagementClient as g, callOptional as h, deleteBranch as i, collectPages as l, callCreateOnly as m, DefaultBranchUnderAnotherNameError as n, isProductionEnvironment as o, call as p, PRODUCTION_ENVIRONMENT as r, resolveContainer as s, ContainerNotFoundError as t, drivePages as u };\n\n//# sourceMappingURL=container-CrBfZsPj.mjs.map","import { g as ManagementClient, h as callOptional, l as collectPages, p as call, s as resolveContainer } from \"./container-CrBfZsPj.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\tenvironment: input.environment\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 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 an environment 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 readDeployedEnvironment(client, input) {\n\treturn Effect.runPromise(program(input).pipe(Effect.catchTag(\"ContainerNotFoundError\", () => Effect.succeed(void 0)), Effect.catchTag(\"DefaultBranchUnderAnotherNameError\", (error) => Effect.fail(new Error(error.message))), 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, readDeployedEnvironment };\n\n//# sourceMappingURL=deployed.mjs.map","import { type DeployedEnvironment, 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 = DeployedEnvironment['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(deployed: DeployedEnvironment, node: TopologyNode): DeployedNode {\n const kind = kindOf(node);\n const address = node.logicalId;\n switch (kind) {\n case 'project':\n return { address, kind, platformId: deployed.projectId, url: null };\n case 'service': {\n const row = deployed.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(deployed.databases, address), url: null };\n case 'bucket':\n return { address, kind, platformId: rowId(deployed.buckets, address), url: null };\n default:\n return { address, kind, platformId: null, url: null };\n }\n}\n\n/** Every node of the environment'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(deployed: DeployedEnvironment): DeployedNode[] {\n return deployed.nodes.map((node) => deployedNode(deployed, node));\n}\n","import { resolveAppIdentity, validateEnvironmentName } 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 { readDeployedEnvironment } 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 environment: string;\n readonly cwd: string;\n readonly workspaceId: string | undefined;\n readonly client: ManagementApiClient;\n}\n\nfunction notFound(app: string, environment: string): CliStructuredError {\n return new CliStructuredError(\n 'DEPLOY.TARGET_NOT_FOUND',\n `Nothing deployed for ${app} in the environment ${environment}.`,\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 in the environment, or `DEPLOY.TARGET_NOT_FOUND` when the environment 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 validateEnvironmentName(input.environment);\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 deployed: Awaited<ReturnType<typeof readDeployedEnvironment>>;\n try {\n deployed = await readDeployedEnvironment(input.client, {\n workspaceId: input.workspaceId,\n appName: app,\n environment: input.environment,\n });\n } catch (error) {\n return notOk(lookupFailed(error));\n }\n const nodes = deployed === undefined ? [] : deployedNodes(deployed);\n if (nodes.length === 0) return notOk(notFound(app, input.environment));\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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,aAAa,KAAK,CAAC;CAClC;CACA,MAAM,QAAQ,aAAa,KAAA,IAAY,CAAC,IAAI,cAAc,QAAQ;CAClE,IAAI,MAAM,WAAW,GAAG,OAAO,MAAM,SAAS,KAAK,MAAM,WAAW,CAAC;CACrE,OAAO,GAAG,KAAK;AACjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/composer-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Prisma Composer's command family, which the `prisma` CLI mounts as `deploy`, `deploy list`, `dev`, `dev url`, `dev stop` and `emulator list`.",
|
|
6
6
|
"exports": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"src"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@prisma/composer": "0.
|
|
16
|
+
"@prisma/composer": "0.38.0",
|
|
17
17
|
"@prisma/management-api-sdk": "^1.80.0",
|
|
18
18
|
"alchemy": "2.0.0-beta.84",
|
|
19
19
|
"cross-spawn": "^7.0.6",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"@prisma/cli-engine": "0.9.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@internal/cli": "0.
|
|
28
|
-
"@internal/dev-emulators": "0.
|
|
29
|
-
"@internal/foundation": "0.
|
|
30
|
-
"@internal/lowering": "0.
|
|
31
|
-
"@internal/tsdown-config": "0.
|
|
27
|
+
"@internal/cli": "0.38.0",
|
|
28
|
+
"@internal/dev-emulators": "0.38.0",
|
|
29
|
+
"@internal/foundation": "0.38.0",
|
|
30
|
+
"@internal/lowering": "0.38.0",
|
|
31
|
+
"@internal/tsdown-config": "0.38.0",
|
|
32
32
|
"@types/bun": "^1.3.13",
|
|
33
33
|
"@prisma/cli-engine": "0.9.0",
|
|
34
34
|
"@types/node": "^26.0.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list-deployed-ayiRZH3n.mjs","names":[],"sources":["../../../1-prisma-cloud/0-lowering/lowering/dist/credentials-vuOzWXNb.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/container-DIfSQh-f.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.37.0-dev.3\";\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-vuOzWXNb.mjs.map","import { i as managementApiBaseUrl, n as deploySourceHeaders, t as PrismaCredentials } from \"./credentials-vuOzWXNb.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 environment's Branch) doesn't exist. */\nvar ContainerNotFoundError = class extends Data.TaggedError(\"ContainerNotFoundError\") {};\n/** The environment that maps to the Project's default Branch. */\nconst PRODUCTION_ENVIRONMENT = \"production\";\n/** Whether `environment` maps to the Project's default Branch rather than a Branch of its own. */\nfunction isProductionEnvironment(environment) {\n\treturn environment === PRODUCTION_ENVIRONMENT;\n}\n/** Raised when a name other than `production` resolves to the Project's default Branch, which would make it production under a second name. */\nvar DefaultBranchUnderAnotherNameError = class extends Data.TaggedError(\"DefaultBranchUnderAnotherNameError\") {\n\tget message() {\n\t\treturn `The environment \"${this.environment}\" names the Branch ${this.branchId}, which is this Project's default Branch, so that Branch is production. Use the environment ${PRODUCTION_ENVIRONMENT} for it, and another name for a separate environment.`;\n\t}\n};\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 findBranch = (client, projectId, gitName) => call(() => client.GET(\"/v1/projects/{projectId}/branches\", { params: {\n\tpath: { projectId },\n\tquery: { gitName }\n} })).pipe(Effect.map((page) => {\n\tconst branch = page.data[0];\n\treturn branch === void 0 ? void 0 : {\n\t\tid: branch.id,\n\t\tisDefault: branch.isDefault\n\t};\n}));\n/**\n* Finds the environment'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`. A `gitName` that finds\n* the default Branch fails with `DefaultBranchUnderAnotherNameError`. 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* findBranch(client, projectId, gitName);\n\tif (existing !== void 0) return yield* refuseDefaultBranch(existing, gitName);\n\tif (!ensure) return yield* Effect.fail(new ContainerNotFoundError({\n\t\tappName,\n\t\tenvironment: 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 ? Effect.gen(function* () {\n\t\tconst found = yield* findBranch(client, projectId, gitName);\n\t\tif (found === void 0) return yield* Effect.fail(err);\n\t\treturn yield* refuseDefaultBranch(found, gitName);\n\t}) : Effect.fail(err)));\n});\nconst refuseDefaultBranch = (branch, gitName) => branch.isDefault === true ? Effect.fail(new DefaultBranchUnderAnotherNameError({\n\tenvironment: gitName,\n\tbranchId: branch.id\n})) : Effect.succeed(branch.id);\n/**\n* Resolves the two containers an environment's deploy runs into (ADR-0019):\n* the app's **Project**, found-or-created by name, and its **Branch**. The\n* environment `production` is the Project's default Branch, read into\n* `defaultBranchId` and never created; `branchId` is omitted. Any other name\n* is the Branch with that `gitName`, found-or-created into `branchId`. With\n* `ensure: false` (`destroy`), nothing is created — an absent Project or\n* Branch 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 (isProductionEnvironment(opts.environment)) 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.environment, 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 environment'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 { layer as _, deleteProject as a, resolveDefaultBranchId as c, drivePagesAsync as d, PrismaApiError as f, ManagementClient as g, callOptional as h, deleteBranch as i, collectPages as l, callCreateOnly as m, DefaultBranchUnderAnotherNameError as n, isProductionEnvironment as o, call as p, PRODUCTION_ENVIRONMENT as r, resolveContainer as s, ContainerNotFoundError as t, drivePages as u };\n\n//# sourceMappingURL=container-DIfSQh-f.mjs.map","import { g as ManagementClient, h as callOptional, l as collectPages, p as call, s as resolveContainer } from \"./container-DIfSQh-f.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\tenvironment: input.environment\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 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 an environment 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 readDeployedEnvironment(client, input) {\n\treturn Effect.runPromise(program(input).pipe(Effect.catchTag(\"ContainerNotFoundError\", () => Effect.succeed(void 0)), Effect.catchTag(\"DefaultBranchUnderAnotherNameError\", (error) => Effect.fail(new Error(error.message))), 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, readDeployedEnvironment };\n\n//# sourceMappingURL=deployed.mjs.map","import { type DeployedEnvironment, 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 = DeployedEnvironment['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(deployed: DeployedEnvironment, node: TopologyNode): DeployedNode {\n const kind = kindOf(node);\n const address = node.logicalId;\n switch (kind) {\n case 'project':\n return { address, kind, platformId: deployed.projectId, url: null };\n case 'service': {\n const row = deployed.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(deployed.databases, address), url: null };\n case 'bucket':\n return { address, kind, platformId: rowId(deployed.buckets, address), url: null };\n default:\n return { address, kind, platformId: null, url: null };\n }\n}\n\n/** Every node of the environment'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(deployed: DeployedEnvironment): DeployedNode[] {\n return deployed.nodes.map((node) => deployedNode(deployed, node));\n}\n","import { resolveAppIdentity, validateEnvironmentName } 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 { readDeployedEnvironment } 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 environment: string;\n readonly cwd: string;\n readonly workspaceId: string | undefined;\n readonly client: ManagementApiClient;\n}\n\nfunction notFound(app: string, environment: string): CliStructuredError {\n return new CliStructuredError(\n 'DEPLOY.TARGET_NOT_FOUND',\n `Nothing deployed for ${app} in the environment ${environment}.`,\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 in the environment, or `DEPLOY.TARGET_NOT_FOUND` when the environment 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 validateEnvironmentName(input.environment);\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 deployed: Awaited<ReturnType<typeof readDeployedEnvironment>>;\n try {\n deployed = await readDeployedEnvironment(input.client, {\n workspaceId: input.workspaceId,\n appName: app,\n environment: input.environment,\n });\n } catch (error) {\n return notOk(lookupFailed(error));\n }\n const nodes = deployed === undefined ? [] : deployedNodes(deployed);\n if (nodes.length === 0) return notOk(notFound(app, input.environment));\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,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