@fctc/interface-logic 2.3.2 → 2.3.3

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,25 +2227,21 @@ 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;
2235
- let token = null;
2236
2236
  if (useActionToken && actionToken) {
2237
- token = actionToken;
2238
- } else {
2239
- const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
2240
- token = await getToken?.();
2241
- }
2242
- if (token) {
2243
- config2.headers["Authorization"] = `Bearer ${token}`;
2237
+ config2.headers["Action-Token"] = actionToken;
2244
2238
  }
2245
2239
  if (database) {
2246
2240
  config2.headers["DATABASE"] = database;
2247
2241
  }
2242
+ console.log("database", database);
2243
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
2244
+ const token = await getToken?.();
2248
2245
  if (token) config2.headers["Authorization"] = `Bearer ${token}`;
2249
2246
  return config2;
2250
2247
  }, Promise.reject);
@@ -2300,7 +2297,7 @@ var axiosClient = {
2300
2297
  );
2301
2298
  return new Promise(function(resolve) {
2302
2299
  import_axios.default.post(
2303
- `${config?.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2300
+ `${config.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2304
2301
  payload,
2305
2302
  {
2306
2303
  headers: {
@@ -2368,47 +2365,20 @@ var axiosClient = {
2368
2365
  function formatUrl(url, db2) {
2369
2366
  return url + (db2 ? "?db=" + db2 : "");
2370
2367
  }
2371
- const getBaseUrl = (baseUrl, serviceName) => {
2372
- const service = serviceName || config?.default_service;
2373
- return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${service}/api/v2`;
2374
- };
2375
2368
  const responseBody = (response) => response;
2376
2369
  const requests = {
2377
- get: (url, headers, serviceName) => instance.get(
2378
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2379
- headers
2380
- ).then(responseBody),
2381
- post: (url, body, headers, serviceName) => instance.post(
2382
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2383
- body,
2384
- headers
2385
- ).then(responseBody),
2386
- post_excel: (url, body, headers, serviceName) => instance.post(
2387
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2388
- body,
2389
- {
2390
- responseType: "arraybuffer",
2391
- headers: {
2392
- "Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
2393
- Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
2394
- ...headers
2395
- }
2370
+ get: (url, headers) => instance.get(formatUrl(url, db), headers).then(responseBody),
2371
+ post: (url, body, headers) => instance.post(formatUrl(url, db), body, headers).then(responseBody),
2372
+ post_excel: (url, body, headers) => instance.post(formatUrl(url, db), body, {
2373
+ responseType: "arraybuffer",
2374
+ headers: {
2375
+ "Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
2376
+ Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
2396
2377
  }
2397
- ).then(responseBody),
2398
- put: (url, body, headers, serviceName) => instance.put(
2399
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2400
- body,
2401
- headers
2402
- ).then(responseBody),
2403
- patch: (url, body, headers, serviceName) => instance.patch(
2404
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2405
- body,
2406
- headers
2407
- ).then(responseBody),
2408
- delete: (url, headers, serviceName) => instance.delete(
2409
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2410
- headers
2411
- ).then(responseBody)
2378
+ }).then(responseBody),
2379
+ put: (url, body, headers) => instance.put(formatUrl(url, db), body, headers).then(responseBody),
2380
+ patch: (url, body) => instance.patch(formatUrl(url, db), body).then(responseBody),
2381
+ delete: (url, body) => instance.delete(formatUrl(url, db), body).then(responseBody)
2412
2382
  };
2413
2383
  return requests;
2414
2384
  }
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,25 +2191,21 @@ 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;
2199
- let token = null;
2200
2200
  if (useActionToken && actionToken) {
2201
- token = actionToken;
2202
- } else {
2203
- const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
2204
- token = await getToken?.();
2205
- }
2206
- if (token) {
2207
- config2.headers["Authorization"] = `Bearer ${token}`;
2201
+ config2.headers["Action-Token"] = actionToken;
2208
2202
  }
2209
2203
  if (database) {
2210
2204
  config2.headers["DATABASE"] = database;
2211
2205
  }
2206
+ console.log("database", database);
2207
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
2208
+ const token = await getToken?.();
2212
2209
  if (token) config2.headers["Authorization"] = `Bearer ${token}`;
2213
2210
  return config2;
2214
2211
  }, Promise.reject);
@@ -2264,7 +2261,7 @@ var axiosClient = {
2264
2261
  );
2265
2262
  return new Promise(function(resolve) {
2266
2263
  axios.post(
2267
- `${config?.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2264
+ `${config.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2268
2265
  payload,
2269
2266
  {
2270
2267
  headers: {
@@ -2332,47 +2329,20 @@ var axiosClient = {
2332
2329
  function formatUrl(url, db2) {
2333
2330
  return url + (db2 ? "?db=" + db2 : "");
2334
2331
  }
2335
- const getBaseUrl = (baseUrl, serviceName) => {
2336
- const service = serviceName || config?.default_service;
2337
- return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${service}/api/v2`;
2338
- };
2339
2332
  const responseBody = (response) => response;
2340
2333
  const requests = {
2341
- get: (url, headers, serviceName) => instance.get(
2342
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2343
- headers
2344
- ).then(responseBody),
2345
- post: (url, body, headers, serviceName) => instance.post(
2346
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2347
- body,
2348
- headers
2349
- ).then(responseBody),
2350
- post_excel: (url, body, headers, serviceName) => instance.post(
2351
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2352
- body,
2353
- {
2354
- responseType: "arraybuffer",
2355
- headers: {
2356
- "Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
2357
- Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
2358
- ...headers
2359
- }
2334
+ get: (url, headers) => instance.get(formatUrl(url, db), headers).then(responseBody),
2335
+ post: (url, body, headers) => instance.post(formatUrl(url, db), body, headers).then(responseBody),
2336
+ post_excel: (url, body, headers) => instance.post(formatUrl(url, db), body, {
2337
+ responseType: "arraybuffer",
2338
+ headers: {
2339
+ "Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
2340
+ Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
2360
2341
  }
2361
- ).then(responseBody),
2362
- put: (url, body, headers, serviceName) => instance.put(
2363
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2364
- body,
2365
- headers
2366
- ).then(responseBody),
2367
- patch: (url, body, headers, serviceName) => instance.patch(
2368
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2369
- body,
2370
- headers
2371
- ).then(responseBody),
2372
- delete: (url, headers, serviceName) => instance.delete(
2373
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2374
- headers
2375
- ).then(responseBody)
2342
+ }).then(responseBody),
2343
+ put: (url, body, headers) => instance.put(formatUrl(url, db), body, headers).then(responseBody),
2344
+ patch: (url, body) => instance.patch(formatUrl(url, db), body).then(responseBody),
2345
+ delete: (url, body) => instance.delete(formatUrl(url, db), body).then(responseBody)
2376
2346
  };
2377
2347
  return requests;
2378
2348
  }
@@ -35,8 +35,7 @@ declare enum UriConstants {
35
35
  LOAD_ACTION = "/load_action",
36
36
  REPORT_PATH = "/report",
37
37
  RUN_ACTION_PATH = "/run_action",
38
- UPLOAD_FILE_EXCEL_PATH = "/upload/file",
39
- UPLOAD_FILE_PATH = "/web/binary/upload_attachment",
38
+ UPLOAD_FILE_PATH = "/upload/file",
40
39
  GET_MESSAGE = "/chatter/thread/messages",
41
40
  SENT_MESSAGE = "/chatter/message/post",
42
41
  UPLOAD_IMAGE = "/mail/attachment/upload",
@@ -44,7 +43,6 @@ declare enum UriConstants {
44
43
  IMAGE_PATH = "/web/image",
45
44
  LOAD_MESSAGE = "/load_message_failures",
46
45
  TOKEN = "/check_token",
47
- VALIDATE_ACTION_TOKEN = "/action-token/validate",
48
46
  CREATE_UPDATE_PATH = "/create_update",
49
47
  TWOFA_METHOD_PATH = "/id/api/v2/call",
50
48
  SIGNIN_SSO = "/signin-sso/oauth",
@@ -35,8 +35,7 @@ declare enum UriConstants {
35
35
  LOAD_ACTION = "/load_action",
36
36
  REPORT_PATH = "/report",
37
37
  RUN_ACTION_PATH = "/run_action",
38
- UPLOAD_FILE_EXCEL_PATH = "/upload/file",
39
- UPLOAD_FILE_PATH = "/web/binary/upload_attachment",
38
+ UPLOAD_FILE_PATH = "/upload/file",
40
39
  GET_MESSAGE = "/chatter/thread/messages",
41
40
  SENT_MESSAGE = "/chatter/message/post",
42
41
  UPLOAD_IMAGE = "/mail/attachment/upload",
@@ -44,7 +43,6 @@ declare enum UriConstants {
44
43
  IMAGE_PATH = "/web/image",
45
44
  LOAD_MESSAGE = "/load_message_failures",
46
45
  TOKEN = "/check_token",
47
- VALIDATE_ACTION_TOKEN = "/action-token/validate",
48
46
  CREATE_UPDATE_PATH = "/create_update",
49
47
  TWOFA_METHOD_PATH = "/id/api/v2/call",
50
48
  SIGNIN_SSO = "/signin-sso/oauth",
package/dist/constants.js CHANGED
@@ -78,8 +78,7 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
78
78
  UriConstants2["LOAD_ACTION"] = `/load_action`;
79
79
  UriConstants2["REPORT_PATH"] = `/report`;
80
80
  UriConstants2["RUN_ACTION_PATH"] = `/run_action`;
81
- UriConstants2["UPLOAD_FILE_EXCEL_PATH"] = `/upload/file`;
82
- UriConstants2["UPLOAD_FILE_PATH"] = `/web/binary/upload_attachment`;
81
+ UriConstants2["UPLOAD_FILE_PATH"] = `/upload/file`;
83
82
  UriConstants2["GET_MESSAGE"] = `/chatter/thread/messages`;
84
83
  UriConstants2["SENT_MESSAGE"] = `/chatter/message/post`;
85
84
  UriConstants2["UPLOAD_IMAGE"] = `/mail/attachment/upload`;
@@ -87,7 +86,6 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
87
86
  UriConstants2["IMAGE_PATH"] = `/web/image`;
88
87
  UriConstants2["LOAD_MESSAGE"] = `/load_message_failures`;
89
88
  UriConstants2["TOKEN"] = `/check_token`;
90
- UriConstants2["VALIDATE_ACTION_TOKEN"] = `/action-token/validate`;
91
89
  UriConstants2["CREATE_UPDATE_PATH"] = `/create_update`;
92
90
  UriConstants2["TWOFA_METHOD_PATH"] = `/id/api/v2/call`;
93
91
  UriConstants2["SIGNIN_SSO"] = `/signin-sso/oauth`;
@@ -40,8 +40,7 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
40
40
  UriConstants2["LOAD_ACTION"] = `/load_action`;
41
41
  UriConstants2["REPORT_PATH"] = `/report`;
42
42
  UriConstants2["RUN_ACTION_PATH"] = `/run_action`;
43
- UriConstants2["UPLOAD_FILE_EXCEL_PATH"] = `/upload/file`;
44
- UriConstants2["UPLOAD_FILE_PATH"] = `/web/binary/upload_attachment`;
43
+ UriConstants2["UPLOAD_FILE_PATH"] = `/upload/file`;
45
44
  UriConstants2["GET_MESSAGE"] = `/chatter/thread/messages`;
46
45
  UriConstants2["SENT_MESSAGE"] = `/chatter/message/post`;
47
46
  UriConstants2["UPLOAD_IMAGE"] = `/mail/attachment/upload`;
@@ -49,7 +48,6 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
49
48
  UriConstants2["IMAGE_PATH"] = `/web/image`;
50
49
  UriConstants2["LOAD_MESSAGE"] = `/load_message_failures`;
51
50
  UriConstants2["TOKEN"] = `/check_token`;
52
- UriConstants2["VALIDATE_ACTION_TOKEN"] = `/action-token/validate`;
53
51
  UriConstants2["CREATE_UPDATE_PATH"] = `/create_update`;
54
52
  UriConstants2["TWOFA_METHOD_PATH"] = `/id/api/v2/call`;
55
53
  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,25 +2229,21 @@ 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;
2237
- let token = null;
2238
2238
  if (useActionToken && actionToken) {
2239
- token = actionToken;
2240
- } else {
2241
- const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
2242
- token = await getToken?.();
2243
- }
2244
- if (token) {
2245
- config2.headers["Authorization"] = `Bearer ${token}`;
2239
+ config2.headers["Action-Token"] = actionToken;
2246
2240
  }
2247
2241
  if (database) {
2248
2242
  config2.headers["DATABASE"] = database;
2249
2243
  }
2244
+ console.log("database", database);
2245
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
2246
+ const token = await getToken?.();
2250
2247
  if (token) config2.headers["Authorization"] = `Bearer ${token}`;
2251
2248
  return config2;
2252
2249
  }, Promise.reject);
@@ -2302,7 +2299,7 @@ var axiosClient = {
2302
2299
  );
2303
2300
  return new Promise(function(resolve) {
2304
2301
  import_axios.default.post(
2305
- `${config?.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2302
+ `${config.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2306
2303
  payload,
2307
2304
  {
2308
2305
  headers: {
@@ -2370,47 +2367,20 @@ var axiosClient = {
2370
2367
  function formatUrl(url, db2) {
2371
2368
  return url + (db2 ? "?db=" + db2 : "");
2372
2369
  }
2373
- const getBaseUrl = (baseUrl, serviceName) => {
2374
- const service = serviceName || config?.default_service;
2375
- return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${service}/api/v2`;
2376
- };
2377
2370
  const responseBody = (response) => response;
2378
2371
  const requests = {
2379
- get: (url, headers, serviceName) => instance.get(
2380
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2381
- headers
2382
- ).then(responseBody),
2383
- post: (url, body, headers, serviceName) => instance.post(
2384
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2385
- body,
2386
- headers
2387
- ).then(responseBody),
2388
- post_excel: (url, body, headers, serviceName) => instance.post(
2389
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2390
- body,
2391
- {
2392
- responseType: "arraybuffer",
2393
- headers: {
2394
- "Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
2395
- Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
2396
- ...headers
2397
- }
2372
+ get: (url, headers) => instance.get(formatUrl(url, db), headers).then(responseBody),
2373
+ post: (url, body, headers) => instance.post(formatUrl(url, db), body, headers).then(responseBody),
2374
+ post_excel: (url, body, headers) => instance.post(formatUrl(url, db), body, {
2375
+ responseType: "arraybuffer",
2376
+ headers: {
2377
+ "Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
2378
+ Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
2398
2379
  }
2399
- ).then(responseBody),
2400
- put: (url, body, headers, serviceName) => instance.put(
2401
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2402
- body,
2403
- headers
2404
- ).then(responseBody),
2405
- patch: (url, body, headers, serviceName) => instance.patch(
2406
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2407
- body,
2408
- headers
2409
- ).then(responseBody),
2410
- delete: (url, headers, serviceName) => instance.delete(
2411
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2412
- headers
2413
- ).then(responseBody)
2380
+ }).then(responseBody),
2381
+ put: (url, body, headers) => instance.put(formatUrl(url, db), body, headers).then(responseBody),
2382
+ patch: (url, body) => instance.patch(formatUrl(url, db), body).then(responseBody),
2383
+ delete: (url, body) => instance.delete(formatUrl(url, db), body).then(responseBody)
2414
2384
  };
2415
2385
  return requests;
2416
2386
  }
@@ -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,25 +2191,21 @@ 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;
2199
- let token = null;
2200
2200
  if (useActionToken && actionToken) {
2201
- token = actionToken;
2202
- } else {
2203
- const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
2204
- token = await getToken?.();
2205
- }
2206
- if (token) {
2207
- config2.headers["Authorization"] = `Bearer ${token}`;
2201
+ config2.headers["Action-Token"] = actionToken;
2208
2202
  }
2209
2203
  if (database) {
2210
2204
  config2.headers["DATABASE"] = database;
2211
2205
  }
2206
+ console.log("database", database);
2207
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
2208
+ const token = await getToken?.();
2212
2209
  if (token) config2.headers["Authorization"] = `Bearer ${token}`;
2213
2210
  return config2;
2214
2211
  }, Promise.reject);
@@ -2264,7 +2261,7 @@ var axiosClient = {
2264
2261
  );
2265
2262
  return new Promise(function(resolve) {
2266
2263
  axios.post(
2267
- `${config?.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2264
+ `${config.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2268
2265
  payload,
2269
2266
  {
2270
2267
  headers: {
@@ -2332,47 +2329,20 @@ var axiosClient = {
2332
2329
  function formatUrl(url, db2) {
2333
2330
  return url + (db2 ? "?db=" + db2 : "");
2334
2331
  }
2335
- const getBaseUrl = (baseUrl, serviceName) => {
2336
- const service = serviceName || config?.default_service;
2337
- return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${service}/api/v2`;
2338
- };
2339
2332
  const responseBody = (response) => response;
2340
2333
  const requests = {
2341
- get: (url, headers, serviceName) => instance.get(
2342
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2343
- headers
2344
- ).then(responseBody),
2345
- post: (url, body, headers, serviceName) => instance.post(
2346
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2347
- body,
2348
- headers
2349
- ).then(responseBody),
2350
- post_excel: (url, body, headers, serviceName) => instance.post(
2351
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2352
- body,
2353
- {
2354
- responseType: "arraybuffer",
2355
- headers: {
2356
- "Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
2357
- Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
2358
- ...headers
2359
- }
2334
+ get: (url, headers) => instance.get(formatUrl(url, db), headers).then(responseBody),
2335
+ post: (url, body, headers) => instance.post(formatUrl(url, db), body, headers).then(responseBody),
2336
+ post_excel: (url, body, headers) => instance.post(formatUrl(url, db), body, {
2337
+ responseType: "arraybuffer",
2338
+ headers: {
2339
+ "Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
2340
+ Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
2360
2341
  }
2361
- ).then(responseBody),
2362
- put: (url, body, headers, serviceName) => instance.put(
2363
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2364
- body,
2365
- headers
2366
- ).then(responseBody),
2367
- patch: (url, body, headers, serviceName) => instance.patch(
2368
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2369
- body,
2370
- headers
2371
- ).then(responseBody),
2372
- delete: (url, headers, serviceName) => instance.delete(
2373
- formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
2374
- headers
2375
- ).then(responseBody)
2342
+ }).then(responseBody),
2343
+ put: (url, body, headers) => instance.put(formatUrl(url, db), body, headers).then(responseBody),
2344
+ patch: (url, body) => instance.patch(formatUrl(url, db), body).then(responseBody),
2345
+ delete: (url, body) => instance.delete(formatUrl(url, db), body).then(responseBody)
2376
2346
  };
2377
2347
  return requests;
2378
2348
  }