@fctc/interface-logic 1.5.8 → 1.5.9

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,114 @@ 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;
3087
3069
  }
3088
3070
  setupEnv(envConfig) {
3089
- const dispatch = this.envStore.dispatch;
3090
- const env2 = __spreadProps(__spreadValues({}, envConfig), {
3071
+ const dispatch = envStore.dispatch;
3072
+ const env2 = {
3073
+ ...envConfig,
3091
3074
  localStorageUtils: this.localStorageUtils,
3092
3075
  sessionStorageUtils: this.sessionStorageUtils
3093
- });
3076
+ };
3094
3077
  const requests = axiosClient.init(env2);
3095
- dispatch(setEnv(__spreadProps(__spreadValues({}, env2), { requests })));
3078
+ dispatch(setEnv({ ...env2, requests }));
3096
3079
  this.setup();
3097
3080
  }
3098
3081
  setUid(uid) {
3099
- const dispatch = this.envStore.dispatch;
3082
+ const dispatch = envStore.dispatch;
3100
3083
  dispatch(setUid(uid));
3101
3084
  this.setup();
3102
3085
  }
3103
3086
  setLang(lang) {
3104
- const dispatch = this.envStore.dispatch;
3087
+ const dispatch = envStore.dispatch;
3105
3088
  dispatch(setLang(lang));
3106
3089
  this.setup();
3107
3090
  }
3108
3091
  setAllowCompanies(allowCompanies) {
3109
- const dispatch = this.envStore.dispatch;
3092
+ const dispatch = envStore.dispatch;
3110
3093
  dispatch(setAllowCompanies(allowCompanies));
3111
3094
  this.setup();
3112
3095
  }
3113
3096
  setCompanies(companies) {
3114
- const dispatch = this.envStore.dispatch;
3097
+ const dispatch = envStore.dispatch;
3115
3098
  dispatch(setCompanies(companies));
3116
3099
  this.setup();
3117
3100
  }
3118
3101
  setDefaultCompany(company) {
3119
- const dispatch = this.envStore.dispatch;
3102
+ const dispatch = envStore.dispatch;
3120
3103
  dispatch(setDefaultCompany(company));
3121
3104
  this.setup();
3122
3105
  }
3123
3106
  setUserInfo(userInfo) {
3124
- const dispatch = this.envStore.dispatch;
3107
+ const dispatch = envStore.dispatch;
3125
3108
  dispatch(setUser(userInfo));
3126
3109
  this.setup();
3127
3110
  }
3128
3111
  };
3129
3112
  var env = null;
3130
3113
  function getEnv() {
3131
- if (!env)
3132
- env = new EnvStore(envStore, localStorageUtils(), sessionStorageUtils());
3114
+ if (!env) env = new EnvStore(localStorageUtils(), sessionStorageUtils());
3133
3115
  return env;
3134
3116
  }
3135
3117
 
3136
3118
  // src/services/action-service/index.ts
3137
3119
  var ActionService = {
3138
3120
  // 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;
3121
+ async loadAction({
3122
+ idAction,
3123
+ context
3124
+ }) {
3125
+ const env2 = getEnv();
3126
+ const jsonData = {
3127
+ action_id: idAction,
3128
+ with_context: {
3129
+ ...context
3130
+ }
3131
+ };
3132
+ return env2.requests.post(`${"/load_action" /* LOAD_ACTION */}`, jsonData, {
3133
+ headers: {
3134
+ "Content-Type": "application/json"
3180
3135
  }
3181
3136
  });
3182
3137
  },
3183
- // remove Row
3184
- removeRows(_0) {
3185
- return __async(this, arguments, function* ({
3186
- model,
3187
- ids,
3188
- context
3189
- }) {
3138
+ // Call Button
3139
+ async callButton({
3140
+ model,
3141
+ ids = [],
3142
+ context,
3143
+ method
3144
+ }) {
3145
+ try {
3190
3146
  const env2 = getEnv();
3191
3147
  const jsonData = {
3192
3148
  model,
3193
- method: "unlink",
3149
+ method,
3194
3150
  ids,
3195
3151
  with_context: context
3196
3152
  };
@@ -3199,96 +3155,112 @@ var ActionService = {
3199
3155
  "Content-Type": "application/json"
3200
3156
  }
3201
3157
  });
3158
+ } catch (error) {
3159
+ console.error("Error when calling button action:", error);
3160
+ throw error;
3161
+ }
3162
+ },
3163
+ // remove Row
3164
+ async removeRows({
3165
+ model,
3166
+ ids,
3167
+ context
3168
+ }) {
3169
+ const env2 = getEnv();
3170
+ const jsonData = {
3171
+ model,
3172
+ method: "unlink",
3173
+ ids,
3174
+ with_context: context
3175
+ };
3176
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3177
+ headers: {
3178
+ "Content-Type": "application/json"
3179
+ }
3202
3180
  });
3203
3181
  },
3204
3182
  // Duplicate Model
3205
- duplicateRecord(_0) {
3206
- return __async(this, arguments, function* ({
3183
+ async duplicateRecord({
3184
+ model,
3185
+ id,
3186
+ context
3187
+ }) {
3188
+ const env2 = getEnv();
3189
+ const jsonData = {
3207
3190
  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
- });
3191
+ method: "copy",
3192
+ ids: id,
3193
+ with_context: context
3194
+ };
3195
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3196
+ headers: {
3197
+ "Content-Type": "application/json"
3198
+ }
3223
3199
  });
3224
3200
  },
3225
3201
  // 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"
3202
+ async getPrintReportName({ id }) {
3203
+ const env2 = getEnv();
3204
+ const jsonData = {
3205
+ model: "ir.actions.report",
3206
+ method: "web_read",
3207
+ id,
3208
+ kwargs: {
3209
+ specification: {
3210
+ report_name: {}
3242
3211
  }
3243
- });
3212
+ }
3213
+ };
3214
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3215
+ headers: {
3216
+ "Content-Type": "application/json"
3217
+ }
3244
3218
  });
3245
3219
  },
3246
3220
  //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
- });
3221
+ async print({ id, report, db }) {
3222
+ const env2 = getEnv();
3223
+ const jsonData = {
3224
+ report,
3225
+ id,
3226
+ type: "pdf",
3227
+ file_response: true,
3228
+ db
3229
+ };
3230
+ const queryString = toQueryString(jsonData);
3231
+ const urlWithParams = `${"/report" /* REPORT_PATH */}?${queryString}`;
3232
+ return env2.requests.get(urlWithParams, {
3233
+ headers: {
3234
+ "Content-Type": "application/json"
3235
+ },
3236
+ responseType: "arraybuffer"
3265
3237
  });
3266
3238
  },
