@fctc/interface-logic 3.8.6 → 3.8.8

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.js CHANGED
@@ -2280,8 +2280,6 @@ var axiosClient = {
2280
2280
  const useRefreshToken = config2.headers["X-Use-Refresh-Token"] === "true";
2281
2281
  const useActionToken = config2.headers["X-Use-Action-Token"] === "true";
2282
2282
  const actionToken = config2.headers["X-Action-Token"];
2283
- console.log("config", config2);
2284
- console.log("useRefreshToken", useRefreshToken);
2285
2283
  let token = null;
2286
2284
  if (useActionToken && actionToken) {
2287
2285
  token = actionToken;
@@ -2326,7 +2324,6 @@ var axiosClient = {
2326
2324
  originalRequest,
2327
2325
  token
2328
2326
  );
2329
- ensureApiV2(originalRequest);
2330
2327
  return instance.request(originalRequest);
2331
2328
  }).catch(async (err) => {
2332
2329
  if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
@@ -2350,16 +2347,13 @@ var axiosClient = {
2350
2347
  }).filter(([_, value]) => !!value)
2351
2348
  );
2352
2349
  return new Promise(function(resolve) {
2353
- import_axios.default.post(
2354
- `${config?.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2355
- payload,
2356
- {
2357
- headers: {
2358
- "Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
2359
- Authorization: `Bearer ${accessTokenExp}`
2360
- }
2350
+ const refreshPath = config.refreshTokenEndpoint ? config.refreshTokenEndpoint : `/api/v2${"/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`;
2351
+ import_axios.default.post(`${config?.baseUrl}${refreshPath}`, payload, {
2352
+ headers: {
2353
+ "Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
2354
+ Authorization: `Bearer ${accessTokenExp}`
2361
2355
  }
2362
- ).then(async (res) => {
2356
+ }).then(async (res) => {
2363
2357
  const data = res.data;
2364
2358
  await localStorage2.setToken(data.access_token);
2365
2359
  await localStorage2.setRefreshToken(data.refresh_token);
@@ -2407,22 +2401,6 @@ var axiosClient = {
2407
2401
  window.location.href = `/login`;
2408
2402
  }
2409
2403
  };
2410
- const ensureApiV2 = (req) => {
2411
- try {
2412
- const baseUrl = (config?.baseUrl || "").replace(/\/$/, "");
2413
- const u = String(req?.url || "");
2414
- if (/\/api\/v2(\/|$)/.test(u)) return req;
2415
- const baseUrlEscaped = baseUrl.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
2416
- const stripped = u.replace(new RegExp(`^${baseUrlEscaped}`), "");
2417
- const hardService = req?.headers?.["X-Hard-Service"] || req?.headers?.["x-hard-service"];
2418
- const prefix = getBaseUrl(baseUrl, hardService).replace(/\/$/, "");
2419
- const path = (stripped || u || "").replace(/^\/+/, "");
2420
- req.url = `${prefix}/${path}`;
2421
- req.baseURL = void 0;
2422
- } catch (_e) {
2423
- }
2424
- return req;
2425
- };
2426
2404
  function formatUrl(url, db2) {
2427
2405
  return url + (db2 ? "?db=" + db2 : "");
2428
2406
  }
package/dist/configs.mjs CHANGED
@@ -2244,8 +2244,6 @@ var axiosClient = {
2244
2244
  const useRefreshToken = config2.headers["X-Use-Refresh-Token"] === "true";
2245
2245
  const useActionToken = config2.headers["X-Use-Action-Token"] === "true";
2246
2246
  const actionToken = config2.headers["X-Action-Token"];
2247
- console.log("config", config2);
2248
- console.log("useRefreshToken", useRefreshToken);
2249
2247
  let token = null;
2250
2248
  if (useActionToken && actionToken) {
2251
2249
  token = actionToken;
@@ -2290,7 +2288,6 @@ var axiosClient = {
2290
2288
  originalRequest,
2291
2289
  token
2292
2290
  );
2293
- ensureApiV2(originalRequest);
2294
2291
  return instance.request(originalRequest);
2295
2292
  }).catch(async (err) => {
2296
2293
  if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
@@ -2314,16 +2311,13 @@ var axiosClient = {
2314
2311
  }).filter(([_, value]) => !!value)
2315
2312
  );
2316
2313
  return new Promise(function(resolve) {
2317
- axios.post(
2318
- `${config?.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2319
- payload,
2320
- {
2321
- headers: {
2322
- "Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
2323
- Authorization: `Bearer ${accessTokenExp}`
2324
- }
2314
+ const refreshPath = config.refreshTokenEndpoint ? config.refreshTokenEndpoint : `/api/v2${"/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`;
2315
+ axios.post(`${config?.baseUrl}${refreshPath}`, payload, {
2316
+ headers: {
2317
+ "Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
2318
+ Authorization: `Bearer ${accessTokenExp}`
2325
2319
  }
2326
- ).then(async (res) => {
2320
+ }).then(async (res) => {
2327
2321
  const data = res.data;
2328
2322
  await localStorage2.setToken(data.access_token);
2329
2323
  await localStorage2.setRefreshToken(data.refresh_token);
@@ -2371,22 +2365,6 @@ var axiosClient = {
2371
2365
  window.location.href = `/login`;
2372
2366
  }
2373
2367
  };
2374
- const ensureApiV2 = (req) => {
2375
- try {
2376
- const baseUrl = (config?.baseUrl || "").replace(/\/$/, "");
2377
- const u = String(req?.url || "");
2378
- if (/\/api\/v2(\/|$)/.test(u)) return req;
2379
- const baseUrlEscaped = baseUrl.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
2380
- const stripped = u.replace(new RegExp(`^${baseUrlEscaped}`), "");
2381
- const hardService = req?.headers?.["X-Hard-Service"] || req?.headers?.["x-hard-service"];
2382
- const prefix = getBaseUrl(baseUrl, hardService).replace(/\/$/, "");
2383
- const path = (stripped || u || "").replace(/^\/+/, "");
2384
- req.url = `${prefix}/${path}`;
2385
- req.baseURL = void 0;
2386
- } catch (_e) {
2387
- }
2388
- return req;
2389
- };
2390
2368
  function formatUrl(url, db2) {
2391
2369
  return url + (db2 ? "?db=" + db2 : "");
2392
2370
  }
@@ -2282,8 +2282,6 @@ var axiosClient = {
2282
2282
  const useRefreshToken = config2.headers["X-Use-Refresh-Token"] === "true";
2283
2283
  const useActionToken = config2.headers["X-Use-Action-Token"] === "true";
2284
2284
  const actionToken = config2.headers["X-Action-Token"];
2285
- console.log("config", config2);
2286
- console.log("useRefreshToken", useRefreshToken);
2287
2285
  let token = null;
2288
2286
  if (useActionToken && actionToken) {
2289
2287
  token = actionToken;
@@ -2328,7 +2326,6 @@ var axiosClient = {
2328
2326
  originalRequest,
2329
2327
  token
2330
2328
  );
2331
- ensureApiV2(originalRequest);
2332
2329
  return instance.request(originalRequest);
2333
2330
  }).catch(async (err) => {
2334
2331
  if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
@@ -2352,16 +2349,13 @@ var axiosClient = {
2352
2349
  }).filter(([_, value]) => !!value)
2353
2350
  );
2354
2351
  return new Promise(function(resolve) {
2355
- import_axios.default.post(
2356
- `${config?.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2357
- payload,
2358
- {
2359
- headers: {
2360
- "Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
2361
- Authorization: `Bearer ${accessTokenExp}`
2362
- }
2352
+ const refreshPath = config.refreshTokenEndpoint ? config.refreshTokenEndpoint : `/api/v2${"/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`;
2353
+ import_axios.default.post(`${config?.baseUrl}${refreshPath}`, payload, {
2354
+ headers: {
2355
+ "Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
2356
+ Authorization: `Bearer ${accessTokenExp}`
2363
2357
  }
2364
- ).then(async (res) => {
2358
+ }).then(async (res) => {
2365
2359
  const data = res.data;
2366
2360
  await localStorage2.setToken(data.access_token);
2367
2361
  await localStorage2.setRefreshToken(data.refresh_token);
@@ -2409,22 +2403,6 @@ var axiosClient = {
2409
2403
  window.location.href = `/login`;
2410
2404
  }
2411
2405
  };
2412
- const ensureApiV2 = (req) => {
2413
- try {
2414
- const baseUrl = (config?.baseUrl || "").replace(/\/$/, "");
2415
- const u = String(req?.url || "");
2416
- if (/\/api\/v2(\/|$)/.test(u)) return req;
2417
- const baseUrlEscaped = baseUrl.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
2418
- const stripped = u.replace(new RegExp(`^${baseUrlEscaped}`), "");
2419
- const hardService = req?.headers?.["X-Hard-Service"] || req?.headers?.["x-hard-service"];
2420
- const prefix = getBaseUrl(baseUrl, hardService).replace(/\/$/, "");
2421
- const path = (stripped || u || "").replace(/^\/+/, "");
2422
- req.url = `${prefix}/${path}`;
2423
- req.baseURL = void 0;
2424
- } catch (_e) {
2425
- }
2426
- return req;
2427
- };
2428
2406
  function formatUrl(url, db2) {
2429
2407
  return url + (db2 ? "?db=" + db2 : "");
2430
2408
  }
@@ -2244,8 +2244,6 @@ var axiosClient = {
2244
2244
  const useRefreshToken = config2.headers["X-Use-Refresh-Token"] === "true";
2245
2245
  const useActionToken = config2.headers["X-Use-Action-Token"] === "true";
2246
2246
  const actionToken = config2.headers["X-Action-Token"];
2247
- console.log("config", config2);
2248
- console.log("useRefreshToken", useRefreshToken);
2249
2247
  let token = null;
2250
2248
  if (useActionToken && actionToken) {
2251
2249
  token = actionToken;
@@ -2290,7 +2288,6 @@ var axiosClient = {
2290
2288
  originalRequest,
2291
2289
  token
2292
2290
  );
2293
- ensureApiV2(originalRequest);
2294
2291
  return instance.request(originalRequest);
2295
2292
  }).catch(async (err) => {
2296
2293
  if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
@@ -2314,16 +2311,13 @@ var axiosClient = {
2314
2311
  }).filter(([_, value]) => !!value)
2315
2312
  );
2316
2313
  return new Promise(function(resolve) {
2317
- axios.post(
2318
- `${config?.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2319
- payload,
2320
- {
2321
- headers: {
2322
- "Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
2323
- Authorization: `Bearer ${accessTokenExp}`
2324
- }
2314
+ const refreshPath = config.refreshTokenEndpoint ? config.refreshTokenEndpoint : `/api/v2${"/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`;
2315
+ axios.post(`${config?.baseUrl}${refreshPath}`, payload, {
2316
+ headers: {
2317
+ "Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
2318
+ Authorization: `Bearer ${accessTokenExp}`
2325
2319
  }
2326
- ).then(async (res) => {
2320
+ }).then(async (res) => {
2327
2321
  const data = res.data;
2328
2322
  await localStorage2.setToken(data.access_token);
2329
2323
  await localStorage2.setRefreshToken(data.refresh_token);
@@ -2371,22 +2365,6 @@ var axiosClient = {
2371
2365
  window.location.href = `/login`;
2372
2366
  }
2373
2367
  };
2374
- const ensureApiV2 = (req) => {
2375
- try {
2376
- const baseUrl = (config?.baseUrl || "").replace(/\/$/, "");
2377
- const u = String(req?.url || "");
2378
- if (/\/api\/v2(\/|$)/.test(u)) return req;
2379
- const baseUrlEscaped = baseUrl.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
2380
- const stripped = u.replace(new RegExp(`^${baseUrlEscaped}`), "");
2381
- const hardService = req?.headers?.["X-Hard-Service"] || req?.headers?.["x-hard-service"];
2382
- const prefix = getBaseUrl(baseUrl, hardService).replace(/\/$/, "");
2383
- const path = (stripped || u || "").replace(/^\/+/, "");
2384
- req.url = `${prefix}/${path}`;
2385
- req.baseURL = void 0;
2386
- } catch (_e) {
2387
- }
2388
- return req;
2389
- };
2390
2368
  function formatUrl(url, db2) {
2391
2369
  return url + (db2 ? "?db=" + db2 : "");
2392
2370
  }
package/dist/provider.js CHANGED
@@ -5919,8 +5919,6 @@ var axiosClient = {
5919
5919
  const useRefreshToken = config2.headers["X-Use-Refresh-Token"] === "true";
5920
5920
  const useActionToken = config2.headers["X-Use-Action-Token"] === "true";
5921
5921
  const actionToken = config2.headers["X-Action-Token"];
5922
- console.log("config", config2);
5923
- console.log("useRefreshToken", useRefreshToken);
5924
5922
  let token = null;
5925
5923
  if (useActionToken && actionToken) {
5926
5924
  token = actionToken;
@@ -5965,7 +5963,6 @@ var axiosClient = {
5965
5963
  originalRequest,
5966
5964
  token
5967
5965
  );
5968
- ensureApiV2(originalRequest);
5969
5966
  return instance.request(originalRequest);
5970
5967
  }).catch(async (err) => {
5971
5968
  if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
@@ -5989,16 +5986,13 @@ var axiosClient = {
5989
5986
  }).filter(([_, value]) => !!value)
5990
5987
  );
5991
5988
  return new Promise(function(resolve) {
5992
- import_axios.default.post(
5993
- `${config?.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
5994
- payload,
5995
- {
5996
- headers: {
5997
- "Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
5998
- Authorization: `Bearer ${accessTokenExp}`
5999
- }
5989
+ const refreshPath = config.refreshTokenEndpoint ? config.refreshTokenEndpoint : `/api/v2${"/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`;
5990
+ import_axios.default.post(`${config?.baseUrl}${refreshPath}`, payload, {
5991
+ headers: {
5992
+ "Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
5993
+ Authorization: `Bearer ${accessTokenExp}`
6000
5994
  }
6001
- ).then(async (res) => {
5995
+ }).then(async (res) => {
6002
5996
  const data = res.data;
6003
5997
  await localStorage2.setToken(data.access_token);
6004
5998
  await localStorage2.setRefreshToken(data.refresh_token);
@@ -6046,22 +6040,6 @@ var axiosClient = {
6046
6040
  window.location.href = `/login`;
6047
6041
  }
6048
6042
  };
6049
- const ensureApiV2 = (req) => {
6050
- try {
6051
- const baseUrl = (config?.baseUrl || "").replace(/\/$/, "");
6052
- const u = String(req?.url || "");
6053
- if (/\/api\/v2(\/|$)/.test(u)) return req;
6054
- const baseUrlEscaped = baseUrl.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
6055
- const stripped = u.replace(new RegExp(`^${baseUrlEscaped}`), "");
6056
- const hardService = req?.headers?.["X-Hard-Service"] || req?.headers?.["x-hard-service"];
6057
- const prefix = getBaseUrl(baseUrl, hardService).replace(/\/$/, "");
6058
- const path = (stripped || u || "").replace(/^\/+/, "");
6059
- req.url = `${prefix}/${path}`;
6060
- req.baseURL = void 0;
6061
- } catch (_e) {
6062
- }
6063
- return req;
6064
- };
6065
6043
  function formatUrl(url, db2) {
6066
6044
  return url + (db2 ? "?db=" + db2 : "");
6067
6045
  }
package/dist/provider.mjs CHANGED
@@ -5876,8 +5876,6 @@ var axiosClient = {
5876
5876
  const useRefreshToken = config2.headers["X-Use-Refresh-Token"] === "true";
5877
5877
  const useActionToken = config2.headers["X-Use-Action-Token"] === "true";
5878
5878
  const actionToken = config2.headers["X-Action-Token"];
5879
- console.log("config", config2);
5880
- console.log("useRefreshToken", useRefreshToken);
5881
5879
  let token = null;
5882
5880
  if (useActionToken && actionToken) {
5883
5881
  token = actionToken;
@@ -5922,7 +5920,6 @@ var axiosClient = {
5922
5920
  originalRequest,
5923
5921
  token
5924
5922
  );
5925
- ensureApiV2(originalRequest);
5926
5923
  return instance.request(originalRequest);
5927
5924
  }).catch(async (err) => {
5928
5925
  if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
@@ -5946,16 +5943,13 @@ var axiosClient = {
5946
5943
  }).filter(([_, value]) => !!value)
5947
5944
  );
5948
5945
  return new Promise(function(resolve) {
5949
- axios.post(
5950
- `${config?.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
5951
- payload,
5952
- {
5953
- headers: {
5954
- "Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
5955
- Authorization: `Bearer ${accessTokenExp}`
5956
- }
5946
+ const refreshPath = config.refreshTokenEndpoint ? config.refreshTokenEndpoint : `/api/v2${"/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`;
5947
+ axios.post(`${config?.baseUrl}${refreshPath}`, payload, {
5948
+ headers: {
5949
+ "Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
5950
+ Authorization: `Bearer ${accessTokenExp}`
5957
5951
  }
5958
- ).then(async (res) => {
5952
+ }).then(async (res) => {
5959
5953
  const data = res.data;
5960
5954
  await localStorage2.setToken(data.access_token);
5961
5955
  await localStorage2.setRefreshToken(data.refresh_token);
@@ -6003,22 +5997,6 @@ var axiosClient = {
6003
5997
  window.location.href = `/login`;
6004
5998
  }
6005
5999
  };
6006
- const ensureApiV2 = (req) => {
6007
- try {
6008
- const baseUrl = (config?.baseUrl || "").replace(/\/$/, "");
6009
- const u = String(req?.url || "");
6010
- if (/\/api\/v2(\/|$)/.test(u)) return req;
6011
- const baseUrlEscaped = baseUrl.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
6012
- const stripped = u.replace(new RegExp(`^${baseUrlEscaped}`), "");
6013
- const hardService = req?.headers?.["X-Hard-Service"] || req?.headers?.["x-hard-service"];
6014
- const prefix = getBaseUrl(baseUrl, hardService).replace(/\/$/, "");
6015
- const path = (stripped || u || "").replace(/^\/+/, "");
6016
- req.url = `${prefix}/${path}`;
6017
- req.baseURL = void 0;
6018
- } catch (_e) {
6019
- }
6020
- return req;
6021
- };
6022
6000
  function formatUrl(url, db2) {
6023
6001
  return url + (db2 ? "?db=" + db2 : "");
6024
6002
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fctc/interface-logic",
3
- "version": "3.8.6",
3
+ "version": "3.8.8",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",