@rebasepro/cms 0.30.0 → 0.31.0-canary.g902a0ce

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 (583) hide show
  1. package/README.md +8 -8
  2. package/dist/collection_editor/ConfigControllerProvider.js +25 -22
  3. package/dist/collection_editor/ConfigControllerProvider.js.map +1 -1
  4. package/dist/collection_editor/firestore_callee.d.ts +10 -0
  5. package/dist/collection_editor/firestore_callee.js +15 -0
  6. package/dist/collection_editor/firestore_callee.js.map +1 -0
  7. package/dist/collection_editor/firestore_edit.d.ts +62 -0
  8. package/dist/collection_editor/firestore_edit.js +339 -0
  9. package/dist/collection_editor/firestore_edit.js.map +1 -0
  10. package/dist/collection_editor/index.d.ts +2 -3
  11. package/dist/collection_editor/liveSchemaClient.d.ts +44 -22
  12. package/dist/collection_editor/liveSchemaClient.js +9 -3
  13. package/dist/collection_editor/liveSchemaClient.js.map +1 -1
  14. package/dist/collection_editor/property_column.d.ts +86 -0
  15. package/dist/collection_editor/property_column.js +719 -0
  16. package/dist/collection_editor/property_column.js.map +1 -0
  17. package/dist/collection_editor/serializable_types.d.ts +2 -24
  18. package/dist/collection_editor/serializable_utils.d.ts +1 -1
  19. package/dist/collection_editor/serializable_utils.js +2 -1
  20. package/dist/collection_editor/serializable_utils.js.map +1 -1
  21. package/dist/collection_editor/split_edit.d.ts +106 -0
  22. package/dist/collection_editor/split_edit.js +564 -0
  23. package/dist/collection_editor/split_edit.js.map +1 -0
  24. package/dist/collection_editor/split_edit_error.d.ts +25 -0
  25. package/dist/collection_editor/split_edit_error.js +35 -0
  26. package/dist/collection_editor/split_edit_error.js.map +1 -0
  27. package/dist/collection_editor/types/collection_editor_controller.d.ts +1 -1
  28. package/dist/collection_editor/types/config_controller.d.ts +67 -1
  29. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +6 -5
  30. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js +44 -12
  31. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js.map +1 -1
  32. package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js +18 -3
  33. package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js.map +1 -1
  34. package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js +94 -55
  35. package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js.map +1 -1
  36. package/dist/collection_editor/ui/collection_editor/CollectionRelationsTab.d.ts +2 -1
  37. package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js.map +1 -1
  38. package/dist/collection_editor/ui/collection_editor/EnumForm.d.ts +1 -1
  39. package/dist/collection_editor/ui/collection_editor/EnumForm.js.map +1 -1
  40. package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js +3 -3
  41. package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js.map +1 -1
  42. package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js.map +1 -1
  43. package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +2 -3
  44. package/dist/collection_editor/ui/collection_editor/PropertyEditView.js +1 -1
  45. package/dist/collection_editor/ui/collection_editor/PropertyEditView.js.map +1 -1
  46. package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.d.ts +1 -1
  47. package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js +1 -1
  48. package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js.map +1 -1
  49. package/dist/collection_editor/ui/collection_editor/PropertyTree.d.ts +7 -4
  50. package/dist/collection_editor/ui/collection_editor/PropertyTree.js +15 -5
  51. package/dist/collection_editor/ui/collection_editor/PropertyTree.js.map +1 -1
  52. package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js +1 -1
  53. package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js.map +1 -1
  54. package/dist/collection_editor/ui/collection_editor/SchemaEditRefusalView.d.ts +20 -0
  55. package/dist/collection_editor/ui/collection_editor/SchemaEditRefusalView.js +74 -0
  56. package/dist/collection_editor/ui/collection_editor/SchemaEditRefusalView.js.map +1 -0
  57. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.d.ts +1 -1
  58. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -1
  59. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js.map +1 -1
  60. package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +1 -1
  61. package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js.map +1 -1
  62. package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js.map +1 -1
  63. package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js.map +1 -1
  64. package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js +1 -1
  65. package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js.map +1 -1
  66. package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js.map +1 -1
  67. package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js.map +1 -1
  68. package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js.map +1 -1
  69. package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js.map +1 -1
  70. package/dist/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.d.ts +1 -1
  71. package/dist/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.d.ts +1 -1
  72. package/dist/collection_editor/ui/collection_editor/properties/conditions/property_paths.d.ts +1 -1
  73. package/dist/collection_editor/ui/collection_editor/rlsRuleForm.d.ts +34 -0
  74. package/dist/collection_editor/ui/collection_editor/rlsRuleForm.js +50 -0
  75. package/dist/collection_editor/ui/collection_editor/rlsRuleForm.js.map +1 -0
  76. package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.d.ts +1 -2
  77. package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js.map +1 -1
  78. package/dist/collection_editor/useDetachRulesConfirmation.d.ts +16 -0
  79. package/dist/collection_editor/useDetachRulesConfirmation.js +48 -0
  80. package/dist/collection_editor/useDetachRulesConfirmation.js.map +1 -0
  81. package/dist/collection_editor/useLiveSchemaEditing.d.ts +2 -2
  82. package/dist/collection_editor/useLiveSchemaEditing.js +1 -1
  83. package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -1
  84. package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +54 -10
  85. package/dist/collection_editor/useLocalCollectionsConfigController.js +394 -122
  86. package/dist/collection_editor/useLocalCollectionsConfigController.js.map +1 -1
  87. package/dist/collection_editor/validateCollectionJson.js.map +1 -1
  88. package/dist/components/CollectionPanel.d.ts +10 -9
  89. package/dist/components/CollectionPanel.js +5 -2
  90. package/dist/components/CollectionPanel.js.map +1 -1
  91. package/dist/components/CollectionTableBinding/CollectionRowActions.d.ts +1 -2
  92. package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -1
  93. package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -1
  94. package/dist/components/CollectionTableBinding/CollectionTableBindingProps.d.ts +3 -5
  95. package/dist/components/CollectionTableBinding/PropertyTableCell.d.ts +2 -2
  96. package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -1
  97. package/dist/components/CollectionTableBinding/column_utils.d.ts +1 -1
  98. package/dist/components/CollectionTableBinding/column_utils.js.map +1 -1
  99. package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.d.ts +2 -2
  100. package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +1 -2
  101. package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -1
  102. package/dist/components/CollectionTableBinding/fields/TableReferenceField.d.ts +2 -2
  103. package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +2 -2
  104. package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -1
  105. package/dist/components/CollectionTableBinding/fields/TableRelationField.d.ts +2 -2
  106. package/dist/components/CollectionTableBinding/fields/TableRelationField.js +1 -2
  107. package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -1
  108. package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.d.ts +2 -1
  109. package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js.map +1 -1
  110. package/dist/components/CollectionTableBinding/fields/TableStorageUpload.d.ts +2 -2
  111. package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js.map +1 -1
  112. package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.d.ts +1 -1
  113. package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js +1 -1
  114. package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js.map +1 -1
  115. package/dist/components/CollectionTableBinding/internal/common.d.ts +1 -2
  116. package/dist/components/CollectionTableBinding/internal/common.js.map +1 -1
  117. package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.d.ts +1 -1
  118. package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +2 -2
  119. package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -1
  120. package/dist/components/CollectionTableBinding/table_bindings.d.ts +2 -2
  121. package/dist/components/CollectionTableBinding/table_bindings.js.map +1 -1
  122. package/dist/components/CollectionViewBinding/BoardCardBinding.d.ts +1 -1
  123. package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -1
  124. package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.d.ts +1 -2
  125. package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +9 -5
  126. package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -1
  127. package/dist/components/CollectionViewBinding/CollectionCardViewBinding.d.ts +1 -2
  128. package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -1
  129. package/dist/components/CollectionViewBinding/CollectionEntityActions.d.ts +1 -1
  130. package/dist/components/CollectionViewBinding/CollectionEntityActions.js.map +1 -1
  131. package/dist/components/CollectionViewBinding/CollectionListViewBinding.d.ts +1 -2
  132. package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +1 -1
  133. package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -1
  134. package/dist/components/CollectionViewBinding/CollectionToolbar.js +1 -1
  135. package/dist/components/CollectionViewBinding/CollectionToolbar.js.map +1 -1
  136. package/dist/components/CollectionViewBinding/CollectionViewActions.js +2 -4
  137. package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -1
  138. package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +6 -6
  139. package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -1
  140. package/dist/components/CollectionViewBinding/CollectionViewContent.js +1 -2
  141. package/dist/components/CollectionViewBinding/CollectionViewContent.js.map +1 -1
  142. package/dist/components/CollectionViewBinding/CollectionViewStartActions.d.ts +1 -1
  143. package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -1
  144. package/dist/components/CollectionViewBinding/CustomViewHost.d.ts +1 -2
  145. package/dist/components/CollectionViewBinding/CustomViewHost.js.map +1 -1
  146. package/dist/components/CollectionViewBinding/EntitiesCount.js +3 -3
  147. package/dist/components/CollectionViewBinding/EntitiesCount.js.map +1 -1
  148. package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +1 -2
  149. package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -1
  150. package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js +1 -1
  151. package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js.map +1 -1
  152. package/dist/components/CollectionViewBinding/FilterPresetsButton.d.ts +1 -2
  153. package/dist/components/CollectionViewBinding/FilterPresetsButton.js +1 -1
  154. package/dist/components/CollectionViewBinding/FilterPresetsButton.js.map +1 -1
  155. package/dist/components/CollectionViewBinding/FiltersButton.d.ts +1 -2
  156. package/dist/components/CollectionViewBinding/FiltersButton.js.map +1 -1
  157. package/dist/components/CollectionViewBinding/FiltersDialog.d.ts +1 -1
  158. package/dist/components/CollectionViewBinding/FiltersDialog.js.map +1 -1
  159. package/dist/components/CollectionViewBinding/PluginColumnSlots.d.ts +1 -2
  160. package/dist/components/CollectionViewBinding/PluginColumnSlots.js.map +1 -1
  161. package/dist/components/CollectionViewBinding/RowActions.d.ts +1 -2
  162. package/dist/components/CollectionViewBinding/RowActions.js.map +1 -1
  163. package/dist/components/CollectionViewBinding/SortButton.d.ts +1 -1
  164. package/dist/components/CollectionViewBinding/SortButton.js.map +1 -1
  165. package/dist/components/CollectionViewBinding/SplitListView.d.ts +1 -2
  166. package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -1
  167. package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.d.ts +1 -2
  168. package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js +1 -1
  169. package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js.map +1 -1
  170. package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.d.ts +1 -2
  171. package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js.map +1 -1
  172. package/dist/components/CollectionViewBinding/useBoardDataController.d.ts +2 -1
  173. package/dist/components/CollectionViewBinding/useBoardDataController.js +3 -3
  174. package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -1
  175. package/dist/components/CollectionViewBinding/useCollectionViewState.d.ts +2 -4
  176. package/dist/components/CollectionViewBinding/useCollectionViewState.js +14 -19
  177. package/dist/components/CollectionViewBinding/useCollectionViewState.js.map +1 -1
  178. package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +1 -3
  179. package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -1
  180. package/dist/components/CollectionViewBinding/useSelectionController.d.ts +1 -2
  181. package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -1
  182. package/dist/components/CollectionsProvider.d.ts +23 -8
  183. package/dist/components/CollectionsProvider.js +23 -7
  184. package/dist/components/CollectionsProvider.js.map +1 -1
  185. package/dist/components/DefaultDrawer.js +1 -1
  186. package/dist/components/DeleteEntityDialog.d.ts +1 -1
  187. package/dist/components/DeleteEntityDialog.js +1 -1
  188. package/dist/components/DeleteEntityDialog.js.map +1 -1
  189. package/dist/components/DetailViewBinding.js +3 -3
  190. package/dist/components/DetailViewBinding.js.map +1 -1
  191. package/dist/components/EditFormActions.js.map +1 -1
  192. package/dist/components/EditViewBinding.d.ts +2 -1
  193. package/dist/components/EditViewBinding.js +6 -6
  194. package/dist/components/EditViewBinding.js.map +1 -1
  195. package/dist/components/EntityDisplayHeader.d.ts +1 -2
  196. package/dist/components/EntityDisplayHeader.js.map +1 -1
  197. package/dist/components/EntityInspector.d.ts +1 -2
  198. package/dist/components/EntityInspector.js.map +1 -1
  199. package/dist/components/EntityPreviewBinding.d.ts +1 -1
  200. package/dist/components/EntityPreviewBinding.js +1 -1
  201. package/dist/components/EntityPreviewBinding.js.map +1 -1
  202. package/dist/components/EntityViewBinding.d.ts +1 -1
  203. package/dist/components/EntityViewBinding.js.map +1 -1
  204. package/dist/components/EntityViewBody.d.ts +1 -1
  205. package/dist/components/EntityViewBody.js +3 -4
  206. package/dist/components/EntityViewBody.js.map +1 -1
  207. package/dist/components/FieldValue.js +2 -2
  208. package/dist/components/FieldValue.js.map +1 -1
  209. package/dist/components/HomePage/ContentHomePage.js +12 -3
  210. package/dist/components/HomePage/ContentHomePage.js.map +1 -1
  211. package/dist/components/InlineEntityPreview.d.ts +1 -1
  212. package/dist/components/InlineEntityPreview.js.map +1 -1
  213. package/dist/components/PropertyCollectionView.d.ts +2 -2
  214. package/dist/components/PropertyCollectionView.js.map +1 -1
  215. package/dist/components/PropertyConfigBadge.js.map +1 -1
  216. package/dist/components/RebaseCMS.d.ts +22 -3
  217. package/dist/components/RebaseCMS.js +32 -14
  218. package/dist/components/RebaseCMS.js.map +1 -1
  219. package/dist/components/RebaseNavigation.js +106 -31
  220. package/dist/components/RebaseNavigation.js.map +1 -1
  221. package/dist/components/RecordDetail.js +4 -1
  222. package/dist/components/RecordDetail.js.map +1 -1
  223. package/dist/components/RecordForm.d.ts +5 -5
  224. package/dist/components/RecordForm.js +5 -2
  225. package/dist/components/RecordForm.js.map +1 -1
  226. package/dist/components/ReferenceTable/SelectionTableBinding.d.ts +2 -2
  227. package/dist/components/ReferenceTable/SelectionTableBinding.js +1 -1
  228. package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -1
  229. package/dist/components/ReferenceWidget.d.ts +2 -1
  230. package/dist/components/ReferenceWidget.js +2 -2
  231. package/dist/components/ReferenceWidget.js.map +1 -1
  232. package/dist/components/RelationSelector.d.ts +2 -1
  233. package/dist/components/RelationSelector.js +2 -3
  234. package/dist/components/RelationSelector.js.map +1 -1
  235. package/dist/components/SelectableTable/SelectableTable.d.ts +2 -2
  236. package/dist/components/SelectableTable/SelectableTable.js.map +1 -1
  237. package/dist/components/SelectableTable/filters/FilterFieldBinding.d.ts +2 -1
  238. package/dist/components/SelectableTable/filters/FilterFieldBinding.js +3 -3
  239. package/dist/components/SelectableTable/filters/FilterFieldBinding.js.map +1 -1
  240. package/dist/components/SelectableTable/filters/ReferenceFilterField.js +2 -2
  241. package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -1
  242. package/dist/components/SelectableTable/filters/RelationFilterField.d.ts +1 -1
  243. package/dist/components/SelectableTable/filters/RelationFilterField.js +1 -1
  244. package/dist/components/SelectableTable/filters/RelationFilterField.js.map +1 -1
  245. package/dist/components/SelectableTable/filters/StringNumberFilterField.d.ts +1 -1
  246. package/dist/components/SelectableTable/filters/StringNumberFilterField.js.map +1 -1
  247. package/dist/components/SelectableTable/filters/null_filter.d.ts +1 -3
  248. package/dist/components/SelectableTable/filters/null_filter.js.map +1 -1
  249. package/dist/components/SidePanelBinding.js +1 -1
  250. package/dist/components/SidePanelBinding.js.map +1 -1
  251. package/dist/components/field_configs.d.ts +1 -2
  252. package/dist/components/field_configs.js.map +1 -1
  253. package/dist/components/field_ids.d.ts +1 -1
  254. package/dist/components/field_ids.js +1 -1
  255. package/dist/components/field_ids.js.map +1 -1
  256. package/dist/components/history/EntityHistoryEntry.js.map +1 -1
  257. package/dist/components/history/EntityHistoryView.d.ts +1 -2
  258. package/dist/components/history/EntityHistoryView.js +1 -1
  259. package/dist/components/history/EntityHistoryView.js.map +1 -1
  260. package/dist/data_export/export/BasicExportAction.d.ts +1 -1
  261. package/dist/data_export/export/BasicExportAction.js.map +1 -1
  262. package/dist/data_export/export/ExportCollectionAction.js +2 -2
  263. package/dist/data_export/export/ExportCollectionAction.js.map +1 -1
  264. package/dist/data_export/export/additional_fields.d.ts +1 -1
  265. package/dist/data_export/export/additional_fields.js.map +1 -1
  266. package/dist/data_export/export/export.d.ts +1 -1
  267. package/dist/data_export/export/export.js +1 -1
  268. package/dist/data_export/export/export.js.map +1 -1
  269. package/dist/data_export/export/fetch_export_data.d.ts +3 -2
  270. package/dist/data_export/export/fetch_export_data.js.map +1 -1
  271. package/dist/data_import/components/DataNewPropertiesMapping.d.ts +1 -1
  272. package/dist/data_import/components/DataNewPropertiesMapping.js.map +1 -1
  273. package/dist/data_import/components/ImportNewPropertyFieldPreview.d.ts +1 -1
  274. package/dist/data_import/components/ImportNewPropertyFieldPreview.js.map +1 -1
  275. package/dist/data_import/hooks/useImportConfig.js.map +1 -1
  276. package/dist/data_import/import/ImportCollectionAction.d.ts +2 -2
  277. package/dist/data_import/import/ImportCollectionAction.js.map +1 -1
  278. package/dist/data_import/types/column_mapping.d.ts +1 -1
  279. package/dist/data_import/utils/data.d.ts +1 -2
  280. package/dist/data_import/utils/data.js +1 -2
  281. package/dist/data_import/utils/data.js.map +1 -1
  282. package/dist/data_import/utils/get_import_inference_type.d.ts +1 -1
  283. package/dist/data_import/utils/get_import_inference_type.js.map +1 -1
  284. package/dist/data_import/utils/id_column.d.ts +1 -1
  285. package/dist/data_import/utils/id_column.js.map +1 -1
  286. package/dist/data_import/utils/import_columns.d.ts +1 -1
  287. package/dist/data_import/utils/import_columns.js.map +1 -1
  288. package/dist/data_import/utils/save_entities.d.ts +3 -3
  289. package/dist/data_import/utils/save_entities.js +1 -1
  290. package/dist/data_import/utils/save_entities.js.map +1 -1
  291. package/dist/form/EntityForm.js +2 -1
  292. package/dist/form/EntityForm.js.map +1 -1
  293. package/dist/form/EntityFormActions.js.map +1 -1
  294. package/dist/form/EntityFormBinding.js +2 -2
  295. package/dist/form/EntityFormBinding.js.map +1 -1
  296. package/dist/form/FormFieldsContext.d.ts +1 -4
  297. package/dist/form/FormFieldsContext.js +1 -1
  298. package/dist/form/FormFieldsContext.js.map +1 -1
  299. package/dist/form/PropertyFieldBinding.js +6 -8
  300. package/dist/form/PropertyFieldBinding.js.map +1 -1
  301. package/dist/form/components/FieldBlock.d.ts +1 -2
  302. package/dist/form/components/FieldBlock.js.map +1 -1
  303. package/dist/form/components/FieldHelperText.d.ts +1 -1
  304. package/dist/form/components/FieldHelperText.js.map +1 -1
  305. package/dist/form/components/FormRail.d.ts +1 -1
  306. package/dist/form/components/FormRail.js.map +1 -1
  307. package/dist/form/components/LocalChangesMenu.d.ts +1 -1
  308. package/dist/form/components/LocalChangesMenu.js.map +1 -1
  309. package/dist/form/components/StorageItemPreview.d.ts +1 -1
  310. package/dist/form/components/StorageItemPreview.js.map +1 -1
  311. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +1 -1
  312. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js +1 -1
  313. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js.map +1 -1
  314. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +2 -2
  315. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +2 -2
  316. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -1
  317. package/dist/form/field_bindings/BinaryFieldBinding.d.ts +1 -1
  318. package/dist/form/field_bindings/BinaryFieldBinding.js.map +1 -1
  319. package/dist/form/field_bindings/BlockFieldBinding.d.ts +1 -1
  320. package/dist/form/field_bindings/BlockFieldBinding.js +1 -1
  321. package/dist/form/field_bindings/BlockFieldBinding.js.map +1 -1
  322. package/dist/form/field_bindings/DateTimeFieldBinding.d.ts +1 -1
  323. package/dist/form/field_bindings/DateTimeFieldBinding.js.map +1 -1
  324. package/dist/form/field_bindings/GeopointFieldBinding.d.ts +1 -1
  325. package/dist/form/field_bindings/GeopointFieldBinding.js.map +1 -1
  326. package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
  327. package/dist/form/field_bindings/KeyValueFieldBinding.js +1 -2
  328. package/dist/form/field_bindings/KeyValueFieldBinding.js.map +1 -1
  329. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  330. package/dist/form/field_bindings/MapFieldBinding.js.map +1 -1
  331. package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +1 -1
  332. package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +1 -1
  333. package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -1
  334. package/dist/form/field_bindings/MultiSelectFieldBinding.d.ts +1 -1
  335. package/dist/form/field_bindings/MultiSelectFieldBinding.js +1 -1
  336. package/dist/form/field_bindings/MultiSelectFieldBinding.js.map +1 -1
  337. package/dist/form/field_bindings/MultipleRelationFieldBinding.d.ts +1 -1
  338. package/dist/form/field_bindings/MultipleRelationFieldBinding.js +2 -2
  339. package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -1
  340. package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +1 -1
  341. package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -1
  342. package/dist/form/field_bindings/ReferenceFieldBinding.d.ts +1 -1
  343. package/dist/form/field_bindings/ReferenceFieldBinding.js +2 -2
  344. package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -1
  345. package/dist/form/field_bindings/RelationFieldBinding.d.ts +1 -1
  346. package/dist/form/field_bindings/RelationFieldBinding.js +2 -2
  347. package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -1
  348. package/dist/form/field_bindings/RepeatFieldBinding.d.ts +1 -1
  349. package/dist/form/field_bindings/RepeatFieldBinding.js +1 -1
  350. package/dist/form/field_bindings/RepeatFieldBinding.js.map +1 -1
  351. package/dist/form/field_bindings/SelectFieldBinding.d.ts +1 -1
  352. package/dist/form/field_bindings/SelectFieldBinding.js +1 -1
  353. package/dist/form/field_bindings/SelectFieldBinding.js.map +1 -1
  354. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +2 -2
  355. package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -1
  356. package/dist/form/field_bindings/SwitchFieldBinding.d.ts +1 -1
  357. package/dist/form/field_bindings/SwitchFieldBinding.js.map +1 -1
  358. package/dist/form/field_bindings/TextFieldBinding.d.ts +1 -1
  359. package/dist/form/field_bindings/TextFieldBinding.js.map +1 -1
  360. package/dist/form/field_bindings/UserSelectFieldBinding.d.ts +1 -1
  361. package/dist/form/field_bindings/UserSelectFieldBinding.js.map +1 -1
  362. package/dist/form/field_bindings/VectorFieldBinding.d.ts +1 -1
  363. package/dist/form/field_bindings/VectorFieldBinding.js.map +1 -1
  364. package/dist/form/form_utils.d.ts +3 -3
  365. package/dist/form/form_utils.js +1 -2
  366. package/dist/form/form_utils.js.map +1 -1
  367. package/dist/form/label_placement.d.ts +1 -2
  368. package/dist/form/label_placement.js.map +1 -1
  369. package/dist/form/resolve_cell_property.d.ts +1 -2
  370. package/dist/form/resolve_cell_property.js +1 -1
  371. package/dist/form/resolve_cell_property.js.map +1 -1
  372. package/dist/form/resolve_form_properties.d.ts +2 -2
  373. package/dist/form/resolve_form_properties.js +1 -1
  374. package/dist/form/resolve_form_properties.js.map +1 -1
  375. package/dist/form/useClearRestoreValue.d.ts +1 -1
  376. package/dist/form/useClearRestoreValue.js.map +1 -1
  377. package/dist/form/validation.d.ts +2 -2
  378. package/dist/form/validation.js +1 -1
  379. package/dist/form/validation.js.map +1 -1
  380. package/dist/hooks/navigation/compose_collections.d.ts +59 -0
  381. package/dist/hooks/navigation/compose_collections.js +48 -0
  382. package/dist/hooks/navigation/compose_collections.js.map +1 -0
  383. package/dist/hooks/navigation/compose_collections_input.d.ts +8 -0
  384. package/dist/hooks/navigation/compose_collections_input.js +17 -0
  385. package/dist/hooks/navigation/compose_collections_input.js.map +1 -0
  386. package/dist/hooks/navigation/contexts/CollectionRegistryContext.d.ts +1 -1
  387. package/dist/hooks/navigation/contexts/CollectionRegistryContext.js.map +1 -1
  388. package/dist/hooks/navigation/registered_collection.d.ts +15 -0
  389. package/dist/hooks/navigation/registered_collection.js +20 -0
  390. package/dist/hooks/navigation/registered_collection.js.map +1 -0
  391. package/dist/hooks/navigation/ui_preferences.d.ts +47 -0
  392. package/dist/hooks/navigation/ui_preferences.js +179 -0
  393. package/dist/hooks/navigation/ui_preferences.js.map +1 -0
  394. package/dist/hooks/navigation/useAsyncResolver.d.ts +8 -1
  395. package/dist/hooks/navigation/useAsyncResolver.js +9 -3
  396. package/dist/hooks/navigation/useAsyncResolver.js.map +1 -1
  397. package/dist/hooks/navigation/useBuildCollectionRegistryController.d.ts +1 -3
  398. package/dist/hooks/navigation/useBuildCollectionRegistryController.js +3 -3
  399. package/dist/hooks/navigation/useBuildCollectionRegistryController.js.map +1 -1
  400. package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +9 -5
  401. package/dist/hooks/navigation/useBuildNavigationStateController.js +2 -1
  402. package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -1
  403. package/dist/hooks/navigation/useBuildUrlController.d.ts +1 -1
  404. package/dist/hooks/navigation/useBuildUrlController.js.map +1 -1
  405. package/dist/hooks/navigation/useNavigationResolution.js +1 -2
  406. package/dist/hooks/navigation/useNavigationResolution.js.map +1 -1
  407. package/dist/hooks/navigation/usePanelTables.d.ts +11 -0
  408. package/dist/hooks/navigation/usePanelTables.js +33 -0
  409. package/dist/hooks/navigation/usePanelTables.js.map +1 -0
  410. package/dist/hooks/navigation/useResolvedCollections.d.ts +8 -3
  411. package/dist/hooks/navigation/useResolvedCollections.js +3 -2
  412. package/dist/hooks/navigation/useResolvedCollections.js.map +1 -1
  413. package/dist/hooks/navigation/useResolvedViews.d.ts +1 -2
  414. package/dist/hooks/navigation/useResolvedViews.js.map +1 -1
  415. package/dist/hooks/navigation/useTopLevelNavigation.d.ts +1 -2
  416. package/dist/hooks/navigation/useTopLevelNavigation.js.map +1 -1
  417. package/dist/hooks/navigation/user_preferences_overlay.d.ts +21 -0
  418. package/dist/hooks/navigation/user_preferences_overlay.js +101 -0
  419. package/dist/hooks/navigation/user_preferences_overlay.js.map +1 -0
  420. package/dist/hooks/navigation/utils.js +1 -1
  421. package/dist/hooks/navigation/utils.js.map +1 -1
  422. package/dist/hooks/useAdminContext.d.ts +1 -2
  423. package/dist/hooks/useAdminContext.js.map +1 -1
  424. package/dist/hooks/useBuildSidePanel.d.ts +1 -2
  425. package/dist/hooks/useBuildSidePanel.js +2 -1
  426. package/dist/hooks/useBuildSidePanel.js.map +1 -1
  427. package/dist/hooks/useChildViewSource.d.ts +1 -1
  428. package/dist/hooks/useChildViewSource.js +1 -1
  429. package/dist/hooks/useChildViewSource.js.map +1 -1
  430. package/dist/hooks/useEntityDisplay.d.ts +1 -2
  431. package/dist/hooks/useEntityDisplay.js +1 -1
  432. package/dist/hooks/useEntityDisplay.js.map +1 -1
  433. package/dist/hooks/useEntityDisplayTitle.d.ts +2 -2
  434. package/dist/hooks/useEntityDisplayTitle.js.map +1 -1
  435. package/dist/hooks/useHistory.js +1 -1
  436. package/dist/hooks/useHistory.js.map +1 -1
  437. package/dist/hooks/useRecordActions.d.ts +1 -2
  438. package/dist/hooks/useRecordActions.js.map +1 -1
  439. package/dist/hooks/useReferencePaths.d.ts +21 -7
  440. package/dist/hooks/useReferencePaths.js +23 -6
  441. package/dist/hooks/useReferencePaths.js.map +1 -1
  442. package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
  443. package/dist/hooks/useResolvedNavigationFrom.js +1 -1
  444. package/dist/hooks/useResolvedNavigationFrom.js.map +1 -1
  445. package/dist/index.d.ts +11 -0
  446. package/dist/index.js +8 -2
  447. package/dist/mcp_view/app_modules.d.ts +2 -2
  448. package/dist/mcp_view/app_modules.js +4 -4
  449. package/dist/mcp_view/app_modules.js.map +1 -1
  450. package/dist/mcp_view/index.d.ts +16 -19
  451. package/dist/mcp_view/index.js +43 -62
  452. package/dist/mcp_view/index.js.map +1 -1
  453. package/dist/mcp_view/payload.d.ts +54 -18
  454. package/dist/mcp_view/payload.js +49 -24
  455. package/dist/mcp_view/payload.js.map +1 -1
  456. package/dist/mcp_view/screen.js +11 -11
  457. package/dist/mcp_view/screen.js.map +1 -1
  458. package/dist/mcp_view/tool_driver.d.ts +5 -34
  459. package/dist/mcp_view/tool_driver.js +17 -16
  460. package/dist/mcp_view/tool_driver.js.map +1 -1
  461. package/dist/mcp_view/write_review.d.ts +1 -2
  462. package/dist/mcp_view/write_review.js +1 -1
  463. package/dist/mcp_view/write_review.js.map +1 -1
  464. package/dist/preview/PropertyPreview.d.ts +1 -1
  465. package/dist/preview/PropertyPreview.js +4 -3
  466. package/dist/preview/PropertyPreview.js.map +1 -1
  467. package/dist/preview/components/ArrayEnumPreview.d.ts +1 -1
  468. package/dist/preview/components/ArrayEnumPreview.js.map +1 -1
  469. package/dist/preview/components/BooleanPreview.d.ts +1 -1
  470. package/dist/preview/components/BooleanPreview.js.map +1 -1
  471. package/dist/preview/components/EnumValuesChip.d.ts +1 -1
  472. package/dist/preview/components/EnumValuesChip.js +1 -1
  473. package/dist/preview/components/EnumValuesChip.js.map +1 -1
  474. package/dist/preview/components/ReferencePreview.d.ts +1 -1
  475. package/dist/preview/components/ReferencePreview.js.map +1 -1
  476. package/dist/preview/components/RelationPreview.d.ts +1 -1
  477. package/dist/preview/components/RelationPreview.js.map +1 -1
  478. package/dist/preview/components/StorageThumbnail.js +2 -1
  479. package/dist/preview/components/StorageThumbnail.js.map +1 -1
  480. package/dist/preview/components/UserPreview.d.ts +1 -1
  481. package/dist/preview/components/UserPreview.js.map +1 -1
  482. package/dist/preview/property_previews/ArrayOfMapsPreview.d.ts +1 -1
  483. package/dist/preview/property_previews/ArrayOfMapsPreview.js.map +1 -1
  484. package/dist/preview/property_previews/ArrayOfReferencesPreview.d.ts +1 -1
  485. package/dist/preview/property_previews/ArrayOfReferencesPreview.js.map +1 -1
  486. package/dist/preview/property_previews/ArrayOfRelationsPreview.d.ts +1 -1
  487. package/dist/preview/property_previews/ArrayOfRelationsPreview.js +2 -1
  488. package/dist/preview/property_previews/ArrayOfRelationsPreview.js.map +1 -1
  489. package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.d.ts +1 -1
  490. package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js.map +1 -1
  491. package/dist/preview/property_previews/ArrayOfStringsPreview.d.ts +1 -1
  492. package/dist/preview/property_previews/ArrayOfStringsPreview.js.map +1 -1
  493. package/dist/preview/property_previews/ArrayOneOfPreview.d.ts +1 -1
  494. package/dist/preview/property_previews/ArrayOneOfPreview.js +1 -1
  495. package/dist/preview/property_previews/ArrayOneOfPreview.js.map +1 -1
  496. package/dist/preview/property_previews/ArrayPropertyEnumPreview.d.ts +1 -1
  497. package/dist/preview/property_previews/ArrayPropertyEnumPreview.js +1 -1
  498. package/dist/preview/property_previews/ArrayPropertyEnumPreview.js.map +1 -1
  499. package/dist/preview/property_previews/ArrayPropertyPreview.d.ts +1 -1
  500. package/dist/preview/property_previews/ArrayPropertyPreview.js +1 -1
  501. package/dist/preview/property_previews/ArrayPropertyPreview.js.map +1 -1
  502. package/dist/preview/property_previews/MapPropertyPreview.d.ts +1 -1
  503. package/dist/preview/property_previews/MapPropertyPreview.js.map +1 -1
  504. package/dist/preview/property_previews/NumberPropertyPreview.d.ts +1 -1
  505. package/dist/preview/property_previews/NumberPropertyPreview.js +1 -1
  506. package/dist/preview/property_previews/NumberPropertyPreview.js.map +1 -1
  507. package/dist/preview/property_previews/SkeletonPropertyComponent.d.ts +1 -1
  508. package/dist/preview/property_previews/SkeletonPropertyComponent.js.map +1 -1
  509. package/dist/preview/property_previews/StringPropertyPreview.d.ts +1 -1
  510. package/dist/preview/property_previews/StringPropertyPreview.js.map +1 -1
  511. package/dist/preview/util.d.ts +1 -1
  512. package/dist/preview/util.js.map +1 -1
  513. package/dist/routes/RebaseRoute.js +2 -2
  514. package/dist/routes/RebaseRoute.js.map +1 -1
  515. package/dist/saved_apps/SavedAppsView.d.ts +1 -1
  516. package/dist/saved_apps/SavedAppsView.js +1 -1
  517. package/dist/saved_apps/SavedAppsView.js.map +1 -1
  518. package/dist/selection/SelectionMenu.d.ts +1 -1
  519. package/dist/selection/SelectionMenu.js.map +1 -1
  520. package/dist/selection/resolve_selection.d.ts +3 -3
  521. package/dist/selection/resolve_selection.js +3 -2
  522. package/dist/selection/resolve_selection.js.map +1 -1
  523. package/dist/tables/apply_customization.d.ts +65 -0
  524. package/dist/tables/apply_customization.js +644 -0
  525. package/dist/tables/apply_customization.js.map +1 -0
  526. package/dist/tables/column_property.d.ts +64 -0
  527. package/dist/tables/column_property.js +549 -0
  528. package/dist/tables/column_property.js.map +1 -0
  529. package/dist/tables/customize_table.d.ts +39 -0
  530. package/dist/tables/customize_table.js +247 -0
  531. package/dist/tables/customize_table.js.map +1 -0
  532. package/dist/tables/index.d.ts +12 -0
  533. package/dist/tables/labels.d.ts +18 -0
  534. package/dist/tables/labels.js +18 -0
  535. package/dist/tables/labels.js.map +1 -0
  536. package/dist/tables/project_table.d.ts +79 -0
  537. package/dist/tables/project_table.js +148 -0
  538. package/dist/tables/project_table.js.map +1 -0
  539. package/dist/tables/relations.d.ts +47 -0
  540. package/dist/tables/relations.js +112 -0
  541. package/dist/tables/relations.js.map +1 -0
  542. package/dist/tables/rls.d.ts +39 -0
  543. package/dist/tables/rls.js +111 -0
  544. package/dist/tables/rls.js.map +1 -0
  545. package/dist/tables/update_record.d.ts +32 -0
  546. package/dist/tables/update_record.js +40 -0
  547. package/dist/tables/update_record.js.map +1 -0
  548. package/dist/types/components/EntityFormActionsProps.d.ts +1 -1
  549. package/dist/types/components/PropertyPreviewProps.d.ts +2 -2
  550. package/dist/types/fields.d.ts +2 -2
  551. package/dist/util/dataControllerAdapter.js.map +1 -1
  552. package/dist/util/entity_pages.d.ts +2 -1
  553. package/dist/util/entity_pages.js.map +1 -1
  554. package/dist/util/find_entities_by_ids.d.ts +2 -2
  555. package/dist/util/find_entities_by_ids.js +1 -1
  556. package/dist/util/find_entities_by_ids.js.map +1 -1
  557. package/dist/util/format_collection_date.d.ts +1 -1
  558. package/dist/util/format_collection_date.js.map +1 -1
  559. package/dist/util/identity.d.ts +8 -0
  560. package/dist/util/identity.js +16 -0
  561. package/dist/util/identity.js.map +1 -0
  562. package/dist/util/navigation_utils.js +1 -1
  563. package/dist/util/navigation_utils.js.map +1 -1
  564. package/dist/util/previews.js +1 -1
  565. package/dist/util/previews.js.map +1 -1
  566. package/dist/util/propertyConfigMapper.d.ts +1 -1
  567. package/dist/util/propertyConfigMapper.js.map +1 -1
  568. package/dist/util/property_utils.d.ts +1 -3
  569. package/dist/util/property_utils.js +1 -1
  570. package/dist/util/property_utils.js.map +1 -1
  571. package/dist/util/relations.d.ts +18 -0
  572. package/dist/util/relations.js +32 -0
  573. package/dist/util/relations.js.map +1 -0
  574. package/package.json +12 -10
  575. package/recipes/README.md +4 -4
  576. package/recipes/my-preferences.tsx +34 -26
  577. package/recipes/site-settings.tsx +34 -27
  578. package/dist/collection_editor/collection_wire.d.ts +0 -13
  579. package/dist/collection_editor/collection_wire.js +0 -49
  580. package/dist/collection_editor/collection_wire.js.map +0 -1
  581. package/dist/collection_editor/useJsonCollectionsConfigController.d.ts +0 -37
  582. package/dist/collection_editor/useJsonCollectionsConfigController.js +0 -191
  583. package/dist/collection_editor/useJsonCollectionsConfigController.js.map +0 -1