3267
3239
  //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
- });
3240
+ async runAction({
3241
+ idAction,
3242
+ context
3243
+ }) {
3244
+ const env2 = getEnv();
3245
+ const jsonData = {
3246
+ action_id: idAction,
3247
+ with_context: {
3248
+ ...context
3249
+ }
3250
+ // context: {
3251
+ // lang: 'en_US',
3252
+ // tz: 'Asia/Saigon',
3253
+ // uid: 2,
3254
+ // allowed_company_ids: [1],
3255
+ // active_id: Array.isArray(idDetail) ? idDetail[0] : idDetail,
3256
+ // active_ids: Array.isArray(idDetail) ? [...idDetail] : idDetail,
3257
+ // active_model: model,
3258
+ // },
3259
+ };
3260
+ return env2.requests.post(`${"/run_action" /* RUN_ACTION_PATH */}`, jsonData, {
3261
+ headers: {
3262
+ "Content-Type": "application/json"
3263
+ }
3292
3264
  });
3293
3265
  }
3294
3266
  };
@@ -3296,238 +3268,214 @@ var action_service_default = ActionService;
3296
3268
 
3297
3269
  // src/services/auth-service/index.ts
3298
3270
  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
- });
3271
+ async login(body) {
3272
+ const env2 = getEnv();
3273
+ const payload = Object.fromEntries(
3274
+ Object.entries({
3275
+ username: body.email,
3276
+ password: body.password,
3277
+ grant_type: env2?.config?.grantType || "",
3278
+ client_id: env2?.config?.clientId || "",
3279
+ client_secret: env2?.config?.clientSecret || ""
3280
+ }).filter(([_, value]) => !!value)
3281
+ );
3282
+ const encodedData = new URLSearchParams(payload).toString();
3283
+ return env2?.requests?.post(body.path, encodedData, {
3284
+ headers: {
3285
+ "Content-Type": "application/x-www-form-urlencoded"
3286
+ }
3318
3287
  });
3319
3288
  },
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
- });
3289
+ async forgotPassword(email) {
3290
+ const env2 = getEnv();
3291
+ const bodyData = {
3292
+ login: email,
3293
+ url: `${window.location.origin}/reset-password`
3294
+ };
3295
+ return env2?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
3296
+ headers: {
3297
+ "Content-Type": "application/json"
3298
+ }
3333
3299
  });
3334
3300
  },
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"
3301
+ async forgotPasswordSSO({
3302
+ email,
3303
+ with_context,
3304
+ method
3305
+ }) {
3306
+ const env2 = getEnv();
3307
+ const body = {
3308
+ method,
3309
+ kwargs: {
3310
+ vals: {
3311
+ email
3355
3312
  }
3356
- });
3313
+ },
3314
+ with_context
3315
+ };
3316
+ return env2?.requests?.post("/call" /* CALL_PATH */, body, {
3317
+ headers: {
3318
+ "Content-Type": "application/json"
3319
+ }
3357
3320
  });
3358
3321
  },
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
- });
3322
+ async resetPassword(data, token) {
3323
+ const env2 = getEnv();
3324
+ const bodyData = {
3325
+ token,
3326
+ password: data.password,
3327
+ new_password: data.confirmPassword
3328
+ };
3329
+ return env2?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
3330
+ headers: {
3331
+ "Content-Type": "application/json"
3332
+ }
3373
3333
  });
3374
3334
  },
3375
- resetPasswordSSO(_0) {
3376
- return __async(this, arguments, function* ({
3335
+ async resetPasswordSSO({
3336
+ method,
3337
+ password,
3338
+ with_context
3339
+ }) {
3340
+ const env2 = getEnv();
3341
+ const bodyData = {
3377
3342
  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"
3343
+ kwargs: {
3344
+ vals: {
3345
+ password
3395
3346
  }
3396
- });
3347
+ },
3348
+ with_context
3349
+ };
3350
+ return env2?.requests?.post("/call" /* CALL_PATH */, bodyData, {
3351
+ headers: {
3352
+ "Content-Type": "application/json"
3353
+ }
3397
3354
  });
3398
3355
  },
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
- });
3356
+ async updatePassword(data, token) {
3357
+ const env2 = getEnv();
3358
+ const bodyData = {
3359
+ token,
3360
+ old_password: data.oldPassword,
3361
+ new_password: data.newPassword
3362
+ };
3363
+ return env2?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
3364
+ headers: {
3365
+ "Content-Type": "application/json"
3366
+ }
3413
3367
  });
