zen-fs-config 0.5.38 → 0.5.39

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.
@@ -9,7 +9,7 @@ import {
9
9
  registerBackend,
10
10
  unregisterBackend,
11
11
  wrapZenFSFileSystem
12
- } from "./chunk-4RP2AXAB.mjs";
12
+ } from "./chunk-6OS2F54Z.mjs";
13
13
  export {
14
14
  createBackend,
15
15
  getAccountFields,
@@ -4,7 +4,8 @@ var metadataRegistry = /* @__PURE__ */ new Map();
4
4
  function registerBackend(type, factory, metadata) {
5
5
  registry.set(type, factory);
6
6
  if (metadata) {
7
- metadataRegistry.set(type, metadata);
7
+ const existing = metadataRegistry.get(type);
8
+ metadataRegistry.set(type, { ...existing, ...metadata });
8
9
  }
9
10
  }
10
11
  function unregisterBackend(type) {
package/dist/index.js CHANGED
@@ -47,7 +47,8 @@ __export(backend_registry_exports, {
47
47
  function registerBackend(type, factory, metadata) {
48
48
  registry.set(type, factory);
49
49
  if (metadata) {
50
- metadataRegistry.set(type, metadata);
50
+ const existing = metadataRegistry.get(type);
51
+ metadataRegistry.set(type, { ...existing, ...metadata });
51
52
  }
52
53
  }
53
54
  function unregisterBackend(type) {
@@ -1360,17 +1361,12 @@ function sortKeysDeep(obj) {
1360
1361
  return sorted;
1361
1362
  }
1362
1363
  function identityOptions(type, options) {
1363
- const meta = getBackendMetadata(type);
1364
- const fields = meta?.identityFields;
1365
- if (!fields || fields.length === 0) {
1366
- log2.warn(`[DEDUP-DIAG] identityOptions(${type}): NO identityFields -> falling back to FULL options (dedup will be key-sensitive to tuning fields)`);
1367
- return options ?? {};
1368
- }
1364
+ const fields = getBackendMetadata(type)?.identityFields;
1365
+ if (!fields || fields.length === 0) return options ?? {};
1369
1366
  const subset = {};
1370
1367
  for (const f of fields) {
1371
1368
  if (options && options[f] !== void 0) subset[f] = options[f];
1372
1369
  }
1373
- log2.log(`[DEDUP-DIAG] identityOptions(${type}): identityFields=${JSON.stringify(fields)} identitySubset=${JSON.stringify(subset)}`);
1374
1370
  return subset;
1375
1371
  }
1376
1372
  function backendDedupKey(desc) {
@@ -2409,22 +2405,18 @@ var ConfigRepo = class {
2409
2405
  const duplicates = [];
2410
2406
  for (const item of items) {
2411
2407
  const key = backendDedupKey(item.desc);
2412
- log2.log(`[DEDUP-DIAG] item id=${item.desc.id} type=${item.desc.type} dedupKey=${key} mtime=${item.mtime} rawOptions=${JSON.stringify(item.desc.options)}`);
2413
2408
  const existing = seen.get(key);
2414
2409
  if (existing) {
2415
2410
  if (item.mtime < existing.mtime) {
2416
- log2.log(`[DEDUP-DIAG] DUPLICATE: new id=${item.desc.id} (older) keeps key, dropping existing=${existing.desc.id}`);
2417
2411
  duplicates.push(existing.desc.id);
2418
2412
  seen.set(key, item);
2419
2413
  } else {
2420
- log2.log(`[DEDUP-DIAG] DUPLICATE: new id=${item.desc.id} dropped, kept=${existing.desc.id}`);
2421
2414
  duplicates.push(item.desc.id);
2422
2415
  }
2423
2416
  } else {
2424
2417
  seen.set(key, item);
2425
2418
  }
2426
2419
  }
2427
- log2.log(`[DEDUP-DIAG] dedup summary: keptKeys=${[...seen.keys()].length} duplicates=${JSON.stringify(duplicates)}`);
2428
2420
  if (duplicates.length > 0) {
2429
2421
  log2.log(
2430
2422
  `[ConfigRepo] readAllBackendDescriptors: removing ${duplicates.length} duplicate(s): ${duplicates.join(", ")}`
@@ -2434,13 +2426,10 @@ var ConfigRepo = class {
2434
2426
  for (const [replicaId, replica] of this.replicaBackends) {
2435
2427
  try {
2436
2428
  await replica.instance.unlink(descPath);
2437
- log2.log(`[DEDUP-DIAG] removed dup ${dupId} from replica ${replicaId}`);
2438
- } catch (e) {
2439
- log2.log(`[DEDUP-DIAG] remove dup ${dupId} from replica ${replicaId} failed/skipped: ${String(e)}`);
2429
+ } catch {
2440
2430
  }
2441
2431
  await this.unlinkVersionSidecar(replica.instance, descPath);
2442
2432
  }
2443
- log2.log(`[DEDUP-DIAG] replicaBackends available during removal: ${[...this.replicaBackends.keys()].join(",") || "(none)"}`);
2444
2433
  try {
2445
2434
  await this.deleteFile(descPath);
2446
2435
  } catch {
@@ -2449,8 +2438,7 @@ var ConfigRepo = class {
2449
2438
  }
2450
2439
  }
2451
2440
  return Array.from(seen.values()).map((i) => i.desc);
2452
- } catch (e) {
2453
- log2.error(`[DEDUP-DIAG] readAllBackendDescriptors threw, returning []:`, e);
2441
+ } catch {
2454
2442
  return [];
2455
2443
  }
2456
2444
  }
@@ -3054,7 +3042,6 @@ async function createConfigRepo(appId, options = {}) {
3054
3042
  log2.log(`[createConfigRepo] Migration complete`);
3055
3043
  }
3056
3044
  let allBackends = await tempRepo.readAllBackendDescriptors();
3057
- log2.log(`[DEDUP-DIAG] createConfigRepo after readAllBackendDescriptors: allBackends=${allBackends.map((b) => b.id).join(",")}`);
3058
3045
  if (options.backendInfo) {
3059
3046
  const replicaId = options.primaryBackendId || `${options.backendInfo.type}-replica`;
3060
3047
  const hasReplica = allBackends.some((b) => b.id === replicaId);
package/dist/index.mjs CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  registerBackend,
10
10
  unregisterBackend,
11
11
  wrapZenFSFileSystem
12
- } from "./chunk-4RP2AXAB.mjs";
12
+ } from "./chunk-6OS2F54Z.mjs";
13
13
 
14
14
  // src/config-repo.ts
15
15
  import {
@@ -351,7 +351,7 @@ function registerFolderBackend() {
351
351
  const pathMod = await import("path");
352
352
  const dir = options.path;
353
353
  const store = new FolderStore({ path: dir, label: options.label, fs, pathMod });
354
- return (await import("./backend-registry-LELIKPQ4.mjs")).wrapZenFSFileSystem({ backend: FolderBackend, path: dir, label: options.label });
354
+ return (await import("./backend-registry-3FVPYPZL.mjs")).wrapZenFSFileSystem({ backend: FolderBackend, path: dir, label: options.label });
355
355
  },
356
356
  {
357
357
  type: "Folder",
@@ -905,17 +905,12 @@ function sortKeysDeep(obj) {
905
905
  return sorted;
906
906
  }
907
907
  function identityOptions(type, options) {
908
- const meta = getBackendMetadata(type);
909
- const fields = meta?.identityFields;
910
- if (!fields || fields.length === 0) {
911
- log2.warn(`[DEDUP-DIAG] identityOptions(${type}): NO identityFields -> falling back to FULL options (dedup will be key-sensitive to tuning fields)`);
912
- return options ?? {};
913
- }
908
+ const fields = getBackendMetadata(type)?.identityFields;
909
+ if (!fields || fields.length === 0) return options ?? {};
914
910
  const subset = {};
915
911
  for (const f of fields) {
916
912
  if (options && options[f] !== void 0) subset[f] = options[f];
917
913
  }
918
- log2.log(`[DEDUP-DIAG] identityOptions(${type}): identityFields=${JSON.stringify(fields)} identitySubset=${JSON.stringify(subset)}`);
919
914
  return subset;
920
915
  }
921
916
  function backendDedupKey(desc) {
@@ -1954,22 +1949,18 @@ var ConfigRepo = class {
1954
1949
  const duplicates = [];
1955
1950
  for (const item of items) {
1956
1951
  const key = backendDedupKey(item.desc);
1957
- log2.log(`[DEDUP-DIAG] item id=${item.desc.id} type=${item.desc.type} dedupKey=${key} mtime=${item.mtime} rawOptions=${JSON.stringify(item.desc.options)}`);
1958
1952
  const existing = seen.get(key);
1959
1953
  if (existing) {
1960
1954
  if (item.mtime < existing.mtime) {
1961
- log2.log(`[DEDUP-DIAG] DUPLICATE: new id=${item.desc.id} (older) keeps key, dropping existing=${existing.desc.id}`);
1962
1955
  duplicates.push(existing.desc.id);
1963
1956
  seen.set(key, item);
1964
1957
  } else {
1965
- log2.log(`[DEDUP-DIAG] DUPLICATE: new id=${item.desc.id} dropped, kept=${existing.desc.id}`);
1966
1958
  duplicates.push(item.desc.id);
1967
1959
  }
1968
1960
  } else {
1969
1961
  seen.set(key, item);
1970
1962
  }
1971
1963
  }
1972
- log2.log(`[DEDUP-DIAG] dedup summary: keptKeys=${[...seen.keys()].length} duplicates=${JSON.stringify(duplicates)}`);
1973
1964
  if (duplicates.length > 0) {
1974
1965
  log2.log(
1975
1966
  `[ConfigRepo] readAllBackendDescriptors: removing ${duplicates.length} duplicate(s): ${duplicates.join(", ")}`
@@ -1979,13 +1970,10 @@ var ConfigRepo = class {
1979
1970
  for (const [replicaId, replica] of this.replicaBackends) {
1980
1971
  try {
1981
1972
  await replica.instance.unlink(descPath);
1982
- log2.log(`[DEDUP-DIAG] removed dup ${dupId} from replica ${replicaId}`);
1983
- } catch (e) {
1984
- log2.log(`[DEDUP-DIAG] remove dup ${dupId} from replica ${replicaId} failed/skipped: ${String(e)}`);
1973
+ } catch {
1985
1974
  }
1986
1975
  await this.unlinkVersionSidecar(replica.instance, descPath);
1987
1976
  }
1988
- log2.log(`[DEDUP-DIAG] replicaBackends available during removal: ${[...this.replicaBackends.keys()].join(",") || "(none)"}`);
1989
1977
  try {
1990
1978
  await this.deleteFile(descPath);
1991
1979
  } catch {
@@ -1994,8 +1982,7 @@ var ConfigRepo = class {
1994
1982
  }
1995
1983
  }
1996
1984
  return Array.from(seen.values()).map((i) => i.desc);
1997
- } catch (e) {
1998
- log2.error(`[DEDUP-DIAG] readAllBackendDescriptors threw, returning []:`, e);
1985
+ } catch {
1999
1986
  return [];
2000
1987
  }
2001
1988
  }
@@ -2599,7 +2586,6 @@ async function createConfigRepo(appId, options = {}) {
2599
2586
  log2.log(`[createConfigRepo] Migration complete`);
2600
2587
  }
2601
2588
  let allBackends = await tempRepo.readAllBackendDescriptors();
2602
- log2.log(`[DEDUP-DIAG] createConfigRepo after readAllBackendDescriptors: allBackends=${allBackends.map((b) => b.id).join(",")}`);
2603
2589
  if (options.backendInfo) {
2604
2590
  const replicaId = options.primaryBackendId || `${options.backendInfo.type}-replica`;
2605
2591
  const hasReplica = allBackends.some((b) => b.id === replicaId);
@@ -24360,7 +24360,8 @@ var ZenFSConfig = (() => {
24360
24360
  function registerBackend(type, factory, metadata) {
24361
24361
  registry.set(type, factory);
24362
24362
  if (metadata) {
24363
- metadataRegistry.set(type, metadata);
24363
+ const existing = metadataRegistry.get(type);
24364
+ metadataRegistry.set(type, { ...existing, ...metadata });
24364
24365
  }
24365
24366
  }
24366
24367
  function unregisterBackend(type) {
@@ -27293,17 +27294,12 @@ var ZenFSConfig = (() => {
27293
27294
  return sorted;
27294
27295
  }
27295
27296
  function identityOptions(type, options) {
27296
- const meta = getBackendMetadata(type);
27297
- const fields = meta?.identityFields;
27298
- if (!fields || fields.length === 0) {
27299
- log6.warn(`[DEDUP-DIAG] identityOptions(${type}): NO identityFields -> falling back to FULL options (dedup will be key-sensitive to tuning fields)`);
27300
- return options ?? {};
27301
- }
27297
+ const fields = getBackendMetadata(type)?.identityFields;
27298
+ if (!fields || fields.length === 0) return options ?? {};
27302
27299
  const subset = {};
27303
27300
  for (const f of fields) {
27304
27301
  if (options && options[f] !== void 0) subset[f] = options[f];
27305
27302
  }
27306
- log6.log(`[DEDUP-DIAG] identityOptions(${type}): identityFields=${JSON.stringify(fields)} identitySubset=${JSON.stringify(subset)}`);
27307
27303
  return subset;
27308
27304
  }
27309
27305
  function backendDedupKey(desc) {
@@ -28342,22 +28338,18 @@ var ZenFSConfig = (() => {
28342
28338
  const duplicates = [];
28343
28339
  for (const item of items) {
28344
28340
  const key = backendDedupKey(item.desc);
28345
- log6.log(`[DEDUP-DIAG] item id=${item.desc.id} type=${item.desc.type} dedupKey=${key} mtime=${item.mtime} rawOptions=${JSON.stringify(item.desc.options)}`);
28346
28341
  const existing = seen.get(key);
28347
28342
  if (existing) {
28348
28343
  if (item.mtime < existing.mtime) {
28349
- log6.log(`[DEDUP-DIAG] DUPLICATE: new id=${item.desc.id} (older) keeps key, dropping existing=${existing.desc.id}`);
28350
28344
  duplicates.push(existing.desc.id);
28351
28345
  seen.set(key, item);
28352
28346
  } else {
28353
- log6.log(`[DEDUP-DIAG] DUPLICATE: new id=${item.desc.id} dropped, kept=${existing.desc.id}`);
28354
28347
  duplicates.push(item.desc.id);
28355
28348
  }
28356
28349
  } else {
28357
28350
  seen.set(key, item);
28358
28351
  }
28359
28352
  }
28360
- log6.log(`[DEDUP-DIAG] dedup summary: keptKeys=${[...seen.keys()].length} duplicates=${JSON.stringify(duplicates)}`);
28361
28353
  if (duplicates.length > 0) {
28362
28354
  log6.log(
28363
28355
  `[ConfigRepo] readAllBackendDescriptors: removing ${duplicates.length} duplicate(s): ${duplicates.join(", ")}`
@@ -28367,13 +28359,10 @@ var ZenFSConfig = (() => {
28367
28359
  for (const [replicaId, replica] of this.replicaBackends) {
28368
28360
  try {
28369
28361
  await replica.instance.unlink(descPath);
28370
- log6.log(`[DEDUP-DIAG] removed dup ${dupId} from replica ${replicaId}`);
28371
- } catch (e) {
28372
- log6.log(`[DEDUP-DIAG] remove dup ${dupId} from replica ${replicaId} failed/skipped: ${String(e)}`);
28362
+ } catch {
28373
28363
  }
28374
28364
  await this.unlinkVersionSidecar(replica.instance, descPath);
28375
28365
  }
28376
- log6.log(`[DEDUP-DIAG] replicaBackends available during removal: ${[...this.replicaBackends.keys()].join(",") || "(none)"}`);
28377
28366
  try {
28378
28367
  await this.deleteFile(descPath);
28379
28368
  } catch {
@@ -28382,8 +28371,7 @@ var ZenFSConfig = (() => {
28382
28371
  }
28383
28372
  }
28384
28373
  return Array.from(seen.values()).map((i) => i.desc);
28385
- } catch (e) {
28386
- log6.error(`[DEDUP-DIAG] readAllBackendDescriptors threw, returning []:`, e);
28374
+ } catch {
28387
28375
  return [];
28388
28376
  }
28389
28377
  }
@@ -28987,7 +28975,6 @@ var ZenFSConfig = (() => {
28987
28975
  log6.log(`[createConfigRepo] Migration complete`);
28988
28976
  }
28989
28977
  let allBackends = await tempRepo.readAllBackendDescriptors();
28990
- log6.log(`[DEDUP-DIAG] createConfigRepo after readAllBackendDescriptors: allBackends=${allBackends.map((b) => b.id).join(",")}`);
28991
28978
  if (options.backendInfo) {
28992
28979
  const replicaId = options.primaryBackendId || `${options.backendInfo.type}-replica`;
28993
28980
  const hasReplica = allBackends.some((b) => b.id === replicaId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-fs-config",
3
- "version": "0.5.38",
3
+ "version": "0.5.39",
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",