@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/bundle.js CHANGED
@@ -1,6 +1,4 @@
1
1
  /*! For license information please see bundle.js.LICENSE.txt */
2
-
3
- !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]="c3fbb52e-5d33-5353-8489-fe175df23e81")}catch(e){}}();
4
2
  var __webpack_modules__ = {
5
3
  "../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js": function(__unused_webpack_module, exports1, __webpack_require__) {
6
4
  "use strict";
@@ -12492,7 +12490,7 @@ var __webpack_exports__ = {};
12492
12490
  var package_namespaceObject = {
12493
12491
  i8: "0.1.2"
12494
12492
  };
12495
- var package_namespaceObject_0 = JSON.parse('{"i8":"4.0.9-beta.0"}');
12493
+ var package_namespaceObject_0 = JSON.parse('{"i8":"4.0.9-beta.2"}');
12496
12494
  const external_node_fs_namespaceObject = require("node:fs");
12497
12495
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
12498
12496
  const external_node_http_namespaceObject = require("node:http");
@@ -27039,6 +27037,36 @@ var __webpack_exports__ = {};
27039
27037
  axios.HttpStatusCode = helpers_HttpStatusCode;
27040
27038
  axios.default = axios;
27041
27039
  const lib_axios = axios;
27040
+ const USER_MESSAGE = {
27041
+ PROXY_UNAVAILABLE: "代理暂时不可用,请稍后重试或使用本地IP",
27042
+ NETWORK_ERROR: "网络异常,请稍后重试",
27043
+ SYSTEM_ERROR: "系统异常,请稍后重试或联系客服",
27044
+ PUBLISH_NETWORK: "发布失败,网络不稳定,请稍后重试",
27045
+ DOUYIN_ACCOUNT_FETCH_FAILED: "抖音数据获取失败,请稍后重试",
27046
+ SHIPINHAO_ACCOUNT_FETCH_FAILED: "视频号数据获取失败,请稍后重试",
27047
+ DOUYIN_POST_FETCH_FAILED: "抖音作品数据获取失败,请稍后重试",
27048
+ SHIPINHAO_POST_FETCH_FAILED: "视频号作品数据获取失败,请稍后重试",
27049
+ BJH_POST_FETCH_FAILED: "百家号作品数据获取失败,请稍后重试",
27050
+ TT_POST_FETCH_FAILED: "头条号作品数据获取失败,请稍后重试",
27051
+ QRCODE_FETCH_FAILED: "认证二维码获取失败,请稍后重试",
27052
+ IMAGE_UPLOAD_FAILED: "图片上传失败,请稍后重试或联系客服"
27053
+ };
27054
+ const NETWORK_CODES = [
27055
+ 500,
27056
+ 502,
27057
+ 503,
27058
+ 504
27059
+ ];
27060
+ function classifyPublishError(handledError) {
27061
+ const { code } = handledError;
27062
+ const isProxyRequest = handledError.extra?.isProxyRequest === true;
27063
+ if (!NETWORK_CODES.includes(code) && 599 !== code) return null;
27064
+ const category = 599 === code || isProxyRequest ? "代理错误" : "网络错误";
27065
+ return {
27066
+ category,
27067
+ userMessage: USER_MESSAGE.PUBLISH_NETWORK
27068
+ };
27069
+ }
27042
27070
  const RPA_ERROR_WEBHOOK_URL = "https://open.xfchat.iflytek.com/open-apis/bot/v2/hook/d202c0dc-5af5-40bc-83ed-abc677caa4a5";
27043
27071
  const ALARM_THROTTLE_MS = 60000;
27044
27072
  const lastSentAt = new Map();
@@ -27242,7 +27270,7 @@ var __webpack_exports__ = {};
27242
27270
  });
27243
27271
  throw {
27244
27272
  code: 414,
27245
- message: `请求代理失败:${err.message}`,
27273
+ message: USER_MESSAGE.PROXY_UNAVAILABLE,
27246
27274
  data: {}
27247
27275
  };
27248
27276
  });
@@ -27308,7 +27336,7 @@ var __webpack_exports__ = {};
27308
27336
  if (error && "object" == typeof error && "code" in error && "message" in error) return error;
27309
27337
  return {
27310
27338
  code: 500,
27311
- message: error instanceof Error ? error.message : "未知错误",
27339
+ message: USER_MESSAGE.SYSTEM_ERROR,
27312
27340
  data: error
27313
27341
  };
27314
27342
  }
@@ -27431,7 +27459,7 @@ var __webpack_exports__ = {};
27431
27459
  errorString: stringifyError(error)
27432
27460
  });
27433
27461
  const status = error.response?.status;
27434
- _message = status && HTTP_STATUS_MESSAGE[status] || `网络错误: ${error.message} ${status}`;
27462
+ _message = status && HTTP_STATUS_MESSAGE[status] || USER_MESSAGE.NETWORK_ERROR;
27435
27463
  break;
27436
27464
  }
