@mdfriday/foundry 26.3.11 → 26.3.13
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/cli.js +29 -11
- package/dist/index.js +1 -1
- package/dist/internal/domain/identity/repository/index.d.ts +1 -1
- package/dist/internal/interfaces/obsidian/auth.d.ts +7 -7
- package/dist/internal/interfaces/obsidian/domain.d.ts +11 -11
- package/dist/internal/interfaces/obsidian/license.d.ts +11 -11
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2571,26 +2571,44 @@ var init_user_factory = __esm({
|
|
|
2571
2571
|
}
|
|
2572
2572
|
/**
|
|
2573
2573
|
* 保存用户到存储(合并保存 token, license, server config, sync config)
|
|
2574
|
+
*
|
|
2575
|
+
* ⚠️ 采用合并策略:先加载现有数据,再用新数据覆盖,避免丢失其他字段
|
|
2574
2576
|
*/
|
|
2575
2577
|
async save(user) {
|
|
2576
2578
|
try {
|
|
2579
|
+
const existingData = await this.storageProvider.loadUserData();
|
|
2577
2580
|
const token = user.getToken();
|
|
2578
2581
|
const license = user.getLicense();
|
|
2579
2582
|
const syncConfig = user.getSyncConfig();
|
|
2580
2583
|
const serverConfig = user.getServerConfig();
|
|
2581
2584
|
const email = user.getEmail().getValue();
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2585
|
+
const mergedData = {
|
|
2586
|
+
// 保留现有数据(如果有)
|
|
2587
|
+
...existingData || {},
|
|
2588
|
+
// 用新数据覆盖(只覆盖存在的字段)
|
|
2589
|
+
...token ? { token } : {},
|
|
2590
|
+
...license ? { license } : {},
|
|
2591
|
+
...syncConfig ? { syncConfig } : {},
|
|
2592
|
+
...serverConfig ? { serverConfig } : {},
|
|
2587
2593
|
email
|
|
2588
|
-
|
|
2589
|
-
|
|
2594
|
+
// email 始终更新
|
|
2595
|
+
};
|
|
2596
|
+
if (!license && existingData?.license) {
|
|
2597
|
+
mergedData.license = existingData.license;
|
|
2598
|
+
log4.debug("Preserved existing license data during save");
|
|
2599
|
+
}
|
|
2600
|
+
if (!syncConfig && existingData?.syncConfig) {
|
|
2601
|
+
mergedData.syncConfig = existingData.syncConfig;
|
|
2602
|
+
log4.debug("Preserved existing syncConfig data during save");
|
|
2603
|
+
}
|
|
2604
|
+
await this.storageProvider.saveUserData(mergedData);
|
|
2605
|
+
log4.debug("User saved to storage (merged)", {
|
|
2590
2606
|
email,
|
|
2591
|
-
hasToken: !!token,
|
|
2592
|
-
hasLicense: !!license,
|
|
2593
|
-
hasSyncConfig: !!syncConfig
|
|
2607
|
+
hasToken: !!mergedData.token,
|
|
2608
|
+
hasLicense: !!mergedData.license,
|
|
2609
|
+
hasSyncConfig: !!mergedData.syncConfig,
|
|
2610
|
+
preservedLicense: !license && !!existingData?.license,
|
|
2611
|
+
preservedSyncConfig: !syncConfig && !!existingData?.syncConfig
|
|
2594
2612
|
});
|
|
2595
2613
|
} catch (error) {
|
|
2596
2614
|
log4.error("Failed to save user to storage", error);
|
|
@@ -55087,7 +55105,7 @@ For more information, visit: https://help.mdfriday.com
|
|
|
55087
55105
|
* Show version
|
|
55088
55106
|
*/
|
|
55089
55107
|
showVersion() {
|
|
55090
|
-
const version = "26.3.
|
|
55108
|
+
const version = "26.3.13";
|
|
55091
55109
|
return {
|
|
55092
55110
|
success: true,
|
|
55093
55111
|
message: `MDFriday CLI v${version}`
|