openxiangda 1.0.88 → 1.0.89

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.
@@ -38147,6 +38147,11 @@ var joinUrl = (baseUrl, url2) => {
38147
38147
  if (/^https?:\/\//i.test(url2)) return url2;
38148
38148
  return `${trimTrailingSlash(baseUrl)}${url2.startsWith("/") ? url2 : `/${url2}`}`;
38149
38149
  };
38150
+ var isSuccessCode = (value) => {
38151
+ if (value === void 0 || value === null || value === "") return true;
38152
+ const code = Number(value);
38153
+ return Number.isFinite(code) ? code === 0 || code >= 200 && code < 300 : false;
38154
+ };
38150
38155
  var normalizeRuntimeFileUrl = (baseUrl, value) => {
38151
38156
  if (typeof value !== "string" || !value) return value;
38152
38157
  if (/^(https?:)?\/\//i.test(value) || /^(blob|data):/i.test(value)) return value;
@@ -38173,6 +38178,12 @@ var parseResponse = async (response) => {
38173
38178
  const message6 = typeof payload === "object" && payload ? payload.message || payload.error || response.statusText : response.statusText;
38174
38179
  throw new Error(message6 || "\u8BF7\u6C42\u5931\u8D25");
38175
38180
  }
38181
+ if (typeof payload === "object" && payload) {
38182
+ const hasCode = Object.prototype.hasOwnProperty.call(payload, "code");
38183
+ if (payload.success === false || hasCode && !isSuccessCode(payload.code)) {
38184
+ throw new Error(payload.message || payload.error || "\u8BF7\u6C42\u5931\u8D25");
38185
+ }
38186
+ }
38176
38187
  if (typeof payload === "object" && payload) {
38177
38188
  return payload;
38178
38189
  }
@@ -39907,14 +39918,14 @@ var TASK_STATUS_META = {
39907
39918
  // packages/sdk/src/components/core/processApi.ts
39908
39919
  var hasOwn = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
39909
39920
  var isRuntimeEnvelope = (value) => !!value && typeof value === "object" && !Array.isArray(value) && (hasOwn(value, "code") || hasOwn(value, "success") || hasOwn(value, "data") || hasOwn(value, "result") || hasOwn(value, "message") || hasOwn(value, "error"));
39910
- var isSuccessCode = (code) => {
39921
+ var isSuccessCode2 = (code) => {
39911
39922
  if (code === void 0 || code === null || code === "") return true;
39912
39923
  const normalized = Number(code);
39913
39924
  return Number.isFinite(normalized) ? normalized === 0 || normalized === 200 : false;
39914
39925
  };
39915
39926
  var unwrapRuntimeResponse = (response) => {
39916
39927
  if (!isRuntimeEnvelope(response)) return response;
39917
- if (response.success === false || !isSuccessCode(response.code)) {
39928
+ if (response.success === false || !isSuccessCode2(response.code)) {
39918
39929
  throw new Error(response.message || response.error || "\u8BF7\u6C42\u5931\u8D25");
39919
39930
  }
39920
39931
  if (hasOwn(response, "data")) return response.data;