@prisma/composer 0.39.0-dev.7 → 0.39.0-dev.9

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 (122) hide show
  1. package/dist/{app-config-DmCj4luV-BC36-MeB.d.mts → app-config-DriAu5RU-C8hYpR38.d.mts} +17 -15
  2. package/dist/app-config-DriAu5RU-C8hYpR38.d.mts.map +1 -0
  3. package/dist/{app-configuration-file-Bbfq5PR3-D4DUNKUM.mjs → app-configuration-file-D0rB5g65-CdMrjkCc.mjs} +10 -40
  4. package/dist/app-configuration-file-D0rB5g65-CdMrjkCc.mjs.map +1 -0
  5. package/dist/app-converge-C6Zrg2xM-D0k4EIJY.mjs +88 -0
  6. package/dist/app-converge-C6Zrg2xM-D0k4EIJY.mjs.map +1 -0
  7. package/dist/config-Bpi8QVLB.d.mts +1 -0
  8. package/dist/config.d.mts +2 -2
  9. package/dist/config.mjs +1 -1
  10. package/dist/control.d.mts +8 -23
  11. package/dist/control.d.mts.map +1 -1
  12. package/dist/control.mjs +4 -4
  13. package/dist/control.mjs.map +1 -1
  14. package/dist/{converge-in-process-BBBeood8-BCIPOG8X.d.mts → converge-in-process-CTomEXaD-BnDylZP8.d.mts} +5 -5
  15. package/dist/{converge-in-process-BBBeood8-BCIPOG8X.d.mts.map → converge-in-process-CTomEXaD-BnDylZP8.d.mts.map} +1 -1
  16. package/dist/converge-in-process-x89zb2MF-Dvj-J8xo.mjs +258 -0
  17. package/dist/converge-in-process-x89zb2MF-Dvj-J8xo.mjs.map +1 -0
  18. package/dist/{deploy-B2kxaH5E.mjs → deploy-CSU0kr4j.mjs} +65 -5
  19. package/dist/{deploy-B2kxaH5E.mjs.map → deploy-CSU0kr4j.mjs.map} +1 -1
  20. package/dist/deploy-DHgEJDpg.d.mts +32 -0
  21. package/dist/deploy-DHgEJDpg.d.mts.map +1 -0
  22. package/dist/deploy.d.mts +4 -4
  23. package/dist/deploy.mjs +3 -3
  24. package/dist/{deployment-summary-6LgQDUuu-Dp8kwMs_.d.mts → deployment-summary-6LgQDUuu-Cu_6UNhc.d.mts} +4 -4
  25. package/dist/{deployment-summary-6LgQDUuu-Dp8kwMs_.d.mts.map → deployment-summary-6LgQDUuu-Cu_6UNhc.d.mts.map} +1 -1
  26. package/dist/{deployment-summary-YP7eMPJI-CQsj7BHh.mjs → deployment-summary-CVJZn2v0-Dz-gX1rp.mjs} +3 -3
  27. package/dist/{deployment-summary-YP7eMPJI-CQsj7BHh.mjs.map → deployment-summary-CVJZn2v0-Dz-gX1rp.mjs.map} +1 -1
  28. package/dist/dev-converge-messages-DML4rTz7-C_EAB5M_.mjs +165 -0
  29. package/dist/dev-converge-messages-DML4rTz7-C_EAB5M_.mjs.map +1 -0
  30. package/dist/dev-converge-worker.d.mts +1 -0
  31. package/dist/dev-converge-worker.mjs +142 -0
  32. package/dist/dev-converge-worker.mjs.map +1 -0
  33. package/dist/{dev-current-gQnmjB4V-BaNhcGpK.mjs → dev-current-EqQbrtj5-Dda1xCjU.mjs} +11 -7
  34. package/dist/dev-current-EqQbrtj5-Dda1xCjU.mjs.map +1 -0
  35. package/dist/{dev-environment-name-6eEr5PW8-6sPgQZG3.mjs → dev-environment-name-6eEr5PW8-7ntm9Xhs.mjs} +3 -3
  36. package/dist/{dev-environment-name-6eEr5PW8-6sPgQZG3.mjs.map → dev-environment-name-6eEr5PW8-7ntm9Xhs.mjs.map} +1 -1
  37. package/dist/{dist-CyrEbDx6.mjs → dist-Cf_mZHaH.mjs} +2 -2
  38. package/dist/{dist-CyrEbDx6.mjs.map → dist-Cf_mZHaH.mjs.map} +1 -1
  39. package/dist/{emulator-retry-CV8rl69G-BgUzkxc-.mjs → emulator-retry-CV8rl69G-scQ105wk.mjs} +2 -2
  40. package/dist/{emulator-retry-CV8rl69G-BgUzkxc-.mjs.map → emulator-retry-CV8rl69G-scQ105wk.mjs.map} +1 -1
  41. package/dist/{errors-0e8IVwzi.mjs → errors-DI3TBXE-.mjs} +7 -2
  42. package/dist/{errors-0e8IVwzi.mjs.map → errors-DI3TBXE-.mjs.map} +1 -1
  43. package/dist/{execute-deploy-destroy-DKbsBkqK-BWXh0zXQ.mjs → execute-deploy-destroy-DKEmb8WI-Cad08hR1.mjs} +246 -193
  44. package/dist/execute-deploy-destroy-DKEmb8WI-Cad08hR1.mjs.map +1 -0
  45. package/dist/{execute-dev-DVCWURmI-Cp3i7Hrp.mjs → execute-dev-C42niIFY-Cl5XzBy3.mjs} +434 -261
  46. package/dist/execute-dev-C42niIFY-Cl5XzBy3.mjs.map +1 -0
  47. package/dist/{execute-dev-current-Dt_9srY2-COEgQ9h4.mjs → execute-dev-current-AVT4zQ8F-WFr1pM2p.mjs} +7 -7
  48. package/dist/{execute-dev-current-Dt_9srY2-COEgQ9h4.mjs.map → execute-dev-current-AVT4zQ8F-WFr1pM2p.mjs.map} +1 -1
  49. package/dist/{execute-log-B34AeU97-CkJiGdIc.mjs → execute-log-DCe9fk1t-vVIgGSSi.mjs} +8 -8
  50. package/dist/{execute-log-B34AeU97-CkJiGdIc.mjs.map → execute-log-DCe9fk1t-vVIgGSSi.mjs.map} +1 -1
  51. package/dist/{graph-1ILOBl8O-DBaUZL2D.d.mts → graph-CUYXjK8S-BzL-mhjq.d.mts} +3 -3
  52. package/dist/graph-CUYXjK8S-BzL-mhjq.d.mts.map +1 -0
  53. package/dist/{graph-C6Fqe2gn-qJQBxs_C.mjs → graph-D2WMLL43-CeiC5wdy.mjs} +18 -9
  54. package/dist/graph-D2WMLL43-CeiC5wdy.mjs.map +1 -0
  55. package/dist/{graph-types-CaH3flhT-DgrCdRA3.d.mts → graph-types-D4PrtP-l-B0uuchTl.d.mts} +13 -11
  56. package/dist/{graph-types-CaH3flhT-DgrCdRA3.d.mts.map → graph-types-D4PrtP-l-B0uuchTl.d.mts.map} +1 -1
  57. package/dist/http.d.mts +2 -2
  58. package/dist/http.mjs +2 -2
  59. package/dist/{index-Cnbf_d0q.d.mts → index-D8chHe55.d.mts} +3 -3
  60. package/dist/{index-Cnbf_d0q.d.mts.map → index-D8chHe55.d.mts.map} +1 -1
  61. package/dist/index.d.mts +3 -3
  62. package/dist/index.mjs +2 -2
  63. package/dist/internal-app-configuration-file.d.mts +5 -9
  64. package/dist/internal-app-configuration-file.d.mts.map +1 -1
  65. package/dist/internal-app-configuration-file.mjs +2 -2
  66. package/dist/internal-converge-contract.d.mts +6 -4
  67. package/dist/internal-converge-contract.d.mts.map +1 -1
  68. package/dist/internal-converge-contract.mjs +7 -5
  69. package/dist/internal-converge-contract.mjs.map +1 -1
  70. package/dist/internal-converge.d.mts +5 -4
  71. package/dist/internal-converge.mjs +4 -228
  72. package/dist/load-entry-CEoVBdMj-CHOz7jKf.mjs +527 -0
  73. package/dist/load-entry-CEoVBdMj-CHOz7jKf.mjs.map +1 -0
  74. package/dist/local-target-7KRsLMDO.d.mts +31 -0
  75. package/dist/local-target-7KRsLMDO.d.mts.map +1 -0
  76. package/dist/{local-target-COdS1iNs.mjs → local-target-DhU1vaxd.mjs} +6 -6
  77. package/dist/{local-target-COdS1iNs.mjs.map → local-target-DhU1vaxd.mjs.map} +1 -1
  78. package/dist/local-target.d.mts +3 -31
  79. package/dist/local-target.mjs +1 -1
  80. package/dist/{nextjs-DLyeRR7M-CSKy5tFv.d.mts → nextjs-DLyeRR7M-CzUbvPaJ.d.mts} +3 -3
  81. package/dist/{nextjs-DLyeRR7M-CSKy5tFv.d.mts.map → nextjs-DLyeRR7M-CzUbvPaJ.d.mts.map} +1 -1
  82. package/dist/nextjs-control.d.mts +4 -4
  83. package/dist/nextjs.d.mts +1 -1
  84. package/dist/node-control.d.mts +3 -3
  85. package/dist/node.d.mts +2 -2
  86. package/dist/{preflight-transport-C7_3abXW-Bza_hn9G.mjs → preflight-transport-2d6iIchu-B-v7Di6I.mjs} +5 -4
  87. package/dist/preflight-transport-2d6iIchu-B-v7Di6I.mjs.map +1 -0
  88. package/dist/{redaction-CjMYXtGp-CEQ5z1PK.mjs → redaction-DY6eDC12-W-FzW7_r.mjs} +16 -4
  89. package/dist/{redaction-CjMYXtGp-CEQ5z1PK.mjs.map → redaction-DY6eDC12-W-FzW7_r.mjs.map} +1 -1
  90. package/dist/{redaction-CIaE4m9U-DyJoGPRw.d.mts → redaction-Dn7BRdaP-BcLSPhLV.d.mts} +58 -17
  91. package/dist/redaction-Dn7BRdaP-BcLSPhLV.d.mts.map +1 -0
  92. package/dist/report.d.mts +3 -3
  93. package/dist/report.mjs +2 -2
  94. package/dist/report.mjs.map +1 -1
  95. package/dist/service-rpc.d.mts +2 -2
  96. package/dist/service-rpc.mjs +2 -2
  97. package/dist/steps-BZXNqW6U-C_ME2VLd.mjs +112 -0
  98. package/dist/steps-BZXNqW6U-C_ME2VLd.mjs.map +1 -0
  99. package/dist/testing.d.mts +1 -1
  100. package/dist/validate-environment-DCZiNSlR-C7lv0cH1.mjs +344 -0
  101. package/dist/validate-environment-DCZiNSlR-C7lv0cH1.mjs.map +1 -0
  102. package/package.json +11 -11
  103. package/skills/prisma-composer-core-concepts/SKILL.md +8 -8
  104. package/src/exports/dev-converge-worker.ts +2 -0
  105. package/dist/app-config-DmCj4luV-BC36-MeB.d.mts.map +0 -1
  106. package/dist/app-configuration-file-Bbfq5PR3-D4DUNKUM.mjs.map +0 -1
  107. package/dist/config-vv8LBErH.d.mts +0 -1
  108. package/dist/deploy-w-BcRS8b.d.mts +0 -12
  109. package/dist/deploy-w-BcRS8b.d.mts.map +0 -1
  110. package/dist/dev-current-gQnmjB4V-BaNhcGpK.mjs.map +0 -1
  111. package/dist/execute-deploy-destroy-DKbsBkqK-BWXh0zXQ.mjs.map +0 -1
  112. package/dist/execute-dev-DVCWURmI-Cp3i7Hrp.mjs.map +0 -1
  113. package/dist/graph-1ILOBl8O-DBaUZL2D.d.mts.map +0 -1
  114. package/dist/graph-C6Fqe2gn-qJQBxs_C.mjs.map +0 -1
  115. package/dist/internal-converge.mjs.map +0 -1
  116. package/dist/local-target.d.mts.map +0 -1
  117. package/dist/preflight-transport-C7_3abXW-Bza_hn9G.mjs.map +0 -1
  118. package/dist/redaction-CIaE4m9U-DyJoGPRw.d.mts.map +0 -1
  119. package/dist/run-alchemy-BlYyc4Oh-mIzYC4lq.mjs +0 -236
  120. package/dist/run-alchemy-BlYyc4Oh-mIzYC4lq.mjs.map +0 -1
  121. package/dist/validate-environment-XwVDifWN-D14WhSH0.mjs +0 -739
  122. package/dist/validate-environment-XwVDifWN-D14WhSH0.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"dist-CyrEbDx6.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/index.mjs"],"sourcesContent":["import { C as resolve, E as RESOURCE_OUT_PORT, S as isValue, T as LoadError, _ as resource, a as ResourceNodeBase, b as slotsOf, c as freezeNode, d as isProvisionNeed, f as isSecretSource, g as provisionNeed, h as paramSource, l as isNode, m as module, n as assertAppName, o as appRoot, p as isValueResource, s as dependency, t as Load, u as isParamSource, v as secretSource, w as GraphCheckError, x as valueResource, y as service } from \"./graph-C6Fqe2gn.mjs\";\nimport { isPlainPointer, isSecretPointer } from \"@internal/foundation/pointer\";\nimport { SecretBox, isSecretString } from \"@internal/foundation/secret\";\n//#region src/config.ts\n/**\n* A data-only descriptor of a param's schema for introspection — the\n* validator's vendor tag, never the schema's own `validate`. `configOf`\n* reports it where the old model reported `type: 'string' | 'number'`, so the\n* config surface stays enumerable without leaking a function. Nothing consumes\n* more than the vendor tag yet; a richer projection (e.g. a JSON-Schema export\n* when the vendor offers one) is an additive change if a consumer needs it.\n*/\nfunction projectSchema(schema) {\n\treturn { vendor: schema[\"~standard\"].vendor };\n}\n/**\n* Enumerates every config param the service declares: each input's connection\n* params, then the service's own params. Pure — reads `root.inputs`/`params`\n* directly, executes nothing but the (also pure) schema projection. Deliberately\n* does not go through `Load`: a service's connection-end inputs are legitimately\n* unwired from its own point of view (wiring is an enclosing module's concern),\n* and this introspects one service's declared shape regardless of how — or\n* whether — it composes into a larger graph.\n*/\nfunction configOf(root) {\n\tconst entries = [];\n\tfor (const [input, value] of Object.entries(root.inputs)) {\n\t\tif (typeof value !== \"object\" || value === null) continue;\n\t\tfor (const [name, param] of Object.entries(value.connection.params)) entries.push({\n\t\t\towner: { input },\n\t\t\tname,\n\t\t\tschema: projectSchema(param.schema),\n\t\t\toptional: param.optional === true,\n\t\t\tdefault: param.default\n\t\t});\n\t}\n\tfor (const [name, param] of Object.entries(root.params)) entries.push({\n\t\towner: \"service\",\n\t\tname,\n\t\tschema: projectSchema(param.schema),\n\t\toptional: param.optional === true,\n\t\tdefault: param.default\n\t});\n\treturn entries;\n}\n/**\n* The app's input manifest: every service input binding a `provision()` call\n* supplied (ADR-0042).\n*/\nfunction inputManifest(graph) {\n\treturn graph.inputBindings;\n}\nfunction scalarSchema(name, check) {\n\treturn { \"~standard\": {\n\t\tversion: 1,\n\t\tvendor: \"@prisma/composer\",\n\t\tvalidate: (value) => check(value) ? { value } : { issues: [{ message: `expected ${name}, got ${typeof value}` }] }\n\t} };\n}\nconst stringSchema = scalarSchema(\"string\", (v) => typeof v === \"string\");\nconst numberSchema = scalarSchema(\"number\", (v) => typeof v === \"number\" && Number.isFinite(v));\nfunction withFacets(schema, opts) {\n\treturn {\n\t\tschema,\n\t\t...opts.optional !== void 0 ? { optional: opts.optional } : {},\n\t\t...opts.default !== void 0 ? { default: opts.default } : {},\n\t\t...opts.provision !== void 0 ? { provision: opts.provision } : {}\n\t};\n}\n/** A string-valued param. */\nfunction string(opts = {}) {\n\treturn withFacets(stringSchema, opts);\n}\n/** A number-valued param. */\nfunction number(opts = {}) {\n\treturn withFacets(numberSchema, opts);\n}\n/** A param over any caller-supplied Standard Schema — a structured `jobs`, say. */\nfunction param(schema, opts = {}) {\n\treturn withFacets(schema, opts);\n}\n//#endregion\n//#region src/hydrate.ts\n/**\n* Given a service and a concrete typed Config, hydrate every input\n* (connection.hydrate with its typed value slice). A resource dep and a\n* connection dep hydrate through identical machinery — the loaded client is\n* indistinguishable. The service's own params ride alongside in\n* `config.service`; the node's `load()` merges the two.\n*/\nasync function hydrate(root, config) {\n\tconst deps = {};\n\tfor (const [name, inputNode] of Object.entries(root.inputs)) {\n\t\tconst values = config.inputs[name] ?? {};\n\t\tdeps[name] = await inputNode.connection.hydrate(values);\n\t}\n\treturn deps;\n}\n/**\n* Synchronous hydrate — what the node's `load()` uses so\n* `const { db } = service.load()` reads without `await`. Requires every\n* connection.hydrate to return synchronously; a Promise return is a loud error\n* naming the input (an async client factory must use the async `hydrate` path).\n*/\nfunction hydrateSync(root, config) {\n\tconst deps = {};\n\tfor (const [name, inputNode] of Object.entries(root.inputs)) {\n\t\tconst values = config.inputs[name] ?? {};\n\t\tconst client = inputNode.connection.hydrate(values);\n\t\tif (client instanceof Promise) throw new Error(`Connection hydrate for input \"${name}\" returned a Promise; load() requires a synchronous client factory.`);\n\t\tdeps[name] = client;\n\t}\n\treturn deps;\n}\n//#endregion\nexport { GraphCheckError, Load, LoadError, RESOURCE_OUT_PORT, ResourceNodeBase, SecretBox, appRoot, assertAppName, configOf, dependency, freezeNode, hydrate, hydrateSync, inputManifest, isNode, isParamSource, isPlainPointer, isProvisionNeed, isSecretPointer, isSecretSource, isSecretString, isValue, isValueResource, module, number, param, paramSource, provisionNeed, resolve, resource, secretSource, service, slotsOf, string, valueResource };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;AAYA,SAAS,cAAc,QAAQ;CAC9B,OAAO,EAAE,QAAQ,OAAO,YAAY,CAAC,OAAO;AAC7C;;;;;;;;;;AAUA,SAAS,SAAS,MAAM;CACvB,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,CAAC,OAAO,UAAU,OAAO,QAAQ,KAAK,MAAM,GAAG;EACzD,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM;EACjD,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,MAAM,WAAW,MAAM,GAAG,QAAQ,KAAK;GACjF,OAAO,EAAE,MAAM;GACf;GACA,QAAQ,cAAc,MAAM,MAAM;GAClC,UAAU,MAAM,aAAa;GAC7B,SAAS,MAAM;EAChB,CAAC;CACF;CACA,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,KAAK,MAAM,GAAG,QAAQ,KAAK;EACrE,OAAO;EACP;EACA,QAAQ,cAAc,MAAM,MAAM;EAClC,UAAU,MAAM,aAAa;EAC7B,SAAS,MAAM;CAChB,CAAC;CACD,OAAO;AACR;;;;;AAKA,SAAS,cAAc,OAAO;CAC7B,OAAO,MAAM;AACd;AACA,SAAS,aAAa,MAAM,OAAO;CAClC,OAAO,EAAE,aAAa;EACrB,SAAS;EACT,QAAQ;EACR,WAAW,UAAU,MAAM,KAAK,IAAI,EAAE,MAAM,IAAI,EAAE,QAAQ,CAAC,EAAE,SAAS,YAAY,KAAK,QAAQ,OAAO,QAAQ,CAAC,EAAE;CAClH,EAAE;AACH;AACA,MAAM,eAAe,aAAa,WAAW,MAAM,OAAO,MAAM,QAAQ;AACxE,MAAM,eAAe,aAAa,WAAW,MAAM,OAAO,MAAM,YAAY,OAAO,SAAS,CAAC,CAAC;AAC9F,SAAS,WAAW,QAAQ,MAAM;CACjC,OAAO;EACN;EACA,GAAG,KAAK,aAAa,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS,IAAI,CAAC;EAC7D,GAAG,KAAK,YAAY,KAAK,IAAI,EAAE,SAAS,KAAK,QAAQ,IAAI,CAAC;EAC1D,GAAG,KAAK,cAAc,KAAK,IAAI,EAAE,WAAW,KAAK,UAAU,IAAI,CAAC;CACjE;AACD;;AAEA,SAAS,OAAO,OAAO,CAAC,GAAG;CAC1B,OAAO,WAAW,cAAc,IAAI;AACrC;;AAEA,SAAS,OAAO,OAAO,CAAC,GAAG;CAC1B,OAAO,WAAW,cAAc,IAAI;AACrC;;AAEA,SAAS,MAAM,QAAQ,OAAO,CAAC,GAAG;CACjC,OAAO,WAAW,QAAQ,IAAI;AAC/B;;;;;;;;AAUA,eAAe,QAAQ,MAAM,QAAQ;CACpC,MAAM,OAAO,CAAC;CACd,KAAK,MAAM,CAAC,MAAM,cAAc,OAAO,QAAQ,KAAK,MAAM,GAAG;EAC5D,MAAM,SAAS,OAAO,OAAO,SAAS,CAAC;EACvC,KAAK,QAAQ,MAAM,UAAU,WAAW,QAAQ,MAAM;CACvD;CACA,OAAO;AACR;;;;;;;AAOA,SAAS,YAAY,MAAM,QAAQ;CAClC,MAAM,OAAO,CAAC;CACd,KAAK,MAAM,CAAC,MAAM,cAAc,OAAO,QAAQ,KAAK,MAAM,GAAG;EAC5D,MAAM,SAAS,OAAO,OAAO,SAAS,CAAC;EACvC,MAAM,SAAS,UAAU,WAAW,QAAQ,MAAM;EAClD,IAAI,kBAAkB,SAAS,MAAM,IAAI,MAAM,iCAAiC,KAAK,oEAAoE;EACzJ,KAAK,QAAQ;CACd;CACA,OAAO;AACR"}
