@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
@@ -1,65 +1,188 @@
1
+ import { LiveSchemaError } from "./liveSchemaClient.js";
1
2
  import { useLiveSchemaEditing } from "./useLiveSchemaEditing.js";
2
- import { collectionForWire } from "./collection_wire.js";
3
+ import { SplitEditError } from "./split_edit_error.js";
4
+ import { useDetachRulesConfirmation } from "./useDetachRulesConfirmation.js";
5
+ import { FIRESTORE_COLLECTION_CALLEE } from "./firestore_callee.js";
3
6
  import { useEffect, useMemo, useRef, useState } from "react";
7
+ import { Fragment, jsxs } from "react/jsx-runtime";
4
8
  import { DEFAULT_API_PATH } from "@rebasepro/app";
5
- import { diffCollections } from "@rebasepro/types";
6
9
  //#region src/collection_editor/useLocalCollectionsConfigController.tsx
7
10
  /**
8
11
  * The guess this hook used to make on its own.
9
12
  *
10
13
  * `process.env.NODE_ENV` here is the *frontend bundle's* build mode. Whether
11
14
  * the schema editor exists is decided by a different process entirely — the
12
- * server's own `NODE_ENV`, its `collectionsDir`, whether its collections were
13
- * introspected, whether `ts-morph` is installed. The two disagree in every
14
- * ordinary setup: a dev frontend against a deployed API, a `baas` project, a
15
- * hosted console. When they did, the editor offered itself and every save came
16
- * back `404 Not Found`. It is kept only as the answer for a backend too old to
17
- * be asked.
15
+ * server's own `NODE_ENV`, its `schemaDir`, whether its tables were
16
+ * introspected, whether `ts-morph` is installed. It is kept only as the answer
17
+ * for a backend too old to be asked.
18
18
  */
19
19
  var buildModeGuess = () => process.env.NODE_ENV === "production";
