zen-fs-config 0.7.21 → 0.7.23

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.js CHANGED
@@ -2906,6 +2906,9 @@ var LEGACY_CONFIG_SYNC_GROUP_FILE = `${META_DIR}/config-sync-group.json`;
2906
2906
  var GROUP_NAME_MAX_LENGTH = 40;
2907
2907
  var NODES_DIR = "/nodes";
2908
2908
  var SHARED_DIR = "/shared";
2909
+ function isDeletableLegacyMetaPath(path) {
2910
+ return path === LEGACY_TOMBSTONES_DIR || path.startsWith(`${LEGACY_TOMBSTONES_DIR}/`) || path === LEGACY_CONFLICTS_DIR || path.startsWith(`${LEGACY_CONFLICTS_DIR}/`);
2911
+ }
2909
2912
  var CONFIG_GROUP_ID = "config";
2910
2913
  var CONFIG_GROUP_FEATURES = {
2911
2914
  tombstones: true,
@@ -4436,22 +4439,7 @@ var ConfigRepo = class {
4436
4439
  const items = [...fresh.items];
4437
4440
  const corruptFiles = [...fresh.corruptFiles];
4438
4441
  for (const corruptPath of corruptFiles) {
4439
- for (const [, replica] of this.replicaBackends) {
4440
- try {
4441
- await replica.instance.unlink(corruptPath);
4442
- } catch {
4443
- }
4444
- await this.unlinkVersionSidecar(replica.instance, corruptPath);
4445
- }
4446
- try {
4447
- await this.deleteFile(corruptPath);
4448
- } catch {
4449
- try {
4450
- await this.cachedFS.unlink(corruptPath);
4451
- } catch {
4452
- }
4453
- await this.unlinkVersionSidecar(this.cachedFS, corruptPath);
4454
- }
4442
+ log5.warn(`[ConfigRepo] readAllBackendDescriptors: ignoring unreadable descriptor ${corruptPath}`);
4455
4443
  }
4456
4444
  const seen = /* @__PURE__ */ new Map();
4457
4445
  const duplicates = [];
@@ -4471,28 +4459,8 @@ var ConfigRepo = class {
4471
4459
  }
4472
4460
  if (duplicates.length > 0) {
4473
4461
  log5.log(
4474
- `[ConfigRepo] readAllBackendDescriptors: removing ${duplicates.length} duplicate(s): ${duplicates.join(", ")}`
4462
+ `[ConfigRepo] readAllBackendDescriptors: ignoring ${duplicates.length} duplicate descriptor(s) (kept on disk): ${duplicates.join(", ")}`
4475
4463
  );
4476
- for (const dupId of duplicates) {
4477
- for (const descPath of [this.backendFilePath(dupId), this.legacyBackendFilePath(dupId)]) {
4478
- for (const [, replica] of this.replicaBackends) {
4479
- try {
4480
- await replica.instance.unlink(descPath);
4481
- } catch {
4482
- }
4483
- await this.unlinkVersionSidecar(replica.instance, descPath);
4484
- }
4485
- try {
4486
- await this.deleteFile(descPath);
4487
- } catch {
4488
- try {
4489
- await this.cachedFS.unlink(descPath);
4490
- } catch {
4491
- }
4492
- await this.unlinkVersionSidecar(this.cachedFS, descPath);
4493
- }
4494
- }
4495
- }
4496
4464
  }
4497
4465
  const result = Array.from(seen.values()).map((i) => i.desc);
4498
4466
  this.backendDescriptorCache = result;
@@ -6083,10 +6051,8 @@ var AppDataGroupImpl = class {
6083
6051
  hiddenPrefixes: [CONFIG_DIR],
6084
6052
  readOnlyPrefixes: [
6085
6053
  TOMBSTONES_DIR,
6086
- LEGACY_TOMBSTONES_DIR,
6087
6054
  VERSIONS_DIR,
6088
- CONFLICTS_DIR,
6089
- LEGACY_CONFLICTS_DIR
6055
+ CONFLICTS_DIR
6090
6056
  ],
6091
6057
  confirmPrefixes: [GROUP_DESCRIPTOR_FILE3],
6092
6058
  onWrite: async (path, data) => {
@@ -6331,7 +6297,7 @@ var AppDataGroupImpl = class {
6331
6297
  async deleteFile(path) {
6332
6298
  if (this.disposed) throw new Error("DataSyncGroup has been disposed");
6333
6299
  const normalized = path.startsWith("/") ? path : `/${path}`;
6334
- if (normalized === META_DIR || normalized === CONFIG_DIR || normalized.startsWith(`${META_DIR}/`) || normalized.startsWith(`${CONFIG_DIR}/`)) {
6300
+ if (normalized === CONFIG_DIR || normalized.startsWith(`${CONFIG_DIR}/`) || (normalized === META_DIR || normalized.startsWith(`${META_DIR}/`)) && !isDeletableLegacyMetaPath(normalized)) {
6335
6301
  throw new Error(`Cannot delete metadata path "${normalized}"`);
6336
6302
  }
6337
6303
  if (await isDirectoryPath(this.localFS, normalized)) {
package/dist/index.mjs CHANGED
@@ -2147,6 +2147,9 @@ var LEGACY_CONFIG_SYNC_GROUP_FILE = `${META_DIR}/config-sync-group.json`;
2147
2147
  var GROUP_NAME_MAX_LENGTH = 40;
2148
2148
  var NODES_DIR = "/nodes";
2149
2149
  var SHARED_DIR = "/shared";
2150
+ function isDeletableLegacyMetaPath(path) {
2151
+ return path === LEGACY_TOMBSTONES_DIR || path.startsWith(`${LEGACY_TOMBSTONES_DIR}/`) || path === LEGACY_CONFLICTS_DIR || path.startsWith(`${LEGACY_CONFLICTS_DIR}/`);
2152
+ }
2150
2153
  var CONFIG_GROUP_ID = "config";
2151
2154
  var CONFIG_GROUP_FEATURES = {
2152
2155
  tombstones: true,
@@ -3677,22 +3680,7 @@ var ConfigRepo = class {
3677
3680
  const items = [...fresh.items];
3678
3681
  const corruptFiles = [...fresh.corruptFiles];
3679
3682
  for (const corruptPath of corruptFiles) {
3680
- for (const [, replica] of this.replicaBackends) {
3681
- try {
3682
- await replica.instance.unlink(corruptPath);
3683
- } catch {
3684
- }
3685
- await this.unlinkVersionSidecar(replica.instance, corruptPath);
3686
- }
3687
- try {
3688
- await this.deleteFile(corruptPath);
3689
- } catch {
3690
- try {
3691
- await this.cachedFS.unlink(corruptPath);
3692
- } catch {
3693
- }
3694
- await this.unlinkVersionSidecar(this.cachedFS, corruptPath);
3695
- }
3683
+ log5.warn(`[ConfigRepo] readAllBackendDescriptors: ignoring unreadable descriptor ${corruptPath}`);
3696
3684
  }
3697
3685
  const seen = /* @__PURE__ */ new Map();
3698
3686
  const duplicates = [];
@@ -3712,28 +3700,8 @@ var ConfigRepo = class {
3712
3700
  }
3713
3701
  if (duplicates.length > 0) {
3714
3702
  log5.log(
3715
- `[ConfigRepo] readAllBackendDescriptors: removing ${duplicates.length} duplicate(s): ${duplicates.join(", ")}`
3703
+ `[ConfigRepo] readAllBackendDescriptors: ignoring ${duplicates.length} duplicate descriptor(s) (kept on disk): ${duplicates.join(", ")}`
3716
3704
  );
3717
- for (const dupId of duplicates) {
3718
- for (const descPath of [this.backendFilePath(dupId), this.legacyBackendFilePath(dupId)]) {
3719
- for (const [, replica] of this.replicaBackends) {
3720
- try {
3721
- await replica.instance.unlink(descPath);
3722
- } catch {
3723
- }
3724
- await this.unlinkVersionSidecar(replica.instance, descPath);
3725
- }
3726
- try {
3727
- await this.deleteFile(descPath);
3728
- } catch {
3729
- try {
3730
- await this.cachedFS.unlink(descPath);
3731
- } catch {
3732
- }
3733
- await this.unlinkVersionSidecar(this.cachedFS, descPath);
3734
- }
3735
- }
3736
- }
3737
3705
  }
3738
3706
  const result = Array.from(seen.values()).map((i) => i.desc);
3739
3707
  this.backendDescriptorCache = result;
@@ -5324,10 +5292,8 @@ var AppDataGroupImpl = class {
5324
5292
  hiddenPrefixes: [CONFIG_DIR],
5325
5293
  readOnlyPrefixes: [
5326
5294
  TOMBSTONES_DIR,
5327
- LEGACY_TOMBSTONES_DIR,
5328
5295
  VERSIONS_DIR,
5329
- CONFLICTS_DIR,
5330
- LEGACY_CONFLICTS_DIR
5296
+ CONFLICTS_DIR
5331
5297
  ],
5332
5298
  confirmPrefixes: [GROUP_DESCRIPTOR_FILE3],
5333
5299
  onWrite: async (path, data) => {
@@ -5572,7 +5538,7 @@ var AppDataGroupImpl = class {
5572
5538
  async deleteFile(path) {
5573
5539
  if (this.disposed) throw new Error("DataSyncGroup has been disposed");
5574
5540
  const normalized = path.startsWith("/") ? path : `/${path}`;
5575
- if (normalized === META_DIR || normalized === CONFIG_DIR || normalized.startsWith(`${META_DIR}/`) || normalized.startsWith(`${CONFIG_DIR}/`)) {
5541
+ if (normalized === CONFIG_DIR || normalized.startsWith(`${CONFIG_DIR}/`) || (normalized === META_DIR || normalized.startsWith(`${META_DIR}/`)) && !isDeletableLegacyMetaPath(normalized)) {
5576
5542
  throw new Error(`Cannot delete metadata path "${normalized}"`);
5577
5543
  }
5578
5544
  if (await isDirectoryPath(this.localFS, normalized)) {
@@ -28863,6 +28863,9 @@ var ZenFSConfig = (() => {
28863
28863
  var GROUP_NAME_MAX_LENGTH = 40;
28864
28864
  var NODES_DIR = "/nodes";
28865
28865
  var SHARED_DIR = "/shared";
28866
+ function isDeletableLegacyMetaPath(path) {
28867
+ return path === LEGACY_TOMBSTONES_DIR || path.startsWith(`${LEGACY_TOMBSTONES_DIR}/`) || path === LEGACY_CONFLICTS_DIR || path.startsWith(`${LEGACY_CONFLICTS_DIR}/`);
28868
+ }
28866
28869
  var CONFIG_GROUP_ID = "config";
28867
28870
  var CONFIG_GROUP_FEATURES = {
28868
28871
  tombstones: true,
@@ -30393,22 +30396,7 @@ var ZenFSConfig = (() => {
30393
30396
  const items = [...fresh.items];
30394
30397
  const corruptFiles = [...fresh.corruptFiles];
30395
30398
  for (const corruptPath of corruptFiles) {
30396
- for (const [, replica] of this.replicaBackends) {
30397
- try {
30398
- await replica.instance.unlink(corruptPath);
30399
- } catch {
30400
- }
30401
- await this.unlinkVersionSidecar(replica.instance, corruptPath);
30402
- }
30403
- try {
30404
- await this.deleteFile(corruptPath);
30405
- } catch {
30406
- try {
30407
- await this.cachedFS.unlink(corruptPath);
30408
- } catch {
30409
- }
30410
- await this.unlinkVersionSidecar(this.cachedFS, corruptPath);
30411
- }
30399
+ log9.warn(`[ConfigRepo] readAllBackendDescriptors: ignoring unreadable descriptor ${corruptPath}`);
30412
30400
  }
30413
30401
  const seen = /* @__PURE__ */ new Map();
30414
30402
  const duplicates = [];
@@ -30428,28 +30416,8 @@ var ZenFSConfig = (() => {
30428
30416
  }
30429
30417
  if (duplicates.length > 0) {
30430
30418
  log9.log(
30431
- `[ConfigRepo] readAllBackendDescriptors: removing ${duplicates.length} duplicate(s): ${duplicates.join(", ")}`
30419
+ `[ConfigRepo] readAllBackendDescriptors: ignoring ${duplicates.length} duplicate descriptor(s) (kept on disk): ${duplicates.join(", ")}`
30432
30420
  );
30433
- for (const dupId of duplicates) {
30434
- for (const descPath of [this.backendFilePath(dupId), this.legacyBackendFilePath(dupId)]) {
30435
- for (const [, replica] of this.replicaBackends) {
30436
- try {
30437
- await replica.instance.unlink(descPath);
30438
- } catch {
30439
- }
30440
- await this.unlinkVersionSidecar(replica.instance, descPath);
30441
- }
30442
- try {
30443
- await this.deleteFile(descPath);
30444
- } catch {
30445
- try {
30446
- await this.cachedFS.unlink(descPath);
30447
- } catch {
30448
- }
30449
- await this.unlinkVersionSidecar(this.cachedFS, descPath);
30450
- }
30451
- }
30452
- }
30453
30421
  }
30454
30422
  const result = Array.from(seen.values()).map((i) => i.desc);
30455
30423
  this.backendDescriptorCache = result;
@@ -32040,10 +32008,8 @@ var ZenFSConfig = (() => {
32040
32008
  hiddenPrefixes: [CONFIG_DIR],
32041
32009
  readOnlyPrefixes: [
32042
32010
  TOMBSTONES_DIR,
32043
- LEGACY_TOMBSTONES_DIR,
32044
32011
  VERSIONS_DIR,
32045
- CONFLICTS_DIR,
32046
- LEGACY_CONFLICTS_DIR
32012
+ CONFLICTS_DIR
32047
32013
  ],
32048
32014
  confirmPrefixes: [GROUP_DESCRIPTOR_FILE3],
32049
32015
  onWrite: async (path, data) => {
@@ -32288,7 +32254,7 @@ var ZenFSConfig = (() => {
32288
32254
  async deleteFile(path) {
32289
32255
  if (this.disposed) throw new Error("DataSyncGroup has been disposed");
32290
32256
  const normalized = path.startsWith("/") ? path : `/${path}`;
32291
- if (normalized === META_DIR || normalized === CONFIG_DIR || normalized.startsWith(`${META_DIR}/`) || normalized.startsWith(`${CONFIG_DIR}/`)) {
32257
+ if (normalized === CONFIG_DIR || normalized.startsWith(`${CONFIG_DIR}/`) || (normalized === META_DIR || normalized.startsWith(`${META_DIR}/`)) && !isDeletableLegacyMetaPath(normalized)) {
32292
32258
  throw new Error(`Cannot delete metadata path "${normalized}"`);
32293
32259
  }
32294
32260
  if (await isDirectoryPath(this.localFS, normalized)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-fs-config",
3
- "version": "0.7.21",
3
+ "version": "0.7.23",
4
4
  "description": "Distributed config management library built on ZenFS, zen-fs-cache, and zen-fs-sync",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",