@specverse/engines 4.1.30 → 4.2.1

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 (285) hide show
  1. package/assets/examples/manifests/frontend-only.yaml +3 -6
  2. package/assets/examples/manifests/fullstack-app.yaml +5 -7
  3. package/assets/examples/manifests/fullstack-monorepo.yaml +3 -6
  4. package/assets/templates/default/specs/main.specly +65 -0
  5. package/dist/inference/comprehensive-engine.d.ts.map +1 -1
  6. package/dist/inference/comprehensive-engine.js +3 -19
  7. package/dist/inference/comprehensive-engine.js.map +1 -1
  8. package/dist/inference/core/rule-engine.d.ts +31 -0
  9. package/dist/inference/core/rule-engine.d.ts.map +1 -1
  10. package/dist/inference/core/rule-engine.js +117 -33
  11. package/dist/inference/core/rule-engine.js.map +1 -1
  12. package/dist/inference/core/rule-file-types.d.ts +0 -2
  13. package/dist/inference/core/rule-file-types.d.ts.map +1 -1
  14. package/dist/inference/core/rule-file-types.js +3 -6
  15. package/dist/inference/core/rule-file-types.js.map +1 -1
  16. package/dist/inference/core/rule-loader.d.ts +5 -15
  17. package/dist/inference/core/rule-loader.d.ts.map +1 -1
  18. package/dist/inference/core/rule-loader.js +43 -132
  19. package/dist/inference/core/rule-loader.js.map +1 -1
  20. package/dist/inference/core/types.d.ts +0 -6
  21. package/dist/inference/core/types.d.ts.map +1 -1
  22. package/dist/inference/core/types.js +0 -4
  23. package/dist/inference/core/types.js.map +1 -1
  24. package/dist/inference/logical/generators/component-type-resolver.d.ts +0 -26
  25. package/dist/inference/logical/generators/component-type-resolver.d.ts.map +1 -1
  26. package/dist/inference/logical/generators/component-type-resolver.js +0 -19
  27. package/dist/inference/logical/generators/component-type-resolver.js.map +1 -1
  28. package/dist/inference/logical/generators/specialist-view-expander.d.ts +1 -17
  29. package/dist/inference/logical/generators/specialist-view-expander.d.ts.map +1 -1
  30. package/dist/inference/logical/generators/specialist-view-expander.js +0 -15
  31. package/dist/inference/logical/generators/specialist-view-expander.js.map +1 -1
  32. package/dist/inference/logical/generators/view-generator.d.ts +4 -14
  33. package/dist/inference/logical/generators/view-generator.d.ts.map +1 -1
  34. package/dist/inference/logical/generators/view-generator.js +6 -26
  35. package/dist/inference/logical/generators/view-generator.js.map +1 -1
  36. package/dist/inference/logical/index.d.ts +2 -2
  37. package/dist/inference/logical/index.d.ts.map +1 -1
  38. package/dist/inference/logical/logical-engine.d.ts.map +1 -1
  39. package/dist/inference/logical/logical-engine.js +17 -80
  40. package/dist/inference/logical/logical-engine.js.map +1 -1
  41. package/dist/inference/quint-transpiler.d.ts +5 -3
  42. package/dist/inference/quint-transpiler.d.ts.map +1 -1
  43. package/dist/inference/quint-transpiler.js +11 -6
  44. package/dist/inference/quint-transpiler.js.map +1 -1
  45. package/dist/libs/instance-factories/CURVED-INTERFACE.md +278 -0
  46. package/dist/libs/instance-factories/README.md +73 -0
  47. package/dist/libs/instance-factories/applications/README.md +51 -0
  48. package/dist/libs/instance-factories/applications/generic-app.yaml +52 -0
  49. package/{libs/instance-factories/applications/react-app.yaml → dist/libs/instance-factories/applications/react-app-runtime.yaml} +30 -77
  50. package/dist/libs/instance-factories/applications/react-app-starter.yaml +143 -0
  51. package/dist/libs/instance-factories/applications/templates/react/env-example-generator.js +24 -2
  52. package/dist/libs/instance-factories/applications/templates/react/vite-config-generator.js +54 -33
  53. package/dist/libs/instance-factories/applications/templates/react-starter/README.md +211 -0
  54. package/dist/libs/instance-factories/applications/templates/react-starter/api-types-starter-generator.js +69 -0
  55. package/dist/libs/instance-factories/applications/templates/react-starter/app-tsx-generator.js +110 -0
  56. package/dist/libs/instance-factories/applications/templates/react-starter/belongs-to.js +40 -0
  57. package/dist/libs/instance-factories/applications/templates/react-starter/dashboard-body-composer.js +129 -0
  58. package/dist/libs/instance-factories/applications/templates/react-starter/detail-body-composer.js +80 -0
  59. package/dist/libs/instance-factories/applications/templates/react-starter/form-body-composer.js +217 -0
  60. package/dist/libs/instance-factories/applications/templates/react-starter/helpers-emitter.js +51 -0
  61. package/dist/libs/instance-factories/applications/templates/react-starter/html-to-jsx.js +192 -0
  62. package/dist/libs/instance-factories/applications/templates/react-starter/list-body-composer.js +56 -0
  63. package/dist/libs/instance-factories/applications/templates/react-starter/orchestrator.js +41 -0
  64. package/dist/libs/instance-factories/applications/templates/react-starter/package-json-generator.js +38 -0
  65. package/dist/libs/instance-factories/applications/templates/react-starter/regen-safety.js +89 -0
  66. package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/dashboard.tsx.template +49 -0
  67. package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/detail.tsx.template +96 -0
  68. package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/form.tsx.template +116 -0
  69. package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/list.tsx.template +74 -0
  70. package/dist/libs/instance-factories/applications/templates/react-starter/use-api-hooks-starter-generator.js +95 -0
  71. package/dist/libs/instance-factories/applications/templates/react-starter/view-emitter.js +81 -0
  72. package/dist/libs/instance-factories/applications/templates/react-starter/views-generator.js +66 -0
  73. package/dist/libs/instance-factories/archived/fastify-prisma.yaml +104 -0
  74. package/dist/libs/instance-factories/cli/README.md +43 -0
  75. package/dist/libs/instance-factories/cli/commander-js.yaml +55 -0
  76. package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +63 -12
  77. package/dist/libs/instance-factories/communication/README.md +47 -0
  78. package/dist/libs/instance-factories/communication/event-emitter.yaml +60 -0
  79. package/dist/libs/instance-factories/communication/rabbitmq-events.yaml +87 -0
  80. package/dist/libs/instance-factories/controllers/README.md +42 -0
  81. package/dist/libs/instance-factories/controllers/fastify.yaml +139 -0
  82. package/dist/libs/instance-factories/controllers/templates/fastify/server-generator.js +29 -2
  83. package/dist/libs/instance-factories/infrastructure/README.md +29 -0
  84. package/dist/libs/instance-factories/infrastructure/docker-k8s.yaml +61 -0
  85. package/dist/libs/instance-factories/orms/README.md +54 -0
  86. package/dist/libs/instance-factories/orms/prisma.yaml +89 -0
  87. package/dist/libs/instance-factories/orms/templates/prisma/schema-generator.js +2 -2
  88. package/dist/libs/instance-factories/scaffolding/README.md +49 -0
  89. package/dist/libs/instance-factories/scaffolding/generic-scaffold.yaml +65 -0
  90. package/dist/libs/instance-factories/sdks/README.md +28 -0
  91. package/dist/libs/instance-factories/sdks/python-sdk.yaml +66 -0
  92. package/dist/libs/instance-factories/sdks/typescript-sdk.yaml +59 -0
  93. package/dist/libs/instance-factories/services/README.md +55 -0
  94. package/dist/libs/instance-factories/services/prisma-services.yaml +71 -0
  95. package/dist/libs/instance-factories/storage/README.md +34 -0
  96. package/dist/libs/instance-factories/storage/mongodb.yaml +79 -0
  97. package/dist/libs/instance-factories/storage/postgresql.yaml +75 -0
  98. package/dist/libs/instance-factories/storage/redis.yaml +79 -0
  99. package/dist/libs/instance-factories/testing/README.md +40 -0
  100. package/dist/libs/instance-factories/testing/vitest-tests.yaml +63 -0
  101. package/dist/libs/instance-factories/tools/README.md +70 -0
  102. package/dist/libs/instance-factories/tools/mcp.yaml +36 -0
  103. package/dist/libs/instance-factories/tools/vscode.yaml +35 -0
  104. package/dist/libs/instance-factories/validation/README.md +38 -0
  105. package/dist/libs/instance-factories/validation/zod.yaml +56 -0
  106. package/dist/realize/engines/code-generator.d.ts.map +1 -1
  107. package/dist/realize/engines/code-generator.js +3 -0
  108. package/dist/realize/engines/code-generator.js.map +1 -1
  109. package/dist/realize/index.d.ts.map +1 -1
  110. package/dist/realize/index.js +15 -22
  111. package/dist/realize/index.js.map +1 -1
  112. package/dist/registry/utils/manifest-adapter.d.ts +8 -1
  113. package/dist/registry/utils/manifest-adapter.d.ts.map +1 -1
  114. package/dist/registry/utils/manifest-adapter.js +8 -1
  115. package/dist/registry/utils/manifest-adapter.js.map +1 -1
  116. package/libs/instance-factories/applications/react-app-starter.yaml +143 -0
  117. package/libs/instance-factories/applications/templates/react/env-example-generator.ts +24 -2
  118. package/libs/instance-factories/applications/templates/react/vite-config-generator.ts +54 -33
  119. package/libs/instance-factories/applications/templates/react-starter/README.md +211 -0
  120. package/libs/instance-factories/applications/templates/react-starter/__tests__/dashboard-body-composer.test.ts +153 -0
  121. package/libs/instance-factories/applications/templates/react-starter/__tests__/detail-body-composer.test.ts +146 -0
  122. package/libs/instance-factories/applications/templates/react-starter/__tests__/form-body-composer.test.ts +188 -0
  123. package/libs/instance-factories/applications/templates/react-starter/__tests__/helpers-emitter.test.ts +55 -0
  124. package/libs/instance-factories/applications/templates/react-starter/__tests__/html-to-jsx.test.ts +140 -0
  125. package/libs/instance-factories/applications/templates/react-starter/__tests__/list-body-composer.test.ts +146 -0
  126. package/libs/instance-factories/applications/templates/react-starter/__tests__/orchestrator.test.ts +184 -0
  127. package/libs/instance-factories/applications/templates/react-starter/__tests__/parity-p2-factory-imports.test.ts +116 -0
  128. package/libs/instance-factories/applications/templates/react-starter/__tests__/parity-p3-rendered-output.test.ts +183 -0
  129. package/libs/instance-factories/applications/templates/react-starter/__tests__/regen-safety.test.ts +144 -0
  130. package/libs/instance-factories/applications/templates/react-starter/__tests__/starter-generators.test.ts +114 -0
  131. package/libs/instance-factories/applications/templates/react-starter/__tests__/view-emitter.test.ts +107 -0
  132. package/libs/instance-factories/applications/templates/react-starter/__tests__/views-generator.test.ts +139 -0
  133. package/libs/instance-factories/applications/templates/react-starter/api-types-starter-generator.ts +98 -0
  134. package/libs/instance-factories/applications/templates/react-starter/app-tsx-generator.ts +141 -0
  135. package/libs/instance-factories/applications/templates/react-starter/belongs-to.ts +82 -0
  136. package/libs/instance-factories/applications/templates/react-starter/dashboard-body-composer.ts +189 -0
  137. package/libs/instance-factories/applications/templates/react-starter/detail-body-composer.ts +135 -0
  138. package/libs/instance-factories/applications/templates/react-starter/form-body-composer.ts +383 -0
  139. package/libs/instance-factories/applications/templates/react-starter/helpers-emitter.ts +66 -0
  140. package/libs/instance-factories/applications/templates/react-starter/html-to-jsx.ts +334 -0
  141. package/libs/instance-factories/applications/templates/react-starter/list-body-composer.ts +146 -0
  142. package/libs/instance-factories/applications/templates/react-starter/orchestrator.ts +95 -0
  143. package/libs/instance-factories/applications/templates/react-starter/package-json-generator.ts +57 -0
  144. package/libs/instance-factories/applications/templates/react-starter/regen-safety.ts +157 -0
  145. package/libs/instance-factories/applications/templates/react-starter/skeletons/dashboard.tsx.template +49 -0
  146. package/libs/instance-factories/applications/templates/react-starter/skeletons/detail.tsx.template +96 -0
  147. package/libs/instance-factories/applications/templates/react-starter/skeletons/form.tsx.template +116 -0
  148. package/libs/instance-factories/applications/templates/react-starter/skeletons/list.tsx.template +74 -0
  149. package/libs/instance-factories/applications/templates/react-starter/use-api-hooks-starter-generator.ts +124 -0
  150. package/libs/instance-factories/applications/templates/react-starter/view-emitter.ts +209 -0
  151. package/libs/instance-factories/applications/templates/react-starter/views-generator.ts +137 -0
  152. package/libs/instance-factories/cli/templates/commander/command-generator.ts +63 -12
  153. package/libs/instance-factories/controllers/fastify.yaml +7 -0
  154. package/libs/instance-factories/controllers/templates/fastify/server-generator.ts +36 -2
  155. package/libs/instance-factories/orms/templates/prisma/schema-generator.ts +11 -4
  156. package/package.json +3 -3
  157. package/dist/libs/instance-factories/applications/templates/react/_view-components-source.js +0 -530
  158. package/dist/libs/instance-factories/applications/templates/react/app-tsx-generator.js +0 -73
  159. package/dist/libs/instance-factories/applications/templates/react/field-helpers-generator.js +0 -99
  160. package/dist/libs/instance-factories/applications/templates/react/package-json-generator.js +0 -49
  161. package/dist/libs/instance-factories/applications/templates/react/pattern-adapter-generator.js +0 -156
  162. package/dist/libs/instance-factories/applications/templates/react/react-pattern-adapter.js +0 -935
  163. package/dist/libs/instance-factories/applications/templates/react/relationship-field-generator.js +0 -143
  164. package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.js +0 -646
  165. package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.js +0 -65
  166. package/dist/libs/instance-factories/applications/templates/react/view-dashboard-generator.js +0 -143
  167. package/dist/libs/instance-factories/applications/templates/react/view-detail-generator.js +0 -143
  168. package/dist/libs/instance-factories/applications/templates/react/view-form-generator.js +0 -355
  169. package/dist/libs/instance-factories/applications/templates/react/view-list-generator.js +0 -91
  170. package/dist/libs/instance-factories/applications/templates/react/view-router-generator.js +0 -79
  171. package/dist/libs/instance-factories/views/index.js +0 -48
  172. package/dist/libs/instance-factories/views/templates/react/adapters/antd-adapter.js +0 -742
  173. package/dist/libs/instance-factories/views/templates/react/adapters/mui-adapter.js +0 -824
  174. package/dist/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.js +0 -719
  175. package/dist/libs/instance-factories/views/templates/react/app-generator.js +0 -45
  176. package/dist/libs/instance-factories/views/templates/react/components-generator.js +0 -820
  177. package/dist/libs/instance-factories/views/templates/react/forms-generator.js +0 -275
  178. package/dist/libs/instance-factories/views/templates/react/frontend-package-json-generator.js +0 -46
  179. package/dist/libs/instance-factories/views/templates/react/hooks-generator.js +0 -81
  180. package/dist/libs/instance-factories/views/templates/react/index-css-generator.js +0 -9
  181. package/dist/libs/instance-factories/views/templates/react/index-html-generator.js +0 -23
  182. package/dist/libs/instance-factories/views/templates/react/main-tsx-generator.js +0 -21
  183. package/dist/libs/instance-factories/views/templates/react/react-component-generator.js +0 -299
  184. package/dist/libs/instance-factories/views/templates/react/router-generator.js +0 -136
  185. package/dist/libs/instance-factories/views/templates/react/router-generic-generator.js +0 -107
  186. package/dist/libs/instance-factories/views/templates/react/shared-utils-generator.js +0 -187
  187. package/dist/libs/instance-factories/views/templates/react/spec-json-generator.js +0 -7
  188. package/dist/libs/instance-factories/views/templates/react/types-generator.js +0 -56
  189. package/dist/libs/instance-factories/views/templates/react/views-metadata-generator.js +0 -27
  190. package/dist/libs/instance-factories/views/templates/react/vite-config-generator.js +0 -29
  191. package/dist/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js +0 -261
  192. package/dist/libs/instance-factories/views/templates/shared/adapter-types.js +0 -34
  193. package/dist/libs/instance-factories/views/templates/shared/atomic-components-registry.js +0 -800
  194. package/dist/libs/instance-factories/views/templates/shared/base-generator.js +0 -305
  195. package/dist/libs/instance-factories/views/templates/shared/component-metadata.js +0 -517
  196. package/dist/libs/instance-factories/views/templates/shared/composite-pattern-types.js +0 -0
  197. package/dist/libs/instance-factories/views/templates/shared/composite-patterns.js +0 -445
  198. package/dist/libs/instance-factories/views/templates/shared/index.js +0 -80
  199. package/dist/libs/instance-factories/views/templates/shared/pattern-validator.js +0 -210
  200. package/dist/libs/instance-factories/views/templates/shared/property-mapper.js +0 -492
  201. package/dist/libs/instance-factories/views/templates/shared/syntax-mapper.js +0 -321
  202. package/dist/realize/index.js.bak +0 -758
  203. package/libs/instance-factories/applications/templates/react/_view-components-source.ts +0 -555
  204. package/libs/instance-factories/applications/templates/react/app-tsx-generator.ts +0 -94
  205. package/libs/instance-factories/applications/templates/react/field-helpers-generator.ts +0 -106
  206. package/libs/instance-factories/applications/templates/react/package-json-generator.ts +0 -57
  207. package/libs/instance-factories/applications/templates/react/pattern-adapter-generator.ts +0 -179
  208. package/libs/instance-factories/applications/templates/react/react-pattern-adapter.tsx +0 -1347
  209. package/libs/instance-factories/applications/templates/react/relationship-field-generator.ts +0 -150
  210. package/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.ts +0 -704
  211. package/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.ts +0 -84
  212. package/libs/instance-factories/applications/templates/react/view-dashboard-generator.ts +0 -150
  213. package/libs/instance-factories/applications/templates/react/view-detail-generator.ts +0 -150
  214. package/libs/instance-factories/applications/templates/react/view-form-generator.ts +0 -362
  215. package/libs/instance-factories/applications/templates/react/view-list-generator.ts +0 -98
  216. package/libs/instance-factories/applications/templates/react/view-router-generator.ts +0 -89
  217. package/libs/instance-factories/views/README.md +0 -62
  218. package/libs/instance-factories/views/index.d.ts +0 -13
  219. package/libs/instance-factories/views/index.d.ts.map +0 -1
  220. package/libs/instance-factories/views/index.js +0 -18
  221. package/libs/instance-factories/views/index.js.map +0 -1
  222. package/libs/instance-factories/views/index.ts +0 -45
  223. package/libs/instance-factories/views/react-components.yaml +0 -129
  224. package/libs/instance-factories/views/templates/ARCHITECTURE.md +0 -198
  225. package/libs/instance-factories/views/templates/react/adapters/antd-adapter.ts +0 -869
  226. package/libs/instance-factories/views/templates/react/adapters/mui-adapter.ts +0 -953
  227. package/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.ts +0 -806
  228. package/libs/instance-factories/views/templates/react/app-generator.ts +0 -55
  229. package/libs/instance-factories/views/templates/react/components-generator.ts +0 -938
  230. package/libs/instance-factories/views/templates/react/forms-generator.ts +0 -325
  231. package/libs/instance-factories/views/templates/react/frontend-package-json-generator.ts +0 -57
  232. package/libs/instance-factories/views/templates/react/hooks-generator.ts +0 -106
  233. package/libs/instance-factories/views/templates/react/index-css-generator.ts +0 -14
  234. package/libs/instance-factories/views/templates/react/index-html-generator.ts +0 -34
  235. package/libs/instance-factories/views/templates/react/main-tsx-generator.ts +0 -29
  236. package/libs/instance-factories/views/templates/react/react-component-generator.d.ts +0 -152
  237. package/libs/instance-factories/views/templates/react/react-component-generator.d.ts.map +0 -1
  238. package/libs/instance-factories/views/templates/react/react-component-generator.js +0 -398
  239. package/libs/instance-factories/views/templates/react/react-component-generator.js.map +0 -1
  240. package/libs/instance-factories/views/templates/react/react-component-generator.ts +0 -533
  241. package/libs/instance-factories/views/templates/react/router-generator.ts +0 -197
  242. package/libs/instance-factories/views/templates/react/router-generic-generator.ts +0 -132
  243. package/libs/instance-factories/views/templates/react/shared-utils-generator.ts +0 -196
  244. package/libs/instance-factories/views/templates/react/spec-json-generator.ts +0 -17
  245. package/libs/instance-factories/views/templates/react/types-generator.ts +0 -76
  246. package/libs/instance-factories/views/templates/react/views-metadata-generator.ts +0 -42
  247. package/libs/instance-factories/views/templates/react/vite-config-generator.ts +0 -38
  248. package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.d.ts.map +0 -1
  249. package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js.map +0 -1
  250. package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.ts +0 -474
  251. package/libs/instance-factories/views/templates/shared/__tests__/composite-patterns.test.ts +0 -242
  252. package/libs/instance-factories/views/templates/shared/adapter-types.d.ts +0 -77
  253. package/libs/instance-factories/views/templates/shared/adapter-types.d.ts.map +0 -1
  254. package/libs/instance-factories/views/templates/shared/adapter-types.js +0 -47
  255. package/libs/instance-factories/views/templates/shared/adapter-types.js.map +0 -1
  256. package/libs/instance-factories/views/templates/shared/adapter-types.ts +0 -142
  257. package/libs/instance-factories/views/templates/shared/atomic-components-registry.d.ts +0 -63
  258. package/libs/instance-factories/views/templates/shared/atomic-components-registry.d.ts.map +0 -1
  259. package/libs/instance-factories/views/templates/shared/atomic-components-registry.js +0 -822
  260. package/libs/instance-factories/views/templates/shared/atomic-components-registry.js.map +0 -1
  261. package/libs/instance-factories/views/templates/shared/atomic-components-registry.ts +0 -908
  262. package/libs/instance-factories/views/templates/shared/base-generator.d.ts +0 -247
  263. package/libs/instance-factories/views/templates/shared/base-generator.d.ts.map +0 -1
  264. package/libs/instance-factories/views/templates/shared/base-generator.js +0 -363
  265. package/libs/instance-factories/views/templates/shared/base-generator.js.map +0 -1
  266. package/libs/instance-factories/views/templates/shared/base-generator.ts +0 -608
  267. package/libs/instance-factories/views/templates/shared/component-metadata.d.ts +0 -254
  268. package/libs/instance-factories/views/templates/shared/component-metadata.d.ts.map +0 -1
  269. package/libs/instance-factories/views/templates/shared/component-metadata.js +0 -602
  270. package/libs/instance-factories/views/templates/shared/component-metadata.js.map +0 -1
  271. package/libs/instance-factories/views/templates/shared/component-metadata.ts +0 -803
  272. package/libs/instance-factories/views/templates/shared/composite-pattern-types.ts +0 -250
  273. package/libs/instance-factories/views/templates/shared/composite-patterns.ts +0 -535
  274. package/libs/instance-factories/views/templates/shared/index.ts +0 -68
  275. package/libs/instance-factories/views/templates/shared/pattern-validator.ts +0 -279
  276. package/libs/instance-factories/views/templates/shared/property-mapper.d.ts +0 -149
  277. package/libs/instance-factories/views/templates/shared/property-mapper.d.ts.map +0 -1
  278. package/libs/instance-factories/views/templates/shared/property-mapper.js +0 -580
  279. package/libs/instance-factories/views/templates/shared/property-mapper.js.map +0 -1
  280. package/libs/instance-factories/views/templates/shared/property-mapper.ts +0 -700
  281. package/libs/instance-factories/views/templates/shared/syntax-mapper.d.ts +0 -143
  282. package/libs/instance-factories/views/templates/shared/syntax-mapper.d.ts.map +0 -1
  283. package/libs/instance-factories/views/templates/shared/syntax-mapper.js +0 -420
  284. package/libs/instance-factories/views/templates/shared/syntax-mapper.js.map +0 -1
  285. package/libs/instance-factories/views/templates/shared/syntax-mapper.ts +0 -539