3414
3368
  },
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
- });
3369
+ async isValidToken(token) {
3370
+ const env2 = getEnv();
3371
+ const bodyData = {
3372
+ token
3373
+ };
3374
+ return env2?.requests?.post("/check_token" /* TOKEN */, bodyData, {
3375
+ headers: {
3376
+ "Content-Type": "application/json"
3377
+ }
3427
3378
  });
3428
3379
  },
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
- }
3380
+ async isValidActionToken(actionToken, path) {
3381
+ const env2 = getEnv();
3382
+ return env2?.requests?.post(
3383
+ path,
3384
+ {},
3385
+ {
3386
+ headers: {
3387
+ "Content-Type": "application/json"
3388
+ },
3389
+ useActionToken: true,
3390
+ actionToken
3391
+ }
3392
+ );
3393
+ },
3394
+ async loginSocial({
3395
+ db,
3396
+ state,
3397
+ access_token
3398
+ }) {
3399
+ const env2 = getEnv();
3400
+ return env2?.requests?.post(
3401
+ "/token/generate" /* GENTOKEN_SOCIAL */,
3402
+ { state, access_token },
3403
+ {
3404
+ headers: {
3405
+ "Content-Type": "application/json"
3444
3406
  }
3445
- );
3446
- });
3407
+ }
3408
+ );
3447
3409
  },
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
- });
3410
+ async getProviders(db) {
3411
+ const env2 = getEnv();
3412
+ return env2?.requests?.get("/oauth/providers", { params: { db } });
3454
3413
  },
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
- }
3414
+ async getAccessByCode(code) {
3415
+ const env2 = getEnv();
3416
+ const data = new URLSearchParams();
3417
+ data.append("code", code);
3418
+ data.append("grant_type", "authorization_code");
3419
+ data.append("client_id", env2?.config?.clientId || "");
3420
+ data.append("redirect_uri", env2?.config?.redirectUri || "");
3421
+ return env2?.requests?.post(
3422
+ `${env2?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
3423
+ data,
3424
+ {
3425
+ headers: {
3426
+ "Content-Type": "application/x-www-form-urlencoded"
3471
3427
  }
3472
- );
3473
- });
3428
+ }
3429
+ );
3474
3430
  },
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
- });
3431
+ async logout(data) {
3432
+ const env2 = getEnv();
3433
+ console.log(data);
3434
+ return env2?.requests?.post(
3435
+ "/logout" /* LOGOUT */,
3436
+ {},
3437
+ {
3438
+ headers: {
3439
+ "Content-Type": "application/json"
3440
+ },
3441
+ withCredentials: true,
3442
+ useRefreshToken: true
3443
+ }
3444
+ );
3492
3445
  }
3493
3446
  };
3494
3447
  var auth_service_default = AuthService;
3495
3448
 
3496
3449
  // src/services/company-service/index.ts
3497
3450
  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
- });
3451
+ async getCurrentCompany() {
3452
+ const env2 = getEnv();
3453
+ return await env2.requests.get("/company" /* COMPANY_PATH */, {
3454
+ headers: {
3455
+ "Content-Type": "application/json"
3456
+ }
3506
3457
  });
3507
3458
  },
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"
3459
+ async getInfoCompany(id) {
3460
+ const env2 = getEnv();
3461
+ const jsonData = {
3462
+ ids: [id],
3463
+ model: "res.company" /* COMPANY */,
3464
+ method: "web_read" /* WEB_READ */,
3465
+ kwargs: {
3466
+ specification: {
3467
+ primary_color: {},
3468
+ secondary_color: {},
3469
+ logo: {},
3470
+ display_name: {},
3471
+ secondary_logo: {}
3529
3472
  }
3530
- });
3473
+ }
3474
+ };
3475
+ return await env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
3476
+ headers: {
3477
+ "Content-Type": "application/json"
3478
+ }
3531
3479
  });
3532
3480
  }
3533
3481
  };
@@ -3535,671 +3483,613 @@ var company_service_default = CompanyService;
3535
3483
 
3536
3484
  // src/services/excel-service/index.ts
3537
3485
  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
- });
3486
+ async uploadFile({ formData }) {
3487
+ const env2 = getEnv();
3488
+ return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3489
+ headers: {
3490
+ "Content-Type": "multipart/form-data"
3491
+ }
3546
3492
  });
3547
3493
  },
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
- });
3494
+ async uploadIdFile({ formData }) {
3495
+ const env2 = getEnv();
3496
+ return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3497
+ headers: {
3498
+ "Content-Type": "multipart/form-data"
3499
+ }
3556
3500
  });
3557
3501
  },
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"
3502
+ async parsePreview({
3503
+ id,
3504
+ selectedSheet,
3505
+ isHeader,
3506
+ context
3507
+ }) {
3508
+ const env2 = getEnv();
3509
+ const jsonData = {
3510
+ model: "base_import.import" /* BASE_IMPORT */,
3511
+ method: "parse_preview",
3512
+ ids: [id],
3513
+ kwargs: {
3514
+ options: {
3515
+ import_skip_records: [],
3516
+ import_set_empty_fields: [],
3517
+ fallback_values: {},
3518
+ name_create_enabled_fields: {},
3519
+ encoding: "",
3520
+ separator: "",
3521
+ quoting: '"',
3522
+ date_format: "",
3523
+ datetime_format: "",
3524
+ float_thousand_separator: ",",
3525
+ float_decimal_separator: ".",
3526
+ advanced: true,
3527
+ has_headers: isHeader,
3528
+ keep_matches: false,
3529
+ limit: 2e3,
3530
+ sheets: [],
3531
+ sheet: selectedSheet,
3532
+ skip: 0,
3533
+ tracking_disable: true
3598
3534
  }
3599
- });
3535
+ },
3536
+ with_context: context
3537
+ };
3538
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3539
+ headers: {
3540
+ "Content-Type": "multipart/form-data"
3541
+ }
3600
3542
  });
3601
3543
  },
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
- });
3544
+ async executeImport({
3545
+ columns,
3546
+ fields,
3547
+ idFile,
3548
+ options,
3549
+ dryrun,
3550
+ context
3551
+ }) {
3552
+ const env2 = getEnv();
3553
+ const jsonData = {
3554
+ model: "base_import.import" /* BASE_IMPORT */,
3555
+ method: "execute_import",
3556
+ ids: [idFile],
3557
+ kwargs: {
3558
+ fields,
3559
+ columns,
3560
+ options,
3561
+ dryrun
3562
+ },
3563
+ with_context: context
3564
+ };
3565
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3566
+ headers: {
3567
+ "Content-Type": "multipart/form-data"
3568
+ }
3629
3569
  });
3630
3570
  },
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
- });
3571
+ async getFileExcel({ model }) {
3572
+ const env2 = getEnv();
3573
+ const jsonData = {
3574
+ model,
3575
+ method: "get_import_templates" /* GET_IMPORT */,
3576
+ args: []
3577
+ };
3578
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData);
3641
3579
  },
3642
- getFieldExport(_0) {
3643
- return __async(this, arguments, function* ({
3644
- ids,
3580
+ async getFieldExport({
3581
+ ids,
3582
+ model,
3583
+ isShow,
3584
+ parentField,
3585
+ fieldType,
3586
+ parentName,
3587
+ prefix,
3588
+ name,
3589
+ context,
3590
+ importCompat
3591
+ }) {
3592
+ const env2 = getEnv();
3593
+ const jsonData = {
3645
3594
  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
- });
3595
+ import_compat: importCompat,
3596
+ domain: [["id", "in", ids]],
3597
+ with_context: context
3598
+ };
3599
+ if (isShow) {
3600
+ jsonData.parent_field = parentField;
3601
+ jsonData.parent_field_type = fieldType;
3602
+ jsonData.parent_name = parentName;
3603
+ jsonData.name = name;
3604
+ jsonData.prefix = prefix;
3605
+ jsonData.exclude = [null];
3606
+ }
3607
+ return env2.requests.post("/export/get_fields", jsonData);
3672
3608
  },
3673
- exportExcel(_0) {
3674
- return __async(this, arguments, function* ({
3609
+ async exportExcel({
3610
+ model,
3611
+ domain,
3612
+ ids,
3613
+ fields,
3614
+ type,
3615
+ importCompat,
3616
+ context,
3617
+ groupby
3618
+ }) {
3619
+ const env2 = getEnv();
3620
+ const jsonData = {
3675
3621
  model,
3676
3622
  domain,
3677
3623
  ids,
3624
+ import_compat: importCompat,
3678
3625
  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
- });
3626
+ with_context: context,
3627
+ groupby: groupby ?? []
3628
+ };
3629
+ return env2.requests.post_excel(`/export/${type}`, jsonData);
3696
3630
  }
3697
3631
  };
3698
3632
  var excel_service_default = ExcelService;
3699
3633
 
3700
3634
  // src/services/form-service/index.ts
3701
3635
  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 }) {
3636
+ async getComment({ data }) {
3637
+ try {
3835
3638
  const env2 = getEnv();
3836
- const vals = {
3837
- [data.name]: data.stage_id
3838
- };
3839
3639
  const jsonData = {
3840
- model: data.model,
3841
- method: "web_save",
3640
+ thread_id: data.thread_id,
3641
+ thread_model: data.thread_model,
3642
+ limit: 100,
3842
3643
  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: {}
3644
+ lang: data.lang
3853
3645
  }
3854
3646
  };
3855
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3647
+ return env2.requests.post("/chatter/thread/messages" /* GET_MESSAGE */, jsonData, {
3856
3648
  headers: {
3857
3649
  "Content-Type": "application/json"
3858
3650
  }
3859
3651
  });
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
- }) {
3652
+ } catch (error) {
3653
+ console.error("Error when sending message:", error);
3654
+ throw error;
3655
+ }
3656
+ },
3657
+ async sentComment({ data }) {
3658
+ try {
3872
3659
  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"]
3660
+ const jsonData = {
3661
+ context: {
3662
+ tz: "Asia/Saigon",
3663
+ uid: 2,
3664
+ allowed_company_ids: [1],
3665
+ mail_post_autofollow: false,
3666
+ temporary_id: 142183.01
3667
+ },
3668
+ post_data: {
3669
+ body: data.message,
3670
+ message_type: "comment",
3671
+ attachment_ids: data.attachment_ids,
3672
+ attachment_tokens: [],
3673
+ subtype_xmlid: data.subtype
3880
3674
  },
3881
- width_context
3675
+ thread_id: Number(data.thread_id),
3676
+ thread_model: data.thread_model
3882
3677
  };
3883
- return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
3678
+ return env2.requests.post("/chatter/message/post" /* SENT_MESSAGE */, jsonData, {
3884
3679
  headers: {
3885
3680
  "Content-Type": "application/json"
3886
3681
  }
3887
3682
  });
3888
- });
3683
+ } catch (error) {
3684
+ console.error("Error when sent message:", error);
3685
+ throw error;
3686
+ }
3889
3687
  },
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
- }) {
3688
+ async deleteComment({ data }) {
3689
+ try {
3930
3690
  const env2 = getEnv();
3931
3691
  const jsonData = {
3932
- model,
3933
- method: "web_search_read",
3934
- kwargs: {
3935
- specification: spectification,
3936
- domain,
3937
- limit: 100,
3938
- offset: 0
3939
- }
3692
+ attachment_ids: [],
3693
+ attachment_tokens: [],
3694
+ body: "",
3695
+ message_id: data.message_id
3940
3696
  };
3941
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3697
+ return env2.requests.post("/chatter/message/update_content" /* DELETE_MESSAGE */, jsonData, {
3942
3698
  headers: {
3943
3699
  "Content-Type": "application/json"
3944
3700
  }
3945
3701
  });
3946
- });
3702
+ } catch (error) {
3703
+ console.error("Error when sent message:", error);
3704
+ throw error;
3705
+ }
3947
3706
  },
3948
- getCurrency() {
3949
- return __async(this, null, function* () {
3707
+ async getImage({ data }) {
3708
+ try {
3950
3709
  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
3710
+ return env2.requests.get(
3711
+ `${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
3712
+ {
3713
+ headers: {
3714
+ "Content-Type": "application/json"
3715
+ }
3962
3716
  }
3963
- };
3964
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3717
+ );
3718
+ } catch (error) {
3719
+ console.error("Error when sent message:", error);
3720
+ throw error;
3721
+ }
3722
+ },
3723
+ async uploadImage({ data }) {
3724
+ try {
3725
+ const env2 = getEnv();
3726
+ return env2.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, data, {
3965
3727
  headers: {
3966
- "Content-Type": "application/json"
3728
+ "Content-Type": "multipart/form-data"
3967
3729
  }
3968
3730
  });
3969
- });
3731
+ } catch (error) {
3732
+ console.error("Error when sent message:", error);
3733
+ throw error;
3734
+ }
3970
3735
  },
