zen-fs-config 0.9.8 → 0.10.1

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/DESIGN.md CHANGED
@@ -136,7 +136,8 @@ group wiring instead of syncing the marker.
136
136
  │ │ └─ ...
137
137
  │ ├─ app-data-groups/ References to data-sync groups (per app)
138
138
  │ │ └─ {appId}/
139
- │ │ └─ {dataGroupId}.json { groupType: "data-sync", backends: [...] }
139
+ │ │ └─ {dataGroupId}.json { groupType: "data-sync", ... }(无 backends)
140
+ │ │ └─ backends/{backendId}.json 应用后端,一文件一端点
140
141
  │ ├─ .deleted/ Tombstones for deletion propagation
141
142
  │ │ └─ {encoded-path}.json
142
143
  │ └─ .conflicts/ Conflict archives (safekeeping)
package/dist/index.d.mts CHANGED
@@ -291,6 +291,14 @@ interface ConfigRepoOptions {
291
291
  folderPath?: string;
292
292
  /** Node identifier. Auto-detected if not provided (see DESIGN.md §8.2). */
293
293
  nodeId?: string;
294
+ /**
295
+ * 配置组的 profile 名。缺省 `config`。
296
+ *
297
+ * 身份按 profile 确定性派生(`config:<profile>`),所以多个应用共享同一个
298
+ * 配置组时,只要 profile 与远端根相同,各端算出的 instanceId 都相同。
299
+ * 一个远端根只能承载一个 profile。
300
+ */
301
+ profile?: string;
294
302
  /**
295
303
  * Cache configuration for replica backends.
296
304
  *
@@ -380,6 +388,12 @@ interface AppDataGroupDescriptor {
380
388
  instanceId?: string;
381
389
  /** Capability overrides (versions/conflicts are opt-in for data groups). */
382
390
  features?: Partial<SyncGroupFeatures>;
391
+ /**
392
+ * @deprecated 不再写入描述符文件:后端改存独立文件
393
+ * `/.config/app-data-groups/<appId>/backends/<backendId>.json`。
394
+ * 读取时仍兼容旧描述符里的数组,并会在首次加载时迁移成文件。
395
+ * 运行时 API 返回的对象仍带这份列表,方便调用方直接使用。
396
+ */
383
397
  backends: AppDataBackendDescriptor[];
384
398
  }
385
399
  /** Descriptor for the config-sync group itself (display metadata only). */
@@ -471,6 +485,13 @@ interface GroupDescriptor {
471
485
  instanceId?: string;
472
486
  /** User-editable display name. */
473
487
  name?: string;
488
+ /**
489
+ * 配置组的 profile 名(仅 `kind=config`)。缺省 `config`。
490
+ *
491
+ * 一个远端根只承载一个 profile;身份按 profile 派生,因此多个应用共享同一个
492
+ * 配置组(同一 profile、同一远端根)时算出的 instanceId 天然一致。
493
+ */
494
+ profile?: string;
474
495
  features?: Partial<SyncGroupFeatures>;
475
496
  /**
476
497
  * @deprecated 不再写入、读取侧忽略。时间戳写进随同步走的内容会形成
@@ -478,6 +499,27 @@ interface GroupDescriptor {
478
499
  */
479
500
  updatedAt?: number;
480
501
  }
502
+ /**
503
+ * `.meta/aliases/{instanceId}.json` — 共享远端根上的成员别名。
504
+ *
505
+ * 一个远端根只有一个 canonical 身份(`.meta/group.json` 的 `instanceId`)。
506
+ * 其它应用的数据组可以显式加入同一个根:各自保留自己的 `instanceId`,
507
+ * 在该根写一份 alias 文件。绑定阶段同时认 canonical 与 alias,因此不同
508
+ * `appId` / 不同 `groupId` 的组可以共享同一份数据,而不会互相改写身份。
509
+ *
510
+ * alias 文件必须一实例一文件:所有成员并发加入时各写各的文件,不存在
511
+ * read-modify-write 覆盖;`.meta/group.json` 始终由 canonical 组持有。
512
+ */
513
+ interface GroupAliasDescriptor {
514
+ schemaVersion: 2;
515
+ kind: 'data';
516
+ /** 成员组自己的 id(canonical 组的 id 不在这里)。 */
517
+ id: string;
518
+ /** 成员组自己的实例身份,同时是文件名。 */
519
+ instanceId: string;
520
+ /** 成员所属应用,仅用于界面展示与排查。 */
521
+ appId?: string;
522
+ }
481
523
  /**
482
524
  * One sync group = a local primary store + zero-or-more remote replicas +
483
525
  * the shared `.meta/` metadata area + that group's own backend definitions.
@@ -523,17 +565,29 @@ interface BackendConflictInfo {
523
565
  canAdoptRemoteInstance: boolean;
524
566
  /** 允许“把远端 group.json 改写成本组身份”(要求 kind 相同;会影响共享该根的副本)。 */
525
567
  canRewriteRemoteIdentity: boolean;
568
+ /**
569
+ * 允许“作为 alias 加入这个共享根”:远端已有 data 身份,本组身份也有效。
570
+ *
571
+ * 加入只写本组自己的 `.meta/aliases/{instanceId}.json`,不改远端
572
+ * `.meta/group.json`;canonical 组不受影响。必须由用户显式确认后调用
573
+ * `resolveBackendConflict(..., 'join-shared-root')`。
574
+ */
575
+ canJoinSharedRoot?: boolean;
526
576
  unreadable?: boolean;
527
577
  error?: string;
528
578
  }
529
579
  /** 用户确认后的冲突解决动作。 */
530
- type BackendConflictResolution = 'adopt-remote-instance' | 'rewrite-remote-identity';
580
+ type BackendConflictResolution = 'adopt-remote-instance' | 'rewrite-remote-identity'
581
+ /** 把本组身份写进远端 `.meta/aliases/`,加入已有数据根(不改 group.json)。 */
582
+ | 'join-shared-root';
531
583
  interface BackendConflictResolutionResult {
532
584
  mode: BackendConflictResolution;
533
585
  ok: boolean;
534
586
  reason?: string;
535
587
  /** adopt-remote-instance 成功后应落盘的本地 instanceId。 */
536
588
  instanceId?: string;
589
+ /** join-shared-root 成功后写入的 alias 实例身份。 */
590
+ aliasInstanceId?: string;
537
591
  }
538
592
  /** `instanceId` 的候选来源:本地描述符 / 共享引导副本 / 某个远端根。 */
539
593
  type IdentityCandidateSource = 'local' | 'bootstrap' | 'remote';
