@iflyrpa/actions 4.0.8 → 4.0.9-beta.0
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/actions/searchPublishInfo/index.d.ts +1 -1
- package/dist/bundle.js +190 -18
- package/dist/bundle.js.map +1 -1
- package/dist/index.js +190 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +189 -17
- package/dist/index.mjs.map +1 -1
- package/dist/utils/feishuAlarm.d.ts +27 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6dfca0ec-85b9-54b0-98f9-63d1c042b4a6")}catch(e){}}();
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
4
|
"./src/utils/XhsXsCommonEnc.js": function(module) {
|
|
5
5
|
var encrypt_lookup = [
|
|
@@ -4402,9 +4402,7 @@ var __webpack_exports__ = {};
|
|
|
4402
4402
|
});
|
|
4403
4403
|
const package_json_namespaceObject = require("@iflyrpa/share/package.json");
|
|
4404
4404
|
var package_json_default = /*#__PURE__*/ __webpack_require__.n(package_json_namespaceObject);
|
|
4405
|
-
var package_namespaceObject = {
|
|
4406
|
-
i8: "4.0.8"
|
|
4407
|
-
};
|
|
4405
|
+
var package_namespaceObject = JSON.parse('{"i8":"4.0.9-beta.0"}');
|
|
4408
4406
|
const share_namespaceObject = require("@iflyrpa/share");
|
|
4409
4407
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
4410
4408
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
@@ -4420,6 +4418,94 @@ var __webpack_exports__ = {};
|
|
|
4420
4418
|
var external_node_crypto_default = /*#__PURE__*/ __webpack_require__.n(external_node_crypto_namespaceObject);
|
|
4421
4419
|
const external_axios_namespaceObject = require("axios");
|
|
4422
4420
|
var external_axios_default = /*#__PURE__*/ __webpack_require__.n(external_axios_namespaceObject);
|
|
4421
|
+
const RPA_ERROR_WEBHOOK_URL = "https://open.xfchat.iflytek.com/open-apis/bot/v2/hook/d202c0dc-5af5-40bc-83ed-abc677caa4a5";
|
|
4422
|
+
const ALARM_THROTTLE_MS = 60000;
|
|
4423
|
+
const lastSentAt = new Map();
|
|
4424
|
+
const postFeishuWebhook = (webhookUrl, payload)=>external_axios_default().post(webhookUrl, payload, {
|
|
4425
|
+
headers: {
|
|
4426
|
+
"Content-Type": "application/json"
|
|
4427
|
+
},
|
|
4428
|
+
timeout: 10000
|
|
4429
|
+
});
|
|
4430
|
+
const buildFeishuPostMessage = (report)=>{
|
|
4431
|
+
const content = [
|
|
4432
|
+
[
|
|
4433
|
+
{
|
|
4434
|
+
tag: "text",
|
|
4435
|
+
text: `平台:${report.platform || "未知平台"}`
|
|
4436
|
+
}
|
|
4437
|
+
],
|
|
4438
|
+
[
|
|
4439
|
+
{
|
|
4440
|
+
tag: "text",
|
|
4441
|
+
text: `错误信息:${report.msg || "未知错误信息"}`
|
|
4442
|
+
}
|
|
4443
|
+
],
|
|
4444
|
+
[
|
|
4445
|
+
{
|
|
4446
|
+
tag: "text",
|
|
4447
|
+
text: `错误类型:${report.errorType || "未知错误类型"}`
|
|
4448
|
+
}
|
|
4449
|
+
],
|
|
4450
|
+
[
|
|
4451
|
+
{
|
|
4452
|
+
tag: "text",
|
|
4453
|
+
text: `阶段:${report.stage || "未知阶段"}`
|
|
4454
|
+
}
|
|
4455
|
+
],
|
|
4456
|
+
[
|
|
4457
|
+
{
|
|
4458
|
+
tag: "text",
|
|
4459
|
+
text: `等级:${report.level}`
|
|
4460
|
+
}
|
|
4461
|
+
],
|
|
4462
|
+
[
|
|
4463
|
+
{
|
|
4464
|
+
tag: "text",
|
|
4465
|
+
text: `来源:${report.source}`
|
|
4466
|
+
}
|
|
4467
|
+
]
|
|
4468
|
+
];
|
|
4469
|
+
if (void 0 !== report.code && null !== report.code) content.push([
|
|
4470
|
+
{
|
|
4471
|
+
tag: "text",
|
|
4472
|
+
text: `接口错误码:${report.code}`
|
|
4473
|
+
}
|
|
4474
|
+
]);
|
|
4475
|
+
if (report.url) content.push([
|
|
4476
|
+
{
|
|
4477
|
+
tag: "text",
|
|
4478
|
+
text: `地址:${report.url}`
|
|
4479
|
+
}
|
|
4480
|
+
]);
|
|
4481
|
+
if ("alarm" === report.level) content.push([
|
|
4482
|
+
{
|
|
4483
|
+
tag: "at",
|
|
4484
|
+
user_id: "all"
|
|
4485
|
+
}
|
|
4486
|
+
]);
|
|
4487
|
+
return {
|
|
4488
|
+
msg_type: "post",
|
|
4489
|
+
content: {
|
|
4490
|
+
post: {
|
|
4491
|
+
zh_cn: {
|
|
4492
|
+
title: report.title || "RPA异常",
|
|
4493
|
+
content
|
|
4494
|
+
}
|
|
4495
|
+
}
|
|
4496
|
+
}
|
|
4497
|
+
};
|
|
4498
|
+
};
|
|
4499
|
+
const reportFeishuAlarm = (report)=>{
|
|
4500
|
+
try {
|
|
4501
|
+
const key = `${report.platform}|${report.source}|${report.errorType}|${report.code ?? ""}`;
|
|
4502
|
+
const now = Date.now();
|
|
4503
|
+
const last = lastSentAt.get(key);
|
|
4504
|
+
if (last && now - last < ALARM_THROTTLE_MS) return;
|
|
4505
|
+
lastSentAt.set(key, now);
|
|
4506
|
+
postFeishuWebhook(RPA_ERROR_WEBHOOK_URL, buildFeishuPostMessage(report)).catch(()=>{});
|
|
4507
|
+
} catch {}
|
|
4508
|
+
};
|
|
4423
4509
|
const external_socks_proxy_agent_namespaceObject = require("socks-proxy-agent");
|
|
4424
4510
|
const PROXY_CREDENTIALS = [
|
|
4425
4511
|
{
|
|
@@ -4522,6 +4608,17 @@ var __webpack_exports__ = {};
|
|
|
4522
4608
|
url: "https://fetdev.iflysec.com/ip-pool/pool/eip/proxy",
|
|
4523
4609
|
data: params
|
|
4524
4610
|
}).catch((err)=>{
|
|
4611
|
+
reportFeishuAlarm({
|
|
4612
|
+
level: "alarm",
|
|
4613
|
+
platform: "ip-pool",
|
|
4614
|
+
source: "proxy",
|
|
4615
|
+
stage: "POST /ip-pool/pool/eip/proxy",
|
|
4616
|
+
errorType: "PROXY_REQUEST_FAILED",
|
|
4617
|
+
code: err?.code,
|
|
4618
|
+
msg: `请求代理失败:${err.message},区域:${addr ?? "-"},AccountId:${accountId ?? "-"}`,
|
|
4619
|
+
url: "https://fetdev.iflysec.com/ip-pool/pool/eip/proxy",
|
|
4620
|
+
title: "代理异常"
|
|
4621
|
+
});
|
|
4525
4622
|
throw {
|
|
4526
4623
|
code: 414,
|
|
4527
4624
|
message: `请求代理失败:${err.message}`,
|
|
@@ -4544,6 +4641,47 @@ var __webpack_exports__ = {};
|
|
|
4544
4641
|
} : null;
|
|
4545
4642
|
return proxyAgent;
|
|
4546
4643
|
}
|
|
4644
|
+
const ALARM_STATUS = new Set([
|
|
4645
|
+
401,
|
|
4646
|
+
403,
|
|
4647
|
+
429,
|
|
4648
|
+
461,
|
|
4649
|
+
471
|
|
4650
|
+
]);
|
|
4651
|
+
const HTTP_STATUS_MESSAGE = {
|
|
4652
|
+
400: "请求参数错误,请检查参数格式是否正确!",
|
|
4653
|
+
401: "登录状态已失效,请重新登录后重试!",
|
|
4654
|
+
403: "没有访问权限,账号可能受限或签名已失效!",
|
|
4655
|
+
404: "请求的资源不存在,请检查接口地址!",
|
|
4656
|
+
405: "请求方法不被允许,请检查接口调用方式!",
|
|
4657
|
+
406: "服务端无法返回可接受的内容格式!",
|
|
4658
|
+
407: "代理需要身份验证,请检查代理配置!",
|
|
4659
|
+
408: "请求超时,请检查网络连接!",
|
|
4660
|
+
409: "请求冲突,资源状态已变更,请刷新后重试!",
|
|
4661
|
+
410: "请求的资源已被移除!",
|
|
4662
|
+
412: "请求前置条件不满足,请刷新后重试!",
|
|
4663
|
+
413: "提交内容过大,请压缩或分批后重试!",
|
|
4664
|
+
414: "请求地址过长,请检查参数!",
|
|
4665
|
+
415: "不支持的内容类型,请检查请求格式!",
|
|
4666
|
+
422: "请求内容校验失败,请检查参数内容!",
|
|
4667
|
+
423: "资源已被锁定,请稍后重试!",
|
|
4668
|
+
429: "请求过于频繁,请稍后重试!",
|
|
4669
|
+
431: "请求头过大,请清理 Cookie 后重试!",
|
|
4670
|
+
451: "内容不合规或因法律原因被拒绝!",
|
|
4671
|
+
461: "账号可能受限,请在网页上完成验证后重试!",
|
|
4672
|
+
471: "账号可能受限,请在网页上完成验证后重试!",
|
|
4673
|
+
500: "服务器内部错误,请稍后重试!",
|
|
4674
|
+
501: "服务端不支持该请求,请稍后重试!",
|
|
4675
|
+
502: "网关错误,请稍后重试!",
|
|
4676
|
+
503: "服务暂时不可用,请稍后重试!",
|
|
4677
|
+
504: "网关超时,请稍后重试!",
|
|
4678
|
+
507: "服务端存储空间不足,请稍后重试!",
|
|
4679
|
+
509: "服务带宽超限,请稍后重试!",
|
|
4680
|
+
520: "服务端返回未知错误,请稍后重试!",
|
|
4681
|
+
521: "源站拒绝连接,请稍后重试!",
|
|
4682
|
+
522: "源站连接超时,请稍后重试!",
|
|
4683
|
+
524: "源站响应超时,请稍后重试!"
|
|
4684
|
+
};
|
|
4547
4685
|
class Http {
|
|
4548
4686
|
static handleApiError(error) {
|
|
4549
4687
|
if (error && "object" == typeof error && "code" in error && "message" in error) return error;
|
|
@@ -4604,6 +4742,18 @@ var __webpack_exports__ = {};
|
|
|
4604
4742
|
const verifyDecision = error.response?.headers?.["x-tt-verify-passport-decision"];
|
|
4605
4743
|
if (verifyDecision) this.logger?.warn(`[403 验证决策] x-tt-verify-passport-decision: ${verifyDecision}`);
|
|
4606
4744
|
}
|
|
4745
|
+
if (error.response?.status === 461 || error.response?.status === 471) {
|
|
4746
|
+
const h = error.response?.headers ?? {};
|
|
4747
|
+
const pick = (name)=>h[name] ?? h[name.toLowerCase()];
|
|
4748
|
+
this.logger?.warn(`[${error.response.status} 风控验证] URL: ${error.config?.url} Verifytype: ${pick("Verifytype") ?? "-"} Verifyuuid: ${pick("Verifyuuid") ?? "-"} Verifybiz: ${pick("Verifybiz") ?? "-"}`);
|
|
4749
|
+
this.logger?.warn(`[${error.response.status} 响应头] ${JSON.stringify(h)}`);
|
|
4750
|
+
errorResponse.extra = {
|
|
4751
|
+
...errorResponse.extra,
|
|
4752
|
+
verifyType: pick("Verifytype"),
|
|
4753
|
+
verifyUuid: pick("Verifyuuid"),
|
|
4754
|
+
verifyBiz: pick("Verifybiz")
|
|
4755
|
+
};
|
|
4756
|
+
}
|
|
4607
4757
|
if (error.response?.data) {
|
|
4608
4758
|
if ("object" == typeof error.response.data) {
|
|
4609
4759
|
const serverError = error.response.data;
|
|
@@ -4634,11 +4784,17 @@ var __webpack_exports__ = {};
|
|
|
4634
4784
|
_message = "DNS 查询超时,请稍后重试!";
|
|
4635
4785
|
break;
|
|
4636
4786
|
case "ERR_BAD_REQUEST":
|
|
4637
|
-
|
|
4638
|
-
|
|
4787
|
+
{
|
|
4788
|
+
const status = error.response?.status;
|
|
4789
|
+
_message = status && HTTP_STATUS_MESSAGE[status] || `请求失败,状态码${status ?? "unknown"}!`;
|
|
4790
|
+
break;
|
|
4791
|
+
}
|
|
4639
4792
|
case "ERR_BAD_RESPONSE":
|
|
4640
|
-
|
|
4641
|
-
|
|
4793
|
+
{
|
|
4794
|
+
const status = error.response?.status;
|
|
4795
|
+
_message = status && HTTP_STATUS_MESSAGE[status] || `服务器响应异常 (${status ?? "unknown"}),请稍后重试!`;
|
|
4796
|
+
break;
|
|
4797
|
+
}
|
|
4642
4798
|
case "ERR_CANCELED":
|
|
4643
4799
|
errorResponse.code = 414;
|
|
4644
4800
|
_message = "请求连接超时,请稍候重试!";
|
|
@@ -4649,11 +4805,14 @@ var __webpack_exports__ = {};
|
|
|
4649
4805
|
}
|
|
4650
4806
|
break;
|
|
4651
4807
|
default:
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4808
|
+
{
|
|
4809
|
+
this.logger?.debug(`未处理的网络错误代码: ${error.code} ${error.message}`, {
|
|
4810
|
+
errorString: stringifyError(error)
|
|
4811
|
+
});
|
|
4812
|
+
const status = error.response?.status;
|
|
4813
|
+
_message = status && HTTP_STATUS_MESSAGE[status] || `网络错误: ${error.message} ${status}`;
|
|
4814
|
+
break;
|
|
4815
|
+
}
|
|
4657
4816
|
}
|
|
4658
4817
|
}
|
|
4659
4818
|
if (error.code && !error.response?.data) errorResponse.message = _message || errorResponse.message;
|
|
@@ -4663,6 +4822,18 @@ var __webpack_exports__ = {};
|
|
|
4663
4822
|
errorResponse.message = message;
|
|
4664
4823
|
}
|
|
4665
4824
|
if (error.message.includes("Proxy connection ended")) errorResponse.message = "所在区域代理连接超时,请更换区域或稍后重试!";
|
|
4825
|
+
const status = error.response?.status;
|
|
4826
|
+
reportFeishuAlarm({
|
|
4827
|
+
level: status && ALARM_STATUS.has(status) ? "alarm" : "warning",
|
|
4828
|
+
platform: this.platform || "unknown",
|
|
4829
|
+
source: "http",
|
|
4830
|
+
stage: `${(error.config?.method || "get").toUpperCase()} ${error.config?.url || "-"}`,
|
|
4831
|
+
errorType: status ? `HTTP_${status}` : error.code || "NETWORK_ERROR",
|
|
4832
|
+
code: errorResponse.code,
|
|
4833
|
+
msg: errorResponse.message,
|
|
4834
|
+
url: error.config?.url,
|
|
4835
|
+
title: "RPA接口异常"
|
|
4836
|
+
});
|
|
4666
4837
|
throw errorResponse;
|
|
4667
4838
|
});
|
|
4668
4839
|
}
|
|
@@ -5432,7 +5603,7 @@ var __webpack_exports__ = {};
|
|
|
5432
5603
|
Number.MAX_VALUE
|
|
5433
5604
|
]
|
|
5434
5605
|
};
|
|
5435
|
-
function
|
|
5606
|
+
function util_pick(schema, mask) {
|
|
5436
5607
|
const currDef = schema._zod.def;
|
|
5437
5608
|
const def = mergeDefs(schema._zod.def, {
|
|
5438
5609
|
get shape () {
|
|
@@ -8413,7 +8584,7 @@ var __webpack_exports__ = {};
|
|
|
8413
8584
|
inst.extend = (incoming)=>extend(inst, incoming);
|
|
8414
8585
|
inst.safeExtend = (incoming)=>safeExtend(inst, incoming);
|
|
8415
8586
|
inst.merge = (other)=>merge(inst, other);
|
|
8416
|
-
inst.pick = (mask)=>
|
|
8587
|
+
inst.pick = (mask)=>util_pick(inst, mask);
|
|
8417
8588
|
inst.omit = (mask)=>omit(inst, mask);
|
|
8418
8589
|
inst.partial = (...args)=>partial(ZodOptional, inst, args[0]);
|
|
8419
8590
|
inst.required = (...args)=>required(ZodNonOptional, inst, args[0]);
|
|
@@ -23598,6 +23769,7 @@ var __webpack_exports__ = {};
|
|
|
23598
23769
|
});
|
|
23599
23770
|
return (0, share_namespaceObject.success)(data, message);
|
|
23600
23771
|
}
|
|
23772
|
+
task.logger.info(`[xiaohongshuPublish] publishData: ${JSON.stringify(publishData)} `);
|
|
23601
23773
|
let publishResult;
|
|
23602
23774
|
try {
|
|
23603
23775
|
publishResult = await proxyHttp.api({
|
|
@@ -23608,8 +23780,8 @@ var __webpack_exports__ = {};
|
|
|
23608
23780
|
defaultErrorMsg: "文章发布异常,请稍后重试。"
|
|
23609
23781
|
}, {
|
|
23610
23782
|
retries: 2,
|
|
23611
|
-
retryDelay:
|
|
23612
|
-
timeout:
|
|
23783
|
+
retryDelay: 3000,
|
|
23784
|
+
timeout: 30000
|
|
23613
23785
|
});
|
|
23614
23786
|
} catch (error) {
|
|
23615
23787
|
const handledError = Http.handleApiError(error);
|
|
@@ -25603,4 +25775,4 @@ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_targe
|
|
|
25603
25775
|
});
|
|
25604
25776
|
|
|
25605
25777
|
//# sourceMappingURL=index.js.map
|
|
25606
|
-
//# debugId=
|
|
25778
|
+
//# debugId=6dfca0ec-85b9-54b0-98f9-63d1c042b4a6
|