@@ -0,0 +1,549 @@
1
+ import { CHIP_COLORS, CHIP_SEED_KEYS, getColorSchemeForSeed } from "@rebasepro/ui";
2
+ import { enumValueLabel, labelFromIdentifier } from "@rebasepro/utils";
3
+ //#region src/tables/column_property.ts
4
+ /**
5
+ * The chip colour a value is drawn with when nobody chose one.
6
+ *
7
+ * The same seeded pick the chip kit makes on its own (`getColorSchemeForSeed`),
8
+ * named by its key so it survives serialization and can be read back. Seeded
9
+ * by the value alone: the same value has the same colour on every load,
10
+ * whatever its position among its siblings or which other values exist.
11
+ */
12
+ function enumValueColor(value) {
13
+ const scheme = getColorSchemeForSeed(String(value));
14
+ return CHIP_SEED_KEYS.find((key) => CHIP_COLORS[key] === scheme);
15
+ }
16
+ /**
17
+ * A closed set of values as select options: each labelled from its identifier
18
+ * (`needs_review` → "Needs Review") and coloured from {@link enumValueColor}.
19
+ */
20
+ function enumValuesFrom(values) {
21
+ return values.map((value) => ({
22
+ id: value,
23
+ label: enumValueLabel(value),
24
+ color: enumValueColor(value)
25
+ }));
26
+ }
27
+ function stringValidation(rules, length) {
28
+ const out = {};
29
+ if (typeof rules?.min === "number") out.min = rules.min;
30
+ if (typeof rules?.max === "number") out.max = rules.max;
31
+ else if (length !== void 0) out.max = length;
32
+ if (rules?.length !== void 0) out.length = rules.length;
33
+ if (rules?.matches !== void 0) out.matches = rules.matchesFlags ? new RegExp(rules.matches, rules.matchesFlags) : rules.matches;
34
+ if (rules?.matchesMessage !== void 0) out.matchesMessage = rules.matchesMessage;
35
+ if (rules?.trim) out.trim = true;
36
+ if (rules?.lowercase) out.lowercase = true;
37
+ if (rules?.uppercase) out.uppercase = true;
38
+ return out;
39
+ }
40
+ function numberValidation(rules, integer) {
41
+ const out = {};
42
+ if (typeof rules?.min === "number") out.min = rules.min;
43
+ if (typeof rules?.max === "number") out.max = rules.max;
44
+ if (rules?.lessThan !== void 0) out.lessThan = rules.lessThan;
45
+ if (rules?.moreThan !== void 0) out.moreThan = rules.moreThan;
46
+ if (rules?.positive) out.positive = true;
47
+ if (rules?.negative) out.negative = true;
48
+ if (integer || rules?.integer) out.integer = true;
49
+ return out;
50
+ }
51
+ function dateBound(bound) {
52
+ if (typeof bound !== "string") return void 0;
53
+ const date = new Date(bound);
54
+ return Number.isNaN(date.getTime()) ? void 0 : date;
55
+ }
56
+ function dateValidation(rules) {
57
+ const out = {};
58
+ const min = dateBound(rules?.min);
59
+ const max = dateBound(rules?.max);
60
+ if (min) out.min = min;
61
+ if (max) out.max = max;
62
+ return out;
63
+ }
64
+ /** Drop the keys a builder left `undefined`, so a property states only what it holds. */
65
+ function compact(value) {
66
+ for (const key of Object.keys(value)) if (Reflect.get(value, key) === void 0) Reflect.deleteProperty(value, key);
67
+ return value;
68
+ }
69
+ /** A validation block, or nothing when it holds no rule. */
70
+ function nonEmpty(rules) {
71
+ return Object.keys(compact(rules)).length > 0 ? rules : void 0;
72
+ }
73
+ /**
74
+ * A column's storage rules as the upload field's configuration: the bucket,
75
+ * the path, what is accepted and how large, and how images are resized. The
76
+ * browser-only options (`processFile`, `previewUrl`, function-valued paths)
77
+ * are `customizeTable`'s to add.
78
+ */
79
+ function storageConfigFrom(storage) {
80
+ return compact({
81
+ storagePath: storage.path,
82
+ storageSource: storage.source,
83
+ acceptedFiles: storage.accept ? [...storage.accept] : void 0,
84
+ maxSize: storage.maxBytes,
85
+ imageResize: storage.imageResize ? { ...storage.imageResize } : void 0,
86
+ public: storage.public,
87
+ fileName: storage.fileName,
88
+ metadata: storage.metadata ? { ...storage.metadata } : void 0,
89
+ includeBucketUrl: storage.includeBucketUrl,
90
+ storeUrl: storage.storeUrl
91
+ });
92
+ }
93
+ var INTEGER_KINDS = /* @__PURE__ */ new Set([
94
+ "smallint",
95
+ "integer",
96
+ "bigint",
97
+ "smallserial",
98
+ "serial",
99
+ "bigserial"
100
+ ]);
101
+ var SERIAL_KINDS = /* @__PURE__ */ new Set([
102
+ "smallserial",
103
+ "serial",
104
+ "bigserial"
105
+ ]);
106
+ function numberColumnType(type) {
107
+ switch (type.kind) {
108
+ case "smallint":
109
+ case "integer": return "integer";
110
+ case "bigint": return "bigint";
111
+ case "smallserial":
112
+ case "serial": return "serial";
113
+ case "bigserial": return "bigserial";
114
+ case "real": return "real";
115
+ case "doublePrecision": return "double precision";
116
+ case "numeric": return "numeric";
117
+ default: return;
118
+ }
119
+ }
120
+ function stringColumnType(type) {
121
+ switch (type.kind) {
122
+ case "text": return "text";
123
+ case "varchar": return "varchar";
124
+ case "char": return "char";
125
+ case "uuid": return "uuid";
126
+ default: return;
127
+ }
128
+ }
129
+ function arrayColumnType(of) {
130
+ switch (of.kind) {
131
+ case "text":
132
+ case "varchar": return "text[]";
133
+ case "smallint":
134
+ case "integer":
135
+ case "bigint": return "integer[]";
136
+ case "boolean": return "boolean[]";
137
+ case "numeric": return "numeric[]";
138
+ default: return;
139
+ }
140
+ }
141
+ var VECTOR_DISTANCE = {
142
+ cosine: "cosine",
143
+ l2: "l2",
144
+ ip: "inner_product"
145
+ };
146
+ function vectorIndexFrom(index) {
147
+ if (index === void 0 || index === false) return index;
148
+ const metric = index.metric;
149
+ const distance = metric === void 0 ? void 0 : typeof metric === "string" ? VECTOR_DISTANCE[metric] : metric.map((m) => VECTOR_DISTANCE[m]);
150
+ return compact({
151
+ method: index.method,
152
+ distance,
153
+ m: index.m,
154
+ efConstruction: index.efConstruction,
155
+ lists: index.lists
156
+ });
157
+ }
158
+ /**
159
+ * What a value of one column type is, before the column's own facts
160
+ * (nullability, defaults, access, …) are applied. Also used for the items of
161
+ * an array column, with the item's rules.
162
+ */
163
+ function valueProperty(type, facts) {
164
+ const { validate, oneOf, storage } = facts;
165
+ switch (type.kind) {
166
+ case "text":
167
+ case "varchar":
168
+ case "char":
169
+ case "uuid":
170
+ case "other": {
171
+ const length = type.kind === "varchar" || type.kind === "char" ? type.length : void 0;
172
+ return compact({
173
+ type: "string",
174
+ columnType: stringColumnType(type),
175
+ validation: nonEmpty(stringValidation(validate, length)),
176
+ enum: oneOf ? enumValuesFrom(oneOf) : void 0,
177
+ storage: storage ? storageConfigFrom(storage) : void 0,
178
+ email: validate?.email ? true : void 0,
179
+ url: validate?.url ? true : void 0,
180
+ userSelect: facts.semantic === "user" ? true : void 0
181
+ });
182
+ }
183
+ case "enum": return compact({
184
+ type: "string",
185
+ enum: enumValuesFrom(type.values)
186
+ });
187
+ case "smallint":
188
+ case "integer":
189
+ case "bigint":
190
+ case "smallserial":
191
+ case "serial":
192
+ case "bigserial":
193
+ case "real":
194
+ case "doublePrecision":
195
+ case "numeric": return compact({
196
+ type: "number",
197
+ columnType: numberColumnType(type),
198
+ precision: type.kind === "numeric" ? type.precision : void 0,
199
+ scale: type.kind === "numeric" ? type.scale : void 0,
200
+ validation: nonEmpty(numberValidation(validate, INTEGER_KINDS.has(type.kind))),
201
+ enum: oneOf ? enumValuesFrom(oneOf) : void 0
202
+ });
203
+ case "boolean": return { type: "boolean" };
204
+ case "timestamptz": return compact({
205
+ type: "date",
206
+ columnType: "timestamp",
207
+ mode: "date_time",
208
+ validation: nonEmpty(dateValidation(validate))
209
+ });
210
+ case "date": return compact({
211
+ type: "date",
212
+ columnType: "date",
213
+ mode: "date",
214
+ validation: nonEmpty(dateValidation(validate))
215
+ });
216
+ case "time": return compact({
217
+ type: "date",
218
+ columnType: "time",
219
+ validation: nonEmpty(dateValidation(validate))
220
+ });
221
+ case "json":
222
+ case "jsonb":
223
+ if (facts.semantic === "geopoint") return { type: "geopoint" };
224
+ return jsonColumnProperty(type.kind, facts.json);
225
+ case "vector": return compact({
226
+ type: "vector",
227
+ dimensions: type.dimensions,
228
+ index: vectorIndexFrom(facts.vectorIndex)
229
+ });
230
+ case "bytea": return { type: "binary" };
231
+ case "array": return arrayProperty(type.of, facts);
232
+ }
233
+ }
234
+ function arrayProperty(of, facts) {
235
+ const element = facts.element;
236
+ const itemStorage = element?.storage ?? facts.storage;
237
+ const item = valueProperty(of, {
238
+ validate: element?.validate,
239
+ oneOf: element?.oneOf,
240
+ storage: itemStorage,
241
+ semantic: element?.semantic
242
+ });
243
+ return compact({
244
+ type: "array",
245
+ columnType: arrayColumnType(of),
246
+ of: item,
247
+ validation: nonEmpty({
248
+ min: facts.validate?.minItems,
249
+ max: facts.validate?.maxItems,
250
+ uniqueInArray: facts.validate?.uniqueItems ? true : void 0
251
+ })
252
+ });
253
+ }
254
+ /** The free-form JSON editor: what a document with no known shape is edited with. */
255
+ function freeFormJson(columnType) {
256
+ return compact({
257
+ type: "map",
258
+ columnType,
259
+ keyValue: true
260
+ });
261
+ }
262
+ function jsonColumnProperty(kind, shape) {
263
+ if (!shape) return freeFormJson(kind);
264
+ const property = jsonNodeProperty(shape);
265
+ if (property.type === "map" || property.type === "array" && property.columnType === void 0) property.columnType = kind;
266
+ return property;
267
+ }
268
+ function nodeDefault(value, guard) {
269
+ return guard(value) ? value : void 0;
270
+ }
271
+ var isString = (v) => typeof v === "string";
272
+ var isNumber = (v) => typeof v === "number" && Number.isFinite(v);
273
+ var isBoolean = (v) => typeof v === "boolean";
274
+ var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
275
+ var isArray = (v) => Array.isArray(v);
276
+ /**
277
+ * An array's `uniqueBy`, as the panel's form checks it: each named field of
278
+ * the item map marked `uniqueInArray` (unique across the array's items).
279
+ */
280
+ function uniqueByFields(item, uniqueBy) {
281
+ if (!uniqueBy || uniqueBy.length === 0 || item.type !== "map" || !item.properties) return item;
282
+ const properties = { ...item.properties };
283
+ for (const field of uniqueBy) {
284
+ const child = properties[field];
285
+ if (child) properties[field] = Object.assign({}, child, { validation: {
286
+ ...child.validation,
287
+ uniqueInArray: true
288
+ } });
289
+ }
290
+ return {
291
+ ...item,
292
+ properties
293
+ };
294
+ }
295
+ function nodeProperties(fields) {
296
+ const properties = {};
297
+ for (const [key, field] of Object.entries(fields)) properties[key] = {
298
+ ...jsonNodeProperty(field),
299
+ name: labelFromIdentifier(key)
300
+ };
301
+ return {
302
+ properties,
303
+ propertiesOrder: Object.keys(fields)
304
+ };
305
+ }
306
+ /**
307
+ * One node of a JSON shape as a property: an object is a group of fields, an
308
+ * array repeats its item, a `oneOf` inside an array is a list of typed blocks,
309
+ * and the leaves are the same fields a column of that type gets.
310
+ */
311
+ function jsonNodeProperty(node) {
312
+ const base = {
313
+ description: node.description,
314
+ validation: node.required ? { required: true } : void 0
315
+ };
316
+ switch (node.kind) {
317
+ case "string": return compact({
318
+ ...base,
319
+ type: "string",
320
+ validation: nonEmpty({
321
+ ...stringValidation(node.validate),
322
+ ...base.validation
323
+ }),
324
+ enum: node.oneOf ? enumValuesFrom(node.oneOf) : void 0,
325
+ storage: node.storage ? storageConfigFrom(node.storage) : void 0,
326
+ email: node.validate?.email ? true : void 0,
327
+ url: node.validate?.url ? true : void 0,
328
+ userSelect: node.semantic === "user" ? true : void 0,
329
+ defaultValue: nodeDefault(node.default, isString)
330
+ });
331
+ case "number": return compact({
332
+ ...base,
333
+ type: "number",
334
+ validation: nonEmpty({
335
+ ...numberValidation(node.validate, false),
336
+ ...base.validation
337
+ }),
338
+ enum: node.oneOf ? enumValuesFrom(node.oneOf) : void 0,
339
+ defaultValue: nodeDefault(node.default, isNumber)
340
+ });
341
+ case "boolean": return compact({
342
+ ...base,
343
+ type: "boolean",
344
+ defaultValue: nodeDefault(node.default, isBoolean)
345
+ });
346
+ case "date": {
347
+ const stamped = node.stamp !== void 0;
348
+ return compact({
349
+ ...base,
350
+ type: "date",
351
+ mode: "date_time",
352
+ validation: nonEmpty({
353
+ ...dateValidation(node.validate),
354
+ ...base.validation
355
+ }),
356
+ autoValue: node.stamp === "create" ? "on_create" : node.stamp === "update" ? "on_update" : void 0,
357
+ admin: stamped ? { readOnly: true } : void 0
358
+ });
359
+ }
360
+ case "geopoint": return compact({
361
+ ...base,
362
+ type: "geopoint"
363
+ });
364
+ case "object": {
365
+ const { properties, propertiesOrder } = nodeProperties(node.fields);
366
+ return compact({
367
+ ...base,
368
+ type: "map",
369
+ properties,
370
+ propertiesOrder,
371
+ defaultValue: nodeDefault(node.default, isRecord)
372
+ });
373
+ }
374
+ case "array": {
375
+ const item = node.of;
376
+ const validation = nonEmpty({
377
+ ...base.validation,
378
+ min: node.validate?.minItems,
379
+ max: node.validate?.maxItems,
380
+ uniqueInArray: node.validate?.uniqueItems ? true : void 0
381
+ });
382
+ if (item.kind === "oneOf") {
383
+ const { properties, propertiesOrder } = nodeProperties(item.variants);
384
+ return compact({
385
+ ...base,
386
+ type: "array",
387
+ validation,
388
+ oneOf: {
389
+ properties,
390
+ propertiesOrder,
391
+ typeField: item.typeField,
392
+ valueField: item.valueField
393
+ },
394
+ defaultValue: nodeDefault(node.default, isArray)
395
+ });
396
+ }
397
+ return compact({
398
+ ...base,
399
+ type: "array",
400
+ validation,
401
+ of: uniqueByFields(jsonNodeProperty(item), node.validate?.uniqueBy),
402
+ defaultValue: nodeDefault(node.default, isArray)
403
+ });
404
+ }
405
+ case "oneOf":
406
+ case "unknown": return compact({
407
+ ...freeFormJson(),
408
+ ...base
409
+ });
410
+ }
411
+ }
412
+ function isTimeStampable(property) {
413
+ return property.type === "date";
414
+ }
415
+ /**
416
+ * The id strategy of a primary-key column: `uuid` for `gen_random_uuid()`,
417
+ * `increment` for identity and serial columns, `true` for any other generated
418
+ * default, `manual` when the value is typed in.
419
+ */
420
+ function idStrategy(column) {
421
+ const fallback = column.default;
422
+ if (SERIAL_KINDS.has(column.type.kind) || fallback?.kind === "identity") return "increment";
423
+ if (fallback?.kind === "random-uuid") return "uuid";
424
+ if (fallback?.kind === "sql" || fallback?.kind === "database") return true;
425
+ return "manual";
426
+ }
427
+ function applyId(property, strategy) {
428
+ switch (property.type) {
429
+ case "string":
430
+ case "number":
431
+ property.isId = strategy;
432
+ return;
433
+ case "date":
434
+ property.isId = strategy === "manual" ? "manual" : true;
435
+ return;
436
+ default: return;
437
+ }
438
+ }
439
+ /** A literal DEFAULT as the value a new record's form opens with. */
440
+ function applyLiteralDefault(property, value) {
441
+ switch (property.type) {
442
+ case "string":
443
+ if (isString(value) && (!property.enum || enumHas(property.enum, value))) property.defaultValue = value;
444
+ return;
445
+ case "number":
446
+ if (isNumber(value)) property.defaultValue = value;
447
+ return;
448
+ case "boolean":
449
+ if (isBoolean(value)) property.defaultValue = value;
450
+ return;
451
+ case "date": {
452
+ if (!isString(value) && !isNumber(value)) return;
453
+ const date = new Date(value);
454
+ if (!Number.isNaN(date.getTime())) property.defaultValue = date;
455
+ return;
456
+ }
457
+ case "map":
458
+ if (isRecord(value)) property.defaultValue = { ...value };
459
+ return;
460
+ case "array":
461
+ if (isArray(value)) property.defaultValue = [...value];
462
+ return;
463
+ default: return;
464
+ }
465
+ }
466
+ function enumHas(values, value) {
467
+ return Array.isArray(values) ? values.some((entry) => entry.id === value) : true;
468
+ }
469
+ function applyStamp(property, stamp) {
470
+ if (stamp.value === "now" && isTimeStampable(property)) {
471
+ property.autoValue = stamp.on === "create" ? "on_create" : "on_update";
472
+ property.admin = {
473
+ ...property.admin,
474
+ readOnly: true,
475
+ hideFromCollection: true
476
+ };
477
+ return;
478
+ }
479
+ if (stamp.value === "user" && property.type === "string") property.autoValue = stamp.on === "create" ? "user_on_create" : "user_on_update";
480
+ property.admin = {
481
+ ...property.admin,
482
+ readOnly: true
483
+ };
484
+ }
485
+ /**
486
+ * A column as a property, or `undefined` for a column that must not reach the
487
+ * panel (`private`: the server never serves one, and one that slips through is
488
+ * dropped here rather than rendered).
489
+ *
490
+ * - `nullable: false` is `validation.required`, except where nobody types the
491
+ * value: a generated id, a stamp, a generated or read-only column.
492
+ * - A DEFAULT keeps the column required on edit and lets a create leave it out:
493
+ * a literal opens the form with the value, anything else is `databaseDefault`.
494
+ * - `readOnly`, `generated` and stamps are read-only in the form; time stamps
495
+ * are also left out of the default table columns.
496
+ * - The tenant column is filled by the server on create (`filledByServer`).
497
+ * It stays editable and stays among the table columns, as an authored
498
+ * collection's did: a caller in a bypass role creates rows in a tenant they
499
+ * name.
500
+ */
501
+ function propertyFromColumn(column, context) {
502
+ if (column.private) return void 0;
503
+ const property = valueProperty(column.type, {
504
+ validate: column.validate,
505
+ oneOf: column.oneOf,
506
+ storage: column.storage,
507
+ json: column.json,
508
+ semantic: column.semantic,
509
+ vectorIndex: column.vectorIndex,
510
+ element: column.element
511
+ });
512
+ property.name = labelFromIdentifier(column.key);
513
+ if (column.description) property.description = column.description;
514
+ if (column.key !== column.column) property.columnName = column.column;
515
+ if (column.access) property.access = compact({
516
+ read: column.access.read ? [...column.access.read] : void 0,
517
+ write: column.access.write ? [...column.access.write] : void 0
518
+ });
519
+ const isKey = context.primaryKey.includes(column.key);
520
+ const strategy = isKey ? idStrategy(column) : void 0;
521
+ if (strategy !== void 0) applyId(property, strategy);
522
+ const generatedKey = strategy !== void 0 && strategy !== "manual";
523
+ const writtenByServer = Boolean(column.readOnly || column.generated || column.stamp);
524
+ if (column.stamp) applyStamp(property, column.stamp);
525
+ if (column.readOnly || column.generated) property.admin = {
526
+ ...property.admin,
527
+ readOnly: true
528
+ };
529
+ const fallback = column.default;
530
+ if (fallback && !generatedKey) if (fallback.kind === "literal") applyLiteralDefault(property, fallback.value);
531
+ else property.databaseDefault = fallback.kind === "sql" ? `sql\`${fallback.expression}\`` : true;
532
+ const validation = {};
533
+ if (!column.nullable && !generatedKey && !writtenByServer) validation.required = true;
534
+ if (validation.required && column.validate?.requiredMessage) validation.requiredMessage = column.validate.requiredMessage;
535
+ if (column.unique && !isKey) validation.unique = true;
536
+ if (Object.keys(validation).length > 0) property.validation = {
537
+ ...property.validation,
538
+ ...validation
539
+ };
540
+ if (context.tenantField === column.key) property.admin = {
541
+ ...property.admin,
542
+ filledByServer: true
543
+ };
544
+ return compact(property);
545
+ }
546
+ //#endregion
547
+ export { enumValueColor, enumValuesFrom, jsonNodeProperty, propertyFromColumn, storageConfigFrom };
548
+
549
+ //# sourceMappingURL=column_property.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column_property.js","names":[],"sources":["../../src/tables/column_property.ts"],"sourcesContent":["/**\n * One column of a {@link TableDescriptor} as the panel's view-model property.\n *\n * Every column type picks a property the panel already has a field for — the\n * widget is then chosen by `getDefaultFieldId` exactly as it is for an\n * authored collection. Nothing here adds a widget; it only states the facts the\n * existing widgets read (`enum`, `storage`, `columnType`, `validation`, `isId`,\n * `autoValue`, `admin.readOnly`, …).\n */\nimport type {\n ColumnDescriptor,\n ColumnElementDescriptor,\n ColumnStorage,\n ColumnType,\n ColumnValidation,\n JsonShape,\n VectorMetric\n} from \"@rebasepro/types\";\nimport type {\n ArrayProperty,\n DateProperty,\n DatePropertyValidationSchema,\n EnumValueConfig,\n MapProperty,\n NumberProperty,\n NumberPropertyValidationSchema,\n PostgresProperty,\n Properties,\n Property,\n StorageConfig,\n StringProperty,\n StringPropertyValidationSchema,\n VectorDistance,\n VectorIndexConfig,\n VectorProperty\n} from \"@rebasepro/cms-types\";\nimport { CHIP_COLORS, CHIP_SEED_KEYS, getColorSchemeForSeed } from \"@rebasepro/ui\";\nimport { enumValueLabel, labelFromIdentifier } from \"@rebasepro/utils\";\n\n/**\n * What a column's projection needs to know about the table around it.\n */\nexport interface ColumnProjectionContext {\n /** The keys of the primary-key columns. */\n primaryKey: readonly string[];\n /** The key of the tenant column, when rows are scoped to a tenant. */\n tenantField?: string;\n}\n\n// ── Enum values ──────────────────────────────────────────────────────────────\n\n/**\n * The chip colour a value is drawn with when nobody chose one.\n *\n * The same seeded pick the chip kit makes on its own (`getColorSchemeForSeed`),\n * named by its key so it survives serialization and can be read back. Seeded\n * by the value alone: the same value has the same colour on every load,\n * whatever its position among its siblings or which other values exist.\n */\nexport function enumValueColor(value: string | number): EnumValueConfig[\"color\"] {\n const scheme = getColorSchemeForSeed(String(value));\n return CHIP_SEED_KEYS.find(key => CHIP_COLORS[key] === scheme);\n}\n\n/**\n * A closed set of values as select options: each labelled from its identifier\n * (`needs_review` → \"Needs Review\") and coloured from {@link enumValueColor}.\n */\nexport function enumValuesFrom(values: readonly (string | number)[]): EnumValueConfig[] {\n return values.map(value => ({\n id: value,\n label: enumValueLabel(value),\n color: enumValueColor(value)\n }));\n}\n\n// ── Validation ───────────────────────────────────────────────────────────────\n\nfunction stringValidation(rules: ColumnValidation | undefined, length?: number): StringPropertyValidationSchema {\n const out: StringPropertyValidationSchema = {};\n if (typeof rules?.min === \"number\") out.min = rules.min;\n if (typeof rules?.max === \"number\") out.max = rules.max;\n else if (length !== undefined) out.max = length;\n if (rules?.length !== undefined) out.length = rules.length;\n if (rules?.matches !== undefined) {\n out.matches = rules.matchesFlags ? new RegExp(rules.matches, rules.matchesFlags) : rules.matches;\n }\n if (rules?.matchesMessage !== undefined) out.matchesMessage = rules.matchesMessage;\n if (rules?.trim) out.trim = true;\n if (rules?.lowercase) out.lowercase = true;\n if (rules?.uppercase) out.uppercase = true;\n return out;\n}\n\nfunction numberValidation(rules: ColumnValidation | undefined, integer: boolean): NumberPropertyValidationSchema {\n const out: NumberPropertyValidationSchema = {};\n if (typeof rules?.min === \"number\") out.min = rules.min;\n if (typeof rules?.max === \"number\") out.max = rules.max;\n if (rules?.lessThan !== undefined) out.lessThan = rules.lessThan;\n if (rules?.moreThan !== undefined) out.moreThan = rules.moreThan;\n if (rules?.positive) out.positive = true;\n if (rules?.negative) out.negative = true;\n if (integer || rules?.integer) out.integer = true;\n return out;\n}\n\nfunction dateBound(bound: number | string | undefined): Date | undefined {\n if (typeof bound !== \"string\") return undefined;\n const date = new Date(bound);\n return Number.isNaN(date.getTime()) ? undefined : date;\n}\n\nfunction dateValidation(rules: ColumnValidation | undefined): DatePropertyValidationSchema {\n const out: DatePropertyValidationSchema = {};\n const min = dateBound(rules?.min);\n const max = dateBound(rules?.max);\n if (min) out.min = min;\n if (max) out.max = max;\n return out;\n}\n\n/** Drop the keys a builder left `undefined`, so a property states only what it holds. */\nfunction compact<T extends object>(value: T): T {\n for (const key of Object.keys(value)) {\n if (Reflect.get(value, key) === undefined) Reflect.deleteProperty(value, key);\n }\n return value;\n}\n\n/** A validation block, or nothing when it holds no rule. */\nfunction nonEmpty<T extends object>(rules: T): T | undefined {\n return Object.keys(compact(rules)).length > 0 ? rules : undefined;\n}\n\n// ── Storage ──────────────────────────────────────────────────────────────────\n\n/**\n * A column's storage rules as the upload field's configuration: the bucket,\n * the path, what is accepted and how large, and how images are resized. The\n * browser-only options (`processFile`, `previewUrl`, function-valued paths)\n * are `customizeTable`'s to add.\n */\nexport function storageConfigFrom(storage: ColumnStorage): StorageConfig {\n return compact<StorageConfig>({\n storagePath: storage.path,\n storageSource: storage.source,\n acceptedFiles: storage.accept ? [...storage.accept] : undefined,\n maxSize: storage.maxBytes,\n imageResize: storage.imageResize ? { ...storage.imageResize } : undefined,\n public: storage.public,\n fileName: storage.fileName,\n metadata: storage.metadata ? { ...storage.metadata } : undefined,\n includeBucketUrl: storage.includeBucketUrl,\n storeUrl: storage.storeUrl\n });\n}\n\n// ── Scalars by column type ───────────────────────────────────────────────────\n\nconst INTEGER_KINDS: ReadonlySet<ColumnType[\"kind\"]> = new Set([\n \"smallint\", \"integer\", \"bigint\", \"smallserial\", \"serial\", \"bigserial\"\n]);\n\nconst SERIAL_KINDS: ReadonlySet<ColumnType[\"kind\"]> = new Set([\"smallserial\", \"serial\", \"bigserial\"]);\n\nfunction numberColumnType(type: ColumnType): NumberProperty[\"columnType\"] {\n switch (type.kind) {\n case \"smallint\":\n case \"integer\": return \"integer\";\n case \"bigint\": return \"bigint\";\n case \"smallserial\":\n case \"serial\": return \"serial\";\n case \"bigserial\": return \"bigserial\";\n case \"real\": return \"real\";\n case \"doublePrecision\": return \"double precision\";\n case \"numeric\": return \"numeric\";\n default: return undefined;\n }\n}\n\nfunction stringColumnType(type: ColumnType): StringProperty[\"columnType\"] {\n switch (type.kind) {\n case \"text\": return \"text\";\n case \"varchar\": return \"varchar\";\n case \"char\": return \"char\";\n case \"uuid\": return \"uuid\";\n default: return undefined;\n }\n}\n\nfunction arrayColumnType(of: ColumnType): ArrayProperty[\"columnType\"] {\n switch (of.kind) {\n case \"text\":\n case \"varchar\": return \"text[]\";\n case \"smallint\":\n case \"integer\":\n case \"bigint\": return \"integer[]\";\n case \"boolean\": return \"boolean[]\";\n case \"numeric\": return \"numeric[]\";\n default: return undefined;\n }\n}\n\nconst VECTOR_DISTANCE: Readonly<Record<VectorMetric, VectorDistance>> = {\n cosine: \"cosine\",\n l2: \"l2\",\n ip: \"inner_product\"\n};\n\nfunction vectorIndexFrom(index: ColumnDescriptor[\"vectorIndex\"]): VectorIndexConfig | false | undefined {\n if (index === undefined || index === false) return index;\n const metric = index.metric;\n const distance = metric === undefined\n ? undefined\n : typeof metric === \"string\" ? VECTOR_DISTANCE[metric] : metric.map(m => VECTOR_DISTANCE[m]);\n return compact<VectorIndexConfig>({\n method: index.method,\n distance,\n m: index.m,\n efConstruction: index.efConstruction,\n lists: index.lists\n });\n}\n\n/** The facts of a column (or of an array's items) that decide what its values are. */\ninterface ValueFacts {\n validate?: ColumnValidation;\n oneOf?: readonly (string | number)[];\n storage?: ColumnStorage;\n json?: JsonShape;\n semantic?: ColumnDescriptor[\"semantic\"];\n vectorIndex?: ColumnDescriptor[\"vectorIndex\"];\n element?: ColumnElementDescriptor;\n}\n\n/**\n * What a value of one column type is, before the column's own facts\n * (nullability, defaults, access, …) are applied. Also used for the items of\n * an array column, with the item's rules.\n */\nfunction valueProperty(\n type: ColumnType,\n facts: ValueFacts\n): PostgresProperty {\n const { validate, oneOf, storage } = facts;\n switch (type.kind) {\n case \"text\":\n case \"varchar\":\n case \"char\":\n case \"uuid\":\n case \"other\": {\n const length = type.kind === \"varchar\" || type.kind === \"char\" ? type.length : undefined;\n return compact<StringProperty>({\n type: \"string\",\n columnType: stringColumnType(type),\n validation: nonEmpty(stringValidation(validate, length)),\n enum: oneOf ? enumValuesFrom(oneOf) : undefined,\n storage: storage ? storageConfigFrom(storage) : undefined,\n email: validate?.email ? true : undefined,\n url: validate?.url ? true : undefined,\n userSelect: facts.semantic === \"user\" ? true : undefined\n });\n }\n case \"enum\":\n return compact<StringProperty>({\n type: \"string\",\n enum: enumValuesFrom(type.values)\n });\n case \"smallint\":\n case \"integer\":\n case \"bigint\":\n case \"smallserial\":\n case \"serial\":\n case \"bigserial\":\n case \"real\":\n case \"doublePrecision\":\n case \"numeric\":\n return compact<NumberProperty>({\n type: \"number\",\n columnType: numberColumnType(type),\n precision: type.kind === \"numeric\" ? type.precision : undefined,\n scale: type.kind === \"numeric\" ? type.scale : undefined,\n validation: nonEmpty(numberValidation(validate, INTEGER_KINDS.has(type.kind))),\n enum: oneOf ? enumValuesFrom(oneOf) : undefined\n });\n case \"boolean\":\n return { type: \"boolean\" };\n case \"timestamptz\":\n return compact<DateProperty>({ type: \"date\", columnType: \"timestamp\", mode: \"date_time\", validation: nonEmpty(dateValidation(validate)) });\n case \"date\":\n return compact<DateProperty>({ type: \"date\", columnType: \"date\", mode: \"date\", validation: nonEmpty(dateValidation(validate)) });\n case \"time\":\n return compact<DateProperty>({ type: \"date\", columnType: \"time\", validation: nonEmpty(dateValidation(validate)) });\n case \"json\":\n case \"jsonb\":\n if (facts.semantic === \"geopoint\") return { type: \"geopoint\" };\n return jsonColumnProperty(type.kind, facts.json);\n case \"vector\":\n return compact<VectorProperty>({ type: \"vector\", dimensions: type.dimensions, index: vectorIndexFrom(facts.vectorIndex) });\n case \"bytea\":\n return { type: \"binary\" };\n case \"array\":\n return arrayProperty(type.of, facts);\n }\n}\n\nfunction arrayProperty(of: ColumnType, facts: ValueFacts): ArrayProperty {\n const element = facts.element;\n // `col.storage().multiple()` states its storage on the column; an array of\n // storage items states it on the element. Either way each item is a file.\n const itemStorage = element?.storage ?? facts.storage;\n const item = valueProperty(of, { validate: element?.validate, oneOf: element?.oneOf, storage: itemStorage, semantic: element?.semantic });\n return compact<ArrayProperty>({\n type: \"array\",\n columnType: arrayColumnType(of),\n of: item,\n validation: nonEmpty({\n min: facts.validate?.minItems,\n max: facts.validate?.maxItems,\n uniqueInArray: facts.validate?.uniqueItems ? true : undefined\n })\n });\n}\n\n// ── JSON documents ───────────────────────────────────────────────────────────\n\n/** The free-form JSON editor: what a document with no known shape is edited with. */\nfunction freeFormJson(columnType?: MapProperty[\"columnType\"]): MapProperty {\n return compact<MapProperty>({ type: \"map\", columnType, keyValue: true });\n}\n\nfunction jsonColumnProperty(kind: \"json\" | \"jsonb\", shape: JsonShape | undefined): PostgresProperty {\n if (!shape) return freeFormJson(kind);\n const property = jsonNodeProperty(shape);\n if (property.type === \"map\" || (property.type === \"array\" && property.columnType === undefined)) {\n property.columnType = kind;\n }\n return property;\n}\n\nfunction nodeDefault<T>(value: unknown, guard: (v: unknown) => v is T): T | undefined {\n return guard(value) ? value : undefined;\n}\n\nconst isString = (v: unknown): v is string => typeof v === \"string\";\nconst isNumber = (v: unknown): v is number => typeof v === \"number\" && Number.isFinite(v);\nconst isBoolean = (v: unknown): v is boolean => typeof v === \"boolean\";\nconst isRecord = (v: unknown): v is Record<string, unknown> => typeof v === \"object\" && v !== null && !Array.isArray(v);\nconst isArray = (v: unknown): v is unknown[] => Array.isArray(v);\n\n/**\n * An array's `uniqueBy`, as the panel's form checks it: each named field of\n * the item map marked `uniqueInArray` (unique across the array's items).\n */\nfunction uniqueByFields(item: PostgresProperty, uniqueBy: readonly string[] | undefined): PostgresProperty {\n if (!uniqueBy || uniqueBy.length === 0 || item.type !== \"map\" || !item.properties) return item;\n const properties: Properties = { ...item.properties };\n for (const field of uniqueBy) {\n const child = properties[field];\n // `Object.assign`, not a spread: a spread of the property union loses\n // which member it is, and the result is no longer a `Property`.\n if (child) properties[field] = Object.assign({}, child, { validation: { ...child.validation, uniqueInArray: true } });\n }\n return { ...item, properties };\n}\n\nfunction nodeProperties(fields: Record<string, JsonShape>): { properties: Properties; propertiesOrder: string[] } {\n const properties: Properties = {};\n for (const [key, field] of Object.entries(fields)) {\n properties[key] = { ...jsonNodeProperty(field), name: labelFromIdentifier(key) };\n }\n return { properties, propertiesOrder: Object.keys(fields) };\n}\n\n/**\n * One node of a JSON shape as a property: an object is a group of fields, an\n * array repeats its item, a `oneOf` inside an array is a list of typed blocks,\n * and the leaves are the same fields a column of that type gets.\n */\nexport function jsonNodeProperty(node: JsonShape): PostgresProperty {\n const base = {\n description: node.description,\n validation: node.required ? { required: true } : undefined\n };\n switch (node.kind) {\n case \"string\":\n return compact<StringProperty>({\n ...base,\n type: \"string\",\n validation: nonEmpty({ ...stringValidation(node.validate), ...base.validation }),\n enum: node.oneOf ? enumValuesFrom(node.oneOf) : undefined,\n storage: node.storage ? storageConfigFrom(node.storage) : undefined,\n email: node.validate?.email ? true : undefined,\n url: node.validate?.url ? true : undefined,\n userSelect: node.semantic === \"user\" ? true : undefined,\n defaultValue: nodeDefault(node.default, isString)\n });\n case \"number\":\n return compact<NumberProperty>({\n ...base,\n type: \"number\",\n validation: nonEmpty({ ...numberValidation(node.validate, false), ...base.validation }),\n enum: node.oneOf ? enumValuesFrom(node.oneOf) : undefined,\n defaultValue: nodeDefault(node.default, isNumber)\n });\n case \"boolean\":\n return compact({ ...base, type: \"boolean\" as const, defaultValue: nodeDefault(node.default, isBoolean) });\n case \"date\": {\n const stamped = node.stamp !== undefined;\n return compact<DateProperty>({\n ...base,\n type: \"date\",\n mode: \"date_time\",\n validation: nonEmpty({ ...dateValidation(node.validate), ...base.validation }),\n autoValue: node.stamp === \"create\" ? \"on_create\" : node.stamp === \"update\" ? \"on_update\" : undefined,\n admin: stamped ? { readOnly: true } : undefined\n });\n }\n case \"geopoint\":\n return compact({ ...base, type: \"geopoint\" as const });\n case \"object\": {\n const { properties, propertiesOrder } = nodeProperties(node.fields);\n return compact<MapProperty>({\n ...base,\n type: \"map\",\n properties,\n propertiesOrder,\n defaultValue: nodeDefault(node.default, isRecord)\n });\n }\n case \"array\": {\n const item = node.of;\n const validation = nonEmpty({\n ...base.validation,\n min: node.validate?.minItems,\n max: node.validate?.maxItems,\n uniqueInArray: node.validate?.uniqueItems ? true : undefined\n });\n if (item.kind === \"oneOf\") {\n const { properties, propertiesOrder } = nodeProperties(item.variants);\n return compact<ArrayProperty>({\n ...base,\n type: \"array\",\n validation,\n oneOf: { properties, propertiesOrder, typeField: item.typeField, valueField: item.valueField },\n defaultValue: nodeDefault(node.default, isArray)\n });\n }\n return compact<ArrayProperty>({\n ...base,\n type: \"array\",\n validation,\n of: uniqueByFields(jsonNodeProperty(item), node.validate?.uniqueBy),\n defaultValue: nodeDefault(node.default, isArray)\n });\n }\n case \"oneOf\":\n case \"unknown\":\n // A single typed block outside a list, and a value of any shape,\n // have no structured field; the free-form editor keeps them editable.\n return compact<MapProperty>({ ...freeFormJson(), ...base });\n }\n}\n\n// ── The column ───────────────────────────────────────────────────────────────\n\nfunction isTimeStampable(property: Property): property is DateProperty {\n return property.type === \"date\";\n}\n\n/**\n * The id strategy of a primary-key column: `uuid` for `gen_random_uuid()`,\n * `increment` for identity and serial columns, `true` for any other generated\n * default, `manual` when the value is typed in.\n */\nfunction idStrategy(column: ColumnDescriptor): \"uuid\" | \"increment\" | \"manual\" | true {\n const fallback = column.default;\n if (SERIAL_KINDS.has(column.type.kind) || fallback?.kind === \"identity\") return \"increment\";\n if (fallback?.kind === \"random-uuid\") return \"uuid\";\n if (fallback?.kind === \"sql\" || fallback?.kind === \"database\") return true;\n return \"manual\";\n}\n\nfunction applyId(property: Property, strategy: \"uuid\" | \"increment\" | \"manual\" | true): void {\n switch (property.type) {\n case \"string\":\n case \"number\":\n property.isId = strategy;\n return;\n case \"date\":\n property.isId = strategy === \"manual\" ? \"manual\" : true;\n return;\n default:\n return;\n }\n}\n\n/** A literal DEFAULT as the value a new record's form opens with. */\nfunction applyLiteralDefault(property: Property, value: unknown): void {\n switch (property.type) {\n case \"string\":\n if (isString(value) && (!property.enum || enumHas(property.enum, value))) property.defaultValue = value;\n return;\n case \"number\":\n if (isNumber(value)) property.defaultValue = value;\n return;\n case \"boolean\":\n if (isBoolean(value)) property.defaultValue = value;\n return;\n case \"date\": {\n if (!isString(value) && !isNumber(value)) return;\n const date = new Date(value);\n if (!Number.isNaN(date.getTime())) property.defaultValue = date;\n return;\n }\n case \"map\":\n if (isRecord(value)) property.defaultValue = { ...value };\n return;\n case \"array\":\n if (isArray(value)) property.defaultValue = [...value];\n return;\n default:\n return;\n }\n}\n\nfunction enumHas(values: StringProperty[\"enum\"], value: string): boolean {\n return Array.isArray(values) ? values.some(entry => entry.id === value) : true;\n}\n\nfunction applyStamp(property: Property, stamp: NonNullable<ColumnDescriptor[\"stamp\"]>): void {\n if (stamp.value === \"now\" && isTimeStampable(property)) {\n property.autoValue = stamp.on === \"create\" ? \"on_create\" : \"on_update\";\n // The record block shows both audit dates; a table column of them is noise.\n property.admin = { ...property.admin, readOnly: true, hideFromCollection: true };\n return;\n }\n if (stamp.value === \"user\" && property.type === \"string\") {\n property.autoValue = stamp.on === \"create\" ? \"user_on_create\" : \"user_on_update\";\n }\n property.admin = { ...property.admin, readOnly: true };\n}\n\n/**\n * A column as a property, or `undefined` for a column that must not reach the\n * panel (`private`: the server never serves one, and one that slips through is\n * dropped here rather than rendered).\n *\n * - `nullable: false` is `validation.required`, except where nobody types the\n * value: a generated id, a stamp, a generated or read-only column.\n * - A DEFAULT keeps the column required on edit and lets a create leave it out:\n * a literal opens the form with the value, anything else is `databaseDefault`.\n * - `readOnly`, `generated` and stamps are read-only in the form; time stamps\n * are also left out of the default table columns.\n * - The tenant column is filled by the server on create (`filledByServer`).\n * It stays editable and stays among the table columns, as an authored\n * collection's did: a caller in a bypass role creates rows in a tenant they\n * name.\n */\nexport function propertyFromColumn(column: ColumnDescriptor, context: ColumnProjectionContext): PostgresProperty | undefined {\n if (column.private) return undefined;\n\n const property = valueProperty(column.type, {\n validate: column.validate,\n oneOf: column.oneOf,\n storage: column.storage,\n json: column.json,\n semantic: column.semantic,\n vectorIndex: column.vectorIndex,\n element: column.element\n });\n property.name = labelFromIdentifier(column.key);\n if (column.description) property.description = column.description;\n if (column.key !== column.column) property.columnName = column.column;\n if (column.access) {\n property.access = compact({\n read: column.access.read ? [...column.access.read] : undefined,\n write: column.access.write ? [...column.access.write] : undefined\n });\n }\n\n const isKey = context.primaryKey.includes(column.key);\n const strategy = isKey ? idStrategy(column) : undefined;\n if (strategy !== undefined) applyId(property, strategy);\n const generatedKey = strategy !== undefined && strategy !== \"manual\";\n\n const writtenByServer = Boolean(column.readOnly || column.generated || column.stamp);\n if (column.stamp) applyStamp(property, column.stamp);\n if (column.readOnly || column.generated) property.admin = { ...property.admin, readOnly: true };\n\n const fallback = column.default;\n if (fallback && !generatedKey) {\n if (fallback.kind === \"literal\") applyLiteralDefault(property, fallback.value);\n else property.databaseDefault = fallback.kind === \"sql\" ? `sql\\`${fallback.expression}\\`` : true;\n }\n\n const validation: { required?: boolean; requiredMessage?: string; unique?: boolean } = {};\n if (!column.nullable && !generatedKey && !writtenByServer) validation.required = true;\n if (validation.required && column.validate?.requiredMessage) validation.requiredMessage = column.validate.requiredMessage;\n if (column.unique && !isKey) validation.unique = true;\n if (Object.keys(validation).length > 0) {\n property.validation = { ...property.validation, ...validation };\n }\n\n if (context.tenantField === column.key) {\n property.admin = { ...property.admin, filledByServer: true };\n }\n\n return compact(property);\n}\n"],"mappings":";;;;;;;;;;;AA2DA,SAAgB,eAAe,OAAkD;CAC7E,MAAM,SAAS,sBAAsB,OAAO,KAAK,CAAC;CAClD,OAAO,eAAe,MAAK,QAAO,YAAY,SAAS,MAAM;AACjE;;;;;AAMA,SAAgB,eAAe,QAAyD;CACpF,OAAO,OAAO,KAAI,WAAU;EACxB,IAAI;EACJ,OAAO,eAAe,KAAK;EAC3B,OAAO,eAAe,KAAK;CAC/B,EAAE;AACN;AAIA,SAAS,iBAAiB,OAAqC,QAAiD;CAC5G,MAAM,MAAsC,CAAC;CAC7C,IAAI,OAAO,OAAO,QAAQ,UAAU,IAAI,MAAM,MAAM;CACpD,IAAI,OAAO,OAAO,QAAQ,UAAU,IAAI,MAAM,MAAM;MAC/C,IAAI,WAAW,KAAA,GAAW,IAAI,MAAM;CACzC,IAAI,OAAO,WAAW,KAAA,GAAW,IAAI,SAAS,MAAM;CACpD,IAAI,OAAO,YAAY,KAAA,GACnB,IAAI,UAAU,MAAM,eAAe,IAAI,OAAO,MAAM,SAAS,MAAM,YAAY,IAAI,MAAM;CAE7F,IAAI,OAAO,mBAAmB,KAAA,GAAW,IAAI,iBAAiB,MAAM;CACpE,IAAI,OAAO,MAAM,IAAI,OAAO;CAC5B,IA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AS,QAAQ,QAAQ,SAAS,WAAW,MAAM;CAGhG,MAAM,aAAiF,CAAC;CACxF,IAAI,CAAC,OAAO,YAAY,CAAC,gBAAgB,CAAC,iBAAiB,WAAW,WAAW;CACjF,IAAI,WAAW,YAAY,OAAO,UAAU,iBAAiB,WAAW,kBAAkB,OAAO,SAAS;CAC1G,IAAI,OAAO,UAAU,CAAC,OAAO,WAAW,SAAS;CACjD,IAAI,OAAO,KAAK,UAAU,CAAC,CAAC,SAAS,GACjC,SAAS,aAAa;EAAE,GAAG,SAAS;EAAY,GAAG;CAAW;CAGlE,IAAI,QAAQ,gBAAgB,OAAO,KAC/B,SAAS,QAAQ;EAAE,GAAG,SAAS;EAAO,gBAAgB;CAAK;CAG/D,OAAO,QAAQ,QAAQ;AAC3B"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * `customizeTable`: a frontend file's deltas over the collection a Postgres
3
+ * table projects to (POSTGRES-FIRST.md §6.2).
4
+ *
5
+ * The types do the heavy checking — every key that names a field is checked
6
+ * against `typeof table` — so the runtime half is cheap and exists for the
7
+ * cases the compiler cannot see: a JavaScript caller, the untyped form, and the
8
+ * habits of the old `admin` block (a string component path, a lazy thunk,
9
+ * `propertiesOrder`). Each is refused with a message that says what to write.
10
+ */
11
+ import { type CustomizableTable, type TableCustomization, type TableCustomizationOptions, type TableSlug } from "@rebasepro/cms-types";
12
+ /**
13
+ * State what a table's default collection should look like in the panel.
14
+ *
15
+ * The first argument is the table's slug — the name it was defined under,
16
+ * unless `defineTable` was given another `slug`. With the type parameter every
17
+ * key that names a field, every enum label and every entity action's `row` is
18
+ * checked against the table:
19
+ *
20
+ * ```tsx
21
+ * export const postsCms = customizeTable<typeof posts>("posts", {
22
+ * icon: "FileText",
23
+ * kanban: { columnField: "status", orderField: "__order" },
24
+ * fields: { content: { Field: CustomMarkdownEditor } },
25
+ * });
26
+ * ```
27
+ *
28
+ * The slug is read from the table's type: for
29
+ * `defineTable("blog_posts", { slug: "posts", … })` the first argument is
30
+ * `"posts"`, still with the one type argument. Without a type argument the
31
+ * slug is any string and the options are accepted loosely typed.
32
+ *
33
+ * The result is frozen; pass it to `<RebaseCMS tableCustomizations>`. Unknown
34
+ * options, legacy `admin` names and components that are not values throw here,
35
+ * with what to write instead.
36
+ *
37
+ * @group Tables
38
+ */
39
+ export declare function customizeTable<T extends CustomizableTable | undefined = undefined>(slug: TableSlug<T>, options: NoInfer<TableCustomizationOptions<T>>): TableCustomization<T>;