zen-fs-config 0.7.16 → 0.7.18
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 +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +27 -15
- package/dist/index.mjs +27 -15
- package/dist/zen-fs-config.js +27 -15
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1820,7 +1820,12 @@ interface IdentityBindingResult {
|
|
|
1820
1820
|
unreadable?: boolean;
|
|
1821
1821
|
error?: string;
|
|
1822
1822
|
}
|
|
1823
|
-
/**
|
|
1823
|
+
/**
|
|
1824
|
+
* `kind=config · id=config · 实例 ID 665532a0-…` 这类一行摘要。
|
|
1825
|
+
*
|
|
1826
|
+
* 实例 ID **给完整 UUID**:界面上要靠它区分「是同一个还是另一个」,
|
|
1827
|
+
* 截成前 8 位反而让人没法核对(`…` 也容易被误当成「同一个」)。
|
|
1828
|
+
*/
|
|
1824
1829
|
declare function summarizeIdentity(identity: {
|
|
1825
1830
|
kind?: string;
|
|
1826
1831
|
id?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1820,7 +1820,12 @@ interface IdentityBindingResult {
|
|
|
1820
1820
|
unreadable?: boolean;
|
|
1821
1821
|
error?: string;
|
|
1822
1822
|
}
|
|
1823
|
-
/**
|
|
1823
|
+
/**
|
|
1824
|
+
* `kind=config · id=config · 实例 ID 665532a0-…` 这类一行摘要。
|
|
1825
|
+
*
|
|
1826
|
+
* 实例 ID **给完整 UUID**:界面上要靠它区分「是同一个还是另一个」,
|
|
1827
|
+
* 截成前 8 位反而让人没法核对(`…` 也容易被误当成「同一个」)。
|
|
1828
|
+
*/
|
|
1824
1829
|
declare function summarizeIdentity(identity: {
|
|
1825
1830
|
kind?: string;
|
|
1826
1831
|
id?: string;
|
package/dist/index.js
CHANGED
|
@@ -2490,7 +2490,7 @@ function summarizeIdentity(identity) {
|
|
|
2490
2490
|
const parts = [
|
|
2491
2491
|
`kind=${identity.kind ?? "?"}`,
|
|
2492
2492
|
`id=${identity.id ?? "?"}`,
|
|
2493
|
-
`\u5B9E\u4F8B ID=${identity.instanceId
|
|
2493
|
+
`\u5B9E\u4F8B ID=${identity.instanceId ?? "\uFF08\u65E0\uFF09"}`
|
|
2494
2494
|
];
|
|
2495
2495
|
return parts.join(" \xB7 ");
|
|
2496
2496
|
}
|
|
@@ -5032,10 +5032,9 @@ var ConfigRepo = class {
|
|
|
5032
5032
|
}
|
|
5033
5033
|
}
|
|
5034
5034
|
const bytes = new TextEncoder().encode(type);
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
await this.
|
|
5038
|
-
await this.cachedFS.writeFile(path, bytes);
|
|
5035
|
+
if (!await this.safeExists(this.cachedFS, GROUP_TYPE_FILE)) {
|
|
5036
|
+
await this.ensureDir(GROUP_TYPE_FILE);
|
|
5037
|
+
await this.cachedFS.writeFile(GROUP_TYPE_FILE, bytes);
|
|
5039
5038
|
}
|
|
5040
5039
|
const existingDescriptor = await readGroupDescriptor(this.cachedFS);
|
|
5041
5040
|
if (!existingDescriptor) {
|
|
@@ -6537,18 +6536,23 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
6537
6536
|
log5.error(`[createConfigRepo] Failed to ensure /.meta/:`, err.message);
|
|
6538
6537
|
}
|
|
6539
6538
|
}
|
|
6539
|
+
const declaredIdentity = await readGroupDescriptor(primaryInstance);
|
|
6540
|
+
if (declaredIdentity?.kind === "data") {
|
|
6541
|
+
throw new Error(
|
|
6542
|
+
`[createConfigRepo] \u8BE5\u8FDC\u7AEF\u6839\u7684 .meta/group.json \u58F0\u660E\u4E3A\u6570\u636E\u7EC4\uFF08kind=data \xB7 id=${declaredIdentity.id ?? "?"}\uFF09\u2014\u2014\u62D2\u7EDD\u5728\u8FD9\u91CC\u521D\u59CB\u5316\u914D\u7F6E\u7EC4\u3002\u8981\u7ED9\u6570\u636E\u7EC4\u6362\u4E13\u5C5E\u8FDC\u7AEF\u6839\uFF0C\u6216\u5728\u914D\u7F6E\u7EC4\u4FA7\u89E3\u9664\u5BF9\u8BE5\u6839\u7684\u7ED1\u5B9A\u3002`
|
|
6543
|
+
);
|
|
6544
|
+
}
|
|
6540
6545
|
try {
|
|
6541
6546
|
const groupTypeBytes = new TextEncoder().encode("config-sync");
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
}
|
|
6547
|
+
const markerPath = `${CONFIG_DIR}/group-type`;
|
|
6548
|
+
try {
|
|
6549
|
+
await primaryInstance.readFile(markerPath);
|
|
6550
|
+
} catch {
|
|
6551
|
+
await ensureParentDir2(primaryInstance, markerPath);
|
|
6552
|
+
await primaryInstance.writeFile(markerPath, groupTypeBytes);
|
|
6553
|
+
log5.log(`[createConfigRepo] group-type set to "config-sync" at ${markerPath}`);
|
|
6550
6554
|
}
|
|
6551
|
-
if (!
|
|
6555
|
+
if (!declaredIdentity) {
|
|
6552
6556
|
await writeGroupDescriptor(primaryInstance, {
|
|
6553
6557
|
schemaVersion: 2,
|
|
6554
6558
|
kind: "config",
|
|
@@ -6821,7 +6825,15 @@ async function detectGroupTypeDetailed(type, options) {
|
|
|
6821
6825
|
} catch {
|
|
6822
6826
|
}
|
|
6823
6827
|
}
|
|
6824
|
-
|
|
6828
|
+
if (remote?.kind === "data") {
|
|
6829
|
+
log6("detectGroupType: no marker, but .meta/group.json declares kind=data \u2192 data-sync");
|
|
6830
|
+
return { groupType: "data-sync", remote };
|
|
6831
|
+
}
|
|
6832
|
+
if (remote?.kind === "config") {
|
|
6833
|
+
log6("detectGroupType: no marker, but .meta/group.json declares kind=config \u2192 config-sync");
|
|
6834
|
+
return { groupType: "config-sync", remote };
|
|
6835
|
+
}
|
|
6836
|
+
log6(`detectGroupType: no group-type file and no descriptor kind (new backend)`);
|
|
6825
6837
|
return { groupType: null, remote };
|
|
6826
6838
|
} finally {
|
|
6827
6839
|
if (tempBackend?.dispose) {
|
package/dist/index.mjs
CHANGED
|
@@ -1731,7 +1731,7 @@ function summarizeIdentity(identity) {
|
|
|
1731
1731
|
const parts = [
|
|
1732
1732
|
`kind=${identity.kind ?? "?"}`,
|
|
1733
1733
|
`id=${identity.id ?? "?"}`,
|
|
1734
|
-
`\u5B9E\u4F8B ID=${identity.instanceId
|
|
1734
|
+
`\u5B9E\u4F8B ID=${identity.instanceId ?? "\uFF08\u65E0\uFF09"}`
|
|
1735
1735
|
];
|
|
1736
1736
|
return parts.join(" \xB7 ");
|
|
1737
1737
|
}
|
|
@@ -4273,10 +4273,9 @@ var ConfigRepo = class {
|
|
|
4273
4273
|
}
|
|
4274
4274
|
}
|
|
4275
4275
|
const bytes = new TextEncoder().encode(type);
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
await this.
|
|
4279
|
-
await this.cachedFS.writeFile(path, bytes);
|
|
4276
|
+
if (!await this.safeExists(this.cachedFS, GROUP_TYPE_FILE)) {
|
|
4277
|
+
await this.ensureDir(GROUP_TYPE_FILE);
|
|
4278
|
+
await this.cachedFS.writeFile(GROUP_TYPE_FILE, bytes);
|
|
4280
4279
|
}
|
|
4281
4280
|
const existingDescriptor = await readGroupDescriptor(this.cachedFS);
|
|
4282
4281
|
if (!existingDescriptor) {
|
|
@@ -5778,18 +5777,23 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
5778
5777
|
log5.error(`[createConfigRepo] Failed to ensure /.meta/:`, err.message);
|
|
5779
5778
|
}
|
|
5780
5779
|
}
|
|
5780
|
+
const declaredIdentity = await readGroupDescriptor(primaryInstance);
|
|
5781
|
+
if (declaredIdentity?.kind === "data") {
|
|
5782
|
+
throw new Error(
|
|
5783
|
+
`[createConfigRepo] \u8BE5\u8FDC\u7AEF\u6839\u7684 .meta/group.json \u58F0\u660E\u4E3A\u6570\u636E\u7EC4\uFF08kind=data \xB7 id=${declaredIdentity.id ?? "?"}\uFF09\u2014\u2014\u62D2\u7EDD\u5728\u8FD9\u91CC\u521D\u59CB\u5316\u914D\u7F6E\u7EC4\u3002\u8981\u7ED9\u6570\u636E\u7EC4\u6362\u4E13\u5C5E\u8FDC\u7AEF\u6839\uFF0C\u6216\u5728\u914D\u7F6E\u7EC4\u4FA7\u89E3\u9664\u5BF9\u8BE5\u6839\u7684\u7ED1\u5B9A\u3002`
|
|
5784
|
+
);
|
|
5785
|
+
}
|
|
5781
5786
|
try {
|
|
5782
5787
|
const groupTypeBytes = new TextEncoder().encode("config-sync");
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
}
|
|
5788
|
+
const markerPath = `${CONFIG_DIR}/group-type`;
|
|
5789
|
+
try {
|
|
5790
|
+
await primaryInstance.readFile(markerPath);
|
|
5791
|
+
} catch {
|
|
5792
|
+
await ensureParentDir2(primaryInstance, markerPath);
|
|
5793
|
+
await primaryInstance.writeFile(markerPath, groupTypeBytes);
|
|
5794
|
+
log5.log(`[createConfigRepo] group-type set to "config-sync" at ${markerPath}`);
|
|
5791
5795
|
}
|
|
5792
|
-
if (!
|
|
5796
|
+
if (!declaredIdentity) {
|
|
5793
5797
|
await writeGroupDescriptor(primaryInstance, {
|
|
5794
5798
|
schemaVersion: 2,
|
|
5795
5799
|
kind: "config",
|
|
@@ -6061,7 +6065,15 @@ async function detectGroupTypeDetailed(type, options) {
|
|
|
6061
6065
|
} catch {
|
|
6062
6066
|
}
|
|
6063
6067
|
}
|
|
6064
|
-
|
|
6068
|
+
if (remote?.kind === "data") {
|
|
6069
|
+
log6("detectGroupType: no marker, but .meta/group.json declares kind=data \u2192 data-sync");
|
|
6070
|
+
return { groupType: "data-sync", remote };
|
|
6071
|
+
}
|
|
6072
|
+
if (remote?.kind === "config") {
|
|
6073
|
+
log6("detectGroupType: no marker, but .meta/group.json declares kind=config \u2192 config-sync");
|
|
6074
|
+
return { groupType: "config-sync", remote };
|
|
6075
|
+
}
|
|
6076
|
+
log6(`detectGroupType: no group-type file and no descriptor kind (new backend)`);
|
|
6065
6077
|
return { groupType: null, remote };
|
|
6066
6078
|
} finally {
|
|
6067
6079
|
if (tempBackend?.dispose) {
|
package/dist/zen-fs-config.js
CHANGED
|
@@ -28447,7 +28447,7 @@ var ZenFSConfig = (() => {
|
|
|
28447
28447
|
const parts = [
|
|
28448
28448
|
`kind=${identity.kind ?? "?"}`,
|
|
28449
28449
|
`id=${identity.id ?? "?"}`,
|
|
28450
|
-
`\u5B9E\u4F8B ID=${identity.instanceId
|
|
28450
|
+
`\u5B9E\u4F8B ID=${identity.instanceId ?? "\uFF08\u65E0\uFF09"}`
|
|
28451
28451
|
];
|
|
28452
28452
|
return parts.join(" \xB7 ");
|
|
28453
28453
|
}
|
|
@@ -30989,10 +30989,9 @@ var ZenFSConfig = (() => {
|
|
|
30989
30989
|
}
|
|
30990
30990
|
}
|
|
30991
30991
|
const bytes = new TextEncoder().encode(type);
|
|
30992
|
-
|
|
30993
|
-
|
|
30994
|
-
await this.
|
|
30995
|
-
await this.cachedFS.writeFile(path, bytes);
|
|
30992
|
+
if (!await this.safeExists(this.cachedFS, GROUP_TYPE_FILE)) {
|
|
30993
|
+
await this.ensureDir(GROUP_TYPE_FILE);
|
|
30994
|
+
await this.cachedFS.writeFile(GROUP_TYPE_FILE, bytes);
|
|
30996
30995
|
}
|
|
30997
30996
|
const existingDescriptor = await readGroupDescriptor(this.cachedFS);
|
|
30998
30997
|
if (!existingDescriptor) {
|
|
@@ -32494,18 +32493,23 @@ var ZenFSConfig = (() => {
|
|
|
32494
32493
|
log9.error(`[createConfigRepo] Failed to ensure /.meta/:`, err2.message);
|
|
32495
32494
|
}
|
|
32496
32495
|
}
|
|
32496
|
+
const declaredIdentity = await readGroupDescriptor(primaryInstance);
|
|
32497
|
+
if (declaredIdentity?.kind === "data") {
|
|
32498
|
+
throw new Error(
|
|
32499
|
+
`[createConfigRepo] \u8BE5\u8FDC\u7AEF\u6839\u7684 .meta/group.json \u58F0\u660E\u4E3A\u6570\u636E\u7EC4\uFF08kind=data \xB7 id=${declaredIdentity.id ?? "?"}\uFF09\u2014\u2014\u62D2\u7EDD\u5728\u8FD9\u91CC\u521D\u59CB\u5316\u914D\u7F6E\u7EC4\u3002\u8981\u7ED9\u6570\u636E\u7EC4\u6362\u4E13\u5C5E\u8FDC\u7AEF\u6839\uFF0C\u6216\u5728\u914D\u7F6E\u7EC4\u4FA7\u89E3\u9664\u5BF9\u8BE5\u6839\u7684\u7ED1\u5B9A\u3002`
|
|
32500
|
+
);
|
|
32501
|
+
}
|
|
32497
32502
|
try {
|
|
32498
32503
|
const groupTypeBytes = new TextEncoder().encode("config-sync");
|
|
32499
|
-
|
|
32500
|
-
|
|
32501
|
-
|
|
32502
|
-
|
|
32503
|
-
|
|
32504
|
-
|
|
32505
|
-
|
|
32506
|
-
}
|
|
32504
|
+
const markerPath = `${CONFIG_DIR}/group-type`;
|
|
32505
|
+
try {
|
|
32506
|
+
await primaryInstance.readFile(markerPath);
|
|
32507
|
+
} catch {
|
|
32508
|
+
await ensureParentDir2(primaryInstance, markerPath);
|
|
32509
|
+
await primaryInstance.writeFile(markerPath, groupTypeBytes);
|
|
32510
|
+
log9.log(`[createConfigRepo] group-type set to "config-sync" at ${markerPath}`);
|
|
32507
32511
|
}
|
|
32508
|
-
if (!
|
|
32512
|
+
if (!declaredIdentity) {
|
|
32509
32513
|
await writeGroupDescriptor(primaryInstance, {
|
|
32510
32514
|
schemaVersion: 2,
|
|
32511
32515
|
kind: "config",
|
|
@@ -32778,7 +32782,15 @@ var ZenFSConfig = (() => {
|
|
|
32778
32782
|
} catch {
|
|
32779
32783
|
}
|
|
32780
32784
|
}
|
|
32781
|
-
|
|
32785
|
+
if (remote?.kind === "data") {
|
|
32786
|
+
log10("detectGroupType: no marker, but .meta/group.json declares kind=data \u2192 data-sync");
|
|
32787
|
+
return { groupType: "data-sync", remote };
|
|
32788
|
+
}
|
|
32789
|
+
if (remote?.kind === "config") {
|
|
32790
|
+
log10("detectGroupType: no marker, but .meta/group.json declares kind=config \u2192 config-sync");
|
|
32791
|
+
return { groupType: "config-sync", remote };
|
|
32792
|
+
}
|
|
32793
|
+
log10(`detectGroupType: no group-type file and no descriptor kind (new backend)`);
|
|
32782
32794
|
return { groupType: null, remote };
|
|
32783
32795
|
} finally {
|
|
32784
32796
|
if (tempBackend?.dispose) {
|