feat(database): add database service abstraction with libsql/turso backend (#3472)

This commit is contained in:
Huang Xin
2026-03-05 02:01:35 +08:00
parent bd957a4eb8
commit 5273ef75dc
26 changed files with 2738 additions and 668 deletions
@@ -1,4 +1,5 @@
import { FileSystem, BaseDir, AppPlatform, ResolvedPath, FileItem } from '@/types/system';
import { DatabaseService } from '@/types/database';
import { getOSPlatform, isValidURL } from '@/utils/misc';
import { RemoteFile } from '@/utils/file';
import { isPWA } from './environment';
@@ -347,4 +348,10 @@ export class WebAppService extends BaseAppService {
async ask(message: string): Promise<boolean> {
return window.confirm(message);
}
async openDatabase(path: string, base: BaseDir): Promise<DatabaseService> {
const fullPath = await this.resolveFilePath(path, base);
const { WebDatabaseService } = await import('./database/webDatabaseService');
return WebDatabaseService.open(fullPath);
}
}