@fctc/interface-logic 2.1.4 → 2.2.0
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/environment.js +44 -22
- package/dist/environment.mjs +44 -22
- package/dist/hooks.d.mts +15 -4
- package/dist/hooks.d.ts +15 -4
- package/dist/hooks.js +191 -91
- package/dist/hooks.mjs +191 -91
- package/dist/provider.d.mts +2 -1
- package/dist/provider.d.ts +2 -1
- package/dist/provider.js +235 -113
- package/dist/provider.mjs +235 -113
- package/dist/services.d.mts +22 -14
- package/dist/services.d.ts +22 -14
- package/dist/services.js +148 -68
- package/dist/services.mjs +148 -68
- 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/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
|
|
|
@@ -140,6 +140,7 @@ declare const useUploadImage: () => _tanstack_react_query.UseMutationResult<any,
|
|
|
140
140
|
declare const useDelete: () => _tanstack_react_query.UseMutationResult<any, Error, {
|
|
141
141
|
ids: any;
|
|
142
142
|
model: string;
|
|
143
|
+
service?: string;
|
|
143
144
|
}, unknown>;
|
|
144
145
|
|
|
145
146
|
declare const useGetAll: ({ data, queryKey, viewResponse }: any) => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
@@ -153,10 +154,12 @@ declare const useGetDetail: () => _tanstack_react_query.UseMutationResult<any, E
|
|
|
153
154
|
ids: any;
|
|
154
155
|
specification?: any;
|
|
155
156
|
context?: any;
|
|
157
|
+
service?: string;
|
|
156
158
|
}, unknown>;
|
|
157
159
|
|
|
158
|
-
declare const useGetFieldOnChange: ({ model }: {
|
|
160
|
+
declare const useGetFieldOnChange: ({ model, service, }: {
|
|
159
161
|
model: string;
|
|
162
|
+
service?: string;
|
|
160
163
|
}) => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
161
164
|
|
|
162
165
|
declare const useGetListMyBankAccount: ({ domain, spectification, model, }: {
|
|
@@ -204,6 +207,7 @@ declare const useOnChangeForm: () => _tanstack_react_query.UseMutationResult<any
|
|
|
204
207
|
context: any;
|
|
205
208
|
object: any;
|
|
206
209
|
fieldChange?: any;
|
|
210
|
+
service?: string;
|
|
207
211
|
}, unknown>;
|
|
208
212
|
|
|
209
213
|
declare const useSave: () => _tanstack_react_query.UseMutationResult<any, Error, {
|
|
@@ -213,6 +217,7 @@ declare const useSave: () => _tanstack_react_query.UseMutationResult<any, Error,
|
|
|
213
217
|
specification?: any;
|
|
214
218
|
context: any;
|
|
215
219
|
path?: string;
|
|
220
|
+
service?: string;
|
|
216
221
|
}, unknown>;
|
|
217
222
|
|
|
218
223
|
declare const useGetProfile: (path?: string) => _tanstack_react_query.UseMutationResult<any, Error, void, unknown>;
|
|
@@ -235,12 +240,14 @@ declare const useButton: () => _tanstack_react_query.UseMutationResult<any, Erro
|
|
|
235
240
|
ids: Record<string, any>[] | any;
|
|
236
241
|
context: ContextApi;
|
|
237
242
|
method: any;
|
|
243
|
+
service?: string;
|
|
238
244
|
}, unknown>;
|
|
239
245
|
|
|
240
246
|
declare const useDuplicateRecord: () => _tanstack_react_query.UseMutationResult<any, Error, {
|
|
241
247
|
id: any;
|
|
242
248
|
model: string;
|
|
243
249
|
context: ContextApi;
|
|
250
|
+
service?: string;
|
|
244
251
|
}, unknown>;
|
|
245
252
|
|
|
246
253
|
declare const useGetActionDetail: ({ aid, context, enabled, id, model, queryKey, }: {
|
|
@@ -259,7 +266,7 @@ declare const useGetGroups: ({ model, width_context, }: {
|
|
|
259
266
|
width_context: any;
|
|
260
267
|
}) => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
261
268
|
|
|
262
|
-
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>;
|
|
263
270
|
|
|
264
271
|
declare const useGetMenu: (context: any, specification: any, enabled?: boolean) => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
265
272
|
|
|
@@ -274,10 +281,11 @@ declare const useGetProGressBar: ({ field, color, model, width_context, }: {
|
|
|
274
281
|
width_context: string;
|
|
275
282
|
}) => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
276
283
|
|
|
277
|
-
declare const useGetSelection: ({ data, queryKey, enabled, }: {
|
|
284
|
+
declare const useGetSelection: ({ data, queryKey, enabled, service }: {
|
|
278
285
|
data: GetSelectionType;
|
|
279
286
|
queryKey: any[];
|
|
280
287
|
enabled?: boolean;
|
|
288
|
+
service?: string;
|
|
281
289
|
}) => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
282
290
|
|
|
283
291
|
declare const useGetView: (viewParams: GetViewParams, actData?: any) => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
@@ -285,6 +293,7 @@ declare const useGetView: (viewParams: GetViewParams, actData?: any) => _tanstac
|
|
|
285
293
|
declare const useLoadAction: () => _tanstack_react_query.UseMutationResult<any, Error, {
|
|
286
294
|
idAction: any;
|
|
287
295
|
context: ContextApi;
|
|
296
|
+
service?: string;
|
|
288
297
|
}, unknown>;
|
|
289
298
|
|
|
290
299
|
declare const useLoadMessage: () => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
@@ -299,6 +308,7 @@ declare const useRemoveRow: () => _tanstack_react_query.UseMutationResult<any, E
|
|
|
299
308
|
model: string;
|
|
300
309
|
ids: Record<string, any>[] | any;
|
|
301
310
|
context: ContextApi;
|
|
311
|
+
service?: string;
|
|
302
312
|
}, unknown>;
|
|
303
313
|
|
|
304
314
|
declare const useGetResequence: (model: string, resIds: any, context: any, offset: any) => _tanstack_react_query.UseQueryResult<any, Error>;
|
|
@@ -306,6 +316,7 @@ declare const useGetResequence: (model: string, resIds: any, context: any, offse
|
|
|
306
316
|
declare const useRunAction: () => _tanstack_react_query.UseMutationResult<any, Error, {
|
|
307
317
|
idAction: any;
|
|
308
318
|
context: ContextApi;
|
|
319
|
+
service?: string;
|
|
309
320
|
}, unknown>;
|
|
310
321
|
|
|
311
322
|
declare const useSignInSSO: () => _tanstack_react_query.UseMutationResult<any, Error, {
|