@prisma/composer-cli 0.38.0-dev.3 → 0.38.0-dev.4
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-Dk65W3Az.mjs → app-configuration-file-CeJvBAti-DA4EKwFq.mjs} +2 -2
- package/dist/{app-configuration-file-CeJvBAti-Dk65W3Az.mjs.map → app-configuration-file-CeJvBAti-DA4EKwFq.mjs.map} +1 -1
- package/dist/{dev-current-BDGLPKn4-XxTPunX9.mjs → dev-current-wD5YDLjA-CFI8XTAK.mjs} +5 -5
- package/dist/{dev-current-BDGLPKn4-XxTPunX9.mjs.map → dev-current-wD5YDLjA-CFI8XTAK.mjs.map} +1 -1
- package/dist/{dev-environment-name-6eEr5PW8-DpdGjmTb.mjs → dev-environment-name-6eEr5PW8-Bs4Dl0vW.mjs} +2 -2
- package/dist/{dev-environment-name-6eEr5PW8-DpdGjmTb.mjs.map → dev-environment-name-6eEr5PW8-Bs4Dl0vW.mjs.map} +1 -1
- package/dist/{dist-BH6HQ6zZ.mjs → dist-D0rWRHos.mjs} +2 -2
- package/dist/{dist-BH6HQ6zZ.mjs.map → dist-D0rWRHos.mjs.map} +1 -1
- package/dist/{execute-deploy-destroy-400RP-8_-BCQzD7g6.mjs → execute-deploy-destroy-DOzo2Psp-2iWcFbD9.mjs} +24 -13
- package/dist/execute-deploy-destroy-DOzo2Psp-2iWcFbD9.mjs.map +1 -0
- package/dist/{execute-dev-CXMMh98q-xMBMcgPi.mjs → execute-dev-BIyOI3Ys-DGpTd9rP.mjs} +12 -11
- package/dist/{execute-dev-CXMMh98q-xMBMcgPi.mjs.map → execute-dev-BIyOI3Ys-DGpTd9rP.mjs.map} +1 -1
- package/dist/{execute-dev-current-S4Dg9y1f-BOMqG5ez.mjs → execute-dev-current-CKOzjWuO-DTOVqZzZ.mjs} +6 -6
- package/dist/{execute-dev-current-S4Dg9y1f-BOMqG5ez.mjs.map → execute-dev-current-CKOzjWuO-DTOVqZzZ.mjs.map} +1 -1
- package/dist/family.d.mts +1 -1
- package/dist/family.mjs +27 -7
- package/dist/family.mjs.map +1 -1
- package/dist/{generate-dev-stack-BV_n-X9n-BDBjgphH.mjs → generate-dev-stack-BV_n-X9n-DM5faH3-.mjs} +2 -2
- package/dist/{generate-dev-stack-BV_n-X9n-BDBjgphH.mjs.map → generate-dev-stack-BV_n-X9n-DM5faH3-.mjs.map} +1 -1
- package/dist/{list-deployed-Nan-WKgM.mjs → list-deployed-B6KD-YRY.mjs} +3 -3
- package/dist/{list-deployed-Nan-WKgM.mjs.map → list-deployed-B6KD-YRY.mjs.map} +1 -1
- package/dist/{config-DiZaanS3.mjs → preflight-transport-DmmtoFPH-CZ0o7QPf.mjs} +19 -6
- package/dist/preflight-transport-DmmtoFPH-CZ0o7QPf.mjs.map +1 -0
- package/dist/{redaction-Bf8FvTFH-BH-Vtt47.d.mts → redaction-Bf8FvTFH-XGchRgrK.d.mts} +54 -15
- package/dist/{redaction-Bf8FvTFH-BH-Vtt47.d.mts.map → redaction-Bf8FvTFH-XGchRgrK.d.mts.map} +1 -1
- package/dist/{redaction-HnbkSFrK-CCKJNRwi.mjs → redaction-DXung4ip-Co_fv4Zl.mjs} +32 -5
- package/dist/redaction-DXung4ip-Co_fv4Zl.mjs.map +1 -0
- package/dist/{run-alchemy-OS_ix5g0-DSlHsv2p.mjs → run-alchemy-CRLAyOtt-CwFLe4Zg.mjs} +3 -3
- package/dist/{run-alchemy-OS_ix5g0-DSlHsv2p.mjs.map → run-alchemy-CRLAyOtt-CwFLe4Zg.mjs.map} +1 -1
- package/dist/testing.d.mts +1 -1
- package/dist/testing.mjs +4 -4
- package/dist/testing.mjs.map +1 -1
- package/dist/{validate-environment-CpQLC3CA-Ct-PXoKN.mjs → validate-environment-D1BTCkTs-C5m4rL6t.mjs} +19 -4
- package/dist/validate-environment-D1BTCkTs-C5m4rL6t.mjs.map +1 -0
- package/package.json +7 -7
- package/dist/config-DiZaanS3.mjs.map +0 -1
- package/dist/execute-deploy-destroy-400RP-8_-BCQzD7g6.mjs.map +0 -1
- package/dist/redaction-HnbkSFrK-CCKJNRwi.mjs.map +0 -1
- package/dist/validate-environment-CpQLC3CA-Ct-PXoKN.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as CliStructuredError } from "./result-sR7PBi61.mjs";
|
|
2
1
|
import { t as DEV_DIR } from "./app-config-CErnR6NK-DnKH4Kqc.mjs";
|
|
2
|
+
import { i as CliStructuredError } from "./result-sR7PBi61.mjs";
|
|
3
3
|
import * as fs from "node:fs";
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
//#region ../../0-framework/3-tooling/cli/dist/app-configuration-file-CeJvBAti.mjs
|
|
@@ -137,4 +137,4 @@ function prepareSecondProcess(input) {
|
|
|
137
137
|
//#endregion
|
|
138
138
|
export { removeLeftoverAppConfigurationFiles as i, devAppConfigurationFile as n, prepareSecondProcess as r, deployAppConfigurationFile as t };
|
|
139
139
|
|
|
140
|
-
//# sourceMappingURL=app-configuration-file-CeJvBAti-
|
|
140
|
+
//# sourceMappingURL=app-configuration-file-CeJvBAti-DA4EKwFq.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-configuration-file-CeJvBAti-Dk65W3Az.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/app-configuration-file-CeJvBAti.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { DEV_DIR } from \"@internal/core/config\";\n//#region src/app-configuration-file.ts\n/** Names the app configuration file the first process wrote for this run (ADR-0062). */\nconst APP_CONFIGURATION_FILE_ENV = \"PRISMA_COMPOSER_APP_CONFIGURATION_FILE\";\n/** `prisma dev` only: the named secrets, as a JSON object. */\nconst NAMED_SECRETS_ENV = \"PRISMA_COMPOSER_NAMED_SECRETS\";\nconst FILE_NAME = /^app-configuration-(\\d+)(-[^/]*)?\\.json$/;\n/** The app configuration file a deploy or destroy run writes: unique per run, so concurrent runs from one checkout never share one. */\nfunction deployAppConfigurationFile(cwd, runId) {\n\treturn path.join(cwd, \".prisma-composer\", `app-configuration-${String(process.pid)}-${runId}.json`);\n}\n/** The app configuration file `prisma dev` writes in an environment's folder. */\nfunction devAppConfigurationFile(devDir) {\n\treturn path.join(devDir, `app-configuration-${String(process.pid)}.json`);\n}\nfunction isRunning(pid) {\n\ttry {\n\t\tprocess.kill(pid, 0);\n\t\treturn true;\n\t} catch (error) {\n\t\treturn error instanceof Error && \"code\" in error && error.code === \"EPERM\";\n\t}\n}\n/**\n* Deletes the app configuration files that earlier runs left in `.prisma-composer/` and in\n* each dev environment's folder: a run killed before its exit handler ran leaves its file. A\n* file is deleted only when its process is not running and it is older than\n* `LEFTOVER_APP_CONFIGURATION_FILE_AGE_MS`. Never throws.\n*/\nfunction removeLeftoverAppConfigurationFiles(cwd) {\n\tconst devRoot = path.join(cwd, DEV_DIR);\n\tconst dirs = [path.join(cwd, \".prisma-composer\")];\n\ttry {\n\t\tfor (const entry of fs.readdirSync(devRoot, { withFileTypes: true })) if (entry.isDirectory()) dirs.push(path.join(devRoot, entry.name));\n\t} catch {}\n\tfor (const dir of dirs) {\n\t\tlet names;\n\t\ttry {\n\t\t\tnames = fs.readdirSync(dir);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const name of names) {\n\t\t\tconst pid = Number(FILE_NAME.exec(name)?.[1]);\n\t\t\tif (Number.isNaN(pid) || pid === process.pid || isRunning(pid)) continue;\n\t\t\tconst file = path.join(dir, name);\n\t\t\ttry {\n\t\t\t\tif (Date.now() - fs.statSync(file).mtimeMs < 6e5) continue;\n\t\t\t\tfs.rmSync(file, { force: true });\n\t\t\t} catch {}\n\t\t}\n\t}\n}\nfunction textIn(value, at) {\n\tif (typeof value === \"string\") return [{\n\t\tat,\n\t\ttext: value\n\t}];\n\tif (typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"bigint\") return [{\n\t\tat,\n\t\ttext: String(value)\n\t}];\n\tif (Array.isArray(value)) return value.flatMap((member, index) => textIn(member, [...at, String(index)]));\n\tif (typeof value === \"object\" && value !== null) return Object.entries(value).flatMap(([key, member]) => textIn(member, [...at, key]));\n\treturn [];\n}\n/**\n* Refuses when the file would hold a known secret in a plain value, a number or a boolean\n* compared as its text (`KnownSecrets.nameIn`). The message names where and the secrets key,\n* never the value.\n*/\nfunction refuseSecretsIn(read, knownSecrets) {\n\tconst places = [...read.rootInput.flatMap((field) => textIn(field.value, field.path).map(({ at, text }) => ({\n\t\twhere: `Root input field input.${at.join(\".\")}`,\n\t\ttext\n\t}))), ...Object.entries(read.configurationKeyText).map(([key, text]) => ({\n\t\twhere: `Configuration key \"${key}\"`,\n\t\ttext\n\t}))];\n\tfor (const { where, text } of places) {\n\t\tconst name = knownSecrets.nameIn(text);\n\t\tif (name === void 0) continue;\n\t\tthrow new CliStructuredError(\"CONFIG.SECRET_AS_PLAIN_VALUE\", `${where} holds the value of the secret \"${name}\", which an envSecret() in the graph reads. Composer hands the second process every plain value Load read, in a file, and never writes a secret to a file.`, { fix: `Read the secret with envSecret('${name}') where it is used, or give this plain value text that does not contain the value of \"${name}\".` });\n\t}\n}\n/**\n* First process: the handover to the second process (ADR-0062). The app configuration file at\n* `file` holds what Load read and the graph's node addresses. With `appSecrets`, which only\n* `prisma dev` passes, the environment also carries the named secrets: the app secrets under\n* the graph's secrets keys, each with text. Refuses when the file would hold any of\n* `knownSecrets`. Every other input is plain data from the graph, such as\n* `graph.appConfigurationRead`, `nodeAddresses(graph)` and `secretsKeys(graph)`, so a caller with\n* its own copy of Composer's core can pass them. The exception is `knownSecrets`, a\n* `KnownSecrets`, which such a caller builds from the testing entry.\n*/\nfunction prepareSecondProcess(input) {\n\tconst { file, appSecrets } = input;\n\trefuseSecretsIn(input.appConfigurationRead, input.knownSecrets);\n\tconst contents = {\n\t\tappConfigurationRead: input.appConfigurationRead,\n\t\tnodeAddresses: input.nodeAddresses\n\t};\n\tconst env = { [APP_CONFIGURATION_FILE_ENV]: file };\n\tif (appSecrets !== void 0) {\n\t\tconst named = {};\n\t\tfor (const key of input.secretsKeys) {\n\t\t\tconst text = appSecrets[key];\n\t\t\tif (text !== void 0 && text !== \"\") named[key] = text;\n\t\t}\n\t\tenv[NAMED_SECRETS_ENV] = JSON.stringify(named);\n\t}\n\tconst remove = () => {\n\t\ttry {\n\t\t\tfs.rmSync(file, { force: true });\n\t\t} catch {}\n\t};\n\treturn {\n\t\tenv,\n\t\twriteFile() {\n\t\t\tfs.rmSync(file, { force: true });\n\t\t\tfs.writeFileSync(file, JSON.stringify(contents), {\n\t\t\t\tmode: 384,\n\t\t\t\tflag: \"wx\"\n\t\t\t});\n\t\t\tprocess.off(\"exit\", remove);\n\t\t\tprocess.on(\"exit\", remove);\n\t\t},\n\t\tremoveFile() {\n\t\t\tprocess.off(\"exit\", remove);\n\t\t\tremove();\n\t\t}\n\t};\n}\nfunction missingVariable(name, what) {\n\treturn `${name} is not set. This stack file runs as the second process of a Composer deploy, destroy or prisma dev, which ${what}.`;\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction isTextList(value) {\n\treturn Array.isArray(value) && value.every((member) => typeof member === \"string\");\n}\nfunction rootFieldsOf(value) {\n\tif (!Array.isArray(value)) return void 0;\n\tconst fields = [];\n\tfor (const member of value) {\n\t\tif (!isRecord(member) || !isTextList(member[\"path\"])) return void 0;\n\t\tfields.push(\"value\" in member ? {\n\t\t\tpath: member[\"path\"],\n\t\t\tvalue: member[\"value\"]\n\t\t} : { path: member[\"path\"] });\n\t}\n\treturn fields;\n}\nfunction textByKeyOf(value) {\n\tif (!isRecord(value)) return void 0;\n\tconst byKey = {};\n\tfor (const [key, member] of Object.entries(value)) {\n\t\tif (typeof member !== \"string\") return void 0;\n\t\tbyKey[key] = member;\n\t}\n\treturn byKey;\n}\n/** Second process: the app configuration file the first process named in its environment. */\nfunction readAppConfigurationFile(env) {\n\tconst file = env[APP_CONFIGURATION_FILE_ENV];\n\tif (file === void 0 || file === \"\") throw new Error(missingVariable(APP_CONFIGURATION_FILE_ENV, \"names the app configuration file it wrote there\"));\n\tlet text;\n\ttry {\n\t\ttext = fs.readFileSync(file, \"utf8\");\n\t} catch (cause) {\n\t\tconst message = cause instanceof Error ? cause.message : String(cause);\n\t\tthrow new Error(`Could not read the app configuration file ${file}: ${message}. Composer deletes it when the run ends, so a stack file run by hand after that cannot read it; run the command again.`, { cause });\n\t}\n\tconst notComposers = (what) => /* @__PURE__ */ new Error(`The app configuration file ${file} is not one Composer wrote: ${what}.`);\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(text);\n\t} catch {\n\t\tthrow notComposers(\"it is not JSON\");\n\t}\n\tif (!isRecord(parsed)) throw notComposers(\"it is not JSON\");\n\tconst read = parsed[\"appConfigurationRead\"];\n\tif (!isRecord(read)) throw notComposers(\"appConfigurationRead is not an object\");\n\tconst rootInput = rootFieldsOf(read[\"rootInput\"]);\n\tif (rootInput === void 0) throw notComposers(\"rootInput is not a list of fields\");\n\tconst configurationKeyText = textByKeyOf(read[\"configurationKeyText\"]);\n\tif (configurationKeyText === void 0) throw notComposers(\"configurationKeyText is not an object of text\");\n\tconst addresses = parsed[\"nodeAddresses\"];\n\tif (!isTextList(addresses)) throw notComposers(\"nodeAddresses is not a list of node addresses\");\n\treturn {\n\t\tappConfigurationRead: {\n\t\t\trootInput,\n\t\t\tconfigurationKeyText\n\t\t},\n\t\tnodeAddresses: addresses\n\t};\n}\n/** Second process, under `prisma dev`: the named secrets the first process handed it. */\nfunction namedSecretsFromEnvironment(env) {\n\tconst text = env[NAMED_SECRETS_ENV];\n\tif (text === void 0 || text === \"\") throw new Error(missingVariable(NAMED_SECRETS_ENV, \"hands the secrets the local services need there\"));\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(text);\n\t} catch {\n\t\tparsed = void 0;\n\t}\n\tconst byKey = textByKeyOf(parsed);\n\tif (byKey === void 0) throw new Error(`${NAMED_SECRETS_ENV} is not a JSON object of text.`);\n\tconst secrets = Object.create(null);\n\tObject.assign(secrets, byKey);\n\treturn Object.freeze(secrets);\n}\n//#endregion\nexport { readAppConfigurationFile as a, prepareSecondProcess as i, devAppConfigurationFile as n, removeLeftoverAppConfigurationFiles as o, namedSecretsFromEnvironment as r, deployAppConfigurationFile as t };\n\n//# sourceMappingURL=app-configuration-file-CeJvBAti.mjs.map"],"mappings":";;;;;;AAMA,MAAM,6BAA6B;;AAEnC,MAAM,oBAAoB;AAC1B,MAAM,YAAY;;AAElB,SAAS,2BAA2B,KAAK,OAAO;CAC/C,OAAO,KAAK,KAAK,KAAK,oBAAoB,qBAAqB,OAAO,QAAQ,GAAG,EAAE,GAAG,MAAM,MAAM;AACnG;;AAEA,SAAS,wBAAwB,QAAQ;CACxC,OAAO,KAAK,KAAK,QAAQ,qBAAqB,OAAO,QAAQ,GAAG,EAAE,MAAM;AACzE;AACA,SAAS,UAAU,KAAK;CACvB,IAAI;EACH,QAAQ,KAAK,KAAK,CAAC;EACnB,OAAO;CACR,SAAS,OAAO;EACf,OAAO,iBAAiB,SAAS,UAAU,SAAS,MAAM,SAAS;CACpE;AACD;;;;;;;AAOA,SAAS,oCAAoC,KAAK;CACjD,MAAM,UAAU,KAAK,KAAK,KAAK,OAAO;CACtC,MAAM,OAAO,CAAC,KAAK,KAAK,KAAK,kBAAkB,CAAC;CAChD,IAAI;EACH,KAAK,MAAM,SAAS,GAAG,YAAY,SAAS,EAAE,eAAe,KAAK,CAAC,GAAG,IAAI,MAAM,YAAY,GAAG,KAAK,KAAK,KAAK,KAAK,SAAS,MAAM,IAAI,CAAC;CACxI,QAAQ,CAAC;CACT,KAAK,MAAM,OAAO,MAAM;EACvB,IAAI;EACJ,IAAI;GACH,QAAQ,GAAG,YAAY,GAAG;EAC3B,QAAQ;GACP;EACD;EACA,KAAK,MAAM,QAAQ,OAAO;GACzB,MAAM,MAA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,QAAQ;EACrC,MAAM,OAAO,aAAa,OAAO,IAAI;EACrC,IAAI,SAAS,KAAK,GAAG;EACrB,MAAM,IAAI,mBAAmB,gCAAgC,GAAG,MAAM,kCAAkC,KAAK,6JAA6J,EAAE,KAAK,mCAAmC,KAAK,yFAAyF,KAAK,IAAI,CAAC;CAC7Z;AACD;;;;;;;;;;;AAWA,SAAS,qBAAqB,OAAO;CACpC,MAAM,EAAE,MAAM,eAAe;CAC7B,gBAAgB,MAAM,sBAAsB,MAAM,YAAY;CAC9D,MAAM,WAAW;EAChB,sBAAsB,MAAM;EAC5B,eAAe,MAAM;CACtB;CACA,MAAM,MAAM,GAAG,6BAA6B,KAAK;CACjD,IAAI,eAAe,KAAK,GAAG;EAC1B,MAAM,QAAQ,CAAC;EACf,KAAK,MAAM,OAAO,MAAM,aAAa;GACpC,MAAM,OAAO,WAAW;GACxB,IAAI,SAAS,KAAK,KAAK,SAAS,IAAI,MAAM,OAAO;EAClD;EACA,IAAI,qBAAqB,KAAK,UAAU,KAAK;CAC9C;CACA,MAAM,eAAe;EACpB,IAAI;GACH,GAAG,OAAO,MAAM,EAAE,OAAO,KAAK,CAAC;EAChC,QAAQ,CAAC;CACV;CACA,OAAO;EACN;EACA,YAAY;GACX,GAAG,OAAO,MAAM,EAAE,OAAO,KAAK,CAAC;GAC/B,GAAG,cAAc,MAAM,KAAK,UAAU,QAAQ,GAAG;IAChD,MAAM;IACN,MAAM;GACP,CAAC;GACD,QAAQ,IAAI,QAAQ,MAAM;GAC1B,QAAQ,GAAG,QAAQ,MAAM;EAC1B;EACA,aAAa;GACZ,QAAQ,IAAI,QAAQ,MAAM;GAC1B,OAAO;EACR;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"app-configuration-file-CeJvBAti-DA4EKwFq.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/app-configuration-file-CeJvBAti.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { DEV_DIR } from \"@internal/core/config\";\n//#region src/app-configuration-file.ts\n/** Names the app configuration file the first process wrote for this run (ADR-0062). */\nconst APP_CONFIGURATION_FILE_ENV = \"PRISMA_COMPOSER_APP_CONFIGURATION_FILE\";\n/** `prisma dev` only: the named secrets, as a JSON object. */\nconst NAMED_SECRETS_ENV = \"PRISMA_COMPOSER_NAMED_SECRETS\";\nconst FILE_NAME = /^app-configuration-(\\d+)(-[^/]*)?\\.json$/;\n/** The app configuration file a deploy or destroy run writes: unique per run, so concurrent runs from one checkout never share one. */\nfunction deployAppConfigurationFile(cwd, runId) {\n\treturn path.join(cwd, \".prisma-composer\", `app-configuration-${String(process.pid)}-${runId}.json`);\n}\n/** The app configuration file `prisma dev` writes in an environment's folder. */\nfunction devAppConfigurationFile(devDir) {\n\treturn path.join(devDir, `app-configuration-${String(process.pid)}.json`);\n}\nfunction isRunning(pid) {\n\ttry {\n\t\tprocess.kill(pid, 0);\n\t\treturn true;\n\t} catch (error) {\n\t\treturn error instanceof Error && \"code\" in error && error.code === \"EPERM\";\n\t}\n}\n/**\n* Deletes the app configuration files that earlier runs left in `.prisma-composer/` and in\n* each dev environment's folder: a run killed before its exit handler ran leaves its file. A\n* file is deleted only when its process is not running and it is older than\n* `LEFTOVER_APP_CONFIGURATION_FILE_AGE_MS`. Never throws.\n*/\nfunction removeLeftoverAppConfigurationFiles(cwd) {\n\tconst devRoot = path.join(cwd, DEV_DIR);\n\tconst dirs = [path.join(cwd, \".prisma-composer\")];\n\ttry {\n\t\tfor (const entry of fs.readdirSync(devRoot, { withFileTypes: true })) if (entry.isDirectory()) dirs.push(path.join(devRoot, entry.name));\n\t} catch {}\n\tfor (const dir of dirs) {\n\t\tlet names;\n\t\ttry {\n\t\t\tnames = fs.readdirSync(dir);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const name of names) {\n\t\t\tconst pid = Number(FILE_NAME.exec(name)?.[1]);\n\t\t\tif (Number.isNaN(pid) || pid === process.pid || isRunning(pid)) continue;\n\t\t\tconst file = path.join(dir, name);\n\t\t\ttry {\n\t\t\t\tif (Date.now() - fs.statSync(file).mtimeMs < 6e5) continue;\n\t\t\t\tfs.rmSync(file, { force: true });\n\t\t\t} catch {}\n\t\t}\n\t}\n}\nfunction textIn(value, at) {\n\tif (typeof value === \"string\") return [{\n\t\tat,\n\t\ttext: value\n\t}];\n\tif (typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"bigint\") return [{\n\t\tat,\n\t\ttext: String(value)\n\t}];\n\tif (Array.isArray(value)) return value.flatMap((member, index) => textIn(member, [...at, String(index)]));\n\tif (typeof value === \"object\" && value !== null) return Object.entries(value).flatMap(([key, member]) => textIn(member, [...at, key]));\n\treturn [];\n}\n/**\n* Refuses when the file would hold a known secret in a plain value, a number or a boolean\n* compared as its text (`KnownSecrets.nameIn`). The message names where and the secrets key,\n* never the value.\n*/\nfunction refuseSecretsIn(read, knownSecrets) {\n\tconst places = [...read.rootInput.flatMap((field) => textIn(field.value, field.path).map(({ at, text }) => ({\n\t\twhere: `Root input field input.${at.join(\".\")}`,\n\t\ttext\n\t}))), ...Object.entries(read.configurationKeyText).map(([key, text]) => ({\n\t\twhere: `Configuration key \"${key}\"`,\n\t\ttext\n\t}))];\n\tfor (const { where, text } of places) {\n\t\tconst name = knownSecrets.nameIn(text);\n\t\tif (name === void 0) continue;\n\t\tthrow new CliStructuredError(\"CONFIG.SECRET_AS_PLAIN_VALUE\", `${where} holds the value of the secret \"${name}\", which an envSecret() in the graph reads. Composer hands the second process every plain value Load read, in a file, and never writes a secret to a file.`, { fix: `Read the secret with envSecret('${name}') where it is used, or give this plain value text that does not contain the value of \"${name}\".` });\n\t}\n}\n/**\n* First process: the handover to the second process (ADR-0062). The app configuration file at\n* `file` holds what Load read and the graph's node addresses. With `appSecrets`, which only\n* `prisma dev` passes, the environment also carries the named secrets: the app secrets under\n* the graph's secrets keys, each with text. Refuses when the file would hold any of\n* `knownSecrets`. Every other input is plain data from the graph, such as\n* `graph.appConfigurationRead`, `nodeAddresses(graph)` and `secretsKeys(graph)`, so a caller with\n* its own copy of Composer's core can pass them. The exception is `knownSecrets`, a\n* `KnownSecrets`, which such a caller builds from the testing entry.\n*/\nfunction prepareSecondProcess(input) {\n\tconst { file, appSecrets } = input;\n\trefuseSecretsIn(input.appConfigurationRead, input.knownSecrets);\n\tconst contents = {\n\t\tappConfigurationRead: input.appConfigurationRead,\n\t\tnodeAddresses: input.nodeAddresses\n\t};\n\tconst env = { [APP_CONFIGURATION_FILE_ENV]: file };\n\tif (appSecrets !== void 0) {\n\t\tconst named = {};\n\t\tfor (const key of input.secretsKeys) {\n\t\t\tconst text = appSecrets[key];\n\t\t\tif (text !== void 0 && text !== \"\") named[key] = text;\n\t\t}\n\t\tenv[NAMED_SECRETS_ENV] = JSON.stringify(named);\n\t}\n\tconst remove = () => {\n\t\ttry {\n\t\t\tfs.rmSync(file, { force: true });\n\t\t} catch {}\n\t};\n\treturn {\n\t\tenv,\n\t\twriteFile() {\n\t\t\tfs.rmSync(file, { force: true });\n\t\t\tfs.writeFileSync(file, JSON.stringify(contents), {\n\t\t\t\tmode: 384,\n\t\t\t\tflag: \"wx\"\n\t\t\t});\n\t\t\tprocess.off(\"exit\", remove);\n\t\t\tprocess.on(\"exit\", remove);\n\t\t},\n\t\tremoveFile() {\n\t\t\tprocess.off(\"exit\", remove);\n\t\t\tremove();\n\t\t}\n\t};\n}\nfunction missingVariable(name, what) {\n\treturn `${name} is not set. This stack file runs as the second process of a Composer deploy, destroy or prisma dev, which ${what}.`;\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction isTextList(value) {\n\treturn Array.isArray(value) && value.every((member) => typeof member === \"string\");\n}\nfunction rootFieldsOf(value) {\n\tif (!Array.isArray(value)) return void 0;\n\tconst fields = [];\n\tfor (const member of value) {\n\t\tif (!isRecord(member) || !isTextList(member[\"path\"])) return void 0;\n\t\tfields.push(\"value\" in member ? {\n\t\t\tpath: member[\"path\"],\n\t\t\tvalue: member[\"value\"]\n\t\t} : { path: member[\"path\"] });\n\t}\n\treturn fields;\n}\nfunction textByKeyOf(value) {\n\tif (!isRecord(value)) return void 0;\n\tconst byKey = {};\n\tfor (const [key, member] of Object.entries(value)) {\n\t\tif (typeof member !== \"string\") return void 0;\n\t\tbyKey[key] = member;\n\t}\n\treturn byKey;\n}\n/** Second process: the app configuration file the first process named in its environment. */\nfunction readAppConfigurationFile(env) {\n\tconst file = env[APP_CONFIGURATION_FILE_ENV];\n\tif (file === void 0 || file === \"\") throw new Error(missingVariable(APP_CONFIGURATION_FILE_ENV, \"names the app configuration file it wrote there\"));\n\tlet text;\n\ttry {\n\t\ttext = fs.readFileSync(file, \"utf8\");\n\t} catch (cause) {\n\t\tconst message = cause instanceof Error ? cause.message : String(cause);\n\t\tthrow new Error(`Could not read the app configuration file ${file}: ${message}. Composer deletes it when the run ends, so a stack file run by hand after that cannot read it; run the command again.`, { cause });\n\t}\n\tconst notComposers = (what) => /* @__PURE__ */ new Error(`The app configuration file ${file} is not one Composer wrote: ${what}.`);\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(text);\n\t} catch {\n\t\tthrow notComposers(\"it is not JSON\");\n\t}\n\tif (!isRecord(parsed)) throw notComposers(\"it is not JSON\");\n\tconst read = parsed[\"appConfigurationRead\"];\n\tif (!isRecord(read)) throw notComposers(\"appConfigurationRead is not an object\");\n\tconst rootInput = rootFieldsOf(read[\"rootInput\"]);\n\tif (rootInput === void 0) throw notComposers(\"rootInput is not a list of fields\");\n\tconst configurationKeyText = textByKeyOf(read[\"configurationKeyText\"]);\n\tif (configurationKeyText === void 0) throw notComposers(\"configurationKeyText is not an object of text\");\n\tconst addresses = parsed[\"nodeAddresses\"];\n\tif (!isTextList(addresses)) throw notComposers(\"nodeAddresses is not a list of node addresses\");\n\treturn {\n\t\tappConfigurationRead: {\n\t\t\trootInput,\n\t\t\tconfigurationKeyText\n\t\t},\n\t\tnodeAddresses: addresses\n\t};\n}\n/** Second process, under `prisma dev`: the named secrets the first process handed it. */\nfunction namedSecretsFromEnvironment(env) {\n\tconst text = env[NAMED_SECRETS_ENV];\n\tif (text === void 0 || text === \"\") throw new Error(missingVariable(NAMED_SECRETS_ENV, \"hands the secrets the local services need there\"));\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(text);\n\t} catch {\n\t\tparsed = void 0;\n\t}\n\tconst byKey = textByKeyOf(parsed);\n\tif (byKey === void 0) throw new Error(`${NAMED_SECRETS_ENV} is not a JSON object of text.`);\n\tconst secrets = Object.create(null);\n\tObject.assign(secrets, byKey);\n\treturn Object.freeze(secrets);\n}\n//#endregion\nexport { readAppConfigurationFile as a, prepareSecondProcess as i, devAppConfigurationFile as n, removeLeftoverAppConfigurationFiles as o, namedSecretsFromEnvironment as r, deployAppConfigurationFile as t };\n\n//# sourceMappingURL=app-configuration-file-CeJvBAti.mjs.map"],"mappings":";;;;;;AAMA,MAAM,6BAA6B;;AAEnC,MAAM,oBAAoB;AAC1B,MAAM,YAAY;;AAElB,SAAS,2BAA2B,KAAK,OAAO;CAC/C,OAAO,KAAK,KAAK,KAAK,oBAAoB,qBAAqB,OAAO,QAAQ,GAAG,EAAE,GAAG,MAAM,MAAM;AACnG;;AAEA,SAAS,wBAAwB,QAAQ;CACxC,OAAO,KAAK,KAAK,QAAQ,qBAAqB,OAAO,QAAQ,GAAG,EAAE,MAAM;AACzE;AACA,SAAS,UAAU,KAAK;CACvB,IAAI;EACH,QAAQ,KAAK,KAAK,CAAC;EACnB,OAAO;CACR,SAAS,OAAO;EACf,OAAO,iBAAiB,SAAS,UAAU,SAAS,MAAM,SAAS;CACpE;AACD;;;;;;;AAOA,SAAS,oCAAoC,KAAK;CACjD,MAAM,UAAU,KAAK,KAAK,KAAK,OAAO;CACtC,MAAM,OAAO,CAAC,KAAK,KAAK,KAAK,kBAAkB,CAAC;CAChD,IAAI;EACH,KAAK,MAAM,SAAS,GAAG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,GAAG,QAAQ,MAAM;EAC1B;EACA,aAAa;GACZ,QAAQ,IAAI,QAAQ,MAAM;GAC1B,OAAO;EACR;CACD;AACD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as CliStructuredError, n as ok, o as blindCast, t as notOk } from "./result-sR7PBi61.mjs";
|
|
2
|
-
//#region ../../0-framework/3-tooling/cli/dist/dev-current-
|
|
2
|
+
//#region ../../0-framework/3-tooling/cli/dist/dev-current-wD5YDLjA.mjs
|
|
3
3
|
/**
|
|
4
4
|
* Reads the execution diagnostics an engine-failure error carries in
|
|
5
5
|
* `meta.diagnostics`; undefined for every other failure.
|
|
@@ -71,7 +71,7 @@ async function deployWithDeps(input, deps) {
|
|
|
71
71
|
const cwd = input.cwd ?? process.cwd();
|
|
72
72
|
let executor;
|
|
73
73
|
try {
|
|
74
|
-
executor = await import("./execute-deploy-destroy-
|
|
74
|
+
executor = await import("./execute-deploy-destroy-DOzo2Psp-2iWcFbD9.mjs");
|
|
75
75
|
} catch (error) {
|
|
76
76
|
return notOk(executorLoadFailure("deploy", error));
|
|
77
77
|
}
|
|
@@ -89,7 +89,7 @@ async function devWithDeps(input, deps) {
|
|
|
89
89
|
const cwd = input.cwd ?? process.cwd();
|
|
90
90
|
let executor;
|
|
91
91
|
try {
|
|
92
|
-
executor = await import("./execute-dev-
|
|
92
|
+
executor = await import("./execute-dev-BIyOI3Ys-DGpTd9rP.mjs");
|
|
93
93
|
} catch (error) {
|
|
94
94
|
return notOk(executorLoadFailure("dev", error));
|
|
95
95
|
}
|
|
@@ -97,7 +97,7 @@ async function devWithDeps(input, deps) {
|
|
|
97
97
|
}
|
|
98
98
|
async function loadExecutor(operation) {
|
|
99
99
|
try {
|
|
100
|
-
return ok(await import("./execute-dev-current-
|
|
100
|
+
return ok(await import("./execute-dev-current-CKOzjWuO-DTOVqZzZ.mjs"));
|
|
101
101
|
} catch (error) {
|
|
102
102
|
return notOk(executorLoadFailure(operation, error));
|
|
103
103
|
}
|
|
@@ -117,4 +117,4 @@ async function devStop(input) {
|
|
|
117
117
|
//#endregion
|
|
118
118
|
export { devWithDeps as a, toStructured as c, devUrl as i, deployWithDeps as n, executionDiagnostics as o, devStop as r, requireContainerForEnvironment as s, DEFAULT_DEPLOY_ENVIRONMENT as t };
|
|
119
119
|
|
|
120
|
-
//# sourceMappingURL=dev-current-
|
|
120
|
+
//# sourceMappingURL=dev-current-wD5YDLjA-CFI8XTAK.mjs.map
|
package/dist/{dev-current-BDGLPKn4-XxTPunX9.mjs.map → dev-current-wD5YDLjA-CFI8XTAK.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-current-
|
|
1
|
+
{"version":3,"file":"dev-current-wD5YDLjA-CFI8XTAK.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/dev-current-wD5YDLjA.mjs"],"sourcesContent":["import { CliStructuredError } from \"@internal/foundation/errors\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport { notOk, ok } from \"@internal/foundation/result\";\n//#region src/operations/shared.ts\n/**\n* Reads the execution diagnostics an engine-failure error carries in\n* `meta.diagnostics`; undefined for every other failure.\n*/\nfunction executionDiagnostics(f) {\n\tconst diagnostics = f.meta?.[\"diagnostics\"];\n\tif (typeof diagnostics !== \"object\" || diagnostics === null) return void 0;\n\tconst candidate = blindCast(diagnostics);\n\tif (candidate[\"exitCode\"] !== void 0 && typeof candidate[\"exitCode\"] !== \"number\" || candidate[\"signal\"] !== void 0 && typeof candidate[\"signal\"] !== \"string\" || typeof candidate[\"stackFilePath\"] !== \"string\" || typeof candidate[\"reproduceCommand\"] !== \"string\" || typeof candidate[\"cwd\"] !== \"string\") return;\n\treturn blindCast(diagnostics);\n}\n/**\n* Site-specific wrap for foreign extension/environment causes — passthrough\n* when already structured; never a boundary fallback (base-type rule 6(ii)).\n*/\nfunction toStructured(code, error) {\n\treturn CliStructuredError.is(error) ? error : new CliStructuredError(code, error instanceof Error ? error.message : String(error), { cause: error });\n}\n/** A failed executor import: an environmental failure of the consumer's\n* installed tree, not a bug here. The import error rides as the cause. */\nfunction executorLoadFailure(operation, error) {\n\treturn new CliStructuredError(\"DEPS.EXECUTOR_UNLOADABLE\", `Could not load the ${operation} executor: ${error instanceof Error ? error.message : String(error)}`, {\n\t\twhy: `The ${operation} operation's executor imports the deploy engine's provider tree from your app's installed dependencies, and that import failed.`,\n\t\tfix: \"Reinstall your dependencies, and check that `alchemy` is installed and loadable from your app.\",\n\t\tcause: error\n\t});\n}\nconst RUN_OF = {\n\tdeploy: {\n\t\trunning: \"this deploy\",\n\t\truns: \"the deploy\"\n\t},\n\tdestroy: {\n\t\trunning: \"this destroy\",\n\t\truns: \"the destroy\"\n\t},\n\tdev: {\n\t\trunning: \"`prisma dev`\",\n\t\truns: \"`prisma dev`\"\n\t}\n};\n/**\n* An extension older than this Composer stores the input it is given but\n* resolves from a key without `environment`, so it may read every name as\n* production, or, locally, put every environment in one copy. Its\n* `deserialize` rebuilds only the fields it knows, so the container the\n* Alchemy child rebuilds shows which environment it really resolved.\n* Refusing here keeps a mismatched install from deploying into, destroying\n* or running the wrong place.\n*/\nfunction requireContainerForEnvironment(action, extensionId, descriptor, instance, environment) {\n\tlet rebuiltEnvironment;\n\ttry {\n\t\trebuiltEnvironment = descriptor.deserialize(instance.serialize()).input.environment;\n\t} catch {\n\t\trebuiltEnvironment = void 0;\n\t}\n\tif (rebuiltEnvironment === environment) return;\n\tconst { running, runs } = RUN_OF[action];\n\tthrow new CliStructuredError(\"DEPS.EXTENSION_INCOMPATIBLE\", `The extension ${extensionId} is older than the Composer running ${running}, so it would not resolve the environment ${environment}.`, { fix: `Install the same Composer version of ${extensionId} as the Composer that runs ${runs}.` });\n}\n//#endregion\n//#region src/operations/deploy.ts\n/** The environment `deploy` targets when none is named. */\nconst DEFAULT_DEPLOY_ENVIRONMENT = \"production\";\nasync function deploy(input) {\n\treturn deployWithDeps(input, {});\n}\n/** In-package variant threading the injection seam, which the family's\n* commands and the unit tests use. Deliberately NOT re-exported through `./control` — the seam mirrors\n* internal types and is not part of the published surface. */\nasync function deployWithDeps(input, deps) {\n\tconst startedAt = performance.now();\n\tconst cwd = input.cwd ?? process.cwd();\n\tlet executor;\n\ttry {\n\t\texecutor = await import(\"./execute-deploy-destroy-DOzo2Psp.mjs\");\n\t} catch (error) {\n\t\treturn notOk(executorLoadFailure(\"deploy\", error));\n\t}\n\tconst result = await executor.executeDeploy(input, deps, cwd);\n\tif (!result.ok) return result;\n\treturn ok({\n\t\t...result.value,\n\t\tdurationMs: Math.round(performance.now() - startedAt)\n\t});\n}\n//#endregion\n//#region src/operations/dev.ts\nasync function dev(input) {\n\treturn devWithDeps(input, {});\n}\n/** In-package variant threading the injection seam, which the family's\n* commands and the unit tests use. Deliberately NOT re-exported through `./control` — the seam mirrors\n* internal types and is not part of the published surface. */\nasync function devWithDeps(input, deps) {\n\tconst cwd = input.cwd ?? process.cwd();\n\tlet executor;\n\ttry {\n\t\texecutor = await import(\"./execute-dev-BIyOI3Ys.mjs\");\n\t} catch (error) {\n\t\treturn notOk(executorLoadFailure(\"dev\", error));\n\t}\n\treturn executor.executeDev(input, deps, cwd);\n}\n//#endregion\n//#region src/operations/dev-current.ts\nasync function loadExecutor(operation) {\n\ttry {\n\t\treturn ok(await import(\"./execute-dev-current-CKOzjWuO.mjs\"));\n\t} catch (error) {\n\t\treturn notOk(executorLoadFailure(operation, error));\n\t}\n}\n/** Where the node at `input.address` runs locally in the environment. */\nasync function devUrl(input) {\n\tconst executor = await loadExecutor(\"dev url\");\n\tif (!executor.ok) return executor;\n\treturn executor.value.executeDevUrl(input, input.cwd ?? process.cwd());\n}\n/** Stops the app's local copy in the environment: its service processes and database servers. Data and ports stay. */\nasync function devStop(input) {\n\tconst executor = await loadExecutor(\"dev stop\");\n\tif (!executor.ok) return executor;\n\treturn executor.value.executeDevStop(input, input.cwd ?? process.cwd());\n}\n//#endregion\nexport { DEFAULT_DEPLOY_ENVIRONMENT as a, executionDiagnostics as c, toStructured as d, devWithDeps as i, executorLoadFailure as l, devUrl as n, deploy as o, dev as r, deployWithDeps as s, devStop as t, requireContainerForEnvironment as u };\n\n//# sourceMappingURL=dev-current-wD5YDLjA.mjs.map"],"mappings":";;;;;;AAQA,SAAS,qBAAqB,GAAG;CAChC,MAAM,cAAc,EAAE,OAAO;CAC7B,IAAI,OAAO,gBAAgB,YAAY,gBAAgB,MAAM,OAAO,KAAK;CACzE,MAAM,YAAY,UAAU,WAAW;CACvC,IAAI,UAAU,gBAAgB,KAAK,KAAK,OAAO,UAAU,gBAAgB,YAAY,UAAU,cAAc,KAAK,KAAK,OAAO,UAAU,cAAc,YAAY,OAAO,UAAU,qBAAqB,YAAY,OAAO,UAAU,wBAAwB,YAAY,OAAO,UAAU,WAAW,UAAU;CAC/S,OAAO,UAAU,WAAW;AAC7B;;;;;AAKA,SAAS,aAAa,MAAM,OAAO;CAClC,OAAO,mBAAmB,GAAG,KAAK,IAAI,QAAQ,IAAI,mBAAmB,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG,EAAE,OAAO,MAAM,CAAC;AACpJ;;;AAGA,SAAS,oBAAoB,WAAW,OAAO;CAC9C,OAAO,IAAI,mBAAmB,4BAA4B,sBAAsB,UAAU,aAAa,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,KAAK;EAChK,KAAK,OAAO,UAAU;EACtB,KAAK;EACL,OAAO;CACR,CAAC;AACF;AACA,MAAM,SAAS;CACd,QAAQ;EACP,SAAS;EACT,MAAM;CACP;CACA,SAAS;EACR,SAAS;EACT,MAAM;CACP;CACA,KAAK;EACJ,SAAS;EACT,MAAM;CACP;AACD;;;;;;;;;;AAUA,SAAS,+BAA+B,QAAQ,aAAa,YAAY,UAAU,aAAa;CAC/F,IAAI;CACJ,IAAI;EACH,qBAAqB,WAAW,YAAY,SAAS,UAAU,CAAC,CAAC,CAAC,MAAM;CACzE,QAAQ;EACP,qBAAqB,KAAK;CAC3B;CACA,IAAI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AW,MAAM,aAAa,UAAU;CAC9C,IAAI,CAAC,SAAS,IAAI,OAAO;CACzB,OAAO,SAAS,MAAM,eAAe,OAAO,MAAM,OAAO,QAAQ,IAAI,CAAC;AACvE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as CliStructuredError } from "./result-sR7PBi61.mjs";
|
|
2
1
|
import { i as isBuildOnlyExtension, n as DEV_ENVIRONMENT_NAME_FILE } from "./app-config-CErnR6NK-DnKH4Kqc.mjs";
|
|
2
|
+
import { i as CliStructuredError } from "./result-sR7PBi61.mjs";
|
|
3
3
|
import * as fs from "node:fs";
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import "effect/Layer";
|
|
@@ -68,4 +68,4 @@ function claimDevEnvironmentName(devDir, environment) {
|
|
|
68
68
|
//#endregion
|
|
69
69
|
export { requireDevEnvironmentName as n, resolveLocalTargets as r, claimDevEnvironmentName as t };
|
|
70
70
|
|
|
71
|
-
//# sourceMappingURL=dev-environment-name-6eEr5PW8-
|
|
71
|
+
//# sourceMappingURL=dev-environment-name-6eEr5PW8-Bs4Dl0vW.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-environment-name-6eEr5PW8-
|
|
1
|
+
{"version":3,"file":"dev-environment-name-6eEr5PW8-Bs4Dl0vW.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/local-target.mjs","../../../0-framework/3-tooling/cli/dist/dev-environment-name-6eEr5PW8.mjs"],"sourcesContent":["import { a as isBuildOnlyExtension, i as devEnvironmentDir, n as DEV_ENVIRONMENT_NAME_FILE, t as DEV_DIR } from \"./app-config-CErnR6NK.mjs\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport * as Layer from \"effect/Layer\";\nimport { localState } from \"alchemy/State/LocalState\";\n//#region src/control/local-target.ts\n/** The local-target stack's own provider aggregation (ADR-0041; naming, operator 2026-07-23 — the seam is `localTarget`, \"dev\" names the user-facing feature only) — the local-target counterpart of `deploy.ts`'s `mergedProviders`, kept in its own module so `lower()` learns nothing about it (deploy.ts's REVISED — operator review of #162). */\nfunction noLocalTargetSupportError(id) {\n\treturn new CliStructuredError(\"DEV.TARGET_UNSUPPORTED\", `extension \"${id}\" has no dev support — it declares no \\`localTarget\\` descriptor (ADR-0041).`);\n}\n/**\n* Resolves every non-build-only configured extension's lazy `localTarget`\n* thunk, once (ADR-0041's lazy local-target reference — operator directive:\n* the production control entry carries only the thunk, never the\n* descriptor, so resolving it is this module's job, not something a deploy\n* path ever does). A build-only extension (`isBuildOnlyExtension`) owns no\n* resources or services and is skipped entirely — never even checked for a\n* `localTarget` thunk. Every other configured extension must be\n* local-target-capable, or the dev command cannot bring the app up at all,\n* so a missing thunk throws naming the extension. The generated dev stack\n* module calls this once and threads the resolved map through every\n* subsequent hook, including `localTargetProviders`.\n*/\nasync function resolveLocalTargets(config) {\n\tconst entries = await Promise.all(config.extensions.flatMap((extension) => {\n\t\tif (isBuildOnlyExtension(extension)) return [];\n\t\tif (extension.localTarget === void 0) throw noLocalTargetSupportError(extension.id);\n\t\treturn [extension.localTarget().then((descriptor) => [extension.id, descriptor])];\n\t}));\n\treturn new Map(entries);\n}\n/**\n* All configured extensions' local-target providers merged, config array\n* order (ADR-0041), from the ALREADY-RESOLVED descriptor map\n* (`resolveLocalTargets`'s product — this function itself never touches a\n* `localTarget` thunk). The generated dev stack module is this\n* aggregator's one caller, passing the result as `LowerOptions.providers`.\n*/\nfunction localTargetProviders(resolved, containers, devDir, configurationKeyText, namedSecrets) {\n\tconst [first, ...rest] = [...resolved.entries()].map(([id, descriptor]) => descriptor.providers({\n\t\tcontainer: containers.get(id),\n\t\tdevDir,\n\t\tconfigurationKeyText,\n\t\tnamedSecrets\n\t}));\n\treturn first === void 0 ? Layer.empty : Layer.mergeAll(first, ...rest);\n}\n/** The state store `prisma dev` converges against: Alchemy's file store in the app's working directory. */\nfunction devState() {\n\treturn localState();\n}\n//#endregion\nexport { DEV_DIR, DEV_ENVIRONMENT_NAME_FILE, devEnvironmentDir, devState, localTargetProviders, resolveLocalTargets };\n\n//# sourceMappingURL=local-target.mjs.map","import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { DEV_ENVIRONMENT_NAME_FILE } from \"@internal/core/local-target\";\n//#region src/operations/dev-environment-name.ts\n/**\n* Each environment's folder records the environment's exact name. On a\n* case-insensitive filesystem `--environment Dev` would otherwise open the\n* folder of `dev` and run, or `--fresh` delete, that copy.\n*/\nfunction recordedName(devDir) {\n\tconst file = path.join(devDir, DEV_ENVIRONMENT_NAME_FILE);\n\treturn fs.existsSync(file) ? fs.readFileSync(file, \"utf8\").trim() : void 0;\n}\nfunction nameMismatch(devDir, recorded, environment) {\n\treturn new CliStructuredError(\"DEV.ENVIRONMENT_NAME_MISMATCH\", `The folder ${devDir} holds the local copy of the environment ${recorded}, not ${environment}.`, {\n\t\twhy: \"On a case-insensitive filesystem, such as the default on macOS, environment names that differ only in case share one folder, so they cannot be separate local copies.\",\n\t\tfix: `Pass \\`--environment ${recorded}\\` for that copy, or pick a name that differs from ${recorded} by more than case.`,\n\t\tmeta: {\n\t\t\tdevDir,\n\t\t\trecorded,\n\t\t\tenvironment\n\t\t}\n\t});\n}\n/** Fails when the folder records another environment's name; a folder with no name recorded passes. */\nfunction requireDevEnvironmentName(devDir, environment) {\n\tconst recorded = recordedName(devDir);\n\tif (recorded !== void 0 && recorded !== environment) throw nameMismatch(devDir, recorded, environment);\n}\n/** Records the environment's name in its folder on first use; fails when the folder records another name. */\nfunction claimDevEnvironmentName(devDir, environment) {\n\tconst recorded = recordedName(devDir);\n\tif (recorded === environment) return;\n\tif (recorded !== void 0) throw nameMismatch(devDir, recorded, environment);\n\tfs.mkdirSync(devDir, { recursive: true });\n\tfs.writeFileSync(path.join(devDir, DEV_ENVIRONMENT_NAME_FILE), `${environment}\\n`);\n}\n//#endregion\nexport { requireDevEnvironmentName as n, claimDevEnvironmentName as t };\n\n//# sourceM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AK,CAAC;CACxC,GAAG,cAAc,KAAK,KAAK,QAAQ,yBAAyB,GAAG,GAAG,YAAY,GAAG;AAClF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as __require, s as __commonJSMin } from "./validate-environment-
|
|
1
|
+
import { c as __require, s as __commonJSMin } from "./validate-environment-D1BTCkTs-C5m4rL6t.mjs";
|
|
2
2
|
import { i as CliStructuredError, n as ok, t as notOk } from "./result-sR7PBi61.mjs";
|
|
3
3
|
import * as fs from "node:fs";
|
|
4
4
|
import * as path from "node:path";
|
|
@@ -1788,4 +1788,4 @@ async function listEmulators(opts = {}) {
|
|
|
1788
1788
|
//#endregion
|
|
1789
1789
|
export { listEmulators };
|
|
1790
1790
|
|
|
1791
|
-
//# sourceMappingURL=dist-
|
|
1791
|
+
//# sourceMappingURL=dist-D0rWRHos.mjs.map
|