@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,1831 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation, useRebaseContext, useSnackbarController, useStudioCollectionRegistry, ErrorView } from "@rebasepro/core";
|
|
3
|
+
import { useState, useEffect, useCallback, useMemo } from "react";
|
|
4
|
+
import { IconButton, iconSize, cls, defaultBorderMixin, Typography, Select, SelectItem, DialogTitle, TextField, Button, MultiSelect, Paper, DialogContent, DialogActions, Dialog, MultiSelectItem, ResizablePanels, Chip, Alert, Tooltip, Tabs, Tab, CircularProgress } from "@rebasepro/ui";
|
|
5
|
+
import { HelpCircleIcon, RefreshCwIcon, AlertTriangleIcon, KeyIcon, Trash2Icon, ShieldIcon } from "lucide-react";
|
|
6
|
+
import { isPostgresCollection } from "@rebasepro/types";
|
|
7
|
+
import { c } from "react-compiler-runtime";
|
|
8
|
+
import { M as MonacoEditor } from "./MonacoEditor-CMYEjiRf.js";
|
|
9
|
+
const COMMAND_OPTIONS = ["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"];
|
|
10
|
+
const ROLE_OPTIONS = ["public", "authenticated", "anon", "admin"];
|
|
11
|
+
const POLICY_PRESETS = [{
|
|
12
|
+
id: "public_read",
|
|
13
|
+
label: "Enable read access to everyone",
|
|
14
|
+
description: "Anyone can read data, regardless of authentication status.",
|
|
15
|
+
policyname: "Enable read access for all users",
|
|
16
|
+
cmd: "SELECT",
|
|
17
|
+
permissive: "PERMISSIVE",
|
|
18
|
+
roles: ["public"],
|
|
19
|
+
qual: "true",
|
|
20
|
+
with_check: ""
|
|
21
|
+
}, {
|
|
22
|
+
id: "auth_read",
|
|
23
|
+
label: "Enable read access for authenticated users only",
|
|
24
|
+
description: "Only logged-in users are allowed to read data.",
|
|
25
|
+
policyname: "Enable read access for authenticated users",
|
|
26
|
+
cmd: "SELECT",
|
|
27
|
+
permissive: "PERMISSIVE",
|
|
28
|
+
roles: ["authenticated"],
|
|
29
|
+
qual: "true",
|
|
30
|
+
with_check: ""
|
|
31
|
+
}, {
|
|
32
|
+
id: "auth_insert",
|
|
33
|
+
label: "Enable insert for authenticated users only",
|
|
34
|
+
description: "Only logged-in users are allowed to insert new data.",
|
|
35
|
+
policyname: "Enable insert for authenticated users only",
|
|
36
|
+
cmd: "INSERT",
|
|
37
|
+
permissive: "PERMISSIVE",
|
|
38
|
+
roles: ["authenticated"],
|
|
39
|
+
qual: "",
|
|
40
|
+
with_check: "true"
|
|
41
|
+
}, {
|
|
42
|
+
id: "user_select_own",
|
|
43
|
+
label: "Users can read their own rows",
|
|
44
|
+
description: "Users can only read rows where the user_id matches their auth.uid()",
|
|
45
|
+
policyname: "Users can select their own data",
|
|
46
|
+
cmd: "SELECT",
|
|
47
|
+
permissive: "PERMISSIVE",
|
|
48
|
+
roles: ["authenticated"],
|
|
49
|
+
qual: "auth.uid() = user_id",
|
|
50
|
+
with_check: ""
|
|
51
|
+
}, {
|
|
52
|
+
id: "user_update_own",
|
|
53
|
+
label: "Users can update their own rows",
|
|
54
|
+
description: "Users can only update rows where the user_id matches their auth.uid()",
|
|
55
|
+
policyname: "Users can update their own data",
|
|
56
|
+
cmd: "UPDATE",
|
|
57
|
+
permissive: "PERMISSIVE",
|
|
58
|
+
roles: ["authenticated"],
|
|
59
|
+
qual: "auth.uid() = user_id",
|
|
60
|
+
with_check: "auth.uid() = user_id"
|
|
61
|
+
}, {
|
|
62
|
+
id: "user_delete_own",
|
|
63
|
+
label: "Users can delete their own rows",
|
|
64
|
+
description: "Users can only delete rows where the user_id matches their auth.uid()",
|
|
65
|
+
policyname: "Users can delete their own data",
|
|
66
|
+
cmd: "DELETE",
|
|
67
|
+
permissive: "PERMISSIVE",
|
|
68
|
+
roles: ["authenticated"],
|
|
69
|
+
qual: "auth.uid() = user_id",
|
|
70
|
+
with_check: ""
|
|
71
|
+
}];
|
|
72
|
+
const PolicyEditor = (t0) => {
|
|
73
|
+
const $ = c(294);
|
|
74
|
+
const {
|
|
75
|
+
policy,
|
|
76
|
+
schema,
|
|
77
|
+
table,
|
|
78
|
+
onSave,
|
|
79
|
+
onCancel
|
|
80
|
+
} = t0;
|
|
81
|
+
const {
|
|
82
|
+
t
|
|
83
|
+
} = useTranslation();
|
|
84
|
+
const [name, setName] = useState("");
|
|
85
|
+
const [helpOpen, setHelpOpen] = useState(false);
|
|
86
|
+
const [behavior, setBehavior] = useState("PERMISSIVE");
|
|
87
|
+
const [command, setCommand] = useState("ALL");
|
|
88
|
+
let t1;
|
|
89
|
+
if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
90
|
+
t1 = ["public"];
|
|
91
|
+
$[0] = t1;
|
|
92
|
+
} else {
|
|
93
|
+
t1 = $[0];
|
|
94
|
+
}
|
|
95
|
+
const [roles, setRoles] = useState(t1);
|
|
96
|
+
const [usingExpr, setUsingExpr] = useState("");
|
|
97
|
+
const [checkExpr, setCheckExpr] = useState("");
|
|
98
|
+
const [selectedPreset, setSelectedPreset] = useState("");
|
|
99
|
+
let t2;
|
|
100
|
+
let t3;
|
|
101
|
+
if ($[1] !== policy) {
|
|
102
|
+
t2 = () => {
|
|
103
|
+
if (policy) {
|
|
104
|
+
setName(policy.policyname || "");
|
|
105
|
+
setBehavior(policy.permissive || "PERMISSIVE");
|
|
106
|
+
setCommand(policy.cmd || "ALL");
|
|
107
|
+
const initialRoles = policy.roles ? Array.isArray(policy.roles) ? policy.roles : [policy.roles] : ["public"];
|
|
108
|
+
setRoles(initialRoles);
|
|
109
|
+
setUsingExpr(policy.qual || "");
|
|
110
|
+
setCheckExpr(policy.with_check || "");
|
|
111
|
+
} else {
|
|
112
|
+
setName("");
|
|
113
|
+
setBehavior("PERMISSIVE");
|
|
114
|
+
setCommand("ALL");
|
|
115
|
+
setRoles(["public"]);
|
|
116
|
+
setUsingExpr("");
|
|
117
|
+
setCheckExpr("");
|
|
118
|
+
setSelectedPreset("");
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
t3 = [policy];
|
|
122
|
+
$[1] = policy;
|
|
123
|
+
$[2] = t2;
|
|
124
|
+
$[3] = t3;
|
|
125
|
+
} else {
|
|
126
|
+
t2 = $[2];
|
|
127
|
+
t3 = $[3];
|
|
128
|
+
}
|
|
129
|
+
useEffect(t2, t3);
|
|
130
|
+
let t4;
|
|
131
|
+
if ($[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
132
|
+
t4 = (presetId) => {
|
|
133
|
+
const preset = POLICY_PRESETS.find((p) => p.id === presetId);
|
|
134
|
+
if (!preset) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
setSelectedPreset(presetId);
|
|
138
|
+
setName(preset.policyname);
|
|
139
|
+
setBehavior(preset.permissive);
|
|
140
|
+
setCommand(preset.cmd);
|
|
141
|
+
setRoles(preset.roles);
|
|
142
|
+
setUsingExpr(preset.qual);
|
|
143
|
+
setCheckExpr(preset.with_check);
|
|
144
|
+
};
|
|
145
|
+
$[4] = t4;
|
|
146
|
+
} else {
|
|
147
|
+
t4 = $[4];
|
|
148
|
+
}
|
|
149
|
+
const handlePresetChange = t4;
|
|
150
|
+
const showCheck = command === "ALL" || command === "INSERT" || command === "UPDATE";
|
|
151
|
+
let t5;
|
|
152
|
+
if ($[5] !== behavior || $[6] !== checkExpr || $[7] !== command || $[8] !== name || $[9] !== onSave || $[10] !== roles || $[11] !== showCheck || $[12] !== usingExpr) {
|
|
153
|
+
t5 = () => {
|
|
154
|
+
onSave({
|
|
155
|
+
policyname: name,
|
|
156
|
+
permissive: behavior,
|
|
157
|
+
cmd: command,
|
|
158
|
+
roles,
|
|
159
|
+
qual: usingExpr,
|
|
160
|
+
with_check: showCheck ? checkExpr : null
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
$[5] = behavior;
|
|
164
|
+
$[6] = checkExpr;
|
|
165
|
+
$[7] = command;
|
|
166
|
+
$[8] = name;
|
|
167
|
+
$[9] = onSave;
|
|
168
|
+
$[10] = roles;
|
|
169
|
+
$[11] = showCheck;
|
|
170
|
+
$[12] = usingExpr;
|
|
171
|
+
$[13] = t5;
|
|
172
|
+
} else {
|
|
173
|
+
t5 = $[13];
|
|
174
|
+
}
|
|
175
|
+
const handleSave = t5;
|
|
176
|
+
let t6;
|
|
177
|
+
if ($[14] !== policy || $[15] !== t) {
|
|
178
|
+
t6 = policy ? t("studio_policy_edit") : t("studio_policy_create");
|
|
179
|
+
$[14] = policy;
|
|
180
|
+
$[15] = t;
|
|
181
|
+
$[16] = t6;
|
|
182
|
+
} else {
|
|
183
|
+
t6 = $[16];
|
|
184
|
+
}
|
|
185
|
+
let t7;
|
|
186
|
+
if ($[17] !== t6) {
|
|
187
|
+
t7 = /* @__PURE__ */ jsx("div", { children: t6 });
|
|
188
|
+
$[17] = t6;
|
|
189
|
+
$[18] = t7;
|
|
190
|
+
} else {
|
|
191
|
+
t7 = $[18];
|
|
192
|
+
}
|
|
193
|
+
let t8;
|
|
194
|
+
if ($[19] !== t) {
|
|
195
|
+
t8 = t("studio_policy_defining_rules");
|
|
196
|
+
$[19] = t;
|
|
197
|
+
$[20] = t8;
|
|
198
|
+
} else {
|
|
199
|
+
t8 = $[20];
|
|
200
|
+
}
|
|
201
|
+
let t9;
|
|
202
|
+
if ($[21] !== schema || $[22] !== table) {
|
|
203
|
+
t9 = /* @__PURE__ */ jsxs("span", { className: "font-mono text-primary bg-primary-bg dark:bg-primary-bg-dark px-1 py-0.5 rounded", children: [
|
|
204
|
+
schema,
|
|
205
|
+
".",
|
|
206
|
+
table
|
|
207
|
+
] });
|
|
208
|
+
$[21] = schema;
|
|
209
|
+
$[22] = table;
|
|
210
|
+
$[23] = t9;
|
|
211
|
+
} else {
|
|
212
|
+
t9 = $[23];
|
|
213
|
+
}
|
|
214
|
+
let t10;
|
|
215
|
+
if ($[24] !== t8 || $[25] !== t9) {
|
|
216
|
+
t10 = /* @__PURE__ */ jsxs("div", { className: "text-sm font-normal text-text-secondary dark:text-text-secondary-dark tracking-wide mt-1", children: [
|
|
217
|
+
t8,
|
|
218
|
+
" ",
|
|
219
|
+
t9
|
|
220
|
+
] });
|
|
221
|
+
$[24] = t8;
|
|
222
|
+
$[25] = t9;
|
|
223
|
+
$[26] = t10;
|
|
224
|
+
} else {
|
|
225
|
+
t10 = $[26];
|
|
226
|
+
}
|
|
227
|
+
let t11;
|
|
228
|
+
if ($[27] !== t10 || $[28] !== t7) {
|
|
229
|
+
t11 = /* @__PURE__ */ jsxs("div", { children: [
|
|
230
|
+
t7,
|
|
231
|
+
t10
|
|
232
|
+
] });
|
|
233
|
+
$[27] = t10;
|
|
234
|
+
$[28] = t7;
|
|
235
|
+
$[29] = t11;
|
|
236
|
+
} else {
|
|
237
|
+
t11 = $[29];
|
|
238
|
+
}
|
|
239
|
+
let t12;
|
|
240
|
+
if ($[30] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
241
|
+
t12 = /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: () => setHelpOpen(true), children: /* @__PURE__ */ jsx(HelpCircleIcon, { size: iconSize.smallest }) });
|
|
242
|
+
$[30] = t12;
|
|
243
|
+
} else {
|
|
244
|
+
t12 = $[30];
|
|
245
|
+
}
|
|
246
|
+
let t13;
|
|
247
|
+
if ($[31] !== t11) {
|
|
248
|
+
t13 = /* @__PURE__ */ jsxs(DialogTitle, { className: "flex justify-between items-center w-full", variant: "h6", children: [
|
|
249
|
+
t11,
|
|
250
|
+
t12
|
|
251
|
+
] });
|
|
252
|
+
$[31] = t11;
|
|
253
|
+
$[32] = t13;
|
|
254
|
+
} else {
|
|
255
|
+
t13 = $[32];
|
|
256
|
+
}
|
|
257
|
+
let t14;
|
|
258
|
+
if ($[33] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
259
|
+
t14 = cls("p-4 md:p-6 flex flex-col gap-6 bg-white dark:bg-surface-900 border-none sm:border-solid rounded-none sm:rounded-xl", defaultBorderMixin);
|
|
260
|
+
$[33] = t14;
|
|
261
|
+
} else {
|
|
262
|
+
t14 = $[33];
|
|
263
|
+
}
|
|
264
|
+
let t15;
|
|
265
|
+
if ($[34] !== policy || $[35] !== selectedPreset || $[36] !== t) {
|
|
266
|
+
t15 = !policy && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5 bg-primary/5 dark:bg-primary-bg-dark/20 p-3 sm:p-4 rounded-lg border border-primary/10 dark:border-primary/20", children: [
|
|
267
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-primary dark:text-primary-light uppercase tracking-wider", children: t("studio_policy_template") }),
|
|
268
|
+
/* @__PURE__ */ jsx(Select, { size: "small", value: selectedPreset, onValueChange: handlePresetChange, position: "item-aligned", placeholder: t("studio_policy_select_template"), className: "bg-white dark:bg-surface-950", children: POLICY_PRESETS.map(_temp) })
|
|
269
|
+
] });
|
|
270
|
+
$[34] = policy;
|
|
271
|
+
$[35] = selectedPreset;
|
|
272
|
+
$[36] = t;
|
|
273
|
+
$[37] = t15;
|
|
274
|
+
} else {
|
|
275
|
+
t15 = $[37];
|
|
276
|
+
}
|
|
277
|
+
let t16;
|
|
278
|
+
if ($[38] !== t) {
|
|
279
|
+
t16 = t("studio_policy_name");
|
|
280
|
+
$[38] = t;
|
|
281
|
+
$[39] = t16;
|
|
282
|
+
} else {
|
|
283
|
+
t16 = $[39];
|
|
284
|
+
}
|
|
285
|
+
let t17;
|
|
286
|
+
if ($[40] !== t16) {
|
|
287
|
+
t17 = /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "uppercase tracking-wider text-text-secondary", children: t16 });
|
|
288
|
+
$[40] = t16;
|
|
289
|
+
$[41] = t17;
|
|
290
|
+
} else {
|
|
291
|
+
t17 = $[41];
|
|
292
|
+
}
|
|
293
|
+
let t18;
|
|
294
|
+
if ($[42] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
295
|
+
t18 = (e) => setName(e.target.value);
|
|
296
|
+
$[42] = t18;
|
|
297
|
+
} else {
|
|
298
|
+
t18 = $[42];
|
|
299
|
+
}
|
|
300
|
+
let t19;
|
|
301
|
+
if ($[43] !== t) {
|
|
302
|
+
t19 = t("studio_policy_name_placeholder");
|
|
303
|
+
$[43] = t;
|
|
304
|
+
$[44] = t19;
|
|
305
|
+
} else {
|
|
306
|
+
t19 = $[44];
|
|
307
|
+
}
|
|
308
|
+
let t20;
|
|
309
|
+
if ($[45] !== name || $[46] !== t19) {
|
|
310
|
+
t20 = /* @__PURE__ */ jsx(TextField, { value: name, onChange: t18, placeholder: t19, className: "w-full" });
|
|
311
|
+
$[45] = name;
|
|
312
|
+
$[46] = t19;
|
|
313
|
+
$[47] = t20;
|
|
314
|
+
} else {
|
|
315
|
+
t20 = $[47];
|
|
316
|
+
}
|
|
317
|
+
let t21;
|
|
318
|
+
if ($[48] !== t17 || $[49] !== t20) {
|
|
319
|
+
t21 = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
320
|
+
t17,
|
|
321
|
+
t20
|
|
322
|
+
] });
|
|
323
|
+
$[48] = t17;
|
|
324
|
+
$[49] = t20;
|
|
325
|
+
$[50] = t21;
|
|
326
|
+
} else {
|
|
327
|
+
t21 = $[50];
|
|
328
|
+
}
|
|
329
|
+
let t22;
|
|
330
|
+
if ($[51] !== t) {
|
|
331
|
+
t22 = t("studio_policy_behavior");
|
|
332
|
+
$[51] = t;
|
|
333
|
+
$[52] = t22;
|
|
334
|
+
} else {
|
|
335
|
+
t22 = $[52];
|
|
336
|
+
}
|
|
337
|
+
let t23;
|
|
338
|
+
if ($[53] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
339
|
+
t23 = /* @__PURE__ */ jsx("code", { className: "text-[10px] bg-surface-200 dark:bg-surface-950 text-text-secondary dark:text-text-secondary-dark px-1 py-0.5 rounded ml-1", children: "AS" });
|
|
340
|
+
$[53] = t23;
|
|
341
|
+
} else {
|
|
342
|
+
t23 = $[53];
|
|
343
|
+
}
|
|
344
|
+
let t24;
|
|
345
|
+
if ($[54] !== t22) {
|
|
346
|
+
t24 = /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "uppercase tracking-wider text-text-secondary", children: [
|
|
347
|
+
t22,
|
|
348
|
+
" ",
|
|
349
|
+
t23
|
|
350
|
+
] });
|
|
351
|
+
$[54] = t22;
|
|
352
|
+
$[55] = t24;
|
|
353
|
+
} else {
|
|
354
|
+
t24 = $[55];
|
|
355
|
+
}
|
|
356
|
+
let t25;
|
|
357
|
+
if ($[56] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
358
|
+
t25 = (val) => setBehavior(val);
|
|
359
|
+
$[56] = t25;
|
|
360
|
+
} else {
|
|
361
|
+
t25 = $[56];
|
|
362
|
+
}
|
|
363
|
+
let t26;
|
|
364
|
+
if ($[57] !== t) {
|
|
365
|
+
t26 = t("studio_policy_permissive");
|
|
366
|
+
$[57] = t;
|
|
367
|
+
$[58] = t26;
|
|
368
|
+
} else {
|
|
369
|
+
t26 = $[58];
|
|
370
|
+
}
|
|
371
|
+
let t27;
|
|
372
|
+
if ($[59] !== t26) {
|
|
373
|
+
t27 = /* @__PURE__ */ jsx("span", { className: "", children: t26 });
|
|
374
|
+
$[59] = t26;
|
|
375
|
+
$[60] = t27;
|
|
376
|
+
} else {
|
|
377
|
+
t27 = $[60];
|
|
378
|
+
}
|
|
379
|
+
let t28;
|
|
380
|
+
if ($[61] !== t) {
|
|
381
|
+
t28 = t("studio_policy_permissive_desc");
|
|
382
|
+
$[61] = t;
|
|
383
|
+
$[62] = t28;
|
|
384
|
+
} else {
|
|
385
|
+
t28 = $[62];
|
|
386
|
+
}
|
|
387
|
+
let t29;
|
|
388
|
+
if ($[63] !== t28) {
|
|
389
|
+
t29 = /* @__PURE__ */ jsx("span", { className: "text-xs text-text-secondary dark:text-text-secondary-dark", children: t28 });
|
|
390
|
+
$[63] = t28;
|
|
391
|
+
$[64] = t29;
|
|
392
|
+
} else {
|
|
393
|
+
t29 = $[64];
|
|
394
|
+
}
|
|
395
|
+
let t30;
|
|
396
|
+
if ($[65] !== t27 || $[66] !== t29) {
|
|
397
|
+
t30 = /* @__PURE__ */ jsx(SelectItem, { value: "PERMISSIVE", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col text-left", children: [
|
|
398
|
+
t27,
|
|
399
|
+
t29
|
|
400
|
+
] }) });
|
|
401
|
+
$[65] = t27;
|
|
402
|
+
$[66] = t29;
|
|
403
|
+
$[67] = t30;
|
|
404
|
+
} else {
|
|
405
|
+
t30 = $[67];
|
|
406
|
+
}
|
|
407
|
+
let t31;
|
|
408
|
+
if ($[68] !== t) {
|
|
409
|
+
t31 = t("studio_policy_restrictive");
|
|
410
|
+
$[68] = t;
|
|
411
|
+
$[69] = t31;
|
|
412
|
+
} else {
|
|
413
|
+
t31 = $[69];
|
|
414
|
+
}
|
|
415
|
+
let t32;
|
|
416
|
+
if ($[70] !== t31) {
|
|
417
|
+
t32 = /* @__PURE__ */ jsx("span", { className: "", children: t31 });
|
|
418
|
+
$[70] = t31;
|
|
419
|
+
$[71] = t32;
|
|
420
|
+
} else {
|
|
421
|
+
t32 = $[71];
|
|
422
|
+
}
|
|
423
|
+
let t33;
|
|
424
|
+
if ($[72] !== t) {
|
|
425
|
+
t33 = t("studio_policy_restrictive_desc");
|
|
426
|
+
$[72] = t;
|
|
427
|
+
$[73] = t33;
|
|
428
|
+
} else {
|
|
429
|
+
t33 = $[73];
|
|
430
|
+
}
|
|
431
|
+
let t34;
|
|
432
|
+
if ($[74] !== t33) {
|
|
433
|
+
t34 = /* @__PURE__ */ jsx("span", { className: "text-xs text-text-secondary dark:text-text-secondary-dark", children: t33 });
|
|
434
|
+
$[74] = t33;
|
|
435
|
+
$[75] = t34;
|
|
436
|
+
} else {
|
|
437
|
+
t34 = $[75];
|
|
438
|
+
}
|
|
439
|
+
let t35;
|
|
440
|
+
if ($[76] !== t32 || $[77] !== t34) {
|
|
441
|
+
t35 = /* @__PURE__ */ jsx(SelectItem, { value: "RESTRICTIVE", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col text-left", children: [
|
|
442
|
+
t32,
|
|
443
|
+
t34
|
|
444
|
+
] }) });
|
|
445
|
+
$[76] = t32;
|
|
446
|
+
$[77] = t34;
|
|
447
|
+
$[78] = t35;
|
|
448
|
+
} else {
|
|
449
|
+
t35 = $[78];
|
|
450
|
+
}
|
|
451
|
+
let t36;
|
|
452
|
+
if ($[79] !== behavior || $[80] !== t30 || $[81] !== t35) {
|
|
453
|
+
t36 = /* @__PURE__ */ jsxs(Select, { value: behavior, onValueChange: t25, position: "item-aligned", children: [
|
|
454
|
+
t30,
|
|
455
|
+
t35
|
|
456
|
+
] });
|
|
457
|
+
$[79] = behavior;
|
|
458
|
+
$[80] = t30;
|
|
459
|
+
$[81] = t35;
|
|
460
|
+
$[82] = t36;
|
|
461
|
+
} else {
|
|
462
|
+
t36 = $[82];
|
|
463
|
+
}
|
|
464
|
+
let t37;
|
|
465
|
+
if ($[83] !== t24 || $[84] !== t36) {
|
|
466
|
+
t37 = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
467
|
+
t24,
|
|
468
|
+
t36
|
|
469
|
+
] });
|
|
470
|
+
$[83] = t24;
|
|
471
|
+
$[84] = t36;
|
|
472
|
+
$[85] = t37;
|
|
473
|
+
} else {
|
|
474
|
+
t37 = $[85];
|
|
475
|
+
}
|
|
476
|
+
let t38;
|
|
477
|
+
if ($[86] !== t21 || $[87] !== t37) {
|
|
478
|
+
t38 = /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 sm:gap-6", children: [
|
|
479
|
+
t21,
|
|
480
|
+
t37
|
|
481
|
+
] });
|
|
482
|
+
$[86] = t21;
|
|
483
|
+
$[87] = t37;
|
|
484
|
+
$[88] = t38;
|
|
485
|
+
} else {
|
|
486
|
+
t38 = $[88];
|
|
487
|
+
}
|
|
488
|
+
let t39;
|
|
489
|
+
if ($[89] !== t) {
|
|
490
|
+
t39 = t("studio_policy_command");
|
|
491
|
+
$[89] = t;
|
|
492
|
+
$[90] = t39;
|
|
493
|
+
} else {
|
|
494
|
+
t39 = $[90];
|
|
495
|
+
}
|
|
496
|
+
let t40;
|
|
497
|
+
if ($[91] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
498
|
+
t40 = /* @__PURE__ */ jsx("code", { className: "text-[10px] bg-surface-200 dark:bg-surface-950 text-text-secondary dark:text-text-secondary-dark px-1 py-0.5 rounded ml-1", children: "FOR" });
|
|
499
|
+
$[91] = t40;
|
|
500
|
+
} else {
|
|
501
|
+
t40 = $[91];
|
|
502
|
+
}
|
|
503
|
+
let t41;
|
|
504
|
+
if ($[92] !== t39) {
|
|
505
|
+
t41 = /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "uppercase tracking-wider text-text-secondary", children: [
|
|
506
|
+
t39,
|
|
507
|
+
" ",
|
|
508
|
+
t40
|
|
509
|
+
] });
|
|
510
|
+
$[92] = t39;
|
|
511
|
+
$[93] = t41;
|
|
512
|
+
} else {
|
|
513
|
+
t41 = $[93];
|
|
514
|
+
}
|
|
515
|
+
let t42;
|
|
516
|
+
if ($[94] !== command) {
|
|
517
|
+
t42 = COMMAND_OPTIONS.map((cmd) => /* @__PURE__ */ jsx(Button, { size: "small", variant: command === cmd ? "filled" : "text", color: "neutral", onClick: () => setCommand(cmd), className: "min-w-[80px]", children: cmd }, cmd));
|
|
518
|
+
$[94] = command;
|
|
519
|
+
$[95] = t42;
|
|
520
|
+
} else {
|
|
521
|
+
t42 = $[95];
|
|
522
|
+
}
|
|
523
|
+
let t43;
|
|
524
|
+
if ($[96] !== t42) {
|
|
525
|
+
t43 = /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: t42 });
|
|
526
|
+
$[96] = t42;
|
|
527
|
+
$[97] = t43;
|
|
528
|
+
} else {
|
|
529
|
+
t43 = $[97];
|
|
530
|
+
}
|
|
531
|
+
let t44;
|
|
532
|
+
if ($[98] !== t41 || $[99] !== t43) {
|
|
533
|
+
t44 = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
534
|
+
t41,
|
|
535
|
+
t43
|
|
536
|
+
] });
|
|
537
|
+
$[98] = t41;
|
|
538
|
+
$[99] = t43;
|
|
539
|
+
$[100] = t44;
|
|
540
|
+
} else {
|
|
541
|
+
t44 = $[100];
|
|
542
|
+
}
|
|
543
|
+
let t45;
|
|
544
|
+
if ($[101] !== t) {
|
|
545
|
+
t45 = t("studio_policy_target_roles");
|
|
546
|
+
$[101] = t;
|
|
547
|
+
$[102] = t45;
|
|
548
|
+
} else {
|
|
549
|
+
t45 = $[102];
|
|
550
|
+
}
|
|
551
|
+
let t46;
|
|
552
|
+
if ($[103] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
553
|
+
t46 = /* @__PURE__ */ jsx("code", { className: "text-[10px] bg-surface-200 dark:bg-surface-950 text-text-secondary dark:text-text-secondary-dark px-1 py-0.5 rounded ml-1", children: "TO" });
|
|
554
|
+
$[103] = t46;
|
|
555
|
+
} else {
|
|
556
|
+
t46 = $[103];
|
|
557
|
+
}
|
|
558
|
+
let t47;
|
|
559
|
+
if ($[104] !== t45) {
|
|
560
|
+
t47 = /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "uppercase tracking-wider text-text-secondary", children: [
|
|
561
|
+
t45,
|
|
562
|
+
" ",
|
|
563
|
+
t46
|
|
564
|
+
] });
|
|
565
|
+
$[104] = t45;
|
|
566
|
+
$[105] = t47;
|
|
567
|
+
} else {
|
|
568
|
+
t47 = $[105];
|
|
569
|
+
}
|
|
570
|
+
let t48;
|
|
571
|
+
if ($[106] !== t) {
|
|
572
|
+
t48 = t("studio_policy_roles_placeholder");
|
|
573
|
+
$[106] = t;
|
|
574
|
+
$[107] = t48;
|
|
575
|
+
} else {
|
|
576
|
+
t48 = $[107];
|
|
577
|
+
}
|
|
578
|
+
let t49;
|
|
579
|
+
if ($[108] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
580
|
+
t49 = ROLE_OPTIONS.map(_temp2);
|
|
581
|
+
$[108] = t49;
|
|
582
|
+
} else {
|
|
583
|
+
t49 = $[108];
|
|
584
|
+
}
|
|
585
|
+
let t50;
|
|
586
|
+
if ($[109] !== roles || $[110] !== t48) {
|
|
587
|
+
t50 = /* @__PURE__ */ jsx(MultiSelect, { size: "small", value: roles, onValueChange: setRoles, placeholder: t48, children: t49 });
|
|
588
|
+
$[109] = roles;
|
|
589
|
+
$[110] = t48;
|
|
590
|
+
$[111] = t50;
|
|
591
|
+
} else {
|
|
592
|
+
t50 = $[111];
|
|
593
|
+
}
|
|
594
|
+
let t51;
|
|
595
|
+
if ($[112] !== t47 || $[113] !== t50) {
|
|
596
|
+
t51 = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
597
|
+
t47,
|
|
598
|
+
t50
|
|
599
|
+
] });
|
|
600
|
+
$[112] = t47;
|
|
601
|
+
$[113] = t50;
|
|
602
|
+
$[114] = t51;
|
|
603
|
+
} else {
|
|
604
|
+
t51 = $[114];
|
|
605
|
+
}
|
|
606
|
+
let t52;
|
|
607
|
+
if ($[115] !== t15 || $[116] !== t38 || $[117] !== t44 || $[118] !== t51) {
|
|
608
|
+
t52 = /* @__PURE__ */ jsxs(Paper, { className: t14, children: [
|
|
609
|
+
t15,
|
|
610
|
+
t38,
|
|
611
|
+
t44,
|
|
612
|
+
t51
|
|
613
|
+
] });
|
|
614
|
+
$[115] = t15;
|
|
615
|
+
$[116] = t38;
|
|
616
|
+
$[117] = t44;
|
|
617
|
+
$[118] = t51;
|
|
618
|
+
$[119] = t52;
|
|
619
|
+
} else {
|
|
620
|
+
t52 = $[119];
|
|
621
|
+
}
|
|
622
|
+
let t53;
|
|
623
|
+
if ($[120] !== command || $[121] !== t || $[122] !== usingExpr) {
|
|
624
|
+
t53 = command !== "INSERT" && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
625
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
|
|
626
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "uppercase tracking-wider text-text-secondary", children: t("studio_policy_using_expr") }),
|
|
627
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-text-secondary opacity-70", children: t("studio_policy_using_expr_desc") })
|
|
628
|
+
] }),
|
|
629
|
+
/* @__PURE__ */ jsx("div", { className: cls("h-32 border rounded-md overflow-hidden bg-white dark:bg-[#1e1e1e]", defaultBorderMixin), children: /* @__PURE__ */ jsx(MonacoEditor, { value: usingExpr, onChange: (v) => setUsingExpr(v || ""), readOnly: false, autoFocus: true }) })
|
|
630
|
+
] });
|
|
631
|
+
$[120] = command;
|
|
632
|
+
$[121] = t;
|
|
633
|
+
$[122] = usingExpr;
|
|
634
|
+
$[123] = t53;
|
|
635
|
+
} else {
|
|
636
|
+
t53 = $[123];
|
|
637
|
+
}
|
|
638
|
+
let t54;
|
|
639
|
+
if ($[124] !== checkExpr || $[125] !== command || $[126] !== showCheck || $[127] !== t) {
|
|
640
|
+
t54 = showCheck && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5 mt-2", children: [
|
|
641
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
|
|
642
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "uppercase tracking-wider text-text-secondary", children: t("studio_policy_check_expr") }),
|
|
643
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-text-secondary opacity-70", children: t("studio_policy_check_expr_desc") })
|
|
644
|
+
] }),
|
|
645
|
+
/* @__PURE__ */ jsx("div", { className: cls("h-32 border rounded-md overflow-hidden bg-white dark:bg-[#1e1e1e]", defaultBorderMixin), children: /* @__PURE__ */ jsx(MonacoEditor, { value: checkExpr, onChange: (v_0) => setCheckExpr(v_0 || ""), readOnly: false, autoFocus: command === "INSERT" }) })
|
|
646
|
+
] });
|
|
647
|
+
$[124] = checkExpr;
|
|
648
|
+
$[125] = command;
|
|
649
|
+
$[126] = showCheck;
|
|
650
|
+
$[127] = t;
|
|
651
|
+
$[128] = t54;
|
|
652
|
+
} else {
|
|
653
|
+
t54 = $[128];
|
|
654
|
+
}
|
|
655
|
+
let t55;
|
|
656
|
+
if ($[129] !== t53 || $[130] !== t54) {
|
|
657
|
+
t55 = /* @__PURE__ */ jsxs("div", { className: "mt-8 flex flex-col gap-4", children: [
|
|
658
|
+
t53,
|
|
659
|
+
t54
|
|
660
|
+
] });
|
|
661
|
+
$[129] = t53;
|
|
662
|
+
$[130] = t54;
|
|
663
|
+
$[131] = t55;
|
|
664
|
+
} else {
|
|
665
|
+
t55 = $[131];
|
|
666
|
+
}
|
|
667
|
+
let t56;
|
|
668
|
+
if ($[132] !== t52 || $[133] !== t55) {
|
|
669
|
+
t56 = /* @__PURE__ */ jsx(DialogContent, { className: "p-4 md:p-6 border-t dark:border-surface-950 bg-surface-50 dark:bg-surface-950", includeMargin: false, children: /* @__PURE__ */ jsxs("div", { className: "max-w-4xl mx-auto", children: [
|
|
670
|
+
t52,
|
|
671
|
+
t55
|
|
672
|
+
] }) });
|
|
673
|
+
$[132] = t52;
|
|
674
|
+
$[133] = t55;
|
|
675
|
+
$[134] = t56;
|
|
676
|
+
} else {
|
|
677
|
+
t56 = $[134];
|
|
678
|
+
}
|
|
679
|
+
let t57;
|
|
680
|
+
if ($[135] !== t) {
|
|
681
|
+
t57 = t("studio_policy_cancel");
|
|
682
|
+
$[135] = t;
|
|
683
|
+
$[136] = t57;
|
|
684
|
+
} else {
|
|
685
|
+
t57 = $[136];
|
|
686
|
+
}
|
|
687
|
+
let t58;
|
|
688
|
+
if ($[137] !== onCancel || $[138] !== t57) {
|
|
689
|
+
t58 = /* @__PURE__ */ jsx(Button, { size: "small", variant: "text", color: "neutral", onClick: onCancel, children: t57 });
|
|
690
|
+
$[137] = onCancel;
|
|
691
|
+
$[138] = t57;
|
|
692
|
+
$[139] = t58;
|
|
693
|
+
} else {
|
|
694
|
+
t58 = $[139];
|
|
695
|
+
}
|
|
696
|
+
const t59 = !name;
|
|
697
|
+
let t60;
|
|
698
|
+
if ($[140] !== t) {
|
|
699
|
+
t60 = t("studio_policy_save");
|
|
700
|
+
$[140] = t;
|
|
701
|
+
$[141] = t60;
|
|
702
|
+
} else {
|
|
703
|
+
t60 = $[141];
|
|
704
|
+
}
|
|
705
|
+
let t61;
|
|
706
|
+
if ($[142] !== handleSave || $[143] !== t59 || $[144] !== t60) {
|
|
707
|
+
t61 = /* @__PURE__ */ jsx(Button, { size: "small", variant: "filled", color: "primary", onClick: handleSave, disabled: t59, children: t60 });
|
|
708
|
+
$[142] = handleSave;
|
|
709
|
+
$[143] = t59;
|
|
710
|
+
$[144] = t60;
|
|
711
|
+
$[145] = t61;
|
|
712
|
+
} else {
|
|
713
|
+
t61 = $[145];
|
|
714
|
+
}
|
|
715
|
+
let t62;
|
|
716
|
+
if ($[146] !== t58 || $[147] !== t61) {
|
|
717
|
+
t62 = /* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
718
|
+
t58,
|
|
719
|
+
t61
|
|
720
|
+
] });
|
|
721
|
+
$[146] = t58;
|
|
722
|
+
$[147] = t61;
|
|
723
|
+
$[148] = t62;
|
|
724
|
+
} else {
|
|
725
|
+
t62 = $[148];
|
|
726
|
+
}
|
|
727
|
+
let t63;
|
|
728
|
+
if ($[149] !== t) {
|
|
729
|
+
t63 = t("studio_policy_help_title");
|
|
730
|
+
$[149] = t;
|
|
731
|
+
$[150] = t63;
|
|
732
|
+
} else {
|
|
733
|
+
t63 = $[150];
|
|
734
|
+
}
|
|
735
|
+
let t64;
|
|
736
|
+
if ($[151] !== t63) {
|
|
737
|
+
t64 = /* @__PURE__ */ jsx(Typography, { variant: "h5", className: "mb-2", children: t63 });
|
|
738
|
+
$[151] = t63;
|
|
739
|
+
$[152] = t64;
|
|
740
|
+
} else {
|
|
741
|
+
t64 = $[152];
|
|
742
|
+
}
|
|
743
|
+
let t65;
|
|
744
|
+
if ($[153] !== t) {
|
|
745
|
+
t65 = t("studio_policy_help_intro");
|
|
746
|
+
$[153] = t;
|
|
747
|
+
$[154] = t65;
|
|
748
|
+
} else {
|
|
749
|
+
t65 = $[154];
|
|
750
|
+
}
|
|
751
|
+
let t66;
|
|
752
|
+
if ($[155] !== t65) {
|
|
753
|
+
t66 = /* @__PURE__ */ jsx(Typography, { className: "text-text-secondary dark:text-text-secondary-dark", children: t65 });
|
|
754
|
+
$[155] = t65;
|
|
755
|
+
$[156] = t66;
|
|
756
|
+
} else {
|
|
757
|
+
t66 = $[156];
|
|
758
|
+
}
|
|
759
|
+
let t67;
|
|
760
|
+
if ($[157] !== t64 || $[158] !== t66) {
|
|
761
|
+
t67 = /* @__PURE__ */ jsxs("div", { children: [
|
|
762
|
+
t64,
|
|
763
|
+
t66
|
|
764
|
+
] });
|
|
765
|
+
$[157] = t64;
|
|
766
|
+
$[158] = t66;
|
|
767
|
+
$[159] = t67;
|
|
768
|
+
} else {
|
|
769
|
+
t67 = $[159];
|
|
770
|
+
}
|
|
771
|
+
let t68;
|
|
772
|
+
if ($[160] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
773
|
+
t68 = cls("p-4 sm:p-5 flex flex-col gap-1", defaultBorderMixin);
|
|
774
|
+
$[160] = t68;
|
|
775
|
+
} else {
|
|
776
|
+
t68 = $[160];
|
|
777
|
+
}
|
|
778
|
+
let t69;
|
|
779
|
+
if ($[161] !== t) {
|
|
780
|
+
t69 = t("studio_policy_help_step1_title");
|
|
781
|
+
$[161] = t;
|
|
782
|
+
$[162] = t69;
|
|
783
|
+
} else {
|
|
784
|
+
t69 = $[162];
|
|
785
|
+
}
|
|
786
|
+
let t70;
|
|
787
|
+
if ($[163] !== t69) {
|
|
788
|
+
t70 = /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "text-primary dark:text-primary-light font-medium", children: t69 });
|
|
789
|
+
$[163] = t69;
|
|
790
|
+
$[164] = t70;
|
|
791
|
+
} else {
|
|
792
|
+
t70 = $[164];
|
|
793
|
+
}
|
|
794
|
+
let t71;
|
|
795
|
+
if ($[165] !== t) {
|
|
796
|
+
t71 = t("studio_policy_help_step1_desc");
|
|
797
|
+
$[165] = t;
|
|
798
|
+
$[166] = t71;
|
|
799
|
+
} else {
|
|
800
|
+
t71 = $[166];
|
|
801
|
+
}
|
|
802
|
+
let t72;
|
|
803
|
+
if ($[167] !== t71) {
|
|
804
|
+
t72 = /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-text-secondary dark:text-text-secondary-dark", children: t71 });
|
|
805
|
+
$[167] = t71;
|
|
806
|
+
$[168] = t72;
|
|
807
|
+
} else {
|
|
808
|
+
t72 = $[168];
|
|
809
|
+
}
|
|
810
|
+
let t73;
|
|
811
|
+
if ($[169] !== t70 || $[170] !== t72) {
|
|
812
|
+
t73 = /* @__PURE__ */ jsxs(Paper, { className: t68, children: [
|
|
813
|
+
t70,
|
|
814
|
+
t72
|
|
815
|
+
] });
|
|
816
|
+
$[169] = t70;
|
|
817
|
+
$[170] = t72;
|
|
818
|
+
$[171] = t73;
|
|
819
|
+
} else {
|
|
820
|
+
t73 = $[171];
|
|
821
|
+
}
|
|
822
|
+
let t74;
|
|
823
|
+
if ($[172] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
824
|
+
t74 = cls("p-4 sm:p-5 flex flex-col gap-1", defaultBorderMixin);
|
|
825
|
+
$[172] = t74;
|
|
826
|
+
} else {
|
|
827
|
+
t74 = $[172];
|
|
828
|
+
}
|
|
829
|
+
let t75;
|
|
830
|
+
if ($[173] !== t) {
|
|
831
|
+
t75 = t("studio_policy_help_step2_title");
|
|
832
|
+
$[173] = t;
|
|
833
|
+
$[174] = t75;
|
|
834
|
+
} else {
|
|
835
|
+
t75 = $[174];
|
|
836
|
+
}
|
|
837
|
+
let t76;
|
|
838
|
+
if ($[175] !== t75) {
|
|
839
|
+
t76 = /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "text-primary dark:text-primary-light font-medium", children: t75 });
|
|
840
|
+
$[175] = t75;
|
|
841
|
+
$[176] = t76;
|
|
842
|
+
} else {
|
|
843
|
+
t76 = $[176];
|
|
844
|
+
}
|
|
845
|
+
let t77;
|
|
846
|
+
if ($[177] !== t) {
|
|
847
|
+
t77 = t("studio_policy_help_step2_desc");
|
|
848
|
+
$[177] = t;
|
|
849
|
+
$[178] = t77;
|
|
850
|
+
} else {
|
|
851
|
+
t77 = $[178];
|
|
852
|
+
}
|
|
853
|
+
let t78;
|
|
854
|
+
if ($[179] !== t77) {
|
|
855
|
+
t78 = /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-text-secondary dark:text-text-secondary-dark mb-1", children: t77 });
|
|
856
|
+
$[179] = t77;
|
|
857
|
+
$[180] = t78;
|
|
858
|
+
} else {
|
|
859
|
+
t78 = $[180];
|
|
860
|
+
}
|
|
861
|
+
let t79;
|
|
862
|
+
if ($[181] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
863
|
+
t79 = /* @__PURE__ */ jsx("strong", { children: "public" });
|
|
864
|
+
$[181] = t79;
|
|
865
|
+
} else {
|
|
866
|
+
t79 = $[181];
|
|
867
|
+
}
|
|
868
|
+
let t80;
|
|
869
|
+
if ($[182] !== t) {
|
|
870
|
+
t80 = t("studio_policy_help_role_public");
|
|
871
|
+
$[182] = t;
|
|
872
|
+
$[183] = t80;
|
|
873
|
+
} else {
|
|
874
|
+
t80 = $[183];
|
|
875
|
+
}
|
|
876
|
+
let t81;
|
|
877
|
+
if ($[184] !== t80) {
|
|
878
|
+
t81 = /* @__PURE__ */ jsxs("li", { children: [
|
|
879
|
+
t79,
|
|
880
|
+
": ",
|
|
881
|
+
t80
|
|
882
|
+
] });
|
|
883
|
+
$[184] = t80;
|
|
884
|
+
$[185] = t81;
|
|
885
|
+
} else {
|
|
886
|
+
t81 = $[185];
|
|
887
|
+
}
|
|
888
|
+
let t82;
|
|
889
|
+
if ($[186] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
890
|
+
t82 = /* @__PURE__ */ jsx("strong", { children: "authenticated" });
|
|
891
|
+
$[186] = t82;
|
|
892
|
+
} else {
|
|
893
|
+
t82 = $[186];
|
|
894
|
+
}
|
|
895
|
+
let t83;
|
|
896
|
+
if ($[187] !== t) {
|
|
897
|
+
t83 = t("studio_policy_help_role_authenticated");
|
|
898
|
+
$[187] = t;
|
|
899
|
+
$[188] = t83;
|
|
900
|
+
} else {
|
|
901
|
+
t83 = $[188];
|
|
902
|
+
}
|
|
903
|
+
let t84;
|
|
904
|
+
if ($[189] !== t83) {
|
|
905
|
+
t84 = /* @__PURE__ */ jsxs("li", { children: [
|
|
906
|
+
t82,
|
|
907
|
+
": ",
|
|
908
|
+
t83
|
|
909
|
+
] });
|
|
910
|
+
$[189] = t83;
|
|
911
|
+
$[190] = t84;
|
|
912
|
+
} else {
|
|
913
|
+
t84 = $[190];
|
|
914
|
+
}
|
|
915
|
+
let t85;
|
|
916
|
+
if ($[191] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
917
|
+
t85 = /* @__PURE__ */ jsx("strong", { children: "anon" });
|
|
918
|
+
$[191] = t85;
|
|
919
|
+
} else {
|
|
920
|
+
t85 = $[191];
|
|
921
|
+
}
|
|
922
|
+
let t86;
|
|
923
|
+
if ($[192] !== t) {
|
|
924
|
+
t86 = t("studio_policy_help_role_anon");
|
|
925
|
+
$[192] = t;
|
|
926
|
+
$[193] = t86;
|
|
927
|
+
} else {
|
|
928
|
+
t86 = $[193];
|
|
929
|
+
}
|
|
930
|
+
let t87;
|
|
931
|
+
if ($[194] !== t86) {
|
|
932
|
+
t87 = /* @__PURE__ */ jsxs("li", { children: [
|
|
933
|
+
t85,
|
|
934
|
+
": ",
|
|
935
|
+
t86
|
|
936
|
+
] });
|
|
937
|
+
$[194] = t86;
|
|
938
|
+
$[195] = t87;
|
|
939
|
+
} else {
|
|
940
|
+
t87 = $[195];
|
|
941
|
+
}
|
|
942
|
+
let t88;
|
|
943
|
+
if ($[196] !== t81 || $[197] !== t84 || $[198] !== t87) {
|
|
944
|
+
t88 = /* @__PURE__ */ jsxs("ul", { className: "list-disc pl-5 space-y-1 text-sm text-text-secondary dark:text-text-secondary-dark", children: [
|
|
945
|
+
t81,
|
|
946
|
+
t84,
|
|
947
|
+
t87
|
|
948
|
+
] });
|
|
949
|
+
$[196] = t81;
|
|
950
|
+
$[197] = t84;
|
|
951
|
+
$[198] = t87;
|
|
952
|
+
$[199] = t88;
|
|
953
|
+
} else {
|
|
954
|
+
t88 = $[199];
|
|
955
|
+
}
|
|
956
|
+
let t89;
|
|
957
|
+
if ($[200] !== t76 || $[201] !== t78 || $[202] !== t88) {
|
|
958
|
+
t89 = /* @__PURE__ */ jsxs(Paper, { className: t74, children: [
|
|
959
|
+
t76,
|
|
960
|
+
t78,
|
|
961
|
+
t88
|
|
962
|
+
] });
|
|
963
|
+
$[200] = t76;
|
|
964
|
+
$[201] = t78;
|
|
965
|
+
$[202] = t88;
|
|
966
|
+
$[203] = t89;
|
|
967
|
+
} else {
|
|
968
|
+
t89 = $[203];
|
|
969
|
+
}
|
|
970
|
+
let t90;
|
|
971
|
+
if ($[204] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
972
|
+
t90 = cls("p-4 sm:p-5 flex flex-col gap-1", defaultBorderMixin);
|
|
973
|
+
$[204] = t90;
|
|
974
|
+
} else {
|
|
975
|
+
t90 = $[204];
|
|
976
|
+
}
|
|
977
|
+
let t91;
|
|
978
|
+
if ($[205] !== t) {
|
|
979
|
+
t91 = t("studio_policy_help_step3_title");
|
|
980
|
+
$[205] = t;
|
|
981
|
+
$[206] = t91;
|
|
982
|
+
} else {
|
|
983
|
+
t91 = $[206];
|
|
984
|
+
}
|
|
985
|
+
let t92;
|
|
986
|
+
if ($[207] !== t91) {
|
|
987
|
+
t92 = /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "text-primary dark:text-primary-light font-medium", children: t91 });
|
|
988
|
+
$[207] = t91;
|
|
989
|
+
$[208] = t92;
|
|
990
|
+
} else {
|
|
991
|
+
t92 = $[208];
|
|
992
|
+
}
|
|
993
|
+
let t93;
|
|
994
|
+
if ($[209] !== t) {
|
|
995
|
+
t93 = t("studio_policy_help_step3_desc");
|
|
996
|
+
$[209] = t;
|
|
997
|
+
$[210] = t93;
|
|
998
|
+
} else {
|
|
999
|
+
t93 = $[210];
|
|
1000
|
+
}
|
|
1001
|
+
let t94;
|
|
1002
|
+
if ($[211] !== t93) {
|
|
1003
|
+
t94 = /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-text-secondary dark:text-text-secondary-dark mb-1", children: t93 });
|
|
1004
|
+
$[211] = t93;
|
|
1005
|
+
$[212] = t94;
|
|
1006
|
+
} else {
|
|
1007
|
+
t94 = $[212];
|
|
1008
|
+
}
|
|
1009
|
+
let t95;
|
|
1010
|
+
if ($[213] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1011
|
+
t95 = /* @__PURE__ */ jsx("div", { className: cls("bg-surface-100 dark:bg-surface-950 px-3 py-2 rounded-md font-mono text-sm my-2", defaultBorderMixin), children: "Example: auth.uid() = user_id" });
|
|
1012
|
+
$[213] = t95;
|
|
1013
|
+
} else {
|
|
1014
|
+
t95 = $[213];
|
|
1015
|
+
}
|
|
1016
|
+
let t96;
|
|
1017
|
+
if ($[214] !== t) {
|
|
1018
|
+
t96 = t("studio_policy_help_step3_example");
|
|
1019
|
+
$[214] = t;
|
|
1020
|
+
$[215] = t96;
|
|
1021
|
+
} else {
|
|
1022
|
+
t96 = $[215];
|
|
1023
|
+
}
|
|
1024
|
+
let t97;
|
|
1025
|
+
if ($[216] !== t96) {
|
|
1026
|
+
t97 = /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-text-secondary dark:text-text-secondary-dark", children: t96 });
|
|
1027
|
+
$[216] = t96;
|
|
1028
|
+
$[217] = t97;
|
|
1029
|
+
} else {
|
|
1030
|
+
t97 = $[217];
|
|
1031
|
+
}
|
|
1032
|
+
let t98;
|
|
1033
|
+
if ($[218] !== t92 || $[219] !== t94 || $[220] !== t97) {
|
|
1034
|
+
t98 = /* @__PURE__ */ jsxs(Paper, { className: t90, children: [
|
|
1035
|
+
t92,
|
|
1036
|
+
t94,
|
|
1037
|
+
t95,
|
|
1038
|
+
t97
|
|
1039
|
+
] });
|
|
1040
|
+
$[218] = t92;
|
|
1041
|
+
$[219] = t94;
|
|
1042
|
+
$[220] = t97;
|
|
1043
|
+
$[221] = t98;
|
|
1044
|
+
} else {
|
|
1045
|
+
t98 = $[221];
|
|
1046
|
+
}
|
|
1047
|
+
let t99;
|
|
1048
|
+
if ($[222] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1049
|
+
t99 = cls("p-4 sm:p-5 flex flex-col gap-1", defaultBorderMixin);
|
|
1050
|
+
$[222] = t99;
|
|
1051
|
+
} else {
|
|
1052
|
+
t99 = $[222];
|
|
1053
|
+
}
|
|
1054
|
+
let t100;
|
|
1055
|
+
if ($[223] !== t) {
|
|
1056
|
+
t100 = t("studio_policy_help_step4_title");
|
|
1057
|
+
$[223] = t;
|
|
1058
|
+
$[224] = t100;
|
|
1059
|
+
} else {
|
|
1060
|
+
t100 = $[224];
|
|
1061
|
+
}
|
|
1062
|
+
let t101;
|
|
1063
|
+
if ($[225] !== t100) {
|
|
1064
|
+
t101 = /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "text-primary dark:text-primary-light font-medium", children: t100 });
|
|
1065
|
+
$[225] = t100;
|
|
1066
|
+
$[226] = t101;
|
|
1067
|
+
} else {
|
|
1068
|
+
t101 = $[226];
|
|
1069
|
+
}
|
|
1070
|
+
let t102;
|
|
1071
|
+
if ($[227] !== t) {
|
|
1072
|
+
t102 = t("studio_policy_help_step4_desc");
|
|
1073
|
+
$[227] = t;
|
|
1074
|
+
$[228] = t102;
|
|
1075
|
+
} else {
|
|
1076
|
+
t102 = $[228];
|
|
1077
|
+
}
|
|
1078
|
+
let t103;
|
|
1079
|
+
if ($[229] !== t102) {
|
|
1080
|
+
t103 = /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-text-secondary dark:text-text-secondary-dark mb-1", children: t102 });
|
|
1081
|
+
$[229] = t102;
|
|
1082
|
+
$[230] = t103;
|
|
1083
|
+
} else {
|
|
1084
|
+
t103 = $[230];
|
|
1085
|
+
}
|
|
1086
|
+
let t104;
|
|
1087
|
+
if ($[231] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1088
|
+
t104 = /* @__PURE__ */ jsx("div", { className: cls("bg-surface-100 dark:bg-surface-950 px-3 py-2 rounded-md font-mono text-sm my-2", defaultBorderMixin), children: "Example: auth.uid() = user_id" });
|
|
1089
|
+
$[231] = t104;
|
|
1090
|
+
} else {
|
|
1091
|
+
t104 = $[231];
|
|
1092
|
+
}
|
|
1093
|
+
let t105;
|
|
1094
|
+
if ($[232] !== t) {
|
|
1095
|
+
t105 = t("studio_policy_help_step4_example");
|
|
1096
|
+
$[232] = t;
|
|
1097
|
+
$[233] = t105;
|
|
1098
|
+
} else {
|
|
1099
|
+
t105 = $[233];
|
|
1100
|
+
}
|
|
1101
|
+
let t106;
|
|
1102
|
+
if ($[234] !== t105) {
|
|
1103
|
+
t106 = /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-text-secondary dark:text-text-secondary-dark", children: t105 });
|
|
1104
|
+
$[234] = t105;
|
|
1105
|
+
$[235] = t106;
|
|
1106
|
+
} else {
|
|
1107
|
+
t106 = $[235];
|
|
1108
|
+
}
|
|
1109
|
+
let t107;
|
|
1110
|
+
if ($[236] !== t101 || $[237] !== t103 || $[238] !== t106) {
|
|
1111
|
+
t107 = /* @__PURE__ */ jsxs(Paper, { className: t99, children: [
|
|
1112
|
+
t101,
|
|
1113
|
+
t103,
|
|
1114
|
+
t104,
|
|
1115
|
+
t106
|
|
1116
|
+
] });
|
|
1117
|
+
$[236] = t101;
|
|
1118
|
+
$[237] = t103;
|
|
1119
|
+
$[238] = t106;
|
|
1120
|
+
$[239] = t107;
|
|
1121
|
+
} else {
|
|
1122
|
+
t107 = $[239];
|
|
1123
|
+
}
|
|
1124
|
+
let t108;
|
|
1125
|
+
if ($[240] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1126
|
+
t108 = cls("p-4 sm:p-5 flex flex-col gap-2 bg-primary/5 dark:bg-primary-bg-dark/10", defaultBorderMixin);
|
|
1127
|
+
$[240] = t108;
|
|
1128
|
+
} else {
|
|
1129
|
+
t108 = $[240];
|
|
1130
|
+
}
|
|
1131
|
+
let t109;
|
|
1132
|
+
if ($[241] !== t) {
|
|
1133
|
+
t109 = t("studio_policy_help_auth_vars_title");
|
|
1134
|
+
$[241] = t;
|
|
1135
|
+
$[242] = t109;
|
|
1136
|
+
} else {
|
|
1137
|
+
t109 = $[242];
|
|
1138
|
+
}
|
|
1139
|
+
let t110;
|
|
1140
|
+
if ($[243] !== t109) {
|
|
1141
|
+
t110 = /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "text-primary dark:text-primary-light font-medium", children: t109 });
|
|
1142
|
+
$[243] = t109;
|
|
1143
|
+
$[244] = t110;
|
|
1144
|
+
} else {
|
|
1145
|
+
t110 = $[244];
|
|
1146
|
+
}
|
|
1147
|
+
let t111;
|
|
1148
|
+
if ($[245] !== t) {
|
|
1149
|
+
t111 = t("studio_policy_help_auth_vars_desc");
|
|
1150
|
+
$[245] = t;
|
|
1151
|
+
$[246] = t111;
|
|
1152
|
+
} else {
|
|
1153
|
+
t111 = $[246];
|
|
1154
|
+
}
|
|
1155
|
+
let t112;
|
|
1156
|
+
if ($[247] !== t111) {
|
|
1157
|
+
t112 = /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-text-secondary dark:text-text-secondary-dark", children: t111 });
|
|
1158
|
+
$[247] = t111;
|
|
1159
|
+
$[248] = t112;
|
|
1160
|
+
} else {
|
|
1161
|
+
t112 = $[248];
|
|
1162
|
+
}
|
|
1163
|
+
let t113;
|
|
1164
|
+
if ($[249] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1165
|
+
t113 = /* @__PURE__ */ jsx("code", { className: "bg-surface-100 dark:bg-surface-950 px-1.5 py-0.5 rounded mr-1 whitespace-nowrap", children: "auth.uid()" });
|
|
1166
|
+
$[249] = t113;
|
|
1167
|
+
} else {
|
|
1168
|
+
t113 = $[249];
|
|
1169
|
+
}
|
|
1170
|
+
let t114;
|
|
1171
|
+
let t115;
|
|
1172
|
+
if ($[250] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1173
|
+
t114 = /* @__PURE__ */ jsxs("li", { children: [
|
|
1174
|
+
t113,
|
|
1175
|
+
/* @__PURE__ */ jsxs("span", { className: "block mt-0.5", children: [
|
|
1176
|
+
"Returns the current user's ID as text. Example: ",
|
|
1177
|
+
/* @__PURE__ */ jsx("code", { className: "bg-surface-100 dark:bg-surface-950 px-1 py-0.5 rounded text-[11px]", children: "auth.uid() = user_id" })
|
|
1178
|
+
] })
|
|
1179
|
+
] });
|
|
1180
|
+
t115 = /* @__PURE__ */ jsx("code", { className: "bg-surface-100 dark:bg-surface-950 px-1.5 py-0.5 rounded mr-1 whitespace-nowrap", children: "auth.jwt()" });
|
|
1181
|
+
$[250] = t114;
|
|
1182
|
+
$[251] = t115;
|
|
1183
|
+
} else {
|
|
1184
|
+
t114 = $[250];
|
|
1185
|
+
t115 = $[251];
|
|
1186
|
+
}
|
|
1187
|
+
let t116;
|
|
1188
|
+
let t117;
|
|
1189
|
+
if ($[252] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1190
|
+
t116 = /* @__PURE__ */ jsxs("li", { children: [
|
|
1191
|
+
t115,
|
|
1192
|
+
/* @__PURE__ */ jsxs("span", { className: "block mt-0.5", children: [
|
|
1193
|
+
"Returns the full JWT payload as JSONB so you can check custom claims. Example: ",
|
|
1194
|
+
/* @__PURE__ */ jsx("code", { className: "bg-surface-100 dark:bg-surface-950 px-1 py-0.5 rounded text-[11px]", children: "auth.jwt() ->> 'email' = 'admin@example.com'" })
|
|
1195
|
+
] })
|
|
1196
|
+
] });
|
|
1197
|
+
t117 = /* @__PURE__ */ jsx("code", { className: "bg-surface-100 dark:bg-surface-950 px-1.5 py-0.5 rounded mr-1 whitespace-nowrap", children: "auth.roles()" });
|
|
1198
|
+
$[252] = t116;
|
|
1199
|
+
$[253] = t117;
|
|
1200
|
+
} else {
|
|
1201
|
+
t116 = $[252];
|
|
1202
|
+
t117 = $[253];
|
|
1203
|
+
}
|
|
1204
|
+
let t118;
|
|
1205
|
+
if ($[254] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1206
|
+
t118 = /* @__PURE__ */ jsxs("ul", { className: "list-disc pl-5 space-y-2 text-sm text-text-secondary dark:text-text-secondary-dark font-normal", children: [
|
|
1207
|
+
t114,
|
|
1208
|
+
t116,
|
|
1209
|
+
/* @__PURE__ */ jsxs("li", { children: [
|
|
1210
|
+
t117,
|
|
1211
|
+
/* @__PURE__ */ jsxs("span", { className: "block mt-0.5", children: [
|
|
1212
|
+
"Returns the user's role IDs as a comma-separated string. Best used with: ",
|
|
1213
|
+
/* @__PURE__ */ jsx("code", { className: "bg-surface-100 dark:bg-surface-950 px-1 py-0.5 rounded text-[11px]", children: "string_to_array(auth.roles(), ',') @> ARRAY['admin']" })
|
|
1214
|
+
] })
|
|
1215
|
+
] })
|
|
1216
|
+
] });
|
|
1217
|
+
$[254] = t118;
|
|
1218
|
+
} else {
|
|
1219
|
+
t118 = $[254];
|
|
1220
|
+
}
|
|
1221
|
+
let t119;
|
|
1222
|
+
if ($[255] !== t110 || $[256] !== t112) {
|
|
1223
|
+
t119 = /* @__PURE__ */ jsxs(Paper, { className: t108, children: [
|
|
1224
|
+
t110,
|
|
1225
|
+
t112,
|
|
1226
|
+
t118
|
|
1227
|
+
] });
|
|
1228
|
+
$[255] = t110;
|
|
1229
|
+
$[256] = t112;
|
|
1230
|
+
$[257] = t119;
|
|
1231
|
+
} else {
|
|
1232
|
+
t119 = $[257];
|
|
1233
|
+
}
|
|
1234
|
+
let t120;
|
|
1235
|
+
if ($[258] !== t107 || $[259] !== t119 || $[260] !== t73 || $[261] !== t89 || $[262] !== t98) {
|
|
1236
|
+
t120 = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
1237
|
+
t73,
|
|
1238
|
+
t89,
|
|
1239
|
+
t98,
|
|
1240
|
+
t107,
|
|
1241
|
+
t119
|
|
1242
|
+
] });
|
|
1243
|
+
$[258] = t107;
|
|
1244
|
+
$[259] = t119;
|
|
1245
|
+
$[260] = t73;
|
|
1246
|
+
$[261] = t89;
|
|
1247
|
+
$[262] = t98;
|
|
1248
|
+
$[263] = t120;
|
|
1249
|
+
} else {
|
|
1250
|
+
t120 = $[263];
|
|
1251
|
+
}
|
|
1252
|
+
let t121;
|
|
1253
|
+
if ($[264] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1254
|
+
t121 = cls("mt-2 flex flex-col sm:flex-row justify-between items-start sm:items-center bg-primary/5 dark:bg-primary-bg-dark/10 p-4 rounded-xl border border-primary/10 dark:border-primary/20", defaultBorderMixin);
|
|
1255
|
+
$[264] = t121;
|
|
1256
|
+
} else {
|
|
1257
|
+
t121 = $[264];
|
|
1258
|
+
}
|
|
1259
|
+
let t122;
|
|
1260
|
+
if ($[265] !== t) {
|
|
1261
|
+
t122 = t("studio_policy_help_docs_cta");
|
|
1262
|
+
$[265] = t;
|
|
1263
|
+
$[266] = t122;
|
|
1264
|
+
} else {
|
|
1265
|
+
t122 = $[266];
|
|
1266
|
+
}
|
|
1267
|
+
let t123;
|
|
1268
|
+
if ($[267] !== t122) {
|
|
1269
|
+
t123 = /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-primary dark:text-primary-light mb-4 sm:mb-0 max-w-md", children: t122 });
|
|
1270
|
+
$[267] = t122;
|
|
1271
|
+
$[268] = t123;
|
|
1272
|
+
} else {
|
|
1273
|
+
t123 = $[268];
|
|
1274
|
+
}
|
|
1275
|
+
let t124;
|
|
1276
|
+
if ($[269] !== t) {
|
|
1277
|
+
t124 = t("studio_policy_help_read_docs");
|
|
1278
|
+
$[269] = t;
|
|
1279
|
+
$[270] = t124;
|
|
1280
|
+
} else {
|
|
1281
|
+
t124 = $[270];
|
|
1282
|
+
}
|
|
1283
|
+
let t125;
|
|
1284
|
+
if ($[271] !== t124) {
|
|
1285
|
+
t125 = /* @__PURE__ */ jsx(Button, { component: "a", href: "https://www.postgresql.org/docs/current/sql-createpolicy.html", target: "_blank", variant: "outlined", color: "primary", size: "small", className: "whitespace-nowrap flex-shrink-0", children: t124 });
|
|
1286
|
+
$[271] = t124;
|
|
1287
|
+
$[272] = t125;
|
|
1288
|
+
} else {
|
|
1289
|
+
t125 = $[272];
|
|
1290
|
+
}
|
|
1291
|
+
let t126;
|
|
1292
|
+
if ($[273] !== t123 || $[274] !== t125) {
|
|
1293
|
+
t126 = /* @__PURE__ */ jsxs("div", { className: t121, children: [
|
|
1294
|
+
t123,
|
|
1295
|
+
t125
|
|
1296
|
+
] });
|
|
1297
|
+
$[273] = t123;
|
|
1298
|
+
$[274] = t125;
|
|
1299
|
+
$[275] = t126;
|
|
1300
|
+
} else {
|
|
1301
|
+
t126 = $[275];
|
|
1302
|
+
}
|
|
1303
|
+
let t127;
|
|
1304
|
+
if ($[276] !== t120 || $[277] !== t126 || $[278] !== t67) {
|
|
1305
|
+
t127 = /* @__PURE__ */ jsxs(DialogContent, { className: "p-4 sm:p-6 lg:p-8 flex flex-col gap-6", children: [
|
|
1306
|
+
t67,
|
|
1307
|
+
t120,
|
|
1308
|
+
t126
|
|
1309
|
+
] });
|
|
1310
|
+
$[276] = t120;
|
|
1311
|
+
$[277] = t126;
|
|
1312
|
+
$[278] = t67;
|
|
1313
|
+
$[279] = t127;
|
|
1314
|
+
} else {
|
|
1315
|
+
t127 = $[279];
|
|
1316
|
+
}
|
|
1317
|
+
let t128;
|
|
1318
|
+
if ($[280] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1319
|
+
t128 = () => setHelpOpen(false);
|
|
1320
|
+
$[280] = t128;
|
|
1321
|
+
} else {
|
|
1322
|
+
t128 = $[280];
|
|
1323
|
+
}
|
|
1324
|
+
let t129;
|
|
1325
|
+
if ($[281] !== t) {
|
|
1326
|
+
t129 = t("studio_policy_help_got_it");
|
|
1327
|
+
$[281] = t;
|
|
1328
|
+
$[282] = t129;
|
|
1329
|
+
} else {
|
|
1330
|
+
t129 = $[282];
|
|
1331
|
+
}
|
|
1332
|
+
let t130;
|
|
1333
|
+
if ($[283] !== t129) {
|
|
1334
|
+
t130 = /* @__PURE__ */ jsx(DialogActions, { className: "p-4 sm:px-6 sm:pb-6 pt-0 border-t-0", children: /* @__PURE__ */ jsx(Button, { onClick: t128, variant: "filled", color: "primary", children: t129 }) });
|
|
1335
|
+
$[283] = t129;
|
|
1336
|
+
$[284] = t130;
|
|
1337
|
+
} else {
|
|
1338
|
+
t130 = $[284];
|
|
1339
|
+
}
|
|
1340
|
+
let t131;
|
|
1341
|
+
if ($[285] !== helpOpen || $[286] !== t127 || $[287] !== t130) {
|
|
1342
|
+
t131 = /* @__PURE__ */ jsxs(Dialog, { open: helpOpen, onOpenChange: setHelpOpen, maxWidth: "3xl", children: [
|
|
1343
|
+
t127,
|
|
1344
|
+
t130
|
|
1345
|
+
] });
|
|
1346
|
+
$[285] = helpOpen;
|
|
1347
|
+
$[286] = t127;
|
|
1348
|
+
$[287] = t130;
|
|
1349
|
+
$[288] = t131;
|
|
1350
|
+
} else {
|
|
1351
|
+
t131 = $[288];
|
|
1352
|
+
}
|
|
1353
|
+
let t132;
|
|
1354
|
+
if ($[289] !== t13 || $[290] !== t131 || $[291] !== t56 || $[292] !== t62) {
|
|
1355
|
+
t132 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1356
|
+
t13,
|
|
1357
|
+
t56,
|
|
1358
|
+
t62,
|
|
1359
|
+
t131
|
|
1360
|
+
] });
|
|
1361
|
+
$[289] = t13;
|
|
1362
|
+
$[290] = t131;
|
|
1363
|
+
$[291] = t56;
|
|
1364
|
+
$[292] = t62;
|
|
1365
|
+
$[293] = t132;
|
|
1366
|
+
} else {
|
|
1367
|
+
t132 = $[293];
|
|
1368
|
+
}
|
|
1369
|
+
return t132;
|
|
1370
|
+
};
|
|
1371
|
+
function _temp(preset_0) {
|
|
1372
|
+
return /* @__PURE__ */ jsx(SelectItem, { value: preset_0.id, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col text-left", children: [
|
|
1373
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: preset_0.label }),
|
|
1374
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-text-secondary dark:text-text-secondary-dark", children: preset_0.description })
|
|
1375
|
+
] }) }, preset_0.id);
|
|
1376
|
+
}
|
|
1377
|
+
function _temp2(role) {
|
|
1378
|
+
return /* @__PURE__ */ jsx(MultiSelectItem, { value: role, children: role }, role);
|
|
1379
|
+
}
|
|
1380
|
+
const RLSEditor = ({
|
|
1381
|
+
apiUrl = ""
|
|
1382
|
+
}) => {
|
|
1383
|
+
const {
|
|
1384
|
+
databaseAdmin
|
|
1385
|
+
} = useRebaseContext();
|
|
1386
|
+
const snackbarController = useSnackbarController();
|
|
1387
|
+
const collectionRegistry = useStudioCollectionRegistry();
|
|
1388
|
+
const {
|
|
1389
|
+
t
|
|
1390
|
+
} = useTranslation();
|
|
1391
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
1392
|
+
const [error, setError] = useState(null);
|
|
1393
|
+
const [tables, setTables] = useState([]);
|
|
1394
|
+
const [selectedTable, setSelectedTable] = useState(null);
|
|
1395
|
+
const [activeTab, setActiveTab] = useState(0);
|
|
1396
|
+
const [editingPolicy, setEditingPolicy] = useState(null);
|
|
1397
|
+
const [sidebarSize, setSidebarSize] = useState(() => {
|
|
1398
|
+
try {
|
|
1399
|
+
const saved = localStorage.getItem("rebase_rls_editor_sidebar_size");
|
|
1400
|
+
return saved !== null ? parseFloat(saved) : 20;
|
|
1401
|
+
} catch (e) {
|
|
1402
|
+
return 20;
|
|
1403
|
+
}
|
|
1404
|
+
});
|
|
1405
|
+
const [expandedSchemas, setExpandedSchemas] = useState({
|
|
1406
|
+
public: true
|
|
1407
|
+
});
|
|
1408
|
+
const [sidebarTab, setSidebarTab] = useState("tables");
|
|
1409
|
+
useEffect(() => {
|
|
1410
|
+
try {
|
|
1411
|
+
localStorage.setItem("rebase_rls_editor_sidebar_size", sidebarSize.toString());
|
|
1412
|
+
} catch (e_0) {
|
|
1413
|
+
}
|
|
1414
|
+
}, [sidebarSize]);
|
|
1415
|
+
const fetchRLSData = useCallback(async () => {
|
|
1416
|
+
if (!databaseAdmin?.executeSql) {
|
|
1417
|
+
setError(t("studio_sql_sql_not_supported"));
|
|
1418
|
+
setIsLoading(false);
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
setIsLoading(true);
|
|
1422
|
+
setError(null);
|
|
1423
|
+
try {
|
|
1424
|
+
const tablesSql = `
|
|
1425
|
+
SELECT
|
|
1426
|
+
schemaname,
|
|
1427
|
+
tablename,
|
|
1428
|
+
rowsecurity
|
|
1429
|
+
FROM pg_tables
|
|
1430
|
+
WHERE schemaname NOT IN ('information_schema', 'pg_catalog')
|
|
1431
|
+
ORDER BY schemaname, tablename;
|
|
1432
|
+
`;
|
|
1433
|
+
const tablesResult = await databaseAdmin.executeSql(tablesSql);
|
|
1434
|
+
const policiesSql = `
|
|
1435
|
+
SELECT
|
|
1436
|
+
schemaname,
|
|
1437
|
+
tablename,
|
|
1438
|
+
policyname,
|
|
1439
|
+
permissive,
|
|
1440
|
+
roles,
|
|
1441
|
+
cmd,
|
|
1442
|
+
qual,
|
|
1443
|
+
with_check
|
|
1444
|
+
FROM pg_policies
|
|
1445
|
+
WHERE schemaname NOT IN ('information_schema', 'pg_catalog');
|
|
1446
|
+
`;
|
|
1447
|
+
const policiesResult = await databaseAdmin.executeSql(policiesSql);
|
|
1448
|
+
const extractRows = (result) => {
|
|
1449
|
+
if (result && typeof result === "object" && "rows" in result && Array.isArray(result.rows)) {
|
|
1450
|
+
return result.rows;
|
|
1451
|
+
}
|
|
1452
|
+
if (Array.isArray(result)) return result;
|
|
1453
|
+
return [];
|
|
1454
|
+
};
|
|
1455
|
+
const tRows = extractRows(tablesResult);
|
|
1456
|
+
const pRows = extractRows(policiesResult);
|
|
1457
|
+
const tableMap = {};
|
|
1458
|
+
tRows.forEach((tRow) => {
|
|
1459
|
+
const t_0 = tRow;
|
|
1460
|
+
const schema = t_0.schemaname || t_0.SCHEMANAME || "public";
|
|
1461
|
+
const table = t_0.tablename || t_0.TABLENAME || "";
|
|
1462
|
+
const rlsEnabled = t_0.rowsecurity || t_0.ROWSECURITY || false;
|
|
1463
|
+
const key = `${schema}.${table}`;
|
|
1464
|
+
tableMap[key] = {
|
|
1465
|
+
schemaName: schema,
|
|
1466
|
+
tableName: table,
|
|
1467
|
+
rlsEnabled,
|
|
1468
|
+
policies: []
|
|
1469
|
+
};
|
|
1470
|
+
});
|
|
1471
|
+
pRows.forEach((pRow) => {
|
|
1472
|
+
const p = pRow;
|
|
1473
|
+
const schema_0 = p.schemaname || p.SCHEMANAME || "public";
|
|
1474
|
+
const table_0 = p.tablename || p.TABLENAME || "";
|
|
1475
|
+
const key_0 = `${schema_0}.${table_0}`;
|
|
1476
|
+
if (tableMap[key_0]) {
|
|
1477
|
+
let parsedRoles = [];
|
|
1478
|
+
const r = p.roles || p.ROLES;
|
|
1479
|
+
if (Array.isArray(r)) {
|
|
1480
|
+
parsedRoles = r;
|
|
1481
|
+
} else if (typeof r === "string") {
|
|
1482
|
+
parsedRoles = r.replace(/^{|}$/g, "").split(",").map((s) => s.trim());
|
|
1483
|
+
}
|
|
1484
|
+
tableMap[key_0].policies.push({
|
|
1485
|
+
policyname: p.policyname || p.POLICYNAME || "",
|
|
1486
|
+
tablename: table_0,
|
|
1487
|
+
permissive: p.permissive || p.PERMISSIVE || "PERMISSIVE",
|
|
1488
|
+
roles: parsedRoles,
|
|
1489
|
+
cmd: p.cmd || p.CMD || "ALL",
|
|
1490
|
+
qual: p.qual || p.QUAL || null,
|
|
1491
|
+
with_check: p.with_check || p.WITH_CHECK || null
|
|
1492
|
+
});
|
|
1493
|
+
}
|
|
1494
|
+
});
|
|
1495
|
+
const sortedTables = Object.values(tableMap).sort((a, b) => a.tableName.localeCompare(b.tableName));
|
|
1496
|
+
setTables(sortedTables);
|
|
1497
|
+
if (sortedTables.length > 0 && !selectedTable) {
|
|
1498
|
+
setSelectedTable(`${sortedTables[0].schemaName}.${sortedTables[0].tableName}`);
|
|
1499
|
+
}
|
|
1500
|
+
} catch (e_1) {
|
|
1501
|
+
console.error("RLS fetch error:", e_1);
|
|
1502
|
+
setError("Failed to fetch RLS policies: " + (e_1 instanceof Error ? e_1.message : String(e_1)));
|
|
1503
|
+
} finally {
|
|
1504
|
+
setIsLoading(false);
|
|
1505
|
+
}
|
|
1506
|
+
}, [databaseAdmin, selectedTable]);
|
|
1507
|
+
useEffect(() => {
|
|
1508
|
+
setEditingPolicy(null);
|
|
1509
|
+
}, [selectedTable]);
|
|
1510
|
+
useEffect(() => {
|
|
1511
|
+
fetchRLSData();
|
|
1512
|
+
}, [fetchRLSData]);
|
|
1513
|
+
const activeTableData = useMemo(() => {
|
|
1514
|
+
if (!selectedTable) return null;
|
|
1515
|
+
return tables.find((t_1) => `${t_1.schemaName}.${t_1.tableName}` === selectedTable) || null;
|
|
1516
|
+
}, [selectedTable, tables]);
|
|
1517
|
+
const groupedTables = useMemo(() => {
|
|
1518
|
+
const groups = {};
|
|
1519
|
+
tables.forEach((table_1) => {
|
|
1520
|
+
if (!groups[table_1.schemaName]) {
|
|
1521
|
+
groups[table_1.schemaName] = [];
|
|
1522
|
+
}
|
|
1523
|
+
groups[table_1.schemaName].push(table_1);
|
|
1524
|
+
});
|
|
1525
|
+
return groups;
|
|
1526
|
+
}, [tables]);
|
|
1527
|
+
const activeCollection = useMemo(() => {
|
|
1528
|
+
if (!activeTableData) return null;
|
|
1529
|
+
return collectionRegistry.collections?.find((c2) => c2.id === activeTableData.tableName || c2.path === activeTableData.tableName || c2.table === activeTableData.tableName || c2.slug === activeTableData.tableName || c2.collectionId === activeTableData.tableName) || null;
|
|
1530
|
+
}, [activeTableData, collectionRegistry.collections]);
|
|
1531
|
+
const mergedPolicies = useMemo(() => {
|
|
1532
|
+
if (!activeTableData) return [];
|
|
1533
|
+
const policiesMap = {};
|
|
1534
|
+
(activeTableData.policies || []).forEach((p_0) => {
|
|
1535
|
+
policiesMap[p_0.policyname] = {
|
|
1536
|
+
...p_0,
|
|
1537
|
+
status: "live"
|
|
1538
|
+
};
|
|
1539
|
+
});
|
|
1540
|
+
if (activeCollection && isPostgresCollection(activeCollection) && activeCollection.securityRules) {
|
|
1541
|
+
activeCollection.securityRules.forEach((rule) => {
|
|
1542
|
+
const ruleName = rule.name;
|
|
1543
|
+
if (!ruleName) return;
|
|
1544
|
+
if (policiesMap[ruleName]) {
|
|
1545
|
+
policiesMap[ruleName] = {
|
|
1546
|
+
policyname: ruleName,
|
|
1547
|
+
tablename: activeTableData.tableName,
|
|
1548
|
+
permissive: (rule.mode || "permissive").toUpperCase(),
|
|
1549
|
+
cmd: (rule.operation || "ALL").toUpperCase(),
|
|
1550
|
+
roles: rule.roles || ["public"],
|
|
1551
|
+
qual: rule.using || null,
|
|
1552
|
+
with_check: rule.withCheck || null,
|
|
1553
|
+
status: "both"
|
|
1554
|
+
};
|
|
1555
|
+
} else {
|
|
1556
|
+
policiesMap[ruleName] = {
|
|
1557
|
+
policyname: ruleName,
|
|
1558
|
+
tablename: activeTableData.tableName,
|
|
1559
|
+
permissive: (rule.mode || "permissive").toUpperCase(),
|
|
1560
|
+
cmd: (rule.operation || "ALL").toUpperCase(),
|
|
1561
|
+
roles: rule.roles || ["public"],
|
|
1562
|
+
qual: rule.using || null,
|
|
1563
|
+
with_check: rule.withCheck || null,
|
|
1564
|
+
status: "code_only"
|
|
1565
|
+
};
|
|
1566
|
+
}
|
|
1567
|
+
});
|
|
1568
|
+
}
|
|
1569
|
+
return Object.values(policiesMap).sort((a_0, b_0) => a_0.policyname.localeCompare(b_0.policyname));
|
|
1570
|
+
}, [activeTableData, activeCollection]);
|
|
1571
|
+
const rlsStats = useMemo(() => {
|
|
1572
|
+
const total = tables.length;
|
|
1573
|
+
const enabled = tables.filter((t_2) => t_2.rlsEnabled).length;
|
|
1574
|
+
const withPolicies = tables.filter((t_3) => t_3.policies.length > 0).length;
|
|
1575
|
+
const totalPolicies = tables.reduce((sum, t_4) => sum + t_4.policies.length, 0);
|
|
1576
|
+
return {
|
|
1577
|
+
total,
|
|
1578
|
+
enabled,
|
|
1579
|
+
withPolicies,
|
|
1580
|
+
totalPolicies
|
|
1581
|
+
};
|
|
1582
|
+
}, [tables]);
|
|
1583
|
+
const renderPolicyTag = (label, value) => {
|
|
1584
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 px-2 py-1 rounded-md bg-surface-100 dark:bg-surface-950 border border-surface-200 dark:border-surface-700/50", children: [
|
|
1585
|
+
/* @__PURE__ */ jsxs("span", { className: "text-[10px] uppercase text-text-secondary dark:text-text-secondary-dark font-medium tracking-wider", children: [
|
|
1586
|
+
label,
|
|
1587
|
+
":"
|
|
1588
|
+
] }),
|
|
1589
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-xs text-text-primary dark:text-text-primary-dark break-all", children: value })
|
|
1590
|
+
] });
|
|
1591
|
+
};
|
|
1592
|
+
return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full bg-white dark:bg-surface-950 overflow-hidden text-text-primary dark:text-text-primary-dark", children: /* @__PURE__ */ jsx(ResizablePanels, { orientation: "horizontal", panelSizePercent: sidebarSize, onPanelSizeChange: setSidebarSize, minPanelSizePx: 220, firstPanel: /* @__PURE__ */ jsxs("div", { className: cls("flex flex-col h-full w-full bg-white dark:bg-surface-950 border-r", defaultBorderMixin), children: [
|
|
1593
|
+
/* @__PURE__ */ jsxs(Tabs, { value: sidebarTab, onValueChange: (v) => setSidebarTab(v), variant: "boxy", className: "border-b border-surface-200 dark:border-surface-950", children: [
|
|
1594
|
+
/* @__PURE__ */ jsx(Tab, { value: "tables", children: "Tables" }),
|
|
1595
|
+
/* @__PURE__ */ jsx(Tab, { value: "info", children: "Info" })
|
|
1596
|
+
] }),
|
|
1597
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-grow overflow-hidden relative", children: [
|
|
1598
|
+
sidebarTab === "tables" && /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full", children: [
|
|
1599
|
+
/* @__PURE__ */ jsxs("div", { className: cls("flex items-center justify-between px-3 py-2 border-b bg-surface-50 dark:bg-surface-900 min-h-[48px]", defaultBorderMixin), children: [
|
|
1600
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "font-bold uppercase tracking-wider text-text-disabled dark:text-text-disabled-dark", children: t("studio_schema_tables") }),
|
|
1601
|
+
/* @__PURE__ */ jsx(IconButton, { size: "small", onClick: fetchRLSData, title: "Refresh", children: /* @__PURE__ */ jsx(RefreshCwIcon, { size: iconSize.smallest }) })
|
|
1602
|
+
] }),
|
|
1603
|
+
/* @__PURE__ */ jsx("div", { className: "flex-grow overflow-y-auto no-scrollbar p-1", children: isLoading && tables.length === 0 ? /* @__PURE__ */ jsx("div", { className: "flex justify-center p-4", children: /* @__PURE__ */ jsx(CircularProgress, { size: "small" }) }) : Object.keys(groupedTables).length === 0 ? /* @__PURE__ */ jsx("div", { className: "p-4 text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-text-disabled dark:text-text-disabled-dark italic", children: t("studio_rls_no_tables") }) }) : Object.entries(groupedTables).map(([schemaName, schemaTables]) => /* @__PURE__ */ jsxs("div", { className: "mb-2", children: [
|
|
1604
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center p-1 cursor-pointer hover:bg-surface-100 dark:hover:bg-surface-950 rounded transition-colors", onClick: () => setExpandedSchemas((prev) => ({
|
|
1605
|
+
...prev,
|
|
1606
|
+
[schemaName]: !prev[schemaName]
|
|
1607
|
+
})), children: [
|
|
1608
|
+
/* @__PURE__ */ jsx("svg", { className: cls("w-3 h-3 mr-1 transition-transform", expandedSchemas[schemaName] ? "rotate-90" : ""), fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx("path", { d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" }) }),
|
|
1609
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-text-primary dark:text-text-primary-dark font-medium text-xs truncate flex-grow", children: schemaName })
|
|
1610
|
+
] }),
|
|
1611
|
+
expandedSchemas[schemaName] && /* @__PURE__ */ jsx("div", { className: "ml-3 mt-1 space-y-0.5", children: schemaTables.map((table_2) => {
|
|
1612
|
+
const key_1 = `${table_2.schemaName}.${table_2.tableName}`;
|
|
1613
|
+
const isSelected = selectedTable === key_1;
|
|
1614
|
+
return /* @__PURE__ */ jsxs("div", { onClick: () => setSelectedTable(key_1), className: cls("flex items-center p-1 cursor-pointer rounded transition-colors group relative", isSelected ? "bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-light" : "hover:bg-surface-100 dark:hover:bg-surface-950 text-text-secondary dark:text-text-secondary-dark"), children: [
|
|
1615
|
+
/* @__PURE__ */ jsx("svg", { className: "w-3.5 h-3.5 mr-1 shrink-0 text-text-disabled dark:text-text-disabled-dark", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 10h18M3 14h18m-9-4v8m-7 0h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" }) }),
|
|
1616
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-xs truncate flex-1 min-w-0", children: table_2.tableName }),
|
|
1617
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 shrink-0 ml-2", children: [
|
|
1618
|
+
table_2.rlsEnabled ? /* @__PURE__ */ jsx(Tooltip, { title: t("studio_rls_enabled"), children: /* @__PURE__ */ jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-green-500" }) }) : /* @__PURE__ */ jsx(Tooltip, { title: t("studio_rls_disabled"), children: /* @__PURE__ */ jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-orange-400 opacity-50" }) }),
|
|
1619
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] opacity-40 group-hover:opacity-100 min-w-[1.2rem] text-right font-medium", children: table_2.policies.length })
|
|
1620
|
+
] })
|
|
1621
|
+
] }, key_1);
|
|
1622
|
+
}) })
|
|
1623
|
+
] }, schemaName)) })
|
|
1624
|
+
] }),
|
|
1625
|
+
sidebarTab === "info" && /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full", children: [
|
|
1626
|
+
/* @__PURE__ */ jsx("div", { className: cls("flex items-center justify-between px-3 py-2 border-b bg-surface-50 dark:bg-surface-900 min-h-[48px]", defaultBorderMixin), children: /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "font-bold uppercase tracking-wider text-text-disabled dark:text-text-disabled-dark", children: "Overview" }) }),
|
|
1627
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-grow overflow-y-auto p-3 space-y-3 no-scrollbar", children: [
|
|
1628
|
+
/* @__PURE__ */ jsxs("div", { className: cls("p-3 rounded-lg border bg-white dark:bg-surface-900", defaultBorderMixin), children: [
|
|
1629
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
1630
|
+
/* @__PURE__ */ jsx(ShieldIcon, { size: iconSize.smallest, className: "text-primary" }),
|
|
1631
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "font-semibold text-[13px]", children: "RLS Studio" })
|
|
1632
|
+
] }),
|
|
1633
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-text-secondary dark:text-text-secondary-dark text-[11px] leading-relaxed block", children: "Manage Row Level Security policies for your PostgreSQL tables. Enable RLS and create fine-grained access policies." })
|
|
1634
|
+
] }),
|
|
1635
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
1636
|
+
/* @__PURE__ */ jsxs("div", { className: cls("p-2.5 rounded border bg-white dark:bg-surface-900 flex items-center justify-between", defaultBorderMixin), children: [
|
|
1637
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-text-secondary dark:text-text-secondary-dark text-[11px]", children: "Total tables" }),
|
|
1638
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "font-mono text-[13px] font-medium", children: rlsStats.total })
|
|
1639
|
+
] }),
|
|
1640
|
+
/* @__PURE__ */ jsxs("div", { className: cls("p-2.5 rounded border bg-white dark:bg-surface-900 flex items-center justify-between", defaultBorderMixin), children: [
|
|
1641
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-text-secondary dark:text-text-secondary-dark text-[11px]", children: "RLS enabled" }),
|
|
1642
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
1643
|
+
/* @__PURE__ */ jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-green-500" }),
|
|
1644
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "font-mono text-[13px] font-medium", children: rlsStats.enabled })
|
|
1645
|
+
] })
|
|
1646
|
+
] }),
|
|
1647
|
+
/* @__PURE__ */ jsxs("div", { className: cls("p-2.5 rounded border bg-white dark:bg-surface-900 flex items-center justify-between", defaultBorderMixin), children: [
|
|
1648
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-text-secondary dark:text-text-secondary-dark text-[11px]", children: "Tables with policies" }),
|
|
1649
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "font-mono text-[13px] font-medium", children: rlsStats.withPolicies })
|
|
1650
|
+
] }),
|
|
1651
|
+
/* @__PURE__ */ jsxs("div", { className: cls("p-2.5 rounded border bg-white dark:bg-surface-900 flex items-center justify-between", defaultBorderMixin), children: [
|
|
1652
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-text-secondary dark:text-text-secondary-dark text-[11px]", children: "Total policies" }),
|
|
1653
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "font-mono text-[13px] font-medium", children: rlsStats.totalPolicies })
|
|
1654
|
+
] })
|
|
1655
|
+
] })
|
|
1656
|
+
] })
|
|
1657
|
+
] })
|
|
1658
|
+
] })
|
|
1659
|
+
] }), secondPanel: /* @__PURE__ */ jsxs("div", { className: "flex-grow flex flex-col min-w-0 h-full w-full bg-white dark:bg-surface-950", children: [
|
|
1660
|
+
/* @__PURE__ */ jsxs("div", { className: cls("flex items-center justify-between pr-2 border-b bg-white dark:bg-surface-950 min-h-[46px]", defaultBorderMixin), children: [
|
|
1661
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center flex-grow overflow-hidden px-4", children: [
|
|
1662
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "font-mono text-text-secondary dark:text-text-secondary-dark truncate", children: activeTableData ? `${activeTableData.schemaName}.${activeTableData.tableName}` : t("studio_rls_select_table") }),
|
|
1663
|
+
activeTableData && /* @__PURE__ */ jsx("div", { className: "ml-3", children: activeTableData.rlsEnabled ? /* @__PURE__ */ jsx(Chip, { size: "smallest", className: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400 border-green-200 dark:border-green-800", children: t("studio_rls_enabled") }) : /* @__PURE__ */ jsx(Chip, { size: "smallest", className: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800", children: t("studio_rls_disabled") }) })
|
|
1664
|
+
] }),
|
|
1665
|
+
/* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center justify-end gap-1.5", children: activeTableData && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1666
|
+
/* @__PURE__ */ jsx(Button, { variant: "text", size: "small", onClick: async () => {
|
|
1667
|
+
const table_3 = activeTableData.tableName;
|
|
1668
|
+
const action = activeTableData.rlsEnabled ? "DISABLE" : "ENABLE";
|
|
1669
|
+
if (!confirm(`Are you sure you want to ${action.toLowerCase()} Row Level Security on "${table_3}"?`)) return;
|
|
1670
|
+
try {
|
|
1671
|
+
await databaseAdmin.executeSql(`ALTER TABLE "${table_3}" ${action} ROW LEVEL SECURITY`);
|
|
1672
|
+
snackbarController.open({
|
|
1673
|
+
type: "success",
|
|
1674
|
+
message: `RLS ${action.toLowerCase()}d on ${table_3}`
|
|
1675
|
+
});
|
|
1676
|
+
fetchRLSData();
|
|
1677
|
+
} catch (e_2) {
|
|
1678
|
+
snackbarController.open({
|
|
1679
|
+
type: "error",
|
|
1680
|
+
message: e_2 instanceof Error ? e_2.message : String(e_2)
|
|
1681
|
+
});
|
|
1682
|
+
}
|
|
1683
|
+
}, children: activeTableData.rlsEnabled ? t("studio_rls_disable_rls") : t("studio_rls_enable_rls") }),
|
|
1684
|
+
/* @__PURE__ */ jsx("div", { className: "h-4 w-px bg-surface-200 dark:bg-surface-950 mx-1" }),
|
|
1685
|
+
/* @__PURE__ */ jsx(Button, { variant: "text", size: "small", onClick: fetchRLSData, startIcon: /* @__PURE__ */ jsx(RefreshCwIcon, { size: iconSize.smallest }), children: "Refresh" }),
|
|
1686
|
+
/* @__PURE__ */ jsx("div", { className: "h-4 w-px bg-surface-200 dark:bg-surface-950 mx-1" }),
|
|
1687
|
+
/* @__PURE__ */ jsx(Button, { size: "small", color: "primary", disabled: !activeCollection, onClick: () => setEditingPolicy("new"), children: t("studio_rls_create_policy") })
|
|
1688
|
+
] }) })
|
|
1689
|
+
] }),
|
|
1690
|
+
error ? /* @__PURE__ */ jsx("div", { className: "p-6 h-full flex items-center justify-center", children: /* @__PURE__ */ jsx(ErrorView, { title: t("studio_rls_error"), error, onRetry: fetchRLSData }) }) : !activeTableData ? /* @__PURE__ */ jsx("div", { className: "flex-grow flex items-center justify-center text-text-disabled h-full", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
1691
|
+
/* @__PURE__ */ jsx("svg", { className: "w-12 h-12 mx-auto mb-4 opacity-50", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1, d: "M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" }) }),
|
|
1692
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: t("studio_rls_select_table") })
|
|
1693
|
+
] }) }) : editingPolicy ? /* @__PURE__ */ jsx(PolicyEditor, { policy: editingPolicy === "new" ? void 0 : editingPolicy, schema: activeTableData.schemaName, table: activeTableData.tableName, onSave: async (newPolicy) => {
|
|
1694
|
+
if (!activeCollection) return;
|
|
1695
|
+
const rule_0 = {
|
|
1696
|
+
name: newPolicy.policyname,
|
|
1697
|
+
operation: newPolicy.cmd?.toLowerCase(),
|
|
1698
|
+
mode: newPolicy.permissive?.toLowerCase(),
|
|
1699
|
+
using: newPolicy.qual || void 0,
|
|
1700
|
+
withCheck: newPolicy.with_check || void 0,
|
|
1701
|
+
roles: newPolicy.roles
|
|
1702
|
+
};
|
|
1703
|
+
const existingRules = (isPostgresCollection(activeCollection) ? activeCollection.securityRules : void 0) || [];
|
|
1704
|
+
let newRules;
|
|
1705
|
+
if (editingPolicy === "new") {
|
|
1706
|
+
newRules = [...existingRules, rule_0];
|
|
1707
|
+
} else {
|
|
1708
|
+
newRules = existingRules.map((r_0) => r_0.name === editingPolicy.policyname ? rule_0 : r_0);
|
|
1709
|
+
}
|
|
1710
|
+
try {
|
|
1711
|
+
const response = await fetch(`${apiUrl}/api/schema-editor/collection/save`, {
|
|
1712
|
+
method: "POST",
|
|
1713
|
+
headers: {
|
|
1714
|
+
"Content-Type": "application/json"
|
|
1715
|
+
},
|
|
1716
|
+
body: JSON.stringify({
|
|
1717
|
+
collectionId: activeCollection.id || activeCollection.path || activeCollection.alias || activeTableData.tableName,
|
|
1718
|
+
collectionData: {
|
|
1719
|
+
securityRules: newRules
|
|
1720
|
+
}
|
|
1721
|
+
})
|
|
1722
|
+
});
|
|
1723
|
+
if (!response.ok) throw new Error("Failed to save policy");
|
|
1724
|
+
snackbarController.open({
|
|
1725
|
+
type: "success",
|
|
1726
|
+
message: "Policy saved successfully"
|
|
1727
|
+
});
|
|
1728
|
+
setEditingPolicy(null);
|
|
1729
|
+
fetchRLSData();
|
|
1730
|
+
} catch (e_3) {
|
|
1731
|
+
snackbarController.open({
|
|
1732
|
+
type: "error",
|
|
1733
|
+
message: e_3 instanceof Error ? e_3.message : String(e_3)
|
|
1734
|
+
});
|
|
1735
|
+
}
|
|
1736
|
+
}, onCancel: () => setEditingPolicy(null) }) : /* @__PURE__ */ jsx("div", { className: "flex-grow flex flex-col overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "p-6 pt-4 flex-grow overflow-auto bg-surface-50 dark:bg-surface-900", children: /* @__PURE__ */ jsxs("div", { className: "max-w-4xl mx-auto flex flex-col gap-6", children: [
|
|
1737
|
+
activeTableData && !activeCollection && /* @__PURE__ */ jsxs(Alert, { color: "warning", children: [
|
|
1738
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "mb-1", children: "Table not managed by Rebase" }),
|
|
1739
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "opacity-80", children: "This table is not mapped to a Rebase Schema via code. To edit security policies visually, you must first import this table into a Schema configuration file." })
|
|
1740
|
+
] }),
|
|
1741
|
+
activeTableData && !activeTableData.rlsEnabled && /* @__PURE__ */ jsxs("div", { className: cls("p-4 sm:p-5 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-900/50 rounded-lg flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between", defaultBorderMixin), children: [
|
|
1742
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-3 items-start", children: [
|
|
1743
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 bg-yellow-100 dark:bg-yellow-900/50 p-1.5 rounded-md shrink-0 flex items-center justify-center", children: /* @__PURE__ */ jsx(AlertTriangleIcon, { size: iconSize.smallest }) }),
|
|
1744
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1745
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "text-yellow-800 dark:text-yellow-500", children: "Row Level Security (RLS) is disabled" }),
|
|
1746
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-yellow-700 dark:text-yellow-600/90 mt-1 max-w-2xl", children: "Your table is completely readable and writable by anyone with access privileges. Enable RLS to create policies that restrict access to specific rows." })
|
|
1747
|
+
] })
|
|
1748
|
+
] }),
|
|
1749
|
+
/* @__PURE__ */ jsx(Button, { size: "medium", variant: "filled", color: "neutral", onClick: () => setEditingPolicy("new"), className: "shrink-0 whitespace-nowrap", disabled: !activeCollection, children: t("studio_rls_create_policy") })
|
|
1750
|
+
] }),
|
|
1751
|
+
activeTableData && mergedPolicies && mergedPolicies.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
1752
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "text-text-secondary dark:text-text-secondary-dark uppercase tracking-wider mb-1", children: t("studio_rls_policies") }),
|
|
1753
|
+
mergedPolicies.map((policy) => /* @__PURE__ */ jsxs(Paper, { className: cls("p-3 sm:px-4 sm:py-3 flex flex-col sm:flex-row sm:items-center justify-between gap-4 border rounded-lg", defaultBorderMixin), children: [
|
|
1754
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 min-w-0", children: [
|
|
1755
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1756
|
+
/* @__PURE__ */ jsx(KeyIcon, { size: iconSize.smallest, className: "text-text-secondary dark:text-text-secondary-dark shrink-0" }),
|
|
1757
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "truncate", children: policy.policyname }),
|
|
1758
|
+
policy.status === "code_only" && /* @__PURE__ */ jsx(Tooltip, { title: "This policy is defined in your code but hasn't been applied to the database yet.", children: /* @__PURE__ */ jsx("div", { className: "px-1.5 py-0.5 rounded text-[10px] uppercase bg-primary/10 text-primary border border-primary/20 shrink-0", children: "Unapplied" }) }),
|
|
1759
|
+
policy.status === "live" && /* @__PURE__ */ jsx(Tooltip, { title: "This policy is live in the database but missing from your codebase schema.", children: /* @__PURE__ */ jsx("div", { className: "px-1.5 py-0.5 rounded text-[10px] uppercase bg-orange-500/10 text-orange-600 border border-orange-500/20 shrink-0", children: "DB Only" }) })
|
|
1760
|
+
] }),
|
|
1761
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1.5 text-sm", children: [
|
|
1762
|
+
renderPolicyTag("Action", policy.cmd),
|
|
1763
|
+
renderPolicyTag("Roles", Array.isArray(policy.roles) ? policy.roles.join(", ") : policy.roles)
|
|
1764
|
+
] })
|
|
1765
|
+
] }),
|
|
1766
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 shrink-0 items-center", children: [
|
|
1767
|
+
policy.status === "live" && activeCollection && /* @__PURE__ */ jsx(Button, { size: "small", variant: "outlined", color: "primary", onClick: async () => {
|
|
1768
|
+
const rule_1 = {
|
|
1769
|
+
name: policy.policyname,
|
|
1770
|
+
operation: policy.cmd?.toLowerCase(),
|
|
1771
|
+
mode: policy.permissive?.toLowerCase(),
|
|
1772
|
+
using: policy.qual || void 0,
|
|
1773
|
+
withCheck: policy.with_check || void 0,
|
|
1774
|
+
roles: policy.roles
|
|
1775
|
+
};
|
|
1776
|
+
const existingRules_0 = (isPostgresCollection(activeCollection) ? activeCollection.securityRules : void 0) || [];
|
|
1777
|
+
const newRules_0 = [...existingRules_0, rule_1];
|
|
1778
|
+
try {
|
|
1779
|
+
const response_0 = await fetch(`${apiUrl}/api/schema-editor/collection/save`, {
|
|
1780
|
+
method: "POST",
|
|
1781
|
+
headers: {
|
|
1782
|
+
"Content-Type": "application/json"
|
|
1783
|
+
},
|
|
1784
|
+
body: JSON.stringify({
|
|
1785
|
+
collectionId: activeCollection.id || activeCollection.path || activeCollection.alias || activeTableData.tableName,
|
|
1786
|
+
collectionData: {
|
|
1787
|
+
securityRules: newRules_0
|
|
1788
|
+
}
|
|
1789
|
+
})
|
|
1790
|
+
});
|
|
1791
|
+
if (!response_0.ok) throw new Error("Failed to save policy");
|
|
1792
|
+
snackbarController.open({
|
|
1793
|
+
type: "success",
|
|
1794
|
+
message: "Policy imported successfully"
|
|
1795
|
+
});
|
|
1796
|
+
fetchRLSData();
|
|
1797
|
+
} catch (e_4) {
|
|
1798
|
+
snackbarController.open({
|
|
1799
|
+
type: "error",
|
|
1800
|
+
message: e_4 instanceof Error ? e_4.message : String(e_4)
|
|
1801
|
+
});
|
|
1802
|
+
}
|
|
1803
|
+
}, children: "Import to codebase" }),
|
|
1804
|
+
/* @__PURE__ */ jsx(Button, { size: "small", variant: "text", color: "primary", onClick: () => setEditingPolicy(policy), disabled: !activeCollection, children: t("studio_rls_edit") }),
|
|
1805
|
+
policy.status !== "code_only" && /* @__PURE__ */ jsx(Tooltip, { title: t("studio_rls_delete"), asChild: true, children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: async () => {
|
|
1806
|
+
const table_4 = activeTableData.tableName;
|
|
1807
|
+
if (!confirm(`Drop policy "${policy.policyname}" from table "${table_4}"?`)) return;
|
|
1808
|
+
try {
|
|
1809
|
+
await databaseAdmin.executeSql(`DROP POLICY "${policy.policyname}" ON "${table_4}"`);
|
|
1810
|
+
snackbarController.open({
|
|
1811
|
+
type: "success",
|
|
1812
|
+
message: `Policy "${policy.policyname}" dropped`
|
|
1813
|
+
});
|
|
1814
|
+
fetchRLSData();
|
|
1815
|
+
} catch (e_5) {
|
|
1816
|
+
snackbarController.open({
|
|
1817
|
+
type: "error",
|
|
1818
|
+
message: e_5 instanceof Error ? e_5.message : String(e_5)
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1821
|
+
}, children: /* @__PURE__ */ jsx(Trash2Icon, { size: iconSize.smallest }) }) })
|
|
1822
|
+
] })
|
|
1823
|
+
] }, policy.policyname))
|
|
1824
|
+
] })
|
|
1825
|
+
] }) }) })
|
|
1826
|
+
] }) }) });
|
|
1827
|
+
};
|
|
1828
|
+
export {
|
|
1829
|
+
RLSEditor
|
|
1830
|
+
};
|
|
1831
|
+
//# sourceMappingURL=RLSEditor-DBH09u9v.js.map
|