@prisma/composer-cli 0.39.0-dev.1 → 0.39.0-dev.2
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/{app-configuration-file-CeJvBAti-DA4EKwFq.mjs → app-configuration-file-Cw9autUL-CPnePaG6.mjs} +17 -20
- package/dist/app-configuration-file-Cw9autUL-CPnePaG6.mjs.map +1 -0
- package/dist/{dev-current-wD5YDLjA-CFI8XTAK.mjs → dev-current-D8GwJQex-D4xWpddG.mjs} +6 -6
- package/dist/{dev-current-wD5YDLjA-CFI8XTAK.mjs.map → dev-current-D8GwJQex-D4xWpddG.mjs.map} +1 -1
- package/dist/{dev-environment-name-6eEr5PW8-Bs4Dl0vW.mjs → dev-environment-name-6eEr5PW8-DuiDkcM6.mjs} +2 -2
- package/dist/dev-environment-name-6eEr5PW8-DuiDkcM6.mjs.map +1 -0
- package/dist/{dist-D0rWRHos.mjs → dist-qqNor5kl.mjs} +3 -3
- package/dist/{dist-D0rWRHos.mjs.map → dist-qqNor5kl.mjs.map} +1 -1
- package/dist/{execute-deploy-destroy-DOzo2Psp-2iWcFbD9.mjs → execute-deploy-destroy-1SIH5uAu-SJMSVJ-C.mjs} +11 -10
- package/dist/{execute-deploy-destroy-DOzo2Psp-2iWcFbD9.mjs.map → execute-deploy-destroy-1SIH5uAu-SJMSVJ-C.mjs.map} +1 -1
- package/dist/{execute-dev-current-CKOzjWuO-DTOVqZzZ.mjs → execute-dev-current-DsAsDBB1-C_Pqg6lv.mjs} +6 -6
- package/dist/{execute-dev-current-CKOzjWuO-DTOVqZzZ.mjs.map → execute-dev-current-DsAsDBB1-C_Pqg6lv.mjs.map} +1 -1
- package/dist/{execute-dev-BIyOI3Ys-DGpTd9rP.mjs → execute-dev-xPaS5SAl-Pf5LvC3G.mjs} +77 -15
- package/dist/{execute-dev-BIyOI3Ys-DGpTd9rP.mjs.map → execute-dev-xPaS5SAl-Pf5LvC3G.mjs.map} +1 -1
- package/dist/family.d.mts +1 -1
- package/dist/family.mjs +22 -6
- package/dist/family.mjs.map +1 -1
- package/dist/{generate-dev-stack-BV_n-X9n-DM5faH3-.mjs → generate-dev-stack-BEpqJ3AH-BwP97FIX.mjs} +5 -5
- package/dist/generate-dev-stack-BEpqJ3AH-BwP97FIX.mjs.map +1 -0
- package/dist/{list-deployed-BFJJxt_W.mjs → list-deployed-B_HjWxgs.mjs} +4 -4
- package/dist/{list-deployed-BFJJxt_W.mjs.map → list-deployed-B_HjWxgs.mjs.map} +1 -1
- package/dist/{preflight-transport-DmmtoFPH-CZ0o7QPf.mjs → preflight-transport-DJjTWvyH-C98XN-K2.mjs} +3 -4
- package/dist/{preflight-transport-DmmtoFPH-CZ0o7QPf.mjs.map → preflight-transport-DJjTWvyH-C98XN-K2.mjs.map} +1 -1
- package/dist/{redaction-DXung4ip-Co_fv4Zl.mjs → redaction-C-NnlVUh-xg-a8RGt.mjs} +4 -10
- package/dist/redaction-C-NnlVUh-xg-a8RGt.mjs.map +1 -0
- package/dist/{redaction-Bf8FvTFH-XGchRgrK.d.mts → redaction-CqdeMBKw-aZd7lPFP.d.mts} +95 -70
- package/dist/redaction-CqdeMBKw-aZd7lPFP.d.mts.map +1 -0
- package/dist/{result-sR7PBi61.mjs → result-DlBttLS8.mjs} +7 -2
- package/dist/{result-sR7PBi61.mjs.map → result-DlBttLS8.mjs.map} +1 -1
- package/dist/{run-alchemy-CRLAyOtt-CwFLe4Zg.mjs → run-alchemy-CyciV8i0-Djfa6x3a.mjs} +4 -4
- package/dist/{run-alchemy-CRLAyOtt-CwFLe4Zg.mjs.map → run-alchemy-CyciV8i0-Djfa6x3a.mjs.map} +1 -1
- package/dist/testing.d.mts +5 -10
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +5 -5
- package/dist/testing.mjs.map +1 -1
- package/dist/{validate-environment-D1BTCkTs-C5m4rL6t.mjs → validate-environment-DyW59rJ7-B1PoUO20.mjs} +135 -88
- package/dist/validate-environment-DyW59rJ7-B1PoUO20.mjs.map +1 -0
- package/package.json +7 -7
- package/dist/app-configuration-file-CeJvBAti-DA4EKwFq.mjs.map +0 -1
- package/dist/dev-environment-name-6eEr5PW8-Bs4Dl0vW.mjs.map +0 -1
- package/dist/generate-dev-stack-BV_n-X9n-DM5faH3-.mjs.map +0 -1
- package/dist/redaction-Bf8FvTFH-XGchRgrK.d.mts.map +0 -1
- package/dist/redaction-DXung4ip-Co_fv4Zl.mjs.map +0 -1
- package/dist/validate-environment-D1BTCkTs-C5m4rL6t.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-deployed-BFJJxt_W.mjs","names":[],"sources":["../../../1-prisma-cloud/0-lowering/lowering/dist/credentials-Cdg3TcB_.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/container-DHNFdeaQ.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.39.0-dev.1\";\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-Cdg3TcB_.mjs.map","import { i as managementApiBaseUrl, n as deploySourceHeaders, t as PrismaCredentials } from \"./credentials-Cdg3TcB_.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-DHNFdeaQ.mjs.map","import { g as ManagementClient, h as callOptional, l as collectPages, p as call, s as resolveContainer } from \"./container-DHNFdeaQ.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,2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T,2BACA,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GACrD,EAAE,OAAO,MAAM,CACjB;AACF;;AAGA,eAAsB,aACpB,OAC8D;CAC9D,IAAI;CACJ,IAAI;EACF,wBAAwB,MAAM,WAAW;EACzC,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,WAAW,MAAM,wBAAwB,MAAM,QAAQ;GACrD,aAAa,MAAM;GACnB,SAAS;GACT,aAAa,MAAM;EACrB,CAAC;CACH,SAAS,OAAO;EACd,OAAO,MAAM,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"}
|
|
1
|
+
{"version":3,"file":"list-deployed-B_HjWxgs.mjs","names":[],"sources":["../../../1-prisma-cloud/0-lowering/lowering/dist/credentials-SEPvBMal.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/container-Dy40jjjL.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.39.0-dev.2\";\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-SEPvBMal.mjs.map","import { i as managementApiBaseUrl, n as deploySourceHeaders, t as PrismaCredentials } from \"./credentials-SEPvBMal.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-Dy40jjjL.mjs.map","import { g as ManagementClient, h as callOptional, l as collectPages, p as call, s as resolveContainer } from \"./container-Dy40jjjL.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,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,QAAQ,EAAE,IAAI,CAAC,CAAC;;AAY7K,MAA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WvyH-C98XN-K2.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../0-framework/1-core/core/dist/preflight-transport-
|
|
1
|
+
//#region ../../0-framework/1-core/core/dist/preflight-transport-DJjTWvyH.mjs
|
|
2
2
|
/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_PRISMA_CLOUD': uppercased, every non-alphanumeric run replaced by one underscore. */
|
|
3
3
|
function envVarSafeExtensionId(extensionId) {
|
|
4
4
|
return extensionId.toUpperCase().replace(/[^A-Z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
@@ -61,8 +61,7 @@ function preflightEnv(payloads) {
|
|
|
61
61
|
function platformVariableReaderText(reader) {
|
|
62
62
|
switch (reader.kind) {
|
|
63
63
|
case "field": return `read by service "${reader.service}", field "${reader.path === "" ? "(root)" : reader.path}"`;
|
|
64
|
-
case "
|
|
65
|
-
case "unread": return `named by ${reader.nodeKind} "${reader.node}", read by no service`;
|
|
64
|
+
case "unread": return `named by resource "${reader.node}", read by no service`;
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
/** The variable that carries every extension's deploy preflight findings from the first process to the second. No extension's preflight variable may take this name. */
|
|
@@ -74,4 +73,4 @@ function preflightFindingsEnv(findings) {
|
|
|
74
73
|
//#endregion
|
|
75
74
|
export { preflightFindingsEnv as a, preflightEnvVarName as i, platformVariableReaderText as n, preflightEnv as r, containerEnv as t };
|
|
76
75
|
|
|
77
|
-
//# sourceMappingURL=preflight-transport-
|
|
76
|
+
//# sourceMappingURL=preflight-transport-DJjTWvyH-C98XN-K2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preflight-transport-
|
|
1
|
+
{"version":3,"file":"preflight-transport-DJjTWvyH-C98XN-K2.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/preflight-transport-DJjTWvyH.mjs"],"sourcesContent":["//#region src/container-transport.ts\n/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_PRISMA_CLOUD': uppercased, every non-alphanumeric run replaced by one underscore. */\nfunction envVarSafeExtensionId(extensionId) {\n\treturn extensionId.toUpperCase().replace(/[^A-Z0-9]+/g, \"_\").replace(/^_+|_+$/g, \"\");\n}\n/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_CONTAINER_PRISMA_COMPOSER_PRISMA_CLOUD' */\nfunction containerEnvVarName(extensionId) {\n\treturn `PRISMA_COMPOSER_CONTAINER_${envVarSafeExtensionId(extensionId)}`;\n}\nfunction collisionError(a, b, varName) {\n\treturn /* @__PURE__ */ new Error(`Extension ids \"${a}\" and \"${b}\" both map to the container transport variable \"${varName}\" — rename one of the extensions.`);\n}\nfunction emptySerializeError(extensionId) {\n\treturn /* @__PURE__ */ new Error(`Extension \"${extensionId}\"'s container instance serialized to an empty string — ContainerInstance.serialize() must return a non-empty string.`);\n}\n/** The env entries the CLI sets on the alchemy process: `{ [containerEnvVarName(id)]: instance.serialize() }` for every resolved instance. */\nfunction containerEnv(instances) {\n\tconst env = {};\n\tconst ownerByVarName = /* @__PURE__ */ new Map();\n\tfor (const [extensionId, instance] of instances) {\n\t\tconst varName = containerEnvVarName(extensionId);\n\t\tconst owner = ownerByVarName.get(varName);\n\t\tif (owner !== void 0) throw collisionError(owner, extensionId, varName);\n\t\townerByVarName.set(varName, extensionId);\n\t\tconst serialized = instance.serialize();\n\t\tif (serialized.length === 0) throw emptySerializeError(extensionId);\n\t\tenv[varName] = serialized;\n\t}\n\treturn env;\n}\n/**\n* The alchemy-process side: for each extension with a container descriptor\n* whose var is present in `env`, call its deserialize. Absent var → no entry.\n*/\nfunction deserializeContainers(extensions, env) {\n\tconst instances = /* @__PURE__ */ new Map();\n\tfor (const extension of extensions) {\n\t\tconst descriptor = extension.container;\n\t\tif (descriptor === void 0) continue;\n\t\tconst serialized = env[containerEnvVarName(extension.id)];\n\t\tif (serialized === void 0) continue;\n\t\tinstances.set(extension.id, descriptor.deserialize(serialized));\n\t}\n\treturn instances;\n}\n//#endregion\n//#region src/preflight-transport.ts\n/**\n* Carries an extension's preflight payload from the CLI process to the\n* alchemy child (which re-imports the config from scratch) — one env var per\n* extension, same channel as containers (container-transport.ts), filled by\n* whichever preflight the run executed: the deploy preflight or the local\n* target's dev preflight. The framework never reads the contents, so an\n* extension that implements both must tell its own payload kinds apart.\n* Payloads carry metadata only, never secret values: the child's environment\n* is not a secret store.\n*/\n/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_PREFLIGHT_PRISMA_COMPOSER_PRISMA_CLOUD' */\nfunction preflightEnvVarName(extensionId) {\n\treturn `PRISMA_COMPOSER_PREFLIGHT_${envVarSafeExtensionId(extensionId)}`;\n}\n/** The env entries the CLI sets on the alchemy process: `{ [preflightEnvVarName(id)]: payload }` for every extension whose preflight returned one. */\nfunction preflightEnv(payloads) {\n\tconst env = {};\n\tconst ownerByVarName = /* @__PURE__ */ new Map();\n\tfor (const [extensionId, payload] of payloads) {\n\t\tif (payload.length === 0) continue;\n\t\tconst varName = preflightEnvVarName(extensionId);\n\t\tif (varName === \"PRISMA_COMPOSER_PREFLIGHT_FINDINGS\") throw new Error(`Extension id \"${extensionId}\" uses the environment variable \"${varName}\", which Composer reserves. Rename the extension.`);\n\t\tconst owner = ownerByVarName.get(varName);\n\t\tif (owner !== void 0) throw new Error(`Extension ids \"${owner}\" and \"${extensionId}\" both use the environment variable \"${varName}\". Rename one of the extensions.`);\n\t\townerByVarName.set(varName, extensionId);\n\t\tenv[varName] = payload;\n\t}\n\treturn env;\n}\n/** The alchemy-process side: the payload this extension's own preflight wrote, or `undefined` when it wrote none (or when nothing ran a preflight at all). */\nfunction readPreflightPayload(extensionId, env) {\n\tconst payload = env[preflightEnvVarName(extensionId)];\n\treturn payload === void 0 || payload.length === 0 ? void 0 : payload;\n}\n/** One reader as the deploy prints it, for example `read by service \"shop.email\", field \"apiKey\"`. */\nfunction platformVariableReaderText(reader) {\n\tswitch (reader.kind) {\n\t\tcase \"field\": return `read by service \"${reader.service}\", field \"${reader.path === \"\" ? \"(root)\" : reader.path}\"`;\n\t\tcase \"unread\": return `named by resource \"${reader.node}\", read by no service`;\n\t}\n}\nconst isRecord = (value) => typeof value === \"object\" && value !== null && !Array.isArray(value);\nconst isStringArray = (value) => Array.isArray(value) && value.every((member) => typeof member === \"string\");\nfunction isPlatformVariableReader(value) {\n\tif (!isRecord(value)) return false;\n\tswitch (value[\"kind\"]) {\n\t\tcase \"field\": return typeof value[\"service\"] === \"string\" && typeof value[\"path\"] === \"string\";\n\t\tcase \"unread\": return typeof value[\"node\"] === \"string\";\n\t\tdefault: return false;\n\t}\n}\nfunction isUnsetPlatformVariable(value) {\n\treturn isRecord(value) && typeof value[\"name\"] === \"string\" && Array.isArray(value[\"readers\"]) && value[\"readers\"].every(isPlatformVariableReader) && isStringArray(value[\"commands\"]);\n}\nfunction isPreflightFindings(value) {\n\treturn isRecord(value) && Array.isArray(value[\"unset\"]) && value[\"unset\"].every(isUnsetPlatformVariable);\n}\n/** The variable that carries every extension's deploy preflight findings from the first process to the second. No extension's preflight variable may take this name. */\nconst PREFLIGHT_FINDINGS_ENV_VAR = \"PRISMA_COMPOSER_PREFLIGHT_FINDINGS\";\n/** The env entry the CLI sets on the second process. It is always set, and empty when nothing was found, so a stale value in the shell never reads as this run's. */\nfunction preflightFindingsEnv(findings) {\n\treturn { [PREFLIGHT_FINDINGS_ENV_VAR]: findings.unset.length === 0 ? \"\" : JSON.stringify(findings) };\n}\n/** The second process's side: the findings the CLI carried, or none. Throws on a value that does not decode: that is a framework bug. */\nfunction readPreflightFindings(env) {\n\tconst text = env[PREFLIGHT_FINDINGS_ENV_VAR];\n\tif (text === void 0 || text.length === 0) return { unset: [] };\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(text);\n\t} catch {\n\t\tparsed = void 0;\n\t}\n\tif (!isPreflightFindings(parsed)) throw new Error(`The deploy check's findings could not be read in the second process (${PREFLIGHT_FINDINGS_ENV_VAR}). This is a Composer bug; deploying again will not fix it.`);\n\treturn parsed;\n}\n//#endregion\nexport { preflightFindingsEnv as a, containerEnv as c, preflightEnvVarName as i, containerEnvVarName as l, platformVariableReaderText as n, readPreflightFindings as o, preflightEnv as r, readPreflightPayload as s, PREFLIGHT_FINDINGS_ENV_VAR as t, deserializeContainers as u };\n\n//# sourceMappingURL=preflight-transport-DJjTWvyH.mjs.map"],"mappings":";;AAEA,SAAS,sBAAsB,aAAa;CAC3C,OAAO,YAAY,YAAY,CAAC,CAAC,QAAQ,eAAe,GAAG,CAAC,CAAC,QAAQ,YAAY,EAAE;AACpF;;AAEA,SAAS,oBAAoB,aAAa;CACzC,OAAO,6BAA6B,sBAAsB,WAAW;AACtE;AACA,SAAS,eAAe,GAAG,GAAG,SAAS;CACtC,uBAAuB,IAAI,MAAM,kBAAkB,EAAE,SAAS,EAAE,kDAAkD,QAAQ,kCAAkC;AAC7J;AACA,SAAS,oBAAoB,aAAa;CACzC,uBAAuB,IAAI,MAAM,cAAc,YAAY,qHAAqH;AACjL;;AAEA,SAAS,aAAa,WAAW;CAChC,MAAM,MAAM,CAAC;CACb,MAAM,iCAAiC,IAAI,IAAI;CAC/C,KAAK,MAAM,CAAC,aAAa,aAAa,WAAW;EAChD,MAAM,UAAU,oBAAoB,WAAW;EAC/C,MAAM,QAAQ,eAAe,IAAI,OAAO;EACxC,IAAI,UAAU,KAAK,GAAG,MAAM,eAAe,OAAO,aAAa,OAAO;EACtE,eAAe,IAAI,SAAS,WAAW;EACvC,MAAM,aAAa,SAAS,UAAU;EACtC,IAAI,WAAW,WAAW,GAAG,MAAM,oBAAoB,WAAW;EAClE,IAAI,WAAW;CAChB;CACA,OAAO;AACR;;;;;;;;;;;;AA6BA,SAAS,oBAAoB,aAAa;CACzC,OAAO,6BAA6B,sBAAsB,WAAW;AACtE;;AAEA,SAAS,aAAa,UAAU;CAC/B,MAAM,MAAM,CAAC;CACb,MAAM,iCAAiC,IAAI,IAAI;CAC/C,KAAK,MAAM,CAAC,aAAa,YAAY,UAAU;EAC9C,IAAI,QAAQ,WAAW,GAAG;EAC1B,MAAM,UAAU,oBAAoB,WAAW;EAC/C,IAAI,YAAY,sCAAsC,MAAM,IAAI,MAAM,iBAAiB,YAAY,mCAAmC,QAAQ,kDAAkD;EAChM,MAAM,QAAQ,eAAe,IAAI,OAAO;EACxC,IAAI,UAAU,KAAK,GAAG,MAAM,IAAI,MAAM,kBAAkB,MAAM,SAAS,YAAY,uCAAuC,QAAQ,iCAAiC;EACnK,eAAe,IAAI,SAAS,WAAW;EACvC,IAAI,WAAW;CAChB;CACA,OAAO;AACR;;AAOA,SAAS,2BAA2B,QAAQ;CAC3C,QAAQ,OAAO,MAAf;EACC,KAAK,SAAS,OAAO,oBAAoB,OAAO,QAAQ,YAAY,OAAO,SAAS,KAAK,WAAW,OAAO,KAAK;EAChH,KAAK,UAAU,OAAO,sBAAsB,OAAO,KAAK;CACzD;AACD;;AAkBA,MAAM,6BAA6B;;AAEnC,SAAS,qBAAqB,UAAU;CACvC,OAAO,GAAG,6BAA6B,SAAS,MAAM,WAAW,IAAI,KAAK,KAAK,UAAU,QAAQ,EAAE;AACpG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as CliStructuredError } from "./result-
|
|
1
|
+
import { i as CliStructuredError } from "./result-DlBttLS8.mjs";
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
//#region ../../0-framework/3-tooling/cli/dist/composer-config-QKdY85G-.mjs
|
|
@@ -250,7 +250,7 @@ function checkComposerConfig(raw, configFile) {
|
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
252
|
//#endregion
|
|
253
|
-
//#region ../../0-framework/3-tooling/cli/dist/redaction-
|
|
253
|
+
//#region ../../0-framework/3-tooling/cli/dist/redaction-C-NnlVUh.mjs
|
|
254
254
|
const REDACTED = "[redacted]";
|
|
255
255
|
/** Env var names whose values are credentials: the service token, preflight payloads, and the usual secret spellings. */
|
|
256
256
|
const SECRET_ENV_NAME = /TOKEN|SECRET|PASSWORD|PASSWD|PRIVATE|CREDENTIAL|AUTH|API_?KEY|ACCESS_?KEY|_KEY$|DATABASE_URL|_DSN$|^PRISMA_COMPOSER_PREFLIGHT_/i;
|
|
@@ -382,15 +382,9 @@ function redactReader(reader, redaction) {
|
|
|
382
382
|
service: redaction.redact(reader.service),
|
|
383
383
|
path: redaction.redact(reader.path)
|
|
384
384
|
};
|
|
385
|
-
case "param": return {
|
|
386
|
-
kind: "param",
|
|
387
|
-
service: redaction.redact(reader.service),
|
|
388
|
-
param: redaction.redact(reader.param)
|
|
389
|
-
};
|
|
390
385
|
case "unread": return {
|
|
391
386
|
kind: "unread",
|
|
392
|
-
node: redaction.redact(reader.node)
|
|
393
|
-
nodeKind: reader.nodeKind
|
|
387
|
+
node: redaction.redact(reader.node)
|
|
394
388
|
};
|
|
395
389
|
}
|
|
396
390
|
}
|
|
@@ -558,4 +552,4 @@ var StreamRedactor = class {
|
|
|
558
552
|
//#endregion
|
|
559
553
|
export { redactDevEvent as a, redactThrown as c, checkComposerConfig as d, configFileMissing as f, sectionMissing as h, credentialLookingValues as i, redactUnsetPlatformVariable as l, noComposerExportMessage as m, SecretRedaction as n, redactError as o, entryMissing as p, StreamRedactor as r, redactSummary as s, KnownSecrets as t, valuesUnderSecretsKeys as u };
|
|
560
554
|
|
|
561
|
-
//# sourceMappingURL=redaction-
|
|
555
|
+
//# sourceMappingURL=redaction-C-NnlVUh-xg-a8RGt.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redaction-C-NnlVUh-xg-a8RGt.mjs","names":["#names"],"sources":["../../../0-framework/3-tooling/cli/dist/composer-config-QKdY85G-.mjs","../../../0-framework/3-tooling/cli/dist/redaction-C-NnlVUh.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n//#region src/composer-config.ts\n/**\n* What makes a `composer` section valid, shared by the CLI's section validator and the programmatic operations.\n* It imports nothing from the CLI engine, because `@prisma/composer` must not depend on it.\n*/\nconst SECTION_FIX = \"Write `composer: composer({ entry: './module.ts', extensions: [...], state: ... })` in prisma.config.ts, with `import { defineConfig as composer } from '@prisma/composer/config'`.\";\nconst MOVE_TO_SECTION_FIX = `${SECTION_FIX} If the project has a prisma-composer.config.ts, move its extensions and state into that section and delete the file.`;\nconst SECTION_IS_THE_ONLY_SOURCE = \"Composer reads its configuration only from the `composer` section of prisma.config.ts.\";\nconst DESCRIPTOR_FIX = \"Use the descriptor the extension factory returns, unchanged, instead of building one by hand.\";\nconst RETIRED_FILE_NAMES = [\n\t\"ts\",\n\t\"mts\",\n\t\"mjs\",\n\t\"js\"\n].map((extension) => `prisma-composer.config.${extension}`);\nconst sectionMissing = {\n\tcode: \"CONFIG.SECTION_MISSING\",\n\tsummary: \"No loaded prisma.config.ts declares a `composer` section.\",\n\twhy: `${SECTION_IS_THE_ONLY_SOURCE} A prisma-composer.config.ts file is no longer read.`,\n\tfix: MOVE_TO_SECTION_FIX\n};\n/** What the generated stack file throws when the file it imports has no `composer` export. */\nfunction noComposerExportMessage(configFile) {\n\treturn `${configFile} declares no \\`composer\\` section. Pass the prisma.config.ts that declares it.`;\n}\nfunction configFileMissing(file) {\n\treturn {\n\t\tcode: \"CONFIG.FILE_MISSING\",\n\t\tsummary: `${file} does not exist.`,\n\t\tfix: \"Pass the path of the prisma.config.ts that declares the `composer` section.\",\n\t\twhere: file\n\t};\n}\n/** A prisma-composer.config.* beside the declaring file would otherwise be silently ignored. */\n/** The path with symlinks resolved; the path itself when it cannot be resolved, so the check never throws. */\nfunction realPath(file) {\n\ttry {\n\t\treturn fs.realpathSync(file);\n\t} catch {\n\t\treturn file;\n\t}\n}\nfunction retiredFileFinding(configFile) {\n\tconst directory = path.dirname(realPath(configFile));\n\tconst found = RETIRED_FILE_NAMES.map((name) => path.join(directory, name)).find((file) => fs.existsSync(file));\n\tif (found === void 0) return void 0;\n\treturn {\n\t\tcode: \"CONFIG.FILE_RETIRED\",\n\t\tsummary: `${found} is no longer read.`,\n\t\twhy: SECTION_IS_THE_ONLY_SOURCE,\n\t\tfix: MOVE_TO_SECTION_FIX,\n\t\twhere: found\n\t};\n}\nfunction isObject(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction isExtensionDescriptor(value) {\n\treturn isObject(value) && typeof value[\"id\"] === \"string\" && value[\"id\"].length > 0 && isObject(value[\"nodes\"]);\n}\nfunction isStateDescriptor(value) {\n\treturn isObject(value) && typeof value[\"extension\"] === \"string\" && typeof value[\"create\"] === \"function\";\n}\nconst stateInvalid = {\n\tcode: \"CONFIG.FIELD_INVALID\",\n\tsummary: \"`composer.state` must be a state descriptor with a string `extension` and a `create` function.\",\n\tfix: \"Set `state` to the state descriptor an extension provides, e.g. `state: prismaState()`.\",\n\tfield: \"state\"\n};\nconst SECTION_FIELDS = /* @__PURE__ */ new Set([\n\t\"entry\",\n\t\"extensions\",\n\t\"state\",\n\t\"config\",\n\t\"secrets\"\n]);\nconst entryInvalid = {\n\tcode: \"CONFIG.FIELD_INVALID\",\n\tsummary: \"`composer.entry` must be a non-empty string: the path to the module whose default export is the app.\",\n\tfix: \"Set `entry` to that module's path, relative to prisma.config.ts, e.g. `entry: './module.ts'`.\",\n\tfield: \"entry\"\n};\n/** Neither the section's `entry` nor an override names the module whose default export is the app. */\nconst entryMissing = {\n\tcode: \"CONFIG.ENTRY_MISSING\",\n\tsummary: \"No entry module is set, so there is no app to load.\",\n\twhy: \"The entry is the module whose default export is the app root, built with appRoot(...).\",\n\tfix: \"Set `entry: './module.ts'` in the `composer` section of prisma.config.ts, or pass `--entry <path>` (the `entry` input when calling @prisma/composer/control).\",\n\tfield: \"entry\"\n};\nfunction unknownField(key) {\n\treturn {\n\t\tcode: \"CONFIG.FIELD_UNKNOWN\",\n\t\tsummary: `The \\`composer\\` section has no field \\`${key}\\`.`,\n\t\tfix: key === \"composer\" ? \"Pass the `composer` property of the prisma.config.ts export, not the whole export. The section takes only `entry`, `extensions`, `state`, `config` and `secrets`.\" : `Remove \\`${key}\\`. The section takes only \\`entry\\`, \\`extensions\\`, \\`state\\`, \\`config\\` and \\`secrets\\`.`,\n\t\tfield: key\n\t};\n}\nfunction checkExtensions(value) {\n\tif (!Array.isArray(value)) return {\n\t\textensions: [],\n\t\tfindings: [{\n\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\tsummary: \"`composer.extensions` must be an array of extension descriptors.\",\n\t\t\tfix: \"Set `extensions` to the descriptors your extensions provide, e.g. `extensions: [nodeBuild()]`.\",\n\t\t\tfield: \"extensions\"\n\t\t}]\n\t};\n\tconst findings = [];\n\tconst extensions = [];\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const [index, entry] of value.entries()) {\n\t\tconst field = `extensions[${index}]`;\n\t\tif (!isObject(entry)) {\n\t\t\tfindings.push({\n\t\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\t\tsummary: `\\`composer.${field}\\` must be an extension descriptor object.`,\n\t\t\t\tfix: \"Put the descriptor an extension factory returns here, e.g. `nodeBuild()`, not the factory itself.\",\n\t\t\t\tfield\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst id = entry[\"id\"];\n\t\tif (typeof id !== \"string\" || id.length === 0) findings.push({\n\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\tsummary: `\\`composer.${field}.id\\` must be a non-empty string (the extension package name).`,\n\t\t\tfix: DESCRIPTOR_FIX,\n\t\t\tfield: `${field}.id`\n\t\t});\n\t\telse if (seen.has(id)) findings.push({\n\t\t\tcode: \"CONFIG.EXTENSION_DUPLICATE\",\n\t\t\tsummary: `Extension \"${id}\" is listed more than once in \\`composer.extensions\\`.`,\n\t\t\tfix: `Remove the repeated \"${id}\" entry from \\`extensions\\`.`,\n\t\t\tfield: `${field}.id`\n\t\t});\n\t\telse seen.add(id);\n\t\tif (!isObject(entry[\"nodes\"])) findings.push({\n\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\tsummary: `\\`composer.${field}.nodes\\` must be an object (the node-ID → control registry).`,\n\t\t\tfix: DESCRIPTOR_FIX,\n\t\t\tfield: `${field}.nodes`\n\t\t});\n\t\tif (isExtensionDescriptor(entry)) extensions.push(entry);\n\t}\n\treturn {\n\t\tfindings,\n\t\textensions\n\t};\n}\nfunction isAdapterList(value) {\n\treturn Array.isArray(value) && value.every((entry) => typeof entry === \"function\");\n}\nfunction checkAdapters(list, value) {\n\tif (value === void 0) return [];\n\tif (!Array.isArray(value)) return [{\n\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\tsummary: `\\`composer.${list}\\` must be an array of adapters.`,\n\t\tfix: `Set \\`${list}\\` to a list of adapters, e.g. \\`${list}: [dotenv(), environmentVariables()]\\`, imported from '@prisma/composer/config'.`,\n\t\tfield: list\n\t}];\n\treturn value.flatMap((entry, index) => typeof entry === \"function\" ? [] : [{\n\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\tsummary: `\\`composer.${list}[${index}]\\` must be an adapter: a function that receives the environment and returns its values.`,\n\t\tfix: \"Put an adapter here, e.g. `dotenv()`.\",\n\t\tfield: `${list}[${index}]`\n\t}]);\n}\nfunction checkFields(section) {\n\tif (Object.hasOwn(section, \"configPath\")) return {\n\t\tok: false,\n\t\tfindings: [{\n\t\t\tcode: \"CONFIG.FIELD_RETIRED\",\n\t\t\tsummary: \"`composer.configPath` is no longer supported: prisma-composer.config.ts is no longer read.\",\n\t\t\twhy: SECTION_IS_THE_ONLY_SOURCE,\n\t\t\tfix: `Replace \\`configPath\\` with the section itself. ${MOVE_TO_SECTION_FIX}`,\n\t\t\tfield: \"configPath\"\n\t\t}]\n\t};\n\tif (Object.hasOwn(section, \"composer\")) return {\n\t\tok: false,\n\t\tfindings: [unknownField(\"composer\")]\n\t};\n\tconst findings = Object.keys(section).filter((key) => !SECTION_FIELDS.has(key)).map(unknownField);\n\tconst checked = checkExtensions(section[\"extensions\"]);\n\tfindings.push(...checked.findings);\n\tconst state = section[\"state\"];\n\tif (!isStateDescriptor(state)) findings.push(stateInvalid);\n\tconst entry = section[\"entry\"];\n\tconst entryValid = entry === void 0 || typeof entry === \"string\" && entry.length > 0;\n\tif (!entryValid) findings.push(entryInvalid);\n\tconst config = section[\"config\"];\n\tconst secrets = section[\"secrets\"];\n\tfindings.push(...checkAdapters(\"config\", config), ...checkAdapters(\"secrets\", secrets));\n\tconst [first, ...rest] = findings;\n\tif (first === void 0 && isStateDescriptor(state) && entryValid && (config === void 0 || isAdapterList(config)) && (secrets === void 0 || isAdapterList(secrets))) return {\n\t\tok: true,\n\t\tvalue: {\n\t\t\textensions: checked.extensions,\n\t\t\tstate,\n\t\t\t...entry === void 0 ? {} : { entry },\n\t\t\t...config === void 0 ? {} : { config },\n\t\t\t...secrets === void 0 ? {} : { secrets }\n\t\t}\n\t};\n\treturn {\n\t\tok: false,\n\t\tfindings: [first ?? stateInvalid, ...rest]\n\t};\n}\n/**\n* Checks the fields that identify each descriptor and returns the descriptors as the config file's own objects.\n* Never throws: a section's values are user code, and a throwing getter or Proxy trap becomes a finding.\n*/\nfunction checkComposerSection(raw) {\n\tif (!isObject(raw)) return {\n\t\tok: false,\n\t\tfindings: [{\n\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\tsummary: \"The `composer` section of prisma.config.ts must be an object.\",\n\t\t\tfix: SECTION_FIX\n\t\t}]\n\t};\n\ttry {\n\t\treturn checkFields({ ...raw });\n\t} catch (cause) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tfindings: [{\n\t\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\t\tsummary: \"The `composer` section of prisma.config.ts could not be read.\",\n\t\t\t\twhy: `Reading it threw: ${cause instanceof Error ? cause.message : String(cause)}`,\n\t\t\t\tfix: SECTION_FIX\n\t\t\t}]\n\t\t};\n\t}\n}\n/**\n* The whole check, shared by the section validator and the programmatic operations so both report the same findings in the same order: the retired file beside the declaring `configFile` (resolved through symlinks), then every field finding.\n*/\nfunction checkComposerConfig(raw, configFile) {\n\tconst retired = retiredFileFinding(configFile);\n\tconst checked = checkComposerSection(raw);\n\tif (retired === void 0) return checked;\n\treturn {\n\t\tok: false,\n\t\tfindings: checked.ok ? [retired] : [retired, ...checked.findings]\n\t};\n}\n//#endregion\nexport { sectionMissing as a, noComposerExportMessage as i, configFileMissing as n, entryMissing as r, checkComposerConfig as t };\n\n//# sourceMappingURL=composer-config-QKdY85G-.mjs.map","import { CliStructuredError } from \"@internal/foundation/errors\";\n//#region src/redaction.ts\nconst REDACTED = \"[redacted]\";\n/** Env var names whose values are credentials: the service token, preflight payloads, and the usual secret spellings. */\nconst SECRET_ENV_NAME = /TOKEN|SECRET|PASSWORD|PASSWD|PRIVATE|CREDENTIAL|AUTH|API_?KEY|ACCESS_?KEY|_KEY$|DATABASE_URL|_DSN$|^PRISMA_COMPOSER_PREFLIGHT_/i;\n/**\n* The credential-looking values in `variables`: text of eight characters or more under a name\n* that looks like a credential's. The length limit keeps a one-letter placeholder from blanking\n* every matching letter.\n*/\nfunction credentialLookingValues(variables) {\n\treturn Object.entries(variables).flatMap(([name, value]) => SECRET_ENV_NAME.test(name) && typeof value === \"string\" && value.length >= 8 ? [value] : []);\n}\n/**\n* Finds every secret in a text: one regular expression for all of them, built once. A match\n* is the span of the longest secret that starts at a position, and spans that overlap are\n* merged, so two overlapping secrets are hidden whole.\n*/\nvar SecretMatcher = class {\n\tstarts;\n\tprefixes = /* @__PURE__ */ new Set();\n\tlongestPrefix;\n\tconstructor(values) {\n\t\tconst sorted = [...new Set(values)].filter((value) => value.length > 0).sort((a, b) => b.length - a.length);\n\t\tthis.starts = sorted.length === 0 ? void 0 : new RegExp(`(?=(${sorted.map((value) => value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")).join(\"|\")}))`, \"g\");\n\t\tfor (const value of sorted) for (let length = 1; length < value.length; length++) this.prefixes.add(value.slice(0, length));\n\t\tthis.longestPrefix = Math.max(0, (sorted[0]?.length ?? 0) - 1);\n\t}\n\t/** The merged spans of every secret in `text`, in order, as `[start, end)`. */\n\tspans(text) {\n\t\tconst spans = [];\n\t\tif (this.starts === void 0) return spans;\n\t\tfor (const match of text.matchAll(this.starts)) {\n\t\t\tconst start = match.index;\n\t\t\tconst end = start + (match[1]?.length ?? 0);\n\t\t\tconst last = spans.at(-1);\n\t\t\tif (last !== void 0 && start < last[1]) last[1] = Math.max(last[1], end);\n\t\t\telse spans.push([start, end]);\n\t\t}\n\t\treturn spans;\n\t}\n\t/** The length of the longest end of `text` that is the start, not the whole, of a secret. */\n\tstartOfSecretAtEnd(text) {\n\t\tfor (let length = Math.min(this.longestPrefix, text.length); length > 0; length--) if (this.prefixes.has(text.slice(text.length - length))) return length;\n\t\treturn 0;\n\t}\n\t/** `text` with each span replaced by `[redacted]`. */\n\tredact(text) {\n\t\tlet out = \"\";\n\t\tlet from = 0;\n\t\tfor (const [start, end] of this.spans(text)) {\n\t\t\tout += text.slice(from, start) + REDACTED;\n\t\t\tfrom = end;\n\t\t}\n\t\treturn from === 0 ? text : out + text.slice(from);\n\t}\n};\n/** `text` with each value in `values` replaced by `[redacted]`, at any length; an empty one is skipped. Overlapping values are hidden whole. */\nfunction redactValues(text, values) {\n\treturn new SecretMatcher(values).redact(text);\n}\n/** `text` with bearer and basic tokens, JWTs, the password in a URL, and `token=…`-style pairs replaced by `[redacted]`. The `<value>` placeholder in a printed command is kept. */\nfunction redactShapes(text) {\n\treturn text.replace(/\\b(Bearer|Basic)\\s+[\\w.~+/=-]+/gi, `$1 ${REDACTED}`).replace(/\\beyJ[\\w-]+\\.[\\w-]+\\.[\\w-]*/g, REDACTED).replace(/(\\b[a-z][\\w+.-]*:\\/\\/[^\\s:/@]*:)[^\\s/@]+@/gi, `$1${REDACTED}@`).replace(/\\b((?:[\\w-]*[_-])?(?:token|secret|password|passwd|api[_-]?key|access[_-]?key|private[_-]?key)[\"']?\\s*[:=]\\s*[\"']?)(?!<value>(?:[\\s\"',;&]|$))[^\\s\"',;&]+/gi, `$1${REDACTED}`);\n}\n/**\n* `text` with the credential-looking values of `env` and the credential shapes replaced by\n* `[redacted]`. For a process that has no `SecretRedaction`; `SecretRedaction.redact` hides\n* the known secrets too.\n*/\nfunction redactCredentialLooking(text, env) {\n\treturn redactShapes(redactValues(text, credentialLookingValues(env)));\n}\n/**\n* The known secrets of one command: the values under the secrets keys the graph names, in the app\n* secrets and the app configuration (ADR-0062). The app configuration file must not hold any of them.\n*/\nvar KnownSecrets = class {\n\t#names = /* @__PURE__ */ new Map();\n\tconstructor(secrets = []) {\n\t\tthis.add(secrets);\n\t}\n\t/** Adds each secret whose value is not empty. A value already known keeps its first name. */\n\tadd(secrets) {\n\t\tfor (const { name, value } of secrets) if (value.length > 0 && !this.#names.has(value)) this.#names.set(value, name);\n\t}\n\tvalues() {\n\t\treturn new Set(this.#names.keys());\n\t}\n\t/**\n\t* The name of a known secret `text` holds, or undefined. A secret of\n\t* `MIN_SECRET_LENGTH_INSIDE_A_VALUE` characters or more is found anywhere in `text`; a shorter\n\t* one only when it is all of `text`.\n\t*/\n\tnameIn(text) {\n\t\tfor (const [value, name] of this.#names) if (value.length >= 8 ? text.includes(value) : text === value) return name;\n\t}\n};\n/**\n* What one command hides from everything it prints, returns or reports (ADR-0062): its known\n* secrets, and the credential-looking values, which only look like secrets by the name of the\n* variable they are under. It starts with the credential-looking values of the process\n* environment.\n*/\nvar SecretRedaction = class {\n\tknownSecrets = new KnownSecrets();\n\tcredentialLooking = /* @__PURE__ */ new Set();\n\tmatcher;\n\tconstructor(env) {\n\t\tthis.addCredentialLookingValues(credentialLookingValues(env));\n\t}\n\taddKnownSecrets(secrets) {\n\t\tthis.knownSecrets.add(secrets);\n\t}\n\taddCredentialLookingValues(values) {\n\t\tfor (const value of values) if (value.length > 0) this.credentialLooking.add(value);\n\t}\n\t/** The known secrets and the credential-looking values, longest first. */\n\tallValues() {\n\t\treturn [.../* @__PURE__ */ new Set([...this.knownSecrets.values(), ...this.credentialLooking])].sort((a, b) => b.length - a.length);\n\t}\n\t/** `text` with every known secret and credential-looking value replaced by `[redacted]` at any length, then bearer tokens, JWTs, URL passwords and `token=…` pairs. */\n\tredact(text) {\n\t\tconst size = this.knownSecrets.values().size + this.credentialLooking.size;\n\t\tif (this.matcher?.size !== size) this.matcher = {\n\t\t\tsize,\n\t\t\tmatcher: new SecretMatcher(this.allValues())\n\t\t};\n\t\treturn redactShapes(this.matcher.matcher.redact(text));\n\t}\n};\n/** The text under each name in `secretsKeys`, in the app configuration and in the app secrets, at any length. */\nfunction valuesUnderSecretsKeys(configuration, secrets, secretsKeys) {\n\treturn secretsKeys.flatMap((name) => [configuration[name], secrets[name]].flatMap((value) => typeof value === \"string\" ? [{\n\t\tname,\n\t\tvalue\n\t}] : []));\n}\nfunction redactReader(reader, redaction) {\n\tswitch (reader.kind) {\n\t\tcase \"field\": return {\n\t\t\tkind: \"field\",\n\t\t\tservice: redaction.redact(reader.service),\n\t\t\tpath: redaction.redact(reader.path)\n\t\t};\n\t\tcase \"unread\": return {\n\t\t\tkind: \"unread\",\n\t\t\tnode: redaction.redact(reader.node)\n\t\t};\n\t}\n}\n/** `variable` with every text in it redacted: its name, each reader's names and each command. */\nfunction redactUnsetPlatformVariable(variable, redaction) {\n\treturn {\n\t\tname: redaction.redact(variable.name),\n\t\treaders: variable.readers.map((reader) => redactReader(reader, redaction)),\n\t\tcommands: variable.commands.map((command) => redaction.redact(command))\n\t};\n}\nfunction redactData(value, redaction) {\n\tif (typeof value === \"string\") return redaction.redact(value);\n\tif (Array.isArray(value)) return value.map((member) => redactData(member, redaction));\n\tif (typeof value === \"object\" && value !== null && Object.getPrototypeOf(value) === Object.prototype) return Object.fromEntries(Object.entries(value).map(([key, member]) => [key, redactData(member, redaction)]));\n\treturn value;\n}\n/**\n* `error` with every value `redaction` hides removed from its summary, `why`, `fix` and every string in\n* its `meta`. The code, severity, `where` and docs link are kept. The cause is dropped, because\n* it holds the same text unredacted and a renderer may print it.\n*/\nfunction redactError(error, redaction) {\n\treturn new CliStructuredError(error.code, redaction.redact(error.message), {\n\t\tseverity: error.severity,\n\t\t...error.why === void 0 ? {} : { why: redaction.redact(error.why) },\n\t\t...error.fix === void 0 ? {} : { fix: redaction.redact(error.fix) },\n\t\t...error.where === void 0 ? {} : { where: error.where },\n\t\t...error.meta === void 0 ? {} : { meta: Object.fromEntries(Object.entries(error.meta).map(([key, value]) => [key, redactData(value, redaction)])) },\n\t\t...error.docsUrl === void 0 ? {} : { docsUrl: error.docsUrl }\n\t});\n}\nfunction setOwn(error, name, value) {\n\tObject.defineProperty(error, name, {\n\t\tvalue,\n\t\twritable: true,\n\t\tconfigurable: true\n\t});\n}\nconst UNPRINTABLE = \"A value was thrown that cannot be turned into text.\";\nfunction safeString(value) {\n\ttry {\n\t\treturn String(value);\n\t} catch {\n\t\ttry {\n\t\t\treturn Object.prototype.toString.call(value);\n\t\t} catch {\n\t\t\treturn UNPRINTABLE;\n\t\t}\n\t}\n}\n/**\n* The error to rethrow in place of a thrown defect, with every secret removed from its message\n* and stack, and from those of each error in its `cause` chain and in an `AggregateError`'s\n* `errors`. A cause that is text or plain data becomes a redacted copy. Each error is redacted\n* in place where it can be. One whose properties cannot change, such as a frozen error, is\n* replaced by a new error with the redacted message, stack and cause. A thrown value that is not\n* an `Error` becomes an `Error` whose message is its redacted text. Never throws: when reading\n* the error fails, the result is a new `Error` holding the redacted text of what was thrown.\n*/\nfunction redactThrown(thrown, redaction) {\n\ttry {\n\t\treturn thrown instanceof Error ? redactErrorChain(thrown, redaction, /* @__PURE__ */ new Map()) : new Error(redaction.redact(safeString(thrown)));\n\t} catch {\n\t\treturn new Error(redaction.redact(safeString(thrown)));\n\t}\n}\nfunction redactErrorChain(error, redaction, seen) {\n\tconst done = seen.get(error);\n\tif (done !== void 0) return done;\n\tseen.set(error, error);\n\tconst message = redaction.redact(typeof error.message === \"string\" ? error.message : safeString(error.message));\n\tconst stack = typeof error.stack === \"string\" ? redaction.redact(error.stack) : void 0;\n\tconst cause = error.cause instanceof Error ? redactErrorChain(error.cause, redaction, seen) : redactData(error.cause, redaction);\n\tconst members = error instanceof AggregateError ? error.errors.map((member) => member instanceof Error ? redactErrorChain(member, redaction, seen) : redactData(member, redaction)) : void 0;\n\ttry {\n\t\tsetOwn(error, \"message\", message);\n\t\tif (stack !== void 0) setOwn(error, \"stack\", stack);\n\t\tif (error.cause !== void 0) setOwn(error, \"cause\", cause);\n\t\tif (members !== void 0) setOwn(error, \"errors\", members);\n\t\treturn error;\n\t} catch {\n\t\tconst options = cause === void 0 ? void 0 : { cause };\n\t\tconst copy = members === void 0 ? new Error(message, options) : new AggregateError(members, message, options);\n\t\tcopy.name = error.name;\n\t\tsetOwn(copy, \"stack\", stack ?? `${error.name}: ${message}`);\n\t\tseen.set(error, copy);\n\t\treturn copy;\n\t}\n}\n/** `event` with every value `redaction` hides removed from the text it carries: a message, or a dev server's output line. */\nfunction redactDevEvent(event, redaction) {\n\tswitch (event.kind) {\n\t\tcase \"target-warning\":\n\t\tcase \"rebuild-failed\":\n\t\tcase \"watch-error\":\n\t\tcase \"stop-error\": return {\n\t\t\t...event,\n\t\t\tmessage: redaction.redact(event.message)\n\t\t};\n\t\tcase \"dev-server-output\": return {\n\t\t\t...event,\n\t\t\tline: redaction.redact(event.line)\n\t\t};\n\t\tdefault: return event;\n\t}\n}\n/** `summary` with every value `redaction` hides removed from each entity's id, url and details. */\nfunction redactSummary(summary, redaction) {\n\tif (summary === void 0) return void 0;\n\treturn {\n\t\tapp: summary.app,\n\t\tnodes: summary.nodes.map((node) => ({\n\t\t\taddress: node.address,\n\t\t\tentities: node.entities.map((entity) => ({\n\t\t\t\t...entity,\n\t\t\t\tid: redaction.redact(entity.id),\n\t\t\t\t...entity.url === void 0 ? {} : { url: redaction.redact(entity.url) },\n\t\t\t\t...entity.details === void 0 ? {} : { details: Object.fromEntries(Object.entries(entity.details).map(([key, value]) => [key, redaction.redact(value)])) }\n\t\t\t}))\n\t\t}))\n\t};\n}\nfunction isHighSurrogate(code) {\n\treturn code >= 55296 && code <= 56319;\n}\n/**\n* Redacts a stream of text chunk by chunk: every value in `values` becomes `[redacted]`, and\n* overlapping values are hidden whole. It holds back only the end of the text that could still\n* be part of a value: the longest end that could start one, or a match that a later value could\n* extend. So a value split across two chunks is still replaced, and text that cannot start one,\n* such as a prompt, is returned at once. It never splits a surrogate pair. `push` returns the\n* text that is ready; `end` returns the rest.\n*/\nvar StreamRedactor = class {\n\theld = \"\";\n\tmatcher;\n\tconstructor(values) {\n\t\tthis.matcher = new SecretMatcher(values);\n\t}\n\tpush(chunk) {\n\t\tconst text = this.held + chunk;\n\t\tconst cut = text.length - this.matcher.startOfSecretAtEnd(text);\n\t\tlet out = \"\";\n\t\tlet from = 0;\n\t\tlet ready = cut;\n\t\tfor (const [start, end] of this.matcher.spans(text)) {\n\t\t\tif (end > cut) {\n\t\t\t\tready = Math.min(cut, start);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tout += text.slice(from, start) + REDACTED;\n\t\t\tfrom = end;\n\t\t}\n\t\tif (ready > from && ready < text.length && isHighSurrogate(text.charCodeAt(ready - 1))) ready -= 1;\n\t\tthis.held = text.slice(ready);\n\t\treturn out + text.slice(from, ready);\n\t}\n\tend() {\n\t\tconst text = this.held;\n\t\tthis.held = \"\";\n\t\treturn this.matcher.redact(text);\n\t}\n};\n//#endregion\nexport { redactCredentialLooking as a, redactSummary as c, valuesUnderSecretsKeys as d, credentialLookingValues as i, redactThrown as l, SecretRedaction as n, redactDevEvent as o, StreamRedactor as r, redactError as s, KnownSecrets as t, redactUnsetPlatformVariable as u };\n\n//# sourceMappingURL=redaction-C-NnlVUh.mjs.map"],"mappings":";;;;;;;;AAOA,MAAM,cAAc;AACpB,MAAM,sBAAsB,GAAG,YAAY;AAC3C,MAAM,6BAA6B;AACnC,MAAM,iBAAiB;AACvB,MAAM,qBAAqB;CAC1B;CACA;CACA;CACA;AACD,CAAC,CAAC,KAAK,cAAc,0BAA0B,WAAW;AAC1D,MAAM,i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