@prisma/composer 0.6.0-dev.6 → 0.6.0-dev.8

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 (97) hide show
  1. package/dist/{app-config-Cbv_lA38-BHJsd1DF.d.mts → app-config-CFsSXEVj-B242oUnm.d.mts} +4 -4
  2. package/dist/{app-config-Cbv_lA38-BHJsd1DF.d.mts.map → app-config-CFsSXEVj-B242oUnm.d.mts.map} +1 -1
  3. package/dist/bin.mjs +6 -91
  4. package/dist/bin.mjs.map +1 -1
  5. package/dist/cli-B3sWzFlb-CxEIzKsQ.mjs +401 -0
  6. package/dist/cli-B3sWzFlb-CxEIzKsQ.mjs.map +1 -0
  7. package/dist/config-ku5b_2YD.d.mts +1 -0
  8. package/dist/config.d.mts +2 -2
  9. package/dist/container-transport-DKmKg5JQ-BMRhx5w-.mjs +75 -0
  10. package/dist/container-transport-DKmKg5JQ-BMRhx5w-.mjs.map +1 -0
  11. package/dist/control.d.mts +216 -0
  12. package/dist/control.d.mts.map +1 -0
  13. package/dist/control.mjs +70 -0
  14. package/dist/control.mjs.map +1 -0
  15. package/dist/deploy-ku5b_2YD.d.mts +1 -0
  16. package/dist/deploy.d.mts +2 -2
  17. package/dist/deploy.mjs +312 -1
  18. package/dist/deploy.mjs.map +1 -0
  19. package/dist/deployment-summary-r47O6kFr-CcMYVOn5.mjs +70 -0
  20. package/dist/deployment-summary-r47O6kFr-CcMYVOn5.mjs.map +1 -0
  21. package/dist/{dist-BdvFDCLV.mjs → dist-C5rZnr4n.mjs} +2 -2
  22. package/dist/{dist-BdvFDCLV.mjs.map → dist-C5rZnr4n.mjs.map} +1 -1
  23. package/dist/emulator-retry-DGonap4g-S8BNrXFD.mjs +24 -0
  24. package/dist/emulator-retry-DGonap4g-S8BNrXFD.mjs.map +1 -0
  25. package/dist/errors-0e8IVwzi.mjs +88 -0
  26. package/dist/errors-0e8IVwzi.mjs.map +1 -0
  27. package/dist/execute-deploy-destroy-IT4vGkMc-YM1Cv6cu.mjs +306 -0
  28. package/dist/execute-deploy-destroy-IT4vGkMc-YM1Cv6cu.mjs.map +1 -0
  29. package/dist/execute-deploy-destroy-IT4vGkMc-oO8yjHPH.mjs +265 -0
  30. package/dist/execute-deploy-destroy-IT4vGkMc-oO8yjHPH.mjs.map +1 -0
  31. package/dist/execute-dev-DLYyduEM-88uyvrbj.mjs +2009 -0
  32. package/dist/execute-dev-DLYyduEM-88uyvrbj.mjs.map +1 -0
  33. package/dist/execute-dev-DLYyduEM-BuUGTm0g.mjs +2006 -0
  34. package/dist/execute-dev-DLYyduEM-BuUGTm0g.mjs.map +1 -0
  35. package/dist/execute-log-VIOL4DBz-DBPH8By4.mjs +157 -0
  36. package/dist/execute-log-VIOL4DBz-DBPH8By4.mjs.map +1 -0
  37. package/dist/execute-log-VIOL4DBz-DKodBrxS.mjs +155 -0
  38. package/dist/execute-log-VIOL4DBz-DKodBrxS.mjs.map +1 -0
  39. package/dist/{graph-DgbALPDo-BEHF94BN.mjs → graph-BJgUfGB0-kvgFzT4q.mjs} +13 -7
  40. package/dist/graph-BJgUfGB0-kvgFzT4q.mjs.map +1 -0
  41. package/dist/{graph-DDpXh7S8-b-93BcHn.d.mts → graph-DqklX5Sf-BNS2aO1j.d.mts} +3 -3
  42. package/dist/graph-DqklX5Sf-BNS2aO1j.d.mts.map +1 -0
  43. package/dist/{graph-types-C3FOaaXm-C6_rGzfn.d.mts → graph-types-N6brq1zY-1VMNwtkJ.d.mts} +88 -5
  44. package/dist/graph-types-N6brq1zY-1VMNwtkJ.d.mts.map +1 -0
  45. package/dist/{index-BQVrMGfe.d.mts → index-DryPyF9U.d.mts} +3 -3
  46. package/dist/{index-BQVrMGfe.d.mts.map → index-DryPyF9U.d.mts.map} +1 -1
  47. package/dist/index.d.mts +3 -3
  48. package/dist/index.mjs +2 -2
  49. package/dist/internal-error-BIc-ehme-Ck_lgxD_.mjs +18 -0
  50. package/dist/internal-error-BIc-ehme-Ck_lgxD_.mjs.map +1 -0
  51. package/dist/local-target-DnA2E8IN.mjs +47 -0
  52. package/dist/local-target-DnA2E8IN.mjs.map +1 -0
  53. package/dist/local-target-DuSyWeYc.mjs +68 -0
  54. package/dist/local-target-DuSyWeYc.mjs.map +1 -0
  55. package/dist/local-target.d.mts +1 -1
  56. package/dist/local-target.mjs +2 -46
  57. package/dist/{nextjs-DLyeRR7M-D47aMmfr.d.mts → nextjs-DLyeRR7M-DZODs9tk.d.mts} +3 -3
  58. package/dist/{nextjs-DLyeRR7M-D47aMmfr.d.mts.map → nextjs-DLyeRR7M-DZODs9tk.d.mts.map} +1 -1
  59. package/dist/nextjs-control.d.mts +4 -4
  60. package/dist/nextjs.d.mts +1 -1
  61. package/dist/node-control.d.mts +3 -3
  62. package/dist/node.d.mts +2 -2
  63. package/dist/pipeline-D3QoVzAB-Ci2aJ2mE.mjs +331 -0
  64. package/dist/pipeline-D3QoVzAB-Ci2aJ2mE.mjs.map +1 -0
  65. package/dist/pipeline-D3QoVzAB-D_ufjg3N.mjs +857 -0
  66. package/dist/pipeline-D3QoVzAB-D_ufjg3N.mjs.map +1 -0
  67. package/dist/render-error-DsPN5qfr-CkVGj9uP.mjs +30 -0
  68. package/dist/render-error-DsPN5qfr-CkVGj9uP.mjs.map +1 -0
  69. package/dist/report.d.mts +4 -3
  70. package/dist/report.d.mts.map +1 -1
  71. package/dist/report.mjs +4 -1
  72. package/dist/report.mjs.map +1 -1
  73. package/dist/result-CFqJKiqg.mjs +106 -0
  74. package/dist/result-CFqJKiqg.mjs.map +1 -0
  75. package/dist/result-CzGChwbZ.mjs +231 -0
  76. package/dist/result-CzGChwbZ.mjs.map +1 -0
  77. package/dist/run-alchemy-hghRtddF-CQHOzlrW.mjs +48 -0
  78. package/dist/run-alchemy-hghRtddF-CQHOzlrW.mjs.map +1 -0
  79. package/dist/service-rpc.d.mts +2 -2
  80. package/dist/service-rpc.mjs +2 -2
  81. package/dist/shared-CCaR42wo-BvegvmA_.mjs +265 -0
  82. package/dist/shared-CCaR42wo-BvegvmA_.mjs.map +1 -0
  83. package/dist/testing.d.mts +1 -1
  84. package/package.json +11 -10
  85. package/src/exports/control.ts +1 -0
  86. package/dist/cli-IDJ-0ZFU-Dz2KMWtU.mjs +0 -3269
  87. package/dist/cli-IDJ-0ZFU-Dz2KMWtU.mjs.map +0 -1
  88. package/dist/cli-error-HxLpXiUX-LVlg5SlD.mjs +0 -16
  89. package/dist/cli-error-HxLpXiUX-LVlg5SlD.mjs.map +0 -1
  90. package/dist/config-whuqZ5xT.d.mts +0 -1
  91. package/dist/deploy-C4DxNkJ9-D73lmBqy.mjs +0 -313
  92. package/dist/deploy-C4DxNkJ9-D73lmBqy.mjs.map +0 -1
  93. package/dist/deploy-whuqZ5xT.d.mts +0 -1
  94. package/dist/graph-DDpXh7S8-b-93BcHn.d.mts.map +0 -1
  95. package/dist/graph-DgbALPDo-BEHF94BN.mjs.map +0 -1
  96. package/dist/graph-types-C3FOaaXm-C6_rGzfn.d.mts.map +0 -1
  97. package/dist/local-target.mjs.map +0 -1
