@salsita-ai/sdk 0.50.0-develop.bc08a38ffe → 0.50.0-develop.bd84173265

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 (348) hide show
  1. package/README.md +14 -13
  2. package/dist/application-spec/caching/content-diff.js +1 -1
  3. package/dist/application-spec/core/application-file.d.ts +0 -2
  4. package/dist/application-spec/core/application-file.js +1 -1
  5. package/dist/application-spec/errors/diagnostic-codes.d.ts +4 -0
  6. package/dist/application-spec/errors/diagnostic-codes.js +1 -1
  7. package/dist/application-spec/errors/diagnostic-messages.d.ts +4 -0
  8. package/dist/application-spec/errors/diagnostic-messages.js +1 -1
  9. package/dist/application-spec/generate-application/code/domain-runtime-files.js +1 -1
  10. package/dist/application-spec/generate-application/code/generate-application-code.d.ts +3 -2
  11. package/dist/application-spec/generate-application/code/generate-application-code.js +1 -1
  12. package/dist/application-spec/generate-application/code/project-scaffolding.d.ts +11 -8
  13. package/dist/application-spec/generate-application/code/project-scaffolding.js +2 -2
  14. package/dist/application-spec/generate-application/code/standalone-app-files.d.ts +2 -2
  15. package/dist/application-spec/generate-application/code/standalone-app-files.js +1 -1
  16. package/dist/application-spec/generate-application/code/templates/configurator-config.js +6 -4
  17. package/dist/application-spec/generate-application/code/templates/eslint-config.d.ts +5 -0
  18. package/dist/application-spec/generate-application/code/templates/eslint-config.js +4 -5
  19. package/dist/application-spec/generate-application/code/templates/frontend-config.js +3 -5
  20. package/dist/application-spec/generate-application/code/templates/gitignore.js +0 -3
  21. package/dist/application-spec/generate-application/code/templates/globals.js +3 -4
  22. package/dist/application-spec/generate-application/code/templates/index.d.ts +1 -1
  23. package/dist/application-spec/generate-application/code/templates/index.js +1 -1
  24. package/dist/application-spec/generate-application/code/templates/lingui-rc.d.ts +5 -0
  25. package/dist/application-spec/generate-application/code/templates/lingui-rc.js +4 -4
  26. package/dist/application-spec/generate-application/code/templates/package-json.js +1 -1
  27. package/dist/application-spec/generate-application/code/templates/prettier-config.d.ts +5 -0
  28. package/dist/application-spec/generate-application/code/templates/prettier-config.js +4 -5
  29. package/dist/application-spec/generate-application/code/templates/root-tsconfig.d.ts +6 -0
  30. package/dist/application-spec/generate-application/code/templates/root-tsconfig.js +2 -0
  31. package/dist/application-spec/generate-application/code/templates/skills/phoenix-cli-skill.js +1 -1
  32. package/dist/application-spec/generate-application/code/templates/skills/phoenix-review-skill.js +1 -1
  33. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +13 -7
  34. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +2 -2
  35. package/dist/application-spec/generate-application/code/templates/tsconfig.d.ts +5 -0
  36. package/dist/application-spec/generate-application/code/templates/tsconfig.js +1 -1
  37. package/dist/application-spec/generate-application/code/templates/webhook-index.d.ts +6 -1
  38. package/dist/application-spec/generate-application/code/templates/webhook-index.js +10 -1
  39. package/dist/application-spec/generate-application/code/templates/webhooks-config.js +2 -3
  40. package/dist/application-spec/generate-application/index.d.ts +2 -0
  41. package/dist/application-spec/generate-application/index.js +1 -1
  42. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-model-runtime.d.ts +4 -3
  43. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.d.ts +7 -3
  44. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.js +1 -1
  45. package/dist/application-spec/generate-application/runtime/admin-runtime/states-runtime.d.ts +2 -2
  46. package/dist/application-spec/generate-application/runtime/application-runtime.d.ts +13 -5
  47. package/dist/application-spec/generate-application/runtime/application-runtime.js +1 -1
  48. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-model-runtime.d.ts +4 -3
  49. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.d.ts +6 -2
  50. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.js +1 -1
  51. package/dist/application-spec/generate-application/runtime/configurator-runtime/states-runtime.d.ts +2 -2
  52. package/dist/application-spec/generate-application/runtime/factory-data/factory-data-runtime.d.ts +43 -0
  53. package/dist/application-spec/generate-application/runtime/factory-data/factory-data-runtime.js +1 -0
  54. package/dist/application-spec/generate-application/runtime/factory-data/index.d.ts +3 -0
  55. package/dist/application-spec/generate-application/runtime/factory-data/index.js +1 -0
  56. package/dist/application-spec/generate-application/runtime/factory-data/recipe-defaults.d.ts +13 -0
  57. package/dist/application-spec/generate-application/runtime/factory-data/recipe-defaults.js +1 -0
  58. package/dist/application-spec/generate-application/runtime/factory-data/static-violations.d.ts +16 -0
  59. package/dist/application-spec/generate-application/runtime/factory-data/static-violations.js +1 -0
  60. package/dist/application-spec/generate-application/runtime/migrations/index.d.ts +1 -0
  61. package/dist/application-spec/generate-application/runtime/migrations/index.js +1 -0
  62. package/dist/application-spec/generate-application/runtime/migrations/migration-runtime.d.ts +53 -0
  63. package/dist/application-spec/generate-application/runtime/migrations/migration-runtime.js +1 -0
  64. package/dist/application-spec/generate-application/runtime/sections/assistant-runtime.d.ts +2 -2
  65. package/dist/application-spec/generate-application/runtime/sections/data-runtime.d.ts +4 -4
  66. package/dist/application-spec/generate-application/runtime/sections/expression-runtime.d.ts +3 -2
  67. package/dist/application-spec/generate-application/runtime/sections/theme-runtime.d.ts +2 -2
  68. package/dist/application-spec/generate-application/runtime/sections/transformers-runtime.d.ts +3 -3
  69. package/dist/application-spec/generate-application/runtime-spec/decode-runtime-spec.d.ts +9 -0
  70. package/dist/application-spec/generate-application/runtime-spec/decode-runtime-spec.js +1 -0
  71. package/dist/application-spec/generate-application/runtime-spec/encode-runtime-spec.d.ts +8 -0
  72. package/dist/application-spec/generate-application/runtime-spec/encode-runtime-spec.js +1 -0
  73. package/dist/application-spec/generate-application/runtime-spec/encoded-runtime-spec.d.ts +27 -0
  74. package/dist/application-spec/generate-application/runtime-spec/encoded-runtime-spec.js +1 -0
  75. package/dist/application-spec/generate-application/runtime-spec/index.d.ts +4 -0
  76. package/dist/application-spec/generate-application/runtime-spec/index.js +1 -0
  77. package/dist/application-spec/generate-application/runtime-spec/runtime-spec.d.ts +68 -0
  78. package/dist/application-spec/generate-application/runtime-spec/runtime-spec.js +1 -0
  79. package/dist/application-spec/parse-application-files/categorize/categorize-files.d.ts +34 -0
  80. package/dist/application-spec/parse-application-files/categorize/categorize-files.js +1 -1
  81. package/dist/application-spec/parse-application-files/categorize/earlier-generated-editor-configs.d.ts +16 -0
  82. package/dist/application-spec/parse-application-files/categorize/earlier-generated-editor-configs.js +9 -0
  83. package/dist/application-spec/parse-application-files/categorize/earlier-generated-tsconfig.d.ts +9 -0
  84. package/dist/application-spec/parse-application-files/categorize/earlier-generated-tsconfig.js +1 -0
  85. package/dist/application-spec/parse-application-files/raw-spec/parse-yaml-spec-file.js +1 -1
  86. package/dist/application-spec/parse-application-files/spec/application/admin-spec/admin-spec.js +1 -1
  87. package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.js +1 -1
  88. package/dist/application-spec/parse-application-files/spec/common/index.d.ts +1 -0
  89. package/dist/application-spec/parse-application-files/spec/common/index.js +1 -1
  90. package/dist/application-spec/parse-application-files/spec/common/value-type/format-value-type.d.ts +3 -0
  91. package/dist/application-spec/parse-application-files/spec/common/value-type/format-value-type.js +1 -0
  92. package/dist/application-spec/parse-application-files/spec/common/value-type/index.d.ts +5 -0
  93. package/dist/application-spec/parse-application-files/spec/common/value-type/index.js +1 -0
  94. package/dist/application-spec/parse-application-files/spec/common/value-type/intersect-value-types.d.ts +6 -0
  95. package/dist/application-spec/parse-application-files/spec/common/value-type/intersect-value-types.js +1 -0
  96. package/dist/application-spec/parse-application-files/spec/common/value-type/is-assignable-value-type.d.ts +8 -0
  97. package/dist/application-spec/parse-application-files/spec/common/value-type/is-assignable-value-type.js +1 -0
  98. package/dist/application-spec/parse-application-files/spec/common/value-type/value-type-at.d.ts +10 -0
  99. package/dist/application-spec/parse-application-files/spec/common/value-type/value-type-at.js +1 -0
  100. package/dist/application-spec/parse-application-files/spec/common/value-type/value-type.d.ts +98 -0
  101. package/dist/application-spec/parse-application-files/spec/common/value-type/value-type.js +1 -0
  102. package/dist/application-spec/parse-application-files/spec/components/bindings/component-path.d.ts +13 -0
  103. package/dist/application-spec/parse-application-files/spec/components/bindings/component-path.js +1 -0
  104. package/dist/application-spec/parse-application-files/spec/components/bindings/index.d.ts +2 -0
  105. package/dist/application-spec/parse-application-files/spec/components/bindings/index.js +1 -1
  106. package/dist/application-spec/parse-application-files/spec/components/bindings/read-binding-type.d.ts +24 -0
  107. package/dist/application-spec/parse-application-files/spec/components/bindings/read-binding-type.js +1 -0
  108. package/dist/application-spec/parse-application-files/spec/components/component-state-type.d.ts +8 -0
  109. package/dist/application-spec/parse-application-files/spec/components/component-state-type.js +1 -0
  110. package/dist/application-spec/parse-application-files/spec/components/filter-criterion-types.d.ts +13 -0
  111. package/dist/application-spec/parse-application-files/spec/components/filter-criterion-types.js +1 -0
  112. package/dist/application-spec/parse-application-files/spec/components/static-entity-id.d.ts +14 -0
  113. package/dist/application-spec/parse-application-files/spec/components/static-entity-id.js +1 -0
  114. package/dist/application-spec/parse-application-files/spec/components/user-component-entry.d.ts +6 -0
  115. package/dist/application-spec/parse-application-files/spec/components/user-component-entry.js +1 -1
  116. package/dist/application-spec/parse-application-files/spec/components/user-components.d.ts +7 -4
  117. package/dist/application-spec/parse-application-files/spec/components/user-components.js +1 -1
  118. package/dist/application-spec/parse-application-files/spec/expressions/expression-read-types.d.ts +19 -0
  119. package/dist/application-spec/parse-application-files/spec/expressions/expression-read-types.js +1 -0
  120. package/dist/application-spec/parse-application-files/spec/expressions/expression-read.d.ts +13 -0
  121. package/dist/application-spec/parse-application-files/spec/expressions/expression-read.js +1 -0
  122. package/dist/application-spec/parse-application-files/spec/expressions/expressions.d.ts +6 -2
  123. package/dist/application-spec/parse-application-files/spec/expressions/expressions.js +1 -1
  124. package/dist/application-spec/parse-application-files/spec/invariants/invariants.d.ts +2 -2
  125. package/dist/application-spec/parse-application-files/spec/invariants/invariants.js +1 -1
  126. package/dist/application-spec/parse-application-files/spec/model/index.d.ts +1 -0
  127. package/dist/application-spec/parse-application-files/spec/model/index.js +1 -1
  128. package/dist/application-spec/parse-application-files/spec/model/model-type-resolution.d.ts +10 -0
  129. package/dist/application-spec/parse-application-files/spec/model/model-type-resolution.js +1 -0
  130. package/dist/client/phoenix-api.d.ts +367 -0
  131. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +36 -1
  132. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
  133. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.d.ts +7 -1
  134. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -1
  135. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +6 -0
  136. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
  137. package/dist/configurator/common/configurator-interface.d.ts +16 -1
  138. package/dist/configurator/common/configurator-interface.js +1 -1
  139. package/dist/configurator/common/index.d.ts +2 -0
  140. package/dist/configurator/common/index.js +1 -1
  141. package/dist/configurator/common/use-finalize-action.d.ts +31 -0
  142. package/dist/configurator/common/use-finalize-action.js +1 -0
  143. package/dist/configurator/common/use-reset-camera.d.ts +6 -0
  144. package/dist/configurator/common/use-reset-camera.js +1 -0
  145. package/dist/configurator/pages/DefaultConfiguratorLayout.d.ts +3 -2
  146. package/dist/configurator/pages/LoadedConfiguratorDetailPage.js +1 -1
  147. package/dist/configurator/pages/configurator-layout-name.d.ts +2 -0
  148. package/dist/configurator/pages/configurator-layout-name.js +1 -0
  149. package/dist/configurator/pages/default-configurator-elements.d.ts +8 -0
  150. package/dist/configurator/pages/default-configurator-elements.js +1 -0
  151. package/dist/configurator/pages/default-elements/built-in-entity-element.d.ts +10 -0
  152. package/dist/configurator/pages/default-elements/built-in-entity-element.js +1 -0
  153. package/dist/configurator/pages/default-elements/built-in-layout-element.d.ts +10 -0
  154. package/dist/configurator/pages/default-elements/built-in-layout-element.js +1 -0
  155. package/dist/configurator/pages/default-elements/domain-control-elements.d.ts +6 -0
  156. package/dist/configurator/pages/default-elements/domain-control-elements.js +1 -0
  157. package/dist/configurator/pages/default-elements/index.d.ts +4 -0
  158. package/dist/configurator/pages/default-elements/index.js +1 -0
  159. package/dist/configurator/pages/default-elements/recipe-panel-elements.d.ts +3 -0
  160. package/dist/configurator/pages/default-elements/recipe-panel-elements.js +1 -0
  161. package/dist/configurator/pages/default-elements/sidebar-footer-elements.d.ts +7 -0
  162. package/dist/configurator/pages/default-elements/sidebar-footer-elements.js +1 -0
  163. package/dist/configurator/pages/default-elements/toolbar-elements.d.ts +7 -0
  164. package/dist/configurator/pages/default-elements/toolbar-elements.js +1 -0
  165. package/dist/configurator/pages/index.d.ts +1 -0
  166. package/dist/configurator/pages/index.js +1 -1
  167. package/dist/configurator/ui/assistant/AssistantChips.d.ts +8 -2
  168. package/dist/configurator/ui/assistant/AssistantChips.js +1 -1
  169. package/dist/configurator/ui/assistant/AssistantMarkdown.d.ts +7 -2
  170. package/dist/configurator/ui/assistant/AssistantMarkdown.js +1 -1
  171. package/dist/configurator/ui/assistant/AssistantPanel.js +1 -1
  172. package/dist/configurator/ui/assistant/AssistantThread.js +1 -1
  173. package/dist/configurator/ui/assistant/entity-link/AssistantEntityLink.d.ts +1 -1
  174. package/dist/configurator/ui/assistant/entity-link/AssistantEntityLink.js +1 -1
  175. package/dist/configurator/ui/assistant/entity-link/entity-link-state.d.ts +1 -1
  176. package/dist/configurator/ui/assistant/entity-link/index.d.ts +0 -1
  177. package/dist/configurator/ui/assistant/entity-link/index.js +1 -1
  178. package/dist/configurator/ui/assistant/form/AssistantForm.d.ts +19 -0
  179. package/dist/configurator/ui/assistant/form/AssistantForm.js +1 -0
  180. package/dist/configurator/ui/assistant/form/built-in-form-registry.d.ts +10 -0
  181. package/dist/configurator/ui/assistant/form/built-in-form-registry.js +1 -0
  182. package/dist/configurator/ui/assistant/form/compose-answer.d.ts +11 -0
  183. package/dist/configurator/ui/assistant/form/compose-answer.js +1 -0
  184. package/dist/configurator/ui/assistant/form/describe-build-errors.d.ts +6 -0
  185. package/dist/configurator/ui/assistant/form/describe-build-errors.js +1 -0
  186. package/dist/configurator/ui/assistant/form/form-element-definition.d.ts +14 -0
  187. package/dist/configurator/ui/assistant/form/form-element-definition.js +1 -0
  188. package/dist/configurator/ui/assistant/form/form-model.d.ts +38 -0
  189. package/dist/configurator/ui/assistant/form/form-model.js +1 -0
  190. package/dist/configurator/ui/assistant/form/form-registry.d.ts +31 -0
  191. package/dist/configurator/ui/assistant/form/form-registry.js +8 -0
  192. package/dist/configurator/ui/assistant/form/form-state.d.ts +4 -0
  193. package/dist/configurator/ui/assistant/form/form-state.js +1 -0
  194. package/dist/configurator/ui/assistant/form/index.d.ts +2 -0
  195. package/dist/configurator/ui/assistant/form/index.js +1 -0
  196. package/dist/configurator/ui/assistant/form/parse-form-block.d.ts +9 -0
  197. package/dist/configurator/ui/assistant/form/parse-form-block.js +1 -0
  198. package/dist/configurator/ui/assistant/form/read-form-attributes.d.ts +13 -0
  199. package/dist/configurator/ui/assistant/form/read-form-attributes.js +1 -0
  200. package/dist/configurator/ui/assistant/form-elements/FormGroup.d.ts +3 -0
  201. package/dist/configurator/ui/assistant/form-elements/FormGroup.js +1 -0
  202. package/dist/configurator/ui/assistant/form-elements/FormOptions.d.ts +3 -0
  203. package/dist/configurator/ui/assistant/form-elements/FormOptions.js +1 -0
  204. package/dist/configurator/ui/assistant/form-elements/FormReply.d.ts +3 -0
  205. package/dist/configurator/ui/assistant/form-elements/FormReply.js +1 -0
  206. package/dist/configurator/ui/assistant/form-elements/FormText.d.ts +3 -0
  207. package/dist/configurator/ui/assistant/form-elements/FormText.js +1 -0
  208. package/dist/configurator/ui/assistant/form-elements/form-element-props.d.ts +34 -0
  209. package/dist/configurator/ui/assistant/form-elements/form-element-props.js +1 -0
  210. package/dist/configurator/ui/assistant/form-elements/index.d.ts +5 -0
  211. package/dist/configurator/ui/assistant/form-elements/index.js +1 -0
  212. package/dist/configurator/ui/assistant/reference-link/AssistantReferenceLink.d.ts +16 -0
  213. package/dist/configurator/ui/assistant/reference-link/AssistantReferenceLink.js +1 -0
  214. package/dist/configurator/ui/assistant/reference-link/assistant-link-target.d.ts +34 -0
  215. package/dist/configurator/ui/assistant/reference-link/assistant-link-target.js +1 -0
  216. package/dist/configurator/ui/assistant/reference-link/assistant-reference-details.d.ts +25 -0
  217. package/dist/configurator/ui/assistant/reference-link/assistant-reference-details.js +1 -0
  218. package/dist/configurator/ui/assistant/reference-link/index.d.ts +3 -0
  219. package/dist/configurator/ui/assistant/reference-link/index.js +1 -0
  220. package/dist/configurator/ui/assistant/reference-link/reference-styles.d.ts +12 -0
  221. package/dist/configurator/ui/assistant/reference-link/reference-styles.js +1 -0
  222. package/dist/configurator/ui/assistant/reference-link/use-assistant-reference-details.d.ts +8 -0
  223. package/dist/configurator/ui/assistant/reference-link/use-assistant-reference-details.js +1 -0
  224. package/dist/configurator/ui/assistant/streamed-markdown.d.ts +2 -0
  225. package/dist/configurator/ui/assistant/streamed-markdown.js +2 -2
  226. package/dist/configurator/ui/assistant/thread-items.d.ts +8 -1
  227. package/dist/configurator/ui/assistant/thread-items.js +1 -1
  228. package/dist/docs/controls/select-child-entity/cardselect.mdx +1 -0
  229. package/dist/docs/fabs/basic.mdx +2 -2
  230. package/dist/docs/index.json +1 -1
  231. package/dist/docs/layouts/custom-layout.mdx +1466 -196
  232. package/dist/docs/phoenix/components.mdx +6 -0
  233. package/dist/docs/phoenix/configurator-interface.mdx +66 -13
  234. package/dist/docs/phoenix/deployments.mdx +2 -6
  235. package/dist/docs/phoenix/domain-model.mdx +2 -0
  236. package/dist/docs/phoenix/finalization.mdx +1 -1
  237. package/dist/docs/phoenix/getting-started.mdx +2 -1
  238. package/dist/docs/phoenix/layout-slots.mdx +4 -2
  239. package/dist/docs/phoenix/localization.mdx +8 -6
  240. package/dist/docs/phoenix/migration-guide.mdx +21 -8
  241. package/dist/docs/phoenix/phoenix-cli.mdx +46 -10
  242. package/dist/docs/phoenix/project-structure.mdx +31 -12
  243. package/dist/docs/phoenix/sdk-builder-workflow.mdx +2 -2
  244. package/dist/docs/phoenix/webhooks.mdx +21 -4
  245. package/dist/domain/application/application-config.d.ts +3 -1
  246. package/dist/domain/application/assistant/assistant-form-elements.d.ts +28 -0
  247. package/dist/domain/application/assistant/assistant-form-elements.js +1 -0
  248. package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
  249. package/dist/domain/application/assistant/index.d.ts +2 -0
  250. package/dist/domain/application/assistant/index.js +1 -1
  251. package/dist/domain/application/assistant-recipe-groups.d.ts +3 -1
  252. package/dist/domain/application/configurator-builder.d.ts +4 -1
  253. package/dist/domain/application/configurator-builder.js +1 -1
  254. package/dist/domain/core/schema/extended-schema-validator.js +1 -1
  255. package/dist/domain/domain-context/index.d.ts +1 -1
  256. package/dist/domain/domain-context/undo-system.d.ts +28 -1
  257. package/dist/domain/domain-context/undo-system.js +1 -1
  258. package/dist/domain/domain-runtime/spec/initialize.js +1 -1
  259. package/dist/domain/domain-runtime/spec/selectors.js +1 -1
  260. package/dist/domain/domain-runtime/spec/types.d.ts +2 -0
  261. package/dist/domain/system-components/child-entity-selection.js +1 -1
  262. package/dist/domain/system-components/common/scene-entity-control-schema.d.ts +3 -0
  263. package/dist/domain/system-components/common/scene-entity-control-schema.js +1 -1
  264. package/dist/globals/index.d.ts +2 -0
  265. package/dist/i18n/locales/cs/messages.js +1 -1
  266. package/dist/i18n/locales/da/messages.js +1 -1
  267. package/dist/i18n/locales/de/messages.js +1 -1
  268. package/dist/i18n/locales/de-AT/messages.js +1 -1
  269. package/dist/i18n/locales/en/messages.js +1 -1
  270. package/dist/i18n/locales/en-AU/messages.js +1 -1
  271. package/dist/i18n/locales/en-GB/messages.js +1 -1
  272. package/dist/i18n/locales/es/messages.js +1 -1
  273. package/dist/i18n/locales/fr/messages.js +1 -1
  274. package/dist/i18n/locales/hu/messages.js +1 -1
  275. package/dist/i18n/locales/it/messages.js +1 -1
  276. package/dist/i18n/locales/nl/messages.js +1 -1
  277. package/dist/i18n/locales/pl/messages.js +1 -1
  278. package/dist/i18n/locales/pt/messages.js +1 -1
  279. package/dist/i18n/locales/ro/messages.js +1 -1
  280. package/dist/i18n/locales/sk/messages.js +1 -1
  281. package/dist/i18n/locales/tr/messages.js +1 -1
  282. package/dist/legacy/domain-cli/utils/cache.d.ts +1 -1
  283. package/dist/legacy/domain-cli/utils/cache.js +1 -1
  284. package/dist/legacy/domain-spec/__generated/domain-schema.d.ts +79 -80
  285. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/claude-md.d.ts +1 -1
  286. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/cursor-rules.d.ts +1 -1
  287. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.d.ts +1 -1
  288. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.js +7 -2
  289. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-admin.js +18 -16
  290. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-configurator.js +14 -12
  291. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-embedded-admin.js +13 -11
  292. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-embedded-configurator.js +13 -11
  293. package/dist/phoenix/application-spec/application-spec-builder.js +1 -1
  294. package/dist/phoenix/application-spec/generate-application-spec-story.js +2 -2
  295. package/dist/phoenix/application-spec/project-files.js +1 -1
  296. package/dist/phoenix/bin.d.ts +2 -0
  297. package/dist/phoenix/bin.js +2 -0
  298. package/dist/phoenix/check-configs/built-in-eslint-config.d.ts +9 -0
  299. package/dist/phoenix/check-configs/built-in-eslint-config.js +1 -0
  300. package/dist/phoenix/check-configs/eslint-config.d.ts +10 -0
  301. package/dist/phoenix/check-configs/eslint-config.js +1 -0
  302. package/dist/phoenix/check-configs/index.d.ts +8 -0
  303. package/dist/phoenix/check-configs/index.js +1 -0
  304. package/dist/phoenix/check-configs/typescript-project.d.ts +5 -0
  305. package/dist/phoenix/check-configs/typescript-project.js +1 -0
  306. package/dist/phoenix/cli.d.ts +0 -1
  307. package/dist/phoenix/cli.js +1 -2
  308. package/dist/phoenix/commands/check.js +1 -1
  309. package/dist/phoenix/commands/deps/deps.d.ts +52 -0
  310. package/dist/phoenix/commands/deps/deps.js +3 -0
  311. package/dist/phoenix/commands/deps/index.d.ts +1 -0
  312. package/dist/phoenix/commands/deps/index.js +1 -0
  313. package/dist/phoenix/commands/deps/sdk-manifest.d.ts +12 -0
  314. package/dist/phoenix/commands/deps/sdk-manifest.js +1 -0
  315. package/dist/phoenix/commands/dev.js +5 -5
  316. package/dist/phoenix/commands/fix.js +1 -1
  317. package/dist/phoenix/commands/index.d.ts +1 -0
  318. package/dist/phoenix/commands/index.js +1 -1
  319. package/dist/phoenix/commands/prettier.js +1 -1
  320. package/dist/phoenix/services/application-spec-project-watcher.d.ts +2 -0
  321. package/dist/phoenix/services/application-spec-project-watcher.js +3 -3
  322. package/dist/phoenix/services/lingui.d.ts +8 -0
  323. package/dist/phoenix/services/lingui.js +1 -1
  324. package/dist/phoenix/services/swc.js +1 -1
  325. package/dist/phoenix/services/vite-config.js +1 -1
  326. package/dist/phoenix/utils/index.d.ts +2 -1
  327. package/dist/phoenix/utils/index.js +1 -1
  328. package/dist/phoenix/utils/node-version/index.d.ts +1 -0
  329. package/dist/phoenix/utils/node-version/index.js +1 -0
  330. package/dist/phoenix/utils/node-version/supported-node-version.d.ts +12 -0
  331. package/dist/phoenix/utils/node-version/supported-node-version.js +4 -0
  332. package/dist/phoenix/utils/run-command.d.ts +11 -0
  333. package/dist/phoenix/utils/run-command.js +1 -1
  334. package/dist/phoenix/utils/sdk-tool/index.d.ts +1 -0
  335. package/dist/phoenix/utils/sdk-tool/index.js +1 -0
  336. package/dist/phoenix/utils/sdk-tool/resolve-sdk-tool-bin.d.ts +15 -0
  337. package/dist/phoenix/utils/sdk-tool/resolve-sdk-tool-bin.js +1 -0
  338. package/dist/react-sdk/domain-context/index.d.ts +1 -1
  339. package/dist/react-sdk/domain-context/index.js +1 -1
  340. package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.d.ts +5 -0
  341. package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.js +1 -1
  342. package/dist/ui-sdk/theme/types.d.ts +1 -1
  343. package/package.json +46 -35
  344. package/schema/domain-spec.json +86 -8
  345. package/dist/application-spec/generate-application/code/templates/webhook-implementation.d.ts +0 -1
  346. package/dist/application-spec/generate-application/code/templates/webhook-implementation.js +0 -7
  347. package/dist/configurator/ui/assistant/entity-link/entity-link-target.d.ts +0 -5
  348. package/dist/configurator/ui/assistant/entity-link/entity-link-target.js +0 -1
