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.
- package/README.md +2 -0
- package/openxiangda-skills/SKILL.md +2 -0
- package/openxiangda-skills/references/architecture-design.md +1 -0
- package/openxiangda-skills/references/openxiangda-api.md +2 -0
- package/openxiangda-skills/references/pages/page-sdk.md +2 -0
- package/openxiangda-skills/references/resource-manifest-cheatsheet.md +2 -0
- package/package.json +1 -1
- package/packages/sdk/dist/components/index.cjs +13 -2
- package/packages/sdk/dist/components/index.cjs.map +1 -1
- package/packages/sdk/dist/components/index.mjs +13 -2
- package/packages/sdk/dist/components/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/index.cjs +102 -21
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.mjs +102 -21
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/react.cjs +70 -11
- package/packages/sdk/dist/runtime/react.cjs.map +1 -1
- package/packages/sdk/dist/runtime/react.d.mts +1 -1
- package/packages/sdk/dist/runtime/react.d.ts +1 -1
- package/packages/sdk/dist/runtime/react.mjs +70 -11
- package/packages/sdk/dist/runtime/react.mjs.map +1 -1
|
@@ -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
|
|
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 || !
|
|
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;
|