diff --git a/apps/desktop/components.json b/apps/desktop/components.json index 2c03417c4..d2f03505b 100644 --- a/apps/desktop/components.json +++ b/apps/desktop/components.json @@ -14,7 +14,7 @@ "rtl": false, "aliases": { "components": "@/components", - "utils": "@/lib/utils", + "utils": "@/lib/common/utils", "ui": "@/components/ui", "lib": "@/lib", "composables": "@/composables" diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vue index 4befc2418..5f3e60272 100644 --- a/apps/desktop/src/App.vue +++ b/apps/desktop/src/App.vue @@ -33,20 +33,20 @@ import { useVisibilityChange } from "@/composables/useVisibilityChange"; import { useWebDavAutoUpload } from "@/composables/useWebDavAutoUpload"; import "@/i18n"; import { translateBackendError } from "@/i18n/backend-errors"; -import * as api from "@/lib/api"; -import { connectionRedactedNameLabel } from "@/lib/connectionPresentation"; -import { quickConnectionOpenTarget } from "@/lib/connectionOpenTarget"; -import { resolveDefaultDatabase } from "@/lib/defaultDatabase"; -import { findTreeNodeById, resolveNewQueryTarget } from "@/lib/newQueryContext"; -import { buildExecutableObjectSourceStatements, objectSourceSaveExecutionMode } from "@/lib/objectSourceEditor"; -import { resolveExecutableSql, resolveExecutableSqlWithBackend, type SqlExecutionSnapshot } from "@/lib/sqlExecutionTarget"; -import { uuid } from "@/lib/utils"; -import { isMacOS } from "@/lib/platform"; -import { isTauriRuntime } from "@/lib/tauriRuntime"; -import { openQueryResultArchiveFile } from "@/lib/queryResultArchiveFile"; -import { sqlFileTitleFromPath } from "@/lib/sqlFileOpen"; +import * as api from "@/lib/backend/api"; +import { connectionRedactedNameLabel } from "@/lib/connection/connectionPresentation"; +import { quickConnectionOpenTarget } from "@/lib/connection/connectionOpenTarget"; +import { resolveDefaultDatabase } from "@/lib/database/defaultDatabase"; +import { findTreeNodeById, resolveNewQueryTarget } from "@/lib/sql/newQueryContext"; +import { buildExecutableObjectSourceStatements, objectSourceSaveExecutionMode } from "@/lib/table/objectSourceEditor"; +import { resolveExecutableSql, resolveExecutableSqlWithBackend, type SqlExecutionSnapshot } from "@/lib/sql/sqlExecutionTarget"; +import { uuid } from "@/lib/common/utils"; +import { isMacOS } from "@/lib/backend/platform"; +import { isTauriRuntime } from "@/lib/backend/tauriRuntime"; +import { openQueryResultArchiveFile } from "@/lib/query/queryResultArchiveFile"; +import { sqlFileTitleFromPath } from "@/lib/sql/sqlFileOpen"; import type { ConnectionConfig, ObjectSourceKind, QueryTab } from "@/types/database"; -import { parseConnectionDeepLink, type ConnectionDeepLinkDraft } from "@/lib/connectionDeepLink"; +import { parseConnectionDeepLink, type ConnectionDeepLinkDraft } from "@/lib/connection/connectionDeepLink"; import { isBrowserReloadShortcut, isCloseTabShortcut, @@ -66,25 +66,25 @@ import { isZoomInShortcut, isZoomOutShortcut, switchToTabIndexFromShortcut, -} from "@/lib/keyboardShortcuts"; -import { isPreviewTab } from "@/lib/tabPresentation"; -import { supportsSqlFileExecution } from "@/lib/databaseCapabilities"; -import { classifyAiSqlExecution } from "@/lib/aiSqlExecutionPolicy"; -import { buildHistoryAiAnalysisPrompt } from "@/lib/historyAiAnalysis"; -import { countAvailableAgentDriverUpdates, type AgentDriverUpdateBadgeState } from "@/lib/agentDriverUpdateBadge"; -import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/safeStorage"; -import { apiUrl, webPath } from "@/lib/webPath"; -import { APP_FONT_SANS_CSS_VAR, DEFAULT_UI_FONT_FAMILY } from "@/lib/appFonts"; -import { rankSavedSqlHistory } from "@/lib/savedSqlHistory"; -import { isSchemaAware, isSingleDatabase, usesTreeSchemaMode } from "@/lib/databaseFeatureSupport"; -import { codeMirrorSqlDialect, connectionUsesDatabaseObjectTreeMode, effectiveDatabaseTypeForConnection } from "@/lib/jdbcDialect"; -import { detectDatabaseFileType } from "@/lib/databaseFileDetection"; +} from "@/lib/editor/keyboardShortcuts"; +import { isPreviewTab } from "@/lib/tabs/tabPresentation"; +import { supportsSqlFileExecution } from "@/lib/database/databaseCapabilities"; +import { classifyAiSqlExecution } from "@/lib/ai/aiSqlExecutionPolicy"; +import { buildHistoryAiAnalysisPrompt } from "@/lib/history/historyAiAnalysis"; +import { countAvailableAgentDriverUpdates, type AgentDriverUpdateBadgeState } from "@/lib/connection/agentDriverUpdateBadge"; +import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/backend/safeStorage"; +import { apiUrl, webPath } from "@/lib/common/webPath"; +import { APP_FONT_SANS_CSS_VAR, DEFAULT_UI_FONT_FAMILY } from "@/lib/app/appFonts"; +import { rankSavedSqlHistory } from "@/lib/savedSql/savedSqlHistory"; +import { isSchemaAware, isSingleDatabase, usesTreeSchemaMode } from "@/lib/database/databaseFeatureSupport"; +import { codeMirrorSqlDialect, connectionUsesDatabaseObjectTreeMode, effectiveDatabaseTypeForConnection } from "@/lib/database/jdbcDialect"; +import { detectDatabaseFileType } from "@/lib/database/databaseFileDetection"; import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; -import type { HistoryEntry } from "@/lib/tauri"; -import type { AiAction } from "@/lib/ai"; +import type { HistoryEntry } from "@/lib/backend/tauri"; +import type { AiAction } from "@/lib/ai/ai"; const AiAssistant = defineAsyncComponent(() => import("@/components/editor/AiAssistant.vue")); const QueryHistory = defineAsyncComponent(() => import("@/components/editor/QueryHistory.vue")); diff --git a/apps/desktop/src/components/admin/DatabaseUserAdmin.vue b/apps/desktop/src/components/admin/DatabaseUserAdmin.vue index ceb223898..ee0ebddf4 100644 --- a/apps/desktop/src/components/admin/DatabaseUserAdmin.vue +++ b/apps/desktop/src/components/admin/DatabaseUserAdmin.vue @@ -12,8 +12,8 @@ import { useConnectionStore } from "@/stores/connectionStore"; import { useToast } from "@/composables/useToast"; import { useSqlHighlighter } from "@/composables/useSqlHighlighter"; import type { ConnectionConfig } from "@/types/database"; -import * as api from "@/lib/api"; -import { grantsFromQueryResult, getDatabaseUserAdminProvider, supportsDatabaseUserAdmin, type DatabaseUserIdentity, type PrivilegeScope } from "@/lib/databaseUserAdmin"; +import * as api from "@/lib/backend/api"; +import { grantsFromQueryResult, getDatabaseUserAdminProvider, supportsDatabaseUserAdmin, type DatabaseUserIdentity, type PrivilegeScope } from "@/lib/database/databaseUserAdmin"; const props = defineProps<{ connection: ConnectionConfig; diff --git a/apps/desktop/src/components/auth/LoginPage.vue b/apps/desktop/src/components/auth/LoginPage.vue index 54e2850af..a081d71c0 100644 --- a/apps/desktop/src/components/auth/LoginPage.vue +++ b/apps/desktop/src/components/auth/LoginPage.vue @@ -5,7 +5,7 @@ import { Button } from "@/components/ui/button"; import PasswordInput from "@/components/ui/PasswordInput.vue"; import { Lock, Loader2, ShieldCheck } from "@lucide/vue"; import AppLogo from "@/components/icons/AppLogo.vue"; -import { apiUrl } from "@/lib/webPath"; +import { apiUrl } from "@/lib/common/webPath"; const props = withDefaults( defineProps<{ diff --git a/apps/desktop/src/components/chart/QueryChart.vue b/apps/desktop/src/components/chart/QueryChart.vue index c10d4c942..a31f9503d 100644 --- a/apps/desktop/src/components/chart/QueryChart.vue +++ b/apps/desktop/src/components/chart/QueryChart.vue @@ -12,7 +12,7 @@ import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMe import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import type { QueryResult } from "@/types/database"; import { useTheme } from "@/composables/useTheme"; -import { axisColumnLabel, chartableColumnIndexes, toChartNumber } from "@/lib/chartData"; +import { axisColumnLabel, chartableColumnIndexes, toChartNumber } from "@/lib/dataGrid/chartData"; use([CanvasRenderer, LineChart, BarChart, PieChart, GridComponent, TooltipComponent, LegendComponent]); diff --git a/apps/desktop/src/components/config/DriverStoreDialog.vue b/apps/desktop/src/components/config/DriverStoreDialog.vue index d529fc1ca..8fd7b573b 100644 --- a/apps/desktop/src/components/config/DriverStoreDialog.vue +++ b/apps/desktop/src/components/config/DriverStoreDialog.vue @@ -12,14 +12,14 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import DriverInstallProgressCircle from "@/components/config/DriverInstallProgressCircle.vue"; import DatabaseIcon from "@/components/icons/DatabaseIcon.vue"; import { useToast } from "@/composables/useToast"; -import { isTauriRuntime } from "@/lib/tauriRuntime"; -import { countAvailableDriverUpdates } from "@/lib/agentDriverUpdateBadge"; +import { isTauriRuntime } from "@/lib/backend/tauriRuntime"; +import { countAvailableDriverUpdates } from "@/lib/connection/agentDriverUpdateBadge"; import type { JdbcDriverInfo, JdbcMavenBundleInfo, JdbcPluginStatus } from "@/types/database"; -import * as api from "@/lib/api"; -import type { AgentDriverInfo, DriverRuntimeInfo, DriverRuntimeSummary, DriverStoreUsage, JavaRuntimeConfig } from "@/lib/api"; -import { formatRuntimeBytes, formatRuntimeCpu, formatRuntimeUptime, runtimeHealthClass, runtimeStatusClass, runtimeStatusDotClass } from "@/lib/driverRuntimePresentation"; -import { addDriverInstallQueue, driverInstallProgressPercent, isDriverInstallProgressTarget, removeDriverInstallQueue, takeNextDriverInstallQueue, type DriverInstallProgress } from "@/lib/driverInstallProgressUi"; -import { PRESTOSQL_DRIVER_DB_TYPE, prestoSqlBuiltinDriverRow, prestoSqlMavenBundle } from "@/lib/prestoSqlBuiltinDriver"; +import * as api from "@/lib/backend/api"; +import type { AgentDriverInfo, DriverRuntimeInfo, DriverRuntimeSummary, DriverStoreUsage, JavaRuntimeConfig } from "@/lib/backend/api"; +import { formatRuntimeBytes, formatRuntimeCpu, formatRuntimeUptime, runtimeHealthClass, runtimeStatusClass, runtimeStatusDotClass } from "@/lib/connection/driverRuntimePresentation"; +import { addDriverInstallQueue, driverInstallProgressPercent, isDriverInstallProgressTarget, removeDriverInstallQueue, takeNextDriverInstallQueue, type DriverInstallProgress } from "@/lib/connection/driverInstallProgressUi"; +import { PRESTOSQL_DRIVER_DB_TYPE, prestoSqlBuiltinDriverRow, prestoSqlMavenBundle } from "@/lib/database/prestoSqlBuiltinDriver"; const { t } = useI18n(); const { toast } = useToast(); @@ -43,7 +43,7 @@ const driverStoreTab = ref("agent"); // ──────────── Driver store path ──────────── import { useSettingsStore } from "@/stores/settingsStore"; -import type { DriverStorePathInfo } from "@/lib/api"; +import type { DriverStorePathInfo } from "@/lib/backend/api"; const settingsStore = useSettingsStore(); type DriverStoreDirKind = "plugin" | "agent"; diff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vue index 8b4f415b6..1c5fa6678 100644 --- a/apps/desktop/src/components/connection/ConnectionDialog.vue +++ b/apps/desktop/src/components/connection/ConnectionDialog.vue @@ -1,6 +1,6 @@ diff --git a/apps/desktop/src/components/ui/select/SelectScrollDownButton.vue b/apps/desktop/src/components/ui/select/SelectScrollDownButton.vue index e0a140535..90073960c 100644 --- a/apps/desktop/src/components/ui/select/SelectScrollDownButton.vue +++ b/apps/desktop/src/components/ui/select/SelectScrollDownButton.vue @@ -5,7 +5,7 @@ import type { HTMLAttributes } from "vue"; import { reactiveOmit } from "@vueuse/core"; import { ChevronDownIcon } from "@lucide/vue"; import { SelectScrollDownButton, useForwardProps } from "reka-ui"; -import { cn } from "@/lib/utils"; +import { cn } from "@/lib/common/utils"; const props = defineProps(); diff --git a/apps/desktop/src/components/ui/select/SelectScrollUpButton.vue b/apps/desktop/src/components/ui/select/SelectScrollUpButton.vue index 9ef499b72..924813ced 100644 --- a/apps/desktop/src/components/ui/select/SelectScrollUpButton.vue +++ b/apps/desktop/src/components/ui/select/SelectScrollUpButton.vue @@ -5,7 +5,7 @@ import type { HTMLAttributes } from "vue"; import { reactiveOmit } from "@vueuse/core"; import { ChevronUpIcon } from "@lucide/vue"; import { SelectScrollUpButton, useForwardProps } from "reka-ui"; -import { cn } from "@/lib/utils"; +import { cn } from "@/lib/common/utils"; const props = defineProps(); diff --git a/apps/desktop/src/components/ui/select/SelectSeparator.vue b/apps/desktop/src/components/ui/select/SelectSeparator.vue index 314812266..bb9f086ed 100644 --- a/apps/desktop/src/components/ui/select/SelectSeparator.vue +++ b/apps/desktop/src/components/ui/select/SelectSeparator.vue @@ -3,7 +3,7 @@ import type { SelectSeparatorProps } from "reka-ui"; import type { HTMLAttributes } from "vue"; import { reactiveOmit } from "@vueuse/core"; import { SelectSeparator } from "reka-ui"; -import { cn } from "@/lib/utils"; +import { cn } from "@/lib/common/utils"; const props = defineProps(); diff --git a/apps/desktop/src/components/ui/select/SelectTrigger.vue b/apps/desktop/src/components/ui/select/SelectTrigger.vue index 4324f8bd1..5922ad6ef 100644 --- a/apps/desktop/src/components/ui/select/SelectTrigger.vue +++ b/apps/desktop/src/components/ui/select/SelectTrigger.vue @@ -5,7 +5,7 @@ import type { HTMLAttributes } from "vue"; import { reactiveOmit } from "@vueuse/core"; import { ChevronDownIcon } from "@lucide/vue"; import { SelectIcon, SelectTrigger, useForwardProps } from "reka-ui"; -import { cn } from "@/lib/utils"; +import { cn } from "@/lib/common/utils"; const props = withDefaults(defineProps(), { size: "default" }); diff --git a/apps/desktop/src/components/ui/separator/Separator.vue b/apps/desktop/src/components/ui/separator/Separator.vue index 1c61a3161..63ebc04d6 100644 --- a/apps/desktop/src/components/ui/separator/Separator.vue +++ b/apps/desktop/src/components/ui/separator/Separator.vue @@ -3,7 +3,7 @@ import type { SeparatorProps } from "reka-ui"; import type { HTMLAttributes } from "vue"; import { reactiveOmit } from "@vueuse/core"; import { Separator } from "reka-ui"; -import { cn } from "@/lib/utils"; +import { cn } from "@/lib/common/utils"; const props = withDefaults(defineProps(), { orientation: "horizontal", diff --git a/apps/desktop/src/components/ui/sheet/SheetContent.vue b/apps/desktop/src/components/ui/sheet/SheetContent.vue index bbfe1777b..2488dbeea 100644 --- a/apps/desktop/src/components/ui/sheet/SheetContent.vue +++ b/apps/desktop/src/components/ui/sheet/SheetContent.vue @@ -5,7 +5,7 @@ import type { HTMLAttributes } from "vue"; import { reactiveOmit } from "@vueuse/core"; import { XIcon } from "@lucide/vue"; import { DialogClose, DialogContent, DialogPortal, useForwardPropsEmits } from "reka-ui"; -import { cn } from "@/lib/utils"; +import { cn } from "@/lib/common/utils"; import { Button } from "@/components/ui/button"; import SheetOverlay from "./SheetOverlay.vue"; diff --git a/apps/desktop/src/components/ui/sheet/SheetDescription.vue b/apps/desktop/src/components/ui/sheet/SheetDescription.vue index f19883a34..dc96cc1ea 100644 --- a/apps/desktop/src/components/ui/sheet/SheetDescription.vue +++ b/apps/desktop/src/components/ui/sheet/SheetDescription.vue @@ -3,7 +3,7 @@ import type { DialogDescriptionProps } from "reka-ui"; import type { HTMLAttributes } from "vue"; import { reactiveOmit } from "@vueuse/core"; import { DialogDescription } from "reka-ui"; -import { cn } from "@/lib/utils"; +import { cn } from "@/lib/common/utils"; const props = defineProps(); diff --git a/apps/desktop/src/components/ui/sheet/SheetFooter.vue b/apps/desktop/src/components/ui/sheet/SheetFooter.vue index 7ac7948ab..1467f3c3c 100644 --- a/apps/desktop/src/components/ui/sheet/SheetFooter.vue +++ b/apps/desktop/src/components/ui/sheet/SheetFooter.vue @@ -1,6 +1,6 @@ diff --git a/apps/desktop/src/components/ui/sheet/SheetHeader.vue b/apps/desktop/src/components/ui/sheet/SheetHeader.vue index bad371dd5..fd7868a94 100644 --- a/apps/desktop/src/components/ui/sheet/SheetHeader.vue +++ b/apps/desktop/src/components/ui/sheet/SheetHeader.vue @@ -1,6 +1,6 @@ diff --git a/apps/desktop/src/components/ui/sheet/SheetOverlay.vue b/apps/desktop/src/components/ui/sheet/SheetOverlay.vue index 01b044b2c..272f8baa7 100644 --- a/apps/desktop/src/components/ui/sheet/SheetOverlay.vue +++ b/apps/desktop/src/components/ui/sheet/SheetOverlay.vue @@ -3,7 +3,7 @@ import type { DialogOverlayProps } from "reka-ui"; import type { HTMLAttributes } from "vue"; import { reactiveOmit } from "@vueuse/core"; import { DialogOverlay } from "reka-ui"; -import { cn } from "@/lib/utils"; +import { cn } from "@/lib/common/utils"; const props = defineProps(); diff --git a/apps/desktop/src/components/ui/sheet/SheetTitle.vue b/apps/desktop/src/components/ui/sheet/SheetTitle.vue index 37e4d6a47..95863287b 100644 --- a/apps/desktop/src/components/ui/sheet/SheetTitle.vue +++ b/apps/desktop/src/components/ui/sheet/SheetTitle.vue @@ -3,7 +3,7 @@ import type { DialogTitleProps } from "reka-ui"; import type { HTMLAttributes } from "vue"; import { reactiveOmit } from "@vueuse/core"; import { DialogTitle } from "reka-ui"; -import { cn } from "@/lib/utils"; +import { cn } from "@/lib/common/utils"; const props = defineProps(); diff --git a/apps/desktop/src/components/ui/switch/Switch.vue b/apps/desktop/src/components/ui/switch/Switch.vue index 7f7760dd9..050a4b9d6 100644 --- a/apps/desktop/src/components/ui/switch/Switch.vue +++ b/apps/desktop/src/components/ui/switch/Switch.vue @@ -3,7 +3,7 @@ import type { SwitchRootEmits, SwitchRootProps } from "reka-ui"; import type { HTMLAttributes } from "vue"; import { reactiveOmit } from "@vueuse/core"; import { SwitchRoot, SwitchThumb, useForwardPropsEmits } from "reka-ui"; -import { cn } from "@/lib/utils"; +import { cn } from "@/lib/common/utils"; const props = withDefaults( defineProps< diff --git a/apps/desktop/src/components/ui/tabs/Tabs.vue b/apps/desktop/src/components/ui/tabs/Tabs.vue index 3814fc23f..85dbe7782 100644 --- a/apps/desktop/src/components/ui/tabs/Tabs.vue +++ b/apps/desktop/src/components/ui/tabs/Tabs.vue @@ -3,7 +3,7 @@ import type { TabsRootEmits, TabsRootProps } from "reka-ui"; import type { HTMLAttributes } from "vue"; import { reactiveOmit } from "@vueuse/core"; import { TabsRoot, useForwardPropsEmits } from "reka-ui"; -import { cn } from "@/lib/utils"; +import { cn } from "@/lib/common/utils"; const props = defineProps(); const emits = defineEmits(); diff --git a/apps/desktop/src/components/ui/tabs/TabsContent.vue b/apps/desktop/src/components/ui/tabs/TabsContent.vue index 5b9e6b2cc..40910591c 100644 --- a/apps/desktop/src/components/ui/tabs/TabsContent.vue +++ b/apps/desktop/src/components/ui/tabs/TabsContent.vue @@ -3,7 +3,7 @@ import type { TabsContentProps } from "reka-ui"; import type { HTMLAttributes } from "vue"; import { reactiveOmit } from "@vueuse/core"; import { TabsContent } from "reka-ui"; -import { cn } from "@/lib/utils"; +import { cn } from "@/lib/common/utils"; const props = defineProps(); diff --git a/apps/desktop/src/components/ui/tabs/TabsList.vue b/apps/desktop/src/components/ui/tabs/TabsList.vue index ceac23d35..0c122f7ca 100644 --- a/apps/desktop/src/components/ui/tabs/TabsList.vue +++ b/apps/desktop/src/components/ui/tabs/TabsList.vue @@ -4,7 +4,7 @@ import type { HTMLAttributes } from "vue"; import type { TabsListVariants } from "."; import { reactiveOmit } from "@vueuse/core"; import { TabsList } from "reka-ui"; -import { cn } from "@/lib/utils"; +import { cn } from "@/lib/common/utils"; import { tabsListVariants } from "."; const props = withDefaults( diff --git a/apps/desktop/src/components/ui/tabs/TabsTrigger.vue b/apps/desktop/src/components/ui/tabs/TabsTrigger.vue index 3fc64444b..20d1f8a4a 100644 --- a/apps/desktop/src/components/ui/tabs/TabsTrigger.vue +++ b/apps/desktop/src/components/ui/tabs/TabsTrigger.vue @@ -3,7 +3,7 @@ import type { TabsTriggerProps } from "reka-ui"; import type { HTMLAttributes } from "vue"; import { reactiveOmit } from "@vueuse/core"; import { TabsTrigger, useForwardProps } from "reka-ui"; -import { cn } from "@/lib/utils"; +import { cn } from "@/lib/common/utils"; const props = defineProps(); diff --git a/apps/desktop/src/components/ui/tooltip/TooltipContent.vue b/apps/desktop/src/components/ui/tooltip/TooltipContent.vue index 167da296d..74725676f 100644 --- a/apps/desktop/src/components/ui/tooltip/TooltipContent.vue +++ b/apps/desktop/src/components/ui/tooltip/TooltipContent.vue @@ -3,7 +3,7 @@ import type { TooltipContentEmits, TooltipContentProps } from "reka-ui"; import type { HTMLAttributes } from "vue"; import { reactiveOmit } from "@vueuse/core"; import { TooltipArrow, TooltipContent, TooltipPortal, useForwardPropsEmits } from "reka-ui"; -import { cn } from "@/lib/utils"; +import { cn } from "@/lib/common/utils"; defineOptions({ inheritAttrs: false, diff --git a/apps/desktop/src/components/vector/VectorBrowser.vue b/apps/desktop/src/components/vector/VectorBrowser.vue index 5da498d91..c4c897ba1 100644 --- a/apps/desktop/src/components/vector/VectorBrowser.vue +++ b/apps/desktop/src/components/vector/VectorBrowser.vue @@ -5,8 +5,8 @@ import { useI18n } from "vue-i18n"; import { Button } from "@/components/ui/button"; import ErrorBanner from "@/components/ui/ErrorBanner.vue"; import QueryLoadingState from "@/components/common/QueryLoadingState.vue"; -import * as api from "@/lib/api"; -import { uuid } from "@/lib/utils"; +import * as api from "@/lib/backend/api"; +import { uuid } from "@/lib/common/utils"; import type { DatabaseType, QueryResult } from "@/types/database"; const DataGrid = defineAsyncComponent(() => import("@/components/grid/DataGrid.vue")); diff --git a/apps/desktop/src/components/zookeeper/ZooKeeperKeyBrowser.vue b/apps/desktop/src/components/zookeeper/ZooKeeperKeyBrowser.vue index a3a9d6468..0707b233b 100644 --- a/apps/desktop/src/components/zookeeper/ZooKeeperKeyBrowser.vue +++ b/apps/desktop/src/components/zookeeper/ZooKeeperKeyBrowser.vue @@ -2,8 +2,8 @@ import { computed, ref } from "vue"; import { useI18n } from "vue-i18n"; import KvKeyBrowser from "@/components/kv/KvKeyBrowser.vue"; -import * as api from "@/lib/api"; -import type { KvCreateMode } from "@/lib/api"; +import * as api from "@/lib/backend/api"; +import type { KvCreateMode } from "@/lib/backend/api"; const props = defineProps<{ connectionId: string }>(); diff --git a/apps/desktop/src/composables/useAppUpdater.ts b/apps/desktop/src/composables/useAppUpdater.ts index 941d39c77..1e3a89193 100644 --- a/apps/desktop/src/composables/useAppUpdater.ts +++ b/apps/desktop/src/composables/useAppUpdater.ts @@ -1,11 +1,11 @@ import { computed, ref } from "vue"; import { useI18n } from "vue-i18n"; -import { isTauriRuntime } from "@/lib/tauriRuntime"; +import { isTauriRuntime } from "@/lib/backend/tauriRuntime"; import { useToast } from "@/composables/useToast"; -import * as api from "@/lib/api"; +import * as api from "@/lib/backend/api"; import { useSettingsStore } from "@/stores/settingsStore"; import type { UpdateDownloadSource as SettingsUpdateDownloadSource } from "@/stores/settingsStore"; -import type { UpdateDownloadProgress } from "@/lib/tauri"; +import type { UpdateDownloadProgress } from "@/lib/backend/tauri"; export function shouldOpenUpdateDialog(options: { silent?: boolean }) { return options.silent !== true; diff --git a/apps/desktop/src/composables/useCellDetailEditor.ts b/apps/desktop/src/composables/useCellDetailEditor.ts index e3eb749b7..36357754e 100644 --- a/apps/desktop/src/composables/useCellDetailEditor.ts +++ b/apps/desktop/src/composables/useCellDetailEditor.ts @@ -5,16 +5,16 @@ import { json } from "@codemirror/lang-json"; import { search as cmSearch } from "@codemirror/search"; import { defaultKeymap, history, historyKeymap } from "@codemirror/commands"; import { bracketMatching } from "@codemirror/language"; -import { trimmedSelectionLayer } from "@/lib/codemirrorTrimmedSelectionLayer"; -import { EDITOR_FONT_FAMILY_CSS_VAR, EDITOR_FONT_SIZE_CSS_VAR, cellDetailActiveLineColor, loadEditorTheme, editorFontTheme } from "@/lib/editorThemes"; -import { shortcutToCodeMirrorKey } from "@/lib/shortcutRegistry"; +import { trimmedSelectionLayer } from "@/lib/editor/codemirrorTrimmedSelectionLayer"; +import { EDITOR_FONT_FAMILY_CSS_VAR, EDITOR_FONT_SIZE_CSS_VAR, cellDetailActiveLineColor, loadEditorTheme, editorFontTheme } from "@/lib/editor/editorThemes"; +import { shortcutToCodeMirrorKey } from "@/lib/editor/shortcutRegistry"; import { useSettingsStore } from "@/stores/settingsStore"; -import { CELL_DETAIL_JSON_FORMAT_MAX_LENGTH, isJsonColumnType } from "@/lib/cellDetailPresentation"; -import { clampEditorFontSize, createEditorZoomCommitScheduler, fontSizeFromGestureScale, fontSizeFromWheelDelta } from "@/lib/editorZoom"; +import { CELL_DETAIL_JSON_FORMAT_MAX_LENGTH, isJsonColumnType } from "@/lib/dataGrid/cellDetailPresentation"; +import { clampEditorFontSize, createEditorZoomCommitScheduler, fontSizeFromGestureScale, fontSizeFromWheelDelta } from "@/lib/editor/editorZoom"; import i18n from "@/i18n"; import EditorSearchPanel from "@/components/editor/EditorSearchPanel.vue"; import type { EditorTheme } from "@/stores/settingsStore"; -import type { AppThemeAppearance } from "@/lib/appTheme"; +import type { AppThemeAppearance } from "@/lib/app/appTheme"; export interface UseCellDetailEditorOptions { onChange?: (value: string) => void; diff --git a/apps/desktop/src/composables/useCloseActionPrompt.ts b/apps/desktop/src/composables/useCloseActionPrompt.ts index f48389749..f128f7ce9 100644 --- a/apps/desktop/src/composables/useCloseActionPrompt.ts +++ b/apps/desktop/src/composables/useCloseActionPrompt.ts @@ -1,7 +1,7 @@ import { ref } from "vue"; import { useSettingsStore } from "@/stores/settingsStore"; -import { isTauriRuntime } from "@/lib/tauriRuntime"; -import * as api from "@/lib/api"; +import { isTauriRuntime } from "@/lib/backend/tauriRuntime"; +import * as api from "@/lib/backend/api"; export type AppCloseAction = "quit" | "hide"; type AppCloseRequestTarget = "settings" | "quit"; diff --git a/apps/desktop/src/composables/useDataGridActions.ts b/apps/desktop/src/composables/useDataGridActions.ts index 05b41af04..697d72850 100644 --- a/apps/desktop/src/composables/useDataGridActions.ts +++ b/apps/desktop/src/composables/useDataGridActions.ts @@ -3,16 +3,16 @@ import { useI18n } from "vue-i18n"; import { useConnectionStore } from "@/stores/connectionStore"; import { useQueryStore } from "@/stores/queryStore"; import { useSettingsStore } from "@/stores/settingsStore"; -import { buildTableSelectSql, quoteTableIdentifier } from "@/lib/tableSelectSql"; -import { editableRowIdentifierColumns, usesSyntheticRowIdKey } from "@/lib/tableEditing"; -import { tableMetaForDataTab } from "@/lib/tableDataTabMeta"; -import * as api from "@/lib/api"; +import { buildTableSelectSql, quoteTableIdentifier } from "@/lib/table/tableSelectSql"; +import { editableRowIdentifierColumns, usesSyntheticRowIdKey } from "@/lib/table/tableEditing"; +import { tableMetaForDataTab } from "@/lib/table/tableDataTabMeta"; +import * as api from "@/lib/backend/api"; import type { QueryTab } from "@/types/database"; import { useToast } from "@/composables/useToast"; -import { effectiveDatabaseTypeForConnection, metadataSchemaForConnection } from "@/lib/jdbcDialect"; -import { applyMongoFindSort } from "@/lib/mongoShellCommand"; -import { uuid } from "@/lib/utils"; -import type { DataGridSortMode } from "@/lib/dataGridSort"; +import { effectiveDatabaseTypeForConnection, metadataSchemaForConnection } from "@/lib/database/jdbcDialect"; +import { applyMongoFindSort } from "@/lib/mongo/mongoShellCommand"; +import { uuid } from "@/lib/common/utils"; +import type { DataGridSortMode } from "@/lib/dataGrid/dataGridSort"; const DATA_TAB_METADATA_TTL_MS = 30_000; diff --git a/apps/desktop/src/composables/useDataGridColumnResize.ts b/apps/desktop/src/composables/useDataGridColumnResize.ts index c6c151732..784db2ba6 100644 --- a/apps/desktop/src/composables/useDataGridColumnResize.ts +++ b/apps/desktop/src/composables/useDataGridColumnResize.ts @@ -1,6 +1,6 @@ import { ref, computed, watch, type ComputedRef, type Ref } from "vue"; import { useElementSize } from "@vueuse/core"; -import { calculateDataGridColumnWidth, DATA_GRID_AUTO_FIT_VALUE_TEXT_LIMIT, DATA_GRID_COL_AUTO_FIT_MAX_WIDTH, DATA_GRID_COL_MIN_WIDTH, DATA_GRID_SAMPLE_ROWS } from "@/lib/dataGridColumnWidth"; +import { calculateDataGridColumnWidth, DATA_GRID_AUTO_FIT_VALUE_TEXT_LIMIT, DATA_GRID_COL_AUTO_FIT_MAX_WIDTH, DATA_GRID_COL_MIN_WIDTH, DATA_GRID_SAMPLE_ROWS } from "@/lib/dataGrid/dataGridColumnWidth"; type CellValue = string | number | boolean | null; diff --git a/apps/desktop/src/composables/useDataGridEditor.ts b/apps/desktop/src/composables/useDataGridEditor.ts index edaf39df5..d85e03110 100644 --- a/apps/desktop/src/composables/useDataGridEditor.ts +++ b/apps/desktop/src/composables/useDataGridEditor.ts @@ -1,15 +1,15 @@ import { ref, computed, nextTick, watch, getCurrentInstance, onActivated, onBeforeUnmount, onDeactivated, onMounted, type ComputedRef, type Ref } from "vue"; -import * as api from "@/lib/api"; -import type { CellValue } from "@/lib/cellValue"; -import { coerceDataGridCellValue, dataGridCellEditorText } from "@/lib/dataGridCellCoercion"; -import { normalizeDataGridSaveError } from "@/lib/dataGridSql"; -import { rowStatusFilterAfterAddingRow, type RowStatusFilter } from "@/lib/gridRowStatus"; -import { supportsDataGridTransaction } from "@/lib/tableEditing"; +import * as api from "@/lib/backend/api"; +import type { CellValue } from "@/lib/dataGrid/cellValue"; +import { coerceDataGridCellValue, dataGridCellEditorText } from "@/lib/dataGrid/dataGridCellCoercion"; +import { normalizeDataGridSaveError } from "@/lib/dataGrid/dataGridSql"; +import { rowStatusFilterAfterAddingRow, type RowStatusFilter } from "@/lib/dataGrid/gridRowStatus"; +import { supportsDataGridTransaction } from "@/lib/table/tableEditing"; import { useConnectionStore } from "@/stores/connectionStore"; import { useHistoryStore } from "@/stores/historyStore"; import type { ColumnInfo, DatabaseType } from "@/types/database"; -import { DBX_NEO4J_ELEMENT_ID_COLUMN, DBX_ROWID_COLUMN } from "@/lib/tableEditing"; -import { effectiveDatabaseTypeForConnection } from "@/lib/jdbcDialect"; +import { DBX_NEO4J_ELEMENT_ID_COLUMN, DBX_ROWID_COLUMN } from "@/lib/table/tableEditing"; +import { effectiveDatabaseTypeForConnection } from "@/lib/database/jdbcDialect"; interface RowItem { id: number; diff --git a/apps/desktop/src/composables/useDataGridExport.ts b/apps/desktop/src/composables/useDataGridExport.ts index 662284f55..a354c9fe8 100644 --- a/apps/desktop/src/composables/useDataGridExport.ts +++ b/apps/desktop/src/composables/useDataGridExport.ts @@ -1,20 +1,20 @@ import { computed, ref, type ComputedRef, type Ref } from "vue"; import { useI18n } from "vue-i18n"; -import { isTauriRuntime } from "@/lib/tauriRuntime"; -import * as api from "@/lib/api"; -import { formatSelectionAsCsv, formatSelectionAsJson, formatSelectionAsSqlInList, formatSelectionAsTsv, type CellSelectionRange, type SelectionData } from "@/lib/gridSelection"; +import { isTauriRuntime } from "@/lib/backend/tauriRuntime"; +import * as api from "@/lib/backend/api"; +import { formatSelectionAsCsv, formatSelectionAsJson, formatSelectionAsSqlInList, formatSelectionAsTsv, type CellSelectionRange, type SelectionData } from "@/lib/dataGrid/gridSelection"; import { useToast } from "@/composables/useToast"; -import { displayCellValue, type CellValue } from "@/lib/cellValue"; -import { tryStartExclusiveActivation, type ActionActivationGuard } from "@/lib/actionActivation"; -import { copyToClipboard } from "@/lib/clipboard"; -import { buildDataGridCopyInsertStatement, buildDataGridCopyUpdateStatements, type DataGridTableMeta } from "@/lib/dataGridSql"; -import { formatSqlInsert } from "@/lib/exportFormats"; -import { uuid } from "@/lib/utils"; +import { displayCellValue, type CellValue } from "@/lib/dataGrid/cellValue"; +import { tryStartExclusiveActivation, type ActionActivationGuard } from "@/lib/connection/actionActivation"; +import { copyToClipboard } from "@/lib/common/clipboard"; +import { buildDataGridCopyInsertStatement, buildDataGridCopyUpdateStatements, type DataGridTableMeta } from "@/lib/dataGrid/dataGridSql"; +import { formatSqlInsert } from "@/lib/export/exportFormats"; +import { uuid } from "@/lib/common/utils"; import { useSettingsStore } from "@/stores/settingsStore"; -import { expandNestedJsonStringsForCopy } from "@/lib/jsonCopyValue"; -import { buildMongoCopyInsertDocument, formatMongoShellLiteral, type MongoInputValue } from "@/lib/mongoDocumentValues"; +import { expandNestedJsonStringsForCopy } from "@/lib/common/jsonCopyValue"; +import { buildMongoCopyInsertDocument, formatMongoShellLiteral, type MongoInputValue } from "@/lib/mongo/mongoDocumentValues"; import type { DatabaseType, QueryResult } from "@/types/database"; -import type { QueryResultExportRequest } from "@/lib/api"; +import type { QueryResultExportRequest } from "@/lib/backend/api"; interface RowItem { id: number; diff --git a/apps/desktop/src/composables/useDataGridSelection.ts b/apps/desktop/src/composables/useDataGridSelection.ts index dc7ff8da3..7fac596dd 100644 --- a/apps/desktop/src/composables/useDataGridSelection.ts +++ b/apps/desktop/src/composables/useDataGridSelection.ts @@ -1,5 +1,5 @@ import { ref, computed, type ComputedRef, type Ref } from "vue"; -import { allCellsSelectionRange, extractColumnsSelection, extractSelection, isCellInSelection, normalizeSelectionRange, normalizeSelectedColumnIndexes, rowSelectionRange, type CellPosition, type CellSelectionRange, type SelectionData } from "@/lib/gridSelection"; +import { allCellsSelectionRange, extractColumnsSelection, extractSelection, isCellInSelection, normalizeSelectionRange, normalizeSelectedColumnIndexes, rowSelectionRange, type CellPosition, type CellSelectionRange, type SelectionData } from "@/lib/dataGrid/gridSelection"; type CellValue = string | number | boolean | null; diff --git a/apps/desktop/src/composables/useDatabaseOptions.ts b/apps/desktop/src/composables/useDatabaseOptions.ts index 1497bba44..409295a19 100644 --- a/apps/desktop/src/composables/useDatabaseOptions.ts +++ b/apps/desktop/src/composables/useDatabaseOptions.ts @@ -1,9 +1,9 @@ import { ref } from "vue"; import { useConnectionStore } from "@/stores/connectionStore"; -import { filterDatabaseNamesForConnection } from "@/lib/visibleDatabases"; -import { usesTreeSchemaMode } from "@/lib/databaseCapabilities"; +import { filterDatabaseNamesForConnection } from "@/lib/database/visibleDatabases"; +import { usesTreeSchemaMode } from "@/lib/database/databaseCapabilities"; import type { ConnectionConfig } from "@/types/database"; -import * as api from "@/lib/api"; +import * as api from "@/lib/backend/api"; export function databaseOptionsForConnection(databaseNames: string[], connection: Pick | undefined): string[] { const names = filterDatabaseNamesForConnection(databaseNames, connection); diff --git a/apps/desktop/src/composables/useEditorFontFamilyStyle.ts b/apps/desktop/src/composables/useEditorFontFamilyStyle.ts index d455d4ef4..5be142359 100644 --- a/apps/desktop/src/composables/useEditorFontFamilyStyle.ts +++ b/apps/desktop/src/composables/useEditorFontFamilyStyle.ts @@ -1,5 +1,5 @@ import { computed } from "vue"; -import { EDITOR_FONT_FAMILY_CSS_VAR } from "@/lib/editorThemes"; +import { EDITOR_FONT_FAMILY_CSS_VAR } from "@/lib/editor/editorThemes"; import { useSettingsStore } from "@/stores/settingsStore"; export function useEditorFontFamilyStyle() { diff --git a/apps/desktop/src/composables/useExportTracker.ts b/apps/desktop/src/composables/useExportTracker.ts index 323f371b2..d41a91f69 100644 --- a/apps/desktop/src/composables/useExportTracker.ts +++ b/apps/desktop/src/composables/useExportTracker.ts @@ -1,5 +1,5 @@ import { reactive, computed } from "vue"; -import * as api from "@/lib/api"; +import * as api from "@/lib/backend/api"; export type BackgroundTaskKind = "table-export" | "database-export" | "sql-file" | "data-transfer"; export type BackgroundTaskStatus = "Running" | "Writing" | "Done" | "Error" | "Cancelled"; diff --git a/apps/desktop/src/composables/useFileDrop.ts b/apps/desktop/src/composables/useFileDrop.ts index 564f4e44b..c3039a28d 100644 --- a/apps/desktop/src/composables/useFileDrop.ts +++ b/apps/desktop/src/composables/useFileDrop.ts @@ -1,12 +1,12 @@ import { useI18n } from "vue-i18n"; -import { uuid } from "@/lib/utils"; -import { isTauriRuntime } from "@/lib/tauriRuntime"; +import { uuid } from "@/lib/common/utils"; +import { isTauriRuntime } from "@/lib/backend/tauriRuntime"; import { useConnectionStore } from "@/stores/connectionStore"; import { useQueryStore } from "@/stores/queryStore"; import { useToast } from "@/composables/useToast"; -import * as api from "@/lib/api"; +import * as api from "@/lib/backend/api"; import type { ConnectionConfig } from "@/types/database"; -import { detectDatabaseFileType } from "@/lib/databaseFileDetection"; +import { detectDatabaseFileType } from "@/lib/database/databaseFileDetection"; function isSqlFilePath(path: string): boolean { return /\.sql$/i.test(path); diff --git a/apps/desktop/src/composables/useNavigationTargets.ts b/apps/desktop/src/composables/useNavigationTargets.ts index d75e4570d..52a1b0b92 100644 --- a/apps/desktop/src/composables/useNavigationTargets.ts +++ b/apps/desktop/src/composables/useNavigationTargets.ts @@ -1,9 +1,9 @@ -import * as api from "@/lib/api"; -import { effectiveDatabaseTypeForConnection, metadataSchemaForConnection } from "@/lib/jdbcDialect"; -import { isNoSnapshotErrorResult } from "@/lib/queryResultError"; -import { buildTableSelectSql } from "@/lib/tableSelectSql"; -import { editableRowIdentifierColumns, usesSyntheticRowIdKey } from "@/lib/tableEditing"; -import { tableOpenPageLimit } from "@/lib/tableOpenPageLimit"; +import * as api from "@/lib/backend/api"; +import { effectiveDatabaseTypeForConnection, metadataSchemaForConnection } from "@/lib/database/jdbcDialect"; +import { isNoSnapshotErrorResult } from "@/lib/query/queryResultError"; +import { buildTableSelectSql } from "@/lib/table/tableSelectSql"; +import { editableRowIdentifierColumns, usesSyntheticRowIdKey } from "@/lib/table/tableEditing"; +import { tableOpenPageLimit } from "@/lib/table/tableOpenPageLimit"; import { useConnectionStore } from "@/stores/connectionStore"; import { useQueryStore } from "@/stores/queryStore"; import { useSettingsStore } from "@/stores/settingsStore"; diff --git a/apps/desktop/src/composables/usePanelResize.ts b/apps/desktop/src/composables/usePanelResize.ts index 15c5063a4..b9465b060 100644 --- a/apps/desktop/src/composables/usePanelResize.ts +++ b/apps/desktop/src/composables/usePanelResize.ts @@ -1,5 +1,5 @@ import { ref, type Ref } from "vue"; -import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/safeStorage"; +import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/backend/safeStorage"; export function usePanelResize() { const sidebarWidth = ref(Number(safeLocalStorageGet("dbx-sidebar-width")) || 260); diff --git a/apps/desktop/src/composables/useSchemaDiffConfig.ts b/apps/desktop/src/composables/useSchemaDiffConfig.ts index 2a84eee83..23f27b61b 100644 --- a/apps/desktop/src/composables/useSchemaDiffConfig.ts +++ b/apps/desktop/src/composables/useSchemaDiffConfig.ts @@ -1,5 +1,5 @@ import { ref, computed, watch } from "vue"; -import { uuid } from "@/lib/utils"; +import { uuid } from "@/lib/common/utils"; import type { SchemaDiffConfig, SchemaDiffCompareOptions } from "@/types/schemaDiff"; import { createEmptyConfig, getDefaultOptionsForDbType } from "@/types/schemaDiff"; diff --git a/apps/desktop/src/composables/useSchemaOptions.ts b/apps/desktop/src/composables/useSchemaOptions.ts index 394d7de8c..cc204ddfd 100644 --- a/apps/desktop/src/composables/useSchemaOptions.ts +++ b/apps/desktop/src/composables/useSchemaOptions.ts @@ -1,9 +1,9 @@ import { ref } from "vue"; import { useConnectionStore } from "@/stores/connectionStore"; -import { isSchemaAware as isSchemaAwareType, isSingleDatabase, usesTreeSchemaMode } from "@/lib/databaseCapabilities"; -import { filterSchemaNamesForConnection } from "@/lib/visibleDatabases"; +import { isSchemaAware as isSchemaAwareType, isSingleDatabase, usesTreeSchemaMode } from "@/lib/database/databaseCapabilities"; +import { filterSchemaNamesForConnection } from "@/lib/database/visibleDatabases"; import type { ConnectionConfig } from "@/types/database"; -import * as api from "@/lib/api"; +import * as api from "@/lib/backend/api"; export function hasSchemaOptionsCacheEntry(options: Record, key: string): boolean { return Object.prototype.hasOwnProperty.call(options, key); diff --git a/apps/desktop/src/composables/useSqlExecution.ts b/apps/desktop/src/composables/useSqlExecution.ts index 1535e55cb..5bac5e381 100644 --- a/apps/desktop/src/composables/useSqlExecution.ts +++ b/apps/desktop/src/composables/useSqlExecution.ts @@ -5,13 +5,13 @@ import { useHistoryStore } from "@/stores/historyStore"; import { useConnectionStore } from "@/stores/connectionStore"; import { useSettingsStore } from "@/stores/settingsStore"; import { useToast } from "@/composables/useToast"; -import { isSingleDatabase } from "@/lib/databaseCapabilities"; -import { canExecuteWithoutSelectedDatabase } from "@/lib/connectionLevelDatabaseBootstrap"; -import { classifySqlActivityKind } from "@/lib/historyActivityKind"; -import { sqlMetadataRefreshTarget } from "@/lib/sqlMetadataRefresh"; -import { classifyRedisCommandSafety, firstRedisCommandToken } from "@/lib/redisCommandSafety"; -import { isSqlExecutionSnapshot, resolveExecutableSql, type SqlExecutionOverride, type SqlExecutionSnapshot } from "@/lib/sqlExecutionTarget"; -import { extractSqlParameters } from "@/lib/sqlParameters"; +import { isSingleDatabase } from "@/lib/database/databaseCapabilities"; +import { canExecuteWithoutSelectedDatabase } from "@/lib/connection/connectionLevelDatabaseBootstrap"; +import { classifySqlActivityKind } from "@/lib/history/historyActivityKind"; +import { sqlMetadataRefreshTarget } from "@/lib/sql/sqlMetadataRefresh"; +import { classifyRedisCommandSafety, firstRedisCommandToken } from "@/lib/redis/redisCommandSafety"; +import { isSqlExecutionSnapshot, resolveExecutableSql, type SqlExecutionOverride, type SqlExecutionSnapshot } from "@/lib/sql/sqlExecutionTarget"; +import { extractSqlParameters } from "@/lib/sql/sqlParameters"; import type { ConnectionConfig, QueryTab } from "@/types/database"; const DANGER_RE = /^\s*(DROP|DELETE|TRUNCATE|ALTER|UPDATE|MERGE|REPLACE)\b/i; diff --git a/apps/desktop/src/composables/useSqlHighlighter.ts b/apps/desktop/src/composables/useSqlHighlighter.ts index 7ad5b248f..454a8e84f 100644 --- a/apps/desktop/src/composables/useSqlHighlighter.ts +++ b/apps/desktop/src/composables/useSqlHighlighter.ts @@ -1,6 +1,6 @@ import { onMounted, ref } from "vue"; import { useTheme } from "@/composables/useTheme"; -import { type SqlHighlighter, createShikiSqlHighlighter } from "@/lib/sqlHighlighter"; +import { type SqlHighlighter, createShikiSqlHighlighter } from "@/lib/sql/sqlHighlighter"; export function useSqlHighlighter() { const { isDark } = useTheme(); diff --git a/apps/desktop/src/composables/useTheme.ts b/apps/desktop/src/composables/useTheme.ts index 903308a1c..ca973a01e 100644 --- a/apps/desktop/src/composables/useTheme.ts +++ b/apps/desktop/src/composables/useTheme.ts @@ -1,7 +1,7 @@ import { computed, ref } from "vue"; -import { APP_THEME_STORAGE_KEY, getTauriThemeForMode, normalizeAppThemeMode, resolveAppThemeAppearance, type AppThemeMode } from "@/lib/appTheme"; -import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/safeStorage"; -import { isTauriRuntime } from "@/lib/tauriRuntime"; +import { APP_THEME_STORAGE_KEY, getTauriThemeForMode, normalizeAppThemeMode, resolveAppThemeAppearance, type AppThemeMode } from "@/lib/app/appTheme"; +import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/backend/safeStorage"; +import { isTauriRuntime } from "@/lib/backend/tauriRuntime"; const themeMode = ref(normalizeAppThemeMode(safeLocalStorageGet(APP_THEME_STORAGE_KEY))); const systemPrefersDark = ref(readSystemPrefersDark()); diff --git a/apps/desktop/src/composables/useVisibilityChange.ts b/apps/desktop/src/composables/useVisibilityChange.ts index 7bb8603d7..801aa790d 100644 --- a/apps/desktop/src/composables/useVisibilityChange.ts +++ b/apps/desktop/src/composables/useVisibilityChange.ts @@ -1,5 +1,5 @@ import { onMounted, onUnmounted } from "vue"; -import { refreshConnections } from "@/lib/api"; +import { refreshConnections } from "@/lib/backend/api"; import { useQueryStore } from "@/stores/queryStore"; let hiddenAt: number | null = null; diff --git a/apps/desktop/src/composables/useWebDavAutoUpload.ts b/apps/desktop/src/composables/useWebDavAutoUpload.ts index 2de8b1c56..b31893858 100644 --- a/apps/desktop/src/composables/useWebDavAutoUpload.ts +++ b/apps/desktop/src/composables/useWebDavAutoUpload.ts @@ -1,8 +1,8 @@ import { onMounted, onUnmounted } from "vue"; import { useSettingsStore } from "@/stores/settingsStore"; -import { appendDebugLog } from "@/lib/debugLog"; -import { webdavSyncUpload } from "@/lib/api"; -import { readWebDavAutoUploadConfig, WEB_DAV_AUTO_UPLOAD_STORAGE_KEYS } from "@/lib/webdavAutoUploadConfig"; +import { appendDebugLog } from "@/lib/backend/debugLog"; +import { webdavSyncUpload } from "@/lib/backend/api"; +import { readWebDavAutoUploadConfig, WEB_DAV_AUTO_UPLOAD_STORAGE_KEYS } from "@/lib/webdav/webdavAutoUploadConfig"; export function useWebDavAutoUpload() { const settingsStore = useSettingsStore(); diff --git a/apps/desktop/src/composables/useWindowControls.ts b/apps/desktop/src/composables/useWindowControls.ts index 447257815..0917d94d7 100644 --- a/apps/desktop/src/composables/useWindowControls.ts +++ b/apps/desktop/src/composables/useWindowControls.ts @@ -1,7 +1,7 @@ import { ref, onMounted, onUnmounted } from "vue"; -import { isTauriRuntime } from "@/lib/tauriRuntime"; -import { isMacOS } from "@/lib/platform"; -import * as api from "@/lib/api"; +import { isTauriRuntime } from "@/lib/backend/tauriRuntime"; +import { isMacOS } from "@/lib/backend/platform"; +import * as api from "@/lib/backend/api"; export function shouldReserveMacTrafficLightInset(isMac: boolean, isFullscreen: boolean, isDesktop = true): boolean { return isDesktop && isMac && !isFullscreen; diff --git a/apps/desktop/src/i18n/index.ts b/apps/desktop/src/i18n/index.ts index 8471cb642..896cf78f4 100644 --- a/apps/desktop/src/i18n/index.ts +++ b/apps/desktop/src/i18n/index.ts @@ -1,6 +1,6 @@ import { createI18n } from "vue-i18n"; import en from "./locales/en"; -import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/safeStorage"; +import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/backend/safeStorage"; export type Locale = "en" | "es" | "it" | "ja" | "pt-BR" | "zh-CN" | "zh-TW"; type LocaleMessages = Record; diff --git a/apps/desktop/src/lib/README.md b/apps/desktop/src/lib/README.md new file mode 100644 index 000000000..2796f0d09 --- /dev/null +++ b/apps/desktop/src/lib/README.md @@ -0,0 +1,15 @@ +# Desktop Library Layout + +`src/lib` is organized by product/runtime domain. Keep implementation modules inside a domain folder instead of adding new files at the root. + +- `backend`: Tauri, HTTP, platform, storage, and transport bridges. +- `common`: generic helpers with no DBX feature ownership. +- `app`, `tabs`, `sidebar`, `connection`: shell, navigation, and connection UI state helpers. +- `database`, `metadata`, `schema`, `table`: relational database metadata, capabilities, DDL, and table-object helpers. +- `sql`, `sql/semantic`, `editor`, `query`, `history`, `savedSql`: SQL editing, execution, diagnostics, history, and saved SQL behavior. +- `dataGrid`: result/grid rendering, editing, previews, pagination, and export helpers tied to the grid. +- `ai`, `mcp`: AI assistant and MCP configuration helpers. +- `redis`, `mongo`, `elasticsearch`, `etcd`, `kv`, `mq`, `nacos`, `zookeeper`, `webdav`: non-relational or service-specific helpers. +- `diagram`, `document`, `export`, `imports`: feature-specific utilities that are shared by more than one component. + +Tests under `src/lib/__tests__` mirror the same domain folders. When moving a module, update both runtime imports and colocated tests so stale root-level aliases do not return. diff --git a/apps/desktop/src/lib/__tests__/ai.spec.ts b/apps/desktop/src/lib/__tests__/ai/ai.spec.ts similarity index 92% rename from apps/desktop/src/lib/__tests__/ai.spec.ts rename to apps/desktop/src/lib/__tests__/ai/ai.spec.ts index d91590a33..233552216 100644 --- a/apps/desktop/src/lib/__tests__/ai.spec.ts +++ b/apps/desktop/src/lib/__tests__/ai/ai.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { buildSystemPrompt, type AiContext } from "@/lib/ai"; +import { buildSystemPrompt, type AiContext } from "@/lib/ai/ai"; function context(overrides: Partial = {}): AiContext { return { diff --git a/apps/desktop/src/lib/__tests__/aiMarkdown.spec.ts b/apps/desktop/src/lib/__tests__/ai/aiMarkdown.spec.ts similarity index 99% rename from apps/desktop/src/lib/__tests__/aiMarkdown.spec.ts rename to apps/desktop/src/lib/__tests__/ai/aiMarkdown.spec.ts index 2dc77a5c2..212cf10fe 100644 --- a/apps/desktop/src/lib/__tests__/aiMarkdown.spec.ts +++ b/apps/desktop/src/lib/__tests__/ai/aiMarkdown.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { aiMarkdownLinkUrlFromClick, formatAiInlineMarkdown, handleAiMarkdownLinkClick, normalizeAiMarkdownLink } from "@/lib/aiMarkdown"; +import { aiMarkdownLinkUrlFromClick, formatAiInlineMarkdown, handleAiMarkdownLinkClick, normalizeAiMarkdownLink } from "@/lib/ai/aiMarkdown"; describe("formatAiInlineMarkdown", () => { it("renders http links for external browser handling", () => { diff --git a/apps/desktop/src/lib/__tests__/aiMessageEdit.spec.ts b/apps/desktop/src/lib/__tests__/ai/aiMessageEdit.spec.ts similarity index 97% rename from apps/desktop/src/lib/__tests__/aiMessageEdit.spec.ts rename to apps/desktop/src/lib/__tests__/ai/aiMessageEdit.spec.ts index 8f90553e3..859044e72 100644 --- a/apps/desktop/src/lib/__tests__/aiMessageEdit.spec.ts +++ b/apps/desktop/src/lib/__tests__/ai/aiMessageEdit.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { visibleToActualIndex } from "@/lib/aiMessageEdit"; +import { visibleToActualIndex } from "@/lib/ai/aiMessageEdit"; describe("visibleToActualIndex", () => { it("maps visible index 0 to first non-summary message", () => { diff --git a/apps/desktop/src/lib/__tests__/aiModelPresentation.spec.ts b/apps/desktop/src/lib/__tests__/ai/aiModelPresentation.spec.ts similarity index 97% rename from apps/desktop/src/lib/__tests__/aiModelPresentation.spec.ts rename to apps/desktop/src/lib/__tests__/ai/aiModelPresentation.spec.ts index b0b337c93..9fd61744b 100644 --- a/apps/desktop/src/lib/__tests__/aiModelPresentation.spec.ts +++ b/apps/desktop/src/lib/__tests__/ai/aiModelPresentation.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { formatAiModelOption, shouldShowAiModelSecondaryLabel } from "@/lib/aiModelPresentation"; +import { formatAiModelOption, shouldShowAiModelSecondaryLabel } from "@/lib/ai/aiModelPresentation"; describe("shouldShowAiModelSecondaryLabel", () => { it("hides secondary text when display name only changes case", () => { diff --git a/apps/desktop/src/lib/__tests__/aiProposalDetect.spec.ts b/apps/desktop/src/lib/__tests__/ai/aiProposalDetect.spec.ts similarity index 99% rename from apps/desktop/src/lib/__tests__/aiProposalDetect.spec.ts rename to apps/desktop/src/lib/__tests__/ai/aiProposalDetect.spec.ts index a9804b5eb..cfe5b021f 100644 --- a/apps/desktop/src/lib/__tests__/aiProposalDetect.spec.ts +++ b/apps/desktop/src/lib/__tests__/ai/aiProposalDetect.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { containsChinese, isShortAffirmative, isShortNegative, looksLikeActionProposal } from "@/lib/aiProposalDetect"; +import { containsChinese, isShortAffirmative, isShortNegative, looksLikeActionProposal } from "@/lib/ai/aiProposalDetect"; describe("looksLikeActionProposal", () => { // ---- zh-CN proposals ---- diff --git a/apps/desktop/src/lib/__tests__/aiTableMentions.spec.ts b/apps/desktop/src/lib/__tests__/ai/aiTableMentions.spec.ts similarity index 98% rename from apps/desktop/src/lib/__tests__/aiTableMentions.spec.ts rename to apps/desktop/src/lib/__tests__/ai/aiTableMentions.spec.ts index 173ce4c35..51da0a8f5 100644 --- a/apps/desktop/src/lib/__tests__/aiTableMentions.spec.ts +++ b/apps/desktop/src/lib/__tests__/ai/aiTableMentions.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { AI_TABLE_MENTION_CANDIDATE_LIMIT, filterAiTableMentionCandidates, formatAiTableMention, parseAiTableMentions } from "@/lib/aiTableMentions"; +import { AI_TABLE_MENTION_CANDIDATE_LIMIT, filterAiTableMentionCandidates, formatAiTableMention, parseAiTableMentions } from "@/lib/ai/aiTableMentions"; describe("AI table mention parsing", () => { it("parses plain and schema-qualified table mentions", () => { diff --git a/apps/desktop/src/lib/__tests__/pinnedItems.spec.ts b/apps/desktop/src/lib/__tests__/app/pinnedItems.spec.ts similarity index 92% rename from apps/desktop/src/lib/__tests__/pinnedItems.spec.ts rename to apps/desktop/src/lib/__tests__/app/pinnedItems.spec.ts index 7ce3b5751..b7ba65ca2 100644 --- a/apps/desktop/src/lib/__tests__/pinnedItems.spec.ts +++ b/apps/desktop/src/lib/__tests__/app/pinnedItems.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "vitest"; -import { updatePinnedTreeNodeInPlace } from "@/lib/pinnedItems"; -import { buildTreeNodesFromLayout } from "@/lib/sidebarLayout"; +import { updatePinnedTreeNodeInPlace } from "@/lib/app/pinnedItems"; +import { buildTreeNodesFromLayout } from "@/lib/sidebar/sidebarLayout"; import type { ConnectionConfig, SidebarLayout, TreeNode } from "@/types/database"; describe("sidebar pinned tree nodes", () => { diff --git a/apps/desktop/src/lib/__tests__/ttlFormat.spec.ts b/apps/desktop/src/lib/__tests__/common/ttlFormat.spec.ts similarity index 98% rename from apps/desktop/src/lib/__tests__/ttlFormat.spec.ts rename to apps/desktop/src/lib/__tests__/common/ttlFormat.spec.ts index 7284accd7..25f2faee7 100644 --- a/apps/desktop/src/lib/__tests__/ttlFormat.spec.ts +++ b/apps/desktop/src/lib/__tests__/common/ttlFormat.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { formatTtl } from "@/lib/ttlFormat"; +import { formatTtl } from "@/lib/common/ttlFormat"; // --------------------------------------------------------------------------- // Mock `t()` helpers — only the day unit needs localization diff --git a/apps/desktop/src/lib/__tests__/webPath.spec.ts b/apps/desktop/src/lib/__tests__/common/webPath.spec.ts similarity index 98% rename from apps/desktop/src/lib/__tests__/webPath.spec.ts rename to apps/desktop/src/lib/__tests__/common/webPath.spec.ts index 41854e6b5..e6ea717a5 100644 --- a/apps/desktop/src/lib/__tests__/webPath.spec.ts +++ b/apps/desktop/src/lib/__tests__/common/webPath.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { apiUrl, apiWebSocketUrl, dbxWebBasePath, webPath } from "@/lib/webPath"; +import { apiUrl, apiWebSocketUrl, dbxWebBasePath, webPath } from "@/lib/common/webPath"; describe("webPath", () => { it("keeps root deployments on root-relative API paths", () => { diff --git a/apps/desktop/src/lib/__tests__/connectionAttemptTimeout.spec.ts b/apps/desktop/src/lib/__tests__/connection/connectionAttemptTimeout.spec.ts similarity index 97% rename from apps/desktop/src/lib/__tests__/connectionAttemptTimeout.spec.ts rename to apps/desktop/src/lib/__tests__/connection/connectionAttemptTimeout.spec.ts index 2cda2f5ee..a447b52b3 100644 --- a/apps/desktop/src/lib/__tests__/connectionAttemptTimeout.spec.ts +++ b/apps/desktop/src/lib/__tests__/connection/connectionAttemptTimeout.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { ACCESS_AGENT_MIN_CONNECT_TIMEOUT_SECS, AGENT_DRIVER_MIN_CONNECT_TIMEOUT_SECS, connectionAttemptOriginalErrorMessage, connectionAttemptTimeoutMessage, connectionAttemptTimeoutMs, CONNECTION_ATTEMPT_TIMEOUT_BUFFER_MS } from "@/lib/connectionAttemptTimeout"; +import { ACCESS_AGENT_MIN_CONNECT_TIMEOUT_SECS, AGENT_DRIVER_MIN_CONNECT_TIMEOUT_SECS, connectionAttemptOriginalErrorMessage, connectionAttemptTimeoutMessage, connectionAttemptTimeoutMs, CONNECTION_ATTEMPT_TIMEOUT_BUFFER_MS } from "@/lib/connection/connectionAttemptTimeout"; describe("connectionAttemptTimeout", () => { it("uses a 10s default for regular database connections", () => { diff --git a/apps/desktop/src/lib/__tests__/connectionOpenTarget.spec.ts b/apps/desktop/src/lib/__tests__/connection/connectionOpenTarget.spec.ts similarity index 92% rename from apps/desktop/src/lib/__tests__/connectionOpenTarget.spec.ts rename to apps/desktop/src/lib/__tests__/connection/connectionOpenTarget.spec.ts index a9c9e0692..50ebcf6cb 100644 --- a/apps/desktop/src/lib/__tests__/connectionOpenTarget.spec.ts +++ b/apps/desktop/src/lib/__tests__/connection/connectionOpenTarget.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { quickConnectionOpenTarget } from "@/lib/connectionOpenTarget"; +import { quickConnectionOpenTarget } from "@/lib/connection/connectionOpenTarget"; import type { ConnectionConfig } from "@/types/database"; function connection(dbType: ConnectionConfig["db_type"]): ConnectionConfig { diff --git a/apps/desktop/src/lib/__tests__/connectionUrl.dremio.spec.ts b/apps/desktop/src/lib/__tests__/connection/connectionUrl.dremio.spec.ts similarity index 97% rename from apps/desktop/src/lib/__tests__/connectionUrl.dremio.spec.ts rename to apps/desktop/src/lib/__tests__/connection/connectionUrl.dremio.spec.ts index af5315e57..7cf7da37e 100644 --- a/apps/desktop/src/lib/__tests__/connectionUrl.dremio.spec.ts +++ b/apps/desktop/src/lib/__tests__/connection/connectionUrl.dremio.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { parseConnectionUrl } from "../connectionUrl"; +import { parseConnectionUrl } from "@/lib/connection/connectionUrl"; describe("Dremio JDBC connection URLs", () => { it("parses legacy direct JDBC URLs into a Dremio JDBC profile", () => { diff --git a/apps/desktop/src/lib/__tests__/connectionUrl.zookeeper.spec.ts b/apps/desktop/src/lib/__tests__/connection/connectionUrl.zookeeper.spec.ts similarity index 80% rename from apps/desktop/src/lib/__tests__/connectionUrl.zookeeper.spec.ts rename to apps/desktop/src/lib/__tests__/connection/connectionUrl.zookeeper.spec.ts index 30231aa0e..efd1c0683 100644 --- a/apps/desktop/src/lib/__tests__/connectionUrl.zookeeper.spec.ts +++ b/apps/desktop/src/lib/__tests__/connection/connectionUrl.zookeeper.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { parseConnectionUrl } from "../connectionUrl"; +import { parseConnectionUrl } from "@/lib/connection/connectionUrl"; describe("ZooKeeper connection URLs", () => { it("preserves the host:port chroot path as a ZooKeeper connect string", () => { diff --git a/apps/desktop/src/lib/__tests__/chartData.spec.ts b/apps/desktop/src/lib/__tests__/dataGrid/chartData.spec.ts similarity index 97% rename from apps/desktop/src/lib/__tests__/chartData.spec.ts rename to apps/desktop/src/lib/__tests__/dataGrid/chartData.spec.ts index a6b21cdd6..825e46274 100644 --- a/apps/desktop/src/lib/__tests__/chartData.spec.ts +++ b/apps/desktop/src/lib/__tests__/dataGrid/chartData.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { axisColumnLabel, chartableColumnIndexes, toChartNumber } from "@/lib/chartData"; +import { axisColumnLabel, chartableColumnIndexes, toChartNumber } from "@/lib/dataGrid/chartData"; import type { QueryResult } from "@/types/database"; function result(columns: string[], rows: QueryResult["rows"]): QueryResult { diff --git a/apps/desktop/src/lib/__tests__/dataGridConditionSuggestionPosition.spec.ts b/apps/desktop/src/lib/__tests__/dataGrid/dataGridConditionSuggestionPosition.spec.ts similarity index 95% rename from apps/desktop/src/lib/__tests__/dataGridConditionSuggestionPosition.spec.ts rename to apps/desktop/src/lib/__tests__/dataGrid/dataGridConditionSuggestionPosition.spec.ts index f4ebf3204..26b6f0b64 100644 --- a/apps/desktop/src/lib/__tests__/dataGridConditionSuggestionPosition.spec.ts +++ b/apps/desktop/src/lib/__tests__/dataGrid/dataGridConditionSuggestionPosition.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from "vitest"; -import { getDataGridConditionSuggestionPosition } from "@/lib/dataGridConditionSuggestionPosition"; +import { getDataGridConditionSuggestionPosition } from "@/lib/dataGrid/dataGridConditionSuggestionPosition"; describe("getDataGridConditionSuggestionPosition", () => { test("anchors the dropdown to the input instead of the caret", () => { diff --git a/apps/desktop/src/lib/__tests__/geometryPreview.spec.ts b/apps/desktop/src/lib/__tests__/dataGrid/geometryPreview.spec.ts similarity index 94% rename from apps/desktop/src/lib/__tests__/geometryPreview.spec.ts rename to apps/desktop/src/lib/__tests__/dataGrid/geometryPreview.spec.ts index 3fc45f471..974146979 100644 --- a/apps/desktop/src/lib/__tests__/geometryPreview.spec.ts +++ b/apps/desktop/src/lib/__tests__/dataGrid/geometryPreview.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { wktToGeoJson } from "@/lib/geometryPreview"; +import { wktToGeoJson } from "@/lib/dataGrid/geometryPreview"; describe("wktToGeoJson", () => { it("preserves polygon interior rings", () => { diff --git a/apps/desktop/src/lib/__tests__/gridSelection.spec.ts b/apps/desktop/src/lib/__tests__/dataGrid/gridSelection.spec.ts similarity index 98% rename from apps/desktop/src/lib/__tests__/gridSelection.spec.ts rename to apps/desktop/src/lib/__tests__/dataGrid/gridSelection.spec.ts index 3b536c4fb..eafc1a0fa 100644 --- a/apps/desktop/src/lib/__tests__/gridSelection.spec.ts +++ b/apps/desktop/src/lib/__tests__/dataGrid/gridSelection.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { formatSelectionAsTsv, summarizeSelection } from "@/lib/gridSelection"; +import { formatSelectionAsTsv, summarizeSelection } from "@/lib/dataGrid/gridSelection"; describe("gridSelection", () => { it("formats TSV selections without headers by default", () => { diff --git a/apps/desktop/src/lib/__tests__/createDatabaseCharsetOptions.spec.ts b/apps/desktop/src/lib/__tests__/database/createDatabaseCharsetOptions.spec.ts similarity index 97% rename from apps/desktop/src/lib/__tests__/createDatabaseCharsetOptions.spec.ts rename to apps/desktop/src/lib/__tests__/database/createDatabaseCharsetOptions.spec.ts index 27230c06f..932719695 100644 --- a/apps/desktop/src/lib/__tests__/createDatabaseCharsetOptions.spec.ts +++ b/apps/desktop/src/lib/__tests__/database/createDatabaseCharsetOptions.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { CREATE_DATABASE_CHARSET_OPTIONS, createDatabaseCollationOptionsForCharset, defaultCreateDatabaseCollationForCharset, normalizeCreateDatabaseCharset, parseCreateDatabaseCharsetMetadata, nextCreateDatabaseCollation } from "@/lib/createDatabaseCharsetOptions"; +import { CREATE_DATABASE_CHARSET_OPTIONS, createDatabaseCollationOptionsForCharset, defaultCreateDatabaseCollationForCharset, normalizeCreateDatabaseCharset, parseCreateDatabaseCharsetMetadata, nextCreateDatabaseCollation } from "@/lib/database/createDatabaseCharsetOptions"; describe("createDatabaseCharsetOptions", () => { it("offers common MySQL character sets with utf8mb4 first", () => { diff --git a/apps/desktop/src/lib/__tests__/databaseDriverManifest.spec.ts b/apps/desktop/src/lib/__tests__/database/databaseDriverManifest.spec.ts similarity index 93% rename from apps/desktop/src/lib/__tests__/databaseDriverManifest.spec.ts rename to apps/desktop/src/lib/__tests__/database/databaseDriverManifest.spec.ts index 0b0df42d1..946e2628f 100644 --- a/apps/desktop/src/lib/__tests__/databaseDriverManifest.spec.ts +++ b/apps/desktop/src/lib/__tests__/database/databaseDriverManifest.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { databaseRuntimeMode, usesAgentCursorForQuery } from "@/lib/databaseDriverManifest"; +import { databaseRuntimeMode, usesAgentCursorForQuery } from "@/lib/database/databaseDriverManifest"; describe("databaseDriverManifest", () => { it("uses agent cursor only for agent or external runtimes", () => { diff --git a/apps/desktop/src/lib/__tests__/databaseFeatureSupport.spec.ts b/apps/desktop/src/lib/__tests__/database/databaseFeatureSupport.spec.ts similarity index 93% rename from apps/desktop/src/lib/__tests__/databaseFeatureSupport.spec.ts rename to apps/desktop/src/lib/__tests__/database/databaseFeatureSupport.spec.ts index d60c20d37..72eb19741 100644 --- a/apps/desktop/src/lib/__tests__/databaseFeatureSupport.spec.ts +++ b/apps/desktop/src/lib/__tests__/database/databaseFeatureSupport.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { supportsTransaction } from "@/lib/databaseFeatureSupport"; +import { supportsTransaction } from "@/lib/database/databaseFeatureSupport"; describe("supportsTransaction", () => { it("returns true for supported database types", () => { diff --git a/apps/desktop/src/lib/__tests__/databaseObjectCapabilities.spec.ts b/apps/desktop/src/lib/__tests__/database/databaseObjectCapabilities.spec.ts similarity index 89% rename from apps/desktop/src/lib/__tests__/databaseObjectCapabilities.spec.ts rename to apps/desktop/src/lib/__tests__/database/databaseObjectCapabilities.spec.ts index 1c397dd93..097f767b2 100644 --- a/apps/desktop/src/lib/__tests__/databaseObjectCapabilities.spec.ts +++ b/apps/desktop/src/lib/__tests__/database/databaseObjectCapabilities.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { normalizeSidebarObjectKind, sidebarObjectKindsForDatabase } from "@/lib/databaseObjectCapabilities"; +import { normalizeSidebarObjectKind, sidebarObjectKindsForDatabase } from "@/lib/database/databaseObjectCapabilities"; describe("databaseObjectCapabilities", () => { it("exposes materialized views for Dameng", () => { diff --git a/apps/desktop/src/lib/__tests__/defaultDatabase.spec.ts b/apps/desktop/src/lib/__tests__/database/defaultDatabase.spec.ts similarity index 95% rename from apps/desktop/src/lib/__tests__/defaultDatabase.spec.ts rename to apps/desktop/src/lib/__tests__/database/defaultDatabase.spec.ts index c0c1784cb..de584c582 100644 --- a/apps/desktop/src/lib/__tests__/defaultDatabase.spec.ts +++ b/apps/desktop/src/lib/__tests__/database/defaultDatabase.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { decodeSelectableDatabaseValue, EMPTY_DATABASE_SELECT_VALUE, encodeSelectableDatabaseValue, TREE_SCHEMA_DEFAULT_DATABASE_SELECT_VALUE } from "@/lib/defaultDatabase"; +import { decodeSelectableDatabaseValue, EMPTY_DATABASE_SELECT_VALUE, encodeSelectableDatabaseValue, TREE_SCHEMA_DEFAULT_DATABASE_SELECT_VALUE } from "@/lib/database/defaultDatabase"; describe("defaultDatabase selectable values", () => { it("encodes empty tree-schema databases with the default database sentinel", () => { diff --git a/apps/desktop/src/lib/__tests__/jdbcDialect.spec.ts b/apps/desktop/src/lib/__tests__/database/jdbcDialect.spec.ts similarity index 97% rename from apps/desktop/src/lib/__tests__/jdbcDialect.spec.ts rename to apps/desktop/src/lib/__tests__/database/jdbcDialect.spec.ts index 8d3047e9f..2240ffc28 100644 --- a/apps/desktop/src/lib/__tests__/jdbcDialect.spec.ts +++ b/apps/desktop/src/lib/__tests__/database/jdbcDialect.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { effectiveDatabaseTypeForConnection, inferJdbcDialect } from "@/lib/jdbcDialect"; +import { effectiveDatabaseTypeForConnection, inferJdbcDialect } from "@/lib/database/jdbcDialect"; describe("jdbc dialect inference", () => { it("detects InterSystems IRIS and Caché JDBC connections", () => { diff --git a/apps/desktop/src/lib/__tests__/mysqlConnectionOptions.spec.ts b/apps/desktop/src/lib/__tests__/database/mysqlConnectionOptions.spec.ts similarity index 94% rename from apps/desktop/src/lib/__tests__/mysqlConnectionOptions.spec.ts rename to apps/desktop/src/lib/__tests__/database/mysqlConnectionOptions.spec.ts index c6117d464..69b087db5 100644 --- a/apps/desktop/src/lib/__tests__/mysqlConnectionOptions.spec.ts +++ b/apps/desktop/src/lib/__tests__/database/mysqlConnectionOptions.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { mysqlCleartextPasswordAuthEnabled, setMysqlCleartextPasswordAuthEnabled } from "../mysqlConnectionOptions"; +import { mysqlCleartextPasswordAuthEnabled, setMysqlCleartextPasswordAuthEnabled } from "@/lib/database/mysqlConnectionOptions"; describe("mysqlConnectionOptions", () => { it("detects cleartext password auth aliases", () => { diff --git a/apps/desktop/src/lib/__tests__/prestoSqlBuiltinDriver.spec.ts b/apps/desktop/src/lib/__tests__/database/prestoSqlBuiltinDriver.spec.ts similarity index 97% rename from apps/desktop/src/lib/__tests__/prestoSqlBuiltinDriver.spec.ts rename to apps/desktop/src/lib/__tests__/database/prestoSqlBuiltinDriver.spec.ts index 14f8b3234..e3dab8776 100644 --- a/apps/desktop/src/lib/__tests__/prestoSqlBuiltinDriver.spec.ts +++ b/apps/desktop/src/lib/__tests__/database/prestoSqlBuiltinDriver.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { PRESTOSQL_JDBC_DRIVER_COORDINATE, prestoSqlBuiltinDriverPaths, prestoSqlBuiltinDriverRow, prestoSqlMavenBundle } from "@/lib/prestoSqlBuiltinDriver"; +import { PRESTOSQL_JDBC_DRIVER_COORDINATE, prestoSqlBuiltinDriverPaths, prestoSqlBuiltinDriverRow, prestoSqlMavenBundle } from "@/lib/database/prestoSqlBuiltinDriver"; import type { JdbcMavenBundleInfo } from "@/types/database"; function bundle(coordinate: string, version = "350"): JdbcMavenBundleInfo { diff --git a/apps/desktop/src/lib/__tests__/codemirrorSqlDialect.spec.ts b/apps/desktop/src/lib/__tests__/editor/codemirrorSqlDialect.spec.ts similarity index 89% rename from apps/desktop/src/lib/__tests__/codemirrorSqlDialect.spec.ts rename to apps/desktop/src/lib/__tests__/editor/codemirrorSqlDialect.spec.ts index 36cef6652..f728d2d2d 100644 --- a/apps/desktop/src/lib/__tests__/codemirrorSqlDialect.spec.ts +++ b/apps/desktop/src/lib/__tests__/editor/codemirrorSqlDialect.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "vitest"; import { PostgreSQL } from "@codemirror/lang-sql"; -import { postgresKeywordSyntaxTerms } from "@/lib/codemirrorSqlDialect"; +import { postgresKeywordSyntaxTerms } from "@/lib/editor/codemirrorSqlDialect"; describe("codemirrorSqlDialect", () => { it("keeps common PostgreSQL identifier names out of keyword highlighting", () => { diff --git a/apps/desktop/src/lib/__tests__/shortcutRegistry.spec.ts b/apps/desktop/src/lib/__tests__/editor/shortcutRegistry.spec.ts similarity index 98% rename from apps/desktop/src/lib/__tests__/shortcutRegistry.spec.ts rename to apps/desktop/src/lib/__tests__/editor/shortcutRegistry.spec.ts index efb84cdde..ac3bf544d 100644 --- a/apps/desktop/src/lib/__tests__/shortcutRegistry.spec.ts +++ b/apps/desktop/src/lib/__tests__/editor/shortcutRegistry.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { DEFAULT_SHORTCUT_SETTINGS, SHORTCUT_DEFINITIONS, findShortcutConflict, normalizeShortcutSettings, type ShortcutActionId } from "@/lib/shortcutRegistry"; +import { DEFAULT_SHORTCUT_SETTINGS, SHORTCUT_DEFINITIONS, findShortcutConflict, normalizeShortcutSettings, type ShortcutActionId } from "@/lib/editor/shortcutRegistry"; describe("shortcutRegistry editor actions", () => { const formatterEditorActionIds: ShortcutActionId[] = ["formatSql", "indentMore", "indentLess", "duplicateLine", "deleteLine", "moveLineUp", "moveLineDown", "copyLineUp", "copyLineDown", "undo", "redo", "selectAll"]; diff --git a/apps/desktop/src/lib/__tests__/etcdKeyTree.spec.ts b/apps/desktop/src/lib/__tests__/etcd/etcdKeyTree.spec.ts similarity index 97% rename from apps/desktop/src/lib/__tests__/etcdKeyTree.spec.ts rename to apps/desktop/src/lib/__tests__/etcd/etcdKeyTree.spec.ts index c6dd7232b..6abe025e9 100644 --- a/apps/desktop/src/lib/__tests__/etcdKeyTree.spec.ts +++ b/apps/desktop/src/lib/__tests__/etcd/etcdKeyTree.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { buildEtcdKeyTree, flattenVisibleEtcdKeyTree } from "@/lib/etcdKeyTree"; +import { buildEtcdKeyTree, flattenVisibleEtcdKeyTree } from "@/lib/etcd/etcdKeyTree"; describe("etcd key tree", () => { it("groups slash-delimited keys", () => { diff --git a/apps/desktop/src/lib/__tests__/navicatImport.spec.ts b/apps/desktop/src/lib/__tests__/imports/navicatImport.spec.ts similarity index 98% rename from apps/desktop/src/lib/__tests__/navicatImport.spec.ts rename to apps/desktop/src/lib/__tests__/imports/navicatImport.spec.ts index 950003c70..64b04a6b5 100644 --- a/apps/desktop/src/lib/__tests__/navicatImport.spec.ts +++ b/apps/desktop/src/lib/__tests__/imports/navicatImport.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { parseNavicatConnections } from "../navicatImport"; +import { parseNavicatConnections } from "@/lib/imports/navicatImport"; class TestElement { readonly tagName: string; diff --git a/apps/desktop/src/lib/__tests__/kvKeyTree.spec.ts b/apps/desktop/src/lib/__tests__/kv/kvKeyTree.spec.ts similarity index 97% rename from apps/desktop/src/lib/__tests__/kvKeyTree.spec.ts rename to apps/desktop/src/lib/__tests__/kv/kvKeyTree.spec.ts index 50bb6a1e2..c0e6b0897 100644 --- a/apps/desktop/src/lib/__tests__/kvKeyTree.spec.ts +++ b/apps/desktop/src/lib/__tests__/kv/kvKeyTree.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { buildKvKeyTree, collectKvGroupIds, flattenVisibleKvKeyTree, preserveKvExpandedGroupIds } from "@/lib/kvKeyTree"; +import { buildKvKeyTree, collectKvGroupIds, flattenVisibleKvKeyTree, preserveKvExpandedGroupIds } from "@/lib/kv/kvKeyTree"; describe("kv key tree", () => { it("keeps root keys as leaf nodes", () => { diff --git a/apps/desktop/src/lib/__tests__/kvRefreshSelection.spec.ts b/apps/desktop/src/lib/__tests__/kv/kvRefreshSelection.spec.ts similarity index 79% rename from apps/desktop/src/lib/__tests__/kvRefreshSelection.spec.ts rename to apps/desktop/src/lib/__tests__/kv/kvRefreshSelection.spec.ts index 8e116bd8c..7945512de 100644 --- a/apps/desktop/src/lib/__tests__/kvRefreshSelection.spec.ts +++ b/apps/desktop/src/lib/__tests__/kv/kvRefreshSelection.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "vitest"; -import { refreshedKvSelectionKey } from "@/lib/kvRefreshSelection"; -import type { KvKeySummary } from "@/lib/api"; +import { refreshedKvSelectionKey } from "@/lib/kv/kvRefreshSelection"; +import type { KvKeySummary } from "@/lib/backend/api"; describe("kv refresh selection", () => { const keys: KvKeySummary[] = [{ key: "/app/config" }, { key: "/app/feature" }]; diff --git a/apps/desktop/src/lib/__tests__/kvRootPresentation.spec.ts b/apps/desktop/src/lib/__tests__/kv/kvRootPresentation.spec.ts similarity index 81% rename from apps/desktop/src/lib/__tests__/kvRootPresentation.spec.ts rename to apps/desktop/src/lib/__tests__/kv/kvRootPresentation.spec.ts index 98697a7b0..6436a08f8 100644 --- a/apps/desktop/src/lib/__tests__/kvRootPresentation.spec.ts +++ b/apps/desktop/src/lib/__tests__/kv/kvRootPresentation.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { kvRootNodeLabel } from "@/lib/kvRootPresentation"; +import { kvRootNodeLabel } from "@/lib/kv/kvRootPresentation"; describe("kv root presentation", () => { it("keeps etcd under Keys but shows ZooKeeper as root path", () => { diff --git a/apps/desktop/src/lib/__tests__/kvValueDisplay.spec.ts b/apps/desktop/src/lib/__tests__/kv/kvValueDisplay.spec.ts similarity index 95% rename from apps/desktop/src/lib/__tests__/kvValueDisplay.spec.ts rename to apps/desktop/src/lib/__tests__/kv/kvValueDisplay.spec.ts index 50f035b45..90b2e843a 100644 --- a/apps/desktop/src/lib/__tests__/kvValueDisplay.spec.ts +++ b/apps/desktop/src/lib/__tests__/kv/kvValueDisplay.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "vitest"; -import { formatZooKeeperMetadataRows, formatZooKeeperSummaryBadges, prettyPrintJsonText } from "@/lib/kvValueDisplay"; -import type { KvKeyMetadata } from "@/lib/api"; +import { formatZooKeeperMetadataRows, formatZooKeeperSummaryBadges, prettyPrintJsonText } from "@/lib/kv/kvValueDisplay"; +import type { KvKeyMetadata } from "@/lib/backend/api"; describe("kv value display helpers", () => { it("pretty prints valid JSON text", () => { diff --git a/apps/desktop/src/lib/__tests__/mcpConfigTemplates.spec.ts b/apps/desktop/src/lib/__tests__/mcp/mcpConfigTemplates.spec.ts similarity index 99% rename from apps/desktop/src/lib/__tests__/mcpConfigTemplates.spec.ts rename to apps/desktop/src/lib/__tests__/mcp/mcpConfigTemplates.spec.ts index 36ad21f1b..d425280bb 100644 --- a/apps/desktop/src/lib/__tests__/mcpConfigTemplates.spec.ts +++ b/apps/desktop/src/lib/__tests__/mcp/mcpConfigTemplates.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { buildMcpCodexConfig, buildMcpJsonConfig, buildMcpOpenCodeConfig, buildMcpVsCodeConfig, type McpEnvEntry } from "@/lib/mcpConfigTemplates"; +import { buildMcpCodexConfig, buildMcpJsonConfig, buildMcpOpenCodeConfig, buildMcpVsCodeConfig, type McpEnvEntry } from "@/lib/mcp/mcpConfigTemplates"; describe("MCP config templates", () => { it("builds the standard mcpServers JSON used by Claude, Cursor, TRAE, and Windsurf", () => { diff --git a/apps/desktop/src/lib/__tests__/completionMetadataPolicy.spec.ts b/apps/desktop/src/lib/__tests__/metadata/completionMetadataPolicy.spec.ts similarity index 94% rename from apps/desktop/src/lib/__tests__/completionMetadataPolicy.spec.ts rename to apps/desktop/src/lib/__tests__/metadata/completionMetadataPolicy.spec.ts index d9909c569..a6528ee45 100644 --- a/apps/desktop/src/lib/__tests__/completionMetadataPolicy.spec.ts +++ b/apps/desktop/src/lib/__tests__/metadata/completionMetadataPolicy.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { usesLocalOnlyEditorCompletionMetadata, usesOnDemandOnlyEditorColumnMetadata } from "@/lib/completionMetadataPolicy"; +import { usesLocalOnlyEditorCompletionMetadata, usesOnDemandOnlyEditorColumnMetadata } from "@/lib/metadata/completionMetadataPolicy"; describe("completionMetadataPolicy", () => { it("keeps Presto-like editor completion on local metadata", () => { diff --git a/apps/desktop/src/lib/__tests__/completionTreeIndex.spec.ts b/apps/desktop/src/lib/__tests__/metadata/completionTreeIndex.spec.ts similarity index 98% rename from apps/desktop/src/lib/__tests__/completionTreeIndex.spec.ts rename to apps/desktop/src/lib/__tests__/metadata/completionTreeIndex.spec.ts index 5458eac9b..a006a4fd3 100644 --- a/apps/desktop/src/lib/__tests__/completionTreeIndex.spec.ts +++ b/apps/desktop/src/lib/__tests__/metadata/completionTreeIndex.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { completionSchemasFromTree, completionTablesFromTree } from "@/lib/completionTreeIndex"; +import { completionSchemasFromTree, completionTablesFromTree } from "@/lib/metadata/completionTreeIndex"; import type { TreeNode } from "@/types/database"; describe("completionTreeIndex", () => { diff --git a/apps/desktop/src/lib/__tests__/mqListPanels.spec.ts b/apps/desktop/src/lib/__tests__/mq/mqListPanels.spec.ts similarity index 95% rename from apps/desktop/src/lib/__tests__/mqListPanels.spec.ts rename to apps/desktop/src/lib/__tests__/mq/mqListPanels.spec.ts index 5f80520f4..4536bc6bf 100644 --- a/apps/desktop/src/lib/__tests__/mqListPanels.spec.ts +++ b/apps/desktop/src/lib/__tests__/mq/mqListPanels.spec.ts @@ -2,7 +2,7 @@ import { readFileSync } from "node:fs"; import { describe, expect, it } from "vitest"; function componentSource(name: string): string { - return readFileSync(new URL(`../../components/mq/${name}`, import.meta.url), "utf8"); + return readFileSync(new URL(`../../../components/mq/${name}`, import.meta.url), "utf8"); } describe("MQ list panels", () => { diff --git a/apps/desktop/src/lib/__tests__/mqPinnedVersionOptions.spec.ts b/apps/desktop/src/lib/__tests__/mq/mqPinnedVersionOptions.spec.ts similarity index 92% rename from apps/desktop/src/lib/__tests__/mqPinnedVersionOptions.spec.ts rename to apps/desktop/src/lib/__tests__/mq/mqPinnedVersionOptions.spec.ts index 7d9bf835e..c8c4e645b 100644 --- a/apps/desktop/src/lib/__tests__/mqPinnedVersionOptions.spec.ts +++ b/apps/desktop/src/lib/__tests__/mq/mqPinnedVersionOptions.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { MQ_PINNED_VERSION_AUTO, MQ_PINNED_VERSION_OPTIONS, pinnedVersionToSelection, selectionToPinnedVersion } from "@/lib/mqPinnedVersionOptions"; +import { MQ_PINNED_VERSION_AUTO, MQ_PINNED_VERSION_OPTIONS, pinnedVersionToSelection, selectionToPinnedVersion } from "@/lib/mq/mqPinnedVersionOptions"; describe("mqPinnedVersionOptions", () => { it("offers auto-detection and the supported Pulsar 3.x profile", () => { diff --git a/apps/desktop/src/lib/__tests__/mqPolicyForms.spec.ts b/apps/desktop/src/lib/__tests__/mq/mqPolicyForms.spec.ts similarity index 98% rename from apps/desktop/src/lib/__tests__/mqPolicyForms.spec.ts rename to apps/desktop/src/lib/__tests__/mq/mqPolicyForms.spec.ts index c38c3b5e4..82a1c406f 100644 --- a/apps/desktop/src/lib/__tests__/mqPolicyForms.spec.ts +++ b/apps/desktop/src/lib/__tests__/mq/mqPolicyForms.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { defaultMqPolicyForms, policyFormsFromEffectivePolicies } from "@/lib/mqPolicyForms"; +import { defaultMqPolicyForms, policyFormsFromEffectivePolicies } from "@/lib/mq/mqPolicyForms"; describe("mqPolicyForms", () => { it("hydrates forms from topic effective policies", () => { diff --git a/apps/desktop/src/lib/__tests__/mqTenantForm.spec.ts b/apps/desktop/src/lib/__tests__/mq/mqTenantForm.spec.ts similarity index 96% rename from apps/desktop/src/lib/__tests__/mqTenantForm.spec.ts rename to apps/desktop/src/lib/__tests__/mq/mqTenantForm.spec.ts index cb120d3d9..c8377ff1f 100644 --- a/apps/desktop/src/lib/__tests__/mqTenantForm.spec.ts +++ b/apps/desktop/src/lib/__tests__/mq/mqTenantForm.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { defaultTenantConfig, mqClusterOptionsFromExtra, validateTenantForm } from "@/lib/mqTenantForm"; +import { defaultTenantConfig, mqClusterOptionsFromExtra, validateTenantForm } from "@/lib/mq/mqTenantForm"; describe("mqTenantForm", () => { it("extracts selectable cluster names from Pulsar cluster info extras", () => { diff --git a/apps/desktop/src/lib/__tests__/mqTokenErrors.spec.ts b/apps/desktop/src/lib/__tests__/mq/mqTokenErrors.spec.ts similarity index 92% rename from apps/desktop/src/lib/__tests__/mqTokenErrors.spec.ts rename to apps/desktop/src/lib/__tests__/mq/mqTokenErrors.spec.ts index 546eaafb2..25f9e6c82 100644 --- a/apps/desktop/src/lib/__tests__/mqTokenErrors.spec.ts +++ b/apps/desktop/src/lib/__tests__/mq/mqTokenErrors.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { formatMqTokenIssueError } from "../mqTokenErrors"; +import { formatMqTokenIssueError } from "@/lib/mq/mqTokenErrors"; describe("MQ token errors", () => { it("turns missing signing configuration backend errors into actionable Chinese copy", () => { diff --git a/apps/desktop/src/lib/__tests__/nacosAdmin.spec.ts b/apps/desktop/src/lib/__tests__/nacos/nacosAdmin.spec.ts similarity index 99% rename from apps/desktop/src/lib/__tests__/nacosAdmin.spec.ts rename to apps/desktop/src/lib/__tests__/nacos/nacosAdmin.spec.ts index 36edee39d..ba9e922f4 100644 --- a/apps/desktop/src/lib/__tests__/nacosAdmin.spec.ts +++ b/apps/desktop/src/lib/__tests__/nacos/nacosAdmin.spec.ts @@ -13,7 +13,7 @@ import { resolveNacosConfigCopyText, sanitizeNacosConfigFileNameSegment, summarizeNacosConfigDiff, -} from "../nacosAdmin"; +} from "@/lib/nacos/nacosAdmin"; describe("nacosAdmin helpers", () => { it("parses raw query and body text", () => { diff --git a/apps/desktop/src/lib/__tests__/queryResultError.spec.ts b/apps/desktop/src/lib/__tests__/query/queryResultError.spec.ts similarity index 95% rename from apps/desktop/src/lib/__tests__/queryResultError.spec.ts rename to apps/desktop/src/lib/__tests__/query/queryResultError.spec.ts index 43263f479..de64be64a 100644 --- a/apps/desktop/src/lib/__tests__/queryResultError.spec.ts +++ b/apps/desktop/src/lib/__tests__/query/queryResultError.spec.ts @@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest"; import type { QueryResult } from "@/types/database"; -import { isNoSnapshotErrorResult } from "@/lib/queryResultError"; +import { isNoSnapshotErrorResult } from "@/lib/query/queryResultError"; function errorResult(message: string): QueryResult { return { columns: ["Error"], rows: [[message]], affected_rows: 0, execution_time_ms: 0 }; diff --git a/apps/desktop/src/lib/__tests__/savedSqlFolderCounts.spec.ts b/apps/desktop/src/lib/__tests__/savedSql/savedSqlFolderCounts.spec.ts similarity index 96% rename from apps/desktop/src/lib/__tests__/savedSqlFolderCounts.spec.ts rename to apps/desktop/src/lib/__tests__/savedSql/savedSqlFolderCounts.spec.ts index 4c810abf4..ead33aca9 100644 --- a/apps/desktop/src/lib/__tests__/savedSqlFolderCounts.spec.ts +++ b/apps/desktop/src/lib/__tests__/savedSql/savedSqlFolderCounts.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { savedSqlFolderBranchFileCount, type SavedSqlFolderCountNode } from "../savedSqlFolderCounts"; +import { savedSqlFolderBranchFileCount, type SavedSqlFolderCountNode } from "@/lib/savedSql/savedSqlFolderCounts"; describe("savedSqlFolderBranchFileCount", () => { const folders: SavedSqlFolderCountNode[] = [{ id: "root" }, { id: "child", parentFolderId: "root" }, { id: "grandchild", parentFolderId: "child" }, { id: "sibling", parentFolderId: "root" }, { id: "other" }]; diff --git a/apps/desktop/src/lib/__tests__/schemaDiffMetadataLoad.spec.ts b/apps/desktop/src/lib/__tests__/schema/schemaDiffMetadataLoad.spec.ts similarity index 97% rename from apps/desktop/src/lib/__tests__/schemaDiffMetadataLoad.spec.ts rename to apps/desktop/src/lib/__tests__/schema/schemaDiffMetadataLoad.spec.ts index 7dcde6ae8..24e0a2447 100644 --- a/apps/desktop/src/lib/__tests__/schemaDiffMetadataLoad.spec.ts +++ b/apps/desktop/src/lib/__tests__/schema/schemaDiffMetadataLoad.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { createConcurrencyLimiter, mapWithConcurrency, schemaDiffMetadataConcurrency } from "@/lib/schemaDiffMetadataLoad"; +import { createConcurrencyLimiter, mapWithConcurrency, schemaDiffMetadataConcurrency } from "@/lib/schema/schemaDiffMetadataLoad"; function wait(ms: number) { return new Promise((resolve) => setTimeout(resolve, ms)); diff --git a/apps/desktop/src/lib/__tests__/sidebarConnectionSelection.spec.ts b/apps/desktop/src/lib/__tests__/sidebar/sidebarConnectionSelection.spec.ts similarity index 95% rename from apps/desktop/src/lib/__tests__/sidebarConnectionSelection.spec.ts rename to apps/desktop/src/lib/__tests__/sidebar/sidebarConnectionSelection.spec.ts index eb2aace8a..7c1068f00 100644 --- a/apps/desktop/src/lib/__tests__/sidebarConnectionSelection.spec.ts +++ b/apps/desktop/src/lib/__tests__/sidebar/sidebarConnectionSelection.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { selectedConnectionDeleteTargets, selectedConnectionDuplicateTargets } from "@/lib/sidebarConnectionSelection"; +import { selectedConnectionDeleteTargets, selectedConnectionDuplicateTargets } from "@/lib/sidebar/sidebarConnectionSelection"; import type { TreeNode } from "@/types/database"; function node(id: string, type: TreeNode["type"] = "connection"): TreeNode { diff --git a/apps/desktop/src/lib/__tests__/sidebarLabelTooltip.spec.ts b/apps/desktop/src/lib/__tests__/sidebar/sidebarLabelTooltip.spec.ts similarity index 97% rename from apps/desktop/src/lib/__tests__/sidebarLabelTooltip.spec.ts rename to apps/desktop/src/lib/__tests__/sidebar/sidebarLabelTooltip.spec.ts index 7857db51f..546e4da99 100644 --- a/apps/desktop/src/lib/__tests__/sidebarLabelTooltip.spec.ts +++ b/apps/desktop/src/lib/__tests__/sidebar/sidebarLabelTooltip.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { shouldMeasureSidebarLabelOverflow } from "@/lib/sidebarLabelTooltip"; +import { shouldMeasureSidebarLabelOverflow } from "@/lib/sidebar/sidebarLabelTooltip"; describe("shouldMeasureSidebarLabelOverflow", () => { it("measures only plain truncated-label tooltip candidates", () => { diff --git a/apps/desktop/src/lib/__tests__/executableStatementRangeCache.spec.ts b/apps/desktop/src/lib/__tests__/sql/executableStatementRangeCache.spec.ts similarity index 98% rename from apps/desktop/src/lib/__tests__/executableStatementRangeCache.spec.ts rename to apps/desktop/src/lib/__tests__/sql/executableStatementRangeCache.spec.ts index 6eca9447e..c55be0d0d 100644 --- a/apps/desktop/src/lib/__tests__/executableStatementRangeCache.spec.ts +++ b/apps/desktop/src/lib/__tests__/sql/executableStatementRangeCache.spec.ts @@ -1,6 +1,6 @@ import { Text } from "@codemirror/state"; import { describe, expect, it, vi } from "vitest"; -import { executableStatementRangeCacheForDoc, executableStatementRangeStartingAt, type ExecutableStatementRangeParser } from "@/lib/executableStatementRangeCache"; +import { executableStatementRangeCacheForDoc, executableStatementRangeStartingAt, type ExecutableStatementRangeParser } from "@/lib/sql/executableStatementRangeCache"; describe("executableStatementRangeCacheForDoc", () => { it("reuses parsed executable statement ranges for the same document and database type", () => { diff --git a/apps/desktop/src/lib/__tests__/sqlSemanticCompletion.spec.ts b/apps/desktop/src/lib/__tests__/sql/semantic/completion.spec.ts similarity index 95% rename from apps/desktop/src/lib/__tests__/sqlSemanticCompletion.spec.ts rename to apps/desktop/src/lib/__tests__/sql/semantic/completion.spec.ts index 8b88c5415..63b1aa641 100644 --- a/apps/desktop/src/lib/__tests__/sqlSemanticCompletion.spec.ts +++ b/apps/desktop/src/lib/__tests__/sql/semantic/completion.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from "vitest"; -import { buildSqlCompletionItemsFromContext, getSqlCompletionContext, type SqlCompletionColumn, type SqlCompletionProviderInput } from "@/lib/sqlCompletion"; -import { sqlCompletionContextFromSemantic, sqlSemanticLocalColumnsByTable } from "@/lib/sqlSemanticCompletion"; -import { buildSqlSemanticModel } from "@/lib/sqlSemanticModel"; -import { sqlFixtureCursor } from "@/lib/sqlSemanticFixtures"; +import { buildSqlCompletionItemsFromContext, getSqlCompletionContext, type SqlCompletionColumn, type SqlCompletionProviderInput } from "@/lib/sql/sqlCompletion"; +import { sqlCompletionContextFromSemantic, sqlSemanticLocalColumnsByTable } from "@/lib/sql/semantic/completion"; +import { buildSqlSemanticModel } from "@/lib/sql/semantic/model"; +import { sqlFixtureCursor } from "@/lib/sql/semantic/fixtures"; import type { DatabaseType } from "@/types/database"; function mergeColumns(...maps: Array | undefined>): Map { diff --git a/apps/desktop/src/lib/__tests__/sqlSemanticDbeaverReferences.md b/apps/desktop/src/lib/__tests__/sql/semantic/dbeaver-references.md similarity index 100% rename from apps/desktop/src/lib/__tests__/sqlSemanticDbeaverReferences.md rename to apps/desktop/src/lib/__tests__/sql/semantic/dbeaver-references.md diff --git a/apps/desktop/src/lib/__tests__/sqlSemanticModel.spec.ts b/apps/desktop/src/lib/__tests__/sql/semantic/model.spec.ts similarity index 98% rename from apps/desktop/src/lib/__tests__/sqlSemanticModel.spec.ts rename to apps/desktop/src/lib/__tests__/sql/semantic/model.spec.ts index 01979cec8..a8f73c159 100644 --- a/apps/desktop/src/lib/__tests__/sqlSemanticModel.spec.ts +++ b/apps/desktop/src/lib/__tests__/sql/semantic/model.spec.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "vitest"; -import { sqlSemanticCompletionScope, sqlSemanticLocalColumnsByTable, sqlSemanticProjectionAliasColumns } from "@/lib/sqlSemanticCompletion"; -import { SQL_SEMANTIC_BASELINE_FIXTURES, sqlFixtureCursor } from "@/lib/sqlSemanticFixtures"; -import { buildSqlSemanticModel } from "@/lib/sqlSemanticModel"; +import { sqlSemanticCompletionScope, sqlSemanticLocalColumnsByTable, sqlSemanticProjectionAliasColumns } from "@/lib/sql/semantic/completion"; +import { SQL_SEMANTIC_BASELINE_FIXTURES, sqlFixtureCursor } from "@/lib/sql/semantic/fixtures"; +import { buildSqlSemanticModel } from "@/lib/sql/semantic/model"; describe("sqlSemanticModel baseline fixtures", () => { for (const fixture of SQL_SEMANTIC_BASELINE_FIXTURES) { diff --git a/apps/desktop/src/lib/__tests__/sqlSemanticReferences.spec.ts b/apps/desktop/src/lib/__tests__/sql/semantic/references.spec.ts similarity index 89% rename from apps/desktop/src/lib/__tests__/sqlSemanticReferences.spec.ts rename to apps/desktop/src/lib/__tests__/sql/semantic/references.spec.ts index 5561573ab..ac93fcc81 100644 --- a/apps/desktop/src/lib/__tests__/sqlSemanticReferences.spec.ts +++ b/apps/desktop/src/lib/__tests__/sql/semantic/references.spec.ts @@ -1,9 +1,9 @@ import { describe, expect, it } from "vitest"; -import { buildSqlSemanticDiagnostics } from "@/lib/sqlSemanticDiagnostics"; -import { buildSqlSemanticModel } from "@/lib/sqlSemanticModel"; -import { sqlFixtureCursor } from "@/lib/sqlSemanticFixtures"; -import { resolveSqlSemanticNavigationTarget, mergeSqlSemanticReferenceAnalysis, sqlSemanticCompletionReferenceTables, sqlSemanticTableReferences } from "@/lib/sqlSemanticReferences"; -import { splitQualifiedIdentifier } from "@/lib/sqlNavigation"; +import { buildSqlSemanticDiagnostics } from "@/lib/sql/semantic/diagnostics"; +import { buildSqlSemanticModel } from "@/lib/sql/semantic/model"; +import { sqlFixtureCursor } from "@/lib/sql/semantic/fixtures"; +import { resolveSqlSemanticNavigationTarget, mergeSqlSemanticReferenceAnalysis, sqlSemanticCompletionReferenceTables, sqlSemanticTableReferences } from "@/lib/sql/semantic/references"; +import { splitQualifiedIdentifier } from "@/lib/sql/sqlNavigation"; import type { SqlReferenceAnalysis } from "@/types/database"; const span = (startColumn: number, endColumn: number) => ({ diff --git a/apps/desktop/src/lib/__tests__/sqlSemanticTokens.spec.ts b/apps/desktop/src/lib/__tests__/sql/semantic/tokens.spec.ts similarity index 98% rename from apps/desktop/src/lib/__tests__/sqlSemanticTokens.spec.ts rename to apps/desktop/src/lib/__tests__/sql/semantic/tokens.spec.ts index 8407e3df5..5b66d99a1 100644 --- a/apps/desktop/src/lib/__tests__/sqlSemanticTokens.spec.ts +++ b/apps/desktop/src/lib/__tests__/sql/semantic/tokens.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { findActiveSqlStatementSpan, isSuppressedSqlSemanticContext, tokenizeSqlSemantic, unquoteSqlSemanticIdentifier } from "@/lib/sqlSemanticTokens"; +import { findActiveSqlStatementSpan, isSuppressedSqlSemanticContext, tokenizeSqlSemantic, unquoteSqlSemanticIdentifier } from "@/lib/sql/semantic/tokens"; describe("sqlSemanticTokens", () => { it("tokenizes comments, strings, quoted identifiers, brackets, and backticks", () => { diff --git a/apps/desktop/src/lib/__tests__/sqlCompletion.context.spec.ts b/apps/desktop/src/lib/__tests__/sql/sqlCompletion.context.spec.ts similarity index 99% rename from apps/desktop/src/lib/__tests__/sqlCompletion.context.spec.ts rename to apps/desktop/src/lib/__tests__/sql/sqlCompletion.context.spec.ts index 01f61f56f..2a953a8ca 100644 --- a/apps/desktop/src/lib/__tests__/sqlCompletion.context.spec.ts +++ b/apps/desktop/src/lib/__tests__/sql/sqlCompletion.context.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { buildSqlCompletionItems, getSqlCompletionContext } from "@/lib/sqlCompletion"; +import { buildSqlCompletionItems, getSqlCompletionContext } from "@/lib/sql/sqlCompletion"; describe("sqlCompletion quoted schema qualifiers", () => { it("parses quoted PostgreSQL schema names before a dot", () => { diff --git a/apps/desktop/src/lib/__tests__/sqlCompletion.snippet.spec.ts b/apps/desktop/src/lib/__tests__/sql/sqlCompletion.snippet.spec.ts similarity index 98% rename from apps/desktop/src/lib/__tests__/sqlCompletion.snippet.spec.ts rename to apps/desktop/src/lib/__tests__/sql/sqlCompletion.snippet.spec.ts index 7e9917a38..7807911e2 100644 --- a/apps/desktop/src/lib/__tests__/sqlCompletion.snippet.spec.ts +++ b/apps/desktop/src/lib/__tests__/sql/sqlCompletion.snippet.spec.ts @@ -1,5 +1,5 @@ import { describe, it, expect } from "vitest"; -import { buildSnippetItemsForTest } from "@/lib/sqlCompletion"; +import { buildSnippetItemsForTest } from "@/lib/sql/sqlCompletion"; import type { SqlSnippet } from "@/types/database"; const TEST_SNIPPETS: SqlSnippet[] = [ diff --git a/apps/desktop/src/lib/__tests__/sqlExecutionTarget.spec.ts b/apps/desktop/src/lib/__tests__/sql/sqlExecutionTarget.spec.ts similarity index 86% rename from apps/desktop/src/lib/__tests__/sqlExecutionTarget.spec.ts rename to apps/desktop/src/lib/__tests__/sql/sqlExecutionTarget.spec.ts index fb4d8f0d8..5725a02c3 100644 --- a/apps/desktop/src/lib/__tests__/sqlExecutionTarget.spec.ts +++ b/apps/desktop/src/lib/__tests__/sql/sqlExecutionTarget.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { resolveExecutableSql } from "../sqlExecutionTarget"; +import { resolveExecutableSql } from "@/lib/sql/sqlExecutionTarget"; describe("resolveExecutableSql", () => { it("uses selected SQL before cursor-mode resolution", () => { diff --git a/apps/desktop/src/lib/__tests__/sqlFormatter.spec.ts b/apps/desktop/src/lib/__tests__/sql/sqlFormatter.spec.ts similarity index 95% rename from apps/desktop/src/lib/__tests__/sqlFormatter.spec.ts rename to apps/desktop/src/lib/__tests__/sql/sqlFormatter.spec.ts index ac1bd32cc..48a27374c 100644 --- a/apps/desktop/src/lib/__tests__/sqlFormatter.spec.ts +++ b/apps/desktop/src/lib/__tests__/sql/sqlFormatter.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { formatSqlForDisplay, formatSqlText, MAX_SQL_FORMAT_CHARS, sqlFormatDialectForDbType } from "@/lib/sqlFormatter"; +import { formatSqlForDisplay, formatSqlText, MAX_SQL_FORMAT_CHARS, sqlFormatDialectForDbType } from "@/lib/sql/sqlFormatter"; describe("sqlFormatter", () => { it("maps PostgreSQL-compatible database types to the postgres formatter dialect", () => { diff --git a/apps/desktop/src/lib/__tests__/sqlFormatterConfig.spec.ts b/apps/desktop/src/lib/__tests__/sql/sqlFormatterConfig.spec.ts similarity index 92% rename from apps/desktop/src/lib/__tests__/sqlFormatterConfig.spec.ts rename to apps/desktop/src/lib/__tests__/sql/sqlFormatterConfig.spec.ts index 8cdfd12de..92314fb7d 100644 --- a/apps/desktop/src/lib/__tests__/sqlFormatterConfig.spec.ts +++ b/apps/desktop/src/lib/__tests__/sql/sqlFormatterConfig.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { DEFAULT_SQL_FORMATTER_SETTINGS, parseSqlFormatterConfig, serializeSqlFormatterConfig } from "@/lib/sqlFormatterConfig"; +import { DEFAULT_SQL_FORMATTER_SETTINGS, parseSqlFormatterConfig, serializeSqlFormatterConfig } from "@/lib/sql/sqlFormatterConfig"; describe("sqlFormatterConfig shortcut storage", () => { it("does not serialize JSON editor shortcut settings", () => { diff --git a/apps/desktop/src/lib/__tests__/sqlHighlighter.spec.ts b/apps/desktop/src/lib/__tests__/sql/sqlHighlighter.spec.ts similarity index 91% rename from apps/desktop/src/lib/__tests__/sqlHighlighter.spec.ts rename to apps/desktop/src/lib/__tests__/sql/sqlHighlighter.spec.ts index 5d731875f..b9c44808d 100644 --- a/apps/desktop/src/lib/__tests__/sqlHighlighter.spec.ts +++ b/apps/desktop/src/lib/__tests__/sql/sqlHighlighter.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from "vitest"; -import { createSafeSqlHighlighter, escapeHtml } from "@/lib/sqlHighlighter"; +import { createSafeSqlHighlighter, escapeHtml } from "@/lib/sql/sqlHighlighter"; describe("escapeHtml", () => { it("escapes SQL text for v-html fallback rendering", () => { diff --git a/apps/desktop/src/lib/__tests__/sqlNavigation.spec.ts b/apps/desktop/src/lib/__tests__/sql/sqlNavigation.spec.ts similarity index 98% rename from apps/desktop/src/lib/__tests__/sqlNavigation.spec.ts rename to apps/desktop/src/lib/__tests__/sql/sqlNavigation.spec.ts index 2a3b3e9ec..2a847952d 100644 --- a/apps/desktop/src/lib/__tests__/sqlNavigation.spec.ts +++ b/apps/desktop/src/lib/__tests__/sql/sqlNavigation.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { extractIdentifierAt, matchTable, splitQualifiedIdentifier } from "@/lib/sqlNavigation"; +import { extractIdentifierAt, matchTable, splitQualifiedIdentifier } from "@/lib/sql/sqlNavigation"; describe("extractIdentifierAt", () => { it("extracts unquoted qualified identifiers", () => { diff --git a/apps/desktop/src/lib/__tests__/sqlParameterHistory.spec.ts b/apps/desktop/src/lib/__tests__/sql/sqlParameterHistory.spec.ts similarity index 96% rename from apps/desktop/src/lib/__tests__/sqlParameterHistory.spec.ts rename to apps/desktop/src/lib/__tests__/sql/sqlParameterHistory.spec.ts index 736cda3ea..cc2bc0006 100644 --- a/apps/desktop/src/lib/__tests__/sqlParameterHistory.spec.ts +++ b/apps/desktop/src/lib/__tests__/sql/sqlParameterHistory.spec.ts @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; -import { loadSqlParameterHistory, MAX_SQL_PARAMETER_HISTORY, rememberSqlParameterValue } from "../sqlParameterHistory"; +import { loadSqlParameterHistory, MAX_SQL_PARAMETER_HISTORY, rememberSqlParameterValue } from "@/lib/sql/sqlParameterHistory"; const storage = new Map(); diff --git a/apps/desktop/src/lib/__tests__/sqlParameters.spec.ts b/apps/desktop/src/lib/__tests__/sql/sqlParameters.spec.ts similarity index 97% rename from apps/desktop/src/lib/__tests__/sqlParameters.spec.ts rename to apps/desktop/src/lib/__tests__/sql/sqlParameters.spec.ts index 25b005454..420a3cf7d 100644 --- a/apps/desktop/src/lib/__tests__/sqlParameters.spec.ts +++ b/apps/desktop/src/lib/__tests__/sql/sqlParameters.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { extractSqlParameters, sqlParameterLiteral, substituteSqlParameters } from "../sqlParameters"; +import { extractSqlParameters, sqlParameterLiteral, substituteSqlParameters } from "@/lib/sql/sqlParameters"; describe("extractSqlParameters", () => { it("extracts unique template parameters in order", () => { diff --git a/apps/desktop/src/lib/__tests__/sqlStatementRanges.spec.ts b/apps/desktop/src/lib/__tests__/sql/sqlStatementRanges.spec.ts similarity index 99% rename from apps/desktop/src/lib/__tests__/sqlStatementRanges.spec.ts rename to apps/desktop/src/lib/__tests__/sql/sqlStatementRanges.spec.ts index 27144534f..344d4fe81 100644 --- a/apps/desktop/src/lib/__tests__/sqlStatementRanges.spec.ts +++ b/apps/desktop/src/lib/__tests__/sql/sqlStatementRanges.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { buildExecutionCandidates, executableStatementRanges, fullSqlRange, hasMultipleExecutionTargets, splitSqlStatementRanges, statementRangeAtCursor, supportsExecutionTargetPicker } from "../sqlStatementRanges"; +import { buildExecutionCandidates, executableStatementRanges, fullSqlRange, hasMultipleExecutionTargets, splitSqlStatementRanges, statementRangeAtCursor, supportsExecutionTargetPicker } from "@/lib/sql/sqlStatementRanges"; function indexOf(sql: string, needle: string, occurrence = 1): number { let from = 0; diff --git a/apps/desktop/src/lib/__tests__/tableDependencySort.spec.ts b/apps/desktop/src/lib/__tests__/table/tableDependencySort.spec.ts similarity index 99% rename from apps/desktop/src/lib/__tests__/tableDependencySort.spec.ts rename to apps/desktop/src/lib/__tests__/table/tableDependencySort.spec.ts index bc72c1ced..d5b76c1c2 100644 --- a/apps/desktop/src/lib/__tests__/tableDependencySort.spec.ts +++ b/apps/desktop/src/lib/__tests__/table/tableDependencySort.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { sortTablesByFkDependency, type TableWithFk } from "@/lib/tableDependencySort"; +import { sortTablesByFkDependency, type TableWithFk } from "@/lib/table/tableDependencySort"; function fk(refTable: string) { return { name: `fk_to_${refTable}`, column: "id", ref_table: refTable, ref_column: "id" }; diff --git a/apps/desktop/src/lib/__tests__/tableEditing.spec.ts b/apps/desktop/src/lib/__tests__/table/tableEditing.spec.ts similarity index 98% rename from apps/desktop/src/lib/__tests__/tableEditing.spec.ts rename to apps/desktop/src/lib/__tests__/table/tableEditing.spec.ts index 00cfa9fbe..696f193eb 100644 --- a/apps/desktop/src/lib/__tests__/tableEditing.spec.ts +++ b/apps/desktop/src/lib/__tests__/table/tableEditing.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { DBX_ROWID_COLUMN, canEditExistingTableRows, canUseKeylessRowPredicate, editablePrimaryKeys, editableRowIdentifierColumns, isClickHouseExistingRowReadonlyColumn, isTableDataEditable, supportsDataGridTransaction } from "@/lib/tableEditing"; +import { DBX_ROWID_COLUMN, canEditExistingTableRows, canUseKeylessRowPredicate, editablePrimaryKeys, editableRowIdentifierColumns, isClickHouseExistingRowReadonlyColumn, isTableDataEditable, supportsDataGridTransaction } from "@/lib/table/tableEditing"; import type { ColumnInfo, IndexInfo } from "@/types/database"; function column(name: string, isPrimaryKey = false): ColumnInfo { diff --git a/apps/desktop/src/lib/__tests__/tableStructureEditorState.spec.ts b/apps/desktop/src/lib/__tests__/table/tableStructureEditorState.spec.ts similarity index 97% rename from apps/desktop/src/lib/__tests__/tableStructureEditorState.spec.ts rename to apps/desktop/src/lib/__tests__/table/tableStructureEditorState.spec.ts index c4027dea1..763c690b0 100644 --- a/apps/desktop/src/lib/__tests__/tableStructureEditorState.spec.ts +++ b/apps/desktop/src/lib/__tests__/table/tableStructureEditorState.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { combineDataTypeForDatabase, createColumnDrafts, dataTypeLengthInputValue, isDataTypeLengthDisabled, isSqlServerIdentityCompatibleDataType, splitDataType } from "../tableStructureEditorState"; +import { combineDataTypeForDatabase, createColumnDrafts, dataTypeLengthInputValue, isDataTypeLengthDisabled, isSqlServerIdentityCompatibleDataType, splitDataType } from "@/lib/table/tableStructureEditorState"; describe("tableStructureEditorState", () => { it("keeps mysql unsigned attributes in the editable base type", () => { diff --git a/apps/desktop/src/lib/__tests__/zookeeperApiContract.spec.ts b/apps/desktop/src/lib/__tests__/zookeeper/zookeeperApiContract.spec.ts similarity index 96% rename from apps/desktop/src/lib/__tests__/zookeeperApiContract.spec.ts rename to apps/desktop/src/lib/__tests__/zookeeper/zookeeperApiContract.spec.ts index 419b673be..b0907c9bc 100644 --- a/apps/desktop/src/lib/__tests__/zookeeperApiContract.spec.ts +++ b/apps/desktop/src/lib/__tests__/zookeeper/zookeeperApiContract.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { zookeeperDelete, zookeeperGet, zookeeperListPrefix, zookeeperPut, type KvListPrefixOptions, type KvPutOptions, type KvPutResponse } from "../api"; +import { zookeeperDelete, zookeeperGet, zookeeperListPrefix, zookeeperPut, type KvListPrefixOptions, type KvPutOptions, type KvPutResponse } from "@/lib/backend/api"; import type { DatabaseType } from "@/types/database"; describe("zookeeper frontend API contract", () => { diff --git a/apps/desktop/src/lib/__tests__/zookeeperConnection.spec.ts b/apps/desktop/src/lib/__tests__/zookeeper/zookeeperConnection.spec.ts similarity index 95% rename from apps/desktop/src/lib/__tests__/zookeeperConnection.spec.ts rename to apps/desktop/src/lib/__tests__/zookeeper/zookeeperConnection.spec.ts index d37ec8b19..3f0e24b19 100644 --- a/apps/desktop/src/lib/__tests__/zookeeperConnection.spec.ts +++ b/apps/desktop/src/lib/__tests__/zookeeper/zookeeperConnection.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { firstZooKeeperEndpoint, normalizeZooKeeperConnectString } from "../zookeeperConnection"; +import { firstZooKeeperEndpoint, normalizeZooKeeperConnectString } from "@/lib/zookeeper/zookeeperConnection"; describe("zookeeperConnection", () => { it("normalizes comma, semicolon, and newline separated connect strings", () => { diff --git a/apps/desktop/src/lib/__tests__/zookeeperLazyKeyTree.spec.ts b/apps/desktop/src/lib/__tests__/zookeeper/zookeeperLazyKeyTree.spec.ts similarity index 95% rename from apps/desktop/src/lib/__tests__/zookeeperLazyKeyTree.spec.ts rename to apps/desktop/src/lib/__tests__/zookeeper/zookeeperLazyKeyTree.spec.ts index 363401240..7d3756b05 100644 --- a/apps/desktop/src/lib/__tests__/zookeeperLazyKeyTree.spec.ts +++ b/apps/desktop/src/lib/__tests__/zookeeper/zookeeperLazyKeyTree.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { createLazyKvKeyTreeState, flattenLazyKvKeyTree, replaceLazyKvChildren, resetLazyKvKeyTree } from "../zookeeperLazyKeyTree"; +import { createLazyKvKeyTreeState, flattenLazyKvKeyTree, replaceLazyKvChildren, resetLazyKvKeyTree } from "@/lib/zookeeper/zookeeperLazyKeyTree"; describe("zookeeper lazy key tree", () => { it("stores only the current path direct children on reset", () => { diff --git a/apps/desktop/src/lib/ai.ts b/apps/desktop/src/lib/ai/ai.ts similarity index 98% rename from apps/desktop/src/lib/ai.ts rename to apps/desktop/src/lib/ai/ai.ts index c33a4b5aa..dbf6def28 100644 --- a/apps/desktop/src/lib/ai.ts +++ b/apps/desktop/src/lib/ai/ai.ts @@ -1,14 +1,14 @@ import type { AiConfig } from "@/stores/settingsStore"; -import { uuid } from "@/lib/utils"; +import { uuid } from "@/lib/common/utils"; import type { ColumnInfo, ConnectionConfig, DatabaseType, ForeignKeyInfo, IndexInfo, QueryResult, QueryTab } from "@/types/database"; -import * as api from "@/lib/api"; +import * as api from "@/lib/backend/api"; import { currentLocale, type Locale } from "@/i18n"; -import { aiTableMentionKey, type AiTableMention } from "@/lib/aiTableMentions"; -import { aiSkillForAction } from "@/lib/aiSkills"; -import { isSchemaAware } from "@/lib/databaseCapabilities"; -import { effectiveDatabaseTypeForConnection } from "@/lib/jdbcDialect"; +import { aiTableMentionKey, type AiTableMention } from "@/lib/ai/aiTableMentions"; +import { aiSkillForAction } from "@/lib/ai/aiSkills"; +import { isSchemaAware } from "@/lib/database/databaseCapabilities"; +import { effectiveDatabaseTypeForConnection } from "@/lib/database/jdbcDialect"; -import type { AgentEvent } from "@/lib/tauri"; +import type { AgentEvent } from "@/lib/backend/tauri"; const VECTOR_DB_TYPES: ReadonlySet = new Set([ "qdrant", diff --git a/apps/desktop/src/lib/aiAgentPlan.ts b/apps/desktop/src/lib/ai/aiAgentPlan.ts similarity index 94% rename from apps/desktop/src/lib/aiAgentPlan.ts rename to apps/desktop/src/lib/ai/aiAgentPlan.ts index 0803f4a63..97198aa77 100644 --- a/apps/desktop/src/lib/aiAgentPlan.ts +++ b/apps/desktop/src/lib/ai/aiAgentPlan.ts @@ -1,5 +1,5 @@ -import type { AiAction, AiAssistantMode } from "@/lib/ai"; -import { classifyAiSqlExecution, shouldAttemptAiAutoExecute, stripAiSqlComments, type AiSqlExecutionDecision } from "@/lib/aiSqlExecutionPolicy"; +import type { AiAction, AiAssistantMode } from "@/lib/ai/ai"; +import { classifyAiSqlExecution, shouldAttemptAiAutoExecute, stripAiSqlComments, type AiSqlExecutionDecision } from "@/lib/ai/aiSqlExecutionPolicy"; import type { ConnectionConfig } from "@/types/database"; export type AiAgentStep = diff --git a/apps/desktop/src/lib/aiAgentStepPresentation.ts b/apps/desktop/src/lib/ai/aiAgentStepPresentation.ts similarity index 98% rename from apps/desktop/src/lib/aiAgentStepPresentation.ts rename to apps/desktop/src/lib/ai/aiAgentStepPresentation.ts index 5e91d191b..d4408b693 100644 --- a/apps/desktop/src/lib/aiAgentStepPresentation.ts +++ b/apps/desktop/src/lib/ai/aiAgentStepPresentation.ts @@ -1,4 +1,4 @@ -import type { AiAgentPlan, AiAgentStep } from "@/lib/aiAgentPlan"; +import type { AiAgentPlan, AiAgentStep } from "@/lib/ai/aiAgentPlan"; export type AiAgentStepTone = "success" | "active" | "warning" | "danger" | "muted"; diff --git a/apps/desktop/src/lib/aiCodeHighlighter.ts b/apps/desktop/src/lib/ai/aiCodeHighlighter.ts similarity index 98% rename from apps/desktop/src/lib/aiCodeHighlighter.ts rename to apps/desktop/src/lib/ai/aiCodeHighlighter.ts index 57c1d4778..920f47d9c 100644 --- a/apps/desktop/src/lib/aiCodeHighlighter.ts +++ b/apps/desktop/src/lib/ai/aiCodeHighlighter.ts @@ -1,4 +1,4 @@ -import type { AppThemeAppearance } from "@/lib/appTheme"; +import type { AppThemeAppearance } from "@/lib/app/appTheme"; export type AiCodeHighlighter = (content: string, lang: string, appearance?: AppThemeAppearance) => string; diff --git a/apps/desktop/src/lib/aiMarkdown.ts b/apps/desktop/src/lib/ai/aiMarkdown.ts similarity index 100% rename from apps/desktop/src/lib/aiMarkdown.ts rename to apps/desktop/src/lib/ai/aiMarkdown.ts diff --git a/apps/desktop/src/lib/aiMessageEdit.ts b/apps/desktop/src/lib/ai/aiMessageEdit.ts similarity index 100% rename from apps/desktop/src/lib/aiMessageEdit.ts rename to apps/desktop/src/lib/ai/aiMessageEdit.ts diff --git a/apps/desktop/src/lib/aiMessageRender.ts b/apps/desktop/src/lib/ai/aiMessageRender.ts similarity index 100% rename from apps/desktop/src/lib/aiMessageRender.ts rename to apps/desktop/src/lib/ai/aiMessageRender.ts diff --git a/apps/desktop/src/lib/aiModelPresentation.ts b/apps/desktop/src/lib/ai/aiModelPresentation.ts similarity index 100% rename from apps/desktop/src/lib/aiModelPresentation.ts rename to apps/desktop/src/lib/ai/aiModelPresentation.ts diff --git a/apps/desktop/src/lib/aiPromptKeyboard.ts b/apps/desktop/src/lib/ai/aiPromptKeyboard.ts similarity index 100% rename from apps/desktop/src/lib/aiPromptKeyboard.ts rename to apps/desktop/src/lib/ai/aiPromptKeyboard.ts diff --git a/apps/desktop/src/lib/aiProposalDetect.ts b/apps/desktop/src/lib/ai/aiProposalDetect.ts similarity index 100% rename from apps/desktop/src/lib/aiProposalDetect.ts rename to apps/desktop/src/lib/ai/aiProposalDetect.ts diff --git a/apps/desktop/src/lib/aiSkills.ts b/apps/desktop/src/lib/ai/aiSkills.ts similarity index 99% rename from apps/desktop/src/lib/aiSkills.ts rename to apps/desktop/src/lib/ai/aiSkills.ts index 77d966dce..b91e75bf9 100644 --- a/apps/desktop/src/lib/aiSkills.ts +++ b/apps/desktop/src/lib/ai/aiSkills.ts @@ -1,4 +1,4 @@ -import type { AiAction } from "@/lib/ai"; +import type { AiAction } from "@/lib/ai/ai"; export type AiSkillRiskPolicy = "readonly" | "readonly_preferred" | "confirmed_write" | "sample_write"; export type AiSkillContextNeed = "currentSql" | "schema" | "indexes" | "foreignKeys" | "lastError" | "lastResultPreview" | "databaseDialect"; diff --git a/apps/desktop/src/lib/aiSqlExecutionPolicy.ts b/apps/desktop/src/lib/ai/aiSqlExecutionPolicy.ts similarity index 100% rename from apps/desktop/src/lib/aiSqlExecutionPolicy.ts rename to apps/desktop/src/lib/ai/aiSqlExecutionPolicy.ts diff --git a/apps/desktop/src/lib/aiTableMentions.ts b/apps/desktop/src/lib/ai/aiTableMentions.ts similarity index 100% rename from apps/desktop/src/lib/aiTableMentions.ts rename to apps/desktop/src/lib/ai/aiTableMentions.ts diff --git a/apps/desktop/src/lib/appFonts.ts b/apps/desktop/src/lib/app/appFonts.ts similarity index 100% rename from apps/desktop/src/lib/appFonts.ts rename to apps/desktop/src/lib/app/appFonts.ts diff --git a/apps/desktop/src/lib/appTheme.ts b/apps/desktop/src/lib/app/appTheme.ts similarity index 100% rename from apps/desktop/src/lib/appTheme.ts rename to apps/desktop/src/lib/app/appTheme.ts diff --git a/apps/desktop/src/lib/documentStoreProvider.ts b/apps/desktop/src/lib/app/documentStoreProvider.ts similarity index 98% rename from apps/desktop/src/lib/documentStoreProvider.ts rename to apps/desktop/src/lib/app/documentStoreProvider.ts index 7826afc62..e9de31ecf 100644 --- a/apps/desktop/src/lib/documentStoreProvider.ts +++ b/apps/desktop/src/lib/app/documentStoreProvider.ts @@ -1,7 +1,7 @@ import type { ComposerTranslation } from "vue-i18n"; import type { DatabaseType } from "@/types/database"; -import { quoteUnquotedObjectKeys } from "@/lib/mongoShellCommand"; -import { formatMongoShellLiteral } from "@/lib/mongoDocumentValues"; +import { quoteUnquotedObjectKeys } from "@/lib/mongo/mongoShellCommand"; +import { formatMongoShellLiteral } from "@/lib/mongo/mongoDocumentValues"; export type DocumentStoreKind = "mongodb" | "elasticsearch"; export type DocumentFilterMode = "equals" | "not-equals" | "like" | "not-like" | "greater-than" | "less-than" | "is-null" | "is-not-null"; diff --git a/apps/desktop/src/lib/localeOptions.ts b/apps/desktop/src/lib/app/localeOptions.ts similarity index 100% rename from apps/desktop/src/lib/localeOptions.ts rename to apps/desktop/src/lib/app/localeOptions.ts diff --git a/apps/desktop/src/lib/openTabsPersistence.ts b/apps/desktop/src/lib/app/openTabsPersistence.ts similarity index 100% rename from apps/desktop/src/lib/openTabsPersistence.ts rename to apps/desktop/src/lib/app/openTabsPersistence.ts diff --git a/apps/desktop/src/lib/pinnedItems.ts b/apps/desktop/src/lib/app/pinnedItems.ts similarity index 100% rename from apps/desktop/src/lib/pinnedItems.ts rename to apps/desktop/src/lib/app/pinnedItems.ts diff --git a/apps/desktop/src/lib/pinnedTreeNodeIds.ts b/apps/desktop/src/lib/app/pinnedTreeNodeIds.ts similarity index 100% rename from apps/desktop/src/lib/pinnedTreeNodeIds.ts rename to apps/desktop/src/lib/app/pinnedTreeNodeIds.ts diff --git a/apps/desktop/src/lib/transferProgressState.ts b/apps/desktop/src/lib/app/transferProgressState.ts similarity index 100% rename from apps/desktop/src/lib/transferProgressState.ts rename to apps/desktop/src/lib/app/transferProgressState.ts diff --git a/apps/desktop/src/lib/api.ts b/apps/desktop/src/lib/backend/api.ts similarity index 98% rename from apps/desktop/src/lib/api.ts rename to apps/desktop/src/lib/backend/api.ts index b1bc62846..877b99615 100644 --- a/apps/desktop/src/lib/api.ts +++ b/apps/desktop/src/lib/backend/api.ts @@ -1,6 +1,6 @@ -import { isTauriRuntime } from "./tauriRuntime"; -import type * as TauriModule from "./tauri"; -import { appendDebugLog } from "./debugLog"; +import { isTauriRuntime } from "@/lib/backend/tauriRuntime"; +import type * as TauriModule from "@/lib/backend/tauri"; +import { appendDebugLog } from "@/lib/backend/debugLog"; // --------------------------------------------------------------------------- // Lazy backend resolution (avoids top-level await) @@ -12,7 +12,7 @@ let _backend: Backend | null = null; async function getBackend(): Promise { if (_backend) return _backend; - _backend = isTauriRuntime(globalThis) ? await import("./tauri") : await import("./http"); + _backend = isTauriRuntime(globalThis) ? await import("@/lib/backend/tauri") : await import("@/lib/backend/http"); return _backend; } @@ -501,4 +501,4 @@ export type { TableExportRequest, QueryResultExportRequest, AgentEvent, -} from "./tauri"; +} from "@/lib/backend/tauri"; diff --git a/apps/desktop/src/lib/configCrypto.ts b/apps/desktop/src/lib/backend/configCrypto.ts similarity index 97% rename from apps/desktop/src/lib/configCrypto.ts rename to apps/desktop/src/lib/backend/configCrypto.ts index d9a5c8c35..88711cdfa 100644 --- a/apps/desktop/src/lib/configCrypto.ts +++ b/apps/desktop/src/lib/backend/configCrypto.ts @@ -79,9 +79,9 @@ export async function decryptConfig(payload: EncryptedPayload, passphrase: strin key = await deriveKey(passphrase, salt); } catch (error) { if (error instanceof Error && error.message === CONFIG_CRYPTO_UNAVAILABLE) { - const { isTauriRuntime } = await import("@/lib/tauriRuntime"); + const { isTauriRuntime } = await import("@/lib/backend/tauriRuntime"); if (!isTauriRuntime(globalThis)) { - const { decryptConfig: decryptConfigOnBackend } = await import("@/lib/api"); + const { decryptConfig: decryptConfigOnBackend } = await import("@/lib/backend/api"); return decryptConfigOnBackend(payload, passphrase); } } diff --git a/apps/desktop/src/lib/connectionTransport.ts b/apps/desktop/src/lib/backend/connectionTransport.ts similarity index 100% rename from apps/desktop/src/lib/connectionTransport.ts rename to apps/desktop/src/lib/backend/connectionTransport.ts diff --git a/apps/desktop/src/lib/debugLog.ts b/apps/desktop/src/lib/backend/debugLog.ts similarity index 100% rename from apps/desktop/src/lib/debugLog.ts rename to apps/desktop/src/lib/backend/debugLog.ts diff --git a/apps/desktop/src/lib/errorUtils.ts b/apps/desktop/src/lib/backend/errorUtils.ts similarity index 100% rename from apps/desktop/src/lib/errorUtils.ts rename to apps/desktop/src/lib/backend/errorUtils.ts diff --git a/apps/desktop/src/lib/http.ts b/apps/desktop/src/lib/backend/http.ts similarity index 97% rename from apps/desktop/src/lib/http.ts rename to apps/desktop/src/lib/backend/http.ts index 794d5b168..693799e65 100644 --- a/apps/desktop/src/lib/http.ts +++ b/apps/desktop/src/lib/backend/http.ts @@ -31,8 +31,8 @@ import type { SavedSqlLibrary, } from "@/types/database"; import type { CollectionInfo } from "@/types/database"; -import type { SchemaDiffPreparation, SchemaDiffPreparationOptions, TableDiff, FunctionDiff, SequenceDiff, RuleDiff, OwnerDiff } from "@/lib/schemaDiff"; -import type { SidebarObjectKind } from "@/lib/databaseObjectCapabilities"; +import type { SchemaDiffPreparation, SchemaDiffPreparationOptions, TableDiff, FunctionDiff, SequenceDiff, RuleDiff, OwnerDiff } from "@/lib/schema/schemaDiff"; +import type { SidebarObjectKind } from "@/lib/database/databaseObjectCapabilities"; import type { AiConfig, AiTestConnectionResult } from "@/stores/settingsStore"; import type { AgentDriverInfo, @@ -91,8 +91,8 @@ import type { ExplainSqlBuildResult, DroppedFilePreviewSqlOptions, MongoGridFsFileInfo, -} from "./tauri"; -import type { QueryEditability } from "@/lib/sqlAnalysis"; +} from "@/lib/backend/tauri"; +import type { QueryEditability } from "@/lib/sql/sqlAnalysis"; import type { DataGridColumnDistinctValuesSqlOptions, DataGridColumnValueFilterConditionOptions, @@ -103,19 +103,19 @@ import type { DataGridCopyUpdateStatementOptions, DataGridSaveStatementOptions, HiveTablePropertiesSqlOptions, -} from "@/lib/dataGridSql"; -import type { BuildTableStructureChangeSqlOptions, BuildSingleColumnAlterSqlOptions, TableStructureChangeSql } from "@/lib/tableStructureEditorSql"; -import type { BuildTableSelectSqlOptions } from "@/lib/tableSelectSql"; -import type { DatabaseSearchSql, DatabaseSearchSqlOptions, SearchResultWhereOptions } from "@/lib/databaseSearch"; -import type { BuildEditableObjectSourceSqlInput, BuildRoutineRenameObjectSourceInput } from "@/lib/objectSourceEditor"; -import type { BuildViewDdlInput } from "@/lib/viewDdl"; -import type { BuildRenameObjectSqlOptions } from "@/lib/objectRenameSql"; -import type { CreateDatabaseSqlOptions } from "@/lib/createDatabaseSql"; -import type { DatabaseNameSqlOptions, DropTableChildObjectSqlOptions, DropObjectSqlOptions, DuplicateTableStructureSqlOptions, CopyTableDataSqlOptions, SchemaNameSqlOptions, TableAdminSqlOptions } from "@/lib/dbAdminSql"; -import type { BuildDatabaseSqlExportOptions, BuildExportInsertStatementsOptions } from "@/lib/databaseExport"; -import type { DataCompareFromTablesOptions, DataCompareFromTablesPreparation, DataCompareSyncPlan, DataCompareSyncPlanOptions, DataComparePreparation, DataComparePreparationOptions } from "@/lib/dataCompare"; -import { apiUrl, apiWebSocketUrl } from "@/lib/webPath"; -import type { DataGridSavePreparation } from "./tauri"; +} from "@/lib/dataGrid/dataGridSql"; +import type { BuildTableStructureChangeSqlOptions, BuildSingleColumnAlterSqlOptions, TableStructureChangeSql } from "@/lib/table/tableStructureEditorSql"; +import type { BuildTableSelectSqlOptions } from "@/lib/table/tableSelectSql"; +import type { DatabaseSearchSql, DatabaseSearchSqlOptions, SearchResultWhereOptions } from "@/lib/database/databaseSearch"; +import type { BuildEditableObjectSourceSqlInput, BuildRoutineRenameObjectSourceInput } from "@/lib/table/objectSourceEditor"; +import type { BuildViewDdlInput } from "@/lib/table/viewDdl"; +import type { BuildRenameObjectSqlOptions } from "@/lib/table/objectRenameSql"; +import type { CreateDatabaseSqlOptions } from "@/lib/database/createDatabaseSql"; +import type { DatabaseNameSqlOptions, DropTableChildObjectSqlOptions, DropObjectSqlOptions, DuplicateTableStructureSqlOptions, CopyTableDataSqlOptions, SchemaNameSqlOptions, TableAdminSqlOptions } from "@/lib/database/dbAdminSql"; +import type { BuildDatabaseSqlExportOptions, BuildExportInsertStatementsOptions } from "@/lib/export/databaseExport"; +import type { DataCompareFromTablesOptions, DataCompareFromTablesPreparation, DataCompareSyncPlan, DataCompareSyncPlanOptions, DataComparePreparation, DataComparePreparationOptions } from "@/lib/dataGrid/dataCompare"; +import { apiUrl, apiWebSocketUrl } from "@/lib/common/webPath"; +import type { DataGridSavePreparation } from "@/lib/backend/tauri"; import type { NacosConfigHistoryKey, NacosConfigHistoryList, @@ -138,7 +138,7 @@ import type { NacosServiceList, NacosServiceQuery, } from "@/types/nacos"; -import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/safeStorage"; +import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/backend/safeStorage"; // --------------------------------------------------------------------------- // Helpers @@ -879,7 +879,7 @@ export async function prepareDataCompareFromTables(options: DataCompareFromTable return post("/api/data-compare/prepare-from-tables", options); } -export async function prepareDataCompareMissingTarget(options: import("@/lib/dataCompare").DataCompareMissingTargetOptions): Promise { +export async function prepareDataCompareMissingTarget(options: import("@/lib/dataGrid/dataCompare").DataCompareMissingTargetOptions): Promise { return post("/api/data-compare/prepare-missing-target", options); } @@ -944,13 +944,13 @@ export async function aiListModels(config: AiConfig): Promise { return post("/api/ai/models", { config }); } -export type { AgentEvent } from "./tauri"; +export type { AgentEvent } from "@/lib/backend/tauri"; -function isAgentEvent(v: unknown): v is import("./tauri").AgentEvent { +function isAgentEvent(v: unknown): v is import("@/lib/backend/tauri").AgentEvent { return typeof v === "object" && v !== null && "type" in v && typeof (v as Record).type === "string"; } -export async function aiAgentStream(sessionId: string, request: AiCompletionRequest, connectionId: string, database: string, dbType: string, onEvent: (event: import("./tauri").AgentEvent) => void, mode?: string, signal?: AbortSignal): Promise { +export async function aiAgentStream(sessionId: string, request: AiCompletionRequest, connectionId: string, database: string, dbType: string, onEvent: (event: import("@/lib/backend/tauri").AgentEvent) => void, mode?: string, signal?: AbortSignal): Promise { const res = await fetch(apiUrl("/api/ai/agent-stream"), { method: "POST", headers: { "Content-Type": "application/json" }, @@ -1459,7 +1459,7 @@ export async function cancelQueryResultExport(exportId: string, executionId?: st } export async function exportQueryResultCsv(filePath: string, columns: string[], rows: readonly (readonly XlsxCellValue[])[]): Promise { - const { formatCsv } = await import("./exportFormats"); + const { formatCsv } = await import("@/lib/export/exportFormats"); const content = formatCsv(columns, rows as (string | number | boolean | null)[][]); const fileName = filePath.split(/[\\/]/).pop() || "export.csv"; const blob = new Blob(["\uFEFF", content], { type: "text/csv;charset=utf-8" }); @@ -1487,7 +1487,7 @@ function downloadTextFile(filePath: string, fallbackFileName: string, content: s } export async function exportQueryResultXlsx(filePath: string, sheetName: string | undefined, columns: string[], rows: readonly (readonly XlsxCellValue[])[]): Promise { - const { buildXlsxWorkbook } = await import("./xlsxExport"); + const { buildXlsxWorkbook } = await import("@/lib/export/xlsxExport"); const workbook = buildXlsxWorkbook({ sheetName: sheetName || "Export", columns, @@ -1506,7 +1506,7 @@ export async function exportQueryResultXlsx(filePath: string, sheetName: string } export async function exportQueryResultsXlsx(filePath: string, worksheets: readonly { sheetName?: string; columns: string[]; rows: readonly (readonly XlsxCellValue[])[] }[]): Promise { - const { buildXlsxWorkbookMulti } = await import("./xlsxExport"); + const { buildXlsxWorkbookMulti } = await import("@/lib/export/xlsxExport"); const workbook = buildXlsxWorkbookMulti(worksheets); const fileName = filePath.split(/[\\/]/).pop() || "export.xlsx"; const blob = new Blob([new Uint8Array(workbook)], { @@ -1945,7 +1945,7 @@ export async function checkForUpdates(): Promise { return get("/api/update/check"); } -export async function checkMcpServerStatus(): Promise { +export async function checkMcpServerStatus(): Promise { return { installed: false, npm_available: false, @@ -1995,4 +1995,4 @@ export async function refreshConnections(): Promise { // Web mode doesn't maintain persistent connection pools - no-op } -export * from "./mq-http"; +export * from "@/lib/backend/mq-http"; diff --git a/apps/desktop/src/lib/mq-http.ts b/apps/desktop/src/lib/backend/mq-http.ts similarity index 99% rename from apps/desktop/src/lib/mq-http.ts rename to apps/desktop/src/lib/backend/mq-http.ts index 54fa0b21b..e09c5f337 100644 --- a/apps/desktop/src/lib/mq-http.ts +++ b/apps/desktop/src/lib/backend/mq-http.ts @@ -1,5 +1,5 @@ // HTTP fetch API for message queue admin (web mode) -import { apiUrl } from "@/lib/webPath"; +import { apiUrl } from "@/lib/common/webPath"; import type { MqClusterInfo, ClusterInfo, diff --git a/apps/desktop/src/lib/mq-tauri.ts b/apps/desktop/src/lib/backend/mq-tauri.ts similarity index 100% rename from apps/desktop/src/lib/mq-tauri.ts rename to apps/desktop/src/lib/backend/mq-tauri.ts diff --git a/apps/desktop/src/lib/nacos-tauri.ts b/apps/desktop/src/lib/backend/nacos-tauri.ts similarity index 100% rename from apps/desktop/src/lib/nacos-tauri.ts rename to apps/desktop/src/lib/backend/nacos-tauri.ts diff --git a/apps/desktop/src/lib/platform.ts b/apps/desktop/src/lib/backend/platform.ts similarity index 100% rename from apps/desktop/src/lib/platform.ts rename to apps/desktop/src/lib/backend/platform.ts diff --git a/apps/desktop/src/lib/safeStorage.ts b/apps/desktop/src/lib/backend/safeStorage.ts similarity index 100% rename from apps/desktop/src/lib/safeStorage.ts rename to apps/desktop/src/lib/backend/safeStorage.ts diff --git a/apps/desktop/src/lib/tauri.ts b/apps/desktop/src/lib/backend/tauri.ts similarity index 98% rename from apps/desktop/src/lib/tauri.ts rename to apps/desktop/src/lib/backend/tauri.ts index c7b63ebb2..41f81af92 100644 --- a/apps/desktop/src/lib/tauri.ts +++ b/apps/desktop/src/lib/backend/tauri.ts @@ -32,9 +32,9 @@ import type { SavedSqlLibrary, } from "@/types/database"; import type { CollectionInfo } from "@/types/database"; -import type { SidebarObjectKind } from "@/lib/databaseObjectCapabilities"; +import type { SidebarObjectKind } from "@/lib/database/databaseObjectCapabilities"; import type { AiConfig, AiTestConnectionResult } from "@/stores/settingsStore"; -import type { QueryEditability } from "@/lib/sqlAnalysis"; +import type { QueryEditability } from "@/lib/sql/sqlAnalysis"; import type { DataGridColumnDistinctValuesSqlOptions, DataGridColumnValueFilterConditionOptions, @@ -45,18 +45,18 @@ import type { DataGridCopyUpdateStatementOptions, DataGridSaveStatementOptions, HiveTablePropertiesSqlOptions, -} from "@/lib/dataGridSql"; -import type { DataCompareFromTablesOptions, DataCompareFromTablesPreparation, DataCompareSyncPlan, DataCompareSyncPlanOptions, DataComparePreparation, DataComparePreparationOptions } from "@/lib/dataCompare"; -import type { SchemaDiffPreparation, SchemaDiffPreparationOptions, TableDiff, FunctionDiff, SequenceDiff, RuleDiff, OwnerDiff } from "@/lib/schemaDiff"; -import type { BuildTableStructureChangeSqlOptions, BuildSingleColumnAlterSqlOptions, TableStructureChangeSql } from "@/lib/tableStructureEditorSql"; -import type { BuildTableSelectSqlOptions } from "@/lib/tableSelectSql"; -import type { DatabaseSearchSql, DatabaseSearchSqlOptions, SearchResultWhereOptions } from "@/lib/databaseSearch"; -import type { BuildEditableObjectSourceSqlInput, BuildRoutineRenameObjectSourceInput } from "@/lib/objectSourceEditor"; -import type { BuildViewDdlInput } from "@/lib/viewDdl"; -import type { BuildRenameObjectSqlOptions } from "@/lib/objectRenameSql"; -import type { CreateDatabaseSqlOptions } from "@/lib/createDatabaseSql"; -import type { DatabaseNameSqlOptions, DropTableChildObjectSqlOptions, DropObjectSqlOptions, DuplicateTableStructureSqlOptions, CopyTableDataSqlOptions, SchemaNameSqlOptions, TableAdminSqlOptions } from "@/lib/dbAdminSql"; -import type { BuildDatabaseSqlExportOptions, BuildExportInsertStatementsOptions } from "@/lib/databaseExport"; +} from "@/lib/dataGrid/dataGridSql"; +import type { DataCompareFromTablesOptions, DataCompareFromTablesPreparation, DataCompareSyncPlan, DataCompareSyncPlanOptions, DataComparePreparation, DataComparePreparationOptions } from "@/lib/dataGrid/dataCompare"; +import type { SchemaDiffPreparation, SchemaDiffPreparationOptions, TableDiff, FunctionDiff, SequenceDiff, RuleDiff, OwnerDiff } from "@/lib/schema/schemaDiff"; +import type { BuildTableStructureChangeSqlOptions, BuildSingleColumnAlterSqlOptions, TableStructureChangeSql } from "@/lib/table/tableStructureEditorSql"; +import type { BuildTableSelectSqlOptions } from "@/lib/table/tableSelectSql"; +import type { DatabaseSearchSql, DatabaseSearchSqlOptions, SearchResultWhereOptions } from "@/lib/database/databaseSearch"; +import type { BuildEditableObjectSourceSqlInput, BuildRoutineRenameObjectSourceInput } from "@/lib/table/objectSourceEditor"; +import type { BuildViewDdlInput } from "@/lib/table/viewDdl"; +import type { BuildRenameObjectSqlOptions } from "@/lib/table/objectRenameSql"; +import type { CreateDatabaseSqlOptions } from "@/lib/database/createDatabaseSql"; +import type { DatabaseNameSqlOptions, DropTableChildObjectSqlOptions, DropObjectSqlOptions, DuplicateTableStructureSqlOptions, CopyTableDataSqlOptions, SchemaNameSqlOptions, TableAdminSqlOptions } from "@/lib/database/dbAdminSql"; +import type { BuildDatabaseSqlExportOptions, BuildExportInsertStatementsOptions } from "@/lib/export/databaseExport"; export interface AgentDriverInfo { db_type: string; @@ -886,7 +886,7 @@ export async function prepareDataCompareFromTables(options: DataCompareFromTable return invoke("prepare_data_compare_from_tables", { options }); } -export async function prepareDataCompareMissingTarget(options: import("@/lib/dataCompare").DataCompareMissingTargetOptions): Promise { +export async function prepareDataCompareMissingTarget(options: import("@/lib/dataGrid/dataCompare").DataCompareMissingTargetOptions): Promise { return invoke("prepare_data_compare_missing_target", { options }); } @@ -960,7 +960,7 @@ export async function readKeychainPasswords(services: string[]): Promise<[string } export async function decryptConfig(payload: unknown, passphrase: string): Promise { - const { decryptConfig: decryptConfigPayload } = await import("@/lib/configCrypto"); + const { decryptConfig: decryptConfigPayload } = await import("@/lib/backend/configCrypto"); return decryptConfigPayload(payload as any, passphrase); } @@ -2156,5 +2156,5 @@ export async function exportQueryResultMarkdown(filePath: string, columns: strin }); } -export * from "./mq-tauri"; -export * from "./nacos-tauri"; +export * from "@/lib/backend/mq-tauri"; +export * from "@/lib/backend/nacos-tauri"; diff --git a/apps/desktop/src/lib/tauriRuntime.ts b/apps/desktop/src/lib/backend/tauriRuntime.ts similarity index 100% rename from apps/desktop/src/lib/tauriRuntime.ts rename to apps/desktop/src/lib/backend/tauriRuntime.ts diff --git a/apps/desktop/src/lib/clipboard.ts b/apps/desktop/src/lib/common/clipboard.ts similarity index 98% rename from apps/desktop/src/lib/clipboard.ts rename to apps/desktop/src/lib/common/clipboard.ts index 6c3e94fd6..f4ba38b3e 100644 --- a/apps/desktop/src/lib/clipboard.ts +++ b/apps/desktop/src/lib/common/clipboard.ts @@ -1,4 +1,4 @@ -import { isTauriRuntime } from "./tauriRuntime"; +import { isTauriRuntime } from "@/lib/backend/tauriRuntime"; interface ClipboardApi { readText?: () => Promise | string; diff --git a/apps/desktop/src/lib/color.ts b/apps/desktop/src/lib/common/color.ts similarity index 100% rename from apps/desktop/src/lib/color.ts rename to apps/desktop/src/lib/common/color.ts diff --git a/apps/desktop/src/lib/jsonCopyValue.ts b/apps/desktop/src/lib/common/jsonCopyValue.ts similarity index 100% rename from apps/desktop/src/lib/jsonCopyValue.ts rename to apps/desktop/src/lib/common/jsonCopyValue.ts diff --git a/apps/desktop/src/lib/searchPattern.ts b/apps/desktop/src/lib/common/searchPattern.ts similarity index 100% rename from apps/desktop/src/lib/searchPattern.ts rename to apps/desktop/src/lib/common/searchPattern.ts diff --git a/apps/desktop/src/lib/ttlFormat.ts b/apps/desktop/src/lib/common/ttlFormat.ts similarity index 100% rename from apps/desktop/src/lib/ttlFormat.ts rename to apps/desktop/src/lib/common/ttlFormat.ts diff --git a/apps/desktop/src/lib/utils.ts b/apps/desktop/src/lib/common/utils.ts similarity index 100% rename from apps/desktop/src/lib/utils.ts rename to apps/desktop/src/lib/common/utils.ts diff --git a/apps/desktop/src/lib/webPath.ts b/apps/desktop/src/lib/common/webPath.ts similarity index 100% rename from apps/desktop/src/lib/webPath.ts rename to apps/desktop/src/lib/common/webPath.ts diff --git a/apps/desktop/src/lib/actionActivation.ts b/apps/desktop/src/lib/connection/actionActivation.ts similarity index 100% rename from apps/desktop/src/lib/actionActivation.ts rename to apps/desktop/src/lib/connection/actionActivation.ts diff --git a/apps/desktop/src/lib/agentDriverInstallHint.ts b/apps/desktop/src/lib/connection/agentDriverInstallHint.ts similarity index 95% rename from apps/desktop/src/lib/agentDriverInstallHint.ts rename to apps/desktop/src/lib/connection/agentDriverInstallHint.ts index 2477c88ae..7318dfe34 100644 --- a/apps/desktop/src/lib/agentDriverInstallHint.ts +++ b/apps/desktop/src/lib/connection/agentDriverInstallHint.ts @@ -1,5 +1,5 @@ import type { DatabaseType } from "@/types/database"; -import { supportsDriverManagement } from "./databaseCapabilities"; +import { supportsDriverManagement } from "@/lib/database/databaseCapabilities"; export interface AgentDriverInstallState { db_type: string; diff --git a/apps/desktop/src/lib/agentDriverUpdateBadge.ts b/apps/desktop/src/lib/connection/agentDriverUpdateBadge.ts similarity index 100% rename from apps/desktop/src/lib/agentDriverUpdateBadge.ts rename to apps/desktop/src/lib/connection/agentDriverUpdateBadge.ts diff --git a/apps/desktop/src/lib/connectionAttemptTimeout.ts b/apps/desktop/src/lib/connection/connectionAttemptTimeout.ts similarity index 100% rename from apps/desktop/src/lib/connectionAttemptTimeout.ts rename to apps/desktop/src/lib/connection/connectionAttemptTimeout.ts diff --git a/apps/desktop/src/lib/connectionDeepLink.ts b/apps/desktop/src/lib/connection/connectionDeepLink.ts similarity index 99% rename from apps/desktop/src/lib/connectionDeepLink.ts rename to apps/desktop/src/lib/connection/connectionDeepLink.ts index 9a6cba0d5..4c28c611b 100644 --- a/apps/desktop/src/lib/connectionDeepLink.ts +++ b/apps/desktop/src/lib/connection/connectionDeepLink.ts @@ -1,5 +1,5 @@ import type { DatabaseType } from "@/types/database"; -import { connectionProfileForScheme, parseConnectionUrl } from "@/lib/connectionUrl"; +import { connectionProfileForScheme, parseConnectionUrl } from "@/lib/connection/connectionUrl"; export interface ConnectionDeepLinkDraft { name?: string; diff --git a/apps/desktop/src/lib/connectionFile.ts b/apps/desktop/src/lib/connection/connectionFile.ts similarity index 97% rename from apps/desktop/src/lib/connectionFile.ts rename to apps/desktop/src/lib/connection/connectionFile.ts index 4a0f57a05..843668c57 100644 --- a/apps/desktop/src/lib/connectionFile.ts +++ b/apps/desktop/src/lib/connection/connectionFile.ts @@ -1,5 +1,5 @@ import type { ConnectionConfig, DatabaseType } from "@/types/database"; -import { h2FilePathFromJdbcUrl } from "@/lib/h2Connection"; +import { h2FilePathFromJdbcUrl } from "@/lib/database/h2Connection"; /** * Whether the database type is one that (potentially) backs onto a local file. diff --git a/apps/desktop/src/lib/connectionHealth.ts b/apps/desktop/src/lib/connection/connectionHealth.ts similarity index 100% rename from apps/desktop/src/lib/connectionHealth.ts rename to apps/desktop/src/lib/connection/connectionHealth.ts diff --git a/apps/desktop/src/lib/connectionLevelDatabaseBootstrap.ts b/apps/desktop/src/lib/connection/connectionLevelDatabaseBootstrap.ts similarity index 97% rename from apps/desktop/src/lib/connectionLevelDatabaseBootstrap.ts rename to apps/desktop/src/lib/connection/connectionLevelDatabaseBootstrap.ts index 3fb8b8ebf..f8a7065e2 100644 --- a/apps/desktop/src/lib/connectionLevelDatabaseBootstrap.ts +++ b/apps/desktop/src/lib/connection/connectionLevelDatabaseBootstrap.ts @@ -1,5 +1,5 @@ -import { splitSqlStatementRanges } from "@/lib/sqlStatementRanges"; -import { supportsCreateDatabaseCharset } from "@/lib/createDatabaseSql"; +import { splitSqlStatementRanges } from "@/lib/sql/sqlStatementRanges"; +import { supportsCreateDatabaseCharset } from "@/lib/database/createDatabaseSql"; import type { ConnectionConfig, DatabaseType } from "@/types/database"; const MYSQL_BOOTSTRAP_EXTRA_PROFILES = new Set(["selectdb", "goldendb"]); diff --git a/apps/desktop/src/lib/connectionOpenTarget.ts b/apps/desktop/src/lib/connection/connectionOpenTarget.ts similarity index 89% rename from apps/desktop/src/lib/connectionOpenTarget.ts rename to apps/desktop/src/lib/connection/connectionOpenTarget.ts index 4fb680614..77270bc25 100644 --- a/apps/desktop/src/lib/connectionOpenTarget.ts +++ b/apps/desktop/src/lib/connection/connectionOpenTarget.ts @@ -1,5 +1,5 @@ import type { ConnectionConfig } from "@/types/database"; -import { resolveDefaultDatabase } from "@/lib/defaultDatabase"; +import { resolveDefaultDatabase } from "@/lib/database/defaultDatabase"; export type QuickConnectionOpenTarget = { kind: "mq-admin" } | { kind: "nacos-admin" } | { kind: "query"; database: string }; diff --git a/apps/desktop/src/lib/connectionPresentation.ts b/apps/desktop/src/lib/connection/connectionPresentation.ts similarity index 100% rename from apps/desktop/src/lib/connectionPresentation.ts rename to apps/desktop/src/lib/connection/connectionPresentation.ts diff --git a/apps/desktop/src/lib/connectionUrl.ts b/apps/desktop/src/lib/connection/connectionUrl.ts similarity index 99% rename from apps/desktop/src/lib/connectionUrl.ts rename to apps/desktop/src/lib/connection/connectionUrl.ts index 91d40508b..f8d0a56d4 100644 --- a/apps/desktop/src/lib/connectionUrl.ts +++ b/apps/desktop/src/lib/connection/connectionUrl.ts @@ -1,5 +1,5 @@ import type { ConnectionConfig, DatabaseType } from "@/types/database"; -import { h2JdbcUrlHasPasswordParam, h2JdbcUrlHasUserParam, parseH2JdbcUrl } from "@/lib/h2Connection"; +import { h2JdbcUrlHasPasswordParam, h2JdbcUrlHasUserParam, parseH2JdbcUrl } from "@/lib/database/h2Connection"; export interface ParsedConnectionUrl { name?: string; diff --git a/apps/desktop/src/lib/connectionVisibleDatabases.ts b/apps/desktop/src/lib/connection/connectionVisibleDatabases.ts similarity index 97% rename from apps/desktop/src/lib/connectionVisibleDatabases.ts rename to apps/desktop/src/lib/connection/connectionVisibleDatabases.ts index 8bb9df6e6..bf93f1d87 100644 --- a/apps/desktop/src/lib/connectionVisibleDatabases.ts +++ b/apps/desktop/src/lib/connection/connectionVisibleDatabases.ts @@ -1,5 +1,5 @@ import type { ConnectionConfig, DatabaseType } from "@/types/database"; -import { filterDatabaseNamesForVisiblePicker, normalizeVisibleDatabaseSelection } from "@/lib/visibleDatabases"; +import { filterDatabaseNamesForVisiblePicker, normalizeVisibleDatabaseSelection } from "@/lib/database/visibleDatabases"; const DRAFT_VISIBLE_DATABASES_PREFIX = "__visible_draft_"; diff --git a/apps/desktop/src/lib/driverInstallProgressUi.ts b/apps/desktop/src/lib/connection/driverInstallProgressUi.ts similarity index 100% rename from apps/desktop/src/lib/driverInstallProgressUi.ts rename to apps/desktop/src/lib/connection/driverInstallProgressUi.ts diff --git a/apps/desktop/src/lib/driverRuntimePresentation.ts b/apps/desktop/src/lib/connection/driverRuntimePresentation.ts similarity index 99% rename from apps/desktop/src/lib/driverRuntimePresentation.ts rename to apps/desktop/src/lib/connection/driverRuntimePresentation.ts index 16b8ce455..aff5a50f8 100644 --- a/apps/desktop/src/lib/driverRuntimePresentation.ts +++ b/apps/desktop/src/lib/connection/driverRuntimePresentation.ts @@ -1,4 +1,4 @@ -import type { DriverRuntimeHealth, DriverRuntimeStatus } from "@/lib/api"; +import type { DriverRuntimeHealth, DriverRuntimeStatus } from "@/lib/backend/api"; export function formatRuntimeBytes(bytes: number | null | undefined): string { if (!bytes) return "-"; diff --git a/apps/desktop/src/lib/binaryCellDownload.ts b/apps/desktop/src/lib/dataGrid/binaryCellDownload.ts similarity index 98% rename from apps/desktop/src/lib/binaryCellDownload.ts rename to apps/desktop/src/lib/dataGrid/binaryCellDownload.ts index b21cc0713..92d48c5b9 100644 --- a/apps/desktop/src/lib/binaryCellDownload.ts +++ b/apps/desktop/src/lib/dataGrid/binaryCellDownload.ts @@ -1,5 +1,5 @@ -import type { CellValue } from "@/lib/cellValue"; -import { isTauriRuntime } from "@/lib/tauriRuntime"; +import type { CellValue } from "@/lib/dataGrid/cellValue"; +import { isTauriRuntime } from "@/lib/backend/tauriRuntime"; export type BinaryCellDownloadMode = "binary" | "utf8" | "gbk"; diff --git a/apps/desktop/src/lib/binaryHexViewer.ts b/apps/desktop/src/lib/dataGrid/binaryHexViewer.ts similarity index 100% rename from apps/desktop/src/lib/binaryHexViewer.ts rename to apps/desktop/src/lib/dataGrid/binaryHexViewer.ts diff --git a/apps/desktop/src/lib/canvasDataGridRenderer.ts b/apps/desktop/src/lib/dataGrid/canvasDataGridRenderer.ts similarity index 98% rename from apps/desktop/src/lib/canvasDataGridRenderer.ts rename to apps/desktop/src/lib/dataGrid/canvasDataGridRenderer.ts index a01d630a2..535ef4e68 100644 --- a/apps/desktop/src/lib/canvasDataGridRenderer.ts +++ b/apps/desktop/src/lib/dataGrid/canvasDataGridRenderer.ts @@ -1,6 +1,6 @@ -import type { CellValue } from "@/lib/cellValue"; -import type { RowStatus } from "@/lib/gridRowStatus"; -import { DATA_GRID_DARK_SEARCH_COLORS, resolveDataGridPaintTheme, type DataGridPaintTheme } from "@/lib/dataGridPaintTheme"; +import type { CellValue } from "@/lib/dataGrid/cellValue"; +import type { RowStatus } from "@/lib/dataGrid/gridRowStatus"; +import { DATA_GRID_DARK_SEARCH_COLORS, resolveDataGridPaintTheme, type DataGridPaintTheme } from "@/lib/dataGrid/dataGridPaintTheme"; export const CANVAS_DATA_GRID_ROW_HEIGHT = 26; diff --git a/apps/desktop/src/lib/cellDetailPresentation.ts b/apps/desktop/src/lib/dataGrid/cellDetailPresentation.ts similarity index 100% rename from apps/desktop/src/lib/cellDetailPresentation.ts rename to apps/desktop/src/lib/dataGrid/cellDetailPresentation.ts diff --git a/apps/desktop/src/lib/cellImageUrl.ts b/apps/desktop/src/lib/dataGrid/cellImageUrl.ts similarity index 97% rename from apps/desktop/src/lib/cellImageUrl.ts rename to apps/desktop/src/lib/dataGrid/cellImageUrl.ts index 3ca3c496a..ebdc5083a 100644 --- a/apps/desktop/src/lib/cellImageUrl.ts +++ b/apps/desktop/src/lib/dataGrid/cellImageUrl.ts @@ -1,5 +1,5 @@ -import type { CellValue } from "@/lib/cellValue"; -import { isBinaryCellColumnType, parseBinaryCellBytes } from "@/lib/binaryCellDownload"; +import type { CellValue } from "@/lib/dataGrid/cellValue"; +import { isBinaryCellColumnType, parseBinaryCellBytes } from "@/lib/dataGrid/binaryCellDownload"; const IMAGE_PATH_RE = /\.(?:png|jpe?g|webp|gif|avif|bmp|svg)$/i; const SAFE_DATA_IMAGE_RE = /^data:image\/(?:png|jpe?g|webp|gif|avif|bmp);base64,[a-z0-9+/=\s]+$/i; diff --git a/apps/desktop/src/lib/cellValue.ts b/apps/desktop/src/lib/dataGrid/cellValue.ts similarity index 100% rename from apps/desktop/src/lib/cellValue.ts rename to apps/desktop/src/lib/dataGrid/cellValue.ts diff --git a/apps/desktop/src/lib/chartData.ts b/apps/desktop/src/lib/dataGrid/chartData.ts similarity index 100% rename from apps/desktop/src/lib/chartData.ts rename to apps/desktop/src/lib/dataGrid/chartData.ts diff --git a/apps/desktop/src/lib/columnFormatter.ts b/apps/desktop/src/lib/dataGrid/columnFormatter.ts similarity index 99% rename from apps/desktop/src/lib/columnFormatter.ts rename to apps/desktop/src/lib/dataGrid/columnFormatter.ts index 241a87a3f..268346546 100644 --- a/apps/desktop/src/lib/columnFormatter.ts +++ b/apps/desktop/src/lib/dataGrid/columnFormatter.ts @@ -1,4 +1,4 @@ -import { displayCellValue, type CellValue } from "@/lib/cellValue"; +import { displayCellValue, type CellValue } from "@/lib/dataGrid/cellValue"; import dayjs, { Dayjs } from "dayjs"; import customParseFormat from "dayjs/plugin/customParseFormat"; import utc from "dayjs/plugin/utc"; diff --git a/apps/desktop/src/lib/dataCompare.ts b/apps/desktop/src/lib/dataGrid/dataCompare.ts similarity index 100% rename from apps/desktop/src/lib/dataCompare.ts rename to apps/desktop/src/lib/dataGrid/dataCompare.ts diff --git a/apps/desktop/src/lib/dataGenerate.ts b/apps/desktop/src/lib/dataGrid/dataGenerate.ts similarity index 99% rename from apps/desktop/src/lib/dataGenerate.ts rename to apps/desktop/src/lib/dataGrid/dataGenerate.ts index 464c9941c..a000a614a 100644 --- a/apps/desktop/src/lib/dataGenerate.ts +++ b/apps/desktop/src/lib/dataGrid/dataGenerate.ts @@ -1,5 +1,5 @@ import type { DatabaseType } from "@/types/database"; -import { quoteTableIdentifier } from "@/lib/tableSelectSql"; +import { quoteTableIdentifier } from "@/lib/table/tableSelectSql"; export interface GeneratorNode { key: string; diff --git a/apps/desktop/src/lib/dataGridCellCoercion.ts b/apps/desktop/src/lib/dataGrid/dataGridCellCoercion.ts similarity index 99% rename from apps/desktop/src/lib/dataGridCellCoercion.ts rename to apps/desktop/src/lib/dataGrid/dataGridCellCoercion.ts index c0712dd11..35663b40b 100644 --- a/apps/desktop/src/lib/dataGridCellCoercion.ts +++ b/apps/desktop/src/lib/dataGrid/dataGridCellCoercion.ts @@ -1,4 +1,4 @@ -import type { GridCellValue } from "@/lib/dataGridSql"; +import type { GridCellValue } from "@/lib/dataGrid/dataGridSql"; import type { DatabaseType, ColumnInfo } from "@/types/database"; export interface CoerceDataGridCellValueOptions { diff --git a/apps/desktop/src/lib/dataGridColumnFilter.ts b/apps/desktop/src/lib/dataGrid/dataGridColumnFilter.ts similarity index 95% rename from apps/desktop/src/lib/dataGridColumnFilter.ts rename to apps/desktop/src/lib/dataGrid/dataGridColumnFilter.ts index 9077d03cc..a8557b1ff 100644 --- a/apps/desktop/src/lib/dataGridColumnFilter.ts +++ b/apps/desktop/src/lib/dataGrid/dataGridColumnFilter.ts @@ -1,7 +1,7 @@ import type { ColumnInfo, DatabaseType } from "@/types/database"; -import type { DataGridColumnInfo, DataGridContextFilterMode, GridCellValue } from "@/lib/dataGridSql"; -import { buildDataGridColumnValueFilterCondition, buildDataGridColumnValuesFilterCondition } from "@/lib/dataGridSql"; -import { normalizeWhereInput } from "@/lib/tableSelectSql"; +import type { DataGridColumnInfo, DataGridContextFilterMode, GridCellValue } from "@/lib/dataGrid/dataGridSql"; +import { buildDataGridColumnValueFilterCondition, buildDataGridColumnValuesFilterCondition } from "@/lib/dataGrid/dataGridSql"; +import { normalizeWhereInput } from "@/lib/table/tableSelectSql"; export function buildColumnValueFilterCondition(options: { databaseType?: DatabaseType; columnName: string; columnInfo?: Pick; rawValue: string }): Promise { return buildDataGridColumnValueFilterCondition({ diff --git a/apps/desktop/src/lib/dataGridColumnLayoutStorage.ts b/apps/desktop/src/lib/dataGrid/dataGridColumnLayoutStorage.ts similarity index 97% rename from apps/desktop/src/lib/dataGridColumnLayoutStorage.ts rename to apps/desktop/src/lib/dataGrid/dataGridColumnLayoutStorage.ts index d1e868b10..85329e7dc 100644 --- a/apps/desktop/src/lib/dataGridColumnLayoutStorage.ts +++ b/apps/desktop/src/lib/dataGrid/dataGridColumnLayoutStorage.ts @@ -1,4 +1,4 @@ -import { safeLocalStorageGet, safeLocalStorageRemove, safeLocalStorageSet } from "@/lib/safeStorage"; +import { safeLocalStorageGet, safeLocalStorageRemove, safeLocalStorageSet } from "@/lib/backend/safeStorage"; const STORAGE_PREFIX = "dbx-data-grid-column-layout:"; const STORAGE_VERSION = 1; diff --git a/apps/desktop/src/lib/dataGridColumnOrder.ts b/apps/desktop/src/lib/dataGrid/dataGridColumnOrder.ts similarity index 100% rename from apps/desktop/src/lib/dataGridColumnOrder.ts rename to apps/desktop/src/lib/dataGrid/dataGridColumnOrder.ts diff --git a/apps/desktop/src/lib/dataGridColumnType.ts b/apps/desktop/src/lib/dataGrid/dataGridColumnType.ts similarity index 100% rename from apps/desktop/src/lib/dataGridColumnType.ts rename to apps/desktop/src/lib/dataGrid/dataGridColumnType.ts diff --git a/apps/desktop/src/lib/dataGridColumnVisibility.ts b/apps/desktop/src/lib/dataGrid/dataGridColumnVisibility.ts similarity index 100% rename from apps/desktop/src/lib/dataGridColumnVisibility.ts rename to apps/desktop/src/lib/dataGrid/dataGridColumnVisibility.ts diff --git a/apps/desktop/src/lib/dataGridColumnWidth.ts b/apps/desktop/src/lib/dataGrid/dataGridColumnWidth.ts similarity index 100% rename from apps/desktop/src/lib/dataGridColumnWidth.ts rename to apps/desktop/src/lib/dataGrid/dataGridColumnWidth.ts diff --git a/apps/desktop/src/lib/dataGridConditionHistory.ts b/apps/desktop/src/lib/dataGrid/dataGridConditionHistory.ts similarity index 99% rename from apps/desktop/src/lib/dataGridConditionHistory.ts rename to apps/desktop/src/lib/dataGrid/dataGridConditionHistory.ts index bf91be185..e7f3f7e26 100644 --- a/apps/desktop/src/lib/dataGridConditionHistory.ts +++ b/apps/desktop/src/lib/dataGrid/dataGridConditionHistory.ts @@ -1,4 +1,4 @@ -import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/safeStorage"; +import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/backend/safeStorage"; const STORAGE_KEY = "dbx-data-grid-condition-history"; const MAX_HISTORY_PER_SCOPE = 12; diff --git a/apps/desktop/src/lib/dataGridConditionSuggestionPosition.ts b/apps/desktop/src/lib/dataGrid/dataGridConditionSuggestionPosition.ts similarity index 100% rename from apps/desktop/src/lib/dataGridConditionSuggestionPosition.ts rename to apps/desktop/src/lib/dataGrid/dataGridConditionSuggestionPosition.ts diff --git a/apps/desktop/src/lib/dataGridDetail.ts b/apps/desktop/src/lib/dataGrid/dataGridDetail.ts similarity index 97% rename from apps/desktop/src/lib/dataGridDetail.ts rename to apps/desktop/src/lib/dataGrid/dataGridDetail.ts index 06850a72a..81148d5d6 100644 --- a/apps/desktop/src/lib/dataGridDetail.ts +++ b/apps/desktop/src/lib/dataGrid/dataGridDetail.ts @@ -1,6 +1,6 @@ -import { cellImagePreviewUrl } from "@/lib/cellImageUrl"; -import { displayCellValue, type CellValue } from "@/lib/cellValue"; -import { formatJsonText } from "@/lib/cellDetailPresentation"; +import { cellImagePreviewUrl } from "@/lib/dataGrid/cellImageUrl"; +import { displayCellValue, type CellValue } from "@/lib/dataGrid/cellValue"; +import { formatJsonText } from "@/lib/dataGrid/cellDetailPresentation"; export const CELL_DETAIL_VALUE_PREVIEW_MAX_LENGTH = 12_000; diff --git a/apps/desktop/src/lib/dataGridEnumEditor.ts b/apps/desktop/src/lib/dataGrid/dataGridEnumEditor.ts similarity index 100% rename from apps/desktop/src/lib/dataGridEnumEditor.ts rename to apps/desktop/src/lib/dataGrid/dataGridEnumEditor.ts diff --git a/apps/desktop/src/lib/dataGridInfiniteScroll.ts b/apps/desktop/src/lib/dataGrid/dataGridInfiniteScroll.ts similarity index 100% rename from apps/desktop/src/lib/dataGridInfiniteScroll.ts rename to apps/desktop/src/lib/dataGrid/dataGridInfiniteScroll.ts diff --git a/apps/desktop/src/lib/dataGridPagination.ts b/apps/desktop/src/lib/dataGrid/dataGridPagination.ts similarity index 100% rename from apps/desktop/src/lib/dataGridPagination.ts rename to apps/desktop/src/lib/dataGrid/dataGridPagination.ts diff --git a/apps/desktop/src/lib/dataGridPaintTheme.ts b/apps/desktop/src/lib/dataGrid/dataGridPaintTheme.ts similarity index 100% rename from apps/desktop/src/lib/dataGridPaintTheme.ts rename to apps/desktop/src/lib/dataGrid/dataGridPaintTheme.ts diff --git a/apps/desktop/src/lib/dataGridSaveUi.ts b/apps/desktop/src/lib/dataGrid/dataGridSaveUi.ts similarity index 100% rename from apps/desktop/src/lib/dataGridSaveUi.ts rename to apps/desktop/src/lib/dataGrid/dataGridSaveUi.ts diff --git a/apps/desktop/src/lib/dataGridScrollGutter.ts b/apps/desktop/src/lib/dataGrid/dataGridScrollGutter.ts similarity index 100% rename from apps/desktop/src/lib/dataGridScrollGutter.ts rename to apps/desktop/src/lib/dataGrid/dataGridScrollGutter.ts diff --git a/apps/desktop/src/lib/dataGridSearchSplit.ts b/apps/desktop/src/lib/dataGrid/dataGridSearchSplit.ts similarity index 100% rename from apps/desktop/src/lib/dataGridSearchSplit.ts rename to apps/desktop/src/lib/dataGrid/dataGridSearchSplit.ts diff --git a/apps/desktop/src/lib/dataGridSort.ts b/apps/desktop/src/lib/dataGrid/dataGridSort.ts similarity index 100% rename from apps/desktop/src/lib/dataGridSort.ts rename to apps/desktop/src/lib/dataGrid/dataGridSort.ts diff --git a/apps/desktop/src/lib/dataGridSql.ts b/apps/desktop/src/lib/dataGrid/dataGridSql.ts similarity index 99% rename from apps/desktop/src/lib/dataGridSql.ts rename to apps/desktop/src/lib/dataGrid/dataGridSql.ts index b6a4748ea..e24f583a5 100644 --- a/apps/desktop/src/lib/dataGridSql.ts +++ b/apps/desktop/src/lib/dataGrid/dataGridSql.ts @@ -1,5 +1,5 @@ import type { DatabaseType } from "@/types/database"; -import * as api from "@/lib/api"; +import * as api from "@/lib/backend/api"; export type GridCellValue = string | number | boolean | null | unknown[] | { [key: string]: unknown }; diff --git a/apps/desktop/src/lib/dataGridTemporalEditor.ts b/apps/desktop/src/lib/dataGrid/dataGridTemporalEditor.ts similarity index 100% rename from apps/desktop/src/lib/dataGridTemporalEditor.ts rename to apps/desktop/src/lib/dataGrid/dataGridTemporalEditor.ts diff --git a/apps/desktop/src/lib/dataGridTranspose.ts b/apps/desktop/src/lib/dataGrid/dataGridTranspose.ts similarity index 100% rename from apps/desktop/src/lib/dataGridTranspose.ts rename to apps/desktop/src/lib/dataGrid/dataGridTranspose.ts diff --git a/apps/desktop/src/lib/previewHandlers/geometryMapPreview.ts b/apps/desktop/src/lib/dataGrid/geometryMapPreview.ts similarity index 94% rename from apps/desktop/src/lib/previewHandlers/geometryMapPreview.ts rename to apps/desktop/src/lib/dataGrid/geometryMapPreview.ts index 4b57111d1..8991b1118 100644 --- a/apps/desktop/src/lib/previewHandlers/geometryMapPreview.ts +++ b/apps/desktop/src/lib/dataGrid/geometryMapPreview.ts @@ -1,6 +1,6 @@ import { Map as MapIcon } from "@lucide/vue"; -import { registerPreviewAction } from "@/lib/resultPreviewRegistry"; -import { wktToGeoJson } from "@/lib/geometryPreview"; +import { registerPreviewAction } from "@/lib/dataGrid/resultPreviewRegistry"; +import { wktToGeoJson } from "@/lib/dataGrid/geometryPreview"; import LayerPreviewDialog from "@/components/grid/LayerPreviewDialog.vue"; registerPreviewAction({ diff --git a/apps/desktop/src/lib/geometryPreview.ts b/apps/desktop/src/lib/dataGrid/geometryPreview.ts similarity index 100% rename from apps/desktop/src/lib/geometryPreview.ts rename to apps/desktop/src/lib/dataGrid/geometryPreview.ts diff --git a/apps/desktop/src/lib/gridRowStatus.ts b/apps/desktop/src/lib/dataGrid/gridRowStatus.ts similarity index 100% rename from apps/desktop/src/lib/gridRowStatus.ts rename to apps/desktop/src/lib/dataGrid/gridRowStatus.ts diff --git a/apps/desktop/src/lib/gridSelection.ts b/apps/desktop/src/lib/dataGrid/gridSelection.ts similarity index 100% rename from apps/desktop/src/lib/gridSelection.ts rename to apps/desktop/src/lib/dataGrid/gridSelection.ts diff --git a/apps/desktop/src/lib/imagePreviewViewer.ts b/apps/desktop/src/lib/dataGrid/imagePreviewViewer.ts similarity index 100% rename from apps/desktop/src/lib/imagePreviewViewer.ts rename to apps/desktop/src/lib/dataGrid/imagePreviewViewer.ts diff --git a/apps/desktop/src/lib/paginationPageSize.ts b/apps/desktop/src/lib/dataGrid/paginationPageSize.ts similarity index 100% rename from apps/desktop/src/lib/paginationPageSize.ts rename to apps/desktop/src/lib/dataGrid/paginationPageSize.ts diff --git a/apps/desktop/src/lib/resultPreviewRegistry.ts b/apps/desktop/src/lib/dataGrid/resultPreviewRegistry.ts similarity index 100% rename from apps/desktop/src/lib/resultPreviewRegistry.ts rename to apps/desktop/src/lib/dataGrid/resultPreviewRegistry.ts diff --git a/apps/desktop/src/lib/createDatabaseCharsetOptions.ts b/apps/desktop/src/lib/database/createDatabaseCharsetOptions.ts similarity index 100% rename from apps/desktop/src/lib/createDatabaseCharsetOptions.ts rename to apps/desktop/src/lib/database/createDatabaseCharsetOptions.ts diff --git a/apps/desktop/src/lib/createDatabaseSql.ts b/apps/desktop/src/lib/database/createDatabaseSql.ts similarity index 97% rename from apps/desktop/src/lib/createDatabaseSql.ts rename to apps/desktop/src/lib/database/createDatabaseSql.ts index f4708fe35..133bf08c0 100644 --- a/apps/desktop/src/lib/createDatabaseSql.ts +++ b/apps/desktop/src/lib/database/createDatabaseSql.ts @@ -1,5 +1,5 @@ import type { DatabaseType } from "@/types/database"; -import * as api from "@/lib/api"; +import * as api from "@/lib/backend/api"; const MYSQL_COMPATIBLE_PROFILES = new Set(["mysql", "mariadb", "tidb", "oceanbase", "doris", "starrocks", "custom_mysql"]); const MYSQL_COMPATIBLE_TYPES = new Set(["mysql", "doris", "starrocks", "goldendb"]); diff --git a/apps/desktop/src/lib/database/databaseCapabilities.ts b/apps/desktop/src/lib/database/databaseCapabilities.ts new file mode 100644 index 000000000..5f7a5f6fa --- /dev/null +++ b/apps/desktop/src/lib/database/databaseCapabilities.ts @@ -0,0 +1,5 @@ +export * from "@/lib/database/databaseCapabilitySets"; +export * from "@/lib/database/databaseDriverManifest"; +export * from "@/lib/database/databaseFeatureSupport"; +export * from "@/lib/database/databaseObjectCapabilities"; +export * from "@/lib/database/databaseTableDataCapabilities"; diff --git a/apps/desktop/src/lib/databaseCapabilitySets.ts b/apps/desktop/src/lib/database/databaseCapabilitySets.ts similarity index 100% rename from apps/desktop/src/lib/databaseCapabilitySets.ts rename to apps/desktop/src/lib/database/databaseCapabilitySets.ts diff --git a/apps/desktop/src/lib/databaseDriverManifest.ts b/apps/desktop/src/lib/database/databaseDriverManifest.ts similarity index 97% rename from apps/desktop/src/lib/databaseDriverManifest.ts rename to apps/desktop/src/lib/database/databaseDriverManifest.ts index a34aefed8..37b2f85ed 100644 --- a/apps/desktop/src/lib/databaseDriverManifest.ts +++ b/apps/desktop/src/lib/database/databaseDriverManifest.ts @@ -1,5 +1,5 @@ import type { DatabaseType } from "@/types/database"; -import driverManifest from "../../../../crates/dbx-core/assets/database-drivers.manifest.json"; +import driverManifest from "../../../../../crates/dbx-core/assets/database-drivers.manifest.json"; export type DatabaseSupportLevel = "connect" | "browse" | "understand" | "operate"; export type DatabaseRuntimeMode = "native" | "file" | "agent" | "external"; diff --git a/apps/desktop/src/lib/databaseFeatureSupport.ts b/apps/desktop/src/lib/database/databaseFeatureSupport.ts similarity index 94% rename from apps/desktop/src/lib/databaseFeatureSupport.ts rename to apps/desktop/src/lib/database/databaseFeatureSupport.ts index dc46fcbeb..ffb091efc 100644 --- a/apps/desktop/src/lib/databaseFeatureSupport.ts +++ b/apps/desktop/src/lib/database/databaseFeatureSupport.ts @@ -1,7 +1,7 @@ import type { DatabaseType, TreeNodeType } from "@/types/database"; -import { supportsDatabaseFeature } from "./databaseDriverManifest"; -import { canEditTableStructure } from "./tableStructureCapabilities"; -import { DATABASE_OBJECT_TREE_TYPES, FETCH_FIRST_TYPES, PG_LIKE_STRUCTURE_TYPES, SCHEMA_AWARE_TYPES, SINGLE_DATABASE_TYPES, TREE_SCHEMA_TYPES } from "./databaseCapabilitySets"; +import { supportsDatabaseFeature } from "@/lib/database/databaseDriverManifest"; +import { canEditTableStructure } from "@/lib/table/tableStructureCapabilities"; +import { DATABASE_OBJECT_TREE_TYPES, FETCH_FIRST_TYPES, PG_LIKE_STRUCTURE_TYPES, SCHEMA_AWARE_TYPES, SINGLE_DATABASE_TYPES, TREE_SCHEMA_TYPES } from "@/lib/database/databaseCapabilitySets"; export function isSchemaAware(dbType?: DatabaseType): boolean { return !!dbType && SCHEMA_AWARE_TYPES.has(dbType); diff --git a/apps/desktop/src/lib/databaseFileDetection.ts b/apps/desktop/src/lib/database/databaseFileDetection.ts similarity index 94% rename from apps/desktop/src/lib/databaseFileDetection.ts rename to apps/desktop/src/lib/database/databaseFileDetection.ts index 30533d1b1..12812544d 100644 --- a/apps/desktop/src/lib/databaseFileDetection.ts +++ b/apps/desktop/src/lib/database/databaseFileDetection.ts @@ -1,4 +1,4 @@ -import * as api from "@/lib/api"; +import * as api from "@/lib/backend/api"; export const SQLITE_DATABASE_FILE_EXTENSIONS = ["db", "db3", "sqlite", "sqlite3", "sqlitedb"]; diff --git a/apps/desktop/src/lib/databaseObjectCapabilities.ts b/apps/desktop/src/lib/database/databaseObjectCapabilities.ts similarity index 100% rename from apps/desktop/src/lib/databaseObjectCapabilities.ts rename to apps/desktop/src/lib/database/databaseObjectCapabilities.ts diff --git a/apps/desktop/src/lib/databaseOptionSearch.ts b/apps/desktop/src/lib/database/databaseOptionSearch.ts similarity index 100% rename from apps/desktop/src/lib/databaseOptionSearch.ts rename to apps/desktop/src/lib/database/databaseOptionSearch.ts diff --git a/apps/desktop/src/lib/databaseSearch.ts b/apps/desktop/src/lib/database/databaseSearch.ts similarity index 96% rename from apps/desktop/src/lib/databaseSearch.ts rename to apps/desktop/src/lib/database/databaseSearch.ts index bf5b9d7f5..49e862a7b 100644 --- a/apps/desktop/src/lib/databaseSearch.ts +++ b/apps/desktop/src/lib/database/databaseSearch.ts @@ -1,5 +1,5 @@ -import type { ColumnInfo, DatabaseType } from "../types/database.ts"; -import * as api from "./api.ts"; +import type { ColumnInfo, DatabaseType } from "@/types/database.ts"; +import * as api from "@/lib/backend/api.ts"; export interface DatabaseSearchSqlOptions { databaseType?: DatabaseType; diff --git a/apps/desktop/src/lib/databaseTableDataCapabilities.ts b/apps/desktop/src/lib/database/databaseTableDataCapabilities.ts similarity index 98% rename from apps/desktop/src/lib/databaseTableDataCapabilities.ts rename to apps/desktop/src/lib/database/databaseTableDataCapabilities.ts index 5fb2a4e20..0b0891160 100644 --- a/apps/desktop/src/lib/databaseTableDataCapabilities.ts +++ b/apps/desktop/src/lib/database/databaseTableDataCapabilities.ts @@ -1,5 +1,5 @@ import type { DatabaseType } from "@/types/database"; -import { isSchemaAware, usesTreeSchemaMode } from "./databaseFeatureSupport"; +import { isSchemaAware, usesTreeSchemaMode } from "@/lib/database/databaseFeatureSupport"; export type SyntheticEditKey = "oracle-rowid" | "neo4j-element-id"; diff --git a/apps/desktop/src/lib/databaseTree.ts b/apps/desktop/src/lib/database/databaseTree.ts similarity index 97% rename from apps/desktop/src/lib/databaseTree.ts rename to apps/desktop/src/lib/database/databaseTree.ts index feb9bc1ec..937e0deca 100644 --- a/apps/desktop/src/lib/databaseTree.ts +++ b/apps/desktop/src/lib/database/databaseTree.ts @@ -1,5 +1,5 @@ import type { ConnectionConfig, DatabaseInfo, TreeNode } from "@/types/database"; -import { DEFAULT_DATABASE_TREE_LABEL } from "./treeNodeContext"; +import { DEFAULT_DATABASE_TREE_LABEL } from "@/lib/sidebar/treeNodeContext"; const sidebarNameCollator = new Intl.Collator(undefined, { numeric: true, sensitivity: "base" }); diff --git a/apps/desktop/src/lib/databaseUserAdmin.ts b/apps/desktop/src/lib/database/databaseUserAdmin.ts similarity index 99% rename from apps/desktop/src/lib/databaseUserAdmin.ts rename to apps/desktop/src/lib/database/databaseUserAdmin.ts index 5c2c0cd14..e1e94df6d 100644 --- a/apps/desktop/src/lib/databaseUserAdmin.ts +++ b/apps/desktop/src/lib/database/databaseUserAdmin.ts @@ -1,5 +1,5 @@ import type { DatabaseType, QueryResult } from "@/types/database"; -import { supportsDatabaseFeature } from "./databaseDriverManifest"; +import { supportsDatabaseFeature } from "@/lib/database/databaseDriverManifest"; export type UserAdminDialect = "mysql" | "postgres"; export type PrivilegeScope = "mysql" | "database" | "schema" | "table" | "role"; diff --git a/apps/desktop/src/lib/dbAdminSql.ts b/apps/desktop/src/lib/database/dbAdminSql.ts similarity index 98% rename from apps/desktop/src/lib/dbAdminSql.ts rename to apps/desktop/src/lib/database/dbAdminSql.ts index 83a126644..b27c6ba6b 100644 --- a/apps/desktop/src/lib/dbAdminSql.ts +++ b/apps/desktop/src/lib/database/dbAdminSql.ts @@ -1,5 +1,5 @@ import type { DatabaseObjectType, DatabaseType } from "@/types/database"; -import * as api from "@/lib/api"; +import * as api from "@/lib/backend/api"; export interface DropObjectSqlOptions { databaseType?: DatabaseType; diff --git a/apps/desktop/src/lib/defaultDatabase.ts b/apps/desktop/src/lib/database/defaultDatabase.ts similarity index 95% rename from apps/desktop/src/lib/defaultDatabase.ts rename to apps/desktop/src/lib/database/defaultDatabase.ts index 3ffed632a..ad7910967 100644 --- a/apps/desktop/src/lib/defaultDatabase.ts +++ b/apps/desktop/src/lib/database/defaultDatabase.ts @@ -1,5 +1,5 @@ import type { ConnectionConfig, DatabaseType } from "@/types/database"; -import { usesTreeSchemaMode } from "@/lib/databaseCapabilities"; +import { usesTreeSchemaMode } from "@/lib/database/databaseCapabilities"; export const TREE_SCHEMA_DEFAULT_DATABASE_SELECT_VALUE = "__dbx_tree_schema_default_database__"; export const EMPTY_DATABASE_SELECT_VALUE = "__dbx_empty_database__"; diff --git a/apps/desktop/src/lib/h2Connection.ts b/apps/desktop/src/lib/database/h2Connection.ts similarity index 100% rename from apps/desktop/src/lib/h2Connection.ts rename to apps/desktop/src/lib/database/h2Connection.ts diff --git a/apps/desktop/src/lib/jdbcDialect.ts b/apps/desktop/src/lib/database/jdbcDialect.ts similarity index 98% rename from apps/desktop/src/lib/jdbcDialect.ts rename to apps/desktop/src/lib/database/jdbcDialect.ts index e47735899..59aee53b6 100644 --- a/apps/desktop/src/lib/jdbcDialect.ts +++ b/apps/desktop/src/lib/database/jdbcDialect.ts @@ -1,5 +1,5 @@ import type { ConnectionConfig, DatabaseType } from "@/types/database"; -import { isSchemaAware, usesDatabaseObjectTreeMode, usesTreeSchemaMode } from "@/lib/databaseFeatureSupport"; +import { isSchemaAware, usesDatabaseObjectTreeMode, usesTreeSchemaMode } from "@/lib/database/databaseFeatureSupport"; type JdbcDialectConnection = Pick & Partial>; diff --git a/apps/desktop/src/lib/mysqlConnectionOptions.ts b/apps/desktop/src/lib/database/mysqlConnectionOptions.ts similarity index 100% rename from apps/desktop/src/lib/mysqlConnectionOptions.ts rename to apps/desktop/src/lib/database/mysqlConnectionOptions.ts diff --git a/apps/desktop/src/lib/oceanbaseConnectionMode.ts b/apps/desktop/src/lib/database/oceanbaseConnectionMode.ts similarity index 100% rename from apps/desktop/src/lib/oceanbaseConnectionMode.ts rename to apps/desktop/src/lib/database/oceanbaseConnectionMode.ts diff --git a/apps/desktop/src/lib/prestoSqlBuiltinDriver.ts b/apps/desktop/src/lib/database/prestoSqlBuiltinDriver.ts similarity index 95% rename from apps/desktop/src/lib/prestoSqlBuiltinDriver.ts rename to apps/desktop/src/lib/database/prestoSqlBuiltinDriver.ts index 01c811f30..cbaa16802 100644 --- a/apps/desktop/src/lib/prestoSqlBuiltinDriver.ts +++ b/apps/desktop/src/lib/database/prestoSqlBuiltinDriver.ts @@ -1,4 +1,4 @@ -import type { AgentDriverInfo } from "@/lib/api"; +import type { AgentDriverInfo } from "@/lib/backend/api"; import type { JdbcMavenBundleInfo } from "@/types/database"; export const PRESTOSQL_DRIVER_DB_TYPE = "prestosql"; diff --git a/apps/desktop/src/lib/sqlServerLinkedServers.ts b/apps/desktop/src/lib/database/sqlServerLinkedServers.ts similarity index 100% rename from apps/desktop/src/lib/sqlServerLinkedServers.ts rename to apps/desktop/src/lib/database/sqlServerLinkedServers.ts diff --git a/apps/desktop/src/lib/sqlServerTree.ts b/apps/desktop/src/lib/database/sqlServerTree.ts similarity index 88% rename from apps/desktop/src/lib/sqlServerTree.ts rename to apps/desktop/src/lib/database/sqlServerTree.ts index bae1fb924..69f7b2bee 100644 --- a/apps/desktop/src/lib/sqlServerTree.ts +++ b/apps/desktop/src/lib/database/sqlServerTree.ts @@ -1,5 +1,5 @@ import type { TreeNode } from "@/types/database"; -import { sortSidebarNames } from "@/lib/databaseTree"; +import { sortSidebarNames } from "@/lib/database/databaseTree"; export const SQLSERVER_DEFAULT_SCHEMA = "dbo"; diff --git a/apps/desktop/src/lib/visibleDatabases.ts b/apps/desktop/src/lib/database/visibleDatabases.ts similarity index 100% rename from apps/desktop/src/lib/visibleDatabases.ts rename to apps/desktop/src/lib/database/visibleDatabases.ts diff --git a/apps/desktop/src/lib/databaseCapabilities.ts b/apps/desktop/src/lib/databaseCapabilities.ts deleted file mode 100644 index 8a77e5e15..000000000 --- a/apps/desktop/src/lib/databaseCapabilities.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from "./databaseCapabilitySets"; -export * from "./databaseDriverManifest"; -export * from "./databaseFeatureSupport"; -export * from "./databaseObjectCapabilities"; -export * from "./databaseTableDataCapabilities"; diff --git a/apps/desktop/src/lib/diagramZoom.ts b/apps/desktop/src/lib/diagram/diagramZoom.ts similarity index 100% rename from apps/desktop/src/lib/diagramZoom.ts rename to apps/desktop/src/lib/diagram/diagramZoom.ts diff --git a/apps/desktop/src/lib/engineeringDiagram.ts b/apps/desktop/src/lib/diagram/engineeringDiagram.ts similarity index 99% rename from apps/desktop/src/lib/engineeringDiagram.ts rename to apps/desktop/src/lib/diagram/engineeringDiagram.ts index f859908af..3c31e1aa2 100644 --- a/apps/desktop/src/lib/engineeringDiagram.ts +++ b/apps/desktop/src/lib/diagram/engineeringDiagram.ts @@ -1,4 +1,4 @@ -import type { DiagramPosition, DiagramRelationship, DiagramTable } from "./erDiagram"; +import type { DiagramPosition, DiagramRelationship, DiagramTable } from "@/lib/diagram/erDiagram"; export const ENGINEERING_ENTITY_WIDTH = 184; export const ENGINEERING_ENTITY_HEIGHT = 58; diff --git a/apps/desktop/src/lib/erDiagram.ts b/apps/desktop/src/lib/diagram/erDiagram.ts similarity index 99% rename from apps/desktop/src/lib/erDiagram.ts rename to apps/desktop/src/lib/diagram/erDiagram.ts index fd61c935b..c0ccceb7d 100644 --- a/apps/desktop/src/lib/erDiagram.ts +++ b/apps/desktop/src/lib/diagram/erDiagram.ts @@ -1,4 +1,4 @@ -import type { ColumnInfo, ForeignKeyInfo } from "../types/database"; +import type { ColumnInfo, ForeignKeyInfo } from "@/types/database"; export interface DiagramTable { name: string; diff --git a/apps/desktop/src/lib/explainPlan.ts b/apps/desktop/src/lib/diagram/explainPlan.ts similarity index 99% rename from apps/desktop/src/lib/explainPlan.ts rename to apps/desktop/src/lib/diagram/explainPlan.ts index ee96060a5..fc78a94c2 100644 --- a/apps/desktop/src/lib/explainPlan.ts +++ b/apps/desktop/src/lib/diagram/explainPlan.ts @@ -1,6 +1,6 @@ import type { DatabaseType, QueryResult } from "@/types/database"; -import * as api from "@/lib/api"; -import { supportsDatabaseFeature } from "./databaseDriverManifest"; +import * as api from "@/lib/backend/api"; +import { supportsDatabaseFeature } from "@/lib/database/databaseDriverManifest"; export interface ExplainPlanNode { id: string; diff --git a/apps/desktop/src/lib/fieldLineage.ts b/apps/desktop/src/lib/diagram/fieldLineage.ts similarity index 100% rename from apps/desktop/src/lib/fieldLineage.ts rename to apps/desktop/src/lib/diagram/fieldLineage.ts diff --git a/apps/desktop/src/lib/documentViewerFontStyle.ts b/apps/desktop/src/lib/document/documentViewerFontStyle.ts similarity index 93% rename from apps/desktop/src/lib/documentViewerFontStyle.ts rename to apps/desktop/src/lib/document/documentViewerFontStyle.ts index fb09333bf..6f2d6d7f0 100644 --- a/apps/desktop/src/lib/documentViewerFontStyle.ts +++ b/apps/desktop/src/lib/document/documentViewerFontStyle.ts @@ -1,4 +1,4 @@ -import { EDITOR_FONT_FAMILY_CSS_VAR, EDITOR_FONT_SIZE_CSS_VAR } from "@/lib/editorThemes"; +import { EDITOR_FONT_FAMILY_CSS_VAR, EDITOR_FONT_SIZE_CSS_VAR } from "@/lib/editor/editorThemes"; import type { EditorSettings } from "@/stores/settingsStore"; export type DocumentViewerFontSettings = Pick; diff --git a/apps/desktop/src/lib/codemirrorSelectionMatches.ts b/apps/desktop/src/lib/editor/codemirrorSelectionMatches.ts similarity index 100% rename from apps/desktop/src/lib/codemirrorSelectionMatches.ts rename to apps/desktop/src/lib/editor/codemirrorSelectionMatches.ts diff --git a/apps/desktop/src/lib/codemirrorSqlDialect.ts b/apps/desktop/src/lib/editor/codemirrorSqlDialect.ts similarity index 100% rename from apps/desktop/src/lib/codemirrorSqlDialect.ts rename to apps/desktop/src/lib/editor/codemirrorSqlDialect.ts diff --git a/apps/desktop/src/lib/codemirrorTrimmedSelectionLayer.ts b/apps/desktop/src/lib/editor/codemirrorTrimmedSelectionLayer.ts similarity index 100% rename from apps/desktop/src/lib/codemirrorTrimmedSelectionLayer.ts rename to apps/desktop/src/lib/editor/codemirrorTrimmedSelectionLayer.ts diff --git a/apps/desktop/src/lib/editorThemes.ts b/apps/desktop/src/lib/editor/editorThemes.ts similarity index 99% rename from apps/desktop/src/lib/editorThemes.ts rename to apps/desktop/src/lib/editor/editorThemes.ts index ec960e35a..9111e5b94 100644 --- a/apps/desktop/src/lib/editorThemes.ts +++ b/apps/desktop/src/lib/editor/editorThemes.ts @@ -1,6 +1,6 @@ import type { Extension } from "@codemirror/state"; import type { EditorTheme, CustomThemeColors } from "@/stores/settingsStore"; -import type { AppThemeAppearance } from "@/lib/appTheme"; +import type { AppThemeAppearance } from "@/lib/app/appTheme"; import { HighlightStyle, syntaxHighlighting } from "@codemirror/language"; import { tags } from "@lezer/highlight"; diff --git a/apps/desktop/src/lib/editorZoom.ts b/apps/desktop/src/lib/editor/editorZoom.ts similarity index 100% rename from apps/desktop/src/lib/editorZoom.ts rename to apps/desktop/src/lib/editor/editorZoom.ts diff --git a/apps/desktop/src/lib/keyboardShortcuts.ts b/apps/desktop/src/lib/editor/keyboardShortcuts.ts similarity index 99% rename from apps/desktop/src/lib/keyboardShortcuts.ts rename to apps/desktop/src/lib/editor/keyboardShortcuts.ts index 2970f4b35..a345f01d2 100644 --- a/apps/desktop/src/lib/keyboardShortcuts.ts +++ b/apps/desktop/src/lib/editor/keyboardShortcuts.ts @@ -1,4 +1,4 @@ -import { normalizeShortcutSettings, type ShortcutActionId, type ShortcutSettings } from "@/lib/shortcutRegistry"; +import { normalizeShortcutSettings, type ShortcutActionId, type ShortcutSettings } from "@/lib/editor/shortcutRegistry"; export interface ShortcutLikeEvent { key: string; diff --git a/apps/desktop/src/lib/queryEditorTableDrop.ts b/apps/desktop/src/lib/editor/queryEditorTableDrop.ts similarity index 99% rename from apps/desktop/src/lib/queryEditorTableDrop.ts rename to apps/desktop/src/lib/editor/queryEditorTableDrop.ts index 5f601e50f..f1853c8dd 100644 --- a/apps/desktop/src/lib/queryEditorTableDrop.ts +++ b/apps/desktop/src/lib/editor/queryEditorTableDrop.ts @@ -1,5 +1,5 @@ import type { DatabaseType } from "@/types/database"; -import { qualifiedTableName, quoteTableIdentifier } from "@/lib/tableSelectSql"; +import { qualifiedTableName, quoteTableIdentifier } from "@/lib/table/tableSelectSql"; export const DBX_TABLE_REFERENCE_MIME = "application/x-dbx-table-reference"; export const DBX_TABLE_REFERENCE_DROP_EVENT = "dbx-table-reference-drop"; diff --git a/apps/desktop/src/lib/shortcutRegistry.ts b/apps/desktop/src/lib/editor/shortcutRegistry.ts similarity index 100% rename from apps/desktop/src/lib/shortcutRegistry.ts rename to apps/desktop/src/lib/editor/shortcutRegistry.ts diff --git a/apps/desktop/src/lib/elasticsearchCompletion.ts b/apps/desktop/src/lib/elasticsearch/elasticsearchCompletion.ts similarity index 100% rename from apps/desktop/src/lib/elasticsearchCompletion.ts rename to apps/desktop/src/lib/elasticsearch/elasticsearchCompletion.ts diff --git a/apps/desktop/src/lib/etcdKeyTree.ts b/apps/desktop/src/lib/etcd/etcdKeyTree.ts similarity index 75% rename from apps/desktop/src/lib/etcdKeyTree.ts rename to apps/desktop/src/lib/etcd/etcdKeyTree.ts index 1e23aafb2..75789778f 100644 --- a/apps/desktop/src/lib/etcdKeyTree.ts +++ b/apps/desktop/src/lib/etcd/etcdKeyTree.ts @@ -1,3 +1,3 @@ -export { buildKvKeyTree as buildEtcdKeyTree, collectKvGroupIds as collectEtcdGroupIds, flattenVisibleKvKeyTree as flattenVisibleEtcdKeyTree, preserveKvExpandedGroupIds as preserveEtcdExpandedGroupIds } from "./kvKeyTree"; +export { buildKvKeyTree as buildEtcdKeyTree, collectKvGroupIds as collectEtcdGroupIds, flattenVisibleKvKeyTree as flattenVisibleEtcdKeyTree, preserveKvExpandedGroupIds as preserveEtcdExpandedGroupIds } from "@/lib/kv/kvKeyTree"; -export type { KvKeyTreeGroupNode as EtcdKeyTreeGroupNode, KvKeyTreeLeafNode as EtcdKeyTreeLeafNode, KvKeyTreeNode as EtcdKeyTreeNode, KvKeyTreeRow as EtcdKeyTreeRow } from "./kvKeyTree"; +export type { KvKeyTreeGroupNode as EtcdKeyTreeGroupNode, KvKeyTreeLeafNode as EtcdKeyTreeLeafNode, KvKeyTreeNode as EtcdKeyTreeNode, KvKeyTreeRow as EtcdKeyTreeRow } from "@/lib/kv/kvKeyTree"; diff --git a/apps/desktop/src/lib/databaseExport.ts b/apps/desktop/src/lib/export/databaseExport.ts similarity index 92% rename from apps/desktop/src/lib/databaseExport.ts rename to apps/desktop/src/lib/export/databaseExport.ts index d0a261053..5ab8183ed 100644 --- a/apps/desktop/src/lib/databaseExport.ts +++ b/apps/desktop/src/lib/export/databaseExport.ts @@ -1,7 +1,7 @@ -import type { DatabaseType, QueryResult } from "../types/database.ts"; -import * as api from "./api.ts"; -import { buildTableSelectSql } from "./tableSelectSql.ts"; -import { uuid } from "./utils.ts"; +import type { DatabaseType, QueryResult } from "@/types/database.ts"; +import * as api from "@/lib/backend/api.ts"; +import { buildTableSelectSql } from "@/lib/table/tableSelectSql.ts"; +import { uuid } from "@/lib/common/utils.ts"; export const DATABASE_EXPORT_ROW_LIMIT = 10_000; export const DATABASE_EXPORT_PAGE_SIZE = 500; diff --git a/apps/desktop/src/lib/databaseExportSelection.ts b/apps/desktop/src/lib/export/databaseExportSelection.ts similarity index 100% rename from apps/desktop/src/lib/databaseExportSelection.ts rename to apps/desktop/src/lib/export/databaseExportSelection.ts diff --git a/apps/desktop/src/lib/ddlExport.ts b/apps/desktop/src/lib/export/ddlExport.ts similarity index 100% rename from apps/desktop/src/lib/ddlExport.ts rename to apps/desktop/src/lib/export/ddlExport.ts diff --git a/apps/desktop/src/lib/diagramSvgExport.ts b/apps/desktop/src/lib/export/diagramSvgExport.ts similarity index 99% rename from apps/desktop/src/lib/diagramSvgExport.ts rename to apps/desktop/src/lib/export/diagramSvgExport.ts index e0979b74c..127ca8919 100644 --- a/apps/desktop/src/lib/diagramSvgExport.ts +++ b/apps/desktop/src/lib/export/diagramSvgExport.ts @@ -1,5 +1,5 @@ -import type { EngineeringDiagram, EngineeringEntityNode } from "./engineeringDiagram"; -import type { DiagramPosition, DiagramRelationship, DiagramTable } from "./erDiagram"; +import type { EngineeringDiagram, EngineeringEntityNode } from "@/lib/diagram/engineeringDiagram"; +import type { DiagramPosition, DiagramRelationship, DiagramTable } from "@/lib/diagram/erDiagram"; type DiagramSvgMode = "table" | "engineering"; diff --git a/apps/desktop/src/lib/exportFormats.ts b/apps/desktop/src/lib/export/exportFormats.ts similarity index 95% rename from apps/desktop/src/lib/exportFormats.ts rename to apps/desktop/src/lib/export/exportFormats.ts index 5b4f52c56..bb3270f9d 100644 --- a/apps/desktop/src/lib/exportFormats.ts +++ b/apps/desktop/src/lib/export/exportFormats.ts @@ -1,5 +1,5 @@ import type { DatabaseType } from "@/types/database"; -import * as api from "@/lib/api"; +import * as api from "@/lib/backend/api"; export type ExportCellValue = string | number | boolean | null; diff --git a/apps/desktop/src/lib/xlsxExport.ts b/apps/desktop/src/lib/export/xlsxExport.ts similarity index 100% rename from apps/desktop/src/lib/xlsxExport.ts rename to apps/desktop/src/lib/export/xlsxExport.ts diff --git a/apps/desktop/src/lib/historyActions.ts b/apps/desktop/src/lib/history/historyActions.ts similarity index 100% rename from apps/desktop/src/lib/historyActions.ts rename to apps/desktop/src/lib/history/historyActions.ts diff --git a/apps/desktop/src/lib/historyActivityKind.ts b/apps/desktop/src/lib/history/historyActivityKind.ts similarity index 100% rename from apps/desktop/src/lib/historyActivityKind.ts rename to apps/desktop/src/lib/history/historyActivityKind.ts diff --git a/apps/desktop/src/lib/historyAiAnalysis.ts b/apps/desktop/src/lib/history/historyAiAnalysis.ts similarity index 100% rename from apps/desktop/src/lib/historyAiAnalysis.ts rename to apps/desktop/src/lib/history/historyAiAnalysis.ts diff --git a/apps/desktop/src/lib/historyTimeRange.ts b/apps/desktop/src/lib/history/historyTimeRange.ts similarity index 100% rename from apps/desktop/src/lib/historyTimeRange.ts rename to apps/desktop/src/lib/history/historyTimeRange.ts diff --git a/apps/desktop/src/lib/historyVirtualList.ts b/apps/desktop/src/lib/history/historyVirtualList.ts similarity index 100% rename from apps/desktop/src/lib/historyVirtualList.ts rename to apps/desktop/src/lib/history/historyVirtualList.ts diff --git a/apps/desktop/src/lib/datagripImport.ts b/apps/desktop/src/lib/imports/datagripImport.ts similarity index 99% rename from apps/desktop/src/lib/datagripImport.ts rename to apps/desktop/src/lib/imports/datagripImport.ts index d7505a87f..9562d4a2e 100644 --- a/apps/desktop/src/lib/datagripImport.ts +++ b/apps/desktop/src/lib/imports/datagripImport.ts @@ -1,5 +1,5 @@ import type { ConnectionConfig, DatabaseType } from "@/types/database"; -import { uuid } from "@/lib/utils"; +import { uuid } from "@/lib/common/utils"; declare var process: { env: Record } | undefined; diff --git a/apps/desktop/src/lib/dbeaverImport.ts b/apps/desktop/src/lib/imports/dbeaverImport.ts similarity index 99% rename from apps/desktop/src/lib/dbeaverImport.ts rename to apps/desktop/src/lib/imports/dbeaverImport.ts index b1cc48817..c8ac1006c 100644 --- a/apps/desktop/src/lib/dbeaverImport.ts +++ b/apps/desktop/src/lib/imports/dbeaverImport.ts @@ -1,5 +1,5 @@ import type { ConnectionConfig, DatabaseType } from "@/types/database"; -import { uuid } from "@/lib/utils"; +import { uuid } from "@/lib/common/utils"; type PartialConnection = Omit; diff --git a/apps/desktop/src/lib/navicatImport.ts b/apps/desktop/src/lib/imports/navicatImport.ts similarity index 99% rename from apps/desktop/src/lib/navicatImport.ts rename to apps/desktop/src/lib/imports/navicatImport.ts index 0773f1bf3..e572189dd 100644 --- a/apps/desktop/src/lib/navicatImport.ts +++ b/apps/desktop/src/lib/imports/navicatImport.ts @@ -1,5 +1,5 @@ import type { ConnectionConfig, DatabaseType } from "@/types/database"; -import { uuid } from "@/lib/utils"; +import { uuid } from "@/lib/common/utils"; type PartialConnection = Omit; diff --git a/apps/desktop/src/lib/kvKeyTree.ts b/apps/desktop/src/lib/kv/kvKeyTree.ts similarity index 98% rename from apps/desktop/src/lib/kvKeyTree.ts rename to apps/desktop/src/lib/kv/kvKeyTree.ts index 26b958a59..63a3087f3 100644 --- a/apps/desktop/src/lib/kvKeyTree.ts +++ b/apps/desktop/src/lib/kv/kvKeyTree.ts @@ -1,4 +1,4 @@ -import type { KvKeySummary } from "./api"; +import type { KvKeySummary } from "@/lib/backend/api"; export interface KvKeyTreeLeafNode { kind: "leaf"; diff --git a/apps/desktop/src/lib/kvRefreshSelection.ts b/apps/desktop/src/lib/kv/kvRefreshSelection.ts similarity index 82% rename from apps/desktop/src/lib/kvRefreshSelection.ts rename to apps/desktop/src/lib/kv/kvRefreshSelection.ts index 36b30c7a4..8a41aefc5 100644 --- a/apps/desktop/src/lib/kvRefreshSelection.ts +++ b/apps/desktop/src/lib/kv/kvRefreshSelection.ts @@ -1,4 +1,4 @@ -import type { KvKeySummary } from "@/lib/api"; +import type { KvKeySummary } from "@/lib/backend/api"; export function refreshedKvSelectionKey(previousKey: string | null | undefined, refreshedKeys: readonly KvKeySummary[]): string | null { if (!previousKey) return null; diff --git a/apps/desktop/src/lib/kvRootPresentation.ts b/apps/desktop/src/lib/kv/kvRootPresentation.ts similarity index 100% rename from apps/desktop/src/lib/kvRootPresentation.ts rename to apps/desktop/src/lib/kv/kvRootPresentation.ts diff --git a/apps/desktop/src/lib/kvValueDisplay.ts b/apps/desktop/src/lib/kv/kvValueDisplay.ts similarity index 98% rename from apps/desktop/src/lib/kvValueDisplay.ts rename to apps/desktop/src/lib/kv/kvValueDisplay.ts index 953b3fd95..5a4592b70 100644 --- a/apps/desktop/src/lib/kvValueDisplay.ts +++ b/apps/desktop/src/lib/kv/kvValueDisplay.ts @@ -1,4 +1,4 @@ -import type { KvKeyMetadata } from "@/lib/api"; +import type { KvKeyMetadata } from "@/lib/backend/api"; export interface PrettyPrintJsonResult { ok: boolean; diff --git a/apps/desktop/src/lib/mcpConfigTemplates.ts b/apps/desktop/src/lib/mcp/mcpConfigTemplates.ts similarity index 100% rename from apps/desktop/src/lib/mcpConfigTemplates.ts rename to apps/desktop/src/lib/mcp/mcpConfigTemplates.ts diff --git a/apps/desktop/src/lib/completionMetadataPolicy.ts b/apps/desktop/src/lib/metadata/completionMetadataPolicy.ts similarity index 100% rename from apps/desktop/src/lib/completionMetadataPolicy.ts rename to apps/desktop/src/lib/metadata/completionMetadataPolicy.ts diff --git a/apps/desktop/src/lib/completionTreeIndex.ts b/apps/desktop/src/lib/metadata/completionTreeIndex.ts similarity index 96% rename from apps/desktop/src/lib/completionTreeIndex.ts rename to apps/desktop/src/lib/metadata/completionTreeIndex.ts index c6a4c9c0e..0754b3688 100644 --- a/apps/desktop/src/lib/completionTreeIndex.ts +++ b/apps/desktop/src/lib/metadata/completionTreeIndex.ts @@ -1,5 +1,5 @@ import type { TreeNode } from "@/types/database"; -import type { SqlCompletionTable } from "@/lib/sqlCompletion"; +import type { SqlCompletionTable } from "@/lib/sql/sqlCompletion"; const TABLE_NODE_TYPES = new Set(["table", "view", "materialized_view"]); diff --git a/apps/desktop/src/lib/metadataTaskLimiter.ts b/apps/desktop/src/lib/metadata/metadataTaskLimiter.ts similarity index 100% rename from apps/desktop/src/lib/metadataTaskLimiter.ts rename to apps/desktop/src/lib/metadata/metadataTaskLimiter.ts diff --git a/apps/desktop/src/lib/schemaTreeCache.ts b/apps/desktop/src/lib/metadata/schemaTreeCache.ts similarity index 100% rename from apps/desktop/src/lib/schemaTreeCache.ts rename to apps/desktop/src/lib/metadata/schemaTreeCache.ts diff --git a/apps/desktop/src/lib/mongoCompletion.ts b/apps/desktop/src/lib/mongo/mongoCompletion.ts similarity index 100% rename from apps/desktop/src/lib/mongoCompletion.ts rename to apps/desktop/src/lib/mongo/mongoCompletion.ts diff --git a/apps/desktop/src/lib/mongoConnectionOptions.ts b/apps/desktop/src/lib/mongo/mongoConnectionOptions.ts similarity index 100% rename from apps/desktop/src/lib/mongoConnectionOptions.ts rename to apps/desktop/src/lib/mongo/mongoConnectionOptions.ts diff --git a/apps/desktop/src/lib/mongoDocumentValues.ts b/apps/desktop/src/lib/mongo/mongoDocumentValues.ts similarity index 100% rename from apps/desktop/src/lib/mongoDocumentValues.ts rename to apps/desktop/src/lib/mongo/mongoDocumentValues.ts diff --git a/apps/desktop/src/lib/mongoFormatter.ts b/apps/desktop/src/lib/mongo/mongoFormatter.ts similarity index 99% rename from apps/desktop/src/lib/mongoFormatter.ts rename to apps/desktop/src/lib/mongo/mongoFormatter.ts index 708830495..31a5605dd 100644 --- a/apps/desktop/src/lib/mongoFormatter.ts +++ b/apps/desktop/src/lib/mongo/mongoFormatter.ts @@ -1,4 +1,4 @@ -import { DEFAULT_SQL_FORMATTER_SETTINGS, type SqlFormatterSettings } from "@/lib/sqlFormatterConfig"; +import { DEFAULT_SQL_FORMATTER_SETTINGS, type SqlFormatterSettings } from "@/lib/sql/sqlFormatterConfig"; export const MAX_MONGO_FORMAT_CHARS = 1_000_000; diff --git a/apps/desktop/src/lib/mongoShellCommand.ts b/apps/desktop/src/lib/mongo/mongoShellCommand.ts similarity index 100% rename from apps/desktop/src/lib/mongoShellCommand.ts rename to apps/desktop/src/lib/mongo/mongoShellCommand.ts diff --git a/apps/desktop/src/lib/mqPinnedVersionOptions.ts b/apps/desktop/src/lib/mq/mqPinnedVersionOptions.ts similarity index 100% rename from apps/desktop/src/lib/mqPinnedVersionOptions.ts rename to apps/desktop/src/lib/mq/mqPinnedVersionOptions.ts diff --git a/apps/desktop/src/lib/mqPolicyForms.ts b/apps/desktop/src/lib/mq/mqPolicyForms.ts similarity index 100% rename from apps/desktop/src/lib/mqPolicyForms.ts rename to apps/desktop/src/lib/mq/mqPolicyForms.ts diff --git a/apps/desktop/src/lib/mqTenantForm.ts b/apps/desktop/src/lib/mq/mqTenantForm.ts similarity index 100% rename from apps/desktop/src/lib/mqTenantForm.ts rename to apps/desktop/src/lib/mq/mqTenantForm.ts diff --git a/apps/desktop/src/lib/mqTokenErrors.ts b/apps/desktop/src/lib/mq/mqTokenErrors.ts similarity index 100% rename from apps/desktop/src/lib/mqTokenErrors.ts rename to apps/desktop/src/lib/mq/mqTokenErrors.ts diff --git a/apps/desktop/src/lib/nacosAdmin.ts b/apps/desktop/src/lib/nacos/nacosAdmin.ts similarity index 100% rename from apps/desktop/src/lib/nacosAdmin.ts rename to apps/desktop/src/lib/nacos/nacosAdmin.ts diff --git a/apps/desktop/src/lib/queryResultArchive.ts b/apps/desktop/src/lib/query/queryResultArchive.ts similarity index 98% rename from apps/desktop/src/lib/queryResultArchive.ts rename to apps/desktop/src/lib/query/queryResultArchive.ts index fd5fc5637..1d86c3379 100644 --- a/apps/desktop/src/lib/queryResultArchive.ts +++ b/apps/desktop/src/lib/query/queryResultArchive.ts @@ -1,6 +1,6 @@ import { decode, encode } from "@msgpack/msgpack"; import type { QueryTab } from "@/types/database"; -import { decodeTabResultSnapshot, encodeTabResultSnapshot, type TabResultSnapshot } from "@/lib/tabResultCache"; +import { decodeTabResultSnapshot, encodeTabResultSnapshot, type TabResultSnapshot } from "@/lib/tabs/tabResultCache"; const ARCHIVE_MAGIC = "DBX_QUERY_RESULT_ARCHIVE"; const ARCHIVE_VERSION = 1; diff --git a/apps/desktop/src/lib/queryResultArchiveFile.ts b/apps/desktop/src/lib/query/queryResultArchiveFile.ts similarity index 97% rename from apps/desktop/src/lib/queryResultArchiveFile.ts rename to apps/desktop/src/lib/query/queryResultArchiveFile.ts index 66540f04d..443ed6abf 100644 --- a/apps/desktop/src/lib/queryResultArchiveFile.ts +++ b/apps/desktop/src/lib/query/queryResultArchiveFile.ts @@ -1,4 +1,4 @@ -import { isTauriRuntime } from "@/lib/tauriRuntime"; +import { isTauriRuntime } from "@/lib/backend/tauriRuntime"; const ARCHIVE_MIME_TYPE = "application/vnd.dbx.results"; const ARCHIVE_EXTENSIONS = ["dbxresults"]; diff --git a/apps/desktop/src/lib/queryResultError.ts b/apps/desktop/src/lib/query/queryResultError.ts similarity index 100% rename from apps/desktop/src/lib/queryResultError.ts rename to apps/desktop/src/lib/query/queryResultError.ts diff --git a/apps/desktop/src/lib/redisCommandSafety.ts b/apps/desktop/src/lib/redis/redisCommandSafety.ts similarity index 100% rename from apps/desktop/src/lib/redisCommandSafety.ts rename to apps/desktop/src/lib/redis/redisCommandSafety.ts diff --git a/apps/desktop/src/lib/redisCommandSession.ts b/apps/desktop/src/lib/redis/redisCommandSession.ts similarity index 100% rename from apps/desktop/src/lib/redisCommandSession.ts rename to apps/desktop/src/lib/redis/redisCommandSession.ts diff --git a/apps/desktop/src/lib/redisCommandTable.ts b/apps/desktop/src/lib/redis/redisCommandTable.ts similarity index 99% rename from apps/desktop/src/lib/redisCommandTable.ts rename to apps/desktop/src/lib/redis/redisCommandTable.ts index e4cd55ed9..12373a5ca 100644 --- a/apps/desktop/src/lib/redisCommandTable.ts +++ b/apps/desktop/src/lib/redis/redisCommandTable.ts @@ -14,7 +14,7 @@ * * Subcommands are keyed as `"MAIN SUB"` in UPPER CASE (e.g. `"CONFIG GET"`, `"XGROUP CREATE"`). */ -import type { RedisCommandSafety } from "@/lib/redisCommandSafety"; +import type { RedisCommandSafety } from "@/lib/redis/redisCommandSafety"; export interface RedisCommandSpec { /** Token count including the command name. Positive = exact, negative = minimum (-N). */ diff --git a/apps/desktop/src/lib/redisCompletion.ts b/apps/desktop/src/lib/redis/redisCompletion.ts similarity index 98% rename from apps/desktop/src/lib/redisCompletion.ts rename to apps/desktop/src/lib/redis/redisCompletion.ts index 2b897072f..d7622bef3 100644 --- a/apps/desktop/src/lib/redisCompletion.ts +++ b/apps/desktop/src/lib/redis/redisCompletion.ts @@ -8,8 +8,8 @@ * (e.g. `"XGROUP CREATE"`). We split those into a main-name index + subcommand * index here. */ -import { REDIS_COMMAND_TABLE } from "@/lib/redisCommandTable"; -import type { RedisCommandSpec } from "@/lib/redisCommandTable"; +import { REDIS_COMMAND_TABLE } from "@/lib/redis/redisCommandTable"; +import type { RedisCommandSpec } from "@/lib/redis/redisCommandTable"; export interface RedisCompletionItem { label: string; diff --git a/apps/desktop/src/lib/redisJsonHighlighter.ts b/apps/desktop/src/lib/redis/redisJsonHighlighter.ts similarity index 96% rename from apps/desktop/src/lib/redisJsonHighlighter.ts rename to apps/desktop/src/lib/redis/redisJsonHighlighter.ts index 51dffa381..3c615cb32 100644 --- a/apps/desktop/src/lib/redisJsonHighlighter.ts +++ b/apps/desktop/src/lib/redis/redisJsonHighlighter.ts @@ -1,4 +1,4 @@ -import type { AppThemeAppearance } from "@/lib/appTheme"; +import type { AppThemeAppearance } from "@/lib/app/appTheme"; export type RedisJsonHighlighter = (content: string, appearance?: AppThemeAppearance) => string; diff --git a/apps/desktop/src/lib/redisKeyPattern.ts b/apps/desktop/src/lib/redis/redisKeyPattern.ts similarity index 100% rename from apps/desktop/src/lib/redisKeyPattern.ts rename to apps/desktop/src/lib/redis/redisKeyPattern.ts diff --git a/apps/desktop/src/lib/redisKeyTree.ts b/apps/desktop/src/lib/redis/redisKeyTree.ts similarity index 99% rename from apps/desktop/src/lib/redisKeyTree.ts rename to apps/desktop/src/lib/redis/redisKeyTree.ts index fcda732ee..841979247 100644 --- a/apps/desktop/src/lib/redisKeyTree.ts +++ b/apps/desktop/src/lib/redis/redisKeyTree.ts @@ -1,4 +1,4 @@ -import type { RedisKeyInfo } from "./api"; +import type { RedisKeyInfo } from "@/lib/backend/api"; export interface RedisKeyTreeLeafNode { kind: "leaf"; diff --git a/apps/desktop/src/lib/redisQueryResult.ts b/apps/desktop/src/lib/redis/redisQueryResult.ts similarity index 96% rename from apps/desktop/src/lib/redisQueryResult.ts rename to apps/desktop/src/lib/redis/redisQueryResult.ts index 7f188fc19..50bff260e 100644 --- a/apps/desktop/src/lib/redisQueryResult.ts +++ b/apps/desktop/src/lib/redis/redisQueryResult.ts @@ -1,5 +1,5 @@ import type { QueryResult } from "@/types/database"; -import { formatRedisCommandResult } from "@/lib/redisValuePresentation"; +import { formatRedisCommandResult } from "@/lib/redis/redisValuePresentation"; const KEY_VALUE_COMMANDS = new Set(["HGETALL"]); diff --git a/apps/desktop/src/lib/redisSyntaxDiagnostics.ts b/apps/desktop/src/lib/redis/redisSyntaxDiagnostics.ts similarity index 96% rename from apps/desktop/src/lib/redisSyntaxDiagnostics.ts rename to apps/desktop/src/lib/redis/redisSyntaxDiagnostics.ts index a29b4a3ef..9500d4690 100644 --- a/apps/desktop/src/lib/redisSyntaxDiagnostics.ts +++ b/apps/desktop/src/lib/redis/redisSyntaxDiagnostics.ts @@ -1,14 +1,14 @@ /** * Redis command syntax diagnostics for the query editor. * - * Mirrors the shape of `sqlSemanticDiagnostics.ts` so the editor's diagnostic + * Mirrors the shape of `sqlSemantic/diagnostics.ts` so the editor's diagnostic * pipeline (StateField + Decoration.mark) can render them with no extra wiring. * Diagnostics are produced per-line (one Redis command per line — matching the * execution contract in `queryStore.executeTabSql`). */ import type { SqlTextSpan } from "@/types/database"; -import type { SqlSemanticDiagnostic } from "@/lib/sqlSemanticDiagnostics"; -import { resolveRedisCommandSpec } from "@/lib/redisCommandTable"; +import type { SqlSemanticDiagnostic } from "@/lib/sql/semantic/diagnostics"; +import { resolveRedisCommandSpec } from "@/lib/redis/redisCommandTable"; export interface RedisArgvToken { /** Token text (raw, case preserved). */ diff --git a/apps/desktop/src/lib/redisValuePresentation.ts b/apps/desktop/src/lib/redis/redisValuePresentation.ts similarity index 100% rename from apps/desktop/src/lib/redisValuePresentation.ts rename to apps/desktop/src/lib/redis/redisValuePresentation.ts diff --git a/apps/desktop/src/lib/savedSqlFolderCounts.ts b/apps/desktop/src/lib/savedSql/savedSqlFolderCounts.ts similarity index 100% rename from apps/desktop/src/lib/savedSqlFolderCounts.ts rename to apps/desktop/src/lib/savedSql/savedSqlFolderCounts.ts diff --git a/apps/desktop/src/lib/savedSqlHistory.ts b/apps/desktop/src/lib/savedSql/savedSqlHistory.ts similarity index 100% rename from apps/desktop/src/lib/savedSqlHistory.ts rename to apps/desktop/src/lib/savedSql/savedSqlHistory.ts diff --git a/apps/desktop/src/lib/schemaDiff.ts b/apps/desktop/src/lib/schema/schemaDiff.ts similarity index 100% rename from apps/desktop/src/lib/schemaDiff.ts rename to apps/desktop/src/lib/schema/schemaDiff.ts diff --git a/apps/desktop/src/lib/schemaDiffMetadataLoad.ts b/apps/desktop/src/lib/schema/schemaDiffMetadataLoad.ts similarity index 100% rename from apps/desktop/src/lib/schemaDiffMetadataLoad.ts rename to apps/desktop/src/lib/schema/schemaDiffMetadataLoad.ts diff --git a/apps/desktop/src/lib/schemaDiffOptions.ts b/apps/desktop/src/lib/schema/schemaDiffOptions.ts similarity index 100% rename from apps/desktop/src/lib/schemaDiffOptions.ts rename to apps/desktop/src/lib/schema/schemaDiffOptions.ts diff --git a/apps/desktop/src/lib/schemaDiffTableFilter.ts b/apps/desktop/src/lib/schema/schemaDiffTableFilter.ts similarity index 100% rename from apps/desktop/src/lib/schemaDiffTableFilter.ts rename to apps/desktop/src/lib/schema/schemaDiffTableFilter.ts diff --git a/apps/desktop/src/lib/sidebarActiveTabTarget.ts b/apps/desktop/src/lib/sidebar/sidebarActiveTabTarget.ts similarity index 100% rename from apps/desktop/src/lib/sidebarActiveTabTarget.ts rename to apps/desktop/src/lib/sidebar/sidebarActiveTabTarget.ts diff --git a/apps/desktop/src/lib/sidebarConnectionSelection.ts b/apps/desktop/src/lib/sidebar/sidebarConnectionSelection.ts similarity index 100% rename from apps/desktop/src/lib/sidebarConnectionSelection.ts rename to apps/desktop/src/lib/sidebar/sidebarConnectionSelection.ts diff --git a/apps/desktop/src/lib/sidebarDatabaseOpenState.ts b/apps/desktop/src/lib/sidebar/sidebarDatabaseOpenState.ts similarity index 100% rename from apps/desktop/src/lib/sidebarDatabaseOpenState.ts rename to apps/desktop/src/lib/sidebar/sidebarDatabaseOpenState.ts diff --git a/apps/desktop/src/lib/sidebarLabelTooltip.ts b/apps/desktop/src/lib/sidebar/sidebarLabelTooltip.ts similarity index 100% rename from apps/desktop/src/lib/sidebarLabelTooltip.ts rename to apps/desktop/src/lib/sidebar/sidebarLabelTooltip.ts diff --git a/apps/desktop/src/lib/sidebarLayout.ts b/apps/desktop/src/lib/sidebar/sidebarLayout.ts similarity index 99% rename from apps/desktop/src/lib/sidebarLayout.ts rename to apps/desktop/src/lib/sidebar/sidebarLayout.ts index 43f3de516..ecb15758d 100644 --- a/apps/desktop/src/lib/sidebarLayout.ts +++ b/apps/desktop/src/lib/sidebar/sidebarLayout.ts @@ -1,5 +1,5 @@ import type { ConnectionConfig, ConnectionGroup, SidebarLayout, SidebarOrderEntry, TreeNode } from "@/types/database"; -import { uuid } from "@/lib/utils"; +import { uuid } from "@/lib/common/utils"; export function emptyLayout(): SidebarLayout { return { groups: [], order: [] }; diff --git a/apps/desktop/src/lib/sidebarNodeOrdering.ts b/apps/desktop/src/lib/sidebar/sidebarNodeOrdering.ts similarity index 100% rename from apps/desktop/src/lib/sidebarNodeOrdering.ts rename to apps/desktop/src/lib/sidebar/sidebarNodeOrdering.ts diff --git a/apps/desktop/src/lib/sidebarRenameFocus.ts b/apps/desktop/src/lib/sidebar/sidebarRenameFocus.ts similarity index 100% rename from apps/desktop/src/lib/sidebarRenameFocus.ts rename to apps/desktop/src/lib/sidebar/sidebarRenameFocus.ts diff --git a/apps/desktop/src/lib/sidebarSearch.ts b/apps/desktop/src/lib/sidebar/sidebarSearch.ts similarity index 96% rename from apps/desktop/src/lib/sidebarSearch.ts rename to apps/desktop/src/lib/sidebar/sidebarSearch.ts index cb9ab8fe1..3aa1b6b02 100644 --- a/apps/desktop/src/lib/sidebarSearch.ts +++ b/apps/desktop/src/lib/sidebar/sidebarSearch.ts @@ -1,4 +1,4 @@ -import { parseSlashDelimitedRegexQuery } from "@/lib/searchPattern"; +import { parseSlashDelimitedRegexQuery } from "@/lib/common/searchPattern"; export type SidebarSearchMatchKind = "exact" | "prefix" | "word-prefix" | "substring" | "abbreviation" | "fuzzy" | "regex"; diff --git a/apps/desktop/src/lib/sidebarSearchTree.ts b/apps/desktop/src/lib/sidebar/sidebarSearchTree.ts similarity index 98% rename from apps/desktop/src/lib/sidebarSearchTree.ts rename to apps/desktop/src/lib/sidebar/sidebarSearchTree.ts index 24044f00d..f30704e58 100644 --- a/apps/desktop/src/lib/sidebarSearchTree.ts +++ b/apps/desktop/src/lib/sidebar/sidebarSearchTree.ts @@ -1,5 +1,5 @@ import type { TreeNode, TreeNodeType } from "@/types/database"; -import { createSidebarLabelMatcher, type SidebarLabelMatcher } from "@/lib/sidebarSearch"; +import { createSidebarLabelMatcher, type SidebarLabelMatcher } from "@/lib/sidebar/sidebarSearch"; const preserveMatchedSubtreeTypes = new Set(["connection", "database", "schema", "table", "view"]); diff --git a/apps/desktop/src/lib/sidebarTableNameDisplay.ts b/apps/desktop/src/lib/sidebar/sidebarTableNameDisplay.ts similarity index 100% rename from apps/desktop/src/lib/sidebarTableNameDisplay.ts rename to apps/desktop/src/lib/sidebar/sidebarTableNameDisplay.ts diff --git a/apps/desktop/src/lib/sidebarTreeCollapse.ts b/apps/desktop/src/lib/sidebar/sidebarTreeCollapse.ts similarity index 100% rename from apps/desktop/src/lib/sidebarTreeCollapse.ts rename to apps/desktop/src/lib/sidebar/sidebarTreeCollapse.ts diff --git a/apps/desktop/src/lib/sidebarTreeContext.ts b/apps/desktop/src/lib/sidebar/sidebarTreeContext.ts similarity index 100% rename from apps/desktop/src/lib/sidebarTreeContext.ts rename to apps/desktop/src/lib/sidebar/sidebarTreeContext.ts diff --git a/apps/desktop/src/lib/sidebarTreeItemLayout.ts b/apps/desktop/src/lib/sidebar/sidebarTreeItemLayout.ts similarity index 100% rename from apps/desktop/src/lib/sidebarTreeItemLayout.ts rename to apps/desktop/src/lib/sidebar/sidebarTreeItemLayout.ts diff --git a/apps/desktop/src/lib/sidebarTreeSelection.ts b/apps/desktop/src/lib/sidebar/sidebarTreeSelection.ts similarity index 100% rename from apps/desktop/src/lib/sidebarTreeSelection.ts rename to apps/desktop/src/lib/sidebar/sidebarTreeSelection.ts diff --git a/apps/desktop/src/lib/sidebarTypeSearch.ts b/apps/desktop/src/lib/sidebar/sidebarTypeSearch.ts similarity index 100% rename from apps/desktop/src/lib/sidebarTypeSearch.ts rename to apps/desktop/src/lib/sidebar/sidebarTypeSearch.ts diff --git a/apps/desktop/src/lib/treeNodeClick.ts b/apps/desktop/src/lib/sidebar/treeNodeClick.ts similarity index 97% rename from apps/desktop/src/lib/treeNodeClick.ts rename to apps/desktop/src/lib/sidebar/treeNodeClick.ts index 794c5f677..ff11ce692 100644 --- a/apps/desktop/src/lib/treeNodeClick.ts +++ b/apps/desktop/src/lib/sidebar/treeNodeClick.ts @@ -1,5 +1,5 @@ import type { ObjectSourceKind, TreeNode, TreeNodeType } from "@/types/database"; -import { matchesShortcut, type ShortcutLikeEvent } from "@/lib/keyboardShortcuts"; +import { matchesShortcut, type ShortcutLikeEvent } from "@/lib/editor/keyboardShortcuts"; export type TreeNodeRowAction = "open-data" | "toggle" | "none"; export type TreeNodeRowDoubleClickAction = "open-data" | "open-object-browser" | "open-object-browser-and-expand" | "open-source" | "open-saved-sql" | "toggle" | "none"; diff --git a/apps/desktop/src/lib/treeNodeContext.ts b/apps/desktop/src/lib/sidebar/treeNodeContext.ts similarity index 100% rename from apps/desktop/src/lib/treeNodeContext.ts rename to apps/desktop/src/lib/sidebar/treeNodeContext.ts diff --git a/apps/desktop/src/lib/treeRefreshTarget.ts b/apps/desktop/src/lib/sidebar/treeRefreshTarget.ts similarity index 100% rename from apps/desktop/src/lib/treeRefreshTarget.ts rename to apps/desktop/src/lib/sidebar/treeRefreshTarget.ts diff --git a/apps/desktop/src/lib/executableStatementRangeCache.ts b/apps/desktop/src/lib/sql/executableStatementRangeCache.ts similarity index 97% rename from apps/desktop/src/lib/executableStatementRangeCache.ts rename to apps/desktop/src/lib/sql/executableStatementRangeCache.ts index 46b7f00b0..bbeee1209 100644 --- a/apps/desktop/src/lib/executableStatementRangeCache.ts +++ b/apps/desktop/src/lib/sql/executableStatementRangeCache.ts @@ -1,6 +1,6 @@ import type { Text } from "@codemirror/state"; import type { DatabaseType } from "@/types/database"; -import { executableStatementRanges, type SqlTextRange } from "@/lib/sqlStatementRanges"; +import { executableStatementRanges, type SqlTextRange } from "@/lib/sql/sqlStatementRanges"; export interface ExecutableStatementRangeCache { doc: Text; diff --git a/apps/desktop/src/lib/httpSqlFileProgress.ts b/apps/desktop/src/lib/sql/httpSqlFileProgress.ts similarity index 82% rename from apps/desktop/src/lib/httpSqlFileProgress.ts rename to apps/desktop/src/lib/sql/httpSqlFileProgress.ts index 174751f9e..04b67ae5f 100644 --- a/apps/desktop/src/lib/httpSqlFileProgress.ts +++ b/apps/desktop/src/lib/sql/httpSqlFileProgress.ts @@ -1,5 +1,5 @@ -import type { SqlFileProgress } from "./tauri"; -import { apiUrl } from "@/lib/webPath"; +import type { SqlFileProgress } from "@/lib/backend/tauri"; +import { apiUrl } from "@/lib/common/webPath"; export function listenSqlFileProgressById(executionId: string, handler: (progress: SqlFileProgress) => void): () => void { const es = new EventSource(apiUrl(`/api/sql-file/progress/${executionId}`)); diff --git a/apps/desktop/src/lib/newQueryContext.ts b/apps/desktop/src/lib/sql/newQueryContext.ts similarity index 97% rename from apps/desktop/src/lib/newQueryContext.ts rename to apps/desktop/src/lib/sql/newQueryContext.ts index f60d6f544..b52182100 100644 --- a/apps/desktop/src/lib/newQueryContext.ts +++ b/apps/desktop/src/lib/sql/newQueryContext.ts @@ -1,4 +1,4 @@ -import { resolveDefaultDatabase } from "@/lib/defaultDatabase"; +import { resolveDefaultDatabase } from "@/lib/database/defaultDatabase"; import type { ConnectionConfig, QueryTab, TreeNode } from "@/types/database"; export interface NewQueryTarget { diff --git a/apps/desktop/src/lib/queryCursorTableTarget.ts b/apps/desktop/src/lib/sql/queryCursorTableTarget.ts similarity index 95% rename from apps/desktop/src/lib/queryCursorTableTarget.ts rename to apps/desktop/src/lib/sql/queryCursorTableTarget.ts index 5f150c458..65a800da3 100644 --- a/apps/desktop/src/lib/queryCursorTableTarget.ts +++ b/apps/desktop/src/lib/sql/queryCursorTableTarget.ts @@ -1,6 +1,6 @@ -import { isSchemaAware, isSingleDatabase } from "@/lib/databaseFeatureSupport"; -import { isSqlKeyword } from "@/lib/sqlNavigation"; -import type { ActiveTabSidebarTarget } from "@/lib/sidebarActiveTabTarget"; +import { isSchemaAware, isSingleDatabase } from "@/lib/database/databaseFeatureSupport"; +import { isSqlKeyword } from "@/lib/sql/sqlNavigation"; +import type { ActiveTabSidebarTarget } from "@/lib/sidebar/sidebarActiveTabTarget"; import type { DatabaseType, QueryTab, TreeNode } from "@/types/database"; export interface QueryCursorTableCandidate { diff --git a/apps/desktop/src/lib/queryExecutionState.ts b/apps/desktop/src/lib/sql/queryExecutionState.ts similarity index 100% rename from apps/desktop/src/lib/queryExecutionState.ts rename to apps/desktop/src/lib/sql/queryExecutionState.ts diff --git a/apps/desktop/src/lib/queryTimeout.ts b/apps/desktop/src/lib/sql/queryTimeout.ts similarity index 91% rename from apps/desktop/src/lib/queryTimeout.ts rename to apps/desktop/src/lib/sql/queryTimeout.ts index 9b409d10e..3b6c5e47c 100644 --- a/apps/desktop/src/lib/queryTimeout.ts +++ b/apps/desktop/src/lib/sql/queryTimeout.ts @@ -1,4 +1,4 @@ -import { splitSqlStatementRanges } from "@/lib/sqlStatementRanges"; +import { splitSqlStatementRanges } from "@/lib/sql/sqlStatementRanges"; import type { ConnectionConfig, DatabaseType } from "@/types/database"; export const DEFAULT_QUERY_TIMEOUT_SECS = 30; diff --git a/apps/desktop/src/lib/sql/semantic/README.md b/apps/desktop/src/lib/sql/semantic/README.md new file mode 100644 index 000000000..638ab2909 --- /dev/null +++ b/apps/desktop/src/lib/sql/semantic/README.md @@ -0,0 +1,13 @@ +# SQL Semantic + +This directory owns the pure frontend SQL semantic layer used by editor completion, diagnostics, and navigation. + +- `tokens.ts`: span-preserving SQL tokenization and active statement detection. +- `dialect.ts`: dialect adapters for identifier normalization, quoting, qualifier roles, and projection alias visibility. +- `model.ts`: active-statement semantic model, row-source parsing, cursor intent, and confidence/fallback output. +- `completion.ts`: compatibility adapter from semantic intent to the existing SQL completion item builder. +- `references.ts`: shared row-source references for completion, diagnostics, and navigation. +- `diagnostics.ts`: SQL semantic diagnostic helpers and viewport range selection. +- `fixtures.ts` and `types.ts`: test fixtures and shared semantic types. + +The older `sqlCompletion.ts` and `sqlNavigation.ts` files remain at `lib/` for now because they are broad public editor utilities. Move them only with a separate behavior-preserving migration. diff --git a/apps/desktop/src/lib/sqlSemanticCompletion.ts b/apps/desktop/src/lib/sql/semantic/completion.ts similarity index 98% rename from apps/desktop/src/lib/sqlSemanticCompletion.ts rename to apps/desktop/src/lib/sql/semantic/completion.ts index 50abe408b..f60ea7332 100644 --- a/apps/desktop/src/lib/sqlSemanticCompletion.ts +++ b/apps/desktop/src/lib/sql/semantic/completion.ts @@ -1,6 +1,6 @@ -import type { SqlCompletionColumn, SqlCompletionContext, SqlCompletionReferencedTable } from "@/lib/sqlCompletion"; -import { SQL_SEMANTIC_DIALECTS } from "@/lib/sqlSemanticDialect"; -import type { SqlSemanticModel, SqlSemanticRowSource } from "@/lib/sqlSemanticTypes"; +import type { SqlCompletionColumn, SqlCompletionContext, SqlCompletionReferencedTable } from "@/lib/sql/sqlCompletion"; +import { SQL_SEMANTIC_DIALECTS } from "@/lib/sql/semantic/dialect"; +import type { SqlSemanticModel, SqlSemanticRowSource } from "@/lib/sql/semantic/types"; export type SqlSemanticCompletionScopeKind = "keyword" | "table" | "schema" | "catalog" | "routine" | "columns" | "local"; diff --git a/apps/desktop/src/lib/sqlSemanticDiagnostics.ts b/apps/desktop/src/lib/sql/semantic/diagnostics.ts similarity index 99% rename from apps/desktop/src/lib/sqlSemanticDiagnostics.ts rename to apps/desktop/src/lib/sql/semantic/diagnostics.ts index 23c98eb46..df063889a 100644 --- a/apps/desktop/src/lib/sqlSemanticDiagnostics.ts +++ b/apps/desktop/src/lib/sql/semantic/diagnostics.ts @@ -1,6 +1,6 @@ -import type { SqlCompletionColumn, SqlCompletionTable } from "@/lib/sqlCompletion"; -import { getSqlCompletionContext } from "@/lib/sqlCompletion"; -import { executableStatementRanges, isOraclePlSqlStatement, type SqlTextRange } from "@/lib/sqlStatementRanges"; +import type { SqlCompletionColumn, SqlCompletionTable } from "@/lib/sql/sqlCompletion"; +import { getSqlCompletionContext } from "@/lib/sql/sqlCompletion"; +import { executableStatementRanges, isOraclePlSqlStatement, type SqlTextRange } from "@/lib/sql/sqlStatementRanges"; import type { DatabaseType, SqlColumnReference, SqlReferenceAnalysis, SqlReferenceScope, SqlTableReference, SqlTextSpan } from "@/types/database"; export interface SqlSemanticDiagnostic { diff --git a/apps/desktop/src/lib/sqlSemanticDialect.ts b/apps/desktop/src/lib/sql/semantic/dialect.ts similarity index 100% rename from apps/desktop/src/lib/sqlSemanticDialect.ts rename to apps/desktop/src/lib/sql/semantic/dialect.ts diff --git a/apps/desktop/src/lib/sqlSemanticFixtures.ts b/apps/desktop/src/lib/sql/semantic/fixtures.ts similarity index 97% rename from apps/desktop/src/lib/sqlSemanticFixtures.ts rename to apps/desktop/src/lib/sql/semantic/fixtures.ts index 1ecb28a7f..dd145756b 100644 --- a/apps/desktop/src/lib/sqlSemanticFixtures.ts +++ b/apps/desktop/src/lib/sql/semantic/fixtures.ts @@ -1,5 +1,5 @@ -import type { SqlSemanticCompletionScopeKind } from "@/lib/sqlSemanticCompletion"; -import type { SqlSemanticConfidence, SqlSemanticCursorKind, SqlSemanticStatementKind } from "@/lib/sqlSemanticTypes"; +import type { SqlSemanticCompletionScopeKind } from "@/lib/sql/semantic/completion"; +import type { SqlSemanticConfidence, SqlSemanticCursorKind, SqlSemanticStatementKind } from "@/lib/sql/semantic/types"; export interface SqlSemanticFixture { name: string; diff --git a/apps/desktop/src/lib/sqlSemanticModel.ts b/apps/desktop/src/lib/sql/semantic/model.ts similarity index 99% rename from apps/desktop/src/lib/sqlSemanticModel.ts rename to apps/desktop/src/lib/sql/semantic/model.ts index 2bf4d21e1..a52ead787 100644 --- a/apps/desktop/src/lib/sqlSemanticModel.ts +++ b/apps/desktop/src/lib/sql/semantic/model.ts @@ -1,5 +1,5 @@ -import { sqlSemanticDialectFor, type SqlSemanticDialectAdapter } from "@/lib/sqlSemanticDialect"; -import { findActiveSqlStatementSpan, isSuppressedSqlSemanticContext, tokenIsIdentifier, tokenizeSqlSemantic, unquoteSqlSemanticIdentifier } from "@/lib/sqlSemanticTokens"; +import { sqlSemanticDialectFor, type SqlSemanticDialectAdapter } from "@/lib/sql/semantic/dialect"; +import { findActiveSqlStatementSpan, isSuppressedSqlSemanticContext, tokenIsIdentifier, tokenizeSqlSemantic, unquoteSqlSemanticIdentifier } from "@/lib/sql/semantic/tokens"; import type { SqlSemanticBuildOptions, SqlSemanticClauseSpans, @@ -14,7 +14,7 @@ import type { SqlSemanticStatement, SqlSemanticStatementKind, SqlSemanticToken, -} from "@/lib/sqlSemanticTypes"; +} from "@/lib/sql/semantic/types"; const TABLE_INTRODUCERS = new Set(["from", "join", "update", "into", "using", "apply"]); const JOIN_MODIFIERS = new Set(["left", "right", "inner", "outer", "cross", "full", "natural"]); diff --git a/apps/desktop/src/lib/sqlSemanticReferences.ts b/apps/desktop/src/lib/sql/semantic/references.ts similarity index 98% rename from apps/desktop/src/lib/sqlSemanticReferences.ts rename to apps/desktop/src/lib/sql/semantic/references.ts index a39a7738f..391840754 100644 --- a/apps/desktop/src/lib/sqlSemanticReferences.ts +++ b/apps/desktop/src/lib/sql/semantic/references.ts @@ -1,5 +1,5 @@ -import type { SqlCompletionReferencedTable } from "@/lib/sqlCompletion"; -import type { SqlSemanticModel, SqlSemanticRowSource, SqlSemanticSpan } from "@/lib/sqlSemanticTypes"; +import type { SqlCompletionReferencedTable } from "@/lib/sql/sqlCompletion"; +import type { SqlSemanticModel, SqlSemanticRowSource, SqlSemanticSpan } from "@/lib/sql/semantic/types"; import type { SqlReferenceAnalysis, SqlTableReference, SqlTextSpan } from "@/types/database"; export type SqlSemanticTableReference = SqlTableReference & { diff --git a/apps/desktop/src/lib/sqlSemanticTokens.ts b/apps/desktop/src/lib/sql/semantic/tokens.ts similarity index 99% rename from apps/desktop/src/lib/sqlSemanticTokens.ts rename to apps/desktop/src/lib/sql/semantic/tokens.ts index 02dbbd0b7..7182ba976 100644 --- a/apps/desktop/src/lib/sqlSemanticTokens.ts +++ b/apps/desktop/src/lib/sql/semantic/tokens.ts @@ -1,4 +1,4 @@ -import type { SqlSemanticSpan, SqlSemanticToken } from "@/lib/sqlSemanticTypes"; +import type { SqlSemanticSpan, SqlSemanticToken } from "@/lib/sql/semantic/types"; const WORD_START = /[A-Za-z_@$#]/; const WORD_PART = /[A-Za-z0-9_@$#]/; diff --git a/apps/desktop/src/lib/sqlSemanticTypes.ts b/apps/desktop/src/lib/sql/semantic/types.ts similarity index 100% rename from apps/desktop/src/lib/sqlSemanticTypes.ts rename to apps/desktop/src/lib/sql/semantic/types.ts diff --git a/apps/desktop/src/lib/sqlAnalysis.ts b/apps/desktop/src/lib/sql/sqlAnalysis.ts similarity index 100% rename from apps/desktop/src/lib/sqlAnalysis.ts rename to apps/desktop/src/lib/sql/sqlAnalysis.ts diff --git a/apps/desktop/src/lib/sqlCompletion.ts b/apps/desktop/src/lib/sql/sqlCompletion.ts similarity index 99% rename from apps/desktop/src/lib/sqlCompletion.ts rename to apps/desktop/src/lib/sql/sqlCompletion.ts index 21d147389..fd76416b3 100644 --- a/apps/desktop/src/lib/sqlCompletion.ts +++ b/apps/desktop/src/lib/sql/sqlCompletion.ts @@ -1,5 +1,5 @@ import type { DatabaseType, SqlSnippet } from "@/types/database"; -import { buildMongoCompletionItemsFromContext, type MongoCompletionItem } from "@/lib/mongoCompletion"; +import { buildMongoCompletionItemsFromContext, type MongoCompletionItem } from "@/lib/mongo/mongoCompletion"; const SQL_KEYWORDS = [ "SELECT", diff --git a/apps/desktop/src/lib/sqlDiagnostics.ts b/apps/desktop/src/lib/sql/sqlDiagnostics.ts similarity index 100% rename from apps/desktop/src/lib/sqlDiagnostics.ts rename to apps/desktop/src/lib/sql/sqlDiagnostics.ts diff --git a/apps/desktop/src/lib/sqlExecutionTarget.ts b/apps/desktop/src/lib/sql/sqlExecutionTarget.ts similarity index 98% rename from apps/desktop/src/lib/sqlExecutionTarget.ts rename to apps/desktop/src/lib/sql/sqlExecutionTarget.ts index 8bb5555a6..789812adf 100644 --- a/apps/desktop/src/lib/sqlExecutionTarget.ts +++ b/apps/desktop/src/lib/sql/sqlExecutionTarget.ts @@ -1,4 +1,4 @@ -import * as api from "./api"; +import * as api from "@/lib/backend/api"; import type { DatabaseType } from "@/types/database"; export type ExecuteMode = "all" | "current"; diff --git a/apps/desktop/src/lib/sqlFileOpen.ts b/apps/desktop/src/lib/sql/sqlFileOpen.ts similarity index 100% rename from apps/desktop/src/lib/sqlFileOpen.ts rename to apps/desktop/src/lib/sql/sqlFileOpen.ts diff --git a/apps/desktop/src/lib/sqlFormatter.ts b/apps/desktop/src/lib/sql/sqlFormatter.ts similarity index 98% rename from apps/desktop/src/lib/sqlFormatter.ts rename to apps/desktop/src/lib/sql/sqlFormatter.ts index 69d06a393..cf7d7a2bc 100644 --- a/apps/desktop/src/lib/sqlFormatter.ts +++ b/apps/desktop/src/lib/sql/sqlFormatter.ts @@ -1,4 +1,4 @@ -import { DEFAULT_SQL_FORMATTER_SETTINGS, sqlFormatterOptions, type SqlFormatterSettings } from "@/lib/sqlFormatterConfig"; +import { DEFAULT_SQL_FORMATTER_SETTINGS, sqlFormatterOptions, type SqlFormatterSettings } from "@/lib/sql/sqlFormatterConfig"; export type SqlFormatDialect = "mysql" | "postgres" | "sqlite" | "sqlserver" | "generic"; diff --git a/apps/desktop/src/lib/sqlFormatterConfig.ts b/apps/desktop/src/lib/sql/sqlFormatterConfig.ts similarity index 100% rename from apps/desktop/src/lib/sqlFormatterConfig.ts rename to apps/desktop/src/lib/sql/sqlFormatterConfig.ts diff --git a/apps/desktop/src/lib/sqlHighlighter.ts b/apps/desktop/src/lib/sql/sqlHighlighter.ts similarity index 97% rename from apps/desktop/src/lib/sqlHighlighter.ts rename to apps/desktop/src/lib/sql/sqlHighlighter.ts index ef9116bec..edd8a4a6b 100644 --- a/apps/desktop/src/lib/sqlHighlighter.ts +++ b/apps/desktop/src/lib/sql/sqlHighlighter.ts @@ -1,4 +1,4 @@ -import type { AppThemeAppearance } from "@/lib/appTheme"; +import type { AppThemeAppearance } from "@/lib/app/appTheme"; export type SqlHighlighter = (content: string, appearance?: AppThemeAppearance) => string; diff --git a/apps/desktop/src/lib/sqlMetadataRefresh.ts b/apps/desktop/src/lib/sql/sqlMetadataRefresh.ts similarity index 100% rename from apps/desktop/src/lib/sqlMetadataRefresh.ts rename to apps/desktop/src/lib/sql/sqlMetadataRefresh.ts diff --git a/apps/desktop/src/lib/sqlNavigation.ts b/apps/desktop/src/lib/sql/sqlNavigation.ts similarity index 100% rename from apps/desktop/src/lib/sqlNavigation.ts rename to apps/desktop/src/lib/sql/sqlNavigation.ts diff --git a/apps/desktop/src/lib/sqlParameterHistory.ts b/apps/desktop/src/lib/sql/sqlParameterHistory.ts similarity index 96% rename from apps/desktop/src/lib/sqlParameterHistory.ts rename to apps/desktop/src/lib/sql/sqlParameterHistory.ts index 7cca36c8a..c5b339b91 100644 --- a/apps/desktop/src/lib/sqlParameterHistory.ts +++ b/apps/desktop/src/lib/sql/sqlParameterHistory.ts @@ -1,5 +1,5 @@ -import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/safeStorage"; -import type { SqlParameterInput } from "@/lib/sqlParameters"; +import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/backend/safeStorage"; +import type { SqlParameterInput } from "@/lib/sql/sqlParameters"; const STORAGE_KEY = "dbx-sql-parameter-history"; export const MAX_SQL_PARAMETER_HISTORY = 8; diff --git a/apps/desktop/src/lib/sqlParameters.ts b/apps/desktop/src/lib/sql/sqlParameters.ts similarity index 100% rename from apps/desktop/src/lib/sqlParameters.ts rename to apps/desktop/src/lib/sql/sqlParameters.ts diff --git a/apps/desktop/src/lib/sqlQuoteCaret.ts b/apps/desktop/src/lib/sql/sqlQuoteCaret.ts similarity index 100% rename from apps/desktop/src/lib/sqlQuoteCaret.ts rename to apps/desktop/src/lib/sql/sqlQuoteCaret.ts diff --git a/apps/desktop/src/lib/sqlServerQueryWrapping.ts b/apps/desktop/src/lib/sql/sqlServerQueryWrapping.ts similarity index 100% rename from apps/desktop/src/lib/sqlServerQueryWrapping.ts rename to apps/desktop/src/lib/sql/sqlServerQueryWrapping.ts diff --git a/apps/desktop/src/lib/sqlStatementRanges.ts b/apps/desktop/src/lib/sql/sqlStatementRanges.ts similarity index 99% rename from apps/desktop/src/lib/sqlStatementRanges.ts rename to apps/desktop/src/lib/sql/sqlStatementRanges.ts index ffbc0e604..ec4f97d8b 100644 --- a/apps/desktop/src/lib/sqlStatementRanges.ts +++ b/apps/desktop/src/lib/sql/sqlStatementRanges.ts @@ -1,5 +1,5 @@ -import type { SqlExecutionCandidate } from "./sqlExecutionTarget"; -import { splitMongoCommandRanges } from "./mongoShellCommand"; +import type { SqlExecutionCandidate } from "@/lib/sql/sqlExecutionTarget"; +import { splitMongoCommandRanges } from "@/lib/mongo/mongoShellCommand"; import type { DatabaseType } from "@/types/database"; /** diff --git a/apps/desktop/src/lib/objectBrowserRows.ts b/apps/desktop/src/lib/table/objectBrowserRows.ts similarity index 98% rename from apps/desktop/src/lib/objectBrowserRows.ts rename to apps/desktop/src/lib/table/objectBrowserRows.ts index 7606cdd4c..8b17d2c25 100644 --- a/apps/desktop/src/lib/objectBrowserRows.ts +++ b/apps/desktop/src/lib/table/objectBrowserRows.ts @@ -1,6 +1,6 @@ import type { ObjectInfo } from "@/types/database"; -import { createDatabaseObjectNameComparator, normalizeDatabaseObjectName } from "@/lib/tableTree"; -import { parseSlashDelimitedRegexQuery } from "@/lib/searchPattern"; +import { createDatabaseObjectNameComparator, normalizeDatabaseObjectName } from "@/lib/table/tableTree"; +import { parseSlashDelimitedRegexQuery } from "@/lib/common/searchPattern"; export type ObjectBrowserRow = { id: string; diff --git a/apps/desktop/src/lib/objectRenameSql.ts b/apps/desktop/src/lib/table/objectRenameSql.ts similarity index 97% rename from apps/desktop/src/lib/objectRenameSql.ts rename to apps/desktop/src/lib/table/objectRenameSql.ts index 37d4517c1..226fd7f98 100644 --- a/apps/desktop/src/lib/objectRenameSql.ts +++ b/apps/desktop/src/lib/table/objectRenameSql.ts @@ -1,5 +1,5 @@ import type { DatabaseObjectType, DatabaseType } from "@/types/database"; -import * as api from "@/lib/api"; +import * as api from "@/lib/backend/api"; export type RenameableObjectType = DatabaseObjectType; diff --git a/apps/desktop/src/lib/objectSourceEditor.ts b/apps/desktop/src/lib/table/objectSourceEditor.ts similarity index 97% rename from apps/desktop/src/lib/objectSourceEditor.ts rename to apps/desktop/src/lib/table/objectSourceEditor.ts index 75bc84a23..c56db0377 100644 --- a/apps/desktop/src/lib/objectSourceEditor.ts +++ b/apps/desktop/src/lib/table/objectSourceEditor.ts @@ -1,5 +1,5 @@ import type { DatabaseType, ObjectSourceKind } from "@/types/database"; -import * as api from "@/lib/api"; +import * as api from "@/lib/backend/api"; export type BuildEditableObjectSourceSqlInput = { databaseType: DatabaseType; diff --git a/apps/desktop/src/lib/routineExecutionSql.ts b/apps/desktop/src/lib/table/routineExecutionSql.ts similarity index 97% rename from apps/desktop/src/lib/routineExecutionSql.ts rename to apps/desktop/src/lib/table/routineExecutionSql.ts index 7899f212c..a2b2d3472 100644 --- a/apps/desktop/src/lib/routineExecutionSql.ts +++ b/apps/desktop/src/lib/table/routineExecutionSql.ts @@ -1,6 +1,6 @@ import type { DatabaseType } from "@/types/database"; -import { isSchemaAware } from "./databaseCapabilities"; -import { quoteTableIdentifier } from "./tableSelectSql"; +import { isSchemaAware } from "@/lib/database/databaseCapabilities"; +import { quoteTableIdentifier } from "@/lib/table/tableSelectSql"; export interface BuildRoutineExecutionSqlOptions { databaseType?: DatabaseType; diff --git a/apps/desktop/src/lib/routineParameters.ts b/apps/desktop/src/lib/table/routineParameters.ts similarity index 98% rename from apps/desktop/src/lib/routineParameters.ts rename to apps/desktop/src/lib/table/routineParameters.ts index 5fe6f6345..4776f1036 100644 --- a/apps/desktop/src/lib/routineParameters.ts +++ b/apps/desktop/src/lib/table/routineParameters.ts @@ -1,6 +1,6 @@ -import * as api from "@/lib/api"; +import * as api from "@/lib/backend/api"; import type { DatabaseType, QueryResult } from "@/types/database"; -import type { RoutineParameter, RoutineParameterMode } from "./routineExecutionSql"; +import type { RoutineParameter, RoutineParameterMode } from "@/lib/table/routineExecutionSql"; export interface LoadRoutineParametersOptions { connectionId: string; diff --git a/apps/desktop/src/lib/tableClipboard.ts b/apps/desktop/src/lib/table/tableClipboard.ts similarity index 100% rename from apps/desktop/src/lib/tableClipboard.ts rename to apps/desktop/src/lib/table/tableClipboard.ts diff --git a/apps/desktop/src/lib/tableColumnTemplates.ts b/apps/desktop/src/lib/table/tableColumnTemplates.ts similarity index 95% rename from apps/desktop/src/lib/tableColumnTemplates.ts rename to apps/desktop/src/lib/table/tableColumnTemplates.ts index fc633e72d..518a9361c 100644 --- a/apps/desktop/src/lib/tableColumnTemplates.ts +++ b/apps/desktop/src/lib/table/tableColumnTemplates.ts @@ -1,7 +1,7 @@ import type { DatabaseType } from "@/types/database"; -import type { EditableStructureColumn } from "@/lib/tableStructureEditorSql"; -import { manifestDatabaseTypes } from "@/lib/databaseDriverManifest"; -import { getTableStructureCapabilities } from "@/lib/tableStructureCapabilities"; +import type { EditableStructureColumn } from "@/lib/table/tableStructureEditorSql"; +import { manifestDatabaseTypes } from "@/lib/database/databaseDriverManifest"; +import { getTableStructureCapabilities } from "@/lib/table/tableStructureCapabilities"; export interface TableColumnTemplate { id: string; diff --git a/apps/desktop/src/lib/tableDataExport.ts b/apps/desktop/src/lib/table/tableDataExport.ts similarity index 91% rename from apps/desktop/src/lib/tableDataExport.ts rename to apps/desktop/src/lib/table/tableDataExport.ts index 688c87998..06619062d 100644 --- a/apps/desktop/src/lib/tableDataExport.ts +++ b/apps/desktop/src/lib/table/tableDataExport.ts @@ -1,5 +1,5 @@ -import type { DatabaseType, QueryResult } from "../types/database.ts"; -import { buildTableSelectSql } from "./tableSelectSql.ts"; +import type { DatabaseType, QueryResult } from "@/types/database.ts"; +import { buildTableSelectSql } from "@/lib/table/tableSelectSql.ts"; export const TABLE_DATA_EXPORT_PAGE_SIZE = 10_000; diff --git a/apps/desktop/src/lib/tableDataTabMeta.ts b/apps/desktop/src/lib/table/tableDataTabMeta.ts similarity index 100% rename from apps/desktop/src/lib/tableDataTabMeta.ts rename to apps/desktop/src/lib/table/tableDataTabMeta.ts diff --git a/apps/desktop/src/lib/tableDependencySort.ts b/apps/desktop/src/lib/table/tableDependencySort.ts similarity index 100% rename from apps/desktop/src/lib/tableDependencySort.ts rename to apps/desktop/src/lib/table/tableDependencySort.ts diff --git a/apps/desktop/src/lib/tableEditing.ts b/apps/desktop/src/lib/table/tableEditing.ts similarity index 98% rename from apps/desktop/src/lib/tableEditing.ts rename to apps/desktop/src/lib/table/tableEditing.ts index 7f426e8dc..4fc488519 100644 --- a/apps/desktop/src/lib/tableEditing.ts +++ b/apps/desktop/src/lib/table/tableEditing.ts @@ -1,5 +1,5 @@ import type { ColumnInfo, DatabaseType, IndexInfo } from "@/types/database"; -import { getDatabaseCapability } from "./databaseCapabilities"; +import { getDatabaseCapability } from "@/lib/database/databaseCapabilities"; export const DBX_ROWID_COLUMN = "__DBX_ROWID"; export const DBX_NEO4J_ELEMENT_ID_COLUMN = "__DBX_ELEMENT_ID"; diff --git a/apps/desktop/src/lib/tableImport.ts b/apps/desktop/src/lib/table/tableImport.ts similarity index 100% rename from apps/desktop/src/lib/tableImport.ts rename to apps/desktop/src/lib/table/tableImport.ts diff --git a/apps/desktop/src/lib/tableMetadataCapabilities.ts b/apps/desktop/src/lib/table/tableMetadataCapabilities.ts similarity index 100% rename from apps/desktop/src/lib/tableMetadataCapabilities.ts rename to apps/desktop/src/lib/table/tableMetadataCapabilities.ts diff --git a/apps/desktop/src/lib/tableOpenPageLimit.ts b/apps/desktop/src/lib/table/tableOpenPageLimit.ts similarity index 90% rename from apps/desktop/src/lib/tableOpenPageLimit.ts rename to apps/desktop/src/lib/table/tableOpenPageLimit.ts index e44b6fb51..1edf5b065 100644 --- a/apps/desktop/src/lib/tableOpenPageLimit.ts +++ b/apps/desktop/src/lib/table/tableOpenPageLimit.ts @@ -1,4 +1,4 @@ -import { DEFAULT_RESULT_PAGE_SIZE, normalizeResultPageSize } from "@/lib/paginationPageSize"; +import { DEFAULT_RESULT_PAGE_SIZE, normalizeResultPageSize } from "@/lib/dataGrid/paginationPageSize"; export const DEFAULT_TABLE_OPEN_PAGE_LIMIT = DEFAULT_RESULT_PAGE_SIZE; diff --git a/apps/desktop/src/lib/tableSelectSql.ts b/apps/desktop/src/lib/table/tableSelectSql.ts similarity index 91% rename from apps/desktop/src/lib/tableSelectSql.ts rename to apps/desktop/src/lib/table/tableSelectSql.ts index 852d55305..690312c7a 100644 --- a/apps/desktop/src/lib/tableSelectSql.ts +++ b/apps/desktop/src/lib/table/tableSelectSql.ts @@ -1,7 +1,7 @@ -import type { DatabaseType } from "../types/database.ts"; -import { isSchemaAware, usesDatabaseObjectTreeMode } from "./databaseCapabilities.ts"; -import * as api from "./api.ts"; -import { parseSqlServerLinkedSchema, sqlServerLinkedTableName } from "./sqlServerLinkedServers.ts"; +import type { DatabaseType } from "@/types/database.ts"; +import { isSchemaAware, usesDatabaseObjectTreeMode } from "@/lib/database/databaseCapabilities.ts"; +import * as api from "@/lib/backend/api.ts"; +import { parseSqlServerLinkedSchema, sqlServerLinkedTableName } from "@/lib/database/sqlServerLinkedServers.ts"; export interface BuildTableSelectSqlOptions { databaseType?: DatabaseType; diff --git a/apps/desktop/src/lib/tableSqlTemplates.ts b/apps/desktop/src/lib/table/tableSqlTemplates.ts similarity index 99% rename from apps/desktop/src/lib/tableSqlTemplates.ts rename to apps/desktop/src/lib/table/tableSqlTemplates.ts index 0b5bf42b9..0446e74e6 100644 --- a/apps/desktop/src/lib/tableSqlTemplates.ts +++ b/apps/desktop/src/lib/table/tableSqlTemplates.ts @@ -1,5 +1,5 @@ import type { ColumnInfo, DatabaseType } from "@/types/database"; -import { qualifiedTableName, quoteTableIdentifier } from "@/lib/tableSelectSql"; +import { qualifiedTableName, quoteTableIdentifier } from "@/lib/table/tableSelectSql"; export interface TableSqlTemplateOptions { databaseType?: DatabaseType; diff --git a/apps/desktop/src/lib/tableStructureCapabilities.ts b/apps/desktop/src/lib/table/tableStructureCapabilities.ts similarity index 100% rename from apps/desktop/src/lib/tableStructureCapabilities.ts rename to apps/desktop/src/lib/table/tableStructureCapabilities.ts diff --git a/apps/desktop/src/lib/tableStructureEditorSql.ts b/apps/desktop/src/lib/table/tableStructureEditorSql.ts similarity index 97% rename from apps/desktop/src/lib/tableStructureEditorSql.ts rename to apps/desktop/src/lib/table/tableStructureEditorSql.ts index 97e4883b4..d31560eea 100644 --- a/apps/desktop/src/lib/tableStructureEditorSql.ts +++ b/apps/desktop/src/lib/table/tableStructureEditorSql.ts @@ -1,4 +1,4 @@ -import type { ColumnInfo, DatabaseType, ForeignKeyInfo, IndexInfo, TriggerInfo } from "../types/database.ts"; +import type { ColumnInfo, DatabaseType, ForeignKeyInfo, IndexInfo, TriggerInfo } from "@/types/database.ts"; export interface ColumnIdentity { generation?: "BY DEFAULT" | "ALWAYS"; diff --git a/apps/desktop/src/lib/tableStructureEditorState.ts b/apps/desktop/src/lib/table/tableStructureEditorState.ts similarity index 99% rename from apps/desktop/src/lib/tableStructureEditorState.ts rename to apps/desktop/src/lib/table/tableStructureEditorState.ts index 583263af2..ccbb17450 100644 --- a/apps/desktop/src/lib/tableStructureEditorState.ts +++ b/apps/desktop/src/lib/table/tableStructureEditorState.ts @@ -1,5 +1,5 @@ -import type { ColumnInfo, DatabaseType, ForeignKeyInfo, IndexInfo, TriggerInfo } from "../types/database.ts"; -import type { ColumnExtra, EditableStructureColumn, EditableStructureForeignKey, EditableStructureIndex, EditableStructureTrigger } from "./tableStructureEditorSql.ts"; +import type { ColumnInfo, DatabaseType, ForeignKeyInfo, IndexInfo, TriggerInfo } from "@/types/database.ts"; +import type { ColumnExtra, EditableStructureColumn, EditableStructureForeignKey, EditableStructureIndex, EditableStructureTrigger } from "@/lib/table/tableStructureEditorSql.ts"; export const DATA_TYPE_OPTIONS: Record = { mysql: [ diff --git a/apps/desktop/src/lib/tableTree.ts b/apps/desktop/src/lib/table/tableTree.ts similarity index 99% rename from apps/desktop/src/lib/tableTree.ts rename to apps/desktop/src/lib/table/tableTree.ts index d20b0ddc3..8c725f936 100644 --- a/apps/desktop/src/lib/tableTree.ts +++ b/apps/desktop/src/lib/table/tableTree.ts @@ -1,5 +1,5 @@ import type { ObjectInfo, TableInfo, TreeNode, TreeNodeType } from "@/types/database"; -import { normalizeSidebarObjectKind, type SidebarObjectKind } from "@/lib/databaseObjectCapabilities"; +import { normalizeSidebarObjectKind, type SidebarObjectKind } from "@/lib/database/databaseObjectCapabilities"; const databaseObjectNameCollator = new Intl.Collator(undefined, { numeric: true, sensitivity: "base" }); diff --git a/apps/desktop/src/lib/viewDdl.ts b/apps/desktop/src/lib/table/viewDdl.ts similarity index 87% rename from apps/desktop/src/lib/viewDdl.ts rename to apps/desktop/src/lib/table/viewDdl.ts index 9ec068672..7eed0c814 100644 --- a/apps/desktop/src/lib/viewDdl.ts +++ b/apps/desktop/src/lib/table/viewDdl.ts @@ -1,5 +1,5 @@ import type { DatabaseType } from "@/types/database"; -import * as api from "@/lib/api"; +import * as api from "@/lib/backend/api"; export type BuildViewDdlInput = { databaseType?: DatabaseType; diff --git a/apps/desktop/src/lib/dataTabActivation.ts b/apps/desktop/src/lib/tabs/dataTabActivation.ts similarity index 100% rename from apps/desktop/src/lib/dataTabActivation.ts rename to apps/desktop/src/lib/tabs/dataTabActivation.ts diff --git a/apps/desktop/src/lib/tabCloseActions.ts b/apps/desktop/src/lib/tabs/tabCloseActions.ts similarity index 100% rename from apps/desktop/src/lib/tabCloseActions.ts rename to apps/desktop/src/lib/tabs/tabCloseActions.ts diff --git a/apps/desktop/src/lib/tabPresentation.ts b/apps/desktop/src/lib/tabs/tabPresentation.ts similarity index 100% rename from apps/desktop/src/lib/tabPresentation.ts rename to apps/desktop/src/lib/tabs/tabPresentation.ts diff --git a/apps/desktop/src/lib/tabResultCache.ts b/apps/desktop/src/lib/tabs/tabResultCache.ts similarity index 99% rename from apps/desktop/src/lib/tabResultCache.ts rename to apps/desktop/src/lib/tabs/tabResultCache.ts index 9ed1594d7..1826cc652 100644 --- a/apps/desktop/src/lib/tabResultCache.ts +++ b/apps/desktop/src/lib/tabs/tabResultCache.ts @@ -1,8 +1,8 @@ import type { QueryResult, QueryTab } from "@/types/database"; import { decode, encode } from "@msgpack/msgpack"; import { toRaw } from "vue"; -import { isTauriRuntime } from "@/lib/tauriRuntime"; -import { apiUrl } from "@/lib/webPath"; +import { isTauriRuntime } from "@/lib/backend/tauriRuntime"; +import { apiUrl } from "@/lib/common/webPath"; const DB_NAME = "dbx-tab-runtime-cache"; const DB_VERSION = 1; diff --git a/apps/desktop/src/lib/webdavAutoUploadConfig.ts b/apps/desktop/src/lib/webdav/webdavAutoUploadConfig.ts similarity index 96% rename from apps/desktop/src/lib/webdavAutoUploadConfig.ts rename to apps/desktop/src/lib/webdav/webdavAutoUploadConfig.ts index 860aeec73..81ab20089 100644 --- a/apps/desktop/src/lib/webdavAutoUploadConfig.ts +++ b/apps/desktop/src/lib/webdav/webdavAutoUploadConfig.ts @@ -1,5 +1,5 @@ -import type { WebDavConfig } from "@/lib/api"; -import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/safeStorage"; +import type { WebDavConfig } from "@/lib/backend/api"; +import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/backend/safeStorage"; export const WEB_DAV_AUTO_UPLOAD_STORAGE_KEYS = ["dbx-webdav-endpoint", "dbx-webdav-username", "dbx-webdav-remote-path", "dbx-webdav-auto-upload-enabled", "dbx-webdav-auto-upload-interval-minutes"] as const; diff --git a/apps/desktop/src/lib/zookeeperConnection.ts b/apps/desktop/src/lib/zookeeper/zookeeperConnection.ts similarity index 100% rename from apps/desktop/src/lib/zookeeperConnection.ts rename to apps/desktop/src/lib/zookeeper/zookeeperConnection.ts diff --git a/apps/desktop/src/lib/zookeeperLazyKeyTree.ts b/apps/desktop/src/lib/zookeeper/zookeeperLazyKeyTree.ts similarity index 98% rename from apps/desktop/src/lib/zookeeperLazyKeyTree.ts rename to apps/desktop/src/lib/zookeeper/zookeeperLazyKeyTree.ts index b4b6a746f..861bfe324 100644 --- a/apps/desktop/src/lib/zookeeperLazyKeyTree.ts +++ b/apps/desktop/src/lib/zookeeper/zookeeperLazyKeyTree.ts @@ -1,4 +1,4 @@ -import type { KvKeyMetadata, KvKeySummary } from "./api"; +import type { KvKeyMetadata, KvKeySummary } from "@/lib/backend/api"; export interface LazyKvKeyTreeNode extends KvKeyMetadata { kind: "lazy"; diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts index c40f4b99c..fd75a4764 100644 --- a/apps/desktop/src/main.ts +++ b/apps/desktop/src/main.ts @@ -3,7 +3,7 @@ import { createPinia } from "pinia"; import VueVirtualScroller from "vue-virtual-scroller"; import "vue-virtual-scroller/dist/vue-virtual-scroller.css"; import "./styles/globals.css"; -import { installDebugLogCapture } from "@/lib/debugLog"; +import { installDebugLogCapture } from "@/lib/backend/debugLog"; function startupErrorMessage(error: unknown): string { if (error instanceof Error) { diff --git a/apps/desktop/src/stores/__tests__/connectionStore.completion.spec.ts b/apps/desktop/src/stores/__tests__/connectionStore.completion.spec.ts index 0db390cbb..ba25cdc57 100644 --- a/apps/desktop/src/stores/__tests__/connectionStore.completion.spec.ts +++ b/apps/desktop/src/stores/__tests__/connectionStore.completion.spec.ts @@ -48,8 +48,8 @@ describe("connectionStore completion assistant", () => { fallback_used: false, }); - vi.doMock("@/lib/tauriRuntime", () => ({ isTauriRuntime: () => false })); - vi.doMock("@/lib/api", () => ({ + vi.doMock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: () => false })); + vi.doMock("@/lib/backend/api", () => ({ checkConnectionHealth: vi.fn().mockResolvedValue(undefined), completionAssistantSearch, listSchemas: vi.fn().mockResolvedValue(["public"]), @@ -72,8 +72,8 @@ describe("connectionStore completion assistant", () => { const completionAssistantSearch = vi.fn().mockRejectedValue(new Error("assistant unavailable")); const listTables = vi.fn().mockResolvedValue([{ name: "accounts", table_type: "BASE TABLE", comment: null }]); - vi.doMock("@/lib/tauriRuntime", () => ({ isTauriRuntime: () => false })); - vi.doMock("@/lib/api", () => ({ + vi.doMock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: () => false })); + vi.doMock("@/lib/backend/api", () => ({ checkConnectionHealth: vi.fn().mockResolvedValue(undefined), completionAssistantSearch, listSchemas: vi.fn().mockResolvedValue(["public"]), @@ -101,8 +101,8 @@ describe("connectionStore completion assistant", () => { return []; }); - vi.doMock("@/lib/tauriRuntime", () => ({ isTauriRuntime: () => false })); - vi.doMock("@/lib/api", () => ({ + vi.doMock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: () => false })); + vi.doMock("@/lib/backend/api", () => ({ checkConnectionHealth: vi.fn().mockResolvedValue(undefined), completionAssistantSearch, listSchemas: vi.fn().mockResolvedValue(["dim_game_base", "dws_game_sdk_base"]), @@ -134,8 +134,8 @@ describe("connectionStore completion assistant", () => { }); }); - vi.doMock("@/lib/tauriRuntime", () => ({ isTauriRuntime: () => false })); - vi.doMock("@/lib/api", () => ({ + vi.doMock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: () => false })); + vi.doMock("@/lib/backend/api", () => ({ checkConnectionHealth: vi.fn().mockResolvedValue(undefined), completionAssistantSearch: vi.fn().mockResolvedValue({ candidates: [], incomplete: false, fallback_used: false }), getColumns, diff --git a/apps/desktop/src/stores/__tests__/connectionStore.mq.spec.ts b/apps/desktop/src/stores/__tests__/connectionStore.mq.spec.ts index c19c9554f..49a5077c4 100644 --- a/apps/desktop/src/stores/__tests__/connectionStore.mq.spec.ts +++ b/apps/desktop/src/stores/__tests__/connectionStore.mq.spec.ts @@ -69,8 +69,8 @@ describe("connectionStore MQ sidebar tree", () => { { name: "tenant-a", adminRoles: [], allowedClusters: [] }, ]); - vi.doMock("@/lib/tauriRuntime", () => ({ isTauriRuntime: () => false })); - vi.doMock("@/lib/api", () => ({ + vi.doMock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: () => false })); + vi.doMock("@/lib/backend/api", () => ({ checkConnectionHealth: vi.fn().mockResolvedValue(undefined), deleteSchemaCachePrefix: vi.fn().mockResolvedValue(undefined), listDatabases: vi.fn().mockResolvedValue([]), @@ -106,8 +106,8 @@ describe("connectionStore MQ sidebar tree", () => { }); it("adds a Kafka topics child with a topics initial tab", async () => { - vi.doMock("@/lib/tauriRuntime", () => ({ isTauriRuntime: () => false })); - vi.doMock("@/lib/api", () => ({ + vi.doMock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: () => false })); + vi.doMock("@/lib/backend/api", () => ({ checkConnectionHealth: vi.fn().mockResolvedValue(undefined), deleteSchemaCachePrefix: vi.fn().mockResolvedValue(undefined), listDatabases: vi.fn().mockResolvedValue([]), @@ -139,8 +139,8 @@ describe("connectionStore MQ sidebar tree", () => { it("detects Kafka from external config when driver profile is missing", async () => { const mqListTenants = vi.fn(); - vi.doMock("@/lib/tauriRuntime", () => ({ isTauriRuntime: () => false })); - vi.doMock("@/lib/api", () => ({ + vi.doMock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: () => false })); + vi.doMock("@/lib/backend/api", () => ({ checkConnectionHealth: vi.fn().mockResolvedValue(undefined), deleteSchemaCachePrefix: vi.fn().mockResolvedValue(undefined), listDatabases: vi.fn().mockResolvedValue([]), @@ -180,8 +180,8 @@ describe("connectionStore MQ sidebar tree", () => { }), ); - vi.doMock("@/lib/tauriRuntime", () => ({ isTauriRuntime: () => false })); - vi.doMock("@/lib/api", () => ({ + vi.doMock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: () => false })); + vi.doMock("@/lib/backend/api", () => ({ checkConnectionHealth: vi.fn().mockResolvedValue(undefined), connectDb, })); diff --git a/apps/desktop/src/stores/__tests__/connectionStore.timeout.spec.ts b/apps/desktop/src/stores/__tests__/connectionStore.timeout.spec.ts index 20a8f6249..06bbb5ea9 100644 --- a/apps/desktop/src/stores/__tests__/connectionStore.timeout.spec.ts +++ b/apps/desktop/src/stores/__tests__/connectionStore.timeout.spec.ts @@ -43,8 +43,8 @@ describe("connectionStore timeout recovery", () => { const checkConnectionHealth = vi.fn(() => new Promise(() => undefined)); const connectDb = vi.fn().mockResolvedValue(undefined); - vi.doMock("@/lib/tauriRuntime", () => ({ isTauriRuntime: () => false })); - vi.doMock("@/lib/api", () => ({ + vi.doMock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: () => false })); + vi.doMock("@/lib/backend/api", () => ({ checkConnectionHealth, connectDb, deleteSchemaCachePrefix: vi.fn().mockResolvedValue(undefined), @@ -68,8 +68,8 @@ describe("connectionStore timeout recovery", () => { }, 10_000); it("normalizes missing keepalive interval to 30 seconds", async () => { - vi.doMock("@/lib/tauriRuntime", () => ({ isTauriRuntime: () => false })); - vi.doMock("@/lib/api", () => ({ + vi.doMock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: () => false })); + vi.doMock("@/lib/backend/api", () => ({ deleteSchemaCachePrefix: vi.fn().mockResolvedValue(undefined), saveConnections: vi.fn().mockResolvedValue(undefined), saveSidebarLayout: vi.fn().mockResolvedValue(undefined), @@ -86,8 +86,8 @@ describe("connectionStore timeout recovery", () => { const checkConnectionHealth = vi.fn(() => new Promise(() => undefined)); const connectDb = vi.fn().mockRejectedValue(new Error("reconnect failed")); - vi.doMock("@/lib/tauriRuntime", () => ({ isTauriRuntime: () => false })); - vi.doMock("@/lib/api", () => ({ + vi.doMock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: () => false })); + vi.doMock("@/lib/backend/api", () => ({ checkConnectionHealth, connectDb, deleteSchemaCachePrefix: vi.fn().mockResolvedValue(undefined), diff --git a/apps/desktop/src/stores/__tests__/queryStore.cancel.spec.ts b/apps/desktop/src/stores/__tests__/queryStore.cancel.spec.ts index 07e20831a..0abd6cab0 100644 --- a/apps/desktop/src/stores/__tests__/queryStore.cancel.spec.ts +++ b/apps/desktop/src/stores/__tests__/queryStore.cancel.spec.ts @@ -26,7 +26,7 @@ describe("queryStore cancel timeout recovery", () => { it("clears cancelling state when cancelQuery does not return", async () => { const cancelQuery = vi.fn(() => new Promise(() => undefined)); - vi.doMock("@/lib/api", () => ({ cancelQuery })); + vi.doMock("@/lib/backend/api", () => ({ cancelQuery })); const { useQueryStore } = await import("@/stores/queryStore"); const store = useQueryStore(); @@ -52,7 +52,7 @@ describe("queryStore cancel timeout recovery", () => { it("clears cancelling state when cancel is acknowledged but execution does not settle", async () => { const cancelQuery = vi.fn(() => Promise.resolve(true)); - vi.doMock("@/lib/api", () => ({ cancelQuery })); + vi.doMock("@/lib/backend/api", () => ({ cancelQuery })); const { useQueryStore } = await import("@/stores/queryStore"); const store = useQueryStore(); diff --git a/apps/desktop/src/stores/__tests__/queryStore.database-open.spec.ts b/apps/desktop/src/stores/__tests__/queryStore.database-open.spec.ts index 76f9cbede..fe4b5676e 100644 --- a/apps/desktop/src/stores/__tests__/queryStore.database-open.spec.ts +++ b/apps/desktop/src/stores/__tests__/queryStore.database-open.spec.ts @@ -1,6 +1,6 @@ import { createPinia, setActivePinia } from "pinia"; import { beforeEach, describe, expect, it, vi } from "vitest"; -import { ACTIVE_TAB_STORAGE_KEY, OPEN_TABS_STORAGE_KEY } from "@/lib/openTabsPersistence"; +import { ACTIVE_TAB_STORAGE_KEY, OPEN_TABS_STORAGE_KEY } from "@/lib/app/openTabsPersistence"; function installLocalStorage() { const data = new Map(); diff --git a/apps/desktop/src/stores/connectionStore.ts b/apps/desktop/src/stores/connectionStore.ts index 50738eacc..0a8c8fdec 100644 --- a/apps/desktop/src/stores/connectionStore.ts +++ b/apps/desktop/src/stores/connectionStore.ts @@ -1,8 +1,8 @@ import { defineStore } from "pinia"; -import { uuid } from "@/lib/utils"; +import { uuid } from "@/lib/common/utils"; import { ref, computed, watch } from "vue"; import type { ColumnInfo, CompletionAssistantCandidate, CompletionAssistantObjectKind, CompletionAssistantRequest, ConnectionConfig, ForeignKeyInfo, ObjectInfo, SchemaInfo, SidebarLayout, TableInfo, TreeNode } from "@/types/database"; -import { applyPinnedTreeNodeState, updatePinnedTreeNodeInPlace } from "@/lib/pinnedItems"; +import { applyPinnedTreeNodeState, updatePinnedTreeNodeInPlace } from "@/lib/app/pinnedItems"; import { reconcileLayout, buildTreeNodesFromLayout, @@ -19,19 +19,19 @@ import { remapSidebarLayoutConnectionIds, reorderEntry as reorderEntryOp, type DropPosition, -} from "@/lib/sidebarLayout"; -import type { SqlCompletionColumn, SqlCompletionForeignKey, SqlCompletionObject, SqlCompletionTable } from "@/lib/sqlCompletion"; -import * as api from "@/lib/api"; -import { isTauriRuntime } from "@/lib/tauriRuntime"; -import { isSchemaAware, normalizeSidebarObjectKind, sidebarObjectKindsForDatabase, usesTreeSchemaMode } from "@/lib/databaseCapabilities"; -import { connectionObjectTreeNodeSchema, connectionObjectTreeQuerySchema, connectionUsesDatabaseObjectTreeMode, effectiveDatabaseTypeForConnection } from "@/lib/jdbcDialect"; -import { buildDatabaseTreeNodes, buildDuckDbConnectionTreeNodes, sortSidebarNames, shouldIncludeDefaultDatabaseNode } from "@/lib/databaseTree"; -import { buildSqlServerDatabaseTreeNodes } from "@/lib/sqlServerTree"; -import { collapseExpandedTreeNodes } from "@/lib/sidebarTreeCollapse"; -import { findDatabaseTreeNode } from "@/lib/treeRefreshTarget"; -import { shouldMarkDisconnected } from "@/lib/connectionHealth"; -import { connectionAttemptOriginalErrorMessage, connectionAttemptTimeoutMessage, connectionAttemptTimeoutMs } from "@/lib/connectionAttemptTimeout"; -import { connectionUsesVisibleSchemaFilter, filterDatabaseNamesForConnection, filterSchemaNamesForConnection, filterVisibleDatabaseNames, normalizeVisibleDatabaseSelection } from "@/lib/visibleDatabases"; +} from "@/lib/sidebar/sidebarLayout"; +import type { SqlCompletionColumn, SqlCompletionForeignKey, SqlCompletionObject, SqlCompletionTable } from "@/lib/sql/sqlCompletion"; +import * as api from "@/lib/backend/api"; +import { isTauriRuntime } from "@/lib/backend/tauriRuntime"; +import { isSchemaAware, normalizeSidebarObjectKind, sidebarObjectKindsForDatabase, usesTreeSchemaMode } from "@/lib/database/databaseCapabilities"; +import { connectionObjectTreeNodeSchema, connectionObjectTreeQuerySchema, connectionUsesDatabaseObjectTreeMode, effectiveDatabaseTypeForConnection } from "@/lib/database/jdbcDialect"; +import { buildDatabaseTreeNodes, buildDuckDbConnectionTreeNodes, sortSidebarNames, shouldIncludeDefaultDatabaseNode } from "@/lib/database/databaseTree"; +import { buildSqlServerDatabaseTreeNodes } from "@/lib/database/sqlServerTree"; +import { collapseExpandedTreeNodes } from "@/lib/sidebar/sidebarTreeCollapse"; +import { findDatabaseTreeNode } from "@/lib/sidebar/treeRefreshTarget"; +import { shouldMarkDisconnected } from "@/lib/connection/connectionHealth"; +import { connectionAttemptOriginalErrorMessage, connectionAttemptTimeoutMessage, connectionAttemptTimeoutMs } from "@/lib/connection/connectionAttemptTimeout"; +import { connectionUsesVisibleSchemaFilter, filterDatabaseNamesForConnection, filterSchemaNamesForConnection, filterVisibleDatabaseNames, normalizeVisibleDatabaseSelection } from "@/lib/database/visibleDatabases"; import { buildObjectGroupPlaceholderNodes, buildGroupedObjectTreeNodes, @@ -46,21 +46,21 @@ import { sortDatabaseObjectsByName, tablePartitionGroups, type DatabaseObjectTreeKind, -} from "@/lib/tableTree"; -import { hasTreeNodeDatabaseContext, normalizeCataloglessDatabaseNodes, treeNodeSchemaCachePrefix } from "@/lib/treeNodeContext"; -import { decodeSchemaTreeCache, encodeSchemaTreeCache } from "@/lib/schemaTreeCache"; -import { sortSidebarTreeChildrenForParent } from "@/lib/sidebarNodeOrdering"; -import { prunePinnedTreeNodeIdsForConnection } from "@/lib/pinnedTreeNodeIds"; -import { supportsDatabaseUserAdmin } from "@/lib/databaseUserAdmin"; -import { getTableMetadataCapabilities } from "@/lib/tableMetadataCapabilities"; +} from "@/lib/table/tableTree"; +import { hasTreeNodeDatabaseContext, normalizeCataloglessDatabaseNodes, treeNodeSchemaCachePrefix } from "@/lib/sidebar/treeNodeContext"; +import { decodeSchemaTreeCache, encodeSchemaTreeCache } from "@/lib/metadata/schemaTreeCache"; +import { sortSidebarTreeChildrenForParent } from "@/lib/sidebar/sidebarNodeOrdering"; +import { prunePinnedTreeNodeIdsForConnection } from "@/lib/app/pinnedTreeNodeIds"; +import { supportsDatabaseUserAdmin } from "@/lib/database/databaseUserAdmin"; +import { getTableMetadataCapabilities } from "@/lib/table/tableMetadataCapabilities"; import { useSettingsStore } from "@/stores/settingsStore"; -import { encodeSqlServerLinkedSchema, parseSqlServerLinkedSchema } from "@/lib/sqlServerLinkedServers"; -import { inferMongoCompletionFields, type MongoCompletionField } from "@/lib/mongoCompletion"; -import { completionSchemasFromTree, completionTablesFromTree } from "@/lib/completionTreeIndex"; -import { kvRootNodeLabel } from "@/lib/kvRootPresentation"; -import { REDIS_SCAN_PAGE_SIZE_DEFAULT } from "@/lib/redisKeyPattern"; -import { appendAgentDriverUpdateHint, hasAgentDriverUpdate, type AgentDriverInstallState } from "@/lib/agentDriverInstallHint"; -import { MetadataTaskLimiter } from "@/lib/metadataTaskLimiter"; +import { encodeSqlServerLinkedSchema, parseSqlServerLinkedSchema } from "@/lib/database/sqlServerLinkedServers"; +import { inferMongoCompletionFields, type MongoCompletionField } from "@/lib/mongo/mongoCompletion"; +import { completionSchemasFromTree, completionTablesFromTree } from "@/lib/metadata/completionTreeIndex"; +import { kvRootNodeLabel } from "@/lib/kv/kvRootPresentation"; +import { REDIS_SCAN_PAGE_SIZE_DEFAULT } from "@/lib/redis/redisKeyPattern"; +import { appendAgentDriverUpdateHint, hasAgentDriverUpdate, type AgentDriverInstallState } from "@/lib/connection/agentDriverInstallHint"; +import { MetadataTaskLimiter } from "@/lib/metadata/metadataTaskLimiter"; import i18n from "@/i18n"; import type { MqAdminConfig } from "@/types/mq"; @@ -3643,7 +3643,7 @@ export const useConnectionStore = defineStore("connection", () => { } async function exportConnectionsToFile(passphrase: string) { - const { encryptConfig } = await import("@/lib/configCrypto"); + const { encryptConfig } = await import("@/lib/backend/configCrypto"); const exportData = { connections: connections.value, layout: sidebarLayout.value }; const json = JSON.stringify(exportData); const payload = await encryptConfig(json, passphrase); @@ -3824,7 +3824,7 @@ export const useConnectionStore = defineStore("connection", () => { return { content, encrypted: false }; } - const { isEncryptedConfig } = await import("@/lib/configCrypto"); + const { isEncryptedConfig } = await import("@/lib/backend/configCrypto"); const parsed = JSON.parse(content); return { content, encrypted: isEncryptedConfig(parsed) }; } @@ -3834,11 +3834,11 @@ export const useConnectionStore = defineStore("connection", () => { let importedLayout: SidebarLayout | undefined; if (!passphrase && content.trimStart().startsWith("<")) { - const { parseNavicatConnections } = await import("@/lib/navicatImport"); + const { parseNavicatConnections } = await import("@/lib/imports/navicatImport"); imported = await parseNavicatConnections(content); } else if (!passphrase) { - const { isDbeaverImportPayload, parseDbeaverConnections } = await import("@/lib/dbeaverImport"); - const { isDataGripImportPayload, parseDataGripConnections } = await import("@/lib/datagripImport"); + const { isDbeaverImportPayload, parseDbeaverConnections } = await import("@/lib/imports/dbeaverImport"); + const { isDataGripImportPayload, parseDataGripConnections } = await import("@/lib/imports/datagripImport"); if (isDataGripImportPayload(content)) { const payload = JSON.parse(content) as { format: "datagrip-import"; @@ -3869,7 +3869,7 @@ export const useConnectionStore = defineStore("connection", () => { const parsed = JSON.parse(content); if (passphrase) { - const { decryptConfig } = await import("@/lib/configCrypto"); + const { decryptConfig } = await import("@/lib/backend/configCrypto"); const json = await decryptConfig(parsed, passphrase); const decrypted = JSON.parse(json); if (Array.isArray(decrypted)) { @@ -3913,7 +3913,7 @@ export const useConnectionStore = defineStore("connection", () => { if (!payload) return 0; try { - const { getDataGripUuidMap, datagripKeychainService } = await import("@/lib/datagripImport"); + const { getDataGripUuidMap, datagripKeychainService } = await import("@/lib/imports/datagripImport"); // dedupKey → DataGrip UUID const uuidMap = getDataGripUuidMap(payload); if (uuidMap.size === 0) return 0; diff --git a/apps/desktop/src/stores/historyStore.ts b/apps/desktop/src/stores/historyStore.ts index 76e78098a..7c49a3889 100644 --- a/apps/desktop/src/stores/historyStore.ts +++ b/apps/desktop/src/stores/historyStore.ts @@ -1,8 +1,8 @@ import { defineStore } from "pinia"; -import { uuid } from "@/lib/utils"; +import { uuid } from "@/lib/common/utils"; import { ref } from "vue"; -import * as api from "@/lib/api"; -import type { HistoryEntry } from "@/lib/api"; +import * as api from "@/lib/backend/api"; +import type { HistoryEntry } from "@/lib/backend/api"; export const useHistoryStore = defineStore("history", () => { const entries = ref([]); diff --git a/apps/desktop/src/stores/queryStore.ts b/apps/desktop/src/stores/queryStore.ts index 1e11587d0..7895f0589 100644 --- a/apps/desktop/src/stores/queryStore.ts +++ b/apps/desktop/src/stores/queryStore.ts @@ -1,13 +1,13 @@ import { defineStore } from "pinia"; -import { uuid } from "@/lib/utils"; +import { uuid } from "@/lib/common/utils"; import { markRaw, ref, watch, computed } from "vue"; import { useI18n } from "vue-i18n"; import type { DatabaseType, QueryResult, QueryTab, TableInfoTab } from "@/types/database"; -import { orderPinnedFirst } from "@/lib/pinnedItems"; -import { canCancelQueryExecution } from "@/lib/queryExecutionState"; -import { buildExplainSql, parseExplainResult, parseDamengExplainText } from "@/lib/explainPlan"; -import { allEditableColumnsWriteable, allPrimaryKeysPresent, analyzeEditableQuery, sourceColumnsForResult, type EditableQueryInfo } from "@/lib/sqlAnalysis"; -import { ACTIVE_TAB_STORAGE_KEY, OPEN_TABS_STORAGE_KEY, restoreOpenTabsState, serializeOpenTabs } from "@/lib/openTabsPersistence"; +import { orderPinnedFirst } from "@/lib/app/pinnedItems"; +import { canCancelQueryExecution } from "@/lib/sql/queryExecutionState"; +import { buildExplainSql, parseExplainResult, parseDamengExplainText } from "@/lib/diagram/explainPlan"; +import { allEditableColumnsWriteable, allPrimaryKeysPresent, analyzeEditableQuery, sourceColumnsForResult, type EditableQueryInfo } from "@/lib/sql/sqlAnalysis"; +import { ACTIVE_TAB_STORAGE_KEY, OPEN_TABS_STORAGE_KEY, restoreOpenTabsState, serializeOpenTabs } from "@/lib/app/openTabsPersistence"; import { evaluateMongoAggregateSafety, evaluateMongoWriteSafety, @@ -22,25 +22,25 @@ import { mongoWriteToQueryResult, splitMongoCommands, type MongoAggregateSafetyOptions, -} from "@/lib/mongoShellCommand"; -import { redisCommandResultToQueryResult } from "@/lib/redisQueryResult"; -import { nextRedisCommandDb } from "@/lib/redisCommandSession"; -import { isRedisMutatingCommand } from "@/lib/redisCommandTable"; -import { usesAgentCursorForQuery } from "@/lib/databaseDriverManifest"; -import { canUseKeylessRowPredicate, editableRowIdentifierColumns } from "@/lib/tableEditing"; -import { TABLE_DATA_EXPORT_PAGE_SIZE } from "@/lib/tableDataExport"; -import { tableMetaForDataTab } from "@/lib/tableDataTabMeta"; -import { tableOpenPageLimit } from "@/lib/tableOpenPageLimit"; -import { quoteTableIdentifier } from "@/lib/tableSelectSql"; -import { connectionUsesDatabaseObjectTreeMode, connectionUsesSchemaExecutionContext, effectiveDatabaseTypeForConnection, metadataSchemaForConnection } from "@/lib/jdbcDialect"; -import { frontendQueryTimeoutSecsForSql, queryTimeoutSecsForConnection } from "@/lib/queryTimeout"; -import { sortDataGridRows, type DataGridSortDirection } from "@/lib/dataGridSort"; -import { normalizeResultPageSize } from "@/lib/paginationPageSize"; -import { splitSqlStatementRanges } from "@/lib/sqlStatementRanges"; +} from "@/lib/mongo/mongoShellCommand"; +import { redisCommandResultToQueryResult } from "@/lib/redis/redisQueryResult"; +import { nextRedisCommandDb } from "@/lib/redis/redisCommandSession"; +import { isRedisMutatingCommand } from "@/lib/redis/redisCommandTable"; +import { usesAgentCursorForQuery } from "@/lib/database/databaseDriverManifest"; +import { canUseKeylessRowPredicate, editableRowIdentifierColumns } from "@/lib/table/tableEditing"; +import { TABLE_DATA_EXPORT_PAGE_SIZE } from "@/lib/table/tableDataExport"; +import { tableMetaForDataTab } from "@/lib/table/tableDataTabMeta"; +import { tableOpenPageLimit } from "@/lib/table/tableOpenPageLimit"; +import { quoteTableIdentifier } from "@/lib/table/tableSelectSql"; +import { connectionUsesDatabaseObjectTreeMode, connectionUsesSchemaExecutionContext, effectiveDatabaseTypeForConnection, metadataSchemaForConnection } from "@/lib/database/jdbcDialect"; +import { frontendQueryTimeoutSecsForSql, queryTimeoutSecsForConnection } from "@/lib/sql/queryTimeout"; +import { sortDataGridRows, type DataGridSortDirection } from "@/lib/dataGrid/dataGridSort"; +import { normalizeResultPageSize } from "@/lib/dataGrid/paginationPageSize"; +import { splitSqlStatementRanges } from "@/lib/sql/sqlStatementRanges"; import { clearDataGridPendingSnapshotsForTab } from "@/composables/useDataGridEditor"; -import { buildTabResultSnapshot, deleteTabResultSnapshot, readTabResultSnapshot, tabResultCacheKey, writeTabResultSnapshot } from "@/lib/tabResultCache"; -import { decodeQueryResultArchive, encodeQueryResultArchive, type DecodedQueryResultArchive } from "@/lib/queryResultArchive"; -import * as api from "@/lib/api"; +import { buildTabResultSnapshot, deleteTabResultSnapshot, readTabResultSnapshot, tabResultCacheKey, writeTabResultSnapshot } from "@/lib/tabs/tabResultCache"; +import { decodeQueryResultArchive, encodeQueryResultArchive, type DecodedQueryResultArchive } from "@/lib/query/queryResultArchive"; +import * as api from "@/lib/backend/api"; import { useConnectionStore } from "@/stores/connectionStore"; import { useSettingsStore } from "@/stores/settingsStore"; import { useSavedSqlStore } from "@/stores/savedSqlStore"; diff --git a/apps/desktop/src/stores/savedSqlStore.ts b/apps/desktop/src/stores/savedSqlStore.ts index 2dc8e38a5..7ad82619d 100644 --- a/apps/desktop/src/stores/savedSqlStore.ts +++ b/apps/desktop/src/stores/savedSqlStore.ts @@ -1,8 +1,8 @@ import { defineStore } from "pinia"; import { computed, ref } from "vue"; -import { uuid } from "@/lib/utils"; -import * as api from "@/lib/api"; -import { isTauriRuntime } from "@/lib/tauriRuntime"; +import { uuid } from "@/lib/common/utils"; +import * as api from "@/lib/backend/api"; +import { isTauriRuntime } from "@/lib/backend/tauriRuntime"; import { useSettingsStore } from "@/stores/settingsStore"; import type { SavedSqlFile, SavedSqlFolder, SavedSqlLibrary } from "@/types/database"; diff --git a/apps/desktop/src/stores/settingsStore.ts b/apps/desktop/src/stores/settingsStore.ts index 710619779..003d2ec4f 100644 --- a/apps/desktop/src/stores/settingsStore.ts +++ b/apps/desktop/src/stores/settingsStore.ts @@ -1,17 +1,17 @@ import { defineStore } from "pinia"; import { ref } from "vue"; -import * as api from "@/lib/api"; -import { normalizeColumnFormatter, normalizeCustomColumnFormatter, type ColumnFormatterConfig, type CustomColumnFormatterConfig } from "@/lib/columnFormatter"; -import { normalizeShortcutSettings, type ShortcutSettings } from "@/lib/shortcutRegistry"; -import { normalizeResultPageSize } from "@/lib/paginationPageSize"; -import { normalizeSidebarHiddenTablePrefixes } from "@/lib/sidebarTableNameDisplay"; -import { DEFAULT_SQL_FORMATTER_SETTINGS, normalizeSqlFormatterSettings, type SqlFormatterSettings } from "@/lib/sqlFormatterConfig"; -import type { SidebarActivation } from "@/lib/treeNodeClick"; +import * as api from "@/lib/backend/api"; +import { normalizeColumnFormatter, normalizeCustomColumnFormatter, type ColumnFormatterConfig, type CustomColumnFormatterConfig } from "@/lib/dataGrid/columnFormatter"; +import { normalizeShortcutSettings, type ShortcutSettings } from "@/lib/editor/shortcutRegistry"; +import { normalizeResultPageSize } from "@/lib/dataGrid/paginationPageSize"; +import { normalizeSidebarHiddenTablePrefixes } from "@/lib/sidebar/sidebarTableNameDisplay"; +import { DEFAULT_SQL_FORMATTER_SETTINGS, normalizeSqlFormatterSettings, type SqlFormatterSettings } from "@/lib/sql/sqlFormatterConfig"; +import type { SidebarActivation } from "@/lib/sidebar/treeNodeClick"; import type { SqlSnippet } from "@/types/database"; -import { DEFAULT_SQL_SNIPPETS } from "@/lib/sqlCompletion"; -import { setDebugLoggingEnabled } from "@/lib/debugLog"; -import { DEFAULT_TABLE_COLUMN_TEMPLATE_FIELDS, normalizeTableColumnTemplateFields } from "@/lib/tableColumnTemplates"; -import { DEFAULT_UI_FONT_FAMILY } from "@/lib/appFonts"; +import { DEFAULT_SQL_SNIPPETS } from "@/lib/sql/sqlCompletion"; +import { setDebugLoggingEnabled } from "@/lib/backend/debugLog"; +import { DEFAULT_TABLE_COLUMN_TEMPLATE_FIELDS, normalizeTableColumnTemplateFields } from "@/lib/table/tableColumnTemplates"; +import { DEFAULT_UI_FONT_FAMILY } from "@/lib/app/appFonts"; export type AiProvider = "claude" | "openai" | "gemini" | "deepseek" | "qwen" | "ollama" | "openai-compatible" | "codex-cli" | "custom"; export type AiApiStyle = "completions" | "responses" | "anthropic-messages"; diff --git a/apps/desktop/src/types/database.ts b/apps/desktop/src/types/database.ts index dba884a02..70bd9ce32 100644 --- a/apps/desktop/src/types/database.ts +++ b/apps/desktop/src/types/database.ts @@ -587,10 +587,10 @@ export interface TableStructureEditorDraft { newTableName: string; tableComment: string; originalTableComment: string; - columns: import("@/lib/tableStructureEditorSql").EditableStructureColumn[]; - indexes: import("@/lib/tableStructureEditorSql").EditableStructureIndex[]; - foreignKeys: import("@/lib/tableStructureEditorSql").EditableStructureForeignKey[]; - triggers: import("@/lib/tableStructureEditorSql").EditableStructureTrigger[]; + columns: import("@/lib/table/tableStructureEditorSql").EditableStructureColumn[]; + indexes: import("@/lib/table/tableStructureEditorSql").EditableStructureIndex[]; + foreignKeys: import("@/lib/table/tableStructureEditorSql").EditableStructureForeignKey[]; + triggers: import("@/lib/table/tableStructureEditorSql").EditableStructureTrigger[]; initialized: boolean; } @@ -631,7 +631,7 @@ export interface QueryTab { resultRuns?: QueryResultRun[]; activeResultRunId?: string; resultAutoSave?: boolean; - explainPlan?: import("@/lib/explainPlan").ParsedExplainPlan; + explainPlan?: import("@/lib/diagram/explainPlan").ParsedExplainPlan; explainError?: string; explainSql?: string; lastExplainedSql?: string; diff --git a/packages/app-tests/actionActivation.test.ts b/packages/app-tests/actionActivation.test.ts index e01f56448..b671bf623 100644 --- a/packages/app-tests/actionActivation.test.ts +++ b/packages/app-tests/actionActivation.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { shouldSuppressRepeatedActivation, tryStartExclusiveActivation } from "../../apps/desktop/src/lib/actionActivation.ts"; +import { shouldSuppressRepeatedActivation, tryStartExclusiveActivation } from "../../apps/desktop/src/lib/connection/actionActivation.ts"; test("allows the first activation", () => { const guard = {}; diff --git a/packages/app-tests/agentDriverInstallHint.test.ts b/packages/app-tests/agentDriverInstallHint.test.ts index 65ab176b9..47532cd6a 100644 --- a/packages/app-tests/agentDriverInstallHint.test.ts +++ b/packages/app-tests/agentDriverInstallHint.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { appendAgentDriverUpdateHint, hasAgentDriverUpdate, showAgentDriverInstallHint } from "../../apps/desktop/src/lib/agentDriverInstallHint.ts"; +import { appendAgentDriverUpdateHint, hasAgentDriverUpdate, showAgentDriverInstallHint } from "../../apps/desktop/src/lib/connection/agentDriverInstallHint.ts"; test("hides the agent driver install hint when the selected driver is installed", () => { assert.equal(showAgentDriverInstallHint("informix", [{ db_type: "informix", installed: true }]), false); diff --git a/packages/app-tests/aiAgentPlan.test.ts b/packages/app-tests/aiAgentPlan.test.ts index 23bc999b1..a6382ca77 100644 --- a/packages/app-tests/aiAgentPlan.test.ts +++ b/packages/app-tests/aiAgentPlan.test.ts @@ -1,7 +1,7 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { buildAiAgentPlan } from "../../apps/desktop/src/lib/aiAgentPlan.ts"; -import type { AiAction, AiAssistantMode } from "../../apps/desktop/src/lib/ai.ts"; +import { buildAiAgentPlan } from "../../apps/desktop/src/lib/ai/aiAgentPlan.ts"; +import type { AiAction, AiAssistantMode } from "../../apps/desktop/src/lib/ai/ai.ts"; import type { ConnectionConfig } from "../../apps/desktop/src/types/database.ts"; function conn(overrides: Partial = {}): ConnectionConfig { diff --git a/packages/app-tests/aiAgentStepPresentation.test.ts b/packages/app-tests/aiAgentStepPresentation.test.ts index 61f14cdf4..481e7e001 100644 --- a/packages/app-tests/aiAgentStepPresentation.test.ts +++ b/packages/app-tests/aiAgentStepPresentation.test.ts @@ -1,7 +1,7 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { buildAiAgentStepItems, toolCallStepKey, upsertAgentStep, type AiAgentStepItem } from "../../apps/desktop/src/lib/aiAgentStepPresentation.ts"; -import type { AiAgentPlan } from "../../apps/desktop/src/lib/aiAgentPlan.ts"; +import { buildAiAgentStepItems, toolCallStepKey, upsertAgentStep, type AiAgentStepItem } from "../../apps/desktop/src/lib/ai/aiAgentStepPresentation.ts"; +import type { AiAgentPlan } from "../../apps/desktop/src/lib/ai/aiAgentPlan.ts"; test("presents auto-execute agent plans as completed generation, safety, and execution steps", () => { const plan: AiAgentPlan = { diff --git a/packages/app-tests/aiPrompt.test.ts b/packages/app-tests/aiPrompt.test.ts index d9c052f26..7111555c4 100644 --- a/packages/app-tests/aiPrompt.test.ts +++ b/packages/app-tests/aiPrompt.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import type { AiContext } from "../../apps/desktop/src/lib/ai.ts"; +import type { AiContext } from "../../apps/desktop/src/lib/ai/ai.ts"; class MemoryStorage { private values = new Map(); @@ -30,7 +30,7 @@ Object.defineProperty(globalThis, "localStorage", { configurable: true, }); -const { buildSystemPrompt, isVectorDbType, buildUserPrompt } = await import("../../apps/desktop/src/lib/ai.ts"); +const { buildSystemPrompt, isVectorDbType, buildUserPrompt } = await import("../../apps/desktop/src/lib/ai/ai.ts"); function context(overrides: Partial = {}): AiContext { return { diff --git a/packages/app-tests/aiPromptEval.test.ts b/packages/app-tests/aiPromptEval.test.ts index 0652fc4e8..f136b8052 100644 --- a/packages/app-tests/aiPromptEval.test.ts +++ b/packages/app-tests/aiPromptEval.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import type { AiAction, AiAssistantMode, AiContext } from "../../apps/desktop/src/lib/ai.ts"; +import type { AiAction, AiAssistantMode, AiContext } from "../../apps/desktop/src/lib/ai/ai.ts"; class MemoryStorage { private values = new Map(); @@ -30,7 +30,7 @@ Object.defineProperty(globalThis, "localStorage", { configurable: true, }); -const { buildSystemPrompt } = await import("../../apps/desktop/src/lib/ai.ts"); +const { buildSystemPrompt } = await import("../../apps/desktop/src/lib/ai/ai.ts"); function baseContext(overrides: Partial = {}): AiContext { return { diff --git a/packages/app-tests/aiPromptKeyboard.test.ts b/packages/app-tests/aiPromptKeyboard.test.ts index f96647064..f0d8a833d 100644 --- a/packages/app-tests/aiPromptKeyboard.test.ts +++ b/packages/app-tests/aiPromptKeyboard.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { isAiPromptImeCompositionEvent, shouldSubmitAiPromptOnKeydown } from "../../apps/desktop/src/lib/aiPromptKeyboard.ts"; +import { isAiPromptImeCompositionEvent, shouldSubmitAiPromptOnKeydown } from "../../apps/desktop/src/lib/ai/aiPromptKeyboard.ts"; test("submits AI prompt on plain Enter", () => { assert.equal(shouldSubmitAiPromptOnKeydown({ key: "Enter" }), true); diff --git a/packages/app-tests/aiSchemaComments.test.ts b/packages/app-tests/aiSchemaComments.test.ts index 76f528285..d28fc414e 100644 --- a/packages/app-tests/aiSchemaComments.test.ts +++ b/packages/app-tests/aiSchemaComments.test.ts @@ -1,7 +1,7 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { buildSystemPrompt, type AiContext } from "../../apps/desktop/src/lib/ai.ts"; +import { buildSystemPrompt, type AiContext } from "../../apps/desktop/src/lib/ai/ai.ts"; const BASE_CONTEXT: AiContext = { connectionName: "local", diff --git a/packages/app-tests/aiSkills.test.ts b/packages/app-tests/aiSkills.test.ts index 54767e92d..e44fddd33 100644 --- a/packages/app-tests/aiSkills.test.ts +++ b/packages/app-tests/aiSkills.test.ts @@ -1,7 +1,7 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import type { AiAction } from "../../apps/desktop/src/lib/ai.ts"; -import { AI_SKILL_DEFINITIONS, aiSkillForAction } from "../../apps/desktop/src/lib/aiSkills.ts"; +import type { AiAction } from "../../apps/desktop/src/lib/ai/ai.ts"; +import { AI_SKILL_DEFINITIONS, aiSkillForAction } from "../../apps/desktop/src/lib/ai/aiSkills.ts"; const actions: AiAction[] = ["generate", "explain", "optimize", "fix", "convert", "sampleData"]; diff --git a/packages/app-tests/aiSqlExecutionPolicy.test.ts b/packages/app-tests/aiSqlExecutionPolicy.test.ts index 57e8c0b3b..28f51c29b 100644 --- a/packages/app-tests/aiSqlExecutionPolicy.test.ts +++ b/packages/app-tests/aiSqlExecutionPolicy.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { classifyAiSqlExecution, classifyConnectionEnvironment, shouldAttemptAiAutoExecute } from "../../apps/desktop/src/lib/aiSqlExecutionPolicy.ts"; +import { classifyAiSqlExecution, classifyConnectionEnvironment, shouldAttemptAiAutoExecute } from "../../apps/desktop/src/lib/ai/aiSqlExecutionPolicy.ts"; import type { ConnectionConfig } from "../../apps/desktop/src/types/database.ts"; function conn(overrides: Partial = {}): ConnectionConfig { diff --git a/packages/app-tests/aiTableMentions.test.ts b/packages/app-tests/aiTableMentions.test.ts index 9f4623134..09d5a6fb4 100644 --- a/packages/app-tests/aiTableMentions.test.ts +++ b/packages/app-tests/aiTableMentions.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { formatAiTableMention, parseAiTableMentions } from "../../apps/desktop/src/lib/aiTableMentions.ts"; +import { formatAiTableMention, parseAiTableMentions } from "../../apps/desktop/src/lib/ai/aiTableMentions.ts"; test("parses simple and schema-qualified AI table mentions", () => { assert.deepEqual(parseAiTableMentions("show @users and join @public.orders"), [ diff --git a/packages/app-tests/appUpdater.test.ts b/packages/app-tests/appUpdater.test.ts index 903854edb..74f25dea3 100644 --- a/packages/app-tests/appUpdater.test.ts +++ b/packages/app-tests/appUpdater.test.ts @@ -2,7 +2,7 @@ import assert from "node:assert/strict"; import { test } from "vitest"; import { canDownloadAndInstallUpdate, normalizeUpdateDownloadSource, resolveUpdateReleaseUrl, tagVersion } from "../../apps/desktop/src/composables/useAppUpdater.ts"; -import type { UpdateInfo } from "../../apps/desktop/src/lib/api.ts"; +import type { UpdateInfo } from "../../apps/desktop/src/lib/backend/api.ts"; function updateInfo(overrides: Partial = {}): UpdateInfo { return { diff --git a/packages/app-tests/binaryCellDownload.test.ts b/packages/app-tests/binaryCellDownload.test.ts index 0c19b0455..7df544456 100644 --- a/packages/app-tests/binaryCellDownload.test.ts +++ b/packages/app-tests/binaryCellDownload.test.ts @@ -1,7 +1,7 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { binaryCellDisplayText, binaryCellDownloadFileName, binaryCellDownloadPayload, canDownloadBinaryCellValue, isBinaryCellColumnType, parseBinaryCellBytes, parseBinaryCellHexValue } from "../../apps/desktop/src/lib/binaryCellDownload.ts"; +import { binaryCellDisplayText, binaryCellDownloadFileName, binaryCellDownloadPayload, canDownloadBinaryCellValue, isBinaryCellColumnType, parseBinaryCellBytes, parseBinaryCellHexValue } from "../../apps/desktop/src/lib/dataGrid/binaryCellDownload.ts"; test("parseBinaryCellHexValue accepts 0x and \\x prefixed hex values", () => { assert.deepEqual(Array.from(parseBinaryCellHexValue("0X48656c6c6f") ?? []), [72, 101, 108, 108, 111]); diff --git a/packages/app-tests/binaryHexViewer.test.ts b/packages/app-tests/binaryHexViewer.test.ts index d3c7a3f26..dc8f5cad6 100644 --- a/packages/app-tests/binaryHexViewer.test.ts +++ b/packages/app-tests/binaryHexViewer.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { buildBinaryHexViewRows } from "../../apps/desktop/src/lib/binaryHexViewer.ts"; +import { buildBinaryHexViewRows } from "../../apps/desktop/src/lib/dataGrid/binaryHexViewer.ts"; test("buildBinaryHexViewRows formats offsets, hex bytes, and ascii preview", () => { const bytes = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x20, 0x41, 0x7e, 0x7f, 0x00, 0x01, 0x02, 0xff, 0x48]); diff --git a/packages/app-tests/canvasDataGridRenderer.test.ts b/packages/app-tests/canvasDataGridRenderer.test.ts index 1a778d850..b193e3572 100644 --- a/packages/app-tests/canvasDataGridRenderer.test.ts +++ b/packages/app-tests/canvasDataGridRenderer.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { fitCanvasText } from "../../apps/desktop/src/lib/canvasDataGridRenderer.ts"; +import { fitCanvasText } from "../../apps/desktop/src/lib/dataGrid/canvasDataGridRenderer.ts"; function measureContext(charWidth = 1): CanvasRenderingContext2D { return { diff --git a/packages/app-tests/cellDetailPresentation.test.ts b/packages/app-tests/cellDetailPresentation.test.ts index 7859e0c9c..8f9ebf666 100644 --- a/packages/app-tests/cellDetailPresentation.test.ts +++ b/packages/app-tests/cellDetailPresentation.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { visibleCellDetailTabs } from "../../apps/desktop/src/lib/cellDetailPresentation.ts"; +import { visibleCellDetailTabs } from "../../apps/desktop/src/lib/dataGrid/cellDetailPresentation.ts"; test("visibleCellDetailTabs exposes hex viewer only for binary details", () => { assert.deepEqual(visibleCellDetailTabs({ isEditable: false }), ["details"]); diff --git a/packages/app-tests/cellImageUrl.test.ts b/packages/app-tests/cellImageUrl.test.ts index 634937397..3764521dd 100644 --- a/packages/app-tests/cellImageUrl.test.ts +++ b/packages/app-tests/cellImageUrl.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { cellImagePreviewUrl } from "../../apps/desktop/src/lib/cellImageUrl.ts"; +import { cellImagePreviewUrl } from "../../apps/desktop/src/lib/dataGrid/cellImageUrl.ts"; test("detects obvious remote image URLs", () => { assert.equal(cellImagePreviewUrl("https://cdn.example.com/avatar/user.png"), "https://cdn.example.com/avatar/user.png"); diff --git a/packages/app-tests/cellValue.test.ts b/packages/app-tests/cellValue.test.ts index 51b633051..c95158286 100644 --- a/packages/app-tests/cellValue.test.ts +++ b/packages/app-tests/cellValue.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { displayCellValue } from "../../apps/desktop/src/lib/cellValue.ts"; +import { displayCellValue } from "../../apps/desktop/src/lib/dataGrid/cellValue.ts"; test("displayCellValue returns NULL for null", () => { assert.equal(displayCellValue(null), "NULL"); diff --git a/packages/app-tests/clipboard.test.ts b/packages/app-tests/clipboard.test.ts index e34fde4b2..cb1fd4e0e 100644 --- a/packages/app-tests/clipboard.test.ts +++ b/packages/app-tests/clipboard.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { copyToClipboard, eventTargetAllowsAppClipboardShortcut, eventTargetAllowsNativeClipboard, hasNativeClipboardSelection, isPlainClipboardShortcut, readTextFromClipboard } from "../../apps/desktop/src/lib/clipboard.ts"; +import { copyToClipboard, eventTargetAllowsAppClipboardShortcut, eventTargetAllowsNativeClipboard, hasNativeClipboardSelection, isPlainClipboardShortcut, readTextFromClipboard } from "../../apps/desktop/src/lib/common/clipboard.ts"; test("copyToClipboard falls back when navigator clipboard is unavailable", async () => { const appended: unknown[] = []; diff --git a/packages/app-tests/codemirrorSqlDialect.test.ts b/packages/app-tests/codemirrorSqlDialect.test.ts index d89bf6224..11fabddc0 100644 --- a/packages/app-tests/codemirrorSqlDialect.test.ts +++ b/packages/app-tests/codemirrorSqlDialect.test.ts @@ -1,7 +1,7 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; import * as langSql from "@codemirror/lang-sql"; -import { createDbxCodeMirrorSqlDialect } from "../../apps/desktop/src/lib/codemirrorSqlDialect.ts"; +import { createDbxCodeMirrorSqlDialect } from "../../apps/desktop/src/lib/editor/codemirrorSqlDialect.ts"; function hasKeyword(keywords: string | undefined, keyword: string): boolean { return new RegExp(`(?:^|\\s)${keyword}(?:\\s|$)`, "i").test(keywords || ""); diff --git a/packages/app-tests/codemirrorTrimmedSelectionLayer.test.ts b/packages/app-tests/codemirrorTrimmedSelectionLayer.test.ts index 91e88f841..287a8da72 100644 --- a/packages/app-tests/codemirrorTrimmedSelectionLayer.test.ts +++ b/packages/app-tests/codemirrorTrimmedSelectionLayer.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { trimmedSelectionHorizontalBounds } from "../../apps/desktop/src/lib/codemirrorTrimmedSelectionLayer.ts"; +import { trimmedSelectionHorizontalBounds } from "../../apps/desktop/src/lib/editor/codemirrorTrimmedSelectionLayer.ts"; test("line-break-only selection starts at the content end", () => { const bounds = trimmedSelectionHorizontalBounds({ diff --git a/packages/app-tests/columnFormatter.test.ts b/packages/app-tests/columnFormatter.test.ts index 4d5347760..774e70131 100644 --- a/packages/app-tests/columnFormatter.test.ts +++ b/packages/app-tests/columnFormatter.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { applyColumnFormatter, buildColumnFormatterKey, resolveColumnFormatter, normalizeColumnFormatter, type ColumnFormatterConfig } from "../../apps/desktop/src/lib/columnFormatter.ts"; +import { applyColumnFormatter, buildColumnFormatterKey, resolveColumnFormatter, normalizeColumnFormatter, type ColumnFormatterConfig } from "../../apps/desktop/src/lib/dataGrid/columnFormatter.ts"; import timezone from "dayjs/plugin/timezone"; import utc from "dayjs/plugin/utc"; import dayjs from "dayjs"; diff --git a/packages/app-tests/configCrypto.test.ts b/packages/app-tests/configCrypto.test.ts index 99317c728..2c2a763d5 100644 --- a/packages/app-tests/configCrypto.test.ts +++ b/packages/app-tests/configCrypto.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { CONFIG_CRYPTO_UNAVAILABLE, encryptConfig, decryptConfig, isEncryptedConfig } from "../../apps/desktop/src/lib/configCrypto.ts"; +import { CONFIG_CRYPTO_UNAVAILABLE, encryptConfig, decryptConfig, isEncryptedConfig } from "../../apps/desktop/src/lib/backend/configCrypto.ts"; test("encrypts and decrypts config round-trip", async () => { const original = JSON.stringify([{ id: "1", name: "test", password: "secret123" }]); diff --git a/packages/app-tests/connectionDeepLink.test.ts b/packages/app-tests/connectionDeepLink.test.ts index 522b34d82..45cad4131 100644 --- a/packages/app-tests/connectionDeepLink.test.ts +++ b/packages/app-tests/connectionDeepLink.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { parseConnectionDeepLink } from "../../apps/desktop/src/lib/connectionDeepLink.ts"; +import { parseConnectionDeepLink } from "../../apps/desktop/src/lib/connection/connectionDeepLink.ts"; test("parses dbx connection deep link query fields", () => { const draft = parseConnectionDeepLink("dbx://connection/new?type=postgres&host=db.internal&port=15432&user=app&database=orders&name=Orders"); diff --git a/packages/app-tests/connectionLevelDatabaseBootstrap.test.ts b/packages/app-tests/connectionLevelDatabaseBootstrap.test.ts index 2311a7231..b86bc6553 100644 --- a/packages/app-tests/connectionLevelDatabaseBootstrap.test.ts +++ b/packages/app-tests/connectionLevelDatabaseBootstrap.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { canExecuteWithoutSelectedDatabase, requiresSqlFileTargetDatabaseSelection, supportsConnectionLevelDatabaseBootstrap } from "../../apps/desktop/src/lib/connectionLevelDatabaseBootstrap.ts"; +import { canExecuteWithoutSelectedDatabase, requiresSqlFileTargetDatabaseSelection, supportsConnectionLevelDatabaseBootstrap } from "../../apps/desktop/src/lib/connection/connectionLevelDatabaseBootstrap.ts"; import type { ConnectionConfig } from "../../apps/desktop/src/types/database.ts"; function connection(dbType: ConnectionConfig["db_type"], driverProfile?: string): Pick { diff --git a/packages/app-tests/connectionPresentation.test.ts b/packages/app-tests/connectionPresentation.test.ts index 0bcf7c5ec..64dce8447 100644 --- a/packages/app-tests/connectionPresentation.test.ts +++ b/packages/app-tests/connectionPresentation.test.ts @@ -1,7 +1,7 @@ import { test } from "vitest"; import assert from "node:assert/strict"; import type { ConnectionConfig } from "../../apps/desktop/src/types/database.ts"; -import { connectionDriverLabel, connectionEndpointLabel, connectionIconType, connectionOptionSubtitle, connectionRedactedEndpointLabel, connectionRedactedNameLabel, connectionRedactedOptionSubtitle } from "../../apps/desktop/src/lib/connectionPresentation.ts"; +import { connectionDriverLabel, connectionEndpointLabel, connectionIconType, connectionOptionSubtitle, connectionRedactedEndpointLabel, connectionRedactedNameLabel, connectionRedactedOptionSubtitle } from "../../apps/desktop/src/lib/connection/connectionPresentation.ts"; const baseConnection: ConnectionConfig = { id: "conn-1", diff --git a/packages/app-tests/connectionUrl.test.ts b/packages/app-tests/connectionUrl.test.ts index cef327d79..1db0d9f8e 100644 --- a/packages/app-tests/connectionUrl.test.ts +++ b/packages/app-tests/connectionUrl.test.ts @@ -1,7 +1,7 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { applyParsedConnectionUrl, normalizeMongoConnectionString, parseConnectionUrl } from "../../apps/desktop/src/lib/connectionUrl.ts"; -import { h2FileJdbcUrlWithPath } from "../../apps/desktop/src/lib/h2Connection.ts"; +import { applyParsedConnectionUrl, normalizeMongoConnectionString, parseConnectionUrl } from "../../apps/desktop/src/lib/connection/connectionUrl.ts"; +import { h2FileJdbcUrlWithPath } from "../../apps/desktop/src/lib/database/h2Connection.ts"; test("parses postgres connection URLs", () => { assert.deepEqual(parseConnectionUrl("postgresql://alice:secret@db.example.com:5433/app?sslmode=require"), { diff --git a/packages/app-tests/connectionVisibleDatabases.test.ts b/packages/app-tests/connectionVisibleDatabases.test.ts index 96e769a13..537ed6b3b 100644 --- a/packages/app-tests/connectionVisibleDatabases.test.ts +++ b/packages/app-tests/connectionVisibleDatabases.test.ts @@ -1,7 +1,7 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { buildDraftVisibleDatabasesConnectionId, connectionCanChooseVisibleDatabases, visibleDatabaseSelectionIsStale, initialVisibleDatabaseSelection } from "../../apps/desktop/src/lib/connectionVisibleDatabases.ts"; -import { connectionUsesVisibleSchemaFilter, filterDatabaseNamesForConnection, filterDatabaseNamesForVisiblePicker } from "../../apps/desktop/src/lib/visibleDatabases.ts"; +import { buildDraftVisibleDatabasesConnectionId, connectionCanChooseVisibleDatabases, visibleDatabaseSelectionIsStale, initialVisibleDatabaseSelection } from "../../apps/desktop/src/lib/connection/connectionVisibleDatabases.ts"; +import { connectionUsesVisibleSchemaFilter, filterDatabaseNamesForConnection, filterDatabaseNamesForVisiblePicker } from "../../apps/desktop/src/lib/database/visibleDatabases.ts"; import type { ConnectionConfig } from "../../apps/desktop/src/types/database.ts"; function config(overrides: Partial = {}): ConnectionConfig { diff --git a/packages/app-tests/dataGridCellCoercion.mysql-json.test.ts b/packages/app-tests/dataGridCellCoercion.mysql-json.test.ts index d896c83eb..87e32015f 100644 --- a/packages/app-tests/dataGridCellCoercion.mysql-json.test.ts +++ b/packages/app-tests/dataGridCellCoercion.mysql-json.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { coerceDataGridCellValue } from "../../apps/desktop/src/lib/dataGridCellCoercion.ts"; +import { coerceDataGridCellValue } from "../../apps/desktop/src/lib/dataGrid/dataGridCellCoercion.ts"; test("MySQL JSON field with English quotes should remain unchanged", () => { const input = '{"2:3":"3:4","3:2":"4:3","21:9":"16:9"}'; diff --git a/packages/app-tests/dataGridCellCoercion.test.ts b/packages/app-tests/dataGridCellCoercion.test.ts index fb158e333..3cd783ed3 100644 --- a/packages/app-tests/dataGridCellCoercion.test.ts +++ b/packages/app-tests/dataGridCellCoercion.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { coerceDataGridCellValue, dataGridCellDisplayText, dataGridCellEditorText } from "../../apps/desktop/src/lib/dataGridCellCoercion.ts"; +import { coerceDataGridCellValue, dataGridCellDisplayText, dataGridCellEditorText } from "../../apps/desktop/src/lib/dataGrid/dataGridCellCoercion.ts"; test("formats Postgres array cells with native brace syntax", () => { const columnInfo = { data_type: "_text" }; diff --git a/packages/app-tests/dataGridColumnFilter.test.ts b/packages/app-tests/dataGridColumnFilter.test.ts index 73ce6aef3..2aea023c1 100644 --- a/packages/app-tests/dataGridColumnFilter.test.ts +++ b/packages/app-tests/dataGridColumnFilter.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { appendColumnValueFilterCondition, buildColumnValueFilterCondition, buildColumnValuesFilterCondition } from "../../apps/desktop/src/lib/dataGridColumnFilter.ts"; +import { appendColumnValueFilterCondition, buildColumnValueFilterCondition, buildColumnValuesFilterCondition } from "../../apps/desktop/src/lib/dataGrid/dataGridColumnFilter.ts"; function installFilterFetchMock() { globalThis.fetch = (async (input, init) => { diff --git a/packages/app-tests/dataGridColumnOrder.test.ts b/packages/app-tests/dataGridColumnOrder.test.ts index 05bcbe4b3..b912cf925 100644 --- a/packages/app-tests/dataGridColumnOrder.test.ts +++ b/packages/app-tests/dataGridColumnOrder.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { columnOrderKeysForIndexes, isDefaultColumnOrder, moveVisibleColumnIndex, orderedColumnIndexes, uniqueDataGridColumnOrderKeys } from "../../apps/desktop/src/lib/dataGridColumnOrder"; +import { columnOrderKeysForIndexes, isDefaultColumnOrder, moveVisibleColumnIndex, orderedColumnIndexes, uniqueDataGridColumnOrderKeys } from "../../apps/desktop/src/lib/dataGrid/dataGridColumnOrder"; test("creates stable keys for duplicate column names", () => { assert.deepEqual(uniqueDataGridColumnOrderKeys(["id", "name", "name"]), [`id\u00000`, `name\u00000`, `name\u00001`]); diff --git a/packages/app-tests/dataGridColumnType.test.ts b/packages/app-tests/dataGridColumnType.test.ts index f63453d79..8635f2744 100644 --- a/packages/app-tests/dataGridColumnType.test.ts +++ b/packages/app-tests/dataGridColumnType.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { resolveHeaderColumnType } from "../../apps/desktop/src/lib/dataGridColumnType.ts"; +import { resolveHeaderColumnType } from "../../apps/desktop/src/lib/dataGrid/dataGridColumnType.ts"; test("prefers table-metadata type over the result type", () => { const type = resolveHeaderColumnType({ diff --git a/packages/app-tests/dataGridColumnVisibility.test.ts b/packages/app-tests/dataGridColumnVisibility.test.ts index fd8ac344d..4a902d793 100644 --- a/packages/app-tests/dataGridColumnVisibility.test.ts +++ b/packages/app-tests/dataGridColumnVisibility.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { allNullColumnIndexes, filterColumnVisibilityOptions, hiddenColumnIndexesWithAllNullColumns, invertedHiddenColumnIndexes, nextHiddenColumnIndexes, removeAutoHiddenColumnIndexes, visibleColumnIndexesForFilter } from "../../apps/desktop/src/lib/dataGridColumnVisibility.ts"; +import { allNullColumnIndexes, filterColumnVisibilityOptions, hiddenColumnIndexesWithAllNullColumns, invertedHiddenColumnIndexes, nextHiddenColumnIndexes, removeAutoHiddenColumnIndexes, visibleColumnIndexesForFilter } from "../../apps/desktop/src/lib/dataGrid/dataGridColumnVisibility.ts"; test("filters column visibility options by trimmed case-insensitive text", () => { const options = filterColumnVisibilityOptions(["id", "created_at", "CustomerName"], " NAME "); diff --git a/packages/app-tests/dataGridColumnWidth.test.ts b/packages/app-tests/dataGridColumnWidth.test.ts index 01a90ac0d..7eceb4a08 100644 --- a/packages/app-tests/dataGridColumnWidth.test.ts +++ b/packages/app-tests/dataGridColumnWidth.test.ts @@ -1,5 +1,5 @@ import { expect, test } from "vitest"; -import { calculateDataGridColumnWidth, DATA_GRID_AUTO_FIT_VALUE_TEXT_LIMIT, DATA_GRID_COL_AUTO_FIT_MAX_WIDTH, DATA_GRID_COL_MAX_WIDTH } from "../../apps/desktop/src/lib/dataGridColumnWidth.ts"; +import { calculateDataGridColumnWidth, DATA_GRID_AUTO_FIT_VALUE_TEXT_LIMIT, DATA_GRID_COL_AUTO_FIT_MAX_WIDTH, DATA_GRID_COL_MAX_WIDTH } from "../../apps/desktop/src/lib/dataGrid/dataGridColumnWidth.ts"; test("default data grid column width remains compact for long values", () => { const width = calculateDataGridColumnWidth({ diff --git a/packages/app-tests/dataGridConditionHistory.test.ts b/packages/app-tests/dataGridConditionHistory.test.ts index cbda1e5b3..dfcf96a74 100644 --- a/packages/app-tests/dataGridConditionHistory.test.ts +++ b/packages/app-tests/dataGridConditionHistory.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { beforeEach, test } from "vitest"; -import { forgetDataGridConditionHistory, loadDataGridConditionHistory, rememberDataGridConditionHistory } from "../../apps/desktop/src/lib/dataGridConditionHistory.ts"; +import { forgetDataGridConditionHistory, loadDataGridConditionHistory, rememberDataGridConditionHistory } from "../../apps/desktop/src/lib/dataGrid/dataGridConditionHistory.ts"; class MemoryStorage { private values = new Map(); diff --git a/packages/app-tests/dataGridDetail.test.ts b/packages/app-tests/dataGridDetail.test.ts index 6126ad95c..a143250a1 100644 --- a/packages/app-tests/dataGridDetail.test.ts +++ b/packages/app-tests/dataGridDetail.test.ts @@ -1,8 +1,8 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { buildDataGridCellDetail, buildDataGridColumnDetail, dataGridColumnDetailJson, dataGridColumnDetailTsv, buildDataGridRowDetail, dataGridRowDetailJson, dataGridRowDetailTsv, filterDataGridDetailFields, type DataGridCellDetail } from "../../apps/desktop/src/lib/dataGridDetail.ts"; -import type { CellValue } from "../../apps/desktop/src/lib/cellValue.ts"; +import { buildDataGridCellDetail, buildDataGridColumnDetail, dataGridColumnDetailJson, dataGridColumnDetailTsv, buildDataGridRowDetail, dataGridRowDetailJson, dataGridRowDetailTsv, filterDataGridDetailFields, type DataGridCellDetail } from "../../apps/desktop/src/lib/dataGrid/dataGridDetail.ts"; +import type { CellValue } from "../../apps/desktop/src/lib/dataGrid/cellValue.ts"; test("buildDataGridCellDetail returns null for an invalid column", () => { const detail = buildDataGridCellDetail({ diff --git a/packages/app-tests/dataGridEditor.test.ts b/packages/app-tests/dataGridEditor.test.ts index 0ed9738a5..8ac6ffb30 100644 --- a/packages/app-tests/dataGridEditor.test.ts +++ b/packages/app-tests/dataGridEditor.test.ts @@ -3,9 +3,9 @@ import { test } from "vitest"; import { computed, nextTick, ref } from "vue"; import { createPinia, setActivePinia } from "pinia"; import { DATA_GRID_QUICK_ENTRY_DRAFT_ROW_ID, useDataGridEditor } from "../../apps/desktop/src/composables/useDataGridEditor.ts"; -import type { CellValue } from "../../apps/desktop/src/lib/cellValue.ts"; -import type { DataGridSaveStatementOptions } from "../../apps/desktop/src/lib/dataGridSql.ts"; -import { matchesRowStatusFilter, type RowStatusFilter } from "../../apps/desktop/src/lib/gridRowStatus.ts"; +import type { CellValue } from "../../apps/desktop/src/lib/dataGrid/cellValue.ts"; +import type { DataGridSaveStatementOptions } from "../../apps/desktop/src/lib/dataGrid/dataGridSql.ts"; +import { matchesRowStatusFilter, type RowStatusFilter } from "../../apps/desktop/src/lib/dataGrid/gridRowStatus.ts"; import type { ColumnInfo } from "../../apps/desktop/src/types/database.ts"; function installBrowserTestGlobals() { diff --git a/packages/app-tests/dataGridEnumEditor.test.ts b/packages/app-tests/dataGridEnumEditor.test.ts index 8c941eb1e..c9fa7c9ae 100644 --- a/packages/app-tests/dataGridEnumEditor.test.ts +++ b/packages/app-tests/dataGridEnumEditor.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { isEnumColumn, enumValuesForColumn } from "../../apps/desktop/src/lib/dataGridEnumEditor.ts"; +import { isEnumColumn, enumValuesForColumn } from "../../apps/desktop/src/lib/dataGrid/dataGridEnumEditor.ts"; test("detects MySQL enum column types", () => { assert.equal(isEnumColumn({ data_type: "enum('pending','active','archived')" }), true); diff --git a/packages/app-tests/dataGridExport.test.ts b/packages/app-tests/dataGridExport.test.ts index c496c32a9..10b70670f 100644 --- a/packages/app-tests/dataGridExport.test.ts +++ b/packages/app-tests/dataGridExport.test.ts @@ -2,8 +2,8 @@ import { strict as assert } from "node:assert"; import { beforeEach, test, vi } from "vitest"; import { computed, ref } from "vue"; import { useDataGridExport } from "../../apps/desktop/src/composables/useDataGridExport.ts"; -import { copyToClipboard } from "@/lib/clipboard"; -import * as api from "@/lib/api"; +import { copyToClipboard } from "@/lib/common/clipboard"; +import * as api from "@/lib/backend/api"; vi.mock("vue-i18n", () => ({ useI18n: () => ({ @@ -11,11 +11,11 @@ vi.mock("vue-i18n", () => ({ }), })); -vi.mock("@/lib/clipboard", () => ({ +vi.mock("@/lib/common/clipboard", () => ({ copyToClipboard: vi.fn(async () => {}), })); -vi.mock("@/lib/api", () => ({ +vi.mock("@/lib/backend/api", () => ({ exportQueryResultCsv: vi.fn(async () => {}), })); diff --git a/packages/app-tests/dataGridInfiniteScroll.test.ts b/packages/app-tests/dataGridInfiniteScroll.test.ts index 8e69d466c..60d016d54 100644 --- a/packages/app-tests/dataGridInfiniteScroll.test.ts +++ b/packages/app-tests/dataGridInfiniteScroll.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { dataGridScrollPosition, isDataGridNearScrollBottom, shouldCheckInfiniteScrollAfterScroll } from "../../apps/desktop/src/lib/dataGridInfiniteScroll.ts"; +import { dataGridScrollPosition, isDataGridNearScrollBottom, shouldCheckInfiniteScrollAfterScroll } from "../../apps/desktop/src/lib/dataGrid/dataGridInfiniteScroll.ts"; test("horizontal-only scroll does not check infinite scroll", () => { assert.equal(shouldCheckInfiniteScrollAfterScroll(dataGridScrollPosition(240, 0), dataGridScrollPosition(240, 180)), false); diff --git a/packages/app-tests/dataGridPagination.test.ts b/packages/app-tests/dataGridPagination.test.ts index bbd1ddef1..710324340 100644 --- a/packages/app-tests/dataGridPagination.test.ts +++ b/packages/app-tests/dataGridPagination.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { canGoNextDataGridPage } from "../../apps/desktop/src/lib/dataGridPagination.ts"; +import { canGoNextDataGridPage } from "../../apps/desktop/src/lib/dataGrid/dataGridPagination.ts"; test("known total disables next page at the last exact page", () => { assert.equal( diff --git a/packages/app-tests/dataGridSaveUi.test.ts b/packages/app-tests/dataGridSaveUi.test.ts index 6b74bb327..4ac77814e 100644 --- a/packages/app-tests/dataGridSaveUi.test.ts +++ b/packages/app-tests/dataGridSaveUi.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { dataGridSaveActionMode, dataGridSaveToolbarState } from "../../apps/desktop/src/lib/dataGridSaveUi.ts"; +import { dataGridSaveActionMode, dataGridSaveToolbarState } from "../../apps/desktop/src/lib/dataGrid/dataGridSaveUi.ts"; test("uses concise save and commit labels for the primary grid save action", () => { assert.deepEqual(dataGridSaveActionMode({ pendingChangeCount: 3, useTransaction: true }), { diff --git a/packages/app-tests/dataGridSort.test.ts b/packages/app-tests/dataGridSort.test.ts index 6e779dbfd..7164146aa 100644 --- a/packages/app-tests/dataGridSort.test.ts +++ b/packages/app-tests/dataGridSort.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { sortDataGridRows } from "../../apps/desktop/src/lib/dataGridSort.ts"; +import { sortDataGridRows } from "../../apps/desktop/src/lib/dataGrid/dataGridSort.ts"; test("sortDataGridRows sorts numbers numerically and keeps null values last", () => { const rows = [ diff --git a/packages/app-tests/dataGridTemporalEditor.test.ts b/packages/app-tests/dataGridTemporalEditor.test.ts index 1c4290e27..89fa5cec6 100644 --- a/packages/app-tests/dataGridTemporalEditor.test.ts +++ b/packages/app-tests/dataGridTemporalEditor.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { stepTemporalInputValue } from "../../apps/desktop/src/lib/dataGridTemporalEditor.ts"; +import { stepTemporalInputValue } from "../../apps/desktop/src/lib/dataGrid/dataGridTemporalEditor.ts"; test("steps datetime date and time parts", () => { assert.equal(stepTemporalInputValue("2025-07-01 13:41:49", "datetime", "day", 1), "2025-07-02 13:41:49"); diff --git a/packages/app-tests/dataGridTranspose.test.ts b/packages/app-tests/dataGridTranspose.test.ts index 2ff9ce543..0eebbd2a3 100644 --- a/packages/app-tests/dataGridTranspose.test.ts +++ b/packages/app-tests/dataGridTranspose.test.ts @@ -13,7 +13,7 @@ import { transposeFieldWidth, transposeScrollLeftForRecord, visibleTransposeRecordWindow, -} from "../../apps/desktop/src/lib/dataGridTranspose.ts"; +} from "../../apps/desktop/src/lib/dataGrid/dataGridTranspose.ts"; test("row number double click opens transpose for a row", () => { assert.deepEqual(nextTransposeState(false, null, 2), { diff --git a/packages/app-tests/dataTabActivation.test.ts b/packages/app-tests/dataTabActivation.test.ts index c1b6a5fc8..82652e21f 100644 --- a/packages/app-tests/dataTabActivation.test.ts +++ b/packages/app-tests/dataTabActivation.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { canActivateExistingDataTableTab } from "../../apps/desktop/src/lib/dataTabActivation.ts"; +import { canActivateExistingDataTableTab } from "../../apps/desktop/src/lib/tabs/dataTabActivation.ts"; import type { QueryTab } from "../../apps/desktop/src/types/database.ts"; function dataTab(overrides: Partial = {}): QueryTab { diff --git a/packages/app-tests/databaseCapabilities.test.ts b/packages/app-tests/databaseCapabilities.test.ts index 8c27e2413..93cc8cb2e 100644 --- a/packages/app-tests/databaseCapabilities.test.ts +++ b/packages/app-tests/databaseCapabilities.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { isSchemaAware, supportsDatabaseCreation, usesTreeSchemaMode } from "../../apps/desktop/src/lib/databaseCapabilities.ts"; +import { isSchemaAware, supportsDatabaseCreation, usesTreeSchemaMode } from "../../apps/desktop/src/lib/database/databaseCapabilities.ts"; test("TDengine uses database/catalog tree nodes without a schema layer", () => { assert.equal(isSchemaAware("tdengine"), false); diff --git a/packages/app-tests/databaseExportPlan.test.ts b/packages/app-tests/databaseExportPlan.test.ts index 2ac6722b3..f5170c000 100644 --- a/packages/app-tests/databaseExportPlan.test.ts +++ b/packages/app-tests/databaseExportPlan.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { buildAllDatabaseExportPlan } from "../../apps/desktop/src/lib/databaseExport.ts"; +import { buildAllDatabaseExportPlan } from "../../apps/desktop/src/lib/export/databaseExport.ts"; test("all-database export includes every schema for schema-aware databases", () => { const plan = buildAllDatabaseExportPlan({ diff --git a/packages/app-tests/databaseSearch.test.ts b/packages/app-tests/databaseSearch.test.ts index 276850ca6..55eed2c2c 100644 --- a/packages/app-tests/databaseSearch.test.ts +++ b/packages/app-tests/databaseSearch.test.ts @@ -1,7 +1,7 @@ import { test } from "vitest"; import assert from "node:assert/strict"; import type { ColumnInfo } from "../../apps/desktop/src/types/database.ts"; -import { findMatchedSearchColumns, isNumericSearchColumn, isTextSearchColumn } from "../../apps/desktop/src/lib/databaseSearch.ts"; +import { findMatchedSearchColumns, isNumericSearchColumn, isTextSearchColumn } from "../../apps/desktop/src/lib/database/databaseSearch.ts"; function col(name: string, dataType: string, primary = false): ColumnInfo { return { diff --git a/packages/app-tests/databaseTree.test.ts b/packages/app-tests/databaseTree.test.ts index 2afe0ba87..01ded45b3 100644 --- a/packages/app-tests/databaseTree.test.ts +++ b/packages/app-tests/databaseTree.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { buildDatabaseTreeNodes, sortSidebarNames } from "../../apps/desktop/src/lib/databaseTree.ts"; +import { buildDatabaseTreeNodes, sortSidebarNames } from "../../apps/desktop/src/lib/database/databaseTree.ts"; test("数据库节点按自然名称排序", () => { const nodes = buildDatabaseTreeNodes("conn-1", [{ name: "db10" }, { name: "db2" }, { name: "campaign_data" }, { name: "cms" }, { name: "mk_campaign" }]); diff --git a/packages/app-tests/databaseUserAdmin.test.ts b/packages/app-tests/databaseUserAdmin.test.ts index e38a316f9..eabff811f 100644 --- a/packages/app-tests/databaseUserAdmin.test.ts +++ b/packages/app-tests/databaseUserAdmin.test.ts @@ -28,7 +28,7 @@ import { usersFromMySqlGranteeResult, usersFromMySqlUserResult, usersFromPostgresRolesResult, -} from "../../apps/desktop/src/lib/databaseUserAdmin.ts"; +} from "../../apps/desktop/src/lib/database/databaseUserAdmin.ts"; import type { QueryResult } from "../../apps/desktop/src/types/database.ts"; function result(columns: string[], rows: QueryResult["rows"]): QueryResult { diff --git a/packages/app-tests/dbAdminSql.test.ts b/packages/app-tests/dbAdminSql.test.ts index 0ea117eae..9ad9e5e91 100644 --- a/packages/app-tests/dbAdminSql.test.ts +++ b/packages/app-tests/dbAdminSql.test.ts @@ -1,7 +1,7 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { buildGetSchemaCommentSql, buildSetSchemaCommentSql, supportsSchemaComment } from "../../apps/desktop/src/lib/dbAdminSql.ts"; +import { buildGetSchemaCommentSql, buildSetSchemaCommentSql, supportsSchemaComment } from "../../apps/desktop/src/lib/database/dbAdminSql.ts"; test("postgres schema comment SQL quotes identifiers and literals", () => { assert.equal(supportsSchemaComment("postgres"), true); diff --git a/packages/app-tests/ddlExport.test.ts b/packages/app-tests/ddlExport.test.ts index 921850630..a75d378d8 100644 --- a/packages/app-tests/ddlExport.test.ts +++ b/packages/app-tests/ddlExport.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { buildSingleDdlExportFileContent, ensureSqlStatementTerminator, joinExportedDdls } from "../../apps/desktop/src/lib/ddlExport.ts"; +import { buildSingleDdlExportFileContent, ensureSqlStatementTerminator, joinExportedDdls } from "../../apps/desktop/src/lib/export/ddlExport.ts"; test("ensureSqlStatementTerminator appends a trailing semicolon when missing", () => { assert.equal(ensureSqlStatementTerminator("CREATE TABLE `users` (\n `id` int\n) ENGINE=InnoDB"), "CREATE TABLE `users` (\n `id` int\n) ENGINE=InnoDB;"); diff --git a/packages/app-tests/defaultDatabase.test.ts b/packages/app-tests/defaultDatabase.test.ts index 6e7f7b225..c5aac6b64 100644 --- a/packages/app-tests/defaultDatabase.test.ts +++ b/packages/app-tests/defaultDatabase.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { TREE_SCHEMA_DEFAULT_DATABASE_SELECT_VALUE, decodeSelectableDatabaseValue, encodeSelectableDatabaseValue, formatDatabaseLabel, isDefaultDatabase, resolveDefaultDatabase } from "../../apps/desktop/src/lib/defaultDatabase.ts"; +import { TREE_SCHEMA_DEFAULT_DATABASE_SELECT_VALUE, decodeSelectableDatabaseValue, encodeSelectableDatabaseValue, formatDatabaseLabel, isDefaultDatabase, resolveDefaultDatabase } from "../../apps/desktop/src/lib/database/defaultDatabase.ts"; test("优先使用连接上已保存的默认数据库", () => { assert.equal(resolveDefaultDatabase({ database: "analytics" }, ["app", "analytics"]), "analytics"); diff --git a/packages/app-tests/diagramSvgExport.test.ts b/packages/app-tests/diagramSvgExport.test.ts index 88960022a..a69254391 100644 --- a/packages/app-tests/diagramSvgExport.test.ts +++ b/packages/app-tests/diagramSvgExport.test.ts @@ -1,8 +1,8 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { buildEngineeringDiagram } from "../../apps/desktop/src/lib/engineeringDiagram.ts"; -import { buildEngineeringDiagramSvg, buildTableDiagramSvg, diagramSvgFileName } from "../../apps/desktop/src/lib/diagramSvgExport.ts"; -import { buildDiagramRelationships, type DiagramTable } from "../../apps/desktop/src/lib/erDiagram.ts"; +import { buildEngineeringDiagram } from "../../apps/desktop/src/lib/diagram/engineeringDiagram.ts"; +import { buildEngineeringDiagramSvg, buildTableDiagramSvg, diagramSvgFileName } from "../../apps/desktop/src/lib/export/diagramSvgExport.ts"; +import { buildDiagramRelationships, type DiagramTable } from "../../apps/desktop/src/lib/diagram/erDiagram.ts"; const tables: DiagramTable[] = [ { diff --git a/packages/app-tests/documentStoreProvider.test.ts b/packages/app-tests/documentStoreProvider.test.ts index 67e483d3a..864c100bc 100644 --- a/packages/app-tests/documentStoreProvider.test.ts +++ b/packages/app-tests/documentStoreProvider.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { buildDocumentFilterCondition, combineDocumentFilterConditions, currentDocumentFilterJson, documentStoreProviderFor, elasticsearchSearchBodyFromDocumentQuery, type DocumentFilterRule } from "../../apps/desktop/src/lib/documentStoreProvider.ts"; +import { buildDocumentFilterCondition, combineDocumentFilterConditions, currentDocumentFilterJson, documentStoreProviderFor, elasticsearchSearchBodyFromDocumentQuery, type DocumentFilterRule } from "../../apps/desktop/src/lib/app/documentStoreProvider.ts"; function rule(patch: Partial): DocumentFilterRule { return { diff --git a/packages/app-tests/documentViewerFontStyle.test.ts b/packages/app-tests/documentViewerFontStyle.test.ts index dcb180214..c4eb6dd28 100644 --- a/packages/app-tests/documentViewerFontStyle.test.ts +++ b/packages/app-tests/documentViewerFontStyle.test.ts @@ -1,7 +1,7 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { EDITOR_FONT_FAMILY_CSS_VAR, EDITOR_FONT_SIZE_CSS_VAR } from "../../apps/desktop/src/lib/editorThemes.ts"; -import { documentViewerFontStyle } from "../../apps/desktop/src/lib/documentViewerFontStyle.ts"; +import { EDITOR_FONT_FAMILY_CSS_VAR, EDITOR_FONT_SIZE_CSS_VAR } from "../../apps/desktop/src/lib/editor/editorThemes.ts"; +import { documentViewerFontStyle } from "../../apps/desktop/src/lib/document/documentViewerFontStyle.ts"; test("document viewer font style follows editor font settings", () => { assert.deepEqual( diff --git a/packages/app-tests/driverInstallProgressUi.test.ts b/packages/app-tests/driverInstallProgressUi.test.ts index ae49a0a36..bd6c7dd33 100644 --- a/packages/app-tests/driverInstallProgressUi.test.ts +++ b/packages/app-tests/driverInstallProgressUi.test.ts @@ -1,7 +1,7 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { addDriverInstallQueue, driverInstallProgressPercent, isDriverInstallProgressTarget, removeDriverInstallQueue, takeNextDriverInstallQueue } from "../../apps/desktop/src/lib/driverInstallProgressUi.ts"; +import { addDriverInstallQueue, driverInstallProgressPercent, isDriverInstallProgressTarget, removeDriverInstallQueue, takeNextDriverInstallQueue } from "../../apps/desktop/src/lib/connection/driverInstallProgressUi.ts"; test("formats driver install progress as a bounded whole percent", () => { assert.equal(driverInstallProgressPercent({ step: "driver", downloaded: 3_900_000, total: 10_500_000 }), 37); diff --git a/packages/app-tests/elasticsearchCompletion.test.ts b/packages/app-tests/elasticsearchCompletion.test.ts index 75f7ed8b7..a0b84a502 100644 --- a/packages/app-tests/elasticsearchCompletion.test.ts +++ b/packages/app-tests/elasticsearchCompletion.test.ts @@ -1,7 +1,7 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { buildElasticsearchCompletionItems, getElasticsearchCompletionContext, shouldAutoOpenElasticsearchCompletion } from "../../apps/desktop/src/lib/elasticsearchCompletion.ts"; -import { buildSqlCompletionItems } from "../../apps/desktop/src/lib/sqlCompletion.ts"; +import { buildElasticsearchCompletionItems, getElasticsearchCompletionContext, shouldAutoOpenElasticsearchCompletion } from "../../apps/desktop/src/lib/elasticsearch/elasticsearchCompletion.ts"; +import { buildSqlCompletionItems } from "../../apps/desktop/src/lib/sql/sqlCompletion.ts"; const indices = ["orders", "order_items", "users"]; diff --git a/packages/app-tests/engineeringDiagram.test.ts b/packages/app-tests/engineeringDiagram.test.ts index 4913596a6..a9679ff2c 100644 --- a/packages/app-tests/engineeringDiagram.test.ts +++ b/packages/app-tests/engineeringDiagram.test.ts @@ -1,7 +1,7 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { buildEngineeringDiagram } from "../../apps/desktop/src/lib/engineeringDiagram.ts"; -import type { DiagramRelationship, DiagramTable } from "../../apps/desktop/src/lib/erDiagram.ts"; +import { buildEngineeringDiagram } from "../../apps/desktop/src/lib/diagram/engineeringDiagram.ts"; +import type { DiagramRelationship, DiagramTable } from "../../apps/desktop/src/lib/diagram/erDiagram.ts"; const tables: DiagramTable[] = [ { diff --git a/packages/app-tests/erDiagram.test.ts b/packages/app-tests/erDiagram.test.ts index 3c30421b0..7f694168d 100644 --- a/packages/app-tests/erDiagram.test.ts +++ b/packages/app-tests/erDiagram.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { buildDiagramJoinSql, buildDiagramRelationships, filterDiagramTables, layoutDiagramTables, normalizeCustomDiagramRelationship } from "../../apps/desktop/src/lib/erDiagram.ts"; +import { buildDiagramJoinSql, buildDiagramRelationships, filterDiagramTables, layoutDiagramTables, normalizeCustomDiagramRelationship } from "../../apps/desktop/src/lib/diagram/erDiagram.ts"; test("builds relationships only between tables in the diagram", () => { const relationships = buildDiagramRelationships([ diff --git a/packages/app-tests/exportFormats.test.ts b/packages/app-tests/exportFormats.test.ts index 1fdf686d9..b067de99c 100644 --- a/packages/app-tests/exportFormats.test.ts +++ b/packages/app-tests/exportFormats.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { formatCsv } from "../../apps/desktop/src/lib/exportFormats.ts"; +import { formatCsv } from "../../apps/desktop/src/lib/export/exportFormats.ts"; test("formatCsv preserves query result null display text", () => { assert.equal(formatCsv(["id", "note"], [[1, null]]), "\"id\",\"note\"\n\"1\",\"NULL\""); diff --git a/packages/app-tests/fieldLineage.test.ts b/packages/app-tests/fieldLineage.test.ts index e23bfac8e..166cc3388 100644 --- a/packages/app-tests/fieldLineage.test.ts +++ b/packages/app-tests/fieldLineage.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { analyzeFieldLineage, identifierInSql, summarizeLineageCounts } from "../../apps/desktop/src/lib/fieldLineage.ts"; +import { analyzeFieldLineage, identifierInSql, summarizeLineageCounts } from "../../apps/desktop/src/lib/diagram/fieldLineage.ts"; test("detects outgoing and incoming foreign key lineage as certain", () => { const result = analyzeFieldLineage({ diff --git a/packages/app-tests/gridRowStatus.test.ts b/packages/app-tests/gridRowStatus.test.ts index 8e741d568..dbd9a2e73 100644 --- a/packages/app-tests/gridRowStatus.test.ts +++ b/packages/app-tests/gridRowStatus.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { canApplyGridSelectionValue, matchesRowStatusFilter, rowStatusFilterAfterAddingRow, type RowStatus } from "../../apps/desktop/src/lib/gridRowStatus.ts"; +import { canApplyGridSelectionValue, matchesRowStatusFilter, rowStatusFilterAfterAddingRow, type RowStatus } from "../../apps/desktop/src/lib/dataGrid/gridRowStatus.ts"; const statuses: RowStatus[] = ["clean", "edited", "new", "deleted"]; diff --git a/packages/app-tests/gridSelection.test.ts b/packages/app-tests/gridSelection.test.ts index 78d137099..27b143b61 100644 --- a/packages/app-tests/gridSelection.test.ts +++ b/packages/app-tests/gridSelection.test.ts @@ -13,7 +13,7 @@ import { normalizeSelectionRange, parseClipboardTable, rowSelectionRange, -} from "../../apps/desktop/src/lib/gridSelection.ts"; +} from "../../apps/desktop/src/lib/dataGrid/gridSelection.ts"; test("normalizes a dragged cell range in either direction", () => { const range = normalizeSelectionRange({ rowIndex: 4, colIndex: 3 }, { rowIndex: 1, colIndex: 0 }); diff --git a/packages/app-tests/historyActivityKind.test.ts b/packages/app-tests/historyActivityKind.test.ts index 3e6b69a4b..f829b97e9 100644 --- a/packages/app-tests/historyActivityKind.test.ts +++ b/packages/app-tests/historyActivityKind.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { resolveHistoryActivityKind } from "../../apps/desktop/src/lib/historyActivityKind.ts"; +import { resolveHistoryActivityKind } from "../../apps/desktop/src/lib/history/historyActivityKind.ts"; test("legacy INSERT history entries are treated as data changes", () => { assert.equal( diff --git a/packages/app-tests/historyAiAnalysis.test.ts b/packages/app-tests/historyAiAnalysis.test.ts index 77654288b..46ac59f23 100644 --- a/packages/app-tests/historyAiAnalysis.test.ts +++ b/packages/app-tests/historyAiAnalysis.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { buildHistoryAiAnalysisPrompt, canRollbackHistoryEntry, type HistoryAiAnalysisEntry } from "../../apps/desktop/src/lib/historyAiAnalysis.ts"; +import { buildHistoryAiAnalysisPrompt, canRollbackHistoryEntry, type HistoryAiAnalysisEntry } from "../../apps/desktop/src/lib/history/historyAiAnalysis.ts"; const baseEntry: HistoryAiAnalysisEntry = { id: "h1", diff --git a/packages/app-tests/historyTimeRange.test.ts b/packages/app-tests/historyTimeRange.test.ts index d9bb12d3a..fad08650b 100644 --- a/packages/app-tests/historyTimeRange.test.ts +++ b/packages/app-tests/historyTimeRange.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { historyDateRangeIsValid, historyEntryMatchesDateRange } from "../../apps/desktop/src/lib/historyTimeRange.ts"; +import { historyDateRangeIsValid, historyEntryMatchesDateRange } from "../../apps/desktop/src/lib/history/historyTimeRange.ts"; test("matches entries on the selected start and end dates inclusively", () => { const range = { startDate: "2026-06-01", endDate: "2026-06-18" }; diff --git a/packages/app-tests/imagePreviewViewer.test.ts b/packages/app-tests/imagePreviewViewer.test.ts index cf0b1bf53..8bffcc849 100644 --- a/packages/app-tests/imagePreviewViewer.test.ts +++ b/packages/app-tests/imagePreviewViewer.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { imagePreviewDialogSize } from "../../apps/desktop/src/lib/imagePreviewViewer.ts"; +import { imagePreviewDialogSize } from "../../apps/desktop/src/lib/dataGrid/imagePreviewViewer.ts"; test("sizes wide image preview dialogs as landscape", () => { const size = imagePreviewDialogSize({ diff --git a/packages/app-tests/jdbcDialect.test.ts b/packages/app-tests/jdbcDialect.test.ts index bd2b46442..0f1673f16 100644 --- a/packages/app-tests/jdbcDialect.test.ts +++ b/packages/app-tests/jdbcDialect.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { effectiveDatabaseTypeForConnection, inferJdbcDialect } from "../../apps/desktop/src/lib/jdbcDialect.ts"; +import { effectiveDatabaseTypeForConnection, inferJdbcDialect } from "../../apps/desktop/src/lib/database/jdbcDialect.ts"; test("infers GoldenDB for generic JDBC connections", () => { assert.equal( diff --git a/packages/app-tests/jsonCopyValue.test.ts b/packages/app-tests/jsonCopyValue.test.ts index b3e1258e9..cc5c03a3c 100644 --- a/packages/app-tests/jsonCopyValue.test.ts +++ b/packages/app-tests/jsonCopyValue.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { expandNestedJsonStringsForCopy } from "../../apps/desktop/src/lib/jsonCopyValue.ts"; +import { expandNestedJsonStringsForCopy } from "../../apps/desktop/src/lib/common/jsonCopyValue.ts"; test("expands nested JSON strings for copied rows", () => { const value = { diff --git a/packages/app-tests/keyboardShortcuts.test.ts b/packages/app-tests/keyboardShortcuts.test.ts index 57e69e059..322e4de40 100644 --- a/packages/app-tests/keyboardShortcuts.test.ts +++ b/packages/app-tests/keyboardShortcuts.test.ts @@ -25,8 +25,8 @@ import { isZoomInShortcut, isZoomOutShortcut, switchToTabIndexFromShortcut, -} from "../../apps/desktop/src/lib/keyboardShortcuts.ts"; -import { shortcutToCodeMirrorKey } from "../../apps/desktop/src/lib/shortcutRegistry.ts"; +} from "../../apps/desktop/src/lib/editor/keyboardShortcuts.ts"; +import { shortcutToCodeMirrorKey } from "../../apps/desktop/src/lib/editor/shortcutRegistry.ts"; test("matches Cmd+Enter for SQL execution", () => { assert.equal(isExecuteSqlShortcut({ key: "Enter", metaKey: true }), true); diff --git a/packages/app-tests/metadataTaskLimiter.test.ts b/packages/app-tests/metadataTaskLimiter.test.ts index d9223f792..a5ea1ea4a 100644 --- a/packages/app-tests/metadataTaskLimiter.test.ts +++ b/packages/app-tests/metadataTaskLimiter.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { MetadataTaskLimiter } from "../../apps/desktop/src/lib/metadataTaskLimiter.ts"; +import { MetadataTaskLimiter } from "../../apps/desktop/src/lib/metadata/metadataTaskLimiter.ts"; function deferred() { let resolve!: (value: T) => void; diff --git a/packages/app-tests/mongoCompletion.test.ts b/packages/app-tests/mongoCompletion.test.ts index bf2d8d35f..7f3e26c57 100644 --- a/packages/app-tests/mongoCompletion.test.ts +++ b/packages/app-tests/mongoCompletion.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { buildMongoCompletionItems, getMongoCompletionContext, inferMongoCompletionFields, shouldAutoOpenMongoCompletion } from "../../apps/desktop/src/lib/mongoCompletion.ts"; +import { buildMongoCompletionItems, getMongoCompletionContext, inferMongoCompletionFields, shouldAutoOpenMongoCompletion } from "../../apps/desktop/src/lib/mongo/mongoCompletion.ts"; const collections = ["users", "user_events", "order-items"]; const fields = [ diff --git a/packages/app-tests/mongoConnectionOptions.test.ts b/packages/app-tests/mongoConnectionOptions.test.ts index 0868b3fde..0d22927f4 100644 --- a/packages/app-tests/mongoConnectionOptions.test.ts +++ b/packages/app-tests/mongoConnectionOptions.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { mongoUrlParam, mongoUrlParamIsTrue, normalizeMongoTlsFormState, setMongoUrlParam, setMongoUrlParamBoolean, mongodbAuthFailureHint } from "../../apps/desktop/src/lib/mongoConnectionOptions.ts"; +import { mongoUrlParam, mongoUrlParamIsTrue, normalizeMongoTlsFormState, setMongoUrlParam, setMongoUrlParamBoolean, mongodbAuthFailureHint } from "../../apps/desktop/src/lib/mongo/mongoConnectionOptions.ts"; test("reads MongoDB authSource from URL params", () => { assert.equal(mongoUrlParam("?replicaSet=rs0&authSource=admin", "authSource"), "admin"); diff --git a/packages/app-tests/mongoDocumentValues.test.ts b/packages/app-tests/mongoDocumentValues.test.ts index e5d4ac83b..03fc47bbf 100644 --- a/packages/app-tests/mongoDocumentValues.test.ts +++ b/packages/app-tests/mongoDocumentValues.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { buildMongoCopyInsertDocument, buildMongoInsertDocument, buildMongoUpdateDocument, formatMongoShellLiteral, parseMongoDocumentInputValue } from "../../apps/desktop/src/lib/mongoDocumentValues.ts"; +import { buildMongoCopyInsertDocument, buildMongoInsertDocument, buildMongoUpdateDocument, formatMongoShellLiteral, parseMongoDocumentInputValue } from "../../apps/desktop/src/lib/mongo/mongoDocumentValues.ts"; test("parses Mongo shell ISODate literals as extended JSON dates", () => { assert.deepEqual(parseMongoDocumentInputValue('ISODate("2026-06-10T13:59:31.287Z")'), { diff --git a/packages/app-tests/mongoFormatter.test.ts b/packages/app-tests/mongoFormatter.test.ts index f1b56632c..d013f7939 100644 --- a/packages/app-tests/mongoFormatter.test.ts +++ b/packages/app-tests/mongoFormatter.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { formatMongoShellText, MAX_MONGO_FORMAT_CHARS } from "../../apps/desktop/src/lib/mongoFormatter.ts"; +import { formatMongoShellText, MAX_MONGO_FORMAT_CHARS } from "../../apps/desktop/src/lib/mongo/mongoFormatter.ts"; test("formats MongoDB find query objects", () => { assert.equal( diff --git a/packages/app-tests/mongoShellCommand.test.ts b/packages/app-tests/mongoShellCommand.test.ts index 5952ff9d8..c01ebd266 100644 --- a/packages/app-tests/mongoShellCommand.test.ts +++ b/packages/app-tests/mongoShellCommand.test.ts @@ -18,8 +18,8 @@ import { parseMongoWriteCommand, splitMongoCommands, splitMongoCommandRanges, -} from "../../apps/desktop/src/lib/mongoShellCommand.ts"; -import { buildMongoUpdateDocument as buildMongoDocumentUpdate, formatMongoShellLiteral as formatMongoDocumentShellLiteral } from "../../apps/desktop/src/lib/mongoDocumentValues.ts"; +} from "../../apps/desktop/src/lib/mongo/mongoShellCommand.ts"; +import { buildMongoUpdateDocument as buildMongoDocumentUpdate, formatMongoShellLiteral as formatMongoDocumentShellLiteral } from "../../apps/desktop/src/lib/mongo/mongoDocumentValues.ts"; test("parseMongoFindCommand parses db collection find with an empty JSON filter", () => { assert.deepEqual(parseMongoFindCommand("db.users.find({})"), { diff --git a/packages/app-tests/newQueryContext.test.ts b/packages/app-tests/newQueryContext.test.ts index 15b081a2b..e3d5b744f 100644 --- a/packages/app-tests/newQueryContext.test.ts +++ b/packages/app-tests/newQueryContext.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { resolveNewQueryTarget } from "../../apps/desktop/src/lib/newQueryContext.ts"; +import { resolveNewQueryTarget } from "../../apps/desktop/src/lib/sql/newQueryContext.ts"; import type { ConnectionConfig, QueryTab, TreeNode } from "../../apps/desktop/src/types/database.ts"; function connection(id: string, database = ""): ConnectionConfig { diff --git a/packages/app-tests/objectBrowserRows.test.ts b/packages/app-tests/objectBrowserRows.test.ts index d0b99f1b3..6b4fe7063 100644 --- a/packages/app-tests/objectBrowserRows.test.ts +++ b/packages/app-tests/objectBrowserRows.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { buildObjectBrowserRows, filterObjectBrowserRows, formatObjectBrowserBytes, formatObjectBrowserCount, formatObjectBrowserTimestamp, sortObjectBrowserRows } from "../../apps/desktop/src/lib/objectBrowserRows.ts"; +import { buildObjectBrowserRows, filterObjectBrowserRows, formatObjectBrowserBytes, formatObjectBrowserCount, formatObjectBrowserTimestamp, sortObjectBrowserRows } from "../../apps/desktop/src/lib/table/objectBrowserRows.ts"; test("builds unique row ids for overloaded routines with the same visible name", () => { const rows = buildObjectBrowserRows({ diff --git a/packages/app-tests/oceanbaseConnectionMode.test.ts b/packages/app-tests/oceanbaseConnectionMode.test.ts index bc4ce1b7c..446f98a5c 100644 --- a/packages/app-tests/oceanbaseConnectionMode.test.ts +++ b/packages/app-tests/oceanbaseConnectionMode.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { oceanbaseModeConnectionPatch, oceanbaseSubModeFromConfig } from "../../apps/desktop/src/lib/oceanbaseConnectionMode.ts"; +import { oceanbaseModeConnectionPatch, oceanbaseSubModeFromConfig } from "../../apps/desktop/src/lib/database/oceanbaseConnectionMode.ts"; test("detects OceanBase Oracle mode from either database type or driver profile", () => { assert.equal(oceanbaseSubModeFromConfig({ db_type: "mysql", driver_profile: "oceanbase-oracle" }), "oracle"); diff --git a/packages/app-tests/openTabsPersistence.test.ts b/packages/app-tests/openTabsPersistence.test.ts index 1d41db1fc..aea8ce76c 100644 --- a/packages/app-tests/openTabsPersistence.test.ts +++ b/packages/app-tests/openTabsPersistence.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { restoreOpenTabsState, serializeOpenTabs } from "../../apps/desktop/src/lib/openTabsPersistence.ts"; +import { restoreOpenTabsState, serializeOpenTabs } from "../../apps/desktop/src/lib/app/openTabsPersistence.ts"; import type { QueryTab } from "../../apps/desktop/src/types/database.ts"; function queryTab(overrides: Partial = {}): QueryTab { diff --git a/packages/app-tests/pinnedItems.test.ts b/packages/app-tests/pinnedItems.test.ts index 199199342..8879c2167 100644 --- a/packages/app-tests/pinnedItems.test.ts +++ b/packages/app-tests/pinnedItems.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { applyPinnedTreeNodeState, orderPinnedFirst } from "../../apps/desktop/src/lib/pinnedItems.ts"; +import { applyPinnedTreeNodeState, orderPinnedFirst } from "../../apps/desktop/src/lib/app/pinnedItems.ts"; import type { TreeNode } from "../../apps/desktop/src/types/database.ts"; test("orders pinned items before unpinned items without changing relative order", () => { diff --git a/packages/app-tests/queryCursorTableTarget.test.ts b/packages/app-tests/queryCursorTableTarget.test.ts index 971c0be5d..569d1df8a 100644 --- a/packages/app-tests/queryCursorTableTarget.test.ts +++ b/packages/app-tests/queryCursorTableTarget.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { extractQualifiedIdentifierPartsAt, findLoadedTableTargetForCandidate, qualifiedTableNameAtSqlPosition, queryContextTargetFromCandidate, queryCursorTableCandidate } from "../../apps/desktop/src/lib/queryCursorTableTarget.ts"; +import { extractQualifiedIdentifierPartsAt, findLoadedTableTargetForCandidate, qualifiedTableNameAtSqlPosition, queryContextTargetFromCandidate, queryCursorTableCandidate } from "../../apps/desktop/src/lib/sql/queryCursorTableTarget.ts"; import type { QueryTab, TreeNode } from "../../apps/desktop/src/types/database.ts"; function queryTab(sql: string, head: number, schema = "public"): QueryTab { diff --git a/packages/app-tests/queryEditorTableDrop.test.ts b/packages/app-tests/queryEditorTableDrop.test.ts index 3bed891b9..b89392997 100644 --- a/packages/app-tests/queryEditorTableDrop.test.ts +++ b/packages/app-tests/queryEditorTableDrop.test.ts @@ -10,7 +10,7 @@ import { serializeTableReferencePayload, setActiveTableReferencePayload, tableReferenceInsertText, -} from "../../apps/desktop/src/lib/queryEditorTableDrop.ts"; +} from "../../apps/desktop/src/lib/editor/queryEditorTableDrop.ts"; test("creates table drag payload only when table context is complete", () => { assert.equal(createTableReferencePayload({ connectionId: "c1", database: "db" }), null); diff --git a/packages/app-tests/queryResultArchive.test.ts b/packages/app-tests/queryResultArchive.test.ts index 5c2503d32..c782e0f41 100644 --- a/packages/app-tests/queryResultArchive.test.ts +++ b/packages/app-tests/queryResultArchive.test.ts @@ -1,7 +1,7 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { buildTabResultSnapshot } from "../../apps/desktop/src/lib/tabResultCache.ts"; -import { decodeQueryResultArchive, defaultQueryResultArchiveFileName, encodeQueryResultArchive } from "../../apps/desktop/src/lib/queryResultArchive.ts"; +import { buildTabResultSnapshot } from "../../apps/desktop/src/lib/tabs/tabResultCache.ts"; +import { decodeQueryResultArchive, defaultQueryResultArchiveFileName, encodeQueryResultArchive } from "../../apps/desktop/src/lib/query/queryResultArchive.ts"; import type { QueryTab } from "../../apps/desktop/src/types/database.ts"; function queryTab(overrides: Partial = {}): QueryTab { diff --git a/packages/app-tests/queryStore.test.ts b/packages/app-tests/queryStore.test.ts index f1c2257a2..2dbd2d807 100644 --- a/packages/app-tests/queryStore.test.ts +++ b/packages/app-tests/queryStore.test.ts @@ -2,7 +2,7 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; import { createPinia, setActivePinia } from "pinia"; import { isReactive } from "vue"; -import { decodeQueryResultArchive } from "../../apps/desktop/src/lib/queryResultArchive.ts"; +import { decodeQueryResultArchive } from "../../apps/desktop/src/lib/query/queryResultArchive.ts"; import { useConnectionStore } from "../../apps/desktop/src/stores/connectionStore.ts"; import { useQueryStore } from "../../apps/desktop/src/stores/queryStore.ts"; import { useSettingsStore } from "../../apps/desktop/src/stores/settingsStore.ts"; diff --git a/packages/app-tests/queryTimeout.test.ts b/packages/app-tests/queryTimeout.test.ts index 955cbb5f7..b8379321e 100644 --- a/packages/app-tests/queryTimeout.test.ts +++ b/packages/app-tests/queryTimeout.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { DEFAULT_QUERY_TIMEOUT_SECS, frontendQueryTimeoutSecsForSql, queryTimeoutSecsForConnection } from "../../apps/desktop/src/lib/queryTimeout.ts"; +import { DEFAULT_QUERY_TIMEOUT_SECS, frontendQueryTimeoutSecsForSql, queryTimeoutSecsForConnection } from "../../apps/desktop/src/lib/sql/queryTimeout.ts"; test("queryTimeoutSecsForConnection falls back to the default timeout", () => { assert.equal(queryTimeoutSecsForConnection(undefined), DEFAULT_QUERY_TIMEOUT_SECS); diff --git a/packages/app-tests/redisCommandSession.test.ts b/packages/app-tests/redisCommandSession.test.ts index 225cf2f0a..1c295f20a 100644 --- a/packages/app-tests/redisCommandSession.test.ts +++ b/packages/app-tests/redisCommandSession.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { isRedisClearScreenCommand, nextRedisCommandDb, redisKeyTextToRaw } from "../../apps/desktop/src/lib/redisCommandSession.ts"; +import { isRedisClearScreenCommand, nextRedisCommandDb, redisKeyTextToRaw } from "../../apps/desktop/src/lib/redis/redisCommandSession.ts"; test("keeps Redis command session database after SELECT succeeds", () => { assert.equal(nextRedisCommandDb(3, "SELECT 0", "OK"), 0); diff --git a/packages/app-tests/redisCommandTable.test.ts b/packages/app-tests/redisCommandTable.test.ts index 5d1a72a7f..ab3825ec8 100644 --- a/packages/app-tests/redisCommandTable.test.ts +++ b/packages/app-tests/redisCommandTable.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { isRedisMutatingCommand, resolveRedisCommandSpec } from "../../apps/desktop/src/lib/redisCommandTable.ts"; +import { isRedisMutatingCommand, resolveRedisCommandSpec } from "../../apps/desktop/src/lib/redis/redisCommandTable.ts"; test("write commands are flagged as mutating", () => { assert.equal(isRedisMutatingCommand("SET foo bar"), true); diff --git a/packages/app-tests/redisCompletion.test.ts b/packages/app-tests/redisCompletion.test.ts index 8e477e094..26e77cced 100644 --- a/packages/app-tests/redisCompletion.test.ts +++ b/packages/app-tests/redisCompletion.test.ts @@ -6,7 +6,7 @@ import { getRedisCompletionResultValidFor, shouldAutoOpenRedisCompletion, takesKeyArgument, -} from "../../apps/desktop/src/lib/redisCompletion.ts"; +} from "../../apps/desktop/src/lib/redis/redisCompletion.ts"; function labels(items: { label: string }[]): string[] { return items.map((item) => item.label); diff --git a/packages/app-tests/redisKeyTree.test.ts b/packages/app-tests/redisKeyTree.test.ts index dc80bd5cd..1d1d3a357 100644 --- a/packages/app-tests/redisKeyTree.test.ts +++ b/packages/app-tests/redisKeyTree.test.ts @@ -1,7 +1,7 @@ import { test } from "vitest"; import assert from "node:assert/strict"; -import { buildRedisKeyTree, collectRedisGroupKeyRaws, collectExpandedGroupIds, flattenVisibleRedisKeyTree, mergeKeysIntoRedisKeyTree, redisKeyNameCopyText, redisKeyToFlatTreeRow, type RedisKeyTreeNode } from "../../apps/desktop/src/lib/redisKeyTree.ts"; -import type { RedisKeyInfo } from "../../apps/desktop/src/lib/api.ts"; +import { buildRedisKeyTree, collectRedisGroupKeyRaws, collectExpandedGroupIds, flattenVisibleRedisKeyTree, mergeKeysIntoRedisKeyTree, redisKeyNameCopyText, redisKeyToFlatTreeRow, type RedisKeyTreeNode } from "../../apps/desktop/src/lib/redis/redisKeyTree.ts"; +import type { RedisKeyInfo } from "../../apps/desktop/src/lib/backend/api.ts"; function makeKey(key_display: string, key_raw: string, key_type = "string", ttl = -1): RedisKeyInfo { return { key_display, key_raw, key_type, ttl }; diff --git a/packages/app-tests/redisSyntaxDiagnostics.test.ts b/packages/app-tests/redisSyntaxDiagnostics.test.ts index d5bf86d80..578d87f09 100644 --- a/packages/app-tests/redisSyntaxDiagnostics.test.ts +++ b/packages/app-tests/redisSyntaxDiagnostics.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { buildRedisSyntaxDiagnostics, shouldRunRedisDiagnostics, tokenizeRedisLine } from "../../apps/desktop/src/lib/redisSyntaxDiagnostics.ts"; +import { buildRedisSyntaxDiagnostics, shouldRunRedisDiagnostics, tokenizeRedisLine } from "../../apps/desktop/src/lib/redis/redisSyntaxDiagnostics.ts"; function messages(source: string): string[] { return buildRedisSyntaxDiagnostics(source).map((d) => d.message); diff --git a/packages/app-tests/redisValuePresentation.test.ts b/packages/app-tests/redisValuePresentation.test.ts index 231214905..e6d900a3f 100644 --- a/packages/app-tests/redisValuePresentation.test.ts +++ b/packages/app-tests/redisValuePresentation.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { canEditRedisMemberDetail, clampRedisMemberDetailSheetWidth, formatRedisCommandResult, formatRedisMemberDetail, formatRedisStringValue, getRedisMemberSelectionKey, highlightRedisJsonDetail, parseRedisJsonDetail } from "../../apps/desktop/src/lib/redisValuePresentation.ts"; +import { canEditRedisMemberDetail, clampRedisMemberDetailSheetWidth, formatRedisCommandResult, formatRedisMemberDetail, formatRedisStringValue, getRedisMemberSelectionKey, highlightRedisJsonDetail, parseRedisJsonDetail } from "../../apps/desktop/src/lib/redis/redisValuePresentation.ts"; test("formats JSON object strings for Redis member details", () => { const detail = formatRedisMemberDetail('{"id":1,"name":"Ada","tags":["dbx","redis"]}'); diff --git a/packages/app-tests/routineExecutionSql.test.ts b/packages/app-tests/routineExecutionSql.test.ts index 05e0e971d..a5804c20c 100644 --- a/packages/app-tests/routineExecutionSql.test.ts +++ b/packages/app-tests/routineExecutionSql.test.ts @@ -1,7 +1,7 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { buildProcedureExecutionSql, buildProcedureExecutionSqlFromValues } from "../../apps/desktop/src/lib/routineExecutionSql.ts"; -import { routineParametersFromResult, routineParametersQuery } from "../../apps/desktop/src/lib/routineParameters.ts"; +import { buildProcedureExecutionSql, buildProcedureExecutionSqlFromValues } from "../../apps/desktop/src/lib/table/routineExecutionSql.ts"; +import { routineParametersFromResult, routineParametersQuery } from "../../apps/desktop/src/lib/table/routineParameters.ts"; test("builds procedure execution templates for common dialect families", () => { assert.equal(buildProcedureExecutionSql({ databaseType: "postgres", schema: "public", routineName: "refresh_stats" }), 'CALL "public"."refresh_stats"();'); diff --git a/packages/app-tests/savedSqlHistory.test.ts b/packages/app-tests/savedSqlHistory.test.ts index f9d1f79ed..5b5f1ba4e 100644 --- a/packages/app-tests/savedSqlHistory.test.ts +++ b/packages/app-tests/savedSqlHistory.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { rankSavedSqlHistory, savedSqlHistoryScore, savedSqlMatchesHistoryScope } from "../../apps/desktop/src/lib/savedSqlHistory.ts"; +import { rankSavedSqlHistory, savedSqlHistoryScore, savedSqlMatchesHistoryScope } from "../../apps/desktop/src/lib/savedSql/savedSqlHistory.ts"; import type { SavedSqlFile } from "../../apps/desktop/src/types/database.ts"; function file(input: Partial & Pick): SavedSqlFile { diff --git a/packages/app-tests/savedSqlStore.test.ts b/packages/app-tests/savedSqlStore.test.ts index 212a53d8a..450c36184 100644 --- a/packages/app-tests/savedSqlStore.test.ts +++ b/packages/app-tests/savedSqlStore.test.ts @@ -12,7 +12,7 @@ const apiMock = vi.hoisted(() => ({ syncSavedSqlDirectory: vi.fn<() => Promise>(), })); -vi.mock("@/lib/api", () => apiMock); +vi.mock("@/lib/backend/api", () => apiMock); beforeEach(() => { setActivePinia(createPinia()); diff --git a/packages/app-tests/schemaDiff.test.ts b/packages/app-tests/schemaDiff.test.ts index 2ee358a9b..ed11bb075 100644 --- a/packages/app-tests/schemaDiff.test.ts +++ b/packages/app-tests/schemaDiff.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { buildDeploySqlForObjects, convertToSchemaDiffObjects, schemaDiffDeployTargetSchema, type TableDiff } from "../../apps/desktop/src/lib/schemaDiff.ts"; +import { buildDeploySqlForObjects, convertToSchemaDiffObjects, schemaDiffDeployTargetSchema, type TableDiff } from "../../apps/desktop/src/lib/schema/schemaDiff.ts"; test("uses generated sync SQL for modified table deployment", () => { const tableDiffs: TableDiff[] = [ diff --git a/packages/app-tests/schemaDiffTableFilter.test.ts b/packages/app-tests/schemaDiffTableFilter.test.ts index 90736c2c6..cdb5540e5 100644 --- a/packages/app-tests/schemaDiffTableFilter.test.ts +++ b/packages/app-tests/schemaDiffTableFilter.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { compileSchemaDiffTableFilter, filterSchemaDiffTables } from "../../apps/desktop/src/lib/schemaDiffTableFilter.ts"; +import { compileSchemaDiffTableFilter, filterSchemaDiffTables } from "../../apps/desktop/src/lib/schema/schemaDiffTableFilter.ts"; import type { TableInfo } from "../../apps/desktop/src/types/database.ts"; import { normalizeSchemaDiffCompareOptions } from "../../apps/desktop/src/types/schemaDiff.ts"; diff --git a/packages/app-tests/schemaTreeCache.test.ts b/packages/app-tests/schemaTreeCache.test.ts index 8ff85a0d5..ca9857228 100644 --- a/packages/app-tests/schemaTreeCache.test.ts +++ b/packages/app-tests/schemaTreeCache.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { SCHEMA_TREE_CACHE_TTL_MS, decodeSchemaTreeCache, encodeSchemaTreeCache } from "../../apps/desktop/src/lib/schemaTreeCache.ts"; +import { SCHEMA_TREE_CACHE_TTL_MS, decodeSchemaTreeCache, encodeSchemaTreeCache } from "../../apps/desktop/src/lib/metadata/schemaTreeCache.ts"; const children = [{ id: "conn:db", label: "db", type: "database" }]; const now = Date.parse("2026-05-17T10:00:00.000Z"); diff --git a/packages/app-tests/settingsStore.test.ts b/packages/app-tests/settingsStore.test.ts index 80e62b43b..d7180518f 100644 --- a/packages/app-tests/settingsStore.test.ts +++ b/packages/app-tests/settingsStore.test.ts @@ -1,10 +1,10 @@ import { test } from "vitest"; import assert from "node:assert/strict"; import { createPinia, setActivePinia } from "pinia"; -import { DEFAULT_SQL_FORMATTER_SETTINGS } from "../../apps/desktop/src/lib/sqlFormatterConfig.ts"; -import { DEFAULT_TABLE_COLUMN_TEMPLATE_FIELDS } from "../../apps/desktop/src/lib/tableColumnTemplates.ts"; -import { DEFAULT_UI_FONT_FAMILY, SYSTEM_UI_FONT_FAMILY } from "../../apps/desktop/src/lib/appFonts.ts"; -import { tableOpenPageLimit } from "../../apps/desktop/src/lib/tableOpenPageLimit.ts"; +import { DEFAULT_SQL_FORMATTER_SETTINGS } from "../../apps/desktop/src/lib/sql/sqlFormatterConfig.ts"; +import { DEFAULT_TABLE_COLUMN_TEMPLATE_FIELDS } from "../../apps/desktop/src/lib/table/tableColumnTemplates.ts"; +import { DEFAULT_UI_FONT_FAMILY, SYSTEM_UI_FONT_FAMILY } from "../../apps/desktop/src/lib/app/appFonts.ts"; +import { tableOpenPageLimit } from "../../apps/desktop/src/lib/table/tableOpenPageLimit.ts"; import { AI_PROVIDER_PRESETS, DEFAULT_EDITOR_SETTINGS, normalizeAiConfig, normalizeEditorSettings, useSettingsStore } from "../../apps/desktop/src/stores/settingsStore.ts"; const OLD_FONT_SIZE_KEY = "dbx-query-editor-font-size"; diff --git a/packages/app-tests/sidebarActiveTabTarget.test.ts b/packages/app-tests/sidebarActiveTabTarget.test.ts index 1762abb30..d72708934 100644 --- a/packages/app-tests/sidebarActiveTabTarget.test.ts +++ b/packages/app-tests/sidebarActiveTabTarget.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { activeTabSidebarTarget, findSidebarNodeForActiveTab, scrollTopForSidebarNode, shouldScrollActiveSidebarSelection } from "../../apps/desktop/src/lib/sidebarActiveTabTarget.ts"; +import { activeTabSidebarTarget, findSidebarNodeForActiveTab, scrollTopForSidebarNode, shouldScrollActiveSidebarSelection } from "../../apps/desktop/src/lib/sidebar/sidebarActiveTabTarget.ts"; import type { FlatTreeNode } from "../../apps/desktop/src/composables/useFlatTree.ts"; import type { QueryTab, TreeNode } from "../../apps/desktop/src/types/database.ts"; diff --git a/packages/app-tests/sidebarConnectionSelection.test.ts b/packages/app-tests/sidebarConnectionSelection.test.ts index 200ce2276..82bdf1d2d 100644 --- a/packages/app-tests/sidebarConnectionSelection.test.ts +++ b/packages/app-tests/sidebarConnectionSelection.test.ts @@ -1,6 +1,6 @@ import { test } from "vitest"; import assert from "node:assert/strict"; -import { connectionPasteTargetGroupId, selectedConnectionClipboardNodes, selectedConnectionClipboardTargets, selectedConnectionEditTarget } from "../../apps/desktop/src/lib/sidebarConnectionSelection.ts"; +import { connectionPasteTargetGroupId, selectedConnectionClipboardNodes, selectedConnectionClipboardTargets, selectedConnectionEditTarget } from "../../apps/desktop/src/lib/sidebar/sidebarConnectionSelection.ts"; import type { TreeNode } from "../../apps/desktop/src/types/database.ts"; function connectionNode(id: string): TreeNode { diff --git a/packages/app-tests/sidebarDatabaseOpenState.test.ts b/packages/app-tests/sidebarDatabaseOpenState.test.ts index eeb4ecacc..0da6e0c2c 100644 --- a/packages/app-tests/sidebarDatabaseOpenState.test.ts +++ b/packages/app-tests/sidebarDatabaseOpenState.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { canCloseSidebarDatabaseConnection, isSidebarDatabaseOpened } from "../../apps/desktop/src/lib/sidebarDatabaseOpenState.ts"; +import { canCloseSidebarDatabaseConnection, isSidebarDatabaseOpened } from "../../apps/desktop/src/lib/sidebar/sidebarDatabaseOpenState.ts"; import type { TreeNode } from "../../apps/desktop/src/types/database.ts"; function databaseNode(id: string): TreeNode { diff --git a/packages/app-tests/sidebarLayout.test.ts b/packages/app-tests/sidebarLayout.test.ts index da8c630b8..313ab0554 100644 --- a/packages/app-tests/sidebarLayout.test.ts +++ b/packages/app-tests/sidebarLayout.test.ts @@ -14,7 +14,7 @@ import { emptyLayout, remapSidebarLayoutConnectionIds, collapseAllGroups, -} from "../../apps/desktop/src/lib/sidebarLayout.ts"; +} from "../../apps/desktop/src/lib/sidebar/sidebarLayout.ts"; import type { ConnectionConfig, SidebarLayout } from "../../apps/desktop/src/types/database.ts"; function conn(id: string, name?: string): ConnectionConfig { diff --git a/packages/app-tests/sidebarLayoutNested.test.ts b/packages/app-tests/sidebarLayoutNested.test.ts index 5647e6725..69363cca8 100644 --- a/packages/app-tests/sidebarLayoutNested.test.ts +++ b/packages/app-tests/sidebarLayoutNested.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { buildTreeNodesFromLayout, deleteGroup, moveConnectionToGroup, reconcileLayout, reorderEntry } from "../../apps/desktop/src/lib/sidebarLayout.ts"; +import { buildTreeNodesFromLayout, deleteGroup, moveConnectionToGroup, reconcileLayout, reorderEntry } from "../../apps/desktop/src/lib/sidebar/sidebarLayout.ts"; import type { ConnectionConfig, SidebarLayout } from "../../apps/desktop/src/types/database.ts"; function conn(id: string): ConnectionConfig { diff --git a/packages/app-tests/sidebarNodeOrdering.test.ts b/packages/app-tests/sidebarNodeOrdering.test.ts index 025c55b65..d9fae9dc5 100644 --- a/packages/app-tests/sidebarNodeOrdering.test.ts +++ b/packages/app-tests/sidebarNodeOrdering.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { sortSidebarTreeChildrenForParent } from "../../apps/desktop/src/lib/sidebarNodeOrdering.ts"; +import { sortSidebarTreeChildrenForParent } from "../../apps/desktop/src/lib/sidebar/sidebarNodeOrdering.ts"; import type { TreeNode } from "../../apps/desktop/src/types/database.ts"; test("reorders cached MongoDB collections alphabetically", () => { diff --git a/packages/app-tests/sidebarRenameFocus.test.ts b/packages/app-tests/sidebarRenameFocus.test.ts index 655eb3199..b401a05cc 100644 --- a/packages/app-tests/sidebarRenameFocus.test.ts +++ b/packages/app-tests/sidebarRenameFocus.test.ts @@ -1,6 +1,6 @@ import { test } from "vitest"; import assert from "node:assert/strict"; -import { focusSidebarRenameInput, shouldPreventRenameCloseAutoFocus } from "../../apps/desktop/src/lib/sidebarRenameFocus.ts"; +import { focusSidebarRenameInput, shouldPreventRenameCloseAutoFocus } from "../../apps/desktop/src/lib/sidebar/sidebarRenameFocus.ts"; test("focusSidebarRenameInput waits for menu focus restoration before focusing", () => { const calls: string[] = []; diff --git a/packages/app-tests/sidebarSearch.test.ts b/packages/app-tests/sidebarSearch.test.ts index d4114c1ec..baa1de38a 100644 --- a/packages/app-tests/sidebarSearch.test.ts +++ b/packages/app-tests/sidebarSearch.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { matchSidebarLabel } from "../../apps/desktop/src/lib/sidebarSearch.ts"; +import { matchSidebarLabel } from "../../apps/desktop/src/lib/sidebar/sidebarSearch.ts"; test("matches exact and prefix labels first", () => { assert.equal(matchSidebarLabel("orders", "orders")?.kind, "exact"); diff --git a/packages/app-tests/sidebarSearchTree.test.ts b/packages/app-tests/sidebarSearchTree.test.ts index 68616ead9..30ec2ad37 100644 --- a/packages/app-tests/sidebarSearchTree.test.ts +++ b/packages/app-tests/sidebarSearchTree.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { filterSidebarSearchRootsByConnectionState, filterSidebarTree } from "../../apps/desktop/src/lib/sidebarSearchTree.ts"; +import { filterSidebarSearchRootsByConnectionState, filterSidebarTree } from "../../apps/desktop/src/lib/sidebar/sidebarSearchTree.ts"; import type { TreeNode } from "../../apps/desktop/src/types/database.ts"; test("preserves loaded table children when the table itself matches search", () => { diff --git a/packages/app-tests/sidebarTreeCollapse.test.ts b/packages/app-tests/sidebarTreeCollapse.test.ts index 09b077645..72c644e46 100644 --- a/packages/app-tests/sidebarTreeCollapse.test.ts +++ b/packages/app-tests/sidebarTreeCollapse.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { collapseExpandedTreeNodes } from "../../apps/desktop/src/lib/sidebarTreeCollapse.ts"; +import { collapseExpandedTreeNodes } from "../../apps/desktop/src/lib/sidebar/sidebarTreeCollapse.ts"; import type { TreeNode } from "../../apps/desktop/src/types/database.ts"; test("collapseExpandedTreeNodes collapses all expanded descendants", () => { diff --git a/packages/app-tests/sidebarTreeItemLayout.test.ts b/packages/app-tests/sidebarTreeItemLayout.test.ts index 073e78394..d2d9062ea 100644 --- a/packages/app-tests/sidebarTreeItemLayout.test.ts +++ b/packages/app-tests/sidebarTreeItemLayout.test.ts @@ -1,6 +1,6 @@ import { test } from "vitest"; import assert from "node:assert/strict"; -import { canTreeNodePin, canTreeNodeShowExpander } from "../../apps/desktop/src/lib/sidebarTreeItemLayout.ts"; +import { canTreeNodePin, canTreeNodeShowExpander } from "../../apps/desktop/src/lib/sidebar/sidebarTreeItemLayout.ts"; test("mongodb collection rows can show an expander for metadata groups", () => { assert.equal(canTreeNodeShowExpander({ type: "mongo-collection", childCount: 0 }), true); diff --git a/packages/app-tests/sidebarTreeSelection.test.ts b/packages/app-tests/sidebarTreeSelection.test.ts index 2e4b57840..84cdf4967 100644 --- a/packages/app-tests/sidebarTreeSelection.test.ts +++ b/packages/app-tests/sidebarTreeSelection.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { selectedTreeNodesInVisibleOrder, treeSelectionRangeIdsByIndex, treeSelectionRangeIds } from "../../apps/desktop/src/lib/sidebarTreeSelection.ts"; +import { selectedTreeNodesInVisibleOrder, treeSelectionRangeIdsByIndex, treeSelectionRangeIds } from "../../apps/desktop/src/lib/sidebar/sidebarTreeSelection.ts"; import type { TreeNode } from "../../apps/desktop/src/types/database.ts"; const nodes: TreeNode[] = [ diff --git a/packages/app-tests/sidebarTypeSearch.test.ts b/packages/app-tests/sidebarTypeSearch.test.ts index 152d5c4db..f472c7b0c 100644 --- a/packages/app-tests/sidebarTypeSearch.test.ts +++ b/packages/app-tests/sidebarTypeSearch.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { sidebarTypeSearchNextQuery } from "../../apps/desktop/src/lib/sidebarTypeSearch.ts"; +import { sidebarTypeSearchNextQuery } from "../../apps/desktop/src/lib/sidebar/sidebarTypeSearch.ts"; test("starts sidebar search from printable keys", () => { assert.equal(sidebarTypeSearchNextQuery("", { key: "e" }), "e"); diff --git a/packages/app-tests/sqlAnalysis.test.ts b/packages/app-tests/sqlAnalysis.test.ts index 471675a5c..83878e5da 100644 --- a/packages/app-tests/sqlAnalysis.test.ts +++ b/packages/app-tests/sqlAnalysis.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { allEditableColumnsWriteable, allPrimaryKeysPresent, analyzeEditableQuery, analyzeEditableQueryEditability, isBinaryType, queryEditabilityMessageKey, sourceColumnsForResult } from "../../apps/desktop/src/lib/sqlAnalysis.ts"; +import { allEditableColumnsWriteable, allPrimaryKeysPresent, analyzeEditableQuery, analyzeEditableQueryEditability, isBinaryType, queryEditabilityMessageKey, sourceColumnsForResult } from "../../apps/desktop/src/lib/sql/sqlAnalysis.ts"; test("recognizes a simple single-table SELECT as editable", () => { const result = analyzeEditableQueryEditability("select id, name from public.users where active = true order by id"); diff --git a/packages/app-tests/sqlCompletion.test.ts b/packages/app-tests/sqlCompletion.test.ts index 600fddf6a..5a7c2d299 100644 --- a/packages/app-tests/sqlCompletion.test.ts +++ b/packages/app-tests/sqlCompletion.test.ts @@ -14,7 +14,7 @@ import { type SqlCompletionForeignKey, type SqlCompletionObject, type SqlCompletionTable, -} from "../../apps/desktop/src/lib/sqlCompletion.ts"; +} from "../../apps/desktop/src/lib/sql/sqlCompletion.ts"; const tables: SqlCompletionTable[] = [ { name: "users", schema: "public", type: "table" }, diff --git a/packages/app-tests/sqlCompletionPerformance.test.ts b/packages/app-tests/sqlCompletionPerformance.test.ts index 06686397c..4fe0aedb2 100644 --- a/packages/app-tests/sqlCompletionPerformance.test.ts +++ b/packages/app-tests/sqlCompletionPerformance.test.ts @@ -1,9 +1,9 @@ import assert from "node:assert/strict"; import { test } from "vitest"; import { createPinia, setActivePinia } from "pinia"; -import { buildSqlCompletionItems, buildSqlCompletionItemsFromContext, getSqlCompletionContext, recordCompletionSelection } from "../../apps/desktop/src/lib/sqlCompletion.ts"; -import { sqlCompletionContextFromSemantic } from "../../apps/desktop/src/lib/sqlSemanticCompletion.ts"; -import { buildSqlSemanticModel } from "../../apps/desktop/src/lib/sqlSemanticModel.ts"; +import { buildSqlCompletionItems, buildSqlCompletionItemsFromContext, getSqlCompletionContext, recordCompletionSelection } from "../../apps/desktop/src/lib/sql/sqlCompletion.ts"; +import { sqlCompletionContextFromSemantic } from "../../apps/desktop/src/lib/sql/semantic/completion.ts"; +import { buildSqlSemanticModel } from "../../apps/desktop/src/lib/sql/semantic/model.ts"; import { useConnectionStore } from "../../apps/desktop/src/stores/connectionStore.ts"; import type { ConnectionConfig, TableInfo } from "../../apps/desktop/src/types/database.ts"; diff --git a/packages/app-tests/sqlExecutionTarget.test.ts b/packages/app-tests/sqlExecutionTarget.test.ts index 61d723e0b..af9dc8a2a 100644 --- a/packages/app-tests/sqlExecutionTarget.test.ts +++ b/packages/app-tests/sqlExecutionTarget.test.ts @@ -5,9 +5,9 @@ const apiMock = vi.hoisted(() => ({ findStatementAtCursor: vi.fn(), })); -vi.mock("@/lib/api", () => apiMock); +vi.mock("@/lib/backend/api", () => apiMock); -const { resolveExecutableSqlWithBackend } = await import("../../apps/desktop/src/lib/sqlExecutionTarget.ts"); +const { resolveExecutableSqlWithBackend } = await import("../../apps/desktop/src/lib/sql/sqlExecutionTarget.ts"); beforeEach(() => { apiMock.findStatementAtCursor.mockReset(); diff --git a/packages/app-tests/sqlFormatter.test.ts b/packages/app-tests/sqlFormatter.test.ts index a8dca7853..7ce915a58 100644 --- a/packages/app-tests/sqlFormatter.test.ts +++ b/packages/app-tests/sqlFormatter.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { afterEach, test, vi } from "vitest"; -import { formatSqlText, MAX_SQL_FORMAT_CHARS } from "../../apps/desktop/src/lib/sqlFormatter.ts"; +import { formatSqlText, MAX_SQL_FORMAT_CHARS } from "../../apps/desktop/src/lib/sql/sqlFormatter.ts"; afterEach(() => { vi.doUnmock("sql-formatter"); @@ -12,7 +12,7 @@ test("rejects very large SQL before importing formatter", async () => { throw new Error("formatter should not load"); }); - const { formatSqlText: isolatedFormatSqlText, MAX_SQL_FORMAT_CHARS: isolatedMaxSqlFormatChars } = await import("../../apps/desktop/src/lib/sqlFormatter.ts"); + const { formatSqlText: isolatedFormatSqlText, MAX_SQL_FORMAT_CHARS: isolatedMaxSqlFormatChars } = await import("../../apps/desktop/src/lib/sql/sqlFormatter.ts"); await assert.rejects(() => isolatedFormatSqlText("x".repeat(isolatedMaxSqlFormatChars + 1), "generic"), /too large/i); }); diff --git a/packages/app-tests/sqlFormatterConfig.test.ts b/packages/app-tests/sqlFormatterConfig.test.ts index 10f968b6f..cbfd29853 100644 --- a/packages/app-tests/sqlFormatterConfig.test.ts +++ b/packages/app-tests/sqlFormatterConfig.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { DEFAULT_SQL_FORMATTER_SETTINGS, normalizeSqlFormatterSettings, parseSqlFormatterConfig, serializeSqlFormatterConfig, sqlFormatterOptions, syncSqlFormatterConfigDraft } from "../../apps/desktop/src/lib/sqlFormatterConfig.ts"; +import { DEFAULT_SQL_FORMATTER_SETTINGS, normalizeSqlFormatterSettings, parseSqlFormatterConfig, serializeSqlFormatterConfig, sqlFormatterOptions, syncSqlFormatterConfigDraft } from "../../apps/desktop/src/lib/sql/sqlFormatterConfig.ts"; const defaultOptionSettings = DEFAULT_SQL_FORMATTER_SETTINGS; diff --git a/packages/app-tests/sqlMetadataRefresh.test.ts b/packages/app-tests/sqlMetadataRefresh.test.ts index d8ee41a54..72275d2ee 100644 --- a/packages/app-tests/sqlMetadataRefresh.test.ts +++ b/packages/app-tests/sqlMetadataRefresh.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { sqlMetadataRefreshScope, sqlMetadataRefreshTarget } from "../../apps/desktop/src/lib/sqlMetadataRefresh.ts"; +import { sqlMetadataRefreshScope, sqlMetadataRefreshTarget } from "../../apps/desktop/src/lib/sql/sqlMetadataRefresh.ts"; test("database DDL refreshes the connection database list", () => { assert.equal(sqlMetadataRefreshScope("CREATE DATABASE app;"), "connection"); diff --git a/packages/app-tests/sqlQuoteCaret.test.ts b/packages/app-tests/sqlQuoteCaret.test.ts index ccc125d09..6383b6b41 100644 --- a/packages/app-tests/sqlQuoteCaret.test.ts +++ b/packages/app-tests/sqlQuoteCaret.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { caretPositionInsideInsertedSqlSingleQuotes, insertedSqlSingleQuoteAtCaret } from "../../apps/desktop/src/lib/sqlQuoteCaret.ts"; +import { caretPositionInsideInsertedSqlSingleQuotes, insertedSqlSingleQuoteAtCaret } from "../../apps/desktop/src/lib/sql/sqlQuoteCaret.ts"; test("detects a newly typed SQL single quote", () => { assert.equal( diff --git a/packages/app-tests/sqlSemanticDiagnostics.test.ts b/packages/app-tests/sqlSemanticDiagnostics.test.ts index c03556889..e032ef09c 100644 --- a/packages/app-tests/sqlSemanticDiagnostics.test.ts +++ b/packages/app-tests/sqlSemanticDiagnostics.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { buildSqlParserErrorDiagnostic, buildSqlSemanticDiagnostics, areSqlSemanticDiagnosticsEqual, isSqlSemanticDiagnosticInputContext, shouldRunSqlSemanticDiagnostics, sqlSemanticDiagnosticRangesForViewport } from "../../apps/desktop/src/lib/sqlSemanticDiagnostics.ts"; +import { buildSqlParserErrorDiagnostic, buildSqlSemanticDiagnostics, areSqlSemanticDiagnosticsEqual, isSqlSemanticDiagnosticInputContext, shouldRunSqlSemanticDiagnostics, sqlSemanticDiagnosticRangesForViewport } from "../../apps/desktop/src/lib/sql/semantic/diagnostics.ts"; import type { SqlReferenceAnalysis } from "../../apps/desktop/src/types/database.ts"; const span = (startColumn: number, endColumn: number) => ({ diff --git a/packages/app-tests/sqlServerTree.test.ts b/packages/app-tests/sqlServerTree.test.ts index 60747f458..4e1796d3f 100644 --- a/packages/app-tests/sqlServerTree.test.ts +++ b/packages/app-tests/sqlServerTree.test.ts @@ -1,6 +1,6 @@ import { test } from "vitest"; import assert from "node:assert/strict"; -import { buildSqlServerDatabaseTreeNodes } from "../../apps/desktop/src/lib/sqlServerTree.ts"; +import { buildSqlServerDatabaseTreeNodes } from "../../apps/desktop/src/lib/database/sqlServerTree.ts"; test("SQL Server database tree shows schemas before objects", () => { const nodes = buildSqlServerDatabaseTreeNodes("conn", "app", ["dbo", "zeta", "sales"]); diff --git a/packages/app-tests/sqlserverSemanticDiagnostics.test.ts b/packages/app-tests/sqlserverSemanticDiagnostics.test.ts index 25d8d6d67..e14c0f8e5 100644 --- a/packages/app-tests/sqlserverSemanticDiagnostics.test.ts +++ b/packages/app-tests/sqlserverSemanticDiagnostics.test.ts @@ -2,7 +2,7 @@ import { test } from "vitest"; import assert from "node:assert/strict"; import { createPinia, setActivePinia } from "pinia"; import { useConnectionStore } from "../../apps/desktop/src/stores/connectionStore.ts"; -import { buildSqlSemanticDiagnostics } from "../../apps/desktop/src/lib/sqlSemanticDiagnostics.ts"; +import { buildSqlSemanticDiagnostics } from "../../apps/desktop/src/lib/sql/semantic/diagnostics.ts"; import type { ConnectionConfig, SqlReferenceAnalysis } from "../../apps/desktop/src/types/database.ts"; const span = (startColumn: number, endColumn: number) => ({ diff --git a/packages/app-tests/tabCloseActions.test.ts b/packages/app-tests/tabCloseActions.test.ts index 5b41f7926..76ed0954e 100644 --- a/packages/app-tests/tabCloseActions.test.ts +++ b/packages/app-tests/tabCloseActions.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { closeAllTabsState, closeOtherTabsState } from "../../apps/desktop/src/lib/tabCloseActions.ts"; +import { closeAllTabsState, closeOtherTabsState } from "../../apps/desktop/src/lib/tabs/tabCloseActions.ts"; test("close other tabs keeps the target tab and makes it active", () => { const tabs = [{ id: "a" }, { id: "b" }, { id: "c" }]; diff --git a/packages/app-tests/tabPresentation.test.ts b/packages/app-tests/tabPresentation.test.ts index 77570c197..8fa8ffbc3 100644 --- a/packages/app-tests/tabPresentation.test.ts +++ b/packages/app-tests/tabPresentation.test.ts @@ -11,7 +11,7 @@ import { tabDisplayTitle, tabModeLabel, tabularResultItems, -} from "../../apps/desktop/src/lib/tabPresentation.ts"; +} from "../../apps/desktop/src/lib/tabs/tabPresentation.ts"; import { useConnectionStore } from "../../apps/desktop/src/stores/connectionStore.ts"; import type { ConnectionConfig, QueryResult, QueryTab } from "../../apps/desktop/src/types/database.ts"; diff --git a/packages/app-tests/tabResultCache.test.ts b/packages/app-tests/tabResultCache.test.ts index 3455f2b55..db1accb25 100644 --- a/packages/app-tests/tabResultCache.test.ts +++ b/packages/app-tests/tabResultCache.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { buildTabResultSnapshot, decodeTabResultSnapshot, encodeTabResultSnapshot } from "../../apps/desktop/src/lib/tabResultCache.ts"; +import { buildTabResultSnapshot, decodeTabResultSnapshot, encodeTabResultSnapshot } from "../../apps/desktop/src/lib/tabs/tabResultCache.ts"; import type { QueryTab } from "../../apps/desktop/src/types/database.ts"; function queryTab(overrides: Partial = {}): QueryTab { diff --git a/packages/app-tests/tableClipboard.test.ts b/packages/app-tests/tableClipboard.test.ts index 73a052684..742a82f1e 100644 --- a/packages/app-tests/tableClipboard.test.ts +++ b/packages/app-tests/tableClipboard.test.ts @@ -1,7 +1,7 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; import type { ColumnInfo } from "../../apps/desktop/src/types/database.ts"; -import { defaultPasteTableMode, pasteTableModeCopiesData, supportsWholeRowTableDataCopy, tableClipboardMatchesTarget, tableDataCopyColumnOptions } from "../../apps/desktop/src/lib/tableClipboard.ts"; +import { defaultPasteTableMode, pasteTableModeCopiesData, supportsWholeRowTableDataCopy, tableClipboardMatchesTarget, tableDataCopyColumnOptions } from "../../apps/desktop/src/lib/table/tableClipboard.ts"; test("table clipboard entries must match the paste target context", () => { const target = { connectionId: "c1", database: "app", schema: "public" }; diff --git a/packages/app-tests/tableColumnTemplates.test.ts b/packages/app-tests/tableColumnTemplates.test.ts index 8ef4da836..22b514a95 100644 --- a/packages/app-tests/tableColumnTemplates.test.ts +++ b/packages/app-tests/tableColumnTemplates.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { createTableColumnTemplateDrafts, DEFAULT_TABLE_COLUMN_TEMPLATE_FIELDS, normalizeTableColumnTemplateFields, parseTableColumnTemplateFields, PRESET_FIELDS_TEMPLATE_ID, tableColumnTemplates, TABLE_COLUMN_TEMPLATE_DATABASE_TYPES } from "../../apps/desktop/src/lib/tableColumnTemplates.ts"; +import { createTableColumnTemplateDrafts, DEFAULT_TABLE_COLUMN_TEMPLATE_FIELDS, normalizeTableColumnTemplateFields, parseTableColumnTemplateFields, PRESET_FIELDS_TEMPLATE_ID, tableColumnTemplates, TABLE_COLUMN_TEMPLATE_DATABASE_TYPES } from "../../apps/desktop/src/lib/table/tableColumnTemplates.ts"; const sixCustomFields = [ "tenant_id | mysql:bigint | postgres:uuid | default:0 | comment:Tenant", diff --git a/packages/app-tests/tableDataExport.test.ts b/packages/app-tests/tableDataExport.test.ts index 99e06f8cb..1e7569bb9 100644 --- a/packages/app-tests/tableDataExport.test.ts +++ b/packages/app-tests/tableDataExport.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { fetchTableDataForExport, TABLE_DATA_EXPORT_PAGE_SIZE } from "../../apps/desktop/src/lib/tableDataExport.ts"; +import { fetchTableDataForExport, TABLE_DATA_EXPORT_PAGE_SIZE } from "../../apps/desktop/src/lib/table/tableDataExport.ts"; import type { QueryResult } from "../../apps/desktop/src/types/database.ts"; function result(rows: QueryResult["rows"]): QueryResult { diff --git a/packages/app-tests/tableDataTabMeta.test.ts b/packages/app-tests/tableDataTabMeta.test.ts index 503e79d47..eaa1f38c7 100644 --- a/packages/app-tests/tableDataTabMeta.test.ts +++ b/packages/app-tests/tableDataTabMeta.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { tableMetaForDataTab } from "../../apps/desktop/src/lib/tableDataTabMeta.ts"; +import { tableMetaForDataTab } from "../../apps/desktop/src/lib/table/tableDataTabMeta.ts"; import type { QueryTab } from "../../apps/desktop/src/types/database.ts"; function tab(overrides: Partial = {}): QueryTab { diff --git a/packages/app-tests/tableEditing.test.ts b/packages/app-tests/tableEditing.test.ts index 79e190204..ccf74c90f 100644 --- a/packages/app-tests/tableEditing.test.ts +++ b/packages/app-tests/tableEditing.test.ts @@ -13,7 +13,7 @@ import { isTableDataEditable, supportsDataGridTransaction, usesSyntheticRowIdKey, -} from "../../apps/desktop/src/lib/tableEditing.ts"; +} from "../../apps/desktop/src/lib/table/tableEditing.ts"; import type { ColumnInfo } from "../../apps/desktop/src/types/database.ts"; function column(name: string, isPrimaryKey = false): ColumnInfo { diff --git a/packages/app-tests/tableImport.test.ts b/packages/app-tests/tableImport.test.ts index 917f541e7..4952d482e 100644 --- a/packages/app-tests/tableImport.test.ts +++ b/packages/app-tests/tableImport.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { autoMapImportColumns, normalizeImportColumnName } from "../../apps/desktop/src/lib/tableImport.ts"; +import { autoMapImportColumns, normalizeImportColumnName } from "../../apps/desktop/src/lib/table/tableImport.ts"; test("normalizes import column names for matching", () => { assert.equal(normalizeImportColumnName(" User ID "), "user id"); diff --git a/packages/app-tests/tableSqlTemplates.test.ts b/packages/app-tests/tableSqlTemplates.test.ts index 1073878a2..c7fac225d 100644 --- a/packages/app-tests/tableSqlTemplates.test.ts +++ b/packages/app-tests/tableSqlTemplates.test.ts @@ -1,7 +1,7 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; import type { ColumnInfo } from "../../apps/desktop/src/types/database.ts"; -import { buildTableDeleteTemplate, buildTableInsertTemplate, buildTableSelectTemplate, buildTableUpdateTemplate } from "../../apps/desktop/src/lib/tableSqlTemplates.ts"; +import { buildTableDeleteTemplate, buildTableInsertTemplate, buildTableSelectTemplate, buildTableUpdateTemplate } from "../../apps/desktop/src/lib/table/tableSqlTemplates.ts"; function col(overrides: Partial & { name: string; data_type: string }): ColumnInfo { return { diff --git a/packages/app-tests/tableStructureEditorState.test.ts b/packages/app-tests/tableStructureEditorState.test.ts index 4aca95037..ed5343ade 100644 --- a/packages/app-tests/tableStructureEditorState.test.ts +++ b/packages/app-tests/tableStructureEditorState.test.ts @@ -17,7 +17,7 @@ import { parseExtraToColumnExtra, rehydrateColumnDraftsFromMetadata, toColumnNames, -} from "../../apps/desktop/src/lib/tableStructureEditorState.ts"; +} from "../../apps/desktop/src/lib/table/tableStructureEditorState.ts"; import type { ColumnInfo, IndexInfo } from "../../apps/desktop/src/types/database.ts"; const columns: ColumnInfo[] = [ diff --git a/packages/app-tests/tableTree.test.ts b/packages/app-tests/tableTree.test.ts index 67dffcf80..09853af4c 100644 --- a/packages/app-tests/tableTree.test.ts +++ b/packages/app-tests/tableTree.test.ts @@ -1,6 +1,6 @@ import { test } from "vitest"; import assert from "node:assert/strict"; -import { buildGroupedObjectTreeNodes, buildObjectGroupPlaceholderNodes, buildSimpleObjectTreeNodes, buildTableTreeNodes, filterSimpleSidebarSupplementalObjects, mergeTableInfosIntoObjects, mergeTableTreePageChildren } from "../../apps/desktop/src/lib/tableTree.ts"; +import { buildGroupedObjectTreeNodes, buildObjectGroupPlaceholderNodes, buildSimpleObjectTreeNodes, buildTableTreeNodes, filterSimpleSidebarSupplementalObjects, mergeTableInfosIntoObjects, mergeTableTreePageChildren } from "../../apps/desktop/src/lib/table/tableTree.ts"; import type { ObjectInfo, TableInfo, TreeNode } from "../../apps/desktop/src/types/database.ts"; function table(name: string, parent?: string): TableInfo { diff --git a/packages/app-tests/transferProgressState.test.ts b/packages/app-tests/transferProgressState.test.ts index 0b1620fa5..98017b257 100644 --- a/packages/app-tests/transferProgressState.test.ts +++ b/packages/app-tests/transferProgressState.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { isTransferRunActive, nextTransferTerminalState, shouldKeepTransferDraftOnOpen, shouldResetTransferDialogOnOpen } from "../../apps/desktop/src/lib/transferProgressState.ts"; +import { isTransferRunActive, nextTransferTerminalState, shouldKeepTransferDraftOnOpen, shouldResetTransferDialogOnOpen } from "../../apps/desktop/src/lib/app/transferProgressState.ts"; test("marks transfer as failed when a table progress event reports error", () => { const state = nextTransferTerminalState({ done: false, cancelled: false, error: false }, { status: "error" }); diff --git a/packages/app-tests/treeNodeClick.test.ts b/packages/app-tests/treeNodeClick.test.ts index f9d733c52..9da35c9fc 100644 --- a/packages/app-tests/treeNodeClick.test.ts +++ b/packages/app-tests/treeNodeClick.test.ts @@ -1,6 +1,6 @@ import { test } from "vitest"; import assert from "node:assert/strict"; -import { copyNameForTreeNode, isDocumentBrowserTreeNode, objectSourceKindForTreeNode, shouldRunTreeNodeRowAction, sidebarSelectionCopyAction, treeNodeRowAction, treeNodeRowDoubleClickAction } from "../../apps/desktop/src/lib/treeNodeClick.ts"; +import { copyNameForTreeNode, isDocumentBrowserTreeNode, objectSourceKindForTreeNode, shouldRunTreeNodeRowAction, sidebarSelectionCopyAction, treeNodeRowAction, treeNodeRowDoubleClickAction } from "../../apps/desktop/src/lib/sidebar/treeNodeClick.ts"; test("table and view rows open data without toggling structure groups", () => { assert.equal(treeNodeRowAction("table", true), "open-data"); diff --git a/packages/app-tests/treeNodeContext.test.ts b/packages/app-tests/treeNodeContext.test.ts index 974b5d008..e3810bb75 100644 --- a/packages/app-tests/treeNodeContext.test.ts +++ b/packages/app-tests/treeNodeContext.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { hasTreeNodeDatabaseContext, normalizeCataloglessDatabaseNodes, treeNodeSchemaCachePrefix } from "../../apps/desktop/src/lib/treeNodeContext.ts"; +import { hasTreeNodeDatabaseContext, normalizeCataloglessDatabaseNodes, treeNodeSchemaCachePrefix } from "../../apps/desktop/src/lib/sidebar/treeNodeContext.ts"; import type { TreeNode } from "../../apps/desktop/src/types/database.ts"; test("treats empty database string as a valid catalogless context", () => { diff --git a/packages/app-tests/treeRefreshTarget.test.ts b/packages/app-tests/treeRefreshTarget.test.ts index 8b6ea0f2a..84fe38b68 100644 --- a/packages/app-tests/treeRefreshTarget.test.ts +++ b/packages/app-tests/treeRefreshTarget.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { test } from "vitest"; -import { findDatabaseTreeNode } from "../../apps/desktop/src/lib/treeRefreshTarget.ts"; +import { findDatabaseTreeNode } from "../../apps/desktop/src/lib/sidebar/treeRefreshTarget.ts"; import type { TreeNode } from "../../apps/desktop/src/types/database.ts"; test("finds database refresh targets inside grouped sidebar trees", () => { diff --git a/packages/app-tests/useDataGridExport.test.ts b/packages/app-tests/useDataGridExport.test.ts index ecc531fd2..b01647284 100644 --- a/packages/app-tests/useDataGridExport.test.ts +++ b/packages/app-tests/useDataGridExport.test.ts @@ -20,9 +20,9 @@ const clipboardMock = vi.hoisted(() => ({ copyToClipboard: vi.fn(), })); -vi.mock("@/lib/api", () => apiMock); -vi.mock("@/lib/clipboard", () => clipboardMock); -vi.mock("@/lib/tauriRuntime", () => ({ isTauriRuntime: () => false })); +vi.mock("@/lib/backend/api", () => apiMock); +vi.mock("@/lib/common/clipboard", () => clipboardMock); +vi.mock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: () => false })); vi.mock("@/composables/useToast", () => ({ useToast: () => ({ toast: vi.fn() }) })); vi.mock("vue-i18n", () => ({ useI18n: () => ({ t: (key: string) => key }) })); diff --git a/packages/app-tests/useExportTracker.test.ts b/packages/app-tests/useExportTracker.test.ts index c8c9c9278..42d7a1374 100644 --- a/packages/app-tests/useExportTracker.test.ts +++ b/packages/app-tests/useExportTracker.test.ts @@ -9,7 +9,7 @@ const apiMock = vi.hoisted(() => ({ startTransfer: vi.fn(), })); -vi.mock("@/lib/api", () => apiMock); +vi.mock("@/lib/backend/api", () => apiMock); const { useExportTracker } = await import("../../apps/desktop/src/composables/useExportTracker.ts"); diff --git a/packages/app-tests/webdavAutoUpload.test.ts b/packages/app-tests/webdavAutoUpload.test.ts index 440b7d4ce..a55a25c1e 100644 --- a/packages/app-tests/webdavAutoUpload.test.ts +++ b/packages/app-tests/webdavAutoUpload.test.ts @@ -2,7 +2,7 @@ import assert from "node:assert/strict"; import { afterEach, beforeEach, test, vi } from "vitest"; import { createPinia, setActivePinia } from "pinia"; import { useWebDavAutoUpload } from "@/composables/useWebDavAutoUpload"; -import { readWebDavAutoUploadConfig } from "@/lib/webdavAutoUploadConfig"; +import { readWebDavAutoUploadConfig } from "@/lib/webdav/webdavAutoUploadConfig"; const { webdavSyncUploadMock } = vi.hoisted(() => ({ webdavSyncUploadMock: vi.fn(), @@ -17,7 +17,7 @@ vi.mock("vue", async (importOriginal) => { }; }); -vi.mock("@/lib/api", () => ({ +vi.mock("@/lib/backend/api", () => ({ webdavSyncUpload: webdavSyncUploadMock, })); diff --git a/packages/app-tests/xlsxExport.test.ts b/packages/app-tests/xlsxExport.test.ts index 2621505dc..20c6b5f49 100644 --- a/packages/app-tests/xlsxExport.test.ts +++ b/packages/app-tests/xlsxExport.test.ts @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { test } from "vitest"; -import { buildXlsxWorkbook } from "../../apps/desktop/src/lib/xlsxExport.ts"; +import { buildXlsxWorkbook } from "../../apps/desktop/src/lib/export/xlsxExport.ts"; test("builds an xlsx workbook zip with worksheet data", () => { const workbook = buildXlsxWorkbook({