zen-fs-config 0.5.25 → 0.5.27

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
@@ -22,7 +22,7 @@ interface BackendsMeta {
22
22
  }
23
23
  /** Content of a sidecar `.version` file. */
24
24
  interface VersionMeta {
25
- /** Monotonically increasing version number. */
25
+ /** Version number; increases only when the config content hash changes. */
26
26
  version: number;
27
27
  /** SHA-256 hash of the corresponding config file content. */
28
28
  hash: string;
package/dist/index.d.ts CHANGED
@@ -22,7 +22,7 @@ interface BackendsMeta {
22
22
  }
23
23
  /** Content of a sidecar `.version` file. */
24
24
  interface VersionMeta {
25
- /** Monotonically increasing version number. */
25
+ /** Version number; increases only when the config content hash changes. */
26
26
  version: number;
27
27
  /** SHA-256 hash of the corresponding config file content. */
28
28
  hash: string;
package/dist/index.js CHANGED
@@ -963,6 +963,9 @@ async function incrementVersion(fs, configFilePath, newContent, author) {
963
963
  const vPath = versionPathFor(configFilePath);
964
964
  const prev = vPath ? await readVersion(fs, vPath) : null;
965
965
  const hash = await sha256(newContent);
966
+ if (prev && prev.hash === hash) {
967
+ return prev;
968
+ }
966
969
  return {
967
970
  version: (prev?.version ?? 0) + 1,
968
971
  hash,
@@ -1695,6 +1698,15 @@ var ConfigRepo = class {
1695
1698
  async writeVersionSidecar(configPath, version) {
1696
1699
  const vPath = versionPathFor(configPath);
1697
1700
  if (!vPath) return;
1701
+ try {
1702
+ const existing = await readVersion(this.fullFS, vPath);
1703
+ if (existing && existing.hash === version.hash) {
1704
+ log2.log("[ConfigRepo] skip version sidecar (hash unchanged):", vPath);
1705
+ return;
1706
+ }
1707
+ } catch {
1708
+ }
1709
+ log2.log("[ConfigRepo] write version sidecar:", vPath, "v" + version.version);
1698
1710
  await this.ensureDir(vPath);
1699
1711
  await writeVersion(this.fullFS, vPath, version);
1700
1712
  }
package/dist/index.mjs CHANGED
@@ -569,6 +569,9 @@ async function incrementVersion(fs, configFilePath, newContent, author) {
569
569
  const vPath = versionPathFor(configFilePath);
570
570
  const prev = vPath ? await readVersion(fs, vPath) : null;
571
571
  const hash = await sha256(newContent);
572
+ if (prev && prev.hash === hash) {
573
+ return prev;
574
+ }
572
575
  return {
573
576
  version: (prev?.version ?? 0) + 1,
574
577
  hash,
@@ -1301,6 +1304,15 @@ var ConfigRepo = class {
1301
1304
  async writeVersionSidecar(configPath, version) {
1302
1305
  const vPath = versionPathFor(configPath);
1303
1306
  if (!vPath) return;
1307
+ try {
1308
+ const existing = await readVersion(this.fullFS, vPath);
1309
+ if (existing && existing.hash === version.hash) {
1310
+ log2.log("[ConfigRepo] skip version sidecar (hash unchanged):", vPath);
1311
+ return;
1312
+ }
1313
+ } catch {
1314
+ }
1315
+ log2.log("[ConfigRepo] write version sidecar:", vPath, "v" + version.version);
1304
1316
  await this.ensureDir(vPath);
1305
1317
  await writeVersion(this.fullFS, vPath, version);
1306
1318
  }
@@ -26840,6 +26840,9 @@ var ZenFSConfig = (() => {
26840
26840
  const vPath = versionPathFor(configFilePath);
26841
26841
  const prev = vPath ? await readVersion(fs, vPath) : null;
26842
26842
  const hash = await sha256(newContent);
26843
+ if (prev && prev.hash === hash) {
26844
+ return prev;
26845
+ }
26843
26846
  return {
26844
26847
  version: (prev?.version ?? 0) + 1,
26845
26848
  hash,
@@ -27572,6 +27575,15 @@ var ZenFSConfig = (() => {
27572
27575
  async writeVersionSidecar(configPath, version2) {
27573
27576
  const vPath = versionPathFor(configPath);
27574
27577
  if (!vPath) return;
27578
+ try {
27579
+ const existing = await readVersion(this.fullFS, vPath);
27580
+ if (existing && existing.hash === version2.hash) {
27581
+ log6.log("[ConfigRepo] skip version sidecar (hash unchanged):", vPath);
27582
+ return;
27583
+ }
27584
+ } catch {
27585
+ }
27586
+ log6.log("[ConfigRepo] write version sidecar:", vPath, "v" + version2.version);
27575
27587
  await this.ensureDir(vPath);
27576
27588
  await writeVersion(this.fullFS, vPath, version2);
27577
27589
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-fs-config",
3
- "version": "0.5.25",
3
+ "version": "0.5.27",
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",