3971
- getConversionRate() {
3972
- return __async(this, null, function* () {
3736
+ async getFormView({ data }) {
3737
+ try {
3973
3738
  const env2 = getEnv();
3974
3739
  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
- }
3740
+ model: data.model,
3741
+ method: "get_formview_action",
3742
+ ids: data.id ? [data.id] : [],
3743
+ with_context: data.context
3992
3744
  };
3993
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3745
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3994
3746
  headers: {
3995
3747
  "Content-Type": "application/json"
3996
3748
  }
3997
3749
  });
3750
+ } catch (error) {
3751
+ console.error("Error when fetching form view:", error);
3752
+ throw error;
3753
+ }
3754
+ },
3755
+ async changeStatus({ data }) {
3756
+ const env2 = getEnv();
3757
+ const vals = {
3758
+ [data.name]: data.stage_id
3759
+ };
3760
+ const jsonData = {
3761
+ model: data.model,
3762
+ method: "web_save",
3763
+ with_context: {
3764
+ lang: data.lang,
3765
+ allowed_company_ids: [1],
3766
+ uid: 2,
3767
+ search_default_my_ticket: true,
3768
+ search_default_is_open: true
3769
+ },
3770
+ ids: [data.id],
3771
+ kwargs: {
3772
+ vals,
3773
+ specification: {}
3774
+ }
3775
+ };
3776
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3777
+ headers: {
3778
+ "Content-Type": "application/json"
3779
+ }
3780
+ });
3781
+ }
3782
+ };
3783
+ var form_service_default = FormService;
3784
+
3785
+ // src/services/kanban-service/index.ts
3786
+ var KanbanServices = {
3787
+ async getGroups({
3788
+ model,
3789
+ width_context
3790
+ }) {
3791
+ const env2 = getEnv();
3792
+ const jsonDataView = {
3793
+ model,
3794
+ method: "web_read_group",
3795
+ kwargs: {
3796
+ domain: [["stage_id.fold", "=", false]],
3797
+ fields: ["color:sum"],
3798
+ groupby: ["stage_id"]
3799
+ },
3800
+ width_context
3801
+ };
3802
+ return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
3803
+ headers: {
3804
+ "Content-Type": "application/json"
3805
+ }
3998
3806
  });
