@rebasepro/cms 0.30.0 → 0.31.0-canary.g59cd6fd

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/dist/index.d.ts CHANGED
@@ -4,11 +4,22 @@ export { EditorAIControllerProvider, useProvidedEditorAIController } from "./con
4
4
  export * from "./form/index.js";
5
5
  export * from "./preview/index.js";
6
6
  export * from "./routes/index.js";
7
+ export { customizeTable } from "./tables/customize_table.js";
8
+ export { applyTableCustomization, applyTableCustomizations } from "./tables/apply_customization.js";
9
+ export type { TableCollection } from "./tables/apply_customization.js";
10
+ export { updateRecord } from "./tables/update_record.js";
11
+ export { collectionFromTable, collectionsFromTables } from "./tables/project_table.js";
12
+ export type { ProjectedCollection, TableProjectionContext, TableProjectionOptions } from "./tables/project_table.js";
13
+ export { composeCollections } from "./hooks/navigation/compose_collections.js";
14
+ export type { CollectionSources } from "./hooks/navigation/compose_collections.js";
15
+ export type { AnyFieldCustomization, CustomizableTable, FieldCustomization, TableCustomization, TableCustomizationOptions } from "@rebasepro/cms-types";
7
16
  export { EntityViewBinding, SelectionTableBinding, SelectableTable, SelectableTableContext, CollectionViewBinding, CollectionViewActions, CollectionCardViewBinding, EntityCardBinding, useSelectionController, PropertyConfigBadge, PropertyKeyHint, CollectionTableBinding, CollectionRowActions, VirtualTableInput, ArrayContainer, type ArrayEntryParams, ReferenceWidget, SearchIconsView, FieldCaption, EntityPreviewBinding, getFieldConfig, getFieldId, getDefaultFieldConfig, getDefaultFieldId, DEFAULT_FIELD_CONFIGS, editEntityAction, copyEntityAction, deleteEntityAction, resetPasswordAction, SidePanelProvider, Scaffold, AppBar, Drawer, DefaultDrawer, DrawerFooterActions, DrawerNavigationItem, DrawerNavigationGroup, AdminModeSyncer, RebaseCMS, RebaseShell, RebaseAuthGate, RebaseNavigation, RebaseLayout, RebaseRouteDefs, SideDialogs, useApp, CollectionPanel, CollectionsProvider, RecordForm, EntityFormPanel, RecordDetail, FieldValue } from "./components/index.js";
8
17
  export type { EntityViewBindingProps, CollectionViewBindingProps, SelectionProps, SelectableTableProps, CollectionPanelProps, CollectionPanelOptions, CollectionsProviderProps, RecordFormProps, RecordFormOptions, EntityFormPanelProps, EntityFormPanelSavedParams, RecordDetailProps, RecordDetailOptions, RecordPanelCollection, FieldValueProps, DrawerNavigationGroupProps, DrawerNavigationItemProps } from "./components/index.js";
9
18
  export * from "./hooks/index.js";
10
19
  export { addInitialSlash, removeInitialSlash, removeTrailingSlash, removeInitialAndTrailingSlashes, getLastSegment, getCollectionBySlugWithin, getCollectionPathsCombinations, resolveCollectionPathIds, mergeEntityActions, resolveEntityAction, resolveEntityView, isReferenceProperty, isRelationProperty, getIconForWidget, getIconForProperty, getPropertyInPath, getResolvedPropertyInPath, getBracketNotation, getPropertiesWithPropertiesOrder, getDefaultPropertiesOrder, getEntityPreviewKeys, getEntityTitlePropertyKey, getEntityTitlePropertyKeyForEntity } from "./util/index.js";
11
20
  export { mapPropertyToConfig, mapPropertiesToConfigs } from "./util/propertyConfigMapper.js";
21
+ export { hasEntityId } from "./util/identity.js";
22
+ export { getRelationTargetPath } from "./util/relations.js";
12
23
  export { useCollectionDataController, createStaticDataController } from "./util/dataControllerAdapter.js";
13
24
  export * from "./selection/index.js";
14
25
  export * from "./data_import/index.js";
package/dist/index.js CHANGED
@@ -1,9 +1,11 @@
1
1
  import { EditorAIControllerProvider, useProvidedEditorAIController } from "./contexts/EditorAIControllerContext.js";
2
+ import { hasEntityId } from "./util/identity.js";
2
3
  import { AdditionalFieldValue } from "./components/AdditionalFieldValue.js";
3
4
  import { getBracketNotation, getDefaultPropertiesOrder, getIconForProperty, getIconForWidget, getPropertiesWithPropertiesOrder, getPropertyInPath, getResolvedPropertyInPath, isReferenceProperty, isRelationProperty } from "./util/property_utils.js";
4
5
  import { PropertyKeyHint } from "./components/PropertyKeyHint.js";
5
6
  import { FieldBlock, LABEL_ICON_SIZE, isSelfLabellingProperty, spanClass } from "./form/components/FieldBlock.js";
6
7
  import { getDefaultFieldId, getFieldId } from "./components/field_ids.js";
8
+ import { getRelationTargetPath } from "./util/relations.js";
7
9
  import { EmptyValue } from "./preview/components/EmptyValue.js";
8
10
  import { getDatePropertyMode, getDatePropertyTimezone, isEmptyPreviewValue, sanitizeUrl } from "./preview/util.js";
9
11
  import { ImagePreview } from "./preview/components/ImagePreview.js";
@@ -106,6 +108,11 @@ import { FormField } from "./form/FormField.js";
106
108
  import { CustomViewRoute } from "./routes/CustomViewRoute.js";
107
109
  import { resolveEntityAction, resolveEntityView } from "./util/resolutions.js";
108
110
  import { RebaseRoute } from "./routes/RebaseRoute.js";
111
+ import { customizeTable } from "./tables/customize_table.js";
112
+ import { applyTableCustomization, applyTableCustomizations } from "./tables/apply_customization.js";
113
+ import { updateRecord } from "./tables/update_record.js";
114
+ import { collectionFromTable, collectionsFromTables } from "./tables/project_table.js";
115
+ import { composeCollections } from "./hooks/navigation/compose_collections.js";
109
116
  import { EntityViewBinding } from "./components/EntityViewBinding.js";
110
117
  import { useChildViewSource } from "./hooks/useChildViewSource.js";
111
118
  import { EditViewBinding } from "./components/EditViewBinding.js";
@@ -175,7 +182,6 @@ import { EXPORT_PAGE_SIZE, MAX_EXPORT_ROWS, fetchAllEntitiesForExport } from "./
175
182
  import { BasicExportAction } from "./data_export/export/BasicExportAction.js";
176
183
  import { ExportCollectionAction } from "./data_export/export/ExportCollectionAction.js";
177
184
  import { fromSerializableCollectionConfig, fromSerializableCollectionConfigs, fromSerializableProperties, fromSerializableProperty, toSerializableCollectionConfig, toSerializableProperties, toSerializableProperty } from "./collection_editor/serializable_utils.js";
178
- import { useJsonCollectionsConfigController } from "./collection_editor/useJsonCollectionsConfigController.js";
179
185
  import { validateCollectionJson } from "./collection_editor/validateCollectionJson.js";
180
186
  import { CollectionGenerationApiError, DEFAULT_COLLECTION_GENERATION_ENDPOINT, buildCollectionGenerationCallback } from "./collection_editor/api/generateCollectionApi.js";
181
187
  import { MissingReferenceWidget } from "./collection_editor/ui/MissingReferenceWidget.js";
