@iflyrpa/actions 1.2.19 → 1.2.20-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/bundle.js CHANGED
@@ -3673,6 +3673,7 @@ var __webpack_exports__ = {};
3673
3673
  __webpack_require__.r(__webpack_exports__);
3674
3674
  __webpack_require__.d(__webpack_exports__, {
3675
3675
  version: ()=>package_namespaceObject.i8,
3676
+ BetaFlag: ()=>BetaFlag,
3676
3677
  Action: ()=>Action
3677
3678
  });
3678
3679
  var common_utils_namespaceObject = {};
@@ -14981,7 +14982,8 @@ var __webpack_exports__ = {};
14981
14982
  20040034: "封面图片推荐jpg、png格式,不支持gif格式。",
14982
14983
  20040124: "服务器异常,请稍后重试!",
14983
14984
  20040001: "当前用户未登录,请登陆后重试!",
14984
- 401100025: "该应用不支持此媒资类型"
14985
+ 401100025: "该应用不支持此媒资类型",
14986
+ 401100033: "图片宽高不满足要求"
14985
14987
  };
14986
14988
  const mockAction = async (task, params)=>{
14987
14989
  const { baijiahaoSingleCover, baijiahaoMultCover, baijiahaoCoverType } = params.settingInfo;
@@ -15106,6 +15108,7 @@ var __webpack_exports__ = {};
15106
15108
  };
15107
15109
  const isDraft = "draft" === params.saveType;
15108
15110
  const saveUrl = isDraft ? "https://baijiahao.baidu.com/pcui/article/save?callback=bjhdraft" : "https://baijiahao.baidu.com/pcui/article/publish?callback=bjhpublish";
15111
+ task._timerRecord['PrePublish'] = Date.now();
15109
15112
  const res = await http.api({
15110
15113
  method: "post",
15111
15114
  url: saveUrl,
@@ -15243,6 +15246,7 @@ var __webpack_exports__ = {};
15243
15246
  }
15244
15247
  };
15245
15248
  page.on("response", handleResponse);
15249
+ task._timerRecord['PrePublish'] = Date.now();
15246
15250
  const operatorContainer = page.locator(".editor-component-operator");
15247
15251
  if ("draft" === params.saveType) await operatorContainer.locator(".op-btn-outter-content").filter({
15248
15252
  hasText: "存草稿"
@@ -15808,6 +15812,7 @@ var __webpack_exports__ = {};
15808
15812
  article_ad_type: getAddTypeValue(params.settingInfo.toutiaoAd),
15809
15813
  claim_exclusive: toutiaoExclusive ? toutiaoExclusive : toutiaoOriginal?.includes("exclusive") ? 1 : 0
15810
15814
  };
15815
+ task._timerRecord['PrePublish'] = Date.now();
15811
15816
  const msToken = params.cookies.find((it)=>"msToken" === it.name)?.value;
15812
15817
  let publishOption = {};
15813
15818
  if (msToken) {
@@ -16052,6 +16057,7 @@ var __webpack_exports__ = {};
16052
16057
  const confirmBtn = page.locator('div.byte-modal-footer button.byte-btn-primary:has-text("确定")');
16053
16058
  if (await confirmBtn.isVisible()) await confirmBtn.click();
16054
16059
  }
16060
+ task._timerRecord['PrePublish'] = Date.now();
16055
16061
  if ("publish" === params.saveType) {
16056
16062
  await page.locator(".publish-footer button").filter({
16057
16063
  hasText: params.settingInfo.timer ? "定时发布" : "确认发布"
@@ -17484,6 +17490,7 @@ var __webpack_exports__ = {};
17484
17490
  masssend_check: 1,
17485
17491
  is_masssend: 1
17486
17492
  };
17493
+ task._timerRecord['PrePublish'] = Date.now();
17487
17494
  const { appMsgId } = await http.api({
17488
17495
  method: "post",
17489
17496
  url: "https://mp.weixin.qq.com/cgi-bin/operate_appmsg",
@@ -18142,6 +18149,7 @@ var __webpack_exports__ = {};
18142
18149
  await poperInstance.locator('.frm_radio_item label[for="not_recomment_0"]').click();
18143
18150
  }
18144
18151
  await page.waitForTimeout(1000);
18152
+ task._timerRecord['PrePublish'] = Date.now();
18145
18153
  const articleId = await new Promise(async (resolve)=>{
18146
18154
  const handleResponse = async (response)=>{
18147
18155
  const url = response.url();
@@ -18673,6 +18681,7 @@ var __webpack_exports__ = {};
18673
18681
  };
18674
18682
  }
18675
18683
  }
18684
+ task._timerRecord['PrePublish'] = Date.now();
18676
18685
  const business_binds = {
18677
18686
  version: 1,
18678
18687
  bizType: "",
@@ -18900,6 +18909,7 @@ var __webpack_exports__ = {};
18900
18909
  hasText: "仅自己可见"
18901
18910
  }).click();
18902
18911
  }
18912
+ task._timerRecord['PrePublish'] = Date.now();
18903
18913
  const releaseTimeInstance = page.locator("label").filter({
18904
18914
  hasText: params.isImmediatelyPublish ? "立即发布" : "定时发布"
18905
18915
  });
@@ -18925,21 +18935,32 @@ var __webpack_exports__ = {};
18925
18935
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
18926
18936
  };
18927
18937
  var package_namespaceObject = {
18928
- i8: "1.2.18"
18938
+ i8: "1.2.19"
18929
18939
  };
18940
+ const BetaFlag = "HuiwenCanary";
18930
18941
  class Action {
18931
18942
  constructor(task){
18932
18943
  this.task = task;
18933
18944
  }
18934
18945
  async bindTask(func, params) {
18935
18946
  let responseData;
18947
+ this.task._timerRecord = {
18948
+ ActionStart: Date.now()
18949
+ };
18950
+ this.task.isBeta = this.task.isFeatOn(BetaFlag);
18951
+ console.log(`当前用户: ${this.task.isBeta ? "测试用户" : "非测试用户"}`);
18936
18952
  if (this.task.setArticleId) this.task.setArticleId(params.articleId ?? "");
18937
- if ("object" == typeof params && null !== params) params.cookies = params?.cookies ?? [];
18953
+ if (this.task.setSaveType) this.task.setSaveType(params.saveType ?? "");
18954
+ if (void 0 !== this.task.isInitializedGB) this.task.setGbInitType(this.task.isInitializedGB);
18955
+ if ("object" == typeof params) params.cookies = params?.cookies ?? [];
18938
18956
  try {
18939
18957
  responseData = await func(this.task, params);
18940
18958
  } catch (error) {
18941
18959
  responseData = Http.handleApiError(error);
18960
+ } finally{
18961
+ this.task._timerRecord['ActionEnd'] = Date.now();
18942
18962
  }
18963
+ if (this.task.setTimeConsuming) this.task.setTimeConsuming(this.task._timerRecord);
18943
18964
  if (200 === responseData.code) this.task.logger.info(`${func.name} action params error`, responseData);
18944
18965
  else if (0 !== responseData.code) {
18945
18966
  this.task.logger.error(responseData.message || `${func.name} 执行失败`, stringifyError(responseData.data), responseData.extra);