@@ -712,6 +766,11 @@ interface ConnectOptions {
712
766
  folderPath?: string;
713
767
  /** Node identifier. Auto-detected if not provided. */
714
768
  nodeId?: string;
769
+ /**
770
+ * 配置组的 profile 名。缺省 `config`(见 `GroupDescriptor.profile`)。
771
+ * 只影响配置组的确定性身份,不改变任何目录结构。
772
+ */
773
+ profile?: string;
715
774
  /**
716
775
  * Cache configuration for replica backends. Omit for the default
717
776
  * (`IdbCacheStore`, persists across reloads); pass `false` to disable; pass a
@@ -915,6 +974,12 @@ interface IConfigRepo {
915
974
  createAppDataGroup(id: string, backends: AppDataBackendDescriptor[], options?: {
916
975
  name?: string;
917
976
  features?: Partial<SyncGroupFeatures>;
977
+ /**
978
+ * 允许创建时先接入一个已被其它数据组占用的远端根:不在这里抛错,
979
+ * 由绑定阶段把冲突交给 UI,用户确认 `join-shared-root` 后再写 alias。
980
+ * 只放行 data/data 同端点;配置组或读不到身份仍然拒绝。
981
+ */
982
+ allowSharedRoot?: boolean;
918
983
  }): Promise<AppDataGroup>;
919
984
  /** Get an existing data-sync group handle. */
920
985
  getAppDataGroup(id: string): Promise<AppDataGroup>;
