@fctc/interface-logic 3.0.3 → 3.0.4
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.mts +6 -6
- package/dist/configs.d.ts +6 -6
- package/dist/configs.js +68 -34
- package/dist/configs.mjs +68 -34
- package/dist/constants.d.mts +1 -2
- package/dist/constants.d.ts +1 -2
- package/dist/constants.js +0 -1
- package/dist/constants.mjs +0 -1
- package/dist/environment.d.mts +8 -5
- package/dist/environment.d.ts +8 -5
- package/dist/environment.js +70 -36
- package/dist/environment.mjs +70 -36
- package/dist/hooks.d.mts +5 -19
- package/dist/hooks.d.ts +5 -19
- package/dist/hooks.js +29 -127
- package/dist/hooks.mjs +29 -125
- package/dist/{session-storage-ARp_lhTD.d.mts → local-storage-BPvoMGYJ.d.mts} +1 -6
- package/dist/{session-storage-ARp_lhTD.d.ts → local-storage-BPvoMGYJ.d.ts} +1 -6
- package/dist/provider.d.mts +5 -6
- package/dist/provider.d.ts +5 -6
- package/dist/provider.js +132 -196
- package/dist/provider.mjs +132 -196
- package/dist/services.d.mts +2 -16
- package/dist/services.d.ts +2 -16
- package/dist/services.js +25 -77
- package/dist/services.mjs +25 -77
- package/dist/utils.d.mts +15 -1
- package/dist/utils.d.ts +15 -1
- package/dist/utils.js +43 -0
- package/dist/utils.mjs +42 -0
- package/package.json +1 -1
package/dist/configs.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare const axiosClient: {
|
|
2
2
|
init(config: any): {
|
|
3
|
-
get: (url: string, headers?: any,
|
|
4
|
-
post: (url: string, body: any, headers?: any,
|
|
5
|
-
post_excel: (url: string, body: any, headers?: any
|
|
6
|
-
put: (url: string, body: any, headers?: any,
|
|
7
|
-
patch: (url: string, body: any, headers?: any,
|
|
8
|
-
delete: (url: string, headers?: any,
|
|
3
|
+
get: (url: string, headers?: any, hardService?: string) => Promise<any>;
|
|
4
|
+
post: (url: string, body: any, headers?: any, hardService?: string) => Promise<any>;
|
|
5
|
+
post_excel: (url: string, body: any, headers?: any) => Promise<any>;
|
|
6
|
+
put: (url: string, body: any, headers?: any, hardService?: string) => Promise<any>;
|
|
7
|
+
patch: (url: string, body: any, headers?: any, hardService?: string) => Promise<any>;
|
|
8
|
+
delete: (url: string, headers?: any, hardService?: string) => Promise<any>;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
11
|
|
package/dist/configs.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare const axiosClient: {
|
|
2
2
|
init(config: any): {
|
|
3
|
-
get: (url: string, headers?: any,
|
|
4
|
-
post: (url: string, body: any, headers?: any,
|
|
5
|
-
post_excel: (url: string, body: any, headers?: any
|
|
6
|
-
put: (url: string, body: any, headers?: any,
|
|
7
|
-
patch: (url: string, body: any, headers?: any,
|
|
8
|
-
delete: (url: string, headers?: any,
|
|
3
|
+
get: (url: string, headers?: any, hardService?: string) => Promise<any>;
|
|
4
|
+
post: (url: string, body: any, headers?: any, hardService?: string) => Promise<any>;
|
|
5
|
+
post_excel: (url: string, body: any, headers?: any) => Promise<any>;
|
|
6
|
+
put: (url: string, body: any, headers?: any, hardService?: string) => Promise<any>;
|
|
7
|
+
patch: (url: string, body: any, headers?: any, hardService?: string) => Promise<any>;
|
|
8
|
+
delete: (url: string, headers?: any, hardService?: string) => Promise<any>;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
11
|
|
package/dist/configs.js
CHANGED
|
@@ -2198,24 +2198,56 @@ var localStorageUtils = () => {
|
|
|
2198
2198
|
};
|
|
2199
2199
|
|
|
2200
2200
|
// src/utils/storage/session-storage.ts
|
|
2201
|
-
var sessionStorageUtils = () => {
|
|
2202
|
-
const
|
|
2203
|
-
|
|
2201
|
+
var sessionStorageUtils = /* @__PURE__ */ (() => {
|
|
2202
|
+
const getMenuFocus = () => {
|
|
2203
|
+
const menuFocus = sessionStorage.getItem("menuFocus");
|
|
2204
|
+
return menuFocus ? JSON.parse(menuFocus) : {
|
|
2205
|
+
id: void 0,
|
|
2206
|
+
service: ""
|
|
2207
|
+
};
|
|
2208
|
+
};
|
|
2209
|
+
const setMenuFocus = (menuTree) => {
|
|
2210
|
+
sessionStorage.setItem("menuFocus", JSON.stringify({ ...menuTree }));
|
|
2211
|
+
};
|
|
2212
|
+
const getActionData = () => {
|
|
2213
|
+
const actionData = sessionStorage.getItem("actionData");
|
|
2214
|
+
return actionData ? JSON.parse(actionData) : {};
|
|
2215
|
+
};
|
|
2216
|
+
const setActionData = (actData) => {
|
|
2217
|
+
sessionStorage.setItem("actionData", JSON.stringify(actData));
|
|
2218
|
+
};
|
|
2219
|
+
const getViewData = () => {
|
|
2220
|
+
const viewData = sessionStorage.getItem("viewData");
|
|
2221
|
+
return viewData ? JSON.parse(viewData) : {};
|
|
2222
|
+
};
|
|
2223
|
+
const getBrowserSession = () => {
|
|
2224
|
+
const actionData = sessionStorage.getItem("browserSession");
|
|
2225
|
+
return actionData ? JSON.parse(actionData) : null;
|
|
2226
|
+
};
|
|
2227
|
+
const setViewData = (viewData) => {
|
|
2228
|
+
sessionStorage.setItem("viewData", JSON.stringify(viewData));
|
|
2204
2229
|
};
|
|
2205
2230
|
return {
|
|
2231
|
+
getMenuFocus,
|
|
2232
|
+
setMenuFocus,
|
|
2233
|
+
setActionData,
|
|
2234
|
+
getActionData,
|
|
2235
|
+
getViewData,
|
|
2236
|
+
setViewData,
|
|
2206
2237
|
getBrowserSession
|
|
2207
2238
|
};
|
|
2208
|
-
};
|
|
2239
|
+
})();
|
|
2209
2240
|
|
|
2210
2241
|
// src/configs/axios-client.ts
|
|
2211
2242
|
var axiosClient = {
|
|
2212
2243
|
init(config) {
|
|
2213
2244
|
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
2214
|
-
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils
|
|
2245
|
+
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils;
|
|
2215
2246
|
const db = config?.db;
|
|
2216
2247
|
const database = config?.config?.database;
|
|
2217
2248
|
let isRefreshing = false;
|
|
2218
2249
|
let failedQueue = [];
|
|
2250
|
+
const xNode = config?.xNode;
|
|
2219
2251
|
const processQueue = (error, token = null) => {
|
|
2220
2252
|
failedQueue?.forEach((prom) => {
|
|
2221
2253
|
if (error) {
|
|
@@ -2370,46 +2402,48 @@ var axiosClient = {
|
|
|
2370
2402
|
function formatUrl(url, db2) {
|
|
2371
2403
|
return url + (db2 ? "?db=" + db2 : "");
|
|
2372
2404
|
}
|
|
2373
|
-
const getBaseUrl = (baseUrl,
|
|
2374
|
-
|
|
2375
|
-
|
|
2405
|
+
const getBaseUrl = (baseUrl, hardService) => {
|
|
2406
|
+
return `${baseUrl.replace(/\/$/, "")}/${hardService ?? (sessionStorage2.getMenuFocus().service || config?.default_service)}/api/v2`;
|
|
2407
|
+
};
|
|
2408
|
+
const getHeaders = (header) => {
|
|
2409
|
+
const headers = {
|
|
2410
|
+
...header,
|
|
2411
|
+
...xNode ? { "X-Node": xNode } : {}
|
|
2412
|
+
};
|
|
2413
|
+
return headers;
|
|
2376
2414
|
};
|
|
2377
2415
|
const responseBody = (response) => response;
|
|
2378
2416
|
const requests = {
|
|
2379
|
-
get: (url, headers,
|
|
2380
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
2381
|
-
headers
|
|
2417
|
+
get: (url, headers, hardService) => instance.get(
|
|
2418
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
2419
|
+
getHeaders(headers)
|
|
2382
2420
|
).then(responseBody),
|
|
2383
|
-
post: async (url, body, headers,
|
|
2384
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
2421
|
+
post: async (url, body, headers, hardService) => instance.post(
|
|
2422
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
2385
2423
|
body,
|
|
2386
|
-
headers
|
|
2424
|
+
getHeaders(headers)
|
|
2387
2425
|
).then(responseBody),
|
|
2388
|
-
post_excel: (url, body, headers
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
headers
|
|
2394
|
-
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
2395
|
-
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
2396
|
-
...headers
|
|
2397
|
-
}
|
|
2426
|
+
post_excel: (url, body, headers) => instance.post(formatUrl(getBaseUrl(config?.baseUrl) + url, db), body, {
|
|
2427
|
+
responseType: "arraybuffer",
|
|
2428
|
+
headers: {
|
|
2429
|
+
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
2430
|
+
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
2431
|
+
...headers
|
|
2398
2432
|
}
|
|
2399
|
-
).then(responseBody),
|
|
2400
|
-
put: (url, body, headers,
|
|
2401
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
2433
|
+
}).then(responseBody),
|
|
2434
|
+
put: (url, body, headers, hardService) => instance.put(
|
|
2435
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
2402
2436
|
body,
|
|
2403
|
-
headers
|
|
2437
|
+
getHeaders(headers)
|
|
2404
2438
|
).then(responseBody),
|
|
2405
|
-
patch: (url, body, headers,
|
|
2406
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
2439
|
+
patch: (url, body, headers, hardService) => instance.patch(
|
|
2440
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
2407
2441
|
body,
|
|
2408
|
-
headers
|
|
2442
|
+
getHeaders(headers)
|
|
2409
2443
|
).then(responseBody),
|
|
2410
|
-
delete: (url, headers,
|
|
2411
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
2412
|
-
headers
|
|
2444
|
+
delete: (url, headers, hardService) => instance.delete(
|
|
2445
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
2446
|
+
getHeaders(headers)
|
|
2413
2447
|
).then(responseBody)
|
|
2414
2448
|
};
|
|
2415
2449
|
return requests;
|
package/dist/configs.mjs
CHANGED
|
@@ -2162,24 +2162,56 @@ var localStorageUtils = () => {
|
|
|
2162
2162
|
};
|
|
2163
2163
|
|
|
2164
2164
|
// src/utils/storage/session-storage.ts
|
|
2165
|
-
var sessionStorageUtils = () => {
|
|
2166
|
-
const
|
|
2167
|
-
|
|
2165
|
+
var sessionStorageUtils = /* @__PURE__ */ (() => {
|
|
2166
|
+
const getMenuFocus = () => {
|
|
2167
|
+
const menuFocus = sessionStorage.getItem("menuFocus");
|
|
2168
|
+
return menuFocus ? JSON.parse(menuFocus) : {
|
|
2169
|
+
id: void 0,
|
|
2170
|
+
service: ""
|
|
2171
|
+
};
|
|
2172
|
+
};
|
|
2173
|
+
const setMenuFocus = (menuTree) => {
|
|
2174
|
+
sessionStorage.setItem("menuFocus", JSON.stringify({ ...menuTree }));
|
|
2175
|
+
};
|
|
2176
|
+
const getActionData = () => {
|
|
2177
|
+
const actionData = sessionStorage.getItem("actionData");
|
|
2178
|
+
return actionData ? JSON.parse(actionData) : {};
|
|
2179
|
+
};
|
|
2180
|
+
const setActionData = (actData) => {
|
|
2181
|
+
sessionStorage.setItem("actionData", JSON.stringify(actData));
|
|
2182
|
+
};
|
|
2183
|
+
const getViewData = () => {
|
|
2184
|
+
const viewData = sessionStorage.getItem("viewData");
|
|
2185
|
+
return viewData ? JSON.parse(viewData) : {};
|
|
2186
|
+
};
|
|
2187
|
+
const getBrowserSession = () => {
|
|
2188
|
+
const actionData = sessionStorage.getItem("browserSession");
|
|
2189
|
+
return actionData ? JSON.parse(actionData) : null;
|
|
2190
|
+
};
|
|
2191
|
+
const setViewData = (viewData) => {
|
|
2192
|
+
sessionStorage.setItem("viewData", JSON.stringify(viewData));
|
|
2168
2193
|
};
|
|
2169
2194
|
return {
|
|
2195
|
+
getMenuFocus,
|
|
2196
|
+
setMenuFocus,
|
|
2197
|
+
setActionData,
|
|
2198
|
+
getActionData,
|
|
2199
|
+
getViewData,
|
|
2200
|
+
setViewData,
|
|
2170
2201
|
getBrowserSession
|
|
2171
2202
|
};
|
|
2172
|
-
};
|
|
2203
|
+
})();
|
|
2173
2204
|
|
|
2174
2205
|
// src/configs/axios-client.ts
|
|
2175
2206
|
var axiosClient = {
|
|
2176
2207
|
init(config) {
|
|
2177
2208
|
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
2178
|
-
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils
|
|
2209
|
+
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils;
|
|
2179
2210
|
const db = config?.db;
|
|
2180
2211
|
const database = config?.config?.database;
|
|
2181
2212
|
let isRefreshing = false;
|
|
2182
2213
|
let failedQueue = [];
|
|
2214
|
+
const xNode = config?.xNode;
|
|
2183
2215
|
const processQueue = (error, token = null) => {
|
|
2184
2216
|
failedQueue?.forEach((prom) => {
|
|
2185
2217
|
if (error) {
|
|
@@ -2334,46 +2366,48 @@ var axiosClient = {
|
|
|
2334
2366
|
function formatUrl(url, db2) {
|
|
2335
2367
|
return url + (db2 ? "?db=" + db2 : "");
|
|
2336
2368
|
}
|
|
2337
|
-
const getBaseUrl = (baseUrl,
|
|
2338
|
-
|
|
2339
|
-
|
|
2369
|
+
const getBaseUrl = (baseUrl, hardService) => {
|
|
2370
|
+
return `${baseUrl.replace(/\/$/, "")}/${hardService ?? (sessionStorage2.getMenuFocus().service || config?.default_service)}/api/v2`;
|
|
2371
|
+
};
|
|
2372
|
+
const getHeaders = (header) => {
|
|
2373
|
+
const headers = {
|
|
2374
|
+
...header,
|
|
2375
|
+
...xNode ? { "X-Node": xNode } : {}
|
|
2376
|
+
};
|
|
2377
|
+
return headers;
|
|
2340
2378
|
};
|
|
2341
2379
|
const responseBody = (response) => response;
|
|
2342
2380
|
const requests = {
|
|
2343
|
-
get: (url, headers,
|
|
2344
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
2345
|
-
headers
|
|
2381
|
+
get: (url, headers, hardService) => instance.get(
|
|
2382
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
2383
|
+
getHeaders(headers)
|
|
2346
2384
|
).then(responseBody),
|
|
2347
|
-
post: async (url, body, headers,
|
|
2348
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
2385
|
+
post: async (url, body, headers, hardService) => instance.post(
|
|
2386
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
2349
2387
|
body,
|
|
2350
|
-
headers
|
|
2388
|
+
getHeaders(headers)
|
|
2351
2389
|
).then(responseBody),
|
|
2352
|
-
post_excel: (url, body, headers
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
headers
|
|
2358
|
-
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
2359
|
-
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
2360
|
-
...headers
|
|
2361
|
-
}
|
|
2390
|
+
post_excel: (url, body, headers) => instance.post(formatUrl(getBaseUrl(config?.baseUrl) + url, db), body, {
|
|
2391
|
+
responseType: "arraybuffer",
|
|
2392
|
+
headers: {
|
|
2393
|
+
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
2394
|
+
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
2395
|
+
...headers
|
|
2362
2396
|
}
|
|
2363
|
-
).then(responseBody),
|
|
2364
|
-
put: (url, body, headers,
|
|
2365
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
2397
|
+
}).then(responseBody),
|
|
2398
|
+
put: (url, body, headers, hardService) => instance.put(
|
|
2399
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
2366
2400
|
body,
|
|
2367
|
-
headers
|
|
2401
|
+
getHeaders(headers)
|
|
2368
2402
|
).then(responseBody),
|
|
2369
|
-
patch: (url, body, headers,
|
|
2370
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
2403
|
+
patch: (url, body, headers, hardService) => instance.patch(
|
|
2404
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
2371
2405
|
body,
|
|
2372
|
-
headers
|
|
2406
|
+
getHeaders(headers)
|
|
2373
2407
|
).then(responseBody),
|
|
2374
|
-
delete: (url, headers,
|
|
2375
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
2376
|
-
headers
|
|
2408
|
+
delete: (url, headers, hardService) => instance.delete(
|
|
2409
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
2410
|
+
getHeaders(headers)
|
|
2377
2411
|
).then(responseBody)
|
|
2378
2412
|
};
|
|
2379
2413
|
return requests;
|
package/dist/constants.d.mts
CHANGED
package/dist/constants.d.ts
CHANGED
package/dist/constants.js
CHANGED
|
@@ -65,7 +65,6 @@ var MethodConstants = /* @__PURE__ */ ((MethodConstants2) => {
|
|
|
65
65
|
MethodConstants2["CREATE"] = "create";
|
|
66
66
|
MethodConstants2["LOAD_DATA"] = "load_data";
|
|
67
67
|
MethodConstants2["CHECK"] = "check";
|
|
68
|
-
MethodConstants2["GET_CLOSING_CONTROL_DATA"] = "get_closing_control_data";
|
|
69
68
|
return MethodConstants2;
|
|
70
69
|
})(MethodConstants || {});
|
|
71
70
|
|
package/dist/constants.mjs
CHANGED
|
@@ -27,7 +27,6 @@ var MethodConstants = /* @__PURE__ */ ((MethodConstants2) => {
|
|
|
27
27
|
MethodConstants2["CREATE"] = "create";
|
|
28
28
|
MethodConstants2["LOAD_DATA"] = "load_data";
|
|
29
29
|
MethodConstants2["CHECK"] = "check";
|
|
30
|
-
MethodConstants2["GET_CLOSING_CONTROL_DATA"] = "get_closing_control_data";
|
|
31
30
|
return MethodConstants2;
|
|
32
31
|
})(MethodConstants || {});
|
|
33
32
|
|
package/dist/environment.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { L as LocalStorageUtilsType
|
|
1
|
+
import { L as LocalStorageUtilsType } from './local-storage-BPvoMGYJ.mjs';
|
|
2
2
|
|
|
3
3
|
interface EnvConfig {
|
|
4
|
+
env?: any;
|
|
4
5
|
baseUrl?: string;
|
|
5
6
|
requests?: any;
|
|
6
7
|
context?: {
|
|
@@ -15,14 +16,16 @@ interface EnvConfig {
|
|
|
15
16
|
secondary_color?: string;
|
|
16
17
|
primary_color?: string;
|
|
17
18
|
};
|
|
19
|
+
database?: string;
|
|
20
|
+
xNode?: string;
|
|
21
|
+
default_service?: string;
|
|
18
22
|
config?: any;
|
|
19
23
|
companies?: any[];
|
|
20
24
|
user?: any;
|
|
21
25
|
db?: string;
|
|
22
|
-
database?: string;
|
|
23
26
|
refreshTokenEndpoint?: string;
|
|
24
27
|
localStorageUtils?: LocalStorageUtilsType;
|
|
25
|
-
sessionStorageUtils?:
|
|
28
|
+
sessionStorageUtils?: any;
|
|
26
29
|
envFile?: any;
|
|
27
30
|
}
|
|
28
31
|
declare class EnvStore {
|
|
@@ -30,7 +33,7 @@ declare class EnvStore {
|
|
|
30
33
|
private emitter;
|
|
31
34
|
private localStorageUtil;
|
|
32
35
|
private sessionStorageUtil;
|
|
33
|
-
constructor(localStorageUtil?: LocalStorageUtilsType, sessionStorageUtil?:
|
|
36
|
+
constructor(localStorageUtil?: LocalStorageUtilsType, sessionStorageUtil?: any);
|
|
34
37
|
getEnv(): EnvConfig;
|
|
35
38
|
onUpdate(callback: (env: EnvConfig) => void): void;
|
|
36
39
|
setupEnv(envConfig: Partial<EnvConfig>): EnvConfig;
|
|
@@ -45,7 +48,7 @@ declare class EnvStore {
|
|
|
45
48
|
}
|
|
46
49
|
declare function initEnv({ localStorageUtils: localStorageUtil, sessionStorageUtils: sessionStorageUtil, }: {
|
|
47
50
|
localStorageUtils?: LocalStorageUtilsType;
|
|
48
|
-
sessionStorageUtils?:
|
|
51
|
+
sessionStorageUtils?: any;
|
|
49
52
|
}): EnvStore;
|
|
50
53
|
declare function getEnv(): any;
|
|
51
54
|
|
package/dist/environment.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { L as LocalStorageUtilsType
|
|
1
|
+
import { L as LocalStorageUtilsType } from './local-storage-BPvoMGYJ.js';
|
|
2
2
|
|
|
3
3
|
interface EnvConfig {
|
|
4
|
+
env?: any;
|
|
4
5
|
baseUrl?: string;
|
|
5
6
|
requests?: any;
|
|
6
7
|
context?: {
|
|
@@ -15,14 +16,16 @@ interface EnvConfig {
|
|
|
15
16
|
secondary_color?: string;
|
|
16
17
|
primary_color?: string;
|
|
17
18
|
};
|
|
19
|
+
database?: string;
|
|
20
|
+
xNode?: string;
|
|
21
|
+
default_service?: string;
|
|
18
22
|
config?: any;
|
|
19
23
|
companies?: any[];
|
|
20
24
|
user?: any;
|
|
21
25
|
db?: string;
|
|
22
|
-
database?: string;
|
|
23
26
|
refreshTokenEndpoint?: string;
|
|
24
27
|
localStorageUtils?: LocalStorageUtilsType;
|
|
25
|
-
sessionStorageUtils?:
|
|
28
|
+
sessionStorageUtils?: any;
|
|
26
29
|
envFile?: any;
|
|
27
30
|
}
|
|
28
31
|
declare class EnvStore {
|
|
@@ -30,7 +33,7 @@ declare class EnvStore {
|
|
|
30
33
|
private emitter;
|
|
31
34
|
private localStorageUtil;
|
|
32
35
|
private sessionStorageUtil;
|
|
33
|
-
constructor(localStorageUtil?: LocalStorageUtilsType, sessionStorageUtil?:
|
|
36
|
+
constructor(localStorageUtil?: LocalStorageUtilsType, sessionStorageUtil?: any);
|
|
34
37
|
getEnv(): EnvConfig;
|
|
35
38
|
onUpdate(callback: (env: EnvConfig) => void): void;
|
|
36
39
|
setupEnv(envConfig: Partial<EnvConfig>): EnvConfig;
|
|
@@ -45,7 +48,7 @@ declare class EnvStore {
|
|
|
45
48
|
}
|
|
46
49
|
declare function initEnv({ localStorageUtils: localStorageUtil, sessionStorageUtils: sessionStorageUtil, }: {
|
|
47
50
|
localStorageUtils?: LocalStorageUtilsType;
|
|
48
|
-
sessionStorageUtils?:
|
|
51
|
+
sessionStorageUtils?: any;
|
|
49
52
|
}): EnvStore;
|
|
50
53
|
declare function getEnv(): any;
|
|
51
54
|
|
package/dist/environment.js
CHANGED
|
@@ -2200,24 +2200,56 @@ var localStorageUtils = () => {
|
|
|
2200
2200
|
};
|
|
2201
2201
|
|
|
2202
2202
|
// src/utils/storage/session-storage.ts
|
|
2203
|
-
var sessionStorageUtils = () => {
|
|
2204
|
-
const
|
|
2205
|
-
|
|
2203
|
+
var sessionStorageUtils = /* @__PURE__ */ (() => {
|
|
2204
|
+
const getMenuFocus = () => {
|
|
2205
|
+
const menuFocus = sessionStorage.getItem("menuFocus");
|
|
2206
|
+
return menuFocus ? JSON.parse(menuFocus) : {
|
|
2207
|
+
id: void 0,
|
|
2208
|
+
service: ""
|
|
2209
|
+
};
|
|
2210
|
+
};
|
|
2211
|
+
const setMenuFocus = (menuTree) => {
|
|
2212
|
+
sessionStorage.setItem("menuFocus", JSON.stringify({ ...menuTree }));
|
|
2213
|
+
};
|
|
2214
|
+
const getActionData = () => {
|
|
2215
|
+
const actionData = sessionStorage.getItem("actionData");
|
|
2216
|
+
return actionData ? JSON.parse(actionData) : {};
|
|
2217
|
+
};
|
|
2218
|
+
const setActionData = (actData) => {
|
|
2219
|
+
sessionStorage.setItem("actionData", JSON.stringify(actData));
|
|
2220
|
+
};
|
|
2221
|
+
const getViewData = () => {
|
|
2222
|
+
const viewData = sessionStorage.getItem("viewData");
|
|
2223
|
+
return viewData ? JSON.parse(viewData) : {};
|
|
2224
|
+
};
|
|
2225
|
+
const getBrowserSession = () => {
|
|
2226
|
+
const actionData = sessionStorage.getItem("browserSession");
|
|
2227
|
+
return actionData ? JSON.parse(actionData) : null;
|
|
2228
|
+
};
|
|
2229
|
+
const setViewData = (viewData) => {
|
|
2230
|
+
sessionStorage.setItem("viewData", JSON.stringify(viewData));
|
|
2206
2231
|
};
|
|
2207
2232
|
return {
|
|
2233
|
+
getMenuFocus,
|
|
2234
|
+
setMenuFocus,
|
|
2235
|
+
setActionData,
|
|
2236
|
+
getActionData,
|
|
2237
|
+
getViewData,
|
|
2238
|
+
setViewData,
|
|
2208
2239
|
getBrowserSession
|
|
2209
2240
|
};
|
|
2210
|
-
};
|
|
2241
|
+
})();
|
|
2211
2242
|
|
|
2212
2243
|
// src/configs/axios-client.ts
|
|
2213
2244
|
var axiosClient = {
|
|
2214
2245
|
init(config) {
|
|
2215
2246
|
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
2216
|
-
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils
|
|
2247
|
+
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils;
|
|
2217
2248
|
const db = config?.db;
|
|
2218
2249
|
const database = config?.config?.database;
|
|
2219
2250
|
let isRefreshing = false;
|
|
2220
2251
|
let failedQueue = [];
|
|
2252
|
+
const xNode = config?.xNode;
|
|
2221
2253
|
const processQueue = (error, token = null) => {
|
|
2222
2254
|
failedQueue?.forEach((prom) => {
|
|
2223
2255
|
if (error) {
|
|
@@ -2372,46 +2404,48 @@ var axiosClient = {
|
|
|
2372
2404
|
function formatUrl(url, db2) {
|
|
2373
2405
|
return url + (db2 ? "?db=" + db2 : "");
|
|
2374
2406
|
}
|
|
2375
|
-
const getBaseUrl = (baseUrl,
|
|
2376
|
-
|
|
2377
|
-
|
|
2407
|
+
const getBaseUrl = (baseUrl, hardService) => {
|
|
2408
|
+
return `${baseUrl.replace(/\/$/, "")}/${hardService ?? (sessionStorage2.getMenuFocus().service || config?.default_service)}/api/v2`;
|
|
2409
|
+
};
|
|
2410
|
+
const getHeaders = (header) => {
|
|
2411
|
+
const headers = {
|
|
2412
|
+
...header,
|
|
2413
|
+
...xNode ? { "X-Node": xNode } : {}
|
|
2414
|
+
};
|
|
2415
|
+
return headers;
|
|
2378
2416
|
};
|
|
2379
2417
|
const responseBody = (response) => response;
|
|
2380
2418
|
const requests = {
|
|
2381
|
-
get: (url, headers,
|
|
2382
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
2383
|
-
headers
|
|
2419
|
+
get: (url, headers, hardService) => instance.get(
|
|
2420
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
2421
|
+
getHeaders(headers)
|
|
2384
2422
|
).then(responseBody),
|
|
2385
|
-
post: async (url, body, headers,
|
|
2386
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
2423
|
+
post: async (url, body, headers, hardService) => instance.post(
|
|
2424
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
2387
2425
|
body,
|
|
2388
|
-
headers
|
|
2426
|
+
getHeaders(headers)
|
|
2389
2427
|
).then(responseBody),
|
|
2390
|
-
post_excel: (url, body, headers
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
headers
|
|
2396
|
-
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
2397
|
-
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
2398
|
-
...headers
|
|
2399
|
-
}
|
|
2428
|
+
post_excel: (url, body, headers) => instance.post(formatUrl(getBaseUrl(config?.baseUrl) + url, db), body, {
|
|
2429
|
+
responseType: "arraybuffer",
|
|
2430
|
+
headers: {
|
|
2431
|
+
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
2432
|
+
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
2433
|
+
...headers
|
|
2400
2434
|
}
|
|
2401
|
-
).then(responseBody),
|
|
2402
|
-
put: (url, body, headers,
|
|
2403
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
2435
|
+
}).then(responseBody),
|
|
2436
|
+
put: (url, body, headers, hardService) => instance.put(
|
|
2437
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
2404
2438
|
body,
|
|
2405
|
-
headers
|
|
2439
|
+
getHeaders(headers)
|
|
2406
2440
|
).then(responseBody),
|
|
2407
|
-
patch: (url, body, headers,
|
|
2408
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
2441
|
+
patch: (url, body, headers, hardService) => instance.patch(
|
|
2442
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
2409
2443
|
body,
|
|
2410
|
-
headers
|
|
2444
|
+
getHeaders(headers)
|
|
2411
2445
|
).then(responseBody),
|
|
2412
|
-
delete: (url, headers,
|
|
2413
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
2414
|
-
headers
|
|
2446
|
+
delete: (url, headers, hardService) => instance.delete(
|
|
2447
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
2448
|
+
getHeaders(headers)
|
|
2415
2449
|
).then(responseBody)
|
|
2416
2450
|
};
|
|
2417
2451
|
return requests;
|
|
@@ -2438,7 +2472,7 @@ var EnvStore = class {
|
|
|
2438
2472
|
emitter;
|
|
2439
2473
|
localStorageUtil;
|
|
2440
2474
|
sessionStorageUtil;
|
|
2441
|
-
constructor(localStorageUtil = localStorageUtils(), sessionStorageUtil = sessionStorageUtils
|
|
2475
|
+
constructor(localStorageUtil = localStorageUtils(), sessionStorageUtil = sessionStorageUtils) {
|
|
2442
2476
|
this.state = {
|
|
2443
2477
|
baseUrl: "",
|
|
2444
2478
|
requests: null,
|
|
@@ -2527,7 +2561,7 @@ var EnvStore = class {
|
|
|
2527
2561
|
var env = null;
|
|
2528
2562
|
function initEnv({
|
|
2529
2563
|
localStorageUtils: localStorageUtil = localStorageUtils(),
|
|
2530
|
-
sessionStorageUtils: sessionStorageUtil = sessionStorageUtils
|
|
2564
|
+
sessionStorageUtils: sessionStorageUtil = sessionStorageUtils
|
|
2531
2565
|
}) {
|
|
2532
2566
|
if (!env) {
|
|
2533
2567
|
env = new EnvStore(localStorageUtil, sessionStorageUtil);
|