@prisma/composer 0.36.0 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/{app-config-DNnd7Zu--BQ1vHaMK.d.mts → app-config-Bf_y5R7o-BEZAnKqM.d.mts} +46 -6
  2. package/dist/app-config-Bf_y5R7o-BEZAnKqM.d.mts.map +1 -0
  3. package/dist/app-configuration-file-CeJvBAti-D3uDlheX.mjs +221 -0
  4. package/dist/app-configuration-file-CeJvBAti-D3uDlheX.mjs.map +1 -0
  5. package/dist/arktype.d.mts +20 -6
  6. package/dist/arktype.d.mts.map +1 -1
  7. package/dist/arktype.mjs +45 -6
  8. package/dist/arktype.mjs.map +1 -1
  9. package/dist/config-CDkq5Ayl.d.mts +1 -0
  10. package/dist/config-adapters-DG-uhGfv-Bt1M9f8b.mjs +47 -0
  11. package/dist/config-adapters-DG-uhGfv-Bt1M9f8b.mjs.map +1 -0
  12. package/dist/config.d.mts +16 -3
  13. package/dist/config.d.mts.map +1 -0
  14. package/dist/config.mjs +2 -1
  15. package/dist/control.d.mts +6 -174
  16. package/dist/control.d.mts.map +1 -1
  17. package/dist/control.mjs +4 -4
  18. package/dist/control.mjs.map +1 -1
  19. package/dist/deploy-CmiYExQA.mjs +373 -0
  20. package/dist/deploy-CmiYExQA.mjs.map +1 -0
  21. package/dist/deploy-DQyaIoNe.d.mts +2 -0
  22. package/dist/deploy.d.mts +4 -3
  23. package/dist/deploy.mjs +3 -364
  24. package/dist/{deployment-summary-CDHdLtnO-DrE7GsHq.mjs → deployment-summary-BiBkPWlB-CyC2pudN.mjs} +10 -23
  25. package/dist/deployment-summary-BiBkPWlB-CyC2pudN.mjs.map +1 -0
  26. package/dist/{deployment-summary-p88NV5m5-SaPCCX2C.d.mts → deployment-summary-p88NV5m5-BJOosgmI.d.mts} +3 -3
  27. package/dist/{deployment-summary-p88NV5m5-SaPCCX2C.d.mts.map → deployment-summary-p88NV5m5-BJOosgmI.d.mts.map} +1 -1
  28. package/dist/{secret-DoWGmN7m-DO5Brq1Y.mjs → describe-kind-Cpm_euxo-CkhlGJUL.mjs} +29 -2
  29. package/dist/describe-kind-Cpm_euxo-CkhlGJUL.mjs.map +1 -0
  30. package/dist/{dev-current-Brb4qugP-CG0_96FZ.mjs → dev-current-D0Kn6Mf4-DDWYu-3j.mjs} +5 -5
  31. package/dist/{dev-current-Brb4qugP-CG0_96FZ.mjs.map → dev-current-D0Kn6Mf4-DDWYu-3j.mjs.map} +1 -1
  32. package/dist/{dev-environment-name-6eEr5PW8-CGk1ijP7.mjs → dev-environment-name-6eEr5PW8-BwusWVKi.mjs} +3 -3
  33. package/dist/{dev-environment-name-6eEr5PW8-CGk1ijP7.mjs.map → dev-environment-name-6eEr5PW8-BwusWVKi.mjs.map} +1 -1
  34. package/dist/{dist-DiYPSVUE.mjs → dist-BtzrklYG.mjs} +2 -2
  35. package/dist/{dist-DiYPSVUE.mjs.map → dist-BtzrklYG.mjs.map} +1 -1
  36. package/dist/{dist-CZ_yEZ7F.mjs → dist-C7SnNTD3.mjs} +11 -4
  37. package/dist/dist-C7SnNTD3.mjs.map +1 -0
  38. package/dist/errors-0e8IVwzi.mjs.map +1 -1
  39. package/dist/{execute-deploy-destroy-CNt-xpE7-CYaa3sYk.mjs → execute-deploy-destroy-Dh1CQ9X6-DY4c9egd.mjs} +60 -29
  40. package/dist/execute-deploy-destroy-Dh1CQ9X6-DY4c9egd.mjs.map +1 -0
  41. package/dist/{execute-dev-BUk-XWBJ-ZHX5A8cR.mjs → execute-dev-Bl-5Q-Av-DILne6iY.mjs} +99 -44
  42. package/dist/execute-dev-Bl-5Q-Av-DILne6iY.mjs.map +1 -0
  43. package/dist/{execute-dev-current-BdEqeKAB-BLUs2eQv.mjs → execute-dev-current-D3USgHJ4-CNQe5ADb.mjs} +6 -6
  44. package/dist/{execute-dev-current-BdEqeKAB-BLUs2eQv.mjs.map → execute-dev-current-D3USgHJ4-CNQe5ADb.mjs.map} +1 -1
  45. package/dist/{execute-log-aiHhujIh-C_aXmb6j.mjs → execute-log-Dm3DkQQP-BSjoy6Wd.mjs} +6 -6
  46. package/dist/{execute-log-aiHhujIh-C_aXmb6j.mjs.map → execute-log-Dm3DkQQP-BSjoy6Wd.mjs.map} +1 -1
  47. package/dist/{graph-MGOZJdDt-CyI8-9r7.mjs → graph-Bqr7PSGl-BM-M-TlO.mjs} +637 -199
  48. package/dist/graph-Bqr7PSGl-BM-M-TlO.mjs.map +1 -0
  49. package/dist/{graph-BzTSXnoQ-BvGVq0bm.d.mts → graph-DI1v3WKX-3g1lTRbh.d.mts} +8 -4
  50. package/dist/graph-DI1v3WKX-3g1lTRbh.d.mts.map +1 -0
  51. package/dist/{graph-types-DfsG9Rkg-D_ARjMo7.d.mts → graph-types-DRe9UUOp-C85Yr-sJ.d.mts} +253 -120
  52. package/dist/graph-types-DRe9UUOp-C85Yr-sJ.d.mts.map +1 -0
  53. package/dist/http.d.mts +2 -2
  54. package/dist/http.mjs +2 -2
  55. package/dist/{index-D89ftK2z.d.mts → index-DWQ6BSgm.d.mts} +3 -3
  56. package/dist/index-DWQ6BSgm.d.mts.map +1 -0
  57. package/dist/index.d.mts +5 -5
  58. package/dist/index.mjs +4 -4
  59. package/dist/internal-app-configuration-file.d.mts +19 -0
  60. package/dist/internal-app-configuration-file.d.mts.map +1 -0
  61. package/dist/internal-app-configuration-file.mjs +2 -0
  62. package/dist/{local-target-DySKw61w.mjs → local-target-Dd8FJEb5.mjs} +5 -3
  63. package/dist/{local-target-DySKw61w.mjs.map → local-target-Dd8FJEb5.mjs.map} +1 -1
  64. package/dist/local-target.d.mts +2 -2
  65. package/dist/local-target.d.mts.map +1 -1
  66. package/dist/local-target.mjs +1 -1
  67. package/dist/{nextjs-DLyeRR7M-BeiYsLuZ.d.mts → nextjs-DLyeRR7M-RtoHcY1c.d.mts} +3 -3
  68. package/dist/{nextjs-DLyeRR7M-BeiYsLuZ.d.mts.map → nextjs-DLyeRR7M-RtoHcY1c.d.mts.map} +1 -1
  69. package/dist/nextjs-control.d.mts +4 -4
  70. package/dist/nextjs-control.mjs +2 -2
  71. package/dist/nextjs.d.mts +1 -1
  72. package/dist/node-control.d.mts +3 -3
  73. package/dist/node-control.mjs +2 -2
  74. package/dist/node.d.mts +2 -2
  75. package/dist/pointer-CyQZZugO-D7k3vibs.d.mts +42 -0
  76. package/dist/pointer-CyQZZugO-D7k3vibs.d.mts.map +1 -0
  77. package/dist/redaction-Bf8FvTFH-BTsKD9B5.d.mts +183 -0
  78. package/dist/redaction-Bf8FvTFH-BTsKD9B5.d.mts.map +1 -0
  79. package/dist/redaction-HnbkSFrK-BXRZ3B33.mjs +295 -0
  80. package/dist/redaction-HnbkSFrK-BXRZ3B33.mjs.map +1 -0
  81. package/dist/report.d.mts +3 -3
  82. package/dist/report.mjs +1 -1
  83. package/dist/report.mjs.map +1 -1
  84. package/dist/{run-alchemy-Dl_MWw4g-BZaLckHp.mjs → run-alchemy-OS_ix5g0-DCvUYZ7T.mjs} +30 -12
  85. package/dist/run-alchemy-OS_ix5g0-DCvUYZ7T.mjs.map +1 -0
  86. package/dist/{run-report-CmBz2-xc-S50d4g5V.mjs → run-report-CmBz2-xc-Cc8rV1CX.mjs} +2 -2
  87. package/dist/{run-report-CmBz2-xc-S50d4g5V.mjs.map → run-report-CmBz2-xc-Cc8rV1CX.mjs.map} +1 -1
  88. package/dist/service-rpc.d.mts +2 -2
  89. package/dist/service-rpc.mjs +2 -2
  90. package/dist/testing.d.mts +2 -2
  91. package/dist/testing.d.mts.map +1 -1
  92. package/dist/{validate-environment-CEhUSEg2-DmAtiQhe.mjs → validate-environment-D_dECxgO-B-gqpVEf.mjs} +113 -13
  93. package/dist/validate-environment-D_dECxgO-B-gqpVEf.mjs.map +1 -0
  94. package/dist/zod.d.mts +30 -0
  95. package/dist/zod.d.mts.map +1 -0
  96. package/dist/zod.mjs +39 -0
  97. package/dist/zod.mjs.map +1 -0
  98. package/package.json +31 -18
  99. package/skills/prisma-composer-core-concepts/SKILL.md +49 -23
  100. package/src/exports/config.ts +1 -0
  101. package/src/exports/internal-app-configuration-file.ts +1 -0
  102. package/src/exports/zod.ts +1 -0
  103. package/dist/app-config-DNnd7Zu--BQ1vHaMK.d.mts.map +0 -1
  104. package/dist/config-RKyUvtGC.d.mts +0 -1
  105. package/dist/deploy-RKyUvtGC.d.mts +0 -1
  106. package/dist/deploy.mjs.map +0 -1
  107. package/dist/deployment-summary-CDHdLtnO-DrE7GsHq.mjs.map +0 -1
  108. package/dist/dist-CZ_yEZ7F.mjs.map +0 -1
  109. package/dist/execute-deploy-destroy-CNt-xpE7-CYaa3sYk.mjs.map +0 -1
  110. package/dist/execute-dev-BUk-XWBJ-ZHX5A8cR.mjs.map +0 -1
  111. package/dist/graph-BzTSXnoQ-BvGVq0bm.d.mts.map +0 -1
  112. package/dist/graph-MGOZJdDt-CyI8-9r7.mjs.map +0 -1
  113. package/dist/graph-types-DfsG9Rkg-D_ARjMo7.d.mts.map +0 -1
  114. package/dist/index-D89ftK2z.d.mts.map +0 -1
  115. package/dist/run-alchemy-Dl_MWw4g-BZaLckHp.mjs.map +0 -1
  116. package/dist/secret-CHOw4LBU-C8yXoC9N.d.mts +0 -25
  117. package/dist/secret-CHOw4LBU-C8yXoC9N.d.mts.map +0 -1
  118. package/dist/secret-DoWGmN7m-DO5Brq1Y.mjs.map +0 -1
  119. package/dist/validate-environment-CEhUSEg2-DmAtiQhe.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute-deploy-destroy-Dh1CQ9X6-DY4c9egd.mjs","names":["path","fs"],"sources":["../../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-Dh1CQ9X6.mjs"],"sourcesContent":["import { i as runPipeline, t as validateEnvironmentName } from \"./validate-environment-D_dECxgO.mjs\";\nimport { i as noComposerExportMessage } from \"./composer-config-DO_iG0iR.mjs\";\nimport { c as redactSummary, l as redactThrown, n as SecretRedaction, s as redactError } from \"./redaction-HnbkSFrK.mjs\";\nimport { a as readEngineFailureCause, i as readDeploymentSummary, r as engineFailureFilePath, t as DEPLOYMENT_RESULT_FILE_ENV } from \"./deployment-summary-BiBkPWlB.mjs\";\nimport { i as prepareSecondProcess, o as removeLeftoverAppConfigurationFiles, t as deployAppConfigurationFile } from \"./app-configuration-file-CeJvBAti.mjs\";\nimport { d as toStructured, u as requireContainerForEnvironment } from \"./dev-current-D0Kn6Mf4.mjs\";\nimport { a as writeRunReport, i as toRunReport, r as resolveRunReportPath, t as RUN_REPORT_FILE_ENV } from \"./run-report-CmBz2-xc.mjs\";\nimport { i as spawnAlchemy, n as alchemyInvocation, r as reproduceCommand } from \"./run-alchemy-OS_ix5g0.mjs\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { nodeAddresses, secretsKeys } from \"@internal/core/deploy\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { containerEnv, preflightEnv, preflightEnvVarName } from \"@internal/core/config\";\nimport { notOk, ok, okVoid } from \"@internal/foundation/result\";\nimport { randomUUID } from \"node:crypto\";\n//#region src/generate-stack.ts\n/** Pipeline step 6: writes a regenerated-every-run, independently runnable stack module at `.prisma-composer/alchemy.run.ts`. */\nconst GENERATED_DIR = \".prisma-composer\";\nconst GENERATED_FILE = \"alchemy.run.ts\";\n/** A relative import specifier from `.prisma-composer/alchemy.run.ts` to `target` (posix separators). */\nfunction relativeImportSpecifier(generatedDir, target) {\n\tconst rel = path.relative(generatedDir, target).split(path.sep).join(\"/\");\n\treturn rel.startsWith(\".\") ? rel : `./${rel}`;\n}\nfunction quote(value) {\n\treturn JSON.stringify(value);\n}\nfunction renderBundle(bundle) {\n\treturn `{ dir: ${quote(bundle.dir)}, entry: ${quote(bundle.entry)} }`;\n}\nfunction renderOptions(input) {\n\tconst lines = [];\n\tlines.push(` name: ${quote(input.name)},`);\n\tlines.push(` environment: ${quote(input.environment)},`);\n\tlines.push(\" appConfigurationRead: file.appConfigurationRead,\");\n\tlines.push(\" firstProcessNodeAddresses: file.nodeAddresses,\");\n\tlines.push(\" bundles: {\");\n\tfor (const [id, bundle] of Object.entries(input.assembled.bundles)) lines.push(` ${quote(id)}: ${renderBundle(bundle)},`);\n\tlines.push(\" },\");\n\tlines.push(\" report: report.deploymentReport,\");\n\treturn lines.join(\"\\n\");\n}\n/** Renders the stack module's source (tests assert on it without touching disk) — uses `//` headers, not a block comment, since a cwd path with a star-slash could close one early. */\nfunction renderStackFile(input) {\n\tconst generatedDir = path.join(input.cwd, GENERATED_DIR);\n\tconst appImport = relativeImportSpecifier(generatedDir, input.entryPath);\n\tconst configImport = relativeImportSpecifier(generatedDir, input.configFile);\n\treturn `// Generated by Composer's deploy and destroy operations — overwritten on every\n// run; do not edit by hand. Runnable from ${quote(input.cwd)} WITH the env the\n// CLI passes its child (the PRISMA_COMPOSER_CONTAINER_*/_PREFLIGHT_* vars and the app configuration file —\n// without them lower() refuses because no container is resolved), by the\n// command Composer starts, which a failed run prints:\n//\n// <node> <bin of the alchemy @prisma/composer depends on> deploy ${GENERATED_DIR}/${GENERATED_FILE} --yes --stage <stage>\n//\n// bisects a CLI bug from an Alchemy bug (deploy-cli.md § Implementation decisions).\n// It runs no config adapter: it reads what the first process's Load read from the app configuration file named in PRISMA_COMPOSER_APP_CONFIGURATION_FILE.\nimport { lower } from '@prisma/composer/deploy';\nimport * as report from '@prisma/composer/report';\nimport { readAppConfigurationFile } from '@prisma/composer/internal/app-configuration-file';\nimport prismaConfig from ${quote(configImport)};\nimport app from ${quote(appImport)};\n\nconst config = prismaConfig.composer;\nif (config === undefined) {\n throw new Error(${quote(noComposerExportMessage(input.configFile))});\n}\n\n// The app's own @prisma/composer may predate the failure recorder.\nreport.captureEngineFailure?.();\n\nconst file = readAppConfigurationFile(process.env);\n\nexport default lower(app, config, {\n${renderOptions(input)}\n});\n`;\n}\n/** Writes the stack file, returning its absolute path. */\nfunction writeStackFile(input) {\n\tconst generatedDir = path.join(input.cwd, GENERATED_DIR);\n\tfs.mkdirSync(generatedDir, { recursive: true });\n\tconst filePath = path.join(generatedDir, GENERATED_FILE);\n\tfs.writeFileSync(filePath, renderStackFile(input));\n\treturn filePath;\n}\nconst GENERATED_STACK_RELATIVE_PATH = path.join(GENERATED_DIR, GENERATED_FILE);\n//#endregion\n//#region src/operations/execute-deploy-destroy.ts\n/**\n* The deploy/destroy executor — main.ts's pipeline orchestration with argv,\n* console, and exit codes removed: typed inputs in, structured results out.\n* Reached only by lazy import from deploy.ts/destroy.ts — this module's\n* static graph transitively loads alchemy's provider tree, so the control\n* entry must never import it statically.\n*/\nconst ALCHEMY_STATE_DIR = \".alchemy\";\n/** Destroy guardrail (moved from main.ts): true when `<cwd>/.alchemy` is missing or empty — likely wrong directory or nothing deployed yet. */\nfunction hasNoLocalDeployState(cwd) {\n\tconst stateDir = path.join(cwd, ALCHEMY_STATE_DIR);\n\treturn !(fs.existsSync(stateDir) && fs.readdirSync(stateDir).length > 0);\n}\n/**\n* Times each deploy step for the host's `onEvent`. A step still open when the\n* run fails is closed as failed, innermost first. A host `onEvent` that throws\n* is the host's bug and cannot fail the deploy.\n*/\nfunction deploySteps(onEvent) {\n\tconst open = /* @__PURE__ */ new Map();\n\tconst keyOf = (step) => step.name === \"assemble-service\" ? `${step.name}:${step.address}` : step.name;\n\tconst emit = (event) => {\n\t\ttry {\n\t\t\tonEvent?.(event);\n\t\t} catch {}\n\t};\n\tconst finish = (step, outcome, data) => {\n\t\tconst entry = open.get(keyOf(step));\n\t\tif (entry === void 0) return;\n\t\topen.delete(keyOf(step));\n\t\tconst durationMs = Math.round(performance.now() - entry.startedAt);\n\t\temit({\n\t\t\tkind: \"step-finished\",\n\t\t\tstep,\n\t\t\toutcome,\n\t\t\tdurationMs,\n\t\t\tdata\n\t\t});\n\t};\n\treturn {\n\t\tstart(step) {\n\t\t\topen.set(keyOf(step), {\n\t\t\t\tstep,\n\t\t\t\tstartedAt: performance.now()\n\t\t\t});\n\t\t\temit({\n\t\t\t\tkind: \"step-started\",\n\t\t\t\tstep\n\t\t\t});\n\t\t},\n\t\tfinish(step, data) {\n\t\t\tfinish(step, \"ok\", data);\n\t\t},\n\t\tfail(step) {\n\t\t\tfinish(step, \"failed\");\n\t\t},\n\t\tfailOpen() {\n\t\t\tfor (const { step } of [...open.values()].reverse()) finish(step, \"failed\");\n\t\t}\n\t};\n}\nasync function executeDeploy(input, deps, cwd) {\n\tconst outcome = await runStackPipeline(\"deploy\", {\n\t\tentry: input.entry,\n\t\tconfig: input.config,\n\t\tname: input.name,\n\t\tenvironment: input.environment ?? \"production\",\n\t\tcwd,\n\t\tonEvent: void 0,\n\t\tdeps,\n\t\treportId: input.reportId,\n\t\treportPath: resolveRunReportPath(input.reportPath, process.env[RUN_REPORT_FILE_ENV], cwd),\n\t\tsteps: deploySteps(input.onEvent),\n\t\tredaction: new SecretRedaction(process.env)\n\t});\n\tif (!outcome.ok) return outcome;\n\treturn ok({ summary: outcome.value });\n}\nasync function executeDestroy(input, deps, cwd) {\n\tconst outcome = await runStackPipeline(\"destroy\", {\n\t\tentry: input.entry,\n\t\tconfig: input.config,\n\t\tname: input.name,\n\t\tenvironment: input.environment,\n\t\tcwd,\n\t\tonEvent: input.onEvent,\n\t\tdeps,\n\t\treportId: void 0,\n\t\treportPath: void 0,\n\t\tsteps: deploySteps(void 0),\n\t\tredaction: new SecretRedaction(process.env)\n\t});\n\tif (!outcome.ok) return outcome;\n\treturn okVoid();\n}\n/**\n* Opens a session per extension that declares a reporter. A `begin` that\n* throws costs that extension its reporting and nothing else — the deploy\n* has not started, and refusing to run it because an observer failed would\n* invert the relationship.\n*/\nasync function beginReporters(extensions, context, redaction) {\n\treturn (await Promise.all(extensions.map(async (extension) => {\n\t\tif (extension.reporter === void 0) return void 0;\n\t\ttry {\n\t\t\tconst reporter = await extension.reporter.begin(context);\n\t\t\treturn reporter === void 0 ? void 0 : {\n\t\t\t\textensionId: extension.id,\n\t\t\t\treporter\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\tconsole.warn(`\\nCould not start deploy reporting for ${extension.id}: ${redaction.redact(detail)}`);\n\t\t\treturn;\n\t\t}\n\t}))).filter((entry) => entry !== void 0);\n}\n/** Hands each session its own extension's resolved container, so it can attach the run to what that container names. */\nasync function attachReporters(reporters, containers, redaction) {\n\tawait Promise.all(reporters.map(async ({ extensionId, reporter }) => {\n\t\ttry {\n\t\t\tawait reporter.attach({ container: containers.get(extensionId) });\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\tconsole.warn(`\\nCould not attach this deploy to its project for ${extensionId}: ${redaction.redact(detail)}`);\n\t\t}\n\t}));\n}\n/** Every session's contribution to the alchemy child's environment, so reporting that happens inside the apply can find the run. */\nfunction reporterChildEnv(reporters, redaction) {\n\tconst env = {};\n\tfor (const { extensionId, reporter } of reporters) try {\n\t\tObject.assign(env, reporter.childEnv());\n\t} catch (error) {\n\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\tconsole.warn(`\\nCould not pass deploy reporting into the apply for ${extensionId}: ${redaction.redact(detail)}`);\n\t}\n\treturn env;\n}\n/** `failingStep` is capped at 500 by the platform and `errorMessage` at 5000; truncating here keeps a long message from costing the whole report. */\nfunction truncate(value, limit) {\n\treturn value.length <= limit ? value : `${value.slice(0, limit - 1)}…`;\n}\n/** An interrupted converge (the engine settled a Ctrl-C) — reported as `cancelled`, never as `failed`. */\nfunction wasInterrupted(failure) {\n\treturn typeof failure.meta?.[\"signal\"] === \"string\";\n}\n/**\n* Ends every reporting session, whatever the run did. Sessions never reject\n* by contract, but a buggy one must not turn a converged deploy into a\n* failure — so this swallows anyway, and reports each session independently\n* so one bad implementation cannot silence another.\n*/\nasync function finishReporters(reporters, outcome, redaction) {\n\tconst entities = outcome.summary?.nodes.flatMap((node) => node.entities) ?? [];\n\tawait Promise.all(reporters.map(async ({ reporter }) => {\n\t\ttry {\n\t\t\tawait reporter.finish({\n\t\t\t\tok: outcome.ok,\n\t\t\t\tcancelled: outcome.cancelled,\n\t\t\t\tfailingStep: outcome.code === void 0 ? void 0 : truncate(outcome.code, 500),\n\t\t\t\terrorMessage: outcome.message === void 0 ? void 0 : truncate(outcome.message, 5e3),\n\t\t\t\tentities\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\tconsole.warn(`\\nCould not report this deploy's outcome: ${redaction.redact(detail)}`);\n\t\t}\n\t}));\n}\n/**\n* Owns the reporting sessions around the pipeline: the inner run opens them\n* once it knows which extensions are configured, and this closes them on\n* every exit path — a returned failure, a success, or a thrown defect — as\n* the `record` step, which also writes the run report.\n* Nothing here can change what the pipeline returns.\n*/\nasync function runStackPipeline(action, opts) {\n\tconst reporters = [];\n\tlet outcome;\n\ttry {\n\t\toutcome = await runStackPipelineInner(action, opts, reporters);\n\t} catch (error) {\n\t\topts.steps.failOpen();\n\t\topts.steps.start({ name: \"record\" });\n\t\tconst thrown = redactThrown(error, opts.redaction);\n\t\tawait finishReporters(reporters, {\n\t\t\tok: false,\n\t\t\tcancelled: false,\n\t\t\tcode: \"DEPLOY.UNEXPECTED\",\n\t\t\tmessage: thrown.message\n\t\t}, opts.redaction);\n\t\topts.steps.finish({ name: \"record\" });\n\t\tthrow thrown;\n\t}\n\tif (!outcome.ok) outcome = notOk(redactError(outcome.failure, opts.redaction));\n\tif (!outcome.ok) opts.steps.failOpen();\n\topts.steps.start({ name: \"record\" });\n\tawait finishReporters(reporters, outcome.ok ? {\n\t\tok: true,\n\t\tcancelled: false,\n\t\tsummary: outcome.value\n\t} : {\n\t\tok: false,\n\t\tcancelled: wasInterrupted(outcome.failure),\n\t\tcode: outcome.failure.code,\n\t\tmessage: outcome.failure.message\n\t}, opts.redaction);\n\tif (opts.reportPath === void 0 || writeRunReport(opts.reportPath, toRunReport({\n\t\tsummary: outcome.ok ? outcome.value : void 0,\n\t\tenvironment: opts.environment,\n\t\tfailure: outcome.ok ? void 0 : {\n\t\t\tcode: outcome.failure.code,\n\t\t\tmessage: outcome.failure.message\n\t\t}\n\t}))) opts.steps.finish({ name: \"record\" });\n\telse opts.steps.fail({ name: \"record\" });\n\treturn outcome;\n}\n/** The pipeline both actions share: validate, resolve containers, preflight,\n* write the stack file, run alchemy against it, then the destroy-only\n* teardown/removal suffix. The value is only ever a summary for deploy. */\nasync function runStackPipelineInner(action, opts, reporters) {\n\tconst { entry, config: composerConfig, name, environment, cwd, onEvent, deps, steps } = opts;\n\tsteps.start({ name: \"prepare\" });\n\tremoveLeftoverAppConfigurationFiles(cwd);\n\ttry {\n\t\tvalidateEnvironmentName(environment);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tif (action === \"destroy\" && hasNoLocalDeployState(cwd)) onEvent?.({\n\t\tkind: \"no-local-deploy-state\",\n\t\tcwd\n\t});\n\tlet pipeline;\n\tlet containers;\n\tlet alchemyStage;\n\tconst preflightPayloads = /* @__PURE__ */ new Map();\n\tlet preflightTransportEnv = {};\n\ttry {\n\t\tpipeline = await runPipeline(entry, name, environment, cwd, composerConfig, {\n\t\t\trunAssembler: deps.runAssembler,\n\t\t\treadSecrets: action === \"deploy\",\n\t\t\tredaction: opts.redaction,\n\t\t\tonEvent: (event) => {\n\t\t\t\tswitch (event.kind) {\n\t\t\t\t\tcase \"loaded\":\n\t\t\t\t\t\tsteps.finish({ name: \"prepare\" });\n\t\t\t\t\t\tsteps.start({ name: \"assemble\" });\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase \"service-started\":\n\t\t\t\t\t\tsteps.start({\n\t\t\t\t\t\t\tname: \"assemble-service\",\n\t\t\t\t\t\t\taddress: event.address\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase \"service-assembled\":\n\t\t\t\t\t\tsteps.finish({\n\t\t\t\t\t\t\tname: \"assemble-service\",\n\t\t\t\t\t\t\taddress: event.address\n\t\t\t\t\t\t}, event.data);\n\t\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}, action === \"destroy\" ? (error) => new CliStructuredError(\"DEPLOY.BUILD_REQUIRED\", error.message, {\n\t\t\twhy: \"destroy evaluates the same stack program as deploy, which packages the built artifacts — so the app must be built first.\",\n\t\t\tfix: \"Run the build, then retry the destroy.\",\n\t\t\tcause: error\n\t\t}) : void 0);\n\t\tsteps.finish({ name: \"assemble\" });\n\t\tconst { graph, name: resolvedName } = pipeline;\n\t\tconst config = pipeline.configSource.value;\n\t\tsteps.start({ name: \"connect\" });\n\t\tif (action === \"deploy\") reporters.push(...await beginReporters(config.extensions, {\n\t\t\tappName: resolvedName,\n\t\t\tgraph,\n\t\t\tenvironment,\n\t\t\tcwd,\n\t\t\treportId: opts.reportId,\n\t\t\tcredentials: deps.credentials\n\t\t}, opts.redaction));\n\t\tcontainers = /* @__PURE__ */ new Map();\n\t\tfor (const extension of config.extensions) {\n\t\t\tif (extension.container === void 0) continue;\n\t\t\ttry {\n\t\t\t\tif (action === \"deploy\") {\n\t\t\t\t\tconst instance = await extension.container.ensure({\n\t\t\t\t\t\tappName: resolvedName,\n\t\t\t\t\t\tenvironment\n\t\t\t\t\t}, deps.credentials);\n\t\t\t\t\trequireContainerForEnvironment(action, extension.id, extension.container, instance, environment);\n\t\t\t\t\tcontainers.set(extension.id, instance);\n\t\t\t\t} else {\n\t\t\t\t\tconst instance = await extension.container.locate({\n\t\t\t\t\t\tappName: resolvedName,\n\t\t\t\t\t\tenvironment\n\t\t\t\t\t}, deps.credentials);\n\t\t\t\t\tif (instance === void 0) throw new CliStructuredError(\"DEPLOY.TARGET_NOT_FOUND\", `Nothing deployed for ${resolvedName} in the environment ${environment}.`, { fix: \"Deploy it first.\" });\n\t\t\t\t\trequireContainerForEnvironment(action, extension.id, extension.container, instance, environment);\n\t\t\t\t\tcontainers.set(extension.id, instance);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthrow toStructured(\"DEPLOY.CONTAINER_FAILED\", error);\n\t\t\t}\n\t\t}\n\t\tawait attachReporters(reporters, containers, opts.redaction);\n\t\talchemyStage = containers.get(config.state.extension)?.alchemyStage ?? environment;\n\t\tsteps.finish({ name: \"connect\" });\n\t\tif (action === \"deploy\") {\n\t\t\tsteps.start({ name: \"preflight\" });\n\t\t\tconst counts = {};\n\t\t\tconst report = (reported) => {\n\t\t\t\tfor (const [key, value] of Object.entries(reported)) counts[key] = (counts[key] ?? 0) + value;\n\t\t\t};\n\t\t\tfor (const extension of config.extensions) {\n\t\t\t\tif (extension.preflight === void 0) continue;\n\t\t\t\ttry {\n\t\t\t\t\tconst payload = await extension.preflight({\n\t\t\t\t\t\tgraph,\n\t\t\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\t\t\tenvironment,\n\t\t\t\t\t\tconfiguration: pipeline.configuration,\n\t\t\t\t\t\tsecrets: pipeline.secrets,\n\t\t\t\t\t\tcredentials: deps.credentials,\n\t\t\t\t\t\treport\n\t\t\t\t\t});\n\t\t\t\t\tif (payload !== void 0) preflightPayloads.set(extension.id, payload);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow toStructured(\"DEPLOY.PREFLIGHT_FAILED\", error);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tpreflightTransportEnv = preflightEnv(preflightPayloads);\n\t\t\t} catch (error) {\n\t\t\t\tthrow toStructured(\"DEPLOY.PREFLIGHT_FAILED\", error);\n\t\t\t}\n\t\t\tsteps.finish({ name: \"preflight\" }, counts);\n\t\t}\n\t\tfor (const extension of config.extensions) preflightTransportEnv[preflightEnvVarName(extension.id)] ??= \"\";\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tlet stackPath;\n\tconst resultFilePath = path.join(cwd, \".prisma-composer\", `deployment-result-${String(process.pid)}-${randomUUID()}.json`);\n\tlet handover;\n\ttry {\n\t\ttry {\n\t\t\thandover = prepareSecondProcess({\n\t\t\t\tfile: deployAppConfigurationFile(cwd, randomUUID()),\n\t\t\t\tappConfigurationRead: pipeline.graph.appConfigurationRead,\n\t\t\t\tnodeAddresses: nodeAddresses(pipeline.graph),\n\t\t\t\tsecretsKeys: secretsKeys(pipeline.graph),\n\t\t\t\tknownSecrets: opts.redaction.knownSecrets\n\t\t\t});\n\t\t\tstackPath = writeStackFile({\n\t\t\t\tentryPath: pipeline.entryModule.path,\n\t\t\t\tcwd,\n\t\t\t\tconfigFile: pipeline.configSource.file,\n\t\t\t\tname: pipeline.name,\n\t\t\t\tenvironment,\n\t\t\t\tassembled: pipeline.assembled\n\t\t\t});\n\t\t\thandover.writeFile();\n\t\t} catch (error) {\n\t\t\treturn notOk(toStructured(\"DEPLOY.STACK_WRITE_FAILED\", error));\n\t\t}\n\t\tconst invocation = alchemyInvocation({\n\t\t\tcommand: action,\n\t\t\tstackFileRelativePath: GENERATED_STACK_RELATIVE_PATH,\n\t\t\tcwd,\n\t\t\tstage: alchemyStage,\n\t\t\tcontainerEnv: containerEnv(containers),\n\t\t\tpreflightEnv: preflightTransportEnv,\n\t\t\tenv: {\n\t\t\t\t...reporterChildEnv(reporters, opts.redaction),\n\t\t\t\t...handover.env,\n\t\t\t\t[DEPLOYMENT_RESULT_FILE_ENV]: resultFilePath\n\t\t\t},\n\t\t\tredactedValues: opts.redaction.allValues()\n\t\t});\n\t\tsteps.start({ name: \"apply\" });\n\t\tlet outcome;\n\t\ttry {\n\t\t\toutcome = await (deps.alchemy ?? spawnAlchemy)(invocation);\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\treturn notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", error instanceof Error ? error.message : String(error), {\n\t\t\t\tcause: error,\n\t\t\t\tmeta: { diagnostics: {\n\t\t\t\t\texitCode: void 0,\n\t\t\t\t\tstackFilePath: stackPath,\n\t\t\t\t\treproduceCommand: reproduceCommand(invocation),\n\t\t\t\t\tcwd\n\t\t\t\t} }\n\t\t\t}));\n\t\t}\n\t\tconst reproduce = reproduceCommand(invocation, outcome);\n\t\tif (outcome.signal !== null) return notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", `alchemy ${action} was interrupted by ${outcome.signal}.`, { meta: {\n\t\t\tsignal: outcome.signal,\n\t\t\tdiagnostics: {\n\t\t\t\texitCode: void 0,\n\t\t\t\tsignal: outcome.signal,\n\t\t\t\tstackFilePath: stackPath,\n\t\t\t\treproduceCommand: reproduce,\n\t\t\t\tcwd\n\t\t\t}\n\t\t} }));\n\t\tconst status = outcome.exitCode ?? 1;\n\t\tif (status !== 0) {\n\t\t\tconst engineCause = readEngineFailureCause(resultFilePath, (text) => opts.redaction.redact(text));\n\t\t\tconst withCause = (sentence) => engineCause === void 0 ? sentence : `${sentence}\\n${engineCause}`;\n\t\t\treturn notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", withCause(`alchemy ${action} exited with status ${status}.`), { meta: {\n\t\t\t\texitCode: status,\n\t\t\t\t...engineCause !== void 0 ? { engineCause } : {},\n\t\t\t\tdiagnostics: {\n\t\t\t\t\texitCode: status,\n\t\t\t\t\tstackFilePath: stackPath,\n\t\t\t\t\treproduceCommand: reproduce,\n\t\t\t\t\tcwd\n\t\t\t\t}\n\t\t\t} }));\n\t\t}\n\t\tsteps.finish({ name: \"apply\" });\n\t\ttry {\n\t\t\tif (action === \"destroy\") {\n\t\t\t\tfor (const extension of pipeline.configSource.value.extensions) {\n\t\t\t\t\tif (extension.teardown === void 0) continue;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait extension.teardown({\n\t\t\t\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\t\t\t\tenvironment\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow toStructured(\"DEPLOY.TEARDOWN_FAILED\", error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (const extension of pipeline.configSource.value.extensions) {\n\t\t\t\t\tif (extension.container === void 0) continue;\n\t\t\t\t\tconst instance = containers.get(extension.id);\n\t\t\t\t\tif (instance === void 0) continue;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait extension.container.remove(instance, deps.credentials);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow toStructured(\"DEPLOY.CONTAINER_REMOVE_FAILED\", error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\tthrow error;\n\t\t}\n\t\tif (action === \"deploy\") return ok(redactSummary(readDeploymentSummary(resultFilePath), opts.redaction));\n\t\treturn ok(void 0);\n\t} finally {\n\t\ttry {\n\t\t\tfs.rmSync(resultFilePath, { force: true });\n\t\t\tfs.rmSync(engineFailureFilePath(resultFilePath), { force: true });\n\t\t} catch {}\n\t\thandover?.removeFile();\n\t}\n}\n//#endregion\nexport { executeDeploy, executeDestroy };\n\n//# sourceMappingURL=execute-deploy-destroy-Dh1CQ9X6.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAM,gBAAgB;AACtB,MAAM,iBAAiB;;AAEvB,SAAS,wBAAwB,cAAc,QAAQ;CACtD,MAAM,MAAMA,OAAK,SAAS,cAAc,MAAM,CAAC,CAAC,MAAMA,OAAK,GAAG,CAAC,CAAC,KAAK,GAAG;CACxE,OAAO,IAAI,WAAW,GAAG,IAAI,MAAM,KAAK;AACzC;AACA,SAAS,MAAM,OAAO;CACrB,OAAO,KAAK,UAAU,KAAK;AAC5B;AACA,SAAS,aAAa,QAAQ;CAC7B,OAAO,UAAU,MAAM,OAAO,GAAG,EAAE,WAAW,MAAM,OAAO,KAAK,EAAE;AACnE;AACA,SAAS,cAAc,OAAO;CAC7B,MAAM,QAAQ,CAAC;CACf,MAAM,KAAK,WAAW,MAAM,MAAM,IAAI,EAAE,EAAE;CAC1C,MAAM,KAAK,kBAAkB,MAAM,MAAM,WAAW,EAAE,EAAE;CACxD,MAAM,KAAK,oDAA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AU,SAAS;OACxB,WAAW,WAAW,IAAI,UAAU,EAAE;OACtC;MACD,CAAC;KACF,SAAS,OAAO;MACf,MAAM,aAAa,0BAA0B,KAAK;KACnD;IACD;IACA,KAAK,MAAM,aAAa,SAAS,aAAa,MAAM,YAAY;KAC/D,IAAI,UAAU,cAAc,KAAK,GAAG;KACpC,MAAM,WAAW,WAAW,IAAI,UAAU,EAAE;KAC5C,IAAI,aAAa,KAAK,GAAG;KACzB,IAAI;MACH,MAAM,UAAU,UAAU,OAAO,UAAU,KAAK,WAAW;KAC5D,SAAS,OAAO;MACf,MAAM,aAAa,kCAAkC,KAAK;KAC3D;IACD;GACD;EACD,SAAS,OAAO;GACf,IAAI,mBAAmB,GAAG,KAAK,GAAG,OAAO,MAAM,KAAK;GACpD,MAAM;EACP;EACA,IAAI,WAAW,UAAU,OAAO,GAAG,cAAc,sBAAsB,cAAc,GAAG,KAAK,SAAS,CAAC;EACvG,OAAO,GAAG,KAAK,CAAC;CACjB,UAAU;EACT,IAAI;GACH,KAAG,OAAO,gBAAgB,EAAE,OAAO,KAAK,CAAC;GACzC,KAAG,OAAO,sBAAsB,cAAc,GAAG,EAAE,OAAO,KAAK,CAAC;EACjE,QAAQ,CAAC;EACT,UAAU,WAAW;CACtB;AACD"}
@@ -1,16 +1,21 @@
1
+ import { b as secretsKeys, m as nodeAddresses } from "./graph-Bqr7PSGl-BM-M-TlO.mjs";
1
2
  import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
2
3
  import { t as containerEnv } from "./container-transport-HcvNOGZL-twPi2TIv.mjs";
3
4
  import { i as devEnvironmentDir } from "./app-config-CErnR6NK-D9NgSBH4.mjs";
4
5
  import { n as preflightEnvVarName, t as preflightEnv } from "./config-BFuriECI.mjs";
5
- import { c as toStructured, l as notOk, s as requireContainerForEnvironment, u as ok } from "./dev-current-Brb4qugP-CG0_96FZ.mjs";
6
- import { r as resolveLocalTargets } from "./local-target-DySKw61w.mjs";
7
- import { a as noComposerExportMessage, i as validateEnvironmentName, r as runPipeline } from "./validate-environment-CEhUSEg2-DmAtiQhe.mjs";
8
- import { n as reproduceCommand, r as spawnAlchemy, t as alchemyInvocation } from "./run-alchemy-Dl_MWw4g-BZaLckHp.mjs";
9
- import { n as requireDevEnvironmentName, t as claimDevEnvironmentName } from "./dev-environment-name-6eEr5PW8-CGk1ijP7.mjs";
6
+ import { i as prepareSecondProcess, n as devAppConfigurationFile, o as removeLeftoverAppConfigurationFiles } from "./app-configuration-file-CeJvBAti-D3uDlheX.mjs";
7
+ import { c as toStructured, l as notOk, s as requireContainerForEnvironment, u as ok } from "./dev-current-D0Kn6Mf4-DDWYu-3j.mjs";
8
+ import "./deploy-CmiYExQA.mjs";
9
+ import { r as resolveLocalTargets } from "./local-target-Dd8FJEb5.mjs";
10
+ import { a as redactDevEvent, c as redactThrown, o as redactError, t as SecretRedaction } from "./redaction-HnbkSFrK-BXRZ3B33.mjs";
11
+ import { a as noComposerExportMessage, i as validateEnvironmentName, r as runPipeline } from "./validate-environment-D_dECxgO-B-gqpVEf.mjs";
12
+ import { n as reproduceCommand, r as spawnAlchemy, t as alchemyInvocation } from "./run-alchemy-OS_ix5g0-DCvUYZ7T.mjs";
13
+ import { n as requireDevEnvironmentName, t as claimDevEnvironmentName } from "./dev-environment-name-6eEr5PW8-BwusWVKi.mjs";
10
14
  import { t as withEmulatorRetry } from "./emulator-retry-CV8rl69G-BgUzkxc-.mjs";
11
- import * as fs$1 from "node:fs";
12
15
  import * as path$1 from "node:path";
13
16
  import { join, relative, resolve, sep } from "node:path";
17
+ import * as fs$1 from "node:fs";
18
+ import { isDeepStrictEqual } from "node:util";
14
19
  import { fileURLToPath } from "node:url";
15
20
  import * as sysPath from "path";
16
21
  import { stat, unwatchFile, watch, watchFile } from "fs";
@@ -20,7 +25,7 @@ import { type } from "os";
20
25
  import { EventEmitter } from "events";
21
26
  import { createHash } from "node:crypto";
22
27
  import { lstat as lstat$1, open, readdir as readdir$1, realpath as realpath$1, stat as stat$2 } from "fs/promises";
23
- //#region ../../0-framework/3-tooling/cli/dist/generate-dev-stack-BkkU2HLE.mjs
28
+ //#region ../../0-framework/3-tooling/cli/dist/generate-dev-stack-Cag2Bd4s.mjs
24
29
  /**
25
30
  * Local-dev spec § 6 `generate-dev-stack.ts`: like generate-stack.ts but in
26
31
  * the environment's folder, `.prisma-composer/dev/<environment>/alchemy.run.ts`,
@@ -54,12 +59,14 @@ function renderOptions(input) {
54
59
  const lines = [];
55
60
  lines.push(` name: ${quote(input.name)},`);
56
61
  lines.push(` environment: ${quote(input.environment)},`);
62
+ lines.push(" appConfigurationRead: file.appConfigurationRead,");
63
+ lines.push(" firstProcessNodeAddresses: file.nodeAddresses,");
57
64
  lines.push(" bundles: {");
58
65
  for (const [id, bundle] of Object.entries(input.assembled.bundles)) lines.push(` ${quote(id)}: ${renderBundle(bundle)},`);
59
66
  lines.push(" },");
60
67
  const unassembled = Object.keys(input.assembled.devServers);
61
68
  if (unassembled.length > 0) lines.push(` unassembled: [${unassembled.map(quote).join(", ")}],`);
62
- lines.push(" providers: localTargetProviders(resolved, containers, devDir),");
69
+ lines.push(" providers: localTargetProviders(resolved, containers, devDir, file.appConfigurationRead.configurationKeyText, namedSecrets),");
63
70
  lines.push(" state: devState(),");
64
71
  return lines.join("\n");
65
72
  }
@@ -70,6 +77,7 @@ function renderDevStackFile(input) {
70
77
  const imports = [
71
78
  "import * as path from 'node:path';",
72
79
  "import { deserializeContainers } from '@prisma/composer/config';",
80
+ "import { namedSecretsFromEnvironment, readAppConfigurationFile } from '@prisma/composer/internal/app-configuration-file';",
73
81
  "import { lower } from '@prisma/composer/deploy';",
74
82
  "import { devEnvironmentDir, devState, localTargetProviders, resolveLocalTargets } from '@prisma/composer/local-target';",
75
83
  `import prismaConfig from ${quote(relativeImportSpecifier(generatedDir, input.configFile))};`,
@@ -82,6 +90,7 @@ function renderDevStackFile(input) {
82
90
  // <node> <bin of the alchemy @prisma/composer depends on> deploy ${devStackRelativePath(input.environment)} --yes --stage ${input.environment}
83
91
  //
84
92
  // bisects a CLI bug from an Alchemy bug (deploy-cli.md § Implementation decisions).
93
+ // It runs no config or secrets adapter: it reads what the first process's Load read from the app configuration file named in PRISMA_COMPOSER_APP_CONFIGURATION_FILE, and the named secrets from PRISMA_COMPOSER_NAMED_SECRETS.
85
94
  ${imports}
86
95
 
87
96
  const config = prismaConfig.composer;
@@ -92,6 +101,8 @@ if (config === undefined) {
92
101
  const containers = deserializeContainers(config.extensions, process.env);
93
102
  const resolved = await resolveLocalTargets(config);
94
103
  const devDir = path.join(process.cwd(), devEnvironmentDir(${quote(input.environment)}));
104
+ const file = readAppConfigurationFile(process.env);
105
+ const namedSecrets = namedSecretsFromEnvironment(process.env);
95
106
 
96
107
  export default lower(app, config, {
97
108
  ${renderOptions(input)}
@@ -1655,7 +1666,7 @@ var esm_default = {
1655
1666
  FSWatcher
1656
1667
  };
1657
1668
  //#endregion
1658
- //#region ../../0-framework/3-tooling/cli/dist/execute-dev-BUk-XWBJ.mjs
1669
+ //#region ../../0-framework/3-tooling/cli/dist/execute-dev-Bl-5Q-Av.mjs
1659
1670
  /**
1660
1671
  * Local-dev spec § 6 `watch.ts`: watches each assembled bundle's declared
1661
1672
  * `watch` paths and every authoring module (ADR-0056) — a directory watched
@@ -1853,11 +1864,24 @@ function contentHash(file) {
1853
1864
  return;
1854
1865
  }
1855
1866
  }
1867
+ function sameValues(started, now) {
1868
+ return isDeepStrictEqual(started.configuration, now.configuration) && isDeepStrictEqual(started.secrets, now.secrets);
1869
+ }
1856
1870
  async function executeDev(input, deps, cwd) {
1871
+ const redaction = new SecretRedaction(process.env);
1872
+ try {
1873
+ const result = await executeDevInner(input, deps, cwd, redaction);
1874
+ return result.ok ? result : notOk(redactError(result.failure, redaction));
1875
+ } catch (error) {
1876
+ throw redactThrown(error, redaction);
1877
+ }
1878
+ }
1879
+ async function executeDevInner(input, deps, cwd, redaction) {
1857
1880
  if (process.platform === "win32") return notOk(new CliStructuredError("DEV.PLATFORM_UNSUPPORTED", "local dev is not supported on Windows yet."));
1858
1881
  const { onEvent } = input;
1859
1882
  const environment = input.environment ?? "dev";
1860
1883
  const devDir = path$1.join(cwd, devEnvironmentDir(environment));
1884
+ removeLeftoverAppConfigurationFiles(cwd);
1861
1885
  let pipeline;
1862
1886
  let resolved;
1863
1887
  const containers = /* @__PURE__ */ new Map();
@@ -1865,14 +1889,16 @@ async function executeDev(input, deps, cwd) {
1865
1889
  const attachmentsById = /* @__PURE__ */ new Map();
1866
1890
  const emit = (event) => {
1867
1891
  try {
1868
- onEvent?.(event);
1892
+ onEvent?.(redactDevEvent(event, redaction));
1869
1893
  } catch {}
1870
1894
  };
1871
1895
  try {
1872
1896
  validateEnvironmentName(environment);
1873
1897
  const pipelineDeps = {
1874
1898
  runAssembler: deps.runAssembler,
1875
- devServers: true
1899
+ devServers: true,
1900
+ readSecrets: true,
1901
+ redaction
1876
1902
  };
1877
1903
  pipeline = await runPipeline(input.entry, input.name, environment, cwd, input.config, pipelineDeps);
1878
1904
  const { graph, name } = pipeline;
@@ -1910,7 +1936,13 @@ async function executeDev(input, deps, cwd) {
1910
1936
  const payload = await dev.preflight({
1911
1937
  graph,
1912
1938
  container: containers.get(id),
1913
- environment
1939
+ environment,
1940
+ configuration: pipeline.configuration,
1941
+ secrets: pipeline.secrets,
1942
+ warn: (message) => emit({
1943
+ kind: "target-warning",
1944
+ message
1945
+ })
1914
1946
  });
1915
1947
  if (payload !== void 0) preflightPayloads.set(id, payload);
1916
1948
  } catch (error) {
@@ -1955,26 +1987,43 @@ async function executeDev(input, deps, cwd) {
1955
1987
  if (CliStructuredError.is(error)) return notOk(error);
1956
1988
  throw error;
1957
1989
  }
1958
- const invocation = alchemyInvocation({
1959
- command: "deploy",
1960
- stackFileRelativePath: devStackRelativePath(environment),
1961
- cwd,
1962
- stage: environment,
1963
- containerEnv: containerEnv(containers),
1964
- preflightEnv: preflightTransportEnv
1965
- });
1966
- const converge = async () => {
1990
+ const invocationFor = (p) => {
1991
+ const handover = prepareSecondProcess({
1992
+ file: devAppConfigurationFile(devDir),
1993
+ appConfigurationRead: p.graph.appConfigurationRead,
1994
+ nodeAddresses: nodeAddresses(p.graph),
1995
+ secretsKeys: secretsKeys(p.graph),
1996
+ knownSecrets: redaction.knownSecrets,
1997
+ appSecrets: p.secrets
1998
+ });
1999
+ return {
2000
+ invocation: alchemyInvocation({
2001
+ command: "deploy",
2002
+ stackFileRelativePath: devStackRelativePath(environment),
2003
+ cwd,
2004
+ stage: environment,
2005
+ containerEnv: containerEnv(containers),
2006
+ preflightEnv: preflightTransportEnv,
2007
+ env: handover.env,
2008
+ redactedValues: redaction.allValues()
2009
+ }),
2010
+ handover
2011
+ };
2012
+ };
2013
+ const converge = async (p) => {
2014
+ const { invocation, handover } = invocationFor(p);
1967
2015
  let stackPath;
1968
2016
  try {
1969
2017
  claimDevEnvironmentName(devDir, environment);
1970
2018
  stackPath = writeDevStackFile({
1971
- entryPath: pipeline.entryModule.path,
2019
+ entryPath: p.entryModule.path,
1972
2020
  cwd,
1973
2021
  environment,
1974
- configFile: pipeline.configSource.file,
1975
- name: pipeline.name,
1976
- assembled: pipeline.assembled
2022
+ configFile: p.configSource.file,
2023
+ name: p.name,
2024
+ assembled: p.assembled
1977
2025
  });
2026
+ handover.writeFile();
1978
2027
  } catch (error) {
1979
2028
  throw toStructured("DEV.STACK_WRITE_FAILED", error);
1980
2029
  }
@@ -1992,10 +2041,13 @@ async function executeDev(input, deps, cwd) {
1992
2041
  cwd
1993
2042
  } }
1994
2043
  });
2044
+ } finally {
2045
+ handover.removeFile();
1995
2046
  }
1996
2047
  return {
1997
2048
  outcome,
1998
- stackPath
2049
+ stackPath,
2050
+ invocation
1999
2051
  };
2000
2052
  };
2001
2053
  const stopStartedServices = async () => {
@@ -2018,7 +2070,9 @@ async function executeDev(input, deps, cwd) {
2018
2070
  ({restarted} = await withEmulatorRetry(() => serve({
2019
2071
  address,
2020
2072
  node,
2021
- server
2073
+ server,
2074
+ configuration: pipeline.configuration,
2075
+ secrets: pipeline.secrets
2022
2076
  })));
2023
2077
  } catch (error) {
2024
2078
  throw toStructured("DEV.SERVICE_START_FAILED", error);
@@ -2028,7 +2082,7 @@ async function executeDev(input, deps, cwd) {
2028
2082
  };
2029
2083
  let first;
2030
2084
  try {
2031
- first = await converge();
2085
+ first = await converge(pipeline);
2032
2086
  } catch (error) {
2033
2087
  await stopStartedServices();
2034
2088
  if (CliStructuredError.is(error)) return notOk(error);
@@ -2043,7 +2097,7 @@ async function executeDev(input, deps, cwd) {
2043
2097
  exitCode: firstStatus ?? void 0,
2044
2098
  ...first.outcome.signal !== null ? { signal: first.outcome.signal } : {},
2045
2099
  stackFilePath: first.stackPath,
2046
- reproduceCommand: reproduceCommand(invocation, first.outcome),
2100
+ reproduceCommand: reproduceCommand(first.invocation, first.outcome),
2047
2101
  cwd
2048
2102
  }
2049
2103
  } }));