3999
3807
  },
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"
3808
+ async getProgressBar({
3809
+ field,
3810
+ color,
3811
+ model,
3812
+ width_context
3813
+ }) {
3814
+ const env2 = getEnv();
3815
+ const jsonDataView = {
3816
+ model,
3817
+ method: "read_progress_bar",
3818
+ kwargs: {
3819
+ domain: [],
3820
+ group_by: "stage_id",
3821
+ progress_bar: {
3822
+ colors: color,
3823
+ field
4025
3824
  }
4026
- });
3825
+ },
3826
+ width_context
3827
+ };
3828
+ return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
3829
+ headers: {
3830
+ "Content-Type": "application/json"
3831
+ }
3832
+ });
3833
+ }
3834
+ };
3835
+ var kanban_service_default = KanbanServices;
3836
+
3837
+ // src/services/model-service/index.ts
3838
+ var OBJECT_POSITION = 2;
3839
+ var ModelService = {
3840
+ async getListMyBankAccount({
3841
+ domain,
3842
+ spectification,
3843
+ model
3844
+ }) {
3845
+ const env2 = getEnv();
3846
+ const jsonData = {
3847
+ model,
3848
+ method: "web_search_read",
3849
+ kwargs: {
3850
+ specification: spectification,
3851
+ domain,
3852
+ limit: 100,
3853
+ offset: 0
3854
+ }
3855
+ };
3856
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3857
+ headers: {
3858
+ "Content-Type": "application/json"
3859
+ }
4027
3860
  });
4028
3861
  },
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] ? {
3862
+ async getCurrency() {
3863
+ const env2 = getEnv();
3864
+ const jsonData = {
3865
+ model: "res.currency",
3866
+ method: "web_search_read",
3867
+ kwargs: {
3868
+ specification: {
3869
+ icon_url: {},
3870
+ name: {}
3871
+ },
3872
+ domain: [["active", "=", true]],
3873
+ limit: 100,
3874
+ offset: 0
3875
+ }
3876
+ };
3877
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3878
+ headers: {
3879
+ "Content-Type": "application/json"
3880
+ }
3881
+ });
3882
+ },
3883
+ async getConversionRate() {
3884
+ const env2 = getEnv();
3885
+ const jsonData = {
3886
+ model: "res.currency",
3887
+ method: "web_search_read",
3888
+ kwargs: {
3889
+ specification: {
3890
+ name: {},
3891
+ icon_url: {},
3892
+ rate_ids: {
3893
+ fields: {
3894
+ company_rate: {},
3895
+ sell: {}
3896
+ }
3897
+ }
3898
+ },
3899
+ domain: [["active", "=", true]],
3900
+ limit: 100,
3901
+ offset: 0
3902
+ }
3903
+ };
3904
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3905
+ headers: {
3906
+ "Content-Type": "application/json"
3907
+ }
3908
+ });
3909
+ },
3910
+ async getAll({ data }) {
3911
+ const env2 = getEnv();
3912
+ const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
3913
+ fields: data.fields,
3914
+ groupby: data.groupby
3915
+ } : {
3916
+ count_limit: 10001,
3917
+ order: data.sort,
3918
+ specification: data.specification
3919
+ };
3920
+ const jsonData = {
3921
+ model: String(data.model),
3922
+ method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
3923
+ ids: data.ids,
3924
+ with_context: data.context,
3925
+ kwargs: {
3926
+ domain: data.domain,
3927
+ limit: data.limit,
3928
+ offset: data.offset,
3929
+ ...jsonReadGroup
3930
+ }
3931
+ };
3932
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3933
+ headers: {
3934
+ "Content-Type": "application/json"
3935
+ }
3936
+ });
3937
+ },
3938
+ async getListCalendar({ data }) {
3939
+ const env2 = getEnv();
3940
+ const jsonReadGroup = data.type == "calendar" ? data?.fields : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
3941
+ fields: data.fields,
3942
+ groupby: data.groupby
3943
+ } : {
3944
+ count_limit: 10001,
3945
+ order: data.sort,
3946
+ specification: data.specification
3947
+ };
3948
+ const jsonData = {
3949
+ model: String(data.model),
3950
+ method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
3951
+ ids: data.ids,
3952
+ with_context: data.context,
3953
+ kwargs: {
3954
+ domain: data.domain,
3955
+ limit: data.limit,
3956
+ offset: data.offset,
4033
3957
  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
- });
3958
+ ...jsonReadGroup
3959
+ }
3960
+ };
3961
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3962
+ headers: {
3963
+ "Content-Type": "application/json"
3964
+ }
4057
3965
  });
4058
3966
  },
4059
- getList(_0) {
4060
- return __async(this, arguments, function* ({
3967
+ async getList({
3968
+ model,
3969
+ ids = [],
3970
+ specification = {},
3971
+ domain = [],
3972
+ offset,
3973
+ order,
3974
+ context = {},
3975
+ limit = 10
3976
+ }) {
3977
+ const env2 = getEnv();
3978
+ const jsonData = {
4061
3979
  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
- });
3980
+ method: "web_search_read" /* WEB_SEARCH_READ */,
3981
+ ids,
3982
+ with_context: context,
3983
+ kwargs: {
3984
+ specification,
3985
+ domain,
3986
+ limit,
3987
+ offset,
3988
+ order
3989
+ }
3990
+ };
3991
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
3992
+ headers: {
3993
+ "Content-Type": "application/json"
3994
+ }
4090
3995
  });
4091
3996
  },
4092
- getDetail(_0) {
4093
- return __async(this, arguments, function* ({
4094
- ids = [],
3997
+ async getDetail({
3998
+ ids = [],
3999
+ model,
4000
+ specification,
4001
+ context
4002
+ }) {
4003
+ const env2 = getEnv();
4004
+ const jsonData = {
4095
4005
  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
- });
4006
+ method: "web_read" /* WEB_READ */,
4007
+ ids,
4008
+ with_context: context,
4009
+ kwargs: {
4010
+ specification
4011
+ }
4012
+ };
4013
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4014
+ headers: {
4015
+ "Content-Type": "application/json"
4016
+ }
4115
4017
  });
4116
4018
  },
4117
- save(_0) {
4118
- return __async(this, arguments, function* ({
4019
+ async save({
4020
+ model,
4021
+ ids = [],
4022
+ data = {},
4023
+ specification = {},
4024
+ context = {},
4025
+ path
4026
+ }) {
4027
+ const env2 = getEnv();
4028
+ const jsonData = {
4119
4029
  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
- });
4030
+ method: "web_save" /* WEB_SAVE */,
4031
+ with_context: context,
4032
+ ids,
4033
+ kwargs: {
4034
+ vals: data,
4035
+ specification
4036
+ }
4037
+ };
4038
+ return env2?.requests?.post(path ?? "/call" /* CALL_PATH */, jsonData, {
4039
+ headers: {
4040
+ "Content-Type": "application/json"
4041
+ }
4143
4042
  });
4144
4043
  },
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
- });
4044
+ async delete({ ids = [], model }) {
4045
+ const env2 = getEnv();
4046
+ const jsonData = {
4047
+ model,
4048
+ method: "unlink" /* UNLINK */,
4049
+ ids
4050
+ };
4051
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4052
+ headers: {
4053
+ "Content-Type": "application/json"
4054
+ }
4159
4055
  });
