openxiangda 1.0.116 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openxiangda",
3
- "version": "1.0.116",
3
+ "version": "1.0.117",
4
4
  "description": "OpenXiangda CLI, workspace build tools, runtime SDK, and form components.",
5
5
  "private": false,
6
6
  "bin": {
@@ -2560,6 +2560,33 @@ init_cjs_shims();
2560
2560
 
2561
2561
  // packages/sdk/src/runtime/core/fetch.ts
2562
2562
  init_cjs_shims();
2563
+ var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
2564
+ var isTransientFetchError = (error) => {
2565
+ const anyError = error;
2566
+ const message7 = String(anyError?.message || error || "").toLowerCase();
2567
+ const causeCode = String(anyError?.cause?.code || "").toLowerCase();
2568
+ 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");
2569
+ };
2570
+ var fetchWithTransientRetry = async (fetchImpl, input, init, options = {}) => {
2571
+ if (!options.enabled) {
2572
+ return fetchImpl(input, init);
2573
+ }
2574
+ const retries = Number.isFinite(Number(options.retries)) ? Number(options.retries) : 2;
2575
+ const baseDelayMs = Number.isFinite(Number(options.baseDelayMs)) ? Number(options.baseDelayMs) : 250;
2576
+ let lastError;
2577
+ for (let attempt = 0; attempt <= retries; attempt += 1) {
2578
+ try {
2579
+ return await fetchImpl(input, init);
2580
+ } catch (error) {
2581
+ lastError = error;
2582
+ if (attempt >= retries || !isTransientFetchError(error)) {
2583
+ throw error;
2584
+ }
2585
+ await sleep(Math.min(baseDelayMs * Math.pow(2, attempt), 2e3));
2586
+ }
2587
+ }
2588
+ throw lastError;
2589
+ };
2563
2590
  var createBoundFetch = (fetchImpl) => {
2564
2591
  const baseFetch = fetchImpl || globalThis.fetch;
2565
2592
  return ((input, init) => baseFetch.call(globalThis, input, init));
@@ -28079,7 +28106,7 @@ var import_react162 = __toESM(require("react"));
28079
28106
 
28080
28107
  // node_modules/antd-mobile/es/utils/sleep.js
28081
28108
  init_cjs_shims();
28082
- var sleep = (time) => new Promise((resolve) => setTimeout(resolve, time));
28109
+ var sleep2 = (time) => new Promise((resolve) => setTimeout(resolve, time));
28083
28110
 
28084
28111
  // node_modules/antd-mobile/es/components/pull-to-refresh/pull-to-refresh.js
28085
28112
  var classPrefix63 = `adm-pull-to-refresh`;
@@ -28152,7 +28179,7 @@ var PullToRefresh = (p) => {
28152
28179
  throw e2;
28153
28180
  }
28154
28181
  if (props.completeDelay > 0) {
28155
- yield sleep(props.completeDelay);
28182
+ yield sleep2(props.completeDelay);
28156
28183
  }
28157
28184
  reset();
28158
28185
  });
@@ -34333,6 +34360,12 @@ var normalizeMethod2 = (method4) => {
34333
34360
  const value = String(method4 || "get").toUpperCase();
34334
34361
  return ["GET", "POST", "PUT", "DELETE", "PATCH"].includes(value) ? value : "GET";
34335
34362
  };
34363
+ var shouldRetryTransportRequest = (payload) => {
34364
+ const method4 = normalizeMethod2(payload?.method);
34365
+ if (method4 === "GET") return true;
34366
+ const path = String(payload?.path || "").split("?")[0];
34367
+ return method4 === "POST" && path === "/workflow/capabilities/resolve";
34368
+ };
34336
34369
  var normalizeCssIsolation2 = (value) => {
34337
34370
  if (value === "namespace" || value === "shadow" || value === "none") {
34338
34371
  return value;
@@ -34393,11 +34426,13 @@ var createBrowserPageBridge = (options = {}) => {
34393
34426
  body = JSON.stringify(payload.body);
34394
34427
  }
34395
34428
  }
34396
- const response = await fetchImpl(url2, {
34429
+ const response = await fetchWithTransientRetry(fetchImpl, url2, {
34397
34430
  method: normalizeMethod2(payload.method),
34398
34431
  headers,
34399
34432
  body,
34400
34433
  credentials: "include"
34434
+ }, {
34435
+ enabled: shouldRetryTransportRequest(payload)
34401
34436
  });
34402
34437
  return parseJsonResponse(response);
34403
34438
  };