@prisma/composer 0.6.0-dev.9 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{app-config-CFsSXEVj-B242oUnm.d.mts → app-config-BinBcpPf-1akTl5h4.d.mts} +128 -15
- package/dist/app-config-BinBcpPf-1akTl5h4.d.mts.map +1 -0
- package/dist/config-647Wkm51.d.mts +1 -0
- package/dist/config.d.mts +3 -3
- package/dist/control.d.mts +79 -35
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +34 -33
- package/dist/control.mjs.map +1 -1
- package/dist/deploy-647Wkm51.d.mts +1 -0
- package/dist/deploy.d.mts +2 -2
- package/dist/{deployment-summary-r47O6kFr-CcMYVOn5.mjs → deployment-summary-DswOl_9E-B9MhYYDt.mjs} +5 -5
- package/dist/deployment-summary-DswOl_9E-B9MhYYDt.mjs.map +1 -0
- package/dist/dist-CVk7Pk4B.mjs +42 -0
- package/dist/dist-CVk7Pk4B.mjs.map +1 -0
- package/dist/{execute-deploy-destroy-IT4vGkMc-oO8yjHPH.mjs → execute-deploy-destroy-DRl6Tfg9-B8LE2Lh5.mjs} +171 -31
- package/dist/execute-deploy-destroy-DRl6Tfg9-B8LE2Lh5.mjs.map +1 -0
- package/dist/{execute-dev-DLYyduEM-88uyvrbj.mjs → execute-dev-BMTFWfFc-7MifQgpp.mjs} +53 -48
- package/dist/execute-dev-BMTFWfFc-7MifQgpp.mjs.map +1 -0
- package/dist/{execute-log-VIOL4DBz-DBPH8By4.mjs → execute-log-Cay9hlKW-BcvKPOW1.mjs} +10 -7
- package/dist/execute-log-Cay9hlKW-BcvKPOW1.mjs.map +1 -0
- package/dist/local-target.d.mts +1 -1
- package/dist/nextjs-control.d.mts +3 -3
- package/dist/nextjs-control.mjs +138 -34
- package/dist/nextjs-control.mjs.map +1 -1
- package/dist/node-control.d.mts +3 -3
- package/dist/node-control.mjs +21814 -55
- package/dist/node-control.mjs.map +1 -1
- package/dist/{pipeline-D3QoVzAB-Ci2aJ2mE.mjs → pipeline-AoW8zq4I-Dg8xQ7nC.mjs} +170 -49
- package/dist/pipeline-AoW8zq4I-Dg8xQ7nC.mjs.map +1 -0
- package/dist/report.d.mts +2 -2
- package/dist/report.mjs +1 -1
- package/dist/report.mjs.map +1 -1
- package/dist/{result-CzGChwbZ.mjs → result-D95kAAek.mjs} +36 -20
- package/dist/result-D95kAAek.mjs.map +1 -0
- package/dist/run-alchemy-D44OZlyB-Cw5CVbUQ.mjs +93 -0
- package/dist/run-alchemy-D44OZlyB-Cw5CVbUQ.mjs.map +1 -0
- package/dist/run-report-C2o98uD--AX8kpz4Q.mjs +60 -0
- package/dist/run-report-C2o98uD--AX8kpz4Q.mjs.map +1 -0
- package/package.json +14 -19
- package/src/exports/testing.ts +5 -0
- package/dist/app-config-CFsSXEVj-B242oUnm.d.mts.map +0 -1
- package/dist/bin.mjs +0 -19
- package/dist/bin.mjs.map +0 -1
- package/dist/cli-B3sWzFlb-CxEIzKsQ.mjs +0 -401
- package/dist/cli-B3sWzFlb-CxEIzKsQ.mjs.map +0 -1
- package/dist/config-ku5b_2YD.d.mts +0 -1
- package/dist/container-transport-DKmKg5JQ-BMRhx5w-.mjs +0 -75
- package/dist/container-transport-DKmKg5JQ-BMRhx5w-.mjs.map +0 -1
- package/dist/deploy-ku5b_2YD.d.mts +0 -1
- package/dist/deployment-summary-r47O6kFr-CcMYVOn5.mjs.map +0 -1
- package/dist/execute-deploy-destroy-IT4vGkMc-YM1Cv6cu.mjs +0 -306
- package/dist/execute-deploy-destroy-IT4vGkMc-YM1Cv6cu.mjs.map +0 -1
- package/dist/execute-deploy-destroy-IT4vGkMc-oO8yjHPH.mjs.map +0 -1
- package/dist/execute-dev-DLYyduEM-88uyvrbj.mjs.map +0 -1
- package/dist/execute-dev-DLYyduEM-BuUGTm0g.mjs +0 -2006
- package/dist/execute-dev-DLYyduEM-BuUGTm0g.mjs.map +0 -1
- package/dist/execute-log-VIOL4DBz-DBPH8By4.mjs.map +0 -1
- package/dist/execute-log-VIOL4DBz-DKodBrxS.mjs +0 -155
- package/dist/execute-log-VIOL4DBz-DKodBrxS.mjs.map +0 -1
- package/dist/local-target-DuSyWeYc.mjs +0 -68
- package/dist/local-target-DuSyWeYc.mjs.map +0 -1
- package/dist/pipeline-D3QoVzAB-Ci2aJ2mE.mjs.map +0 -1
- package/dist/pipeline-D3QoVzAB-D_ufjg3N.mjs +0 -857
- package/dist/pipeline-D3QoVzAB-D_ufjg3N.mjs.map +0 -1
- package/dist/render-error-DsPN5qfr-CkVGj9uP.mjs +0 -30
- package/dist/render-error-DsPN5qfr-CkVGj9uP.mjs.map +0 -1
- package/dist/result-CFqJKiqg.mjs +0 -106
- package/dist/result-CFqJKiqg.mjs.map +0 -1
- package/dist/result-CzGChwbZ.mjs.map +0 -1
- package/dist/run-alchemy-hghRtddF-CQHOzlrW.mjs +0 -48
- package/dist/run-alchemy-hghRtddF-CQHOzlrW.mjs.map +0 -1
- package/dist/shared-CCaR42wo-BvegvmA_.mjs +0 -265
- package/dist/shared-CCaR42wo-BvegvmA_.mjs.map +0 -1
|
@@ -2,11 +2,12 @@ import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
|
|
|
2
2
|
import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
|
|
3
3
|
import { o as isNode, t as Load } from "./graph-BJgUfGB0-kvgFzT4q.mjs";
|
|
4
4
|
import "./dist-C5rZnr4n.mjs";
|
|
5
|
-
import
|
|
6
|
-
import * as
|
|
5
|
+
import { i as effectResolutionDiagnostic } from "./result-D95kAAek.mjs";
|
|
6
|
+
import * as fs$1 from "node:fs";
|
|
7
|
+
import * as path$1 from "node:path";
|
|
7
8
|
import { pathToFileURL } from "node:url";
|
|
8
9
|
import * as c12 from "c12";
|
|
9
|
-
//#region ../../0-framework/3-tooling/cli/dist/load-entry-
|
|
10
|
+
//#region ../../0-framework/3-tooling/cli/dist/load-entry-BYBSCuWg.mjs
|
|
10
11
|
/**
|
|
11
12
|
* `loadEntry` imports a user's topology with the host runtime's own module
|
|
12
13
|
* loader — under node (the CLI's shebang runtime), that loader strips
|
|
@@ -51,7 +52,7 @@ function explainJsxLoadError(error, entryPath) {
|
|
|
51
52
|
* IS the application; nothing else marks a root (ADR-0003).
|
|
52
53
|
*/
|
|
53
54
|
async function loadEntry(entryArg, cwd) {
|
|
54
|
-
const resolvedPath = path.resolve(cwd, entryArg);
|
|
55
|
+
const resolvedPath = path$1.resolve(cwd, entryArg);
|
|
55
56
|
let mod;
|
|
56
57
|
try {
|
|
57
58
|
mod = await import(pathToFileURL(resolvedPath).href);
|
|
@@ -127,7 +128,7 @@ async function assembleServices(graph, config, cwd, run) {
|
|
|
127
128
|
return { bundles };
|
|
128
129
|
}
|
|
129
130
|
//#endregion
|
|
130
|
-
//#region ../../0-framework/3-tooling/cli/dist/pipeline-
|
|
131
|
+
//#region ../../0-framework/3-tooling/cli/dist/pipeline-AoW8zq4I.mjs
|
|
131
132
|
/**
|
|
132
133
|
* Pipeline step: find and load `prisma-composer.config.ts` (ADR-0017) — the ONE
|
|
133
134
|
* file that imports control-plane code. Discovery is the standard walk-up
|
|
@@ -135,23 +136,34 @@ async function assembleServices(graph, config, cwd, run) {
|
|
|
135
136
|
* loading is c12 with that explicit path (rc/global/package.json lookups
|
|
136
137
|
* disabled), so the config file's own static imports resolve from the app
|
|
137
138
|
* root by whatever package manager runs — no specifier construction, no
|
|
138
|
-
* anchoring.
|
|
139
|
-
*
|
|
139
|
+
* anchoring.
|
|
140
|
+
*
|
|
141
|
+
* Two shapes of the same machinery:
|
|
142
|
+
*
|
|
143
|
+
* loadAppConfigDiagnostics — returns the evaluated value together with
|
|
144
|
+
* EVERY problem found, and never throws. This is the shape the engine
|
|
145
|
+
* command family consumes: the engine renders diagnostics itself and
|
|
146
|
+
* decides per command whether a broken section is fatal, so a loader that
|
|
147
|
+
* threw on the first bad field would both hide the rest and bypass that
|
|
148
|
+
* rendering.
|
|
149
|
+
*
|
|
150
|
+
* loadAppConfig — the same load, throwing its first diagnostic. The
|
|
151
|
+
* clipanion CLI still runs on it; it goes when clipanion does.
|
|
140
152
|
*/
|
|
141
153
|
const CONFIG_FILENAME = "prisma-composer.config.ts";
|
|
142
154
|
/** Walks UP from the entry file's directory looking for the literal CONFIG_FILENAME; undefined when the walk hits the filesystem root. */
|
|
143
155
|
function findConfigPathForEntry(entryPath) {
|
|
144
|
-
let current = path.dirname(path.resolve(entryPath));
|
|
156
|
+
let current = path$1.dirname(path$1.resolve(entryPath));
|
|
145
157
|
while (true) {
|
|
146
|
-
const candidate = path.join(current, CONFIG_FILENAME);
|
|
147
|
-
if (fs.existsSync(candidate)) return candidate;
|
|
148
|
-
const parent = path.dirname(current);
|
|
158
|
+
const candidate = path$1.join(current, CONFIG_FILENAME);
|
|
159
|
+
if (fs$1.existsSync(candidate)) return candidate;
|
|
160
|
+
const parent = path$1.dirname(current);
|
|
149
161
|
if (parent === current) return void 0;
|
|
150
162
|
current = parent;
|
|
151
163
|
}
|
|
152
164
|
}
|
|
153
165
|
function missingConfigError(entryPath) {
|
|
154
|
-
const searchedFrom = path.dirname(path.resolve(entryPath));
|
|
166
|
+
const searchedFrom = path$1.dirname(path$1.resolve(entryPath));
|
|
155
167
|
return new CliStructuredError("CONFIG.FILE_MISSING", `No ${CONFIG_FILENAME} found walking up from "${searchedFrom}".`, {
|
|
156
168
|
why: "The deploy needs the app's config file.",
|
|
157
169
|
fix: "Create one next to (or above) the entry, default-exporting defineConfig({ extensions: [...], state: ... }) from '@prisma/composer/config'.",
|
|
@@ -170,58 +182,156 @@ function isRecord(value) {
|
|
|
170
182
|
/**
|
|
171
183
|
* Field-by-field validation of the loaded default export — deliberately no
|
|
172
184
|
* schema library: each check is a structured error naming the offending field.
|
|
173
|
-
*
|
|
185
|
+
*
|
|
186
|
+
* Collects rather than throws, so one bad config reports every bad field
|
|
187
|
+
* instead of only the first. The `extensions` and `state` checks are
|
|
188
|
+
* independent, and within `extensions` each entry is judged on its own; a
|
|
189
|
+
* field whose own shape check already failed is not probed further, because
|
|
190
|
+
* anything derived from it would be noise rather than a second finding.
|
|
174
191
|
*/
|
|
175
|
-
function
|
|
176
|
-
if (!isRecord(loaded) || Object.keys(loaded).length === 0)
|
|
192
|
+
function configShapeDiagnostics(loaded, configPath) {
|
|
193
|
+
if (!isRecord(loaded) || Object.keys(loaded).length === 0) return [new CliStructuredError("CONFIG.EXPORT_INVALID", `"${configPath}" exported no config.`, {
|
|
177
194
|
fix: "It must default-export defineConfig({ extensions: [...], state: ... }) from '@prisma/composer/config'.",
|
|
178
195
|
where: { path: configPath }
|
|
179
|
-
});
|
|
196
|
+
})];
|
|
197
|
+
const diagnostics = [];
|
|
180
198
|
const extensions = loaded["extensions"];
|
|
181
|
-
if (!Array.isArray(extensions))
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
199
|
+
if (!Array.isArray(extensions)) diagnostics.push(fieldError("extensions", "must be an array"));
|
|
200
|
+
else {
|
|
201
|
+
const seen = /* @__PURE__ */ new Set();
|
|
202
|
+
for (const [index, entry] of extensions.entries()) {
|
|
203
|
+
if (!isRecord(entry)) {
|
|
204
|
+
diagnostics.push(fieldError(`extensions[${index}]`, "must be an extension descriptor object"));
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
const id = entry["id"];
|
|
208
|
+
if (typeof id !== "string" || id.length === 0) diagnostics.push(fieldError(`extensions[${index}].id`, "must be a non-empty string (the extension package name)"));
|
|
209
|
+
else if (seen.has(id)) diagnostics.push(new CliStructuredError("CONFIG.EXTENSION_DUPLICATE", `${CONFIG_FILENAME}: extension "${id}" is listed more than once in \`extensions\`.`));
|
|
210
|
+
else seen.add(id);
|
|
211
|
+
if (!isRecord(entry["nodes"])) diagnostics.push(fieldError(`extensions[${index}].nodes`, "must be an object (the node-ID → control registry)"));
|
|
212
|
+
}
|
|
190
213
|
}
|
|
191
214
|
const state = loaded["state"];
|
|
192
|
-
if (!isRecord(state) || typeof state["extension"] !== "string" || typeof state["create"] !== "function")
|
|
215
|
+
if (!isRecord(state) || typeof state["extension"] !== "string" || typeof state["create"] !== "function") diagnostics.push(fieldError("state", "must be a state descriptor (e.g. prismaState())"));
|
|
216
|
+
return diagnostics;
|
|
217
|
+
}
|
|
218
|
+
/** The throwing form of configShapeDiagnostics: raises the first finding, returns the same object typed. Used by the clipanion pipeline. */
|
|
219
|
+
function validateConfigShape(loaded, configPath) {
|
|
220
|
+
const [first] = configShapeDiagnostics(loaded, configPath);
|
|
221
|
+
if (first !== void 0) throw first;
|
|
193
222
|
return blindCast(loaded);
|
|
194
223
|
}
|
|
195
224
|
/**
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
225
|
+
* Evaluates `configPath` with c12 (explicit file; rc / global-rc /
|
|
226
|
+
* package.json lookups disabled). `verifySamePath` runs the same-file check
|
|
227
|
+
* against the discovered path — see loadAppConfigDiagnostics for when it does
|
|
228
|
+
* not apply.
|
|
199
229
|
*/
|
|
200
|
-
async function
|
|
230
|
+
async function evaluateConfig(configPath, verifySamePath) {
|
|
201
231
|
let result;
|
|
202
232
|
try {
|
|
203
233
|
result = await c12.loadConfig({
|
|
204
234
|
name: "prisma-composer",
|
|
205
235
|
configFile: configPath,
|
|
206
|
-
cwd: path.dirname(configPath),
|
|
236
|
+
cwd: path$1.dirname(configPath),
|
|
207
237
|
rcFile: false,
|
|
208
238
|
globalRc: false,
|
|
209
239
|
packageJson: false
|
|
210
240
|
});
|
|
211
241
|
} catch (error) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
242
|
+
return {
|
|
243
|
+
value: void 0,
|
|
244
|
+
diagnostics: [new CliStructuredError("CONFIG.EVALUATION_FAILED", `Evaluating "${configPath}" failed: ${error instanceof Error ? error.message : String(error)}`, {
|
|
245
|
+
where: { path: configPath },
|
|
246
|
+
cause: error
|
|
247
|
+
})]
|
|
248
|
+
};
|
|
216
249
|
}
|
|
217
250
|
const loadedFile = result.configFile;
|
|
218
|
-
if (typeof loadedFile !== "string" || fs.realpathSync(loadedFile) !== fs.realpathSync(configPath))
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
251
|
+
if (verifySamePath && (typeof loadedFile !== "string" || fs$1.realpathSync(loadedFile) !== fs$1.realpathSync(configPath))) return {
|
|
252
|
+
value: result.config,
|
|
253
|
+
diagnostics: [new CliStructuredError("CONFIG.PATH_MISMATCH", `Config loading resolved "${String(loadedFile)}" instead of the discovered "${configPath}".`, {
|
|
254
|
+
why: "Refusing to deploy against a different file.",
|
|
255
|
+
where: { path: configPath }
|
|
256
|
+
})]
|
|
257
|
+
};
|
|
258
|
+
return {
|
|
259
|
+
value: result.config,
|
|
260
|
+
diagnostics: configShapeDiagnostics(result.config, configPath)
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* The front of every config load, shared by the throwing and the
|
|
265
|
+
* diagnostics-list shapes: verify the installed tree can evaluate a config at
|
|
266
|
+
* all, then settle which file to load — the section's path, or the
|
|
267
|
+
* entry-anchored walk.
|
|
268
|
+
*
|
|
269
|
+
* The effect-resolution check comes first because evaluating a config imports
|
|
270
|
+
* alchemy's provider tree: in a tree where alchemy resolves an `effect` we did
|
|
271
|
+
* not pin, nothing downstream can load, so the dependency conflict is the
|
|
272
|
+
* finding with the fix in it and every later failure is its symptom.
|
|
273
|
+
*/
|
|
274
|
+
function configSource(request) {
|
|
275
|
+
const resolvedEntry = path$1.resolve(request.entryPath);
|
|
276
|
+
const cwd = request.cwd ?? path$1.dirname(resolvedEntry);
|
|
277
|
+
const effectConflict = effectResolutionDiagnostic(cwd);
|
|
278
|
+
if (effectConflict !== void 0) return {
|
|
279
|
+
ok: false,
|
|
280
|
+
path: void 0,
|
|
281
|
+
diagnostic: effectConflict
|
|
282
|
+
};
|
|
283
|
+
if (request.configPath === void 0) {
|
|
284
|
+
const discovered = findConfigPathForEntry(resolvedEntry);
|
|
285
|
+
return discovered === void 0 ? {
|
|
286
|
+
ok: false,
|
|
287
|
+
path: void 0,
|
|
288
|
+
diagnostic: missingConfigError(resolvedEntry)
|
|
289
|
+
} : {
|
|
290
|
+
ok: true,
|
|
291
|
+
path: discovered,
|
|
292
|
+
explicit: false
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
const configPath = path$1.resolve(cwd, request.configPath);
|
|
296
|
+
if (!fs$1.existsSync(configPath)) return {
|
|
297
|
+
ok: false,
|
|
298
|
+
path: configPath,
|
|
299
|
+
diagnostic: new CliStructuredError("CONFIG.FILE_MISSING", `The \`composer\` config section points at "${configPath}", which does not exist.`, {
|
|
300
|
+
why: "An explicit configPath is used as given — there is no walk to fall back on.",
|
|
301
|
+
fix: "Correct `configPath` in the `composer` section of prisma.config.ts, or remove it to search upward from the entry.",
|
|
302
|
+
where: { path: configPath }
|
|
303
|
+
})
|
|
304
|
+
};
|
|
222
305
|
return {
|
|
306
|
+
ok: true,
|
|
223
307
|
path: configPath,
|
|
224
|
-
|
|
308
|
+
explicit: true
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* The throwing form of that front, for the pipeline: the file the load will
|
|
313
|
+
* use, or the finding raised. `explicit` says the section named the file,
|
|
314
|
+
* which is what retires the same-file check for that case.
|
|
315
|
+
*/
|
|
316
|
+
function resolveConfigFile(request) {
|
|
317
|
+
const source = configSource(request);
|
|
318
|
+
if (!source.ok) throw source.diagnostic;
|
|
319
|
+
return {
|
|
320
|
+
path: source.path,
|
|
321
|
+
explicit: source.explicit
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Loads + validates the config at `configPath`, throwing its first diagnostic.
|
|
326
|
+
* The clipanion CLI's pipeline runs on this; it goes when clipanion does.
|
|
327
|
+
*/
|
|
328
|
+
async function loadAppConfig(configPath, verifySamePath = true) {
|
|
329
|
+
const { value, diagnostics } = await evaluateConfig(configPath, verifySamePath);
|
|
330
|
+
const [first] = diagnostics;
|
|
331
|
+
if (first !== void 0) throw first;
|
|
332
|
+
return {
|
|
333
|
+
path: configPath,
|
|
334
|
+
config: validateConfigShape(value, configPath)
|
|
225
335
|
};
|
|
226
336
|
}
|
|
227
337
|
function lookup(extensions, extension, type, expectedKind, what) {
|
|
@@ -271,6 +381,23 @@ function validateRegistryCoverage(graph, config) {
|
|
|
271
381
|
* cannot drift.
|
|
272
382
|
*/
|
|
273
383
|
/**
|
|
384
|
+
* The config step both pipelines share: the effect-resolution check and the
|
|
385
|
+
* choice of config file (load-config.ts's shared front), then evaluation —
|
|
386
|
+
* unless the caller substituted a config, which replaces the evaluation and
|
|
387
|
+
* nothing before it.
|
|
388
|
+
*/
|
|
389
|
+
async function loadConfigStep(entryPath, cwd, deps) {
|
|
390
|
+
const { path: configPath, explicit } = resolveConfigFile({
|
|
391
|
+
entryPath,
|
|
392
|
+
configPath: deps.configPath,
|
|
393
|
+
cwd
|
|
394
|
+
});
|
|
395
|
+
return {
|
|
396
|
+
configPath,
|
|
397
|
+
config: deps.config ?? (await loadAppConfig(configPath, !explicit)).config
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
274
401
|
* The pipeline's front — config discovery/load, entry load, name resolution —
|
|
275
402
|
* WITHOUT Load, coverage, or assemble. `log` needs only who the app is (its
|
|
276
403
|
* config and resolved name) to reach the already-running local instance; it
|
|
@@ -278,10 +405,7 @@ function validateRegistryCoverage(graph, config) {
|
|
|
278
405
|
* output the way the full pipeline does.
|
|
279
406
|
*/
|
|
280
407
|
async function resolveAppIdentity(entry, overrideName, cwd, deps = {}) {
|
|
281
|
-
const
|
|
282
|
-
const configPath = findConfigPathForEntry(resolvedEntryPath);
|
|
283
|
-
if (configPath === void 0) throw missingConfigError(resolvedEntryPath);
|
|
284
|
-
const config = deps.config ?? (await loadAppConfig(configPath)).config;
|
|
408
|
+
const { configPath, config } = await loadConfigStep(path$1.resolve(cwd, entry), cwd, deps);
|
|
285
409
|
const entryModule = await loadEntry(entry, cwd);
|
|
286
410
|
const name = overrideName ?? entryModule.root.name;
|
|
287
411
|
if (name.length === 0) throw new CliStructuredError("COMPOSE.NAME_MISSING", "The root node has no name.", { fix: "Name it at authoring, or pass --name." });
|
|
@@ -299,10 +423,7 @@ async function resolveAppIdentity(entry, overrideName, cwd, deps = {}) {
|
|
|
299
423
|
* about any one command.
|
|
300
424
|
*/
|
|
301
425
|
async function runPipeline(entry, overrideName, cwd, deps = {}, onAssembleError) {
|
|
302
|
-
const
|
|
303
|
-
const configPath = findConfigPathForEntry(resolvedEntryPath);
|
|
304
|
-
if (configPath === void 0) throw missingConfigError(resolvedEntryPath);
|
|
305
|
-
const config = deps.config ?? (await loadAppConfig(configPath)).config;
|
|
426
|
+
const { configPath, config } = await loadConfigStep(path$1.resolve(cwd, entry), cwd, deps);
|
|
306
427
|
const entryModule = await loadEntry(entry, cwd);
|
|
307
428
|
const graph = Load(entryModule.root);
|
|
308
429
|
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); })." });
|
|
@@ -328,4 +449,4 @@ async function runPipeline(entry, overrideName, cwd, deps = {}, onAssembleError)
|
|
|
328
449
|
//#endregion
|
|
329
450
|
export { runPipeline as n, resolveAppIdentity as t };
|
|
330
451
|
|
|
331
|
-
//# sourceMappingURL=pipeline-
|
|
452
|
+
//# sourceMappingURL=pipeline-AoW8zq4I-Dg8xQ7nC.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-AoW8zq4I-Dg8xQ7nC.mjs","names":["path","path","fs"],"sources":["../../../0-framework/3-tooling/cli/dist/load-entry-BYBSCuWg.mjs","../../../0-framework/3-tooling/assemble/dist/index.mjs","../../../0-framework/3-tooling/cli/dist/pipeline-AoW8zq4I.mjs"],"sourcesContent":["import { CliStructuredError } from \"@internal/foundation/errors\";\nimport * as path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { blindCast } from \"@internal/foundation/casts\";\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-BYBSCuWg.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 { i as effectResolutionDiagnostic } from \"./shared-BTnATsqm.mjs\";\nimport { t as loadEntry } from \"./load-entry-BYBSCuWg.mjs\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { blindCast } from \"@internal/foundation/casts\";\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.\n*\n* Two shapes of the same machinery:\n*\n* loadAppConfigDiagnostics — returns the evaluated value together with\n* EVERY problem found, and never throws. This is the shape the engine\n* command family consumes: the engine renders diagnostics itself and\n* decides per command whether a broken section is fatal, so a loader that\n* threw on the first bad field would both hide the rest and bypass that\n* rendering.\n*\n* loadAppConfig — the same load, throwing its first diagnostic. The\n* clipanion CLI still runs on it; it goes when clipanion does.\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*\n* Collects rather than throws, so one bad config reports every bad field\n* instead of only the first. The `extensions` and `state` checks are\n* independent, and within `extensions` each entry is judged on its own; a\n* field whose own shape check already failed is not probed further, because\n* anything derived from it would be noise rather than a second finding.\n*/\nfunction configShapeDiagnostics(loaded, configPath) {\n\tif (!isRecord(loaded) || Object.keys(loaded).length === 0) return [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 diagnostics = [];\n\tconst extensions = loaded[\"extensions\"];\n\tif (!Array.isArray(extensions)) diagnostics.push(fieldError(\"extensions\", \"must be an array\"));\n\telse {\n\t\tconst seen = /* @__PURE__ */ new Set();\n\t\tfor (const [index, entry] of extensions.entries()) {\n\t\t\tif (!isRecord(entry)) {\n\t\t\t\tdiagnostics.push(fieldError(`extensions[${index}]`, \"must be an extension descriptor object\"));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst id = entry[\"id\"];\n\t\t\tif (typeof id !== \"string\" || id.length === 0) diagnostics.push(fieldError(`extensions[${index}].id`, \"must be a non-empty string (the extension package name)\"));\n\t\t\telse if (seen.has(id)) diagnostics.push(new CliStructuredError(\"CONFIG.EXTENSION_DUPLICATE\", `${CONFIG_FILENAME}: extension \"${id}\" is listed more than once in \\`extensions\\`.`));\n\t\t\telse seen.add(id);\n\t\t\tif (!isRecord(entry[\"nodes\"])) diagnostics.push(fieldError(`extensions[${index}].nodes`, \"must be an object (the node-ID → control registry)\"));\n\t\t}\n\t}\n\tconst state = loaded[\"state\"];\n\tif (!isRecord(state) || typeof state[\"extension\"] !== \"string\" || typeof state[\"create\"] !== \"function\") diagnostics.push(fieldError(\"state\", \"must be a state descriptor (e.g. prismaState())\"));\n\treturn diagnostics;\n}\n/** The throwing form of configShapeDiagnostics: raises the first finding, returns the same object typed. Used by the clipanion pipeline. */\nfunction validateConfigShape(loaded, configPath) {\n\tconst [first] = configShapeDiagnostics(loaded, configPath);\n\tif (first !== void 0) throw first;\n\treturn blindCast(loaded);\n}\n/**\n* Evaluates `configPath` with c12 (explicit file; rc / global-rc /\n* package.json lookups disabled). `verifySamePath` runs the same-file check\n* against the discovered path — see loadAppConfigDiagnostics for when it does\n* not apply.\n*/\nasync function evaluateConfig(configPath, verifySamePath) {\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\treturn {\n\t\t\tvalue: void 0,\n\t\t\tdiagnostics: [new CliStructuredError(\"CONFIG.EVALUATION_FAILED\", `Evaluating \"${configPath}\" failed: ${error instanceof Error ? error.message : String(error)}`, {\n\t\t\t\twhere: { path: configPath },\n\t\t\t\tcause: error\n\t\t\t})]\n\t\t};\n\t}\n\tconst loadedFile = result.configFile;\n\tif (verifySamePath && (typeof loadedFile !== \"string\" || fs.realpathSync(loadedFile) !== fs.realpathSync(configPath))) return {\n\t\tvalue: result.config,\n\t\tdiagnostics: [new CliStructuredError(\"CONFIG.PATH_MISMATCH\", `Config loading resolved \"${String(loadedFile)}\" instead of the discovered \"${configPath}\".`, {\n\t\t\twhy: \"Refusing to deploy against a different file.\",\n\t\t\twhere: { path: configPath }\n\t\t})]\n\t};\n\treturn {\n\t\tvalue: result.config,\n\t\tdiagnostics: configShapeDiagnostics(result.config, configPath)\n\t};\n}\n/**\n* The front of every config load, shared by the throwing and the\n* diagnostics-list shapes: verify the installed tree can evaluate a config at\n* all, then settle which file to load — the section's path, or the\n* entry-anchored walk.\n*\n* The effect-resolution check comes first because evaluating a config imports\n* alchemy's provider tree: in a tree where alchemy resolves an `effect` we did\n* not pin, nothing downstream can load, so the dependency conflict is the\n* finding with the fix in it and every later failure is its symptom.\n*/\nfunction configSource(request) {\n\tconst resolvedEntry = path.resolve(request.entryPath);\n\tconst cwd = request.cwd ?? path.dirname(resolvedEntry);\n\tconst effectConflict = effectResolutionDiagnostic(cwd);\n\tif (effectConflict !== void 0) return {\n\t\tok: false,\n\t\tpath: void 0,\n\t\tdiagnostic: effectConflict\n\t};\n\tif (request.configPath === void 0) {\n\t\tconst discovered = findConfigPathForEntry(resolvedEntry);\n\t\treturn discovered === void 0 ? {\n\t\t\tok: false,\n\t\t\tpath: void 0,\n\t\t\tdiagnostic: missingConfigError(resolvedEntry)\n\t\t} : {\n\t\t\tok: true,\n\t\t\tpath: discovered,\n\t\t\texplicit: false\n\t\t};\n\t}\n\tconst configPath = path.resolve(cwd, request.configPath);\n\tif (!fs.existsSync(configPath)) return {\n\t\tok: false,\n\t\tpath: configPath,\n\t\tdiagnostic: new CliStructuredError(\"CONFIG.FILE_MISSING\", `The \\`composer\\` config section points at \"${configPath}\", which does not exist.`, {\n\t\t\twhy: \"An explicit configPath is used as given — there is no walk to fall back on.\",\n\t\t\tfix: \"Correct `configPath` in the `composer` section of prisma.config.ts, or remove it to search upward from the entry.\",\n\t\t\twhere: { path: configPath }\n\t\t})\n\t};\n\treturn {\n\t\tok: true,\n\t\tpath: configPath,\n\t\texplicit: true\n\t};\n}\n/**\n* The throwing form of that front, for the pipeline: the file the load will\n* use, or the finding raised. `explicit` says the section named the file,\n* which is what retires the same-file check for that case.\n*/\nfunction resolveConfigFile(request) {\n\tconst source = configSource(request);\n\tif (!source.ok) throw source.diagnostic;\n\treturn {\n\t\tpath: source.path,\n\t\texplicit: source.explicit\n\t};\n}\n/**\n* Loads + validates the config at `configPath`, throwing its first diagnostic.\n* The clipanion CLI's pipeline runs on this; it goes when clipanion does.\n*/\nasync function loadAppConfig(configPath, verifySamePath = true) {\n\tconst { value, diagnostics } = await evaluateConfig(configPath, verifySamePath);\n\tconst [first] = diagnostics;\n\tif (first !== void 0) throw first;\n\treturn {\n\t\tpath: configPath,\n\t\tconfig: validateConfigShape(value, 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 config step both pipelines share: the effect-resolution check and the\n* choice of config file (load-config.ts's shared front), then evaluation —\n* unless the caller substituted a config, which replaces the evaluation and\n* nothing before it.\n*/\nasync function loadConfigStep(entryPath, cwd, deps) {\n\tconst { path: configPath, explicit } = resolveConfigFile({\n\t\tentryPath,\n\t\tconfigPath: deps.configPath,\n\t\tcwd\n\t});\n\treturn {\n\t\tconfigPath,\n\t\tconfig: deps.config ?? (await loadAppConfig(configPath, !explicit)).config\n\t};\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 { configPath, config } = await loadConfigStep(path.resolve(cwd, entry), cwd, deps);\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 { configPath, config } = await loadConfigStep(path.resolve(cwd, entry), cwd, deps);\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-AoW8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CAC1J,OAAO;EACN;EACA;EACA;CACD;AACD;;;;;;;;AAQA,eAAe,YAAY,OAAO,cAAc,KAAK,OAAO,CAAC,GAAG,iBAAiB;CAChF,MAAM,EAAE,YAAY,WAAW,MAAM,eAAeA,OAAK,QAAQ,KAAK,KAAK,GAAG,KAAK,IAAI;CACvF,MAAM,cAAc,MAAM,UAAU,OAAO,GAAG;CAC9C,MAAM,QAAQ,KAAK,YAAY,IAAI;CACnC,IAAI,MAAM,KAAK,KAAK,SAAS,UAAU,MAAM,IAAI,mBAAmB,2BAA2B,qCAAqC,EAAE,KAAK,qGAAqG,CAAC;CACjP,yBAAyB,OAAO,MAAM;CACtC,MAAM,OAAO,gBAAgB,YAAY,KAAK;CAC9C,IAAI,KAAK,WAAW,GAAG,MAAM,IAAI,mBAAmB,wBAAwB,8BAA8B,EAAE,KAAK,wCAAwC,CAAC;CAC1J,IAAI;CACJ,IAAI;EACH,YAAY,MAAM,iBAAiB,OAAO,QAAQ,KAAK,KAAK,YAAY;CACzE,SAAS,OAAO;EACf,IAAI,oBAAoB,KAAK,KAAK,iBAAiB,OAAO,MAAM,gBAAgB,KAAK;EACrF,MAAM;CACP;CACA,OAAO;EACN;EACA;EACA;EACA;EACA;EACA;CACD;AACD"}
|
package/dist/report.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./deploy-
|
|
1
|
+
import { f as DeploymentResult } from "./app-config-BinBcpPf-1akTl5h4.mjs";
|
|
2
|
+
import "./deploy-647Wkm51.mjs";
|
|
3
3
|
//#region ../../0-framework/3-tooling/cli/dist/report.d.mts
|
|
4
4
|
//#region src/render-deployment.d.ts
|
|
5
5
|
/**
|
package/dist/report.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as writeDeploymentSummaryFile } from "./deployment-summary-
|
|
1
|
+
import { r as writeDeploymentSummaryFile } from "./deployment-summary-DswOl_9E-B9MhYYDt.mjs";
|
|
2
2
|
//#region ../../0-framework/3-tooling/cli/dist/report.mjs
|
|
3
3
|
/** Gap between the deepest tree label and the entity column. */
|
|
4
4
|
const LABEL_GAP = 3;
|
package/dist/report.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/report.mjs"],"sourcesContent":["import { r as writeDeploymentSummaryFile } from \"./deployment-summary-
|
|
1
|
+
{"version":3,"file":"report.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/report.mjs"],"sourcesContent":["import { r as writeDeploymentSummaryFile } from \"./deployment-summary-DswOl_9E.mjs\";\n//#region src/render-deployment.ts\n/** Gap between the deepest tree label and the entity column. */\nconst LABEL_GAP = 3;\nconst emptyNode = (segment) => ({\n\tsegment,\n\tchildren: /* @__PURE__ */ new Map()\n});\n/** Builds the address tree, splitting each dot-address into its segments. */\nfunction buildTree(nodes) {\n\tconst root = emptyNode(\"\");\n\tfor (const deployed of nodes) {\n\t\tlet node = root;\n\t\tfor (const segment of deployed.address.split(\".\")) {\n\t\t\tlet child = node.children.get(segment);\n\t\t\tif (child === void 0) {\n\t\t\t\tchild = emptyNode(segment);\n\t\t\t\tnode.children.set(segment, child);\n\t\t\t}\n\t\t\tnode = child;\n\t\t}\n\t\tnode.deployed = deployed;\n\t}\n\treturn root;\n}\n/** Flattens the tree to rows in address order, drawing the box guides. */\nfunction toRows(node, guides, rows) {\n\tconst children = Array.from(node.children.values());\n\tchildren.forEach((child, index) => {\n\t\tconst isLast = index === children.length - 1;\n\t\trows.push({\n\t\t\tlabel: `${guides}${isLast ? \"└─ \" : \"├─ \"}${child.segment}`,\n\t\t\tcontinuation: `${guides}${isLast ? \" \" : \"│ \"}`,\n\t\t\tdeployed: child.deployed\n\t\t});\n\t\ttoRows(child, `${guides}${isLast ? \" \" : \"│ \"}`, rows);\n\t});\n}\n/** `kind id` — the one line an entity gets. */\nconst entityLine = (entity) => `${entity.kind} ${entity.id}`;\n/** Pads `prefix` out to `width`, so every entity starts in the same column. */\nconst pad = (prefix, width) => prefix.padEnd(width, \" \");\n/**\n* Renders a deploy's result as the app's own topology. Pure — returns the\n* string; the caller prints.\n*/\nfunction renderDeployment(result) {\n\tconst rows = [];\n\ttoRows(buildTree(result.nodes), \"\", rows);\n\tconst column = Math.max(0, ...rows.map((row) => row.label.length)) + LABEL_GAP;\n\tconst lines = [result.app];\n\tfor (const row of rows) {\n\t\tif (row.deployed === void 0) {\n\t\t\tlines.push(row.label);\n\t\t\tcontinue;\n\t\t}\n\t\tif (row.deployed.entities.length === 0) {\n\t\t\tlines.push(`${pad(row.label, column)}(no entities reported)`);\n\t\t\tcontinue;\n\t\t}\n\t\trow.deployed.entities.forEach((entity, index) => {\n\t\t\tconst prefix = index === 0 ? row.label : row.continuation;\n\t\t\tlines.push(`${pad(prefix, column)}${entityLine(entity)}`);\n\t\t\tif (entity.url !== void 0) lines.push(`${pad(row.continuation, column)}${entity.url}`);\n\t\t\tfor (const [key, value] of Object.entries(entity.details ?? {})) {\n\t\t\t\tif (value === \"\") continue;\n\t\t\t\tfor (const line of value.split(\"\\n\")) lines.push(`${pad(row.continuation, column)}${key} ${line}`);\n\t\t\t}\n\t\t});\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* The report hook the generated stack file wires into `LowerOptions`. Prints a\n* leading blank line so the summary separates from alchemy's own apply output,\n* then hands the result to the cross-process writer (deployment-summary.ts).\n*/\nfunction deploymentReport(result) {\n\tconsole.log(\"\");\n\tconsole.log(renderDeployment(result));\n\twriteDeploymentSummaryFile(result);\n}\n//#endregion\nexport { deploymentReport, renderDeployment };\n\n//# sourceMappingURL=report.mjs.map"],"mappings":";;;AAGA,MAAM,YAAY;AAClB,MAAM,aAAa,aAAa;CAC/B;CACA,0BAA0B,IAAI,IAAI;AACnC;;AAEA,SAAS,UAAU,OAAO;CACzB,MAAM,OAAO,UAAU,EAAE;CACzB,KAAK,MAAM,YAAY,OAAO;EAC7B,IAAI,OAAO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D,MAAM,SAAS,UAAU,IAAI,IAAI,QAAQ,IAAI;GAC7C,MAAM,KAAK,GAAG,IAAI,QAAQ,MAAM,IAAI,WAAW,MAAM,GAAG;GACxD,IAAI,OAAO,QAAQ,KAAK,GAAG,MAAM,KAAK,GAAG,IAAI,IAAI,cAAc,MAAM,IAAI,OAAO,KAAK;GACrF,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,WAAW,CAAC,CAAC,GAAG;IAChE,IAAI,UAAU,IAAI;IAClB,KAAK,MAAM,QAAQ,MAAM,MAAM,IAAI,GAAG,MAAM,KAAK,GAAG,IAAI,IAAI,cAAc,MAAM,IAAI,IAAI,GAAG,MAAM;GAClG;EACD,CAAC;CACF;CACA,OAAO,MAAM,KAAK,IAAI;AACvB;;;;;;AAMA,SAAS,iBAAiB,QAAQ;CACjC,QAAQ,IAAI,EAAE;CACd,QAAQ,IAAI,iBAAiB,MAAM,CAAC;CACpC,2BAA2B,MAAM;AAClC"}
|
|
@@ -2,9 +2,9 @@ import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
|
|
|
2
2
|
import { t as InternalError } from "./internal-error-BIc-ehme-Ck_lgxD_.mjs";
|
|
3
3
|
import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
|
-
import * as fs from "node:fs";
|
|
6
|
-
import * as path from "node:path";
|
|
7
|
-
//#region ../../0-framework/3-tooling/cli/dist/shared-
|
|
5
|
+
import * as fs$1 from "node:fs";
|
|
6
|
+
import * as path$1 from "node:path";
|
|
7
|
+
//#region ../../0-framework/3-tooling/cli/dist/shared-BTnATsqm.mjs
|
|
8
8
|
/**
|
|
9
9
|
* Deploy preflight (TML-3158): verify that alchemy resolves the exact `effect`
|
|
10
10
|
* version @prisma/composer pins. Package managers cannot be made to enforce
|
|
@@ -19,9 +19,9 @@ import * as path from "node:path";
|
|
|
19
19
|
function findAlchemyPackageDir(startDir) {
|
|
20
20
|
let dir = startDir;
|
|
21
21
|
while (true) {
|
|
22
|
-
const candidate = path.join(dir, "node_modules", "alchemy");
|
|
23
|
-
if (fs.existsSync(path.join(candidate, "package.json"))) return candidate;
|
|
24
|
-
const parent = path.dirname(dir);
|
|
22
|
+
const candidate = path$1.join(dir, "node_modules", "alchemy");
|
|
23
|
+
if (fs$1.existsSync(path$1.join(candidate, "package.json"))) return candidate;
|
|
24
|
+
const parent = path$1.dirname(dir);
|
|
25
25
|
if (parent === dir) return void 0;
|
|
26
26
|
dir = parent;
|
|
27
27
|
}
|
|
@@ -35,17 +35,17 @@ function findAlchemyPackageDir(startDir) {
|
|
|
35
35
|
function resolveEffectVersionFrom(packageDir) {
|
|
36
36
|
let entry;
|
|
37
37
|
try {
|
|
38
|
-
entry = createRequire(path.join(fs.realpathSync(packageDir), "noop.js")).resolve("effect");
|
|
38
|
+
entry = createRequire(path$1.join(fs$1.realpathSync(packageDir), "noop.js")).resolve("effect");
|
|
39
39
|
} catch {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
let dir = path.dirname(entry);
|
|
43
|
-
while (!fs.existsSync(path.join(dir, "package.json"))) {
|
|
44
|
-
const parent = path.dirname(dir);
|
|
42
|
+
let dir = path$1.dirname(entry);
|
|
43
|
+
while (!fs$1.existsSync(path$1.join(dir, "package.json"))) {
|
|
44
|
+
const parent = path$1.dirname(dir);
|
|
45
45
|
if (parent === dir) return void 0;
|
|
46
46
|
dir = parent;
|
|
47
47
|
}
|
|
48
|
-
const version = JSON.parse(fs.readFileSync(path.join(dir, "package.json"), "utf-8")).version;
|
|
48
|
+
const version = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8")).version;
|
|
49
49
|
return typeof version === "string" ? version : void 0;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
@@ -61,11 +61,11 @@ function resolveEffectVersionFrom(packageDir) {
|
|
|
61
61
|
function requiredEffectVersion(startDir) {
|
|
62
62
|
let manifestPath;
|
|
63
63
|
try {
|
|
64
|
-
manifestPath = createRequire(path.join(startDir, "noop.js")).resolve("@prisma/composer/package.json");
|
|
64
|
+
manifestPath = createRequire(path$1.join(startDir, "noop.js")).resolve("@prisma/composer/package.json");
|
|
65
65
|
} catch {
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
|
-
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf-8"));
|
|
68
|
+
const manifest = JSON.parse(fs$1.readFileSync(manifestPath, "utf-8"));
|
|
69
69
|
if (typeof manifest !== "object" || manifest === null || !("dependencies" in manifest)) return;
|
|
70
70
|
const dependencies = manifest.dependencies;
|
|
71
71
|
if (typeof dependencies !== "object" || dependencies === null || !("effect" in dependencies)) return;
|
|
@@ -87,17 +87,33 @@ function effectMismatchError(found, required) {
|
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
|
-
/**
|
|
91
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Runs the preflight from the app's directory and RETURNS the
|
|
92
|
+
* DEPS.EFFECT_VERSION_CONFLICT error for a mismatched tree; undefined when the
|
|
93
|
+
* tree is healthy or alchemy is not installed.
|
|
94
|
+
*
|
|
95
|
+
* This is the form the config-load machinery uses. The check belongs on the
|
|
96
|
+
* config-load path rather than at import time because that is the first moment
|
|
97
|
+
* anything actually loads alchemy's provider tree — the break it explains —
|
|
98
|
+
* and because a check that runs at import time takes out commands that never
|
|
99
|
+
* touch alchemy at all, help among them.
|
|
100
|
+
*/
|
|
101
|
+
function effectResolutionDiagnostic(cwd) {
|
|
92
102
|
const alchemyDir = findAlchemyPackageDir(cwd);
|
|
93
|
-
if (alchemyDir === void 0) return;
|
|
103
|
+
if (alchemyDir === void 0) return void 0;
|
|
94
104
|
const parts = effectMismatchError(resolveEffectVersionFrom(alchemyDir), requiredEffectVersion(cwd));
|
|
95
|
-
if (parts
|
|
105
|
+
if (parts === void 0) return void 0;
|
|
106
|
+
return new CliStructuredError("DEPS.EFFECT_VERSION_CONFLICT", parts.summary, {
|
|
96
107
|
why: parts.why,
|
|
97
108
|
fix: parts.fix,
|
|
98
109
|
meta: parts.meta
|
|
99
110
|
});
|
|
100
111
|
}
|
|
112
|
+
/** The throwing form, used by the executor-load diagnosis — the one caller left now that the bin runs no start-up preflight of its own. */
|
|
113
|
+
function checkEffectResolution(cwd) {
|
|
114
|
+
const diagnostic = effectResolutionDiagnostic(cwd);
|
|
115
|
+
if (diagnostic !== void 0) throw diagnostic;
|
|
116
|
+
}
|
|
101
117
|
/**
|
|
102
118
|
* Reads the execution diagnostics an engine-failure error carries in
|
|
103
119
|
* `meta.diagnostics`; undefined for every other failure.
|
|
@@ -106,7 +122,7 @@ function executionDiagnostics(f) {
|
|
|
106
122
|
const diagnostics = f.meta?.["diagnostics"];
|
|
107
123
|
if (typeof diagnostics !== "object" || diagnostics === null) return void 0;
|
|
108
124
|
const candidate = blindCast(diagnostics);
|
|
109
|
-
if (candidate["exitCode"] !== void 0 && typeof candidate["exitCode"] !== "number" || typeof candidate["stackFilePath"] !== "string" || typeof candidate["reproduceCommand"] !== "string" || typeof candidate["cwd"] !== "string") return;
|
|
125
|
+
if (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;
|
|
110
126
|
return blindCast(diagnostics);
|
|
111
127
|
}
|
|
112
128
|
/**
|
|
@@ -226,6 +242,6 @@ function okVoid() {
|
|
|
226
242
|
return OK_VOID;
|
|
227
243
|
}
|
|
228
244
|
//#endregion
|
|
229
|
-
export {
|
|
245
|
+
export { executionDiagnostics as a, effectResolutionDiagnostic as i, ok as n, executorLoadFailure as o, okVoid as r, toStructured as s, notOk as t };
|
|
230
246
|
|
|
231
|
-
//# sourceMappingURL=result-
|
|
247
|
+
//# sourceMappingURL=result-D95kAAek.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result-D95kAAek.mjs","names":["path","fs"],"sources":["../../../0-framework/3-tooling/cli/dist/shared-BTnATsqm.mjs","../../../0-framework/0-foundation/foundation/dist/result.mjs"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { blindCast } from \"@internal/foundation/casts\";\n//#region src/check-effect-resolution.ts\n/**\n* Deploy preflight (TML-3158): verify that alchemy resolves the exact `effect`\n* version @prisma/composer pins. Package managers cannot be made to enforce\n* this — alchemy's own peer range accepts newer effect betas, and npm resolves\n* transitive peer conflicts with a warning, not a failure — so a floating\n* `@effect/*` range anywhere in the consumer's tree can hoist a newer effect\n* to the root, where alchemy picks it up and crashes mid-deploy\n* (`TypeError: Schedule.either is not a function`). This check turns that\n* silent break into a start-up error naming the fix.\n*/\n/** Walks up from `startDir` looking for `node_modules/alchemy` (mirrors resolveAlchemyBin). Undefined when absent — the check skips rather than second-guessing later, clearer failures. */\nfunction findAlchemyPackageDir(startDir) {\n\tlet dir = startDir;\n\twhile (true) {\n\t\tconst candidate = path.join(dir, \"node_modules\", \"alchemy\");\n\t\tif (fs.existsSync(path.join(candidate, \"package.json\"))) return candidate;\n\t\tconst parent = path.dirname(dir);\n\t\tif (parent === dir) return void 0;\n\t\tdir = parent;\n\t}\n}\n/**\n* The `effect` version Node gives `packageDir`'s code, resolved exactly as\n* Node would: from the package's real path (so pnpm symlink layouts resolve\n* from the package's own store position, like at runtime). Undefined when\n* `effect` is not resolvable from there.\n*/\nfunction resolveEffectVersionFrom(packageDir) {\n\tlet entry;\n\ttry {\n\t\tentry = createRequire(path.join(fs.realpathSync(packageDir), \"noop.js\")).resolve(\"effect\");\n\t} catch {\n\t\treturn;\n\t}\n\tlet dir = path.dirname(entry);\n\twhile (!fs.existsSync(path.join(dir, \"package.json\"))) {\n\t\tconst parent = path.dirname(dir);\n\t\tif (parent === dir) return void 0;\n\t\tdir = parent;\n\t}\n\tconst version = JSON.parse(fs.readFileSync(path.join(dir, \"package.json\"), \"utf-8\")).version;\n\treturn typeof version === \"string\" ? version : void 0;\n}\n/**\n* The `effect` version @prisma/composer pins, read from its own installed\n* package.json — the single source of truth; never hardcoded here. Undefined\n* when @prisma/composer is not resolvable from `startDir` (e.g. the CLI is\n* driven some other way), in which case the check skips.\n*\n* Assumes the pin is an exact version — effectMismatchError compares with\n* `===`, which scripts/check-npm-effect-resolution.mjs enforces in CI;\n* relaxing the pin to a range means revisiting that comparison.\n*/\nfunction requiredEffectVersion(startDir) {\n\tlet manifestPath;\n\ttry {\n\t\tmanifestPath = createRequire(path.join(startDir, \"noop.js\")).resolve(\"@prisma/composer/package.json\");\n\t} catch {\n\t\treturn;\n\t}\n\tconst manifest = JSON.parse(fs.readFileSync(manifestPath, \"utf-8\"));\n\tif (typeof manifest !== \"object\" || manifest === null || !(\"dependencies\" in manifest)) return;\n\tconst dependencies = manifest.dependencies;\n\tif (typeof dependencies !== \"object\" || dependencies === null || !(\"effect\" in dependencies)) return;\n\tconst version = dependencies.effect;\n\treturn typeof version === \"string\" ? version : void 0;\n}\n/** Pure comparison + parts rendering, separated so tests cover the rule without a filesystem. Returns the structured error parts, or undefined when the tree is healthy or either side is unknown. */\nfunction effectMismatchError(found, required) {\n\tif (found === void 0 || required === void 0 || found === required) return void 0;\n\treturn {\n\t\tsummary: `Dependency conflict: alchemy resolves effect@${found}, but @prisma/composer requires effect@${required}.`,\n\t\twhy: \"Your package manager installed a second effect that alchemy picks up; deploying with it would crash inside alchemy.\",\n\t\tfix: `Add this to your app's package.json, then reinstall:\n\n \"overrides\": { \"effect\": \"${required}\" }\\n\\n(npm uses \"overrides\"; yarn calls it \"resolutions\", pnpm \"pnpm.overrides\".)`,\n\t\tmeta: {\n\t\t\tfound,\n\t\t\trequired\n\t\t}\n\t};\n}\n/**\n* Runs the preflight from the app's directory and RETURNS the\n* DEPS.EFFECT_VERSION_CONFLICT error for a mismatched tree; undefined when the\n* tree is healthy or alchemy is not installed.\n*\n* This is the form the config-load machinery uses. The check belongs on the\n* config-load path rather than at import time because that is the first moment\n* anything actually loads alchemy's provider tree — the break it explains —\n* and because a check that runs at import time takes out commands that never\n* touch alchemy at all, help among them.\n*/\nfunction effectResolutionDiagnostic(cwd) {\n\tconst alchemyDir = findAlchemyPackageDir(cwd);\n\tif (alchemyDir === void 0) return void 0;\n\tconst parts = effectMismatchError(resolveEffectVersionFrom(alchemyDir), requiredEffectVersion(cwd));\n\tif (parts === void 0) return void 0;\n\treturn new CliStructuredError(\"DEPS.EFFECT_VERSION_CONFLICT\", parts.summary, {\n\t\twhy: parts.why,\n\t\tfix: parts.fix,\n\t\tmeta: parts.meta\n\t});\n}\n/** The throwing form, used by the executor-load diagnosis — the one caller left now that the bin runs no start-up preflight of its own. */\nfunction checkEffectResolution(cwd) {\n\tconst diagnostic = effectResolutionDiagnostic(cwd);\n\tif (diagnostic !== void 0) throw diagnostic;\n}\n//#endregion\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/** Diagnoses a failed executor import: when the app's tree resolves a\n* mismatched `effect` (the known way that import breaks), the failure is the\n* fix-naming DEPS.EFFECT_VERSION_CONFLICT from checkEffectResolution with the\n* import error riding as cause; otherwise DEPS.EXECUTOR_UNLOADABLE — an\n* environmental failure of the consumer's installed tree, not a bug here. */\nfunction executorLoadFailure(operation, error, cwd) {\n\ttry {\n\t\tcheckEffectResolution(cwd);\n\t} catch (diagnostic) {\n\t\tif (CliStructuredError.is(diagnostic)) return new CliStructuredError(diagnostic.code, diagnostic.message, {\n\t\t\t...diagnostic.why !== void 0 ? { why: diagnostic.why } : {},\n\t\t\t...diagnostic.fix !== void 0 ? { fix: diagnostic.fix } : {},\n\t\t\t...diagnostic.meta !== void 0 ? { meta: diagnostic.meta } : {},\n\t\t\tcause: error\n\t\t});\n\t}\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}\n//#endregion\nexport { effectResolutionDiagnostic as i, executorLoadFailure as n, toStructured as r, executionDiagnostics as t };\n\n//# sourceMappingURL=shared-BTnATsqm.mjs.map","import { t as blindCast } from \"./casts-DpaahrlC.mjs\";\nimport { t as InternalError } from \"./internal-error-BIc-ehme.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"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,SAAS,sBAAsB,UAAU;CACxC,IAAI,MAAM;CACV,OAAO,MAAM;EACZ,MAAM,YAAYA,OAAK,KAAK,KAAK,gBAAgB,SAAS;EAC1D,IAAIC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