@salsita-ai/sdk 0.50.0-develop.f9cd9b3a12 → 0.50.0-develop.fda84314a5

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 (240) hide show
  1. package/dist/application/index.d.ts +1 -0
  2. package/dist/application/index.js +1 -1
  3. package/dist/application/mount-application.d.ts +1 -1
  4. package/dist/application/mount-application.js +1 -1
  5. package/dist/application/mount-configurator.d.ts +19 -0
  6. package/dist/application/mount-configurator.js +1 -0
  7. package/dist/application/mounted-application-runtime.d.ts +4 -0
  8. package/dist/application/mounted-application-runtime.js +1 -0
  9. package/dist/application/register-web-component.d.ts +2 -0
  10. package/dist/application/register-web-component.js +1 -0
  11. package/dist/application-spec/generate-application/implementations/phx-application-types.d.ts +25 -0
  12. package/dist/application-spec/generate-application/implementations/phx-application-types.js +1 -0
  13. package/dist/application-spec/generate-application/implementations/phx-domain.d.ts +36 -0
  14. package/dist/application-spec/generate-application/implementations/phx-domain.js +1 -0
  15. package/dist/application-spec/generate-application/implementations/phx-model.d.ts +24 -0
  16. package/dist/application-spec/generate-application/implementations/phx-model.js +1 -0
  17. package/dist/application-spec/generate-application/implementations/phx.d.ts +22 -0
  18. package/dist/application-spec/generate-application/implementations/phx.js +1 -0
  19. package/dist/application-spec/generate-application/index.d.ts +2 -0
  20. package/dist/application-spec/generate-application/index.js +1 -1
  21. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-model-runtime.d.ts +3 -3
  22. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.d.ts +7 -4
  23. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.js +1 -1
  24. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-spec-runtime.d.ts +16 -0
  25. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-spec-runtime.js +1 -0
  26. package/dist/application-spec/generate-application/runtime/application-runtime.d.ts +17 -4
  27. package/dist/application-spec/generate-application/runtime/application-runtime.js +1 -1
  28. package/dist/application-spec/generate-application/runtime/application-spec-slice.d.ts +71 -0
  29. package/dist/application-spec/generate-application/runtime/application-spec-slice.js +1 -0
  30. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-model-runtime.d.ts +3 -3
  31. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.d.ts +7 -5
  32. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.js +1 -1
  33. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-spec-runtime.d.ts +16 -0
  34. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-spec-runtime.js +1 -0
  35. package/dist/application-spec/generate-application/runtime/create-application.d.ts +57 -0
  36. package/dist/application-spec/generate-application/runtime/create-application.js +1 -0
  37. package/dist/application-spec/generate-application/runtime/index.d.ts +8 -0
  38. package/dist/application-spec/generate-application/runtime/index.js +1 -0
  39. package/dist/application-spec/generate-application/runtime/sections/expression-runtime.d.ts +9 -3
  40. package/dist/application-spec/generate-application/runtime/sections/expression-runtime.js +1 -1
  41. package/dist/application-spec/generate-application/runtime/spec-runtime.d.ts +21 -0
  42. package/dist/application-spec/generate-application/runtime/spec-runtime.js +1 -0
  43. package/dist/application-spec/generate-application/runtime-spec/encoded-runtime-spec.d.ts +3 -2
  44. package/dist/application-spec/generate-application/runtime-spec/runtime-spec.d.ts +44 -9
  45. package/dist/application-spec/generate-application/runtime-spec/runtime-spec.js +1 -1
  46. package/dist/client/authorized-client.d.ts +3 -1
  47. package/dist/client/authorized-client.js +1 -1
  48. package/dist/client/contract.d.ts +17 -0
  49. package/dist/client/index.d.ts +1 -1
  50. package/dist/client/local-authorized-client.d.ts +3 -1
  51. package/dist/client/local-authorized-client.js +1 -1
  52. package/dist/client/memory-authorized-client.d.ts +4 -1
  53. package/dist/client/memory-authorized-client.js +1 -1
  54. package/dist/client/phoenix-api.d.ts +228 -0
  55. package/dist/configurator/ConfiguratorApp.js +1 -1
  56. package/dist/configurator/app-loader-content/index.d.ts +0 -1
  57. package/dist/configurator/app-loader-content/index.js +1 -1
  58. package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
  59. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +13 -0
  60. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
  61. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.d.ts +2 -1
  62. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -1
  63. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +15 -9
  64. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
  65. package/dist/configurator/common/configurator-interface.d.ts +3 -5
  66. package/dist/configurator/common/configurator-interface.js +1 -1
  67. package/dist/configurator/configuration-not-found-page/BuiltInConfigurationNotFoundPage.d.ts +5 -0
  68. package/dist/configurator/configuration-not-found-page/BuiltInConfigurationNotFoundPage.js +1 -0
  69. package/dist/configurator/configuration-not-found-page/ConfigurationNotFoundPageElement.d.ts +0 -6
  70. package/dist/configurator/configuration-not-found-page/ConfigurationNotFoundPageElement.js +1 -1
  71. package/dist/configurator/configuration-not-found-page/index.d.ts +2 -2
  72. package/dist/configurator/configuration-not-found-page/index.js +1 -1
  73. package/dist/configurator/configurator-error-page/BuiltInConfiguratorErrorPage.d.ts +3 -3
  74. package/dist/configurator/configurator-error-page/BuiltInConfiguratorErrorPage.js +1 -1
  75. package/dist/configurator/configurator-error-page/ConfiguratorErrorPageElement.d.ts +0 -5
  76. package/dist/configurator/configurator-error-page/ConfiguratorErrorPageElement.js +1 -1
  77. package/dist/configurator/configurator-error-page/index.d.ts +1 -2
  78. package/dist/configurator/configurator-error-page/index.js +1 -1
  79. package/dist/configurator/index.d.ts +9 -2
  80. package/dist/configurator/index.js +1 -1
  81. package/dist/configurator/pages/default-configurator-elements.js +1 -1
  82. package/dist/configurator/pages/error-boundaries/LoadingErrorBoundary.js +1 -1
  83. package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.d.ts +1 -1
  84. package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.js +1 -1
  85. package/dist/configurator/ui/assistant/screenshots/tool-screenshots.d.ts +12 -4
  86. package/dist/configurator/ui/assistant/screenshots/tool-screenshots.js +1 -1
  87. package/dist/configurator/ui/assistant/screenshots/use-screenshot-src.d.ts +8 -0
  88. package/dist/configurator/ui/assistant/screenshots/use-screenshot-src.js +1 -0
  89. package/dist/configurator/ui/configurator-layout/slots/canvas/LayoutCanvas.js +1 -1
  90. package/dist/configurator/ui/configurator-layout/slots/canvas/SharedCanvas.js +1 -1
  91. package/dist/configurator/ui/legacy/layout/common/ReactiveInterfaceLayout.js +1 -1
  92. package/dist/configurator/ui/phoenix-layout-elements/AppLoader.d.ts +0 -7
  93. package/dist/configurator/ui/phoenix-layout-elements/AppLoader.js +2 -2
  94. package/dist/configurator/ui/phoenix-layout-elements/index.d.ts +8 -1
  95. package/dist/configurator/ui/phoenix-layout-elements/index.js +1 -1
  96. package/dist/configurator/ui/preset-layout/PresetUi.d.ts +0 -2
  97. package/dist/configurator/ui/preset-layout/PresetUi.js +1 -1
  98. package/dist/configurator/ui/preset-layout/index.d.ts +6 -1
  99. package/dist/configurator/ui/preset-layout/index.js +1 -1
  100. package/dist/docs/index.json +34 -1
  101. package/dist/docs/layouts/gallery/corvid-drone.mdx +3428 -0
  102. package/dist/docs/layouts/gallery/nightjar-guitar.mdx +3698 -0
  103. package/dist/docs/layouts/gallery/tidepool-aquascape.mdx +5203 -0
  104. package/dist/docs/phoenix/configurator-interface.mdx +4 -3
  105. package/dist/docs/phoenix/sdk-builder-workflow.mdx +4 -2
  106. package/dist/domain/application/assistant/build-assistant-manifest.js +1 -1
  107. package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
  108. package/dist/domain/application/configurator-builder.d.ts +7 -1
  109. package/dist/domain/application/configurator-builder.js +1 -1
  110. package/dist/domain/application/index.d.ts +1 -1
  111. package/dist/domain/application/index.js +1 -1
  112. package/dist/domain/application/standard-properties.js +1 -1
  113. package/dist/domain/domain-builder.d.ts +9 -3
  114. package/dist/domain/domain-builder.js +1 -1
  115. package/dist/domain/domain-runtime/application.d.ts +39 -0
  116. package/dist/domain/domain-runtime/application.js +1 -0
  117. package/dist/domain/domain-runtime/domain-runtime.d.ts +36 -4
  118. package/dist/domain/domain-runtime/domain-runtime.js +1 -1
  119. package/dist/domain/domain-runtime/environment/initialize.d.ts +1 -1
  120. package/dist/domain/domain-runtime/errors/implementation-error-collector.d.ts +2 -0
  121. package/dist/domain/domain-runtime/errors/implementation-error-collector.js +1 -1
  122. package/dist/domain/domain-runtime/index.d.ts +2 -1
  123. package/dist/domain/domain-runtime/index.js +1 -1
  124. package/dist/domain/domain-runtime/spec/index.d.ts +1 -1
  125. package/dist/domain/domain-runtime/spec/index.js +1 -1
  126. package/dist/domain/domain-runtime/spec/module-checks/index.d.ts +1 -0
  127. package/dist/domain/domain-runtime/spec/module-checks/index.js +1 -1
  128. package/dist/domain/domain-runtime/spec/module-checks/merge-expression-modules.d.ts +23 -0
  129. package/dist/domain/domain-runtime/spec/module-checks/merge-expression-modules.js +1 -0
  130. package/dist/domain/domain-runtime/spec/module-checks/resolve-expression-modules.d.ts +3 -4
  131. package/dist/domain/domain-runtime/spec/module-checks/resolve-expression-modules.js +1 -1
  132. package/dist/domain/domain-runtime/web-component/actions.d.ts +3 -0
  133. package/dist/domain/domain-runtime/web-component/actions.js +1 -1
  134. package/dist/domain/domain-runtime/web-component/initialize.d.ts +1 -0
  135. package/dist/domain/domain-runtime/web-component/initialize.js +1 -1
  136. package/dist/domain/domain-runtime/web-component/selectors.d.ts +2 -0
  137. package/dist/domain/domain-runtime/web-component/selectors.js +1 -1
  138. package/dist/domain/domain-runtime/web-component/types.d.ts +6 -3
  139. package/dist/domain/mocks/create-mock-domain-runtime.d.ts +5 -0
  140. package/dist/editor/domain-editors/DomainSpecContext.js +1 -1
  141. package/dist/editor/domain-editors/apply-spec-update.d.ts +2 -1
  142. package/dist/editor/domain-editors/apply-spec-update.js +1 -1
  143. package/dist/editor/domain-editors/use-implementation-files.d.ts +6 -14
  144. package/dist/editor/domain-editors/use-implementation-files.js +1 -1
  145. package/dist/react-sdk/application-runtime/common-services/analytics/analytics-service.d.ts +1 -1
  146. package/dist/react-sdk/application-runtime/common-services/initialize.d.ts +2 -2
  147. package/dist/react-sdk/application-runtime/hooks/index.d.ts +1 -0
  148. package/dist/react-sdk/application-runtime/hooks/index.js +1 -1
  149. package/dist/react-sdk/application-runtime/hooks/loading/index.d.ts +5 -0
  150. package/dist/react-sdk/application-runtime/hooks/loading/index.js +1 -0
  151. package/dist/react-sdk/application-runtime/hooks/loading/loader-host-context.d.ts +11 -0
  152. package/dist/react-sdk/application-runtime/hooks/loading/loader-host-context.js +1 -0
  153. package/dist/react-sdk/application-runtime/hooks/loading/use-is-awaiting-loading-phase.d.ts +8 -0
  154. package/dist/react-sdk/application-runtime/hooks/loading/use-is-awaiting-loading-phase.js +1 -0
  155. package/dist/react-sdk/application-runtime/hooks/loading/use-is-loader-hosted.d.ts +7 -0
  156. package/dist/react-sdk/application-runtime/hooks/loading/use-is-loader-hosted.js +1 -0
  157. package/dist/react-sdk/application-runtime/hooks/loading/use-loading-actions.d.ts +9 -0
  158. package/dist/react-sdk/application-runtime/hooks/loading/use-loading-actions.js +1 -0
  159. package/dist/react-sdk/application-runtime/hooks/loading/use-loading-application.d.ts +24 -0
  160. package/dist/react-sdk/application-runtime/hooks/loading/use-loading-application.js +1 -0
  161. package/dist/react-sdk/application-runtime/hooks/use-access-service.js +1 -1
  162. package/dist/react-sdk/application-runtime/hooks/use-web-component-readonly-sync.d.ts +4 -11
  163. package/dist/react-sdk/application-runtime/hooks/use-web-component-readonly-sync.js +1 -1
  164. package/dist/react-sdk/application-runtime/hooks/use-web-component.d.ts +5 -0
  165. package/dist/react-sdk/application-runtime/hooks/use-web-component.js +1 -1
  166. package/dist/react-sdk/application-runtime/host-properties/actions.d.ts +15 -0
  167. package/dist/react-sdk/application-runtime/host-properties/actions.js +1 -0
  168. package/dist/react-sdk/application-runtime/host-properties/connect-host-properties.d.ts +30 -0
  169. package/dist/react-sdk/application-runtime/host-properties/connect-host-properties.js +1 -0
  170. package/dist/react-sdk/application-runtime/host-properties/domain-host-properties.d.ts +7 -0
  171. package/dist/react-sdk/application-runtime/host-properties/domain-host-properties.js +1 -0
  172. package/dist/react-sdk/application-runtime/host-properties/host-property-descriptors.d.ts +21 -0
  173. package/dist/react-sdk/application-runtime/host-properties/host-property-descriptors.js +1 -0
  174. package/dist/react-sdk/application-runtime/host-properties/host-property-scopes.d.ts +42 -0
  175. package/dist/react-sdk/application-runtime/host-properties/host-property-scopes.js +1 -0
  176. package/dist/react-sdk/application-runtime/host-properties/index.d.ts +8 -0
  177. package/dist/react-sdk/application-runtime/host-properties/index.js +1 -0
  178. package/dist/react-sdk/application-runtime/host-properties/initialize.d.ts +7 -0
  179. package/dist/react-sdk/application-runtime/host-properties/initialize.js +1 -0
  180. package/dist/react-sdk/application-runtime/host-properties/selectors.d.ts +54 -0
  181. package/dist/react-sdk/application-runtime/host-properties/selectors.js +1 -0
  182. package/dist/react-sdk/application-runtime/host-properties/types.d.ts +18 -0
  183. package/dist/react-sdk/application-runtime/index.d.ts +2 -0
  184. package/dist/react-sdk/application-runtime/loading/actions.d.ts +45 -0
  185. package/dist/react-sdk/application-runtime/loading/actions.js +1 -0
  186. package/dist/react-sdk/application-runtime/loading/index.d.ts +4 -0
  187. package/dist/react-sdk/application-runtime/loading/index.js +1 -0
  188. package/dist/react-sdk/application-runtime/loading/initialize.d.ts +3 -0
  189. package/dist/react-sdk/application-runtime/loading/initialize.js +1 -0
  190. package/dist/react-sdk/application-runtime/loading/selectors.d.ts +18 -0
  191. package/dist/react-sdk/application-runtime/loading/selectors.js +1 -0
  192. package/dist/react-sdk/application-runtime/loading/types.d.ts +59 -0
  193. package/dist/react-sdk/application-runtime/loading/types.js +1 -0
  194. package/dist/react-sdk/application-runtime/mocks/create-mock-application-runtime.js +1 -1
  195. package/dist/react-sdk/application-runtime/provider/ApplicationRuntime.d.ts +6 -0
  196. package/dist/react-sdk/application-runtime/provider/ApplicationRuntime.js +1 -1
  197. package/dist/react-sdk/application-runtime/provider/ApplicationType.d.ts +7 -0
  198. package/dist/react-sdk/application-runtime/provider/ApplicationType.js +1 -1
  199. package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +218 -8
  200. package/dist/react-sdk/application-runtime/runtime/create-application-runtime.js +1 -1
  201. package/dist/react-sdk/domain-application-context/BackendDataProvider.js +1 -1
  202. package/dist/react-sdk/domain-application-context/FrontendDataProvider.js +1 -1
  203. package/dist/react-sdk/domain-application-context/PublishedDataProvider.js +1 -1
  204. package/dist/react-sdk/elements/index.d.ts +0 -1
  205. package/dist/react-sdk/index.d.ts +1 -0
  206. package/dist/react-sdk/index.js +1 -1
  207. package/dist/react-sdk/loading-state/LoaderHost.d.ts +20 -0
  208. package/dist/react-sdk/loading-state/LoaderHost.js +1 -0
  209. package/dist/react-sdk/loading-state/built-in-loading-phase.d.ts +9 -0
  210. package/dist/react-sdk/loading-state/built-in-loading-phase.js +1 -0
  211. package/dist/react-sdk/loading-state/create-app-loader.d.ts +18 -0
  212. package/dist/react-sdk/loading-state/create-app-loader.js +1 -0
  213. package/dist/react-sdk/loading-state/index.d.ts +4 -2
  214. package/dist/react-sdk/loading-state/index.js +1 -1
  215. package/dist/react-sdk/loading-state/{LoadingStateProvider.d.ts → loading-state-hooks.d.ts} +3 -12
  216. package/dist/react-sdk/loading-state/loading-state-hooks.js +1 -0
  217. package/dist/react-sdk/page-elements/ConfigurationNotFoundPagePropsProvider.d.ts +17 -0
  218. package/dist/react-sdk/page-elements/ConfigurationNotFoundPagePropsProvider.js +1 -0
  219. package/dist/react-sdk/page-elements/ConfiguratorErrorPagePropsProvider.d.ts +17 -0
  220. package/dist/react-sdk/page-elements/ConfiguratorErrorPagePropsProvider.js +1 -0
  221. package/dist/react-sdk/page-elements/configurator-error-page-props.js +1 -0
  222. package/dist/{configurator/configuration-not-found-page → react-sdk/page-elements}/create-configuration-not-found-page.d.ts +7 -1
  223. package/dist/react-sdk/page-elements/create-configuration-not-found-page.js +1 -0
  224. package/dist/{configurator/configurator-error-page → react-sdk/page-elements}/create-configurator-error-page.d.ts +6 -1
  225. package/dist/react-sdk/page-elements/create-configurator-error-page.js +1 -0
  226. package/dist/react-sdk/page-elements/create-preset-ui.d.ts +9 -0
  227. package/dist/react-sdk/page-elements/create-preset-ui.js +1 -0
  228. package/dist/react-sdk/page-elements/index.d.ts +6 -0
  229. package/dist/react-sdk/page-elements/index.js +1 -0
  230. package/dist/react-sdk/session/SessionServiceProvider.js +1 -1
  231. package/package.json +3 -3
  232. package/dist/configurator/app-loader-content/app-loader-content-name.d.ts +0 -5
  233. package/dist/configurator/app-loader-content/app-loader-content-name.js +0 -1
  234. package/dist/configurator/configuration-not-found-page/create-configuration-not-found-page.js +0 -1
  235. package/dist/configurator/configurator-error-page/create-configurator-error-page.js +0 -1
  236. package/dist/react-sdk/loading-state/LoadingStateProvider.js +0 -1
  237. package/dist/react-sdk/loading-state/loading-state-manager.d.ts +0 -37
  238. package/dist/react-sdk/loading-state/loading-state-manager.js +0 -1
  239. /package/dist/react-sdk/{elements/configurator-error-page-props.js → application-runtime/host-properties/types.js} +0 -0
  240. /package/dist/react-sdk/{elements → page-elements}/configurator-error-page-props.d.ts +0 -0
