Added data migration service

This commit is contained in:
2025-06-06 23:49:05 +08:00
parent 3e20f47b8e
commit 31addd5a20
25 changed files with 1915 additions and 425 deletions

View File

@@ -62,6 +62,23 @@ export class Menu {
}
}
export class WebviewWindow {
/** Creates a new WebviewWindow instance. */
constructor($$source: Partial<WebviewWindow> = {}) {
Object.assign(this, $$source);
}
/**
* Creates a new WebviewWindow instance from a string or object.
*/
static createFrom($$source: any = {}): WebviewWindow {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new WebviewWindow($$parsedSource as Partial<WebviewWindow>);
}
}
// Private type creation functions
const $$createType0 = Menu.createFrom;
const $$createType1 = $Create.Nullable($$createType0);

View File

@@ -5,6 +5,42 @@
// @ts-ignore: Unused imports
import {Create as $Create} from "@wailsio/runtime";
/**
* A Duration represents the elapsed time between two instants
* as an int64 nanosecond count. The representation limits the
* largest representable duration to approximately 290 years.
*/
export enum Duration {
/**
* The Go zero value for the underlying type of the enum.
*/
$zero = 0,
minDuration = -9223372036854775808,
maxDuration = 9223372036854775807,
/**
* Common durations. There is no definition for units of Day or larger
* to avoid confusion across daylight savings time zone transitions.
*
* To count the number of units in a [Duration], divide:
*
* second := time.Second
* fmt.Print(int64(second/time.Millisecond)) // prints 1000
*
* To convert an integer number of units to a Duration, multiply:
*
* seconds := 10
* fmt.Print(time.Duration(seconds)*time.Second) // prints 10s
*/
Nanosecond = 1,
Microsecond = 1000,
Millisecond = 1000000,
Second = 1000000000,
Minute = 60000000000,
Hour = 3600000000000,
};
/**
* A Time represents an instant in time with nanosecond precision.
*

View File

@@ -348,20 +348,9 @@ export class GeneralConfig {
"alwaysOnTop": boolean;
/**
* 默认数据存储路径
* 数据存储路径
*/
"defaultDataPath": string;
/**
* 数据存储路径配置
* 是否使用自定义数据路径
*/
"useCustomDataPath": boolean;
/**
* 自定义数据存储路径
*/
"customDataPath": string;
"dataPath": string;
/**
* 全局热键设置
@@ -379,14 +368,8 @@ export class GeneralConfig {
if (!("alwaysOnTop" in $$source)) {
this["alwaysOnTop"] = false;
}
if (!("defaultDataPath" in $$source)) {
this["defaultDataPath"] = "";
}
if (!("useCustomDataPath" in $$source)) {
this["useCustomDataPath"] = false;
}
if (!("customDataPath" in $$source)) {
this["customDataPath"] = "";
if (!("dataPath" in $$source)) {
this["dataPath"] = "";
}
if (!("enableGlobalHotkey" in $$source)) {
this["enableGlobalHotkey"] = false;
@@ -402,10 +385,10 @@ export class GeneralConfig {
* Creates a new GeneralConfig instance from a string or object.
*/
static createFrom($$source: any = {}): GeneralConfig {
const $$createField5_0 = $$createType7;
const $$createField3_0 = $$createType7;
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
if ("globalHotkey" in $$parsedSource) {
$$parsedSource["globalHotkey"] = $$createField5_0($$parsedSource["globalHotkey"]);
$$parsedSource["globalHotkey"] = $$createField3_0($$parsedSource["globalHotkey"]);
}
return new GeneralConfig($$parsedSource as Partial<GeneralConfig>);
}

View File

@@ -50,6 +50,14 @@ export function Set(key: string, value: any): Promise<void> & { cancel(): void }
return $resultPromise;
}
/**
* SetDataPathChangeCallback 设置数据路径配置变更回调
*/
export function SetDataPathChangeCallback(callback: any): Promise<void> & { cancel(): void } {
let $resultPromise = $Call.ByID(393017412, callback) as any;
return $resultPromise;
}
/**
* SetHotkeyChangeCallback 设置热键配置变更回调
*/

View File