27437
27465
  }
@@ -36714,7 +36742,7 @@ var __webpack_exports__ = {};
36714
36742
  });
36715
36743
  const qrData = qrCodeResponse?.data;
36716
36744
  task.logger.info(`获取二维码响应: error_code=${qrData?.error_code}, message=${qrCodeResponse?.message}`);
36717
- if (qrData?.error_code !== 0) return utils_response(414, `获取二维码失败: error_code=${qrData?.error_code}`, "");
36745
+ if (qrData?.error_code !== 0) return utils_response(414, USER_MESSAGE.QRCODE_FETCH_FAILED, "");
36718
36746
  return utils_response(0, "获取二维码成功", {
36719
36747
  qrcode: qrData.qrcode,
36720
36748
  token: qrData.token,
@@ -36729,7 +36757,7 @@ var __webpack_exports__ = {};
36729
36757
  } catch (err) {
36730
36758
  const msg = err instanceof Error ? err.message : String(err);
36731
36759
  task.logger.warn(`[douyinGetVerifyQrCode] 获取二维码失败: ${msg}`);
36732
- return utils_response(500, `获取二维码失败: ${msg}`, "");
36760
+ return utils_response(500, USER_MESSAGE.QRCODE_FETCH_FAILED, "");
36733
36761
  }
36734
36762
  };
36735
36763
  const DouyinGetWorkListParamsSchema = ActionCommonParamsSchema.extend({
@@ -38983,18 +39011,10 @@ var __webpack_exports__ = {};
38983
39011
  });
38984
39012
  } catch (error) {
38985
39013
  const handledError = Http.handleApiError(error);
38986
- const isProxyOrNetworkError = [
38987
- 599,
38988
- 500,
38989
- 502,
38990
- 503,
38991
- 504
38992
- ].includes(handledError.code);
38993
- if (isProxyOrNetworkError) {
38994
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
38995
- const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
38996
- const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
38997
- task.logger.error(`[douyinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
39014
+ const classified = classifyPublishError(handledError);
39015
+ if (classified) {
39016
+ const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
39017
+ task.logger.error(`[douyinPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
38998
39018
  await updateTaskState?.({
38999
39019
  state: types_TaskState.FAILED,
39000
39020
  error: message
@@ -40712,7 +40732,7 @@ var __webpack_exports__ = {};
40712
40732
  }
40713
40733
  const errMsg = error instanceof Error ? error.message : String(error);
40714
40734
  _task.logger.error(`抖音账号数据获取失败: ${errMsg}`);
40715
- return types_errorResponse(errMsg || "抖音账号数据获取失败");
40735
+ return types_errorResponse(USER_MESSAGE.DOUYIN_ACCOUNT_FETCH_FAILED);
40716
40736
  }
40717
40737
  }
40718
40738
  async function getShipinhaoData(_task, params) {
@@ -40843,7 +40863,7 @@ var __webpack_exports__ = {};
40843
40863
  }
40844
40864
  const errMsg = error instanceof Error ? error.message : String(error);
40845
40865
  _task.logger.error(`视频号账号数据获取失败: ${errMsg}`);
40846
- return types_errorResponse(errMsg || "视频号账号数据获取失败");
40866
+ return types_errorResponse(USER_MESSAGE.SHIPINHAO_ACCOUNT_FETCH_FAILED);
40847
40867
  }
40848
40868
  }
40849
40869
  async function getToutiaoData(_task, params) {
@@ -41284,7 +41304,9 @@ var __webpack_exports__ = {};
41284
41304
  } : null
41285
41305
  }, "百家号文章数据获取成功");
41286
41306
  } catch (error) {
41287
- return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "百家号文章数据获取失败");
41307
+ const errMsg = error instanceof Error ? error.message : String(error);
41308
+ _task.logger.error(`百家号文章数据获取失败: ${errMsg}`);
41309
+ return searchPublishInfo_types_errorResponse(USER_MESSAGE.BJH_POST_FETCH_FAILED);
41288
41310
  }
41289
41311
  }
41290
41312
  async function handleDouyinData(_task, params) {
@@ -41379,7 +41401,9 @@ var __webpack_exports__ = {};
41379
41401
  } : null
41380
41402
  }, "抖音数据获取成功");
41381
41403
  } catch (error) {
41382
- return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "抖音数据获取失败");
41404
+ const errMsg = error instanceof Error ? error.message : String(error);
41405
+ _task.logger.error(`抖音作品数据获取失败: ${errMsg}`);
41406
+ return searchPublishInfo_types_errorResponse(USER_MESSAGE.DOUYIN_POST_FETCH_FAILED);
41383
41407
  }
41384
41408
  }
41385
41409
  async function handleShipinhaoData(_task, params) {
@@ -41544,8 +41568,9 @@ var __webpack_exports__ = {};
41544
41568
  }, "视频号数据获取成功");