1
+ {"version":3,"file":"dist-Cf_mZHaH.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/index.mjs"],"sourcesContent":["import { D as GraphCheckError, E as resolve, O as LoadError, S as valueResource, _ as provisionNeed, b as service, c as dependency, d as isParamSource, f as isProvisionNeed, g as paramSource, h as module, k as RESOURCE_OUT_PORT, l as freezeNode, m as isValueResource, n as assertAppName, o as ResourceNodeBase, p as isSecretSource, s as appRoot, t as Load, u as isNode, v as resource, w as isValue, x as slotsOf, y as secretSource } from \"./graph-D2WMLL43.mjs\";\nimport { isPlainPointer, isSecretPointer } from \"@internal/foundation/pointer\";\nimport { SecretBox, isSecretString } from \"@internal/foundation/secret\";\n//#region src/config.ts\n/**\n* A data-only descriptor of a param's schema for introspection — the\n* validator's vendor tag, never the schema's own `validate`. `configOf`\n* reports it where the old model reported `type: 'string' | 'number'`, so the\n* config surface stays enumerable without leaking a function. Nothing consumes\n* more than the vendor tag yet; a richer projection (e.g. a JSON-Schema export\n* when the vendor offers one) is an additive change if a consumer needs it.\n*/\nfunction projectSchema(schema) {\n\treturn { vendor: schema[\"~standard\"].vendor };\n}\n/**\n* Enumerates every config param the service declares: each input's connection\n* params, then the service's own params. Pure — reads `root.inputs`/`params`\n* directly, executes nothing but the (also pure) schema projection. Deliberately\n* does not go through `Load`: a service's connection-end inputs are legitimately\n* unwired from its own point of view (wiring is an enclosing module's concern),\n* and this introspects one service's declared shape regardless of how — or\n* whether — it composes into a larger graph.\n*/\nfunction configOf(root) {\n\tconst entries = [];\n\tfor (const [input, value] of Object.entries(root.inputs)) {\n\t\tif (typeof value !== \"object\" || value === null) continue;\n\t\tfor (const [name, param] of Object.entries(value.connection.params)) entries.push({\n\t\t\towner: { input },\n\t\t\tname,\n\t\t\tschema: projectSchema(param.schema),\n\t\t\toptional: param.optional === true,\n\t\t\tdefault: param.default\n\t\t});\n\t}\n\tfor (const [name, param] of Object.entries(root.params)) entries.push({\n\t\towner: \"service\",\n\t\tname,\n\t\tschema: projectSchema(param.schema),\n\t\toptional: param.optional === true,\n\t\tdefault: param.default\n\t});\n\treturn entries;\n}\n/**\n* The app's input manifest: every service input binding a `provision()` call\n* supplied (ADR-0042).\n*/\nfunction inputManifest(graph) {\n\treturn graph.inputBindings;\n}\nfunction scalarSchema(name, check) {\n\treturn { \"~standard\": {\n\t\tversion: 1,\n\t\tvendor: \"@prisma/composer\",\n\t\tvalidate: (value) => check(value) ? { value } : { issues: [{ message: `expected ${name}, got ${typeof value}` }] }\n\t} };\n}\nconst stringSchema = scalarSchema(\"string\", (v) => typeof v === \"string\");\nconst numberSchema = scalarSchema(\"number\", (v) => typeof v === \"number\" && Number.isFinite(v));\nfunction withFacets(schema, opts) {\n\treturn {\n\t\tschema,\n\t\t...opts.optional !== void 0 ? { optional: opts.optional } : {},\n\t\t...opts.default !== void 0 ? { default: opts.default } : {},\n\t\t...opts.provision !== void 0 ? { provision: opts.provision } : {}\n\t};\n}\n/** A string-valued param. */\nfunction string(opts = {}) {\n\treturn withFacets(stringSchema, opts);\n}\n/** A number-valued param. */\nfunction number(opts = {}) {\n\treturn withFacets(numberSchema, opts);\n}\n/** A param over any caller-supplied Standard Schema — a structured `jobs`, say. */\nfunction param(schema, opts = {}) {\n\treturn withFacets(schema, opts);\n}\n//#endregion\n//#region src/hydrate.ts\n/**\n* Given a service and a concrete typed Config, hydrate every input\n* (connection.hydrate with its typed value slice). A resource dep and a\n* connection dep hydrate through identical machinery — the loaded client is\n* indistinguishable. The service's own params ride alongside in\n* `config.service`; the node's `load()` merges the two.\n*/\nasync function hydrate(root, config) {\n\tconst deps = {};\n\tfor (const [name, inputNode] of Object.entries(root.inputs)) {\n\t\tconst values = config.inputs[name] ?? {};\n\t\tdeps[name] = await inputNode.connection.hydrate(values);\n\t}\n\treturn deps;\n}\n/**\n* Synchronous hydrate — what the node's `load()` uses so\n* `const { db } = service.load()` reads without `await`. Requires every\n* connection.hydrate to return synchronously; a Promise return is a loud error\n* naming the input (an async client factory must use the async `hydrate` path).\n*/\nfunction hydrateSync(root, config) {\n\tconst deps = {};\n\tfor (const [name, inputNode] of Object.entries(root.inputs)) {\n\t\tconst values = config.inputs[name] ?? {};\n\t\tconst client = inputNode.connection.hydrate(values);\n\t\tif (client instanceof Promise) throw new Error(`Connection hydrate for input \"${name}\" returned a Promise; load() requires a synchronous client factory.`);\n\t\tdeps[name] = client;\n\t}\n\treturn deps;\n}\n//#endregion\nexport { GraphCheckError, Load, LoadError, RESOURCE_OUT_PORT, ResourceNodeBase, SecretBox, appRoot, assertAppName, configOf, dependency, freezeNode, hydrate, hydrateSync, inputManifest, isNode, isParamSource, isPlainPointer, isProvisionNeed, isSecretPointer, isSecretSource, isSecretString, isValue, isValueResource, module, number, param, paramSource, provisionNeed, resolve, resource, secretSource, service, slotsOf, string, valueResource };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;AAYA,SAAS,cAAc,QAAQ;CAC9B,OAAO,EAAE,QAAQ,OAAO,YAAY,CAAC,OAAO;AAC7C;;;;;;;;;;AAUA,SAAS,SAAS,MAAM;CACvB,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,CAAC,OAAO,UAAU,OAAO,QAAQ,KAAK,MAAM,GAAG;EACzD,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM;EACjD,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,MAAM,WAAW,MAAM,GAAG,QAAQ,KAAK;GACjF,OAAO,EAAE,MAAM;GACf;GACA,QAAQ,cAAc,MAAM,MAAM;GAClC,UAAU,MAAM,aAAa;GAC7B,SAAS,MAAM;EAChB,CAAC;CACF;CACA,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,KAAK,MAAM,GAAG,QAAQ,KAAK;EACrE,OAAO;EACP;EACA,QAAQ,cAAc,MAAM,MAAM;EAClC,UAAU,MAAM,aAAa;EAC7B,SAAS,MAAM;CAChB,CAAC;CACD,OAAO;AACR;;;;;AAKA,SAAS,cAAc,OAAO;CAC7B,OAAO,MAAM;AACd;AACA,SAAS,aAAa,MAAM,OAAO;CAClC,OAAO,EAAE,aAAa;EACrB,SAAS;EACT,QAAQ;EACR,WAAW,UAAU,MAAM,KAAK,IAAI,EAAE,MAAM,IAAI,EAAE,QAAQ,CAAC,EAAE,SAAS,YAAY,KAAK,QAAQ,OAAO,QAAQ,CAAC,EAAE;CAClH,EAAE;AACH;AACA,MAAM,eAAe,aAAa,WAAW,MAAM,OAAO,MAAM,QAAQ;AACxE,MAAM,eAAe,aAAa,WAAW,MAAM,OAAO,MAAM,YAAY,OAAO,SAAS,CAAC,CAAC;AAC9F,SAAS,WAAW,QAAQ,MAAM;CACjC,OAAO;EACN;EACA,GAAG,KAAK,aAAa,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS,IAAI,CAAC;EAC7D,GAAG,KAAK,YAAY,KAAK,IAAI,EAAE,SAAS,KAAK,QAAQ,IAAI,CAAC;EAC1D,GAAG,KAAK,cAAc,KAAK,IAAI,EAAE,WAAW,KAAK,UAAU,IAAI,CAAC;CACjE;AACD;;AAEA,SAAS,OAAO,OAAO,CAAC,GAAG;CAC1B,OAAO,WAAW,cAAc,IAAI;AACrC;;AAEA,SAAS,OAAO,OAAO,CAAC,GAAG;CAC1B,OAAO,WAAW,cAAc,IAAI;AACrC;;AAEA,SAAS,MAAM,QAAQ,OAAO,CAAC,GAAG;CACjC,OAAO,WAAW,QAAQ,IAAI;AAC/B;;;;;;;;AAUA,eAAe,QAAQ,MAAM,QAAQ;CACpC,MAAM,OAAO,CAAC;CACd,KAAK,MAAM,CAAC,MAAM,cAAc,OAAO,QAAQ,KAAK,MAAM,GAAG;EAC5D,MAAM,SAAS,OAAO,OAAO,SAAS,CAAC;EACvC,KAAK,QAAQ,MAAM,UAAU,WAAW,QAAQ,MAAM;CACvD;CACA,OAAO;AACR;;;;;;;AAOA,SAAS,YAAY,MAAM,QAAQ;CAClC,MAAM,OAAO,CAAC;CACd,KAAK,MAAM,CAAC,MAAM,cAAc,OAAO,QAAQ,KAAK,MAAM,GAAG;EAC5D,MAAM,SAAS,OAAO,OAAO,SAAS,CAAC;EACvC,MAAM,SAAS,UAAU,WAAW,QAAQ,MAAM;EAClD,IAAI,kBAAkB,SAAS,MAAM,IAAI,MAAM,iCAAiC,KAAK,oEAAoE;EACzJ,KAAK,QAAQ;CACd;CACA,OAAO;AACR"}
@@ -1,4 +1,4 @@
1
- import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
1
+ import { t as CliStructuredError } from "./errors-DI3TBXE-.mjs";
2
2
  //#region ../../0-framework/3-tooling/cli/dist/emulator-retry-CV8rl69G.mjs