@@ -1297,6 +1362,13 @@ declare class ConfigRepo implements IConfigRepo {
1297
1362
  * `instanceId`,不一致就不建同步对 —— 两个不同的同步组永不互相同步。
1298
1363
  */
1299
1364
  private instanceId?;
1365
+ /**
1366
+ * 配置组的 profile 名(缺省 `config`)。身份按它确定性派生;
1367
+ * 一个远端根只承载一个 profile,因此不改变任何目录结构。
1368
+ */
1369
+ private profile;
1370
+ /** 调用方是否显式传了 profile(否则沿用描述符里的值)。 */
1371
+ private profileExplicit;
1300
1372
  /** 配置组身份的候选(本地 + 每个后端根),供界面展示。 */
1301
1373
  private identityCandidates;
1302
1374
  /** 候选互相矛盾:需要用户裁决,绝不由库层自动择一。 */
@@ -1321,7 +1393,7 @@ declare class ConfigRepo implements IConfigRepo {
1321
1393
  * preventing concurrent syncEngine.syncAll() calls.
1322
1394
  */
1323
1395
  private initialSyncPromise;
1324
- constructor(appId: string, nodeId: string, primaryBackendId: string, cachedFS: MinimalAsyncFS, serializer: PathAwareSerializer, onConflict?: (conflict: ConflictInfo) => Promise<unknown | null>, pollIntervalMs?: number, cacheOptions?: CacheOptions);
1396
+ constructor(appId: string, nodeId: string, primaryBackendId: string, cachedFS: MinimalAsyncFS, serializer: PathAwareSerializer, onConflict?: (conflict: ConflictInfo) => Promise<unknown | null>, pollIntervalMs?: number, cacheOptions?: CacheOptions, profile?: string);
1325
1397
  /** Full path to this node's directory on the primary backend. */
1326
1398
  get nodePath(): string;
1327
1399
  /** Number of replica backends registered (excludes the local primary). */
@@ -1733,6 +1805,40 @@ declare class ConfigRepo implements IConfigRepo {
1733
1805
  * 因此时间戳差异不会让两台设备互相覆盖。
1734
1806
  */
1735
1807
  private writeAppDataGroupDescriptorFile;
1808
+ /**
1809
+ * 应用数据组后端文件目录(平铺,不额外套 `<groupId>.backends/`):
1810
+ * `/.config/app-data-groups/<appId>/backends/`。
1811
+ *
1812
+ * 归属靠文件内的 `groupId` 字段区分:同一 app 下不同组即使后端 id 相同,
1813
+ * 也各用各自的文件,不会在同步时互相覆盖(同一组不同端点同理)。
1814
+ */
1815
+ private appDataBackendsDirPath;
1816
+ private appDataBackendFilePath;
1817
+ /** 读本 app 目录下所有后端文件(忽略损坏/非本格式的文件)。 */
1818
+ private readAppDataBackendFiles;
1819
+ /** 读某个数据组声明的全部后端文件(按 id 去重,先到先得)。 */
1820
+ private readAppDataBackendFilesForGroup;
1821
+ /** 幂等写一个后端文件(`createdAt` 取 min,避免两节点互覆盖时间戳)。 */
1822
+ private writeAppDataBackendFile;
1823
+ /**
1824
+ * 用权威后端列表重写本组的后端文件:缺的补齐、多的删除(删除走墓碑)。
1825
+ * 目录是平铺共享的,只处理 `groupId` 属于本组的文件,别组文件不碰。
1826
+ */
1827
+ private reconcileAppDataBackendFiles;
1828
+ /**
1829
+ * 读组后端:新布局(独立文件)优先;旧描述符里还带 `backends` 数组时,
1830
+ * 迁移成文件并回写描述符(去掉数组),让两种布局收敛到同一种。
1831
+ */
1832
+ private resolveAppDataGroupBackends;
1833
+ /**
1834
+ * 由端点指纹派生后端 id:同类型 + 同身份参数(不含 token)→ 同 id。
1835
+ *
1836
+ * 不再混入 groupId:共享同一个远端根的几个应用组,必须落到同一个
1837
+ * `.meta/backends/{id}.json`,否则每个组都会把对方的 backend 当自己的候选,
1838
+ * 在同一根上建出重复同步对。不同组指向同一端点本来就会被共享根校验拦下,
1839
+ * 因此去掉 groupId 不会让非共享组发生文件名碰撞。
1840
+ */
1841
+ private deriveAppDataBackendId;
1736
1842
  /**
1737
1843
  * Resolve a backend descriptor's options by merging account fields
1738
1844
  * from the referenced config-sync backend (if accountBackendId is set).
@@ -1759,6 +1865,7 @@ declare class ConfigRepo implements IConfigRepo {
1759
1865
  createAppDataGroup(id: string, backends: AppDataBackendDescriptor[], options?: {
1760
1866
  name?: string;
1761
1867
  features?: Partial<SyncGroupFeatures>;
1868
+ allowSharedRoot?: boolean;
1762
1869
  }): Promise<AppDataGroup>;
1763
1870
  /**
1764
1871
  * Rewrite an app data group's **bootstrap copy** at
@@ -2052,14 +2159,37 @@ interface GroupIdentity {
2052
2159
  kind: SyncGroupKind;
2053
2160
  id: string;
2054
2161
  instanceId: string;
2162
+ /** 数据组所属应用,写入 alias 文件时用于展示;配置组忽略。 */
2163
+ appId?: string;
2055
2164
  name?: string;
2056
2165
  /** 组能力位;认领老仓库时一并写入,避免与本地描述符产生字节差异。 */
2057
2166
  features?: GroupDescriptor['features'];
2058
2167
  }
2059
2168
  /** 生成一个新的组实例身份(UUID v4)。 */
2060
2169
  declare function newGroupInstanceId(): string;
2061
- /** 只接受 UUID v4 形态,避免把任意字符串当成身份写进会被同步的内容。 */
2170
+ /** 只接受 UUID 形态(v4 随机 / v5 确定性都合法),避免把任意字符串当成身份写进会被同步的内容。 */
2062
2171
  declare function isValidGroupInstanceId(value: unknown): value is string;
2172
+ /** 派生身份的输入:配置组用 `profile`,数据组用 `appId + groupId`。 */
2173
+ interface DerivedIdentityInput {
2174
+ /** 配置组:profile 名(缺省 `config`);数据组忽略。 */
2175
+ profile?: string;
2176
+ /** 数据组:应用 id;配置组忽略。 */
2177
+ appId?: string;
2178
+ /** 数据组:组 id;配置组忽略。 */
2179
+ groupId?: string;
2180
+ }
2181
+ /**
2182
+ * 确定性组身份(UUID v5)。
2183
+ *
2184
+ * 规则(与 GROUP-IDENTITY-INIT 的「第一期」一致):
2185
+ * - 配置组:`config:${profile}`(profile 缺省 `config`),因此同一个远端根
2186
+ * 无论被哪台设备、哪个应用先连上,算出来的身份都相同,不需要再「认领」;
2187
+ * - 数据组:`data:${appId}:${groupId}`,不同应用的 `default` 不会撞在一起。
2188
+ *
2189
+ * 只在「本地 / 引导副本 / 所有远端根都没有身份」且确实有后端需要认领时使用;
2190
+ * 已有身份(含历史随机 UUID)一律沿用,绝不改写。
2191
+ */
2192
+ declare function deriveGroupInstanceId(kind: SyncGroupKind, input?: DerivedIdentityInput): string;
2063
2193
  /**
2064
2194
  * 读远端根的归属,必要时认领。
2065
2195
  *
@@ -2081,6 +2211,8 @@ interface IdentityBindingResult {
2081
2211
  remote: RemoteIdentitySnapshot | null;
2082
2212
  local: GroupIdentity;
2083
2213
  conflict?: IdentityConflictReason;
2214
+ /** 命中方式:canonical(group.json)或 alias(.meta/aliases)。 */
2215
+ matchedVia?: 'canonical' | 'alias';
2084
2216
  /** 远端读不到(网络 / 权限),区别于“空仓库”。 */
2085
2217
  unreadable?: boolean;
2086
2218
  error?: string;
@@ -2116,13 +2248,17 @@ type IdentityResolutionMode =
2116
2248
  /** 只把本地实例身份对齐成远端的 instanceId(要求 kind 与 id 相同)。 */
2117
2249
  'adopt-remote-instance'
2118
2250
  /** 把远端 `group.json` 改写成本组的 kind/id/instanceId(要求 kind 相同)。 */
2119
- | 'rewrite-remote-identity';
2251
+ | 'rewrite-remote-identity'
2252
+ /** 把本组写成远端根的 alias 成员,保留两侧身份,不改 `group.json`。 */
2253
+ | 'join-shared-root';
2120
2254
  interface IdentityResolutionResult {
2121
2255
  mode: IdentityResolutionMode;
2122
2256
  ok: boolean;
2123
2257
  reason?: string;
2124
2258
  /** adopt-remote-instance 成功后应落盘到本地的 instanceId。 */
2125
2259
  instanceId?: string;
2260
+ /** join-shared-root 成功后写入的 alias 实例身份。 */
2261
+ aliasInstanceId?: string;
2126
2262
  remote?: RemoteIdentitySnapshot | null;
2127
2263
  }
2128
2264
  /**
@@ -2459,6 +2595,11 @@ declare function verifyOrRepairVersion(fs: SyncableFS, configFilePath: string, a
2459
2595
  declare const META_DIR = "/.meta";
2460
2596
  declare const GROUP_DESCRIPTOR_FILE = "/.meta/group.json";
2461
2597
  declare const TOMBSTONES_DIR = "/.meta/tombstones";
2598
+ /**
2599
+ * 共享远端根的成员别名目录。一个 alias 一个文件,按 instanceId 命名。
2600
+ * 与 `group.json` 分开,避免多个应用并发加入时 read-modify-write 丢成员。
2601
+ */
2602
+ declare const ALIASES_DIR = "/.meta/aliases";
2462
2603
  /**
2463
2604
  * 历史归档目录。仅作为常量保留(旧数据仍在远端,按普通内容对待):
2464
2605
  * 既不读取也不写入,删除状态只以 {@link TOMBSTONES_DIR} 为准。
@@ -2493,6 +2634,23 @@ declare function readGroupDescriptor(fs: MetaFS): Promise<GroupDescriptor | null
2493
2634
  * 的无限回环)。
2494
2635
  */
2495
2636
  declare function writeGroupDescriptor(fs: MetaFS, descriptor: GroupDescriptor): Promise<void>;
2637
+ /** alias 文件名直接使用 instanceId,必须先校验 UUID,避免路径逃逸。 */
2638
+ declare function groupAliasFilePath(instanceId: string): string;
2639
+ /** Read one alias by instanceId. Missing/corrupt returns null. */
2640
+ declare function readGroupAlias(fs: MetaFS, instanceId: string): Promise<GroupAliasDescriptor | null>;
2641
+ /**
2642
+ * Read every alias on a shared root.
2643
+ *
2644
+ * 目录不存在 = 尚未共享,返回空数组;目录存在但个别文件损坏时跳过损坏项,
2645
+ * 不让一个坏 alias 把整个根判成可写。
2646
+ */
2647
+ declare function readGroupAliases(fs: MetaFS): Promise<GroupAliasDescriptor[]>;
2648
+ /**
2649
+ * Write one member alias. Write-once per instanceId:
2650
+ * - 已存在同 instanceId 且 id 相同 → 幂等;
2651
+ * - 已存在同 instanceId 但 id 不同 → 拒绝,绝不覆盖别人的成员记录。
2652
+ */
2653
+ declare function writeGroupAlias(fs: MetaFS, alias: GroupAliasDescriptor): Promise<boolean>;
2496
2654
  interface TombstoneTarget {
2497
2655
  id: string;
2498
2656
  fs: any;
@@ -2725,4 +2883,4 @@ interface EnsureDataGroupResult {
2725
2883
  */
2726
2884
  declare function ensureDataGroup(source: DataGroupSource, appId: string, opts?: EnsureDataGroupOptions): Promise<EnsureDataGroupResult>;
2727
2885
 
2728
- export { type AddBackendResult, type AppDataBackendDescriptor, type AppDataGroup, type AppDataGroupDescriptor, type AppRepo, BackendAlreadyExistsError, type BackendConflictInfo, type BackendConflictReason, type BackendConflictResolution, type BackendConflictResolutionResult, type BackendDescriptor, BackendEndpointConflictError, type BackendFactory, BackendIdentityError, type BackendInstance, type BackendMetadata, type BackendParamDef, type BackendSyncState, type BackendsMeta, CONFIG_DIR, CONFLICTS_DIR, type CacheOptions, type ConfigBackendInput, ConfigNotReadyError, ConfigRepo, type ConfigRepoOptions, type ConfigSerializer, type ConfigSyncGroupDescriptor, type ConfigSyncGroupHandle, type ConflictArchive, type ConflictInfo, ConflictStore, ConnectFailedError, type ConnectOptions, type ConnectResult, ConnectV2Error, type ConnectV2Options, DATA_GROUP_DEFAULT_FEATURES, DATA_GROUP_PREFERENCE_PREFIX, type DataBackendInput, type DataGroup, DataGroupBackendError, type DataGroupCandidate, DataGroupCreateError, type DataGroupFlushResult, type DataGroupInfo, DataGroupNotFoundError, DataGroupOperationError, type DataGroupSource, type DataGroupSyncEvent, type DataGroupSyncProgress, type DataGroupSyncResult, type EnsureDataGroupOptions, type EnsureDataGroupResult, FolderStore, GROUP_DESCRIPTOR_FILE, type GroupDescriptor, type GroupIdentity, type GroupInstanceIdRootResult, type GroupProbeResult, type GroupProbeState, type IConfigRepo, type IdentityBindingResult, type IdentityCandidate, type IdentityCandidateSource, type IdentityConflictReason, type IdentityResolutionMode, type IdentityResolutionResult, InvalidBackendError, 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, NeedsInitError, type PreferenceOptions, type PreferenceStorage, type PurgeKeepOptions, type PurgeLocalSyncConfigOptions, type PurgeLocalSyncConfigResult, type PurgeMtimeOptions, type PurgeableFS$1 as PurgeableFS, type RemoteIdentitySnapshot, type RemoteIdentityState, RemoteUnreachableError, type ReplicaSetupSummary, type ResolveDataGroupOptions, type SetGroupInstanceIdOptions, type SetGroupInstanceIdResult, type SyncGroupFeatures, type SyncGroupHandle, type SyncGroupKind, type SyncGroupSyncEvent, type SyncGroupType, TOMBSTONES_DIR, type TombstoneMeta, TombstoneStore, type UiConnection, VERSIONS_DIR, type VersionMeta, type VersionMigrationOptions, type VersionMigrationResult, VersionStore, bindRemoteGroupIdentity, bindRemoteGroupIdentityDetailed, collectDataGroupCandidates, configKeyToFilePath, connect, connectV2, connectionToAppRepo, createBackend, createConfigRepo, createSerializerChain, dataGroupLocalStoreName, deleteDataGroupLocalStore, deleteIndexedDbStore, encodeMetaPath, ensureDataGroup, getAccountFields, getBackendMetadata, getExtension, getPreferredDataGroupId, getUiConnection, groupHasPath, hasBackend, incrementVersion, isBrowserEnv, isKeepFile, isLocalBackendType, isLocalStorageUnavailableError, isMtimeSidecar, isValidGroupInstanceId, legacyVersionPathFor, listBackendMetadata, listBackends, listDataGroupCandidates, localPrimaryType, localSyncStoreNames, mergeAccountFields, migrateVersionSidecars, newGroupInstanceId, probeGroupTypeDetailed, purgeKeepFiles, purgeLocalSyncConfig, purgeMtimeSidecars, readGroupDescriptor, readVersion, registerBackend, registerFolderBackend, resolveDataGroup, resolveLocalPrimary, resolveRemoteIdentity, setPreferredDataGroupId, sha256, shortInstanceId, summarizeIdentity, unregisterBackend, verifyOrRepairVersion, versionPathFor, wrapZenFSFileSystem, writeGroupDescriptor, writeVersion };
2886
+ export { ALIASES_DIR, type AddBackendResult, type AppDataBackendDescriptor, type AppDataGroup, type AppDataGroupDescriptor, type AppRepo, BackendAlreadyExistsError, type BackendConflictInfo, type BackendConflictReason, type BackendConflictResolution, type BackendConflictResolutionResult, type BackendDescriptor, BackendEndpointConflictError, type BackendFactory, BackendIdentityError, type BackendInstance, type BackendMetadata, type BackendParamDef, type BackendSyncState, type BackendsMeta, CONFIG_DIR, CONFLICTS_DIR, type CacheOptions, type ConfigBackendInput, ConfigNotReadyError, ConfigRepo, type ConfigRepoOptions, type ConfigSerializer, type ConfigSyncGroupDescriptor, type ConfigSyncGroupHandle, type ConflictArchive, type ConflictInfo, ConflictStore, ConnectFailedError, type ConnectOptions, type ConnectResult, ConnectV2Error, type ConnectV2Options, DATA_GROUP_DEFAULT_FEATURES, DATA_GROUP_PREFERENCE_PREFIX, type DataBackendInput, type DataGroup, DataGroupBackendError, type DataGroupCandidate, DataGroupCreateError, type DataGroupFlushResult, type DataGroupInfo, DataGroupNotFoundError, DataGroupOperationError, type DataGroupSource, type DataGroupSyncEvent, type DataGroupSyncProgress, type DataGroupSyncResult, type DerivedIdentityInput, type EnsureDataGroupOptions, type EnsureDataGroupResult, FolderStore, GROUP_DESCRIPTOR_FILE, type GroupAliasDescriptor, type GroupDescriptor, type GroupIdentity, type GroupInstanceIdRootResult, type GroupProbeResult, type GroupProbeState, type IConfigRepo, type IdentityBindingResult, type IdentityCandidate, type IdentityCandidateSource, type IdentityConflictReason, type IdentityResolutionMode, type IdentityResolutionResult, InvalidBackendError, 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, NeedsInitError, type PreferenceOptions, type PreferenceStorage, type PurgeKeepOptions, type PurgeLocalSyncConfigOptions, type PurgeLocalSyncConfigResult, type PurgeMtimeOptions, type PurgeableFS$1 as PurgeableFS, type RemoteIdentitySnapshot, type RemoteIdentityState, RemoteUnreachableError, type ReplicaSetupSummary, type ResolveDataGroupOptions, type SetGroupInstanceIdOptions, type SetGroupInstanceIdResult, type SyncGroupFeatures, type SyncGroupHandle, type SyncGroupKind, type SyncGroupSyncEvent, type SyncGroupType, TOMBSTONES_DIR, type TombstoneMeta, TombstoneStore, type UiConnection, VERSIONS_DIR, type VersionMeta, type VersionMigrationOptions, type VersionMigrationResult, VersionStore, bindRemoteGroupIdentity, bindRemoteGroupIdentityDetailed, collectDataGroupCandidates, configKeyToFilePath, connect, connectV2, connectionToAppRepo, createBackend, createConfigRepo, createSerializerChain, dataGroupLocalStoreName, deleteDataGroupLocalStore, deleteIndexedDbStore, deriveGroupInstanceId, encodeMetaPath, ensureDataGroup, getAccountFields, getBackendMetadata, getExtension, getPreferredDataGroupId, getUiConnection, groupAliasFilePath, groupHasPath, hasBackend, incrementVersion, isBrowserEnv, isKeepFile, isLocalBackendType, isLocalStorageUnavailableError, isMtimeSidecar, isValidGroupInstanceId, legacyVersionPathFor, listBackendMetadata, listBackends, listDataGroupCandidates, localPrimaryType, localSyncStoreNames, mergeAccountFields, migrateVersionSidecars, newGroupInstanceId, probeGroupTypeDetailed, purgeKeepFiles, purgeLocalSyncConfig, purgeMtimeSidecars, readGroupAlias, readGroupAliases, readGroupDescriptor, readVersion, registerBackend, registerFolderBackend, resolveDataGroup, resolveLocalPrimary, resolveRemoteIdentity, setPreferredDataGroupId, sha256, shortInstanceId, summarizeIdentity, unregisterBackend, verifyOrRepairVersion, versionPathFor, wrapZenFSFileSystem, writeGroupAlias, writeGroupDescriptor, writeVersion };
package/dist/index.d.ts CHANGED
@@ -291,6 +291,14 @@ interface ConfigRepoOptions {
291
291
  folderPath?: string;
292
292
  /** Node identifier. Auto-detected if not provided (see DESIGN.md §8.2). */
293
293
  nodeId?: string;
294
+ /**
295
+ * 配置组的 profile 名。缺省 `config`。
296
+ *
297
+ * 身份按 profile 确定性派生(`config:<profile>`),所以多个应用共享同一个
298
+ * 配置组时,只要 profile 与远端根相同,各端算出的 instanceId 都相同。
299
+ * 一个远端根只能承载一个 profile。
300
+ */
301
+ profile?: string;
294
302
  /**
295
303
  * Cache configuration for replica backends.
296
304
  *
@@ -380,6 +388,12 @@ interface AppDataGroupDescriptor {
380
388
  instanceId?: string;
381
389
  /** Capability overrides (versions/conflicts are opt-in for data groups). */
382
390
  features?: Partial<SyncGroupFeatures>;
391
+ /**
392
+ * @deprecated 不再写入描述符文件:后端改存独立文件
393
+ * `/.config/app-data-groups/<appId>/backends/<backendId>.json`。
394
+ * 读取时仍兼容旧描述符里的数组,并会在首次加载时迁移成文件。
395
+ * 运行时 API 返回的对象仍带这份列表,方便调用方直接使用。
396
+ */
383
397
  backends: AppDataBackendDescriptor[];
384
398
  }
385
399
  /** Descriptor for the config-sync group itself (display metadata only). */
@@ -471,6 +485,13 @@ interface GroupDescriptor {
471
485
  instanceId?: string;
472
486
  /** User-editable display name. */
473
487
  name?: string;
488
+ /**
489
+ * 配置组的 profile 名(仅 `kind=config`)。缺省 `config`。
490
+ *
491
+ * 一个远端根只承载一个 profile;身份按 profile 派生,因此多个应用共享同一个
492
+ * 配置组(同一 profile、同一远端根)时算出的 instanceId 天然一致。
493
+ */
494
+ profile?: string;
474
495
  features?: Partial<SyncGroupFeatures>;
475
496
  /**
476
497
  * @deprecated 不再写入、读取侧忽略。时间戳写进随同步走的内容会形成
@@ -478,6 +499,27 @@ interface GroupDescriptor {
478
499
  */
479
500
  updatedAt?: number;
480
501
  }
502
+ /**
503
+ * `.meta/aliases/{instanceId}.json` — 共享远端根上的成员别名。
504
+ *
505
+ * 一个远端根只有一个 canonical 身份(`.meta/group.json` 的 `instanceId`)。
506
+ * 其它应用的数据组可以显式加入同一个根:各自保留自己的 `instanceId`,
507
+ * 在该根写一份 alias 文件。绑定阶段同时认 canonical 与 alias,因此不同
508
+ * `appId` / 不同 `groupId` 的组可以共享同一份数据,而不会互相改写身份。
509
+ *
510
+ * alias 文件必须一实例一文件:所有成员并发加入时各写各的文件,不存在
511
+ * read-modify-write 覆盖;`.meta/group.json` 始终由 canonical 组持有。
512
+ */
513
+ interface GroupAliasDescriptor {
514
+ schemaVersion: 2;
515
+ kind: 'data';
516
+ /** 成员组自己的 id(canonical 组的 id 不在这里)。 */
517
+ id: string;
518
+ /** 成员组自己的实例身份,同时是文件名。 */
519
+ instanceId: string;
520
+ /** 成员所属应用,仅用于界面展示与排查。 */
521
+ appId?: string;
522
+ }
481
523
  /**
482
524
  * One sync group = a local primary store + zero-or-more remote replicas +
483
525
  * the shared `.meta/` metadata area + that group's own backend definitions.
@@ -523,17 +565,29 @@ interface BackendConflictInfo {
523
565
  canAdoptRemoteInstance: boolean;
524
566
  /** 允许“把远端 group.json 改写成本组身份”(要求 kind 相同;会影响共享该根的副本)。 */
525
567
  canRewriteRemoteIdentity: boolean;
568
+ /**
569
+ * 允许“作为 alias 加入这个共享根”:远端已有 data 身份,本组身份也有效。
570
+ *
571
+ * 加入只写本组自己的 `.meta/aliases/{instanceId}.json`,不改远端
572
+ * `.meta/group.json`;canonical 组不受影响。必须由用户显式确认后调用
573
+ * `resolveBackendConflict(..., 'join-shared-root')`。
574
+ */
575
+ canJoinSharedRoot?: boolean;
526
576
  unreadable?: boolean;
527
577
  error?: string;
528
578
  }
529
579
  /** 用户确认后的冲突解决动作。 */
530
- type BackendConflictResolution = 'adopt-remote-instance' | 'rewrite-remote-identity';
580
+ type BackendConflictResolution = 'adopt-remote-instance' | 'rewrite-remote-identity'
581
+ /** 把本组身份写进远端 `.meta/aliases/`,加入已有数据根(不改 group.json)。 */
582
+ | 'join-shared-root';
531
583
  interface BackendConflictResolutionResult {
532
584
  mode: BackendConflictResolution;
533
585
  ok: boolean;
534
586
  reason?: string;
535
587
  /** adopt-remote-instance 成功后应落盘的本地 instanceId。 */
536
588
  instanceId?: string;
589
+ /** join-shared-root 成功后写入的 alias 实例身份。 */
590
+ aliasInstanceId?: string;
537
591
  }
538
592
  /** `instanceId` 的候选来源:本地描述符 / 共享引导副本 / 某个远端根。 */
539
593
  type IdentityCandidateSource = 'local' | 'bootstrap' | 'remote';
@@ -712,6 +766,11 @@ interface ConnectOptions {
712
766
  folderPath?: string;
713
767
  /** Node identifier. Auto-detected if not provided. */
714
768
  nodeId?: string;
769
+ /**
770
+ * 配置组的 profile 名。缺省 `config`(见 `GroupDescriptor.profile`)。
771
+ * 只影响配置组的确定性身份,不改变任何目录结构。
772
+ */
773
+ profile?: string;
715
774
  /**
716
775
  * Cache configuration for replica backends. Omit for the default
717
776
  * (`IdbCacheStore`, persists across reloads); pass `false` to disable; pass a
@@ -915,6 +974,12 @@ interface IConfigRepo {
915
974
  createAppDataGroup(id: string, backends: AppDataBackendDescriptor[], options?: {
916
975
  name?: string;
917
976
  features?: Partial<SyncGroupFeatures>;
977
+ /**
978
+ * 允许创建时先接入一个已被其它数据组占用的远端根:不在这里抛错,
979
+ * 由绑定阶段把冲突交给 UI,用户确认 `join-shared-root` 后再写 alias。
980
+ * 只放行 data/data 同端点;配置组或读不到身份仍然拒绝。
981
+ */
982
+ allowSharedRoot?: boolean;
918
983
  }): Promise<AppDataGroup>;
919
984
  /** Get an existing data-sync group handle. */
920
985
  getAppDataGroup(id: string): Promise<AppDataGroup>;
@@ -1297,6 +1362,13 @@ declare class ConfigRepo implements IConfigRepo {
1297
1362
  * `instanceId`,不一致就不建同步对 —— 两个不同的同步组永不互相同步。
1298
1363
  */
1299
1364
  private instanceId?;
1365
+ /**
1366
+ * 配置组的 profile 名(缺省 `config`)。身份按它确定性派生;
1367
+ * 一个远端根只承载一个 profile,因此不改变任何目录结构。
1368
+ */
1369
+ private profile;
1370
+ /** 调用方是否显式传了 profile(否则沿用描述符里的值)。 */
1371
+ private profileExplicit;
1300
1372
  /** 配置组身份的候选(本地 + 每个后端根),供界面展示。 */
1301
1373
  private identityCandidates;
1302
1374
  /** 候选互相矛盾:需要用户裁决,绝不由库层自动择一。 */
@@ -1321,7 +1393,7 @@ declare class ConfigRepo implements IConfigRepo {
1321
1393
  * preventing concurrent syncEngine.syncAll() calls.
1322
1394
  */
1323
1395
  private initialSyncPromise;
1324
- constructor(appId: string, nodeId: string, primaryBackendId: string, cachedFS: MinimalAsyncFS, serializer: PathAwareSerializer, onConflict?: (conflict: ConflictInfo) => Promise<unknown | null>, pollIntervalMs?: number, cacheOptions?: CacheOptions);
1396
+ constructor(appId: string, nodeId: string, primaryBackendId: string, cachedFS: MinimalAsyncFS, serializer: PathAwareSerializer, onConflict?: (conflict: ConflictInfo) => Promise<unknown | null>, pollIntervalMs?: number, cacheOptions?: CacheOptions, profile?: string);
1325
1397
  /** Full path to this node's directory on the primary backend. */
1326
1398
  get nodePath(): string;
1327
1399
  /** Number of replica backends registered (excludes the local primary). */
@@ -1733,6 +1805,40 @@ declare class ConfigRepo implements IConfigRepo {
1733
1805
  * 因此时间戳差异不会让两台设备互相覆盖。
1734
1806
  */
1735
1807
  private writeAppDataGroupDescriptorFile;
1808
+ /**
1809
+ * 应用数据组后端文件目录(平铺,不额外套 `<groupId>.backends/`):
1810
+ * `/.config/app-data-groups/<appId>/backends/`。
1811
+ *
1812
+ * 归属靠文件内的 `groupId` 字段区分:同一 app 下不同组即使后端 id 相同,
1813
+ * 也各用各自的文件,不会在同步时互相覆盖(同一组不同端点同理)。
1814
+ */
1815
+ private appDataBackendsDirPath;
1816
+ private appDataBackendFilePath;
1817
+ /** 读本 app 目录下所有后端文件(忽略损坏/非本格式的文件)。 */
1818
+ private readAppDataBackendFiles;
1819
+ /** 读某个数据组声明的全部后端文件(按 id 去重,先到先得)。 */
1820
+ private readAppDataBackendFilesForGroup;
1821
+ /** 幂等写一个后端文件(`createdAt` 取 min,避免两节点互覆盖时间戳)。 */
1822
+ private writeAppDataBackendFile;
1823
+ /**
1824
+ * 用权威后端列表重写本组的后端文件:缺的补齐、多的删除(删除走墓碑)。
1825
+ * 目录是平铺共享的,只处理 `groupId` 属于本组的文件,别组文件不碰。
1826
+ */
1827
+ private reconcileAppDataBackendFiles;
1828
+ /**
1829
+ * 读组后端:新布局(独立文件)优先;旧描述符里还带 `backends` 数组时,
1830
+ * 迁移成文件并回写描述符(去掉数组),让两种布局收敛到同一种。
1831
+ */
1832
+ private resolveAppDataGroupBackends;
1833
+ /**
1834
+ * 由端点指纹派生后端 id:同类型 + 同身份参数(不含 token)→ 同 id。
1835
+ *
1836
+ * 不再混入 groupId:共享同一个远端根的几个应用组,必须落到同一个
1837
+ * `.meta/backends/{id}.json`,否则每个组都会把对方的 backend 当自己的候选,
1838
+ * 在同一根上建出重复同步对。不同组指向同一端点本来就会被共享根校验拦下,
1839
+ * 因此去掉 groupId 不会让非共享组发生文件名碰撞。
1840
+ */
1841
+ private deriveAppDataBackendId;
1736
1842
  /**
1737
1843
  * Resolve a backend descriptor's options by merging account fields
1738
1844
  * from the referenced config-sync backend (if accountBackendId is set).
@@ -1759,6 +1865,7 @@ declare class ConfigRepo implements IConfigRepo {
1759
1865
  createAppDataGroup(id: string, backends: AppDataBackendDescriptor[], options?: {
1760
1866
  name?: string;
1761
1867
  features?: Partial<SyncGroupFeatures>;
1868
+ allowSharedRoot?: boolean;
1762
1869
  }): Promise<AppDataGroup>;
1763
1870
  /**
1764
1871
  * Rewrite an app data group's **bootstrap copy** at
@@ -2052,14 +2159,37 @@ interface GroupIdentity {
2052
2159
  kind: SyncGroupKind;
2053
2160
  id: string;
2054
2161
  instanceId: string;
2162
+ /** 数据组所属应用,写入 alias 文件时用于展示;配置组忽略。 */
2163
+ appId?: string;
2055
2164
  name?: string;
2056
2165
  /** 组能力位;认领老仓库时一并写入,避免与本地描述符产生字节差异。 */
2057
2166
  features?: GroupDescriptor['features'];
2058
2167
  }
2059
2168
  /** 生成一个新的组实例身份(UUID v4)。 */
2060
2169
  declare function newGroupInstanceId(): string;
2061
- /** 只接受 UUID v4 形态,避免把任意字符串当成身份写进会被同步的内容。 */
2170
+ /** 只接受 UUID 形态(v4 随机 / v5 确定性都合法),避免把任意字符串当成身份写进会被同步的内容。 */
2062
2171
  declare function isValidGroupInstanceId(value: unknown): value is string;
2172
+ /** 派生身份的输入:配置组用 `profile`,数据组用 `appId + groupId`。 */
2173
+ interface DerivedIdentityInput {
2174
+ /** 配置组:profile 名(缺省 `config`);数据组忽略。 */
2175
+ profile?: string;
2176
+ /** 数据组:应用 id;配置组忽略。 */
2177
+ appId?: string;
2178
+ /** 数据组:组 id;配置组忽略。 */
2179
+ groupId?: string;
2180
+ }
2181
+ /**
2182
+ * 确定性组身份(UUID v5)。
2183
+ *
2184
+ * 规则(与 GROUP-IDENTITY-INIT 的「第一期」一致):
2185
+ * - 配置组:`config:${profile}`(profile 缺省 `config`),因此同一个远端根
2186
+ * 无论被哪台设备、哪个应用先连上,算出来的身份都相同,不需要再「认领」;
2187
+ * - 数据组:`data:${appId}:${groupId}`,不同应用的 `default` 不会撞在一起。
2188
+ *
2189
+ * 只在「本地 / 引导副本 / 所有远端根都没有身份」且确实有后端需要认领时使用;
2190
+ * 已有身份(含历史随机 UUID)一律沿用,绝不改写。
2191
+ */
2192
+ declare function deriveGroupInstanceId(kind: SyncGroupKind, input?: DerivedIdentityInput): string;
2063
2193
  /**
2064
2194
  * 读远端根的归属,必要时认领。
2065
2195
  *
@@ -2081,6 +2211,8 @@ interface IdentityBindingResult {
2081
2211
  remote: RemoteIdentitySnapshot | null;
2082
2212
  local: GroupIdentity;
2083
2213
  conflict?: IdentityConflictReason;
2214
+ /** 命中方式:canonical(group.json)或 alias(.meta/aliases)。 */
2215
+ matchedVia?: 'canonical' | 'alias';
2084
2216
  /** 远端读不到(网络 / 权限),区别于“空仓库”。 */
2085
2217
  unreadable?: boolean;
2086
2218
  error?: string;
@@ -2116,13 +2248,17 @@ type IdentityResolutionMode =
2116
2248
  /** 只把本地实例身份对齐成远端的 instanceId(要求 kind 与 id 相同)。 */
2117
2249
  'adopt-remote-instance'
2118
2250
  /** 把远端 `group.json` 改写成本组的 kind/id/instanceId(要求 kind 相同)。 */
2119
- | 'rewrite-remote-identity';
2251
+ | 'rewrite-remote-identity'
2252
+ /** 把本组写成远端根的 alias 成员,保留两侧身份,不改 `group.json`。 */
2253
+ | 'join-shared-root';
2120
2254
  interface IdentityResolutionResult {
2121
2255
  mode: IdentityResolutionMode;
2122
2256
  ok: boolean;
2123
2257
  reason?: string;
2124
2258
  /** adopt-remote-instance 成功后应落盘到本地的 instanceId。 */
2125
2259
  instanceId?: string;
2260
+ /** join-shared-root 成功后写入的 alias 实例身份。 */
2261
+ aliasInstanceId?: string;
2126
2262
  remote?: RemoteIdentitySnapshot | null;
2127
2263
  }
2128
2264
  /**
@@ -2459,6 +2595,11 @@ declare function verifyOrRepairVersion(fs: SyncableFS, configFilePath: string, a
2459
2595
  declare const META_DIR = "/.meta";
2460
2596
  declare const GROUP_DESCRIPTOR_FILE = "/.meta/group.json";
2461
2597
  declare const TOMBSTONES_DIR = "/.meta/tombstones";
2598
+ /**
2599
+ * 共享远端根的成员别名目录。一个 alias 一个文件,按 instanceId 命名。
2600
+ * 与 `group.json` 分开,避免多个应用并发加入时 read-modify-write 丢成员。
2601
+ */
2602
+ declare const ALIASES_DIR = "/.meta/aliases";
2462
2603
  /**
2463
2604
  * 历史归档目录。仅作为常量保留(旧数据仍在远端,按普通内容对待):
2464
2605
  * 既不读取也不写入,删除状态只以 {@link TOMBSTONES_DIR} 为准。
@@ -2493,6 +2634,23 @@ declare function readGroupDescriptor(fs: MetaFS): Promise<GroupDescriptor | null
2493
2634
  * 的无限回环)。
2494
2635
  */
2495
2636
  declare function writeGroupDescriptor(fs: MetaFS, descriptor: GroupDescriptor): Promise<void>;
2637
+ /** alias 文件名直接使用 instanceId,必须先校验 UUID,避免路径逃逸。 */
2638
+ declare function groupAliasFilePath(instanceId: string): string;
2639
+ /** Read one alias by instanceId. Missing/corrupt returns null. */
2640
+ declare function readGroupAlias(fs: MetaFS, instanceId: string): Promise<GroupAliasDescriptor | null>;
2641
+ /**
2642
+ * Read every alias on a shared root.
2643
+ *
2644
+ * 目录不存在 = 尚未共享,返回空数组;目录存在但个别文件损坏时跳过损坏项,
2645
+ * 不让一个坏 alias 把整个根判成可写。
2646
+ */
2647
+ declare function readGroupAliases(fs: MetaFS): Promise<GroupAliasDescriptor[]>;
2648
+ /**
2649
+ * Write one member alias. Write-once per instanceId:
2650
+ * - 已存在同 instanceId 且 id 相同 → 幂等;
2651
+ * - 已存在同 instanceId 但 id 不同 → 拒绝,绝不覆盖别人的成员记录。
2652
+ */
2653
+ declare function writeGroupAlias(fs: MetaFS, alias: GroupAliasDescriptor): Promise<boolean>;
2496
2654
  interface TombstoneTarget {
2497
2655
  id: string;
2498
2656
  fs: any;
@@ -2725,4 +2883,4 @@ interface EnsureDataGroupResult {
2725
2883
  */
2726
2884
  declare function ensureDataGroup(source: DataGroupSource, appId: string, opts?: EnsureDataGroupOptions): Promise<EnsureDataGroupResult>;
2727
2885
 
2728
- export { type AddBackendResult, type AppDataBackendDescriptor, type AppDataGroup, type AppDataGroupDescriptor, type AppRepo, BackendAlreadyExistsError, type BackendConflictInfo, type BackendConflictReason, type BackendConflictResolution, type BackendConflictResolutionResult, type BackendDescriptor, BackendEndpointConflictError, type BackendFactory, BackendIdentityError, type BackendInstance, type BackendMetadata, type BackendParamDef, type BackendSyncState, type BackendsMeta, CONFIG_DIR, CONFLICTS_DIR, type CacheOptions, type ConfigBackendInput, ConfigNotReadyError, ConfigRepo, type ConfigRepoOptions, type ConfigSerializer, type ConfigSyncGroupDescriptor, type ConfigSyncGroupHandle, type ConflictArchive, type ConflictInfo, ConflictStore, ConnectFailedError, type ConnectOptions, type ConnectResult, ConnectV2Error, type ConnectV2Options, DATA_GROUP_DEFAULT_FEATURES, DATA_GROUP_PREFERENCE_PREFIX, type DataBackendInput, type DataGroup, DataGroupBackendError, type DataGroupCandidate, DataGroupCreateError, type DataGroupFlushResult, type DataGroupInfo, DataGroupNotFoundError, DataGroupOperationError, type DataGroupSource, type DataGroupSyncEvent, type DataGroupSyncProgress, type DataGroupSyncResult, type EnsureDataGroupOptions, type EnsureDataGroupResult, FolderStore, GROUP_DESCRIPTOR_FILE, type GroupDescriptor, type GroupIdentity, type GroupInstanceIdRootResult, type GroupProbeResult, type GroupProbeState, type IConfigRepo, type IdentityBindingResult, type IdentityCandidate, type IdentityCandidateSource, type IdentityConflictReason, type IdentityResolutionMode, type IdentityResolutionResult, InvalidBackendError, 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, NeedsInitError, type PreferenceOptions, type PreferenceStorage, type PurgeKeepOptions, type PurgeLocalSyncConfigOptions, type PurgeLocalSyncConfigResult, type PurgeMtimeOptions, type PurgeableFS$1 as PurgeableFS, type RemoteIdentitySnapshot, type RemoteIdentityState, RemoteUnreachableError, type ReplicaSetupSummary, type ResolveDataGroupOptions, type SetGroupInstanceIdOptions, type SetGroupInstanceIdResult, type SyncGroupFeatures, type SyncGroupHandle, type SyncGroupKind, type SyncGroupSyncEvent, type SyncGroupType, TOMBSTONES_DIR, type TombstoneMeta, TombstoneStore, type UiConnection, VERSIONS_DIR, type VersionMeta, type VersionMigrationOptions, type VersionMigrationResult, VersionStore, bindRemoteGroupIdentity, bindRemoteGroupIdentityDetailed, collectDataGroupCandidates, configKeyToFilePath, connect, connectV2, connectionToAppRepo, createBackend, createConfigRepo, createSerializerChain, dataGroupLocalStoreName, deleteDataGroupLocalStore, deleteIndexedDbStore, encodeMetaPath, ensureDataGroup, getAccountFields, getBackendMetadata, getExtension, getPreferredDataGroupId, getUiConnection, groupHasPath, hasBackend, incrementVersion, isBrowserEnv, isKeepFile, isLocalBackendType, isLocalStorageUnavailableError, isMtimeSidecar, isValidGroupInstanceId, legacyVersionPathFor, listBackendMetadata, listBackends, listDataGroupCandidates, localPrimaryType, localSyncStoreNames, mergeAccountFields, migrateVersionSidecars, newGroupInstanceId, probeGroupTypeDetailed, purgeKeepFiles, purgeLocalSyncConfig, purgeMtimeSidecars, readGroupDescriptor, readVersion, registerBackend, registerFolderBackend, resolveDataGroup, resolveLocalPrimary, resolveRemoteIdentity, setPreferredDataGroupId, sha256, shortInstanceId, summarizeIdentity, unregisterBackend, verifyOrRepairVersion, versionPathFor, wrapZenFSFileSystem, writeGroupDescriptor, writeVersion };
2886
+ export { ALIASES_DIR, type AddBackendResult, type AppDataBackendDescriptor, type AppDataGroup, type AppDataGroupDescriptor, type AppRepo, BackendAlreadyExistsError, type BackendConflictInfo, type BackendConflictReason, type BackendConflictResolution, type BackendConflictResolutionResult, type BackendDescriptor, BackendEndpointConflictError, type BackendFactory, BackendIdentityError, type BackendInstance, type BackendMetadata, type BackendParamDef, type BackendSyncState, type BackendsMeta, CONFIG_DIR, CONFLICTS_DIR, type CacheOptions, type ConfigBackendInput, ConfigNotReadyError, ConfigRepo, type ConfigRepoOptions, type ConfigSerializer, type ConfigSyncGroupDescriptor, type ConfigSyncGroupHandle, type ConflictArchive, type ConflictInfo, ConflictStore, ConnectFailedError, type ConnectOptions, type ConnectResult, ConnectV2Error, type ConnectV2Options, DATA_GROUP_DEFAULT_FEATURES, DATA_GROUP_PREFERENCE_PREFIX, type DataBackendInput, type DataGroup, DataGroupBackendError, type DataGroupCandidate, DataGroupCreateError, type DataGroupFlushResult, type DataGroupInfo, DataGroupNotFoundError, DataGroupOperationError, type DataGroupSource, type DataGroupSyncEvent, type DataGroupSyncProgress, type DataGroupSyncResult, type DerivedIdentityInput, type EnsureDataGroupOptions, type EnsureDataGroupResult, FolderStore, GROUP_DESCRIPTOR_FILE, type GroupAliasDescriptor, type GroupDescriptor, type GroupIdentity, type GroupInstanceIdRootResult, type GroupProbeResult, type GroupProbeState, type IConfigRepo, type IdentityBindingResult, type IdentityCandidate, type IdentityCandidateSource, type IdentityConflictReason, type IdentityResolutionMode, type IdentityResolutionResult, InvalidBackendError, 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, NeedsInitError, type PreferenceOptions, type PreferenceStorage, type PurgeKeepOptions, type PurgeLocalSyncConfigOptions, type PurgeLocalSyncConfigResult, type PurgeMtimeOptions, type PurgeableFS$1 as PurgeableFS, type RemoteIdentitySnapshot, type RemoteIdentityState, RemoteUnreachableError, type ReplicaSetupSummary, type ResolveDataGroupOptions, type SetGroupInstanceIdOptions, type SetGroupInstanceIdResult, type SyncGroupFeatures, type SyncGroupHandle, type SyncGroupKind, type SyncGroupSyncEvent, type SyncGroupType, TOMBSTONES_DIR, type TombstoneMeta, TombstoneStore, type UiConnection, VERSIONS_DIR, type VersionMeta, type VersionMigrationOptions, type VersionMigrationResult, VersionStore, bindRemoteGroupIdentity, bindRemoteGroupIdentityDetailed, collectDataGroupCandidates, configKeyToFilePath, connect, connectV2, connectionToAppRepo, createBackend, createConfigRepo, createSerializerChain, dataGroupLocalStoreName, deleteDataGroupLocalStore, deleteIndexedDbStore, deriveGroupInstanceId, encodeMetaPath, ensureDataGroup, getAccountFields, getBackendMetadata, getExtension, getPreferredDataGroupId, getUiConnection, groupAliasFilePath, groupHasPath, hasBackend, incrementVersion, isBrowserEnv, isKeepFile, isLocalBackendType, isLocalStorageUnavailableError, isMtimeSidecar, isValidGroupInstanceId, legacyVersionPathFor, listBackendMetadata, listBackends, listDataGroupCandidates, localPrimaryType, localSyncStoreNames, mergeAccountFields, migrateVersionSidecars, newGroupInstanceId, probeGroupTypeDetailed, purgeKeepFiles, purgeLocalSyncConfig, purgeMtimeSidecars, readGroupAlias, readGroupAliases, readGroupDescriptor, readVersion, registerBackend, registerFolderBackend, resolveDataGroup, resolveLocalPrimary, resolveRemoteIdentity, setPreferredDataGroupId, sha256, shortInstanceId, summarizeIdentity, unregisterBackend, verifyOrRepairVersion, versionPathFor, wrapZenFSFileSystem, writeGroupAlias, writeGroupDescriptor, writeVersion };