zen-fs-config 0.5.37 → 0.5.38
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 +18 -4
- package/dist/index.mjs +18 -4
- package/dist/zen-fs-config.js +18 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1360,12 +1360,17 @@ function sortKeysDeep(obj) {
|
|
|
1360
1360
|
return sorted;
|
|
1361
1361
|
}
|
|
1362
1362
|
function identityOptions(type, options) {
|
|
1363
|
-
const
|
|
1364
|
-
|
|
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
|
+
}
|
|
1365
1369
|
const subset = {};
|
|
1366
1370
|
for (const f of fields) {
|
|
1367
1371
|
if (options && options[f] !== void 0) subset[f] = options[f];
|
|
1368
1372
|
}
|
|
1373
|
+
log2.log(`[DEDUP-DIAG] identityOptions(${type}): identityFields=${JSON.stringify(fields)} identitySubset=${JSON.stringify(subset)}`);
|
|
1369
1374
|
return subset;
|
|
1370
1375
|
}
|
|
1371
1376
|
function backendDedupKey(desc) {
|
|
@@ -2404,18 +2409,22 @@ var ConfigRepo = class {
|
|
|
2404
2409
|
const duplicates = [];
|
|
2405
2410
|
for (const item of items) {
|
|
2406
2411
|
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)}`);
|
|
2407
2413
|
const existing = seen.get(key);
|
|
2408
2414
|
if (existing) {
|
|
2409
2415
|
if (item.mtime < existing.mtime) {
|
|
2416
|
+
log2.log(`[DEDUP-DIAG] DUPLICATE: new id=${item.desc.id} (older) keeps key, dropping existing=${existing.desc.id}`);
|
|
2410
2417
|
duplicates.push(existing.desc.id);
|
|
2411
2418
|
seen.set(key, item);
|
|
2412
2419
|
} else {
|
|
2420
|
+
log2.log(`[DEDUP-DIAG] DUPLICATE: new id=${item.desc.id} dropped, kept=${existing.desc.id}`);
|
|
2413
2421
|
duplicates.push(item.desc.id);
|
|
2414
2422
|
}
|
|
2415
2423
|
} else {
|
|
2416
2424
|
seen.set(key, item);
|
|
2417
2425
|
}
|
|
2418
2426
|
}
|
|
2427
|
+
log2.log(`[DEDUP-DIAG] dedup summary: keptKeys=${[...seen.keys()].length} duplicates=${JSON.stringify(duplicates)}`);
|
|
2419
2428
|
if (duplicates.length > 0) {
|
|
2420
2429
|
log2.log(
|
|
2421
2430
|
`[ConfigRepo] readAllBackendDescriptors: removing ${duplicates.length} duplicate(s): ${duplicates.join(", ")}`
|
|
@@ -2425,10 +2434,13 @@ var ConfigRepo = class {
|
|
|
2425
2434
|
for (const [replicaId, replica] of this.replicaBackends) {
|
|
2426
2435
|
try {
|
|
2427
2436
|
await replica.instance.unlink(descPath);
|
|
2428
|
-
|
|
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
2440
|
}
|
|
2430
2441
|
await this.unlinkVersionSidecar(replica.instance, descPath);
|
|
2431
2442
|
}
|
|
2443
|
+
log2.log(`[DEDUP-DIAG] replicaBackends available during removal: ${[...this.replicaBackends.keys()].join(",") || "(none)"}`);
|
|
2432
2444
|
try {
|
|
2433
2445
|
await this.deleteFile(descPath);
|
|
2434
2446
|
} catch {
|
|
@@ -2437,7 +2449,8 @@ var ConfigRepo = class {
|
|
|
2437
2449
|
}
|
|
2438
2450
|
}
|
|
2439
2451
|
return Array.from(seen.values()).map((i) => i.desc);
|
|
2440
|
-
} catch {
|
|
2452
|
+
} catch (e) {
|
|
2453
|
+
log2.error(`[DEDUP-DIAG] readAllBackendDescriptors threw, returning []:`, e);
|
|
2441
2454
|
return [];
|
|
2442
2455
|
}
|
|
2443
2456
|
}
|
|
@@ -3041,6 +3054,7 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
3041
3054
|
log2.log(`[createConfigRepo] Migration complete`);
|
|
3042
3055
|
}
|
|
3043
3056
|
let allBackends = await tempRepo.readAllBackendDescriptors();
|
|
3057
|
+
log2.log(`[DEDUP-DIAG] createConfigRepo after readAllBackendDescriptors: allBackends=${allBackends.map((b) => b.id).join(",")}`);
|
|
3044
3058
|
if (options.backendInfo) {
|
|
3045
3059
|
const replicaId = options.primaryBackendId || `${options.backendInfo.type}-replica`;
|
|
3046
3060
|
const hasReplica = allBackends.some((b) => b.id === replicaId);
|
package/dist/index.mjs
CHANGED
|
@@ -905,12 +905,17 @@ function sortKeysDeep(obj) {
|
|
|
905
905
|
return sorted;
|
|
906
906
|
}
|
|
907
907
|
function identityOptions(type, options) {
|
|
908
|
-
const
|
|
909
|
-
|
|
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
|
+
}
|
|
910
914
|
const subset = {};
|
|
911
915
|
for (const f of fields) {
|
|
912
916
|
if (options && options[f] !== void 0) subset[f] = options[f];
|
|
913
917
|
}
|
|
918
|
+
log2.log(`[DEDUP-DIAG] identityOptions(${type}): identityFields=${JSON.stringify(fields)} identitySubset=${JSON.stringify(subset)}`);
|
|
914
919
|
return subset;
|
|
915
920
|
}
|
|
916
921
|
function backendDedupKey(desc) {
|
|
@@ -1949,18 +1954,22 @@ var ConfigRepo = class {
|
|
|
1949
1954
|
const duplicates = [];
|
|
1950
1955
|
for (const item of items) {
|
|
1951
1956
|
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)}`);
|
|
1952
1958
|
const existing = seen.get(key);
|
|
1953
1959
|
if (existing) {
|
|
1954
1960
|
if (item.mtime < existing.mtime) {
|
|
1961
|
+
log2.log(`[DEDUP-DIAG] DUPLICATE: new id=${item.desc.id} (older) keeps key, dropping existing=${existing.desc.id}`);
|
|
1955
1962
|
duplicates.push(existing.desc.id);
|
|
1956
1963
|
seen.set(key, item);
|
|
1957
1964
|
} else {
|
|
1965
|
+
log2.log(`[DEDUP-DIAG] DUPLICATE: new id=${item.desc.id} dropped, kept=${existing.desc.id}`);
|
|
1958
1966
|
duplicates.push(item.desc.id);
|
|
1959
1967
|
}
|
|
1960
1968
|
} else {
|
|
1961
1969
|
seen.set(key, item);
|
|
1962
1970
|
}
|
|
1963
1971
|
}
|
|
1972
|
+
log2.log(`[DEDUP-DIAG] dedup summary: keptKeys=${[...seen.keys()].length} duplicates=${JSON.stringify(duplicates)}`);
|
|
1964
1973
|
if (duplicates.length > 0) {
|
|
1965
1974
|
log2.log(
|
|
1966
1975
|
`[ConfigRepo] readAllBackendDescriptors: removing ${duplicates.length} duplicate(s): ${duplicates.join(", ")}`
|
|
@@ -1970,10 +1979,13 @@ var ConfigRepo = class {
|
|
|
1970
1979
|
for (const [replicaId, replica] of this.replicaBackends) {
|
|
1971
1980
|
try {
|
|
1972
1981
|
await replica.instance.unlink(descPath);
|
|
1973
|
-
|
|
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)}`);
|
|
1974
1985
|
}
|
|
1975
1986
|
await this.unlinkVersionSidecar(replica.instance, descPath);
|
|
1976
1987
|
}
|
|
1988
|
+
log2.log(`[DEDUP-DIAG] replicaBackends available during removal: ${[...this.replicaBackends.keys()].join(",") || "(none)"}`);
|
|
1977
1989
|
try {
|
|
1978
1990
|
await this.deleteFile(descPath);
|
|
1979
1991
|
} catch {
|
|
@@ -1982,7 +1994,8 @@ var ConfigRepo = class {
|
|
|
1982
1994
|
}
|
|
1983
1995
|
}
|
|
1984
1996
|
return Array.from(seen.values()).map((i) => i.desc);
|
|
1985
|
-
} catch {
|
|
1997
|
+
} catch (e) {
|
|
1998
|
+
log2.error(`[DEDUP-DIAG] readAllBackendDescriptors threw, returning []:`, e);
|
|
1986
1999
|
return [];
|
|
1987
2000
|
}
|
|
1988
2001
|
}
|
|
@@ -2586,6 +2599,7 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
2586
2599
|
log2.log(`[createConfigRepo] Migration complete`);
|
|
2587
2600
|
}
|
|
2588
2601
|
let allBackends = await tempRepo.readAllBackendDescriptors();
|
|
2602
|
+
log2.log(`[DEDUP-DIAG] createConfigRepo after readAllBackendDescriptors: allBackends=${allBackends.map((b) => b.id).join(",")}`);
|
|
2589
2603
|
if (options.backendInfo) {
|
|
2590
2604
|
const replicaId = options.primaryBackendId || `${options.backendInfo.type}-replica`;
|
|
2591
2605
|
const hasReplica = allBackends.some((b) => b.id === replicaId);
|
package/dist/zen-fs-config.js
CHANGED
|
@@ -27293,12 +27293,17 @@ var ZenFSConfig = (() => {
|
|
|
27293
27293
|
return sorted;
|
|
27294
27294
|
}
|
|
27295
27295
|
function identityOptions(type, options) {
|
|
27296
|
-
const
|
|
27297
|
-
|
|
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
|
+
}
|
|
27298
27302
|
const subset = {};
|
|
27299
27303
|
for (const f of fields) {
|
|
27300
27304
|
if (options && options[f] !== void 0) subset[f] = options[f];
|
|
27301
27305
|
}
|
|
27306
|
+
log6.log(`[DEDUP-DIAG] identityOptions(${type}): identityFields=${JSON.stringify(fields)} identitySubset=${JSON.stringify(subset)}`);
|
|
27302
27307
|
return subset;
|
|
27303
27308
|
}
|
|
27304
27309
|
function backendDedupKey(desc) {
|
|
@@ -28337,18 +28342,22 @@ var ZenFSConfig = (() => {
|
|
|
28337
28342
|
const duplicates = [];
|
|
28338
28343
|
for (const item of items) {
|
|
28339
28344
|
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)}`);
|
|
28340
28346
|
const existing = seen.get(key);
|
|
28341
28347
|
if (existing) {
|
|
28342
28348
|
if (item.mtime < existing.mtime) {
|
|
28349
|
+
log6.log(`[DEDUP-DIAG] DUPLICATE: new id=${item.desc.id} (older) keeps key, dropping existing=${existing.desc.id}`);
|
|
28343
28350
|
duplicates.push(existing.desc.id);
|
|
28344
28351
|
seen.set(key, item);
|
|
28345
28352
|
} else {
|
|
28353
|
+
log6.log(`[DEDUP-DIAG] DUPLICATE: new id=${item.desc.id} dropped, kept=${existing.desc.id}`);
|
|
28346
28354
|
duplicates.push(item.desc.id);
|
|
28347
28355
|
}
|
|
28348
28356
|
} else {
|
|
28349
28357
|
seen.set(key, item);
|
|
28350
28358
|
}
|
|
28351
28359
|
}
|
|
28360
|
+
log6.log(`[DEDUP-DIAG] dedup summary: keptKeys=${[...seen.keys()].length} duplicates=${JSON.stringify(duplicates)}`);
|
|
28352
28361
|
if (duplicates.length > 0) {
|
|
28353
28362
|
log6.log(
|
|
28354
28363
|
`[ConfigRepo] readAllBackendDescriptors: removing ${duplicates.length} duplicate(s): ${duplicates.join(", ")}`
|
|
@@ -28358,10 +28367,13 @@ var ZenFSConfig = (() => {
|
|
|
28358
28367
|
for (const [replicaId, replica] of this.replicaBackends) {
|
|
28359
28368
|
try {
|
|
28360
28369
|
await replica.instance.unlink(descPath);
|
|
28361
|
-
|
|
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
28373
|
}
|
|
28363
28374
|
await this.unlinkVersionSidecar(replica.instance, descPath);
|
|
28364
28375
|
}
|
|
28376
|
+
log6.log(`[DEDUP-DIAG] replicaBackends available during removal: ${[...this.replicaBackends.keys()].join(",") || "(none)"}`);
|
|
28365
28377
|
try {
|
|
28366
28378
|
await this.deleteFile(descPath);
|
|
28367
28379
|
} catch {
|
|
@@ -28370,7 +28382,8 @@ var ZenFSConfig = (() => {
|
|
|
28370
28382
|
}
|
|
28371
28383
|
}
|
|
28372
28384
|
return Array.from(seen.values()).map((i) => i.desc);
|
|
28373
|
-
} catch {
|
|
28385
|
+
} catch (e) {
|
|
28386
|
+
log6.error(`[DEDUP-DIAG] readAllBackendDescriptors threw, returning []:`, e);
|
|
28374
28387
|
return [];
|
|
28375
28388
|
}
|
|
28376
28389
|
}
|
|
@@ -28974,6 +28987,7 @@ var ZenFSConfig = (() => {
|
|
|
28974
28987
|
log6.log(`[createConfigRepo] Migration complete`);
|
|
28975
28988
|
}
|
|
28976
28989
|
let allBackends = await tempRepo.readAllBackendDescriptors();
|
|
28990
|
+
log6.log(`[DEDUP-DIAG] createConfigRepo after readAllBackendDescriptors: allBackends=${allBackends.map((b) => b.id).join(",")}`);
|
|
28977
28991
|
if (options.backendInfo) {
|
|
28978
28992
|
const replicaId = options.primaryBackendId || `${options.backendInfo.type}-replica`;
|
|
28979
28993
|
const hasReplica = allBackends.some((b) => b.id === replicaId);
|