4160
4056
  },
4161
- onChange(_0) {
4162
- return __async(this, arguments, function* ({
4163
- ids = [],
4057
+ async onChange({
4058
+ ids = [],
4059
+ model,
4060
+ object,
4061
+ specification,
4062
+ context,
4063
+ fieldChange
4064
+ }) {
4065
+ const env2 = getEnv();
4066
+ const jsonData = {
4164
4067
  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
- });
4068
+ method: "onchange" /* ONCHANGE */,
4069
+ ids,
4070
+ with_context: context,
4071
+ args: [
4072
+ object ? object : {},
4073
+ fieldChange ? fieldChange : [],
4074
+ specification
4075
+ ]
4076
+ };
4077
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4078
+ headers: {
4079
+ "Content-Type": "application/json"
4080
+ }
4188
4081
  });
4189
4082
  },
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
- });
4083
+ async getListFieldsOnchange({ model }) {
4084
+ const env2 = getEnv();
4085
+ const jsonData = {
4086
+ model,
4087
+ method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
4088
+ };
4089
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4090
+ headers: {
4091
+ "Content-Type": "application/json"
4092
+ }
4203
4093
  });
4204
4094
  },
4205
4095
  parseORMOdoo(data) {
@@ -4213,14 +4103,13 @@ var ModelService = {
4213
4103
  data[key] = "/";
4214
4104
  }
4215
4105
  }
4216
- return __spreadValues({}, data);
4106
+ return { ...data };
4217
4107
  },
4218
4108
  toDataJS(data, viewData, model) {
4219
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
4220
4109
  for (const key in data) {
4221
4110
  if (data[key] === false) {
4222
4111
  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 */) {
4112
+ if (viewData?.models?.[model]?.[key]?.type !== "boolean" /* BOOLEAN */) {
4224
4113
  data[key] = null;
4225
4114
  }
4226
4115
  } else {
@@ -4230,13 +4119,12 @@ var ModelService = {
4230
4119
  data[key] = "Draft";
4231
4120
  } else if (data[key] !== false) {
4232
4121
  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;
4122
+ if (viewData?.models?.[model]?.[key]?.type === "one2many" /* ONE2MANY */ || viewData?.models?.[model]?.[key]?.type === "many2many" /* MANY2MANY */) {
4123
+ data[key] = (data[key] ??= [])?.map((item) => {
4124
+ const relation = viewData?.models?.[model]?.[key]?.relation;
4237
4125
  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) {
4126
+ if (viewData?.models?.[relation]) {
4127
+ if (item?.length >= 3) {
4240
4128
  return ModelService.toDataJS(
4241
4129
  item[OBJECT_POSITION],
4242
4130
  viewData,
@@ -4246,7 +4134,7 @@ var ModelService = {
4246
4134
  return ModelService.toDataJS(item, viewData, relation);
4247
4135
  }
4248
4136
  } else {
4249
- if ((item == null ? void 0 : item.length) >= 3) {
4137
+ if (item?.length >= 3) {
4250
4138
  return item[OBJECT_POSITION];
4251
4139
  } else {
4252
4140
  return item;
@@ -4258,556 +4146,514 @@ var ModelService = {
4258
4146
  }
4259
4147
  }
4260
4148
  }
4261
- return __spreadValues({}, data);
4149
+ return { ...data };
4262
4150
  }
4263
4151
  };
4264
4152
  var model_service_default = ModelService;
4265
4153
 
4266
4154
  // src/services/user-service/index.ts
4267
4155
  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
- });
4156
+ async getProfile(path) {
4157
+ const env2 = getEnv();
4158
+ return env2.requests.get(path ?? "/userinfo" /* PROFILE_PATH */, {
4159
+ headers: {
4160
+ "Content-Type": "application/x-www-form-urlencoded"
4161
+ }
4276
4162
  });
4277
4163
  },
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
- }
4164
+ async getUser({ context, id }) {
4165
+ const env2 = getEnv();
4166
+ const jsonData = {
4167
+ model: "res.users",
4168
+ method: "web_read",
4169
+ ids: [id],
4170
+ with_context: context,
4171
+ kwargs: {
4172
+ specification: {
4173
+ display_name: {},
4174
+ image_1920: {},
4175
+ name: {},
4176
+ login: {},
4177
+ email: {},
4178
+ password: {},
4179
+ visible_group_id: {
4180
+ fields: {
4181
+ id: {},
4182
+ display_name: {}
4183
+ }
4184
+ },
4185
+ company_id: {
4186
+ fields: {
4187
+ id: {},
4188
+ display_name: {}
4305
4189
  }
4306
4190
  }
4307
4191
  }
4308
- };
4309
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4310
- headers: {
4311
- "Content-Type": "application/json"
4312
- }
4313
- });
4192
+ }
4193
+ };
4194
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4195
+ headers: {
4196
+ "Content-Type": "application/json"
4197
+ }
4314
4198
  });
4315
4199
  },