41545
41569
  } catch (error) {
41546
41570
  const errMsg = error instanceof Error ? error.message : String(error);
41571
+ _task.logger.error(`视频号作品数据获取失败: ${errMsg}`);
41547
41572
  if (errMsg.startsWith("AUTH_ERROR:")) return searchPublishInfo_types_errorResponse("视频号数据获取失败,请检查账号状态", 414);
41548
- return searchPublishInfo_types_errorResponse(errMsg || "视频号数据获取失败");
41573
+ return searchPublishInfo_types_errorResponse(USER_MESSAGE.SHIPINHAO_POST_FETCH_FAILED);
41549
41574
  }
41550
41575
  }
41551
41576
  async function handleToutiaoData(_task, params) {
@@ -41630,7 +41655,9 @@ var __webpack_exports__ = {};
41630
41655
  } : null
41631
41656
  }, "头条号文章文章获取成功");
41632
41657
  } catch (error) {
41633
- return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "头条号文章数据获取失败");
41658
+ const errMsg = error instanceof Error ? error.message : String(error);
41659
+ _task.logger.error(`头条号文章数据获取失败: ${errMsg}`);
41660
+ return searchPublishInfo_types_errorResponse(USER_MESSAGE.TT_POST_FETCH_FAILED);
41634
41661
  }
41635
41662
  }
41636
41663
  const external_node_vm_namespaceObject = require("node:vm");
@@ -44007,18 +44034,10 @@ var __webpack_exports__ = {};
44007
44034
  });
44008
44035
  } catch (error) {
44009
44036
  const handledError = Http.handleApiError(error);
44010
- const isProxyOrNetworkError = [
44011
- 599,
44012
- 500,
44013
- 502,
44014
- 503,
44015
- 504
44016
- ].includes(handledError.code);
44017
- if (isProxyOrNetworkError) {
44018
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
44019
- const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
44020
- const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
44021
- task.logger.error(`[shipinhaoPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
44037
+ const classified = classifyPublishError(handledError);
44038
+ if (classified) {
44039
+ const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
44040
+ task.logger.error(`[shipinhaoPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
44022
44041
  await updateTaskState?.({
44023
44042
  state: types_TaskState.FAILED,
44024
44043
  error: message
@@ -44850,7 +44869,8 @@ var __webpack_exports__ = {};
44850
44869
  imageBuffer = Buffer.from(await external_node_fs_default().promises.readFile(filePath));
44851
44870
  }
44852
44871
  } catch (err) {
44853
- return utils_response(414, `读取图片失败: ${err instanceof Error ? err.message : String(err)}`, void 0);
44872
+ _task.logger.error(`读取图片失败: ${err instanceof Error ? err.message : String(err)}`);
44873
+ return utils_response(414, USER_MESSAGE.IMAGE_UPLOAD_FAILED, void 0);
44854
44874
  }
44855
44875
  const md5 = (0, external_node_crypto_namespaceObject.createHash)("md5").update(imageBuffer).digest("hex");
44856
44876
  const timestamp = Date.now().toString();
@@ -47361,18 +47381,10 @@ var __webpack_exports__ = {};
47361
47381
  });
47362
47382
  } catch (error) {
47363
47383
  const handledError = Http.handleApiError(error);
47364
- const isProxyOrNetworkError = [
47365
- 599,
47366
- 500,
47367
- 502,
47368
- 503,
47369
- 504
47370
- ].includes(handledError.code);
47371
- if (isProxyOrNetworkError) {
47372
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
47373
- const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
47374
- const message = `文章发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
47375
- task.logger.error(`[weixinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
47384
+ const classified = classifyPublishError(handledError);
47385
+ if (classified) {
47386
+ const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
47387
+ task.logger.error(`[weixinPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
47376
47388
  await updateTaskState?.({
47377
47389
  state: types_TaskState.FAILED,
47378
47390
  error: message
@@ -48856,18 +48868,10 @@ var __webpack_exports__ = {};
48856
48868
  });
48857
48869
  } catch (error) {
48858
48870
  const handledError = Http.handleApiError(error);
48859
- const isProxyOrNetworkError = [
48860
- 599,
48861
- 500,
48862
- 502,
48863
- 503,
48864
- 504
48865
- ].includes(handledError.code);
48866
- if (isProxyOrNetworkError) {
48867
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
48868
- const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
48869
- const message = `文章发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
48870
- task.logger.error(`[xiaohongshuPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
48871
+ const classified = classifyPublishError(handledError);
48872
+ if (classified) {
48873
+ const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
48874
+ task.logger.error(`[xiaohongshuPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
48871
48875
  await updateTaskState?.({
48872
48876
  state: types_TaskState.FAILED,
48873
48877
  error: message
@@ -50845,5 +50849,4 @@ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_targe
50845
50849
  value: true
50846
50850
  });
50847
50851
 
50848
- //# sourceMappingURL=bundle.js.map
50849
- //# debugId=c3fbb52e-5d33-5353-8489-fe175df23e81
50852
+ //# sourceMappingURL=bundle.js.map