zen-fs-config 0.7.14 → 0.7.16
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.
- package/dist/index.d.mts +256 -1
- package/dist/index.d.ts +256 -1
- package/dist/index.js +755 -64
- package/dist/index.mjs +748 -64
- package/dist/zen-fs-config.js +748 -64
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -435,6 +435,90 @@ interface GroupDescriptor {
|
|
|
435
435
|
* `/nodes`、`/shared`。
|
|
436
436
|
* 两个能力位互不蕴含。
|
|
437
437
|
*/
|
|
438
|
+
/** 归属冲突的细分原因。 */
|
|
439
|
+
type BackendConflictReason = 'kind-mismatch' | 'id-mismatch' | 'instance-mismatch' | 'unreadable' | 'claim-failed';
|
|
440
|
+
/**
|
|
441
|
+
* 一个后端与远端根归属冲突的完整信息。
|
|
442
|
+
*
|
|
443
|
+
* `kind` / `id` / `instanceId` 三者用途不同,必须同时展示:
|
|
444
|
+
* - `kind`:组类型(config / data);
|
|
445
|
+
* - `id`:组 id(同时决定本地库名与引导副本路径);
|
|
446
|
+
* - `instanceId`:组实例身份(UUID,判定“这个远端根归谁”)。
|
|
447
|
+
*/
|
|
448
|
+
interface BackendConflictInfo {
|
|
449
|
+
backendId: string;
|
|
450
|
+
/** 一句话原因(已含两侧身份摘要,可直接展示)。 */
|
|
451
|
+
reason: string;
|
|
452
|
+
conflict?: BackendConflictReason;
|
|
453
|
+
/** 远端根的现状;空仓库或读不到时为 null。 */
|
|
454
|
+
remote: {
|
|
455
|
+
kind?: SyncGroupKind;
|
|
456
|
+
id?: string;
|
|
457
|
+
instanceId?: string;
|
|
458
|
+
name?: string;
|
|
459
|
+
} | null;
|
|
460
|
+
/** 本组身份。 */
|
|
461
|
+
local: {
|
|
462
|
+
kind: SyncGroupKind;
|
|
463
|
+
id: string;
|
|
464
|
+
instanceId?: string;
|
|
465
|
+
};
|
|
466
|
+
/** 允许“只把本地 instanceId 对齐到远端”(要求 kind 与 id 都相同)。 */
|
|
467
|
+
canAdoptRemoteInstance: boolean;
|
|
468
|
+
/** 允许“把远端 group.json 改写成本组身份”(要求 kind 相同;会影响共享该根的副本)。 */
|
|
469
|
+
canRewriteRemoteIdentity: boolean;
|
|
470
|
+
unreadable?: boolean;
|
|
471
|
+
error?: string;
|
|
472
|
+
}
|
|
473
|
+
/** 用户确认后的冲突解决动作。 */
|
|
474
|
+
type BackendConflictResolution = 'adopt-remote-instance' | 'rewrite-remote-identity';
|
|
475
|
+
interface BackendConflictResolutionResult {
|
|
476
|
+
mode: BackendConflictResolution;
|
|
477
|
+
ok: boolean;
|
|
478
|
+
reason?: string;
|
|
479
|
+
/** adopt-remote-instance 成功后应落盘的本地 instanceId。 */
|
|
480
|
+
instanceId?: string;
|
|
481
|
+
}
|
|
482
|
+
/** `instanceId` 的候选来源:本地描述符 / 共享引导副本 / 某个远端根。 */
|
|
483
|
+
type IdentityCandidateSource = 'local' | 'bootstrap' | 'remote';
|
|
484
|
+
/**
|
|
485
|
+
* 一条身份候选。同一值可能被多个根持有,用 `rootCount` 表示。
|
|
486
|
+
* 界面必须把它们全部列出,由用户决定本组最终使用哪个值。
|
|
487
|
+
*/
|
|
488
|
+
interface IdentityCandidate {
|
|
489
|
+
source: IdentityCandidateSource;
|
|
490
|
+
/** 远端候选对应的后端 id(local / bootstrap 无此字段)。 */
|
|
491
|
+
backendId?: string;
|
|
492
|
+
instanceId: string;
|
|
493
|
+
/** 持有该值的根数量(local / bootstrap 为 1)。 */
|
|
494
|
+
rootCount: number;
|
|
495
|
+
/** 该值所属的 kind / id;与本组不一致的候选已在收集阶段被排除。 */
|
|
496
|
+
kind?: SyncGroupKind;
|
|
497
|
+
id?: string;
|
|
498
|
+
}
|
|
499
|
+
/** 用户决定本组实例身份时的选项。 */
|
|
500
|
+
interface SetGroupInstanceIdOptions {
|
|
501
|
+
/**
|
|
502
|
+
* 同时把本组所有 `kind` / `id` 相同的远端根统一成该值(默认 false)。
|
|
503
|
+
* 这是唯一会改写远端 `group.json` 的路径,必须由用户确认后调用。
|
|
504
|
+
*/
|
|
505
|
+
rewriteRoots?: boolean;
|
|
506
|
+
}
|
|
507
|
+
/** 逐个远端根的写回结果。 */
|
|
508
|
+
interface GroupInstanceIdRootResult {
|
|
509
|
+
backendId: string;
|
|
510
|
+
ok: boolean;
|
|
511
|
+
/** 该根原本的 instanceId(用于如实汇报“从什么改成什么”)。 */
|
|
512
|
+
before?: string;
|
|
513
|
+
reason?: string;
|
|
514
|
+
}
|
|
515
|
+
interface SetGroupInstanceIdResult {
|
|
516
|
+
ok: boolean;
|
|
517
|
+
instanceId?: string;
|
|
518
|
+
reason?: string;
|
|
519
|
+
/** 各根的处理结果(`rewriteRoots: true` 时逐条返回)。 */
|
|
520
|
+
roots: GroupInstanceIdRootResult[];
|
|
521
|
+
}
|
|
438
522
|
interface SyncGroupHandle {
|
|
439
523
|
readonly groupId: string;
|
|
440
524
|
readonly appId: string;
|
|
@@ -452,6 +536,31 @@ interface SyncGroupHandle {
|
|
|
452
536
|
backendId: string;
|
|
453
537
|
reason: string;
|
|
454
538
|
}[];
|
|
539
|
+
/**
|
|
540
|
+
* 归属冲突的完整信息(含两侧 kind / id / instanceId 与可执行的对齐动作)。
|
|
541
|
+
* UI 应展示这些字段让用户判断,而不是只给一句“不一致”。
|
|
542
|
+
*/
|
|
543
|
+
listBackendConflicts(): BackendConflictInfo[];
|
|
544
|
+
/**
|
|
545
|
+
* 用户确认后解决某个后端的归属冲突。
|
|
546
|
+
* 调用方负责二次确认,并在成功后重新连接/刷新(本组实例需要重新 init)。
|
|
547
|
+
*/
|
|
548
|
+
resolveBackendConflict(backendId: string, mode: BackendConflictResolution): Promise<BackendConflictResolutionResult>;
|
|
549
|
+
/**
|
|
550
|
+
* 本组 `instanceId` 的全部候选(本地 / 引导副本 / 每个远端根)。
|
|
551
|
+
* 不一致时界面必须让用户挑一个,不允许代码静默择一。
|
|
552
|
+
*/
|
|
553
|
+
getIdentityCandidates(): IdentityCandidate[];
|
|
554
|
+
/**
|
|
555
|
+
* 候选之间是否互相矛盾(需要用户在界面上拍板)。
|
|
556
|
+
* 可选:老版本实现可能没有这个方法,调用方按候选去重自行判断。
|
|
557
|
+
*/
|
|
558
|
+
isIdentityUnsettled?(): boolean;
|
|
559
|
+
/**
|
|
560
|
+
* 用户确认后的唯一写入口:把本组身份设成指定值。
|
|
561
|
+
* `rewriteRoots: true` 时一并把本组所有 kind/id 相同的根统一成该值。
|
|
562
|
+
*/
|
|
563
|
+
setGroupInstanceId(instanceId: string, options?: SetGroupInstanceIdOptions): Promise<SetGroupInstanceIdResult>;
|
|
455
564
|
/**
|
|
456
565
|
* Direct fs view of the group root. `.config/` is hidden (config-sync
|
|
457
566
|
* territory); sync bookkeeping under `.meta/` (tombstones / versions /
|
|
@@ -1023,8 +1132,14 @@ declare class ConfigRepo implements IConfigRepo {
|
|
|
1023
1132
|
* `instanceId`,不一致就不建同步对 —— 两个不同的同步组永不互相同步。
|
|
1024
1133
|
*/
|
|
1025
1134
|
private instanceId?;
|
|
1135
|
+
/** 配置组身份的候选(本地 + 每个后端根),供界面展示。 */
|
|
1136
|
+
private identityCandidates;
|
|
1137
|
+
/** 候选互相矛盾:需要用户裁决,绝不由库层自动择一。 */
|
|
1138
|
+
private configIdentityUnsettled;
|
|
1026
1139
|
/** 因归属他人而被跳过的后端 id → 原因,供 UI 展示。 */
|
|
1027
1140
|
private skippedBackends;
|
|
1141
|
+
/** 归属冲突的完整信息(两侧 kind / id / instanceId + 可执行动作)。 */
|
|
1142
|
+
private backendConflicts;
|
|
1028
1143
|
/** Last known backend descriptors, for the synchronous unified handle API. */
|
|
1029
1144
|
private backendDescriptorCache;
|
|
1030
1145
|
/**
|
|
@@ -1342,10 +1457,24 @@ declare class ConfigRepo implements IConfigRepo {
|
|
|
1342
1457
|
* 并就地写回 —— 只写一次,之后字节相同不再落盘。
|
|
1343
1458
|
*/
|
|
1344
1459
|
private ensureGroupIdentity;
|
|
1460
|
+
/**
|
|
1461
|
+
* 只读收集配置组身份的候选:本地描述符 + 每个已注册后端根的 `group.json`。
|
|
1462
|
+
* 只看 `kind` / `id` 与本组一致的根;读失败的根不参与裁决(不猜)。
|
|
1463
|
+
*/
|
|
1464
|
+
private collectConfigIdentityCandidates;
|
|
1345
1465
|
/** 组实例身份(未初始化时先兜底生成并落盘)。 */
|
|
1346
1466
|
ensureGroupInstanceId(): Promise<string>;
|
|
1347
1467
|
/** 组实例身份(同步读取;init 之前可能为 `undefined`)。 */
|
|
1348
1468
|
getGroupInstanceId(): string | undefined;
|
|
1469
|
+
/** 配置组的身份候选:本地描述符 + 已注册后端根上的值。 */
|
|
1470
|
+
getIdentityCandidates(): IdentityCandidate[];
|
|
1471
|
+
/** 候选是否互相矛盾(界面据此要求用户拍板)。 */
|
|
1472
|
+
isIdentityUnsettled(): boolean;
|
|
1473
|
+
/**
|
|
1474
|
+
* 用户确认后的唯一写入口(配置组)。
|
|
1475
|
+
* `rewriteRoots` 为真时把每个副本根的 `/meta/group.json` 统一成该值。
|
|
1476
|
+
*/
|
|
1477
|
+
setGroupInstanceId(instanceId: string, options?: SetGroupInstanceIdOptions): Promise<SetGroupInstanceIdResult>;
|
|
1349
1478
|
/**
|
|
1350
1479
|
* 连接远端前校验归属:属于别的组 → `conflict`(调用方必须跳过、不建同步对)。
|
|
1351
1480
|
* 老仓库(无 instanceId)会被本组认领。
|
|
@@ -1356,6 +1485,10 @@ declare class ConfigRepo implements IConfigRepo {
|
|
|
1356
1485
|
backendId: string;
|
|
1357
1486
|
reason: string;
|
|
1358
1487
|
}[];
|
|
1488
|
+
/** 归属冲突的完整信息(配置组也会被别的组占用同一个根)。 */
|
|
1489
|
+
listBackendConflicts(): BackendConflictInfo[];
|
|
1490
|
+
/** 用户确认后解决配置组某个后端的归属冲突。 */
|
|
1491
|
+
resolveBackendConflict(backendId: string, mode: BackendConflictResolution): Promise<BackendConflictResolutionResult>;
|
|
1359
1492
|
/** Write the group-type marker file if it doesn't exist. */
|
|
1360
1493
|
ensureGroupType(type: SyncGroupType): Promise<void>;
|
|
1361
1494
|
/** Read the group-type marker. Returns null if not set (new path, then legacy). */
|
|
@@ -1403,6 +1536,7 @@ declare class ConfigRepo implements IConfigRepo {
|
|
|
1403
1536
|
updateAppDataGroupDescriptor(id: string, backends: AppDataBackendDescriptor[], meta?: {
|
|
1404
1537
|
name?: string;
|
|
1405
1538
|
features?: Partial<SyncGroupFeatures>;
|
|
1539
|
+
instanceId?: string;
|
|
1406
1540
|
}): Promise<void>;
|
|
1407
1541
|
/**
|
|
1408
1542
|
* Change a data-sync group's display name only. `id`, backends, local stores
|
|
@@ -1610,6 +1744,127 @@ declare function localSyncStoreNames(appId: string, groupIds?: string[]): string
|
|
|
1610
1744
|
*/
|
|
1611
1745
|
declare function purgeLocalSyncConfig(appId: string, options?: PurgeLocalSyncConfigOptions): Promise<PurgeLocalSyncConfigResult>;
|
|
1612
1746
|
|
|
1747
|
+
/**
|
|
1748
|
+
* zen-fs-config — Group Identity (sync boundary)
|
|
1749
|
+
*
|
|
1750
|
+
* 每个同步组有一个不可变的实例身份(`instanceId`,UUID)。它写在两处:
|
|
1751
|
+
*
|
|
1752
|
+
* - 组自己的 `/.meta/group.json`(随同步走,因此每个副本都带着它);
|
|
1753
|
+
* - 引导副本 `.config/app-data-groups/{appId}/{id}.json`(配置组登记,新设备
|
|
1754
|
+
* 在还没连上任何数据后端时就知道该组声明的身份)。
|
|
1755
|
+
*
|
|
1756
|
+
* 规则:**连接任何远端之前,先读对方的 `/.meta/group.json`**。
|
|
1757
|
+
* - 对方带着同一个实例身份 → 同一组,允许建立同步对;
|
|
1758
|
+
* - 对方还没有实例身份(老仓库)→ 由当前组认领并写入,之后固定归属;
|
|
1759
|
+
* - 对方带着另一个实例身份 → **不建立同步对**,该后端被跳过并告警。
|
|
1760
|
+
*
|
|
1761
|
+
* 这就是「不同的同步组之间不能同步」的落地点:跨组不是靠路径隔离,而是靠
|
|
1762
|
+
* 连接前拒绝建对。
|
|
1763
|
+
*/
|
|
1764
|
+
|
|
1765
|
+
/** 远端根当前归属的判定结果。 */
|
|
1766
|
+
type RemoteIdentityState =
|
|
1767
|
+
/** 远端根属于本组(实例身份一致)。 */
|
|
1768
|
+
'match'
|
|
1769
|
+
/** 远端根原先没有实例身份,本次由本组认领并写入。 */
|
|
1770
|
+
| 'claimed'
|
|
1771
|
+
/** 远端根属于另一个同步组 —— 必须跳过,不能建同步对。 */
|
|
1772
|
+
| 'conflict';
|
|
1773
|
+
/** 冲突的细分原因:三类身份的哪一项不一致。 */
|
|
1774
|
+
type IdentityConflictReason =
|
|
1775
|
+
/** `kind` 不同(配置组 vs 数据组)。 */
|
|
1776
|
+
'kind-mismatch'
|
|
1777
|
+
/** 同为一种 kind,但组 id 不同(同一远端根被另一个逻辑组占用)。 */
|
|
1778
|
+
| 'id-mismatch'
|
|
1779
|
+
/** kind 与 id 都相同,但实例身份(instanceId)不同。 */
|
|
1780
|
+
| 'instance-mismatch'
|
|
1781
|
+
/** 远端描述符读不到(网络 / 权限),无法判断归属。 */
|
|
1782
|
+
| 'unreadable'
|
|
1783
|
+
/** 认领写入失败(远端只读 / 无权限)。 */
|
|
1784
|
+
| 'claim-failed';
|
|
1785
|
+
/** 本组身份:kind + 显示用 id + 不可变实例身份。 */
|
|
1786
|
+
interface GroupIdentity {
|
|
1787
|
+
kind: SyncGroupKind;
|
|
1788
|
+
id: string;
|
|
1789
|
+
instanceId: string;
|
|
1790
|
+
name?: string;
|
|
1791
|
+
/** 组能力位;认领老仓库时一并写入,避免与本地描述符产生字节差异。 */
|
|
1792
|
+
features?: GroupDescriptor['features'];
|
|
1793
|
+
}
|
|
1794
|
+
/** 生成一个新的组实例身份(UUID v4)。 */
|
|
1795
|
+
declare function newGroupInstanceId(): string;
|
|
1796
|
+
/** 只接受 UUID v4 形态,避免把任意字符串当成身份写进会被同步的内容。 */
|
|
1797
|
+
declare function isValidGroupInstanceId(value: unknown): value is string;
|
|
1798
|
+
/**
|
|
1799
|
+
* 读远端根的归属,必要时认领。
|
|
1800
|
+
*
|
|
1801
|
+
* @param remoteFS 远端后端的文件系统(未 chroot 的根)
|
|
1802
|
+
* @param identity 本组身份
|
|
1803
|
+
*/
|
|
1804
|
+
declare function bindRemoteGroupIdentity(remoteFS: any, identity: GroupIdentity): Promise<RemoteIdentityState>;
|
|
1805
|
+
/** 远端 `group.json` 的可见字段(用于在界面上把三方身份都摆出来)。 */
|
|
1806
|
+
interface RemoteIdentitySnapshot {
|
|
1807
|
+
kind?: SyncGroupKind;
|
|
1808
|
+
id?: string;
|
|
1809
|
+
instanceId?: string;
|
|
1810
|
+
name?: string;
|
|
1811
|
+
}
|
|
1812
|
+
/** 归属校验的完整结果:既给判定,也给两侧身份,UI 可以直接展示与决策。 */
|
|
1813
|
+
interface IdentityBindingResult {
|
|
1814
|
+
state: RemoteIdentityState;
|
|
1815
|
+
/** 远端当前描述符(空仓库 / 读不到时为 null)。 */
|
|
1816
|
+
remote: RemoteIdentitySnapshot | null;
|
|
1817
|
+
local: GroupIdentity;
|
|
1818
|
+
conflict?: IdentityConflictReason;
|
|
1819
|
+
/** 远端读不到(网络 / 权限),区别于“空仓库”。 */
|
|
1820
|
+
unreadable?: boolean;
|
|
1821
|
+
error?: string;
|
|
1822
|
+
}
|
|
1823
|
+
/** `kind=config · id=config · 实例 ID 665532a0…` 这类一行摘要。 */
|
|
1824
|
+
declare function summarizeIdentity(identity: {
|
|
1825
|
+
kind?: string;
|
|
1826
|
+
id?: string;
|
|
1827
|
+
instanceId?: string;
|
|
1828
|
+
} | null | undefined): string;
|
|
1829
|
+
/** instanceId 前 8 位,仅用于展示(永不作为比较依据)。 */
|
|
1830
|
+
declare function shortInstanceId(instanceId: string): string;
|
|
1831
|
+
/**
|
|
1832
|
+
* 归属校验的详细版:返回 `match` / `claimed` / `conflict` 以及两侧完整身份。
|
|
1833
|
+
*
|
|
1834
|
+
* 判定顺序(决定界面上的“原因”文案):
|
|
1835
|
+
* 1. 远端描述符读不到 → conflict(unreadable);
|
|
1836
|
+
* 2. `kind` 不同 → conflict(kind-mismatch);
|
|
1837
|
+
* 3. 远端有实例身份:与本地一致 → match;不一致 → conflict(
|
|
1838
|
+
* 本地 id 与远端不同 ? id-mismatch : instance-mismatch );
|
|
1839
|
+
* 4. 远端无身份(老仓库)→ 认领(保留远端已有的 kind/id/name)。
|
|
1840
|
+
*/
|
|
1841
|
+
declare function bindRemoteGroupIdentityDetailed(remoteFS: any, identity: GroupIdentity,
|
|
1842
|
+
/** 已读到的远端描述符(`null` = 已确认空仓库);`undefined` = 未读,函数自己读。 */
|
|
1843
|
+
prefetched?: GroupDescriptor | null): Promise<IdentityBindingResult>;
|
|
1844
|
+
/** 冲突解决动作。 */
|
|
1845
|
+
type IdentityResolutionMode =
|
|
1846
|
+
/** 只把本地实例身份对齐成远端的 instanceId(要求 kind 与 id 相同)。 */
|
|
1847
|
+
'adopt-remote-instance'
|
|
1848
|
+
/** 把远端 `group.json` 改写成本组的 kind/id/instanceId(要求 kind 相同)。 */
|
|
1849
|
+
| 'rewrite-remote-identity';
|
|
1850
|
+
interface IdentityResolutionResult {
|
|
1851
|
+
mode: IdentityResolutionMode;
|
|
1852
|
+
ok: boolean;
|
|
1853
|
+
reason?: string;
|
|
1854
|
+
/** adopt-remote-instance 成功后应落盘到本地的 instanceId。 */
|
|
1855
|
+
instanceId?: string;
|
|
1856
|
+
remote?: RemoteIdentitySnapshot | null;
|
|
1857
|
+
}
|
|
1858
|
+
/**
|
|
1859
|
+
* 用户确认后的身份对齐(绝不静默执行)。
|
|
1860
|
+
*
|
|
1861
|
+
* - `adopt-remote-instance`:仅当远端 kind/id 与本组完全一致时,把远端 instanceId
|
|
1862
|
+
* 当作本组身份(本地库名、引导副本路径不变,无损)。
|
|
1863
|
+
* - `rewrite-remote-identity`:仅当 kind 相同时,把远端 `group.json` 改写成本组
|
|
1864
|
+
* 身份;会影响到共享同一个远端根的其它副本,调用方必须先警告用户。
|
|
1865
|
+
*/
|
|
1866
|
+
declare function resolveRemoteIdentity(remoteFS: any, identity: GroupIdentity, mode: IdentityResolutionMode): Promise<IdentityResolutionResult>;
|
|
1867
|
+
|
|
1613
1868
|
/**
|
|
1614
1869
|
* zen-fs-config — Unified Connect Entry Point
|
|
1615
1870
|
*
|
|
@@ -1866,4 +2121,4 @@ declare class ConflictStore {
|
|
|
1866
2121
|
resolve(conflictId: string, mergedContent: string | Uint8Array): Promise<void>;
|
|
1867
2122
|
}
|
|
1868
2123
|
|
|
1869
|
-
export { type AppDataBackendDescriptor, type AppDataGroup, type AppDataGroupDescriptor, type BackendDescriptor, type BackendFactory, type BackendInstance, type BackendMetadata, type BackendParamDef, type BackendSyncState, type BackendsMeta, CONFIG_DIR, CONFLICTS_DIR, type CacheOptions, ConfigRepo, type ConfigRepoOptions, type ConfigSerializer, type ConfigSyncGroupDescriptor, type ConfigSyncGroupHandle, type ConflictArchive, type ConflictInfo, ConflictStore, type ConnectOptions, type ConnectResult, DATA_GROUP_DEFAULT_FEATURES, FolderStore, GROUP_DESCRIPTOR_FILE, type GroupDescriptor, type IConfigRepo, type KeepPurgeResult, LEGACY_CONFLICTS_DIR, LEGACY_TOMBSTONES_DIR, LOCAL_IDB_BACKEND_ID, LOCAL_STORAGE_UNAVAILABLE, type LocalStorageUnavailableDetails, LocalStorageUnavailableError, type LocalStoreDeletionResult, META_DIR, type MigrateLocalFS, type MigrateReplicaFS, type MtimePurgeResult, type PurgeKeepOptions, type PurgeLocalSyncConfigOptions, type PurgeLocalSyncConfigResult, type PurgeMtimeOptions, type PurgeableFS$1 as PurgeableFS, type SyncGroupFeatures, type SyncGroupHandle, type SyncGroupKind, type SyncGroupType, TOMBSTONES_DIR, type TombstoneMeta, TombstoneStore, VERSIONS_DIR, type VersionMeta, type VersionMigrationOptions, type VersionMigrationResult, VersionStore, configKeyToFilePath, connect, createBackend, createConfigRepo, createSerializerChain, dataGroupLocalStoreName, deleteDataGroupLocalStore, deleteIndexedDbStore, encodeMetaPath, getAccountFields, getBackendMetadata, getExtension, hasBackend, incrementVersion, isBrowserEnv, isKeepFile, isLocalStorageUnavailableError, isMtimeSidecar, legacyVersionPathFor, listBackendMetadata, listBackends, localPrimaryType, localSyncStoreNames, mergeAccountFields, migrateVersionSidecars, purgeKeepFiles, purgeLocalSyncConfig, purgeMtimeSidecars, readGroupDescriptor, readVersion, registerBackend, registerFolderBackend, resolveLocalPrimary, sha256, unregisterBackend, verifyOrRepairVersion, versionPathFor, wrapZenFSFileSystem, writeGroupDescriptor, writeVersion };
|
|
2124
|
+
export { type AppDataBackendDescriptor, type AppDataGroup, type AppDataGroupDescriptor, type BackendConflictInfo, type BackendConflictReason, type BackendConflictResolution, type BackendConflictResolutionResult, type BackendDescriptor, type BackendFactory, type BackendInstance, type BackendMetadata, type BackendParamDef, type BackendSyncState, type BackendsMeta, CONFIG_DIR, CONFLICTS_DIR, type CacheOptions, ConfigRepo, type ConfigRepoOptions, type ConfigSerializer, type ConfigSyncGroupDescriptor, type ConfigSyncGroupHandle, type ConflictArchive, type ConflictInfo, ConflictStore, type ConnectOptions, type ConnectResult, DATA_GROUP_DEFAULT_FEATURES, FolderStore, GROUP_DESCRIPTOR_FILE, type GroupDescriptor, type GroupIdentity, type GroupInstanceIdRootResult, type IConfigRepo, type IdentityBindingResult, type IdentityCandidate, type IdentityCandidateSource, type IdentityConflictReason, type IdentityResolutionMode, type IdentityResolutionResult, type KeepPurgeResult, LEGACY_CONFLICTS_DIR, LEGACY_TOMBSTONES_DIR, LOCAL_IDB_BACKEND_ID, LOCAL_STORAGE_UNAVAILABLE, type LocalStorageUnavailableDetails, LocalStorageUnavailableError, type LocalStoreDeletionResult, META_DIR, type MigrateLocalFS, type MigrateReplicaFS, type MtimePurgeResult, type PurgeKeepOptions, type PurgeLocalSyncConfigOptions, type PurgeLocalSyncConfigResult, type PurgeMtimeOptions, type PurgeableFS$1 as PurgeableFS, type RemoteIdentitySnapshot, type RemoteIdentityState, type SetGroupInstanceIdOptions, type SetGroupInstanceIdResult, type SyncGroupFeatures, type SyncGroupHandle, type SyncGroupKind, type SyncGroupType, TOMBSTONES_DIR, type TombstoneMeta, TombstoneStore, VERSIONS_DIR, type VersionMeta, type VersionMigrationOptions, type VersionMigrationResult, VersionStore, bindRemoteGroupIdentity, bindRemoteGroupIdentityDetailed, configKeyToFilePath, connect, createBackend, createConfigRepo, createSerializerChain, dataGroupLocalStoreName, deleteDataGroupLocalStore, deleteIndexedDbStore, encodeMetaPath, getAccountFields, getBackendMetadata, getExtension, hasBackend, incrementVersion, isBrowserEnv, isKeepFile, isLocalStorageUnavailableError, isMtimeSidecar, isValidGroupInstanceId, legacyVersionPathFor, listBackendMetadata, listBackends, localPrimaryType, localSyncStoreNames, mergeAccountFields, migrateVersionSidecars, newGroupInstanceId, purgeKeepFiles, purgeLocalSyncConfig, purgeMtimeSidecars, readGroupDescriptor, readVersion, registerBackend, registerFolderBackend, resolveLocalPrimary, resolveRemoteIdentity, sha256, shortInstanceId, summarizeIdentity, unregisterBackend, verifyOrRepairVersion, versionPathFor, wrapZenFSFileSystem, writeGroupDescriptor, writeVersion };
|
package/dist/index.d.ts
CHANGED
|
@@ -435,6 +435,90 @@ interface GroupDescriptor {
|
|
|
435
435
|
* `/nodes`、`/shared`。
|
|
436
436
|
* 两个能力位互不蕴含。
|
|
437
437
|
*/
|
|
438
|
+
/** 归属冲突的细分原因。 */
|
|
439
|
+
type BackendConflictReason = 'kind-mismatch' | 'id-mismatch' | 'instance-mismatch' | 'unreadable' | 'claim-failed';
|
|
440
|
+
/**
|
|
441
|
+
* 一个后端与远端根归属冲突的完整信息。
|
|
442
|
+
*
|
|
443
|
+
* `kind` / `id` / `instanceId` 三者用途不同,必须同时展示:
|
|
444
|
+
* - `kind`:组类型(config / data);
|
|
445
|
+
* - `id`:组 id(同时决定本地库名与引导副本路径);
|
|
446
|
+
* - `instanceId`:组实例身份(UUID,判定“这个远端根归谁”)。
|
|
447
|
+
*/
|
|
448
|
+
interface BackendConflictInfo {
|
|
449
|
+
backendId: string;
|
|
450
|
+
/** 一句话原因(已含两侧身份摘要,可直接展示)。 */
|
|
451
|
+
reason: string;
|
|
452
|
+
conflict?: BackendConflictReason;
|
|
453
|
+
/** 远端根的现状;空仓库或读不到时为 null。 */
|
|
454
|
+
remote: {
|
|
455
|
+
kind?: SyncGroupKind;
|
|
456
|
+
id?: string;
|
|
457
|
+
instanceId?: string;
|
|
458
|
+
name?: string;
|
|
459
|
+
} | null;
|
|
460
|
+
/** 本组身份。 */
|
|
461
|
+
local: {
|
|
462
|
+
kind: SyncGroupKind;
|
|
463
|
+
id: string;
|
|
464
|
+
instanceId?: string;
|
|
465
|
+
};
|
|
466
|
+
/** 允许“只把本地 instanceId 对齐到远端”(要求 kind 与 id 都相同)。 */
|
|
467
|
+
canAdoptRemoteInstance: boolean;
|
|
468
|
+
/** 允许“把远端 group.json 改写成本组身份”(要求 kind 相同;会影响共享该根的副本)。 */
|
|
469
|
+
canRewriteRemoteIdentity: boolean;
|
|
470
|
+
unreadable?: boolean;
|
|
471
|
+
error?: string;
|
|
472
|
+
}
|
|
473
|
+
/** 用户确认后的冲突解决动作。 */
|
|
474
|
+
type BackendConflictResolution = 'adopt-remote-instance' | 'rewrite-remote-identity';
|
|
475
|
+
interface BackendConflictResolutionResult {
|
|
476
|
+
mode: BackendConflictResolution;
|
|
477
|
+
ok: boolean;
|
|
478
|
+
reason?: string;
|
|
479
|
+
/** adopt-remote-instance 成功后应落盘的本地 instanceId。 */
|
|
480
|
+
instanceId?: string;
|
|
481
|
+
}
|
|
482
|
+
/** `instanceId` 的候选来源:本地描述符 / 共享引导副本 / 某个远端根。 */
|
|
483
|
+
type IdentityCandidateSource = 'local' | 'bootstrap' | 'remote';
|
|
484
|
+
/**
|
|
485
|
+
* 一条身份候选。同一值可能被多个根持有,用 `rootCount` 表示。
|
|
486
|
+
* 界面必须把它们全部列出,由用户决定本组最终使用哪个值。
|
|
487
|
+
*/
|
|
488
|
+
interface IdentityCandidate {
|
|
489
|
+
source: IdentityCandidateSource;
|
|
490
|
+
/** 远端候选对应的后端 id(local / bootstrap 无此字段)。 */
|
|
491
|
+
backendId?: string;
|
|
492
|
+
instanceId: string;
|
|
493
|
+
/** 持有该值的根数量(local / bootstrap 为 1)。 */
|
|
494
|
+
rootCount: number;
|
|
495
|
+
/** 该值所属的 kind / id;与本组不一致的候选已在收集阶段被排除。 */
|
|
496
|
+
kind?: SyncGroupKind;
|
|
497
|
+
id?: string;
|
|
498
|
+
}
|
|
499
|
+
/** 用户决定本组实例身份时的选项。 */
|
|
500
|
+
interface SetGroupInstanceIdOptions {
|
|
501
|
+
/**
|
|
502
|
+
* 同时把本组所有 `kind` / `id` 相同的远端根统一成该值(默认 false)。
|
|
503
|
+
* 这是唯一会改写远端 `group.json` 的路径,必须由用户确认后调用。
|
|
504
|
+
*/
|
|
505
|
+
rewriteRoots?: boolean;
|
|
506
|
+
}
|
|
507
|
+
/** 逐个远端根的写回结果。 */
|
|
508
|
+
interface GroupInstanceIdRootResult {
|
|
509
|
+
backendId: string;
|
|
510
|
+
ok: boolean;
|
|
511
|
+
/** 该根原本的 instanceId(用于如实汇报“从什么改成什么”)。 */
|
|
512
|
+
before?: string;
|
|
513
|
+
reason?: string;
|
|
514
|
+
}
|
|
515
|
+
interface SetGroupInstanceIdResult {
|
|
516
|
+
ok: boolean;
|
|
517
|
+
instanceId?: string;
|
|
518
|
+
reason?: string;
|
|
519
|
+
/** 各根的处理结果(`rewriteRoots: true` 时逐条返回)。 */
|
|
520
|
+
roots: GroupInstanceIdRootResult[];
|
|
521
|
+
}
|
|
438
522
|
interface SyncGroupHandle {
|
|
439
523
|
readonly groupId: string;
|
|
440
524
|
readonly appId: string;
|
|
@@ -452,6 +536,31 @@ interface SyncGroupHandle {
|
|
|
452
536
|
backendId: string;
|
|
453
537
|
reason: string;
|
|
454
538
|
}[];
|
|
539
|
+
/**
|
|
540
|
+
* 归属冲突的完整信息(含两侧 kind / id / instanceId 与可执行的对齐动作)。
|
|
541
|
+
* UI 应展示这些字段让用户判断,而不是只给一句“不一致”。
|
|
542
|
+
*/
|
|
543
|
+
listBackendConflicts(): BackendConflictInfo[];
|
|
544
|
+
/**
|
|
545
|
+
* 用户确认后解决某个后端的归属冲突。
|
|
546
|
+
* 调用方负责二次确认,并在成功后重新连接/刷新(本组实例需要重新 init)。
|
|
547
|
+
*/
|
|
548
|
+
resolveBackendConflict(backendId: string, mode: BackendConflictResolution): Promise<BackendConflictResolutionResult>;
|
|
549
|
+
/**
|
|
550
|
+
* 本组 `instanceId` 的全部候选(本地 / 引导副本 / 每个远端根)。
|
|
551
|
+
* 不一致时界面必须让用户挑一个,不允许代码静默择一。
|
|
552
|
+
*/
|
|
553
|
+
getIdentityCandidates(): IdentityCandidate[];
|
|
554
|
+
/**
|
|
555
|
+
* 候选之间是否互相矛盾(需要用户在界面上拍板)。
|
|
556
|
+
* 可选:老版本实现可能没有这个方法,调用方按候选去重自行判断。
|
|
557
|
+
*/
|
|
558
|
+
isIdentityUnsettled?(): boolean;
|
|
559
|
+
/**
|
|
560
|
+
* 用户确认后的唯一写入口:把本组身份设成指定值。
|
|
561
|
+
* `rewriteRoots: true` 时一并把本组所有 kind/id 相同的根统一成该值。
|
|
562
|
+
*/
|
|
563
|
+
setGroupInstanceId(instanceId: string, options?: SetGroupInstanceIdOptions): Promise<SetGroupInstanceIdResult>;
|
|
455
564
|
/**
|
|
456
565
|
* Direct fs view of the group root. `.config/` is hidden (config-sync
|
|
457
566
|
* territory); sync bookkeeping under `.meta/` (tombstones / versions /
|
|
@@ -1023,8 +1132,14 @@ declare class ConfigRepo implements IConfigRepo {
|
|
|
1023
1132
|
* `instanceId`,不一致就不建同步对 —— 两个不同的同步组永不互相同步。
|
|
1024
1133
|
*/
|
|
1025
1134
|
private instanceId?;
|
|
1135
|
+
/** 配置组身份的候选(本地 + 每个后端根),供界面展示。 */
|
|
1136
|
+
private identityCandidates;
|
|
1137
|
+
/** 候选互相矛盾:需要用户裁决,绝不由库层自动择一。 */
|
|
1138
|
+
private configIdentityUnsettled;
|
|
1026
1139
|
/** 因归属他人而被跳过的后端 id → 原因,供 UI 展示。 */
|
|
1027
1140
|
private skippedBackends;
|
|
1141
|
+
/** 归属冲突的完整信息(两侧 kind / id / instanceId + 可执行动作)。 */
|
|
1142
|
+
private backendConflicts;
|
|
1028
1143
|
/** Last known backend descriptors, for the synchronous unified handle API. */
|
|
1029
1144
|
private backendDescriptorCache;
|
|
1030
1145
|
/**
|
|
@@ -1342,10 +1457,24 @@ declare class ConfigRepo implements IConfigRepo {
|
|
|
1342
1457
|
* 并就地写回 —— 只写一次,之后字节相同不再落盘。
|
|
1343
1458
|
*/
|
|
1344
1459
|
private ensureGroupIdentity;
|
|
1460
|
+
/**
|
|
1461
|
+
* 只读收集配置组身份的候选:本地描述符 + 每个已注册后端根的 `group.json`。
|
|
1462
|
+
* 只看 `kind` / `id` 与本组一致的根;读失败的根不参与裁决(不猜)。
|
|
1463
|
+
*/
|
|
1464
|
+
private collectConfigIdentityCandidates;
|
|
1345
1465
|
/** 组实例身份(未初始化时先兜底生成并落盘)。 */
|
|
1346
1466
|
ensureGroupInstanceId(): Promise<string>;
|
|
1347
1467
|
/** 组实例身份(同步读取;init 之前可能为 `undefined`)。 */
|
|
1348
1468
|
getGroupInstanceId(): string | undefined;
|
|
1469
|
+
/** 配置组的身份候选:本地描述符 + 已注册后端根上的值。 */
|
|
1470
|
+
getIdentityCandidates(): IdentityCandidate[];
|
|
1471
|
+
/** 候选是否互相矛盾(界面据此要求用户拍板)。 */
|
|
1472
|
+
isIdentityUnsettled(): boolean;
|
|
1473
|
+
/**
|
|
1474
|
+
* 用户确认后的唯一写入口(配置组)。
|
|
1475
|
+
* `rewriteRoots` 为真时把每个副本根的 `/meta/group.json` 统一成该值。
|
|
1476
|
+
*/
|
|
1477
|
+
setGroupInstanceId(instanceId: string, options?: SetGroupInstanceIdOptions): Promise<SetGroupInstanceIdResult>;
|
|
1349
1478
|
/**
|
|
1350
1479
|
* 连接远端前校验归属:属于别的组 → `conflict`(调用方必须跳过、不建同步对)。
|
|
1351
1480
|
* 老仓库(无 instanceId)会被本组认领。
|
|
@@ -1356,6 +1485,10 @@ declare class ConfigRepo implements IConfigRepo {
|
|
|
1356
1485
|
backendId: string;
|
|
1357
1486
|
reason: string;
|
|
1358
1487
|
}[];
|
|
1488
|
+
/** 归属冲突的完整信息(配置组也会被别的组占用同一个根)。 */
|
|
1489
|
+
listBackendConflicts(): BackendConflictInfo[];
|
|
1490
|
+
/** 用户确认后解决配置组某个后端的归属冲突。 */
|
|
1491
|
+
resolveBackendConflict(backendId: string, mode: BackendConflictResolution): Promise<BackendConflictResolutionResult>;
|
|
1359
1492
|
/** Write the group-type marker file if it doesn't exist. */
|
|
1360
1493
|
ensureGroupType(type: SyncGroupType): Promise<void>;
|
|
1361
1494
|
/** Read the group-type marker. Returns null if not set (new path, then legacy). */
|
|
@@ -1403,6 +1536,7 @@ declare class ConfigRepo implements IConfigRepo {
|
|
|
1403
1536
|
updateAppDataGroupDescriptor(id: string, backends: AppDataBackendDescriptor[], meta?: {
|
|
1404
1537
|
name?: string;
|
|
1405
1538
|
features?: Partial<SyncGroupFeatures>;
|
|
1539
|
+
instanceId?: string;
|
|
1406
1540
|
}): Promise<void>;
|
|
1407
1541
|
/**
|
|
1408
1542
|
* Change a data-sync group's display name only. `id`, backends, local stores
|
|
@@ -1610,6 +1744,127 @@ declare function localSyncStoreNames(appId: string, groupIds?: string[]): string
|
|
|
1610
1744
|
*/
|
|
1611
1745
|
declare function purgeLocalSyncConfig(appId: string, options?: PurgeLocalSyncConfigOptions): Promise<PurgeLocalSyncConfigResult>;
|
|
1612
1746
|
|
|
1747
|
+
/**
|
|
1748
|
+
* zen-fs-config — Group Identity (sync boundary)
|
|
1749
|
+
*
|
|
1750
|
+
* 每个同步组有一个不可变的实例身份(`instanceId`,UUID)。它写在两处:
|
|
1751
|
+
*
|
|
1752
|
+
* - 组自己的 `/.meta/group.json`(随同步走,因此每个副本都带着它);
|
|
1753
|
+
* - 引导副本 `.config/app-data-groups/{appId}/{id}.json`(配置组登记,新设备
|
|
1754
|
+
* 在还没连上任何数据后端时就知道该组声明的身份)。
|
|
1755
|
+
*
|
|
1756
|
+
* 规则:**连接任何远端之前,先读对方的 `/.meta/group.json`**。
|
|
1757
|
+
* - 对方带着同一个实例身份 → 同一组,允许建立同步对;
|
|
1758
|
+
* - 对方还没有实例身份(老仓库)→ 由当前组认领并写入,之后固定归属;
|
|
1759
|
+
* - 对方带着另一个实例身份 → **不建立同步对**,该后端被跳过并告警。
|
|
1760
|
+
*
|
|
1761
|
+
* 这就是「不同的同步组之间不能同步」的落地点:跨组不是靠路径隔离,而是靠
|
|
1762
|
+
* 连接前拒绝建对。
|
|
1763
|
+
*/
|
|
1764
|
+
|
|
1765
|
+
/** 远端根当前归属的判定结果。 */
|
|
1766
|
+
type RemoteIdentityState =
|
|
1767
|
+
/** 远端根属于本组(实例身份一致)。 */
|
|
1768
|
+
'match'
|
|
1769
|
+
/** 远端根原先没有实例身份,本次由本组认领并写入。 */
|
|
1770
|
+
| 'claimed'
|
|
1771
|
+
/** 远端根属于另一个同步组 —— 必须跳过,不能建同步对。 */
|
|
1772
|
+
| 'conflict';
|
|
1773
|
+
/** 冲突的细分原因:三类身份的哪一项不一致。 */
|
|
1774
|
+
type IdentityConflictReason =
|
|
1775
|
+
/** `kind` 不同(配置组 vs 数据组)。 */
|
|
1776
|
+
'kind-mismatch'
|
|
1777
|
+
/** 同为一种 kind,但组 id 不同(同一远端根被另一个逻辑组占用)。 */
|
|
1778
|
+
| 'id-mismatch'
|
|
1779
|
+
/** kind 与 id 都相同,但实例身份(instanceId)不同。 */
|
|
1780
|
+
| 'instance-mismatch'
|
|
1781
|
+
/** 远端描述符读不到(网络 / 权限),无法判断归属。 */
|
|
1782
|
+
| 'unreadable'
|
|
1783
|
+
/** 认领写入失败(远端只读 / 无权限)。 */
|
|
1784
|
+
| 'claim-failed';
|
|
1785
|
+
/** 本组身份:kind + 显示用 id + 不可变实例身份。 */
|
|
1786
|
+
interface GroupIdentity {
|
|
1787
|
+
kind: SyncGroupKind;
|
|
1788
|
+
id: string;
|
|
1789
|
+
instanceId: string;
|
|
1790
|
+
name?: string;
|
|
1791
|
+
/** 组能力位;认领老仓库时一并写入,避免与本地描述符产生字节差异。 */
|
|
1792
|
+
features?: GroupDescriptor['features'];
|
|
1793
|
+
}
|
|
1794
|
+
/** 生成一个新的组实例身份(UUID v4)。 */
|
|
1795
|
+
declare function newGroupInstanceId(): string;
|
|
1796
|
+
/** 只接受 UUID v4 形态,避免把任意字符串当成身份写进会被同步的内容。 */
|
|
1797
|
+
declare function isValidGroupInstanceId(value: unknown): value is string;
|
|
1798
|
+
/**
|
|
1799
|
+
* 读远端根的归属,必要时认领。
|
|
1800
|
+
*
|
|
1801
|
+
* @param remoteFS 远端后端的文件系统(未 chroot 的根)
|
|
1802
|
+
* @param identity 本组身份
|
|
1803
|
+
*/
|
|
1804
|
+
declare function bindRemoteGroupIdentity(remoteFS: any, identity: GroupIdentity): Promise<RemoteIdentityState>;
|
|
1805
|
+
/** 远端 `group.json` 的可见字段(用于在界面上把三方身份都摆出来)。 */
|
|
1806
|
+
interface RemoteIdentitySnapshot {
|
|
1807
|
+
kind?: SyncGroupKind;
|
|
1808
|
+
id?: string;
|
|
1809
|
+
instanceId?: string;
|
|
1810
|
+
name?: string;
|
|
1811
|
+
}
|
|
1812
|
+
/** 归属校验的完整结果:既给判定,也给两侧身份,UI 可以直接展示与决策。 */
|
|
1813
|
+
interface IdentityBindingResult {
|
|
1814
|
+
state: RemoteIdentityState;
|
|
1815
|
+
/** 远端当前描述符(空仓库 / 读不到时为 null)。 */
|
|
1816
|
+
remote: RemoteIdentitySnapshot | null;
|
|
1817
|
+
local: GroupIdentity;
|
|
1818
|
+
conflict?: IdentityConflictReason;
|
|
1819
|
+
/** 远端读不到(网络 / 权限),区别于“空仓库”。 */
|
|
1820
|
+
unreadable?: boolean;
|
|
1821
|
+
error?: string;
|
|
1822
|
+
}
|
|
1823
|
+
/** `kind=config · id=config · 实例 ID 665532a0…` 这类一行摘要。 */
|
|
1824
|
+
declare function summarizeIdentity(identity: {
|
|
1825
|
+
kind?: string;
|
|
1826
|
+
id?: string;
|
|
1827
|
+
instanceId?: string;
|
|
1828
|
+
} | null | undefined): string;
|
|
1829
|
+
/** instanceId 前 8 位,仅用于展示(永不作为比较依据)。 */
|
|
1830
|
+
declare function shortInstanceId(instanceId: string): string;
|
|
1831
|
+
/**
|
|
1832
|
+
* 归属校验的详细版:返回 `match` / `claimed` / `conflict` 以及两侧完整身份。
|
|
1833
|
+
*
|
|
1834
|
+
* 判定顺序(决定界面上的“原因”文案):
|
|
1835
|
+
* 1. 远端描述符读不到 → conflict(unreadable);
|
|
1836
|
+
* 2. `kind` 不同 → conflict(kind-mismatch);
|
|
1837
|
+
* 3. 远端有实例身份:与本地一致 → match;不一致 → conflict(
|
|
1838
|
+
* 本地 id 与远端不同 ? id-mismatch : instance-mismatch );
|
|
1839
|
+
* 4. 远端无身份(老仓库)→ 认领(保留远端已有的 kind/id/name)。
|
|
1840
|
+
*/
|
|
1841
|
+
declare function bindRemoteGroupIdentityDetailed(remoteFS: any, identity: GroupIdentity,
|
|
1842
|
+
/** 已读到的远端描述符(`null` = 已确认空仓库);`undefined` = 未读,函数自己读。 */
|
|
1843
|
+
prefetched?: GroupDescriptor | null): Promise<IdentityBindingResult>;
|
|
1844
|
+
/** 冲突解决动作。 */
|
|
1845
|
+
type IdentityResolutionMode =
|
|
1846
|
+
/** 只把本地实例身份对齐成远端的 instanceId(要求 kind 与 id 相同)。 */
|
|
1847
|
+
'adopt-remote-instance'
|
|
1848
|
+
/** 把远端 `group.json` 改写成本组的 kind/id/instanceId(要求 kind 相同)。 */
|
|
1849
|
+
| 'rewrite-remote-identity';
|
|
1850
|
+
interface IdentityResolutionResult {
|
|
1851
|
+
mode: IdentityResolutionMode;
|
|
1852
|
+
ok: boolean;
|
|
1853
|
+
reason?: string;
|
|
1854
|
+
/** adopt-remote-instance 成功后应落盘到本地的 instanceId。 */
|
|
1855
|
+
instanceId?: string;
|
|
1856
|
+
remote?: RemoteIdentitySnapshot | null;
|
|
1857
|
+
}
|
|
1858
|
+
/**
|
|
1859
|
+
* 用户确认后的身份对齐(绝不静默执行)。
|
|
1860
|
+
*
|
|
1861
|
+
* - `adopt-remote-instance`:仅当远端 kind/id 与本组完全一致时,把远端 instanceId
|
|
1862
|
+
* 当作本组身份(本地库名、引导副本路径不变,无损)。
|
|
1863
|
+
* - `rewrite-remote-identity`:仅当 kind 相同时,把远端 `group.json` 改写成本组
|
|
1864
|
+
* 身份;会影响到共享同一个远端根的其它副本,调用方必须先警告用户。
|
|
1865
|
+
*/
|
|
1866
|
+
declare function resolveRemoteIdentity(remoteFS: any, identity: GroupIdentity, mode: IdentityResolutionMode): Promise<IdentityResolutionResult>;
|
|
1867
|
+
|
|
1613
1868
|
/**
|
|
1614
1869
|
* zen-fs-config — Unified Connect Entry Point
|
|
1615
1870
|
*
|
|
@@ -1866,4 +2121,4 @@ declare class ConflictStore {
|
|
|
1866
2121
|
resolve(conflictId: string, mergedContent: string | Uint8Array): Promise<void>;
|
|
1867
2122
|
}
|
|
1868
2123
|
|
|
1869
|
-
export { type AppDataBackendDescriptor, type AppDataGroup, type AppDataGroupDescriptor, type BackendDescriptor, type BackendFactory, type BackendInstance, type BackendMetadata, type BackendParamDef, type BackendSyncState, type BackendsMeta, CONFIG_DIR, CONFLICTS_DIR, type CacheOptions, ConfigRepo, type ConfigRepoOptions, type ConfigSerializer, type ConfigSyncGroupDescriptor, type ConfigSyncGroupHandle, type ConflictArchive, type ConflictInfo, ConflictStore, type ConnectOptions, type ConnectResult, DATA_GROUP_DEFAULT_FEATURES, FolderStore, GROUP_DESCRIPTOR_FILE, type GroupDescriptor, type IConfigRepo, type KeepPurgeResult, LEGACY_CONFLICTS_DIR, LEGACY_TOMBSTONES_DIR, LOCAL_IDB_BACKEND_ID, LOCAL_STORAGE_UNAVAILABLE, type LocalStorageUnavailableDetails, LocalStorageUnavailableError, type LocalStoreDeletionResult, META_DIR, type MigrateLocalFS, type MigrateReplicaFS, type MtimePurgeResult, type PurgeKeepOptions, type PurgeLocalSyncConfigOptions, type PurgeLocalSyncConfigResult, type PurgeMtimeOptions, type PurgeableFS$1 as PurgeableFS, type SyncGroupFeatures, type SyncGroupHandle, type SyncGroupKind, type SyncGroupType, TOMBSTONES_DIR, type TombstoneMeta, TombstoneStore, VERSIONS_DIR, type VersionMeta, type VersionMigrationOptions, type VersionMigrationResult, VersionStore, configKeyToFilePath, connect, createBackend, createConfigRepo, createSerializerChain, dataGroupLocalStoreName, deleteDataGroupLocalStore, deleteIndexedDbStore, encodeMetaPath, getAccountFields, getBackendMetadata, getExtension, hasBackend, incrementVersion, isBrowserEnv, isKeepFile, isLocalStorageUnavailableError, isMtimeSidecar, legacyVersionPathFor, listBackendMetadata, listBackends, localPrimaryType, localSyncStoreNames, mergeAccountFields, migrateVersionSidecars, purgeKeepFiles, purgeLocalSyncConfig, purgeMtimeSidecars, readGroupDescriptor, readVersion, registerBackend, registerFolderBackend, resolveLocalPrimary, sha256, unregisterBackend, verifyOrRepairVersion, versionPathFor, wrapZenFSFileSystem, writeGroupDescriptor, writeVersion };
|
|
2124
|
+
export { type AppDataBackendDescriptor, type AppDataGroup, type AppDataGroupDescriptor, type BackendConflictInfo, type BackendConflictReason, type BackendConflictResolution, type BackendConflictResolutionResult, type BackendDescriptor, type BackendFactory, type BackendInstance, type BackendMetadata, type BackendParamDef, type BackendSyncState, type BackendsMeta, CONFIG_DIR, CONFLICTS_DIR, type CacheOptions, ConfigRepo, type ConfigRepoOptions, type ConfigSerializer, type ConfigSyncGroupDescriptor, type ConfigSyncGroupHandle, type ConflictArchive, type ConflictInfo, ConflictStore, type ConnectOptions, type ConnectResult, DATA_GROUP_DEFAULT_FEATURES, FolderStore, GROUP_DESCRIPTOR_FILE, type GroupDescriptor, type GroupIdentity, type GroupInstanceIdRootResult, type IConfigRepo, type IdentityBindingResult, type IdentityCandidate, type IdentityCandidateSource, type IdentityConflictReason, type IdentityResolutionMode, type IdentityResolutionResult, type KeepPurgeResult, LEGACY_CONFLICTS_DIR, LEGACY_TOMBSTONES_DIR, LOCAL_IDB_BACKEND_ID, LOCAL_STORAGE_UNAVAILABLE, type LocalStorageUnavailableDetails, LocalStorageUnavailableError, type LocalStoreDeletionResult, META_DIR, type MigrateLocalFS, type MigrateReplicaFS, type MtimePurgeResult, type PurgeKeepOptions, type PurgeLocalSyncConfigOptions, type PurgeLocalSyncConfigResult, type PurgeMtimeOptions, type PurgeableFS$1 as PurgeableFS, type RemoteIdentitySnapshot, type RemoteIdentityState, type SetGroupInstanceIdOptions, type SetGroupInstanceIdResult, type SyncGroupFeatures, type SyncGroupHandle, type SyncGroupKind, type SyncGroupType, TOMBSTONES_DIR, type TombstoneMeta, TombstoneStore, VERSIONS_DIR, type VersionMeta, type VersionMigrationOptions, type VersionMigrationResult, VersionStore, bindRemoteGroupIdentity, bindRemoteGroupIdentityDetailed, configKeyToFilePath, connect, createBackend, createConfigRepo, createSerializerChain, dataGroupLocalStoreName, deleteDataGroupLocalStore, deleteIndexedDbStore, encodeMetaPath, getAccountFields, getBackendMetadata, getExtension, hasBackend, incrementVersion, isBrowserEnv, isKeepFile, isLocalStorageUnavailableError, isMtimeSidecar, isValidGroupInstanceId, legacyVersionPathFor, listBackendMetadata, listBackends, localPrimaryType, localSyncStoreNames, mergeAccountFields, migrateVersionSidecars, newGroupInstanceId, purgeKeepFiles, purgeLocalSyncConfig, purgeMtimeSidecars, readGroupDescriptor, readVersion, registerBackend, registerFolderBackend, resolveLocalPrimary, resolveRemoteIdentity, sha256, shortInstanceId, summarizeIdentity, unregisterBackend, verifyOrRepairVersion, versionPathFor, wrapZenFSFileSystem, writeGroupDescriptor, writeVersion };
|