@@ -1 +1 @@
1
- import{Branded as t}from"@salsita-ai/common/utils";import{ActionsRuntime as o}from"../sections/actions-runtime.js";import{AssistantRuntime as e}from"../sections/assistant-runtime.js";import{ComponentOptics as r}from"../sections/component-optic.js";import{ExpressionRuntime as s}from"../sections/expression-runtime.js";import{PresetRuntime as i}from"../sections/preset-runtime.js";import{ThemeRuntime as n}from"../sections/theme-runtime.js";import{TransformersRuntime as m}from"../sections/transformers-runtime.js";import{ConfiguratorModelRuntime as u}from"./configurator-model-runtime.js";import{ConfiguratorStatesRuntime as c}from"./states-runtime.js";export const ConfiguratorRuntime=(p,a,f,g,R)=>{let j=u(p.configurator,a),x=s(p.configurator,a,f,"configuratorExpressionRuntime",R);return x.ok?{ok:!0,runtime:t({modelRuntime:j,componentOptics:r(a,{components:p.configurator.components,referenceScope:"configuratorRuntime/componentOptics",modelRuntime:j}),presetRuntime:i(a,{referenceScope:"configuratorRuntime/presetRuntime",presets:p.configurator.presets.presets}),statesRuntime:c(p,a),expressionRuntime:x.runtime,themeRuntime:n(p,a),transformersRuntime:m(p,a,g),assistantRuntime:e(p,a),actionsRuntime:o(p.configurator.actions,a)})}:{ok:!1,missingExpressions:x.missing}};
1
+ import{Branded as t}from"@salsita-ai/common/utils";import{FactoryDataRuntime as e}from"../factory-data/index.js";import{MigrationRuntime as i}from"../migrations/index.js";import{ActionsRuntime as o}from"../sections/actions-runtime.js";import{AssistantRuntime as r}from"../sections/assistant-runtime.js";import{ComponentOptics as n}from"../sections/component-optic.js";import{ExpressionRuntime as s}from"../sections/expression-runtime.js";import{PresetRuntime as m}from"../sections/preset-runtime.js";import{ThemeRuntime as a}from"../sections/theme-runtime.js";import{TransformersRuntime as u}from"../sections/transformers-runtime.js";import{ConfiguratorModelRuntime as c}from"./configurator-model-runtime.js";import{ConfiguratorStatesRuntime as f}from"./states-runtime.js";export const ConfiguratorRuntime=(p,g,R,j,l,d)=>{let x=c(p.configurator,g),v=s(p.configurator,g,R,"configuratorExpressionRuntime",l);return v.ok?{ok:!0,runtime:t({modelRuntime:x,componentOptics:n(g,{components:p.configurator.components,referenceScope:"configuratorRuntime/componentOptics",modelRuntime:x}),presetRuntime:m(g,{referenceScope:"configuratorRuntime/presetRuntime",presets:p.configurator.presets.presets}),statesRuntime:f(p,g),expressionRuntime:v.runtime,themeRuntime:a(p,g),transformersRuntime:u(p,g,j),assistantRuntime:r(p,g),actionsRuntime:o(p.configurator.actions,g),migrationRuntime:i(g,{referenceScope:"configuratorRuntime/migrationRuntime",resolvedVersions:p.configurator.resolvedVersions,latestEntities:x.entities,migrationModules:d}),factoryDataRuntime:e(g,{referenceScope:"configuratorRuntime/factoryDataRuntime",invariants:p.configurator.invariants,defaults:p.configurator.defaults,aliases:x.aliases,entities:x.entities})})}:{ok:!1,missingExpressions:v.missing}};
@@ -1,6 +1,6 @@
1
1
  import { Branded } from '@salsita-ai/common/utils';
