@fctc/interface-logic 1.7.1 → 1.7.2
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.mjs → configs.cjs} +161 -111
- package/dist/{configs.d.mts → configs.d.cts} +2 -1
- package/dist/configs.d.ts +1 -0
- package/dist/configs.js +124 -146
- package/dist/{constants.mjs → constants.cjs} +40 -2
- package/dist/constants.js +2 -41
- package/dist/{environment.mjs → environment.cjs} +2029 -1967
- package/dist/environment.d.cts +56 -0
- package/dist/environment.d.ts +24 -6
- package/dist/environment.js +2235 -2248
- package/dist/{hooks.mjs → hooks.cjs} +4021 -3773
- package/dist/{hooks.d.mts → hooks.d.cts} +2 -7
- package/dist/hooks.d.ts +1 -6
- package/dist/hooks.js +3916 -3873
- package/dist/{provider.mjs → provider.cjs} +688 -586
- package/dist/{provider.d.mts → provider.d.cts} +1 -1
- package/dist/provider.d.ts +1 -1
- package/dist/provider.js +648 -620
- package/dist/{services.mjs → services.cjs} +4186 -3980
- package/dist/{services.d.mts → services.d.cts} +1 -2
- package/dist/services.d.ts +0 -1
- package/dist/services.js +4141 -4021
- package/dist/{store.mjs → store.cjs} +149 -33
- package/dist/{store.d.mts → store.d.cts} +127 -155
- package/dist/store.d.ts +127 -155
- package/dist/store.js +44 -134
- package/dist/types.cjs +17 -0
- package/dist/{types.d.mts → types.d.cts} +1 -1
- package/dist/types.js +0 -18
- package/dist/{utils.mjs → utils.cjs} +202 -115
- package/dist/{utils.d.mts → utils.d.cts} +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +135 -176
- package/package.json +82 -81
- package/dist/environment.d.mts +0 -38
- package/dist/types.mjs +0 -0
- /package/dist/{constants.d.mts → constants.d.cts} +0 -0
- /package/dist/{view-type-BGJfDe73.d.mts → view-type-BGJfDe73.d.cts} +0 -0
package/dist/configs.js
CHANGED
|
@@ -1,44 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
var __pow = Math.pow;
|
|
2
|
+
var __async = (__this, __arguments, generator) => {
|
|
3
|
+
return new Promise((resolve, reject) => {
|
|
4
|
+
var fulfilled = (value) => {
|
|
5
|
+
try {
|
|
6
|
+
step(generator.next(value));
|
|
7
|
+
} catch (e) {
|
|
8
|
+
reject(e);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
var rejected = (value) => {
|
|
12
|
+
try {
|
|
13
|
+
step(generator.throw(value));
|
|
14
|
+
} catch (e) {
|
|
15
|
+
reject(e);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
19
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
20
|
+
});
|
|
19
21
|
};
|
|
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);
|
|
36
22
|
|
|
37
23
|
// src/configs/axios-client.ts
|
|
38
|
-
|
|
24
|
+
import axios from "axios";
|
|
39
25
|
|
|
40
26
|
// src/utils/format.ts
|
|
41
|
-
|
|
27
|
+
import moment from "moment";
|
|
42
28
|
|
|
43
29
|
// src/utils/domain/py_tokenizer.ts
|
|
44
30
|
var TokenizerError = class extends Error {
|
|
@@ -1118,22 +1104,6 @@ var PyRelativeDelta = class _PyRelativeDelta {
|
|
|
1118
1104
|
this.microsecond = params.microsecond;
|
|
1119
1105
|
this.weekday = params.weekday;
|
|
1120
1106
|
}
|
|
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;
|
|
1137
1107
|
negate() {
|
|
1138
1108
|
return new _PyRelativeDelta(this, -1);
|
|
1139
1109
|
}
|
|
@@ -1248,7 +1218,7 @@ function execOnIterable(iterable, func) {
|
|
|
1248
1218
|
if (typeof iterable === "object" && !Array.isArray(iterable) && !(iterable instanceof Set)) {
|
|
1249
1219
|
iterable = Object.keys(iterable);
|
|
1250
1220
|
}
|
|
1251
|
-
if (typeof iterable
|
|
1221
|
+
if (typeof (iterable == null ? void 0 : iterable[Symbol.iterator]) !== "function") {
|
|
1252
1222
|
throw new EvaluationError("value not iterable");
|
|
1253
1223
|
}
|
|
1254
1224
|
return func(iterable);
|
|
@@ -1571,7 +1541,7 @@ function applyBinaryOp(ast, context) {
|
|
|
1571
1541
|
}
|
|
1572
1542
|
return Math.floor(left / right);
|
|
1573
1543
|
case "**":
|
|
1574
|
-
return left
|
|
1544
|
+
return __pow(left, right);
|
|
1575
1545
|
case "==":
|
|
1576
1546
|
return isEqual(left, right);
|
|
1577
1547
|
case "<>":
|
|
@@ -1693,7 +1663,7 @@ function evaluate(ast, context = {}) {
|
|
|
1693
1663
|
const dicts = /* @__PURE__ */ new Set();
|
|
1694
1664
|
let pyContext;
|
|
1695
1665
|
const evalContext = Object.create(context);
|
|
1696
|
-
if (!evalContext
|
|
1666
|
+
if (!(evalContext == null ? void 0 : evalContext.context)) {
|
|
1697
1667
|
Object.defineProperty(evalContext, "context", {
|
|
1698
1668
|
get() {
|
|
1699
1669
|
if (!pyContext) {
|
|
@@ -1704,17 +1674,18 @@ function evaluate(ast, context = {}) {
|
|
|
1704
1674
|
});
|
|
1705
1675
|
}
|
|
1706
1676
|
function _innerEvaluate(ast2) {
|
|
1707
|
-
|
|
1677
|
+
var _a, _b, _c;
|
|
1678
|
+
switch (ast2 == null ? void 0 : ast2.type) {
|
|
1708
1679
|
case 0:
|
|
1709
1680
|
// Number
|
|
1710
1681
|
case 1:
|
|
1711
1682
|
return ast2.value;
|
|
1712
1683
|
case 5:
|
|
1713
1684
|
if (ast2.value in evalContext) {
|
|
1714
|
-
if (typeof evalContext[ast2.value] === "object" && evalContext[ast2.value]
|
|
1715
|
-
return evalContext[ast2.value]
|
|
1685
|
+
if (typeof evalContext[ast2.value] === "object" && ((_a = evalContext[ast2.value]) == null ? void 0 : _a.id)) {
|
|
1686
|
+
return (_b = evalContext[ast2.value]) == null ? void 0 : _b.id;
|
|
1716
1687
|
}
|
|
1717
|
-
return evalContext[ast2.value]
|
|
1688
|
+
return (_c = evalContext[ast2.value]) != null ? _c : false;
|
|
1718
1689
|
} else if (ast2.value in BUILTINS) {
|
|
1719
1690
|
return BUILTINS[ast2.value];
|
|
1720
1691
|
} else {
|
|
@@ -1751,7 +1722,7 @@ function evaluate(ast, context = {}) {
|
|
|
1751
1722
|
const args = ast2.args.map(_evaluate);
|
|
1752
1723
|
const kwargs = {};
|
|
1753
1724
|
for (const kwarg in ast2.kwargs) {
|
|
1754
|
-
kwargs[kwarg] = _evaluate(ast2
|
|
1725
|
+
kwargs[kwarg] = _evaluate(ast2 == null ? void 0 : ast2.kwargs[kwarg]);
|
|
1755
1726
|
}
|
|
1756
1727
|
if (fnValue === PyDate || fnValue === PyDateTime || fnValue === PyTime || fnValue === PyRelativeDelta || fnValue === PyTimeDelta) {
|
|
1757
1728
|
return fnValue.create(...args, kwargs);
|
|
@@ -1830,9 +1801,25 @@ function escapeRegExp(str) {
|
|
|
1830
1801
|
var InvalidDomainError = class extends Error {
|
|
1831
1802
|
};
|
|
1832
1803
|
var Domain = class _Domain {
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1804
|
+
constructor(descr = []) {
|
|
1805
|
+
this.ast = { type: -1, value: null };
|
|
1806
|
+
if (descr instanceof _Domain) {
|
|
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
|
+
}
|
|
1836
1823
|
static combine(domains, operator) {
|
|
1837
1824
|
if (domains.length === 0) {
|
|
1838
1825
|
return new _Domain([]);
|
|
@@ -1911,24 +1898,6 @@ var Domain = class _Domain {
|
|
|
1911
1898
|
processLeaf(d.ast.value, 0, "&", newDomain);
|
|
1912
1899
|
return newDomain;
|
|
1913
1900
|
}
|
|
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
|
-
}
|
|
1932
1901
|
contains(record) {
|
|
1933
1902
|
const expr = evaluate(this.ast, record);
|
|
1934
1903
|
return matchDomain(record, expr);
|
|
@@ -1947,7 +1916,7 @@ var Domain = class _Domain {
|
|
|
1947
1916
|
return evaluatedAsList;
|
|
1948
1917
|
}
|
|
1949
1918
|
return this.toString();
|
|
1950
|
-
} catch {
|
|
1919
|
+
} catch (e) {
|
|
1951
1920
|
return this.toString();
|
|
1952
1921
|
}
|
|
1953
1922
|
}
|
|
@@ -2147,7 +2116,7 @@ function matchDomain(record, domain) {
|
|
|
2147
2116
|
}
|
|
2148
2117
|
|
|
2149
2118
|
// src/utils/function.ts
|
|
2150
|
-
|
|
2119
|
+
import { useEffect, useState } from "react";
|
|
2151
2120
|
var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
|
2152
2121
|
if (!originalRequest.data) return originalRequest.data;
|
|
2153
2122
|
if (typeof originalRequest.data === "string") {
|
|
@@ -2170,22 +2139,22 @@ var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
|
|
2170
2139
|
|
|
2171
2140
|
// src/utils/storage/local-storage.ts
|
|
2172
2141
|
var localStorageUtils = () => {
|
|
2173
|
-
const setToken =
|
|
2142
|
+
const setToken = (access_token) => __async(null, null, function* () {
|
|
2174
2143
|
localStorage.setItem("accessToken", access_token);
|
|
2175
|
-
};
|
|
2176
|
-
const setRefreshToken =
|
|
2144
|
+
});
|
|
2145
|
+
const setRefreshToken = (refresh_token) => __async(null, null, function* () {
|
|
2177
2146
|
localStorage.setItem("refreshToken", refresh_token);
|
|
2178
|
-
};
|
|
2179
|
-
const getAccessToken =
|
|
2147
|
+
});
|
|
2148
|
+
const getAccessToken = () => __async(null, null, function* () {
|
|
2180
2149
|
return localStorage.getItem("accessToken");
|
|
2181
|
-
};
|
|
2182
|
-
const getRefreshToken =
|
|
2150
|
+
});
|
|
2151
|
+
const getRefreshToken = () => __async(null, null, function* () {
|
|
2183
2152
|
return localStorage.getItem("refreshToken");
|
|
2184
|
-
};
|
|
2185
|
-
const clearToken =
|
|
2153
|
+
});
|
|
2154
|
+
const clearToken = () => __async(null, null, function* () {
|
|
2186
2155
|
localStorage.removeItem("accessToken");
|
|
2187
2156
|
localStorage.removeItem("refreshToken");
|
|
2188
|
-
};
|
|
2157
|
+
});
|
|
2189
2158
|
return {
|
|
2190
2159
|
setToken,
|
|
2191
2160
|
setRefreshToken,
|
|
@@ -2197,9 +2166,9 @@ var localStorageUtils = () => {
|
|
|
2197
2166
|
|
|
2198
2167
|
// src/utils/storage/session-storage.ts
|
|
2199
2168
|
var sessionStorageUtils = () => {
|
|
2200
|
-
const getBrowserSession =
|
|
2169
|
+
const getBrowserSession = () => __async(null, null, function* () {
|
|
2201
2170
|
return sessionStorage.getItem("browserSession");
|
|
2202
|
-
};
|
|
2171
|
+
});
|
|
2203
2172
|
return {
|
|
2204
2173
|
getBrowserSession
|
|
2205
2174
|
};
|
|
@@ -2208,13 +2177,14 @@ var sessionStorageUtils = () => {
|
|
|
2208
2177
|
// src/configs/axios-client.ts
|
|
2209
2178
|
var axiosClient = {
|
|
2210
2179
|
init(config) {
|
|
2211
|
-
|
|
2212
|
-
const
|
|
2180
|
+
var _a, _b;
|
|
2181
|
+
const localStorage2 = (_a = config.localStorageUtils) != null ? _a : localStorageUtils();
|
|
2182
|
+
const sessionStorage2 = (_b = config.sessionStorageUtils) != null ? _b : sessionStorageUtils();
|
|
2213
2183
|
const db = config.db;
|
|
2214
2184
|
let isRefreshing = false;
|
|
2215
2185
|
let failedQueue = [];
|
|
2216
2186
|
const processQueue = (error, token = null) => {
|
|
2217
|
-
failedQueue
|
|
2187
|
+
failedQueue == null ? void 0 : failedQueue.forEach((prom) => {
|
|
2218
2188
|
if (error) {
|
|
2219
2189
|
prom.reject(error);
|
|
2220
2190
|
} else {
|
|
@@ -2223,39 +2193,44 @@ var axiosClient = {
|
|
|
2223
2193
|
});
|
|
2224
2194
|
failedQueue = [];
|
|
2225
2195
|
};
|
|
2226
|
-
const instance =
|
|
2227
|
-
adapter:
|
|
2196
|
+
const instance = axios.create({
|
|
2197
|
+
adapter: axios.defaults.adapter,
|
|
2228
2198
|
baseURL: config.baseUrl,
|
|
2229
2199
|
timeout: 5e4,
|
|
2230
2200
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2231
2201
|
});
|
|
2232
|
-
instance.interceptors.request.use(
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2202
|
+
instance.interceptors.request.use(
|
|
2203
|
+
(config2) => __async(null, null, function* () {
|
|
2204
|
+
const useRefreshToken = config2.useRefreshToken;
|
|
2205
|
+
const token = useRefreshToken ? yield localStorage2.getRefreshToken() : yield localStorage2.getAccessToken();
|
|
2206
|
+
if (token) {
|
|
2207
|
+
config2.headers["Authorization"] = "Bearer " + token;
|
|
2208
|
+
}
|
|
2209
|
+
return config2;
|
|
2210
|
+
}),
|
|
2211
|
+
(error) => {
|
|
2212
|
+
Promise.reject(error);
|
|
2236
2213
|
}
|
|
2237
|
-
|
|
2238
|
-
const token = await getToken?.();
|
|
2239
|
-
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2240
|
-
return config2;
|
|
2241
|
-
}, Promise.reject);
|
|
2214
|
+
);
|
|
2242
2215
|
instance.interceptors.response.use(
|
|
2243
2216
|
(response) => {
|
|
2244
2217
|
return handleResponse(response);
|
|
2245
2218
|
},
|
|
2246
|
-
|
|
2247
|
-
|
|
2219
|
+
(error) => __async(null, null, function* () {
|
|
2220
|
+
var _a2, _b2, _c;
|
|
2221
|
+
const handleError3 = (error2) => __async(null, null, function* () {
|
|
2222
|
+
var _a3;
|
|
2248
2223
|
if (!error2.response) {
|
|
2249
2224
|
return error2;
|
|
2250
2225
|
}
|
|
2251
2226
|
const { data } = error2.response;
|
|
2252
|
-
if (data && data.code === 400 && ["invalid_grant"].includes(data.data
|
|
2253
|
-
|
|
2227
|
+
if (data && data.code === 400 && ["invalid_grant"].includes((_a3 = data.data) == null ? void 0 : _a3.error)) {
|
|
2228
|
+
yield clearAuthToken();
|
|
2254
2229
|
}
|
|
2255
2230
|
return data;
|
|
2256
|
-
};
|
|
2231
|
+
});
|
|
2257
2232
|
const originalRequest = error.config;
|
|
2258
|
-
if ((error.response
|
|
2233
|
+
if ((((_a2 = error.response) == null ? void 0 : _a2.status) === 403 || ((_b2 = error.response) == null ? void 0 : _b2.status) === 401 || ((_c = error.response) == null ? void 0 : _c.status) === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401, "ERR_2FA_006"].includes(
|
|
2259
2234
|
error.response.data.code
|
|
2260
2235
|
)) {
|
|
2261
2236
|
if (isRefreshing) {
|
|
@@ -2268,18 +2243,19 @@ var axiosClient = {
|
|
|
2268
2243
|
token
|
|
2269
2244
|
);
|
|
2270
2245
|
return instance.request(originalRequest);
|
|
2271
|
-
}).catch(
|
|
2272
|
-
|
|
2273
|
-
|
|
2246
|
+
}).catch((err) => __async(null, null, function* () {
|
|
2247
|
+
var _a3, _b3;
|
|
2248
|
+
if ((((_a3 = err.response) == null ? void 0 : _a3.status) === 400 || ((_b3 = err.response) == null ? void 0 : _b3.status) === 401) && ["invalid_grant"].includes(err.response.data.error)) {
|
|
2249
|
+
yield clearAuthToken();
|
|
2274
2250
|
}
|
|
2275
|
-
});
|
|
2251
|
+
}));
|
|
2276
2252
|
}
|
|
2277
|
-
const browserSession =
|
|
2278
|
-
const refreshToken =
|
|
2279
|
-
const accessTokenExp =
|
|
2253
|
+
const browserSession = yield sessionStorage2.getBrowserSession();
|
|
2254
|
+
const refreshToken = yield localStorage2.getRefreshToken();
|
|
2255
|
+
const accessTokenExp = yield localStorage2.getAccessToken();
|
|
2280
2256
|
isRefreshing = true;
|
|
2281
2257
|
if (!refreshToken && (!browserSession || browserSession == "unActive")) {
|
|
2282
|
-
|
|
2258
|
+
yield clearAuthToken();
|
|
2283
2259
|
} else {
|
|
2284
2260
|
const payload = Object.fromEntries(
|
|
2285
2261
|
Object.entries({
|
|
@@ -2290,8 +2266,9 @@ var axiosClient = {
|
|
|
2290
2266
|
}).filter(([_, value]) => !!value)
|
|
2291
2267
|
);
|
|
2292
2268
|
return new Promise(function(resolve) {
|
|
2293
|
-
|
|
2294
|
-
|
|
2269
|
+
var _a3;
|
|
2270
|
+
axios.post(
|
|
2271
|
+
`${config.baseUrl}${(_a3 = config.refreshTokenEndpoint) != null ? _a3 : "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
|
|
2295
2272
|
payload,
|
|
2296
2273
|
{
|
|
2297
2274
|
headers: {
|
|
@@ -2299,11 +2276,11 @@ var axiosClient = {
|
|
|
2299
2276
|
Authorization: `Bearer ${accessTokenExp}`
|
|
2300
2277
|
}
|
|
2301
2278
|
}
|
|
2302
|
-
).then(
|
|
2279
|
+
).then((res) => __async(null, null, function* () {
|
|
2303
2280
|
const data = res.data;
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2281
|
+
yield localStorage2.setToken(data.access_token);
|
|
2282
|
+
yield localStorage2.setRefreshToken(data.refresh_token);
|
|
2283
|
+
axios.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
|
|
2307
2284
|
originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
|
|
2308
2285
|
originalRequest.data = updateTokenParamInOriginalRequest(
|
|
2309
2286
|
originalRequest,
|
|
@@ -2311,25 +2288,26 @@ var axiosClient = {
|
|
|
2311
2288
|
);
|
|
2312
2289
|
processQueue(null, data.access_token);
|
|
2313
2290
|
resolve(instance.request(originalRequest));
|
|
2314
|
-
}).catch(
|
|
2315
|
-
|
|
2316
|
-
|
|
2291
|
+
})).catch((err) => __async(null, null, function* () {
|
|
2292
|
+
var _a4;
|
|
2293
|
+
if (err && ((err == null ? void 0 : err.error_code) === "AUTHEN_FAIL" || (err == null ? void 0 : err.error_code) === "TOKEN_EXPIRED" || (err == null ? void 0 : err.error_code) === "TOKEN_INCORRECT" || (err == null ? void 0 : err.code) === "ERR_BAD_REQUEST") || (err == null ? void 0 : err.error_code) === "ERR_2FA_006") {
|
|
2294
|
+
yield clearAuthToken();
|
|
2317
2295
|
}
|
|
2318
2296
|
if (err && err.response) {
|
|
2319
|
-
const { error_code } = err.response
|
|
2297
|
+
const { error_code } = ((_a4 = err.response) == null ? void 0 : _a4.data) || {};
|
|
2320
2298
|
if (error_code === "AUTHEN_FAIL") {
|
|
2321
|
-
|
|
2299
|
+
yield clearAuthToken();
|
|
2322
2300
|
}
|
|
2323
2301
|
}
|
|
2324
2302
|
processQueue(err, null);
|
|
2325
|
-
}).finally(() => {
|
|
2303
|
+
})).finally(() => {
|
|
2326
2304
|
isRefreshing = false;
|
|
2327
2305
|
});
|
|
2328
2306
|
});
|
|
2329
2307
|
}
|
|
2330
2308
|
}
|
|
2331
|
-
return Promise.reject(
|
|
2332
|
-
}
|
|
2309
|
+
return Promise.reject(yield handleError3(error));
|
|
2310
|
+
})
|
|
2333
2311
|
);
|
|
2334
2312
|
const handleResponse = (res) => {
|
|
2335
2313
|
if (res && res.data) {
|
|
@@ -2338,6 +2316,7 @@ var axiosClient = {
|
|
|
2338
2316
|
return res;
|
|
2339
2317
|
};
|
|
2340
2318
|
const handleError2 = (error) => {
|
|
2319
|
+
var _a2, _b2, _c;
|
|
2341
2320
|
if (error.isAxiosError && error.code === "ECONNABORTED") {
|
|
2342
2321
|
console.error("Request Timeout Error:", error);
|
|
2343
2322
|
return "Request Timeout Error";
|
|
@@ -2345,17 +2324,17 @@ var axiosClient = {
|
|
|
2345
2324
|
console.error("Network Error:", error);
|
|
2346
2325
|
return "Network Error";
|
|
2347
2326
|
} else {
|
|
2348
|
-
console.error("Other Error:", error
|
|
2349
|
-
const errorMessage = error
|
|
2350
|
-
return { message: errorMessage, status: error
|
|
2327
|
+
console.error("Other Error:", error == null ? void 0 : error.response);
|
|
2328
|
+
const errorMessage = ((_b2 = (_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.data) == null ? void 0 : _b2.message) || "An error occurred";
|
|
2329
|
+
return { message: errorMessage, status: (_c = error == null ? void 0 : error.response) == null ? void 0 : _c.status };
|
|
2351
2330
|
}
|
|
2352
2331
|
};
|
|
2353
|
-
const clearAuthToken =
|
|
2354
|
-
|
|
2332
|
+
const clearAuthToken = () => __async(null, null, function* () {
|
|
2333
|
+
yield localStorage2.clearToken();
|
|
2355
2334
|
if (typeof window !== "undefined") {
|
|
2356
2335
|
window.location.href = `/login`;
|
|
2357
2336
|
}
|
|
2358
|
-
};
|
|
2337
|
+
});
|
|
2359
2338
|
function formatUrl(url, db2) {
|
|
2360
2339
|
return url + (db2 ? "?db=" + db2 : "");
|
|
2361
2340
|
}
|
|
@@ -2377,7 +2356,6 @@ var axiosClient = {
|
|
|
2377
2356
|
return requests;
|
|
2378
2357
|
}
|
|
2379
2358
|
};
|
|
2380
|
-
|
|
2381
|
-
0 && (module.exports = {
|
|
2359
|
+
export {
|
|
2382
2360
|
axiosClient
|
|
2383
|
-
}
|
|
2361
|
+
};
|
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/constants.ts
|
|
20
|
+
var constants_exports = {};
|
|
21
|
+
__export(constants_exports, {
|
|
22
|
+
ComponentType: () => ComponentType,
|
|
23
|
+
FieldTypeConstants: () => FieldTypeConstants,
|
|
24
|
+
KeyConstants: () => KeyConstants,
|
|
25
|
+
MethodConstants: () => MethodConstants,
|
|
26
|
+
MethodType: () => MethodType,
|
|
27
|
+
ModelConstants: () => ModelConstants,
|
|
28
|
+
SearchType: () => SearchType,
|
|
29
|
+
UriConstants: () => UriConstants,
|
|
30
|
+
WIDGETAVATAR: () => WIDGETAVATAR,
|
|
31
|
+
WIDGETCOLOR: () => WIDGETCOLOR,
|
|
32
|
+
WIDGETCURRENCY: () => WIDGETCURRENCY,
|
|
33
|
+
WIDGETNOSTRING: () => WIDGETNOSTRING,
|
|
34
|
+
WIDGETSTATUS: () => WIDGETSTATUS
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(constants_exports);
|
|
37
|
+
|
|
1
38
|
// src/constants/api/key-constant.ts
|
|
2
39
|
var KeyConstants = /* @__PURE__ */ ((KeyConstants2) => {
|
|
3
40
|
KeyConstants2["PROFILE"] = "userinfo";
|
|
@@ -149,7 +186,8 @@ var WIDGETNOSTRING = /* @__PURE__ */ ((WIDGETNOSTRING2) => {
|
|
|
149
186
|
WIDGETNOSTRING2["sla_status_ids"] = "sla_status_ids";
|
|
150
187
|
return WIDGETNOSTRING2;
|
|
151
188
|
})(WIDGETNOSTRING || {});
|
|
152
|
-
export
|
|
189
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
190
|
+
0 && (module.exports = {
|
|
153
191
|
ComponentType,
|
|
154
192
|
FieldTypeConstants,
|
|
155
193
|
KeyConstants,
|
|
@@ -163,4 +201,4 @@ export {
|
|
|
163
201
|
WIDGETCURRENCY,
|
|
164
202
|
WIDGETNOSTRING,
|
|
165
203
|
WIDGETSTATUS
|
|
166
|
-
};
|
|
204
|
+
});
|
package/dist/constants.js
CHANGED
|
@@ -1,41 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/constants.ts
|
|
21
|
-
var constants_exports = {};
|
|
22
|
-
__export(constants_exports, {
|
|
23
|
-
ComponentType: () => ComponentType,
|
|
24
|
-
FieldTypeConstants: () => FieldTypeConstants,
|
|
25
|
-
KeyConstants: () => KeyConstants,
|
|
26
|
-
MethodConstants: () => MethodConstants,
|
|
27
|
-
MethodType: () => MethodType,
|
|
28
|
-
ModelConstants: () => ModelConstants,
|
|
29
|
-
SearchType: () => SearchType,
|
|
30
|
-
UriConstants: () => UriConstants,
|
|
31
|
-
WIDGETAVATAR: () => WIDGETAVATAR,
|
|
32
|
-
WIDGETCOLOR: () => WIDGETCOLOR,
|
|
33
|
-
WIDGETCURRENCY: () => WIDGETCURRENCY,
|
|
34
|
-
WIDGETNOSTRING: () => WIDGETNOSTRING,
|
|
35
|
-
WIDGETSTATUS: () => WIDGETSTATUS
|
|
36
|
-
});
|
|
37
|
-
module.exports = __toCommonJS(constants_exports);
|
|
38
|
-
|
|
39
1
|
// src/constants/api/key-constant.ts
|
|
40
2
|
var KeyConstants = /* @__PURE__ */ ((KeyConstants2) => {
|
|
41
3
|
KeyConstants2["PROFILE"] = "userinfo";
|
|
@@ -187,8 +149,7 @@ var WIDGETNOSTRING = /* @__PURE__ */ ((WIDGETNOSTRING2) => {
|
|
|
187
149
|
WIDGETNOSTRING2["sla_status_ids"] = "sla_status_ids";
|
|
188
150
|
return WIDGETNOSTRING2;
|
|
189
151
|
})(WIDGETNOSTRING || {});
|
|
190
|
-
|
|
191
|
-
0 && (module.exports = {
|
|
152
|
+
export {
|
|
192
153
|
ComponentType,
|
|
193
154
|
FieldTypeConstants,
|
|
194
155
|
KeyConstants,
|
|
@@ -202,4 +163,4 @@ var WIDGETNOSTRING = /* @__PURE__ */ ((WIDGETNOSTRING2) => {
|
|
|
202
163
|
WIDGETCURRENCY,
|
|
203
164
|
WIDGETNOSTRING,
|
|
204
165
|
WIDGETSTATUS
|
|
205
|
-
}
|
|
166
|
+
};
|