@ikenxuan/amagi 5.11.0 → 5.11.1
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/dist/default/index.cjs
CHANGED
|
@@ -1233,9 +1233,12 @@ const fetchResponse = async (config, maxRetries = DEFAULT_MAX_RETRIES) => {
|
|
|
1233
1233
|
* 判断结果是否为网络错误响应
|
|
1234
1234
|
* @param result - 请求结果
|
|
1235
1235
|
* @returns 是否为ErrorResult
|
|
1236
|
+
* @description 通过检查 error 字段中的 amagiError 来区分网络错误和业务错误
|
|
1236
1237
|
*/
|
|
1237
1238
|
const isNetworkErrorResult = (result) => {
|
|
1238
|
-
|
|
1239
|
+
if (result === null || typeof result !== "object") return false;
|
|
1240
|
+
const obj = result;
|
|
1241
|
+
return obj.success === false && obj.error !== null && typeof obj.error === "object" && "amagiError" in obj.error;
|
|
1239
1242
|
};
|
|
1240
1243
|
/**
|
|
1241
1244
|
* 获取响应头和数据(带自动重试)
|
|
@@ -5110,7 +5113,7 @@ let DynamicType = /* @__PURE__ */ function(DynamicType$1) {
|
|
|
5110
5113
|
|
|
5111
5114
|
//#endregion
|
|
5112
5115
|
//#region src/index.ts
|
|
5113
|
-
const VERSION = "5.11.
|
|
5116
|
+
const VERSION = "5.11.1";
|
|
5114
5117
|
/**
|
|
5115
5118
|
* @deprecated 请使用 createAmagiClient 替代
|
|
5116
5119
|
*/
|
package/dist/default/index.d.cts
CHANGED
|
@@ -23319,6 +23319,7 @@ declare const fetchResponse: <T$1 = unknown>(config: AxiosRequestConfig, maxRetr
|
|
|
23319
23319
|
* 判断结果是否为网络错误响应
|
|
23320
23320
|
* @param result - 请求结果
|
|
23321
23321
|
* @returns 是否为ErrorResult
|
|
23322
|
+
* @description 通过检查 error 字段中的 amagiError 来区分网络错误和业务错误
|
|
23322
23323
|
*/
|
|
23323
23324
|
declare const isNetworkErrorResult: (result: unknown) => result is ErrorResult;
|
|
23324
23325
|
/**
|
package/dist/default/index.d.ts
CHANGED
|
@@ -23319,6 +23319,7 @@ declare const fetchResponse: <T$1 = unknown>(config: AxiosRequestConfig, maxRetr
|
|
|
23319
23319
|
* 判断结果是否为网络错误响应
|
|
23320
23320
|
* @param result - 请求结果
|
|
23321
23321
|
* @returns 是否为ErrorResult
|
|
23322
|
+
* @description 通过检查 error 字段中的 amagiError 来区分网络错误和业务错误
|
|
23322
23323
|
*/
|
|
23323
23324
|
declare const isNetworkErrorResult: (result: unknown) => result is ErrorResult;
|
|
23324
23325
|
/**
|
package/dist/default/index.js
CHANGED
|
@@ -1223,9 +1223,12 @@ const fetchResponse = async (config, maxRetries = DEFAULT_MAX_RETRIES) => {
|
|
|
1223
1223
|
* 判断结果是否为网络错误响应
|
|
1224
1224
|
* @param result - 请求结果
|
|
1225
1225
|
* @returns 是否为ErrorResult
|
|
1226
|
+
* @description 通过检查 error 字段中的 amagiError 来区分网络错误和业务错误
|
|
1226
1227
|
*/
|
|
1227
1228
|
const isNetworkErrorResult = (result) => {
|
|
1228
|
-
|
|
1229
|
+
if (result === null || typeof result !== "object") return false;
|
|
1230
|
+
const obj = result;
|
|
1231
|
+
return obj.success === false && obj.error !== null && typeof obj.error === "object" && "amagiError" in obj.error;
|
|
1229
1232
|
};
|
|
1230
1233
|
/**
|
|
1231
1234
|
* 获取响应头和数据(带自动重试)
|
|
@@ -5100,7 +5103,7 @@ let DynamicType = /* @__PURE__ */ function(DynamicType$1) {
|
|
|
5100
5103
|
|
|
5101
5104
|
//#endregion
|
|
5102
5105
|
//#region src/index.ts
|
|
5103
|
-
const VERSION = "5.11.
|
|
5106
|
+
const VERSION = "5.11.1";
|
|
5104
5107
|
/**
|
|
5105
5108
|
* @deprecated 请使用 createAmagiClient 替代
|
|
5106
5109
|
*/
|