@mdfriday/foundry 26.3.9 → 26.3.10
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 +176 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/domain/identity/entity/user.d.ts +7 -1
- package/dist/internal/domain/identity/factory/user-factory.d.ts +6 -0
- package/dist/internal/domain/identity/index.d.ts +1 -0
- package/dist/internal/domain/identity/repository/index.d.ts +2 -0
- package/dist/internal/domain/identity/value-object/sync-config.d.ts +35 -0
- package/dist/internal/interfaces/obsidian/index.d.ts +1 -0
- package/dist/internal/interfaces/obsidian/license.d.ts +22 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1970,6 +1970,126 @@ var init_license = __esm({
|
|
|
1970
1970
|
}
|
|
1971
1971
|
});
|
|
1972
1972
|
|
|
1973
|
+
// internal/domain/identity/value-object/sync-config.ts
|
|
1974
|
+
var SyncConfig;
|
|
1975
|
+
var init_sync_config = __esm({
|
|
1976
|
+
"internal/domain/identity/value-object/sync-config.ts"() {
|
|
1977
|
+
"use strict";
|
|
1978
|
+
SyncConfig = class _SyncConfig {
|
|
1979
|
+
dbEndpoint;
|
|
1980
|
+
dbName;
|
|
1981
|
+
email;
|
|
1982
|
+
dbPassword;
|
|
1983
|
+
userDir;
|
|
1984
|
+
constructor(data) {
|
|
1985
|
+
this.dbEndpoint = data.dbEndpoint;
|
|
1986
|
+
this.dbName = data.dbName;
|
|
1987
|
+
this.email = data.email;
|
|
1988
|
+
this.dbPassword = data.dbPassword;
|
|
1989
|
+
this.userDir = data.userDir;
|
|
1990
|
+
}
|
|
1991
|
+
// ============================================================================
|
|
1992
|
+
// Factory Methods
|
|
1993
|
+
// ============================================================================
|
|
1994
|
+
/**
|
|
1995
|
+
* 创建 SyncConfig 实例
|
|
1996
|
+
*/
|
|
1997
|
+
static create(data) {
|
|
1998
|
+
if (!data.dbEndpoint || !data.dbName || !data.email || !data.dbPassword) {
|
|
1999
|
+
throw new Error("Missing required sync configuration fields");
|
|
2000
|
+
}
|
|
2001
|
+
return new _SyncConfig(data);
|
|
2002
|
+
}
|
|
2003
|
+
/**
|
|
2004
|
+
* 从 JSON 数据创建 SyncConfig
|
|
2005
|
+
*/
|
|
2006
|
+
static fromJSON(data) {
|
|
2007
|
+
return _SyncConfig.create(data);
|
|
2008
|
+
}
|
|
2009
|
+
// ============================================================================
|
|
2010
|
+
// Getters
|
|
2011
|
+
// ============================================================================
|
|
2012
|
+
/**
|
|
2013
|
+
* 获取数据库端点 URL(包含数据库名)
|
|
2014
|
+
*/
|
|
2015
|
+
getDbEndpoint() {
|
|
2016
|
+
return this.dbEndpoint;
|
|
2017
|
+
}
|
|
2018
|
+
/**
|
|
2019
|
+
* 获取数据库名称
|
|
2020
|
+
*/
|
|
2021
|
+
getDbName() {
|
|
2022
|
+
return this.dbName;
|
|
2023
|
+
}
|
|
2024
|
+
/**
|
|
2025
|
+
* 获取用户邮箱
|
|
2026
|
+
*/
|
|
2027
|
+
getEmail() {
|
|
2028
|
+
return this.email;
|
|
2029
|
+
}
|
|
2030
|
+
/**
|
|
2031
|
+
* 获取数据库密码
|
|
2032
|
+
*/
|
|
2033
|
+
getDbPassword() {
|
|
2034
|
+
return this.dbPassword;
|
|
2035
|
+
}
|
|
2036
|
+
/**
|
|
2037
|
+
* 获取用户目录
|
|
2038
|
+
*/
|
|
2039
|
+
getUserDir() {
|
|
2040
|
+
return this.userDir;
|
|
2041
|
+
}
|
|
2042
|
+
/**
|
|
2043
|
+
* 获取 CouchDB URI(不包含数据库名)
|
|
2044
|
+
* 例如:https://couch.example.com/dbname -> https://couch.example.com
|
|
2045
|
+
*/
|
|
2046
|
+
getCouchDbUri() {
|
|
2047
|
+
return this.dbEndpoint.replace(`/${this.dbName}`, "");
|
|
2048
|
+
}
|
|
2049
|
+
// ============================================================================
|
|
2050
|
+
// Serialization
|
|
2051
|
+
// ============================================================================
|
|
2052
|
+
/**
|
|
2053
|
+
* 序列化为 JSON
|
|
2054
|
+
*/
|
|
2055
|
+
toJSON() {
|
|
2056
|
+
return {
|
|
2057
|
+
dbEndpoint: this.dbEndpoint,
|
|
2058
|
+
dbName: this.dbName,
|
|
2059
|
+
email: this.email,
|
|
2060
|
+
dbPassword: this.dbPassword,
|
|
2061
|
+
userDir: this.userDir
|
|
2062
|
+
};
|
|
2063
|
+
}
|
|
2064
|
+
/**
|
|
2065
|
+
* 转换为 Obsidian LiveSync 插件格式
|
|
2066
|
+
* 用于直接配置 Obsidian 的 LiveSync 插件
|
|
2067
|
+
*/
|
|
2068
|
+
toObsidianLiveSyncFormat() {
|
|
2069
|
+
return {
|
|
2070
|
+
couchDB_URI: this.getCouchDbUri(),
|
|
2071
|
+
couchDB_DBNAME: this.dbName,
|
|
2072
|
+
couchDB_USER: this.email,
|
|
2073
|
+
couchDB_PASSWORD: this.dbPassword,
|
|
2074
|
+
encrypt: true,
|
|
2075
|
+
syncOnStart: true,
|
|
2076
|
+
syncOnSave: true,
|
|
2077
|
+
liveSync: true
|
|
2078
|
+
};
|
|
2079
|
+
}
|
|
2080
|
+
// ============================================================================
|
|
2081
|
+
// Comparison
|
|
2082
|
+
// ============================================================================
|
|
2083
|
+
/**
|
|
2084
|
+
* 比较两个 SyncConfig 是否相同
|
|
2085
|
+
*/
|
|
2086
|
+
equals(other) {
|
|
2087
|
+
return this.dbEndpoint === other.dbEndpoint && this.dbName === other.dbName && this.email === other.email;
|
|
2088
|
+
}
|
|
2089
|
+
};
|
|
2090
|
+
}
|
|
2091
|
+
});
|
|
2092
|
+
|
|
1973
2093
|
// internal/domain/identity/value-object/device.ts
|
|
1974
2094
|
var Device;
|
|
1975
2095
|
var init_device = __esm({
|
|
@@ -2184,14 +2304,16 @@ var init_user = __esm({
|
|
|
2184
2304
|
token;
|
|
2185
2305
|
serverConfig;
|
|
2186
2306
|
license;
|
|
2307
|
+
syncConfig;
|
|
2187
2308
|
/**
|
|
2188
2309
|
* 构造函数(私有,通过 Factory 创建)
|
|
2189
2310
|
*/
|
|
2190
|
-
constructor(email, token, serverConfig, license = null) {
|
|
2311
|
+
constructor(email, token, serverConfig, license = null, syncConfig = null) {
|
|
2191
2312
|
this.email = email;
|
|
2192
2313
|
this.token = token;
|
|
2193
2314
|
this.serverConfig = serverConfig;
|
|
2194
2315
|
this.license = license;
|
|
2316
|
+
this.syncConfig = syncConfig;
|
|
2195
2317
|
}
|
|
2196
2318
|
// ============================================================================
|
|
2197
2319
|
// Getters
|
|
@@ -2220,6 +2342,12 @@ var init_user = __esm({
|
|
|
2220
2342
|
getLicense() {
|
|
2221
2343
|
return this.license;
|
|
2222
2344
|
}
|
|
2345
|
+
/**
|
|
2346
|
+
* 获取同步配置
|
|
2347
|
+
*/
|
|
2348
|
+
getSyncConfig() {
|
|
2349
|
+
return this.syncConfig;
|
|
2350
|
+
}
|
|
2223
2351
|
// ============================================================================
|
|
2224
2352
|
// Business Logic
|
|
2225
2353
|
// ============================================================================
|
|
@@ -2253,6 +2381,18 @@ var init_user = __esm({
|
|
|
2253
2381
|
clearLicense() {
|
|
2254
2382
|
this.license = null;
|
|
2255
2383
|
}
|
|
2384
|
+
/**
|
|
2385
|
+
* 设置同步配置
|
|
2386
|
+
*/
|
|
2387
|
+
setSyncConfig(syncConfig) {
|
|
2388
|
+
this.syncConfig = syncConfig;
|
|
2389
|
+
}
|
|
2390
|
+
/**
|
|
2391
|
+
* 清除同步配置
|
|
2392
|
+
*/
|
|
2393
|
+
clearSyncConfig() {
|
|
2394
|
+
this.syncConfig = null;
|
|
2395
|
+
}
|
|
2256
2396
|
/**
|
|
2257
2397
|
* 检查是否已认证
|
|
2258
2398
|
*/
|
|
@@ -2318,7 +2458,8 @@ var init_user = __esm({
|
|
|
2318
2458
|
email: this.email.toJSON(),
|
|
2319
2459
|
token: this.token?.toJSON() || null,
|
|
2320
2460
|
serverConfig: this.serverConfig.toJSON(),
|
|
2321
|
-
license: this.license?.toJSON() || null
|
|
2461
|
+
license: this.license?.toJSON() || null,
|
|
2462
|
+
syncConfig: this.syncConfig?.toJSON() || null
|
|
2322
2463
|
};
|
|
2323
2464
|
}
|
|
2324
2465
|
};
|
|
@@ -2335,6 +2476,7 @@ var init_user_factory = __esm({
|
|
|
2335
2476
|
init_token();
|
|
2336
2477
|
init_server_config();
|
|
2337
2478
|
init_license();
|
|
2479
|
+
init_sync_config();
|
|
2338
2480
|
init_device();
|
|
2339
2481
|
init_log();
|
|
2340
2482
|
log4 = getDomainLogger("user-factory", { component: "domain" });
|
|
@@ -2372,10 +2514,15 @@ var init_user_factory = __esm({
|
|
|
2372
2514
|
if (userData.license) {
|
|
2373
2515
|
user.setLicense(userData.license);
|
|
2374
2516
|
}
|
|
2517
|
+
if (userData.syncConfig) {
|
|
2518
|
+
const syncConfig = SyncConfig.fromJSON(userData.syncConfig);
|
|
2519
|
+
user.setSyncConfig(syncConfig);
|
|
2520
|
+
}
|
|
2375
2521
|
log4.debug("User loaded from storage", {
|
|
2376
2522
|
email: email.getValue(),
|
|
2377
2523
|
hasToken: !!userData.token,
|
|
2378
|
-
hasLicense: !!userData.license
|
|
2524
|
+
hasLicense: !!userData.license,
|
|
2525
|
+
hasSyncConfig: !!userData.syncConfig
|
|
2379
2526
|
});
|
|
2380
2527
|
return user;
|
|
2381
2528
|
} catch (error) {
|
|
@@ -2384,24 +2531,27 @@ var init_user_factory = __esm({
|
|
|
2384
2531
|
}
|
|
2385
2532
|
}
|
|
2386
2533
|
/**
|
|
2387
|
-
* 保存用户到存储(合并保存 token, license, server config)
|
|
2534
|
+
* 保存用户到存储(合并保存 token, license, server config, sync config)
|
|
2388
2535
|
*/
|
|
2389
2536
|
async save(user) {
|
|
2390
2537
|
try {
|
|
2391
2538
|
const token = user.getToken();
|
|
2392
2539
|
const license = user.getLicense();
|
|
2540
|
+
const syncConfig = user.getSyncConfig();
|
|
2393
2541
|
const serverConfig = user.getServerConfig();
|
|
2394
2542
|
const email = user.getEmail().getValue();
|
|
2395
2543
|
await this.storageProvider.saveUserData({
|
|
2396
2544
|
token,
|
|
2397
2545
|
license,
|
|
2546
|
+
syncConfig,
|
|
2398
2547
|
serverConfig,
|
|
2399
2548
|
email
|
|
2400
2549
|
});
|
|
2401
2550
|
log4.debug("User saved to storage", {
|
|
2402
2551
|
email,
|
|
2403
2552
|
hasToken: !!token,
|
|
2404
|
-
hasLicense: !!license
|
|
2553
|
+
hasLicense: !!license,
|
|
2554
|
+
hasSyncConfig: !!syncConfig
|
|
2405
2555
|
});
|
|
2406
2556
|
} catch (error) {
|
|
2407
2557
|
log4.error("Failed to save user to storage", error);
|
|
@@ -2665,10 +2815,27 @@ var init_user_factory = __esm({
|
|
|
2665
2815
|
Date.now()
|
|
2666
2816
|
);
|
|
2667
2817
|
user.setLicense(license);
|
|
2818
|
+
if (data.sync && data.features.sync_enabled) {
|
|
2819
|
+
const syncConfig = SyncConfig.create({
|
|
2820
|
+
dbEndpoint: data.sync.db_endpoint,
|
|
2821
|
+
dbName: data.sync.db_name,
|
|
2822
|
+
email: data.sync.email,
|
|
2823
|
+
dbPassword: data.sync.db_password,
|
|
2824
|
+
userDir: data.user.user_dir
|
|
2825
|
+
});
|
|
2826
|
+
user.setSyncConfig(syncConfig);
|
|
2827
|
+
log4.info("Sync configuration saved", {
|
|
2828
|
+
dbName: syncConfig.getDbName(),
|
|
2829
|
+
email: syncConfig.getEmail(),
|
|
2830
|
+
userDir: syncConfig.getUserDir()
|
|
2831
|
+
});
|
|
2832
|
+
}
|
|
2668
2833
|
await this.save(user);
|
|
2669
2834
|
log4.info("License activated successfully", {
|
|
2670
2835
|
plan: license.getPlan(),
|
|
2671
|
-
expires: license.getFormattedExpiresAt()
|
|
2836
|
+
expires: license.getFormattedExpiresAt(),
|
|
2837
|
+
syncEnabled: data.features.sync_enabled,
|
|
2838
|
+
hasSyncConfig: user.getSyncConfig() !== null
|
|
2672
2839
|
});
|
|
2673
2840
|
return user;
|
|
2674
2841
|
} catch (error) {
|
|
@@ -3113,6 +3280,7 @@ __export(identity_exports, {
|
|
|
3113
3280
|
Email: () => Email,
|
|
3114
3281
|
License: () => License,
|
|
3115
3282
|
ServerConfig: () => ServerConfig,
|
|
3283
|
+
SyncConfig: () => SyncConfig,
|
|
3116
3284
|
Token: () => Token,
|
|
3117
3285
|
User: () => User,
|
|
3118
3286
|
UserFactory: () => UserFactory
|
|
@@ -3124,6 +3292,7 @@ var init_identity = __esm({
|
|
|
3124
3292
|
init_token();
|
|
3125
3293
|
init_server_config();
|
|
3126
3294
|
init_license();
|
|
3295
|
+
init_sync_config();
|
|
3127
3296
|
init_device();
|
|
3128
3297
|
init_user();
|
|
3129
3298
|
init_user_factory();
|
|
@@ -54871,7 +55040,7 @@ For more information, visit: https://help.mdfriday.com
|
|
|
54871
55040
|
* Show version
|
|
54872
55041
|
*/
|
|
54873
55042
|
showVersion() {
|
|
54874
|
-
const version = "26.3.
|
|
55043
|
+
const version = "26.3.10";
|
|
54875
55044
|
return {
|
|
54876
55045
|
success: true,
|
|
54877
55046
|
message: `MDFriday CLI v${version}`
|
package/dist/index.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export { processSSGParallel, ParallelSSGStats } from './internal/application/ssg
|
|
|
3
3
|
export { startIncrementalBuild, IncrementalBuildConfig, IncrementalBuildCoordinator } from './internal/application/incremental-ssg';
|
|
4
4
|
export { MarkdownRenderer, AutoIDGenerator, ParsingResult, Header, TocFragments, Link, Paragraph } from './internal/domain/markdown';
|
|
5
5
|
export { PageTask } from './pkg/page-filter';
|
|
6
|
-
export { ObsidianWorkspaceService, createObsidianWorkspaceService, ObsidianWorkspaceInitOptions, ObsidianWorkspaceInfo, ObsidianWorkspaceResult, ObsidianProjectService, createObsidianProjectService, ObsidianProjectCreateOptions, ObsidianProjectInfo, ObsidianProjectResult, ObsidianBuildService, createObsidianBuildService, ObsidianBuildOptions, ObsidianBuildResult, ObsidianGlobalConfigService, ObsidianProjectConfigService, createObsidianGlobalConfigService, createObsidianProjectConfigService, ObsidianConfigResult, ConfigGetResult, ConfigListResult, ObsidianPublishService, createObsidianPublishService, ObsidianPublishMethod, ObsidianPublishOptions, ObsidianPublishProgress, ObsidianPublishResult, ObsidianTestConnectionResult, ObsidianServeService, createObsidianServeService, ObsidianServeOptions, ObsidianServeResult, ObsidianServeProgress, ObsidianLicenseService, createObsidianLicenseService, ObsidianLicenseInfo, ObsidianLicenseUsage, ObsidianLicenseResult, ObsidianAuthService, createObsidianAuthService, ObsidianAuthStatus, ObsidianServerConfig, ObsidianAuthResult, ObsidianDomainService, createObsidianDomainService, ObsidianDomainInfo, ObsidianSubdomainCheckResult, ObsidianSubdomainUpdateResult, ObsidianCustomDomainCheckResult, ObsidianCustomDomainAddResult, ObsidianHttpsCertificate, ObsidianHttpsStatusResult, ObsidianDomainResult, createWorkspaceAppService, createWorkspaceFactory, type PublishHttpClient, type PublishHttpResponse, type IdentityHttpClient, type IdentityHttpResponse, type AnyPublishConfig, type FTPConfig, type NetlifyConfig, type MDFridayConfig, } from './internal/interfaces/obsidian';
|
|
6
|
+
export { ObsidianWorkspaceService, createObsidianWorkspaceService, ObsidianWorkspaceInitOptions, ObsidianWorkspaceInfo, ObsidianWorkspaceResult, ObsidianProjectService, createObsidianProjectService, ObsidianProjectCreateOptions, ObsidianProjectInfo, ObsidianProjectResult, ObsidianBuildService, createObsidianBuildService, ObsidianBuildOptions, ObsidianBuildResult, ObsidianGlobalConfigService, ObsidianProjectConfigService, createObsidianGlobalConfigService, createObsidianProjectConfigService, ObsidianConfigResult, ConfigGetResult, ConfigListResult, ObsidianPublishService, createObsidianPublishService, ObsidianPublishMethod, ObsidianPublishOptions, ObsidianPublishProgress, ObsidianPublishResult, ObsidianTestConnectionResult, ObsidianServeService, createObsidianServeService, ObsidianServeOptions, ObsidianServeResult, ObsidianServeProgress, ObsidianLicenseService, createObsidianLicenseService, ObsidianLicenseInfo, ObsidianLicenseUsage, ObsidianLicenseResult, ObsidianAuthService, createObsidianAuthService, ObsidianAuthStatus, ObsidianServerConfig, ObsidianAuthResult, ObsidianDomainService, createObsidianDomainService, ObsidianDomainInfo, ObsidianSubdomainCheckResult, ObsidianSubdomainUpdateResult, ObsidianCustomDomainCheckResult, ObsidianCustomDomainAddResult, ObsidianHttpsCertificate, ObsidianHttpsStatusResult, ObsidianDomainResult, createWorkspaceAppService, createWorkspaceFactory, type PublishHttpClient, type PublishHttpResponse, type IdentityHttpClient, type IdentityHttpResponse, type AnyPublishConfig, type FTPConfig, type NetlifyConfig, type MDFridayConfig, type SyncConfig, type SyncConfigData, } from './internal/interfaces/obsidian';
|