@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.
package/dist/index.js CHANGED
@@ -1169,12 +1169,7 @@ var __webpack_exports__ = {};
1169
1169
  }
1170
1170
  constructor(config){
1171
1171
  this.apiClient = external_axios_default().create({
1172
- ...config,
1173
- proxy: {
1174
- host: "localhost",
1175
- port: 9000,
1176
- protocol: "http"
1177
- }
1172
+ ...config
1178
1173
  });
1179
1174
  }
1180
1175
  addResponseInterceptor(findError) {
@@ -3031,7 +3026,7 @@ var __webpack_exports__ = {};
3031
3026
  }
3032
3027
  async function handleWeixinData(params) {
3033
3028
  try {
3034
- const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
3029
+ const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false, cursor, lastPage } = params;
3035
3030
  if (!token) return {
3036
3031
  code: 200,
3037
3032
  message: "缺少token",
@@ -3110,9 +3105,11 @@ var __webpack_exports__ = {};
3110
3105
  }
3111
3106
  });
3112
3107
  }
3113
- let size = pageSize > 20 ? 20 : pageSize;
3114
- let rawArticlesInfo = await fetchArticles((pageNum - 1) * size, size, token);
3108
+ let size = onlySuccess ? 10 : pageSize > 20 ? 20 : pageSize;
3109
+ let begin = (lastPage ?? pageNum) - 1;
3110
+ let rawArticlesInfo = await fetchArticles(begin * size, size, token);
3115
3111
  let articlesInfo = ParsePublishPage(rawArticlesInfo);
3112
+ let articleCell = [];
3116
3113
  if (!onlySuccess && pageSize > 20) {
3117
3114
  let totalFetched = articlesInfo.publish_list.length;
3118
3115
  let nextPage = pageNum + 1;
@@ -3126,29 +3123,70 @@ var __webpack_exports__ = {};
3126
3123
  if (parsed.publish_list.length < currentPageSize) break;
3127
3124
  nextPage++;
3128
3125
  }
3126
+ articleCell = articlesInfo.publish_list.map((item)=>({
3127
+ title: item.publish_info.appmsg_info[0].title,
3128
+ imageUrl: item.publish_info.appmsg_info[0].cover,
3129
+ createTime: item.publish_info.appmsg_info[0].line_info.send_time,
3130
+ redirectUrl: item.publish_info.appmsg_info[0].content_url,
3131
+ readNum: item.publish_info.appmsg_info[0].read_num,
3132
+ likeNum: item.publish_info.appmsg_info[0].old_like_num,
3133
+ shareNum: item.publish_info.appmsg_info[0].share_num,
3134
+ recommendNum: item.publish_info.appmsg_info[0].like_num,
3135
+ ...showOriginalData ? {
3136
+ originalData: item
3137
+ } : {}
3138
+ }));
3129
3139
  }