3
3
  /**
4
4
  * An emulator admin call right after a converge that just PUT dozens of
@@ -29,4 +29,4 @@ async function withEmulatorRetry(call) {
29
29
  //#endregion
30
30
  export { withEmulatorRetry as t };
31
31
 
32
- //# sourceMappingURL=emulator-retry-CV8rl69G-BgUzkxc-.mjs.map
32
+ //# sourceMappingURL=emulator-retry-CV8rl69G-scQ105wk.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"emulator-retry-CV8rl69G-BgUzkxc-.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/emulator-retry-CV8rl69G.mjs"],"sourcesContent":["import { CliStructuredError } from \"@internal/foundation/errors\";\n//#region src/operations/emulator-retry.ts\n/**\n* An emulator admin call right after a converge that just PUT dozens of\n* resources through the same daemon can fail to connect — a brief loopback\n* hiccup under load, not a real failure. Only that is retried: the emulator\n* client reports it as `DEV.EMULATOR_UNREACHABLE`. Anything else is final,\n* including an error response (such as a service that failed to start) and a\n* connection reset while a response body is read. Shared by the dev and log\n* executors, which talk to the same daemons (`startServices`, `endpoints`,\n* `attach`).\n*/\nconst EMULATOR_RETRY_ATTEMPTS = 5;\nconst EMULATOR_RETRY_DELAY_MS = 500;\nfunction isUnreachable(error) {\n\treturn CliStructuredError.is(error) && error.code === \"DEV.EMULATOR_UNREACHABLE\";\n}\nasync function withEmulatorRetry(call) {\n\tlet lastError;\n\tfor (let attempt = 1; attempt <= EMULATOR_RETRY_ATTEMPTS; attempt += 1) try {\n\t\treturn await call();\n\t} catch (error) {\n\t\tif (!isUnreachable(error)) throw error;\n\t\tlastError = error;\n\t\tif (attempt < EMULATOR_RETRY_ATTEMPTS) await new Promise((resolve) => setTimeout(resolve, EMULATOR_RETRY_DELAY_MS));\n\t}\n\tthrow lastError instanceof Error ? lastError : new Error(String(lastError));\n}\n//#endregion\nexport { withEmulatorRetry as t };\n\n//# sourceMappingURL=emulator-retry-CV8rl69G.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,MAAM,0BAA0B;AAChC,MAAM,0BAA0B;AAChC,SAAS,cAAc,OAAO;CAC7B,OAAO,mBAAmB,GAAG,KAAK,KAAK,MAAM,SAAS;AACvD;AACA,eAAe,kBAAkB,MAAM;CACtC,IAAI;CACJ,KAAK,IAAI,UAAU,GAAG,WAAW,yBAAyB,WAAW,GAAG,IAAI;EAC3E,OAAO,MAAM,KAAK;CACnB,SAAS,OAAO;EACf,IAAI,CAAC,cAAc,KAAK,GAAG,MAAM;EACjC,YAAY;EACZ,IAAI,UAAU,yBAAyB,MAAM,IAAI,SAAS,YAAY,WAAW,SAAS,uBAAuB,CAAC;CACnH;CACA,MAAM,qBAAqB,QAAQ,YAAY,IAAI,MAAM,OAAO,SAAS,CAAC;AAC3E"}
1
+ {"version":3,"file":"emulator-retry-CV8rl69G-scQ105wk.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/emulator-retry-CV8rl69G.mjs"],"sourcesContent":["import { CliStructuredError } from \"@internal/foundation/errors\";\n//#region src/operations/emulator-retry.ts\n/**\n* An emulator admin call right after a converge that just PUT dozens of\n* resources through the same daemon can fail to connect — a brief loopback\n* hiccup under load, not a real failure. Only that is retried: the emulator\n* client reports it as `DEV.EMULATOR_UNREACHABLE`. Anything else is final,\n* including an error response (such as a service that failed to start) and a\n* connection reset while a response body is read. Shared by the dev and log\n* executors, which talk to the same daemons (`startServices`, `endpoints`,\n* `attach`).\n*/\nconst EMULATOR_RETRY_ATTEMPTS = 5;\nconst EMULATOR_RETRY_DELAY_MS = 500;\nfunction isUnreachable(error) {\n\treturn CliStructuredError.is(error) && error.code === \"DEV.EMULATOR_UNREACHABLE\";\n}\nasync function withEmulatorRetry(call) {\n\tlet lastError;\n\tfor (let attempt = 1; attempt <= EMULATOR_RETRY_ATTEMPTS; attempt += 1) try {\n\t\treturn await call();\n\t} catch (error) {\n\t\tif (!isUnreachable(error)) throw error;\n\t\tlastError = error;\n\t\tif (attempt < EMULATOR_RETRY_ATTEMPTS) await new Promise((resolve) => setTimeout(resolve, EMULATOR_RETRY_DELAY_MS));\n\t}\n\tthrow lastError instanceof Error ? lastError : new Error(String(lastError));\n}\n//#endregion\nexport { withEmulatorRetry as t };\n\n//# sourceMappingURL=emulator-retry-CV8rl69G.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,MAAM,0BAA0B;AAChC,MAAM,0BAA0B;AAChC,SAAS,cAAc,OAAO;CAC7B,OAAO,mBAAmB,GAAG,KAAK,KAAK,MAAM,SAAS;AACvD;AACA,eAAe,kBAAkB,MAAM;CACtC,IAAI;CACJ,KAAK,IAAI,UAAU,GAAG,WAAW,yBAAyB,WAAW,GAAG,IAAI;EAC3E,OAAO,MAAM,KAAK;CACnB,SAAS,OAAO;EACf,IAAI,CAAC,cAAc,KAAK,GAAG,MAAM;EACjC,YAAY;EACZ,IAAI,UAAU,yBAAyB,MAAM,IAAI,SAAS,YAAY,WAAW,SAAS,uBAAuB,CAAC;CACnH;CACA,MAAM,qBAAqB,QAAQ,YAAY,IAAI,MAAM,OAAO,SAAS,CAAC;AAC3E"}
@@ -82,7 +82,12 @@ var CliStructuredError = class extends Error {
82
82
  return candidate.name === "CliStructuredError" && typeof candidate.code === "string" && typeof candidate.toEnvelope === "function";
83
83
  }
