@iflyrpa/actions 4.0.9-beta.4 → 4.0.9-beta.5

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.ts CHANGED
@@ -73,20 +73,6 @@ export declare const BetaFlag = "HuiwenCanary";
73
73
  export declare class Action {
74
74
  private task;
75
75
  constructor(task: AutomateTask);
76
- /**
77
- * 【测试专用】获取当前 Action 类的版本标识
78
- *
79
- * 用于验证热更新后内存中的 Action 实例是否真的被替换了。
80
- * 每个版本的 @iflyrpa/actions 包应该返回不同的标识。
81
- *
82
- * @returns 包含版本号和时间戳的对象
83
- */
84
- getActionVersionMarker(): {
85
- version: string;
86
- shareVersion: string;
87
- marker: string;
88
- timestamp: string;
89
- };
90
76
  private bindTask;
91
77
  xiaohongshuWebSearch(params: XhsWebSearchParams): Promise<ResponseData<Record<string, unknown>>>;
92
78
  xiaohongshuWebCommentAction(params: xiaohongshuWebCommentActionParams): Promise<ResponseData<Record<string, never> | import("./actions/xiaohongshuWebCommentAction").ActionResponse>>;
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]="3b831ac8-2f97-5984-b6b4-868d0748d2c6")}catch(e){}}();
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]="585269c7-495e-5b9a-ac8b-82247b0fe2b1")}catch(e){}}();
3
3
  var __webpack_modules__ = {
4
4
  "./src/utils/XhsXsCommonEnc.js": function(module) {
5
5
  var encrypt_lookup = [
@@ -4402,7 +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 = JSON.parse('{"i8":"4.0.9-beta.4"}');
4405
+ var package_namespaceObject = JSON.parse('{"i8":"4.0.9-beta.5"}');
4406
4406
  const share_namespaceObject = require("@iflyrpa/share");
4407
4407
  const external_node_fs_namespaceObject = require("node:fs");
4408
4408
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
@@ -4418,124 +4418,6 @@ var __webpack_exports__ = {};
4418
4418
  var external_node_crypto_default = /*#__PURE__*/ __webpack_require__.n(external_node_crypto_namespaceObject);
4419
4419
  const external_axios_namespaceObject = require("axios");
4420
4420
  var external_axios_default = /*#__PURE__*/ __webpack_require__.n(external_axios_namespaceObject);
4421
- const USER_MESSAGE = {
4422
- PROXY_UNAVAILABLE: "代理暂时不可用,请稍后重试或使用本地IP",
4423
- NETWORK_ERROR: "网络异常,请稍后重试",
4424
- SYSTEM_ERROR: "系统异常,请稍后重试或联系客服",
4425
- PUBLISH_NETWORK: "发布失败,网络不稳定,请稍后重试",
4426
- DOUYIN_ACCOUNT_FETCH_FAILED: "抖音数据获取失败,请稍后重试",
4427
- SHIPINHAO_ACCOUNT_FETCH_FAILED: "视频号数据获取失败,请稍后重试",
4428
- DOUYIN_POST_FETCH_FAILED: "抖音作品数据获取失败,请稍后重试",
4429
- SHIPINHAO_POST_FETCH_FAILED: "视频号作品数据获取失败,请稍后重试",
4430
- BJH_POST_FETCH_FAILED: "百家号作品数据获取失败,请稍后重试",
4431
- TT_POST_FETCH_FAILED: "头条号作品数据获取失败,请稍后重试",
4432
- QRCODE_FETCH_FAILED: "认证二维码获取失败,请稍后重试",
4433
- IMAGE_UPLOAD_FAILED: "图片上传失败,请稍后重试或联系客服"
4434
- };
4435
- const NETWORK_CODES = [
4436
- 500,
4437
- 502,
4438
- 503,
4439
- 504
4440
- ];
4441
- function classifyPublishError(handledError) {
4442
- const { code } = handledError;
4443
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
4444
- if (!NETWORK_CODES.includes(code) && 599 !== code) return null;
4445
- const category = 599 === code || isProxyRequest ? "代理错误" : "网络错误";
4446
- return {
4447
- category,
4448
- userMessage: USER_MESSAGE.PUBLISH_NETWORK
4449
- };
4450
- }
4451
- const RPA_ERROR_WEBHOOK_URL = "https://open.xfchat.iflytek.com/open-apis/bot/v2/hook/d202c0dc-5af5-40bc-83ed-abc677caa4a5";
4452
- const ALARM_THROTTLE_MS = 60000;
4453
- const lastSentAt = new Map();
4454
- const postFeishuWebhook = (webhookUrl, payload)=>external_axios_default().post(webhookUrl, payload, {
4455
- headers: {
4456
- "Content-Type": "application/json"
4457
- },
4458
- timeout: 10000
4459
- });
4460
- const buildFeishuPostMessage = (report)=>{
4461
- const content = [
4462
- [
4463
- {
4464
- tag: "text",
4465
- text: `平台:${report.platform || "未知平台"}`
4466
- }
4467
- ],
4468
- [
4469
- {
4470
- tag: "text",
4471
- text: `错误信息:${report.msg || "未知错误信息"}`
4472
- }
4473
- ],
4474
- [
4475
- {
4476
- tag: "text",
4477
- text: `错误类型:${report.errorType || "未知错误类型"}`
4478
- }
4479
- ],
4480
- [
4481
- {
4482
- tag: "text",
4483
- text: `阶段:${report.stage || "未知阶段"}`
4484
- }
4485
- ],
4486
- [
4487
- {
4488
- tag: "text",
4489
- text: `等级:${report.level}`
4490
- }
4491
- ],
4492
- [
4493
- {
4494
- tag: "text",
4495
- text: `来源:${report.source}`
4496
- }
4497
- ]
4498
- ];
4499
- if (void 0 !== report.code && null !== report.code) content.push([
4500
- {
4501
- tag: "text",
4502
- text: `接口错误码:${report.code}`
4503
- }
4504
- ]);
4505
- if (report.url) content.push([
4506
- {
4507
- tag: "text",
4508
- text: `地址:${report.url}`
4509
- }
4510
- ]);
4511
- if ("alarm" === report.level) content.push([
4512
- {
4513
- tag: "at",
4514
- user_id: "all"
4515
- }
4516
- ]);
4517
- return {
4518
- msg_type: "post",
4519
- content: {
4520
- post: {
4521
- zh_cn: {
4522
- title: report.title || "RPA异常",
4523
- content
4524
- }
4525
- }
4526
- }
4527
- };
4528
- };
4529
- const reportFeishuAlarm = (report)=>{
4530
- try {
4531
- const key = `${report.platform}|${report.source}|${report.errorType}|${report.code ?? ""}`;
4532
- const now = Date.now();
4533
- const last = lastSentAt.get(key);
4534
- if (last && now - last < ALARM_THROTTLE_MS) return;
4535
- lastSentAt.set(key, now);
4536
- postFeishuWebhook(RPA_ERROR_WEBHOOK_URL, buildFeishuPostMessage(report)).catch(()=>{});
4537
- } catch {}
4538
- };
4539
4421
  const external_socks_proxy_agent_namespaceObject = require("socks-proxy-agent");
4540
4422
  const PROXY_CREDENTIALS = [
4541
4423
  {
@@ -4638,20 +4520,9 @@ var __webpack_exports__ = {};
4638
4520
  url: "https://fetdev.iflysec.com/ip-pool/pool/eip/proxy",
4639
4521
  data: params
4640
4522
  }).catch((err)=>{
4641
- reportFeishuAlarm({
4642
- level: "alarm",
4643
- platform: "ip-pool",
4644
- source: "proxy",
4645
- stage: "POST /ip-pool/pool/eip/proxy",
4646
- errorType: "PROXY_REQUEST_FAILED",
4647
- code: err?.code,
4648
- msg: `请求代理失败:${err.message},区域:${addr ?? "-"},AccountId:${accountId ?? "-"}`,
4649
- url: "https://fetdev.iflysec.com/ip-pool/pool/eip/proxy",
4650
- title: "代理异常"
4651
- });
4652
4523
  throw {
4653
4524
  code: 414,
4654
- message: USER_MESSAGE.PROXY_UNAVAILABLE,
4525
+ message: `请求代理失败:${err.message}`,
4655
4526
  data: {}
4656
4527
  };
4657
4528
  });
@@ -4671,53 +4542,12 @@ var __webpack_exports__ = {};
4671
4542
  } : null;
4672
4543
  return proxyAgent;
4673
4544
  }
4674
- const ALARM_STATUS = new Set([
4675
- 401,
4676
- 403,
4677
- 429,
4678
- 461,
4679
- 471
4680
- ]);
4681
- const HTTP_STATUS_MESSAGE = {
4682
- 400: "请求参数错误,请检查参数格式是否正确!",
4683
- 401: "登录状态已失效,请重新登录后重试!",
4684
- 403: "没有访问权限,账号可能受限或签名已失效!",
4685
- 404: "请求的资源不存在,请检查接口地址!",
4686
- 405: "请求方法不被允许,请检查接口调用方式!",
4687
- 406: "服务端无法返回可接受的内容格式!",
4688
- 407: "代理需要身份验证,请检查代理配置!",
4689
- 408: "请求超时,请检查网络连接!",
4690
- 409: "请求冲突,资源状态已变更,请刷新后重试!",
4691
- 410: "请求的资源已被移除!",
4692
- 412: "请求前置条件不满足,请刷新后重试!",
4693
- 413: "提交内容过大,请压缩或分批后重试!",
4694
- 414: "请求地址过长,请检查参数!",
4695
- 415: "不支持的内容类型,请检查请求格式!",
4696
- 422: "请求内容校验失败,请检查参数内容!",
4697
- 423: "资源已被锁定,请稍后重试!",
4698
- 429: "请求过于频繁,请稍后重试!",
4699
- 431: "请求头过大,请清理 Cookie 后重试!",
4700
- 451: "内容不合规或因法律原因被拒绝!",
4701
- 461: "账号可能受限,请在网页上完成验证后重试!",
4702
- 471: "账号可能受限,请在网页上完成验证后重试!",
4703
- 500: "服务器内部错误,请稍后重试!",
4704
- 501: "服务端不支持该请求,请稍后重试!",
4705
- 502: "网关错误,请稍后重试!",
4706
- 503: "服务暂时不可用,请稍后重试!",
4707
- 504: "网关超时,请稍后重试!",
4708
- 507: "服务端存储空间不足,请稍后重试!",
4709
- 509: "服务带宽超限,请稍后重试!",
4710
- 520: "服务端返回未知错误,请稍后重试!",
4711
- 521: "源站拒绝连接,请稍后重试!",
4712
- 522: "源站连接超时,请稍后重试!",
4713
- 524: "源站响应超时,请稍后重试!"
4714
- };
4715
4545
  class Http {
4716
4546
  static handleApiError(error) {
4717
4547
  if (error && "object" == typeof error && "code" in error && "message" in error) return error;
4718
4548
  return {
4719
4549
  code: 500,
4720
- message: USER_MESSAGE.SYSTEM_ERROR,
4550
+ message: error instanceof Error ? error.message : "未知错误",
4721
4551
  data: error
4722
4552
  };
4723
4553
  }
@@ -4772,18 +4602,6 @@ var __webpack_exports__ = {};
4772
4602
  const verifyDecision = error.response?.headers?.["x-tt-verify-passport-decision"];
4773
4603
  if (verifyDecision) this.logger?.warn(`[403 验证决策] x-tt-verify-passport-decision: ${verifyDecision}`);
4774
4604
  }
4775
- if (error.response?.status === 461 || error.response?.status === 471) {
4776
- const h = error.response?.headers ?? {};
4777
- const pick = (name)=>h[name] ?? h[name.toLowerCase()];
4778
- this.logger?.warn(`[${error.response.status} 风控验证] URL: ${error.config?.url} Verifytype: ${pick("Verifytype") ?? "-"} Verifyuuid: ${pick("Verifyuuid") ?? "-"} Verifybiz: ${pick("Verifybiz") ?? "-"}`);
4779
- this.logger?.warn(`[${error.response.status} 响应头] ${JSON.stringify(h)}`);
4780
- errorResponse.extra = {
4781
- ...errorResponse.extra,
4782
- verifyType: pick("Verifytype"),
4783
- verifyUuid: pick("Verifyuuid"),
4784
- verifyBiz: pick("Verifybiz")
4785
- };
4786
- }
4787
4605
  if (error.response?.data) {
4788
4606
  if ("object" == typeof error.response.data) {
4789
4607
  const serverError = error.response.data;
@@ -4814,17 +4632,11 @@ var __webpack_exports__ = {};
4814
4632
  _message = "DNS 查询超时,请稍后重试!";
4815
4633
  break;
4816
4634
  case "ERR_BAD_REQUEST":
4817
- {
4818
- const status = error.response?.status;
4819
- _message = status && HTTP_STATUS_MESSAGE[status] || `请求失败,状态码${status ?? "unknown"}!`;
4820
- break;
4821
- }
4635
+ _message = "请求出现错误,请检查请求参数!";
4636
+ break;
4822
4637
  case "ERR_BAD_RESPONSE":
4823
- {
4824
- const status = error.response?.status;
4825
- _message = status && HTTP_STATUS_MESSAGE[status] || `服务器响应异常 (${status ?? "unknown"}),请稍后重试!`;
4826
- break;
4827
- }
4638
+ _message = `服务器响应异常 (${error.response?.status ?? "unknown"}),请稍后重试!`;
4639
+ break;
4828
4640
  case "ERR_CANCELED":
4829
4641
  errorResponse.code = 414;
4830
4642
  _message = "请求连接超时,请稍候重试!";
@@ -4835,14 +4647,11 @@ var __webpack_exports__ = {};
4835
4647
  }
4836
4648
  break;
4837
4649
  default:
4838
- {
4839
- this.logger?.debug(`未处理的网络错误代码: ${error.code} ${error.message}`, {
4840
- errorString: stringifyError(error)
4841
- });
4842
- const status = error.response?.status;
4843
- _message = status && HTTP_STATUS_MESSAGE[status] || USER_MESSAGE.NETWORK_ERROR;
4844
- break;
4845
- }
4650
+ this.logger?.debug(`未处理的网络错误代码: ${error.code} ${error.message}`, {
4651
+ errorString: stringifyError(error)
4652
+ });
4653
+ _message = `网络错误: ${error.message}`;
4654
+ break;
4846
4655
  }
4847
4656
  }
