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