@open-mercato/cli 0.11.1-develop.8593.1.50784dae35 → 0.11.1-develop.8687.1.adb16f62b3

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 (327) hide show
  1. package/.turbo/turbo-build.log +6 -2
  2. package/AGENTS.md +2 -0
  3. package/dist/agentic/guides/architecture.md +2 -2
  4. package/dist/agentic/guides/extensions.md +7 -2
  5. package/dist/agentic/guides/framework-extension-points.md +1 -0
  6. package/dist/agentic/guides/infrastructure-providers.md +20 -0
  7. package/dist/agentic/guides/integrations.md +2 -2
  8. package/dist/agentic/guides/module-facts.json +11067 -7122
  9. package/dist/agentic/guides/module-facts.v2.json +11055 -7094
  10. package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
  11. package/dist/agentic/guides/modules/ai_assistant/index.md +1 -1
  12. package/dist/agentic/guides/modules/api_docs/index.md +1 -1
  13. package/dist/agentic/guides/modules/api_keys/index.md +1 -1
  14. package/dist/agentic/guides/modules/assisted_selling/acl-features.md +16 -0
  15. package/dist/agentic/guides/modules/assisted_selling/contribution-resolutions.md +21 -0
  16. package/dist/agentic/guides/modules/assisted_selling/domain-commands.md +11 -0
  17. package/dist/agentic/guides/modules/assisted_selling/entities.md +11 -0
  18. package/dist/agentic/guides/modules/assisted_selling/events.md +22 -0
  19. package/dist/agentic/guides/modules/assisted_selling/exact-override-targets.md +17 -0
  20. package/dist/agentic/guides/modules/assisted_selling/index.md +21 -0
  21. package/dist/agentic/guides/modules/assisted_selling/owned-contract-module-metadata.md +11 -0
  22. package/dist/agentic/guides/modules/assisted_selling/setup.md +11 -0
  23. package/dist/agentic/guides/modules/assisted_selling/umes-contributions.md +21 -0
  24. package/dist/agentic/guides/modules/assisted_selling/umes-hosts.md +23 -0
  25. package/dist/agentic/guides/modules/attachments/exact-override-targets.md +1 -1
  26. package/dist/agentic/guides/modules/attachments/index.md +1 -1
  27. package/dist/agentic/guides/modules/attachments/workers.md +1 -1
  28. package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
  29. package/dist/agentic/guides/modules/auth/index.md +1 -1
  30. package/dist/agentic/guides/modules/availability/index.md +1 -1
  31. package/dist/agentic/guides/modules/backups/di-registrations-rich.md +11 -0
  32. package/dist/agentic/guides/modules/backups/di-service-tokens.md +11 -0
  33. package/dist/agentic/guides/modules/backups/exact-override-targets.md +11 -0
  34. package/dist/agentic/guides/modules/backups/index.md +5 -2
  35. package/dist/agentic/guides/modules/business_rules/index.md +1 -1
  36. package/dist/agentic/guides/modules/carrier_inpost/index.md +1 -1
  37. package/dist/agentic/guides/modules/cart/index.md +1 -1
  38. package/dist/agentic/guides/modules/catalog/acl-features.md +2 -1
  39. package/dist/agentic/guides/modules/catalog/active-extension-bindings.md +2 -0
  40. package/dist/agentic/guides/modules/catalog/backend-pages.md +1 -0
  41. package/dist/agentic/guides/modules/catalog/contribution-resolutions.md +5 -0
  42. package/dist/agentic/guides/modules/catalog/di-registrations-rich.md +8 -7
  43. package/dist/agentic/guides/modules/catalog/di-service-tokens.md +5 -4
  44. package/dist/agentic/guides/modules/catalog/domain-commands.md +2 -0
  45. package/dist/agentic/guides/modules/catalog/entities.md +1 -0
  46. package/dist/agentic/guides/modules/catalog/events.md +4 -1
  47. package/dist/agentic/guides/modules/catalog/exact-override-targets.md +13 -7
  48. package/dist/agentic/guides/modules/catalog/index.md +9 -9
  49. package/dist/agentic/guides/modules/catalog/umes-contributions.md +5 -0
  50. package/dist/agentic/guides/modules/catalog/umes-hosts.md +4 -0
  51. package/dist/agentic/guides/modules/catalog/workers.md +1 -0
  52. package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
  53. package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
  54. package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
  55. package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
  56. package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
  57. package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
  58. package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
  59. package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
  60. package/dist/agentic/guides/modules/channel_smtp/index.md +1 -1
  61. package/dist/agentic/guides/modules/checkout/index.md +1 -1
  62. package/dist/agentic/guides/modules/communication_channels/exact-override-targets.md +1 -1
  63. package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
  64. package/dist/agentic/guides/modules/communication_channels/workers.md +1 -1
  65. package/dist/agentic/guides/modules/configs/index.md +1 -1
  66. package/dist/agentic/guides/modules/content/index.md +1 -1
  67. package/dist/agentic/guides/modules/currencies/active-extension-bindings.md +11 -0
  68. package/dist/agentic/guides/modules/currencies/di-registrations-rich.md +1 -1
  69. package/dist/agentic/guides/modules/currencies/di-service-tokens.md +1 -1
  70. package/dist/agentic/guides/modules/currencies/exact-override-targets.md +1 -1
  71. package/dist/agentic/guides/modules/currencies/index.md +3 -2
  72. package/dist/agentic/guides/modules/customer_accounts/active-extension-bindings.md +1 -1
  73. package/dist/agentic/guides/modules/customer_accounts/exact-override-targets.md +2 -0
  74. package/dist/agentic/guides/modules/customer_accounts/index.md +2 -2
  75. package/dist/agentic/guides/modules/customer_accounts/workers.md +2 -0
  76. package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
  77. package/dist/agentic/guides/modules/customers/active-extension-bindings.md +2 -1
  78. package/dist/agentic/guides/modules/customers/incoming-installed-contributions.md +1 -0
  79. package/dist/agentic/guides/modules/customers/index.md +3 -3
  80. package/dist/agentic/guides/modules/customers/umes-hosts.md +1 -0
  81. package/dist/agentic/guides/modules/dashboards/active-extension-bindings.md +0 -1
  82. package/dist/agentic/guides/modules/dashboards/cli-commands.md +1 -0
  83. package/dist/agentic/guides/modules/dashboards/exact-override-targets.md +1 -0
  84. package/dist/agentic/guides/modules/dashboards/index.md +2 -3
  85. package/dist/agentic/guides/modules/data_sync/index.md +1 -1
  86. package/dist/agentic/guides/modules/design_system/index.md +1 -1
  87. package/dist/agentic/guides/modules/devices/index.md +1 -1
  88. package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
  89. package/dist/agentic/guides/modules/directory/index.md +1 -1
  90. package/dist/agentic/guides/modules/documents/index.md +1 -1
  91. package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
  92. package/dist/agentic/guides/modules/entities/index.md +1 -1
  93. package/dist/agentic/guides/modules/eudr/index.md +1 -1
  94. package/dist/agentic/guides/modules/events/index.md +1 -1
  95. package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
  96. package/dist/agentic/guides/modules/forms/index.md +1 -1
  97. package/dist/agentic/guides/modules/gateway_autopay/index.md +1 -1
  98. package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
  99. package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
  100. package/dist/agentic/guides/modules/generators/index.md +1 -1
  101. package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
  102. package/dist/agentic/guides/modules/integrations/di-registrations-rich.md +8 -8
  103. package/dist/agentic/guides/modules/integrations/di-service-tokens.md +4 -4
  104. package/dist/agentic/guides/modules/integrations/exact-override-targets.md +14 -12
  105. package/dist/agentic/guides/modules/integrations/index.md +2 -2
  106. package/dist/agentic/guides/modules/integrations/setup.md +1 -1
  107. package/dist/agentic/guides/modules/integrations/workers.md +3 -1
  108. package/dist/agentic/guides/modules/ledger/acl-features.md +16 -0
  109. package/dist/agentic/guides/modules/ledger/active-extension-bindings.md +11 -0
  110. package/dist/agentic/guides/modules/ledger/backend-pages.md +21 -0
  111. package/dist/agentic/guides/modules/ledger/domain-commands.md +22 -0
  112. package/dist/agentic/guides/modules/ledger/encryption.md +11 -0
  113. package/dist/agentic/guides/modules/ledger/entities.md +17 -0
  114. package/dist/agentic/guides/modules/ledger/events.md +19 -0
  115. package/dist/agentic/guides/modules/ledger/exact-override-targets.md +30 -0
  116. package/dist/agentic/guides/modules/ledger/index.md +22 -0
  117. package/dist/agentic/guides/modules/ledger/owned-contract-module-metadata.md +11 -0
  118. package/dist/agentic/guides/modules/ledger/setup.md +11 -0
  119. package/dist/agentic/guides/modules/ledger/umes-hosts.md +26 -0
  120. package/dist/agentic/guides/modules/messages/index.md +1 -1
  121. package/dist/agentic/guides/modules/notifications/index.md +1 -1
  122. package/dist/agentic/guides/modules/onboarding/index.md +1 -1
  123. package/dist/agentic/guides/modules/payment_gateways/active-extension-bindings.md +1 -1
  124. package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
  125. package/dist/agentic/guides/modules/perspectives/index.md +1 -1
  126. package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
  127. package/dist/agentic/guides/modules/planner/index.md +1 -1
  128. package/dist/agentic/guides/modules/portal/index.md +1 -1
  129. package/dist/agentic/guides/modules/progress/index.md +1 -1
  130. package/dist/agentic/guides/modules/promotions/index.md +1 -1
  131. package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
  132. package/dist/agentic/guides/modules/query_index/index.md +1 -1
  133. package/dist/agentic/guides/modules/record_locks/index.md +1 -1
  134. package/dist/agentic/guides/modules/resources/exact-override-targets.md +3 -3
  135. package/dist/agentic/guides/modules/resources/index.md +1 -1
  136. package/dist/agentic/guides/modules/resources/owned-contract-module-metadata.md +1 -1
  137. package/dist/agentic/guides/modules/resources/setup.md +1 -1
  138. package/dist/agentic/guides/modules/sales/contribution-resolutions.md +1 -0
  139. package/dist/agentic/guides/modules/sales/exact-override-targets.md +1 -0
  140. package/dist/agentic/guides/modules/sales/index.md +3 -3
  141. package/dist/agentic/guides/modules/sales/umes-contributions.md +1 -0
  142. package/dist/agentic/guides/modules/scheduler/index.md +1 -1
  143. package/dist/agentic/guides/modules/search/index.md +1 -1
  144. package/dist/agentic/guides/modules/security/index.md +1 -1
  145. package/dist/agentic/guides/modules/seeds/index.md +1 -1
  146. package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
  147. package/dist/agentic/guides/modules/sso/index.md +1 -1
  148. package/dist/agentic/guides/modules/staff/contribution-resolutions.md +1 -1
  149. package/dist/agentic/guides/modules/staff/exact-override-targets.md +1 -1
  150. package/dist/agentic/guides/modules/staff/index.md +1 -1
  151. package/dist/agentic/guides/modules/staff/workers.md +1 -1
  152. package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
  153. package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
  154. package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
  155. package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
  156. package/dist/agentic/guides/modules/telemetry/index.md +1 -1
  157. package/dist/agentic/guides/modules/tillio/index.md +1 -1
  158. package/dist/agentic/guides/modules/translations/index.md +1 -1
  159. package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
  160. package/dist/agentic/guides/modules/webhooks/index.md +1 -1
  161. package/dist/agentic/guides/modules/wms/index.md +1 -1
  162. package/dist/agentic/guides/modules/workflows/index.md +1 -1
  163. package/dist/agentic/guides/reference-module-facts.json +811 -21
  164. package/dist/agentic/guides/reference-modules/example/active-extension-bindings.md +1 -0
  165. package/dist/agentic/guides/reference-modules/example/backend-pages.md +2 -0
  166. package/dist/agentic/guides/reference-modules/example/contribution-resolutions.md +3 -1
  167. package/dist/agentic/guides/reference-modules/example/di-registrations-rich.md +3 -3
  168. package/dist/agentic/guides/reference-modules/example/di-service-tokens.md +1 -1
  169. package/dist/agentic/guides/reference-modules/example/entities.md +2 -0
  170. package/dist/agentic/guides/reference-modules/example/events.md +2 -1
  171. package/dist/agentic/guides/reference-modules/example/exact-override-targets.md +25 -8
  172. package/dist/agentic/guides/reference-modules/example/index.md +7 -7
  173. package/dist/agentic/guides/reference-modules/example/notifications.md +1 -0
  174. package/dist/agentic/guides/reference-modules/example/setup.md +1 -1
  175. package/dist/agentic/guides/reference-modules/example/umes-contributions.md +3 -1
  176. package/dist/agentic/guides/reference-modules/example/umes-hosts.md +4 -0
  177. package/dist/agentic/guides/upstream/AGENTS.md +5 -4
  178. package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +37 -20
  179. package/dist/agentic/guides/upstream/manifest.json +3 -3
  180. package/dist/agentic/shared/AGENTS.md.template +12 -16
  181. package/dist/agentic/shared/ai/harness/README.md +4 -2
  182. package/dist/agentic/shared/ai/harness/RELEASE.md +4 -4
  183. package/dist/agentic/shared/ai/harness/cases.json +1420 -41
  184. package/dist/agentic/shared/ai/harness/cases.schema.json +4 -4
  185. package/dist/agentic/shared/ai/harness/design-system-inventory.json +640 -142
  186. package/dist/agentic/shared/ai/harness/source-link-inventory.json +223 -16
  187. package/dist/agentic/shared/ai/harness/validators.json +1 -1
  188. package/dist/agentic/shared/ai/skills/om-system-extension/SKILL.md +1 -1
  189. package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-branches.md +25 -0
  190. package/dist/agentic/shared/ai/skills/om-system-extension/references/mechanism-selector.md +1 -0
  191. package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +2 -0
  192. package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +21 -1
  193. package/dist/lib/cache-provider-manifest.js +9 -0
  194. package/dist/lib/cache-provider-manifest.js.map +7 -0
  195. package/dist/lib/generate-watch-plan.js +4 -0
  196. package/dist/lib/generate-watch-plan.js.map +2 -2
  197. package/dist/lib/generate-watch-runner.js +1 -0
  198. package/dist/lib/generate-watch-runner.js.map +2 -2
  199. package/dist/lib/generate-watch-structure.js +2 -0
  200. package/dist/lib/generate-watch-structure.js.map +2 -2
  201. package/dist/lib/generators/ast/writers.js +5 -1
  202. package/dist/lib/generators/ast/writers.js.map +2 -2
  203. package/dist/lib/generators/cache-providers.js +80 -0
  204. package/dist/lib/generators/cache-providers.js.map +7 -0
  205. package/dist/lib/generators/form-section-ast.js +156 -0
  206. package/dist/lib/generators/form-section-ast.js.map +7 -0
  207. package/dist/lib/generators/form-section-extension-compiler.js +568 -0
  208. package/dist/lib/generators/form-section-extension-compiler.js.map +7 -0
  209. package/dist/lib/generators/form-section-extension-source.js +245 -0
  210. package/dist/lib/generators/form-section-extension-source.js.map +7 -0
  211. package/dist/lib/generators/form-section-runtime-revisions.js +184 -0
  212. package/dist/lib/generators/form-section-runtime-revisions.js.map +7 -0
  213. package/dist/lib/generators/form-sections.js +773 -0
  214. package/dist/lib/generators/form-sections.js.map +7 -0
  215. package/dist/lib/generators/index.js +2 -0
  216. package/dist/lib/generators/index.js.map +2 -2
  217. package/dist/lib/generators/module-entities.js +21 -2
  218. package/dist/lib/generators/module-entities.js.map +2 -2
  219. package/dist/lib/generators/module-extension-facts.js +2 -1
  220. package/dist/lib/generators/module-extension-facts.js.map +2 -2
  221. package/dist/lib/generators/module-facts.js +30 -1
  222. package/dist/lib/generators/module-facts.js.map +2 -2
  223. package/dist/lib/generators/module-override-targets.js +24 -2
  224. package/dist/lib/generators/module-override-targets.js.map +2 -2
  225. package/dist/lib/generators/module-registry.js +75 -3
  226. package/dist/lib/generators/module-registry.js.map +2 -2
  227. package/dist/lib/generators/openapi.js +27 -17
  228. package/dist/lib/generators/openapi.js.map +2 -2
  229. package/dist/lib/post-generate-invalidation.js +20 -1
  230. package/dist/lib/post-generate-invalidation.js.map +2 -2
  231. package/dist/lib/resolver.js +195 -1
  232. package/dist/lib/resolver.js.map +3 -3
  233. package/dist/lib/scaffold/field-dsl.js +393 -0
  234. package/dist/lib/scaffold/field-dsl.js.map +7 -0
  235. package/dist/lib/scaffold/index.js +412 -0
  236. package/dist/lib/scaffold/index.js.map +7 -0
  237. package/dist/lib/scaffold/targets.js +42 -0
  238. package/dist/lib/scaffold/targets.js.map +7 -0
  239. package/dist/lib/scaffold/templates/create-page.js +52 -0
  240. package/dist/lib/scaffold/templates/create-page.js.map +7 -0
  241. package/dist/lib/scaffold/templates/detail-page.js +186 -0
  242. package/dist/lib/scaffold/templates/detail-page.js.map +7 -0
  243. package/dist/lib/scaffold/templates/form-config.js +42 -0
  244. package/dist/lib/scaffold/templates/form-config.js.map +7 -0
  245. package/dist/lib/scaffold/templates/index.js +27 -0
  246. package/dist/lib/scaffold/templates/index.js.map +7 -0
  247. package/dist/lib/scaffold/templates/list-page.js +190 -0
  248. package/dist/lib/scaffold/templates/list-page.js.map +7 -0
  249. package/dist/lib/scaffold/templates/metas.js +47 -0
  250. package/dist/lib/scaffold/templates/metas.js.map +7 -0
  251. package/dist/lib/scaffold/templates/module-files.js +85 -0
  252. package/dist/lib/scaffold/templates/module-files.js.map +7 -0
  253. package/dist/lib/single-instance-strategy-guard.js +26 -3
  254. package/dist/lib/single-instance-strategy-guard.js.map +2 -2
  255. package/dist/lib/testing/integration-discovery.js +32 -3
  256. package/dist/lib/testing/integration-discovery.js.map +2 -2
  257. package/dist/lib/testing/integration.js +232 -8
  258. package/dist/lib/testing/integration.js.map +2 -2
  259. package/dist/mercato.js +40 -7
  260. package/dist/mercato.js.map +2 -2
  261. package/jest.config.cjs +2 -0
  262. package/package.json +7 -7
  263. package/src/__tests__/mercato.test.ts +18 -0
  264. package/src/__tests__/rotation-json-output.test.ts +52 -0
  265. package/src/lib/__tests__/agentic-workflows-ownership.test.ts +79 -0
  266. package/src/lib/__tests__/cache-provider-manifest.test.ts +76 -0
  267. package/src/lib/__tests__/generate-watch-plan.test.ts +3 -2
  268. package/src/lib/__tests__/generate-watch-runner.test.ts +13 -1
  269. package/src/lib/__tests__/generate-watch-structure.test.ts +34 -0
  270. package/src/lib/__tests__/post-generate-invalidation.test.ts +108 -0
  271. package/src/lib/__tests__/resolver.form-section-gates.test.ts +82 -0
  272. package/src/lib/__tests__/single-instance-strategy-guard.test.ts +129 -0
  273. package/src/lib/cache-provider-manifest.ts +8 -0
  274. package/src/lib/generate-watch-plan.ts +6 -3
  275. package/src/lib/generate-watch-runner.ts +1 -0
  276. package/src/lib/generate-watch-structure.ts +5 -1
  277. package/src/lib/generators/__tests__/cache-providers.test.ts +102 -0
  278. package/src/lib/generators/__tests__/derived-crud-route-collisions.test.ts +85 -0
  279. package/src/lib/generators/__tests__/form-section-outbox.test.ts +53 -0
  280. package/src/lib/generators/__tests__/form-sections.test.ts +896 -0
  281. package/src/lib/generators/__tests__/module-extension-facts.test.ts +1 -0
  282. package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +8 -6
  283. package/src/lib/generators/__tests__/module-facts.example-fact-coverage.test.ts +37 -13
  284. package/src/lib/generators/__tests__/module-facts.local-reference.test.ts +13 -0
  285. package/src/lib/generators/__tests__/module-override-targets.test.ts +2 -3
  286. package/src/lib/generators/__tests__/module-subset.test.ts +1 -1
  287. package/src/lib/generators/__tests__/openapi.test.ts +60 -13
  288. package/src/lib/generators/__tests__/structural-contracts.test.ts +2 -2
  289. package/src/lib/generators/ast/writers.ts +6 -1
  290. package/src/lib/generators/cache-providers.ts +111 -0
  291. package/src/lib/generators/form-section-ast.ts +166 -0
  292. package/src/lib/generators/form-section-extension-compiler.ts +632 -0
  293. package/src/lib/generators/form-section-extension-source.ts +308 -0
  294. package/src/lib/generators/form-section-runtime-revisions.ts +211 -0
  295. package/src/lib/generators/form-sections.ts +896 -0
  296. package/src/lib/generators/index.ts +1 -0
  297. package/src/lib/generators/module-entities.ts +22 -4
  298. package/src/lib/generators/module-extension-facts.ts +1 -0
  299. package/src/lib/generators/module-facts.ts +40 -0
  300. package/src/lib/generators/module-override-targets.ts +19 -0
  301. package/src/lib/generators/module-registry.ts +80 -4
  302. package/src/lib/generators/openapi.ts +31 -20
  303. package/src/lib/post-generate-invalidation.ts +28 -1
  304. package/src/lib/resolver.ts +218 -0
  305. package/src/lib/scaffold/__tests__/__snapshots__/scaffold-golden.test.ts.snap +1742 -0
  306. package/src/lib/scaffold/__tests__/helpers.ts +75 -0
  307. package/src/lib/scaffold/__tests__/scaffold-ds-contract.test.ts +248 -0
  308. package/src/lib/scaffold/__tests__/scaffold-golden.test.ts +267 -0
  309. package/src/lib/scaffold/__tests__/scaffold-runtime.test.tsx +193 -0
  310. package/src/lib/scaffold/field-dsl.ts +491 -0
  311. package/src/lib/scaffold/index.ts +531 -0
  312. package/src/lib/scaffold/targets.ts +68 -0
  313. package/src/lib/scaffold/templates/create-page.ts +52 -0
  314. package/src/lib/scaffold/templates/detail-page.ts +190 -0
  315. package/src/lib/scaffold/templates/form-config.ts +42 -0
  316. package/src/lib/scaffold/templates/index.ts +27 -0
  317. package/src/lib/scaffold/templates/list-page.ts +190 -0
  318. package/src/lib/scaffold/templates/metas.ts +48 -0
  319. package/src/lib/scaffold/templates/module-files.ts +87 -0
  320. package/src/lib/single-instance-strategy-guard.ts +51 -1
  321. package/src/lib/testing/__tests__/integration-app-only-playwright.test.ts +225 -0
  322. package/src/lib/testing/__tests__/integration-app-only.test.ts +320 -0
  323. package/src/lib/testing/__tests__/integration-discovery.test.ts +45 -1
  324. package/src/lib/testing/integration-discovery.ts +32 -2
  325. package/src/lib/testing/integration.ts +293 -11
  326. package/src/mercato.ts +39 -5
  327. package/dist/agentic/guides/modules/dashboards/incoming-installed-contributions.md +0 -11
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/lib/generators/form-sections.ts"],
4
+ "sourcesContent": ["import fs from 'node:fs'\nimport { createHash, randomUUID } from 'node:crypto'\nimport path from 'node:path'\nimport ts from 'typescript-js'\nimport { resolveModuleRequirement, type ModuleIdentity } from '@open-mercato/shared/modules/module-locators'\nimport {\n crudFormSectionClientMutationFactSchema, crudSectionOperationMethods as derivedRouteMethods,\n derivedCrudFormSectionClientMutationFact, derivedCrudFormSectionRetryPath, parseCrudFormSectionClientMutationFacts,\n} from '@open-mercato/shared/lib/crud/form-sections/client-mutation-facts'\nimport { crudFormSectionOverrideKey } from '@open-mercato/shared/lib/crud/form-sections/composition'\nimport type { CrudFormSectionClientHostFact } from '@open-mercato/shared/modules/form-sections'\nimport type { FormSectionOverridesMap } from '@open-mercato/shared/modules/overrides'\nimport { writeGeneratedFile, type GeneratorResult } from '../utils'\nimport { escapeGeneratedJsonLiteral, stringLiteral } from './ast/writers'\nimport { compileCrudFormSectionExtensions, type CompilerModule, type CompiledSectionExtensions } from './form-section-extension-compiler'\nimport { parseSectionExtensionSources } from './form-section-extension-source'\nimport { arrayField, exportedDeclaration, fieldsOf, helperArgument, literalData, literalValue, readIdentity, readSectionRuntimeFields, unwrap } from './form-section-ast'\nimport { hashHandwrittenSectionRuntime, planHandwrittenSectionRevisionWrite } from './form-section-runtime-revisions'\nimport {\n MODULE_CODE_EXTENSIONS,\n resolveStandaloneSourceMirrorBase,\n stripModuleCodeExtension,\n type ModuleRoots,\n type ResolvedFile,\n} from './scanner'\n\ntype ModuleSource = {\n modId: string\n roots: ModuleRoots\n resolve: (relativePath: string) => ResolvedFile | null\n formSectionOverrides?: Readonly<FormSectionOverridesMap>\n}\n\nconst factFields = [\n ['host', 'hostFacts'],\n ['contribution', 'contributionFacts'],\n] as const\n\ntype Descriptor = {\n id: string\n roundTripId: string\n kind: (typeof factFields)[number][0]\n field: (typeof factFields)[number][1]\n index: number\n runtimePath: string\n}\n\ntype ModuleSections = CompilerModule & {\n hasHandwrittenSections: boolean\n sourceFileName: string\n descriptors: Descriptor[]\n leafDefaultProviderIds: readonly string[]\n sinkIds: readonly string[]\n derivedRoutes: readonly DerivedRouteDeclaration[]\n revisionWrite: ReturnType<typeof planHandwrittenSectionRevisionWrite>\n}\n\ntype DerivedMethod = 'POST' | 'PUT' | 'DELETE'\ntype DerivedRouteDeclaration = {\n index: number\n routePath: string\n hostDescriptorId: string\n operations: readonly ('create' | 'update' | 'delete')[]\n versioned: boolean\n outboxRetry: boolean\n}\nexport type GeneratedDerivedCrudRoute = {\n moduleId: string\n routePath: string\n fileName: string\n methods: DerivedMethod[]\n}\n\nexport const generatedDerivedCrudRouteIndex = 'crud-form-section-derived-routes.generated.json'\n\n\nfunction compareIds(left: string, right: string): number {\n if (left === right) return 0\n return left < right ? -1 : 1\n}\n\nfunction readRuntimePath(\n initializer: ts.Expression | undefined,\n declaration: ResolvedFile,\n declarationSourcePath: string,\n expected: { id: string; roundTripId: string },\n invalid: (reason: string) => never,\n): { runtimePath: string; source: ts.SourceFile } {\n if (!initializer) return invalid('missing runtime loader')\n const arrow = unwrap(helperArgument(initializer, 'lazyCrudFormSectionRuntime', invalid))\n if (!ts.isArrowFunction(arrow) || arrow.parameters.length !== 0 || ts.isBlock(arrow.body)) {\n return invalid('expected a zero-argument arrow returning a literal import()')\n }\n const call = unwrap(arrow.body)\n if (!ts.isCallExpression(call) || call.expression.kind !== ts.SyntaxKind.ImportKeyword || call.arguments.length !== 1) {\n return invalid('expected a literal import()')\n }\n const specifier = literalValue(call.arguments[0], 'runtime import specifier', invalid)\n if (!specifier.startsWith('./') || specifier.includes('\\\\')) return invalid('expected a module-relative runtime import')\n const relative = stripModuleCodeExtension(path.posix.normalize(specifier))\n if (relative.startsWith('../') || !relative.endsWith('.client')) {\n return invalid(`runtime import \"${specifier}\" must resolve to a .client file inside the owning module`)\n }\n const readRuntime = (declarationPath: string) => {\n const owner = path.dirname(declarationPath)\n const runtimeFile = MODULE_CODE_EXTENSIONS\n .map((extension) => path.join(owner, `${relative}${extension}`))\n .find((candidate) => fs.existsSync(candidate))\n if (!runtimeFile) return invalid(`runtime import \"${specifier}\" is missing from the owning module`)\n const filename = fs.realpathSync(runtimeFile)\n const fromOwner = path.relative(fs.realpathSync(owner), filename)\n if (fromOwner === '..' || fromOwner.startsWith(`..${path.sep}`) || path.isAbsolute(fromOwner)) {\n return invalid(`runtime import \"${specifier}\" escapes the owning module`)\n }\n const source = ts.createSourceFile(filename, fs.readFileSync(filename, 'utf8'), ts.ScriptTarget.Latest, true)\n const runtime = exportedDeclaration(source, 'crudFormSectionRuntime')\n if (!runtime) return invalid(`runtime import \"${specifier}\" must export crudFormSectionRuntime`)\n const runtimeValue = unwrap(runtime)\n const literal = ts.isCallExpression(runtimeValue)\n ? helperArgument(runtimeValue,\n ts.isIdentifier(runtimeValue.expression) && runtimeValue.expression.text === 'defineCrudFormFieldGranularSection'\n ? 'defineCrudFormFieldGranularSection' : 'defineCrudFormSectionRuntime', invalid) : runtimeValue\n const actual = readIdentity(fieldsOf(literal, invalid), invalid)\n if (actual.id !== expected.id || actual.roundTripId !== expected.roundTripId) {\n return invalid(`runtime import \"${specifier}\" exports \"${actual.roundTripId}\" but loader declares \"${expected.roundTripId}\"`)\n }\n return source\n }\n const source = readRuntime(declarationSourcePath)\n if (declarationSourcePath !== declaration.absolutePath) readRuntime(declaration.absolutePath)\n const importBase = declaration.importPath.slice(0, declaration.importPath.lastIndexOf('/'))\n return { runtimePath: `${importBase}/${relative}`, source }\n}\n\nfunction importedNamedBinding(source: ts.SourceFile, localName: string): { specifier: string; exported: string } | null {\n for (const statement of source.statements) {\n if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier)\n || statement.importClause?.isTypeOnly) continue\n const names = statement.importClause?.namedBindings\n if (!names || !ts.isNamedImports(names)) continue\n const entry = names.elements.find(({ name, isTypeOnly }) => !isTypeOnly && name.text === localName)\n if (entry) return { specifier: statement.moduleSpecifier.text, exported: (entry.propertyName ?? entry.name).text }\n }\n return null\n}\n\nfunction exportsFactoryBinding(source: ts.SourceFile, factoryName: string, exported: string): boolean {\n const exportedLocals = new Set<string>()\n for (const statement of source.statements) {\n if (!ts.isExportDeclaration(statement) || statement.moduleSpecifier || !statement.exportClause\n || !ts.isNamedExports(statement.exportClause)) continue\n for (const entry of statement.exportClause.elements) {\n if (!entry.isTypeOnly && entry.name.text === exported) exportedLocals.add((entry.propertyName ?? entry.name).text)\n }\n }\n for (const statement of source.statements) {\n if (!ts.isVariableStatement(statement)) continue\n const direct = statement.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)\n const isBound = (local: string) => Boolean(direct && local === exported) || exportedLocals.has(local)\n for (const declaration of statement.declarationList.declarations) {\n if (!declaration.initializer) continue\n const value = unwrap(declaration.initializer)\n if (ts.isIdentifier(declaration.name) && isBound(declaration.name.text)\n && ts.isPropertyAccessExpression(value) && ts.isIdentifier(value.expression)\n && value.expression.text === factoryName && value.name.text === exported) return true\n if (ts.isObjectBindingPattern(declaration.name) && ts.isIdentifier(value) && value.text === factoryName\n && declaration.name.elements.some((entry) => ts.isIdentifier(entry.name) && isBound(entry.name.text)\n && !entry.initializer && (entry.propertyName ?? entry.name).getText() === exported)) return true\n }\n }\n return false\n}\n\nfunction hasIdentityMapper(input: ts.Expression | undefined): boolean {\n if (!input) return true\n const mapper = unwrap(input)\n if (!ts.isArrowFunction(mapper) || mapper.parameters.length !== 1 || ts.isBlock(mapper.body)) return false\n const binding = mapper.parameters[0].name\n if (!ts.isObjectBindingPattern(binding) || binding.elements.length !== 1) return false\n const [entry] = binding.elements\n const body = unwrap(mapper.body)\n return !entry.dotDotDotToken && !entry.initializer && ts.isIdentifier(entry.name)\n && (entry.propertyName ?? entry.name).getText() === 'parsed' && ts.isIdentifier(body) && body.text === entry.name.text\n}\n\nfunction parseDerivedRoutes(\n fields: ReadonlyMap<string, ts.Expression>,\n module: ModuleSource,\n declaration: ResolvedFile,\n source: ts.SourceFile,\n invalid: (reason: string) => never,\n): DerivedRouteDeclaration[] {\n return arrayField(fields, 'derivedHosts', invalid).map((entry, index) => {\n const options = fieldsOf(helperArgument(entry, 'defineCrudRouteSectionHost', invalid), invalid)\n const hostDescriptorId = literalValue(options.get('hostDescriptorId'), 'hostDescriptorId', invalid)\n const formOperation = literalValue(options.get('formOperation'), 'formOperation', invalid)\n if (formOperation !== 'create' && formOperation !== 'update') return invalid('derived host requires create or update')\n if (formOperation === 'create' && options.has('delete')) return invalid('derived create host cannot declare delete')\n const groups = arrayField(options, 'sections', invalid)\n if (!groups.length) return invalid('derived host requires a finite group set')\n for (const group of groups) {\n const writes = literalValue(fieldsOf(group, invalid).get('writes'), 'section writes', invalid)\n if (writes !== 'parent' && writes !== 'none') return invalid('derived host group declares a secondary write')\n }\n const routeNode = options.get('route')\n const binding = routeNode && ts.isIdentifier(routeNode) && importedNamedBinding(source, routeNode.text)\n if (!binding || !/^\\.\\/api(?:\\/[A-Za-z0-9_.[\\]-]+)*\\/route(?:\\.[jt]sx?)?$/.test(binding.specifier)) {\n return invalid('derived host route must import the original named makeCrudRoute result from its module API route')\n }\n const relative = binding.specifier.slice(2)\n const routeFile = module.resolve(relative)\n if (!routeFile || routeFile.fromApp !== declaration.fromApp) return invalid('derived host route is missing or shadowed')\n const mirror = routeFile.fromApp ? null : resolveStandaloneSourceMirrorBase(module.roots.pkgBase)\n const mirrorFile = mirror && MODULE_CODE_EXTENSIONS.map((extension) =>\n path.join(mirror, stripModuleCodeExtension(relative) + extension),\n ).find((candidate) => fs.existsSync(candidate))\n const fileName = mirrorFile || routeFile.absolutePath\n const routeSource = ts.createSourceFile(fileName, fs.readFileSync(fileName, 'utf8'), ts.ScriptTarget.Latest, true)\n const routeInitializer = exportedDeclaration(routeSource, binding.exported)\n const routeCall = routeInitializer && unwrap(routeInitializer)\n const factory = routeCall && ts.isCallExpression(routeCall) && ts.isIdentifier(routeCall.expression)\n && importedNamedBinding(routeSource, routeCall.expression.text)\n if (!routeCall || !ts.isCallExpression(routeCall) || routeCall.arguments.length !== 1\n || !factory || factory.exported !== 'makeCrudRoute'\n || !['@open-mercato/shared/lib/crud/factory', '@open-mercato/shared/lib/crud'].includes(factory.specifier)) {\n return invalid('derived host requires a named original makeCrudRoute declaration')\n }\n const routeDeclaration = routeInitializer?.parent\n if (!routeDeclaration || !ts.isVariableDeclaration(routeDeclaration) || !ts.isIdentifier(routeDeclaration.name)\n || !exportsFactoryBinding(routeSource, routeDeclaration.name.text, 'metadata')) {\n return invalid('derived route metadata must come directly from the named factory result')\n }\n const factoryName = routeDeclaration.name.text\n const factoryOptions = fieldsOf(routeCall.arguments[0], invalid)\n const actionNode = factoryOptions.get('actions')\n const metadataNode = factoryOptions.get('metadata')\n if (!actionNode || !metadataNode) return invalid('derived route requires literal factory actions and method metadata')\n if (factoryOptions.has('resolveIdentifiers')) return invalid('derived route declares custom identifier mapping')\n const hooks = factoryOptions.get('hooks')\n if (hooks && [...fieldsOf(hooks, invalid).keys()].some((key) => /^(before|after)(Create|Update|Delete)$/.test(key))) {\n return invalid('derived route declares custom write hooks')\n }\n const actions = fieldsOf(actionNode, invalid)\n const metadata = fieldsOf(metadataNode, invalid)\n const operations: DerivedRouteDeclaration['operations'] = [formOperation, ...(options.has('delete') ? ['delete' as const] : [])]\n for (const operation of operations) {\n const action = actions.get(operation)\n const method = derivedRouteMethods[operation]\n if (!action || !metadata.has(method) || !exportsFactoryBinding(routeSource, factoryName, method)) {\n return invalid(`derived route has no direct ${method} factory export, command or metadata`)\n }\n const command = fieldsOf(action, invalid)\n if (!hasIdentityMapper(command.get('mapInput')) || command.has('metadata')) {\n return invalid(`derived ${method} route requires direct command input without custom metadata`)\n }\n const commandId = literalValue(command.get('commandId'), 'commandId', invalid)\n if (!commandId.endsWith(`.${operation}`)) return invalid(`derived ${method} route command does not match its operation`)\n const methodMetadata = fieldsOf(metadata.get(method)!, invalid)\n if (methodMetadata.get('requireAuth')?.kind !== ts.SyntaxKind.TrueKeyword\n || methodMetadata.has('requireRoles')) {\n return invalid(`derived ${method} route must require authentication`)\n }\n for (const feature of arrayField(methodMetadata, 'requireFeatures', invalid)) literalValue(feature, 'required feature', invalid)\n }\n const configuredPath = metadata.get('path')\n const basePath = configuredPath ? literalValue(configuredPath, 'route path', invalid)\n : `/${[module.modId, ...relative.split('/').slice(1, -1)].join('/')}`\n if (!/^\\/(?:[A-Za-z0-9_.-]+|\\[[A-Za-z0-9_-]+\\])(?:\\/(?:[A-Za-z0-9_.-]+|\\[[A-Za-z0-9_-]+\\]))*$/.test(basePath)) {\n return invalid('derived route path must be a regular named API path')\n }\n const outboxRetry = options.has('outboxRetry')\n if (outboxRetry && (formOperation !== 'update' || options.get('outboxRetry')?.kind !== ts.SyntaxKind.TrueKeyword)) {\n return invalid('derived outbox retry must literally opt in on an update host')\n }\n const versioned = options.has('expectedVersionField')\n if (versioned) literalValue(options.get('expectedVersionField'), 'expectedVersionField', invalid)\n return { index, routePath: `${basePath}/section-policy`, hostDescriptorId, operations, versioned, outboxRetry }\n })\n}\n\nfunction parseModuleSections(module: ModuleSource, checkRevisions = false): ModuleSections | null {\n const declaration = module.resolve('form-sections.ts')\n if (!declaration) return null\n const mirror = declaration.fromApp ? null : resolveStandaloneSourceMirrorBase(module.roots.pkgBase)\n const sourceFile = mirror && fs.existsSync(path.join(mirror, 'form-sections.ts'))\n ? path.join(mirror, 'form-sections.ts')\n : declaration.absolutePath\n const source = ts.createSourceFile(sourceFile, fs.readFileSync(sourceFile, 'utf8'), ts.ScriptTarget.Latest, true)\n const invalid = (reason: string): never => {\n throw new Error(`[generate] form-sections for \"${module.modId}\" (${sourceFile}): ${reason}`)\n }\n for (const statement of source.statements) {\n if (!ts.isImportDeclaration(statement) || statement.importClause?.isTypeOnly || !ts.isStringLiteralLike(statement.moduleSpecifier)) continue\n const specifier = statement.moduleSpecifier.text\n if (/^(?:react(?:-dom)?|next)(?:\\/|$)/.test(specifier) || /(?:\\.client(?:\\.[jt]sx?)?|\\/page(?:\\.[jt]sx?)?)$/.test(specifier)) {\n invalid(`server declaration statically imports \"${specifier}\"`)\n }\n }\n const initializer = exportedDeclaration(source, 'crudFormSections')\n const extensionExport = exportedDeclaration(source, 'crudFormExtensions')\n if (!initializer && !extensionExport) return invalid('expected a named crudFormSections or crudFormExtensions declaration')\n const moduleBase = path.dirname(sourceFile)\n const extensions = parseSectionExtensionSources(extensionExport, moduleBase, declaration.importPath, invalid)\n const fields = initializer ? fieldsOf(helperArgument(initializer, 'defineCrudFormSections', invalid), invalid) : new Map<string, ts.Expression>()\n\n const derivedRoutes = parseDerivedRoutes(fields, module, declaration, source, invalid)\n const runtimes = new Map<string, { roundTripId: string; runtimePath: string; source: ts.SourceFile }>()\n for (const runtime of arrayField(fields, 'runtimes', invalid)) {\n const properties = fieldsOf(runtime, invalid)\n const { id, roundTripId } = readIdentity(properties, invalid)\n if (runtimes.has(id)) invalid(`duplicate runtime loader id \"${id}\"`)\n runtimes.set(id, { roundTripId, ...readRuntimePath(properties.get('load'), declaration, sourceFile, { id, roundTripId }, invalid) })\n }\n\n const leafDefaultProviderIds = arrayField(fields, 'leafDefaultProviders', invalid).map((entry) => {\n const provider = unwrap(entry)\n if (!ts.isObjectLiteralExpression(provider)) return invalid('expected a leaf default provider object')\n const factProperty = provider.properties.find((property): property is ts.PropertyAssignment =>\n ts.isPropertyAssignment(property) && (ts.isIdentifier(property.name) || ts.isStringLiteralLike(property.name))\n && property.name.text === 'fact')\n if (!factProperty) return invalid('missing literal leaf default provider fact')\n literalData(factProperty.initializer, invalid)\n return readIdentity(fieldsOf(factProperty.initializer, invalid), invalid).id\n }).sort(compareIds)\n const sinkIds = arrayField(fields, 'sinks', invalid).map((entry) => {\n const call = unwrap(entry)\n const isOutboxBuilder = ts.isCallExpression(call) && ts.isIdentifier(call.expression)\n && call.expression.text === 'defineCrudFormSectionOutboxSink'\n const declaration = unwrap(helperArgument(entry, isOutboxBuilder ? 'defineCrudFormSectionOutboxSink' : 'defineCrudFormSectionSink', invalid))\n if (!ts.isObjectLiteralExpression(declaration)) return invalid('expected a sink declaration object')\n const fact = declaration.properties.find((property): property is ts.PropertyAssignment =>\n ts.isPropertyAssignment(property) && (ts.isIdentifier(property.name) || ts.isStringLiteralLike(property.name))\n && property.name.text === 'fact')\n if (!fact) return invalid('missing literal sink fact')\n const properties = fieldsOf(fact.initializer, invalid)\n const { id } = readIdentity(properties, invalid)\n literalData(fact.initializer, invalid)\n if (literalValue(properties.get('ownerModuleId'), 'ownerModuleId', invalid) !== module.modId) {\n return invalid(`sink \"${id}\" must be declared in its owning module`)\n }\n const atomicity = literalValue(properties.get('atomicity'), 'atomicity', invalid)\n const externalDelivery = properties.get('externalDelivery')\n if (atomicity === 'outbox') {\n if (!externalDelivery) return invalid(`outbox sink \"${id}\" requires a literal externalDelivery contract`)\n const external = fieldsOf(externalDelivery, invalid)\n const maxAttempts = external.get('maxAttempts')\n const attempts = maxAttempts && literalData(maxAttempts, invalid)\n const target = literalValue(properties.get('targetEntityId'), 'targetEntityId', invalid)\n const contract = literalValue(external.get('contractId'), 'contractId', invalid)\n if (!contract.startsWith(`${target}@v`) || !/^[1-9][0-9]*$/.test(contract.slice(target.length + 2))) {\n return invalid(`outbox sink \"${id}\" requires contractId \"${target}@v<positive-integer>\"`)\n }\n if (external.size !== 6\n || literalValue(external.get('fencing'), 'fencing', invalid) !== 'remote-monotonic-revision/v1'\n || literalValue(external.get('coalesce'), 'coalesce', invalid) !== 'latest-state'\n || !['none', 'read-only'].includes(literalValue(external.get('preCommitValidation'), 'preCommitValidation', invalid))\n || !literalValue(external.get('integrationId'), 'integrationId', invalid)\n || typeof attempts !== 'number' || !Number.isSafeInteger(attempts) || attempts < 1) {\n return invalid(`outbox sink \"${id}\" requires the remote-monotonic-revision/v1 fencing contract`)\n }\n } else if (!['host-transaction', 'after-commit'].includes(atomicity) || externalDelivery || isOutboxBuilder) {\n return invalid(`invalid atomicity or externalDelivery for sink \"${id}\"`)\n }\n return id\n }).sort(compareIds)\n const descriptors: Descriptor[] = []\n const primitiveContributions: CompilerModule['primitiveContributions'][number][] = []\n const authoredSource = !moduleBase.split(path.sep).includes('node_modules')\n && (declaration.fromApp || !moduleBase.split(path.sep).includes('dist'))\n const revisions: Array<{ id: string; roundTripId: string; sourceHash: string }> = []\n const clientHosts: CrudFormSectionClientHostFact[] = []\n const customFieldSeedEntities = new Map<string, Readonly<Record<string, string>>>()\n const factIds = new Set<string>()\n for (const [kind, field] of factFields) {\n const facts = arrayField(fields, field, invalid)\n for (const [index, fact] of facts.entries()) {\n const properties = fieldsOf(fact, invalid)\n const { id, roundTripId } = readIdentity(properties, invalid)\n if (kind === 'host') {\n const seeds = properties.get('customFieldSeedEntities')\n if (seeds) {\n customFieldSeedEntities.set(id, Object.fromEntries([...fieldsOf(seeds, invalid)].map(([setId, value]) => {\n const entityId = literalValue(value, 'custom-field seed entity', invalid)\n if (!/^[a-z0-9][a-z0-9._-]*$/.test(setId) || !/^[a-z0-9_]+:[a-z0-9_]+$/.test(entityId)) {\n return invalid('customFieldSeedEntities requires literal definition-set and entity ids')\n }\n return [setId, entityId]\n })))\n }\n const hostResourceKind = properties.has('hostResourceKind')\n ? literalValue(properties.get('hostResourceKind'), 'hostResourceKind', invalid)\n : undefined\n const alternatives = arrayField(properties, 'alternatives', invalid).map((entry) => {\n const alternative = fieldsOf(entry, invalid)\n const surface = alternative.get('surface')\n if (!surface) return invalid('missing finite surface alternative')\n const fact = literalData(surface, invalid)\n if (!fact || typeof fact !== 'object' || Array.isArray(fact)) return invalid('expected finite surface facts')\n const derived = derivedRoutes.find(({ hostDescriptorId }) => hostDescriptorId === id)\n if (Object.hasOwn(fact, 'clientMutationSurfaces')) return invalid('client mutation surface projection is generated')\n if ('allowNoopSubmit' in fact && typeof fact.allowNoopSubmit !== 'boolean') return invalid('allowNoopSubmit must be a boolean')\n const authoredIds = (fact as { mutationSurfaceIds?: unknown }).mutationSurfaceIds\n if (!Array.isArray(authoredIds) || authoredIds.some((surfaceId) => typeof surfaceId !== 'string')) {\n return invalid('mutationSurfaceIds must be a literal ID array')\n }\n const rows = derived ? derived.operations.map((operation) => derivedCrudFormSectionClientMutationFact({\n operation, hostDescriptorId: id, route: derived.routePath,\n versioned: derived.versioned, resourceKind: hostResourceKind ?? '',\n })) : arrayField(alternative, 'mutationSurfaces', invalid).map((mutation) => {\n const declaration = fieldsOf(mutation, invalid)\n return Object.fromEntries(Object.keys(crudFormSectionClientMutationFactSchema.shape).flatMap((key) => {\n const value = declaration.get(key)\n return value ? [[key, literalData(value, invalid)]] : []\n }))\n })\n const mutationSurfaceIds = derived ? derived.operations.map((operation) => `${id}.${operation}`) : authoredIds\n const clientMutationSurfaces = parseCrudFormSectionClientMutationFacts(mutationSurfaceIds, rows)\n if (!clientMutationSurfaces || clientMutationSurfaces.some((row) => row.hostResourceKind !== hostResourceKind)) {\n return invalid('mutation surface projection does not match its host alternative')\n }\n return {\n ...fact, mutationSurfaceIds,\n ...(clientMutationSurfaces.length ? { clientMutationSurfaces } : {}),\n }\n })\n if (alternatives.length && !hostResourceKind) return invalid('host alternatives require a hostResourceKind')\n clientHosts.push({ id, roundTripId, hostResourceKind, alternatives: alternatives as unknown as CrudFormSectionClientHostFact['alternatives'] })\n }\n const addressNode = properties.get('address')\n const operationNode = properties.get('operation')\n if (kind === 'contribution' && addressNode && operationNode && ts.isObjectLiteralExpression(unwrap(addressNode))) {\n const operation = unwrap(operationNode)\n const literalAddress = unwrap(addressNode) as ts.ObjectLiteralExpression\n const address = Object.fromEntries(literalAddress.properties.flatMap((property) => {\n if (!ts.isPropertyAssignment(property) || (!ts.isIdentifier(property.name) && !ts.isStringLiteralLike(property.name))) return []\n const value = unwrap(property.initializer)\n return ts.isStringLiteralLike(value) ? [[property.name.text, value.text]] : []\n }))\n const { hostId, formVariant, formOperation, sectionId } = address\n if (hostId && formVariant && sectionId && (formOperation === 'create' || formOperation === 'update')\n && ts.isStringLiteralLike(operation) && (operation.text === 'add' || operation.text === 'replace' || operation.text === 'hide')) {\n primitiveContributions.push({ id, address: { hostId, formVariant, formOperation, sectionId }, operation: operation.text })\n }\n }\n if (factIds.has(id)) invalid(`duplicate fact id \"${id}\"`)\n factIds.add(id)\n const runtime = runtimes.get(id)\n if (!runtime) return invalid(`fact \"${id}\" has no matching runtime loader`)\n if (runtime.roundTripId !== roundTripId) {\n invalid(`fact and runtime roundTripId differ for \"${id}\"`)\n }\n descriptors.push({ id, roundTripId, kind, field, index, runtimePath: runtime.runtimePath })\n if (checkRevisions && authoredSource) {\n revisions.push({ id, roundTripId, sourceHash: hashHandwrittenSectionRuntime(runtime.source, fact, moduleBase) })\n }\n }\n }\n for (const id of runtimes.keys()) {\n if (!factIds.has(id)) invalid(`runtime loader \"${id}\" has no matching fact`)\n }\n return {\n moduleId: module.modId,\n importPath: declaration.importPath,\n hasHandwrittenSections: Boolean(initializer),\n sourceFileName: path.basename(sourceFile),\n sourceBase: moduleBase,\n authoredSource,\n extensionSources: extensions,\n runtimeSources: runtimes,\n customFieldSeedEntities,\n primitiveContributions,\n derivedRoutes,\n clientHosts: clientHosts.sort((left, right) => compareIds(left.id, right.id)),\n contributedOverrides: fields.has('contributedOverrides')\n ? literalData(fields.get('contributedOverrides')!, invalid) as FormSectionOverridesMap\n : {},\n leafDefaultProviderIds,\n sinkIds,\n revisionWrite: planHandwrittenSectionRevisionWrite(moduleBase, revisions, invalid),\n descriptors: descriptors.sort((left, right) => compareIds(left.id, right.id)),\n }\n}\n\nfunction orderedSectionModules(\n sections: ReadonlyMap<string, ModuleSections>,\n identities: readonly ModuleIdentity[],\n requiresByModule: ReadonlyMap<string, readonly string[]>,\n): ModuleSections[] {\n const done = new Set<string>()\n const visiting = new Set<string>()\n const ordered: ModuleSections[] = []\n function visit(moduleId: string): void {\n if (done.has(moduleId)) return\n if (visiting.has(moduleId)) {\n throw new Error(`[generate] Cannot order form-sections through a module dependency cycle at \"${moduleId}\"`)\n }\n visiting.add(moduleId)\n const dependencies = (requiresByModule.get(moduleId) ?? [])\n .map((requirement) => resolveModuleRequirement(requirement, identities))\n .filter((dependency): dependency is string => dependency !== undefined)\n .sort(compareIds)\n for (const dependency of dependencies) visit(dependency)\n visiting.delete(moduleId)\n done.add(moduleId)\n const module = sections.get(moduleId)\n if (module) ordered.push(module)\n }\n const sectionModules = [...sections.values()].sort((left, right) => compareIds(left.importPath, right.importPath))\n for (const module of sectionModules) visit(module.moduleId)\n return ordered\n}\n\nconst generatedHeader = '// Auto-generated by yarn generate. Do not edit.'\nconst injectionPositionTypeImport = \"import type { InjectionPosition } from '@open-mercato/shared/modules/widgets/injection-position'\"\n\nfunction renderSectionOverrides(overrides: Readonly<FormSectionOverridesMap>): string {\n return escapeGeneratedJsonLiteral(JSON.stringify(overrides, null, 2))\n .replace(/^( +\"position\": \"(?:first|last|before|after)\")/gm, '$1 as InjectionPosition')\n}\n\nfunction renderFactRegistry(modules: readonly ModuleSections[], compiled: CompiledSectionExtensions): string {\n const hasGenericSinks = [...compiled.contributionsByModule.values()].some((entries) => entries.some(({ sinks }) =>\n sinks.some(({ fields }) => fields.some(({ field }) => field.store?.kind === 'table' || field.store?.kind === 'external'))))\n const moduleIndexes = new Map(modules.map(({ moduleId }, index) => [moduleId, index]))\n const imports = modules.flatMap(({ importPath, hasHandwrittenSections, extensionSources }, index) => [\n ...(hasHandwrittenSections ? [`import { crudFormSections as sections${index} } from ${JSON.stringify(importPath)}`] : []),\n ...(extensionSources.length ? [`import { crudFormExtensions as extensions${index} } from ${JSON.stringify(importPath)}`] : []),\n ])\n const authoredSection = ({ module, extension, change }: {\n module: CompilerModule; extension: CompilerModule['extensionSources'][number]; change: CompilerModule['extensionSources'][number]['changes'][number]\n }) => `extensions${moduleIndexes.get(module.moduleId)}[${extension.index}].sections[${JSON.stringify(change.id)}]`\n const compiledDeclarations = modules.flatMap(({ moduleId }, index) => {\n const candidates = compiled.contributionsByModule.get(moduleId)\n if (!candidates?.length) return []\n const lines = candidates.map(({ contribution, fields, defaults, sinks }) => {\n const compiledFields = fields.flatMap(({ field, authored, payloadPath }) => {\n if (!payloadPath || (!field.server && !field.rules.some(({ enforce }) => enforce === 'client-and-server'))) return []\n const source = `${authoredSection(authored)}.options.fields[${JSON.stringify(field.id)}].${field.operation === 'add' ? 'definition' : 'patch'}`\n const data = JSON.stringify({ fieldId: field.id, payloadPath, rules: field.rules })\n return [`{ ...${data}${field.server ? `, server: ${source}.validate.server` : ''} }`]\n })\n function fieldStore({ field, authored, payloadPath }: (typeof fields)[number]): string {\n const source = authoredSection(authored)\n if (field.store?.fieldOverride) return `${source}.options.fields[${JSON.stringify(field.id)}].definition.store`\n if (authored.change.operation === 'add' && field.store?.kind !== 'customField') return `${source}.options.store`\n return `{ kind: 'customField', key: ${JSON.stringify(payloadPath?.slice('customFields.'.length))} }`\n }\n const stores = fields.flatMap((item) => {\n const { field, authored, payloadPath, customField } = item\n if (!payloadPath || !field.store) return []\n const data = JSON.stringify({ ownerModuleId: authored.module.moduleId, fieldId: field.id, payloadPath, customField })\n return [`{ ...${data}, store: ${fieldStore(item)} }`]\n })\n const sinkAssociations = sinks.map(({ fields: owned, ...keys }) => {\n const [{ authored }] = owned\n const plan = {\n ...keys, ownerModuleId: authored.module.moduleId, payloadPaths: owned.map(({ payloadPath }) => payloadPath!),\n fields: owned.map(({ field }) => ({\n key: field.id, kind: field.browser.type, required: field.browser.required,\n options: Array.isArray(field.browser.options) ? field.browser.options.map(({ value }) => value) : undefined,\n })),\n }\n const kind = owned[0].field.store?.kind\n const entityProof = kind === 'table' || kind === 'external'\n ? `, entityExports: lookupCompiledOrmExports(${JSON.stringify(authored.module.moduleId)})` : ''\n return `{ ...${JSON.stringify(plan)}, store: ${fieldStore(owned[0])}${entityProof} }`\n })\n const providers = defaults.map(({ owner, id, payloadPath, readsPayloadPaths, scoped }) => {\n const { hostId, formVariant, formOperation } = contribution.address\n const fact = { id, roundTripId: `${id}@v${contribution.roundTripId.split('@v')[1]}`, hostId, formVariant, formOperation, payloadPath, readsPayloadPaths }\n return `{ fact: ${JSON.stringify(fact)}, resolve: extensions${moduleIndexes.get(owner.module.moduleId)}[${owner.extension.index}].defaults[${JSON.stringify(payloadPath)}]${scoped ? \".resolve\" : \"\"} }`\n })\n return ` { contribution: ${JSON.stringify(contribution)}, fieldRules: [${compiledFields.join(', ')}], defaults: [${providers.join(', ')}], stores: [${stores.join(', ')}], sinkAssociations: [${sinkAssociations.join(', ')}] },`\n })\n const overrides = Object.fromEntries(Object.entries(compiled.fallbacks).filter(([, override]) => candidates.some(({ id }) => id === override?.contributionId)))\n return [`const compiled${index} = [`, ...lines, '] as const satisfies readonly CompiledCrudFormContribution[]',\n `const compiledOverrides${index} = ${renderSectionOverrides(overrides)} as const`]\n })\n const entries = modules.flatMap(({ moduleId, descriptors }, index) => [\n ...descriptors.map((descriptor) =>\n ` { kind: ${JSON.stringify(descriptor.kind)}, moduleId: ${JSON.stringify(moduleId)}, fact: sections${index}.${descriptor.field}[${descriptor.index}] },`,\n ),\n ...(compiled.contributionsByModule.get(moduleId) ?? []).map((_, contribution) =>\n ` { kind: \"contribution\", moduleId: ${JSON.stringify(moduleId)}, fact: compiled${index}[${contribution}].contribution },`),\n ])\n return [\n generatedHeader,\n \"import type { CrudFormSectionFactEntry, CrudFormSectionServerModule } from '@open-mercato/shared/modules/form-sections'\",\n ...imports,\n ...(hasGenericSinks ? [\"import { ormEntityExportNamespaces } from './entities.generated'\"] : []),\n ...(compiledDeclarations.length ? [\n \"import { bindCompiledCrudFormAlternatives, bindCompiledCrudFormContributions, type CompiledCrudFormContribution } from '@open-mercato/shared/lib/crud/form-sections/compiled-extensions'\",\n ] : []),\n ...(compiledDeclarations.some((line) => line.includes(' as InjectionPosition')) ? [injectionPositionTypeImport] : []),\n ...(modules.some(({ derivedRoutes }) => derivedRoutes.length)\n ? [\"import { bindDerivedCrudRouteSectionHosts } from '@open-mercato/shared/lib/crud/form-sections/derived-route-host'\"] : []),\n '',\n ...(hasGenericSinks ? [\n \"export { entities as crudFormSectionOrmEntities } from './entities.generated'\",\n 'const lookupCompiledOrmExports = (moduleId: string) => ormEntityExportNamespaces.find((entry) => entry.moduleId === moduleId)?.entities',\n ] : []),\n ...compiledDeclarations,\n 'export const crudFormSectionFactEntries = [',\n ...entries,\n '] as const satisfies readonly CrudFormSectionFactEntry[]',\n '',\n 'export const crudFormSectionServerModules = [',\n ...modules.map(({ moduleId, derivedRoutes, hasHandwrittenSections }, index) => {\n const alternatives = compiled.alternativesByModule.get(moduleId)\n const bindings = derivedRoutes.map((route) => {\n const retrySinks = [...new Set(alternatives?.flatMap((alternative) => alternative.hostDescriptorId === route.hostDescriptorId\n ? alternative.outboxRetrySinkIds ?? [] : []))].sort(compareIds)\n return `{ declaration: sections${index}.derivedHosts[${route.index}], route: ${JSON.stringify(route.routePath)}, outboxRetrySinkIds: ${JSON.stringify(retrySinks)} }`\n })\n const primitive = bindings.length ? `bindDerivedCrudRouteSectionHosts(sections${index}, [${bindings.join(', ')}])`\n : hasHandwrittenSections ? `sections${index}` : '{}'\n const sections = compiled.contributionsByModule.has(moduleId)\n ? `bindCompiledCrudFormContributions(${primitive}, compiled${index}, compiledOverrides${index})` : primitive\n const entry = `{ moduleId: ${JSON.stringify(moduleId)}, sections: ${sections} }`\n return ` ${alternatives?.length ? `bindCompiledCrudFormAlternatives(${entry}, ${JSON.stringify(alternatives)})` : entry},`\n }),\n '] as const satisfies readonly CrudFormSectionServerModule[]',\n '',\n ].join('\\n')\n}\n\nfunction renderRuntimeRegistry(modules: readonly ModuleSections[], compiled: CompiledSectionExtensions): string {\n const overrides = renderSectionOverrides(Object.assign({}, ...modules.map((module) => module.contributedOverrides), compiled.fallbacks))\n const entries = modules.flatMap(({ moduleId, descriptors }) => [\n ...descriptors.map(({ id, roundTripId, kind, runtimePath }) =>\n ` { id: ${stringLiteral(id)}, roundTripId: ${stringLiteral(roundTripId)}, kind: ${stringLiteral(kind)}, moduleId: ${stringLiteral(moduleId)}, load: () => import(${stringLiteral(runtimePath)}) },`,\n ),\n ...(compiled.contributionsByModule.get(moduleId) ?? []).map(({ contribution: { id, roundTripId }, file }) =>\n ` { id: ${stringLiteral(id)}, roundTripId: ${stringLiteral(roundTripId)}, kind: \"contribution\", moduleId: ${stringLiteral(moduleId)}, load: () => import(${stringLiteral('./' + stripModuleCodeExtension(file))}) },`),\n ])\n const versionedSinks = [...compiled.contributionsByModule.values()].flatMap((entries) =>\n entries.flatMap(({ contribution, sinks }) => sinks.flatMap(({ id, fields }) => {\n const first = fields[0]\n const kind = first.field.store?.kind\n const { hostId, formVariant, formOperation } = contribution.address\n return kind === 'table' || kind === 'external'\n ? [{ id, hostId, formVariant, formOperation, kind, ownerModuleId: first.authored.module.moduleId,\n payloadPaths: fields.map(({ payloadPath }) => payloadPath!) }]\n : []\n })))\n return [\n generatedHeader,\n \"import type { CrudFormSectionClientHostFact, CrudFormSectionRuntimeEntry } from '@open-mercato/shared/modules/form-sections'\",\n \"import type { CrudFormSectionClientVersionedSink } from '@open-mercato/shared/lib/crud/form-sections/client-registry'\",\n \"import type { FormSectionOverridesMap } from '@open-mercato/shared/modules/overrides'\",\n ...(overrides.includes(' as InjectionPosition') ? [injectionPositionTypeImport] : []),\n '',\n `export const crudFormSectionClientHostFacts = ${escapeGeneratedJsonLiteral(JSON.stringify(modules.flatMap((module) => module.clientHosts), null, 2))} as const satisfies readonly CrudFormSectionClientHostFact[]`,\n `export const crudFormSectionClientVersionedSinks = ${escapeGeneratedJsonLiteral(JSON.stringify(versionedSinks))} as const satisfies readonly CrudFormSectionClientVersionedSink[]`,\n `export const crudFormSectionContributedOverrides = ${overrides} as const satisfies Readonly<FormSectionOverridesMap>`,\n '',\n 'export const crudFormSectionRuntimeEntries: readonly CrudFormSectionRuntimeEntry[] = [',\n ...entries,\n ']',\n '',\n 'const runtimesById = new Map(crudFormSectionRuntimeEntries.map((entry) => [entry.id, entry]))',\n '',\n 'export function getCrudFormSectionRuntime(id: string): CrudFormSectionRuntimeEntry | undefined {',\n ' return runtimesById.get(id)',\n '}',\n '',\n ].join('\\n')\n}\n\ntype SectionRegistryDiscoveryOptions = {\n modules: readonly ModuleSource[]\n identities: readonly ModuleIdentity[]\n requiresByModule: ReadonlyMap<string, readonly string[]>\n}\n\nexport function prepareCrudFormSectionRegistries(options: SectionRegistryDiscoveryOptions) {\n const sections = new Map<string, ModuleSections>()\n for (const module of options.modules) {\n const declaration = parseModuleSections(module, true)\n if (declaration) sections.set(module.modId, declaration)\n }\n const modules = orderedSectionModules(sections, options.identities, options.requiresByModule)\n const modulesById = new Map<string, string>()\n const defaultModulesById = new Map<string, string>()\n const sinkModulesById = new Map<string, string>()\n for (const module of modules) {\n for (const id of module.sinkIds) {\n const owner = sinkModulesById.get(id)\n if (owner) throw new Error(`[generate] Duplicate CrudForm section sink id \"${id}\" in \"${owner}\" and \"${module.moduleId}\"`)\n sinkModulesById.set(id, module.moduleId)\n }\n for (const id of module.leafDefaultProviderIds) {\n const owner = defaultModulesById.get(id)\n if (owner) {\n throw new Error(`[generate] Duplicate leaf default provider id \"${id}\" in \"${owner}\" and \"${module.moduleId}\"`)\n }\n defaultModulesById.set(id, module.moduleId)\n }\n for (const { id } of module.descriptors) {\n const owner = modulesById.get(id)\n if (owner) {\n throw new Error(`[generate] Duplicate form-sections descriptor id \"${id}\" in \"${owner}\" and \"${module.moduleId}\"`)\n }\n modulesById.set(id, module.moduleId)\n }\n }\n\n const compiled = compileCrudFormSectionExtensions(modules, Object.assign({}, ...options.modules.map(({ formSectionOverrides }) => formSectionOverrides)))\n for (const [moduleId, candidates] of compiled.contributionsByModule) for (const { id } of candidates) {\n const owner = modulesById.get(id)\n if (owner) throw new Error(`[generate] Duplicate form-sections descriptor id \"${id}\" in \"${owner}\" and \"${moduleId}\"`)\n modulesById.set(id, moduleId)\n }\n return { modules, compiled }\n}\n\nexport type CrudFormSectionContributionProjection = {\n id: string\n key: string\n operation: 'add' | 'hide' | 'replace'\n sourceFileName: string\n exportName: 'crudFormSections' | 'crudFormExtensions'\n}\n\nexport function projectCrudFormSectionContributions(\n { modules, compiled }: ReturnType<typeof prepareCrudFormSectionRegistries>,\n): ReadonlyMap<string, readonly CrudFormSectionContributionProjection[]> {\n return new Map(modules.map((module) => {\n const rows: CrudFormSectionContributionProjection[] = []\n for (const { id, address, operation } of module.primitiveContributions) {\n rows.push({ id, key: crudFormSectionOverrideKey(address), operation,\n sourceFileName: module.sourceFileName, exportName: 'crudFormSections' })\n }\n for (const { contribution: { id, address, operation } } of compiled.contributionsByModule.get(module.moduleId) ?? []) {\n rows.push({ id, key: crudFormSectionOverrideKey(address), operation,\n sourceFileName: module.sourceFileName, exportName: 'crudFormExtensions' })\n }\n return [module.moduleId, rows.sort((left, right) => compareIds(left.id, right.id))]\n }))\n}\n\nexport function writeCrudFormSectionRegistries(options: SectionRegistryDiscoveryOptions & {\n outputDir: string\n structureChecksum: string\n result: GeneratorResult\n quiet: boolean\n prepared?: ReturnType<typeof prepareCrudFormSectionRegistries>\n}): void {\n const { modules, compiled } = options.prepared ?? prepareCrudFormSectionRegistries(options)\n const revisions = [...modules.flatMap(({ revisionWrite }) => revisionWrite ? [revisionWrite] : []), ...compiled.revisionWrites]\n for (const revisionWrite of revisions) {\n const temporary = `${revisionWrite.filename}.${randomUUID()}.tmp`\n try {\n fs.writeFileSync(temporary, revisionWrite.content, { flag: 'wx' })\n fs.renameSync(temporary, revisionWrite.filename)\n } finally {\n fs.rmSync(temporary, { force: true })\n }\n options.result.filesWritten.push(revisionWrite.filename)\n }\n const outputs = [\n ['crud-form-section-facts', renderFactRegistry(modules, compiled)],\n ['crud-form-section-runtime', renderRuntimeRegistry(modules, compiled)],\n ...compiled.runtimeFiles.map(({ name, content }) => [name.slice(0, -'.generated.ts'.length), content]),\n ]\n const retainedRuntimeFiles = new Set(compiled.runtimeFiles.map(({ name }) => name))\n if (fs.existsSync(options.outputDir)) for (const filename of fs.readdirSync(options.outputDir)) {\n if (!/^crud-form-section-extension-[0-9a-f]{20}\\.generated\\.(?:checksum|ts)$/.test(filename)\n || retainedRuntimeFiles.has(filename.replace(/\\.checksum$/, '.ts'))) continue\n fs.rmSync(path.join(options.outputDir, filename), { force: true })\n }\n if (!options.quiet) for (const [moduleId, candidates] of compiled.contributionsByModule) {\n for (const candidate of candidates) {\n const owned = candidate.ownership?.payloadPaths.join(', ') || 'none'\n const stores = candidate.fields.filter(({ field }) => field.store).map(({ field }) => `${field.id}/${field.store!.kind}`).join(', ') || 'none'\n console.log(`[generate] CrudForm extension ${moduleId}/${candidate.id} ${candidate.override.operation}; fields: ${candidate.fields.length}, payload leaves: ${owned}, defaults: ${candidate.defaults.length}, stores: ${stores}, field rules: ${candidate.fields.filter(({ field }) => field.server || field.rules.length).length}`)\n }\n }\n for (const [name, content] of outputs) {\n writeGeneratedFile({\n outFile: path.join(options.outputDir, `${name}.generated.ts`),\n checksumFile: path.join(options.outputDir, `${name}.generated.checksum`),\n content,\n structureChecksum: options.structureChecksum,\n result: options.result,\n quiet: options.quiet,\n })\n }\n}\n\nconst derivedRouteFilePattern = /^crud-form-section-route-[a-f0-9]{16}\\.generated\\.ts$/\n\nexport function writeDerivedCrudFormSectionRoutes(\n options: Parameters<typeof writeCrudFormSectionRegistries>[0],\n): GeneratedDerivedCrudRoute[] {\n const routes = new Map<string, {\n moduleId: string\n importPath: string\n entries: DerivedRouteDeclaration[]\n }>()\n for (const module of options.modules) {\n const source = parseModuleSections(module)\n if (!source) continue\n const hostIds = new Set(source.descriptors.filter(({ kind }) => kind === 'host').map(({ id }) => id))\n const bound = new Set<string>()\n for (const entry of source.derivedRoutes) {\n if (!hostIds.has(entry.hostDescriptorId) || bound.has(entry.hostDescriptorId)) {\n throw new Error(`[generate] Derived CrudForm route requires one matching host fact in \"${module.modId}\"`)\n }\n bound.add(entry.hostDescriptorId)\n const existing = routes.get(entry.routePath)\n if (existing && existing.moduleId !== module.modId) {\n throw new Error(`[generate] Duplicate derived CrudForm route \"${entry.routePath}\"`)\n }\n const route = existing ?? { moduleId: module.modId, importPath: source.importPath, entries: [] }\n route.entries.push(entry)\n routes.set(entry.routePath, route)\n }\n }\n\n const generated: GeneratedDerivedCrudRoute[] = []\n function emit(routePath: string, moduleId: string, methods: GeneratedDerivedCrudRoute['methods'], content: string) {\n if (generated.some((route) => route.routePath === routePath)) {\n throw new Error(`[generate] Duplicate derived CrudForm route \"${routePath}\"`)\n }\n const suffix = createHash('sha256').update(`${moduleId}:${routePath}`).digest('hex').slice(0, 16)\n const fileName = `crud-form-section-route-${suffix}.generated.ts`\n generated.push({ moduleId, routePath, fileName, methods })\n writeGeneratedFile({\n outFile: path.join(options.outputDir, fileName),\n checksumFile: path.join(options.outputDir, fileName.replace(/\\.ts$/, '.checksum')),\n content, structureChecksum: options.structureChecksum, result: options.result, quiet: options.quiet,\n })\n }\n for (const [routePath, { moduleId, importPath, entries }] of [...routes].sort(([left], [right]) => compareIds(left, right))) {\n const methods = [...new Set(entries.flatMap(({ operations }) => operations.map((operation) => derivedRouteMethods[operation])))].sort(compareIds)\n const routeImport = `import { crudFormSections } from ${JSON.stringify(importPath)}`\n const declarations = (binding: readonly DerivedRouteDeclaration[]) =>\n `[${binding.map(({ index }) => `crudFormSections.derivedHosts[${index}]`).join(', ')}]`\n const content = [\n generatedHeader,\n \"import { createDerivedCrudFormSectionFacade } from '@open-mercato/shared/lib/crud/form-sections/derived-route-host'\",\n routeImport,\n `const facade = createDerivedCrudFormSectionFacade(${declarations(entries)}, ${JSON.stringify(routePath)}, ${JSON.stringify(methods)})`,\n 'export const metadata = facade.metadata',\n 'export const openApi = facade.openApi',\n ...methods.map((method) => `export const ${method} = facade.handlers.${method}!`),\n '',\n ].join('\\n')\n emit(routePath, moduleId, methods, content)\n const retry = entries.filter(({ outboxRetry }) => outboxRetry)\n if (retry.length) {\n emit(derivedCrudFormSectionRetryPath(routePath), moduleId, ['POST'], [\n generatedHeader,\n \"import { createDerivedCrudFormSectionOutboxRetryRoute } from '@open-mercato/shared/lib/crud/form-sections/derived-route-host'\",\n routeImport,\n `export const { metadata, openApi, POST } = createDerivedCrudFormSectionOutboxRetryRoute(${declarations(retry)}, ${JSON.stringify(routePath)})`,\n '',\n ].join('\\n'))\n }\n }\n\n const indexPath = path.join(options.outputDir, generatedDerivedCrudRouteIndex)\n if (generated.length || fs.existsSync(indexPath)) {\n writeGeneratedFile({\n outFile: indexPath,\n checksumFile: indexPath.replace(/\\.json$/, '.checksum'),\n content: JSON.stringify(generated, null, 2) + '\\n',\n structureChecksum: options.structureChecksum, result: options.result, quiet: options.quiet,\n })\n }\n const current = new Set(generated.map(({ fileName }) => fileName))\n if (fs.existsSync(options.outputDir)) {\n for (const fileName of fs.readdirSync(options.outputDir)) {\n if (!derivedRouteFilePattern.test(fileName) || current.has(fileName)) continue\n fs.rmSync(path.join(options.outputDir, fileName), { force: true })\n fs.rmSync(path.join(options.outputDir, fileName.replace(/\\.ts$/, '.checksum')), { force: true })\n }\n }\n return generated\n}\n\nexport function readDerivedCrudFormSectionRouteIndex(outputDir: string): GeneratedDerivedCrudRoute[] {\n const filePath = path.join(outputDir, generatedDerivedCrudRouteIndex)\n if (!fs.existsSync(filePath)) return []\n const entries: unknown = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n if (!Array.isArray(entries)) throw new Error('[generate] Invalid generated derived route index')\n return entries.map((entry: Partial<GeneratedDerivedCrudRoute>) => {\n if (typeof entry.moduleId !== 'string' || typeof entry.routePath !== 'string' || !/\\/section-policy(?:\\/retry)?$/.test(entry.routePath)\n || typeof entry.fileName !== 'string' || !derivedRouteFilePattern.test(entry.fileName)\n || !Array.isArray(entry.methods) || !entry.methods.every((method) => ['POST', 'PUT', 'DELETE'].includes(method))) {\n throw new Error('[generate] Invalid derived route index entry')\n }\n return { moduleId: entry.moduleId, routePath: entry.routePath, fileName: entry.fileName, methods: entry.methods }\n })\n}\n"],
5
+ "mappings": "AAAA,OAAO,QAAQ;AACf,SAAS,YAAY,kBAAkB;AACvC,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,SAAS,gCAAqD;AAC9D;AAAA,EACE;AAAA,EAAyC,+BAA+B;AAAA,EACxE;AAAA,EAA0C;AAAA,EAAiC;AAAA,OACtE;AACP,SAAS,kCAAkC;AAG3C,SAAS,0BAAgD;AACzD,SAAS,4BAA4B,qBAAqB;AAC1D,SAAS,wCAA6F;AACtG,SAAS,oCAAoC;AAC7C,SAAS,YAAY,qBAAqB,UAAU,gBAAgB,aAAa,cAAc,cAAwC,cAAc;AACrJ,SAAS,+BAA+B,2CAA2C;AACnF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AASP,MAAM,aAAa;AAAA,EACjB,CAAC,QAAQ,WAAW;AAAA,EACpB,CAAC,gBAAgB,mBAAmB;AACtC;AAqCO,MAAM,iCAAiC;AAG9C,SAAS,WAAW,MAAc,OAAuB;AACvD,MAAI,SAAS,MAAO,QAAO;AAC3B,SAAO,OAAO,QAAQ,KAAK;AAC7B;AAEA,SAAS,gBACP,aACA,aACA,uBACA,UACA,SACgD;AAChD,MAAI,CAAC,YAAa,QAAO,QAAQ,wBAAwB;AACzD,QAAM,QAAQ,OAAO,eAAe,aAAa,8BAA8B,OAAO,CAAC;AACvF,MAAI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MAAM,8CAA8C;AAAA,IAChE;AACA,WAAO,EAAE,UAAU,MAAM,UAAU,WAAW,MAAM,WAAW,UAAU,MAAM,UAAU,SAAS,MAAM,QAAQ;AAAA,EAClH,CAAC;AACH;",
6
+ "names": ["source", "declaration", "fact", "entries"]
7
+ }
@@ -10,7 +10,9 @@ import { generateModuleDi } from "./module-di.js";
10
10
  import { generateModulePackageSources } from "./module-package-sources.js";