4848
4657
  if (error.code && !error.response?.data) errorResponse.message = _message || errorResponse.message;
@@ -4852,18 +4661,6 @@ var __webpack_exports__ = {};
4852
4661
  errorResponse.message = message;
4853
4662
  }
4854
4663
  if (error.message.includes("Proxy connection ended")) errorResponse.message = "所在区域代理连接超时,请更换区域或稍后重试!";
4855
- const status = error.response?.status;
4856
- reportFeishuAlarm({
4857
- level: status && ALARM_STATUS.has(status) ? "alarm" : "warning",
4858
- platform: this.platform || "unknown",
4859
- source: "http",
4860
- stage: `${(error.config?.method || "get").toUpperCase()} ${error.config?.url || "-"}`,
4861
- errorType: status ? `HTTP_${status}` : error.code || "NETWORK_ERROR",
4862
- code: errorResponse.code,
4863
- msg: errorResponse.message,
4864
- url: error.config?.url,
4865
- title: "RPA接口异常"
4866
- });
4867
4664
  throw errorResponse;
4868
4665
  });
4869
4666
  }
@@ -5633,7 +5430,7 @@ var __webpack_exports__ = {};
5633
5430
  Number.MAX_VALUE
5634
5431
  ]
5635
5432
  };
5636
- function util_pick(schema, mask) {
5433
+ function pick(schema, mask) {
5637
5434
  const currDef = schema._zod.def;
5638
5435
  const def = mergeDefs(schema._zod.def, {
5639
5436
  get shape () {
@@ -8614,7 +8411,7 @@ var __webpack_exports__ = {};
8614
8411
  inst.extend = (incoming)=>extend(inst, incoming);
8615
8412
  inst.safeExtend = (incoming)=>safeExtend(inst, incoming);
8616
8413
  inst.merge = (other)=>merge(inst, other);
8617
- inst.pick = (mask)=>util_pick(inst, mask);
8414
+ inst.pick = (mask)=>pick(inst, mask);
8618
8415
  inst.omit = (mask)=>omit(inst, mask);
8619
8416
  inst.partial = (...args)=>partial(ZodOptional, inst, args[0]);
8620
8417
  inst.required = (...args)=>required(ZodNonOptional, inst, args[0]);
@@ -9321,7 +9118,7 @@ var __webpack_exports__ = {};
9321
9118
  ".png"
9322
9119
  ].includes(ext)) throw {
9323
9120
  code: 414,
9324
- message: `图片格式不支持:${fileName}。百家号仅支持 jpg、png 格式,请转换后重试。`,
9121
+ message: "图片格式不支持,百家号仅支持 jpg、png 格式,请转换后重试。",
9325
9122
  data: ""
9326
9123
  };
9327
9124
  const image = await (0, share_namespaceObject.downloadImage)(url, external_node_path_default().join(tmpCachePath, fileName));
@@ -12608,7 +12405,7 @@ var __webpack_exports__ = {};
12608
12405
  });
12609
12406
  const qrData = qrCodeResponse?.data;
12610
12407
  task.logger.info(`获取二维码响应: error_code=${qrData?.error_code}, message=${qrCodeResponse?.message}`);
12611
- if (qrData?.error_code !== 0) return (0, share_namespaceObject.response)(414, USER_MESSAGE.QRCODE_FETCH_FAILED, "");
12408
+ if (qrData?.error_code !== 0) return (0, share_namespaceObject.response)(414, `获取二维码失败: error_code=${qrData?.error_code}`, "");
12612
12409
  return (0, share_namespaceObject.response)(0, "获取二维码成功", {
12613
12410
  qrcode: qrData.qrcode,
12614
12411
  token: qrData.token,
@@ -12623,7 +12420,7 @@ var __webpack_exports__ = {};
12623
12420
  } catch (err) {
12624
12421
  const msg = err instanceof Error ? err.message : String(err);
12625
12422
  task.logger.warn(`[douyinGetVerifyQrCode] 获取二维码失败: ${msg}`);
12626
- return (0, share_namespaceObject.response)(500, USER_MESSAGE.QRCODE_FETCH_FAILED, "");
12423
+ return (0, share_namespaceObject.response)(500, `获取二维码失败: ${msg}`, "");
12627
12424
  }
12628
12425
  };
12629
12426
  const DouyinGetWorkListParamsSchema = ActionCommonParamsSchema.extend({
@@ -13942,10 +13739,18 @@ var __webpack_exports__ = {};
13942
13739
  });
13943
13740
  } catch (error) {
13944
13741
  const handledError = Http.handleApiError(error);
13945
- const classified = classifyPublishError(handledError);
13946
- if (classified) {
13947
- const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
13948
- task.logger.error(`[douyinPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
13742
+ const isProxyOrNetworkError = [
13743
+ 599,
13744
+ 500,
13745
+ 502,
13746
+ 503,
13747
+ 504
13748
+ ].includes(handledError.code);
13749
+ if (isProxyOrNetworkError) {
13750
+ const isProxyRequest = handledError.extra?.isProxyRequest === true;
13751
+ const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
13752
+ const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
13753
+ task.logger.error(`[douyinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
13949
13754
  await updateTaskState?.({
13950
13755
  state: share_namespaceObject.TaskState.FAILED,
13951
13756
  error: message
@@ -15663,7 +15468,7 @@ var __webpack_exports__ = {};
15663
15468
  }
15664
15469
  const errMsg = error instanceof Error ? error.message : String(error);
15665
15470
  _task.logger.error(`抖音账号数据获取失败: ${errMsg}`);
15666
- return types_errorResponse(USER_MESSAGE.DOUYIN_ACCOUNT_FETCH_FAILED);
15471
+ return types_errorResponse(errMsg || "抖音账号数据获取失败");
15667
15472
  }
15668
15473
  }
15669
15474
  async function getShipinhaoData(_task, params) {
@@ -15794,7 +15599,7 @@ var __webpack_exports__ = {};
15794
15599
  }
15795
15600
  const errMsg = error instanceof Error ? error.message : String(error);
15796
15601
  _task.logger.error(`视频号账号数据获取失败: ${errMsg}`);
15797
- return types_errorResponse(USER_MESSAGE.SHIPINHAO_ACCOUNT_FETCH_FAILED);
15602
+ return types_errorResponse(errMsg || "视频号账号数据获取失败");
15798
15603
  }
15799
15604
  }
15800
15605
  async function getToutiaoData(_task, params) {
@@ -16235,9 +16040,7 @@ var __webpack_exports__ = {};
16235
16040
  } : null
16236
16041
  }, "百家号文章数据获取成功");
