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