@@ -391,7 +391,7 @@ Use these factories to customize the preset-selection screen without changing ho
391
391
  - `createPresetPageAction` adds project-specific content below the default preset cards.
392
392
  - `createPresetDeviceNotSupported` adds project-specific overlay content above the default preset cards.
393
393
 
394
- Without `createPresetUi`, Phoenix renders its built-in preset screen, which is the default `PresetUi` registration in `defaultConfiguratorElements`. The action and the overlay are parts of that built-in screen and render nothing until the project registers them.
394
+ Without `createPresetUi`, Phoenix renders its built-in preset screen, which is the default `PresetUi` registration in `defaultConfiguratorElements`. The action and the overlay are parts of that built-in screen and render nothing until the project registers them. `createPresetUi` and the element's name, `PresetUiName`, are also exported from `@salsita-ai/sdk/react`.
395
395
 
396
396
  ```typescript
397
397
  const PresetScreen = phx.frontend.createPresetUi(CustomPresetScreen)
@@ -413,7 +413,7 @@ export default phx.frontend.createConfigurationNotFoundPage(({ onBack }) => (
413
413
  ))
414
414
  ```
415
415
 
416
- The helper types the page's props as `ConfigurationNotFoundPageProps` from `@salsita-ai/sdk/react`. A layout element registered under the name `ConfigurationNotFoundPage` with `createCustomPhoenixLayoutElement` replaces the page too, but its component is typed as taking only `children`.
416
+ The helper types the page's props as `ConfigurationNotFoundPageProps` from `@salsita-ai/sdk/react`, which also exports the helper and the element's name, `ConfigurationNotFoundPageName`. A layout element registered under the name `ConfigurationNotFoundPage` with `createCustomPhoenixLayoutElement` replaces the page too, but its component is typed as taking only `children`.
417
417
 
418
418
  - The page receives one optional prop, `onBack`, which returns to the start of the configurator. It is set when a configuration fails to load or is opened without a valid access key. It is not set on the start page itself, so a page that offers a way back shows it only when `onBack` is set.
419
419
  - The configurator renders the element in four cases: a configuration fails to load, for example because its ID does not exist or the server rejects its access key; a configuration is opened without an access key for it; a signed-in user whose role may not create configurations (`acl.canCreate`) opens the start page; the preset screen has no preset category to show, for example because the host's `presetTags` match no preset. The last case happens inside the built-in preset screen, so a project that replaces it with `createPresetUi` decides what to show itself.
@@ -434,7 +434,7 @@ export default phx.frontend.createConfiguratorErrorPage(({ reason, onRetry }) =>
434
434
  ))
435
435
  ```
436
436
 
437
- The helper types the page's props as `ConfiguratorErrorPageProps` from `@salsita-ai/sdk/react`. A layout element registered under the name `ConfiguratorErrorPage` with `createCustomPhoenixLayoutElement` replaces the page too, but its component is typed as taking only `children`.
437
+ The helper types the page's props as `ConfiguratorErrorPageProps` from `@salsita-ai/sdk/react`, which also exports the helper and the element's name, `ConfiguratorErrorPageName`. A layout element registered under the name `ConfiguratorErrorPage` with `createCustomPhoenixLayoutElement` replaces the page too, but its component is typed as taking only `children`.
438
438
 
439
439
  - The page receives two props. `reason` says what failed: `uncaughtError` when rendering the configurator failed with an error nothing else handled, `presetCreationFailed` when starting a configuration from the only preset failed. `onRetry` tries again: after `uncaughtError` it renders the configurator again, after `presetCreationFailed` it reloads the page. The error itself is not passed; it is logged to the console.
440
440
  - The configurator renders the element in two cases: an error reaches the configurator's error boundary, which wraps everything from the scene resources and the session down to the pages, including a failure while the application starts; and creating a configuration fails on a start screen with a single preset. The element is available in both, because the spec and its elements are part of the application before the configurator renders.
@@ -451,6 +451,7 @@ export default phx.frontend.createAppLoader(({ phases }) => <span>{phases[0]?.la
451
451
  ```
452
452
 
453
453
  - Phoenix keeps the overlay, its place over the safe area and its fade-in; the element is only what it shows.
454
+ - `createAppLoader`, the props type `AppLoaderContentProps` and the element's name, `AppLoaderContentName`, are also exported from `@salsita-ai/sdk/react`.
454
455
  - The overlay stays up while a loading phase runs: the session, the project's data, the configuration and the 3D scene. It waits for the scene only when the loaded configuration's layout mounts a canvas, as the built-in layouts and `LayoutSlots.SharedCanvas` do. A `ConfiguratorLayout` without a canvas is not held by the loader: the overlay leaves once the configuration is up.
455
456
  - The top-level `appLoader: legacy` key in the spec turns the overlay off.
456
457
  - The built-in content is the default `AppLoaderContent` registration in `defaultConfiguratorElements`, see below.
