zen-fs-config 0.6.4 → 0.7.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/dist/index.d.mts CHANGED
@@ -432,7 +432,7 @@ interface SyncGroupHandle {
432
432
  /**
433
433
  * 该组**声明**的后端列表(权威定义,允许尚未连接成功的条目)。
434
434
  *
435
- * 数据组读自自己的 `.meta/backends/`;配置组读自 `.config/backends/`。
435
+ * 数据组与配置组都读自 `.meta/backends/`(唯一权威位置)。
436
436
  * 与 `listBackends()`(已连接视图)不同,这个列表不会因为后端暂时不可达
437
437
  * 而少显示条目。
438
438
  */
@@ -994,9 +994,9 @@ declare class ConfigRepo implements IConfigRepo {
994
994
  peekNodeConfig<T = unknown>(nodeId: string, path: string): Promise<T>;
995
995
  flush(): Promise<SyncResult[]>;
996
996
  /**
997
- * Write the tombstone record for `filePath` (new `.meta/tombstones` + legacy
998
- * mirror for one release cycle). Records only metadata — it never creates
999
- * the deleted file locally.
997
+ * Write the tombstone record for `filePath` under `.meta/tombstones/`.
998
+ * Records only metadata — it never creates the deleted file locally, and the
999
+ * legacy `/.meta/.deleted/` archive is neither read nor written.
1000
1000
  */
1001
1001
  private writeTombstoneFor;
1002
1002
  /**
@@ -1167,7 +1167,7 @@ declare class ConfigRepo implements IConfigRepo {
1167
1167
  private trackSyncErrors;
1168
1168
  /** Registered replica backend descriptors (excludes the implicit local primary). */
1169
1169
  listBackends(): AppDataBackendDescriptor[];
1170
- /** 配置组的权威后端列表(`.config/backends/`),与 `listBackends()` 相同。 */
1170
+ /** 配置组的权威后端列表(`.meta/backends/`),与 `listBackends()` 相同。 */
1171
1171
  listDeclaredBackends(): AppDataBackendDescriptor[];
1172
1172
  /** Update the config-sync group's display name only. */
1173
1173
  rename(name: string): Promise<void>;
@@ -1191,15 +1191,22 @@ declare class ConfigRepo implements IConfigRepo {
1191
1191
  readMetaFile<T>(path: string): Promise<T | null>;
1192
1192
  /** Read a text file; `null` when absent (used for byte-compare-then-write). */
1193
1193
  private readTextIfExists;
1194
- /** Path for a single backend descriptor: .config/backends/{id}.json */
1194
+ /** Path for a single backend descriptor: `.meta/backends/{id}.json`. */
1195
1195
  backendFilePath(id: string): string;
1196
- /** Legacy path: .meta/backends/{id}.json (read + dual-write for one cycle). */
1196
+ /**
1197
+ * Legacy pre-0.7 path `/.config/backends/{id}.json`.
1198
+ *
1199
+ * 该目录已不再读取:此处只用于删除后端时尽力清理残留副本。
1200
+ */
1197
1201
  legacyBackendFilePath(id: string): string;
1198
1202
  /** Read every parseable descriptor in one directory. */
1199
1203
  private readBackendDescriptorsFrom;
1200
1204
  /**
1201
- * Read all backend descriptors from `.config/backends/*.json` with legacy
1202
- * `.meta/backends/*.json` as a one-cycle fallback (new layout wins by id).
1205
+ * Read all backend descriptors from `.meta/backends/*.json` — the single
1206
+ * authoritative location for both config-sync and data-sync groups.
1207
+ *
1208
+ * `/.config/backends/` is intentionally **not** read: leftovers there are
1209
+ * plain content and never take part in backend enumeration.
1203
1210
  *
1204
1211
  * If duplicate backends are detected (same type + options but different id),
1205
1212
  * only the first one (sorted by id) is kept and the rest are removed
@@ -1207,15 +1214,16 @@ declare class ConfigRepo implements IConfigRepo {
1207
1214
  */
1208
1215
  readAllBackendDescriptors(): Promise<BackendDescriptor[]>;
1209
1216
  /**
1210
- * Write a single backend descriptor to `.config/backends/{id}.json`,
1211
- * mirroring to the legacy `.meta/backends/{id}.json` for one release cycle
1212
- * so older clients still see the backend.
1217
+ * Write a single backend descriptor to `.meta/backends/{id}.json`.
1213
1218
  *
1214
- * Both files use the canonical serializer and are only written when their
1215
- * bytes actually differ (no needless sync churn).
1219
+ * Uses the canonical serializer and is only written when the bytes actually
1220
+ * differ (no needless sync churn). `/.config/backends/` is never written.
1216
1221
  */
1217
1222
  writeBackendDescriptor(desc: BackendDescriptor): Promise<void>;
1218
- /** Remove a single backend descriptor file + its version sidecar (both layouts) */
1223
+ /**
1224
+ * Remove a single backend descriptor: always `.meta/backends/{id}.json`, plus
1225
+ * a best-effort cleanup of the legacy `/.config/backends/{id}.json` residue.
1226
+ */
1219
1227
  removeBackendDescriptor(id: string): Promise<void>;
1220
1228
  getBackends(): Promise<BackendsMeta | null>;
1221
1229
  updateBackends(meta: BackendsMeta): Promise<void>;
@@ -1247,8 +1255,9 @@ declare class ConfigRepo implements IConfigRepo {
1247
1255
  /** Legacy descriptor path: .meta/app-data-groups/{appId}/{id}.json */
1248
1256
  private legacyAppDataGroupFilePath;
1249
1257
  /**
1250
- * Write a data-group descriptor to `.config/` (bootstrap copy), mirroring to
1251
- * the legacy `.meta/` path.
1258
+ * Write a data-group descriptor to `.config/app-data-groups/` (registration
1259
+ * + bootstrap copy). The legacy `.meta/app-data-groups/` mirror is no longer
1260
+ * written; it is still read so old layouts keep working.
1252
1261
  *
1253
1262
  * 这份描述符是**引导副本**:它让只有配置组凭据的新设备知道有哪些数据组、
1254
1263
  * 远端在哪。权威定义在数据组自己的 `.meta/backends/`。
@@ -1477,7 +1486,7 @@ declare function verifyOrRepairVersion(fs: SyncableFS, configFilePath: string, a
1477
1486
  * Implements the layout agreed in SYNC-GROUP-UNIFICATION.zh-CN.md:
1478
1487
  *
1479
1488
  * /.meta/group.json # group descriptor (kind/id/features)
1480
- * /.meta/tombstones/{encoded}.json # tombstones (legacy: /.meta/.deleted)
1489
+ * /.meta/tombstones/{encoded}.json # tombstones (the only deletion record)
1481
1490
  * /.meta/versions/{encoded}.json # version records for data groups
1482
1491
  * /.meta/conflicts/{conflictId}/ # conflict archives (legacy: /.meta/.conflicts)
1483
1492
  * /.config/** # config-sync only (not synced by data groups)
@@ -1490,6 +1499,10 @@ declare function verifyOrRepairVersion(fs: SyncableFS, configFilePath: string, a
1490
1499
  declare const META_DIR = "/.meta";
1491
1500
  declare const GROUP_DESCRIPTOR_FILE = "/.meta/group.json";
1492
1501
  declare const TOMBSTONES_DIR = "/.meta/tombstones";
1502
+ /**
1503
+ * 历史归档目录。仅作为常量保留(旧数据仍在远端,按普通内容对待):
1504
+ * 既不读取也不写入,删除状态只以 {@link TOMBSTONES_DIR} 为准。
1505
+ */
1493
1506
  declare const LEGACY_TOMBSTONES_DIR = "/.meta/.deleted";
1494
1507
  declare const VERSIONS_DIR = "/.meta/versions";
1495
1508
  declare const CONFLICTS_DIR = "/.meta/conflicts";
@@ -1527,22 +1540,20 @@ interface TombstoneTarget {
1527
1540
  /**
1528
1541
  * Tombstone store for a group's local store.
1529
1542
  *
1530
- * New writes go to `/.meta/tombstones/`; for one release cycle a mirror copy is
1531
- * also written to the legacy `/.meta/.deleted/` path so older clients still see
1532
- * deletions. Reads accept both.
1543
+ * 删除状态只写在 `/.meta/tombstones/`;历史归档目录不再读写。
1533
1544
  */
1534
1545
  declare class TombstoneStore {
1535
1546
  private fs;
1536
1547
  private author;
1537
1548
  constructor(fs: MetaFS, author: string);
1538
1549
  private pathFor;
1539
- /** All tombstones, new path first, legacy only for paths not already seen. */
1550
+ /** All tombstones. */
1540
1551
  list(): Promise<TombstoneMeta[]>;
1541
- /** Write a tombstone (new + legacy mirror). */
1552
+ /** Write a tombstone. */
1542
1553
  write(tombstone: TombstoneMeta): Promise<void>;
1543
- /** Persist an updated tombstone (confirmations) to whichever paths exist. */
1554
+ /** Persist an updated tombstone (confirmations) when it still exists. */
1544
1555
  save(tombstone: TombstoneMeta): Promise<void>;
1545
- /** Delete a tombstone from both layouts. */
1556
+ /** Delete a tombstone. */
1546
1557
  remove(tombstone: TombstoneMeta): Promise<void>;
1547
1558
  /**
1548
1559
  * Delete every tombstoned file (and its version record) on the local store
@@ -1552,7 +1563,7 @@ declare class TombstoneStore {
1552
1563
  private deleteEverywhere;
1553
1564
  /** Add the given backend ids to every tombstone's confirmation set. */
1554
1565
  confirm(backendIds: string[]): Promise<number>;
1555
- /** Remove tombstones confirmed by every connected backend (and their mirrors). */
1566
+ /** Remove tombstones confirmed by every connected backend. */
1556
1567
  gc(allBackendIds: string[], targets?: TombstoneTarget[]): Promise<void>;
1557
1568
  }
1558
1569
  /**
package/dist/index.d.ts CHANGED
@@ -432,7 +432,7 @@ interface SyncGroupHandle {
432
432
  /**
433
433
  * 该组**声明**的后端列表(权威定义,允许尚未连接成功的条目)。
434
434
  *
435
- * 数据组读自自己的 `.meta/backends/`;配置组读自 `.config/backends/`。
435
+ * 数据组与配置组都读自 `.meta/backends/`(唯一权威位置)。
436
436
  * 与 `listBackends()`(已连接视图)不同,这个列表不会因为后端暂时不可达
437
437
  * 而少显示条目。
438
438
  */
@@ -994,9 +994,9 @@ declare class ConfigRepo implements IConfigRepo {
994
994
  peekNodeConfig<T = unknown>(nodeId: string, path: string): Promise<T>;
995
995
  flush(): Promise<SyncResult[]>;
996
996
  /**
997
- * Write the tombstone record for `filePath` (new `.meta/tombstones` + legacy
998
- * mirror for one release cycle). Records only metadata — it never creates
999
- * the deleted file locally.
997
+ * Write the tombstone record for `filePath` under `.meta/tombstones/`.
998
+ * Records only metadata — it never creates the deleted file locally, and the
999
+ * legacy `/.meta/.deleted/` archive is neither read nor written.
1000
1000
  */
1001
1001
  private writeTombstoneFor;
1002
1002
  /**
@@ -1167,7 +1167,7 @@ declare class ConfigRepo implements IConfigRepo {
1167
1167
  private trackSyncErrors;
1168
1168
  /** Registered replica backend descriptors (excludes the implicit local primary). */
1169
1169
  listBackends(): AppDataBackendDescriptor[];
1170
- /** 配置组的权威后端列表(`.config/backends/`),与 `listBackends()` 相同。 */
1170
+ /** 配置组的权威后端列表(`.meta/backends/`),与 `listBackends()` 相同。 */
1171
1171
  listDeclaredBackends(): AppDataBackendDescriptor[];
1172
1172
  /** Update the config-sync group's display name only. */
1173
1173
  rename(name: string): Promise<void>;
@@ -1191,15 +1191,22 @@ declare class ConfigRepo implements IConfigRepo {
1191
1191
  readMetaFile<T>(path: string): Promise<T | null>;
1192
1192
  /** Read a text file; `null` when absent (used for byte-compare-then-write). */
1193
1193
  private readTextIfExists;
1194
- /** Path for a single backend descriptor: .config/backends/{id}.json */
1194
+ /** Path for a single backend descriptor: `.meta/backends/{id}.json`. */
1195
1195
  backendFilePath(id: string): string;
1196
- /** Legacy path: .meta/backends/{id}.json (read + dual-write for one cycle). */
1196
+ /**
1197
+ * Legacy pre-0.7 path `/.config/backends/{id}.json`.
1198
+ *
1199
+ * 该目录已不再读取:此处只用于删除后端时尽力清理残留副本。
1200
+ */
1197
1201
  legacyBackendFilePath(id: string): string;
1198
1202
  /** Read every parseable descriptor in one directory. */
1199
1203
  private readBackendDescriptorsFrom;
1200
1204
  /**
1201
- * Read all backend descriptors from `.config/backends/*.json` with legacy
1202
- * `.meta/backends/*.json` as a one-cycle fallback (new layout wins by id).
1205
+ * Read all backend descriptors from `.meta/backends/*.json` — the single
1206
+ * authoritative location for both config-sync and data-sync groups.
1207
+ *
1208
+ * `/.config/backends/` is intentionally **not** read: leftovers there are
1209
+ * plain content and never take part in backend enumeration.
1203
1210
  *
1204
1211
  * If duplicate backends are detected (same type + options but different id),
1205
1212
  * only the first one (sorted by id) is kept and the rest are removed
@@ -1207,15 +1214,16 @@ declare class ConfigRepo implements IConfigRepo {
1207
1214
  */
1208
1215
  readAllBackendDescriptors(): Promise<BackendDescriptor[]>;
1209
1216
  /**
1210
- * Write a single backend descriptor to `.config/backends/{id}.json`,
1211
- * mirroring to the legacy `.meta/backends/{id}.json` for one release cycle
1212
- * so older clients still see the backend.
1217
+ * Write a single backend descriptor to `.meta/backends/{id}.json`.
1213
1218
  *
1214
- * Both files use the canonical serializer and are only written when their
1215
- * bytes actually differ (no needless sync churn).
1219
+ * Uses the canonical serializer and is only written when the bytes actually
1220
+ * differ (no needless sync churn). `/.config/backends/` is never written.
1216
1221
  */
1217
1222
  writeBackendDescriptor(desc: BackendDescriptor): Promise<void>;
1218
- /** Remove a single backend descriptor file + its version sidecar (both layouts) */
1223
+ /**
1224
+ * Remove a single backend descriptor: always `.meta/backends/{id}.json`, plus
1225
+ * a best-effort cleanup of the legacy `/.config/backends/{id}.json` residue.
1226
+ */
1219
1227
  removeBackendDescriptor(id: string): Promise<void>;
1220
1228
  getBackends(): Promise<BackendsMeta | null>;
1221
1229
  updateBackends(meta: BackendsMeta): Promise<void>;
@@ -1247,8 +1255,9 @@ declare class ConfigRepo implements IConfigRepo {
1247
1255
  /** Legacy descriptor path: .meta/app-data-groups/{appId}/{id}.json */
1248
1256
  private legacyAppDataGroupFilePath;
1249
1257
  /**
1250
- * Write a data-group descriptor to `.config/` (bootstrap copy), mirroring to
1251
- * the legacy `.meta/` path.
1258
+ * Write a data-group descriptor to `.config/app-data-groups/` (registration
1259
+ * + bootstrap copy). The legacy `.meta/app-data-groups/` mirror is no longer
1260
+ * written; it is still read so old layouts keep working.
1252
1261
  *
1253
1262
  * 这份描述符是**引导副本**:它让只有配置组凭据的新设备知道有哪些数据组、
1254
1263
  * 远端在哪。权威定义在数据组自己的 `.meta/backends/`。
@@ -1477,7 +1486,7 @@ declare function verifyOrRepairVersion(fs: SyncableFS, configFilePath: string, a
1477
1486
  * Implements the layout agreed in SYNC-GROUP-UNIFICATION.zh-CN.md:
1478
1487
  *
1479
1488
  * /.meta/group.json # group descriptor (kind/id/features)
1480
- * /.meta/tombstones/{encoded}.json # tombstones (legacy: /.meta/.deleted)
1489
+ * /.meta/tombstones/{encoded}.json # tombstones (the only deletion record)
1481
1490
  * /.meta/versions/{encoded}.json # version records for data groups
1482
1491
  * /.meta/conflicts/{conflictId}/ # conflict archives (legacy: /.meta/.conflicts)
1483
1492
  * /.config/** # config-sync only (not synced by data groups)
@@ -1490,6 +1499,10 @@ declare function verifyOrRepairVersion(fs: SyncableFS, configFilePath: string, a
1490
1499
  declare const META_DIR = "/.meta";
1491
1500
  declare const GROUP_DESCRIPTOR_FILE = "/.meta/group.json";
1492
1501
  declare const TOMBSTONES_DIR = "/.meta/tombstones";
1502
+ /**
1503
+ * 历史归档目录。仅作为常量保留(旧数据仍在远端,按普通内容对待):
1504
+ * 既不读取也不写入,删除状态只以 {@link TOMBSTONES_DIR} 为准。
1505
+ */
1493
1506
  declare const LEGACY_TOMBSTONES_DIR = "/.meta/.deleted";
1494
1507
  declare const VERSIONS_DIR = "/.meta/versions";
1495
1508
  declare const CONFLICTS_DIR = "/.meta/conflicts";
@@ -1527,22 +1540,20 @@ interface TombstoneTarget {
1527
1540
  /**
1528
1541
  * Tombstone store for a group's local store.
1529
1542
  *
1530
- * New writes go to `/.meta/tombstones/`; for one release cycle a mirror copy is
1531
- * also written to the legacy `/.meta/.deleted/` path so older clients still see
1532
- * deletions. Reads accept both.
1543
+ * 删除状态只写在 `/.meta/tombstones/`;历史归档目录不再读写。
1533
1544
  */
1534
1545
  declare class TombstoneStore {
1535
1546
  private fs;
1536
1547
  private author;
1537
1548
  constructor(fs: MetaFS, author: string);
1538
1549
  private pathFor;
1539
- /** All tombstones, new path first, legacy only for paths not already seen. */
1550
+ /** All tombstones. */
1540
1551
  list(): Promise<TombstoneMeta[]>;
1541
- /** Write a tombstone (new + legacy mirror). */
1552
+ /** Write a tombstone. */
1542
1553
  write(tombstone: TombstoneMeta): Promise<void>;
1543
- /** Persist an updated tombstone (confirmations) to whichever paths exist. */
1554
+ /** Persist an updated tombstone (confirmations) when it still exists. */
1544
1555
  save(tombstone: TombstoneMeta): Promise<void>;
1545
- /** Delete a tombstone from both layouts. */
1556
+ /** Delete a tombstone. */
1546
1557
  remove(tombstone: TombstoneMeta): Promise<void>;
1547
1558
  /**
1548
1559
  * Delete every tombstoned file (and its version record) on the local store
@@ -1552,7 +1563,7 @@ declare class TombstoneStore {
1552
1563
  private deleteEverywhere;
1553
1564
  /** Add the given backend ids to every tombstone's confirmation set. */
1554
1565
  confirm(backendIds: string[]): Promise<number>;
1555
- /** Remove tombstones confirmed by every connected backend (and their mirrors). */
1566
+ /** Remove tombstones confirmed by every connected backend. */
1556
1567
  gc(allBackendIds: string[], targets?: TombstoneTarget[]): Promise<void>;
1557
1568
  }
1558
1569
  /**