@cratis/scene.components 4.2.0 → 4.3.0

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 (248) hide show
  1. package/bindings/resolveElementBinding.ts +17 -1
  2. package/cratisComponentsDescriptors.ts +48 -0
  3. package/cratisComponentsPackage.ts +2 -0
  4. package/dist/cjs/bindings/resolveElementBinding.js +13 -1
  5. package/dist/cjs/bindings/resolveElementBinding.js.map +1 -1
  6. package/dist/cjs/cratisComponentsDescriptors.js +83 -0
  7. package/dist/cjs/cratisComponentsDescriptors.js.map +1 -0
  8. package/dist/cjs/cratisComponentsPackage.js +3 -1
  9. package/dist/cjs/cratisComponentsPackage.js.map +1 -1
  10. package/dist/cjs/index.js +2 -0
  11. package/dist/cjs/index.js.map +1 -1
  12. package/dist/esm/bindings/resolveElementBinding.d.ts.map +1 -1
  13. package/dist/esm/bindings/resolveElementBinding.js +13 -1
  14. package/dist/esm/bindings/resolveElementBinding.js.map +1 -1
  15. package/dist/esm/cratisComponentsDescriptors.d.ts +3 -0
  16. package/dist/esm/cratisComponentsDescriptors.d.ts.map +1 -0
  17. package/dist/esm/cratisComponentsDescriptors.js +81 -0
  18. package/dist/esm/cratisComponentsDescriptors.js.map +1 -0
  19. package/dist/esm/cratisComponentsPackage.d.ts.map +1 -1
  20. package/dist/esm/cratisComponentsPackage.js +3 -1
  21. package/dist/esm/cratisComponentsPackage.js.map +1 -1
  22. package/dist/esm/index.d.ts +1 -0
  23. package/dist/esm/index.d.ts.map +1 -1
  24. package/dist/esm/index.js +1 -0
  25. package/dist/esm/index.js.map +1 -1
  26. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  27. package/index.ts +1 -0
  28. package/package.json +17 -16
  29. package/bindings/for_bindingRegistry/when_a_command_is_registered.ts +0 -30
  30. package/bindings/for_bindingRegistry/when_a_query_is_not_registered.ts +0 -17
  31. package/bindings/for_bindingRegistry/when_a_query_is_registered.ts +0 -30
  32. package/bindings/for_bindingRegistry/when_bindings_are_cleared.ts +0 -29
  33. package/bindings/for_bindingRegistry/when_registering_query_identities.ts +0 -81
  34. package/bindings/for_requireArcProxy/NativeProxies.ts +0 -28
  35. package/bindings/for_requireArcProxy/when_mounting_bound_adapters.tsx +0 -73
  36. package/bindings/for_requireArcProxy/when_previewing_without_arc.tsx +0 -37
  37. package/bindings/for_requireArcProxy/when_validating_a_proxy.ts +0 -44
  38. package/bindings/for_resolveElementBinding/when_resolving_a_command_binding.ts +0 -34
  39. package/bindings/for_resolveElementBinding/when_resolving_a_query_binding.ts +0 -45
  40. package/data/for_SceneDataTable/when_forwarding_query_arguments.tsx +0 -123
  41. package/data/for_SceneDataTable/when_the_query_binding_is_missing.tsx +0 -48
  42. package/data/for_SceneSingleResult/when_executing_a_native_query.tsx +0 -290
  43. package/data/for_SceneSingleResult/when_gating_the_lazy_runtime.tsx +0 -60
  44. package/dist/esm/bindings/for_bindingRegistry/when_a_command_is_registered.d.ts +0 -2
  45. package/dist/esm/bindings/for_bindingRegistry/when_a_command_is_registered.d.ts.map +0 -1
  46. package/dist/esm/bindings/for_bindingRegistry/when_a_command_is_registered.js +0 -25
  47. package/dist/esm/bindings/for_bindingRegistry/when_a_command_is_registered.js.map +0 -1
  48. package/dist/esm/bindings/for_bindingRegistry/when_a_query_is_not_registered.d.ts +0 -2
  49. package/dist/esm/bindings/for_bindingRegistry/when_a_query_is_not_registered.d.ts.map +0 -1
  50. package/dist/esm/bindings/for_bindingRegistry/when_a_query_is_not_registered.js +0 -12
  51. package/dist/esm/bindings/for_bindingRegistry/when_a_query_is_not_registered.js.map +0 -1
  52. package/dist/esm/bindings/for_bindingRegistry/when_a_query_is_registered.d.ts +0 -2
  53. package/dist/esm/bindings/for_bindingRegistry/when_a_query_is_registered.d.ts.map +0 -1
  54. package/dist/esm/bindings/for_bindingRegistry/when_a_query_is_registered.js +0 -23
  55. package/dist/esm/bindings/for_bindingRegistry/when_a_query_is_registered.js.map +0 -1
  56. package/dist/esm/bindings/for_bindingRegistry/when_bindings_are_cleared.d.ts +0 -2
  57. package/dist/esm/bindings/for_bindingRegistry/when_bindings_are_cleared.d.ts.map +0 -1
  58. package/dist/esm/bindings/for_bindingRegistry/when_bindings_are_cleared.js +0 -18
  59. package/dist/esm/bindings/for_bindingRegistry/when_bindings_are_cleared.js.map +0 -1
  60. package/dist/esm/bindings/for_bindingRegistry/when_registering_query_identities.d.ts +0 -2
  61. package/dist/esm/bindings/for_bindingRegistry/when_registering_query_identities.d.ts.map +0 -1
  62. package/dist/esm/bindings/for_bindingRegistry/when_registering_query_identities.js +0 -73
  63. package/dist/esm/bindings/for_bindingRegistry/when_registering_query_identities.js.map +0 -1
  64. package/dist/esm/bindings/for_requireArcProxy/NativeProxies.d.ts +0 -25
  65. package/dist/esm/bindings/for_requireArcProxy/NativeProxies.d.ts.map +0 -1
  66. package/dist/esm/bindings/for_requireArcProxy/NativeProxies.js +0 -23
  67. package/dist/esm/bindings/for_requireArcProxy/NativeProxies.js.map +0 -1
  68. package/dist/esm/bindings/for_requireArcProxy/when_mounting_bound_adapters.d.ts +0 -2
  69. package/dist/esm/bindings/for_requireArcProxy/when_mounting_bound_adapters.d.ts.map +0 -1
  70. package/dist/esm/bindings/for_requireArcProxy/when_mounting_bound_adapters.js +0 -56
  71. package/dist/esm/bindings/for_requireArcProxy/when_mounting_bound_adapters.js.map +0 -1
  72. package/dist/esm/bindings/for_requireArcProxy/when_previewing_without_arc.d.ts +0 -2
  73. package/dist/esm/bindings/for_requireArcProxy/when_previewing_without_arc.d.ts.map +0 -1
  74. package/dist/esm/bindings/for_requireArcProxy/when_previewing_without_arc.js +0 -32
  75. package/dist/esm/bindings/for_requireArcProxy/when_previewing_without_arc.js.map +0 -1
  76. package/dist/esm/bindings/for_requireArcProxy/when_validating_a_proxy.d.ts +0 -2
  77. package/dist/esm/bindings/for_requireArcProxy/when_validating_a_proxy.d.ts.map +0 -1
  78. package/dist/esm/bindings/for_requireArcProxy/when_validating_a_proxy.js +0 -45
  79. package/dist/esm/bindings/for_requireArcProxy/when_validating_a_proxy.js.map +0 -1
  80. package/dist/esm/bindings/for_resolveElementBinding/when_resolving_a_command_binding.d.ts +0 -2
  81. package/dist/esm/bindings/for_resolveElementBinding/when_resolving_a_command_binding.d.ts.map +0 -1
  82. package/dist/esm/bindings/for_resolveElementBinding/when_resolving_a_command_binding.js +0 -25
  83. package/dist/esm/bindings/for_resolveElementBinding/when_resolving_a_command_binding.js.map +0 -1
  84. package/dist/esm/bindings/for_resolveElementBinding/when_resolving_a_query_binding.d.ts +0 -2
  85. package/dist/esm/bindings/for_resolveElementBinding/when_resolving_a_query_binding.d.ts.map +0 -1
  86. package/dist/esm/bindings/for_resolveElementBinding/when_resolving_a_query_binding.js +0 -33
  87. package/dist/esm/bindings/for_resolveElementBinding/when_resolving_a_query_binding.js.map +0 -1
  88. package/dist/esm/data/for_SceneDataTable/when_forwarding_query_arguments.d.ts +0 -2
  89. package/dist/esm/data/for_SceneDataTable/when_forwarding_query_arguments.d.ts.map +0 -1
  90. package/dist/esm/data/for_SceneDataTable/when_forwarding_query_arguments.js +0 -107
  91. package/dist/esm/data/for_SceneDataTable/when_forwarding_query_arguments.js.map +0 -1
  92. package/dist/esm/data/for_SceneDataTable/when_the_query_binding_is_missing.d.ts +0 -2
  93. package/dist/esm/data/for_SceneDataTable/when_the_query_binding_is_missing.d.ts.map +0 -1
  94. package/dist/esm/data/for_SceneDataTable/when_the_query_binding_is_missing.js +0 -36
  95. package/dist/esm/data/for_SceneDataTable/when_the_query_binding_is_missing.js.map +0 -1
  96. package/dist/esm/data/for_SceneSingleResult/when_executing_a_native_query.d.ts +0 -2
  97. package/dist/esm/data/for_SceneSingleResult/when_executing_a_native_query.d.ts.map +0 -1
  98. package/dist/esm/data/for_SceneSingleResult/when_executing_a_native_query.js +0 -255
  99. package/dist/esm/data/for_SceneSingleResult/when_executing_a_native_query.js.map +0 -1
  100. package/dist/esm/data/for_SceneSingleResult/when_gating_the_lazy_runtime.d.ts +0 -2
  101. package/dist/esm/data/for_SceneSingleResult/when_gating_the_lazy_runtime.d.ts.map +0 -1
  102. package/dist/esm/data/for_SceneSingleResult/when_gating_the_lazy_runtime.js +0 -54
  103. package/dist/esm/data/for_SceneSingleResult/when_gating_the_lazy_runtime.js.map +0 -1
  104. package/dist/esm/editors/for_SceneObjectNavigationalBar/when_navigating_back_up_the_trail.d.ts +0 -2
  105. package/dist/esm/editors/for_SceneObjectNavigationalBar/when_navigating_back_up_the_trail.d.ts.map +0 -1
  106. package/dist/esm/editors/for_SceneObjectNavigationalBar/when_navigating_back_up_the_trail.js +0 -15
  107. package/dist/esm/editors/for_SceneObjectNavigationalBar/when_navigating_back_up_the_trail.js.map +0 -1
  108. package/dist/esm/editors/for_filterDefinitions/when_reading_filter_definitions.d.ts +0 -2
  109. package/dist/esm/editors/for_filterDefinitions/when_reading_filter_definitions.d.ts.map +0 -1
  110. package/dist/esm/editors/for_filterDefinitions/when_reading_filter_definitions.js +0 -39
  111. package/dist/esm/editors/for_filterDefinitions/when_reading_filter_definitions.js.map +0 -1
  112. package/dist/esm/editors/for_timeMachineVersions/when_reading_versions.d.ts +0 -2
  113. package/dist/esm/editors/for_timeMachineVersions/when_reading_versions.d.ts.map +0 -1
  114. package/dist/esm/editors/for_timeMachineVersions/when_reading_versions.js +0 -32
  115. package/dist/esm/editors/for_timeMachineVersions/when_reading_versions.js.map +0 -1
  116. package/dist/esm/for_cratisComponents/when_rendering_a_screen_through_the_real_renderer.d.ts +0 -2
  117. package/dist/esm/for_cratisComponents/when_rendering_a_screen_through_the_real_renderer.d.ts.map +0 -1
  118. package/dist/esm/for_cratisComponents/when_rendering_a_screen_through_the_real_renderer.js +0 -25
  119. package/dist/esm/for_cratisComponents/when_rendering_a_screen_through_the_real_renderer.js.map +0 -1
  120. package/dist/esm/for_cratisComponentsPackage/when_a_profile_ranks_it_above_the_packages_it_layers_on.d.ts +0 -2
  121. package/dist/esm/for_cratisComponentsPackage/when_a_profile_ranks_it_above_the_packages_it_layers_on.d.ts.map +0 -1
  122. package/dist/esm/for_cratisComponentsPackage/when_a_profile_ranks_it_above_the_packages_it_layers_on.js +0 -34
  123. package/dist/esm/for_cratisComponentsPackage/when_a_profile_ranks_it_above_the_packages_it_layers_on.js.map +0 -1
  124. package/dist/esm/for_cratisComponentsPackage/when_declaring_command_form_peers.d.ts +0 -2
  125. package/dist/esm/for_cratisComponentsPackage/when_declaring_command_form_peers.d.ts.map +0 -1
  126. package/dist/esm/for_cratisComponentsPackage/when_declaring_command_form_peers.js +0 -16
  127. package/dist/esm/for_cratisComponentsPackage/when_declaring_command_form_peers.js.map +0 -1
  128. package/dist/esm/for_cratisComponentsPackage/when_describing_query_arguments.d.ts +0 -2
  129. package/dist/esm/for_cratisComponentsPackage/when_describing_query_arguments.d.ts.map +0 -1
  130. package/dist/esm/for_cratisComponentsPackage/when_describing_query_arguments.js +0 -11
  131. package/dist/esm/for_cratisComponentsPackage/when_describing_query_arguments.js.map +0 -1
  132. package/dist/esm/for_cratisComponentsPackage/when_describing_query_input_form.d.ts +0 -2
  133. package/dist/esm/for_cratisComponentsPackage/when_describing_query_input_form.d.ts.map +0 -1
  134. package/dist/esm/for_cratisComponentsPackage/when_describing_query_input_form.js +0 -14
  135. package/dist/esm/for_cratisComponentsPackage/when_describing_query_input_form.js.map +0 -1
  136. package/dist/esm/for_cratisComponentsPackage/when_describing_single_result.d.ts +0 -2
  137. package/dist/esm/for_cratisComponentsPackage/when_describing_single_result.d.ts.map +0 -1
  138. package/dist/esm/for_cratisComponentsPackage/when_describing_single_result.js +0 -16
  139. package/dist/esm/for_cratisComponentsPackage/when_describing_single_result.js.map +0 -1
  140. package/dist/esm/for_cratisComponentsPackage/when_resolving_its_dependencies.d.ts +0 -2
  141. package/dist/esm/for_cratisComponentsPackage/when_resolving_its_dependencies.d.ts.map +0 -1
  142. package/dist/esm/for_cratisComponentsPackage/when_resolving_its_dependencies.js +0 -49
  143. package/dist/esm/for_cratisComponentsPackage/when_resolving_its_dependencies.js.map +0 -1
  144. package/dist/esm/for_cratisComponentsPackage/when_validating_the_bundle.d.ts +0 -2
  145. package/dist/esm/for_cratisComponentsPackage/when_validating_the_bundle.d.ts.map +0 -1
  146. package/dist/esm/for_cratisComponentsPackage/when_validating_the_bundle.js +0 -27
  147. package/dist/esm/for_cratisComponentsPackage/when_validating_the_bundle.js.map +0 -1
  148. package/dist/esm/for_properties/when_a_property_has_the_wrong_type.d.ts +0 -2
  149. package/dist/esm/for_properties/when_a_property_has_the_wrong_type.d.ts.map +0 -1
  150. package/dist/esm/for_properties/when_a_property_has_the_wrong_type.js +0 -24
  151. package/dist/esm/for_properties/when_a_property_has_the_wrong_type.js.map +0 -1
  152. package/dist/esm/for_properties/when_a_property_is_missing.d.ts +0 -2
  153. package/dist/esm/for_properties/when_a_property_is_missing.d.ts.map +0 -1
  154. package/dist/esm/for_properties/when_a_property_is_missing.js +0 -13
  155. package/dist/esm/for_properties/when_a_property_is_missing.js.map +0 -1
  156. package/dist/esm/for_properties/when_a_property_is_present.d.ts +0 -2
  157. package/dist/esm/for_properties/when_a_property_is_present.d.ts.map +0 -1
  158. package/dist/esm/for_properties/when_a_property_is_present.js +0 -21
  159. package/dist/esm/for_properties/when_a_property_is_present.js.map +0 -1
  160. package/dist/esm/forms/fields/for_CommandFormField/when_the_field_names_no_property.d.ts +0 -2
  161. package/dist/esm/forms/fields/for_CommandFormField/when_the_field_names_no_property.d.ts.map +0 -1
  162. package/dist/esm/forms/fields/for_CommandFormField/when_the_field_names_no_property.js +0 -12
  163. package/dist/esm/forms/fields/for_CommandFormField/when_the_field_names_no_property.js.map +0 -1
  164. package/dist/esm/forms/fields/for_SceneRadioButtonField/when_mapping_the_group_name.d.ts +0 -2
  165. package/dist/esm/forms/fields/for_SceneRadioButtonField/when_mapping_the_group_name.d.ts.map +0 -1
  166. package/dist/esm/forms/fields/for_SceneRadioButtonField/when_mapping_the_group_name.js +0 -38
  167. package/dist/esm/forms/fields/for_SceneRadioButtonField/when_mapping_the_group_name.js.map +0 -1
  168. package/dist/esm/forms/fields/for_resolveFieldBinding/when_resolving_a_field_binding.d.ts +0 -2
  169. package/dist/esm/forms/fields/for_resolveFieldBinding/when_resolving_a_field_binding.d.ts.map +0 -1
  170. package/dist/esm/forms/fields/for_resolveFieldBinding/when_resolving_a_field_binding.js +0 -28
  171. package/dist/esm/forms/fields/for_resolveFieldBinding/when_resolving_a_field_binding.js.map +0 -1
  172. package/dist/esm/forms/for_SceneCommandForm/given/RecordNote.d.ts +0 -22
  173. package/dist/esm/forms/for_SceneCommandForm/given/RecordNote.d.ts.map +0 -1
  174. package/dist/esm/forms/for_SceneCommandForm/given/RecordNote.js +0 -30
  175. package/dist/esm/forms/for_SceneCommandForm/given/RecordNote.js.map +0 -1
  176. package/dist/esm/forms/for_SceneCommandForm/given/StartProject.d.ts +0 -32
  177. package/dist/esm/forms/for_SceneCommandForm/given/StartProject.d.ts.map +0 -1
  178. package/dist/esm/forms/for_SceneCommandForm/given/StartProject.js +0 -32
  179. package/dist/esm/forms/for_SceneCommandForm/given/StartProject.js.map +0 -1
  180. package/dist/esm/forms/for_SceneCommandForm/when_forwarding_to_the_lazy_runtime.d.ts +0 -2
  181. package/dist/esm/forms/for_SceneCommandForm/when_forwarding_to_the_lazy_runtime.d.ts.map +0 -1
  182. package/dist/esm/forms/for_SceneCommandForm/when_forwarding_to_the_lazy_runtime.js +0 -66
  183. package/dist/esm/forms/for_SceneCommandForm/when_forwarding_to_the_lazy_runtime.js.map +0 -1
  184. package/dist/esm/forms/for_SceneCommandForm/when_native_custom_field_errors_block_submission.d.ts +0 -2
  185. package/dist/esm/forms/for_SceneCommandForm/when_native_custom_field_errors_block_submission.d.ts.map +0 -1
  186. package/dist/esm/forms/for_SceneCommandForm/when_native_custom_field_errors_block_submission.js +0 -26
  187. package/dist/esm/forms/for_SceneCommandForm/when_native_custom_field_errors_block_submission.js.map +0 -1
  188. package/dist/esm/forms/for_SceneCommandForm/when_preserving_guid_error_ownership.d.ts +0 -2
  189. package/dist/esm/forms/for_SceneCommandForm/when_preserving_guid_error_ownership.d.ts.map +0 -1
  190. package/dist/esm/forms/for_SceneCommandForm/when_preserving_guid_error_ownership.js +0 -44
  191. package/dist/esm/forms/for_SceneCommandForm/when_preserving_guid_error_ownership.js.map +0 -1
  192. package/dist/esm/forms/for_SceneCommandForm/when_rendering_submit_in_native_context.d.ts +0 -2
  193. package/dist/esm/forms/for_SceneCommandForm/when_rendering_submit_in_native_context.d.ts.map +0 -1
  194. package/dist/esm/forms/for_SceneCommandForm/when_rendering_submit_in_native_context.js +0 -49
  195. package/dist/esm/forms/for_SceneCommandForm/when_rendering_submit_in_native_context.js.map +0 -1
  196. package/dist/esm/forms/for_SceneCommandForm/when_submitting_explicit_inputs.d.ts +0 -2
  197. package/dist/esm/forms/for_SceneCommandForm/when_submitting_explicit_inputs.d.ts.map +0 -1
  198. package/dist/esm/forms/for_SceneCommandForm/when_submitting_explicit_inputs.js +0 -176
  199. package/dist/esm/forms/for_SceneCommandForm/when_submitting_explicit_inputs.js.map +0 -1
  200. package/dist/esm/forms/for_SceneCommandForm/when_submitting_the_native_form.d.ts +0 -2
  201. package/dist/esm/forms/for_SceneCommandForm/when_submitting_the_native_form.d.ts.map +0 -1
  202. package/dist/esm/forms/for_SceneCommandForm/when_submitting_the_native_form.js +0 -110
  203. package/dist/esm/forms/for_SceneCommandForm/when_submitting_the_native_form.js.map +0 -1
  204. package/dist/esm/forms/for_SceneQueryInputForm/ProjectLookup.d.ts +0 -26
  205. package/dist/esm/forms/for_SceneQueryInputForm/ProjectLookup.d.ts.map +0 -1
  206. package/dist/esm/forms/for_SceneQueryInputForm/ProjectLookup.js +0 -44
  207. package/dist/esm/forms/for_SceneQueryInputForm/ProjectLookup.js.map +0 -1
  208. package/dist/esm/forms/for_SceneQueryInputForm/when_submitting_generated_guid_parameters.d.ts +0 -2
  209. package/dist/esm/forms/for_SceneQueryInputForm/when_submitting_generated_guid_parameters.d.ts.map +0 -1
  210. package/dist/esm/forms/for_SceneQueryInputForm/when_submitting_generated_guid_parameters.js +0 -175
  211. package/dist/esm/forms/for_SceneQueryInputForm/when_submitting_generated_guid_parameters.js.map +0 -1
  212. package/dist/esm/forms/for_SceneQueryInputForm/when_submitting_native_queries.d.ts +0 -2
  213. package/dist/esm/forms/for_SceneQueryInputForm/when_submitting_native_queries.d.ts.map +0 -1
  214. package/dist/esm/forms/for_SceneQueryInputForm/when_submitting_native_queries.js +0 -413
  215. package/dist/esm/forms/for_SceneQueryInputForm/when_submitting_native_queries.js.map +0 -1
  216. package/dist/esm/pages/for_ScenePage/when_rendering_a_page.d.ts +0 -2
  217. package/dist/esm/pages/for_ScenePage/when_rendering_a_page.d.ts.map +0 -1
  218. package/dist/esm/pages/for_ScenePage/when_rendering_a_page.js +0 -31
  219. package/dist/esm/pages/for_ScenePage/when_rendering_a_page.js.map +0 -1
  220. package/editors/for_SceneObjectNavigationalBar/when_navigating_back_up_the_trail.tsx +0 -24
  221. package/editors/for_filterDefinitions/when_reading_filter_definitions.ts +0 -49
  222. package/editors/for_timeMachineVersions/when_reading_versions.ts +0 -39
  223. package/for_cratisComponents/when_rendering_a_screen_through_the_real_renderer.tsx +0 -37
  224. package/for_cratisComponentsPackage/when_a_profile_ranks_it_above_the_packages_it_layers_on.ts +0 -49
  225. package/for_cratisComponentsPackage/when_declaring_command_form_peers.ts +0 -26
  226. package/for_cratisComponentsPackage/when_describing_query_arguments.ts +0 -15
  227. package/for_cratisComponentsPackage/when_describing_query_input_form.ts +0 -17
  228. package/for_cratisComponentsPackage/when_describing_single_result.ts +0 -20
  229. package/for_cratisComponentsPackage/when_resolving_its_dependencies.ts +0 -78
  230. package/for_cratisComponentsPackage/when_validating_the_bundle.ts +0 -39
  231. package/for_properties/when_a_property_has_the_wrong_type.ts +0 -41
  232. package/for_properties/when_a_property_is_missing.ts +0 -26
  233. package/for_properties/when_a_property_is_present.ts +0 -36
  234. package/forms/fields/for_CommandFormField/when_the_field_names_no_property.tsx +0 -16
  235. package/forms/fields/for_SceneRadioButtonField/when_mapping_the_group_name.tsx +0 -45
  236. package/forms/fields/for_resolveFieldBinding/when_resolving_a_field_binding.ts +0 -40
  237. package/forms/for_SceneCommandForm/given/RecordNote.ts +0 -37
  238. package/forms/for_SceneCommandForm/given/StartProject.ts +0 -41
  239. package/forms/for_SceneCommandForm/when_forwarding_to_the_lazy_runtime.tsx +0 -69
  240. package/forms/for_SceneCommandForm/when_native_custom_field_errors_block_submission.tsx +0 -33
  241. package/forms/for_SceneCommandForm/when_preserving_guid_error_ownership.tsx +0 -50
  242. package/forms/for_SceneCommandForm/when_rendering_submit_in_native_context.tsx +0 -56
  243. package/forms/for_SceneCommandForm/when_submitting_explicit_inputs.tsx +0 -189
  244. package/forms/for_SceneCommandForm/when_submitting_the_native_form.tsx +0 -120
  245. package/forms/for_SceneQueryInputForm/ProjectLookup.ts +0 -54
  246. package/forms/for_SceneQueryInputForm/when_submitting_generated_guid_parameters.tsx +0 -188
  247. package/forms/for_SceneQueryInputForm/when_submitting_native_queries.tsx +0 -423
  248. package/pages/for_ScenePage/when_rendering_a_page.tsx +0 -39
