zen-fs-config 0.7.19 → 0.7.20
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 +21 -11
- package/dist/index.mjs +21 -11
- package/dist/zen-fs-config.js +21 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6546,9 +6546,19 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
6546
6546
|
}
|
|
6547
6547
|
const declaredIdentity = await readGroupDescriptor(primaryInstance);
|
|
6548
6548
|
if (declaredIdentity?.kind === "data") {
|
|
6549
|
-
|
|
6550
|
-
`[createConfigRepo]
|
|
6549
|
+
log5.warn(
|
|
6550
|
+
`[createConfigRepo] local primary carries a data-group descriptor (id=${declaredIdentity.id ?? "?"}) \u2014 rewriting it back to kind=config (its .meta/group.json was overwritten by sync)`
|
|
6551
6551
|
);
|
|
6552
|
+
await writeGroupDescriptor(primaryInstance, {
|
|
6553
|
+
schemaVersion: 2,
|
|
6554
|
+
kind: "config",
|
|
6555
|
+
id: CONFIG_GROUP_ID,
|
|
6556
|
+
// 被污染的 instanceId 属于那个数据组,不能当成自己的身份继续用;
|
|
6557
|
+
// 重新分配一个,界面上的「实例 ID 不一致」会提示用户拍板统一。
|
|
6558
|
+
instanceId: newGroupInstanceId(),
|
|
6559
|
+
...declaredIdentity.name ? { name: declaredIdentity.name } : {},
|
|
6560
|
+
features: CONFIG_GROUP_FEATURES
|
|
6561
|
+
});
|
|
6552
6562
|
}
|
|
6553
6563
|
try {
|
|
6554
6564
|
const groupTypeBytes = new TextEncoder().encode("config-sync");
|
|
@@ -6825,12 +6835,20 @@ async function detectGroupTypeDetailed(type, options) {
|
|
|
6825
6835
|
} finally {
|
|
6826
6836
|
}
|
|
6827
6837
|
try {
|
|
6838
|
+
if (remote?.kind === "data") {
|
|
6839
|
+
log6("detectGroupType: .meta/group.json declares kind=data \u2192 data-sync");
|
|
6840
|
+
return { groupType: "data-sync", remote };
|
|
6841
|
+
}
|
|
6842
|
+
if (remote?.kind === "config") {
|
|
6843
|
+
log6("detectGroupType: .meta/group.json declares kind=config \u2192 config-sync");
|
|
6844
|
+
return { groupType: "config-sync", remote };
|
|
6845
|
+
}
|
|
6828
6846
|
for (const path of [GROUP_TYPE_FILE2, LEGACY_GROUP_TYPE_FILE2]) {
|
|
6829
6847
|
try {
|
|
6830
6848
|
const raw = await tempBackend.readFile(path, "utf-8");
|
|
6831
6849
|
const groupType = raw.trim();
|
|
6832
6850
|
if (groupType === "config-sync" || groupType === "data-sync") {
|
|
6833
|
-
log6(`detectGroupType: detected "${groupType}" at ${path}`);
|
|
6851
|
+
log6(`detectGroupType: detected "${groupType}" at ${path} (no descriptor)`);
|
|
6834
6852
|
return { groupType, remote };
|
|
6835
6853
|
}
|
|
6836
6854
|
log6(`detectGroupType: unknown group-type value "${groupType}" at ${path}, treating as null`);
|
|
@@ -6838,14 +6856,6 @@ async function detectGroupTypeDetailed(type, options) {
|
|
|
6838
6856
|
} catch {
|
|
6839
6857
|
}
|
|
6840
6858
|
}
|
|
6841
|
-
if (remote?.kind === "data") {
|
|
6842
|
-
log6("detectGroupType: no marker, but .meta/group.json declares kind=data \u2192 data-sync");
|
|
6843
|
-
return { groupType: "data-sync", remote };
|
|
6844
|
-
}
|
|
6845
|
-
if (remote?.kind === "config") {
|
|
6846
|
-
log6("detectGroupType: no marker, but .meta/group.json declares kind=config \u2192 config-sync");
|
|
6847
|
-
return { groupType: "config-sync", remote };
|
|
6848
|
-
}
|
|
6849
6859
|
log6(`detectGroupType: no group-type file and no descriptor kind (new backend)`);
|
|
6850
6860
|
return { groupType: null, remote };
|
|
6851
6861
|
} finally {
|
package/dist/index.mjs
CHANGED
|
@@ -5787,9 +5787,19 @@ async function createConfigRepo(appId, options = {}) {
|
|
|
5787
5787
|
}
|
|
5788
5788
|
const declaredIdentity = await readGroupDescriptor(primaryInstance);
|
|
5789
5789
|
if (declaredIdentity?.kind === "data") {
|
|
5790
|
-
|
|
5791
|
-
`[createConfigRepo]
|
|
5790
|
+
log5.warn(
|
|
5791
|
+
`[createConfigRepo] local primary carries a data-group descriptor (id=${declaredIdentity.id ?? "?"}) \u2014 rewriting it back to kind=config (its .meta/group.json was overwritten by sync)`
|
|
5792
5792
|
);
|
|
5793
|
+
await writeGroupDescriptor(primaryInstance, {
|
|
5794
|
+
schemaVersion: 2,
|
|
5795
|
+
kind: "config",
|
|
5796
|
+
id: CONFIG_GROUP_ID,
|
|
5797
|
+
// 被污染的 instanceId 属于那个数据组,不能当成自己的身份继续用;
|
|
5798
|
+
// 重新分配一个,界面上的「实例 ID 不一致」会提示用户拍板统一。
|
|
5799
|
+
instanceId: newGroupInstanceId(),
|
|
5800
|
+
...declaredIdentity.name ? { name: declaredIdentity.name } : {},
|
|
5801
|
+
features: CONFIG_GROUP_FEATURES
|
|
5802
|
+
});
|
|
5793
5803
|
}
|
|
5794
5804
|
try {
|
|
5795
5805
|
const groupTypeBytes = new TextEncoder().encode("config-sync");
|
|
@@ -6065,12 +6075,20 @@ async function detectGroupTypeDetailed(type, options) {
|
|
|
6065
6075
|
} finally {
|
|
6066
6076
|
}
|
|
6067
6077
|
try {
|
|
6078
|
+
if (remote?.kind === "data") {
|
|
6079
|
+
log6("detectGroupType: .meta/group.json declares kind=data \u2192 data-sync");
|
|
6080
|
+
return { groupType: "data-sync", remote };
|
|
6081
|
+
}
|
|
6082
|
+
if (remote?.kind === "config") {
|
|
6083
|
+
log6("detectGroupType: .meta/group.json declares kind=config \u2192 config-sync");
|
|
6084
|
+
return { groupType: "config-sync", remote };
|
|
6085
|
+
}
|
|
6068
6086
|
for (const path of [GROUP_TYPE_FILE2, LEGACY_GROUP_TYPE_FILE2]) {
|
|
6069
6087
|
try {
|
|
6070
6088
|
const raw = await tempBackend.readFile(path, "utf-8");
|
|
6071
6089
|
const groupType = raw.trim();
|
|
6072
6090
|
if (groupType === "config-sync" || groupType === "data-sync") {
|
|
6073
|
-
log6(`detectGroupType: detected "${groupType}" at ${path}`);
|
|
6091
|
+
log6(`detectGroupType: detected "${groupType}" at ${path} (no descriptor)`);
|
|
6074
6092
|
return { groupType, remote };
|
|
6075
6093
|
}
|
|
6076
6094
|
log6(`detectGroupType: unknown group-type value "${groupType}" at ${path}, treating as null`);
|
|
@@ -6078,14 +6096,6 @@ async function detectGroupTypeDetailed(type, options) {
|
|
|
6078
6096
|
} catch {
|
|
6079
6097
|
}
|
|
6080
6098
|
}
|
|
6081
|
-
if (remote?.kind === "data") {
|
|
6082
|
-
log6("detectGroupType: no marker, but .meta/group.json declares kind=data \u2192 data-sync");
|
|
6083
|
-
return { groupType: "data-sync", remote };
|
|
6084
|
-
}
|
|
6085
|
-
if (remote?.kind === "config") {
|
|
6086
|
-
log6("detectGroupType: no marker, but .meta/group.json declares kind=config \u2192 config-sync");
|
|
6087
|
-
return { groupType: "config-sync", remote };
|
|
6088
|
-
}
|
|
6089
6099
|
log6(`detectGroupType: no group-type file and no descriptor kind (new backend)`);
|
|
6090
6100
|
return { groupType: null, remote };
|
|
6091
6101
|
} finally {
|
package/dist/zen-fs-config.js
CHANGED
|
@@ -32503,9 +32503,19 @@ var ZenFSConfig = (() => {
|
|
|
32503
32503
|
}
|
|
32504
32504
|
const declaredIdentity = await readGroupDescriptor(primaryInstance);
|
|
32505
32505
|
if (declaredIdentity?.kind === "data") {
|
|
32506
|
-
|
|
32507
|
-
`[createConfigRepo]
|
|
32506
|
+
log9.warn(
|
|
32507
|
+
`[createConfigRepo] local primary carries a data-group descriptor (id=${declaredIdentity.id ?? "?"}) \u2014 rewriting it back to kind=config (its .meta/group.json was overwritten by sync)`
|
|
32508
32508
|
);
|
|
32509
|
+
await writeGroupDescriptor(primaryInstance, {
|
|
32510
|
+
schemaVersion: 2,
|
|
32511
|
+
kind: "config",
|
|
32512
|
+
id: CONFIG_GROUP_ID,
|
|
32513
|
+
// 被污染的 instanceId 属于那个数据组,不能当成自己的身份继续用;
|
|
32514
|
+
// 重新分配一个,界面上的「实例 ID 不一致」会提示用户拍板统一。
|
|
32515
|
+
instanceId: newGroupInstanceId(),
|
|
32516
|
+
...declaredIdentity.name ? { name: declaredIdentity.name } : {},
|
|
32517
|
+
features: CONFIG_GROUP_FEATURES
|
|
32518
|
+
});
|
|
32509
32519
|
}
|
|
32510
32520
|
try {
|
|
32511
32521
|
const groupTypeBytes = new TextEncoder().encode("config-sync");
|
|
@@ -32782,12 +32792,20 @@ var ZenFSConfig = (() => {
|
|
|
32782
32792
|
} finally {
|
|
32783
32793
|
}
|
|
32784
32794
|
try {
|
|
32795
|
+
if (remote?.kind === "data") {
|
|
32796
|
+
log10("detectGroupType: .meta/group.json declares kind=data \u2192 data-sync");
|
|
32797
|
+
return { groupType: "data-sync", remote };
|
|
32798
|
+
}
|
|
32799
|
+
if (remote?.kind === "config") {
|
|
32800
|
+
log10("detectGroupType: .meta/group.json declares kind=config \u2192 config-sync");
|
|
32801
|
+
return { groupType: "config-sync", remote };
|
|
32802
|
+
}
|
|
32785
32803
|
for (const path of [GROUP_TYPE_FILE2, LEGACY_GROUP_TYPE_FILE2]) {
|
|
32786
32804
|
try {
|
|
32787
32805
|
const raw = await tempBackend.readFile(path, "utf-8");
|
|
32788
32806
|
const groupType = raw.trim();
|
|
32789
32807
|
if (groupType === "config-sync" || groupType === "data-sync") {
|
|
32790
|
-
log10(`detectGroupType: detected "${groupType}" at ${path}`);
|
|
32808
|
+
log10(`detectGroupType: detected "${groupType}" at ${path} (no descriptor)`);
|
|
32791
32809
|
return { groupType, remote };
|
|
32792
32810
|
}
|
|
32793
32811
|
log10(`detectGroupType: unknown group-type value "${groupType}" at ${path}, treating as null`);
|
|
@@ -32795,14 +32813,6 @@ var ZenFSConfig = (() => {
|
|
|
32795
32813
|
} catch {
|
|
32796
32814
|
}
|
|
32797
32815
|
}
|
|
32798
|
-
if (remote?.kind === "data") {
|
|
32799
|
-
log10("detectGroupType: no marker, but .meta/group.json declares kind=data \u2192 data-sync");
|
|
32800
|
-
return { groupType: "data-sync", remote };
|
|
32801
|
-
}
|
|
32802
|
-
if (remote?.kind === "config") {
|
|
32803
|
-
log10("detectGroupType: no marker, but .meta/group.json declares kind=config \u2192 config-sync");
|
|
32804
|
-
return { groupType: "config-sync", remote };
|
|
32805
|
-
}
|
|
32806
32816
|
log10(`detectGroupType: no group-type file and no descriptor kind (new backend)`);
|
|
32807
32817
|
return { groupType: null, remote };
|
|
32808
32818
|
} finally {
|