3130
- const articleCell = articlesInfo?.publish_list.map((item)=>({
3131
- title: item.publish_info.appmsg_info[0].title,
3132
- imageUrl: item.publish_info.appmsg_info[0].cover,
3133
- createTime: item.publish_info.appmsg_info[0].line_info.send_time,
3134
- redirectUrl: item.publish_info.appmsg_info[0].content_url,
3135
- readNum: item.publish_info.appmsg_info[0].read_num,
3136
- likeNum: item.publish_info.appmsg_info[0].old_like_num,
3137
- shareNum: item.publish_info.appmsg_info[0].share_num,
3138
- recommendNum: item.publish_info.appmsg_info[0].like_num,
3139
- ...showOriginalData ? {
3140
- originalData: item
3141
- } : {}
3142
- }));
3143
- return (0, share_namespaceObject.success)({
3144
- articleCell,
3145
- ...onlySuccess ? {
3140
+ let nextPage = false;
3141
+ if (onlySuccess) {
3142
+ let filteredList = articlesInfo.publish_list.filter((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
3143
+ if (cursor) {
3144
+ const cursorIndex = filteredList.findIndex((item)=>item.msgid === cursor);
3145
+ if (-1 !== cursorIndex) filteredList = filteredList.slice(cursorIndex + 1);
3146
+ }
3147
+ let totalFetched = filteredList.length;
3148
+ while(totalFetched < pageSize && begin * size < articlesInfo.total_count){
3149
+ begin += 1;
3150
+ let nextRawArticlesInfo = await fetchArticles(begin * size, size, token);
3151
+ let nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
3152
+ const newFiltered = nextArticlesInfo.publish_list.filter((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
3153
+ filteredList = filteredList.concat(newFiltered);
3154
+ totalFetched = filteredList.length;
3155
+ }
3156
+ filteredList = filteredList.slice(0, pageSize);
3157
+ totalFetched = filteredList.length;
3158
+ if (totalFetched >= pageSize && begin * size < articlesInfo.total_count) {
3159
+ let nextRawArticlesInfo = await fetchArticles((begin + 1) * size, size, token);
3160
+ let nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
3161
+ nextPage = nextArticlesInfo.publish_list.length > 0 && nextArticlesInfo.publish_list.some((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey"));
3162
+ }
3163
+ const lastMsgId = filteredList.length > 0 ? filteredList[filteredList.length - 1].msgid : void 0;
3164
+ articleCell = filteredList.map((item)=>({
3165
+ title: item.appmsg_info[0].title,
3166
+ imageUrl: item.appmsg_info[0].cover,
3167
+ createTime: item.appmsg_info[0].line_info.send_time,
3168
+ redirectUrl: item.appmsg_info[0].content_url,
3169
+ readNum: item.appmsg_info[0].read_num,
3170
+ likeNum: item.appmsg_info[0].old_like_num,
3171
+ shareNum: item.appmsg_info[0].share_num,
3172
+ recommendNum: item.appmsg_info[0].like_num,
3173
+ ...showOriginalData ? {
3174
+ originalData: item
3175
+ } : {}
3176
+ }));
3177
+ return (0, share_namespaceObject.success)({
3178
+ articleCell,
3146
3179
  pagination: {
3147
- total: articlesInfo?.total_count,
3180
+ nextPage,
3148
3181
  pageNum,
3149
- pageSize
3182
+ pageSize,
3183
+ lastPage: begin + 1,
3184
+ cursor: lastMsgId
3150
3185
  }
3151
- } : null
3186
+ }, "微信文章文章获取成功");
3187
+ }
3188
+ return (0, share_namespaceObject.success)({
3189
+ articleCell
3152
3190
  }, "微信文章文章获取成功");
3153
3191
  } catch (error) {
3154
3192
  return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "微信文章数据获取失败");
@@ -3205,11 +3243,11 @@ var __webpack_exports__ = {};
3205
3243
  imageUrl: JSON.parse(item.cover_images)[0].src,
3206
3244
  createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
3207
3245
  redirectUrl: item.url,
3208
- recommendNum: item.rec_amount,
3246
+ recommendNum: item.rec_amount | item.forward_num,
3209
3247
  collectNum: item.collection_amount,
3210
- readNum: item.read_amount,
3211
- likeNum: item.like_amount,
3212
- commentNum: item.comment_amount,
3248
+ readNum: item.read_amount | item.read_num,
3249
+ likeNum: item.like_amount | item.praise_num,
3250
+ commentNum: item.comment_amount | item.comment_num,
3213
3251
  shareNum: item.share_amount,
3214
3252
  ...showOriginalData ? {
3215
3253
  originalData: item
@@ -5312,7 +5350,7 @@ var __webpack_exports__ = {};
5312
5350
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
5313
5351
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
5314
5352
  };
5315
- var package_namespaceObject = JSON.parse('{"i8":"1.2.16-beta.1"}');
5353
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.16-beta.3"}');
5316
5354
  class Action {
5317
5355
  constructor(task){
5318
5356
  this.task = task;