openxiangda 1.0.115 → 1.0.117

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.
@@ -2456,6 +2456,33 @@ var createPageSdk = (context) => {
2456
2456
  };
2457
2457
 
2458
2458
  // packages/sdk/src/runtime/core/fetch.ts
2459
+ var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
2460
+ var isTransientFetchError = (error) => {
2461
+ const anyError = error;
2462
+ const message7 = String(anyError?.message || error || "").toLowerCase();
2463
+ const causeCode = String(anyError?.cause?.code || "").toLowerCase();
2464
+ return causeCode === "und_err_connect_timeout" || message7.includes("und_err_connect_timeout") || message7.includes("connect_timeout") || message7.includes("econnreset") || message7.includes("socket hang up") || message7.includes("network socket disconnected") || message7.includes("fetch failed");
2465
+ };
2466
+ var fetchWithTransientRetry = async (fetchImpl, input, init, options = {}) => {
2467
+ if (!options.enabled) {
2468
+ return fetchImpl(input, init);
2469
+ }
2470
+ const retries = Number.isFinite(Number(options.retries)) ? Number(options.retries) : 2;
2471
+ const baseDelayMs = Number.isFinite(Number(options.baseDelayMs)) ? Number(options.baseDelayMs) : 250;
2472
+ let lastError;
2473
+ for (let attempt = 0; attempt <= retries; attempt += 1) {
2474
+ try {
2475
+ return await fetchImpl(input, init);
2476
+ } catch (error) {
2477
+ lastError = error;
2478
+ if (attempt >= retries || !isTransientFetchError(error)) {
2479
+ throw error;
2480
+ }
2481
+ await sleep(Math.min(baseDelayMs * Math.pow(2, attempt), 2e3));
2482
+ }
2483
+ }
2484
+ throw lastError;
2485
+ };
2459
2486
  var createBoundFetch = (fetchImpl) => {
2460
2487
  const baseFetch = fetchImpl || globalThis.fetch;
2461
2488
  return ((input, init) => baseFetch.call(globalThis, input, init));
@@ -27352,7 +27379,7 @@ var progress_circle_default = ProgressCircle;
27352
27379
  import React146, { useEffect as useEffect42, useRef as useRef60, useState as useState44 } from "react";
27353
27380
 
27354
27381
  // node_modules/antd-mobile/es/utils/sleep.js
27355
- var sleep = (time) => new Promise((resolve) => setTimeout(resolve, time));
27382
+ var sleep2 = (time) => new Promise((resolve) => setTimeout(resolve, time));
27356
27383
 
27357
27384
  // node_modules/antd-mobile/es/components/pull-to-refresh/pull-to-refresh.js
27358
27385
  var classPrefix63 = `adm-pull-to-refresh`;
@@ -27425,7 +27452,7 @@ var PullToRefresh = (p) => {
27425
27452
  throw e2;
27426
27453
  }
27427
27454
  if (props.completeDelay > 0) {
27428
- yield sleep(props.completeDelay);
27455
+ yield sleep2(props.completeDelay);
27429
27456
  }
27430
27457
  reset();
27431
27458
  });
@@ -33464,6 +33491,12 @@ var normalizeMethod2 = (method4) => {
33464
33491
  const value = String(method4 || "get").toUpperCase();
33465
33492
  return ["GET", "POST", "PUT", "DELETE", "PATCH"].includes(value) ? value : "GET";
33466
33493
  };
33494
+ var shouldRetryTransportRequest = (payload) => {
33495
+ const method4 = normalizeMethod2(payload?.method);
33496
+ if (method4 === "GET") return true;
33497
+ const path = String(payload?.path || "").split("?")[0];
33498
+ return method4 === "POST" && path === "/workflow/capabilities/resolve";
33499
+ };
33467
33500
  var normalizeCssIsolation2 = (value) => {
33468
33501
  if (value === "namespace" || value === "shadow" || value === "none") {
33469
33502
  return value;
@@ -33524,11 +33557,13 @@ var createBrowserPageBridge = (options = {}) => {
33524
33557
  body = JSON.stringify(payload.body);
33525
33558
  }
33526
33559
  }
33527
- const response = await fetchImpl(url2, {
33560
+ const response = await fetchWithTransientRetry(fetchImpl, url2, {
33528
33561
  method: normalizeMethod2(payload.method),
33529
33562
  headers,
33530
33563
  body,
33531
33564
  credentials: "include"
33565
+ }, {
33566
+ enabled: shouldRetryTransportRequest(payload)
33532
33567
  });
33533
33568
  return parseJsonResponse(response);
33534
33569
  };