16237
16042
  } catch (error) {
16238
- const errMsg = error instanceof Error ? error.message : String(error);
16239
- _task.logger.error(`百家号文章数据获取失败: ${errMsg}`);
16240
- return searchPublishInfo_types_errorResponse(USER_MESSAGE.BJH_POST_FETCH_FAILED);
16043
+ return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "百家号文章数据获取失败");
16241
16044
  }
16242
16045
  }
16243
16046
  async function handleDouyinData(_task, params) {
@@ -16332,9 +16135,7 @@ var __webpack_exports__ = {};
16332
16135
  } : null
16333
16136
  }, "抖音数据获取成功");
16334
16137
  } catch (error) {
16335
- const errMsg = error instanceof Error ? error.message : String(error);
16336
- _task.logger.error(`抖音作品数据获取失败: ${errMsg}`);
16337
- return searchPublishInfo_types_errorResponse(USER_MESSAGE.DOUYIN_POST_FETCH_FAILED);
16138
+ return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "抖音数据获取失败");
16338
16139
  }
16339
16140
  }
16340
16141
  async function handleShipinhaoData(_task, params) {
@@ -16499,9 +16300,8 @@ var __webpack_exports__ = {};
16499
16300
  }, "视频号数据获取成功");
16500
16301
  } catch (error) {
16501
16302
  const errMsg = error instanceof Error ? error.message : String(error);
16502
- _task.logger.error(`视频号作品数据获取失败: ${errMsg}`);
16503
16303
  if (errMsg.startsWith("AUTH_ERROR:")) return searchPublishInfo_types_errorResponse("视频号数据获取失败,请检查账号状态", 414);
16504
- return searchPublishInfo_types_errorResponse(USER_MESSAGE.SHIPINHAO_POST_FETCH_FAILED);
16304
+ return searchPublishInfo_types_errorResponse(errMsg || "视频号数据获取失败");
16505
16305
  }
