@prisma/composer 0.37.0 → 0.38.0-dev.2

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 (70) hide show
  1. package/dist/{app-config-Bf_y5R7o-BEZAnKqM.d.mts → app-config-DFe3eq6b-Cmr7ggPt.d.mts} +6 -8
  2. package/dist/app-config-DFe3eq6b-Cmr7ggPt.d.mts.map +1 -0
  3. package/dist/config-Db5eI7CK.d.mts +1 -0
  4. package/dist/config.d.mts +2 -2
  5. package/dist/control.d.mts +5 -5
  6. package/dist/control.mjs +3 -3
  7. package/dist/control.mjs.map +1 -1
  8. package/dist/{deploy-CmiYExQA.mjs → deploy-DergV8De.mjs} +7 -5
  9. package/dist/deploy-DergV8De.mjs.map +1 -0
  10. package/dist/deploy-Ds3eG6H7.d.mts +2 -0
  11. package/dist/deploy.d.mts +3 -3
  12. package/dist/deploy.mjs +2 -2
  13. package/dist/{deployment-summary-BiBkPWlB-CyC2pudN.mjs → deployment-summary-BETZp_5k-C_KvpHWJ.mjs} +10 -4
  14. package/dist/deployment-summary-BETZp_5k-C_KvpHWJ.mjs.map +1 -0
  15. package/dist/{deployment-summary-p88NV5m5-BJOosgmI.d.mts → deployment-summary-p88NV5m5-GNA6qu4b.d.mts} +3 -3
  16. package/dist/{deployment-summary-p88NV5m5-BJOosgmI.d.mts.map → deployment-summary-p88NV5m5-GNA6qu4b.d.mts.map} +1 -1
  17. package/dist/{dev-current-D0Kn6Mf4-DDWYu-3j.mjs → dev-current-ByDVi5EO-Dct7Q7mq.mjs} +5 -5
  18. package/dist/{dev-current-D0Kn6Mf4-DDWYu-3j.mjs.map → dev-current-ByDVi5EO-Dct7Q7mq.mjs.map} +1 -1
  19. package/dist/{dist-C7SnNTD3.mjs → dist-NyTyCEnG.mjs} +2 -2
  20. package/dist/dist-NyTyCEnG.mjs.map +1 -0
  21. package/dist/{execute-deploy-destroy-Dh1CQ9X6-DY4c9egd.mjs → execute-deploy-destroy--N_UkK1g-nxZ3N_Jh.mjs} +7 -7
  22. package/dist/{execute-deploy-destroy-Dh1CQ9X6-DY4c9egd.mjs.map → execute-deploy-destroy--N_UkK1g-nxZ3N_Jh.mjs.map} +1 -1
  23. package/dist/{execute-dev-Bl-5Q-Av-DILne6iY.mjs → execute-dev-Crd7rFYA-DcPJ_3wI.mjs} +7 -7
  24. package/dist/{execute-dev-Bl-5Q-Av-DILne6iY.mjs.map → execute-dev-Crd7rFYA-DcPJ_3wI.mjs.map} +1 -1
  25. package/dist/{execute-dev-current-D3USgHJ4-CNQe5ADb.mjs → execute-dev-current-Cj8M-VXO-B2Gdq4dR.mjs} +4 -4
  26. package/dist/{execute-dev-current-D3USgHJ4-CNQe5ADb.mjs.map → execute-dev-current-Cj8M-VXO-B2Gdq4dR.mjs.map} +1 -1
  27. package/dist/{execute-log-Dm3DkQQP-BSjoy6Wd.mjs → execute-log-T_FgN53M-CJsJdGqo.mjs} +4 -4
  28. package/dist/{execute-log-Dm3DkQQP-BSjoy6Wd.mjs.map → execute-log-T_FgN53M-CJsJdGqo.mjs.map} +1 -1
  29. package/dist/{graph-Bqr7PSGl-BM-M-TlO.mjs → graph-CBt9CRBT-yMupsISb.mjs} +58 -29
  30. package/dist/graph-CBt9CRBT-yMupsISb.mjs.map +1 -0
  31. package/dist/{graph-DI1v3WKX-3g1lTRbh.d.mts → graph-D1zpgcLm-YlrEdzUB.d.mts} +4 -4
  32. package/dist/graph-D1zpgcLm-YlrEdzUB.d.mts.map +1 -0
  33. package/dist/{graph-types-DRe9UUOp-C85Yr-sJ.d.mts → graph-types-BiFZrE06-D6vaGxXz.d.mts} +37 -5
  34. package/dist/graph-types-BiFZrE06-D6vaGxXz.d.mts.map +1 -0
  35. package/dist/http.d.mts +2 -2
  36. package/dist/http.mjs +2 -2
  37. package/dist/{index-DWQ6BSgm.d.mts → index-CMklpG87.d.mts} +3 -3
  38. package/dist/{index-DWQ6BSgm.d.mts.map → index-CMklpG87.d.mts.map} +1 -1
  39. package/dist/index.d.mts +4 -4
  40. package/dist/index.mjs +3 -3
  41. package/dist/internal-app-configuration-file.d.mts +5 -5
  42. package/dist/local-target.d.mts +1 -1
  43. package/dist/{nextjs-DLyeRR7M-RtoHcY1c.d.mts → nextjs-DLyeRR7M-RqgYxqhI.d.mts} +3 -3
  44. package/dist/{nextjs-DLyeRR7M-RtoHcY1c.d.mts.map → nextjs-DLyeRR7M-RqgYxqhI.d.mts.map} +1 -1
  45. package/dist/nextjs-control.d.mts +4 -4
  46. package/dist/nextjs.d.mts +1 -1
  47. package/dist/node-control.d.mts +3 -3
  48. package/dist/node.d.mts +2 -2
  49. package/dist/{redaction-Bf8FvTFH-BTsKD9B5.d.mts → redaction-Bf8FvTFH-1DLg1LoF.d.mts} +7 -7
  50. package/dist/{redaction-Bf8FvTFH-BTsKD9B5.d.mts.map → redaction-Bf8FvTFH-1DLg1LoF.d.mts.map} +1 -1
  51. package/dist/report.d.mts +3 -3
  52. package/dist/report.mjs +1 -1
  53. package/dist/report.mjs.map +1 -1
  54. package/dist/service-rpc.d.mts +2 -2
  55. package/dist/service-rpc.mjs +2 -2
  56. package/dist/testing.d.mts +1 -1
  57. package/dist/{validate-environment-D_dECxgO-B-gqpVEf.mjs → validate-environment-CpQLC3CA-COmDdusV.mjs} +17 -14
  58. package/dist/validate-environment-CpQLC3CA-COmDdusV.mjs.map +1 -0
  59. package/package.json +13 -13
  60. package/skills/prisma-composer-core-concepts/SKILL.md +7 -8
  61. package/dist/app-config-Bf_y5R7o-BEZAnKqM.d.mts.map +0 -1
  62. package/dist/config-CDkq5Ayl.d.mts +0 -1
  63. package/dist/deploy-CmiYExQA.mjs.map +0 -1
  64. package/dist/deploy-DQyaIoNe.d.mts +0 -2
  65. package/dist/deployment-summary-BiBkPWlB-CyC2pudN.mjs.map +0 -1
  66. package/dist/dist-C7SnNTD3.mjs.map +0 -1
  67. package/dist/graph-Bqr7PSGl-BM-M-TlO.mjs.map +0 -1
  68. package/dist/graph-DI1v3WKX-3g1lTRbh.d.mts.map +0 -1
  69. package/dist/graph-types-DRe9UUOp-C85Yr-sJ.d.mts.map +0 -1
  70. package/dist/validate-environment-D_dECxgO-B-gqpVEf.mjs.map +0 -1
@@ -1,12 +1,12 @@
1
1
  import { t as InternalError } from "./internal-error-Dfur7Zqt-D96dWHZK.mjs";
2
2
  import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
3
3
  import { i as devEnvironmentDir } from "./app-config-CErnR6NK-D9NgSBH4.mjs";
4
- import { c as toStructured, l as notOk, u as ok } from "./dev-current-D0Kn6Mf4-DDWYu-3j.mjs";
4
+ import { c as toStructured, l as notOk, u as ok } from "./dev-current-ByDVi5EO-Dct7Q7mq.mjs";
5
5
  import { r as resolveLocalTargets } from "./local-target-Dd8FJEb5.mjs";
