@prisma/composer 0.6.0-dev.1 → 0.6.0-dev.10
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-Cbv_lA38-BHJsd1DF.d.mts → app-config-CFsSXEVj-B242oUnm.d.mts} +4 -4
- package/dist/{app-config-Cbv_lA38-BHJsd1DF.d.mts.map → app-config-CFsSXEVj-B242oUnm.d.mts.map} +1 -1
- package/dist/bin.mjs +11 -3275
- package/dist/bin.mjs.map +1 -1
- package/dist/cli-B3sWzFlb-CxEIzKsQ.mjs +401 -0
- package/dist/cli-B3sWzFlb-CxEIzKsQ.mjs.map +1 -0
- package/dist/config-ku5b_2YD.d.mts +1 -0
- package/dist/config.d.mts +2 -2
- package/dist/container-transport-DKmKg5JQ-BMRhx5w-.mjs +75 -0
- package/dist/container-transport-DKmKg5JQ-BMRhx5w-.mjs.map +1 -0
- package/dist/control.d.mts +216 -0
- package/dist/control.d.mts.map +1 -0
- package/dist/control.mjs +70 -0
- package/dist/control.mjs.map +1 -0
- package/dist/deploy-ku5b_2YD.d.mts +1 -0
- package/dist/deploy.d.mts +2 -2
- package/dist/deploy.mjs +312 -1
- package/dist/deploy.mjs.map +1 -0
- package/dist/deployment-summary-r47O6kFr-CcMYVOn5.mjs +70 -0
- package/dist/deployment-summary-r47O6kFr-CcMYVOn5.mjs.map +1 -0
- package/dist/{dist-BdvFDCLV.mjs → dist-C5rZnr4n.mjs} +2 -2
- package/dist/{dist-BdvFDCLV.mjs.map → dist-C5rZnr4n.mjs.map} +1 -1
- package/dist/emulator-retry-DGonap4g-S8BNrXFD.mjs +24 -0
- package/dist/emulator-retry-DGonap4g-S8BNrXFD.mjs.map +1 -0
- package/dist/errors-0e8IVwzi.mjs +88 -0
- package/dist/errors-0e8IVwzi.mjs.map +1 -0
- package/dist/execute-deploy-destroy-IT4vGkMc-YM1Cv6cu.mjs +306 -0
- package/dist/execute-deploy-destroy-IT4vGkMc-YM1Cv6cu.mjs.map +1 -0
- package/dist/execute-deploy-destroy-IT4vGkMc-oO8yjHPH.mjs +265 -0
- package/dist/execute-deploy-destroy-IT4vGkMc-oO8yjHPH.mjs.map +1 -0
- package/dist/execute-dev-DLYyduEM-88uyvrbj.mjs +2009 -0
- package/dist/execute-dev-DLYyduEM-88uyvrbj.mjs.map +1 -0
- package/dist/execute-dev-DLYyduEM-BuUGTm0g.mjs +2006 -0
- package/dist/execute-dev-DLYyduEM-BuUGTm0g.mjs.map +1 -0
- package/dist/execute-log-VIOL4DBz-DBPH8By4.mjs +157 -0
- package/dist/execute-log-VIOL4DBz-DBPH8By4.mjs.map +1 -0
- package/dist/execute-log-VIOL4DBz-DKodBrxS.mjs +155 -0
- package/dist/execute-log-VIOL4DBz-DKodBrxS.mjs.map +1 -0
- package/dist/{graph-DgbALPDo-BEHF94BN.mjs → graph-BJgUfGB0-kvgFzT4q.mjs} +13 -7
- package/dist/graph-BJgUfGB0-kvgFzT4q.mjs.map +1 -0
- package/dist/{graph-DDpXh7S8-b-93BcHn.d.mts → graph-DqklX5Sf-BNS2aO1j.d.mts} +3 -3
- package/dist/graph-DqklX5Sf-BNS2aO1j.d.mts.map +1 -0
- package/dist/{graph-types-C3FOaaXm-C6_rGzfn.d.mts → graph-types-N6brq1zY-1VMNwtkJ.d.mts} +88 -5
- package/dist/graph-types-N6brq1zY-1VMNwtkJ.d.mts.map +1 -0
- package/dist/{index-BQVrMGfe.d.mts → index-DryPyF9U.d.mts} +3 -3
- package/dist/{index-BQVrMGfe.d.mts.map → index-DryPyF9U.d.mts.map} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/internal-error-BIc-ehme-Ck_lgxD_.mjs +18 -0
- package/dist/internal-error-BIc-ehme-Ck_lgxD_.mjs.map +1 -0
- package/dist/local-target-DnA2E8IN.mjs +47 -0
- package/dist/local-target-DnA2E8IN.mjs.map +1 -0
- package/dist/local-target-DuSyWeYc.mjs +68 -0
- package/dist/local-target-DuSyWeYc.mjs.map +1 -0
- package/dist/local-target.d.mts +1 -1
- package/dist/local-target.mjs +2 -46
- package/dist/{nextjs-DLyeRR7M-D47aMmfr.d.mts → nextjs-DLyeRR7M-DZODs9tk.d.mts} +3 -3
- package/dist/{nextjs-DLyeRR7M-D47aMmfr.d.mts.map → nextjs-DLyeRR7M-DZODs9tk.d.mts.map} +1 -1
- package/dist/nextjs-control.d.mts +4 -4
- package/dist/nextjs.d.mts +1 -1
- package/dist/node-control.d.mts +3 -3
- package/dist/node.d.mts +2 -2
- package/dist/pipeline-D3QoVzAB-Ci2aJ2mE.mjs +331 -0
- package/dist/pipeline-D3QoVzAB-Ci2aJ2mE.mjs.map +1 -0
- package/dist/pipeline-D3QoVzAB-D_ufjg3N.mjs +857 -0
- package/dist/pipeline-D3QoVzAB-D_ufjg3N.mjs.map +1 -0
- package/dist/render-error-DsPN5qfr-CkVGj9uP.mjs +30 -0
- package/dist/render-error-DsPN5qfr-CkVGj9uP.mjs.map +1 -0
- package/dist/report.d.mts +4 -3
- package/dist/report.d.mts.map +1 -1
- package/dist/report.mjs +4 -1
- package/dist/report.mjs.map +1 -1
- package/dist/result-CFqJKiqg.mjs +106 -0
- package/dist/result-CFqJKiqg.mjs.map +1 -0
- package/dist/result-CzGChwbZ.mjs +231 -0
- package/dist/result-CzGChwbZ.mjs.map +1 -0
- package/dist/run-alchemy-hghRtddF-CQHOzlrW.mjs +48 -0
- package/dist/run-alchemy-hghRtddF-CQHOzlrW.mjs.map +1 -0
- package/dist/service-rpc.d.mts +2 -2
- package/dist/service-rpc.mjs +2 -2
- package/dist/shared-CCaR42wo-BvegvmA_.mjs +265 -0
- package/dist/shared-CCaR42wo-BvegvmA_.mjs.map +1 -0
- package/dist/testing.d.mts +1 -1
- package/package.json +15 -15
- package/src/exports/control.ts +1 -0
- package/dist/config-whuqZ5xT.d.mts +0 -1
- package/dist/deploy-C4DxNkJ9-D73lmBqy.mjs +0 -313
- package/dist/deploy-C4DxNkJ9-D73lmBqy.mjs.map +0 -1
- package/dist/deploy-whuqZ5xT.d.mts +0 -1
- package/dist/graph-DDpXh7S8-b-93BcHn.d.mts.map +0 -1
- package/dist/graph-DgbALPDo-BEHF94BN.mjs.map +0 -1
- package/dist/graph-types-C3FOaaXm-C6_rGzfn.d.mts.map +0 -1
- package/dist/local-target.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as BuildAdapter } from "./graph-types-
|
|
2
|
-
import "./index-
|
|
1
|
+
import { t as BuildAdapter } from "./graph-types-N6brq1zY-1VMNwtkJ.mjs";
|
|
2
|
+
import "./index-DryPyF9U.mjs";
|
|
3
3
|
//#region ../../0-framework/2-authoring/nextjs/dist/nextjs-DLyeRR7M.d.mts
|
|
4
4
|
//#region src/nextjs.d.ts
|
|
5
5
|
/** The nextjs build adapter's descriptor — `appDir` is this kind's own extra path input (the Next app root), beyond the shared `{ extension, type, module, entry }`. `entry` is a placeholder; the assembler locates `server.js` in the standalone tree. */
|
|
@@ -13,4 +13,4 @@ declare const nextjsBuild: (opts: {
|
|
|
13
13
|
}) => NextjsBuildAdapter;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { nextjsBuild as n, NextjsBuildAdapter as t };
|
|
16
|
-
//# sourceMappingURL=nextjs-DLyeRR7M-
|
|
16
|
+
//# sourceMappingURL=nextjs-DLyeRR7M-DZODs9tk.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextjs-DLyeRR7M-
|
|
1
|
+
{"version":3,"file":"nextjs-DLyeRR7M-DZODs9tk.d.mts","names":[],"sources":["../../../0-framework/2-authoring/nextjs/dist/nextjs-DLyeRR7M.d.mts"],"mappings":";;;;;UAGU,2BAA2B;WAC1B;WACA;;cAEG,cAAc;EAC1B;EACA;MACI"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as Bundle, f as ExtensionDescriptor, i as AssembleInput } from "./app-config-
|
|
2
|
-
import "./config-
|
|
3
|
-
import "./deploy-
|
|
4
|
-
import { t as NextjsBuildAdapter } from "./nextjs-DLyeRR7M-
|
|
1
|
+
import { a as Bundle, f as ExtensionDescriptor, i as AssembleInput } from "./app-config-CFsSXEVj-B242oUnm.mjs";
|
|
2
|
+
import "./config-ku5b_2YD.mjs";
|
|
3
|
+
import "./deploy-ku5b_2YD.mjs";
|
|
4
|
+
import { t as NextjsBuildAdapter } from "./nextjs-DLyeRR7M-DZODs9tk.mjs";
|
|
5
5
|
//#region ../../0-framework/2-authoring/nextjs/dist/control.d.mts
|
|
6
6
|
//#region src/control/build.d.ts
|
|
7
7
|
/** The built standalone server.js for a nextjs build — `appDir`'s standalone root plus the app subpath Next recorded. Single-sourced so `assemble()` (deploy) and the integration-test seam can't drift. */
|
package/dist/nextjs.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as nextjsBuild, t as NextjsBuildAdapter } from "./nextjs-DLyeRR7M-
|
|
1
|
+
import { n as nextjsBuild, t as NextjsBuildAdapter } from "./nextjs-DLyeRR7M-DZODs9tk.mjs";
|
|
2
2
|
export { type NextjsBuildAdapter, nextjsBuild as default };
|
package/dist/node-control.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as Bundle, f as ExtensionDescriptor, i as AssembleInput } from "./app-config-
|
|
2
|
-
import "./config-
|
|
3
|
-
import "./deploy-
|
|
1
|
+
import { a as Bundle, f as ExtensionDescriptor, i as AssembleInput } from "./app-config-CFsSXEVj-B242oUnm.mjs";
|
|
2
|
+
import "./config-ku5b_2YD.mjs";
|
|
3
|
+
import "./deploy-ku5b_2YD.mjs";
|
|
4
4
|
//#region ../../0-framework/2-authoring/node/dist/control.d.mts
|
|
5
5
|
//#region src/control/build.d.ts
|
|
6
6
|
declare function assemble(input: AssembleInput): Promise<Bundle>;
|
package/dist/node.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as BuildAdapter } from "./graph-types-
|
|
2
|
-
import "./index-
|
|
1
|
+
import { t as BuildAdapter } from "./graph-types-N6brq1zY-1VMNwtkJ.mjs";
|
|
2
|
+
import "./index-DryPyF9U.mjs";
|
|
3
3
|
//#region ../../0-framework/2-authoring/node/dist/index.d.mts
|
|
4
4
|
//#region src/node.d.ts
|
|
5
5
|
/** The node build adapter's descriptor. `dir` is the directory form's own extra path input (the built tree to copy verbatim), beyond the shared `{ extension, type, module, entry }`; absent, `entry` is the whole built runnable. */
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
|
|
2
|
+
import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
|
|
3
|
+
import { o as isNode, t as Load } from "./graph-BJgUfGB0-kvgFzT4q.mjs";
|
|
4
|
+
import "./dist-C5rZnr4n.mjs";
|
|
5
|
+
import * as fs from "node:fs";
|
|
6
|
+
import * as path from "node:path";
|
|
7
|
+
import { pathToFileURL } from "node:url";
|
|
8
|
+
import * as c12 from "c12";
|
|
9
|
+
//#region ../../0-framework/3-tooling/cli/dist/load-entry-ZpkCjTxj.mjs
|
|
10
|
+
/**
|
|
11
|
+
* `loadEntry` imports a user's topology with the host runtime's own module
|
|
12
|
+
* loader — under node (the CLI's shebang runtime), that loader strips
|
|
13
|
+
* TypeScript types but has no JSX transform (ADR-0005: the framework
|
|
14
|
+
* doesn't bundle or transform the app's code; deploy loading is no
|
|
15
|
+
* exception). A `.tsx`/`.jsx` file anywhere in the topology's import graph
|
|
16
|
+
* dies with node's raw `ERR_UNKNOWN_FILE_EXTENSION`, which names the file
|
|
17
|
+
* but not the cause or the fix. This turns that one case into structured
|
|
18
|
+
* error parts (summary/why/fix) that do — every other load failure (syntax
|
|
19
|
+
* errors, missing files, non-JSX unknown extensions) is untouched.
|
|
20
|
+
*/
|
|
21
|
+
const UNKNOWN_EXTENSION_CODE = "ERR_UNKNOWN_FILE_EXTENSION";
|
|
22
|
+
const JSX_EXTENSIONS = [".tsx", ".jsx"];
|
|
23
|
+
function errorCode(error) {
|
|
24
|
+
return "code" in error && typeof error.code === "string" ? error.code : void 0;
|
|
25
|
+
}
|
|
26
|
+
function unknownExtensionPath(error) {
|
|
27
|
+
if (!(error instanceof Error)) return void 0;
|
|
28
|
+
if (errorCode(error) !== UNKNOWN_EXTENSION_CODE) return void 0;
|
|
29
|
+
return /Unknown file extension "\.\w+" for (.+)$/.exec(error.message)?.[1];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns structured error parts when `error` is node's
|
|
33
|
+
* `ERR_UNKNOWN_FILE_EXTENSION` for a `.tsx`/`.jsx` file — `undefined` for
|
|
34
|
+
* every other error (including unknown-extension failures for some other
|
|
35
|
+
* extension), so the caller can fall through to its normal rethrow.
|
|
36
|
+
*/
|
|
37
|
+
function explainJsxLoadError(error, entryPath) {
|
|
38
|
+
const offendingPath = unknownExtensionPath(error);
|
|
39
|
+
if (offendingPath === void 0) return void 0;
|
|
40
|
+
if (!JSX_EXTENSIONS.some((ext) => offendingPath.endsWith(ext))) return void 0;
|
|
41
|
+
return {
|
|
42
|
+
summary: `"${offendingPath}" can't be loaded.`,
|
|
43
|
+
why: `deploy loads "${entryPath}"'s topology with node's own module loader, which strips TypeScript types but has no JSX transform — so a .tsx/.jsx file can't sit anywhere in that import graph.`,
|
|
44
|
+
fix: "Precompile that file in your own build (transform the JSX away, keep the real npm packages external) and import the compiled output instead of the raw .tsx/.jsx — see examples/email/scripts/build.ts in the prisma/composer repo for a worked example."
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Pipeline step 1 (deploy-cli.md § The pipeline): import the entry module
|
|
49
|
+
* (resolved against cwd) and require its default export to be a node — a
|
|
50
|
+
* service or module, branded by core's factories. Whatever this module exports
|
|
51
|
+
* IS the application; nothing else marks a root (ADR-0003).
|
|
52
|
+
*/
|
|
53
|
+
async function loadEntry(entryArg, cwd) {
|
|
54
|
+
const resolvedPath = path.resolve(cwd, entryArg);
|
|
55
|
+
let mod;
|
|
56
|
+
try {
|
|
57
|
+
mod = await import(pathToFileURL(resolvedPath).href);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
const explained = explainJsxLoadError(error, resolvedPath);
|
|
60
|
+
if (explained !== void 0) throw new CliStructuredError("COMPOSE.ENTRY_UNLOADABLE", explained.summary, {
|
|
61
|
+
why: explained.why,
|
|
62
|
+
fix: explained.fix,
|
|
63
|
+
where: { path: resolvedPath },
|
|
64
|
+
cause: error
|
|
65
|
+
});
|
|
66
|
+
throw new CliStructuredError("COMPOSE.ENTRY_UNLOADABLE", `Failed to import entry module "${resolvedPath}": ${error instanceof Error ? error.message : String(error)}`, {
|
|
67
|
+
where: { path: resolvedPath },
|
|
68
|
+
cause: error
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const root = blindCast(mod).default;
|
|
72
|
+
if (!isNode(root) || root.kind === "dependency" || root.kind === "resource") throw new CliStructuredError("COMPOSE.ENTRY_EXPORT_INVALID", `Entry module "${resolvedPath}" must default-export a node (a service or a module).`, {
|
|
73
|
+
fix: "Construct it with service() or module() from @prisma/composer.",
|
|
74
|
+
where: { path: resolvedPath }
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
path: resolvedPath,
|
|
78
|
+
root: blindCast(root)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region ../../0-framework/3-tooling/assemble/dist/index.mjs
|
|
83
|
+
/**
|
|
84
|
+
* A user-facing assembly failure, structured at origin (base-type rule 6):
|
|
85
|
+
* a `CliStructuredError` whose code names which way assembly went wrong.
|
|
86
|
+
* This package's second consumer is the programmatic deploy API, not just
|
|
87
|
+
* the CLI — hosts branch on `error.code`, the CLI renders the envelope.
|
|
88
|
+
*/
|
|
89
|
+
var AssembleError = class extends CliStructuredError {
|
|
90
|
+
constructor(code, summary, options) {
|
|
91
|
+
super(code, summary, options);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* The registry route for one service's build: extension by
|
|
96
|
+
* `build.extension`, node descriptor by `build.type`, kind must be "build".
|
|
97
|
+
* The CLI's coverage validation reports the same misses earlier with the
|
|
98
|
+
* config fix; these errors are the backstop for programmatic callers.
|
|
99
|
+
*/
|
|
100
|
+
function buildDescriptorAssemble(config, node, address, cwd) {
|
|
101
|
+
const { extension, type } = node.build;
|
|
102
|
+
const extensionDescriptor = config.extensions.find((candidate) => candidate.id === extension);
|
|
103
|
+
if (extensionDescriptor === void 0) throw new AssembleError("ASSEMBLE.EXTENSION_MISSING", `No extension "${extension}" is configured (needed by service "${node.name}"'s build).`, { fix: "Add it to prisma-composer.config.ts's `extensions`." });
|
|
104
|
+
const nodeDescriptor = extensionDescriptor.nodes[type];
|
|
105
|
+
if (nodeDescriptor === void 0) throw new AssembleError("ASSEMBLE.DESCRIPTOR_MISSING", `Extension "${extension}" has no descriptor for build type "${type}".`, { why: `Known types: ${Object.keys(extensionDescriptor.nodes).join(", ")}.` });
|
|
106
|
+
if (nodeDescriptor.kind !== "build") throw new AssembleError("ASSEMBLE.DESCRIPTOR_KIND_MISMATCH", `Extension "${extension}"'s descriptor for type "${type}" is a "${nodeDescriptor.kind}" descriptor.`, { why: "Assembling a service build needs a \"build\" descriptor." });
|
|
107
|
+
return nodeDescriptor.assemble({
|
|
108
|
+
build: node.build,
|
|
109
|
+
address,
|
|
110
|
+
cwd
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
async function assembleServices(graph, config, cwd, run) {
|
|
114
|
+
const runAssembler = run ?? ((node, address, nodeCwd) => buildDescriptorAssemble(config, node, address, nodeCwd));
|
|
115
|
+
const serviceNodes = graph.nodes.filter((n) => n.node.kind === "service");
|
|
116
|
+
if (serviceNodes.length === 0) throw new AssembleError("ASSEMBLE.SERVICE_MISSING", "The loaded graph has no service to assemble.");
|
|
117
|
+
const bundles = {};
|
|
118
|
+
for (const { id, node } of serviceNodes) try {
|
|
119
|
+
bundles[id] = await runAssembler(node, id, cwd);
|
|
120
|
+
} catch (error) {
|
|
121
|
+
if (CliStructuredError.is(error)) throw error;
|
|
122
|
+
throw new AssembleError("ASSEMBLE.BUILD_FAILED", error instanceof Error ? error.message : String(error), {
|
|
123
|
+
meta: { address: id },
|
|
124
|
+
cause: error
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
return { bundles };
|
|
128
|
+
}
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region ../../0-framework/3-tooling/cli/dist/pipeline-D3QoVzAB.mjs
|
|
131
|
+
/**
|
|
132
|
+
* Pipeline step: find and load `prisma-composer.config.ts` (ADR-0017) — the ONE
|
|
133
|
+
* file that imports control-plane code. Discovery is the standard walk-up
|
|
134
|
+
* from the deploy entry's directory (mirrors prisma-next's config-loader);
|
|
135
|
+
* loading is c12 with that explicit path (rc/global/package.json lookups
|
|
136
|
+
* disabled), so the config file's own static imports resolve from the app
|
|
137
|
+
* root by whatever package manager runs — no specifier construction, no
|
|
138
|
+
* anchoring. The loaded shape is validated field-by-field with structured
|
|
139
|
+
* errors naming the field.
|
|
140
|
+
*/
|
|
141
|
+
const CONFIG_FILENAME = "prisma-composer.config.ts";
|
|
142
|
+
/** Walks UP from the entry file's directory looking for the literal CONFIG_FILENAME; undefined when the walk hits the filesystem root. */
|
|
143
|
+
function findConfigPathForEntry(entryPath) {
|
|
144
|
+
let current = path.dirname(path.resolve(entryPath));
|
|
145
|
+
while (true) {
|
|
146
|
+
const candidate = path.join(current, CONFIG_FILENAME);
|
|
147
|
+
if (fs.existsSync(candidate)) return candidate;
|
|
148
|
+
const parent = path.dirname(current);
|
|
149
|
+
if (parent === current) return void 0;
|
|
150
|
+
current = parent;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function missingConfigError(entryPath) {
|
|
154
|
+
const searchedFrom = path.dirname(path.resolve(entryPath));
|
|
155
|
+
return new CliStructuredError("CONFIG.FILE_MISSING", `No ${CONFIG_FILENAME} found walking up from "${searchedFrom}".`, {
|
|
156
|
+
why: "The deploy needs the app's config file.",
|
|
157
|
+
fix: "Create one next to (or above) the entry, default-exporting defineConfig({ extensions: [...], state: ... }) from '@prisma/composer/config'.",
|
|
158
|
+
where: { path: searchedFrom }
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
function fieldError(field, requirement) {
|
|
162
|
+
return new CliStructuredError("CONFIG.FIELD_INVALID", `${CONFIG_FILENAME}: \`${field}\` ${requirement}.`, {
|
|
163
|
+
fix: "See defineConfig() in '@prisma/composer/config'.",
|
|
164
|
+
meta: { field }
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function isRecord(value) {
|
|
168
|
+
return typeof value === "object" && value !== null;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Field-by-field validation of the loaded default export — deliberately no
|
|
172
|
+
* schema library: each check is a structured error naming the offending field.
|
|
173
|
+
* Returns the same object, typed.
|
|
174
|
+
*/
|
|
175
|
+
function validateConfigShape(loaded, configPath) {
|
|
176
|
+
if (!isRecord(loaded) || Object.keys(loaded).length === 0) throw new CliStructuredError("CONFIG.EXPORT_INVALID", `"${configPath}" exported no config.`, {
|
|
177
|
+
fix: "It must default-export defineConfig({ extensions: [...], state: ... }) from '@prisma/composer/config'.",
|
|
178
|
+
where: { path: configPath }
|
|
179
|
+
});
|
|
180
|
+
const extensions = loaded["extensions"];
|
|
181
|
+
if (!Array.isArray(extensions)) throw fieldError("extensions", "must be an array");
|
|
182
|
+
const seen = /* @__PURE__ */ new Set();
|
|
183
|
+
for (const [index, entry] of extensions.entries()) {
|
|
184
|
+
if (!isRecord(entry)) throw fieldError(`extensions[${index}]`, "must be an extension descriptor object");
|
|
185
|
+
const id = entry["id"];
|
|
186
|
+
if (typeof id !== "string" || id.length === 0) throw fieldError(`extensions[${index}].id`, "must be a non-empty string (the extension package name)");
|
|
187
|
+
if (!isRecord(entry["nodes"])) throw fieldError(`extensions[${index}].nodes`, "must be an object (the node-ID → control registry)");
|
|
188
|
+
if (seen.has(id)) throw new CliStructuredError("CONFIG.EXTENSION_DUPLICATE", `${CONFIG_FILENAME}: extension "${id}" is listed more than once in \`extensions\`.`);
|
|
189
|
+
seen.add(id);
|
|
190
|
+
}
|
|
191
|
+
const state = loaded["state"];
|
|
192
|
+
if (!isRecord(state) || typeof state["extension"] !== "string" || typeof state["create"] !== "function") throw fieldError("state", "must be a state descriptor (e.g. prismaState())");
|
|
193
|
+
return blindCast(loaded);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Loads + validates the config at `configPath` via c12 (explicit file; rc /
|
|
197
|
+
* global-rc / package.json lookups disabled — discovery already happened in
|
|
198
|
+
* findConfigPathForEntry).
|
|
199
|
+
*/
|
|
200
|
+
async function loadAppConfig(configPath) {
|
|
201
|
+
let result;
|
|
202
|
+
try {
|
|
203
|
+
result = await c12.loadConfig({
|
|
204
|
+
name: "prisma-composer",
|
|
205
|
+
configFile: configPath,
|
|
206
|
+
cwd: path.dirname(configPath),
|
|
207
|
+
rcFile: false,
|
|
208
|
+
globalRc: false,
|
|
209
|
+
packageJson: false
|
|
210
|
+
});
|
|
211
|
+
} catch (error) {
|
|
212
|
+
throw new CliStructuredError("CONFIG.EVALUATION_FAILED", `Evaluating "${configPath}" failed: ${error instanceof Error ? error.message : String(error)}`, {
|
|
213
|
+
where: { path: configPath },
|
|
214
|
+
cause: error
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
const loadedFile = result.configFile;
|
|
218
|
+
if (typeof loadedFile !== "string" || fs.realpathSync(loadedFile) !== fs.realpathSync(configPath)) throw new CliStructuredError("CONFIG.PATH_MISMATCH", `Config loading resolved "${String(loadedFile)}" instead of the discovered "${configPath}".`, {
|
|
219
|
+
why: "Refusing to deploy against a different file.",
|
|
220
|
+
where: { path: configPath }
|
|
221
|
+
});
|
|
222
|
+
return {
|
|
223
|
+
path: configPath,
|
|
224
|
+
config: validateConfigShape(result.config, configPath)
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
function lookup(extensions, extension, type, expectedKind, what) {
|
|
228
|
+
const ext = extensions.get(extension);
|
|
229
|
+
if (ext === void 0) throw new CliStructuredError("CONFIG.EXTENSION_MISSING", `No extension "${extension}" is configured (needed by ${what}).`, {
|
|
230
|
+
fix: `Add it to ${CONFIG_FILENAME}'s \`extensions\` (import its /control entry and list its descriptor).`,
|
|
231
|
+
meta: {
|
|
232
|
+
extension,
|
|
233
|
+
type
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
const descriptor = ext.nodes[type];
|
|
237
|
+
if (descriptor === void 0) throw new CliStructuredError("CONFIG.DESCRIPTOR_MISSING", `Extension "${extension}" has no descriptor for node type "${type}" (needed by ${what}).`, {
|
|
238
|
+
why: `Known types: ${Object.keys(ext.nodes).join(", ")}.`,
|
|
239
|
+
meta: {
|
|
240
|
+
extension,
|
|
241
|
+
type
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
if (descriptor.kind !== expectedKind) throw new CliStructuredError("CONFIG.DESCRIPTOR_KIND_MISMATCH", `Extension "${extension}"'s descriptor for node type "${type}" is a "${descriptor.kind}" descriptor — ${what} needs a "${expectedKind}" descriptor.`, { meta: {
|
|
245
|
+
extension,
|
|
246
|
+
type,
|
|
247
|
+
kind: descriptor.kind
|
|
248
|
+
} });
|
|
249
|
+
}
|
|
250
|
+
/** Throws a structured CONFIG.* error on the first uncovered `(extension, type)`; silent when the config covers the whole graph. */
|
|
251
|
+
function validateRegistryCoverage(graph, config) {
|
|
252
|
+
const extensions = new Map(config.extensions.map((descriptor) => [descriptor.id, descriptor]));
|
|
253
|
+
for (const { id, node } of graph.nodes) {
|
|
254
|
+
if (node.kind === "resource") {
|
|
255
|
+
lookup(extensions, node.extension, node.type, "resource", `resource node "${id}"`);
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
if (node.kind !== "service") continue;
|
|
259
|
+
lookup(extensions, node.extension, node.type, "service", `service node "${id}"`);
|
|
260
|
+
lookup(extensions, node.build.extension, node.build.type, "build", `service node "${id}"'s build descriptor`);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* The shared prefix of `deploy`/`destroy`/`dev` (deploy-cli.md § The
|
|
265
|
+
* pipeline; local-dev spec § 6): config discovery/load, entry load, Load,
|
|
266
|
+
* registry coverage validation, name resolution, assemble. Deploy and dev
|
|
267
|
+
* diverge after this — deploy resolves containers/preflight/stack file
|
|
268
|
+
* against the hosted providers, dev against the local ones — so everything
|
|
269
|
+
* up to and including assemble lives here once, consumed verbatim by both
|
|
270
|
+
* `run()` (main.ts) and `runDev()` (dev/run-dev.ts), so the two pipelines
|
|
271
|
+
* cannot drift.
|
|
272
|
+
*/
|
|
273
|
+
/**
|
|
274
|
+
* The pipeline's front — config discovery/load, entry load, name resolution —
|
|
275
|
+
* WITHOUT Load, coverage, or assemble. `log` needs only who the app is (its
|
|
276
|
+
* config and resolved name) to reach the already-running local instance; it
|
|
277
|
+
* neither builds nor provisions, so it must not require the user's built
|
|
278
|
+
* output the way the full pipeline does.
|
|
279
|
+
*/
|
|
280
|
+
async function resolveAppIdentity(entry, overrideName, cwd, deps = {}) {
|
|
281
|
+
const resolvedEntryPath = path.resolve(cwd, entry);
|
|
282
|
+
const configPath = findConfigPathForEntry(resolvedEntryPath);
|
|
283
|
+
if (configPath === void 0) throw missingConfigError(resolvedEntryPath);
|
|
284
|
+
const config = deps.config ?? (await loadAppConfig(configPath)).config;
|
|
285
|
+
const entryModule = await loadEntry(entry, cwd);
|
|
286
|
+
const name = overrideName ?? entryModule.root.name;
|
|
287
|
+
if (name.length === 0) throw new CliStructuredError("COMPOSE.NAME_MISSING", "The root node has no name.", { fix: "Name it at authoring, or pass --name." });
|
|
288
|
+
return {
|
|
289
|
+
configPath,
|
|
290
|
+
config,
|
|
291
|
+
name
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Runs config discovery/load, entry load, Load, registry coverage, name
|
|
296
|
+
* resolution, and assemble — steps 1–6 of `run()`. `onAssembleError`, when
|
|
297
|
+
* given, lets a caller decorate an assemble failure with command-specific
|
|
298
|
+
* guidance (destroy's "build first" hint) without this shared step knowing
|
|
299
|
+
* about any one command.
|
|
300
|
+
*/
|
|
301
|
+
async function runPipeline(entry, overrideName, cwd, deps = {}, onAssembleError) {
|
|
302
|
+
const resolvedEntryPath = path.resolve(cwd, entry);
|
|
303
|
+
const configPath = findConfigPathForEntry(resolvedEntryPath);
|
|
304
|
+
if (configPath === void 0) throw missingConfigError(resolvedEntryPath);
|
|
305
|
+
const config = deps.config ?? (await loadAppConfig(configPath)).config;
|
|
306
|
+
const entryModule = await loadEntry(entry, cwd);
|
|
307
|
+
const graph = Load(entryModule.root);
|
|
308
|
+
if (graph.root.node.kind !== "module") throw new CliStructuredError("COMPOSE.ROOT_NOT_MODULE", "The deploy root must be a module.", { fix: "Wrap your service, e.g. export default module('name', ({ provision }) => { provision(service); })." });
|
|
309
|
+
validateRegistryCoverage(graph, config);
|
|
310
|
+
const name = overrideName ?? entryModule.root.name;
|
|
311
|
+
if (name.length === 0) throw new CliStructuredError("COMPOSE.NAME_MISSING", "The root node has no name.", { fix: "Name it at authoring, or pass --name." });
|
|
312
|
+
let assembled;
|
|
313
|
+
try {
|
|
314
|
+
assembled = await assembleServices(graph, config, cwd, deps.runAssembler);
|
|
315
|
+
} catch (error) {
|
|
316
|
+
if (onAssembleError !== void 0 && error instanceof Error) throw onAssembleError(error);
|
|
317
|
+
throw error;
|
|
318
|
+
}
|
|
319
|
+
return {
|
|
320
|
+
configPath,
|
|
321
|
+
config,
|
|
322
|
+
entryModule,
|
|
323
|
+
graph,
|
|
324
|
+
name,
|
|
325
|
+
assembled
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
//#endregion
|
|
329
|
+
export { runPipeline as n, resolveAppIdentity as t };
|
|
330
|
+
|
|
331
|
+
//# sourceMappingURL=pipeline-D3QoVzAB-Ci2aJ2mE.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-D3QoVzAB-Ci2aJ2mE.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/load-entry-ZpkCjTxj.mjs","../../../0-framework/3-tooling/assemble/dist/index.mjs","../../../0-framework/3-tooling/cli/dist/pipeline-D3QoVzAB.mjs"],"sourcesContent":["import { CliStructuredError } from \"@internal/foundation/errors\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport * as path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { isNode } from \"@internal/core\";\n//#region src/jsx-load-error.ts\n/**\n* `loadEntry` imports a user's topology with the host runtime's own module\n* loader — under node (the CLI's shebang runtime), that loader strips\n* TypeScript types but has no JSX transform (ADR-0005: the framework\n* doesn't bundle or transform the app's code; deploy loading is no\n* exception). A `.tsx`/`.jsx` file anywhere in the topology's import graph\n* dies with node's raw `ERR_UNKNOWN_FILE_EXTENSION`, which names the file\n* but not the cause or the fix. This turns that one case into structured\n* error parts (summary/why/fix) that do — every other load failure (syntax\n* errors, missing files, non-JSX unknown extensions) is untouched.\n*/\nconst UNKNOWN_EXTENSION_CODE = \"ERR_UNKNOWN_FILE_EXTENSION\";\nconst JSX_EXTENSIONS = [\".tsx\", \".jsx\"];\nfunction errorCode(error) {\n\treturn \"code\" in error && typeof error.code === \"string\" ? error.code : void 0;\n}\nfunction unknownExtensionPath(error) {\n\tif (!(error instanceof Error)) return void 0;\n\tif (errorCode(error) !== UNKNOWN_EXTENSION_CODE) return void 0;\n\treturn /Unknown file extension \"\\.\\w+\" for (.+)$/.exec(error.message)?.[1];\n}\n/**\n* Returns structured error parts when `error` is node's\n* `ERR_UNKNOWN_FILE_EXTENSION` for a `.tsx`/`.jsx` file — `undefined` for\n* every other error (including unknown-extension failures for some other\n* extension), so the caller can fall through to its normal rethrow.\n*/\nfunction explainJsxLoadError(error, entryPath) {\n\tconst offendingPath = unknownExtensionPath(error);\n\tif (offendingPath === void 0) return void 0;\n\tif (!JSX_EXTENSIONS.some((ext) => offendingPath.endsWith(ext))) return void 0;\n\treturn {\n\t\tsummary: `\"${offendingPath}\" can't be loaded.`,\n\t\twhy: `deploy loads \"${entryPath}\"'s topology with node's own module loader, which strips TypeScript types but has no JSX transform — so a .tsx/.jsx file can't sit anywhere in that import graph.`,\n\t\tfix: \"Precompile that file in your own build (transform the JSX away, keep the real npm packages external) and import the compiled output instead of the raw .tsx/.jsx — see examples/email/scripts/build.ts in the prisma/composer repo for a worked example.\"\n\t};\n}\n//#endregion\n//#region src/load-entry.ts\n/**\n* Pipeline step 1 (deploy-cli.md § The pipeline): import the entry module\n* (resolved against cwd) and require its default export to be a node — a\n* service or module, branded by core's factories. Whatever this module exports\n* IS the application; nothing else marks a root (ADR-0003).\n*/\nasync function loadEntry(entryArg, cwd) {\n\tconst resolvedPath = path.resolve(cwd, entryArg);\n\tlet mod;\n\ttry {\n\t\tmod = await import(pathToFileURL(resolvedPath).href);\n\t} catch (error) {\n\t\tconst explained = explainJsxLoadError(error, resolvedPath);\n\t\tif (explained !== void 0) throw new CliStructuredError(\"COMPOSE.ENTRY_UNLOADABLE\", explained.summary, {\n\t\t\twhy: explained.why,\n\t\t\tfix: explained.fix,\n\t\t\twhere: { path: resolvedPath },\n\t\t\tcause: error\n\t\t});\n\t\tthrow new CliStructuredError(\"COMPOSE.ENTRY_UNLOADABLE\", `Failed to import entry module \"${resolvedPath}\": ${error instanceof Error ? error.message : String(error)}`, {\n\t\t\twhere: { path: resolvedPath },\n\t\t\tcause: error\n\t\t});\n\t}\n\tconst root = blindCast(mod).default;\n\tif (!isNode(root) || root.kind === \"dependency\" || root.kind === \"resource\") throw new CliStructuredError(\"COMPOSE.ENTRY_EXPORT_INVALID\", `Entry module \"${resolvedPath}\" must default-export a node (a service or a module).`, {\n\t\tfix: \"Construct it with service() or module() from @prisma/composer.\",\n\t\twhere: { path: resolvedPath }\n\t});\n\treturn {\n\t\tpath: resolvedPath,\n\t\troot: blindCast(root)\n\t};\n}\n//#endregion\nexport { loadEntry as t };\n\n//# sourceMappingURL=load-entry-ZpkCjTxj.mjs.map","import { CliStructuredError } from \"@internal/foundation/errors\";\n//#region src/assemble-error.ts\n/**\n* A user-facing assembly failure, structured at origin (base-type rule 6):\n* a `CliStructuredError` whose code names which way assembly went wrong.\n* This package's second consumer is the programmatic deploy API, not just\n* the CLI — hosts branch on `error.code`, the CLI renders the envelope.\n*/\nvar AssembleError = class extends CliStructuredError {\n\tconstructor(code, summary, options) {\n\t\tsuper(code, summary, options);\n\t}\n};\n//#endregion\n//#region src/assemble-services.ts\n/**\n* The registry route for one service's build: extension by\n* `build.extension`, node descriptor by `build.type`, kind must be \"build\".\n* The CLI's coverage validation reports the same misses earlier with the\n* config fix; these errors are the backstop for programmatic callers.\n*/\nfunction buildDescriptorAssemble(config, node, address, cwd) {\n\tconst { extension, type } = node.build;\n\tconst extensionDescriptor = config.extensions.find((candidate) => candidate.id === extension);\n\tif (extensionDescriptor === void 0) throw new AssembleError(\"ASSEMBLE.EXTENSION_MISSING\", `No extension \"${extension}\" is configured (needed by service \"${node.name}\"'s build).`, { fix: \"Add it to prisma-composer.config.ts's `extensions`.\" });\n\tconst nodeDescriptor = extensionDescriptor.nodes[type];\n\tif (nodeDescriptor === void 0) throw new AssembleError(\"ASSEMBLE.DESCRIPTOR_MISSING\", `Extension \"${extension}\" has no descriptor for build type \"${type}\".`, { why: `Known types: ${Object.keys(extensionDescriptor.nodes).join(\", \")}.` });\n\tif (nodeDescriptor.kind !== \"build\") throw new AssembleError(\"ASSEMBLE.DESCRIPTOR_KIND_MISMATCH\", `Extension \"${extension}\"'s descriptor for type \"${type}\" is a \"${nodeDescriptor.kind}\" descriptor.`, { why: \"Assembling a service build needs a \\\"build\\\" descriptor.\" });\n\treturn nodeDescriptor.assemble({\n\t\tbuild: node.build,\n\t\taddress,\n\t\tcwd\n\t});\n}\nasync function assembleServices(graph, config, cwd, run) {\n\tconst runAssembler = run ?? ((node, address, nodeCwd) => buildDescriptorAssemble(config, node, address, nodeCwd));\n\tconst serviceNodes = graph.nodes.filter((n) => n.node.kind === \"service\");\n\tif (serviceNodes.length === 0) throw new AssembleError(\"ASSEMBLE.SERVICE_MISSING\", \"The loaded graph has no service to assemble.\");\n\tconst bundles = {};\n\tfor (const { id, node } of serviceNodes) try {\n\t\tbundles[id] = await runAssembler(node, id, cwd);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) throw error;\n\t\tthrow new AssembleError(\"ASSEMBLE.BUILD_FAILED\", error instanceof Error ? error.message : String(error), {\n\t\t\tmeta: { address: id },\n\t\t\tcause: error\n\t\t});\n\t}\n\treturn { bundles };\n}\n//#endregion\nexport { AssembleError, assembleServices };\n\n//# sourceMappingURL=index.mjs.map","import { t as loadEntry } from \"./load-entry-ZpkCjTxj.mjs\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { Load } from \"@internal/core\";\nimport { assembleServices } from \"@internal/assemble\";\nimport * as c12 from \"c12\";\n//#region src/load-config.ts\n/**\n* Pipeline step: find and load `prisma-composer.config.ts` (ADR-0017) — the ONE\n* file that imports control-plane code. Discovery is the standard walk-up\n* from the deploy entry's directory (mirrors prisma-next's config-loader);\n* loading is c12 with that explicit path (rc/global/package.json lookups\n* disabled), so the config file's own static imports resolve from the app\n* root by whatever package manager runs — no specifier construction, no\n* anchoring. The loaded shape is validated field-by-field with structured\n* errors naming the field.\n*/\nconst CONFIG_FILENAME = \"prisma-composer.config.ts\";\n/** Walks UP from the entry file's directory looking for the literal CONFIG_FILENAME; undefined when the walk hits the filesystem root. */\nfunction findConfigPathForEntry(entryPath) {\n\tlet current = path.dirname(path.resolve(entryPath));\n\twhile (true) {\n\t\tconst candidate = path.join(current, CONFIG_FILENAME);\n\t\tif (fs.existsSync(candidate)) return candidate;\n\t\tconst parent = path.dirname(current);\n\t\tif (parent === current) return void 0;\n\t\tcurrent = parent;\n\t}\n}\nfunction missingConfigError(entryPath) {\n\tconst searchedFrom = path.dirname(path.resolve(entryPath));\n\treturn new CliStructuredError(\"CONFIG.FILE_MISSING\", `No ${CONFIG_FILENAME} found walking up from \"${searchedFrom}\".`, {\n\t\twhy: \"The deploy needs the app's config file.\",\n\t\tfix: \"Create one next to (or above) the entry, default-exporting defineConfig({ extensions: [...], state: ... }) from '@prisma/composer/config'.\",\n\t\twhere: { path: searchedFrom }\n\t});\n}\nfunction fieldError(field, requirement) {\n\treturn new CliStructuredError(\"CONFIG.FIELD_INVALID\", `${CONFIG_FILENAME}: \\`${field}\\` ${requirement}.`, {\n\t\tfix: \"See defineConfig() in '@prisma/composer/config'.\",\n\t\tmeta: { field }\n\t});\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\n/**\n* Field-by-field validation of the loaded default export — deliberately no\n* schema library: each check is a structured error naming the offending field.\n* Returns the same object, typed.\n*/\nfunction validateConfigShape(loaded, configPath) {\n\tif (!isRecord(loaded) || Object.keys(loaded).length === 0) throw new CliStructuredError(\"CONFIG.EXPORT_INVALID\", `\"${configPath}\" exported no config.`, {\n\t\tfix: \"It must default-export defineConfig({ extensions: [...], state: ... }) from '@prisma/composer/config'.\",\n\t\twhere: { path: configPath }\n\t});\n\tconst extensions = loaded[\"extensions\"];\n\tif (!Array.isArray(extensions)) throw fieldError(\"extensions\", \"must be an array\");\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const [index, entry] of extensions.entries()) {\n\t\tif (!isRecord(entry)) throw fieldError(`extensions[${index}]`, \"must be an extension descriptor object\");\n\t\tconst id = entry[\"id\"];\n\t\tif (typeof id !== \"string\" || id.length === 0) throw fieldError(`extensions[${index}].id`, \"must be a non-empty string (the extension package name)\");\n\t\tif (!isRecord(entry[\"nodes\"])) throw fieldError(`extensions[${index}].nodes`, \"must be an object (the node-ID → control registry)\");\n\t\tif (seen.has(id)) throw new CliStructuredError(\"CONFIG.EXTENSION_DUPLICATE\", `${CONFIG_FILENAME}: extension \"${id}\" is listed more than once in \\`extensions\\`.`);\n\t\tseen.add(id);\n\t}\n\tconst state = loaded[\"state\"];\n\tif (!isRecord(state) || typeof state[\"extension\"] !== \"string\" || typeof state[\"create\"] !== \"function\") throw fieldError(\"state\", \"must be a state descriptor (e.g. prismaState())\");\n\treturn blindCast(loaded);\n}\n/**\n* Loads + validates the config at `configPath` via c12 (explicit file; rc /\n* global-rc / package.json lookups disabled — discovery already happened in\n* findConfigPathForEntry).\n*/\nasync function loadAppConfig(configPath) {\n\tlet result;\n\ttry {\n\t\tresult = await c12.loadConfig({\n\t\t\tname: \"prisma-composer\",\n\t\t\tconfigFile: configPath,\n\t\t\tcwd: path.dirname(configPath),\n\t\t\trcFile: false,\n\t\t\tglobalRc: false,\n\t\t\tpackageJson: false\n\t\t});\n\t} catch (error) {\n\t\tthrow new CliStructuredError(\"CONFIG.EVALUATION_FAILED\", `Evaluating \"${configPath}\" failed: ${error instanceof Error ? error.message : String(error)}`, {\n\t\t\twhere: { path: configPath },\n\t\t\tcause: error\n\t\t});\n\t}\n\tconst loadedFile = result.configFile;\n\tif (typeof loadedFile !== \"string\" || fs.realpathSync(loadedFile) !== fs.realpathSync(configPath)) throw new CliStructuredError(\"CONFIG.PATH_MISMATCH\", `Config loading resolved \"${String(loadedFile)}\" instead of the discovered \"${configPath}\".`, {\n\t\twhy: \"Refusing to deploy against a different file.\",\n\t\twhere: { path: configPath }\n\t});\n\treturn {\n\t\tpath: configPath,\n\t\tconfig: validateConfigShape(result.config, configPath)\n\t};\n}\n//#endregion\n//#region src/validate-coverage.ts\nfunction lookup(extensions, extension, type, expectedKind, what) {\n\tconst ext = extensions.get(extension);\n\tif (ext === void 0) throw new CliStructuredError(\"CONFIG.EXTENSION_MISSING\", `No extension \"${extension}\" is configured (needed by ${what}).`, {\n\t\tfix: `Add it to ${CONFIG_FILENAME}'s \\`extensions\\` (import its /control entry and list its descriptor).`,\n\t\tmeta: {\n\t\t\textension,\n\t\t\ttype\n\t\t}\n\t});\n\tconst descriptor = ext.nodes[type];\n\tif (descriptor === void 0) throw new CliStructuredError(\"CONFIG.DESCRIPTOR_MISSING\", `Extension \"${extension}\" has no descriptor for node type \"${type}\" (needed by ${what}).`, {\n\t\twhy: `Known types: ${Object.keys(ext.nodes).join(\", \")}.`,\n\t\tmeta: {\n\t\t\textension,\n\t\t\ttype\n\t\t}\n\t});\n\tif (descriptor.kind !== expectedKind) throw new CliStructuredError(\"CONFIG.DESCRIPTOR_KIND_MISMATCH\", `Extension \"${extension}\"'s descriptor for node type \"${type}\" is a \"${descriptor.kind}\" descriptor — ${what} needs a \"${expectedKind}\" descriptor.`, { meta: {\n\t\textension,\n\t\ttype,\n\t\tkind: descriptor.kind\n\t} });\n}\n/** Throws a structured CONFIG.* error on the first uncovered `(extension, type)`; silent when the config covers the whole graph. */\nfunction validateRegistryCoverage(graph, config) {\n\tconst extensions = new Map(config.extensions.map((descriptor) => [descriptor.id, descriptor]));\n\tfor (const { id, node } of graph.nodes) {\n\t\tif (node.kind === \"resource\") {\n\t\t\tlookup(extensions, node.extension, node.type, \"resource\", `resource node \"${id}\"`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (node.kind !== \"service\") continue;\n\t\tlookup(extensions, node.extension, node.type, \"service\", `service node \"${id}\"`);\n\t\tlookup(extensions, node.build.extension, node.build.type, \"build\", `service node \"${id}\"'s build descriptor`);\n\t}\n}\n//#endregion\n//#region src/pipeline.ts\n/**\n* The shared prefix of `deploy`/`destroy`/`dev` (deploy-cli.md § The\n* pipeline; local-dev spec § 6): config discovery/load, entry load, Load,\n* registry coverage validation, name resolution, assemble. Deploy and dev\n* diverge after this — deploy resolves containers/preflight/stack file\n* against the hosted providers, dev against the local ones — so everything\n* up to and including assemble lives here once, consumed verbatim by both\n* `run()` (main.ts) and `runDev()` (dev/run-dev.ts), so the two pipelines\n* cannot drift.\n*/\n/**\n* The pipeline's front — config discovery/load, entry load, name resolution —\n* WITHOUT Load, coverage, or assemble. `log` needs only who the app is (its\n* config and resolved name) to reach the already-running local instance; it\n* neither builds nor provisions, so it must not require the user's built\n* output the way the full pipeline does.\n*/\nasync function resolveAppIdentity(entry, overrideName, cwd, deps = {}) {\n\tconst resolvedEntryPath = path.resolve(cwd, entry);\n\tconst configPath = findConfigPathForEntry(resolvedEntryPath);\n\tif (configPath === void 0) throw missingConfigError(resolvedEntryPath);\n\tconst config = deps.config ?? (await loadAppConfig(configPath)).config;\n\tconst entryModule = await loadEntry(entry, cwd);\n\tconst name = overrideName ?? entryModule.root.name;\n\tif (name.length === 0) throw new CliStructuredError(\"COMPOSE.NAME_MISSING\", \"The root node has no name.\", { fix: \"Name it at authoring, or pass --name.\" });\n\treturn {\n\t\tconfigPath,\n\t\tconfig,\n\t\tname\n\t};\n}\n/**\n* Runs config discovery/load, entry load, Load, registry coverage, name\n* resolution, and assemble — steps 1–6 of `run()`. `onAssembleError`, when\n* given, lets a caller decorate an assemble failure with command-specific\n* guidance (destroy's \"build first\" hint) without this shared step knowing\n* about any one command.\n*/\nasync function runPipeline(entry, overrideName, cwd, deps = {}, onAssembleError) {\n\tconst resolvedEntryPath = path.resolve(cwd, entry);\n\tconst configPath = findConfigPathForEntry(resolvedEntryPath);\n\tif (configPath === void 0) throw missingConfigError(resolvedEntryPath);\n\tconst config = deps.config ?? (await loadAppConfig(configPath)).config;\n\tconst entryModule = await loadEntry(entry, cwd);\n\tconst graph = Load(entryModule.root);\n\tif (graph.root.node.kind !== \"module\") throw new CliStructuredError(\"COMPOSE.ROOT_NOT_MODULE\", \"The deploy root must be a module.\", { fix: \"Wrap your service, e.g. export default module('name', ({ provision }) => { provision(service); }).\" });\n\tvalidateRegistryCoverage(graph, config);\n\tconst name = overrideName ?? entryModule.root.name;\n\tif (name.length === 0) throw new CliStructuredError(\"COMPOSE.NAME_MISSING\", \"The root node has no name.\", { fix: \"Name it at authoring, or pass --name.\" });\n\tlet assembled;\n\ttry {\n\t\tassembled = await assembleServices(graph, config, cwd, deps.runAssembler);\n\t} catch (error) {\n\t\tif (onAssembleError !== void 0 && error instanceof Error) throw onAssembleError(error);\n\t\tthrow error;\n\t}\n\treturn {\n\t\tconfigPath,\n\t\tconfig,\n\t\tentryModule,\n\t\tgraph,\n\t\tname,\n\t\tassembled\n\t};\n}\n//#endregion\nexport { runPipeline as n, resolveAppIdentity as t };\n\n//# sourceMappingURL=pipeline-D3QoVzAB.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiBA,MAAM,yBAAyB;AAC/B,MAAM,iBAAiB,CAAC,QAAQ,MAAM;AACtC,SAAS,UAAU,OAAO;CACzB,OAAO,UAAU,SAAS,OAAO,MAAM,SAAS,WAAW,MAAM,OAAO,KAAK;AAC9E;AACA,SAAS,qBAAqB,OAAO;CACpC,IAAI,EAAE,iBAAiB,QAAQ,OAAO,KAAK;CAC3C,IAAI,UAAU,KAAK,MAAM,wBAAwB,OAAO,KAAK;CAC7D,OAAO,2CAA2C,KAAK,MAAM,OAAO,CAAC,GAAG;AACzE;;;;;;;AAOA,SAAS,oBAAoB,OAAO,WAAW;CAC9C,MAAM,gBAAgB,qBAAqB,KAAK;CAChD,IAAI,kBAAkB,KAAK,GAAG,OAAO,KAAK;CAC1C,IAAI,CAAC,eAAe,MAAM,QAAQ,cAAc,SAAS,GAAG,CAAC,GAAG,OAAO,KAAK;CAC5E,OAAO;EACN,SAAS,IAAI,cAAc;EAC3B,KAAK,iBAAiB,UAAU;EAChC,KAAK;CACN;AACD;;;;;;;AASA,eAAe,UAAU,UAAU,KAAK;CACvC,MAAM,eAAe,KAAK,QAAQ,KAAK,QAAQ;CAC/C,IAAI;CACJ,IAAI;EACH,MAAM,MAAM,OAAO,cAAc,YAAY,CAAC,CAAC;CAChD,SAAS,OAAO;EACf,MAAM,YAAY,oBAAoB,OAAO,YAAY;EACzD,IAAI,cAAc,KAAK,GAAG,MAAM,IAAI,mBAAmB,4BAA4B,UAAU,SAAS;GACrG,KAAK,UAAU;GACf,KAAK,UAAU;GACf,OAAO,EAAE,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