20
+ var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
21
+ /** A table description as the wire carries it: checked for the fields the projector and the adoption read. */
22
+ function isTableDescriptor(value) {
23
+ return isRecord(value) && typeof value.name === "string" && typeof value.slug === "string" && typeof value.table === "string" && typeof value.schema === "string" && Array.isArray(value.columns) && Array.isArray(value.relations) && Array.isArray(value.primaryKey) && isRecord(value.rls);
24
+ }
25
+ /** One table of `GET …/unmapped-tables`, or of `…/unmapped-tables/:schema/:table` with its description. */
26
+ function readUnmappedTable(value) {
27
+ if (!isRecord(value) || typeof value.schema !== "string" || typeof value.table !== "string") return void 0;
28
+ return {
29
+ schema: value.schema,
30
+ table: value.table,
31
+ rlsEnabled: value.rlsEnabled === true,
32
+ policies: typeof value.policies === "number" ? value.policies : 0,
33
+ ...isTableDescriptor(value.descriptor) ? { descriptor: value.descriptor } : {},
34
+ ...typeof value.rlsRaised === "string" ? { rlsRaised: value.rlsRaised } : {},
35
+ ...typeof value.unimportable === "string" ? { unimportable: value.unimportable } : {},
36
+ notes: Array.isArray(value.notes) ? value.notes.filter((note) => typeof note === "string") : []
37
+ };
38
+ }
39
+ function readSummaries(body) {
40
+ if (!isRecord(body) || !Array.isArray(body.tables)) return [];
41
+ return body.tables.flatMap((entry) => {
42
+ if (!isRecord(entry) || typeof entry.slug !== "string" || typeof entry.file !== "string") return [];
43
+ const listed = (value, name) => Array.isArray(value) ? value.flatMap((item) => isRecord(item) && typeof item[name] === "string" ? [{
44
+ id: String(item[name]),
45
+ reason: typeof item.editedInCode === "string" ? item.editedInCode : void 0
46
+ }] : []) : [];
47
+ return [{
48
+ slug: entry.slug,
49
+ file: entry.file,
50
+ ...typeof entry.editedInCode === "string" ? { editedInCode: entry.editedInCode } : {},
51
+ columns: listed(entry.columns, "key").map((c) => ({
52
+ key: c.id,
53
+ ...c.reason ? { editedInCode: c.reason } : {}
54
+ })),
55
+ relations: listed(entry.relations, "name").map((r) => ({
56
+ name: r.id,
57
+ ...r.reason ? { editedInCode: r.reason } : {}
58
+ })),
59
+ ...typeof entry.rlsEditedInCode === "string" ? { rlsEditedInCode: entry.rlsEditedInCode } : {}
60
+ }];
61
+ });
62
+ }
63
+ function readCalls(body) {
64
+ if (!isRecord(body) || !Array.isArray(body.calls)) return [];
65
+ return body.calls.flatMap((entry) => {
66
+ if (!isRecord(entry) || typeof entry.value !== "string" || typeof entry.file !== "string" || typeof entry.version !== "string") return [];
67
+ const fields = {};
68
+ if (isRecord(entry.members)) {
69
+ for (const [member, reason] of Object.entries(entry.members)) if (typeof reason === "string" && member.startsWith("fields.")) fields[member.slice(7)] = reason;
70
+ }
71
+ return [{
72
+ slug: entry.value,
73
+ file: entry.file,
74
+ version: entry.version,
75
+ info: {
76
+ file: entry.file,
77
+ fields,
78
+ ...typeof entry.editedInCode === "string" ? { editedInCode: entry.editedInCode } : {}
79
+ }
80
+ }];
81
+ });
82
+ }
83
+ /** `values` in the order of `order` (the ones it does not name last), in the shape they were given in. */
84
+ function reorderEnum(values, order) {
85
+ const rank = (id) => {
86
+ const at = order.indexOf(id);
87
+ return at === -1 ? order.length : at;
88
+ };
89
+ if (Array.isArray(values)) return [...values].sort((a, b) => rank(String(a.id)) - rank(String(b.id)));
90
+ return Object.fromEntries(Object.entries(values).sort(([a], [b]) => rank(a) - rank(b)));
91
+ }
92
+ function sourceInfoOf(summary) {
93
+ const columns = {};
94
+ for (const column of summary.columns ?? []) if (column.editedInCode) columns[column.key] = column.editedInCode;
95
+ for (const relation of summary.relations ?? []) if (relation.editedInCode) columns[relation.name] = relation.editedInCode;
96
+ return {
97
+ file: summary.file,
98
+ ...summary.editedInCode ? { editedInCode: summary.editedInCode } : {},
99
+ fields: columns,
100
+ ...summary.rlsEditedInCode ? { rlsEditedInCode: summary.rlsEditedInCode } : {}
101
+ };
102
+ }
103
+ /**
104
+ * An error a save ends with that the editor shows as more than a line:
105
+ * `SCHEMA_EDIT_DOES_NOT_COMPILE` with its problems, a refusal, a file changed
106
+ * on disk since the preview. Carries the server's code and problems.
107
+ */
108
+ var SchemaEditRefused = class extends Error {
109
+ code;
110
+ problems;
111
+ constructor(message, code, problems = []) {
112
+ super(message);
113
+ this.code = code;
114
+ this.problems = problems;
115
+ this.name = "SchemaEditRefused";
116
+ }
117
+ };
118
+ /**
119
+ * The collections config controller the panel builds when the collection
120
+ * editor is on.
121
+ *
122
+ * A save is split ({@link splitEdit}) into the schema edit — `TablePatch`
123
+ * operations for the server's schema editor, through the plan-and-confirm
124
+ * dialog when live schema editing is on, straight to the source-only editor
125
+ * when it is not — and the presentation delta, written to the UI preferences
126
+ * store. A Firestore collection is defined in the frontend: on a development
127
+ * server its save is an edit of its `defineFirestoreCollection` call
128
+ * (`firestoreCollectionPatches`), written by the server's frontend source
129
+ * editor; anywhere else it is read-only here.
130
+ */
20
131
  function useLocalCollectionsConfigController(clientOrUrl, baseCollections = [], options) {
21
132
  const parsedCollections = baseCollections;
22
133
  const optionsRef = useRef(options);
23
134
  optionsRef.current = options;
24
- const clientBaseUrl = typeof clientOrUrl === "string" ? clientOrUrl : clientOrUrl?.baseUrl ?? "";
25
- const clientApiPath = typeof clientOrUrl === "object" && clientOrUrl !== null && clientOrUrl.apiPath || DEFAULT_API_PATH;
26
- const editorUrl = `${String(clientBaseUrl).replace(/\/$/, "")}${clientApiPath}/admin/schema-editor`;
135
+ const transport = typeof clientOrUrl === "string" ? { baseUrl: clientOrUrl } : clientOrUrl ?? {};
136
+ const clientBaseUrl = String(transport.baseUrl ?? "").replace(/\/$/, "");
137
+ const clientApiPath = transport.apiPath || DEFAULT_API_PATH;
138
+ const editorUrl = `${clientBaseUrl}${clientApiPath}/admin/schema-editor`;
27
139
  const resolveToken = async () => {
28
140
  let token = optionsRef.current?.getAuthToken ? await optionsRef.current.getAuthToken() : null;
29
- if (!token && typeof clientOrUrl === "object" && clientOrUrl !== null && clientOrUrl.resolveToken) token = await clientOrUrl.resolveToken();
141
+ if (!token && transport.resolveToken) token = await transport.resolveToken() ?? null;
30
142
  return token ?? null;
31
143
  };
32
- const request = async (endpoint, payload) => {
144
+ /** A call to the source-only editor; a refusal becomes {@link SchemaEditRefused} with the server's problems. */
145
+ const request = async (method, endpoint, payload) => {
146
+ const token = await resolveToken();
147
+ const headers = { "Content-Type": "application/json" };
148
+ if (token) headers.Authorization = `Bearer ${token}`;
149
+ const response = await fetch(`${editorUrl}${endpoint}`, {
150
+ method,
151
+ headers,
152
+ ...payload ? { body: JSON.stringify(payload) } : {}
153
+ });
154
+ const text = await response.text();
155
+ let body;
33
156
  try {
34
- const token = await resolveToken();
35
- const headers = { "Content-Type": "application/json" };
36
- if (token) headers["Authorization"] = `Bearer ${token}`;
37
- const response = await fetch(`${editorUrl}${endpoint}`, {
38
- method: "POST",
39
- headers,
40
- body: JSON.stringify(payload)
41
- });
42
- if (!response.ok) {
43
- const text = await response.text();
44
- let err = {};
45
- try {
46
- err = JSON.parse(text);
47
- } catch (e) {}
48
- if (Object.keys(err).length === 0) err = { message: text };
49
- console.error("dev server error payload:", err);
50
- const errObj = err.error;
51
- const errMessage = typeof errObj === "object" && errObj !== null ? errObj.message : typeof errObj === "string" ? errObj : err.message;
52
- throw new Error(errMessage || "Error communicating with local dev server");
53
- }
54
- } catch (e) {
55
- console.error("fetch request failed", e);
56
- throw e;
157
+ body = text ? JSON.parse(text) : void 0;
158
+ } catch {
159
+ body = void 0;
57
160
  }
161
+ if (response.ok) return body;
162
+ const error = isRecord(body) && isRecord(body.error) ? body.error : void 0;
163
+ const details = error && isRecord(error.details) ? error.details : void 0;
164
+ const problems = Array.isArray(details?.problems) ? details.problems.flatMap((p) => isRecord(p) && typeof p.message === "string" ? [{
165
+ table: typeof p.table === "string" ? p.table : "",
166
+ ...typeof p.key === "string" ? { key: p.key } : {},
167
+ message: p.message
168
+ }] : []) : [];
169
+ throw new SchemaEditRefused(typeof error?.message === "string" && error.message || text || `The schema editor answered ${response.status}.`, typeof error?.code === "string" ? error.code : void 0, problems);
58
170
  };
59
171
  const noSchemaAccess = options?.mayReadSchema === false;
60
172
  const forcedReadOnly = noSchemaAccess ? true : options?.readOnly;
61
173
  const authKey = options?.authKey ?? null;
62
174
  const [availability, setAvailability] = useState({ state: "unknown" });
175
+ const [sources, setSources] = useState({});
176
+ /** The Firestore collections the frontend source editor found, by slug. */
177
+ const [frontendCalls, setFrontendCalls] = useState({});
178
+ /** Ask the frontend source editor where each Firestore collection is written, and what in it is code. */
179
+ const refreshFrontendCalls = async () => {
180
+ const listed = await request("GET", `/frontend/calls?callee=${FIRESTORE_COLLECTION_CALLEE}&key=slug&list=fields`).catch(() => void 0);
181
+ if (listed === void 0) return;
182
+ const next = {};
183
+ for (const call of readCalls(listed)) next[call.slug] = call;
184
+ setFrontendCalls(next);
185
+ };
63
186
  useEffect(() => {
64
187
  if (forcedReadOnly === true) return;
65
188
  let cancelled = false;
@@ -74,15 +197,25 @@ function useLocalCollectionsConfigController(clientOrUrl, baseCollections = [],
74
197
  }
75
198
  const body = await response.json().catch(() => ({}));
76
199
  if (cancelled) return;
77
- if (response.ok) setAvailability({
78
- state: "known",
79
- enabled: body.enabled === true,
80
- reason: body.reason
81
- });
82
- else setAvailability({
200
+ if (response.ok) {
201
+ setAvailability({
202
+ state: "known",
203
+ enabled: body.enabled === true,
204
+ reason: body.reason
205
+ });
206
+ if (body.enabled === true) {
207
+ const listed = await request("GET", "/tables").catch(() => void 0);
208
+ if (!cancelled && listed !== void 0) {
209
+ const next = {};
210
+ for (const summary of readSummaries(listed)) next[summary.slug] = sourceInfoOf(summary);
211
+ setSources(next);
212
+ }
213
+ if (!cancelled) await refreshFrontendCalls();
214
+ }
215
+ } else setAvailability({
83
216
  state: "known",
84
217
  enabled: false,
85
- reason: body.error?.message ?? `The backend refused to say whether collections are editable (HTTP ${response.status}).`
218
+ reason: body.error?.message ?? `The backend refused to say whether tables are editable (HTTP ${response.status}).`
86
219
  });
87
220
  } catch {
88
221
  if (!cancelled) setAvailability({ state: "unknown" });
@@ -96,120 +229,254 @@ function useLocalCollectionsConfigController(clientOrUrl, baseCollections = [],
96
229
  forcedReadOnly,
97
230
  authKey
98
231
  ]);
232
+ const sourceEditorEnabled = availability.state === "known" && availability.enabled;
233
+ useEffect(() => {
234
+ if (sourceEditorEnabled && forcedReadOnly !== true) refreshFrontendCalls();
235
+ }, [parsedCollections]);
99
236
  const liveSchema = useLiveSchemaEditing({
100
- baseUrl: `${String(clientBaseUrl).replace(/\/$/, "")}${clientApiPath}/admin/schema`,
237
+ baseUrl: `${clientBaseUrl}${clientApiPath}/admin/schema`,
101
238
  getAuthToken: resolveToken,
102
239
  authKey,
103
240
  enabled: forcedReadOnly !== true
104
241
  });
242
+ const detach = useDetachRulesConfirmation();
243
+ const tablesBySlug = useMemo(() => {
244
+ const map = /* @__PURE__ */ new Map();
245
+ for (const table of options?.tables ?? []) map.set(table.slug, table);
246
+ return map;
247
+ }, [options?.tables]);
105
248
  /**
106
- * Perform a write, through the live editor when there is one.
107
- *
108
- * `sourceOnly` is the write this controller has always done. It stays the
109
- * whole behaviour on a backend that cannot edit its schema — a bundle
110
- * deployment, a non-Postgres driver, a version too old to be asked — so
111
- * nothing about the editor depends on the feature being there.
249
+ * Send a schema edit: through the live editor (planned, shown, confirmed)
250
+ * when there is one, to the source-only editor when there is not.
112
251
  */
113
- const write = async (collectionId, change) => {
114
- if ("patch" in change && change.patch.length === 0) return;
115
- const available = await liveSchema.ready();
116
- const proposed = {
117
- collectionId,
118
- ...change
119
- };
120
- if (!available.enabled) {
121
- await request("/collection/save", "patch" in change ? {
122
- collectionId,
123
- patch: change.patch
124
- } : {
125
- collectionId,
126
- collectionData: change.collection
252
+ const writeSchema = async (table, patches) => {
253
+ if (patches.length === 0) return;
254
+ if ((await liveSchema.ready()).enabled) {
255
+ await liveSchema.reviewChange({
256
+ table,
257
+ patches
127
258
  });
128
259
  return;
129
260
  }
130
- await liveSchema.reviewChange(proposed);
261
+ try {
262
+ await request("POST", "/apply", { patches });
263
+ } catch (error) {
264
+ if (error instanceof LiveSchemaError) throw new SchemaEditRefused(error.message, error.code, error.problems);
265
+ throw error;
266
+ }
267
+ };
268
+ const writePresentation = async (slug, delta) => {
269
+ if (Object.keys(delta).length === 0) return;
270
+ const writer = optionsRef.current?.presentation;
271
+ if (!writer) throw new Error(`How "${slug}" is presented (labels, columns, view modes) is stored as a UI preference, and this panel has no preferences store. Sign in, or customize the table with customizeTable in the frontend.`);
272
+ await writer.save(slug, delta);
273
+ };
274
+ const findCollection = (id) => parsedCollections.find((c) => c.slug === id);
275
+ /** A collection that is not a served table is defined in the frontend: refuse to edit it here. */
276
+ const assertTable = (collection, slug) => {
277
+ if (!collection || tablesBySlug.size === 0 || tablesBySlug.has(slug)) return;
278
+ throw new SplitEditError("EXTERNAL_COLLECTION", `"${slug}" is not a table of this backend: it is defined in the frontend (frontend/src/cms), which the schema editor does not write. Edit it there.`);
131
279
  };
132
- const liveEditing = liveSchema.status?.enabled === true;
133
- const readOnly = forcedReadOnly ?? (liveEditing ? false : availability.state === "known" ? !availability.enabled : buildModeGuess());
134
- const readOnlyReason = noSchemaAccess || liveEditing ? void 0 : availability.state === "known" && availability.reason ? availability.reason : "Collections can only be edited against a backend running the schema editor, which is off in production.";
135
- const findCollection = (id) => parsedCollections.find((c) => c.id === id || c.slug === id);
136
280
  /**
137
- * What to send for a collection that should end up as `saving`.
138
- *
139
- * For one that exists: the difference from `loaded` — what the person
140
- * changed — and nothing else. Both sides are the same view model, through
141
- * JSON, so whatever JSON cannot carry (a handler, a shared property, an
142
- * imported enum) is absent from both and never appears as a change; the
143
- * server writes only the keys the patch names. A collection this does not
144
- * recognise is a new one — a duplicate among them — and is sent whole,
145
- * with each relation's target as its slug (see `collectionForWire`).
281
+ * Whether Firestore collections can be edited here: the dev server's
282
+ * source editor is on, which writes their `defineFirestoreCollection`
283
+ * calls in frontend/src/cms. Off — production, a deployed API, no
284
+ * `schema:read` — they are read-only, with where to edit them.
146
285
  */
147
- const changeFor = (id, saving, loaded) => {
148
- const current = loaded ?? findCollection(id);
149
- return current ? { patch: diffCollections(current, saving) } : { collection: collectionForWire(saving) };
286
+ const frontendEditable = forcedReadOnly !== true && sourceEditorEnabled;
287
+ /** Save a Firestore collection: the whole edit is an edit of its definition in the frontend. */
288
+ const saveFirestore = async (slug, after, before) => {
289
+ if (!frontendEditable) throw new SplitEditError("EXTERNAL_COLLECTION", `"${slug}" is a Firestore collection: it is defined in the frontend (frontend/src/cms), and only a development server's source editor writes the frontend. Edit it there.`);
290
+ const loaded = before ?? findCollection(slug);
291
+ if (!loaded) throw new Error(`No collection "${slug}" is open in the editor.`);
292
+ const { firestoreCollectionPatches, firestoreSourceEdit } = await import("./firestore_edit.js");
293
+ const patches = firestoreCollectionPatches(loaded, after);
294
+ if (patches.length === 0) return;
295
+ await request("POST", "/frontend/apply", firestoreSourceEdit(slug, patches, frontendCalls[slug]?.version));
296
+ await refreshFrontendCalls();
297
+ };
298
+ /** A table being imported, projected as the served tables are, its relations resolved among them. */
299
+ const projectedImport = async (descriptor) => {
300
+ const { collectionFromTable } = await import("../tables/project_table.js");
301
+ return collectionFromTable(descriptor, { tables: [...(optionsRef.current?.tables ?? []).filter((table) => table.slug !== descriptor.slug), descriptor] });
302
+ };
303
+ /** Write one split edit: the schema first, then — once the schema took — the presentation. */
304
+ const commit = async (edit) => {
305
+ if (edit.detachesInheritedRules) await detach.confirm(edit.table);
306
+ await writeSchema(edit.table, edit.schema);
307
+ await writePresentation(edit.table, edit.presentation);
308
+ };
309
+ const save = async (slug, after, before, adopting) => {
310
+ if (adopting) {
311
+ const { splitEdit } = await import("./split_edit.js");
312
+ const projected = before ?? await projectedImport(adopting);
313
+ await commit(splitEdit({
314
+ before: projected,
315
+ after,
316
+ table: adopting,
317
+ adopt: true
318
+ }));
319
+ return;
320
+ }
321
+ const loaded = before ?? findCollection(slug);
322
+ if ((loaded ?? after).engine === "firestore") {
323
+ await saveFirestore(slug, after, loaded);
324
+ return;
325
+ }
326
+ assertTable(loaded, slug);
327
+ const { splitEdit } = await import("./split_edit.js");
328
+ await commit(splitEdit({
329
+ before: loaded,
330
+ after,
331
+ table: tablesBySlug.get(slug)
332
+ }));
333
+ };
334
+ const liveEditing = liveSchema.status?.enabled === true;
335
+ const servedRedacted = parsedCollections.some((c) => (c.securityRules ?? []).some((rule) => isRecord(rule) && rule.redacted === true));
336
+ const readOnly = forcedReadOnly ?? (servedRedacted ? true : liveEditing ? false : availability.state === "known" ? !availability.enabled : buildModeGuess());
337
+ const readOnlyReason = noSchemaAccess ? void 0 : servedRedacted ? "Some of the rules were served to you redacted: only an admin can save schema changes, because saving would write the redacted marker back." : liveEditing ? void 0 : availability.state === "known" && availability.reason ? availability.reason : "Tables can only be edited against a backend running the schema editor, which is off in production.";
338
+ const currentOf = (id) => {
339
+ const found = findCollection(id);
340
+ if (!found) throw new Error(`No table "${id}" is open in the editor.`);
341
+ return found;
342
+ };
343
+ /** The collection of a table, or a refusal naming where an external collection is defined. */
344
+ const tableOf = (id) => {
345
+ const found = currentOf(id);
346
+ if (found.engine === "firestore") throw new SplitEditError("EXTERNAL_COLLECTION", `"${id}" is a Firestore collection: it is defined in the frontend (frontend/src/cms), which the schema editor does not write. Edit it there.`);
347
+ return found;
348
+ };
349
+ /** A Firestore collection with `properties` replaced, saved. */
350
+ const saveFirestoreProperties = async (current, properties, order) => {
351
+ const firestoreProperties = {};
352
+ for (const [key, property] of Object.entries(properties)) {
353
+ if (property.type === "relation" || property.type === "vector") throw new SplitEditError("NOT_A_COLUMN", `"${key}" is a ${property.type}, which Firestore does not store: that belongs to a Postgres table.`, key);
354
+ firestoreProperties[key] = property;
355
+ }
356
+ await saveFirestore(current.slug, {
357
+ ...current,
358
+ engine: "firestore",
359
+ properties: firestoreProperties,
360
+ ...order ? { propertiesOrder: order } : {}
361
+ }, current);
362
+ };
363
+ const columnProperty = (key, property) => {
364
+ if (property.type === "reference") throw new SplitEditError("NOT_A_COLUMN", `"${key}" is a reference, which a table stores as a text column: make it a text field and point it at the other table with \`referenceTo\` in its customization.`, key);
365
+ return property;
150
366
  };
151
- /** `findCollection`, as the record a patch is computed from. */
152
- const currentOf = (id) => findCollection(id) ?? {};
153
367
  return useMemo(() => ({
154
368
  loading: false,
155
369
  readOnly,
156
370
  readOnlyReason,
371
+ frontendCollectionsEditable: frontendEditable,
157
372
  collections: parsedCollections,
158
- dialog: liveSchema.dialog,
159
- getCollection: (id) => {
160
- const found = findCollection(id);
161
- if (found) return found;
162
- throw Error(`Collection ${id} not found in local mode`);
163
- },
164
- saveCollection: async ({ id, collectionData, baseline }) => {
165
- await write(id, changeFor(id, collectionData, baseline));
373
+ tableSource: (slug) => sources[slug] ?? frontendCalls[slug]?.info,
374
+ dialog: /* @__PURE__ */ jsxs(Fragment, { children: [liveSchema.dialog, detach.dialog] }),
375
+ getCollection: (id) => currentOf(id),
376
+ saveCollection: async ({ id, collectionData, baseline, adopting }) => {
377
+ await save(id, collectionData, baseline, adopting);
166
378
  },
167
379
  updateCollection: async ({ id, collectionData }) => {
168
- const current = findCollection(id);
169
- await write(id, current ? { patch: diffCollections(current, {
170
- ...current,
171
- ...collectionData
172
- }) } : { collection: collectionForWire(collectionData) });
173
- },
174
- deleteCollection: async ({ id }) => {
175
- if (!(await liveSchema.ready()).enabled) {
176
- await request("/collection/delete", { collectionId: id });
380
+ const current = currentOf(id);
381
+ if (current.engine === "firestore") {
382
+ const edited = { ...current };
383
+ for (const [key, value] of Object.entries(collectionData)) if (value === void 0) Reflect.deleteProperty(edited, key);
384
+ else Reflect.set(edited, key, value);
385
+ await saveFirestore(id, edited, current);
177
386
  return;
178
387
  }
179
- await liveSchema.reviewChange({
180
- collectionId: id,
181
- remove: true
182
- });
388
+ const after = { ...tableOf(id) };
389
+ for (const [key, value] of Object.entries(collectionData)) if (value === void 0) Reflect.deleteProperty(after, key);
390
+ else Reflect.set(after, key, value);
391
+ await save(id, after);
392
+ },
393
+ deleteCollection: async ({ id }) => {
394
+ if (findCollection(id)?.engine === "firestore") throw new SplitEditError("EXTERNAL_COLLECTION", `"${id}" is a Firestore collection: delete it in code — its file in frontend/src/cms and its entry in \`externalCollections\`. Its documents stay in Firestore.`);
395
+ assertTable(findCollection(id), id);
396
+ await writeSchema(id, [{
397
+ op: "deleteTable",
398
+ table: id
399
+ }]);
400
+ },
401
+ applyTablePatches: async (table, patches) => {
402
+ await writeSchema(table, patches);
403
+ },
404
+ listUnmappedTables: async () => {
405
+ const body = await request("GET", "/unmapped-tables");
406
+ return (isRecord(body) && Array.isArray(body.tables) ? body.tables : []).flatMap((table) => readUnmappedTable(table) ?? []);
407
+ },
408
+ describeUnmappedTable: async (schema, table) => {
409
+ const body = await request("GET", `/unmapped-tables/${encodeURIComponent(schema)}/${encodeURIComponent(table)}`);
410
+ const found = isRecord(body) ? readUnmappedTable(body.table) : void 0;
411
+ const descriptor = found?.descriptor;
412
+ if (!found || !descriptor) throw new Error(`The schema editor did not describe "${schema}"."${table}".`);
413
+ return {
414
+ table: found,
415
+ descriptor,
416
+ collection: await projectedImport(descriptor)
417
+ };
183
418
  },
184
419
  saveProperty: async ({ path, propertyKey, property, newPropertiesOrder }) => {
185
- const current = currentOf(path);
186
- await write(path, { patch: diffCollections(current, {
420
+ const external = currentOf(path);
421
+ if (external.engine === "firestore") {
422
+ await saveFirestoreProperties(external, {
423
+ ...external.properties,
424
+ [propertyKey]: property
425
+ }, newPropertiesOrder);
426
+ return;
427
+ }
428
+ const current = tableOf(path);
429
+ await save(path, {
187
430
  ...current,
188
431
  properties: {
189
- ...current.properties ?? {},
190
- [propertyKey]: property
432
+ ...current.properties,
433
+ [propertyKey]: columnProperty(propertyKey, property)
191
434
  },
192
435
  ...newPropertiesOrder ? { propertiesOrder: newPropertiesOrder } : {}
193
- }) });
436
+ });
194
437
  },
195
438
  deleteProperty: async ({ path, propertyKey, newPropertiesOrder }) => {
196
- const current = currentOf(path);
439
+ const external = currentOf(path);
440
+ if (external.engine === "firestore") {
441
+ const { [propertyKey]: _gone, ...rest } = external.properties;
442
+ await saveFirestoreProperties(external, rest, newPropertiesOrder);
443
+ return;
444
+ }
445
+ const current = tableOf(path);
197
446
  const { [propertyKey]: _removed, ...properties } = current.properties ?? {};
198
- await write(path, { patch: diffCollections(current, {
447
+ await save(path, {
199
448
  ...current,
200
449
  properties,
201
450
  ...newPropertiesOrder ? { propertiesOrder: newPropertiesOrder } : {}
202
- }) });
451
+ });
203
452
  },
204
- updatePropertiesOrder: async ({ collection, fullPath, newPropertiesOrder }) => {
205
- const collectionId = collection.id || fullPath.split("/").pop() || "";
206
- const current = currentOf(collectionId);
207
- await write(collectionId, { patch: diffCollections(current, {
208
- ...current,
209
- propertiesOrder: newPropertiesOrder
210
- }) });
453
+ updatePropertiesOrder: async ({ collection, newPropertiesOrder }) => {
454
+ const external = findCollection(collection.slug);
455
+ if (external?.engine === "firestore") {
456
+ await saveFirestore(collection.slug, {
457
+ ...external,
458
+ propertiesOrder: [...newPropertiesOrder]
459
+ }, external);
460
+ return;
461
+ }
462
+ await writePresentation(collection.slug, { fieldOrder: [...newPropertiesOrder] });
463
+ },
464
+ updateKanbanColumnsOrder: async ({ collection, kanbanColumnProperty, newColumnsOrder }) => {
465
+ const external = findCollection(collection.slug);
466
+ if (external?.engine === "firestore") {
467
+ const property = external.properties[kanbanColumnProperty];
468
+ if (!property || property.type !== "string" || !property.enum) throw new Error(`"${kanbanColumnProperty}" of "${collection.slug}" is not a string field with values to order.`);
469
+ await saveFirestoreProperties(external, {
470
+ ...external.properties,
471
+ [kanbanColumnProperty]: {
472
+ ...property,
473
+ enum: reorderEnum(property.enum, newColumnsOrder)
474
+ }
475
+ });
476
+ return;
477
+ }
478
+ await writePresentation(collection.slug, { fields: { [kanbanColumnProperty]: { enumOrder: [...newColumnsOrder] } } });
211
479
  },
212
- updateKanbanColumnsOrder: async () => {},
213
480
  navigationEntries: [],
214
481
  saveNavigationEntries: async () => {}
215
482
  }), [
@@ -217,12 +484,17 @@ function useLocalCollectionsConfigController(clientOrUrl, baseCollections = [],
217
484
  parsedCollections,
218
485
  readOnly,
219
486
  readOnlyReason,
487
+ sources,
488
+ frontendCalls,
489
+ frontendEditable,
490
+ tablesBySlug,
220
491
  options?.getAuthToken,
221
492
  liveSchema.dialog,
222
- liveSchema.status
493
+ liveSchema.status,
494
+ detach.dialog
223
495
  ]);
224
496
  }
225
497
  //#endregion
226
- export { useLocalCollectionsConfigController };
498
+ export { SchemaEditRefused, useLocalCollectionsConfigController };
227
499
 
228
500
  //# sourceMappingURL=useLocalCollectionsConfigController.js.map