@fctc/interface-logic 1.5.8 → 1.6.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/services.js CHANGED
@@ -1,27 +1,10 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
6
  var __getProtoOf = Object.getPrototypeOf;
9
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __pow = Math.pow;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {}))
15
- if (__hasOwnProp.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- if (__getOwnPropSymbols)
18
- for (var prop of __getOwnPropSymbols(b)) {
19
- if (__propIsEnum.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- }
22
- return a;
23
- };
24
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
8
  var __export = (target, all) => {
26
9
  for (var name in all)
27
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -43,26 +26,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
43
26
  mod
44
27
  ));
45
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
46
- var __async = (__this, __arguments, generator) => {
47
- return new Promise((resolve, reject) => {
48
- var fulfilled = (value) => {
49
- try {
50
- step(generator.next(value));
51
- } catch (e) {
52
- reject(e);
53
- }
54
- };
55
- var rejected = (value) => {
56
- try {
57
- step(generator.throw(value));
58
- } catch (e) {
59
- reject(e);
60
- }
61
- };
62
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
63
- step((generator = generator.apply(__this, __arguments)).next());
64
- });
65
- };
66
29
 
67
30
  // src/services.ts
68
31
  var services_exports = {};
@@ -1193,6 +1156,22 @@ var PyRelativeDelta = class _PyRelativeDelta {
1193
1156
  this.microsecond = params.microsecond;
1194
1157
  this.weekday = params.weekday;
1195
1158
  }
1159
+ years;
1160
+ months;
1161
+ days;
1162
+ hours;
1163
+ minutes;
1164
+ seconds;
1165
+ microseconds;
1166
+ leapDays;
1167
+ year;
1168
+ month;
1169
+ day;
1170
+ hour;
1171
+ minute;
1172
+ second;
1173
+ microsecond;
1174
+ weekday;
1196
1175
  negate() {
1197
1176
  return new _PyRelativeDelta(this, -1);
1198
1177
  }
