@salsita-ai/sdk 0.50.0-develop.6d8967bc99 → 0.50.0-develop.70dc8d05b6

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 (670) hide show
  1. package/README.md +3 -3
  2. package/dist/admin/create-admin-pages-from-spec.d.ts +1 -1
  3. package/dist/application-spec/errors/diagnostic-codes.d.ts +9 -0
  4. package/dist/application-spec/errors/diagnostic-codes.js +1 -1
  5. package/dist/application-spec/errors/diagnostic-messages.d.ts +12 -0
  6. package/dist/application-spec/errors/diagnostic-messages.js +1 -1
  7. package/dist/application-spec/generate-application/code/project-scaffolding.d.ts +8 -1
  8. package/dist/application-spec/generate-application/code/project-scaffolding.js +2 -2
  9. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-defaults.d.ts +4 -2
  10. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-domain-block.js +56 -56
  11. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-invariants.d.ts +1 -1
  12. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-invariants.js +1 -1
  13. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-phx-globals.js +3 -0
  14. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-relation-expressions.js +1 -1
  15. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-resources.d.ts +6 -8
  16. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-resources.js +11 -11
  17. package/dist/application-spec/generate-application/code/templates/domain-spec/index.d.ts +1 -1
  18. package/dist/application-spec/generate-application/code/templates/domain-spec/index.js +1 -1
  19. package/dist/application-spec/generate-application/code/templates/domain-spec.js +12 -12
  20. package/dist/application-spec/generate-application/code/templates/domain.js +3 -3
  21. package/dist/application-spec/generate-application/code/templates/globals.js +5 -4
  22. package/dist/application-spec/generate-application/code/templates/index.d.ts +0 -7
  23. package/dist/application-spec/generate-application/code/templates/index.js +1 -1
  24. package/dist/application-spec/generate-application/code/templates/package-json.js +1 -1
  25. package/dist/application-spec/generate-application/code/templates/skills/phoenix-create-configurator-skill.js +66 -42
  26. package/dist/application-spec/generate-application/code/templates/skills/phoenix-review-skill.js +8 -2
  27. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +13 -14
  28. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +6 -8
  29. package/dist/application-spec/generate-application/code/templates/webhook-builders.js +4 -3
  30. package/dist/application-spec/generate-application/code/templates/webhooks-config.js +2 -2
  31. package/dist/application-spec/generate-application/runtime/application-runtime.d.ts +1 -3
  32. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.d.ts +1 -3
  33. package/dist/application-spec/generate-application/runtime/sections/component-optic.d.ts +2 -1
  34. package/dist/application-spec/generate-application/runtime/sections/expression-runtime.js +1 -1
  35. package/dist/application-spec/generate-application/runtime/sections/transformers-runtime.d.ts +2 -4
  36. package/dist/application-spec/parse-application-files/categorize/module-analysis.d.ts +1 -1
  37. package/dist/application-spec/parse-application-files/categorize/module-analysis.js +1 -1
  38. package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.d.ts +16 -3
  39. package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.js +1 -1
  40. package/dist/application-spec/parse-application-files/spec/application/admin-spec/admin-spec.js +1 -1
  41. package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.js +1 -1
  42. package/dist/application-spec/parse-application-files/spec/model/defaults.d.ts +7 -2
  43. package/dist/application-spec/parse-application-files/spec/model/defaults.js +1 -1
  44. package/dist/application-spec/parse-application-files/spec/relations/reference-field-type.d.ts +25 -0
  45. package/dist/application-spec/parse-application-files/spec/relations/reference-field-type.js +1 -0
  46. package/dist/application-spec/parse-application-files/spec/relations/relation-field-mismatch.d.ts +46 -0
  47. package/dist/application-spec/parse-application-files/spec/relations/relation-field-mismatch.js +1 -0
  48. package/dist/application-spec/parse-application-files/spec/relations/relations.d.ts +4 -3
  49. package/dist/application-spec/parse-application-files/spec/relations/relations.js +1 -1
  50. package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.js +1 -1
  51. package/dist/application-spec/parse-application-files/spec/sections/infra.d.ts +2 -0
  52. package/dist/application-spec/parse-application-files/spec/sections/infra.js +1 -1
  53. package/dist/client/authorized-client.d.ts +3 -1
  54. package/dist/client/authorized-client.js +1 -1
  55. package/dist/client/contract.d.ts +34 -0
  56. package/dist/client/contract.js +1 -1
  57. package/dist/client/index.d.ts +2 -2
  58. package/dist/client/index.js +1 -1
  59. package/dist/client/local-authorized-client.d.ts +3 -1
  60. package/dist/client/local-authorized-client.js +1 -1
  61. package/dist/client/memory-authorized-client.d.ts +3 -1
  62. package/dist/client/memory-authorized-client.js +1 -1
  63. package/dist/client/phoenix-api.d.ts +215 -2
  64. package/dist/configurator/application-runtime/extensions/create-configurator-extensions.js +1 -1
  65. package/dist/configurator/application-runtime/extensions/selectors.d.ts +3 -1
  66. package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
  67. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +92 -3
  68. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
  69. package/dist/configurator/application-runtime/extensions/systems/graphql-system/entity-meta.js +1 -1
  70. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +14 -4
  71. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
  72. package/dist/configurator/application-runtime/extensions/systems/graphql-system/inject-assistant-lenses.d.ts +11 -0
  73. package/dist/configurator/application-runtime/extensions/systems/graphql-system/inject-assistant-lenses.js +1 -0
  74. package/dist/configurator/application-runtime/extensions/systems/index.d.ts +1 -1
  75. package/dist/configurator/application-runtime/extensions/systems/layout-system/layout-system.js +1 -1
  76. package/dist/configurator/common/configurator-interface.d.ts +5 -1
  77. package/dist/configurator/common/configurator-interface.js +1 -1
  78. package/dist/configurator/pages/DefaultConfiguratorLayout.d.ts +6 -0
  79. package/dist/configurator/pages/DefaultConfiguratorLayout.js +1 -0
  80. package/dist/configurator/pages/LoadedConfiguratorDetailPage.js +1 -1
  81. package/dist/configurator/ui/assistant/AssistantComposer.d.ts +2 -1
  82. package/dist/configurator/ui/assistant/AssistantComposer.js +1 -1
  83. package/dist/configurator/ui/assistant/AssistantThread.d.ts +6 -2
  84. package/dist/configurator/ui/assistant/AssistantThread.js +1 -1
  85. package/dist/configurator/ui/assistant/thread-items.d.ts +13 -2
  86. package/dist/configurator/ui/assistant/thread-items.js +1 -1
  87. package/dist/configurator/ui/configurator-layout/universal/DesktopLayout.d.ts +1 -75
  88. package/dist/configurator/ui/configurator-layout/universal/DesktopLayout.js +5 -20
  89. package/dist/configurator/ui/configurator-layout/universal/DesktopPreview.js +1 -1
  90. package/dist/configurator/ui/configurator-layout/universal/DesktopSidebar.d.ts +92 -0
  91. package/dist/configurator/ui/configurator-layout/universal/DesktopSidebar.js +16 -0
  92. package/dist/configurator/ui/configurator-layout/universal/MobileLayout.js +4 -4
  93. package/dist/configurator/ui/configurator-layout/universal/MobilePreview.js +1 -1
  94. package/dist/configurator/ui/configurator-layout/universal/use-layout-scene-safe-area.d.ts +47 -0
  95. package/dist/configurator/ui/configurator-layout/universal/use-layout-scene-safe-area.js +1 -0
  96. package/dist/configurator/ui/configurator-layout/universal/use-scene-safe-area.d.ts +11 -26
  97. package/dist/configurator/ui/configurator-layout/universal/use-scene-safe-area.js +1 -1
  98. package/dist/docs/complex-use-cases/filtered-controls-with-fix-dialog.mdx +16 -19
  99. package/dist/docs/complex-use-cases/sketching.mdx +0 -38
  100. package/dist/docs/controls/select-attribute/cardselect.mdx +9 -13
  101. package/dist/docs/index.json +11 -1
  102. package/dist/docs/integrations/woocommerce/local-development.mdx +1 -1
  103. package/dist/docs/layouts/custom-layout.mdx +981 -0
  104. package/dist/docs/other-features/side-effects.mdx +8 -11
  105. package/dist/docs/other-features/violation-messages.mdx +52 -56
  106. package/dist/docs/phoenix/configurator-interface.mdx +105 -65
  107. package/dist/docs/phoenix/deployments.mdx +1 -1
  108. package/dist/docs/phoenix/domain-model.mdx +4 -0
  109. package/dist/docs/phoenix/expression-context.mdx +11 -3
  110. package/dist/docs/phoenix/getting-started.mdx +1 -1
  111. package/dist/docs/phoenix/phoenix-cli.mdx +43 -47
  112. package/dist/docs/phoenix/project-structure.mdx +16 -10
  113. package/dist/docs/phoenix/quickstart.mdx +2 -2
  114. package/dist/docs/phoenix/sdk-builder-workflow.mdx +8 -8
  115. package/dist/docs/phoenix/webhook-membership.mdx +10 -9
  116. package/dist/docs/phoenix/webhooks.mdx +2 -2
  117. package/dist/docs/ux-guidelines/choosing-a-control.mdx +11 -0
  118. package/dist/domain/admin-domain/implementation/common-admin-expressions.d.ts +26 -11
  119. package/dist/domain/admin-domain/implementation/common-admin-publish.d.ts +1 -2
  120. package/dist/domain/admin-domain/index.d.ts +8 -3
  121. package/dist/domain/admin-domain/index.js +1 -1
  122. package/dist/domain/application/GetApplicationWrapperHandler.d.ts +2 -2
  123. package/dist/domain/application/GetThemeHandler.d.ts +1 -1
  124. package/dist/domain/application/GetWebComponentOptions.d.ts +1 -1
  125. package/dist/domain/application/admin-page-factories.d.ts +1 -2
  126. package/dist/domain/application/application-config.d.ts +7 -26
  127. package/dist/domain/application/assistant/assistant-fields.d.ts +12 -0
  128. package/dist/domain/application/assistant/assistant-fields.js +1 -0
  129. package/dist/domain/application/assistant/assistant-manifest.d.ts +11 -1
  130. package/dist/domain/application/assistant/assistant-resolved-manifest.d.ts +38 -2
  131. package/dist/domain/application/assistant/assistant-resolved-manifest.js +1 -1
  132. package/dist/domain/application/assistant/assistant-value-type.js +1 -1
  133. package/dist/domain/application/assistant/build-assistant-lenses.d.ts +14 -0
  134. package/dist/domain/application/assistant/build-assistant-lenses.js +5 -0
  135. package/dist/domain/application/assistant/build-assistant-manifest.js +1 -1
  136. package/dist/domain/application/assistant/create-assistant-execution-schema.d.ts +32 -0
  137. package/dist/domain/application/assistant/create-assistant-execution-schema.js +1 -0
  138. package/dist/domain/application/assistant/generate-assistant-prompt.d.ts +1 -11
  139. package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
  140. package/dist/domain/application/assistant/index.d.ts +6 -1
  141. package/dist/domain/application/assistant/index.js +1 -1
  142. package/dist/domain/application/assistant/session-setup/AssistantSetupHandler.d.ts +20 -0
  143. package/dist/domain/application/assistant/session-setup/AssistantSetupHandler.js +1 -0
  144. package/dist/domain/application/assistant/session-setup/apply-assistant-setup.d.ts +10 -0
  145. package/dist/domain/application/assistant/session-setup/apply-assistant-setup.js +1 -0
  146. package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.d.ts +48 -0
  147. package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.js +1 -0
  148. package/dist/domain/application/assistant/session-setup/create-session-assistant.d.ts +15 -0
  149. package/dist/domain/application/assistant/session-setup/create-session-assistant.js +1 -0
  150. package/dist/domain/application/assistant/session-setup/index.d.ts +4 -0
  151. package/dist/domain/application/assistant/session-setup/index.js +1 -0
  152. package/dist/domain/application/assistant-mutations.d.ts +2 -1
  153. package/dist/domain/application/assistant-mutations.js +1 -1
  154. package/dist/domain/application/assistant-recipe-groups.d.ts +1 -1
  155. package/dist/domain/application/configurator-builder.d.ts +2 -2
  156. package/dist/domain/application/configurator-builder.js +1 -1
  157. package/dist/domain/application/create-initial-published-data.d.ts +6 -7
  158. package/dist/domain/application/index.d.ts +2 -6
  159. package/dist/domain/application/index.js +1 -1
  160. package/dist/domain/application/published-data/DataRowValidatorHandler.d.ts +1 -1
  161. package/dist/domain/application/published-data/FilterPublishedChunksHandler.d.ts +1 -1
  162. package/dist/domain/application/published-data/MapPublishedChunkedDataHandler.d.ts +1 -1
  163. package/dist/domain/application/published-data/MapPublishedRevisionDataHandler.d.ts +1 -1
  164. package/dist/domain/application/published-data/SheetValidatorHandler.d.ts +1 -1
  165. package/dist/domain/application/published-data/build-legend-data.d.ts +1 -1
  166. package/dist/domain/application/published-data/format-field-type.d.ts +1 -1
  167. package/dist/domain/application/published-data/map-data-to-sheet.d.ts +1 -1
  168. package/dist/domain/application/published-data/map-published-chunked-data.d.ts +3 -3
  169. package/dist/domain/application/published-data/map-published-data.d.ts +7 -3
  170. package/dist/domain/application/published-data/validate-sheet-data.d.ts +1 -1
  171. package/dist/domain/available-system-components.js +1 -1
  172. package/dist/domain/core/action/action-factory.d.ts +11 -0
  173. package/dist/domain/core/{action.d.ts → action/action.d.ts} +21 -16
  174. package/dist/domain/core/action/index.d.ts +2 -0
  175. package/dist/domain/core/action/index.js +1 -0
  176. package/dist/domain/core/component/domain-component-optic.d.ts +29 -40
  177. package/dist/domain/core/component/domain-component-optic.js +2 -2
  178. package/dist/domain/core/component/legacy-filter.d.ts +2 -17
  179. package/dist/domain/core/component/system-component-filter.d.ts +36 -18
  180. package/dist/domain/core/data-schema/data-cell-value.d.ts +4 -0
  181. package/dist/domain/core/data-schema/data-schema-array-field.d.ts +5 -0
  182. package/dist/domain/core/data-schema/data-schema-field-object.d.ts +4 -0
  183. package/dist/domain/core/data-schema/data-schema-field-object.js +1 -0
  184. package/dist/domain/core/data-schema/data-schema-field.d.ts +2 -0
  185. package/dist/domain/core/data-schema/data-schema-field.js +1 -0
  186. package/dist/domain/core/data-schema/data-schema-localized-field.d.ts +4 -0
  187. package/dist/domain/core/data-schema/data-schema-localized-field.js +1 -0
  188. package/dist/domain/core/data-schema/data-schema-primitive-field.d.ts +5 -0
  189. package/dist/domain/core/data-schema/data-schema-primitive-field.js +1 -0
  190. package/dist/domain/core/data-schema/data-schema.d.ts +2 -0
  191. package/dist/domain/core/data-schema/data-schema.js +1 -0
  192. package/dist/domain/core/data-schema/index.d.ts +7 -0
  193. package/dist/domain/core/data-schema/index.js +1 -0
  194. package/dist/domain/core/domain-factory.d.ts +1 -1
  195. package/dist/domain/core/domain.d.ts +2 -2
  196. package/dist/domain/core/emission/index.d.ts +8 -0
  197. package/dist/domain/core/emission/index.js +1 -0
  198. package/dist/domain/core/emission/reset-state-emission.d.ts +12 -0
  199. package/dist/domain/core/emission/reset-state-emission.js +1 -0
  200. package/dist/domain/core/emission/state-emission.d.ts +4 -0
  201. package/dist/domain/core/emission/state-emission.js +1 -0
  202. package/dist/domain/core/emission/state-update-emission.d.ts +14 -0
  203. package/dist/domain/core/emission/state-update-emission.js +1 -0
  204. package/dist/domain/core/emission/state-validation-result.d.ts +18 -0
  205. package/dist/domain/core/emission/state-validation-result.js +1 -0
  206. package/dist/domain/core/emission/transformation-log.d.ts +2 -0
  207. package/dist/domain/core/emission/transformation-log.js +1 -0
  208. package/dist/domain/core/emission/transformer-log-entry.d.ts +6 -0
  209. package/dist/domain/core/emission/transformer-log-entry.js +1 -0
  210. package/dist/domain/core/emission/transformer-log.d.ts +11 -0
  211. package/dist/domain/core/emission/transformer-log.js +1 -0
  212. package/dist/domain/core/emission/transformer-phase.d.ts +1 -0
  213. package/dist/domain/core/emission/transformer-phase.js +1 -0
  214. package/dist/domain/core/expression/aliased-expressions.d.ts +10 -0
  215. package/dist/domain/core/expression/aliased-expressions.js +1 -0
  216. package/dist/domain/core/expression/constant-expressions.d.ts +16 -8
  217. package/dist/domain/core/expression/constant-expressions.js +1 -1
  218. package/dist/domain/core/expression/custom-expression.d.ts +21 -8
  219. package/dist/domain/core/expression/custom-expression.js +1 -1
  220. package/dist/domain/core/expression/expression.d.ts +15 -17
  221. package/dist/domain/core/expression/index.d.ts +1 -2
  222. package/dist/domain/core/expression/index.js +1 -1
  223. package/dist/domain/core/index.d.ts +5 -1
  224. package/dist/domain/core/index.js +1 -1
  225. package/dist/domain/core/invariant/custom-invariants.d.ts +8 -16
  226. package/dist/domain/core/invariant/index.d.ts +1 -1
  227. package/dist/domain/core/invariant/index.js +1 -1
  228. package/dist/domain/core/invariant/invariants.d.ts +4 -70
  229. package/dist/domain/core/invariant/invariants.js +1 -1
  230. package/dist/domain/core/invariant/violation.d.ts +1 -1
  231. package/dist/domain/core/recipe/index.d.ts +1 -0
  232. package/dist/domain/core/recipe/index.js +1 -0
  233. package/dist/domain/core/recipe/recipes.d.ts +23 -0
  234. package/dist/domain/core/recipe/recipes.js +1 -0
  235. package/dist/domain/core/relation/all-of-type-relation.d.ts +19 -0
  236. package/dist/domain/core/relation/all-of-type-relation.js +1 -0
  237. package/dist/domain/{relations → core/relation}/component-factories.d.ts +1 -1
  238. package/dist/domain/core/relation/component-factories.js +1 -0
  239. package/dist/domain/{relations → core/relation}/composed-of.d.ts +1 -1
  240. package/dist/domain/core/relation/composed-of.js +1 -0
  241. package/dist/domain/core/relation/direct-relation.d.ts +17 -0
  242. package/dist/domain/core/relation/index.d.ts +8 -0
  243. package/dist/domain/core/relation/index.js +1 -0
  244. package/dist/domain/core/relation/indirect-relation.d.ts +25 -0
  245. package/dist/domain/core/relation/indirect-relation.js +1 -0
  246. package/dist/domain/{relations → core/relation}/reference-component.d.ts +4 -3
  247. package/dist/domain/core/relation/reference-component.js +1 -0
  248. package/dist/domain/{relations → core/relation}/reference-field.d.ts +1 -1
  249. package/dist/domain/core/relation/reference-field.js +1 -0
  250. package/dist/domain/core/relation/relation-factory.d.ts +22 -0
  251. package/dist/domain/core/relation/relation-factory.js +1 -0
  252. package/dist/domain/core/state/migrations.d.ts +14 -45
  253. package/dist/domain/core/state/migrations.js +1 -1
  254. package/dist/domain/core/state/state.d.ts +1 -1
  255. package/dist/domain/domain-builder.d.ts +2 -5
  256. package/dist/domain/domain-builder.js +1 -1
  257. package/dist/domain/domain-context/action-system/action-system.d.ts +2 -2
  258. package/dist/domain/domain-context/action-system/action-system.js +1 -1
  259. package/dist/domain/domain-context/action-system/index.d.ts +1 -0
  260. package/dist/domain/domain-context/action-system/index.js +1 -0
  261. package/dist/domain/domain-context/analytics-system/index.d.ts +2 -0
  262. package/dist/domain/domain-context/analytics-system/index.js +1 -0
  263. package/dist/domain/domain-context/create-transformer.d.ts +1 -1
  264. package/dist/domain/domain-context/dimension-system/dimension-system.d.ts +2 -2
  265. package/dist/domain/domain-context/dimension-system/dimension-system.js +1 -1
  266. package/dist/domain/domain-context/dimension-system/index.d.ts +1 -0
  267. package/dist/domain/domain-context/dimension-system/index.js +1 -0
  268. package/dist/domain/domain-context/domain-context-systems.d.ts +7 -7
  269. package/dist/domain/domain-context/index.d.ts +8 -18
  270. package/dist/domain/domain-context/index.js +1 -1
  271. package/dist/domain/domain-context/navigation-system/index.d.ts +3 -0
  272. package/dist/domain/domain-context/navigation-system/index.js +1 -0
  273. package/dist/domain/domain-context/navigation-system/navigation-system.d.ts +2 -3
  274. package/dist/domain/domain-context/navigation-system/navigation-system.js +1 -1
  275. package/dist/domain/domain-context/navigation-system/selection-transformers.d.ts +1 -1
  276. package/dist/domain/domain-context/recipe-system/index.d.ts +1 -0
  277. package/dist/domain/domain-context/recipe-system/index.js +1 -0
  278. package/dist/domain/domain-context/recipe-system/recipe-cooker-system.d.ts +2 -3
  279. package/dist/domain/domain-context/recipe-system/recipe-cooker-system.js +1 -1
  280. package/dist/domain/domain-context/relation-transformers/cascade-deletes.d.ts +2 -2
  281. package/dist/domain/domain-context/relation-transformers/cascade-ref-pruning.d.ts +2 -2
  282. package/dist/domain/domain-context/relation-transformers/cascade-ref-pruning.js +1 -1
  283. package/dist/domain/domain-context/relation-transformers/create-entity-refs.d.ts +2 -2
  284. package/dist/domain/domain-context/relation-transformers/create-entity-refs.js +2 -2
  285. package/dist/domain/domain-context/relation-transformers/index.d.ts +4 -0
  286. package/dist/domain/domain-context/relation-transformers/index.js +1 -0
  287. package/dist/domain/domain-context/relation-transformers/replace-refs.d.ts +2 -2
  288. package/dist/domain/domain-context/relation-transformers/replace-refs.js +1 -1
  289. package/dist/domain/domain-context/store-system/index.d.ts +4 -0
  290. package/dist/domain/domain-context/store-system/index.js +1 -0
  291. package/dist/domain/domain-context/store-system/reconcile-projected-entities.js +1 -1
  292. package/dist/domain/domain-context/store-system/store-system.d.ts +2 -35
  293. package/dist/domain/domain-context/store-system/store-system.js +2 -2
  294. package/dist/domain/domain-context/store-system/system-state.d.ts +1 -1
  295. package/dist/domain/domain-context/transformers/actions-builder.js +1 -1
  296. package/dist/domain/domain-context/transformers/auto-snap-transformer.d.ts +5 -7
  297. package/dist/domain/domain-context/transformers/auto-snap-transformer.js +1 -1
  298. package/dist/domain/domain-context/transformers/chain-builder.d.ts +1 -1
  299. package/dist/domain/domain-context/transformers/context.d.ts +2 -3
  300. package/dist/domain/domain-context/transformers/context.js +1 -1
  301. package/dist/domain/domain-context/transformers/entity-builder.js +1 -1
  302. package/dist/domain/domain-context/transformers/index.d.ts +1 -1
  303. package/dist/domain/domain-context/transformers/index.js +1 -1
  304. package/dist/domain/domain-context/transformers/when-builder.d.ts +2 -3
  305. package/dist/domain/domain-context/transformers/when-builder.js +1 -1
  306. package/dist/domain/domain-context/undo-system.d.ts +2 -3
  307. package/dist/domain/domain-runtime/access/selectors.d.ts +9 -0
  308. package/dist/domain/domain-runtime/access/selectors.js +1 -1
  309. package/dist/domain/domain-runtime/access/types.d.ts +2 -0
  310. package/dist/domain/domain-runtime/access/types.js +1 -1
  311. package/dist/domain/domain-runtime/domain-context/action-context.d.ts +11 -0
  312. package/dist/domain/domain-runtime/domain-context/action-context.js +1 -0
  313. package/dist/domain/domain-runtime/domain-context/domain-context.js +1 -1
  314. package/dist/domain/domain-runtime/domain-context/expression-context.d.ts +8 -0
  315. package/dist/domain/domain-runtime/domain-context/expression-context.js +1 -0
  316. package/dist/domain/domain-runtime/domain-context/index.d.ts +3 -0
  317. package/dist/domain/domain-runtime/domain-context/runtime-expression-context.d.ts +18 -0
  318. package/dist/domain/domain-runtime/domain-context/runtime-expression-context.js +1 -0
  319. package/dist/domain/domain-runtime/domain-context/selectors.d.ts +19 -23
  320. package/dist/domain/domain-runtime/domain-context/selectors.js +1 -1
  321. package/dist/domain/domain-runtime/domain-context/types.d.ts +4 -1
  322. package/dist/domain/domain-runtime/domain-runtime.d.ts +84 -68
  323. package/dist/domain/domain-runtime/errors/implementation-error-collector.d.ts +19 -0
  324. package/dist/domain/domain-runtime/errors/implementation-error-collector.js +1 -0
  325. package/dist/domain/domain-runtime/errors/implementation-error.d.ts +46 -0
  326. package/dist/domain/domain-runtime/errors/implementation-error.js +1 -0
  327. package/dist/domain/domain-runtime/errors/implementation-errors.d.ts +13 -0
  328. package/dist/domain/domain-runtime/errors/implementation-errors.js +1 -0
  329. package/dist/domain/domain-runtime/errors/index.d.ts +4 -0
  330. package/dist/domain/domain-runtime/errors/index.js +1 -0
  331. package/dist/domain/domain-runtime/errors/to-implementation-errors.d.ts +10 -0
  332. package/dist/domain/domain-runtime/errors/to-implementation-errors.js +1 -0
  333. package/dist/domain/domain-runtime/index.d.ts +1 -0
  334. package/dist/domain/domain-runtime/index.js +1 -1
  335. package/dist/domain/domain-runtime/spec/create-violation-expressions.d.ts +24 -0
  336. package/dist/domain/domain-runtime/spec/create-violation-expressions.js +1 -0
  337. package/dist/domain/domain-runtime/spec/index.d.ts +5 -0
  338. package/dist/domain/domain-runtime/spec/index.js +1 -1
  339. package/dist/domain/domain-runtime/spec/initialize.js +1 -1
  340. package/dist/domain/{core/expression → domain-runtime/spec}/memoize-expression.d.ts +1 -2
  341. package/dist/domain/{application → domain-runtime/spec/module-checks}/element-registration.d.ts +2 -2
  342. package/dist/domain/domain-runtime/spec/module-checks/element-registration.js +1 -0
  343. package/dist/domain/{application → domain-runtime/spec/module-checks}/handler-registration.d.ts +1 -1
  344. package/dist/domain/domain-runtime/spec/module-checks/handler-registration.js +1 -0
  345. package/dist/domain/domain-runtime/spec/module-checks/index.d.ts +8 -0
  346. package/dist/domain/domain-runtime/spec/module-checks/index.js +1 -0
  347. package/dist/domain/{project-modules → domain-runtime/spec/module-checks}/project-modules.d.ts +8 -17
  348. package/dist/domain/domain-runtime/spec/module-checks/project-modules.js +1 -0
  349. package/dist/domain/domain-runtime/spec/module-checks/resolve-action-modules.d.ts +4 -0
  350. package/dist/domain/domain-runtime/spec/module-checks/resolve-action-modules.js +1 -0
  351. package/dist/domain/domain-runtime/spec/module-checks/resolve-component-optic-modules.d.ts +4 -0
  352. package/dist/domain/domain-runtime/spec/module-checks/resolve-component-optic-modules.js +1 -0
  353. package/dist/domain/domain-runtime/spec/module-checks/resolve-expression-modules.d.ts +15 -0
  354. package/dist/domain/domain-runtime/spec/module-checks/resolve-expression-modules.js +1 -0
  355. package/dist/domain/domain-runtime/spec/module-checks/resolve-imported-transformers.d.ts +22 -0
  356. package/dist/domain/domain-runtime/spec/module-checks/resolve-imported-transformers.js +1 -0
  357. package/dist/domain/domain-runtime/spec/module-checks/resolve-invariant-modules.d.ts +6 -0
  358. package/dist/domain/domain-runtime/spec/module-checks/resolve-invariant-modules.js +1 -0
  359. package/dist/domain/{actions → domain-runtime/spec}/prepare-action-implementations.d.ts +1 -1
  360. package/dist/domain/domain-runtime/spec/prepare-action-implementations.js +5 -0
  361. package/dist/domain/{core/expression → domain-runtime/spec}/prepare-domain-expressions.d.ts +1 -1
  362. package/dist/domain/domain-runtime/spec/selectors.d.ts +5 -6
  363. package/dist/domain/domain-runtime/spec/selectors.js +1 -1
  364. package/dist/domain/domain-runtime/spec/types.d.ts +3 -2
  365. package/dist/domain/{system-components → extensions}/child-entity-recipe-hierarchy.d.ts +1 -1
  366. package/dist/domain/extensions/child-entity-recipe-hierarchy.js +1 -0
  367. package/dist/domain/{system-components → extensions}/common/angle-indicator-schema.d.ts +1 -1
  368. package/dist/domain/extensions/common/angle-indicator-schema.js +1 -0
  369. package/dist/domain/extensions/common/index.d.ts +4 -0
  370. package/dist/domain/extensions/common/index.js +1 -0
  371. package/dist/domain/{system-components → extensions}/custom-header.d.ts +1 -1
  372. package/dist/domain/extensions/custom-header.js +1 -0
  373. package/dist/domain/{system-components → extensions}/custom-price-footer.js +1 -1
  374. package/dist/domain/{system-components → extensions}/custom-sidebar-footer.d.ts +1 -1
  375. package/dist/domain/extensions/custom-sidebar-footer.js +1 -0
  376. package/dist/domain/{system-components → extensions}/editable-angle-indicator.d.ts +2 -1
  377. package/dist/domain/extensions/editable-angle-indicator.js +1 -0
  378. package/dist/domain/{system-components → extensions}/editable-distance-dimension-indicator.d.ts +2 -1
  379. package/dist/domain/extensions/editable-distance-dimension-indicator.js +1 -0
  380. package/dist/domain/{system-components → extensions}/editable-offset-indicator.d.ts +2 -1
  381. package/dist/domain/extensions/editable-offset-indicator.js +1 -0
  382. package/dist/domain/{system-components → extensions}/editable-size-indicator.d.ts +2 -1
  383. package/dist/domain/extensions/editable-size-indicator.js +1 -0
  384. package/dist/domain/{system-components → extensions}/entity-header.d.ts +1 -1
  385. package/dist/domain/extensions/entity-header.js +1 -0
  386. package/dist/domain/{system-components → extensions}/finalize-component.js +1 -1
  387. package/dist/domain/extensions/index.d.ts +69 -0
  388. package/dist/domain/extensions/index.js +1 -0
  389. package/dist/domain/{system-components → extensions}/list-selector-dimension-indicator.d.ts +2 -1
  390. package/dist/domain/extensions/list-selector-dimension-indicator.js +1 -0
  391. package/dist/domain/{system-components → extensions}/property-page.d.ts +1 -1
  392. package/dist/domain/extensions/property-page.js +1 -0
  393. package/dist/domain/{system-components → extensions}/replace-entity-recipe-hierarchy.d.ts +1 -1
  394. package/dist/domain/extensions/replace-entity-recipe-hierarchy.js +1 -0
  395. package/dist/domain/{system-components → extensions}/scene-entity-add-fab.d.ts +1 -1
  396. package/dist/domain/extensions/scene-entity-add-fab.js +1 -0
  397. package/dist/domain/{system-components → extensions}/scene-entity-delete-fab.d.ts +1 -1
  398. package/dist/domain/extensions/scene-entity-delete-fab.js +1 -0
  399. package/dist/domain/{system-components → extensions}/scene-entity-html-hotspot.d.ts +1 -1
  400. package/dist/domain/extensions/scene-entity-html-hotspot.js +1 -0
  401. package/dist/domain/{system-components → extensions}/scene-entity-navigation-hotspot.d.ts +1 -1
  402. package/dist/domain/extensions/scene-entity-navigation-hotspot.js +1 -0
  403. package/dist/domain/{system-components → extensions}/scene-entity-object-html-hotspot.d.ts +1 -1
  404. package/dist/domain/extensions/scene-entity-object-html-hotspot.js +1 -0
  405. package/dist/domain/{system-components → extensions}/scene-entity-select-hotspot.d.ts +1 -1
  406. package/dist/domain/extensions/scene-entity-select-hotspot.js +1 -0
  407. package/dist/domain/{system-components → extensions}/sketching-edit.d.ts +1 -1
  408. package/dist/domain/extensions/sketching-edit.js +1 -0
  409. package/dist/domain/{system-components → extensions}/summary-component.js +1 -1
  410. package/dist/domain/{system-components → extensions}/tool-menu-fab.d.ts +1 -1
  411. package/dist/domain/extensions/tool-menu-fab.js +1 -0
  412. package/dist/domain/{system-components → extensions}/toolbar.d.ts +1 -1
  413. package/dist/domain/extensions/toolbar.js +1 -0
  414. package/dist/domain/index.d.ts +2 -8
  415. package/dist/domain/index.js +1 -1
  416. package/dist/domain/mocks/create-mock-domain-context.d.ts +1 -1
  417. package/dist/domain/mocks/create-mock-domain-runtime-services.d.ts +1 -1
  418. package/dist/domain/mocks/create-mock-domain-runtime.d.ts +28 -19
  419. package/dist/domain/mocks/create-mock-domain-runtime.js +1 -1
  420. package/dist/domain/mocks/create-mock-domain.d.ts +1 -1
  421. package/dist/domain/mocks/create-mock-domain.js +1 -1
  422. package/dist/domain/mocks/create-mock-state.d.ts +2 -2
  423. package/dist/domain/projections/blender-projections/blender-projections.d.ts +1 -2
  424. package/dist/domain/projections/blender-projections/camera.d.ts +2 -2
  425. package/dist/domain/projections/collision-projections.d.ts +1 -1
  426. package/dist/domain/projections/composition-projections.d.ts +1 -1
  427. package/dist/domain/projections/composition-projections.js +1 -1
  428. package/dist/domain/projections/constraint-projections.d.ts +1 -1
  429. package/dist/domain/projections/index.d.ts +1 -1
  430. package/dist/domain/projections/position-projections.d.ts +1 -1
  431. package/dist/domain/projections/projected-entities-projections.d.ts +1 -1
  432. package/dist/domain/projections/snapping-projections.d.ts +1 -1
  433. package/dist/domain/projections/validation-projections.d.ts +3 -19
  434. package/dist/domain/sketching/sketching-projections.d.ts +1 -1
  435. package/dist/domain/system-components/child-entity-selection.d.ts +1 -2
  436. package/dist/domain/system-components/common/index.d.ts +0 -4
  437. package/dist/domain/system-components/common/index.js +1 -1
  438. package/dist/domain/system-components/common/recipes.d.ts +1 -2
  439. package/dist/domain/system-components/index.d.ts +0 -68
  440. package/dist/domain/system-components/index.js +1 -1
  441. package/dist/domain/system-components/phoenix-entity-elements/admin-data-table-sidebar.d.ts +1 -1
  442. package/dist/domain/system-components/phoenix-layout-elements/admin-connected-resource-page.d.ts +1 -1
  443. package/dist/domain/system-components/phoenix-layout-elements/admin-data-table-actions.d.ts +1 -1
  444. package/dist/domain/system-components/phoenix-layout-elements/admin-data-table-page.d.ts +1 -1
  445. package/dist/domain/utils/eval-cache.d.ts +1 -1
  446. package/dist/domain/utils/map-nested-object.d.ts +1 -1
  447. package/dist/domain/utils/memo-eval.d.ts +2 -2
  448. package/dist/editor/domain-editors/use-implementation-files.d.ts +1 -2
  449. package/dist/editor/mocks/EditorMockContext.js +1 -1
  450. package/dist/i18n/locales/cs/messages.js +1 -1
  451. package/dist/i18n/locales/da/messages.js +1 -1
  452. package/dist/i18n/locales/de/messages.js +1 -1
  453. package/dist/i18n/locales/de-AT/messages.js +1 -1
  454. package/dist/i18n/locales/en/messages.js +1 -1
  455. package/dist/i18n/locales/en-AU/messages.js +1 -1
  456. package/dist/i18n/locales/en-GB/messages.js +1 -1
  457. package/dist/i18n/locales/es/messages.js +1 -1
  458. package/dist/i18n/locales/fr/messages.js +1 -1
  459. package/dist/i18n/locales/hu/messages.js +1 -1
  460. package/dist/i18n/locales/it/messages.js +1 -1
  461. package/dist/i18n/locales/nl/messages.js +1 -1
  462. package/dist/i18n/locales/pl/messages.js +1 -1
  463. package/dist/i18n/locales/pt/messages.js +1 -1
  464. package/dist/i18n/locales/ro/messages.js +1 -1
  465. package/dist/i18n/locales/sk/messages.js +1 -1
  466. package/dist/i18n/locales/tr/messages.js +1 -1
  467. package/dist/legacy/domain-cli/gen/configurator-builder.js +13 -12
  468. package/dist/legacy/domain-cli/gen/constant-expressions.js +1 -3
  469. package/dist/legacy/domain-cli/gen/defaults.js +1 -7
  470. package/dist/legacy/domain-cli/gen/implementation.js +7 -11
  471. package/dist/legacy/domain-cli/gen/invariants.js +7 -6
  472. package/dist/legacy/domain-cli/gen/relations.js +1 -1
  473. package/dist/legacy/domain-cli/utils/cache.d.ts +1 -1
  474. package/dist/legacy/domain-cli/utils/cache.js +1 -1
  475. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/claude-md.d.ts +1 -1
  476. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/cursor-rules.d.ts +1 -1
  477. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.d.ts +1 -1
  478. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.js +1 -0
  479. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/domain-index.js +17 -15
  480. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/env-example.d.ts +1 -1
  481. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/env-example.js +4 -0
  482. package/dist/phoenix/application-spec/application-spec-builder.js +1 -1
  483. package/dist/phoenix/commands/init.d.ts +4 -4
  484. package/dist/phoenix/commands/init.js +1 -1
  485. package/dist/phoenix/commands/prettier.js +1 -1
  486. package/dist/phoenix/utils/git/index.d.ts +1 -0
  487. package/dist/phoenix/utils/git/index.js +1 -0
  488. package/dist/phoenix/utils/git/is-inside-git-repository.d.ts +6 -0
  489. package/dist/phoenix/utils/git/is-inside-git-repository.js +1 -0
  490. package/dist/phoenix/utils/index.d.ts +1 -0
  491. package/dist/phoenix/utils/index.js +1 -1
  492. package/dist/react-sdk/application-runtime/hooks/use-access-service.d.ts +2 -0
  493. package/dist/react-sdk/application-runtime/mocks/create-mock-application-runtime.js +1 -1
  494. package/dist/react-sdk/application-runtime/routing/access-service.d.ts +1 -0
  495. package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +53 -36
  496. package/dist/react-sdk/application-runtime/runtime/create-application-runtime.js +1 -1
  497. package/dist/react-sdk/domain-context/common-hooks/use-domain-context.d.ts +9 -9
  498. package/dist/react-sdk/domain-context/index.d.ts +1 -1
  499. package/dist/react-sdk/domain-context/index.js +1 -1
  500. package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.d.ts +6 -0
  501. package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.js +1 -1
  502. package/dist/ui-sdk/theme/types.d.ts +1 -1
  503. package/dist/webhook/builders/common.d.ts +5 -0
  504. package/dist/webhook/builders/webhook-builder.js +1 -1
  505. package/package.json +3 -3
  506. package/dist/application-spec/generate-application/code/templates/env-ci.d.ts +0 -1
  507. package/dist/application-spec/generate-application/code/templates/env-ci.js +0 -25
  508. package/dist/application-spec/generate-application/code/templates/env-example.d.ts +0 -1
  509. package/dist/application-spec/generate-application/code/templates/env-example.js +0 -90
  510. package/dist/application-spec/generate-application/code/templates/prettier-ignore.d.ts +0 -1
  511. package/dist/application-spec/generate-application/code/templates/prettier-ignore.js +0 -6
  512. package/dist/application-spec/generate-application/code/templates/private-assets-readme.d.ts +0 -1
  513. package/dist/application-spec/generate-application/code/templates/private-assets-readme.js +0 -24
  514. package/dist/application-spec/generate-application/code/templates/public-assets-readme.d.ts +0 -1
  515. package/dist/application-spec/generate-application/code/templates/public-assets-readme.js +0 -24
  516. package/dist/application-spec/generate-application/code/templates/readme.d.ts +0 -1
  517. package/dist/application-spec/generate-application/code/templates/readme.js +0 -23
  518. package/dist/application-spec/generate-application/code/templates/skills/agents-md.d.ts +0 -1
  519. package/dist/application-spec/generate-application/code/templates/skills/agents-md.js +0 -2
  520. package/dist/domain/actions/action-factory.d.ts +0 -10
  521. package/dist/domain/actions/prepare-action-implementations.js +0 -5
  522. package/dist/domain/application/element-registration.js +0 -1
  523. package/dist/domain/application/handler-registration.js +0 -1
  524. package/dist/domain/application/resolve-imported-transformers.d.ts +0 -23
  525. package/dist/domain/application/resolve-imported-transformers.js +0 -1
  526. package/dist/domain/application/resource-builder.d.ts +0 -13
  527. package/dist/domain/application/resource-builder.js +0 -1
  528. package/dist/domain/domain-context/recipe-system/recipes.d.ts +0 -55
  529. package/dist/domain/domain-context/recipe-system/recipes.js +0 -1
  530. package/dist/domain/project-modules/index.d.ts +0 -1
  531. package/dist/domain/project-modules/index.js +0 -1
  532. package/dist/domain/project-modules/project-modules.js +0 -1
  533. package/dist/domain/relations/all-of-type-relation.d.ts +0 -30
  534. package/dist/domain/relations/all-of-type-relation.js +0 -1
  535. package/dist/domain/relations/component-factories.js +0 -1
  536. package/dist/domain/relations/composed-of.js +0 -1
  537. package/dist/domain/relations/direct-relation.d.ts +0 -27
  538. package/dist/domain/relations/indirect-relation.d.ts +0 -78
  539. package/dist/domain/relations/indirect-relation.js +0 -1
  540. package/dist/domain/relations/reference-component.js +0 -1
  541. package/dist/domain/relations/relation-factory.d.ts +0 -17
  542. package/dist/domain/relations/relation-factory.js +0 -1
  543. package/dist/domain/relations/relation-implementation.d.ts +0 -5
  544. package/dist/domain/system-components/child-entity-recipe-hierarchy.js +0 -1
  545. package/dist/domain/system-components/common/angle-indicator-schema.js +0 -1
  546. package/dist/domain/system-components/custom-header.js +0 -1
  547. package/dist/domain/system-components/custom-sidebar-footer.js +0 -1
  548. package/dist/domain/system-components/editable-angle-indicator.js +0 -1
  549. package/dist/domain/system-components/editable-distance-dimension-indicator.js +0 -1
  550. package/dist/domain/system-components/editable-offset-indicator.js +0 -1
  551. package/dist/domain/system-components/editable-size-indicator.js +0 -1
  552. package/dist/domain/system-components/entity-header.js +0 -1
  553. package/dist/domain/system-components/list-selector-dimension-indicator.js +0 -1
  554. package/dist/domain/system-components/property-page.js +0 -1
  555. package/dist/domain/system-components/replace-entity-recipe-hierarchy.js +0 -1
  556. package/dist/domain/system-components/scene-entity-add-fab.js +0 -1
  557. package/dist/domain/system-components/scene-entity-delete-fab.js +0 -1
  558. package/dist/domain/system-components/scene-entity-html-hotspot.js +0 -1
  559. package/dist/domain/system-components/scene-entity-navigation-hotspot.js +0 -1
  560. package/dist/domain/system-components/scene-entity-object-html-hotspot.js +0 -1
  561. package/dist/domain/system-components/scene-entity-select-hotspot.js +0 -1
  562. package/dist/domain/system-components/sketching-edit.js +0 -1
  563. package/dist/domain/system-components/tool-menu-fab.js +0 -1
  564. package/dist/domain/system-components/toolbar.js +0 -1
  565. /package/dist/domain/{actions → core/action}/action-factory.js +0 -0
  566. /package/dist/domain/core/{action.js → action/action.js} +0 -0
  567. /package/dist/domain/{relations/reference-field.js → core/data-schema/data-cell-value.js} +0 -0
  568. /package/dist/domain/{relations/relation-implementation.js → core/data-schema/data-schema-array-field.js} +0 -0
  569. /package/dist/domain/{relations → core/relation}/direct-relation.js +0 -0
  570. /package/dist/domain/{core/expression → domain-runtime/spec}/memoize-expression.js +0 -0
  571. /package/dist/domain/{core/expression → domain-runtime/spec}/prepare-domain-expressions.js +0 -0
  572. /package/dist/domain/{system-components → extensions}/angle-indicator.d.ts +0 -0
  573. /package/dist/domain/{system-components → extensions}/angle-indicator.js +0 -0
  574. /package/dist/domain/{system-components → extensions}/attribute-switch.d.ts +0 -0
  575. /package/dist/domain/{system-components → extensions}/attribute-switch.js +0 -0
  576. /package/dist/domain/{system-components → extensions}/autorotate-camera-component.d.ts +0 -0
  577. /package/dist/domain/{system-components → extensions}/autorotate-camera-component.js +0 -0
  578. /package/dist/domain/{system-components → extensions}/basic-sidebar-footer.d.ts +0 -0
  579. /package/dist/domain/{system-components → extensions}/basic-sidebar-footer.js +0 -0
  580. /package/dist/domain/{system-components → extensions}/camera-based-hidden-entity-object.d.ts +0 -0
  581. /package/dist/domain/{system-components → extensions}/camera-based-hidden-entity-object.js +0 -0
  582. /package/dist/domain/{system-components → extensions}/camera-based-hidden-entity.d.ts +0 -0
  583. /package/dist/domain/{system-components → extensions}/camera-based-hidden-entity.js +0 -0
  584. /package/dist/domain/{system-components → extensions}/canvas-config.d.ts +0 -0
  585. /package/dist/domain/{system-components → extensions}/canvas-config.js +0 -0
  586. /package/dist/domain/{system-components → extensions}/canvas-custom-environment.d.ts +0 -0
  587. /package/dist/domain/{system-components → extensions}/canvas-custom-environment.js +0 -0
  588. /package/dist/domain/{system-components → extensions}/canvas-padding.d.ts +0 -0
  589. /package/dist/domain/{system-components → extensions}/canvas-padding.js +0 -0
  590. /package/dist/domain/{system-components → extensions}/canvas-preset-environment.d.ts +0 -0
  591. /package/dist/domain/{system-components → extensions}/canvas-preset-environment.js +0 -0
  592. /package/dist/domain/{system-components → extensions}/client-side-image.d.ts +0 -0
  593. /package/dist/domain/{system-components → extensions}/client-side-image.js +0 -0
  594. /package/dist/domain/{system-components → extensions}/color-value.d.ts +0 -0
  595. /package/dist/domain/{system-components → extensions}/color-value.js +0 -0
  596. /package/dist/domain/{system-components → extensions}/common/dimension-indicator-schema.d.ts +0 -0
  597. /package/dist/domain/{system-components → extensions}/common/dimension-indicator-schema.js +0 -0
  598. /package/dist/domain/{system-components → extensions}/common/dimension-indicators.d.ts +0 -0
  599. /package/dist/domain/{system-components → extensions}/common/dimension-indicators.js +0 -0
  600. /package/dist/domain/{system-components → extensions}/common/editable-indicator-button-variant.d.ts +0 -0
  601. /package/dist/domain/{system-components → extensions}/common/editable-indicator-button-variant.js +0 -0
  602. /package/dist/domain/{system-components → extensions}/custom-price-footer.d.ts +0 -0
  603. /package/dist/domain/{system-components → extensions}/dimension-indicator.d.ts +0 -0
  604. /package/dist/domain/{system-components → extensions}/dimension-indicator.js +0 -0
  605. /package/dist/domain/{system-components → extensions}/exit-tool-mode-fab.d.ts +0 -0
  606. /package/dist/domain/{system-components → extensions}/exit-tool-mode-fab.js +0 -0
  607. /package/dist/domain/{system-components → extensions}/finalize-action.d.ts +0 -0
  608. /package/dist/domain/{system-components → extensions}/finalize-action.js +0 -0
  609. /package/dist/domain/{system-components → extensions}/finalize-component.d.ts +0 -0
  610. /package/dist/domain/{system-components → extensions}/fit-selection-orthographic-camera-component.d.ts +0 -0
  611. /package/dist/domain/{system-components → extensions}/fit-selection-orthographic-camera-component.js +0 -0
  612. /package/dist/domain/{system-components → extensions}/fit-selection-perspective-camera-component.d.ts +0 -0
  613. /package/dist/domain/{system-components → extensions}/fit-selection-perspective-camera-component.js +0 -0
  614. /package/dist/domain/{system-components → extensions}/fixed-header.d.ts +0 -0
  615. /package/dist/domain/{system-components → extensions}/fixed-header.js +0 -0
  616. /package/dist/domain/{system-components → extensions}/floating-header.d.ts +0 -0
  617. /package/dist/domain/{system-components → extensions}/floating-header.js +0 -0
  618. /package/dist/domain/{system-components → extensions}/hidden-header.d.ts +0 -0
  619. /package/dist/domain/{system-components → extensions}/hidden-header.js +0 -0
  620. /package/dist/domain/{system-components → extensions}/hidden-sidebar-footer.d.ts +0 -0
  621. /package/dist/domain/{system-components → extensions}/hidden-sidebar-footer.js +0 -0
  622. /package/dist/domain/{system-components → extensions}/horizontal-tabs.d.ts +0 -0
  623. /package/dist/domain/{system-components → extensions}/horizontal-tabs.js +0 -0
  624. /package/dist/domain/{system-components → extensions}/multilingual-text-value.d.ts +0 -0
  625. /package/dist/domain/{system-components → extensions}/multilingual-text-value.js +0 -0
  626. /package/dist/domain/{system-components → extensions}/navigation-steps.d.ts +0 -0
  627. /package/dist/domain/{system-components → extensions}/navigation-steps.js +0 -0
  628. /package/dist/domain/{system-components → extensions}/offset-anchors.d.ts +0 -0
  629. /package/dist/domain/{system-components → extensions}/offset-anchors.js +0 -0
  630. /package/dist/domain/{system-components → extensions}/offset-indicator.d.ts +0 -0
  631. /package/dist/domain/{system-components → extensions}/offset-indicator.js +0 -0
  632. /package/dist/domain/{system-components → extensions}/offset.d.ts +0 -0
  633. /package/dist/domain/{system-components → extensions}/offset.js +0 -0
  634. /package/dist/domain/{system-components → extensions}/other-action.d.ts +0 -0
  635. /package/dist/domain/{system-components → extensions}/other-action.js +0 -0
  636. /package/dist/domain/{system-components → extensions}/read-sidebar-footer.d.ts +0 -0
  637. /package/dist/domain/{system-components → extensions}/read-sidebar-footer.js +0 -0
  638. /package/dist/domain/{system-components → extensions}/rotatable.d.ts +0 -0
  639. /package/dist/domain/{system-components → extensions}/rotatable.js +0 -0
  640. /package/dist/domain/{system-components → extensions}/rotation-handle.d.ts +0 -0
  641. /package/dist/domain/{system-components → extensions}/rotation-handle.js +0 -0
  642. /package/dist/domain/{system-components → extensions}/save-template-thumbnail.d.ts +0 -0
  643. /package/dist/domain/{system-components → extensions}/save-template-thumbnail.js +0 -0
  644. /package/dist/domain/{system-components → extensions}/scene-entity-animation.d.ts +0 -0
  645. /package/dist/domain/{system-components → extensions}/scene-entity-animation.js +0 -0
  646. /package/dist/domain/{system-components → extensions}/scene-entity-control.d.ts +0 -0
  647. /package/dist/domain/{system-components → extensions}/scene-entity-control.js +0 -0
  648. /package/dist/domain/{system-components → extensions}/scene-entity-floor-object.d.ts +0 -0
  649. /package/dist/domain/{system-components → extensions}/scene-entity-floor-object.js +0 -0
  650. /package/dist/domain/{system-components → extensions}/scene-entity-wall-object.d.ts +0 -0
  651. /package/dist/domain/{system-components → extensions}/scene-entity-wall-object.js +0 -0
  652. /package/dist/domain/{system-components → extensions}/selectable-component.d.ts +0 -0
  653. /package/dist/domain/{system-components → extensions}/selectable-component.js +0 -0
  654. /package/dist/domain/{system-components → extensions}/sidebar-tabs.d.ts +0 -0
  655. /package/dist/domain/{system-components → extensions}/sidebar-tabs.js +0 -0
  656. /package/dist/domain/{system-components → extensions}/simple-summary.d.ts +0 -0
  657. /package/dist/domain/{system-components → extensions}/simple-summary.js +0 -0
  658. /package/dist/domain/{system-components → extensions}/size.d.ts +0 -0
  659. /package/dist/domain/{system-components → extensions}/size.js +0 -0
  660. /package/dist/domain/{system-components → extensions}/sketching-draw.d.ts +0 -0
  661. /package/dist/domain/{system-components → extensions}/sketching-draw.js +0 -0
  662. /package/dist/domain/{system-components → extensions}/summary-component.d.ts +0 -0
  663. /package/dist/domain/{system-components → extensions}/text-value.d.ts +0 -0
  664. /package/dist/domain/{system-components → extensions}/text-value.js +0 -0
  665. /package/dist/domain/{system-components → extensions}/tool-controls.d.ts +0 -0
  666. /package/dist/domain/{system-components → extensions}/tool-controls.js +0 -0
  667. /package/dist/domain/{system-components → extensions}/universal-sidebar-footer.d.ts +0 -0
  668. /package/dist/domain/{system-components → extensions}/universal-sidebar-footer.js +0 -0
  669. /package/dist/domain/{system-components → extensions}/view-controls.d.ts +0 -0
  670. /package/dist/domain/{system-components → extensions}/view-controls.js +0 -0
