@iflyrpa/actions 1.2.16-beta.2 → 1.2.16-beta.4

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.
@@ -9,5 +9,7 @@ export interface FetchArticlesParams extends ActiomCommonParams {
9
9
  size?: number;
10
10
  onlySuccess?: boolean;
11
11
  showOriginalData?: boolean;
12
+ cursor?: number;
13
+ lastPage?: number;
12
14
  }
13
15
  export declare const FetchArticles: CommonAction<FetchArticlesParams, FetchArticlesData | null>;
@@ -37,6 +37,8 @@ export interface FetchArticlesData {
37
37
  pagination?: {
38
38
  total?: number;
39
39
  nextPage?: boolean;
40
+ lastPage?: number;
41
+ cursor?: number;
40
42
  pageNum: number;
41
43
  pageSize: number;
42
44
  };
package/dist/bundle.js CHANGED
@@ -13975,12 +13975,7 @@ var __webpack_exports__ = {};
13975
13975
  }
13976
13976
  constructor(config){
13977
13977
  this.apiClient = lib_axios.create({
13978
- ...config,
13979
- proxy: {
13980
- host: "localhost",
13981
- port: 9000,
13982
- protocol: "http"
13983
- }
13978
+ ...config
13984
13979
  });
13985
13980
  }
13986
13981
  addResponseInterceptor(findError) {
@@ -15906,7 +15901,7 @@ var __webpack_exports__ = {};
15906
15901
  }
15907
15902
  async function handleWeixinData(params) {
15908
15903
  try {
15909
- const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
15904
+ const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false, cursor, lastPage } = params;
15910
15905
  if (!token) return {
15911
15906
  code: 200,
15912
15907
  message: "缺少token",
@@ -15985,9 +15980,11 @@ var __webpack_exports__ = {};
15985
15980
  }
15986
15981
  });
15987
15982
  }
15988
- let size = pageSize > 20 ? 20 : pageSize;
15989
- let rawArticlesInfo = await fetchArticles((pageNum - 1) * size, size, token);
15983
+ let size = onlySuccess ? 10 : pageSize > 20 ? 20 : pageSize;
15984
+ let begin = (lastPage ?? pageNum) - 1;
15985
+ let rawArticlesInfo = await fetchArticles(begin * size, size, token);
15990
15986
  let articlesInfo = ParsePublishPage(rawArticlesInfo);
15987
+ let articleCell = [];
15991
15988
  if (!onlySuccess && pageSize > 20) {
15992
15989
  let totalFetched = articlesInfo.publish_list.length;
15993
15990
  let nextPage = pageNum + 1;
@@ -16001,29 +15998,70 @@ var __webpack_exports__ = {};
16001
15998
  if (parsed.publish_list.length < currentPageSize) break;
16002
15999
  nextPage++;
16003
16000
  }
16001
+ articleCell = articlesInfo.publish_list.map((item)=>({
16002
+ title: item.publish_info.appmsg_info[0].title,
16003
+ imageUrl: item.publish_info.appmsg_info[0].cover,
16004
+ createTime: item.publish_info.appmsg_info[0].line_info.send_time,
16005
+ redirectUrl: item.publish_info.appmsg_info[0].content_url,
16006
+ readNum: item.publish_info.appmsg_info[0].read_num,
16007
+ likeNum: item.publish_info.appmsg_info[0].old_like_num,
16008
+ shareNum: item.publish_info.appmsg_info[0].share_num,
16009
+ recommendNum: item.publish_info.appmsg_info[0].like_num,
16010
+ ...showOriginalData ? {
16011
+ originalData: item
16012
+ } : {}
16013
+ }));
16004
16014
  }
