zen-fs-config 0.3.27 → 0.3.29

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
@@ -150,14 +150,10 @@ function createChrootFS(inner, root) {
150
150
  },
151
151
  async stat(path) {
152
152
  const s = await inner.stat(rp(path));
153
- if (typeof s.isFile === "function" && typeof s.isDirectory === "function") {
154
- return s;
155
- }
156
- const isDir = typeof s.isDirectory === "function" ? s.isDirectory() : typeof s.isDirectory === "boolean" ? s.isDirectory : s.mode !== void 0 && (s.mode & 61440) === 16384;
157
153
  return {
158
- ...s,
159
- isFile: () => !isDir,
160
- isDirectory: () => isDir
154
+ mode: typeof s.mode === "number" ? s.mode : void 0,
155
+ size: s.size ?? 0,
156
+ mtimeMs: s.mtimeMs ?? s.mtime ?? 0
161
157
  };
162
158
  },
163
159
  async access(path) {
@@ -995,14 +991,10 @@ var ConfigRepo = class {
995
991
  for (const part of parts) {
996
992
  current += `/${part}`;
997
993
  const exists = await this.fullFS.exists(current);
998
- console.log(`[ensureDir] ${current} exists=${exists}`);
999
994
  if (!exists) {
1000
995
  try {
1001
- console.log(`[ensureDir] mkdir(${current})`);
1002
996
  await this.fullFS.mkdir(current);
1003
- console.log(`[ensureDir] mkdir(${current}) OK`);
1004
- } catch (err) {
1005
- console.error(`[ensureDir] mkdir(${current}) FAILED:`, err.message);
997
+ } catch {
1006
998
  }
1007
999
  }
1008
1000
  }
@@ -1019,9 +1011,9 @@ var ConfigRepo = class {
1019
1011
  const fullPath = current === "/" ? `/${entry}` : `${current}/${entry}`;
1020
1012
  try {
1021
1013
  const stat = await this.cachedFS.stat(fullPath);
1022
- if (stat.isDirectory()) {
1014
+ if (stat.mode !== void 0 && (stat.mode & 16384) === 16384) {
1023
1015
  stack.push(fullPath);
1024
- } else if (stat.isFile()) {
1016
+ } else {
1025
1017
  results.push(fullPath);
1026
1018
  }
1027
1019
  } catch {
@@ -1033,16 +1025,13 @@ var ConfigRepo = class {
1033
1025
  return results;
1034
1026
  }
1035
1027
  async writeMetaFile(path, data) {
1036
- console.log(`[writeMetaFile] ${path}, ensuring dir...`);
1037
1028
  await this.ensureDir(path);
1038
1029
  const bytes = new TextEncoder().encode(JSON.stringify(data, null, 2));
1039
- console.log(`[writeMetaFile] ${path}, writing ${bytes.length} bytes...`);
1040
1030
  await this.cachedFS.writeFile(path, bytes);
1041
1031
  const author = `${this.appId}/${this.nodeId}`;
1042
1032
  const version = await incrementVersion(this.fullFS, path, bytes, author);
1043
1033
  await this.ensureDir(versionPathFor(path));
1044
1034
  await writeVersion(this.fullFS, versionPathFor(path), version);
1045
- console.log(`[writeMetaFile] ${path} done (version=${version.version})`);
1046
1035
  }
1047
1036
  async readMetaFile(path) {
1048
1037
  try {
package/dist/index.mjs CHANGED
@@ -101,14 +101,10 @@ function createChrootFS(inner, root) {
101
101
  },
102
102
  async stat(path) {
103
103
  const s = await inner.stat(rp(path));
104
- if (typeof s.isFile === "function" && typeof s.isDirectory === "function") {
105
- return s;
106
- }
107
- const isDir = typeof s.isDirectory === "function" ? s.isDirectory() : typeof s.isDirectory === "boolean" ? s.isDirectory : s.mode !== void 0 && (s.mode & 61440) === 16384;
108
104
  return {
109
- ...s,
110
- isFile: () => !isDir,
111
- isDirectory: () => isDir
105
+ mode: typeof s.mode === "number" ? s.mode : void 0,
106
+ size: s.size ?? 0,
107
+ mtimeMs: s.mtimeMs ?? s.mtime ?? 0
112
108
  };
113
109
  },
114
110
  async access(path) {
@@ -946,14 +942,10 @@ var ConfigRepo = class {
946
942
  for (const part of parts) {
947
943
  current += `/${part}`;
948
944
  const exists = await this.fullFS.exists(current);
949
- console.log(`[ensureDir] ${current} exists=${exists}`);
950
945
  if (!exists) {
951
946
  try {
952
- console.log(`[ensureDir] mkdir(${current})`);
953
947
  await this.fullFS.mkdir(current);
954
- console.log(`[ensureDir] mkdir(${current}) OK`);
955
- } catch (err) {
956
- console.error(`[ensureDir] mkdir(${current}) FAILED:`, err.message);
948
+ } catch {
957
949
  }
958
950
  }
959
951
  }
@@ -970,9 +962,9 @@ var ConfigRepo = class {
970
962
  const fullPath = current === "/" ? `/${entry}` : `${current}/${entry}`;
971
963
  try {
972
964
  const stat = await this.cachedFS.stat(fullPath);
973
- if (stat.isDirectory()) {
965
+ if (stat.mode !== void 0 && (stat.mode & 16384) === 16384) {
974
966
  stack.push(fullPath);
975
- } else if (stat.isFile()) {
967
+ } else {
976
968
  results.push(fullPath);
977
969
  }
978
970
  } catch {
@@ -984,16 +976,13 @@ var ConfigRepo = class {
984
976
  return results;
985
977
  }
986
978
  async writeMetaFile(path, data) {
987
- console.log(`[writeMetaFile] ${path}, ensuring dir...`);
988
979
  await this.ensureDir(path);
989
980
  const bytes = new TextEncoder().encode(JSON.stringify(data, null, 2));
990
- console.log(`[writeMetaFile] ${path}, writing ${bytes.length} bytes...`);
991
981
  await this.cachedFS.writeFile(path, bytes);
992
982
  const author = `${this.appId}/${this.nodeId}`;
993
983
  const version = await incrementVersion(this.fullFS, path, bytes, author);
994
984
  await this.ensureDir(versionPathFor(path));
995
985
  await writeVersion(this.fullFS, versionPathFor(path), version);
996
- console.log(`[writeMetaFile] ${path} done (version=${version.version})`);
997
986
  }
998
987
  async readMetaFile(path) {
999
988
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-fs-config",
3
- "version": "0.3.27",
3
+ "version": "0.3.29",
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",