84
84
  };
85
+ function quotedList(names) {
86
+ const quoted = names.map((name) => `"${name}"`);
87
+ const last = quoted.pop() ?? "";
88
+ return quoted.length === 0 ? last : `${quoted.join(", ")} and ${last}`;
89
+ }
85
90
  //#endregion
86
- export { CliStructuredError as t };
91
+ export { quotedList as n, CliStructuredError as t };
87
92
 
88
- //# sourceMappingURL=errors-0e8IVwzi.mjs.map
93
+ //# sourceMappingURL=errors-DI3TBXE-.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors-0e8IVwzi.mjs","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/errors.mjs"],"sourcesContent":["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/quoted-list.ts\nfunction quotedList(names) {\n\tconst quoted = names.map((name) => `\"${name}\"`);\n\tconst last = quoted.pop() ?? \"\";\n\treturn quoted.length === 0 ? last : `${quoted.join(\", \")} and ${last}`;\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, quotedList, structuredError };\n\n//# sourceMappingURL=errors.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,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,aAAa;EACZ,OAAO;GACN,IAAI;GACJ,MAAM,KAAK;GACX,UAAU,KAAK;GACf,SAAS,KAAK;GACd,GAAG,UAAU,OAAO,KAAK,GAAG;GAC5B,GAAG,UAAU,OAAO,KAAK,GAAG;GAC5B,GAAG,UAAU,SAAS,KAAK,KAAK;GAChC,GAAG,UAAU,QAAQ,KAAK,IAAI;GAC9B,GAAG,UAAU,WAAW,KAAK,OAAO;EACrC;CACD;;;;;CAKA,OAAO,GAAG,OAAO;EAChB,IAAI,EAAE,iBAAiB,QAAQ,OAAO;EACtC,MAAM,YAAY,UAAU,KAAK;EACjC,OAAO,UAAU,SAAS,wBAAwB,OAAO,UAAU,SAAS,YAAY,OAAO,UAAU,eAAe;CACzH;AACD"}
1
+ {"version":3,"file":"errors-DI3TBXE-.mjs","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/errors.mjs"],"sourcesContent":["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/quoted-list.ts\nfunction quotedList(names) {\n\tconst quoted = names.map((name) => `\"${name}\"`);\n\tconst last = quoted.pop() ?? \"\";\n\treturn quoted.length === 0 ? last : `${quoted.join(\", \")} and ${last}`;\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, quotedList, structuredError };\n\n//# sourceMappingURL=errors.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,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,aAAa;EACZ,OAAO;GACN,IAAI;GACJ,MAAM,KAAK;GACX,UAAU,KAAK;GACf,SAAS,KAAK;GACd,GAAG,UAAU,OAAO,KAAK,GAAG;GAC5B,GAAG,UAAU,OAAO,KAAK,GAAG;GAC5B,GAAG,UAAU,SAAS,KAAK,KAAK;GAChC,GAAG,UAAU,QAAQ,KAAK,IAAI;GAC9B,GAAG,UAAU,WAAW,KAAK,OAAO;EACrC;CACD;;;;;CAKA,OAAO,GAAG,OAAO;EAChB,IAAI,EAAE,iBAAiB,QAAQ,OAAO;EACtC,MAAM,YAAY,UAAU,KAAK;EACjC,OAAO,UAAU,SAAS,wBAAwB,OAAO,UAAU,SAAS,YAAY,OAAO,UAAU,eAAe;CACzH;AACD;AAGA,SAAS,WAAW,OAAO;CAC1B,MAAM,SAAS,MAAM,KAAK,SAAS,IAAI,KAAK,EAAE;CAC9C,MAAM,OAAO,OAAO,IAAI,KAAK;CAC7B,OAAO,OAAO,WAAW,IAAI,OAAO,GAAG,OAAO,KAAK,IAAI,EAAE,OAAO;AACjE"}
@@ -1,90 +1,23 @@
1
- import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
2
- import { C as secretsKeys, _ as nodeAddresses } from "./graph-C6Fqe2gn-qJQBxs_C.mjs";
1
+ import { y as nodeAddresses } from "./graph-D2WMLL43-CeiC5wdy.mjs";
3
2
  import { t as InternalError } from "./internal-error-Dfur7Zqt-D96dWHZK.mjs";
