@rebasepro/studio 0.5.0 → 0.6.0
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/dist/ApiExplorer-CdIwR9Ga.js +963 -0
- package/dist/ApiExplorer-CdIwR9Ga.js.map +1 -0
- package/dist/AuthSimulationSelector-iEZ-Or_1.js +56 -0
- package/dist/AuthSimulationSelector-iEZ-Or_1.js.map +1 -0
- package/dist/BranchesView-DncIRcZt.js +461 -0
- package/dist/BranchesView-DncIRcZt.js.map +1 -0
- package/dist/CronJobsView-4gdtJvoe.js +500 -0
- package/dist/CronJobsView-4gdtJvoe.js.map +1 -0
- package/dist/JSEditor-BhAbEjCP.js +1573 -0
- package/dist/JSEditor-BhAbEjCP.js.map +1 -0
- package/dist/LogsExplorer-CqtKILj8.js +240 -0
- package/dist/LogsExplorer-CqtKILj8.js.map +1 -0
- package/dist/MonacoEditor-COZqrIJ1.js +246 -0
- package/dist/MonacoEditor-COZqrIJ1.js.map +1 -0
- package/dist/RLSEditor-CTxYbBdW.js +1362 -0
- package/dist/RLSEditor-CTxYbBdW.js.map +1 -0
- package/dist/SQLEditor-BLuq_zDM.js +1964 -0
- package/dist/SQLEditor-BLuq_zDM.js.map +1 -0
- package/dist/SchemaVisualizer-BJK2u3C0.js +1068 -0
- package/dist/SchemaVisualizer-BJK2u3C0.js.map +1 -0
- package/dist/StorageView-nDaC2foF.js +1382 -0
- package/dist/StorageView-nDaC2foF.js.map +1 -0
- package/dist/{studio/src/components → components}/ApiExplorer/ApiExplorer.d.ts +2 -1
- package/dist/{studio/src/components → components}/ApiExplorer/EndpointDetail.d.ts +2 -1
- package/dist/{studio/src/components → components}/ApiExplorer/TryItPanel.d.ts +2 -1
- package/dist/{studio/src/components → components}/AuthSimulationSelector.d.ts +2 -1
- package/dist/components/Branches/BranchesView.d.ts +2 -0
- package/dist/components/CronJobs/CronJobsView.d.ts +2 -0
- package/dist/components/JSEditor/JSEditor.d.ts +2 -0
- package/dist/{studio/src/components → components}/JSEditor/JSEditorSidebar.d.ts +2 -1
- package/dist/{studio/src/components → components}/JSEditor/JSMonacoEditor.d.ts +2 -1
- package/dist/components/LogsExplorer/LogsExplorer.d.ts +2 -0
- package/dist/{studio/src/components → components}/RLSEditor/PolicyEditor.d.ts +2 -1
- package/dist/{studio/src/components → components}/RLSEditor/RLSEditor.d.ts +2 -1
- package/dist/{studio/src/components → components}/SQLEditor/MonacoEditor.d.ts +2 -1
- package/dist/{studio/src/components → components}/SQLEditor/SQLEditor.d.ts +2 -1
- package/dist/{studio/src/components → components}/SQLEditor/SQLEditorSidebar.d.ts +2 -1
- package/dist/{studio/src/components → components}/SQLEditor/SchemaBrowser.d.ts +2 -1
- package/dist/{studio/src/components → components}/SchemaVisualizer/RelationEdge.d.ts +1 -1
- package/dist/components/SchemaVisualizer/SchemaVisualizer.d.ts +3 -0
- package/dist/{studio/src/components → components}/SchemaVisualizer/TableNode.d.ts +1 -1
- package/dist/components/StorageView/StorageView.d.ts +2 -0
- package/dist/{studio/src/components → components}/StudioHomePage.d.ts +1 -1
- package/dist/index.es.js +688 -746
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +10303 -9572
- package/dist/index.umd.js.map +1 -1
- package/package.json +22 -22
- package/src/components/ApiExplorer/TryItPanel.tsx +15 -18
- package/src/components/CronJobs/CronJobsView.tsx +1 -1
- package/src/components/JSEditor/JSEditor.tsx +9 -14
- package/src/components/LogsExplorer/LogsExplorer.tsx +6 -3
- package/src/components/RLSEditor/PolicyEditor.tsx +0 -1
- package/src/components/SQLEditor/SQLEditor.tsx +40 -30
- package/src/components/StorageView/StorageView.tsx +22 -11
- package/src/components/StudioHomePage.tsx +51 -15
- package/src/utils/parseSpec.test.ts +41 -20
- package/src/utils/pgColumnToProperty.ts +1 -1
- package/dist/ApiExplorer-CGHEF1uL.js +0 -1052
- package/dist/ApiExplorer-CGHEF1uL.js.map +0 -1
- package/dist/AuthSimulationSelector-DGoXkWSg.js +0 -105
- package/dist/AuthSimulationSelector-DGoXkWSg.js.map +0 -1
- package/dist/BranchesView-BiTEwIhd.js +0 -291
- package/dist/BranchesView-BiTEwIhd.js.map +0 -1
- package/dist/CronJobsView-3PM_qR8v.js +0 -472
- package/dist/CronJobsView-3PM_qR8v.js.map +0 -1
- package/dist/JSEditor-DfwRLBZg.js +0 -1297
- package/dist/JSEditor-DfwRLBZg.js.map +0 -1
- package/dist/LogsExplorer-_4sZadKn.js +0 -162
- package/dist/LogsExplorer-_4sZadKn.js.map +0 -1
- package/dist/MonacoEditor-CMYEjiRf.js +0 -161
- package/dist/MonacoEditor-CMYEjiRf.js.map +0 -1
- package/dist/RLSEditor-CHEExeSB.js +0 -1871
- package/dist/RLSEditor-CHEExeSB.js.map +0 -1
- package/dist/SQLEditor-CQXaI0iU.js +0 -1797
- package/dist/SQLEditor-CQXaI0iU.js.map +0 -1
- package/dist/SchemaVisualizer-BGpmzyXT.js +0 -1069
- package/dist/SchemaVisualizer-BGpmzyXT.js.map +0 -1
- package/dist/StorageView-B7AsN2qX.js +0 -869
- package/dist/StorageView-B7AsN2qX.js.map +0 -1
- package/dist/common/src/collections/CollectionRegistry.d.ts +0 -56
- package/dist/common/src/collections/default-collections.d.ts +0 -9
- package/dist/common/src/collections/index.d.ts +0 -2
- package/dist/common/src/data/buildRebaseData.d.ts +0 -14
- package/dist/common/src/data/query_builder.d.ts +0 -55
- package/dist/common/src/index.d.ts +0 -4
- package/dist/common/src/util/builders.d.ts +0 -57
- package/dist/common/src/util/callbacks.d.ts +0 -6
- package/dist/common/src/util/collections.d.ts +0 -11
- package/dist/common/src/util/common.d.ts +0 -2
- package/dist/common/src/util/conditions.d.ts +0 -26
- package/dist/common/src/util/entities.d.ts +0 -58
- package/dist/common/src/util/enums.d.ts +0 -3
- package/dist/common/src/util/index.d.ts +0 -16
- package/dist/common/src/util/navigation_from_path.d.ts +0 -34
- package/dist/common/src/util/navigation_utils.d.ts +0 -20
- package/dist/common/src/util/parent_references_from_path.d.ts +0 -6
- package/dist/common/src/util/paths.d.ts +0 -14
- package/dist/common/src/util/permissions.d.ts +0 -14
- package/dist/common/src/util/references.d.ts +0 -2
- package/dist/common/src/util/relations.d.ts +0 -22
- package/dist/common/src/util/resolutions.d.ts +0 -72
- package/dist/common/src/util/storage.d.ts +0 -24
- package/dist/core/src/components/AIIcon.d.ts +0 -16
- package/dist/core/src/components/BootstrapAdminBanner.d.ts +0 -4
- package/dist/core/src/components/ConfirmationDialog.d.ts +0 -9
- package/dist/core/src/components/Debug/UIReferenceView.d.ts +0 -1
- package/dist/core/src/components/Debug/UIStyleGuide.d.ts +0 -1
- package/dist/core/src/components/ErrorTooltip.d.ts +0 -2
- package/dist/core/src/components/ErrorView.d.ts +0 -21
- package/dist/core/src/components/LanguageToggle.d.ts +0 -1
- package/dist/core/src/components/LoginView/LoginView.d.ts +0 -109
- package/dist/core/src/components/LoginView/index.d.ts +0 -2
- package/dist/core/src/components/NotFoundPage.d.ts +0 -1
- package/dist/core/src/components/RebaseAuth.d.ts +0 -10
- package/dist/core/src/components/RebaseLogo.d.ts +0 -7
- package/dist/core/src/components/UnsavedChangesDialog.d.ts +0 -9
- package/dist/core/src/components/UserDisplay.d.ts +0 -7
- package/dist/core/src/components/UserSelectPopover.d.ts +0 -62
- package/dist/core/src/components/UserSettingsView.d.ts +0 -1
- package/dist/core/src/components/common/index.d.ts +0 -6
- package/dist/core/src/components/common/table_height.d.ts +0 -5
- package/dist/core/src/components/common/types.d.ts +0 -66
- package/dist/core/src/components/common/useColumnsIds.d.ts +0 -9
- package/dist/core/src/components/common/useDataTableController.d.ts +0 -45
- package/dist/core/src/components/common/useDebouncedData.d.ts +0 -9
- package/dist/core/src/components/common/useScrollRestoration.d.ts +0 -14
- package/dist/core/src/components/index.d.ts +0 -17
- package/dist/core/src/contexts/AdminModeController.d.ts +0 -4
- package/dist/core/src/contexts/AnalyticsContext.d.ts +0 -3
- package/dist/core/src/contexts/AuthControllerContext.d.ts +0 -3
- package/dist/core/src/contexts/CustomizationControllerContext.d.ts +0 -3
- package/dist/core/src/contexts/DataDriverContext.d.ts +0 -3
- package/dist/core/src/contexts/DatabaseAdminContext.d.ts +0 -3
- package/dist/core/src/contexts/DialogsProvider.d.ts +0 -4
- package/dist/core/src/contexts/EffectiveRoleController.d.ts +0 -4
- package/dist/core/src/contexts/InternalUserManagementContext.d.ts +0 -3
- package/dist/core/src/contexts/ModeController.d.ts +0 -4
- package/dist/core/src/contexts/RebaseClientInstanceContext.d.ts +0 -6
- package/dist/core/src/contexts/RebaseDataContext.d.ts +0 -3
- package/dist/core/src/contexts/SnackbarProvider.d.ts +0 -2
- package/dist/core/src/contexts/StorageSourceContext.d.ts +0 -3
- package/dist/core/src/contexts/UserConfigurationPersistenceContext.d.ts +0 -3
- package/dist/core/src/contexts/index.d.ts +0 -13
- package/dist/core/src/core/PluginLifecycleManager.d.ts +0 -17
- package/dist/core/src/core/PluginProviderStack.d.ts +0 -21
- package/dist/core/src/core/Rebase.d.ts +0 -14
- package/dist/core/src/core/RebaseProps.d.ts +0 -147
- package/dist/core/src/core/RebaseRouter.d.ts +0 -4
- package/dist/core/src/core/RebaseRoutes.d.ts +0 -17
- package/dist/core/src/core/index.d.ts +0 -4
- package/dist/core/src/hooks/ApiConfigContext.d.ts +0 -24
- package/dist/core/src/hooks/data/delete.d.ts +0 -31
- package/dist/core/src/hooks/data/save.d.ts +0 -34
- package/dist/core/src/hooks/data/useCollectionFetch.d.ts +0 -62
- package/dist/core/src/hooks/data/useData.d.ts +0 -13
- package/dist/core/src/hooks/data/useDataOrder.d.ts +0 -12
- package/dist/core/src/hooks/data/useEntityFetch.d.ts +0 -43
- package/dist/core/src/hooks/data/useRelationSelector.d.ts +0 -52
- package/dist/core/src/hooks/data/useUserSelector.d.ts +0 -31
- package/dist/core/src/hooks/index.d.ts +0 -37
- package/dist/core/src/hooks/useAdminModeController.d.ts +0 -19
- package/dist/core/src/hooks/useAnalyticsController.d.ts +0 -5
- package/dist/core/src/hooks/useAuthController.d.ts +0 -11
- package/dist/core/src/hooks/useAuthSubscription.d.ts +0 -2
- package/dist/core/src/hooks/useBackendStorageSource.d.ts +0 -30
- package/dist/core/src/hooks/useBridgeRegistration.d.ts +0 -18
- package/dist/core/src/hooks/useBrowserTitleAndIcon.d.ts +0 -6
- package/dist/core/src/hooks/useBuildAdminModeController.d.ts +0 -6
- package/dist/core/src/hooks/useBuildEffectiveRoleController.d.ts +0 -8
- package/dist/core/src/hooks/useBuildLocalConfigurationPersistence.d.ts +0 -2
- package/dist/core/src/hooks/useBuildModeController.d.ts +0 -6
- package/dist/core/src/hooks/useClipboard.d.ts +0 -57
- package/dist/core/src/hooks/useCollapsedGroups.d.ts +0 -27
- package/dist/core/src/hooks/useCustomizationController.d.ts +0 -11
- package/dist/core/src/hooks/useDialogsController.d.ts +0 -11
- package/dist/core/src/hooks/useEffectiveRoleController.d.ts +0 -7
- package/dist/core/src/hooks/useInternalUserManagementController.d.ts +0 -12
- package/dist/core/src/hooks/useLargeLayout.d.ts +0 -1
- package/dist/core/src/hooks/useModeController.d.ts +0 -19
- package/dist/core/src/hooks/usePermissions.d.ts +0 -12
- package/dist/core/src/hooks/useRebaseClient.d.ts +0 -5
- package/dist/core/src/hooks/useRebaseContext.d.ts +0 -11
- package/dist/core/src/hooks/useRebaseRegistry.d.ts +0 -34
- package/dist/core/src/hooks/useResolvedComponent.d.ts +0 -47
- package/dist/core/src/hooks/useSlot.d.ts +0 -18
- package/dist/core/src/hooks/useSnackbarController.d.ts +0 -20
- package/dist/core/src/hooks/useStorageSource.d.ts +0 -7
- package/dist/core/src/hooks/useStudioBridge.d.ts +0 -91
- package/dist/core/src/hooks/useTranslation.d.ts +0 -17
- package/dist/core/src/hooks/useUnsavedChangesDialog.d.ts +0 -12
- package/dist/core/src/hooks/useUserConfigurationPersistence.d.ts +0 -8
- package/dist/core/src/i18n/RebaseI18nProvider.d.ts +0 -33
- package/dist/core/src/index.d.ts +0 -15
- package/dist/core/src/internal/common.d.ts +0 -3
- package/dist/core/src/internal/useRestoreScroll.d.ts +0 -6
- package/dist/core/src/locales/de.d.ts +0 -2
- package/dist/core/src/locales/en.d.ts +0 -10
- package/dist/core/src/locales/es.d.ts +0 -10
- package/dist/core/src/locales/fr.d.ts +0 -2
- package/dist/core/src/locales/hi.d.ts +0 -2
- package/dist/core/src/locales/it.d.ts +0 -2
- package/dist/core/src/locales/pt.d.ts +0 -7
- package/dist/core/src/util/constants.d.ts +0 -1
- package/dist/core/src/util/createFormexStub.d.ts +0 -2
- package/dist/core/src/util/entity_cache.d.ts +0 -22
- package/dist/core/src/util/enums.d.ts +0 -5
- package/dist/core/src/util/icon_list.d.ts +0 -5
- package/dist/core/src/util/icons.d.ts +0 -20
- package/dist/core/src/util/index.d.ts +0 -8
- package/dist/core/src/util/previews.d.ts +0 -4
- package/dist/core/src/util/useStorageUploadController.d.ts +0 -38
- package/dist/formex/src/Field.d.ts +0 -52
- package/dist/formex/src/Formex.d.ts +0 -7
- package/dist/formex/src/index.d.ts +0 -5
- package/dist/formex/src/types.d.ts +0 -40
- package/dist/formex/src/useCreateFormex.d.ts +0 -14
- package/dist/formex/src/utils.d.ts +0 -16
- package/dist/studio/src/components/Branches/BranchesView.d.ts +0 -1
- package/dist/studio/src/components/CronJobs/CronJobsView.d.ts +0 -1
- package/dist/studio/src/components/JSEditor/JSEditor.d.ts +0 -1
- package/dist/studio/src/components/LogsExplorer/LogsExplorer.d.ts +0 -1
- package/dist/studio/src/components/SchemaVisualizer/SchemaVisualizer.d.ts +0 -2
- package/dist/studio/src/components/StorageView/StorageView.d.ts +0 -1
- package/dist/types/src/controllers/analytics_controller.d.ts +0 -7
- package/dist/types/src/controllers/auth.d.ts +0 -104
- package/dist/types/src/controllers/client.d.ts +0 -168
- package/dist/types/src/controllers/collection_registry.d.ts +0 -46
- package/dist/types/src/controllers/customization_controller.d.ts +0 -60
- package/dist/types/src/controllers/data.d.ts +0 -207
- package/dist/types/src/controllers/data_driver.d.ts +0 -218
- package/dist/types/src/controllers/database_admin.d.ts +0 -11
- package/dist/types/src/controllers/dialogs_controller.d.ts +0 -36
- package/dist/types/src/controllers/effective_role.d.ts +0 -4
- package/dist/types/src/controllers/email.d.ts +0 -36
- package/dist/types/src/controllers/index.d.ts +0 -18
- package/dist/types/src/controllers/local_config_persistence.d.ts +0 -20
- package/dist/types/src/controllers/navigation.d.ts +0 -225
- package/dist/types/src/controllers/registry.d.ts +0 -63
- package/dist/types/src/controllers/side_dialogs_controller.d.ts +0 -67
- package/dist/types/src/controllers/side_entity_controller.d.ts +0 -97
- package/dist/types/src/controllers/snackbar.d.ts +0 -24
- package/dist/types/src/controllers/storage.d.ts +0 -171
- package/dist/types/src/index.d.ts +0 -4
- package/dist/types/src/rebase_context.d.ts +0 -122
- package/dist/types/src/types/auth_adapter.d.ts +0 -301
- package/dist/types/src/types/backend.d.ts +0 -571
- package/dist/types/src/types/backend_hooks.d.ts +0 -172
- package/dist/types/src/types/builders.d.ts +0 -15
- package/dist/types/src/types/chips.d.ts +0 -5
- package/dist/types/src/types/collections.d.ts +0 -961
- package/dist/types/src/types/component_ref.d.ts +0 -47
- package/dist/types/src/types/cron.d.ts +0 -102
- package/dist/types/src/types/data_source.d.ts +0 -64
- package/dist/types/src/types/database_adapter.d.ts +0 -94
- package/dist/types/src/types/entities.d.ts +0 -145
- package/dist/types/src/types/entity_actions.d.ts +0 -104
- package/dist/types/src/types/entity_callbacks.d.ts +0 -173
- package/dist/types/src/types/entity_link_builder.d.ts +0 -7
- package/dist/types/src/types/entity_overrides.d.ts +0 -10
- package/dist/types/src/types/entity_views.d.ts +0 -87
- package/dist/types/src/types/export_import.d.ts +0 -21
- package/dist/types/src/types/formex.d.ts +0 -40
- package/dist/types/src/types/index.d.ts +0 -28
- package/dist/types/src/types/locales.d.ts +0 -4
- package/dist/types/src/types/modify_collections.d.ts +0 -5
- package/dist/types/src/types/plugins.d.ts +0 -282
- package/dist/types/src/types/properties.d.ts +0 -1173
- package/dist/types/src/types/property_config.d.ts +0 -74
- package/dist/types/src/types/relations.d.ts +0 -336
- package/dist/types/src/types/slots.d.ts +0 -262
- package/dist/types/src/types/translations.d.ts +0 -900
- package/dist/types/src/types/user_management_delegate.d.ts +0 -86
- package/dist/types/src/types/websockets.d.ts +0 -78
- package/dist/types/src/users/index.d.ts +0 -1
- package/dist/types/src/users/user.d.ts +0 -50
- package/dist/ui/src/components/Alert.d.ts +0 -12
- package/dist/ui/src/components/Autocomplete.d.ts +0 -21
- package/dist/ui/src/components/Avatar.d.ts +0 -11
- package/dist/ui/src/components/Badge.d.ts +0 -8
- package/dist/ui/src/components/BooleanSwitch.d.ts +0 -14
- package/dist/ui/src/components/BooleanSwitchWithLabel.d.ts +0 -17
- package/dist/ui/src/components/Button.d.ts +0 -14
- package/dist/ui/src/components/Card.d.ts +0 -8
- package/dist/ui/src/components/CenteredView.d.ts +0 -9
- package/dist/ui/src/components/Checkbox.d.ts +0 -13
- package/dist/ui/src/components/Chip.d.ts +0 -26
- package/dist/ui/src/components/CircularProgress.d.ts +0 -5
- package/dist/ui/src/components/CircularProgressCenter.d.ts +0 -11
- package/dist/ui/src/components/Collapse.d.ts +0 -9
- package/dist/ui/src/components/ColorPicker.d.ts +0 -30
- package/dist/ui/src/components/Container.d.ts +0 -8
- package/dist/ui/src/components/DateTimeField.d.ts +0 -24
- package/dist/ui/src/components/DebouncedTextField.d.ts +0 -2
- package/dist/ui/src/components/Dialog.d.ts +0 -39
- package/dist/ui/src/components/DialogActions.d.ts +0 -7
- package/dist/ui/src/components/DialogContent.d.ts +0 -7
- package/dist/ui/src/components/DialogTitle.d.ts +0 -10
- package/dist/ui/src/components/ErrorBoundary.d.ts +0 -33
- package/dist/ui/src/components/ExpandablePanel.d.ts +0 -12
- package/dist/ui/src/components/FileUpload.d.ts +0 -23
- package/dist/ui/src/components/FilterChip.d.ts +0 -34
- package/dist/ui/src/components/IconButton.d.ts +0 -12
- package/dist/ui/src/components/InfoLabel.d.ts +0 -5
- package/dist/ui/src/components/InputLabel.d.ts +0 -11
- package/dist/ui/src/components/Label.d.ts +0 -7
- package/dist/ui/src/components/LoadingButton.d.ts +0 -7
- package/dist/ui/src/components/Markdown.d.ts +0 -10
- package/dist/ui/src/components/Menu.d.ts +0 -23
- package/dist/ui/src/components/Menubar.d.ts +0 -80
- package/dist/ui/src/components/MultiSelect.d.ts +0 -48
- package/dist/ui/src/components/Paper.d.ts +0 -6
- package/dist/ui/src/components/Popover.d.ts +0 -24
- package/dist/ui/src/components/RadioGroup.d.ts +0 -28
- package/dist/ui/src/components/ResizablePanels.d.ts +0 -18
- package/dist/ui/src/components/SearchBar.d.ts +0 -26
- package/dist/ui/src/components/Select.d.ts +0 -43
- package/dist/ui/src/components/Separator.d.ts +0 -5
- package/dist/ui/src/components/Sheet.d.ts +0 -22
- package/dist/ui/src/components/Skeleton.d.ts +0 -6
- package/dist/ui/src/components/Slider.d.ts +0 -21
- package/dist/ui/src/components/Table.d.ts +0 -34
- package/dist/ui/src/components/Tabs.d.ts +0 -19
- package/dist/ui/src/components/TextField.d.ts +0 -58
- package/dist/ui/src/components/TextareaAutosize.d.ts +0 -43
- package/dist/ui/src/components/ToggleButtonGroup.d.ts +0 -30
- package/dist/ui/src/components/Tooltip.d.ts +0 -19
- package/dist/ui/src/components/Typography.d.ts +0 -36
- package/dist/ui/src/components/VirtualTable/VirtualTable.d.ts +0 -11
- package/dist/ui/src/components/VirtualTable/VirtualTableCell.d.ts +0 -21
- package/dist/ui/src/components/VirtualTable/VirtualTableHeader.d.ts +0 -29
- package/dist/ui/src/components/VirtualTable/VirtualTableHeaderRow.d.ts +0 -2
- package/dist/ui/src/components/VirtualTable/VirtualTableProps.d.ts +0 -249
- package/dist/ui/src/components/VirtualTable/VirtualTableRow.d.ts +0 -3
- package/dist/ui/src/components/VirtualTable/index.d.ts +0 -3
- package/dist/ui/src/components/VirtualTable/types.d.ts +0 -38
- package/dist/ui/src/components/common/SelectInputLabel.d.ts +0 -5
- package/dist/ui/src/components/index.d.ts +0 -58
- package/dist/ui/src/hooks/PortalContainerContext.d.ts +0 -31
- package/dist/ui/src/hooks/index.d.ts +0 -6
- package/dist/ui/src/hooks/useDebounceCallback.d.ts +0 -1
- package/dist/ui/src/hooks/useDebounceValue.d.ts +0 -1
- package/dist/ui/src/hooks/useDebouncedCallback.d.ts +0 -1
- package/dist/ui/src/hooks/useInjectStyles.d.ts +0 -7
- package/dist/ui/src/hooks/useOutsideAlerter.d.ts +0 -5
- package/dist/ui/src/icons/GitHubIcon.d.ts +0 -2
- package/dist/ui/src/icons/HandleIcon.d.ts +0 -1
- package/dist/ui/src/icons/Icon.d.ts +0 -20
- package/dist/ui/src/icons/cool_icon_keys.d.ts +0 -1
- package/dist/ui/src/icons/icon_keys.d.ts +0 -1
- package/dist/ui/src/icons/index.d.ts +0 -8
- package/dist/ui/src/index.d.ts +0 -5
- package/dist/ui/src/styles.d.ts +0 -12
- package/dist/ui/src/util/chip_colors.d.ts +0 -4
- package/dist/ui/src/util/cls.d.ts +0 -2
- package/dist/ui/src/util/debounce.d.ts +0 -10
- package/dist/ui/src/util/hash.d.ts +0 -1
- package/dist/ui/src/util/index.d.ts +0 -4
- package/dist/ui/src/util/key_to_icon_component.d.ts +0 -1
- /package/dist/{studio/src/components → components}/ApiExplorer/parseSpec.d.ts +0 -0
- /package/dist/{studio/src/components → components}/ApiExplorer/types.d.ts +0 -0
- /package/dist/{studio/src/components → components}/RLSEditor/index.d.ts +0 -0
- /package/dist/{studio/src/components → components}/RebaseStudio.d.ts +0 -0
- /package/dist/{studio/src/components → components}/SQLEditor/ExplainVisualizer.d.ts +0 -0
- /package/dist/{studio/src/components → components}/SchemaVisualizer/schema-visualizer.utils.d.ts +0 -0
- /package/dist/{studio/src/components → components}/SchemaVisualizer/useSchemaGraph.d.ts +0 -0
- /package/dist/{studio/src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{studio/src/utils → utils}/pgColumnToProperty.d.ts +0 -0
- /package/dist/{studio/src/utils → utils}/sql_utils.d.ts +0 -0
|
@@ -1,1052 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useMemo, useEffect, useCallback } from "react";
|
|
3
|
-
import { useRebaseContext, useApiConfig, useAuthController } from "@rebasepro/core";
|
|
4
|
-
import { Typography, SlidersHorizontalIcon, iconSize, cls, defaultBorderMixin, UploadIcon, Chip, ArrowRightFromLineIcon, TextField, Button, LoaderIcon, SendIcon, PlusIcon, IconButton, XIcon, Alert, CircularProgress, BookOpenIcon, SearchBar, PlayIcon } from "@rebasepro/ui";
|
|
5
|
-
import { c } from "react-compiler-runtime";
|
|
6
|
-
import { A as AuthSimulationSelector } from "./AuthSimulationSelector-DGoXkWSg.js";
|
|
7
|
-
function parseOpenApiSpec(spec) {
|
|
8
|
-
const allEndpoints = [];
|
|
9
|
-
const tagMap = /* @__PURE__ */ new Map();
|
|
10
|
-
const tagDescriptions = /* @__PURE__ */ new Map();
|
|
11
|
-
for (const t of spec.tags ?? []) {
|
|
12
|
-
tagDescriptions.set(t.name, t.description ?? "");
|
|
13
|
-
}
|
|
14
|
-
for (const [path, methods] of Object.entries(spec.paths ?? {})) {
|
|
15
|
-
for (const [method, op] of Object.entries(methods)) {
|
|
16
|
-
if (["get", "post", "put", "patch", "delete"].indexOf(method) === -1) continue;
|
|
17
|
-
const tags = op.tags?.length ? op.tags : ["Other"];
|
|
18
|
-
const shortPath = path.replace(/^\/api\/data/, "");
|
|
19
|
-
const endpoint = {
|
|
20
|
-
id: `${method}:${path}`,
|
|
21
|
-
method,
|
|
22
|
-
path,
|
|
23
|
-
shortPath: shortPath || "/",
|
|
24
|
-
summary: op.summary ?? "",
|
|
25
|
-
description: op.description ?? "",
|
|
26
|
-
tags,
|
|
27
|
-
parameters: op.parameters ?? [],
|
|
28
|
-
requestBody: op.requestBody,
|
|
29
|
-
responses: op.responses ?? {},
|
|
30
|
-
security: op.security,
|
|
31
|
-
operationId: op.operationId
|
|
32
|
-
};
|
|
33
|
-
allEndpoints.push(endpoint);
|
|
34
|
-
for (const tag of tags) {
|
|
35
|
-
if (!tagMap.has(tag)) tagMap.set(tag, []);
|
|
36
|
-
tagMap.get(tag).push(endpoint);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
const ORDER = {
|
|
41
|
-
get: 0,
|
|
42
|
-
post: 1,
|
|
43
|
-
put: 2,
|
|
44
|
-
patch: 3,
|
|
45
|
-
delete: 4
|
|
46
|
-
};
|
|
47
|
-
const groups = [];
|
|
48
|
-
const tagOrder = (spec.tags ?? []).map((t) => t.name);
|
|
49
|
-
const sortedTags = [...tagMap.keys()].sort((a, b) => {
|
|
50
|
-
const ai = tagOrder.indexOf(a);
|
|
51
|
-
const bi = tagOrder.indexOf(b);
|
|
52
|
-
if (ai !== -1 && bi !== -1) return ai - bi;
|
|
53
|
-
if (ai !== -1) return -1;
|
|
54
|
-
if (bi !== -1) return 1;
|
|
55
|
-
return a.localeCompare(b);
|
|
56
|
-
});
|
|
57
|
-
for (const tag of sortedTags) {
|
|
58
|
-
const endpoints = tagMap.get(tag);
|
|
59
|
-
endpoints.sort((a, b) => {
|
|
60
|
-
const pa = a.path.localeCompare(b.path);
|
|
61
|
-
if (pa !== 0) return pa;
|
|
62
|
-
return (ORDER[a.method] ?? 99) - (ORDER[b.method] ?? 99);
|
|
63
|
-
});
|
|
64
|
-
groups.push({
|
|
65
|
-
tag,
|
|
66
|
-
description: tagDescriptions.get(tag),
|
|
67
|
-
endpoints
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
return {
|
|
71
|
-
groups,
|
|
72
|
-
allEndpoints
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
function resolveRefName(ref) {
|
|
76
|
-
const parts = ref.split("/");
|
|
77
|
-
return parts[parts.length - 1];
|
|
78
|
-
}
|
|
79
|
-
function resolveRef(spec, ref) {
|
|
80
|
-
const parts = ref.replace("#/", "").split("/");
|
|
81
|
-
let current = spec;
|
|
82
|
-
for (const part of parts) {
|
|
83
|
-
current = current?.[part];
|
|
84
|
-
}
|
|
85
|
-
return current ?? {};
|
|
86
|
-
}
|
|
87
|
-
function EndpointDetail(t0) {
|
|
88
|
-
const $ = c(21);
|
|
89
|
-
const {
|
|
90
|
-
endpoint,
|
|
91
|
-
spec
|
|
92
|
-
} = t0;
|
|
93
|
-
let t1;
|
|
94
|
-
if ($[0] !== endpoint.description || $[1] !== endpoint.summary) {
|
|
95
|
-
t1 = (endpoint.summary || endpoint.description) && /* @__PURE__ */ jsxs("div", { children: [
|
|
96
|
-
endpoint.summary && /* @__PURE__ */ jsx(Typography, { variant: "h6", className: "font-semibold mb-1", children: endpoint.summary }),
|
|
97
|
-
endpoint.description && /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-text-secondary dark:text-text-secondary-dark", children: endpoint.description })
|
|
98
|
-
] });
|
|
99
|
-
$[0] = endpoint.description;
|
|
100
|
-
$[1] = endpoint.summary;
|
|
101
|
-
$[2] = t1;
|
|
102
|
-
} else {
|
|
103
|
-
t1 = $[2];
|
|
104
|
-
}
|
|
105
|
-
let t2;
|
|
106
|
-
if ($[3] !== endpoint.parameters) {
|
|
107
|
-
t2 = endpoint.parameters.length > 0 && /* @__PURE__ */ jsxs("section", { children: [
|
|
108
|
-
/* @__PURE__ */ jsx(SectionHeading, { icon: /* @__PURE__ */ jsx(SlidersHorizontalIcon, { size: iconSize.small, className: "text-text-secondary dark:text-text-secondary-dark" }), title: "Parameters" }),
|
|
109
|
-
/* @__PURE__ */ jsx("div", { className: cls("rounded-lg border overflow-hidden", defaultBorderMixin), children: /* @__PURE__ */ jsxs("table", { className: "w-full text-sm", children: [
|
|
110
|
-
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "bg-surface-100 dark:bg-surface-900 text-left", children: [
|
|
111
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-2 font-medium text-text-secondary dark:text-text-secondary-dark", children: "Name" }),
|
|
112
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-2 font-medium text-text-secondary dark:text-text-secondary-dark", children: "In" }),
|
|
113
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-2 font-medium text-text-secondary dark:text-text-secondary-dark", children: "Type" }),
|
|
114
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-2 font-medium text-text-secondary dark:text-text-secondary-dark", children: "Description" })
|
|
115
|
-
] }) }),
|
|
116
|
-
/* @__PURE__ */ jsx("tbody", { children: endpoint.parameters.map(_temp) })
|
|
117
|
-
] }) })
|
|
118
|
-
] });
|
|
119
|
-
$[3] = endpoint.parameters;
|
|
120
|
-
$[4] = t2;
|
|
121
|
-
} else {
|
|
122
|
-
t2 = $[4];
|
|
123
|
-
}
|
|
124
|
-
let t3;
|
|
125
|
-
if ($[5] !== endpoint.requestBody || $[6] !== spec) {
|
|
126
|
-
t3 = endpoint.requestBody && /* @__PURE__ */ jsxs("section", { children: [
|
|
127
|
-
/* @__PURE__ */ jsx(SectionHeading, { icon: /* @__PURE__ */ jsx(UploadIcon, { size: iconSize.small, className: "text-text-secondary dark:text-text-secondary-dark" }), title: "Request Body" }),
|
|
128
|
-
Object.entries(endpoint.requestBody.content ?? {}).map((t42) => {
|
|
129
|
-
const [contentType, media] = t42;
|
|
130
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
131
|
-
/* @__PURE__ */ jsx(Chip, { size: "smallest", colorScheme: "blueDarker", className: "mb-3", children: contentType }),
|
|
132
|
-
media.schema && /* @__PURE__ */ jsx(SchemaBlock, { schema: media.schema, spec, depth: 0 })
|
|
133
|
-
] }, contentType);
|
|
134
|
-
})
|
|
135
|
-
] });
|
|
136
|
-
$[5] = endpoint.requestBody;
|
|
137
|
-
$[6] = spec;
|
|
138
|
-
$[7] = t3;
|
|
139
|
-
} else {
|
|
140
|
-
t3 = $[7];
|
|
141
|
-
}
|
|
142
|
-
let t4;
|
|
143
|
-
if ($[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
144
|
-
t4 = /* @__PURE__ */ jsx(SectionHeading, { icon: /* @__PURE__ */ jsx(ArrowRightFromLineIcon, { size: iconSize.small, className: "text-text-secondary dark:text-text-secondary-dark" }), title: "Responses" });
|
|
145
|
-
$[8] = t4;
|
|
146
|
-
} else {
|
|
147
|
-
t4 = $[8];
|
|
148
|
-
}
|
|
149
|
-
let t5;
|
|
150
|
-
if ($[9] !== endpoint.responses || $[10] !== spec) {
|
|
151
|
-
let t62;
|
|
152
|
-
if ($[12] !== spec) {
|
|
153
|
-
t62 = (t72) => {
|
|
154
|
-
const [code, res] = t72;
|
|
155
|
-
return /* @__PURE__ */ jsxs("div", { className: cls("rounded-lg border overflow-hidden", defaultBorderMixin), children: [
|
|
156
|
-
/* @__PURE__ */ jsxs("div", { className: cls("flex items-center gap-3 px-4 py-2.5", "bg-surface-50 dark:bg-surface-900/50"), children: [
|
|
157
|
-
/* @__PURE__ */ jsx(StatusBadge, { code }),
|
|
158
|
-
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-text-secondary dark:text-text-secondary-dark text-xs", children: res.description })
|
|
159
|
-
] }),
|
|
160
|
-
res.content && Object.entries(res.content).map((t8) => {
|
|
161
|
-
const [ct, media_0] = t8;
|
|
162
|
-
return media_0.schema && /* @__PURE__ */ jsx("div", { className: cls("px-4 py-3 border-t", defaultBorderMixin), children: /* @__PURE__ */ jsx(SchemaBlock, { schema: media_0.schema, spec, depth: 0 }) }, ct);
|
|
163
|
-
})
|
|
164
|
-
] }, code);
|
|
165
|
-
};
|
|
166
|
-
$[12] = spec;
|
|
167
|
-
$[13] = t62;
|
|
168
|
-
} else {
|
|
169
|
-
t62 = $[13];
|
|
170
|
-
}
|
|
171
|
-
t5 = Object.entries(endpoint.responses).map(t62);
|
|
172
|
-
$[9] = endpoint.responses;
|
|
173
|
-
$[10] = spec;
|
|
174
|
-
$[11] = t5;
|
|
175
|
-
} else {
|
|
176
|
-
t5 = $[11];
|
|
177
|
-
}
|
|
178
|
-
let t6;
|
|
179
|
-
if ($[14] !== t5) {
|
|
180
|
-
t6 = /* @__PURE__ */ jsxs("section", { children: [
|
|
181
|
-
t4,
|
|
182
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-3", children: t5 })
|
|
183
|
-
] });
|
|
184
|
-
$[14] = t5;
|
|
185
|
-
$[15] = t6;
|
|
186
|
-
} else {
|
|
187
|
-
t6 = $[15];
|
|
188
|
-
}
|
|
189
|
-
let t7;
|
|
190
|
-
if ($[16] !== t1 || $[17] !== t2 || $[18] !== t3 || $[19] !== t6) {
|
|
191
|
-
t7 = /* @__PURE__ */ jsxs("div", { className: "p-6 space-y-8 max-w-4xl", children: [
|
|
192
|
-
t1,
|
|
193
|
-
t2,
|
|
194
|
-
t3,
|
|
195
|
-
t6
|
|
196
|
-
] });
|
|
197
|
-
$[16] = t1;
|
|
198
|
-
$[17] = t2;
|
|
199
|
-
$[18] = t3;
|
|
200
|
-
$[19] = t6;
|
|
201
|
-
$[20] = t7;
|
|
202
|
-
} else {
|
|
203
|
-
t7 = $[20];
|
|
204
|
-
}
|
|
205
|
-
return t7;
|
|
206
|
-
}
|
|
207
|
-
function _temp(p, i) {
|
|
208
|
-
return /* @__PURE__ */ jsxs("tr", { className: cls("border-t", defaultBorderMixin), children: [
|
|
209
|
-
/* @__PURE__ */ jsxs("td", { className: "px-4 py-2.5", children: [
|
|
210
|
-
/* @__PURE__ */ jsx("code", { className: "text-xs font-mono font-semibold", children: p.name }),
|
|
211
|
-
p.required && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-1 text-xs", children: "*" })
|
|
212
|
-
] }),
|
|
213
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-2.5", children: /* @__PURE__ */ jsx(Chip, { size: "smallest", colorScheme: p.in === "path" ? "orangeDarker" : "cyanDarker", children: p.in }) }),
|
|
214
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-2.5 text-xs font-mono text-text-secondary dark:text-text-secondary-dark", children: schemaTypeLabel(p.schema) }),
|
|
215
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-2.5 text-xs text-text-secondary dark:text-text-secondary-dark", children: p.description ?? "—" })
|
|
216
|
-
] }, p.name + i);
|
|
217
|
-
}
|
|
218
|
-
function SchemaBlock(t0) {
|
|
219
|
-
const $ = c(43);
|
|
220
|
-
const {
|
|
221
|
-
schema,
|
|
222
|
-
spec,
|
|
223
|
-
depth
|
|
224
|
-
} = t0;
|
|
225
|
-
if (schema.$ref) {
|
|
226
|
-
let t12;
|
|
227
|
-
if ($[0] !== schema.$ref) {
|
|
228
|
-
t12 = resolveRefName(schema.$ref);
|
|
229
|
-
$[0] = schema.$ref;
|
|
230
|
-
$[1] = t12;
|
|
231
|
-
} else {
|
|
232
|
-
t12 = $[1];
|
|
233
|
-
}
|
|
234
|
-
const name = t12;
|
|
235
|
-
let t22;
|
|
236
|
-
if ($[2] !== schema.$ref || $[3] !== spec) {
|
|
237
|
-
t22 = resolveRef(spec, schema.$ref);
|
|
238
|
-
$[2] = schema.$ref;
|
|
239
|
-
$[3] = spec;
|
|
240
|
-
$[4] = t22;
|
|
241
|
-
} else {
|
|
242
|
-
t22 = $[4];
|
|
243
|
-
}
|
|
244
|
-
const resolved = t22;
|
|
245
|
-
let t3;
|
|
246
|
-
if ($[5] !== name) {
|
|
247
|
-
t3 = /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-primary dark:text-primary-dark font-mono text-xs mb-2 block", children: name });
|
|
248
|
-
$[5] = name;
|
|
249
|
-
$[6] = t3;
|
|
250
|
-
} else {
|
|
251
|
-
t3 = $[6];
|
|
252
|
-
}
|
|
253
|
-
let t4;
|
|
254
|
-
if ($[7] !== depth || $[8] !== resolved || $[9] !== spec) {
|
|
255
|
-
t4 = /* @__PURE__ */ jsx(SchemaBlock, { schema: resolved, spec, depth });
|
|
256
|
-
$[7] = depth;
|
|
257
|
-
$[8] = resolved;
|
|
258
|
-
$[9] = spec;
|
|
259
|
-
$[10] = t4;
|
|
260
|
-
} else {
|
|
261
|
-
t4 = $[10];
|
|
262
|
-
}
|
|
263
|
-
let t5;
|
|
264
|
-
if ($[11] !== t3 || $[12] !== t4) {
|
|
265
|
-
t5 = /* @__PURE__ */ jsxs("div", { children: [
|
|
266
|
-
t3,
|
|
267
|
-
t4
|
|
268
|
-
] });
|
|
269
|
-
$[11] = t3;
|
|
270
|
-
$[12] = t4;
|
|
271
|
-
$[13] = t5;
|
|
272
|
-
} else {
|
|
273
|
-
t5 = $[13];
|
|
274
|
-
}
|
|
275
|
-
return t5;
|
|
276
|
-
}
|
|
277
|
-
if (schema.properties) {
|
|
278
|
-
let t12;
|
|
279
|
-
if ($[14] !== schema.required) {
|
|
280
|
-
t12 = schema.required ?? [];
|
|
281
|
-
$[14] = schema.required;
|
|
282
|
-
$[15] = t12;
|
|
283
|
-
} else {
|
|
284
|
-
t12 = $[15];
|
|
285
|
-
}
|
|
286
|
-
let t22;
|
|
287
|
-
if ($[16] !== t12) {
|
|
288
|
-
t22 = new Set(t12);
|
|
289
|
-
$[16] = t12;
|
|
290
|
-
$[17] = t22;
|
|
291
|
-
} else {
|
|
292
|
-
t22 = $[17];
|
|
293
|
-
}
|
|
294
|
-
const required = t22;
|
|
295
|
-
const t3 = depth > 0 && `border ml-4 mt-1 ${defaultBorderMixin}`;
|
|
296
|
-
let t4;
|
|
297
|
-
if ($[18] !== t3) {
|
|
298
|
-
t4 = cls("rounded-lg overflow-hidden", t3);
|
|
299
|
-
$[18] = t3;
|
|
300
|
-
$[19] = t4;
|
|
301
|
-
} else {
|
|
302
|
-
t4 = $[19];
|
|
303
|
-
}
|
|
304
|
-
let t5;
|
|
305
|
-
if ($[20] !== depth || $[21] !== required || $[22] !== schema.properties || $[23] !== spec) {
|
|
306
|
-
let t62;
|
|
307
|
-
if ($[25] !== depth || $[26] !== required || $[27] !== spec) {
|
|
308
|
-
t62 = (t72) => {
|
|
309
|
-
const [key, prop] = t72;
|
|
310
|
-
return /* @__PURE__ */ jsxs("tr", { className: cls("border-t first:border-t-0", defaultBorderMixin), children: [
|
|
311
|
-
/* @__PURE__ */ jsxs("td", { className: "px-3 py-2 align-top w-36", children: [
|
|
312
|
-
/* @__PURE__ */ jsx("code", { className: "font-mono font-semibold text-text-primary dark:text-text-primary-dark", children: key }),
|
|
313
|
-
required.has(key) && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-0.5", children: "*" }),
|
|
314
|
-
prop.readOnly && /* @__PURE__ */ jsx("span", { className: "ml-1.5 text-[9px] text-text-secondary dark:text-text-secondary-dark italic", children: "read-only" })
|
|
315
|
-
] }),
|
|
316
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 align-top w-28", children: /* @__PURE__ */ jsx("span", { className: "font-mono text-text-secondary dark:text-text-secondary-dark", children: schemaTypeLabel(prop) }) }),
|
|
317
|
-
/* @__PURE__ */ jsxs("td", { className: "px-3 py-2 align-top text-text-secondary dark:text-text-secondary-dark", children: [
|
|
318
|
-
prop.description ?? "",
|
|
319
|
-
prop.enum && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 mt-1", children: prop.enum.map(_temp2) }),
|
|
320
|
-
prop.properties && /* @__PURE__ */ jsx(SchemaBlock, { schema: prop, spec, depth: depth + 1 }),
|
|
321
|
-
prop.$ref && /* @__PURE__ */ jsx(SchemaBlock, { schema: prop, spec, depth: depth + 1 })
|
|
322
|
-
] })
|
|
323
|
-
] }, key);
|
|
324
|
-
};
|
|
325
|
-
$[25] = depth;
|
|
326
|
-
$[26] = required;
|
|
327
|
-
$[27] = spec;
|
|
328
|
-
$[28] = t62;
|
|
329
|
-
} else {
|
|
330
|
-
t62 = $[28];
|
|
331
|
-
}
|
|
332
|
-
t5 = Object.entries(schema.properties).map(t62);
|
|
333
|
-
$[20] = depth;
|
|
334
|
-
$[21] = required;
|
|
335
|
-
$[22] = schema.properties;
|
|
336
|
-
$[23] = spec;
|
|
337
|
-
$[24] = t5;
|
|
338
|
-
} else {
|
|
339
|
-
t5 = $[24];
|
|
340
|
-
}
|
|
341
|
-
let t6;
|
|
342
|
-
if ($[29] !== t5) {
|
|
343
|
-
t6 = /* @__PURE__ */ jsx("table", { className: "w-full text-xs", children: /* @__PURE__ */ jsx("tbody", { children: t5 }) });
|
|
344
|
-
$[29] = t5;
|
|
345
|
-
$[30] = t6;
|
|
346
|
-
} else {
|
|
347
|
-
t6 = $[30];
|
|
348
|
-
}
|
|
349
|
-
let t7;
|
|
350
|
-
if ($[31] !== t4 || $[32] !== t6) {
|
|
351
|
-
t7 = /* @__PURE__ */ jsx("div", { className: t4, children: t6 });
|
|
352
|
-
$[31] = t4;
|
|
353
|
-
$[32] = t6;
|
|
354
|
-
$[33] = t7;
|
|
355
|
-
} else {
|
|
356
|
-
t7 = $[33];
|
|
357
|
-
}
|
|
358
|
-
return t7;
|
|
359
|
-
}
|
|
360
|
-
if (schema.type === "array" && schema.items) {
|
|
361
|
-
let t12;
|
|
362
|
-
if ($[34] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
363
|
-
t12 = /* @__PURE__ */ jsx("span", { className: "font-mono text-xs text-text-secondary dark:text-text-secondary-dark", children: "Array of:" });
|
|
364
|
-
$[34] = t12;
|
|
365
|
-
} else {
|
|
366
|
-
t12 = $[34];
|
|
367
|
-
}
|
|
368
|
-
const t22 = depth + 1;
|
|
369
|
-
let t3;
|
|
370
|
-
if ($[35] !== schema.items || $[36] !== spec || $[37] !== t22) {
|
|
371
|
-
t3 = /* @__PURE__ */ jsxs("div", { children: [
|
|
372
|
-
t12,
|
|
373
|
-
/* @__PURE__ */ jsx(SchemaBlock, { schema: schema.items, spec, depth: t22 })
|
|
374
|
-
] });
|
|
375
|
-
$[35] = schema.items;
|
|
376
|
-
$[36] = spec;
|
|
377
|
-
$[37] = t22;
|
|
378
|
-
$[38] = t3;
|
|
379
|
-
} else {
|
|
380
|
-
t3 = $[38];
|
|
381
|
-
}
|
|
382
|
-
return t3;
|
|
383
|
-
}
|
|
384
|
-
let t1;
|
|
385
|
-
if ($[39] !== schema) {
|
|
386
|
-
t1 = schemaTypeLabel(schema);
|
|
387
|
-
$[39] = schema;
|
|
388
|
-
$[40] = t1;
|
|
389
|
-
} else {
|
|
390
|
-
t1 = $[40];
|
|
391
|
-
}
|
|
392
|
-
let t2;
|
|
393
|
-
if ($[41] !== t1) {
|
|
394
|
-
t2 = /* @__PURE__ */ jsx("span", { className: "font-mono text-xs text-text-secondary dark:text-text-secondary-dark", children: t1 });
|
|
395
|
-
$[41] = t1;
|
|
396
|
-
$[42] = t2;
|
|
397
|
-
} else {
|
|
398
|
-
t2 = $[42];
|
|
399
|
-
}
|
|
400
|
-
return t2;
|
|
401
|
-
}
|
|
402
|
-
function _temp2(v) {
|
|
403
|
-
return /* @__PURE__ */ jsx("span", { className: "px-1.5 py-0.5 rounded bg-surface-200 dark:bg-surface-800 text-[10px] font-mono", children: String(v) }, String(v));
|
|
404
|
-
}
|
|
405
|
-
function schemaTypeLabel(schema) {
|
|
406
|
-
if (!schema) return "any";
|
|
407
|
-
if (schema.$ref) return resolveRefName(schema.$ref);
|
|
408
|
-
if (schema.type === "array") return `${schemaTypeLabel(schema.items)}[]`;
|
|
409
|
-
if (schema.format) return `${schema.type} (${schema.format})`;
|
|
410
|
-
return schema.type ?? "object";
|
|
411
|
-
}
|
|
412
|
-
function SectionHeading(t0) {
|
|
413
|
-
const $ = c(5);
|
|
414
|
-
const {
|
|
415
|
-
icon,
|
|
416
|
-
title
|
|
417
|
-
} = t0;
|
|
418
|
-
let t1;
|
|
419
|
-
if ($[0] !== title) {
|
|
420
|
-
t1 = /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "font-semibold text-sm", children: title });
|
|
421
|
-
$[0] = title;
|
|
422
|
-
$[1] = t1;
|
|
423
|
-
} else {
|
|
424
|
-
t1 = $[1];
|
|
425
|
-
}
|
|
426
|
-
let t2;
|
|
427
|
-
if ($[2] !== icon || $[3] !== t1) {
|
|
428
|
-
t2 = /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-3", children: [
|
|
429
|
-
icon,
|
|
430
|
-
t1
|
|
431
|
-
] });
|
|
432
|
-
$[2] = icon;
|
|
433
|
-
$[3] = t1;
|
|
434
|
-
$[4] = t2;
|
|
435
|
-
} else {
|
|
436
|
-
t2 = $[4];
|
|
437
|
-
}
|
|
438
|
-
return t2;
|
|
439
|
-
}
|
|
440
|
-
function StatusBadge(t0) {
|
|
441
|
-
const $ = c(5);
|
|
442
|
-
const {
|
|
443
|
-
code
|
|
444
|
-
} = t0;
|
|
445
|
-
const n = parseInt(code, 10);
|
|
446
|
-
const color = n < 300 ? "text-emerald-600 dark:text-emerald-400" : n < 400 ? "text-blue-600 dark:text-blue-400" : n < 500 ? "text-amber-600 dark:text-amber-400" : "text-red-600 dark:text-red-400";
|
|
447
|
-
let t1;
|
|
448
|
-
if ($[0] !== color) {
|
|
449
|
-
t1 = cls("text-xs font-bold font-mono", color);
|
|
450
|
-
$[0] = color;
|
|
451
|
-
$[1] = t1;
|
|
452
|
-
} else {
|
|
453
|
-
t1 = $[1];
|
|
454
|
-
}
|
|
455
|
-
let t2;
|
|
456
|
-
if ($[2] !== code || $[3] !== t1) {
|
|
457
|
-
t2 = /* @__PURE__ */ jsx("span", { className: t1, children: code });
|
|
458
|
-
$[2] = code;
|
|
459
|
-
$[3] = t1;
|
|
460
|
-
$[4] = t2;
|
|
461
|
-
} else {
|
|
462
|
-
t2 = $[4];
|
|
463
|
-
}
|
|
464
|
-
return t2;
|
|
465
|
-
}
|
|
466
|
-
function TryItPanel({
|
|
467
|
-
endpoint,
|
|
468
|
-
apiUrl,
|
|
469
|
-
getAuthToken,
|
|
470
|
-
user,
|
|
471
|
-
basePath = ""
|
|
472
|
-
}) {
|
|
473
|
-
const storageKey = `rebase_apiexplorer_${endpoint.method}_${endpoint.path}`;
|
|
474
|
-
const [pathParams, setPathParams] = useState(() => {
|
|
475
|
-
try {
|
|
476
|
-
const v = localStorage.getItem(`${storageKey}_path`);
|
|
477
|
-
if (v) return JSON.parse(v);
|
|
478
|
-
} catch {
|
|
479
|
-
}
|
|
480
|
-
return {};
|
|
481
|
-
});
|
|
482
|
-
const [queryParams, setQueryParams] = useState(() => {
|
|
483
|
-
try {
|
|
484
|
-
const v_0 = localStorage.getItem(`${storageKey}_query`);
|
|
485
|
-
if (v_0) return JSON.parse(v_0);
|
|
486
|
-
} catch {
|
|
487
|
-
}
|
|
488
|
-
return {};
|
|
489
|
-
});
|
|
490
|
-
const [customHeaders, setCustomHeaders] = useState(() => {
|
|
491
|
-
try {
|
|
492
|
-
const v_1 = localStorage.getItem(`${storageKey}_headers`);
|
|
493
|
-
if (v_1) return JSON.parse(v_1);
|
|
494
|
-
} catch {
|
|
495
|
-
}
|
|
496
|
-
return [{
|
|
497
|
-
key: "rebase-branch",
|
|
498
|
-
value: ""
|
|
499
|
-
}];
|
|
500
|
-
});
|
|
501
|
-
const [body, setBody] = useState(() => {
|
|
502
|
-
try {
|
|
503
|
-
const v_2 = localStorage.getItem(`${storageKey}_body`);
|
|
504
|
-
if (v_2) return JSON.parse(v_2);
|
|
505
|
-
} catch {
|
|
506
|
-
}
|
|
507
|
-
return buildBodyTemplate(endpoint);
|
|
508
|
-
});
|
|
509
|
-
const [response, setResponse] = useState(null);
|
|
510
|
-
const [loading, setLoading] = useState(false);
|
|
511
|
-
const [authMode, setAuthMode] = useState("jwt");
|
|
512
|
-
const [validationError, setValidationError] = useState(null);
|
|
513
|
-
const rebaseContext = useRebaseContext();
|
|
514
|
-
const userManagement = rebaseContext.userManagement;
|
|
515
|
-
const currentUser = rebaseContext.authController?.user;
|
|
516
|
-
const users = useMemo(() => {
|
|
517
|
-
const managed = (userManagement?.users ?? []).map((u) => ({
|
|
518
|
-
uid: u.uid,
|
|
519
|
-
displayName: u.displayName,
|
|
520
|
-
email: u.email,
|
|
521
|
-
photoURL: u.photoURL,
|
|
522
|
-
roles: u.roles
|
|
523
|
-
}));
|
|
524
|
-
if (currentUser && !managed.some((u_0) => u_0.uid === currentUser.uid)) {
|
|
525
|
-
managed.unshift({
|
|
526
|
-
uid: currentUser.uid,
|
|
527
|
-
displayName: currentUser.displayName,
|
|
528
|
-
email: currentUser.email,
|
|
529
|
-
photoURL: currentUser.photoURL,
|
|
530
|
-
roles: currentUser.roles
|
|
531
|
-
});
|
|
532
|
-
}
|
|
533
|
-
return managed;
|
|
534
|
-
}, [userManagement?.users, currentUser]);
|
|
535
|
-
const currentSelectableUser = useMemo(() => {
|
|
536
|
-
if (!currentUser) return null;
|
|
537
|
-
return {
|
|
538
|
-
uid: currentUser.uid,
|
|
539
|
-
displayName: currentUser.displayName,
|
|
540
|
-
email: currentUser.email,
|
|
541
|
-
photoURL: currentUser.photoURL,
|
|
542
|
-
roles: currentUser.roles
|
|
543
|
-
};
|
|
544
|
-
}, [currentUser]);
|
|
545
|
-
const [selectedUser, setSelectedUser] = useState(null);
|
|
546
|
-
useEffect(() => {
|
|
547
|
-
localStorage.setItem(`${storageKey}_path`, JSON.stringify(pathParams));
|
|
548
|
-
localStorage.setItem(`${storageKey}_query`, JSON.stringify(queryParams));
|
|
549
|
-
localStorage.setItem(`${storageKey}_headers`, JSON.stringify(customHeaders));
|
|
550
|
-
localStorage.setItem(`${storageKey}_body`, JSON.stringify(body));
|
|
551
|
-
}, [storageKey, pathParams, queryParams, customHeaders, body]);
|
|
552
|
-
const resolvedUrl = useMemo(() => {
|
|
553
|
-
const base = basePath.startsWith("/") ? basePath : `/${basePath}`;
|
|
554
|
-
const cleanBase = base === "/" ? "" : base;
|
|
555
|
-
let url = `${apiUrl.replace(/\/+$/, "")}${cleanBase}${endpoint.path}`;
|
|
556
|
-
for (const [key, val] of Object.entries(pathParams)) {
|
|
557
|
-
url = url.replace(`{${key}}`, encodeURIComponent(val));
|
|
558
|
-
}
|
|
559
|
-
const qp = Object.entries(queryParams).filter(([, v_3]) => v_3.trim() !== "");
|
|
560
|
-
if (qp.length > 0) {
|
|
561
|
-
url += "?" + qp.map(([k, v_4]) => `${encodeURIComponent(k)}=${encodeURIComponent(v_4)}`).join("&");
|
|
562
|
-
}
|
|
563
|
-
return url;
|
|
564
|
-
}, [apiUrl, basePath, endpoint.path, pathParams, queryParams]);
|
|
565
|
-
const pathParamDefs = endpoint.parameters.filter((p) => p.in === "path");
|
|
566
|
-
const queryParamDefs = endpoint.parameters.filter((p_0) => p_0.in === "query");
|
|
567
|
-
const hasBody = ["post", "put", "patch"].includes(endpoint.method);
|
|
568
|
-
const execute = useCallback(async () => {
|
|
569
|
-
setValidationError(null);
|
|
570
|
-
if (hasBody && body.trim()) {
|
|
571
|
-
try {
|
|
572
|
-
JSON.parse(body);
|
|
573
|
-
} catch (err) {
|
|
574
|
-
setValidationError(`Invalid JSON: ${err instanceof Error ? err.message : String(err)}`);
|
|
575
|
-
return;
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
setLoading(true);
|
|
579
|
-
setResponse(null);
|
|
580
|
-
const start = performance.now();
|
|
581
|
-
try {
|
|
582
|
-
const headers = {
|
|
583
|
-
"Content-Type": "application/json"
|
|
584
|
-
};
|
|
585
|
-
for (const h of customHeaders) {
|
|
586
|
-
if (h.key.trim()) headers[h.key.trim()] = h.value;
|
|
587
|
-
}
|
|
588
|
-
if (authMode === "jwt") {
|
|
589
|
-
const token = await getAuthToken();
|
|
590
|
-
if (token) headers["Authorization"] = `Bearer ${token}`;
|
|
591
|
-
if (selectedUser && selectedUser.uid !== currentUser?.uid) {
|
|
592
|
-
headers["x-rebase-impersonate"] = selectedUser.uid;
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
const res = await fetch(resolvedUrl, {
|
|
596
|
-
method: endpoint.method.toUpperCase(),
|
|
597
|
-
headers,
|
|
598
|
-
body: hasBody && body.trim() ? body : void 0
|
|
599
|
-
});
|
|
600
|
-
const elapsed = Math.round(performance.now() - start);
|
|
601
|
-
let text;
|
|
602
|
-
const rawText = await res.text();
|
|
603
|
-
try {
|
|
604
|
-
const json = JSON.parse(rawText);
|
|
605
|
-
text = JSON.stringify(json, null, 2);
|
|
606
|
-
} catch {
|
|
607
|
-
text = rawText;
|
|
608
|
-
}
|
|
609
|
-
setResponse({
|
|
610
|
-
status: res.status,
|
|
611
|
-
statusText: res.statusText,
|
|
612
|
-
body: text,
|
|
613
|
-
time: elapsed
|
|
614
|
-
});
|
|
615
|
-
} catch (err_0) {
|
|
616
|
-
setResponse({
|
|
617
|
-
status: 0,
|
|
618
|
-
statusText: "Network Error",
|
|
619
|
-
body: err_0 instanceof Error ? err_0.message : "Request failed",
|
|
620
|
-
time: Math.round(performance.now() - start)
|
|
621
|
-
});
|
|
622
|
-
} finally {
|
|
623
|
-
setLoading(false);
|
|
624
|
-
}
|
|
625
|
-
}, [resolvedUrl, endpoint.method, hasBody, body, authMode, getAuthToken, customHeaders, selectedUser, currentUser?.uid]);
|
|
626
|
-
return /* @__PURE__ */ jsx("div", { className: "flex flex-col h-full", children: /* @__PURE__ */ jsxs("div", { className: "p-5 space-y-5 overflow-y-auto flex-1", children: [
|
|
627
|
-
/* @__PURE__ */ jsx(AuthSimulationSelector, { authMode, setAuthMode, selectedUser, setSelectedUser, users, loading: userManagement?.loading, currentUser: currentSelectableUser }),
|
|
628
|
-
pathParamDefs.length > 0 && /* @__PURE__ */ jsx(ParamSection, { title: "Path Parameters", params: pathParamDefs, values: pathParams, onChange: (k_0, v_5) => setPathParams((prev) => ({
|
|
629
|
-
...prev,
|
|
630
|
-
[k_0]: v_5
|
|
631
|
-
})) }),
|
|
632
|
-
queryParamDefs.length > 0 && /* @__PURE__ */ jsx(ParamSection, { title: "Query Parameters", params: queryParamDefs, values: queryParams, onChange: (k_1, v_6) => setQueryParams((prev_0) => ({
|
|
633
|
-
...prev_0,
|
|
634
|
-
[k_1]: v_6
|
|
635
|
-
})) }),
|
|
636
|
-
/* @__PURE__ */ jsx(CustomKeyValueSection, { title: "Custom Headers", values: customHeaders, onChange: (i, k_2, v_7) => {
|
|
637
|
-
const next = [...customHeaders];
|
|
638
|
-
next[i] = {
|
|
639
|
-
key: k_2,
|
|
640
|
-
value: v_7
|
|
641
|
-
};
|
|
642
|
-
setCustomHeaders(next);
|
|
643
|
-
}, onAdd: () => setCustomHeaders((prev_1) => [...prev_1, {
|
|
644
|
-
key: "",
|
|
645
|
-
value: ""
|
|
646
|
-
}]), onRemove: (i_0) => {
|
|
647
|
-
const next_0 = [...customHeaders];
|
|
648
|
-
next_0.splice(i_0, 1);
|
|
649
|
-
setCustomHeaders(next_0);
|
|
650
|
-
} }),
|
|
651
|
-
hasBody && /* @__PURE__ */ jsxs("div", { children: [
|
|
652
|
-
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-text-secondary dark:text-text-secondary-dark text-xs font-semibold uppercase tracking-wider mb-2 block", children: "Request Body" }),
|
|
653
|
-
/* @__PURE__ */ jsx(TextField, { multiline: true, minRows: 10, value: body, onChange: (e) => {
|
|
654
|
-
setBody(e.target.value);
|
|
655
|
-
setValidationError(null);
|
|
656
|
-
}, spellCheck: false, error: !!validationError, className: "w-full", inputClassName: "font-mono text-xs p-3 resize-y" }),
|
|
657
|
-
validationError && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-red-500 mt-1 block text-xs", children: validationError })
|
|
658
|
-
] }),
|
|
659
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-lg bg-surface-100 dark:bg-surface-900 p-3", children: [
|
|
660
|
-
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-text-secondary dark:text-text-secondary-dark text-[10px] uppercase tracking-wider block mb-1", children: "Request URL" }),
|
|
661
|
-
/* @__PURE__ */ jsx("code", { className: "text-xs font-mono text-text-primary dark:text-text-primary-dark break-all", children: resolvedUrl })
|
|
662
|
-
] }),
|
|
663
|
-
/* @__PURE__ */ jsx(Button, { variant: "filled", onClick: execute, disabled: loading, className: "w-full", children: loading ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
664
|
-
/* @__PURE__ */ jsx(LoaderIcon, { size: iconSize.small, className: "animate-spin" }),
|
|
665
|
-
"Sending…"
|
|
666
|
-
] }) : /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
667
|
-
/* @__PURE__ */ jsx(SendIcon, { size: iconSize.small }),
|
|
668
|
-
"Send Request"
|
|
669
|
-
] }) }),
|
|
670
|
-
response && /* @__PURE__ */ jsxs("div", { className: cls("rounded-lg border overflow-hidden", defaultBorderMixin), children: [
|
|
671
|
-
/* @__PURE__ */ jsxs("div", { className: cls("flex items-center justify-between px-4 py-2.5", "bg-surface-50 dark:bg-surface-900/50"), children: [
|
|
672
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
673
|
-
/* @__PURE__ */ jsx(ResponseBadge, { status: response.status }),
|
|
674
|
-
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-text-secondary dark:text-text-secondary-dark text-xs", children: response.statusText })
|
|
675
|
-
] }),
|
|
676
|
-
/* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-text-secondary dark:text-text-secondary-dark text-xs font-mono", children: [
|
|
677
|
-
response.time,
|
|
678
|
-
"ms"
|
|
679
|
-
] })
|
|
680
|
-
] }),
|
|
681
|
-
/* @__PURE__ */ jsx("pre", { className: cls("p-4 text-xs font-mono overflow-auto max-h-96", "bg-surface-950 text-emerald-400", "dark:bg-surface-900 dark:text-emerald-400"), children: response.body })
|
|
682
|
-
] })
|
|
683
|
-
] }) });
|
|
684
|
-
}
|
|
685
|
-
function ParamSection(t0) {
|
|
686
|
-
const $ = c(14);
|
|
687
|
-
const {
|
|
688
|
-
title,
|
|
689
|
-
params,
|
|
690
|
-
values,
|
|
691
|
-
onChange
|
|
692
|
-
} = t0;
|
|
693
|
-
let t1;
|
|
694
|
-
if ($[0] !== title) {
|
|
695
|
-
t1 = /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-text-secondary dark:text-text-secondary-dark text-xs font-semibold uppercase tracking-wider mb-2 block", children: title });
|
|
696
|
-
$[0] = title;
|
|
697
|
-
$[1] = t1;
|
|
698
|
-
} else {
|
|
699
|
-
t1 = $[1];
|
|
700
|
-
}
|
|
701
|
-
let t2;
|
|
702
|
-
if ($[2] !== onChange || $[3] !== params || $[4] !== values) {
|
|
703
|
-
let t32;
|
|
704
|
-
if ($[6] !== onChange || $[7] !== values) {
|
|
705
|
-
t32 = (p) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
706
|
-
/* @__PURE__ */ jsxs("label", { className: "w-32 shrink-0", children: [
|
|
707
|
-
/* @__PURE__ */ jsx("code", { className: "text-xs font-mono font-semibold", children: p.name }),
|
|
708
|
-
p.required && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-0.5 text-xs", children: "*" })
|
|
709
|
-
] }),
|
|
710
|
-
/* @__PURE__ */ jsx(TextField, { size: "small", placeholder: p.description ?? p.name, value: values[p.name] ?? "", onChange: (e) => onChange(p.name, e.target.value), className: "flex-1", inputClassName: "font-mono text-xs" })
|
|
711
|
-
] }, p.name);
|
|
712
|
-
$[6] = onChange;
|
|
713
|
-
$[7] = values;
|
|
714
|
-
$[8] = t32;
|
|
715
|
-
} else {
|
|
716
|
-
t32 = $[8];
|
|
717
|
-
}
|
|
718
|
-
t2 = params.map(t32);
|
|
719
|
-
$[2] = onChange;
|
|
720
|
-
$[3] = params;
|
|
721
|
-
$[4] = values;
|
|
722
|
-
$[5] = t2;
|
|
723
|
-
} else {
|
|
724
|
-
t2 = $[5];
|
|
725
|
-
}
|
|
726
|
-
let t3;
|
|
727
|
-
if ($[9] !== t2) {
|
|
728
|
-
t3 = /* @__PURE__ */ jsx("div", { className: "space-y-2", children: t2 });
|
|
729
|
-
$[9] = t2;
|
|
730
|
-
$[10] = t3;
|
|
731
|
-
} else {
|
|
732
|
-
t3 = $[10];
|
|
733
|
-
}
|
|
734
|
-
let t4;
|
|
735
|
-
if ($[11] !== t1 || $[12] !== t3) {
|
|
736
|
-
t4 = /* @__PURE__ */ jsxs("div", { children: [
|
|
737
|
-
t1,
|
|
738
|
-
t3
|
|
739
|
-
] });
|
|
740
|
-
$[11] = t1;
|
|
741
|
-
$[12] = t3;
|
|
742
|
-
$[13] = t4;
|
|
743
|
-
} else {
|
|
744
|
-
t4 = $[13];
|
|
745
|
-
}
|
|
746
|
-
return t4;
|
|
747
|
-
}
|
|
748
|
-
function CustomKeyValueSection(t0) {
|
|
749
|
-
const $ = c(23);
|
|
750
|
-
const {
|
|
751
|
-
title,
|
|
752
|
-
values,
|
|
753
|
-
onChange,
|
|
754
|
-
onAdd,
|
|
755
|
-
onRemove
|
|
756
|
-
} = t0;
|
|
757
|
-
let t1;
|
|
758
|
-
if ($[0] !== title) {
|
|
759
|
-
t1 = /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-text-secondary dark:text-text-secondary-dark text-xs font-semibold uppercase tracking-wider block", children: title });
|
|
760
|
-
$[0] = title;
|
|
761
|
-
$[1] = t1;
|
|
762
|
-
} else {
|
|
763
|
-
t1 = $[1];
|
|
764
|
-
}
|
|
765
|
-
let t2;
|
|
766
|
-
if ($[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
767
|
-
t2 = /* @__PURE__ */ jsx(PlusIcon, { size: iconSize.small, className: "mr-1" });
|
|
768
|
-
$[2] = t2;
|
|
769
|
-
} else {
|
|
770
|
-
t2 = $[2];
|
|
771
|
-
}
|
|
772
|
-
let t3;
|
|
773
|
-
if ($[3] !== onAdd) {
|
|
774
|
-
t3 = /* @__PURE__ */ jsxs(Button, { variant: "text", size: "small", color: "primary", onClick: onAdd, className: "text-xs p-0 min-h-0", children: [
|
|
775
|
-
t2,
|
|
776
|
-
" Add Header"
|
|
777
|
-
] });
|
|
778
|
-
$[3] = onAdd;
|
|
779
|
-
$[4] = t3;
|
|
780
|
-
} else {
|
|
781
|
-
t3 = $[4];
|
|
782
|
-
}
|
|
783
|
-
let t4;
|
|
784
|
-
if ($[5] !== t1 || $[6] !== t3) {
|
|
785
|
-
t4 = /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-2", children: [
|
|
786
|
-
t1,
|
|
787
|
-
t3
|
|
788
|
-
] });
|
|
789
|
-
$[5] = t1;
|
|
790
|
-
$[6] = t3;
|
|
791
|
-
$[7] = t4;
|
|
792
|
-
} else {
|
|
793
|
-
t4 = $[7];
|
|
794
|
-
}
|
|
795
|
-
let t5;
|
|
796
|
-
if ($[8] !== onChange || $[9] !== onRemove || $[10] !== values) {
|
|
797
|
-
let t62;
|
|
798
|
-
if ($[12] !== onChange || $[13] !== onRemove) {
|
|
799
|
-
t62 = (v, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
800
|
-
/* @__PURE__ */ jsx(TextField, { size: "small", placeholder: "Header name", value: v.key, onChange: (e) => onChange(i, e.target.value, v.value), className: "w-1/3", inputClassName: "font-mono text-xs" }),
|
|
801
|
-
/* @__PURE__ */ jsx(TextField, { size: "small", placeholder: "Value", value: v.value, onChange: (e_0) => onChange(i, v.key, e_0.target.value), className: "flex-1", inputClassName: "font-mono text-xs" }),
|
|
802
|
-
/* @__PURE__ */ jsx(IconButton, { size: "small", onClick: () => onRemove(i), className: "text-text-secondary hover:text-red-500 shrink-0", title: "Remove", children: /* @__PURE__ */ jsx(XIcon, { size: iconSize.small }) })
|
|
803
|
-
] }, i);
|
|
804
|
-
$[12] = onChange;
|
|
805
|
-
$[13] = onRemove;
|
|
806
|
-
$[14] = t62;
|
|
807
|
-
} else {
|
|
808
|
-
t62 = $[14];
|
|
809
|
-
}
|
|
810
|
-
t5 = values.map(t62);
|
|
811
|
-
$[8] = onChange;
|
|
812
|
-
$[9] = onRemove;
|
|
813
|
-
$[10] = values;
|
|
814
|
-
$[11] = t5;
|
|
815
|
-
} else {
|
|
816
|
-
t5 = $[11];
|
|
817
|
-
}
|
|
818
|
-
let t6;
|
|
819
|
-
if ($[15] !== values.length) {
|
|
820
|
-
t6 = values.length === 0 && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-text-secondary/50 italic text-xs", children: "No custom headers added." });
|
|
821
|
-
$[15] = values.length;
|
|
822
|
-
$[16] = t6;
|
|
823
|
-
} else {
|
|
824
|
-
t6 = $[16];
|
|
825
|
-
}
|
|
826
|
-
let t7;
|
|
827
|
-
if ($[17] !== t5 || $[18] !== t6) {
|
|
828
|
-
t7 = /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
829
|
-
t5,
|
|
830
|
-
t6
|
|
831
|
-
] });
|
|
832
|
-
$[17] = t5;
|
|
833
|
-
$[18] = t6;
|
|
834
|
-
$[19] = t7;
|
|
835
|
-
} else {
|
|
836
|
-
t7 = $[19];
|
|
837
|
-
}
|
|
838
|
-
let t8;
|
|
839
|
-
if ($[20] !== t4 || $[21] !== t7) {
|
|
840
|
-
t8 = /* @__PURE__ */ jsxs("div", { children: [
|
|
841
|
-
t4,
|
|
842
|
-
t7
|
|
843
|
-
] });
|
|
844
|
-
$[20] = t4;
|
|
845
|
-
$[21] = t7;
|
|
846
|
-
$[22] = t8;
|
|
847
|
-
} else {
|
|
848
|
-
t8 = $[22];
|
|
849
|
-
}
|
|
850
|
-
return t8;
|
|
851
|
-
}
|
|
852
|
-
function ResponseBadge(t0) {
|
|
853
|
-
const $ = c(5);
|
|
854
|
-
const {
|
|
855
|
-
status
|
|
856
|
-
} = t0;
|
|
857
|
-
let colorClass = "text-red-500";
|
|
858
|
-
if (status >= 200 && status < 300) {
|
|
859
|
-
colorClass = "text-emerald-500";
|
|
860
|
-
} else {
|
|
861
|
-
if (status >= 300 && status < 400) {
|
|
862
|
-
colorClass = "text-blue-500";
|
|
863
|
-
} else {
|
|
864
|
-
if (status >= 400 && status < 500) {
|
|
865
|
-
colorClass = "text-amber-500";
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
let t1;
|
|
870
|
-
if ($[0] !== colorClass) {
|
|
871
|
-
t1 = cls("text-xs font-bold font-mono", colorClass);
|
|
872
|
-
$[0] = colorClass;
|
|
873
|
-
$[1] = t1;
|
|
874
|
-
} else {
|
|
875
|
-
t1 = $[1];
|
|
876
|
-
}
|
|
877
|
-
const t2 = status || "ERR";
|
|
878
|
-
let t3;
|
|
879
|
-
if ($[2] !== t1 || $[3] !== t2) {
|
|
880
|
-
t3 = /* @__PURE__ */ jsx("span", { className: t1, children: t2 });
|
|
881
|
-
$[2] = t1;
|
|
882
|
-
$[3] = t2;
|
|
883
|
-
$[4] = t3;
|
|
884
|
-
} else {
|
|
885
|
-
t3 = $[4];
|
|
886
|
-
}
|
|
887
|
-
return t3;
|
|
888
|
-
}
|
|
889
|
-
function buildBodyTemplate(endpoint) {
|
|
890
|
-
if (!endpoint.requestBody?.content) return "{\n \n}";
|
|
891
|
-
const json = endpoint.requestBody.content["application/json"];
|
|
892
|
-
if (!json?.schema?.properties) return "{\n \n}";
|
|
893
|
-
const props = json.schema.properties;
|
|
894
|
-
const lines = ["{"];
|
|
895
|
-
const keys = Object.keys(props);
|
|
896
|
-
keys.forEach((key, i) => {
|
|
897
|
-
const prop = props[key];
|
|
898
|
-
if (prop.readOnly) return;
|
|
899
|
-
const comma = i < keys.length - 1 ? "," : "";
|
|
900
|
-
const val = defaultValue(prop);
|
|
901
|
-
lines.push(` "${key}": ${val}${comma}`);
|
|
902
|
-
});
|
|
903
|
-
lines.push("}");
|
|
904
|
-
return lines.join("\n");
|
|
905
|
-
}
|
|
906
|
-
function defaultValue(schema) {
|
|
907
|
-
if (schema.enum) return JSON.stringify(schema.enum[0]);
|
|
908
|
-
switch (schema.type) {
|
|
909
|
-
case "string":
|
|
910
|
-
return schema.format === "date-time" ? `"${(/* @__PURE__ */ new Date()).toISOString()}"` : '""';
|
|
911
|
-
case "number":
|
|
912
|
-
case "integer":
|
|
913
|
-
return "0";
|
|
914
|
-
case "boolean":
|
|
915
|
-
return "false";
|
|
916
|
-
case "array":
|
|
917
|
-
return "[]";
|
|
918
|
-
default:
|
|
919
|
-
return "null";
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
function ApiExplorer() {
|
|
923
|
-
const apiConfig = useApiConfig();
|
|
924
|
-
const authController = useAuthController();
|
|
925
|
-
const apiUrl = apiConfig?.apiUrl;
|
|
926
|
-
const [spec, setSpec] = useState(null);
|
|
927
|
-
const [loading, setLoading] = useState(true);
|
|
928
|
-
const [error, setError] = useState(null);
|
|
929
|
-
const [selectedEndpoint, setSelectedEndpoint] = useState(null);
|
|
930
|
-
const [sidebarFilter, setSidebarFilter] = useState("");
|
|
931
|
-
const [tryItOpen, setTryItOpen] = useState(false);
|
|
932
|
-
useEffect(() => {
|
|
933
|
-
if (!apiUrl) return;
|
|
934
|
-
let cancelled = false;
|
|
935
|
-
const specUrl = `${apiUrl.replace(/\/+$/, "")}/api/docs`;
|
|
936
|
-
(async () => {
|
|
937
|
-
try {
|
|
938
|
-
const res = await fetch(specUrl);
|
|
939
|
-
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
|
|
940
|
-
const data = await res.json();
|
|
941
|
-
if (!cancelled) {
|
|
942
|
-
setSpec(data);
|
|
943
|
-
setLoading(false);
|
|
944
|
-
}
|
|
945
|
-
} catch (err) {
|
|
946
|
-
if (!cancelled) {
|
|
947
|
-
setError(err instanceof Error ? err.message : "Failed to load API spec");
|
|
948
|
-
setLoading(false);
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
})();
|
|
952
|
-
return () => {
|
|
953
|
-
cancelled = true;
|
|
954
|
-
};
|
|
955
|
-
}, [apiUrl]);
|
|
956
|
-
const {
|
|
957
|
-
groups,
|
|
958
|
-
allEndpoints
|
|
959
|
-
} = useMemo(() => {
|
|
960
|
-
if (!spec) return {
|
|
961
|
-
groups: [],
|
|
962
|
-
allEndpoints: []
|
|
963
|
-
};
|
|
964
|
-
return parseOpenApiSpec(spec);
|
|
965
|
-
}, [spec]);
|
|
966
|
-
const filteredGroups = useMemo(() => {
|
|
967
|
-
if (!sidebarFilter.trim()) return groups;
|
|
968
|
-
const q = sidebarFilter.toLowerCase();
|
|
969
|
-
return groups.map((g) => ({
|
|
970
|
-
...g,
|
|
971
|
-
endpoints: g.endpoints.filter((e) => e.path.toLowerCase().includes(q) || e.summary.toLowerCase().includes(q) || e.method.toLowerCase().includes(q))
|
|
972
|
-
})).filter((g_0) => g_0.endpoints.length > 0);
|
|
973
|
-
}, [groups, sidebarFilter]);
|
|
974
|
-
useEffect(() => {
|
|
975
|
-
if (!selectedEndpoint && allEndpoints.length > 0) {
|
|
976
|
-
setSelectedEndpoint(allEndpoints[0]);
|
|
977
|
-
}
|
|
978
|
-
}, [allEndpoints, selectedEndpoint]);
|
|
979
|
-
if (!apiUrl) {
|
|
980
|
-
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-full w-full p-8", children: /* @__PURE__ */ jsx(Alert, { color: "warning", children: /* @__PURE__ */ jsxs(Typography, { variant: "body2", children: [
|
|
981
|
-
"No API URL configured. Ensure your app provides an",
|
|
982
|
-
" ",
|
|
983
|
-
/* @__PURE__ */ jsx("code", { className: "font-mono text-xs", children: "apiUrl" }),
|
|
984
|
-
"."
|
|
985
|
-
] }) }) });
|
|
986
|
-
}
|
|
987
|
-
if (loading) {
|
|
988
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center h-full w-full gap-4", children: [
|
|
989
|
-
/* @__PURE__ */ jsx(CircularProgress, { size: "medium" }),
|
|
990
|
-
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-text-secondary dark:text-text-secondary-dark animate-pulse", children: "Loading API specification…" })
|
|
991
|
-
] });
|
|
992
|
-
}
|
|
993
|
-
if (error || !spec) {
|
|
994
|
-
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-full w-full p-8", children: /* @__PURE__ */ jsx(Alert, { color: "error", children: /* @__PURE__ */ jsx(Typography, { variant: "body2", children: error ?? "Unknown error" }) }) });
|
|
995
|
-
}
|
|
996
|
-
const METHOD_COLORS = {
|
|
997
|
-
get: "text-blue-600 dark:text-blue-400",
|
|
998
|
-
post: "text-emerald-600 dark:text-emerald-400",
|
|
999
|
-
put: "text-amber-600 dark:text-amber-400",
|
|
1000
|
-
patch: "text-orange-600 dark:text-orange-400",
|
|
1001
|
-
delete: "text-red-600 dark:text-red-400"
|
|
1002
|
-
};
|
|
1003
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full overflow-hidden", children: [
|
|
1004
|
-
/* @__PURE__ */ jsxs("div", { className: cls("w-72 min-w-[272px] flex flex-col h-full overflow-hidden border-r", defaultBorderMixin, "bg-surface-50 dark:bg-surface-900"), children: [
|
|
1005
|
-
/* @__PURE__ */ jsxs("div", { className: "p-4 space-y-3", children: [
|
|
1006
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1007
|
-
/* @__PURE__ */ jsx(BookOpenIcon, { size: iconSize.medium, className: "text-primary dark:text-primary-dark" }),
|
|
1008
|
-
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "font-semibold", children: spec.info?.title ?? "API Reference" })
|
|
1009
|
-
] }),
|
|
1010
|
-
spec.info?.version && /* @__PURE__ */ jsxs(Chip, { size: "smallest", colorScheme: "cyanDarker", children: [
|
|
1011
|
-
"v",
|
|
1012
|
-
spec.info.version
|
|
1013
|
-
] }),
|
|
1014
|
-
/* @__PURE__ */ jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsx(SearchBar, { placeholder: "Filter endpoints…", size: "small", onTextSearch: (val) => setSidebarFilter(val ?? "") }) })
|
|
1015
|
-
] }),
|
|
1016
|
-
/* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-y-auto px-2 pb-4", children: [
|
|
1017
|
-
filteredGroups.map((group) => /* @__PURE__ */ jsxs("div", { className: "mb-3", children: [
|
|
1018
|
-
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "px-2 py-1.5 text-text-secondary dark:text-text-secondary-dark uppercase tracking-wider font-semibold text-[10px]", children: group.tag }),
|
|
1019
|
-
group.endpoints.map((ep) => {
|
|
1020
|
-
const isSelected = selectedEndpoint?.id === ep.id;
|
|
1021
|
-
return /* @__PURE__ */ jsxs(Button, { variant: "text", color: "neutral", fullWidth: true, onClick: () => {
|
|
1022
|
-
setSelectedEndpoint(ep);
|
|
1023
|
-
setTryItOpen(false);
|
|
1024
|
-
}, className: cls("!justify-between !px-2.5 !py-1.5 !text-left !text-sm", isSelected ? "bg-surface-200 dark:bg-surface-800 font-medium" : "text-text-primary dark:text-text-primary-dark"), children: [
|
|
1025
|
-
/* @__PURE__ */ jsx("span", { className: "truncate text-[13px] opacity-90", children: ep.summary || ep.shortPath }),
|
|
1026
|
-
/* @__PURE__ */ jsx("span", { className: cls("text-[10px] font-bold uppercase shrink-0", METHOD_COLORS[ep.method] ?? "text-text-secondary"), children: ep.method })
|
|
1027
|
-
] }, ep.id);
|
|
1028
|
-
})
|
|
1029
|
-
] }, group.tag)),
|
|
1030
|
-
filteredGroups.length === 0 && /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-center text-text-secondary dark:text-text-secondary-dark py-8", children: "No endpoints match" })
|
|
1031
|
-
] })
|
|
1032
|
-
] }),
|
|
1033
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 flex flex-col h-full overflow-hidden", children: selectedEndpoint ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1034
|
-
/* @__PURE__ */ jsxs("div", { className: cls("flex items-center justify-between px-5 py-3 gap-4 shrink-0 border-b z-10", defaultBorderMixin, "bg-surface-50/80 dark:bg-surface-950/80 backdrop-blur-md sticky top-0"), children: [
|
|
1035
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 min-w-0", children: [
|
|
1036
|
-
/* @__PURE__ */ jsx("span", { className: cls("text-xs font-bold uppercase", METHOD_COLORS[selectedEndpoint.method] ?? ""), children: selectedEndpoint.method }),
|
|
1037
|
-
/* @__PURE__ */ jsx("code", { className: "text-sm font-mono text-text-primary dark:text-text-primary-dark truncate", children: selectedEndpoint.path })
|
|
1038
|
-
] }),
|
|
1039
|
-
/* @__PURE__ */ jsxs(Button, { variant: tryItOpen ? "filled" : "outlined", size: "small", onClick: () => setTryItOpen((v) => !v), children: [
|
|
1040
|
-
/* @__PURE__ */ jsx(PlayIcon, { size: iconSize.small, className: "mr-1" }),
|
|
1041
|
-
"Try It"
|
|
1042
|
-
] })
|
|
1043
|
-
] }),
|
|
1044
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto", children: tryItOpen ? /* @__PURE__ */ jsx(TryItPanel, { endpoint: selectedEndpoint, apiUrl, getAuthToken: apiConfig?.getAuthToken ?? authController.getAuthToken, user: authController.user, basePath: spec?.servers?.[0]?.url || "" }, selectedEndpoint.operationId || selectedEndpoint.path) : /* @__PURE__ */ jsx(EndpointDetail, { endpoint: selectedEndpoint, spec }) })
|
|
1045
|
-
] }) : /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-text-secondary dark:text-text-secondary-dark", children: "Select an endpoint from the sidebar" }) }) })
|
|
1046
|
-
] });
|
|
1047
|
-
}
|
|
1048
|
-
ApiExplorer.displayName = "ApiExplorer";
|
|
1049
|
-
export {
|
|
1050
|
-
ApiExplorer
|
|
1051
|
-
};
|
|
1052
|
-
//# sourceMappingURL=ApiExplorer-CGHEF1uL.js.map
|