@fctc/interface-logic 2.1.5 → 2.2.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/configs.d.mts +6 -6
- package/dist/configs.d.ts +6 -6
- package/dist/configs.js +44 -22
- package/dist/configs.mjs +44 -22
- package/dist/constants.d.mts +0 -1
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +0 -1
- package/dist/constants.mjs +0 -1
- package/dist/environment.js +44 -22
- package/dist/environment.mjs +44 -22
- package/dist/hooks.d.mts +16 -4
- package/dist/hooks.d.ts +16 -4
- package/dist/hooks.js +199 -96
- package/dist/hooks.mjs +199 -96
- package/dist/provider.d.mts +2 -1
- package/dist/provider.d.ts +2 -1
- package/dist/provider.js +243 -118
- package/dist/provider.mjs +243 -118
- package/dist/services.d.mts +23 -15
- package/dist/services.d.ts +23 -15
- package/dist/services.js +150 -71
- package/dist/services.mjs +150 -71
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/{view-type-BGJfDe73.d.mts → view-type-p4JdAOsz.d.mts} +5 -0
- package/dist/{view-type-BGJfDe73.d.ts → view-type-p4JdAOsz.d.ts} +5 -0
- package/package.json +85 -85
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
|
|
4
|
-
post: (url: string, body: any, headers
|
|
5
|
-
post_excel: (url: string, body: any, headers
|
|
6
|
-
put: (url: string, body: any, headers
|
|
7
|
-
patch: (url: string, body: any) => Promise<any>;
|
|
8
|
-
delete: (url: string,
|
|
3
|
+
get: (url: string, headers?: any, serviceName?: string) => Promise<any>;
|
|
4
|
+
post: (url: string, body: any, headers?: any, serviceName?: string) => Promise<any>;
|
|
5
|
+
post_excel: (url: string, body: any, headers?: any, serviceName?: string) => Promise<any>;
|
|
6
|
+
put: (url: string, body: any, headers?: any, serviceName?: string) => Promise<any>;
|
|
7
|
+
patch: (url: string, body: any, headers?: any, serviceName?: string) => Promise<any>;
|
|
8
|
+
delete: (url: string, headers?: any, serviceName?: 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
|
|
4
|
-
post: (url: string, body: any, headers
|
|
5
|
-
post_excel: (url: string, body: any, headers
|
|
6
|
-
put: (url: string, body: any, headers
|
|
7
|
-
patch: (url: string, body: any) => Promise<any>;
|
|
8
|
-
delete: (url: string,
|
|
3
|
+
get: (url: string, headers?: any, serviceName?: string) => Promise<any>;
|
|
4
|
+
post: (url: string, body: any, headers?: any, serviceName?: string) => Promise<any>;
|
|
5
|
+
post_excel: (url: string, body: any, headers?: any, serviceName?: string) => Promise<any>;
|
|
6
|
+
put: (url: string, body: any, headers?: any, serviceName?: string) => Promise<any>;
|
|
7
|
+
patch: (url: string, body: any, headers?: any, serviceName?: string) => Promise<any>;
|
|
8
|
+
delete: (url: string, headers?: any, serviceName?: string) => Promise<any>;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
11
|
|
package/dist/configs.js
CHANGED
|
@@ -2208,7 +2208,6 @@ var sessionStorageUtils = () => {
|
|
|
2208
2208
|
// src/configs/axios-client.ts
|
|
2209
2209
|
var axiosClient = {
|
|
2210
2210
|
init(config) {
|
|
2211
|
-
console.log("config", config);
|
|
2212
2211
|
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
2213
2212
|
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
|
|
2214
2213
|
const db = config?.db;
|
|
@@ -2227,25 +2226,21 @@ var axiosClient = {
|
|
|
2227
2226
|
};
|
|
2228
2227
|
const instance = import_axios.default.create({
|
|
2229
2228
|
adapter: import_axios.default.defaults.adapter,
|
|
2230
|
-
baseURL: config
|
|
2229
|
+
baseURL: config?.baseUrl,
|
|
2231
2230
|
timeout: 5e4,
|
|
2232
2231
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2233
2232
|
});
|
|
2234
2233
|
instance.interceptors.request.use(async (config2) => {
|
|
2235
2234
|
const { useRefreshToken, useActionToken, actionToken } = config2;
|
|
2236
|
-
let token = null;
|
|
2237
2235
|
if (useActionToken && actionToken) {
|
|
2238
|
-
|
|
2239
|
-
} else {
|
|
2240
|
-
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
2241
|
-
token = await getToken?.();
|
|
2242
|
-
}
|
|
2243
|
-
if (token) {
|
|
2244
|
-
config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2236
|
+
config2.headers["Action-Token"] = actionToken;
|
|
2245
2237
|
}
|
|
2246
2238
|
if (database) {
|
|
2247
2239
|
config2.headers["DATABASE"] = database;
|
|
2248
2240
|
}
|
|
2241
|
+
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
2242
|
+
const token = await getToken?.();
|
|
2243
|
+
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2249
2244
|
return config2;
|
|
2250
2245
|
}, Promise.reject);
|
|
2251
2246
|
instance.interceptors.response.use(
|
|
@@ -2300,7 +2295,7 @@ var axiosClient = {
|
|
|
2300
2295
|
);
|
|
2301
2296
|
return new Promise(function(resolve) {
|
|
2302
2297
|
import_axios.default.post(
|
|
2303
|
-
`${config
|
|
2298
|
+
`${config?.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
|
|
2304
2299
|
payload,
|
|
2305
2300
|
{
|
|
2306
2301
|
headers: {
|
|
@@ -2368,20 +2363,47 @@ var axiosClient = {
|
|
|
2368
2363
|
function formatUrl(url, db2) {
|
|
2369
2364
|
return url + (db2 ? "?db=" + db2 : "");
|
|
2370
2365
|
}
|
|
2366
|
+
const getBaseUrl = (baseUrl, serviceName) => {
|
|
2367
|
+
const service = serviceName || config?.default_service;
|
|
2368
|
+
return `${baseUrl.replace(/\/$/, "")}/${service}/api/v2`;
|
|
2369
|
+
};
|
|
2371
2370
|
const responseBody = (response) => response;
|
|
2372
2371
|
const requests = {
|
|
2373
|
-
get: (url, headers) => instance.get(
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2372
|
+
get: (url, headers, serviceName) => instance.get(
|
|
2373
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2374
|
+
headers
|
|
2375
|
+
).then(responseBody),
|
|
2376
|
+
post: (url, body, headers, serviceName) => instance.post(
|
|
2377
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2378
|
+
body,
|
|
2379
|
+
headers
|
|
2380
|
+
).then(responseBody),
|
|
2381
|
+
post_excel: (url, body, headers, serviceName) => instance.post(
|
|
2382
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2383
|
+
body,
|
|
2384
|
+
{
|
|
2385
|
+
responseType: "arraybuffer",
|
|
2386
|
+
headers: {
|
|
2387
|
+
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
2388
|
+
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
2389
|
+
...headers
|
|
2390
|
+
}
|
|
2380
2391
|
}
|
|
2381
|
-
|
|
2382
|
-
put: (url, body, headers) => instance.put(
|
|
2383
|
-
|
|
2384
|
-
|
|
2392
|
+
).then(responseBody),
|
|
2393
|
+
put: (url, body, headers, serviceName) => instance.put(
|
|
2394
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2395
|
+
body,
|
|
2396
|
+
headers
|
|
2397
|
+
).then(responseBody),
|
|
2398
|
+
patch: (url, body, headers, serviceName) => instance.patch(
|
|
2399
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2400
|
+
body,
|
|
2401
|
+
headers
|
|
2402
|
+
).then(responseBody),
|
|
2403
|
+
delete: (url, headers, serviceName) => instance.delete(
|
|
2404
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2405
|
+
headers
|
|
2406
|
+
).then(responseBody)
|
|
2385
2407
|
};
|
|
2386
2408
|
return requests;
|
|
2387
2409
|
}
|
package/dist/configs.mjs
CHANGED
|
@@ -2172,7 +2172,6 @@ var sessionStorageUtils = () => {
|
|
|
2172
2172
|
// src/configs/axios-client.ts
|
|
2173
2173
|
var axiosClient = {
|
|
2174
2174
|
init(config) {
|
|
2175
|
-
console.log("config", config);
|
|
2176
2175
|
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
2177
2176
|
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
|
|
2178
2177
|
const db = config?.db;
|
|
@@ -2191,25 +2190,21 @@ var axiosClient = {
|
|
|
2191
2190
|
};
|
|
2192
2191
|
const instance = axios.create({
|
|
2193
2192
|
adapter: axios.defaults.adapter,
|
|
2194
|
-
baseURL: config
|
|
2193
|
+
baseURL: config?.baseUrl,
|
|
2195
2194
|
timeout: 5e4,
|
|
2196
2195
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2197
2196
|
});
|
|
2198
2197
|
instance.interceptors.request.use(async (config2) => {
|
|
2199
2198
|
const { useRefreshToken, useActionToken, actionToken } = config2;
|
|
2200
|
-
let token = null;
|
|
2201
2199
|
if (useActionToken && actionToken) {
|
|
2202
|
-
|
|
2203
|
-
} else {
|
|
2204
|
-
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
2205
|
-
token = await getToken?.();
|
|
2206
|
-
}
|
|
2207
|
-
if (token) {
|
|
2208
|
-
config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2200
|
+
config2.headers["Action-Token"] = actionToken;
|
|
2209
2201
|
}
|
|
2210
2202
|
if (database) {
|
|
2211
2203
|
config2.headers["DATABASE"] = database;
|
|
2212
2204
|
}
|
|
2205
|
+
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
2206
|
+
const token = await getToken?.();
|
|
2207
|
+
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2213
2208
|
return config2;
|
|
2214
2209
|
}, Promise.reject);
|
|
2215
2210
|
instance.interceptors.response.use(
|
|
@@ -2264,7 +2259,7 @@ var axiosClient = {
|
|
|
2264
2259
|
);
|
|
2265
2260
|
return new Promise(function(resolve) {
|
|
2266
2261
|
axios.post(
|
|
2267
|
-
`${config
|
|
2262
|
+
`${config?.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
|
|
2268
2263
|
payload,
|
|
2269
2264
|
{
|
|
2270
2265
|
headers: {
|
|
@@ -2332,20 +2327,47 @@ var axiosClient = {
|
|
|
2332
2327
|
function formatUrl(url, db2) {
|
|
2333
2328
|
return url + (db2 ? "?db=" + db2 : "");
|
|
2334
2329
|
}
|
|
2330
|
+
const getBaseUrl = (baseUrl, serviceName) => {
|
|
2331
|
+
const service = serviceName || config?.default_service;
|
|
2332
|
+
return `${baseUrl.replace(/\/$/, "")}/${service}/api/v2`;
|
|
2333
|
+
};
|
|
2335
2334
|
const responseBody = (response) => response;
|
|
2336
2335
|
const requests = {
|
|
2337
|
-
get: (url, headers) => instance.get(
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2336
|
+
get: (url, headers, serviceName) => instance.get(
|
|
2337
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2338
|
+
headers
|
|
2339
|
+
).then(responseBody),
|
|
2340
|
+
post: (url, body, headers, serviceName) => instance.post(
|
|
2341
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2342
|
+
body,
|
|
2343
|
+
headers
|
|
2344
|
+
).then(responseBody),
|
|
2345
|
+
post_excel: (url, body, headers, serviceName) => instance.post(
|
|
2346
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2347
|
+
body,
|
|
2348
|
+
{
|
|
2349
|
+
responseType: "arraybuffer",
|
|
2350
|
+
headers: {
|
|
2351
|
+
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
2352
|
+
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
2353
|
+
...headers
|
|
2354
|
+
}
|
|
2344
2355
|
}
|
|
2345
|
-
|
|
2346
|
-
put: (url, body, headers) => instance.put(
|
|
2347
|
-
|
|
2348
|
-
|
|
2356
|
+
).then(responseBody),
|
|
2357
|
+
put: (url, body, headers, serviceName) => instance.put(
|
|
2358
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2359
|
+
body,
|
|
2360
|
+
headers
|
|
2361
|
+
).then(responseBody),
|
|
2362
|
+
patch: (url, body, headers, serviceName) => instance.patch(
|
|
2363
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2364
|
+
body,
|
|
2365
|
+
headers
|
|
2366
|
+
).then(responseBody),
|
|
2367
|
+
delete: (url, headers, serviceName) => instance.delete(
|
|
2368
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2369
|
+
headers
|
|
2370
|
+
).then(responseBody)
|
|
2349
2371
|
};
|
|
2350
2372
|
return requests;
|
|
2351
2373
|
}
|
package/dist/constants.d.mts
CHANGED
|
@@ -43,7 +43,6 @@ declare enum UriConstants {
|
|
|
43
43
|
IMAGE_PATH = "/web/image",
|
|
44
44
|
LOAD_MESSAGE = "/load_message_failures",
|
|
45
45
|
TOKEN = "/check_token",
|
|
46
|
-
VALIDATE_ACTION_TOKEN = "/action-token/validate",
|
|
47
46
|
CREATE_UPDATE_PATH = "/create_update",
|
|
48
47
|
TWOFA_METHOD_PATH = "/id/api/v2/call",
|
|
49
48
|
SIGNIN_SSO = "/signin-sso/oauth",
|
package/dist/constants.d.ts
CHANGED
|
@@ -43,7 +43,6 @@ declare enum UriConstants {
|
|
|
43
43
|
IMAGE_PATH = "/web/image",
|
|
44
44
|
LOAD_MESSAGE = "/load_message_failures",
|
|
45
45
|
TOKEN = "/check_token",
|
|
46
|
-
VALIDATE_ACTION_TOKEN = "/action-token/validate",
|
|
47
46
|
CREATE_UPDATE_PATH = "/create_update",
|
|
48
47
|
TWOFA_METHOD_PATH = "/id/api/v2/call",
|
|
49
48
|
SIGNIN_SSO = "/signin-sso/oauth",
|
package/dist/constants.js
CHANGED
|
@@ -86,7 +86,6 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
|
86
86
|
UriConstants2["IMAGE_PATH"] = `/web/image`;
|
|
87
87
|
UriConstants2["LOAD_MESSAGE"] = `/load_message_failures`;
|
|
88
88
|
UriConstants2["TOKEN"] = `/check_token`;
|
|
89
|
-
UriConstants2["VALIDATE_ACTION_TOKEN"] = "/action-token/validate";
|
|
90
89
|
UriConstants2["CREATE_UPDATE_PATH"] = `/create_update`;
|
|
91
90
|
UriConstants2["TWOFA_METHOD_PATH"] = `/id/api/v2/call`;
|
|
92
91
|
UriConstants2["SIGNIN_SSO"] = `/signin-sso/oauth`;
|
package/dist/constants.mjs
CHANGED
|
@@ -48,7 +48,6 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
|
48
48
|
UriConstants2["IMAGE_PATH"] = `/web/image`;
|
|
49
49
|
UriConstants2["LOAD_MESSAGE"] = `/load_message_failures`;
|
|
50
50
|
UriConstants2["TOKEN"] = `/check_token`;
|
|
51
|
-
UriConstants2["VALIDATE_ACTION_TOKEN"] = "/action-token/validate";
|
|
52
51
|
UriConstants2["CREATE_UPDATE_PATH"] = `/create_update`;
|
|
53
52
|
UriConstants2["TWOFA_METHOD_PATH"] = `/id/api/v2/call`;
|
|
54
53
|
UriConstants2["SIGNIN_SSO"] = `/signin-sso/oauth`;
|
package/dist/environment.js
CHANGED
|
@@ -2210,7 +2210,6 @@ var sessionStorageUtils = () => {
|
|
|
2210
2210
|
// src/configs/axios-client.ts
|
|
2211
2211
|
var axiosClient = {
|
|
2212
2212
|
init(config) {
|
|
2213
|
-
console.log("config", config);
|
|
2214
2213
|
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
2215
2214
|
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
|
|
2216
2215
|
const db = config?.db;
|
|
@@ -2229,25 +2228,21 @@ var axiosClient = {
|
|
|
2229
2228
|
};
|
|
2230
2229
|
const instance = import_axios.default.create({
|
|
2231
2230
|
adapter: import_axios.default.defaults.adapter,
|
|
2232
|
-
baseURL: config
|
|
2231
|
+
baseURL: config?.baseUrl,
|
|
2233
2232
|
timeout: 5e4,
|
|
2234
2233
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2235
2234
|
});
|
|
2236
2235
|
instance.interceptors.request.use(async (config2) => {
|
|
2237
2236
|
const { useRefreshToken, useActionToken, actionToken } = config2;
|
|
2238
|
-
let token = null;
|
|
2239
2237
|
if (useActionToken && actionToken) {
|
|
2240
|
-
|
|
2241
|
-
} else {
|
|
2242
|
-
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
2243
|
-
token = await getToken?.();
|
|
2244
|
-
}
|
|
2245
|
-
if (token) {
|
|
2246
|
-
config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2238
|
+
config2.headers["Action-Token"] = actionToken;
|
|
2247
2239
|
}
|
|
2248
2240
|
if (database) {
|
|
2249
2241
|
config2.headers["DATABASE"] = database;
|
|
2250
2242
|
}
|
|
2243
|
+
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
2244
|
+
const token = await getToken?.();
|
|
2245
|
+
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2251
2246
|
return config2;
|
|
2252
2247
|
}, Promise.reject);
|
|
2253
2248
|
instance.interceptors.response.use(
|
|
@@ -2302,7 +2297,7 @@ var axiosClient = {
|
|
|
2302
2297
|
);
|
|
2303
2298
|
return new Promise(function(resolve) {
|
|
2304
2299
|
import_axios.default.post(
|
|
2305
|
-
`${config
|
|
2300
|
+
`${config?.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
|
|
2306
2301
|
payload,
|
|
2307
2302
|
{
|
|
2308
2303
|
headers: {
|
|
@@ -2370,20 +2365,47 @@ var axiosClient = {
|
|
|
2370
2365
|
function formatUrl(url, db2) {
|
|
2371
2366
|
return url + (db2 ? "?db=" + db2 : "");
|
|
2372
2367
|
}
|
|
2368
|
+
const getBaseUrl = (baseUrl, serviceName) => {
|
|
2369
|
+
const service = serviceName || config?.default_service;
|
|
2370
|
+
return `${baseUrl.replace(/\/$/, "")}/${service}/api/v2`;
|
|
2371
|
+
};
|
|
2373
2372
|
const responseBody = (response) => response;
|
|
2374
2373
|
const requests = {
|
|
2375
|
-
get: (url, headers) => instance.get(
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2374
|
+
get: (url, headers, serviceName) => instance.get(
|
|
2375
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2376
|
+
headers
|
|
2377
|
+
).then(responseBody),
|
|
2378
|
+
post: (url, body, headers, serviceName) => instance.post(
|
|
2379
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2380
|
+
body,
|
|
2381
|
+
headers
|
|
2382
|
+
).then(responseBody),
|
|
2383
|
+
post_excel: (url, body, headers, serviceName) => instance.post(
|
|
2384
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2385
|
+
body,
|
|
2386
|
+
{
|
|
2387
|
+
responseType: "arraybuffer",
|
|
2388
|
+
headers: {
|
|
2389
|
+
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
2390
|
+
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
2391
|
+
...headers
|
|
2392
|
+
}
|
|
2382
2393
|
}
|
|
2383
|
-
|
|
2384
|
-
put: (url, body, headers) => instance.put(
|
|
2385
|
-
|
|
2386
|
-
|
|
2394
|
+
).then(responseBody),
|
|
2395
|
+
put: (url, body, headers, serviceName) => instance.put(
|
|
2396
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2397
|
+
body,
|
|
2398
|
+
headers
|
|
2399
|
+
).then(responseBody),
|
|
2400
|
+
patch: (url, body, headers, serviceName) => instance.patch(
|
|
2401
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2402
|
+
body,
|
|
2403
|
+
headers
|
|
2404
|
+
).then(responseBody),
|
|
2405
|
+
delete: (url, headers, serviceName) => instance.delete(
|
|
2406
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2407
|
+
headers
|
|
2408
|
+
).then(responseBody)
|
|
2387
2409
|
};
|
|
2388
2410
|
return requests;
|
|
2389
2411
|
}
|
package/dist/environment.mjs
CHANGED
|
@@ -2172,7 +2172,6 @@ var sessionStorageUtils = () => {
|
|
|
2172
2172
|
// src/configs/axios-client.ts
|
|
2173
2173
|
var axiosClient = {
|
|
2174
2174
|
init(config) {
|
|
2175
|
-
console.log("config", config);
|
|
2176
2175
|
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
2177
2176
|
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
|
|
2178
2177
|
const db = config?.db;
|
|
@@ -2191,25 +2190,21 @@ var axiosClient = {
|
|
|
2191
2190
|
};
|
|
2192
2191
|
const instance = axios.create({
|
|
2193
2192
|
adapter: axios.defaults.adapter,
|
|
2194
|
-
baseURL: config
|
|
2193
|
+
baseURL: config?.baseUrl,
|
|
2195
2194
|
timeout: 5e4,
|
|
2196
2195
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2197
2196
|
});
|
|
2198
2197
|
instance.interceptors.request.use(async (config2) => {
|
|
2199
2198
|
const { useRefreshToken, useActionToken, actionToken } = config2;
|
|
2200
|
-
let token = null;
|
|
2201
2199
|
if (useActionToken && actionToken) {
|
|
2202
|
-
|
|
2203
|
-
} else {
|
|
2204
|
-
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
2205
|
-
token = await getToken?.();
|
|
2206
|
-
}
|
|
2207
|
-
if (token) {
|
|
2208
|
-
config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2200
|
+
config2.headers["Action-Token"] = actionToken;
|
|
2209
2201
|
}
|
|
2210
2202
|
if (database) {
|
|
2211
2203
|
config2.headers["DATABASE"] = database;
|
|
2212
2204
|
}
|
|
2205
|
+
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
2206
|
+
const token = await getToken?.();
|
|
2207
|
+
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2213
2208
|
return config2;
|
|
2214
2209
|
}, Promise.reject);
|
|
2215
2210
|
instance.interceptors.response.use(
|
|
@@ -2264,7 +2259,7 @@ var axiosClient = {
|
|
|
2264
2259
|
);
|
|
2265
2260
|
return new Promise(function(resolve) {
|
|
2266
2261
|
axios.post(
|
|
2267
|
-
`${config
|
|
2262
|
+
`${config?.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
|
|
2268
2263
|
payload,
|
|
2269
2264
|
{
|
|
2270
2265
|
headers: {
|
|
@@ -2332,20 +2327,47 @@ var axiosClient = {
|
|
|
2332
2327
|
function formatUrl(url, db2) {
|
|
2333
2328
|
return url + (db2 ? "?db=" + db2 : "");
|
|
2334
2329
|
}
|
|
2330
|
+
const getBaseUrl = (baseUrl, serviceName) => {
|
|
2331
|
+
const service = serviceName || config?.default_service;
|
|
2332
|
+
return `${baseUrl.replace(/\/$/, "")}/${service}/api/v2`;
|
|
2333
|
+
};
|
|
2335
2334
|
const responseBody = (response) => response;
|
|
2336
2335
|
const requests = {
|
|
2337
|
-
get: (url, headers) => instance.get(
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2336
|
+
get: (url, headers, serviceName) => instance.get(
|
|
2337
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2338
|
+
headers
|
|
2339
|
+
).then(responseBody),
|
|
2340
|
+
post: (url, body, headers, serviceName) => instance.post(
|
|
2341
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2342
|
+
body,
|
|
2343
|
+
headers
|
|
2344
|
+
).then(responseBody),
|
|
2345
|
+
post_excel: (url, body, headers, serviceName) => instance.post(
|
|
2346
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2347
|
+
body,
|
|
2348
|
+
{
|
|
2349
|
+
responseType: "arraybuffer",
|
|
2350
|
+
headers: {
|
|
2351
|
+
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
2352
|
+
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
2353
|
+
...headers
|
|
2354
|
+
}
|
|
2344
2355
|
}
|
|
2345
|
-
|
|
2346
|
-
put: (url, body, headers) => instance.put(
|
|
2347
|
-
|
|
2348
|
-
|
|
2356
|
+
).then(responseBody),
|
|
2357
|
+
put: (url, body, headers, serviceName) => instance.put(
|
|
2358
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2359
|
+
body,
|
|
2360
|
+
headers
|
|
2361
|
+
).then(responseBody),
|
|
2362
|
+
patch: (url, body, headers, serviceName) => instance.patch(
|
|
2363
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2364
|
+
body,
|
|
2365
|
+
headers
|
|
2366
|
+
).then(responseBody),
|
|
2367
|
+
delete: (url, headers, serviceName) => instance.delete(
|
|
2368
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2369
|
+
headers
|
|
2370
|
+
).then(responseBody)
|
|
2349
2371
|
};
|
|
2350
2372
|
return requests;
|
|
2351
2373
|
}
|
package/dist/hooks.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import { L as LoginCredentialBody, d as SocialTokenBody, F as ForgotPasswordBody, u as updatePasswordBody, V as ViewData, C as ContextApi, c as GetSelectionType, f as GetViewParams } from './view-type-
|
|
2
|
+
import { L as LoginCredentialBody, d as SocialTokenBody, F as ForgotPasswordBody, u as updatePasswordBody, V as ViewData, C as ContextApi, c as GetSelectionType, f as GetViewParams } from './view-type-p4JdAOsz.mjs';
|
|
3
3
|
|
|
4
4
|
declare const useForgotPassword: () => _tanstack_react_query.UseMutationResult<any, Error, string, unknown>;
|
|
5
5
|
|
|
@@ -38,6 +38,7 @@ declare const useGetAccessByCode: () => _tanstack_react_query.UseMutationResult<
|
|
|
38
38
|
|
|
39
39
|
declare const useValidateActionToken: () => _tanstack_react_query.UseMutationResult<any, Error, {
|
|
40
40
|
actionToken: string;
|
|
41
|
+
path: string;
|
|
41
42
|
}, unknown>;
|
|
42
43
|
|
|
43
44
|
declare const useGetCompanyInfo: () => _tanstack_react_query.UseMutationResult<any, Error, number, unknown>;
|
|
@@ -139,6 +140,7 @@ declare const useUploadImage: () => _tanstack_react_query.UseMutationResult<any,
|
|
|
139
140
|
declare const useDelete: () => _tanstack_react_query.UseMutationResult<any, Error, {
|
|
140
141
|
ids: any;
|
|
141
142
|
model: string;
|
|
143
|
+
service?: string;
|
|
142
144
|
}, unknown>;
|
|
143
145
|
|
|
144
146
|
declare const useGetAll: ({ data, queryKey, viewResponse }: any) => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
@@ -152,10 +154,12 @@ declare const useGetDetail: () => _tanstack_react_query.UseMutationResult<any, E
|
|
|
152
154
|
ids: any;
|
|
153
155
|
specification?: any;
|
|
154
156
|
context?: any;
|
|
157
|
+
service?: string;
|
|
155
158
|
}, unknown>;
|
|
156
159
|
|
|
157
|
-
declare const useGetFieldOnChange: ({ model }: {
|
|
160
|
+
declare const useGetFieldOnChange: ({ model, service, }: {
|
|
158
161
|
model: string;
|
|
162
|
+
service?: string;
|
|
159
163
|
}) => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
160
164
|
|
|
161
165
|
declare const useGetListMyBankAccount: ({ domain, spectification, model, }: {
|
|
@@ -203,6 +207,7 @@ declare const useOnChangeForm: () => _tanstack_react_query.UseMutationResult<any
|
|
|
203
207
|
context: any;
|
|
204
208
|
object: any;
|
|
205
209
|
fieldChange?: any;
|
|
210
|
+
service?: string;
|
|
206
211
|
}, unknown>;
|
|
207
212
|
|
|
208
213
|
declare const useSave: () => _tanstack_react_query.UseMutationResult<any, Error, {
|
|
@@ -212,6 +217,7 @@ declare const useSave: () => _tanstack_react_query.UseMutationResult<any, Error,
|
|
|
212
217
|
specification?: any;
|
|
213
218
|
context: any;
|
|
214
219
|
path?: string;
|
|
220
|
+
service?: string;
|
|
215
221
|
}, unknown>;
|
|
216
222
|
|
|
217
223
|
declare const useGetProfile: (path?: string) => _tanstack_react_query.UseMutationResult<any, Error, void, unknown>;
|
|
@@ -234,12 +240,14 @@ declare const useButton: () => _tanstack_react_query.UseMutationResult<any, Erro
|
|
|
234
240
|
ids: Record<string, any>[] | any;
|
|
235
241
|
context: ContextApi;
|
|
236
242
|
method: any;
|
|
243
|
+
service?: string;
|
|
237
244
|
}, unknown>;
|
|
238
245
|
|
|
239
246
|
declare const useDuplicateRecord: () => _tanstack_react_query.UseMutationResult<any, Error, {
|
|
240
247
|
id: any;
|
|
241
248
|
model: string;
|
|
242
249
|
context: ContextApi;
|
|
250
|
+
service?: string;
|
|
243
251
|
}, unknown>;
|
|
244
252
|
|
|
245
253
|
declare const useGetActionDetail: ({ aid, context, enabled, id, model, queryKey, }: {
|
|
@@ -258,7 +266,7 @@ declare const useGetGroups: ({ model, width_context, }: {
|
|
|
258
266
|
width_context: any;
|
|
259
267
|
}) => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
260
268
|
|
|
261
|
-
declare const useGetListData: (listDataProps: any, queryKey?: any, enabled?: any) => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
269
|
+
declare const useGetListData: (listDataProps: any, queryKey?: any, enabled?: any, service?: string) => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
262
270
|
|
|
263
271
|
declare const useGetMenu: (context: any, specification: any, enabled?: boolean) => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
264
272
|
|
|
@@ -273,10 +281,11 @@ declare const useGetProGressBar: ({ field, color, model, width_context, }: {
|
|
|
273
281
|
width_context: string;
|
|
274
282
|
}) => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
275
283
|
|
|
276
|
-
declare const useGetSelection: ({ data, queryKey, enabled, }: {
|
|
284
|
+
declare const useGetSelection: ({ data, queryKey, enabled, service }: {
|
|
277
285
|
data: GetSelectionType;
|
|
278
286
|
queryKey: any[];
|
|
279
287
|
enabled?: boolean;
|
|
288
|
+
service?: string;
|
|
280
289
|
}) => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
281
290
|
|
|
282
291
|
declare const useGetView: (viewParams: GetViewParams, actData?: any) => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
@@ -284,6 +293,7 @@ declare const useGetView: (viewParams: GetViewParams, actData?: any) => _tanstac
|
|
|
284
293
|
declare const useLoadAction: () => _tanstack_react_query.UseMutationResult<any, Error, {
|
|
285
294
|
idAction: any;
|
|
286
295
|
context: ContextApi;
|
|
296
|
+
service?: string;
|
|
287
297
|
}, unknown>;
|
|
288
298
|
|
|
289
299
|
declare const useLoadMessage: () => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
@@ -298,6 +308,7 @@ declare const useRemoveRow: () => _tanstack_react_query.UseMutationResult<any, E
|
|
|
298
308
|
model: string;
|
|
299
309
|
ids: Record<string, any>[] | any;
|
|
300
310
|
context: ContextApi;
|
|
311
|
+
service?: string;
|
|
301
312
|
}, unknown>;
|
|
302
313
|
|
|
303
314
|
declare const useGetResequence: (model: string, resIds: any, context: any, offset: any) => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
@@ -305,6 +316,7 @@ declare const useGetResequence: (model: string, resIds: any, context: any, offse
|
|
|
305
316
|
declare const useRunAction: () => _tanstack_react_query.UseMutationResult<any, Error, {
|
|
306
317
|
idAction: any;
|
|
307
318
|
context: ContextApi;
|
|
319
|
+
service?: string;
|
|
308
320
|
}, unknown>;
|
|
309
321
|
|
|
310
322
|
declare const useSignInSSO: () => _tanstack_react_query.UseMutationResult<any, Error, {
|