4
- import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
5
- import { o as preflightEnvVarName, t as containerEnv } from "./preflight-transport-C7_3abXW-Bza_hn9G.mjs";
6
- import { i as prepareSecondProcess, o as refuseSecretsInRootInput, s as removeLeftoverAppConfigurationFiles, t as deployAppConfigurationFile } from "./app-configuration-file-Bbfq5PR3-D4DUNKUM.mjs";
7
- import "./deploy-B2kxaH5E.mjs";
8
- import { c as toStructured, d as okVoid, l as notOk, s as requireContainerForEnvironment, u as ok } from "./dev-current-gQnmjB4V-BaNhcGpK.mjs";
3
+ import { t as CliStructuredError } from "./errors-DI3TBXE-.mjs";
4
+ import { o as preflightEnvVarName, t as containerEnv } from "./preflight-transport-2d6iIchu-B-v7Di6I.mjs";
5
+ import { a as refuseSecretsInRootInput, n as prepareSecondProcess, o as removeLeftoverAppConfigurationFiles, t as deployAppConfigurationFile } from "./app-configuration-file-D0rB5g65-CdMrjkCc.mjs";
6
+ import "./deploy-CSU0kr4j.mjs";
7
+ import { c as requireContainerForEnvironment, d as ok, f as okVoid, l as toStructured, t as convergeReasonsText, u as notOk } from "./dev-current-EqQbrtj5-Dda1xCjU.mjs";
9
8
  import { a as writeRunReport, i as toRunReport, r as resolveRunReportPath, t as RUN_REPORT_FILE_ENV } from "./run-report-CmBz2-xc-Cc8rV1CX.mjs";