@@ -1,608 +0,0 @@
1
- /**
2
- * Base Generator - Abstract Class for Framework Generators
3
- *
4
- * Provides shared functionality for React, Vue, Svelte, Angular, and Runtime generators.
5
- * Enforces architectural constraints (nesting depth, state management) while allowing
6
- * framework-specific implementation details.
7
- *
8
- * Architecture:
9
- * - Shared: Component tree rendering, property mapping, nesting enforcement
10
- * - Abstract: Syntax generation, file structure, imports (framework-specific)
11
- * - Constraints: MAX_DEPTH = 3, basic state only, common properties only
12
- */
13
-
14
- import { mapProperties, PropertyTarget } from './property-mapper.js';
15
- import { getSyntaxPattern, FrameworkTarget } from './syntax-mapper.js';
16
- import { ATOMIC_COMPONENTS_REGISTRY, AtomicComponentDefinition } from './atomic-components-registry.js';
17
- import type { ComponentAdapter } from './adapter-types.js';
18
-
19
- // ============================================================================
20
- // Types
21
- // ============================================================================
22
-
23
- /**
24
- * UI Component specification from SpecVerse view definition
25
- */
26
- export interface UIComponent {
27
- type: string;
28
- properties?: Record<string, any>;
29
- children?: UIComponent[];
30
- dataSource?: string; // Model array for lists
31
- condition?: string; // Conditional rendering expression
32
- }
33
-
34
- /**
35
- * View specification from SpecVerse
36
- */
37
- export interface ViewSpec {
38
- name: string;
39
- description?: string;
40
- components: Record<string, UIComponent>;
41
- state?: Record<string, StateDefinition>;
42
- events?: Record<string, EventDefinition>;
43
- }
44
-
45
- /**
46
- * State variable definition
47
- */
48
- export interface StateDefinition {
49
- type: string;
50
- initial: any;
51
- description?: string;
52
- }
53
-
54
- /**
55
- * Event handler definition
56
- */
57
- export interface EventDefinition {
58
- params?: string;
59
- body: string;
60
- description?: string;
61
- }
62
-
63
- /**
64
- * Component rendering context
65
- */
66
- export interface RenderContext {
67
- depth: number;
68
- path: string[];
69
- parentComponent?: string;
70
- dataContext?: string; // Current data variable (for loops)
71
- }
72
-
73
- /**
74
- * Generation result
75
- */
76
- export interface GenerationResult {
77
- code: string;
78
- imports: string[];
79
- warnings: string[];
80
- }
81
-
82
- /**
83
- * Generator configuration
84
- */
85
- export interface GeneratorConfig {
86
- target: PropertyTarget;
87
- framework: FrameworkTarget;
88
- maxDepth?: number;
89
- enableWarnings?: boolean;
90
- }
91
-
92
- // ============================================================================
93
- // Base Generator Abstract Class
94
- // ============================================================================
95
-
96
- /**
97
- * Base generator for all framework implementations
98
- *
99
- * Provides shared logic for:
100
- * - Component tree rendering with depth enforcement
101
- * - Property mapping via property-mapper
102
- * - Nesting validation and flattening
103
- * - State and event management
104
- *
105
- * Framework-specific subclasses must implement:
106
- * - generateImports(): Framework-specific import statements
107
- * - generateComponent(): Framework-specific component structure
108
- * - generateState(): Framework-specific state declarations
109
- * - generateEvents(): Framework-specific event handlers
110
- */
111
- export abstract class BaseComponentGenerator {
112
- // Configuration
113
- protected readonly config: GeneratorConfig;
114
- protected readonly adapter: ComponentAdapter;
115
-
116
- // Architectural constraints
117
- protected readonly MAX_DEPTH: number;
118
- protected readonly ENABLE_WARNINGS: boolean;
119
-
120
- // Tracking
121
- protected warnings: string[] = [];
122
- protected imports: Set<string> = new Set();
123
-
124
- constructor(adapter: ComponentAdapter, config: GeneratorConfig) {
125
- this.adapter = adapter;
126
- this.config = config;
127
- this.MAX_DEPTH = config.maxDepth ?? 3;
128
- this.ENABLE_WARNINGS = config.enableWarnings ?? true;
129
- }
130
-
131
- // ============================================================================
132
- // Public API
133
- // ============================================================================
134
-
135
- /**
136
- * Generate code for a complete view specification
137
- *
138
- * @param viewSpec - View specification from SpecVerse
139
- * @returns Generation result with code, imports, and warnings
140
- */
141
- public generate(viewSpec: ViewSpec): GenerationResult {
142
- this.reset();
143
-
144
- // Generate imports
145
- const importStatements = this.generateImports(viewSpec);
146
-
147
- // Generate state declarations
148
- const stateCode = viewSpec.state
149
- ? this.generateState(viewSpec.state)
150
- : '';
151
-
152
- // Generate event handlers
153
- const eventsCode = viewSpec.events
154
- ? this.generateEvents(viewSpec.events)
155
- : '';
156
-
157
- // Generate component tree
158
- const componentsCode = this.generateComponentTree(viewSpec.components);
159
-
160
- // Generate complete component
161
- const code = this.generateComponent({
162
- name: viewSpec.name,
163
- imports: importStatements,
164
- state: stateCode,
165
- events: eventsCode,
166
- components: componentsCode
167
- });
168
-
169
- return {
170
- code,
171
- imports: Array.from(this.imports),
172
- warnings: this.warnings
173
- };
174
- }
175
-
176
- // ============================================================================
177
- // Shared Component Rendering (Framework-Agnostic)
178
- // ============================================================================
179
-
180
- /**
181
- * Render all components in the view
182
- */
183
- protected generateComponentTree(components: Record<string, UIComponent>): string {
184
- const rendered = Object.entries(components).map(([name, component]) => {
185
- return this.renderComponent(component, {
186
- depth: 0,
187
- path: [name],
188
- dataContext: undefined
189
- });
190
- });
191
-
192
- return rendered.join('\n\n');
193
- }
194
-
195
- /**
196
- * Render a single component with depth tracking and nesting enforcement
197
- *
198
- * This is the core shared logic - applies to ALL frameworks
199
- */
200
- protected renderComponent(
201
- component: UIComponent,
202
- context: RenderContext
203
- ): string {
204
- // Depth enforcement
205
- if (context.depth > this.MAX_DEPTH) {
206
- this.addWarning(
207
- `Component at path ${context.path.join('.')} exceeds max depth (${this.MAX_DEPTH}). ` +
208
- `Flattening to maintain readability.`
209
- );
210
- return this.renderFlattened(component, context);
211
- }
212
-
213
- // Get component definition from registry
214
- const componentDef = ATOMIC_COMPONENTS_REGISTRY[component.type];
215
- if (!componentDef) {
216
- this.addWarning(`Unknown component type: ${component.type}`);
217
- return `<!-- Unknown component: ${component.type} -->`;
218
- }
219
-
220
- // Map properties to target framework
221
- const mappedProps = this.mapComponentProperties(component, componentDef);
222
-
223
- // Handle conditional rendering
224
- if (component.condition) {
225
- return this.renderConditional(component, mappedProps, context);
226
- }
227
-
228
- // Handle list rendering (dataSource)
229
- if (component.dataSource) {
230
- return this.renderList(component, mappedProps, context);
231
- }
232
-
233
- // Handle children
234
- const children = component.children
235
- ? this.renderChildren(component.children, context)
236
- : undefined;
237
-
238
- // Delegate to adapter for framework-specific rendering
239
- return this.renderAdapterComponent(
240
- component.type,
241
- mappedProps,
242
- children,
243
- context
244
- );
245
- }
246
-
247
- /**
248
- * Map component properties using property-mapper
249
- */
250
- protected mapComponentProperties(
251
- component: UIComponent,
252
- componentDef: AtomicComponentDefinition
253
- ): Record<string, any> {
254
- if (!component.properties) {
255
- return {};
256
- }
257
-
258
- return mapProperties(
259
- component.type,
260
- component.properties,
261
- this.config.target
262
- );
263
- }
264
-
265
- /**
266
- * Render child components with incremented depth
267
- */
268
- protected renderChildren(
269
- children: UIComponent[],
270
- parentContext: RenderContext
271
- ): string {
272
- const childContext: RenderContext = {
273
- ...parentContext,
274
- depth: parentContext.depth + 1
275
- };
276
-
277
- return children
278
- .map((child, index) => {
279
- const childPath = [...parentContext.path, `child_${index}`];
280
- return this.renderComponent(child, {
281
- ...childContext,
282
- path: childPath
283
- });
284
- })
285
- .join('\n');
286
- }
287
-
288
- /**
289
- * Render conditional component using syntax-mapper
290
- */
291
- protected renderConditional(
292
- component: UIComponent,
293
- mappedProps: Record<string, any>,
294
- context: RenderContext
295
- ): string {
296
- const innerComponent = this.renderAdapterComponent(
297
- component.type,
298
- mappedProps,
299
- component.children
300
- ? this.renderChildren(component.children, context)
301
- : undefined,
302
- context
303
- );
304
-
305
- // Use syntax-mapper for framework-specific conditional syntax
306
- return getSyntaxPattern('conditionalRender', this.config.framework, {
307
- condition: component.condition,
308
- Component: this.getComponentName(component.type),
309
- props: this.formatProps(mappedProps)
310
- });
311
- }
312
-
313
- /**
314
- * Render list (loop) component using syntax-mapper
315
- */
316
- protected renderList(
317
- component: UIComponent,
318
- mappedProps: Record<string, any>,
319
- context: RenderContext
320
- ): string {
321
- const itemName = this.getItemName(component.dataSource!);
322
- const keyProperty = this.getKeyProperty(component);
323
-
324
- // Create child context with data variable
325
- const childContext: RenderContext = {
326
- ...context,
327
- depth: context.depth + 1,
328
- dataContext: itemName
329
- };
330
-
331
- // Use syntax-mapper for framework-specific loop syntax
332
- return getSyntaxPattern('loopRender', this.config.framework, {
333
- array: component.dataSource,
334
- item: itemName,
335
- key: keyProperty,
336
- Component: this.getComponentName(component.type)
337
- });
338
- }
339
-
340
- /**
341
- * Flatten component when depth exceeded
342
- *
343
- * Extracts nested children into sibling components to reduce nesting
344
- */
345
- protected renderFlattened(
346
- component: UIComponent,
347
- context: RenderContext
348
- ): string {
349
- // Render component without children
350
- const componentDef = ATOMIC_COMPONENTS_REGISTRY[component.type];
351
- const mappedProps = this.mapComponentProperties(component, componentDef);
352
-
353
- const flatComponent = this.renderAdapterComponent(
354
- component.type,
355
- mappedProps,
356
- undefined, // No children
357
- context
358
- );
359
-
360
- // Render children as siblings (extracted)
361
- const flattenedChildren = component.children
362
- ? component.children.map((child, index) => {
363
- return this.renderComponent(child, {
364
- depth: context.depth, // Same depth (sibling)
365
- path: [...context.path, `flattened_${index}`]
366
- });
367
- }).join('\n')
368
- : '';
369
-
370
- return flatComponent + '\n' + flattenedChildren;
371
- }
372
-
373
- /**
374
- * Delegate to adapter for actual component rendering
375
- */
376
- protected renderAdapterComponent(
377
- type: string,
378
- properties: Record<string, any>,
379
- children: string | undefined,
380
- context: RenderContext
381
- ): string {
382
- const adapterComponent = this.adapter.components[type];
383
- if (!adapterComponent) {
384
- this.addWarning(`Adapter missing component: ${type}`);
385
- return `<!-- Missing adapter for: ${type} -->`;
386
- }
387
-
388
- return adapterComponent.render({
389
- properties,
390
- children
391
- });
392
- }
393
-
394
- // ============================================================================
395
- // Helper Methods
396
- // ============================================================================
397
-
398
- /**
399
- * Get component name for import/usage
400
- */
401
- protected getComponentName(type: string): string {
402
- const componentDef = ATOMIC_COMPONENTS_REGISTRY[type];
403
- return componentDef?.name || type.charAt(0).toUpperCase() + type.slice(1);
404
- }
405
-
406
- /**
407
- * Get item variable name for loop rendering
408
- */
409
- protected getItemName(dataSource: string): string {
410
- // Convert "users" -> "user", "items" -> "item"
411
- if (dataSource.endsWith('s')) {
412
- return dataSource.slice(0, -1);
413
- }
414
- return dataSource + 'Item';
415
- }
416
-
417
- /**
418
- * Get key property for list items
419
- */
420
- protected getKeyProperty(component: UIComponent): string {
421
- return component.properties?.keyProperty || 'id';
422
- }
423
-
424
- /**
425
- * Format properties for inline rendering
426
- */
427
- protected formatProps(properties: Record<string, any>): string {
428
- return Object.entries(properties)
429
- .map(([key, value]) => {
430
- if (typeof value === 'string') {
431
- return `${key}="${value}"`;
432
- }
433
- return `${key}={${JSON.stringify(value)}}`;
434
- })
435
- .join(' ');
436
- }
437
-
438
- /**
439
- * Add warning message
440
- */
441
- protected addWarning(message: string): void {
442
- if (this.ENABLE_WARNINGS) {
443
- this.warnings.push(message);
444
- }
445
- }
446
-
447
- /**
448
- * Reset generator state for new generation
449
- */
450
- protected reset(): void {
451
- this.warnings = [];
452
- this.imports = new Set();
453
- }
454
-
455
- /**
456
- * Add import statement
457
- */
458
- protected addImport(importStatement: string): void {
459
- this.imports.add(importStatement);
460
- }
461
-
462
- // ============================================================================
463
- // Abstract Methods (Framework-Specific)
464
- // ============================================================================
465
-
466
- /**
467
- * Generate import statements for the framework
468
- *
469
- * @param viewSpec - View specification
470
- * @returns Import statements code
471
- */
472
- protected abstract generateImports(viewSpec: ViewSpec): string;
473
-
474
- /**
475
- * Generate complete component code with framework-specific structure
476
- *
477
- * @param parts - Component parts (imports, state, events, components)
478
- * @returns Complete component code
479
- */
480
- protected abstract generateComponent(parts: {
481
- name: string;
482
- imports: string;
483
- state: string;
484
- events: string;
485
- components: string;
486
- }): string;
487
-
488
- /**
489
- * Generate state declarations using framework-specific syntax
490
- *
491
- * @param state - State definitions
492
- * @returns State declaration code
493
- */
494
- protected abstract generateState(state: Record<string, StateDefinition>): string;
495
-
496
- /**
497
- * Generate event handlers using framework-specific syntax
498
- *
499
- * @param events - Event definitions
500
- * @returns Event handler code
501
- */
502
- protected abstract generateEvents(events: Record<string, EventDefinition>): string;
503
-
504
- /**
505
- * Get file extension for the framework
506
- *
507
- * @returns File extension (e.g., '.tsx', '.vue', '.svelte')
508
- */
509
- public abstract getFileExtension(): string;
510
-
511
- /**
512
- * Get additional files that need to be generated (e.g., CSS, types)
513
- *
514
- * @param viewSpec - View specification
515
- * @returns Map of filename to content
516
- */
517
- public abstract getAdditionalFiles(viewSpec: ViewSpec): Record<string, string>;
518
- }
519
-
520
- // ============================================================================
521
- // Utility Functions
522
- // ============================================================================
523
-
524
- /**
525
- * Validate component nesting depth
526
- *
527
- * @param component - Component to validate
528
- * @param maxDepth - Maximum allowed depth
529
- * @returns Validation result with depth and issues
530
- */
531
- export function validateNestingDepth(
532
- component: UIComponent,
533
- maxDepth: number = 3
534
- ): { valid: boolean; actualDepth: number; issues: string[] } {
535
- const issues: string[] = [];
536
-
537
- function calculateDepth(comp: UIComponent, currentDepth: number): number {
538
- if (!comp.children || comp.children.length === 0) {
539
- return currentDepth;
540
- }
541
-
542
- const childDepths = comp.children.map(child =>
543
- calculateDepth(child, currentDepth + 1)
544
- );
545
-
546
- return Math.max(...childDepths);
547
- }
548
-
549
- const actualDepth = calculateDepth(component, 0);
550
-
551
- if (actualDepth > maxDepth) {
552
- issues.push(
553
- `Component nesting depth (${actualDepth}) exceeds maximum (${maxDepth})`
554
- );
555
- }
556
-
557
- return {
558
- valid: actualDepth <= maxDepth,
559
- actualDepth,
560
- issues
561
- };
562
- }
563
-
564
- /**
565
- * Extract all component types used in a view
566
- *
567
- * @param components - Component tree
568
- * @returns Set of component types
569
- */
570
- export function extractComponentTypes(
571
- components: Record<string, UIComponent>
572
- ): Set<string> {
573
- const types = new Set<string>();
574
-
575
- function walk(component: UIComponent): void {
576
- types.add(component.type);
577
- if (component.children) {
578
- component.children.forEach(walk);
579
- }
580
- }
581
-
582
- Object.values(components).forEach(walk);
583
-
584
- return types;
585
- }
586
-
587
- /**
588
- * Count total components in a view
589
- *
590
- * @param components - Component tree
591
- * @returns Component count
592
- */
593
- export function countComponents(
594
- components: Record<string, UIComponent>
595
- ): number {
596
- let count = 0;
597
-
598
- function walk(component: UIComponent): void {
599
- count++;
600
- if (component.children) {
601
- component.children.forEach(walk);
602
- }
603
- }
604
-
605
- Object.values(components).forEach(walk);
606
-
607
- return count;
608
- }