zen-fs-config 0.5.25 → 0.5.26

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,11 @@ 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) return;
1704
+ } catch {
1705
+ }
1698
1706
  await this.ensureDir(vPath);
1699
1707
  await writeVersion(this.fullFS, vPath, version);
1700
1708
  }
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,11 @@ 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) return;
1310
+ } catch {
1311
+ }
1304
1312
  await this.ensureDir(vPath);
1305
1313
  await writeVersion(this.fullFS, vPath, version);
1306
1314
  }
@@ -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,11 @@ 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) return;
27581
+ } catch {
27582
+ }
27575
27583
  await this.ensureDir(vPath);
27576
27584
  await writeVersion(this.fullFS, vPath, version2);
27577
27585
  }
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.26",
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",