11
11
  import { generateOpenApi } from "./openapi.js";
12
12
  import { generateWebResearchAdapters } from "./web-research-adapters.js";
13
+ import { generateCacheProviders } from "./cache-providers.js";
13
14
  export {
15
+ generateCacheProviders,
14
16
  generateEntityIds,
15
17
  generateModuleDi,
16
18
  generateModuleEntities,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/generators/index.ts"],
4
- "sourcesContent": ["export { generateEntityIds, type EntityIdsOptions } from './entity-ids'\nexport {\n generateModuleRegistry,\n generateModuleRegistryApp,\n generateModuleRegistryCli,\n generateModuleRegistries,\n type ModuleRegistryOptions,\n} from './module-registry'\nexport { generateModuleEntities, type ModuleEntitiesOptions } from './module-entities'\nexport { generateModuleDi, type ModuleDiOptions } from './module-di'\nexport { generateModulePackageSources, type ModulePackageSourcesOptions } from './module-package-sources'\nexport { generateOpenApi, type GenerateOpenApiOptions } from './openapi'\nexport { generateWebResearchAdapters, type WebResearchAdaptersOptions } from './web-research-adapters'\n"],
5
- "mappings": "AAAA,SAAS,yBAAgD;AACzD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,8BAA0D;AACnE,SAAS,wBAA8C;AACvD,SAAS,oCAAsE;AAC/E,SAAS,uBAAoD;AAC7D,SAAS,mCAAoE;",
4
+ "sourcesContent": ["export { generateEntityIds, type EntityIdsOptions } from './entity-ids'\nexport {\n generateModuleRegistry,\n generateModuleRegistryApp,\n generateModuleRegistryCli,\n generateModuleRegistries,\n type ModuleRegistryOptions,\n} from './module-registry'\nexport { generateModuleEntities, type ModuleEntitiesOptions } from './module-entities'\nexport { generateModuleDi, type ModuleDiOptions } from './module-di'\nexport { generateModulePackageSources, type ModulePackageSourcesOptions } from './module-package-sources'\nexport { generateOpenApi, type GenerateOpenApiOptions } from './openapi'\nexport { generateWebResearchAdapters, type WebResearchAdaptersOptions } from './web-research-adapters'\nexport { generateCacheProviders, type CacheProvidersOptions } from './cache-providers'\n"],
5
+ "mappings": "AAAA,SAAS,yBAAgD;AACzD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,8BAA0D;AACnE,SAAS,wBAA8C;AACvD,SAAS,oCAAsE;AAC/E,SAAS,uBAAoD;AAC7D,SAAS,mCAAoE;AAC7E,SAAS,8BAA0D;",
6
6
  "names": []
7
7
  }
