@prisma/composer-cli 0.36.0-dev.2 → 0.36.0-dev.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/config-adapters-BA_IeiX0-CiRnz7z8.mjs +590 -0
  2. package/dist/config-adapters-BA_IeiX0-CiRnz7z8.mjs.map +1 -0
  3. package/dist/{dev-current-BNoPkDRU-D_UIh9Ne.mjs → dev-current-BurA9uhA-BWYAftn9.mjs} +6 -6
  4. package/dist/{dev-current-BNoPkDRU-D_UIh9Ne.mjs.map → dev-current-BurA9uhA-BWYAftn9.mjs.map} +1 -1
  5. package/dist/{dev-environment-name-6eEr5PW8-lIZmJjfr.mjs → dev-environment-name-6eEr5PW8-YyPDRApO.mjs} +2 -2
  6. package/dist/dev-environment-name-6eEr5PW8-YyPDRApO.mjs.map +1 -0
  7. package/dist/{dist-B9-nLeho.mjs → dist-BsONwZNR.mjs} +3 -6
  8. package/dist/{dist-B9-nLeho.mjs.map → dist-BsONwZNR.mjs.map} +1 -1
  9. package/dist/{execute-deploy-destroy-BIqwt1RF-DiqyXoh9.mjs → execute-deploy-destroy-Cww6zOSC-CmOmzLiB.mjs} +50 -11
  10. package/dist/execute-deploy-destroy-Cww6zOSC-CmOmzLiB.mjs.map +1 -0
  11. package/dist/{execute-dev-DIEyloWn-CBl6TlQ0.mjs → execute-dev-4KYkqSMh-uh7gnPyS.mjs} +33 -17
  12. package/dist/{execute-dev-DIEyloWn-CBl6TlQ0.mjs.map → execute-dev-4KYkqSMh-uh7gnPyS.mjs.map} +1 -1
  13. package/dist/{execute-dev-current-CeKI-tiC-BVg5a-5b.mjs → execute-dev-current-Cd4YEUZk-b2L-LwbT.mjs} +6 -6
  14. package/dist/{execute-dev-current-CeKI-tiC-BVg5a-5b.mjs.map → execute-dev-current-Cd4YEUZk-b2L-LwbT.mjs.map} +1 -1
  15. package/dist/{family-Dy3ZQOxG-BGwHvqM_.d.mts → family-DACJfaA5-CBuEC2B3.d.mts} +166 -71
  16. package/dist/family-DACJfaA5-CBuEC2B3.d.mts.map +1 -0
  17. package/dist/family.d.mts +1 -1
  18. package/dist/family.mjs +12 -4
  19. package/dist/family.mjs.map +1 -1
  20. package/dist/{generate-dev-stack-BkkU2HLE-Dek3CkAQ.mjs → generate-dev-stack-DS6U_JHX-wDTViqdg.mjs} +9 -4
  21. package/dist/generate-dev-stack-DS6U_JHX-wDTViqdg.mjs.map +1 -0
  22. package/dist/{list-deployed-s0gjqC-r.mjs → list-deployed-CH3SMsQ4.mjs} +4 -4
  23. package/dist/{list-deployed-s0gjqC-r.mjs.map → list-deployed-CH3SMsQ4.mjs.map} +1 -1
  24. package/dist/result-sR7PBi61.mjs +229 -0
  25. package/dist/result-sR7PBi61.mjs.map +1 -0
  26. package/dist/run-alchemy-B-Z6i3cD-f0MXFCG8.mjs +219 -0
  27. package/dist/run-alchemy-B-Z6i3cD-f0MXFCG8.mjs.map +1 -0
  28. package/dist/testing.d.mts +1 -1
  29. package/dist/testing.mjs +3 -2
  30. package/dist/testing.mjs.map +1 -1
  31. package/dist/{validate-environment-CEhUSEg2-ExABehBM.mjs → validate-environment-BNZC6W46-DY_7cPQJ.mjs} +529 -169
  32. package/dist/validate-environment-BNZC6W46-DY_7cPQJ.mjs.map +1 -0
  33. package/package.json +7 -7
  34. package/dist/dev-environment-name-6eEr5PW8-lIZmJjfr.mjs.map +0 -1
  35. package/dist/execute-deploy-destroy-BIqwt1RF-DiqyXoh9.mjs.map +0 -1
  36. package/dist/family-Dy3ZQOxG-BGwHvqM_.d.mts.map +0 -1
  37. package/dist/generate-dev-stack-BkkU2HLE-Dek3CkAQ.mjs.map +0 -1
  38. package/dist/run-alchemy-Dl_MWw4g-DaWV9tkH.mjs +0 -667
  39. package/dist/run-alchemy-Dl_MWw4g-DaWV9tkH.mjs.map +0 -1
  40. package/dist/validate-environment-CEhUSEg2-ExABehBM.mjs.map +0 -1