@@ -0,0 +1,231 @@
1
+ import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
2
+ import { t as InternalError } from "./internal-error-BIc-ehme-Ck_lgxD_.mjs";
3
+ import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
4
+ import { createRequire } from "node:module";
5
+ import * as fs from "node:fs";
6
+ import * as path from "node:path";
7
+ //#region ../../0-framework/3-tooling/cli/dist/shared-CCaR42wo.mjs
8
+ /**
9
+ * Deploy preflight (TML-3158): verify that alchemy resolves the exact `effect`
10
+ * version @prisma/composer pins. Package managers cannot be made to enforce
11
+ * this — alchemy's own peer range accepts newer effect betas, and npm resolves
12
+ * transitive peer conflicts with a warning, not a failure — so a floating
13
+ * `@effect/*` range anywhere in the consumer's tree can hoist a newer effect
14
+ * to the root, where alchemy picks it up and crashes mid-deploy
15
+ * (`TypeError: Schedule.either is not a function`). This check turns that
16
+ * silent break into a start-up error naming the fix.
17
+ */
18
+ /** Walks up from `startDir` looking for `node_modules/alchemy` (mirrors resolveAlchemyBin). Undefined when absent — the check skips rather than second-guessing later, clearer failures. */
19
+ function findAlchemyPackageDir(startDir) {
20
+ let dir = startDir;
21
+ while (true) {
22
+ const candidate = path.join(dir, "node_modules", "alchemy");
23
+ if (fs.existsSync(path.join(candidate, "package.json"))) return candidate;
24
+ const parent = path.dirname(dir);
25
+ if (parent === dir) return void 0;
26
+ dir = parent;
27
+ }
28
+ }
29
+ /**
30
+ * The `effect` version Node gives `packageDir`'s code, resolved exactly as
31
+ * Node would: from the package's real path (so pnpm symlink layouts resolve
32
+ * from the package's own store position, like at runtime). Undefined when
33
+ * `effect` is not resolvable from there.
34
+ */
35
+ function resolveEffectVersionFrom(packageDir) {
36
+ let entry;
37
+ try {
38
+ entry = createRequire(path.join(fs.realpathSync(packageDir), "noop.js")).resolve("effect");
39
+ } catch {
40
+ return;
41
+ }
42
+ let dir = path.dirname(entry);
43
+ while (!fs.existsSync(path.join(dir, "package.json"))) {
44
+ const parent = path.dirname(dir);
45
+ if (parent === dir) return void 0;
46
+ dir = parent;
47
+ }
48
+ const version = JSON.parse(fs.readFileSync(path.join(dir, "package.json"), "utf-8")).version;
49
+ return typeof version === "string" ? version : void 0;
50
+ }
51
+ /**
52
+ * The `effect` version @prisma/composer pins, read from its own installed
53
+ * package.json — the single source of truth; never hardcoded here. Undefined
54
+ * when @prisma/composer is not resolvable from `startDir` (e.g. the CLI is
55
+ * driven some other way), in which case the check skips.
56
+ *
57
+ * Assumes the pin is an exact version — effectMismatchError compares with
58
+ * `===`, which scripts/check-npm-effect-resolution.mjs enforces in CI;
59
+ * relaxing the pin to a range means revisiting that comparison.
60
+ */
61
+ function requiredEffectVersion(startDir) {
62
+ let manifestPath;
63
+ try {
64
+ manifestPath = createRequire(path.join(startDir, "noop.js")).resolve("@prisma/composer/package.json");
65
+ } catch {
66
+ return;
67
+ }
68
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf-8"));
69
+ if (typeof manifest !== "object" || manifest === null || !("dependencies" in manifest)) return;
70
+ const dependencies = manifest.dependencies;
71
+ if (typeof dependencies !== "object" || dependencies === null || !("effect" in dependencies)) return;
72
+ const version = dependencies.effect;
73
+ return typeof version === "string" ? version : void 0;
74
+ }
75
+ /** Pure comparison + parts rendering, separated so tests cover the rule without a filesystem. Returns the structured error parts, or undefined when the tree is healthy or either side is unknown. */
76
+ function effectMismatchError(found, required) {
77
+ if (found === void 0 || required === void 0 || found === required) return void 0;
78
+ return {
79
+ summary: `Dependency conflict: alchemy resolves effect@${found}, but @prisma/composer requires effect@${required}.`,
80
+ why: "Your package manager installed a second effect that alchemy picks up; deploying with it would crash inside alchemy.",
81
+ fix: `Add this to your app's package.json, then reinstall:
82
+
83
+ "overrides": { "effect": "${required}" }\n\n(npm uses "overrides"; yarn calls it "resolutions", pnpm "pnpm.overrides".)`,
84
+ meta: {
85
+ found,
86
+ required
87
+ }
88
+ };
89
+ }
90
+ /** Runs the preflight from the app's directory; throws DEPS.EFFECT_VERSION_CONFLICT on a mismatched tree, no-op otherwise. */
91
+ function checkEffectResolution(cwd) {
92
+ const alchemyDir = findAlchemyPackageDir(cwd);
93
+ if (alchemyDir === void 0) return;
94
+ const parts = effectMismatchError(resolveEffectVersionFrom(alchemyDir), requiredEffectVersion(cwd));
95
+ if (parts !== void 0) throw new CliStructuredError("DEPS.EFFECT_VERSION_CONFLICT", parts.summary, {
96
+ why: parts.why,
97
+ fix: parts.fix,
98
+ meta: parts.meta
99
+ });
100
+ }
101
+ /**
102
+ * Reads the execution diagnostics an engine-failure error carries in
103
+ * `meta.diagnostics`; undefined for every other failure.
104
+ */
105
+ function executionDiagnostics(f) {
106
+ const diagnostics = f.meta?.["diagnostics"];
107
+ if (typeof diagnostics !== "object" || diagnostics === null) return void 0;
108
+ const candidate = blindCast(diagnostics);
109
+ if (candidate["exitCode"] !== void 0 && typeof candidate["exitCode"] !== "number" || typeof candidate["stackFilePath"] !== "string" || typeof candidate["reproduceCommand"] !== "string" || typeof candidate["cwd"] !== "string") return;
110
+ return blindCast(diagnostics);
111
+ }
112
+ /**
113
+ * Site-specific wrap for foreign extension/environment causes — passthrough
114
+ * when already structured; never a boundary fallback (base-type rule 6(ii)).
115
+ */
116
+ function toStructured(code, error) {
117
+ return CliStructuredError.is(error) ? error : new CliStructuredError(code, error instanceof Error ? error.message : String(error), { cause: error });
118
+ }
119
+ /** Diagnoses a failed executor import: when the app's tree resolves a
120
+ * mismatched `effect` (the known way that import breaks), the failure is the
121
+ * fix-naming DEPS.EFFECT_VERSION_CONFLICT from checkEffectResolution with the
122
+ * import error riding as cause; otherwise DEPS.EXECUTOR_UNLOADABLE — an
123
+ * environmental failure of the consumer's installed tree, not a bug here. */
124
+ function executorLoadFailure(operation, error, cwd) {
125
+ try {
126
+ checkEffectResolution(cwd);
127
+ } catch (diagnostic) {
128
+ if (CliStructuredError.is(diagnostic)) return new CliStructuredError(diagnostic.code, diagnostic.message, {
129
+ ...diagnostic.why !== void 0 ? { why: diagnostic.why } : {},
130
+ ...diagnostic.fix !== void 0 ? { fix: diagnostic.fix } : {},
131
+ ...diagnostic.meta !== void 0 ? { meta: diagnostic.meta } : {},
132
+ cause: error
133
+ });
134
+ }
135
+ return new CliStructuredError("DEPS.EXECUTOR_UNLOADABLE", `Could not load the ${operation} executor: ${error instanceof Error ? error.message : String(error)}`, {
136
+ why: `The ${operation} operation's executor imports the deploy engine's provider tree from your app's installed dependencies, and that import failed.`,
137
+ fix: "Reinstall your dependencies, and check that `alchemy` is installed and loadable from your app.",
138
+ cause: error
139
+ });
140
+ }
141
+ //#endregion
142
+ //#region ../../0-framework/0-foundation/foundation/dist/result.mjs
143
+ /**
144
+ * Generic Result type for representing success or failure outcomes.
145
+ *
146
+ * This is the standard way to return "expected failures" as values rather than
147
+ * throwing exceptions. See docs/Error Handling.md for the full taxonomy.
148
+ *
149
+ * Naming rationale:
150
+ * - `Ok<T>` / `NotOk<F>` mirror the `ok: true/false` discriminator
151
+ * - `NotOk` avoids collision with domain types like "Failure" or "Error"
152
+ * - `failure` property distinguishes from JS Error semantics
153
+ */
154
+ /**
155
+ * Result class that implements both Ok and NotOk variants.
156
+ */
157
+ var ResultImpl = class ResultImpl {
158
+ ok;
159
+ _value;
160
+ _failure;
161
+ constructor(ok, valueOrFailure) {
162
+ this.ok = ok;
163
+ if (ok) this._value = blindCast(valueOrFailure);
164
+ else this._failure = blindCast(valueOrFailure);
165
+ Object.freeze(this);
166
+ }
167
+ get value() {
168
+ if (!this.ok) throw new InternalError("Cannot access value on NotOk result");
169
+ return this._value;
170
+ }
171
+ get failure() {
172
+ if (this.ok) throw new InternalError("Cannot access failure on Ok result");
173
+ return this._failure;
174
+ }
175
+ /**
176
+ * Creates a successful result.
177
+ */
178
+ static ok(value) {
179
+ return blindCast(new ResultImpl(true, value));
180
+ }
181
+ /**
182
+ * Creates an unsuccessful result.
183
+ */
184
+ static notOk(failure) {
185
+ return blindCast(new ResultImpl(false, failure));
186
+ }
187
+ /**
188
+ * Asserts that this result is Ok and returns the value.
189
+ * Throws if the result is NotOk.
190
+ */
191
+ assertOk() {
192
+ if (!this.ok) throw new InternalError("Expected Ok result but got NotOk");
193
+ return this.value;
194
+ }
195
+ /**
196
+ * Asserts that this result is NotOk and returns the failure.
197
+ * Throws if the result is Ok.
198
+ */
199
+ assertNotOk() {
200
+ if (this.ok) throw new InternalError("Expected NotOk result but got Ok");
201
+ return this.failure;
202
+ }
203
+ };
204
+ /**
205
+ * Creates a successful result.
206
+ */
207
+ function ok(value) {
208
+ return ResultImpl.ok(value);
209
+ }
210
+ /**
211
+ * Creates an unsuccessful result.
212
+ */
213
+ function notOk(failure) {
214
+ return ResultImpl.notOk(failure);
215
+ }
216
+ /**
217
+ * Singleton for void success results.
218
+ * Use this for validation checks that don't produce a value.
219
+ */
220
+ const OK_VOID = ResultImpl.ok(void 0);
221
+ /**
222
+ * Returns a successful void result.
223
+ * Use this for validation checks that don't produce a value.
224
+ */
225
+ function okVoid() {
226
+ return OK_VOID;
227
+ }
228
+ //#endregion
229
+ export { executorLoadFailure as a, executionDiagnostics as i, ok as n, toStructured as o, okVoid as r, notOk as t };
230
+
231
+ //# sourceMappingURL=result-CzGChwbZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result-CzGChwbZ.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/shared-CCaR42wo.mjs","../../../0-framework/0-foundation/foundation/dist/result.mjs"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n//#region src/check-effect-resolution.ts\n/**\n* Deploy preflight (TML-3158): verify that alchemy resolves the exact `effect`\n* version @prisma/composer pins. Package managers cannot be made to enforce\n* this — alchemy's own peer range accepts newer effect betas, and npm resolves\n* transitive peer conflicts with a warning, not a failure — so a floating\n* `@effect/*` range anywhere in the consumer's tree can hoist a newer effect\n* to the root, where alchemy picks it up and crashes mid-deploy\n* (`TypeError: Schedule.either is not a function`). This check turns that\n* silent break into a start-up error naming the fix.\n*/\n/** Walks up from `startDir` looking for `node_modules/alchemy` (mirrors resolveAlchemyBin). Undefined when absent — the check skips rather than second-guessing later, clearer failures. */\nfunction findAlchemyPackageDir(startDir) {\n\tlet dir = startDir;\n\twhile (true) {\n\t\tconst candidate = path.join(dir, \"node_modules\", \"alchemy\");\n\t\tif (fs.existsSync(path.join(candidate, \"package.json\"))) return candidate;\n\t\tconst parent = path.dirname(dir);\n\t\tif (parent === dir) return void 0;\n\t\tdir = parent;\n\t}\n}\n/**\n* The `effect` version Node gives `packageDir`'s code, resolved exactly as\n* Node would: from the package's real path (so pnpm symlink layouts resolve\n* from the package's own store position, like at runtime). Undefined when\n* `effect` is not resolvable from there.\n*/\nfunction resolveEffectVersionFrom(packageDir) {\n\tlet entry;\n\ttry {\n\t\tentry = createRequire(path.join(fs.realpathSync(packageDir), \"noop.js\")).resolve(\"effect\");\n\t} catch {\n\t\treturn;\n\t}\n\tlet dir = path.dirname(entry);\n\twhile (!fs.existsSync(path.join(dir, \"package.json\"))) {\n\t\tconst parent = path.dirname(dir);\n\t\tif (parent === dir) return void 0;\n\t\tdir = parent;\n\t}\n\tconst version = JSON.parse(fs.readFileSync(path.join(dir, \"package.json\"), \"utf-8\")).version;\n\treturn typeof version === \"string\" ? version : void 0;\n}\n/**\n* The `effect` version @prisma/composer pins, read from its own installed\n* package.json — the single source of truth; never hardcoded here. Undefined\n* when @prisma/composer is not resolvable from `startDir` (e.g. the CLI is\n* driven some other way), in which case the check skips.\n*\n* Assumes the pin is an exact version — effectMismatchError compares with\n* `===`, which scripts/check-npm-effect-resolution.mjs enforces in CI;\n* relaxing the pin to a range means revisiting that comparison.\n*/\nfunction requiredEffectVersion(startDir) {\n\tlet manifestPath;\n\ttry {\n\t\tmanifestPath = createRequire(path.join(startDir, \"noop.js\")).resolve(\"@prisma/composer/package.json\");\n\t} catch {\n\t\treturn;\n\t}\n\tconst manifest = JSON.parse(fs.readFileSync(manifestPath, \"utf-8\"));\n\tif (typeof manifest !== \"object\" || manifest === null || !(\"dependencies\" in manifest)) return;\n\tconst dependencies = manifest.dependencies;\n\tif (typeof dependencies !== \"object\" || dependencies === null || !(\"effect\" in dependencies)) return;\n\tconst version = dependencies.effect;\n\treturn typeof version === \"string\" ? version : void 0;\n}\n/** Pure comparison + parts rendering, separated so tests cover the rule without a filesystem. Returns the structured error parts, or undefined when the tree is healthy or either side is unknown. */\nfunction effectMismatchError(found, required) {\n\tif (found === void 0 || required === void 0 || found === required) return void 0;\n\treturn {\n\t\tsummary: `Dependency conflict: alchemy resolves effect@${found}, but @prisma/composer requires effect@${required}.`,\n\t\twhy: \"Your package manager installed a second effect that alchemy picks up; deploying with it would crash inside alchemy.\",\n\t\tfix: `Add this to your app's package.json, then reinstall:\n\n \"overrides\": { \"effect\": \"${required}\" }\\n\\n(npm uses \"overrides\"; yarn calls it \"resolutions\", pnpm \"pnpm.overrides\".)`,\n\t\tmeta: {\n\t\t\tfound,\n\t\t\trequired\n\t\t}\n\t};\n}\n/** Runs the preflight from the app's directory; throws DEPS.EFFECT_VERSION_CONFLICT on a mismatched tree, no-op otherwise. */\nfunction checkEffectResolution(cwd) {\n\tconst alchemyDir = findAlchemyPackageDir(cwd);\n\tif (alchemyDir === void 0) return;\n\tconst parts = effectMismatchError(resolveEffectVersionFrom(alchemyDir), requiredEffectVersion(cwd));\n\tif (parts !== void 0) throw new CliStructuredError(\"DEPS.EFFECT_VERSION_CONFLICT\", parts.summary, {\n\t\twhy: parts.why,\n\t\tfix: parts.fix,\n\t\tmeta: parts.meta\n\t});\n}\n//#endregion\n//#region src/operations/shared.ts\n/**\n* Reads the execution diagnostics an engine-failure error carries in\n* `meta.diagnostics`; undefined for every other failure.\n*/\nfunction executionDiagnostics(f) {\n\tconst diagnostics = f.meta?.[\"diagnostics\"];\n\tif (typeof diagnostics !== \"object\" || diagnostics === null) return void 0;\n\tconst candidate = blindCast(diagnostics);\n\tif (candidate[\"exitCode\"] !== void 0 && typeof candidate[\"exitCode\"] !== \"number\" || typeof candidate[\"stackFilePath\"] !== \"string\" || typeof candidate[\"reproduceCommand\"] !== \"string\" || typeof candidate[\"cwd\"] !== \"string\") return;\n\treturn blindCast(diagnostics);\n}\n/**\n* Site-specific wrap for foreign extension/environment causes — passthrough\n* when already structured; never a boundary fallback (base-type rule 6(ii)).\n*/\nfunction toStructured(code, error) {\n\treturn CliStructuredError.is(error) ? error : new CliStructuredError(code, error instanceof Error ? error.message : String(error), { cause: error });\n}\n/** Diagnoses a failed executor import: when the app's tree resolves a\n* mismatched `effect` (the known way that import breaks), the failure is the\n* fix-naming DEPS.EFFECT_VERSION_CONFLICT from checkEffectResolution with the\n* import error riding as cause; otherwise DEPS.EXECUTOR_UNLOADABLE — an\n* environmental failure of the consumer's installed tree, not a bug here. */\nfunction executorLoadFailure(operation, error, cwd) {\n\ttry {\n\t\tcheckEffectResolution(cwd);\n\t} catch (diagnostic) {\n\t\tif (CliStructuredError.is(diagnostic)) return new CliStructuredError(diagnostic.code, diagnostic.message, {\n\t\t\t...diagnostic.why !== void 0 ? { why: diagnostic.why } : {},\n\t\t\t...diagnostic.fix !== void 0 ? { fix: diagnostic.fix } : {},\n\t\t\t...diagnostic.meta !== void 0 ? { meta: diagnostic.meta } : {},\n\t\t\tcause: error\n\t\t});\n\t}\n\treturn new CliStructuredError(\"DEPS.EXECUTOR_UNLOADABLE\", `Could not load the ${operation} executor: ${error instanceof Error ? error.message : String(error)}`, {\n\t\twhy: `The ${operation} operation's executor imports the deploy engine's provider tree from your app's installed dependencies, and that import failed.`,\n\t\tfix: \"Reinstall your dependencies, and check that `alchemy` is installed and loadable from your app.\",\n\t\tcause: error\n\t});\n}\n//#endregion\nexport { checkEffectResolution as i, executorLoadFailure as n, toStructured as r, executionDiagnostics as t };\n\n//# sourceMappingURL=shared-CCaR42wo.mjs.map","import { t as blindCast } from \"./casts-DpaahrlC.mjs\";\nimport { t as InternalError } from \"./internal-error-BIc-ehme.mjs\";\n//#region src/result.ts\n/**\n* Generic Result type for representing success or failure outcomes.\n*\n* This is the standard way to return \"expected failures\" as values rather than\n* throwing exceptions. See docs/Error Handling.md for the full taxonomy.\n*\n* Naming rationale:\n* - `Ok<T>` / `NotOk<F>` mirror the `ok: true/false` discriminator\n* - `NotOk` avoids collision with domain types like \"Failure\" or \"Error\"\n* - `failure` property distinguishes from JS Error semantics\n*/\n/**\n* Result class that implements both Ok and NotOk variants.\n*/\nvar ResultImpl = class ResultImpl {\n\tok;\n\t_value;\n\t_failure;\n\tconstructor(ok, valueOrFailure) {\n\t\tthis.ok = ok;\n\t\tif (ok) this._value = blindCast(valueOrFailure);\n\t\telse this._failure = blindCast(valueOrFailure);\n\t\tObject.freeze(this);\n\t}\n\tget value() {\n\t\tif (!this.ok) throw new InternalError(\"Cannot access value on NotOk result\");\n\t\treturn this._value;\n\t}\n\tget failure() {\n\t\tif (this.ok) throw new InternalError(\"Cannot access failure on Ok result\");\n\t\treturn this._failure;\n\t}\n\t/**\n\t* Creates a successful result.\n\t*/\n\tstatic ok(value) {\n\t\treturn blindCast(new ResultImpl(true, value));\n\t}\n\t/**\n\t* Creates an unsuccessful result.\n\t*/\n\tstatic notOk(failure) {\n\t\treturn blindCast(new ResultImpl(false, failure));\n\t}\n\t/**\n\t* Asserts that this result is Ok and returns the value.\n\t* Throws if the result is NotOk.\n\t*/\n\tassertOk() {\n\t\tif (!this.ok) throw new InternalError(\"Expected Ok result but got NotOk\");\n\t\treturn this.value;\n\t}\n\t/**\n\t* Asserts that this result is NotOk and returns the failure.\n\t* Throws if the result is Ok.\n\t*/\n\tassertNotOk() {\n\t\tif (this.ok) throw new InternalError(\"Expected NotOk result but got Ok\");\n\t\treturn this.failure;\n\t}\n};\n/**\n* Creates a successful result.\n*/\nfunction ok(value) {\n\treturn ResultImpl.ok(value);\n}\n/**\n* Creates an unsuccessful result.\n*/\nfunction notOk(failure) {\n\treturn ResultImpl.notOk(failure);\n}\n/**\n* Singleton for void success results.\n* Use this for validation checks that don't produce a value.\n*/\nconst OK_VOID = ResultImpl.ok(void 0);\n/**\n* Returns a successful void result.\n* Use this for validation checks that don't produce a value.\n*/\nfunction okVoid() {\n\treturn OK_VOID;\n}\n//#endregion\nexport { notOk, ok, okVoid };\n\n//# sourceMappingURL=result.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,SAAS,sBAAsB,UAAU;CACxC,IAAI,MAAM;CACV,OAAO,MAAM;EACZ,MAAM,YAAY,KAAK,KAAK,KAAK,gBAAgB,SAAS;EAC1D,IAAI,GAAG,WAAW,KAAK,KAAK,WAAW,cAAc,CAAC,GAAG,OAAO;EAChE,MAAM,SAAS,KAAK,QAAQ,GAAG;EAC/B,IAAI,WAAW,KAAK,OAAO,KAAK;EAChC,MAAM;CACP;AACD;;;;;;;AAOA,SAAS,yBAAyB,YAAY;CAC7C,IAAI;CACJ,IAAI;EACH,Q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AChK,KAAK,OAAO,UAAU;EACtB,KAAK;EACL,OAAO;CACR,CAAC;AACF;;;;;;;;;;;;;;;;;AC3HA,IAAI,aAAa,MAAM,WAAW;CACjC;CACA;CACA;CACA,YAAY,IAAI,gBAAgB;EAC/B,KAAK,KAAK;EACV,IAAI,IAAI,KAAK,SAAS,UAAU,cAAc;OACzC,KAAK,WAAW,UAAU,cAAc;EAC7C,OAAO,OAAO,IAAI;CACnB;CACA,IAAI,QAAQ;EACX,IAAI,CAAC,KAAK,IAAI,MAAM,IAAI,cAAc,qCAAqC;EAC3E,OAAO,KAAK;CACb;CACA,IAAI,UAAU;EACb,IAAI,KAAK,IAAI,MAAM,IAAI,cAAc,oCAAoC;EACzE,OAAO,KAAK;CACb;;;;CAIA,OAAO,GAAG,OAAO;EAChB,OAAO,UAAU,IAAI,WAAW,MAAM,KAAK,CAAC;CAC7C;;;;CAIA,OAAO,MAAM,SAAS;EACrB,OAAO,UAAU,IAAI,WAAW,OAAO,OAAO,CAAC;CAChD;;;;;CAKA,WAAW;EACV,IAAI,CAAC,KAAK,IAAI,MAAM,IAAI,cAAc,kCAAkC;EACxE,OAAO,KAAK;CACb;;;;;CAKA,cAAc;EACb,IAAI,KAAK,IAAI,MAAM,IAAI,cAAc,kCAAkC;EACvE,OAAO,KAAK;CACb;AACD;;;;AAIA,SAAS,GAAG,OAAO;CAClB,OAAO,WAAW,GAAG,KAAK;AAC3B;;;;AAIA,SAAS,MAAM,SAAS;CACvB,OAAO,WAAW,MAAM,OAAO;AAChC;;;;;AAKA,MAAM,UAAU,WAAW,GAAG,KAAK,CAAC;;;;;AAKpC,SAAS,SAAS;CACjB,OAAO;AACR"}
@@ -0,0 +1,48 @@
1
+ import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
2
+ import * as fs from "node:fs";
3
+ import * as path from "node:path";
4
+ import { spawnSync } from "node:child_process";
5
+ //#region ../../0-framework/3-tooling/cli/dist/run-alchemy-hghRtddF.mjs
6
+ /**
7
+ * Pipeline step 7 (deploy-cli.md § The pipeline; design-notes.md's "Driving
8
+ * Alchemy" call): shell out to the generated stack file. Resolves the
9
+ * workspace's own installed `alchemy` bin (walking up `node_modules/.bin`
10
+ * from the generated file's package dir) rather than going through
11
+ * `bunx`/`npx`, so this works the same under node and bun — the resolved
12
+ * bin's own launcher (`alchemy/bin/cli.js`) does its own node/bun dispatch
13
+ * from there, driven by the env it inherits.
14
+ */
15
+ /** Walks up from `startDir` looking for `node_modules/.bin/alchemy`. */
16
+ function resolveAlchemyBin(startDir) {
17
+ let dir = startDir;
18
+ while (true) {
19
+ const candidate = path.join(dir, "node_modules", ".bin", "alchemy");
20
+ if (fs.existsSync(candidate)) return candidate;
21
+ const parent = path.dirname(dir);
22
+ if (parent === dir) throw new CliStructuredError("DEPLOY.ALCHEMY_BIN_MISSING", `Could not find an installed \`alchemy\` bin above "${startDir}".`, { fix: "Add \"alchemy\" as a dependency of your app." });
23
+ dir = parent;
24
+ }
25
+ }
26
+ /** Runs `alchemy deploy|destroy <stack file> --yes --stage <stage>`, inheriting stdio + env, plus every extension's resolved container. */
27
+ function runAlchemy(input) {
28
+ const result = spawnSync(resolveAlchemyBin(input.cwd), [
29
+ input.command,
30
+ input.stackFileRelativePath,
31
+ "--yes",
32
+ "--stage",
33
+ input.stage
34
+ ], {
35
+ cwd: input.cwd,
36
+ stdio: "inherit",
37
+ env: {
38
+ ...input.env ?? process.env,
39
+ ...input.containerEnv
40
+ }
41
+ });
42
+ if (result.error !== void 0) throw result.error;
43
+ return result.status ?? 1;
44
+ }
45
+ //#endregion
46
+ export { runAlchemy as t };
47
+
48
+ //# sourceMappingURL=run-alchemy-hghRtddF-CQHOzlrW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-alchemy-hghRtddF-CQHOzlrW.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/run-alchemy-hghRtddF.mjs"],"sourcesContent":["import { CliStructuredError } from \"@internal/foundation/errors\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { spawnSync } from \"node:child_process\";\n//#region src/run-alchemy.ts\n/**\n* Pipeline step 7 (deploy-cli.md § The pipeline; design-notes.md's \"Driving\n* Alchemy\" call): shell out to the generated stack file. Resolves the\n* workspace's own installed `alchemy` bin (walking up `node_modules/.bin`\n* from the generated file's package dir) rather than going through\n* `bunx`/`npx`, so this works the same under node and bun — the resolved\n* bin's own launcher (`alchemy/bin/cli.js`) does its own node/bun dispatch\n* from there, driven by the env it inherits.\n*/\n/** Walks up from `startDir` looking for `node_modules/.bin/alchemy`. */\nfunction resolveAlchemyBin(startDir) {\n\tlet dir = startDir;\n\twhile (true) {\n\t\tconst candidate = path.join(dir, \"node_modules\", \".bin\", \"alchemy\");\n\t\tif (fs.existsSync(candidate)) return candidate;\n\t\tconst parent = path.dirname(dir);\n\t\tif (parent === dir) throw new CliStructuredError(\"DEPLOY.ALCHEMY_BIN_MISSING\", `Could not find an installed \\`alchemy\\` bin above \"${startDir}\".`, { fix: \"Add \\\"alchemy\\\" as a dependency of your app.\" });\n\t\tdir = parent;\n\t}\n}\n/** Runs `alchemy deploy|destroy <stack file> --yes --stage <stage>`, inheriting stdio + env, plus every extension's resolved container. */\nfunction runAlchemy(input) {\n\tconst result = spawnSync(resolveAlchemyBin(input.cwd), [\n\t\tinput.command,\n\t\tinput.stackFileRelativePath,\n\t\t\"--yes\",\n\t\t\"--stage\",\n\t\tinput.stage\n\t], {\n\t\tcwd: input.cwd,\n\t\tstdio: \"inherit\",\n\t\tenv: {\n\t\t\t...input.env ?? process.env,\n\t\t\t...input.containerEnv\n\t\t}\n\t});\n\tif (result.error !== void 0) throw result.error;\n\treturn result.status ?? 1;\n}\n//#endregion\nexport { runAlchemy as n, resolveAlchemyBin as t };\n\n//# sourceMappingURL=run-alchemy-hghRtddF.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,kBAAkB,UAAU;CACpC,IAAI,MAAM;CACV,OAAO,MAAM;EACZ,MAAM,YAAY,KAAK,KAAK,KAAK,gBAAgB,QAAQ,SAAS;EAClE,IAAI,GAAG,WAAW,SAAS,GAAG,OAAO;EACrC,MAAM,SAAS,KAAK,QAAQ,GAAG;EAC/B,IAAI,WAAW,KAAK,MAAM,IAAI,mBAAmB,8BAA8B,sDAAsD,SAAS,KAAK,EAAE,KAAK,+CAA+C,CAAC;EAC1M,MAAM;CACP;AACD;;AAEA,SAAS,WAAW,OAAO;CAC1B,MAAM,SAAS,UAAU,kBAAkB,MAAM,GAAG,GAAG;EACtD,MAAM;EACN,MAAM;EACN;EACA;EACA,MAAM;CACP,GAAG;EACF,KAAK,MAAM;EACX,OAAO;EACP,KAAK;GACJ,GAAG,MAAM,OAAO,QAAQ;GACxB,GAAG,MAAM;EACV;CACD,CAAC;CACD,IAAI,OAAO,UAAU,KAAK,GAAG,MAAM,OAAO;CAC1C,OAAO,OAAO,UAAU;AACzB"}
@@ -1,5 +1,5 @@
1
- import { L as RunnableServiceNode, M as ProvisionNeed, o as Contract, s as DependencyEnd } from "./graph-types-C3FOaaXm-C6_rGzfn.mjs";
2
- import "./index-BQVrMGfe.mjs";
1
+ import { L as RunnableServiceNode, M as ProvisionNeed, o as Contract, s as DependencyEnd } from "./graph-types-N6brq1zY-1VMNwtkJ.mjs";
2
+ import "./index-DryPyF9U.mjs";
3
3
  import { StandardSchemaV1 } from "@standard-schema/spec";