@@ -37,6 +37,9 @@ import {
37
37
  templateLiteral,
38
38
  variableStatement
39
39
  } from "./ast/index.js";
40
+ function namespaceEntityLookup(namespace, name) {
41
+ return propertyAccess(asExpression(identifier(namespace), "Record<string, unknown>"), name);
42
+ }
40
43
  async function generateModuleEntities(options) {
41
44
  const { resolver, quiet = false } = options;
42
45
  const result = createGeneratorResult();
@@ -83,9 +86,10 @@ async function generateModuleEntities(options) {
83
86
  relImport = `${baseImport}/${sub}/${stripModuleCodeExtension(found.file)}`;
84
87
  }
85
88
  imports.push({ name: importName, moduleSpecifier: relImport });
86
- entitySources.push({ importName, moduleId: modId });
87
89
  const entityFilePath = resolveEntitySourceFile(resolver, entry, found, fromApp);
88
- for (const className of parseEntityClassNames(entityFilePath)) {
90
+ const classNames = parseEntityClassNames(entityFilePath);
91
+ entitySources.push({ importName, moduleId: modId, classNames });
92
+ for (const className of classNames) {
89
93
  classNameEntries.push({ className, moduleId: modId, sourcePath: entityFilePath });
90
94
  }
91
95
  }
@@ -189,6 +193,21 @@ async function generateModuleEntities(options) {
189
193
  }
190
194
  ]