@@ -85,7 +85,9 @@ On the server, the install runs pnpm. It follows your `pnpm-lock.yaml` and `pnpm
85
85
 
86
86
  If the build fails, is cancelled or takes too long, `phoenix deploy` prints the end of the build log and exits with an error. `--no-wait` returns as soon as the build starts.
87
87
 
88
- Studio's **Builds & deployments** page lists your builds and shows which one your configurator serves. Each build shows its progress, its error and the full build log while it runs.
88
+ Studio's **Builds & deployments** page lists your builds, 20 to a page, and shows which one your configurator serves. Filter it to the live build or to the builds that failed. Each build shows its progress, its error and the full build log while it runs, and who deployed it with which CLI token.
89
+
90
+ **Rebuild** on a build's page builds the files uploaded with that build again, with your environment variables as they are now, without a new `phoenix deploy`. Use it after changing a variable, or when a build failed for a reason on our side. If the rebuild succeeds it goes live, so rebuilding an older build rolls production back to it.
89
91
 
90
92
  `phoenix deploy` refuses symlinks, hard-linked files and other special files among the project files, because builds only accept regular files. Packing uses the system `tar`, which macOS, Linux and Windows 10 or later all include. The build runner checks the uploaded archive again and keeps only project files, so a file outside the list above never reaches the build.
91
93
 
@@ -107,5 +109,5 @@ Coding agents working in your project use the same command, guided by the genera
107
109
  - `phoenix deploy` always deploys to the workspace's default project; it doesn't read `project` from the spec yet.
108
110
  - Only `phoenix dev` works from the sign-in. `phoenix deployment:prepare-dev` still needs the `.env` block of a Studio development environment.
109
111
  - Every deploy uploads the whole project; there are no incremental uploads.
110
- - Your own environment variables are set in Studio under Environment, by a super admin of the workspace, and apply from the next deploy. `phoenix dev` doesn't receive them: your development environment has its own variables. A build reads them from `process.env`; a webhook reads the ones the spec declares under `env.webhook`, through `phx.webhooksEnv` (see [Webhooks](?path=/docs/phoenix-webhooks--docs)). They can't use platform names such as `LAMBDA_FUNCTION_NAME`, the `AWS_` prefix, the identity provider settings such as `CLERK_API_KEY`, or names the CLI and the deploy tooling read themselves, such as `SERVER_URL` or `NODE_OPTIONS`; Studio refuses those names.
112
+ - Your own environment variables are set in Studio under Environment, by a super admin of the workspace, and apply from the next deploy. After a change, **Redeploy #N now** there rebuilds your live build with the new values, without a new `phoenix deploy`; it appears once your own build is live. `phoenix dev` doesn't receive them: your development environment has its own variables. A build reads them from `process.env`; a webhook reads the ones the spec declares under `env.webhook`, through `phx.webhooksEnv` (see [Webhooks](?path=/docs/phoenix-webhooks--docs)). They can't use platform names such as `LAMBDA_FUNCTION_NAME`, the `AWS_` prefix, the identity provider settings such as `CLERK_API_KEY`, or names the CLI and the deploy tooling read themselves, such as `SERVER_URL` or `NODE_OPTIONS`; Studio refuses those names.
111
113
  - Only super admins of a workspace can open its Studio. Admins and users see a page that says so.
@@ -1 +1 @@
1
- import{GraphQLBoolean as e,GraphQLEnumType as t,GraphQLID as n,GraphQLInputObjectType as i,GraphQLInterfaceType as s,GraphQLList as r,GraphQLNonNull as o,GraphQLObjectType as a,GraphQLSchema as p,GraphQLString as c,printSchema as d,validateSchema as l}from"graphql";import{GraphQLJSON as h,createAssistantValueType as w}from"./assistant-value-type.js";import{buildAssistantLenses as y}from"./build-assistant-lenses.js";import{createAssistantExecutionSchema as u}from"./create-assistant-execution-schema.js";let m="AnyDomainEntity",f="RootEntity",g=[["navigationState","Active navigation state.","navigationStates"],["viewState","Active view state.","viewStates"],["toolState","Active tool state.","toolStates"]],b={section:"childRecipes",mutation:"addChild"},v={section:"replaceRecipes",mutation:"replaceEntity"},j=(e,t)=>Object.entries(e).find(([e])=>e===t)?.[1],$=(e,t)=>{if(!t||0===t.length)return e;let n=`One of: ${t.map(e=>`"${e}"`).join(", ")}.`;return e?/[.!?]$/.test(e)?`${e} ${n}`:`${e}. ${n}`:n},O=({target:e,cardinality:t},n)=>{let i=n(e);switch(t){case"1-1":return new o(i);case"0-1":return i;case"0-N":case"1-N":return new o(new r(new o(i)))}},E=(e,t,i)=>{let s={id:{type:new o(n),description:i?`Unique id of the entity, assigned by the configurator, e.g. "${i}-1".`:void 0},type:{type:new o(c),description:i?`Entity type name, e.g. "${i}".`:void 0}};for(let n of e)s[n.name]={type:"edge"===n.type.kind?O(n.type,t):w(n.type.type),description:n.description};return s},R=e=>Object.fromEntries(e.map(({name:e,source:t,localized:n})=>[e,n?{source:t,localized:!0}:{source:t}])),k={sameForAllInstances:e=>`Same recipe groups and recipes for every ${e}.`,constantDuringSession:()=>"Fixed for the session."},T={sameForAllInstances:e=>`Same for every ${e}.`,constantDuringSession:()=>"Fixed for the session."},I=(e,t,n)=>e.map(e=>` ${t[e](n)}`).join(""),N=({section:e},{groups:t,hints:n},{entityType:i,purpose:s,recipeGroup:a})=>{let p=t.filter(({dryRuns:e})=>!e).map(({groupId:e})=>e);return 0===t.length?{}:{[e]:{type:new o(new r(new o(a))),description:`The recipe groups for ${s} this ${i}: ${t.map(({groupId:e})=>e).join(", ")}. A group is listed only while the configurator offers it on the entity.${p.length>0?` Recipes of these groups cannot be dry-run: ${p.join(", ")}.`:""}${I(n,k,i)}`}}},A=({entityType:e,childRecipes:n,replaceRecipes:i,optionsEdges:s,screenshots:p},{recipeGroup:c,fieldOption:d,screenshot:l})=>new a({name:`${e}Meta`,fields:Object.assign(N(b,n,{entityType:e,purpose:"adding children to",recipeGroup:c}),N(v,i,{entityType:e,purpose:"replacing",recipeGroup:c}),...s.map(({options:{edgeName:t,field:n,validate:i,dryRuns:s},hints:a})=>({[t]:{type:new r(new o(d)),description:`Values "${n}" accepts on this ${e}. Null when there is no choice to make.${i?"":" Not checked on write."}${s?"":" Cannot be dry-run."}${I(a,T,e)}`}})),0===p.length?{}:{screenshot:{type:l,args:{view:{type:new o(new t({name:`${e}ScreenshotView`,values:Object.fromEntries(p.map(({view:e,description:t})=>[e,{description:t}]))}))}},description:"Renders this entity from a predefined view. The picture follows the tool result as an image labelled with `image`. Each one costs tokens and blocks the user's configurator while it renders: ask only when seeing the design answers something the data cannot. The images of one call share a size budget; past it, further screenshots come back null. Null as well when the view does not apply to this entity right now."}})}),S=e=>Object.entries(e).map(([e,t])=>`${e} (${t.map(({groupId:e})=>e).join(", ")})`);export const buildAssistantManifest=t=>{var O,k,T,I,N;let M,D,F,W,{entityTypes:x,aliases:C,exampleType:q,fields:G,states:U,deletableTypes:K,writableTypes:V,actionFields:z,optionsEdges:P}=t,L=Object.fromEntries(Object.entries(t.childRecipes).map(([e,t])=>[e,t.groups])),Q=Object.fromEntries(Object.entries(t.replaceRecipes).map(([e,t])=>[e,t.groups])),B=new Map,H=new Map,J=new Map,X=e=>{let[t,...n]=Object.entries(C).find(([t])=>t===e)?.[1]??[];return(t&&0===n.length?H.get(t):void 0)??J.get(e)??Z},Y=e=>H.get(e)??X(e),Z=new s({name:m,description:"Every entity of the configuration.",fields:()=>E(G[m]??[],Y,q)});for(let e of(J.set(m,Z),Object.keys(C)))e!==m&&J.set(e,new s({name:e,interfaces:[Z],fields:()=>E(G[e]??[],Y)}));let _={};for(let e of x){let t=[m,...Object.entries(C).filter(([t,n])=>t!==m&&n.includes(e)).map(([e])=>e)],n=G[e]??[];_[e]=R(n),H.set(e,new a({name:e,interfaces:t.flatMap(e=>J.get(e)??[]),fields:()=>{let t=B.get(e);return{...E(n,Y),...t?{meta:{type:new o(t),description:"What can be done to this entity right now."}}:{}}}}))}let ee=(O=()=>X(J.has(f)?f:m),k=()=>X(m),M=new a({name:"DryRunError",description:"One reason a change cannot be made right now.",fields:{type:{type:new o(c),description:"Kind of the problem."},entityId:{type:n,description:"The entity the problem is on, when it is on one."},message:{type:c,description:"The problem as the user would be told it."}}}),new a({name:"DryRun",description:"What using a recipe or writing an option would do, tried out on the configuration the query reads. Nothing is changed.",fields:()=>({ok:{type:new o(e),description:"Whether the change would succeed on the configuration the query reads."},root:{type:O(),description:"The root entity of the configuration as it would be after the change; null when ok is false. Everything selected under it reads that configuration."},changedEntities:{type:new o(new r(new o(k()))),description:"Entities the change would add or modify; empty when ok is false. One whose id is not in the configuration would be added, and its real id may differ. An entity written to is listed even when its values stay the same."},deletedEntityIds:{type:new o(new r(new o(n))),description:"The ids of the entities the change would remove; empty when ok is false."},sideEffects:{type:new o(new r(new o(c))),description:"The major or unexpected things the configurator would change along with it; empty when ok is false."},errors:{type:new o(new r(new o(M))),description:"Why the change cannot be made; empty when ok is true."}})})),et={recipeGroup:(T=[...Object.keys(L).length>0?[b.mutation]:[],...Object.keys(Q).length>0?[v.mutation]:[]],D=T.join(" or "),F=new a({name:"Recipe",description:`${T.includes("addChild")?"One thing that can be added to the entity (under childRecipes)":"One thing the entity can be replaced with (under replaceRecipes)"}${T.length>1?" or that it can be replaced with (under replaceRecipes)":""}.`,fields:{key:{type:new o(c),description:`Pass to ${D} as recipeKey. Valid only for the listing it came from.`},name:{type:new o(c),description:"Name shown to the user."},description:{type:c},imageUrl:{type:c,description:"Thumbnail shown to the user."},dryRun:{type:ee,description:"What using this recipe would do. Null when it cannot be tried."}}}),new a({name:"RecipeGroup",description:"A group of recipes for this entity.",fields:{groupId:{type:new o(c),description:`Pass to ${D} as recipeGroupId.`},name:{type:new o(c),description:"Name shown to the user."},description:{type:c},recipes:{type:new o(new r(new o(F)))}}})),fieldOption:new a({name:"FieldOption",description:"One value a field accepts. Writing a value outside the list is rejected unless the field description says it is not checked.",fields:{value:{type:new o(h),description:"The value to write to the field."},name:{type:c,description:"Name shown to the user."},description:{type:c},imageUrl:{type:c,description:"Image shown to the user."},color:{type:c,description:'Color shown to the user, as "#rrggbb".'},dryRun:{type:ee,description:"What writing this value would do. Null when it cannot be tried."}}}),screenshot:new a({name:"Screenshot",description:"A screenshot of an entity. The picture itself follows the tool result.",fields:{image:{type:new o(n),description:"Label of the image that follows the tool result."}}})};for(let e of x){let n=j(t.childRecipes,e)??{groups:[],hints:[]},i=j(t.replaceRecipes,e)??{groups:[],hints:[]},s=j(P,e)??[],r=j(t.screenshots,e)??[];(n.groups.length>0||i.groups.length>0||s.length>0||r.length>0)&&B.set(e,A({entityType:e,childRecipes:n,replaceRecipes:i,optionsEdges:s.map(t=>({...t,hints:(C[f]??[]).includes(e)?t.hints.filter(e=>"sameForAllInstances"!==e):t.hints})),screenshots:r},et))}let en=new p({query:(I=X(J.has(f)?f:m),N=X(m),W=(e=>{let t={};for(let[n,i,s]of g){let r=e[s];r.length>1&&(t[n]={type:new o(c),description:$(i,r)})}if(0!==Object.keys(t).length)return new a({name:"Navigation",description:"The active UI states of the configurator.",fields:t})})(U),new a({name:"Query",fields:{root:{type:new o(I),description:"The root entity of the configuration."},entities:{type:new o(new r(N)),args:{ids:{type:new r(new o(n))}},description:"Every entity, or the given ids in order with null for an unknown id."},selectedEntity:{type:new o(N),description:"The selected entity, or the root entity when nothing is selected."},...W?{navigation:{type:new o(W)}}:{}}})),mutation:(({deletableTypes:e,writableTypes:t,childRecipes:s,replaceRecipes:p,actionFields:d,objectTypes:l,anyDomainEntity:h,targetOutputType:y})=>{let u,m;if(0!==e.length||0!==t.length||0!==Object.keys(s).length||0!==Object.keys(p).length||0!==d.length)return new a({name:"Mutation",fields:Object.assign(0===e.length?{}:{deleteEntity:{type:new o(new r(new o(n))),args:{id:{type:new o(n)}},description:`Deletes the entity and everything composed into it. Deletable types: ${e.join(", ")}. Returns the ids removed, the given one first.`}},0===(u=S(s)).length?{}:{addChild:{type:new o(new r(new o(h))),args:{parentId:{type:new o(n)},recipeGroupId:{type:new o(c)},recipeKey:{type:new o(c)}},description:`Adds a child to the entity parentId from a recipe listed under its meta { childRecipes }. Types with child recipes: ${u.join("; ")}. Returns the entities added, the recipe's own first; empty when they were removed again.`}},0===(m=S(p)).length?{}:{replaceEntity:{type:new o(new r(new o(h))),args:{entityId:{type:new o(n)},recipeGroupId:{type:new o(c)},recipeKey:{type:new o(c)}},description:`Replaces the entity entityId from a recipe listed under its meta { replaceRecipes }. Types with replace recipes: ${m.join("; ")}. The replacement is a new entity: it has a new id and the field values of its recipe, and entityId no longer exists. Returns the entities added, the replacement first; empty when they were removed again.`}},...t.flatMap(e=>{let t=l.get(e.entityType);return t?[(({entityType:e,fields:t},s)=>{let r=Object.fromEntries(t.map(({name:e,type:t,description:n})=>[e,{type:w(t),description:n}]));return{[`modify${e}`]:{type:s,args:{id:{type:new o(n)},delta:{type:new o(new i({name:`${e}Delta`,fields:r}))}},description:`Sets the fields named in delta on one ${e}. Returns the entity after the change, or null when the change removed it.`}}})(e,t)]:[]}),Object.fromEntries(d.map(e=>{var t;return[e.fieldName,{type:new o(new a({name:(t=e.fieldName,`${t.charAt(0).toUpperCase()+t.slice(1)}Result`),description:`What ${e.fieldName} returns, read from the configuration after the change.`,fields:()=>Object.fromEntries(Object.entries(e.result).map(([e,t])=>[e,{type:"edge"===t.kind?(({target:e,list:t,nullable:n},i)=>{let s=t?new r(new o(i(e))):i(e);return n?s:new o(s)})(t,y):w(t.type),description:t.description}]))})),args:Object.fromEntries(Object.entries(e.args).map(([e,t])=>[e,{type:w(t.type),description:t.description}])),description:e.description}]})))})})({deletableTypes:K,writableTypes:V,childRecipes:L,replaceRecipes:Q,actionFields:z,objectTypes:H,anyDomainEntity:X(m),targetOutputType:Y}),types:[...J.values(),...H.values()]}),ei=l(en);if(ei.length>0)throw Error(ei.map(e=>e.message).join(" "));let es=d(en);return{sdl:es,navigationFields:g.filter(([,,e])=>U[e].length>1).map(([e])=>e),fields:_,deletableTypes:K,writableFields:Object.fromEntries(V.map(({entityType:e,fields:t})=>[e,Object.fromEntries(t.map(({name:e,property:t})=>[e,t]))])),childRecipes:L,replaceRecipes:Q,fieldOptions:Object.fromEntries(x.flatMap(e=>{let t=j(P,e);return t?[[e,t.map(({options:e})=>e)]]:[]})),screenshots:Object.fromEntries(x.flatMap(e=>{let n=j(t.screenshots,e);return n?[[e,n]]:[]})),actions:Object.fromEntries(z.map(({fieldName:e,actionName:t})=>[e,t])),lenses:y(t,u(es)),formElements:t.formElements}};
1
+ import{GraphQLBoolean as e,GraphQLEnumType as t,GraphQLID as n,GraphQLInputObjectType as i,GraphQLInterfaceType as s,GraphQLList as r,GraphQLNonNull as o,GraphQLObjectType as a,GraphQLSchema as p,GraphQLString as d,printSchema as c,validateSchema as l}from"graphql";import{GraphQLJSON as h,createAssistantValueType as w}from"./assistant-value-type.js";import{buildAssistantLenses as y}from"./build-assistant-lenses.js";import{createAssistantExecutionSchema as u}from"./create-assistant-execution-schema.js";let m="AnyDomainEntity",f="RootEntity",g=[["navigationState","Active navigation state.","navigationStates"],["viewState","Active view state.","viewStates"],["toolState","Active tool state.","toolStates"]],b={section:"childRecipes",mutation:"addChild"},v={section:"replaceRecipes",mutation:"replaceEntity"},j=(e,t)=>Object.entries(e).find(([e])=>e===t)?.[1],$=(e,t)=>{if(!t||0===t.length)return e;let n=`One of: ${t.map(e=>`"${e}"`).join(", ")}.`;return e?/[.!?]$/.test(e)?`${e} ${n}`:`${e}. ${n}`:n},O=({target:e,cardinality:t},n)=>{let i=n(e);switch(t){case"1-1":return new o(i);case"0-1":return i;case"0-N":case"1-N":return new o(new r(new o(i)))}},E=(e,t,i)=>{let s={id:{type:new o(n),description:i?`Unique id of the entity, assigned by the configurator, e.g. "${i}-1".`:void 0},type:{type:new o(d),description:i?`Entity type name, e.g. "${i}".`:void 0}};for(let n of e)s[n.name]={type:"edge"===n.type.kind?O(n.type,t):w(n.type.type),description:n.description};return s},R=e=>Object.fromEntries(e.map(({name:e,source:t,localized:n})=>[e,n?{source:t,localized:!0}:{source:t}])),k={sameForAllInstances:e=>`Same recipe groups and recipes for every ${e}.`,constantDuringSession:()=>"Fixed for the session."},T={sameForAllInstances:e=>`Same for every ${e}.`,constantDuringSession:()=>"Fixed for the session."},I=(e,t,n)=>e.map(e=>` ${t[e](n)}`).join(""),N=({section:e},{groups:t,hints:n},{entityType:i,purpose:s,recipeGroup:a})=>{let p=t.filter(({dryRuns:e})=>!e).map(({groupId:e})=>e);return 0===t.length?{}:{[e]:{type:new o(new r(new o(a))),description:`The recipe groups for ${s} this ${i}: ${t.map(({groupId:e})=>e).join(", ")}. A group is listed only while the configurator offers it on the entity.${p.length>0?` Recipes of these groups cannot be dry-run: ${p.join(", ")}.`:""}${I(n,k,i)}`}}},A=({entityType:e,childRecipes:n,replaceRecipes:i,optionsEdges:s,screenshots:p},{recipeGroup:d,fieldOption:c,screenshot:l})=>new a({name:`${e}Meta`,fields:Object.assign(N(b,n,{entityType:e,purpose:"adding children to",recipeGroup:d}),N(v,i,{entityType:e,purpose:"replacing",recipeGroup:d}),...s.map(({options:{edgeName:t,field:n,validate:i,dryRuns:s},hints:a})=>({[t]:{type:new r(new o(c)),description:`Values "${n}" accepts on this ${e}. Null when there is no choice to make.${i?"":" Not checked on write."}${s?"":" Cannot be dry-run."}${I(a,T,e)}`}})),0===p.length?{}:{screenshot:{type:l,args:{view:{type:new o(new t({name:`${e}ScreenshotView`,values:Object.fromEntries(p.map(({view:e,description:t})=>[e,{description:t}]))}))}},description:"Renders this entity from a predefined view. The picture follows the tool result as an image labelled with `image`. Null when the view does not apply to this entity right now."}})}),S=e=>Object.entries(e).map(([e,t])=>`${e} (${t.map(({groupId:e})=>e).join(", ")})`);export const buildAssistantManifest=t=>{var O,k,T,I,N;let M,D,F,W,{entityTypes:x,aliases:C,exampleType:q,fields:G,states:U,deletableTypes:K,writableTypes:V,actionFields:P,optionsEdges:z}=t,L=Object.fromEntries(Object.entries(t.childRecipes).map(([e,t])=>[e,t.groups])),Q=Object.fromEntries(Object.entries(t.replaceRecipes).map(([e,t])=>[e,t.groups])),B=new Map,H=new Map,J=new Map,X=e=>{let[t,...n]=Object.entries(C).find(([t])=>t===e)?.[1]??[];return(t&&0===n.length?H.get(t):void 0)??J.get(e)??Z},Y=e=>H.get(e)??X(e),Z=new s({name:m,description:"Every entity of the configuration.",fields:()=>E(G[m]??[],Y,q)});for(let e of(J.set(m,Z),Object.keys(C)))e!==m&&J.set(e,new s({name:e,interfaces:[Z],fields:()=>E(G[e]??[],Y)}));let _={};for(let e of x){let t=[m,...Object.entries(C).filter(([t,n])=>t!==m&&n.includes(e)).map(([e])=>e)],n=G[e]??[];_[e]=R(n),H.set(e,new a({name:e,interfaces:t.flatMap(e=>J.get(e)??[]),fields:()=>{let t=B.get(e);return{...E(n,Y),...t?{meta:{type:new o(t),description:"What can be done to this entity right now."}}:{}}}}))}let ee=(O=()=>X(J.has(f)?f:m),k=()=>X(m),M=new a({name:"DryRunError",description:"One reason a change cannot be made right now.",fields:{type:{type:new o(d),description:"Kind of the problem."},entityId:{type:n,description:"The entity the problem is on, when it is on one."},message:{type:d,description:"The problem as the user would be told it."}}}),new a({name:"DryRun",description:"What using a recipe or writing an option would do, tried out on the configuration the query reads. Nothing is changed.",fields:()=>({ok:{type:new o(e),description:"Whether the change would succeed on the configuration the query reads."},root:{type:O(),description:"The root entity of the configuration as it would be after the change; null when ok is false. Everything selected under it reads that configuration."},changedEntities:{type:new o(new r(new o(k()))),description:"Entities the change would add or modify; empty when ok is false. One whose id is not in the configuration would be added, and its real id may differ. An entity written to is listed even when its values stay the same."},deletedEntityIds:{type:new o(new r(new o(n))),description:"The ids of the entities the change would remove; empty when ok is false."},sideEffects:{type:new o(new r(new o(d))),description:"The major or unexpected things the configurator would change along with it; empty when ok is false."},errors:{type:new o(new r(new o(M))),description:"Why the change cannot be made; empty when ok is true."}})})),et={recipeGroup:(T=[...Object.keys(L).length>0?[b.mutation]:[],...Object.keys(Q).length>0?[v.mutation]:[]],D=T.join(" or "),F=new a({name:"Recipe",description:`${T.includes("addChild")?"One thing that can be added to the entity (under childRecipes)":"One thing the entity can be replaced with (under replaceRecipes)"}${T.length>1?" or that it can be replaced with (under replaceRecipes)":""}.`,fields:{key:{type:new o(d),description:`Pass to ${D} as recipeKey. Valid only for the listing it came from.`},name:{type:new o(d),description:"Name shown to the user."},description:{type:d},imageUrl:{type:d,description:"Thumbnail shown to the user."},dryRun:{type:ee,description:"What using this recipe would do. Null when it cannot be tried."}}}),new a({name:"RecipeGroup",description:"A group of recipes for this entity.",fields:{groupId:{type:new o(d),description:`Pass to ${D} as recipeGroupId.`},name:{type:new o(d),description:"Name shown to the user."},description:{type:d},recipes:{type:new o(new r(new o(F)))}}})),fieldOption:new a({name:"FieldOption",description:"One value a field accepts. Writing a value outside the list is rejected unless the field description says it is not checked.",fields:{value:{type:new o(h),description:"The value to write to the field."},name:{type:d,description:"Name shown to the user."},description:{type:d},imageUrl:{type:d,description:"Image shown to the user."},color:{type:d,description:'Color shown to the user, as "#rrggbb".'},dryRun:{type:ee,description:"What writing this value would do. Null when it cannot be tried."}}}),screenshot:new a({name:"Screenshot",description:"A screenshot of an entity. The picture itself follows the tool result.",fields:{image:{type:new o(n),description:"Label of the image that follows the tool result."}}})};for(let e of x){let n=j(t.childRecipes,e)??{groups:[],hints:[]},i=j(t.replaceRecipes,e)??{groups:[],hints:[]},s=j(z,e)??[],r=j(t.screenshots,e)??[];(n.groups.length>0||i.groups.length>0||s.length>0||r.length>0)&&B.set(e,A({entityType:e,childRecipes:n,replaceRecipes:i,optionsEdges:s.map(t=>({...t,hints:(C[f]??[]).includes(e)?t.hints.filter(e=>"sameForAllInstances"!==e):t.hints})),screenshots:r},et))}let en=new p({query:(I=X(J.has(f)?f:m),N=X(m),W=(e=>{let t={};for(let[n,i,s]of g){let r=e[s];r.length>1&&(t[n]={type:new o(d),description:$(i,r)})}if(0!==Object.keys(t).length)return new a({name:"Navigation",description:"The active UI states of the configurator.",fields:t})})(U),new a({name:"Query",fields:{root:{type:new o(I),description:"The root entity of the configuration."},entities:{type:new o(new r(N)),args:{ids:{type:new r(new o(n))}},description:"Every entity, or the given ids in order with null for an unknown id."},selectedEntity:{type:new o(N),description:"The selected entity, or the root entity when nothing is selected."},...W?{navigation:{type:new o(W)}}:{}}})),mutation:(({deletableTypes:e,writableTypes:t,childRecipes:s,replaceRecipes:p,actionFields:c,objectTypes:l,anyDomainEntity:h,targetOutputType:y})=>{let u,m;if(0!==e.length||0!==t.length||0!==Object.keys(s).length||0!==Object.keys(p).length||0!==c.length)return new a({name:"Mutation",fields:Object.assign(0===e.length?{}:{deleteEntity:{type:new o(new r(new o(n))),args:{id:{type:new o(n)}},description:`Deletes the entity and everything composed into it. Deletable types: ${e.join(", ")}. Returns the ids removed, the given one first.`}},0===(u=S(s)).length?{}:{addChild:{type:new o(new r(new o(h))),args:{parentId:{type:new o(n)},recipeGroupId:{type:new o(d)},recipeKey:{type:new o(d)}},description:`Adds a child to the entity parentId from a recipe listed under its meta { childRecipes }. Types with child recipes: ${u.join("; ")}. Returns the entities added, the recipe's own first; empty when they were removed again.`}},0===(m=S(p)).length?{}:{replaceEntity:{type:new o(new r(new o(h))),args:{entityId:{type:new o(n)},recipeGroupId:{type:new o(d)},recipeKey:{type:new o(d)}},description:`Replaces the entity entityId from a recipe listed under its meta { replaceRecipes }. Types with replace recipes: ${m.join("; ")}. The replacement is a new entity: it has a new id and the field values of its recipe, and entityId no longer exists. Returns the entities added, the replacement first; empty when they were removed again.`}},...t.flatMap(e=>{let t=l.get(e.entityType);return t?[(({entityType:e,fields:t},s)=>{let r=Object.fromEntries(t.map(({name:e,type:t,description:n})=>[e,{type:w(t),description:n}]));return{[`modify${e}`]:{type:s,args:{id:{type:new o(n)},delta:{type:new o(new i({name:`${e}Delta`,fields:r}))}},description:`Sets the fields named in delta on one ${e}. Returns the entity after the change, or null when the change removed it.`}}})(e,t)]:[]}),Object.fromEntries(c.map(e=>{var t;return[e.fieldName,{type:new o(new a({name:(t=e.fieldName,`${t.charAt(0).toUpperCase()+t.slice(1)}Result`),description:`What ${e.fieldName} returns, read from the configuration after the change.`,fields:()=>Object.fromEntries(Object.entries(e.result).map(([e,t])=>[e,{type:"edge"===t.kind?(({target:e,list:t,nullable:n},i)=>{let s=t?new r(new o(i(e))):i(e);return n?s:new o(s)})(t,y):w(t.type),description:t.description}]))})),args:Object.fromEntries(Object.entries(e.args).map(([e,t])=>[e,{type:w(t.type),description:t.description}])),description:e.description}]})))})})({deletableTypes:K,writableTypes:V,childRecipes:L,replaceRecipes:Q,actionFields:P,objectTypes:H,anyDomainEntity:X(m),targetOutputType:Y}),types:[...J.values(),...H.values()]}),ei=l(en);if(ei.length>0)throw Error(ei.map(e=>e.message).join(" "));let es=c(en);return{sdl:es,navigationFields:g.filter(([,,e])=>U[e].length>1).map(([e])=>e),fields:_,deletableTypes:K,writableFields:Object.fromEntries(V.map(({entityType:e,fields:t})=>[e,Object.fromEntries(t.map(({name:e,property:t})=>[e,t]))])),childRecipes:L,replaceRecipes:Q,fieldOptions:Object.fromEntries(x.flatMap(e=>{let t=j(z,e);return t?[[e,t.map(({options:e})=>e)]]:[]})),screenshots:Object.fromEntries(x.flatMap(e=>{let n=j(t.screenshots,e);return n?[[e,n]]:[]})),actions:Object.fromEntries(P.map(({fieldName:e,actionName:t})=>[e,t])),lenses:y(t,u(es)),formElements:t.formElements}};
@@ -1 +1 @@
1
- import{ASSISTANT_BUILT_IN_FORM_ELEMENTS as e}from"./form/index.js";let t=[["Containers",["group","choice","choices"]],["Options",["option"]],["Inputs",["input"]]];export const formElementSignature=({name:e,role:t,attributes:a})=>{let n=["label",...Object.entries(a).map(([e,t])=>((e,{type:t,enum:a})=>a?`${e}="${a.join("|")}"`:"string"===t?e:`${e}="<${t}>"`)(e,t))];return"option"===t||"input"===t?`<${e} ${n.join(" ")} />`:`<${e} ${n.join(" ")}>…</${e}>`};export const generateAssistantPrompt=a=>{let n,s=Object.values(a.childRecipes??{}).some(e=>e.length>0),i=Object.values(a.replaceRecipes??{}).some(e=>e.length>0),o=Object.values(a.fieldOptions??{}).some(e=>e.length>0),r=Object.keys(a.actions??{}).length>0,h=(a.deletableTypes?.length??0)>0||Object.values(a.writableFields??{}).some(e=>Object.keys(e).length>0)||s||i||r,l=s||i||o,d=[...s?["`childRecipes` is what can be added to it"]:[],...i?["`replaceRecipes` what it can be replaced with"]:[],...o?["`<field>Options` the values a field accepts"]:[]],c=["`selected`",...(a.navigationFields??[]).map(e=>`\`${e}\``)].join(", ");return[["Tools","- Put related operations in one call and select only the fields you need.",...h?[`- Use a mutation inside \`query\` to answer a what-if about a change ${l?"the lists under `meta` do not show":"before making it"}.`,"- Use `apply` only for what the user asked for."]:["- Nothing in this configurator can be changed through you. Say so when the user asks for a change."],"- When an operation fails, its `errors` say why and what to send instead."],...h?[["After a change","- A change is made only when the `apply` result has `committed: true`. Otherwise `errors` or `message` says what happened; without either, nothing changed. Never say a change was made when it was not.","- `sideEffects` names the major or unexpected things the configurator changed along with your change. Tell the user about them when committed; otherwise they describe what would happen. Smaller adjustments are not listed.","- A mutation returns the state after the change: use the ids and values it returned, not the ones you sent.",...r?["- When one mutation does the whole of what the user asked, use it instead of building the same change from several others."]:[]]]:[],...l?[["What can be done to an entity",`- \`meta\` lists what is possible right now: ${d.join(", ")}. Read the list before such a change and before telling the user what is available.`,`- You can select \`dryRun\` on ${[...s||i?["recipes"]:[],...o?["options"]:[]].join(" or ")} to look ahead and pick one that meets what the user asked for. It is optional before a change.`,"- Read the lists again after a change, unless their descriptions say they stay the same."]]:[],["The `[changes]` block","- Every user message starts with it: a glimpse of what the user did in the configurator since your last turn.",`- \`[changes: none]\`, or only ${c} lines: what you know still holds. Do not query it again.`,"- Other lines are a hint at what to read again: `A` added, `D` deleted, `M` modified with the fields. Text after `#` says what caused the line; `reset: undo/redo` says the user undid or redid changes.","- Read computed fields again when a listed change may affect them.","- `[changes: unavailable]` and `[changes: too many (n)]`: read again before relying on anything you read earlier.",...h?["- Your applied changes are not listed, except those waiting for user approval: they appear once approved."]:[]],["Reading the schema","- Take ids from results.",...(a.deletableTypes?.length??0)>0||i?["- The id of a deleted or replaced entity is gone and may later be given to another entity."]:[],`- A field whose name starts with \`_\` is computed: read it${h?", never write it":""}.`,"- Numbers are in the unit the field description names. Convert when the user uses another unit."],["Links","- You may link an entity of the current configuration when you speak about that very entity: `[the left burner](entity:CookingTop-1)`. It helps the user find it in the configurator.",...l?["- Whenever you name recipes or options you read from `meta`, in a list, a table or a sentence, link each one: `[Single gas burner](recipe:KitchenRange-1/top/gas_single)` or `[Oak](option:Cabinet-2/finishOptions/oak)`. The link shows the user its picture or color and its description, so never draw previews yourself. The target is the entity id, the recipe group id or the options field you read, and the key or value, each encoded as in a URL."]:[]],["Replies","- Write Markdown only, never HTML: the panel does not render it.","- An image, `![alt](path)`, is shown only when its path is relative.","- To make a warning or a key note stand out, write a GitHub alert: a blockquote whose first line is only `[!WARNING]` or `[!NOTE]`. Use it sparingly."],["Forms","- To ask the user something they answer by picking or typing, end your reply with a form: a fenced code block with the language `form`. It holds only elements, written as lowercase tags with string attributes, without Markdown or text.","- Every element takes `label`, the text the user sees; on a container or an input it also names the answer. An option or an input whose signature lists `value` takes it: an option sends it instead of its label, and an input starts with it.",'- A bare attribute in a signature takes any text, `name="<type>"` takes a value of that type written as text, such as `min="<number>"`, and `name="a|b"` takes one of the words listed.',"- Options can also stand on their own, outside a `choice` or `choices`.","- An element or attribute not listed here, or an element other than an option inside a `choice` or `choices`, makes the whole form fail.","- The answer is the user's next message. Each container or input gives a line `Label: value`, or the bare value without a label; the lines of a labelled container are indented by two spaces under it, a `choices` lists each picked option on its own line, and `—` marks what was left unanswered.",'- Example: `<choice label="Plinth"><reply label="Black" /><reply label="Oak" /></choice>` is answered with `Plinth: Oak`.',"- The chat shows the answer as the user's own message, so a `value` reads as natural words, never as an id, key or code. Give `value` only when the label alone would be unclear as an answer, and map the answer's labels back to ids yourself.",...(n=[...e,...a.formElements??[]],t.flatMap(([e,t])=>{let a=n.filter(({role:e})=>t.includes(e));return 0===a.length?[]:[`- ${e}:`,...a.map(e=>` - \`${formElementSignature(e)}\`: ${(({description:e,required:t=[]})=>0===t.length?e:`${e} Requires ${t.map(e=>`\`${e}\``).join(", ")}.`)(e)}`)]}))],...a.lenses?.declarations?[["Built-in fragments","- These fragments are already defined for every operation. Spread one by name on a field of its type, as in `field { ...FragmentName }`, instead of listing its fields.","- A fragment is a starting selection: add the other fields you need next to the spread, by name from the schema.","- Never define a fragment with one of these names.","",a.lenses.declarations]]:[]].map(e=>e.join("\n")).join("\n\n")};
1
+ import{ASSISTANT_BUILT_IN_FORM_ELEMENTS as e}from"./form/index.js";let t=[["Containers",["group","choice","choices"]],["Options",["option"]],["Inputs",["input"]]];export const formElementSignature=({name:e,role:t,attributes:a})=>{let n=["label",...Object.entries(a).map(([e,t])=>((e,{type:t,enum:a})=>a?`${e}="${a.join("|")}"`:"string"===t?e:`${e}="<${t}>"`)(e,t))];return"option"===t||"input"===t?`<${e} ${n.join(" ")} />`:`<${e} ${n.join(" ")}>…</${e}>`};export const generateAssistantPrompt=a=>{let n,s=Object.values(a.childRecipes??{}).some(e=>e.length>0),o=Object.values(a.replaceRecipes??{}).some(e=>e.length>0),i=Object.values(a.fieldOptions??{}).some(e=>e.length>0),r=Object.keys(a.actions??{}).length>0,h=Object.values(a.screenshots??{}).some(e=>e.length>0),l=(a.deletableTypes?.length??0)>0||Object.values(a.writableFields??{}).some(e=>Object.keys(e).length>0)||s||o||r,d=s||o||i,u=[...s?["`childRecipes` is what can be added to it"]:[],...o?["`replaceRecipes` what it can be replaced with"]:[],...i?["`<field>Options` the values a field accepts"]:[]],c=["`selected`",...(a.navigationFields??[]).map(e=>`\`${e}\``)].join(", ");return[["Tools","- Put related operations in one call and select only the fields you need.",...l?[`- Use a mutation inside \`query\` to answer a what-if about a change ${d?"the lists under `meta` do not show":"before making it"}.`,"- Use `apply` only for what the user asked for."]:["- Nothing in this configurator can be changed through you. Say so when the user asks for a change."],"- When an operation fails, its `errors` say why and what to send instead."],...l?[["After a change","- A change is made only when the `apply` result has `committed: true`. Otherwise `errors` or `message` says what happened; without either, nothing changed. Never say a change was made when it was not.","- `sideEffects` names the major or unexpected things the configurator changed along with your change. Tell the user about them when committed; otherwise they describe what would happen. Smaller adjustments are not listed.","- A mutation returns the state after the change: use the ids and values it returned, not the ones you sent.",...r?["- When one mutation does the whole of what the user asked, use it instead of building the same change from several others."]:[]]]:[],...d?[["What can be done to an entity",`- \`meta\` lists what is possible right now: ${u.join(", ")}. Read the list before such a change and before telling the user what is available.`,`- You can select \`dryRun\` on ${[...s||o?["recipes"]:[],...i?["options"]:[]].join(" or ")} to look ahead and pick one that meets what the user asked for. It is optional before a change.`,"- Read the lists again after a change, unless their descriptions say they stay the same."]]:[],...h?[["Seeing the design","- `meta { screenshot(view: …) { image } }` renders an entity from one of the views its `<Type>ScreenshotView` lists. The picture follows the tool result.","- Take one when the user asks how the design looks, or when you are not sure something is laid out right: what sits where, what overlaps or lines up. Otherwise rely on the data.","- Each one costs tokens and blocks the user's configurator while it renders."]]:[],["The `[changes]` block","- Every user message starts with it: a glimpse of what the user did in the configurator since your last turn.",`- \`[changes: none]\`, or only ${c} lines: what you know still holds. Do not query it again.`,"- Other lines are a hint at what to read again: `A` added, `D` deleted, `M` modified with the fields. Text after `#` says what caused the line; `reset: undo/redo` says the user undid or redid changes.","- Read computed fields again when a listed change may affect them.","- `[changes: unavailable]` and `[changes: too many (n)]`: read again before relying on anything you read earlier.",...l?["- Your applied changes are not listed, except those waiting for user approval: they appear once approved."]:[]],["Reading the schema","- Take ids from results.",...(a.deletableTypes?.length??0)>0||o?["- The id of a deleted or replaced entity is gone and may later be given to another entity."]:[],`- A field whose name starts with \`_\` is computed: read it${l?", never write it":""}.`,"- Numbers are in the unit the field description names. Convert when the user uses another unit."],["Links","- You may link an entity of the current configuration when you speak about that very entity: `[the left burner](entity:CookingTop-1)`. It helps the user find it in the configurator.",...d?["- Whenever you name recipes or options you read from `meta`, in a list, a table or a sentence, link each one: `[Single gas burner](recipe:KitchenRange-1/top/gas_single)` or `[Oak](option:Cabinet-2/finishOptions/oak)`. The link shows the user its picture or color and its description, so never draw previews yourself. The target is the entity id, the recipe group id or the options field you read, and the key or value, each encoded as in a URL."]:[]],["Replies","- Write Markdown only, never HTML: the panel does not render it.","- An image, `![alt](path)`, is shown only when its path is relative.","- To make a warning or a key note stand out, write a GitHub alert: a blockquote whose first line is only `[!WARNING]` or `[!NOTE]`. Use it sparingly."],["Forms","- To ask the user something they answer by picking or typing, end your reply with a form: a fenced code block with the language `form`. It holds only elements, written as lowercase tags with string attributes, without Markdown or text.","- Every element takes `label`, the text the user sees; on a container or an input it also names the answer. An option or an input whose signature lists `value` takes it: an option sends it instead of its label, and an input starts with it.",'- A bare attribute in a signature takes any text, `name="<type>"` takes a value of that type written as text, such as `min="<number>"`, and `name="a|b"` takes one of the words listed.',"- Options can also stand on their own, outside a `choice` or `choices`.","- An element or attribute not listed here, or an element other than an option inside a `choice` or `choices`, makes the whole form fail.","- The answer is the user's next message. Each container or input gives a line `Label: value`, or the bare value without a label; the lines of a labelled container are indented by two spaces under it, a `choices` lists each picked option on its own line, and `—` marks what was left unanswered.",'- Example: `<choice label="Plinth"><reply label="Black" /><reply label="Oak" /></choice>` is answered with `Plinth: Oak`.',"- The chat shows the answer as the user's own message, so a `value` reads as natural words, never as an id, key or code. Give `value` only when the label alone would be unclear as an answer, and map the answer's labels back to ids yourself.",...(n=[...e,...a.formElements??[]],t.flatMap(([e,t])=>{let a=n.filter(({role:e})=>t.includes(e));return 0===a.length?[]:[`- ${e}:`,...a.map(e=>` - \`${formElementSignature(e)}\`: ${(({description:e,required:t=[]})=>0===t.length?e:`${e} Requires ${t.map(e=>`\`${e}\``).join(", ")}.`)(e)}`)]}))],...a.lenses?.declarations?[["Built-in fragments","- These fragments are already defined for every operation. Spread one by name on a field of its type, as in `field { ...FragmentName }`, instead of listing its fields.","- A fragment is a starting selection: add the other fields you need next to the spread, by name from the schema.","- Never define a fragment with one of these names.","",a.lenses.declarations]]:[]].map(e=>e.join("\n")).join("\n\n")};
@@ -3,7 +3,7 @@ import type { ThemeOptions } from '@mui/material';
3
3
  import type { z } from 'zod';
