next-admin-svr 0.1.48 → 1.0.1
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/lib/index.js +48 -24
- package/lib/index.mjs +48 -24
- package/lib/utils/email/watch-and-sync-iwiki.d.ts +42 -1
- package/lib/utils/init.d.ts +1 -1
- package/package.json +5 -3
package/lib/index.js
CHANGED
|
@@ -1319,6 +1319,7 @@ router$7.post('/mcp-upload', uploadWithSlice.single('file'), async (req, res) =>
|
|
|
1319
1319
|
console.log('[mcp-upload] req.body', req.body);
|
|
1320
1320
|
const parsedDir = getUploadDir(dir, cdn);
|
|
1321
1321
|
const staffName = (req.header('rid') || 'developer');
|
|
1322
|
+
const toolName = (req.header('x-mcp-tool-name') || '');
|
|
1322
1323
|
const newFileKey = `${parsedDir}/${qiniuKey}`;
|
|
1323
1324
|
if (!cdn) {
|
|
1324
1325
|
res.send({ r: -1, msg: '缺少 cdn 参数' });
|
|
@@ -1404,6 +1405,7 @@ router$7.post('/mcp-upload', uploadWithSlice.single('file'), async (req, res) =>
|
|
|
1404
1405
|
mcpDB,
|
|
1405
1406
|
mcpName,
|
|
1406
1407
|
mcpVersion,
|
|
1408
|
+
toolName,
|
|
1407
1409
|
imageDB,
|
|
1408
1410
|
operationTool: coreModule.get().operation,
|
|
1409
1411
|
});
|
|
@@ -1425,6 +1427,7 @@ router$6.post('/start-publish', async (req, res) => {
|
|
|
1425
1427
|
}
|
|
1426
1428
|
}
|
|
1427
1429
|
const staffName = (req.header('rid') || 'developer');
|
|
1430
|
+
const toolName = (req.header('x-mcp-tool-name') || '');
|
|
1428
1431
|
const { mcpName, mcpVersion, repo, branch, publishReason, subProjectName, } = req.body;
|
|
1429
1432
|
const result = await shared.startMpCIPipeline({
|
|
1430
1433
|
repo,
|
|
@@ -1437,6 +1440,8 @@ router$6.post('/start-publish', async (req, res) => {
|
|
|
1437
1440
|
mcpVersion,
|
|
1438
1441
|
operationTool: coreModule.get().operation,
|
|
1439
1442
|
startPipeline: coreModule.get().landun.startPipeline,
|
|
1443
|
+
mcpDB: coreModule.get().mcpDB,
|
|
1444
|
+
toolName,
|
|
1440
1445
|
});
|
|
1441
1446
|
res.send(result);
|
|
1442
1447
|
});
|
|
@@ -1470,6 +1475,7 @@ router$4.post('/mcp-start', async (req, res) => {
|
|
|
1470
1475
|
}
|
|
1471
1476
|
}
|
|
1472
1477
|
const staffName = (req.header('rid') || 'developer');
|
|
1478
|
+
const toolName = (req.header('x-mcp-tool-name') || '');
|
|
1473
1479
|
const { mcpName, mcpVersion, repo, branch, publishReason, versionType, publishExternalNPM, publishPackage, } = req.body;
|
|
1474
1480
|
console.log('[mcp-start]', {
|
|
1475
1481
|
mcpName,
|
|
@@ -1503,6 +1509,7 @@ router$4.post('/mcp-start', async (req, res) => {
|
|
|
1503
1509
|
mcpName,
|
|
1504
1510
|
mcpVersion,
|
|
1505
1511
|
operationTool: coreModule.get().operation,
|
|
1512
|
+
toolName,
|
|
1506
1513
|
});
|
|
1507
1514
|
res.send(result);
|
|
1508
1515
|
});
|
|
@@ -2678,7 +2685,7 @@ async function updateWhiteUserStatus({ status = false, pipelineRunId = '', }) {
|
|
|
2678
2685
|
|
|
2679
2686
|
const CRON_TIME = '0 */10 * * * *';
|
|
2680
2687
|
function createUpdateWhiteUserCosCron() {
|
|
2681
|
-
if (process.env.NODE_ENV === 'development') {
|
|
2688
|
+
if (process.env.NODE_ENV === 'development' || process.platform !== 'linux') {
|
|
2682
2689
|
return;
|
|
2683
2690
|
}
|
|
2684
2691
|
try {
|
|
@@ -2740,21 +2747,24 @@ const ROBOT_NOTIFY_CONFIG = {
|
|
|
2740
2747
|
* 2. 收到新邮件后,提取 markdown 内容
|
|
2741
2748
|
* 3. 创建 iwiki 文档
|
|
2742
2749
|
*/
|
|
2743
|
-
async function watchEmailAndSyncToIwiki() {
|
|
2744
|
-
const
|
|
2750
|
+
async function watchEmailAndSyncToIwiki(options = {}) {
|
|
2751
|
+
const mergedEmailConfig = { ...EMAIL_CONFIG, ...options.emailConfig };
|
|
2752
|
+
const mergedIwikiConfig = { ...IWIKI_CONFIG, ...options.iwikiConfig };
|
|
2753
|
+
const mergedRobotNotifyConfig = { ...ROBOT_NOTIFY_CONFIG, ...options.robotNotifyConfig };
|
|
2754
|
+
const password = process.env[mergedEmailConfig.passwordEnvName];
|
|
2745
2755
|
if (!password) {
|
|
2746
|
-
console.error(`[EmailSync] 环境变量 ${
|
|
2756
|
+
console.error(`[EmailSync] 环境变量 ${mergedEmailConfig.passwordEnvName} 未设置,无法启动邮件监听`);
|
|
2747
2757
|
return;
|
|
2748
2758
|
}
|
|
2749
2759
|
const watcher = await shared.watchEmails({
|
|
2750
|
-
host:
|
|
2751
|
-
user:
|
|
2760
|
+
host: mergedEmailConfig.host,
|
|
2761
|
+
user: mergedEmailConfig.user,
|
|
2752
2762
|
password,
|
|
2753
2763
|
onNewEmail: async (email) => {
|
|
2754
2764
|
console.log(`[EmailSync] 📬 收到新邮件: "${email.subject}" from ${email.from}`);
|
|
2755
2765
|
tComm.saveJsonToLog(email, 'new-email.json');
|
|
2756
2766
|
try {
|
|
2757
|
-
await syncEmailToIwiki(email);
|
|
2767
|
+
await syncEmailToIwiki(email, mergedIwikiConfig, mergedRobotNotifyConfig);
|
|
2758
2768
|
}
|
|
2759
2769
|
catch (err) {
|
|
2760
2770
|
console.error('[EmailSync] 同步邮件到 iwiki 失败:', err);
|
|
@@ -2776,7 +2786,7 @@ async function watchEmailAndSyncToIwiki() {
|
|
|
2776
2786
|
/**
|
|
2777
2787
|
* 将单封邮件同步到 iwiki
|
|
2778
2788
|
*/
|
|
2779
|
-
async function syncEmailToIwiki(email) {
|
|
2789
|
+
async function syncEmailToIwiki(email, iwikiConfig, robotNotifyConfig) {
|
|
2780
2790
|
// 1. 构建邮件的完整 Markdown 内容
|
|
2781
2791
|
let fullMarkdown = buildEmailMarkdown(email);
|
|
2782
2792
|
if (!fullMarkdown.trim()) {
|
|
@@ -2792,10 +2802,10 @@ async function syncEmailToIwiki(email) {
|
|
|
2792
2802
|
sender: email.from,
|
|
2793
2803
|
};
|
|
2794
2804
|
// 4. 创建 iwiki 文档
|
|
2795
|
-
const iwikiUrl = await saveToIwiki(entry);
|
|
2805
|
+
const iwikiUrl = await saveToIwiki(entry, iwikiConfig);
|
|
2796
2806
|
console.log(`[EmailSync] ✅ 邮件 "${email.subject}" 已同步到 iwiki: ${iwikiUrl}`);
|
|
2797
2807
|
// 5. 发送企微机器人通知
|
|
2798
|
-
await notifyRobot(entry, iwikiUrl);
|
|
2808
|
+
await notifyRobot(entry, iwikiUrl, robotNotifyConfig);
|
|
2799
2809
|
}
|
|
2800
2810
|
// ==================== 图片上传 ====================
|
|
2801
2811
|
/** 匹配 Markdown 中的 base64 图片: */
|
|
@@ -2936,10 +2946,24 @@ function buildEmailMarkdown(email) {
|
|
|
2936
2946
|
/**
|
|
2937
2947
|
* 通过企微机器人发送通知消息
|
|
2938
2948
|
*/
|
|
2939
|
-
async function notifyRobot(entry, iwikiUrl) {
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2949
|
+
async function notifyRobot(entry, iwikiUrl, robotNotifyConfig) {
|
|
2950
|
+
if (!robotNotifyConfig.webhookUrl) {
|
|
2951
|
+
console.warn('[EmailSync] 未配置机器人 webhookUrl,跳过通知');
|
|
2952
|
+
return;
|
|
2953
|
+
}
|
|
2954
|
+
// 清理 HTML 标签,避免未闭合标签(如 <style、<table 等)破坏企微 Markdown 渲染
|
|
2955
|
+
const plainContent = entry.content
|
|
2956
|
+
.replace(/<style[\s\S]*?<\/style>/gi, '') // 移除完整的 <style> 块
|
|
2957
|
+
.replace(/<script[\s\S]*?<\/script>/gi, '') // 移除完整的 <script> 块
|
|
2958
|
+
.replace(/<[^>]*>/g, '') // 移除所有 HTML 标签
|
|
2959
|
+
.replace(/ /g, ' ') // 替换常见 HTML 实体
|
|
2960
|
+
.replace(/</g, '<')
|
|
2961
|
+
.replace(/>/g, '>')
|
|
2962
|
+
.replace(/&/g, '&')
|
|
2963
|
+
.trim();
|
|
2964
|
+
const contentPreview = plainContent.length > 200
|
|
2965
|
+
? `${plainContent.slice(0, 200)}...`
|
|
2966
|
+
: plainContent;
|
|
2943
2967
|
const message = [
|
|
2944
2968
|
'📬 **邮件知识已同步到 iwiki**',
|
|
2945
2969
|
'',
|
|
@@ -2951,8 +2975,8 @@ async function notifyRobot(entry, iwikiUrl) {
|
|
|
2951
2975
|
try {
|
|
2952
2976
|
await tComm.batchSendWxRobotMarkdown({
|
|
2953
2977
|
content: message,
|
|
2954
|
-
chatId:
|
|
2955
|
-
webhookUrl:
|
|
2978
|
+
chatId: robotNotifyConfig.chatId,
|
|
2979
|
+
webhookUrl: robotNotifyConfig.webhookUrl,
|
|
2956
2980
|
isV2: true,
|
|
2957
2981
|
});
|
|
2958
2982
|
console.log('[EmailSync] 📤 机器人通知已发送');
|
|
@@ -2964,18 +2988,18 @@ async function notifyRobot(entry, iwikiUrl) {
|
|
|
2964
2988
|
/**
|
|
2965
2989
|
* 创建 iwiki 文档
|
|
2966
2990
|
*/
|
|
2967
|
-
async function saveToIwiki(entry) {
|
|
2968
|
-
const paasToken = process.env[
|
|
2991
|
+
async function saveToIwiki(entry, iwikiConfig) {
|
|
2992
|
+
const paasToken = process.env[iwikiConfig.paasTokenEnvName] || '';
|
|
2969
2993
|
if (!paasToken) {
|
|
2970
|
-
throw new Error(`环境变量 ${
|
|
2994
|
+
throw new Error(`环境变量 ${iwikiConfig.paasTokenEnvName} 未设置`);
|
|
2971
2995
|
}
|
|
2972
2996
|
const docTitle = `${entry.title} - ${entry.sender}`;
|
|
2973
2997
|
const res = await tComm.createIwikiDoc({
|
|
2974
|
-
prefix:
|
|
2975
|
-
paasId:
|
|
2998
|
+
prefix: iwikiConfig.urlPrefixInOA,
|
|
2999
|
+
paasId: iwikiConfig.paasid,
|
|
2976
3000
|
paasToken,
|
|
2977
|
-
parentid:
|
|
2978
|
-
spacekey:
|
|
3001
|
+
parentid: iwikiConfig.parentDocId,
|
|
3002
|
+
spacekey: iwikiConfig.spacekey,
|
|
2979
3003
|
bodymode: 'md',
|
|
2980
3004
|
title: docTitle,
|
|
2981
3005
|
body: entry.content,
|
|
@@ -2984,7 +3008,7 @@ async function saveToIwiki(entry) {
|
|
|
2984
3008
|
if (!res.data?.id) {
|
|
2985
3009
|
throw new Error(`创建 iwiki 文档失败: ${res.msg}`);
|
|
2986
3010
|
}
|
|
2987
|
-
return `${
|
|
3011
|
+
return `${iwikiConfig.iwikiUrlPrefix}${res.data.id}`;
|
|
2988
3012
|
}
|
|
2989
3013
|
|
|
2990
3014
|
exports.componentStatisticsOpenRouter = router$e;
|
package/lib/index.mjs
CHANGED
|
@@ -1308,6 +1308,7 @@ router$7.post('/mcp-upload', uploadWithSlice.single('file'), async (req, res) =>
|
|
|
1308
1308
|
console.log('[mcp-upload] req.body', req.body);
|
|
1309
1309
|
const parsedDir = getUploadDir(dir, cdn);
|
|
1310
1310
|
const staffName = (req.header('rid') || 'developer');
|
|
1311
|
+
const toolName = (req.header('x-mcp-tool-name') || '');
|
|
1311
1312
|
const newFileKey = `${parsedDir}/${qiniuKey}`;
|
|
1312
1313
|
if (!cdn) {
|
|
1313
1314
|
res.send({ r: -1, msg: '缺少 cdn 参数' });
|
|
@@ -1393,6 +1394,7 @@ router$7.post('/mcp-upload', uploadWithSlice.single('file'), async (req, res) =>
|
|
|
1393
1394
|
mcpDB,
|
|
1394
1395
|
mcpName,
|
|
1395
1396
|
mcpVersion,
|
|
1397
|
+
toolName,
|
|
1396
1398
|
imageDB,
|
|
1397
1399
|
operationTool: coreModule.get().operation,
|
|
1398
1400
|
});
|
|
@@ -1414,6 +1416,7 @@ router$6.post('/start-publish', async (req, res) => {
|
|
|
1414
1416
|
}
|
|
1415
1417
|
}
|
|
1416
1418
|
const staffName = (req.header('rid') || 'developer');
|
|
1419
|
+
const toolName = (req.header('x-mcp-tool-name') || '');
|
|
1417
1420
|
const { mcpName, mcpVersion, repo, branch, publishReason, subProjectName, } = req.body;
|
|
1418
1421
|
const result = await startMpCIPipeline({
|
|
1419
1422
|
repo,
|
|
@@ -1426,6 +1429,8 @@ router$6.post('/start-publish', async (req, res) => {
|
|
|
1426
1429
|
mcpVersion,
|
|
1427
1430
|
operationTool: coreModule.get().operation,
|
|
1428
1431
|
startPipeline: coreModule.get().landun.startPipeline,
|
|
1432
|
+
mcpDB: coreModule.get().mcpDB,
|
|
1433
|
+
toolName,
|
|
1429
1434
|
});
|
|
1430
1435
|
res.send(result);
|
|
1431
1436
|
});
|
|
@@ -1459,6 +1464,7 @@ router$4.post('/mcp-start', async (req, res) => {
|
|
|
1459
1464
|
}
|
|
1460
1465
|
}
|
|
1461
1466
|
const staffName = (req.header('rid') || 'developer');
|
|
1467
|
+
const toolName = (req.header('x-mcp-tool-name') || '');
|
|
1462
1468
|
const { mcpName, mcpVersion, repo, branch, publishReason, versionType, publishExternalNPM, publishPackage, } = req.body;
|
|
1463
1469
|
console.log('[mcp-start]', {
|
|
1464
1470
|
mcpName,
|
|
@@ -1492,6 +1498,7 @@ router$4.post('/mcp-start', async (req, res) => {
|
|
|
1492
1498
|
mcpName,
|
|
1493
1499
|
mcpVersion,
|
|
1494
1500
|
operationTool: coreModule.get().operation,
|
|
1501
|
+
toolName,
|
|
1495
1502
|
});
|
|
1496
1503
|
res.send(result);
|
|
1497
1504
|
});
|
|
@@ -2667,7 +2674,7 @@ async function updateWhiteUserStatus({ status = false, pipelineRunId = '', }) {
|
|
|
2667
2674
|
|
|
2668
2675
|
const CRON_TIME = '0 */10 * * * *';
|
|
2669
2676
|
function createUpdateWhiteUserCosCron() {
|
|
2670
|
-
if (process.env.NODE_ENV === 'development') {
|
|
2677
|
+
if (process.env.NODE_ENV === 'development' || process.platform !== 'linux') {
|
|
2671
2678
|
return;
|
|
2672
2679
|
}
|
|
2673
2680
|
try {
|
|
@@ -2729,21 +2736,24 @@ const ROBOT_NOTIFY_CONFIG = {
|
|
|
2729
2736
|
* 2. 收到新邮件后,提取 markdown 内容
|
|
2730
2737
|
* 3. 创建 iwiki 文档
|
|
2731
2738
|
*/
|
|
2732
|
-
async function watchEmailAndSyncToIwiki() {
|
|
2733
|
-
const
|
|
2739
|
+
async function watchEmailAndSyncToIwiki(options = {}) {
|
|
2740
|
+
const mergedEmailConfig = { ...EMAIL_CONFIG, ...options.emailConfig };
|
|
2741
|
+
const mergedIwikiConfig = { ...IWIKI_CONFIG, ...options.iwikiConfig };
|
|
2742
|
+
const mergedRobotNotifyConfig = { ...ROBOT_NOTIFY_CONFIG, ...options.robotNotifyConfig };
|
|
2743
|
+
const password = process.env[mergedEmailConfig.passwordEnvName];
|
|
2734
2744
|
if (!password) {
|
|
2735
|
-
console.error(`[EmailSync] 环境变量 ${
|
|
2745
|
+
console.error(`[EmailSync] 环境变量 ${mergedEmailConfig.passwordEnvName} 未设置,无法启动邮件监听`);
|
|
2736
2746
|
return;
|
|
2737
2747
|
}
|
|
2738
2748
|
const watcher = await watchEmails({
|
|
2739
|
-
host:
|
|
2740
|
-
user:
|
|
2749
|
+
host: mergedEmailConfig.host,
|
|
2750
|
+
user: mergedEmailConfig.user,
|
|
2741
2751
|
password,
|
|
2742
2752
|
onNewEmail: async (email) => {
|
|
2743
2753
|
console.log(`[EmailSync] 📬 收到新邮件: "${email.subject}" from ${email.from}`);
|
|
2744
2754
|
saveJsonToLog(email, 'new-email.json');
|
|
2745
2755
|
try {
|
|
2746
|
-
await syncEmailToIwiki(email);
|
|
2756
|
+
await syncEmailToIwiki(email, mergedIwikiConfig, mergedRobotNotifyConfig);
|
|
2747
2757
|
}
|
|
2748
2758
|
catch (err) {
|
|
2749
2759
|
console.error('[EmailSync] 同步邮件到 iwiki 失败:', err);
|
|
@@ -2765,7 +2775,7 @@ async function watchEmailAndSyncToIwiki() {
|
|
|
2765
2775
|
/**
|
|
2766
2776
|
* 将单封邮件同步到 iwiki
|
|
2767
2777
|
*/
|
|
2768
|
-
async function syncEmailToIwiki(email) {
|
|
2778
|
+
async function syncEmailToIwiki(email, iwikiConfig, robotNotifyConfig) {
|
|
2769
2779
|
// 1. 构建邮件的完整 Markdown 内容
|
|
2770
2780
|
let fullMarkdown = buildEmailMarkdown(email);
|
|
2771
2781
|
if (!fullMarkdown.trim()) {
|
|
@@ -2781,10 +2791,10 @@ async function syncEmailToIwiki(email) {
|
|
|
2781
2791
|
sender: email.from,
|
|
2782
2792
|
};
|
|
2783
2793
|
// 4. 创建 iwiki 文档
|
|
2784
|
-
const iwikiUrl = await saveToIwiki(entry);
|
|
2794
|
+
const iwikiUrl = await saveToIwiki(entry, iwikiConfig);
|
|
2785
2795
|
console.log(`[EmailSync] ✅ 邮件 "${email.subject}" 已同步到 iwiki: ${iwikiUrl}`);
|
|
2786
2796
|
// 5. 发送企微机器人通知
|
|
2787
|
-
await notifyRobot(entry, iwikiUrl);
|
|
2797
|
+
await notifyRobot(entry, iwikiUrl, robotNotifyConfig);
|
|
2788
2798
|
}
|
|
2789
2799
|
// ==================== 图片上传 ====================
|
|
2790
2800
|
/** 匹配 Markdown 中的 base64 图片: */
|
|
@@ -2925,10 +2935,24 @@ function buildEmailMarkdown(email) {
|
|
|
2925
2935
|
/**
|
|
2926
2936
|
* 通过企微机器人发送通知消息
|
|
2927
2937
|
*/
|
|
2928
|
-
async function notifyRobot(entry, iwikiUrl) {
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2938
|
+
async function notifyRobot(entry, iwikiUrl, robotNotifyConfig) {
|
|
2939
|
+
if (!robotNotifyConfig.webhookUrl) {
|
|
2940
|
+
console.warn('[EmailSync] 未配置机器人 webhookUrl,跳过通知');
|
|
2941
|
+
return;
|
|
2942
|
+
}
|
|
2943
|
+
// 清理 HTML 标签,避免未闭合标签(如 <style、<table 等)破坏企微 Markdown 渲染
|
|
2944
|
+
const plainContent = entry.content
|
|
2945
|
+
.replace(/<style[\s\S]*?<\/style>/gi, '') // 移除完整的 <style> 块
|
|
2946
|
+
.replace(/<script[\s\S]*?<\/script>/gi, '') // 移除完整的 <script> 块
|
|
2947
|
+
.replace(/<[^>]*>/g, '') // 移除所有 HTML 标签
|
|
2948
|
+
.replace(/ /g, ' ') // 替换常见 HTML 实体
|
|
2949
|
+
.replace(/</g, '<')
|
|
2950
|
+
.replace(/>/g, '>')
|
|
2951
|
+
.replace(/&/g, '&')
|
|
2952
|
+
.trim();
|
|
2953
|
+
const contentPreview = plainContent.length > 200
|
|
2954
|
+
? `${plainContent.slice(0, 200)}...`
|
|
2955
|
+
: plainContent;
|
|
2932
2956
|
const message = [
|
|
2933
2957
|
'📬 **邮件知识已同步到 iwiki**',
|
|
2934
2958
|
'',
|
|
@@ -2940,8 +2964,8 @@ async function notifyRobot(entry, iwikiUrl) {
|
|
|
2940
2964
|
try {
|
|
2941
2965
|
await batchSendWxRobotMarkdown({
|
|
2942
2966
|
content: message,
|
|
2943
|
-
chatId:
|
|
2944
|
-
webhookUrl:
|
|
2967
|
+
chatId: robotNotifyConfig.chatId,
|
|
2968
|
+
webhookUrl: robotNotifyConfig.webhookUrl,
|
|
2945
2969
|
isV2: true,
|
|
2946
2970
|
});
|
|
2947
2971
|
console.log('[EmailSync] 📤 机器人通知已发送');
|
|
@@ -2953,18 +2977,18 @@ async function notifyRobot(entry, iwikiUrl) {
|
|
|
2953
2977
|
/**
|
|
2954
2978
|
* 创建 iwiki 文档
|
|
2955
2979
|
*/
|
|
2956
|
-
async function saveToIwiki(entry) {
|
|
2957
|
-
const paasToken = process.env[
|
|
2980
|
+
async function saveToIwiki(entry, iwikiConfig) {
|
|
2981
|
+
const paasToken = process.env[iwikiConfig.paasTokenEnvName] || '';
|
|
2958
2982
|
if (!paasToken) {
|
|
2959
|
-
throw new Error(`环境变量 ${
|
|
2983
|
+
throw new Error(`环境变量 ${iwikiConfig.paasTokenEnvName} 未设置`);
|
|
2960
2984
|
}
|
|
2961
2985
|
const docTitle = `${entry.title} - ${entry.sender}`;
|
|
2962
2986
|
const res = await createIwikiDoc({
|
|
2963
|
-
prefix:
|
|
2964
|
-
paasId:
|
|
2987
|
+
prefix: iwikiConfig.urlPrefixInOA,
|
|
2988
|
+
paasId: iwikiConfig.paasid,
|
|
2965
2989
|
paasToken,
|
|
2966
|
-
parentid:
|
|
2967
|
-
spacekey:
|
|
2990
|
+
parentid: iwikiConfig.parentDocId,
|
|
2991
|
+
spacekey: iwikiConfig.spacekey,
|
|
2968
2992
|
bodymode: 'md',
|
|
2969
2993
|
title: docTitle,
|
|
2970
2994
|
body: entry.content,
|
|
@@ -2973,7 +2997,7 @@ async function saveToIwiki(entry) {
|
|
|
2973
2997
|
if (!res.data?.id) {
|
|
2974
2998
|
throw new Error(`创建 iwiki 文档失败: ${res.msg}`);
|
|
2975
2999
|
}
|
|
2976
|
-
return `${
|
|
3000
|
+
return `${iwikiConfig.iwikiUrlPrefix}${res.data.id}`;
|
|
2977
3001
|
}
|
|
2978
3002
|
|
|
2979
3003
|
export { router$e as componentStatisticsOpenRouter, router$d as componentStatisticsRouter, coreModule, createUpdateWhiteUserCosCron, router$b as cyclomaticComplexityOpenRouter, router$c as cyclomaticComplexityRouter, router$a as fontProjectRouter, router$9 as iconProjectRouter, router$7 as imageOpenRouter, router$8 as imageRouter, router$6 as mpCiOpenRouter, router$4 as pipelineOpenRouter, router$5 as pipelineRouter, router$2 as robotKnowledgeEntryRouter, router$3 as robotRouter, watchEmailAndSyncToIwiki, router as whiteUserOpenRouter, router$1 as whiteUserRouter };
|
|
@@ -1,3 +1,43 @@
|
|
|
1
|
+
/** 邮箱 IMAP 连接配置参数 */
|
|
2
|
+
interface EmailConfigOptions {
|
|
3
|
+
/** IMAP 服务器地址 */
|
|
4
|
+
host?: string;
|
|
5
|
+
/** 邮箱账号 */
|
|
6
|
+
user?: string;
|
|
7
|
+
/** 密码环境变量名 */
|
|
8
|
+
passwordEnvName?: string;
|
|
9
|
+
}
|
|
10
|
+
/** iwiki 配置参数 */
|
|
11
|
+
interface IwikiConfigOptions {
|
|
12
|
+
/** OA 环境的 iwiki API 前缀 */
|
|
13
|
+
urlPrefixInOA?: string;
|
|
14
|
+
/** iwiki 文档 URL 前缀 */
|
|
15
|
+
iwikiUrlPrefix?: string;
|
|
16
|
+
/** iwiki 空间 key */
|
|
17
|
+
spacekey?: string;
|
|
18
|
+
/** 邮件同步文档的父级文档 ID */
|
|
19
|
+
parentDocId?: number;
|
|
20
|
+
/** paas 认证 ID */
|
|
21
|
+
paasid?: string;
|
|
22
|
+
/** paas token 环境变量名 */
|
|
23
|
+
paasTokenEnvName?: string;
|
|
24
|
+
}
|
|
25
|
+
/** 企微机器人通知配置参数 */
|
|
26
|
+
interface RobotNotifyConfigOptions {
|
|
27
|
+
/** 机器人 webhook URL */
|
|
28
|
+
webhookUrl?: string;
|
|
29
|
+
/** 群聊 chatId */
|
|
30
|
+
chatId?: string;
|
|
31
|
+
}
|
|
32
|
+
/** watchEmailAndSyncToIwiki 的参数 */
|
|
33
|
+
interface WatchEmailAndSyncToIwikiOptions {
|
|
34
|
+
/** 邮箱 IMAP 连接配置 */
|
|
35
|
+
emailConfig?: EmailConfigOptions;
|
|
36
|
+
/** iwiki 配置 */
|
|
37
|
+
iwikiConfig?: IwikiConfigOptions;
|
|
38
|
+
/** 企微机器人通知配置 */
|
|
39
|
+
robotNotifyConfig?: RobotNotifyConfigOptions;
|
|
40
|
+
}
|
|
1
41
|
/**
|
|
2
42
|
* 启动邮件监听,自动将新邮件内容同步到 iwiki
|
|
3
43
|
*
|
|
@@ -6,4 +46,5 @@
|
|
|
6
46
|
* 2. 收到新邮件后,提取 markdown 内容
|
|
7
47
|
* 3. 创建 iwiki 文档
|
|
8
48
|
*/
|
|
9
|
-
export declare function watchEmailAndSyncToIwiki(): Promise<import("@plugin-light/shared").EmailWatcher | undefined>;
|
|
49
|
+
export declare function watchEmailAndSyncToIwiki(options?: WatchEmailAndSyncToIwikiOptions): Promise<import("@plugin-light/shared").EmailWatcher | undefined>;
|
|
50
|
+
export {};
|
package/lib/utils/init.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ interface CoreModuleData {
|
|
|
46
46
|
operation: OperationTool;
|
|
47
47
|
mcpValidate: (req: Request, res: Response) => Promise<boolean>;
|
|
48
48
|
mcpDB?: {
|
|
49
|
-
add: (
|
|
49
|
+
add: (mcpName: string, staffName: string, content: string, version?: string, toolName?: string) => Promise<void>;
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
interface CoreModule {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-admin-svr",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Next Admin 服务端",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue3",
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
"lib"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
+
"@plugin-light/shared": "latest",
|
|
30
|
+
"@tdesign/uniapp": "^0.7.3",
|
|
31
|
+
"@tdesign/uniapp-chat": "^0.2.1",
|
|
29
32
|
"@tencent-ai/agent-sdk": "latest",
|
|
30
33
|
"@types/express": "^5.0.6",
|
|
31
34
|
"@wecom/crypto": "latest",
|
|
@@ -36,8 +39,7 @@
|
|
|
36
39
|
"multer": "^2.0.2",
|
|
37
40
|
"t-comm": "latest",
|
|
38
41
|
"tinify": "^1.8.2",
|
|
39
|
-
"tslib": "^2.8.1"
|
|
40
|
-
"@plugin-light/shared": "^1.0.14"
|
|
42
|
+
"tslib": "^2.8.1"
|
|
41
43
|
},
|
|
42
44
|
"devDependencies": {
|
|
43
45
|
"axios": "latest"
|