@iflyrpa/actions 4.0.9-beta.0 → 4.0.9-beta.2

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.js CHANGED
@@ -1,5 +1,3 @@
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]="6dfca0ec-85b9-54b0-98f9-63d1c042b4a6")}catch(e){}}();
3
1
  var __webpack_modules__ = {
4
2
  "./src/utils/XhsXsCommonEnc.js": function(module) {
5
3
  var encrypt_lookup = [
@@ -4402,7 +4400,7 @@ var __webpack_exports__ = {};
4402
4400
  });
4403
4401
  const package_json_namespaceObject = require("@iflyrpa/share/package.json");
4404
4402
  var package_json_default = /*#__PURE__*/ __webpack_require__.n(package_json_namespaceObject);
4405
- var package_namespaceObject = JSON.parse('{"i8":"4.0.9-beta.0"}');
4403
+ var package_namespaceObject = JSON.parse('{"i8":"4.0.9-beta.2"}');
4406
4404
  const share_namespaceObject = require("@iflyrpa/share");
4407
4405
  const external_node_fs_namespaceObject = require("node:fs");
4408
4406
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
@@ -4418,6 +4416,36 @@ var __webpack_exports__ = {};
4418
4416
  var external_node_crypto_default = /*#__PURE__*/ __webpack_require__.n(external_node_crypto_namespaceObject);
4419
4417
  const external_axios_namespaceObject = require("axios");
4420
4418
  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
+ }
4421
4449
  const RPA_ERROR_WEBHOOK_URL = "https://open.xfchat.iflytek.com/open-apis/bot/v2/hook/d202c0dc-5af5-40bc-83ed-abc677caa4a5";
4422
4450
  const ALARM_THROTTLE_MS = 60000;
4423
4451
  const lastSentAt = new Map();
@@ -4621,7 +4649,7 @@ var __webpack_exports__ = {};
4621
4649
  });
4622
4650
  throw {
4623
4651
  code: 414,
4624
- message: `请求代理失败:${err.message}`,
4652
+ message: USER_MESSAGE.PROXY_UNAVAILABLE,
4625
4653
  data: {}
4626
4654
  };
4627
4655
  });
@@ -4687,7 +4715,7 @@ var __webpack_exports__ = {};
4687
4715
  if (error && "object" == typeof error && "code" in error && "message" in error) return error;
4688
4716
  return {
4689
4717
  code: 500,
4690
- message: error instanceof Error ? error.message : "未知错误",
4718
+ message: USER_MESSAGE.SYSTEM_ERROR,
4691
4719
  data: error
4692
4720
  };
4693
4721
  }
@@ -4810,7 +4838,7 @@ var __webpack_exports__ = {};
4810
4838
  errorString: stringifyError(error)
4811
4839
  });
4812
4840
  const status = error.response?.status;
4813
- _message = status && HTTP_STATUS_MESSAGE[status] || `网络错误: ${error.message} ${status}`;
4841
+ _message = status && HTTP_STATUS_MESSAGE[status] || USER_MESSAGE.NETWORK_ERROR;
4814
4842
  break;
4815
4843
  }
4816
4844
  }
@@ -12578,7 +12606,7 @@ var __webpack_exports__ = {};
12578
12606
  });
12579
12607
  const qrData = qrCodeResponse?.data;
12580
12608
  task.logger.info(`获取二维码响应: error_code=${qrData?.error_code}, message=${qrCodeResponse?.message}`);
12581
- if (qrData?.error_code !== 0) return (0, share_namespaceObject.response)(414, `获取二维码失败: error_code=${qrData?.error_code}`, "");
12609
+ if (qrData?.error_code !== 0) return (0, share_namespaceObject.response)(414, USER_MESSAGE.QRCODE_FETCH_FAILED, "");
12582
12610
  return (0, share_namespaceObject.response)(0, "获取二维码成功", {
12583
12611
  qrcode: qrData.qrcode,
12584
12612
  token: qrData.token,
@@ -12593,7 +12621,7 @@ var __webpack_exports__ = {};
12593
12621
  } catch (err) {
12594
12622
  const msg = err instanceof Error ? err.message : String(err);
12595
12623
  task.logger.warn(`[douyinGetVerifyQrCode] 获取二维码失败: ${msg}`);
12596
- return (0, share_namespaceObject.response)(500, `获取二维码失败: ${msg}`, "");
12624
+ return (0, share_namespaceObject.response)(500, USER_MESSAGE.QRCODE_FETCH_FAILED, "");
12597
12625
  }
12598
12626
  };
12599
12627
  const DouyinGetWorkListParamsSchema = ActionCommonParamsSchema.extend({
@@ -13912,18 +13940,10 @@ var __webpack_exports__ = {};
13912
13940
  });
