@solazah/solazah-runtime 0.1.77 → 0.1.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/types/Sync.d.ts +27 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solazah/solazah-runtime",
3
- "version": "0.1.77",
3
+ "version": "0.1.82",
4
4
  "main": "index.cjs",
5
5
  "module": "index.js",
6
6
  "types": "types/index.d.ts",
package/types/Sync.d.ts CHANGED
@@ -8,7 +8,15 @@ export interface SyncStatusDto {
8
8
  lastSyncAt: number | null;
9
9
  lastError: string | null;
10
10
  pushedSeq: number;
11
- peers: number;
11
+ /** 文件侧游标(与 pushedSeq 是两条独立的线:后者是 cloud.db 的水位)。 */
12
+ fileChangeId: number;
13
+ /** 空间占用。界面不单独展示,只用于排障与超额提示。 */
14
+ usage: {
15
+ usedBytes: number;
16
+ quotaBytes: number;
17
+ perFileBytes: number;
18
+ tier: string;
19
+ } | null;
12
20
  /** 当前同步命名空间 = 账号 ID(消毒为路径安全),即 COS 分区目录名。用于核对多设备是否同一账号。 */
13
21
  namespace: string | null;
14
22
  /** 是否为付费会员。跨设备同步是会员功能。 */
@@ -33,17 +41,26 @@ export interface SyncAppliedPayload {
33
41
  db?: boolean;
34
42
  files?: boolean;
35
43
  }
36
- /** 一条同步变更日志(仅记"有活动/出错"的同步),给账号-同步页排障。 */
44
+ /**
45
+ * 一条**真实发生的同步操作**。设置页直接展示,一行就是一件事。
46
+ *
47
+ * 不再是每轮的聚合计数:新模型里一条变更可能完全不传输任何字节(移动只改路径、删除不下载),
48
+ * 「文件下载 12」那种数字会让人以为花了 12 个文件的流量。
49
+ */
37
50
  export interface SyncLogEntry {
38
51
  at: number;
52
+ /** DOWN=拉到本机, UP=推出去, BOTH=与方向无关(如设置与插件那条线)。 */
53
+ direction: string;
54
+ /** CREATE / UPDATE / MOVE / DELETE / CONFLICT / DB / FAILED */
55
+ action: string;
56
+ path: string;
57
+ /** MOVE 的旧路径、CONFLICT 的副本落点。 */
58
+ fromPath: string | null;
59
+ size: number;
60
+ /** 服务端日志游标,排查时能直接对上。 */
61
+ changeId: number | null;
62
+ error: string | null;
39
63
  reason: string;
40
- ns: string;
41
- dbPulled: number;
42
- dbPushed: number;
43
- filesPulled: number;
44
- filesPushed: number;
45
- ok: boolean;
46
- error?: string;
47
64
  }
48
65
  /**
49
66
  * window.sync —— 数据库/工作空间同步的公共 API(sync.* IPC)。
@@ -66,7 +83,7 @@ export default class Sync {
66
83
  /** 立即同步一次,返回最新状态。 */
67
84
  now: () => Promise<SyncStatusDto>;
68
85
  /** 读同步变更日志(最新在前),给账号-同步页排障。 */
69
- getLog: (limit?: number) => Promise<SyncLogEntry[]>;
86
+ getLog: (limit?: number, offset?: number) => Promise<SyncLogEntry[]>;
70
87
  /**
71
88
  * 订阅"同步已应用"(主进程拉到远端 DB/文件变更后广播)→ 据此重拉刷新。返回退订闭包。
72
89
  * 多订阅者共用单条 ipcRenderer 通道(宿主 on 会 removeAllListeners,故在本实例内自行分发)。