4
4
  import type { FinalizeTaskResource } from '@salsita-ai/contracts/webhook';
5
5
  import { type $DomainEntity, type DomainEntity, type DomainFactory, type EnumLike, type ProductPreset, type SchemaOfObject } from '../core/index.js';
6
- import { type ElementRegistration, type ProjectModule } from '../domain-runtime/index.js';
6
+ import { type ElementRegistration, type HandlerRegistration, type ProjectModule } from '../domain-runtime/index.js';
7
7
  import type { AclConfig, ApplicationConfig, DataSpec, DefaultEnvs, ResourcesConfig, SpecTransformer, TransformersConfig, UserInterfaceConfig } from './application-config.js';
8
8
  import { type AssistantResolvedManifest } from './assistant/index.js';
9
9
  interface ConfiguratorBuilderContext<ENTITIES extends DomainEntity<string> = never, ALLOWED_ROOT_ENTITIES extends ENTITIES = never, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>> = never, NAVIGATION_STATES extends string = never, VIEW_STATES extends string = never, TOOL_STATES extends string = never, EXPORT_STATES extends string = never, PUBLISHED_DATA extends Record<string, unknown> = never, SESSION_DATA extends Record<string, unknown> = never, FRONTEND_DATA extends Record<string, unknown> = never, ADMIN_ENTITIES extends DomainEntity<string> = never, ADMIN_ALLOWED_ROOT_ENTITIES extends ADMIN_ENTITIES = never, ADMIN_$MAP extends Record<ADMIN_ENTITIES['type'], $DomainEntity<ADMIN_ENTITIES>> = never, ADMIN_NAVIGATION_STATES extends string = never, ADMIN_VIEW_STATES extends string = never, FINALIZE_DATA extends Record<string, unknown> = never, PREFETCHED_FINALIZE_DATA extends Record<string, unknown> = never, FINALIZE_RESULT extends Record<string, unknown> = never, CALLBACK_DATA extends Record<string, unknown> = never, RESOURCE extends string = never> {
@@ -46,6 +46,12 @@ interface ConfiguratorBuilderContext<ENTITIES extends DomainEntity<string> = nev
46
46
  elements?: readonly ProjectModule[];
47
47
  defaultElements?: readonly ElementRegistration[];
48
48
  }