16005
- const articleCell = articlesInfo?.publish_list.map((item)=>({
16006
- title: item.publish_info.appmsg_info[0].title,
16007
- imageUrl: item.publish_info.appmsg_info[0].cover,
16008
- createTime: item.publish_info.appmsg_info[0].line_info.send_time,
16009
- redirectUrl: item.publish_info.appmsg_info[0].content_url,
16010
- readNum: item.publish_info.appmsg_info[0].read_num,
16011
- likeNum: item.publish_info.appmsg_info[0].old_like_num,
16012
- shareNum: item.publish_info.appmsg_info[0].share_num,
16013
- recommendNum: item.publish_info.appmsg_info[0].like_num,
16014
- ...showOriginalData ? {
16015
- originalData: item
16016
- } : {}
16017
- }));
16018
- return success({
16019
- articleCell,
16020
- ...onlySuccess ? {
16015
+ let nextPage = false;
16016
+ if (onlySuccess) {
16017
+ let filteredList = articlesInfo.publish_list.filter((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
16018
+ if (cursor) {
16019
+ const cursorIndex = filteredList.findIndex((item)=>item.msgid === cursor);
16020
+ if (-1 !== cursorIndex) filteredList = filteredList.slice(cursorIndex + 1);
16021
+ }
16022
+ let totalFetched = filteredList.length;
16023
+ while(totalFetched < pageSize && begin * size < articlesInfo.total_count){
16024
+ begin += 1;
16025
+ let nextRawArticlesInfo = await fetchArticles(begin * size, size, token);
16026
+ let nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
16027
+ const newFiltered = nextArticlesInfo.publish_list.filter((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
16028
+ filteredList = filteredList.concat(newFiltered);
16029
+ totalFetched = filteredList.length;
16030
+ }
16031
+ filteredList = filteredList.slice(0, pageSize);
16032
+ totalFetched = filteredList.length;
16033
+ if (totalFetched >= pageSize && begin * size < articlesInfo.total_count) {
16034
+ let nextRawArticlesInfo = await fetchArticles((begin + 1) * size, size, token);
16035
+ let nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
16036
+ nextPage = nextArticlesInfo.publish_list.length > 0 && nextArticlesInfo.publish_list.some((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey"));
16037
+ }
16038
+ const lastMsgId = filteredList.length > 0 ? filteredList[filteredList.length - 1].msgid : void 0;
16039
+ articleCell = filteredList.map((item)=>({
16040
+ title: item.appmsg_info[0].title,
16041
+ imageUrl: item.appmsg_info[0].cover,
16042
+ createTime: item.appmsg_info[0].line_info.send_time,
16043
+ redirectUrl: item.appmsg_info[0].content_url,
16044
+ readNum: item.appmsg_info[0].read_num,
16045
+ likeNum: item.appmsg_info[0].old_like_num,
16046
+ shareNum: item.appmsg_info[0].share_num,
16047
+ recommendNum: item.appmsg_info[0].like_num,
16048
+ ...showOriginalData ? {
16049
+ originalData: item
16050
+ } : {}
16051
+ }));
16052
+ return success({
16053
+ articleCell,
16021
16054
  pagination: {
16022
- total: articlesInfo?.total_count,
16055
+ nextPage,
16023
16056
  pageNum,
16024
- pageSize
16057
+ pageSize,
16058
+ lastPage: begin + 1,
16059
+ cursor: lastMsgId
16025
16060
  }
16026
- } : null
16061
+ }, "微信文章文章获取成功");
16062
+ }
16063
+ return success({
16064
+ articleCell
16027
16065
  }, "微信文章文章获取成功");
16028
16066
  } catch (error) {
16029
16067
  return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "微信文章数据获取失败");
@@ -16080,11 +16118,11 @@ var __webpack_exports__ = {};
16080
16118
  imageUrl: JSON.parse(item.cover_images)[0].src,
16081
16119
  createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
16082
16120
  redirectUrl: item.url,
16083
- recommendNum: item.rec_amount,
16121
+ recommendNum: item.rec_amount | item.forward_num,
16084
16122
  collectNum: item.collection_amount,
16085
- readNum: item.read_amount,
16086
- likeNum: item.like_amount,
16087
- commentNum: item.comment_amount,
16123
+ readNum: item.read_amount | item.read_num,
16124
+ likeNum: item.like_amount | item.praise_num,
16125
+ commentNum: item.comment_amount | item.comment_num,
16088
16126
  shareNum: item.share_amount,
16089
16127
  ...showOriginalData ? {
16090
16128
  originalData: item
@@ -18187,7 +18225,7 @@ var __webpack_exports__ = {};
18187
18225
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
18188
18226
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
18189
18227
  };
18190
- var package_namespaceObject = JSON.parse('{"i8":"1.2.16-beta.1"}');
18228
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.16-beta.3"}');
18191
18229
  class Action {
18192
18230
  constructor(task){
18193
18231
  this.task = task;