@@ -2105,7 +2159,9 @@ async function executeDev(input, deps, cwd) {
2105
2159
  });
2106
2160
  const watchDeps = {
2107
2161
  runAssembler: deps.runAssembler,
2108
- devServers: true
2162
+ devServers: true,
2163
+ readSecrets: true,
2164
+ redaction
2109
2165
  };
2110
2166
  const watchFiles = deps.watch ?? startWatch;
2111
2167
  const onWatchError = (error) => emit({
@@ -2115,7 +2171,9 @@ async function executeDev(input, deps, cwd) {
2115
2171
  const configFile = pipeline.configSource.file;
2116
2172
  const startedConfig = contentHash(configFile);
2117
2173
  let configChanged = false;
2118
- const pausedForConfig = () => {
2174
+ let valuesChanged = false;
2175
+ const paused = () => {
2176
+ if (valuesChanged) return true;
2119
2177
  if (!configChanged && contentHash(configFile) === startedConfig) return false;
2120
2178
  configChanged = true;
2121
2179
  emit({
@@ -2127,19 +2185,16 @@ async function executeDev(input, deps, cwd) {
2127
2185
  configWatch = watchFiles([{
2128
2186
  address: configFile,
2129
2187
  paths: [configFile]
2130
- }], () => void pausedForConfig(), onWatchError);
2188
+ }], () => void paused(), onWatchError);
2131
2189
  const rebuild = async () => {
2132
2190
  try {
2133
2191
  const rePipeline = await runPipeline(input.entry, input.name, environment, cwd, input.config, watchDeps);
2134
- const stackPath = writeDevStackFile({
2135
- entryPath: rePipeline.entryModule.path,
2136
- cwd,
2137
- environment,
2138
- configFile: rePipeline.configSource.file,
2139
- name: rePipeline.name,
2140
- assembled: rePipeline.assembled
2141
- });
2142
- const outcome = await (deps.alchemy ?? spawnAlchemy)(invocation);
2192
+ if (!sameValues(pipeline, rePipeline)) {
2193
+ if (!valuesChanged) emit({ kind: "values-changed" });
2194
+ valuesChanged = true;
2195
+ return;
2196
+ }
2197
+ const { outcome, stackPath, invocation } = await converge(rePipeline);
2143
2198
  if (outcome.signal !== null || outcome.exitCode !== 0) {
2144
2199
  emit({
2145
2200
  kind: "converge-failed",
@@ -2172,11 +2227,11 @@ async function executeDev(input, deps, cwd) {
2172
2227
  do {
2173
2228
  changedDuringRebuild = false;
2174
2229
  await rebuild();
2175
- } while (changedDuringRebuild && !pausedForConfig());
2230
+ } while (changedDuringRebuild && !paused());
2176
2231
  rebuilding = false;
2177
2232
  };
2178
2233
  watch = watchFiles(targets, () => {
2179
- if (pausedForConfig()) return;
2234
+ if (paused()) return;
2180
2235
  if (rebuilding) {
2181
2236
  changedDuringRebuild = true;
2182
2237
  return;
@@ -2230,4 +2285,4 @@ async function executeDev(input, deps, cwd) {
2230
2285
  //#endregion
2231
2286
  export { executeDev };
2232
2287
 
2233
- //# sourceMappingURL=execute-dev-BUk-XWBJ-ZHX5A8cR.mjs.map
2288
+ //# sourceMappingURL=execute-dev-Bl-5Q-Av-DILne6iY.mjs.map