@@ -1307,7 +1286,7 @@ function execOnIterable(iterable, func) {
1307
1286
  if (typeof iterable === "object" && !Array.isArray(iterable) && !(iterable instanceof Set)) {
1308
1287
  iterable = Object.keys(iterable);
1309
1288
  }
1310
- if (typeof (iterable == null ? void 0 : iterable[Symbol.iterator]) !== "function") {
1289
+ if (typeof iterable?.[Symbol.iterator] !== "function") {
1311
1290
  throw new EvaluationError("value not iterable");
1312
1291
  }
1313
1292
  return func(iterable);
@@ -1630,7 +1609,7 @@ function applyBinaryOp(ast, context) {
1630
1609
  }
1631
1610
  return Math.floor(left / right);
1632
1611
  case "**":
1633
- return __pow(left, right);
1612
+ return left ** right;
1634
1613
  case "==":
1635
1614
  return isEqual(left, right);
1636
1615
  case "<>":
@@ -1752,7 +1731,7 @@ function evaluate(ast, context = {}) {
1752
1731
  const dicts = /* @__PURE__ */ new Set();
1753
1732
  let pyContext;
1754
1733
  const evalContext = Object.create(context);
1755
- if (!(evalContext == null ? void 0 : evalContext.context)) {
1734
+ if (!evalContext?.context) {
1756
1735
  Object.defineProperty(evalContext, "context", {
1757
1736
  get() {
1758
1737
  if (!pyContext) {
@@ -1763,18 +1742,17 @@ function evaluate(ast, context = {}) {
1763
1742
  });
1764
1743
  }
1765
1744
  function _innerEvaluate(ast2) {
1766
- var _a, _b, _c;
1767
- switch (ast2 == null ? void 0 : ast2.type) {
1745
+ switch (ast2?.type) {
1768
1746
  case 0:
1769
1747
  // Number
1770
1748
  case 1:
1771
1749
  return ast2.value;
1772
1750
  case 5:
1773
1751
  if (ast2.value in evalContext) {
1774
- if (typeof evalContext[ast2.value] === "object" && ((_a = evalContext[ast2.value]) == null ? void 0 : _a.id)) {
1775
- return (_b = evalContext[ast2.value]) == null ? void 0 : _b.id;
1752
+ if (typeof evalContext[ast2.value] === "object" && evalContext[ast2.value]?.id) {
1753
+ return evalContext[ast2.value]?.id;
1776
1754
  }
1777
- return (_c = evalContext[ast2.value]) != null ? _c : false;
1755
+ return evalContext[ast2.value] ?? false;
1778
1756
  } else if (ast2.value in BUILTINS) {
1779
1757
  return BUILTINS[ast2.value];
1780
1758
  } else {
@@ -1811,7 +1789,7 @@ function evaluate(ast, context = {}) {
1811
1789
  const args = ast2.args.map(_evaluate);
1812
1790
  const kwargs = {};
1813
1791
  for (const kwarg in ast2.kwargs) {
1814
- kwargs[kwarg] = _evaluate(ast2 == null ? void 0 : ast2.kwargs[kwarg]);
1792
+ kwargs[kwarg] = _evaluate(ast2?.kwargs[kwarg]);
1815
1793
  }
1816
1794
  if (fnValue === PyDate || fnValue === PyDateTime || fnValue === PyTime || fnValue === PyRelativeDelta || fnValue === PyTimeDelta) {
1817
1795
  return fnValue.create(...args, kwargs);
@@ -1890,25 +1868,9 @@ function escapeRegExp(str) {
1890
1868
  var InvalidDomainError = class extends Error {
1891
1869
  };
1892
1870
  var Domain = class _Domain {
1893
- constructor(descr = []) {
1894
- this.ast = { type: -1, value: null };
1895
- if (descr instanceof _Domain) {
1896
- return new _Domain(descr.toString());
1897
- } else {
1898
- let rawAST;
1899
- try {
1900
- rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
1901
- } catch (error) {
1902
- throw new InvalidDomainError(
1903
- `Invalid domain representation: ${descr}`,
1904
- {
1905
- cause: error
1906
- }
1907
- );
1908
- }
1909
- this.ast = normalizeDomainAST(rawAST);
1910
- }
1911
- }
1871
+ ast = { type: -1, value: null };
1872
+ static TRUE;
1873
+ static FALSE;
1912
1874
  static combine(domains, operator) {
1913
1875
  if (domains.length === 0) {
1914
1876
  return new _Domain([]);
@@ -1987,6 +1949,24 @@ var Domain = class _Domain {
1987
1949
  processLeaf(d.ast.value, 0, "&", newDomain);
1988
1950
  return newDomain;
1989
1951
  }
1952
+ constructor(descr = []) {
1953
+ if (descr instanceof _Domain) {
1954
+ return new _Domain(descr.toString());
1955
+ } else {
1956
+ let rawAST;
1957
+ try {
1958
+ rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
1959
+ } catch (error) {
1960
+ throw new InvalidDomainError(
1961
+ `Invalid domain representation: ${descr}`,
1962
+ {
1963
+ cause: error
1964
+ }
1965
+ );
1966
+ }
1967
+ this.ast = normalizeDomainAST(rawAST);
1968
+ }
1969
+ }
1990
1970
  contains(record) {
1991
1971
  const expr = evaluate(this.ast, record);
1992
1972
  return matchDomain(record, expr);
@@ -2005,7 +1985,7 @@ var Domain = class _Domain {
2005
1985
  return evaluatedAsList;
2006
1986
  }
2007
1987
  return this.toString();
2008
- } catch (e) {
1988
+ } catch {
2009
1989
  return this.toString();
2010
1990
  }
2011
1991
  }
@@ -2233,22 +2213,22 @@ var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
2233
2213
 
2234
2214
  // src/utils/storage/local-storage.ts
2235
2215
  var localStorageUtils = () => {
2236
- const setToken = (access_token) => __async(null, null, function* () {
2216
+ const setToken = async (access_token) => {
2237
2217
  localStorage.setItem("accessToken", access_token);
2238
- });
2239
- const setRefreshToken = (refresh_token) => __async(null, null, function* () {
2218
+ };
2219
+ const setRefreshToken = async (refresh_token) => {
2240
2220
  localStorage.setItem("refreshToken", refresh_token);
2241
- });
2242
- const getAccessToken = () => __async(null, null, function* () {
2221
+ };
2222
+ const getAccessToken = async () => {
2243
2223
  return localStorage.getItem("accessToken");
2244
- });
2245
- const getRefreshToken = () => __async(null, null, function* () {
2224
+ };
2225
+ const getRefreshToken = async () => {
2246
2226
  return localStorage.getItem("refreshToken");
2247
- });
2248
- const clearToken = () => __async(null, null, function* () {
2227
+ };
2228
+ const clearToken = async () => {
2249
2229
  localStorage.removeItem("accessToken");
2250
2230
  localStorage.removeItem("refreshToken");
2251
- });
2231
+ };
2252
2232
  return {
2253
2233
  setToken,
2254
2234
  setRefreshToken,
@@ -2260,9 +2240,9 @@ var localStorageUtils = () => {
2260
2240
 
2261
2241
  // src/utils/storage/session-storage.ts
2262
2242
  var sessionStorageUtils = () => {
2263
- const getBrowserSession = () => __async(null, null, function* () {
2243
+ const getBrowserSession = async () => {
2264
2244
  return sessionStorage.getItem("browserSession");
2265
- });
2245
+ };
2266
2246
  return {
2267
2247
  getBrowserSession
2268
2248
  };
@@ -2271,14 +2251,13 @@ var sessionStorageUtils = () => {
2271
2251
  // src/configs/axios-client.ts
2272
2252
  var axiosClient = {
2273
2253
  init(config) {
2274
- var _a, _b;
2275
- const localStorage2 = (_a = config.localStorageUtils) != null ? _a : localStorageUtils();
2276
- const sessionStorage2 = (_b = config.sessionStorageUtils) != null ? _b : sessionStorageUtils();
2254
+ const localStorage2 = config.localStorageUtils ?? localStorageUtils();
2255
+ const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
2277
2256
  const db = config.db;
2278
2257
  let isRefreshing = false;
2279
2258
  let failedQueue = [];
2280
2259
  const processQueue = (error, token = null) => {
2281
- failedQueue == null ? void 0 : failedQueue.forEach((prom) => {
2260
+ failedQueue?.forEach((prom) => {
2282
2261
  if (error) {
2283
2262
  prom.reject(error);
2284
2263
  } else {
@@ -2293,38 +2272,33 @@ var axiosClient = {
2293
2272
  timeout: 5e4,
2294
2273
  paramsSerializer: (params) => new URLSearchParams(params).toString()
2295
2274
  });
2296
- instance.interceptors.request.use(
2297
- (config2) => __async(null, null, function* () {
2298
- const useRefreshToken = config2.useRefreshToken;
2299
- const token = useRefreshToken ? yield localStorage2.getRefreshToken() : yield localStorage2.getAccessToken();
2300
- if (token) {
2301
- config2.headers["Authorization"] = "Bearer " + token;
2302
- }
2303
- return config2;
2304
- }),
2305
- (error) => {
2306
- Promise.reject(error);
2275
+ instance.interceptors.request.use(async (config2) => {
2276
+ const { useRefreshToken, useActionToken, actionToken } = config2;
2277
+ if (useActionToken && actionToken) {
2278
+ config2.headers["Action-Token"] = actionToken;
2307
2279
  }
2308
- );
2280
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
2281
+ const token = await getToken?.();
2282
+ if (token) config2.headers["Authorization"] = `Bearer ${token}`;
2283
+ return config2;
2284
+ }, Promise.reject);
2309
2285
  instance.interceptors.response.use(
2310
2286
  (response) => {
2311
2287
  return handleResponse(response);
2312
2288
  },
2313
- (error) => __async(null, null, function* () {
2314
- var _a2, _b2, _c;
2315
- const handleError3 = (error2) => __async(null, null, function* () {
2316
- var _a3;
2289
+ async (error) => {
2290
+ const handleError3 = async (error2) => {
2317
2291
  if (!error2.response) {
2318
2292
  return error2;
2319
2293
  }
2320
2294
  const { data } = error2.response;
2321
- if (data && data.code === 400 && ["invalid_grant"].includes((_a3 = data.data) == null ? void 0 : _a3.error)) {
2322
- yield clearAuthToken();
2295
+ if (data && data.code === 400 && ["invalid_grant"].includes(data.data?.error)) {
2296
+ await clearAuthToken();
2323
2297
  }
2324
2298
  return data;
2325
- });
2299
+ };
2326
2300
  const originalRequest = error.config;
2327
- if ((((_a2 = error.response) == null ? void 0 : _a2.status) === 403 || ((_b2 = error.response) == null ? void 0 : _b2.status) === 401 || ((_c = error.response) == null ? void 0 : _c.status) === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401, "ERR_2FA_006"].includes(
2301
+ if ((error.response?.status === 403 || error.response?.status === 401 || error.response?.status === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401, "ERR_2FA_006"].includes(
2328
2302
  error.response.data.code
2329
2303
  )) {
2330
2304
  if (isRefreshing) {
@@ -2337,19 +2311,18 @@ var axiosClient = {
2337
2311
  token
2338
2312
  );
2339
2313
  return instance.request(originalRequest);
2340
- }).catch((err) => __async(null, null, function* () {
2341
- var _a3, _b3;
2342
- if ((((_a3 = err.response) == null ? void 0 : _a3.status) === 400 || ((_b3 = err.response) == null ? void 0 : _b3.status) === 401) && ["invalid_grant"].includes(err.response.data.error)) {
2343
- yield clearAuthToken();
2314
+ }).catch(async (err) => {
2315
+ if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
2316
+ await clearAuthToken();
2344
2317
  }
2345
- }));
2318
+ });
2346
2319
  }
2347
- const browserSession = yield sessionStorage2.getBrowserSession();
2348
- const refreshToken = yield localStorage2.getRefreshToken();
2349
- const accessTokenExp = yield localStorage2.getAccessToken();
2320
+ const browserSession = await sessionStorage2.getBrowserSession();
2321
+ const refreshToken = await localStorage2.getRefreshToken();
2322
+ const accessTokenExp = await localStorage2.getAccessToken();
2350
2323
  isRefreshing = true;
2351
2324
  if (!refreshToken && (!browserSession || browserSession == "unActive")) {
2352
- yield clearAuthToken();
2325
+ await clearAuthToken();
2353
2326
  } else {
2354
2327
  const payload = Object.fromEntries(
2355
2328
  Object.entries({
@@ -2360,9 +2333,8 @@ var axiosClient = {
2360
2333
  }).filter(([_, value]) => !!value)
2361
2334
  );
2362
2335
  return new Promise(function(resolve) {
2363
- var _a3;
2364
2336
  import_axios.default.post(
2365
- `${config.baseUrl}${(_a3 = config.refreshTokenEndpoint) != null ? _a3 : "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2337
+ `${config.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2366
2338
  payload,
2367
2339
  {
2368
2340
  headers: {
@@ -2370,10 +2342,10 @@ var axiosClient = {
2370
2342
  Authorization: `Bearer ${accessTokenExp}`
2371
2343
  }
2372
2344
  }
2373
- ).then((res) => __async(null, null, function* () {
2345
+ ).then(async (res) => {
2374
2346
  const data = res.data;
2375
- yield localStorage2.setToken(data.access_token);
2376
- yield localStorage2.setRefreshToken(data.refresh_token);
2347
+ await localStorage2.setToken(data.access_token);
2348
+ await localStorage2.setRefreshToken(data.refresh_token);
2377
2349
  import_axios.default.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
2378
2350
  originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
2379
2351
  originalRequest.data = updateTokenParamInOriginalRequest(
@@ -2382,26 +2354,25 @@ var axiosClient = {
2382
2354
  );
2383
2355
  processQueue(null, data.access_token);
2384
2356
  resolve(instance.request(originalRequest));
2385
- })).catch((err) => __async(null, null, function* () {
2386
- var _a4;
2387
- if (err && ((err == null ? void 0 : err.error_code) === "AUTHEN_FAIL" || (err == null ? void 0 : err.error_code) === "TOKEN_EXPIRED" || (err == null ? void 0 : err.error_code) === "TOKEN_INCORRECT" || (err == null ? void 0 : err.code) === "ERR_BAD_REQUEST") || (err == null ? void 0 : err.error_code) === "ERR_2FA_006") {
2388
- yield clearAuthToken();
2357
+ }).catch(async (err) => {
2358
+ if (err && (err?.error_code === "AUTHEN_FAIL" || err?.error_code === "TOKEN_EXPIRED" || err?.error_code === "TOKEN_INCORRECT" || err?.code === "ERR_BAD_REQUEST") || err?.error_code === "ERR_2FA_006") {
2359
+ await clearAuthToken();
2389
2360
  }
2390
2361
  if (err && err.response) {
2391
- const { error_code } = ((_a4 = err.response) == null ? void 0 : _a4.data) || {};
2362
+ const { error_code } = err.response?.data || {};
2392
2363
  if (error_code === "AUTHEN_FAIL") {
2393
- yield clearAuthToken();
2364
+ await clearAuthToken();
2394
2365
  }
2395
2366
  }
2396
2367
  processQueue(err, null);
2397
- })).finally(() => {
2368
+ }).finally(() => {
2398
2369
  isRefreshing = false;
2399
2370
  });
2400
2371
  });
2401
2372
  }
2402
2373
  }
2403
- return Promise.reject(yield handleError3(error));
2404
- })
2374
+ return Promise.reject(await handleError3(error));
2375
+ }
2405
2376
  );
2406
2377
  const handleResponse = (res) => {
2407
2378
  if (res && res.data) {
@@ -2410,7 +2381,6 @@ var axiosClient = {
2410
2381
  return res;
2411
2382
  };
2412
2383
  const handleError2 = (error) => {
2413
- var _a2, _b2, _c;
2414
2384
  if (error.isAxiosError && error.code === "ECONNABORTED") {
2415
2385
  console.error("Request Timeout Error:", error);
2416
2386
  return "Request Timeout Error";
@@ -2418,17 +2388,17 @@ var axiosClient = {
2418
2388
  console.error("Network Error:", error);
2419
2389
  return "Network Error";
2420
2390
  } else {
2421
- console.error("Other Error:", error == null ? void 0 : error.response);
2422
- const errorMessage = ((_b2 = (_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.data) == null ? void 0 : _b2.message) || "An error occurred";
2423
- return { message: errorMessage, status: (_c = error == null ? void 0 : error.response) == null ? void 0 : _c.status };
2391
+ console.error("Other Error:", error?.response);
2392
+ const errorMessage = error?.response?.data?.message || "An error occurred";
2393
+ return { message: errorMessage, status: error?.response?.status };
2424
2394
  }
2425
2395
  };
2426
- const clearAuthToken = () => __async(null, null, function* () {
2427
- yield localStorage2.clearToken();
2396
+ const clearAuthToken = async () => {
2397
+ await localStorage2.clearToken();
2428
2398
  if (typeof window !== "undefined") {
2429
2399
  window.location.href = `/login`;
2430
2400
  }
2431
- });
2401
+ };
2432
2402
  function formatUrl(url, db2) {
2433
2403
  return url + (db2 ? "?db=" + db2 : "");
2434
2404
  }
@@ -2478,6 +2448,8 @@ var initialState2 = {
2478
2448
  requests: null,
2479
2449
  companies: [],
2480
2450
  user: {},
2451
+ db: "",
2452
+ refreshTokenEndpoint: "",
2481
2453
  config: null,
2482
2454
  envFile: null,
2483
2455
  defaultCompany: {
@@ -2641,7 +2613,7 @@ var headerSlice = (0, import_toolkit5.createSlice)({
2641
2613
  },
2642
2614
  reducers: {
2643
2615
  setHeader: (state, action) => {
2644
- state.value = __spreadValues(__spreadValues({}, state.value), action.payload);
2616
+ state.value = { ...state.value, ...action.payload };
2645
2617
  },
2646
2618
  setAllowedCompanyIds: (state, action) => {
2647
2619
  state.value.allowedCompanyIds = action.payload;
@@ -3067,130 +3039,115 @@ var envStore = (0, import_toolkit11.configureStore)({
3067
3039
 
3068
3040
  // src/environment/EnvStore.ts
3069
3041
  var EnvStore = class {
3070
- constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
3071
- this.envStore = envStore2;
3042
+ baseUrl;
3043
+ requests;
3044
+ context;
3045
+ defaultCompany;
3046
+ config;
3047
+ companies;
3048
+ user;
3049
+ db;
3050
+ localStorageUtils;
3051
+ sessionStorageUtils;
3052
+ refreshTokenEndpoint;
3053
+ constructor(localStorageUtils2, sessionStorageUtils2) {
3072
3054
  this.localStorageUtils = localStorageUtils2;
3073
3055
  this.sessionStorageUtils = sessionStorageUtils2;
3074
3056
  this.setup();
3075
3057
  }
3076
3058
  setup() {
3077
- const env2 = this.envStore.getState().env;
3078
- this.baseUrl = env2 == null ? void 0 : env2.baseUrl;
3079
- this.requests = env2 == null ? void 0 : env2.requests;
3080
- this.context = env2 == null ? void 0 : env2.context;
3081
- this.defaultCompany = env2 == null ? void 0 : env2.defaultCompany;
3082
- this.config = env2 == null ? void 0 : env2.config;
3083
- this.companies = (env2 == null ? void 0 : env2.companies) || [];
3084
- this.user = env2 == null ? void 0 : env2.user;
3085
- this.db = env2 == null ? void 0 : env2.db;
3086
- this.refreshTokenEndpoint = env2 == null ? void 0 : env2.refreshTokenEndpoint;
3059
+ const env2 = envStore.getState().env;
3060
+ this.baseUrl = env2?.baseUrl;
3061
+ this.requests = env2?.requests;
3062
+ this.context = env2?.context;
3063
+ this.defaultCompany = env2?.defaultCompany;
3064
+ this.config = env2?.config;
3065
+ this.companies = env2?.companies || [];
3066
+ this.user = env2?.user;
3067
+ this.db = env2?.db;
3068
+ this.refreshTokenEndpoint = env2?.refreshTokenEndpoint;
3069
+ console.log("env from interface-logic", env2);
3087
3070
  }
3088
3071
  setupEnv(envConfig) {
3089
- const dispatch = this.envStore.dispatch;
3090
- const env2 = __spreadProps(__spreadValues({}, envConfig), {
3072
+ const dispatch = envStore.dispatch;
3073
+ const env2 = {
3074
+ ...envConfig,
3091
3075
  localStorageUtils: this.localStorageUtils,
3092
3076
  sessionStorageUtils: this.sessionStorageUtils
3093
- });
3077
+ };
3094
3078
  const requests = axiosClient.init(env2);
3095
- dispatch(setEnv(__spreadProps(__spreadValues({}, env2), { requests })));
3079
+ dispatch(setEnv({ ...env2, requests }));
3096
3080
  this.setup();
3097
3081
  }
3098
3082
  setUid(uid) {
3099
- const dispatch = this.envStore.dispatch;
3083
+ const dispatch = envStore.dispatch;
3100
3084
  dispatch(setUid(uid));
3101
3085
  this.setup();
3102
3086
  }
3103
3087
  setLang(lang) {
3104
- const dispatch = this.envStore.dispatch;
3088
+ const dispatch = envStore.dispatch;
3105
3089
  dispatch(setLang(lang));
3106
3090
  this.setup();
3107
3091
  }
3108
3092
  setAllowCompanies(allowCompanies) {
3109
- const dispatch = this.envStore.dispatch;
3093
+ const dispatch = envStore.dispatch;
3110
3094
  dispatch(setAllowCompanies(allowCompanies));
3111
3095
  this.setup();
3112
3096
  }
3113
3097
  setCompanies(companies) {
3114
- const dispatch = this.envStore.dispatch;
3098
+ const dispatch = envStore.dispatch;
3115
3099
  dispatch(setCompanies(companies));
3116
3100
  this.setup();
3117
3101
  }
3118
3102
  setDefaultCompany(company) {
3119
- const dispatch = this.envStore.dispatch;
3103
+ const dispatch = envStore.dispatch;
3120
3104
  dispatch(setDefaultCompany(company));
3121
3105
  this.setup();
3122
3106
  }
3123
3107
  setUserInfo(userInfo) {
3124
- const dispatch = this.envStore.dispatch;
3108
+ const dispatch = envStore.dispatch;
3125
3109
  dispatch(setUser(userInfo));
3126
3110
  this.setup();
3127
3111
  }
3128
3112
  };
3129
3113
  var env = null;
3130
3114
  function getEnv() {
3131
- if (!env)
3132
- env = new EnvStore(envStore, localStorageUtils(), sessionStorageUtils());
3115
+ if (!env) env = new EnvStore(localStorageUtils(), sessionStorageUtils());
3133
3116
  return env;
3134
3117
  }
3135
3118
 
3136
3119
  // src/services/action-service/index.ts
3137
3120
  var ActionService = {
3138
3121
  // Load Action
3139
- loadAction(_0) {
3140
- return __async(this, arguments, function* ({
3141
- idAction,
3142
- context
3143
- }) {
3144
- const env2 = getEnv();
3145
- const jsonData = {
3146
- action_id: idAction,
3147
- with_context: __spreadValues({}, context)
3148
- };
3149
- return env2.requests.post(`${"/load_action" /* LOAD_ACTION */}`, jsonData, {
3150
- headers: {
3151
- "Content-Type": "application/json"
3152
- }
3153
- });
3154
- });
3155
- },
3156
- // Call Button
3157
- callButton(_0) {
3158
- return __async(this, arguments, function* ({
3159
- model,
3160
- ids = [],
3161
- context,
3162
- method
3163
- }) {
3164
- try {
3165
- const env2 = getEnv();
3166
- const jsonData = {
3167
- model,
3168
- method,
3169
- ids,
3170
- with_context: context
3171
- };
3172
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3173
- headers: {
3174
- "Content-Type": "application/json"
3175
- }
3176
- });
3177
- } catch (error) {
3178
- console.error("Error when calling button action:", error);
3179
- throw error;
3122
+ async loadAction({
3123
+ idAction,
3124
+ context
3125
+ }) {
3126
+ const env2 = getEnv();
3127
+ const jsonData = {
3128
+ action_id: idAction,
3129
+ with_context: {
3130
+ ...context
3131
+ }
3132
+ };
3133
+ return env2.requests.post(`${"/load_action" /* LOAD_ACTION */}`, jsonData, {
3134
+ headers: {
3135
+ "Content-Type": "application/json"
3180
3136
  }
3181
3137
  });
3182
3138
  },
3183
- // remove Row
3184
- removeRows(_0) {
3185
- return __async(this, arguments, function* ({
3186
- model,
3187
- ids,
3188
- context
3189
- }) {
3139
+ // Call Button
3140
+ async callButton({
3141
+ model,
3142
+ ids = [],
3143
+ context,
3144
+ method
3145
+ }) {
3146
+ try {
3190
3147
  const env2 = getEnv();
3191
3148
  const jsonData = {
3192
3149
  model,
3193
- method: "unlink",
3150
+ method,
3194
3151
  ids,
3195
3152
  with_context: context
3196
3153
  };
@@ -3199,96 +3156,112 @@ var ActionService = {
3199
3156
  "Content-Type": "application/json"
3200
3157
  }
3201
3158
  });
3159
+ } catch (error) {
3160
+ console.error("Error when calling button action:", error);
3161
+ throw error;
3162
+ }
3163
+ },
3164
+ // remove Row
3165
+ async removeRows({
3166
+ model,
3167
+ ids,
3168
+ context
3169
+ }) {
3170
+ const env2 = getEnv();
3171
+ const jsonData = {
3172
+ model,
3173
+ method: "unlink",
3174
+ ids,
3175
+ with_context: context
3176
+ };
3177
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3178
+ headers: {
3179
+ "Content-Type": "application/json"
3180
+ }
3202
3181
  });
3203
3182
  },
3204
3183
  // Duplicate Model
3205
- duplicateRecord(_0) {
3206
- return __async(this, arguments, function* ({
3184
+ async duplicateRecord({
3185
+ model,
3186
+ id,
3187
+ context
3188
+ }) {
3189
+ const env2 = getEnv();
3190
+ const jsonData = {
3207
3191
  model,
3208
- id,
3209
- context
3210
- }) {
3211
- const env2 = getEnv();
3212
- const jsonData = {
3213
- model,
3214
- method: "copy",
3215
- ids: id,
3216
- with_context: context
3217
- };
3218
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3219
- headers: {
3220
- "Content-Type": "application/json"
3221
- }
3222
- });
3192
+ method: "copy",
3193
+ ids: id,
3194
+ with_context: context
3195
+ };
3196
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3197
+ headers: {
3198
+ "Content-Type": "application/json"
3199
+ }
3223
3200
  });
3224
3201
  },
3225
3202
  // Get Print Report
3226
- getPrintReportName(_0) {
3227
- return __async(this, arguments, function* ({ id }) {
3228
- const env2 = getEnv();
3229
- const jsonData = {
3230
- model: "ir.actions.report",
3231
- method: "web_read",
3232
- id,
3233
- kwargs: {
3234
- specification: {
3235
- report_name: {}
3236
- }
3237
- }
3238
- };
3239
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3240
- headers: {
3241
- "Content-Type": "application/json"
3203
+ async getPrintReportName({ id }) {
3204
+ const env2 = getEnv();
3205
+ const jsonData = {
3206
+ model: "ir.actions.report",
3207
+ method: "web_read",
3208
+ id,
3209
+ kwargs: {
3210
+ specification: {
3211
+ report_name: {}
3242
3212
  }
3243
- });
3213
+ }
3214
+ };
3215
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3216
+ headers: {
3217
+ "Content-Type": "application/json"
3218
+ }
3244
3219
  });
3245
3220
  },
3246
3221
  //Save Print Invoice
3247
- print(_0) {
3248
- return __async(this, arguments, function* ({ id, report, db }) {
3249
- const env2 = getEnv();
3250
- const jsonData = {
3251
- report,
3252
- id,
3253
- type: "pdf",
3254
- file_response: true,
3255
- db
3256
- };
3257
- const queryString = toQueryString(jsonData);
3258
- const urlWithParams = `${"/report" /* REPORT_PATH */}?${queryString}`;
3259
- return env2.requests.get(urlWithParams, {
3260
- headers: {
3261
- "Content-Type": "application/json"
3262
- },
3263
- responseType: "arraybuffer"
3264
- });
3222
+ async print({ id, report, db }) {
3223
+ const env2 = getEnv();
3224
+ const jsonData = {
3225
+ report,
3226
+ id,
3227
+ type: "pdf",
3228
+ file_response: true,
3229
+ db
3230
+ };
3231
+ const queryString = toQueryString(jsonData);
3232
+ const urlWithParams = `${"/report" /* REPORT_PATH */}?${queryString}`;
3233
+ return env2.requests.get(urlWithParams, {
3234
+ headers: {
3235
+ "Content-Type": "application/json"
3236
+ },
3237
+ responseType: "arraybuffer"
3265
3238
  });
3266
3239
  },
3267
3240
  //Run Action
3268
- runAction(_0) {
3269
- return __async(this, arguments, function* ({
3270
- idAction,
3271
- context
3272
- }) {
3273
- const env2 = getEnv();
3274
- const jsonData = {
3275
- action_id: idAction,
3276
- with_context: __spreadValues({}, context)
3277
- // context: {
3278
- // lang: 'en_US',
3279
- // tz: 'Asia/Saigon',
3280
- // uid: 2,
3281
- // allowed_company_ids: [1],
3282
- // active_id: Array.isArray(idDetail) ? idDetail[0] : idDetail,
3283
- // active_ids: Array.isArray(idDetail) ? [...idDetail] : idDetail,
3284
- // active_model: model,
3285
- // },
3286
- };
3287
- return env2.requests.post(`${"/run_action" /* RUN_ACTION_PATH */}`, jsonData, {
3288
- headers: {
3289
- "Content-Type": "application/json"
3290
- }
3291
- });
3241
+ async runAction({
3242
+ idAction,
3243
+ context
3244
+ }) {
3245
+ const env2 = getEnv();
3246
+ const jsonData = {
3247
+ action_id: idAction,
3248
+ with_context: {
3249
+ ...context
3250
+ }
3251
+ // context: {
3252
+ // lang: 'en_US',
3253
+ // tz: 'Asia/Saigon',
3254
+ // uid: 2,
3255
+ // allowed_company_ids: [1],
3256
+ // active_id: Array.isArray(idDetail) ? idDetail[0] : idDetail,
3257
+ // active_ids: Array.isArray(idDetail) ? [...idDetail] : idDetail,
3258
+ // active_model: model,
3259
+ // },
3260
+ };
3261
+ return env2.requests.post(`${"/run_action" /* RUN_ACTION_PATH */}`, jsonData, {
3262
+ headers: {
3263
+ "Content-Type": "application/json"
3264
+ }
3292
3265
  });
3293
3266
  }
3294
3267
  };
@@ -3296,238 +3269,214 @@ var action_service_default = ActionService;
3296
3269
 
3297
3270
  // src/services/auth-service/index.ts
3298
3271
  var AuthService = {
3299
- login(body) {
3300
- return __async(this, null, function* () {
3301
- var _a, _b, _c, _d;
3302
- const env2 = getEnv();
3303
- const payload = Object.fromEntries(
3304
- Object.entries({
3305
- username: body.email,
3306
- password: body.password,
3307
- grant_type: ((_a = env2 == null ? void 0 : env2.config) == null ? void 0 : _a.grantType) || "",
3308
- client_id: ((_b = env2 == null ? void 0 : env2.config) == null ? void 0 : _b.clientId) || "",
3309
- client_secret: ((_c = env2 == null ? void 0 : env2.config) == null ? void 0 : _c.clientSecret) || ""
3310
- }).filter(([_, value]) => !!value)
3311
- );
3312
- const encodedData = new URLSearchParams(payload).toString();
3313
- return (_d = env2 == null ? void 0 : env2.requests) == null ? void 0 : _d.post(body.path, encodedData, {
3314
- headers: {
3315
- "Content-Type": "application/x-www-form-urlencoded"
3316
- }
3317
- });
3272
+ async login(body) {
3273
+ const env2 = getEnv();
3274
+ const payload = Object.fromEntries(
3275
+ Object.entries({
3276
+ username: body.email,
3277
+ password: body.password,
3278
+ grant_type: env2?.config?.grantType || "",
3279
+ client_id: env2?.config?.clientId || "",
3280
+ client_secret: env2?.config?.clientSecret || ""
3281
+ }).filter(([_, value]) => !!value)
3282
+ );
3283
+ const encodedData = new URLSearchParams(payload).toString();
3284
+ return env2?.requests?.post(body.path, encodedData, {
3285
+ headers: {
3286
+ "Content-Type": "application/x-www-form-urlencoded"
3287
+ }
3318
3288
  });
3319
3289
  },
3320
- forgotPassword(email) {
3321
- return __async(this, null, function* () {
3322
- var _a;
3323
- const env2 = getEnv();
3324
- const bodyData = {
3325
- login: email,
3326
- url: `${window.location.origin}/reset-password`
3327
- };
3328
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
3329
- headers: {
3330
- "Content-Type": "application/json"
3331
- }
3332
- });
3290
+ async forgotPassword(email) {
3291
+ const env2 = getEnv();
3292
+ const bodyData = {
3293
+ login: email,
3294
+ url: `${window.location.origin}/reset-password`
3295
+ };
3296
+ return env2?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
3297
+ headers: {
3298
+ "Content-Type": "application/json"
3299
+ }
3333
3300
  });
3334
3301
  },
3335
- forgotPasswordSSO(_0) {
3336
- return __async(this, arguments, function* ({
3337
- email,
3338
- with_context,
3339
- method
3340
- }) {
3341
- var _a;
3342
- const env2 = getEnv();
3343
- const body = {
3344
- method,
3345
- kwargs: {
3346
- vals: {
3347
- email
3348
- }
3349
- },
3350
- with_context
3351
- };
3352
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, body, {
3353
- headers: {
3354
- "Content-Type": "application/json"
3302
+ async forgotPasswordSSO({
3303
+ email,
3304
+ with_context,
3305
+ method
3306
+ }) {
3307
+ const env2 = getEnv();
3308
+ const body = {
3309
+ method,
3310
+ kwargs: {
3311
+ vals: {
3312
+ email
3355
3313
  }
3356
- });
3314
+ },
3315
+ with_context
3316
+ };
3317
+ return env2?.requests?.post("/call" /* CALL_PATH */, body, {
3318
+ headers: {
3319
+ "Content-Type": "application/json"
3320
+ }
3357
3321
  });
3358
3322
  },
3359
- resetPassword(data, token) {
3360
- return __async(this, null, function* () {
3361
- var _a;
3362
- const env2 = getEnv();
3363
- const bodyData = {
3364
- token,
3365
- password: data.password,
3366
- new_password: data.confirmPassword
3367
- };
3368
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
3369
- headers: {
3370
- "Content-Type": "application/json"
3371
- }
3372
- });
3323
+ async resetPassword(data, token) {
3324
+ const env2 = getEnv();
3325
+ const bodyData = {
3326
+ token,
3327
+ password: data.password,
3328
+ new_password: data.confirmPassword
3329
+ };
3330
+ return env2?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
3331
+ headers: {
3332
+ "Content-Type": "application/json"
3333
+ }
3373
3334
  });
3374
3335
  },
3375
- resetPasswordSSO(_0) {
3376
- return __async(this, arguments, function* ({
3336
+ async resetPasswordSSO({
3337
+ method,
3338
+ password,
3339
+ with_context
3340
+ }) {
3341
+ const env2 = getEnv();
3342
+ const bodyData = {
3377
3343
  method,
3378
- password,
3379
- with_context
3380
- }) {
3381
- var _a;
3382
- const env2 = getEnv();
3383
- const bodyData = {
3384
- method,
3385
- kwargs: {
3386
- vals: {
3387
- password
3388
- }
3389
- },
3390
- with_context
3391
- };
3392
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, bodyData, {
3393
- headers: {
3394
- "Content-Type": "application/json"
3344
+ kwargs: {
3345
+ vals: {
3346
+ password
3395
3347
  }
3396
- });
3348
+ },
3349
+ with_context
3350
+ };
3351
+ return env2?.requests?.post("/call" /* CALL_PATH */, bodyData, {
3352
+ headers: {
3353
+ "Content-Type": "application/json"
3354
+ }
3397
3355
  });
3398
3356
  },
3399
- updatePassword(data, token) {
3400
- return __async(this, null, function* () {
3401
- var _a;
3402
- const env2 = getEnv();
3403
- const bodyData = {
3404
- token,
3405
- old_password: data.oldPassword,
3406
- new_password: data.newPassword
3407
- };
3408
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
3409
- headers: {
3410
- "Content-Type": "application/json"
3411
- }
3412
- });
3357
+ async updatePassword(data, token) {
3358
+ const env2 = getEnv();
3359
+ const bodyData = {
3360
+ token,
3361
+ old_password: data.oldPassword,
3362
+ new_password: data.newPassword
3363
+ };
3364
+ return env2?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
3365
+ headers: {
3366
+ "Content-Type": "application/json"
3367
+ }
3413
3368
  });
3414
3369
  },
3415
- isValidToken(token) {
3416
- return __async(this, null, function* () {
3417
- var _a;
3418
- const env2 = getEnv();
3419
- const bodyData = {
3420
- token
3421
- };
3422
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/check_token" /* TOKEN */, bodyData, {
3423
- headers: {
3424
- "Content-Type": "application/json"
3425
- }
3426
- });
3370
+ async isValidToken(token) {
3371
+ const env2 = getEnv();
3372
+ const bodyData = {
3373
+ token
3374
+ };
3375
+ return env2?.requests?.post("/check_token" /* TOKEN */, bodyData, {
3376
+ headers: {
3377
+ "Content-Type": "application/json"
3378
+ }
3427
3379
  });
3428
3380
  },
3429
- loginSocial(_0) {
3430
- return __async(this, arguments, function* ({
3431
- db,
3432
- state,
3433
- access_token
3434
- }) {
3435
- var _a;
3436
- const env2 = getEnv();
3437
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post(
3438
- "/token/generate" /* GENTOKEN_SOCIAL */,
3439
- { state, access_token },
3440
- {
3441
- headers: {
3442
- "Content-Type": "application/json"
3443
- }
3381
+ async isValidActionToken(actionToken, path) {
3382
+ const env2 = getEnv();
3383
+ return env2?.requests?.post(
3384
+ path,
3385
+ {},
3386
+ {
3387
+ headers: {
3388
+ "Content-Type": "application/json"
3389
+ },
3390
+ useActionToken: true,
3391
+ actionToken
3392
+ }
3393
+ );
3394
+ },
3395
+ async loginSocial({
3396
+ db,
3397
+ state,
3398
+ access_token
3399
+ }) {
3400
+ const env2 = getEnv();
3401
+ return env2?.requests?.post(
3402
+ "/token/generate" /* GENTOKEN_SOCIAL */,
3403
+ { state, access_token },
3404
+ {
3405
+ headers: {
3406
+ "Content-Type": "application/json"
3444
3407
  }
3445
- );
3446
- });
3408
+ }
3409
+ );
3447
3410
  },
3448
- getProviders(db) {
3449
- return __async(this, null, function* () {
3450
- var _a;
3451
- const env2 = getEnv();
3452
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.get("/oauth/providers", { params: { db } });
3453
- });
3411
+ async getProviders(db) {
3412
+ const env2 = getEnv();
3413
+ return env2?.requests?.get("/oauth/providers", { params: { db } });
3454
3414
  },
3455
- getAccessByCode(code) {
3456
- return __async(this, null, function* () {
3457
- var _a, _b, _c, _d;
3458
- const env2 = getEnv();
3459
- const data = new URLSearchParams();
3460
- data.append("code", code);
3461
- data.append("grant_type", "authorization_code");
3462
- data.append("client_id", ((_a = env2 == null ? void 0 : env2.config) == null ? void 0 : _a.clientId) || "");
3463
- data.append("redirect_uri", ((_b = env2 == null ? void 0 : env2.config) == null ? void 0 : _b.redirectUri) || "");
3464
- return (_d = env2 == null ? void 0 : env2.requests) == null ? void 0 : _d.post(
3465
- `${(_c = env2 == null ? void 0 : env2.baseUrl) == null ? void 0 : _c.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
3466
- data,
3467
- {
3468
- headers: {
3469
- "Content-Type": "application/x-www-form-urlencoded"
3470
- }
3415
+ async getAccessByCode(code) {
3416
+ const env2 = getEnv();
3417
+ const data = new URLSearchParams();
3418
+ data.append("code", code);
3419
+ data.append("grant_type", "authorization_code");
3420
+ data.append("client_id", env2?.config?.clientId || "");
3421
+ data.append("redirect_uri", env2?.config?.redirectUri || "");
3422
+ return env2?.requests?.post(
3423
+ `${env2?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
3424
+ data,
3425
+ {
3426
+ headers: {
3427
+ "Content-Type": "application/x-www-form-urlencoded"
3471
3428
  }
3472
- );
3473
- });
3429
+ }
3430
+ );
3474
3431
  },
3475
- logout(data) {
3476
- return __async(this, null, function* () {
3477
- var _a;
3478
- const env2 = getEnv();
3479
- console.log(data);
3480
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post(
3481
- "/logout" /* LOGOUT */,
3482
- {},
3483
- {
3484
- headers: {
3485
- "Content-Type": "application/json"
3486
- },
3487
- withCredentials: true,
3488
- useRefreshToken: true
3489
- }
3490
- );
3491
- });
3432
+ async logout(data) {
3433
+ const env2 = getEnv();
3434
+ console.log(data);
3435
+ return env2?.requests?.post(
3436
+ "/logout" /* LOGOUT */,
3437
+ {},
3438
+ {
3439
+ headers: {
3440
+ "Content-Type": "application/json"
3441
+ },
3442
+ withCredentials: true,
3443
+ useRefreshToken: true
3444
+ }
3445
+ );
3492
3446
  }
3493
3447
  };
3494
3448
  var auth_service_default = AuthService;
3495
3449
 
3496
3450
  // src/services/company-service/index.ts
3497
3451
  var CompanyService = {
3498
- getCurrentCompany() {
3499
- return __async(this, null, function* () {
3500
- const env2 = getEnv();
3501
- return yield env2.requests.get("/company" /* COMPANY_PATH */, {
3502
- headers: {
3503
- "Content-Type": "application/json"
3504
- }
3505
- });
3452
+ async getCurrentCompany() {
3453
+ const env2 = getEnv();
3454
+ return await env2.requests.get("/company" /* COMPANY_PATH */, {
3455
+ headers: {
3456
+ "Content-Type": "application/json"
3457
+ }
3506
3458
  });
3507
3459
  },
3508
- getInfoCompany(id) {
3509
- return __async(this, null, function* () {
3510
- var _a;
3511
- const env2 = getEnv();
3512
- const jsonData = {
3513
- ids: [id],
3514
- model: "res.company" /* COMPANY */,
3515
- method: "web_read" /* WEB_READ */,
3516
- kwargs: {
3517
- specification: {
3518
- primary_color: {},
3519
- secondary_color: {},
3520
- logo: {},
3521
- display_name: {},
3522
- secondary_logo: {}
3523
- }
3524
- }
3525
- };
3526
- return yield (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
3527
- headers: {
3528
- "Content-Type": "application/json"
3460
+ async getInfoCompany(id) {
3461
+ const env2 = getEnv();
3462
+ const jsonData = {
3463
+ ids: [id],
3464
+ model: "res.company" /* COMPANY */,
3465
+ method: "web_read" /* WEB_READ */,
3466
+ kwargs: {
3467
+ specification: {
3468
+ primary_color: {},
3469
+ secondary_color: {},
3470
+ logo: {},
3471
+ display_name: {},
3472
+ secondary_logo: {}
3529
3473
  }
3530
- });
3474
+ }
3475
+ };
3476
+ return await env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
3477
+ headers: {
3478
+ "Content-Type": "application/json"
3479
+ }
3531
3480
  });
3532
3481
  }
3533
3482
  };
@@ -3535,671 +3484,613 @@ var company_service_default = CompanyService;
3535
3484
 
3536
3485
  // src/services/excel-service/index.ts
3537
3486
  var ExcelService = {
3538
- uploadFile(_0) {
3539
- return __async(this, arguments, function* ({ formData }) {
3540
- const env2 = getEnv();
3541
- return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3542
- headers: {
3543
- "Content-Type": "multipart/form-data"
3544
- }
3545
- });
3487
+ async uploadFile({ formData }) {
3488
+ const env2 = getEnv();
3489
+ return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3490
+ headers: {
3491
+ "Content-Type": "multipart/form-data"
3492
+ }
3546
3493
  });
3547
3494
  },
3548
- uploadIdFile(_0) {
3549
- return __async(this, arguments, function* ({ formData }) {
3550
- const env2 = getEnv();
3551
- return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3552
- headers: {
3553
- "Content-Type": "multipart/form-data"
3554
- }
3555
- });
3495
+ async uploadIdFile({ formData }) {
3496
+ const env2 = getEnv();
3497
+ return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3498
+ headers: {
3499
+ "Content-Type": "multipart/form-data"
3500
+ }
3556
3501
  });
3557
3502
  },
3558
- parsePreview(_0) {
3559
- return __async(this, arguments, function* ({
3560
- id,
3561
- selectedSheet,
3562
- isHeader,
3563
- context
3564
- }) {
3565
- const env2 = getEnv();
3566
- const jsonData = {
3567
- model: "base_import.import" /* BASE_IMPORT */,
3568
- method: "parse_preview",
3569
- ids: [id],
3570
- kwargs: {
3571
- options: {
3572
- import_skip_records: [],
3573
- import_set_empty_fields: [],
3574
- fallback_values: {},
3575
- name_create_enabled_fields: {},
3576
- encoding: "",
3577
- separator: "",
3578
- quoting: '"',
3579
- date_format: "",
3580
- datetime_format: "",
3581
- float_thousand_separator: ",",
3582
- float_decimal_separator: ".",
3583
- advanced: true,
3584
- has_headers: isHeader,
3585
- keep_matches: false,
3586
- limit: 2e3,
3587
- sheets: [],
3588
- sheet: selectedSheet,
3589
- skip: 0,
3590
- tracking_disable: true
3591
- }
3592
- },
3593
- with_context: context
3594
- };
3595
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3596
- headers: {
3597
- "Content-Type": "multipart/form-data"
3503
+ async parsePreview({
3504
+ id,
3505
+ selectedSheet,
3506
+ isHeader,
3507
+ context
3508
+ }) {
3509
+ const env2 = getEnv();
3510
+ const jsonData = {
3511
+ model: "base_import.import" /* BASE_IMPORT */,
3512
+ method: "parse_preview",
3513
+ ids: [id],
3514
+ kwargs: {
3515
+ options: {
3516
+ import_skip_records: [],
3517
+ import_set_empty_fields: [],
3518
+ fallback_values: {},
3519
+ name_create_enabled_fields: {},
3520
+ encoding: "",
3521
+ separator: "",
3522
+ quoting: '"',
3523
+ date_format: "",
3524
+ datetime_format: "",
3525
+ float_thousand_separator: ",",
3526
+ float_decimal_separator: ".",
3527
+ advanced: true,
3528
+ has_headers: isHeader,
3529
+ keep_matches: false,
3530
+ limit: 2e3,
3531
+ sheets: [],
3532
+ sheet: selectedSheet,
3533
+ skip: 0,
3534
+ tracking_disable: true
3598
3535
  }
3599
- });
3536
+ },
3537
+ with_context: context
3538
+ };
3539
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3540
+ headers: {
3541
+ "Content-Type": "multipart/form-data"
3542
+ }
3600
3543
  });
3601
3544
  },
3602
- executeImport(_0) {
3603
- return __async(this, arguments, function* ({
3604
- columns,
3605
- fields,
3606
- idFile,
3607
- options,
3608
- dryrun,
3609
- context
3610
- }) {
3611
- const env2 = getEnv();
3612
- const jsonData = {
3613
- model: "base_import.import" /* BASE_IMPORT */,
3614
- method: "execute_import",
3615
- ids: [idFile],
3616
- kwargs: {
3617
- fields,
3618
- columns,
3619
- options,
3620
- dryrun
3621
- },
3622
- with_context: context
3623
- };
3624
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3625
- headers: {
3626
- "Content-Type": "multipart/form-data"
3627
- }
3628
- });
3545
+ async executeImport({
3546
+ columns,
3547
+ fields,
3548
+ idFile,
3549
+ options,
3550
+ dryrun,
3551
+ context
3552
+ }) {
3553
+ const env2 = getEnv();
3554
+ const jsonData = {
3555
+ model: "base_import.import" /* BASE_IMPORT */,
3556
+ method: "execute_import",
3557
+ ids: [idFile],
3558
+ kwargs: {
3559
+ fields,
3560
+ columns,
3561
+ options,
3562
+ dryrun
3563
+ },
3564
+ with_context: context
3565
+ };
3566
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3567
+ headers: {
3568
+ "Content-Type": "multipart/form-data"
3569
+ }
3629
3570
  });
3630
3571
  },
3631
- getFileExcel(_0) {
3632
- return __async(this, arguments, function* ({ model }) {
3633
- const env2 = getEnv();
3634
- const jsonData = {
3635
- model,
3636
- method: "get_import_templates" /* GET_IMPORT */,
3637
- args: []
3638
- };
3639
- return env2.requests.post("/call" /* CALL_PATH */, jsonData);
3640
- });
3572
+ async getFileExcel({ model }) {
3573
+ const env2 = getEnv();
3574
+ const jsonData = {
3575
+ model,
3576
+ method: "get_import_templates" /* GET_IMPORT */,
3577
+ args: []
3578
+ };
3579
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData);
3641
3580
  },
3642
- getFieldExport(_0) {
3643
- return __async(this, arguments, function* ({
3644
- ids,
3581
+ async getFieldExport({
3582
+ ids,
3583
+ model,
3584
+ isShow,
3585
+ parentField,
3586
+ fieldType,
3587
+ parentName,
3588
+ prefix,
3589
+ name,
3590
+ context,
3591
+ importCompat
3592
+ }) {
3593
+ const env2 = getEnv();
3594
+ const jsonData = {
3645
3595
  model,
3646
- isShow,
3647
- parentField,
3648
- fieldType,
3649
- parentName,
3650
- prefix,
3651
- name,
3652
- context,
3653
- importCompat
3654
- }) {
3655
- const env2 = getEnv();
3656
- const jsonData = {
3657
- model,
3658
- import_compat: importCompat,
3659
- domain: [["id", "in", ids]],
3660
- with_context: context
3661
- };
3662
- if (isShow) {
3663
- jsonData.parent_field = parentField;
3664
- jsonData.parent_field_type = fieldType;
3665
- jsonData.parent_name = parentName;
3666
- jsonData.name = name;
3667
- jsonData.prefix = prefix;
3668
- jsonData.exclude = [null];
3669
- }
3670
- return env2.requests.post("/export/get_fields", jsonData);
3671
- });
3596
+ import_compat: importCompat,
3597
+ domain: [["id", "in", ids]],
3598
+ with_context: context
3599
+ };
3600
+ if (isShow) {
3601
+ jsonData.parent_field = parentField;
3602
+ jsonData.parent_field_type = fieldType;
3603
+ jsonData.parent_name = parentName;
3604
+ jsonData.name = name;
3605
+ jsonData.prefix = prefix;
3606
+ jsonData.exclude = [null];
3607
+ }
3608
+ return env2.requests.post("/export/get_fields", jsonData);
3672
3609
  },
3673
- exportExcel(_0) {
3674
- return __async(this, arguments, function* ({
3610
+ async exportExcel({
3611
+ model,
3612
+ domain,
3613
+ ids,
3614
+ fields,
3615
+ type,
3616
+ importCompat,
3617
+ context,
3618
+ groupby
3619
+ }) {
3620
+ const env2 = getEnv();
3621
+ const jsonData = {
3675
3622
  model,
3676
3623
  domain,
3677
3624
  ids,
3625
+ import_compat: importCompat,
3678
3626
  fields,
3679
- type,
3680
- importCompat,
3681
- context,
3682
- groupby
3683
- }) {
3684
- const env2 = getEnv();
3685
- const jsonData = {
3686
- model,
3687
- domain,
3688
- ids,
3689
- import_compat: importCompat,
3690
- fields,
3691
- with_context: context,
3692
- groupby: groupby != null ? groupby : []
3693
- };
3694
- return env2.requests.post_excel(`/export/${type}`, jsonData);
3695
- });
3627
+ with_context: context,
3628
+ groupby: groupby ?? []
3629
+ };
3630
+ return env2.requests.post_excel(`/export/${type}`, jsonData);
3696
3631
  }
3697
3632
  };
3698
3633
  var excel_service_default = ExcelService;
3699
3634
 
3700
3635
  // src/services/form-service/index.ts
3701
3636
  var FormService = {
3702
- getComment(_0) {
3703
- return __async(this, arguments, function* ({ data }) {
3704
- try {
3705
- const env2 = getEnv();
3706
- const jsonData = {
3707
- thread_id: data.thread_id,
3708
- thread_model: data.thread_model,
3709
- limit: 100,
3710
- with_context: {
3711
- lang: data.lang
3712
- }
3713
- };
3714
- return env2.requests.post("/chatter/thread/messages" /* GET_MESSAGE */, jsonData, {
3715
- headers: {
3716
- "Content-Type": "application/json"
3717
- }
3718
- });
3719
- } catch (error) {
3720
- console.error("Error when sending message:", error);
3721
- throw error;
3722
- }
3723
- });
3724
- },
3725
- sentComment(_0) {
3726
- return __async(this, arguments, function* ({ data }) {
3727
- try {
3728
- const env2 = getEnv();
3729
- const jsonData = {
3730
- context: {
3731
- tz: "Asia/Saigon",
3732
- uid: 2,
3733
- allowed_company_ids: [1],
3734
- mail_post_autofollow: false,
3735
- temporary_id: 142183.01
3736
- },
3737
- post_data: {
3738
- body: data.message,
3739
- message_type: "comment",
3740
- attachment_ids: data.attachment_ids,
3741
- attachment_tokens: [],
3742
- subtype_xmlid: data.subtype
3743
- },
3744
- thread_id: Number(data.thread_id),
3745
- thread_model: data.thread_model
3746
- };
3747
- return env2.requests.post("/chatter/message/post" /* SENT_MESSAGE */, jsonData, {
3748
- headers: {
3749
- "Content-Type": "application/json"
3750
- }
3751
- });
3752
- } catch (error) {
3753
- console.error("Error when sent message:", error);
3754
- throw error;
3755
- }
3756
- });
3757
- },
3758
- deleteComment(_0) {
3759
- return __async(this, arguments, function* ({ data }) {
3760
- try {
3761
- const env2 = getEnv();
3762
- const jsonData = {
3763
- attachment_ids: [],
3764
- attachment_tokens: [],
3765
- body: "",
3766
- message_id: data.message_id
3767
- };
3768
- return env2.requests.post("/chatter/message/update_content" /* DELETE_MESSAGE */, jsonData, {
3769
- headers: {
3770
- "Content-Type": "application/json"
3771
- }
3772
- });
3773
- } catch (error) {
3774
- console.error("Error when sent message:", error);
3775
- throw error;
3776
- }
3777
- });
3778
- },
3779
- getImage(_0) {
3780
- return __async(this, arguments, function* ({ data }) {
3781
- try {
3782
- const env2 = getEnv();
3783
- return env2.requests.get(
3784
- `${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
3785
- {
3786
- headers: {
3787
- "Content-Type": "application/json"
3788
- }
3789
- }
3790
- );
3791
- } catch (error) {
3792
- console.error("Error when sent message:", error);
3793
- throw error;
3794
- }
3795
- });
3796
- },
3797
- uploadImage(_0) {
3798
- return __async(this, arguments, function* ({ data }) {
3799
- try {
3800
- const env2 = getEnv();
3801
- return env2.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, data, {
3802
- headers: {
3803
- "Content-Type": "multipart/form-data"
3804
- }
3805
- });
3806
- } catch (error) {
3807
- console.error("Error when sent message:", error);
3808
- throw error;
3809
- }
3810
- });
3811
- },
3812
- getFormView(_0) {
3813
- return __async(this, arguments, function* ({ data }) {
3814
- try {
3815
- const env2 = getEnv();
3816
- const jsonData = {
3817
- model: data.model,
3818
- method: "get_formview_action",
3819
- ids: data.id ? [data.id] : [],
3820
- with_context: data.context
3821
- };
3822
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3823
- headers: {
3824
- "Content-Type": "application/json"
3825
- }
3826
- });
3827
- } catch (error) {
3828
- console.error("Error when fetching form view:", error);
3829
- throw error;
3830
- }
3831
- });
3832
- },
3833
- changeStatus(_0) {
3834
- return __async(this, arguments, function* ({ data }) {
3637
+ async getComment({ data }) {
3638
+ try {
3835
3639
  const env2 = getEnv();
3836
- const vals = {
3837
- [data.name]: data.stage_id
3838
- };
3839
3640
  const jsonData = {
3840
- model: data.model,
3841
- method: "web_save",
3641
+ thread_id: data.thread_id,
3642
+ thread_model: data.thread_model,
3643
+ limit: 100,
3842
3644
  with_context: {
3843
- lang: data.lang,
3844
- allowed_company_ids: [1],
3845
- uid: 2,
3846
- search_default_my_ticket: true,
3847
- search_default_is_open: true
3848
- },
3849
- ids: [data.id],
3850
- kwargs: {
3851
- vals,
3852
- specification: {}
3645
+ lang: data.lang
3853
3646
  }
3854
3647
  };
3855
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3648
+ return env2.requests.post("/chatter/thread/messages" /* GET_MESSAGE */, jsonData, {
3856
3649
  headers: {
3857
3650
  "Content-Type": "application/json"
3858
3651
  }
3859
3652
  });
3860
- });
3861
- }
3862
- };
3863
- var form_service_default = FormService;
3864
-
3865
- // src/services/kanban-service/index.ts
3866
- var KanbanServices = {
3867
- getGroups(_0) {
3868
- return __async(this, arguments, function* ({
3869
- model,
3870
- width_context
3871
- }) {
3653
+ } catch (error) {
3654
+ console.error("Error when sending message:", error);
3655
+ throw error;
3656
+ }
3657
+ },
3658
+ async sentComment({ data }) {
3659
+ try {
3872
3660
  const env2 = getEnv();
3873
- const jsonDataView = {
3874
- model,
3875
- method: "web_read_group",
3876
- kwargs: {
3877
- domain: [["stage_id.fold", "=", false]],
3878
- fields: ["color:sum"],
3879
- groupby: ["stage_id"]
3661
+ const jsonData = {
3662
+ context: {
3663
+ tz: "Asia/Saigon",
3664
+ uid: 2,
3665
+ allowed_company_ids: [1],
3666
+ mail_post_autofollow: false,
3667
+ temporary_id: 142183.01
3668
+ },
3669
+ post_data: {
3670
+ body: data.message,
3671
+ message_type: "comment",
3672
+ attachment_ids: data.attachment_ids,
3673
+ attachment_tokens: [],
3674
+ subtype_xmlid: data.subtype
3880
3675
  },
3881
- width_context
3676
+ thread_id: Number(data.thread_id),
3677
+ thread_model: data.thread_model
3882
3678
  };
3883
- return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
3679
+ return env2.requests.post("/chatter/message/post" /* SENT_MESSAGE */, jsonData, {
3884
3680
  headers: {
3885
3681
  "Content-Type": "application/json"
3886
3682
  }
3887
3683
  });
3888
- });
3684
+ } catch (error) {
3685
+ console.error("Error when sent message:", error);
3686
+ throw error;
3687
+ }
3889
3688
  },
3890
- getProgressBar(_0) {
3891
- return __async(this, arguments, function* ({
3892
- field,
3893
- color,
3894
- model,
3895
- width_context
3896
- }) {
3897
- const env2 = getEnv();
3898
- const jsonDataView = {
3899
- model,
3900
- method: "read_progress_bar",
3901
- kwargs: {
3902
- domain: [],
3903
- group_by: "stage_id",
3904
- progress_bar: {
3905
- colors: color,
3906
- field
3907
- }
3908
- },
3909
- width_context
3910
- };
3911
- return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
3912
- headers: {
3913
- "Content-Type": "application/json"
3914
- }
3915
- });
3916
- });
3917
- }
3918
- };
3919
- var kanban_service_default = KanbanServices;
3920
-
3921
- // src/services/model-service/index.ts
3922
- var OBJECT_POSITION = 2;
3923
- var ModelService = {
3924
- getListMyBankAccount(_0) {
3925
- return __async(this, arguments, function* ({
3926
- domain,
3927
- spectification,
3928
- model
3929
- }) {
3689
+ async deleteComment({ data }) {
3690
+ try {
3930
3691
  const env2 = getEnv();
3931
3692
  const jsonData = {
3932
- model,
3933
- method: "web_search_read",
3934
- kwargs: {
3935
- specification: spectification,
3936
- domain,
3937
- limit: 100,
3938
- offset: 0
3939
- }
3693
+ attachment_ids: [],
3694
+ attachment_tokens: [],
3695
+ body: "",
3696
+ message_id: data.message_id
3940
3697
  };
3941
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3698
+ return env2.requests.post("/chatter/message/update_content" /* DELETE_MESSAGE */, jsonData, {
3942
3699
  headers: {
3943
3700
  "Content-Type": "application/json"
3944
3701
  }
3945
3702
  });
3946
- });
3703
+ } catch (error) {
3704
+ console.error("Error when sent message:", error);
3705
+ throw error;
3706
+ }
3947
3707
  },
3948
- getCurrency() {
3949
- return __async(this, null, function* () {
3708
+ async getImage({ data }) {
3709
+ try {
3950
3710
  const env2 = getEnv();
3951
- const jsonData = {
3952
- model: "res.currency",
3953
- method: "web_search_read",
3954
- kwargs: {
3955
- specification: {
3956
- icon_url: {},
3957
- name: {}
3958
- },
3959
- domain: [["active", "=", true]],
3960
- limit: 100,
3961
- offset: 0
3711
+ return env2.requests.get(
3712
+ `${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
3713
+ {
3714
+ headers: {
3715
+ "Content-Type": "application/json"
3716
+ }
3962
3717
  }
3963
- };
3964
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3718
+ );
3719
+ } catch (error) {
3720
+ console.error("Error when sent message:", error);
3721
+ throw error;
3722
+ }
3723
+ },
3724
+ async uploadImage({ data }) {
3725
+ try {
3726
+ const env2 = getEnv();
3727
+ return env2.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, data, {
3965
3728
  headers: {
3966
- "Content-Type": "application/json"
3729
+ "Content-Type": "multipart/form-data"
3967
3730
  }
3968
3731
  });
3969
- });
3732
+ } catch (error) {
3733
+ console.error("Error when sent message:", error);
3734
+ throw error;
3735
+ }
3970
3736
  },
3971
- getConversionRate() {
3972
- return __async(this, null, function* () {
3737
+ async getFormView({ data }) {
3738
+ try {
3973
3739
  const env2 = getEnv();
3974
3740
  const jsonData = {
3975
- model: "res.currency",
3976
- method: "web_search_read",
3977
- kwargs: {
3978
- specification: {
3979
- name: {},
3980
- icon_url: {},
3981
- rate_ids: {
3982
- fields: {
3983
- company_rate: {},
3984
- sell: {}
3985
- }
3986
- }
3987
- },
3988
- domain: [["active", "=", true]],
3989
- limit: 100,
3990
- offset: 0
3991
- }
3741
+ model: data.model,
3742
+ method: "get_formview_action",
3743
+ ids: data.id ? [data.id] : [],
3744
+ with_context: data.context
3992
3745
  };
3993
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3746
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3994
3747
  headers: {
3995
3748
  "Content-Type": "application/json"
3996
3749
  }
3997
3750
  });
3751
+ } catch (error) {
3752
+ console.error("Error when fetching form view:", error);
3753
+ throw error;
3754
+ }
3755
+ },
3756
+ async changeStatus({ data }) {
3757
+ const env2 = getEnv();
3758
+ const vals = {
3759
+ [data.name]: data.stage_id
3760
+ };
3761
+ const jsonData = {
3762
+ model: data.model,
3763
+ method: "web_save",
3764
+ with_context: {
3765
+ lang: data.lang,
3766
+ allowed_company_ids: [1],
3767
+ uid: 2,
3768
+ search_default_my_ticket: true,
3769
+ search_default_is_open: true
3770
+ },
3771
+ ids: [data.id],
3772
+ kwargs: {
3773
+ vals,
3774
+ specification: {}
3775
+ }
3776
+ };
3777
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3778
+ headers: {
3779
+ "Content-Type": "application/json"
3780
+ }
3781
+ });
3782
+ }
3783
+ };
3784
+ var form_service_default = FormService;
3785
+
3786
+ // src/services/kanban-service/index.ts
3787
+ var KanbanServices = {
3788
+ async getGroups({
3789
+ model,
3790
+ width_context
3791
+ }) {
3792
+ const env2 = getEnv();
3793
+ const jsonDataView = {
3794
+ model,
3795
+ method: "web_read_group",
3796
+ kwargs: {
3797
+ domain: [["stage_id.fold", "=", false]],
3798
+ fields: ["color:sum"],
3799
+ groupby: ["stage_id"]
3800
+ },
3801
+ width_context
3802
+ };
3803
+ return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
3804
+ headers: {
3805
+ "Content-Type": "application/json"
3806
+ }
3998
3807
  });
3999
3808
  },
4000
- getAll(_0) {
4001
- return __async(this, arguments, function* ({ data }) {
4002
- const env2 = getEnv();
4003
- const jsonReadGroup = data.type == "calendar" ? { fields: data == null ? void 0 : data.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
4004
- fields: data.fields,
4005
- groupby: data.groupby
4006
- } : {
4007
- count_limit: 10001,
4008
- order: data.sort,
4009
- specification: data.specification
4010
- };
4011
- const jsonData = {
4012
- model: String(data.model),
4013
- method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
4014
- ids: data.ids,
4015
- with_context: data.context,
4016
- kwargs: __spreadValues({
4017
- domain: data.domain,
4018
- limit: data.limit,
4019
- offset: data.offset
4020
- }, jsonReadGroup)
4021
- };
4022
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4023
- headers: {
4024
- "Content-Type": "application/json"
3809
+ async getProgressBar({
3810
+ field,
3811
+ color,
3812
+ model,
3813
+ width_context
3814
+ }) {
3815
+ const env2 = getEnv();
3816
+ const jsonDataView = {
3817
+ model,
3818
+ method: "read_progress_bar",
3819
+ kwargs: {
3820
+ domain: [],
3821
+ group_by: "stage_id",
3822
+ progress_bar: {
3823
+ colors: color,
3824
+ field
4025
3825
  }
4026
- });
3826
+ },
3827
+ width_context
3828
+ };
3829
+ return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
3830
+ headers: {
3831
+ "Content-Type": "application/json"
3832
+ }
3833
+ });
3834
+ }
3835
+ };
3836
+ var kanban_service_default = KanbanServices;
3837
+
3838
+ // src/services/model-service/index.ts
3839
+ var OBJECT_POSITION = 2;
3840
+ var ModelService = {
3841
+ async getListMyBankAccount({
3842
+ domain,
3843
+ spectification,
3844
+ model
3845
+ }) {
3846
+ const env2 = getEnv();
3847
+ const jsonData = {
3848
+ model,
3849
+ method: "web_search_read",
3850
+ kwargs: {
3851
+ specification: spectification,
3852
+ domain,
3853
+ limit: 100,
3854
+ offset: 0
3855
+ }
3856
+ };
3857
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3858
+ headers: {
3859
+ "Content-Type": "application/json"
3860
+ }
4027
3861
  });
4028
3862
  },
4029
- getListCalendar(_0) {
4030
- return __async(this, arguments, function* ({ data }) {
4031
- const env2 = getEnv();
4032
- const jsonReadGroup = data.type == "calendar" ? data == null ? void 0 : data.fields : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
3863
+ async getCurrency() {
3864
+ const env2 = getEnv();
3865
+ const jsonData = {
3866
+ model: "res.currency",
3867
+ method: "web_search_read",
3868
+ kwargs: {
3869
+ specification: {
3870
+ icon_url: {},
3871
+ name: {}
3872
+ },
3873
+ domain: [["active", "=", true]],
3874
+ limit: 100,
3875
+ offset: 0
3876
+ }
3877
+ };
3878
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3879
+ headers: {
3880
+ "Content-Type": "application/json"
3881
+ }
3882
+ });
3883
+ },
3884
+ async getConversionRate() {
3885
+ const env2 = getEnv();
3886
+ const jsonData = {
3887
+ model: "res.currency",
3888
+ method: "web_search_read",
3889
+ kwargs: {
3890
+ specification: {
3891
+ name: {},
3892
+ icon_url: {},
3893
+ rate_ids: {
3894
+ fields: {
3895
+ company_rate: {},
3896
+ sell: {}
3897
+ }
3898
+ }
3899
+ },
3900
+ domain: [["active", "=", true]],
3901
+ limit: 100,
3902
+ offset: 0
3903
+ }
3904
+ };
3905
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3906
+ headers: {
3907
+ "Content-Type": "application/json"
3908
+ }
3909
+ });
3910
+ },
3911
+ async getAll({ data }) {
3912
+ const env2 = getEnv();
3913
+ const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
3914
+ fields: data.fields,
3915
+ groupby: data.groupby
3916
+ } : {
3917
+ count_limit: 10001,
3918
+ order: data.sort,
3919
+ specification: data.specification
3920
+ };
3921
+ const jsonData = {
3922
+ model: String(data.model),
3923
+ method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
3924
+ ids: data.ids,
3925
+ with_context: data.context,
3926
+ kwargs: {
3927
+ domain: data.domain,
3928
+ limit: data.limit,
3929
+ offset: data.offset,
3930
+ ...jsonReadGroup
3931
+ }
3932
+ };
3933
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3934
+ headers: {
3935
+ "Content-Type": "application/json"
3936
+ }
3937
+ });
3938
+ },
3939
+ async getListCalendar({ data }) {
3940
+ const env2 = getEnv();
3941
+ const jsonReadGroup = data.type == "calendar" ? data?.fields : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
3942
+ fields: data.fields,
3943
+ groupby: data.groupby
3944
+ } : {
3945
+ count_limit: 10001,
3946
+ order: data.sort,
3947
+ specification: data.specification
3948
+ };
3949
+ const jsonData = {
3950
+ model: String(data.model),
3951
+ method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
3952
+ ids: data.ids,
3953
+ with_context: data.context,
3954
+ kwargs: {
3955
+ domain: data.domain,
3956
+ limit: data.limit,
3957
+ offset: data.offset,
4033
3958
  fields: data.fields,
4034
- groupby: data.groupby
4035
- } : {
4036
- count_limit: 10001,
4037
- order: data.sort,
4038
- specification: data.specification
4039
- };
4040
- const jsonData = {
4041
- model: String(data.model),
4042
- method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
4043
- ids: data.ids,
4044
- with_context: data.context,
4045
- kwargs: __spreadValues({
4046
- domain: data.domain,
4047
- limit: data.limit,
4048
- offset: data.offset,
4049
- fields: data.fields
4050
- }, jsonReadGroup)
4051
- };
4052
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4053
- headers: {
4054
- "Content-Type": "application/json"
4055
- }
4056
- });
3959
+ ...jsonReadGroup
3960
+ }
3961
+ };
3962
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3963
+ headers: {
3964
+ "Content-Type": "application/json"
3965
+ }
4057
3966
  });
4058
3967
  },
4059
- getList(_0) {
4060
- return __async(this, arguments, function* ({
3968
+ async getList({
3969
+ model,
3970
+ ids = [],
3971
+ specification = {},
3972
+ domain = [],
3973
+ offset,
3974
+ order,
3975
+ context = {},
3976
+ limit = 10
3977
+ }) {
3978
+ const env2 = getEnv();
3979
+ const jsonData = {
4061
3980
  model,
4062
- ids = [],
4063
- specification = {},
4064
- domain = [],
4065
- offset,
4066
- order,
4067
- context = {},
4068
- limit = 10
4069
- }) {
4070
- var _a;
4071
- const env2 = getEnv();
4072
- const jsonData = {
4073
- model,
4074
- method: "web_search_read" /* WEB_SEARCH_READ */,
4075
- ids,
4076
- with_context: context,
4077
- kwargs: {
4078
- specification,
4079
- domain,
4080
- limit,
4081
- offset,
4082
- order
4083
- }
4084
- };
4085
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4086
- headers: {
4087
- "Content-Type": "application/json"
4088
- }
4089
- });
3981
+ method: "web_search_read" /* WEB_SEARCH_READ */,
3982
+ ids,
3983
+ with_context: context,
3984
+ kwargs: {
3985
+ specification,
3986
+ domain,
3987
+ limit,
3988
+ offset,
3989
+ order
3990
+ }
3991
+ };
3992
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
3993
+ headers: {
3994
+ "Content-Type": "application/json"
3995
+ }
4090
3996
  });
4091
3997
  },
4092
- getDetail(_0) {
4093
- return __async(this, arguments, function* ({
4094
- ids = [],
3998
+ async getDetail({
3999
+ ids = [],
4000
+ model,
4001
+ specification,
4002
+ context
4003
+ }) {
4004
+ const env2 = getEnv();
4005
+ const jsonData = {
4095
4006
  model,
4096
- specification,
4097
- context
4098
- }) {
4099
- var _a;
4100
- const env2 = getEnv();
4101
- const jsonData = {
4102
- model,
4103
- method: "web_read" /* WEB_READ */,
4104
- ids,
4105
- with_context: context,
4106
- kwargs: {
4107
- specification
4108
- }
4109
- };
4110
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4111
- headers: {
4112
- "Content-Type": "application/json"
4113
- }
4114
- });
4007
+ method: "web_read" /* WEB_READ */,
4008
+ ids,
4009
+ with_context: context,
4010
+ kwargs: {
4011
+ specification
4012
+ }
4013
+ };
4014
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4015
+ headers: {
4016
+ "Content-Type": "application/json"
4017
+ }
4115
4018
  });
4116
4019
  },
4117
- save(_0) {
4118
- return __async(this, arguments, function* ({
4020
+ async save({
4021
+ model,
4022
+ ids = [],
4023
+ data = {},
4024
+ specification = {},
4025
+ context = {},
4026
+ path
4027
+ }) {
4028
+ const env2 = getEnv();
4029
+ const jsonData = {
4119
4030
  model,
4120
- ids = [],
4121
- data = {},
4122
- specification = {},
4123
- context = {},
4124
- path
4125
- }) {
4126
- var _a;
4127
- const env2 = getEnv();
4128
- const jsonData = {
4129
- model,
4130
- method: "web_save" /* WEB_SAVE */,
4131
- with_context: context,
4132
- ids,
4133
- kwargs: {
4134
- vals: data,
4135
- specification
4136
- }
4137
- };
4138
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post(path != null ? path : "/call" /* CALL_PATH */, jsonData, {
4139
- headers: {
4140
- "Content-Type": "application/json"
4141
- }
4142
- });
4031
+ method: "web_save" /* WEB_SAVE */,
4032
+ with_context: context,
4033
+ ids,
4034
+ kwargs: {
4035
+ vals: data,
4036
+ specification
4037
+ }
4038
+ };
4039
+ return env2?.requests?.post(path ?? "/call" /* CALL_PATH */, jsonData, {
4040
+ headers: {
4041
+ "Content-Type": "application/json"
4042
+ }
4143
4043
  });
4144
4044
  },
4145
- delete(_0) {
4146
- return __async(this, arguments, function* ({ ids = [], model }) {
4147
- var _a;
4148
- const env2 = getEnv();
4149
- const jsonData = {
4150
- model,
4151
- method: "unlink" /* UNLINK */,
4152
- ids
4153
- };
4154
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4155
- headers: {
4156
- "Content-Type": "application/json"
4157
- }
4158
- });
4045
+ async delete({ ids = [], model }) {
4046
+ const env2 = getEnv();
4047
+ const jsonData = {
4048
+ model,
4049
+ method: "unlink" /* UNLINK */,
4050
+ ids
4051
+ };
4052
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4053
+ headers: {
4054
+ "Content-Type": "application/json"
4055
+ }
4159
4056
  });
4160
4057
  },
4161
- onChange(_0) {
4162
- return __async(this, arguments, function* ({
4163
- ids = [],
4058
+ async onChange({
4059
+ ids = [],
4060
+ model,
4061
+ object,
4062
+ specification,
4063
+ context,
4064
+ fieldChange
4065
+ }) {
4066
+ const env2 = getEnv();
4067
+ const jsonData = {
4164
4068
  model,
4165
- object,
4166
- specification,
4167
- context,
4168
- fieldChange
4169
- }) {
4170
- var _a;
4171
- const env2 = getEnv();
4172
- const jsonData = {
4173
- model,
4174
- method: "onchange" /* ONCHANGE */,
4175
- ids,
4176
- with_context: context,
4177
- args: [
4178
- object ? object : {},
4179
- fieldChange ? fieldChange : [],
4180
- specification
4181
- ]
4182
- };
4183
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4184
- headers: {
4185
- "Content-Type": "application/json"
4186
- }
4187
- });
4069
+ method: "onchange" /* ONCHANGE */,
4070
+ ids,
4071
+ with_context: context,
4072
+ args: [
4073
+ object ? object : {},
4074
+ fieldChange ? fieldChange : [],
4075
+ specification
4076
+ ]
4077
+ };
4078
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4079
+ headers: {
4080
+ "Content-Type": "application/json"
4081
+ }
4188
4082
  });
4189
4083
  },
4190
- getListFieldsOnchange(_0) {
4191
- return __async(this, arguments, function* ({ model }) {
4192
- var _a;
4193
- const env2 = getEnv();
4194
- const jsonData = {
4195
- model,
4196
- method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
4197
- };
4198
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4199
- headers: {
4200
- "Content-Type": "application/json"
4201
- }
4202
- });
4084
+ async getListFieldsOnchange({ model }) {
4085
+ const env2 = getEnv();
4086
+ const jsonData = {
4087
+ model,
4088
+ method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
4089
+ };
4090
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4091
+ headers: {
4092
+ "Content-Type": "application/json"
4093
+ }
4203
4094
  });
4204
4095
  },
4205
4096
  parseORMOdoo(data) {
@@ -4213,14 +4104,13 @@ var ModelService = {
4213
4104
  data[key] = "/";
4214
4105
  }
4215
4106
  }
4216
- return __spreadValues({}, data);
4107
+ return { ...data };
4217
4108
  },
4218
4109
  toDataJS(data, viewData, model) {
4219
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
4220
4110
  for (const key in data) {
4221
4111
  if (data[key] === false) {
4222
4112
  if (viewData && model) {
4223
- if (((_c = (_b = (_a = viewData == null ? void 0 : viewData.models) == null ? void 0 : _a[model]) == null ? void 0 : _b[key]) == null ? void 0 : _c.type) !== "boolean" /* BOOLEAN */) {
4113
+ if (viewData?.models?.[model]?.[key]?.type !== "boolean" /* BOOLEAN */) {
4224
4114
  data[key] = null;
4225
4115
  }
4226
4116
  } else {
@@ -4230,13 +4120,12 @@ var ModelService = {
4230
4120
  data[key] = "Draft";
4231
4121
  } else if (data[key] !== false) {
4232
4122
  if (model !== void 0) {
4233
- if (((_f = (_e = (_d = viewData == null ? void 0 : viewData.models) == null ? void 0 : _d[model]) == null ? void 0 : _e[key]) == null ? void 0 : _f.type) === "one2many" /* ONE2MANY */ || ((_i = (_h = (_g = viewData == null ? void 0 : viewData.models) == null ? void 0 : _g[model]) == null ? void 0 : _h[key]) == null ? void 0 : _i.type) === "many2many" /* MANY2MANY */) {
4234
- data[key] = (_k = (_j = data[key]) != null ? _j : data[key] = []) == null ? void 0 : _k.map((item) => {
4235
- var _a2, _b2, _c2, _d2;
4236
- const relation = (_c2 = (_b2 = (_a2 = viewData == null ? void 0 : viewData.models) == null ? void 0 : _a2[model]) == null ? void 0 : _b2[key]) == null ? void 0 : _c2.relation;
4123
+ if (viewData?.models?.[model]?.[key]?.type === "one2many" /* ONE2MANY */ || viewData?.models?.[model]?.[key]?.type === "many2many" /* MANY2MANY */) {
4124
+ data[key] = (data[key] ??= [])?.map((item) => {
4125
+ const relation = viewData?.models?.[model]?.[key]?.relation;
4237
4126
  if (relation !== void 0) {
4238
- if ((_d2 = viewData == null ? void 0 : viewData.models) == null ? void 0 : _d2[relation]) {
4239
- if ((item == null ? void 0 : item.length) >= 3) {
4127
+ if (viewData?.models?.[relation]) {
4128
+ if (item?.length >= 3) {
4240
4129
  return ModelService.toDataJS(
4241
4130
  item[OBJECT_POSITION],
4242
4131
  viewData,
@@ -4246,7 +4135,7 @@ var ModelService = {
4246
4135
  return ModelService.toDataJS(item, viewData, relation);
4247
4136
  }
4248
4137
  } else {
4249
- if ((item == null ? void 0 : item.length) >= 3) {
4138
+ if (item?.length >= 3) {
4250
4139
  return item[OBJECT_POSITION];
4251
4140
  } else {
4252
4141
  return item;
@@ -4258,556 +4147,514 @@ var ModelService = {
4258
4147
  }
4259
4148
  }
4260
4149
  }
4261
- return __spreadValues({}, data);
4150
+ return { ...data };
4262
4151
  }
4263
4152
  };
4264
4153
  var model_service_default = ModelService;
4265
4154
 
4266
4155
  // src/services/user-service/index.ts
4267
4156
  var UserService = {
4268
- getProfile(path) {
4269
- return __async(this, null, function* () {
4270
- const env2 = getEnv();
4271
- return env2.requests.get(path != null ? path : "/userinfo" /* PROFILE_PATH */, {
4272
- headers: {
4273
- "Content-Type": "application/x-www-form-urlencoded"
4274
- }
4275
- });
4157
+ async getProfile(path) {
4158
+ const env2 = getEnv();
4159
+ return env2.requests.get(path ?? "/userinfo" /* PROFILE_PATH */, {
4160
+ headers: {
4161
+ "Content-Type": "application/x-www-form-urlencoded"
4162
+ }
4276
4163
  });
4277
4164
  },
4278
- getUser(_0) {
4279
- return __async(this, arguments, function* ({ context, id }) {
4280
- const env2 = getEnv();
4281
- const jsonData = {
4282
- model: "res.users",
4283
- method: "web_read",
4284
- ids: [id],
4285
- with_context: context,
4286
- kwargs: {
4287
- specification: {
4288
- display_name: {},
4289
- image_1920: {},
4290
- name: {},
4291
- login: {},
4292
- email: {},
4293
- password: {},
4294
- visible_group_id: {
4295
- fields: {
4296
- id: {},
4297
- display_name: {}
4298
- }
4299
- },
4300
- company_id: {
4301
- fields: {
4302
- id: {},
4303
- display_name: {}
4304
- }
4165
+ async getUser({ context, id }) {
4166
+ const env2 = getEnv();
4167
+ const jsonData = {
4168
+ model: "res.users",
4169
+ method: "web_read",
4170
+ ids: [id],
4171
+ with_context: context,
4172
+ kwargs: {
4173
+ specification: {
4174
+ display_name: {},
4175
+ image_1920: {},
4176
+ name: {},
4177
+ login: {},
4178
+ email: {},
4179
+ password: {},
4180
+ visible_group_id: {
4181
+ fields: {
4182
+ id: {},
4183
+ display_name: {}
4184
+ }
4185
+ },
4186
+ company_id: {
4187
+ fields: {
4188
+ id: {},
4189
+ display_name: {}
4305
4190
  }
4306
4191
  }
4307
4192
  }
4308
- };
4309
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4310
- headers: {
4311
- "Content-Type": "application/json"
4312
- }
4313
- });
4193
+ }
4194
+ };
4195
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4196
+ headers: {
4197
+ "Content-Type": "application/json"
4198
+ }
4314
4199
  });
4315
4200
  },
4316
- switchUserLocale: (_0) => __async(null, [_0], function* ({ id, values }) {
4317
- var _a;
4201
+ switchUserLocale: async ({ id, values }) => {
4318
4202
  const env2 = getEnv();
4319
4203
  const jsonData = {
4320
4204
  model: "res.users",
4321
4205
  domain: [["id", "=", id]],
4322
4206
  values
4323
4207
  };
4324
- return env2 == null ? void 0 : env2.requests.post((_a = UriConstants) == null ? void 0 : _a.CREATE_UPDATE_PATH, jsonData, {
4208
+ return env2?.requests.post(UriConstants?.CREATE_UPDATE_PATH, jsonData, {
4325
4209
  headers: {
4326
4210
  "Content-Type": "application/json"
4327
4211
  }
4328
4212
  });
4329
- })
4213
+ }
4330
4214
  };
4331
4215
  var user_service_default = UserService;
4332
4216
 
4333
4217
  // src/services/view-service/index.ts
4334
4218
  var ViewService = {
4335
- getView(_0) {
4336
- return __async(this, arguments, function* ({
4219
+ async getView({
4220
+ model,
4221
+ views,
4222
+ context = {},
4223
+ options = {},
4224
+ aid
4225
+ }) {
4226
+ const env2 = getEnv();
4227
+ const defaultOptions = {
4228
+ load_filters: true,
4229
+ toolbar: true,
4230
+ action_id: aid
4231
+ };
4232
+ const jsonDataView = {
4337
4233
  model,
4338
- views,
4339
- context = {},
4340
- options = {},
4341
- aid
4342
- }) {
4343
- var _a;
4344
- const env2 = getEnv();
4345
- const defaultOptions = {
4346
- load_filters: true,
4347
- toolbar: true,
4348
- action_id: aid
4349
- };
4350
- const jsonDataView = {
4351
- model,
4352
- method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
4353
- kwargs: {
4354
- views,
4355
- options: __spreadValues(__spreadValues({}, options), defaultOptions)
4356
- },
4357
- with_context: context
4358
- };
4359
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonDataView, {
4360
- headers: {
4361
- "Content-Type": "application/json"
4362
- }
4363
- });
4234
+ method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
4235
+ kwargs: {
4236
+ views,
4237
+ options: { ...options, ...defaultOptions }
4238
+ },
4239
+ with_context: context
4240
+ };
4241
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
4242
+ headers: {
4243
+ "Content-Type": "application/json"
4244
+ }
4364
4245
  });
4365
4246
  },
4366
- getMenu(context) {
4367
- return __async(this, null, function* () {
4368
- var _a;
4369
- const env2 = getEnv();
4370
- const jsonData = {
4371
- model: "ir.ui.menu" /* MENU */,
4372
- method: "web_search_read" /* WEB_SEARCH_READ */,
4373
- ids: [],
4374
- with_context: context,
4375
- kwargs: {
4376
- specification: {
4377
- active: {},
4378
- name: {},
4379
- is_display: {},
4380
- sequence: {},
4381
- complete_name: {},
4382
- action: {
4383
- fields: {
4384
- display_name: {},
4385
- type: {},
4386
- binding_view_types: {}
4387
- // res_model: {},
4388
- }
4247
+ async getMenu(context) {
4248
+ const env2 = getEnv();
4249
+ const jsonData = {
4250
+ model: "ir.ui.menu" /* MENU */,
4251
+ method: "web_search_read" /* WEB_SEARCH_READ */,
4252
+ ids: [],
4253
+ with_context: context,
4254
+ kwargs: {
4255
+ specification: {
4256
+ active: {},
4257
+ name: {},
4258
+ is_display: {},
4259
+ sequence: {},
4260
+ complete_name: {},
4261
+ action: {
4262
+ fields: {
4263
+ display_name: {},
4264
+ type: {},
4265
+ binding_view_types: {}
4266
+ // res_model: {},
4267
+ }
4268
+ },
4269
+ url_icon: {},
4270
+ web_icon: {},
4271
+ web_icon_data: {},
4272
+ groups_id: {
4273
+ fields: {
4274
+ full_name: {}
4389
4275
  },
4390
- url_icon: {},
4391
- web_icon: {},
4392
- web_icon_data: {},
4393
- groups_id: {
4394
- fields: {
4395
- full_name: {}
4276
+ limit: 40,
4277
+ order: ""
4278
+ },
4279
+ display_name: {},
4280
+ child_id: {
4281
+ fields: {
4282
+ active: {},
4283
+ name: {},
4284
+ is_display: {},
4285
+ sequence: {},
4286
+ complete_name: {},
4287
+ action: {
4288
+ fields: {
4289
+ display_name: {},
4290
+ type: {},
4291
+ binding_view_types: {}
4292
+ // res_model: {},
4293
+ }
4396
4294
  },
4397
- limit: 40,
4398
- order: ""
4399
- },
4400
- display_name: {},
4401
- child_id: {
4402
- fields: {
4403
- active: {},
4404
- name: {},
4405
- is_display: {},
4406
- sequence: {},
4407
- complete_name: {},
4408
- action: {
4409
- fields: {
4410
- display_name: {},
4411
- type: {},
4412
- binding_view_types: {}
4413
- // res_model: {},
4414
- }
4295
+ url_icon: {},
4296
+ web_icon: {},
4297
+ web_icon_data: {},
4298
+ groups_id: {
4299
+ fields: {
4300
+ full_name: {}
4415
4301
  },
4416
- url_icon: {},
4417
- web_icon: {},
4418
- web_icon_data: {},
4419
- groups_id: {
4420
- fields: {
4421
- full_name: {}
4302
+ limit: 40,
4303
+ order: ""
4304
+ },
4305
+ display_name: {},
4306
+ child_id: {
4307
+ fields: {
4308
+ active: {},
4309
+ name: {},
4310
+ is_display: {},
4311
+ sequence: {},
4312
+ complete_name: {},
4313
+ action: {
4314
+ fields: {
4315
+ display_name: {},
4316
+ type: {},
4317
+ binding_view_types: {}
4318
+ // res_model: {},
4319
+ }
4422
4320
  },
4423
- limit: 40,
4424
- order: ""
4425
- },
4426
- display_name: {},
4427
- child_id: {
4428
- fields: {
4429
- active: {},
4430
- name: {},
4431
- is_display: {},
4432
- sequence: {},
4433
- complete_name: {},
4434
- action: {
4435
- fields: {
4436
- display_name: {},
4437
- type: {},
4438
- binding_view_types: {}
4439
- // res_model: {},
4440
- }
4321
+ url_icon: {},
4322
+ web_icon: {},
4323
+ web_icon_data: {},
4324
+ groups_id: {
4325
+ fields: {
4326
+ full_name: {}
4441
4327
  },
4442
- url_icon: {},
4443
- web_icon: {},
4444
- web_icon_data: {},
4445
- groups_id: {
4446
- fields: {
4447
- full_name: {}
4328
+ limit: 40,
4329
+ order: ""
4330
+ },
4331
+ display_name: {},
4332
+ child_id: {
4333
+ fields: {
4334
+ active: {},
4335
+ name: {},
4336
+ is_display: {},
4337
+ sequence: {},
4338
+ complete_name: {},
4339
+ action: {
4340
+ fields: {
4341
+ display_name: {},
4342
+ type: {},
4343
+ binding_view_types: {}
4344
+ // res_model: {},
4345
+ }
4448
4346
  },
4449
- limit: 40,
4450
- order: ""
4451
- },
4452
- display_name: {},
4453
- child_id: {
4454
- fields: {
4455
- active: {},
4456
- name: {},
4457
- is_display: {},
4458
- sequence: {},
4459
- complete_name: {},
4460
- action: {
4461
- fields: {
4462
- display_name: {},
4463
- type: {},
4464
- binding_view_types: {}
4465
- // res_model: {},
4466
- }
4467
- },
4468
- url_icon: {},
4469
- web_icon: {},
4470
- web_icon_data: {},
4471
- groups_id: {
4472
- fields: {
4473
- full_name: {}
4474
- },
4475
- limit: 40,
4476
- order: ""
4347
+ url_icon: {},
4348
+ web_icon: {},
4349
+ web_icon_data: {},
4350
+ groups_id: {
4351
+ fields: {
4352
+ full_name: {}
4477
4353
  },
4478
- display_name: {},
4479
- child_id: {
4480
- fields: {},
4481
- limit: 40,
4482
- order: ""
4483
- }
4354
+ limit: 40,
4355
+ order: ""
4484
4356
  },
4485
- limit: 40,
4486
- order: ""
4487
- }
4488
- },
4489
- limit: 40,
4490
- order: ""
4491
- }
4492
- },
4493
- limit: 40,
4494
- order: ""
4495
- }
4496
- },
4497
- domain: [
4498
- "&",
4499
- ["is_display", "=", true],
4500
- "&",
4501
- ["active", "=", true],
4502
- ["parent_id", "=", false]
4503
- ]
4504
- }
4505
- };
4506
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4507
- headers: {
4508
- "Content-Type": "application/json"
4509
- }
4510
- });
4357
+ display_name: {},
4358
+ child_id: {
4359
+ fields: {},
4360
+ limit: 40,
4361
+ order: ""
4362
+ }
4363
+ },
4364
+ limit: 40,
4365
+ order: ""
4366
+ }
4367
+ },
4368
+ limit: 40,
4369
+ order: ""
4370
+ }
4371
+ },
4372
+ limit: 40,
4373
+ order: ""
4374
+ }
4375
+ },
4376
+ domain: [
4377
+ "&",
4378
+ ["is_display", "=", true],
4379
+ "&",
4380
+ ["active", "=", true],
4381
+ ["parent_id", "=", false]
4382
+ ]
4383
+ }
4384
+ };
4385
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4386
+ headers: {
4387
+ "Content-Type": "application/json"
4388
+ }
4511
4389
  });
4512
4390
  },
4513
- getActionDetail(aid, context) {
4514
- return __async(this, null, function* () {
4515
- var _a;
4516
- const env2 = getEnv();
4517
- const jsonData = {
4518
- model: "ir.actions.act_window" /* WINDOW_ACTION */,
4519
- method: "web_read" /* WEB_READ */,
4520
- ids: [aid],
4521
- with_context: context,
4522
- kwargs: {
4523
- specification: {
4524
- id: {},
4525
- name: {},
4526
- res_model: {},
4527
- views: {},
4528
- view_mode: {},
4529
- mobile_view_mode: {},
4530
- domain: {},
4531
- context: {},
4532
- groups_id: {},
4533
- search_view_id: {}
4534
- }
4535
- }
4536
- };
4537
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4538
- headers: {
4539
- "Content-Type": "application/json"
4391
+ async getActionDetail(aid, context) {
4392
+ const env2 = getEnv();
4393
+ const jsonData = {
4394
+ model: "ir.actions.act_window" /* WINDOW_ACTION */,
4395
+ method: "web_read" /* WEB_READ */,
4396
+ ids: [aid],
4397
+ with_context: context,
4398
+ kwargs: {
4399
+ specification: {
4400
+ id: {},
4401
+ name: {},
4402
+ res_model: {},
4403
+ views: {},
4404
+ view_mode: {},
4405
+ mobile_view_mode: {},
4406
+ domain: {},
4407
+ context: {},
4408
+ groups_id: {},
4409
+ search_view_id: {}
4540
4410
  }
4541
- });
4411
+ }
4412
+ };
4413
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4414
+ headers: {
4415
+ "Content-Type": "application/json"
4416
+ }
4542
4417
  });
4543
4418
  },
4544
- getResequence(_0) {
4545
- return __async(this, arguments, function* ({
4419
+ async getResequence({
4420
+ model,
4421
+ ids,
4422
+ context,
4423
+ offset
4424
+ }) {
4425
+ const env2 = getEnv();
4426
+ const jsonData = {
4546
4427
  model,
4428
+ with_context: context,
4547
4429
  ids,
4548
- context,
4549
- offset
4550
- }) {
4551
- const env2 = getEnv();
4552
- const jsonData = __spreadValues({
4553
- model,
4554
- with_context: context,
4555
- ids,
4556
- field: "sequence"
4557
- }, offset > 0 ? { offset } : {});
4558
- return env2 == null ? void 0 : env2.requests.post("/web/dataset/resequence", jsonData, {
4559
- headers: {
4560
- "Content-Type": "application/json"
4561
- }
4562
- });
4563
- });
4564
- },
4565
- getSelectionItem(_0) {
4566
- return __async(this, arguments, function* ({ data }) {
4567
- var _a;
4568
- const env2 = getEnv();
4569
- const jsonData = {
4570
- model: data.model,
4571
- ids: [],
4572
- method: "get_data_select",
4573
- with_context: data.context,
4574
- kwargs: {
4575
- count_limit: 10001,
4576
- domain: data.domain ? data.domain : [],
4577
- offset: 0,
4578
- order: "",
4579
- specification: (_a = data == null ? void 0 : data.specification) != null ? _a : {
4580
- id: {},
4581
- name: {},
4582
- display_name: {}
4583
- }
4584
- }
4585
- };
4586
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4587
- headers: {
4588
- "Content-Type": "application/json"
4589
- }
4590
- });
4430
+ field: "sequence",
4431
+ ...offset > 0 ? { offset } : {}
4432
+ };
4433
+ return env2?.requests.post("/web/dataset/resequence", jsonData, {
4434
+ headers: {
4435
+ "Content-Type": "application/json"
4436
+ }
4591
4437
  });
4592
4438
  },
4593
- loadMessages() {
4594
- return __async(this, null, function* () {
4595
- const env2 = getEnv();
4596
- return env2.requests.post(
4597
- "/load_message_failures" /* LOAD_MESSAGE */,
4598
- {},
4599
- {
4600
- headers: {
4601
- "Content-Type": "application/json"
4602
- }
4439
+ async getSelectionItem({ data }) {
4440
+ const env2 = getEnv();
4441
+ const jsonData = {
4442
+ model: data.model,
4443
+ ids: [],
4444
+ method: "get_data_select",
4445
+ with_context: data.context,
4446
+ kwargs: {
4447
+ count_limit: 10001,
4448
+ domain: data.domain ? data.domain : [],
4449
+ offset: 0,
4450
+ order: "",
4451
+ specification: data?.specification ?? {
4452
+ id: {},
4453
+ name: {},
4454
+ display_name: {}
4603
4455
  }
4604
- );
4456
+ }
4457
+ };
4458
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4459
+ headers: {
4460
+ "Content-Type": "application/json"
4461
+ }
4605
4462
  });
4606
4463
  },
4607
- getVersion() {
4608
- return __async(this, null, function* () {
4609
- var _a;
4610
- const env2 = getEnv();
4611
- console.log("env?.requests", env2, env2 == null ? void 0 : env2.requests);
4612
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.get("", {
4464
+ async loadMessages() {
4465
+ const env2 = getEnv();
4466
+ return env2.requests.post(
4467
+ "/load_message_failures" /* LOAD_MESSAGE */,
4468
+ {},
4469
+ {
4613
4470
  headers: {
4614
4471
  "Content-Type": "application/json"
4615
4472
  }
4616
- });
4473
+ }
4474
+ );
4475
+ },
4476
+ async getVersion() {
4477
+ const env2 = getEnv();
4478
+ return env2?.requests.get("", {
4479
+ headers: {
4480
+ "Content-Type": "application/json"
4481
+ }
4617
4482
  });
4618
4483
  },
4619
- get2FAMethods(_0) {
4620
- return __async(this, arguments, function* ({
4484
+ async get2FAMethods({
4485
+ method,
4486
+ with_context
4487
+ }) {
4488
+ const env2 = getEnv();
4489
+ const jsonData = {
4621
4490
  method,
4622
4491
  with_context
4623
- }) {
4624
- const env2 = getEnv();
4625
- const jsonData = {
4626
- method,
4627
- with_context
4628
- };
4629
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4630
- headers: {
4631
- "Content-Type": "application/json"
4632
- }
4633
- });
4492
+ };
4493
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4494
+ headers: {
4495
+ "Content-Type": "application/json"
4496
+ }
4634
4497
  });
4635
4498
  },
4636
- verify2FA(_0) {
4637
- return __async(this, arguments, function* ({
4499
+ async verify2FA({
4500
+ method,
4501
+ with_context,
4502
+ code,
4503
+ device,
4504
+ location
4505
+ }) {
4506
+ const env2 = getEnv();
4507
+ const jsonData = {
4638
4508
  method,
4639
- with_context,
4640
- code,
4641
- device,
4642
- location
4643
- }) {
4644
- const env2 = getEnv();
4645
- const jsonData = {
4646
- method,
4647
- kwargs: {
4648
- vals: {
4649
- code,
4650
- device,
4651
- location
4652
- }
4653
- },
4654
- with_context
4655
- };
4656
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4657
- headers: {
4658
- "Content-Type": "application/json"
4659
- },
4660
- withCredentials: true
4661
- });
4509
+ kwargs: {
4510
+ vals: {
4511
+ code,
4512
+ device,
4513
+ location
4514
+ }
4515
+ },
4516
+ with_context
4517
+ };
4518
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4519
+ headers: {
4520
+ "Content-Type": "application/json"
4521
+ },
4522
+ withCredentials: true
4662
4523
  });
4663
4524
  },
4664
- signInSSO(_0) {
4665
- return __async(this, arguments, function* ({
4666
- redirect_uri,
4667
- state,
4668
- client_id,
4525
+ async signInSSO({
4526
+ redirect_uri,
4527
+ state,
4528
+ client_id,
4529
+ response_type,
4530
+ path
4531
+ }) {
4532
+ const env2 = getEnv();
4533
+ const params = new URLSearchParams({
4669
4534
  response_type,
4670
- path
4671
- }) {
4672
- const env2 = getEnv();
4673
- const params = new URLSearchParams({
4674
- response_type,
4675
- client_id,
4676
- redirect_uri,
4677
- state
4678
- });
4679
- const url = `${path}?${params.toString()}`;
4680
- return env2 == null ? void 0 : env2.requests.get(url, {
4681
- headers: {
4682
- "Content-Type": "application/json"
4683
- },
4684
- withCredentials: true
4685
- });
4535
+ client_id,
4536
+ redirect_uri,
4537
+ state
4538
+ });
4539
+ const url = `${path}?${params.toString()}`;
4540
+ return env2?.requests.get(url, {
4541
+ headers: {
4542
+ "Content-Type": "application/json"
4543
+ },
4544
+ withCredentials: true
4686
4545
  });
4687
4546
  },
4688
- grantAccess(_0) {
4689
- return __async(this, arguments, function* ({
4547
+ async grantAccess({
4548
+ redirect_uri,
4549
+ state,
4550
+ client_id,
4551
+ scopes
4552
+ }) {
4553
+ const env2 = getEnv();
4554
+ const jsonData = {
4690
4555
  redirect_uri,
4691
4556
  state,
4692
4557
  client_id,
4693
4558
  scopes
4694
- }) {
4695
- const env2 = getEnv();
4696
- const jsonData = {
4697
- redirect_uri,
4698
- state,
4699
- client_id,
4700
- scopes
4701
- };
4702
- return env2 == null ? void 0 : env2.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
4703
- headers: {
4704
- "Content-Type": "application/json"
4705
- },
4706
- withCredentials: true
4707
- });
4559
+ };
4560
+ return env2?.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
4561
+ headers: {
4562
+ "Content-Type": "application/json"
4563
+ },
4564
+ withCredentials: true
4708
4565
  });
4709
4566
  },
4710
- getFieldsViewSecurity(_0) {
4711
- return __async(this, arguments, function* ({
4567
+ async getFieldsViewSecurity({
4568
+ method,
4569
+ token,
4570
+ views
4571
+ }) {
4572
+ const env2 = getEnv();
4573
+ const jsonData = {
4712
4574
  method,
4713
- token,
4714
- views
4715
- }) {
4716
- const env2 = getEnv();
4717
- const jsonData = {
4718
- method,
4719
- kwargs: {
4720
- views
4721
- },
4722
- with_context: {
4723
- token
4724
- }
4725
- };
4726
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4727
- headers: {
4728
- "Content-Type": "application/json"
4729
- }
4730
- });
4575
+ kwargs: {
4576
+ views
4577
+ },
4578
+ with_context: {
4579
+ token
4580
+ }
4581
+ };
4582
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4583
+ headers: {
4584
+ "Content-Type": "application/json"
4585
+ }
4731
4586
  });
4732
4587
  },
4733
- settingsWebRead2fa(_0) {
4734
- return __async(this, arguments, function* ({
4588
+ async settingsWebRead2fa({
4589
+ method,
4590
+ model,
4591
+ kwargs,
4592
+ token
4593
+ }) {
4594
+ const env2 = getEnv();
4595
+ const jsonData = {
4735
4596
  method,
4736
4597
  model,
4737
4598
  kwargs,
4738
- token
4739
- }) {
4740
- const env2 = getEnv();
4741
- const jsonData = {
4742
- method,
4743
- model,
4744
- kwargs,
4745
- with_context: {
4746
- token
4747
- }
4748
- };
4749
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4750
- headers: {
4751
- "Content-Type": "application/json"
4752
- }
4753
- });
4599
+ with_context: {
4600
+ token
4601
+ }
4602
+ };
4603
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4604
+ headers: {
4605
+ "Content-Type": "application/json"
4606
+ }
4754
4607
  });
4755
4608
  },
4756
- requestSetupTotp(_0) {
4757
- return __async(this, arguments, function* ({ method, token }) {
4758
- const env2 = getEnv();
4759
- const jsonData = {
4760
- method,
4761
- with_context: {
4762
- token
4763
- }
4764
- };
4765
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4766
- headers: {
4767
- "Content-Type": "application/json"
4768
- }
4769
- });
4609
+ async requestSetupTotp({ method, token }) {
4610
+ const env2 = getEnv();
4611
+ const jsonData = {
4612
+ method,
4613
+ with_context: {
4614
+ token
4615
+ }
4616
+ };
4617
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4618
+ headers: {
4619
+ "Content-Type": "application/json"
4620
+ }
4770
4621
  });
4771
4622
  },
4772
- verifyTotp(_0) {
4773
- return __async(this, arguments, function* ({
4623
+ async verifyTotp({
4624
+ method,
4625
+ action_token,
4626
+ code
4627
+ }) {
4628
+ const env2 = getEnv();
4629
+ const jsonData = {
4774
4630
  method,
4775
- action_token,
4776
- code
4777
- }) {
4778
- const env2 = getEnv();
4779
- const jsonData = {
4780
- method,
4781
- kwargs: {
4782
- vals: {
4783
- code
4784
- }
4785
- },
4786
- with_context: {
4787
- action_token
4788
- }
4789
- };
4790
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4791
- headers: {
4792
- "Content-Type": "application/json"
4631
+ kwargs: {
4632
+ vals: {
4633
+ code
4793
4634
  }
4794
- });
4635
+ },
4636
+ with_context: {
4637
+ action_token
4638
+ }
4639
+ };
4640
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4641
+ headers: {
4642
+ "Content-Type": "application/json"
4643
+ }
4795
4644
  });
4796
4645
  },
4797
- removeTotpSetUp(_0) {
4798
- return __async(this, arguments, function* ({ method, token }) {
4799
- const env2 = getEnv();
4800
- const jsonData = {
4801
- method,
4802
- with_context: {
4803
- token
4804
- }
4805
- };
4806
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4807
- headers: {
4808
- "Content-Type": "application/json"
4809
- }
4810
- });
4646
+ async removeTotpSetUp({ method, token }) {
4647
+ const env2 = getEnv();
4648
+ const jsonData = {
4649
+ method,
4650
+ with_context: {
4651
+ token
4652
+ }
4653
+ };
4654
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4655
+ headers: {
4656
+ "Content-Type": "application/json"
4657
+ }
4811
4658
  });
4812
4659
  }
4813
4660
  };