49
+ /**
50
+ * Rejects a second registration of a handler kind the application runs at most once: the assistant
51
+ * setup, the published-chunks filter, the data-row validator and the sheet validator. Both ways of
52
+ * building an application call it, `ConfiguratorBuilder.buildConfig` and `createApplication`.
53
+ */
54
+ export declare const checkSingleInstanceHandlers: (handlers: ReadonlyArray<HandlerRegistration<any, any>>) => void;
49
55
  export declare class ConfiguratorBuilder<ENTITIES extends DomainEntity<string> = never, ALLOWED_ROOT_ENTITIES extends ENTITIES = never, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>> = never, NAVIGATION_STATES extends string = never, VIEW_STATES extends string = never, TOOL_STATES extends string = never, EXPORT_STATES extends string = never, PUBLISHED_DATA extends Record<string, unknown> = never, SESSION_DATA extends Record<string, unknown> = never, FRONTEND_DATA extends Record<string, unknown> = never, ADMIN_ENTITIES extends DomainEntity<string> = never, ADMIN_ALLOWED_ROOT_ENTITIES extends ADMIN_ENTITIES = never, ADMIN_$MAP extends Record<ADMIN_ENTITIES['type'], $DomainEntity<ADMIN_ENTITIES>> = never, ADMIN_NAVIGATION_STATES extends string = never, ADMIN_VIEW_STATES extends string = never, FINALIZE_DATA extends Record<string, unknown> = never, PREFETCHED_FINALIZE_DATA extends Record<string, unknown> = never, FINALIZE_RESULT extends Record<string, unknown> = never, CALLBACK_DATA extends Record<string, unknown> = never, RESOURCE extends string = never> {
50
56
  private readonly _context;
51
57
  constructor(_context: ConfiguratorBuilderContext<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, NAVIGATION_STATES, VIEW_STATES, TOOL_STATES, EXPORT_STATES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ADMIN_ENTITIES, ADMIN_ALLOWED_ROOT_ENTITIES, ADMIN_$MAP, ADMIN_NAVIGATION_STATES, ADMIN_VIEW_STATES, FINALIZE_DATA, PREFETCHED_FINALIZE_DATA, FINALIZE_RESULT, CALLBACK_DATA, RESOURCE>);
@@ -1 +1 @@
1
- import{initConsoleLogger as t}from"@salsita-ai/common/utils";import{defaultI18n as e}from"#package/i18n";import{extendedSchemaValidator as i}from"../core/index.js";import{NoopAnalyticsSystem as r}from"../domain-context/index.js";import{createDomainRuntime as n}from"../domain-runtime/index.js";import{isGetApplicationWrapperHandler as o}from"./GetApplicationWrapperHandler.js";import{isGetWebComponentOptionsHandler as a}from"./GetWebComponentOptions.js";import{isAssistantSetupHandler as s}from"./assistant/index.js";import{createInitialPublishedData as l}from"./create-initial-published-data.js";import{isDataRowValidatorHandler as h}from"./published-data/DataRowValidatorHandler.js";import{isFilterPublishedChunksHandler as u}from"./published-data/FilterPublishedChunksHandler.js";import{isMapPublishedChunkedDataHandler as d}from"./published-data/MapPublishedChunkedDataHandler.js";import{isMapPublishedRevisionDataHandler as c}from"./published-data/MapPublishedRevisionDataHandler.js";import{isSheetValidatorHandler as f}from"./published-data/SheetValidatorHandler.js";export class ConfiguratorBuilder{_context;constructor(t){this._context=t}withDefaultEnvs(t){return new ConfiguratorBuilder({...this._context,defaultEnvs:t})}withVersion(t){return new ConfiguratorBuilder({...this._context,version:t})}withTextLanguages(t){return new ConfiguratorBuilder({...this._context,textLanguages:t})}withAcl(t){return new ConfiguratorBuilder({...this._context,acl:t})}withAdminRelease(t){return new ConfiguratorBuilder({...this._context,enableAdminRelease:t})}withUi(t){return new ConfiguratorBuilder({...this._context,ui:t})}withResourcesConfig(t){return new ConfiguratorBuilder({...this._context,resourcesConfig:t})}withChunks(t){return new ConfiguratorBuilder({...this._context,chunks:t})}withPublishedDataHash(t){return new ConfiguratorBuilder({...this._context,publishedDataHash:t})}withAssistant(t){return new ConfiguratorBuilder({...this._context,assistant:t})}withTheme(t){return new ConfiguratorBuilder({...this._context,theme:t})}withDomainFactory(t){return new ConfiguratorBuilder({...this._context,domainFactory:t})}withAdminDomainFactory(t){return new ConfiguratorBuilder({...this._context,adminDomainFactory:t})}withI18n=t=>new ConfiguratorBuilder({...this._context,i18n:t});withPrefetchedFinalizeData(t){return new ConfiguratorBuilder({...this._context,prefetchedFinalizeData:t})}withFinalizeData(t){return new ConfiguratorBuilder({...this._context,finalizeData:t})}withFinalizeResult(t){return new ConfiguratorBuilder({...this._context,finalizeResult:t})}withCallbackData(t){return new ConfiguratorBuilder({...this._context,callbackData:t})}withNavigationState(t){return new ConfiguratorBuilder({...this._context,navigationState:t})}withViewState(t){return new ConfiguratorBuilder({...this._context,viewState:t})}withToolState(t){return new ConfiguratorBuilder({...this._context,toolState:t})}withExportState(t){return new ConfiguratorBuilder({...this._context,exportState:t})}withAdminNavigationState(t){return new ConfiguratorBuilder({...this._context,adminNavigationState:t})}withAdminViewState(t){return new ConfiguratorBuilder({...this._context,adminViewState:t})}withPresets(t){return new ConfiguratorBuilder({...this._context,presets:t})}withAdminPresets(t){return new ConfiguratorBuilder({...this._context,adminPresets:t})}withComponentOptics(t){return new ConfiguratorBuilder({...this._context,componentOptics:[...this._context.componentOptics,...t]})}withAdminComponentOptics(t){return new ConfiguratorBuilder({...this._context,adminComponentOptics:[...this._context.adminComponentOptics??[],...t]})}withHandlers(t){return new ConfiguratorBuilder({...this._context,handlers:t})}withElements(t){return new ConfiguratorBuilder({...this._context,elements:t})}withDefaultElements(t){return new ConfiguratorBuilder({...this._context,defaultElements:t})}withResources(t){return new ConfiguratorBuilder({...this._context,resources:t})}withWebComponentTag(t){return new ConfiguratorBuilder({...this._context,tagName:t})}withTransformers(t,e){return new ConfiguratorBuilder({...this._context,transformers:{importedTransformers:t,specTransformers:e}})}withInterface(t){return this}withDataSpec=t=>new ConfiguratorBuilder({...this._context,dataSpec:t});_computeInitialPublishedData(t,e,i){if(!this._context.adminDomainFactory)throw Error("adminDomainFactory is required!");return l({adminDomainFactory:this._context.adminDomainFactory,domainRuntime:e,adminPresets:this._context.adminPresets??[],handlers:i,dataSpec:this._context.dataSpec,chunks:this._context.chunks,logger:t})}buildConfig(){return this._buildConfigWithHandlers().config}_buildConfigWithHandlers(){if(!this._context.domainFactory)throw Error("Can not create application config, domainFactory is required! Is it registered with the ConfiguratorBuilder?");if(!this._context.presets)throw Error("Can not create application config, presets are required! Is it registered with the ConfiguratorBuilder?");if(!this._context.adminDomainFactory)throw Error("Can not create application config, adminDomainFactory is required! Is it registered with the ConfiguratorBuilder?");if(!this._context.adminPresets)throw Error("Can not create application config, adminPresets are required! Is it registered with the ConfiguratorBuilder?");if(!this._context.version)throw Error("Can not create application config, version is required!");let i=this._context.tagName??"salsita-configurator",l={defaultEnvs:this._context.defaultEnvs,services:{i18n:this._context.i18n},version:this._context.version,initialPublishedData:{},domain:{textLanguages:this._context.textLanguages,componentOptics:this._context.componentOptics,presets:this._context.presets,domainFactory:this._context.domainFactory},navigation:{navigationStates:this._context.navigationState?.values(),viewStates:this._context.viewState?.values(),toolStates:this._context.toolState?.values(),exportStates:this._context.exportState?.values()},adminNavigation:{navigationStates:this._context.adminNavigationState?.values(),viewStates:this._context.adminViewState?.values()},adminDomain:{textLanguages:this._context.textLanguages,componentOptics:this._context.adminComponentOptics??[],presets:this._context.adminPresets,domainFactory:this._context.adminDomainFactory},mount:{tag:i,options:{}},handlers:this._context.handlers??[],elements:this._context.elements??[],defaultElements:this._context.defaultElements??[],transformers:this._context.transformers,features:{acl:this._context.acl,enableAdminRelease:this._context.enableAdminRelease},ui:{preview:this._context.ui?.preview,alwaysExpand:this._context.ui?.alwaysExpand,theme:this._context.theme},resources:this._context.resourcesConfig,chunks:this._context.chunks,publishedDataHash:this._context.publishedDataHash,assistant:this._context.assistant,dataSpec:this._context.dataSpec},d=t(),c=n({config:l,services:{analyticsService:new r,i18n:e,logger:d}}),m=c.getState().spec.configurator.handlers;if(m.filter(s).length>1)throw Error("Multiple createAssistantSetupHandler handlers found. Only one handler is allowed.");if(m.filter(t=>u(t)).length>1)throw Error("Multiple createFilterPublishedChunksHandler handlers found. Only one handler is allowed.");if(m.filter(t=>h(t)).length>1)throw Error("Multiple createDataRowValidatorHandler handlers found. Only one handler is allowed.");if(m.filter(t=>f(t)).length>1)throw Error("Multiple createSheetValidatorHandler handlers found. Only one handler is allowed.");let w=m.find(o)?.handler().handler,x=m.find(a)?.handler().handler(void 0),_=this._computeInitialPublishedData(d,c,m);return{config:{...l,mount:{tag:i,options:x??{},Application:w},initialPublishedData:_},handlers:m}}buildWebhookContext(){if(!this._context.domainFactory)throw Error("domainFactory is required!");if(!this._context.adminDomainFactory)throw Error("adminDomainFactory is required!");if(!this._context.adminPresets)throw Error("adminPresets are required!");let{config:t,handlers:e}=this._buildConfigWithHandlers(),r=t=>{if(null==this._context.finalizeData)return{};let e=i.compile(this._context.finalizeData);if(!e(t))throw console.error("Finalize data validation errors:",e.errors),Error("Invalid finalize data!");return t},n=t=>{if(null==this._context.finalizeResult)return{};let e=i.compile(this._context.finalizeResult);if(!e(t))throw console.error("Finalize result validation errors:",e.errors),Error("Invalid finalize result!");return t},o=t=>{if(null==this._context.callbackData)return{};let e=i.compile(this._context.callbackData);if(!e(t))throw console.error("Callback data validation errors:",e.errors),Error("Invalid callback data!");return t},a=e.find(c)?.handler().handler,s=e.find(d)?.handler().handler,l=e.find(h)?.handler().handler,u=e.find(f)?.handler().handler;return{config:t,parseFinalizeData:r,parseFinalizeResult:n,resources:this._context.resources??[],parseCallbackData:o,mapPublishedRevisionData:a,mapPublishedChunkedData:s,dataRowValidator:l,sheetValidator:u}}}
1
+ import{initConsoleLogger as t}from"@salsita-ai/common/utils";import{defaultI18n as e}from"#package/i18n";import{extendedSchemaValidator as i}from"../core/index.js";import{NoopAnalyticsSystem as r}from"../domain-context/index.js";import{createDomainRuntime as n}from"../domain-runtime/index.js";import{isGetApplicationWrapperHandler as o}from"./GetApplicationWrapperHandler.js";import{isGetWebComponentOptionsHandler as a}from"./GetWebComponentOptions.js";import{isAssistantSetupHandler as s}from"./assistant/index.js";import{createInitialPublishedData as u}from"./create-initial-published-data.js";import{isDataRowValidatorHandler as h}from"./published-data/DataRowValidatorHandler.js";import{isFilterPublishedChunksHandler as l}from"./published-data/FilterPublishedChunksHandler.js";import{isMapPublishedChunkedDataHandler as c}from"./published-data/MapPublishedChunkedDataHandler.js";import{isMapPublishedRevisionDataHandler as d}from"./published-data/MapPublishedRevisionDataHandler.js";import{isSheetValidatorHandler as m}from"./published-data/SheetValidatorHandler.js";let f=[[s,"createAssistantSetupHandler"],[l,"createFilterPublishedChunksHandler"],[h,"createDataRowValidatorHandler"],[m,"createSheetValidatorHandler"]];export const checkSingleInstanceHandlers=t=>{for(let[e,i]of f)if(t.filter(t=>e(t)).length>1)throw Error(`Multiple ${i} handlers found. Only one handler is allowed.`)};export class ConfiguratorBuilder{_context;constructor(t){this._context=t}withDefaultEnvs(t){return new ConfiguratorBuilder({...this._context,defaultEnvs:t})}withVersion(t){return new ConfiguratorBuilder({...this._context,version:t})}withTextLanguages(t){return new ConfiguratorBuilder({...this._context,textLanguages:t})}withAcl(t){return new ConfiguratorBuilder({...this._context,acl:t})}withAdminRelease(t){return new ConfiguratorBuilder({...this._context,enableAdminRelease:t})}withUi(t){return new ConfiguratorBuilder({...this._context,ui:t})}withResourcesConfig(t){return new ConfiguratorBuilder({...this._context,resourcesConfig:t})}withChunks(t){return new ConfiguratorBuilder({...this._context,chunks:t})}withPublishedDataHash(t){return new ConfiguratorBuilder({...this._context,publishedDataHash:t})}withAssistant(t){return new ConfiguratorBuilder({...this._context,assistant:t})}withTheme(t){return new ConfiguratorBuilder({...this._context,theme:t})}withDomainFactory(t){return new ConfiguratorBuilder({...this._context,domainFactory:t})}withAdminDomainFactory(t){return new ConfiguratorBuilder({...this._context,adminDomainFactory:t})}withI18n=t=>new ConfiguratorBuilder({...this._context,i18n:t});withPrefetchedFinalizeData(t){return new ConfiguratorBuilder({...this._context,prefetchedFinalizeData:t})}withFinalizeData(t){return new ConfiguratorBuilder({...this._context,finalizeData:t})}withFinalizeResult(t){return new ConfiguratorBuilder({...this._context,finalizeResult:t})}withCallbackData(t){return new ConfiguratorBuilder({...this._context,callbackData:t})}withNavigationState(t){return new ConfiguratorBuilder({...this._context,navigationState:t})}withViewState(t){return new ConfiguratorBuilder({...this._context,viewState:t})}withToolState(t){return new ConfiguratorBuilder({...this._context,toolState:t})}withExportState(t){return new ConfiguratorBuilder({...this._context,exportState:t})}withAdminNavigationState(t){return new ConfiguratorBuilder({...this._context,adminNavigationState:t})}withAdminViewState(t){return new ConfiguratorBuilder({...this._context,adminViewState:t})}withPresets(t){return new ConfiguratorBuilder({...this._context,presets:t})}withAdminPresets(t){return new ConfiguratorBuilder({...this._context,adminPresets:t})}withComponentOptics(t){return new ConfiguratorBuilder({...this._context,componentOptics:[...this._context.componentOptics,...t]})}withAdminComponentOptics(t){return new ConfiguratorBuilder({...this._context,adminComponentOptics:[...this._context.adminComponentOptics??[],...t]})}withHandlers(t){return new ConfiguratorBuilder({...this._context,handlers:t})}withElements(t){return new ConfiguratorBuilder({...this._context,elements:t})}withDefaultElements(t){return new ConfiguratorBuilder({...this._context,defaultElements:t})}withResources(t){return new ConfiguratorBuilder({...this._context,resources:t})}withWebComponentTag(t){return new ConfiguratorBuilder({...this._context,tagName:t})}withTransformers(t,e){return new ConfiguratorBuilder({...this._context,transformers:{importedTransformers:t,specTransformers:e}})}withInterface(t){return this}withDataSpec=t=>new ConfiguratorBuilder({...this._context,dataSpec:t});_computeInitialPublishedData(t,e,i){if(!this._context.adminDomainFactory)throw Error("adminDomainFactory is required!");return u({adminDomainFactory:this._context.adminDomainFactory,domainRuntime:e,adminPresets:this._context.adminPresets??[],handlers:i,dataSpec:this._context.dataSpec,chunks:this._context.chunks,logger:t})}buildConfig(){return this._buildConfigWithHandlers().config}_buildConfigWithHandlers(){if(!this._context.domainFactory)throw Error("Can not create application config, domainFactory is required! Is it registered with the ConfiguratorBuilder?");if(!this._context.presets)throw Error("Can not create application config, presets are required! Is it registered with the ConfiguratorBuilder?");if(!this._context.adminDomainFactory)throw Error("Can not create application config, adminDomainFactory is required! Is it registered with the ConfiguratorBuilder?");if(!this._context.adminPresets)throw Error("Can not create application config, adminPresets are required! Is it registered with the ConfiguratorBuilder?");if(!this._context.version)throw Error("Can not create application config, version is required!");let i=this._context.tagName??"salsita-configurator",s={defaultEnvs:this._context.defaultEnvs,services:{i18n:this._context.i18n},version:this._context.version,initialPublishedData:{},domain:{textLanguages:this._context.textLanguages,componentOptics:this._context.componentOptics,presets:this._context.presets,domainFactory:this._context.domainFactory},navigation:{navigationStates:this._context.navigationState?.values(),viewStates:this._context.viewState?.values(),toolStates:this._context.toolState?.values(),exportStates:this._context.exportState?.values()},adminNavigation:{navigationStates:this._context.adminNavigationState?.values(),viewStates:this._context.adminViewState?.values()},adminDomain:{textLanguages:this._context.textLanguages,componentOptics:this._context.adminComponentOptics??[],presets:this._context.adminPresets,domainFactory:this._context.adminDomainFactory},mount:{tag:i,options:{}},handlers:this._context.handlers??[],elements:this._context.elements??[],defaultElements:this._context.defaultElements??[],transformers:this._context.transformers,features:{acl:this._context.acl,enableAdminRelease:this._context.enableAdminRelease},ui:{preview:this._context.ui?.preview,alwaysExpand:this._context.ui?.alwaysExpand,theme:this._context.theme},resources:this._context.resourcesConfig,chunks:this._context.chunks,publishedDataHash:this._context.publishedDataHash,assistant:this._context.assistant,dataSpec:this._context.dataSpec},u=t(),h=n({config:s,services:{analyticsService:new r,i18n:e,logger:u}}),l=h.getState().spec.configurator.handlers;checkSingleInstanceHandlers(l);let c=l.find(o)?.handler().handler,d=l.find(a)?.handler().handler(void 0),m=this._computeInitialPublishedData(u,h,l);return{config:{...s,mount:{tag:i,options:d??{},Application:c},initialPublishedData:m},handlers:l}}buildWebhookContext(){if(!this._context.domainFactory)throw Error("domainFactory is required!");if(!this._context.adminDomainFactory)throw Error("adminDomainFactory is required!");if(!this._context.adminPresets)throw Error("adminPresets are required!");let{config:t,handlers:e}=this._buildConfigWithHandlers(),r=t=>{if(null==this._context.finalizeData)return{};let e=i.compile(this._context.finalizeData);if(!e(t))throw console.error("Finalize data validation errors:",e.errors),Error("Invalid finalize data!");return t},n=t=>{if(null==this._context.finalizeResult)return{};let e=i.compile(this._context.finalizeResult);if(!e(t))throw console.error("Finalize result validation errors:",e.errors),Error("Invalid finalize result!");return t},o=t=>{if(null==this._context.callbackData)return{};let e=i.compile(this._context.callbackData);if(!e(t))throw console.error("Callback data validation errors:",e.errors),Error("Invalid callback data!");return t},a=e.find(d)?.handler().handler,s=e.find(c)?.handler().handler,u=e.find(h)?.handler().handler,l=e.find(m)?.handler().handler;return{config:t,parseFinalizeData:r,parseFinalizeResult:n,resources:this._context.resources??[],parseCallbackData:o,mapPublishedRevisionData:a,mapPublishedChunkedData:s,dataRowValidator:u,sheetValidator:l}}}
@@ -2,7 +2,7 @@ export { type DomainConfig, type NavigationConfig, type ISessionService, type Se
2
2
  export { type AssistantFieldOption, findAssistantFieldOptions, readAssistantFieldOptions, } from './assistant-field-options.js';
3
3
  export { deleteEntityUpdateTag, findAssistantMutation, modifyEntityUpdateTag } from './assistant-mutations.js';
4
4
  export { type AssistantRecipe, type AssistantRecipeContext, type AssistantRecipeGroupSnapshot, type AssistantRecipeKind, findAssistantRecipeGroups, prepareAssistantRecipeUpdates, readAssistantRecipeGroup, } from './assistant-recipe-groups.js';
5
- export { ConfiguratorBuilder } from './configurator-builder.js';
5
+ export { ConfiguratorBuilder, checkSingleInstanceHandlers } from './configurator-builder.js';
6
6
  export * from './admin-page-factories.js';
7
7
  export { createInitialPublishedData, type CreateInitialPublishedDataProps } from './create-initial-published-data.js';
8
8
  export { webComponentAttributeParsers, createWebComponentPropertyDescriptor, type AttributeParser, type WebComponentPropertyDescriptor, } from './web-component-property.js';
@@ -1 +1 @@
1
- export{findAssistantFieldOptions,readAssistantFieldOptions}from"./assistant-field-options.js";export{deleteEntityUpdateTag,findAssistantMutation,modifyEntityUpdateTag}from"./assistant-mutations.js";export{findAssistantRecipeGroups,prepareAssistantRecipeUpdates,readAssistantRecipeGroup}from"./assistant-recipe-groups.js";export{ConfiguratorBuilder}from"./configurator-builder.js";export*from"./admin-page-factories.js";export{createInitialPublishedData}from"./create-initial-published-data.js";export{webComponentAttributeParsers,createWebComponentPropertyDescriptor}from"./web-component-property.js";export{createWebComponentEventDescriptor}from"./web-component-event.js";export{standardWebComponentProperties}from"./standard-properties.js";export{standardWebComponentEvents}from"./standard-events.js";export{createGetApplicationWrapperHandler,isGetApplicationWrapperHandler}from"./GetApplicationWrapperHandler.js";export{createGetThemeHandler,GetThemeHandlerName,isGetThemeHandler}from"./GetThemeHandler.js";export{createGetWebComponentOptionsHandler,isGetWebComponentOptionsHandler}from"./GetWebComponentOptions.js";export{createFinalizeAdminDomain}from"./published-data/create-finalize-admin-domain.js";export{FilterPublishedChunksHandlerName,isFilterPublishedChunksHandler}from"./published-data/FilterPublishedChunksHandler.js";export{mapPublishedData}from"./published-data/map-published-data.js";export{flattenTabData,mapDefaultValuesToRecords,mapPublishedChunkedData,SYSTEM_CHUNK_KEY,SYSTEM_CHUNK_SCOPE,SWATCH_DEFINITION}from"./published-data/map-published-chunked-data.js";export{buildLegendRows}from"./published-data/build-legend-data.js";export{formatFieldType,getFieldDescription}from"./published-data/format-field-type.js";export{mapDataToSheet}from"./published-data/map-data-to-sheet.js";export{validateRows}from"./published-data/validate-sheet-data.js";export{createDataRowValidatorHandler,DataRowValidatorHandlerName,isDataRowValidatorHandler}from"./published-data/DataRowValidatorHandler.js";export{createSheetValidatorHandler,SheetValidatorHandlerName,isSheetValidatorHandler}from"./published-data/SheetValidatorHandler.js";export{createMapPublishedRevisionDataHandler,createMapPublishedRevisionDataHandlerFactory,isMapPublishedRevisionDataHandler}from"./published-data/MapPublishedRevisionDataHandler.js";export{createMapPublishedChunkedDataHandler,createMapPublishedChunkedDataHandlerFactory,isMapPublishedChunkedDataHandler}from"./published-data/MapPublishedChunkedDataHandler.js";export*from"./assistant/index.js";
1
+ export{findAssistantFieldOptions,readAssistantFieldOptions}from"./assistant-field-options.js";export{deleteEntityUpdateTag,findAssistantMutation,modifyEntityUpdateTag}from"./assistant-mutations.js";export{findAssistantRecipeGroups,prepareAssistantRecipeUpdates,readAssistantRecipeGroup}from"./assistant-recipe-groups.js";export{ConfiguratorBuilder,checkSingleInstanceHandlers}from"./configurator-builder.js";export*from"./admin-page-factories.js";export{createInitialPublishedData}from"./create-initial-published-data.js";export{webComponentAttributeParsers,createWebComponentPropertyDescriptor}from"./web-component-property.js";export{createWebComponentEventDescriptor}from"./web-component-event.js";export{standardWebComponentProperties}from"./standard-properties.js";export{standardWebComponentEvents}from"./standard-events.js";export{createGetApplicationWrapperHandler,isGetApplicationWrapperHandler}from"./GetApplicationWrapperHandler.js";export{createGetThemeHandler,GetThemeHandlerName,isGetThemeHandler}from"./GetThemeHandler.js";export{createGetWebComponentOptionsHandler,isGetWebComponentOptionsHandler}from"./GetWebComponentOptions.js";export{createFinalizeAdminDomain}from"./published-data/create-finalize-admin-domain.js";export{FilterPublishedChunksHandlerName,isFilterPublishedChunksHandler}from"./published-data/FilterPublishedChunksHandler.js";export{mapPublishedData}from"./published-data/map-published-data.js";export{flattenTabData,mapDefaultValuesToRecords,mapPublishedChunkedData,SYSTEM_CHUNK_KEY,SYSTEM_CHUNK_SCOPE,SWATCH_DEFINITION}from"./published-data/map-published-chunked-data.js";export{buildLegendRows}from"./published-data/build-legend-data.js";export{formatFieldType,getFieldDescription}from"./published-data/format-field-type.js";export{mapDataToSheet}from"./published-data/map-data-to-sheet.js";export{validateRows}from"./published-data/validate-sheet-data.js";export{createDataRowValidatorHandler,DataRowValidatorHandlerName,isDataRowValidatorHandler}from"./published-data/DataRowValidatorHandler.js";export{createSheetValidatorHandler,SheetValidatorHandlerName,isSheetValidatorHandler}from"./published-data/SheetValidatorHandler.js";export{createMapPublishedRevisionDataHandler,createMapPublishedRevisionDataHandlerFactory,isMapPublishedRevisionDataHandler}from"./published-data/MapPublishedRevisionDataHandler.js";export{createMapPublishedChunkedDataHandler,createMapPublishedChunkedDataHandlerFactory,isMapPublishedChunkedDataHandler}from"./published-data/MapPublishedChunkedDataHandler.js";export*from"./assistant/index.js";
@@ -1 +1 @@
1
- import{z as e}from"zod";import{RoutingStateSchema as t,parseRouteAttribute as a}from"./route-property.js";import{createWebComponentPropertyDescriptor as r,webComponentAttributeParsers as n}from"./web-component-property.js";export const standardWebComponentProperties={onEvent:r({schema:e.function().args(e.object({type:e.string(),payload:e.unknown()})).returns(e.unknown()),defaultValue:void 0,attributeParser:n.globalVariable,attributeNames:["on-event","onevent"]}),onAttached:r({schema:e.function().args(e.unknown().describe("The web component instance")).returns(e.unknown().describe("Nothing should be returned, but validation will not fail if something is (important for async handlers)")),defaultValue:void 0,attributeParser:n.globalVariable,attributeNames:["on-attached","onattached"]}),locale:r({schema:e.string(),defaultValue:"en",attributeParser:n.string,attributeNames:["locale"]}),nonce:r({schema:e.string(),defaultValue:void 0,attributeParser:n.string,attributeNames:["nonce"]}),modalZIndex:r({schema:e.number().int(),defaultValue:9910,attributeParser:n.number,attributeNames:["modal-zindex","modalzindex","modal-z-index"]}),expanded:r({schema:e.boolean(),defaultValue:!1,attributeParser:n.boolean,attributeNames:["expanded"]}),mode:r({schema:e.enum(["configurator","admin","standalone-admin"]),defaultValue:"configurator",attributeParser:n.string,attributeNames:["mode"]}),presetTags:r({schema:e.array(e.string()).nullable(),defaultValue:null,attributeParser:n.commaSeparatedStrings,attributeNames:["preset-tags"]}),route:r({schema:t,defaultValue:{route:"Index"},attributeParser:a,attributeNames:["route"]}),sessionToken:r({schema:e.string(),defaultValue:void 0,attributeParser:n.string,attributeNames:["session-token","sessiontoken"]}),adminSessionToken:r({schema:e.string(),defaultValue:void 0,attributeParser:n.string,attributeNames:["admin-session-token","adminsessiontoken"]}),refreshToken:r({schema:e.string(),defaultValue:void 0,attributeParser:n.string,attributeNames:["refresh-token","refreshtoken"]}),authorizationCode:r({schema:e.string(),defaultValue:void 0,attributeParser:n.string,attributeNames:["authorization-code","authorizationcode"]}),containerZIndex:r({schema:e.number().int(),defaultValue:9900,attributeParser:n.number,attributeNames:["container-zindex","containerzindex","container-z-index"]}),htmlFontSize:r({schema:e.number().int(),defaultValue:16,attributeParser:n.number,attributeNames:["html-font-size","htmlfontsize"]}),integrationMode:r({schema:e.enum(["page","handoff","widget","headless"]),defaultValue:"page",attributeParser:n.string,attributeNames:["integration-mode","integrationmode"]}),power:r({schema:e.enum(["on","standby","off"]),defaultValue:"on",attributeParser:n.string,attributeNames:["power"]}),readonly:r({schema:e.boolean(),defaultValue:!1,attributeParser:n.boolean,attributeNames:["readonly"]})};
1
+ import{z as e}from"zod";import{DEFAULT_FALLBACK_LOCALE as t}from"#package/i18n";import{RoutingStateSchema as a,parseRouteAttribute as r}from"./route-property.js";import{createWebComponentPropertyDescriptor as n,webComponentAttributeParsers as i}from"./web-component-property.js";export const standardWebComponentProperties={onEvent:n({schema:e.function().args(e.object({type:e.string(),payload:e.unknown()})).returns(e.unknown()),defaultValue:void 0,attributeParser:i.globalVariable,attributeNames:["on-event","onevent"]}),onAttached:n({schema:e.function().args(e.unknown().describe("The web component instance")).returns(e.unknown().describe("Nothing should be returned, but validation will not fail if something is (important for async handlers)")),defaultValue:void 0,attributeParser:i.globalVariable,attributeNames:["on-attached","onattached"]}),locale:n({schema:e.string(),defaultValue:t,attributeParser:i.string,attributeNames:["locale"]}),nonce:n({schema:e.string(),defaultValue:void 0,attributeParser:i.string,attributeNames:["nonce"]}),modalZIndex:n({schema:e.number().int(),defaultValue:9910,attributeParser:i.number,attributeNames:["modal-zindex","modalzindex","modal-z-index"]}),expanded:n({schema:e.boolean(),defaultValue:!1,attributeParser:i.boolean,attributeNames:["expanded"]}),mode:n({schema:e.enum(["configurator","admin","standalone-admin"]),defaultValue:"configurator",attributeParser:i.string,attributeNames:["mode"]}),presetTags:n({schema:e.array(e.string()).nullable(),defaultValue:null,attributeParser:i.commaSeparatedStrings,attributeNames:["preset-tags"]}),route:n({schema:a,defaultValue:{route:"Index"},attributeParser:r,attributeNames:["route"]}),sessionToken:n({schema:e.string(),defaultValue:void 0,attributeParser:i.string,attributeNames:["session-token","sessiontoken"]}),adminSessionToken:n({schema:e.string(),defaultValue:void 0,attributeParser:i.string,attributeNames:["admin-session-token","adminsessiontoken"]}),refreshToken:n({schema:e.string(),defaultValue:void 0,attributeParser:i.string,attributeNames:["refresh-token","refreshtoken"]}),authorizationCode:n({schema:e.string(),defaultValue:void 0,attributeParser:i.string,attributeNames:["authorization-code","authorizationcode"]}),containerZIndex:n({schema:e.number().int(),defaultValue:9900,attributeParser:i.number,attributeNames:["container-zindex","containerzindex","container-z-index"]}),htmlFontSize:n({schema:e.number().int(),defaultValue:16,attributeParser:i.number,attributeNames:["html-font-size","htmlfontsize"]}),integrationMode:n({schema:e.enum(["page","handoff","widget","headless"]),defaultValue:"page",attributeParser:i.string,attributeNames:["integration-mode","integrationmode"]}),power:n({schema:e.enum(["on","standby","off"]),defaultValue:"on",attributeParser:i.string,attributeNames:["power"]}),readonly:n({schema:e.boolean(),defaultValue:!1,attributeParser:i.boolean,attributeNames:["readonly"]})};
@@ -24,11 +24,17 @@ export declare class DomainBuilder<ENTITIES extends DomainEntity<string>, ALLOWE
24
24
  withMigrate(migration: MigrateFunction<ENTITIES>): DomainBuilder<ENTITIES, ALLOWED_ROOT_ENTITIES, ALIASES, $MAP, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA>;
25
25
  withExpressions(implementation: AliasedExpressions<ENTITIES, ALLOWED_ROOT_ENTITIES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ALIASES>): DomainBuilder<ENTITIES, ALLOWED_ROOT_ENTITIES, ALIASES, $MAP, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA>;
26
26
  /**
27
- * Adds the expressions of the `src/expressions/` files, as the generated barrel lists them. Each file
28
- * is checked against the folder's contract and added on its own, so an expression defined twice is
29
- * reported with both files instead of being overwritten by file order.
27
+ * Adds the expressions of the `src/expressions/` files, as the generated barrel lists them. The
28
+ * files are merged by `mergeExpressionModules`, which checks each one and throws every wrong file,
29
+ * every expression defined twice and every expression the domain already has, such as a generated
30
+ * one, together as one `ImplementationErrors` of `DUPLICATE_DEFINITION`s.
30
31
  */
31
32
  withExpressionModules(modules: readonly ProjectModule[]): DomainBuilder<ENTITIES, ALLOWED_ROOT_ENTITIES, ALIASES, $MAP, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA>;
33
+ /**
34
+ * Adds expressions already expanded to entity types, each with its origin. An expression that the
35
+ * domain, or an earlier one of the list, defines for the same entity type is an error.
36
+ */
37
+ private withEntityExpressions;
32
38
  /** Declares the actions of the domain, as the generated `domain-spec.ts` reads them from the spec's `actions` section. */
33
39
  withActions(actions: readonly ActionDefinition[]): DomainBuilder<ENTITIES, ALLOWED_ROOT_ENTITIES, ALIASES, $MAP, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA>;
34
40
  /** Adds the action implementations of the `src/actions/` files, as the generated barrel lists them, after checking each file against the folder's contract. */
@@ -1 +1 @@
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
+ import{DomainFactory as t,createMigrateFunction as i,expandAlias as e}from"./core/index.js";import{mergeExpressionModules as s,resolveActionModules 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=Object.entries(t);return this.withEntityExpressions(i.flatMap(([t,i])=>e(this.aliasMap,t).flatMap(e=>Object.entries(i).map(([i,s])=>({type:e,expression:{...s,origin:{name:i,typeOrAlias:t}}})))))}withExpressionModules(t){let i=new Map(Object.entries(this.implemented).map(([t,i])=>[t,new Set(Object.keys(i))]));return this.withEntityExpressions(Object.entries(s(t,this.aliasMap,void 0,i)).flatMap(([t,i])=>Object.values(i).map(i=>({type:t,expression:i}))))}withEntityExpressions(t){let i={...this.implemented};return t.forEach(({type:t,expression:e})=>{let{name:s,typeOrAlias:n}=e.origin,o={...i[t]},h=o[s];if(h)throw Error(`Duplicate expression ${t}.${s}: The expression is defined on both ${n} and ${h.origin.typeOrAlias}, which would lead to ambiguous usage. Please ensure that expressions are only defined once.`);o[s]={...e,evaluate:a(`${t}_${s}`,e.evaluate)},i[t]=o}),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)}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(n(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})}}
@@ -0,0 +1,39 @@
1
+ import type { AnyApplicationConfig, DefaultEnvs } from '../application/index.js';
2
+ import type { PersistenceConfig } from './environment/index.js';
3
+ import { type ApplicationSpec } from './spec/index.js';
4
+ /**
5
+ * The environment an application runs in, before the runtime resolves it: the values of the
6
+ * phoenix runtime config (`defaultEnvs`), and the deployment id, the development flag and the
7
+ * persistence when the host sets them explicitly.
8
+ */
9
+ interface ApplicationEnvironmentInput {
10
+ readonly defaultEnvs?: DefaultEnvs | undefined;
11
+ readonly deploymentId?: string | undefined;
12
+ readonly isDev?: boolean | undefined;
13
+ readonly persistence?: PersistenceConfig | undefined;
14
+ }
15
+ /**
16
+ * An application ready to run: the spec slice of the domain runtime, the environment it runs in,
17
+ * the services it uses (i18n, and a logger, analytics or admin integration a host provides) and the
18
+ * tag of the web component it mounts as.
19
+ *
20
+ * `createApplication` of `@salsita-ai/sdk/application-spec` builds one from an
21
+ * application's runtime spec and its project modules, without a builder or an `ApplicationConfig`.
22
+ * `TYPES` is the project's types; no value carries it at run time.
23
+ */
24
+ export interface Application<TYPES = unknown> {
25
+ readonly spec: ApplicationSpec;
26
+ readonly environment: ApplicationEnvironmentInput;
27
+ readonly services: NonNullable<AnyApplicationConfig['services']>;
28
+ readonly tag: string;
29
+ /** Never set: it carries `TYPES` to the functions that take the application. */
30
+ readonly '~types'?: TYPES;
31
+ }
32
+ /**
33
+ * Converts the config of a project built with `ConfiguratorBuilder` to the application a runtime
34
+ * starts from. It checks the project's files (`initializeSpec`) and throws every mistake together,
35
+ * so a host converts it where it shows a failed start: a mount when an element starts, the domain
36
+ * runtime when it initializes.
37
+ */
38
+ export declare const applicationFromConfig: (config: AnyApplicationConfig) => Application;
39
+ export {};
@@ -0,0 +1 @@
1
+ import{initializeSpec as e}from"./spec/index.js";export const applicationFromConfig=s=>({spec:e(s),environment:{defaultEnvs:s.defaultEnvs,deploymentId:s.deploymentId,isDev:s.isDev,persistence:s.persistence},services:s.services??{},tag:s.mount.tag});
@@ -1,6 +1,7 @@
1
1
  import { BehaviorSubject } from 'rxjs';