10
- import { c as redactThrown, l as redactUnsetPlatformVariable, n as StreamRedactor, o as redactError, r as credentialLookingValues, s as redactSummary, t as SecretRedaction } from "./redaction-CjMYXtGp-CEQ5z1PK.mjs";
11
- import { a as readEngineFailureCause, i as engineFailureFilePath, n as capFailureCause, o as toDeploymentSummary, s as withComposerAdvice, t as DEPLOYMENT_RESULT_FILE_ENV } from "./deployment-summary-YP7eMPJI-CQsj7BHh.mjs";
12
- import { a as noComposerExportMessage, i as validateEnvironmentName, r as runPipeline } from "./validate-environment-XwVDifWN-D14WhSH0.mjs";
13
- import { n as reproduceCommand, r as spawnAlchemy, t as alchemyInvocation } from "./run-alchemy-BlYyc4Oh-mIzYC4lq.mjs";
9
+ import { c as noComposerExportMessage } from "./load-entry-CEoVBdMj-CHOz7jKf.mjs";
10
+ import { t as loadAppConvergeEntry } from "./app-converge-C6Zrg2xM-D0k4EIJY.mjs";
11
+ import { c as redactThrown, l as redactUnsetPlatformVariable, n as StreamRedactor, o as redactError, r as credentialLookingValues, s as redactSummary, t as SecretRedaction } from "./redaction-DY6eDC12-W-FzW7_r.mjs";
12
+ import { a as readEngineFailureCause, i as engineFailureFilePath, n as capFailureCause, o as toDeploymentSummary, s as withComposerAdvice, t as DEPLOYMENT_RESULT_FILE_ENV } from "./deployment-summary-CVJZn2v0-Dz-gX1rp.mjs";
13
+ import { i as validateEnvironmentName, r as runPipeline } from "./validate-environment-DCZiNSlR-C7lv0cH1.mjs";
14
+ import { n as reportConvergeEvent, r as stepTracker, t as interactionMessages } from "./steps-BZXNqW6U-C_ME2VLd.mjs";
14
15
  import { createRequire } from "node:module";
15
16
  import * as path$1 from "node:path";
16
17
  import * as fs$1 from "node:fs";
17
- import { pathToFileURL } from "node:url";
18
18
  import { randomUUID } from "node:crypto";
19
- //#region ../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-DKbsBkqK.mjs
20
- var version = "0.39.0-dev.7";
21
- const ENTRY = "@prisma/composer/internal/converge";
22
- const CONTRACT_ENTRY = "@prisma/composer/internal/converge-contract";
23
- /** The Composer version this host runs; every Composer package carries the same one. */
24
- const HOST_COMPOSER_VERSION = version;
25
- function unresolvable(appDir, detail, cause) {
26
- return new CliStructuredError("DEPS.CONVERGE_UNRESOLVABLE", `Could not load the converge from the app's @prisma/composer in "${appDir}": ${detail}`, {
27
- why: "`prisma deploy` runs the lowering and Alchemy from the app's own install of @prisma/composer, so the app, its extensions and Alchemy share one copy of alchemy.",
28
- fix: "Install @prisma/composer in the app, at the same version as the Composer the `prisma` CLI runs.",
29
- ...cause === void 0 ? {} : { cause }
30
- });
31
- }
32
- function installedVersion(require) {
33
- try {
34
- const parsed = JSON.parse(fs$1.readFileSync(require.resolve("@prisma/composer/package.json"), "utf8"));
35
- return typeof parsed === "object" && parsed !== null && "version" in parsed && typeof parsed.version === "string" ? parsed.version : void 0;
36
- } catch {
37
- return;
38
- }
39
- }
40
- async function importFile(appDir, file) {
41
- try {
42
- return await import(pathToFileURL(file).href);
43
- } catch (error) {
44
- throw unresolvable(appDir, `${file} failed to load: ${error instanceof Error ? error.message : String(error)}`, error);
45
- }
46
- }
47
- function contractMismatch(host, app) {
48
- const appVersion = app.version ?? "an unknown version";
49
- const update = app.contract < host.contract ? `Upgrade the app's @prisma/composer to a release that speaks converge contract ${host.contract}, such as ${host.version}.` : `Upgrade the \`prisma\` CLI to one that runs a Composer speaking converge contract ${app.contract}, such as ${appVersion}.`;
50
- return new CliStructuredError("DEPS.CONVERGE_CONTRACT_MISMATCH", `The app's @prisma/composer ${appVersion} speaks converge contract ${app.contract}, and the \`prisma\` CLI's Composer ${host.version} speaks contract ${host.contract}.`, {
51
- why: "Deploy calls the app's @prisma/composer from the CLI's Composer, and the two read each other's data only when they speak the same converge contract.",
52
- fix: update
53
- });
54
- }
55
- /**
56
- * The app's `lower` and converge, from the install `appDir` resolves. Reads the app's
57
- * converge contract before loading anything else. Raises
58
- * DEPS.CONVERGE_UNRESOLVABLE when the install is missing or predates the
59
- * in-process converge, and DEPS.CONVERGE_CONTRACT_MISMATCH when it speaks
60
- * another contract than `host`.
61
- */
62
- async function loadAppConvergeEntry(appDir, host = {
63
- contract: 2,
64
- version: HOST_COMPOSER_VERSION
65
- }) {
66
- const require = createRequire(path$1.join(appDir, "package.json"));
67
- let contractFile;
68
- let file;
69
- try {
70
- contractFile = require.resolve(CONTRACT_ENTRY);
71
- file = require.resolve(ENTRY);
72
- } catch (error) {
73
- throw unresolvable(appDir, `${CONTRACT_ENTRY} or ${ENTRY} does not resolve.`, error);
74
- }
75
- const { CONVERGE_CONTRACT: appContract } = await importFile(appDir, contractFile);
76
- if (typeof appContract !== "number") throw unresolvable(appDir, `${contractFile} exports no CONVERGE_CONTRACT.`);
77
- if (appContract !== host.contract) throw contractMismatch(host, {
78
- contract: appContract,
79
- version: installedVersion(require)
80
- });
81
- const { lower: appLower, convergeInProcess } = await importFile(appDir, file);
82
- if (typeof appLower !== "function" || typeof convergeInProcess !== "function") throw unresolvable(appDir, `${file} exports no lower and convergeInProcess.`);
83
- return blindCast({
84
- lower: appLower,
85
- converge: convergeInProcess
86
- });
87
- }
19
+ import spawn from "cross-spawn";
20
+ //#region ../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-DKEmb8WI.mjs
88
21
  /** Pipeline step 6: writes a regenerated-every-run, independently runnable stack module at `.prisma-composer/alchemy.run.ts`. */
89
22
  const GENERATED_DIR = ".prisma-composer";
90
23
  const GENERATED_FILE = "alchemy.run.ts";
@@ -157,6 +90,228 @@ function writeStackFile(input) {
157
90
  }
158
91
  const GENERATED_STACK_RELATIVE_PATH = path$1.join(GENERATED_DIR, GENERATED_FILE);
