@fctc/interface-logic 1.7.2 → 1.7.3
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/{configs.d.cts → configs.d.mts} +1 -1
- package/dist/configs.js +140 -115
- package/dist/{configs.cjs → configs.mjs} +105 -152
- package/dist/constants.js +41 -2
- package/dist/{constants.cjs → constants.mjs} +2 -40
- package/dist/environment.js +190 -170
- package/dist/{environment.cjs → environment.mjs} +156 -210
- package/dist/{hooks.d.cts → hooks.d.mts} +1 -1
- package/dist/hooks.js +1730 -1792
- package/dist/{hooks.cjs → hooks.mjs} +1631 -1897
- package/dist/{provider.d.cts → provider.d.mts} +1 -1
- package/dist/provider.d.ts +1 -1
- package/dist/provider.js +594 -610
- package/dist/{provider.cjs → provider.mjs} +560 -650
- package/dist/{services.d.cts → services.d.mts} +1 -1
- package/dist/services.js +1439 -1562
- package/dist/{services.cjs → services.mjs} +1399 -1608
- package/dist/{store.d.cts → store.d.mts} +127 -127
- package/dist/store.d.ts +127 -127
- package/dist/store.js +129 -41
- package/dist/{store.cjs → store.mjs} +28 -146
- package/dist/{types.d.cts → types.d.mts} +1 -1
- package/dist/types.js +18 -0
- package/dist/types.mjs +0 -0
- package/dist/{utils.d.cts → utils.d.mts} +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +176 -135
- package/dist/{utils.cjs → utils.mjs} +115 -202
- package/package.json +1 -2
- package/dist/types.cjs +0 -17
- /package/dist/{constants.d.cts → constants.d.mts} +0 -0
- /package/dist/{environment.d.cts → environment.d.mts} +0 -0
- /package/dist/{view-type-BGJfDe73.d.cts → view-type-BGJfDe73.d.mts} +0 -0
package/dist/configs.js
CHANGED
|
@@ -1,30 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
20
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
21
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/configs.ts
|
|
31
|
+
var configs_exports = {};
|
|
32
|
+
__export(configs_exports, {
|
|
33
|
+
axiosClient: () => axiosClient
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(configs_exports);
|
|
22
36
|
|
|
23
37
|
// src/configs/axios-client.ts
|
|
24
|
-
|
|
38
|
+
var import_axios = __toESM(require("axios"));
|
|
25
39
|
|
|
26
40
|
// src/utils/format.ts
|
|
27
|
-
|
|
41
|
+
var import_moment = __toESM(require("moment"));
|
|
28
42
|
|
|
29
43
|
// src/utils/domain/py_tokenizer.ts
|
|
30
44
|
var TokenizerError = class extends Error {
|
|
@@ -1104,6 +1118,22 @@ var PyRelativeDelta = class _PyRelativeDelta {
|
|
|
1104
1118
|
this.microsecond = params.microsecond;
|
|
1105
1119
|
this.weekday = params.weekday;
|
|
1106
1120
|
}
|
|
1121
|
+
years;
|
|
1122
|
+
months;
|
|
1123
|
+
days;
|
|
1124
|
+
hours;
|
|
1125
|
+
minutes;
|
|
1126
|
+
seconds;
|
|
1127
|
+
microseconds;
|
|
1128
|
+
leapDays;
|
|
1129
|
+
year;
|
|
1130
|
+
month;
|
|
1131
|
+
day;
|
|
1132
|
+
hour;
|
|
1133
|
+
minute;
|
|
1134
|
+
second;
|
|
1135
|
+
microsecond;
|
|
1136
|
+
weekday;
|
|
1107
1137
|
negate() {
|
|
1108
1138
|
return new _PyRelativeDelta(this, -1);
|
|
1109
1139
|
}
|
|
@@ -1218,7 +1248,7 @@ function execOnIterable(iterable, func) {
|
|
|
1218
1248
|
if (typeof iterable === "object" && !Array.isArray(iterable) && !(iterable instanceof Set)) {
|
|
1219
1249
|
iterable = Object.keys(iterable);
|
|
1220
1250
|
}
|
|
1221
|
-
if (typeof
|
|
1251
|
+
if (typeof iterable?.[Symbol.iterator] !== "function") {
|
|
1222
1252
|
throw new EvaluationError("value not iterable");
|
|
1223
1253
|
}
|
|
1224
1254
|
return func(iterable);
|
|
@@ -1541,7 +1571,7 @@ function applyBinaryOp(ast, context) {
|
|
|
1541
1571
|
}
|
|
1542
1572
|
return Math.floor(left / right);
|
|
1543
1573
|
case "**":
|
|
1544
|
-
return
|
|
1574
|
+
return left ** right;
|
|
1545
1575
|
case "==":
|
|
1546
1576
|
return isEqual(left, right);
|
|
1547
1577
|
case "<>":
|
|
@@ -1663,7 +1693,7 @@ function evaluate(ast, context = {}) {
|
|
|
1663
1693
|
const dicts = /* @__PURE__ */ new Set();
|
|
1664
1694
|
let pyContext;
|
|
1665
1695
|
const evalContext = Object.create(context);
|
|
1666
|
-
if (!
|
|
1696
|
+
if (!evalContext?.context) {
|
|
1667
1697
|
Object.defineProperty(evalContext, "context", {
|
|
1668
1698
|
get() {
|
|
1669
1699
|
if (!pyContext) {
|
|
@@ -1674,18 +1704,17 @@ function evaluate(ast, context = {}) {
|
|
|
1674
1704
|
});
|
|
1675
1705
|
}
|
|
1676
1706
|
function _innerEvaluate(ast2) {
|
|
1677
|
-
|
|
1678
|
-
switch (ast2 == null ? void 0 : ast2.type) {
|
|
1707
|
+
switch (ast2?.type) {
|
|
1679
1708
|
case 0:
|
|
1680
1709
|
// Number
|
|
1681
1710
|
case 1:
|
|
1682
1711
|
return ast2.value;
|
|
1683
1712
|
case 5:
|
|
1684
1713
|
if (ast2.value in evalContext) {
|
|
1685
|
-
if (typeof evalContext[ast2.value] === "object" &&
|
|
1686
|
-
return
|
|
1714
|
+
if (typeof evalContext[ast2.value] === "object" && evalContext[ast2.value]?.id) {
|
|
1715
|
+
return evalContext[ast2.value]?.id;
|
|
1687
1716
|
}
|
|
1688
|
-
return
|
|
1717
|
+
return evalContext[ast2.value] ?? false;
|
|
1689
1718
|
} else if (ast2.value in BUILTINS) {
|
|
1690
1719
|
return BUILTINS[ast2.value];
|
|
1691
1720
|
} else {
|
|
@@ -1722,7 +1751,7 @@ function evaluate(ast, context = {}) {
|
|
|
1722
1751
|
const args = ast2.args.map(_evaluate);
|
|
1723
1752
|
const kwargs = {};
|
|
1724
1753
|
for (const kwarg in ast2.kwargs) {
|
|
1725
|
-
kwargs[kwarg] = _evaluate(ast2
|
|
1754
|
+
kwargs[kwarg] = _evaluate(ast2?.kwargs[kwarg]);
|
|
1726
1755
|
}
|
|
1727
1756
|
if (fnValue === PyDate || fnValue === PyDateTime || fnValue === PyTime || fnValue === PyRelativeDelta || fnValue === PyTimeDelta) {
|
|
1728
1757
|
return fnValue.create(...args, kwargs);
|
|
@@ -1801,25 +1830,9 @@ function escapeRegExp(str) {
|
|
|
1801
1830
|
var InvalidDomainError = class extends Error {
|
|
1802
1831
|
};
|
|
1803
1832
|
var Domain = class _Domain {
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
return new _Domain(descr.toString());
|
|
1808
|
-
} else {
|
|
1809
|
-
let rawAST;
|
|
1810
|
-
try {
|
|
1811
|
-
rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
|
|
1812
|
-
} catch (error) {
|
|
1813
|
-
throw new InvalidDomainError(
|
|
1814
|
-
`Invalid domain representation: ${descr}`,
|
|
1815
|
-
{
|
|
1816
|
-
cause: error
|
|
1817
|
-
}
|
|
1818
|
-
);
|
|
1819
|
-
}
|
|
1820
|
-
this.ast = normalizeDomainAST(rawAST);
|
|
1821
|
-
}
|
|
1822
|
-
}
|
|
1833
|
+
ast = { type: -1, value: null };
|
|
1834
|
+
static TRUE;
|
|
1835
|
+
static FALSE;
|
|
1823
1836
|
static combine(domains, operator) {
|
|
1824
1837
|
if (domains.length === 0) {
|
|
1825
1838
|
return new _Domain([]);
|
|
@@ -1898,6 +1911,24 @@ var Domain = class _Domain {
|
|
|
1898
1911
|
processLeaf(d.ast.value, 0, "&", newDomain);
|
|
1899
1912
|
return newDomain;
|
|
1900
1913
|
}
|
|
1914
|
+
constructor(descr = []) {
|
|
1915
|
+
if (descr instanceof _Domain) {
|
|
1916
|
+
return new _Domain(descr.toString());
|
|
1917
|
+
} else {
|
|
1918
|
+
let rawAST;
|
|
1919
|
+
try {
|
|
1920
|
+
rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
|
|
1921
|
+
} catch (error) {
|
|
1922
|
+
throw new InvalidDomainError(
|
|
1923
|
+
`Invalid domain representation: ${descr}`,
|
|
1924
|
+
{
|
|
1925
|
+
cause: error
|
|
1926
|
+
}
|
|
1927
|
+
);
|
|
1928
|
+
}
|
|
1929
|
+
this.ast = normalizeDomainAST(rawAST);
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1901
1932
|
contains(record) {
|
|
1902
1933
|
const expr = evaluate(this.ast, record);
|
|
1903
1934
|
return matchDomain(record, expr);
|
|
@@ -1916,7 +1947,7 @@ var Domain = class _Domain {
|
|
|
1916
1947
|
return evaluatedAsList;
|
|
1917
1948
|
}
|
|
1918
1949
|
return this.toString();
|
|
1919
|
-
} catch
|
|
1950
|
+
} catch {
|
|
1920
1951
|
return this.toString();
|
|
1921
1952
|
}
|
|
1922
1953
|
}
|
|
@@ -2116,7 +2147,7 @@ function matchDomain(record, domain) {
|
|
|
2116
2147
|
}
|
|
2117
2148
|
|
|
2118
2149
|
// src/utils/function.ts
|
|
2119
|
-
|
|
2150
|
+
var import_react = require("react");
|
|
2120
2151
|
var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
|
2121
2152
|
if (!originalRequest.data) return originalRequest.data;
|
|
2122
2153
|
if (typeof originalRequest.data === "string") {
|
|
@@ -2139,22 +2170,22 @@ var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
|
|
2139
2170
|
|
|
2140
2171
|
// src/utils/storage/local-storage.ts
|
|
2141
2172
|
var localStorageUtils = () => {
|
|
2142
|
-
const setToken = (access_token) =>
|
|
2173
|
+
const setToken = async (access_token) => {
|
|
2143
2174
|
localStorage.setItem("accessToken", access_token);
|
|
2144
|
-
}
|
|
2145
|
-
const setRefreshToken = (refresh_token) =>
|
|
2175
|
+
};
|
|
2176
|
+
const setRefreshToken = async (refresh_token) => {
|
|
2146
2177
|
localStorage.setItem("refreshToken", refresh_token);
|
|
2147
|
-
}
|
|
2148
|
-
const getAccessToken = () =>
|
|
2178
|
+
};
|
|
2179
|
+
const getAccessToken = async () => {
|
|
2149
2180
|
return localStorage.getItem("accessToken");
|
|
2150
|
-
}
|
|
2151
|
-
const getRefreshToken = () =>
|
|
2181
|
+
};
|
|
2182
|
+
const getRefreshToken = async () => {
|
|
2152
2183
|
return localStorage.getItem("refreshToken");
|
|
2153
|
-
}
|
|
2154
|
-
const clearToken = () =>
|
|
2184
|
+
};
|
|
2185
|
+
const clearToken = async () => {
|
|
2155
2186
|
localStorage.removeItem("accessToken");
|
|
2156
2187
|
localStorage.removeItem("refreshToken");
|
|
2157
|
-
}
|
|
2188
|
+
};
|
|
2158
2189
|
return {
|
|
2159
2190
|
setToken,
|
|
2160
2191
|
setRefreshToken,
|
|
@@ -2166,9 +2197,9 @@ var localStorageUtils = () => {
|
|
|
2166
2197
|
|
|
2167
2198
|
// src/utils/storage/session-storage.ts
|
|
2168
2199
|
var sessionStorageUtils = () => {
|
|
2169
|
-
const getBrowserSession = () =>
|
|
2200
|
+
const getBrowserSession = async () => {
|
|
2170
2201
|
return sessionStorage.getItem("browserSession");
|
|
2171
|
-
}
|
|
2202
|
+
};
|
|
2172
2203
|
return {
|
|
2173
2204
|
getBrowserSession
|
|
2174
2205
|
};
|
|
@@ -2177,14 +2208,13 @@ var sessionStorageUtils = () => {
|
|
|
2177
2208
|
// src/configs/axios-client.ts
|
|
2178
2209
|
var axiosClient = {
|
|
2179
2210
|
init(config) {
|
|
2180
|
-
|
|
2181
|
-
const
|
|
2182
|
-
const sessionStorage2 = (_b = config.sessionStorageUtils) != null ? _b : sessionStorageUtils();
|
|
2211
|
+
const localStorage2 = config.localStorageUtils ?? localStorageUtils();
|
|
2212
|
+
const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
|
|
2183
2213
|
const db = config.db;
|
|
2184
2214
|
let isRefreshing = false;
|
|
2185
2215
|
let failedQueue = [];
|
|
2186
2216
|
const processQueue = (error, token = null) => {
|
|
2187
|
-
failedQueue
|
|
2217
|
+
failedQueue?.forEach((prom) => {
|
|
2188
2218
|
if (error) {
|
|
2189
2219
|
prom.reject(error);
|
|
2190
2220
|
} else {
|
|
@@ -2193,21 +2223,21 @@ var axiosClient = {
|
|
|
2193
2223
|
});
|
|
2194
2224
|
failedQueue = [];
|
|
2195
2225
|
};
|
|
2196
|
-
const instance =
|
|
2197
|
-
adapter:
|
|
2226
|
+
const instance = import_axios.default.create({
|
|
2227
|
+
adapter: import_axios.default.defaults.adapter,
|
|
2198
2228
|
baseURL: config.baseUrl,
|
|
2199
2229
|
timeout: 5e4,
|
|
2200
2230
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2201
2231
|
});
|
|
2202
2232
|
instance.interceptors.request.use(
|
|
2203
|
-
(config2) =>
|
|
2233
|
+
async (config2) => {
|
|
2204
2234
|
const useRefreshToken = config2.useRefreshToken;
|
|
2205
|
-
const token = useRefreshToken ?
|
|
2235
|
+
const token = useRefreshToken ? await localStorage2.getRefreshToken() : await localStorage2.getAccessToken();
|
|
2206
2236
|
if (token) {
|
|
2207
2237
|
config2.headers["Authorization"] = "Bearer " + token;
|
|
2208
2238
|
}
|
|
2209
2239
|
return config2;
|
|
2210
|
-
}
|
|
2240
|
+
},
|
|
2211
2241
|
(error) => {
|
|
2212
2242
|
Promise.reject(error);
|
|
2213
2243
|
}
|
|
@@ -2216,21 +2246,19 @@ var axiosClient = {
|
|
|
2216
2246
|
(response) => {
|
|
2217
2247
|
return handleResponse(response);
|
|
2218
2248
|
},
|
|
2219
|
-
(error) =>
|
|
2220
|
-
|
|
2221
|
-
const handleError3 = (error2) => __async(null, null, function* () {
|
|
2222
|
-
var _a3;
|
|
2249
|
+
async (error) => {
|
|
2250
|
+
const handleError3 = async (error2) => {
|
|
2223
2251
|
if (!error2.response) {
|
|
2224
2252
|
return error2;
|
|
2225
2253
|
}
|
|
2226
2254
|
const { data } = error2.response;
|
|
2227
|
-
if (data && data.code === 400 && ["invalid_grant"].includes(
|
|
2228
|
-
|
|
2255
|
+
if (data && data.code === 400 && ["invalid_grant"].includes(data.data?.error)) {
|
|
2256
|
+
await clearAuthToken();
|
|
2229
2257
|
}
|
|
2230
2258
|
return data;
|
|
2231
|
-
}
|
|
2259
|
+
};
|
|
2232
2260
|
const originalRequest = error.config;
|
|
2233
|
-
if ((
|
|
2261
|
+
if ((error.response?.status === 403 || error.response?.status === 401 || error.response?.status === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401, "ERR_2FA_006"].includes(
|
|
2234
2262
|
error.response.data.code
|
|
2235
2263
|
)) {
|
|
2236
2264
|
if (isRefreshing) {
|
|
@@ -2243,19 +2271,18 @@ var axiosClient = {
|
|
|
2243
2271
|
token
|
|
2244
2272
|
);
|
|
2245
2273
|
return instance.request(originalRequest);
|
|
2246
|
-
}).catch((err) =>
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
yield clearAuthToken();
|
|
2274
|
+
}).catch(async (err) => {
|
|
2275
|
+
if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
|
|
2276
|
+
await clearAuthToken();
|
|
2250
2277
|
}
|
|
2251
|
-
})
|
|
2278
|
+
});
|
|
2252
2279
|
}
|
|
2253
|
-
const browserSession =
|
|
2254
|
-
const refreshToken =
|
|
2255
|
-
const accessTokenExp =
|
|
2280
|
+
const browserSession = await sessionStorage2.getBrowserSession();
|
|
2281
|
+
const refreshToken = await localStorage2.getRefreshToken();
|
|
2282
|
+
const accessTokenExp = await localStorage2.getAccessToken();
|
|
2256
2283
|
isRefreshing = true;
|
|
2257
2284
|
if (!refreshToken && (!browserSession || browserSession == "unActive")) {
|
|
2258
|
-
|
|
2285
|
+
await clearAuthToken();
|
|
2259
2286
|
} else {
|
|
2260
2287
|
const payload = Object.fromEntries(
|
|
2261
2288
|
Object.entries({
|
|
@@ -2266,9 +2293,8 @@ var axiosClient = {
|
|
|
2266
2293
|
}).filter(([_, value]) => !!value)
|
|
2267
2294
|
);
|
|
2268
2295
|
return new Promise(function(resolve) {
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
`${config.baseUrl}${(_a3 = config.refreshTokenEndpoint) != null ? _a3 : "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
|
|
2296
|
+
import_axios.default.post(
|
|
2297
|
+
`${config.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
|
|
2272
2298
|
payload,
|
|
2273
2299
|
{
|
|
2274
2300
|
headers: {
|
|
@@ -2276,11 +2302,11 @@ var axiosClient = {
|
|
|
2276
2302
|
Authorization: `Bearer ${accessTokenExp}`
|
|
2277
2303
|
}
|
|
2278
2304
|
}
|
|
2279
|
-
).then((res) =>
|
|
2305
|
+
).then(async (res) => {
|
|
2280
2306
|
const data = res.data;
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2307
|
+
await localStorage2.setToken(data.access_token);
|
|
2308
|
+
await localStorage2.setRefreshToken(data.refresh_token);
|
|
2309
|
+
import_axios.default.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
|
|
2284
2310
|
originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
|
|
2285
2311
|
originalRequest.data = updateTokenParamInOriginalRequest(
|
|
2286
2312
|
originalRequest,
|
|
@@ -2288,26 +2314,25 @@ var axiosClient = {
|
|
|
2288
2314
|
);
|
|
2289
2315
|
processQueue(null, data.access_token);
|
|
2290
2316
|
resolve(instance.request(originalRequest));
|
|
2291
|
-
})
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
yield clearAuthToken();
|
|
2317
|
+
}).catch(async (err) => {
|
|
2318
|
+
if (err && (err?.error_code === "AUTHEN_FAIL" || err?.error_code === "TOKEN_EXPIRED" || err?.error_code === "TOKEN_INCORRECT" || err?.code === "ERR_BAD_REQUEST") || err?.error_code === "ERR_2FA_006") {
|
|
2319
|
+
await clearAuthToken();
|
|
2295
2320
|
}
|
|
2296
2321
|
if (err && err.response) {
|
|
2297
|
-
const { error_code } =
|
|
2322
|
+
const { error_code } = err.response?.data || {};
|
|
2298
2323
|
if (error_code === "AUTHEN_FAIL") {
|
|
2299
|
-
|
|
2324
|
+
await clearAuthToken();
|
|
2300
2325
|
}
|
|
2301
2326
|
}
|
|
2302
2327
|
processQueue(err, null);
|
|
2303
|
-
})
|
|
2328
|
+
}).finally(() => {
|
|
2304
2329
|
isRefreshing = false;
|
|
2305
2330
|
});
|
|
2306
2331
|
});
|
|
2307
2332
|
}
|
|
2308
2333
|
}
|
|
2309
|
-
return Promise.reject(
|
|
2310
|
-
}
|
|
2334
|
+
return Promise.reject(await handleError3(error));
|
|
2335
|
+
}
|
|
2311
2336
|
);
|
|
2312
2337
|
const handleResponse = (res) => {
|
|
2313
2338
|
if (res && res.data) {
|
|
@@ -2316,7 +2341,6 @@ var axiosClient = {
|
|
|
2316
2341
|
return res;
|
|
2317
2342
|
};
|
|
2318
2343
|
const handleError2 = (error) => {
|
|
2319
|
-
var _a2, _b2, _c;
|
|
2320
2344
|
if (error.isAxiosError && error.code === "ECONNABORTED") {
|
|
2321
2345
|
console.error("Request Timeout Error:", error);
|
|
2322
2346
|
return "Request Timeout Error";
|
|
@@ -2324,17 +2348,17 @@ var axiosClient = {
|
|
|
2324
2348
|
console.error("Network Error:", error);
|
|
2325
2349
|
return "Network Error";
|
|
2326
2350
|
} else {
|
|
2327
|
-
console.error("Other Error:", error
|
|
2328
|
-
const errorMessage =
|
|
2329
|
-
return { message: errorMessage, status:
|
|
2351
|
+
console.error("Other Error:", error?.response);
|
|
2352
|
+
const errorMessage = error?.response?.data?.message || "An error occurred";
|
|
2353
|
+
return { message: errorMessage, status: error?.response?.status };
|
|
2330
2354
|
}
|
|
2331
2355
|
};
|
|
2332
|
-
const clearAuthToken = () =>
|
|
2333
|
-
|
|
2356
|
+
const clearAuthToken = async () => {
|
|
2357
|
+
await localStorage2.clearToken();
|
|
2334
2358
|
if (typeof window !== "undefined") {
|
|
2335
2359
|
window.location.href = `/login`;
|
|
2336
2360
|
}
|
|
2337
|
-
}
|
|
2361
|
+
};
|
|
2338
2362
|
function formatUrl(url, db2) {
|
|
2339
2363
|
return url + (db2 ? "?db=" + db2 : "");
|
|
2340
2364
|
}
|
|
@@ -2356,6 +2380,7 @@ var axiosClient = {
|
|
|
2356
2380
|
return requests;
|
|
2357
2381
|
}
|
|
2358
2382
|
};
|
|
2359
|
-
export
|
|
2383
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2384
|
+
0 && (module.exports = {
|
|
2360
2385
|
axiosClient
|
|
2361
|
-
};
|
|
2386
|
+
});
|