2
2
  import type { AnyApplicationConfig } from '../application/index.js';
3
3
  import { type ApplicationAccessInfo } from './access/index.js';
4
+ import { type Application } from './application.js';
4
5
  import { type ApplicationDomainContextState, type DomainApplicationType, type InitializableSystem } from './domain-context/index.js';
5
6
  import { type ApplicationDomainData } from './domain-data/index.js';
6
7
  import { type DomainRuntimeServices } from './domain-services/index.js';
@@ -21,17 +22,30 @@ export interface DomainRuntimeState {
21
22
  readonly webComponent: ApplicationWebComponentState;
22
23
  readonly domainContext: ApplicationDomainContextState;
23
24
  }
24
- interface Props<State extends DomainRuntimeState> {
25
+ /**
26
+ * What a domain runtime starts from: the spec slice and the environment of an application, or the
27
+ * config of a project built with `ConfiguratorBuilder`, which is converted to them when the runtime
28
+ * initializes.
29
+ */
30
+ type DomainRuntimeSource = {
31
+ readonly application: Pick<Application, 'spec' | 'environment'>;
32
+ readonly config?: undefined;
33
+ } | {
25
34
  readonly config: AnyApplicationConfig;
35
+ readonly application?: undefined;
36
+ };
37
+ type DomainRuntimeProps = DomainRuntimeSource & {
26
38
  readonly services: DomainRuntimeServices;
27
- readonly getSubject: () => BehaviorSubject<State>;
28
39
  /**
29
40
  * Systems a host layers onto a slot's domain initialization. Webhook and finalize hosts run the
30
41
  * domain alone and pass nothing; the application runtime contributes its domain-application
31
42
  * systems here.
32
43
  */
33
44
  readonly getExtensionSystems?: (applicationType: DomainApplicationType) => readonly InitializableSystem[];
34
- }
45
+ };
46
+ type Props<State extends DomainRuntimeState> = DomainRuntimeProps & {
47
+ readonly getSubject: () => BehaviorSubject<State>;
48
+ };
35
49
  export declare function createDomainRuntimeSlices<State extends DomainRuntimeState>(props: Props<State>): {
36
50
  initialize: () => {
37
51
  spec: ApplicationSpec;
@@ -344,6 +358,8 @@ export declare function createDomainRuntimeSlices<State extends DomainRuntimeSta
344
358
  webComponent: {
345
359
  selectReadonly: import("@salsita-ai/common/utils").Selector<import("./index.js").WebComponentSelectorState, boolean>;
346
360
  getReadonly: () => boolean;
361
+ selectLocale: import("@salsita-ai/common/utils").Selector<import("./index.js").WebComponentSelectorState, string>;
362
+ getLocale: () => string;
347
363
  getWebcomponentGeneration: () => number;
348
364
  };
349
365
  domainContext: {
@@ -632,9 +648,16 @@ export declare function createDomainRuntimeSlices<State extends DomainRuntimeSta
632
648
  };
633
649
  };
634
650
  };