191
195
  });
196
+ sourceFile.addVariableStatement({
197
+ declarationKind: VariableDeclarationKind.Const,
198
+ isExported: true,
199
+ declarations: [{
200
+ name: "ormEntityExportNamespaces",
201
+ type: "readonly { moduleId: string; entities: Record<string, unknown> }[]",
202
+ initializer: arrayLiteral(entitySources.map(({ importName, moduleId, classNames }) => objectLiteral([
203
+ { name: "moduleId", value: moduleId },
204
+ { name: "entities", value: objectLiteral(classNames.map((name) => ({
205
+ name,
206
+ value: namespaceEntityLookup(importName, name)
207
+ }))) }
208
+ ])), (writer, entry) => entry(writer))
209
+ }]
210
+ });
192
211
  const output = getSourceText(sourceFile);
193
212
  writeGeneratedFile({
194
213
  outFile,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/generators/module-entities.ts"],
4
- "sourcesContent": ["import { getEnabledModuleIdentities } from '../module-identity'\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { VariableDeclarationKind } from 'ts-morph'\nimport {\n findDuplicateEntityClassNames,\n formatDuplicateEntityClassNamesWarning,\n type EntityClassNameEntry,\n} from '@open-mercato/shared/lib/db/duplicateEntityClassNames'\nimport type { ModuleEntry, PackageResolver } from '../resolver'\nimport { parseEntityClassNames } from './entity-class-declarations'\nimport { MODULE_CODE_EXTENSIONS, stripModuleCodeExtension } from './scanner'\nimport {\n toVar,\n type GeneratorResult,\n createGeneratorResult,\n writeGeneratedFile,\n} from '../utils'\nimport {\n addAutoGeneratedComment,\n addImportSpecs,\n asExpression,\n arrayLiteral,\n arrowFunction,\n binaryExpression,\n callExpression,\n createGeneratedSourceFile,\n expressionStatement,\n getSourceText,\n identifier,\n ifStatement,\n logicalAnd,\n methodCall,\n objectEntries,\n objectLiteral,\n prefixExpression,\n propertyAccess,\n returnStatement,\n spreadExpression,\n templateLiteral,\n variableStatement,\n} from './ast'\n\nexport interface ModuleEntitiesOptions {\n resolver: PackageResolver\n quiet?: boolean\n}\n\nexport async function generateModuleEntities(options: ModuleEntitiesOptions): Promise<GeneratorResult> {\n const { resolver, quiet = false } = options\n const result = createGeneratorResult()\n\n const outputDir = resolver.getOutputDir()\n const outFile = path.join(outputDir, 'entities.generated.ts')\n const checksumFile = path.join(outputDir, 'entities.generated.checksum')\n\n const mods = resolver.loadEnabledModules()\n getEnabledModuleIdentities(resolver, mods)\n const imports: Array<{ name: string; moduleSpecifier: string }> = []\n const entitySources: Array<{ importName: string; moduleId: string }> = []\n const classNameEntries: EntityClassNameEntry[] = []\n let n = 0\n\n for (const entry of mods) {\n const modId = entry.id\n const roots = resolver.getModulePaths(entry)\n const imp = resolver.getModuleImportBase(entry)\n const isAppModule = entry.from === '@app'\n\n // prefer app override data/, fallback to core data/, then legacy db/\n const appData = path.join(roots.appBase, 'data')\n const pkgData = path.join(roots.pkgBase, 'data')\n const appDb = path.join(roots.appBase, 'db')\n const pkgDb = path.join(roots.pkgBase, 'db')\n const bases = [appData, pkgData, appDb, pkgDb]\n const candidates = ['entities.override', 'entities', 'schema']\n\n let found: { base: string; file: string } | null = null\n for (const base of bases) {\n for (const f of candidates) {\n const p = resolveConventionFile(base, f)\n if (p) {\n found = { base, file: path.basename(p) }\n break\n }\n }\n if (found) break\n }\n if (!found) continue\n\n const importName = `E_${toVar(modId)}_${n++}`\n const sub = path.basename(found.base) // 'data' or 'db'\n const fromApp = found.base.startsWith(roots.appBase)\n // For @app modules, use relative path to ensure it works both in Next.js and Node.js CLI context\n // From .mercato/generated/, the relative path to src/modules/ is ../src/modules/\n let relImport: string\n if (isAppModule && fromApp) {\n // From .mercato/generated/, go up two levels (../..) to reach the app root, then into src/modules/\n relImport = `../../src/modules/${modId}/${sub}/${stripModuleCodeExtension(found.file)}`\n } else {\n const baseImport = fromApp ? imp.appBase : imp.pkgBase\n relImport = `${baseImport}/${sub}/${stripModuleCodeExtension(found.file)}`\n }\n imports.push({ name: importName, moduleSpecifier: relImport })\n entitySources.push({ importName, moduleId: modId })\n\n const entityFilePath = resolveEntitySourceFile(resolver, entry, found, fromApp)\n for (const className of parseEntityClassNames(entityFilePath)) {\n classNameEntries.push({ className, moduleId: modId, sourcePath: entityFilePath })\n }\n }\n\n const sourceFile = createGeneratedSourceFile('entities.generated.ts')\n addAutoGeneratedComment(sourceFile, 'entities')\n addImportSpecs(sourceFile, imports.map((entry) => ({\n namespaceImport: entry.name,\n moduleSpecifier: entry.moduleSpecifier,\n })))\n sourceFile.addFunction({\n name: 'enhanceEntities',\n parameters: [\n { name: 'namespace', type: 'Record<string, unknown>' },\n { name: 'moduleId', type: 'string' },\n ],\n returnType: 'any[]',\n statements: [\n returnStatement(\n methodCall(\n methodCall(objectEntries(identifier('namespace')), 'filter', [\n arrowFunction({\n parameters: ['[, value]'],\n body: binaryExpression(\n prefixExpression('typeof ', identifier('value')),\n '===',\n 'function',\n ),\n }),\n ]),\n 'map',\n [\n arrowFunction({\n parameters: ['[exportName, value]'],\n body: (writer) => {\n writer.block(() => {\n variableStatement({\n name: 'entity',\n initializer: asExpression(identifier('value'), '{ entityName?: string }'),\n })(writer)\n writer.newLine()\n ifStatement({\n condition: logicalAnd([\n identifier('entity'),\n binaryExpression(\n prefixExpression('typeof ', identifier('entity')),\n '===',\n 'function',\n ),\n binaryExpression(\n methodCall(\n propertyAccess(\n propertyAccess(identifier('Object'), 'prototype'),\n 'hasOwnProperty',\n ),\n 'call',\n [identifier('entity'), 'entityName'],\n ),\n '===',\n false,\n ),\n ]),\n thenStatements: [\n expressionStatement(\n callExpression(propertyAccess(identifier('Object'), 'defineProperty'), [\n identifier('entity'),\n 'entityName',\n objectLiteral([\n {\n name: 'value',\n value: templateLiteral([\n identifier('moduleId'),\n '.',\n identifier('exportName'),\n ]),\n },\n { name: 'configurable', value: true },\n { name: 'enumerable', value: false },\n { name: 'writable', value: false },\n ]),\n ]),\n ),\n ],\n })(writer)\n writer.newLine()\n returnStatement(identifier('entity'))(writer)\n })\n },\n }),\n ],\n ),\n ),\n ],\n })\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: 'entities',\n initializer: arrayLiteral(entitySources, (writer, entry) =>\n spreadExpression(callExpression(identifier('enhanceEntities'), [identifier(entry.importName), entry.moduleId]))(writer)),\n },\n ],\n })\n const output = getSourceText(sourceFile)\n\n writeGeneratedFile({\n outFile,\n checksumFile,\n content: output,\n structureChecksum: '',\n result,\n quiet,\n })\n\n warnOnDuplicateEntityClassNames(classNameEntries)\n\n return result\n}\n\n/**\n * A duplicate entity class name across modules silently corrupts entity resolution at\n * runtime and no build step otherwise catches it, so surface it here \u2014 where the\n * colliding registry is produced. Reported as a warning; generation still succeeds.\n */\nfunction warnOnDuplicateEntityClassNames(entries: readonly EntityClassNameEntry[]): void {\n try {\n const duplicates = findDuplicateEntityClassNames(entries)\n if (duplicates.length === 0) return\n console.warn(`\\x1b[33m[Entities Warning]\\x1b[0m ${formatDuplicateEntityClassNamesWarning(duplicates)}`)\n } catch {\n // This check is a diagnostic. It must never be the reason generation fails.\n }\n}\n\n/**\n * The file to read class names out of, which is not always the file the runtime imports.\n * A standalone install resolves a package module to its compiled `dist/modules` tree, and\n * published packages ship `src/modules` alongside it \u2014 so prefer the shipped source, the\n * way `eject` already does, and leave the runtime import pointing at `dist`. A package\n * that ships compiled output only falls back to the resolved base, which the parser also\n * understands. An app override wins over the package tree entirely: the registry imports\n * the app file, so that is the file whose class names are registered.\n */\nfunction resolveEntitySourceFile(\n resolver: PackageResolver,\n entry: ModuleEntry,\n found: { base: string; file: string },\n fromApp: boolean,\n): string {\n const resolved = path.join(found.base, found.file)\n const from = entry.from\n if (fromApp || !from || from === '@app') return resolved\n const sourceBase = path.join(resolver.getPackageRoot(from), 'src', 'modules', entry.id, path.basename(found.base))\n if (path.resolve(sourceBase) === path.resolve(found.base)) return resolved\n const sourceFile = resolveConventionFile(sourceBase, stripModuleCodeExtension(found.file))\n return sourceFile ?? resolved\n}\n\nfunction resolveConventionFile(baseDir: string, basename: string): string | null {\n for (const extension of MODULE_CODE_EXTENSIONS) {\n const candidate = path.join(baseDir, `${basename}${extension}`)\n if (fs.existsS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Q;AAAA,EAER;AACF;AAWA,SAAS,wBACP,UACA,OACA,OACA,SACQ;AACR,QAAM,WAAW,KAAK,KAAK,MAAM,MAAM,MAAM,IAAI;AACjD,QAAM,OAAO,MAAM;AACnB,MAAI,WAAW,CAAC,QAAQ,SAAS,OAAQ,QAAO;AAChD,QAAM,aAAa,KAAK,KAAK,SAAS,eAAe,IAAI,GAAG,OAAO,WAAW,MAAM,IAAI,KAAK,SAAS,MAAM,IAAI,CAAC;AACjH,MAAI,KAAK,QAAQ,UAAU,MAAM,KAAK,QAAQ,MAAM,IAAI,EAAG,QAAO;AAClE,QAAM,aAAa,sBAAsB,YAAY,yBAAyB,MAAM,IAAI,CAAC;AACzF,SAAO,cAAc;AACvB;AAEA,SAAS,sBAAsB,SAAiB,UAAiC;AAC/E,aAAW,aAAa,wBAAwB;AAC9C,UAAM,YAAY,KAAK,KAAK,SAAS,GAAG,QAAQ,GAAG,SAAS,EAAE;AAC9D,QAAI,GAAG,WAAW,SAAS,EAAG,QAAO;AAAA,EACvC;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["import { getEnabledModuleIdentities } from '../module-identity'\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { VariableDeclarationKind } from 'ts-morph'\nimport {\n findDuplicateEntityClassNames,\n formatDuplicateEntityClassNamesWarning,\n type EntityClassNameEntry,\n} from '@open-mercato/shared/lib/db/duplicateEntityClassNames'\nimport type { ModuleEntry, PackageResolver } from '../resolver'\nimport { parseEntityClassNames } from './entity-class-declarations'\nimport { MODULE_CODE_EXTENSIONS, stripModuleCodeExtension } from './scanner'\nimport {\n toVar,\n type GeneratorResult,\n createGeneratorResult,\n writeGeneratedFile,\n} from '../utils'\nimport {\n addAutoGeneratedComment,\n addImportSpecs,\n asExpression,\n arrayLiteral,\n arrowFunction,\n binaryExpression,\n callExpression,\n createGeneratedSourceFile,\n expressionStatement,\n getSourceText,\n identifier,\n ifStatement,\n logicalAnd,\n methodCall,\n objectEntries,\n objectLiteral,\n prefixExpression,\n propertyAccess,\n returnStatement,\n spreadExpression,\n templateLiteral,\n variableStatement,\n} from './ast'\n\nfunction namespaceEntityLookup(namespace: string, name: string) {\n return propertyAccess(asExpression(identifier(namespace), 'Record<string, unknown>'), name)\n}\n\nexport interface ModuleEntitiesOptions {\n resolver: PackageResolver\n quiet?: boolean\n}\n\nexport async function generateModuleEntities(options: ModuleEntitiesOptions): Promise<GeneratorResult> {\n const { resolver, quiet = false } = options\n const result = createGeneratorResult()\n\n const outputDir = resolver.getOutputDir()\n const outFile = path.join(outputDir, 'entities.generated.ts')\n const checksumFile = path.join(outputDir, 'entities.generated.checksum')\n\n const mods = resolver.loadEnabledModules()\n getEnabledModuleIdentities(resolver, mods)\n const imports: Array<{ name: string; moduleSpecifier: string }> = []\n const entitySources: Array<{ importName: string; moduleId: string; classNames: string[] }> = []\n const classNameEntries: EntityClassNameEntry[] = []\n let n = 0\n\n for (const entry of mods) {\n const modId = entry.id\n const roots = resolver.getModulePaths(entry)\n const imp = resolver.getModuleImportBase(entry)\n const isAppModule = entry.from === '@app'\n\n // prefer app override data/, fallback to core data/, then legacy db/\n const appData = path.join(roots.appBase, 'data')\n const pkgData = path.join(roots.pkgBase, 'data')\n const appDb = path.join(roots.appBase, 'db')\n const pkgDb = path.join(roots.pkgBase, 'db')\n const bases = [appData, pkgData, appDb, pkgDb]\n const candidates = ['entities.override', 'entities', 'schema']\n\n let found: { base: string; file: string } | null = null\n for (const base of bases) {\n for (const f of candidates) {\n const p = resolveConventionFile(base, f)\n if (p) {\n found = { base, file: path.basename(p) }\n break\n }\n }\n if (found) break\n }\n if (!found) continue\n\n const importName = `E_${toVar(modId)}_${n++}`\n const sub = path.basename(found.base) // 'data' or 'db'\n const fromApp = found.base.startsWith(roots.appBase)\n // For @app modules, use relative path to ensure it works both in Next.js and Node.js CLI context\n // From .mercato/generated/, the relative path to src/modules/ is ../src/modules/\n let relImport: string\n if (isAppModule && fromApp) {\n // From .mercato/generated/, go up two levels (../..) to reach the app root, then into src/modules/\n relImport = `../../src/modules/${modId}/${sub}/${stripModuleCodeExtension(found.file)}`\n } else {\n const baseImport = fromApp ? imp.appBase : imp.pkgBase\n relImport = `${baseImport}/${sub}/${stripModuleCodeExtension(found.file)}`\n }\n imports.push({ name: importName, moduleSpecifier: relImport })\n const entityFilePath = resolveEntitySourceFile(resolver, entry, found, fromApp)\n const classNames = parseEntityClassNames(entityFilePath)\n entitySources.push({ importName, moduleId: modId, classNames })\n for (const className of classNames) {\n classNameEntries.push({ className, moduleId: modId, sourcePath: entityFilePath })\n }\n }\n\n const sourceFile = createGeneratedSourceFile('entities.generated.ts')\n addAutoGeneratedComment(sourceFile, 'entities')\n addImportSpecs(sourceFile, imports.map((entry) => ({\n namespaceImport: entry.name,\n moduleSpecifier: entry.moduleSpecifier,\n })))\n sourceFile.addFunction({\n name: 'enhanceEntities',\n parameters: [\n { name: 'namespace', type: 'Record<string, unknown>' },\n { name: 'moduleId', type: 'string' },\n ],\n returnType: 'any[]',\n statements: [\n returnStatement(\n methodCall(\n methodCall(objectEntries(identifier('namespace')), 'filter', [\n arrowFunction({\n parameters: ['[, value]'],\n body: binaryExpression(\n prefixExpression('typeof ', identifier('value')),\n '===',\n 'function',\n ),\n }),\n ]),\n 'map',\n [\n arrowFunction({\n parameters: ['[exportName, value]'],\n body: (writer) => {\n writer.block(() => {\n variableStatement({\n name: 'entity',\n initializer: asExpression(identifier('value'), '{ entityName?: string }'),\n })(writer)\n writer.newLine()\n ifStatement({\n condition: logicalAnd([\n identifier('entity'),\n binaryExpression(\n prefixExpression('typeof ', identifier('entity')),\n '===',\n 'function',\n ),\n binaryExpression(\n methodCall(\n propertyAccess(\n propertyAccess(identifier('Object'), 'prototype'),\n 'hasOwnProperty',\n ),\n 'call',\n [identifier('entity'), 'entityName'],\n ),\n '===',\n false,\n ),\n ]),\n thenStatements: [\n expressionStatement(\n callExpression(propertyAccess(identifier('Object'), 'defineProperty'), [\n identifier('entity'),\n 'entityName',\n objectLiteral([\n {\n name: 'value',\n value: templateLiteral([\n identifier('moduleId'),\n '.',\n identifier('exportName'),\n ]),\n },\n { name: 'configurable', value: true },\n { name: 'enumerable', value: false },\n { name: 'writable', value: false },\n ]),\n ]),\n ),\n ],\n })(writer)\n writer.newLine()\n returnStatement(identifier('entity'))(writer)\n })\n },\n }),\n ],\n ),\n ),\n ],\n })\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: 'entities',\n initializer: arrayLiteral(entitySources, (writer, entry) =>\n spreadExpression(callExpression(identifier('enhanceEntities'), [identifier(entry.importName), entry.moduleId]))(writer)),\n },\n ],\n })\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [{\n name: 'ormEntityExportNamespaces',\n type: 'readonly { moduleId: string; entities: Record<string, unknown> }[]',\n initializer: arrayLiteral(entitySources.map(({ importName, moduleId, classNames }) => objectLiteral([\n { name: 'moduleId', value: moduleId },\n { name: 'entities', value: objectLiteral(classNames.map((name) => ({\n name, value: namespaceEntityLookup(importName, name),\n }))) },\n ])), (writer, entry) => entry(writer)),\n }],\n })\n const output = getSourceText(sourceFile)\n\n writeGeneratedFile({\n outFile,\n checksumFile,\n content: output,\n structureChecksum: '',\n result,\n quiet,\n })\n\n warnOnDuplicateEntityClassNames(classNameEntries)\n\n return result\n}\n\n/**\n * A duplicate entity class name across modules silently corrupts entity resolution at\n * runtime and no build step otherwise catches it, so surface it here \u2014 where the\n * colliding registry is produced. Reported as a warning; generation still succeeds.\n */\nfunction warnOnDuplicateEntityClassNames(entries: readonly EntityClassNameEntry[]): void {\n try {\n const duplicates = findDuplicateEntityClassNames(entries)\n if (duplicates.length === 0) return\n console.warn(`\\x1b[33m[Entities Warning]\\x1b[0m ${formatDuplicateEntityClassNamesWarning(duplicates)}`)\n } catch {\n // This check is a diagnostic. It must never be the reason generation fails.\n }\n}\n\n/**\n * The file to read class names out of, which is not always the file the runtime imports.\n * A standalone install resolves a package module to its compiled `dist/modules` tree, and\n * published packages ship `src/modules` alongside it \u2014 so prefer the shipped source, the\n * way `eject` already does, and leave the runtime import pointing at `dist`. A package\n * that ships compiled output only falls back to the resolved base, which the parser also\n * understands. An app override wins over the package tree entirely: the registry imports\n * the app file, so that is the file whose class names are registered.\n */\nfunction resolveEntitySourceFile(\n resolver: PackageResolver,\n entry: ModuleEntry,\n found: { base: string; file: string },\n fromApp: boolean,\n): string {\n const resolved = path.join(found.base, found.file)\n const from = entry.from\n if (fromApp || !from || from === '@app') return resolved\n const sourceBase = path.join(resolver.getPackageRoot(from), 'src', 'modules', entry.id, path.basename(found.base))\n if (path.resolve(sourceBase) === path.resolve(found.base)) return resolved\n const sourceFile = resolveConventionFile(sourceBase, stripModuleCodeExtension(found.file))\n return sourceFile ?? resolved\n}\n\nfunction resolveConventionFile(baseDir: string, basename: string): string | null {\n for (const extension of MODULE_CODE_EXTENSIONS) {\n const candidate = path.join(baseDir, `${basename}${extension}`)\n if (fs.existsSync(candidate)) return candidate\n }\n return null\n}\n"],
5
+ "mappings": "AAAA,SAAS,kCAAkC;AAC3C,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,+BAA+B;AACxC;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AAEP,SAAS,6BAA6B;AACtC,SAAS,wBAAwB,gCAAgC;AACjE;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,sBAAsB,WAAmB,MAAc;AAC9D,SAAO,eAAe,aAAa,WAAW,SAAS,GAAG,yBAAyB,GAAG,IAAI;A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EACxG,QAAQ;AAAA,EAER;AACF;AAWA,SAAS,wBACP,UACA,OACA,OACA,SACQ;AACR,QAAM,WAAW,KAAK,KAAK,MAAM,MAAM,MAAM,IAAI;AACjD,QAAM,OAAO,MAAM;AACnB,MAAI,WAAW,CAAC,QAAQ,SAAS,OAAQ,QAAO;AAChD,QAAM,aAAa,KAAK,KAAK,SAAS,eAAe,IAAI,GAAG,OAAO,WAAW,MAAM,IAAI,KAAK,SAAS,MAAM,IAAI,CAAC;AACjH,MAAI,KAAK,QAAQ,UAAU,MAAM,KAAK,QAAQ,MAAM,IAAI,EAAG,QAAO;AAClE,QAAM,aAAa,sBAAsB,YAAY,yBAAyB,MAAM,IAAI,CAAC;AACzF,SAAO,cAAc;AACvB;AAEA,SAAS,sBAAsB,SAAiB,UAAiC;AAC/E,aAAW,aAAa,wBAAwB;AAC9C,UAAM,YAAY,KAAK,KAAK,SAAS,GAAG,QAAQ,GAAG,SAAS,EAAE;AAC9D,QAAI,GAAG,WAAW,SAAS,EAAG,QAAO;AAAA,EACvC;AACA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -109,7 +109,8 @@ const FRAMEWORK_OVERRIDE_HOSTS = [
109
109
  frameworkOverrideHost("acl.features", "disable-replace"),
110
110
  frameworkOverrideHost("di", "disable-replace"),
111
111
  frameworkOverrideHost("encryption.maps", "disable-replace"),
112
- frameworkOverrideHost("nav.groupOrder", "additive")
112
+ frameworkOverrideHost("nav.groupOrder", "additive"),
113
+ frameworkOverrideHost("forms.sections", "disable-replace")
113
114
  ];
114
115
  function allFrameworkHosts() {
115
116
  return [...FRAMEWORK_HOSTS, ...FRAMEWORK_OVERRIDE_HOSTS];