@rebasepro/cms 0.30.0 → 0.31.0-canary.g902a0ce
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/dist/collection_editor/ConfigControllerProvider.js +25 -22
- package/dist/collection_editor/ConfigControllerProvider.js.map +1 -1
- package/dist/collection_editor/firestore_callee.d.ts +10 -0
- package/dist/collection_editor/firestore_callee.js +15 -0
- package/dist/collection_editor/firestore_callee.js.map +1 -0
- package/dist/collection_editor/firestore_edit.d.ts +62 -0
- package/dist/collection_editor/firestore_edit.js +339 -0
- package/dist/collection_editor/firestore_edit.js.map +1 -0
- package/dist/collection_editor/index.d.ts +2 -3
- package/dist/collection_editor/liveSchemaClient.d.ts +44 -22
- package/dist/collection_editor/liveSchemaClient.js +9 -3
- package/dist/collection_editor/liveSchemaClient.js.map +1 -1
- package/dist/collection_editor/property_column.d.ts +86 -0
- package/dist/collection_editor/property_column.js +719 -0
- package/dist/collection_editor/property_column.js.map +1 -0
- package/dist/collection_editor/serializable_types.d.ts +2 -24
- package/dist/collection_editor/serializable_utils.d.ts +1 -1
- package/dist/collection_editor/serializable_utils.js +2 -1
- package/dist/collection_editor/serializable_utils.js.map +1 -1
- package/dist/collection_editor/split_edit.d.ts +106 -0
- package/dist/collection_editor/split_edit.js +564 -0
- package/dist/collection_editor/split_edit.js.map +1 -0
- package/dist/collection_editor/split_edit_error.d.ts +25 -0
- package/dist/collection_editor/split_edit_error.js +35 -0
- package/dist/collection_editor/split_edit_error.js.map +1 -0
- package/dist/collection_editor/types/collection_editor_controller.d.ts +1 -1
- package/dist/collection_editor/types/config_controller.d.ts +67 -1
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +6 -5
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js +44 -12
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js +18 -3
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js +94 -55
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/CollectionRelationsTab.d.ts +2 -1
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/EnumForm.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/EnumForm.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js +3 -3
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +2 -3
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyTree.d.ts +7 -4
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js +15 -5
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js +1 -1
- package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/SchemaEditRefusalView.d.ts +20 -0
- package/dist/collection_editor/ui/collection_editor/SchemaEditRefusalView.js +74 -0
- package/dist/collection_editor/ui/collection_editor/SchemaEditRefusalView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/conditions/property_paths.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/rlsRuleForm.d.ts +34 -0
- package/dist/collection_editor/ui/collection_editor/rlsRuleForm.js +50 -0
- package/dist/collection_editor/ui/collection_editor/rlsRuleForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.d.ts +1 -2
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js.map +1 -1
- package/dist/collection_editor/useDetachRulesConfirmation.d.ts +16 -0
- package/dist/collection_editor/useDetachRulesConfirmation.js +48 -0
- package/dist/collection_editor/useDetachRulesConfirmation.js.map +1 -0
- package/dist/collection_editor/useLiveSchemaEditing.d.ts +2 -2
- package/dist/collection_editor/useLiveSchemaEditing.js +1 -1
- package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -1
- package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +54 -10
- package/dist/collection_editor/useLocalCollectionsConfigController.js +394 -122
- package/dist/collection_editor/useLocalCollectionsConfigController.js.map +1 -1
- package/dist/collection_editor/validateCollectionJson.js.map +1 -1
- package/dist/components/CollectionPanel.d.ts +10 -9
- package/dist/components/CollectionPanel.js +5 -2
- package/dist/components/CollectionPanel.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionRowActions.d.ts +1 -2
- package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionTableBindingProps.d.ts +3 -5
- package/dist/components/CollectionTableBinding/PropertyTableCell.d.ts +2 -2
- package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -1
- package/dist/components/CollectionTableBinding/column_utils.d.ts +1 -1
- package/dist/components/CollectionTableBinding/column_utils.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.d.ts +2 -2
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +1 -2
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.d.ts +2 -2
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +2 -2
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableRelationField.d.ts +2 -2
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js +1 -2
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.d.ts +2 -1
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.d.ts +2 -2
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.d.ts +1 -1
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js +1 -1
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/common.d.ts +1 -2
- package/dist/components/CollectionTableBinding/internal/common.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.d.ts +1 -1
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +2 -2
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -1
- package/dist/components/CollectionTableBinding/table_bindings.d.ts +2 -2
- package/dist/components/CollectionTableBinding/table_bindings.js.map +1 -1
- package/dist/components/CollectionViewBinding/BoardCardBinding.d.ts +1 -1
- package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.d.ts +1 -2
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +9 -5
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.d.ts +1 -2
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionEntityActions.d.ts +1 -1
- package/dist/components/CollectionViewBinding/CollectionEntityActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.d.ts +1 -2
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +1 -1
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionToolbar.js +1 -1
- package/dist/components/CollectionViewBinding/CollectionToolbar.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewActions.js +2 -4
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +6 -6
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewContent.js +1 -2
- package/dist/components/CollectionViewBinding/CollectionViewContent.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.d.ts +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CustomViewHost.d.ts +1 -2
- package/dist/components/CollectionViewBinding/CustomViewHost.js.map +1 -1
- package/dist/components/CollectionViewBinding/EntitiesCount.js +3 -3
- package/dist/components/CollectionViewBinding/EntitiesCount.js.map +1 -1
- package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +1 -2
- package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js +1 -1
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js.map +1 -1
- package/dist/components/CollectionViewBinding/FilterPresetsButton.d.ts +1 -2
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js +1 -1
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js.map +1 -1
- package/dist/components/CollectionViewBinding/FiltersButton.d.ts +1 -2
- package/dist/components/CollectionViewBinding/FiltersButton.js.map +1 -1
- package/dist/components/CollectionViewBinding/FiltersDialog.d.ts +1 -1
- package/dist/components/CollectionViewBinding/FiltersDialog.js.map +1 -1
- package/dist/components/CollectionViewBinding/PluginColumnSlots.d.ts +1 -2
- package/dist/components/CollectionViewBinding/PluginColumnSlots.js.map +1 -1
- package/dist/components/CollectionViewBinding/RowActions.d.ts +1 -2
- package/dist/components/CollectionViewBinding/RowActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/SortButton.d.ts +1 -1
- package/dist/components/CollectionViewBinding/SortButton.js.map +1 -1
- package/dist/components/CollectionViewBinding/SplitListView.d.ts +1 -2
- package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -1
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.d.ts +1 -2
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js +1 -1
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js.map +1 -1
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.d.ts +1 -2
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js.map +1 -1
- package/dist/components/CollectionViewBinding/useBoardDataController.d.ts +2 -1
- package/dist/components/CollectionViewBinding/useBoardDataController.js +3 -3
- package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -1
- package/dist/components/CollectionViewBinding/useCollectionViewState.d.ts +2 -4
- package/dist/components/CollectionViewBinding/useCollectionViewState.js +14 -19
- package/dist/components/CollectionViewBinding/useCollectionViewState.js.map +1 -1
- package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +1 -3
- package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -1
- package/dist/components/CollectionViewBinding/useSelectionController.d.ts +1 -2
- package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -1
- package/dist/components/CollectionsProvider.d.ts +23 -8
- package/dist/components/CollectionsProvider.js +23 -7
- package/dist/components/CollectionsProvider.js.map +1 -1
- package/dist/components/DefaultDrawer.js +1 -1
- package/dist/components/DeleteEntityDialog.d.ts +1 -1
- package/dist/components/DeleteEntityDialog.js +1 -1
- package/dist/components/DeleteEntityDialog.js.map +1 -1
- package/dist/components/DetailViewBinding.js +3 -3
- package/dist/components/DetailViewBinding.js.map +1 -1
- package/dist/components/EditFormActions.js.map +1 -1
- package/dist/components/EditViewBinding.d.ts +2 -1
- package/dist/components/EditViewBinding.js +6 -6
- package/dist/components/EditViewBinding.js.map +1 -1
- package/dist/components/EntityDisplayHeader.d.ts +1 -2
- package/dist/components/EntityDisplayHeader.js.map +1 -1
- package/dist/components/EntityInspector.d.ts +1 -2
- package/dist/components/EntityInspector.js.map +1 -1
- package/dist/components/EntityPreviewBinding.d.ts +1 -1
- package/dist/components/EntityPreviewBinding.js +1 -1
- package/dist/components/EntityPreviewBinding.js.map +1 -1
- package/dist/components/EntityViewBinding.d.ts +1 -1
- package/dist/components/EntityViewBinding.js.map +1 -1
- package/dist/components/EntityViewBody.d.ts +1 -1
- package/dist/components/EntityViewBody.js +3 -4
- package/dist/components/EntityViewBody.js.map +1 -1
- package/dist/components/FieldValue.js +2 -2
- package/dist/components/FieldValue.js.map +1 -1
- package/dist/components/HomePage/ContentHomePage.js +12 -3
- package/dist/components/HomePage/ContentHomePage.js.map +1 -1
- package/dist/components/InlineEntityPreview.d.ts +1 -1
- package/dist/components/InlineEntityPreview.js.map +1 -1
- package/dist/components/PropertyCollectionView.d.ts +2 -2
- package/dist/components/PropertyCollectionView.js.map +1 -1
- package/dist/components/PropertyConfigBadge.js.map +1 -1
- package/dist/components/RebaseCMS.d.ts +22 -3
- package/dist/components/RebaseCMS.js +32 -14
- package/dist/components/RebaseCMS.js.map +1 -1
- package/dist/components/RebaseNavigation.js +106 -31
- package/dist/components/RebaseNavigation.js.map +1 -1
- package/dist/components/RecordDetail.js +4 -1
- package/dist/components/RecordDetail.js.map +1 -1
- package/dist/components/RecordForm.d.ts +5 -5
- package/dist/components/RecordForm.js +5 -2
- package/dist/components/RecordForm.js.map +1 -1
- package/dist/components/ReferenceTable/SelectionTableBinding.d.ts +2 -2
- package/dist/components/ReferenceTable/SelectionTableBinding.js +1 -1
- package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -1
- package/dist/components/ReferenceWidget.d.ts +2 -1
- package/dist/components/ReferenceWidget.js +2 -2
- package/dist/components/ReferenceWidget.js.map +1 -1
- package/dist/components/RelationSelector.d.ts +2 -1
- package/dist/components/RelationSelector.js +2 -3
- package/dist/components/RelationSelector.js.map +1 -1
- package/dist/components/SelectableTable/SelectableTable.d.ts +2 -2
- package/dist/components/SelectableTable/SelectableTable.js.map +1 -1
- package/dist/components/SelectableTable/filters/FilterFieldBinding.d.ts +2 -1
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js +3 -3
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js.map +1 -1
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js +2 -2
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -1
- package/dist/components/SelectableTable/filters/RelationFilterField.d.ts +1 -1
- package/dist/components/SelectableTable/filters/RelationFilterField.js +1 -1
- package/dist/components/SelectableTable/filters/RelationFilterField.js.map +1 -1
- package/dist/components/SelectableTable/filters/StringNumberFilterField.d.ts +1 -1
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js.map +1 -1
- package/dist/components/SelectableTable/filters/null_filter.d.ts +1 -3
- package/dist/components/SelectableTable/filters/null_filter.js.map +1 -1
- package/dist/components/SidePanelBinding.js +1 -1
- package/dist/components/SidePanelBinding.js.map +1 -1
- package/dist/components/field_configs.d.ts +1 -2
- package/dist/components/field_configs.js.map +1 -1
- package/dist/components/field_ids.d.ts +1 -1
- package/dist/components/field_ids.js +1 -1
- package/dist/components/field_ids.js.map +1 -1
- package/dist/components/history/EntityHistoryEntry.js.map +1 -1
- package/dist/components/history/EntityHistoryView.d.ts +1 -2
- package/dist/components/history/EntityHistoryView.js +1 -1
- package/dist/components/history/EntityHistoryView.js.map +1 -1
- package/dist/data_export/export/BasicExportAction.d.ts +1 -1
- package/dist/data_export/export/BasicExportAction.js.map +1 -1
- package/dist/data_export/export/ExportCollectionAction.js +2 -2
- package/dist/data_export/export/ExportCollectionAction.js.map +1 -1
- package/dist/data_export/export/additional_fields.d.ts +1 -1
- package/dist/data_export/export/additional_fields.js.map +1 -1
- package/dist/data_export/export/export.d.ts +1 -1
- package/dist/data_export/export/export.js +1 -1
- package/dist/data_export/export/export.js.map +1 -1
- package/dist/data_export/export/fetch_export_data.d.ts +3 -2
- package/dist/data_export/export/fetch_export_data.js.map +1 -1
- package/dist/data_import/components/DataNewPropertiesMapping.d.ts +1 -1
- package/dist/data_import/components/DataNewPropertiesMapping.js.map +1 -1
- package/dist/data_import/components/ImportNewPropertyFieldPreview.d.ts +1 -1
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js.map +1 -1
- package/dist/data_import/hooks/useImportConfig.js.map +1 -1
- package/dist/data_import/import/ImportCollectionAction.d.ts +2 -2
- package/dist/data_import/import/ImportCollectionAction.js.map +1 -1
- package/dist/data_import/types/column_mapping.d.ts +1 -1
- package/dist/data_import/utils/data.d.ts +1 -2
- package/dist/data_import/utils/data.js +1 -2
- package/dist/data_import/utils/data.js.map +1 -1
- package/dist/data_import/utils/get_import_inference_type.d.ts +1 -1
- package/dist/data_import/utils/get_import_inference_type.js.map +1 -1
- package/dist/data_import/utils/id_column.d.ts +1 -1
- package/dist/data_import/utils/id_column.js.map +1 -1
- package/dist/data_import/utils/import_columns.d.ts +1 -1
- package/dist/data_import/utils/import_columns.js.map +1 -1
- package/dist/data_import/utils/save_entities.d.ts +3 -3
- package/dist/data_import/utils/save_entities.js +1 -1
- package/dist/data_import/utils/save_entities.js.map +1 -1
- package/dist/form/EntityForm.js +2 -1
- package/dist/form/EntityForm.js.map +1 -1
- package/dist/form/EntityFormActions.js.map +1 -1
- package/dist/form/EntityFormBinding.js +2 -2
- package/dist/form/EntityFormBinding.js.map +1 -1
- package/dist/form/FormFieldsContext.d.ts +1 -4
- package/dist/form/FormFieldsContext.js +1 -1
- package/dist/form/FormFieldsContext.js.map +1 -1
- package/dist/form/PropertyFieldBinding.js +6 -8
- package/dist/form/PropertyFieldBinding.js.map +1 -1
- package/dist/form/components/FieldBlock.d.ts +1 -2
- package/dist/form/components/FieldBlock.js.map +1 -1
- package/dist/form/components/FieldHelperText.d.ts +1 -1
- package/dist/form/components/FieldHelperText.js.map +1 -1
- package/dist/form/components/FormRail.d.ts +1 -1
- package/dist/form/components/FormRail.js.map +1 -1
- package/dist/form/components/LocalChangesMenu.d.ts +1 -1
- package/dist/form/components/LocalChangesMenu.js.map +1 -1
- package/dist/form/components/StorageItemPreview.d.ts +1 -1
- package/dist/form/components/StorageItemPreview.js.map +1 -1
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js +1 -1
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +2 -2
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +2 -2
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/BinaryFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/BinaryFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/BlockFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/BlockFieldBinding.js +1 -1
- package/dist/form/field_bindings/BlockFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/DateTimeFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/DateTimeFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/GeopointFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/GeopointFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/KeyValueFieldBinding.js +1 -2
- package/dist/form/field_bindings/KeyValueFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MapFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MultiSelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MultiSelectFieldBinding.js +1 -1
- package/dist/form/field_bindings/MultiSelectFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MultipleRelationFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js +2 -2
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ReferenceFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ReferenceFieldBinding.js +2 -2
- package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/RelationFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/RelationFieldBinding.js +2 -2
- package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/RepeatFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/RepeatFieldBinding.js +1 -1
- package/dist/form/field_bindings/RepeatFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/SelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/SelectFieldBinding.js +1 -1
- package/dist/form/field_bindings/SelectFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +2 -2
- package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/SwitchFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/SwitchFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/TextFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/TextFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/UserSelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/UserSelectFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/VectorFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/VectorFieldBinding.js.map +1 -1
- package/dist/form/form_utils.d.ts +3 -3
- package/dist/form/form_utils.js +1 -2
- package/dist/form/form_utils.js.map +1 -1
- package/dist/form/label_placement.d.ts +1 -2
- package/dist/form/label_placement.js.map +1 -1
- package/dist/form/resolve_cell_property.d.ts +1 -2
- package/dist/form/resolve_cell_property.js +1 -1
- package/dist/form/resolve_cell_property.js.map +1 -1
- package/dist/form/resolve_form_properties.d.ts +2 -2
- package/dist/form/resolve_form_properties.js +1 -1
- package/dist/form/resolve_form_properties.js.map +1 -1
- package/dist/form/useClearRestoreValue.d.ts +1 -1
- package/dist/form/useClearRestoreValue.js.map +1 -1
- package/dist/form/validation.d.ts +2 -2
- package/dist/form/validation.js +1 -1
- package/dist/form/validation.js.map +1 -1
- package/dist/hooks/navigation/compose_collections.d.ts +59 -0
- package/dist/hooks/navigation/compose_collections.js +48 -0
- package/dist/hooks/navigation/compose_collections.js.map +1 -0
- package/dist/hooks/navigation/compose_collections_input.d.ts +8 -0
- package/dist/hooks/navigation/compose_collections_input.js +17 -0
- package/dist/hooks/navigation/compose_collections_input.js.map +1 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.d.ts +1 -1
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js.map +1 -1
- package/dist/hooks/navigation/registered_collection.d.ts +15 -0
- package/dist/hooks/navigation/registered_collection.js +20 -0
- package/dist/hooks/navigation/registered_collection.js.map +1 -0
- package/dist/hooks/navigation/ui_preferences.d.ts +47 -0
- package/dist/hooks/navigation/ui_preferences.js +179 -0
- package/dist/hooks/navigation/ui_preferences.js.map +1 -0
- package/dist/hooks/navigation/useAsyncResolver.d.ts +8 -1
- package/dist/hooks/navigation/useAsyncResolver.js +9 -3
- package/dist/hooks/navigation/useAsyncResolver.js.map +1 -1
- package/dist/hooks/navigation/useBuildCollectionRegistryController.d.ts +1 -3
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js +3 -3
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js.map +1 -1
- package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +9 -5
- package/dist/hooks/navigation/useBuildNavigationStateController.js +2 -1
- package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -1
- package/dist/hooks/navigation/useBuildUrlController.d.ts +1 -1
- package/dist/hooks/navigation/useBuildUrlController.js.map +1 -1
- package/dist/hooks/navigation/useNavigationResolution.js +1 -2
- package/dist/hooks/navigation/useNavigationResolution.js.map +1 -1
- package/dist/hooks/navigation/usePanelTables.d.ts +11 -0
- package/dist/hooks/navigation/usePanelTables.js +33 -0
- package/dist/hooks/navigation/usePanelTables.js.map +1 -0
- package/dist/hooks/navigation/useResolvedCollections.d.ts +8 -3
- package/dist/hooks/navigation/useResolvedCollections.js +3 -2
- package/dist/hooks/navigation/useResolvedCollections.js.map +1 -1
- package/dist/hooks/navigation/useResolvedViews.d.ts +1 -2
- package/dist/hooks/navigation/useResolvedViews.js.map +1 -1
- package/dist/hooks/navigation/useTopLevelNavigation.d.ts +1 -2
- package/dist/hooks/navigation/useTopLevelNavigation.js.map +1 -1
- package/dist/hooks/navigation/user_preferences_overlay.d.ts +21 -0
- package/dist/hooks/navigation/user_preferences_overlay.js +101 -0
- package/dist/hooks/navigation/user_preferences_overlay.js.map +1 -0
- package/dist/hooks/navigation/utils.js +1 -1
- package/dist/hooks/navigation/utils.js.map +1 -1
- package/dist/hooks/useAdminContext.d.ts +1 -2
- package/dist/hooks/useAdminContext.js.map +1 -1
- package/dist/hooks/useBuildSidePanel.d.ts +1 -2
- package/dist/hooks/useBuildSidePanel.js +2 -1
- package/dist/hooks/useBuildSidePanel.js.map +1 -1
- package/dist/hooks/useChildViewSource.d.ts +1 -1
- package/dist/hooks/useChildViewSource.js +1 -1
- package/dist/hooks/useChildViewSource.js.map +1 -1
- package/dist/hooks/useEntityDisplay.d.ts +1 -2
- package/dist/hooks/useEntityDisplay.js +1 -1
- package/dist/hooks/useEntityDisplay.js.map +1 -1
- package/dist/hooks/useEntityDisplayTitle.d.ts +2 -2
- package/dist/hooks/useEntityDisplayTitle.js.map +1 -1
- package/dist/hooks/useHistory.js +1 -1
- package/dist/hooks/useHistory.js.map +1 -1
- package/dist/hooks/useRecordActions.d.ts +1 -2
- package/dist/hooks/useRecordActions.js.map +1 -1
- package/dist/hooks/useReferencePaths.d.ts +21 -7
- package/dist/hooks/useReferencePaths.js +23 -6
- package/dist/hooks/useReferencePaths.js.map +1 -1
- package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
- package/dist/hooks/useResolvedNavigationFrom.js +1 -1
- package/dist/hooks/useResolvedNavigationFrom.js.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +8 -2
- package/dist/mcp_view/app_modules.d.ts +2 -2
- package/dist/mcp_view/app_modules.js +4 -4
- package/dist/mcp_view/app_modules.js.map +1 -1
- package/dist/mcp_view/index.d.ts +16 -19
- package/dist/mcp_view/index.js +43 -62
- package/dist/mcp_view/index.js.map +1 -1
- package/dist/mcp_view/payload.d.ts +54 -18
- package/dist/mcp_view/payload.js +49 -24
- package/dist/mcp_view/payload.js.map +1 -1
- package/dist/mcp_view/screen.js +11 -11
- package/dist/mcp_view/screen.js.map +1 -1
- package/dist/mcp_view/tool_driver.d.ts +5 -34
- package/dist/mcp_view/tool_driver.js +17 -16
- package/dist/mcp_view/tool_driver.js.map +1 -1
- package/dist/mcp_view/write_review.d.ts +1 -2
- package/dist/mcp_view/write_review.js +1 -1
- package/dist/mcp_view/write_review.js.map +1 -1
- package/dist/preview/PropertyPreview.d.ts +1 -1
- package/dist/preview/PropertyPreview.js +4 -3
- package/dist/preview/PropertyPreview.js.map +1 -1
- package/dist/preview/components/ArrayEnumPreview.d.ts +1 -1
- package/dist/preview/components/ArrayEnumPreview.js.map +1 -1
- package/dist/preview/components/BooleanPreview.d.ts +1 -1
- package/dist/preview/components/BooleanPreview.js.map +1 -1
- package/dist/preview/components/EnumValuesChip.d.ts +1 -1
- package/dist/preview/components/EnumValuesChip.js +1 -1
- package/dist/preview/components/EnumValuesChip.js.map +1 -1
- package/dist/preview/components/ReferencePreview.d.ts +1 -1
- package/dist/preview/components/ReferencePreview.js.map +1 -1
- package/dist/preview/components/RelationPreview.d.ts +1 -1
- package/dist/preview/components/RelationPreview.js.map +1 -1
- package/dist/preview/components/StorageThumbnail.js +2 -1
- package/dist/preview/components/StorageThumbnail.js.map +1 -1
- package/dist/preview/components/UserPreview.d.ts +1 -1
- package/dist/preview/components/UserPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfMapsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfMapsPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfReferencesPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfRelationsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js +2 -1
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfStringsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfStringsPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOneOfPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOneOfPreview.js +1 -1
- package/dist/preview/property_previews/ArrayOneOfPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js +1 -1
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayPropertyPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayPropertyPreview.js +1 -1
- package/dist/preview/property_previews/ArrayPropertyPreview.js.map +1 -1
- package/dist/preview/property_previews/MapPropertyPreview.d.ts +1 -1
- package/dist/preview/property_previews/MapPropertyPreview.js.map +1 -1
- package/dist/preview/property_previews/NumberPropertyPreview.d.ts +1 -1
- package/dist/preview/property_previews/NumberPropertyPreview.js +1 -1
- package/dist/preview/property_previews/NumberPropertyPreview.js.map +1 -1
- package/dist/preview/property_previews/SkeletonPropertyComponent.d.ts +1 -1
- package/dist/preview/property_previews/SkeletonPropertyComponent.js.map +1 -1
- package/dist/preview/property_previews/StringPropertyPreview.d.ts +1 -1
- package/dist/preview/property_previews/StringPropertyPreview.js.map +1 -1
- package/dist/preview/util.d.ts +1 -1
- package/dist/preview/util.js.map +1 -1
- package/dist/routes/RebaseRoute.js +2 -2
- package/dist/routes/RebaseRoute.js.map +1 -1
- package/dist/saved_apps/SavedAppsView.d.ts +1 -1
- package/dist/saved_apps/SavedAppsView.js +1 -1
- package/dist/saved_apps/SavedAppsView.js.map +1 -1
- package/dist/selection/SelectionMenu.d.ts +1 -1
- package/dist/selection/SelectionMenu.js.map +1 -1
- package/dist/selection/resolve_selection.d.ts +3 -3
- package/dist/selection/resolve_selection.js +3 -2
- package/dist/selection/resolve_selection.js.map +1 -1
- package/dist/tables/apply_customization.d.ts +65 -0
- package/dist/tables/apply_customization.js +644 -0
- package/dist/tables/apply_customization.js.map +1 -0
- package/dist/tables/column_property.d.ts +64 -0
- package/dist/tables/column_property.js +549 -0
- package/dist/tables/column_property.js.map +1 -0
- package/dist/tables/customize_table.d.ts +39 -0
- package/dist/tables/customize_table.js +247 -0
- package/dist/tables/customize_table.js.map +1 -0
- package/dist/tables/index.d.ts +12 -0
- package/dist/tables/labels.d.ts +18 -0
- package/dist/tables/labels.js +18 -0
- package/dist/tables/labels.js.map +1 -0
- package/dist/tables/project_table.d.ts +79 -0
- package/dist/tables/project_table.js +148 -0
- package/dist/tables/project_table.js.map +1 -0
- package/dist/tables/relations.d.ts +47 -0
- package/dist/tables/relations.js +112 -0
- package/dist/tables/relations.js.map +1 -0
- package/dist/tables/rls.d.ts +39 -0
- package/dist/tables/rls.js +111 -0
- package/dist/tables/rls.js.map +1 -0
- package/dist/tables/update_record.d.ts +32 -0
- package/dist/tables/update_record.js +40 -0
- package/dist/tables/update_record.js.map +1 -0
- package/dist/types/components/EntityFormActionsProps.d.ts +1 -1
- package/dist/types/components/PropertyPreviewProps.d.ts +2 -2
- package/dist/types/fields.d.ts +2 -2
- package/dist/util/dataControllerAdapter.js.map +1 -1
- package/dist/util/entity_pages.d.ts +2 -1
- package/dist/util/entity_pages.js.map +1 -1
- package/dist/util/find_entities_by_ids.d.ts +2 -2
- package/dist/util/find_entities_by_ids.js +1 -1
- package/dist/util/find_entities_by_ids.js.map +1 -1
- package/dist/util/format_collection_date.d.ts +1 -1
- package/dist/util/format_collection_date.js.map +1 -1
- package/dist/util/identity.d.ts +8 -0
- package/dist/util/identity.js +16 -0
- package/dist/util/identity.js.map +1 -0
- package/dist/util/navigation_utils.js +1 -1
- package/dist/util/navigation_utils.js.map +1 -1
- package/dist/util/previews.js +1 -1
- package/dist/util/previews.js.map +1 -1
- package/dist/util/propertyConfigMapper.d.ts +1 -1
- package/dist/util/propertyConfigMapper.js.map +1 -1
- package/dist/util/property_utils.d.ts +1 -3
- package/dist/util/property_utils.js +1 -1
- package/dist/util/property_utils.js.map +1 -1
- package/dist/util/relations.d.ts +18 -0
- package/dist/util/relations.js +32 -0
- package/dist/util/relations.js.map +1 -0
- package/package.json +12 -10
- package/recipes/README.md +4 -4
- package/recipes/my-preferences.tsx +34 -26
- package/recipes/site-settings.tsx +34 -27
- package/dist/collection_editor/collection_wire.d.ts +0 -13
- package/dist/collection_editor/collection_wire.js +0 -49
- package/dist/collection_editor/collection_wire.js.map +0 -1
- package/dist/collection_editor/useJsonCollectionsConfigController.d.ts +0 -37
- package/dist/collection_editor/useJsonCollectionsConfigController.js +0 -191
- package/dist/collection_editor/useJsonCollectionsConfigController.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split_edit.js","names":[],"sources":["../../src/collection_editor/split_edit.ts"],"sourcesContent":["/**\n * One edit in the collection editor, split into what it changes about the\n * table and what it changes about how the panel presents it.\n *\n * The editor edits one collection view model at a time — the panel's flat\n * collection of `Property`s, projected from the table the server serves and\n * customized. Saving it is two different writes (POSTGRES-FIRST.md §6.4):\n *\n * - **Schema** — column types, nullability, defaults, validation, enum values,\n * storage rules, relations, row-level security, `history`, `description` —\n * is a list of {@link TablePatch} operations for the server's schema editor,\n * which edits `backend/schema/*.ts` and nothing else.\n * - **Presentation** — labels, icon, group, view modes, column order, hidden\n * columns, widths, enum labels and colours, kanban — is a\n * {@link UiTablePreferences} delta, stored as a UI preference (a JSON UI\n * config in development, `rebase.ui_preferences` when deployed).\n *\n * Nothing presentational is ever sent to the schema routes and nothing about\n * the schema is ever stored as a preference: the presentation keys are exactly\n * `UI_PREFERENCE_TABLE_KEYS` / `UI_PREFERENCE_FIELD_KEYS`, every one of them a\n * `customizeTable` key (checked at compile time below).\n *\n * The module is pure: given the collection before and after, and the table as\n * served, it returns the two writes, or throws {@link SplitEditError} for an\n * edit that is not an edit (renaming a slug is a migration).\n *\n * @module\n */\nimport type {\n SecurityRule,\n TableDescriptor,\n TablePatch,\n UiDisplayPreferences,\n UiFieldPreferences,\n UiTablePreferences,\n WireColumnDef,\n WireRelation,\n UI_PREFERENCE_FIELD_KEYS,\n UI_PREFERENCE_TABLE_KEYS\n} from \"@rebasepro/types\";\nimport { isRedactedSecurityRule, isUiTablePreferences, rulePatches } from \"@rebasepro/types\";\nimport { enumValueLabel } from \"@rebasepro/utils\";\nimport type { AdminCollection, FIELD_CUSTOMIZATION_KEYS, TABLE_CUSTOMIZATION_KEYS, EnumValueConfig, EnumValues, Properties, Property, Relation } from \"@rebasepro/cms-types\";\nimport { SplitEditError } from \"./split_edit_error\";\nimport {\n PropertyNotAColumnError,\n wireColumnFromProperty,\n wireColumnOfDescriptor,\n wireRelationFromRelation,\n wireRelationOfDescriptor\n} from \"./property_column\";\n\n// ── The key partition is the customization's ────────────────────────────────\n\n/** Compiles only when `T` is `never`. */\ntype AssertNever<T extends never = never> = T;\n/** Every table preference is a `customizeTable` key. */\ntype _TablePreferencesAreCustomizations = AssertNever<Exclude<typeof UI_PREFERENCE_TABLE_KEYS[number], typeof TABLE_CUSTOMIZATION_KEYS[number]>>;\n/** Every field preference is a field customization key. */\ntype _FieldPreferencesAreCustomizations = AssertNever<Exclude<typeof UI_PREFERENCE_FIELD_KEYS[number], typeof FIELD_CUSTOMIZATION_KEYS[number]>>;\n\nexport { SplitEditError };\n\n// ── The result ──────────────────────────────────────────────────────────────\n\n/**\n * What one save of the collection editor writes.\n */\nexport interface SplitEdit {\n /** The table slug the edit is about. */\n table: string;\n /** The schema editor's operations, in the order they apply. Empty when the schema is unchanged. */\n schema: TablePatch[];\n /** The presentation delta: only the keys the edit changed. Empty when nothing presentational changed. */\n presentation: UiTablePreferences;\n /**\n * The table's rules come from `defaultRls` and the edit gives it rules of\n * its own: saving detaches it from the inherited rules. The caller asks\n * before sending a schema edit with this set.\n */\n detachesInheritedRules?: true;\n}\n\n/** What {@link splitEdit} reads. */\nexport interface SplitEditInput {\n /** The collection as the editor loaded it; absent for a new table. */\n before?: AdminCollection;\n /** The collection as the editor is saving it. */\n after: AdminCollection;\n /** The table as the server serves it: the facts the view model cannot carry are kept from it. */\n table?: TableDescriptor;\n /**\n * `table` is not in `backend/schema` yet: it is the database's table as\n * introspection described it (\"Import an existing table\"), and `before`\n * its projection. The edit adopts it first (`adoptTable`), then makes the\n * person's changes to it.\n */\n adopt?: true;\n}\n\n// ── Small helpers ───────────────────────────────────────────────────────────\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** Deep equality of the JSON-like values a collection holds. Functions compare by identity. */\nexport function sameValue(a: unknown, b: unknown): boolean {\n if (a === b) return true;\n if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();\n if (a instanceof RegExp && b instanceof RegExp) return a.source === b.source && a.flags === b.flags;\n if (Array.isArray(a) || Array.isArray(b)) {\n return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((item, i) => sameValue(item, b[i]));\n }\n if (!isRecord(a) || !isRecord(b)) return false;\n const keys = Object.keys(a).filter(key => a[key] !== undefined);\n const other = Object.keys(b).filter(key => b[key] !== undefined);\n return keys.length === other.length && keys.every(key => sameValue(a[key], b[key]));\n}\n\nconst stringsOnly = (value: unknown): string[] | undefined =>\n Array.isArray(value) ? value.filter((item): item is string => typeof item === \"string\") : undefined;\n\nfunction setIf<T, K extends keyof T>(target: T, key: K, value: T[K] | undefined): void {\n if (value !== undefined) target[key] = value;\n}\n\n// ── Presentation: table level ───────────────────────────────────────────────\n\nfunction displayOf(collection: AdminCollection): UiDisplayPreferences | undefined {\n const display = collection.display;\n if (!isRecord(display)) return undefined;\n const out: UiDisplayPreferences = {};\n for (const slot of [\"title\", \"subtitle\", \"image\", \"status\", \"date\", \"tags\"] as const) {\n const value = display[slot];\n if (typeof value === \"string\") out[slot] = value;\n }\n return Object.keys(out).length > 0 ? out : undefined;\n}\n\nconst VIEW_SIZES = [\"xs\", \"s\", \"m\", \"l\", \"xl\"] as const;\nconst ENTITY_MODES = [\"side_panel\", \"full_screen\", \"split\", \"dialog\"] as const;\nconst isOneOf = <T extends string>(allowed: readonly T[], value: unknown): value is T =>\n typeof value === \"string\" && (allowed as readonly string[]).includes(value);\n\n/**\n * The table-level presentation a collection states, in the preference\n * vocabulary (`propertiesOrder` → `fieldOrder`, `kanban.columnProperty` →\n * `kanban.columnField`, …). Code-valued options (an action object, a\n * resolver) are not data and are left out.\n */\nexport function tablePresentationOf(collection: AdminCollection): UiTablePreferences {\n const c = collection;\n const out: UiTablePreferences = {};\n setIf(out, \"name\", c.name);\n setIf(out, \"singularName\", c.singularName);\n if (typeof c.icon === \"string\") out.icon = c.icon;\n setIf(out, \"group\", c.group);\n setIf(out, \"hideFromNavigation\", c.hideFromNavigation);\n setIf(out, \"hideFromEntityViews\", c.hideFromEntityViews);\n setIf(out, \"defaultViewMode\", c.defaultViewMode);\n setIf(out, \"enabledViews\", c.enabledViews ? [...c.enabledViews] : undefined);\n if (isOneOf(VIEW_SIZES, c.defaultSize)) out.defaultSize = c.defaultSize;\n const columnField = c.kanban?.columnProperty;\n if (typeof columnField === \"string\") {\n out.kanban = { columnField, ...(typeof c.orderProperty === \"string\" ? { orderField: c.orderProperty } : {}) };\n }\n setIf(out, \"fieldOrder\", c.propertiesOrder ? [...c.propertiesOrder] : undefined);\n setIf(out, \"listFields\", c.listProperties ? [...c.listProperties] : undefined);\n setIf(out, \"previewFields\", c.previewProperties ? [...c.previewProperties] : undefined);\n setIf(out, \"display\", displayOf(c));\n setIf(out, \"hideIdFromCollection\", c.hideIdFromCollection);\n // Query defaults are data only when they hold JSON values.\n const query = { sort: c.sort, defaultFilter: c.defaultFilter };\n if (isUiTablePreferences(query)) {\n setIf(out, \"sort\", query.sort);\n setIf(out, \"defaultFilter\", query.defaultFilter);\n }\n setIf(out, \"pagination\", c.pagination);\n setIf(out, \"inlineEditing\", c.inlineEditing);\n setIf(out, \"selectionEnabled\", c.selectionEnabled);\n if (typeof c.exportable === \"boolean\") out.exportable = c.exportable;\n if (isOneOf(ENTITY_MODES, c.openEntityMode)) out.openEntityMode = c.openEntityMode;\n setIf(out, \"defaultEntityAction\", c.defaultEntityAction);\n setIf(out, \"sideDialogWidth\", c.sideDialogWidth);\n if (typeof c.defaultSelectedView === \"string\") out.defaultSelectedView = c.defaultSelectedView;\n setIf(out, \"formAutoSave\", c.formAutoSave);\n setIf(out, \"alwaysApplyDefaultValues\", c.alwaysApplyDefaultValues);\n setIf(out, \"includeJsonView\", c.includeJsonView);\n setIf(out, \"localChangesBackup\", c.localChangesBackup);\n setIf(out, \"hideIdFromForm\", c.hideIdFromForm);\n setIf(out, \"entityActions\", stringsOnly(c.entityActions));\n setIf(out, \"disableDefaultActions\", c.disableDefaultActions ? [...c.disableDefaultActions] : undefined);\n setIf(out, \"entityViews\", stringsOnly(c.entityViews));\n setIf(out, \"customViews\", stringsOnly(c.customViews));\n return out;\n}\n\n// ── Presentation: field level ───────────────────────────────────────────────\n\n/** A property's enum values as a list, whichever form they were written in. */\nfunction enumList(values: EnumValues | undefined): EnumValueConfig[] {\n if (values === undefined) return [];\n if (Array.isArray(values)) return values;\n return Object.entries(values).map(([id, value]) => typeof value === \"string\" ? { id, label: value } : { ...value, id });\n}\n\n/**\n * The presentation of one property, in the preference vocabulary. `admin.*`\n * keys keep their names except `hideFromCollection` (`hidden`),\n * `disabled.hidden` (`hiddenInForm`) and `previewProperties`\n * (`previewFields`).\n */\nexport function fieldPresentationOf(property: Property): UiFieldPreferences {\n const out: UiFieldPreferences = {};\n setIf(out, \"name\", property.name);\n const admin = property.admin;\n if (admin) {\n setIf(out, \"hidden\", admin.hideFromCollection);\n if (typeof admin.disabled === \"boolean\") out.disabled = admin.disabled;\n else if (isRecord(admin.disabled) && typeof admin.disabled.hidden === \"boolean\") out.hiddenInForm = admin.disabled.hidden;\n setIf(out, \"readOnly\", admin.readOnly);\n setIf(out, \"columnWidth\", admin.columnWidth);\n setIf(out, \"span\", admin.span);\n if (\"multiline\" in admin) setIf(out, \"multiline\", admin.multiline);\n if (\"markdown\" in admin) setIf(out, \"markdown\", admin.markdown);\n if (\"previewAsTag\" in admin) setIf(out, \"previewAsTag\", admin.previewAsTag);\n if (\"clearable\" in admin) setIf(out, \"clearable\", admin.clearable);\n if (\"urlPreview\" in admin) setIf(out, \"urlPreview\", admin.urlPreview);\n if (\"expanded\" in admin) setIf(out, \"expanded\", admin.expanded);\n if (\"minimalistView\" in admin) setIf(out, \"minimalistView\", admin.minimalistView);\n if (\"sortable\" in admin) setIf(out, \"sortable\", admin.sortable);\n if (\"canAddElements\" in admin) setIf(out, \"canAddElements\", admin.canAddElements);\n if (\"spreadChildren\" in admin) setIf(out, \"spreadChildren\", admin.spreadChildren);\n if (\"previewProperties\" in admin) setIf(out, \"previewFields\", admin.previewProperties ? [...admin.previewProperties] : undefined);\n if (\"widget\" in admin) setIf(out, \"widget\", admin.widget);\n if (\"includeId\" in admin) setIf(out, \"includeId\", admin.includeId);\n if (\"includeEntityLink\" in admin) setIf(out, \"includeEntityLink\", admin.includeEntityLink);\n }\n if (property.conditions && isRecord(property.conditions)) {\n const conditions: NonNullable<UiFieldPreferences[\"conditions\"]> = {};\n for (const [key, value] of Object.entries(property.conditions)) {\n if (isJsonValue(value)) conditions[key] = value;\n }\n if (Object.keys(conditions).length > 0) out.conditions = conditions;\n }\n if (property.type === \"reference\" && property.path) out.referenceTo = property.path;\n if (property.type === \"date\") {\n setIf(out, \"mode\", property.mode);\n setIf(out, \"timezone\", property.timezone);\n }\n if (property.type === \"map\") {\n setIf(out, \"keyValue\", property.keyValue);\n setIf(out, \"fieldOrder\", property.propertiesOrder ? [...property.propertiesOrder] : undefined);\n if (property.properties) {\n const fields: NonNullable<UiFieldPreferences[\"fields\"]> = {};\n for (const [key, nested] of Object.entries(property.properties)) {\n const presentation = fieldPresentationOf(nested);\n if (Object.keys(presentation).length > 0) fields[key] = presentation;\n }\n if (Object.keys(fields).length > 0) out.fields = fields;\n }\n }\n if (property.type === \"array\" && property.of && !Array.isArray(property.of)) {\n const of = fieldPresentationOf(property.of);\n if (Object.keys(of).length > 0) out.of = of;\n }\n if ((property.type === \"string\" || property.type === \"number\") && property.enum !== undefined) {\n const labels: NonNullable<UiFieldPreferences[\"enumLabels\"]> = {};\n for (const value of enumList(property.enum)) {\n const color = typeof value.color === \"string\" ? value.color : undefined;\n labels[String(value.id)] = color !== undefined || value.disabled !== undefined\n ? { label: value.label, ...(color !== undefined ? { color } : {}), ...(value.disabled !== undefined ? { disabled: value.disabled } : {}) }\n : value.label;\n }\n out.enumLabels = labels;\n out.enumOrder = enumList(property.enum).map(value => value.id);\n }\n return out;\n}\n\nfunction isJsonValue(value: unknown, depth = 0): value is NonNullable<UiFieldPreferences[\"conditions\"]>[string] {\n if (depth > 32) return false;\n if (value === null || typeof value === \"string\" || typeof value === \"boolean\") return true;\n if (typeof value === \"number\") return Number.isFinite(value);\n if (Array.isArray(value)) return value.every(item => isJsonValue(item, depth + 1));\n if (isRecord(value)) return Object.values(value).every(item => isJsonValue(item, depth + 1));\n return false;\n}\n\n/** What changed between two field presentations: the keys of `after` that differ, nested maps field by field. */\nfunction fieldDelta(before: UiFieldPreferences, after: UiFieldPreferences): UiFieldPreferences {\n const out: UiFieldPreferences = {};\n for (const key of Object.keys(after)) {\n if (key === \"fields\" || key === \"of\" || key === \"enumLabels\" || key === \"enumOrder\") continue;\n copyIfChanged(out, before, after, key);\n }\n if (after.fields) {\n const fields: NonNullable<UiFieldPreferences[\"fields\"]> = {};\n for (const [key, nested] of Object.entries(after.fields)) {\n const delta = fieldDelta(before.fields?.[key] ?? {}, nested);\n if (Object.keys(delta).length > 0) fields[key] = delta;\n }\n if (Object.keys(fields).length > 0) out.fields = fields;\n }\n if (after.of) {\n const of = fieldDelta(before.of ?? {}, after.of);\n if (Object.keys(of).length > 0) out.of = of;\n }\n if (after.enumLabels) {\n const labels: NonNullable<UiFieldPreferences[\"enumLabels\"]> = {};\n for (const [value, label] of Object.entries(after.enumLabels)) {\n if (sameValue(before.enumLabels?.[value], label)) continue;\n // A new value labelled as the panel would label it anyway is not a preference.\n if (before.enumLabels?.[value] === undefined && isDefaultLabel(value, label)) continue;\n labels[value] = label;\n }\n if (Object.keys(labels).length > 0) out.enumLabels = labels;\n }\n // The order is presentation only while the values are the same set; a new\n // or removed value is a schema change and carries its own order.\n if (after.enumOrder && before.enumOrder && !sameValue(before.enumOrder, after.enumOrder)\n && sameValue([...before.enumOrder].map(String).sort(), [...after.enumOrder].map(String).sort())) {\n out.enumOrder = after.enumOrder;\n }\n return out;\n}\n\n/** Whether an enum label says only what the projector would say for the value: its prettified id, no colour. */\nfunction isDefaultLabel(value: string, label: string | { label: string; color?: string; disabled?: boolean }): boolean {\n return typeof label === \"string\" ? label === enumValueLabel(value) : false;\n}\n\n/**\n * The presentation of a field the edit adds: what it states, less what the\n * panel derives anyway — a new enum's values carry their own order, and a\n * label that is the prettified value is the projector's.\n */\nfunction newFieldPresentation(property: Property): UiFieldPreferences {\n const field = fieldPresentationOf(property);\n delete field.enumOrder;\n if (field.enumLabels) {\n for (const [value, label] of Object.entries(field.enumLabels)) {\n if (isDefaultLabel(value, label)) delete field.enumLabels[value];\n }\n if (Object.keys(field.enumLabels).length === 0) delete field.enumLabels;\n }\n return field;\n}\n\n/** `out[key] = after[key]` when it differs from `before[key]`, for a key both objects share by type. */\nfunction copyIfChanged<T extends object>(out: T, before: T, after: T, key: string): void {\n const next: unknown = Reflect.get(after, key);\n if (next !== undefined && !sameValue(Reflect.get(before, key), next)) Reflect.set(out, key, next);\n}\n\n/** What changed between two table presentations. */\nfunction tableDelta(before: UiTablePreferences, after: UiTablePreferences): UiTablePreferences {\n const out: UiTablePreferences = {};\n for (const key of Object.keys(after)) {\n if (key === \"fields\") continue;\n copyIfChanged(out, before, after, key);\n }\n return out;\n}\n\n// ── Schema: columns and relations ───────────────────────────────────────────\n\n/** The relations a collection states, by name: its relation properties and its `relations` list. */\nfunction relationsOf(collection: AdminCollection): Map<string, { relation: Relation; property?: Property }> {\n const out = new Map<string, { relation: Relation; property?: Property }>();\n const listed: unknown = \"relations\" in collection ? collection.relations : undefined;\n for (const relation of Array.isArray(listed) ? listed : []) {\n if (isRelation(relation) && relation.relationName) out.set(relation.relationName, { relation });\n }\n for (const [key, property] of Object.entries(collection.properties ?? {})) {\n if (property.type === \"relation\" && property.relation) {\n out.set(property.relation.relationName ?? key, { relation: property.relation, property });\n }\n }\n return out;\n}\n\nconst isRelation = (value: unknown): value is Relation =>\n isRecord(value) && typeof value.kind === \"string\" && typeof value.target === \"function\";\n\n/** The column properties of a collection, in order. */\nfunction columnsOf(collection: AdminCollection): [string, Property][] {\n const properties: Properties = collection.properties ?? {};\n return Object.entries(properties).filter(([, property]) => property.type !== \"relation\");\n}\n\n/** The wire form of a column property, read over the column as served. */\nfunction wireOf(key: string, property: Property, served: Map<string, WireColumnDef>): WireColumnDef {\n try {\n return wireColumnFromProperty(key, property, served.get(key));\n } catch (error) {\n if (error instanceof PropertyNotAColumnError) throw new SplitEditError(\"NOT_A_COLUMN\", error.message, error.key);\n throw error;\n }\n}\n\nfunction wireRelationOf(\n name: string,\n entry: { relation: Relation; property?: Property },\n served: Map<string, WireRelation>,\n declaredForeignKeys: ReadonlySet<string> = new Set()\n): WireRelation {\n try {\n return wireRelationFromRelation(name, entry.relation, {\n base: served.get(name),\n ownsForeignKey: !declaredForeignKeys.has(name),\n required: entry.relation.kind === \"belongsTo\" && entry.property ? entry.property.validation?.required === true : undefined,\n access: entry.property?.access\n });\n } catch (error) {\n if (error instanceof PropertyNotAColumnError) throw new SplitEditError(\"NOT_A_COLUMN\", error.message, error.key);\n throw error;\n }\n}\n\n// ── Schema: rules ───────────────────────────────────────────────────────────\n\nconst hasRedacted = (rules: readonly SecurityRule[] | undefined): boolean => (rules ?? []).some(isRedactedSecurityRule);\n\n/**\n * The `rls` operations for an edit of the rules tab.\n *\n * The tab shows the table's effective rules: the declared ones, and the ones\n * the platform adds (the admin baseline, tenant scoping). Only the declared\n * ones are written, and a declared rule the edit left as it was is sent back\n * exactly as served, so {@link rulePatches} leaves its text — and its\n * policy's name, a hash of the rule as written — alone.\n */\nfunction rlsPatches(\n slug: string,\n before: readonly SecurityRule[],\n after: readonly SecurityRule[],\n table: TableDescriptor | undefined\n): { patches: TablePatch[]; detaches: boolean } {\n if (sameValue(before, after)) return { patches: [], detaches: false };\n if (hasRedacted(before) || hasRedacted(after)) {\n throw new SplitEditError(\"REDACTED_RULES\",\n `The rules of \"${slug}\" were served to you redacted, so they cannot be written back from here. Ask an admin, or edit them in backend/schema.`, \"rls\");\n }\n const declared = table && table.rls.posture === \"rules\" ? table.rls.rules : table ? [] : [...before];\n // Which of the effective rules shown are declared ones, by position.\n const declaredAt = new Map<number, SecurityRule>();\n const usedDeclared = new Set<number>();\n before.forEach((rule, index) => {\n const match = declared.findIndex((candidate, i) => !usedDeclared.has(i) && sameValue(candidate, rule));\n if (match >= 0) {\n usedDeclared.add(match);\n declaredAt.set(index, declared[match]);\n }\n });\n const injected = before.filter((_, index) => !declaredAt.has(index));\n const written = after\n .filter(rule => !injected.some(added => sameValue(added, rule)))\n .map(rule => declared.find(candidate => sameValue(candidate, rule)) ?? rule);\n\n const inherited = table?.rls.inherited === true;\n if (inherited) {\n return written.length === 0 || sameValue(written, declared)\n ? { patches: [], detaches: false }\n : { patches: [{ op: \"setRls\", table: slug, rls: [written[0], ...written.slice(1)] }], detaches: true };\n }\n if (written.length === 0) {\n return declared.length === 0 ? { patches: [], detaches: false } : { patches: [{ op: \"setRls\", table: slug, rls: \"admin-only\" }], detaches: false };\n }\n if (declared.length === 0) {\n return { patches: [{ op: \"setRls\", table: slug, rls: [written[0], ...written.slice(1)] }], detaches: false };\n }\n return { patches: rulePatches(slug, declared, written), detaches: false };\n}\n\n// ── The split ───────────────────────────────────────────────────────────────\n\n/** Refuse what an edit cannot change. */\nfunction refuseMigrations(before: AdminCollection, after: AdminCollection): void {\n const moved = (key: \"slug\" | \"table\" | \"dataSource\" | \"databaseId\", what: string): void => {\n const a: unknown = Reflect.get(before, key);\n const b: unknown = Reflect.get(after, key);\n if (a !== undefined && b !== undefined && a !== b) {\n throw new SplitEditError(\"MIGRATION_REQUIRED\",\n `Changing ${what} of \"${before.slug}\" from \"${String(a)}\" to \"${String(b)}\" moves its rows, which is a migration, not an edit. ` +\n \"Create a new table and migrate the rows, or write the rename in backend/schema together with a migration.\", key);\n }\n };\n moved(\"slug\", \"the slug\");\n moved(\"table\", \"the SQL table\");\n moved(\"dataSource\", \"the database\");\n moved(\"databaseId\", \"the database\");\n}\n\n/** A new table, as the `createTable` it is. */\nfunction createTable(after: AdminCollection): TablePatch {\n const served = new Map<string, WireColumnDef>();\n const columns: Record<string, WireColumnDef> = {};\n for (const [key, property] of columnsOf(after)) columns[key] = wireOf(key, property, served);\n if (!Object.values(columns).some(column => column.primaryKey)) {\n // A table needs a primary key, and a new one from a template or a\n // blank form usually names none: it gets the scaffold's own, a uuid\n // `id` the database fills.\n if (columns.id !== undefined) {\n throw new SplitEditError(\"NO_PRIMARY_KEY\", `The new table \"${after.slug}\" has a field \"id\" that is not its primary key. Mark it, or another field, as the id.`, \"id\");\n }\n return createTableWith(after, { id: { type: { kind: \"uuid\" }, primaryKey: true, notNull: true, default: { kind: \"random-uuid\" } }, ...columns });\n }\n return createTableWith(after, columns);\n}\n\nfunction createTableWith(after: AdminCollection, columns: Record<string, WireColumnDef>): TablePatch {\n const relations: Record<string, WireRelation> = {};\n for (const [name, entry] of relationsOf(after)) relations[name] = wireRelationOf(name, entry, new Map());\n const rules = (after.securityRules ?? []).filter(rule => !isRedactedSecurityRule(rule));\n const sqlName = \"table\" in after && typeof after.table === \"string\" ? after.table : undefined;\n const table = sqlName && sqlName !== after.slug ? { table: sqlName } : {};\n return {\n op: \"createTable\",\n table: {\n name: after.slug,\n ...table,\n columns,\n ...(Object.keys(relations).length > 0 ? { relations } : {}),\n rls: rules.length > 0 ? [rules[0], ...rules.slice(1)] : \"admin-only\",\n ...(after.description ? { description: after.description } : {}),\n ...(after.history ? { history: true } : {})\n }\n };\n}\n\n/**\n * Split one save of the collection editor into the schema edit and the\n * presentation delta it makes.\n *\n * - A column added, changed or removed is `addColumn` / `changeColumn` /\n * `removeColumn`; a column whose schema facts did not change produces\n * nothing, whatever happened to its label or width.\n * - A relation added, changed or removed is `addRelation` /\n * `changeRelation` / `removeRelation`.\n * - The rules are {@link rulePatches} over the declared rules (an untouched\n * rule is never rewritten), `setRls` for a posture.\n * - `description` and `history` are `setOption`.\n * - Everything else the edit changed that is a preference key is the\n * presentation delta. A new table's presentation is everything it states.\n *\n * - Adopting a table the database has (`adopt`) is `adoptTable` with its\n * description, then the edit made to its projection.\n *\n * @throws {@link SplitEditError} for a slug, table or database change, a\n * property with no column equivalent, redacted rules, or a new table without\n * a primary key.\n */\nexport function splitEdit({ before, after, table, adopt }: SplitEditInput): SplitEdit {\n const slug = before?.slug ?? after.slug;\n\n if (adopt) {\n if (!before || !table) throw new Error(\"Adopting a table needs its description and its projection.\");\n const edit = splitEdit({ before, after, table });\n return { ...edit, schema: [{ op: \"adoptTable\", table }, ...edit.schema] };\n }\n\n if (!before) {\n const presentation = tablePresentationOf(after);\n const fields: NonNullable<UiTablePreferences[\"fields\"]> = {};\n for (const [key, property] of Object.entries(after.properties ?? {})) {\n const field = newFieldPresentation(property);\n if (Object.keys(field).length > 0) fields[key] = field;\n }\n if (Object.keys(fields).length > 0) presentation.fields = fields;\n return { table: slug, schema: [createTable(after)], presentation };\n }\n\n refuseMigrations(before, after);\n\n const servedColumns = new Map<string, WireColumnDef>();\n const servedRelations = new Map<string, WireRelation>();\n for (const column of table?.columns ?? []) {\n if (!column.derived && !column.private) servedColumns.set(column.key, wireColumnOfDescriptor(column));\n }\n // The belongsTo relations whose foreign key a column declares.\n const declaredForeignKeys = new Set<string>();\n for (const relation of table?.relations ?? []) {\n if (!table) continue;\n servedRelations.set(relation.name, wireRelationOfDescriptor(relation, table));\n if (relation.kind === \"belongsTo\" && table.columns.some(c => c.key === relation.localField && !c.derived)) {\n declaredForeignKeys.add(relation.name);\n }\n }\n\n const schema: TablePatch[] = [];\n\n // Columns.\n const beforeColumns = new Map(columnsOf(before));\n const afterColumns = new Map(columnsOf(after));\n for (const [key, property] of afterColumns) {\n const previous = beforeColumns.get(key);\n const next = wireOf(key, property, servedColumns);\n if (!previous) {\n schema.push({ op: \"addColumn\", table: slug, key, column: next });\n continue;\n }\n const was = wireOf(key, previous, servedColumns);\n if (!sameValue(was, next)) schema.push({ op: \"changeColumn\", table: slug, key, column: next });\n }\n for (const key of beforeColumns.keys()) {\n if (!afterColumns.has(key)) schema.push({ op: \"removeColumn\", table: slug, key });\n }\n\n // Relations.\n const beforeRelations = relationsOf(before);\n const afterRelations = relationsOf(after);\n for (const [name, entry] of afterRelations) {\n const previous = beforeRelations.get(name);\n const next = wireRelationOf(name, entry, servedRelations, declaredForeignKeys);\n if (!previous) {\n schema.push({ op: \"addRelation\", table: slug, name, relation: next });\n continue;\n }\n if (!sameValue(wireRelationOf(name, previous, servedRelations, declaredForeignKeys), next)) {\n schema.push({ op: \"changeRelation\", table: slug, name, relation: next });\n }\n }\n for (const name of beforeRelations.keys()) {\n if (!afterRelations.has(name)) schema.push({ op: \"removeRelation\", table: slug, name });\n }\n\n // Rules.\n const rls = rlsPatches(slug, before.securityRules ?? [], after.securityRules ?? [], table);\n schema.push(...rls.patches);\n\n // Table options.\n if ((before.description ?? \"\") !== (after.description ?? \"\")) {\n schema.push({ op: \"setOption\", table: slug, option: \"description\", value: after.description ? after.description : null });\n }\n if (Boolean(before.history) !== Boolean(after.history)) {\n schema.push({ op: \"setOption\", table: slug, option: \"history\", value: after.history ? true : null });\n }\n\n // Presentation.\n const presentation = tableDelta(tablePresentationOf(before), tablePresentationOf(after));\n const fields: NonNullable<UiTablePreferences[\"fields\"]> = {};\n for (const [key, property] of Object.entries(after.properties ?? {})) {\n const previous = before.properties?.[key];\n const delta = previous ? fieldDelta(fieldPresentationOf(previous), fieldPresentationOf(property)) : newFieldPresentation(property);\n if (Object.keys(delta).length > 0) fields[key] = delta;\n }\n if (Object.keys(fields).length > 0) presentation.fields = fields;\n\n return { table: slug, schema, presentation, ...(rls.detaches ? { detachesInheritedRules: true } : {}) };\n}\n\n/** Whether a split edit writes nothing. */\nexport function isEmptyEdit(edit: SplitEdit): boolean {\n return edit.schema.length === 0 && Object.keys(edit.presentation).length === 0;\n}\n"],"mappings":";;;;;AAsGA,IAAM,YAAY,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;;AAGvE,SAAgB,UAAU,GAAY,GAAqB;CACvD,IAAI,MAAM,GAAG,OAAO;CACpB,IAAI,aAAa,QAAQ,aAAa,MAAM,OAAO,EAAE,QAAQ,MAAM,EAAE,QAAQ;CAC7E,IAAI,aAAa,UAAU,aAAa,QAAQ,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE;CAC9F,IAAI,MAAM,QAAQ,CAAC,KAAK,MAAM,QAAQ,CAAC,GACnC,OAAO,MAAM,QAAQ,CAAC,KAAK,MAAM,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,MAAM,MAAM,UAAU,MAAM,EAAE,EAAE,CAAC;CAEtH,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC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IAAI;EAAkB,OAAO;EAAM;CAAK,CAAC;CAI1F,MAAM,MAAM,WAAW,MAAM,OAAO,iBAAiB,CAAC,GAAG,MAAM,iBAAiB,CAAC,GAAG,KAAK;CACzF,OAAO,KAAK,GAAG,IAAI,OAAO;CAG1B,KAAK,OAAO,eAAe,SAAS,MAAM,eAAe,KACrD,OAAO,KAAK;EAAE,IAAI;EAAa,OAAO;EAAM,QAAQ;EAAe,OAAO,MAAM,cAAc,MAAM,cAAc;CAAK,CAAC;CAE5H,IAAI,QAAQ,OAAO,OAAO,MAAM,QAAQ,MAAM,OAAO,GACjD,OAAO,KAAK;EAAE,IAAI;EAAa,OAAO;EAAM,QAAQ;EAAW,OAAO,MAAM,UAAU,OAAO;CAAK,CAAC;CAIvG,MAAM,eAAe,WAAW,oBAAoB,MAAM,GAAG,oBAAoB,KAAK,CAAC;CACvF,MAAM,SAAoD,CAAC;CAC3D,KAAK,MAAM,CAAC,KAAK,aAAa,OAAO,QAAQ,MAAM,cAAc,CAAC,CAAC,GAAG;EAClE,MAAM,WAAW,OAAO,aAAa;EACrC,MAAM,QAAQ,WAAW,WAAW,oBAAoB,QAAQ,GAAG,oBAAoB,QAAQ,CAAC,IAAI,qBAAqB,QAAQ;EACjI,IAAI,OAAO,KAAK,KAAK,CAAC,CAAC,SAAS,GAAG,OAAO,OAAO;CACrD;CACA,IAAI,OAAO,KAAK,MAAM,CAAC,CAAC,SAAS,GAAG,aAAa,SAAS;CAE1D,OAAO;EAAE,OAAO;EAAM;EAAQ;EAAc,GAAI,IAAI,WAAW,EAAE,wBAAwB,KAAK,IAAI,CAAC;CAAG;AAC1G"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The refusals of `splitEdit`, in a module of their own: the controller and
|
|
3
|
+
* the refusal view test for them on the eager path, while the split itself
|
|
4
|
+
* is loaded with the first save.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Why an edit cannot be split into a schema edit and a presentation delta.
|
|
8
|
+
*
|
|
9
|
+
* - `MIGRATION_REQUIRED` — the slug, the SQL table or the database changed:
|
|
10
|
+
* that moves data, which is a migration.
|
|
11
|
+
* - `NOT_A_COLUMN` — a property has no column equivalent on a table.
|
|
12
|
+
* - `REDACTED_RULES` — the caller was served rules it may not read, so it may
|
|
13
|
+
* not write them back.
|
|
14
|
+
* - `NO_PRIMARY_KEY` — a new table has an `id` field that is not its primary key.
|
|
15
|
+
* - `EXTERNAL_COLLECTION` — the collection is not a table of this backend:
|
|
16
|
+
* it is defined in the frontend, and this backend cannot write the frontend
|
|
17
|
+
* (no dev server's source editor: production, or an older backend).
|
|
18
|
+
* - `EDITED_IN_CODE` — a Firestore collection's edit changes a value that is
|
|
19
|
+
* code (a function, a component): it is changed in the collection's file.
|
|
20
|
+
*/
|
|
21
|
+
export declare class SplitEditError extends Error {
|
|
22
|
+
readonly code: "MIGRATION_REQUIRED" | "NOT_A_COLUMN" | "REDACTED_RULES" | "NO_PRIMARY_KEY" | "EXTERNAL_COLLECTION" | "EDITED_IN_CODE";
|
|
23
|
+
readonly key?: string | undefined;
|
|
24
|
+
constructor(code: "MIGRATION_REQUIRED" | "NOT_A_COLUMN" | "REDACTED_RULES" | "NO_PRIMARY_KEY" | "EXTERNAL_COLLECTION" | "EDITED_IN_CODE", message: string, key?: string | undefined);
|
|
25
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/collection_editor/split_edit_error.ts
|
|
2
|
+
/**
|
|
3
|
+
* The refusals of `splitEdit`, in a module of their own: the controller and
|
|
4
|
+
* the refusal view test for them on the eager path, while the split itself
|
|
5
|
+
* is loaded with the first save.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Why an edit cannot be split into a schema edit and a presentation delta.
|
|
9
|
+
*
|
|
10
|
+
* - `MIGRATION_REQUIRED` — the slug, the SQL table or the database changed:
|
|
11
|
+
* that moves data, which is a migration.
|
|
12
|
+
* - `NOT_A_COLUMN` — a property has no column equivalent on a table.
|
|
13
|
+
* - `REDACTED_RULES` — the caller was served rules it may not read, so it may
|
|
14
|
+
* not write them back.
|
|
15
|
+
* - `NO_PRIMARY_KEY` — a new table has an `id` field that is not its primary key.
|
|
16
|
+
* - `EXTERNAL_COLLECTION` — the collection is not a table of this backend:
|
|
17
|
+
* it is defined in the frontend, and this backend cannot write the frontend
|
|
18
|
+
* (no dev server's source editor: production, or an older backend).
|
|
19
|
+
* - `EDITED_IN_CODE` — a Firestore collection's edit changes a value that is
|
|
20
|
+
* code (a function, a component): it is changed in the collection's file.
|
|
21
|
+
*/
|
|
22
|
+
var SplitEditError = class extends Error {
|
|
23
|
+
code;
|
|
24
|
+
key;
|
|
25
|
+
constructor(code, message, key) {
|
|
26
|
+
super(message);
|
|
27
|
+
this.code = code;
|
|
28
|
+
this.key = key;
|
|
29
|
+
this.name = "SplitEditError";
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { SplitEditError };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=split_edit_error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split_edit_error.js","names":[],"sources":["../../src/collection_editor/split_edit_error.ts"],"sourcesContent":["/**\n * The refusals of `splitEdit`, in a module of their own: the controller and\n * the refusal view test for them on the eager path, while the split itself\n * is loaded with the first save.\n */\n/**\n * Why an edit cannot be split into a schema edit and a presentation delta.\n *\n * - `MIGRATION_REQUIRED` — the slug, the SQL table or the database changed:\n * that moves data, which is a migration.\n * - `NOT_A_COLUMN` — a property has no column equivalent on a table.\n * - `REDACTED_RULES` — the caller was served rules it may not read, so it may\n * not write them back.\n * - `NO_PRIMARY_KEY` — a new table has an `id` field that is not its primary key.\n * - `EXTERNAL_COLLECTION` — the collection is not a table of this backend:\n * it is defined in the frontend, and this backend cannot write the frontend\n * (no dev server's source editor: production, or an older backend).\n * - `EDITED_IN_CODE` — a Firestore collection's edit changes a value that is\n * code (a function, a component): it is changed in the collection's file.\n */\nexport class SplitEditError extends Error {\n constructor(\n readonly code: \"MIGRATION_REQUIRED\" | \"NOT_A_COLUMN\" | \"REDACTED_RULES\" | \"NO_PRIMARY_KEY\" | \"EXTERNAL_COLLECTION\" | \"EDITED_IN_CODE\",\n message: string,\n readonly key?: string\n ) {\n super(message);\n this.name = \"SplitEditError\";\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,IAAa,iBAAb,cAAoC,MAAM;CAEzB;CAEA;CAHb,YACI,MACA,SACA,KACF;EACE,MAAM,OAAO;EAJJ,KAAA,OAAA;EAEA,KAAA,MAAA;EAGT,KAAK,OAAO;CAChB;AACJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CollectionsConfigController } from "./config_controller.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Property, Entity } from "@rebasepro/cms-types";
|
|
3
3
|
import type { AdminCollection } from "@rebasepro/cms-types";
|
|
4
4
|
/**
|
|
5
5
|
* Controller to open the collection editor dialog.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import type { TableDescriptor, TablePatch, UnmappedTable } from "@rebasepro/types";
|
|
3
|
+
import type { Property } from "@rebasepro/cms-types";
|
|
3
4
|
import { NavigationGroupMapping, AdminCollection } from "@rebasepro/cms-types";
|
|
4
5
|
export interface CollectionsSetupInfo {
|
|
5
6
|
status: "ongoing" | "complete" | "error";
|
|
@@ -21,12 +22,27 @@ export interface CollectionsConfigController {
|
|
|
21
22
|
* Reason why the configuration is read-only.
|
|
22
23
|
*/
|
|
23
24
|
readOnlyReason?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Whether collections defined in the frontend (Firestore collections,
|
|
27
|
+
* `defineFirestoreCollection` in frontend/src/cms) can be edited: the
|
|
28
|
+
* backend runs a development server's source editor, which writes them.
|
|
29
|
+
* Absent or false, the editor shows them read-only.
|
|
30
|
+
*/
|
|
31
|
+
frontendCollectionsEditable?: boolean;
|
|
24
32
|
/**
|
|
25
33
|
* Status information about the automatic collections setup process.
|
|
26
34
|
* Stored in the project config document at `collectionsSetup`.
|
|
27
35
|
*/
|
|
28
36
|
collectionsSetup?: CollectionsSetupInfo;
|
|
29
37
|
getCollection: (id: string) => AdminCollection;
|
|
38
|
+
/**
|
|
39
|
+
* How the schema editor reads a table's source: its file, and what in it
|
|
40
|
+
* is edited in code (a config spread from a variable, a column built by a
|
|
41
|
+
* helper, rules in a variable) — read-only in the editor, because the
|
|
42
|
+
* server refuses to write there. `undefined` when the backend does not
|
|
43
|
+
* say (live editing off, an older backend).
|
|
44
|
+
*/
|
|
45
|
+
tableSource?: (slug: string) => TableSourceInfo | undefined;
|
|
30
46
|
saveCollection: <M extends {
|
|
31
47
|
[Key: string]: any;
|
|
32
48
|
}>(params: SaveCollectionParams<M>) => Promise<void>;
|
|
@@ -36,6 +52,24 @@ export interface CollectionsConfigController {
|
|
|
36
52
|
saveProperty: (params: SavePropertyParams) => Promise<void>;
|
|
37
53
|
deleteProperty: (params: DeletePropertyParams) => Promise<void>;
|
|
38
54
|
deleteCollection: (props: DeleteCollectionParams) => Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Send table edits as they are — the RLS editor's one `replaceRule` —
|
|
57
|
+
* through the same door as a save: planned and confirmed when live schema
|
|
58
|
+
* editing is on, to the source-only editor when it is not. Absent on a
|
|
59
|
+
* controller that does not write `backend/schema`.
|
|
60
|
+
*/
|
|
61
|
+
applyTablePatches?: (table: string, patches: TablePatch[]) => Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* The database's tables no declared table maps — what "Import an existing
|
|
64
|
+
* table" offers — as the schema editor lists them. Absent on a controller
|
|
65
|
+
* that does not write `backend/schema`.
|
|
66
|
+
*/
|
|
67
|
+
listUnmappedTables?: () => Promise<UnmappedTable[]>;
|
|
68
|
+
/**
|
|
69
|
+
* One of those tables as introspection describes it, and projected as a
|
|
70
|
+
* served table is: what the editor opens to import it.
|
|
71
|
+
*/
|
|
72
|
+
describeUnmappedTable?: (schema: string, table: string) => Promise<ImportedTable>;
|
|
39
73
|
/**
|
|
40
74
|
* Update the properties order of a collection (used for column reordering).
|
|
41
75
|
*/
|
|
@@ -57,6 +91,30 @@ export interface CollectionsConfigController {
|
|
|
57
91
|
*/
|
|
58
92
|
dialog?: React.ReactNode;
|
|
59
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* A table the database has, read for "Import an existing table".
|
|
96
|
+
*/
|
|
97
|
+
export interface ImportedTable {
|
|
98
|
+
/** What introspection found, the description included (`rlsRaised` when its posture was raised to `"admin-only"`). */
|
|
99
|
+
table: UnmappedTable;
|
|
100
|
+
/** The table as introspection described it: what the save adopts (`SaveCollectionParams.adopting`). */
|
|
101
|
+
descriptor: TableDescriptor;
|
|
102
|
+
/** Its projection, as a served table's: what the editor opens, and the baseline the person's edits are made against. */
|
|
103
|
+
collection: AdminCollection;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* What the schema editor says about one table's source.
|
|
107
|
+
*/
|
|
108
|
+
export interface TableSourceInfo {
|
|
109
|
+
/** The file the table is defined in, as the server names it. */
|
|
110
|
+
file: string;
|
|
111
|
+
/** Why the whole table is read-only, when it is. */
|
|
112
|
+
editedInCode?: string;
|
|
113
|
+
/** Why a column or relation is read-only, by key. */
|
|
114
|
+
fields: Record<string, string>;
|
|
115
|
+
/** Why the rules cannot be written, when they cannot. */
|
|
116
|
+
rlsEditedInCode?: string;
|
|
117
|
+
}
|
|
60
118
|
export type UpdateCollectionParams<M extends Record<string, unknown> = Record<string, unknown>> = {
|
|
61
119
|
id: string;
|
|
62
120
|
collectionData: Partial<AdminCollection<M>>;
|
|
@@ -78,6 +136,14 @@ export type SaveCollectionParams<M extends Record<string, unknown> = Record<stri
|
|
|
78
136
|
* Absent, the controller's own copy of the collection stands in for it.
|
|
79
137
|
*/
|
|
80
138
|
baseline?: AdminCollection<M>;
|
|
139
|
+
/**
|
|
140
|
+
* The table this new collection adopts ("Import an existing table"), as
|
|
141
|
+
* introspection described it. The save writes the table's source from it
|
|
142
|
+
* (`adoptTable`) — so planning it changes nothing in the database — and
|
|
143
|
+
* then the changes the person made to its projection (`baseline`, or the
|
|
144
|
+
* projection itself when absent).
|
|
145
|
+
*/
|
|
146
|
+
adopting?: TableDescriptor;
|
|
81
147
|
previousId?: string;
|
|
82
148
|
parentCollectionSlugs?: string[];
|
|
83
149
|
parentEntityIds?: string[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { AdminCollection } from "@rebasepro/cms-types";
|
|
4
|
-
import { CollectionsConfigController } from "../../types/config_controller.js";
|
|
2
|
+
import { User } from "@rebasepro/types";
|
|
3
|
+
import { AdminCollection, Entity } from "@rebasepro/cms-types";
|
|
4
|
+
import { CollectionsConfigController, ImportedTable } from "../../types/config_controller.js";
|
|
5
5
|
import { CollectionInference } from "../../types/collection_inference.js";
|
|
6
6
|
import { CollectionGenerationCallback } from "../../api/generateCollectionApi.js";
|
|
7
7
|
import type { CollectionEditorExtensionProps } from "../../extensibility_types.js";
|
|
@@ -61,9 +61,10 @@ export interface CollectionEditorDialogProps extends CollectionEditorExtensionPr
|
|
|
61
61
|
*/
|
|
62
62
|
unmappedTables?: string[];
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* One unmapped table as introspection describes it, projected: what
|
|
65
|
+
* "Import an existing table" opens, and adopts on save.
|
|
65
66
|
*/
|
|
66
|
-
|
|
67
|
+
onDescribeUnmappedTable?: (tableName: string) => Promise<ImportedTable | undefined>;
|
|
67
68
|
}
|
|
68
69
|
export declare function CollectionEditorDialog(props: CollectionEditorDialogProps): React.JSX.Element;
|
|
69
70
|
export declare function CollectionEditor(props: CollectionEditorDialogProps & {
|
|
@@ -5,8 +5,10 @@ import { useSafeSnackbarController } from "../../useSafeSnackbarController.js";
|
|
|
5
5
|
import { ImportSaveInProgress } from "../../../data_import/components/ImportSaveInProgress.js";
|
|
6
6
|
import { useImportConfig } from "../../../data_import/hooks/useImportConfig.js";
|
|
7
7
|
import { getInferenceType } from "../../../data_import/utils/get_import_inference_type.js";
|
|
8
|
+
import { ConfigControllerContext } from "../../ConfigControllerProvider.js";
|
|
8
9
|
import { isSchemaChangeCancelled } from "../../liveSchemaClient.js";
|
|
9
10
|
import { getFullIdPath } from "./util.js";
|
|
11
|
+
import { SchemaEditRefusalView } from "./SchemaEditRefusalView.js";
|
|
10
12
|
import { CollectionEditorSchema } from "./CollectionYupValidation.js";
|
|
11
13
|
import { GeneralSettingsForm } from "./GeneralSettingsForm.js";
|
|
12
14
|
import { AIModifiedPathsProvider, useAIModifiedPaths } from "./AIModifiedPathsContext.js";
|
|
@@ -21,9 +23,9 @@ import { CollectionRLSTab } from "./CollectionRLSTab.js";
|
|
|
21
23
|
import * as React$1 from "react";
|
|
22
24
|
import { useEffect, useRef, useState } from "react";
|
|
23
25
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
24
|
-
import { ArrowLeftIcon, Button, CheckIcon, CircularProgressCenter, Dialog, DialogTitle, IconButton, LoadingButton, Tab, Tabs, Tooltip, Typography, cls, coolIconKeys, defaultBorderMixin } from "@rebasepro/ui";
|
|
25
|
-
import {
|
|
26
|
-
import { ConfirmationDialog,
|
|
26
|
+
import { Alert, ArrowLeftIcon, Button, CheckIcon, CircularProgressCenter, Dialog, DialogTitle, IconButton, LoadingButton, Tab, Tabs, Tooltip, Typography, cls, coolIconKeys, defaultBorderMixin } from "@rebasepro/ui";
|
|
27
|
+
import { getSubcollections, getTableName, isPropertyBuilder } from "@rebasepro/cms-types";
|
|
28
|
+
import { ConfirmationDialog, UnsavedChangesDialog, removeInitialAndTrailingSlashes, useAuthController, useCustomizationController, useTranslation, useUnsavedChangesDialog } from "@rebasepro/app";
|
|
27
29
|
import { Formex, useCreateFormex } from "@rebasepro/forms";
|
|
28
30
|
import { getDataSourceCapabilities } from "@rebasepro/types";
|
|
29
31
|
import { mergeDeep, randomString, removeUndefined } from "@rebasepro/utils";
|
|
@@ -60,6 +62,7 @@ function CollectionEditorDialog(props) {
|
|
|
60
62
|
}
|
|
61
63
|
function CollectionEditor(props) {
|
|
62
64
|
const { standalone } = props;
|
|
65
|
+
const { t } = useTranslation();
|
|
63
66
|
const customizationController = useCustomizationController();
|
|
64
67
|
const navigationState = useNavigationStateController();
|
|
65
68
|
const collectionRegistry = useCollectionRegistryController();
|
|
@@ -140,8 +143,15 @@ function CollectionEditor(props) {
|
|
|
140
143
|
]);
|
|
141
144
|
if (!initialLoadingCompleted) return /* @__PURE__ */ jsx(CircularProgressCenter, {});
|
|
142
145
|
if (!props.isNewCollection && (!(standalone ? true : collectionRegistry?.initialised ?? true) || !initialLoadingCompleted)) return /* @__PURE__ */ jsx(CircularProgressCenter, {});
|
|
143
|
-
|
|
146
|
+
const external = !props.isNewCollection && initialValues.engine === "firestore" && props.configController.frontendCollectionsEditable !== true;
|
|
147
|
+
const configController = external ? {
|
|
148
|
+
...props.configController,
|
|
149
|
+
readOnly: true,
|
|
150
|
+
readOnlyReason: t("schema_external_collection_read_only", { slug: initialValues.slug })
|
|
151
|
+
} : props.configController;
|
|
152
|
+
const editor = /* @__PURE__ */ jsx(CollectionEditorInternal, {
|
|
144
153
|
...props,
|
|
154
|
+
configController,
|
|
145
155
|
initialValues,
|
|
146
156
|
existingPaths,
|
|
147
157
|
existingIds,
|
|
@@ -150,8 +160,12 @@ function CollectionEditor(props) {
|
|
|
150
160
|
setCollection,
|
|
151
161
|
propertyConfigs
|
|
152
162
|
});
|
|
163
|
+
return external ? /* @__PURE__ */ jsx(ConfigControllerContext.Provider, {
|
|
164
|
+
value: configController,
|
|
165
|
+
children: editor
|
|
166
|
+
}) : editor;
|
|
153
167
|
}
|
|
154
|
-
function CollectionEditorInternal({ isNewCollection, configController, editedCollectionId, parentCollectionSlugs, parentEntityIds, path, collectionInference, handleClose, extraView, handleCancel, setFormDirty, getUser, parentCollection, getData, existingPaths, existingIds, includeTemplates, collection, setCollection, initialValues, propertyConfigs, existingEntities, initialView: initialViewProp, expandKanban, generateCollection, onAnalyticsEvent, fullScreen, unmappedTables,
|
|
168
|
+
function CollectionEditorInternal({ isNewCollection, configController, editedCollectionId, parentCollectionSlugs, parentEntityIds, path, collectionInference, handleClose, extraView, handleCancel, setFormDirty, getUser, parentCollection, getData, existingPaths, existingIds, includeTemplates, collection, setCollection, initialValues, propertyConfigs, existingEntities, initialView: initialViewProp, expandKanban, generateCollection, onAnalyticsEvent, fullScreen, unmappedTables, onDescribeUnmappedTable, propertyTypePresets, hiddenPropertyTypes, renderExtraPropertyFields, renderExtraCollectionFields, visibleTabs, standalone }) {
|
|
155
169
|
const { t } = useTranslation();
|
|
156
170
|
/** Why the submit buttons below are dead, straight from the backend. */
|
|
157
171
|
const readOnlyTitle = configController?.readOnlyReason || "This backend does not accept collection edits.";
|
|
@@ -159,6 +173,7 @@ function CollectionEditorInternal({ isNewCollection, configController, editedCol
|
|
|
159
173
|
const urlControllerRaw = useUrlController();
|
|
160
174
|
const collectionRegistryRaw = useCollectionRegistryController();
|
|
161
175
|
const snackbarControllerRaw = useSafeSnackbarController();
|
|
176
|
+
const navigationStateRaw = useNavigationStateController();
|
|
162
177
|
const importConfig = standalone ? void 0 : importConfigRaw;
|
|
163
178
|
const urlController = standalone ? {
|
|
164
179
|
basePath: "/",
|
|
@@ -182,6 +197,8 @@ function CollectionEditorInternal({ isNewCollection, configController, editedCol
|
|
|
182
197
|
if (visibleTabs && !visibleTabs.includes(currentView)) setCurrentView(visibleTabs[0] || "general");
|
|
183
198
|
}, [visibleTabs, currentView]);
|
|
184
199
|
const [error, setError] = React$1.useState();
|
|
200
|
+
/** The database table this new collection imports, when it is one: saved as an adoption of its description. */
|
|
201
|
+
const [adopting, setAdopting] = React$1.useState();
|
|
185
202
|
/**
|
|
186
203
|
* `baseline` is what the form was loaded with: the controller saves the
|
|
187
204
|
* difference between it and `updatedCollection`, so only what the person
|
|
@@ -193,6 +210,7 @@ function CollectionEditorInternal({ isNewCollection, configController, editedCol
|
|
|
193
210
|
id,
|
|
194
211
|
collectionData: updatedCollection,
|
|
195
212
|
baseline: isNewCollection ? void 0 : baseline,
|
|
213
|
+
...isNewCollection && adopting ? { adopting: adopting.descriptor } : {},
|
|
196
214
|
previousId: editedCollectionId,
|
|
197
215
|
parentCollectionSlugs
|
|
198
216
|
}).then(() => {
|
|
@@ -483,6 +501,14 @@ function CollectionEditorInternal({ isNewCollection, configController, editedCol
|
|
|
483
501
|
className: "flex-grow flex flex-col min-h-0 relative w-full h-full bg-surface-sheet",
|
|
484
502
|
children: [
|
|
485
503
|
currentView === "loading" && /* @__PURE__ */ jsx(CircularProgressCenter, {}),
|
|
504
|
+
adopting?.table.rlsRaised && currentView !== "welcome" && /* @__PURE__ */ jsx("div", {
|
|
505
|
+
className: "px-4 pt-4 sm:px-6",
|
|
506
|
+
children: /* @__PURE__ */ jsx(Alert, {
|
|
507
|
+
color: "warning",
|
|
508
|
+
size: "small",
|
|
509
|
+
children: adopting.table.rlsRaised
|
|
510
|
+
})
|
|
511
|
+
}),
|
|
486
512
|
currentView === "extra_view" && usedPath && extraView?.View && /* @__PURE__ */ jsx(extraView.View, { path: usedPath }),
|
|
487
513
|
currentView === "welcome" && /* @__PURE__ */ jsx(CollectionEditorWelcomeView, {
|
|
488
514
|
path: usedPath,
|
|
@@ -492,14 +518,14 @@ function CollectionEditorInternal({ isNewCollection, configController, editedCol
|
|
|
492
518
|
generateCollection,
|
|
493
519
|
onAnalyticsEvent,
|
|
494
520
|
unmappedTables,
|
|
495
|
-
onImportFromTable:
|
|
521
|
+
onImportFromTable: onDescribeUnmappedTable ? async (tableName) => {
|
|
496
522
|
try {
|
|
497
|
-
const
|
|
498
|
-
if (!
|
|
499
|
-
|
|
523
|
+
const imported = await onDescribeUnmappedTable(tableName);
|
|
524
|
+
if (!imported) return;
|
|
525
|
+
setAdopting(imported);
|
|
500
526
|
formController.setValues({
|
|
501
527
|
...formController.values,
|
|
502
|
-
...
|
|
528
|
+
...imported.collection
|
|
503
529
|
});
|
|
504
530
|
onWelcomeScreenContinue();
|
|
505
531
|
} catch (e) {
|
|
@@ -562,7 +588,7 @@ function CollectionEditorInternal({ isNewCollection, configController, editedCol
|
|
|
562
588
|
doCollectionInference,
|
|
563
589
|
propertyConfigs,
|
|
564
590
|
propertyTypePresets,
|
|
565
|
-
hiddenPropertyTypes,
|
|
591
|
+
hiddenPropertyTypes: values.engine === "firestore" ? hiddenPropertyTypes : [...hiddenPropertyTypes ?? [], "reference"],
|
|
566
592
|
renderExtraPropertyFields,
|
|
567
593
|
extraIcon: extraView?.icon && /* @__PURE__ */ jsx(IconButton, {
|
|
568
594
|
"aria-label": t("open_view"),
|
|
@@ -575,7 +601,13 @@ function CollectionEditorInternal({ isNewCollection, configController, editedCol
|
|
|
575
601
|
}), (!fullScreen || isNewCollection || !!error) && /* @__PURE__ */ jsxs("div", {
|
|
576
602
|
className: "shrink-0 w-full p-4 sm:px-6 sm:py-4 border-t border-hairline flex items-center justify-between gap-4",
|
|
577
603
|
children: [
|
|
578
|
-
error && /* @__PURE__ */ jsx(
|
|
604
|
+
error && /* @__PURE__ */ jsx(SchemaEditRefusalView, {
|
|
605
|
+
error,
|
|
606
|
+
onReload: () => {
|
|
607
|
+
setError(void 0);
|
|
608
|
+
navigationStateRaw?.refreshNavigation();
|
|
609
|
+
}
|
|
610
|
+
}),
|
|
579
611
|
isNewCollection && includeTemplates && currentView === "import_data_mapping" && /* @__PURE__ */ jsx(Button, {
|
|
580
612
|
variant: "text",
|
|
581
613
|
type: "button",
|