13913
13941
  } catch (error) {
13914
13942
  const handledError = Http.handleApiError(error);
13915
- const isProxyOrNetworkError = [
13916
- 599,
13917
- 500,
13918
- 502,
13919
- 503,
13920
- 504
13921
- ].includes(handledError.code);
13922
- if (isProxyOrNetworkError) {
13923
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
13924
- const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
13925
- const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
13926
- task.logger.error(`[douyinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
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));
13927
13947
  await updateTaskState?.({
13928
13948
  state: share_namespaceObject.TaskState.FAILED,
13929
13949
  error: message
@@ -15641,7 +15661,7 @@ var __webpack_exports__ = {};
15641
15661
  }
15642
15662
  const errMsg = error instanceof Error ? error.message : String(error);
15643
15663
  _task.logger.error(`抖音账号数据获取失败: ${errMsg}`);
15644
- return types_errorResponse(errMsg || "抖音账号数据获取失败");
15664
+ return types_errorResponse(USER_MESSAGE.DOUYIN_ACCOUNT_FETCH_FAILED);
15645
15665
  }
15646
15666
  }
15647
15667
  async function getShipinhaoData(_task, params) {
@@ -15772,7 +15792,7 @@ var __webpack_exports__ = {};
15772
15792
  }
15773
15793
  const errMsg = error instanceof Error ? error.message : String(error);
15774
15794
  _task.logger.error(`视频号账号数据获取失败: ${errMsg}`);
15775
- return types_errorResponse(errMsg || "视频号账号数据获取失败");
15795
+ return types_errorResponse(USER_MESSAGE.SHIPINHAO_ACCOUNT_FETCH_FAILED);
15776
15796
  }
15777
15797
  }
15778
15798
  async function getToutiaoData(_task, params) {
@@ -16213,7 +16233,9 @@ var __webpack_exports__ = {};
16213
16233
  } : null
16214
16234
  }, "百家号文章数据获取成功");
16215
16235
  } catch (error) {
16216
- return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "百家号文章数据获取失败");
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);
16217
16239
  }
16218
16240
  }
16219
16241
  async function handleDouyinData(_task, params) {
@@ -16308,7 +16330,9 @@ var __webpack_exports__ = {};
16308
16330
  } : null
16309
16331
  }, "抖音数据获取成功");
16310
16332
  } catch (error) {
16311
- return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "抖音数据获取失败");
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);
16312
16336
  }
16313
16337
  }
16314
16338
  async function handleShipinhaoData(_task, params) {
@@ -16473,8 +16497,9 @@ var __webpack_exports__ = {};
16473
16497
  }, "视频号数据获取成功");
16474
16498
  } catch (error) {
16475
16499
  const errMsg = error instanceof Error ? error.message : String(error);
16500
+ _task.logger.error(`视频号作品数据获取失败: ${errMsg}`);
16476
16501
  if (errMsg.startsWith("AUTH_ERROR:")) return searchPublishInfo_types_errorResponse("视频号数据获取失败,请检查账号状态", 414);
16477
- return searchPublishInfo_types_errorResponse(errMsg || "视频号数据获取失败");
16502
+ return searchPublishInfo_types_errorResponse(USER_MESSAGE.SHIPINHAO_POST_FETCH_FAILED);
16478
16503
  }
16479
16504
  }
16480
16505
  async function handleToutiaoData(_task, params) {
@@ -16559,7 +16584,9 @@ var __webpack_exports__ = {};
16559
16584
  } : null
16560
16585
  }, "头条号文章文章获取成功");
16561
16586
  } catch (error) {
16562
- return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "头条号文章数据获取失败");
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);
16563
16590
  }
16564
16591
  }
16565
16592
  const external_node_vm_namespaceObject = require("node:vm");
@@ -18936,18 +18963,10 @@ var __webpack_exports__ = {};
18936
18963
  });
18937
18964
  } catch (error) {
18938
18965
  const handledError = Http.handleApiError(error);
18939
- const isProxyOrNetworkError = [
18940
- 599,
18941
- 500,
18942
- 502,
18943
- 503,
18944
- 504
18945
- ].includes(handledError.code);
18946
- if (isProxyOrNetworkError) {
18947
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
18948
- const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
18949
- const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
18950
- task.logger.error(`[shipinhaoPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
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));
18951
18970
  await updateTaskState?.({
18952
18971
  state: share_namespaceObject.TaskState.FAILED,
18953
18972
  error: message
@@ -19779,7 +19798,8 @@ var __webpack_exports__ = {};
19779
19798
  imageBuffer = Buffer.from(await external_node_fs_default().promises.readFile(filePath));
19780
19799
  }
19781
19800
  } catch (err) {
19782
- return (0, share_namespaceObject.response)(414, `读取图片失败: ${err instanceof Error ? err.message : String(err)}`, void 0);
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);
19783
19803
  }
19784
19804
  const md5 = (0, external_node_crypto_namespaceObject.createHash)("md5").update(imageBuffer).digest("hex");
19785
19805
  const timestamp = Date.now().toString();
@@ -22290,18 +22310,10 @@ var __webpack_exports__ = {};
22290
22310
  });
22291
22311
  } catch (error) {
22292
22312
  const handledError = Http.handleApiError(error);
22293
- const isProxyOrNetworkError = [
22294
- 599,
22295
- 500,
22296
- 502,
22297
- 503,
22298
- 504
22299
- ].includes(handledError.code);
22300
- if (isProxyOrNetworkError) {
22301
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
22302
- const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
22303
- const message = `文章发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
22304
- task.logger.error(`[weixinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
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));
22305
22317
  await updateTaskState?.({
22306
22318
  state: share_namespaceObject.TaskState.FAILED,
22307
22319
  error: message
@@ -23785,18 +23797,10 @@ var __webpack_exports__ = {};
23785
23797
  });
23786
23798
  } catch (error) {
23787
23799
  const handledError = Http.handleApiError(error);
23788
- const isProxyOrNetworkError = [
23789
- 599,
23790
- 500,
23791
- 502,
23792
- 503,
23793
- 504
23794
- ].includes(handledError.code);
23795
- if (isProxyOrNetworkError) {
23796
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
23797
- const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
23798
- const message = `文章发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
23799
- task.logger.error(`[xiaohongshuPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
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));
23800
23804
  await updateTaskState?.({
23801
23805
  state: share_namespaceObject.TaskState.FAILED,
23802
23806
  error: message
@@ -25774,5 +25778,4 @@ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_targe
25774
25778
  value: true
25775
25779
  });
25776
25780
 
25777
- //# sourceMappingURL=index.js.map
25778
- //# debugId=6dfca0ec-85b9-54b0-98f9-63d1c042b4a6
25781
+ //# sourceMappingURL=index.js.map