16506
16306
  }
16507
16307
  async function handleToutiaoData(_task, params) {
@@ -16586,9 +16386,7 @@ var __webpack_exports__ = {};
16586
16386
  } : null
16587
16387
  }, "头条号文章文章获取成功");
16588
16388
  } catch (error) {
16589
- const errMsg = error instanceof Error ? error.message : String(error);
16590
- _task.logger.error(`头条号文章数据获取失败: ${errMsg}`);
16591
- return searchPublishInfo_types_errorResponse(USER_MESSAGE.TT_POST_FETCH_FAILED);
16389
+ return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "头条号文章数据获取失败");
16592
16390
  }
16593
16391
  }
16594
16392
  const external_node_vm_namespaceObject = require("node:vm");
@@ -18809,7 +18607,7 @@ var __webpack_exports__ = {};
18809
18607
  name: params.music.name,
18810
18608
  artist: params.music.authorName,
18811
18609
  mediaStreamingUrl: params.music.url,
18812
- docType: params.music.raw.playableInfo.type
18610
+ docType: 2 === params.music.raw.bgmSource ? 0 : 1
18813
18611
  },
18814
18612
  groupId: params.music.id,
18815
18613
  hasBgm: 1,
@@ -18965,10 +18763,18 @@ var __webpack_exports__ = {};
18965
18763
  });