6
- import { i as validateEnvironmentName, n as resolveAppIdentity, t as checkConfigSource } from "./validate-environment-D_dECxgO-B-gqpVEf.mjs";
6
+ import { i as validateEnvironmentName, n as resolveAppIdentity, t as checkConfigSource } from "./validate-environment-CpQLC3CA-COmDdusV.mjs";
7
7
  import { n as requireDevEnvironmentName } from "./dev-environment-name-6eEr5PW8-BwusWVKi.mjs";
8
8
  import * as path$1 from "node:path";
9
- //#region ../../0-framework/3-tooling/cli/dist/execute-dev-current-D3USgHJ4.mjs
9
+ //#region ../../0-framework/3-tooling/cli/dist/execute-dev-current-Cj8M-VXO.mjs
10
10
  /**
11
11
  * The `devUrl` and `devStop` executor: config → each extension's local
12
12
  * target → the app's local copy in the environment, read from that
@@ -163,4 +163,4 @@ async function executeDevStop(input, cwd) {
163
163
  //#endregion
164
164
  export { executeDevStop, executeDevUrl };
165
165
 
166
- //# sourceMappingURL=execute-dev-current-D3USgHJ4-CNQe5ADb.mjs.map
166
+ //# sourceMappingURL=execute-dev-current-Cj8M-VXO-B2Gdq4dR.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"execute-dev-current-D3USgHJ4-CNQe5ADb.mjs","names":["path"],"sources":["../../../0-framework/3-tooling/cli/dist/execute-dev-current-D3USgHJ4.mjs"],"sourcesContent":["import { n as checkConfigSource, r as resolveAppIdentity, t as validateEnvironmentName } from \"./validate-environment-D_dECxgO.mjs\";\nimport { d as toStructured } from \"./dev-current-D0Kn6Mf4.mjs\";\nimport { n as requireDevEnvironmentName } from \"./dev-environment-name-6eEr5PW8.mjs\";\nimport * as path from \"node:path\";\nimport { CliStructuredError, InternalError } from \"@internal/foundation/errors\";\nimport { notOk, ok } from \"@internal/foundation/result\";\nimport { devEnvironmentDir, resolveLocalTargets } from \"@internal/core/local-target\";\n//#region src/operations/execute-dev-current.ts\n/**\n* The `devUrl` and `devStop` executor: config → each extension's local\n* target → the app's local copy in the environment, read from that\n* environment's dev state. Reached only by lazy import from dev-current.ts —\n* resolving the local targets loads their descriptors, whose graphs reach\n* alchemy's provider tree.\n*/\nfunction platformUnsupported() {\n\treturn new CliStructuredError(\"DEV.PLATFORM_UNSUPPORTED\", \"local dev is not supported on Windows yet.\");\n}\n/** The `prisma dev` command that runs `environment`. */\nfunction runDev(environment) {\n\treturn environment === \"dev\" ? \"`prisma dev`\" : `\\`prisma dev --environment ${environment}\\``;\n}\n/** A call into an extension's local target; its failures that carry no code are the emulator's. */\nasync function fromTarget(call) {\n\ttry {\n\t\treturn await call();\n\t} catch (error) {\n\t\tthrow toStructured(\"DEV.EMULATOR_FAILED\", error);\n\t}\n}\n/** Every extension's record of the app in the environment; fails when none recorded it. */\nasync function currentApps(copy, cwd) {\n\tconst { app, environment } = copy;\n\tconst { value } = checkConfigSource(copy.config, cwd);\n\tconst devDir = path.join(cwd, devEnvironmentDir(environment));\n\trequireDevEnvironmentName(devDir, environment);\n\tconst apps = [];\n\tfor (const target of (await resolveLocalTargets(value)).values()) {\n\t\tconst current = await fromTarget(async () => target.current?.({\n\t\t\tdevDir,\n\t\t\tapp,\n\t\t\tenvironment\n\t\t}));\n\t\tif (current !== void 0) apps.push(current);\n\t}\n\tif (apps.length === 0) throw new CliStructuredError(\"DEV.NOT_STARTED_HERE\", `\\`prisma dev\\` has not run ${app} in the environment ${environment} in ${cwd}.`, {\n\t\twhy: `The local services, databases and buckets of an app are recorded in ${devDir} when \\`prisma dev\\` runs it in the environment ${environment}, and ${app} has no such record.`,\n\t\tfix: `Run ${runDev(environment)} for ${app} in this directory.`,\n\t\tmeta: {\n\t\t\tcwd,\n\t\t\tapp,\n\t\t\tenvironment\n\t\t}\n\t});\n\treturn apps;\n}\n/** The app a full address starts with: `shop.api` belongs to `shop`. */\nfunction appOfAddress(address) {\n\tconst dot = address.indexOf(\".\");\n\treturn dot === -1 ? address : address.slice(0, dot);\n}\nasync function locate(input, cwd) {\n\tconst environment = input.environment ?? \"dev\";\n\tvalidateEnvironmentName(environment);\n\tconst app = appOfAddress(input.address);\n\tconst apps = await currentApps({\n\t\tconfig: input.config,\n\t\tapp,\n\t\tenvironment\n\t}, cwd);\n\tconst recorded = apps.find((candidate) => candidate.addresses.includes(input.address));\n\tif (recorded === void 0) {\n\t\tconst known = apps.flatMap((candidate) => candidate.addresses).sort();\n\t\tthrow new CliStructuredError(\"DEV.ADDRESS_UNKNOWN\", `\"${app}\" has no node at \"${input.address}\" in the environment ${environment}.`, {\n\t\t\twhy: `The addresses recorded for ${app} in the environment ${environment} are: ${known.join(\", \")}.`,\n\t\t\tfix: \"Pass one of those addresses. A nested node has a dotted address, such as `shop.catalog.database`.\",\n\t\t\tmeta: {\n\t\t\t\taddress: input.address,\n\t\t\t\tknown\n\t\t\t}\n\t\t});\n\t}\n\tconst location = await fromTarget(() => recorded.locate(input.address));\n\tif (location === void 0) throw new InternalError(`the local target recorded \"${input.address}\" but cannot locate it`);\n\tif (location.emulator === \"not-running\") throw new CliStructuredError(\"DEV.EMULATOR_UNREACHABLE\", `The local ${location.kind} emulator that runs \"${input.address}\" is not running.`, {\n\t\twhy: \"The local emulators run your services, databases and buckets on this machine; `prisma dev` starts the ones an app needs.\",\n\t\tfix: `Run ${runDev(environment)} in this directory.`,\n\t\tmeta: {\n\t\t\taddress: input.address,\n\t\t\tkind: location.kind\n\t\t}\n\t});\n\tif (location.condition !== \"running\") throw notRunning(input.address, environment, location);\n\tif (location.url === void 0) throw new InternalError(`the local target reports \"${input.address}\" running with no URL`);\n\tconst runs = location.command !== void 0 ? \"dev-server\" : location.kind === \"service\" ? \"artifact\" : void 0;\n\treturn {\n\t\taddress: input.address,\n\t\tkind: location.kind,\n\t\turl: location.url,\n\t\tstate: location.state,\n\t\t...runs !== void 0 ? { runs } : {}\n\t};\n}\nfunction notRunning(address, environment, location) {\n\tconst rerun = `Run ${runDev(environment)} in this directory.`;\n\tconst { kind, state, condition, logPath } = location;\n\tconst meta = {\n\t\taddress,\n\t\tkind,\n\t\tstate,\n\t\t...logPath === void 0 ? {} : { logPath }\n\t};\n\tconst message = `The ${kind} \"${address}\" is not running (${state}).`;\n\tif (condition === \"crashing\") return new CliStructuredError(\"DEV.NOT_RUNNING\", message, {\n\t\twhy: \"It exited after it started, and it is being restarted or was held after repeated crashes.\",\n\t\tfix: logPath === void 0 ? \"Read its output in the `prisma dev` terminal, fix the cause, and rebuild.\" : `Read its log at ${logPath}, fix the cause, and rebuild.`,\n\t\tmeta\n\t});\n\tif (condition === \"missing\") return new CliStructuredError(\"DEV.NOT_RUNNING\", message, {\n\t\twhy: \"The local emulator no longer has it, for example because a Composer upgrade discarded the emulator’s state.\",\n\t\tfix: `${rerun} It creates the ${kind} again, empty.`,\n\t\tmeta\n\t});\n\treturn new CliStructuredError(\"DEV.NOT_RUNNING\", `The ${kind} \"${address}\" is stopped.`, {\n\t\twhy: \"`prisma dev stop` and `prisma dev` ending both stop an app's services and database servers, and a stopped node has no URL that answers.\",\n\t\tfix: rerun,\n\t\tmeta\n\t});\n}\nasync function executeDevUrl(input, cwd) {\n\tif (process.platform === \"win32\") return notOk(platformUnsupported());\n\ttry {\n\t\treturn ok(await locate(input, cwd));\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n}\nasync function executeDevStop(input, cwd) {\n\tif (process.platform === \"win32\") return notOk(platformUnsupported());\n\ttry {\n\t\tconst environment = input.environment ?? \"dev\";\n\t\tvalidateEnvironmentName(environment);\n\t\tconst { name: app } = await resolveAppIdentity(input.entry, input.name, cwd, input.config);\n\t\tconst apps = await currentApps({\n\t\t\tconfig: input.config,\n\t\t\tapp,\n\t\t\tenvironment\n\t\t}, cwd);\n\t\tconst stopped = [];\n\t\tfor (const recorded of apps) stopped.push(...await fromTarget(() => recorded.stop()));\n\t\treturn ok({\n\t\t\tapp,\n\t\t\tenvironment,\n\t\t\tstopped\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n}\n//#endregion\nexport { executeDevStop, executeDevUrl };\n\n//# sourceMappingURL=execute-dev-current-D3USgHJ4.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAeA,SAAS,sBAAsB;CAC9B,OAAO,IAAI,mBAAmB,4BAA4B,4CAA4C;AACvG;;AAEA,SAAS,OAAO,aAAa;CAC5B,OAAO,gBAAgB,QAAQ,iBAAiB,8BAA8B,YAAY;AAC3F;;AAEA,eAAe,WAAW,MAAM;CAC/B,IAAI;EACH,OAAO,MAAM,KAAK;CACnB,SAAS,OAAO;EACf,MAAM,aAAa,uBAAuB,KAAK;CAChD;AACD;;AAEA,eAAe,YAAY,MAAM,KAAK;CACrC,MAAM,EAAE,KAAK,gBAAgB;CAC7B,MAAM,EAAE,UAAU,kBAAkB,KAAK,QAAQ,GAAG;CACpD,MAAM,SAASA,OAAK,KAAK,KAAK,kBAAkB,WAAW,CAAC;CAC5D,0BAA0B,QAAQ,WAAW;CAC7C,MAAM,OAAO,CAAC;CACd,KAAK,MAAM,WAAW,MAAM,oBAAoB,KAAK,EAAA,CAAG,OAAO,GAAG;EACjE,MAAM,UAAU,MAAM,WAAW,YAAY,OAAO,UAAU;GAC7D;GACA;GACA;EACD,CAAC,CAAC;EACF,IAAI,YAAY,KAAK,GAAG,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AAoB,CAAC;CACpE,IAAI;EACH,OAAO,GAAG,MAAM,OAAO,OAAO,GAAG,CAAC;CACnC,SAAS,OAAO;EACf,IAAI,mBAAmB,GAAG,KAAK,GAAG,OAAO,MAAM,KAAK;EACpD,MAAM;CACP;AACD;AACA,eAAe,eAAe,OAAO,KAAK;CACzC,IAAI,QAAQ,aAAa,SAAS,OAAO,MAAM,oBAAoB,CAAC;CACpE,IAAI;EACH,MAAM,cAAc,MAAM,eAAe;EACzC,wBAAwB,WAAW;EACnC,MAAM,EAAE,MAAM,QAAQ,MAAM,mBAAmB,MAAM,OAAO,MAAM,MAAM,KAAK,MAAM,MAAM;EACzF,MAAM,OAAO,MAAM,YAAY;GAC9B,QAAQ,MAAM;GACd;GACA;EACD,GAAG,GAAG;EACN,MAAM,UAAU,CAAC;EACjB,KAAK,MAAM,YAAY,MAAM,QAAQ,KAAK,GAAG,MAAM,iBAAiB,SAAS,KAAK,CAAC,CAAC;EACpF,OAAO,GAAG;GACT;GACA;GACA;EACD,CAAC;CACF,SAAS,OAAO;EACf,IAAI,mBAAmB,GAAG,KAAK,GAAG,OAAO,MAAM,KAAK;EACpD,MAAM;CACP;AACD"}
1
+ {"version":3,"file":"execute-dev-current-Cj8M-VXO-B2Gdq4dR.mjs","names":["path"],"sources":["../../../0-framework/3-tooling/cli/dist/execute-dev-current-Cj8M-VXO.mjs"],"sourcesContent":["import { n as checkConfigSource, r as resolveAppIdentity, t as validateEnvironmentName } from \"./validate-environment-CpQLC3CA.mjs\";\nimport { d as toStructured } from \"./dev-current-ByDVi5EO.mjs\";\nimport { n as requireDevEnvironmentName } from \"./dev-environment-name-6eEr5PW8.mjs\";\nimport * as path from \"node:path\";\nimport { CliStructuredError, InternalError } from \"@internal/foundation/errors\";\nimport { notOk, ok } from \"@internal/foundation/result\";\nimport { devEnvironmentDir, resolveLocalTargets } from \"@internal/core/local-target\";\n//#region src/operations/execute-dev-current.ts\n/**\n* The `devUrl` and `devStop` executor: config → each extension's local\n* target → the app's local copy in the environment, read from that\n* environment's dev state. Reached only by lazy import from dev-current.ts —\n* resolving the local targets loads their descriptors, whose graphs reach\n* alchemy's provider tree.\n*/\nfunction platformUnsupported() {\n\treturn new CliStructuredError(\"DEV.PLATFORM_UNSUPPORTED\", \"local dev is not supported on Windows yet.\");\n}\n/** The `prisma dev` command that runs `environment`. */\nfunction runDev(environment) {\n\treturn environment === \"dev\" ? \"`prisma dev`\" : `\\`prisma dev --environment ${environment}\\``;\n}\n/** A call into an extension's local target; its failures that carry no code are the emulator's. */\nasync function fromTarget(call) {\n\ttry {\n\t\treturn await call();\n\t} catch (error) {\n\t\tthrow toStructured(\"DEV.EMULATOR_FAILED\", error);\n\t}\n}\n/** Every extension's record of the app in the environment; fails when none recorded it. */\nasync function currentApps(copy, cwd) {\n\tconst { app, environment } = copy;\n\tconst { value } = checkConfigSource(copy.config, cwd);\n\tconst devDir = path.join(cwd, devEnvironmentDir(environment));\n\trequireDevEnvironmentName(devDir, environment);\n\tconst apps = [];\n\tfor (const target of (await resolveLocalTargets(value)).values()) {\n\t\tconst current = await fromTarget(async () => target.current?.({\n\t\t\tdevDir,\n\t\t\tapp,\n\t\t\tenvironment\n\t\t}));\n\t\tif (current !== void 0) apps.push(current);\n\t}\n\tif (apps.length === 0) throw new CliStructuredError(\"DEV.NOT_STARTED_HERE\", `\\`prisma dev\\` has not run ${app} in the environment ${environment} in ${cwd}.`, {\n\t\twhy: `The local services, databases and buckets of an app are recorded in ${devDir} when \\`prisma dev\\` runs it in the environment ${environment}, and ${app} has no such record.`,\n\t\tfix: `Run ${runDev(environment)} for ${app} in this directory.`,\n\t\tmeta: {\n\t\t\tcwd,\n\t\t\tapp,\n\t\t\tenvironment\n\t\t}\n\t});\n\treturn apps;\n}\n/** The app a full address starts with: `shop.api` belongs to `shop`. */\nfunction appOfAddress(address) {\n\tconst dot = address.indexOf(\".\");\n\treturn dot === -1 ? address : address.slice(0, dot);\n}\nasync function locate(input, cwd) {\n\tconst environment = input.environment ?? \"dev\";\n\tvalidateEnvironmentName(environment);\n\tconst app = appOfAddress(input.address);\n\tconst apps = await currentApps({\n\t\tconfig: input.config,\n\t\tapp,\n\t\tenvironment\n\t}, cwd);\n\tconst recorded = apps.find((candidate) => candidate.addresses.includes(input.address));\n\tif (recorded === void 0) {\n\t\tconst known = apps.flatMap((candidate) => candidate.addresses).sort();\n\t\tthrow new CliStructuredError(\"DEV.ADDRESS_UNKNOWN\", `\"${app}\" has no node at \"${input.address}\" in the environment ${environment}.`, {\n\t\t\twhy: `The addresses recorded for ${app} in the environment ${environment} are: ${known.join(\", \")}.`,\n\t\t\tfix: \"Pass one of those addresses. A nested node has a dotted address, such as `shop.catalog.database`.\",\n\t\t\tmeta: {\n\t\t\t\taddress: input.address,\n\t\t\t\tknown\n\t\t\t}\n\t\t});\n\t}\n\tconst location = await fromTarget(() => recorded.locate(input.address));\n\tif (location === void 0) throw new InternalError(`the local target recorded \"${input.address}\" but cannot locate it`);\n\tif (location.emulator === \"not-running\") throw new CliStructuredError(\"DEV.EMULATOR_UNREACHABLE\", `The local ${location.kind} emulator that runs \"${input.address}\" is not running.`, {\n\t\twhy: \"The local emulators run your services, databases and buckets on this machine; `prisma dev` starts the ones an app needs.\",\n\t\tfix: `Run ${runDev(environment)} in this directory.`,\n\t\tmeta: {\n\t\t\taddress: input.address,\n\t\t\tkind: location.kind\n\t\t}\n\t});\n\tif (location.condition !== \"running\") throw notRunning(input.address, environment, location);\n\tif (location.url === void 0) throw new InternalError(`the local target reports \"${input.address}\" running with no URL`);\n\tconst runs = location.command !== void 0 ? \"dev-server\" : location.kind === \"service\" ? \"artifact\" : void 0;\n\treturn {\n\t\taddress: input.address,\n\t\tkind: location.kind,\n\t\turl: location.url,\n\t\tstate: location.state,\n\t\t...runs !== void 0 ? { runs } : {}\n\t};\n}\nfunction notRunning(address, environment, location) {\n\tconst rerun = `Run ${runDev(environment)} in this directory.`;\n\tconst { kind, state, condition, logPath } = location;\n\tconst meta = {\n\t\taddress,\n\t\tkind,\n\t\tstate,\n\t\t...logPath === void 0 ? {} : { logPath }\n\t};\n\tconst message = `The ${kind} \"${address}\" is not running (${state}).`;\n\tif (condition === \"crashing\") return new CliStructuredError(\"DEV.NOT_RUNNING\", message, {\n\t\twhy: \"It exited after it started, and it is being restarted or was held after repeated crashes.\",\n\t\tfix: logPath === void 0 ? \"Read its output in the `prisma dev` terminal, fix the cause, and rebuild.\" : `Read its log at ${logPath}, fix the cause, and rebuild.`,\n\t\tmeta\n\t});\n\tif (condition === \"missing\") return new CliStructuredError(\"DEV.NOT_RUNNING\", message, {\n\t\twhy: \"The local emulator no longer has it, for example because a Composer upgrade discarded the emulator’s state.\",\n\t\tfix: `${rerun} It creates the ${kind} again, empty.`,\n\t\tmeta\n\t});\n\treturn new CliStructuredError(\"DEV.NOT_RUNNING\", `The ${kind} \"${address}\" is stopped.`, {\n\t\twhy: \"`prisma dev stop` and `prisma dev` ending both stop an app's services and database servers, and a stopped node has no URL that answers.\",\n\t\tfix: rerun,\n\t\tmeta\n\t});\n}\nasync function executeDevUrl(input, cwd) {\n\tif (process.platform === \"win32\") return notOk(platformUnsupported());\n\ttry {\n\t\treturn ok(await locate(input, cwd));\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n}\nasync function executeDevStop(input, cwd) {\n\tif (process.platform === \"win32\") return notOk(platformUnsupported());\n\ttry {\n\t\tconst environment = input.environment ?? \"dev\";\n\t\tvalidateEnvironmentName(environment);\n\t\tconst { name: app } = await resolveAppIdentity(input.entry, input.name, cwd, input.config);\n\t\tconst apps = await currentApps({\n\t\t\tconfig: input.config,\n\t\t\tapp,\n\t\t\tenvironment\n\t\t}, cwd);\n\t\tconst stopped = [];\n\t\tfor (const recorded of apps) stopped.push(...await fromTarget(() => recorded.stop()));\n\t\treturn ok({\n\t\t\tapp,\n\t\t\tenvironment,\n\t\t\tstopped\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk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O,MAAM,YAAY;GAC9B,QAAQ,MAAM;GACd;GACA;EACD,GAAG,GAAG;EACN,MAAM,UAAU,CAAC;EACjB,KAAK,MAAM,YAAY,MAAM,QAAQ,KAAK,GAAG,MAAM,iBAAiB,SAAS,KAAK,CAAC,CAAC;EACpF,OAAO,GAAG;GACT;GACA;GACA;EACD,CAAC;CACF,SAAS,OAAO;EACf,IAAI,mBAAmB,GAAG,KAAK,GAAG,OAAO,MAAM,KAAK;EACpD,MAAM;CACP;AACD"}
@@ -1,12 +1,12 @@
1
1
  import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
2
2
  import { i as devEnvironmentDir } from "./app-config-CErnR6NK-D9NgSBH4.mjs";
3
- import { c as toStructured, l as notOk, u as ok } from "./dev-current-D0Kn6Mf4-DDWYu-3j.mjs";
3
+ import { c as toStructured, l as notOk, u as ok } from "./dev-current-ByDVi5EO-Dct7Q7mq.mjs";
4
4
  import { r as resolveLocalTargets } from "./local-target-Dd8FJEb5.mjs";
5
- import { i as validateEnvironmentName, n as resolveAppIdentity } from "./validate-environment-D_dECxgO-B-gqpVEf.mjs";
5
+ import { i as validateEnvironmentName, n as resolveAppIdentity } from "./validate-environment-CpQLC3CA-COmDdusV.mjs";
6
6
  import { n as requireDevEnvironmentName } from "./dev-environment-name-6eEr5PW8-BwusWVKi.mjs";
7
7
  import { t as withEmulatorRetry } from "./emulator-retry-CV8rl69G-BgUzkxc-.mjs";
8
8
  import * as path$1 from "node:path";
9
- //#region ../../0-framework/3-tooling/cli/dist/execute-log-Dm3DkQQP.mjs
9
+ //#region ../../0-framework/3-tooling/cli/dist/execute-log-T_FgN53M.mjs
10
10
  /**
11
11
  * The log executor — run-log.ts's attach-and-tail (config → localTarget →
12
12
  * container → attach → logs) with console and signal handling removed: the
@@ -158,4 +158,4 @@ async function executeLog(input, deps, cwd) {
158
158
  //#endregion
159
159
  export { LOG_QUEUE_LIMIT, executeLog };
160
160
 
161
- //# sourceMappingURL=execute-log-Dm3DkQQP-BSjoy6Wd.mjs.map
161
+ //# sourceMappingURL=execute-log-T_FgN53M-CJsJdGqo.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"execute-log-Dm3DkQQP-BSjoy6Wd.mjs","names":["path"],"sources":["../../../0-framework/3-tooling/cli/dist/execute-log-Dm3DkQQP.mjs"],"sourcesContent":["import { r as resolveAppIdentity, t as validateEnvironmentName } from \"./validate-environment-D_dECxgO.mjs\";\nimport { d as toStructured } from \"./dev-current-D0Kn6Mf4.mjs\";\nimport { n as requireDevEnvironmentName } from \"./dev-environment-name-6eEr5PW8.mjs\";\nimport { t as withEmulatorRetry } from \"./emulator-retry-CV8rl69G.mjs\";\nimport * as path from \"node:path\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { notOk, ok } from \"@internal/foundation/result\";\nimport { devEnvironmentDir, resolveLocalTargets } from \"@internal/core/local-target\";\n//#region src/operations/execute-log.ts\n/**\n* The log executor — run-log.ts's attach-and-tail (config → localTarget →\n* container → attach → logs) with console and signal handling removed: the\n* merged stream comes back as an AsyncIterable, ended by the caller's\n* AbortSignal. Reached only by lazy import from log.ts — this module's\n* static graph transitively loads alchemy's provider tree, so the control\n* entry must never import it statically.\n*/\nfunction failureMessage(error) {\n\treturn error instanceof Error ? error.message : String(error);\n}\n/** The merge queue's bound: past this, the oldest line is dropped and the\n* consumer is told via a `lines-dropped` event — a log viewer tolerates loss\n* better than the host tolerates unbounded memory growth. Exported so tests\n* can size their floods relative to the bound. */\nconst LOG_QUEUE_LIMIT = 1e4;\n/**\n* Merges every attachment's log stream into one iterable: one pump per\n* attachment pushing into a shared bounded queue. A pump's throw becomes a\n* `stream-failed` event and ends that pump only; the merged iterable ends\n* when `input.signal` aborts, when every pump ends, or when the consumer\n* stops iterating (an early `break` aborts an internal controller so the\n* pumps tear down — the generator never waits on a source that will not\n* end). No event is delivered after the iterable has ended. Address\n* filtering and `tail` apply exactly as the CLI always has.\n*/\nasync function* mergeLogStreams(attachments, input) {\n\tconst controller = new AbortController();\n\tconst { signal } = controller;\n\tconst abortInternal = () => controller.abort();\n\tif (input.signal?.aborted === true) controller.abort();\n\tinput.signal?.addEventListener(\"abort\", abortInternal, { once: true });\n\tconst queue = [];\n\tlet dropped = 0;\n\tlet done = false;\n\tlet active = attachments.length;\n\tlet wake;\n\tconst notify = () => {\n\t\twake?.();\n\t\twake = void 0;\n\t};\n\tsignal.addEventListener(\"abort\", notify, { once: true });\n\tconst emit = (event) => {\n\t\tif (done) return;\n\t\ttry {\n\t\t\tinput.onEvent?.(event);\n\t\t} catch {}\n\t};\n\tconst pump = async (attachment) => {\n\t\ttry {\n\t\t\tfor await (const { service, line } of attachment.logs(signal, { tail: input.tail ?? 0 })) {\n\t\t\t\tif (signal.aborted) return;\n\t\t\t\tif (input.address !== void 0 && service !== input.address) continue;\n\t\t\t\tif (queue.length >= 1e4) {\n\t\t\t\t\tqueue.shift();\n\t\t\t\t\tdropped += 1;\n\t\t\t\t}\n\t\t\t\tqueue.push({\n\t\t\t\t\tservice,\n\t\t\t\t\tline\n\t\t\t\t});\n\t\t\t\tnotify();\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (!signal.aborted) emit({\n\t\t\t\tkind: \"stream-failed\",\n\t\t\t\tmessage: failureMessage(error)\n\t\t\t});\n\t\t} finally {\n\t\t\tactive -= 1;\n\t\t\tnotify();\n\t\t}\n\t};\n\tfor (const attachment of attachments) pump(attachment);\n\ttry {\n\t\twhile (true) {\n\t\t\tlet next = queue.shift();\n\t\t\twhile (next !== void 0) {\n\t\t\t\tif (dropped > 0) {\n\t\t\t\t\tconst count = dropped;\n\t\t\t\t\tdropped = 0;\n\t\t\t\t\temit({\n\t\t\t\t\t\tkind: \"lines-dropped\",\n\t\t\t\t\t\tcount\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tyield next;\n\t\t\t\tnext = queue.shift();\n\t\t\t}\n\t\t\tif (signal.aborted || active === 0) break;\n\t\t\tawait new Promise((resolve) => {\n\t\t\t\twake = resolve;\n\t\t\t});\n\t\t}\n\t} finally {\n\t\tdone = true;\n\t\tcontroller.abort();\n\t\tsignal.removeEventListener(\"abort\", notify);\n\t\tinput.signal?.removeEventListener(\"abort\", abortInternal);\n\t}\n}\n/** Resolves the running app and attaches to its log streams; the caller consumes `lines`. */\nasync function executeLog(input, deps, cwd) {\n\tif (process.platform === \"win32\") return notOk(new CliStructuredError(\"LOG.PLATFORM_UNSUPPORTED\", \"local dev is not supported on Windows yet.\"));\n\tconst environment = input.environment ?? \"dev\";\n\tconst devDir = path.join(cwd, devEnvironmentDir(environment));\n\tlet name;\n\tconst attachments = [];\n\tlet services;\n\ttry {\n\t\tvalidateEnvironmentName(environment);\n\t\trequireDevEnvironmentName(devDir, environment);\n\t\tconst identity = deps.identity ?? await resolveAppIdentity(input.entry, input.name, cwd, input.config);\n\t\tname = identity.name;\n\t\tconst resolved = await resolveLocalTargets(identity.config);\n\t\tfor (const target of resolved.values()) try {\n\t\t\tconst container = await target.container.ensure({\n\t\t\t\tappName: name,\n\t\t\t\tenvironment\n\t\t\t});\n\t\t\tattachments.push(await withEmulatorRetry(() => target.attach({\n\t\t\t\tcontainer,\n\t\t\t\tdevDir\n\t\t\t})));\n\t\t} catch (error) {\n\t\t\tthrow toStructured(\"LOG.ATTACH_FAILED\", error);\n\t\t}\n\t\ttry {\n\t\t\tservices = (await Promise.all(attachments.map((a) => withEmulatorRetry(() => a.endpoints())))).flat();\n\t\t} catch (error) {\n\t\t\tthrow toStructured(\"LOG.ATTACH_FAILED\", error);\n\t\t}\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tif (services.length === 0) return ok({\n\t\tappName: name,\n\t\tservices: [],\n\t\tlines: mergeLogStreams([], input)\n\t});\n\tif (input.address !== void 0 && !services.some((s) => s.address === input.address)) return notOk(new CliStructuredError(\"LOG.ADDRESS_UNKNOWN\", `no service \"${input.address}\" in \"${name}\" — running services: ${services.map((s) => s.address).join(\", \")}.`));\n\treturn ok({\n\t\tappName: name,\n\t\tservices,\n\t\tlines: mergeLogStreams(attachments, input)\n\t});\n}\n//#endregion\nexport { LOG_QUEUE_LIMIT, executeLog };\n\n//# sourceMappingURL=execute-log-Dm3DkQQP.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAS,eAAe,OAAO;CAC9B,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC7D;;;;;AAKA,MAAM,kBAAkB;;;;;;;;;;;AAWxB,gBAAgB,gBAAgB,aAAa,OAAO;CACnD,MAAM,aAAa,IAAI,gBAAgB;CACvC,MAAM,EAAE,WAAW;CACnB,MAAM,sBAAsB,WAAW,MAAM;CAC7C,IAAI,MAAM,QAAQ,YAAY,MAAM,WAAW,MAAM;CACrD,MAAM,QAAQ,iBAAiB,SAAS,eAAe,EAAE,MAAM,KAAK,CAAC;CACrE,MAAM,QAAQ,CAAC;CACf,IAAI,UAAU;CACd,IAAI,OAAO;CACX,IAAI,SAAS,YAAY;CACzB,IAAI;CACJ,MAAM,eAAe;EACpB,OAAO;EACP,OAAO,KAAK;CACb;CACA,OAAO,iBAAiB,SAAS,QAAQ,EAAE,MAAM,KAAK,CAAC;CACvD,MAAM,QAAQ,UAAU;EACvB,IAAI,MAAM;EACV,IAAI;GACH,MAAM,UAAU,KAAK;EACtB,QAAQ,CAAC;CACV;CACA,MAAM,OAAO,OAAO,eAAe;EAClC,IAAI;GACH,WAAW,MAAM,EAAE,SAAS,UAAU,WAAW,KAAK,QAAQ,EAAE,MAAM,MAAM,QAAQ,EAAE,CAAC,GAAG;IACzF,IAAI,OAAO,SAAS;IACpB,IAAI,MAAM,YAAY,KAAK,KAAK,YAAY,MAAM,SAAS;IAC3D,IAAI,MAAM,UAAU,KAAK;KACxB,MAAM,MAAM;KACZ,WAAW;IACZ;IACA,MAAM,KAAK;KACV;KACA;IACD,CAAC;IACD,OAAO;GACR;EACD,SAAS,OAAO;GACf,IAAI,CAAC,OAAO,SAA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AC,CAAC,CAAC;EACJ,SAAS,OAAO;GACf,MAAM,aAAa,qBAAqB,KAAK;EAC9C;EACA,IAAI;GACH,YAAY,MAAM,QAAQ,IAAI,YAAY,KAAK,MAAM,wBAAwB,EAAE,UAAU,CAAC,CAAC,CAAC,EAAA,CAAG,KAAK;EACrG,SAAS,OAAO;GACf,MAAM,aAAa,qBAAqB,KAAK;EAC9C;CACD,SAAS,OAAO;EACf,IAAI,mBAAmB,GAAG,KAAK,GAAG,OAAO,MAAM,KAAK;EACpD,MAAM;CACP;CACA,IAAI,SAAS,WAAW,GAAG,OAAO,GAAG;EACpC,SAAS;EACT,UAAU,CAAC;EACX,OAAO,gBAAgB,CAAC,GAAG,KAAK;CACjC,CAAC;CACD,IAAI,MAAM,YAAY,KAAK,KAAK,CAAC,SAAS,MAAM,MAAM,EAAE,YAAY,MAAM,OAAO,GAAG,OAAO,MAAM,IAAI,mBAAmB,uBAAuB,eAAe,MAAM,QAAQ,QAAQ,KAAK,wBAAwB,SAAS,KAAK,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;CAC9P,OAAO,GAAG;EACT,SAAS;EACT;EACA,OAAO,gBAAgB,aAAa,KAAK;CAC1C,CAAC;AACF"}
1
+ {"version":3,"file":"execute-log-T_FgN53M-CJsJdGqo.mjs","names":["path"],"sources":["../../../0-framework/3-tooling/cli/dist/execute-log-T_FgN53M.mjs"],"sourcesContent":["import { r as resolveAppIdentity, t as validateEnvironmentName } from \"./validate-environment-CpQLC3CA.mjs\";\nimport { d as toStructured } from \"./dev-current-ByDVi5EO.mjs\";\nimport { n as requireDevEnvironmentName } from \"./dev-environment-name-6eEr5PW8.mjs\";\nimport { t as withEmulatorRetry } from \"./emulator-retry-CV8rl69G.mjs\";\nimport * as path from \"node:path\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { notOk, ok } from \"@internal/foundation/result\";\nimport { devEnvironmentDir, resolveLocalTargets } from \"@internal/core/local-target\";\n//#region src/operations/execute-log.ts\n/**\n* The log executor — run-log.ts's attach-and-tail (config → localTarget →\n* container → attach → logs) with console and signal handling removed: the\n* merged stream comes back as an AsyncIterable, ended by the caller's\n* AbortSignal. Reached only by lazy import from log.ts — this module's\n* static graph transitively loads alchemy's provider tree, so the control\n* entry must never import it statically.\n*/\nfunction failureMessage(error) {\n\treturn error instanceof Error ? error.message : String(error);\n}\n/** The merge queue's bound: past this, the oldest line is dropped and the\n* consumer is told via a `lines-dropped` event — a log viewer tolerates loss\n* better than the host tolerates unbounded memory growth. Exported so tests\n* can size their floods relative to the bound. */\nconst LOG_QUEUE_LIMIT = 1e4;\n/**\n* Merges every attachment's log stream into one iterable: one pump per\n* attachment pushing into a shared bounded queue. A pump's throw becomes a\n* `stream-failed` event and ends that pump only; the merged iterable ends\n* when `input.signal` aborts, when every pump ends, or when the consumer\n* stops iterating (an early `break` aborts an internal controller so the\n* pumps tear down — the generator never waits on a source that will not\n* end). No event is delivered after the iterable has ended. Address\n* filtering and `tail` apply exactly as the CLI always has.\n*/\nasync function* mergeLogStreams(attachments, input) {\n\tconst controller = new AbortController();\n\tconst { signal } = controller;\n\tconst abortInternal = () => controller.abort();\n\tif (input.signal?.aborted === true) controller.abort();\n\tinput.signal?.addEventListener(\"abort\", abortInternal, { once: true });\n\tconst queue = [];\n\tlet dropped = 0;\n\tlet done = false;\n\tlet active = attachments.length;\n\tlet wake;\n\tconst notify = () => {\n\t\twake?.();\n\t\twake = void 0;\n\t};\n\tsignal.addEventListener(\"abort\", notify, { once: true });\n\tconst emit = (event) => {\n\t\tif (done) return;\n\t\ttry {\n\t\t\tinput.onEvent?.(event);\n\t\t} catch {}\n\t};\n\tconst pump = async (attachment) => {\n\t\ttry {\n\t\t\tfor await (const { service, line } of attachment.logs(signal, { tail: input.tail ?? 0 })) {\n\t\t\t\tif (signal.aborted) return;\n\t\t\t\tif (input.address !== void 0 && service !== input.address) continue;\n\t\t\t\tif (queue.length >= 1e4) {\n\t\t\t\t\tqueue.shift();\n\t\t\t\t\tdropped += 1;\n\t\t\t\t}\n\t\t\t\tqueue.push({\n\t\t\t\t\tservice,\n\t\t\t\t\tline\n\t\t\t\t});\n\t\t\t\tnotify();\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (!signal.aborted) emit({\n\t\t\t\tkind: \"stream-failed\",\n\t\t\t\tmessage: failureMessage(error)\n\t\t\t});\n\t\t} finally {\n\t\t\tactive -= 1;\n\t\t\tnotify();\n\t\t}\n\t};\n\tfor (const attachment of attachments) pump(attachment);\n\ttry {\n\t\twhile (true) {\n\t\t\tlet next = queue.shift();\n\t\t\twhile (next !== void 0) {\n\t\t\t\tif (dropped > 0) {\n\t\t\t\t\tconst count = dropped;\n\t\t\t\t\tdropped = 0;\n\t\t\t\t\temit({\n\t\t\t\t\t\tkind: \"lines-dropped\",\n\t\t\t\t\t\tcount\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tyield next;\n\t\t\t\tnext = queue.shift();\n\t\t\t}\n\t\t\tif (signal.aborted || active === 0) break;\n\t\t\tawait new Promise((resolve) => {\n\t\t\t\twake = resolve;\n\t\t\t});\n\t\t}\n\t} finally {\n\t\tdone = true;\n\t\tcontroller.abort();\n\t\tsignal.removeEventListener(\"abort\", notify);\n\t\tinput.signal?.removeEventListener(\"abort\", abortInternal);\n\t}\n}\n/** Resolves the running app and attaches to its log streams; the caller consumes `lines`. */\nasync function executeLog(input, deps, cwd) {\n\tif (process.platform === \"win32\") return notOk(new CliStructuredError(\"LOG.PLATFORM_UNSUPPORTED\", \"local dev is not supported on Windows yet.\"));\n\tconst environment = input.environment ?? \"dev\";\n\tconst devDir = path.join(cwd, devEnvironmentDir(environment));\n\tlet name;\n\tconst attachments = [];\n\tlet services;\n\ttry {\n\t\tvalidateEnvironmentName(environment);\n\t\trequireDevEnvironmentName(devDir, environment);\n\t\tconst identity = deps.identity ?? await resolveAppIdentity(input.entry, input.name, cwd, input.config);\n\t\tname = identity.name;\n\t\tconst resolved = await resolveLocalTargets(identity.config);\n\t\tfor (const target of resolved.values()) try {\n\t\t\tconst container = await target.container.ensure({\n\t\t\t\tappName: name,\n\t\t\t\tenvironment\n\t\t\t});\n\t\t\tattachments.push(await withEmulatorRetry(() => target.attach({\n\t\t\t\tcontainer,\n\t\t\t\tdevDir\n\t\t\t})));\n\t\t} catch (error) {\n\t\t\tthrow toStructured(\"LOG.ATTACH_FAILED\", error);\n\t\t}\n\t\ttry {\n\t\t\tservices = (await Promise.all(attachments.map((a) => withEmulatorRetry(() => a.endpoints())))).flat();\n\t\t} catch (error) {\n\t\t\tthrow toStructured(\"LOG.ATTACH_FAILED\", error);\n\t\t}\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tif (services.length === 0) return ok({\n\t\tappName: name,\n\t\tservices: [],\n\t\tlines: mergeLogStreams([], input)\n\t});\n\tif (input.address !== void 0 && !services.some((s) => s.address === input.address)) return notOk(new CliStructuredError(\"LOG.ADDRESS_UNKNOWN\", `no service \"${input.address}\" in \"${name}\" — running services: ${services.map((s) => s.address).join(\", \")}.`));\n\treturn ok({\n\t\tappName: name,\n\t\tservices,\n\t\tlines: mergeLogStreams(attachments, input)\n\t});\n}\n//#endregion\nexport { LOG_QUEUE_LIMIT, executeLog };\n\n//# sourceMappingURL=execute-log-T_FgN53M.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAS,eAAe,OAAO;CAC9B,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC7D;;;;;AAKA,MAAM,kBAAkB;;;;;;;;;;;AAWxB,gBAAgB,gBAAgB,aAAa,OAAO;CACnD,MAAM,aAAa,IAAI,gBAAgB;CACvC,MAAM,EAAE,WAAW;CACnB,MAAM,sBAAsB,WAAW,MAAM;CAC7C,IAAI,MAAM,QAAQ,YAAY,MAAM,WAAW,MAAM;CACrD,MAAM,QAAQ,iBAAiB,SAAS,eAAe,EAAE,MAAM,KAAK,CAAC;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AAM,IAAI,mBAAmB,uBAAuB,eAAe,MAAM,QAAQ,QAAQ,KAAK,wBAAwB,SAAS,KAAK,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;CAC9P,OAAO,GAAG;EACT,SAAS;EACT;EACA,OAAO,gBAAgB,aAAa,KAAK;CAC1C,CAAC;AACF"}
@@ -2,7 +2,7 @@ import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
2
2
  import { i as POINTER, o as isSecretPointer, r as isSecretString, t as describeKind } from "./describe-kind-Cpm_euxo-CkhlGJUL.mjs";
3
3
  import { t as InternalError } from "./internal-error-Dfur7Zqt-D96dWHZK.mjs";
4
4
  import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
5
- //#region ../../0-framework/1-core/core/dist/graph-Bqr7PSGl.mjs
5
+ //#region ../../0-framework/1-core/core/dist/graph-CBt9CRBT.mjs
6
6
  /** The reserved name of a resource's single anonymous output port. Rejected as a user-declared port name (node.ts). */
7
7
  const RESOURCE_OUT_PORT = "$out";
8
8
  /**
@@ -302,7 +302,7 @@ function requireConfigKeySegmentNames(names, kind, factory) {
302
302
  function freezeParams(params) {
303
303
  const frozen = {};
304
304
  for (const [name, param] of Object.entries(params)) frozen[name] = Object.freeze({ ...param });
305
- return Object.freeze(frozen);
305
+ return blindCast(Object.freeze(frozen));
306
306
  }
307
307
  /** A frozen shallow copy that keeps the caller's declared type. */
308
308
  function frozenShallowCopy(obj) {
@@ -432,7 +432,7 @@ function dependency(def) {
432
432
  kind: "dependency",
433
433
  name: def.name !== void 0 && def.name.length > 0 ? def.name : def.type,
434
434
  type: def.type,
435
- connection,
435
+ connection: blindCast(connection),
436
436
  required: def.required
437
437
  });
438
438
  }
@@ -442,30 +442,58 @@ function dependency(def) {
442
442
  */
443
443
  function module(name, boundaryOrBody, maybeBody) {
444
444
  requireName(name, "module");
445
- const closedRoot = typeof boundaryOrBody === "function";
446
- const boundary = closedRoot ? {} : boundaryOrBody;
447
- if (Object.hasOwn(boundary, "params")) throw new Error(`module("${name}") declares \`params\`, which a module no longer takes. Declare each value as a field of the module's \`input\` schema, and bind it with provision(module, { input: { … } }) (ADR-0061).`);
448
- if (Object.hasOwn(boundary, "secrets")) throw new Error(`module("${name}") declares \`secrets\`, which a module no longer takes. Declare each secret as a secretString() field of the module's \`input\` schema, and bind it with provision(module, { input: { … } }) (ADR-0061).`);
449
- requireNotReservedPortNames(Object.keys(boundary.deps ?? {}), "module");
450
- requireNotReservedPortNames(Object.keys(boundary.expose ?? {}), "module");
451
- if (boundary.input !== void 0 && typeof boundary.input["~standard"]?.validate !== "function") throw new Error("module() `input` must be a Standard Schema (an object with a \"~standard\".validate function) — see https://standardschema.dev (ADR-0061).");
452
- const deps = frozenShallowCopy(boundary.deps ?? {});
453
- const expose = frozenShallowCopy(boundary.expose ?? {});
454
- const body = closedRoot ? (ctx) => {
445
+ if (typeof boundaryOrBody === "function") return buildModuleNode(false, name, {}, (ctx) => {
455
446
  boundaryOrBody({
456
447
  ...ctx,
457
448
  input: void 0
458
449
  });
459
450
  return {};
460
- } : maybeBody;
451
+ });
452
+ return buildModuleNode(false, name, boundaryOrBody, requireBody("module", name, maybeBody));
453
+ }
454
+ function appRoot(name, optionsOrBody, maybeBody) {
455
+ requireName(name, "appRoot");
456
+ if (typeof optionsOrBody === "function") return buildModuleNode(true, name, {}, ({ environment, provision }) => {
457
+ optionsOrBody({
458
+ input: void 0,
459
+ environment,
460
+ provision
461
+ });
462
+ return {};
463
+ });
464
+ const body = requireBody("appRoot", name, maybeBody);
465
+ if (Object.hasOwn(optionsOrBody, "deps")) throw new Error(`appRoot("${name}") declares \`deps\`, which an app root cannot have: nothing provisions the root, so nothing can wire a dependency into it. Provision the resource inside the root's body instead.`);
466
+ if (Object.hasOwn(optionsOrBody, "expose")) throw new Error(`appRoot("${name}") declares \`expose\`, which an app root cannot have: nothing provisions the root, so nothing can consume what it exposes.`);
467
+ return buildModuleNode(true, name, optionsOrBody, ({ input, environment, provision }) => {
468
+ body({
469
+ input,
470
+ environment,
471
+ provision
472
+ });
473
+ return {};
474
+ });
475
+ }
476
+ function requireBody(factory, name, body) {
477
+ if (typeof body !== "function") throw new Error(`${factory}("${name}") requires a body function.`);
478
+ return body;
479
+ }
480
+ /** Constructs a branded, frozen module node for `module()` and `appRoot()`. Construction is inert: the body is wiring, and runs only when the module is Loaded. */
481
+ function buildModuleNode(root, name, boundary, body) {
482
+ const factory = root ? "appRoot" : "module";
483
+ if (Object.hasOwn(boundary, "params")) throw new Error(`${factory}("${name}") declares \`params\`, which a module no longer takes. Declare each value as a field of the module's \`input\` schema, and bind it with provision(module, { input: { … } }) (ADR-0061).`);
484
+ if (Object.hasOwn(boundary, "secrets")) throw new Error(`${factory}("${name}") declares \`secrets\`, which a module no longer takes. Declare each secret as a secretString() field of the module's \`input\` schema, and bind it with provision(module, { input: { … } }) (ADR-0061).`);
485
+ requireNotReservedPortNames(Object.keys(boundary.deps ?? {}), "module");
486
+ requireNotReservedPortNames(Object.keys(boundary.expose ?? {}), "module");
487
+ if (boundary.input !== void 0 && typeof boundary.input["~standard"]?.validate !== "function") throw new Error(`${factory}() \`input\` must be a Standard Schema (an object with a "~standard".validate function) — see https://standardschema.dev (ADR-0061).`);
461
488
  return Object.freeze({
462
489
  [NODE]: true,
463
490
  kind: "module",
464
491
  name,
465
- deps,
492
+ deps: frozenShallowCopy(boundary.deps ?? {}),
466
493
  inputSchema: boundary.input,
467
- expose,
468
- body
494
+ expose: frozenShallowCopy(boundary.expose ?? {}),
495
+ body,
496
+ isRoot: () => root
469
497
  });
470
498
  }
471
499
  /**
@@ -474,7 +502,7 @@ function module(name, boundaryOrBody, maybeBody) {
474
502
  * installed copy of core (dual-package hazard).
475
503
  */
476
504
  function isNode(value) {
477
- return typeof value === "object" && value !== null && value[NODE] === true;
505
+ return typeof value === "object" && value !== null && blindCast(value)[NODE] === true;
478
506
  }
479
507
  /** A node's dependency slots. A resource node built by another installed copy of core may have no `inputs`; that means none. */
480
508
  function slotsOf(node) {
@@ -848,7 +876,7 @@ function validateModuleInput(entry, resolved, environment) {
848
876
  if (result instanceof Promise) throw new LoadError(`The input schema of module "${address}" returned a Promise from validate(). A module's input is validated synchronously at Load; use a schema with no asynchronous checks.`);
849
877
  if (result.issues !== void 0) {
850
878
  const messages = result.issues.map((issue) => issue.message).join("; ");
851
- if (entry.isRoot) throw new LoadError(`The input of root module "${address}" does not match its input schema: ${messages}. A root's input is the values the \`config\` adapters in prisma.config.ts return${environment === void 0 ? "" : ` for the environment "${environment.name}"`}.`);
879
+ if (entry.isLoadRoot) throw new LoadError(`The input of root module "${address}" does not match its input schema: ${messages}. A root's input is the values the \`config\` adapters in prisma.config.ts return${environment === void 0 ? "" : ` for the environment "${environment.name}"`}.`);
852
880
  throw new LoadError(`The input binding of module "${address}" does not match the module's input schema: ${messages}`);
853
881
  }
854
882
  const bound = sourcesByPath(resolved);
@@ -998,7 +1026,7 @@ function resolveValues(input) {
998
1026
  const entry = moduleInputByAddress.get(origin.module);
999
1027
  if (entry === void 0) throw new LoadError(`${describeSite(site)} depends on ${inputFieldLabel(origin)} of module "${origin.module}", which this Load does not provision. An input field can be passed on only inside the body of the module that received it.`);
1000
1028
  if (origin.path.length === 0) {
1001
- const everyVariable = entry.isRoot ? " The root's input is every value the `config` adapters return, which by default is every variable of the process environment, secrets included." : "";
1029
+ const everyVariable = entry.isLoadRoot ? " The root's input is every value the `config` adapters return, which by default is every variable of the process environment, secrets included." : "";
1002
1030
  throw new LoadError(`${describeSite(site)} depends on the whole input of module "${origin.module}". A module body's input is a dictionary of values, not a value, so it cannot be passed on whole.${everyVariable} Pass its fields on by name, such as input.from.`);
1003
1031
  }
1004
1032
  if (entry.checked !== void 0) {
@@ -1007,7 +1035,7 @@ function resolveValues(input) {
1007
1035
  result = field.value;
1008
1036
  } else {
1009
1037
  result = readPath(validatedInputOf(entry), origin);
1010
- if (entry.isRoot) rootFields.set(origin.path.join("\0"), result === void 0 ? { path: origin.path } : {
1038
+ if (entry.isLoadRoot) rootFields.set(origin.path.join("\0"), result === void 0 ? { path: origin.path } : {
1011
1039
  path: origin.path,
1012
1040
  value: result
1013
1041
  });
@@ -1037,7 +1065,7 @@ function resolveValues(input) {
1037
1065
  validatedInputs.set(entry.moduleAddress, validated);
1038
1066
  return validated;
1039
1067
  };
1040
- const rootModuleAddress = () => input.moduleInputs.find((entry) => entry.isRoot)?.moduleAddress ?? "";
1068
+ const rootModuleAddress = () => input.moduleInputs.find((entry) => entry.isLoadRoot)?.moduleAddress ?? "";
1041
1069
  const appConfigurationReadOf = (inputBindings, params, secretSources) => {
1042
1070
  if (input.configuration !== void 0 || input.appConfigurationRead !== void 0) {
1043
1071
  const kept = [...inputBindings.map(({ serviceAddress, binding }) => ({
@@ -1330,6 +1358,7 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
1330
1358
  if (localIds.has(id)) throw new LoadError(`Duplicate provision id "${id}" in module "${moduleNode.name}".`);
1331
1359
  const untrusted = child;
1332
1360
  if (!isNode(untrusted) || untrusted.kind !== "service" && untrusted.kind !== "resource" && untrusted.kind !== "module") throw new LoadError(`provision("${id}") expects a branded service, resource, or module node (construct it with the service()/resource()/module() factories or a pack's own).`);
1361
+ if (untrusted.kind === "module" && typeof untrusted.isRoot === "function" && untrusted.isRoot()) throw new LoadError(`Module "${selfId}" provisions the app root "${untrusted.name}". An app root is the deploy's entry and cannot be provisioned. Build the module with module() instead.`);
1333
1362
  localIds.add(id);
1334
1363
  const fullAddress = `${selfId}.${id}`;
1335
1364
  if (child.kind === "resource") {
@@ -1413,7 +1442,7 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
1413
1442
  moduleAddress: fullAddress,
1414
1443
  schema: childInputSchema,
1415
1444
  binding: provisionInput,
1416
- isRoot: false
1445
+ isLoadRoot: false
1417
1446
  });
1418
1447
  edges.push(...wiringEdges(localWiring, fullAddress));
1419
1448
  recordAuthoredWiring(fullAddress, localWiring);
@@ -1483,14 +1512,14 @@ function loadModule(root, opts) {
1483
1512
  moduleAddress: rootId,
1484
1513
  schema: root.inputSchema,
1485
1514
  binding: void 0,
1486
- isRoot: true,
1515
+ isLoadRoot: true,
1487
1516
  checked: opts.appConfigurationRead.rootInput
1488
1517
  });
1489
1518
  else if (opts?.configuration !== void 0) moduleInputs.push({
1490
1519
  moduleAddress: rootId,
1491
1520
  schema: root.inputSchema,
1492
1521
  binding: opts.configuration,
1493
- isRoot: true
1522
+ isLoadRoot: true
1494
1523
  });
1495
1524
  else throw new LoadError(`Module "${root.name}" declares input and is being deployed as the root, but Load was given no app configuration to fill it from. Pass { configuration } to Load; prisma deploy and prisma dev pass the values the \`config\` adapters return.`);
1496
1525
  const nodes = [];
@@ -1606,13 +1635,13 @@ function assertAppName(name) {
1606
1635
  * functions.
1607
1636
  */
1608
1637
  function Load(root, opts) {
1609
- if (!isNode(root)) throw new LoadError("Load expects a branded service or module node (construct it with the service()/module() factories).");
1638
+ if (!isNode(root)) throw new LoadError("Load expects a branded service, module or app root node (construct it with the service(), module() or appRoot() factories).");
1610
1639
  if (root.kind === "module") {
1611
1640
  assertAppName(opts?.id ?? root.name);
1612
1641
  return loadModule(root, opts);
1613
1642
  }
1614
1643
  if (root.kind === "service") return loadService(root, opts?.id ?? "root");
1615
- throw new LoadError("Load expects a service or module root (received another node kind).");
1644
+ throw new LoadError("Load expects a service, module or app root (received another node kind).");
1616
1645
  }
1617
1646
  /** The app secrets key of every secret source the graph names, once each, in the order Load met them. A source built without a `secretsKey` is left out. */
1618
1647
  function secretsKeys(graph) {
@@ -1629,6 +1658,6 @@ function nodeAddresses(graph) {
1629
1658
  return graph.nodes.map(({ id }) => id).sort();
1630
1659
  }
1631
1660
  //#endregion
1632
- export { slotsOf as S, resolve as _, assertAppName as a, secretsKeys as b, isNode as c, isSecretSource as d, isValue as f, provisionNeed as g, paramSource as h, ResourceNodeBase as i, isParamSource as l, nodeAddresses as m, LoadError as n, dependency as o, module as p, RESOURCE_OUT_PORT as r, freezeNode as s, Load as t, isProvisionNeed as u, resource as v, service as x, secretSource as y };
1661
+ export { slotsOf as C, service as S, provisionNeed as _, appRoot as a, secretSource as b, freezeNode as c, isProvisionNeed as d, isSecretSource as f, paramSource as g, nodeAddresses as h, ResourceNodeBase as i, isNode as l, module as m, LoadError as n, assertAppName as o, isValue as p, RESOURCE_OUT_PORT as r, dependency as s, Load as t, isParamSource as u, resolve as v, secretsKeys as x, resource as y };
1633
1662
 
1634
- //# sourceMappingURL=graph-Bqr7PSGl-BM-M-TlO.mjs.map
1663
+ //# sourceMappingURL=graph-CBt9CRBT-yMupsISb.mjs.map