openxiangda 1.0.47 → 1.0.49

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.47",
3
+ "version": "1.0.49",
4
4
  "description": "OpenXiangda CLI, workspace build tools, runtime SDK, and form components.",
5
5
  "private": false,
6
6
  "bin": {
@@ -39207,8 +39207,16 @@ var normalizeFormInstancePayload = (payload) => {
39207
39207
  };
39208
39208
  };
39209
39209
  var unwrapBusinessResponse = (response) => {
39210
- const result = response?.data || response?.result || response;
39211
- if (result?.success === false) {
39210
+ const isFailureCode = (value) => {
39211
+ if (value === void 0 || value === null || value === "") return false;
39212
+ const code = Number(value);
39213
+ return Number.isFinite(code) && code !== 0 && code !== 200;
39214
+ };
39215
+ if (response?.success === false || isFailureCode(response?.code)) {
39216
+ throw new Error(response.message || response.error || "\u8BF7\u6C42\u5931\u8D25");
39217
+ }
39218
+ const result = response?.data ?? response?.result ?? response;
39219
+ if (result?.success === false || isFailureCode(result?.code)) {
39212
39220
  throw new Error(result.message || response?.message || "\u8BF7\u6C42\u5931\u8D25");
39213
39221
  }
39214
39222
  return result;
@@ -39456,7 +39464,7 @@ function createFormRuntimeApi(config3) {
39456
39464
  method: "post",
39457
39465
  data: payload
39458
39466
  });
39459
- return response.data || response.result || response;
39467
+ return unwrapBusinessResponse(response);
39460
39468
  },
39461
39469
  updateFormData: async (payload) => {
39462
39470
  const data = normalizeFormInstancePayload(payload);
@@ -42881,6 +42889,11 @@ var normalizeBasePath = (basePath) => {
42881
42889
  var inferBasePath = (appType) => {
42882
42890
  if (typeof window === "undefined") return "";
42883
42891
  const pathname = window.location?.pathname || "";
42892
+ const submitMarker = `/submit/${appType}/`;
42893
+ const submitMarkerIndex = pathname.indexOf(submitMarker);
42894
+ if (submitMarkerIndex > 0) {
42895
+ return pathname.slice(0, submitMarkerIndex);
42896
+ }
42884
42897
  const marker = `/${appType}/`;
42885
42898
  const markerIndex = pathname.indexOf(marker);
42886
42899
  if (markerIndex <= 0) return "";