@@ -10,6 +10,10 @@
// @ts-ignore: Unused imports
import {Call as $Call, Create as $Create} from "@wailsio/runtime";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as application$0 from "../../../github.com/wailsapp/wails/v3/pkg/application/models.js";
/**
* SelectDirectory 打开目录选择对话框
*/
@@ -17,3 +21,11 @@ export function SelectDirectory(): Promise<string> & { cancel(): void } {
let $resultPromise = $Call.ByID(2249533621) as any;
return $resultPromise;
}
/**
* SetWindow 设置绑定的窗口
*/
export function SetWindow(window: application$0.WebviewWindow | null): Promise<void> & { cancel(): void } {
let $resultPromise = $Call.ByID(968177170, window) as any;
return $resultPromise;
}

View File

@@ -15,7 +15,7 @@ import {Call as $Call, Create as $Create} from "@wailsio/runtime";
import * as models$0 from "../models/models.js";
/**
* ForceSave 强制保存当前文档
* ForceSave 强制保存
*/
export function ForceSave(): Promise<void> & { cancel(): void } {
let $resultPromise = $Call.ByID(2767091023) as any;
@@ -23,7 +23,7 @@ export function ForceSave(): Promise<void> & { cancel(): void } {
}
/**
* GetActiveDocument 获取当前活动文档
* GetActiveDocument 获取活动文档
*/
export function GetActiveDocument(): Promise<models$0.Document | null> & { cancel(): void } {
let $resultPromise = $Call.ByID(1785823398) as any;
@@ -35,15 +35,7 @@ export function GetActiveDocument(): Promise<models$0.Document | null> & { cance
}
/**
* GetActiveDocumentContent 获取当前活动文档内容
*/
export function GetActiveDocumentContent(): Promise<string> & { cancel(): void } {
let $resultPromise = $Call.ByID(922617063) as any;
return $resultPromise;
}
/**
* Initialize 初始化文档服务
* Initialize 初始化服务
*/
export function Initialize(): Promise<void> & { cancel(): void } {
let $resultPromise = $Call.ByID(3418008221) as any;
@@ -51,15 +43,23 @@ export function Initialize(): Promise<void> & { cancel(): void } {
}
/**
* SaveDocumentSync 同步保存文档内容
* OnDataPathChanged 处理数据路径变更
*/
export function SaveDocumentSync(content: string): Promise<void> & { cancel(): void } {
let $resultPromise = $Call.ByID(3770207288, content) as any;
export function OnDataPathChanged(oldPath: string, newPath: string): Promise<void> & { cancel(): void } {
let $resultPromise = $Call.ByID(269349439, oldPath, newPath) as any;
return $resultPromise;
}
/**
* ServiceShutdown 服务关闭
* ReloadDocument 重新加载文档
*/
export function ReloadDocument(): Promise<void> & { cancel(): void } {
let $resultPromise = $Call.ByID(3093415283) as any;
return $resultPromise;
}
/**
* ServiceShutdown 关闭服务
*/
export function ServiceShutdown(): Promise<void> & { cancel(): void } {
let $resultPromise = $Call.ByID(638578044) as any;
@@ -67,7 +67,7 @@ export function ServiceShutdown(): Promise<void> & { cancel(): void } {
}
/**
* UpdateActiveDocumentContent 更新当前活动文档内容
* UpdateActiveDocumentContent 更新文档内容
*/
export function UpdateActiveDocumentContent(content: string): Promise<void> & { cancel(): void } {
let $resultPromise = $Call.ByID(1486276638, content) as any;

View File

@@ -5,12 +5,14 @@ import * as ConfigService from "./configservice.js";
import * as DialogService from "./dialogservice.js";
import * as DocumentService from "./documentservice.js";
import * as HotkeyService from "./hotkeyservice.js";
import * as MigrationService from "./migrationservice.js";
import * as SystemService from "./systemservice.js";
export {
ConfigService,
DialogService,
DocumentService,
HotkeyService,
MigrationService,
SystemService
};

View File

@@ -0,0 +1,62 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* MigrationService 迁移服务
* @module
*/
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import {Call as $Call, Create as $Create} from "@wailsio/runtime";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as $models from "./models.js";
/**
* CancelMigration 取消迁移
*/
export function CancelMigration(): Promise<void> & { cancel(): void } {
let $resultPromise = $Call.ByID(1813274502) as any;
return $resultPromise;
}
/**
* GetProgress 获取当前进度
*/
export function GetProgress(): Promise<$models.MigrationProgress> & { cancel(): void } {
let $resultPromise = $Call.ByID(3413264131) as any;
let $typingPromise = $resultPromise.then(($result: any) => {
return $$createType0($result);
}) as any;
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
return $typingPromise;
}
/**
* MigrateDirectory 迁移目录
*/
export function MigrateDirectory(srcPath: string, dstPath: string): Promise<void> & { cancel(): void } {
let $resultPromise = $Call.ByID(311970580, srcPath, dstPath) as any;
return $resultPromise;
}
/**
* ServiceShutdown 服务关闭
*/
export function ServiceShutdown(): Promise<void> & { cancel(): void } {
let $resultPromise = $Call.ByID(3472042605) as any;
return $resultPromise;
}
/**
* SetProgressCallback 设置进度回调
*/
export function SetProgressCallback(callback: $models.MigrationProgressCallback): Promise<void> & { cancel(): void } {
let $resultPromise = $Call.ByID(75752256, callback) as any;
return $resultPromise;
}
// Private type creation functions
const $$createType0 = $models.MigrationProgress.createFrom;

View File

@@ -5,6 +5,10 @@
// @ts-ignore: Unused imports
import {Create as $Create} from "@wailsio/runtime";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as time$0 from "../../../time/models.js";
/**
* MemoryStats 内存统计信息
*/
@@ -71,3 +75,152 @@ export class MemoryStats {
return new MemoryStats($$parsedSource as Partial<MemoryStats>);
}
}
/**
* MigrationProgress 迁移进度信息
*/
export class MigrationProgress {
/**
* 迁移状态
*/
"status": MigrationStatus;
/**
* 当前处理的文件
*/
"currentFile": string;
/**
* 已处理文件数
*/
"processedFiles": number;
/**
* 总文件数
*/
"totalFiles": number;
/**
* 已处理字节数
*/
"processedBytes": number;
/**
* 总字节数
*/
"totalBytes": number;
/**
* 进度百分比 (0-100)
*/
"progress": number;
/**
* 状态消息
*/
"message": string;
/**
* 错误信息
*/
"error"?: string;
/**
* 开始时间
*/
"startTime": time$0.Time;
/**
* 估计剩余时间
*/
"estimatedTime": time$0.Duration;
/** Creates a new MigrationProgress instance. */
constructor($$source: Partial<MigrationProgress> = {}) {
if (!("status" in $$source)) {
this["status"] = ("" as MigrationStatus);
}
if (!("currentFile" in $$source)) {
this["currentFile"] = "";
}
if (!("processedFiles" in $$source)) {
this["processedFiles"] = 0;
}
if (!("totalFiles" in $$source)) {
this["totalFiles"] = 0;
}
if (!("processedBytes" in $$source)) {
this["processedBytes"] = 0;
}
if (!("totalBytes" in $$source)) {
this["totalBytes"] = 0;
}
if (!("progress" in $$source)) {
this["progress"] = 0;
}
if (!("message" in $$source)) {
this["message"] = "";
}
if (!("startTime" in $$source)) {
this["startTime"] = null;
}
if (!("estimatedTime" in $$source)) {
this["estimatedTime"] = (0 as time$0.Duration);
}
Object.assign(this, $$source);
}
/**
* Creates a new MigrationProgress instance from a string or object.
*/
static createFrom($$source: any = {}): MigrationProgress {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new MigrationProgress($$parsedSource as Partial<MigrationProgress>);
}
}
/**
* MigrationProgressCallback 进度回调函数类型
*/
export type MigrationProgressCallback = any;
/**
* MigrationStatus 迁移状态
*/
export enum MigrationStatus {
/**
* The Go zero value for the underlying type of the enum.
*/
$zero = "",
/**
* 空闲状态
*/
MigrationStatusIdle = "idle",
/**
* 准备中
*/
MigrationStatusPreparing = "preparing",
/**
* 迁移中
*/
MigrationStatusMigrating = "migrating",
/**
* 完成
*/
MigrationStatusCompleted = "completed",
/**
* 失败
*/
MigrationStatusFailed = "failed",
/**
* 取消
*/
MigrationStatusCancelled = "cancelled",
};