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