@rebasepro/studio 0.0.1-canary.09e5ec5
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/LICENSE +114 -0
- package/README.md +159 -0
- package/dist/ApiExplorer-gMJt5JrS.js +1053 -0
- package/dist/ApiExplorer-gMJt5JrS.js.map +1 -0
- package/dist/AuthSimulationSelector-BF4rkRGp.js +118 -0
- package/dist/AuthSimulationSelector-BF4rkRGp.js.map +1 -0
- package/dist/BranchesView-DcHZtvXo.js +292 -0
- package/dist/BranchesView-DcHZtvXo.js.map +1 -0
- package/dist/CronJobsView-CijCToeK.js +456 -0
- package/dist/CronJobsView-CijCToeK.js.map +1 -0
- package/dist/JSEditor-D8nVp3Lp.js +1308 -0
- package/dist/JSEditor-D8nVp3Lp.js.map +1 -0
- package/dist/MonacoEditor-CMYEjiRf.js +161 -0
- package/dist/MonacoEditor-CMYEjiRf.js.map +1 -0
- package/dist/RLSEditor-DBH09u9v.js +1831 -0
- package/dist/RLSEditor-DBH09u9v.js.map +1 -0
- package/dist/SQLEditor-CkVx9vgr.js +1792 -0
- package/dist/SQLEditor-CkVx9vgr.js.map +1 -0
- package/dist/SchemaVisualizer-BgD5Zb77.js +1069 -0
- package/dist/SchemaVisualizer-BgD5Zb77.js.map +1 -0
- package/dist/StorageView-CTqGFhY9.js +907 -0
- package/dist/StorageView-CTqGFhY9.js.map +1 -0
- package/dist/common/src/collections/CollectionRegistry.d.ts +56 -0
- package/dist/common/src/collections/index.d.ts +1 -0
- package/dist/common/src/data/buildRebaseData.d.ts +14 -0
- package/dist/common/src/index.d.ts +3 -0
- package/dist/common/src/util/builders.d.ts +57 -0
- package/dist/common/src/util/callbacks.d.ts +6 -0
- package/dist/common/src/util/collections.d.ts +11 -0
- package/dist/common/src/util/common.d.ts +2 -0
- package/dist/common/src/util/conditions.d.ts +26 -0
- package/dist/common/src/util/entities.d.ts +58 -0
- package/dist/common/src/util/enums.d.ts +3 -0
- package/dist/common/src/util/index.d.ts +16 -0
- package/dist/common/src/util/navigation_from_path.d.ts +34 -0
- package/dist/common/src/util/navigation_utils.d.ts +20 -0
- package/dist/common/src/util/parent_references_from_path.d.ts +6 -0
- package/dist/common/src/util/paths.d.ts +14 -0
- package/dist/common/src/util/permissions.d.ts +5 -0
- package/dist/common/src/util/references.d.ts +2 -0
- package/dist/common/src/util/relations.d.ts +22 -0
- package/dist/common/src/util/resolutions.d.ts +72 -0
- package/dist/common/src/util/storage.d.ts +24 -0
- package/dist/core/src/components/AIIcon.d.ts +16 -0
- package/dist/core/src/components/ConfirmationDialog.d.ts +9 -0
- package/dist/core/src/components/Debug/UIReferenceView.d.ts +1 -0
- package/dist/core/src/components/Debug/UIStyleGuide.d.ts +1 -0
- package/dist/core/src/components/ErrorTooltip.d.ts +2 -0
- package/dist/core/src/components/ErrorView.d.ts +21 -0
- package/dist/core/src/components/LanguageToggle.d.ts +1 -0
- package/dist/core/src/components/LoginView/LoginView.d.ts +68 -0
- package/dist/core/src/components/LoginView/index.d.ts +2 -0
- package/dist/core/src/components/NotFoundPage.d.ts +1 -0
- package/dist/core/src/components/RebaseAuth.d.ts +10 -0
- package/dist/core/src/components/RebaseLogo.d.ts +7 -0
- package/dist/core/src/components/UnsavedChangesDialog.d.ts +9 -0
- package/dist/core/src/components/UserDisplay.d.ts +7 -0
- package/dist/core/src/components/UserSelectPopover.d.ts +62 -0
- package/dist/core/src/components/UserSettingsView.d.ts +1 -0
- package/dist/core/src/components/common/index.d.ts +6 -0
- package/dist/core/src/components/common/table_height.d.ts +5 -0
- package/dist/core/src/components/common/types.d.ts +63 -0
- package/dist/core/src/components/common/useColumnsIds.d.ts +9 -0
- package/dist/core/src/components/common/useDataTableController.d.ts +45 -0
- package/dist/core/src/components/common/useDebouncedData.d.ts +9 -0
- package/dist/core/src/components/common/useScrollRestoration.d.ts +14 -0
- package/dist/core/src/components/index.d.ts +16 -0
- package/dist/core/src/contexts/AdminModeController.d.ts +4 -0
- package/dist/core/src/contexts/AnalyticsContext.d.ts +3 -0
- package/dist/core/src/contexts/AuthControllerContext.d.ts +3 -0
- package/dist/core/src/contexts/CustomizationControllerContext.d.ts +3 -0
- package/dist/core/src/contexts/DataDriverContext.d.ts +3 -0
- package/dist/core/src/contexts/DatabaseAdminContext.d.ts +3 -0
- package/dist/core/src/contexts/DialogsProvider.d.ts +4 -0
- package/dist/core/src/contexts/EffectiveRoleController.d.ts +4 -0
- package/dist/core/src/contexts/InternalUserManagementContext.d.ts +3 -0
- package/dist/core/src/contexts/ModeController.d.ts +4 -0
- package/dist/core/src/contexts/RebaseClientInstanceContext.d.ts +6 -0
- package/dist/core/src/contexts/RebaseDataContext.d.ts +3 -0
- package/dist/core/src/contexts/SnackbarProvider.d.ts +2 -0
- package/dist/core/src/contexts/StorageSourceContext.d.ts +3 -0
- package/dist/core/src/contexts/UserConfigurationPersistenceContext.d.ts +3 -0
- package/dist/core/src/contexts/index.d.ts +13 -0
- package/dist/core/src/core/PluginLifecycleManager.d.ts +17 -0
- package/dist/core/src/core/PluginProviderStack.d.ts +21 -0
- package/dist/core/src/core/Rebase.d.ts +14 -0
- package/dist/core/src/core/RebaseProps.d.ts +136 -0
- package/dist/core/src/core/RebaseRouter.d.ts +4 -0
- package/dist/core/src/core/RebaseRoutes.d.ts +17 -0
- package/dist/core/src/core/index.d.ts +4 -0
- package/dist/core/src/hooks/ApiConfigContext.d.ts +24 -0
- package/dist/core/src/hooks/data/delete.d.ts +31 -0
- package/dist/core/src/hooks/data/save.d.ts +34 -0
- package/dist/core/src/hooks/data/useCollectionFetch.d.ts +51 -0
- package/dist/core/src/hooks/data/useData.d.ts +13 -0
- package/dist/core/src/hooks/data/useDataOrder.d.ts +12 -0
- package/dist/core/src/hooks/data/useEntityFetch.d.ts +38 -0
- package/dist/core/src/hooks/data/useRelationSelector.d.ts +52 -0
- package/dist/core/src/hooks/data/useUserSelector.d.ts +31 -0
- package/dist/core/src/hooks/index.d.ts +37 -0
- package/dist/core/src/hooks/useAdminModeController.d.ts +19 -0
- package/dist/core/src/hooks/useAnalyticsController.d.ts +5 -0
- package/dist/core/src/hooks/useAuthController.d.ts +11 -0
- package/dist/core/src/hooks/useAuthSubscription.d.ts +2 -0
- package/dist/core/src/hooks/useBackendStorageSource.d.ts +30 -0
- package/dist/core/src/hooks/useBridgeRegistration.d.ts +18 -0
- package/dist/core/src/hooks/useBrowserTitleAndIcon.d.ts +6 -0
- package/dist/core/src/hooks/useBuildAdminModeController.d.ts +6 -0
- package/dist/core/src/hooks/useBuildEffectiveRoleController.d.ts +8 -0
- package/dist/core/src/hooks/useBuildLocalConfigurationPersistence.d.ts +2 -0
- package/dist/core/src/hooks/useBuildModeController.d.ts +6 -0
- package/dist/core/src/hooks/useClipboard.d.ts +57 -0
- package/dist/core/src/hooks/useCollapsedGroups.d.ts +12 -0
- package/dist/core/src/hooks/useCustomizationController.d.ts +11 -0
- package/dist/core/src/hooks/useDialogsController.d.ts +11 -0
- package/dist/core/src/hooks/useEffectiveRoleController.d.ts +7 -0
- package/dist/core/src/hooks/useInternalUserManagementController.d.ts +12 -0
- package/dist/core/src/hooks/useLargeLayout.d.ts +1 -0
- package/dist/core/src/hooks/useModeController.d.ts +19 -0
- package/dist/core/src/hooks/usePermissions.d.ts +12 -0
- package/dist/core/src/hooks/useRebaseClient.d.ts +5 -0
- package/dist/core/src/hooks/useRebaseContext.d.ts +11 -0
- package/dist/core/src/hooks/useRebaseRegistry.d.ts +34 -0
- package/dist/core/src/hooks/useSlot.d.ts +18 -0
- package/dist/core/src/hooks/useSnackbarController.d.ts +20 -0
- package/dist/core/src/hooks/useStorageSource.d.ts +7 -0
- package/dist/core/src/hooks/useStudioBridge.d.ts +91 -0
- package/dist/core/src/hooks/useTranslation.d.ts +17 -0
- package/dist/core/src/hooks/useUnsavedChangesDialog.d.ts +12 -0
- package/dist/core/src/hooks/useUserConfigurationPersistence.d.ts +8 -0
- package/dist/core/src/hooks/useValidateAuthenticator.d.ts +21 -0
- package/dist/core/src/i18n/RebaseI18nProvider.d.ts +33 -0
- package/dist/core/src/index.d.ts +15 -0
- package/dist/core/src/internal/common.d.ts +3 -0
- package/dist/core/src/internal/useRestoreScroll.d.ts +6 -0
- package/dist/core/src/locales/de.d.ts +2 -0
- package/dist/core/src/locales/en.d.ts +10 -0
- package/dist/core/src/locales/es.d.ts +10 -0
- package/dist/core/src/locales/fr.d.ts +2 -0
- package/dist/core/src/locales/hi.d.ts +2 -0
- package/dist/core/src/locales/it.d.ts +2 -0
- package/dist/core/src/locales/pt.d.ts +7 -0
- package/dist/core/src/util/constants.d.ts +1 -0
- package/dist/core/src/util/createFormexStub.d.ts +2 -0
- package/dist/core/src/util/entity_cache.d.ts +27 -0
- package/dist/core/src/util/enums.d.ts +5 -0
- package/dist/core/src/util/icon_list.d.ts +5 -0
- package/dist/core/src/util/icon_synonyms.d.ts +1 -0
- package/dist/core/src/util/icons.d.ts +20 -0
- package/dist/core/src/util/index.d.ts +10 -0
- package/dist/core/src/util/previews.d.ts +4 -0
- package/dist/core/src/util/useStorageUploadController.d.ts +38 -0
- package/dist/core/src/util/useTraceUpdate.d.ts +2 -0
- package/dist/formex/src/Field.d.ts +52 -0
- package/dist/formex/src/Formex.d.ts +7 -0
- package/dist/formex/src/index.d.ts +5 -0
- package/dist/formex/src/types.d.ts +40 -0
- package/dist/formex/src/useCreateFormex.d.ts +14 -0
- package/dist/formex/src/utils.d.ts +16 -0
- package/dist/index.es.js +726 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +9647 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/studio/src/components/ApiExplorer/ApiExplorer.d.ts +9 -0
- package/dist/studio/src/components/ApiExplorer/EndpointDetail.d.ts +9 -0
- package/dist/studio/src/components/ApiExplorer/TryItPanel.d.ts +15 -0
- package/dist/studio/src/components/ApiExplorer/parseSpec.d.ts +16 -0
- package/dist/studio/src/components/ApiExplorer/types.d.ts +90 -0
- package/dist/studio/src/components/AuthSimulationSelector.d.ts +11 -0
- package/dist/studio/src/components/Branches/BranchesView.d.ts +1 -0
- package/dist/studio/src/components/CronJobs/CronJobsView.d.ts +1 -0
- package/dist/studio/src/components/JSEditor/JSEditor.d.ts +1 -0
- package/dist/studio/src/components/JSEditor/JSEditorSidebar.d.ts +21 -0
- package/dist/studio/src/components/JSEditor/JSMonacoEditor.d.ts +18 -0
- package/dist/studio/src/components/RLSEditor/PolicyEditor.d.ts +9 -0
- package/dist/studio/src/components/RLSEditor/RLSEditor.d.ts +19 -0
- package/dist/studio/src/components/RLSEditor/index.d.ts +1 -0
- package/dist/studio/src/components/RebaseStudio.d.ts +2 -0
- package/dist/studio/src/components/SQLEditor/ExplainVisualizer.d.ts +24 -0
- package/dist/studio/src/components/SQLEditor/MonacoEditor.d.ts +17 -0
- package/dist/studio/src/components/SQLEditor/SQLEditor.d.ts +11 -0
- package/dist/studio/src/components/SQLEditor/SQLEditorSidebar.d.ts +21 -0
- package/dist/studio/src/components/SQLEditor/SchemaBrowser.d.ts +8 -0
- package/dist/studio/src/components/SchemaVisualizer/RelationEdge.d.ts +3 -0
- package/dist/studio/src/components/SchemaVisualizer/SchemaVisualizer.d.ts +2 -0
- package/dist/studio/src/components/SchemaVisualizer/TableNode.d.ts +3 -0
- package/dist/studio/src/components/SchemaVisualizer/index.d.ts +5 -0
- package/dist/studio/src/components/SchemaVisualizer/schema-visualizer.utils.d.ts +42 -0
- package/dist/studio/src/components/SchemaVisualizer/useSchemaGraph.d.ts +37 -0
- package/dist/studio/src/components/StorageView/StorageView.d.ts +1 -0
- package/dist/studio/src/components/StudioHomePage.d.ts +9 -0
- package/dist/studio/src/index.d.ts +4 -0
- package/dist/studio/src/utils/entities.d.ts +0 -0
- package/dist/studio/src/utils/pgColumnToProperty.d.ts +6 -0
- package/dist/studio/src/utils/sql_utils.d.ts +52 -0
- package/dist/types/src/controllers/analytics_controller.d.ts +7 -0
- package/dist/types/src/controllers/auth.d.ts +119 -0
- package/dist/types/src/controllers/client.d.ts +170 -0
- package/dist/types/src/controllers/collection_registry.d.ts +45 -0
- package/dist/types/src/controllers/customization_controller.d.ts +60 -0
- package/dist/types/src/controllers/data.d.ts +168 -0
- package/dist/types/src/controllers/data_driver.d.ts +160 -0
- package/dist/types/src/controllers/database_admin.d.ts +11 -0
- package/dist/types/src/controllers/dialogs_controller.d.ts +36 -0
- package/dist/types/src/controllers/effective_role.d.ts +4 -0
- package/dist/types/src/controllers/email.d.ts +34 -0
- package/dist/types/src/controllers/index.d.ts +18 -0
- package/dist/types/src/controllers/local_config_persistence.d.ts +20 -0
- package/dist/types/src/controllers/navigation.d.ts +213 -0
- package/dist/types/src/controllers/registry.d.ts +54 -0
- package/dist/types/src/controllers/side_dialogs_controller.d.ts +67 -0
- package/dist/types/src/controllers/side_entity_controller.d.ts +90 -0
- package/dist/types/src/controllers/snackbar.d.ts +24 -0
- package/dist/types/src/controllers/storage.d.ts +171 -0
- package/dist/types/src/index.d.ts +4 -0
- package/dist/types/src/rebase_context.d.ts +105 -0
- package/dist/types/src/types/backend.d.ts +536 -0
- package/dist/types/src/types/builders.d.ts +15 -0
- package/dist/types/src/types/chips.d.ts +5 -0
- package/dist/types/src/types/collections.d.ts +856 -0
- package/dist/types/src/types/cron.d.ts +102 -0
- package/dist/types/src/types/data_source.d.ts +64 -0
- package/dist/types/src/types/entities.d.ts +145 -0
- package/dist/types/src/types/entity_actions.d.ts +98 -0
- package/dist/types/src/types/entity_callbacks.d.ts +173 -0
- package/dist/types/src/types/entity_link_builder.d.ts +7 -0
- package/dist/types/src/types/entity_overrides.d.ts +10 -0
- package/dist/types/src/types/entity_views.d.ts +61 -0
- package/dist/types/src/types/export_import.d.ts +21 -0
- package/dist/types/src/types/index.d.ts +23 -0
- package/dist/types/src/types/locales.d.ts +4 -0
- package/dist/types/src/types/modify_collections.d.ts +5 -0
- package/dist/types/src/types/plugins.d.ts +279 -0
- package/dist/types/src/types/properties.d.ts +1176 -0
- package/dist/types/src/types/property_config.d.ts +70 -0
- package/dist/types/src/types/relations.d.ts +336 -0
- package/dist/types/src/types/slots.d.ts +252 -0
- package/dist/types/src/types/translations.d.ts +870 -0
- package/dist/types/src/types/user_management_delegate.d.ts +121 -0
- package/dist/types/src/types/websockets.d.ts +78 -0
- package/dist/types/src/users/index.d.ts +2 -0
- package/dist/types/src/users/roles.d.ts +22 -0
- package/dist/types/src/users/user.d.ts +46 -0
- package/dist/ui/src/components/Alert.d.ts +12 -0
- package/dist/ui/src/components/Autocomplete.d.ts +21 -0
- package/dist/ui/src/components/Avatar.d.ts +11 -0
- package/dist/ui/src/components/Badge.d.ts +8 -0
- package/dist/ui/src/components/BooleanSwitch.d.ts +14 -0
- package/dist/ui/src/components/BooleanSwitchWithLabel.d.ts +17 -0
- package/dist/ui/src/components/Button.d.ts +14 -0
- package/dist/ui/src/components/Card.d.ts +9 -0
- package/dist/ui/src/components/CenteredView.d.ts +9 -0
- package/dist/ui/src/components/Checkbox.d.ts +13 -0
- package/dist/ui/src/components/Chip.d.ts +26 -0
- package/dist/ui/src/components/CircularProgress.d.ts +5 -0
- package/dist/ui/src/components/CircularProgressCenter.d.ts +11 -0
- package/dist/ui/src/components/Collapse.d.ts +9 -0
- package/dist/ui/src/components/ColorPicker.d.ts +30 -0
- package/dist/ui/src/components/Container.d.ts +8 -0
- package/dist/ui/src/components/DateTimeField.d.ts +24 -0
- package/dist/ui/src/components/DebouncedTextField.d.ts +2 -0
- package/dist/ui/src/components/Dialog.d.ts +39 -0
- package/dist/ui/src/components/DialogActions.d.ts +7 -0
- package/dist/ui/src/components/DialogContent.d.ts +7 -0
- package/dist/ui/src/components/DialogTitle.d.ts +10 -0
- package/dist/ui/src/components/ErrorBoundary.d.ts +11 -0
- package/dist/ui/src/components/ExpandablePanel.d.ts +12 -0
- package/dist/ui/src/components/FileUpload.d.ts +23 -0
- package/dist/ui/src/components/IconButton.d.ts +12 -0
- package/dist/ui/src/components/InfoLabel.d.ts +5 -0
- package/dist/ui/src/components/InputLabel.d.ts +11 -0
- package/dist/ui/src/components/Label.d.ts +7 -0
- package/dist/ui/src/components/LoadingButton.d.ts +7 -0
- package/dist/ui/src/components/Markdown.d.ts +10 -0
- package/dist/ui/src/components/Menu.d.ts +23 -0
- package/dist/ui/src/components/Menubar.d.ts +80 -0
- package/dist/ui/src/components/MultiSelect.d.ts +48 -0
- package/dist/ui/src/components/Paper.d.ts +6 -0
- package/dist/ui/src/components/Popover.d.ts +24 -0
- package/dist/ui/src/components/RadioGroup.d.ts +28 -0
- package/dist/ui/src/components/ResizablePanels.d.ts +18 -0
- package/dist/ui/src/components/SearchBar.d.ts +22 -0
- package/dist/ui/src/components/Select.d.ts +43 -0
- package/dist/ui/src/components/Separator.d.ts +5 -0
- package/dist/ui/src/components/Sheet.d.ts +22 -0
- package/dist/ui/src/components/Skeleton.d.ts +6 -0
- package/dist/ui/src/components/Slider.d.ts +21 -0
- package/dist/ui/src/components/Table.d.ts +34 -0
- package/dist/ui/src/components/Tabs.d.ts +19 -0
- package/dist/ui/src/components/TextField.d.ts +58 -0
- package/dist/ui/src/components/TextareaAutosize.d.ts +43 -0
- package/dist/ui/src/components/ToggleButtonGroup.d.ts +30 -0
- package/dist/ui/src/components/Tooltip.d.ts +19 -0
- package/dist/ui/src/components/Typography.d.ts +36 -0
- package/dist/ui/src/components/VirtualTable/VirtualTable.d.ts +11 -0
- package/dist/ui/src/components/VirtualTable/VirtualTableCell.d.ts +21 -0
- package/dist/ui/src/components/VirtualTable/VirtualTableHeader.d.ts +29 -0
- package/dist/ui/src/components/VirtualTable/VirtualTableHeaderRow.d.ts +2 -0
- package/dist/ui/src/components/VirtualTable/VirtualTableProps.d.ts +243 -0
- package/dist/ui/src/components/VirtualTable/VirtualTableRow.d.ts +3 -0
- package/dist/ui/src/components/VirtualTable/index.d.ts +3 -0
- package/dist/ui/src/components/VirtualTable/types.d.ts +38 -0
- package/dist/ui/src/components/common/SelectInputLabel.d.ts +5 -0
- package/dist/ui/src/components/index.d.ts +53 -0
- package/dist/ui/src/hooks/PortalContainerContext.d.ts +31 -0
- package/dist/ui/src/hooks/index.d.ts +6 -0
- package/dist/ui/src/hooks/useDebounceCallback.d.ts +1 -0
- package/dist/ui/src/hooks/useDebounceValue.d.ts +1 -0
- package/dist/ui/src/hooks/useDebouncedCallback.d.ts +1 -0
- package/dist/ui/src/hooks/useInjectStyles.d.ts +7 -0
- package/dist/ui/src/hooks/useOutsideAlerter.d.ts +5 -0
- package/dist/ui/src/icons/GitHubIcon.d.ts +2 -0
- package/dist/ui/src/icons/HandleIcon.d.ts +1 -0
- package/dist/ui/src/icons/Icon.d.ts +20 -0
- package/dist/ui/src/icons/cool_icon_keys.d.ts +1 -0
- package/dist/ui/src/icons/icon_keys.d.ts +1 -0
- package/dist/ui/src/icons/index.d.ts +6 -0
- package/dist/ui/src/index.d.ts +5 -0
- package/dist/ui/src/styles.d.ts +12 -0
- package/dist/ui/src/util/chip_colors.d.ts +4 -0
- package/dist/ui/src/util/cls.d.ts +2 -0
- package/dist/ui/src/util/debounce.d.ts +10 -0
- package/dist/ui/src/util/hash.d.ts +1 -0
- package/dist/ui/src/util/index.d.ts +4 -0
- package/dist/ui/src/util/key_to_icon_component.d.ts +1 -0
- package/package.json +84 -0
- package/src/components/ApiExplorer/ApiExplorer.tsx +290 -0
- package/src/components/ApiExplorer/EndpointDetail.tsx +271 -0
- package/src/components/ApiExplorer/TryItPanel.tsx +510 -0
- package/src/components/ApiExplorer/parseSpec.ts +104 -0
- package/src/components/ApiExplorer/types.ts +84 -0
- package/src/components/AuthSimulationSelector.tsx +77 -0
- package/src/components/Branches/BranchesView.tsx +370 -0
- package/src/components/CronJobs/CronJobsView.tsx +346 -0
- package/src/components/JSEditor/JSEditor.tsx +1033 -0
- package/src/components/JSEditor/JSEditorSidebar.tsx +340 -0
- package/src/components/JSEditor/JSMonacoEditor.tsx +390 -0
- package/src/components/RLSEditor/PolicyEditor.tsx +444 -0
- package/src/components/RLSEditor/RLSEditor.tsx +692 -0
- package/src/components/RLSEditor/index.ts +1 -0
- package/src/components/RebaseStudio.tsx +121 -0
- package/src/components/SQLEditor/ExplainVisualizer.tsx +128 -0
- package/src/components/SQLEditor/MonacoEditor.tsx +203 -0
- package/src/components/SQLEditor/SQLEditor.tsx +1419 -0
- package/src/components/SQLEditor/SQLEditorSidebar.tsx +174 -0
- package/src/components/SQLEditor/SchemaBrowser.tsx +158 -0
- package/src/components/SchemaVisualizer/RelationEdge.tsx +102 -0
- package/src/components/SchemaVisualizer/SchemaVisualizer.tsx +665 -0
- package/src/components/SchemaVisualizer/TableNode.tsx +257 -0
- package/src/components/SchemaVisualizer/index.ts +5 -0
- package/src/components/SchemaVisualizer/schema-visualizer.utils.ts +140 -0
- package/src/components/SchemaVisualizer/useSchemaGraph.ts +397 -0
- package/src/components/StorageView/StorageView.tsx +1035 -0
- package/src/components/StudioHomePage.tsx +357 -0
- package/src/index.ts +31 -0
- package/src/utils/entities.ts +2 -0
- package/src/utils/pgColumnToProperty.test.ts +401 -0
- package/src/utils/pgColumnToProperty.ts +275 -0
- package/src/utils/sql_utils.test.ts +265 -0
- package/src/utils/sql_utils.ts +291 -0
- package/src/vite-env.d.ts +1 -0
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { useMemo, useState, useCallback, useEffect } from "react";
|
|
2
|
+
import type { Node, Edge } from "@xyflow/react";
|
|
3
|
+
import { MarkerType } from "@xyflow/react";
|
|
4
|
+
import { isPostgresCollection } from "@rebasepro/types";
|
|
5
|
+
import type { EntityCollection, PostgresCollection, Relation } from "@rebasepro/types";
|
|
6
|
+
import { resolveCollectionRelations } from "@rebasepro/common";
|
|
7
|
+
import { getLayoutedElements, getCardinalityLabel, getTypeLabel, NODE_WIDTH } from "./schema-visualizer.utils";
|
|
8
|
+
import type { LayoutDirection, RelationEdgeData } from "./schema-visualizer.utils";
|
|
9
|
+
|
|
10
|
+
// ─── Column info extracted from a collection ──────────────────────────
|
|
11
|
+
|
|
12
|
+
export interface ColumnInfo {
|
|
13
|
+
name: string;
|
|
14
|
+
type: string;
|
|
15
|
+
typeLabel: string;
|
|
16
|
+
isPrimaryKey: boolean;
|
|
17
|
+
isForeignKey: boolean;
|
|
18
|
+
isRequired: boolean;
|
|
19
|
+
isEnum: boolean;
|
|
20
|
+
enumValues?: string[];
|
|
21
|
+
relationName?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// ─── Node data shape ──────────────────────────────────────────────────
|
|
25
|
+
|
|
26
|
+
export interface TableNodeData {
|
|
27
|
+
tableName: string;
|
|
28
|
+
collectionName: string;
|
|
29
|
+
slug: string;
|
|
30
|
+
columns: ColumnInfo[];
|
|
31
|
+
isJunction: boolean;
|
|
32
|
+
isUnmanaged: boolean;
|
|
33
|
+
rlsEnabled: boolean;
|
|
34
|
+
historyEnabled: boolean;
|
|
35
|
+
icon?: string;
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// ─── Extract columns from an EntityCollection ─────────────────────────
|
|
40
|
+
|
|
41
|
+
const extractColumns = (collection: EntityCollection): ColumnInfo[] => {
|
|
42
|
+
const columns: ColumnInfo[] = [];
|
|
43
|
+
const properties = collection.properties ?? {};
|
|
44
|
+
|
|
45
|
+
for (const [propName, prop] of Object.entries(properties)) {
|
|
46
|
+
if (prop.type === "relation") continue; // Relations are shown as edges, not columns
|
|
47
|
+
|
|
48
|
+
const isPk =
|
|
49
|
+
("isId" in prop && Boolean((prop as unknown as Record<string, unknown>).isId)) ||
|
|
50
|
+
(!Object.values(properties).some(
|
|
51
|
+
(p) => "isId" in p && Boolean((p as unknown as Record<string, unknown>).isId)
|
|
52
|
+
) &&
|
|
53
|
+
propName === "id");
|
|
54
|
+
|
|
55
|
+
const isEnum = prop.type === "string" && "enum" in prop && Boolean(prop.enum);
|
|
56
|
+
|
|
57
|
+
let enumValues: string[] | undefined;
|
|
58
|
+
if (isEnum && "enum" in prop && prop.enum) {
|
|
59
|
+
const enumProp = prop.enum;
|
|
60
|
+
if (Array.isArray(enumProp)) {
|
|
61
|
+
enumValues = enumProp.map((v: unknown) =>
|
|
62
|
+
typeof v === "string" ? v : String((v as Record<string, unknown>)?.id ?? v)
|
|
63
|
+
);
|
|
64
|
+
} else if (typeof enumProp === "object" && enumProp !== null) {
|
|
65
|
+
enumValues = Object.keys(enumProp);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
columns.push({
|
|
70
|
+
name: propName,
|
|
71
|
+
type: prop.type,
|
|
72
|
+
typeLabel: getTypeLabel(prop.type),
|
|
73
|
+
isPrimaryKey: isPk,
|
|
74
|
+
isForeignKey: false,
|
|
75
|
+
isRequired: Boolean(prop.validation?.required),
|
|
76
|
+
isEnum,
|
|
77
|
+
enumValues
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Add FK columns from owning relations
|
|
82
|
+
if (isPostgresCollection(collection)) {
|
|
83
|
+
try {
|
|
84
|
+
const resolvedRelations = resolveCollectionRelations(collection);
|
|
85
|
+
for (const rel of Object.values(resolvedRelations)) {
|
|
86
|
+
if (rel.direction === "owning" && rel.cardinality === "one" && rel.localKey) {
|
|
87
|
+
// Only add if not already present as a regular column
|
|
88
|
+
if (!columns.some((c) => c.name === rel.localKey)) {
|
|
89
|
+
columns.push({
|
|
90
|
+
name: rel.localKey,
|
|
91
|
+
type: "number",
|
|
92
|
+
typeLabel: "FK",
|
|
93
|
+
isPrimaryKey: false,
|
|
94
|
+
isForeignKey: true,
|
|
95
|
+
isRequired: false,
|
|
96
|
+
isEnum: false,
|
|
97
|
+
relationName: rel.relationName
|
|
98
|
+
});
|
|
99
|
+
} else {
|
|
100
|
+
// Mark existing column as FK
|
|
101
|
+
const existing = columns.find((c) => c.name === rel.localKey);
|
|
102
|
+
if (existing) {
|
|
103
|
+
existing.isForeignKey = true;
|
|
104
|
+
existing.relationName = rel.relationName;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
} catch {
|
|
110
|
+
// Ignore resolution errors
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return columns;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// ─── Build graph from collections ─────────────────────────────────────
|
|
118
|
+
|
|
119
|
+
const buildGraph = (
|
|
120
|
+
collections: EntityCollection[],
|
|
121
|
+
direction: LayoutDirection
|
|
122
|
+
): { nodes: Node[]; edges: Edge[] } => {
|
|
123
|
+
const nodes: Node[] = [];
|
|
124
|
+
const edges: Edge[] = [];
|
|
125
|
+
const tableToNodeId = new Map<string, string>();
|
|
126
|
+
// Track columns per node so we can resolve handle IDs for edges
|
|
127
|
+
const nodeColumns = new Map<string, ColumnInfo[]>();
|
|
128
|
+
|
|
129
|
+
// Helper: find the PK column name for a node (falls back to "id")
|
|
130
|
+
const getPkHandle = (nodeId: string): string => {
|
|
131
|
+
const cols = nodeColumns.get(nodeId);
|
|
132
|
+
const pk = cols?.find((c) => c.isPrimaryKey);
|
|
133
|
+
return pk ? `target-${pk.name}` : "target-default";
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// Helper: find the FK column name for a node pointing to a relation
|
|
137
|
+
const getFkHandle = (nodeId: string, localKey: string | undefined): string => {
|
|
138
|
+
if (!localKey) return "source-default";
|
|
139
|
+
const cols = nodeColumns.get(nodeId);
|
|
140
|
+
const fk = cols?.find((c) => c.name === localKey);
|
|
141
|
+
return fk ? `source-${fk.name}` : "source-default";
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// 1. Create nodes for each collection
|
|
145
|
+
for (const collection of collections) {
|
|
146
|
+
if (!isPostgresCollection(collection)) continue;
|
|
147
|
+
|
|
148
|
+
const tableName = collection.table ?? collection.slug;
|
|
149
|
+
const nodeId = `table-${tableName}`;
|
|
150
|
+
tableToNodeId.set(tableName, nodeId);
|
|
151
|
+
|
|
152
|
+
const columns = extractColumns(collection);
|
|
153
|
+
nodeColumns.set(nodeId, columns);
|
|
154
|
+
|
|
155
|
+
const nodeData: TableNodeData = {
|
|
156
|
+
tableName,
|
|
157
|
+
collectionName: collection.name,
|
|
158
|
+
slug: collection.slug,
|
|
159
|
+
columns,
|
|
160
|
+
isJunction: false,
|
|
161
|
+
isUnmanaged: false,
|
|
162
|
+
rlsEnabled: Boolean(collection.securityRules && collection.securityRules.length > 0),
|
|
163
|
+
historyEnabled: Boolean(collection.history),
|
|
164
|
+
icon: typeof collection.icon === "string" ? collection.icon : undefined
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
nodes.push({
|
|
168
|
+
id: nodeId,
|
|
169
|
+
type: "tableNode",
|
|
170
|
+
position: { x: 0,
|
|
171
|
+
y: 0 },
|
|
172
|
+
data: nodeData
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// 2. Create junction table nodes and edges
|
|
177
|
+
const processedJunctions = new Set<string>();
|
|
178
|
+
|
|
179
|
+
for (const collection of collections) {
|
|
180
|
+
if (!isPostgresCollection(collection)) continue;
|
|
181
|
+
|
|
182
|
+
const tableName = collection.table ?? collection.slug;
|
|
183
|
+
const sourceNodeId = tableToNodeId.get(tableName);
|
|
184
|
+
if (!sourceNodeId) continue;
|
|
185
|
+
|
|
186
|
+
let resolvedRelations: Record<string, Relation>;
|
|
187
|
+
try {
|
|
188
|
+
resolvedRelations = resolveCollectionRelations(collection);
|
|
189
|
+
} catch {
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
for (const [relationKey, rel] of Object.entries(resolvedRelations)) {
|
|
194
|
+
let targetCollection: EntityCollection;
|
|
195
|
+
try {
|
|
196
|
+
targetCollection = rel.target();
|
|
197
|
+
} catch {
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (!isPostgresCollection(targetCollection)) continue;
|
|
202
|
+
|
|
203
|
+
const targetTable = targetCollection.table ?? targetCollection.slug;
|
|
204
|
+
const targetNodeId = tableToNodeId.get(targetTable);
|
|
205
|
+
if (!targetNodeId) continue;
|
|
206
|
+
|
|
207
|
+
// Skip inverse relations (we only draw owning ones)
|
|
208
|
+
if (rel.direction === "inverse") continue;
|
|
209
|
+
|
|
210
|
+
const edgeData: RelationEdgeData = {
|
|
211
|
+
cardinality: rel.cardinality,
|
|
212
|
+
direction: rel.direction ?? "owning",
|
|
213
|
+
relationName: rel.relationName ?? relationKey,
|
|
214
|
+
hasJunction: Boolean(rel.through),
|
|
215
|
+
hasJoinPath: Boolean(rel.joinPath),
|
|
216
|
+
label: getCardinalityLabel(rel.cardinality, rel.direction ?? "owning")
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
if (rel.through && !processedJunctions.has(rel.through.table)) {
|
|
220
|
+
// Many-to-many: create junction node + two edges
|
|
221
|
+
processedJunctions.add(rel.through.table);
|
|
222
|
+
const junctionNodeId = `junction-${rel.through.table}`;
|
|
223
|
+
|
|
224
|
+
const junctionColumns: ColumnInfo[] = [
|
|
225
|
+
{
|
|
226
|
+
name: rel.through.sourceColumn,
|
|
227
|
+
type: "number",
|
|
228
|
+
typeLabel: "FK",
|
|
229
|
+
isPrimaryKey: true,
|
|
230
|
+
isForeignKey: true,
|
|
231
|
+
isRequired: true,
|
|
232
|
+
isEnum: false
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: rel.through.targetColumn,
|
|
236
|
+
type: "number",
|
|
237
|
+
typeLabel: "FK",
|
|
238
|
+
isPrimaryKey: true,
|
|
239
|
+
isForeignKey: true,
|
|
240
|
+
isRequired: true,
|
|
241
|
+
isEnum: false
|
|
242
|
+
}
|
|
243
|
+
];
|
|
244
|
+
nodeColumns.set(junctionNodeId, junctionColumns);
|
|
245
|
+
|
|
246
|
+
nodes.push({
|
|
247
|
+
id: junctionNodeId,
|
|
248
|
+
type: "tableNode",
|
|
249
|
+
position: { x: 0,
|
|
250
|
+
y: 0 },
|
|
251
|
+
data: {
|
|
252
|
+
tableName: rel.through.table,
|
|
253
|
+
collectionName: rel.through.table,
|
|
254
|
+
slug: rel.through.table,
|
|
255
|
+
columns: junctionColumns,
|
|
256
|
+
isJunction: true,
|
|
257
|
+
isUnmanaged: false,
|
|
258
|
+
rlsEnabled: false,
|
|
259
|
+
historyEnabled: false
|
|
260
|
+
} satisfies TableNodeData
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
// Source table → junction (junction references source PK)
|
|
264
|
+
const sourcePk = nodeColumns.get(sourceNodeId)?.find((c) => c.isPrimaryKey);
|
|
265
|
+
edges.push({
|
|
266
|
+
id: `edge-${sourceNodeId}-${junctionNodeId}`,
|
|
267
|
+
source: sourceNodeId,
|
|
268
|
+
target: junctionNodeId,
|
|
269
|
+
sourceHandle: sourcePk ? `source-${sourcePk.name}` : "source-default",
|
|
270
|
+
targetHandle: `target-${rel.through.sourceColumn}`,
|
|
271
|
+
type: "relationEdge",
|
|
272
|
+
data: { ...edgeData,
|
|
273
|
+
label: "1:N" } as Record<string, unknown>,
|
|
274
|
+
markerEnd: { type: MarkerType.ArrowClosed,
|
|
275
|
+
width: 16,
|
|
276
|
+
height: 16 }
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
// Junction → target table
|
|
280
|
+
edges.push({
|
|
281
|
+
id: `edge-${junctionNodeId}-${targetNodeId}`,
|
|
282
|
+
source: junctionNodeId,
|
|
283
|
+
target: targetNodeId,
|
|
284
|
+
sourceHandle: `source-${rel.through.targetColumn}`,
|
|
285
|
+
targetHandle: getPkHandle(targetNodeId),
|
|
286
|
+
type: "relationEdge",
|
|
287
|
+
data: { ...edgeData,
|
|
288
|
+
label: "N:1" } as Record<string, unknown>,
|
|
289
|
+
markerEnd: { type: MarkerType.ArrowClosed,
|
|
290
|
+
width: 16,
|
|
291
|
+
height: 16 }
|
|
292
|
+
});
|
|
293
|
+
} else if (!rel.through) {
|
|
294
|
+
// Direct relation (one-to-one or many-to-one)
|
|
295
|
+
edges.push({
|
|
296
|
+
id: `edge-${sourceNodeId}-${targetNodeId}-${relationKey}`,
|
|
297
|
+
source: sourceNodeId,
|
|
298
|
+
target: targetNodeId,
|
|
299
|
+
sourceHandle: getFkHandle(sourceNodeId, rel.localKey),
|
|
300
|
+
targetHandle: getPkHandle(targetNodeId),
|
|
301
|
+
type: "relationEdge",
|
|
302
|
+
data: { ...edgeData } as Record<string, unknown>,
|
|
303
|
+
markerEnd: { type: MarkerType.ArrowClosed,
|
|
304
|
+
width: 16,
|
|
305
|
+
height: 16 }
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
// 3. Apply dagre layout first to get node positions
|
|
311
|
+
const layoutResult = getLayoutedElements(nodes, edges, direction);
|
|
312
|
+
|
|
313
|
+
// 4. Build a position lookup from the laid-out nodes
|
|
314
|
+
const nodePositions = new Map<string, { x: number }>();
|
|
315
|
+
for (const node of layoutResult.nodes) {
|
|
316
|
+
nodePositions.set(node.id, { x: node.position.x });
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// 5. Resolve handle sides based on relative node positions.
|
|
320
|
+
// If source is left of target → source exits Right, target enters Left.
|
|
321
|
+
// If source is right of target → source exits Left, target enters Right.
|
|
322
|
+
for (const edge of layoutResult.edges) {
|
|
323
|
+
const srcPos = nodePositions.get(edge.source);
|
|
324
|
+
const tgtPos = nodePositions.get(edge.target);
|
|
325
|
+
|
|
326
|
+
const srcBaseHandle = (edge.sourceHandle ?? "source-default") as string;
|
|
327
|
+
const tgtBaseHandle = (edge.targetHandle ?? "target-default") as string;
|
|
328
|
+
|
|
329
|
+
if (srcPos && tgtPos) {
|
|
330
|
+
const srcCenterX = srcPos.x + NODE_WIDTH / 2;
|
|
331
|
+
const tgtCenterX = tgtPos.x + NODE_WIDTH / 2;
|
|
332
|
+
const sourceIsLeft = srcCenterX <= tgtCenterX;
|
|
333
|
+
|
|
334
|
+
edge.sourceHandle = `${srcBaseHandle}-${sourceIsLeft ? "right" : "left"}`;
|
|
335
|
+
edge.targetHandle = `${tgtBaseHandle}-${sourceIsLeft ? "left" : "right"}`;
|
|
336
|
+
} else {
|
|
337
|
+
edge.sourceHandle = `${srcBaseHandle}-right`;
|
|
338
|
+
edge.targetHandle = `${tgtBaseHandle}-left`;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
return layoutResult;
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
// ─── Hook ─────────────────────────────────────────────────────────────
|
|
346
|
+
|
|
347
|
+
export interface UseSchemaGraphResult {
|
|
348
|
+
nodes: Node[];
|
|
349
|
+
edges: Edge[];
|
|
350
|
+
direction: LayoutDirection;
|
|
351
|
+
setDirection: (dir: LayoutDirection) => void;
|
|
352
|
+
relayout: () => void;
|
|
353
|
+
isLoading: boolean;
|
|
354
|
+
tableCount: number;
|
|
355
|
+
relationCount: number;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export const useSchemaGraph = (
|
|
359
|
+
collections: EntityCollection[] | undefined
|
|
360
|
+
): UseSchemaGraphResult => {
|
|
361
|
+
const [direction, setDirection] = useState<LayoutDirection>("LR");
|
|
362
|
+
const [version, setVersion] = useState(0);
|
|
363
|
+
|
|
364
|
+
const relayout = useCallback(() => setVersion((v) => v + 1), []);
|
|
365
|
+
|
|
366
|
+
// Re-layout on direction change
|
|
367
|
+
useEffect(() => {
|
|
368
|
+
setVersion((v) => v + 1);
|
|
369
|
+
}, [direction]);
|
|
370
|
+
|
|
371
|
+
const { nodes, edges, tableCount, relationCount } = useMemo(() => {
|
|
372
|
+
if (!collections || collections.length === 0) {
|
|
373
|
+
return { nodes: [],
|
|
374
|
+
edges: [],
|
|
375
|
+
tableCount: 0,
|
|
376
|
+
relationCount: 0 };
|
|
377
|
+
}
|
|
378
|
+
const result = buildGraph(collections, direction);
|
|
379
|
+
return {
|
|
380
|
+
...result,
|
|
381
|
+
tableCount: result.nodes.length,
|
|
382
|
+
relationCount: result.edges.length
|
|
383
|
+
};
|
|
384
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
385
|
+
}, [collections, direction, version]);
|
|
386
|
+
|
|
387
|
+
return {
|
|
388
|
+
nodes,
|
|
389
|
+
edges,
|
|
390
|
+
direction,
|
|
391
|
+
setDirection,
|
|
392
|
+
relayout,
|
|
393
|
+
isLoading: !collections,
|
|
394
|
+
tableCount,
|
|
395
|
+
relationCount
|
|
396
|
+
};
|
|
397
|
+
};
|