@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
package/README.md CHANGED
@@ -16,7 +16,7 @@ of it resolves too: Node has supported `require(esm)` since 22.12.
16
16
 
17
17
  ## What This Package Does
18
18
 
19
- `@rebasepro/cms` is the complete CMS layer of Rebase. It provides the admin panel UI — collection table/card views, entity editing forms, side-panel navigation, the visual collection (schema) editor, data import/export (CSV, JSON, Excel), and the app shell with auth gating, routing, and drawer layout. It sits on top of `@rebasepro/app` (runtime hooks/providers) and `@rebasepro/ui` (design system components).
19
+ `@rebasepro/cms` is the complete CMS layer of Rebase. It renders every table the backend serves at `GET /api/schema/tables` with no configuration, changed per table by `customizeTable` (in a project's `frontend/src/cms/`), and Firestore collections passed as `externalCollections`. It provides the admin panel UI — table/card views, entity editing forms, side-panel navigation, the visual collection (schema) editor, data import/export (CSV, JSON, Excel), and the app shell with auth gating, routing, and drawer layout. It sits on top of `@rebasepro/app` (runtime hooks/providers) and `@rebasepro/ui` (design system components).
20
20
 
21
21
  ## Key Exports
22
22
 
@@ -24,7 +24,7 @@ of it resolves too: Node has supported `require(esm)` since 22.12.
24
24
 
25
25
  | Export | Description |
26
26
  |---|---|
27
- | `RebaseCMS` | Declares the CMS into the registry: `collections`, `views`, `homePage`, `entityViews`, `collectionViews`, `entityActions`, `collectionEditor`, `navigationGroupMappings`, `basePath`. Renders nothing; it sits inside `<Rebase>` |
27
+ | `RebaseCMS` | Declares the CMS into the registry: `tableCustomizations`, `externalCollections`, `tables` (embedding and tests), `views`, `homePage`, `entityViews`, `collectionViews`, `entityActions`, `collectionEditor`, `navigationGroupMappings`, `basePath`. Renders nothing; it sits inside `<Rebase>` |
28
28
  | `RebaseShell` | Composes `RebaseAuthGate`, `RebaseNavigation`, `RebaseRouteDefs` and `RebaseLayout` with sensible defaults |
29
29
  | `RebaseAuthGate` | Auth-gated wrapper — shows login or the CMS based on session state |
30
30
  | `RebaseNavigation` | Renders the sidebar navigation from resolved collections/views |
@@ -36,9 +36,9 @@ of it resolves too: Node has supported `require(esm)` since 22.12.
36
36
  | `DrawerFooterActions` | Footer action buttons inside the drawer |
37
37
  | `SideDialogs` | Stacked side-panel dialog system |
38
38
  | `AdminModeSyncer` | Syncs the admin mode (`"cms"` \| `"studio"`) with the current route |
39
- | `CollectionPanel` | Standalone collection browser panel — by slug, or with the collection as a value (`collection={postsCollection}`), anywhere under `<Rebase>` and a router |
39
+ | `CollectionPanel` | Standalone collection browser panel — a served table by its slug (`collection="posts"`), or an external collection as a value, anywhere under `<Rebase>` and a router |
40
40
  | `RecordForm` | One record's form, loaded by `id` (or new without one) and saved through `<Rebase>`'s data layer, with `onSaved` and `onClose` |
41
- | `CollectionsProvider` | The minimal scope for those two in a page of your own app: a registry of the collections you pass, and the side panels records open in. No `RebaseCMS`, `RebaseNavigation` or `RebaseShell` needed; any React Router router |
41
+ | `CollectionsProvider` | The minimal scope for those two in a page of your own app: a registry of the served tables (with your `tableCustomizations`) and your `externalCollections`, and the side panels records open in. No `RebaseCMS`, `RebaseNavigation` or `RebaseShell` needed; any React Router router |
42
42
 
43
43
  ### Entity & Collection Views
44
44
 
@@ -86,7 +86,7 @@ All exports from `./data_import` and `./data_export` — utilities for importing
86
86
 
87
87
  ### Collection Editor (Visual Schema Editor)
88
88
 
89
- All exports from `./collection_editor` — the visual schema editor UI for creating and editing collection definitions (properties, relations, validation rules) from within the CMS.
89
+ All exports from `./collection_editor` — the visual editor for a table and how the panel shows it. A save is split into `TablePatch` edits, which the server's schema editor writes into `backend/schema`, and UI preferences (labels, view modes, column order), which go to `/api/admin/ui-config`.
90
90
 
91
91
  Also available as a separate entry point:
92
92
 
@@ -130,7 +130,7 @@ function App() {
130
130
  return (
131
131
  <Rebase client={client} authController={authController}>
132
132
  <RebaseAuth />
133
- <RebaseCMS collections={[/* your collection configs */]} />
133
+ <RebaseCMS tableCustomizations={[/* customizeTable(...) results */]} />
134
134
  <RebaseShell title="Rebase" />
135
135
  </Rebase>
136
136
  );
@@ -141,7 +141,7 @@ function App() {
141
141
 
142
142
  - [`@rebasepro/app`](../app) — Runtime hooks, providers, auth components, and context
143
143
  - [`@rebasepro/ui`](../ui) — Design system components (buttons, dialogs, inputs, etc.)
144
- - [`@rebasepro/common`](../common) — Shared utilities, collection registry, query builder
144
+ - [`@rebasepro/common`](../common) — Shared utilities, the schema compiler, query builder
145
145
  - [`@rebasepro/types`](../types) — TypeScript type definitions
146
146
  - [`@rebasepro/forms`](../forms) — Form state management
147
- - [`@rebasepro/inference`](../inference) — Schema introspection from databases
147
+ - [`@rebasepro/inference`](../inference) — Infer fields from sample data (the "create from a file" import)
@@ -3,26 +3,30 @@ import { CollectionEditorDialogsContext } from "./CollectionEditorDialogsContext
3
3
  import React, { useCallback, useEffect, useMemo, useState } from "react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { deepEqual } from "fast-equals";
6
- import { getTableName } from "@rebasepro/common";
7
- import { useAuthController, useBridgeRegistration, useCustomizationController, useRebaseContext, useSnackbarController } from "@rebasepro/app";
6
+ import { useAuthController, useBridgeRegistration, useCustomizationController, useSnackbarController } from "@rebasepro/app";
8
7
  import { useNavigate } from "react-router";
9
8
  //#region src/collection_editor/ConfigControllerProvider.tsx
10
9
  var ConfigControllerContext = React.createContext({});
11
10
  var CollectionEditorContext = React.createContext({});
12
11
  var ConfigControllerProvider = React.memo(function ConfigControllerProvider({ children, collectionConfigController, collectionInference, extraView, getUser, getData, onAnalyticsEvent, pathSuggestions, generateCollection }) {
13
- const { databaseAdmin } = useRebaseContext();
14
12
  const authController = useAuthController();
15
- const [unmappedTables, setUnmappedTables] = useState([]);
16
- useBridgeRegistration("schemaEditing", useMemo(() => ({
17
- available: !collectionConfigController.readOnly,
18
- updateCollection: (collectionId, patch) => collectionConfigController.updateCollection({
19
- id: collectionId,
20
- collectionData: patch
21
- })
22
- }), [collectionConfigController]));
23
- const onFetchTableMetadata = useCallback(async (tableName) => {
24
- return databaseAdmin?.fetchTableMetadata?.(tableName);
25
- }, [databaseAdmin]);
13
+ /** The database's tables no declared table maps, as the schema editor lists them. */
14
+ const [unmapped, setUnmapped] = useState([]);
15
+ const unmappedTables = useMemo(() => unmapped.filter((table) => !table.unimportable).map((table) => table.table), [unmapped]);
16
+ useBridgeRegistration("schemaEditing", useMemo(() => {
17
+ const apply = collectionConfigController.applyTablePatches;
18
+ return {
19
+ available: !collectionConfigController.readOnly && apply !== void 0,
20
+ applyTablePatches: (table, patches) => apply ? apply(table, patches) : Promise.reject(/* @__PURE__ */ new Error("This collection editor does not write backend/schema."))
21
+ };
22
+ }, [collectionConfigController]));
23
+ /** One unmapped table as introspection describes it: what "Import an existing table" adopts. */
24
+ const onDescribeUnmappedTable = useCallback(async (tableName) => {
25
+ const describe = collectionConfigController.describeUnmappedTable;
26
+ const listed = unmapped.find((table) => table.table === tableName);
27
+ if (!describe || !listed) return void 0;
28
+ return describe(listed.schema, listed.table);
29
+ }, [collectionConfigController, unmapped]);
26
30
  const urlController = useUrlController();
27
31
  const navigate = useNavigate();
28
32
  const snackbarController = useSnackbarController();
@@ -37,17 +41,16 @@ var ConfigControllerProvider = React.memo(function ConfigControllerProvider({ ch
37
41
  * tables, for a list most sessions never see.
38
42
  */
39
43
  const newCollectionDialogOpen = Boolean(currentDialog?.isNewCollection);
44
+ const listUnmappedTables = collectionConfigController.listUnmappedTables;
40
45
  useEffect(() => {
41
46
  if (!newCollectionDialogOpen) return;
42
- if (!databaseAdmin?.fetchUnmappedTables || authController.initialLoading || !authController.user) return;
43
- const existingPaths = (collectionConfigController.collections ?? []).map((c) => getTableName(c) ?? "").filter(Boolean);
44
- databaseAdmin.fetchUnmappedTables(existingPaths).then((tables) => setUnmappedTables(tables)).catch((e) => console.warn("Could not fetch unmapped tables:", e));
47
+ if (!listUnmappedTables || authController.initialLoading || !authController.user) return;
48
+ listUnmappedTables().then((tables) => setUnmapped(tables)).catch((e) => console.warn("Could not fetch unmapped tables:", e));
45
49
  }, [
46
50
  newCollectionDialogOpen,
47
- databaseAdmin,
51
+ listUnmappedTables,
48
52
  authController.initialLoading,
49
- authController.user,
50
- collectionConfigController.collections
53
+ authController.user
51
54
  ]);
52
55
  const [currentPropertyDialog, setCurrentPropertyDialog] = React.useState();
53
56
  const editCollection = useCallback(({ id, path, parentCollectionSlugs, parentEntityIds, parentCollection, existingEntities, initialView, expandKanban }) => {
@@ -132,7 +135,7 @@ var ConfigControllerProvider = React.memo(function ConfigControllerProvider({ ch
132
135
  generateCollection,
133
136
  onAnalyticsEvent,
134
137
  unmappedTables,
135
- onFetchTableMetadata,
138
+ onDescribeUnmappedTable,
136
139
  handleClose: (collection) => {
137
140
  if (currentDialog?.redirect) {
138
141
  if (collection && currentDialog?.isNewCollection && !currentDialog.parentCollectionSlugs.length) {
@@ -153,7 +156,7 @@ var ConfigControllerProvider = React.memo(function ConfigControllerProvider({ ch
153
156
  generateCollection,
154
157
  onAnalyticsEvent,
155
158
  unmappedTables,
156
- onFetchTableMetadata,
159
+ onDescribeUnmappedTable,
157
160
  urlController,
158
161
  navigate
159
162
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigControllerProvider.js","names":[],"sources":["../../src/collection_editor/ConfigControllerProvider.tsx"],"sourcesContent":["import { useUrlController } from \"./_cms_internals\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { Entity, Property, TableMetadata, User } from \"@rebasepro/types\";\nimport { deepEqual as equal } from \"fast-equals\";\n\nimport { CollectionsConfigController } from \"./types/config_controller\";\nimport { useCustomizationController, useRebaseContext, useAuthController, useSnackbarController, useBridgeRegistration } from \"@rebasepro/app\";\nimport type { StudioSchemaEditing } from \"@rebasepro/app\";\nimport { getTableName } from \"@rebasepro/common\";\nimport { useNavigate } from \"react-router\";\nimport { CollectionEditorController } from \"./types/collection_editor_controller\";\nimport { CollectionInference } from \"./types/collection_inference\";\nimport { CollectionGenerationCallback } from \"./api/generateCollectionApi\";\nimport { CollectionEditorDialogsContext, CollectionEditorDialogsState } from \"./CollectionEditorDialogsContext\";\nimport type { AdminCollection } from \"@rebasepro/cms-types\";\n\nexport const ConfigControllerContext = React.createContext<CollectionsConfigController>({} as CollectionsConfigController);\nexport const CollectionEditorContext = React.createContext<CollectionEditorController>({} as CollectionEditorController);\n\nexport interface ConfigControllerProviderProps {\n /**\n * Controller for managing the collections' config.\n */\n collectionConfigController: CollectionsConfigController;\n\n /**\n * Callback used to infer the schema from the data.\n */\n collectionInference?: CollectionInference;\n\n extraView?: {\n View: React.ComponentType<{\n path: string\n }>,\n icon: React.ReactNode\n };\n\n pathSuggestions?: string[];\n\n getUser?: (uid: string) => User | null;\n\n getData?: (path: string, parentPaths: string[]) => Promise<object[]>;\n\n onAnalyticsEvent?: (event: string, params?: object) => void;\n\n /**\n * Callback function for generating/modifying collections.\n * The plugin is API-agnostic - the consumer provides the implementation.\n */\n generateCollection?: CollectionGenerationCallback;\n\n}\n\nexport const ConfigControllerProvider = React.memo(\n function ConfigControllerProvider({\n children,\n collectionConfigController,\n collectionInference,\n extraView,\n getUser,\n getData,\n onAnalyticsEvent,\n pathSuggestions,\n generateCollection\n }: ConfigControllerProviderProps & { children?: React.ReactNode }) {\n\n // Internal: fetch unmapped tables and table columns from the data source\n const { databaseAdmin } = useRebaseContext();\n const authController = useAuthController();\n const [unmappedTables, setUnmappedTables] = useState<string[]>([]);\n\n /**\n * Studio's writers, routed through the same plan/apply dialog the\n * collection editor uses.\n *\n * The RLS editor used to POST a mapped table's rules straight to\n * `/schema-editor/collection/save`: no plan, no confirmation, no sight\n * of the SQL — while the identical edit two tabs away showed all three.\n * Studio cannot import this controller (`@rebasepro/cms` is a *peer*\n * of `@rebasepro/studio`, and Studio has to run without it), so it\n * arrives over the bridge, and `available` is what a caller checks\n * before reaching for it.\n */\n const schemaEditing = useMemo<StudioSchemaEditing>(() => ({\n available: !collectionConfigController.readOnly,\n updateCollection: (collectionId, patch) =>\n collectionConfigController.updateCollection({\n id: collectionId,\n collectionData: patch as Record<string, never>\n })\n }), [collectionConfigController]);\n useBridgeRegistration(\"schemaEditing\", schemaEditing);\n\n const onFetchTableMetadata = useCallback(async (tableName: string): Promise<TableMetadata | undefined> => {\n return databaseAdmin?.fetchTableMetadata?.(tableName) as Promise<TableMetadata | undefined>;\n }, [databaseAdmin]);\n\n const urlController = useUrlController();\n const navigate = useNavigate();\n const snackbarController = useSnackbarController();\n const { propertyConfigs } = useCustomizationController();\n\n const [currentDialog, setCurrentDialog] = React.useState<{\n isNewCollection: boolean,\n parentCollection?: AdminCollection,\n editedCollectionId?: string,\n path?: string,\n parentCollectionSlugs: string[], parentEntityIds: string[],\n initialValues?: {\n path?: string,\n name?: string\n },\n copyFrom?: AdminCollection,\n redirect: boolean,\n existingEntities?: Entity[],\n pathSuggestions?: string[];\n initialView?: \"general\" | \"display\" | \"properties\";\n expandKanban?: boolean;\n }>();\n\n /**\n * The tables no collection maps, which the \"new collection\" dialog\n * offers to import — asked for when that dialog opens, and only then.\n * They were asked for on every admin page load, and again whenever\n * the collections or the user changed: `information_schema.tables`\n * and the junction-table query, ~50–70 ms of catalogue at 2,000\n * tables, for a list most sessions never see.\n */\n const newCollectionDialogOpen = Boolean(currentDialog?.isNewCollection);\n useEffect(() => {\n if (!newCollectionDialogOpen) return;\n if (!databaseAdmin?.fetchUnmappedTables || authController.initialLoading || !authController.user) return;\n const existingPaths = (collectionConfigController.collections ?? []).map(c => getTableName(c) ?? \"\").filter(Boolean);\n databaseAdmin.fetchUnmappedTables(existingPaths)\n .then((tables: string[]) => setUnmappedTables(tables))\n .catch((e: unknown) => console.warn(\"Could not fetch unmapped tables:\", e));\n }, [newCollectionDialogOpen, databaseAdmin, authController.initialLoading, authController.user, collectionConfigController.collections]);\n\n const [currentPropertyDialog, setCurrentPropertyDialog] = React.useState<{\n propertyKey?: string,\n property?: Property,\n namespace?: string,\n parentCollection?: AdminCollection,\n currentPropertiesOrder?: string[],\n editedCollectionId: string,\n path?: string,\n parentCollectionSlugs: string[], parentEntityIds: string[],\n\n existingEntities?: Entity[];\n collection?: AdminCollection;\n }>();\n\n const editCollection = useCallback(({\n id,\n path,\n parentCollectionSlugs, parentEntityIds,\n parentCollection,\n existingEntities,\n initialView,\n expandKanban\n }: {\n id?: string,\n path?: string,\n parentCollectionSlugs: string[], parentEntityIds: string[],\n parentCollection?: AdminCollection,\n existingEntities?: Entity[],\n initialView?: \"general\" | \"display\" | \"properties\",\n expandKanban?: boolean\n }) => {\n console.debug(\"Edit collection\", id, path, parentCollectionSlugs, parentEntityIds, parentCollection);\n onAnalyticsEvent?.(\"edit_collection\", {\n id,\n path\n });\n setCurrentDialog({\n editedCollectionId: id,\n path,\n parentCollectionSlugs,\nparentEntityIds,\n isNewCollection: false,\n parentCollection,\n redirect: false,\n existingEntities,\n pathSuggestions,\n initialView,\n expandKanban\n });\n }, [onAnalyticsEvent, pathSuggestions]);\n\n const editProperty = useCallback(({\n propertyKey,\n property,\n editedCollectionId,\n currentPropertiesOrder,\n parentCollectionSlugs, parentEntityIds,\n collection,\n existingEntities\n }: {\n propertyKey?: string,\n property?: Property,\n currentPropertiesOrder?: string[],\n editedCollectionId: string,\n parentCollectionSlugs: string[], parentEntityIds: string[],\n collection: AdminCollection,\n existingEntities?: Entity[]\n }) => {\n console.debug(\"Edit property\", propertyKey, property, editedCollectionId, currentPropertiesOrder, parentCollectionSlugs, parentEntityIds, collection);\n onAnalyticsEvent?.(\"edit_property\", {\n propertyKey,\n editedCollectionId\n });\n // namespace is all the path until the last dot\n const namespace = propertyKey && propertyKey.includes(\".\")\n ? propertyKey.substring(0, propertyKey.lastIndexOf(\".\"))\n : undefined;\n const propertyKeyWithoutNamespace = propertyKey && propertyKey.includes(\".\")\n ? propertyKey.substring(propertyKey.lastIndexOf(\".\") + 1)\n : propertyKey;\n setCurrentPropertyDialog({\n propertyKey: propertyKeyWithoutNamespace,\n property,\n namespace,\n currentPropertiesOrder,\n editedCollectionId,\n parentCollectionSlugs,\nparentEntityIds,\n\n existingEntities,\n collection\n });\n }, [onAnalyticsEvent]);\n\n const createCollection = useCallback(({\n parentCollectionSlugs, parentEntityIds,\n parentCollection,\n initialValues,\n copyFrom,\n redirect,\n sourceClick\n }: {\n parentCollectionSlugs: string[], parentEntityIds: string[],\n parentCollection?: AdminCollection\n initialValues?: {\n path?: string,\n name?: string\n },\n copyFrom?: AdminCollection,\n redirect: boolean,\n sourceClick?: string\n }) => {\n console.debug(\"Create collection\", {\n parentCollectionSlugs,\nparentEntityIds,\n parentCollection,\n initialValues,\n copyFrom,\n redirect,\n sourceClick\n });\n onAnalyticsEvent?.(copyFrom ? \"duplicate_collection\" : \"create_collection\", {\n parentCollectionSlugs,\nparentEntityIds,\n parentCollection,\n initialValues,\n redirect,\n sourceClick\n });\n setCurrentDialog({\n isNewCollection: true,\n parentCollectionSlugs,\nparentEntityIds,\n parentCollection,\n initialValues,\n copyFrom,\n redirect,\n pathSuggestions\n });\n }, [onAnalyticsEvent, pathSuggestions]);\n\n // Build the dialog props objects that will be consumed by\n // CollectionEditorDialogs (rendered inside RebaseShell where admin\n // contexts are available).\n const collectionDialogProps = useMemo(() => {\n if (!currentDialog) return undefined;\n return {\n open: true,\n configController: collectionConfigController,\n collectionInference,\n ...currentDialog,\n getData,\n extraView,\n getUser,\n generateCollection,\n onAnalyticsEvent,\n unmappedTables,\n onFetchTableMetadata,\n handleClose: (collection?: AdminCollection) => {\n if (currentDialog?.redirect) {\n if (collection && currentDialog?.isNewCollection && !currentDialog.parentCollectionSlugs.length) {\n const url = urlController.buildUrlCollectionPath(collection.slug);\n navigate(url);\n }\n }\n setCurrentDialog(undefined);\n }\n };\n }, [\n currentDialog, collectionConfigController, collectionInference,\n getData, extraView, getUser, generateCollection,\n onAnalyticsEvent, unmappedTables, onFetchTableMetadata,\n urlController, navigate\n ]);\n\n const propertyDialogProps = useMemo(() => {\n if (!currentPropertyDialog) return undefined;\n return {\n open: true,\n includeIdAndName: true,\n existingProperty: Boolean(currentPropertyDialog.propertyKey),\n autoUpdateId: !currentPropertyDialog.propertyKey,\n autoOpenTypeSelect: !currentPropertyDialog.propertyKey,\n inArray: false,\n getData: currentPropertyDialog.existingEntities || (getData && currentPropertyDialog.editedCollectionId)\n ? async () => {\n let data: object[] = [];\n if (currentPropertyDialog.existingEntities) {\n data = currentPropertyDialog.existingEntities.map(e => e.values);\n }\n if (getData && currentPropertyDialog.editedCollectionId) {\n console.debug(\"Get data for property, path:\", currentPropertyDialog.editedCollectionId);\n const resolvedPath = urlController.resolveDatabasePathsFrom(currentPropertyDialog.editedCollectionId!);\n const fetchedData = await getData(resolvedPath, []);\n data.push(...fetchedData);\n }\n return data;\n }\n : undefined,\n onPropertyChanged: ({\n id,\n property\n }: { id?: string; property: Property }) => {\n if (!currentPropertyDialog) return;\n if (!id) return;\n const newProperty = !(currentPropertyDialog.propertyKey);\n return collectionConfigController.saveProperty({\n path: currentPropertyDialog.editedCollectionId,\n property,\n propertyKey: id,\n newPropertiesOrder: newProperty && currentPropertyDialog.currentPropertiesOrder ? [...currentPropertyDialog.currentPropertiesOrder, id] : undefined,\n namespace: currentPropertyDialog.namespace,\n parentCollectionSlugs: currentPropertyDialog.parentCollectionSlugs\n })\n .catch((e: any) => {\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error persisting property: \" + (e.message ?? \"Details in the console\")\n });\n return false;\n });\n },\n onPropertyChangedImmediate: false,\n onDelete: () => {\n if (!currentPropertyDialog.propertyKey) return;\n const newPropertiesOrder = currentPropertyDialog.currentPropertiesOrder?.filter((p: string) => p !== currentPropertyDialog.propertyKey);\n return collectionConfigController.deleteProperty({\n path: currentPropertyDialog.editedCollectionId,\n propertyKey: currentPropertyDialog.propertyKey,\n namespace: currentPropertyDialog.namespace,\n newPropertiesOrder,\n parentCollectionSlugs: currentPropertyDialog.parentCollectionSlugs\n })\n .then(() => {\n setCurrentPropertyDialog(undefined);\n }).catch((e: any) => {\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error deleting property: \" + (e.message ?? \"Details in the console\")\n });\n return false;\n });\n },\n onError: () => { },\n onOkClicked: () => {\n setCurrentPropertyDialog(undefined);\n },\n onCancel: () => {\n setCurrentPropertyDialog(undefined);\n },\n initialErrors: {},\n forceShowErrors: false,\n existingPropertyKeys: currentPropertyDialog.collection?.properties ? Object.keys(currentPropertyDialog.collection.properties) : [],\n allowDataInference: true,\n propertyConfigs,\n property: currentPropertyDialog.property,\n propertyKey: currentPropertyDialog.propertyKey\n };\n }, [currentPropertyDialog, getData, urlController, collectionConfigController, snackbarController, propertyConfigs]);\n\n const dialogsState: CollectionEditorDialogsState = useMemo(() => ({\n collectionDialogProps,\n propertyDialogProps\n }), [collectionDialogProps, propertyDialogProps]);\n\n const collectionEditorContextValue = useMemo(() => ({\n editCollection,\n createCollection,\n editProperty,\n pathSuggestions,\n configController: collectionConfigController\n }), [editCollection, createCollection, editProperty, pathSuggestions, collectionConfigController]);\n\n return (\n <ConfigControllerContext.Provider value={collectionConfigController}>\n <CollectionEditorContext.Provider value={collectionEditorContextValue}>\n <CollectionEditorDialogsContext.Provider value={dialogsState}>\n {children}\n {/* Rendered here rather than by each consumer: a\n controller that has to ask before it writes needs\n somewhere to ask, and this is the one component that\n wraps every editor surface. */}\n {collectionConfigController.dialog}\n </CollectionEditorDialogsContext.Provider>\n </CollectionEditorContext.Provider>\n </ConfigControllerContext.Provider>\n );\n }, equal);\n"],"mappings":";;;;;;;;;AAgBA,IAAa,0BAA0B,MAAM,cAA2C,CAAC,CAAgC;AACzH,IAAa,0BAA0B,MAAM,cAA0C,CAAC,CAA+B;AAoCvH,IAAa,2BAA2B,MAAM,KAC1C,SAAS,yBAAyB,EAC9B,UACA,4BACA,qBACA,WACA,SACA,SACA,kBACA,iBACA,sBAC+D;CAG/D,MAAM,EAAE,kBAAkB,iBAAiB;CAC3C,MAAM,iBAAiB,kBAAkB;CACzC,MAAM,CAAC,gBAAgB,qBAAqB,SAAmB,CAAC,CAAC;CAsBjE,sBAAsB,iBARA,eAAoC;EACtD,WAAW,CAAC,2BAA2B;EACvC,mBAAmB,cAAc,UAC7B,2BAA2B,iBAAiB;GACxC,IAAI;GACJ,gBAAgB;EACpB,CAAC;CACT,IAAI,CAAC,0BAA0B,CACQ,CAAa;CAEpD,MAAM,uBAAuB,YAAY,OAAO,cAA0D;EACtG,OAAO,eAAe,qBAAqB,SAAS;CACxD,GAAG,CAAC,aAAa,CAAC;CAElB,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,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ACjB,QAAQ,MAAM,CAAC;KACf,mBAAmB,KAAK;MACpB,MAAM;MACN,SAAS,+BAA+B,EAAE,WAAW;KACzD,CAAC;KACD,OAAO;IACX,CAAC;GACT;GACA,eAAe,CAAE;GACjB,mBAAmB;IACf,yBAAyB,KAAA,CAAS;GACtC;GACA,gBAAgB;IACZ,yBAAyB,KAAA,CAAS;GACtC;GACA,eAAe,CAAC;GAChB,iBAAiB;GACjB,sBAAsB,sBAAsB,YAAY,aAAa,OAAO,KAAK,sBAAsB,WAAW,UAAU,IAAI,CAAC;GACjI,oBAAoB;GACpB;GACA,UAAU,sBAAsB;GAChC,aAAa,sBAAsB;EACvC;CACJ,GAAG;EAAC;EAAuB;EAAS;EAAe;EAA4B;EAAoB;CAAe,CAAC;CAEnH,MAAM,eAA6C,eAAe;EAC9D;EACA;CACJ,IAAI,CAAC,uBAAuB,mBAAmB,CAAC;CAEhD,MAAM,+BAA+B,eAAe;EAChD;EACA;EACA;EACA;EACA,kBAAkB;CACtB,IAAI;EAAC;EAAgB;EAAkB;EAAc;EAAiB;CAA0B,CAAC;CAEjG,OACI,oBAAC,wBAAwB,UAAzB;EAAkC,OAAO;YACrC,oBAAC,wBAAwB,UAAzB;GAAkC,OAAO;aACrC,qBAAC,+BAA+B,UAAhC;IAAyC,OAAO;cAAhD,CACK,UAKA,2BAA2B,MACS;;EACX,CAAA;CACJ,CAAA;AAE1C,GAAG,SAAK"}
1
+ {"version":3,"file":"ConfigControllerProvider.js","names":[],"sources":["../../src/collection_editor/ConfigControllerProvider.tsx"],"sourcesContent":["import { useUrlController } from \"./_cms_internals\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { UnmappedTable, User } from \"@rebasepro/types\";\nimport { Property, Entity } from \"@rebasepro/cms-types\";\nimport { deepEqual as equal } from \"fast-equals\";\n\nimport { CollectionsConfigController, ImportedTable } from \"./types/config_controller\";\nimport { useCustomizationController, useAuthController, useSnackbarController, useBridgeRegistration } from \"@rebasepro/app\";\nimport type { StudioSchemaEditing } from \"@rebasepro/app\";\nimport { useNavigate } from \"react-router\";\nimport { CollectionEditorController } from \"./types/collection_editor_controller\";\nimport { CollectionInference } from \"./types/collection_inference\";\nimport { CollectionGenerationCallback } from \"./api/generateCollectionApi\";\nimport { CollectionEditorDialogsContext, CollectionEditorDialogsState } from \"./CollectionEditorDialogsContext\";\nimport type { AdminCollection } from \"@rebasepro/cms-types\";\n\nexport const ConfigControllerContext = React.createContext<CollectionsConfigController>({} as CollectionsConfigController);\nexport const CollectionEditorContext = React.createContext<CollectionEditorController>({} as CollectionEditorController);\n\nexport interface ConfigControllerProviderProps {\n /**\n * Controller for managing the collections' config.\n */\n collectionConfigController: CollectionsConfigController;\n\n /**\n * Callback used to infer the schema from the data.\n */\n collectionInference?: CollectionInference;\n\n extraView?: {\n View: React.ComponentType<{\n path: string\n }>,\n icon: React.ReactNode\n };\n\n pathSuggestions?: string[];\n\n getUser?: (uid: string) => User | null;\n\n getData?: (path: string, parentPaths: string[]) => Promise<object[]>;\n\n onAnalyticsEvent?: (event: string, params?: object) => void;\n\n /**\n * Callback function for generating/modifying collections.\n * The plugin is API-agnostic - the consumer provides the implementation.\n */\n generateCollection?: CollectionGenerationCallback;\n\n}\n\nexport const ConfigControllerProvider = React.memo(\n function ConfigControllerProvider({\n children,\n collectionConfigController,\n collectionInference,\n extraView,\n getUser,\n getData,\n onAnalyticsEvent,\n pathSuggestions,\n generateCollection\n }: ConfigControllerProviderProps & { children?: React.ReactNode }) {\n\n const authController = useAuthController();\n /** The database's tables no declared table maps, as the schema editor lists them. */\n const [unmapped, setUnmapped] = useState<UnmappedTable[]>([]);\n const unmappedTables = useMemo(() => unmapped.filter(table => !table.unimportable).map(table => table.table), [unmapped]);\n\n /**\n * Studio's writers, routed through the same plan/apply dialog the\n * collection editor uses.\n *\n * The RLS editor used to POST a mapped table's rules straight to\n * `/schema-editor/collection/save`: no plan, no confirmation, no sight\n * of the SQL — while the identical edit two tabs away showed all three.\n * Studio cannot import this controller (`@rebasepro/cms` is a *peer*\n * of `@rebasepro/studio`, and Studio has to run without it), so it\n * arrives over the bridge, and `available` is what a caller checks\n * before reaching for it.\n */\n const schemaEditing = useMemo<StudioSchemaEditing>(() => {\n const apply = collectionConfigController.applyTablePatches;\n return {\n available: !collectionConfigController.readOnly && apply !== undefined,\n applyTablePatches: (table, patches) => apply\n ? apply(table, patches)\n : Promise.reject(new Error(\"This collection editor does not write backend/schema.\"))\n };\n }, [collectionConfigController]);\n useBridgeRegistration(\"schemaEditing\", schemaEditing);\n\n /** One unmapped table as introspection describes it: what \"Import an existing table\" adopts. */\n const onDescribeUnmappedTable = useCallback(async (tableName: string): Promise<ImportedTable | undefined> => {\n const describe = collectionConfigController.describeUnmappedTable;\n const listed = unmapped.find(table => table.table === tableName);\n if (!describe || !listed) return undefined;\n return describe(listed.schema, listed.table);\n }, [collectionConfigController, unmapped]);\n\n const urlController = useUrlController();\n const navigate = useNavigate();\n const snackbarController = useSnackbarController();\n const { propertyConfigs } = useCustomizationController();\n\n const [currentDialog, setCurrentDialog] = React.useState<{\n isNewCollection: boolean,\n parentCollection?: AdminCollection,\n editedCollectionId?: string,\n path?: string,\n parentCollectionSlugs: string[], parentEntityIds: string[],\n initialValues?: {\n path?: string,\n name?: string\n },\n copyFrom?: AdminCollection,\n redirect: boolean,\n existingEntities?: Entity[],\n pathSuggestions?: string[];\n initialView?: \"general\" | \"display\" | \"properties\";\n expandKanban?: boolean;\n }>();\n\n /**\n * The tables no collection maps, which the \"new collection\" dialog\n * offers to import — asked for when that dialog opens, and only then.\n * They were asked for on every admin page load, and again whenever\n * the collections or the user changed: `information_schema.tables`\n * and the junction-table query, ~50–70 ms of catalogue at 2,000\n * tables, for a list most sessions never see.\n */\n const newCollectionDialogOpen = Boolean(currentDialog?.isNewCollection);\n const listUnmappedTables = collectionConfigController.listUnmappedTables;\n useEffect(() => {\n if (!newCollectionDialogOpen) return;\n if (!listUnmappedTables || authController.initialLoading || !authController.user) return;\n listUnmappedTables()\n .then(tables => setUnmapped(tables))\n .catch((e: unknown) => console.warn(\"Could not fetch unmapped tables:\", e));\n }, [newCollectionDialogOpen, listUnmappedTables, authController.initialLoading, authController.user]);\n\n const [currentPropertyDialog, setCurrentPropertyDialog] = React.useState<{\n propertyKey?: string,\n property?: Property,\n namespace?: string,\n parentCollection?: AdminCollection,\n currentPropertiesOrder?: string[],\n editedCollectionId: string,\n path?: string,\n parentCollectionSlugs: string[], parentEntityIds: string[],\n\n existingEntities?: Entity[];\n collection?: AdminCollection;\n }>();\n\n const editCollection = useCallback(({\n id,\n path,\n parentCollectionSlugs, parentEntityIds,\n parentCollection,\n existingEntities,\n initialView,\n expandKanban\n }: {\n id?: string,\n path?: string,\n parentCollectionSlugs: string[], parentEntityIds: string[],\n parentCollection?: AdminCollection,\n existingEntities?: Entity[],\n initialView?: \"general\" | \"display\" | \"properties\",\n expandKanban?: boolean\n }) => {\n console.debug(\"Edit collection\", id, path, parentCollectionSlugs, parentEntityIds, parentCollection);\n onAnalyticsEvent?.(\"edit_collection\", {\n id,\n path\n });\n setCurrentDialog({\n editedCollectionId: id,\n path,\n parentCollectionSlugs,\nparentEntityIds,\n isNewCollection: false,\n parentCollection,\n redirect: false,\n existingEntities,\n pathSuggestions,\n initialView,\n expandKanban\n });\n }, [onAnalyticsEvent, pathSuggestions]);\n\n const editProperty = useCallback(({\n propertyKey,\n property,\n editedCollectionId,\n currentPropertiesOrder,\n parentCollectionSlugs, parentEntityIds,\n collection,\n existingEntities\n }: {\n propertyKey?: string,\n property?: Property,\n currentPropertiesOrder?: string[],\n editedCollectionId: string,\n parentCollectionSlugs: string[], parentEntityIds: string[],\n collection: AdminCollection,\n existingEntities?: Entity[]\n }) => {\n console.debug(\"Edit property\", propertyKey, property, editedCollectionId, currentPropertiesOrder, parentCollectionSlugs, parentEntityIds, collection);\n onAnalyticsEvent?.(\"edit_property\", {\n propertyKey,\n editedCollectionId\n });\n // namespace is all the path until the last dot\n const namespace = propertyKey && propertyKey.includes(\".\")\n ? propertyKey.substring(0, propertyKey.lastIndexOf(\".\"))\n : undefined;\n const propertyKeyWithoutNamespace = propertyKey && propertyKey.includes(\".\")\n ? propertyKey.substring(propertyKey.lastIndexOf(\".\") + 1)\n : propertyKey;\n setCurrentPropertyDialog({\n propertyKey: propertyKeyWithoutNamespace,\n property,\n namespace,\n currentPropertiesOrder,\n editedCollectionId,\n parentCollectionSlugs,\nparentEntityIds,\n\n existingEntities,\n collection\n });\n }, [onAnalyticsEvent]);\n\n const createCollection = useCallback(({\n parentCollectionSlugs, parentEntityIds,\n parentCollection,\n initialValues,\n copyFrom,\n redirect,\n sourceClick\n }: {\n parentCollectionSlugs: string[], parentEntityIds: string[],\n parentCollection?: AdminCollection\n initialValues?: {\n path?: string,\n name?: string\n },\n copyFrom?: AdminCollection,\n redirect: boolean,\n sourceClick?: string\n }) => {\n console.debug(\"Create collection\", {\n parentCollectionSlugs,\nparentEntityIds,\n parentCollection,\n initialValues,\n copyFrom,\n redirect,\n sourceClick\n });\n onAnalyticsEvent?.(copyFrom ? \"duplicate_collection\" : \"create_collection\", {\n parentCollectionSlugs,\nparentEntityIds,\n parentCollection,\n initialValues,\n redirect,\n sourceClick\n });\n setCurrentDialog({\n isNewCollection: true,\n parentCollectionSlugs,\nparentEntityIds,\n parentCollection,\n initialValues,\n copyFrom,\n redirect,\n pathSuggestions\n });\n }, [onAnalyticsEvent, pathSuggestions]);\n\n // Build the dialog props objects that will be consumed by\n // CollectionEditorDialogs (rendered inside RebaseShell where admin\n // contexts are available).\n const collectionDialogProps = useMemo(() => {\n if (!currentDialog) return undefined;\n return {\n open: true,\n configController: collectionConfigController,\n collectionInference,\n ...currentDialog,\n getData,\n extraView,\n getUser,\n generateCollection,\n onAnalyticsEvent,\n unmappedTables,\n onDescribeUnmappedTable,\n handleClose: (collection?: AdminCollection) => {\n if (currentDialog?.redirect) {\n if (collection && currentDialog?.isNewCollection && !currentDialog.parentCollectionSlugs.length) {\n const url = urlController.buildUrlCollectionPath(collection.slug);\n navigate(url);\n }\n }\n setCurrentDialog(undefined);\n }\n };\n }, [\n currentDialog, collectionConfigController, collectionInference,\n getData, extraView, getUser, generateCollection,\n onAnalyticsEvent, unmappedTables, onDescribeUnmappedTable,\n urlController, navigate\n ]);\n\n const propertyDialogProps = useMemo(() => {\n if (!currentPropertyDialog) return undefined;\n return {\n open: true,\n includeIdAndName: true,\n existingProperty: Boolean(currentPropertyDialog.propertyKey),\n autoUpdateId: !currentPropertyDialog.propertyKey,\n autoOpenTypeSelect: !currentPropertyDialog.propertyKey,\n inArray: false,\n getData: currentPropertyDialog.existingEntities || (getData && currentPropertyDialog.editedCollectionId)\n ? async () => {\n let data: object[] = [];\n if (currentPropertyDialog.existingEntities) {\n data = currentPropertyDialog.existingEntities.map(e => e.values);\n }\n if (getData && currentPropertyDialog.editedCollectionId) {\n console.debug(\"Get data for property, path:\", currentPropertyDialog.editedCollectionId);\n const resolvedPath = urlController.resolveDatabasePathsFrom(currentPropertyDialog.editedCollectionId!);\n const fetchedData = await getData(resolvedPath, []);\n data.push(...fetchedData);\n }\n return data;\n }\n : undefined,\n onPropertyChanged: ({\n id,\n property\n }: { id?: string; property: Property }) => {\n if (!currentPropertyDialog) return;\n if (!id) return;\n const newProperty = !(currentPropertyDialog.propertyKey);\n return collectionConfigController.saveProperty({\n path: currentPropertyDialog.editedCollectionId,\n property,\n propertyKey: id,\n newPropertiesOrder: newProperty && currentPropertyDialog.currentPropertiesOrder ? [...currentPropertyDialog.currentPropertiesOrder, id] : undefined,\n namespace: currentPropertyDialog.namespace,\n parentCollectionSlugs: currentPropertyDialog.parentCollectionSlugs\n })\n .catch((e: any) => {\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error persisting property: \" + (e.message ?? \"Details in the console\")\n });\n return false;\n });\n },\n onPropertyChangedImmediate: false,\n onDelete: () => {\n if (!currentPropertyDialog.propertyKey) return;\n const newPropertiesOrder = currentPropertyDialog.currentPropertiesOrder?.filter((p: string) => p !== currentPropertyDialog.propertyKey);\n return collectionConfigController.deleteProperty({\n path: currentPropertyDialog.editedCollectionId,\n propertyKey: currentPropertyDialog.propertyKey,\n namespace: currentPropertyDialog.namespace,\n newPropertiesOrder,\n parentCollectionSlugs: currentPropertyDialog.parentCollectionSlugs\n })\n .then(() => {\n setCurrentPropertyDialog(undefined);\n }).catch((e: any) => {\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error deleting property: \" + (e.message ?? \"Details in the console\")\n });\n return false;\n });\n },\n onError: () => { },\n onOkClicked: () => {\n setCurrentPropertyDialog(undefined);\n },\n onCancel: () => {\n setCurrentPropertyDialog(undefined);\n },\n initialErrors: {},\n forceShowErrors: false,\n existingPropertyKeys: currentPropertyDialog.collection?.properties ? Object.keys(currentPropertyDialog.collection.properties) : [],\n allowDataInference: true,\n propertyConfigs,\n property: currentPropertyDialog.property,\n propertyKey: currentPropertyDialog.propertyKey\n };\n }, [currentPropertyDialog, getData, urlController, collectionConfigController, snackbarController, propertyConfigs]);\n\n const dialogsState: CollectionEditorDialogsState = useMemo(() => ({\n collectionDialogProps,\n propertyDialogProps\n }), [collectionDialogProps, propertyDialogProps]);\n\n const collectionEditorContextValue = useMemo(() => ({\n editCollection,\n createCollection,\n editProperty,\n pathSuggestions,\n configController: collectionConfigController\n }), [editCollection, createCollection, editProperty, pathSuggestions, collectionConfigController]);\n\n return (\n <ConfigControllerContext.Provider value={collectionConfigController}>\n <CollectionEditorContext.Provider value={collectionEditorContextValue}>\n <CollectionEditorDialogsContext.Provider value={dialogsState}>\n {children}\n {/* Rendered here rather than by each consumer: a\n controller that has to ask before it writes needs\n somewhere to ask, and this is the one component that\n wraps every editor surface. */}\n {collectionConfigController.dialog}\n </CollectionEditorDialogsContext.Provider>\n </CollectionEditorContext.Provider>\n </ConfigControllerContext.Provider>\n );\n }, equal);\n"],"mappings":";;;;;;;;AAgBA,IAAa,0BAA0B,MAAM,cAA2C,CAAC,CAAgC;AACzH,IAAa,0BAA0B,MAAM,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B;CAAe,CAAC;CAEnH,MAAM,eAA6C,eAAe;EAC9D;EACA;CACJ,IAAI,CAAC,uBAAuB,mBAAmB,CAAC;CAEhD,MAAM,+BAA+B,eAAe;EAChD;EACA;EACA;EACA;EACA,kBAAkB;CACtB,IAAI;EAAC;EAAgB;EAAkB;EAAc;EAAiB;CAA0B,CAAC;CAEjG,OACI,oBAAC,wBAAwB,UAAzB;EAAkC,OAAO;YACrC,oBAAC,wBAAwB,UAAzB;GAAkC,OAAO;aACrC,qBAAC,+BAA+B,UAAhC;IAAyC,OAAO;cAAhD,CACK,UAKA,2BAA2B,MACS;;EACX,CAAA;CACJ,CAAA;AAE1C,GAAG,SAAK"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The name of the call a Firestore collection is declared with, in a module of
3
+ * its own: the collection editor's controller lists those calls on the eager
4
+ * path, while `firestore_edit` (and the `split_edit` it imports) load with the
5
+ * first save of a Firestore collection.
6
+ *
7
+ * @module
8
+ */
9
+ /** The call a Firestore collection is declared with. */
10
+ export declare const FIRESTORE_COLLECTION_CALLEE = "defineFirestoreCollection";
@@ -0,0 +1,15 @@
1
+ //#region src/collection_editor/firestore_callee.ts
2
+ /**
3
+ * The name of the call a Firestore collection is declared with, in a module of
4
+ * its own: the collection editor's controller lists those calls on the eager
5
+ * path, while `firestore_edit` (and the `split_edit` it imports) load with the
6
+ * first save of a Firestore collection.
7
+ *
8
+ * @module
9
+ */
10
+ /** The call a Firestore collection is declared with. */
11
+ var FIRESTORE_COLLECTION_CALLEE = "defineFirestoreCollection";
12
+ //#endregion
13
+ export { FIRESTORE_COLLECTION_CALLEE };
14
+
15
+ //# sourceMappingURL=firestore_callee.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firestore_callee.js","names":[],"sources":["../../src/collection_editor/firestore_callee.ts"],"sourcesContent":["/**\n * The name of the call a Firestore collection is declared with, in a module of\n * its own: the collection editor's controller lists those calls on the eager\n * path, while `firestore_edit` (and the `split_edit` it imports) load with the\n * first save of a Firestore collection.\n *\n * @module\n */\n\n/** The call a Firestore collection is declared with. */\nexport const FIRESTORE_COLLECTION_CALLEE = \"defineFirestoreCollection\";\n"],"mappings":";;;;;;;;;;AAUA,IAAa,8BAA8B"}
@@ -0,0 +1,62 @@
1
+ import type { AdminCollection, FirestoreCollectionPatch, FirestorePatchValue, Property } from "@rebasepro/cms-types";
2
+ /**
3
+ * The frontend source editor's wire (`POST /admin/schema-editor/frontend/apply`):
4
+ * operations on paths into the object argument of the call `target` names.
5
+ */
6
+ export interface FrontendSourceEditRequest {
7
+ target: {
8
+ callee: string;
9
+ key: string;
10
+ value: string;
11
+ };
12
+ /** The file's version as the panel read it: a file changed since is refused. */
13
+ version?: string;
14
+ operations: FrontendSourceOperation[];
15
+ }
16
+ /** One operation of a {@link FrontendSourceEditRequest}. */
17
+ export type FrontendSourceOperation = {
18
+ op: "set";
19
+ path: string[];
20
+ value: FirestorePatchValue;
21
+ before?: string;
22
+ } | {
23
+ op: "remove";
24
+ path: string[];
25
+ prune?: boolean;
26
+ } | {
27
+ op: "rename";
28
+ path: string[];
29
+ to: string;
30
+ } | {
31
+ op: "move";
32
+ path: string[];
33
+ before?: string;
34
+ };
35
+ /**
36
+ * A property as the field a `defineFirestoreCollection` call writes:
37
+ * presentation keys under `admin`, `validation.required` as `required`, a
38
+ * reference's `path` as `target`, nested fields the same way.
39
+ */
40
+ export declare function firestoreFieldOf(property: Property): Record<string, unknown>;
41
+ /**
42
+ * The patches that turn the Firestore collection `before` into `after`, as
43
+ * the editor saves it.
44
+ *
45
+ * - Collection options (`name`, `path`, `description`, the `admin` block)
46
+ * are `setOption` / `removeOption` at the path that changed.
47
+ * - A new field is `addField`, a removed one `removeField`; a changed field
48
+ * is `setFieldOption` / `removeFieldOption` at each path that changed
49
+ * inside it.
50
+ * - The field order the editor shows becomes `moveField`s when the file has
51
+ * no `admin.propertiesOrder` of its own (which is set like any option).
52
+ *
53
+ * @throws {@link SplitEditError} `MIGRATION_REQUIRED` for a slug change (it is
54
+ * the collection's URL, its reference target and what the file is found
55
+ * by), `EDITED_IN_CODE` for a changed value that is code.
56
+ */
57
+ export declare function firestoreCollectionPatches(before: AdminCollection, after: AdminCollection): FirestoreCollectionPatch[];
58
+ /**
59
+ * The frontend source edit that writes `patches` into the collection's
60
+ * `defineFirestoreCollection` call, found by its slug.
61
+ */
62
+ export declare function firestoreSourceEdit(slug: string, patches: readonly FirestoreCollectionPatch[], version?: string): FrontendSourceEditRequest;