@prisma/composer 0.36.0 → 0.37.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-config-DNnd7Zu--BQ1vHaMK.d.mts → app-config-lMqqcFA1-DacpRpC4.d.mts} +48 -8
- package/dist/app-config-lMqqcFA1-DacpRpC4.d.mts.map +1 -0
- package/dist/app-configuration-file-CeJvBAti-D3uDlheX.mjs +221 -0
- package/dist/app-configuration-file-CeJvBAti-D3uDlheX.mjs.map +1 -0
- package/dist/arktype.d.mts +20 -6
- package/dist/arktype.d.mts.map +1 -1
- package/dist/arktype.mjs +45 -6
- package/dist/arktype.mjs.map +1 -1
- package/dist/config-Bpbj7Riz.d.mts +1 -0
- package/dist/config-adapters-DG-uhGfv-Bt1M9f8b.mjs +47 -0
- package/dist/config-adapters-DG-uhGfv-Bt1M9f8b.mjs.map +1 -0
- package/dist/config.d.mts +16 -3
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +2 -1
- package/dist/control.d.mts +6 -174
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +4 -4
- package/dist/control.mjs.map +1 -1
- package/dist/deploy-DergV8De.mjs +375 -0
- package/dist/deploy-DergV8De.mjs.map +1 -0
- package/dist/deploy-Dh_I6YLS.d.mts +2 -0
- package/dist/deploy.d.mts +4 -3
- package/dist/deploy.mjs +3 -364
- package/dist/{deployment-summary-CDHdLtnO-DrE7GsHq.mjs → deployment-summary-BiBkPWlB-CyC2pudN.mjs} +10 -23
- package/dist/deployment-summary-BiBkPWlB-CyC2pudN.mjs.map +1 -0
- package/dist/{deployment-summary-p88NV5m5-SaPCCX2C.d.mts → deployment-summary-p88NV5m5-Bqd0Uf4H.d.mts} +3 -3
- package/dist/{deployment-summary-p88NV5m5-SaPCCX2C.d.mts.map → deployment-summary-p88NV5m5-Bqd0Uf4H.d.mts.map} +1 -1
- package/dist/{secret-DoWGmN7m-DO5Brq1Y.mjs → describe-kind-Cpm_euxo-CkhlGJUL.mjs} +29 -2
- package/dist/describe-kind-Cpm_euxo-CkhlGJUL.mjs.map +1 -0
- package/dist/{dev-current-Brb4qugP-CG0_96FZ.mjs → dev-current-D-Qb6Yem-Cvy2dWhe.mjs} +5 -5
- package/dist/{dev-current-Brb4qugP-CG0_96FZ.mjs.map → dev-current-D-Qb6Yem-Cvy2dWhe.mjs.map} +1 -1
- package/dist/{dev-environment-name-6eEr5PW8-CGk1ijP7.mjs → dev-environment-name-6eEr5PW8-BwusWVKi.mjs} +3 -3
- package/dist/{dev-environment-name-6eEr5PW8-CGk1ijP7.mjs.map → dev-environment-name-6eEr5PW8-BwusWVKi.mjs.map} +1 -1
- package/dist/{dist-DiYPSVUE.mjs → dist-BtzrklYG.mjs} +2 -2
- package/dist/{dist-DiYPSVUE.mjs.map → dist-BtzrklYG.mjs.map} +1 -1
- package/dist/{dist-CZ_yEZ7F.mjs → dist-NyTyCEnG.mjs} +11 -4
- package/dist/dist-NyTyCEnG.mjs.map +1 -0
- package/dist/errors-0e8IVwzi.mjs.map +1 -1
- package/dist/{execute-deploy-destroy-CNt-xpE7-CYaa3sYk.mjs → execute-deploy-destroy-C6EsdmLz-BO5xEJsJ.mjs} +60 -29
- package/dist/execute-deploy-destroy-C6EsdmLz-BO5xEJsJ.mjs.map +1 -0
- package/dist/{execute-dev-current-BdEqeKAB-BLUs2eQv.mjs → execute-dev-current-tBKmDAjV-0LnPjGGi.mjs} +6 -6
- package/dist/{execute-dev-current-BdEqeKAB-BLUs2eQv.mjs.map → execute-dev-current-tBKmDAjV-0LnPjGGi.mjs.map} +1 -1
- package/dist/{execute-dev-BUk-XWBJ-ZHX5A8cR.mjs → execute-dev-gjIKYybU-BMpgGLtS.mjs} +99 -44
- package/dist/execute-dev-gjIKYybU-BMpgGLtS.mjs.map +1 -0
- package/dist/{execute-log-aiHhujIh-C_aXmb6j.mjs → execute-log-c0_dL_Bv-Dq1glmTO.mjs} +6 -6
- package/dist/{execute-log-aiHhujIh-C_aXmb6j.mjs.map → execute-log-c0_dL_Bv-Dq1glmTO.mjs.map} +1 -1
- package/dist/{graph-MGOZJdDt-CyI8-9r7.mjs → graph-CBt9CRBT-yMupsISb.mjs} +681 -214
- package/dist/graph-CBt9CRBT-yMupsISb.mjs.map +1 -0
- package/dist/{graph-BzTSXnoQ-BvGVq0bm.d.mts → graph-D1zpgcLm-YlrEdzUB.d.mts} +9 -5
- package/dist/graph-D1zpgcLm-YlrEdzUB.d.mts.map +1 -0
- package/dist/{graph-types-DfsG9Rkg-D_ARjMo7.d.mts → graph-types-BiFZrE06-D6vaGxXz.d.mts} +287 -122
- package/dist/graph-types-BiFZrE06-D6vaGxXz.d.mts.map +1 -0
- package/dist/http.d.mts +2 -2
- package/dist/http.mjs +2 -2
- package/dist/{index-D89ftK2z.d.mts → index-CMklpG87.d.mts} +3 -3
- package/dist/index-CMklpG87.d.mts.map +1 -0
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +4 -4
- package/dist/internal-app-configuration-file.d.mts +19 -0
- package/dist/internal-app-configuration-file.d.mts.map +1 -0
- package/dist/internal-app-configuration-file.mjs +2 -0
- package/dist/{local-target-DySKw61w.mjs → local-target-Dd8FJEb5.mjs} +5 -3
- package/dist/{local-target-DySKw61w.mjs.map → local-target-Dd8FJEb5.mjs.map} +1 -1
- package/dist/local-target.d.mts +2 -2
- package/dist/local-target.d.mts.map +1 -1
- package/dist/local-target.mjs +1 -1
- package/dist/{nextjs-DLyeRR7M-BeiYsLuZ.d.mts → nextjs-DLyeRR7M-RqgYxqhI.d.mts} +3 -3
- package/dist/{nextjs-DLyeRR7M-BeiYsLuZ.d.mts.map → nextjs-DLyeRR7M-RqgYxqhI.d.mts.map} +1 -1
- package/dist/nextjs-control.d.mts +4 -4
- package/dist/nextjs-control.mjs +2 -2
- package/dist/nextjs.d.mts +1 -1
- package/dist/node-control.d.mts +3 -3
- package/dist/node-control.mjs +2 -2
- package/dist/node.d.mts +2 -2
- package/dist/pointer-CyQZZugO-D7k3vibs.d.mts +42 -0
- package/dist/pointer-CyQZZugO-D7k3vibs.d.mts.map +1 -0
- package/dist/redaction-Bf8FvTFH-pjMN5nIB.d.mts +183 -0
- package/dist/redaction-Bf8FvTFH-pjMN5nIB.d.mts.map +1 -0
- package/dist/redaction-HnbkSFrK-BXRZ3B33.mjs +295 -0
- package/dist/redaction-HnbkSFrK-BXRZ3B33.mjs.map +1 -0
- package/dist/report.d.mts +3 -3
- package/dist/report.mjs +1 -1
- package/dist/report.mjs.map +1 -1
- package/dist/{run-alchemy-Dl_MWw4g-BZaLckHp.mjs → run-alchemy-OS_ix5g0-DCvUYZ7T.mjs} +30 -12
- package/dist/run-alchemy-OS_ix5g0-DCvUYZ7T.mjs.map +1 -0
- package/dist/{run-report-CmBz2-xc-S50d4g5V.mjs → run-report-CmBz2-xc-Cc8rV1CX.mjs} +2 -2
- package/dist/{run-report-CmBz2-xc-S50d4g5V.mjs.map → run-report-CmBz2-xc-Cc8rV1CX.mjs.map} +1 -1
- package/dist/service-rpc.d.mts +2 -2
- package/dist/service-rpc.mjs +2 -2
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.mts.map +1 -1
- package/dist/{validate-environment-CEhUSEg2-DmAtiQhe.mjs → validate-environment-CpQLC3CA-COmDdusV.mjs} +124 -21
- package/dist/validate-environment-CpQLC3CA-COmDdusV.mjs.map +1 -0
- package/dist/zod.d.mts +30 -0
- package/dist/zod.d.mts.map +1 -0
- package/dist/zod.mjs +39 -0
- package/dist/zod.mjs.map +1 -0
- package/package.json +31 -18
- package/skills/prisma-composer-core-concepts/SKILL.md +54 -29
- package/src/exports/config.ts +1 -0
- package/src/exports/internal-app-configuration-file.ts +1 -0
- package/src/exports/zod.ts +1 -0
- package/dist/app-config-DNnd7Zu--BQ1vHaMK.d.mts.map +0 -1
- package/dist/config-RKyUvtGC.d.mts +0 -1
- package/dist/deploy-RKyUvtGC.d.mts +0 -1
- package/dist/deploy.mjs.map +0 -1
- package/dist/deployment-summary-CDHdLtnO-DrE7GsHq.mjs.map +0 -1
- package/dist/dist-CZ_yEZ7F.mjs.map +0 -1
- package/dist/execute-deploy-destroy-CNt-xpE7-CYaa3sYk.mjs.map +0 -1
- package/dist/execute-dev-BUk-XWBJ-ZHX5A8cR.mjs.map +0 -1
- package/dist/graph-BzTSXnoQ-BvGVq0bm.d.mts.map +0 -1
- package/dist/graph-MGOZJdDt-CyI8-9r7.mjs.map +0 -1
- package/dist/graph-types-DfsG9Rkg-D_ARjMo7.d.mts.map +0 -1
- package/dist/index-D89ftK2z.d.mts.map +0 -1
- package/dist/run-alchemy-Dl_MWw4g-BZaLckHp.mjs.map +0 -1
- package/dist/secret-CHOw4LBU-C8yXoC9N.d.mts +0 -25
- package/dist/secret-CHOw4LBU-C8yXoC9N.d.mts.map +0 -1
- package/dist/secret-DoWGmN7m-DO5Brq1Y.mjs.map +0 -1
- package/dist/validate-environment-CEhUSEg2-DmAtiQhe.mjs.map +0 -1
|
@@ -88,7 +88,7 @@ function okVoid() {
|
|
|
88
88
|
return OK_VOID;
|
|
89
89
|
}
|
|
90
90
|
//#endregion
|
|
91
|
-
//#region ../../0-framework/3-tooling/cli/dist/dev-current-
|
|
91
|
+
//#region ../../0-framework/3-tooling/cli/dist/dev-current-D-Qb6Yem.mjs
|
|
92
92
|
/**
|
|
93
93
|
* Reads the execution diagnostics an engine-failure error carries in
|
|
94
94
|
* `meta.diagnostics`; undefined for every other failure.
|
|
@@ -161,7 +161,7 @@ async function deployWithDeps(input, deps) {
|
|
|
161
161
|
const cwd = input.cwd ?? process.cwd();
|
|
162
162
|
let executor;
|
|
163
163
|
try {
|
|
164
|
-
executor = await import("./execute-deploy-destroy-
|
|
164
|
+
executor = await import("./execute-deploy-destroy-C6EsdmLz-BO5xEJsJ.mjs");
|
|
165
165
|
} catch (error) {
|
|
166
166
|
return notOk(executorLoadFailure("deploy", error));
|
|
167
167
|
}
|
|
@@ -182,7 +182,7 @@ async function devWithDeps(input, deps) {
|
|
|
182
182
|
const cwd = input.cwd ?? process.cwd();
|
|
183
183
|
let executor;
|
|
184
184
|
try {
|
|
185
|
-
executor = await import("./execute-dev-
|
|
185
|
+
executor = await import("./execute-dev-gjIKYybU-BMpgGLtS.mjs");
|
|
186
186
|
} catch (error) {
|
|
187
187
|
return notOk(executorLoadFailure("dev", error));
|
|
188
188
|
}
|
|
@@ -190,7 +190,7 @@ async function devWithDeps(input, deps) {
|
|
|
190
190
|
}
|
|
191
191
|
async function loadExecutor(operation) {
|
|
192
192
|
try {
|
|
193
|
-
return ok(await import("./execute-dev-current-
|
|
193
|
+
return ok(await import("./execute-dev-current-tBKmDAjV-0LnPjGGi.mjs"));
|
|
194
194
|
} catch (error) {
|
|
195
195
|
return notOk(executorLoadFailure(operation, error));
|
|
196
196
|
}
|
|
@@ -210,4 +210,4 @@ async function devStop(input) {
|
|
|
210
210
|
//#endregion
|
|
211
211
|
export { executionDiagnostics as a, toStructured as c, okVoid as d, devUrl as i, notOk as l, dev as n, executorLoadFailure as o, devStop as r, requireContainerForEnvironment as s, deploy as t, ok as u };
|
|
212
212
|
|
|
213
|
-
//# sourceMappingURL=dev-current-
|
|
213
|
+
//# sourceMappingURL=dev-current-D-Qb6Yem-Cvy2dWhe.mjs.map
|
package/dist/{dev-current-Brb4qugP-CG0_96FZ.mjs.map → dev-current-D-Qb6Yem-Cvy2dWhe.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-current-Brb4qugP-CG0_96FZ.mjs","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/result.mjs","../../../0-framework/3-tooling/cli/dist/dev-current-Brb4qugP.mjs"],"sourcesContent":["import { t as blindCast } from \"./casts-DpaahrlC.mjs\";\nimport { t as InternalError } from \"./internal-error-Dfur7Zqt.mjs\";\n//#region src/result.ts\n/**\n* Generic Result type for representing success or failure outcomes.\n*\n* This is the standard way to return \"expected failures\" as values rather than\n* throwing exceptions. See docs/Error Handling.md for the full taxonomy.\n*\n* Naming rationale:\n* - `Ok<T>` / `NotOk<F>` mirror the `ok: true/false` discriminator\n* - `NotOk` avoids collision with domain types like \"Failure\" or \"Error\"\n* - `failure` property distinguishes from JS Error semantics\n*/\n/**\n* Result class that implements both Ok and NotOk variants.\n*/\nvar ResultImpl = class ResultImpl {\n\tok;\n\t_value;\n\t_failure;\n\tconstructor(ok, valueOrFailure) {\n\t\tthis.ok = ok;\n\t\tif (ok) this._value = blindCast(valueOrFailure);\n\t\telse this._failure = blindCast(valueOrFailure);\n\t\tObject.freeze(this);\n\t}\n\tget value() {\n\t\tif (!this.ok) throw new InternalError(\"Cannot access value on NotOk result\");\n\t\treturn this._value;\n\t}\n\tget failure() {\n\t\tif (this.ok) throw new InternalError(\"Cannot access failure on Ok result\");\n\t\treturn this._failure;\n\t}\n\t/**\n\t* Creates a successful result.\n\t*/\n\tstatic ok(value) {\n\t\treturn blindCast(new ResultImpl(true, value));\n\t}\n\t/**\n\t* Creates an unsuccessful result.\n\t*/\n\tstatic notOk(failure) {\n\t\treturn blindCast(new ResultImpl(false, failure));\n\t}\n\t/**\n\t* Asserts that this result is Ok and returns the value.\n\t* Throws if the result is NotOk.\n\t*/\n\tassertOk() {\n\t\tif (!this.ok) throw new InternalError(\"Expected Ok result but got NotOk\");\n\t\treturn this.value;\n\t}\n\t/**\n\t* Asserts that this result is NotOk and returns the failure.\n\t* Throws if the result is Ok.\n\t*/\n\tassertNotOk() {\n\t\tif (this.ok) throw new InternalError(\"Expected NotOk result but got Ok\");\n\t\treturn this.failure;\n\t}\n};\n/**\n* Creates a successful result.\n*/\nfunction ok(value) {\n\treturn ResultImpl.ok(value);\n}\n/**\n* Creates an unsuccessful result.\n*/\nfunction notOk(failure) {\n\treturn ResultImpl.notOk(failure);\n}\n/**\n* Singleton for void success results.\n* Use this for validation checks that don't produce a value.\n*/\nconst OK_VOID = ResultImpl.ok(void 0);\n/**\n* Returns a successful void result.\n* Use this for validation checks that don't produce a value.\n*/\nfunction okVoid() {\n\treturn OK_VOID;\n}\n//#endregion\nexport { notOk, ok, okVoid };\n\n//# sourceMappingURL=result.mjs.map","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-CNt-xpE7.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-BUk-XWBJ.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-BdEqeKAB.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-Brb4qugP.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,IAAI,aAAa,MAAM,WAAW;CACjC;CACA;CACA;CACA,YAAY,IAAI,gBAAgB;EAC/B,KAAK,KAAK;EACV,IAAI,IAAI,KAAK,SAAS,UAAU,cAAc;OACzC,KAAK,WAAW,UAAU,cAAc;EAC7C,OAAO,OAAO,IAAI;CACnB;CACA,IAAI,QAAQ;EACX,IAAI,CAAC,KAAK,IAAI,MAAM,IAAI,cAAc,qCAAqC;EAC3E,OAAO,KAAK;CACb;CACA,IAAI,UAAU;EACb,IAAI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;;;;AAIA,eAAe,YAAY,OAAO,MAAM;CACvC,MAAM,MAAM,MAAM,OAAO,QAAQ,IAAI;CACrC,IAAI;CACJ,IAAI;EACH,WAAW,MAAM,OAAO;CACzB,SAAS,OAAO;EACf,OAAO,MAAM,oBAAoB,OAAO,KAAK,CAAC;CAC/C;CACA,OAAO,SAAS,WAAW,OAAO,MAAM,GAAG;AAC5C;AAGA,eAAe,aAAa,WAAW;CACtC,IAAI;EACH,OAAO,GAAG,MAAM,OAAO,8CAAqC;CAC7D,SAAS,OAAO;EACf,OAAO,MAAM,oBAAoB,WAAW,KAAK,CAAC;CACnD;AACD;;AAEA,eAAe,OAAO,OAAO;CAC5B,MAAM,WAAW,MAAM,aAAa,SAAS;CAC7C,IAAI,CAAC,SAAS,IAAI,OAAO;CACzB,OAAO,SAAS,MAAM,cAAc,OAAO,MAAM,OAAO,QAAQ,IAAI,CAAC;AACtE;;AAEA,eAAe,QAAQ,OAAO;CAC7B,MAAM,WAAW,MAAM,aAAa,UAAU;CAC9C,IAAI,CAAC,SAAS,IAAI,OAAO;CACzB,OAAO,SAAS,MAAM,eAAe,OAAO,MAAM,OAAO,QAAQ,IAAI,CAAC;AACvE"}
|
|
1
|
+
{"version":3,"file":"dev-current-D-Qb6Yem-Cvy2dWhe.mjs","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/result.mjs","../../../0-framework/3-tooling/cli/dist/dev-current-D-Qb6Yem.mjs"],"sourcesContent":["import { t as blindCast } from \"./casts-DpaahrlC.mjs\";\nimport { t as InternalError } from \"./internal-error-Dfur7Zqt.mjs\";\n//#region src/result.ts\n/**\n* Generic Result type for representing success or failure outcomes.\n*\n* This is the standard way to return \"expected failures\" as values rather than\n* throwing exceptions. See docs/Error Handling.md for the full taxonomy.\n*\n* Naming rationale:\n* - `Ok<T>` / `NotOk<F>` mirror the `ok: true/false` discriminator\n* - `NotOk` avoids collision with domain types like \"Failure\" or \"Error\"\n* - `failure` property distinguishes from JS Error semantics\n*/\n/**\n* Result class that implements both Ok and NotOk variants.\n*/\nvar ResultImpl = class ResultImpl {\n\tok;\n\t_value;\n\t_failure;\n\tconstructor(ok, valueOrFailure) {\n\t\tthis.ok = ok;\n\t\tif (ok) this._value = blindCast(valueOrFailure);\n\t\telse this._failure = blindCast(valueOrFailure);\n\t\tObject.freeze(this);\n\t}\n\tget value() {\n\t\tif (!this.ok) throw new InternalError(\"Cannot access value on NotOk result\");\n\t\treturn this._value;\n\t}\n\tget failure() {\n\t\tif (this.ok) throw new InternalError(\"Cannot access failure on Ok result\");\n\t\treturn this._failure;\n\t}\n\t/**\n\t* Creates a successful result.\n\t*/\n\tstatic ok(value) {\n\t\treturn blindCast(new ResultImpl(true, value));\n\t}\n\t/**\n\t* Creates an unsuccessful result.\n\t*/\n\tstatic notOk(failure) {\n\t\treturn blindCast(new ResultImpl(false, failure));\n\t}\n\t/**\n\t* Asserts that this result is Ok and returns the value.\n\t* Throws if the result is NotOk.\n\t*/\n\tassertOk() {\n\t\tif (!this.ok) throw new InternalError(\"Expected Ok result but got NotOk\");\n\t\treturn this.value;\n\t}\n\t/**\n\t* Asserts that this result is NotOk and returns the failure.\n\t* Throws if the result is Ok.\n\t*/\n\tassertNotOk() {\n\t\tif (this.ok) throw new InternalError(\"Expected NotOk result but got Ok\");\n\t\treturn this.failure;\n\t}\n};\n/**\n* Creates a successful result.\n*/\nfunction ok(value) {\n\treturn ResultImpl.ok(value);\n}\n/**\n* Creates an unsuccessful result.\n*/\nfunction notOk(failure) {\n\treturn ResultImpl.notOk(failure);\n}\n/**\n* Singleton for void success results.\n* Use this for validation checks that don't produce a value.\n*/\nconst OK_VOID = ResultImpl.ok(void 0);\n/**\n* Returns a successful void result.\n* Use this for validation checks that don't produce a value.\n*/\nfunction okVoid() {\n\treturn OK_VOID;\n}\n//#endregion\nexport { notOk, ok, okVoid };\n\n//# sourceMappingURL=result.mjs.map","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-C6EsdmLz.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-gjIKYybU.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-tBKmDAjV.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-D-Qb6Yem.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,IAAI,aAAa,MAAM,WAAW;CACjC;CACA;CACA;CACA,YAAY,IAAI,gBAAgB;EAC/B,KAAK,KAAK;EACV,IAAI,IAAI,KAAK,SAAS,UAAU,cAAc;OACzC,KAAK,WAAW,UAAU,cAAc;EAC7C,OAAO,OAAO,IAAI;CACnB;CACA,IAAI,QAAQ;EACX,IAAI,CAAC,KAAK,IAAI,MAAM,IAAI,cAAc,qCAAqC;EAC3E,OAAO,KAAK;CACb;CACA,IAAI,UAAU;EACb,IAAI,KAAK,IAAI,MAAM,IAAI,cAAc,oCAAoC;EACzE,OAAO,KAAK;CACb;;;;CAIA,OAAO,GAAG,OAAO;EAChB,OAAO,UAAU,IAAI,WAAW,MAAM,KAAK,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AAS,OAAO;EACf,OAAO,MAAM,oBAAoB,OAAO,KAAK,CAAC;CAC/C;CACA,OAAO,SAAS,WAAW,OAAO,MAAM,GAAG;AAC5C;AAGA,eAAe,aAAa,WAAW;CACtC,IAAI;EACH,OAAO,GAAG,MAAM,OAAO,8CAAqC;CAC7D,SAAS,OAAO;EACf,OAAO,MAAM,oBAAoB,WAAW,KAAK,CAAC;CACnD;AACD;;AAEA,eAAe,OAAO,OAAO;CAC5B,MAAM,WAAW,MAAM,aAAa,SAAS;CAC7C,IAAI,CAAC,SAAS,IAAI,OAAO;CACzB,OAAO,SAAS,MAAM,cAAc,OAAO,MAAM,OAAO,QAAQ,IAAI,CAAC;AACtE;;AAEA,eAAe,QAAQ,OAAO;CAC7B,MAAM,WAAW,MAAM,aAAa,UAAU;CAC9C,IAAI,CAAC,SAAS,IAAI,OAAO;CACzB,OAAO,SAAS,MAAM,eAAe,OAAO,MAAM,OAAO,QAAQ,IAAI,CAAC;AACvE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
|
|
2
2
|
import { n as DEV_ENVIRONMENT_NAME_FILE } from "./app-config-CErnR6NK-D9NgSBH4.mjs";
|
|
3
|
-
import "./local-target-
|
|
4
|
-
import * as fs$1 from "node:fs";
|
|
3
|
+
import "./local-target-Dd8FJEb5.mjs";
|
|
5
4
|
import * as path$1 from "node:path";
|
|
5
|
+
import * as fs$1 from "node:fs";
|
|
6
6
|
//#region ../../0-framework/3-tooling/cli/dist/dev-environment-name-6eEr5PW8.mjs
|
|
7
7
|
/**
|
|
8
8
|
* Each environment's folder records the environment's exact name. On a
|
|
@@ -40,4 +40,4 @@ function claimDevEnvironmentName(devDir, environment) {
|
|
|
40
40
|
//#endregion
|
|
41
41
|
export { requireDevEnvironmentName as n, claimDevEnvironmentName as t };
|
|
42
42
|
|
|
43
|
-
//# sourceMappingURL=dev-environment-name-6eEr5PW8-
|
|
43
|
+
//# sourceMappingURL=dev-environment-name-6eEr5PW8-BwusWVKi.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-environment-name-6eEr5PW8-
|
|
1
|
+
{"version":3,"file":"dev-environment-name-6eEr5PW8-BwusWVKi.mjs","names":["path","fs"],"sources":["../../../0-framework/3-tooling/cli/dist/dev-environment-name-6eEr5PW8.mjs"],"sourcesContent":["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//# sourceMappingURL=dev-environment-name-6eEr5PW8.mjs.map"],"mappings":";;;;;;;;;;;AAUA,SAAS,aAAa,QAAQ;CAC7B,MAAM,OAAOA,OAAK,KAAK,QAAQ,yBAAyB;CACxD,OAAOC,KAAG,WAAW,IAAI,IAAIA,KAAG,aAAa,MAAM,MAAM,CAAC,CAAC,KAAK,IAAI,KAAK;AAC1E;AACA,SAAS,aAAa,QAAQ,UAAU,aAAa;CACpD,OAAO,IAAI,mBAAmB,iCAAiC,cAAc,OAAO,2CAA2C,SAAS,QAAQ,YAAY,IAAI;EAC/J,KAAK;EACL,KAAK,wBAAwB,SAAS,qDAAqD,SAAS;EACpG,MAAM;GACL;GACA;GACA;EACD;CACD,CAAC;AACF;;AAEA,SAAS,0BAA0B,QAAQ,aAAa;CACvD,MAAM,WAAW,aAAa,MAAM;CACpC,IAAI,aAAa,KAAK,KAAK,aAAa,aAAa,MAAM,aAAa,QAAQ,UAAU,WAAW;AACtG;;AAEA,SAAS,wBAAwB,QAAQ,aAAa;CACrD,MAAM,WAAW,aAAa,MAAM;CACpC,IAAI,aAAa,aAAa;CAC9B,IAAI,aAAa,KAAK,GAAG,MAAM,aAAa,QAAQ,UAAU,WAAW;CACzE,KAAG,UAAU,QAAQ,EAAE,WAAW,KAAK,CAAC;CACxC,KAAG,cAAcD,OAAK,KAAK,QAAQ,yBAAyB,GAAG,GAAG,YAAY,GAAG;AAClF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
1
|
import path from "node:path";
|
|
2
|
+
import fs from "node:fs";
|
|
3
3
|
//#region ../../0-framework/2-authoring/bundle-paths/dist/index.mjs
|
|
4
4
|
/**
|
|
5
5
|
* The path-containment predicate and bundle-link validation shared by every
|
|
@@ -174,4 +174,4 @@ async function assertBundleSymlinksStayInside(bundleDir) {
|
|
|
174
174
|
//#endregion
|
|
175
175
|
export { repairWindowsDirectorySymlinks as a, isWithin as i, copyTreeVerbatim as n, createBundleLink as r, assertBundleSymlinksStayInside as t };
|
|
176
176
|
|
|
177
|
-
//# sourceMappingURL=dist-
|
|
177
|
+
//# sourceMappingURL=dist-BtzrklYG.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dist-DiYPSVUE.mjs","names":[],"sources":["../../../0-framework/2-authoring/bundle-paths/dist/index.mjs"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n//#region src/bundle-paths.ts\n/**\n* The path-containment predicate and bundle-link validation shared by every\n* assembly and packaging seam (node/nextjs adapters, the compute artifact\n* writer, the local extractor). This predicate is the enforcement point of\n* ADR-0047's boundary — a symlink may be preserved only while its target\n* stays inside the assembled bundle — so it exists exactly once.\n*\n* Windows cannot create `dir`/`file` symlinks without Developer Mode or an\n* elevated token (`EPERM`). Directory junctions need no such privilege, so\n* assemble uses them on win32; file links fall back to a copy of the target.\n*/\n/** How a platform materializes a bundle link without needing symlink privilege. */\nfunction bundleLinkStrategy(platform, type) {\n\tif (platform !== \"win32\") return \"symlink\";\n\treturn type === \"dir\" ? \"junction\" : \"symlink-with-copy-fallback\";\n}\nfunction isNotPermitted(error) {\n\treturn error instanceof Error && Reflect.get(error, \"code\") === \"EPERM\";\n}\n/**\n* Creates a link at `linkPath` whose stored target is `target`.\n* `resolvedTarget` is the absolute path of that target in the destination\n* tree — junctions require it. The win32 file-copy fallback reads\n* `copySource` (source-tree path) when set, otherwise `resolvedTarget`, and\n* only when the target exists and stays inside `copyWithinRoot` (ADR-0047:\n* never dereference an escaping link into the artifact).\n*\n* Junction/symlink strategies may temporarily store an escaping\n* `resolvedTarget` (pnpm absolute junctions into the tracing-root store);\n* later staging rewrites them, and `assertBundleSymlinksStayInside` is the\n* final gate. Only the file-copy fallback must refuse escapes — copying would\n* materialize deploy-machine content as a regular file with no link left to\n* validate.\n*/\nasync function createBundleLink(linkPath, target, type, options) {\n\tconst strategy = bundleLinkStrategy(options.platform ?? process.platform, type);\n\tif (strategy === \"junction\") {\n\t\tawait fs.promises.symlink(options.resolvedTarget, linkPath, \"junction\");\n\t\treturn;\n\t}\n\tif (strategy === \"symlink\") {\n\t\tawait fs.promises.symlink(target, linkPath, type);\n\t\treturn;\n\t}\n\ttry {\n\t\tawait fs.promises.symlink(target, linkPath, \"file\");\n\t} catch (error) {\n\t\tif (!isNotPermitted(error)) throw error;\n\t\tif (!isWithin(path.resolve(options.copyWithinRoot), path.resolve(options.resolvedTarget))) throw new Error(`refusing to materialize a file link whose target escapes the bundle: ${linkPath} -> ${options.resolvedTarget}`, { cause: error });\n\t\tconst copyFrom = options.copySource ?? options.resolvedTarget;\n\t\ttry {\n\t\t\tawait fs.promises.stat(copyFrom);\n\t\t} catch {\n\t\t\tthrow new Error(`the assembled bundle contains a dangling symlink: ${linkPath}`);\n\t\t}\n\t\tawait fs.promises.copyFile(copyFrom, linkPath);\n\t}\n}\n/**\n* Map a link's stored target from the source tree into the destination tree.\n* pnpm on Windows often materializes directory links as junctions with absolute\n* targets; copying those verbatim leaves them pointing at the source, which\n* `assertBundleSymlinksStayInside` correctly rejects as an escape.\n*/\nfunction mapLinkIntoDestination(sourceRoot, destinationRoot, sourcePath, destinationPath, rawTarget) {\n\tconst resolvedSource = path.resolve(path.dirname(sourcePath), rawTarget);\n\tif (isWithin(sourceRoot, resolvedSource)) {\n\t\tconst resolvedTarget = path.resolve(destinationRoot, path.relative(sourceRoot, resolvedSource));\n\t\treturn {\n\t\t\ttarget: path.relative(path.dirname(destinationPath), resolvedTarget),\n\t\t\tresolvedTarget\n\t\t};\n\t}\n\treturn {\n\t\ttarget: rawTarget,\n\t\tresolvedTarget: path.resolve(path.dirname(destinationPath), rawTarget)\n\t};\n}\n/** Restores directory-link metadata lost by `fs.cp` on Windows. */\nasync function repairWindowsDirectorySymlinks(root) {\n\tif (process.platform !== \"win32\") return;\n\tconst visit = async (directory) => {\n\t\tfor (const entry of await fs.promises.readdir(directory, { withFileTypes: true })) {\n\t\t\tconst full = path.join(directory, entry.name);\n\t\t\tif (entry.isSymbolicLink()) {\n\t\t\t\tconst target = await fs.promises.readlink(full);\n\t\t\t\tif (path.isAbsolute(target)) continue;\n\t\t\t\tconst resolvedTarget = path.resolve(path.dirname(full), target);\n\t\t\t\tif (!isWithin(root, resolvedTarget)) continue;\n\t\t\t\ttry {\n\t\t\t\t\tif (!(await fs.promises.stat(resolvedTarget)).isDirectory()) continue;\n\t\t\t\t} catch {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tawait fs.promises.unlink(full);\n\t\t\t\tawait createBundleLink(full, target, \"dir\", {\n\t\t\t\t\tresolvedTarget,\n\t\t\t\t\tcopyWithinRoot: root\n\t\t\t\t});\n\t\t\t} else if (entry.isDirectory()) await visit(full);\n\t\t}\n\t};\n\tawait visit(root);\n}\n/** Copy without `fs.cp`'s symlink privilege requirement: real files first, then links. */\nasync function copyTreeVerbatimWalk(source, destination) {\n\tconst sourceRoot = path.resolve(source);\n\tconst destinationRoot = path.resolve(destination);\n\tconst links = [];\n\tconst copyNonLinks = async (sourceDir, destinationDir) => {\n\t\tawait fs.promises.mkdir(destinationDir, { recursive: true });\n\t\tfor (const entry of await fs.promises.readdir(sourceDir, { withFileTypes: true })) {\n\t\t\tconst sourcePath = path.join(sourceDir, entry.name);\n\t\t\tconst destinationPath = path.join(destinationDir, entry.name);\n\t\t\tif (entry.isSymbolicLink()) links.push({\n\t\t\t\tsourcePath,\n\t\t\t\tdestinationPath\n\t\t\t});\n\t\t\telse if (entry.isDirectory()) await copyNonLinks(sourcePath, destinationPath);\n\t\t\telse if (entry.isFile()) await fs.promises.copyFile(sourcePath, destinationPath);\n\t\t}\n\t};\n\tawait copyNonLinks(source, destination);\n\tfor (const { sourcePath, destinationPath } of links) {\n\t\tconst rawTarget = await fs.promises.readlink(sourcePath);\n\t\tconst resolvedSource = path.resolve(path.dirname(sourcePath), rawTarget);\n\t\tlet type = \"file\";\n\t\ttry {\n\t\t\ttype = (await fs.promises.stat(resolvedSource)).isDirectory() ? \"dir\" : \"file\";\n\t\t} catch {}\n\t\tconst mapped = mapLinkIntoDestination(sourceRoot, destinationRoot, sourcePath, destinationPath, rawTarget);\n\t\tawait fs.promises.mkdir(path.dirname(destinationPath), { recursive: true });\n\t\tawait createBundleLink(destinationPath, mapped.target, type, {\n\t\t\tresolvedTarget: mapped.resolvedTarget,\n\t\t\tcopySource: resolvedSource,\n\t\t\tcopyWithinRoot: destinationRoot\n\t\t});\n\t}\n}\nasync function copyTreeVerbatim(source, destination) {\n\tawait copyTreeVerbatimWalk(source, destination);\n}\n/** Lexical containment: `candidate` is `root` itself or below it. Both paths\n* must already be absolute or share a resolution base; no filesystem access. */\nfunction isWithin(root, candidate) {\n\tconst relative = path.relative(root, candidate);\n\treturn relative === \"\" || !relative.startsWith(`..${path.sep}`) && relative !== \"..\" && !path.isAbsolute(relative);\n}\n/** Walks the assembled bundle and rejects a dangling symlink or one whose\n* resolved target escapes the bundle root. Symlinked directories are not\n* descended: their targets are validated, and their contents belong to the\n* target's own location. */\nasync function assertBundleSymlinksStayInside(bundleDir) {\n\tconst realRoot = await fs.promises.realpath(bundleDir);\n\tconst walk = async (directory) => {\n\t\tfor (const entry of await fs.promises.readdir(directory, { withFileTypes: true })) {\n\t\t\tconst full = path.join(directory, entry.name);\n\t\t\tif (entry.isSymbolicLink()) {\n\t\t\t\tlet realTarget;\n\t\t\t\ttry {\n\t\t\t\t\trealTarget = await fs.promises.realpath(full);\n\t\t\t\t} catch {\n\t\t\t\t\tthrow new Error(`the assembled bundle contains a dangling symlink: ${full}`);\n\t\t\t\t}\n\t\t\t\tif (!isWithin(realRoot, realTarget)) throw new Error(`the assembled bundle contains a symlink whose target escapes the bundle: ${full} -> ${await fs.promises.readlink(full)}`);\n\t\t\t} else if (entry.isDirectory()) await walk(full);\n\t\t}\n\t};\n\tawait walk(bundleDir);\n}\n//#endregion\nexport { assertBundleSymlinksStayInside, bundleLinkStrategy, copyTreeVerbatim, createBundleLink, isWithin, repairWindowsDirectorySymlinks };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,mBAAmB,UAAU,MAAM;CAC3C,IAAI,aAAa,SAAS,OAAO;CACjC,OAAO,SAAS,QAAQ,aAAa;AACtC;AACA,SAAS,eAAe,OAAO;CAC9B,OAAO,iBAAiB,SAAS,QAAQ,IAAI,OAAO,MAAM,MAAM;AACjE;;;;;;;;;;;;;;;;AAgBA,eAAe,iBAAiB,UAAU,QAAQ,MAAM,SAAS;CAChE,MAAM,WAAW,mBAAmB,QAAQ,YAAY,QAAQ,UAAU,IAAI;CAC9E,IAAI,aAAa,YAAY;EAC5B,MAAM,GAAG,SAAS,QAAQ,QAAQ,gBAAgB,UAAU,UAAU;EACtE;CACD;CACA,IAAI,aAAa,WAAW;EAC3B,MAAM,GAAG,SAAS,QAAQ,QAAQ,UAAU,IAAI;EAChD;CACD;CACA,IAAI;EACH,MAAM,GAAG,SAAS,QAAQ,QAAQ,UAAU,MAAM;CACnD,SAAS,OAAO;EACf,IAAI,CAAC,eAAe,KAAK,GAAG,MAAM;EAClC,IAAI,CAAC,SAAS,KAAK,QAAQ,QAAQ,cAAc,GAAG,KAAK,QAAQ,QAAQ,cAAc,CAAC,GAAG,MAAM,IAAI,MAAM,wEAAwE,SAAS,MAAM,QAAQ,kBAAkB,EAAE,OAAO,MAAM,CAAC;EAC5O,MAAM,WAAW,QAAQ,cAAc,QAAQ;EAC/C,IAAI;GACH,MAAM,GAAG,SAAS,KAAK,QAAQ;EAChC,QAAQ;GACP,MAAM,IAAI,MAAM,qDAAqD,UAAU;EAChF;EACA,MAAM,GAAG,SAAS,SAAS,UAAU,QAAQ;CAC9C;AACD;;;;;;;AAOA,SAAS,uBAAuB,YAAY,iB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SAAS;CAC9C,OAAO,aAAa,MAAM,CAAC,SAAS,WAAW,KAAK,KAAK,KAAK,KAAK,aAAa,QAAQ,CAAC,KAAK,WAAW,QAAQ;AAClH;;;;;AAKA,eAAe,+BAA+B,WAAW;CACxD,MAAM,WAAW,MAAM,GAAG,SAAS,SAAS,SAAS;CACrD,MAAM,OAAO,OAAO,cAAc;EACjC,KAAK,MAAM,SAAS,MAAM,GAAG,SAAS,QAAQ,WAAW,EAAE,eAAe,KAAK,CAAC,GAAG;GAClF,MAAM,OAAO,KAAK,KAAK,WAAW,MAAM,IAAI;GAC5C,IAAI,MAAM,eAAe,GAAG;IAC3B,IAAI;IACJ,IAAI;KACH,aAAa,MAAM,GAAG,SAAS,SAAS,IAAI;IAC7C,QAAQ;KACP,MAAM,IAAI,MAAM,qDAAqD,MAAM;IAC5E;IACA,IAAI,CAAC,SAAS,UAAU,UAAU,GAAG,MAAM,IAAI,MAAM,4EAA4E,KAAK,MAAM,MAAM,GAAG,SAAS,SAAS,IAAI,GAAG;GAC/K,OAAO,IAAI,MAAM,YAAY,GAAG,MAAM,KAAK,IAAI;EAChD;CACD;CACA,MAAM,KAAK,SAAS;AACrB"}
|
|
1
|
+
{"version":3,"file":"dist-BtzrklYG.mjs","names":[],"sources":["../../../0-framework/2-authoring/bundle-paths/dist/index.mjs"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n//#region src/bundle-paths.ts\n/**\n* The path-containment predicate and bundle-link validation shared by every\n* assembly and packaging seam (node/nextjs adapters, the compute artifact\n* writer, the local extractor). This predicate is the enforcement point of\n* ADR-0047's boundary — a symlink may be preserved only while its target\n* stays inside the assembled bundle — so it exists exactly once.\n*\n* Windows cannot create `dir`/`file` symlinks without Developer Mode or an\n* elevated token (`EPERM`). Directory junctions need no such privilege, so\n* assemble uses them on win32; file links fall back to a copy of the target.\n*/\n/** How a platform materializes a bundle link without needing symlink privilege. */\nfunction bundleLinkStrategy(platform, type) {\n\tif (platform !== \"win32\") return \"symlink\";\n\treturn type === \"dir\" ? \"junction\" : \"symlink-with-copy-fallback\";\n}\nfunction isNotPermitted(error) {\n\treturn error instanceof Error && Reflect.get(error, \"code\") === \"EPERM\";\n}\n/**\n* Creates a link at `linkPath` whose stored target is `target`.\n* `resolvedTarget` is the absolute path of that target in the destination\n* tree — junctions require it. The win32 file-copy fallback reads\n* `copySource` (source-tree path) when set, otherwise `resolvedTarget`, and\n* only when the target exists and stays inside `copyWithinRoot` (ADR-0047:\n* never dereference an escaping link into the artifact).\n*\n* Junction/symlink strategies may temporarily store an escaping\n* `resolvedTarget` (pnpm absolute junctions into the tracing-root store);\n* later staging rewrites them, and `assertBundleSymlinksStayInside` is the\n* final gate. Only the file-copy fallback must refuse escapes — copying would\n* materialize deploy-machine content as a regular file with no link left to\n* validate.\n*/\nasync function createBundleLink(linkPath, target, type, options) {\n\tconst strategy = bundleLinkStrategy(options.platform ?? process.platform, type);\n\tif (strategy === \"junction\") {\n\t\tawait fs.promises.symlink(options.resolvedTarget, linkPath, \"junction\");\n\t\treturn;\n\t}\n\tif (strategy === \"symlink\") {\n\t\tawait fs.promises.symlink(target, linkPath, type);\n\t\treturn;\n\t}\n\ttry {\n\t\tawait fs.promises.symlink(target, linkPath, \"file\");\n\t} catch (error) {\n\t\tif (!isNotPermitted(error)) throw error;\n\t\tif (!isWithin(path.resolve(options.copyWithinRoot), path.resolve(options.resolvedTarget))) throw new Error(`refusing to materialize a file link whose target escapes the bundle: ${linkPath} -> ${options.resolvedTarget}`, { cause: error });\n\t\tconst copyFrom = options.copySource ?? options.resolvedTarget;\n\t\ttry {\n\t\t\tawait fs.promises.stat(copyFrom);\n\t\t} catch {\n\t\t\tthrow new Error(`the assembled bundle contains a dangling symlink: ${linkPath}`);\n\t\t}\n\t\tawait fs.promises.copyFile(copyFrom, linkPath);\n\t}\n}\n/**\n* Map a link's stored target from the source tree into the destination tree.\n* pnpm on Windows often materializes directory links as junctions with absolute\n* targets; copying those verbatim leaves them pointing at the source, which\n* `assertBundleSymlinksStayInside` correctly rejects as an escape.\n*/\nfunction mapLinkIntoDestination(sourceRoot, destinationRoot, sourcePath, destinationPath, rawTarget) {\n\tconst resolvedSource = path.resolve(path.dirname(sourcePath), rawTarget);\n\tif (isWithin(sourceRoot, resolvedSource)) {\n\t\tconst resolvedTarget = path.resolve(destinationRoot, path.relative(sourceRoot, resolvedSource));\n\t\treturn {\n\t\t\ttarget: path.relative(path.dirname(destinationPath), resolvedTarget),\n\t\t\tresolvedTarget\n\t\t};\n\t}\n\treturn {\n\t\ttarget: rawTarget,\n\t\tresolvedTarget: path.resolve(path.dirname(destinationPath), rawTarget)\n\t};\n}\n/** Restores directory-link metadata lost by `fs.cp` on Windows. */\nasync function repairWindowsDirectorySymlinks(root) {\n\tif (process.platform !== \"win32\") return;\n\tconst visit = async (directory) => {\n\t\tfor (const entry of await fs.promises.readdir(directory, { withFileTypes: true })) {\n\t\t\tconst full = path.join(directory, entry.name);\n\t\t\tif (entry.isSymbolicLink()) {\n\t\t\t\tconst target = await fs.promises.readlink(full);\n\t\t\t\tif (path.isAbsolute(target)) continue;\n\t\t\t\tconst resolvedTarget = path.resolve(path.dirname(full), target);\n\t\t\t\tif (!isWithin(root, resolvedTarget)) continue;\n\t\t\t\ttry {\n\t\t\t\t\tif (!(await fs.promises.stat(resolvedTarget)).isDirectory()) continue;\n\t\t\t\t} catch {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tawait fs.promises.unlink(full);\n\t\t\t\tawait createBundleLink(full, target, \"dir\", {\n\t\t\t\t\tresolvedTarget,\n\t\t\t\t\tcopyWithinRoot: root\n\t\t\t\t});\n\t\t\t} else if (entry.isDirectory()) await visit(full);\n\t\t}\n\t};\n\tawait visit(root);\n}\n/** Copy without `fs.cp`'s symlink privilege requirement: real files first, then links. */\nasync function copyTreeVerbatimWalk(source, destination) {\n\tconst sourceRoot = path.resolve(source);\n\tconst destinationRoot = path.resolve(destination);\n\tconst links = [];\n\tconst copyNonLinks = async (sourceDir, destinationDir) => {\n\t\tawait fs.promises.mkdir(destinationDir, { recursive: true });\n\t\tfor (const entry of await fs.promises.readdir(sourceDir, { withFileTypes: true })) {\n\t\t\tconst sourcePath = path.join(sourceDir, entry.name);\n\t\t\tconst destinationPath = path.join(destinationDir, entry.name);\n\t\t\tif (entry.isSymbolicLink()) links.push({\n\t\t\t\tsourcePath,\n\t\t\t\tdestinationPath\n\t\t\t});\n\t\t\telse if (entry.isDirectory()) await copyNonLinks(sourcePath, destinationPath);\n\t\t\telse if (entry.isFile()) await fs.promises.copyFile(sourcePath, destinationPath);\n\t\t}\n\t};\n\tawait copyNonLinks(source, destination);\n\tfor (const { sourcePath, destinationPath } of links) {\n\t\tconst rawTarget = await fs.promises.readlink(sourcePath);\n\t\tconst resolvedSource = path.resolve(path.dirname(sourcePath), rawTarget);\n\t\tlet type = \"file\";\n\t\ttry {\n\t\t\ttype = (await fs.promises.stat(resolvedSource)).isDirectory() ? \"dir\" : \"file\";\n\t\t} catch {}\n\t\tconst mapped = mapLinkIntoDestination(sourceRoot, destinationRoot, sourcePath, destinationPath, rawTarget);\n\t\tawait fs.promises.mkdir(path.dirname(destinationPath), { recursive: true });\n\t\tawait createBundleLink(destinationPath, mapped.target, type, {\n\t\t\tresolvedTarget: mapped.resolvedTarget,\n\t\t\tcopySource: resolvedSource,\n\t\t\tcopyWithinRoot: destinationRoot\n\t\t});\n\t}\n}\nasync function copyTreeVerbatim(source, destination) {\n\tawait copyTreeVerbatimWalk(source, destination);\n}\n/** Lexical containment: `candidate` is `root` itself or below it. Both paths\n* must already be absolute or share a resolution base; no filesystem access. */\nfunction isWithin(root, candidate) {\n\tconst relative = path.relative(root, candidate);\n\treturn relative === \"\" || !relative.startsWith(`..${path.sep}`) && relative !== \"..\" && !path.isAbsolute(relative);\n}\n/** Walks the assembled bundle and rejects a dangling symlink or one whose\n* resolved target escapes the bundle root. Symlinked directories are not\n* descended: their targets are validated, and their contents belong to the\n* target's own location. */\nasync function assertBundleSymlinksStayInside(bundleDir) {\n\tconst realRoot = await fs.promises.realpath(bundleDir);\n\tconst walk = async (directory) => {\n\t\tfor (const entry of await fs.promises.readdir(directory, { withFileTypes: true })) {\n\t\t\tconst full = path.join(directory, entry.name);\n\t\t\tif (entry.isSymbolicLink()) {\n\t\t\t\tlet realTarget;\n\t\t\t\ttry {\n\t\t\t\t\trealTarget = await fs.promises.realpath(full);\n\t\t\t\t} catch {\n\t\t\t\t\tthrow new Error(`the assembled bundle contains a dangling symlink: ${full}`);\n\t\t\t\t}\n\t\t\t\tif (!isWithin(realRoot, realTarget)) throw new Error(`the assembled bundle contains a symlink whose target escapes the bundle: ${full} -> ${await fs.promises.readlink(full)}`);\n\t\t\t} else if (entry.isDirectory()) await walk(full);\n\t\t}\n\t};\n\tawait walk(bundleDir);\n}\n//#endregion\nexport { assertBundleSymlinksStayInside, bundleLinkStrategy, copyTreeVerbatim, createBundleLink, isWithin, repairWindowsDirectorySymlinks };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,mBAAmB,UAAU,MAAM;CAC3C,IAAI,aAAa,SAAS,OAAO;CACjC,OAAO,SAAS,QAAQ,aAAa;AACtC;AACA,SAAS,eAAe,OAAO;CAC9B,OAAO,iBAAiB,SAAS,QAAQ,IAAI,OAAO,MAAM,MAAM;AACjE;;;;;;;;;;;;;;;;AAgBA,eAAe,iBAAiB,UAAU,QAAQ,MAAM,SAAS;CAChE,MAAM,WAAW,mBAAmB,QAAQ,YAAY,QAAQ,UAAU,IAAI;CAC9E,IAAI,aAAa,YAAY;EAC5B,MAAM,GAAG,SAAS,QAAQ,QAAQ,gBAAgB,UAAU,UAAU;EACtE;CACD;CACA,IAAI,aAAa,WAAW;EAC3B,MAAM,GAAG,SAAS,QAAQ,QAAQ,UAAU,IAAI;EAChD;CACD;CACA,IAAI;EACH,MAAM,GAAG,SAAS,QAAQ,QAAQ,UAAU,MAAM;CACnD,SAAS,OAAO;EACf,IAAI,CA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-DoWGmN7m-DO5Brq1Y.mjs";
|
|
1
|
+
import "./graph-CBt9CRBT-yMupsISb.mjs";
|
|
3
2
|
//#region ../../0-framework/1-core/core/dist/index.mjs
|
|
4
3
|
/**
|
|
5
4
|
* A data-only descriptor of a param's schema for introspection — the
|
|
@@ -63,6 +62,14 @@ function inputManifest(graph) {
|
|
|
63
62
|
function paramManifest(graph) {
|
|
64
63
|
return graph.params;
|
|
65
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Every secret source a binding in the graph names, wherever it sits: what a
|
|
67
|
+
* deploy target's preflight checks.
|
|
68
|
+
* Pure graph introspection, TARGET-AGNOSTIC.
|
|
69
|
+
*/
|
|
70
|
+
function secretSourceManifest(graph) {
|
|
71
|
+
return graph.secretSources;
|
|
72
|
+
}
|
|
66
73
|
function scalarSchema(name, check) {
|
|
67
74
|
return { "~standard": {
|
|
68
75
|
version: 1,
|
|
@@ -124,6 +131,6 @@ function hydrateSync(root, config) {
|
|
|
124
131
|
return deps;
|
|
125
132
|
}
|
|
126
133
|
//#endregion
|
|
127
|
-
export { number as a,
|
|
134
|
+
export { number as a, secretSourceManifest as c, inputManifest as i, string as l, hydrate as n, param as o, hydrateSync as r, paramManifest as s, configOf as t };
|
|
128
135
|
|
|
129
|
-
//# sourceMappingURL=dist-
|
|
136
|
+
//# sourceMappingURL=dist-NyTyCEnG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dist-NyTyCEnG.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/index.mjs"],"sourcesContent":["import { C as RESOURCE_OUT_PORT, S as LoadError, _ as secretSource, a as ResourceNodeBase, b as isValue, c as freezeNode, d as isProvisionNeed, f as isSecretSource, g as resource, h as provisionNeed, l as isNode, m as paramSource, n as assertAppName, o as appRoot, p as module, s as dependency, t as Load, u as isParamSource, v as service, x as resolve, y as slotsOf } from \"./graph-CBt9CRBT.mjs\";\nimport { isPlainPointer, isSecretPointer } from \"@internal/foundation/pointer\";\nimport { SecretBox, isSecretString } from \"@internal/foundation/secret\";\n//#region src/config.ts\n/**\n* A data-only descriptor of a param's schema for introspection — the\n* validator's vendor tag, never the schema's own `validate`. `configOf`\n* reports it where the old model reported `type: 'string' | 'number'`, so the\n* config surface stays enumerable without leaking a function. Nothing consumes\n* more than the vendor tag yet; a richer projection (e.g. a JSON-Schema export\n* when the vendor offers one) is an additive change if a consumer needs it.\n*/\nfunction projectSchema(schema) {\n\treturn { vendor: schema[\"~standard\"].vendor };\n}\n/**\n* Enumerates every config param the service declares: each input's connection\n* params, then the service's own params. Pure — reads `root.inputs`/`params`\n* directly, executes nothing but the (also pure) schema projection. Deliberately\n* does not go through `Load`: a service's connection-end inputs are legitimately\n* unwired from its own point of view (wiring is an enclosing module's concern),\n* and this introspects one service's declared shape regardless of how — or\n* whether — it composes into a larger graph.\n*/\nfunction configOf(root) {\n\tconst entries = [];\n\tfor (const [input, value] of Object.entries(root.inputs)) {\n\t\tif (typeof value !== \"object\" || value === null) continue;\n\t\tfor (const [name, param] of Object.entries(value.connection.params)) entries.push({\n\t\t\towner: { input },\n\t\t\tname,\n\t\t\tschema: projectSchema(param.schema),\n\t\t\toptional: param.optional === true,\n\t\t\tdefault: param.default\n\t\t});\n\t}\n\tfor (const [name, param] of Object.entries(root.params)) entries.push({\n\t\towner: \"service\",\n\t\tname,\n\t\tschema: projectSchema(param.schema),\n\t\toptional: param.optional === true,\n\t\tdefault: param.default\n\t});\n\treturn entries;\n}\n/**\n* The app's input manifest: every service input binding a `provision()` call\n* supplied (ADR-0042). Pure graph introspection, TARGET-AGNOSTIC — a deploy\n* target's recursive descent classifies the binding's leaves (its preflight\n* verifies each `envSecret` leaf's platform var exists before deploy; the\n* values are provisioned out-of-band).\n*/\nfunction inputManifest(graph) {\n\treturn graph.inputBindings;\n}\n/**\n* The app's param-binding manifest: every param a `provision()` call bound —\n* literal or an opaque, target-defined `ParamSource` — at the address that\n* declared it. The param sibling of `provisionManifest`, for a deploy\n* target's own preflight to consume. Pure graph introspection,\n* TARGET-AGNOSTIC; a param this manifest omits simply falls back to its own\n* `default` at `buildConfig`.\n*/\nfunction paramManifest(graph) {\n\treturn graph.params;\n}\n/**\n* Every secret source a binding in the graph names, wherever it sits: what a\n* deploy target's preflight checks.\n* Pure graph introspection, TARGET-AGNOSTIC.\n*/\nfunction secretSourceManifest(graph) {\n\treturn graph.secretSources;\n}\nfunction scalarSchema(name, check) {\n\treturn { \"~standard\": {\n\t\tversion: 1,\n\t\tvendor: \"@prisma/composer\",\n\t\tvalidate: (value) => check(value) ? { value } : { issues: [{ message: `expected ${name}, got ${typeof value}` }] }\n\t} };\n}\nconst stringSchema = scalarSchema(\"string\", (v) => typeof v === \"string\");\nconst numberSchema = scalarSchema(\"number\", (v) => typeof v === \"number\" && Number.isFinite(v));\nfunction withFacets(schema, opts) {\n\treturn {\n\t\tschema,\n\t\t...opts.optional !== void 0 ? { optional: opts.optional } : {},\n\t\t...opts.default !== void 0 ? { default: opts.default } : {},\n\t\t...opts.provision !== void 0 ? { provision: opts.provision } : {}\n\t};\n}\n/** A string-valued param. */\nfunction string(opts = {}) {\n\treturn withFacets(stringSchema, opts);\n}\n/** A number-valued param. */\nfunction number(opts = {}) {\n\treturn withFacets(numberSchema, opts);\n}\n/** A param over any caller-supplied Standard Schema — a structured `jobs`, say. */\nfunction param(schema, opts = {}) {\n\treturn withFacets(schema, opts);\n}\n//#endregion\n//#region src/hydrate.ts\n/**\n* Given a service and a concrete typed Config, hydrate every input\n* (connection.hydrate with its typed value slice). A resource dep and a\n* connection dep hydrate through identical machinery — the loaded client is\n* indistinguishable. The service's own params ride alongside in\n* `config.service`; the node's `load()` merges the two.\n*/\nasync function hydrate(root, config) {\n\tconst deps = {};\n\tfor (const [name, inputNode] of Object.entries(root.inputs)) {\n\t\tconst values = config.inputs[name] ?? {};\n\t\tdeps[name] = await inputNode.connection.hydrate(values);\n\t}\n\treturn deps;\n}\n/**\n* Synchronous hydrate — what the node's `load()` uses so\n* `const { db } = service.load()` reads without `await`. Requires every\n* connection.hydrate to return synchronously; a Promise return is a loud error\n* naming the input (an async client factory must use the async `hydrate` path).\n*/\nfunction hydrateSync(root, config) {\n\tconst deps = {};\n\tfor (const [name, inputNode] of Object.entries(root.inputs)) {\n\t\tconst values = config.inputs[name] ?? {};\n\t\tconst client = inputNode.connection.hydrate(values);\n\t\tif (client instanceof Promise) throw new Error(`Connection hydrate for input \"${name}\" returned a Promise; load() requires a synchronous client factory.`);\n\t\tdeps[name] = client;\n\t}\n\treturn deps;\n}\n//#endregion\nexport { Load, LoadError, RESOURCE_OUT_PORT, ResourceNodeBase, SecretBox, appRoot, assertAppName, configOf, dependency, freezeNode, hydrate, hydrateSync, inputManifest, isNode, isParamSource, isPlainPointer, isProvisionNeed, isSecretPointer, isSecretSource, isSecretString, isValue, module, number, param, paramManifest, paramSource, provisionNeed, resolve, resource, secretSource, secretSourceManifest, service, slotsOf, string };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;AAYA,SAAS,cAAc,QAAQ;CAC9B,OAAO,EAAE,QAAQ,OAAO,YAAY,CAAC,OAAO;AAC7C;;;;;;;;;;AAUA,SAAS,SAAS,MAAM;CACvB,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,CAAC,OAAO,UAAU,OAAO,QAAQ,KAAK,MAAM,GAAG;EACzD,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM;EACjD,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,MAAM,WAAW,MAAM,GAAG,QAAQ,KAAK;GACjF,OAAO,EAAE,MAAM;GACf;GACA,QAAQ,cAAc,MAAM,MAAM;GAClC,UAAU,MAAM,aAAa;GAC7B,SAAS,MAAM;EAChB,CAAC;CACF;CACA,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,KAAK,MAAM,GAAG,QAAQ,KAAK;EACrE,OAAO;EACP;EACA,QAAQ,cAAc,MAAM,MAAM;EAClC,UAAU,MAAM,aAAa;EAC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O,OAAO,SAAS,CAAC;EACvC,KAAK,QAAQ,MAAM,UAAU,WAAW,QAAQ,MAAM;CACvD;CACA,OAAO;AACR;;;;;;;AAOA,SAAS,YAAY,MAAM,QAAQ;CAClC,MAAM,OAAO,CAAC;CACd,KAAK,MAAM,CAAC,MAAM,cAAc,OAAO,QAAQ,KAAK,MAAM,GAAG;EAC5D,MAAM,SAAS,OAAO,OAAO,SAAS,CAAC;EACvC,MAAM,SAAS,UAAU,WAAW,QAAQ,MAAM;EAClD,IAAI,kBAAkB,SAAS,MAAM,IAAI,MAAM,iCAAiC,KAAK,oEAAoE;EACzJ,KAAK,QAAQ;CACd;CACA,OAAO;AACR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors-0e8IVwzi.mjs","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/errors.mjs"],"sourcesContent":["import { t as blindCast } from \"./casts-DpaahrlC.mjs\";\nimport { n as assertNever, r as isInternalError, t as InternalError } from \"./internal-error-Dfur7Zqt.mjs\";\n//#region src/defined.ts\n/**\n* Returns an object with the key/value if value is defined, otherwise an empty object.\n*\n* Use with spread to conditionally include optional properties while satisfying\n* exactOptionalPropertyTypes. This is explicit about which properties are optional\n* and won't inadvertently strip other undefined values.\n*\n* @example\n* ```typescript\n* // Instead of:\n* const obj = {\n* required: 'value',\n* ...(optional ? { optional } : {}),\n* };\n*\n* // Use:\n* const obj = {\n* required: 'value',\n* ...ifDefined('optional', optional),\n* };\n* ```\n*/\nfunction ifDefined(key, value) {\n\treturn value !== void 0 ? blindCast({ [key]: value }) : {};\n}\n//#endregion\n//#region src/cli-structured-error.ts\n/**\n* Structured CLI error that contains all information needed for error envelopes.\n* Call sites throw these errors with full context.\n*\n* A `CliStructuredError` is a `StructuredError` (see\n* `./structured-error.ts`): `code` is a dotted\n* `NAMESPACE.SUBCODE` string, and the namespace prefix is the error's\n* category — there is no separate `domain` field. See ADR 239 in\n* prisma/prisma and composer's ADR-0044 for the namespace taxonomy.\n*/\nvar CliStructuredError = class extends Error {\n\tcode;\n\tseverity;\n\tconstructor(code, summary, options) {\n\t\tsuper(summary, options?.cause !== void 0 ? { cause: options.cause } : void 0);\n\t\tthis.name = \"CliStructuredError\";\n\t\tthis.code = code;\n\t\tthis.severity = options?.severity ?? \"error\";\n\t\tconst fix = options?.fix === options?.why ? void 0 : options?.fix;\n\t\tconst where = options?.where ? {\n\t\t\t...ifDefined(\"path\", options.where.path),\n\t\t\t...ifDefined(\"line\", options.where.line)\n\t\t} : void 0;\n\t\tObject.assign(this, {\n\t\t\t...ifDefined(\"why\", options?.why),\n\t\t\t...ifDefined(\"fix\", fix),\n\t\t\t...ifDefined(\"where\", where),\n\t\t\t...ifDefined(\"meta\", options?.meta),\n\t\t\t...ifDefined(\"docsUrl\", options?.docsUrl)\n\t\t});\n\t}\n\t/**\n\t* Converts this error to a CLI error envelope for output formatting.\n\t*/\n\ttoEnvelope() {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tcode: this.code,\n\t\t\tseverity: this.severity,\n\t\t\tsummary: this.message,\n\t\t\t...ifDefined(\"why\", this.why),\n\t\t\t...ifDefined(\"fix\", this.fix),\n\t\t\t...ifDefined(\"where\", this.where),\n\t\t\t...ifDefined(\"meta\", this.meta),\n\t\t\t...ifDefined(\"docsUrl\", this.docsUrl)\n\t\t};\n\t}\n\t/**\n\t* Type guard to check if an error is a CliStructuredError.\n\t* Uses duck-typing to work across module boundaries where instanceof may fail.\n\t*/\n\tstatic is(error) {\n\t\tif (!(error instanceof Error)) return false;\n\t\tconst candidate = blindCast(error);\n\t\treturn candidate.name === \"CliStructuredError\" && typeof candidate.code === \"string\" && typeof candidate.toEnvelope === \"function\";\n\t}\n};\n//#endregion\n//#region src/structured-error.ts\nconst STRUCTURED_CODE_RE = /^[A-Z][A-Z0-9]*\\.[A-Z][A-Z0-9_]*$/;\nfunction isStructuredError(e) {\n\treturn typeof e === \"object\" && e !== null && \"code\" in e && typeof e.code === \"string\" && STRUCTURED_CODE_RE.test(e.code) && \"message\" in e && typeof e.message === \"string\";\n}\nfunction structuredError(code, message, options) {\n\tconst error = options?.cause !== void 0 ? new Error(message, { cause: options.cause }) : new Error(message);\n\tObject.defineProperty(error, \"name\", {\n\t\tvalue: \"StructuredError\",\n\t\tconfigurable: true\n\t});\n\treturn Object.assign(error, {\n\t\tcode,\n\t\t...ifDefined(\"why\", options?.why),\n\t\t...ifDefined(\"fix\", options?.fix),\n\t\t...ifDefined(\"where\", options?.where),\n\t\t...ifDefined(\"severity\", options?.severity),\n\t\t...ifDefined(\"meta\", options?.meta),\n\t\t...ifDefined(\"docsUrl\", options?.docsUrl)\n\t});\n}\nconst DOCS_BASE = `https://docs.prisma.io/docs/orm/next/reference/error-reference`;\nfunction docsUrlFor(code) {\n\treturn `${DOCS_BASE}#${code}`;\n}\n//#endregion\nexport { CliStructuredError, DOCS_BASE, InternalError, assertNever, docsUrlFor, isInternalError, isStructuredError, structuredError };\n\n//# sourceMappingURL=errors.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"errors-0e8IVwzi.mjs","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/errors.mjs"],"sourcesContent":["import { t as blindCast } from \"./casts-DpaahrlC.mjs\";\nimport { t as describeKind } from \"./describe-kind-Cpm_euxo.mjs\";\nimport { n as assertNever, r as isInternalError, t as InternalError } from \"./internal-error-Dfur7Zqt.mjs\";\n//#region src/defined.ts\n/**\n* Returns an object with the key/value if value is defined, otherwise an empty object.\n*\n* Use with spread to conditionally include optional properties while satisfying\n* exactOptionalPropertyTypes. This is explicit about which properties are optional\n* and won't inadvertently strip other undefined values.\n*\n* @example\n* ```typescript\n* // Instead of:\n* const obj = {\n* required: 'value',\n* ...(optional ? { optional } : {}),\n* };\n*\n* // Use:\n* const obj = {\n* required: 'value',\n* ...ifDefined('optional', optional),\n* };\n* ```\n*/\nfunction ifDefined(key, value) {\n\treturn value !== void 0 ? blindCast({ [key]: value }) : {};\n}\n//#endregion\n//#region src/cli-structured-error.ts\n/**\n* Structured CLI error that contains all information needed for error envelopes.\n* Call sites throw these errors with full context.\n*\n* A `CliStructuredError` is a `StructuredError` (see\n* `./structured-error.ts`): `code` is a dotted\n* `NAMESPACE.SUBCODE` string, and the namespace prefix is the error's\n* category — there is no separate `domain` field. See ADR 239 in\n* prisma/prisma and composer's ADR-0044 for the namespace taxonomy.\n*/\nvar CliStructuredError = class extends Error {\n\tcode;\n\tseverity;\n\tconstructor(code, summary, options) {\n\t\tsuper(summary, options?.cause !== void 0 ? { cause: options.cause } : void 0);\n\t\tthis.name = \"CliStructuredError\";\n\t\tthis.code = code;\n\t\tthis.severity = options?.severity ?? \"error\";\n\t\tconst fix = options?.fix === options?.why ? void 0 : options?.fix;\n\t\tconst where = options?.where ? {\n\t\t\t...ifDefined(\"path\", options.where.path),\n\t\t\t...ifDefined(\"line\", options.where.line)\n\t\t} : void 0;\n\t\tObject.assign(this, {\n\t\t\t...ifDefined(\"why\", options?.why),\n\t\t\t...ifDefined(\"fix\", fix),\n\t\t\t...ifDefined(\"where\", where),\n\t\t\t...ifDefined(\"meta\", options?.meta),\n\t\t\t...ifDefined(\"docsUrl\", options?.docsUrl)\n\t\t});\n\t}\n\t/**\n\t* Converts this error to a CLI error envelope for output formatting.\n\t*/\n\ttoEnvelope() {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tcode: this.code,\n\t\t\tseverity: this.severity,\n\t\t\tsummary: this.message,\n\t\t\t...ifDefined(\"why\", this.why),\n\t\t\t...ifDefined(\"fix\", this.fix),\n\t\t\t...ifDefined(\"where\", this.where),\n\t\t\t...ifDefined(\"meta\", this.meta),\n\t\t\t...ifDefined(\"docsUrl\", this.docsUrl)\n\t\t};\n\t}\n\t/**\n\t* Type guard to check if an error is a CliStructuredError.\n\t* Uses duck-typing to work across module boundaries where instanceof may fail.\n\t*/\n\tstatic is(error) {\n\t\tif (!(error instanceof Error)) return false;\n\t\tconst candidate = blindCast(error);\n\t\treturn candidate.name === \"CliStructuredError\" && typeof candidate.code === \"string\" && typeof candidate.toEnvelope === \"function\";\n\t}\n};\n//#endregion\n//#region src/structured-error.ts\nconst STRUCTURED_CODE_RE = /^[A-Z][A-Z0-9]*\\.[A-Z][A-Z0-9_]*$/;\nfunction isStructuredError(e) {\n\treturn typeof e === \"object\" && e !== null && \"code\" in e && typeof e.code === \"string\" && STRUCTURED_CODE_RE.test(e.code) && \"message\" in e && typeof e.message === \"string\";\n}\nfunction structuredError(code, message, options) {\n\tconst error = options?.cause !== void 0 ? new Error(message, { cause: options.cause }) : new Error(message);\n\tObject.defineProperty(error, \"name\", {\n\t\tvalue: \"StructuredError\",\n\t\tconfigurable: true\n\t});\n\treturn Object.assign(error, {\n\t\tcode,\n\t\t...ifDefined(\"why\", options?.why),\n\t\t...ifDefined(\"fix\", options?.fix),\n\t\t...ifDefined(\"where\", options?.where),\n\t\t...ifDefined(\"severity\", options?.severity),\n\t\t...ifDefined(\"meta\", options?.meta),\n\t\t...ifDefined(\"docsUrl\", options?.docsUrl)\n\t});\n}\nconst DOCS_BASE = `https://docs.prisma.io/docs/orm/next/reference/error-reference`;\nfunction docsUrlFor(code) {\n\treturn `${DOCS_BASE}#${code}`;\n}\n//#endregion\nexport { CliStructuredError, DOCS_BASE, InternalError, assertNever, describeKind, docsUrlFor, isInternalError, isStructuredError, structuredError };\n\n//# sourceMappingURL=errors.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAS,UAAU,KAAK,OAAO;CAC9B,OAAO,UAAU,KAAK,IAAI,UAAU,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC;AAC1D;;;;;;;;;;;AAaA,IAAI,qBAAqB,cAAc,MAAM;CAC5C;CACA;CACA,YAAY,MAAM,SAAS,SAAS;EACnC,MAAM,SAAS,SAAS,UAAU,KAAK,IAAI,EAAE,OAAO,QAAQ,MAAM,IAAI,KAAK,CAAC;EAC5E,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,WAAW,SAAS,YAAY;EACrC,MAAM,MAAM,SAAS,QAAQ,SAAS,MAAM,KAAK,IAAI,SAAS;EAC9D,MAAM,QAAQ,SAAS,QAAQ;GAC9B,GAAG,UAAU,QAAQ,QAAQ,MAAM,IAAI;GACvC,GAAG,UAAU,QAAQ,QAAQ,MAAM,IAAI;EACxC,IAAI,KAAK;EACT,OAAO,OAAO,MAAM;GACnB,GAAG,UAAU,OAAO,SAAS,GAAG;GAChC,GAAG,UAAU,OAAO,GAAG;GACvB,GAAG,UAAU,SAAS,KAAK;GAC3B,GAAG,UAAU,QAAQ,SAAS,IAAI;GAClC,GAAG,UAAU,WAAW,SAAS,OAAO;EACzC,CAAC;CACF;;;;CAIA,aAAa;EACZ,OAAO;GACN,IAAI;GACJ,MAAM,KAAK;GACX,UAAU,KAAK;GACf,SAAS,KAAK;GACd,GAAG,UAAU,OAAO,KAAK,GAAG;GAC5B,GAAG,UAAU,OAAO,KAAK,GAAG;GAC5B,GAAG,UAAU,SAAS,KAAK,KAAK;GAChC,GAAG,UAAU,QAAQ,KAAK,IAAI;GAC9B,GAAG,UAAU,WAAW,KAAK,OAAO;EACrC;CACD;;;;;CAKA,OAAO,GAAG,OAAO;EAChB,IAAI,EAAE,iBAAiB,QAAQ,OAAO;EACtC,MAAM,YAAY,UAAU,KAAK;EACjC,OAAO,UAAU,SAAS,wBAAwB,OAAO,UAAU,SAAS,YAAY,OAAO,UAAU,eAAe;CACzH;AACD"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import { h as nodeAddresses, x as secretsKeys } from "./graph-CBt9CRBT-yMupsISb.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 { n as preflightEnvVarName, t as preflightEnv } from "./config-BFuriECI.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { a as
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
5
|
+
import { i as prepareSecondProcess, o as removeLeftoverAppConfigurationFiles, t as deployAppConfigurationFile } from "./app-configuration-file-CeJvBAti-D3uDlheX.mjs";
|
|
6
|
+
import { c as toStructured, d as okVoid, l as notOk, s as requireContainerForEnvironment, u as ok } from "./dev-current-D-Qb6Yem-Cvy2dWhe.mjs";
|
|
7
|
+
import { a as writeRunReport, i as toRunReport, r as resolveRunReportPath, t as RUN_REPORT_FILE_ENV } from "./run-report-CmBz2-xc-Cc8rV1CX.mjs";
|
|
8
|
+
import "./deploy-DergV8De.mjs";
|
|
9
|
+
import { c as redactThrown, o as redactError, s as redactSummary, t as SecretRedaction } from "./redaction-HnbkSFrK-BXRZ3B33.mjs";
|
|
10
|
+
import { a as readEngineFailureCause, i as readDeploymentSummary, r as engineFailureFilePath, t as DEPLOYMENT_RESULT_FILE_ENV } from "./deployment-summary-BiBkPWlB-CyC2pudN.mjs";
|
|
11
|
+
import { a as noComposerExportMessage, i as validateEnvironmentName, r as runPipeline } from "./validate-environment-CpQLC3CA-COmDdusV.mjs";
|
|
12
|
+
import { n as reproduceCommand, r as spawnAlchemy, t as alchemyInvocation } from "./run-alchemy-OS_ix5g0-DCvUYZ7T.mjs";
|
|
10
13
|
import * as path$1 from "node:path";
|
|
14
|
+
import * as fs$1 from "node:fs";
|
|
11
15
|
import { randomUUID } from "node:crypto";
|
|
12
|
-
//#region ../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-
|
|
16
|
+
//#region ../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-C6EsdmLz.mjs
|
|
13
17
|
/** Pipeline step 6: writes a regenerated-every-run, independently runnable stack module at `.prisma-composer/alchemy.run.ts`. */
|
|
14
18
|
const GENERATED_DIR = ".prisma-composer";
|
|
15
19
|
const GENERATED_FILE = "alchemy.run.ts";
|
|
@@ -28,6 +32,8 @@ function renderOptions(input) {
|
|
|
28
32
|
const lines = [];
|
|
29
33
|
lines.push(` name: ${quote(input.name)},`);
|
|
30
34
|
lines.push(` environment: ${quote(input.environment)},`);
|
|
35
|
+
lines.push(" appConfigurationRead: file.appConfigurationRead,");
|
|
36
|
+
lines.push(" firstProcessNodeAddresses: file.nodeAddresses,");
|
|
31
37
|
lines.push(" bundles: {");
|
|
32
38
|
for (const [id, bundle] of Object.entries(input.assembled.bundles)) lines.push(` ${quote(id)}: ${renderBundle(bundle)},`);
|
|
33
39
|
lines.push(" },");
|
|
@@ -41,15 +47,17 @@ function renderStackFile(input) {
|
|
|
41
47
|
const configImport = relativeImportSpecifier(generatedDir, input.configFile);
|
|
42
48
|
return `// Generated by Composer's deploy and destroy operations — overwritten on every
|
|
43
49
|
// run; do not edit by hand. Runnable from ${quote(input.cwd)} WITH the env the
|
|
44
|
-
// CLI passes its child (the PRISMA_COMPOSER_CONTAINER_*/_PREFLIGHT_* vars —
|
|
50
|
+
// CLI passes its child (the PRISMA_COMPOSER_CONTAINER_*/_PREFLIGHT_* vars and the app configuration file —
|
|
45
51
|
// without them lower() refuses because no container is resolved), by the
|
|
46
52
|
// command Composer starts, which a failed run prints:
|
|
47
53
|
//
|
|
48
54
|
// <node> <bin of the alchemy @prisma/composer depends on> deploy ${GENERATED_DIR}/${GENERATED_FILE} --yes --stage <stage>
|
|
49
55
|
//
|
|
50
56
|
// bisects a CLI bug from an Alchemy bug (deploy-cli.md § Implementation decisions).
|
|
57
|
+
// 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.
|
|
51
58
|
import { lower } from '@prisma/composer/deploy';
|
|
52
59
|
import * as report from '@prisma/composer/report';
|
|
60
|
+
import { readAppConfigurationFile } from '@prisma/composer/internal/app-configuration-file';
|
|
53
61
|
import prismaConfig from ${quote(configImport)};
|
|
54
62
|
import app from ${quote(appImport)};
|
|
55
63
|
|
|
@@ -61,6 +69,8 @@ if (config === undefined) {
|
|
|
61
69
|
// The app's own @prisma/composer may predate the failure recorder.
|
|
62
70
|
report.captureEngineFailure?.();
|
|
63
71
|
|
|
72
|
+
const file = readAppConfigurationFile(process.env);
|
|
73
|
+
|
|
64
74
|
export default lower(app, config, {
|
|
65
75
|
${renderOptions(input)}
|
|
66
76
|
});
|
|
@@ -147,7 +157,8 @@ async function executeDeploy(input, deps, cwd) {
|
|
|
147
157
|
deps,
|
|
148
158
|
reportId: input.reportId,
|
|
149
159
|
reportPath: resolveRunReportPath(input.reportPath, process.env[RUN_REPORT_FILE_ENV], cwd),
|
|
150
|
-
steps: deploySteps(input.onEvent)
|
|
160
|
+
steps: deploySteps(input.onEvent),
|
|
161
|
+
redaction: new SecretRedaction(process.env)
|
|
151
162
|
});
|
|
152
163
|
if (!outcome.ok) return outcome;
|
|
153
164
|
return ok({ summary: outcome.value });
|
|
@@ -163,7 +174,8 @@ async function executeDestroy(input, deps, cwd) {
|
|
|
163
174
|
deps,
|
|
164
175
|
reportId: void 0,
|
|
165
176
|
reportPath: void 0,
|
|
166
|
-
steps: deploySteps(void 0)
|
|
177
|
+
steps: deploySteps(void 0),
|
|
178
|
+
redaction: new SecretRedaction(process.env)
|
|
167
179
|
});
|
|
168
180
|
if (!outcome.ok) return outcome;
|
|
169
181
|
return okVoid();
|
|
@@ -174,7 +186,7 @@ async function executeDestroy(input, deps, cwd) {
|
|
|
174
186
|
* has not started, and refusing to run it because an observer failed would
|
|
175
187
|
* invert the relationship.
|
|
176
188
|
*/
|
|
177
|
-
async function beginReporters(extensions, context) {
|
|
189
|
+
async function beginReporters(extensions, context, redaction) {
|
|
178
190
|
return (await Promise.all(extensions.map(async (extension) => {
|
|
179
191
|
if (extension.reporter === void 0) return void 0;
|
|
180
192
|
try {
|
|
@@ -185,30 +197,30 @@ async function beginReporters(extensions, context) {
|
|
|
185
197
|
};
|
|
186
198
|
} catch (error) {
|
|
187
199
|
const detail = error instanceof Error ? error.message : String(error);
|
|
188
|
-
console.warn(`\nCould not start deploy reporting for ${extension.id}: ${detail}`);
|
|
200
|
+
console.warn(`\nCould not start deploy reporting for ${extension.id}: ${redaction.redact(detail)}`);
|
|
189
201
|
return;
|
|
190
202
|
}
|
|
191
203
|
}))).filter((entry) => entry !== void 0);
|
|
192
204
|
}
|
|
193
205
|
/** Hands each session its own extension's resolved container, so it can attach the run to what that container names. */
|
|
194
|
-
async function attachReporters(reporters, containers) {
|
|
206
|
+
async function attachReporters(reporters, containers, redaction) {
|
|
195
207
|
await Promise.all(reporters.map(async ({ extensionId, reporter }) => {
|
|
196
208
|
try {
|
|
197
209
|
await reporter.attach({ container: containers.get(extensionId) });
|
|
198
210
|
} catch (error) {
|
|
199
211
|
const detail = error instanceof Error ? error.message : String(error);
|
|
200
|
-
console.warn(`\nCould not attach this deploy to its project for ${extensionId}: ${detail}`);
|
|
212
|
+
console.warn(`\nCould not attach this deploy to its project for ${extensionId}: ${redaction.redact(detail)}`);
|
|
201
213
|
}
|
|
202
214
|
}));
|
|
203
215
|
}
|
|
204
216
|
/** Every session's contribution to the alchemy child's environment, so reporting that happens inside the apply can find the run. */
|
|
205
|
-
function reporterChildEnv(reporters) {
|
|
217
|
+
function reporterChildEnv(reporters, redaction) {
|
|
206
218
|
const env = {};
|
|
207
219
|
for (const { extensionId, reporter } of reporters) try {
|
|
208
220
|
Object.assign(env, reporter.childEnv());
|
|
209
221
|
} catch (error) {
|
|
210
222
|
const detail = error instanceof Error ? error.message : String(error);
|
|
211
|
-
console.warn(`\nCould not pass deploy reporting into the apply for ${extensionId}: ${detail}`);
|
|
223
|
+
console.warn(`\nCould not pass deploy reporting into the apply for ${extensionId}: ${redaction.redact(detail)}`);
|
|
212
224
|
}
|
|
213
225
|
return env;
|
|
214
226
|
}
|
|
@@ -226,7 +238,7 @@ function wasInterrupted(failure) {
|
|
|
226
238
|
* failure — so this swallows anyway, and reports each session independently
|
|
227
239
|
* so one bad implementation cannot silence another.
|
|
228
240
|
*/
|
|
229
|
-
async function finishReporters(reporters, outcome) {
|
|
241
|
+
async function finishReporters(reporters, outcome, redaction) {
|
|
230
242
|
const entities = outcome.summary?.nodes.flatMap((node) => node.entities) ?? [];
|
|
231
243
|
await Promise.all(reporters.map(async ({ reporter }) => {
|
|
232
244
|
try {
|
|
@@ -239,7 +251,7 @@ async function finishReporters(reporters, outcome) {
|
|
|
239
251
|
});
|
|
240
252
|
} catch (error) {
|
|
241
253
|
const detail = error instanceof Error ? error.message : String(error);
|
|
242
|
-
console.warn(`\nCould not report this deploy's outcome: ${detail}`);
|
|
254
|
+
console.warn(`\nCould not report this deploy's outcome: ${redaction.redact(detail)}`);
|
|
243
255
|
}
|
|
244
256
|
}));
|
|
245
257
|
}
|
|
@@ -258,15 +270,17 @@ async function runStackPipeline(action, opts) {
|
|
|
258
270
|
} catch (error) {
|
|
259
271
|
opts.steps.failOpen();
|
|
260
272
|
opts.steps.start({ name: "record" });
|
|
273
|
+
const thrown = redactThrown(error, opts.redaction);
|
|
261
274
|
await finishReporters(reporters, {
|
|
262
275
|
ok: false,
|
|
263
276
|
cancelled: false,
|
|
264
277
|
code: "DEPLOY.UNEXPECTED",
|
|
265
|
-
message:
|
|
266
|
-
});
|
|
278
|
+
message: thrown.message
|
|
279
|
+
}, opts.redaction);
|
|
267
280
|
opts.steps.finish({ name: "record" });
|
|
268
|
-
throw
|
|
281
|
+
throw thrown;
|
|
269
282
|
}
|
|
283
|
+
if (!outcome.ok) outcome = notOk(redactError(outcome.failure, opts.redaction));
|
|
270
284
|
if (!outcome.ok) opts.steps.failOpen();
|
|
271
285
|
opts.steps.start({ name: "record" });
|
|
272
286
|
await finishReporters(reporters, outcome.ok ? {
|
|
@@ -278,7 +292,7 @@ async function runStackPipeline(action, opts) {
|
|
|
278
292
|
cancelled: wasInterrupted(outcome.failure),
|
|
279
293
|
code: outcome.failure.code,
|
|
280
294
|
message: outcome.failure.message
|
|
281
|
-
});
|
|
295
|
+
}, opts.redaction);
|
|
282
296
|
if (opts.reportPath === void 0 || writeRunReport(opts.reportPath, toRunReport({
|
|
283
297
|
summary: outcome.ok ? outcome.value : void 0,
|
|
284
298
|
environment: opts.environment,
|
|
@@ -296,6 +310,7 @@ async function runStackPipeline(action, opts) {
|
|
|
296
310
|
async function runStackPipelineInner(action, opts, reporters) {
|
|
297
311
|
const { entry, config: composerConfig, name, environment, cwd, onEvent, deps, steps } = opts;
|
|
298
312
|
steps.start({ name: "prepare" });
|
|
313
|
+
removeLeftoverAppConfigurationFiles(cwd);
|
|
299
314
|
try {
|
|
300
315
|
validateEnvironmentName(environment);
|
|
301
316
|
} catch (error) {
|
|
@@ -314,6 +329,8 @@ async function runStackPipelineInner(action, opts, reporters) {
|
|
|
314
329
|
try {
|
|
315
330
|
pipeline = await runPipeline(entry, name, environment, cwd, composerConfig, {
|
|
316
331
|
runAssembler: deps.runAssembler,
|
|
332
|
+
readSecrets: action === "deploy",
|
|
333
|
+
redaction: opts.redaction,
|
|
317
334
|
onEvent: (event) => {
|
|
318
335
|
switch (event.kind) {
|
|
319
336
|
case "loaded":
|
|
@@ -350,7 +367,7 @@ async function runStackPipelineInner(action, opts, reporters) {
|
|
|
350
367
|
cwd,
|
|
351
368
|
reportId: opts.reportId,
|
|
352
369
|
credentials: deps.credentials
|
|
353
|
-
}));
|
|
370
|
+
}, opts.redaction));
|
|
354
371
|
containers = /* @__PURE__ */ new Map();
|
|
355
372
|
for (const extension of config.extensions) {
|
|
356
373
|
if (extension.container === void 0) continue;
|
|
@@ -375,7 +392,7 @@ async function runStackPipelineInner(action, opts, reporters) {
|
|
|
375
392
|
throw toStructured("DEPLOY.CONTAINER_FAILED", error);
|
|
376
393
|
}
|
|
377
394
|
}
|
|
378
|
-
await attachReporters(reporters, containers);
|
|
395
|
+
await attachReporters(reporters, containers, opts.redaction);
|
|
379
396
|
alchemyStage = containers.get(config.state.extension)?.alchemyStage ?? environment;
|
|
380
397
|
steps.finish({ name: "connect" });
|
|
381
398
|
if (action === "deploy") {
|
|
@@ -391,6 +408,8 @@ async function runStackPipelineInner(action, opts, reporters) {
|
|
|
391
408
|
graph,
|
|
392
409
|
container: containers.get(extension.id),
|
|
393
410
|
environment,
|
|
411
|
+
configuration: pipeline.configuration,
|
|
412
|
+
secrets: pipeline.secrets,
|
|
394
413
|
credentials: deps.credentials,
|
|
395
414
|
report
|
|
396
415
|
});
|
|
@@ -413,8 +432,16 @@ async function runStackPipelineInner(action, opts, reporters) {
|
|
|
413
432
|
}
|
|
414
433
|
let stackPath;
|
|
415
434
|
const resultFilePath = path$1.join(cwd, ".prisma-composer", `deployment-result-${String(process.pid)}-${randomUUID()}.json`);
|
|
435
|
+
let handover;
|
|
416
436
|
try {
|
|
417
437
|
try {
|
|
438
|
+
handover = prepareSecondProcess({
|
|
439
|
+
file: deployAppConfigurationFile(cwd, randomUUID()),
|
|
440
|
+
appConfigurationRead: pipeline.graph.appConfigurationRead,
|
|
441
|
+
nodeAddresses: nodeAddresses(pipeline.graph),
|
|
442
|
+
secretsKeys: secretsKeys(pipeline.graph),
|
|
443
|
+
knownSecrets: opts.redaction.knownSecrets
|
|
444
|
+
});
|
|
418
445
|
stackPath = writeStackFile({
|
|
419
446
|
entryPath: pipeline.entryModule.path,
|
|
420
447
|
cwd,
|
|
@@ -423,6 +450,7 @@ async function runStackPipelineInner(action, opts, reporters) {
|
|
|
423
450
|
environment,
|
|
424
451
|
assembled: pipeline.assembled
|
|
425
452
|
});
|
|
453
|
+
handover.writeFile();
|
|
426
454
|
} catch (error) {
|
|
427
455
|
return notOk(toStructured("DEPLOY.STACK_WRITE_FAILED", error));
|
|
428
456
|
}
|
|
@@ -434,9 +462,11 @@ async function runStackPipelineInner(action, opts, reporters) {
|
|
|
434
462
|
containerEnv: containerEnv(containers),
|
|
435
463
|
preflightEnv: preflightTransportEnv,
|
|
436
464
|
env: {
|
|
437
|
-
...reporterChildEnv(reporters),
|
|
465
|
+
...reporterChildEnv(reporters, opts.redaction),
|
|
466
|
+
...handover.env,
|
|
438
467
|
[DEPLOYMENT_RESULT_FILE_ENV]: resultFilePath
|
|
439
|
-
}
|
|
468
|
+
},
|
|
469
|
+
redactedValues: opts.redaction.allValues()
|
|
440
470
|
});
|
|
441
471
|
steps.start({ name: "apply" });
|
|
442
472
|
let outcome;
|
|
@@ -467,7 +497,7 @@ async function runStackPipelineInner(action, opts, reporters) {
|
|
|
467
497
|
} }));
|
|
468
498
|
const status = outcome.exitCode ?? 1;
|
|
469
499
|
if (status !== 0) {
|
|
470
|
-
const engineCause = readEngineFailureCause(resultFilePath);
|
|
500
|
+
const engineCause = readEngineFailureCause(resultFilePath, (text) => opts.redaction.redact(text));
|
|
471
501
|
const withCause = (sentence) => engineCause === void 0 ? sentence : `${sentence}\n${engineCause}`;
|
|
472
502
|
return notOk(new CliStructuredError("DEPLOY.ENGINE_FAILED", withCause(`alchemy ${action} exited with status ${status}.`), { meta: {
|
|
473
503
|
exitCode: status,
|
|
@@ -509,16 +539,17 @@ async function runStackPipelineInner(action, opts, reporters) {
|
|
|
509
539
|
if (CliStructuredError.is(error)) return notOk(error);
|
|
510
540
|
throw error;
|
|
511
541
|
}
|
|
512
|
-
if (action === "deploy") return ok(readDeploymentSummary(resultFilePath));
|
|
542
|
+
if (action === "deploy") return ok(redactSummary(readDeploymentSummary(resultFilePath), opts.redaction));
|
|
513
543
|
return ok(void 0);
|
|
514
544
|
} finally {
|
|
515
545
|
try {
|
|
516
546
|
fs$1.rmSync(resultFilePath, { force: true });
|
|
517
547
|
fs$1.rmSync(engineFailureFilePath(resultFilePath), { force: true });
|
|
518
548
|
} catch {}
|
|
549
|
+
handover?.removeFile();
|
|
519
550
|
}
|
|
520
551
|
}
|
|
521
552
|
//#endregion
|
|
522
553
|
export { executeDeploy, executeDestroy };
|
|
523
554
|
|
|
524
|
-
//# sourceMappingURL=execute-deploy-destroy-
|
|
555
|
+
//# sourceMappingURL=execute-deploy-destroy-C6EsdmLz-BO5xEJsJ.mjs.map
|