@rebasepro/cms 0.23.0 → 0.24.1-canary.g19596ef
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 +3 -1
- package/dist/collection_editor/CollectionEditorDialogsContext.js +10 -0
- package/dist/collection_editor/CollectionEditorDialogsContext.js.map +1 -0
- package/dist/collection_editor/ConfigControllerProvider.js +274 -0
- package/dist/collection_editor/ConfigControllerProvider.js.map +1 -0
- package/dist/collection_editor/_cms_internals.d.ts +2 -1
- package/dist/collection_editor/api/generateCollectionApi.js +64 -0
- package/dist/collection_editor/api/generateCollectionApi.js.map +1 -0
- package/dist/collection_editor/collection_wire.d.ts +13 -0
- package/dist/collection_editor/collection_wire.js +49 -0
- package/dist/collection_editor/collection_wire.js.map +1 -0
- package/dist/collection_editor/liveSchemaClient.d.ts +38 -18
- package/dist/collection_editor/liveSchemaClient.js +130 -0
- package/dist/collection_editor/liveSchemaClient.js.map +1 -0
- package/dist/collection_editor/relation_kinds.js +74 -0
- package/dist/collection_editor/relation_kinds.js.map +1 -0
- package/dist/collection_editor/serializable_types.d.ts +6 -1
- package/dist/collection_editor/serializable_utils.js +504 -0
- package/dist/collection_editor/serializable_utils.js.map +1 -0
- package/dist/collection_editor/types/config_controller.d.ts +11 -0
- package/dist/collection_editor/ui/EditorCollectionAction.js +37 -0
- package/dist/collection_editor/ui/EditorCollectionAction.js.map +1 -0
- package/dist/collection_editor/ui/MissingReferenceWidget.js +39 -0
- package/dist/collection_editor/ui/MissingReferenceWidget.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js +160 -0
- package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js +61 -0
- package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js +731 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js +220 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js +160 -0
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js +394 -0
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js +616 -0
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js +68 -0
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js +11 -0
- package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js +148 -0
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js +244 -0
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/EnumForm.js +222 -0
- package/dist/collection_editor/ui/collection_editor/EnumForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js +204 -0
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js +108 -0
- package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js +163 -0
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js +59 -0
- package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js +640 -0
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js +141 -0
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js +210 -0
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js +31 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js +25 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js.map +1 -0
- package/dist/{SchemaChangeDialog-BeP0A4MJ.js → collection_editor/ui/collection_editor/SchemaChangeDialog.js} +73 -69
- package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/SwitchControl.js +24 -0
- package/dist/collection_editor/ui/collection_editor/SwitchControl.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js +66 -0
- package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js +61 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js +188 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +12 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js +74 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js +100 -0
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js +34 -0
- package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js +75 -0
- package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js +338 -0
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js +83 -0
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js +15 -0
- package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js +121 -0
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js +127 -0
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js +151 -0
- package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js +77 -0
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js +254 -0
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js +71 -0
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js +356 -0
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js +173 -0
- package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js +79 -0
- package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js +34 -0
- package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js +47 -0
- package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js +47 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js +62 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js +119 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.d.ts +10 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js +178 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js +23 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.js +116 -0
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.js +182 -0
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/products_template.js +87 -0
- package/dist/collection_editor/ui/collection_editor/templates/products_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/users_template.js +46 -0
- package/dist/collection_editor/ui/collection_editor/templates/users_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/util.js +20 -0
- package/dist/collection_editor/ui/collection_editor/util.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/strings.js +2 -0
- package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js +37 -0
- package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js +192 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js.map +1 -0
- package/dist/collection_editor/useCollectionEditorController.js +12 -0
- package/dist/collection_editor/useCollectionEditorController.js.map +1 -0
- package/dist/collection_editor/useCollectionsConfigController.js +12 -0
- package/dist/collection_editor/useCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useJsonCollectionsConfigController.js +191 -0
- package/dist/collection_editor/useJsonCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useLiveSchemaEditing.d.ts +5 -5
- package/dist/collection_editor/useLiveSchemaEditing.js +214 -0
- package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +7 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.js +228 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useSafeSnackbarController.js +13 -0
- package/dist/collection_editor/useSafeSnackbarController.js.map +1 -0
- package/dist/collection_editor/validateCollectionJson.js +289 -0
- package/dist/collection_editor/validateCollectionJson.js.map +1 -0
- package/dist/collection_editor_ui.js +7 -33
- package/dist/components/AdditionalFieldValue.js +60 -0
- package/dist/components/AdditionalFieldValue.js.map +1 -0
- package/dist/components/AdminModeSyncer.js +41 -0
- package/dist/components/AdminModeSyncer.js.map +1 -0
- package/dist/components/ArrayContainer.d.ts +8 -2
- package/dist/components/ArrayContainer.js +363 -0
- package/dist/components/ArrayContainer.js.map +1 -0
- package/dist/components/ClearFilterSortButton.d.ts +7 -1
- package/dist/components/ClearFilterSortButton.js +33 -0
- package/dist/components/ClearFilterSortButton.js.map +1 -0
- package/dist/components/CollectionEditorDialogs.js +49 -0
- package/dist/components/CollectionEditorDialogs.js.map +1 -0
- package/dist/components/CollectionPanel.d.ts +26 -5
- package/dist/components/CollectionPanel.js +142 -0
- package/dist/components/CollectionPanel.js.map +1 -0
- package/dist/components/CollectionTableBinding/CollectionRowActions.js +165 -0
- package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -0
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js +329 -0
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -0
- package/dist/components/CollectionTableBinding/PropertyTableCell.js +311 -0
- package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -0
- package/dist/components/CollectionTableBinding/column_utils.js +85 -0
- package/dist/components/CollectionTableBinding/column_utils.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js +45 -0
- package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +66 -0
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +86 -0
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js +93 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js +33 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js +171 -0
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js +91 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js +36 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js.map +1 -0
- package/dist/components/CollectionTableBinding/index.js +6 -0
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js +50 -0
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.d.ts +2 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.js +223 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js +58 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/TableCellOpener.js +53 -0
- package/dist/components/CollectionTableBinding/internal/TableCellOpener.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/common.js +40 -0
- package/dist/components/CollectionTableBinding/internal/common.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +270 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js +68 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js +24 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js.map +1 -0
- package/dist/components/CollectionTableBinding/table_bindings.js +306 -0
- package/dist/components/CollectionTableBinding/table_bindings.js.map +1 -0
- package/dist/components/CollectionViewBinding/BoardCardBinding.js +160 -0
- package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +471 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js +108 -0
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +988 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.d.ts +6 -1
- package/dist/components/CollectionViewBinding/CollectionViewActions.js +146 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +5 -2
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js +1209 -0
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js +133 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.js +133 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js +203 -0
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.d.ts +5 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.js +148 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.js.map +1 -0
- package/dist/components/CollectionViewBinding/SearchExplanation.js +86 -0
- package/dist/components/CollectionViewBinding/SearchExplanation.js.map +1 -0
- package/dist/components/CollectionViewBinding/SearchHighlight.js +262 -0
- package/dist/components/CollectionViewBinding/SearchHighlight.js.map +1 -0
- package/dist/components/CollectionViewBinding/SlotValue.js +117 -0
- package/dist/components/CollectionViewBinding/SlotValue.js.map +1 -0
- package/dist/components/CollectionViewBinding/SortButton.js +214 -0
- package/dist/components/CollectionViewBinding/SortButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListCloseButton.js +41 -0
- package/dist/components/CollectionViewBinding/SplitListCloseButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListShowButton.js +29 -0
- package/dist/components/CollectionViewBinding/SplitListShowButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListView.js +311 -0
- package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitViewContext.js +21 -0
- package/dist/components/CollectionViewBinding/SplitViewContext.js.map +1 -0
- package/dist/components/CollectionViewBinding/ViewModeToggle.js +150 -0
- package/dist/components/CollectionViewBinding/ViewModeToggle.js.map +1 -0
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js +49 -0
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js.map +1 -0
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js +122 -0
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js.map +1 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js +530 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +4 -1
- package/dist/components/CollectionViewBinding/usePreviewSlots.js +384 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -0
- package/dist/components/CollectionViewBinding/useSelectionController.js +104 -0
- package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -0
- package/dist/components/CollectionViewBinding/utils.js +21 -0
- package/dist/components/CollectionViewBinding/utils.js.map +1 -0
- package/dist/components/CollectionsProvider.d.ts +44 -0
- package/dist/components/CollectionsProvider.js +137 -0
- package/dist/components/CollectionsProvider.js.map +1 -0
- package/dist/components/CollectionsScopeContext.d.ts +18 -0
- package/dist/components/CollectionsScopeContext.js +25 -0
- package/dist/components/CollectionsScopeContext.js.map +1 -0
- package/dist/components/DefaultAppBar.js +179 -0
- package/dist/components/DefaultAppBar.js.map +1 -0
- package/dist/components/DefaultDrawer.js +364 -0
- package/dist/components/DefaultDrawer.js.map +1 -0
- package/dist/components/DeleteEntityDialog.js +256 -0
- package/dist/components/DeleteEntityDialog.js.map +1 -0
- package/dist/components/DetailViewBinding.js +504 -0
- package/dist/components/DetailViewBinding.js.map +1 -0
- package/dist/components/DrawerNavigationGroup.js +74 -0
- package/dist/components/DrawerNavigationGroup.js.map +1 -0
- package/dist/components/DrawerNavigationItem.d.ts +8 -0
- package/dist/components/DrawerNavigationItem.js +45 -0
- package/dist/components/DrawerNavigationItem.js.map +1 -0
- package/dist/components/EditFormActions.js +210 -0
- package/dist/components/EditFormActions.js.map +1 -0
- package/dist/components/EditViewBinding.d.ts +7 -1
- package/dist/components/EditViewBinding.js +802 -0
- package/dist/components/EditViewBinding.js.map +1 -0
- package/dist/components/EntityDisplayHeader.js +139 -0
- package/dist/components/EntityDisplayHeader.js.map +1 -0
- package/dist/components/EntityFormPanel.d.ts +58 -0
- package/dist/components/EntityFormPanel.js +126 -0
- package/dist/components/EntityFormPanel.js.map +1 -0
- package/dist/components/EntityIdentityBar.d.ts +29 -4
- package/dist/components/EntityIdentityBar.js +364 -0
- package/dist/components/EntityIdentityBar.js.map +1 -0
- package/dist/components/EntityInspector.js +96 -0
- package/dist/components/EntityInspector.js.map +1 -0
- package/dist/components/EntityPreviewBinding.js +282 -0
- package/dist/components/EntityPreviewBinding.js.map +1 -0
- package/dist/components/EntityPreviewNesting.js +53 -0
- package/dist/components/EntityPreviewNesting.js.map +1 -0
- package/dist/components/EntityViewBinding.js +246 -0
- package/dist/components/EntityViewBinding.js.map +1 -0
- package/dist/components/FieldCaption.js +17 -0
- package/dist/components/FieldCaption.js.map +1 -0
- package/dist/components/HomePage/ContentHomePage.js +326 -0
- package/dist/components/HomePage/ContentHomePage.js.map +1 -0
- package/dist/components/HomePage/FavouritesView.js +44 -0
- package/dist/components/HomePage/FavouritesView.js.map +1 -0
- package/dist/components/HomePage/HomePageDnD.js +436 -0
- package/dist/components/HomePage/HomePageDnD.js.map +1 -0
- package/dist/components/HomePage/NavigationCard.js +59 -0
- package/dist/components/HomePage/NavigationCard.js.map +1 -0
- package/dist/components/HomePage/NavigationCardBinding.js +70 -0
- package/dist/components/HomePage/NavigationCardBinding.js.map +1 -0
- package/dist/components/HomePage/NavigationGroup.js +98 -0
- package/dist/components/HomePage/NavigationGroup.js.map +1 -0
- package/dist/components/HomePage/RenameGroupDialog.js +89 -0
- package/dist/components/HomePage/RenameGroupDialog.js.map +1 -0
- package/dist/components/InlineEntityPreview.js +116 -0
- package/dist/components/InlineEntityPreview.js.map +1 -0
- package/dist/{JsonPreviewBinding-v0w3H0fp.js → components/JsonPreviewBinding.js} +2 -2
- package/dist/components/JsonPreviewBinding.js.map +1 -0
- package/dist/components/NavigationLoadingErrorView.d.ts +16 -0
- package/dist/components/NavigationLoadingErrorView.js +27 -0
- package/dist/components/NavigationLoadingErrorView.js.map +1 -0
- package/dist/components/PickerTrigger.js +27 -0
- package/dist/components/PickerTrigger.js.map +1 -0
- package/dist/components/PropertyCollectionView.js +215 -0
- package/dist/components/PropertyCollectionView.js.map +1 -0
- package/dist/components/PropertyConfigBadge.js +19 -0
- package/dist/components/PropertyConfigBadge.js.map +1 -0
- package/dist/components/PropertyKeyHint.js +58 -0
- package/dist/components/PropertyKeyHint.js.map +1 -0
- package/dist/components/RebaseAuthGate.js +35 -0
- package/dist/components/RebaseAuthGate.js.map +1 -0
- package/dist/components/RebaseCMS.js +44 -0
- package/dist/components/RebaseCMS.js.map +1 -0
- package/dist/components/RebaseLayout.js +59 -0
- package/dist/components/RebaseLayout.js.map +1 -0
- package/dist/components/RebaseNavigation.js +215 -0
- package/dist/components/RebaseNavigation.js.map +1 -0
- package/dist/components/RebaseRouteDefs.js +96 -0
- package/dist/components/RebaseRouteDefs.js.map +1 -0
- package/dist/components/RebaseShell.js +50 -0
- package/dist/components/RebaseShell.js.map +1 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.js +224 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -0
- package/dist/components/ReferenceWidget.js +100 -0
- package/dist/components/ReferenceWidget.js.map +1 -0
- package/dist/components/RelationSelector.js +625 -0
- package/dist/components/RelationSelector.js.map +1 -0
- package/dist/components/SearchIconsView.js +52 -0
- package/dist/components/SearchIconsView.js.map +1 -0
- package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
- package/dist/components/SelectableTable/SelectableTable.js +158 -0
- package/dist/components/SelectableTable/SelectableTable.js.map +1 -0
- package/dist/components/SelectableTable/SelectableTableContext.js +8 -0
- package/dist/components/SelectableTable/SelectableTableContext.js.map +1 -0
- package/dist/components/SelectableTable/SelectionStore.js +29 -0
- package/dist/components/SelectableTable/SelectionStore.js.map +1 -0
- package/dist/components/SelectableTable/filters/BooleanFilterField.js +28 -0
- package/dist/components/SelectableTable/filters/BooleanFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +2 -1
- package/dist/components/SelectableTable/filters/DateTimeFilterField.js +93 -0
- package/dist/components/SelectableTable/filters/DateTimeFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js +132 -0
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js.map +1 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js +157 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/RelationFilterField.js +169 -0
- package/dist/components/SelectableTable/filters/RelationFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js +181 -0
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/null_filter.js +36 -0
- package/dist/components/SelectableTable/filters/null_filter.js.map +1 -0
- package/dist/components/SideDialogs.js +149 -0
- package/dist/components/SideDialogs.js.map +1 -0
- package/dist/components/SidePanelBinding.js +287 -0
- package/dist/components/SidePanelBinding.js.map +1 -0
- package/dist/components/SidePanelProvider.js +69 -0
- package/dist/components/SidePanelProvider.js.map +1 -0
- package/dist/components/UserSelector.d.ts +2 -0
- package/dist/components/UserSelector.js +418 -0
- package/dist/components/UserSelector.js.map +1 -0
- package/dist/components/admin/CreationResultDialog.js +118 -0
- package/dist/components/admin/CreationResultDialog.js.map +1 -0
- package/dist/components/app/AppBar.js +14 -0
- package/dist/components/app/AppBar.js.map +1 -0
- package/dist/components/app/Drawer.js +26 -0
- package/dist/components/app/Drawer.js.map +1 -0
- package/dist/components/app/Scaffold.js +229 -0
- package/dist/components/app/Scaffold.js.map +1 -0
- package/dist/components/app/useApp.js +24 -0
- package/dist/components/app/useApp.js.map +1 -0
- package/dist/components/common/ActionMenuLabel.d.ts +15 -0
- package/dist/components/common/ActionMenuLabel.js +30 -0
- package/dist/components/common/ActionMenuLabel.js.map +1 -0
- package/dist/components/common/default_entity_actions.d.ts +37 -0
- package/dist/components/common/default_entity_actions.js +590 -0
- package/dist/components/common/default_entity_actions.js.map +1 -0
- package/dist/components/drawer_expansion.d.ts +25 -0
- package/dist/components/drawer_expansion.js +44 -0
- package/dist/components/drawer_expansion.js.map +1 -0
- package/dist/components/field_configs.d.ts +2 -2
- package/dist/components/field_configs.js +431 -0
- package/dist/components/field_configs.js.map +1 -0
- package/dist/components/field_ids.d.ts +11 -0
- package/dist/components/field_ids.js +58 -0
- package/dist/components/field_ids.js.map +1 -0
- package/dist/components/history/EntityHistoryEntry.js +151 -0
- package/dist/components/history/EntityHistoryEntry.js.map +1 -0
- package/dist/components/history/EntityHistoryView.js +157 -0
- package/dist/components/history/EntityHistoryView.js.map +1 -0
- package/dist/components/history/UserChip.js +21 -0
- package/dist/components/history/UserChip.js.map +1 -0
- package/dist/components/history/index.js +4 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/lazy_record_views.d.ts +10 -0
- package/dist/components/lazy_record_views.js +57 -0
- package/dist/components/lazy_record_views.js.map +1 -0
- package/dist/contexts/BreacrumbsContext.js +28 -0
- package/dist/contexts/BreacrumbsContext.js.map +1 -0
- package/dist/contexts/EditorAIControllerContext.d.ts +18 -0
- package/dist/contexts/EditorAIControllerContext.js +29 -0
- package/dist/contexts/EditorAIControllerContext.js.map +1 -0
- package/dist/contexts/SideDialogsControllerContext.js +7 -0
- package/dist/contexts/SideDialogsControllerContext.js.map +1 -0
- package/dist/data_export/export/BasicExportAction.js +151 -0
- package/dist/data_export/export/BasicExportAction.js.map +1 -0
- package/dist/data_export/export/ExportCollectionAction.js +297 -0
- package/dist/data_export/export/ExportCollectionAction.js.map +1 -0
- package/dist/data_export/export/additional_fields.js +40 -0
- package/dist/data_export/export/additional_fields.js.map +1 -0
- package/dist/data_export/export/export.d.ts +35 -0
- package/dist/data_export/export/export.js +400 -0
- package/dist/data_export/export/export.js.map +1 -0
- package/dist/data_export/export/fetch_export_data.d.ts +17 -7
- package/dist/data_export/export/fetch_export_data.js +67 -0
- package/dist/data_export/export/fetch_export_data.js.map +1 -0
- package/dist/data_export/export/index.d.ts +4 -2
- package/dist/data_export/export/index.js +5 -0
- package/dist/data_import/components/DataNewPropertiesMapping.js +207 -0
- package/dist/data_import/components/DataNewPropertiesMapping.js.map +1 -0
- package/dist/data_import/components/ImportConversionProblems.d.ts +11 -0
- package/dist/data_import/components/ImportConversionProblems.js +89 -0
- package/dist/data_import/components/ImportConversionProblems.js.map +1 -0
- package/dist/data_import/components/ImportFileUpload.js +43 -0
- package/dist/data_import/components/ImportFileUpload.js.map +1 -0
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js +42 -0
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js.map +1 -0
- package/dist/data_import/components/ImportSaveInProgress.js +105 -0
- package/dist/data_import/components/ImportSaveInProgress.js.map +1 -0
- package/dist/data_import/components/index.d.ts +1 -0
- package/dist/data_import/hooks/useImportConfig.js +34 -0
- package/dist/data_import/hooks/useImportConfig.js.map +1 -0
- package/dist/{import-TCgkTVlS.js → data_import/import/ImportCollectionAction.js} +84 -92
- package/dist/data_import/import/ImportCollectionAction.js.map +1 -0
- package/dist/data_import/import/index.js +2 -0
- package/dist/data_import/utils/csv.js +146 -0
- package/dist/data_import/utils/csv.js.map +1 -0
- package/dist/data_import/utils/data.d.ts +81 -4
- package/dist/data_import/utils/data.js +366 -0
- package/dist/data_import/utils/data.js.map +1 -0
- package/dist/data_import/utils/file_headers.js +32 -0
- package/dist/data_import/utils/file_headers.js.map +1 -0
- package/dist/data_import/utils/file_to_json.js +149 -0
- package/dist/data_import/utils/file_to_json.js.map +1 -0
- package/dist/data_import/utils/get_import_inference_type.js +14 -0
- package/dist/data_import/utils/get_import_inference_type.js.map +1 -0
- package/dist/data_import/utils/id_column.js +27 -0
- package/dist/data_import/utils/id_column.js.map +1 -0
- package/dist/data_import/utils/import_columns.d.ts +48 -0
- package/dist/data_import/utils/import_columns.js +92 -0
- package/dist/data_import/utils/import_columns.js.map +1 -0
- package/dist/data_import/utils/save_entities.d.ts +33 -4
- package/dist/data_import/utils/save_entities.js +244 -0
- package/dist/data_import/utils/save_entities.js.map +1 -0
- package/dist/data_import/utils/transforms.js +83 -0
- package/dist/data_import/utils/transforms.js.map +1 -0
- package/dist/editor/components/SlashCommandMenu.js +497 -0
- package/dist/editor/components/SlashCommandMenu.js.map +1 -0
- package/dist/editor/components/editor-bubble-item.js +24 -0
- package/dist/editor/components/editor-bubble-item.js.map +1 -0
- package/dist/editor/components/editor-bubble.js +97 -0
- package/dist/editor/components/editor-bubble.js.map +1 -0
- package/dist/editor/components/image-bubble.js +148 -0
- package/dist/editor/components/image-bubble.js.map +1 -0
- package/dist/editor/components/table-bubble.js +406 -0
- package/dist/editor/components/table-bubble.js.map +1 -0
- package/dist/editor/editor.d.ts +7 -1
- package/dist/editor/editor.js +423 -0
- package/dist/editor/editor.js.map +1 -0
- package/dist/editor/extensions/HighlightDecorationExtension.js +74 -0
- package/dist/editor/extensions/HighlightDecorationExtension.js.map +1 -0
- package/dist/editor/extensions/Image.d.ts +28 -1
- package/dist/editor/extensions/Image.js +160 -0
- package/dist/editor/extensions/Image.js.map +1 -0
- package/dist/editor/extensions/TextLoadingDecorationExtension.js +82 -0
- package/dist/editor/extensions/TextLoadingDecorationExtension.js.map +1 -0
- package/dist/editor/extensions/clipboard.js +63 -0
- package/dist/editor/extensions/clipboard.js.map +1 -0
- package/dist/editor/extensions/drag-and-drop.js +354 -0
- package/dist/editor/extensions/drag-and-drop.js.map +1 -0
- package/dist/editor/hooks/useProseMirror.d.ts +4 -1
- package/dist/editor/hooks/useProseMirror.js +101 -0
- package/dist/editor/hooks/useProseMirror.js.map +1 -0
- package/dist/editor/hooks/useProseMirrorContext.js +11 -0
- package/dist/editor/hooks/useProseMirrorContext.js.map +1 -0
- package/dist/editor/markdown.js +154 -0
- package/dist/editor/markdown.js.map +1 -0
- package/dist/editor/nodeViews/ImageComponent.js +35 -0
- package/dist/editor/nodeViews/ImageComponent.js.map +1 -0
- package/dist/editor/nodeViews/ReactNodeView.js +57 -0
- package/dist/editor/nodeViews/ReactNodeView.js.map +1 -0
- package/dist/editor/nodeViews/TaskItemComponent.js +29 -0
- package/dist/editor/nodeViews/TaskItemComponent.js.map +1 -0
- package/dist/editor/nodeViews/index.js +21 -0
- package/dist/editor/nodeViews/index.js.map +1 -0
- package/dist/editor/plugins/index.js +54 -0
- package/dist/editor/plugins/index.js.map +1 -0
- package/dist/editor/plugins/inputrules.js +54 -0
- package/dist/editor/plugins/inputrules.js.map +1 -0
- package/dist/editor/plugins/placeholderPlugin.js +38 -0
- package/dist/editor/plugins/placeholderPlugin.js.map +1 -0
- package/dist/editor/plugins/slashCommandPlugin.js +40 -0
- package/dist/editor/plugins/slashCommandPlugin.js.map +1 -0
- package/dist/editor/sanitize-html.js +190 -0
- package/dist/editor/sanitize-html.js.map +1 -0
- package/dist/{markdown-CCqp8ibf.js → editor/schema.js} +2 -159
- package/dist/editor/schema.js.map +1 -0
- package/dist/editor/selectors/link-selector.js +118 -0
- package/dist/editor/selectors/link-selector.js.map +1 -0
- package/dist/editor/selectors/node-selector.js +118 -0
- package/dist/editor/selectors/node-selector.js.map +1 -0
- package/dist/editor/selectors/text-buttons.js +71 -0
- package/dist/editor/selectors/text-buttons.js.map +1 -0
- package/dist/editor/utils/prosemirror-utils.js +92 -0
- package/dist/editor/utils/prosemirror-utils.js.map +1 -0
- package/dist/editor/utils/remove_classes.js +16 -0
- package/dist/editor/utils/remove_classes.js.map +1 -0
- package/dist/editor.js +1 -3085
- package/dist/form/EntityForm.js +734 -0
- package/dist/form/EntityForm.js.map +1 -0
- package/dist/form/EntityFormActions.js +101 -0
- package/dist/form/EntityFormActions.js.map +1 -0
- package/dist/form/EntityFormBinding.js +256 -0
- package/dist/form/EntityFormBinding.js.map +1 -0
- package/dist/form/PropertyFieldBinding.js +298 -0
- package/dist/form/PropertyFieldBinding.js.map +1 -0
- package/dist/form/components/ErrorFocus.js +33 -0
- package/dist/form/components/ErrorFocus.js.map +1 -0
- package/dist/form/components/FieldBlock.js +118 -0
- package/dist/form/components/FieldBlock.js.map +1 -0
- package/dist/form/components/FieldHelperText.js +56 -0
- package/dist/form/components/FieldHelperText.js.map +1 -0
- package/dist/form/components/FormRail.js +118 -0
- package/dist/form/components/FormRail.js.map +1 -0
- package/dist/form/components/FormSections.js +63 -0
- package/dist/form/components/FormSections.js.map +1 -0
- package/dist/form/components/LabelWithIcon.js +29 -0
- package/dist/form/components/LabelWithIcon.js.map +1 -0
- package/dist/form/components/LocalChangesMenu.js +127 -0
- package/dist/form/components/LocalChangesMenu.js.map +1 -0
- package/dist/form/components/StorageItemPreview.js +46 -0
- package/dist/form/components/StorageItemPreview.js.map +1 -0
- package/dist/form/components/StorageUploadProgress.js +84 -0
- package/dist/form/components/StorageUploadProgress.js.map +1 -0
- package/dist/form/components/useRailVisible.js +43 -0
- package/dist/form/components/useRailVisible.js.map +1 -0
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js +84 -0
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +125 -0
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/BinaryFieldBinding.js +135 -0
- package/dist/form/field_bindings/BinaryFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/BlockFieldBinding.js +164 -0
- package/dist/form/field_bindings/BlockFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/DateTimeFieldBinding.js +47 -0
- package/dist/form/field_bindings/DateTimeFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/GeopointFieldBinding.js +148 -0
- package/dist/form/field_bindings/GeopointFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.js +450 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MapFieldBinding.js +77 -0
- package/dist/form/field_bindings/MapFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +215 -0
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MultiSelectFieldBinding.js +88 -0
- package/dist/form/field_bindings/MultiSelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js +118 -0
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js +52 -0
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ReferenceFieldBinding.js +99 -0
- package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/RelationFieldBinding.js +135 -0
- package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/RepeatFieldBinding.js +103 -0
- package/dist/form/field_bindings/RepeatFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/SelectFieldBinding.js +80 -0
- package/dist/form/field_bindings/SelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/StorageUploadFieldBinding.js +266 -0
- package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/SwitchFieldBinding.js +41 -0
- package/dist/form/field_bindings/SwitchFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/TextFieldBinding.js +114 -0
- package/dist/form/field_bindings/TextFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/UserSelectFieldBinding.js +48 -0
- package/dist/form/field_bindings/UserSelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/VectorFieldBinding.js +147 -0
- package/dist/form/field_bindings/VectorFieldBinding.js.map +1 -0
- package/dist/form/form_keyboard_scope.d.ts +26 -0
- package/dist/form/form_keyboard_scope.js +39 -0
- package/dist/form/form_keyboard_scope.js.map +1 -0
- package/dist/form/form_uploads.d.ts +24 -0
- package/dist/form/form_uploads.js +31 -0
- package/dist/form/form_uploads.js.map +1 -0
- package/dist/form/form_utils.d.ts +48 -0
- package/dist/form/form_utils.js +280 -0
- package/dist/form/form_utils.js.map +1 -0
- package/dist/form/resolve_cell_property.d.ts +32 -0
- package/dist/form/resolve_cell_property.js +80 -0
- package/dist/form/resolve_cell_property.js.map +1 -0
- package/dist/form/resolve_form_properties.d.ts +27 -0
- package/dist/form/resolve_form_properties.js +78 -0
- package/dist/form/resolve_form_properties.js.map +1 -0
- package/dist/form/useClearRestoreValue.js +27 -0
- package/dist/form/useClearRestoreValue.js.map +1 -0
- package/dist/form/useUndoableDiscard.js +36 -0
- package/dist/form/useUndoableDiscard.js.map +1 -0
- package/dist/form/validation.d.ts +20 -0
- package/dist/form/validation.js +416 -0
- package/dist/form/validation.js.map +1 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js +22 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js.map +1 -0
- package/dist/hooks/navigation/contexts/NavigationStateContext.js +15 -0
- package/dist/hooks/navigation/contexts/NavigationStateContext.js.map +1 -0
- package/dist/hooks/navigation/contexts/UrlContext.js +22 -0
- package/dist/hooks/navigation/contexts/UrlContext.js.map +1 -0
- package/dist/hooks/navigation/useAsyncResolver.js +68 -0
- package/dist/hooks/navigation/useAsyncResolver.js.map +1 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js +141 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js.map +1 -0
- package/dist/hooks/navigation/useBuildNavigationStateController.js +77 -0
- package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -0
- package/dist/hooks/navigation/useBuildUrlController.js +57 -0
- package/dist/hooks/navigation/useBuildUrlController.js.map +1 -0
- package/dist/hooks/navigation/useNavigationResolution.js +177 -0
- package/dist/hooks/navigation/useNavigationResolution.js.map +1 -0
- package/dist/hooks/navigation/useResolvedCollections.js +56 -0
- package/dist/hooks/navigation/useResolvedCollections.js.map +1 -0
- package/dist/hooks/navigation/useResolvedViews.js +94 -0
- package/dist/hooks/navigation/useResolvedViews.js.map +1 -0
- package/dist/hooks/navigation/useTopLevelNavigation.js +162 -0
- package/dist/hooks/navigation/useTopLevelNavigation.js.map +1 -0
- package/dist/hooks/navigation/utils.js +125 -0
- package/dist/hooks/navigation/utils.js.map +1 -0
- package/dist/hooks/useAdminContext.js +45 -0
- package/dist/hooks/useAdminContext.js.map +1 -0
- package/dist/hooks/useBreadcrumbsController.js +17 -0
- package/dist/hooks/useBreadcrumbsController.js.map +1 -0
- package/dist/hooks/useBuildSideDialogsController.js +96 -0
- package/dist/hooks/useBuildSideDialogsController.js.map +1 -0
- package/dist/hooks/useBuildSidePanel.js +221 -0
- package/dist/hooks/useBuildSidePanel.js.map +1 -0
- package/dist/hooks/useChildViewSource.js +41 -0
- package/dist/hooks/useChildViewSource.js.map +1 -0
- package/dist/hooks/useEntityDisplay.js +136 -0
- package/dist/hooks/useEntityDisplay.js.map +1 -0
- package/dist/hooks/useEntityDisplayTitle.js +34 -0
- package/dist/hooks/useEntityDisplayTitle.js.map +1 -0
- package/dist/hooks/useHistory.js +137 -0
- package/dist/hooks/useHistory.js.map +1 -0
- package/dist/hooks/useRecordActions.d.ts +28 -6
- package/dist/hooks/useRecordActions.js +108 -0
- package/dist/hooks/useRecordActions.js.map +1 -0
- package/dist/hooks/useReferencePaths.d.ts +21 -0
- package/dist/hooks/useReferencePaths.js +32 -0
- package/dist/hooks/useReferencePaths.js.map +1 -0
- package/dist/hooks/useResolvedNavigationFrom.js +83 -0
- package/dist/hooks/useResolvedNavigationFrom.js.map +1 -0
- package/dist/hooks/useResolvedUsers.js +109 -0
- package/dist/hooks/useResolvedUsers.js.map +1 -0
- package/dist/hooks/useSelectionDialog.js +53 -0
- package/dist/hooks/useSelectionDialog.js.map +1 -0
- package/dist/hooks/useSideDialogsController.js +8 -0
- package/dist/hooks/useSideDialogsController.js.map +1 -0
- package/dist/hooks/useSidePanel.js +15 -0
- package/dist/hooks/useSidePanel.js.map +1 -0
- package/dist/hooks/useStorageReferenceResolver.d.ts +25 -0
- package/dist/hooks/useStorageReferenceResolver.js +49 -0
- package/dist/hooks/useStorageReferenceResolver.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +151 -3793
- package/dist/preview/PropertyPreview.js +260 -0
- package/dist/preview/PropertyPreview.js.map +1 -0
- package/dist/preview/compact_text.js +52 -0
- package/dist/preview/compact_text.js.map +1 -0
- package/dist/preview/components/ArrayEnumPreview.js +24 -0
- package/dist/preview/components/ArrayEnumPreview.js.map +1 -0
- package/dist/preview/components/BooleanPreview.js +25 -0
- package/dist/preview/components/BooleanPreview.js.map +1 -0
- package/dist/preview/components/DatePreview.d.ts +3 -2
- package/dist/preview/components/DatePreview.js +87 -0
- package/dist/preview/components/DatePreview.js.map +1 -0
- package/dist/preview/components/EmptyValue.js +13 -0
- package/dist/preview/components/EmptyValue.js.map +1 -0
- package/dist/preview/components/EnumValuesChip.js +26 -0
- package/dist/preview/components/EnumValuesChip.js.map +1 -0
- package/dist/preview/components/ImagePreview.d.ts +7 -1
- package/dist/preview/components/ImagePreview.js +112 -0
- package/dist/preview/components/ImagePreview.js.map +1 -0
- package/dist/preview/components/InlineEntityListPreview.js +31 -0
- package/dist/preview/components/InlineEntityListPreview.js.map +1 -0
- package/dist/preview/components/ReferencePreview.js +162 -0
- package/dist/preview/components/ReferencePreview.js.map +1 -0
- package/dist/preview/components/RelationPreview.js +196 -0
- package/dist/preview/components/RelationPreview.js.map +1 -0
- package/dist/preview/components/StorageMarkdown.d.ts +11 -0
- package/dist/preview/components/StorageMarkdown.js +49 -0
- package/dist/preview/components/StorageMarkdown.js.map +1 -0
- package/dist/preview/components/StorageThumbnail.js +183 -0
- package/dist/preview/components/StorageThumbnail.js.map +1 -0
- package/dist/preview/components/UrlComponentPreview.d.ts +3 -1
- package/dist/preview/components/UrlComponentPreview.js +88 -0
- package/dist/preview/components/UrlComponentPreview.js.map +1 -0
- package/dist/preview/components/UserPreview.js +30 -0
- package/dist/preview/components/UserPreview.js.map +1 -0
- package/dist/preview/components/date_fns_locales.js +124 -0
- package/dist/preview/components/date_fns_locales.js.map +1 -0
- package/dist/preview/components/storageRenditions.d.ts +10 -0
- package/dist/preview/components/storageRenditions.js +95 -0
- package/dist/preview/components/storageRenditions.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfMapsPreview.js +44 -0
- package/dist/preview/property_previews/ArrayOfMapsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js +48 -0
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js +50 -0
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js +30 -0
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfStringsPreview.js +42 -0
- package/dist/preview/property_previews/ArrayOfStringsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOneOfPreview.js +47 -0
- package/dist/preview/property_previews/ArrayOneOfPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js +25 -0
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayPropertyPreview.js +48 -0
- package/dist/preview/property_previews/ArrayPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/MapPropertyPreview.js +137 -0
- package/dist/preview/property_previews/MapPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/NumberPropertyPreview.js +34 -0
- package/dist/preview/property_previews/NumberPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/SkeletonPropertyComponent.js +151 -0
- package/dist/preview/property_previews/SkeletonPropertyComponent.js.map +1 -0
- package/dist/preview/property_previews/StringPropertyPreview.js +49 -0
- package/dist/preview/property_previews/StringPropertyPreview.js.map +1 -0
- package/dist/preview/util.d.ts +8 -3
- package/dist/{util-CC0ozHoD.js → preview/util.js} +13 -6
- package/dist/preview/util.js.map +1 -0
- package/dist/routes/CustomViewRoute.js +26 -0
- package/dist/routes/CustomViewRoute.js.map +1 -0
- package/dist/routes/RebaseRoute.js +311 -0
- package/dist/routes/RebaseRoute.js.map +1 -0
- package/dist/selection/SelectionMenu.js +90 -0
- package/dist/selection/SelectionMenu.js.map +1 -0
- package/dist/selection/resolve_selection.js +79 -0
- package/dist/selection/resolve_selection.js.map +1 -0
- package/dist/util/caller_scopes.d.ts +15 -0
- package/dist/util/caller_scopes.js +25 -0
- package/dist/util/caller_scopes.js.map +1 -0
- package/dist/util/collection_open_mode.d.ts +20 -0
- package/dist/util/collection_open_mode.js +32 -0
- package/dist/util/collection_open_mode.js.map +1 -0
- package/dist/util/dataControllerAdapter.js +65 -0
- package/dist/util/dataControllerAdapter.js.map +1 -0
- package/dist/util/entity_actions.d.ts +42 -1
- package/dist/util/entity_actions.js +77 -0
- package/dist/util/entity_actions.js.map +1 -0
- package/dist/util/entity_pages.d.ts +37 -3
- package/dist/util/entity_pages.js +71 -0
- package/dist/util/entity_pages.js.map +1 -0
- package/dist/util/find_entities_by_ids.d.ts +23 -0
- package/dist/util/find_entities_by_ids.js +55 -0
- package/dist/util/find_entities_by_ids.js.map +1 -0
- package/dist/util/fit_inline_actions.d.ts +20 -0
- package/dist/util/fit_inline_actions.js +40 -0
- package/dist/util/fit_inline_actions.js.map +1 -0
- package/dist/util/format_collection_date.d.ts +29 -0
- package/dist/util/format_collection_date.js +60 -0
- package/dist/util/format_collection_date.js.map +1 -0
- package/dist/util/map_with_concurrency.js +46 -0
- package/dist/util/map_with_concurrency.js.map +1 -0
- package/dist/util/navigation_utils.js +45 -0
- package/dist/util/navigation_utils.js.map +1 -0
- package/dist/util/number_format.js +33 -0
- package/dist/util/number_format.js.map +1 -0
- package/dist/util/previews.js +71 -0
- package/dist/util/previews.js.map +1 -0
- package/dist/util/propertyConfigMapper.js +83 -0
- package/dist/util/propertyConfigMapper.js.map +1 -0
- package/dist/util/property_utils.js +141 -0
- package/dist/util/property_utils.js.map +1 -0
- package/dist/util/resolutions.js +55 -0
- package/dist/util/resolutions.js.map +1 -0
- package/dist/util/view_constants.js +35 -0
- package/dist/util/view_constants.js.map +1 -0
- package/dist/util/view_mode.js +112 -0
- package/dist/util/view_mode.js.map +1 -0
- package/package.json +13 -9
- package/dist/CollectionEditorDialog-DLHCka00.js +0 -3630
- package/dist/CollectionEditorDialog-DLHCka00.js.map +0 -1
- package/dist/JsonPreviewBinding-v0w3H0fp.js.map +0 -1
- package/dist/PropertyEditView-_pu5hzZn.js +0 -3837
- package/dist/PropertyEditView-_pu5hzZn.js.map +0 -1
- package/dist/RouterCollectionsStudioView-ChPNl_uU.js +0 -212
- package/dist/RouterCollectionsStudioView-ChPNl_uU.js.map +0 -1
- package/dist/SchemaChangeDialog-BeP0A4MJ.js.map +0 -1
- package/dist/collection_editor/ui/CollectionViewHeaderAction.d.ts +0 -13
- package/dist/collection_editor/ui/PropertyAddColumnComponent.d.ts +0 -8
- package/dist/collection_editor_ui.js.map +0 -1
- package/dist/editor.js.map +0 -1
- package/dist/export-4bJWdlDK.js +0 -520
- package/dist/export-4bJWdlDK.js.map +0 -1
- package/dist/history-BElrZ5Rw.js +0 -313
- package/dist/history-BElrZ5Rw.js.map +0 -1
- package/dist/import-TCgkTVlS.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/markdown-CCqp8ibf.js.map +0 -1
- package/dist/rolldown-runtime-D7D4PA-g.js +0 -13
- package/dist/util-CC0ozHoD.js.map +0 -1
- package/dist/util-DybQBkug.js +0 -26390
- package/dist/util-DybQBkug.js.map +0 -1
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { LiveSchemaError, SchemaChangeCancelled, createLiveSchemaClient } from "./liveSchemaClient.js";
|
|
2
|
+
import { Suspense, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { lazyChunk } from "@rebasepro/ui";
|
|
5
|
+
//#region src/collection_editor/useLiveSchemaEditing.tsx
|
|
6
|
+
/**
|
|
7
|
+
* The plan-then-confirm flow, as a hook.
|
|
8
|
+
*
|
|
9
|
+
* Owns three things that belong together and nothing else: whether the backend
|
|
10
|
+
* can edit its schema, the plan for the change somebody is making, and the
|
|
11
|
+
* dialog they confirm it in. The config controller calls `reviewChange` and
|
|
12
|
+
* awaits it; everything about *how* the confirmation happens stays here.
|
|
13
|
+
*
|
|
14
|
+
* ## Why `reviewChange` returns a promise that can reject
|
|
15
|
+
*
|
|
16
|
+
* Because the editor needs to know. A save that was cancelled must not leave
|
|
17
|
+
* the form thinking it succeeded — the collection on screen would then differ
|
|
18
|
+
* from the one on disk, and the next save would be computed from the wrong
|
|
19
|
+
* `before`. Rejecting with {@link SchemaChangeCancelled} is how "the person
|
|
20
|
+
* said no" reaches the caller as an outcome rather than as silence.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Loaded when a change is actually being reviewed, not before.
|
|
24
|
+
*
|
|
25
|
+
* This hook is reached from the collections config controller, which is
|
|
26
|
+
* constructed on every admin boot — so a static import would put the dialog and
|
|
27
|
+
* the `@rebasepro/ui` surface it draws on into the **eager** bundle: everything
|
|
28
|
+
* a browser downloads before the login screen paints. It cost 14 kB there, for
|
|
29
|
+
* a dialog most sessions never open. The bundle budget caught it.
|
|
30
|
+
*/
|
|
31
|
+
var SchemaChangeDialog = lazyChunk(() => import("./ui/collection_editor/SchemaChangeDialog.js").then((m) => ({ default: m.SchemaChangeDialog })));
|
|
32
|
+
/** The answer when nobody asked. */
|
|
33
|
+
var NOT_ASKED = {
|
|
34
|
+
enabled: false,
|
|
35
|
+
canPlan: false,
|
|
36
|
+
canApply: false
|
|
37
|
+
};
|
|
38
|
+
function useLiveSchemaEditing(options) {
|
|
39
|
+
const { baseUrl, authKey } = options;
|
|
40
|
+
const asking = options.enabled !== false;
|
|
41
|
+
const optionsRef = useRef(options);
|
|
42
|
+
optionsRef.current = options;
|
|
43
|
+
const client = useMemo(() => options.client ?? createLiveSchemaClient({
|
|
44
|
+
baseUrl,
|
|
45
|
+
getAuthToken: () => optionsRef.current.getAuthToken?.() ?? null
|
|
46
|
+
}), [baseUrl, options.client]);
|
|
47
|
+
const [status, setStatus] = useState();
|
|
48
|
+
const [pending, setPending] = useState();
|
|
49
|
+
const [plan, setPlan] = useState();
|
|
50
|
+
const [planError, setPlanError] = useState();
|
|
51
|
+
const [result, setResult] = useState();
|
|
52
|
+
const [applying, setApplying] = useState(false);
|
|
53
|
+
const [applyError, setApplyError] = useState();
|
|
54
|
+
const probe = useRef(void 0);
|
|
55
|
+
/** Which review a plan response belongs to. See `reviewChange`. */
|
|
56
|
+
const reviewToken = useRef(0);
|
|
57
|
+
const ready = useCallback(() => {
|
|
58
|
+
if (!asking) return Promise.resolve(NOT_ASKED);
|
|
59
|
+
const key = [client, authKey];
|
|
60
|
+
const current = probe.current;
|
|
61
|
+
if (!current || current.key[0] !== key[0] || current.key[1] !== key[1]) probe.current = {
|
|
62
|
+
key,
|
|
63
|
+
promise: client.status()
|
|
64
|
+
};
|
|
65
|
+
return probe.current.promise;
|
|
66
|
+
}, [
|
|
67
|
+
client,
|
|
68
|
+
authKey,
|
|
69
|
+
asking
|
|
70
|
+
]);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
let cancelled = false;
|
|
73
|
+
ready().then((answer) => {
|
|
74
|
+
if (!cancelled) setStatus(answer);
|
|
75
|
+
});
|
|
76
|
+
return () => {
|
|
77
|
+
cancelled = true;
|
|
78
|
+
};
|
|
79
|
+
}, [ready]);
|
|
80
|
+
/**
|
|
81
|
+
* Ask what the change would do, and ignore an answer that arrives late.
|
|
82
|
+
*
|
|
83
|
+
* Separate from `reviewChange` so it can be issued *again* without starting
|
|
84
|
+
* a new review: a plan that failed on a dropped connection should cost a
|
|
85
|
+
* click, not the whole wizard — the person has already filled in the form,
|
|
86
|
+
* and making them do it twice for a transient failure is the kind of thing
|
|
87
|
+
* that teaches people to distrust the preview.
|
|
88
|
+
*/
|
|
89
|
+
const requestPlan = useCallback(async (change) => {
|
|
90
|
+
const token = ++reviewToken.current;
|
|
91
|
+
try {
|
|
92
|
+
const answer = await client.plan(change);
|
|
93
|
+
if (token === reviewToken.current) setPlan(answer);
|
|
94
|
+
} catch (err) {
|
|
95
|
+
if (token !== reviewToken.current) return;
|
|
96
|
+
setPlanError(err instanceof LiveSchemaError || err instanceof Error ? err.message : String(err));
|
|
97
|
+
}
|
|
98
|
+
}, [client]);
|
|
99
|
+
const onRetry = useCallback(() => {
|
|
100
|
+
if (!pending) return;
|
|
101
|
+
setPlanError(void 0);
|
|
102
|
+
setPlan(void 0);
|
|
103
|
+
requestPlan(pending.change);
|
|
104
|
+
}, [pending, requestPlan]);
|
|
105
|
+
const clear = useCallback(() => {
|
|
106
|
+
setPending(void 0);
|
|
107
|
+
setPlan(void 0);
|
|
108
|
+
setPlanError(void 0);
|
|
109
|
+
setResult(void 0);
|
|
110
|
+
setApplyError(void 0);
|
|
111
|
+
setApplying(false);
|
|
112
|
+
}, []);
|
|
113
|
+
const reviewChange = useCallback((change) => {
|
|
114
|
+
return new Promise((resolve, reject) => {
|
|
115
|
+
setPending((previous) => {
|
|
116
|
+
previous?.reject(new SchemaChangeCancelled());
|
|
117
|
+
return {
|
|
118
|
+
change,
|
|
119
|
+
resolve,
|
|
120
|
+
reject
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
setPlan(void 0);
|
|
124
|
+
setPlanError(void 0);
|
|
125
|
+
setResult(void 0);
|
|
126
|
+
setApplyError(void 0);
|
|
127
|
+
setApplying(false);
|
|
128
|
+
requestPlan(change);
|
|
129
|
+
});
|
|
130
|
+
}, [requestPlan]);
|
|
131
|
+
const onConfirm = useCallback(() => {
|
|
132
|
+
if (!pending) return;
|
|
133
|
+
setApplying(true);
|
|
134
|
+
setApplyError(void 0);
|
|
135
|
+
client.apply(pending.change).then((answer) => {
|
|
136
|
+
setResult(answer);
|
|
137
|
+
setApplying(false);
|
|
138
|
+
pending.resolve();
|
|
139
|
+
setPending(void 0);
|
|
140
|
+
}, (err) => {
|
|
141
|
+
setApplying(false);
|
|
142
|
+
setApplyError(err instanceof Error ? err.message : String(err));
|
|
143
|
+
});
|
|
144
|
+
}, [client, pending]);
|
|
145
|
+
/**
|
|
146
|
+
* "Edit source only": commit the collection, run nothing.
|
|
147
|
+
*
|
|
148
|
+
* Through the same door as an apply, so it is committed. It used to be a
|
|
149
|
+
* write through the source-only editor that nobody committed, which every
|
|
150
|
+
* later "Commit and apply" met as somebody else's work — 409, with the
|
|
151
|
+
* dialog never saying why.
|
|
152
|
+
*/
|
|
153
|
+
const onSourceOnly = useCallback(() => {
|
|
154
|
+
if (!pending) return;
|
|
155
|
+
setApplying(true);
|
|
156
|
+
setApplyError(void 0);
|
|
157
|
+
const settle = pending;
|
|
158
|
+
client.apply({
|
|
159
|
+
...settle.change,
|
|
160
|
+
sourceOnly: true
|
|
161
|
+
}).then((answer) => {
|
|
162
|
+
setResult(answer);
|
|
163
|
+
setApplying(false);
|
|
164
|
+
settle.resolve();
|
|
165
|
+
setPending(void 0);
|
|
166
|
+
}, (err) => {
|
|
167
|
+
setApplying(false);
|
|
168
|
+
setApplyError(err instanceof Error ? err.message : String(err));
|
|
169
|
+
});
|
|
170
|
+
}, [client, pending]);
|
|
171
|
+
const sourceOnlyOffered = Boolean(plan && !plan.applicable && plan.changes.filter((change) => change.verdict !== "safe").every((change) => change.sourceOnly));
|
|
172
|
+
const onClose = useCallback(() => {
|
|
173
|
+
if (applying) return;
|
|
174
|
+
const settle = pending;
|
|
175
|
+
clear();
|
|
176
|
+
if (settle && !result) settle.reject(new SchemaChangeCancelled());
|
|
177
|
+
}, [
|
|
178
|
+
applying,
|
|
179
|
+
pending,
|
|
180
|
+
result,
|
|
181
|
+
clear
|
|
182
|
+
]);
|
|
183
|
+
const open = Boolean(pending) || Boolean(result);
|
|
184
|
+
return {
|
|
185
|
+
status,
|
|
186
|
+
ready,
|
|
187
|
+
reviewChange,
|
|
188
|
+
dialog: open ? /* @__PURE__ */ jsx(Suspense, {
|
|
189
|
+
fallback: null,
|
|
190
|
+
children: /* @__PURE__ */ jsx(SchemaChangeDialog, {
|
|
191
|
+
open,
|
|
192
|
+
collectionId: pending?.change.collectionId ?? "",
|
|
193
|
+
plan,
|
|
194
|
+
planError,
|
|
195
|
+
result,
|
|
196
|
+
applying,
|
|
197
|
+
applyError,
|
|
198
|
+
onConfirm,
|
|
199
|
+
onRetry: planError ? onRetry : void 0,
|
|
200
|
+
onSourceOnly: sourceOnlyOffered ? onSourceOnly : void 0,
|
|
201
|
+
onClose,
|
|
202
|
+
applyRefusedBecause: status && !status.canApply ? status.applyRefusedBecause : void 0,
|
|
203
|
+
target: status && {
|
|
204
|
+
repository: status.repository,
|
|
205
|
+
branch: status.branch
|
|
206
|
+
}
|
|
207
|
+
})
|
|
208
|
+
}) : null
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
//#endregion
|
|
212
|
+
export { useLiveSchemaEditing };
|
|
213
|
+
|
|
214
|
+
//# sourceMappingURL=useLiveSchemaEditing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLiveSchemaEditing.js","names":[],"sources":["../../src/collection_editor/useLiveSchemaEditing.tsx"],"sourcesContent":["/**\n * The plan-then-confirm flow, as a hook.\n *\n * Owns three things that belong together and nothing else: whether the backend\n * can edit its schema, the plan for the change somebody is making, and the\n * dialog they confirm it in. The config controller calls `reviewChange` and\n * awaits it; everything about *how* the confirmation happens stays here.\n *\n * ## Why `reviewChange` returns a promise that can reject\n *\n * Because the editor needs to know. A save that was cancelled must not leave\n * the form thinking it succeeded — the collection on screen would then differ\n * from the one on disk, and the next save would be computed from the wrong\n * `before`. Rejecting with {@link SchemaChangeCancelled} is how \"the person\n * said no\" reaches the caller as an outcome rather than as silence.\n */\nimport React, { Suspense, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { lazyChunk } from \"@rebasepro/ui\";\n\nimport {\n createLiveSchemaClient,\n LiveSchemaError,\n SchemaChangeCancelled,\n type LiveSchemaClient,\n type LiveSchemaPlan,\n type LiveSchemaResult,\n type LiveSchemaStatus,\n type ProposedCollectionChange\n} from \"./liveSchemaClient\";\n\n// Re-exported so the hook stays the one import a caller needs.\nexport { SchemaChangeCancelled, isSchemaChangeCancelled } from \"./liveSchemaClient\";\n\n/**\n * Loaded when a change is actually being reviewed, not before.\n *\n * This hook is reached from the collections config controller, which is\n * constructed on every admin boot — so a static import would put the dialog and\n * the `@rebasepro/ui` surface it draws on into the **eager** bundle: everything\n * a browser downloads before the login screen paints. It cost 14 kB there, for\n * a dialog most sessions never open. The bundle budget caught it.\n */\nconst SchemaChangeDialog = lazyChunk(() =>\n import(\"./ui/collection_editor/SchemaChangeDialog\")\n .then(m => ({ default: m.SchemaChangeDialog }))\n);\n\nexport interface UseLiveSchemaEditingOptions {\n /** Base for the routes, e.g. `https://api.example.com/api/admin/schema`. */\n baseUrl: string;\n getAuthToken?: () => Promise<string | null> | string | null;\n /**\n * Identity of the signed-in user.\n *\n * Only used to re-ask: whether this backend will accept a schema change\n * depends on who is asking, and the answer to an anonymous probe does not\n * survive a sign-in.\n */\n authKey?: string | null;\n /**\n * Whether to ask the backend at all. `false` when the caller cannot be told\n * anything (`/status` needs `schema:read`) or the editor is read-only: the\n * answer is then \"not available\" without a request that could only be\n * refused. Defaults to `true`.\n */\n enabled?: boolean;\n /** Swappable for the tests, which have no server. */\n client?: LiveSchemaClient;\n}\n\n/** The answer when nobody asked. */\nconst NOT_ASKED: LiveSchemaStatus = { enabled: false, canPlan: false, canApply: false };\n\ninterface PendingChange {\n change: ProposedCollectionChange;\n resolve: () => void;\n reject: (err: Error) => void;\n}\n\nexport interface LiveSchemaEditing {\n /** `undefined` until the backend has answered. For rendering. */\n status?: LiveSchemaStatus;\n /**\n * The same answer, for deciding.\n *\n * `status` is undefined for one round trip after mount, and a caller that\n * read it to choose a code path would take the \"not available\" branch for\n * that window — so a save issued quickly after a page load would silently\n * skip the confirmation and write source only, while the same save a second\n * later would not. Timing-dependent behaviour with no visible difference is\n * the worst shape this could have.\n *\n * Resolves once, cached; never rejects, because every way of failing to get\n * an answer means the same thing to whoever is deciding.\n */\n ready: () => Promise<LiveSchemaStatus>;\n /**\n * Plan the change, show it, and settle when the person has decided.\n *\n * Resolves once the change has been applied — or written source-only, if\n * they chose that. Rejects with {@link SchemaChangeCancelled} if they\n * closed the dialog, and with the underlying error if planning or applying\n * failed in a way they did not choose.\n */\n reviewChange: (change: ProposedCollectionChange) => Promise<void>;\n /** Render this once, high enough that a dialog over the editor is not clipped. */\n dialog: React.ReactNode;\n}\n\nexport function useLiveSchemaEditing(options: UseLiveSchemaEditingOptions): LiveSchemaEditing {\n const { baseUrl, authKey } = options;\n const asking = options.enabled !== false;\n\n const optionsRef = useRef(options);\n optionsRef.current = options;\n\n const client = useMemo(\n () => options.client ?? createLiveSchemaClient({\n baseUrl,\n getAuthToken: () => optionsRef.current.getAuthToken?.() ?? null\n }),\n // `client` is either supplied once by a test or built from the URL. The\n // token getter is read through the ref so a new closure on every render\n // does not rebuild the client underneath an in-flight request.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [baseUrl, options.client]\n );\n\n const [status, setStatus] = useState<LiveSchemaStatus | undefined>();\n const [pending, setPending] = useState<PendingChange | undefined>();\n const [plan, setPlan] = useState<LiveSchemaPlan | undefined>();\n const [planError, setPlanError] = useState<string | undefined>();\n const [result, setResult] = useState<LiveSchemaResult | undefined>();\n const [applying, setApplying] = useState(false);\n const [applyError, setApplyError] = useState<string | undefined>();\n\n // The in-flight probe, so `ready()` can await the same one the effect\n // started rather than issuing a second. Keyed by client+authKey the same way\n // the effect is: a sign-in changes the answer, so it has to be re-asked.\n // `undefined` passed explicitly: React 19's `useRef` takes no zero-argument\n // overload, and omitting it is an error rather than a default.\n const probe = useRef<{ key: unknown[]; promise: Promise<LiveSchemaStatus> } | undefined>(undefined);\n\n /** Which review a plan response belongs to. See `reviewChange`. */\n const reviewToken = useRef(0);\n\n const ready = useCallback((): Promise<LiveSchemaStatus> => {\n if (!asking) return Promise.resolve(NOT_ASKED);\n const key = [client, authKey];\n const current = probe.current;\n if (!current || current.key[0] !== key[0] || current.key[1] !== key[1]) {\n probe.current = { key, promise: client.status() };\n }\n return probe.current!.promise;\n }, [client, authKey, asking]);\n\n useEffect(() => {\n let cancelled = false;\n void ready().then(answer => {\n if (!cancelled) setStatus(answer);\n });\n return () => { cancelled = true; };\n }, [ready]);\n\n /**\n * Ask what the change would do, and ignore an answer that arrives late.\n *\n * Separate from `reviewChange` so it can be issued *again* without starting\n * a new review: a plan that failed on a dropped connection should cost a\n * click, not the whole wizard — the person has already filled in the form,\n * and making them do it twice for a transient failure is the kind of thing\n * that teaches people to distrust the preview.\n */\n const requestPlan = useCallback(async (change: ProposedCollectionChange) => {\n // Identifies the review a response belongs to. A plan that arrives after\n // its review was replaced must not be shown: the dialog would describe\n // the *previous* change while the reader believes it describes this one.\n const token = ++reviewToken.current;\n try {\n const answer = await client.plan(change);\n if (token === reviewToken.current) setPlan(answer);\n } catch (err: unknown) {\n if (token !== reviewToken.current) return;\n setPlanError(\n err instanceof LiveSchemaError || err instanceof Error\n ? err.message\n : String(err)\n );\n }\n }, [client]);\n\n const onRetry = useCallback(() => {\n if (!pending) return;\n setPlanError(undefined);\n setPlan(undefined);\n void requestPlan(pending.change);\n }, [pending, requestPlan]);\n\n const clear = useCallback(() => {\n setPending(undefined);\n setPlan(undefined);\n setPlanError(undefined);\n setResult(undefined);\n setApplyError(undefined);\n setApplying(false);\n }, []);\n\n const reviewChange = useCallback((change: ProposedCollectionChange) => {\n return new Promise<void>((resolve, reject) => {\n // A second review while one is open — a double-clicked save —\n // replaces the pending one, and the one it replaces has to be\n // settled. `setPending` used to overwrite `resolve`/`reject` with\n // nobody left holding them, so the first caller's promise never\n // settled at all and the editor's save simply never returned.\n setPending(previous => {\n previous?.reject(new SchemaChangeCancelled());\n return { change, resolve, reject };\n });\n\n // Identifies the review a response belongs to. A plan that arrives\n // after its review was replaced must not be shown: the dialog would\n // describe the *previous* change while the reader believes it\n // describes this one, and the SQL on screen would be for something\n // they are not confirming.\n setPlan(undefined);\n setPlanError(undefined);\n setResult(undefined);\n setApplyError(undefined);\n setApplying(false);\n\n void requestPlan(change);\n });\n // `client` is not listed: this no longer touches it directly, and\n // `requestPlan` already carries that dependency.\n }, [requestPlan]);\n\n const onConfirm = useCallback(() => {\n if (!pending) return;\n setApplying(true);\n setApplyError(undefined);\n void client.apply(pending.change).then(\n answer => {\n setResult(answer);\n setApplying(false);\n // Resolved here, not on close. The change has happened, and the\n // dialog is now a receipt somebody may read for as long as they\n // like — holding the caller open until they close it would\n // leave the editor mid-save for no reason.\n pending.resolve();\n setPending(undefined);\n },\n (err: unknown) => {\n setApplying(false);\n setApplyError(err instanceof Error ? err.message : String(err));\n }\n );\n }, [client, pending]);\n\n /**\n * \"Edit source only\": commit the collection, run nothing.\n *\n * Through the same door as an apply, so it is committed. It used to be a\n * write through the source-only editor that nobody committed, which every\n * later \"Commit and apply\" met as somebody else's work — 409, with the\n * dialog never saying why.\n */\n const onSourceOnly = useCallback(() => {\n if (!pending) return;\n setApplying(true);\n setApplyError(undefined);\n const settle = pending;\n void client.apply({ ...settle.change, sourceOnly: true }).then(\n answer => {\n setResult(answer);\n setApplying(false);\n settle.resolve();\n setPending(undefined);\n },\n (err: unknown) => {\n setApplying(false);\n setApplyError(err instanceof Error ? err.message : String(err));\n }\n );\n }, [client, pending]);\n\n // Offered only when every refused change says what it would leave behind.\n // One that does not may not be written to the source alone.\n const sourceOnlyOffered = Boolean(plan && !plan.applicable &&\n plan.changes.filter(change => change.verdict !== \"safe\").every(change => change.sourceOnly));\n\n const onClose = useCallback(() => {\n // Escape and the backdrop reach this too, and the Cancel *button* is the\n // only one of the three that was disabled while applying. Closing\n // mid-apply rejected the caller as cancelled while the commit and the\n // DDL carried on — reporting that nothing happened while something did,\n // which is the exact failure this whole feature exists to end.\n if (applying) return;\n\n const settle = pending;\n clear();\n // A dialog showing a result has already resolved; closing it is not a\n // cancellation of anything.\n if (settle && !result) settle.reject(new SchemaChangeCancelled());\n }, [applying, pending, result, clear]);\n\n // Not even a Suspense boundary until there is something to review — the\n // chunk is fetched by the first `reviewChange`, and an admin session that\n // never edits a collection never pays for it.\n const open = Boolean(pending) || Boolean(result);\n const dialog = open\n ? (\n <Suspense fallback={null}>\n <SchemaChangeDialog\n open={open}\n collectionId={pending?.change.collectionId ?? \"\"}\n plan={plan}\n planError={planError}\n result={result}\n applying={applying}\n applyError={applyError}\n onConfirm={onConfirm}\n onRetry={planError ? onRetry : undefined}\n onSourceOnly={sourceOnlyOffered ? onSourceOnly : undefined}\n onClose={onClose}\n applyRefusedBecause={\n status && !status.canApply ? status.applyRefusedBecause : undefined\n }\n target={status && {\n repository: status.repository,\n branch: status.branch\n }}\n />\n </Suspense>\n )\n : null;\n\n return { status, ready, reviewChange, dialog };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,IAAM,qBAAqB,gBACvB,OAAO,+CAA4C,CAC9C,MAAK,OAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,CACtD;;AA0BA,IAAM,YA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,sBAAsB,KAAA;IAE9D,QAAQ,UAAU;KACd,YAAY,OAAO;KACnB,QAAQ,OAAO;IACnB;GACH,CAAA;EACK,CAAA,IAEZ;CAEuC;AACjD"}
|
|
@@ -11,4 +11,11 @@ export declare function useLocalCollectionsConfigController(clientOrUrl: any, ba
|
|
|
11
11
|
* anonymous probe does not survive a sign-in.
|
|
12
12
|
*/
|
|
13
13
|
authKey?: string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the signed-in user holds `schema:read`, which both
|
|
16
|
+
* status routes require. `false` asks neither and leaves the editor
|
|
17
|
+
* read-only, because a 403 is the only answer such a user can get.
|
|
18
|
+
* Absent means ask.
|
|
19
|
+
*/
|
|
20
|
+
mayReadSchema?: boolean;
|
|
14
21
|
}): CollectionsConfigController;
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { useLiveSchemaEditing } from "./useLiveSchemaEditing.js";
|
|
2
|
+
import { collectionForWire } from "./collection_wire.js";
|
|
3
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { DEFAULT_API_PATH } from "@rebasepro/app";
|
|
5
|
+
import { diffCollections } from "@rebasepro/types";
|
|
6
|
+
//#region src/collection_editor/useLocalCollectionsConfigController.tsx
|
|
7
|
+
/**
|
|
8
|
+
* The guess this hook used to make on its own.
|
|
9
|
+
*
|
|
10
|
+
* `process.env.NODE_ENV` here is the *frontend bundle's* build mode. Whether
|
|
11
|
+
* the schema editor exists is decided by a different process entirely — the
|
|
12
|
+
* server's own `NODE_ENV`, its `collectionsDir`, whether its collections were
|
|
13
|
+
* introspected, whether `ts-morph` is installed. The two disagree in every
|
|
14
|
+
* ordinary setup: a dev frontend against a deployed API, a `baas` project, a
|
|
15
|
+
* hosted console. When they did, the editor offered itself and every save came
|
|
16
|
+
* back `404 Not Found`. It is kept only as the answer for a backend too old to
|
|
17
|
+
* be asked.
|
|
18
|
+
*/
|
|
19
|
+
var buildModeGuess = () => process.env.NODE_ENV === "production";
|
|
20
|
+
function useLocalCollectionsConfigController(clientOrUrl, baseCollections = [], options) {
|
|
21
|
+
const parsedCollections = baseCollections;
|
|
22
|
+
const optionsRef = useRef(options);
|
|
23
|
+
optionsRef.current = options;
|
|
24
|
+
const clientBaseUrl = typeof clientOrUrl === "string" ? clientOrUrl : clientOrUrl?.baseUrl ?? "";
|
|
25
|
+
const clientApiPath = typeof clientOrUrl === "object" && clientOrUrl !== null && clientOrUrl.apiPath || DEFAULT_API_PATH;
|
|
26
|
+
const editorUrl = `${String(clientBaseUrl).replace(/\/$/, "")}${clientApiPath}/admin/schema-editor`;
|
|
27
|
+
const resolveToken = async () => {
|
|
28
|
+
let token = optionsRef.current?.getAuthToken ? await optionsRef.current.getAuthToken() : null;
|
|
29
|
+
if (!token && typeof clientOrUrl === "object" && clientOrUrl !== null && clientOrUrl.resolveToken) token = await clientOrUrl.resolveToken();
|
|
30
|
+
return token ?? null;
|
|
31
|
+
};
|
|
32
|
+
const request = async (endpoint, payload) => {
|
|
33
|
+
try {
|
|
34
|
+
const token = await resolveToken();
|
|
35
|
+
const headers = { "Content-Type": "application/json" };
|
|
36
|
+
if (token) headers["Authorization"] = `Bearer ${token}`;
|
|
37
|
+
const response = await fetch(`${editorUrl}${endpoint}`, {
|
|
38
|
+
method: "POST",
|
|
39
|
+
headers,
|
|
40
|
+
body: JSON.stringify(payload)
|
|
41
|
+
});
|
|
42
|
+
if (!response.ok) {
|
|
43
|
+
const text = await response.text();
|
|
44
|
+
let err = {};
|
|
45
|
+
try {
|
|
46
|
+
err = JSON.parse(text);
|
|
47
|
+
} catch (e) {}
|
|
48
|
+
if (Object.keys(err).length === 0) err = { message: text };
|
|
49
|
+
console.error("dev server error payload:", err);
|
|
50
|
+
const errObj = err.error;
|
|
51
|
+
const errMessage = typeof errObj === "object" && errObj !== null ? errObj.message : typeof errObj === "string" ? errObj : err.message;
|
|
52
|
+
throw new Error(errMessage || "Error communicating with local dev server");
|
|
53
|
+
}
|
|
54
|
+
} catch (e) {
|
|
55
|
+
console.error("fetch request failed", e);
|
|
56
|
+
throw e;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const noSchemaAccess = options?.mayReadSchema === false;
|
|
60
|
+
const forcedReadOnly = noSchemaAccess ? true : options?.readOnly;
|
|
61
|
+
const authKey = options?.authKey ?? null;
|
|
62
|
+
const [availability, setAvailability] = useState({ state: "unknown" });
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (forcedReadOnly === true) return;
|
|
65
|
+
let cancelled = false;
|
|
66
|
+
(async () => {
|
|
67
|
+
try {
|
|
68
|
+
const token = await resolveToken();
|
|
69
|
+
const response = await fetch(`${editorUrl}/status`, { headers: token ? { Authorization: `Bearer ${token}` } : {} });
|
|
70
|
+
if (cancelled) return;
|
|
71
|
+
if (response.status === 404) {
|
|
72
|
+
setAvailability({ state: "unknown" });
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const body = await response.json().catch(() => ({}));
|
|
76
|
+
if (cancelled) return;
|
|
77
|
+
if (response.ok) setAvailability({
|
|
78
|
+
state: "known",
|
|
79
|
+
enabled: body.enabled === true,
|
|
80
|
+
reason: body.reason
|
|
81
|
+
});
|
|
82
|
+
else setAvailability({
|
|
83
|
+
state: "known",
|
|
84
|
+
enabled: false,
|
|
85
|
+
reason: body.error?.message ?? `The backend refused to say whether collections are editable (HTTP ${response.status}).`
|
|
86
|
+
});
|
|
87
|
+
} catch {
|
|
88
|
+
if (!cancelled) setAvailability({ state: "unknown" });
|
|
89
|
+
}
|
|
90
|
+
})();
|
|
91
|
+
return () => {
|
|
92
|
+
cancelled = true;
|
|
93
|
+
};
|
|
94
|
+
}, [
|
|
95
|
+
editorUrl,
|
|
96
|
+
forcedReadOnly,
|
|
97
|
+
authKey
|
|
98
|
+
]);
|
|
99
|
+
const liveSchema = useLiveSchemaEditing({
|
|
100
|
+
baseUrl: `${String(clientBaseUrl).replace(/\/$/, "")}${clientApiPath}/admin/schema`,
|
|
101
|
+
getAuthToken: resolveToken,
|
|
102
|
+
authKey,
|
|
103
|
+
enabled: forcedReadOnly !== true
|
|
104
|
+
});
|
|
105
|
+
/**
|
|
106
|
+
* Perform a write, through the live editor when there is one.
|
|
107
|
+
*
|
|
108
|
+
* `sourceOnly` is the write this controller has always done. It stays the
|
|
109
|
+
* whole behaviour on a backend that cannot edit its schema — a bundle
|
|
110
|
+
* deployment, a non-Postgres driver, a version too old to be asked — so
|
|
111
|
+
* nothing about the editor depends on the feature being there.
|
|
112
|
+
*/
|
|
113
|
+
const write = async (collectionId, change) => {
|
|
114
|
+
if ("patch" in change && change.patch.length === 0) return;
|
|
115
|
+
const available = await liveSchema.ready();
|
|
116
|
+
const proposed = {
|
|
117
|
+
collectionId,
|
|
118
|
+
...change
|
|
119
|
+
};
|
|
120
|
+
if (!available.enabled) {
|
|
121
|
+
await request("/collection/save", "patch" in change ? {
|
|
122
|
+
collectionId,
|
|
123
|
+
patch: change.patch
|
|
124
|
+
} : {
|
|
125
|
+
collectionId,
|
|
126
|
+
collectionData: change.collection
|
|
127
|
+
});
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
await liveSchema.reviewChange(proposed);
|
|
131
|
+
};
|
|
132
|
+
const liveEditing = liveSchema.status?.enabled === true;
|
|
133
|
+
const readOnly = forcedReadOnly ?? (liveEditing ? false : availability.state === "known" ? !availability.enabled : buildModeGuess());
|
|
134
|
+
const readOnlyReason = noSchemaAccess || liveEditing ? void 0 : availability.state === "known" && availability.reason ? availability.reason : "Collections can only be edited against a backend running the schema editor, which is off in production.";
|
|
135
|
+
const findCollection = (id) => parsedCollections.find((c) => c.id === id || c.slug === id);
|
|
136
|
+
/**
|
|
137
|
+
* What to send for a collection that should end up as `saving`.
|
|
138
|
+
*
|
|
139
|
+
* For one that exists: the difference from `loaded` — what the person
|
|
140
|
+
* changed — and nothing else. Both sides are the same view model, through
|
|
141
|
+
* JSON, so whatever JSON cannot carry (a handler, a shared property, an
|
|
142
|
+
* imported enum) is absent from both and never appears as a change; the
|
|
143
|
+
* server writes only the keys the patch names. A collection this does not
|
|
144
|
+
* recognise is a new one — a duplicate among them — and is sent whole,
|
|
145
|
+
* with each relation's target as its slug (see `collectionForWire`).
|
|
146
|
+
*/
|
|
147
|
+
const changeFor = (id, saving, loaded) => {
|
|
148
|
+
const current = loaded ?? findCollection(id);
|
|
149
|
+
return current ? { patch: diffCollections(current, saving) } : { collection: collectionForWire(saving) };
|
|
150
|
+
};
|
|
151
|
+
/** `findCollection`, as the record a patch is computed from. */
|
|
152
|
+
const currentOf = (id) => findCollection(id) ?? {};
|
|
153
|
+
return useMemo(() => ({
|
|
154
|
+
loading: false,
|
|
155
|
+
readOnly,
|
|
156
|
+
readOnlyReason,
|
|
157
|
+
collections: parsedCollections,
|
|
158
|
+
dialog: liveSchema.dialog,
|
|
159
|
+
getCollection: (id) => {
|
|
160
|
+
const found = findCollection(id);
|
|
161
|
+
if (found) return found;
|
|
162
|
+
throw Error(`Collection ${id} not found in local mode`);
|
|
163
|
+
},
|
|
164
|
+
saveCollection: async ({ id, collectionData, baseline }) => {
|
|
165
|
+
await write(id, changeFor(id, collectionData, baseline));
|
|
166
|
+
},
|
|
167
|
+
updateCollection: async ({ id, collectionData }) => {
|
|
168
|
+
const current = findCollection(id);
|
|
169
|
+
await write(id, current ? { patch: diffCollections(current, {
|
|
170
|
+
...current,
|
|
171
|
+
...collectionData
|
|
172
|
+
}) } : { collection: collectionForWire(collectionData) });
|
|
173
|
+
},
|
|
174
|
+
deleteCollection: async ({ id }) => {
|
|
175
|
+
if (!(await liveSchema.ready()).enabled) {
|
|
176
|
+
await request("/collection/delete", { collectionId: id });
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
await liveSchema.reviewChange({
|
|
180
|
+
collectionId: id,
|
|
181
|
+
remove: true
|
|
182
|
+
});
|
|
183
|
+
},
|
|
184
|
+
saveProperty: async ({ path, propertyKey, property, newPropertiesOrder }) => {
|
|
185
|
+
const current = currentOf(path);
|
|
186
|
+
await write(path, { patch: diffCollections(current, {
|
|
187
|
+
...current,
|
|
188
|
+
properties: {
|
|
189
|
+
...current.properties ?? {},
|
|
190
|
+
[propertyKey]: property
|
|
191
|
+
},
|
|
192
|
+
...newPropertiesOrder ? { propertiesOrder: newPropertiesOrder } : {}
|
|
193
|
+
}) });
|
|
194
|
+
},
|
|
195
|
+
deleteProperty: async ({ path, propertyKey, newPropertiesOrder }) => {
|
|
196
|
+
const current = currentOf(path);
|
|
197
|
+
const { [propertyKey]: _removed, ...properties } = current.properties ?? {};
|
|
198
|
+
await write(path, { patch: diffCollections(current, {
|
|
199
|
+
...current,
|
|
200
|
+
properties,
|
|
201
|
+
...newPropertiesOrder ? { propertiesOrder: newPropertiesOrder } : {}
|
|
202
|
+
}) });
|
|
203
|
+
},
|
|
204
|
+
updatePropertiesOrder: async ({ collection, fullPath, newPropertiesOrder }) => {
|
|
205
|
+
const collectionId = collection.id || fullPath.split("/").pop() || "";
|
|
206
|
+
const current = currentOf(collectionId);
|
|
207
|
+
await write(collectionId, { patch: diffCollections(current, {
|
|
208
|
+
...current,
|
|
209
|
+
propertiesOrder: newPropertiesOrder
|
|
210
|
+
}) });
|
|
211
|
+
},
|
|
212
|
+
updateKanbanColumnsOrder: async () => {},
|
|
213
|
+
navigationEntries: [],
|
|
214
|
+
saveNavigationEntries: async () => {}
|
|
215
|
+
}), [
|
|
216
|
+
clientOrUrl,
|
|
217
|
+
parsedCollections,
|
|
218
|
+
readOnly,
|
|
219
|
+
readOnlyReason,
|
|
220
|
+
options?.getAuthToken,
|
|
221
|
+
liveSchema.dialog,
|
|
222
|
+
liveSchema.status
|
|
223
|
+
]);
|
|
224
|
+
}
|
|
225
|
+
//#endregion
|
|
226
|
+
export { useLocalCollectionsConfigController };
|
|
227
|
+
|
|
228
|
+
//# sourceMappingURL=useLocalCollectionsConfigController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocalCollectionsConfigController.js","names":[],"sources":["../../src/collection_editor/useLocalCollectionsConfigController.tsx"],"sourcesContent":["import { CollectionsConfigController, SaveCollectionParams, UpdateCollectionParams, DeleteCollectionParams, SavePropertyParams, DeletePropertyParams, UpdatePropertiesOrderParams } from \"./types/config_controller\";\nimport { diffCollections, type CollectionPatch } from \"@rebasepro/types\";\nimport { getSubcollections } from \"@rebasepro/common\";\n\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport type { AdminCollection } from \"@rebasepro/cms-types\";\nimport { DEFAULT_API_PATH } from \"@rebasepro/app\";\nimport { useLiveSchemaEditing } from \"./useLiveSchemaEditing\";\nimport { collectionForWire } from \"./collection_wire\";\n\n/**\n * What the backend said about its schema editor, and how sure we are.\n *\n * `unknown` covers both \"still asking\" and \"could not ask\" — a backend too old\n * to have the endpoint, or one that is unreachable. Those fall back to the\n * build-mode guess below rather than locking the editor for someone whose\n * editor used to work.\n */\ntype SchemaEditorAvailability =\n | { state: \"unknown\" }\n | { state: \"known\", enabled: boolean, reason?: string };\n\n/**\n * The guess this hook used to make on its own.\n *\n * `process.env.NODE_ENV` here is the *frontend bundle's* build mode. Whether\n * the schema editor exists is decided by a different process entirely — the\n * server's own `NODE_ENV`, its `collectionsDir`, whether its collections were\n * introspected, whether `ts-morph` is installed. The two disagree in every\n * ordinary setup: a dev frontend against a deployed API, a `baas` project, a\n * hosted console. When they did, the editor offered itself and every save came\n * back `404 Not Found`. It is kept only as the answer for a backend too old to\n * be asked.\n */\nconst buildModeGuess = (): boolean => process.env.NODE_ENV === \"production\";\n\nexport function useLocalCollectionsConfigController(\n clientOrUrl: any,\n baseCollections: AdminCollection[] = [],\n options?: {\n readOnly?: boolean;\n getAuthToken?: () => Promise<string | null>;\n /**\n * Identity of the signed-in user, if any.\n *\n * Only used to re-ask the backend when it changes: whether the editor\n * will accept a write depends on who is asking, and the answer to an\n * anonymous probe does not survive a sign-in.\n */\n authKey?: string | null;\n /**\n * Whether the signed-in user holds `schema:read`, which both\n * status routes require. `false` asks neither and leaves the editor\n * read-only, because a 403 is the only answer such a user can get.\n * Absent means ask.\n */\n mayReadSchema?: boolean;\n }\n): CollectionsConfigController {\n\n const parsedCollections = baseCollections;\n\n // Store latest options in a ref to prevent stale closures in the `request` function\n // due to useMemo caching the saveCollection function.\n const optionsRef = useRef(options);\n optionsRef.current = options;\n\n // `/api` only by default — a backend configured with another `basePath`\n // mounts the schema editor under that instead.\n const clientBaseUrl = typeof clientOrUrl === \"string\"\n ? clientOrUrl\n : (clientOrUrl?.baseUrl ?? \"\");\n const clientApiPath = (typeof clientOrUrl === \"object\" && clientOrUrl !== null && clientOrUrl.apiPath)\n || DEFAULT_API_PATH;\n const editorUrl = `${String(clientBaseUrl).replace(/\\/$/, \"\")}${clientApiPath}/admin/schema-editor`;\n\n const resolveToken = async (): Promise<string | null> => {\n let token = optionsRef.current?.getAuthToken ? await optionsRef.current.getAuthToken() : null;\n if (!token && typeof clientOrUrl === \"object\" && clientOrUrl !== null && clientOrUrl.resolveToken) {\n token = await clientOrUrl.resolveToken();\n }\n return token ?? null;\n };\n\n const request = async (endpoint: string, payload: Record<string, unknown>) => {\n try {\n const token = await resolveToken();\n\n const headers: Record<string, string> = { \"Content-Type\": \"application/json\" };\n if (token) {\n headers[\"Authorization\"] = `Bearer ${token}`;\n }\n\n const response = await fetch(`${editorUrl}${endpoint}`, {\n method: \"POST\",\n headers,\n body: JSON.stringify(payload)\n });\n if (!response.ok) {\n const text = await response.text();\n let err: Record<string, unknown> = {};\n try {\n err = JSON.parse(text);\n } catch (e) {\n // ignore json parse error\n }\n\n if (Object.keys(err).length === 0) {\n err = { message: text };\n }\n console.error(\"dev server error payload:\", err);\n const errObj = err.error as Record<string, unknown> | string | undefined;\n const errMessage = typeof errObj === \"object\" && errObj !== null\n ? (errObj.message as string)\n : (typeof errObj === \"string\" ? errObj : (err.message as string | undefined));\n throw new Error(errMessage || \"Error communicating with local dev server\");\n }\n } catch (e) {\n console.error(\"fetch request failed\", e);\n throw e;\n }\n };\n\n // ── Ask the backend whether it will accept an edit ────────────────\n const noSchemaAccess = options?.mayReadSchema === false;\n const forcedReadOnly = noSchemaAccess ? true : options?.readOnly;\n const authKey = options?.authKey ?? null;\n const [availability, setAvailability] = useState<SchemaEditorAvailability>({ state: \"unknown\" });\n\n useEffect(() => {\n // Nothing to ask about: the caller has already decided.\n if (forcedReadOnly === true) return;\n\n let cancelled = false;\n (async () => {\n try {\n const token = await resolveToken();\n const response = await fetch(`${editorUrl}/status`, {\n headers: token ? { Authorization: `Bearer ${token}` } : {}\n });\n if (cancelled) return;\n\n // A backend from before the endpoint existed. Guessing from the\n // bundle's build mode is wrong, but it is what that backend's\n // admin panel has always done, and locking the editor for\n // someone whose editor works would be worse.\n if (response.status === 404) {\n setAvailability({ state: \"unknown\" });\n return;\n }\n\n const body = await response.json().catch(() => ({})) as {\n enabled?: boolean,\n reason?: string,\n error?: { message?: string }\n };\n if (cancelled) return;\n\n if (response.ok) {\n setAvailability({\n state: \"known\",\n enabled: body.enabled === true,\n reason: body.reason\n });\n } else {\n // 401/403 (not an admin) or 501 (no auth configured at all)\n // — all of them mean this session cannot edit collections,\n // and the body says why better than we could.\n setAvailability({\n state: \"known\",\n enabled: false,\n reason: body.error?.message\n ?? `The backend refused to say whether collections are editable (HTTP ${response.status}).`\n });\n }\n } catch {\n if (!cancelled) setAvailability({ state: \"unknown\" });\n }\n })();\n\n return () => { cancelled = true; };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [editorUrl, forcedReadOnly, authKey]);\n\n // ── Live schema editing ───────────────────────────────────────────\n // The same edit, against a backend that can also change the database and\n // commit the result. When it is available, a save is planned and shown\n // before anything happens; when it is not, this is inert and writes go\n // straight to the source-only editor exactly as before.\n const liveSchema = useLiveSchemaEditing({\n baseUrl: `${String(clientBaseUrl).replace(/\\/$/, \"\")}${clientApiPath}/admin/schema`,\n getAuthToken: resolveToken,\n authKey,\n // A read-only editor writes nothing, so there is nothing to ask.\n enabled: forcedReadOnly !== true\n });\n\n /**\n * Perform a write, through the live editor when there is one.\n *\n * `sourceOnly` is the write this controller has always done. It stays the\n * whole behaviour on a backend that cannot edit its schema — a bundle\n * deployment, a non-Postgres driver, a version too old to be asked — so\n * nothing about the editor depends on the feature being there.\n */\n const write = async (\n collectionId: string,\n change: { collection: Record<string, unknown> } | { patch: CollectionPatch }\n ): Promise<void> => {\n // Nothing changed: nothing to plan, commit or write.\n if (\"patch\" in change && change.patch.length === 0) return;\n // `ready()`, not `status` — the rendered status is undefined for one\n // round trip after mount, so reading it here would send a save issued\n // in that window down the source-only path with no confirmation, while\n // the same save a second later would open a dialog. One round trip is\n // cheap; behaviour that depends on how fast somebody clicked is not.\n const available = await liveSchema.ready();\n const proposed = { collectionId, ...change };\n if (!available.enabled) {\n await request(\"/collection/save\", \"patch\" in change\n ? { collectionId, patch: change.patch }\n : { collectionId, collectionData: change.collection });\n return;\n }\n await liveSchema.reviewChange(proposed);\n };\n\n // Live schema editing, when it is on, is where every write goes (`write`\n // above), so the source-only editor's answer does not lock the editor\n // then. That is the case of a bundle with `REBASE_LIVE_SCHEMA_REPOSITORY`:\n // it has no source of its own, so its source-only editor is off, and its\n // writes are committed to the repository instead.\n const liveEditing = liveSchema.status?.enabled === true;\n const readOnly = forcedReadOnly\n ?? (liveEditing ? false : availability.state === \"known\" ? !availability.enabled : buildModeGuess());\n\n // No reason of our own for a user without schema access. Each surface\n // has a generic \"editing is disabled\" for that, and the user's scopes may\n // still be loading, so a specific reason could be wrong.\n const readOnlyReason = noSchemaAccess || liveEditing\n ? undefined\n : availability.state === \"known\" && availability.reason\n ? availability.reason\n : \"Collections can only be edited against a backend running the schema editor, which is off in production.\";\n\n const findCollection = (id: string): AdminCollection | undefined =>\n parsedCollections.find(c => (c as AdminCollection & { id?: string }).id === id || c.slug === id);\n\n /**\n * What to send for a collection that should end up as `saving`.\n *\n * For one that exists: the difference from `loaded` — what the person\n * changed — and nothing else. Both sides are the same view model, through\n * JSON, so whatever JSON cannot carry (a handler, a shared property, an\n * imported enum) is absent from both and never appears as a change; the\n * server writes only the keys the patch names. A collection this does not\n * recognise is a new one — a duplicate among them — and is sent whole,\n * with each relation's target as its slug (see `collectionForWire`).\n */\n const changeFor = (\n id: string,\n saving: Record<string, unknown>,\n loaded?: Record<string, unknown>\n ): { collection: Record<string, unknown> } | { patch: CollectionPatch } => {\n const current = loaded ?? findCollection(id) as Record<string, unknown> | undefined;\n return current\n ? { patch: diffCollections(current, saving) }\n : { collection: collectionForWire(saving) };\n };\n\n /** `findCollection`, as the record a patch is computed from. */\n const currentOf = (id: string): Record<string, unknown> =>\n (findCollection(id) as Record<string, unknown> | undefined) ?? {};\n\n return useMemo(() => ({\n loading: false,\n readOnly,\n readOnlyReason,\n collections: parsedCollections,\n dialog: liveSchema.dialog,\n getCollection: (id: string) => {\n const found = findCollection(id);\n if (found) return found;\n throw Error(`Collection ${id} not found in local mode`);\n },\n\n saveCollection: async ({ id, collectionData, baseline }: SaveCollectionParams) => {\n await write(id, changeFor(\n id,\n collectionData as Record<string, unknown>,\n baseline as Record<string, unknown> | undefined\n ));\n },\n // `collectionData` is a partial: the keys it names, set over the\n // collection as it is.\n updateCollection: async ({ id, collectionData }: UpdateCollectionParams) => {\n const current = findCollection(id) as Record<string, unknown> | undefined;\n await write(id, current\n ? { patch: diffCollections(current, { ...current, ...(collectionData as Record<string, unknown>) }) }\n : { collection: collectionForWire(collectionData as Record<string, unknown>) });\n },\n // Through the live door when there is one: planned (the table and its\n // rows stay, and the plan says so) and committed source-only, with the\n // collection's entry in `index.ts` removed alongside the file. It used\n // to unlink the file and nothing else, which stopped the project from\n // loading its collections and was never committed.\n deleteCollection: async ({ id }: DeleteCollectionParams) => {\n const available = await liveSchema.ready();\n if (!available.enabled) {\n await request(\"/collection/delete\", { collectionId: id });\n return;\n }\n await liveSchema.reviewChange({ collectionId: id, remove: true });\n },\n\n // Every write below is the difference between the collection as it is\n // and as it should end up, through the same door as the editor's own\n // save: planned and confirmed when live editing is on, written as a\n // patch when it is not.\n saveProperty: async ({ path, propertyKey, property, newPropertiesOrder }: SavePropertyParams) => {\n const current = currentOf(path);\n await write(path, { patch: diffCollections(current, {\n ...current,\n properties: { ...(current.properties as Record<string, unknown> | undefined ?? {}), [propertyKey]: property },\n ...(newPropertiesOrder ? { propertiesOrder: newPropertiesOrder } : {})\n }) });\n },\n deleteProperty: async ({ path, propertyKey, newPropertiesOrder }: DeletePropertyParams) => {\n const current = currentOf(path);\n const { [propertyKey]: _removed, ...properties } = (current.properties as Record<string, unknown> | undefined) ?? {};\n await write(path, { patch: diffCollections(current, {\n ...current,\n properties,\n ...(newPropertiesOrder ? { propertiesOrder: newPropertiesOrder } : {})\n }) });\n },\n\n updatePropertiesOrder: async ({ collection, fullPath, newPropertiesOrder }: UpdatePropertiesOrderParams) => {\n const collectionId = (collection as AdminCollection & { id?: string }).id || fullPath.split(\"/\").pop() || \"\";\n const current = currentOf(collectionId);\n await write(collectionId, { patch: diffCollections(current, { ...current, propertiesOrder: newPropertiesOrder }) });\n },\n updateKanbanColumnsOrder: async () => {\n // Kanban order mapping logic can be added later if needed natively.\n },\n\n navigationEntries: [],\n saveNavigationEntries: async () => { }\n // `liveSchema.dialog` and `liveSchema.status` both change as the flow\n // runs — a plan arrives, a dialog opens — and a controller memoised\n // without them would keep handing back a closed dialog and a stale\n // answer about whether the backend can edit its schema at all.\n //\n // `write`, `request`, `findCollection`, `changeFor` and `currentOf` are\n // rebuilt on every render, so listing them would defeat the memo\n // entirely. Each is already covered *transitively* by what is listed:\n // `request` closes over `editorUrl` and a ref, and `editorUrl` derives\n // from `clientOrUrl`; `findCollection`, `changeFor` and `currentOf` close over\n // `parsedCollections`; `write` closes over `liveSchema.status` and\n // `liveSchema.reviewChange`, and the latter is a `useCallback` keyed on\n // a client built from `clientOrUrl`. Every input that can change is in\n // the array under the name it actually varies with.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }), [\n clientOrUrl,\n parsedCollections,\n readOnly,\n readOnlyReason,\n options?.getAuthToken,\n liveSchema.dialog,\n liveSch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gB,SAAS;IAAE,GAAG;IAAS,iBAAiB;GAAmB,CAAC,EAAE,CAAC;EACtH;EACA,0BAA0B,YAAY,CAEtC;EAEA,mBAAmB,CAAC;EACpB,uBAAuB,YAAY,CAAE;CAgBzC,IAAI;EACA;EACA;EACA;EACA;EACA,SAAS;EACT,WAAW;EACX,WAAW;CACf,CAAC;AACL"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useSnackbarController } from "@rebasepro/app";
|
|
2
|
+
//#region src/collection_editor/useSafeSnackbarController.ts
|
|
3
|
+
function useSafeSnackbarController() {
|
|
4
|
+
try {
|
|
5
|
+
return useSnackbarController();
|
|
6
|
+
} catch {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { useSafeSnackbarController };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=useSafeSnackbarController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSafeSnackbarController.js","names":[],"sources":["../../src/collection_editor/useSafeSnackbarController.ts"],"sourcesContent":["import { useSnackbarController } from \"@rebasepro/app\";\n\nexport function useSafeSnackbarController(): ReturnType<typeof useSnackbarController> | undefined {\n try {\n return useSnackbarController();\n } catch {\n return undefined;\n }\n}\n"],"mappings":";;AAEA,SAAgB,4BAAkF;CAC9F,IAAI;EACA,OAAO,sBAAsB;CACjC,QAAQ;EACJ;CACJ;AACJ"}
|