zen-fs-config 0.7.20 → 0.7.21
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 +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +29 -1
- package/dist/index.mjs +29 -1
- package/dist/zen-fs-config.js +29 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -551,6 +551,12 @@ interface SyncGroupHandle {
|
|
|
551
551
|
* 不一致时界面必须让用户挑一个,不允许代码静默择一。
|
|
552
552
|
*/
|
|
553
553
|
getIdentityCandidates(): IdentityCandidate[];
|
|
554
|
+
/**
|
|
555
|
+
* 同上,但会现场回读各根再返回(同步 getter 只给缓存)。
|
|
556
|
+
* 界面优先用它,才能在「本地已有身份、远端与本地不一致」时看到两个值。
|
|
557
|
+
* 可选:老版本实现可能没有这个方法。
|
|
558
|
+
*/
|
|
559
|
+
getIdentityCandidatesAsync?(): Promise<IdentityCandidate[]>;
|
|
554
560
|
/**
|
|
555
561
|
* 候选之间是否互相矛盾(需要用户在界面上拍板)。
|
|
556
562
|
* 可选:老版本实现可能没有这个方法,调用方按候选去重自行判断。
|
|
@@ -1466,8 +1472,16 @@ declare class ConfigRepo implements IConfigRepo {
|
|
|
1466
1472
|
ensureGroupInstanceId(): Promise<string>;
|
|
1467
1473
|
/** 组实例身份(同步读取;init 之前可能为 `undefined`)。 */
|
|
1468
1474
|
getGroupInstanceId(): string | undefined;
|
|
1469
|
-
/** 配置组的身份候选:本地描述符 +
|
|
1475
|
+
/** 配置组的身份候选:本地描述符 + 已注册后端根上的值(只读缓存)。 */
|
|
1470
1476
|
getIdentityCandidates(): IdentityCandidate[];
|
|
1477
|
+
/**
|
|
1478
|
+
* 现场回读各根,重算候选并填充缓存。
|
|
1479
|
+
*
|
|
1480
|
+
* 缓存只在「初始化时本地没有身份」才被填充;本地已有身份时缓存是空的,
|
|
1481
|
+
* 同步 getter 也就只剩一个本地值 —— 界面看不到「本地 6abe… vs 远端 5a52…」
|
|
1482
|
+
* 这种真正需要拍板的分歧。所以给界面一个能主动回读的入口。
|
|
1483
|
+
*/
|
|
1484
|
+
getIdentityCandidatesAsync(): Promise<IdentityCandidate[]>;
|
|
1471
1485
|
/** 候选是否互相矛盾(界面据此要求用户拍板)。 */
|
|
1472
1486
|
isIdentityUnsettled(): boolean;
|
|
1473
1487
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -551,6 +551,12 @@ interface SyncGroupHandle {
|
|
|
551
551
|
* 不一致时界面必须让用户挑一个,不允许代码静默择一。
|
|
552
552
|
*/
|
|
553
553
|
getIdentityCandidates(): IdentityCandidate[];
|
|
554
|
+
/**
|
|
555
|
+
* 同上,但会现场回读各根再返回(同步 getter 只给缓存)。
|
|
556
|
+
* 界面优先用它,才能在「本地已有身份、远端与本地不一致」时看到两个值。
|
|
557
|
+
* 可选:老版本实现可能没有这个方法。
|
|
558
|
+
*/
|
|
559
|
+
getIdentityCandidatesAsync?(): Promise<IdentityCandidate[]>;
|
|
554
560
|
/**
|
|
555
561
|
* 候选之间是否互相矛盾(需要用户在界面上拍板)。
|
|
556
562
|
* 可选:老版本实现可能没有这个方法,调用方按候选去重自行判断。
|
|
@@ -1466,8 +1472,16 @@ declare class ConfigRepo implements IConfigRepo {
|
|
|
1466
1472
|
ensureGroupInstanceId(): Promise<string>;
|
|
1467
1473
|
/** 组实例身份(同步读取;init 之前可能为 `undefined`)。 */
|
|
1468
1474
|
getGroupInstanceId(): string | undefined;
|
|
1469
|
-
/** 配置组的身份候选:本地描述符 +
|
|
1475
|
+
/** 配置组的身份候选:本地描述符 + 已注册后端根上的值(只读缓存)。 */
|
|
1470
1476
|
getIdentityCandidates(): IdentityCandidate[];
|
|
1477
|
+
/**
|
|
1478
|
+
* 现场回读各根,重算候选并填充缓存。
|
|
1479
|
+
*
|
|
1480
|
+
* 缓存只在「初始化时本地没有身份」才被填充;本地已有身份时缓存是空的,
|
|
1481
|
+
* 同步 getter 也就只剩一个本地值 —— 界面看不到「本地 6abe… vs 远端 5a52…」
|
|
1482
|
+
* 这种真正需要拍板的分歧。所以给界面一个能主动回读的入口。
|
|
1483
|
+
*/
|
|
1484
|
+
getIdentityCandidatesAsync(): Promise<IdentityCandidate[]>;
|
|
1471
1485
|
/** 候选是否互相矛盾(界面据此要求用户拍板)。 */
|
|
1472
1486
|
isIdentityUnsettled(): boolean;
|
|
1473
1487
|
/**
|
package/dist/index.js
CHANGED
|
@@ -4853,12 +4853,40 @@ var ConfigRepo = class {
|
|
|
4853
4853
|
getGroupInstanceId() {
|
|
4854
4854
|
return this.instanceId;
|
|
4855
4855
|
}
|
|
4856
|
-
/** 配置组的身份候选:本地描述符 +
|
|
4856
|
+
/** 配置组的身份候选:本地描述符 + 已注册后端根上的值(只读缓存)。 */
|
|
4857
4857
|
getIdentityCandidates() {
|
|
4858
4858
|
if (this.identityCandidates.length > 0) return this.identityCandidates.map((c) => ({ ...c }));
|
|
4859
4859
|
if (!this.instanceId) return [];
|
|
4860
4860
|
return [{ source: "local", instanceId: this.instanceId, rootCount: 1, kind: "config", id: CONFIG_GROUP_ID }];
|
|
4861
4861
|
}
|
|
4862
|
+
/**
|
|
4863
|
+
* 现场回读各根,重算候选并填充缓存。
|
|
4864
|
+
*
|
|
4865
|
+
* 缓存只在「初始化时本地没有身份」才被填充;本地已有身份时缓存是空的,
|
|
4866
|
+
* 同步 getter 也就只剩一个本地值 —— 界面看不到「本地 6abe… vs 远端 5a52…」
|
|
4867
|
+
* 这种真正需要拍板的分歧。所以给界面一个能主动回读的入口。
|
|
4868
|
+
*/
|
|
4869
|
+
async getIdentityCandidatesAsync() {
|
|
4870
|
+
if (!this.instanceId) return [];
|
|
4871
|
+
const collected = await this.collectConfigIdentityCandidates("config", CONFIG_GROUP_ID);
|
|
4872
|
+
if (!collected.candidates.some((c) => c.source === "local") && this.instanceId) {
|
|
4873
|
+
collected.candidates.unshift({
|
|
4874
|
+
source: "local",
|
|
4875
|
+
instanceId: this.instanceId,
|
|
4876
|
+
rootCount: 1,
|
|
4877
|
+
kind: "config",
|
|
4878
|
+
id: CONFIG_GROUP_ID
|
|
4879
|
+
});
|
|
4880
|
+
}
|
|
4881
|
+
this.identityCandidates = collected.candidates;
|
|
4882
|
+
this.configIdentityUnsettled = collected.distinct.length > 1;
|
|
4883
|
+
if (this.configIdentityUnsettled) {
|
|
4884
|
+
log5.warn(
|
|
4885
|
+
`[ConfigRepo] identity candidates disagree (${collected.distinct.join(" / ")}) \u2014 left to the user to decide in the UI`
|
|
4886
|
+
);
|
|
4887
|
+
}
|
|
4888
|
+
return this.identityCandidates.map((c) => ({ ...c }));
|
|
4889
|
+
}
|
|
4862
4890
|
/** 候选是否互相矛盾(界面据此要求用户拍板)。 */
|
|
4863
4891
|
isIdentityUnsettled() {
|
|
4864
4892
|
return this.configIdentityUnsettled;
|
package/dist/index.mjs
CHANGED
|
@@ -4094,12 +4094,40 @@ var ConfigRepo = class {
|
|
|
4094
4094
|
getGroupInstanceId() {
|
|
4095
4095
|
return this.instanceId;
|
|
4096
4096
|
}
|
|
4097
|
-
/** 配置组的身份候选:本地描述符 +
|
|
4097
|
+
/** 配置组的身份候选:本地描述符 + 已注册后端根上的值(只读缓存)。 */
|
|
4098
4098
|
getIdentityCandidates() {
|
|
4099
4099
|
if (this.identityCandidates.length > 0) return this.identityCandidates.map((c) => ({ ...c }));
|
|
4100
4100
|
if (!this.instanceId) return [];
|
|
4101
4101
|
return [{ source: "local", instanceId: this.instanceId, rootCount: 1, kind: "config", id: CONFIG_GROUP_ID }];
|
|
4102
4102
|
}
|
|
4103
|
+
/**
|
|
4104
|
+
* 现场回读各根,重算候选并填充缓存。
|
|
4105
|
+
*
|
|
4106
|
+
* 缓存只在「初始化时本地没有身份」才被填充;本地已有身份时缓存是空的,
|
|
4107
|
+
* 同步 getter 也就只剩一个本地值 —— 界面看不到「本地 6abe… vs 远端 5a52…」
|
|
4108
|
+
* 这种真正需要拍板的分歧。所以给界面一个能主动回读的入口。
|
|
4109
|
+
*/
|
|
4110
|
+
async getIdentityCandidatesAsync() {
|
|
4111
|
+
if (!this.instanceId) return [];
|
|
4112
|
+
const collected = await this.collectConfigIdentityCandidates("config", CONFIG_GROUP_ID);
|
|
4113
|
+
if (!collected.candidates.some((c) => c.source === "local") && this.instanceId) {
|
|
4114
|
+
collected.candidates.unshift({
|
|
4115
|
+
source: "local",
|
|
4116
|
+
instanceId: this.instanceId,
|
|
4117
|
+
rootCount: 1,
|
|
4118
|
+
kind: "config",
|
|
4119
|
+
id: CONFIG_GROUP_ID
|
|
4120
|
+
});
|
|
4121
|
+
}
|
|
4122
|
+
this.identityCandidates = collected.candidates;
|
|
4123
|
+
this.configIdentityUnsettled = collected.distinct.length > 1;
|
|
4124
|
+
if (this.configIdentityUnsettled) {
|
|
4125
|
+
log5.warn(
|
|
4126
|
+
`[ConfigRepo] identity candidates disagree (${collected.distinct.join(" / ")}) \u2014 left to the user to decide in the UI`
|
|
4127
|
+
);
|
|
4128
|
+
}
|
|
4129
|
+
return this.identityCandidates.map((c) => ({ ...c }));
|
|
4130
|
+
}
|
|
4103
4131
|
/** 候选是否互相矛盾(界面据此要求用户拍板)。 */
|
|
4104
4132
|
isIdentityUnsettled() {
|
|
4105
4133
|
return this.configIdentityUnsettled;
|
package/dist/zen-fs-config.js
CHANGED
|
@@ -30810,12 +30810,40 @@ var ZenFSConfig = (() => {
|
|
|
30810
30810
|
getGroupInstanceId() {
|
|
30811
30811
|
return this.instanceId;
|
|
30812
30812
|
}
|
|
30813
|
-
/** 配置组的身份候选:本地描述符 +
|
|
30813
|
+
/** 配置组的身份候选:本地描述符 + 已注册后端根上的值(只读缓存)。 */
|
|
30814
30814
|
getIdentityCandidates() {
|
|
30815
30815
|
if (this.identityCandidates.length > 0) return this.identityCandidates.map((c) => ({ ...c }));
|
|
30816
30816
|
if (!this.instanceId) return [];
|
|
30817
30817
|
return [{ source: "local", instanceId: this.instanceId, rootCount: 1, kind: "config", id: CONFIG_GROUP_ID }];
|
|
30818
30818
|
}
|
|
30819
|
+
/**
|
|
30820
|
+
* 现场回读各根,重算候选并填充缓存。
|
|
30821
|
+
*
|
|
30822
|
+
* 缓存只在「初始化时本地没有身份」才被填充;本地已有身份时缓存是空的,
|
|
30823
|
+
* 同步 getter 也就只剩一个本地值 —— 界面看不到「本地 6abe… vs 远端 5a52…」
|
|
30824
|
+
* 这种真正需要拍板的分歧。所以给界面一个能主动回读的入口。
|
|
30825
|
+
*/
|
|
30826
|
+
async getIdentityCandidatesAsync() {
|
|
30827
|
+
if (!this.instanceId) return [];
|
|
30828
|
+
const collected = await this.collectConfigIdentityCandidates("config", CONFIG_GROUP_ID);
|
|
30829
|
+
if (!collected.candidates.some((c) => c.source === "local") && this.instanceId) {
|
|
30830
|
+
collected.candidates.unshift({
|
|
30831
|
+
source: "local",
|
|
30832
|
+
instanceId: this.instanceId,
|
|
30833
|
+
rootCount: 1,
|
|
30834
|
+
kind: "config",
|
|
30835
|
+
id: CONFIG_GROUP_ID
|
|
30836
|
+
});
|
|
30837
|
+
}
|
|
30838
|
+
this.identityCandidates = collected.candidates;
|
|
30839
|
+
this.configIdentityUnsettled = collected.distinct.length > 1;
|
|
30840
|
+
if (this.configIdentityUnsettled) {
|
|
30841
|
+
log9.warn(
|
|
30842
|
+
`[ConfigRepo] identity candidates disagree (${collected.distinct.join(" / ")}) \u2014 left to the user to decide in the UI`
|
|
30843
|
+
);
|
|
30844
|
+
}
|
|
30845
|
+
return this.identityCandidates.map((c) => ({ ...c }));
|
|
30846
|
+
}
|
|
30819
30847
|
/** 候选是否互相矛盾(界面据此要求用户拍板)。 */
|
|
30820
30848
|
isIdentityUnsettled() {
|
|
30821
30849
|
return this.configIdentityUnsettled;
|