openxiangda 1.0.87 → 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 +4 -0
- package/openxiangda-skills/SKILL.md +2 -0
- package/openxiangda-skills/references/architecture-design.md +1 -0
- package/openxiangda-skills/references/openxiangda-api.md +7 -1
- package/openxiangda-skills/references/pages/page-sdk.md +3 -1
- package/openxiangda-skills/references/resource-manifest-cheatsheet.md +5 -1
- 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 +139 -30
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.mjs +139 -30
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/react.cjs +107 -20
- package/packages/sdk/dist/runtime/react.cjs.map +1 -1
- package/packages/sdk/dist/runtime/react.d.mts +10 -4
- package/packages/sdk/dist/runtime/react.d.ts +10 -4
- package/packages/sdk/dist/runtime/react.mjs +107 -20
- package/packages/sdk/dist/runtime/react.mjs.map +1 -1
|
@@ -34,7 +34,7 @@ var require_classnames = __commonJS({
|
|
|
34
34
|
"use strict";
|
|
35
35
|
(function() {
|
|
36
36
|
"use strict";
|
|
37
|
-
var
|
|
37
|
+
var hasOwn3 = {}.hasOwnProperty;
|
|
38
38
|
function classNames80() {
|
|
39
39
|
var classes = "";
|
|
40
40
|
for (var i2 = 0; i2 < arguments.length; i2++) {
|
|
@@ -60,7 +60,7 @@ var require_classnames = __commonJS({
|
|
|
60
60
|
}
|
|
61
61
|
var classes = "";
|
|
62
62
|
for (var key in arg) {
|
|
63
|
-
if (
|
|
63
|
+
if (hasOwn3.call(arg, key) && arg[key]) {
|
|
64
64
|
classes = appendClass(classes, key);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -1007,18 +1007,39 @@ var normalizeDynamicOrder = (value) => {
|
|
|
1007
1007
|
}
|
|
1008
1008
|
return `${value.id}:${value.isAsc === "n" ? "-" : "+"}`;
|
|
1009
1009
|
};
|
|
1010
|
+
var hasOwn = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
|
|
1011
|
+
var normalizeEnvelopeCode = (value) => {
|
|
1012
|
+
if (value === void 0 || value === null || value === "") {
|
|
1013
|
+
return 200;
|
|
1014
|
+
}
|
|
1015
|
+
const normalized = Number(value);
|
|
1016
|
+
return Number.isFinite(normalized) ? normalized : String(value);
|
|
1017
|
+
};
|
|
1018
|
+
var isSuccessCode = (value) => {
|
|
1019
|
+
if (value === void 0 || value === null || value === "") {
|
|
1020
|
+
return true;
|
|
1021
|
+
}
|
|
1022
|
+
const normalized = Number(value);
|
|
1023
|
+
return Number.isFinite(normalized) ? normalized === 0 || normalized >= 200 && normalized < 300 : false;
|
|
1024
|
+
};
|
|
1025
|
+
var getEnvelopeCode = (rawResponse) => {
|
|
1026
|
+
if (isRecord(rawResponse) && hasOwn(rawResponse, "code")) {
|
|
1027
|
+
return rawResponse.code;
|
|
1028
|
+
}
|
|
1029
|
+
const nestedData = rawResponse?.data;
|
|
1030
|
+
if (isRecord(nestedData) && hasOwn(nestedData, "code")) {
|
|
1031
|
+
return nestedData.code;
|
|
1032
|
+
}
|
|
1033
|
+
return void 0;
|
|
1034
|
+
};
|
|
1010
1035
|
var normalizeJsonResponse = (rawResponse) => {
|
|
1011
|
-
const
|
|
1012
|
-
const nestedCode = Number(
|
|
1013
|
-
rawResponse?.data?.code
|
|
1014
|
-
);
|
|
1015
|
-
const code = Number.isFinite(topLevelCode) ? topLevelCode : Number.isFinite(nestedCode) ? nestedCode : 200;
|
|
1036
|
+
const code = normalizeEnvelopeCode(getEnvelopeCode(rawResponse));
|
|
1016
1037
|
const topLevelResult = isRecord(rawResponse) && "result" in rawResponse ? rawResponse.result : void 0;
|
|
1017
1038
|
const nestedResult = isRecord(rawResponse?.data) && "result" in (rawResponse.data || {}) ? rawResponse.data?.result : void 0;
|
|
1018
1039
|
const topLevelData = isRecord(rawResponse) && "data" in rawResponse ? rawResponse.data : void 0;
|
|
1019
1040
|
const result = topLevelResult !== void 0 ? topLevelResult : nestedResult !== void 0 ? nestedResult : topLevelData !== void 0 ? topLevelData : isRecord(rawResponse) ? rawResponse : null;
|
|
1020
1041
|
const nestedSuccess = typeof rawResponse?.data?.success === "boolean" ? rawResponse.data?.success : void 0;
|
|
1021
|
-
const success =
|
|
1042
|
+
const success = rawResponse?.success === false || nestedSuccess === false ? false : isSuccessCode(code);
|
|
1022
1043
|
return {
|
|
1023
1044
|
code,
|
|
1024
1045
|
success,
|
|
@@ -1063,6 +1084,9 @@ var normalizeBinaryResponse = (rawResponse) => {
|
|
|
1063
1084
|
};
|
|
1064
1085
|
};
|
|
1065
1086
|
var toSdkError = (input, payload) => {
|
|
1087
|
+
if (input instanceof Error && input.response) {
|
|
1088
|
+
return input;
|
|
1089
|
+
}
|
|
1066
1090
|
const normalizedResponse = isRecord(input) ? normalizeJsonResponse(input) : void 0;
|
|
1067
1091
|
const nextError = input instanceof Error ? input : new Error(
|
|
1068
1092
|
normalizedResponse?.message || `\u8BF7\u6C42\u5931\u8D25: ${String(payload.method).toUpperCase()} ${payload.path}`
|
|
@@ -2202,7 +2226,8 @@ var createAuthClient = ({
|
|
|
2202
2226
|
});
|
|
2203
2227
|
const payload = await readPayload(response);
|
|
2204
2228
|
const code = getRecordValue(payload, "code");
|
|
2205
|
-
|
|
2229
|
+
const success = getRecordValue(payload, "success");
|
|
2230
|
+
if (!response.ok || success === false || !isSuccessCode2(code)) {
|
|
2206
2231
|
throw new AuthClientError(
|
|
2207
2232
|
String(getRecordValue(payload, "message") || `Auth request failed: ${response.status}`),
|
|
2208
2233
|
{ status: response.status, code, payload }
|
|
@@ -2255,6 +2280,11 @@ var getRecordValue = (value, key) => {
|
|
|
2255
2280
|
if (!value || typeof value !== "object") return void 0;
|
|
2256
2281
|
return value[key];
|
|
2257
2282
|
};
|
|
2283
|
+
var isSuccessCode2 = (code) => {
|
|
2284
|
+
if (code === void 0 || code === null || code === "") return true;
|
|
2285
|
+
const normalized = Number(code);
|
|
2286
|
+
return Number.isFinite(normalized) ? normalized === 0 || normalized >= 200 && normalized < 300 : false;
|
|
2287
|
+
};
|
|
2258
2288
|
var resolveLoginUrl = (appType, {
|
|
2259
2289
|
callbackUrl = getCurrentHref2(),
|
|
2260
2290
|
callbackParamName = "callback",
|
|
@@ -2326,7 +2356,8 @@ var createPublicAccessClient = ({
|
|
|
2326
2356
|
);
|
|
2327
2357
|
const payload = await readPayload2(response);
|
|
2328
2358
|
const code = getRecordValue2(payload, "code");
|
|
2329
|
-
|
|
2359
|
+
const success = getRecordValue2(payload, "success");
|
|
2360
|
+
if (!response.ok || success === false || !isSuccessCode3(code)) {
|
|
2330
2361
|
throw new PublicAccessClientError(
|
|
2331
2362
|
String(
|
|
2332
2363
|
getRecordValue2(payload, "message") || `Public access session failed: ${response.status}`
|
|
@@ -2364,6 +2395,11 @@ var getRecordValue2 = (value, key) => {
|
|
|
2364
2395
|
if (!value || typeof value !== "object") return void 0;
|
|
2365
2396
|
return value[key];
|
|
2366
2397
|
};
|
|
2398
|
+
var isSuccessCode3 = (code) => {
|
|
2399
|
+
if (code === void 0 || code === null || code === "") return true;
|
|
2400
|
+
const normalized = Number(code);
|
|
2401
|
+
return Number.isFinite(normalized) ? normalized === 0 || normalized >= 200 && normalized < 300 : false;
|
|
2402
|
+
};
|
|
2367
2403
|
var getCurrentPathname = () => typeof window === "undefined" ? void 0 : window.location.pathname;
|
|
2368
2404
|
var getCurrentDomain = () => typeof window === "undefined" ? void 0 : window.location.host;
|
|
2369
2405
|
var getCurrentUserAgent = () => typeof navigator === "undefined" ? void 0 : navigator.userAgent;
|
|
@@ -4008,12 +4044,23 @@ var OpenXiangdaProvider = ({
|
|
|
4008
4044
|
() => appType || resolveAppTypeFromLocation(),
|
|
4009
4045
|
[appType]
|
|
4010
4046
|
);
|
|
4047
|
+
const [accessToken, setAccessTokenState] = useState4(null);
|
|
4048
|
+
const setAccessToken = useCallback4(
|
|
4049
|
+
(nextAccessToken) => {
|
|
4050
|
+
setAccessTokenState(nextAccessToken || null);
|
|
4051
|
+
},
|
|
4052
|
+
[]
|
|
4053
|
+
);
|
|
4054
|
+
const authorizedFetch = useMemo5(
|
|
4055
|
+
() => createAuthorizedFetch(resolvedFetch, accessToken),
|
|
4056
|
+
[accessToken, resolvedFetch]
|
|
4057
|
+
);
|
|
4011
4058
|
const [state, setState] = useState4({
|
|
4012
4059
|
data: null,
|
|
4013
4060
|
loading: true,
|
|
4014
4061
|
error: null
|
|
4015
4062
|
});
|
|
4016
|
-
const reload = useCallback4(async () => {
|
|
4063
|
+
const reload = useCallback4(async (options = {}) => {
|
|
4017
4064
|
if (!resolvedAppType) {
|
|
4018
4065
|
setState({
|
|
4019
4066
|
data: null,
|
|
@@ -4026,8 +4073,9 @@ var OpenXiangdaProvider = ({
|
|
|
4026
4073
|
return;
|
|
4027
4074
|
}
|
|
4028
4075
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
4076
|
+
const requestFetch = options.accessToken !== void 0 ? createAuthorizedFetch(resolvedFetch, options.accessToken || null) : authorizedFetch;
|
|
4029
4077
|
try {
|
|
4030
|
-
const response = await
|
|
4078
|
+
const response = await requestFetch(
|
|
4031
4079
|
buildServiceUrl3(
|
|
4032
4080
|
servicePrefix,
|
|
4033
4081
|
`/openxiangda-api/v1/apps/${encodeURIComponent(
|
|
@@ -4040,7 +4088,7 @@ var OpenXiangdaProvider = ({
|
|
|
4040
4088
|
}
|
|
4041
4089
|
);
|
|
4042
4090
|
const payload = await readJsonPayload(response);
|
|
4043
|
-
if (
|
|
4091
|
+
if (isRuntimeEnvelopeFailure(response, payload)) {
|
|
4044
4092
|
throw createRuntimeHttpError(
|
|
4045
4093
|
response,
|
|
4046
4094
|
payload,
|
|
@@ -4059,7 +4107,7 @@ var OpenXiangdaProvider = ({
|
|
|
4059
4107
|
error: normalizeRuntimeError(error)
|
|
4060
4108
|
});
|
|
4061
4109
|
}
|
|
4062
|
-
}, [resolvedAppType, resolvedFetch, servicePrefix]);
|
|
4110
|
+
}, [authorizedFetch, resolvedAppType, resolvedFetch, servicePrefix]);
|
|
4063
4111
|
useEffect4(() => {
|
|
4064
4112
|
void reload();
|
|
4065
4113
|
}, [reload]);
|
|
@@ -4068,10 +4116,11 @@ var OpenXiangdaProvider = ({
|
|
|
4068
4116
|
...state,
|
|
4069
4117
|
appType: resolvedAppType,
|
|
4070
4118
|
servicePrefix,
|
|
4071
|
-
fetchImpl:
|
|
4072
|
-
reload
|
|
4119
|
+
fetchImpl: authorizedFetch,
|
|
4120
|
+
reload,
|
|
4121
|
+
setAccessToken
|
|
4073
4122
|
}),
|
|
4074
|
-
[reload, resolvedAppType,
|
|
4123
|
+
[authorizedFetch, reload, resolvedAppType, servicePrefix, state]
|
|
4075
4124
|
);
|
|
4076
4125
|
return /* @__PURE__ */ jsx4(OpenXiangdaRuntimeContext.Provider, { value, children });
|
|
4077
4126
|
};
|
|
@@ -4174,7 +4223,7 @@ var useCanAccessRoute = (input) => {
|
|
|
4174
4223
|
payload
|
|
4175
4224
|
};
|
|
4176
4225
|
if (!disposed) {
|
|
4177
|
-
const shouldTreatAsError = !response.ok ||
|
|
4226
|
+
const shouldTreatAsError = !response.ok || isServerErrorCode(code);
|
|
4178
4227
|
setState({
|
|
4179
4228
|
data,
|
|
4180
4229
|
loading: false,
|
|
@@ -4306,7 +4355,7 @@ var useRuntimeAuth = () => {
|
|
|
4306
4355
|
}
|
|
4307
4356
|
);
|
|
4308
4357
|
const payload = await readJsonPayload(response);
|
|
4309
|
-
if (
|
|
4358
|
+
if (isRuntimeEnvelopeFailure(response, payload)) {
|
|
4310
4359
|
throw createRuntimeHttpError(
|
|
4311
4360
|
response,
|
|
4312
4361
|
payload,
|
|
@@ -4338,6 +4387,19 @@ var buildServiceUrl3 = (servicePrefix, path) => {
|
|
|
4338
4387
|
const suffix = path.startsWith("/") ? path : `/${path}`;
|
|
4339
4388
|
return `${prefix2}${suffix}`;
|
|
4340
4389
|
};
|
|
4390
|
+
var createAuthorizedFetch = (baseFetch, accessToken) => {
|
|
4391
|
+
if (!accessToken) return baseFetch;
|
|
4392
|
+
return ((input, init = {}) => {
|
|
4393
|
+
const headers = new Headers(init.headers || {});
|
|
4394
|
+
if (!headers.has("authorization")) {
|
|
4395
|
+
headers.set("authorization", `Bearer ${accessToken}`);
|
|
4396
|
+
}
|
|
4397
|
+
return baseFetch(input, {
|
|
4398
|
+
...init,
|
|
4399
|
+
headers
|
|
4400
|
+
});
|
|
4401
|
+
});
|
|
4402
|
+
};
|
|
4341
4403
|
var readJsonPayload = async (response) => {
|
|
4342
4404
|
try {
|
|
4343
4405
|
return await response.json();
|
|
@@ -4383,6 +4445,15 @@ var classifyRuntimeError = (status, code) => {
|
|
|
4383
4445
|
const normalizedCode = typeof code === "string" ? Number(code) : code;
|
|
4384
4446
|
if (status === 401 || normalizedCode === 401) return "unauthenticated";
|
|
4385
4447
|
if (status === 403 || normalizedCode === 403) return "forbidden";
|
|
4448
|
+
if (typeof code === "string") {
|
|
4449
|
+
const normalizedText = code.toUpperCase();
|
|
4450
|
+
if (normalizedText.includes("DENIED") || normalizedText.includes("FORBIDDEN")) {
|
|
4451
|
+
return "forbidden";
|
|
4452
|
+
}
|
|
4453
|
+
if (normalizedText.includes("UNAUTH") || normalizedText.includes("LOGIN")) {
|
|
4454
|
+
return "unauthenticated";
|
|
4455
|
+
}
|
|
4456
|
+
}
|
|
4386
4457
|
if (!status && !normalizedCode) return "network";
|
|
4387
4458
|
return "unknown";
|
|
4388
4459
|
};
|
|
@@ -4438,6 +4509,20 @@ var getRecordValue3 = (value, key) => {
|
|
|
4438
4509
|
if (!value || typeof value !== "object") return void 0;
|
|
4439
4510
|
return value[key];
|
|
4440
4511
|
};
|
|
4512
|
+
var isSuccessCode4 = (code) => {
|
|
4513
|
+
if (code === void 0 || code === null || code === "") return true;
|
|
4514
|
+
const normalized = Number(code);
|
|
4515
|
+
return Number.isFinite(normalized) ? normalized === 0 || normalized >= 200 && normalized < 300 : false;
|
|
4516
|
+
};
|
|
4517
|
+
var isRuntimeEnvelopeFailure = (response, payload) => {
|
|
4518
|
+
const code = getRecordValue3(payload, "code");
|
|
4519
|
+
const success = getRecordValue3(payload, "success");
|
|
4520
|
+
return !response.ok || success === false || !isSuccessCode4(code);
|
|
4521
|
+
};
|
|
4522
|
+
var isServerErrorCode = (code) => {
|
|
4523
|
+
const normalized = Number(code);
|
|
4524
|
+
return Number.isFinite(normalized) && normalized >= 500;
|
|
4525
|
+
};
|
|
4441
4526
|
var getRecordString = (value, key) => {
|
|
4442
4527
|
const result = getRecordValue3(value, key);
|
|
4443
4528
|
return typeof result === "string" ? result : void 0;
|
|
@@ -4460,7 +4545,8 @@ var usePublicAccess = (options = {}) => {
|
|
|
4460
4545
|
appType: runtimeAppType,
|
|
4461
4546
|
servicePrefix: runtimeServicePrefix,
|
|
4462
4547
|
fetchImpl: runtimeFetchImpl,
|
|
4463
|
-
reload: reloadRuntime
|
|
4548
|
+
reload: reloadRuntime,
|
|
4549
|
+
setAccessToken
|
|
4464
4550
|
} = runtime;
|
|
4465
4551
|
const {
|
|
4466
4552
|
appType = runtimeAppType,
|
|
@@ -4494,7 +4580,8 @@ var usePublicAccess = (options = {}) => {
|
|
|
4494
4580
|
path: input.path || stableSessionInput.path || readPathFromLocation()
|
|
4495
4581
|
});
|
|
4496
4582
|
setSession(data);
|
|
4497
|
-
|
|
4583
|
+
setAccessToken(data.accessToken);
|
|
4584
|
+
await reloadRuntime({ accessToken: data.accessToken });
|
|
4498
4585
|
setLoading(false);
|
|
4499
4586
|
return data;
|
|
4500
4587
|
} catch (caught) {
|
|
@@ -4507,7 +4594,7 @@ var usePublicAccess = (options = {}) => {
|
|
|
4507
4594
|
throw nextError;
|
|
4508
4595
|
}
|
|
4509
4596
|
},
|
|
4510
|
-
[client, reloadRuntime, stableSessionInput]
|
|
4597
|
+
[client, reloadRuntime, setAccessToken, stableSessionInput]
|
|
4511
4598
|
);
|
|
4512
4599
|
useEffect5(() => {
|
|
4513
4600
|
if (!autoStart) return;
|
|
@@ -4568,6 +4655,16 @@ var normalizeCssIsolation2 = (value) => {
|
|
|
4568
4655
|
}
|
|
4569
4656
|
return "none";
|
|
4570
4657
|
};
|
|
4658
|
+
var normalizeEnvelopeCode2 = (value, fallback) => {
|
|
4659
|
+
if (value === void 0 || value === null || value === "") return fallback;
|
|
4660
|
+
const normalized = Number(value);
|
|
4661
|
+
return Number.isFinite(normalized) ? normalized : String(value);
|
|
4662
|
+
};
|
|
4663
|
+
var isSuccessCode5 = (value) => {
|
|
4664
|
+
if (value === void 0 || value === null || value === "") return true;
|
|
4665
|
+
const normalized = Number(value);
|
|
4666
|
+
return Number.isFinite(normalized) ? normalized === 0 || normalized >= 200 && normalized < 300 : false;
|
|
4667
|
+
};
|
|
4571
4668
|
var parseJsonResponse = async (response) => {
|
|
4572
4669
|
const payload = await response.json().catch(() => null);
|
|
4573
4670
|
if (!response.ok) {
|
|
@@ -4575,9 +4672,10 @@ var parseJsonResponse = async (response) => {
|
|
|
4575
4672
|
throw new Error(message7 || "\u8BF7\u6C42\u5931\u8D25");
|
|
4576
4673
|
}
|
|
4577
4674
|
if (payload && typeof payload === "object" && "code" in payload) {
|
|
4675
|
+
const code = normalizeEnvelopeCode2(payload.code, response.status);
|
|
4578
4676
|
return {
|
|
4579
|
-
code
|
|
4580
|
-
success: payload.success
|
|
4677
|
+
code,
|
|
4678
|
+
success: payload.success !== false && isSuccessCode5(code),
|
|
4581
4679
|
message: payload.message,
|
|
4582
4680
|
result: payload.result ?? payload.data ?? null,
|
|
4583
4681
|
data: payload.data,
|
|
@@ -4943,6 +5041,11 @@ var joinUrl = (baseUrl, url2) => {
|
|
|
4943
5041
|
if (/^https?:\/\//i.test(url2)) return url2;
|
|
4944
5042
|
return `${trimTrailingSlash2(baseUrl)}${url2.startsWith("/") ? url2 : `/${url2}`}`;
|
|
4945
5043
|
};
|
|
5044
|
+
var isSuccessCode6 = (value) => {
|
|
5045
|
+
if (value === void 0 || value === null || value === "") return true;
|
|
5046
|
+
const code = Number(value);
|
|
5047
|
+
return Number.isFinite(code) ? code === 0 || code >= 200 && code < 300 : false;
|
|
5048
|
+
};
|
|
4946
5049
|
var normalizeRuntimeFileUrl = (baseUrl, value) => {
|
|
4947
5050
|
if (typeof value !== "string" || !value) return value;
|
|
4948
5051
|
if (/^(https?:)?\/\//i.test(value) || /^(blob|data):/i.test(value)) return value;
|
|
@@ -4969,6 +5072,12 @@ var parseResponse = async (response) => {
|
|
|
4969
5072
|
const message7 = typeof payload === "object" && payload ? payload.message || payload.error || response.statusText : response.statusText;
|
|
4970
5073
|
throw new Error(message7 || "\u8BF7\u6C42\u5931\u8D25");
|
|
4971
5074
|
}
|
|
5075
|
+
if (typeof payload === "object" && payload) {
|
|
5076
|
+
const hasCode = Object.prototype.hasOwnProperty.call(payload, "code");
|
|
5077
|
+
if (payload.success === false || hasCode && !isSuccessCode6(payload.code)) {
|
|
5078
|
+
throw new Error(payload.message || payload.error || "\u8BF7\u6C42\u5931\u8D25");
|
|
5079
|
+
}
|
|
5080
|
+
}
|
|
4972
5081
|
if (typeof payload === "object" && payload) {
|
|
4973
5082
|
return payload;
|
|
4974
5083
|
}
|
|
@@ -43399,20 +43508,20 @@ async function validateAndNotify(validateAllWithErrors) {
|
|
|
43399
43508
|
import { useState as useState79, useEffect as useEffect91, useCallback as useCallback27, useRef as useRef87 } from "react";
|
|
43400
43509
|
|
|
43401
43510
|
// packages/sdk/src/components/core/processApi.ts
|
|
43402
|
-
var
|
|
43403
|
-
var isRuntimeEnvelope = (value) => !!value && typeof value === "object" && !Array.isArray(value) && (
|
|
43404
|
-
var
|
|
43511
|
+
var hasOwn2 = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
|
|
43512
|
+
var isRuntimeEnvelope = (value) => !!value && typeof value === "object" && !Array.isArray(value) && (hasOwn2(value, "code") || hasOwn2(value, "success") || hasOwn2(value, "data") || hasOwn2(value, "result") || hasOwn2(value, "message") || hasOwn2(value, "error"));
|
|
43513
|
+
var isSuccessCode7 = (code) => {
|
|
43405
43514
|
if (code === void 0 || code === null || code === "") return true;
|
|
43406
43515
|
const normalized = Number(code);
|
|
43407
43516
|
return Number.isFinite(normalized) ? normalized === 0 || normalized === 200 : false;
|
|
43408
43517
|
};
|
|
43409
43518
|
var unwrapRuntimeResponse = (response) => {
|
|
43410
43519
|
if (!isRuntimeEnvelope(response)) return response;
|
|
43411
|
-
if (response.success === false || !
|
|
43520
|
+
if (response.success === false || !isSuccessCode7(response.code)) {
|
|
43412
43521
|
throw new Error(response.message || response.error || "\u8BF7\u6C42\u5931\u8D25");
|
|
43413
43522
|
}
|
|
43414
|
-
if (
|
|
43415
|
-
if (
|
|
43523
|
+
if (hasOwn2(response, "data")) return response.data;
|
|
43524
|
+
if (hasOwn2(response, "result")) return response.result;
|
|
43416
43525
|
return response;
|
|
43417
43526
|
};
|
|
43418
43527
|
var withInitiatorSelectedApprovers = (payload, initiatorSelectedApprovers) => {
|