4316
- switchUserLocale: (_0) => __async(null, [_0], function* ({ id, values }) {
4317
- var _a;
4200
+ switchUserLocale: async ({ id, values }) => {
4318
4201
  const env2 = getEnv();
4319
4202
  const jsonData = {
4320
4203
  model: "res.users",
4321
4204
  domain: [["id", "=", id]],
4322
4205
  values
4323
4206
  };
4324
- return env2 == null ? void 0 : env2.requests.post((_a = UriConstants) == null ? void 0 : _a.CREATE_UPDATE_PATH, jsonData, {
4207
+ return env2?.requests.post(UriConstants?.CREATE_UPDATE_PATH, jsonData, {
4325
4208
  headers: {
4326
4209
  "Content-Type": "application/json"
4327
4210
  }
4328
4211
  });
4329
- })
4212
+ }
4330
4213
  };
4331
4214
  var user_service_default = UserService;
4332
4215
 
4333
4216
  // src/services/view-service/index.ts
4334
4217
  var ViewService = {
4335
- getView(_0) {
4336
- return __async(this, arguments, function* ({
4218
+ async getView({
4219
+ model,
4220
+ views,
4221
+ context = {},
4222
+ options = {},
4223
+ aid
4224
+ }) {
4225
+ const env2 = getEnv();
4226
+ const defaultOptions = {
4227
+ load_filters: true,
4228
+ toolbar: true,
4229
+ action_id: aid
4230
+ };
4231
+ const jsonDataView = {
4337
4232
  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
- });
4233
+ method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
4234
+ kwargs: {
4235
+ views,
4236
+ options: { ...options, ...defaultOptions }
4237
+ },
4238
+ with_context: context
4239
+ };
4240
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
4241
+ headers: {
4242
+ "Content-Type": "application/json"
4243
+ }
4364
4244
  });
4365
4245
  },
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
- }
4246
+ async getMenu(context) {
4247
+ const env2 = getEnv();
4248
+ const jsonData = {
4249
+ model: "ir.ui.menu" /* MENU */,
4250
+ method: "web_search_read" /* WEB_SEARCH_READ */,
4251
+ ids: [],
4252
+ with_context: context,
4253
+ kwargs: {
4254
+ specification: {
4255
+ active: {},
4256
+ name: {},
4257
+ is_display: {},
4258
+ sequence: {},
4259
+ complete_name: {},
4260
+ action: {
4261
+ fields: {
4262
+ display_name: {},
4263
+ type: {},
4264
+ binding_view_types: {}
4265
+ // res_model: {},
4266
+ }
4267
+ },
4268
+ url_icon: {},
4269
+ web_icon: {},
4270
+ web_icon_data: {},
4271
+ groups_id: {
4272
+ fields: {
4273
+ full_name: {}
4389
4274
  },
4390
- url_icon: {},
4391
- web_icon: {},
4392
- web_icon_data: {},
4393
- groups_id: {
4394
- fields: {
4395
- full_name: {}
4275
+ limit: 40,
4276
+ order: ""
4277
+ },
4278
+ display_name: {},
4279
+ child_id: {
4280
+ fields: {
4281
+ active: {},
4282
+ name: {},
4283
+ is_display: {},
4284
+ sequence: {},
4285
+ complete_name: {},
4286
+ action: {
4287
+ fields: {
4288
+ display_name: {},
4289
+ type: {},
4290
+ binding_view_types: {}
4291
+ // res_model: {},
4292
+ }
4396
4293
  },
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
- }
4294
+ url_icon: {},
4295
+ web_icon: {},
4296
+ web_icon_data: {},
4297
+ groups_id: {
4298
+ fields: {
4299
+ full_name: {}
4415
4300
  },
4416
- url_icon: {},
4417
- web_icon: {},
4418
- web_icon_data: {},
4419
- groups_id: {
4420
- fields: {
4421
- full_name: {}
4301
+ limit: 40,
4302
+ order: ""
4303
+ },
4304
+ display_name: {},
4305
+ child_id: {
4306
+ fields: {
4307
+ active: {},
4308
+ name: {},
4309
+ is_display: {},
4310
+ sequence: {},
4311
+ complete_name: {},
4312
+ action: {
4313
+ fields: {
4314
+ display_name: {},
4315
+ type: {},
4316
+ binding_view_types: {}
4317
+ // res_model: {},
4318
+ }
4422
4319
  },
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
- }
4320
+ url_icon: {},
4321
+ web_icon: {},
4322
+ web_icon_data: {},
4323
+ groups_id: {
4324
+ fields: {
4325
+ full_name: {}
4441
4326
  },
4442
- url_icon: {},
4443
- web_icon: {},
4444
- web_icon_data: {},
4445
- groups_id: {
4446
- fields: {
4447
- full_name: {}
4327
+ limit: 40,
4328
+ order: ""
4329
+ },
4330
+ display_name: {},
4331
+ child_id: {
4332
+ fields: {
4333
+ active: {},
4334
+ name: {},
4335
+ is_display: {},
4336
+ sequence: {},
4337
+ complete_name: {},
4338
+ action: {
4339
+ fields: {
4340
+ display_name: {},
4341
+ type: {},
4342
+ binding_view_types: {}
4343
+ // res_model: {},
4344
+ }
4448
4345
  },
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: ""
4346
+ url_icon: {},
4347
+ web_icon: {},
4348
+ web_icon_data: {},
4349
+ groups_id: {
4350
+ fields: {
4351
+ full_name: {}
4477
4352
  },
4478
- display_name: {},
4479
- child_id: {
4480
- fields: {},
4481
- limit: 40,
4482
- order: ""
4483
- }
4353
+ limit: 40,
4354
+ order: ""
4484
4355
  },
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
- });
4356
+ display_name: {},
4357
+ child_id: {
4358
+ fields: {},
4359
+ limit: 40,
4360
+ order: ""
4361
+ }
4362
+ },
4363
+ limit: 40,
4364
+ order: ""
4365
+ }
4366
+ },
4367
+ limit: 40,
4368
+ order: ""
4369
+ }
4370
+ },
4371
+ limit: 40,
4372
+ order: ""
4373
+ }
4374
+ },
4375
+ domain: [
4376
+ "&",
4377
+ ["is_display", "=", true],
4378
+ "&",
4379
+ ["active", "=", true],
4380
+ ["parent_id", "=", false]
4381
+ ]
4382
+ }
4383
+ };
4384
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4385
+ headers: {
4386
+ "Content-Type": "application/json"
4387
+ }
4511
4388
  });
4512
4389
  },
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"
4390
+ async getActionDetail(aid, context) {
4391
+ const env2 = getEnv();
4392
+ const jsonData = {
4393
+ model: "ir.actions.act_window" /* WINDOW_ACTION */,
4394
+ method: "web_read" /* WEB_READ */,
4395
+ ids: [aid],
4396
+ with_context: context,
4397
+ kwargs: {
4398
+ specification: {
4399
+ id: {},
4400
+ name: {},
4401
+ res_model: {},
4402
+ views: {},
4403
+ view_mode: {},
4404
+ mobile_view_mode: {},
4405
+ domain: {},
4406
+ context: {},
4407
+ groups_id: {},
4408
+ search_view_id: {}
4540
4409
  }
4541
- });
4410
+ }
4411
+ };
4412
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4413
+ headers: {
4414
+ "Content-Type": "application/json"
4415
+ }
4542
4416
  });
4543
4417
  },
4544
- getResequence(_0) {
4545
- return __async(this, arguments, function* ({
4418
+ async getResequence({
4419
+ model,
4420
+ ids,
4421
+ context,
4422
+ offset
4423
+ }) {
4424
+ const env2 = getEnv();
4425
+ const jsonData = {
4546
4426
  model,
4427
+ with_context: context,
4547
4428
  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
- });
4429
+ field: "sequence",
4430
+ ...offset > 0 ? { offset } : {}
4431
+ };
4432
+ return env2?.requests.post("/web/dataset/resequence", jsonData, {
4433
+ headers: {
4434
+ "Content-Type": "application/json"
4435
+ }
4591
4436
  });
4592
4437
  },
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
- }
4438
+ async getSelectionItem({ data }) {
4439
+ const env2 = getEnv();
4440
+ const jsonData = {
4441
+ model: data.model,
4442
+ ids: [],
4443
+ method: "get_data_select",
4444
+ with_context: data.context,
4445
+ kwargs: {
4446
+ count_limit: 10001,
4447
+ domain: data.domain ? data.domain : [],
4448
+ offset: 0,
4449
+ order: "",
4450
+ specification: data?.specification ?? {
4451
+ id: {},
4452
+ name: {},
4453
+ display_name: {}
4603
4454
  }
4604
- );
4455
+ }
4456
+ };
4457
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4458
+ headers: {
4459
+ "Content-Type": "application/json"
4460
+ }
4605
4461
  });
