@iflyrpa/actions 1.2.16-beta.3 → 1.2.16-beta.5

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
@@ -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) {
@@ -15894,7 +15889,7 @@ var __webpack_exports__ = {};
15894
15889
  articleCell,
15895
15890
  ...onlySuccess ? {
15896
15891
  pagination: {
15897
- total: api_base_info_json.total_count || -1,
15892
+ total: api_base_info_json.total_count,
15898
15893
  pageNum,
15899
15894
  pageSize
15900
15895
  }
@@ -17838,33 +17833,40 @@ var __webpack_exports__ = {};
17838
17833
  }
17839
17834
  });
17840
17835
  let uploadInfos = [];
17841
- coverIdInfo.data.uploadTempPermits.map((item)=>{
17842
- uploadInfos.push({
17843
- bucket: "",
17844
- uploadAddr: item.uploadAddr,
17845
- fileIds: item.fileIds,
17846
- token: item.token
17836
+ coverIdInfo.data.uploadTempPermits.forEach((item)=>{
17837
+ item.fileIds.forEach((fileId)=>{
17838
+ uploadInfos.push({
17839
+ bucket: item.bucket || "",
17840
+ uploadAddr: item.uploadAddr || "",
17841
+ fileIds: fileId,
17842
+ token: item.token || ""
17843
+ });
17847
17844
  });
17848
17845
  });
17846
+ if (uploadInfos.length < params.banners.length) return {
17847
+ code: 200,
17848
+ message: "可用 OSS bucket 数量不足,无法上传所有图片!",
17849
+ data: ""
17850
+ };
17849
17851
  if (0 === uploadInfos.length) return {
17850
17852
  code: 200,
17851
17853
  message: "图片上传失败,请稍后重试!",
17852
17854
  data: ""
17853
17855
  };
17854
- const uploadFile = async (url, index, infoIndex = 0)=>{
17856
+ const availableBuckets = Array.from({
17857
+ length: uploadInfos.length
17858
+ }, (_, i)=>i);
17859
+ const uploadFile = async (url, index)=>{
17855
17860
  const fileName = getFilenameFromUrl(url);
17856
17861
  const localUrl = await downloadImage(url, external_node_path_default().join(tmpCachePath, fileName));
17857
17862
  const fileBuffer = external_node_fs_default().readFileSync(localUrl);
17858
- const tryUpload = async (uploadIndex)=>{
17859
- if (uploadIndex >= uploadInfos.length) {
17860
- external_node_fs_default().unlinkSync(localUrl);
17861
- return {
17862
- ossFileId: "",
17863
- ossToken: ""
17864
- };
17865
- }
17866
- const currentInfo = uploadInfos[uploadIndex];
17867
- const ossFileId = currentInfo.fileIds[0];
17863
+ const MAX_RETRIES = uploadInfos.length;
17864
+ let attempt = 0;
17865
+ while(attempt < MAX_RETRIES){
17866
+ const ossBucketIndex = availableBuckets.shift();
17867
+ if (void 0 === ossBucketIndex) break;
17868
+ const currentInfo = uploadInfos[ossBucketIndex];
17869
+ const ossFileId = currentInfo.fileIds;
17868
17870
  const ossToken = currentInfo.token;
17869
17871
  const ossDomain = currentInfo.uploadAddr;
17870
17872
  try {
@@ -17882,10 +17884,13 @@ var __webpack_exports__ = {};
17882
17884
  ossToken
17883
17885
  };
17884
17886
  } catch (error) {
17885
- return tryUpload(uploadIndex + 1);
17887
+ attempt++;
17886
17888
  }
17889
+ }
17890
+ return {
17891
+ ossFileId: "",
17892
+ ossToken: ""
17887
17893
  };
17888
- return tryUpload(infoIndex);
17889
17894
  };
17890
17895
  const coverInfos = await Promise.all(params.banners.map((it, idx)=>uploadFile(it, idx)));
17891
17896
  const invalidUpload = coverInfos.find((it)=>"" === it.ossToken || "" == it.ossFileId);
@@ -18230,7 +18235,7 @@ var __webpack_exports__ = {};
18230
18235
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
18231
18236
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
18232
18237
  };
18233
- var package_namespaceObject = JSON.parse('{"i8":"1.2.16-beta.2"}');
18238
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.16-beta.4"}');
18234
18239
  class Action {
18235
18240
  constructor(task){
18236
18241
  this.task = task;