@@ -1,76 +1,10 @@
1
- import type { OmitNever } from '@salsita-ai/common/utils';
2
- import { type ProjectModule } from '../../project-modules/index.js';
3
- import type { AnonymousExpression, ExpressionContext } from '../expression/index.js';
4
- import { type $DomainEntity, type AliasMap, type DomainEntity, type EntityByType, type EventualAlias, type ExpandAlias, type ExtractFromAliasedRecord, type TypeOrAlias } from '../model/index.js';
1
+ import type { OpenExpressionContext } from '../expression/index.js';
2
+ import type { DomainEntity, ExpandAlias, TypeOrAlias } from '../model/index.js';
5
3
  import type { DomainState } from '../state/index.js';
6
4
  import { type Violation } from './violation.js';
7
- export interface Invariant<ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, ENTITY extends ENTITIES, VIOLATION_TYPE extends string> {
8
- evaluate(selfId: ENTITY['id'], state: DomainState<ENTITIES>, ctx: ExpressionContext<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA>): ReadonlyArray<Violation<VIOLATION_TYPE>>;
5
+ export interface Invariant<ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, ENTITY extends ENTITIES, VIOLATION_TYPE extends string, CONTEXT_EXTENSION = unknown> {
6
+ evaluate(selfId: ENTITY['id'], state: DomainState<ENTITIES>, ctx: OpenExpressionContext<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, CONTEXT_EXTENSION>): ReadonlyArray<Violation<VIOLATION_TYPE>>;
9
7
  }
10
8
  export type AliasedInvariants<ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, ALIASES extends Record<string, ENTITIES>, VIOLATION_TYPES extends string> = {
11
9
  [K in TypeOrAlias<ENTITIES, ALIASES>]?: ReadonlyArray<Invariant<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ExpandAlias<ENTITIES, ALIASES, K>, VIOLATION_TYPES>>;
12
10
  };
13
- export type DeclaredInvariants<ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>>, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>> = {
14
- readonly [TYPE in ENTITIES['type']]: '$violations' extends keyof $MAP[TYPE] ? $MAP[TYPE]['$violations'] extends () => ReadonlyArray<Violation<infer VIOLATION_TYPE>> ? ReadonlyArray<Invariant<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ENTITIES, VIOLATION_TYPE>> : never : never;
15
- };
16
- type ConflictingInvariants<ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, EXPECTED extends Partial<Record<ENTITIES['type'], ReadonlyArray<Invariant<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ENTITIES, string>>>>, IMPLEMENTED extends Partial<Record<ENTITIES['type'], ReadonlyArray<Invariant<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ENTITIES, string>>>>> = OmitNever<{
17
- [K in keyof EXPECTED]: EXPECTED[K] extends [never] ? never : K extends keyof IMPLEMENTED ? ViolationTypeOfInvariants<EXPECTED[K]> extends ViolationTypeOfInvariants<IMPLEMENTED[K]> ? ViolationTypeOfInvariants<IMPLEMENTED[K]> extends ViolationTypeOfInvariants<EXPECTED[K]> ? never : {
18
- missing: Exclude<ViolationTypeOfInvariants<EXPECTED[K]>, ViolationTypeOfInvariants<IMPLEMENTED[K]>>;
19
- extra: Exclude<ViolationTypeOfInvariants<IMPLEMENTED[K]>, ViolationTypeOfInvariants<EXPECTED[K]>>;
20
- } : {
21
- missing: Exclude<ViolationTypeOfInvariants<EXPECTED[K]>, ViolationTypeOfInvariants<IMPLEMENTED[K]>>;
22
- extra: Exclude<ViolationTypeOfInvariants<IMPLEMENTED[K]>, ViolationTypeOfInvariants<EXPECTED[K]>>;
23
- } : {
24
- missing: ViolationTypeOfInvariants<EXPECTED[K]>;
25
- extra: never;
26
- };
27
- }>;
28
- type ViolationOfInvariants<INVARIANTS> = INVARIANTS extends ReadonlyArray<infer INVARIANT> ? INVARIANT : never;
29
- type ViolationTypeOfInvariants<INVARIANTS> = ViolationOfInvariants<INVARIANTS> extends Invariant<any, any, any, any, any, any, infer VIOLATION_TYPE> ? VIOLATION_TYPE : never;
30
- type ExpandAndMergeInvariants<ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, ALIASES extends Readonly<Record<string, ENTITIES>>, EXPANDED extends Partial<Record<ENTITIES['type'], ReadonlyArray<Invariant<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ENTITIES, string>>>>, ALIASED extends Partial<Record<TypeOrAlias<ENTITIES, ALIASES>, ReadonlyArray<Invariant<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ENTITIES, string>>>>> = {
31
- [K in keyof EXPANDED | ExpandAlias<ENTITIES, ALIASES, keyof ALIASED & string>['type']]: K extends ENTITIES['type'] ? ExtractFromAliasedRecord<ENTITIES, ALIASES, ALIASED, EventualAlias<ENTITIES, ALIASES, K> | K> extends infer INVARIANTS_FROM_ALIAS ? [
32
- INVARIANTS_FROM_ALIAS
33
- ] extends [never] ? K extends keyof EXPANDED ? EXPANDED[K] : never : K extends keyof EXPANDED ? ReadonlyArray<ViolationOfInvariants<EXPANDED[K]> | ViolationOfInvariants<INVARIANTS_FROM_ALIAS>> : ReadonlyArray<ViolationOfInvariants<INVARIANTS_FROM_ALIAS>> : never : never;
34
- };
35
- type ExpressionsFromInvariants<ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, INVARIANTS extends Partial<Record<ENTITIES['type'], ReadonlyArray<Invariant<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ENTITIES, string>>>>> = {
36
- [K in keyof INVARIANTS & ENTITIES['type']]: {
37
- $violations: AnonymousExpression<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, EntityByType<ENTITIES, K>, ReadonlyArray<Violation<INVARIANTS[K] extends ReadonlyArray<infer ELEMENT> ? ELEMENT extends Invariant<any, any, any, any, any, any, infer VIOLATION_TYPE> ? VIOLATION_TYPE : never : never>>>;
38
- };
39
- };
40
- type BuildViolationExpressions<ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>>, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, INVARIANTS extends Partial<Record<ENTITIES['type'], ReadonlyArray<Invariant<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ENTITIES, string>>>>> = Record<never, never> extends ConflictingInvariants<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, DeclaredInvariants<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA>, INVARIANTS> ? () => ExpressionsFromInvariants<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, INVARIANTS> : never;
41
- type AnyInvariant = Invariant<any, any, any, any, any, any, string>;
42
- /** Validates the `src/invariants/` files and concatenates their invariants per entity type or alias. */
43
- export declare const resolveInvariantModules: (modules: readonly ProjectModule[]) => Readonly<Record<string, readonly AnyInvariant[]>>;
44
- export declare class InvariantBuilder<ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>>, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, ALIASES extends Record<string, ENTITIES>, INVARIANTS extends Partial<Record<ENTITIES['type'], ReadonlyArray<Invariant<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ENTITIES, string>>>> = Record<never, never>> {
45
- private readonly aliasMap;
46
- private readonly invariants;
47
- constructor(aliasMap: AliasMap<ALIASES>, invariants?: INVARIANTS);
48
- /**
49
- * Adds the invariants of the `src/invariants/` files, as the generated barrel lists them, after
50
- * checking each file against the folder's contract.
51
- */
52
- withInvariantModules(modules: readonly ProjectModule[]): InvariantBuilder<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ALIASES, ExpandAndMergeInvariants<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ALIASES, INVARIANTS, AliasedInvariants<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ALIASES, string>>>;
53
- withInvariants<ALIASED_INVARIANTS extends AliasedInvariants<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ALIASES, string>>(aliasedInvariants: ALIASED_INVARIANTS): InvariantBuilder<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ALIASES, ExpandAndMergeInvariants<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ALIASES, INVARIANTS, ALIASED_INVARIANTS>>;
54
- /**
55
- * DO NOT USE in runtime!
56
- *
57
- * This is just a dev-time to review conflicts in declared and actually reportable violations.
58
- * Use your IDEs code-completion to see which entities have conflicts and which violations are the conflicting ones.
59
- *
60
- * Use the helper when you see the following error on the `.buildViolationExpressions()` method call:
61
- * ```
62
- * TS2349: This expression is not callable.
63
- * Type never has no call signatures.
64
- * ```
65
- * simply
66
- * ```ts
67
- * const violationExpressions = invariantBuilder
68
- * .withInvariants(createBuiltinInvariants(domainComponentReader))
69
- * .withInvariants(kitchenRangeInvariants)
70
- * ._conflicts.Oven. // <- trigger code-completion here
71
- * ```
72
- */
73
- _conflicts: ConflictingInvariants<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, DeclaredInvariants<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA>, INVARIANTS>;
74
- buildViolationExpressions: BuildViolationExpressions<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, INVARIANTS>;
75
- }
76
- export {};
@@ -1 +1 @@
1
- import{SHARED_FOLDER_HINT as t,createContractError as e,isRecord as a}from"../../project-modules/index.js";import{expandAlias as i}from"../model/index.js";let r={expected:"an object of invariant lists keyed by entity type or alias",fix:`Create it with phx.domain.implementCustomInvariants({ ... }) (phx.domain.admin.implementCustomInvariants({ ... }) under src/admin/), ${t}.`},n=t=>a(t)&&"function"==typeof t.evaluate,s=t=>a(t)&&Object.values(t).every(t=>Array.isArray(t)&&t.every(n));export const resolveInvariantModules=t=>{let a={};for(let i of t){if(!s(i.exports))throw e(i.origin,r,i.exports);for(let[t,e]of Object.entries(i.exports))a[t]=[...a[t]??[],...e]}return a};export class InvariantBuilder{aliasMap;invariants;constructor(t,e={}){this.aliasMap=t,this.invariants=e}withInvariantModules(t){return this.withInvariants(resolveInvariantModules(t))}withInvariants(t){let e={...this.invariants};return Object.entries(t).forEach(([t,a])=>{i(this.aliasMap,t).forEach(t=>{e[t]=[...e[t]??[],...a]})}),new InvariantBuilder(this.aliasMap,e)}_conflicts={};buildViolationExpressions=()=>{let t={};return Object.entries(this.invariants).forEach(([e,a])=>{t[e]={$violations:{evaluate:(t,e,i)=>a.flatMap(a=>a.evaluate(t,e,i)),meta:{}}}}),t}}
1
+ export{};
@@ -1,6 +1,6 @@
1
1
  import type { I18n } from '@lingui/core';
2
2
  import type { Localizable } from '@salsita-ai/common/utils';
3
- import type { StateEmission } from '../../domain-context/store-system/store-system.js';
3
+ import type { StateEmission } from '../emission/index.js';
4
4
  import type { $DomainEntity, DomainEntity, EntityId } from '../model/index.js';
5
5
  /**
6
6
  * An **ORDERED** list of violation severities.
@@ -0,0 +1 @@
1
+ export * from './recipes.js';
@@ -0,0 +1 @@
1
+ export*from"./recipes.js";
@@ -0,0 +1,23 @@
1
+ import { type AnyAliasMap, type DomainEntity, type DomainEntityReflection, type EntityByType } from '../model/index.js';
2
+ /** The entity a recipe yields: a whole entity, which the recipe system gives a new id when it cooks the recipe. */
3
+ export type EntityRecipe<ENTITY extends DomainEntity<string>> = ENTITY;
4
+ /** What a project passes to its recipe factory: the entity type, and the properties that differ from the defaults. */
5
+ export type EntityOverrides<ENTITIES extends DomainEntity<string>, TYPE extends ENTITIES['type']> = Partial<Omit<EntityByType<ENTITIES, TYPE>, 'type'>> & {
6
+ type: TYPE;
7
+ };
8
+ /** The function a project creates recipes with, `phx.domain.createRecipe`. */
9
+ export type RecipeFactory<ENTITIES extends DomainEntity<string>> = <TYPE extends ENTITIES['type']>(overrides: EntityOverrides<ENTITIES, TYPE>) => EntityRecipe<EntityByType<ENTITIES, TYPE>>;
10
+ /**
11
+ * Creates the recipe factory of a domain from the `defaults` of its spec.
12
+ *
13
+ * Defaults declared for an alias apply to every entity type of the alias, and a later key overrides
14
+ * an earlier one. The defaults of an entity type must be a whole entity of that type: they are
15
+ * validated here against the entity's schema, so a domain with invalid defaults fails when its
16
+ * module loads. An entity type without defaults is not checked.
17
+ *
18
+ * `ENTITIES` is the only type the result depends on, and no argument determines it, so the caller
19
+ * states it.
20
+ *
21
+ * @param defaults Property values by entity type or alias.
22
+ */
23
+ export declare const createRecipeFactory: <ENTITIES extends DomainEntity<string>>(aliasMap: AnyAliasMap, entityReflections: ReadonlyArray<ENTITIES extends unknown ? DomainEntityReflection<ENTITIES> : never>, defaults: Readonly<Record<string, Readonly<Record<string, unknown>>>>) => RecipeFactory<ENTITIES>;
@@ -0,0 +1 @@
1
+ import{_unsafeBuildDomainEntityId as e,expandAlias as r}from"../model/index.js";export const createRecipeFactory=(t,o,i)=>{let a={};Object.entries(i).forEach(([e,o])=>{r(t,e).forEach(e=>{a[e]={...a[e],...o}})});let n=new Map(o.map(e=>[e.type,e._meta.validator]));return Object.entries(a).forEach(([r,t])=>{let o=n.get(r);if(!o)throw Error(`Defaults provided for unknown entity ${r}`);if(!o({id:e(r,1),type:r,...t}))throw console.error(o.errors,t),Error(`Invalid defaults for ${r} entity.`)}),r=>({id:e(r.type,1),...a[r.type],...r})};
@@ -0,0 +1,19 @@
1
+ import type { ExpressionMeta } from '../expression/index.js';
2
+ import { type AnyAliasMap, type DomainEntity, type DomainEntityId } from '../model/index.js';
3
+ import type { DomainState } from '../state/index.js';
4
+ /** A relation whose related entities are all entities of the target type or alias. */
5
+ export interface AllOfTypeRelation {
6
+ kind: 'allOfType';
7
+ target: string;
8
+ cardinality: '0-1' | '1-1' | '0-N' | '1-N';
9
+ meta?: ExpressionMeta;
10
+ }
11
+ /**
12
+ * Resolves `allOfType` relations from a per-state index. Relations targeting the same set of types
13
+ * share one bucket; the first resolution on a state walks the entities once to fill every bucket,
14
+ * and every later resolution on that state is a lookup. Registration closes once the first state
15
+ * has been indexed, so a bucket can never be missing from an index that was already built.
16
+ */
17
+ export declare const createAllOfTypeRelation: (aliasMap: AnyAliasMap) => (relation: {
18
+ readonly target: string;
19
+ }) => (_selfId: DomainEntityId<string>, state: DomainState<DomainEntity<string>>) => DomainEntityId<string>[];
@@ -0,0 +1 @@
1
+ import{expandAlias as e}from"../model/index.js";export const createAllOfTypeRelation=t=>{let r=new Map,a=new WeakMap,n=!1;return o=>{if(n)throw Error(`Cannot register all-of-type relation targeting ${o.target} after evaluation started. Create all relation expressions before evaluating the domain state.`);let l=new Set(e(t,o.target)),i=[...l].sort().join("|");return r.set(i,l),(e,t)=>(e=>{let t=a.get(e);if(t)return t;n=!0;let o=new Map([...r.keys()].map(e=>[e,[]]));for(let t of e.entities)for(let[e,a]of r)a.has(t.type)&&o.get(e).push(t.id);return a.set(e,o),o})(t).get(i)}};
@@ -1,4 +1,4 @@
1
- import type { DomainEntity, DomainEntityId, DomainEntityReflection, RawAliasReflection } from '../core/index.js';
1
+ import type { DomainEntity, DomainEntityId, DomainEntityReflection, RawAliasReflection } from '../model/index.js';
2
2
  import type { ComposedOfComponentState } from './composed-of.js';
3
3
  import type { ReferenceComponentState } from './reference-component.js';
4
4
  export declare const createSingleReferenceRead: <TARGET extends DomainEntity<string>>(_targetReflection: DomainEntityReflection<TARGET> | RawAliasReflection<TARGET>, field: string) => (self: object, state: unknown, ctx: unknown) => ReferenceComponentState;
@@ -0,0 +1 @@
1
+ import{memoEval as e}from"../../utils/memo-eval.js";export const createSingleReferenceRead=(t,r)=>e(e=>[e[r]],e=>({referencedEntityIds:null===e?[]:[e]}));export const createSingleReferenceWrite=(e,t)=>r=>{let n=r.referencedEntityIds[0];return n&&e.assertId(n),{[t]:n??null}};export const createMultipleReferenceRead=(t,r)=>e(e=>[e[r]],e=>({referencedEntityIds:e}));export const createMultipleReferenceWrite=(e,t)=>r=>(e.assertIds(r.referencedEntityIds),{[t]:r.referencedEntityIds});export const createSingleCompositionRead=t=>e(e=>[e[t]?.id??null],e=>({childEntityIds:null===e?[]:[e]}));export const createMultipleCompositionRead=t=>e(e=>e[t].map(e=>e.id),(...e)=>({childEntityIds:e}));export const createEmptyWrite=()=>()=>({});
@@ -1,4 +1,4 @@
1
- import { type DomainEntityId } from '../core/index.js';
1
+ import { type DomainEntityId } from '../model/index.js';
2
2
  export type ComposedOfComponentState = {
3
3
  /**
4
4
  * List of entity IDs that the parent entity is composed of
@@ -0,0 +1 @@
1
+ import{SystemComponentBuilder as o}from"../component/index.js";import{EntityIdSchema as t}from"../model/index.js";export const composedOfComponent=o.component("composedOf").withState({type:"object",properties:{childEntityIds:{type:"array",items:t}},required:["childEntityIds"],additionalProperties:!1}).build();
@@ -0,0 +1,17 @@
1
+ import type { AnyDomain } from '../domain.js';
2
+ import type { ExpressionMeta } from '../expression/index.js';
3
+ import type { DomainEntity, DomainEntityId } from '../model/index.js';
4
+ import type { DomainState } from '../state/index.js';
5
+ /**
6
+ * A relation whose related entities are the ones a field of the entity itself references. The
7
+ * application-spec parser checks that `field` is a reference field of the entity that fits the
8
+ * target and the cardinality.
9
+ */
10
+ export interface DirectRelation {
11
+ kind: 'direct';
12
+ target: string;
13
+ field: string;
14
+ cardinality: '0-1' | '1-1' | '0-N' | '1-N';
15
+ meta?: ExpressionMeta;
16
+ }
17
+ export declare const directRelation: (relation: DirectRelation) => (selfId: DomainEntityId<string>, state: DomainState<DomainEntity<string>>, domain: AnyDomain) => Array<DomainEntityId<string>>;
@@ -0,0 +1,8 @@
1
+ export * from './all-of-type-relation.js';
2
+ export * from './component-factories.js';
3
+ export * from './composed-of.js';
4
+ export * from './direct-relation.js';
5
+ export * from './indirect-relation.js';
6
+ export * from './reference-component.js';
7
+ export type * from './reference-field.js';
8
+ export * from './relation-factory.js';
@@ -0,0 +1 @@
1
+ export*from"./all-of-type-relation.js";export*from"./component-factories.js";export*from"./composed-of.js";export*from"./direct-relation.js";export*from"./indirect-relation.js";export*from"./reference-component.js";export*from"./relation-factory.js";
@@ -0,0 +1,25 @@
1
+ import type { ExpressionMeta } from '../expression/index.js';
2
+ import { type AnyAliasMap, type DomainEntity, type DomainEntityId } from '../model/index.js';
3
+ import type { DomainState } from '../state/index.js';
4
+ /**
5
+ * A relation whose related entities are the ones that reference the entity in their `field`. The
6
+ * application-spec parser checks that `field` is a reference field of the target that points back.
7
+ */
8
+ export interface IndirectRelation {
9
+ kind: 'indirect';
10
+ target: string;
11
+ field: string;
12
+ cardinality: '0-1' | '1-1' | '0-N' | '1-N';
13
+ meta?: ExpressionMeta;
14
+ }
15
+ /**
16
+ * Resolves `indirect` relations from a per-state reverse-reference index. Relations reading the
17
+ * same field on the same set of target types share one index mapping each referenced id to the
18
+ * entities that reference it; the first resolution on a state walks the entities once to fill
19
+ * every index, and every later resolution on that state is a lookup. Registration closes once the
20
+ * first state has been indexed, so an index can never be missing from a state already walked.
21
+ */
22
+ export declare const createIndirectRelation: (aliasMap: AnyAliasMap) => (relation: {
23
+ readonly target: string;
24
+ readonly field: string;
25
+ }) => (sourceId: DomainEntityId<string>, state: DomainState<DomainEntity<string>>) => DomainEntityId<string>[];
@@ -0,0 +1 @@
1
+ import{isArray as e}from"@salsita-ai/common/utils";import{expandAlias as t}from"../model/index.js";let r=e=>"string"==typeof e;export const createIndirectRelation=i=>{let n=new Map,o=new WeakMap,a=!1;return l=>{if(a)throw Error(`Cannot register indirect relation ${l.target}#${l.field} after evaluation started. Create all relation expressions before evaluating the domain state.`);let s=new Set(t(i,l.target)),f=`${l.field}|${[...s].sort().join("|")}`;return n.set(f,{field:l.field,targetTypes:s}),(t,i)=>(t=>{let i=o.get(t);if(i)return i;a=!0;let l=new Map([...n.keys()].map(e=>[e,new Map]));for(let i of t.entities)for(let[t,{field:o,targetTypes:a}]of n){if(!a.has(i.type))continue;let n=i[o],s=e(n)?new Set(n.filter(r)):r(n)?[n]:[],f=l.get(t);for(let e of s){let t=f.get(e);t||(t=[],f.set(e,t)),t.push(i.id)}}return o.set(t,l),l})(i).get(f).get(t)??[]}};
@@ -1,4 +1,5 @@
1
- import { type $DomainEntity, type DomainComponentOpticBuilder, type DomainEntity, type DomainEntityId, type DomainEntityReflection, type RawAliasReflection } from '../core/index.js';
1
+ import { type DomainComponentOpticBuilder } from '../component/index.js';
2
+ import { type $DomainEntity, type DomainEntity, type DomainEntityId, type DomainEntityReflection, type RawAliasReflection } from '../model/index.js';
2
3
  import type { ArrayReferenceField, SingleReferenceField } from './reference-field.js';
3
4
  export type ReferenceComponentState = {
4
5
  /**
@@ -12,5 +13,5 @@ export type ReferenceComponentState = {
12
13
  */
13
14
  export declare const referenceComponent: import("../index.js").SystemComponentType<"reference", ReferenceComponentState, "referencedEntityIds">;
14
15
  export type ReferenceComponent = typeof referenceComponent;
15
- export declare const attachSingleReferenceComponent: <ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>>, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, ALIASES extends Record<string, ENTITIES>, ENTITY extends ENTITIES, $ENTITY extends $DomainEntity<ENTITY>, TARGET_ENTITY extends ENTITIES>(attachComponent: DomainComponentOpticBuilder<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ALIASES, ENTITY, $ENTITY, typeof referenceComponent>, targetReflection: DomainEntityReflection<TARGET_ENTITY> | RawAliasReflection<TARGET_ENTITY>, field: SingleReferenceField<ENTITY, TARGET_ENTITY, any>) => import("../index.js").DomainComponentSimpleOptic<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ENTITY, import("../index.js").SystemComponentType<"reference", ReferenceComponentState, "referencedEntityIds">>;
16
- export declare const attachMultipleReferenceComponent: <ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>>, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, ALIASES extends Record<string, ENTITIES>, ENTITY extends ENTITIES, $ENTITY extends $DomainEntity<ENTITY>, TARGET_ENTITY extends ENTITIES>(attachComponent: DomainComponentOpticBuilder<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ALIASES, ENTITY, $ENTITY, typeof referenceComponent>, targetReflection: DomainEntityReflection<TARGET_ENTITY> | RawAliasReflection<TARGET_ENTITY>, field: ArrayReferenceField<ENTITY, TARGET_ENTITY>) => import("../index.js").DomainComponentSimpleOptic<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ENTITY, import("../index.js").SystemComponentType<"reference", ReferenceComponentState, "referencedEntityIds">>;
16
+ export declare const attachSingleReferenceComponent: <ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>>, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, ALIASES extends Record<string, ENTITIES>, ENTITY extends ENTITIES, $ENTITY extends $DomainEntity<ENTITY>, TARGET_ENTITY extends ENTITIES, CONTEXT_EXTENSION = unknown>(attachComponent: DomainComponentOpticBuilder<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ALIASES, ENTITY, $ENTITY, typeof referenceComponent, CONTEXT_EXTENSION>, targetReflection: DomainEntityReflection<TARGET_ENTITY> | RawAliasReflection<TARGET_ENTITY>, field: SingleReferenceField<ENTITY, TARGET_ENTITY, any>) => import("../index.js").DomainComponentSimpleOptic<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ENTITY, import("../index.js").SystemComponentType<"reference", ReferenceComponentState, "referencedEntityIds">, CONTEXT_EXTENSION>;
17
+ export declare const attachMultipleReferenceComponent: <ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>>, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, ALIASES extends Record<string, ENTITIES>, ENTITY extends ENTITIES, $ENTITY extends $DomainEntity<ENTITY>, TARGET_ENTITY extends ENTITIES, CONTEXT_EXTENSION = unknown>(attachComponent: DomainComponentOpticBuilder<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ALIASES, ENTITY, $ENTITY, typeof referenceComponent, CONTEXT_EXTENSION>, targetReflection: DomainEntityReflection<TARGET_ENTITY> | RawAliasReflection<TARGET_ENTITY>, field: ArrayReferenceField<ENTITY, TARGET_ENTITY>) => import("../index.js").DomainComponentSimpleOptic<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ENTITY, import("../index.js").SystemComponentType<"reference", ReferenceComponentState, "referencedEntityIds">, CONTEXT_EXTENSION>;
@@ -0,0 +1 @@
1
+ import{memoEval as e}from"../../utils/memo-eval.js";import{SystemComponentBuilder as t}from"../component/index.js";import{EntityIdSchema as r}from"../model/index.js";export const referenceComponent=t.component("reference").withState({type:"object",properties:{referencedEntityIds:{type:"array",items:r}},required:["referencedEntityIds"],additionalProperties:!1}).withWritableKeys(["referencedEntityIds"]).build();export const attachSingleReferenceComponent=(t,r,n)=>t.attach(e(e=>[e[n]],e=>({referencedEntityIds:null===e?[]:[e]})),e=>{let t=e.referencedEntityIds[0];return t&&r.assertId(t),{[n]:t??null}});export const attachMultipleReferenceComponent=(t,r,n)=>t.attach(e(e=>[e[n]],e=>({referencedEntityIds:e})),e=>(r.assertIds(e.referencedEntityIds),{[n]:e.referencedEntityIds}));
@@ -1,4 +1,4 @@
1
- import type { DomainEntity } from '../core/index.js';
1
+ import type { DomainEntity } from '../model/index.js';
2
2
  export type SingleReferenceField<FROM extends DomainEntity<string>, TO extends DomainEntity<string>, OPTIONALITY extends null | never> = {
3
3
  [K in keyof FROM]: TO['id'] | OPTIONALITY extends FROM[K] ? FROM[K] extends TO['id'] | OPTIONALITY ? K & string : never : never;
4
4
  }[keyof FROM];
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1,22 @@
1
+ import type { AnonymousExpression } from '../expression/index.js';
2
+ import { type $DomainEntity, type AnyAliasMap, type DomainEntity } from '../model/index.js';
3
+ import { type AllOfTypeRelation } from './all-of-type-relation.js';
4
+ import { type DirectRelation } from './direct-relation.js';
5
+ import { type IndirectRelation } from './indirect-relation.js';
6
+ /** A relation as a spec declares it: where the related entities are found and how many there may be. */
7
+ export type Relation = DirectRelation | AllOfTypeRelation | IndirectRelation;
8
+ type RelatedEntity = $DomainEntity<DomainEntity<string>>;
9
+ /**
10
+ * The expression of a relation as a domain takes it. The entity and data types are erased, so that
11
+ * the domain of any project accepts it: an expression typed with the base entity type is not
12
+ * assignable to one typed with a project's entities. The type a project reads from a relation is
13
+ * the one its generated model declares for the relation's property.
14
+ */
15
+ type RelationExpression = AnonymousExpression<any, any, any, any, any, any, RelatedEntity | null | ReadonlyArray<RelatedEntity>>;
16
+ /**
17
+ * Makes the expression of one relation: it collects the related entities of an entity and returns
18
+ * them as the cardinality says, one entity, one entity or `null`, or an array.
19
+ */
20
+ export type RelationFactory = (relation: Relation) => RelationExpression;
21
+ export declare const createRelationFactory: (aliasMap: AnyAliasMap) => RelationFactory;
22
+ export {};
@@ -0,0 +1 @@
1
+ import{match as t}from"ts-pattern";import{expandAlias as e}from"../model/index.js";import{createAllOfTypeRelation as r}from"./all-of-type-relation.js";import{directRelation as i}from"./direct-relation.js";import{createIndirectRelation as n}from"./indirect-relation.js";export const createRelationFactory=o=>{let a=r(o),l=n(o);return r=>{let n=t(r).with({kind:"direct"},t=>i(t)).with({kind:"indirect"},t=>l(t)).with({kind:"allOfType"},t=>a(t)).exhaustive(),d=t(r).with({cardinality:"0-1"},()=>t=>{if(t.length>1)throw Error(`Expected at most one entity, but got ${t.length}`);return t[0]??null}).with({cardinality:"1-1"},()=>t=>{let[e,...r]=t;if(void 0===e||r.length>0)throw Error(`Expected exactly one entity, but got ${t.length}`);return e}).with({cardinality:"0-N"},()=>t=>t).with({cardinality:"1-N"},()=>t=>{if(0===t.length)throw Error("Expected at least one entity, but got none");return t}).exhaustive(),c=e(o,r.target);return{meta:{alwaysEvaluate:!0,...r.meta},evaluate:(t,e,i)=>{let o=n(t,e,i.domain),a=i.domain.get$Entities(o,e);if(!a.every(t=>c.includes(t.type))){let t=a.map(t=>t.type).filter(t=>!c.includes(t));throw Error(`Expected ${r.target} entities, but got ${t.join(", ")}`)}return d(a)}}}};
@@ -48,51 +48,20 @@ export type MigrateFunction<LATEST_ENTITIES extends DomainEntity<string>> = (ver
48
48
  state: ReadonlyArray<DomainEntity<string>>;
49
49
  }, options: MigrateFunctionOptions) => readonly LATEST_ENTITIES[];
50
50
  /**
51
- * Builder for the state migration function.
51
+ * Creates the function that migrates a state of any registered version of the model to the latest
52
+ * one. The state is validated against the reflections of its own version, and again after every
53
+ * migration against the reflections of the version that migration yields.
54
+ *
55
+ * @param modelVersions the entity reflections of every version of the model, keyed by version
56
+ * @param latestVersion the version the state is migrated to
57
+ * @param migrations the migration to each version above the first: the one under key `n` takes a
58
+ * state of version `n - 1` to version `n`
52
59
  * @example
53
-
54
- export const migrateState = MigrateFunctionBuilder
55
-
56
- // the reflections are used for validation and sanitization
57
- .fromVersions({
58
- 1: v1Reflections,
59
- 2: v2Reflections,
60
- 3: v3Reflections,
61
- })
62
-
63
- // the latest version of the model
64
- .to(2)
65
-
66
- // the migrations between the versions
67
- .using({
68
- 2: migrationToV2,
69
- 3: migrationToV3,
70
- })
71
-
72
- .build()
73
-
60
+ * export const migrate = createMigrateFunction(
61
+ * { 1: v1Reflections, 2: v2Reflections, 3: v3Reflections },
62
+ * 3,
63
+ * { 2: migrationToV2, 3: migrationToV3 }
64
+ * )
74
65
  */
75
- export declare const MigrateFunctionBuilder: {
76
- /**
77
- * Provide the entity reflections for all versions of the model.
78
- */
79
- fromVersions: <VERSIONS extends Record<number, EntityReflections<any>>>(modelVersions: VERSIONS) => {
80
- /**
81
- * Specify the latest version of the model. I.e. the version to which the state will be migrated.
82
- */
83
- to: <LATEST extends keyof VERSIONS & number>(latestVersion: LATEST) => {
84
- /**
85
- * Provide the migrations between each consecutive version of the model.
86
- *
87
- * Migration with index `i` should migrate the state from version `i - 1` to version `i`.
88
- */
89
- using: (migrations: Record<Exclude<keyof VERSIONS, 1>, Migration<any, any>>) => {
90
- /**
91
- * Finally, build the migration function.
92
- */
93
- build: () => MigrateFunction<EntitiesOfReflections<VERSIONS[LATEST]>>;
94
- };
95
- };
96
- };
97
- };
66
+ export declare const createMigrateFunction: <VERSIONS extends Record<number, EntityReflections<any>>, LATEST extends keyof VERSIONS & number>(modelVersions: VERSIONS, latestVersion: LATEST, migrations: Record<Exclude<keyof VERSIONS, 1>, Migration<any, any>>) => MigrateFunction<EntitiesOfReflections<VERSIONS[LATEST]>>;
98
67
  export {};
@@ -1 +1 @@
1
- import e from"lodash-es/pick.js";export class StateMigrationError extends Error{constructor(e){super(e),this.name="StateMigrationError"}}export const isStateMigrationError=e=>e instanceof StateMigrationError;let t=(t,r,i,o)=>t.map(t=>{let n=r[t.type];if(!n)throw new StateMigrationError(`Unknown entity type "${t.type}". The state contains an entity whose type is not registered in the domain model for this version. Fix: register the entity type in the domain spec, or remove/migrate the stale entity from the preset or configuration data.`);if(n._meta.validator(t))return t;if(i){let r=e(t,Object.keys(n._meta.schema.properties));if(n._meta.validator(t))return o?.error(`Entity ${t.type}#${t.id} had extra fields that had to be trimmed: ${Object.keys(r)}`),r}throw new StateMigrationError(`Entity "${t.type}#${t.id}" does not match its schema in the current domain model. Validation errors: ${JSON.stringify(n._meta.validator.errors)}. Fix: update the entity data to match the schema, add a migration that transforms older data into the current shape, or re-register the schema if it changed.`)});export const MigrateFunctionBuilder={fromVersions:e=>({to:r=>({using:i=>({build:()=>(o,{logger:n,trimExtraProperties:a})=>{let s=e[o.version];if(!s)throw new StateMigrationError(`Unknown model version ${o.version}. The state declares a version that has no registered reflections. Fix: register the version in MigrateFunctionBuilder.fromVersions({ ... }), or correct the version stored on the state.`);let d=t(o.state,s,a,n);o.version===r?n?.debug(`State is already in the latest version ${r}`):n?.debug(`Migrating state from version ${o.version} to ${r}`);for(let s=o.version;s<r;s++){n?.debug(`Applying intermediate migration to version ${s+1}`);let h=e[s+1];if(!h)throw new StateMigrationError(`Unknown model version ${s+1} while migrating from ${o.version} to ${r}. An intermediate version has no registered reflections. Fix: register version ${s+1} in MigrateFunctionBuilder.fromVersions({ ... }).`);let g=i[s+1];if(!g)throw new StateMigrationError(`Missing migration from version ${s} to ${s+1}. No migration is registered for this step while migrating to ${r}. Fix: add the migration in MigrateFunctionBuilder.using({ ${s+1}: ... }).`);d=t(g(d),h,a,n)}if(!e[o.version])throw new StateMigrationError(`Unknown model version ${o.version}. The state declares a version that has no registered reflections. Fix: register the version in MigrateFunctionBuilder.fromVersions({ ... }), or correct the version stored on the state.`);return d}})})})};
1
+ import t from"lodash-es/pick.js";export class StateMigrationError extends Error{constructor(t){super(t),this.name="StateMigrationError"}}export const isStateMigrationError=t=>t instanceof StateMigrationError;let e=(e,r,i,o)=>e.map(e=>{let n=r[e.type];if(!n)throw new StateMigrationError(`Unknown entity type "${e.type}". The state contains an entity whose type is not registered in the domain model for this version. Fix: register the entity type in the domain spec, or remove/migrate the stale entity from the preset or configuration data.`);if(n._meta.validator(e))return e;if(i){let r=t(e,Object.keys(n._meta.schema.properties));if(n._meta.validator(e))return o?.error(`Entity ${e.type}#${e.id} had extra fields that had to be trimmed: ${Object.keys(r)}`),r}throw new StateMigrationError(`Entity "${e.type}#${e.id}" does not match its schema in the current domain model. Validation errors: ${JSON.stringify(n._meta.validator.errors)}. Fix: update the entity data to match the schema, add a migration that transforms older data into the current shape, or re-register the schema if it changed.`)});export const createMigrateFunction=(t,r,i)=>(o,{logger:n,trimExtraProperties:a})=>{let s=t[o.version];if(!s)throw new StateMigrationError(`Unknown model version ${o.version}. The state declares a version that has no registered reflections. Fix: register the version in the model versions passed to createMigrateFunction, or correct the version stored on the state.`);let d=e(o.state,s,a,n);o.version===r?n?.debug(`State is already in the latest version ${r}`):n?.debug(`Migrating state from version ${o.version} to ${r}`);for(let s=o.version;s<r;s++){n?.debug(`Applying intermediate migration to version ${s+1}`);let h=t[s+1];if(!h)throw new StateMigrationError(`Unknown model version ${s+1} while migrating from ${o.version} to ${r}. An intermediate version has no registered reflections. Fix: register version ${s+1} in the model versions passed to createMigrateFunction.`);let g=i[s+1];if(!g)throw new StateMigrationError(`Missing migration from version ${s} to ${s+1}. No migration is registered for this step while migrating to ${r}. Fix: add the migration under key ${s+1} in the migrations passed to createMigrateFunction.`);d=e(g(d),h,a,n)}return d};
@@ -6,4 +6,4 @@ export interface DomainState<ENTITIES extends DomainEntity<string>> {
6
6
  readonly ephemeralRecords: ReadonlyArray<ComponentSnapshot<SystemComponentTypeConstraint>>;
7
7
  }
8
8
  export type DomainStateFactory<ENTITIES extends DomainEntity<string>> = (entities: readonly ENTITIES[], ephemeralRecords: ReadonlyArray<ComponentSnapshot<SystemComponentTypeConstraint>>, rootEntityType: ENTITIES['type']) => DomainState<ENTITIES>;
9
- export declare const createInitialDomainState: <ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES>(entities: readonly ENTITIES[], rootEntityType: ALLOWED_ROOT_ENTITIES['type']) => DomainState<ENTITIES>;
9
+ export declare const createInitialDomainState: <ENTITIES extends DomainEntity<string>>(entities: readonly ENTITIES[], rootEntityType: ENTITIES['type']) => DomainState<ENTITIES>;
@@ -1,9 +1,6 @@
1
1
  import { type ExtendedJsonSchema } from '@salsita-ai/common/utils';
2
- import { type $DomainEntity, type $DomainEntityReflection, type ActionDefinition, type AliasMap, type AnonymousExpression, type AnyActionImplementations, type DomainEntity, DomainFactory, type EntityByType, type EntityReflections, type ExpandAlias, type MigrateFunction, type SchemaOfObject, type TypeOrAlias } from './core/index.js';
3
- import { type ProjectModule } from './project-modules/index.js';
4
- export type AliasedExpressions<ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, ALIASES extends Record<string, ENTITIES>> = {
5
- [K in TypeOrAlias<ENTITIES, ALIASES>]?: Record<string, AnonymousExpression<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ExpandAlias<ENTITIES, ALIASES, K>, unknown>>;
6
- };
2
+ import { type $DomainEntity, type $DomainEntityReflection, type ActionDefinition, type AliasMap, type AliasedExpressions, type AnyActionImplementations, type DomainEntity, DomainFactory, type EntityByType, type EntityReflections, type MigrateFunction, type SchemaOfObject } from './core/index.js';
3
+ import { type ProjectModule } from './domain-runtime/index.js';
7
4
  type $EntityReflections<ENTITIES extends DomainEntity<string>> = {
8
5
  [TYPE in ENTITIES['type']]: $DomainEntityReflection<$DomainEntity<EntityByType<ENTITIES, TYPE>>>;
9
6
  };
@@ -1 +1 @@
1
- import{DomainFactory as t,MigrateFunctionBuilder as i,expandAlias as e}from"./core/index.js";import{resolveActionModules as s,resolveExpressionModules as n}from"./project-modules/index.js";import{withProfilerLabel as a}from"./utils/profiler-label.js";export class DomainBuilder{entities;aliasMap;$entityReflections;allowedRootEntityTypes;implemented;modelVersion;publishedData;sessionData;frontendData;backendData;migrate;isAdminDomain;actions;actionImplementations;constructor(t,i,e,s,n,a,o,h,l,r,m,d,p,c){this.entities=t,this.aliasMap=i,this.$entityReflections=e,this.allowedRootEntityTypes=s,this.implemented=n,this.modelVersion=a,this.publishedData=o,this.sessionData=h,this.frontendData=l,this.backendData=r,this.migrate=m,this.isAdminDomain=d,this.actions=p,this.actionImplementations=c}static from(t,e,s,n,a,o,h,l,r,m){let d=i.fromVersions({1:t}).to(1).using({}).build();return new DomainBuilder(t,e,s,n,{},a,o,h,l,r,d,m,{},{})}withMigrate(t){return new DomainBuilder(this.entities,this.aliasMap,this.$entityReflections,this.allowedRootEntityTypes,this.implemented,this.modelVersion,this.publishedData,this.sessionData,this.frontendData,this.backendData,t,this.isAdminDomain,this.actions,this.actionImplementations)}withExpressions(t){let i={...this.implemented};return Object.entries(t).forEach(([t,s])=>{e(this.aliasMap,t).forEach(e=>{let n={...i[e]};i[e]=n,Object.entries(s).forEach(([i,s])=>{let o=n[i];if(o)throw Error(`Duplicate expression ${e}.${i}: The expression is defined on both ${t} and ${o.origin.typeOrAlias}, which would lead to ambiguous usage. Please ensure that expressions are only defined once.`);n[i]={...s,evaluate:a(`${e}_${i}`,s.evaluate),origin:{name:i,typeOrAlias:t}}})})}),new DomainBuilder(this.entities,this.aliasMap,this.$entityReflections,this.allowedRootEntityTypes,i,this.modelVersion,this.publishedData,this.sessionData,this.frontendData,this.backendData,this.migrate,this.isAdminDomain,this.actions,this.actionImplementations)}withExpressionModules(t){return n(t,this.aliasMap).reduce((t,i)=>t.withExpressions(i.expressions),this)}withActions(t){return new DomainBuilder(this.entities,this.aliasMap,this.$entityReflections,this.allowedRootEntityTypes,this.implemented,this.modelVersion,this.publishedData,this.sessionData,this.frontendData,this.backendData,this.migrate,this.isAdminDomain,Object.fromEntries(t.map(t=>[t.name,t])),this.actionImplementations)}withActionModules(t){return this.withActionImplementations(s(t))}withActionImplementations(t){return new DomainBuilder(this.entities,this.aliasMap,this.$entityReflections,this.allowedRootEntityTypes,this.implemented,this.modelVersion,this.publishedData,this.sessionData,this.frontendData,this.backendData,this.migrate,this.isAdminDomain,this.actions,{...this.actionImplementations,...t})}build=()=>{let e=this.implemented,s=this.migrate??i.fromVersions({1:this.entities}).to(1).using({}).build();return new t({aliasMap:this.aliasMap,entityReflections:this.entities,$entityReflections:this.$entityReflections,expressions:e,allowedRootEntityTypes:this.allowedRootEntityTypes,modelVersion:this.modelVersion,migrate:s,publishedData:this.publishedData,sessionData:this.sessionData,frontendData:this.frontendData,backendData:this.backendData,isAdminDomain:this.isAdminDomain,actions:this.actions,actionImplementations:this.actionImplementations})}}
1
+ import{DomainFactory as t,createMigrateFunction as i,expandAlias as e}from"./core/index.js";import{resolveActionModules as s,resolveExpressionModules as n}from"./domain-runtime/index.js";import{withProfilerLabel as a}from"./utils/profiler-label.js";export class DomainBuilder{entities;aliasMap;$entityReflections;allowedRootEntityTypes;implemented;modelVersion;publishedData;sessionData;frontendData;backendData;migrate;isAdminDomain;actions;actionImplementations;constructor(t,i,e,s,n,a,o,h,l,m,r,d,p,c){this.entities=t,this.aliasMap=i,this.$entityReflections=e,this.allowedRootEntityTypes=s,this.implemented=n,this.modelVersion=a,this.publishedData=o,this.sessionData=h,this.frontendData=l,this.backendData=m,this.migrate=r,this.isAdminDomain=d,this.actions=p,this.actionImplementations=c}static from(t,e,s,n,a,o,h,l,m,r){let d=i({1:t},1,{});return new DomainBuilder(t,e,s,n,{},a,o,h,l,m,d,r,{},{})}withMigrate(t){return new DomainBuilder(this.entities,this.aliasMap,this.$entityReflections,this.allowedRootEntityTypes,this.implemented,this.modelVersion,this.publishedData,this.sessionData,this.frontendData,this.backendData,t,this.isAdminDomain,this.actions,this.actionImplementations)}withExpressions(t){let i={...this.implemented};return Object.entries(t).forEach(([t,s])=>{e(this.aliasMap,t).forEach(e=>{let n={...i[e]};i[e]=n,Object.entries(s).forEach(([i,s])=>{let o=n[i];if(o)throw Error(`Duplicate expression ${e}.${i}: The expression is defined on both ${t} and ${o.origin.typeOrAlias}, which would lead to ambiguous usage. Please ensure that expressions are only defined once.`);n[i]={...s,evaluate:a(`${e}_${i}`,s.evaluate),origin:{name:i,typeOrAlias:t}}})})}),new DomainBuilder(this.entities,this.aliasMap,this.$entityReflections,this.allowedRootEntityTypes,i,this.modelVersion,this.publishedData,this.sessionData,this.frontendData,this.backendData,this.migrate,this.isAdminDomain,this.actions,this.actionImplementations)}withExpressionModules(t){return n(t,this.aliasMap).reduce((t,i)=>t.withExpressions(i.expressions),this)}withActions(t){return new DomainBuilder(this.entities,this.aliasMap,this.$entityReflections,this.allowedRootEntityTypes,this.implemented,this.modelVersion,this.publishedData,this.sessionData,this.frontendData,this.backendData,this.migrate,this.isAdminDomain,Object.fromEntries(t.map(t=>[t.name,t])),this.actionImplementations)}withActionModules(t){return this.withActionImplementations(s(t))}withActionImplementations(t){return new DomainBuilder(this.entities,this.aliasMap,this.$entityReflections,this.allowedRootEntityTypes,this.implemented,this.modelVersion,this.publishedData,this.sessionData,this.frontendData,this.backendData,this.migrate,this.isAdminDomain,this.actions,{...this.actionImplementations,...t})}build=()=>{let e=this.implemented,s=this.migrate??i({1:this.entities},1,{});return new t({aliasMap:this.aliasMap,entityReflections:this.entities,$entityReflections:this.$entityReflections,expressions:e,allowedRootEntityTypes:this.allowedRootEntityTypes,modelVersion:this.modelVersion,migrate:s,publishedData:this.publishedData,sessionData:this.sessionData,frontendData:this.frontendData,backendData:this.backendData,isAdminDomain:this.isAdminDomain,actions:this.actions,actionImplementations:this.actionImplementations})}}
@@ -1,5 +1,5 @@
1
- import { type $DomainEntity, type ActionContext, type ActionTypes, type DomainEntity, type DomainState, type PreparedAction } from '../../core/index.js';
2
- import type { DomainContextSelectors } from '../../domain-runtime/domain-context/index.js';
1
+ import { type $DomainEntity, type ActionTypes, type DomainEntity, type DomainState, type PreparedAction } from '../../core/index.js';
2
+ import type { ActionContext, DomainContextSelectors } from '../../domain-runtime/index.js';
3
3
  export interface ActionSystemContext {
4
4
  /**
5
5
  * The action system's window into the runtime registry: the declared actions and their
@@ -1 +1 @@
1
- import{createSelector as t}from"@salsita-ai/common/utils";import{createUpdateFactory as e,extendedSchemaValidator as s}from"../../core/index.js";import{getIdSequence as n}from"../store-system/next-domain-entity-id.js";export class ActionSystem{_context;_selectValidators=t([t.leaf(t=>t)],t=>new Map(Object.values(t).map(t=>[t.name,s.compile(t.params)])));_updates=e();constructor(t){this._context=t}createContext=t=>({expressionContext:this._context.selectors.getExpressionContext(),systems:this._context.selectors.getDomainSystems(),getIdSequence:()=>n(t.entities,[]),updates:this._updates});prepareAction=(t,e,n)=>{let o=this._context.selectors.getActionDefinitions(),i=Object.values(o).find(e=>e.name===t);if(!i){let e=Object.values(o).map(t=>`"${t.name}"`);throw Error(`Unknown action "${t}". ${e.length>0?`The application declares these actions: ${e.join(", ")}.`:"The application declares no actions."} Declare it under "actions" in a spec file and implement it in src/actions/.`)}let a=this._selectValidators(o).get(i.name);if(a&&!a(e))throw Error(`The arguments of action "${t}" do not fit its params: ${s.errorsText(a.errors)}. Nothing was changed. Send arguments that fit the params the action declares.`);return(Object.entries(this._context.selectors.getActionImplementations()).find(([e])=>e===t)?.[1])(e,n,this.createContext(n))}}
1
+ import{createSelector as t}from"@salsita-ai/common/utils";import{createUpdateFactory as e,extendedSchemaValidator as s}from"../../core/index.js";import{getIdSequence as n}from"../store-system/index.js";export class ActionSystem{_context;_selectValidators=t([t.leaf(t=>t)],t=>new Map(Object.values(t).map(t=>[t.name,s.compile(t.params)])));_updates=e();constructor(t){this._context=t}createContext=t=>({expressionContext:this._context.selectors.getExpressionContext(),systems:this._context.selectors.getDomainSystems(),getIdSequence:()=>n(t.entities,[]),updates:this._updates});prepareAction=(t,e,n)=>{let o=this._context.selectors.getActionDefinitions(),i=Object.values(o).find(e=>e.name===t);if(!i){let e=Object.values(o).map(t=>`"${t.name}"`);throw Error(`Unknown action "${t}". ${e.length>0?`The application declares these actions: ${e.join(", ")}.`:"The application declares no actions."} Declare it under "actions" in a spec file and implement it in src/actions/.`)}let a=this._selectValidators(o).get(i.name);if(a&&!a(e))throw Error(`The arguments of action "${t}" do not fit its params: ${s.errorsText(a.errors)}. Nothing was changed. Send arguments that fit the params the action declares.`);return(Object.entries(this._context.selectors.getActionImplementations()).find(([e])=>e===t)?.[1])(e,n,this.createContext(n))}}
@@ -0,0 +1 @@
1
+ export { ActionSystem, type ActionSystemContext, type AnyActionSystem } from './action-system.js';
@@ -0,0 +1 @@
1
+ export{ActionSystem}from"./action-system.js";
@@ -0,0 +1,2 @@
1
+ export { type AnalyticsEvent, AnalyticsEventFactory, AnalyticsEventType, type DataLoadedEvent, type InitEvent, type NavigationEvent, type SessionAuthenticatedEvent, type SystemEvent, type UserActionEvent, } from './analytics-contracts.js';
2
+ export { type AnalyticsSystem, NoopAnalyticsSystem } from './analytics-system.js';
@@ -0,0 +1 @@
1
+ export{AnalyticsEventFactory,AnalyticsEventType}from"./analytics-contracts.js";export{NoopAnalyticsSystem}from"./analytics-system.js";
@@ -1,5 +1,5 @@
1
1
  import type { $DomainEntity, DomainEntity } from '../core/index.js';
2
2
  import type { DomainContextSystems } from './domain-context-systems.js';
3
- import type { UpdateTransformer } from './store-system/store-system.js';
3
+ import type { UpdateTransformer } from './store-system/index.js';
4
4
  export declare const createTransformer: <ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>>, NAVIGATION_STATES extends string, VIEW_STATES extends string, TOOL_STATES extends string, EXPORT_STATES extends string>(transformer: (ctx: DomainContextSystems<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, NAVIGATION_STATES, VIEW_STATES, TOOL_STATES, EXPORT_STATES>) => UpdateTransformer<ENTITIES>) => (ctx: DomainContextSystems<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, NAVIGATION_STATES, VIEW_STATES, TOOL_STATES, EXPORT_STATES>) => UpdateTransformer<ENTITIES>;
5
5
  export type TransformerFactory<ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>>, NAVIGATION_STATES extends string, VIEW_STATES extends string, TOOL_STATES extends string, EXPORT_STATES extends string> = (transformer: (ctx: DomainContextSystems<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, NAVIGATION_STATES, VIEW_STATES, TOOL_STATES, EXPORT_STATES>) => UpdateTransformer<ENTITIES>) => (ctx: DomainContextSystems<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, NAVIGATION_STATES, VIEW_STATES, TOOL_STATES, EXPORT_STATES>) => UpdateTransformer<ENTITIES>;
@@ -1,7 +1,7 @@
1
1
  import type { DomainEntity, DomainState, EntityViolation } from '../../core/index.js';
2
2
  import { DimensionUnit, type UnitsConfig } from '../../dimensions/index.js';
3
- import type { DomainContextSelectors } from '../../domain-runtime/domain-context/index.js';
4
- import { SystemState } from '../store-system/system-state.js';
3
+ import type { DomainContextSelectors } from '../../domain-runtime/index.js';
4
+ import { SystemState } from '../store-system/index.js';
5
5
  import { type DimensionStateComponent } from './dimension-state.js';
6
6
  export type DistanceDimensionViolation = `${string}.distanceDimension.tooLarge` | `${string}.distanceDimension.tooSmall`;
7
7
  export type GenericDimensionViolation = `${string}.genericDimension.tooLarge` | `${string}.genericDimension.tooSmall`;
@@ -1 +1 @@
1
- import{AngleUnit as t,DEFAULT_DECIMAL_PLACES as e,DimensionUnit as i,defaultAngleToUnit as n,formatDistanceValue as a,isDimensionGreaterThanMax as o,isDimensionLowerThanMin as s}from"../../dimensions/index.js";import{angleDimensionComponent as l,applicationConfigComponent as m,distanceDimensionComponent as r,genericDimensionComponent as c}from"../../system-components/index.js";import{SystemState as u}from"../store-system/system-state.js";import{dimensionStateComponent as g}from"./dimension-state.js";let d={[t.degree]:"\xb0",[t.radian]:"rad"},p={mm:{strategy:"decimal",decimalPlaces:0},cm:{strategy:"decimal",decimalPlaces:1},m:{strategy:"decimal",decimalPlaces:2},inch:{strategy:"fraction",fractionBasis:[3,4]},feet:{strategy:"fraction-inch",fractionBasis:[3,4]}},h=["mm","cm","m","inch","feet"];function f(t,e){let i={sourceUnit:t.sourceUnit,displayUnit:t.displayUnit,unitDisplayConfig:t.unitDisplayConfig,locale:t.locale,omitLeadingZeroUnits:!0},n=a(t.limitValue,i),o=a(t.currentValue,i);return"tooLarge"===e?{id:"sdk.distanceDimension.hintMessageTooLarge",message:"Current value is {0}, which is larger than allowed maximum of {1}.",values:{0:o.valueWithUnit,1:n.valueWithUnit}}:{id:"sdk.distanceDimension.hintMessageTooSmall",message:"Current value is {0}, which is smaller than allowed minimum of {1}.",values:{0:o.valueWithUnit,1:n.valueWithUnit}}}function y(t,e){let i=`${t.currentValue.toFixed(t.decimalPlaces)}\u00A0${t.unit}`,n=`${t.limitValue}\u00A0${t.unit}`;return"tooLarge"===e?{id:"sdk.genericDimension.hintMessageTooLarge",message:"Current value is {currentWithUnit}, which is larger than allowed maximum of {limitWithUnit}.",values:{currentWithUnit:i,limitWithUnit:n}}:{id:"sdk.genericDimension.hintMessageTooSmall",message:"Current value is {currentWithUnit}, which is smaller than allowed minimum of {limitWithUnit}.",values:{currentWithUnit:i,limitWithUnit:n}}}function v(t,e){let i=`${n(t.currentValue,t.unit).toFixed(t.decimalPlaces)}\u00A0${t.unitLabel}`,a=`${n(t.limitValue,t.unit).toFixed(t.decimalPlaces)}\u00A0${t.unitLabel}`;return"tooLarge"===e?{id:"sdk.angleDimension.hintMessageTooLarge",message:"Current value is {currentWithUnit}, which is larger than allowed maximum of {limitWithUnit}.",values:{currentWithUnit:i,limitWithUnit:a}}:{id:"sdk.angleDimension.hintMessageTooSmall",message:"Current value is {currentWithUnit}, which is smaller than allowed minimum of {limitWithUnit}.",values:{currentWithUnit:i,limitWithUnit:a}}}export class DimensionSystem{_context;state;constructor(t){this._context=t,this.state=new u({selectors:this._context.selectors,componentType:g,getInitialState:t=>{let e=this._context.selectors.getComponentReader().readFirstRootComponent({componentTypes:[m]},t);return{unit:e?.state.initialGlobalUnit??e?.state.distanceDataUnit??i.mm}}})}initialize=t=>this.state.getInitialUpdates(t);getDimensionConfig=t=>{let e=this._context.selectors.getComponentReader().readFirstRootComponent({componentTypes:[m]},t);return{distanceDataUnit:e?.state.distanceDataUnit??i.mm,unitDisplayConfig:e?.state.unitDisplayConfig??p,availableDimensions:e?.state.availableDimensions??h}};getDataDistanceUnit=t=>this.getDimensionConfig(t).distanceDataUnit;getGlobalUnit=t=>this.state.get(t).unit;getSetGlobalUnitUpdates=(t,e)=>this.state.getUpdates(e=>({...e,unit:t}),e);_getDistanceComponentViolations=t=>{let e=this.getDimensionConfig(t),i=this.state.get(t),n=this._context.selectors.getComponentReader().readManyComponents({componentTypes:[r]},t),a=[];for(let t of n){let n=t.state.displayUnit??i.unit,l=t.state.unitDisplayConfig?.[n]??e.unitDisplayConfig[n];if(!l)throw Error(`Unit config for ${n} not found!`);let m=t.state.max;if(void 0!==m&&o(t.state.value,m)){let i={currentValue:t.state.value,limitValue:m,sourceUnit:e.distanceDataUnit,displayUnit:n,unitDisplayConfig:l};a.push({entityId:t.componentInstance.entityId,violation:{type:`${t.componentInstance.instanceName}.distanceDimension.tooLarge`,severity:"fatal",message:f({...i,locale:"en-US"},"tooLarge"),formatControlViolationMessage:(t,e)=>f({...i,locale:e.i18n.locale},"tooLarge")}})}let r=t.state.min;if(void 0!==r&&s(t.state.value,r)){let i={currentValue:t.state.value,limitValue:r,sourceUnit:e.distanceDataUnit,displayUnit:n,unitDisplayConfig:l};a.push({entityId:t.componentInstance.entityId,violation:{type:`${t.componentInstance.instanceName}.distanceDimension.tooSmall`,severity:"fatal",message:f({...i,locale:"en-US"},"tooSmall"),formatControlViolationMessage:(t,e)=>f({...i,locale:e.i18n.locale},"tooSmall")}})}}return a};_getGenericComponentViolations=t=>{let i=this._context.selectors.getComponentReader().readManyComponents({componentTypes:[c]},t),n=[];for(let t of i){if(void 0!==t.state.max&&o(t.state.value,t.state.max)){let i={currentValue:t.state.value,limitValue:t.state.max,decimalPlaces:t.state.decimalPlaces??e,unit:t.state.unit};n.push({entityId:t.componentInstance.entityId,violation:{type:`${t.componentInstance.instanceName}.genericDimension.tooLarge`,severity:"fatal",message:y(i,"tooLarge"),formatControlViolationMessage:()=>y(i,"tooLarge")}})}if(void 0!==t.state.min&&s(t.state.value,t.state.min)){let i={currentValue:t.state.value,limitValue:t.state.min,decimalPlaces:t.state.decimalPlaces??e,unit:t.state.unit};n.push({entityId:t.componentInstance.entityId,violation:{type:`${t.componentInstance.instanceName}.genericDimension.tooSmall`,severity:"fatal",message:y(i,"tooSmall"),formatControlViolationMessage:()=>y(i,"tooSmall")}})}}return n};_getAngleComponentViolations=t=>{let i=this._context.selectors.getComponentReader().readManyComponents({componentTypes:[l]},t),n=[];for(let t of i){let i=t.state.unit??"degree",a=d[i],l=t.state.decimalPlaces??e;if(void 0!==t.state.max&&o(t.state.value,t.state.max)){let e={currentValue:t.state.value,limitValue:t.state.max,unit:i,unitLabel:a,decimalPlaces:l};n.push({entityId:t.componentInstance.entityId,violation:{type:`${t.componentInstance.instanceName}.angleDimension.tooLarge`,severity:"fatal",message:v(e,"tooLarge"),formatControlViolationMessage:()=>v(e,"tooLarge")}})}if(void 0!==t.state.min&&s(t.state.value,t.state.min)){let e={currentValue:t.state.value,limitValue:t.state.min,unit:i,unitLabel:a,decimalPlaces:l};n.push({entityId:t.componentInstance.entityId,violation:{type:`${t.componentInstance.instanceName}.angleDimension.tooSmall`,severity:"fatal",message:v(e,"tooSmall"),formatControlViolationMessage:()=>v(e,"tooSmall")}})}}return n};validateState=t=>[...this._getDistanceComponentViolations(t),...this._getGenericComponentViolations(t),...this._getAngleComponentViolations(t)]}
1
+ import{AngleUnit as t,DEFAULT_DECIMAL_PLACES as e,DimensionUnit as i,defaultAngleToUnit as n,formatDistanceValue as a,isDimensionGreaterThanMax as o,isDimensionLowerThanMin as s}from"../../dimensions/index.js";import{angleDimensionComponent as l,applicationConfigComponent as m,distanceDimensionComponent as r,genericDimensionComponent as c}from"../../system-components/index.js";import{SystemState as u}from"../store-system/index.js";import{dimensionStateComponent as g}from"./dimension-state.js";let d={[t.degree]:"\xb0",[t.radian]:"rad"},p={mm:{strategy:"decimal",decimalPlaces:0},cm:{strategy:"decimal",decimalPlaces:1},m:{strategy:"decimal",decimalPlaces:2},inch:{strategy:"fraction",fractionBasis:[3,4]},feet:{strategy:"fraction-inch",fractionBasis:[3,4]}},h=["mm","cm","m","inch","feet"];function f(t,e){let i={sourceUnit:t.sourceUnit,displayUnit:t.displayUnit,unitDisplayConfig:t.unitDisplayConfig,locale:t.locale,omitLeadingZeroUnits:!0},n=a(t.limitValue,i),o=a(t.currentValue,i);return"tooLarge"===e?{id:"sdk.distanceDimension.hintMessageTooLarge",message:"Current value is {0}, which is larger than allowed maximum of {1}.",values:{0:o.valueWithUnit,1:n.valueWithUnit}}:{id:"sdk.distanceDimension.hintMessageTooSmall",message:"Current value is {0}, which is smaller than allowed minimum of {1}.",values:{0:o.valueWithUnit,1:n.valueWithUnit}}}function y(t,e){let i=`${t.currentValue.toFixed(t.decimalPlaces)}\u00A0${t.unit}`,n=`${t.limitValue}\u00A0${t.unit}`;return"tooLarge"===e?{id:"sdk.genericDimension.hintMessageTooLarge",message:"Current value is {currentWithUnit}, which is larger than allowed maximum of {limitWithUnit}.",values:{currentWithUnit:i,limitWithUnit:n}}:{id:"sdk.genericDimension.hintMessageTooSmall",message:"Current value is {currentWithUnit}, which is smaller than allowed minimum of {limitWithUnit}.",values:{currentWithUnit:i,limitWithUnit:n}}}function v(t,e){let i=`${n(t.currentValue,t.unit).toFixed(t.decimalPlaces)}\u00A0${t.unitLabel}`,a=`${n(t.limitValue,t.unit).toFixed(t.decimalPlaces)}\u00A0${t.unitLabel}`;return"tooLarge"===e?{id:"sdk.angleDimension.hintMessageTooLarge",message:"Current value is {currentWithUnit}, which is larger than allowed maximum of {limitWithUnit}.",values:{currentWithUnit:i,limitWithUnit:a}}:{id:"sdk.angleDimension.hintMessageTooSmall",message:"Current value is {currentWithUnit}, which is smaller than allowed minimum of {limitWithUnit}.",values:{currentWithUnit:i,limitWithUnit:a}}}export class DimensionSystem{_context;state;constructor(t){this._context=t,this.state=new u({selectors:this._context.selectors,componentType:g,getInitialState:t=>{let e=this._context.selectors.getComponentReader().readFirstRootComponent({componentTypes:[m]},t);return{unit:e?.state.initialGlobalUnit??e?.state.distanceDataUnit??i.mm}}})}initialize=t=>this.state.getInitialUpdates(t);getDimensionConfig=t=>{let e=this._context.selectors.getComponentReader().readFirstRootComponent({componentTypes:[m]},t);return{distanceDataUnit:e?.state.distanceDataUnit??i.mm,unitDisplayConfig:e?.state.unitDisplayConfig??p,availableDimensions:e?.state.availableDimensions??h}};getDataDistanceUnit=t=>this.getDimensionConfig(t).distanceDataUnit;getGlobalUnit=t=>this.state.get(t).unit;getSetGlobalUnitUpdates=(t,e)=>this.state.getUpdates(e=>({...e,unit:t}),e);_getDistanceComponentViolations=t=>{let e=this.getDimensionConfig(t),i=this.state.get(t),n=this._context.selectors.getComponentReader().readManyComponents({componentTypes:[r]},t),a=[];for(let t of n){let n=t.state.displayUnit??i.unit,l=t.state.unitDisplayConfig?.[n]??e.unitDisplayConfig[n];if(!l)throw Error(`Unit config for ${n} not found!`);let m=t.state.max;if(void 0!==m&&o(t.state.value,m)){let i={currentValue:t.state.value,limitValue:m,sourceUnit:e.distanceDataUnit,displayUnit:n,unitDisplayConfig:l};a.push({entityId:t.componentInstance.entityId,violation:{type:`${t.componentInstance.instanceName}.distanceDimension.tooLarge`,severity:"fatal",message:f({...i,locale:"en-US"},"tooLarge"),formatControlViolationMessage:(t,e)=>f({...i,locale:e.i18n.locale},"tooLarge")}})}let r=t.state.min;if(void 0!==r&&s(t.state.value,r)){let i={currentValue:t.state.value,limitValue:r,sourceUnit:e.distanceDataUnit,displayUnit:n,unitDisplayConfig:l};a.push({entityId:t.componentInstance.entityId,violation:{type:`${t.componentInstance.instanceName}.distanceDimension.tooSmall`,severity:"fatal",message:f({...i,locale:"en-US"},"tooSmall"),formatControlViolationMessage:(t,e)=>f({...i,locale:e.i18n.locale},"tooSmall")}})}}return a};_getGenericComponentViolations=t=>{let i=this._context.selectors.getComponentReader().readManyComponents({componentTypes:[c]},t),n=[];for(let t of i){if(void 0!==t.state.max&&o(t.state.value,t.state.max)){let i={currentValue:t.state.value,limitValue:t.state.max,decimalPlaces:t.state.decimalPlaces??e,unit:t.state.unit};n.push({entityId:t.componentInstance.entityId,violation:{type:`${t.componentInstance.instanceName}.genericDimension.tooLarge`,severity:"fatal",message:y(i,"tooLarge"),formatControlViolationMessage:()=>y(i,"tooLarge")}})}if(void 0!==t.state.min&&s(t.state.value,t.state.min)){let i={currentValue:t.state.value,limitValue:t.state.min,decimalPlaces:t.state.decimalPlaces??e,unit:t.state.unit};n.push({entityId:t.componentInstance.entityId,violation:{type:`${t.componentInstance.instanceName}.genericDimension.tooSmall`,severity:"fatal",message:y(i,"tooSmall"),formatControlViolationMessage:()=>y(i,"tooSmall")}})}}return n};_getAngleComponentViolations=t=>{let i=this._context.selectors.getComponentReader().readManyComponents({componentTypes:[l]},t),n=[];for(let t of i){let i=t.state.unit??"degree",a=d[i],l=t.state.decimalPlaces??e;if(void 0!==t.state.max&&o(t.state.value,t.state.max)){let e={currentValue:t.state.value,limitValue:t.state.max,unit:i,unitLabel:a,decimalPlaces:l};n.push({entityId:t.componentInstance.entityId,violation:{type:`${t.componentInstance.instanceName}.angleDimension.tooLarge`,severity:"fatal",message:v(e,"tooLarge"),formatControlViolationMessage:()=>v(e,"tooLarge")}})}if(void 0!==t.state.min&&s(t.state.value,t.state.min)){let e={currentValue:t.state.value,limitValue:t.state.min,unit:i,unitLabel:a,decimalPlaces:l};n.push({entityId:t.componentInstance.entityId,violation:{type:`${t.componentInstance.instanceName}.angleDimension.tooSmall`,severity:"fatal",message:v(e,"tooSmall"),formatControlViolationMessage:()=>v(e,"tooSmall")}})}}return n};validateState=t=>[...this._getDistanceComponentViolations(t),...this._getGenericComponentViolations(t),...this._getAngleComponentViolations(t)]}
@@ -0,0 +1 @@
1
+ export { type AngleDimensionViolation, type AnyDimensionSystem, DimensionSystem, type DimensionSystemContext, type DistanceDimensionViolation, type GenericDimensionViolation, } from './dimension-system.js';
@@ -0,0 +1 @@
1
+ export{DimensionSystem}from"./dimension-system.js";
@@ -1,12 +1,12 @@
1
1
  import type { $DomainEntity, ActionTypes, Domain, DomainEntity } from '../core/index.js';
2
- import type { ComponentReader, DomainContextSelectors } from '../domain-runtime/domain-context/index.js';
2
+ import type { ComponentReader, DomainContextSelectors } from '../domain-runtime/index.js';
3
3
  import type { BlenderProjections, CollisionProjections, CompositionProjections, ConstraintProjections, PositionProjections, ProjectedEntitiesProjections, SnappingProjections, ValidationProjections } from '../projections/index.js';
4
- import type { SketchingProjections } from '../sketching/sketching-projections.js';
5
- import type { ActionSystem } from './action-system/action-system.js';
6
- import type { DimensionSystem } from './dimension-system/dimension-system.js';
7
- import type { NavigationSystem } from './navigation-system/navigation-system.js';
8
- import type { RecipeCookerSystem } from './recipe-system/recipe-cooker-system.js';
9
- import type { StoreSystem } from './store-system/store-system.js';
4
+ import type { SketchingProjections } from '../sketching/index.js';
5
+ import type { ActionSystem } from './action-system/index.js';
6
+ import type { DimensionSystem } from './dimension-system/index.js';
7
+ import type { NavigationSystem } from './navigation-system/index.js';
8
+ import type { RecipeCookerSystem } from './recipe-system/index.js';
9
+ import type { StoreSystem } from './store-system/index.js';
10
10
  import type { UndoSystem } from './undo-system.js';
11
11
  /**
12
12
  * Stable domain system graph owned by one application slot in the domain runtime.