18966
18764
  } catch (error) {
18967
18765
  const handledError = Http.handleApiError(error);
18968
- const classified = classifyPublishError(handledError);
18969
- if (classified) {
18970
- const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
18971
- task.logger.error(`[shipinhaoPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
18766
+ const isProxyOrNetworkError = [
18767
+ 599,
18768
+ 500,
18769
+ 502,
18770
+ 503,
18771
+ 504
18772
+ ].includes(handledError.code);
18773
+ if (isProxyOrNetworkError) {
18774
+ const isProxyRequest = handledError.extra?.isProxyRequest === true;
18775
+ const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
18776
+ const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
18777
+ task.logger.error(`[shipinhaoPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
18972
18778
  await updateTaskState?.({
18973
18779
  state: share_namespaceObject.TaskState.FAILED,
18974
18780
  error: message
@@ -19800,8 +19606,7 @@ var __webpack_exports__ = {};
19800
19606
  imageBuffer = Buffer.from(await external_node_fs_default().promises.readFile(filePath));
19801
19607
  }
19802
19608
  } catch (err) {
19803
- _task.logger.error(`读取图片失败: ${err instanceof Error ? err.message : String(err)}`);
19804
- return (0, share_namespaceObject.response)(414, USER_MESSAGE.IMAGE_UPLOAD_FAILED, void 0);
19609
+ return (0, share_namespaceObject.response)(414, `读取图片失败: ${err instanceof Error ? err.message : String(err)}`, void 0);
19805
19610
  }
19806
19611
  const md5 = (0, external_node_crypto_namespaceObject.createHash)("md5").update(imageBuffer).digest("hex");
19807
19612
  const timestamp = Date.now().toString();
@@ -22312,10 +22117,18 @@ var __webpack_exports__ = {};
22312
22117
  });
22313
22118
  } catch (error) {
22314
22119
  const handledError = Http.handleApiError(error);
22315
- const classified = classifyPublishError(handledError);
22316
- if (classified) {
22317
- const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
22318
- task.logger.error(`[weixinPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
22120
+ const isProxyOrNetworkError = [
22121
+ 599,
22122
+ 500,
22123
+ 502,
22124
+ 503,
22125
+ 504
22126
+ ].includes(handledError.code);
22127
+ if (isProxyOrNetworkError) {
22128
+ const isProxyRequest = handledError.extra?.isProxyRequest === true;
22129
+ const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
22130
+ const message = `文章发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
22131
+ task.logger.error(`[weixinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
22319
22132
  await updateTaskState?.({
22320
22133
  state: share_namespaceObject.TaskState.FAILED,
22321
22134
  error: message
@@ -23783,7 +23596,6 @@ var __webpack_exports__ = {};
23783
23596
  });
23784
23597
  return (0, share_namespaceObject.success)(data, message);
23785
23598
  }
23786
- task.logger.info(`[xiaohongshuPublish] publishData: ${JSON.stringify(publishData)} `);
23787
23599
  let publishResult;
23788
23600
  try {
23789
23601
  publishResult = await proxyHttp.api({
@@ -23794,15 +23606,23 @@ var __webpack_exports__ = {};
23794
23606
  defaultErrorMsg: "文章发布异常,请稍后重试。"
23795
23607
  }, {
23796
23608
  retries: 2,
23797
- retryDelay: 3000,
23798
- timeout: 30000
23609
+ retryDelay: 500,
23610
+ timeout: 12000
23799
23611
  });
23800
23612
  } catch (error) {
23801
23613
  const handledError = Http.handleApiError(error);
23802
- const classified = classifyPublishError(handledError);
23803
- if (classified) {
23804
- const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
23805
- task.logger.error(`[xiaohongshuPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
23614
+ const isProxyOrNetworkError = [
23615
+ 599,
23616
+ 500,
23617
+ 502,
23618
+ 503,
23619
+ 504
23620
+ ].includes(handledError.code);
23621
+ if (isProxyOrNetworkError) {
23622
+ const isProxyRequest = handledError.extra?.isProxyRequest === true;
23623
+ const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
23624
+ const message = `文章发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
23625
+ task.logger.error(`[xiaohongshuPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
23806
23626
  await updateTaskState?.({
23807
23627
  state: share_namespaceObject.TaskState.FAILED,
23808
23628
  error: message
@@ -25498,14 +25318,6 @@ var __webpack_exports__ = {};
25498
25318
  this.task = task;
25499
25319
  this.task.logger.info(`当前包版本:Share=>${package_json_default().version} Action=>${package_namespaceObject.i8}`);
25500
25320
  }
25501
- getActionVersionMarker() {
25502
- return {
25503
- version: package_namespaceObject.i8,
25504
- shareVersion: package_json_default().version,
25505
- marker: `Action_${package_namespaceObject.i8}_${package_json_default().version}`,
25506
- timestamp: new Date().toLocaleString()
25507
- };
25508
- }
25509
25321
  async bindTask(func, params) {
25510
25322
  let responseData;
25511
25323
  this.task.isBeta = this.task?.isFeatOn ? this.task?.isFeatOn(BetaFlag) : false;
@@ -25789,4 +25601,4 @@ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_targe
25789
25601
  });
25790
25602
 
25791
25603
  //# sourceMappingURL=index.js.map
25792
- //# debugId=3b831ac8-2f97-5984-b6b4-868d0748d2c6
25604
+ //# debugId=585269c7-495e-5b9a-ac8b-82247b0fe2b1