From 7dff4585637fefe07b11ad69d3d38487eb27570d Mon Sep 17 00:00:00 2001 From: Arvin Xu Date: Mon, 2 Dec 2024 19:39:36 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20deprecated=20t?= =?UTF-8?q?he=20current=20client=20mode=20code=20(#4866)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/__tests__/db-upgrade.test.ts | 0 .../{client => _deprecated}/core/__tests__/db.test.ts | 0 .../{client => _deprecated}/core/__tests__/model.test.ts | 0 src/database/{client => _deprecated}/core/db.ts | 0 src/database/{client => _deprecated}/core/index.ts | 0 .../migrations/migrateSettingsToUser/fixtures/input.json | 0 .../migrations/migrateSettingsToUser/fixtures/output.json | 0 .../core/migrations/migrateSettingsToUser/index.test.ts | 0 .../core/migrations/migrateSettingsToUser/index.ts | 0 .../core/migrations/migrateSettingsToUser/type.ts | 0 src/database/{client => _deprecated}/core/model.ts | 0 src/database/{client => _deprecated}/core/schemas.ts | 0 src/database/{client => _deprecated}/core/sync.ts | 0 src/database/{client => _deprecated}/core/types/db.ts | 0 src/database/{client => _deprecated}/models/__DEBUG.ts | 6 +++--- .../{client => _deprecated}/models/__tests__/file.test.ts | 0 .../models/__tests__/message.test.ts | 0 .../models/__tests__/plugin.test.ts | 0 .../models/__tests__/session.test.ts | 6 +++--- .../models/__tests__/sessionGroup.test.ts | 2 +- .../models/__tests__/topic.test.ts | 8 ++++---- .../{client => _deprecated}/models/__tests__/user.test.ts | 0 src/database/{client => _deprecated}/models/file.ts | 4 ++-- src/database/{client => _deprecated}/models/message.ts | 6 +++--- src/database/{client => _deprecated}/models/plugin.ts | 2 +- src/database/{client => _deprecated}/models/session.ts | 6 +++--- .../{client => _deprecated}/models/sessionGroup.ts | 4 ++-- src/database/{client => _deprecated}/models/topic.ts | 8 ++++---- src/database/{client => _deprecated}/models/user.ts | 2 +- src/database/{client => _deprecated}/schemas/files.ts | 0 src/database/{client => _deprecated}/schemas/message.ts | 0 src/database/{client => _deprecated}/schemas/plugin.ts | 0 src/database/{client => _deprecated}/schemas/session.ts | 0 .../{client => _deprecated}/schemas/sessionGroup.ts | 0 src/database/{client => _deprecated}/schemas/topic.ts | 0 src/database/{client => _deprecated}/schemas/user.ts | 2 +- src/services/__tests__/sync.test.ts | 4 ++-- src/services/debug.ts | 2 +- src/services/file/client.test.ts | 6 +++--- src/services/file/client.ts | 4 ++-- src/services/import/client.ts | 8 ++++---- src/services/message/client.test.ts | 4 ++-- src/services/message/client.ts | 6 +++--- src/services/message/index.test.ts | 4 ++-- src/services/message/type.ts | 2 +- src/services/plugin/client.test.ts | 6 +++--- src/services/plugin/client.ts | 2 +- src/services/session/client.test.ts | 8 ++++---- src/services/session/client.ts | 6 +++--- src/services/sync.ts | 2 +- src/services/topic/client.test.ts | 6 +++--- src/services/topic/client.ts | 2 +- src/services/upload.ts | 2 +- src/services/user/client.test.ts | 4 ++-- src/services/user/client.ts | 6 +++--- src/store/file/slices/chat/action.test.ts | 2 +- src/types/sync.ts | 2 +- 57 files changed, 72 insertions(+), 72 deletions(-) rename src/database/{client => _deprecated}/core/__tests__/db-upgrade.test.ts (100%) rename src/database/{client => _deprecated}/core/__tests__/db.test.ts (100%) rename src/database/{client => _deprecated}/core/__tests__/model.test.ts (100%) rename src/database/{client => _deprecated}/core/db.ts (100%) rename src/database/{client => _deprecated}/core/index.ts (100%) rename src/database/{client => _deprecated}/core/migrations/migrateSettingsToUser/fixtures/input.json (100%) rename src/database/{client => _deprecated}/core/migrations/migrateSettingsToUser/fixtures/output.json (100%) rename src/database/{client => _deprecated}/core/migrations/migrateSettingsToUser/index.test.ts (100%) rename src/database/{client => _deprecated}/core/migrations/migrateSettingsToUser/index.ts (100%) rename src/database/{client => _deprecated}/core/migrations/migrateSettingsToUser/type.ts (100%) rename src/database/{client => _deprecated}/core/model.ts (100%) rename src/database/{client => _deprecated}/core/schemas.ts (100%) rename src/database/{client => _deprecated}/core/sync.ts (100%) rename src/database/{client => _deprecated}/core/types/db.ts (100%) rename src/database/{client => _deprecated}/models/__DEBUG.ts (95%) rename src/database/{client => _deprecated}/models/__tests__/file.test.ts (100%) rename src/database/{client => _deprecated}/models/__tests__/message.test.ts (100%) rename src/database/{client => _deprecated}/models/__tests__/plugin.test.ts (100%) rename src/database/{client => _deprecated}/models/__tests__/session.test.ts (97%) rename src/database/{client => _deprecated}/models/__tests__/sessionGroup.test.ts (99%) rename src/database/{client => _deprecated}/models/__tests__/topic.test.ts (98%) rename src/database/{client => _deprecated}/models/__tests__/user.test.ts (100%) rename src/database/{client => _deprecated}/models/file.ts (84%) rename src/database/{client => _deprecated}/models/message.ts (97%) rename src/database/{client => _deprecated}/models/plugin.ts (96%) rename src/database/{client => _deprecated}/models/session.ts (97%) rename src/database/{client => _deprecated}/models/sessionGroup.ts (96%) rename src/database/{client => _deprecated}/models/topic.ts (96%) rename src/database/{client => _deprecated}/models/user.ts (96%) rename src/database/{client => _deprecated}/schemas/files.ts (100%) rename src/database/{client => _deprecated}/schemas/message.ts (100%) rename src/database/{client => _deprecated}/schemas/plugin.ts (100%) rename src/database/{client => _deprecated}/schemas/session.ts (100%) rename src/database/{client => _deprecated}/schemas/sessionGroup.ts (100%) rename src/database/{client => _deprecated}/schemas/topic.ts (100%) rename src/database/{client => _deprecated}/schemas/user.ts (92%) diff --git a/src/database/client/core/__tests__/db-upgrade.test.ts b/src/database/_deprecated/core/__tests__/db-upgrade.test.ts similarity index 100% rename from src/database/client/core/__tests__/db-upgrade.test.ts rename to src/database/_deprecated/core/__tests__/db-upgrade.test.ts diff --git a/src/database/client/core/__tests__/db.test.ts b/src/database/_deprecated/core/__tests__/db.test.ts similarity index 100% rename from src/database/client/core/__tests__/db.test.ts rename to src/database/_deprecated/core/__tests__/db.test.ts diff --git a/src/database/client/core/__tests__/model.test.ts b/src/database/_deprecated/core/__tests__/model.test.ts similarity index 100% rename from src/database/client/core/__tests__/model.test.ts rename to src/database/_deprecated/core/__tests__/model.test.ts diff --git a/src/database/client/core/db.ts b/src/database/_deprecated/core/db.ts similarity index 100% rename from src/database/client/core/db.ts rename to src/database/_deprecated/core/db.ts diff --git a/src/database/client/core/index.ts b/src/database/_deprecated/core/index.ts similarity index 100% rename from src/database/client/core/index.ts rename to src/database/_deprecated/core/index.ts diff --git a/src/database/client/core/migrations/migrateSettingsToUser/fixtures/input.json b/src/database/_deprecated/core/migrations/migrateSettingsToUser/fixtures/input.json similarity index 100% rename from src/database/client/core/migrations/migrateSettingsToUser/fixtures/input.json rename to src/database/_deprecated/core/migrations/migrateSettingsToUser/fixtures/input.json diff --git a/src/database/client/core/migrations/migrateSettingsToUser/fixtures/output.json b/src/database/_deprecated/core/migrations/migrateSettingsToUser/fixtures/output.json similarity index 100% rename from src/database/client/core/migrations/migrateSettingsToUser/fixtures/output.json rename to src/database/_deprecated/core/migrations/migrateSettingsToUser/fixtures/output.json diff --git a/src/database/client/core/migrations/migrateSettingsToUser/index.test.ts b/src/database/_deprecated/core/migrations/migrateSettingsToUser/index.test.ts similarity index 100% rename from src/database/client/core/migrations/migrateSettingsToUser/index.test.ts rename to src/database/_deprecated/core/migrations/migrateSettingsToUser/index.test.ts diff --git a/src/database/client/core/migrations/migrateSettingsToUser/index.ts b/src/database/_deprecated/core/migrations/migrateSettingsToUser/index.ts similarity index 100% rename from src/database/client/core/migrations/migrateSettingsToUser/index.ts rename to src/database/_deprecated/core/migrations/migrateSettingsToUser/index.ts diff --git a/src/database/client/core/migrations/migrateSettingsToUser/type.ts b/src/database/_deprecated/core/migrations/migrateSettingsToUser/type.ts similarity index 100% rename from src/database/client/core/migrations/migrateSettingsToUser/type.ts rename to src/database/_deprecated/core/migrations/migrateSettingsToUser/type.ts diff --git a/src/database/client/core/model.ts b/src/database/_deprecated/core/model.ts similarity index 100% rename from src/database/client/core/model.ts rename to src/database/_deprecated/core/model.ts diff --git a/src/database/client/core/schemas.ts b/src/database/_deprecated/core/schemas.ts similarity index 100% rename from src/database/client/core/schemas.ts rename to src/database/_deprecated/core/schemas.ts diff --git a/src/database/client/core/sync.ts b/src/database/_deprecated/core/sync.ts similarity index 100% rename from src/database/client/core/sync.ts rename to src/database/_deprecated/core/sync.ts diff --git a/src/database/client/core/types/db.ts b/src/database/_deprecated/core/types/db.ts similarity index 100% rename from src/database/client/core/types/db.ts rename to src/database/_deprecated/core/types/db.ts diff --git a/src/database/client/models/__DEBUG.ts b/src/database/_deprecated/models/__DEBUG.ts similarity index 95% rename from src/database/client/models/__DEBUG.ts rename to src/database/_deprecated/models/__DEBUG.ts index 890474120573..19951870dfa4 100644 --- a/src/database/client/models/__DEBUG.ts +++ b/src/database/_deprecated/models/__DEBUG.ts @@ -1,9 +1,9 @@ // This file is for debugging purposes only. // DON'T USE IT IN PRODUCTION. import { DEFAULT_AGENT_CONFIG } from '@/const/settings'; -import { DBModel } from '@/database/client/core/types/db'; -import { DB_Message } from '@/database/client/schemas/message'; -import { DB_Topic } from '@/database/client/schemas/topic'; +import { DBModel } from '@/database/_deprecated/core/types/db'; +import { DB_Message } from '@/database/_deprecated/schemas/message'; +import { DB_Topic } from '@/database/_deprecated/schemas/topic'; import { BaseModel } from '../core'; import { DB_Session, DB_SessionSchema } from '../schemas/session'; diff --git a/src/database/client/models/__tests__/file.test.ts b/src/database/_deprecated/models/__tests__/file.test.ts similarity index 100% rename from src/database/client/models/__tests__/file.test.ts rename to src/database/_deprecated/models/__tests__/file.test.ts diff --git a/src/database/client/models/__tests__/message.test.ts b/src/database/_deprecated/models/__tests__/message.test.ts similarity index 100% rename from src/database/client/models/__tests__/message.test.ts rename to src/database/_deprecated/models/__tests__/message.test.ts diff --git a/src/database/client/models/__tests__/plugin.test.ts b/src/database/_deprecated/models/__tests__/plugin.test.ts similarity index 100% rename from src/database/client/models/__tests__/plugin.test.ts rename to src/database/_deprecated/models/__tests__/plugin.test.ts diff --git a/src/database/client/models/__tests__/session.test.ts b/src/database/_deprecated/models/__tests__/session.test.ts similarity index 97% rename from src/database/client/models/__tests__/session.test.ts rename to src/database/_deprecated/models/__tests__/session.test.ts index 6252f42048e5..e34de5549308 100644 --- a/src/database/client/models/__tests__/session.test.ts +++ b/src/database/_deprecated/models/__tests__/session.test.ts @@ -1,9 +1,9 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest'; import { DEFAULT_AGENT_CONFIG } from '@/const/settings'; -import { CreateMessageParams, MessageModel } from '@/database/client/models/message'; -import { SessionGroupModel } from '@/database/client/models/sessionGroup'; -import { TopicModel } from '@/database/client/models/topic'; +import { CreateMessageParams, MessageModel } from '@/database/_deprecated/models/message'; +import { SessionGroupModel } from '@/database/_deprecated/models/sessionGroup'; +import { TopicModel } from '@/database/_deprecated/models/topic'; import { LobeAgentConfig } from '@/types/agent'; import { LobeAgentSession, diff --git a/src/database/client/models/__tests__/sessionGroup.test.ts b/src/database/_deprecated/models/__tests__/sessionGroup.test.ts similarity index 99% rename from src/database/client/models/__tests__/sessionGroup.test.ts rename to src/database/_deprecated/models/__tests__/sessionGroup.test.ts index 87d4e018ab6e..21b5066edfc4 100644 --- a/src/database/client/models/__tests__/sessionGroup.test.ts +++ b/src/database/_deprecated/models/__tests__/sessionGroup.test.ts @@ -1,6 +1,6 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest'; -import { SessionModel } from '@/database/client/models/session'; +import { SessionModel } from '@/database/_deprecated/models/session'; import { SessionGroups } from '@/types/session'; import { DB_SessionGroup } from '../../schemas/sessionGroup'; diff --git a/src/database/client/models/__tests__/topic.test.ts b/src/database/_deprecated/models/__tests__/topic.test.ts similarity index 98% rename from src/database/client/models/__tests__/topic.test.ts rename to src/database/_deprecated/models/__tests__/topic.test.ts index 079e746ce8e0..321bd74386ea 100644 --- a/src/database/client/models/__tests__/topic.test.ts +++ b/src/database/_deprecated/models/__tests__/topic.test.ts @@ -1,9 +1,9 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest'; -import { DBModel } from '@/database/client/core/types/db'; -import { CreateMessageParams, MessageModel } from '@/database/client/models/message'; -import { DB_Message } from '@/database/client/schemas/message'; -import { DB_Topic } from '@/database/client/schemas/topic'; +import { DBModel } from '@/database/_deprecated/core/types/db'; +import { CreateMessageParams, MessageModel } from '@/database/_deprecated/models/message'; +import { DB_Message } from '@/database/_deprecated/schemas/message'; +import { DB_Topic } from '@/database/_deprecated/schemas/topic'; import { nanoid } from '@/utils/uuid'; import * as uuidUtils from '@/utils/uuid'; diff --git a/src/database/client/models/__tests__/user.test.ts b/src/database/_deprecated/models/__tests__/user.test.ts similarity index 100% rename from src/database/client/models/__tests__/user.test.ts rename to src/database/_deprecated/models/__tests__/user.test.ts diff --git a/src/database/client/models/file.ts b/src/database/_deprecated/models/file.ts similarity index 84% rename from src/database/client/models/file.ts rename to src/database/_deprecated/models/file.ts index c41fcaf6eca5..f4a3244d8914 100644 --- a/src/database/client/models/file.ts +++ b/src/database/_deprecated/models/file.ts @@ -1,5 +1,5 @@ -import { DBModel } from '@/database/client/core/types/db'; -import { DB_File, DB_FileSchema } from '@/database/client/schemas/files'; +import { DBModel } from '@/database/_deprecated/core/types/db'; +import { DB_File, DB_FileSchema } from '@/database/_deprecated/schemas/files'; import { nanoid } from '@/utils/uuid'; import { BaseModel } from '../core'; diff --git a/src/database/client/models/message.ts b/src/database/_deprecated/models/message.ts similarity index 97% rename from src/database/client/models/message.ts rename to src/database/_deprecated/models/message.ts index 0474226a5d3c..2cfd6b11593e 100644 --- a/src/database/client/models/message.ts +++ b/src/database/_deprecated/models/message.ts @@ -1,8 +1,8 @@ import { DeepPartial } from 'utility-types'; -import { BaseModel } from '@/database/client/core'; -import { DBModel } from '@/database/client/core/types/db'; -import { DB_Message, DB_MessageSchema } from '@/database/client/schemas/message'; +import { BaseModel } from '@/database/_deprecated/core'; +import { DBModel } from '@/database/_deprecated/core/types/db'; +import { DB_Message, DB_MessageSchema } from '@/database/_deprecated/schemas/message'; import { ChatMessage } from '@/types/message'; import { nanoid } from '@/utils/uuid'; diff --git a/src/database/client/models/plugin.ts b/src/database/_deprecated/models/plugin.ts similarity index 96% rename from src/database/client/models/plugin.ts rename to src/database/_deprecated/models/plugin.ts index 3c074063e190..61c87222f7ab 100644 --- a/src/database/client/models/plugin.ts +++ b/src/database/_deprecated/models/plugin.ts @@ -1,6 +1,6 @@ import { LobeChatPluginManifest } from '@lobehub/chat-plugin-sdk'; -import { BaseModel } from '@/database/client/core'; +import { BaseModel } from '@/database/_deprecated/core'; import { LobeTool } from '@/types/tool'; import { merge } from '@/utils/merge'; diff --git a/src/database/client/models/session.ts b/src/database/_deprecated/models/session.ts similarity index 97% rename from src/database/client/models/session.ts rename to src/database/_deprecated/models/session.ts index a6ece1d87639..16961fb57ab1 100644 --- a/src/database/client/models/session.ts +++ b/src/database/_deprecated/models/session.ts @@ -1,9 +1,9 @@ import { DeepPartial } from 'utility-types'; import { DEFAULT_AGENT_LOBE_SESSION } from '@/const/session'; -import { BaseModel } from '@/database/client/core'; -import { DBModel } from '@/database/client/core/types/db'; -import { DB_Session, DB_SessionSchema } from '@/database/client/schemas/session'; +import { BaseModel } from '@/database/_deprecated/core'; +import { DBModel } from '@/database/_deprecated/core/types/db'; +import { DB_Session, DB_SessionSchema } from '@/database/_deprecated/schemas/session'; import { LobeAgentConfig } from '@/types/agent'; import { ChatSessionList, diff --git a/src/database/client/models/sessionGroup.ts b/src/database/_deprecated/models/sessionGroup.ts similarity index 96% rename from src/database/client/models/sessionGroup.ts rename to src/database/_deprecated/models/sessionGroup.ts index 583ddbb32352..fb934788a772 100644 --- a/src/database/client/models/sessionGroup.ts +++ b/src/database/_deprecated/models/sessionGroup.ts @@ -1,5 +1,5 @@ -import { BaseModel } from '@/database/client/core'; -import { DB_SessionGroup, DB_SessionGroupSchema } from '@/database/client/schemas/sessionGroup'; +import { BaseModel } from '@/database/_deprecated/core'; +import { DB_SessionGroup, DB_SessionGroupSchema } from '@/database/_deprecated/schemas/sessionGroup'; import { SessionGroups } from '@/types/session'; import { nanoid } from '@/utils/uuid'; diff --git a/src/database/client/models/topic.ts b/src/database/_deprecated/models/topic.ts similarity index 96% rename from src/database/client/models/topic.ts rename to src/database/_deprecated/models/topic.ts index e25e7e49b7c1..4c496a758422 100644 --- a/src/database/client/models/topic.ts +++ b/src/database/_deprecated/models/topic.ts @@ -1,7 +1,7 @@ -import { BaseModel } from '@/database/client/core'; -import { DBModel } from '@/database/client/core/types/db'; -import { MessageModel } from '@/database/client/models/message'; -import { DB_Topic, DB_TopicSchema } from '@/database/client/schemas/topic'; +import { BaseModel } from '@/database/_deprecated/core'; +import { DBModel } from '@/database/_deprecated/core/types/db'; +import { MessageModel } from '@/database/_deprecated/models/message'; +import { DB_Topic, DB_TopicSchema } from '@/database/_deprecated/schemas/topic'; import { ChatTopic } from '@/types/topic'; import { nanoid } from '@/utils/uuid'; diff --git a/src/database/client/models/user.ts b/src/database/_deprecated/models/user.ts similarity index 96% rename from src/database/client/models/user.ts rename to src/database/_deprecated/models/user.ts index 1162b197b7e5..e9dc5979ce0b 100644 --- a/src/database/client/models/user.ts +++ b/src/database/_deprecated/models/user.ts @@ -1,6 +1,6 @@ import { DeepPartial } from 'utility-types'; -import { BaseModel } from '@/database/client/core'; +import { BaseModel } from '@/database/_deprecated/core'; import { LobeAgentConfig } from '@/types/agent'; import { uuid } from '@/utils/uuid'; diff --git a/src/database/client/schemas/files.ts b/src/database/_deprecated/schemas/files.ts similarity index 100% rename from src/database/client/schemas/files.ts rename to src/database/_deprecated/schemas/files.ts diff --git a/src/database/client/schemas/message.ts b/src/database/_deprecated/schemas/message.ts similarity index 100% rename from src/database/client/schemas/message.ts rename to src/database/_deprecated/schemas/message.ts diff --git a/src/database/client/schemas/plugin.ts b/src/database/_deprecated/schemas/plugin.ts similarity index 100% rename from src/database/client/schemas/plugin.ts rename to src/database/_deprecated/schemas/plugin.ts diff --git a/src/database/client/schemas/session.ts b/src/database/_deprecated/schemas/session.ts similarity index 100% rename from src/database/client/schemas/session.ts rename to src/database/_deprecated/schemas/session.ts diff --git a/src/database/client/schemas/sessionGroup.ts b/src/database/_deprecated/schemas/sessionGroup.ts similarity index 100% rename from src/database/client/schemas/sessionGroup.ts rename to src/database/_deprecated/schemas/sessionGroup.ts diff --git a/src/database/client/schemas/topic.ts b/src/database/_deprecated/schemas/topic.ts similarity index 100% rename from src/database/client/schemas/topic.ts rename to src/database/_deprecated/schemas/topic.ts diff --git a/src/database/client/schemas/user.ts b/src/database/_deprecated/schemas/user.ts similarity index 92% rename from src/database/client/schemas/user.ts rename to src/database/_deprecated/schemas/user.ts index 3aad822a6ce9..e78458879d9c 100644 --- a/src/database/client/schemas/user.ts +++ b/src/database/_deprecated/schemas/user.ts @@ -1,6 +1,6 @@ import { z } from 'zod'; -import { AgentSchema } from '@/database/client/schemas/session'; +import { AgentSchema } from '@/database/_deprecated/schemas/session'; import { LobeMetaDataSchema } from '@/types/meta'; const generalSechma = z.object({ diff --git a/src/services/__tests__/sync.test.ts b/src/services/__tests__/sync.test.ts index 7010131065e9..7ebe9a5bd13f 100644 --- a/src/services/__tests__/sync.test.ts +++ b/src/services/__tests__/sync.test.ts @@ -1,11 +1,11 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { dataSync } from '@/database/client/core'; +import { dataSync } from '@/database/_deprecated/core'; import { StartDataSyncParams } from '@/types/sync'; import { syncService } from '../sync'; -vi.mock('@/database/client/core', () => ({ +vi.mock('@/database/_deprecated/core', () => ({ dataSync: { startDataSync: vi.fn(), disconnect: vi.fn(), diff --git a/src/services/debug.ts b/src/services/debug.ts index ea91a275efe1..1584e5f8de3e 100644 --- a/src/services/debug.ts +++ b/src/services/debug.ts @@ -1,4 +1,4 @@ -import { DEBUG_MODEL } from '@/database/client/models/__DEBUG'; +import { DEBUG_MODEL } from '@/database/_deprecated/models/__DEBUG'; class DebugService { async insertLargeDataToDB() { diff --git a/src/services/file/client.test.ts b/src/services/file/client.test.ts index b7282fb4de4a..636db762c4cf 100644 --- a/src/services/file/client.test.ts +++ b/src/services/file/client.test.ts @@ -1,8 +1,8 @@ import { Mock, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import { fileEnv } from '@/config/file'; -import { FileModel } from '@/database/client/models/file'; -import { DB_File } from '@/database/client/schemas/files'; +import { FileModel } from '@/database/_deprecated/models/file'; +import { DB_File } from '@/database/_deprecated/schemas/files'; import { serverConfigSelectors } from '@/store/serverConfig/selectors'; import { createServerConfigStore } from '@/store/serverConfig/store'; @@ -14,7 +14,7 @@ beforeAll(() => { createServerConfigStore(); }); // Mocks for the FileModel -vi.mock('@/database/client/models/file', () => ({ +vi.mock('@/database/_deprecated/models/file', () => ({ FileModel: { create: vi.fn(), delete: vi.fn(), diff --git a/src/services/file/client.ts b/src/services/file/client.ts index f9361238a2fa..babfa78322c3 100644 --- a/src/services/file/client.ts +++ b/src/services/file/client.ts @@ -1,5 +1,5 @@ -import { FileModel } from '@/database/client/models/file'; -import { DB_File } from '@/database/client/schemas/files'; +import { FileModel } from '@/database/_deprecated/models/file'; +import { DB_File } from '@/database/_deprecated/schemas/files'; import { FileItem } from '@/types/files'; import { IFileService } from './type'; diff --git a/src/services/import/client.ts b/src/services/import/client.ts index 274e3b81028f..d246c5b29425 100644 --- a/src/services/import/client.ts +++ b/src/services/import/client.ts @@ -1,7 +1,7 @@ -import { MessageModel } from '@/database/client/models/message'; -import { SessionModel } from '@/database/client/models/session'; -import { SessionGroupModel } from '@/database/client/models/sessionGroup'; -import { TopicModel } from '@/database/client/models/topic'; +import { MessageModel } from '@/database/_deprecated/models/message'; +import { SessionModel } from '@/database/_deprecated/models/session'; +import { SessionGroupModel } from '@/database/_deprecated/models/sessionGroup'; +import { TopicModel } from '@/database/_deprecated/models/topic'; import { ImportResult, ImportResults } from '@/services/config'; import { useUserStore } from '@/store/user'; import { ImportStage, ImporterEntryData, OnImportCallbacks } from '@/types/importer'; diff --git a/src/services/message/client.test.ts b/src/services/message/client.test.ts index 3e777fb00d88..867fda6c5b72 100644 --- a/src/services/message/client.test.ts +++ b/src/services/message/client.test.ts @@ -1,7 +1,7 @@ import dayjs from 'dayjs'; import { Mock, describe, expect, it, vi } from 'vitest'; -import { CreateMessageParams, MessageModel } from '@/database/client/models/message'; +import { CreateMessageParams, MessageModel } from '@/database/_deprecated/models/message'; import { ChatMessage, ChatMessageError, @@ -15,7 +15,7 @@ import { ClientService } from './client'; const messageService = new ClientService(); // Mock the MessageModel -vi.mock('@/database/client/models/message', () => { +vi.mock('@/database/_deprecated/models/message', () => { return { MessageModel: { create: vi.fn(), diff --git a/src/services/message/client.ts b/src/services/message/client.ts index 3ee501251feb..d51d6d72a1a4 100644 --- a/src/services/message/client.ts +++ b/src/services/message/client.ts @@ -1,8 +1,8 @@ import dayjs from 'dayjs'; -import { FileModel } from '@/database/client/models/file'; -import { MessageModel } from '@/database/client/models/message'; -import { DB_Message } from '@/database/client/schemas/message'; +import { FileModel } from '@/database/_deprecated/models/file'; +import { MessageModel } from '@/database/_deprecated/models/message'; +import { DB_Message } from '@/database/_deprecated/schemas/message'; import { ChatFileItem, ChatMessage, diff --git a/src/services/message/index.test.ts b/src/services/message/index.test.ts index 25e89235e35d..625261f53c90 100644 --- a/src/services/message/index.test.ts +++ b/src/services/message/index.test.ts @@ -1,12 +1,12 @@ import { Mock, describe, expect, it, vi } from 'vitest'; -import { CreateMessageParams, MessageModel } from '@/database/client/models/message'; +import { CreateMessageParams, MessageModel } from '@/database/_deprecated/models/message'; import { ChatMessage, ChatMessageError, ChatPluginPayload } from '@/types/message'; import { messageService } from './index'; // Mock the MessageModel -vi.mock('@/database/client/models/message', () => { +vi.mock('@/database/_deprecated/models/message', () => { return { MessageModel: { count: vi.fn(), diff --git a/src/services/message/type.ts b/src/services/message/type.ts index d151a80aff49..2929620ad128 100644 --- a/src/services/message/type.ts +++ b/src/services/message/type.ts @@ -1,4 +1,4 @@ -import { DB_Message } from '@/database/client/schemas/message'; +import { DB_Message } from '@/database/_deprecated/schemas/message'; import { ChatMessage, ChatMessageError, diff --git a/src/services/plugin/client.test.ts b/src/services/plugin/client.test.ts index e90c7cdf5247..e2b6ccc66822 100644 --- a/src/services/plugin/client.test.ts +++ b/src/services/plugin/client.test.ts @@ -1,8 +1,8 @@ import { LobeChatPluginManifest } from '@lobehub/chat-plugin-sdk'; import { beforeEach, describe, expect, it, vi } from 'vitest'; -import { PluginModel } from '@/database/client/models/plugin'; -import { DB_Plugin } from '@/database/client/schemas/plugin'; +import { PluginModel } from '@/database/_deprecated/models/plugin'; +import { DB_Plugin } from '@/database/_deprecated/schemas/plugin'; import { LobeTool } from '@/types/tool'; import { LobeToolCustomPlugin } from '@/types/tool/plugin'; @@ -13,7 +13,7 @@ const pluginService = new ClientService(); // Mocking modules and functions -vi.mock('@/database/client/models/plugin', () => ({ +vi.mock('@/database/_deprecated/models/plugin', () => ({ PluginModel: { getList: vi.fn(), create: vi.fn(), diff --git a/src/services/plugin/client.ts b/src/services/plugin/client.ts index cb2f1682e54c..c56f73119c14 100644 --- a/src/services/plugin/client.ts +++ b/src/services/plugin/client.ts @@ -1,6 +1,6 @@ import { LobeChatPluginManifest } from '@lobehub/chat-plugin-sdk'; -import { PluginModel } from '@/database/client/models/plugin'; +import { PluginModel } from '@/database/_deprecated/models/plugin'; import { LobeTool } from '@/types/tool'; import { LobeToolCustomPlugin } from '@/types/tool/plugin'; diff --git a/src/services/session/client.test.ts b/src/services/session/client.test.ts index aa5299782b79..4a7274ce547a 100644 --- a/src/services/session/client.test.ts +++ b/src/services/session/client.test.ts @@ -1,7 +1,7 @@ import { Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { SessionModel } from '@/database/client/models/session'; -import { SessionGroupModel } from '@/database/client/models/sessionGroup'; +import { SessionModel } from '@/database/_deprecated/models/session'; +import { SessionGroupModel } from '@/database/_deprecated/models/sessionGroup'; import { LobeAgentConfig } from '@/types/agent'; import { LobeAgentSession, LobeSessionType, SessionGroups } from '@/types/session'; @@ -10,7 +10,7 @@ import { ClientService } from './client'; const sessionService = new ClientService(); // Mock the SessionModel -vi.mock('@/database/client/models/session', () => { +vi.mock('@/database/_deprecated/models/session', () => { return { SessionModel: { create: vi.fn(), @@ -33,7 +33,7 @@ vi.mock('@/database/client/models/session', () => { }); // Mock the SessionGroupModel -vi.mock('@/database/client/models/sessionGroup', () => { +vi.mock('@/database/_deprecated/models/sessionGroup', () => { return { SessionGroupModel: { create: vi.fn(), diff --git a/src/services/session/client.ts b/src/services/session/client.ts index 0f17fcefe778..2d205cca8c8c 100644 --- a/src/services/session/client.ts +++ b/src/services/session/client.ts @@ -1,9 +1,9 @@ import { DeepPartial } from 'utility-types'; import { INBOX_SESSION_ID } from '@/const/session'; -import { SessionModel } from '@/database/client/models/session'; -import { SessionGroupModel } from '@/database/client/models/sessionGroup'; -import { UserModel } from '@/database/client/models/user'; +import { SessionModel } from '@/database/_deprecated/models/session'; +import { SessionGroupModel } from '@/database/_deprecated/models/sessionGroup'; +import { UserModel } from '@/database/_deprecated/models/user'; import { useUserStore } from '@/store/user'; import { LobeAgentChatConfig, LobeAgentConfig } from '@/types/agent'; import { MetaData } from '@/types/meta'; diff --git a/src/services/sync.ts b/src/services/sync.ts index 6331ccec209a..03e8b8bbc9a8 100644 --- a/src/services/sync.ts +++ b/src/services/sync.ts @@ -1,4 +1,4 @@ -import { dataSync } from '@/database/client/core'; +import { dataSync } from '@/database/_deprecated/core'; import { StartDataSyncParams } from '@/types/sync'; class SyncService { diff --git a/src/services/topic/client.test.ts b/src/services/topic/client.test.ts index 9c2eadfb7bd0..211abefa7d36 100644 --- a/src/services/topic/client.test.ts +++ b/src/services/topic/client.test.ts @@ -1,14 +1,14 @@ import { Mock, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; -import { SessionModel } from '@/database/client/models/session'; -import { CreateTopicParams, TopicModel } from '@/database/client/models/topic'; +import { SessionModel } from '@/database/_deprecated/models/session'; +import { CreateTopicParams, TopicModel } from '@/database/_deprecated/models/topic'; import { ChatTopic } from '@/types/topic'; import { ClientService } from './client'; const topicService = new ClientService(); // Mock the TopicModel -vi.mock('@/database/client/models/topic', () => { +vi.mock('@/database/_deprecated/models/topic', () => { return { TopicModel: { create: vi.fn(), diff --git a/src/services/topic/client.ts b/src/services/topic/client.ts index 1be53520ed17..eeb2ffa2e395 100644 --- a/src/services/topic/client.ts +++ b/src/services/topic/client.ts @@ -1,4 +1,4 @@ -import { TopicModel } from '@/database/client/models/topic'; +import { TopicModel } from '@/database/_deprecated/models/topic'; import { ChatTopic } from '@/types/topic'; import { CreateTopicParams, ITopicService, QueryTopicParams } from './type'; diff --git a/src/services/upload.ts b/src/services/upload.ts index 311b329150e3..38f6cdd2959b 100644 --- a/src/services/upload.ts +++ b/src/services/upload.ts @@ -67,7 +67,7 @@ class UploadService { }; uploadToClientDB = async (params: UploadFileParams, file: File) => { - const { FileModel } = await import('@/database/client/models/file'); + const { FileModel } = await import('@/database/_deprecated/models/file'); const fileArrayBuffer = await file.arrayBuffer(); // save to local storage diff --git a/src/services/user/client.test.ts b/src/services/user/client.test.ts index d289252493ef..f79f8294a2f5 100644 --- a/src/services/user/client.test.ts +++ b/src/services/user/client.test.ts @@ -1,14 +1,14 @@ import { DeepPartial } from 'utility-types'; import { Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { UserModel } from '@/database/client/models/user'; +import { UserModel } from '@/database/_deprecated/models/user'; import { UserPreference } from '@/types/user'; import { UserSettings } from '@/types/user/settings'; import { AsyncLocalStorage } from '@/utils/localStorage'; import { ClientService } from './client'; -vi.mock('@/database/client/models/user', () => ({ +vi.mock('@/database/_deprecated/models/user', () => ({ UserModel: { getUser: vi.fn(), updateSettings: vi.fn(), diff --git a/src/services/user/client.ts b/src/services/user/client.ts index 4554b16fa4be..500d856a11b5 100644 --- a/src/services/user/client.ts +++ b/src/services/user/client.ts @@ -1,8 +1,8 @@ import { DeepPartial } from 'utility-types'; -import { MessageModel } from '@/database/client/models/message'; -import { SessionModel } from '@/database/client/models/session'; -import { UserModel } from '@/database/client/models/user'; +import { MessageModel } from '@/database/_deprecated/models/message'; +import { SessionModel } from '@/database/_deprecated/models/session'; +import { UserModel } from '@/database/_deprecated/models/user'; import { UserGuide, UserInitializationState, UserPreference } from '@/types/user'; import { UserSettings } from '@/types/user/settings'; import { AsyncLocalStorage } from '@/utils/localStorage'; diff --git a/src/store/file/slices/chat/action.test.ts b/src/store/file/slices/chat/action.test.ts index 0050168d81ee..88eacd4cc46b 100644 --- a/src/store/file/slices/chat/action.test.ts +++ b/src/store/file/slices/chat/action.test.ts @@ -3,7 +3,7 @@ import useSWR from 'swr'; import { Mock, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import { notification } from '@/components/AntdStaticMethods'; -import { DB_File } from '@/database/client/schemas/files'; +import { DB_File } from '@/database/_deprecated/schemas/files'; import { fileService } from '@/services/file'; import { uploadService } from '@/services/upload'; diff --git a/src/types/sync.ts b/src/types/sync.ts index 23d869f37f4b..dc83beccb689 100644 --- a/src/types/sync.ts +++ b/src/types/sync.ts @@ -1,4 +1,4 @@ -import { LobeDBSchemaMap } from '@/database/client/core/db'; +import { LobeDBSchemaMap } from '@/database/_deprecated/core/db'; export type OnSyncEvent = (tableKey: keyof LobeDBSchemaMap) => void; export type OnSyncStatusChange = (status: PeerSyncStatus) => void;