@iflyrpa/actions 1.2.21 → 1.2.23
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 +3 -23
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +3 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -23
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +0 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ import { type WeixinPublishParams } from "./actions/weixinPublish";
|
|
|
19
19
|
import { type WeixinmpPublishParams } from "./actions/weixinmpPublish";
|
|
20
20
|
import { type XiaohongshuPublishParams } from "./actions/xiaohongshuPublish";
|
|
21
21
|
import type { ActiomCommonParams } from "./types";
|
|
22
|
-
export declare const BetaFlag = "HuiwenCanary";
|
|
23
22
|
export declare class Action {
|
|
24
23
|
private task;
|
|
25
24
|
constructor(task: AutomateTask);
|
package/dist/index.js
CHANGED
|
@@ -1810,7 +1810,6 @@ var __webpack_exports__ = {};
|
|
|
1810
1810
|
__webpack_require__.r(__webpack_exports__);
|
|
1811
1811
|
__webpack_require__.d(__webpack_exports__, {
|
|
1812
1812
|
version: ()=>package_namespaceObject.i8,
|
|
1813
|
-
BetaFlag: ()=>BetaFlag,
|
|
1814
1813
|
Action: ()=>Action
|
|
1815
1814
|
});
|
|
1816
1815
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
@@ -2096,8 +2095,7 @@ var __webpack_exports__ = {};
|
|
|
2096
2095
|
20040034: "封面图片推荐jpg、png格式,不支持gif格式。",
|
|
2097
2096
|
20040124: "服务器异常,请稍后重试!",
|
|
2098
2097
|
20040001: "当前用户未登录,请登陆后重试!",
|
|
2099
|
-
401100025: "该应用不支持此媒资类型"
|
|
2100
|
-
401100033: "图片宽高不满足要求"
|
|
2098
|
+
401100025: "该应用不支持此媒资类型"
|
|
2101
2099
|
};
|
|
2102
2100
|
const mockAction = async (task, params)=>{
|
|
2103
2101
|
const { baijiahaoSingleCover, baijiahaoMultCover, baijiahaoCoverType } = params.settingInfo;
|
|
@@ -2222,7 +2220,6 @@ var __webpack_exports__ = {};
|
|
|
2222
2220
|
};
|
|
2223
2221
|
const isDraft = "draft" === params.saveType;
|
|
2224
2222
|
const saveUrl = isDraft ? "https://baijiahao.baidu.com/pcui/article/save?callback=bjhdraft" : "https://baijiahao.baidu.com/pcui/article/publish?callback=bjhpublish";
|
|
2225
|
-
task._timerRecord['PrePublish'] = Date.now();
|
|
2226
2223
|
const res = await http.api({
|
|
2227
2224
|
method: "post",
|
|
2228
2225
|
url: saveUrl,
|
|
@@ -2360,7 +2357,6 @@ var __webpack_exports__ = {};
|
|
|
2360
2357
|
}
|
|
2361
2358
|
};
|
|
2362
2359
|
page.on("response", handleResponse);
|
|
2363
|
-
task._timerRecord['PrePublish'] = Date.now();
|
|
2364
2360
|
const operatorContainer = page.locator(".editor-component-operator");
|
|
2365
2361
|
if ("draft" === params.saveType) await operatorContainer.locator(".op-btn-outter-content").filter({
|
|
2366
2362
|
hasText: "存草稿"
|
|
@@ -2926,7 +2922,6 @@ var __webpack_exports__ = {};
|
|
|
2926
2922
|
article_ad_type: getAddTypeValue(params.settingInfo.toutiaoAd),
|
|
2927
2923
|
claim_exclusive: toutiaoExclusive ? toutiaoExclusive : toutiaoOriginal?.includes("exclusive") ? 1 : 0
|
|
2928
2924
|
};
|
|
2929
|
-
task._timerRecord['PrePublish'] = Date.now();
|
|
2930
2925
|
const msToken = params.cookies.find((it)=>"msToken" === it.name)?.value;
|
|
2931
2926
|
let publishOption = {};
|
|
2932
2927
|
if (msToken) {
|
|
@@ -3171,7 +3166,6 @@ var __webpack_exports__ = {};
|
|
|
3171
3166
|
const confirmBtn = page.locator('div.byte-modal-footer button.byte-btn-primary:has-text("确定")');
|
|
3172
3167
|
if (await confirmBtn.isVisible()) await confirmBtn.click();
|
|
3173
3168
|
}
|
|
3174
|
-
task._timerRecord['PrePublish'] = Date.now();
|
|
3175
3169
|
if ("publish" === params.saveType) {
|
|
3176
3170
|
await page.locator(".publish-footer button").filter({
|
|
3177
3171
|
hasText: params.settingInfo.timer ? "定时发布" : "确认发布"
|
|
@@ -4604,7 +4598,6 @@ var __webpack_exports__ = {};
|
|
|
4604
4598
|
masssend_check: 1,
|
|
4605
4599
|
is_masssend: 1
|
|
4606
4600
|
};
|
|
4607
|
-
task._timerRecord['PrePublish'] = Date.now();
|
|
4608
4601
|
const { appMsgId } = await http.api({
|
|
4609
4602
|
method: "post",
|
|
4610
4603
|
url: "https://mp.weixin.qq.com/cgi-bin/operate_appmsg",
|
|
@@ -5263,7 +5256,6 @@ var __webpack_exports__ = {};
|
|
|
5263
5256
|
await poperInstance.locator('.frm_radio_item label[for="not_recomment_0"]').click();
|
|
5264
5257
|
}
|
|
5265
5258
|
await page.waitForTimeout(1000);
|
|
5266
|
-
task._timerRecord['PrePublish'] = Date.now();
|
|
5267
5259
|
const articleId = await new Promise(async (resolve)=>{
|
|
5268
5260
|
const handleResponse = async (response)=>{
|
|
5269
5261
|
const url = response.url();
|
|
@@ -5795,7 +5787,6 @@ var __webpack_exports__ = {};
|
|
|
5795
5787
|
};
|
|
5796
5788
|
}
|
|
5797
5789
|
}
|
|
5798
|
-
task._timerRecord['PrePublish'] = Date.now();
|
|
5799
5790
|
const business_binds = {
|
|
5800
5791
|
version: 1,
|
|
5801
5792
|
bizType: "",
|
|
@@ -6023,7 +6014,6 @@ var __webpack_exports__ = {};
|
|
|
6023
6014
|
hasText: "仅自己可见"
|
|
6024
6015
|
}).click();
|
|
6025
6016
|
}
|
|
6026
|
-
task._timerRecord['PrePublish'] = Date.now();
|
|
6027
6017
|
const releaseTimeInstance = page.locator("label").filter({
|
|
6028
6018
|
hasText: params.isImmediatelyPublish ? "立即发布" : "定时发布"
|
|
6029
6019
|
});
|
|
@@ -6049,31 +6039,21 @@ var __webpack_exports__ = {};
|
|
|
6049
6039
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
6050
6040
|
};
|
|
6051
6041
|
var package_namespaceObject = {
|
|
6052
|
-
i8: "1.2.
|
|
6042
|
+
i8: "1.2.22"
|
|
6053
6043
|
};
|
|
6054
|
-
const BetaFlag = "HuiwenCanary";
|
|
6055
6044
|
class Action {
|
|
6056
6045
|
constructor(task){
|
|
6057
6046
|
this.task = task;
|
|
6058
6047
|
}
|
|
6059
6048
|
async bindTask(func, params) {
|
|
6060
6049
|
let responseData;
|
|
6061
|
-
this.task.isBeta = this.task.isFeatOn(BetaFlag);
|
|
6062
|
-
this.task._timerRecord = {
|
|
6063
|
-
ActionStart: Date.now()
|
|
6064
|
-
};
|
|
6065
6050
|
if (this.task.setArticleId) this.task.setArticleId(params.articleId ?? "");
|
|
6066
|
-
if (
|
|
6067
|
-
if (void 0 !== this.task.isInitializedGB) this.task.setGbInitType(this.task.isInitializedGB);
|
|
6068
|
-
if ("object" == typeof params) params.cookies = params?.cookies ?? [];
|
|
6051
|
+
if ("object" == typeof params && null !== params) params.cookies = params?.cookies ?? [];
|
|
6069
6052
|
try {
|
|
6070
6053
|
responseData = await func(this.task, params);
|
|
6071
6054
|
} catch (error) {
|
|
6072
6055
|
responseData = Http.handleApiError(error);
|
|
6073
|
-
} finally{
|
|
6074
|
-
this.task._timerRecord['ActionEnd'] = Date.now();
|
|
6075
6056
|
}
|
|
6076
|
-
if (this.task.isBeta && this.task.setTimeConsuming) this.task.setTimeConsuming(this.task._timerRecord);
|
|
6077
6057
|
if (200 === responseData.code) this.task.logger.info(`${func.name} action params error`, responseData);
|
|
6078
6058
|
else if (0 !== responseData.code) {
|
|
6079
6059
|
this.task.logger.error(responseData.message || `${func.name} 执行失败`, stringifyError(responseData.data), responseData.extra);
|