@@ -0,0 +1,229 @@
1
+ //#region ../../0-framework/0-foundation/foundation/dist/casts-DpaahrlC.mjs
2
+ /**
3
+ * **Last-resort escape hatch for unsafe type assertions. Not a sanctioned tool to reach for.**
4
+ *
5
+ * Before reaching for `blindCast`, **rewrite the surrounding code so the cast becomes
6
+ * unnecessary**: tighten an input type, add a runtime check that narrows via a type
7
+ * predicate, restructure a generic so the compiler can see the relationship you're
8
+ * asserting, or use {@link castAs} when the value already satisfies the target type.
9
+ * Only when no rewrite is feasible does `blindCast` become the right answer — and at
10
+ * that point, the `Reason` literal you supply must articulate the compromise in
11
+ * language a reviewer can evaluate.
12
+ *
13
+ * The reviewer **will** validate the `Reason`. If it doesn't hold up under scrutiny,
14
+ * that is not a signal to soften the reason; it is a signal to go back and solve the
15
+ * underlying type-system problem properly. An unconvincing justification is rework,
16
+ * not a free pass.
17
+ *
18
+ * `blindCast` is the auditable form of `as Foo` / `as unknown as Foo`: it bypasses
19
+ * the compiler's checks (the input type is `unknown`, the output type is whatever the
20
+ * caller asks for), but it forces the unsafety to be named at the call site instead of
21
+ * smuggled in via a bare `as`. The `Reason` type parameter exists only at compile
22
+ * time — it is not present in the emitted JavaScript — but it is grep-able and
23
+ * visible to future readers.
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * const stringValue = blindCast<
28
+ * string,
29
+ * "JSON.parse returns `unknown`; this field is documented to be a string in the API contract"
30
+ * >(parsed[key]);
31
+ * ```
32
+ *
33
+ * @typeParam TargetType - The type the caller is asserting the input has.
34
+ * @typeParam _Reason - A string literal describing why bypassing the type system is necessary here.
35
+ * Only meaningful at compile time. The reviewer evaluates whether it justifies the unsafety.
36
+ */
37
+ function blindCast(input) {
38
+ return input;
39
+ }
40
+ //#endregion
41
+ //#region ../../0-framework/0-foundation/foundation/dist/internal-error-Dfur7Zqt.mjs
42
+ /**
43
+ * A bug in Prisma ORM, not a user error. Never catch this except at the
44
+ * outermost boundary for crash reporting — an InternalError means an invariant
45
+ * broke and the process cannot reliably continue. User-facing failures use
46
+ * `structuredError` with a dotted code instead.
47
+ */
48
+ var InternalError = class extends Error {
49
+ isPrismaInternalError = true;
50
+ constructor(message, options) {
51
+ super(message, options?.cause !== void 0 ? { cause: options.cause } : void 0);
52
+ this.name = "InternalError";
53
+ }
54
+ };
55
+ //#endregion
56
+ //#region ../../0-framework/0-foundation/foundation/dist/errors.mjs
57
+ /**
58
+ * Returns an object with the key/value if value is defined, otherwise an empty object.
59
+ *
60
+ * Use with spread to conditionally include optional properties while satisfying
61
+ * exactOptionalPropertyTypes. This is explicit about which properties are optional
62
+ * and won't inadvertently strip other undefined values.
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * // Instead of:
67
+ * const obj = {
68
+ * required: 'value',
69
+ * ...(optional ? { optional } : {}),
70
+ * };
71
+ *
72
+ * // Use:
73
+ * const obj = {
74
+ * required: 'value',
75
+ * ...ifDefined('optional', optional),
76
+ * };
77
+ * ```
78
+ */
79
+ function ifDefined(key, value) {
80
+ return value !== void 0 ? blindCast({ [key]: value }) : {};
81
+ }
82
+ /**
83
+ * Structured CLI error that contains all information needed for error envelopes.
84
+ * Call sites throw these errors with full context.
85
+ *
86
+ * A `CliStructuredError` is a `StructuredError` (see
87
+ * `./structured-error.ts`): `code` is a dotted
88
+ * `NAMESPACE.SUBCODE` string, and the namespace prefix is the error's
89
+ * category — there is no separate `domain` field. See ADR 239 in
90
+ * prisma/prisma and composer's ADR-0044 for the namespace taxonomy.
91
+ */
92
+ var CliStructuredError = class extends Error {
93
+ code;
94
+ severity;
95
+ constructor(code, summary, options) {
96
+ super(summary, options?.cause !== void 0 ? { cause: options.cause } : void 0);
97
+ this.name = "CliStructuredError";
98
+ this.code = code;
99
+ this.severity = options?.severity ?? "error";
100
+ const fix = options?.fix === options?.why ? void 0 : options?.fix;
101
+ const where = options?.where ? {
102
+ ...ifDefined("path", options.where.path),
103
+ ...ifDefined("line", options.where.line)
104
+ } : void 0;
105
+ Object.assign(this, {
106
+ ...ifDefined("why", options?.why),
107
+ ...ifDefined("fix", fix),
108
+ ...ifDefined("where", where),
109
+ ...ifDefined("meta", options?.meta),
110
+ ...ifDefined("docsUrl", options?.docsUrl)
111
+ });
112
+ }
113
+ /**
114
+ * Converts this error to a CLI error envelope for output formatting.
115
+ */
116
+ toEnvelope() {
117
+ return {
118
+ ok: false,
119
+ code: this.code,
120
+ severity: this.severity,
121
+ summary: this.message,
122
+ ...ifDefined("why", this.why),
123
+ ...ifDefined("fix", this.fix),
124
+ ...ifDefined("where", this.where),
125
+ ...ifDefined("meta", this.meta),
126
+ ...ifDefined("docsUrl", this.docsUrl)
127
+ };
128
+ }
129
+ /**
130
+ * Type guard to check if an error is a CliStructuredError.
131
+ * Uses duck-typing to work across module boundaries where instanceof may fail.
132
+ */
133
+ static is(error) {
134
+ if (!(error instanceof Error)) return false;
135
+ const candidate = blindCast(error);
136
+ return candidate.name === "CliStructuredError" && typeof candidate.code === "string" && typeof candidate.toEnvelope === "function";
137
+ }
138
+ };
139
+ //#endregion
140
+ //#region ../../0-framework/0-foundation/foundation/dist/result.mjs
141
+ /**
142
+ * Generic Result type for representing success or failure outcomes.
143
+ *
144
+ * This is the standard way to return "expected failures" as values rather than
145
+ * throwing exceptions. See docs/Error Handling.md for the full taxonomy.
146
+ *
147
+ * Naming rationale:
148
+ * - `Ok<T>` / `NotOk<F>` mirror the `ok: true/false` discriminator
149
+ * - `NotOk` avoids collision with domain types like "Failure" or "Error"
150
+ * - `failure` property distinguishes from JS Error semantics
151
+ */
152
+ /**
153
+ * Result class that implements both Ok and NotOk variants.
154
+ */
155
+ var ResultImpl = class ResultImpl {
156
+ ok;
157
+ _value;
158
+ _failure;
159
+ constructor(ok, valueOrFailure) {
160
+ this.ok = ok;
161
+ if (ok) this._value = blindCast(valueOrFailure);
162
+ else this._failure = blindCast(valueOrFailure);
163
+ Object.freeze(this);
164
+ }
165
+ get value() {
166
+ if (!this.ok) throw new InternalError("Cannot access value on NotOk result");
167
+ return this._value;
168
+ }
169
+ get failure() {
170
+ if (this.ok) throw new InternalError("Cannot access failure on Ok result");
171
+ return this._failure;
172
+ }
173
+ /**
174
+ * Creates a successful result.
175
+ */
176
+ static ok(value) {
177
+ return blindCast(new ResultImpl(true, value));
178
+ }
179
+ /**
180
+ * Creates an unsuccessful result.
181
+ */
182
+ static notOk(failure) {
183
+ return blindCast(new ResultImpl(false, failure));
184
+ }
185
+ /**
186
+ * Asserts that this result is Ok and returns the value.
187
+ * Throws if the result is NotOk.
188
+ */
189
+ assertOk() {
190
+ if (!this.ok) throw new InternalError("Expected Ok result but got NotOk");
191
+ return this.value;
192
+ }
193
+ /**
194
+ * Asserts that this result is NotOk and returns the failure.
195
+ * Throws if the result is Ok.
196
+ */
197
+ assertNotOk() {
198
+ if (this.ok) throw new InternalError("Expected NotOk result but got Ok");
199
+ return this.failure;
200
+ }
201
+ };
202
+ /**
203
+ * Creates a successful result.
204
+ */
205
+ function ok(value) {
206
+ return ResultImpl.ok(value);
207
+ }
208
+ /**
209
+ * Creates an unsuccessful result.
210
+ */
211
+ function notOk(failure) {
212
+ return ResultImpl.notOk(failure);
213
+ }
214
+ /**
215
+ * Singleton for void success results.
216
+ * Use this for validation checks that don't produce a value.
217
+ */
218
+ const OK_VOID = ResultImpl.ok(void 0);
219
+ /**
220
+ * Returns a successful void result.
221
+ * Use this for validation checks that don't produce a value.
222
+ */
223
+ function okVoid() {
224
+ return OK_VOID;
225
+ }
226
+ //#endregion
227
+ export { InternalError as a, CliStructuredError as i, ok as n, blindCast as o, okVoid as r, notOk as t };
228
+
229
+ //# sourceMappingURL=result-sR7PBi61.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result-sR7PBi61.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/errors.mjs","../../../0-framework/0-foundation/foundation/dist/result.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 describeKind } from \"./describe-kind-Cpm_euxo.mjs\";\nimport { n as assertNever, r as isInternalError, t as InternalError } from \"./internal-error-Dfur7Zqt.mjs\";\n//#region src/defined.ts\n/**\n* Returns an object with the key/value if value is defined, otherwise an empty object.\n*\n* Use with spread to conditionally include optional properties while satisfying\n* exactOptionalPropertyTypes. This is explicit about which properties are optional\n* and won't inadvertently strip other undefined values.\n*\n* @example\n* ```typescript\n* // Instead of:\n* const obj = {\n* required: 'value',\n* ...(optional ? { optional } : {}),\n* };\n*\n* // Use:\n* const obj = {\n* required: 'value',\n* ...ifDefined('optional', optional),\n* };\n* ```\n*/\nfunction ifDefined(key, value) {\n\treturn value !== void 0 ? blindCast({ [key]: value }) : {};\n}\n//#endregion\n//#region src/cli-structured-error.ts\n/**\n* Structured CLI error that contains all information needed for error envelopes.\n* Call sites throw these errors with full context.\n*\n* A `CliStructuredError` is a `StructuredError` (see\n* `./structured-error.ts`): `code` is a dotted\n* `NAMESPACE.SUBCODE` string, and the namespace prefix is the error's\n* category — there is no separate `domain` field. See ADR 239 in\n* prisma/prisma and composer's ADR-0044 for the namespace taxonomy.\n*/\nvar CliStructuredError = class extends Error {\n\tcode;\n\tseverity;\n\tconstructor(code, summary, options) {\n\t\tsuper(summary, options?.cause !== void 0 ? { cause: options.cause } : void 0);\n\t\tthis.name = \"CliStructuredError\";\n\t\tthis.code = code;\n\t\tthis.severity = options?.severity ?? \"error\";\n\t\tconst fix = options?.fix === options?.why ? void 0 : options?.fix;\n\t\tconst where = options?.where ? {\n\t\t\t...ifDefined(\"path\", options.where.path),\n\t\t\t...ifDefined(\"line\", options.where.line)\n\t\t} : void 0;\n\t\tObject.assign(this, {\n\t\t\t...ifDefined(\"why\", options?.why),\n\t\t\t...ifDefined(\"fix\", fix),\n\t\t\t...ifDefined(\"where\", where),\n\t\t\t...ifDefined(\"meta\", options?.meta),\n\t\t\t...ifDefined(\"docsUrl\", options?.docsUrl)\n\t\t});\n\t}\n\t/**\n\t* Converts this error to a CLI error envelope for output formatting.\n\t*/\n\ttoEnvelope() {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tcode: this.code,\n\t\t\tseverity: this.severity,\n\t\t\tsummary: this.message,\n\t\t\t...ifDefined(\"why\", this.why),\n\t\t\t...ifDefined(\"fix\", this.fix),\n\t\t\t...ifDefined(\"where\", this.where),\n\t\t\t...ifDefined(\"meta\", this.meta),\n\t\t\t...ifDefined(\"docsUrl\", this.docsUrl)\n\t\t};\n\t}\n\t/**\n\t* Type guard to check if an error is a CliStructuredError.\n\t* Uses duck-typing to work across module boundaries where instanceof may fail.\n\t*/\n\tstatic is(error) {\n\t\tif (!(error instanceof Error)) return false;\n\t\tconst candidate = blindCast(error);\n\t\treturn candidate.name === \"CliStructuredError\" && typeof candidate.code === \"string\" && typeof candidate.toEnvelope === \"function\";\n\t}\n};\n//#endregion\n//#region src/structured-error.ts\nconst STRUCTURED_CODE_RE = /^[A-Z][A-Z0-9]*\\.[A-Z][A-Z0-9_]*$/;\nfunction isStructuredError(e) {\n\treturn typeof e === \"object\" && e !== null && \"code\" in e && typeof e.code === \"string\" && STRUCTURED_CODE_RE.test(e.code) && \"message\" in e && typeof e.message === \"string\";\n}\nfunction structuredError(code, message, options) {\n\tconst error = options?.cause !== void 0 ? new Error(message, { cause: options.cause }) : new Error(message);\n\tObject.defineProperty(error, \"name\", {\n\t\tvalue: \"StructuredError\",\n\t\tconfigurable: true\n\t});\n\treturn Object.assign(error, {\n\t\tcode,\n\t\t...ifDefined(\"why\", options?.why),\n\t\t...ifDefined(\"fix\", options?.fix),\n\t\t...ifDefined(\"where\", options?.where),\n\t\t...ifDefined(\"severity\", options?.severity),\n\t\t...ifDefined(\"meta\", options?.meta),\n\t\t...ifDefined(\"docsUrl\", options?.docsUrl)\n\t});\n}\nconst DOCS_BASE = `https://docs.prisma.io/docs/orm/next/reference/error-reference`;\nfunction docsUrlFor(code) {\n\treturn `${DOCS_BASE}#${code}`;\n}\n//#endregion\nexport { CliStructuredError, DOCS_BASE, InternalError, assertNever, describeKind, docsUrlFor, isInternalError, isStructuredError, structuredError };\n\n//# sourceMappingURL=errors.mjs.map","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"],"mappings":";;;;;;;;;;;;;;;;;;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AAS,SAAS;CACjB,OAAO;AACR"}
@@ -0,0 +1,219 @@
1
+ import { t as childEnvironment } from "./config-adapters-BA_IeiX0-CiRnz7z8.mjs";
2
+ import { i as CliStructuredError } from "./result-sR7PBi61.mjs";
3
+ import { createRequire } from "node:module";
4
+ import * as fs from "node:fs";
5
+ import * as path from "node:path";
6
+ import spawn from "cross-spawn";
7
+ //#region ../../0-framework/3-tooling/cli/dist/run-alchemy-B-Z6i3cD.mjs
8
+ /**
9
+ * Which Alchemy CLI runs a generated stack file: the `alchemy` that
10
+ * `@prisma/composer` depends on, found from the app the way the stack file's
11
+ * own `@prisma/composer/...` imports are. The CLI and the stack code then
12
+ * come from one install, so the child loads one copy of `alchemy`.
13
+ *
14
+ * Node's resolver finds `@prisma/composer` from the app. It cannot find
15
+ * `alchemy` from there: alchemy exports neither its `package.json` nor its
16
+ * bin, and has no `require` condition. Bun has no `module.findPackageJSON`.
17
+ * So the last step is Node's own lookup written out: each `node_modules`
18
+ * above `@prisma/composer`'s real location, nearest first.
19
+ */
20
+ const FIX = "Check that the app depends on @prisma/composer and that `alchemy`, which @prisma/composer depends on, is installed in a node_modules directory. Layouts without one, such as Yarn Plug'n'Play, are not supported.";
21
+ function binMissing(message) {
22
+ return new CliStructuredError("DEPLOY.ALCHEMY_BIN_MISSING", message, { fix: FIX });
23
+ }
24
+ function composerPackageDir(appDir) {
25
+ try {
26
+ const manifest = createRequire(path.join(appDir, "package.json")).resolve("@prisma/composer/package.json");
27
+ return path.dirname(fs.realpathSync(manifest));
28
+ } catch {
29
+ return;
30
+ }
31
+ }
32
+ function alchemyPackageDirAbove(dir) {
33
+ for (let current = dir;; current = path.dirname(current)) {
34
+ const candidate = path.join(current, "node_modules", "alchemy");
35
+ if (fs.existsSync(path.join(candidate, "package.json"))) return candidate;
36
+ if (path.dirname(current) === current) return void 0;
37
+ }
38
+ }
39
+ function readPackageJson(packageDir) {
40
+ try {
41
+ return JSON.parse(fs.readFileSync(path.join(packageDir, "package.json"), "utf8"));
42
+ } catch {
43
+ return;
44
+ }
45
+ }
46
+ function binOf(packageDir) {
47
+ const manifest = readPackageJson(packageDir);
48
+ if (typeof manifest !== "object" || manifest === null || !("bin" in manifest)) return void 0;
49
+ const bin = manifest.bin;
50
+ const relative = typeof bin === "string" ? bin : typeof bin === "object" && bin !== null && "alchemy" in bin ? bin.alchemy : void 0;
51
+ if (typeof relative !== "string") return void 0;
52
+ const entry = path.join(packageDir, relative);
53
+ return fs.existsSync(entry) ? entry : void 0;
54
+ }
55
+ /**
56
+ * The JavaScript file `alchemy`'s `bin` names, for the app in `appDir`.
57
+ * Raises DEPLOY.ALCHEMY_BIN_MISSING when the app does not resolve
58
+ * `@prisma/composer` or no usable `alchemy` is installed beside it.
59
+ */
60
+ function resolveAlchemyBin(appDir) {
61
+ const composerDir = composerPackageDir(appDir);
62
+ if (composerDir === void 0) throw binMissing(`Could not resolve @prisma/composer from "${appDir}".`);
63
+ const alchemyDir = alchemyPackageDirAbove(composerDir);
64
+ const entry = alchemyDir === void 0 ? void 0 : binOf(alchemyDir);
65
+ if (entry === void 0) throw binMissing(`Could not resolve the bin of the \`alchemy\` package @prisma/composer depends on, from "${composerDir}".`);
66
+ return entry;
67
+ }
68
+ /**
69
+ * Pipeline step 9 (deploy-cli.md § The pipeline; design-notes.md's "Driving
70
+ * Alchemy" call): hand the terminal to the generated stack file.
71
+ *
72
+ * Runs the bin of the `alchemy` the app's `@prisma/composer` depends on
73
+ * (`resolveAlchemyBin`), started with Node (`nodeExecutable`). Never a
74
+ * `node_modules/.bin` link, which pnpm creates only for an app's direct
75
+ * dependencies.
76
+ *
77
+ * This module composes the invocation; it does not decide how the child is
78
+ * started. Under the CLI the engine starts it (`ctx.spawn`), which is what
79
+ * makes Ctrl-C reach the child natively and keeps signal policy in one place.
80
+ * `spawnAlchemy` is the default for programmatic hosts driving
81
+ * `@prisma/composer/control`, which have no engine to borrow.
82
+ */
83
+ function currentRuntime() {
84
+ return {
85
+ bun: process.versions.bun !== void 0,
86
+ execPath: process.execPath,
87
+ env: process.env,
88
+ platform: process.platform,
89
+ exists: fs.existsSync
90
+ };
91
+ }
92
+ function envValue(env, name) {
93
+ return Object.entries(env).find(([key]) => key.toLowerCase() === name.toLowerCase())?.[1];
94
+ }
95
+ /** The file names `node` may have in a PATH directory: PATHEXT's extensions on Windows. */
96
+ function nodeFileNames(runtime) {
97
+ if (runtime.platform !== "win32") return ["node"];
98
+ return (envValue(runtime.env, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").filter((extension) => extension.length > 0).map((extension) => `node${extension}`);
99
+ }
100
+ /**
101
+ * The Node that starts Alchemy's launcher: this process's own runtime under
102
+ * Node, and the first `node` on PATH under Bun. Alchemy's launcher may still
103
+ * move itself to Bun when the package-manager environment says Bun invoked
104
+ * it (`bunx`, `bun run`), so the runtime Alchemy ends up on follows how
105
+ * `prisma` was invoked.
106
+ */
107
+ function nodeExecutable(runtime = currentRuntime()) {
108
+ if (!runtime.bun) return runtime.execPath;
109
+ const paths = runtime.platform === "win32" ? path.win32 : path.posix;
110
+ const names = nodeFileNames(runtime);
111
+ for (const rawDir of (envValue(runtime.env, "PATH") ?? "").split(paths.delimiter)) {
112
+ const dir = rawDir.replace(/^"(.*)"$/, "$1");
113
+ if (dir.length === 0) continue;
114
+ for (const name of names) {
115
+ const candidate = paths.join(dir, name);
116
+ if (runtime.exists(candidate)) return candidate;
117
+ }
118
+ }
119
+ throw new CliStructuredError("DEPLOY.NODE_MISSING", "Composer starts Alchemy with Node, and no `node` was found on PATH.", { fix: "Install Node.js 22.18 or newer on the 22 line, 24.11 or newer on the 24 line, or 26 or newer, and put it on PATH, or run `prisma` under Node." });
120
+ }
121
+ /**
122
+ * Resolves the invocation against this machine — the step every adapter takes
123
+ * and no caller should. Runs alchemy's JavaScript entry with Node, so no shell
124
+ * shim is involved on any platform. Raises DEPLOY.ALCHEMY_BIN_MISSING when
125
+ * Composer's alchemy cannot be resolved, and DEPLOY.NODE_MISSING when no Node
126
+ * can run it.
127
+ */
128
+ function alchemyCommandLine(invocation, alchemyBin = resolveAlchemyBin(invocation.cwd), node = nodeExecutable()) {
129
+ return {
130
+ command: node,
131
+ args: [
132
+ alchemyBin,
133
+ invocation.action,
134
+ invocation.stackFileRelativePath,
135
+ "--yes",
136
+ "--stage",
137
+ invocation.stage
138
+ ],
139
+ cwd: invocation.cwd,
140
+ env: invocation.env
141
+ };
142
+ }
143
+ /** What becomes `alchemy deploy|destroy <stack file> --yes --stage <stage>`. */
144
+ function alchemyInvocation(input) {
145
+ return {
146
+ action: input.command,
147
+ stackFileRelativePath: input.stackFileRelativePath,
148
+ cwd: input.cwd,
149
+ stage: input.stage,
150
+ env: childEnvironment({
151
+ ...input.containerEnv,
152
+ ...input.preflightEnv,
153
+ ...input.env
154
+ })
155
+ };
156
+ }
157
+ /**
158
+ * The default runner for hosts with no engine: inherited stdio, the caller's
159
+ * own process group, and the child's status returned verbatim. It does not
160
+ * collapse a signal into an exit code — that collapse is what made a
161
+ * Ctrl-C'd deploy report itself as a failure.
162
+ */
163
+ const spawnAlchemy = async (invocation) => {
164
+ const commandLine = alchemyCommandLine(invocation);
165
+ return {
166
+ ...await spawnCommandLine(commandLine),
167
+ commandLine
168
+ };
169
+ };
170
+ /**
171
+ * One argument as the platform's shell reads it literally: single quotes for
172
+ * POSIX shells, double quotes for cmd.exe. cmd.exe expands `%VAR%` inside
173
+ * double quotes, and strips or expands `!` when delayed expansion is on; no
174
+ * quoting prevents either, so an argument containing them is not fully
175
+ * literal there.
176
+ */
177
+ function shellArg(arg, platform) {
178
+ if (platform === "win32") return /^[\w@+=:,./\\~-]+$/.test(arg) ? arg : `"${arg.replaceAll("\"", "\"\"")}"`;
179
+ return /^[\w@%+=:,./-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", "'\\''")}'`;
180
+ }
181
+ /**
182
+ * The command a user runs from the invocation's directory to repeat a
183
+ * converge: the command line the adapter started, or, from an adapter that
184
+ * does not report one, `alchemy` with the same arguments.
185
+ */
186
+ function reproduceCommand(invocation, outcome, platform = process.platform) {
187
+ return (outcome?.commandLine === void 0 ? [
188
+ "alchemy",
189
+ invocation.action,
190
+ invocation.stackFileRelativePath,
191
+ "--yes",
192
+ "--stage",
193
+ invocation.stage
194
+ ] : [outcome.commandLine.command, ...outcome.commandLine.args]).map((arg) => shellArg(arg, platform)).join(" ");
195
+ }
196
+ /** Starts a resolved command line with inherited stdio and returns how it ended. */
197
+ function spawnCommandLine(line) {
198
+ return new Promise((resolve, reject) => {
199
+ const child = spawn(line.command, [...line.args], {
200
+ cwd: line.cwd,
201
+ stdio: "inherit",
202
+ env: {
203
+ ...process.env,
204
+ ...line.env
205
+ }
206
+ });
207
+ child.on("error", reject);
208
+ child.on("close", (exitCode, signal) => {
209
+ resolve({
210
+ exitCode,
211
+ signal
212
+ });
213
+ });
214
+ });
215
+ }
216
+ //#endregion
217
+ export { spawnAlchemy as i, alchemyInvocation as n, reproduceCommand as r, alchemyCommandLine as t };
218
+
219
+ //# sourceMappingURL=run-alchemy-B-Z6i3cD-f0MXFCG8.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-alchemy-B-Z6i3cD-f0MXFCG8.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/run-alchemy-B-Z6i3cD.mjs"],"sourcesContent":["import { t as childEnvironment } from \"./config-adapters-BA_IeiX0.mjs\";\nimport { createRequire } from \"node:module\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport spawn from \"cross-spawn\";\n//#region src/alchemy-bin.ts\n/**\n* Which Alchemy CLI runs a generated stack file: the `alchemy` that\n* `@prisma/composer` depends on, found from the app the way the stack file's\n* own `@prisma/composer/...` imports are. The CLI and the stack code then\n* come from one install, so the child loads one copy of `alchemy`.\n*\n* Node's resolver finds `@prisma/composer` from the app. It cannot find\n* `alchemy` from there: alchemy exports neither its `package.json` nor its\n* bin, and has no `require` condition. Bun has no `module.findPackageJSON`.\n* So the last step is Node's own lookup written out: each `node_modules`\n* above `@prisma/composer`'s real location, nearest first.\n*/\nconst FIX = \"Check that the app depends on @prisma/composer and that `alchemy`, which @prisma/composer depends on, is installed in a node_modules directory. Layouts without one, such as Yarn Plug'n'Play, are not supported.\";\nfunction binMissing(message) {\n\treturn new CliStructuredError(\"DEPLOY.ALCHEMY_BIN_MISSING\", message, { fix: FIX });\n}\nfunction composerPackageDir(appDir) {\n\ttry {\n\t\tconst manifest = createRequire(path.join(appDir, \"package.json\")).resolve(\"@prisma/composer/package.json\");\n\t\treturn path.dirname(fs.realpathSync(manifest));\n\t} catch {\n\t\treturn;\n\t}\n}\nfunction alchemyPackageDirAbove(dir) {\n\tfor (let current = dir;; current = path.dirname(current)) {\n\t\tconst candidate = path.join(current, \"node_modules\", \"alchemy\");\n\t\tif (fs.existsSync(path.join(candidate, \"package.json\"))) return candidate;\n\t\tif (path.dirname(current) === current) return void 0;\n\t}\n}\nfunction readPackageJson(packageDir) {\n\ttry {\n\t\treturn JSON.parse(fs.readFileSync(path.join(packageDir, \"package.json\"), \"utf8\"));\n\t} catch {\n\t\treturn;\n\t}\n}\nfunction binOf(packageDir) {\n\tconst manifest = readPackageJson(packageDir);\n\tif (typeof manifest !== \"object\" || manifest === null || !(\"bin\" in manifest)) return void 0;\n\tconst bin = manifest.bin;\n\tconst relative = typeof bin === \"string\" ? bin : typeof bin === \"object\" && bin !== null && \"alchemy\" in bin ? bin.alchemy : void 0;\n\tif (typeof relative !== \"string\") return void 0;\n\tconst entry = path.join(packageDir, relative);\n\treturn fs.existsSync(entry) ? entry : void 0;\n}\n/**\n* The JavaScript file `alchemy`'s `bin` names, for the app in `appDir`.\n* Raises DEPLOY.ALCHEMY_BIN_MISSING when the app does not resolve\n* `@prisma/composer` or no usable `alchemy` is installed beside it.\n*/\nfunction resolveAlchemyBin(appDir) {\n\tconst composerDir = composerPackageDir(appDir);\n\tif (composerDir === void 0) throw binMissing(`Could not resolve @prisma/composer from \"${appDir}\".`);\n\tconst alchemyDir = alchemyPackageDirAbove(composerDir);\n\tconst entry = alchemyDir === void 0 ? void 0 : binOf(alchemyDir);\n\tif (entry === void 0) throw binMissing(`Could not resolve the bin of the \\`alchemy\\` package @prisma/composer depends on, from \"${composerDir}\".`);\n\treturn entry;\n}\n//#endregion\n//#region src/run-alchemy.ts\n/**\n* Pipeline step 9 (deploy-cli.md § The pipeline; design-notes.md's \"Driving\n* Alchemy\" call): hand the terminal to the generated stack file.\n*\n* Runs the bin of the `alchemy` the app's `@prisma/composer` depends on\n* (`resolveAlchemyBin`), started with Node (`nodeExecutable`). Never a\n* `node_modules/.bin` link, which pnpm creates only for an app's direct\n* dependencies.\n*\n* This module composes the invocation; it does not decide how the child is\n* started. Under the CLI the engine starts it (`ctx.spawn`), which is what\n* makes Ctrl-C reach the child natively and keeps signal policy in one place.\n* `spawnAlchemy` is the default for programmatic hosts driving\n* `@prisma/composer/control`, which have no engine to borrow.\n*/\nfunction currentRuntime() {\n\treturn {\n\t\tbun: process.versions.bun !== void 0,\n\t\texecPath: process.execPath,\n\t\tenv: process.env,\n\t\tplatform: process.platform,\n\t\texists: fs.existsSync\n\t};\n}\nfunction envValue(env, name) {\n\treturn Object.entries(env).find(([key]) => key.toLowerCase() === name.toLowerCase())?.[1];\n}\n/** The file names `node` may have in a PATH directory: PATHEXT's extensions on Windows. */\nfunction nodeFileNames(runtime) {\n\tif (runtime.platform !== \"win32\") return [\"node\"];\n\treturn (envValue(runtime.env, \"PATHEXT\") ?? \".COM;.EXE;.BAT;.CMD\").split(\";\").filter((extension) => extension.length > 0).map((extension) => `node${extension}`);\n}\n/**\n* The Node that starts Alchemy's launcher: this process's own runtime under\n* Node, and the first `node` on PATH under Bun. Alchemy's launcher may still\n* move itself to Bun when the package-manager environment says Bun invoked\n* it (`bunx`, `bun run`), so the runtime Alchemy ends up on follows how\n* `prisma` was invoked.\n*/\nfunction nodeExecutable(runtime = currentRuntime()) {\n\tif (!runtime.bun) return runtime.execPath;\n\tconst paths = runtime.platform === \"win32\" ? path.win32 : path.posix;\n\tconst names = nodeFileNames(runtime);\n\tfor (const rawDir of (envValue(runtime.env, \"PATH\") ?? \"\").split(paths.delimiter)) {\n\t\tconst dir = rawDir.replace(/^\"(.*)\"$/, \"$1\");\n\t\tif (dir.length === 0) continue;\n\t\tfor (const name of names) {\n\t\t\tconst candidate = paths.join(dir, name);\n\t\t\tif (runtime.exists(candidate)) return candidate;\n\t\t}\n\t}\n\tthrow new CliStructuredError(\"DEPLOY.NODE_MISSING\", \"Composer starts Alchemy with Node, and no `node` was found on PATH.\", { fix: \"Install Node.js 22.18 or newer on the 22 line, 24.11 or newer on the 24 line, or 26 or newer, and put it on PATH, or run `prisma` under Node.\" });\n}\n/**\n* Resolves the invocation against this machine — the step every adapter takes\n* and no caller should. Runs alchemy's JavaScript entry with Node, so no shell\n* shim is involved on any platform. Raises DEPLOY.ALCHEMY_BIN_MISSING when\n* Composer's alchemy cannot be resolved, and DEPLOY.NODE_MISSING when no Node\n* can run it.\n*/\nfunction alchemyCommandLine(invocation, alchemyBin = resolveAlchemyBin(invocation.cwd), node = nodeExecutable()) {\n\treturn {\n\t\tcommand: node,\n\t\targs: [\n\t\t\talchemyBin,\n\t\t\tinvocation.action,\n\t\t\tinvocation.stackFileRelativePath,\n\t\t\t\"--yes\",\n\t\t\t\"--stage\",\n\t\t\tinvocation.stage\n\t\t],\n\t\tcwd: invocation.cwd,\n\t\tenv: invocation.env\n\t};\n}\n/** What becomes `alchemy deploy|destroy <stack file> --yes --stage <stage>`. */\nfunction alchemyInvocation(input) {\n\treturn {\n\t\taction: input.command,\n\t\tstackFileRelativePath: input.stackFileRelativePath,\n\t\tcwd: input.cwd,\n\t\tstage: input.stage,\n\t\tenv: childEnvironment({\n\t\t\t...input.containerEnv,\n\t\t\t...input.preflightEnv,\n\t\t\t...input.env\n\t\t})\n\t};\n}\n/**\n* The default runner for hosts with no engine: inherited stdio, the caller's\n* own process group, and the child's status returned verbatim. It does not\n* collapse a signal into an exit code — that collapse is what made a\n* Ctrl-C'd deploy report itself as a failure.\n*/\nconst spawnAlchemy = async (invocation) => {\n\tconst commandLine = alchemyCommandLine(invocation);\n\treturn {\n\t\t...await spawnCommandLine(commandLine),\n\t\tcommandLine\n\t};\n};\n/**\n* One argument as the platform's shell reads it literally: single quotes for\n* POSIX shells, double quotes for cmd.exe. cmd.exe expands `%VAR%` inside\n* double quotes, and strips or expands `!` when delayed expansion is on; no\n* quoting prevents either, so an argument containing them is not fully\n* literal there.\n*/\nfunction shellArg(arg, platform) {\n\tif (platform === \"win32\") return /^[\\w@+=:,./\\\\~-]+$/.test(arg) ? arg : `\"${arg.replaceAll(\"\\\"\", \"\\\"\\\"\")}\"`;\n\treturn /^[\\w@%+=:,./-]+$/.test(arg) ? arg : `'${arg.replaceAll(\"'\", \"'\\\\''\")}'`;\n}\n/**\n* The command a user runs from the invocation's directory to repeat a\n* converge: the command line the adapter started, or, from an adapter that\n* does not report one, `alchemy` with the same arguments.\n*/\nfunction reproduceCommand(invocation, outcome, platform = process.platform) {\n\treturn (outcome?.commandLine === void 0 ? [\n\t\t\"alchemy\",\n\t\tinvocation.action,\n\t\tinvocation.stackFileRelativePath,\n\t\t\"--yes\",\n\t\t\"--stage\",\n\t\tinvocation.stage\n\t] : [outcome.commandLine.command, ...outcome.commandLine.args]).map((arg) => shellArg(arg, platform)).join(\" \");\n}\n/** Starts a resolved command line with inherited stdio and returns how it ended. */\nfunction spawnCommandLine(line) {\n\treturn new Promise((resolve, reject) => {\n\t\tconst child = spawn(line.command, [...line.args], {\n\t\t\tcwd: line.cwd,\n\t\t\tstdio: \"inherit\",\n\t\t\tenv: {\n\t\t\t\t...process.env,\n\t\t\t\t...line.env\n\t\t\t}\n\t\t});\n\t\tchild.on(\"error\", reject);\n\t\tchild.on(\"close\", (exitCode, signal) => {\n\t\t\tresolve({\n\t\t\t\texitCode,\n\t\t\t\tsignal\n\t\t\t});\n\t\t});\n\t});\n}\n//#endregion\nexport { sp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K,QAAQ,CAAC,CAAC,CAAC,KAAK,GAAG;AAC/G;;AAEA,SAAS,iBAAiB,MAAM;CAC/B,OAAO,IAAI,SAAS,SAAS,WAAW;EACvC,MAAM,QAAQ,MAAM,KAAK,SAAS,CAAC,GAAG,KAAK,IAAI,GAAG;GACjD,KAAK,KAAK;GACV,OAAO;GACP,KAAK;IACJ,GAAG,QAAQ;IACX,GAAG,KAAK;GACT;EACD,CAAC;EACD,MAAM,GAAG,SAAS,MAAM;EACxB,MAAM,GAAG,UAAU,UAAU,WAAW;GACvC,QAAQ;IACP;IACA;GACD,CAAC;EACF,CAAC;CACF,CAAC;AACF"}
@@ -1,4 +1,4 @@
1
- import { _ as Result, a as DeployEvent, b as CliStructuredError, c as DevEvent, d as DevStopInput, f as DevStopped, g as ServiceEndpoint, h as OperationDeps, l as DevInput, m as DevUrlInput, o as DeployInput, p as DevUrl, s as DeploySuccess, t as ComposerOperations, u as DevSession, v as AssembledServices } from "./family-Dy3ZQOxG-BGwHvqM_.mjs";
1
+ import { _ as Result, a as DeployEvent, b as CliStructuredError, c as DevEvent, d as DevStopInput, f as DevStopped, g as ServiceEndpoint, h as OperationDeps, l as DevInput, m as DevUrlInput, o as DeployInput, p as DevUrl, s as DeploySuccess, t as ComposerOperations, u as DevSession, v as AssembledServices } from "./family-DACJfaA5-CBuEC2B3.mjs";
2
2
  //#region ../../0-framework/3-tooling/cli/dist/testing.d.mts
3
3
  //#region src/dev/generate-dev-stack.d.ts
4
4
  interface DevStackFileInput {
package/dist/testing.mjs CHANGED
@@ -1,5 +1,6 @@
1
- import { a as notOk, c as CliStructuredError, o as ok, r as reproduceCommand } from "./run-alchemy-Dl_MWw4g-DaWV9tkH.mjs";
2
- import { n as renderDevStackFile } from "./generate-dev-stack-BkkU2HLE-Dek3CkAQ.mjs";
1
+ import { i as CliStructuredError, n as ok, t as notOk } from "./result-sR7PBi61.mjs";
2
+ import { r as reproduceCommand } from "./run-alchemy-B-Z6i3cD-f0MXFCG8.mjs";
3
+ import { n as renderDevStackFile } from "./generate-dev-stack-DS6U_JHX-wDTViqdg.mjs";
3
4
  //#region ../../0-framework/3-tooling/cli/dist/testing.mjs
4
5
  /**
5
6
  * The published operations double (`@prisma/composer-cli/testing`): the
@@ -1 +1 @@
1
- {"version":3,"file":"testing.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/testing.mjs"],"sourcesContent":["import { r as reproduceCommand } from \"./run-alchemy-Dl_MWw4g.mjs\";\nimport { n as renderDevStackFile } from \"./generate-dev-stack-BkkU2HLE.mjs\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { notOk, ok } from \"@internal/foundation/result\";\n//#region src/testing/operations-double.ts\n/**\n* The published operations double (`@prisma/composer-cli/testing`): the\n* operations the command family calls, `deploy`, `dev`, `devUrl` and\n* `devStop`, with their real\n* signatures and Result shapes, backed by fixtures instead of alchemy,\n* containers, or a network. It does not cover `destroy` and `log`, which no\n* command calls.\n*\n* Hosts that mount composer's command family — prisma-cli above all — test\n* against this instead of the real operations, so their suites never spawn a\n* converge and their typecheck never needs the alchemy/effect constellation.\n* The conformance guarantee is carried by the types: `ComposerOperations` is\n* defined as `typeof deployWithDeps` (etc.) of the REAL operations, and the\n* double is declared against it, so a drift in any real signature fails\n* `tsc --noEmit` right here. Every import of implementation modules is\n* type-only and erases at build — the built `testing` chunk must contain no path to the real\n* control implementation, which scripts/check-family-static-graph.mjs proves\n* against the packed tarball.\n*/\nfunction devSessionDouble(input, endpoints, events) {\n\tlet resolveClosed;\n\tconst closed = new Promise((resolve) => {\n\t\tresolveClosed = resolve;\n\t});\n\tlet stopped = false;\n\tinput.onEvent?.({\n\t\tkind: \"ready\",\n\t\tendpoints\n\t});\n\tfor (const event of events) input.onEvent?.(event);\n\treturn {\n\t\tendpoints,\n\t\tclosed,\n\t\tstop: async () => {\n\t\t\tif (stopped) return;\n\t\t\tstopped = true;\n\t\t\tinput.onEvent?.({ kind: \"stopping\" });\n\t\t\tinput.onEvent?.({ kind: \"stopped\" });\n\t\t\tresolveClosed();\n\t\t}\n\t};\n}\n/**\n* Runs the caller's converge adapter, when it supplied one, against a\n* synthetic invocation — no alchemy bin is resolved and no real child is\n* started; the adapter decides what the child does.\n*\n* This is what makes a host's tests cover the settlement rules rather than\n* just the grammar: a scripted fake child that exits non-zero, or is killed\n* by a signal, produces the same failure shape the real executor produces, so\n* the handler's settlement — and the engine's own child-status settlement\n* behind it — is genuinely exercised. Returns undefined when no adapter was\n* injected, leaving the fixture result untouched.\n*/\nasync function runConverge(deps, cwd) {\n\tif (deps.alchemy === void 0) return void 0;\n\tconst stackFilePath = \".prisma-composer/alchemy.run.ts\";\n\tconst workingDirectory = cwd ?? \".\";\n\tconst invocation = {\n\t\taction: \"deploy\",\n\t\tstackFileRelativePath: stackFilePath,\n\t\tcwd: workingDirectory,\n\t\tstage: \"test\",\n\t\tenv: {}\n\t};\n\tconst outcome = await deps.alchemy(invocation);\n\tconst reproduce = reproduceCommand(invocation, outcome);\n\tif (outcome.signal !== null) return notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", `alchemy deploy was interrupted by ${outcome.signal}.`, { meta: {\n\t\tsignal: outcome.signal,\n\t\tdiagnostics: {\n\t\t\texitCode: void 0,\n\t\t\tsignal: outcome.signal,\n\t\t\tstackFilePath,\n\t\t\treproduceCommand: reproduce,\n\t\t\tcwd: workingDirectory\n\t\t}\n\t} }));\n\tconst status = outcome.exitCode ?? 1;\n\tif (status === 0) return void 0;\n\treturn notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", `alchemy deploy exited with status ${status}.`, { meta: {\n\t\texitCode: status,\n\t\tdiagnostics: {\n\t\t\texitCode: status,\n\t\t\tstackFilePath,\n\t\t\treproduceCommand: reproduce,\n\t\t\tcwd: workingDirectory\n\t\t}\n\t} }));\n}\nfunction createOperationsDouble(fixtures = {}) {\n\tconst deployCalls = [];\n\tconst devCalls = [];\n\tconst deps = {\n\t\tdeploy: [],\n\t\tdev: []\n\t};\n\tconst devUrlCalls = [];\n\tconst devStopCalls = [];\n\tconst calls = {\n\t\tdeploy: deployCalls,\n\t\tdev: devCalls,\n\t\tdevUrl: devUrlCalls,\n\t\tdevStop: devStopCalls,\n\t\tdeps\n\t};\n\treturn {\n\t\toperations: {\n\t\t\tdeploy: async (input, operationDeps) => {\n\t\t\t\tcalls.deploy.push(input);\n\t\t\t\tdeps.deploy.push(operationDeps);\n\t\t\t\tfor (const event of fixtures.deployEvents ?? []) try {\n\t\t\t\t\tinput.onEvent?.(event);\n\t\t\t\t} catch {}\n\t\t\t\tconst converge = await runConverge(operationDeps, input.cwd);\n\t\t\t\tif (converge !== void 0) return converge;\n\t\t\t\treturn fixtures.deploy ?? ok({\n\t\t\t\t\tsummary: void 0,\n\t\t\t\t\tdurationMs: 0\n\t\t\t\t});\n\t\t\t},\n\t\t\tdev: async (input, operationDeps) => {\n\t\t\t\tcalls.dev.push(input);\n\t\t\t\tdeps.dev.push(operationDeps);\n\t\t\t\treturn fixtures.dev ?? ok(devSessionDouble(input, fixtures.devEndpoints ?? [], fixtures.devEvents ?? []));\n\t\t\t},\n\t\t\tdevUrl: async (input) => {\n\t\t\t\tdevUrlCalls.push(input);\n\t\t\t\treturn fixtures.devUrl ?? ok({\n\t\t\t\t\taddress: input.address,\n\t\t\t\t\tkind: \"service\",\n\t\t\t\t\turl: \"http://localhost:3000\",\n\t\t\t\t\tstate: \"running\"\n\t\t\t\t});\n\t\t\t},\n\t\t\tdevStop: async (input) => {\n\t\t\t\tdevStopCalls.push(input);\n\t\t\t\treturn fixtures.devStop ?? ok({\n\t\t\t\t\tapp: \"app\",\n\t\t\t\t\tenvironment: input.environment ?? \"dev\",\n\t\t\t\t\tstopped: []\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tcalls\n\t};\n}\n//#endregion\nexport { createOperationsDouble, renderDevStackFile };\n\n//# sourceMappingURL=testing.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAS,iBAAiB,OAA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AM,WAAW,CAAC;CAClB,MAAM,OAAO;EACZ,QAAQ,CAAC;EACT,KAAK,CAAC;CACP;CACA,MAAM,cAAc,CAAC;CACrB,MAAM,eAAe,CAAC;CACtB,MAAM,QAAQ;EACb,QAAQ;EACR,KAAK;EACL,QAAQ;EACR,SAAS;EACT;CACD;CACA,OAAO;EACN,YAAY;GACX,QAAQ,OAAO,OAAO,kBAAkB;IACvC,MAAM,OAAO,KAAK,KAAK;IACvB,KAAK,OAAO,KAAK,aAAa;IAC9B,KAAK,MAAM,SAAS,SAAS,gBAAgB,CAAC,GAAG,IAAI;KACpD,MAAM,UAAU,KAAK;IACtB,QAAQ,CAAC;IACT,MAAM,WAAW,MAAM,YAAY,eAAe,MAAM,GAAG;IAC3D,IAAI,aAAa,KAAK,GAAG,OAAO;IAChC,OAAO,SAAS,UAAU,GAAG;KAC5B,SAAS,KAAK;KACd,YAAY;IACb,CAAC;GACF;GACA,KAAK,OAAO,OAAO,kBAAkB;IACpC,MAAM,IAAI,KAAK,KAAK;IACpB,KAAK,IAAI,KAAK,aAAa;IAC3B,OAAO,SAAS,OAAO,GAAG,iBAAiB,OAAO,SAAS,gBAAgB,CAAC,GAAG,SAAS,aAAa,CAAC,CAAC,CAAC;GACzG;GACA,QAAQ,OAAO,UAAU;IACxB,YAAY,KAAK,KAAK;IACtB,OAAO,SAAS,UAAU,GAAG;KAC5B,SAAS,MAAM;KACf,MAAM;KACN,KAAK;KACL,OAAO;IACR,CAAC;GACF;GACA,SAAS,OAAO,UAAU;IACzB,aAAa,KAAK,KAAK;IACvB,OAAO,SAAS,WAAW,GAAG;KAC7B,KAAK;KACL,aAAa,MAAM,eAAe;KAClC,SAAS,CAAC;IACX,CAAC;GACF;EACD;EACA;CACD;AACD"}
1
+ {"version":3,"file":"testing.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/testing.mjs"],"sourcesContent":["import { r as reproduceCommand } from \"./run-alchemy-B-Z6i3cD.mjs\";\nimport { n as renderDevStackFile } from \"./generate-dev-stack-DS6U_JHX.mjs\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { notOk, ok } from \"@internal/foundation/result\";\n//#region src/testing/operations-double.ts\n/**\n* The published operations double (`@prisma/composer-cli/testing`): the\n* operations the command family calls, `deploy`, `dev`, `devUrl` and\n* `devStop`, with their real\n* signatures and Result shapes, backed by fixtures instead of alchemy,\n* containers, or a network. It does not cover `destroy` and `log`, which no\n* command calls.\n*\n* Hosts that mount composer's command family — prisma-cli above all — test\n* against this instead of the real operations, so their suites never spawn a\n* converge and their typecheck never needs the alchemy/effect constellation.\n* The conformance guarantee is carried by the types: `ComposerOperations` is\n* defined as `typeof deployWithDeps` (etc.) of the REAL operations, and the\n* double is declared against it, so a drift in any real signature fails\n* `tsc --noEmit` right here. Every import of implementation modules is\n* type-only and erases at build — the built `testing` chunk must contain no path to the real\n* control implementation, which scripts/check-family-static-graph.mjs proves\n* against the packed tarball.\n*/\nfunction devSessionDouble(input, endpoints, events) {\n\tlet resolveClosed;\n\tconst closed = new Promise((resolve) => {\n\t\tresolveClosed = resolve;\n\t});\n\tlet stopped = false;\n\tinput.onEvent?.({\n\t\tkind: \"ready\",\n\t\tendpoints\n\t});\n\tfor (const event of events) input.onEvent?.(event);\n\treturn {\n\t\tendpoints,\n\t\tclosed,\n\t\tstop: async () => {\n\t\t\tif (stopped) return;\n\t\t\tstopped = true;\n\t\t\tinput.onEvent?.({ kind: \"stopping\" });\n\t\t\tinput.onEvent?.({ kind: \"stopped\" });\n\t\t\tresolveClosed();\n\t\t}\n\t};\n}\n/**\n* Runs the caller's converge adapter, when it supplied one, against a\n* synthetic invocation — no alchemy bin is resolved and no real child is\n* started; the adapter decides what the child does.\n*\n* This is what makes a host's tests cover the settlement rules rather than\n* just the grammar: a scripted fake child that exits non-zero, or is killed\n* by a signal, produces the same failure shape the real executor produces, so\n* the handler's settlement — and the engine's own child-status settlement\n* behind it — is genuinely exercised. Returns undefined when no adapter was\n* injected, leaving the fixture result untouched.\n*/\nasync function runConverge(deps, cwd) {\n\tif (deps.alchemy === void 0) return void 0;\n\tconst stackFilePath = \".prisma-composer/alchemy.run.ts\";\n\tconst workingDirectory = cwd ?? \".\";\n\tconst invocation = {\n\t\taction: \"deploy\",\n\t\tstackFileRelativePath: stackFilePath,\n\t\tcwd: workingDirectory,\n\t\tstage: \"test\",\n\t\tenv: {}\n\t};\n\tconst outcome = await deps.alchemy(invocation);\n\tconst reproduce = reproduceCommand(invocation, outcome);\n\tif (outcome.signal !== null) return notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", `alchemy deploy was interrupted by ${outcome.signal}.`, { meta: {\n\t\tsignal: outcome.signal,\n\t\tdiagnostics: {\n\t\t\texitCode: void 0,\n\t\t\tsignal: outcome.signal,\n\t\t\tstackFilePath,\n\t\t\treproduceCommand: reproduce,\n\t\t\tcwd: workingDirectory\n\t\t}\n\t} }));\n\tconst status = outcome.exitCode ?? 1;\n\tif (status === 0) return void 0;\n\treturn notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", `alchemy deploy exited with status ${status}.`, { meta: {\n\t\texitCode: status,\n\t\tdiagnostics: {\n\t\t\texitCode: status,\n\t\t\tstackFilePath,\n\t\t\treproduceCommand: reproduce,\n\t\t\tcwd: workingDirectory\n\t\t}\n\t} }));\n}\nfunction createOperationsDouble(fixtures = {}) {\n\tconst deployCalls = [];\n\tconst devCalls = [];\n\tconst deps = {\n\t\tdeploy: [],\n\t\tdev: []\n\t};\n\tconst devUrlCalls = [];\n\tconst devStopCalls = [];\n\tconst calls = {\n\t\tdeploy: deployCalls,\n\t\tdev: devCalls,\n\t\tdevUrl: devUrlCalls,\n\t\tdevStop: devStopCalls,\n\t\tdeps\n\t};\n\treturn {\n\t\toperations: {\n\t\t\tdeploy: async (input, operationDeps) => {\n\t\t\t\tcalls.deploy.push(input);\n\t\t\t\tdeps.deploy.push(operationDeps);\n\t\t\t\tfor (const event of fixtures.deployEvents ?? []) try {\n\t\t\t\t\tinput.onEvent?.(event);\n\t\t\t\t} catch {}\n\t\t\t\tconst converge = await runConverge(operationDeps, input.cwd);\n\t\t\t\tif (converge !== void 0) return converge;\n\t\t\t\treturn fixtures.deploy ?? ok({\n\t\t\t\t\tsummary: void 0,\n\t\t\t\t\tdurationMs: 0\n\t\t\t\t});\n\t\t\t},\n\t\t\tdev: async (input, operationDeps) => {\n\t\t\t\tcalls.dev.push(input);\n\t\t\t\tdeps.dev.push(operationDeps);\n\t\t\t\treturn fixtures.dev ?? ok(devSessionDouble(input, fixtures.devEndpoints ?? [], fixtures.devEvents ?? []));\n\t\t\t},\n\t\t\tdevUrl: async (input) => {\n\t\t\t\tdevUrlCalls.push(input);\n\t\t\t\treturn fixtures.devUrl ?? ok({\n\t\t\t\t\taddress: input.address,\n\t\t\t\t\tkind: \"service\",\n\t\t\t\t\turl: \"http://localhost:3000\",\n\t\t\t\t\tstate: \"running\"\n\t\t\t\t});\n\t\t\t},\n\t\t\tdevStop: async (input) => {\n\t\t\t\tdevStopCalls.push(input);\n\t\t\t\treturn fixtures.devStop ?? ok({\n\t\t\t\t\tapp: \"app\",\n\t\t\t\t\tenvironment: input.environment ?? \"dev\",\n\t\t\t\t\tstopped: []\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tcalls\n\t};\n}\n//#endregion\nexport { createOperationsDouble, renderDevStackFile };\n\n//# sourceMappingURL=testing.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAS,iBAAiB,OAAO,WAAW,QAAQ;CACnD,IAAI;CACJ,MAAM,SAAS,IAAI,SAAS,YAAY;EACvC,gBAAgB;CACjB,CAAC;CACD,IAAI,UAAU;CACd,MAAM,UAAU;EACf,MAAM;EACN;CACD,CAAC;CACD,KAAK,MAAM,SAAS,QAAQ,MAAM,UAAU,KAAK;CACjD,OAAO;EACN;EACA;EACA,MAAM,YAAY;GACjB,IAAI,SAAS;GACb,UAAU;GACV,MAAM,UAAU,EAAE,MAAM,WAAW,CAAC;GAC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