651
+ /**
652
+ * Writers only the runtime that owns the host-property mirror may call, kept off the public
653
+ * `actions`: the host sets `locale` on the element, and the mirror copies it here.
654
+ */
655
+ hostMirrorActions: {
656
+ setLocale: (locale: string) => void;
657
+ };
635
658
  };
636
659
  export type DomainRuntimeSlices = ReturnType<typeof createDomainRuntimeSlices>;
637
- export declare const createDomainRuntime: (props: Omit<Props<DomainRuntimeState>, 'getSubject'>) => {
660
+ export declare const createDomainRuntime: (props: DomainRuntimeProps) => {
638
661
  initialize: () => {
639
662
  spec: ApplicationSpec;
640
663
  overrides: ApplicationOverrides;
@@ -946,6 +969,8 @@ export declare const createDomainRuntime: (props: Omit<Props<DomainRuntimeState>
946
969
  webComponent: {
947
970
  selectReadonly: import("@salsita-ai/common/utils").Selector<import("./index.js").WebComponentSelectorState, boolean>;
948
971
  getReadonly: () => boolean;
972
+ selectLocale: import("@salsita-ai/common/utils").Selector<import("./index.js").WebComponentSelectorState, string>;
973
+ getLocale: () => string;
949
974
  getWebcomponentGeneration: () => number;
950
975
  };
951
976
  domainContext: {
@@ -1234,6 +1259,13 @@ export declare const createDomainRuntime: (props: Omit<Props<DomainRuntimeState>
1234
1259
  };
1235
1260
  };
1236
1261
  };
1262
+ /**
1263
+ * Writers only the runtime that owns the host-property mirror may call, kept off the public
1264
+ * `actions`: the host sets `locale` on the element, and the mirror copies it here.
1265
+ */
1266
+ hostMirrorActions: {
1267
+ setLocale: (locale: string) => void;
1268
+ };
1237
1269
  getState: () => DomainRuntimeState;
1238
1270
  subscribe: (callback: () => void) => () => void;
1239
1271
  };
@@ -1 +1 @@
1
- import{BehaviorSubject as e}from"rxjs";import{createAccessInfoActions as t,createAccessInfoSelectors as n,initializeAccessInfo as a}from"./access/index.js";import{createDomainContextActions as o,createDomainContextSelectors as i,initializeDomainContext as s}from"./domain-context/index.js";import{createDomainDataActions as r,createDomainDataSelectors as m,initializeDomainData as l}from"./domain-data/index.js";import{createDomainServicesSelectors as d}from"./domain-services/index.js";import{createEnvironmentActions as c,createEnvironmentSelectors as u,initializeEnvironment as v}from"./environment/index.js";import{createLoadedDataActions as x,createLoadedDataSelectors as p,initializeLoadedData as S}from"./loaded-data/index.js";import{createOverridesActions as f,createOverridesSelectors as g,initializeOverrides as C}from"./overrides/index.js";import{createSessionContextActions as D,createSessionContextSelectors as b,initializeSessionContext as j}from"./session-context/index.js";import{createSpecActions as w,createSpecSelectors as y,initializeSpec as E}from"./spec/index.js";import{createWebComponentActions as z,createWebComponentSelectors as R,initializeWebComponent as T}from"./web-component/index.js";export function createDomainRuntimeSlices(e){let{config:h,getSubject:A,services:I,getExtensionSystems:L}=e,O=w({setSpec:e=>{let t=A(),n=e(t.value.spec);t.next({...t.value,spec:n})}}),W=y({getState:()=>A().value}),k=d({services:I,specSelectors:W}),q=f({setOverrides:e=>{let t=A(),n=e(t.value.overrides);t.next({...t.value,overrides:n})}}),B=g({getState:()=>A().value}),F=u({getState:()=>A().value,overridesSelectors:B}),G=c({setEnvironment:e=>{let t=A(),n=e(t.value.environment);t.next({...t.value,environment:n})}}),H=x({setLoadedData:e=>{let t=A(),n=e(t.value.loadedData);t.next({...t.value,loadedData:n})}}),J=p({getState:()=>A().value}),K=r({setDomainDataState:e=>{let t=A(),n=e(t.value.domainData);t.next({...t.value,domainData:n})}}),M=m({getState:()=>A().value,overridesSelectors:B}),N=D({setSessionContextState:e=>{let t=A(),n=e(t.value.sessionContext);t.next({...t.value,sessionContext:n})}}),P=b({getState:()=>A().value,overridesSelectors:B}),Q=t({setAccessInfoState:e=>{let t=A(),n=e(t.value.access);t.next({...t.value,access:n})}}),U=n({getState:()=>A().value,overridesSelectors:B}),V=z({setWebComponentState:e=>{let t=A(),n=e(t.value.webComponent);t.next({...t.value,webComponent:n})}}),X=R({getState:()=>A().value}),Y=o({setDomainContextState:e=>{let t=A(),n=e(t.value.domainContext);t.next({...t.value,domainContext:n})}}),Z={configurator:i({applicationType:"configurator",getState:()=>A().value,actions:Y.configurator,getExtensionSystems:()=>L?.("configurator")??[],specSelectors:W,accessSelectors:U,webComponentSelectors:X,domainDataSelectors:M,sessionContextSelectors:P,domainServicesSelectors:k,environmentSelectors:F}),admin:i({applicationType:"admin",getState:()=>A().value,actions:Y.admin,getExtensionSystems:()=>L?.("admin")??[],specSelectors:W,accessSelectors:U,webComponentSelectors:X,domainDataSelectors:M,sessionContextSelectors:P,domainServicesSelectors:k,environmentSelectors:F})};return{initialize:()=>({spec:E(h),overrides:C(),environment:v(h),loadedData:S(),domainData:l(),sessionContext:j(),access:a(),webComponent:T(),domainContext:s()}),selectors:{domainServices:k,spec:W,overrides:B,environment:F,loadedData:J,domainData:M,sessionContext:P,access:U,webComponent:X,domainContext:Z},actions:{spec:O,overrides:q,environment:G,loadedData:H,domainData:K,sessionContext:N,access:Q,webComponent:V,domainContext:Y}}}export const createDomainRuntime=t=>{let{config:n,services:a,getExtensionSystems:o}=t,i=null,s=createDomainRuntimeSlices({config:n,getSubject:()=>{if(!i)throw Error("Subject not yet initialized!");return i},services:a,getExtensionSystems:o});return i=new e(s.initialize()),{...s,getState:()=>i.value,subscribe:e=>{let t=i.subscribe(()=>e());return()=>t.unsubscribe()}}};
1
+ import{BehaviorSubject as e}from"rxjs";import{createAccessInfoActions as t,createAccessInfoSelectors as n,initializeAccessInfo as a}from"./access/index.js";import{applicationFromConfig as o}from"./application.js";import{createDomainContextActions as i,createDomainContextSelectors as s,initializeDomainContext as r}from"./domain-context/index.js";import{createDomainDataActions as m,createDomainDataSelectors as l,initializeDomainData as c}from"./domain-data/index.js";import{createDomainServicesSelectors as d}from"./domain-services/index.js";import{createEnvironmentActions as u,createEnvironmentSelectors as v,initializeEnvironment as p}from"./environment/index.js";import{createLoadedDataActions as x,createLoadedDataSelectors as S,initializeLoadedData as f}from"./loaded-data/index.js";import{createOverridesActions as g,createOverridesSelectors as C,initializeOverrides as D}from"./overrides/index.js";import{createSessionContextActions as b,createSessionContextSelectors as j,initializeSessionContext as w}from"./session-context/index.js";import{createSpecActions as y,createSpecSelectors as E}from"./spec/index.js";import{createWebComponentActions as z,createWebComponentSelectors as R,initializeWebComponent as h}from"./web-component/index.js";export function createDomainRuntimeSlices(e){let{getSubject:A,services:T,getExtensionSystems:I}=e,L=y({setSpec:e=>{let t=A(),n=e(t.value.spec);t.next({...t.value,spec:n})}}),M=E({getState:()=>A().value}),O=d({services:T,specSelectors:M}),W=g({setOverrides:e=>{let t=A(),n=e(t.value.overrides);t.next({...t.value,overrides:n})}}),k=C({getState:()=>A().value}),q=v({getState:()=>A().value,overridesSelectors:k}),B=u({setEnvironment:e=>{let t=A(),n=e(t.value.environment);t.next({...t.value,environment:n})}}),F=x({setLoadedData:e=>{let t=A(),n=e(t.value.loadedData);t.next({...t.value,loadedData:n})}}),G=S({getState:()=>A().value}),H=m({setDomainDataState:e=>{let t=A(),n=e(t.value.domainData);t.next({...t.value,domainData:n})}}),J=l({getState:()=>A().value,overridesSelectors:k}),K=b({setSessionContextState:e=>{let t=A(),n=e(t.value.sessionContext);t.next({...t.value,sessionContext:n})}}),N=j({getState:()=>A().value,overridesSelectors:k}),P=t({setAccessInfoState:e=>{let t=A(),n=e(t.value.access);t.next({...t.value,access:n})}}),Q=n({getState:()=>A().value,overridesSelectors:k}),{setLocale:U,...V}=z({setWebComponentState:e=>{let t=A(),n=e(t.value.webComponent);t.next({...t.value,webComponent:n})}}),X=R({getState:()=>A().value}),Y=i({setDomainContextState:e=>{let t=A(),n=e(t.value.domainContext);t.next({...t.value,domainContext:n})}}),Z={configurator:s({applicationType:"configurator",getState:()=>A().value,actions:Y.configurator,getExtensionSystems:()=>I?.("configurator")??[],specSelectors:M,accessSelectors:Q,webComponentSelectors:X,domainDataSelectors:J,sessionContextSelectors:N,domainServicesSelectors:O,environmentSelectors:q}),admin:s({applicationType:"admin",getState:()=>A().value,actions:Y.admin,getExtensionSystems:()=>I?.("admin")??[],specSelectors:M,accessSelectors:Q,webComponentSelectors:X,domainDataSelectors:J,sessionContextSelectors:N,domainServicesSelectors:O,environmentSelectors:q})};return{initialize:()=>{let t=e.application??o(e.config);return{spec:t.spec,overrides:D(),environment:p(t.environment),loadedData:f(),domainData:c(),sessionContext:w(),access:a(),webComponent:h(),domainContext:r()}},selectors:{domainServices:O,spec:M,overrides:k,environment:q,loadedData:G,domainData:J,sessionContext:N,access:Q,webComponent:X,domainContext:Z},actions:{spec:L,overrides:W,environment:B,loadedData:F,domainData:H,sessionContext:K,access:P,webComponent:V,domainContext:Y},hostMirrorActions:{setLocale:U}}}export const createDomainRuntime=t=>{let n=null,a=createDomainRuntimeSlices({...t,getSubject:()=>{if(!n)throw Error("Subject not yet initialized!");return n}});return n=new e(a.initialize()),{...a,getState:()=>n.value,subscribe:e=>{let t=n.subscribe(()=>e());return()=>t.unsubscribe()}}};
@@ -2,4 +2,4 @@ import type { AnyApplicationConfig } from '../../application/index.js';
2
2
  import type { ApplicationEnvironmentConfig } from './types.js';
3
3
  export declare const GOD_MODE_SESSION_STORAGE_KEY = "salsita-god-mode";
4
4
  export declare const isNotRegisteredDeploymentId: (deploymentId: string) => boolean;
5
- export declare const initializeEnvironment: (config: AnyApplicationConfig) => ApplicationEnvironmentConfig;
5
+ export declare const initializeEnvironment: (config: Pick<AnyApplicationConfig, 'defaultEnvs' | 'deploymentId' | 'isDev' | 'persistence'>) => ApplicationEnvironmentConfig;
@@ -10,6 +10,8 @@ export interface ImplementationErrorCollector {
10
10
  */
11
11
  readonly attempt: <T>(check: () => T, fallback: T) => T;
12
12
  readonly add: (error: ImplementationError) => void;
13
+ /** The errors recorded so far, in the order they were recorded. A host that reports them itself, such as the editor, reads them here instead of throwing them. */
14
+ readonly recorded: () => readonly ImplementationError[];
13
15
  /**
14
16
  * Throws the recorded errors as one {@link ImplementationErrors}, in the order they were
15
17
  * recorded. Does nothing when there are none.
@@ -1 +1 @@
1
- import{isImplementationError as r}from"./implementation-error.js";import{ImplementationErrors as t,isImplementationErrors as e}from"./implementation-errors.js";export const createImplementationErrorCollector=()=>{let o=[],n=r=>{o.push(r)};return{add:n,attempt:(t,o)=>{try{return t()}catch(t){if(e(t))return t.errors.forEach(n),o;if(r(t))return n(t),o;throw t}},throwIfAny:()=>{if(o.length>0)throw new t(o)}}};
1
+ import{isImplementationError as r}from"./implementation-error.js";import{ImplementationErrors as t,isImplementationErrors as e}from"./implementation-errors.js";export const createImplementationErrorCollector=()=>{let o=[],n=r=>{o.push(r)};return{add:n,attempt:(t,o)=>{try{return t()}catch(t){if(e(t))return t.errors.forEach(n),o;if(r(t))return n(t),o;throw t}},recorded:()=>[...o],throwIfAny:()=>{if(o.length>0)throw new t(o)}}};
@@ -1,7 +1,8 @@
1
1
  export * from './domain-runtime.js';
2
+ export { type Application, applicationFromConfig } from './application.js';
2
3
  export * from './domain-context/index.js';
3
4
  export * from './domain-services/index.js';
4
- export { type ImplementationErrorCode, type ImplementationErrorProps, type StartupStage, ImplementationError, ImplementationErrors, isImplementationError, isImplementationErrors, toImplementationErrors, } from './errors/index.js';
5
+ export { type ImplementationErrorCode, type ImplementationErrorCollector, type ImplementationErrorProps, type StartupStage, ImplementationError, ImplementationErrors, createImplementationErrorCollector, isImplementationError, isImplementationErrors, toImplementationErrors, } from './errors/index.js';
5
6
  export * from './spec/index.js';
6
7
  export * from './environment/index.js';
7
8
  export * from './access/index.js';
@@ -1 +1 @@
1
- export*from"./domain-runtime.js";export*from"./domain-context/index.js";export*from"./domain-services/index.js";export{ImplementationError,ImplementationErrors,isImplementationError,isImplementationErrors,toImplementationErrors}from"./errors/index.js";export*from"./spec/index.js";export*from"./environment/index.js";export*from"./access/index.js";export*from"./overrides/index.js";export*from"./loaded-data/index.js";export*from"./domain-data/index.js";export*from"./session-context/index.js";export*from"./web-component/index.js";
1
+ export*from"./domain-runtime.js";export{applicationFromConfig}from"./application.js";export*from"./domain-context/index.js";export*from"./domain-services/index.js";export{ImplementationError,ImplementationErrors,createImplementationErrorCollector,isImplementationError,isImplementationErrors,toImplementationErrors}from"./errors/index.js";export*from"./spec/index.js";export*from"./environment/index.js";export*from"./access/index.js";export*from"./overrides/index.js";export*from"./loaded-data/index.js";export*from"./domain-data/index.js";export*from"./session-context/index.js";export*from"./web-component/index.js";
@@ -4,6 +4,6 @@ export * from './actions.js';
4
4
  export * from './create-violation-expressions.js';
5
5
  export * from './initialize.js';
6
6
  export * from './memoize-expression.js';
7
- export { type PhoenixEntityElementProps, type PhoenixEntityElementRegistration, type PhoenixLayoutElementRegistration, type PhoenixIconRegistration, type AssistantFormElementRegistration, type ElementRegistration, type CustomPhoenixEntityElementProps, type PhoenixLayoutElementDefinition, type PhoenixEntityElementDefinition, type CreateCustomPhoenixLayoutElement, type CreateCustomPhoenixEntityElement, createPhoenixLayoutElement, createPhoenixEntityElement, createCustomPhoenixLayoutElement, createCustomPhoenixEntityElement, createAssistantFormElement, findAssistantFormElementErrors, resolveElementModule, resolveElementModules, type PhoenixHandlerDefinition, type SystemPhoenixHandlerDefinition, type PhoenixHandlerRegistration, type SystemPhoenixHandlerRegistration, type SystemPhoenixAsyncHandlerDefinition, type SystemPhoenixAsyncHandlerRegistration, type HandlerRegistration, type CreatePhoenixHandler, createPhoenixHandler, createSystemPhoenixHandler, createSystemPhoenixAsyncHandler, resolveHandlerModule, resolveHandlerModules, type ProjectModule, resolveActionModules, resolveComponentOpticModules, type ExpressionModule, resolveExpressionModules, resolveImportedTransformers, resolveTransformerModule, resolveTransformerModules, resolveInvariantModules, } from './module-checks/index.js';
7
+ export { type PhoenixEntityElementProps, type PhoenixEntityElementRegistration, type PhoenixLayoutElementRegistration, type PhoenixIconRegistration, type AssistantFormElementRegistration, type ElementRegistration, type CustomPhoenixEntityElementProps, type PhoenixLayoutElementDefinition, type PhoenixEntityElementDefinition, type CreateCustomPhoenixLayoutElement, type CreateCustomPhoenixEntityElement, createPhoenixLayoutElement, createPhoenixEntityElement, createCustomPhoenixLayoutElement, createCustomPhoenixEntityElement, createAssistantFormElement, findAssistantFormElementErrors, resolveElementModule, resolveElementModules, type PhoenixHandlerDefinition, type SystemPhoenixHandlerDefinition, type PhoenixHandlerRegistration, type SystemPhoenixHandlerRegistration, type SystemPhoenixAsyncHandlerDefinition, type SystemPhoenixAsyncHandlerRegistration, type HandlerRegistration, type CreatePhoenixHandler, createPhoenixHandler, createSystemPhoenixHandler, createSystemPhoenixAsyncHandler, resolveHandlerModule, resolveHandlerModules, type ProjectModule, resolveActionModules, resolveComponentOpticModules, type ExpressionModule, resolveExpressionModules, type ValuedExpressions, mergeExpressionModules, resolveImportedTransformers, resolveTransformerModule, resolveTransformerModules, resolveInvariantModules, } from './module-checks/index.js';
8
8
  export * from './prepare-action-implementations.js';
9
9
  export * from './prepare-domain-expressions.js';
@@ -1 +1 @@
1
- export*from"./selectors.js";export*from"./actions.js";export*from"./create-violation-expressions.js";export*from"./initialize.js";export*from"./memoize-expression.js";export{createPhoenixLayoutElement,createPhoenixEntityElement,createCustomPhoenixLayoutElement,createCustomPhoenixEntityElement,createAssistantFormElement,findAssistantFormElementErrors,resolveElementModule,resolveElementModules,createPhoenixHandler,createSystemPhoenixHandler,createSystemPhoenixAsyncHandler,resolveHandlerModule,resolveHandlerModules,resolveActionModules,resolveComponentOpticModules,resolveExpressionModules,resolveImportedTransformers,resolveTransformerModule,resolveTransformerModules,resolveInvariantModules}from"./module-checks/index.js";export*from"./prepare-action-implementations.js";export*from"./prepare-domain-expressions.js";
1
+ export*from"./selectors.js";export*from"./actions.js";export*from"./create-violation-expressions.js";export*from"./initialize.js";export*from"./memoize-expression.js";export{createPhoenixLayoutElement,createPhoenixEntityElement,createCustomPhoenixLayoutElement,createCustomPhoenixEntityElement,createAssistantFormElement,findAssistantFormElementErrors,resolveElementModule,resolveElementModules,createPhoenixHandler,createSystemPhoenixHandler,createSystemPhoenixAsyncHandler,resolveHandlerModule,resolveHandlerModules,resolveActionModules,resolveComponentOpticModules,resolveExpressionModules,mergeExpressionModules,resolveImportedTransformers,resolveTransformerModule,resolveTransformerModules,resolveInvariantModules}from"./module-checks/index.js";export*from"./prepare-action-implementations.js";export*from"./prepare-domain-expressions.js";
@@ -4,6 +4,7 @@ export { findAssistantFormElementErrors } from './find-assistant-form-element-er
4
4
  export { type ProjectModule } from './project-modules.js';
5
5
  export { resolveActionModules } from './resolve-action-modules.js';
6
6
  export { resolveComponentOpticModules } from './resolve-component-optic-modules.js';
7
+ export { type ValuedExpressions, mergeExpressionModules } from './merge-expression-modules.js';
7
8
  export { type ExpressionModule, resolveExpressionModules } from './resolve-expression-modules.js';
8
9
  export { resolveImportedTransformers, resolveTransformerModule, resolveTransformerModules, } from './resolve-imported-transformers.js';
9
10
  export { type AnyInvariant, resolveInvariantModules } from './resolve-invariant-modules.js';
@@ -1 +1 @@
1
- export{createPhoenixLayoutElement,createPhoenixEntityElement,createCustomPhoenixLayoutElement,createCustomPhoenixEntityElement,createAssistantFormElement,resolveElementModule,resolveElementModules}from"./element-registration.js";export{createPhoenixHandler,createSystemPhoenixHandler,createSystemPhoenixAsyncHandler,resolveHandlerModule,resolveHandlerModules}from"./handler-registration.js";export{findAssistantFormElementErrors}from"./find-assistant-form-element-errors.js";export{resolveActionModules}from"./resolve-action-modules.js";export{resolveComponentOpticModules}from"./resolve-component-optic-modules.js";export{resolveExpressionModules}from"./resolve-expression-modules.js";export{resolveImportedTransformers,resolveTransformerModule,resolveTransformerModules}from"./resolve-imported-transformers.js";export{resolveInvariantModules}from"./resolve-invariant-modules.js";
1
+ export{createPhoenixLayoutElement,createPhoenixEntityElement,createCustomPhoenixLayoutElement,createCustomPhoenixEntityElement,createAssistantFormElement,resolveElementModule,resolveElementModules}from"./element-registration.js";export{createPhoenixHandler,createSystemPhoenixHandler,createSystemPhoenixAsyncHandler,resolveHandlerModule,resolveHandlerModules}from"./handler-registration.js";export{findAssistantFormElementErrors}from"./find-assistant-form-element-errors.js";export{resolveActionModules}from"./resolve-action-modules.js";export{resolveComponentOpticModules}from"./resolve-component-optic-modules.js";export{mergeExpressionModules}from"./merge-expression-modules.js";export{resolveExpressionModules}from"./resolve-expression-modules.js";export{resolveImportedTransformers,resolveTransformerModule,resolveTransformerModules}from"./resolve-imported-transformers.js";export{resolveInvariantModules}from"./resolve-invariant-modules.js";