@@ -1,37 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import { expect } from 'chai';
5
- import { render, screen } from '@testing-library/react';
6
- import { ExternalComponent } from '@cratis/scene.model';
7
- import { SceneElementView } from '@cratis/scene.react';
8
- import { externalComponent } from '../given';
9
- import { cratisComponents } from '../cratisComponents';
10
- import { clearBindings } from '../bindings';
11
-
12
- function withContent(element: ExternalComponent, content: ExternalComponent[]): ExternalComponent {
13
- return { ...element, slots: { content } };
14
- }
15
-
16
- const invoices = withContent(externalComponent('Cratis.Components:page', { title: 'Invoices', showTitle: true }), [
17
- externalComponent('Cratis.Components:toolbar', {}),
18
- externalComponent('Cratis.Components:dataTable', { query: 'AllInvoices', emptyMessage: 'No invoices' }),
19
- ]);
20
-
21
- describe('when rendering a screen through the real renderer', () => {
22
- beforeEach(() => {
23
- clearBindings();
24
- render(<SceneElementView element={invoices} registry={cratisComponents} resolveBinding={() => undefined} />);
25
- });
26
-
27
- afterEach(() => clearBindings());
28
-
29
- it('should resolve every component name against this package registry', () =>
30
- expect(screen.getByRole('heading', { name: 'Invoices' })).to.exist);
31
-
32
- it('should render the unbound table as a placeholder', () =>
33
- expect(screen.getByText("Unresolved query binding 'AllInvoices' on Cratis.Components:dataTable")).to.exist);
34
-
35
- it('should render no unresolved-component fallback', () =>
36
- (document.querySelector('[data-scene-unresolved-component]') === null).should.be.true);
37
- });
@@ -1,49 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import { UiProfile } from '@cratis/scene.model';
5
- import { PackageCatalog, resolveComponentName } from '@cratis/scene.engine';
6
- import { cratisComponentsPackageManifest } from '../cratisComponentsPackage';
7
-
8
- const profile: UiProfile = { name: 'test', targetPlatform: 'web', packages: ['core', 'PrimeReact', 'Cratis.Components'] };
9
-
10
- const catalog: PackageCatalog = {
11
- core: ['text', 'button', 'card'],
12
- PrimeReact: ['button', 'table', 'dialog'],
13
- 'Cratis.Components': cratisComponentsPackageManifest.components,
14
- };
15
-
16
- describe('when a profile ranks it above the packages it layers on', () => {
17
- describe('and it declares a name PrimeReact also declares', () => {
18
- const resolution = resolveComponentName('table', profile, catalog)!;
19
-
20
- it('should resolve to this package', () => resolution.package.should.equal('Cratis.Components'));
21
- it('should record PrimeReact as shadowed rather than discarding it', () => resolution.shadows.should.deep.equal(['PrimeReact']));
22
- });
23
-
24
- describe('and it declares the dialog name PrimeReact also declares', () => {
25
- const resolution = resolveComponentName('dialog', profile, catalog)!;
26
-
27
- it('should resolve to the Arc-aware dialog rather than the bare PrimeReact one', () => resolution.package.should.equal('Cratis.Components'));
28
- it('should record PrimeReact as shadowed', () => resolution.shadows.should.deep.equal(['PrimeReact']));
29
- });
30
-
31
- describe('and it declares a name nothing else does', () => {
32
- const resolution = resolveComponentName('dataPage', profile, catalog)!;
33
-
34
- it('should resolve to this package', () => resolution.package.should.equal('Cratis.Components'));
35
- it('should shadow nothing', () => resolution.shadows.should.deep.equal([]));
36
- });
37
-
38
- describe('and a name it does not declare is asked for', () => {
39
- const resolution = resolveComponentName('card', profile, catalog)!;
40
-
41
- it('should fall through to the highest-priority package that does', () => resolution.package.should.equal('core'));
42
- });
43
-
44
- describe('and a screen qualifies the name with the package explicitly', () => {
45
- const resolution = resolveComponentName('PrimeReact.table', profile, catalog)!;
46
-
47
- it('should resolve to the named package even though this one outranks it', () => resolution.package.should.equal('PrimeReact'));
48
- });
49
- });
@@ -1,26 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import { readFileSync } from 'node:fs';
5
- import { expect } from 'vitest';
6
-
7
- // The workspace test command runs from this package root; do not rely on Vite's virtual import.meta.url.
8
- const packageJson = JSON.parse(readFileSync('package.json', 'utf8')) as {
9
- name: string;
10
- peerDependencies: Record<string, string>;
11
- peerDependenciesMeta: Record<string, { optional?: boolean }>;
12
- };
13
-
14
- describe('when declaring native command form peers', () => {
15
- it('requires the published footer and native custom-error execution contracts', () => {
16
- expect(packageJson.name).toBe('@cratis/scene.components');
17
- expect(packageJson.peerDependencies['@cratis/components']).toBe('^4.13.0');
18
- expect(packageJson.peerDependencies['@cratis/arc']).toBe('^22.19.1');
19
- expect(packageJson.peerDependencies['@cratis/arc.react']).toBe('^22.19.1');
20
- });
21
-
22
- it('keeps Arc optional for an unbound design-time preview', () => {
23
- expect(packageJson.peerDependenciesMeta['@cratis/arc'].optional).toBe(true);
24
- expect(packageJson.peerDependenciesMeta['@cratis/arc.react'].optional).toBe(true);
25
- });
26
- });
@@ -1,15 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import { cratisComponentsPackageManifest } from '../cratisComponentsPackage';
5
-
6
- describe('when describing query arguments', () => {
7
- it('should keep both collection table names in the manifest', () => {
8
- cratisComponentsPackageManifest.components.should.include('dataTable');
9
- cratisComponentsPackageManifest.components.should.include('table');
10
- });
11
-
12
- it('should describe the optional object property without promising single-result support', () => {
13
- (cratisComponentsPackageManifest.description ?? '').should.contain('dataTable and table accept optional object-valued queryArguments for collection queries');
14
- });
15
- });
@@ -1,17 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import { expect } from 'vitest';
5
- import { SceneQueryInputForm, cratisComponents, cratisComponentsPackageManifest, registerQueryIdentity, resolveExactQuery, type QueryInput } from '../index';
6
-
7
- describe('when describing the query input form public API', () => {
8
- it('exports and registers the component advertised by the manifest', () => {
9
- expect(cratisComponentsPackageManifest.components).toContain('queryInputForm');
10
- expect(cratisComponents['Cratis.Components:queryInputForm']).toBe(SceneQueryInputForm);
11
- expect(cratisComponentsPackageManifest.description).toContain('commits explicit string inputs on submit');
12
- expect(registerQueryIdentity).toBeTypeOf('function');
13
- expect(resolveExactQuery).toBeTypeOf('function');
14
- const input: QueryInput = { parameter: 'projectId', type: 'string', label: 'Project identifier' };
15
- expect(input.type).toBe('string');
16
- });
17
- });
@@ -1,20 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import { expect } from 'vitest';
5
- import { componentRegistryKey } from '@cratis/scene.react';
6
- import { cratisComponents, cratisComponentsPackageName } from '../cratisComponents';
7
- import { cratisComponentsPackageManifest } from '../cratisComponentsPackage';
8
- import { SceneSingleResult } from '../data/SceneSingleResult';
9
-
10
- describe('when describing the single result view', () => {
11
- it('registers the same component advertised by the manifest', () => {
12
- expect(cratisComponentsPackageManifest.components).toContain('singleResult');
13
- expect(cratisComponents[componentRegistryKey(cratisComponentsPackageName, 'singleResult')]).toBe(SceneSingleResult);
14
- });
15
-
16
- it('describes an explicitly enabled read-only own-field capability', () => {
17
- expect(cratisComponentsPackageManifest.description).toContain('read-only scalar own resultField');
18
- expect(cratisComponentsPackageManifest.description).toContain('enabled: true');
19
- });
20
- });
@@ -1,78 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import { PackageKind, ScenePackage } from '@cratis/scene.model';
5
- import { isPackageSelectionValid, resolvePackageDependencies } from '@cratis/scene.engine';
6
- import { cratisComponentsPackageManifest } from '../cratisComponentsPackage';
7
-
8
- /**
9
- * A styling package declaring nothing but itself - enough for `Cratis.Components` to depend on, and no
10
- * more, so this spec fails only when *this* package's declaration is wrong.
11
- */
12
- const tailwind: ScenePackage = {
13
- name: 'Tailwind',
14
- version: '4.3.3',
15
- kind: PackageKind.Styling,
16
- dependencies: [],
17
- components: [],
18
- layouts: [],
19
- screenTemplates: [],
20
- dialogTemplates: [],
21
- themes: [],
22
- };
23
-
24
- /**
25
- * The base component library `Cratis.Components` wraps, at the version this repository pins.
26
- *
27
- * The theme names are drawn from the catalog PrimeReact 11 actually has. Version 11 ships no theme
28
- * stylesheets at all - a look is a `@primeuix/themes` preset applied at runtime - and the catalog was
29
- * rebuilt on those presets, so names read `<family>-<light|dark>-<accent>` across the Aura, Lara and Nora
30
- * families. Several version 10 names (`saga-*`, `vela-*`, `soho-*`, `nano`, `mira` and the rest) have no
31
- * preset behind them any more and are simply gone; the Lara pair below survived the rebuild, and an Aura
32
- * pair is listed alongside them so the stub is visibly the version 11 catalog rather than a version 10
33
- * remnant that happens to still be valid.
34
- */
35
- const primeReact: ScenePackage = {
36
- name: 'PrimeReact',
37
- version: '11.1.0',
38
- kind: PackageKind.ComponentLibrary,
39
- dependencies: [{ name: 'Tailwind' }],
40
- components: ['button', 'table', 'dialog'],
41
- layouts: [],
42
- screenTemplates: [],
43
- dialogTemplates: [],
44
- themes: ['aura-light-blue', 'aura-dark-blue', 'lara-light-blue', 'lara-dark-blue'],
45
- };
46
-
47
- describe('when resolving its dependencies', () => {
48
- const catalog = [tailwind, primeReact, cratisComponentsPackageManifest];
49
- const selection = resolvePackageDependencies(['Cratis.Components'], catalog);
50
-
51
- it('should order every package it depends on before it', () =>
52
- selection.packages.should.deep.equal(['Tailwind', 'PrimeReact', 'Cratis.Components']));
53
-
54
- it('should report the packages it pulls in on the caller behalf', () => selection.added.should.deep.equal(['Tailwind', 'PrimeReact']));
55
- it('should report nothing missing', () => selection.missing.should.deep.equal([]));
56
- it('should report no version conflict', () => selection.versionConflicts.should.deep.equal([]));
57
- it('should report no cycle', () => selection.cycles.should.deep.equal([]));
58
- it('should be a valid selection', () => isPackageSelectionValid(selection).should.be.true);
59
-
60
- describe('and neither dependency is in the catalog', () => {
61
- const withoutDependencies = resolvePackageDependencies(['Cratis.Components'], [cratisComponentsPackageManifest]);
62
-
63
- it('should report both as missing rather than silently ordering around them', () =>
64
- withoutDependencies.missing.should.deep.equal([
65
- { package: 'Cratis.Components', dependsOn: 'PrimeReact' },
66
- { package: 'Cratis.Components', dependsOn: 'Tailwind' },
67
- ]));
68
- });
69
-
70
- describe('and PrimeReact is older than the major version the library is built against', () => {
71
- const older = resolvePackageDependencies(['Cratis.Components'], [tailwind, { ...primeReact, version: '10.9.8' }, cratisComponentsPackageManifest]);
72
-
73
- it('should report the version conflict', () =>
74
- older.versionConflicts.should.deep.equal([
75
- { package: 'Cratis.Components', dependsOn: 'PrimeReact', requiredRange: '>=11.0.0', actualVersion: '10.9.8' },
76
- ]));
77
- });
78
- });
@@ -1,39 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import { componentRegistryKey, validatePackageBundle } from '@cratis/scene.react';
5
- import { cratisComponentsPackage, cratisComponentsPackageManifest } from '../cratisComponentsPackage';
6
- import { cratisComponentsPackageName } from '../cratisComponents';
7
-
8
- describe('when validating the bundle', () => {
9
- const problems = validatePackageBundle(cratisComponentsPackage);
10
-
11
- it('should report no problems', () => problems.should.deep.equal([]));
12
-
13
- it('should register an implementation for every declared component', () => {
14
- const missing = cratisComponentsPackageManifest.components.filter(
15
- name => !(componentRegistryKey(cratisComponentsPackageName, name) in cratisComponentsPackage.components)
16
- );
17
- missing.should.deep.equal([]);
18
- });
19
-
20
- it('should key every registration under this package name', () => {
21
- const foreign = Object.keys(cratisComponentsPackage.components).filter(key => !key.startsWith(`${cratisComponentsPackageName}:`));
22
- foreign.should.deep.equal([]);
23
- });
24
-
25
- it('should declare every registered component', () => {
26
- const declared = new Set(cratisComponentsPackageManifest.components);
27
- const undeclared = Object.keys(cratisComponentsPackage.components).filter(
28
- key => !declared.has(key.slice(`${cratisComponentsPackageName}:`.length))
29
- );
30
- undeclared.should.deep.equal([]);
31
- });
32
-
33
- it('should declare no layouts, screen templates, dialog templates or themes', () => {
34
- cratisComponentsPackageManifest.layouts.should.deep.equal([]);
35
- cratisComponentsPackageManifest.screenTemplates.should.deep.equal([]);
36
- cratisComponentsPackageManifest.dialogTemplates.should.deep.equal([]);
37
- cratisComponentsPackageManifest.themes.should.deep.equal([]);
38
- });
39
- });
@@ -1,41 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import {
5
- arrayProperty,
6
- booleanProperty,
7
- numberProperty,
8
- objectArrayProperty,
9
- objectProperty,
10
- stringArrayProperty,
11
- stringProperty,
12
- unionProperty,
13
- } from '../properties';
14
-
15
- describe('when a property has the wrong type', () => {
16
- const properties: Record<string, unknown> = {
17
- title: 42,
18
- panel: 'yes',
19
- rows: 'ten',
20
- notANumber: Number.NaN,
21
- options: 'first,second',
22
- schema: ['not', 'an', 'object'],
23
- orientation: 'diagonal',
24
- fields: ['name', 7, 'number'],
25
- entries: [{ key: 'a' }, 'not an object'],
26
- };
27
-
28
- it('should not read a number as a string', () => (stringProperty(properties, 'title') === undefined).should.be.true);
29
- it('should not read a string as a boolean', () => (booleanProperty(properties, 'panel') === undefined).should.be.true);
30
- it('should not read a string as a number', () => (numberProperty(properties, 'rows') === undefined).should.be.true);
31
- it('should not read NaN as a number', () => (numberProperty(properties, 'notANumber') === undefined).should.be.true);
32
- it('should not read a string as an array', () => (arrayProperty(properties, 'options') === undefined).should.be.true);
33
- it('should not read an array as an object', () => (objectProperty(properties, 'schema') === undefined).should.be.true);
34
-
35
- it('should reject a value outside the allowed union', () =>
36
- (unionProperty(properties, 'orientation', ['vertical', 'horizontal']) === undefined).should.be.true);
37
-
38
- it('should keep only the string elements of a string array', () => stringArrayProperty(properties, 'fields')!.should.deep.equal(['name', 'number']));
39
-
40
- it('should keep only the object elements of an object array', () => objectArrayProperty(properties, 'entries')!.should.deep.equal([{ key: 'a' }]));
41
- });
@@ -1,26 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import {
5
- arrayProperty,
6
- booleanProperty,
7
- numberProperty,
8
- objectArrayProperty,
9
- objectProperty,
10
- stringArrayProperty,
11
- stringProperty,
12
- unionProperty,
13
- } from '../properties';
14
-
15
- describe('when a property is missing', () => {
16
- const properties: Record<string, unknown> = {};
17
-
18
- it('should read no string', () => (stringProperty(properties, 'title') === undefined).should.be.true);
19
- it('should read no boolean', () => (booleanProperty(properties, 'panel') === undefined).should.be.true);
20
- it('should read no number', () => (numberProperty(properties, 'rows') === undefined).should.be.true);
21
- it('should read no array', () => (arrayProperty(properties, 'options') === undefined).should.be.true);
22
- it('should read no string array', () => (stringArrayProperty(properties, 'fields') === undefined).should.be.true);
23
- it('should read no object array', () => (objectArrayProperty(properties, 'options') === undefined).should.be.true);
24
- it('should read no object', () => (objectProperty(properties, 'schema') === undefined).should.be.true);
25
- it('should read no union value', () => (unionProperty(properties, 'orientation', ['vertical', 'horizontal']) === undefined).should.be.true);
26
- });
@@ -1,36 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import {
5
- arrayProperty,
6
- booleanProperty,
7
- numberProperty,
8
- objectArrayProperty,
9
- objectProperty,
10
- stringArrayProperty,
11
- stringProperty,
12
- unionProperty,
13
- } from '../properties';
14
-
15
- describe('when a property is present', () => {
16
- const properties: Record<string, unknown> = {
17
- title: 'Invoices',
18
- panel: false,
19
- rows: 0,
20
- options: [{ label: 'Draft', value: 'draft' }],
21
- fields: ['number', 'customer'],
22
- schema: { type: 'object' },
23
- orientation: 'vertical',
24
- };
25
-
26
- it('should read the string', () => stringProperty(properties, 'title')!.should.equal('Invoices'));
27
- it('should read a false boolean rather than treating it as absent', () => booleanProperty(properties, 'panel')!.should.equal(false));
28
- it('should read a zero number rather than treating it as absent', () => numberProperty(properties, 'rows')!.should.equal(0));
29
- it('should read the array', () => arrayProperty(properties, 'options')!.should.have.lengthOf(1));
30
- it('should read the string array', () => stringArrayProperty(properties, 'fields')!.should.deep.equal(['number', 'customer']));
31
- it('should read the object array', () => objectArrayProperty(properties, 'options')!.should.deep.equal([{ label: 'Draft', value: 'draft' }]));
32
- it('should read the object', () => objectProperty(properties, 'schema')!.should.deep.equal({ type: 'object' }));
33
-
34
- it('should read a value that is in the allowed union', () =>
35
- unionProperty(properties, 'orientation', ['vertical', 'horizontal'])!.should.equal('vertical'));
36
- });
@@ -1,16 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import { expect } from 'chai';
5
- import { render, screen } from '@testing-library/react';
6
- import { externalComponent } from '../../../given';
7
- import { SceneInputTextField } from '../SceneInputTextField';
8
-
9
- describe('when the field names no property', () => {
10
- beforeEach(() => {
11
- render(<SceneInputTextField element={externalComponent('Cratis.Components:inputTextField', { title: 'Customer' })} slots={{}} />);
12
- });
13
-
14
- it('should render a placeholder rather than a field bound to nothing', () =>
15
- expect(screen.getByText("Missing 'property' on Cratis.Components:inputTextField")).to.exist);
16
- });
@@ -1,45 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import { act, cleanup, render, screen } from '@testing-library/react';
5
- import { expect, vi } from 'vitest';
6
- import { externalComponent } from '../../../given';
7
-
8
- // The public Components radio props require a native group name independently of the display title.
9
- describe('when mapping the radio group name', () => {
10
- const received = vi.fn<(props: { name: string; title: string; value: (instance: Record<string, unknown>) => unknown }) => void>();
11
- let SceneRadioButtonField: typeof import('../SceneRadioButtonField').SceneRadioButtonField;
12
-
13
- beforeEach(async () => {
14
- vi.resetModules();
15
- received.mockClear();
16
- vi.doMock('@cratis/components/CommandForm', () => ({
17
- RadioButtonField: (props: Parameters<typeof received>[0]) => { received(props); return <input type='radio' name={props.name} />; },
18
- }));
19
- ({ SceneRadioButtonField } = await import('../SceneRadioButtonField'));
20
- });
21
-
22
- afterEach(() => {
23
- cleanup();
24
- vi.doUnmock('@cratis/components/CommandForm');
25
- vi.resetModules();
26
- });
27
-
28
- it('should group options by the explicit property, regardless of titles or labels', async () => {
29
- await act(async () => {
30
- render(<>{['First title', 'Second title'].map((title, index) => <SceneRadioButtonField key={title} element={externalComponent('Cratis.Components:radioButtonField', { property: 'choice', title, label: 'Display label', buttonValue: index })} slots={{}} />)}</>);
31
- });
32
- expect(screen.getAllByRole('radio').map(radio => radio.getAttribute('name'))).toEqual(['choice', 'choice']);
33
- expect(received.mock.calls.map(([props]) => props.value({ choice: 2 }))).toEqual([2, 2]);
34
- });
35
-
36
- for (const property of [undefined, 42, null, {}, []]) {
37
- it(`should visibly reject malformed property ${JSON.stringify(property)} instead of using the title`, async () => {
38
- await act(async () => {
39
- render(<SceneRadioButtonField element={externalComponent('Cratis.Components:radioButtonField', { property, title: 'Not a binding' })} slots={{}} />);
40
- });
41
- expect(screen.getByText("Missing 'property' on Cratis.Components:radioButtonField")).toBeTruthy();
42
- expect(received).not.toHaveBeenCalled();
43
- });
44
- }
45
- });
@@ -1,40 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import { externalComponent } from '../../../given';
5
- import { resolveFieldBinding } from '../resolveFieldBinding';
6
- import type { FieldBinding } from '../FieldBinding';
7
-
8
- describe('when resolving a field binding', () => {
9
- it('should preserve manually constructed field bindings without a native group name', () => {
10
- const binding: FieldBinding = { value: instance => instance.customerName, title: 'Customer' };
11
- binding.value({ customerName: 'Acme' })!.should.equal('Acme');
12
- });
13
-
14
- describe('and the element names a property with a title and description', () => {
15
- const binding = resolveFieldBinding(
16
- externalComponent('Cratis.Components:inputTextField', {
17
- property: 'customerName',
18
- title: 'Customer',
19
- description: 'Who the invoice is for',
20
- })
21
- )!;
22
-
23
- it('should read the named property off the command instance', () => binding.value({ customerName: 'Acme' })!.should.equal('Acme'));
24
- it('should use the declared title', () => binding.title.should.equal('Customer'));
25
- it('should carry the description', () => binding.description!.should.equal('Who the invoice is for'));
26
- });
27
-
28
- describe('and the element names only a property', () => {
29
- const binding = resolveFieldBinding(externalComponent('Cratis.Components:inputTextField', { property: 'customerName' }))!;
30
-
31
- it('should fall back to the property name as the title', () => binding.title.should.equal('customerName'));
32
- it('should carry no description', () => (binding.description === undefined).should.be.true);
33
- });
34
-
35
- describe('and the element names no property', () => {
36
- const binding = resolveFieldBinding(externalComponent('Cratis.Components:inputTextField', { title: 'Customer' }));
37
-
38
- it('should resolve to nothing rather than an accessor that reads nothing', () => (binding === undefined).should.be.true);
39
- });
40
- });
@@ -1,37 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import { Command, CommandValidator } from '@cratis/arc/commands';
5
- import { PropertyDescriptor } from '@cratis/arc/reflection';
6
-
7
- class NoteValidator extends CommandValidator<{ subject: string }> {
8
- constructor() {
9
- super();
10
- this.ruleFor(command => command.subject).notEmpty().withMessage('Subject is required');
11
- }
12
- }
13
-
14
- /** Synthetic proxy: execution, serialization and validation are all native Arc. */
15
- export class RecordNote extends Command {
16
- readonly route: string = '/synthetic/notes';
17
- readonly propertyDescriptors = [
18
- new PropertyDescriptor('subject', String),
19
- new PropertyDescriptor('internalValue', String, true),
20
- ];
21
- readonly requestParameters = [];
22
- readonly validation = new NoteValidator();
23
- subject = '';
24
- internalValue = 'proxy default';
25
- constructor() { super(Object, false); }
26
- }
27
-
28
- export class RestrictedNote extends RecordNote {
29
- readonly roles = ['note-writer'];
30
- }
31
-
32
- export function successfulResponse() {
33
- return { status: 200, json: async () => ({
34
- isSuccess: true, isAuthorized: true, isValid: true, hasExceptions: false,
35
- validationResults: [], exceptionMessages: [], exceptionStackTrace: '', response: {},
36
- }) } as Response;
37
- }
@@ -1,41 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import { Command, CommandValidator } from '@cratis/arc/commands';
5
- import { PropertyDescriptor } from '@cratis/arc/reflection';
6
- import { Guid } from '@cratis/fundamentals';
7
-
8
- class ProjectValidator extends CommandValidator<{ name: string }> {
9
- constructor() {
10
- super();
11
- this.ruleFor(command => command.name).notEmpty().withMessage('Name is required');
12
- }
13
- }
14
-
15
- /** Generated-shape proxy: native execution and serialization, only fetch is substituted. */
16
- export class StartProject extends Command {
17
- readonly route: string = '/synthetic/projects';
18
- readonly propertyDescriptors = [new PropertyDescriptor('projectId', Guid), new PropertyDescriptor('name', String)];
19
- readonly requestParameters = [];
20
- readonly validation = new ProjectValidator();
21
- projectId: Guid = Guid.empty;
22
- name = '';
23
- constructor() { super(Object, false); }
24
- }
25
-
26
- export class RestrictedProject extends StartProject {
27
- readonly roles = ['project-writer'];
28
- }
29
-
30
- export class OptionalUnsupported extends StartProject {
31
- readonly propertyDescriptors = [new PropertyDescriptor('projectId', Guid), new PropertyDescriptor('name', String), new PropertyDescriptor('details', Object, true)];
32
- details?: object;
33
- }
34
-
35
- export class RequiredUnsupported extends OptionalUnsupported {
36
- readonly propertyDescriptors = [new PropertyDescriptor('projectId', Guid), new PropertyDescriptor('name', String), new PropertyDescriptor('details', Object)];
37
- }
38
-
39
- export class AmbiguousProject extends StartProject {
40
- readonly propertyDescriptors = [new PropertyDescriptor('projectId', Guid), new PropertyDescriptor('name', String), new PropertyDescriptor('projectId', Guid)];
41
- }