@prisma/composer-cli 0.25.0-dev.5 → 0.26.0-dev.1
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/{result-D9vIrN7i.mjs → composer-config-CY9fET8H-KpGjlYgO.mjs} +89 -89
- package/dist/composer-config-CY9fET8H-KpGjlYgO.mjs.map +1 -0
- package/dist/{pipeline-DAYhea3J-uuBciVDS.mjs → container-transport-HcvNOGZL-CHqecFc7.mjs} +83 -71
- package/dist/container-transport-HcvNOGZL-CHqecFc7.mjs.map +1 -0
- package/dist/{execute-deploy-destroy-CF6DR7sA-jdelm-y5.mjs → execute-deploy-destroy-c0eko3AO-9npuGXd3.mjs} +70 -73
- package/dist/execute-deploy-destroy-c0eko3AO-9npuGXd3.mjs.map +1 -0
- package/dist/{execute-dev-DAIUT0es-DTdnJdOi.mjs → execute-dev-BICPaq1g-CSoZJuhB.mjs} +70 -9
- package/dist/execute-dev-BICPaq1g-CSoZJuhB.mjs.map +1 -0
- package/dist/{family-DB2Uf88c-DWEm0USb.d.mts → family-CgeZQdNg-gH8LuqqL.d.mts} +46 -140
- package/dist/family-CgeZQdNg-gH8LuqqL.d.mts.map +1 -0
- package/dist/family.d.mts +3 -28
- package/dist/family.d.mts.map +1 -1
- package/dist/family.mjs +12 -461
- package/dist/family.mjs.map +1 -1
- package/dist/{generate-dev-stack-CPpjJdTG-W0N0YgsI.mjs → generate-dev-stack-BUadNY_w-DF_lHVaP.mjs} +4 -4
- package/dist/{generate-dev-stack-CPpjJdTG-W0N0YgsI.mjs.map → generate-dev-stack-BUadNY_w-DF_lHVaP.mjs.map} +1 -1
- package/dist/run-alchemy-BEvB2sYQ-BgV2deuO.mjs +154 -0
- package/dist/run-alchemy-BEvB2sYQ-BgV2deuO.mjs.map +1 -0
- package/dist/testing.d.mts +10 -24
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +17 -46
- package/dist/testing.mjs.map +1 -1
- package/package.json +5 -8
- package/src/exports/testing.ts +2 -2
- package/dist/bin.mjs +0 -987
- package/dist/bin.mjs.map +0 -1
- package/dist/container-transport-HcvNOGZL-CIoZc7Rs.mjs +0 -34
- package/dist/container-transport-HcvNOGZL-CIoZc7Rs.mjs.map +0 -1
- package/dist/execute-deploy-destroy-CF6DR7sA-DGs5poBA.mjs +0 -556
- package/dist/execute-deploy-destroy-CF6DR7sA-DGs5poBA.mjs.map +0 -1
- package/dist/execute-deploy-destroy-CF6DR7sA-jdelm-y5.mjs.map +0 -1
- package/dist/execute-dev-DAIUT0es-CVW9TfgX.mjs +0 -2060
- package/dist/execute-dev-DAIUT0es-CVW9TfgX.mjs.map +0 -1
- package/dist/execute-dev-DAIUT0es-DTdnJdOi.mjs.map +0 -1
- package/dist/execute-log-PLs9-Qn3-BUBx5KmY.mjs +0 -155
- package/dist/execute-log-PLs9-Qn3-BUBx5KmY.mjs.map +0 -1
- package/dist/execute-log-PLs9-Qn3-D8DRuvDr.mjs +0 -154
- package/dist/execute-log-PLs9-Qn3-D8DRuvDr.mjs.map +0 -1
- package/dist/family-DB2Uf88c-DWEm0USb.d.mts.map +0 -1
- package/dist/local-target-B9cBl_6r.mjs +0 -68
- package/dist/local-target-B9cBl_6r.mjs.map +0 -1
- package/dist/local-target-P4-n1Ovh.mjs +0 -68
- package/dist/local-target-P4-n1Ovh.mjs.map +0 -1
- package/dist/pipeline-DAYhea3J-BEnHHWp8.mjs +0 -979
- package/dist/pipeline-DAYhea3J-BEnHHWp8.mjs.map +0 -1
- package/dist/pipeline-DAYhea3J-uuBciVDS.mjs.map +0 -1
- package/dist/result-D9vIrN7i.mjs.map +0 -1
- package/dist/result-SF9LFOuR.mjs +0 -461
- package/dist/result-SF9LFOuR.mjs.map +0 -1
- package/dist/run-alchemy-pANK8XNX-CqXC1tbs.mjs +0 -99
- package/dist/run-alchemy-pANK8XNX-CqXC1tbs.mjs.map +0 -1
- package/dist/run-alchemy-pANK8XNX-T_pHNDBo.mjs +0 -99
- package/dist/run-alchemy-pANK8XNX-T_pHNDBo.mjs.map +0 -1
- package/dist/shared-BAIiDgXa-DYP7EOSk.mjs +0 -33
- package/dist/shared-BAIiDgXa-DYP7EOSk.mjs.map +0 -1
|
@@ -55,6 +55,93 @@ var InternalError = class extends Error {
|
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
//#endregion
|
|
58
|
+
//#region ../../0-framework/0-foundation/foundation/dist/result.mjs
|
|
59
|
+
/**
|
|
60
|
+
* Generic Result type for representing success or failure outcomes.
|
|
61
|
+
*
|
|
62
|
+
* This is the standard way to return "expected failures" as values rather than
|
|
63
|
+
* throwing exceptions. See docs/Error Handling.md for the full taxonomy.
|
|
64
|
+
*
|
|
65
|
+
* Naming rationale:
|
|
66
|
+
* - `Ok<T>` / `NotOk<F>` mirror the `ok: true/false` discriminator
|
|
67
|
+
* - `NotOk` avoids collision with domain types like "Failure" or "Error"
|
|
68
|
+
* - `failure` property distinguishes from JS Error semantics
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* Result class that implements both Ok and NotOk variants.
|
|
72
|
+
*/
|
|
73
|
+
var ResultImpl = class ResultImpl {
|
|
74
|
+
ok;
|
|
75
|
+
_value;
|
|
76
|
+
_failure;
|
|
77
|
+
constructor(ok, valueOrFailure) {
|
|
78
|
+
this.ok = ok;
|
|
79
|
+
if (ok) this._value = blindCast(valueOrFailure);
|
|
80
|
+
else this._failure = blindCast(valueOrFailure);
|
|
81
|
+
Object.freeze(this);
|
|
82
|
+
}
|
|
83
|
+
get value() {
|
|
84
|
+
if (!this.ok) throw new InternalError("Cannot access value on NotOk result");
|
|
85
|
+
return this._value;
|
|
86
|
+
}
|
|
87
|
+
get failure() {
|
|
88
|
+
if (this.ok) throw new InternalError("Cannot access failure on Ok result");
|
|
89
|
+
return this._failure;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Creates a successful result.
|
|
93
|
+
*/
|
|
94
|
+
static ok(value) {
|
|
95
|
+
return blindCast(new ResultImpl(true, value));
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Creates an unsuccessful result.
|
|
99
|
+
*/
|
|
100
|
+
static notOk(failure) {
|
|
101
|
+
return blindCast(new ResultImpl(false, failure));
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Asserts that this result is Ok and returns the value.
|
|
105
|
+
* Throws if the result is NotOk.
|
|
106
|
+
*/
|
|
107
|
+
assertOk() {
|
|
108
|
+
if (!this.ok) throw new InternalError("Expected Ok result but got NotOk");
|
|
109
|
+
return this.value;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Asserts that this result is NotOk and returns the failure.
|
|
113
|
+
* Throws if the result is Ok.
|
|
114
|
+
*/
|
|
115
|
+
assertNotOk() {
|
|
116
|
+
if (this.ok) throw new InternalError("Expected NotOk result but got Ok");
|
|
117
|
+
return this.failure;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Creates a successful result.
|
|
122
|
+
*/
|
|
123
|
+
function ok(value) {
|
|
124
|
+
return ResultImpl.ok(value);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Creates an unsuccessful result.
|
|
128
|
+
*/
|
|
129
|
+
function notOk(failure) {
|
|
130
|
+
return ResultImpl.notOk(failure);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Singleton for void success results.
|
|
134
|
+
* Use this for validation checks that don't produce a value.
|
|
135
|
+
*/
|
|
136
|
+
const OK_VOID = ResultImpl.ok(void 0);
|
|
137
|
+
/**
|
|
138
|
+
* Returns a successful void result.
|
|
139
|
+
* Use this for validation checks that don't produce a value.
|
|
140
|
+
*/
|
|
141
|
+
function okVoid() {
|
|
142
|
+
return OK_VOID;
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
58
145
|
//#region ../../0-framework/0-foundation/foundation/dist/errors.mjs
|
|
59
146
|
/**
|
|
60
147
|
* Returns an object with the key/value if value is defined, otherwise an empty object.
|
|
@@ -340,93 +427,6 @@ function checkComposerConfig(raw, configFile) {
|
|
|
340
427
|
};
|
|
341
428
|
}
|
|
342
429
|
//#endregion
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Generic Result type for representing success or failure outcomes.
|
|
346
|
-
*
|
|
347
|
-
* This is the standard way to return "expected failures" as values rather than
|
|
348
|
-
* throwing exceptions. See docs/Error Handling.md for the full taxonomy.
|
|
349
|
-
*
|
|
350
|
-
* Naming rationale:
|
|
351
|
-
* - `Ok<T>` / `NotOk<F>` mirror the `ok: true/false` discriminator
|
|
352
|
-
* - `NotOk` avoids collision with domain types like "Failure" or "Error"
|
|
353
|
-
* - `failure` property distinguishes from JS Error semantics
|
|
354
|
-
*/
|
|
355
|
-
/**
|
|
356
|
-
* Result class that implements both Ok and NotOk variants.
|
|
357
|
-
*/
|
|
358
|
-
var ResultImpl = class ResultImpl {
|
|
359
|
-
ok;
|
|
360
|
-
_value;
|
|
361
|
-
_failure;
|
|
362
|
-
constructor(ok, valueOrFailure) {
|
|
363
|
-
this.ok = ok;
|
|
364
|
-
if (ok) this._value = blindCast(valueOrFailure);
|
|
365
|
-
else this._failure = blindCast(valueOrFailure);
|
|
366
|
-
Object.freeze(this);
|
|
367
|
-
}
|
|
368
|
-
get value() {
|
|
369
|
-
if (!this.ok) throw new InternalError("Cannot access value on NotOk result");
|
|
370
|
-
return this._value;
|
|
371
|
-
}
|
|
372
|
-
get failure() {
|
|
373
|
-
if (this.ok) throw new InternalError("Cannot access failure on Ok result");
|
|
374
|
-
return this._failure;
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* Creates a successful result.
|
|
378
|
-
*/
|
|
379
|
-
static ok(value) {
|
|
380
|
-
return blindCast(new ResultImpl(true, value));
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Creates an unsuccessful result.
|
|
384
|
-
*/
|
|
385
|
-
static notOk(failure) {
|
|
386
|
-
return blindCast(new ResultImpl(false, failure));
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Asserts that this result is Ok and returns the value.
|
|
390
|
-
* Throws if the result is NotOk.
|
|
391
|
-
*/
|
|
392
|
-
assertOk() {
|
|
393
|
-
if (!this.ok) throw new InternalError("Expected Ok result but got NotOk");
|
|
394
|
-
return this.value;
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* Asserts that this result is NotOk and returns the failure.
|
|
398
|
-
* Throws if the result is Ok.
|
|
399
|
-
*/
|
|
400
|
-
assertNotOk() {
|
|
401
|
-
if (this.ok) throw new InternalError("Expected NotOk result but got Ok");
|
|
402
|
-
return this.failure;
|
|
403
|
-
}
|
|
404
|
-
};
|
|
405
|
-
/**
|
|
406
|
-
* Creates a successful result.
|
|
407
|
-
*/
|
|
408
|
-
function ok(value) {
|
|
409
|
-
return ResultImpl.ok(value);
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
* Creates an unsuccessful result.
|
|
413
|
-
*/
|
|
414
|
-
function notOk(failure) {
|
|
415
|
-
return ResultImpl.notOk(failure);
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* Singleton for void success results.
|
|
419
|
-
* Use this for validation checks that don't produce a value.
|
|
420
|
-
*/
|
|
421
|
-
const OK_VOID = ResultImpl.ok(void 0);
|
|
422
|
-
/**
|
|
423
|
-
* Returns a successful void result.
|
|
424
|
-
* Use this for validation checks that don't produce a value.
|
|
425
|
-
*/
|
|
426
|
-
function okVoid() {
|
|
427
|
-
return OK_VOID;
|
|
428
|
-
}
|
|
429
|
-
//#endregion
|
|
430
|
-
export { configFileMissing as a, CliStructuredError as c, checkComposerConfig as i, InternalError as l, ok as n, noComposerExportMessage as o, okVoid as r, sectionMissing as s, notOk as t, blindCast as u };
|
|
430
|
+
export { CliStructuredError as a, okVoid as c, sectionMissing as i, InternalError as l, configFileMissing as n, notOk as o, noComposerExportMessage as r, ok as s, checkComposerConfig as t, blindCast as u };
|
|
431
431
|
|
|
432
|
-
//# sourceMappingURL=
|
|
432
|
+
//# sourceMappingURL=composer-config-CY9fET8H-KpGjlYgO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composer-config-CY9fET8H-KpGjlYgO.mjs","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/casts-DpaahrlC.mjs","../../../0-framework/0-foundation/foundation/dist/internal-error-Dfur7Zqt.mjs","../../../0-framework/0-foundation/foundation/dist/result.mjs","../../../0-framework/0-foundation/foundation/dist/errors.mjs","../../../0-framework/3-tooling/cli/dist/composer-config-CY9fET8H.mjs"],"sourcesContent":["//#region src/casts.ts\n/**\n* **Last-resort escape hatch for unsafe type assertions. Not a sanctioned tool to reach for.**\n*\n* Before reaching for `blindCast`, **rewrite the surrounding code so the cast becomes\n* unnecessary**: tighten an input type, add a runtime check that narrows via a type\n* predicate, restructure a generic so the compiler can see the relationship you're\n* asserting, or use {@link castAs} when the value already satisfies the target type.\n* Only when no rewrite is feasible does `blindCast` become the right answer — and at\n* that point, the `Reason` literal you supply must articulate the compromise in\n* language a reviewer can evaluate.\n*\n* The reviewer **will** validate the `Reason`. If it doesn't hold up under scrutiny,\n* that is not a signal to soften the reason; it is a signal to go back and solve the\n* underlying type-system problem properly. An unconvincing justification is rework,\n* not a free pass.\n*\n* `blindCast` is the auditable form of `as Foo` / `as unknown as Foo`: it bypasses\n* the compiler's checks (the input type is `unknown`, the output type is whatever the\n* caller asks for), but it forces the unsafety to be named at the call site instead of\n* smuggled in via a bare `as`. The `Reason` type parameter exists only at compile\n* time — it is not present in the emitted JavaScript — but it is grep-able and\n* visible to future readers.\n*\n* @example\n* ```typescript\n* const stringValue = blindCast<\n* string,\n* \"JSON.parse returns `unknown`; this field is documented to be a string in the API contract\"\n* >(parsed[key]);\n* ```\n*\n* @typeParam TargetType - The type the caller is asserting the input has.\n* @typeParam _Reason - A string literal describing why bypassing the type system is necessary here.\n* Only meaningful at compile time. The reviewer evaluates whether it justifies the unsafety.\n*/\nfunction blindCast(input) {\n\treturn input;\n}\n/**\n* Type-checked, runtime pass-through alternative to a bare `as Type` cast.\n*\n* Use `castAs` when the value already satisfies the target type but you want to make\n* the type assertion explicit at the call site — for example, when an inferred type is\n* wider than the type you want to publish, or when a literal object should be tagged\n* with its nominal interface. Unlike {@link blindCast}, the compiler still checks that\n* the value is assignable to the target type, so this helper cannot smuggle in an\n* unsafe assertion.\n*\n* `castAs` exists alongside `blindCast` so authors pick the right name at the call\n* site: a `castAs` is type-checked and benign; a `blindCast` is the unsafe escape\n* hatch. The split makes review faster — readers know which casts to scrutinize and\n* which are pure annotations.\n*\n* @example\n* ```typescript\n* interface FancyObject {\n* key: string;\n* keyTwo: {\n* subKey: string;\n* subKeyTwo: number;\n* };\n* }\n*\n* const typedObject = castAs<FancyObject>({\n* key: 'Chookede',\n* keyTwo: {\n* subKey: 'Choookeeeee',\n* subKeyTwo: 2,\n* },\n* });\n* ```\n*\n* @typeParam Type - The type to constrain and tag the value with. The value must be assignable to `Type`.\n*/\nfunction castAs(value) {\n\treturn value;\n}\n//#endregion\nexport { castAs as n, blindCast as t };\n\n//# sourceMappingURL=casts-DpaahrlC.mjs.map","//#region src/internal-error.ts\n/**\n* A bug in Prisma ORM, not a user error. Never catch this except at the\n* outermost boundary for crash reporting — an InternalError means an invariant\n* broke and the process cannot reliably continue. User-facing failures use\n* `structuredError` with a dotted code instead.\n*/\nvar InternalError = class extends Error {\n\tisPrismaInternalError = true;\n\tconstructor(message, options) {\n\t\tsuper(message, options?.cause !== void 0 ? { cause: options.cause } : void 0);\n\t\tthis.name = \"InternalError\";\n\t}\n};\nfunction isInternalError(e) {\n\treturn typeof e === \"object\" && e !== null && \"isPrismaInternalError\" in e && e.isPrismaInternalError === true;\n}\nfunction assertNever(value, message) {\n\tthrow new InternalError(message ?? `Unreachable: unexpected value ${String(value)}`);\n}\n//#endregion\nexport { assertNever as n, isInternalError as r, InternalError as t };\n\n//# sourceMappingURL=internal-error-Dfur7Zqt.mjs.map","import { t as blindCast } from \"./casts-DpaahrlC.mjs\";\nimport { t as InternalError } from \"./internal-error-Dfur7Zqt.mjs\";\n//#region src/result.ts\n/**\n* Generic Result type for representing success or failure outcomes.\n*\n* This is the standard way to return \"expected failures\" as values rather than\n* throwing exceptions. See docs/Error Handling.md for the full taxonomy.\n*\n* Naming rationale:\n* - `Ok<T>` / `NotOk<F>` mirror the `ok: true/false` discriminator\n* - `NotOk` avoids collision with domain types like \"Failure\" or \"Error\"\n* - `failure` property distinguishes from JS Error semantics\n*/\n/**\n* Result class that implements both Ok and NotOk variants.\n*/\nvar ResultImpl = class ResultImpl {\n\tok;\n\t_value;\n\t_failure;\n\tconstructor(ok, valueOrFailure) {\n\t\tthis.ok = ok;\n\t\tif (ok) this._value = blindCast(valueOrFailure);\n\t\telse this._failure = blindCast(valueOrFailure);\n\t\tObject.freeze(this);\n\t}\n\tget value() {\n\t\tif (!this.ok) throw new InternalError(\"Cannot access value on NotOk result\");\n\t\treturn this._value;\n\t}\n\tget failure() {\n\t\tif (this.ok) throw new InternalError(\"Cannot access failure on Ok result\");\n\t\treturn this._failure;\n\t}\n\t/**\n\t* Creates a successful result.\n\t*/\n\tstatic ok(value) {\n\t\treturn blindCast(new ResultImpl(true, value));\n\t}\n\t/**\n\t* Creates an unsuccessful result.\n\t*/\n\tstatic notOk(failure) {\n\t\treturn blindCast(new ResultImpl(false, failure));\n\t}\n\t/**\n\t* Asserts that this result is Ok and returns the value.\n\t* Throws if the result is NotOk.\n\t*/\n\tassertOk() {\n\t\tif (!this.ok) throw new InternalError(\"Expected Ok result but got NotOk\");\n\t\treturn this.value;\n\t}\n\t/**\n\t* Asserts that this result is NotOk and returns the failure.\n\t* Throws if the result is Ok.\n\t*/\n\tassertNotOk() {\n\t\tif (this.ok) throw new InternalError(\"Expected NotOk result but got Ok\");\n\t\treturn this.failure;\n\t}\n};\n/**\n* Creates a successful result.\n*/\nfunction ok(value) {\n\treturn ResultImpl.ok(value);\n}\n/**\n* Creates an unsuccessful result.\n*/\nfunction notOk(failure) {\n\treturn ResultImpl.notOk(failure);\n}\n/**\n* Singleton for void success results.\n* Use this for validation checks that don't produce a value.\n*/\nconst OK_VOID = ResultImpl.ok(void 0);\n/**\n* Returns a successful void result.\n* Use this for validation checks that don't produce a value.\n*/\nfunction okVoid() {\n\treturn OK_VOID;\n}\n//#endregion\nexport { notOk, ok, okVoid };\n\n//# sourceMappingURL=result.mjs.map","import { t as blindCast } from \"./casts-DpaahrlC.mjs\";\nimport { n as assertNever, r as isInternalError, t as InternalError } from \"./internal-error-Dfur7Zqt.mjs\";\n//#region src/defined.ts\n/**\n* Returns an object with the key/value if value is defined, otherwise an empty object.\n*\n* Use with spread to conditionally include optional properties while satisfying\n* exactOptionalPropertyTypes. This is explicit about which properties are optional\n* and won't inadvertently strip other undefined values.\n*\n* @example\n* ```typescript\n* // Instead of:\n* const obj = {\n* required: 'value',\n* ...(optional ? { optional } : {}),\n* };\n*\n* // Use:\n* const obj = {\n* required: 'value',\n* ...ifDefined('optional', optional),\n* };\n* ```\n*/\nfunction ifDefined(key, value) {\n\treturn value !== void 0 ? blindCast({ [key]: value }) : {};\n}\n//#endregion\n//#region src/cli-structured-error.ts\n/**\n* Structured CLI error that contains all information needed for error envelopes.\n* Call sites throw these errors with full context.\n*\n* A `CliStructuredError` is a `StructuredError` (see\n* `./structured-error.ts`): `code` is a dotted\n* `NAMESPACE.SUBCODE` string, and the namespace prefix is the error's\n* category — there is no separate `domain` field. See ADR 239 in\n* prisma/prisma and composer's ADR-0044 for the namespace taxonomy.\n*/\nvar CliStructuredError = class extends Error {\n\tcode;\n\tseverity;\n\tconstructor(code, summary, options) {\n\t\tsuper(summary, options?.cause !== void 0 ? { cause: options.cause } : void 0);\n\t\tthis.name = \"CliStructuredError\";\n\t\tthis.code = code;\n\t\tthis.severity = options?.severity ?? \"error\";\n\t\tconst fix = options?.fix === options?.why ? void 0 : options?.fix;\n\t\tconst where = options?.where ? {\n\t\t\t...ifDefined(\"path\", options.where.path),\n\t\t\t...ifDefined(\"line\", options.where.line)\n\t\t} : void 0;\n\t\tObject.assign(this, {\n\t\t\t...ifDefined(\"why\", options?.why),\n\t\t\t...ifDefined(\"fix\", fix),\n\t\t\t...ifDefined(\"where\", where),\n\t\t\t...ifDefined(\"meta\", options?.meta),\n\t\t\t...ifDefined(\"docsUrl\", options?.docsUrl)\n\t\t});\n\t}\n\t/**\n\t* Converts this error to a CLI error envelope for output formatting.\n\t*/\n\ttoEnvelope() {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tcode: this.code,\n\t\t\tseverity: this.severity,\n\t\t\tsummary: this.message,\n\t\t\t...ifDefined(\"why\", this.why),\n\t\t\t...ifDefined(\"fix\", this.fix),\n\t\t\t...ifDefined(\"where\", this.where),\n\t\t\t...ifDefined(\"meta\", this.meta),\n\t\t\t...ifDefined(\"docsUrl\", this.docsUrl)\n\t\t};\n\t}\n\t/**\n\t* Type guard to check if an error is a CliStructuredError.\n\t* Uses duck-typing to work across module boundaries where instanceof may fail.\n\t*/\n\tstatic is(error) {\n\t\tif (!(error instanceof Error)) return false;\n\t\tconst candidate = blindCast(error);\n\t\treturn candidate.name === \"CliStructuredError\" && typeof candidate.code === \"string\" && typeof candidate.toEnvelope === \"function\";\n\t}\n};\n//#endregion\n//#region src/structured-error.ts\nconst STRUCTURED_CODE_RE = /^[A-Z][A-Z0-9]*\\.[A-Z][A-Z0-9_]*$/;\nfunction isStructuredError(e) {\n\treturn typeof e === \"object\" && e !== null && \"code\" in e && typeof e.code === \"string\" && STRUCTURED_CODE_RE.test(e.code) && \"message\" in e && typeof e.message === \"string\";\n}\nfunction structuredError(code, message, options) {\n\tconst error = options?.cause !== void 0 ? new Error(message, { cause: options.cause }) : new Error(message);\n\tObject.defineProperty(error, \"name\", {\n\t\tvalue: \"StructuredError\",\n\t\tconfigurable: true\n\t});\n\treturn Object.assign(error, {\n\t\tcode,\n\t\t...ifDefined(\"why\", options?.why),\n\t\t...ifDefined(\"fix\", options?.fix),\n\t\t...ifDefined(\"where\", options?.where),\n\t\t...ifDefined(\"severity\", options?.severity),\n\t\t...ifDefined(\"meta\", options?.meta),\n\t\t...ifDefined(\"docsUrl\", options?.docsUrl)\n\t});\n}\nconst DOCS_BASE = `https://docs.prisma.io/docs/orm/next/reference/error-reference`;\nfunction docsUrlFor(code) {\n\treturn `${DOCS_BASE}#${code}`;\n}\n//#endregion\nexport { CliStructuredError, DOCS_BASE, InternalError, assertNever, docsUrlFor, isInternalError, isStructuredError, structuredError };\n\n//# sourceMappingURL=errors.mjs.map","import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n//#region src/composer-config.ts\n/**\n* What makes a `composer` section valid, shared by the CLI's section validator and the programmatic operations.\n* It imports nothing from the CLI engine, because `@prisma/composer` must not depend on it.\n*/\nconst SECTION_FIX = \"Write `composer: composer({ extensions: [...], state: ... })` in prisma.config.ts, with `import { defineConfig as composer } from '@prisma/composer/config'`.\";\nconst MOVE_TO_SECTION_FIX = `${SECTION_FIX} If the project has a prisma-composer.config.ts, move its extensions and state into that section and delete the file.`;\nconst SECTION_IS_THE_ONLY_SOURCE = \"Composer reads its configuration only from the `composer` section of prisma.config.ts.\";\nconst DESCRIPTOR_FIX = \"Use the descriptor the extension factory returns, unchanged, instead of building one by hand.\";\nconst RETIRED_FILE_NAMES = [\n\t\"ts\",\n\t\"mts\",\n\t\"mjs\",\n\t\"js\"\n].map((extension) => `prisma-composer.config.${extension}`);\nconst sectionMissing = {\n\tcode: \"CONFIG.SECTION_MISSING\",\n\tsummary: \"No loaded prisma.config.ts declares a `composer` section.\",\n\twhy: `${SECTION_IS_THE_ONLY_SOURCE} A prisma-composer.config.ts file is no longer read.`,\n\tfix: MOVE_TO_SECTION_FIX\n};\n/** What the generated stack file throws when the file it imports has no `composer` export. */\nfunction noComposerExportMessage(configFile) {\n\treturn `${configFile} declares no \\`composer\\` section. Pass the prisma.config.ts that declares it.`;\n}\nfunction configFileMissing(file) {\n\treturn {\n\t\tcode: \"CONFIG.FILE_MISSING\",\n\t\tsummary: `${file} does not exist.`,\n\t\tfix: \"Pass the path of the prisma.config.ts that declares the `composer` section.\",\n\t\twhere: file\n\t};\n}\n/** A prisma-composer.config.* beside the declaring file would otherwise be silently ignored. */\n/** The path with symlinks resolved; the path itself when it cannot be resolved, so the check never throws. */\nfunction realPath(file) {\n\ttry {\n\t\treturn fs.realpathSync(file);\n\t} catch {\n\t\treturn file;\n\t}\n}\nfunction retiredFileFinding(configFile) {\n\tconst directory = path.dirname(realPath(configFile));\n\tconst found = RETIRED_FILE_NAMES.map((name) => path.join(directory, name)).find((file) => fs.existsSync(file));\n\tif (found === void 0) return void 0;\n\treturn {\n\t\tcode: \"CONFIG.FILE_RETIRED\",\n\t\tsummary: `${found} is no longer read.`,\n\t\twhy: SECTION_IS_THE_ONLY_SOURCE,\n\t\tfix: MOVE_TO_SECTION_FIX,\n\t\twhere: found\n\t};\n}\nfunction isObject(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction isExtensionDescriptor(value) {\n\treturn isObject(value) && typeof value[\"id\"] === \"string\" && value[\"id\"].length > 0 && isObject(value[\"nodes\"]);\n}\nfunction isStateDescriptor(value) {\n\treturn isObject(value) && typeof value[\"extension\"] === \"string\" && typeof value[\"create\"] === \"function\";\n}\nconst stateInvalid = {\n\tcode: \"CONFIG.FIELD_INVALID\",\n\tsummary: \"`composer.state` must be a state descriptor with a string `extension` and a `create` function.\",\n\tfix: \"Set `state` to the state descriptor an extension provides, e.g. `state: prismaState()`.\",\n\tfield: \"state\"\n};\nfunction unknownField(key) {\n\treturn {\n\t\tcode: \"CONFIG.FIELD_UNKNOWN\",\n\t\tsummary: `The \\`composer\\` section has no field \\`${key}\\`.`,\n\t\tfix: key === \"composer\" ? \"Pass the `composer` property of the prisma.config.ts export, not the whole export. The section takes only `extensions` and `state`.\" : `Remove \\`${key}\\`. The section takes only \\`extensions\\` and \\`state\\`.`,\n\t\tfield: key\n\t};\n}\nfunction checkExtensions(value) {\n\tif (!Array.isArray(value)) return {\n\t\textensions: [],\n\t\tfindings: [{\n\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\tsummary: \"`composer.extensions` must be an array of extension descriptors.\",\n\t\t\tfix: \"Set `extensions` to the descriptors your extensions provide, e.g. `extensions: [nodeBuild()]`.\",\n\t\t\tfield: \"extensions\"\n\t\t}]\n\t};\n\tconst findings = [];\n\tconst extensions = [];\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const [index, entry] of value.entries()) {\n\t\tconst field = `extensions[${index}]`;\n\t\tif (!isObject(entry)) {\n\t\t\tfindings.push({\n\t\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\t\tsummary: `\\`composer.${field}\\` must be an extension descriptor object.`,\n\t\t\t\tfix: \"Put the descriptor an extension factory returns here, e.g. `nodeBuild()`, not the factory itself.\",\n\t\t\t\tfield\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst id = entry[\"id\"];\n\t\tif (typeof id !== \"string\" || id.length === 0) findings.push({\n\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\tsummary: `\\`composer.${field}.id\\` must be a non-empty string (the extension package name).`,\n\t\t\tfix: DESCRIPTOR_FIX,\n\t\t\tfield: `${field}.id`\n\t\t});\n\t\telse if (seen.has(id)) findings.push({\n\t\t\tcode: \"CONFIG.EXTENSION_DUPLICATE\",\n\t\t\tsummary: `Extension \"${id}\" is listed more than once in \\`composer.extensions\\`.`,\n\t\t\tfix: `Remove the repeated \"${id}\" entry from \\`extensions\\`.`,\n\t\t\tfield: `${field}.id`\n\t\t});\n\t\telse seen.add(id);\n\t\tif (!isObject(entry[\"nodes\"])) findings.push({\n\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\tsummary: `\\`composer.${field}.nodes\\` must be an object (the node-ID → control registry).`,\n\t\t\tfix: DESCRIPTOR_FIX,\n\t\t\tfield: `${field}.nodes`\n\t\t});\n\t\tif (isExtensionDescriptor(entry)) extensions.push(entry);\n\t}\n\treturn {\n\t\tfindings,\n\t\textensions\n\t};\n}\nfunction checkFields(section) {\n\tif (Object.hasOwn(section, \"configPath\")) return {\n\t\tok: false,\n\t\tfindings: [{\n\t\t\tcode: \"CONFIG.FIELD_RETIRED\",\n\t\t\tsummary: \"`composer.configPath` is no longer supported: prisma-composer.config.ts is no longer read.\",\n\t\t\twhy: SECTION_IS_THE_ONLY_SOURCE,\n\t\t\tfix: `Replace \\`configPath\\` with the section itself. ${MOVE_TO_SECTION_FIX}`,\n\t\t\tfield: \"configPath\"\n\t\t}]\n\t};\n\tif (Object.hasOwn(section, \"composer\")) return {\n\t\tok: false,\n\t\tfindings: [unknownField(\"composer\")]\n\t};\n\tconst findings = Object.keys(section).filter((key) => key !== \"extensions\" && key !== \"state\").map(unknownField);\n\tconst checked = checkExtensions(section[\"extensions\"]);\n\tfindings.push(...checked.findings);\n\tconst state = section[\"state\"];\n\tif (!isStateDescriptor(state)) findings.push(stateInvalid);\n\tconst [first, ...rest] = findings;\n\tif (first === void 0 && isStateDescriptor(state)) return {\n\t\tok: true,\n\t\tvalue: {\n\t\t\textensions: checked.extensions,\n\t\t\tstate\n\t\t}\n\t};\n\treturn {\n\t\tok: false,\n\t\tfindings: [first ?? stateInvalid, ...rest]\n\t};\n}\n/**\n* Checks the fields that identify each descriptor and returns the descriptors as the config file's own objects.\n* Never throws: a section's values are user code, and a throwing getter or Proxy trap becomes a finding.\n*/\nfunction checkComposerSection(raw) {\n\tif (!isObject(raw)) return {\n\t\tok: false,\n\t\tfindings: [{\n\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\tsummary: \"The `composer` section of prisma.config.ts must be an object.\",\n\t\t\tfix: SECTION_FIX\n\t\t}]\n\t};\n\ttry {\n\t\treturn checkFields({ ...raw });\n\t} catch (cause) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tfindings: [{\n\t\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\t\tsummary: \"The `composer` section of prisma.config.ts could not be read.\",\n\t\t\t\twhy: `Reading it threw: ${cause instanceof Error ? cause.message : String(cause)}`,\n\t\t\t\tfix: SECTION_FIX\n\t\t\t}]\n\t\t};\n\t}\n}\n/**\n* The whole check, shared by the section validator and the programmatic operations so both report the same findings in the same order: the retired file beside the declaring `configFile` (resolved through symlinks), then every field finding.\n*/\nfunction checkComposerConfig(raw, configFile) {\n\tconst retired = retiredFileFinding(configFile);\n\tconst checked = checkComposerSection(raw);\n\tif (retired === void 0) return checked;\n\treturn {\n\t\tok: false,\n\t\tfindings: checked.ok ? [retired] : [retired, ...checked.findings]\n\t};\n}\n//#endregion\nexport { sectionMissing as i, configFileMissing as n, noComposerExportMessage as r, checkComposerConfig as t };\n\n//# sourceMappingURL=composer-config-CY9fET8H.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAS,UAAU,OAAO;CACzB,OAAO;AACR;;;;;;;;;AC/BA,IAAI,gBAAgB,cAAc,MAAM;CACvC,wBAAwB;CACxB,YAAY,SAAS,SAAS;EAC7B,MAAM,SAAS,SAAS,UAAU,KAAK,IAAI,EAAE,OAAO,QAAQ,MAAM,IAAI,KAAK,CAAC;EAC5E,KAAK,OAAO;CACb;AACD;;;;;;;;;;;;;;;;;ACIA,IAAI,aAAa,MAAM,WAAW;CACjC;CACA;CACA;CACA,YAAY,IAAI,gBAAgB;EAC/B,KAAK,KAAK;EACV,IAAI,IAAI,KAAK,SAAS,UAAU,cAAc;OACzC,KAAK,WAAW,UAAU,cAAc;EAC7C,OAAO,OAAO,IAAI;CACnB;CACA,IAAI,QAAQ;EACX,IAAI,CAAC,KAAK,IAAI,MAAM,IAAI,cAAc,qCAAqC;EAC3E,OAAO,KAAK;CACb;CACA,IAAI,UAAU;EACb,IAAI,KAAK,IAAI,MAAM,IAAI,cAAc,oCAAoC;EACzE,OAAO,KAAK;CACb;;;;CAIA,OAAO,GAAG,OAAO;EAChB,OAAO,UAAU,IAAI,WAA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AAO;EACN,IAAI;EACJ,UAAU,CAAC,SAAS,cAAc,GAAG,IAAI;CAC1C;AACD;;;;;AAKA,SAAS,qBAAqB,KAAK;CAClC,IAAI,CAAC,SAAS,GAAG,GAAG,OAAO;EAC1B,IAAI;EACJ,UAAU,CAAC;GACV,MAAM;GACN,SAAS;GACT,KAAK;EACN,CAAC;CACF;CACA,IAAI;EACH,OAAO,YAAY,EAAE,GAAG,IAAI,CAAC;CAC9B,SAAS,OAAO;EACf,OAAO;GACN,IAAI;GACJ,UAAU,CAAC;IACV,MAAM;IACN,SAAS;IACT,KAAK,qBAAqB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;IAC/E,KAAK;GACN,CAAC;EACF;CACD;AACD;;;;AAIA,SAAS,oBAAoB,KAAK,YAAY;CAC7C,MAAM,UAAU,mBAAmB,UAAU;CAC7C,MAAM,UAAU,qBAAqB,GAAG;CACxC,IAAI,YAAY,KAAK,GAAG,OAAO;CAC/B,OAAO;EACN,IAAI;EACJ,UAAU,QAAQ,KAAK,CAAC,OAAO,IAAI,CAAC,SAAS,GAAG,QAAQ,QAAQ;CACjE;AACD"}
|
|
@@ -1,9 +1,57 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as CliStructuredError, l as InternalError, n as configFileMissing, t as checkComposerConfig, u as blindCast } from "./composer-config-CY9fET8H-KpGjlYgO.mjs";
|
|
2
2
|
import * as mod from "node:module";
|
|
3
3
|
import * as fs from "node:fs";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import * as path from "node:path";
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
|
+
//#region ../../0-framework/3-tooling/assemble/dist/index.mjs
|
|
8
|
+
/**
|
|
9
|
+
* A user-facing assembly failure, structured at origin (base-type rule 6):
|
|
10
|
+
* a `CliStructuredError` whose code names which way assembly went wrong.
|
|
11
|
+
* This package's second consumer is the programmatic deploy API, not just
|
|
12
|
+
* the CLI — hosts branch on `error.code`, the CLI renders the envelope.
|
|
13
|
+
*/
|
|
14
|
+
var AssembleError = class extends CliStructuredError {
|
|
15
|
+
constructor(code, summary, options) {
|
|
16
|
+
super(code, summary, options);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The registry route for one service's build: extension by
|
|
21
|
+
* `build.extension`, node descriptor by `build.type`, kind must be "build".
|
|
22
|
+
* The CLI's coverage validation reports the same misses earlier with the
|
|
23
|
+
* config fix; these errors are the backstop for programmatic callers.
|
|
24
|
+
*/
|
|
25
|
+
function buildDescriptorAssemble(config, node, address, cwd) {
|
|
26
|
+
const { extension, type } = node.build;
|
|
27
|
+
const extensionDescriptor = config.extensions.find((candidate) => candidate.id === extension);
|
|
28
|
+
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 `extensions` in the `composer` section of prisma.config.ts." });
|
|
29
|
+
const nodeDescriptor = extensionDescriptor.nodes[type];
|
|
30
|
+
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(", ")}.` });
|
|
31
|
+
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." });
|
|
32
|
+
return nodeDescriptor.assemble({
|
|
33
|
+
build: node.build,
|
|
34
|
+
address,
|
|
35
|
+
cwd
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
async function assembleServices(graph, config, cwd, run) {
|
|
39
|
+
const runAssembler = run ?? ((node, address, nodeCwd) => buildDescriptorAssemble(config, node, address, nodeCwd));
|
|
40
|
+
const serviceNodes = graph.nodes.filter((n) => n.node.kind === "service");
|
|
41
|
+
if (serviceNodes.length === 0) throw new AssembleError("ASSEMBLE.SERVICE_MISSING", "The loaded graph has no service to assemble.");
|
|
42
|
+
const bundles = {};
|
|
43
|
+
for (const { id, node } of serviceNodes) try {
|
|
44
|
+
bundles[id] = await runAssembler(node, id, cwd);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (CliStructuredError.is(error)) throw error;
|
|
47
|
+
throw new AssembleError("ASSEMBLE.BUILD_FAILED", error instanceof Error ? error.message : String(error), {
|
|
48
|
+
meta: { address: id },
|
|
49
|
+
cause: error
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return { bundles };
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
7
55
|
//#region ../../0-framework/1-core/core/dist/graph-BfKAg2Ap.mjs
|
|
8
56
|
/** The reserved name of a resource's single anonymous output port. Rejected as a user-declared port name (node.ts). */
|
|
9
57
|
const RESOURCE_OUT_PORT = "$out";
|
|
@@ -660,7 +708,7 @@ function Load(root, opts) {
|
|
|
660
708
|
}
|
|
661
709
|
blindCast(Symbol.for("prisma:secret-box"));
|
|
662
710
|
//#endregion
|
|
663
|
-
//#region ../../0-framework/3-tooling/cli/dist/
|
|
711
|
+
//#region ../../0-framework/3-tooling/cli/dist/pipeline-DYvl561J.mjs
|
|
664
712
|
/**
|
|
665
713
|
* Synchronous Node resolve hook so that entry modules may import relative
|
|
666
714
|
* files using the specifier forms TypeScript accepts by default —
|
|
@@ -804,56 +852,6 @@ async function loadEntry(entryArg, cwd) {
|
|
|
804
852
|
root: blindCast(root)
|
|
805
853
|
};
|
|
806
854
|
}
|
|
807
|
-
//#endregion
|
|
808
|
-
//#region ../../0-framework/3-tooling/assemble/dist/index.mjs
|
|
809
|
-
/**
|
|
810
|
-
* A user-facing assembly failure, structured at origin (base-type rule 6):
|
|
811
|
-
* a `CliStructuredError` whose code names which way assembly went wrong.
|
|
812
|
-
* This package's second consumer is the programmatic deploy API, not just
|
|
813
|
-
* the CLI — hosts branch on `error.code`, the CLI renders the envelope.
|
|
814
|
-
*/
|
|
815
|
-
var AssembleError = class extends CliStructuredError {
|
|
816
|
-
constructor(code, summary, options) {
|
|
817
|
-
super(code, summary, options);
|
|
818
|
-
}
|
|
819
|
-
};
|
|
820
|
-
/**
|
|
821
|
-
* The registry route for one service's build: extension by
|
|
822
|
-
* `build.extension`, node descriptor by `build.type`, kind must be "build".
|
|
823
|
-
* The CLI's coverage validation reports the same misses earlier with the
|
|
824
|
-
* config fix; these errors are the backstop for programmatic callers.
|
|
825
|
-
*/
|
|
826
|
-
function buildDescriptorAssemble(config, node, address, cwd) {
|
|
827
|
-
const { extension, type } = node.build;
|
|
828
|
-
const extensionDescriptor = config.extensions.find((candidate) => candidate.id === extension);
|
|
829
|
-
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 `extensions` in the `composer` section of prisma.config.ts." });
|
|
830
|
-
const nodeDescriptor = extensionDescriptor.nodes[type];
|
|
831
|
-
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(", ")}.` });
|
|
832
|
-
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." });
|
|
833
|
-
return nodeDescriptor.assemble({
|
|
834
|
-
build: node.build,
|
|
835
|
-
address,
|
|
836
|
-
cwd
|
|
837
|
-
});
|
|
838
|
-
}
|
|
839
|
-
async function assembleServices(graph, config, cwd, run) {
|
|
840
|
-
const runAssembler = run ?? ((node, address, nodeCwd) => buildDescriptorAssemble(config, node, address, nodeCwd));
|
|
841
|
-
const serviceNodes = graph.nodes.filter((n) => n.node.kind === "service");
|
|
842
|
-
if (serviceNodes.length === 0) throw new AssembleError("ASSEMBLE.SERVICE_MISSING", "The loaded graph has no service to assemble.");
|
|
843
|
-
const bundles = {};
|
|
844
|
-
for (const { id, node } of serviceNodes) try {
|
|
845
|
-
bundles[id] = await runAssembler(node, id, cwd);
|
|
846
|
-
} catch (error) {
|
|
847
|
-
if (CliStructuredError.is(error)) throw error;
|
|
848
|
-
throw new AssembleError("ASSEMBLE.BUILD_FAILED", error instanceof Error ? error.message : String(error), {
|
|
849
|
-
meta: { address: id },
|
|
850
|
-
cause: error
|
|
851
|
-
});
|
|
852
|
-
}
|
|
853
|
-
return { bundles };
|
|
854
|
-
}
|
|
855
|
-
//#endregion
|
|
856
|
-
//#region ../../0-framework/3-tooling/cli/dist/pipeline-DAYhea3J.mjs
|
|
857
855
|
function lookup(extensions, extension, type, expectedKind, what) {
|
|
858
856
|
const ext = extensions.get(extension);
|
|
859
857
|
if (ext === void 0) throw new CliStructuredError("CONFIG.EXTENSION_MISSING", `No extension "${extension}" is configured (needed by ${what}).`, {
|
|
@@ -927,23 +925,6 @@ function checkConfigSource(source, cwd) {
|
|
|
927
925
|
};
|
|
928
926
|
}
|
|
929
927
|
/**
|
|
930
|
-
* The pipeline's front — entry load and name resolution —
|
|
931
|
-
* WITHOUT Load, coverage, or assemble. `log` needs only who the app is (its
|
|
932
|
-
* config and resolved name) to reach the already-running local instance; it
|
|
933
|
-
* neither builds nor provisions, so it must not require the user's built
|
|
934
|
-
* output the way the full pipeline does.
|
|
935
|
-
*/
|
|
936
|
-
async function resolveAppIdentity(entry, overrideName, cwd, config) {
|
|
937
|
-
const { value } = checkConfigSource(config, cwd);
|
|
938
|
-
const entryModule = await loadEntry(entry, cwd);
|
|
939
|
-
const name = overrideName ?? entryModule.root.name;
|
|
940
|
-
if (name.length === 0) throw new CliStructuredError("COMPOSE.NAME_MISSING", "The root node has no name.", { fix: "Name it at authoring, or pass --name." });
|
|
941
|
-
return {
|
|
942
|
-
config: value,
|
|
943
|
-
name
|
|
944
|
-
};
|
|
945
|
-
}
|
|
946
|
-
/**
|
|
947
928
|
* Runs entry load, Load, registry coverage, name resolution, and assemble — steps 1–5 of `run()`. `onAssembleError`, when
|
|
948
929
|
* given, lets a caller decorate an assemble failure with command-specific
|
|
949
930
|
* guidance (destroy's "build first" hint) without this shared step knowing
|
|
@@ -974,6 +955,37 @@ async function runPipeline(entry, overrideName, cwd, source, deps = {}, onAssemb
|
|
|
974
955
|
};
|
|
975
956
|
}
|
|
976
957
|
//#endregion
|
|
977
|
-
|
|
958
|
+
//#region ../../0-framework/1-core/core/dist/container-transport-HcvNOGZL.mjs
|
|
959
|
+
/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_PRISMA_CLOUD': uppercased, every non-alphanumeric run replaced by one underscore. */
|
|
960
|
+
function envVarSafeExtensionId(extensionId) {
|
|
961
|
+
return extensionId.toUpperCase().replace(/[^A-Z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
962
|
+
}
|
|
963
|
+
/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_CONTAINER_PRISMA_COMPOSER_PRISMA_CLOUD' */
|
|
964
|
+
function containerEnvVarName(extensionId) {
|
|
965
|
+
return `PRISMA_COMPOSER_CONTAINER_${envVarSafeExtensionId(extensionId)}`;
|
|
966
|
+
}
|
|
967
|
+
function collisionError(a, b, varName) {
|
|
968
|
+
return /* @__PURE__ */ new Error(`Extension ids "${a}" and "${b}" both map to the container transport variable "${varName}" — rename one of the extensions.`);
|
|
969
|
+
}
|
|
970
|
+
function emptySerializeError(extensionId) {
|
|
971
|
+
return /* @__PURE__ */ new Error(`Extension "${extensionId}"'s container instance serialized to an empty string — ContainerInstance.serialize() must return a non-empty string.`);
|
|
972
|
+
}
|
|
973
|
+
/** The env entries the CLI sets on the alchemy process: `{ [containerEnvVarName(id)]: instance.serialize() }` for every resolved instance. */
|
|
974
|
+
function containerEnv(instances) {
|
|
975
|
+
const env = {};
|
|
976
|
+
const ownerByVarName = /* @__PURE__ */ new Map();
|
|
977
|
+
for (const [extensionId, instance] of instances) {
|
|
978
|
+
const varName = containerEnvVarName(extensionId);
|
|
979
|
+
const owner = ownerByVarName.get(varName);
|
|
980
|
+
if (owner !== void 0) throw collisionError(owner, extensionId, varName);
|
|
981
|
+
ownerByVarName.set(varName, extensionId);
|
|
982
|
+
const serialized = instance.serialize();
|
|
983
|
+
if (serialized.length === 0) throw emptySerializeError(extensionId);
|
|
984
|
+
env[varName] = serialized;
|
|
985
|
+
}
|
|
986
|
+
return env;
|
|
987
|
+
}
|
|
988
|
+
//#endregion
|
|
989
|
+
export { envVarSafeExtensionId as n, runPipeline as r, containerEnv as t };
|
|
978
990
|
|
|
979
|
-
//# sourceMappingURL=
|
|
991
|
+
//# sourceMappingURL=container-transport-HcvNOGZL-CHqecFc7.mjs.map
|