159
92
  /**
93
+ * Which Alchemy CLI runs a generated stack file: the `alchemy` that
94
+ * `@prisma/composer` depends on, found from the app the way the stack file's
95
+ * own `@prisma/composer/...` imports are. The CLI and the stack code then
96
+ * come from one install, so the child loads one copy of `alchemy`.
97
+ *
98
+ * Node's resolver finds `@prisma/composer` from the app. It cannot find
99
+ * `alchemy` from there: alchemy exports neither its `package.json` nor its
100
+ * bin, and has no `require` condition. Bun has no `module.findPackageJSON`.
101
+ * So the last step is Node's own lookup written out: each `node_modules`
102
+ * above `@prisma/composer`'s real location, nearest first.
103
+ */
104
+ 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.";
105
+ function binMissing(message) {
106
+ return new CliStructuredError("DEPLOY.ALCHEMY_BIN_MISSING", message, { fix: FIX });
107
+ }
108
+ function composerPackageDir(appDir) {
109
+ try {
110
+ const manifest = createRequire(path$1.join(appDir, "package.json")).resolve("@prisma/composer/package.json");
111
+ return path$1.dirname(fs$1.realpathSync(manifest));
112
+ } catch {
113
+ return;
114
+ }
115
+ }
116
+ function alchemyPackageDirAbove(dir) {
117
+ for (let current = dir;; current = path$1.dirname(current)) {
118
+ const candidate = path$1.join(current, "node_modules", "alchemy");
119
+ if (fs$1.existsSync(path$1.join(candidate, "package.json"))) return candidate;
120
+ if (path$1.dirname(current) === current) return void 0;
121
+ }
122
+ }
123
+ function readPackageJson(packageDir) {
124
+ try {
125
+ return JSON.parse(fs$1.readFileSync(path$1.join(packageDir, "package.json"), "utf8"));
126
+ } catch {
127
+ return;
128
+ }
129
+ }
130
+ function binOf(packageDir) {
131
+ const manifest = readPackageJson(packageDir);
132
+ if (typeof manifest !== "object" || manifest === null || !("bin" in manifest)) return void 0;
133
+ const bin = manifest.bin;
134
+ const relative = typeof bin === "string" ? bin : typeof bin === "object" && bin !== null && "alchemy" in bin ? bin.alchemy : void 0;
135
+ if (typeof relative !== "string") return void 0;
136
+ const entry = path$1.join(packageDir, relative);
137
+ return fs$1.existsSync(entry) ? entry : void 0;
138
+ }
139
+ /**
140
+ * The JavaScript file `alchemy`'s `bin` names, for the app in `appDir`.
141
+ * Raises DEPLOY.ALCHEMY_BIN_MISSING when the app does not resolve
142
+ * `@prisma/composer` or no usable `alchemy` is installed beside it.
143
+ */
144
+ function resolveAlchemyBin(appDir) {
145
+ const composerDir = composerPackageDir(appDir);
146
+ if (composerDir === void 0) throw binMissing(`Could not resolve @prisma/composer from "${appDir}".`);
147
+ const alchemyDir = alchemyPackageDirAbove(composerDir);
148
+ const entry = alchemyDir === void 0 ? void 0 : binOf(alchemyDir);
149
+ if (entry === void 0) throw binMissing(`Could not resolve the bin of the \`alchemy\` package @prisma/composer depends on, from "${composerDir}".`);
150
+ return entry;
151
+ }
152
+ /**
153
+ * Pipeline step 9 (deploy-cli.md § The pipeline; design-notes.md's "Driving
154
+ * Alchemy" call): run the generated stack file and, for programmatic hosts, pipe its
155
+ * output through redaction.
156
+ *
157
+ * Runs the bin of the `alchemy` the app's `@prisma/composer` depends on
158
+ * (`resolveAlchemyBin`), started with Node (`nodeExecutable`). Never a
159
+ * `node_modules/.bin` link, which pnpm creates only for an app's direct
160
+ * dependencies.
161
+ *
162
+ * Only `destroy` still runs Alchemy in a child; `deploy` and `dev` converge
163
+ * in-process (ADR-0066). This module composes the invocation; `spawnAlchemy`
164
+ * starts it, piping the child's output through the stream redactor
165
+ * (ADR-0062), and tests substitute their own runner.
166
+ */
167
+ function currentRuntime() {
168
+ return {
169
+ bun: process.versions.bun !== void 0,
170
+ execPath: process.execPath,
171
+ env: process.env,
172
+ platform: process.platform,
173
+ exists: fs$1.existsSync
174
+ };
175
+ }
176
+ function envValue(env, name) {
177
+ return Object.entries(env).find(([key]) => key.toLowerCase() === name.toLowerCase())?.[1];
178
+ }
179
+ /** The file names `node` may have in a PATH directory: PATHEXT's extensions on Windows. */
180
+ function nodeFileNames(runtime) {
181
+ if (runtime.platform !== "win32") return ["node"];
182
+ return (envValue(runtime.env, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").filter((extension) => extension.length > 0).map((extension) => `node${extension}`);
183
+ }
184
+ /**
185
+ * The Node that starts Alchemy's launcher: this process's own runtime under
186
+ * Node, and the first `node` on PATH under Bun. Alchemy's launcher may still
187
+ * move itself to Bun when the package-manager environment says Bun invoked
188
+ * it (`bunx`, `bun run`), so the runtime Alchemy ends up on follows how
189
+ * `prisma` was invoked.
190
+ */
191
+ function nodeExecutable(runtime = currentRuntime()) {
192
+ if (!runtime.bun) return runtime.execPath;
193
+ const paths = runtime.platform === "win32" ? path$1.win32 : path$1.posix;
194
+ const names = nodeFileNames(runtime);
195
+ for (const rawDir of (envValue(runtime.env, "PATH") ?? "").split(paths.delimiter)) {
196
+ const dir = rawDir.replace(/^"(.*)"$/, "$1");
197
+ if (dir.length === 0) continue;
198
+ for (const name of names) {
199
+ const candidate = paths.join(dir, name);
200
+ if (runtime.exists(candidate)) return candidate;
201
+ }
202
+ }
203
+ 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." });
204
+ }
205
+ /**
206
+ * Resolves the invocation against this machine — the step every adapter takes
207
+ * and no caller should. Runs alchemy's JavaScript entry with Node, so no shell
208
+ * shim is involved on any platform. Raises DEPLOY.ALCHEMY_BIN_MISSING when
209
+ * Composer's alchemy cannot be resolved, and DEPLOY.NODE_MISSING when no Node
210
+ * can run it.
211
+ */
212
+ function alchemyCommandLine(invocation, alchemyBin = resolveAlchemyBin(invocation.cwd), node = nodeExecutable()) {
213
+ return {
214
+ command: node,
215
+ args: [
216
+ alchemyBin,
217
+ invocation.action,
218
+ invocation.stackFileRelativePath,
219
+ "--yes",
220
+ "--stage",
221
+ invocation.stage
222
+ ],
223
+ cwd: invocation.cwd,
224
+ env: invocation.env
225
+ };
226
+ }
227
+ /** What becomes `alchemy deploy|destroy <stack file> --yes --stage <stage>`. */
228
+ function alchemyInvocation(input) {
229
+ return {
230
+ action: input.command,
231
+ stackFileRelativePath: input.stackFileRelativePath,
232
+ cwd: input.cwd,
233
+ stage: input.stage,
234
+ env: {
235
+ ...input.containerEnv,
236
+ ...input.preflightEnv,
237
+ ...input.env
238
+ },
239
+ redactedValues: input.redactedValues
240
+ };
241
+ }
242
+ /**
243
+ * The default runner for hosts with no engine: stdin inherited and output piped through redaction, the caller's
244
+ * own process group, and the child's status returned verbatim. It does not
245
+ * collapse a signal into an exit code — that collapse is what made a
246
+ * Ctrl-C'd deploy report itself as a failure.
247
+ */
248
+ const spawnAlchemy = async (invocation) => {
249
+ const commandLine = alchemyCommandLine(invocation);
250
+ return {
251
+ ...await spawnCommandLine(commandLine, invocation.redactedValues),
252
+ commandLine
253
+ };
254
+ };
255
+ /**
256
+ * One argument as the platform's shell reads it literally: single quotes for
257
+ * POSIX shells, double quotes for cmd.exe. cmd.exe expands `%VAR%` inside
258
+ * double quotes, and strips or expands `!` when delayed expansion is on; no
259
+ * quoting prevents either, so an argument containing them is not fully
260
+ * literal there.
261
+ */
262
+ function shellArg(arg, platform) {
263
+ if (platform === "win32") return /^[\w@+=:,./\\~-]+$/.test(arg) ? arg : `"${arg.replaceAll("\"", "\"\"")}"`;
264
+ return /^[\w@%+=:,./-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", "'\\''")}'`;
265
+ }
266
+ /**
267
+ * The command a user runs from the invocation's directory to repeat a
268
+ * converge: the command line the adapter started, or, from an adapter that
269
+ * does not report one, `alchemy` with the same arguments.
270
+ */
271
+ function reproduceCommand(invocation, outcome, platform = process.platform) {
272
+ return (outcome?.commandLine === void 0 ? [
273
+ "alchemy",
274
+ invocation.action,
275
+ invocation.stackFileRelativePath,
276
+ "--yes",
277
+ "--stage",
278
+ invocation.stage
279
+ ] : [outcome.commandLine.command, ...outcome.commandLine.args]).map((arg) => shellArg(arg, platform)).join(" ");
280
+ }
281
+ /** Starts a resolved command line with stdin inherited and its output piped through redaction, and returns how it ended. */
282
+ function spawnCommandLine(line, redactedValues, outputs = process) {
283
+ return new Promise((resolve, reject) => {
284
+ const child = spawn(line.command, [...line.args], {
285
+ cwd: line.cwd,
286
+ stdio: [
287
+ "inherit",
288
+ "pipe",
289
+ "pipe"
290
+ ],
291
+ env: {
292
+ ...process.env,
293
+ ...line.env
294
+ }
295
+ });
296
+ const stdout = new StreamRedactor(redactedValues);
297
+ const stderr = new StreamRedactor(redactedValues);
298
+ const write = (stream, text) => {
299
+ if (text.length > 0) stream.write(text);
300
+ };
301
+ child.stdout?.setEncoding("utf8").on("data", (chunk) => write(outputs.stdout, stdout.push(chunk)));
302
+ child.stderr?.setEncoding("utf8").on("data", (chunk) => write(outputs.stderr, stderr.push(chunk)));
303
+ child.on("error", reject);
304
+ child.on("close", (exitCode, signal) => {
305
+ write(outputs.stdout, stdout.end());
306
+ write(outputs.stderr, stderr.end());
307
+ resolve({
308
+ exitCode,
309
+ signal
310
+ });
311
+ });
312
+ });
313
+ }
314
+ /**
160
315
  * The deploy/destroy executor — main.ts's pipeline orchestration with argv,
161
316
  * console, and exit codes removed: typed inputs in, structured results out.
162
317
  * Reached only by lazy import from deploy.ts/destroy.ts — this module's
@@ -169,64 +324,9 @@ function hasNoLocalDeployState(cwd) {
169
324
  const stateDir = path$1.join(cwd, ALCHEMY_STATE_DIR);
170
325
  return !(fs$1.existsSync(stateDir) && fs$1.readdirSync(stateDir).length > 0);
171
326
  }
172
- /**
173
- * Times each deploy step for the host's `onEvent`. A step still open when the
174
- * run fails is closed as failed, innermost first. A host `onEvent` that throws
175
- * is the host's bug and cannot fail the deploy.
176
- */
327
+ /** Times each deploy step for the host's `onEvent`. A step still open when the run fails is closed as failed, innermost first. */
177
328
  function deploySteps(onEvent) {
178
- const open = /* @__PURE__ */ new Map();
179
- const keyOf = (step) => step.name === "assemble-service" ? `${step.name}:${step.address}` : step.name === "apply-resource" ? `${step.name}:${step.resourceId}` : step.name;
180
- const emit = (event) => {
181
- try {
182
- onEvent?.(event);
183
- } catch {}
184
- };
185
- const finish = (step, outcome, data) => {
186
- const entry = open.get(keyOf(step));
187
- if (entry === void 0) return;
188
- open.delete(keyOf(step));
189
- const durationMs = Math.round(performance.now() - entry.startedAt);
190
- emit({
191
- kind: "step-finished",
192
- step,
193
- outcome,
194
- durationMs,
195
- data
196
- });
197
- };
198
- return {
199
- start(step) {
200
- open.set(keyOf(step), {
201
- step,
202
- startedAt: performance.now()
203
- });
204
- emit({
205
- kind: "step-started",
206
- step
207
- });
208
- },
209
- finish(step, data) {
210
- finish(step, "ok", data);
211
- },
212
- fail(step) {
213
- finish(step, "failed");
214
- },
215
- failOpen() {
216
- for (const { step } of [...open.values()].reverse()) finish(step, "failed");
217
- },
218
- isOpen(step) {
219
- return open.has(keyOf(step));
220
- },
221
- message(severity, text) {
222
- emit({
223
- kind: "message",
224
- severity,
225
- text
226
- });
227
- },
228
- emit
229
- };
329
+ return stepTracker((step) => step.name === "assemble-service" ? `${step.name}:${step.address}` : step.name === "apply-resource" ? `${step.name}:${step.resourceId}` : step.name, onEvent);
230
330
  }
231
331
  async function executeDeploy(input, deps, cwd) {
232
332
  const outcome = await runStackPipeline("deploy", {
@@ -352,7 +452,7 @@ async function runStackPipeline(action, opts) {
352
452
  try {
353
453
  outcome = await runStackPipelineInner(action, opts, reporters);
354
454
  } catch (error) {
355
- opts.steps.failOpen();
455
+ opts.steps.closeOpen("failed");
356
456
  opts.steps.start({ name: "record" });
357
457
  const thrown = redactThrown(error, opts.redaction);
358
458
  await finishReporters(reporters, {
@@ -365,7 +465,7 @@ async function runStackPipeline(action, opts) {
365
465
  throw thrown;
366
466
  }
367
467
  if (!outcome.ok) outcome = notOk(redactError(outcome.failure, opts.redaction));
368
- if (!outcome.ok) opts.steps.failOpen();
468
+ if (!outcome.ok) opts.steps.closeOpen("failed");
369
469
  opts.steps.start({ name: "record" });
370
470
  await finishReporters(reporters, outcome.ok ? {
371
471
  ok: true,
@@ -544,7 +644,6 @@ async function runStackPipelineInner(action, opts, reporters) {
544
644
  appConfigurationRead: pipeline.graph.appConfigurationRead,
545
645
  plainVariableText: {},
546
646
  nodeAddresses: nodeAddresses(pipeline.graph),
547
- secretsKeys: secretsKeys(pipeline.graph),
548
647
  knownSecrets: opts.redaction.knownSecrets
549
648
  });
550
649
  stackPath = writeStackFile({
@@ -662,37 +761,6 @@ async function prepareAppConvergeEntry(deps, appDir) {
662
761
  throw error;
663
762
  }
664
763
  }
665
- /** One Alchemy progress event as the deploy's step events: each resource is a step inside `apply`. */
666
- function reportConvergeEvent(steps, event, redact) {
667
- if (event.kind === "log") {
668
- steps.message(event.severity, redact(withComposerAdvice(event.text)));
669
- return;
670
- }
671
- const step = {
672
- name: "apply-resource",
673
- resourceId: event.fqn,
674
- resourceType: event.resourceType,
675
- status: event.status
676
- };
677
- switch (event.phase) {
678
- case "running":
679
- if (!steps.isOpen(step)) steps.start(step);
680
- return;
681
- case "done":
682
- if (!steps.isOpen(step)) steps.start(step);
683
- steps.finish(step);
684
- return;
685
- case "failed":
686
- if (!steps.isOpen(step)) steps.start(step);
687
- steps.fail(step);
688
- if (event.message !== void 0) steps.message("warn", redact(`${event.fqn}: ${withComposerAdvice(event.message)}`));
689
- return;
690
- case "pending": return;
691
- }
692
- }
693
- function reasonsText(reasons) {
694
- return reasons.map(({ tag, message }) => tag === "Error" || tag === "Unknown" || message.startsWith(tag) ? message : `${tag}: ${message}`).join("\n");
695
- }
696
764
  /** The structured failure a converge that did not apply settles as. */
697
765
  function convergeFailure(outcome, redact) {
698
766
  switch (outcome.kind) {
@@ -708,7 +776,7 @@ function convergeFailure(outcome, redact) {
708
776
  fix: "Call deploy from the main thread, or with the process's working directory as its cwd."
709
777
  });
710
778
  case "failed": {
711
- const cause = capFailureCause(redact(withComposerAdvice(reasonsText(outcome.reasons))));
779
+ const cause = capFailureCause(redact(withComposerAdvice(convergeReasonsText(outcome.reasons))));
712
780
  return new CliStructuredError("DEPLOY.ENGINE_FAILED", `Alchemy could not deploy the app.\n${cause}`, { meta: {
713
781
  engineCause: cause,
714
782
  reasons: outcome.reasons.map(({ tag, message }) => ({
@@ -721,24 +789,6 @@ function convergeFailure(outcome, redact) {
721
789
  return new CliStructuredError("DEPLOY.ENGINE_FAILED", "The converge ended with an outcome this Composer does not know.");
722
790
  }
723
791
  /**
724
- * Alchemy's terminal text as `info` messages, one per complete line, redacted. A secret split
725
- * across writes or lines is still found, because the text passes through a `StreamRedactor`
726
- * before it is cut into lines. `end` sends the last line that has no line break.
727
- */
728
- function interactionMessages(steps, redaction) {
729
- const stream = new StreamRedactor(redaction.allValues());
730
- let partial = "";
731
- const send = (text, last) => {
732
- const lines = (partial + text).split("\n");
733
- partial = last ? "" : lines.pop() ?? "";
734
- for (const line of lines) if (line.trim() !== "") steps.message("info", redaction.redact(line));
735
- };
736
- return {
737
- push: (text) => send(stream.push(text), false),
738
- end: () => send(stream.end(), true)
739
- };
740
- }
741
- /**
742
792
  * Deploy's converge: lowers the app with the containers and preflight
743
793
  * payloads this run resolved, then plans and applies it in this process.
744
794
  * The report hook runs inside the apply, here, so the summary comes back as
@@ -784,7 +834,10 @@ async function convergeDeploy(opts, pipeline, entry, resolved) {
784
834
  cwd,
785
835
  env,
786
836
  signal: opts.signal,
787
- onEvent: (event) => reportConvergeEvent(steps, event, redact),
837
+ onEvent: (event) => reportConvergeEvent(steps, event, redact, (resource) => ({
838
+ name: "apply-resource",
839
+ ...resource
840
+ })),
788
841
  output: (text) => output.push(text)
789
842
  });
790
843
  } catch (error) {
@@ -799,4 +852,4 @@ async function convergeDeploy(opts, pipeline, entry, resolved) {
799
852
  //#endregion
800
853
  export { executeDeploy, executeDestroy };
801
854
 
802
- //# sourceMappingURL=execute-deploy-destroy-DKbsBkqK-BWXh0zXQ.mjs.map
855
+ //# sourceMappingURL=execute-deploy-destroy-DKEmb8WI-Cad08hR1.mjs.map