zen-fs-config 0.7.6 → 0.7.7
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 +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +24 -0
- package/dist/index.mjs +24 -0
- package/dist/zen-fs-config.js +24 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -631,6 +631,15 @@ interface IConfigRepo {
|
|
|
631
631
|
* instead of being treated as a "missing file" that gets re-created.
|
|
632
632
|
*/
|
|
633
633
|
deleteFile(path: string): Promise<void>;
|
|
634
|
+
/**
|
|
635
|
+
* Write a repo-root file (`/.config/...`, `/.meta/...`, `/shared/...`) at its
|
|
636
|
+
* real path and record its `.version` sidecar.
|
|
637
|
+
*
|
|
638
|
+
* Distinct from `setConfig(path)`, which prefixes `/${appId}` and is meant for
|
|
639
|
+
* app payload keys; using it for root paths writes to a shadow location
|
|
640
|
+
* (`/admin/.config/...`) that nothing reads.
|
|
641
|
+
*/
|
|
642
|
+
writeRepoFile(path: string, data: string | Uint8Array): Promise<void>;
|
|
634
643
|
/**
|
|
635
644
|
* Sync .meta/ files (backends.json) to all replica backends.
|
|
636
645
|
* Called automatically by createConfigRepo() after setupSync().
|
|
@@ -1243,6 +1252,17 @@ declare class ConfigRepo implements IConfigRepo {
|
|
|
1243
1252
|
ensureDir(filePath: string): Promise<void>;
|
|
1244
1253
|
private walkDir;
|
|
1245
1254
|
writeMetaFile(path: string, data: unknown): Promise<void>;
|
|
1255
|
+
/**
|
|
1256
|
+
* 写仓库根级文件(`/.config/...`、`/.meta/...`、`/shared/...` 等,不是 app 载荷)。
|
|
1257
|
+
*
|
|
1258
|
+
* 与 `setConfig()` 的区别:`setConfig(path)` 会把路径拼成 `/${appId}${path}`,
|
|
1259
|
+
* 是给应用自己的配置键用的;根级文件必须落在 cachedFS 的真实路径上,否则编辑
|
|
1260
|
+
* 会写进 `/admin/.config/...` 之类的影子目录(读的地方看不到,文件"改了又没改")。
|
|
1261
|
+
*
|
|
1262
|
+
* 落盘后按同一套机制记录 `.version` 边车(作者为 `appId/nodeId`),
|
|
1263
|
+
* 与内部写描述符 / 元数据的行为一致。
|
|
1264
|
+
*/
|
|
1265
|
+
writeRepoFile(path: string, data: string | Uint8Array): Promise<void>;
|
|
1246
1266
|
readMetaFile<T>(path: string): Promise<T | null>;
|
|
1247
1267
|
/** Read a text file; `null` when absent (used for byte-compare-then-write). */
|
|
1248
1268
|
private readTextIfExists;
|
package/dist/index.d.ts
CHANGED
|
@@ -631,6 +631,15 @@ interface IConfigRepo {
|
|
|
631
631
|
* instead of being treated as a "missing file" that gets re-created.
|
|
632
632
|
*/
|
|
633
633
|
deleteFile(path: string): Promise<void>;
|
|
634
|
+
/**
|
|
635
|
+
* Write a repo-root file (`/.config/...`, `/.meta/...`, `/shared/...`) at its
|
|
636
|
+
* real path and record its `.version` sidecar.
|
|
637
|
+
*
|
|
638
|
+
* Distinct from `setConfig(path)`, which prefixes `/${appId}` and is meant for
|
|
639
|
+
* app payload keys; using it for root paths writes to a shadow location
|
|
640
|
+
* (`/admin/.config/...`) that nothing reads.
|
|
641
|
+
*/
|
|
642
|
+
writeRepoFile(path: string, data: string | Uint8Array): Promise<void>;
|
|
634
643
|
/**
|
|
635
644
|
* Sync .meta/ files (backends.json) to all replica backends.
|
|
636
645
|
* Called automatically by createConfigRepo() after setupSync().
|
|
@@ -1243,6 +1252,17 @@ declare class ConfigRepo implements IConfigRepo {
|
|
|
1243
1252
|
ensureDir(filePath: string): Promise<void>;
|
|
1244
1253
|
private walkDir;
|
|
1245
1254
|
writeMetaFile(path: string, data: unknown): Promise<void>;
|
|
1255
|
+
/**
|
|
1256
|
+
* 写仓库根级文件(`/.config/...`、`/.meta/...`、`/shared/...` 等,不是 app 载荷)。
|
|
1257
|
+
*
|
|
1258
|
+
* 与 `setConfig()` 的区别:`setConfig(path)` 会把路径拼成 `/${appId}${path}`,
|
|
1259
|
+
* 是给应用自己的配置键用的;根级文件必须落在 cachedFS 的真实路径上,否则编辑
|
|
1260
|
+
* 会写进 `/admin/.config/...` 之类的影子目录(读的地方看不到,文件"改了又没改")。
|
|
1261
|
+
*
|
|
1262
|
+
* 落盘后按同一套机制记录 `.version` 边车(作者为 `appId/nodeId`),
|
|
1263
|
+
* 与内部写描述符 / 元数据的行为一致。
|
|
1264
|
+
*/
|
|
1265
|
+
writeRepoFile(path: string, data: string | Uint8Array): Promise<void>;
|
|
1246
1266
|
readMetaFile<T>(path: string): Promise<T | null>;
|
|
1247
1267
|
/** Read a text file; `null` when absent (used for byte-compare-then-write). */
|
|
1248
1268
|
private readTextIfExists;
|
package/dist/index.js
CHANGED
|
@@ -3915,6 +3915,30 @@ var ConfigRepo = class {
|
|
|
3915
3915
|
const version = await incrementVersion(this.fullFS, path, bytes, author);
|
|
3916
3916
|
await this.writeVersionSidecar(path, version);
|
|
3917
3917
|
}
|
|
3918
|
+
/**
|
|
3919
|
+
* 写仓库根级文件(`/.config/...`、`/.meta/...`、`/shared/...` 等,不是 app 载荷)。
|
|
3920
|
+
*
|
|
3921
|
+
* 与 `setConfig()` 的区别:`setConfig(path)` 会把路径拼成 `/${appId}${path}`,
|
|
3922
|
+
* 是给应用自己的配置键用的;根级文件必须落在 cachedFS 的真实路径上,否则编辑
|
|
3923
|
+
* 会写进 `/admin/.config/...` 之类的影子目录(读的地方看不到,文件"改了又没改")。
|
|
3924
|
+
*
|
|
3925
|
+
* 落盘后按同一套机制记录 `.version` 边车(作者为 `appId/nodeId`),
|
|
3926
|
+
* 与内部写描述符 / 元数据的行为一致。
|
|
3927
|
+
*/
|
|
3928
|
+
async writeRepoFile(path, data) {
|
|
3929
|
+
this.assertNotDisposed();
|
|
3930
|
+
const p = path.startsWith("/") ? path : `/${path}`;
|
|
3931
|
+
const bytes = typeof data === "string" ? new TextEncoder().encode(data) : data;
|
|
3932
|
+
await this.ensureDir(p);
|
|
3933
|
+
await this.cachedFS.writeFile(p, bytes);
|
|
3934
|
+
const author = `${this.appId}/${this.nodeId}`;
|
|
3935
|
+
try {
|
|
3936
|
+
const version = await incrementVersion(this.fullFS, p, bytes, author);
|
|
3937
|
+
await this.writeVersionSidecar(p, version);
|
|
3938
|
+
} catch (err) {
|
|
3939
|
+
log5.warn(`[ConfigRepo] writeRepoFile: version sidecar failed for ${p}:`, err);
|
|
3940
|
+
}
|
|
3941
|
+
}
|
|
3918
3942
|
async readMetaFile(path) {
|
|
3919
3943
|
try {
|
|
3920
3944
|
const raw = await this.cachedFS.readFile(path);
|
package/dist/index.mjs
CHANGED
|
@@ -3340,6 +3340,30 @@ var ConfigRepo = class {
|
|
|
3340
3340
|
const version = await incrementVersion(this.fullFS, path, bytes, author);
|
|
3341
3341
|
await this.writeVersionSidecar(path, version);
|
|
3342
3342
|
}
|
|
3343
|
+
/**
|
|
3344
|
+
* 写仓库根级文件(`/.config/...`、`/.meta/...`、`/shared/...` 等,不是 app 载荷)。
|
|
3345
|
+
*
|
|
3346
|
+
* 与 `setConfig()` 的区别:`setConfig(path)` 会把路径拼成 `/${appId}${path}`,
|
|
3347
|
+
* 是给应用自己的配置键用的;根级文件必须落在 cachedFS 的真实路径上,否则编辑
|
|
3348
|
+
* 会写进 `/admin/.config/...` 之类的影子目录(读的地方看不到,文件"改了又没改")。
|
|
3349
|
+
*
|
|
3350
|
+
* 落盘后按同一套机制记录 `.version` 边车(作者为 `appId/nodeId`),
|
|
3351
|
+
* 与内部写描述符 / 元数据的行为一致。
|
|
3352
|
+
*/
|
|
3353
|
+
async writeRepoFile(path, data) {
|
|
3354
|
+
this.assertNotDisposed();
|
|
3355
|
+
const p = path.startsWith("/") ? path : `/${path}`;
|
|
3356
|
+
const bytes = typeof data === "string" ? new TextEncoder().encode(data) : data;
|
|
3357
|
+
await this.ensureDir(p);
|
|
3358
|
+
await this.cachedFS.writeFile(p, bytes);
|
|
3359
|
+
const author = `${this.appId}/${this.nodeId}`;
|
|
3360
|
+
try {
|
|
3361
|
+
const version = await incrementVersion(this.fullFS, p, bytes, author);
|
|
3362
|
+
await this.writeVersionSidecar(p, version);
|
|
3363
|
+
} catch (err) {
|
|
3364
|
+
log5.warn(`[ConfigRepo] writeRepoFile: version sidecar failed for ${p}:`, err);
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3343
3367
|
async readMetaFile(path) {
|
|
3344
3368
|
try {
|
|
3345
3369
|
const raw = await this.cachedFS.readFile(path);
|
package/dist/zen-fs-config.js
CHANGED
|
@@ -29872,6 +29872,30 @@ var ZenFSConfig = (() => {
|
|
|
29872
29872
|
const version2 = await incrementVersion(this.fullFS, path, bytes, author);
|
|
29873
29873
|
await this.writeVersionSidecar(path, version2);
|
|
29874
29874
|
}
|
|
29875
|
+
/**
|
|
29876
|
+
* 写仓库根级文件(`/.config/...`、`/.meta/...`、`/shared/...` 等,不是 app 载荷)。
|
|
29877
|
+
*
|
|
29878
|
+
* 与 `setConfig()` 的区别:`setConfig(path)` 会把路径拼成 `/${appId}${path}`,
|
|
29879
|
+
* 是给应用自己的配置键用的;根级文件必须落在 cachedFS 的真实路径上,否则编辑
|
|
29880
|
+
* 会写进 `/admin/.config/...` 之类的影子目录(读的地方看不到,文件"改了又没改")。
|
|
29881
|
+
*
|
|
29882
|
+
* 落盘后按同一套机制记录 `.version` 边车(作者为 `appId/nodeId`),
|
|
29883
|
+
* 与内部写描述符 / 元数据的行为一致。
|
|
29884
|
+
*/
|
|
29885
|
+
async writeRepoFile(path, data) {
|
|
29886
|
+
this.assertNotDisposed();
|
|
29887
|
+
const p = path.startsWith("/") ? path : `/${path}`;
|
|
29888
|
+
const bytes = typeof data === "string" ? new TextEncoder().encode(data) : data;
|
|
29889
|
+
await this.ensureDir(p);
|
|
29890
|
+
await this.cachedFS.writeFile(p, bytes);
|
|
29891
|
+
const author = `${this.appId}/${this.nodeId}`;
|
|
29892
|
+
try {
|
|
29893
|
+
const version2 = await incrementVersion(this.fullFS, p, bytes, author);
|
|
29894
|
+
await this.writeVersionSidecar(p, version2);
|
|
29895
|
+
} catch (err2) {
|
|
29896
|
+
log9.warn(`[ConfigRepo] writeRepoFile: version sidecar failed for ${p}:`, err2);
|
|
29897
|
+
}
|
|
29898
|
+
}
|
|
29875
29899
|
async readMetaFile(path) {
|
|
29876
29900
|
try {
|
|
29877
29901
|
const raw = await this.cachedFS.readFile(path);
|