@iflyrpa/actions 4.0.0-beta.4 → 4.0.0-beta.8

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.mjs CHANGED
@@ -5434,7 +5434,7 @@ function __webpack_require__(moduleId) {
5434
5434
  return module;
5435
5435
  };
5436
5436
  })();
5437
- var package_namespaceObject = JSON.parse('{"i8":"3.0.7-beta.3"}');
5437
+ var package_namespaceObject = JSON.parse('{"i8":"4.0.0-beta.7"}');
5438
5438
  var dist = __webpack_require__("../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js");
5439
5439
  async function ProxyAgent(task, ip, adr, accountId, refresh) {
5440
5440
  const http = new Http({
@@ -11820,16 +11820,35 @@ const WxSessionCheck = async (_task, params)=>{
11820
11820
  }, "微信账号有效性检测完成!");
11821
11821
  };
11822
11822
  const XhsSessionCheck = async (_task, params)=>{
11823
+ const logger = _task.logger;
11824
+ const startedAt = Date.now();
11823
11825
  const check = {
11824
11826
  isValidSession: false,
11825
11827
  isValidWebSession: false
11826
11828
  };
11829
+ const cookieNames = params.cookies.map((it)=>it.name);
11830
+ logger?.info("[XhsSessionCheck] 开始执行小红书账号有效性检测", {
11831
+ accountId: params.accountId,
11832
+ proxyLoc: params.proxyLoc,
11833
+ localIP: params.localIP,
11834
+ willUseProxyAgent: !!params.localIP,
11835
+ cookieCount: params.cookies.length,
11836
+ cookieNames,
11837
+ hasA1: cookieNames.includes("a1"),
11838
+ hasWebSession: cookieNames.includes("web_session")
11839
+ });
11827
11840
  const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
11828
- if (!a1Cookie) return {
11829
- code: 414,
11830
- message: "账号数据异常,请重新绑定账号后重试。",
11831
- data: check
11832
- };
11841
+ if (!a1Cookie) {
11842
+ logger?.warn("[XhsSessionCheck] 缺失关键 cookie a1,提前返回", {
11843
+ accountId: params.accountId,
11844
+ cookieNames
11845
+ });
11846
+ return {
11847
+ code: 414,
11848
+ message: "账号数据异常,请重新绑定账号后重试。",
11849
+ data: check
11850
+ };
11851
+ }
11833
11852
  const headers = {
11834
11853
  cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
11835
11854
  referer: "https://creator.xiaohongshu.com/new/home?source=official"
@@ -11857,6 +11876,7 @@ const XhsSessionCheck = async (_task, params)=>{
11857
11876
  return acc;
11858
11877
  }, {});
11859
11878
  const loginBaseXsHeader = sessionCheck_xsEncrypt.signHeadersGet(loginBasePath, recordCookie, "xhs-pc-web", null);
11879
+ const baseInfoStart = Date.now();
11860
11880
  const _baseInfo = http.api({
11861
11881
  method: "get",
11862
11882
  baseURL: "https://creator.xiaohongshu.com",
@@ -11866,7 +11886,28 @@ const XhsSessionCheck = async (_task, params)=>{
11866
11886
  retries: 3,
11867
11887
  retryDelay: 20,
11868
11888
  timeout: 3000
11869
- }).catch((e)=>e.data);
11889
+ }).then((res)=>{
11890
+ logger?.info("[XhsSessionCheck] creator base 接口请求成功", {
11891
+ accountId: params.accountId,
11892
+ duration: Date.now() - baseInfoStart,
11893
+ code: res?.code,
11894
+ msg: res?.msg,
11895
+ proxyInfo: http.proxyInfo
11896
+ });
11897
+ return res;
11898
+ }).catch((e)=>{
11899
+ logger?.warn("[XhsSessionCheck] creator base 接口请求失败", {
11900
+ accountId: params.accountId,
11901
+ duration: Date.now() - baseInfoStart,
11902
+ code: e?.code,
11903
+ message: e?.message,
11904
+ data: e?.data,
11905
+ extra: e?.extra,
11906
+ proxyInfo: http.proxyInfo
11907
+ });
11908
+ return e.data;
11909
+ });
11910
+ const webSessionStart = Date.now();
11870
11911
  const _web_session = http.api({
11871
11912
  method: "get",
11872
11913
  url: "https://edith.xiaohongshu.com/api/sns/web/unread_count"
@@ -11874,6 +11915,26 @@ const XhsSessionCheck = async (_task, params)=>{
11874
11915
  retries: 3,
11875
11916
  retryDelay: 20,
11876
11917
  timeout: 3000
11918
+ }).then((res)=>{
11919
+ logger?.info("[XhsSessionCheck] edith unread_count 接口请求成功", {
11920
+ accountId: params.accountId,
11921
+ duration: Date.now() - webSessionStart,
11922
+ code: res?.code,
11923
+ msg: res?.msg,
11924
+ proxyInfo: http.proxyInfo
11925
+ });
11926
+ return res;
11927
+ }).catch((e)=>{
11928
+ logger?.warn("[XhsSessionCheck] edith unread_count 接口请求失败", {
11929
+ accountId: params.accountId,
11930
+ duration: Date.now() - webSessionStart,
11931
+ code: e?.code,
11932
+ message: e?.message,
11933
+ data: e?.data,
11934
+ extra: e?.extra,
11935
+ proxyInfo: http.proxyInfo
11936
+ });
11937
+ throw e;
11877
11938
  });
11878
11939
  const [baseInfo, web_session] = await Promise.all([
11879
11940
  _baseInfo,
@@ -11881,8 +11942,18 @@ const XhsSessionCheck = async (_task, params)=>{
11881
11942
  ]);
11882
11943
  if (baseInfo?.code === 0) check.isValidSession = true;
11883
11944
  if (0 === web_session.code) check.isValidWebSession = true;
11884
- baseInfo?.code, web_session.code;
11945
+ const _isSuccess = baseInfo?.code === web_session.code;
11885
11946
  const message = `小红书账号有效性检测成功${_task.debug ? ` ${http.proxyInfo}` : ""}`;
11947
+ logger?.info("[XhsSessionCheck] 检测完成", {
11948
+ accountId: params.accountId,
11949
+ totalDuration: Date.now() - startedAt,
11950
+ baseInfoCode: baseInfo?.code,
11951
+ webSessionCode: web_session?.code,
11952
+ isValidSession: check.isValidSession,
11953
+ isValidWebSession: check.isValidWebSession,
11954
+ codeAligned: _isSuccess,
11955
+ proxyInfo: http.proxyInfo
11956
+ });
11886
11957
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(check, message);
11887
11958
  };
11888
11959
  const BjhSessionCheck = async (_task, params)=>{
@@ -14521,10 +14592,13 @@ const mock_mockAction = async (task, params)=>{
14521
14592
  ].filter(Boolean).join(" ");
14522
14593
  const message = `图文发布失败,原因:${details}${task.debug ? ` ${http.proxyInfo}` : ""}`;
14523
14594
  task.logger.warn(`TaskId:${task.taskId},检测到需要验证,准备返回验证信息`);
14595
+ let decisionObj = {};
14596
+ if (decision) decisionObj = decision;
14524
14597
  const mockData = {
14525
14598
  state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
14526
14599
  error: message,
14527
14600
  result: {
14601
+ ...decisionObj,
14528
14602
  data: decision,
14529
14603
  uploadedImgList: JSON.stringify(publishData.item.common.images)
14530
14604
  }
@@ -14554,10 +14628,13 @@ const mock_mockAction = async (task, params)=>{
14554
14628
  const message = `图文发布${isSuccess ? "成功" : `失败,原因:${publishResult.status_msg} ${decision?.verify_title} ${decision?.verify_desc}`}${task.debug ? ` ${http.proxyInfo}` : ""}`;
14555
14629
  const data = isSuccess ? publishResult.item_id || "" : "";
14556
14630
  if (!isSuccess) {
14631
+ let decisionObj = {};
14632
+ if (decision) decisionObj = decision;
14557
14633
  await updateTaskState?.({
14558
14634
  state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
14559
14635
  error: message,
14560
14636
  result: {
14637
+ ...decisionObj,
14561
14638
  data: decision,
14562
14639
  uploadedImgList: JSON.stringify(publishData.item.common.images)
14563
14640
  }