2
2
  import type { RuntimeReferenceStore } from '../../../caching/index.js';
3
- import type { ApplicationSpec } from '../../../parse-application-files/index.js';
3
+ import type { RuntimeSpec } from '../../runtime-spec/index.js';
4
4
  export type ConfiguratorStatesRuntime = Branded<'ConfiguratorStatesRuntime', {
5
5
  readonly navigationStates: readonly string[];
6
6
  readonly viewStates: readonly string[];
@@ -8,4 +8,4 @@ export type ConfiguratorStatesRuntime = Branded<'ConfiguratorStatesRuntime', {
8
8
  readonly exportStates: readonly string[];
9
9
  readonly changed: boolean;
10
10
  }>;
11
- export declare const ConfiguratorStatesRuntime: (spec: ApplicationSpec, referenceStore: RuntimeReferenceStore) => ConfiguratorStatesRuntime;
11
+ export declare const ConfiguratorStatesRuntime: (spec: RuntimeSpec, referenceStore: RuntimeReferenceStore) => ConfiguratorStatesRuntime;
@@ -0,0 +1,43 @@
1
+ import { Branded } from '@salsita-ai/common/utils';
2
+ import type { AnyEntityReflections, DomainEntity, DomainEntityReflection } from '#package/domain';
3
+ import type { RuntimeReferenceStore } from '../../../caching/index.js';
4
+ import type { Defaults, Invariants } from '../../../parse-application-files/index.js';
5
+ import { type RecipeDefaults } from './recipe-defaults.js';
6
+ import { type StaticViolations } from './static-violations.js';
7
+ interface FactoryDataRuntimeFields {
8
+ /**
9
+ * The member types of each alias: what `phx.domain.attachComponent` expands an alias with, and
10
+ * what `phx.domain.createRecipe` expands alias defaults with.
11
+ */
12
+ readonly aliases: Readonly<Record<string, readonly string[]>>;
13
+ /** The entity reflections `phx.domain.createRecipe` validates the defaults with. */
14
+ readonly entityReflections: ReadonlyArray<DomainEntityReflection<DomainEntity<string>>>;
15
+ /** The violations `phx.domain.implementCustomInvariants` reports for a static invariant that fails. */
16
+ readonly staticViolations: StaticViolations;
17
+ /** The defaults `phx.domain.createRecipe` puts into a new recipe. */
18
+ readonly defaults: RecipeDefaults;
19
+ readonly changed: boolean;
20
+ }
21
+ /**
22
+ * The data the `phx.domain` factories of one domain carry, built from the parsed spec: the static
23
+ * violations of `implementCustomInvariants`, the aliases of `attachComponent`, and the aliases,
24
+ * entity reflections and defaults of `createRecipe`. Generated `domain-spec.ts` passes the same
25
+ * values to those factories as literals; with this section the factories can be built from the
26
+ * spec instead. The configurator and the admin domain each have one.
27
+ */
28
+ export type FactoryDataRuntime = Branded<'FactoryDataRuntime', FactoryDataRuntimeFields>;
29
+ interface FactoryDataRuntimeInput {
30
+ readonly invariants: Invariants;
31
+ readonly defaults: Defaults;
32
+ readonly aliases: Readonly<Record<string, readonly string[]>>;
33
+ readonly entities: AnyEntityReflections;
34
+ }
35
+ interface FactoryDataRuntimeProps extends FactoryDataRuntimeInput {
36
+ readonly referenceScope: string;
37
+ }
38
+ /**
39
+ * Builds the factory data of one domain. The result keeps its reference while the invariants and
40
+ * defaults are equal and the model runtime's aliases and entity reflections are the same objects.
41
+ */
42
+ export declare const FactoryDataRuntime: (referenceStore: RuntimeReferenceStore, props: FactoryDataRuntimeProps) => FactoryDataRuntime;
43
+ export {};
@@ -0,0 +1 @@
1
+ import e from"lodash-es/isEqual.js";import{Branded as t}from"@salsita-ai/common/utils";import{createRecipeDefaults as i}from"./recipe-defaults.js";import{createStaticViolations as s}from"./static-violations.js";let a=e=>({aliases:e.aliases,entityReflections:Object.values(e.entities),staticViolations:s(e.invariants),defaults:i(e.defaults)});export const FactoryDataRuntime=(i,s)=>{let n=i.createBuilder(s.referenceScope,{build:a,getKey:()=>"singleton",compare:(t,i)=>t.aliases===i.aliases&&t.entities===i.entities&&e(t.invariants.entries,i.invariants.entries)&&e(t.defaults.entries,i.defaults.entries)}).build({invariants:s.invariants,defaults:s.defaults,aliases:s.aliases,entities:s.entities});return t({...n.output,changed:n.changed})};
@@ -0,0 +1,3 @@
1
+ export { FactoryDataRuntime } from './factory-data-runtime.js';
2
+ export type { RecipeDefaults } from './recipe-defaults.js';
3
+ export type { StaticViolations } from './static-violations.js';
@@ -0,0 +1 @@
1
+ export{FactoryDataRuntime}from"./factory-data-runtime.js";
@@ -0,0 +1,13 @@
1
+ import type { Defaults } from '../../../parse-application-files/index.js';
2
+ /**
3
+ * The default property values of each entity type, keyed by entity type: what
4
+ * `phx.domain.createRecipe` puts into a new recipe before the caller's overrides. Alias entries are
5
+ * already expanded to their member types by the parser.
6
+ */
7
+ export type RecipeDefaults = Readonly<Record<string, Readonly<Record<string, unknown>>>>;
8
+ /**
9
+ * The runtime counterpart of the `defaults` literal the generated `domain-spec.ts` passes to
10
+ * `createRecipeFactory`: the parsed per-entity defaults with every `$msg` lowered to the descriptor
11
+ * the `msg` macro produces.
12
+ */
13
+ export declare const createRecipeDefaults: (defaults: Defaults) => RecipeDefaults;
@@ -0,0 +1 @@
1
+ import{createMessageDescriptor as e,isEvalMarker as t,isMsgMarker as r}from"../../../core/index.js";let s=(a,i)=>{if(null===a||"object"!=typeof a)return a;if(r(a))return e(a);if(t(a))throw Error(`The default at ${i} is an $eval expression. Defaults are static values; the parser rejects $eval in them, so the spec given to the runtime was not produced by it. Parse the spec again and pass the result.`);return Array.isArray(a)?a.map((e,t)=>s(e,`${i}[${t}]`)):Object.fromEntries(Object.entries(a).map(([e,t])=>[e,s(t,`${i}.${e}`)]))};export const createRecipeDefaults=e=>Object.fromEntries(Object.entries(e.entries).map(([e,t])=>[e,Object.fromEntries(Object.entries(t).map(([t,r])=>[t,s(r,`${e}.${t}`)]))]));
@@ -0,0 +1,16 @@
1
+ import type { Violation } from '#package/domain';
2
+ import type { Invariants } from '../../../parse-application-files/index.js';
3
+ /**
4
+ * The violation each static invariant of a domain reports when its implementation returns `false`,
5
+ * by entity type or alias and by invariant name. `phx.domain.implementCustomInvariants` closes over
6
+ * it: a project implements a static invariant as a boolean and the factory turns `false` into this
7
+ * violation.
8
+ */
9
+ export type StaticViolations = Readonly<Record<string, Readonly<Record<string, Violation<string>>>>>;
10
+ /**
11
+ * The runtime counterpart of the `staticViolations` literal the generated `domain-spec.ts` passes
12
+ * to `createCustomInvariantFactory`: one entry per static invariant, keyed as the spec declares it,
13
+ * with a `$msg` message lowered to the descriptor the `msg` macro produces. Types and aliases
14
+ * without a static invariant have no entry.
15
+ */
16
+ export declare const createStaticViolations: (invariants: Invariants) => StaticViolations;
@@ -0,0 +1 @@
1
+ import{createMessageDescriptor as t}from"../../../core/index.js";export const createStaticViolations=e=>{let i={};for(let[o,r]of Object.entries(e.entries))for(let e of Object.values(r)){if("static"!==e.kind)continue;let r={type:String(e.violationType),severity:e.severity,message:"string"==typeof e.message?e.message:t(e.message),...void 0===e.controlViolationPriority?{}:{controlViolationPriority:e.controlViolationPriority}};i[o]={...i[o],[String(e.name)]:r}}return i};
@@ -0,0 +1 @@
1
+ export { MigrationRuntime, type MigrationModules } from './migration-runtime.js';
@@ -0,0 +1 @@
1
+ export{MigrationRuntime}from"./migration-runtime.js";
@@ -0,0 +1,53 @@
1
+ import { Branded } from '@salsita-ai/common/utils';
2
+ import { type AnyEntityReflections, type DomainEntity, type MigrateFunction, type Migration } from '#package/domain';
3
+ import type { RuntimeReferenceStore } from '../../../caching/index.js';
4
+ import type { RuntimeResolvedVersions } from '../../runtime-spec/index.js';
5
+ type AnyEntity = DomainEntity<string>;
6
+ type AnyMigration = Migration<AnyEntity, AnyEntity>;
7
+ /**
8
+ * The project's migration modules, keyed by the project path the parser records for each model
9
+ * version (`src/migrations/v2.ts`, `src/admin/migrations/v2.ts`), each holding the module's exports.
10
+ * The module of version `N` exports the migration to that version as `migrateToV<N>`, the name the
11
+ * generated `domain.ts` imports.
12
+ */
13
+ export type MigrationModules = Readonly<Record<string, Readonly<Record<string, unknown>>>>;
14
+ interface MigrationRuntimeFields {
15
+ /** The entity reflections of each model version, keyed by version; the latest is the domain's own. */
16
+ readonly modelVersions: Readonly<Record<number, AnyEntityReflections>>;
17
+ /** The migration to each version, keyed by the version it yields. */
18
+ readonly migrations: Readonly<Record<number, AnyMigration>>;
19
+ readonly migrate: MigrateFunction<AnyEntity>;
20
+ /**
21
+ * The migrations the spec declares but the migration modules do not provide, as
22
+ * `<migration file>#migrateToV<N>`. A state that needs one fails to load with a
23
+ * `StateMigrationError` naming the missing step.
24
+ */
25
+ readonly missingMigrations: readonly string[];
26
+ readonly changed: boolean;
27
+ }
28
+ /**
29
+ * How a domain migrates a stored state of any of its model versions to the latest one: the entity
30
+ * reflections of every version, the project's migration to each version above the first, and the
31
+ * migrate function built from both, which `DomainBuilder.withMigrate` takes.
32
+ *
33
+ * The configurator and the admin domain each have one. The admin domain's factory first applies the
34
+ * SDK's own migration of the common admin entities (`migrateCommonAdminDomain`) and then this one.
35
+ */
36
+ export type MigrationRuntime = Branded<'MigrationRuntime', MigrationRuntimeFields>;
37
+ interface MigrationRuntimeInput {
38
+ readonly resolvedVersions: RuntimeResolvedVersions;
39
+ readonly latestEntities: AnyEntityReflections;
40
+ readonly migrationModules: MigrationModules;
41
+ }
42
+ interface MigrationRuntimeProps extends MigrationRuntimeInput {
43
+ readonly referenceScope: string;
44
+ }
45
+ /**
46
+ * Builds a domain's migrations from its resolved model versions and the project's migration
47
+ * modules: the runtime counterpart of the `modelVersions` literal of the generated `domain-spec.ts`
48
+ * and the `createMigrateFunction(...)` call of the generated `domain.ts`. The latest version uses the
49
+ * domain's own entity reflections, as generated code does. The result keeps its reference while
50
+ * the versions, the latest reflections and the migration modules stay the same.
51
+ */
52
+ export declare const MigrationRuntime: (referenceStore: RuntimeReferenceStore, props: MigrationRuntimeProps) => MigrationRuntime;
53
+ export {};
@@ -0,0 +1 @@
1
+ import e from"lodash-es/isEqual.js";import{Branded as i}from"@salsita-ai/common/utils";import{DomainEntityReflection as t,createMigrateFunction as s}from"#package/domain";let o=e=>"function"==typeof e,r=e=>`migrateToV${e}`,n=e=>{let{resolvedVersions:i,latestEntities:n,migrationModules:a}=e,l={},m={},d=[];for(let e of i.versionedModels){if(e.isLatest)l[e.version]=n;else{let i={};for(let s of e.modelVersion.entitySchemas)i[String(s.entityType)]=new t(String(s.entityType),[s.shapeSchema]);l[e.version]=i}if(void 0===e.migrationFile)continue;let i=r(e.version),s=a[e.migrationFile]?.[i];o(s)?m[e.version]=s:d.push(`${e.migrationFile}#${i}`)}return{modelVersions:l,migrations:m,migrate:s(l,i.latestVersion,m),missingMigrations:d}},a=e=>e.versionedModels.map(e=>({version:e.version,isLatest:e.isLatest,migrationFile:e.migrationFile,schemas:e.isLatest?[]:e.modelVersion.entitySchemas.map(e=>e.shapeSchema)})),l=(i,t)=>i.latestEntities===t.latestEntities&&i.resolvedVersions.latestVersion===t.resolvedVersions.latestVersion&&e(a(i.resolvedVersions),a(t.resolvedVersions))&&i.resolvedVersions.versionedModels.every(e=>void 0===e.migrationFile||i.migrationModules[e.migrationFile]===t.migrationModules[e.migrationFile]);export const MigrationRuntime=(e,t)=>{let s=e.createBuilder(t.referenceScope,{build:n,getKey:()=>"singleton",compare:l}).build({resolvedVersions:t.resolvedVersions,latestEntities:t.latestEntities,migrationModules:t.migrationModules});return i({...s.output,changed:s.changed})};
@@ -1,10 +1,10 @@
1
1
  import { Branded } from '@salsita-ai/common/utils';
2
2
  import type { AssistantResolvedManifest } from '#package/domain';
3
3
  import type { RuntimeReferenceStore } from '../../../caching/index.js';
4
- import type { ApplicationSpec } from '../../../parse-application-files/index.js';
4
+ import type { RuntimeSpec } from '../../runtime-spec/index.js';
5
5
  /** Resolved assistant manifest with change tracking, carried to the runtime spec on hot reload. */
6
6
  export type AssistantRuntime = Branded<'AssistantRuntime', {
7
7
  readonly assistant: AssistantResolvedManifest | null;
8
8
  readonly changed: boolean;
9
9
  }>;
10
- export declare const AssistantRuntime: (spec: ApplicationSpec, referenceStore: RuntimeReferenceStore) => AssistantRuntime;
10
+ export declare const AssistantRuntime: (spec: RuntimeSpec, referenceStore: RuntimeReferenceStore) => AssistantRuntime;
@@ -1,13 +1,13 @@
1
1
  import { Branded } from '@salsita-ai/common/utils';
2
2
  import type { RuntimeReferenceStore } from '../../../caching/index.js';
3
- import type { ApplicationSpec } from '../../../parse-application-files/index.js';
4
- type ParsedDataSpecEntries = ApplicationSpec['dataSpec']['entries'];
5
- type ParsedChunks = ApplicationSpec['dataSpec']['chunks'];
3
+ import type { RuntimeSpec } from '../../runtime-spec/index.js';
4
+ type ParsedDataSpecEntries = RuntimeSpec['dataSpec']['entries'];
5
+ type ParsedChunks = RuntimeSpec['dataSpec']['chunks'];
6
6
  export type DataRuntime = Branded<'DataRuntime', {
7
7
  readonly dataSpec: ParsedDataSpecEntries;
8
8
  readonly chunks: ParsedChunks;
9
9
  readonly publishedDataHash: string;
10
10
  readonly changed: boolean;
11
11
  }>;
12
- export declare const DataRuntime: (spec: ApplicationSpec, referenceStore: RuntimeReferenceStore) => DataRuntime;
12
+ export declare const DataRuntime: (spec: RuntimeSpec, referenceStore: RuntimeReferenceStore) => DataRuntime;
13
13
  export {};
@@ -1,7 +1,8 @@
1
1
  import { Branded } from '@salsita-ai/common/utils';
2
2
  import type { DomainEntity, Expression as DomainExpression, Invariant as DomainInvariant } from '#package/domain';
3
3
  import type { RuntimeReferenceStore } from '../../../caching/index.js';
4
- import type { Expressions, ModelVersion } from '../../../parse-application-files/index.js';
4
+ import type { Expressions } from '../../../parse-application-files/index.js';
5
+ import type { RuntimeModelVersion } from '../../runtime-spec/index.js';
5
6
  type RuntimeData = Record<string, unknown>;
6
7
  type RuntimeEntity = DomainEntity<string>;
7
8
  type AnyExpression = DomainExpression<RuntimeEntity, RuntimeEntity, RuntimeData, RuntimeData, RuntimeData, RuntimeEntity, unknown>;
@@ -30,7 +31,7 @@ export type ExpressionRuntimeResult = {
30
31
  };
31
32
  interface ExpressionRuntimeSpec {
32
33
  readonly expressions: Expressions;
33
- readonly latestModel: ModelVersion;
34
+ readonly latestModel: RuntimeModelVersion;
34
35
  }
35
36
  /**
36
37
  * Runtime section that produces the single merged expression map for the registry.
@@ -1,10 +1,10 @@
1
1
  import { Branded } from '@salsita-ai/common/utils';
2
2
  import type { RuntimeReferenceStore } from '../../../caching/index.js';
3
- import type { ApplicationSpec } from '../../../parse-application-files/index.js';
3
+ import type { RuntimeSpec } from '../../runtime-spec/index.js';
4
4
  /** Resolved theme spec with change tracking — no UI deps, just preset + options. */
5
5
  export type ThemeRuntime = Branded<'ThemeRuntime', {
6
6
  readonly preset: string;
7
7
  readonly options: Readonly<Record<string, unknown>>;
8
8
  readonly changed: boolean;
9
9
  }>;
10
- export declare const ThemeRuntime: (spec: ApplicationSpec, referenceStore: RuntimeReferenceStore) => ThemeRuntime;
10
+ export declare const ThemeRuntime: (spec: RuntimeSpec, referenceStore: RuntimeReferenceStore) => ThemeRuntime;
@@ -1,7 +1,7 @@
1
1
  import { Branded } from '@salsita-ai/common/utils';
2
2
  import type { ImportedTransformer } from '#package/domain';
3
3
  import type { RuntimeReferenceStore } from '../../../caching/index.js';
4
- import type { ApplicationSpec } from '../../../parse-application-files/index.js';
4
+ import type { RuntimeSpec } from '../../runtime-spec/index.js';
5
5
  /**
6
6
  * Runtime section for transformers. Combines two sources of truth:
7
7
  * - `importedTransformers` — factory functions from src/transformers/*.ts
@@ -13,7 +13,7 @@ import type { ApplicationSpec } from '../../../parse-application-files/index.js'
13
13
  */
14
14
  export type TransformersRuntime = Branded<'TransformersRuntime', {
15
15
  readonly importedTransformers: readonly ImportedTransformer[];
16
- readonly specTransformers: ApplicationSpec['configurator']['transformers'];
16
+ readonly specTransformers: RuntimeSpec['configurator']['transformers'];
17
17
  readonly changed: boolean;
18
18
  }>;
19
- export declare const TransformersRuntime: (spec: ApplicationSpec, referenceStore: RuntimeReferenceStore, importedTransformers: readonly ImportedTransformer[]) => TransformersRuntime;
19
+ export declare const TransformersRuntime: (spec: RuntimeSpec, referenceStore: RuntimeReferenceStore, importedTransformers: readonly ImportedTransformer[]) => TransformersRuntime;
@@ -0,0 +1,9 @@
1
+ import type { RuntimeSpec } from './runtime-spec.js';
2
+ /**
3
+ * Reads the JSON text of `.phoenix/application-spec.json` back into the runtime spec that
4
+ * `encodeRuntimeSpec` wrote: one `JSON.parse`, then each listed array back into its Map or Set.
5
+ *
6
+ * Throws when the text is not a runtime spec artifact, or when it was written in another format
7
+ * version than this SDK reads; `phoenix sync` writes the artifact again in the right one.
8
+ */
9
+ export declare const decodeRuntimeSpec: (text: string) => RuntimeSpec;
@@ -0,0 +1 @@
1
+ import{RUNTIME_SPEC_FORMAT_VERSION as e}from"./encoded-runtime-spec.js";let t="Run `phoenix sync` to write it again with the SDK the project uses.",r=e=>"object"==typeof e&&null!==e,i=e=>Error(`Cannot read .phoenix/application-spec.json: its ${e.kind} at ${JSON.stringify(e.path)} is not where the file says it is, so the file was changed after it was written. ${t}`),o=(e,t)=>{let o=e,n="spec";for(let e of t.path)o=r(o)?o[n]:void 0,n=e;let s=r(o)?o[n]:void 0;if(!r(o)||!Array.isArray(s))throw i(t);o[n]="Map"===t.kind?new Map(s.map(e=>{if(!Array.isArray(e)||2!==e.length)throw i(t);return[e[0],e[1]]})):new Set(s)};export const decodeRuntimeSpec=i=>{let n=JSON.parse(i);if(!(r(n)&&"number"==typeof n.format&&Array.isArray(n.collections)&&"spec"in n))throw Error(`Cannot read .phoenix/application-spec.json: it is not a runtime spec written by \`phoenix sync\` or \`phoenix build\`. ${t}`);if(n.format!==e)throw Error(`Cannot read .phoenix/application-spec.json: it is written in format version ${n.format}, and this SDK reads format version ${e}, so it was written by another version of the SDK. ${t}`);let s={spec:n.spec};for(let e of n.collections)o(s,e);return s.spec};
@@ -0,0 +1,8 @@
1
+ import type { RuntimeSpec } from './runtime-spec.js';
2
+ /**
3
+ * Writes a runtime spec as the JSON text of `.phoenix/application-spec.json`, which
4
+ * `decodeRuntimeSpec` reads back. Maps and Sets become arrays listed in `collections`, properties
5
+ * whose value is `undefined` are left out, and the document carries the format version. The text
6
+ * is the same for the same spec, so an unchanged spec leaves the file unchanged.
7
+ */
8
+ export declare const encodeRuntimeSpec: (spec: RuntimeSpec) => string;
@@ -0,0 +1 @@
1
+ import{RUNTIME_SPEC_FORMAT_VERSION as t}from"./encoded-runtime-spec.js";let e=(t,e)=>Error(`Cannot write .phoenix/application-spec.json: the parsed spec holds ${e} at ${JSON.stringify(t.path)}, which the runtime spec cannot hold. The runtime spec holds only plain data, Maps and Sets, so the parser produced a value it should not have. Report this to the Phoenix team with the YAML that declares this value.`),o=(t,e,o)=>{t.path.push(e);let n=r(t,o);return t.path.pop(),n},r=(t,r)=>{let n;if(null===r||"string"==typeof r||"boolean"==typeof r)return r;if("number"==typeof r){if(!Number.isFinite(r))throw e(t,`the number ${r}`);return r}if("object"!=typeof r)throw e(t,`a value of type ${typeof r}`);if(r instanceof Map){let e=[...r].map(([e,r],n)=>{t.path.push(n);let p=[o(t,0,e),o(t,1,r)];return t.path.pop(),p});return t.collections.push({kind:"Map",path:[...t.path]}),e}if(r instanceof Set){let e=[...r].map((e,r)=>o(t,r,e));return t.collections.push({kind:"Set",path:[...t.path]}),e}if(Array.isArray(r))return r.map((r,n)=>{if(void 0===r)throw e(t,`undefined as item ${n} of an array`);return o(t,n,r)});if((n=Object.getPrototypeOf(r))!==Object.prototype&&null!==n)throw e(t,`an instance of ${r.constructor.name}`);let p={};for(let[e,n]of Object.entries(r))void 0!==n&&(p[e]=o(t,e,n));return p};export const encodeRuntimeSpec=e=>{let o={path:[],collections:[]},n=r(o,e);return JSON.stringify({format:t,collections:o.collections,spec:n})};
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The version of the JSON format `encodeRuntimeSpec` writes. Raise it with every change to the
3
+ * format or to the shape of `RuntimeSpec`, so that `decodeRuntimeSpec` refuses an artifact an older
4
+ * or newer SDK wrote instead of building a runtime from data it does not understand.
5
+ */
6
+ export declare const RUNTIME_SPEC_FORMAT_VERSION = 1;
7
+ /** One step from a value into a part of it: an object key or an array index. */
8
+ export type RuntimeSpecPathSegment = string | number;
9
+ /**
10
+ * A Map or Set of the runtime spec, which JSON cannot hold: it is written as an array (a Map as its
11
+ * `[key, value]` entries), and `path` leads from the spec to that array. Paths into a Map run
12
+ * through its entries, so `[..., 2, 1]` is the value of its third entry.
13
+ */
14
+ export interface EncodedCollection {
15
+ readonly kind: 'Map' | 'Set';
16
+ readonly path: readonly RuntimeSpecPathSegment[];
17
+ }
18
+ /**
19
+ * The JSON document of `.phoenix/application-spec.json`. `spec` is the runtime spec with every Map
20
+ * and Set written as an array, and `collections` lists those arrays, inner ones before the ones
21
+ * that hold them, so a decoder turns them back in that order without walking the whole spec.
22
+ */
23
+ export interface EncodedRuntimeSpec {
24
+ readonly format: number;
25
+ readonly collections: readonly EncodedCollection[];
26
+ readonly spec: unknown;
27
+ }
@@ -0,0 +1 @@
1
+ export const RUNTIME_SPEC_FORMAT_VERSION=1;
@@ -0,0 +1,4 @@
1
+ export * from './runtime-spec.js';
2
+ export * from './encoded-runtime-spec.js';
3
+ export * from './encode-runtime-spec.js';
4
+ export * from './decode-runtime-spec.js';
@@ -0,0 +1 @@
1
+ export*from"./runtime-spec.js";export*from"./encoded-runtime-spec.js";export*from"./encode-runtime-spec.js";export*from"./decode-runtime-spec.js";
@@ -0,0 +1,68 @@
1
+ import type { AdminSpec, ApplicationSpec, ConfiguratorSpec, EntitySchema, Infra, ModelVersion, ResolvedModelVersion, ResolvedVersions } from '../../parse-application-files/index.js';
2
+ /**
3
+ * The part of a parsed entity schema the runtime reads: the entity type and the schema of its
4
+ * shape, from which it builds the entity's reflection. The full schema with `id` and `type` is
5
+ * only registered with a deployment, and the compiled shape validators only check presets and
6
+ * defaults while parsing.
7
+ */
8
+ export type RuntimeEntitySchema = Pick<EntitySchema, 'entityType' | 'shapeSchema'>;
9
+ /**
10
+ * The part of a parsed model version the runtime reads: the entity types, the aliases, the common
11
+ * types and the schema of every entity's shape. The raw shapes and resolved shapes only serve the
12
+ * parser and the type generator.
13
+ */
14
+ export type RuntimeModelVersion = Pick<ModelVersion, 'versionKey' | 'entityTypes' | 'rootEntityTypes' | 'aliases' | 'commonTypes'> & {
15
+ readonly entitySchemas: readonly RuntimeEntitySchema[];
16
+ };
17
+ /** One model version of a domain as the runtime reads it, with the migration file that leads to it. */
18
+ export type RuntimeResolvedModelVersion = Omit<ResolvedModelVersion, 'modelVersion'> & {
19
+ readonly modelVersion: RuntimeModelVersion;
20
+ };
21
+ /** Every model version of a domain as the runtime reads it; it builds the domain's migrations from them. */
22
+ export type RuntimeResolvedVersions = Pick<ResolvedVersions, 'latestVersion'> & {
23
+ readonly versionedModels: readonly RuntimeResolvedModelVersion[];
24
+ };
25
+ /** The model of a domain as the runtime reads it: the latest version and every earlier one. */
26
+ interface RuntimeDomainModel {
27
+ readonly latestModel: RuntimeModelVersion;
28
+ readonly resolvedVersions: RuntimeResolvedVersions;
29
+ }
30
+ /**
31
+ * The configurator part of the runtime spec. It leaves out the configuration schema and its
32
+ * version, which only a deployment registers, and the assistant's server settings (instructions
33
+ * and AI settings), which must never reach the browser of a customer.
34
+ */
35
+ export type RuntimeConfiguratorSpec = Pick<ConfiguratorSpec, 'components' | 'presets' | 'expressions' | 'actions' | 'invariants' | 'dataSchemas' | 'defaults' | 'states' | 'theme' | 'ui' | 'transformers' | 'assistant'> & RuntimeDomainModel;
36
+ /**
37
+ * The admin part of the runtime spec. It leaves out the configuration schema and its version, which
38
+ * only a deployment registers.
39
+ */
40
+ export type RuntimeAdminSpec = Pick<AdminSpec, 'components' | 'presets' | 'expressions' | 'invariants' | 'defaults' | 'states' | 'adminPages'> & RuntimeDomainModel;
41
+ /**
42
+ * The infrastructure settings the runtime reads: access control and resources. The environment
43
+ * variable declarations only drive the generated environment readers.
44
+ */
45
+ export type RuntimeInfra = Pick<Infra, 'acl' | 'resources' | 'resourcesConfig'>;
46
+ /**
47
+ * The parsed application spec as the runtime reads it: what `ApplicationRuntime` builds the
48
+ * configurator and admin runtimes from, and the sections an application needs besides its domains
49
+ * (data spec, app metadata, resources, access control, user interface settings, webhook data
50
+ * schemas, admin pages). `phoenix sync` and `phoenix build` write it to
51
+ * `.phoenix/application-spec.json` with `encodeRuntimeSpec`.
52
+ *
53
+ * It is derived from the parsed types, so a section the runtime reads keeps the parser's type. It
54
+ * leaves out what only the parser, the type generator or a deployment use, and holds plain data,
55
+ * Maps and Sets only, so it can be encoded as JSON.
56
+ */
57
+ export interface RuntimeSpec extends Pick<ApplicationSpec, 'appMetadata' | 'dataSpec'> {
58
+ readonly configurator: RuntimeConfiguratorSpec;
59
+ readonly admin: RuntimeAdminSpec;
60
+ readonly infra: RuntimeInfra;
61
+ }
62
+ /**
63
+ * Takes from a parsed application spec the part the runtime reads. The sections it keeps are the
64
+ * parsed values themselves, not copies; only the model versions are rebuilt without what the
65
+ * runtime does not read.
66
+ */
67
+ export declare const toRuntimeSpec: (spec: ApplicationSpec) => RuntimeSpec;
68
+ export {};
@@ -0,0 +1 @@
1
+ let e=e=>({versionKey:e.versionKey,entityTypes:e.entityTypes,rootEntityTypes:e.rootEntityTypes,aliases:e.aliases,commonTypes:e.commonTypes,entitySchemas:e.entitySchemas.map(e=>({entityType:e.entityType,shapeSchema:e.shapeSchema}))}),s=s=>({latestModel:e(s.latestModel),resolvedVersions:{latestVersion:s.resolvedVersions.latestVersion,versionedModels:s.resolvedVersions.versionedModels.map(s=>({version:s.version,key:s.key,isLatest:s.isLatest,migrationFile:s.migrationFile,modelVersion:e(s.modelVersion)}))}});export const toRuntimeSpec=e=>{let{configurator:t,admin:a,infra:n}=e;return{configurator:{components:t.components,presets:t.presets,expressions:t.expressions,actions:t.actions,invariants:t.invariants,dataSchemas:t.dataSchemas,defaults:t.defaults,states:t.states,theme:t.theme,ui:t.ui,transformers:t.transformers,assistant:t.assistant,...s(t)},admin:{components:a.components,presets:a.presets,expressions:a.expressions,invariants:a.invariants,defaults:a.defaults,states:a.states,adminPages:a.adminPages,...s(a)},appMetadata:e.appMetadata,infra:{acl:n.acl,resources:n.resources,resourcesConfig:n.resourcesConfig},dataSpec:e.dataSpec}};
@@ -58,12 +58,46 @@ export type CategorizedFiles = Branded<'CategorizedFiles', {
58
58
  readonly adminElementsChanged: boolean;
59
59
  readonly webhooks: readonly CategorizedFile[];
60
60
  readonly webhooksChanged: boolean;
61
+ /**
62
+ * Whether the project has its webhook entry, `src/webhooks/index.ts`, whose default export is the
63
+ * project's webhook. Generation reads it to decide the generated webhook entry: without it the
64
+ * entry holds the built-in inert webhook.
65
+ */
66
+ readonly hasWebhookEntry: boolean;
61
67
  readonly locales: readonly CategorizedFile[];
62
68
  readonly localesChanged: boolean;
63
69
  readonly mockTemplates: readonly CategorizedFile[];
64
70
  readonly mockTemplatesChanged: boolean;
65
71
  readonly projectFiles: readonly CategorizedFile[];
66
72
  readonly projectFilesChanged: boolean;
73
+ /**
74
+ * One-time migration: true only on a checkout's first sync with an SDK that contains this field;
75
+ * delete it once projects have synced with such an SDK.
76
+ *
77
+ * Whether the project's root `tsconfig.json` is the full file earlier SDK versions generated on
78
+ * every sync, before the TypeScript settings moved to `.phoenix/tsconfig.json`. Generation reads
79
+ * it to replace that file with the one-line `tsconfig.json` that extends `.phoenix/tsconfig.json`;
80
+ * any other root `tsconfig.json` is the project's own and is left as it is.
81
+ */
82
+ readonly hasEarlierGeneratedTsconfig: boolean;
83
+ /**
84
+ * One-time migration: true only on a checkout's first sync with an SDK that contains this field;
85
+ * delete it once projects have synced with such an SDK.
86
+ *
87
+ * Whether the project's root `eslint.config.js` is the file earlier SDK versions generated on
88
+ * every sync, before it became the project's. Generation reads it to replace that file once with
89
+ * the current one; any other root `eslint.config.js` is the project's own and is left as it is.
90
+ */
91
+ readonly hasEarlierGeneratedEslintConfig: boolean;
92
+ /**
93
+ * One-time migration: true only on a checkout's first sync with an SDK that contains this field;
94
+ * delete it once projects have synced with such an SDK.
95
+ *
96
+ * Whether the project's root `prettier.config.js` is the file earlier SDK versions generated on
97
+ * every sync, before it became the project's. Generation reads it to replace that file once with
98
+ * the current one; any other root `prettier.config.js` is the project's own and is left as it is.
99
+ */
100
+ readonly hasEarlierGeneratedPrettierConfig: boolean;
67
101
  readonly customCode: readonly CategorizedFile[];
68
102
  readonly customCodeChanged: boolean;
69
103
  readonly envs: Record<string, unknown>;
@@ -1 +1 @@
1
- import e from"lodash-es/isEqual.js";import{Branded as n}from"@salsita-ai/common/utils";import{computeFileDepHashes as s}from"../../caching/index.js";import{DiagnosticCode as o,diagnosticMessages as a}from"../../errors/index.js";import{findWebhookHandlerRegistration as i}from"./module-analysis.js";import{findWebhookSafetyViolation as t}from"./webhook-safety.js";export const buildProjectFileIndex=e=>new Map([...e.spec,...e.expressions,...e.actions,...e.handlers,...e.elements,...e.transformers,...e.components,...e.invariants,...e.migrations,...e.adminMigrations,...e.adminExpressions,...e.adminInvariants,...e.adminComponents,...e.adminElements,...e.webhooks,...e.locales,...e.mockTemplates,...e.projectFiles,...e.customCode].map(e=>[e.file.name,e]));let r=e=>/\/_[^/]+\//.test(e),m=[{path:"spec/",key:"spec"},{path:"src/admin/expressions/",key:"adminExpressions"},{path:"src/admin/invariants/",key:"adminInvariants"},{path:"src/admin/components/",key:"adminComponents"},{path:"src/admin/elements/",key:"adminElements"},{path:"src/admin/migrations/",key:"adminMigrations"},{path:"src/expressions/",key:"expressions"},{path:"src/actions/",key:"actions"},{path:"src/handlers/",key:"handlers"},{path:"src/elements/",key:"elements"},{path:"src/transformers/",key:"transformers"},{path:"src/components/",key:"components"},{path:"src/invariants/",key:"invariants"},{path:"src/migrations/",key:"migrations"},{path:"src/webhooks/",key:"webhooks"},{path:"src/locales/",key:"locales"},{path:"mocks/",key:"mockTemplates"}],l=new Set(["package.json",".gitignore","CLAUDE.md",".cursor/rules/phoenix.mdc"]),d=new Set(["migrations","adminMigrations"]),c=m.filter(({path:e,key:n})=>e.startsWith("src/")&&d.has(n)),p=(e,n)=>{let s=e.slice(n.length).split("/");return!(s.length<=1)&&s.slice(0,-1).some(e=>!e.startsWith("_"))},h=/\.(ts|tsx|js|jsx)$/,f=(e,n)=>{if("components"===e||"adminComponents"===e)return n.hasUseWebhookDirective?{membership:"pinned",logSuffix:"webhook ('use webhook' directive)"}:{membership:"frontend",logSuffix:"frontend only (no 'use webhook' directive)"};if("handlers"===e){let e=i(n);return void 0!==e?{membership:"named-handler",logSuffix:`webhook (the ${e} registration)`}:n.hasUseWebhookDirective?{membership:"pinned",logSuffix:"webhook ('use webhook' directive)"}:{membership:"frontend",logSuffix:"frontend only (not a named handler or pin)"}}};export const CategorizedFiles=(i,d,g,u)=>{let k={spec:[],expressions:[],actions:[],handlers:[],elements:[],transformers:[],components:[],invariants:[],migrations:[],adminMigrations:[],adminExpressions:[],adminInvariants:[],adminComponents:[],adminElements:[],webhooks:[],locales:[],mockTemplates:[],projectFiles:[],customCode:[]},b=[];for(let e of i.files){if("text"!==e.kind)continue;if(r(e.name)){k.customCode.push({file:e,category:"customCode"});continue}if(l.has(e.name)){k.projectFiles.push({file:e,category:"projectFiles"});continue}let n=!1;for(let{path:s,key:o}of m)if(e.name.startsWith(s)){k[o].push({file:e,category:o}),n=!0;break}n||b.push(e.name)}for(let e of b)e.startsWith("src/")&&g.error(o.UNKNOWN_SRC_PATH,a.UNKNOWN_SRC_PATH(e));for(let{path:e,key:n}of c)for(let s of k[n])p(s.file.name,e)&&g.error(o.INVALID_SUBDIRECTORY,a.INVALID_SUBDIRECTORY(s.file.name,e));if(k.webhooks.length>0&&!k.webhooks.some(e=>"src/webhooks/index.ts"===e.file.name)&&g.error(o.MISSING_WEBHOOK_INDEX,a.MISSING_WEBHOOK_INDEX()),g.hasErrors)return;let C=[];for(let e of Object.values(k))for(let n of e)C.push(n.file.name);let v=s(i,C),{analyzer:x,logger:y}=u,E=d.createBuilder("categorizedFiles/moduleAnalysis",{build:e=>{try{return{analysis:x(e.name,e.content)}}catch(e){return{error:e instanceof Error?e.message:String(e)}}},getKey:e=>e.name,compare:(e,n)=>e.content===n.content}),I=new Set,w=e=>{if(!h.test(e.name))return;I.add(e.name);let n=E.build({name:e.name,content:e.content}).output;return void 0!==n.error?void g.error(o.MODULE_ANALYSIS_FAILED,a[o.MODULE_ANALYSIS_FAILED](e.name,n.error)):n.analysis},S={},j={};for(let[e,s]of Object.entries(k)){let o=d.createBuilder(`categorizedFiles/${e}`,{build:e=>e,getKey:e=>e.name,compare:(e,n)=>e.depHash===n.depHash}),a=new Set;S[e]=s.map(e=>{let s=v[e.file.name]??{deps:[],hash:""},{changed:i}=o.build({name:e.file.name,depHash:s.hash});a.add(e.file.name);let t=w(e.file),r=void 0===t?void 0:f(e.category,t);return void 0!==r&&y.debug(`Webhook membership: ${e.file.name} -> ${r.logSuffix}`),n({file:e.file,category:e.category,deps:s.deps,depHash:s.hash,changed:i,analysis:t,webhookMembership:r?.membership})}),j[e]=o.cleanup(a)}E.cleanup(I);let _=(e,n)=>n.some(e=>e.changed)||!0===j[e],F=d.createBuilder("categorizedFiles/envs",{build:e=>e.envs,getKey:()=>"singleton",compare:(n,s)=>e(n.envs,s.envs)}).build({envs:i.envs}),M=n({spec:S.spec,specChanged:_("spec",S.spec),expressions:S.expressions,expressionsChanged:_("expressions",S.expressions),actions:S.actions,actionsChanged:_("actions",S.actions),handlers:S.handlers,handlersChanged:_("handlers",S.handlers),elements:S.elements,elementsChanged:_("elements",S.elements),transformers:S.transformers,transformersChanged:_("transformers",S.transformers),components:S.components,componentsChanged:_("components",S.components),invariants:S.invariants,invariantsChanged:_("invariants",S.invariants),migrations:S.migrations,migrationsChanged:_("migrations",S.migrations),adminMigrations:S.adminMigrations,adminMigrationsChanged:_("adminMigrations",S.adminMigrations),adminExpressions:S.adminExpressions,adminExpressionsChanged:_("adminExpressions",S.adminExpressions),adminInvariants:S.adminInvariants,adminInvariantsChanged:_("adminInvariants",S.adminInvariants),adminComponents:S.adminComponents,adminComponentsChanged:_("adminComponents",S.adminComponents),adminElements:S.adminElements,adminElementsChanged:_("adminElements",S.adminElements),webhooks:S.webhooks,webhooksChanged:_("webhooks",S.webhooks),locales:S.locales,localesChanged:_("locales",S.locales),mockTemplates:S.mockTemplates,mockTemplatesChanged:_("mockTemplates",S.mockTemplates),projectFiles:S.projectFiles,projectFilesChanged:_("projectFiles",S.projectFiles),customCode:S.customCode,customCodeChanged:_("customCode",S.customCode),envs:F.output,envsChanged:F.changed}),O=buildProjectFileIndex(M);for(let e of O.values()){if("pinned"!==e.webhookMembership&&"named-handler"!==e.webhookMembership)continue;let n=t(e,O);void 0!==n&&g.error(o.WEBHOOK_UNSAFE_IMPORT,a[o.WEBHOOK_UNSAFE_IMPORT](n.fileName,n.inclusionReason,n.importer,n.specifier))}return M};
1
+ import e from"lodash-es/isEqual.js";import{Branded as n}from"@salsita-ai/common/utils";import{computeFileDepHashes as s}from"../../caching/index.js";import{DiagnosticCode as o,diagnosticMessages as i}from"../../errors/index.js";import{isEarlierGeneratedEslintConfig as t,isEarlierGeneratedPrettierConfig as a}from"./earlier-generated-editor-configs.js";import{isEarlierGeneratedTsconfig as r}from"./earlier-generated-tsconfig.js";import{findWebhookHandlerRegistration as m}from"./module-analysis.js";import{findWebhookSafetyViolation as l}from"./webhook-safety.js";export const buildProjectFileIndex=e=>new Map([...e.spec,...e.expressions,...e.actions,...e.handlers,...e.elements,...e.transformers,...e.components,...e.invariants,...e.migrations,...e.adminMigrations,...e.adminExpressions,...e.adminInvariants,...e.adminComponents,...e.adminElements,...e.webhooks,...e.locales,...e.mockTemplates,...e.projectFiles,...e.customCode].map(e=>[e.file.name,e]));let d=e=>/\/_[^/]+\//.test(e),c=[{path:"spec/",key:"spec"},{path:"src/admin/expressions/",key:"adminExpressions"},{path:"src/admin/invariants/",key:"adminInvariants"},{path:"src/admin/components/",key:"adminComponents"},{path:"src/admin/elements/",key:"adminElements"},{path:"src/admin/migrations/",key:"adminMigrations"},{path:"src/expressions/",key:"expressions"},{path:"src/actions/",key:"actions"},{path:"src/handlers/",key:"handlers"},{path:"src/elements/",key:"elements"},{path:"src/transformers/",key:"transformers"},{path:"src/components/",key:"components"},{path:"src/invariants/",key:"invariants"},{path:"src/migrations/",key:"migrations"},{path:"src/webhooks/",key:"webhooks"},{path:"src/locales/",key:"locales"},{path:"mocks/",key:"mockTemplates"}],p="tsconfig.json",h="eslint.config.js",f="prettier.config.js",g=new Set(["package.json",".gitignore",p,h,f,"CLAUDE.md",".cursor/rules/phoenix.mdc"]),u=new Set(["migrations","adminMigrations"]),k=c.filter(({path:e,key:n})=>e.startsWith("src/")&&u.has(n)),b=(e,n)=>{let s=e.slice(n.length).split("/");return!(s.length<=1)&&s.slice(0,-1).some(e=>!e.startsWith("_"))},C=/\.(ts|tsx|js|jsx)$/,v=(e,n)=>{if("components"===e||"adminComponents"===e)return n.hasUseWebhookDirective?{membership:"pinned",logSuffix:"webhook ('use webhook' directive)"}:{membership:"frontend",logSuffix:"frontend only (no 'use webhook' directive)"};if("handlers"===e){let e=m(n);return void 0!==e?{membership:"named-handler",logSuffix:`webhook (the ${e} registration)`}:n.hasUseWebhookDirective?{membership:"pinned",logSuffix:"webhook ('use webhook' directive)"}:{membership:"frontend",logSuffix:"frontend only (not a named handler or pin)"}}};export const CategorizedFiles=(m,u,x,y)=>{let E={spec:[],expressions:[],actions:[],handlers:[],elements:[],transformers:[],components:[],invariants:[],migrations:[],adminMigrations:[],adminExpressions:[],adminInvariants:[],adminComponents:[],adminElements:[],webhooks:[],locales:[],mockTemplates:[],projectFiles:[],customCode:[]},j=[];for(let e of m.files){if("text"!==e.kind)continue;if(d(e.name)){E.customCode.push({file:e,category:"customCode"});continue}if(g.has(e.name)){E.projectFiles.push({file:e,category:"projectFiles"});continue}let n=!1;for(let{path:s,key:o}of c)if(e.name.startsWith(s)){E[o].push({file:e,category:o}),n=!0;break}n||j.push(e.name)}for(let e of j)e.startsWith("src/")&&x.error(o.UNKNOWN_SRC_PATH,i.UNKNOWN_SRC_PATH(e));for(let{path:e,key:n}of k)for(let s of E[n])b(s.file.name,e)&&x.error(o.INVALID_SUBDIRECTORY,i.INVALID_SUBDIRECTORY(s.file.name,e));let I=E.webhooks.some(e=>"src/webhooks/index.ts"===e.file.name);if(E.webhooks.length>0&&!I&&x.error(o.MISSING_WEBHOOK_INDEX,i.MISSING_WEBHOOK_INDEX()),x.hasErrors)return;let w=E.projectFiles.find(e=>e.file.name===p),S=void 0!==w&&r(w.file.content),F=E.projectFiles.find(e=>e.file.name===h),_=void 0!==F&&t(F.file.content),M=E.projectFiles.find(e=>e.file.name===f),O=void 0!==M&&a(M.file.content),N=[];for(let e of Object.values(E))for(let n of e)N.push(n.file.name);let A=s(m,N),{analyzer:T,logger:D}=y,W=u.createBuilder("categorizedFiles/moduleAnalysis",{build:e=>{try{return{analysis:T(e.name,e.content)}}catch(e){return{error:e instanceof Error?e.message:String(e)}}},getKey:e=>e.name,compare:(e,n)=>e.content===n.content}),U=new Set,H=e=>{if(!C.test(e.name))return;U.add(e.name);let n=W.build({name:e.name,content:e.content}).output;return void 0!==n.error?void x.error(o.MODULE_ANALYSIS_FAILED,i[o.MODULE_ANALYSIS_FAILED](e.name,n.error)):n.analysis},B={},K={};for(let[e,s]of Object.entries(E)){let o=u.createBuilder(`categorizedFiles/${e}`,{build:e=>e,getKey:e=>e.name,compare:(e,n)=>e.depHash===n.depHash}),i=new Set;B[e]=s.map(e=>{let s=A[e.file.name]??{deps:[],hash:""},{changed:t}=o.build({name:e.file.name,depHash:s.hash});i.add(e.file.name);let a=H(e.file),r=void 0===a?void 0:v(e.category,a);return void 0!==r&&D.debug(`Webhook membership: ${e.file.name} -> ${r.logSuffix}`),n({file:e.file,category:e.category,deps:s.deps,depHash:s.hash,changed:t,analysis:a,webhookMembership:r?.membership})}),K[e]=o.cleanup(i)}W.cleanup(U);let L=(e,n)=>n.some(e=>e.changed)||!0===K[e],R=u.createBuilder("categorizedFiles/envs",{build:e=>e.envs,getKey:()=>"singleton",compare:(n,s)=>e(n.envs,s.envs)}).build({envs:m.envs}),P=n({spec:B.spec,specChanged:L("spec",B.spec),expressions:B.expressions,expressionsChanged:L("expressions",B.expressions),actions:B.actions,actionsChanged:L("actions",B.actions),handlers:B.handlers,handlersChanged:L("handlers",B.handlers),elements:B.elements,elementsChanged:L("elements",B.elements),transformers:B.transformers,transformersChanged:L("transformers",B.transformers),components:B.components,componentsChanged:L("components",B.components),invariants:B.invariants,invariantsChanged:L("invariants",B.invariants),migrations:B.migrations,migrationsChanged:L("migrations",B.migrations),adminMigrations:B.adminMigrations,adminMigrationsChanged:L("adminMigrations",B.adminMigrations),adminExpressions:B.adminExpressions,adminExpressionsChanged:L("adminExpressions",B.adminExpressions),adminInvariants:B.adminInvariants,adminInvariantsChanged:L("adminInvariants",B.adminInvariants),adminComponents:B.adminComponents,adminComponentsChanged:L("adminComponents",B.adminComponents),adminElements:B.adminElements,adminElementsChanged:L("adminElements",B.adminElements),webhooks:B.webhooks,webhooksChanged:L("webhooks",B.webhooks),hasWebhookEntry:I,locales:B.locales,localesChanged:L("locales",B.locales),mockTemplates:B.mockTemplates,mockTemplatesChanged:L("mockTemplates",B.mockTemplates),projectFiles:B.projectFiles,projectFilesChanged:L("projectFiles",B.projectFiles),hasEarlierGeneratedTsconfig:S,hasEarlierGeneratedEslintConfig:_,hasEarlierGeneratedPrettierConfig:O,customCode:B.customCode,customCodeChanged:L("customCode",B.customCode),envs:R.output,envsChanged:R.changed}),$=buildProjectFileIndex(P);for(let e of $.values()){if("pinned"!==e.webhookMembership&&"named-handler"!==e.webhookMembership)continue;let n=l(e,$);void 0!==n&&x.error(o.WEBHOOK_UNSAFE_IMPORT,i[o.WEBHOOK_UNSAFE_IMPORT](n.fileName,n.inclusionReason,n.importer,n.specifier))}return P};
@@ -0,0 +1,16 @@
1
+ /**
2
+ * One-time migration, see the top of this module: true only before a checkout's first sync with this SDK.
3
+ *
4
+ * Whether the content of a project's root `eslint.config.js` is the file earlier SDK versions
5
+ * generated. Whitespace, semicolons and the quote style do not count; any other difference makes the
6
+ * file the project's own.
7
+ */
8
+ export declare const isEarlierGeneratedEslintConfig: (content: string) => boolean;
9
+ /**
10
+ * One-time migration, see the top of this module: true only before a checkout's first sync with this SDK.
11
+ *
12
+ * Whether the content of a project's root `prettier.config.js` is the file earlier SDK versions
13
+ * generated. Whitespace, semicolons and the quote style do not count; any other difference makes the
14
+ * file the project's own.
15
+ */
16
+ export declare const isEarlierGeneratedPrettierConfig: (content: string) => boolean;
@@ -0,0 +1,9 @@
1
+ let e=`/**
2
+ * Auto-generated file.
3
+ * Do not modify this file manually.
4
+ * Version: 1
5
+ */`,t=["@salsita-ai/sdk/common","@salsita-ai/platform-common","@salsita-ai/common"],a=(a,r)=>t.map(t=>`${e}
6
+ import { ${a} } from '${t}/${r}'
7
+
8
+ export default ${a}
9
+ `),r=e=>e.replace(/\s+/g,"").replace(/;/g,"").replace(/"/g,"'"),i=new Set(a("eslintrc","eslint").map(r)),o=new Set(a("prettierrc","prettier").map(r));export const isEarlierGeneratedEslintConfig=e=>i.has(r(e));export const isEarlierGeneratedPrettierConfig=e=>o.has(r(e));
@@ -0,0 +1,9 @@
1
+ /**
2
+ * One-time migration, see the top of this module: true only before a checkout's first sync with this SDK.
3
+ *
4
+ * Whether the content of a project's root `tsconfig.json` is the file earlier SDK versions generated.
5
+ * The comparison is by meaning: comments, formatting and key order do not count, so a generated
6
+ * file that an editor or formatter rewrote is still recognised. Content that does not parse, or that
7
+ * differs in any setting, is the project's own.
8
+ */
9
+ export declare const isEarlierGeneratedTsconfig: (content: string) => boolean;
@@ -0,0 +1 @@
1
+ import e from"lodash-es/isEqual.js";let l={compilerOptions:{noEmit:!0,module:"ESNext",moduleResolution:"Bundler",lib:["ES2022","DOM"],esModuleInterop:!0,isolatedModules:!0,resolveJsonModule:!0,allowJs:!1,skipLibCheck:!0,strict:!0,noImplicitOverride:!0,noImplicitReturns:!0,noPropertyAccessFromIndexSignature:!0,noUncheckedIndexedAccess:!0,allowUnreachableCode:!1,allowUnusedLabels:!1,noFallthroughCasesInSwitch:!0,noUnusedLocals:!0,noUnusedParameters:!0,useDefineForClassFields:!0,jsx:"react-jsx",paths:{}},include:["src",".phoenix","prettier.config.js","eslint.config.js","./.phoenix/globals.d.ts"]},s=(e,l)=>{let s=l+1;for(;s<e.length&&'"'!==e[s];)s+="\\"===e[s]?2:1;return s+1};export const isEarlierGeneratedTsconfig=t=>e((e=>{try{return JSON.parse((e=>{let l="",t=0;for(;t<e.length;){let n=e[t];if('"'===n){let n=s(e,t);l+=e.slice(t,n),t=n;continue}","===n&&/^\s*[}\]]/.test(e.slice(t+1))||(l+=n),t++}return l})((e=>{let l="",t=0;for(;t<e.length;){let n=e[t],o=e[t+1];if('"'===n){let n=s(e,t);l+=e.slice(t,n),t=n}else if("/"===n&&"/"===o){let l=e.indexOf("\n",t);t=-1===l?e.length:l}else if("/"===n&&"*"===o){let l=e.indexOf("*/",t+2);t=-1===l?e.length:l+2}else l+=n,t++}return l})(e)))}catch{return}})(t),l);
@@ -1 +1 @@
1
- import{parse as r}from"yaml";import{Branded as e}from"@salsita-ai/common/utils";import{DiagnosticCode as t,diagnosticMessages as n}from"../../errors/index.js";export const parseYamlSpecFile=(o,a)=>{try{let i=r(o.file.content,{merge:!0});if(null===i)return a.warning(t.EMPTY_SPEC_FILE,n.EMPTY_SPEC_FILE()),e({name:o.file.name,content:{}});if("object"!=typeof i||Array.isArray(i))return void a.error(t.YAML_PARSE_ERROR,n.YAML_PARSE_ERROR("File did not parse to an object"));return e({name:o.file.name,content:i})}catch(r){a.error(t.YAML_PARSE_ERROR,n.YAML_PARSE_ERROR(r instanceof Error?r.message:String(r)));return}};
1
+ import{parse as r}from"yaml";import{Branded as e}from"@salsita-ai/common/utils";import{DiagnosticCode as t,diagnosticMessages as n}from"../../errors/index.js";let o=(r,e,i)=>{if("number"==typeof r)return!Number.isFinite(r)&&(i.at(...e).error(t.NON_FINITE_NUMBER,n.NON_FINITE_NUMBER(e.join("."),String(r))),!0);if("object"!=typeof r||null===r)return!1;let a=!1;for(let[t,n]of Object.entries(r))a=o(n,[...e,t],i)||a;return a};export const parseYamlSpecFile=(i,a)=>{try{let E=r(i.file.content,{merge:!0});if(null===E)return a.warning(t.EMPTY_SPEC_FILE,n.EMPTY_SPEC_FILE()),e({name:i.file.name,content:{}});if("object"!=typeof E||Array.isArray(E))return void a.error(t.YAML_PARSE_ERROR,n.YAML_PARSE_ERROR("File did not parse to an object"));if(o(E,[],a))return;return e({name:i.file.name,content:E})}catch(r){a.error(t.YAML_PARSE_ERROR,n.YAML_PARSE_ERROR(r instanceof Error?r.message:String(r)));return}};
@@ -1 +1 @@
1
- import{Branded as e}from"@salsita-ai/common/utils";import{DiagnosticCode as t,diagnosticMessages as s}from"../../../../errors/index.js";import{Components as n,UserComponents as r}from"../../components/index.js";import{Expressions as o}from"../../expressions/index.js";import{Invariants as i}from"../../invariants/index.js";import{ConfigurationSchema as a,Defaults as m,ModelVersion as l,Presets as p}from"../../model/index.js";import{Relations as d}from"../../relations/index.js";import{ResolvedVersions as f}from"../resolved-versions.js";import{AdminPages as S}from"./admin-pages.js";import{AdminStates as v}from"./states.js";export const AdminSpec=(g,x)=>{let{rawModel:u,rawPresets:I,rawExpressions:N,rawInvariants:T,rawRelations:_,rawDefaults:c,migrationFiles:j,rawComponents:A,rawAdminPages:C,dataSpec:E,phxDefinitions:M,evalExpressionParser:h,label:L,requireMigrationFiles:y}=g;if(0===Object.keys(u).length)return void x.at(L).error(t.MISSING_MODEL,s.MISSING_MODEL(L));u.latest||x.at(L).error(t.MISSING_LATEST,s.MISSING_LATEST(L));let G=new Map;for(let[e,t]of Object.entries(u)){let s=l(e,t,M,x.at(L,e));s&&G.set(s.versionKey,s)}if(x.hasErrors)return;let O=f(G,j,x,{requireMigrationFiles:y});if(!O)return;let D=O.versionedModels.find(e=>e.isLatest)?.modelVersion;if(!D)return;let V=O.latestVersion,P=a(D,V),b=d(_,D,M,x),w=i({rawInvariants:T,rawExpressions:N,rawRelations:_,rawComponents:A},D,x),F=p(I,D,b,x),k=S(C,{latestModel:D,parsingContext:x.at(L,"$adminPages")},E);if(!k)return;let K=r(A,{allNames:D.allNames,resolvedShapes:D.resolvedShapes,parsingContext:x}),$=m(c,D,x.at(L,"defaults")),q=o({rawExpressions:N,inferredExpressions:[...b.expressions,...w.expressions,...K.expressions]},{latestModel:D,aliases:D.aliases,entityTypes:D.entityTypes,evalExpressionParser:h,parsingContext:x}),z=n({userComponents:K.components,generatedComponents:[...b.components,...k.components],invariantComponents:w.components},{aliases:D.aliases,parsingContext:x});if(void 0!==$&&void 0!==q&&void 0!==z)return e({latestModel:D,schemaVersion:V,resolvedVersions:O,components:z,configurationSchema:P,presets:F,expressions:q,invariants:w,defaults:$,states:v(((n,r,o)=>{if(0===r.length)return n;let i=1===n.navigationStates.length&&"Default"===n.navigationStates[0]?[]:n.navigationStates,a=i.filter(e=>r.includes(e));return a.length>0&&o.error(t.ADMIN_PAGES_NAV_STATE_CONFLICT,s.ADMIN_PAGES_NAV_STATE_CONFLICT(a)),e({...n,navigationStates:[...i,...r]})})(g.rawStates,k.navigationStates,x),x),adminPages:k})};
1
+ import{Branded as e}from"@salsita-ai/common/utils";import{DiagnosticCode as t,diagnosticMessages as s}from"../../../../errors/index.js";import{Components as n,UserComponents as r}from"../../components/index.js";import{Expressions as o}from"../../expressions/index.js";import{Invariants as i}from"../../invariants/index.js";import{ConfigurationSchema as a,Defaults as m,ModelVersion as p,Presets as l}from"../../model/index.js";import{Relations as d}from"../../relations/index.js";import{ResolvedVersions as f}from"../resolved-versions.js";import{AdminPages as S}from"./admin-pages.js";import{AdminStates as x}from"./states.js";export const AdminSpec=(g,v)=>{let{rawModel:u,rawPresets:I,rawExpressions:T,rawInvariants:_,rawRelations:c,rawDefaults:j,migrationFiles:A,rawComponents:C,rawAdminPages:E,dataSpec:M,phxDefinitions:N,evalExpressionParser:L,label:y,requireMigrationFiles:G}=g;if(0===Object.keys(u).length)return void v.at(y).error(t.MISSING_MODEL,s.MISSING_MODEL(y));u.latest||v.at(y).error(t.MISSING_LATEST,s.MISSING_LATEST(y));let O=new Map;for(let[e,t]of Object.entries(u)){let s=p(e,t,N,v.at(y,e));s&&O.set(s.versionKey,s)}if(v.hasErrors)return;let h=f(O,A,v,{requireMigrationFiles:G});if(!h)return;let D=h.versionedModels.find(e=>e.isLatest)?.modelVersion;if(!D)return;let V=h.latestVersion,P=a(D,V),b=d(c,D,N,v),w=i({rawInvariants:_,rawExpressions:T,rawRelations:c,rawComponents:C},D,N,v),F=l(I,D,b,v),R=S(E,{latestModel:D,parsingContext:v.at(y,"$adminPages")},M);if(!R)return;let k=r(C,{latestModel:D,phxDefinitions:N,parsingContext:v}),K=m(j,D,v.at(y,"defaults")),$=o({rawExpressions:T,inferredExpressions:[...b.expressions,...w.expressions,...k.expressions],expressionReads:k.expressionReads},{latestModel:D,aliases:D.aliases,entityTypes:D.entityTypes,evalExpressionParser:L,phxDefinitions:N,parsingContext:v}),q=n({userComponents:k.components,generatedComponents:[...b.components,...R.components],invariantComponents:w.components},{aliases:D.aliases,parsingContext:v});if(void 0!==K&&void 0!==$&&void 0!==q)return e({latestModel:D,schemaVersion:V,resolvedVersions:h,components:q,configurationSchema:P,presets:F,expressions:$,invariants:w,defaults:K,states:x(((n,r,o)=>{if(0===r.length)return n;let i=1===n.navigationStates.length&&"Default"===n.navigationStates[0]?[]:n.navigationStates,a=i.filter(e=>r.includes(e));return a.length>0&&o.error(t.ADMIN_PAGES_NAV_STATE_CONFLICT,s.ADMIN_PAGES_NAV_STATE_CONFLICT(a)),e({...n,navigationStates:[...i,...r]})})(g.rawStates,R.navigationStates,v),v),adminPages:R})};