@@ -183,4 +189,4 @@ import { getFullId, getFullIdPath, idToPropertiesPath, namespaceToPropertiesOrde
183
189
  import { SmallNavigationCard } from "./components/HomePage/SmallNavigationCard.js";
184
190
  import { SavedAppFrame, sandboxedViewDocument } from "./saved_apps/saved_app_frame.js";
185
191
  import { SavedAppsView, savedAppsView } from "./saved_apps/SavedAppsView.js";
186
- export { AdditionalFieldValue, AdminModeSyncer, AppBar, ArrayContainer, ArrayCustomShapedFieldBinding, ArrayEnumPreview, ArrayOfMapsPreview, ArrayOfReferencesFieldBinding, ArrayOfReferencesPreview, ArrayOfStorageComponentsPreview, ArrayOfStringsPreview, ArrayOneOfPreview, ArrayPropertyEnumPreview, ArrayPropertyPreview, BasicExportAction, BlockFieldBinding, BooleanFilterField, BooleanPreview, CollectionAddButton, CollectionCardViewBinding, CollectionFiltersButton, CollectionGenerationApiError, CollectionPanel, CollectionRegistryContext, CollectionRowActions, CollectionSearchBar, CollectionTableBinding, CollectionTableToolbar, CollectionToolbar, CollectionViewActions, CollectionViewBinding, CollectionViewModeToggle, CollectionsProvider, CreationResultDialog, CustomViewRoute, DEFAULT_COLLECTION_GENERATION_ENDPOINT, DEFAULT_FIELD_CONFIGS, DataNewPropertiesMapping, DatePreview, DateTimeFieldBinding, DateTimeFilterField, DefaultDrawer, DetailViewBinding, Drawer, DrawerExpansionContext, DrawerFooterActions, DrawerNavigationGroup, DrawerNavigationItem, EXPORT_PAGE_SIZE, EditViewBinding, EditorAIControllerProvider, EditorCollectionAction, EmptyValue, EntityCardBinding, EntityForm, EntityFormBinding, EntityFormPanel, EntityPreviewBinding, EntityTableCell, EntityViewBinding, EnumValuesChip, ExportCollectionAction, FavouritesView, FieldBlock, FieldCaption, FieldHelperText, FieldValue, FormField, FormRail, FormSections, Highlighted, IMPORT_BATCH_MAX_BYTES, IMPORT_BATCH_SIZE, ImagePreview, ImportCollectionAction, ImportConversionProblems, ImportDataPreview, ImportFileUpload, ImportNewPropertyFieldPreview, ImportSaveInProgress, InlineEntityListPreview, KeyValueFieldBinding, KeyValuePreview, LABEL_ICON_SIZE, LabelWithIcon, LiveSchemaError, MAX_EXPORT_ROWS, MAX_SELECTION_ROWS, MapFieldBinding, MapPropertyPreview, MarkdownEditorFieldBinding, MatchExplanation, MissingReferenceWidget, MultiSelectFieldBinding, NAVIGATION_DEFAULT_GROUP_NAME, NavigationCard, NavigationCardBinding, NavigationGroup, NavigationStateContext, NestedEntityPreviewBoundary, NumberPropertyPreview, PropertyConfigBadge, PropertyFieldBinding, PropertyKeyHint, PropertyPreview, PropertySelectEntry, PropertyTableCell, ReadOnlyFieldBinding, RebaseAuthGate, RebaseCMS, RebaseLayout, RebaseNavigation, RebaseRoute, RebaseRouteDefs, RebaseShell, RecordDetail, RecordForm, RecordMeta, ReferenceFieldBinding, ReferenceFilterField, ReferencePreview, ReferenceWidget, RelationFilterField, RelationPreview, RepeatFieldBinding, SELECTION_PAGE_SIZE, SavedAppFrame, SavedAppsView, Scaffold, SchemaChangeCancelled, SearchIconsView, SelectFieldBinding, SelectableTable, SelectableTableContext, SelectionMenu, SelectionTableBinding, SideDialogs, SidePanelControllerContext, SidePanelProvider, SkeletonPropertyComponent, SlotValue, SmallNavigationCard, StorageThumbnail, StorageThumbnailInternal, StorageUploadFieldBinding, StringNumberFilterField, StringPropertyPreview, SwitchFieldBinding, TagChips, TextFieldBinding, UrlComponentPreview, UrlContext, UserPreview, VectorFieldBinding, VirtualTableInput, addInitialSlash, asUnavailable, buildCollectionGenerationCallback, buildSidePanelsFromUrl, convertDataToEntity, convertFileToJson, convertImportData, copyEntityAction, createLiveSchemaClient, createStaticDataController, deleteEntityAction, detectCsvDelimiter, downloadBlob, downloadDataAsCsv, downloadEntitiesExport, editEntityAction, entityActionName, entryToCSVRow, escapeCsvFormula, extractTouchedValues, fetchAllEntitiesForExport, fieldLabel, flattenEntry, formatDatePreview, fromSerializableCollectionConfig, fromSerializableCollectionConfigs, fromSerializableProperties, fromSerializableProperty, getBracketNotation, getChanges, getCollectionBySlugWithin, getCollectionPathsCombinations, getDatePropertyMode, getDatePropertyTimezone, getDefaultFieldConfig, getDefaultFieldId, getDefaultPropertiesOrder, getEntityCSVExportableData, getEntityJsonExportableData, getEntityPreviewKeys, getEntityTitlePropertyKey, getEntityTitlePropertyKeyForEntity, getEntityViewWidth, getFieldConfig, getFieldId, getFullId, getFullIdPath, getIconForProperty, getIconForWidget, getInferenceType, getInitialEntityValues, getLastSegment, getParentLinkValues, getPropertiesWithPropertiesOrder, getPropertyInPath, getResolvedPropertyInPath, getTouchedPropertyValues, getUnappliedLocalChanges, getUserLabel, idToPropertiesPath, isEmptyPreviewValue, isReferenceProperty, isRelationProperty, isSchemaChangeCancelled, isSelfLabellingProperty, mapPropertiesToConfigs, mapPropertyToConfig, mappedColumnTarget, mergeEntityActions, namespaceToPropertiesOrderPath, namespaceToPropertiesPath, normalizeDeprecatedSidePanelProps, overlayEdit, parseCsvRows, parseCsvToObjects, processValueMapping, propertiesToColumns, removeEmptyContainers, removeInitialAndTrailingSlashes, removeInitialSlash, removeTrailingSlash, renderSkeletonCaptionText, renderSkeletonIcon, renderSkeletonImageThumbnail, renderSkeletonText, resetPasswordAction, resolveCollectionPathIds, resolveCollectionSlotKeys, resolveEntityAction, resolveEntityActionState, resolveEntityView, resolveNavigationFrom, resolveSelection, sandboxedViewDocument, sanitizeUrl, saveImportedEntities, savedAppsView, selectionQueryToFindParams, serializeSelectionQuery, slashDateOrdersByColumn, spanClass, toSerializableCollectionConfig, toSerializableProperties, toSerializableProperty, unescapeCsvFormula, unlinkEntityAction, useAdminContext, useApp, useBreadcrumbsController, useBuildCollectionRegistryController, useBuildNavigationStateController, useBuildSidePanel, useBuildUrlController, useChildViewSource, useClearRestoreValue, useCollectionDataController, useCollectionEditorController, useCollectionLargeLayout, useCollectionRegistryController, useCollectionSlotKeys, useCollectionsConfigController, useDateFnsLocale, useDrawerExpandedWhile, useDrawerExpansion, useEntitySlots, useEntityTitle, useHistory, useImagePlace, useImportConfig, useJsonCollectionsConfigController, useLiveSchemaEditing, useLocalCollectionsConfigController, useNavigationStateController, useProvidedEditorAIController, useResolvedCollections, useResolvedNavigationFrom, useResolvedUser, useResolvedViews, useSearchExplanation, useSelectionController, useSelectionDialog, useSideDialogContext, useSideDialogsController, useSidePanel, useToolbarLabels, useTopLevelNavigation, useUrlController, validateCollectionJson, zodToFormErrors };
192
+ export { AdditionalFieldValue, AdminModeSyncer, AppBar, ArrayContainer, ArrayCustomShapedFieldBinding, ArrayEnumPreview, ArrayOfMapsPreview, ArrayOfReferencesFieldBinding, ArrayOfReferencesPreview, ArrayOfStorageComponentsPreview, ArrayOfStringsPreview, ArrayOneOfPreview, ArrayPropertyEnumPreview, ArrayPropertyPreview, BasicExportAction, BlockFieldBinding, BooleanFilterField, BooleanPreview, CollectionAddButton, CollectionCardViewBinding, CollectionFiltersButton, CollectionGenerationApiError, CollectionPanel, CollectionRegistryContext, CollectionRowActions, CollectionSearchBar, CollectionTableBinding, CollectionTableToolbar, CollectionToolbar, CollectionViewActions, CollectionViewBinding, CollectionViewModeToggle, CollectionsProvider, CreationResultDialog, CustomViewRoute, DEFAULT_COLLECTION_GENERATION_ENDPOINT, DEFAULT_FIELD_CONFIGS, DataNewPropertiesMapping, DatePreview, DateTimeFieldBinding, DateTimeFilterField, DefaultDrawer, DetailViewBinding, Drawer, DrawerExpansionContext, DrawerFooterActions, DrawerNavigationGroup, DrawerNavigationItem, EXPORT_PAGE_SIZE, EditViewBinding, EditorAIControllerProvider, EditorCollectionAction, EmptyValue, EntityCardBinding, EntityForm, EntityFormBinding, EntityFormPanel, EntityPreviewBinding, EntityTableCell, EntityViewBinding, EnumValuesChip, ExportCollectionAction, FavouritesView, FieldBlock, FieldCaption, FieldHelperText, FieldValue, FormField, FormRail, FormSections, Highlighted, IMPORT_BATCH_MAX_BYTES, IMPORT_BATCH_SIZE, ImagePreview, ImportCollectionAction, ImportConversionProblems, ImportDataPreview, ImportFileUpload, ImportNewPropertyFieldPreview, ImportSaveInProgress, InlineEntityListPreview, KeyValueFieldBinding, KeyValuePreview, LABEL_ICON_SIZE, LabelWithIcon, LiveSchemaError, MAX_EXPORT_ROWS, MAX_SELECTION_ROWS, MapFieldBinding, MapPropertyPreview, MarkdownEditorFieldBinding, MatchExplanation, MissingReferenceWidget, MultiSelectFieldBinding, NAVIGATION_DEFAULT_GROUP_NAME, NavigationCard, NavigationCardBinding, NavigationGroup, NavigationStateContext, NestedEntityPreviewBoundary, NumberPropertyPreview, PropertyConfigBadge, PropertyFieldBinding, PropertyKeyHint, PropertyPreview, PropertySelectEntry, PropertyTableCell, ReadOnlyFieldBinding, RebaseAuthGate, RebaseCMS, RebaseLayout, RebaseNavigation, RebaseRoute, RebaseRouteDefs, RebaseShell, RecordDetail, RecordForm, RecordMeta, ReferenceFieldBinding, ReferenceFilterField, ReferencePreview, ReferenceWidget, RelationFilterField, RelationPreview, RepeatFieldBinding, SELECTION_PAGE_SIZE, SavedAppFrame, SavedAppsView, Scaffold, SchemaChangeCancelled, SearchIconsView, SelectFieldBinding, SelectableTable, SelectableTableContext, SelectionMenu, SelectionTableBinding, SideDialogs, SidePanelControllerContext, SidePanelProvider, SkeletonPropertyComponent, SlotValue, SmallNavigationCard, StorageThumbnail, StorageThumbnailInternal, StorageUploadFieldBinding, StringNumberFilterField, StringPropertyPreview, SwitchFieldBinding, TagChips, TextFieldBinding, UrlComponentPreview, UrlContext, UserPreview, VectorFieldBinding, VirtualTableInput, addInitialSlash, applyTableCustomization, applyTableCustomizations, asUnavailable, buildCollectionGenerationCallback, buildSidePanelsFromUrl, collectionFromTable, collectionsFromTables, composeCollections, convertDataToEntity, convertFileToJson, convertImportData, copyEntityAction, createLiveSchemaClient, createStaticDataController, customizeTable, deleteEntityAction, detectCsvDelimiter, downloadBlob, downloadDataAsCsv, downloadEntitiesExport, editEntityAction, entityActionName, entryToCSVRow, escapeCsvFormula, extractTouchedValues, fetchAllEntitiesForExport, fieldLabel, flattenEntry, formatDatePreview, fromSerializableCollectionConfig, fromSerializableCollectionConfigs, fromSerializableProperties, fromSerializableProperty, getBracketNotation, getChanges, getCollectionBySlugWithin, getCollectionPathsCombinations, getDatePropertyMode, getDatePropertyTimezone, getDefaultFieldConfig, getDefaultFieldId, getDefaultPropertiesOrder, getEntityCSVExportableData, getEntityJsonExportableData, getEntityPreviewKeys, getEntityTitlePropertyKey, getEntityTitlePropertyKeyForEntity, getEntityViewWidth, getFieldConfig, getFieldId, getFullId, getFullIdPath, getIconForProperty, getIconForWidget, getInferenceType, getInitialEntityValues, getLastSegment, getParentLinkValues, getPropertiesWithPropertiesOrder, getPropertyInPath, getRelationTargetPath, getResolvedPropertyInPath, getTouchedPropertyValues, getUnappliedLocalChanges, getUserLabel, hasEntityId, idToPropertiesPath, isEmptyPreviewValue, isReferenceProperty, isRelationProperty, isSchemaChangeCancelled, isSelfLabellingProperty, mapPropertiesToConfigs, mapPropertyToConfig, mappedColumnTarget, mergeEntityActions, namespaceToPropertiesOrderPath, namespaceToPropertiesPath, normalizeDeprecatedSidePanelProps, overlayEdit, parseCsvRows, parseCsvToObjects, processValueMapping, propertiesToColumns, removeEmptyContainers, removeInitialAndTrailingSlashes, removeInitialSlash, removeTrailingSlash, renderSkeletonCaptionText, renderSkeletonIcon, renderSkeletonImageThumbnail, renderSkeletonText, resetPasswordAction, resolveCollectionPathIds, resolveCollectionSlotKeys, resolveEntityAction, resolveEntityActionState, resolveEntityView, resolveNavigationFrom, resolveSelection, sandboxedViewDocument, sanitizeUrl, saveImportedEntities, savedAppsView, selectionQueryToFindParams, serializeSelectionQuery, slashDateOrdersByColumn, spanClass, toSerializableCollectionConfig, toSerializableProperties, toSerializableProperty, unescapeCsvFormula, unlinkEntityAction, updateRecord, useAdminContext, useApp, useBreadcrumbsController, useBuildCollectionRegistryController, useBuildNavigationStateController, useBuildSidePanel, useBuildUrlController, useChildViewSource, useClearRestoreValue, useCollectionDataController, useCollectionEditorController, useCollectionLargeLayout, useCollectionRegistryController, useCollectionSlotKeys, useCollectionsConfigController, useDateFnsLocale, useDrawerExpandedWhile, useDrawerExpansion, useEntitySlots, useEntityTitle, useHistory, useImagePlace, useImportConfig, useLiveSchemaEditing, useLocalCollectionsConfigController, useNavigationStateController, useProvidedEditorAIController, useResolvedCollections, useResolvedNavigationFrom, useResolvedUser, useResolvedViews, useSearchExplanation, useSelectionController, useSelectionDialog, useSideDialogContext, useSideDialogsController, useSidePanel, useToolbarLabels, useTopLevelNavigation, useUrlController, validateCollectionJson, zodToFormErrors };
@@ -6,14 +6,14 @@
6
6
  * made of.
7
7
  *
8
8
  * One thing differs from the packages: an app was opened with a list of
9
- * collections (show_app's `collections`), and every export that names one
9
+ * tables (show_app's `tables`), and every export that names one
10
10
  * holds the app to it, with an error that says which it may use. The rows an
11
11
  * app reads and writes go through the tool driver, as the person, under their
12
12
  * RLS and their connection's scopes: that is what bounds an app, which can do
13
13
  * nothing the model could not with the same tools. `useRowWrites` asks them
14
14
  * before each write (`confirmingDriver` in `tool_driver.ts`), a courtesy
15
15
  * against an app writing without a click; the admin's own controls in it — a
16
- * form's Save, a delete — behave as on a show_collection screen. A form whose
16
+ * form's Save, a delete — behave as on a show_table screen. A form whose
17
17
  * overrides make it save itself is not handed to an app: it would write on
18
18
  * mount, unasked.
19
19
  */
@@ -12,8 +12,8 @@ import React, { createContext, useCallback, useContext, useMemo } from "react";
12
12
  import * as jsxRuntime from "react/jsx-runtime";
13
13
  import { jsx } from "react/jsx-runtime";
14
14
  import * as UI from "@rebasepro/ui";
15
+ import { getCollectionDataPath } from "@rebasepro/cms-types";
15
16
  import { useAggregate, useRow, useRowCount, useRowWrites, useRows } from "@rebasepro/app";
16
- import { getCollectionDataPath } from "@rebasepro/types";
17
17
  //#region src/mcp_view/app_modules.tsx
18
18
  /**
19
19
  * What an app the model wrote imports (show_app): the modules of
@@ -23,14 +23,14 @@ import { getCollectionDataPath } from "@rebasepro/types";
23
23
  * made of.
24
24
  *
25
25
  * One thing differs from the packages: an app was opened with a list of
26
- * collections (show_app's `collections`), and every export that names one
26
+ * tables (show_app's `tables`), and every export that names one
27
27
  * holds the app to it, with an error that says which it may use. The rows an
28
28
  * app reads and writes go through the tool driver, as the person, under their
29
29
  * RLS and their connection's scopes: that is what bounds an app, which can do
30
30
  * nothing the model could not with the same tools. `useRowWrites` asks them
31
31
  * before each write (`confirmingDriver` in `tool_driver.ts`), a courtesy
32
32
  * against an app writing without a click; the admin's own controls in it — a
33
- * form's Save, a delete — behave as on a show_collection screen. A form whose
33
+ * form's Save, a delete — behave as on a show_table screen. A form whose
34
34
  * overrides make it save itself is not handed to an app: it would write on
35
35
  * mount, unasked.
36
36
  */
@@ -55,7 +55,7 @@ function useCollectionCheck() {
55
55
  if (allowed === void 0 || name === void 0 || allowed.includes(name)) return;
56
56
  const collection = registry.getCollection(name);
57
57
  if (collection && (allowed.includes(collection.slug) || allowed.includes(getCollectionDataPath(collection)))) return;
58
- throw new Error(`"${name}" is not one of this app's collections (${allowed.join(", ")}). List it in show_app's \`collections\`.`);
58
+ throw new Error(`"${name}" is not one of this app's tables (${allowed.join(", ")}). List it in show_app's \`tables\`.`);
59
59
  }, [allowed, registry]);
60
60
  }
61
61
  function AppCollectionPanel(props) {
@@ -1 +1 @@
1
- {"version":3,"file":"app_modules.js","names":[],"sources":["../../src/mcp_view/app_modules.tsx"],"sourcesContent":["/**\n * What an app the model wrote imports (show_app): the modules of\n * `MCP_APP_MODULES`, each the package's own exports — `@rebasepro/cms`'s\n * blocks, `@rebasepro/app`'s row hooks, the UI kit, React — so the code reads\n * as Rebase code does anywhere, and the parts are the ones the admin panel is\n * made of.\n *\n * One thing differs from the packages: an app was opened with a list of\n * collections (show_app's `collections`), and every export that names one\n * holds the app to it, with an error that says which it may use. The rows an\n * app reads and writes go through the tool driver, as the person, under their\n * RLS and their connection's scopes: that is what bounds an app, which can do\n * nothing the model could not with the same tools. `useRowWrites` asks them\n * before each write (`confirmingDriver` in `tool_driver.ts`), a courtesy\n * against an app writing without a click; the admin's own controls in it — a\n * form's Save, a delete — behave as on a show_collection screen. A form whose\n * overrides make it save itself is not handed to an app: it would write on\n * mount, unasked.\n */\nimport React, { createContext, useCallback, useContext, useMemo } from \"react\";\nimport * as jsxRuntime from \"react/jsx-runtime\";\nimport * as UI from \"@rebasepro/ui\";\nimport { useAggregate, useRow, useRowCount, useRows, useRowWrites, type UseRowWritesResult } from \"@rebasepro/app\";\nimport type { SidePanelBindingProps, SidePanelController } from \"@rebasepro/cms-types\";\nimport {\n getCollectionDataPath,\n type McpAppModule,\n type McpAppModuleExport\n} from \"@rebasepro/types\";\nimport { CollectionPanel, type CollectionPanelProps } from \"../components/CollectionPanel\";\nimport { RecordForm, type RecordFormProps } from \"../components/RecordForm\";\nimport { RecordDetail, type RecordDetailProps } from \"../components/RecordDetail\";\nimport { FieldValue, type FieldValueProps } from \"../components/FieldValue\";\nimport {\n CollectionFiltersButton,\n CollectionSearchBar,\n CollectionToolbar,\n CollectionViewModeToggle\n} from \"../components/CollectionViewBinding/CollectionToolbar\";\nimport { CollectionAddButton } from \"../components/CollectionViewBinding/CollectionAddButton\";\nimport { FormField } from \"../form/FormField\";\nimport { useSidePanel } from \"../hooks/useSidePanel\";\nimport { collectionPropOf } from \"../components/collection_prop\";\nimport { useCollectionRegistryController } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\n\n/** The collections the app was opened with, by the names the model gave. */\nconst AppCollectionsContext = createContext<readonly string[] | undefined>(undefined);\n\n/** Around an app's component: the collections its imports may name. */\nexport function AppCollections({ names, children }: { names: readonly string[]; children: React.ReactNode }) {\n return <AppCollectionsContext.Provider value={names}>{children}</AppCollectionsContext.Provider>;\n}\n\n/**\n * Throws, for a collection the app was not opened with. A name counts by\n * what the model listed, or by the collection it names — its slug or the\n * name the tools take — so `orders` and the table it lives in are one.\n */\nfunction useCollectionCheck(): (name: string | undefined) => void {\n const allowed = useContext(AppCollectionsContext);\n const registry = useCollectionRegistryController();\n return useCallback((name: string | undefined) => {\n if (allowed === undefined || name === undefined || allowed.includes(name)) return;\n const collection = registry.getCollection(name);\n if (collection && (allowed.includes(collection.slug)\n || allowed.includes(getCollectionDataPath(collection)))) return;\n throw new Error(`\"${name}\" is not one of this app's collections (${allowed.join(\", \")}). `\n + \"List it in show_app's `collections`.\");\n }, [allowed, registry]);\n}\n\nfunction AppCollectionPanel(props: CollectionPanelProps) {\n useCollectionCheck()(collectionPropOf(props.collection, props.path).path);\n return <CollectionPanel {...props}/>;\n}\n\nfunction AppRecordForm({ collectionOverrides, ...props }: RecordFormProps) {\n useCollectionCheck()(collectionPropOf(props.collection, props.path).path);\n // A form that saves itself writes the values it was seeded with on mount,\n // with nobody's click: off, whether the override or the collection asked\n // for it. The overrides merge over the collection the form opens.\n return <RecordForm {...props} collectionOverrides={{ ...collectionOverrides, formAutoSave: false }}/>;\n}\n\nfunction AppRecordDetail(props: RecordDetailProps) {\n useCollectionCheck()(collectionPropOf(props.collection, props.path).path);\n return <RecordDetail {...props}/>;\n}\n\nfunction AppFieldValue(props: FieldValueProps) {\n useCollectionCheck()(props.collection);\n return <FieldValue {...props}/>;\n}\n\nfunction useAppSidePanel(): SidePanelController {\n const check = useCollectionCheck();\n const panel = useSidePanel();\n return useMemo(() => {\n const checked = <M extends Record<string, unknown>>(props: SidePanelBindingProps<M>) => {\n check(props.path);\n return props;\n };\n return {\n close: () => panel.close(),\n open: props => panel.open(checked(props)),\n replace: props => panel.replace(checked(props))\n };\n }, [panel, check]);\n}\n\n/** The row hooks, each held to the app's collections. */\nconst useAppRows: typeof useRows = (collection, options) => {\n useCollectionCheck()(collection);\n return useRows(collection, options);\n};\n\nconst useAppRow: typeof useRow = (collection, id) => {\n useCollectionCheck()(collection);\n return useRow(collection, id);\n};\n\nconst useAppRowCount: typeof useRowCount = (collection, where) => {\n useCollectionCheck()(collection);\n return useRowCount(collection, where);\n};\n\nconst useAppAggregate: typeof useAggregate = (collection, params) => {\n useCollectionCheck()(collection);\n return useAggregate(collection, params);\n};\n\n/** Writes are checked when they are made: a refused one rejects, as a failed write does. */\nfunction useAppRowWrites(): UseRowWritesResult {\n const check = useCollectionCheck();\n const writes = useRowWrites();\n return useMemo(() => {\n const checked = <T, >(collection: string, write: () => Promise<T>): Promise<T> => {\n try {\n check(collection);\n } catch (error) {\n return Promise.reject(error);\n }\n return write();\n };\n return {\n ...writes,\n create: (collection, values, id) => checked(collection, () => writes.create(collection, values, id)),\n update: (collection, id, values) => checked(collection, () => writes.update(collection, id, values)),\n remove: (collection, id) => checked(collection, () => writes.remove(collection, id))\n };\n }, [writes, check]);\n}\n\n/** A module's served exports: exactly its names in `MCP_APP_MODULES`, no more, no fewer. */\ntype Served<M extends McpAppModule> = Record<McpAppModuleExport<M>, unknown>;\n\nconst APP_MODULE: Served<\"@rebasepro/app\"> = {\n useRows: useAppRows,\n useRow: useAppRow,\n useRowCount: useAppRowCount,\n useAggregate: useAppAggregate,\n useRowWrites: useAppRowWrites\n};\n\nconst CMS_MODULE: Served<\"@rebasepro/cms\"> = {\n CollectionPanel: AppCollectionPanel,\n CollectionToolbar,\n CollectionSearchBar,\n CollectionFiltersButton,\n CollectionViewModeToggle,\n CollectionAddButton,\n RecordForm: AppRecordForm,\n RecordDetail: AppRecordDetail,\n FormField,\n FieldValue: AppFieldValue,\n useSidePanel: useAppSidePanel\n};\n\n/** Every module an app may import, by name. */\nexport const APP_MODULE_EXPORTS: Record<McpAppModule, object> = {\n \"react\": React,\n \"react/jsx-runtime\": jsxRuntime,\n \"@rebasepro/ui\": UI,\n \"@rebasepro/app\": APP_MODULE,\n \"@rebasepro/cms\": CMS_MODULE\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,IAAM,wBAAwB,cAA6C,KAAA,CAAS;;AAGpF,SAAgB,eAAe,EAAE,OAAO,YAAqE;CACzG,OAAO,oBAAC,sBAAsB,UAAvB;EAAgC,OAAO;EAAQ;CAAyC,CAAA;AACnG;;;;;;AAOA,SAAS,qBAAyD;CAC9D,MAAM,UAAU,WAAW,qBAAqB;CAChD,MAAM,WAAW,gCAAgC;CACjD,OAAO,aAAa,SAA6B;EAC7C,IAAI,YAAY,KAAA,KAAa,SAAS,KAAA,KAAa,QAAQ,SAAS,IAAI,GAAG;EAC3E,MAAM,aAAa,SAAS,cAAc,IAAI;EAC9C,IAAI,eAAe,QAAQ,SAAS,WAAW,IAAI,KAC5C,QAAQ,SAAS,sBAAsB,UAAU,CAAC,IAAI;EAC7D,MAAM,IAAI,MAAM,IAAI,KAAK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O;CACjD,mBAAmB,CAAC,CAAC,UAAU;CAC/B,OAAO,OAAO,YAAY,EAAE;AAChC;AAEA,IAAM,kBAAsC,YAAY,UAAU;CAC9D,mBAAmB,CAAC,CAAC,UAAU;CAC/B,OAAO,YAAY,YAAY,KAAK;AACxC;AAEA,IAAM,mBAAwC,YAAY,WAAW;CACjE,mBAAmB,CAAC,CAAC,UAAU;CAC/B,OAAO,aAAa,YAAY,MAAM;AAC1C;;AAGA,SAAS,kBAAsC;CAC3C,MAAM,QAAQ,mBAAmB;CACjC,MAAM,SAAS,aAAa;CAC5B,OAAO,cAAc;EACjB,MAAM,WAAgB,YAAoB,UAAwC;GAC9E,IAAI;IACA,MAAM,UAAU;GACpB,SAAS,OAAO;IACZ,OAAO,QAAQ,OAAO,KAAK;GAC/B;GACA,OAAO,MAAM;EACjB;EACA,OAAO;GACH,GAAG;GACH,SAAS,YAAY,QAAQ,OAAO,QAAQ,kBAAkB,OAAO,OAAO,YAAY,QAAQ,EAAE,CAAC;GACnG,SAAS,YAAY,IAAI,WAAW,QAAQ,kBAAkB,OAAO,OAAO,YAAY,IAAI,MAAM,CAAC;GACnG,SAAS,YAAY,OAAO,QAAQ,kBAAkB,OAAO,OAAO,YAAY,EAAE,CAAC;EACvF;CACJ,GAAG,CAAC,QAAQ,KAAK,CAAC;AACtB;;AA4BA,IAAa,qBAAmD;CAC5D,SAAS;CACT,qBAAqB;CACrB,iBAAiB;CACjB,kBAAkB;EA1BlB,SAAS;EACT,QAAQ;EACR,aAAa;EACb,cAAc;EACd,cAAc;CAsBI;CAClB,kBAAkB;EAnBlB,iBAAiB;EACjB;EACA;EACA;EACA;EACA;EACA,YAAY;EACZ,cAAc;EACd;EACA,YAAY;EACZ,cAAc;CASI;AACtB"}
1
+ {"version":3,"file":"app_modules.js","names":[],"sources":["../../src/mcp_view/app_modules.tsx"],"sourcesContent":["/**\n * What an app the model wrote imports (show_app): the modules of\n * `MCP_APP_MODULES`, each the package's own exports — `@rebasepro/cms`'s\n * blocks, `@rebasepro/app`'s row hooks, the UI kit, React — so the code reads\n * as Rebase code does anywhere, and the parts are the ones the admin panel is\n * made of.\n *\n * One thing differs from the packages: an app was opened with a list of\n * tables (show_app's `tables`), and every export that names one\n * holds the app to it, with an error that says which it may use. The rows an\n * app reads and writes go through the tool driver, as the person, under their\n * RLS and their connection's scopes: that is what bounds an app, which can do\n * nothing the model could not with the same tools. `useRowWrites` asks them\n * before each write (`confirmingDriver` in `tool_driver.ts`), a courtesy\n * against an app writing without a click; the admin's own controls in it — a\n * form's Save, a delete — behave as on a show_table screen. A form whose\n * overrides make it save itself is not handed to an app: it would write on\n * mount, unasked.\n */\nimport React, { createContext, useCallback, useContext, useMemo } from \"react\";\nimport * as jsxRuntime from \"react/jsx-runtime\";\nimport * as UI from \"@rebasepro/ui\";\nimport { useAggregate, useRow, useRowCount, useRows, useRowWrites, type UseRowWritesResult } from \"@rebasepro/app\";\nimport type { SidePanelBindingProps, SidePanelController } from \"@rebasepro/cms-types\";\nimport {\n type McpAppModule\n} from \"@rebasepro/types\";\nimport {\n type McpAppModuleExport,\n getCollectionDataPath\n} from \"@rebasepro/cms-types\";\nimport { CollectionPanel, type CollectionPanelProps } from \"../components/CollectionPanel\";\nimport { RecordForm, type RecordFormProps } from \"../components/RecordForm\";\nimport { RecordDetail, type RecordDetailProps } from \"../components/RecordDetail\";\nimport { FieldValue, type FieldValueProps } from \"../components/FieldValue\";\nimport {\n CollectionFiltersButton,\n CollectionSearchBar,\n CollectionToolbar,\n CollectionViewModeToggle\n} from \"../components/CollectionViewBinding/CollectionToolbar\";\nimport { CollectionAddButton } from \"../components/CollectionViewBinding/CollectionAddButton\";\nimport { FormField } from \"../form/FormField\";\nimport { useSidePanel } from \"../hooks/useSidePanel\";\nimport { collectionPropOf } from \"../components/collection_prop\";\nimport { useCollectionRegistryController } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\n\n/** The collections the app was opened with, by the names the model gave. */\nconst AppCollectionsContext = createContext<readonly string[] | undefined>(undefined);\n\n/** Around an app's component: the collections its imports may name. */\nexport function AppCollections({ names, children }: { names: readonly string[]; children: React.ReactNode }) {\n return <AppCollectionsContext.Provider value={names}>{children}</AppCollectionsContext.Provider>;\n}\n\n/**\n * Throws, for a collection the app was not opened with. A name counts by\n * what the model listed, or by the collection it names — its slug or the\n * name the tools take — so `orders` and the table it lives in are one.\n */\nfunction useCollectionCheck(): (name: string | undefined) => void {\n const allowed = useContext(AppCollectionsContext);\n const registry = useCollectionRegistryController();\n return useCallback((name: string | undefined) => {\n if (allowed === undefined || name === undefined || allowed.includes(name)) return;\n const collection = registry.getCollection(name);\n if (collection && (allowed.includes(collection.slug)\n || allowed.includes(getCollectionDataPath(collection)))) return;\n throw new Error(`\"${name}\" is not one of this app's tables (${allowed.join(\", \")}). `\n + \"List it in show_app's `tables`.\");\n }, [allowed, registry]);\n}\n\nfunction AppCollectionPanel(props: CollectionPanelProps) {\n useCollectionCheck()(collectionPropOf(props.collection, props.path).path);\n return <CollectionPanel {...props}/>;\n}\n\nfunction AppRecordForm({ collectionOverrides, ...props }: RecordFormProps) {\n useCollectionCheck()(collectionPropOf(props.collection, props.path).path);\n // A form that saves itself writes the values it was seeded with on mount,\n // with nobody's click: off, whether the override or the collection asked\n // for it. The overrides merge over the collection the form opens.\n return <RecordForm {...props} collectionOverrides={{ ...collectionOverrides, formAutoSave: false }}/>;\n}\n\nfunction AppRecordDetail(props: RecordDetailProps) {\n useCollectionCheck()(collectionPropOf(props.collection, props.path).path);\n return <RecordDetail {...props}/>;\n}\n\nfunction AppFieldValue(props: FieldValueProps) {\n useCollectionCheck()(props.collection);\n return <FieldValue {...props}/>;\n}\n\nfunction useAppSidePanel(): SidePanelController {\n const check = useCollectionCheck();\n const panel = useSidePanel();\n return useMemo(() => {\n const checked = <M extends Record<string, unknown>>(props: SidePanelBindingProps<M>) => {\n check(props.path);\n return props;\n };\n return {\n close: () => panel.close(),\n open: props => panel.open(checked(props)),\n replace: props => panel.replace(checked(props))\n };\n }, [panel, check]);\n}\n\n/** The row hooks, each held to the app's collections. */\nconst useAppRows: typeof useRows = (collection, options) => {\n useCollectionCheck()(collection);\n return useRows(collection, options);\n};\n\nconst useAppRow: typeof useRow = (collection, id) => {\n useCollectionCheck()(collection);\n return useRow(collection, id);\n};\n\nconst useAppRowCount: typeof useRowCount = (collection, where) => {\n useCollectionCheck()(collection);\n return useRowCount(collection, where);\n};\n\nconst useAppAggregate: typeof useAggregate = (collection, params) => {\n useCollectionCheck()(collection);\n return useAggregate(collection, params);\n};\n\n/** Writes are checked when they are made: a refused one rejects, as a failed write does. */\nfunction useAppRowWrites(): UseRowWritesResult {\n const check = useCollectionCheck();\n const writes = useRowWrites();\n return useMemo(() => {\n const checked = <T, >(collection: string, write: () => Promise<T>): Promise<T> => {\n try {\n check(collection);\n } catch (error) {\n return Promise.reject(error);\n }\n return write();\n };\n return {\n ...writes,\n create: (collection, values, id) => checked(collection, () => writes.create(collection, values, id)),\n update: (collection, id, values) => checked(collection, () => writes.update(collection, id, values)),\n remove: (collection, id) => checked(collection, () => writes.remove(collection, id))\n };\n }, [writes, check]);\n}\n\n/** A module's served exports: exactly its names in `MCP_APP_MODULES`, no more, no fewer. */\ntype Served<M extends McpAppModule> = Record<McpAppModuleExport<M>, unknown>;\n\nconst APP_MODULE: Served<\"@rebasepro/app\"> = {\n useRows: useAppRows,\n useRow: useAppRow,\n useRowCount: useAppRowCount,\n useAggregate: useAppAggregate,\n useRowWrites: useAppRowWrites\n};\n\nconst CMS_MODULE: Served<\"@rebasepro/cms\"> = {\n CollectionPanel: AppCollectionPanel,\n CollectionToolbar,\n CollectionSearchBar,\n CollectionFiltersButton,\n CollectionViewModeToggle,\n CollectionAddButton,\n RecordForm: AppRecordForm,\n RecordDetail: AppRecordDetail,\n FormField,\n FieldValue: AppFieldValue,\n useSidePanel: useAppSidePanel\n};\n\n/** Every module an app may import, by name. */\nexport const APP_MODULE_EXPORTS: Record<McpAppModule, object> = {\n \"react\": React,\n \"react/j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AAQ,kBAAkB,OAAO,OAAO,YAAY,QAAQ,EAAE,CAAC;GACnG,SAAS,YAAY,IAAI,WAAW,QAAQ,kBAAkB,OAAO,OAAO,YAAY,IAAI,MAAM,CAAC;GACnG,SAAS,YAAY,OAAO,QAAQ,kBAAkB,OAAO,OAAO,YAAY,EAAE,CAAC;EACvF;CACJ,GAAG,CAAC,QAAQ,KAAK,CAAC;AACtB;;AA4BA,IAAa,qBAAmD;CAC5D,SAAS;CACT,qBAAqB;CACrB,iBAAiB;CACjB,kBAAkB;EA1BlB,SAAS;EACT,QAAQ;EACR,aAAa;EACb,cAAc;EACd,cAAc;CAsBI;CAClB,kBAAkB;EAnBlB,iBAAiB;EACjB;EACA;EACA;EACA;EACA;EACA,YAAY;EACZ,cAAc;EACd;EACA,YAAY;EACZ,cAAc;CASI;AACtB"}
@@ -1,25 +1,19 @@
1
1
  import type { AdminCollection } from "@rebasepro/cms-types";
2
2
  import { type ViewBridge } from "./bridge.js";
3
- import { type Screen } from "./payload.js";
3
+ import { type Screen, type TableGrant } from "./payload.js";
4
4
  export { APPS_PROTOCOL_VERSION, McpAppBridge, isRecord } from "./bridge.js";
5
5
  export type { HostContext, ToolResult, DisplayMode, ViewBridge } from "./bridge.js";
6
6
  export { createToolDriver, DEFAULT_ACTIONS, SaveCancelledError, describeChanges, describeFailedWrite, describeRefusal, needsConfirmation } from "./tool_driver.js";
7
7
  export type { CallTool, SeedPage, ToolDriver, ViewActions, WritePlan, WriteIntent, ViewChange, WriteFailure } from "./tool_driver.js";
8
8
  export { parseResult, actionsOf, filterOf } from "./payload.js";
9
- export type { Screen, Block } from "./payload.js";
9
+ export type { Screen, Block, TableGrant, ScreenPreferences } from "./payload.js";
10
10
  export interface McpViewOptions {
11
11
  /**
12
12
  * Mount the app, once the host is set: import the project's entry (which
13
13
  * renders its app as it would on its page), or render a default one into
14
- * `#root`. Given the screen the tool opened, for an app with no
15
- * collections of its own.
14
+ * `#root`. Given the screen the tool opened.
16
15
  */
17
16
  mountApp: (screen: Screen) => void | Promise<unknown>;
18
- /**
19
- * Draw a result from a server that predates the admin panel's views
20
- * (show_collection's columns only): the old table, where the view has it.
21
- */
22
- mountTable?: (bridge: ViewBridge, container: HTMLElement) => void;
23
17
  /** Name and version the view gives the host. */
24
18
  appInfo?: {
25
19
  name: string;
@@ -34,18 +28,21 @@ export interface McpViewOptions {
34
28
  */
35
29
  export declare function startMcpView(options: McpViewOptions): ViewBridge;
36
30
  /**
37
- * The app's collections as this person may see them here: the project's own
38
- * configs — with their components — narrowed as the server narrowed the ones
39
- * it sent (`McpViewPayload` in the server's `mcp/mcp-view.ts`). A field the
40
- * server left out is left out; one it made read-only is read-only; its
41
- * security rules (the project's, and the one closing what the connection was
42
- * not granted) are the ones checked. A collection the server sent nothing
43
- * for is shown with every change closed: this screen did not ask for it.
31
+ * The app's collections as this person may see them here. They were composed
32
+ * from the descriptors the server sent — so a column the person may not read
33
+ * is not in them, and the CMS reads a column's write rule as it does on the
34
+ * project's page — with the project's own customizations and components. What
35
+ * remains is the connection: an operation its scopes were not granted on a
36
+ * table (`data:write`, `data:delete`) is closed by a restrictive rule, which
37
+ * is what the admin panel asks before it offers Add, Save or Delete. A
38
+ * collection the server sent no grant for (one the app declares beside the
39
+ * tables) is shown with every change closed: this screen did not ask for it.
44
40
  *
45
- * Where the app has no collections of its own (the view without a project),
46
- * the server's configs are the collections.
41
+ * None of it is the boundary — every save is the server's write tool, which
42
+ * checks the scopes, the column rules and RLS again — it keeps the view from
43
+ * offering what would be refused.
47
44
  */
48
- export declare function narrowCollections(own: AdminCollection[], sent: readonly AdminCollection[]): AdminCollection[];
45
+ export declare function narrowCollections(collections: readonly AdminCollection[], grants: Readonly<Record<string, TableGrant>>): AdminCollection[];
49
46
  /**
50
47
  * A row's title, as the admin names the record: the collection's title
51
48
  * property where the row carries a readable value for it. Nothing where it
@@ -1,4 +1,5 @@
1
- import { McpAppBridge, isRecord } from "./bridge.js";
1
+ import { collectionsFromTables } from "../tables/project_table.js";
2
+ import { McpAppBridge } from "./bridge.js";
2
3
  import { createToolDriver, describeChanges, describeRefusal, needsConfirmation } from "./tool_driver.js";
3
4
  import { findCollection, parseResult } from "./payload.js";
4
5
  import { describeAppError } from "./code_app.js";
@@ -23,12 +24,6 @@ function startMcpView(options) {
23
24
  if (started) return;
24
25
  started = true;
25
26
  const parsed = parseResult(result);
26
- if (parsed.kind === "table") {
27
- const container = document.getElementById("root");
28
- if (container && options.mountTable) options.mountTable(bridge, container);
29
- else showError("This view cannot draw this result.");
30
- return;
31
- }
32
27
  if (parsed.kind === "error") {
33
28
  showError(parsed.message);
34
29
  return;
@@ -53,12 +48,15 @@ function embedHost(bridge, screen) {
53
48
  const context = createViewStore(bridge.hostContext);
54
49
  bridge.watchHostContext((next) => context.set(next));
55
50
  const told = modelContext(bridge);
51
+ const projected = collectionsFromTables(screen.tables);
52
+ let drawn = [];
53
+ const collectionOf = (name) => findCollection(drawn, name) ?? findCollection(projected, name);
56
54
  const tools = createToolDriver({
57
55
  callTool: (name, args) => bridge.callTool(name, args),
58
56
  actions: screen.actions,
59
57
  ...screen.firstPage && { seed: screen.firstPage },
60
58
  ...screen.seeds && { seeds: screen.seeds },
61
- collection: (name) => findCollection(screen.collections, name),
59
+ collection: collectionOf,
62
60
  confirm: (plan) => new Promise((resolve) => pending.set({
63
61
  plan,
64
62
  answer: (confirmed) => {
@@ -70,7 +68,7 @@ function embedHost(bridge, screen) {
70
68
  if (!needsConfirmation(intent)) saved.set(intent);
71
69
  },
72
70
  onChange: told.changes,
73
- rowLabel: (name, id, row) => rowTitle(findCollection(screen.collections, name), id, row),
71
+ rowLabel: (name, id, row) => rowTitle(collectionOf(name), id, row),
74
72
  onWriteFailed: (failure) => {
75
73
  refused.set(failure);
76
74
  told.writeFailed(failure);
@@ -82,7 +80,12 @@ function embedHost(bridge, screen) {
82
80
  authController: viewerAuth(screen.viewer),
83
81
  storageSource: VIEW_STORAGE_SOURCE,
84
82
  mode: bridge.hostContext.theme === "dark" ? "dark" : "light",
85
- narrowCollections: (collections) => narrowCollections(collections, screen.collections),
83
+ tables: screen.tables,
84
+ uiPreferences: screen.preferences,
85
+ narrowCollections: (collections) => {
86
+ drawn = narrowCollections(collections, screen.grants);
87
+ return [...drawn];
88
+ },
86
89
  renderCms: () => /* @__PURE__ */ jsx(McpScreen, {
87
90
  bridge,
88
91
  screen,
@@ -103,64 +106,42 @@ function embedHost(bridge, screen) {
103
106
  return host;
104
107
  }
105
108
  /**
106
- * The app's collections as this person may see them here: the project's own
107
- * configs — with their components — narrowed as the server narrowed the ones
108
- * it sent (`McpViewPayload` in the server's `mcp/mcp-view.ts`). A field the
109
- * server left out is left out; one it made read-only is read-only; its
110
- * security rules (the project's, and the one closing what the connection was
111
- * not granted) are the ones checked. A collection the server sent nothing
112
- * for is shown with every change closed: this screen did not ask for it.
109
+ * The app's collections as this person may see them here. They were composed
110
+ * from the descriptors the server sent — so a column the person may not read
111
+ * is not in them, and the CMS reads a column's write rule as it does on the
112
+ * project's page — with the project's own customizations and components. What
113
+ * remains is the connection: an operation its scopes were not granted on a
114
+ * table (`data:write`, `data:delete`) is closed by a restrictive rule, which
115
+ * is what the admin panel asks before it offers Add, Save or Delete. A
116
+ * collection the server sent no grant for (one the app declares beside the
117
+ * tables) is shown with every change closed: this screen did not ask for it.
113
118
  *
114
- * Where the app has no collections of its own (the view without a project),
115
- * the server's configs are the collections.
119
+ * None of it is the boundary — every save is the server's write tool, which
120
+ * checks the scopes, the column rules and RLS again — it keeps the view from
121
+ * offering what would be refused.
116
122
  */
117
- function narrowCollections(own, sent) {
118
- if (own.length === 0) return [...sent];
119
- const bySlug = new Map(sent.map((collection) => [collection.slug, collection]));
120
- return own.map((collection) => {
121
- const narrowed = bySlug.get(collection.slug);
122
- if (!narrowed) return {
123
+ function narrowCollections(collections, grants) {
124
+ return collections.map((collection) => {
125
+ const grant = grants[collection.slug];
126
+ const closed = [...grant?.write ? [] : ["insert", "update"], ...grant?.delete ? [] : ["delete"]];
127
+ if (closed.length === 0) return collection;
128
+ const rule = {
129
+ name: grant ? "mcp_connection_scope" : "mcp_view_not_opened",
130
+ mode: "restrictive",
131
+ operations: closed,
132
+ condition: {
133
+ kind: "rolesOverlap",
134
+ roles: [NOT_GRANTED]
135
+ }
136
+ };
137
+ return {
123
138
  ...collection,
124
- securityRules: [...collection.securityRules ?? [], CLOSED]
139
+ securityRules: [...collection.securityRules ?? [], rule]
125
140
  };
126
- const copy = { ...collection };
127
- return Object.assign(copy, {
128
- properties: narrowProperties(collection.properties, narrowed.properties),
129
- securityRules: narrowed.securityRules ?? collection.securityRules
130
- });
131
141
  });
132
142
  }
133
- /** The fields the server sent, with its read-only marks; the project's own config for each. */
134
- function narrowProperties(own, sent) {
135
- const narrowed = { ...own };
136
- for (const key of Object.keys(narrowed)) {
137
- const sentProperty = sent[key];
138
- if (!sentProperty) {
139
- delete narrowed[key];
140
- continue;
141
- }
142
- const property = narrowed[key];
143
- if (isRecord(sentProperty) && isRecord(sentProperty.admin) && sentProperty.admin.readOnly === true && isRecord(property)) Object.assign(narrowed, { [key]: {
144
- ...property,
145
- admin: {
146
- ...isRecord(property.admin) ? property.admin : {},
147
- readOnly: true
148
- }
149
- } });
150
- }
151
- return narrowed;
152
- }
153
- /** A restrictive rule no account passes, closing every change. */
154
- var CLOSED = {
155
- name: "mcp_view_not_opened",
156
- mode: "restrictive",
157
- operations: [
158
- "insert",
159
- "update",
160
- "delete"
161
- ],
162
- roles: ["__mcp_view_not_opened__"]
163
- };
143
+ /** A role no account holds: the condition of a rule meant never to pass. */
144
+ var NOT_GRANTED = "__mcp_connection_not_granted__";
164
145
  /**
165
146
  * The person the server drew the screen for, as the admin panel asks about
166
147
  * them: the security rules it evaluates before offering an action read
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/mcp_view/index.tsx"],"sourcesContent":["/**\n * `@rebasepro/cms/mcp-view`: a project's admin app, inside an MCP App view.\n *\n * A client like Claude shows what the show_* tools open (a collection, a\n * record, an app the model wrote) in a sandboxed frame next to the\n * conversation. This is what runs in that frame: it speaks the host's\n * protocol, reads and writes through the server's tools as the person, and\n * draws with the admin panel's own components — inside the project's own\n * admin app, so its custom views, entity views, fields, previews, actions,\n * plugins and slots are the ones drawn.\n *\n * ```ts\n * // the project's view entry (the Vite plugin generates it)\n * import { startMcpView } from \"@rebasepro/cms/mcp-view\";\n * startMcpView({ mountApp: () => import(\"./main\") });\n * ```\n *\n * The app mounts as it does on its own page; `<Rebase>`, `<RebaseCMS>`,\n * `<RebaseStudio>` and `<RebaseShell>` find the embed host this sets\n * (`setRebaseEmbedHost` in `@rebasepro/app`) and stand in what the frame\n * cannot give them: data through the tools, the person already signed in,\n * no routes, no network.\n *\n * @module\n */\nimport React from \"react\";\nimport { createRoot } from \"react-dom/client\";\nimport { getTitlePropertyKeyForValues, looksLikeIdentifierValue, setRebaseEmbedHost, type RebaseEmbedHost } from \"@rebasepro/app\";\nimport type { AdminCollection, AuthController } from \"@rebasepro/cms-types\";\nimport type { SecurityRule, User } from \"@rebasepro/types\";\nimport { Alert } from \"@rebasepro/ui\";\nimport { McpAppBridge, type HostContext, type ToolResult, type ViewBridge } from \"./bridge\";\nimport { createToolDriver, describeChanges, describeRefusal, needsConfirmation, type ToolDriver, type ViewChange, type WriteFailure, type WriteIntent } from \"./tool_driver\";\nimport { findCollection, parseResult, type Screen } from \"./payload\";\nimport { describeAppError, type AppError } from \"./code_app\";\nimport { McpScreen, type PendingPlan } from \"./screen\";\nimport { VIEW_STORAGE_SOURCE } from \"./storage_source\";\nimport { createViewStore } from \"./store\";\n\nexport { APPS_PROTOCOL_VERSION, McpAppBridge, isRecord } from \"./bridge\";\nimport { isRecord } from \"./bridge\";\nexport type { HostContext, ToolResult, DisplayMode, ViewBridge } from \"./bridge\";\nexport { createToolDriver, DEFAULT_ACTIONS, SaveCancelledError, describeChanges, describeFailedWrite, describeRefusal, needsConfirmation } from \"./tool_driver\";\nexport type { CallTool, SeedPage, ToolDriver, ViewActions, WritePlan, WriteIntent, ViewChange, WriteFailure } from \"./tool_driver\";\nexport { parseResult, actionsOf, filterOf } from \"./payload\";\nexport type { Screen, Block } from \"./payload\";\n\nexport interface McpViewOptions {\n /**\n * Mount the app, once the host is set: import the project's entry (which\n * renders its app as it would on its page), or render a default one into\n * `#root`. Given the screen the tool opened, for an app with no\n * collections of its own.\n */\n mountApp: (screen: Screen) => void | Promise<unknown>;\n /**\n * Draw a result from a server that predates the admin panel's views\n * (show_collection's columns only): the old table, where the view has it.\n */\n mountTable?: (bridge: ViewBridge, container: HTMLElement) => void;\n /** Name and version the view gives the host. */\n appInfo?: { name: string; version: string };\n /** The channel to the host; a new one on this window's parent by default. */\n bridge?: ViewBridge;\n}\n\n/**\n * Connect to the host, wait for the tool's result, set the embed host from\n * it, and mount the app.\n */\nexport function startMcpView(options: McpViewOptions): ViewBridge {\n installSubmitFix();\n const bridge = options.bridge ?? new McpAppBridge();\n let started = false;\n\n bridge.ontoolresult = (result: ToolResult) => {\n if (started) return;\n started = true;\n const parsed = parseResult(result);\n if (parsed.kind === \"table\") {\n const container = document.getElementById(\"root\");\n if (container && options.mountTable) options.mountTable(bridge, container);\n else showError(\"This view cannot draw this result.\");\n return;\n }\n if (parsed.kind === \"error\") {\n showError(parsed.message);\n return;\n }\n setRebaseEmbedHost(embedHost(bridge, parsed.screen));\n Promise.resolve(options.mountApp(parsed.screen))\n .catch(error => showError(`The view could not start: ${error instanceof Error ? error.message : String(error)}`));\n };\n\n // The host's light or dark, on the class the UI kit's `dark:` variant reads.\n bridge.watchHostContext(context => {\n if (context.theme) document.documentElement.classList.toggle(\"dark\", context.theme === \"dark\");\n });\n\n void bridge.connect(options.appInfo ?? { name: \"rebase\", version: \"0.3.0\" });\n return bridge;\n}\n\n/** What the app runs on, here: the tools, the person, the frame's storage and theme, and the screen to draw. */\nfunction embedHost(bridge: ViewBridge, screen: Screen): RebaseEmbedHost {\n const pending = createViewStore<PendingPlan | undefined>(undefined);\n const refused = createViewStore<WriteFailure | undefined>(undefined);\n const saved = createViewStore<WriteIntent | undefined>(undefined);\n const context = createViewStore<HostContext>(bridge.hostContext);\n bridge.watchHostContext(next => context.set(next));\n\n const told = modelContext(bridge);\n const tools: ToolDriver = createToolDriver({\n callTool: (name, args) => bridge.callTool(name, args),\n actions: screen.actions,\n ...(screen.firstPage && { seed: screen.firstPage }),\n ...(screen.seeds && { seeds: screen.seeds }),\n // A collection by whichever name it was read or written under: its\n // data path (the tools' name, the model's) or its slug (the admin's).\n collection: name => findCollection(screen.collections, name),\n confirm: plan => new Promise<boolean>(resolve => pending.set({\n plan,\n answer: confirmed => {\n pending.set(undefined);\n resolve(confirmed);\n }\n })),\n onWritten: intent => {\n if (!needsConfirmation(intent)) saved.set(intent);\n },\n onChange: told.changes,\n rowLabel: (name, id, row) => rowTitle(findCollection(screen.collections, name), id, row),\n onWriteFailed: failure => {\n refused.set(failure);\n told.writeFailed(failure);\n }\n });\n\n const host: RebaseEmbedHost = {\n dataDriver: tools.driver,\n // Code can write without a click, so the row hooks ask the person\n // before each write; a save made with the admin's own controls goes\n // as on any screen. A courtesy, not the boundary: every call is the\n // server's tool as the person, under their RLS and granted scopes.\n rowHooksDriver: tools.confirmingDriver,\n authController: viewerAuth(screen.viewer),\n storageSource: VIEW_STORAGE_SOURCE,\n mode: bridge.hostContext.theme === \"dark\" ? \"dark\" : \"light\",\n narrowCollections: collections => narrowCollections(collections, screen.collections),\n renderCms: () => (\n <McpScreen\n bridge={bridge}\n screen={screen}\n hostContext={context}\n pendingPlan={pending}\n savedWrite={saved}\n writeFailure={refused}\n onAppError={told.appError}\n />\n )\n };\n // The theme follows the host's.\n bridge.watchHostContext(next => {\n const mode = next.theme === \"dark\" ? \"dark\" : \"light\";\n if (mode !== host.mode) {\n host.mode = mode;\n setRebaseEmbedHost({ ...host });\n }\n });\n return host;\n}\n\n/**\n * The app's collections as this person may see them here: the project's own\n * configs — with their components — narrowed as the server narrowed the ones\n * it sent (`McpViewPayload` in the server's `mcp/mcp-view.ts`). A field the\n * server left out is left out; one it made read-only is read-only; its\n * security rules (the project's, and the one closing what the connection was\n * not granted) are the ones checked. A collection the server sent nothing\n * for is shown with every change closed: this screen did not ask for it.\n *\n * Where the app has no collections of its own (the view without a project),\n * the server's configs are the collections.\n */\nexport function narrowCollections(own: AdminCollection[], sent: readonly AdminCollection[]): AdminCollection[] {\n if (own.length === 0) return [...sent];\n const bySlug = new Map(sent.map(collection => [collection.slug, collection]));\n return own.map((collection): AdminCollection => {\n const narrowed = bySlug.get(collection.slug);\n if (!narrowed) {\n return { ...collection, securityRules: [...(collection.securityRules ?? []), CLOSED] };\n }\n const copy = { ...collection };\n return Object.assign(copy, {\n properties: narrowProperties(collection.properties, narrowed.properties),\n securityRules: narrowed.securityRules ?? collection.securityRules\n });\n });\n}\n\n/** The fields the server sent, with its read-only marks; the project's own config for each. */\nfunction narrowProperties<P extends Record<string, unknown>>(own: P, sent: Record<string, unknown>): P {\n const narrowed = { ...own };\n for (const key of Object.keys(narrowed)) {\n const sentProperty = sent[key];\n if (!sentProperty) {\n delete narrowed[key];\n continue;\n }\n const property = narrowed[key];\n if (isRecord(sentProperty) && isRecord(sentProperty.admin) && sentProperty.admin.readOnly === true && isRecord(property)) {\n Object.assign(narrowed, { [key]: { ...property, admin: { ...(isRecord(property.admin) ? property.admin : {}), readOnly: true } } });\n }\n }\n return narrowed;\n}\n\n/** A restrictive rule no account passes, closing every change. */\nconst CLOSED: SecurityRule = {\n name: \"mcp_view_not_opened\",\n mode: \"restrictive\",\n operations: [\"insert\", \"update\", \"delete\"],\n roles: [\"__mcp_view_not_opened__\"]\n};\n\n/**\n * The person the server drew the screen for, as the admin panel asks about\n * them: the security rules it evaluates before offering an action read\n * `uid` and `roles`. Signing out means nothing here — the host holds the\n * connection.\n */\nfunction viewerAuth(viewer: Screen[\"viewer\"]): AuthController {\n const user: User = {\n uid: viewer.uid,\n displayName: null,\n email: null,\n photoURL: null,\n providerId: \"mcp\",\n isAnonymous: false,\n roles: viewer.roles\n };\n return {\n user,\n initialLoading: false,\n authLoading: false,\n loginSkipped: true,\n storageEnabled: false,\n signOut: async () => undefined,\n getAuthToken: async () => \"\",\n extra: undefined,\n setExtra: () => undefined\n };\n}\n\n/**\n * What the model is told, sent with the person's next message: the changes\n * they made here, and an app's failure. Each update replaces the last, so\n * both go every time.\n */\nfunction modelContext(bridge: ViewBridge) {\n const state: { changes?: string; refused?: string; error?: string } = {};\n const send = () => {\n const text = [state.changes, state.refused, state.error].filter(Boolean).join(\"\\n\");\n if (text) void bridge.updateModelContext(text).catch(() => undefined);\n };\n return {\n changes: (changes: readonly ViewChange[]) => {\n state.changes = describeChanges(changes);\n send();\n },\n writeFailed: (failure: WriteFailure) => {\n state.refused = describeRefusal(failure);\n send();\n },\n appError: (error: AppError) => {\n state.error = describeAppError(error);\n send();\n }\n };\n}\n\n/**\n * A row's title, as the admin names the record: the collection's title\n * property where the row carries a readable value for it. Nothing where it\n * does not — an opaque id says no more than the caller's fallback.\n */\nexport function rowTitle(collection: AdminCollection | undefined, id: string, row: Record<string, unknown> | undefined): string | undefined {\n if (!collection || !row) return undefined;\n const key = getTitlePropertyKeyForValues(collection, row, id);\n const value = key ? row[key] : undefined;\n if (typeof value === \"number\") return String(value);\n return typeof value === \"string\" && value.trim() !== \"\" && !looksLikeIdentifierValue(value) ? value : undefined;\n}\n\n/** An error where the app would be, before it could start. */\nfunction showError(message: string): void {\n const container = document.getElementById(\"root\") ?? document.body.appendChild(document.createElement(\"div\"));\n createRoot(container).render(<div className=\"p-4\"><Alert color=\"error\" size=\"small\">{message}</Alert></div>);\n}\n\n/**\n * A host may sandbox the view without `allow-forms`, and then a form's submit\n * button submits nothing: the browser drops the submission before the form's\n * `submit` event — the admin panel's record form saves on that event. The\n * click still happens, so it is turned into the event itself, after the click\n * has finished (a button's own handler may say which save it was).\n */\nfunction installSubmitFix(): void {\n document.addEventListener(\"click\", (event) => {\n const button = event.target instanceof Element ? event.target.closest(\"button[type=submit]\") : null;\n if (!(button instanceof HTMLButtonElement) || !button.form || button.disabled) return;\n event.preventDefault();\n const form = button.form;\n setTimeout(() => form.dispatchEvent(new SubmitEvent(\"submit\", { bubbles: true, cancelable: true, submitter: button })));\n }, true);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAsEA,SAAgB,aAAa,SAAqC;CAC9D,iBAAiB;CACjB,MAAM,SAAS,QAAQ,UAAU,IAAI,aAAa;CAClD,IAAI,UAAU;CAEd,OAAO,gBAAgB,WAAuB;EAC1C,IAAI,SAAS;EACb,UAAU;EACV,MAAM,SAAS,YAAY,MAAM;EACjC,IAAI,OAAO,SAAS,SAAS;GACzB,MAAM,YAAY,SAAS,eAAe,MAAM;GAChD,IAAI,aAAa,QAAQ,YAAY,QAAQ,WAAW,QAAQ,SAAS;QACpE,UAAU,oCAAoC;GACnD;EACJ;EACA,IAAI,OAAO,SAAS,SAAS;GACzB,UAAU,OAAO,OAAO;GACxB;EACJ;EACA,mBAAmB,UAAU,QAAQ,OAAO,MAAM,CAAC;EACnD,QAAQ,QAAQ,QAAQ,SAAS,OAAO,MAAM,CAAC,CAAC,CAC3C,OAAM,UAAS,UAAU,6BAA6B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG,CAAC;CACxH;CAGA,OAAO,kBAAiB,YAAW;EAC/B,IAAI,QAAQ,OAAO,SAAS,gBAAgB,UAAU,OAAO,QAAQ,QAAQ,UAAU,MAAM;CACjG,CAAC;CAED,OAAY,QAAQ,QAAQ,WAAW;EAAE,MAAM;EAAU,SAAS;CAAQ,CAAC;CAC3E,OAAO;AACX;;AAGA,SAAS,UAAU,QAAoB,QAAiC;CACpE,MAAM,UAAU,gBAAyC,KAAA,CAAS;CAClE,MAAM,UAAU,gBAA0C,KAAA,CAAS;CACnE,MAAM,QAAQ,gBAAyC,KAAA,CAAS;CAChE,MAAM,UAAU,gBAA6B,OAAO,WAAW;CAC/D,OAAO,kBAAiB,SAAQ,QAAQ,IAAI,IAAI,CAAC;CA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,mBAAyB;CAC9B,SAAS,iBAAiB,UAAU,UAAU;EAC1C,MAAM,SAAS,MAAM,kBAAkB,UAAU,MAAM,OAAO,QAAQ,qBAAqB,IAAI;EAC/F,IAAI,EAAE,kBAAkB,sBAAsB,CAAC,OAAO,QAAQ,OAAO,UAAU;EAC/E,MAAM,eAAe;EACrB,MAAM,OAAO,OAAO;EACpB,iBAAiB,KAAK,cAAc,IAAI,YAAY,UAAU;GAAE,SAAS;GAAM,YAAY;GAAM,WAAW;EAAO,CAAC,CAAC,CAAC;CAC1H,GAAG,IAAI;AACX"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/mcp_view/index.tsx"],"sourcesContent":["/**\n * `@rebasepro/cms/mcp-view`: a project's admin app, inside an MCP App view.\n *\n * A client like Claude shows what the show_* tools open (a table's rows, a\n * record, an app the model wrote) in a sandboxed frame next to the\n * conversation. This is what runs in that frame: it speaks the host's\n * protocol, reads and writes through the server's tools as the person, and\n * draws with the admin panel's own components — inside the project's own\n * admin app, so its `customizeTable` customizations, custom views, entity\n * views, fields, previews, actions, plugins and slots are the ones drawn.\n *\n * The tables are the descriptors the tool result carries, redacted by the\n * server for this person: `<RebaseCMS>` renders them in place of the ones\n * its client would fetch, projected and customized exactly as on the\n * project's own page — the project's code customizations, then the UI\n * preferences the result carries (`ui-config.json` as the server knows it,\n * the workspace's, the person's), folded by the panel's own composition. The\n * generic view has no code customizations; the preferences still apply.\n *\n * ```ts\n * // the project's view entry (the Vite plugin generates it)\n * import { startMcpView } from \"@rebasepro/cms/mcp-view\";\n * startMcpView({ mountApp: () => import(\"./main\") });\n * ```\n *\n * The app mounts as it does on its own page; `<Rebase>`, `<RebaseCMS>`,\n * `<RebaseStudio>` and `<RebaseShell>` find the embed host this sets\n * (`setRebaseEmbedHost` in `@rebasepro/app`) and stand in what the frame\n * cannot give them: data through the tools, the tables from the result, the\n * person already signed in, no routes, no network.\n *\n * @module\n */\nimport React from \"react\";\nimport { createRoot } from \"react-dom/client\";\nimport { getTitlePropertyKeyForValues, looksLikeIdentifierValue, setRebaseEmbedHost, type RebaseEmbedHost } from \"@rebasepro/app\";\nimport type { AdminCollection, AuthController } from \"@rebasepro/cms-types\";\nimport type { SecurityOperation, SecurityRule, User } from \"@rebasepro/types\";\nimport { Alert } from \"@rebasepro/ui\";\nimport { McpAppBridge, type HostContext, type ToolResult, type ViewBridge } from \"./bridge\";\nimport { createToolDriver, describeChanges, describeRefusal, needsConfirmation, type ToolDriver, type ViewChange, type WriteFailure, type WriteIntent } from \"./tool_driver\";\nimport { findCollection, parseResult, type Screen, type TableGrant } from \"./payload\";\nimport { collectionsFromTables } from \"../tables\";\nimport { describeAppError, type AppError } from \"./code_app\";\nimport { McpScreen, type PendingPlan } from \"./screen\";\nimport { VIEW_STORAGE_SOURCE } from \"./storage_source\";\nimport { createViewStore } from \"./store\";\n\nexport { APPS_PROTOCOL_VERSION, McpAppBridge, isRecord } from \"./bridge\";\nexport type { HostContext, ToolResult, DisplayMode, ViewBridge } from \"./bridge\";\nexport { createToolDriver, DEFAULT_ACTIONS, SaveCancelledError, describeChanges, describeFailedWrite, describeRefusal, needsConfirmation } from \"./tool_driver\";\nexport type { CallTool, SeedPage, ToolDriver, ViewActions, WritePlan, WriteIntent, ViewChange, WriteFailure } from \"./tool_driver\";\nexport { parseResult, actionsOf, filterOf } from \"./payload\";\nexport type { Screen, Block, TableGrant, ScreenPreferences } from \"./payload\";\n\nexport interface McpViewOptions {\n /**\n * Mount the app, once the host is set: import the project's entry (which\n * renders its app as it would on its page), or render a default one into\n * `#root`. Given the screen the tool opened.\n */\n mountApp: (screen: Screen) => void | Promise<unknown>;\n /** Name and version the view gives the host. */\n appInfo?: { name: string; version: string };\n /** The channel to the host; a new one on this window's parent by default. */\n bridge?: ViewBridge;\n}\n\n/**\n * Connect to the host, wait for the tool's result, set the embed host from\n * it, and mount the app.\n */\nexport function startMcpView(options: McpViewOptions): ViewBridge {\n installSubmitFix();\n const bridge = options.bridge ?? new McpAppBridge();\n let started = false;\n\n bridge.ontoolresult = (result: ToolResult) => {\n if (started) return;\n started = true;\n const parsed = parseResult(result);\n if (parsed.kind === \"error\") {\n showError(parsed.message);\n return;\n }\n setRebaseEmbedHost(embedHost(bridge, parsed.screen));\n Promise.resolve(options.mountApp(parsed.screen))\n .catch(error => showError(`The view could not start: ${error instanceof Error ? error.message : String(error)}`));\n };\n\n // The host's light or dark, on the class the UI kit's `dark:` variant reads.\n bridge.watchHostContext(context => {\n if (context.theme) document.documentElement.classList.toggle(\"dark\", context.theme === \"dark\");\n });\n\n void bridge.connect(options.appInfo ?? { name: \"rebase\", version: \"0.3.0\" });\n return bridge;\n}\n\n/** What the app runs on, here: the tools, the person, the frame's storage and theme, and the screen to draw. */\nfunction embedHost(bridge: ViewBridge, screen: Screen): RebaseEmbedHost {\n const pending = createViewStore<PendingPlan | undefined>(undefined);\n const refused = createViewStore<WriteFailure | undefined>(undefined);\n const saved = createViewStore<WriteIntent | undefined>(undefined);\n const context = createViewStore<HostContext>(bridge.hostContext);\n bridge.watchHostContext(next => context.set(next));\n\n const told = modelContext(bridge);\n // The tables as the panel draws them — projected and customized, then\n // narrowed — once `<RebaseCMS>` has composed them; until then, and for a\n // table the app left out, as the CMS projects the descriptor. What a write\n // is sent by (a date-only column as its day, a belongsTo under its key) and\n // what a row is called.\n const projected: AdminCollection[] = collectionsFromTables(screen.tables);\n let drawn: readonly AdminCollection[] = [];\n const collectionOf = (name: string): AdminCollection | undefined =>\n findCollection(drawn, name) ?? findCollection(projected, name);\n const tools: ToolDriver = createToolDriver({\n callTool: (name, args) => bridge.callTool(name, args),\n actions: screen.actions,\n ...(screen.firstPage && { seed: screen.firstPage }),\n ...(screen.seeds && { seeds: screen.seeds }),\n // A table's collection by its slug: the name the tools, the model and\n // the admin panel all use.\n collection: collectionOf,\n confirm: plan => new Promise<boolean>(resolve => pending.set({\n plan,\n answer: confirmed => {\n pending.set(undefined);\n resolve(confirmed);\n }\n })),\n onWritten: intent => {\n if (!needsConfirmation(intent)) saved.set(intent);\n },\n onChange: told.changes,\n rowLabel: (name, id, row) => rowTitle(collectionOf(name), id, row),\n onWriteFailed: failure => {\n refused.set(failure);\n told.writeFailed(failure);\n }\n });\n\n const host: RebaseEmbedHost = {\n dataDriver: tools.driver,\n // Code can write without a click, so the row hooks ask the person\n // before each write; a save made with the admin's own controls goes\n // as on any screen. A courtesy, not the boundary: every call is the\n // server's tool as the person, under their RLS and granted scopes.\n rowHooksDriver: tools.confirmingDriver,\n authController: viewerAuth(screen.viewer),\n storageSource: VIEW_STORAGE_SOURCE,\n mode: bridge.hostContext.theme === \"dark\" ? \"dark\" : \"light\",\n tables: screen.tables,\n uiPreferences: screen.preferences,\n narrowCollections: collections => {\n drawn = narrowCollections(collections, screen.grants);\n return [...drawn];\n },\n renderCms: () => (\n <McpScreen\n bridge={bridge}\n screen={screen}\n hostContext={context}\n pendingPlan={pending}\n savedWrite={saved}\n writeFailure={refused}\n onAppError={told.appError}\n />\n )\n };\n // The theme follows the host's.\n bridge.watchHostContext(next => {\n const mode = next.theme === \"dark\" ? \"dark\" : \"light\";\n if (mode !== host.mode) {\n host.mode = mode;\n setRebaseEmbedHost({ ...host });\n }\n });\n return host;\n}\n\n/**\n * The app's collections as this person may see them here. They were composed\n * from the descriptors the server sent — so a column the person may not read\n * is not in them, and the CMS reads a column's write rule as it does on the\n * project's page — with the project's own customizations and components. What\n * remains is the connection: an operation its scopes were not granted on a\n * table (`data:write`, `data:delete`) is closed by a restrictive rule, which\n * is what the admin panel asks before it offers Add, Save or Delete. A\n * collection the server sent no grant for (one the app declares beside the\n * tables) is shown with every change closed: this screen did not ask for it.\n *\n * None of it is the boundary — every save is the server's write tool, which\n * checks the scopes, the column rules and RLS again — it keeps the view from\n * offering what would be refused.\n */\nexport function narrowCollections(collections: readonly AdminCollection[], grants: Readonly<Record<string, TableGrant>>): AdminCollection[] {\n return collections.map((collection): AdminCollection => {\n const grant = grants[collection.slug];\n const closed: SecurityOperation[] = [\n ...(grant?.write ? [] : [\"insert\", \"update\"] as const),\n ...(grant?.delete ? [] : [\"delete\"] as const)\n ];\n if (closed.length === 0) return collection;\n // A condition the evaluator decides (false) for everybody: a role no\n // account holds. The `roles` shortcut alone is a condition the\n // client-side evaluator leaves undecided, which the UI reads as allowed.\n const rule: SecurityRule = {\n name: grant ? \"mcp_connection_scope\" : \"mcp_view_not_opened\",\n mode: \"restrictive\",\n operations: closed,\n condition: { kind: \"rolesOverlap\", roles: [NOT_GRANTED] }\n };\n return { ...collection, securityRules: [...(collection.securityRules ?? []), rule] };\n });\n}\n\n/** A role no account holds: the condition of a rule meant never to pass. */\nconst NOT_GRANTED = \"__mcp_connection_not_granted__\";\n\n/**\n * The person the server drew the screen for, as the admin panel asks about\n * them: the security rules it evaluates before offering an action read\n * `uid` and `roles`. Signing out means nothing here — the host holds the\n * connection.\n */\nfunction viewerAuth(viewer: Screen[\"viewer\"]): AuthController {\n const user: User = {\n uid: viewer.uid,\n displayName: null,\n email: null,\n photoURL: null,\n providerId: \"mcp\",\n isAnonymous: false,\n roles: viewer.roles\n };\n return {\n user,\n initialLoading: false,\n authLoading: false,\n loginSkipped: true,\n storageEnabled: false,\n signOut: async () => undefined,\n getAuthToken: async () => \"\",\n extra: undefined,\n setExtra: () => undefined\n };\n}\n\n/**\n * What the model is told, sent with the person's next message: the changes\n * they made here, and an app's failure. Each update replaces the last, so\n * both go every time.\n */\nfunction modelContext(bridge: ViewBridge) {\n const state: { changes?: string; refused?: string; error?: string } = {};\n const send = () => {\n const text = [state.changes, state.refused, state.error].filter(Boolean).join(\"\\n\");\n if (text) void bridge.updateModelContext(text).catch(() => undefined);\n };\n return {\n changes: (changes: readonly ViewChange[]) => {\n state.changes = describeChanges(changes);\n send();\n },\n writeFailed: (failure: WriteFailure) => {\n state.refused = describeRefusal(failure);\n send();\n },\n appError: (error: AppError) => {\n state.error = describeAppError(error);\n send();\n }\n };\n}\n\n/**\n * A row's title, as the admin names the record: the collection's title\n * property where the row carries a readable value for it. Nothing where it\n * does not — an opaque id says no more than the caller's fallback.\n */\nexport function rowTitle(collection: AdminCollection | undefined, id: string, row: Record<string, unknown> | undefined): string | undefined {\n if (!collection || !row) return undefined;\n const key = getTitlePropertyKeyForValues(collection, row, id);\n const value = key ? row[key] : undefined;\n if (typeof value === \"number\") return String(value);\n return typeof value === \"string\" && value.trim() !== \"\" && !looksLikeIdentifierValue(value) ? value : undefined;\n}\n\n/** An error where the app would be, before it could start. */\nfunction showError(message: string): void {\n const container = document.getElementById(\"root\") ?? document.body.appendChild(document.createElement(\"div\"));\n createRoot(container).render(<div className=\"p-4\"><Alert color=\"error\" size=\"small\">{message}</Alert></div>);\n}\n\n/**\n * A host may sandbox the view without `allow-forms`, and then a form's submit\n * button submits nothing: the browser drops the submission before the form's\n * `submit` event — the admin panel's record form saves on that event. The\n * click still happens, so it is turned into the event itself, after the click\n * has finished (a button's own handler may say which save it was).\n */\nfunction installSubmitFix(): void {\n document.addEventListener(\"click\", (event) => {\n const button = event.target instanceof Element ? event.target.closest(\"button[type=submit]\") : null;\n if (!(button instanceof HTMLButtonElement) || !button.form || button.disabled) return;\n event.preventDefault();\n const form = button.form;\n setTimeout(() => form.dispatchEvent(new SubmitEvent(\"submit\", { bubbles: true, cancelable: true, submitter: button })));\n }, true);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwEA,SAAgB,aAAa,SAAqC;CAC9D,iBAAiB;CACjB,MAAM,SAAS,QAAQ,UAAU,IAAI,aAAa;CAClD,IAAI,UAAU;CAEd,OAAO,gBAAgB,WAAuB;EAC1C,IAAI,SAAS;EACb,UAAU;EACV,MAAM,SAAS,YAAY,MAAM;EACjC,IAAI,OAAO,SAAS,SAAS;GACzB,UAAU,OAAO,OAAO;GACxB;EACJ;EACA,mBAAmB,UAAU,QAAQ,OAAO,MAAM,CAAC;EACnD,QAAQ,QAAQ,QAAQ,SAAS,OAAO,MAAM,CAAC,CAAC,CAC3C,OAAM,UAAS,UAAU,6BAA6B,iBAAiB,QA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