4
4
  //#region ../../0-framework/2-authoring/service-rpc/dist/index.d.mts
5
5
  //#region src/rpc.d.ts
@@ -1,6 +1,6 @@
1
1
  import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
2
- import { i as dependency, p as provisionNeed } from "./graph-DgbALPDo-BEHF94BN.mjs";
3
- import { c as string } from "./dist-BdvFDCLV.mjs";
2
+ import { i as dependency, p as provisionNeed } from "./graph-BJgUfGB0-kvgFzT4q.mjs";
3
+ import { c as string } from "./dist-C5rZnr4n.mjs";
4
4
  //#region ../../0-framework/2-authoring/service-rpc/dist/index.mjs
5
5
  /** Bounded jittered backoff for retrying a dropped call. `maxRetries` is retries after the first attempt. */
6
6
  const RETRY = {
@@ -0,0 +1,265 @@
1
+ import { createRequire } from "node:module";
2
+ import * as fs from "node:fs";
3
+ import * as path from "node:path";
4
+ //#region ../../0-framework/0-foundation/foundation/dist/casts-DpaahrlC.mjs
5
+ /**
6
+ * **Last-resort escape hatch for unsafe type assertions. Not a sanctioned tool to reach for.**
7
+ *
8
+ * Before reaching for `blindCast`, **rewrite the surrounding code so the cast becomes
9
+ * unnecessary**: tighten an input type, add a runtime check that narrows via a type
10
+ * predicate, restructure a generic so the compiler can see the relationship you're
11
+ * asserting, or use {@link castAs} when the value already satisfies the target type.
12
+ * Only when no rewrite is feasible does `blindCast` become the right answer — and at
13
+ * that point, the `Reason` literal you supply must articulate the compromise in
14
+ * language a reviewer can evaluate.
15
+ *
16
+ * The reviewer **will** validate the `Reason`. If it doesn't hold up under scrutiny,
17
+ * that is not a signal to soften the reason; it is a signal to go back and solve the
18
+ * underlying type-system problem properly. An unconvincing justification is rework,
19
+ * not a free pass.
20
+ *
21
+ * `blindCast` is the auditable form of `as Foo` / `as unknown as Foo`: it bypasses
22
+ * the compiler's checks (the input type is `unknown`, the output type is whatever the
23
+ * caller asks for), but it forces the unsafety to be named at the call site instead of
24
+ * smuggled in via a bare `as`. The `Reason` type parameter exists only at compile
25
+ * time — it is not present in the emitted JavaScript — but it is grep-able and
26
+ * visible to future readers.
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * const stringValue = blindCast<
31
+ * string,
32
+ * "JSON.parse returns `unknown`; this field is documented to be a string in the API contract"
33
+ * >(parsed[key]);
34
+ * ```
35
+ *
36
+ * @typeParam TargetType - The type the caller is asserting the input has.
37
+ * @typeParam _Reason - A string literal describing why bypassing the type system is necessary here.
38
+ * Only meaningful at compile time. The reviewer evaluates whether it justifies the unsafety.
39
+ */
40
+ function blindCast(input) {
41
+ return input;
42
+ }
43
+ //#endregion
44
+ //#region ../../0-framework/0-foundation/foundation/dist/errors.mjs
45
+ /**
46
+ * Returns an object with the key/value if value is defined, otherwise an empty object.
47
+ *
48
+ * Use with spread to conditionally include optional properties while satisfying
49
+ * exactOptionalPropertyTypes. This is explicit about which properties are optional
50
+ * and won't inadvertently strip other undefined values.
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * // Instead of:
55
+ * const obj = {
56
+ * required: 'value',
57
+ * ...(optional ? { optional } : {}),
58
+ * };
59
+ *
60
+ * // Use:
61
+ * const obj = {
62
+ * required: 'value',
63
+ * ...ifDefined('optional', optional),
64
+ * };
65
+ * ```
66
+ */
67
+ function ifDefined(key, value) {
68
+ return value !== void 0 ? blindCast({ [key]: value }) : {};
69
+ }
70
+ /**
71
+ * Structured CLI error that contains all information needed for error envelopes.
72
+ * Call sites throw these errors with full context.
73
+ *
74
+ * A `CliStructuredError` is a `StructuredError` (see
75
+ * `./structured-error.ts`): `code` is a dotted
76
+ * `NAMESPACE.SUBCODE` string, and the namespace prefix is the error's
77
+ * category — there is no separate `domain` field. See ADR 239 in
78
+ * prisma/prisma and composer's ADR-0044 for the namespace taxonomy.
79
+ */
80
+ var CliStructuredError = class extends Error {
81
+ code;
82
+ severity;
83
+ constructor(code, summary, options) {
84
+ super(summary, options?.cause !== void 0 ? { cause: options.cause } : void 0);
85
+ this.name = "CliStructuredError";
86
+ this.code = code;
87
+ this.severity = options?.severity ?? "error";
88
+ const fix = options?.fix === options?.why ? void 0 : options?.fix;
89
+ const where = options?.where ? {
90
+ ...ifDefined("path", options.where.path),
91
+ ...ifDefined("line", options.where.line)
92
+ } : void 0;
93
+ Object.assign(this, {
94
+ ...ifDefined("why", options?.why),
95
+ ...ifDefined("fix", fix),
96
+ ...ifDefined("where", where),
97
+ ...ifDefined("meta", options?.meta),
98
+ ...ifDefined("docsUrl", options?.docsUrl)
99
+ });
100
+ }
101
+ /**
102
+ * Converts this error to a CLI error envelope for output formatting.
103
+ */
104
+ toEnvelope() {
105
+ return {
106
+ ok: false,
107
+ code: this.code,
108
+ severity: this.severity,
109
+ summary: this.message,
110
+ ...ifDefined("why", this.why),
111
+ ...ifDefined("fix", this.fix),
112
+ ...ifDefined("where", this.where),
113
+ ...ifDefined("meta", this.meta),
114
+ ...ifDefined("docsUrl", this.docsUrl)
115
+ };
116
+ }
117
+ /**
118
+ * Type guard to check if an error is a CliStructuredError.
119
+ * Uses duck-typing to work across module boundaries where instanceof may fail.
120
+ */
121
+ static is(error) {
122
+ if (!(error instanceof Error)) return false;
123
+ const candidate = blindCast(error);
124
+ return candidate.name === "CliStructuredError" && typeof candidate.code === "string" && typeof candidate.toEnvelope === "function";
125
+ }
126
+ };
127
+ //#endregion
128
+ //#region ../../0-framework/3-tooling/cli/dist/shared-CCaR42wo.mjs
129
+ /**
130
+ * Deploy preflight (TML-3158): verify that alchemy resolves the exact `effect`
131
+ * version @prisma/composer pins. Package managers cannot be made to enforce
132
+ * this — alchemy's own peer range accepts newer effect betas, and npm resolves
133
+ * transitive peer conflicts with a warning, not a failure — so a floating
134
+ * `@effect/*` range anywhere in the consumer's tree can hoist a newer effect
135
+ * to the root, where alchemy picks it up and crashes mid-deploy
136
+ * (`TypeError: Schedule.either is not a function`). This check turns that
137
+ * silent break into a start-up error naming the fix.
138
+ */
139
+ /** Walks up from `startDir` looking for `node_modules/alchemy` (mirrors resolveAlchemyBin). Undefined when absent — the check skips rather than second-guessing later, clearer failures. */
140
+ function findAlchemyPackageDir(startDir) {
141
+ let dir = startDir;
142
+ while (true) {
143
+ const candidate = path.join(dir, "node_modules", "alchemy");
144
+ if (fs.existsSync(path.join(candidate, "package.json"))) return candidate;
145
+ const parent = path.dirname(dir);
146
+ if (parent === dir) return void 0;
147
+ dir = parent;
148
+ }
149
+ }
150
+ /**
151
+ * The `effect` version Node gives `packageDir`'s code, resolved exactly as
152
+ * Node would: from the package's real path (so pnpm symlink layouts resolve
153
+ * from the package's own store position, like at runtime). Undefined when
154
+ * `effect` is not resolvable from there.
155
+ */
156
+ function resolveEffectVersionFrom(packageDir) {
157
+ let entry;
158
+ try {
159
+ entry = createRequire(path.join(fs.realpathSync(packageDir), "noop.js")).resolve("effect");
160
+ } catch {
161
+ return;
162
+ }
163
+ let dir = path.dirname(entry);
164
+ while (!fs.existsSync(path.join(dir, "package.json"))) {
165
+ const parent = path.dirname(dir);
166
+ if (parent === dir) return void 0;
167
+ dir = parent;
168
+ }
169
+ const version = JSON.parse(fs.readFileSync(path.join(dir, "package.json"), "utf-8")).version;
170
+ return typeof version === "string" ? version : void 0;
171
+ }
172
+ /**
173
+ * The `effect` version @prisma/composer pins, read from its own installed
174
+ * package.json — the single source of truth; never hardcoded here. Undefined
175
+ * when @prisma/composer is not resolvable from `startDir` (e.g. the CLI is
176
+ * driven some other way), in which case the check skips.
177
+ *
178
+ * Assumes the pin is an exact version — effectMismatchError compares with
179
+ * `===`, which scripts/check-npm-effect-resolution.mjs enforces in CI;
180
+ * relaxing the pin to a range means revisiting that comparison.
181
+ */
182
+ function requiredEffectVersion(startDir) {
183
+ let manifestPath;
184
+ try {
185
+ manifestPath = createRequire(path.join(startDir, "noop.js")).resolve("@prisma/composer/package.json");
186
+ } catch {
187
+ return;
188
+ }
189
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf-8"));
190
+ if (typeof manifest !== "object" || manifest === null || !("dependencies" in manifest)) return;
191
+ const dependencies = manifest.dependencies;
192
+ if (typeof dependencies !== "object" || dependencies === null || !("effect" in dependencies)) return;
193
+ const version = dependencies.effect;
194
+ return typeof version === "string" ? version : void 0;
195
+ }
196
+ /** Pure comparison + parts rendering, separated so tests cover the rule without a filesystem. Returns the structured error parts, or undefined when the tree is healthy or either side is unknown. */
197
+ function effectMismatchError(found, required) {
198
+ if (found === void 0 || required === void 0 || found === required) return void 0;
199
+ return {
200
+ summary: `Dependency conflict: alchemy resolves effect@${found}, but @prisma/composer requires effect@${required}.`,
201
+ why: "Your package manager installed a second effect that alchemy picks up; deploying with it would crash inside alchemy.",
202
+ fix: `Add this to your app's package.json, then reinstall:
203
+
204
+ "overrides": { "effect": "${required}" }\n\n(npm uses "overrides"; yarn calls it "resolutions", pnpm "pnpm.overrides".)`,
205
+ meta: {
206
+ found,
207
+ required
208
+ }
209
+ };
210
+ }
211
+ /** Runs the preflight from the app's directory; throws DEPS.EFFECT_VERSION_CONFLICT on a mismatched tree, no-op otherwise. */
212
+ function checkEffectResolution(cwd) {
213
+ const alchemyDir = findAlchemyPackageDir(cwd);
214
+ if (alchemyDir === void 0) return;
215
+ const parts = effectMismatchError(resolveEffectVersionFrom(alchemyDir), requiredEffectVersion(cwd));
216
+ if (parts !== void 0) throw new CliStructuredError("DEPS.EFFECT_VERSION_CONFLICT", parts.summary, {
217
+ why: parts.why,
218
+ fix: parts.fix,
219
+ meta: parts.meta
220
+ });
221
+ }
222
+ /**
223
+ * Reads the execution diagnostics an engine-failure error carries in
224
+ * `meta.diagnostics`; undefined for every other failure.
225
+ */
226
+ function executionDiagnostics(f) {
227
+ const diagnostics = f.meta?.["diagnostics"];
228
+ if (typeof diagnostics !== "object" || diagnostics === null) return void 0;
229
+ const candidate = blindCast(diagnostics);
230
+ if (candidate["exitCode"] !== void 0 && typeof candidate["exitCode"] !== "number" || typeof candidate["stackFilePath"] !== "string" || typeof candidate["reproduceCommand"] !== "string" || typeof candidate["cwd"] !== "string") return;
231
+ return blindCast(diagnostics);
232
+ }
233
+ /**
234
+ * Site-specific wrap for foreign extension/environment causes — passthrough
235
+ * when already structured; never a boundary fallback (base-type rule 6(ii)).
236
+ */
237
+ function toStructured(code, error) {
238
+ return CliStructuredError.is(error) ? error : new CliStructuredError(code, error instanceof Error ? error.message : String(error), { cause: error });
239
+ }
240
+ /** Diagnoses a failed executor import: when the app's tree resolves a
241
+ * mismatched `effect` (the known way that import breaks), the failure is the
242
+ * fix-naming DEPS.EFFECT_VERSION_CONFLICT from checkEffectResolution with the
243
+ * import error riding as cause; otherwise DEPS.EXECUTOR_UNLOADABLE — an
244
+ * environmental failure of the consumer's installed tree, not a bug here. */
245
+ function executorLoadFailure(operation, error, cwd) {
246
+ try {
247
+ checkEffectResolution(cwd);
248
+ } catch (diagnostic) {
249
+ if (CliStructuredError.is(diagnostic)) return new CliStructuredError(diagnostic.code, diagnostic.message, {
250
+ ...diagnostic.why !== void 0 ? { why: diagnostic.why } : {},
251
+ ...diagnostic.fix !== void 0 ? { fix: diagnostic.fix } : {},
252
+ ...diagnostic.meta !== void 0 ? { meta: diagnostic.meta } : {},
253
+ cause: error
254
+ });
255
+ }
256
+ return new CliStructuredError("DEPS.EXECUTOR_UNLOADABLE", `Could not load the ${operation} executor: ${error instanceof Error ? error.message : String(error)}`, {
257
+ why: `The ${operation} operation's executor imports the deploy engine's provider tree from your app's installed dependencies, and that import failed.`,
258
+ fix: "Reinstall your dependencies, and check that `alchemy` is installed and loadable from your app.",
259
+ cause: error
260
+ });
261
+ }
262
+ //#endregion
263
+ export { CliStructuredError as a, toStructured as i, executionDiagnostics as n, blindCast as o, executorLoadFailure as r, checkEffectResolution as t };
264
+
265
+ //# sourceMappingURL=shared-CCaR42wo-BvegvmA_.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-CCaR42wo-BvegvmA_.mjs","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/casts-DpaahrlC.mjs","../../../0-framework/0-foundation/foundation/dist/errors.mjs","../../../0-framework/3-tooling/cli/dist/shared-CCaR42wo.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","import { t as blindCast } from \"./casts-DpaahrlC.mjs\";\nimport { n as assertNever, r as isInternalError, t as InternalError } from \"./internal-error-BIc-ehme.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 { createRequire } from \"node:module\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n//#region src/check-effect-resolution.ts\n/**\n* Deploy preflight (TML-3158): verify that alchemy resolves the exact `effect`\n* version @prisma/composer pins. Package managers cannot be made to enforce\n* this — alchemy's own peer range accepts newer effect betas, and npm resolves\n* transitive peer conflicts with a warning, not a failure — so a floating\n* `@effect/*` range anywhere in the consumer's tree can hoist a newer effect\n* to the root, where alchemy picks it up and crashes mid-deploy\n* (`TypeError: Schedule.either is not a function`). This check turns that\n* silent break into a start-up error naming the fix.\n*/\n/** Walks up from `startDir` looking for `node_modules/alchemy` (mirrors resolveAlchemyBin). Undefined when absent — the check skips rather than second-guessing later, clearer failures. */\nfunction findAlchemyPackageDir(startDir) {\n\tlet dir = startDir;\n\twhile (true) {\n\t\tconst candidate = path.join(dir, \"node_modules\", \"alchemy\");\n\t\tif (fs.existsSync(path.join(candidate, \"package.json\"))) return candidate;\n\t\tconst parent = path.dirname(dir);\n\t\tif (parent === dir) return void 0;\n\t\tdir = parent;\n\t}\n}\n/**\n* The `effect` version Node gives `packageDir`'s code, resolved exactly as\n* Node would: from the package's real path (so pnpm symlink layouts resolve\n* from the package's own store position, like at runtime). Undefined when\n* `effect` is not resolvable from there.\n*/\nfunction resolveEffectVersionFrom(packageDir) {\n\tlet entry;\n\ttry {\n\t\tentry = createRequire(path.join(fs.realpathSync(packageDir), \"noop.js\")).resolve(\"effect\");\n\t} catch {\n\t\treturn;\n\t}\n\tlet dir = path.dirname(entry);\n\twhile (!fs.existsSync(path.join(dir, \"package.json\"))) {\n\t\tconst parent = path.dirname(dir);\n\t\tif (parent === dir) return void 0;\n\t\tdir = parent;\n\t}\n\tconst version = JSON.parse(fs.readFileSync(path.join(dir, \"package.json\"), \"utf-8\")).version;\n\treturn typeof version === \"string\" ? version : void 0;\n}\n/**\n* The `effect` version @prisma/composer pins, read from its own installed\n* package.json — the single source of truth; never hardcoded here. Undefined\n* when @prisma/composer is not resolvable from `startDir` (e.g. the CLI is\n* driven some other way), in which case the check skips.\n*\n* Assumes the pin is an exact version — effectMismatchError compares with\n* `===`, which scripts/check-npm-effect-resolution.mjs enforces in CI;\n* relaxing the pin to a range means revisiting that comparison.\n*/\nfunction requiredEffectVersion(startDir) {\n\tlet manifestPath;\n\ttry {\n\t\tmanifestPath = createRequire(path.join(startDir, \"noop.js\")).resolve(\"@prisma/composer/package.json\");\n\t} catch {\n\t\treturn;\n\t}\n\tconst manifest = JSON.parse(fs.readFileSync(manifestPath, \"utf-8\"));\n\tif (typeof manifest !== \"object\" || manifest === null || !(\"dependencies\" in manifest)) return;\n\tconst dependencies = manifest.dependencies;\n\tif (typeof dependencies !== \"object\" || dependencies === null || !(\"effect\" in dependencies)) return;\n\tconst version = dependencies.effect;\n\treturn typeof version === \"string\" ? version : void 0;\n}\n/** Pure comparison + parts rendering, separated so tests cover the rule without a filesystem. Returns the structured error parts, or undefined when the tree is healthy or either side is unknown. */\nfunction effectMismatchError(found, required) {\n\tif (found === void 0 || required === void 0 || found === required) return void 0;\n\treturn {\n\t\tsummary: `Dependency conflict: alchemy resolves effect@${found}, but @prisma/composer requires effect@${required}.`,\n\t\twhy: \"Your package manager installed a second effect that alchemy picks up; deploying with it would crash inside alchemy.\",\n\t\tfix: `Add this to your app's package.json, then reinstall:\n\n \"overrides\": { \"effect\": \"${required}\" }\\n\\n(npm uses \"overrides\"; yarn calls it \"resolutions\", pnpm \"pnpm.overrides\".)`,\n\t\tmeta: {\n\t\t\tfound,\n\t\t\trequired\n\t\t}\n\t};\n}\n/** Runs the preflight from the app's directory; throws DEPS.EFFECT_VERSION_CONFLICT on a mismatched tree, no-op otherwise. */\nfunction checkEffectResolution(cwd) {\n\tconst alchemyDir = findAlchemyPackageDir(cwd);\n\tif (alchemyDir === void 0) return;\n\tconst parts = effectMismatchError(resolveEffectVersionFrom(alchemyDir), requiredEffectVersion(cwd));\n\tif (parts !== void 0) throw new CliStructuredError(\"DEPS.EFFECT_VERSION_CONFLICT\", parts.summary, {\n\t\twhy: parts.why,\n\t\tfix: parts.fix,\n\t\tmeta: parts.meta\n\t});\n}\n//#endregion\n//#region src/operations/shared.ts\n/**\n* Reads the execution diagnostics an engine-failure error carries in\n* `meta.diagnostics`; undefined for every other failure.\n*/\nfunction executionDiagnostics(f) {\n\tconst diagnostics = f.meta?.[\"diagnostics\"];\n\tif (typeof diagnostics !== \"object\" || diagnostics === null) return void 0;\n\tconst candidate = blindCast(diagnostics);\n\tif (candidate[\"exitCode\"] !== void 0 && typeof candidate[\"exitCode\"] !== \"number\" || typeof candidate[\"stackFilePath\"] !== \"string\" || typeof candidate[\"reproduceCommand\"] !== \"string\" || typeof candidate[\"cwd\"] !== \"string\") return;\n\treturn blindCast(diagnostics);\n}\n/**\n* Site-specific wrap for foreign extension/environment causes — passthrough\n* when already structured; never a boundary fallback (base-type rule 6(ii)).\n*/\nfunction toStructured(code, error) {\n\treturn CliStructuredError.is(error) ? error : new CliStructuredError(code, error instanceof Error ? error.message : String(error), { cause: error });\n}\n/** Diagnoses a failed executor import: when the app's tree resolves a\n* mismatched `effect` (the known way that import breaks), the failure is the\n* fix-naming DEPS.EFFECT_VERSION_CONFLICT from checkEffectResolution with the\n* import error riding as cause; otherwise DEPS.EXECUTOR_UNLOADABLE — an\n* environmental failure of the consumer's installed tree, not a bug here. */\nfunction executorLoadFailure(operation, error, cwd) {\n\ttry {\n\t\tcheckEffectResolution(cwd);\n\t} catch (diagnostic) {\n\t\tif (CliStructuredError.is(diagnostic)) return new CliStructuredError(diagnostic.code, diagnostic.message, {\n\t\t\t...diagnostic.why !== void 0 ? { why: diagnostic.why } : {},\n\t\t\t...diagnostic.fix !== void 0 ? { fix: diagnostic.fix } : {},\n\t\t\t...diagnostic.meta !== void 0 ? { meta: diagnostic.meta } : {},\n\t\t\tcause: error\n\t\t});\n\t}\n\treturn new CliStructuredError(\"DEPS.EXECUTOR_UNLOADABLE\", `Could not load the ${operation} executor: ${error instanceof Error ? error.message : String(error)}`, {\n\t\twhy: `The ${operation} operation's executor imports the deploy engine's provider tree from your app's installed dependencies, and that import failed.`,\n\t\tfix: \"Reinstall your dependencies, and check that `alchemy` is installed and loadable from your app.\",\n\t\tcause: error\n\t});\n}\n//#endregion\nexport { checkEffectResolution as i, executorLoadFailure as n, toStructured as r, executionDiagnostics as t };\n\n//# sourceMappingURL=shared-CCaR42wo.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAS,UAAU,OAAO;CACzB,OAAO;AACR;;;;;;;;;;;;;;;;;;;;;;;;;ACbA,SAAS,UAAU,KAAK,OAAO;CAC9B,OAAO,UAAU,KAAK,IAAI,UAAU,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC;AAC1D;;;;;;;;;;;AAaA,IAAI,qBAAqB,cAAc,MAAM;CAC5C;CACA;CACA,YAAY,MAAM,SAAS,SAAS;EACnC,MAAM,SAAS,SAAS,UAAU,KAAK,IAAI,EAAE,OAAO,QAAQ,MAAM,IAAI,KAAK,CAAC;EAC5E,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,WAAW,SAAS,YAAY;EACrC,MAAM,MAAM,SAAS,QAAQ,SAAS,MAAM,KAAK,IAAI,SAAS;EAC9D,MAAM,QAAQ,SAAS,QAAQ;GAC9B,GAAG,UAAU,QAAQ,QAAQ,MAAM,IAAI;GACvC,GAAG,UAAU,QAAQ,QAAQ,MAAM,IAAI;EACxC,IAAI,KAAK;EACT,OAAO,OAAO,MAAM;GACnB,GAAG,UAAU,OAAO,SAAS,GAAG;GAChC,GAAG,UAAU,OAAO,GAAG;GACvB,GAAG,UAAU,SAAS,KAAK;GAC3B,GAAG,UAAU,QAAQ,SAAS,IAAI;GAClC,GAAG,UAAU,WAAW,SAAS,OAAO;EACzC,CAAC;CACF;;;;CAIA,aA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AAO,UAAU,qBAAqB,YAAY,OAAO,UAAU,wBAAwB,YAAY,OAAO,UAAU,WAAW,UAAU;CAClO,OAAO,UAAU,WAAW;AAC7B;;;;;AAKA,SAAS,aAAa,MAAM,OAAO;CAClC,OAAO,mBAAmB,GAAG,KAAK,IAAI,QAAQ,IAAI,mBAAmB,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG,EAAE,OAAO,MAAM,CAAC;AACpJ;;;;;;AAMA,SAAS,oBAAoB,WAAW,OAAO,KAAK;CACnD,IAAI;EACH,sBAAsB,GAAG;CAC1B,SAAS,YAAY;EACpB,IAAI,mBAAmB,GAAG,UAAU,GAAG,OAAO,IAAI,mBAAmB,WAAW,MAAM,WAAW,SAAS;GACzG,GAAG,WAAW,QAAQ,KAAK,IAAI,EAAE,KAAK,WAAW,IAAI,IAAI,CAAC;GAC1D,GAAG,WAAW,QAAQ,KAAK,IAAI,EAAE,KAAK,WAAW,IAAI,IAAI,CAAC;GAC1D,GAAG,WAAW,SAAS,KAAK,IAAI,EAAE,MAAM,WAAW,KAAK,IAAI,CAAC;GAC7D,OAAO;EACR,CAAC;CACF;CACA,OAAO,IAAI,mBAAmB,4BAA4B,sBAAsB,UAAU,aAAa,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,KAAK;EAChK,KAAK,OAAO,UAAU;EACtB,KAAK;EACL,OAAO;CACR,CAAC;AACF"}
@@ -1,4 +1,4 @@
1
- import { L as RunnableServiceNode, c as Deps, j as Params, m as HydratedDeps, u as Expose } from "./graph-types-C3FOaaXm-C6_rGzfn.mjs";
1
+ import { L as RunnableServiceNode, c as Deps, j as Params, m as HydratedDeps, u as Expose } from "./graph-types-N6brq1zY-1VMNwtkJ.mjs";
2
2
  import { StandardSchemaV1 } from "@standard-schema/spec";
3
3
  //#region ../../0-framework/1-core/core/dist/testing.d.mts
4
4
  //#region src/testing.d.ts