4606
4462
  },
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("", {
4463
+ async loadMessages() {
4464
+ const env2 = getEnv();
4465
+ return env2.requests.post(
4466
+ "/load_message_failures" /* LOAD_MESSAGE */,
4467
+ {},
4468
+ {
4613
4469
  headers: {
4614
4470
  "Content-Type": "application/json"
4615
4471
  }
4616
- });
4472
+ }
4473
+ );
4474
+ },
4475
+ async getVersion() {
4476
+ const env2 = getEnv();
4477
+ return env2?.requests.get("", {
4478
+ headers: {
4479
+ "Content-Type": "application/json"
4480
+ }
4617
4481
  });
4618
4482
  },
4619
- get2FAMethods(_0) {
4620
- return __async(this, arguments, function* ({
4483
+ async get2FAMethods({
4484
+ method,
4485
+ with_context
4486
+ }) {
4487
+ const env2 = getEnv();
4488
+ const jsonData = {
4621
4489
  method,
4622
4490
  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
- });
4491
+ };
4492
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4493
+ headers: {
4494
+ "Content-Type": "application/json"
4495
+ }
4634
4496
  });
4635
4497
  },
4636
- verify2FA(_0) {
4637
- return __async(this, arguments, function* ({
4498
+ async verify2FA({
4499
+ method,
4500
+ with_context,
4501
+ code,
4502
+ device,
4503
+ location
4504
+ }) {
4505
+ const env2 = getEnv();
4506
+ const jsonData = {
4638
4507
  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
- });
4508
+ kwargs: {
4509
+ vals: {
4510
+ code,
4511
+ device,
4512
+ location
4513
+ }
4514
+ },
4515
+ with_context
4516
+ };
4517
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4518
+ headers: {
4519
+ "Content-Type": "application/json"
4520
+ },
4521
+ withCredentials: true
4662
4522
  });
4663
4523
  },
4664
- signInSSO(_0) {
4665
- return __async(this, arguments, function* ({
4666
- redirect_uri,
4667
- state,
4668
- client_id,
4524
+ async signInSSO({
4525
+ redirect_uri,
4526
+ state,
4527
+ client_id,
4528
+ response_type,
4529
+ path
4530
+ }) {
4531
+ const env2 = getEnv();
4532
+ const params = new URLSearchParams({
4669
4533
  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
- });
4534
+ client_id,
4535
+ redirect_uri,
4536
+ state
4537
+ });
4538
+ const url = `${path}?${params.toString()}`;
4539
+ return env2?.requests.get(url, {
4540
+ headers: {
4541
+ "Content-Type": "application/json"
4542
+ },
4543
+ withCredentials: true
4686
4544
  });
4687
4545
  },
4688
- grantAccess(_0) {
4689
- return __async(this, arguments, function* ({
4546
+ async grantAccess({
4547
+ redirect_uri,
4548
+ state,
4549
+ client_id,
4550
+ scopes
4551
+ }) {
4552
+ const env2 = getEnv();
4553
+ const jsonData = {
4690
4554
  redirect_uri,
4691
4555
  state,
4692
4556
  client_id,
4693
4557
  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
- });
4558
+ };
4559
+ return env2?.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
4560
+ headers: {
4561
+ "Content-Type": "application/json"
4562
+ },
4563
+ withCredentials: true
4708
4564
  });
4709
4565
  },
4710
- getFieldsViewSecurity(_0) {
4711
- return __async(this, arguments, function* ({
4566
+ async getFieldsViewSecurity({
4567
+ method,
4568
+ token,
4569
+ views
4570
+ }) {
4571
+ const env2 = getEnv();
4572
+ const jsonData = {
4712
4573
  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
- });
4574
+ kwargs: {
4575
+ views
4576
+ },
4577
+ with_context: {
4578
+ token
4579
+ }
4580
+ };
4581
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4582
+ headers: {
4583
+ "Content-Type": "application/json"
4584
+ }
4731
4585
  });
4732
4586
  },
4733
- settingsWebRead2fa(_0) {
4734
- return __async(this, arguments, function* ({
4587
+ async settingsWebRead2fa({
4588
+ method,
4589
+ model,
4590
+ kwargs,
4591
+ token
4592
+ }) {
4593
+ const env2 = getEnv();
4594
+ const jsonData = {
4735
4595
  method,
4736
4596
  model,
4737
4597
  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
- });
4598
+ with_context: {
4599
+ token
4600
+ }
4601
+ };
4602
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4603
+ headers: {
4604
+ "Content-Type": "application/json"
4605
+ }
4754
4606
  });
4755
4607
  },
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
- });
4608
+ async requestSetupTotp({ method, token }) {
4609
+ const env2 = getEnv();
4610
+ const jsonData = {
4611
+ method,
4612
+ with_context: {
4613
+ token
4614
+ }
4615
+ };
4616
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4617
+ headers: {
4618
+ "Content-Type": "application/json"
4619
+ }
4770
4620
  });
4771
4621
  },
4772
- verifyTotp(_0) {
4773
- return __async(this, arguments, function* ({
4622
+ async verifyTotp({
4623
+ method,
4624
+ action_token,
4625
+ code
4626
+ }) {
4627
+ const env2 = getEnv();
4628
+ const jsonData = {
4774
4629
  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"
4630
+ kwargs: {
4631
+ vals: {
4632
+ code
4793
4633
  }
4794
- });
4634
+ },
4635
+ with_context: {
4636
+ action_token
4637
+ }
4638
+ };
4639
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4640
+ headers: {
4641
+ "Content-Type": "application/json"
4642
+ }
4795
4643
  });
4796
4644
  },
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
- });
4645
+ async removeTotpSetUp({ method, token }) {
4646
+ const env2 = getEnv();
4647
+ const jsonData = {
4648
+ method,
4649
+ with_context: {
4650
+ token
4651
+ }
4652
+ };
4653
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4654
+ headers: {
4655
+ "Content-Type": "application/json"
4656
+ }
4811
4657
  });
4812
4658
  }
4813
4659
  };