@fctc/interface-logic 1.5.3 → 1.5.5

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/hooks.js CHANGED
@@ -1,28 +1,10 @@
1
1
  "use strict";
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
- var __defProps = Object.defineProperties;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
6
  var __getProtoOf = Object.getPrototypeOf;
10
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
- var __pow = Math.pow;
13
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14
- var __spreadValues = (a, b) => {
15
- for (var prop in b || (b = {}))
16
- if (__hasOwnProp.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- if (__getOwnPropSymbols)
19
- for (var prop of __getOwnPropSymbols(b)) {
20
- if (__propIsEnum.call(b, prop))
21
- __defNormalProp(a, prop, b[prop]);
22
- }
23
- return a;
24
- };
25
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26
8
  var __export = (target, all) => {
27
9
  for (var name in all)
28
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -44,26 +26,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
44
26
  mod
45
27
  ));
46
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
47
- var __async = (__this, __arguments, generator) => {
48
- return new Promise((resolve, reject) => {
49
- var fulfilled = (value) => {
50
- try {
51
- step(generator.next(value));
52
- } catch (e) {
53
- reject(e);
54
- }
55
- };
56
- var rejected = (value) => {
57
- try {
58
- step(generator.throw(value));
59
- } catch (e) {
60
- reject(e);
61
- }
62
- };
63
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
64
- step((generator = generator.apply(__this, __arguments)).next());
65
- });
66
- };
67
29
 
68
30
  // src/hooks.ts
69
31
  var hooks_exports = {};
@@ -1263,6 +1225,22 @@ var PyRelativeDelta = class _PyRelativeDelta {
1263
1225
  this.microsecond = params.microsecond;
1264
1226
  this.weekday = params.weekday;
1265
1227
  }
1228
+ years;
1229
+ months;
1230
+ days;
1231
+ hours;
1232
+ minutes;
1233
+ seconds;
1234
+ microseconds;
1235
+ leapDays;
1236
+ year;
1237
+ month;
1238
+ day;
1239
+ hour;
1240
+ minute;
1241
+ second;
1242
+ microsecond;
1243
+ weekday;
1266
1244
  negate() {
1267
1245
  return new _PyRelativeDelta(this, -1);
1268
1246
  }
@@ -1377,7 +1355,7 @@ function execOnIterable(iterable, func) {
1377
1355
  if (typeof iterable === "object" && !Array.isArray(iterable) && !(iterable instanceof Set)) {
1378
1356
  iterable = Object.keys(iterable);
1379
1357
  }
1380
- if (typeof (iterable == null ? void 0 : iterable[Symbol.iterator]) !== "function") {
1358
+ if (typeof iterable?.[Symbol.iterator] !== "function") {
1381
1359
  throw new EvaluationError("value not iterable");
1382
1360
  }
1383
1361
  return func(iterable);
@@ -1700,7 +1678,7 @@ function applyBinaryOp(ast, context) {
1700
1678
  }
1701
1679
  return Math.floor(left / right);
1702
1680
  case "**":
1703
- return __pow(left, right);
1681
+ return left ** right;
1704
1682
  case "==":
1705
1683
  return isEqual(left, right);
1706
1684
  case "<>":
@@ -1822,7 +1800,7 @@ function evaluate(ast, context = {}) {
1822
1800
  const dicts = /* @__PURE__ */ new Set();
1823
1801
  let pyContext;
1824
1802
  const evalContext = Object.create(context);
1825
- if (!(evalContext == null ? void 0 : evalContext.context)) {
1803
+ if (!evalContext?.context) {
1826
1804
  Object.defineProperty(evalContext, "context", {
1827
1805
  get() {
1828
1806
  if (!pyContext) {
@@ -1833,18 +1811,17 @@ function evaluate(ast, context = {}) {
1833
1811
  });
1834
1812
  }
1835
1813
  function _innerEvaluate(ast2) {
1836
- var _a, _b, _c;
1837
- switch (ast2 == null ? void 0 : ast2.type) {
1814
+ switch (ast2?.type) {
1838
1815
  case 0:
1839
1816
  // Number
1840
1817
  case 1:
1841
1818
  return ast2.value;
1842
1819
  case 5:
1843
1820
  if (ast2.value in evalContext) {
1844
- if (typeof evalContext[ast2.value] === "object" && ((_a = evalContext[ast2.value]) == null ? void 0 : _a.id)) {
1845
- return (_b = evalContext[ast2.value]) == null ? void 0 : _b.id;
1821
+ if (typeof evalContext[ast2.value] === "object" && evalContext[ast2.value]?.id) {
1822
+ return evalContext[ast2.value]?.id;
1846
1823
  }
1847
- return (_c = evalContext[ast2.value]) != null ? _c : false;
1824
+ return evalContext[ast2.value] ?? false;
1848
1825
  } else if (ast2.value in BUILTINS) {
1849
1826
  return BUILTINS[ast2.value];
1850
1827
  } else {
@@ -1881,7 +1858,7 @@ function evaluate(ast, context = {}) {
1881
1858
  const args = ast2.args.map(_evaluate);
1882
1859
  const kwargs = {};
1883
1860
  for (const kwarg in ast2.kwargs) {
1884
- kwargs[kwarg] = _evaluate(ast2 == null ? void 0 : ast2.kwargs[kwarg]);
1861
+ kwargs[kwarg] = _evaluate(ast2?.kwargs[kwarg]);
1885
1862
  }
1886
1863
  if (fnValue === PyDate || fnValue === PyDateTime || fnValue === PyTime || fnValue === PyRelativeDelta || fnValue === PyTimeDelta) {
1887
1864
  return fnValue.create(...args, kwargs);
@@ -1960,25 +1937,9 @@ function escapeRegExp(str) {
1960
1937
  var InvalidDomainError = class extends Error {
1961
1938
  };
1962
1939
  var Domain = class _Domain {
1963
- constructor(descr = []) {
1964
- this.ast = { type: -1, value: null };
1965
- if (descr instanceof _Domain) {
1966
- return new _Domain(descr.toString());
1967
- } else {
1968
- let rawAST;
1969
- try {
1970
- rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
1971
- } catch (error) {
1972
- throw new InvalidDomainError(
1973
- `Invalid domain representation: ${descr}`,
1974
- {
1975
- cause: error
1976
- }
1977
- );
1978
- }
1979
- this.ast = normalizeDomainAST(rawAST);
1980
- }
1981
- }
1940
+ ast = { type: -1, value: null };
1941
+ static TRUE;
1942
+ static FALSE;
1982
1943
  static combine(domains, operator) {
1983
1944
  if (domains.length === 0) {
1984
1945
  return new _Domain([]);
@@ -2057,6 +2018,24 @@ var Domain = class _Domain {
2057
2018
  processLeaf(d.ast.value, 0, "&", newDomain);
2058
2019
  return newDomain;
2059
2020
  }
2021
+ constructor(descr = []) {
2022
+ if (descr instanceof _Domain) {
2023
+ return new _Domain(descr.toString());
2024
+ } else {
2025
+ let rawAST;
2026
+ try {
2027
+ rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
2028
+ } catch (error) {
2029
+ throw new InvalidDomainError(
2030
+ `Invalid domain representation: ${descr}`,
2031
+ {
2032
+ cause: error
2033
+ }
2034
+ );
2035
+ }
2036
+ this.ast = normalizeDomainAST(rawAST);
2037
+ }
2038
+ }
2060
2039
  contains(record) {
2061
2040
  const expr = evaluate(this.ast, record);
2062
2041
  return matchDomain(record, expr);
@@ -2075,7 +2054,7 @@ var Domain = class _Domain {
2075
2054
  return evaluatedAsList;
2076
2055
  }
2077
2056
  return this.toString();
2078
- } catch (e) {
2057
+ } catch {
2079
2058
  return this.toString();
2080
2059
  }
2081
2060
  }
@@ -2318,22 +2297,22 @@ var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
2318
2297
 
2319
2298
  // src/utils/storage/local-storage.ts
2320
2299
  var localStorageUtils = () => {
2321
- const setToken = (access_token) => __async(null, null, function* () {
2300
+ const setToken = async (access_token) => {
2322
2301
  localStorage.setItem("accessToken", access_token);
2323
- });
2324
- const setRefreshToken = (refresh_token) => __async(null, null, function* () {
2302
+ };
2303
+ const setRefreshToken = async (refresh_token) => {
2325
2304
  localStorage.setItem("refreshToken", refresh_token);
2326
- });
2327
- const getAccessToken = () => __async(null, null, function* () {
2305
+ };
2306
+ const getAccessToken = async () => {
2328
2307
  return localStorage.getItem("accessToken");
2329
- });
2330
- const getRefreshToken = () => __async(null, null, function* () {
2308
+ };
2309
+ const getRefreshToken = async () => {
2331
2310
  return localStorage.getItem("refreshToken");
2332
- });
2333
- const clearToken = () => __async(null, null, function* () {
2311
+ };
2312
+ const clearToken = async () => {
2334
2313
  localStorage.removeItem("accessToken");
2335
2314
  localStorage.removeItem("refreshToken");
2336
- });
2315
+ };
2337
2316
  return {
2338
2317
  setToken,
2339
2318
  setRefreshToken,
@@ -2345,9 +2324,9 @@ var localStorageUtils = () => {
2345
2324
 
2346
2325
  // src/utils/storage/session-storage.ts
2347
2326
  var sessionStorageUtils = () => {
2348
- const getBrowserSession = () => __async(null, null, function* () {
2327
+ const getBrowserSession = async () => {
2349
2328
  return sessionStorage.getItem("browserSession");
2350
- });
2329
+ };
2351
2330
  return {
2352
2331
  getBrowserSession
2353
2332
  };
@@ -2356,14 +2335,13 @@ var sessionStorageUtils = () => {
2356
2335
  // src/configs/axios-client.ts
2357
2336
  var axiosClient = {
2358
2337
  init(config) {
2359
- var _a, _b;
2360
- const localStorage2 = (_a = config.localStorageUtils) != null ? _a : localStorageUtils();
2361
- const sessionStorage2 = (_b = config.sessionStorageUtils) != null ? _b : sessionStorageUtils();
2338
+ const localStorage2 = config.localStorageUtils ?? localStorageUtils();
2339
+ const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
2362
2340
  const db = config.db;
2363
2341
  let isRefreshing = false;
2364
2342
  let failedQueue = [];
2365
2343
  const processQueue = (error, token = null) => {
2366
- failedQueue == null ? void 0 : failedQueue.forEach((prom) => {
2344
+ failedQueue?.forEach((prom) => {
2367
2345
  if (error) {
2368
2346
  prom.reject(error);
2369
2347
  } else {
@@ -2379,14 +2357,14 @@ var axiosClient = {
2379
2357
  paramsSerializer: (params) => new URLSearchParams(params).toString()
2380
2358
  });
2381
2359
  instance.interceptors.request.use(
2382
- (config2) => __async(null, null, function* () {
2360
+ async (config2) => {
2383
2361
  const useRefreshToken = config2.useRefreshToken;
2384
- const token = useRefreshToken ? yield localStorage2.getRefreshToken() : yield localStorage2.getAccessToken();
2362
+ const token = useRefreshToken ? await localStorage2.getRefreshToken() : await localStorage2.getAccessToken();
2385
2363
  if (token) {
2386
2364
  config2.headers["Authorization"] = "Bearer " + token;
2387
2365
  }
2388
2366
  return config2;
2389
- }),
2367
+ },
2390
2368
  (error) => {
2391
2369
  Promise.reject(error);
2392
2370
  }
@@ -2395,21 +2373,19 @@ var axiosClient = {
2395
2373
  (response) => {
2396
2374
  return handleResponse(response);
2397
2375
  },
2398
- (error) => __async(null, null, function* () {
2399
- var _a2, _b2, _c;
2400
- const handleError3 = (error2) => __async(null, null, function* () {
2401
- var _a3;
2376
+ async (error) => {
2377
+ const handleError3 = async (error2) => {
2402
2378
  if (!error2.response) {
2403
2379
  return error2;
2404
2380
  }
2405
2381
  const { data } = error2.response;
2406
- if (data && data.code === 400 && ["invalid_grant"].includes((_a3 = data.data) == null ? void 0 : _a3.error)) {
2407
- yield clearAuthToken();
2382
+ if (data && data.code === 400 && ["invalid_grant"].includes(data.data?.error)) {
2383
+ await clearAuthToken();
2408
2384
  }
2409
2385
  return data;
2410
- });
2386
+ };
2411
2387
  const originalRequest = error.config;
2412
- 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(
2388
+ if ((error.response?.status === 403 || error.response?.status === 401 || error.response?.status === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401, "ERR_2FA_006"].includes(
2413
2389
  error.response.data.code
2414
2390
  )) {
2415
2391
  if (isRefreshing) {
@@ -2422,19 +2398,18 @@ var axiosClient = {
2422
2398
  token
2423
2399
  );
2424
2400
  return instance.request(originalRequest);
2425
- }).catch((err) => __async(null, null, function* () {
2426
- var _a3, _b3;
2427
- 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)) {
2428
- yield clearAuthToken();
2401
+ }).catch(async (err) => {
2402
+ if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
2403
+ await clearAuthToken();
2429
2404
  }
2430
- }));
2405
+ });
2431
2406
  }
2432
- const browserSession = yield sessionStorage2.getBrowserSession();
2433
- const refreshToken = yield localStorage2.getRefreshToken();
2434
- const accessTokenExp = yield localStorage2.getAccessToken();
2407
+ const browserSession = await sessionStorage2.getBrowserSession();
2408
+ const refreshToken = await localStorage2.getRefreshToken();
2409
+ const accessTokenExp = await localStorage2.getAccessToken();
2435
2410
  isRefreshing = true;
2436
2411
  if (!refreshToken && (!browserSession || browserSession == "unActive")) {
2437
- yield clearAuthToken();
2412
+ await clearAuthToken();
2438
2413
  } else {
2439
2414
  const payload = Object.fromEntries(
2440
2415
  Object.entries({
@@ -2445,9 +2420,8 @@ var axiosClient = {
2445
2420
  }).filter(([_, value]) => !!value)
2446
2421
  );
2447
2422
  return new Promise(function(resolve) {
2448
- var _a3;
2449
2423
  import_axios.default.post(
2450
- `${config.baseUrl}${(_a3 = config.refreshTokenEndpoint) != null ? _a3 : "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2424
+ `${config.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2451
2425
  payload,
2452
2426
  {
2453
2427
  headers: {
@@ -2455,10 +2429,10 @@ var axiosClient = {
2455
2429
  Authorization: `Bearer ${accessTokenExp}`
2456
2430
  }
2457
2431
  }
2458
- ).then((res) => __async(null, null, function* () {
2432
+ ).then(async (res) => {
2459
2433
  const data = res.data;
2460
- yield localStorage2.setToken(data.access_token);
2461
- yield localStorage2.setRefreshToken(data.refresh_token);
2434
+ await localStorage2.setToken(data.access_token);
2435
+ await localStorage2.setRefreshToken(data.refresh_token);
2462
2436
  import_axios.default.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
2463
2437
  originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
2464
2438
  originalRequest.data = updateTokenParamInOriginalRequest(
@@ -2467,26 +2441,25 @@ var axiosClient = {
2467
2441
  );
2468
2442
  processQueue(null, data.access_token);
2469
2443
  resolve(instance.request(originalRequest));
2470
- })).catch((err) => __async(null, null, function* () {
2471
- var _a4;
2472
- 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") {
2473
- yield clearAuthToken();
2444
+ }).catch(async (err) => {
2445
+ 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") {
2446
+ await clearAuthToken();
2474
2447
  }
2475
2448
  if (err && err.response) {
2476
- const { error_code } = ((_a4 = err.response) == null ? void 0 : _a4.data) || {};
2449
+ const { error_code } = err.response?.data || {};
2477
2450
  if (error_code === "AUTHEN_FAIL") {
2478
- yield clearAuthToken();
2451
+ await clearAuthToken();
2479
2452
  }
2480
2453
  }
2481
2454
  processQueue(err, null);
2482
- })).finally(() => {
2455
+ }).finally(() => {
2483
2456
  isRefreshing = false;
2484
2457
  });
2485
2458
  });
2486
2459
  }
2487
2460
  }
2488
- return Promise.reject(yield handleError3(error));
2489
- })
2461
+ return Promise.reject(await handleError3(error));
2462
+ }
2490
2463
  );
2491
2464
  const handleResponse = (res) => {
2492
2465
  if (res && res.data) {
@@ -2495,7 +2468,6 @@ var axiosClient = {
2495
2468
  return res;
2496
2469
  };
2497
2470
  const handleError2 = (error) => {
2498
- var _a2, _b2, _c;
2499
2471
  if (error.isAxiosError && error.code === "ECONNABORTED") {
2500
2472
  console.error("Request Timeout Error:", error);
2501
2473
  return "Request Timeout Error";
@@ -2503,17 +2475,17 @@ var axiosClient = {
2503
2475
  console.error("Network Error:", error);
2504
2476
  return "Network Error";
2505
2477
  } else {
2506
- console.error("Other Error:", error == null ? void 0 : error.response);
2507
- const errorMessage = ((_b2 = (_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.data) == null ? void 0 : _b2.message) || "An error occurred";
2508
- return { message: errorMessage, status: (_c = error == null ? void 0 : error.response) == null ? void 0 : _c.status };
2478
+ console.error("Other Error:", error?.response);
2479
+ const errorMessage = error?.response?.data?.message || "An error occurred";
2480
+ return { message: errorMessage, status: error?.response?.status };
2509
2481
  }
2510
2482
  };
2511
- const clearAuthToken = () => __async(null, null, function* () {
2512
- yield localStorage2.clearToken();
2483
+ const clearAuthToken = async () => {
2484
+ await localStorage2.clearToken();
2513
2485
  if (typeof window !== "undefined") {
2514
2486
  window.location.href = `/login`;
2515
2487
  }
2516
- });
2488
+ };
2517
2489
  function formatUrl(url, db2) {
2518
2490
  return url + (db2 ? "?db=" + db2 : "");
2519
2491
  }
@@ -2726,7 +2698,7 @@ var headerSlice = (0, import_toolkit5.createSlice)({
2726
2698
  },
2727
2699
  reducers: {
2728
2700
  setHeader: (state, action) => {
2729
- state.value = __spreadValues(__spreadValues({}, state.value), action.payload);
2701
+ state.value = { ...state.value, ...action.payload };
2730
2702
  },
2731
2703
  setAllowedCompanyIds: (state, action) => {
2732
2704
  state.value.allowedCompanyIds = action.payload;
@@ -3152,6 +3124,18 @@ var envStore = (0, import_toolkit11.configureStore)({
3152
3124
 
3153
3125
  // src/environment/EnvStore.ts
3154
3126
  var EnvStore = class {
3127
+ envStore;
3128
+ baseUrl;
3129
+ requests;
3130
+ context;
3131
+ defaultCompany;
3132
+ config;
3133
+ companies;
3134
+ user;
3135
+ db;
3136
+ localStorageUtils;
3137
+ sessionStorageUtils;
3138
+ refreshTokenEndpoint;
3155
3139
  constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
3156
3140
  this.envStore = envStore2;
3157
3141
  this.localStorageUtils = localStorageUtils2;
@@ -3160,24 +3144,25 @@ var EnvStore = class {
3160
3144
  }
3161
3145
  setup() {
3162
3146
  const env2 = this.envStore.getState().env;
3163
- this.baseUrl = env2 == null ? void 0 : env2.baseUrl;
3164
- this.requests = env2 == null ? void 0 : env2.requests;
3165
- this.context = env2 == null ? void 0 : env2.context;
3166
- this.defaultCompany = env2 == null ? void 0 : env2.defaultCompany;
3167
- this.config = env2 == null ? void 0 : env2.config;
3168
- this.companies = (env2 == null ? void 0 : env2.companies) || [];
3169
- this.user = env2 == null ? void 0 : env2.user;
3170
- this.db = env2 == null ? void 0 : env2.db;
3171
- this.refreshTokenEndpoint = env2 == null ? void 0 : env2.refreshTokenEndpoint;
3147
+ this.baseUrl = env2?.baseUrl;
3148
+ this.requests = env2?.requests;
3149
+ this.context = env2?.context;
3150
+ this.defaultCompany = env2?.defaultCompany;
3151
+ this.config = env2?.config;
3152
+ this.companies = env2?.companies || [];
3153
+ this.user = env2?.user;
3154
+ this.db = env2?.db;
3155
+ this.refreshTokenEndpoint = env2?.refreshTokenEndpoint;
3172
3156
  }
3173
3157
  setupEnv(envConfig) {
3174
3158
  const dispatch = this.envStore.dispatch;
3175
- const env2 = __spreadProps(__spreadValues({}, envConfig), {
3159
+ const env2 = {
3160
+ ...envConfig,
3176
3161
  localStorageUtils: this.localStorageUtils,
3177
3162
  sessionStorageUtils: this.sessionStorageUtils
3178
- });
3163
+ };
3179
3164
  const requests = axiosClient.init(env2);
3180
- dispatch(setEnv(__spreadProps(__spreadValues({}, env2), { requests })));
3165
+ dispatch(setEnv({ ...env2, requests }));
3181
3166
  this.setup();
3182
3167
  }
3183
3168
  setUid(uid) {
@@ -3221,61 +3206,35 @@ function getEnv() {
3221
3206
  // src/services/action-service/index.ts
3222
3207
  var ActionService = {
3223
3208
  // Load Action
3224
- loadAction(_0) {
3225
- return __async(this, arguments, function* ({
3226
- idAction,
3227
- context
3228
- }) {
3229
- const env2 = getEnv();
3230
- const jsonData = {
3231
- action_id: idAction,
3232
- with_context: __spreadValues({}, context)
3233
- };
3234
- return env2.requests.post(`${"/load_action" /* LOAD_ACTION */}`, jsonData, {
3235
- headers: {
3236
- "Content-Type": "application/json"
3237
- }
3238
- });
3239
- });
3240
- },
3241
- // Call Button
3242
- callButton(_0) {
3243
- return __async(this, arguments, function* ({
3244
- model,
3245
- ids = [],
3246
- context,
3247
- method
3248
- }) {
3249
- try {
3250
- const env2 = getEnv();
3251
- const jsonData = {
3252
- model,
3253
- method,
3254
- ids,
3255
- with_context: context
3256
- };
3257
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3258
- headers: {
3259
- "Content-Type": "application/json"
3260
- }
3261
- });
3262
- } catch (error) {
3263
- console.error("Error when calling button action:", error);
3264
- throw error;
3209
+ async loadAction({
3210
+ idAction,
3211
+ context
3212
+ }) {
3213
+ const env2 = getEnv();
3214
+ const jsonData = {
3215
+ action_id: idAction,
3216
+ with_context: {
3217
+ ...context
3218
+ }
3219
+ };
3220
+ return env2.requests.post(`${"/load_action" /* LOAD_ACTION */}`, jsonData, {
3221
+ headers: {
3222
+ "Content-Type": "application/json"
3265
3223
  }
3266
3224
  });
3267
3225
  },
3268
- // remove Row
3269
- removeRows(_0) {
3270
- return __async(this, arguments, function* ({
3271
- model,
3272
- ids,
3273
- context
3274
- }) {
3226
+ // Call Button
3227
+ async callButton({
3228
+ model,
3229
+ ids = [],
3230
+ context,
3231
+ method
3232
+ }) {
3233
+ try {
3275
3234
  const env2 = getEnv();
3276
3235
  const jsonData = {
3277
3236
  model,
3278
- method: "unlink",
3237
+ method,
3279
3238
  ids,
3280
3239
  with_context: context
3281
3240
  };
@@ -3284,96 +3243,112 @@ var ActionService = {
3284
3243
  "Content-Type": "application/json"
3285
3244
  }
3286
3245
  });
3246
+ } catch (error) {
3247
+ console.error("Error when calling button action:", error);
3248
+ throw error;
3249
+ }
3250
+ },
3251
+ // remove Row
3252
+ async removeRows({
3253
+ model,
3254
+ ids,
3255
+ context
3256
+ }) {
3257
+ const env2 = getEnv();
3258
+ const jsonData = {
3259
+ model,
3260
+ method: "unlink",
3261
+ ids,
3262
+ with_context: context
3263
+ };
3264
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3265
+ headers: {
3266
+ "Content-Type": "application/json"
3267
+ }
3287
3268
  });
3288
3269
  },
3289
3270
  // Duplicate Model
3290
- duplicateRecord(_0) {
3291
- return __async(this, arguments, function* ({
3271
+ async duplicateRecord({
3272
+ model,
3273
+ id,
3274
+ context
3275
+ }) {
3276
+ const env2 = getEnv();
3277
+ const jsonData = {
3292
3278
  model,
3293
- id,
3294
- context
3295
- }) {
3296
- const env2 = getEnv();
3297
- const jsonData = {
3298
- model,
3299
- method: "copy",
3300
- ids: id,
3301
- with_context: context
3302
- };
3303
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3304
- headers: {
3305
- "Content-Type": "application/json"
3306
- }
3307
- });
3279
+ method: "copy",
3280
+ ids: id,
3281
+ with_context: context
3282
+ };
3283
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3284
+ headers: {
3285
+ "Content-Type": "application/json"
3286
+ }
3308
3287
  });
3309
3288
  },
3310
3289
  // Get Print Report
3311
- getPrintReportName(_0) {
3312
- return __async(this, arguments, function* ({ id }) {
3313
- const env2 = getEnv();
3314
- const jsonData = {
3315
- model: "ir.actions.report",
3316
- method: "web_read",
3317
- id,
3318
- kwargs: {
3319
- specification: {
3320
- report_name: {}
3321
- }
3322
- }
3323
- };
3324
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3325
- headers: {
3326
- "Content-Type": "application/json"
3290
+ async getPrintReportName({ id }) {
3291
+ const env2 = getEnv();
3292
+ const jsonData = {
3293
+ model: "ir.actions.report",
3294
+ method: "web_read",
3295
+ id,
3296
+ kwargs: {
3297
+ specification: {
3298
+ report_name: {}
3327
3299
  }
3328
- });
3300
+ }
3301
+ };
3302
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3303
+ headers: {
3304
+ "Content-Type": "application/json"
3305
+ }
3329
3306
  });
3330
3307
  },
3331
3308
  //Save Print Invoice
3332
- print(_0) {
3333
- return __async(this, arguments, function* ({ id, report, db }) {
3334
- const env2 = getEnv();
3335
- const jsonData = {
3336
- report,
3337
- id,
3338
- type: "pdf",
3339
- file_response: true,
3340
- db
3341
- };
3342
- const queryString = toQueryString(jsonData);
3343
- const urlWithParams = `${"/report" /* REPORT_PATH */}?${queryString}`;
3344
- return env2.requests.get(urlWithParams, {
3345
- headers: {
3346
- "Content-Type": "application/json"
3347
- },
3348
- responseType: "arraybuffer"
3349
- });
3309
+ async print({ id, report, db }) {
3310
+ const env2 = getEnv();
3311
+ const jsonData = {
3312
+ report,
3313
+ id,
3314
+ type: "pdf",
3315
+ file_response: true,
3316
+ db
3317
+ };
3318
+ const queryString = toQueryString(jsonData);
3319
+ const urlWithParams = `${"/report" /* REPORT_PATH */}?${queryString}`;
3320
+ return env2.requests.get(urlWithParams, {
3321
+ headers: {
3322
+ "Content-Type": "application/json"
3323
+ },
3324
+ responseType: "arraybuffer"
3350
3325
  });
3351
3326
  },
3352
3327
  //Run Action
3353
- runAction(_0) {
3354
- return __async(this, arguments, function* ({
3355
- idAction,
3356
- context
3357
- }) {
3358
- const env2 = getEnv();
3359
- const jsonData = {
3360
- action_id: idAction,
3361
- with_context: __spreadValues({}, context)
3362
- // context: {
3363
- // lang: 'en_US',
3364
- // tz: 'Asia/Saigon',
3365
- // uid: 2,
3366
- // allowed_company_ids: [1],
3367
- // active_id: Array.isArray(idDetail) ? idDetail[0] : idDetail,
3368
- // active_ids: Array.isArray(idDetail) ? [...idDetail] : idDetail,
3369
- // active_model: model,
3370
- // },
3371
- };
3372
- return env2.requests.post(`${"/run_action" /* RUN_ACTION_PATH */}`, jsonData, {
3373
- headers: {
3374
- "Content-Type": "application/json"
3375
- }
3376
- });
3328
+ async runAction({
3329
+ idAction,
3330
+ context
3331
+ }) {
3332
+ const env2 = getEnv();
3333
+ const jsonData = {
3334
+ action_id: idAction,
3335
+ with_context: {
3336
+ ...context
3337
+ }
3338
+ // context: {
3339
+ // lang: 'en_US',
3340
+ // tz: 'Asia/Saigon',
3341
+ // uid: 2,
3342
+ // allowed_company_ids: [1],
3343
+ // active_id: Array.isArray(idDetail) ? idDetail[0] : idDetail,
3344
+ // active_ids: Array.isArray(idDetail) ? [...idDetail] : idDetail,
3345
+ // active_model: model,
3346
+ // },
3347
+ };
3348
+ return env2.requests.post(`${"/run_action" /* RUN_ACTION_PATH */}`, jsonData, {
3349
+ headers: {
3350
+ "Content-Type": "application/json"
3351
+ }
3377
3352
  });
3378
3353
  }
3379
3354
  };
@@ -3381,238 +3356,200 @@ var action_service_default = ActionService;
3381
3356
 
3382
3357
  // src/services/auth-service/index.ts
3383
3358
  var AuthService = {
3384
- login(body) {
3385
- return __async(this, null, function* () {
3386
- var _a, _b, _c, _d;
3387
- const env2 = getEnv();
3388
- const payload = Object.fromEntries(
3389
- Object.entries({
3390
- username: body.email,
3391
- password: body.password,
3392
- grant_type: ((_a = env2 == null ? void 0 : env2.config) == null ? void 0 : _a.grantType) || "",
3393
- client_id: ((_b = env2 == null ? void 0 : env2.config) == null ? void 0 : _b.clientId) || "",
3394
- client_secret: ((_c = env2 == null ? void 0 : env2.config) == null ? void 0 : _c.clientSecret) || ""
3395
- }).filter(([_, value]) => !!value)
3396
- );
3397
- const encodedData = new URLSearchParams(payload).toString();
3398
- return (_d = env2 == null ? void 0 : env2.requests) == null ? void 0 : _d.post(body.path, encodedData, {
3399
- headers: {
3400
- "Content-Type": "application/x-www-form-urlencoded"
3401
- }
3402
- });
3359
+ async login(body) {
3360
+ const env2 = getEnv();
3361
+ const payload = Object.fromEntries(
3362
+ Object.entries({
3363
+ username: body.email,
3364
+ password: body.password,
3365
+ grant_type: env2?.config?.grantType || "",
3366
+ client_id: env2?.config?.clientId || "",
3367
+ client_secret: env2?.config?.clientSecret || ""
3368
+ }).filter(([_, value]) => !!value)
3369
+ );
3370
+ const encodedData = new URLSearchParams(payload).toString();
3371
+ return env2?.requests?.post(body.path, encodedData, {
3372
+ headers: {
3373
+ "Content-Type": "application/x-www-form-urlencoded"
3374
+ }
3403
3375
  });
3404
3376
  },
3405
- forgotPassword(email) {
3406
- return __async(this, null, function* () {
3407
- var _a;
3408
- const env2 = getEnv();
3409
- const bodyData = {
3410
- login: email,
3411
- url: `${window.location.origin}/reset-password`
3412
- };
3413
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
3414
- headers: {
3415
- "Content-Type": "application/json"
3416
- }
3417
- });
3377
+ async forgotPassword(email) {
3378
+ const env2 = getEnv();
3379
+ const bodyData = {
3380
+ login: email,
3381
+ url: `${window.location.origin}/reset-password`
3382
+ };
3383
+ return env2?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
3384
+ headers: {
3385
+ "Content-Type": "application/json"
3386
+ }
3418
3387
  });
3419
3388
  },
3420
- forgotPasswordSSO(_0) {
3421
- return __async(this, arguments, function* ({
3422
- email,
3423
- with_context,
3424
- method
3425
- }) {
3426
- var _a;
3427
- const env2 = getEnv();
3428
- const body = {
3429
- method,
3430
- kwargs: {
3431
- vals: {
3432
- email
3433
- }
3434
- },
3435
- with_context
3436
- };
3437
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, body, {
3438
- headers: {
3439
- "Content-Type": "application/json"
3389
+ async forgotPasswordSSO({
3390
+ email,
3391
+ with_context,
3392
+ method
3393
+ }) {
3394
+ const env2 = getEnv();
3395
+ const body = {
3396
+ method,
3397
+ kwargs: {
3398
+ vals: {
3399
+ email
3440
3400
  }
3441
- });
3401
+ },
3402
+ with_context
3403
+ };
3404
+ return env2?.requests?.post("/call" /* CALL_PATH */, body, {
3405
+ headers: {
3406
+ "Content-Type": "application/json"
3407
+ }
3442
3408
  });
3443
3409
  },
3444
- resetPassword(data, token) {
3445
- return __async(this, null, function* () {
3446
- var _a;
3447
- const env2 = getEnv();
3448
- const bodyData = {
3449
- token,
3450
- password: data.password,
3451
- new_password: data.confirmPassword
3452
- };
3453
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
3454
- headers: {
3455
- "Content-Type": "application/json"
3456
- }
3457
- });
3410
+ async resetPassword(data, token) {
3411
+ const env2 = getEnv();
3412
+ const bodyData = {
3413
+ token,
3414
+ password: data.password,
3415
+ new_password: data.confirmPassword
3416
+ };
3417
+ return env2?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
3418
+ headers: {
3419
+ "Content-Type": "application/json"
3420
+ }
3458
3421
  });
3459
3422
  },
3460
- resetPasswordSSO(_0) {
3461
- return __async(this, arguments, function* ({
3423
+ async resetPasswordSSO({
3424
+ method,
3425
+ password,
3426
+ with_context
3427
+ }) {
3428
+ const env2 = getEnv();
3429
+ const bodyData = {
3462
3430
  method,
3463
- password,
3431
+ kwargs: {
3432
+ vals: {
3433
+ password
3434
+ }
3435
+ },
3464
3436
  with_context
3465
- }) {
3466
- var _a;
3467
- const env2 = getEnv();
3468
- const bodyData = {
3469
- method,
3470
- kwargs: {
3471
- vals: {
3472
- password
3473
- }
3474
- },
3475
- with_context
3476
- };
3477
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, bodyData, {
3478
- headers: {
3479
- "Content-Type": "application/json"
3480
- }
3481
- });
3437
+ };
3438
+ return env2?.requests?.post("/call" /* CALL_PATH */, bodyData, {
3439
+ headers: {
3440
+ "Content-Type": "application/json"
3441
+ }
3482
3442
  });
3483
3443
  },
3484
- updatePassword(data, token) {
3485
- return __async(this, null, function* () {
3486
- var _a;
3487
- const env2 = getEnv();
3488
- const bodyData = {
3489
- token,
3490
- old_password: data.oldPassword,
3491
- new_password: data.newPassword
3492
- };
3493
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
3494
- headers: {
3495
- "Content-Type": "application/json"
3496
- }
3497
- });
3444
+ async updatePassword(data, token) {
3445
+ const env2 = getEnv();
3446
+ const bodyData = {
3447
+ token,
3448
+ old_password: data.oldPassword,
3449
+ new_password: data.newPassword
3450
+ };
3451
+ return env2?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
3452
+ headers: {
3453
+ "Content-Type": "application/json"
3454
+ }
3498
3455
  });
3499
3456
  },
3500
- isValidToken(token) {
3501
- return __async(this, null, function* () {
3502
- var _a;
3503
- const env2 = getEnv();
3504
- const bodyData = {
3505
- token
3506
- };
3507
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/check_token" /* TOKEN */, bodyData, {
3508
- headers: {
3509
- "Content-Type": "application/json"
3510
- }
3511
- });
3457
+ async isValidToken(token) {
3458
+ const env2 = getEnv();
3459
+ const bodyData = {
3460
+ token
3461
+ };
3462
+ return env2?.requests?.post("/check_token" /* TOKEN */, bodyData, {
3463
+ headers: {
3464
+ "Content-Type": "application/json"
3465
+ }
3512
3466
  });
3513
3467
  },
3514
- loginSocial(_0) {
3515
- return __async(this, arguments, function* ({
3516
- db,
3517
- state,
3518
- access_token
3519
- }) {
3520
- var _a;
3521
- const env2 = getEnv();
3522
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post(
3523
- "/token/generate" /* GENTOKEN_SOCIAL */,
3524
- { state, access_token },
3525
- {
3526
- headers: {
3527
- "Content-Type": "application/json"
3528
- }
3468
+ async loginSocial({
3469
+ db,
3470
+ state,
3471
+ access_token
3472
+ }) {
3473
+ const env2 = getEnv();
3474
+ return env2?.requests?.post(
3475
+ "/token/generate" /* GENTOKEN_SOCIAL */,
3476
+ { state, access_token },
3477
+ {
3478
+ headers: {
3479
+ "Content-Type": "application/json"
3529
3480
  }
3530
- );
3531
- });
3481
+ }
3482
+ );
3532
3483
  },
3533
- getProviders(db) {
3534
- return __async(this, null, function* () {
3535
- var _a;
3536
- const env2 = getEnv();
3537
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.get("/oauth/providers", { params: { db } });
3538
- });
3484
+ async getProviders(db) {
3485
+ const env2 = getEnv();
3486
+ return env2?.requests?.get("/oauth/providers", { params: { db } });
3539
3487
  },
3540
- getAccessByCode(code) {
3541
- return __async(this, null, function* () {
3542
- var _a, _b, _c, _d;
3543
- const env2 = getEnv();
3544
- const data = new URLSearchParams();
3545
- data.append("code", code);
3546
- data.append("grant_type", "authorization_code");
3547
- data.append("client_id", ((_a = env2 == null ? void 0 : env2.config) == null ? void 0 : _a.clientId) || "");
3548
- data.append("redirect_uri", ((_b = env2 == null ? void 0 : env2.config) == null ? void 0 : _b.redirectUri) || "");
3549
- return (_d = env2 == null ? void 0 : env2.requests) == null ? void 0 : _d.post(
3550
- `${(_c = env2 == null ? void 0 : env2.baseUrl) == null ? void 0 : _c.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
3551
- data,
3552
- {
3553
- headers: {
3554
- "Content-Type": "application/x-www-form-urlencoded"
3555
- }
3488
+ async getAccessByCode(code) {
3489
+ const env2 = getEnv();
3490
+ const data = new URLSearchParams();
3491
+ data.append("code", code);
3492
+ data.append("grant_type", "authorization_code");
3493
+ data.append("client_id", env2?.config?.clientId || "");
3494
+ data.append("redirect_uri", env2?.config?.redirectUri || "");
3495
+ return env2?.requests?.post(
3496
+ `${env2?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
3497
+ data,
3498
+ {
3499
+ headers: {
3500
+ "Content-Type": "application/x-www-form-urlencoded"
3556
3501
  }
3557
- );
3558
- });
3502
+ }
3503
+ );
3559
3504
  },
3560
- logout(data) {
3561
- return __async(this, null, function* () {
3562
- var _a;
3563
- const env2 = getEnv();
3564
- console.log(data);
3565
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post(
3566
- "/logout" /* LOGOUT */,
3567
- {},
3568
- {
3569
- headers: {
3570
- "Content-Type": "application/json"
3571
- },
3572
- withCredentials: true,
3573
- useRefreshToken: true
3574
- }
3575
- );
3576
- });
3505
+ async logout(data) {
3506
+ const env2 = getEnv();
3507
+ console.log(data);
3508
+ return env2?.requests?.post(
3509
+ "/logout" /* LOGOUT */,
3510
+ {},
3511
+ {
3512
+ headers: {
3513
+ "Content-Type": "application/json"
3514
+ },
3515
+ withCredentials: true,
3516
+ useRefreshToken: true
3517
+ }
3518
+ );
3577
3519
  }
3578
3520
  };
3579
3521
  var auth_service_default = AuthService;
3580
3522
 
3581
3523
  // src/services/company-service/index.ts
3582
3524
  var CompanyService = {
3583
- getCurrentCompany() {
3584
- return __async(this, null, function* () {
3585
- const env2 = getEnv();
3586
- return yield env2.requests.get("/company" /* COMPANY_PATH */, {
3587
- headers: {
3588
- "Content-Type": "application/json"
3589
- }
3590
- });
3525
+ async getCurrentCompany() {
3526
+ const env2 = getEnv();
3527
+ return await env2.requests.get("/company" /* COMPANY_PATH */, {
3528
+ headers: {
3529
+ "Content-Type": "application/json"
3530
+ }
3591
3531
  });
3592
3532
  },
3593
- getInfoCompany(id) {
3594
- return __async(this, null, function* () {
3595
- var _a;
3596
- const env2 = getEnv();
3597
- const jsonData = {
3598
- ids: [id],
3599
- model: "res.company" /* COMPANY */,
3600
- method: "web_read" /* WEB_READ */,
3601
- kwargs: {
3602
- specification: {
3603
- primary_color: {},
3604
- secondary_color: {},
3605
- logo: {},
3606
- display_name: {},
3607
- secondary_logo: {}
3608
- }
3609
- }
3610
- };
3611
- return yield (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
3612
- headers: {
3613
- "Content-Type": "application/json"
3533
+ async getInfoCompany(id) {
3534
+ const env2 = getEnv();
3535
+ const jsonData = {
3536
+ ids: [id],
3537
+ model: "res.company" /* COMPANY */,
3538
+ method: "web_read" /* WEB_READ */,
3539
+ kwargs: {
3540
+ specification: {
3541
+ primary_color: {},
3542
+ secondary_color: {},
3543
+ logo: {},
3544
+ display_name: {},
3545
+ secondary_logo: {}
3614
3546
  }
3615
- });
3547
+ }
3548
+ };
3549
+ return await env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
3550
+ headers: {
3551
+ "Content-Type": "application/json"
3552
+ }
3616
3553
  });
3617
3554
  }
3618
3555
  };
@@ -3620,328 +3557,300 @@ var company_service_default = CompanyService;
3620
3557
 
3621
3558
  // src/services/excel-service/index.ts
3622
3559
  var ExcelService = {
3623
- uploadFile(_0) {
3624
- return __async(this, arguments, function* ({ formData }) {
3625
- const env2 = getEnv();
3626
- return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3627
- headers: {
3628
- "Content-Type": "multipart/form-data"
3629
- }
3630
- });
3560
+ async uploadFile({ formData }) {
3561
+ const env2 = getEnv();
3562
+ return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3563
+ headers: {
3564
+ "Content-Type": "multipart/form-data"
3565
+ }
3631
3566
  });
3632
3567
  },
3633
- uploadIdFile(_0) {
3634
- return __async(this, arguments, function* ({ formData }) {
3635
- const env2 = getEnv();
3636
- return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3637
- headers: {
3638
- "Content-Type": "multipart/form-data"
3639
- }
3640
- });
3568
+ async uploadIdFile({ formData }) {
3569
+ const env2 = getEnv();
3570
+ return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3571
+ headers: {
3572
+ "Content-Type": "multipart/form-data"
3573
+ }
3641
3574
  });
3642
3575
  },
3643
- parsePreview(_0) {
3644
- return __async(this, arguments, function* ({
3645
- id,
3646
- selectedSheet,
3647
- isHeader,
3648
- context
3649
- }) {
3650
- const env2 = getEnv();
3651
- const jsonData = {
3652
- model: "base_import.import" /* BASE_IMPORT */,
3653
- method: "parse_preview",
3654
- ids: [id],
3655
- kwargs: {
3656
- options: {
3657
- import_skip_records: [],
3658
- import_set_empty_fields: [],
3659
- fallback_values: {},
3660
- name_create_enabled_fields: {},
3661
- encoding: "",
3662
- separator: "",
3663
- quoting: '"',
3664
- date_format: "",
3665
- datetime_format: "",
3666
- float_thousand_separator: ",",
3667
- float_decimal_separator: ".",
3668
- advanced: true,
3669
- has_headers: isHeader,
3670
- keep_matches: false,
3671
- limit: 2e3,
3672
- sheets: [],
3673
- sheet: selectedSheet,
3674
- skip: 0,
3675
- tracking_disable: true
3676
- }
3677
- },
3678
- with_context: context
3679
- };
3680
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3681
- headers: {
3682
- "Content-Type": "multipart/form-data"
3576
+ async parsePreview({
3577
+ id,
3578
+ selectedSheet,
3579
+ isHeader,
3580
+ context
3581
+ }) {
3582
+ const env2 = getEnv();
3583
+ const jsonData = {
3584
+ model: "base_import.import" /* BASE_IMPORT */,
3585
+ method: "parse_preview",
3586
+ ids: [id],
3587
+ kwargs: {
3588
+ options: {
3589
+ import_skip_records: [],
3590
+ import_set_empty_fields: [],
3591
+ fallback_values: {},
3592
+ name_create_enabled_fields: {},
3593
+ encoding: "",
3594
+ separator: "",
3595
+ quoting: '"',
3596
+ date_format: "",
3597
+ datetime_format: "",
3598
+ float_thousand_separator: ",",
3599
+ float_decimal_separator: ".",
3600
+ advanced: true,
3601
+ has_headers: isHeader,
3602
+ keep_matches: false,
3603
+ limit: 2e3,
3604
+ sheets: [],
3605
+ sheet: selectedSheet,
3606
+ skip: 0,
3607
+ tracking_disable: true
3683
3608
  }
3684
- });
3609
+ },
3610
+ with_context: context
3611
+ };
3612
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3613
+ headers: {
3614
+ "Content-Type": "multipart/form-data"
3615
+ }
3685
3616
  });
3686
3617
  },
3687
- executeImport(_0) {
3688
- return __async(this, arguments, function* ({
3689
- columns,
3690
- fields,
3691
- idFile,
3692
- options,
3693
- dryrun,
3694
- context
3695
- }) {
3696
- const env2 = getEnv();
3697
- const jsonData = {
3698
- model: "base_import.import" /* BASE_IMPORT */,
3699
- method: "execute_import",
3700
- ids: [idFile],
3701
- kwargs: {
3702
- fields,
3703
- columns,
3704
- options,
3705
- dryrun
3706
- },
3707
- with_context: context
3708
- };
3709
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3710
- headers: {
3711
- "Content-Type": "multipart/form-data"
3712
- }
3713
- });
3618
+ async executeImport({
3619
+ columns,
3620
+ fields,
3621
+ idFile,
3622
+ options,
3623
+ dryrun,
3624
+ context
3625
+ }) {
3626
+ const env2 = getEnv();
3627
+ const jsonData = {
3628
+ model: "base_import.import" /* BASE_IMPORT */,
3629
+ method: "execute_import",
3630
+ ids: [idFile],
3631
+ kwargs: {
3632
+ fields,
3633
+ columns,
3634
+ options,
3635
+ dryrun
3636
+ },
3637
+ with_context: context
3638
+ };
3639
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3640
+ headers: {
3641
+ "Content-Type": "multipart/form-data"
3642
+ }
3714
3643
  });
3715
3644
  },
3716
- getFileExcel(_0) {
3717
- return __async(this, arguments, function* ({ model }) {
3718
- const env2 = getEnv();
3719
- const jsonData = {
3720
- model,
3721
- method: "get_import_templates" /* GET_IMPORT */,
3722
- args: []
3723
- };
3724
- return env2.requests.post("/call" /* CALL_PATH */, jsonData);
3725
- });
3645
+ async getFileExcel({ model }) {
3646
+ const env2 = getEnv();
3647
+ const jsonData = {
3648
+ model,
3649
+ method: "get_import_templates" /* GET_IMPORT */,
3650
+ args: []
3651
+ };
3652
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData);
3726
3653
  },
3727
- getFieldExport(_0) {
3728
- return __async(this, arguments, function* ({
3729
- ids,
3654
+ async getFieldExport({
3655
+ ids,
3656
+ model,
3657
+ isShow,
3658
+ parentField,
3659
+ fieldType,
3660
+ parentName,
3661
+ prefix,
3662
+ name,
3663
+ context,
3664
+ importCompat
3665
+ }) {
3666
+ const env2 = getEnv();
3667
+ const jsonData = {
3730
3668
  model,
3731
- isShow,
3732
- parentField,
3733
- fieldType,
3734
- parentName,
3735
- prefix,
3736
- name,
3737
- context,
3738
- importCompat
3739
- }) {
3740
- const env2 = getEnv();
3741
- const jsonData = {
3742
- model,
3743
- import_compat: importCompat,
3744
- domain: [["id", "in", ids]],
3745
- with_context: context
3746
- };
3747
- if (isShow) {
3748
- jsonData.parent_field = parentField;
3749
- jsonData.parent_field_type = fieldType;
3750
- jsonData.parent_name = parentName;
3751
- jsonData.name = name;
3752
- jsonData.prefix = prefix;
3753
- jsonData.exclude = [null];
3754
- }
3755
- return env2.requests.post("/export/get_fields", jsonData);
3756
- });
3669
+ import_compat: importCompat,
3670
+ domain: [["id", "in", ids]],
3671
+ with_context: context
3672
+ };
3673
+ if (isShow) {
3674
+ jsonData.parent_field = parentField;
3675
+ jsonData.parent_field_type = fieldType;
3676
+ jsonData.parent_name = parentName;
3677
+ jsonData.name = name;
3678
+ jsonData.prefix = prefix;
3679
+ jsonData.exclude = [null];
3680
+ }
3681
+ return env2.requests.post("/export/get_fields", jsonData);
3757
3682
  },
3758
- exportExcel(_0) {
3759
- return __async(this, arguments, function* ({
3683
+ async exportExcel({
3684
+ model,
3685
+ domain,
3686
+ ids,
3687
+ fields,
3688
+ type,
3689
+ importCompat,
3690
+ context,
3691
+ groupby
3692
+ }) {
3693
+ const env2 = getEnv();
3694
+ const jsonData = {
3760
3695
  model,
3761
3696
  domain,
3762
3697
  ids,
3698
+ import_compat: importCompat,
3763
3699
  fields,
3764
- type,
3765
- importCompat,
3766
- context,
3767
- groupby
3768
- }) {
3769
- const env2 = getEnv();
3770
- const jsonData = {
3771
- model,
3772
- domain,
3773
- ids,
3774
- import_compat: importCompat,
3775
- fields,
3776
- with_context: context,
3777
- groupby: groupby != null ? groupby : []
3778
- };
3779
- return env2.requests.post_excel(`/export/${type}`, jsonData);
3780
- });
3700
+ with_context: context,
3701
+ groupby: groupby ?? []
3702
+ };
3703
+ return env2.requests.post_excel(`/export/${type}`, jsonData);
3781
3704
  }
3782
3705
  };
3783
3706
  var excel_service_default = ExcelService;
3784
3707
 
3785
3708
  // src/services/form-service/index.ts
3786
3709
  var FormService = {
3787
- getComment(_0) {
3788
- return __async(this, arguments, function* ({ data }) {
3789
- try {
3790
- const env2 = getEnv();
3791
- const jsonData = {
3792
- thread_id: data.thread_id,
3793
- thread_model: data.thread_model,
3794
- limit: 100,
3795
- with_context: {
3796
- lang: data.lang
3797
- }
3798
- };
3799
- return env2.requests.post("/chatter/thread/messages" /* GET_MESSAGE */, jsonData, {
3800
- headers: {
3801
- "Content-Type": "application/json"
3802
- }
3803
- });
3804
- } catch (error) {
3805
- console.error("Error when sending message:", error);
3806
- throw error;
3807
- }
3808
- });
3809
- },
3810
- sentComment(_0) {
3811
- return __async(this, arguments, function* ({ data }) {
3812
- try {
3813
- const env2 = getEnv();
3814
- const jsonData = {
3815
- context: {
3816
- tz: "Asia/Saigon",
3817
- uid: 2,
3818
- allowed_company_ids: [1],
3819
- mail_post_autofollow: false,
3820
- temporary_id: 142183.01
3821
- },
3822
- post_data: {
3823
- body: data.message,
3824
- message_type: "comment",
3825
- attachment_ids: data.attachment_ids,
3826
- attachment_tokens: [],
3827
- subtype_xmlid: data.subtype
3828
- },
3829
- thread_id: Number(data.thread_id),
3830
- thread_model: data.thread_model
3831
- };
3832
- return env2.requests.post("/chatter/message/post" /* SENT_MESSAGE */, jsonData, {
3833
- headers: {
3834
- "Content-Type": "application/json"
3835
- }
3836
- });
3837
- } catch (error) {
3838
- console.error("Error when sent message:", error);
3839
- throw error;
3840
- }
3841
- });
3710
+ async getComment({ data }) {
3711
+ try {
3712
+ const env2 = getEnv();
3713
+ const jsonData = {
3714
+ thread_id: data.thread_id,
3715
+ thread_model: data.thread_model,
3716
+ limit: 100,
3717
+ with_context: {
3718
+ lang: data.lang
3719
+ }
3720
+ };
3721
+ return env2.requests.post("/chatter/thread/messages" /* GET_MESSAGE */, jsonData, {
3722
+ headers: {
3723
+ "Content-Type": "application/json"
3724
+ }
3725
+ });
3726
+ } catch (error) {
3727
+ console.error("Error when sending message:", error);
3728
+ throw error;
3729
+ }
3842
3730
  },
3843
- deleteComment(_0) {
3844
- return __async(this, arguments, function* ({ data }) {
3845
- try {
3846
- const env2 = getEnv();
3847
- const jsonData = {
3848
- attachment_ids: [],
3731
+ async sentComment({ data }) {
3732
+ try {
3733
+ const env2 = getEnv();
3734
+ const jsonData = {
3735
+ context: {
3736
+ tz: "Asia/Saigon",
3737
+ uid: 2,
3738
+ allowed_company_ids: [1],
3739
+ mail_post_autofollow: false,
3740
+ temporary_id: 142183.01
3741
+ },
3742
+ post_data: {
3743
+ body: data.message,
3744
+ message_type: "comment",
3745
+ attachment_ids: data.attachment_ids,
3849
3746
  attachment_tokens: [],
3850
- body: "",
3851
- message_id: data.message_id
3852
- };
3853
- return env2.requests.post("/chatter/message/update_content" /* DELETE_MESSAGE */, jsonData, {
3854
- headers: {
3855
- "Content-Type": "application/json"
3856
- }
3857
- });
3858
- } catch (error) {
3859
- console.error("Error when sent message:", error);
3860
- throw error;
3861
- }
3862
- });
3863
- },
3864
- getImage(_0) {
3865
- return __async(this, arguments, function* ({ data }) {
3866
- try {
3867
- const env2 = getEnv();
3868
- return env2.requests.get(
3869
- `${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
3870
- {
3871
- headers: {
3872
- "Content-Type": "application/json"
3873
- }
3874
- }
3875
- );
3876
- } catch (error) {
3877
- console.error("Error when sent message:", error);
3878
- throw error;
3879
- }
3880
- });
3747
+ subtype_xmlid: data.subtype
3748
+ },
3749
+ thread_id: Number(data.thread_id),
3750
+ thread_model: data.thread_model
3751
+ };
3752
+ return env2.requests.post("/chatter/message/post" /* SENT_MESSAGE */, jsonData, {
3753
+ headers: {
3754
+ "Content-Type": "application/json"
3755
+ }
3756
+ });
3757
+ } catch (error) {
3758
+ console.error("Error when sent message:", error);
3759
+ throw error;
3760
+ }
3881
3761
  },
3882
- uploadImage(_0) {
3883
- return __async(this, arguments, function* ({ data }) {
3884
- try {
3885
- const env2 = getEnv();
3886
- return env2.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, data, {
3887
- headers: {
3888
- "Content-Type": "multipart/form-data"
3889
- }
3890
- });
3891
- } catch (error) {
3892
- console.error("Error when sent message:", error);
3893
- throw error;
3894
- }
3895
- });
3762
+ async deleteComment({ data }) {
3763
+ try {
3764
+ const env2 = getEnv();
3765
+ const jsonData = {
3766
+ attachment_ids: [],
3767
+ attachment_tokens: [],
3768
+ body: "",
3769
+ message_id: data.message_id
3770
+ };
3771
+ return env2.requests.post("/chatter/message/update_content" /* DELETE_MESSAGE */, jsonData, {
3772
+ headers: {
3773
+ "Content-Type": "application/json"
3774
+ }
3775
+ });
3776
+ } catch (error) {
3777
+ console.error("Error when sent message:", error);
3778
+ throw error;
3779
+ }
3896
3780
  },
3897
- getFormView(_0) {
3898
- return __async(this, arguments, function* ({ data }) {
3899
- try {
3900
- const env2 = getEnv();
3901
- const jsonData = {
3902
- model: data.model,
3903
- method: "get_formview_action",
3904
- ids: data.id ? [data.id] : [],
3905
- with_context: data.context
3906
- };
3907
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3781
+ async getImage({ data }) {
3782
+ try {
3783
+ const env2 = getEnv();
3784
+ return env2.requests.get(
3785
+ `${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
3786
+ {
3908
3787
  headers: {
3909
3788
  "Content-Type": "application/json"
3910
3789
  }
3911
- });
3912
- } catch (error) {
3913
- console.error("Error when fetching form view:", error);
3914
- throw error;
3915
- }
3916
- });
3790
+ }
3791
+ );
3792
+ } catch (error) {
3793
+ console.error("Error when sent message:", error);
3794
+ throw error;
3795
+ }
3917
3796
  },
3918
- changeStatus(_0) {
3919
- return __async(this, arguments, function* ({ data }) {
3797
+ async uploadImage({ data }) {
3798
+ try {
3799
+ const env2 = getEnv();
3800
+ return env2.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, data, {
3801
+ headers: {
3802
+ "Content-Type": "multipart/form-data"
3803
+ }
3804
+ });
3805
+ } catch (error) {
3806
+ console.error("Error when sent message:", error);
3807
+ throw error;
3808
+ }
3809
+ },
3810
+ async getFormView({ data }) {
3811
+ try {
3920
3812
  const env2 = getEnv();
3921
- const vals = {
3922
- [data.name]: data.stage_id
3923
- };
3924
3813
  const jsonData = {
3925
3814
  model: data.model,
3926
- method: "web_save",
3927
- with_context: {
3928
- lang: data.lang,
3929
- allowed_company_ids: [1],
3930
- uid: 2,
3931
- search_default_my_ticket: true,
3932
- search_default_is_open: true
3933
- },
3934
- ids: [data.id],
3935
- kwargs: {
3936
- vals,
3937
- specification: {}
3938
- }
3815
+ method: "get_formview_action",
3816
+ ids: data.id ? [data.id] : [],
3817
+ with_context: data.context
3939
3818
  };
3940
3819
  return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3941
3820
  headers: {
3942
3821
  "Content-Type": "application/json"
3943
3822
  }
3944
3823
  });
3824
+ } catch (error) {
3825
+ console.error("Error when fetching form view:", error);
3826
+ throw error;
3827
+ }
3828
+ },
3829
+ async changeStatus({ data }) {
3830
+ const env2 = getEnv();
3831
+ const vals = {
3832
+ [data.name]: data.stage_id
3833
+ };
3834
+ const jsonData = {
3835
+ model: data.model,
3836
+ method: "web_save",
3837
+ with_context: {
3838
+ lang: data.lang,
3839
+ allowed_company_ids: [1],
3840
+ uid: 2,
3841
+ search_default_my_ticket: true,
3842
+ search_default_is_open: true
3843
+ },
3844
+ ids: [data.id],
3845
+ kwargs: {
3846
+ vals,
3847
+ specification: {}
3848
+ }
3849
+ };
3850
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3851
+ headers: {
3852
+ "Content-Type": "application/json"
3853
+ }
3945
3854
  });
3946
3855
  }
3947
3856
  };
@@ -3949,55 +3858,51 @@ var form_service_default = FormService;
3949
3858
 
3950
3859
  // src/services/kanban-service/index.ts
3951
3860
  var KanbanServices = {
3952
- getGroups(_0) {
3953
- return __async(this, arguments, function* ({
3861
+ async getGroups({
3862
+ model,
3863
+ width_context
3864
+ }) {
3865
+ const env2 = getEnv();
3866
+ const jsonDataView = {
3954
3867
  model,
3868
+ method: "web_read_group",
3869
+ kwargs: {
3870
+ domain: [["stage_id.fold", "=", false]],
3871
+ fields: ["color:sum"],
3872
+ groupby: ["stage_id"]
3873
+ },
3955
3874
  width_context
3956
- }) {
3957
- const env2 = getEnv();
3958
- const jsonDataView = {
3959
- model,
3960
- method: "web_read_group",
3961
- kwargs: {
3962
- domain: [["stage_id.fold", "=", false]],
3963
- fields: ["color:sum"],
3964
- groupby: ["stage_id"]
3965
- },
3966
- width_context
3967
- };
3968
- return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
3969
- headers: {
3970
- "Content-Type": "application/json"
3971
- }
3972
- });
3875
+ };
3876
+ return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
3877
+ headers: {
3878
+ "Content-Type": "application/json"
3879
+ }
3973
3880
  });
3974
3881
  },
3975
- getProgressBar(_0) {
3976
- return __async(this, arguments, function* ({
3977
- field,
3978
- color,
3882
+ async getProgressBar({
3883
+ field,
3884
+ color,
3885
+ model,
3886
+ width_context
3887
+ }) {
3888
+ const env2 = getEnv();
3889
+ const jsonDataView = {
3979
3890
  model,
3980
- width_context
3981
- }) {
3982
- const env2 = getEnv();
3983
- const jsonDataView = {
3984
- model,
3985
- method: "read_progress_bar",
3986
- kwargs: {
3987
- domain: [],
3988
- group_by: "stage_id",
3989
- progress_bar: {
3990
- colors: color,
3991
- field
3992
- }
3993
- },
3994
- width_context
3995
- };
3996
- return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
3997
- headers: {
3998
- "Content-Type": "application/json"
3891
+ method: "read_progress_bar",
3892
+ kwargs: {
3893
+ domain: [],
3894
+ group_by: "stage_id",
3895
+ progress_bar: {
3896
+ colors: color,
3897
+ field
3999
3898
  }
4000
- });
3899
+ },
3900
+ width_context
3901
+ };
3902
+ return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
3903
+ headers: {
3904
+ "Content-Type": "application/json"
3905
+ }
4001
3906
  });
4002
3907
  }
4003
3908
  };
@@ -4006,285 +3911,259 @@ var kanban_service_default = KanbanServices;
4006
3911
  // src/services/model-service/index.ts
4007
3912
  var OBJECT_POSITION = 2;
4008
3913
  var ModelService = {
4009
- getListMyBankAccount(_0) {
4010
- return __async(this, arguments, function* ({
4011
- domain,
4012
- spectification,
4013
- model
4014
- }) {
4015
- const env2 = getEnv();
4016
- const jsonData = {
4017
- model,
4018
- method: "web_search_read",
4019
- kwargs: {
4020
- specification: spectification,
4021
- domain,
4022
- limit: 100,
4023
- offset: 0
4024
- }
4025
- };
4026
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4027
- headers: {
4028
- "Content-Type": "application/json"
4029
- }
4030
- });
3914
+ async getListMyBankAccount({
3915
+ domain,
3916
+ spectification,
3917
+ model
3918
+ }) {
3919
+ const env2 = getEnv();
3920
+ const jsonData = {
3921
+ model,
3922
+ method: "web_search_read",
3923
+ kwargs: {
3924
+ specification: spectification,
3925
+ domain,
3926
+ limit: 100,
3927
+ offset: 0
3928
+ }
3929
+ };
3930
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3931
+ headers: {
3932
+ "Content-Type": "application/json"
3933
+ }
4031
3934
  });
4032
3935
  },
4033
- getCurrency() {
4034
- return __async(this, null, function* () {
4035
- const env2 = getEnv();
4036
- const jsonData = {
4037
- model: "res.currency",
4038
- method: "web_search_read",
4039
- kwargs: {
4040
- specification: {
4041
- icon_url: {},
4042
- name: {}
4043
- },
4044
- domain: [["active", "=", true]],
4045
- limit: 100,
4046
- offset: 0
4047
- }
4048
- };
4049
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4050
- headers: {
4051
- "Content-Type": "application/json"
4052
- }
4053
- });
3936
+ async getCurrency() {
3937
+ const env2 = getEnv();
3938
+ const jsonData = {
3939
+ model: "res.currency",
3940
+ method: "web_search_read",
3941
+ kwargs: {
3942
+ specification: {
3943
+ icon_url: {},
3944
+ name: {}
3945
+ },
3946
+ domain: [["active", "=", true]],
3947
+ limit: 100,
3948
+ offset: 0
3949
+ }
3950
+ };
3951
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3952
+ headers: {
3953
+ "Content-Type": "application/json"
3954
+ }
4054
3955
  });
4055
3956
  },
4056
- getConversionRate() {
4057
- return __async(this, null, function* () {
4058
- const env2 = getEnv();
4059
- const jsonData = {
4060
- model: "res.currency",
4061
- method: "web_search_read",
4062
- kwargs: {
4063
- specification: {
4064
- name: {},
4065
- icon_url: {},
4066
- rate_ids: {
4067
- fields: {
4068
- company_rate: {},
4069
- sell: {}
4070
- }
3957
+ async getConversionRate() {
3958
+ const env2 = getEnv();
3959
+ const jsonData = {
3960
+ model: "res.currency",
3961
+ method: "web_search_read",
3962
+ kwargs: {
3963
+ specification: {
3964
+ name: {},
3965
+ icon_url: {},
3966
+ rate_ids: {
3967
+ fields: {
3968
+ company_rate: {},
3969
+ sell: {}
4071
3970
  }
4072
- },
4073
- domain: [["active", "=", true]],
4074
- limit: 100,
4075
- offset: 0
4076
- }
4077
- };
4078
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4079
- headers: {
4080
- "Content-Type": "application/json"
4081
- }
4082
- });
4083
- });
4084
- },
4085
- getAll(_0) {
4086
- return __async(this, arguments, function* ({ data }) {
4087
- const env2 = getEnv();
4088
- 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] ? {
4089
- fields: data.fields,
4090
- groupby: data.groupby
4091
- } : {
4092
- count_limit: 10001,
4093
- order: data.sort,
4094
- specification: data.specification
4095
- };
4096
- const jsonData = {
4097
- model: String(data.model),
4098
- method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
4099
- ids: data.ids,
4100
- with_context: data.context,
4101
- kwargs: __spreadValues({
4102
- domain: data.domain,
4103
- limit: data.limit,
4104
- offset: data.offset
4105
- }, jsonReadGroup)
4106
- };
4107
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4108
- headers: {
4109
- "Content-Type": "application/json"
4110
- }
4111
- });
3971
+ }
3972
+ },
3973
+ domain: [["active", "=", true]],
3974
+ limit: 100,
3975
+ offset: 0
3976
+ }
3977
+ };
3978
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3979
+ headers: {
3980
+ "Content-Type": "application/json"
3981
+ }
4112
3982
  });
4113
3983
  },
4114
- getListCalendar(_0) {
4115
- return __async(this, arguments, function* ({ data }) {
4116
- const env2 = getEnv();
4117
- 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] ? {
3984
+ async getAll({ data }) {
3985
+ const env2 = getEnv();
3986
+ const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
3987
+ fields: data.fields,
3988
+ groupby: data.groupby
3989
+ } : {
3990
+ count_limit: 10001,
3991
+ order: data.sort,
3992
+ specification: data.specification
3993
+ };
3994
+ const jsonData = {
3995
+ model: String(data.model),
3996
+ method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
3997
+ ids: data.ids,
3998
+ with_context: data.context,
3999
+ kwargs: {
4000
+ domain: data.domain,
4001
+ limit: data.limit,
4002
+ offset: data.offset,
4003
+ ...jsonReadGroup
4004
+ }
4005
+ };
4006
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4007
+ headers: {
4008
+ "Content-Type": "application/json"
4009
+ }
4010
+ });
4011
+ },
4012
+ async getListCalendar({ data }) {
4013
+ const env2 = getEnv();
4014
+ const jsonReadGroup = data.type == "calendar" ? data?.fields : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
4015
+ fields: data.fields,
4016
+ groupby: data.groupby
4017
+ } : {
4018
+ count_limit: 10001,
4019
+ order: data.sort,
4020
+ specification: data.specification
4021
+ };
4022
+ const jsonData = {
4023
+ model: String(data.model),
4024
+ method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
4025
+ ids: data.ids,
4026
+ with_context: data.context,
4027
+ kwargs: {
4028
+ domain: data.domain,
4029
+ limit: data.limit,
4030
+ offset: data.offset,
4118
4031
  fields: data.fields,
4119
- groupby: data.groupby
4120
- } : {
4121
- count_limit: 10001,
4122
- order: data.sort,
4123
- specification: data.specification
4124
- };
4125
- const jsonData = {
4126
- model: String(data.model),
4127
- method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
4128
- ids: data.ids,
4129
- with_context: data.context,
4130
- kwargs: __spreadValues({
4131
- domain: data.domain,
4132
- limit: data.limit,
4133
- offset: data.offset,
4134
- fields: data.fields
4135
- }, jsonReadGroup)
4136
- };
4137
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4138
- headers: {
4139
- "Content-Type": "application/json"
4140
- }
4141
- });
4032
+ ...jsonReadGroup
4033
+ }
4034
+ };
4035
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4036
+ headers: {
4037
+ "Content-Type": "application/json"
4038
+ }
4142
4039
  });
4143
4040
  },
4144
- getList(_0) {
4145
- return __async(this, arguments, function* ({
4041
+ async getList({
4042
+ model,
4043
+ ids = [],
4044
+ specification = {},
4045
+ domain = [],
4046
+ offset,
4047
+ order,
4048
+ context = {},
4049
+ limit = 10
4050
+ }) {
4051
+ const env2 = getEnv();
4052
+ const jsonData = {
4146
4053
  model,
4147
- ids = [],
4148
- specification = {},
4149
- domain = [],
4150
- offset,
4151
- order,
4152
- context = {},
4153
- limit = 10
4154
- }) {
4155
- var _a;
4156
- const env2 = getEnv();
4157
- const jsonData = {
4158
- model,
4159
- method: "web_search_read" /* WEB_SEARCH_READ */,
4160
- ids,
4161
- with_context: context,
4162
- kwargs: {
4163
- specification,
4164
- domain,
4165
- limit,
4166
- offset,
4167
- order
4168
- }
4169
- };
4170
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4171
- headers: {
4172
- "Content-Type": "application/json"
4173
- }
4174
- });
4054
+ method: "web_search_read" /* WEB_SEARCH_READ */,
4055
+ ids,
4056
+ with_context: context,
4057
+ kwargs: {
4058
+ specification,
4059
+ domain,
4060
+ limit,
4061
+ offset,
4062
+ order
4063
+ }
4064
+ };
4065
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4066
+ headers: {
4067
+ "Content-Type": "application/json"
4068
+ }
4175
4069
  });
4176
4070
  },
4177
- getDetail(_0) {
4178
- return __async(this, arguments, function* ({
4179
- ids = [],
4071
+ async getDetail({
4072
+ ids = [],
4073
+ model,
4074
+ specification,
4075
+ context
4076
+ }) {
4077
+ const env2 = getEnv();
4078
+ const jsonData = {
4180
4079
  model,
4181
- specification,
4182
- context
4183
- }) {
4184
- var _a;
4185
- const env2 = getEnv();
4186
- const jsonData = {
4187
- model,
4188
- method: "web_read" /* WEB_READ */,
4189
- ids,
4190
- with_context: context,
4191
- kwargs: {
4192
- specification
4193
- }
4194
- };
4195
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4196
- headers: {
4197
- "Content-Type": "application/json"
4198
- }
4199
- });
4080
+ method: "web_read" /* WEB_READ */,
4081
+ ids,
4082
+ with_context: context,
4083
+ kwargs: {
4084
+ specification
4085
+ }
4086
+ };
4087
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4088
+ headers: {
4089
+ "Content-Type": "application/json"
4090
+ }
4200
4091
  });
4201
4092
  },
4202
- save(_0) {
4203
- return __async(this, arguments, function* ({
4093
+ async save({
4094
+ model,
4095
+ ids = [],
4096
+ data = {},
4097
+ specification = {},
4098
+ context = {},
4099
+ path
4100
+ }) {
4101
+ const env2 = getEnv();
4102
+ const jsonData = {
4204
4103
  model,
4205
- ids = [],
4206
- data = {},
4207
- specification = {},
4208
- context = {},
4209
- path
4210
- }) {
4211
- var _a;
4212
- const env2 = getEnv();
4213
- const jsonData = {
4214
- model,
4215
- method: "web_save" /* WEB_SAVE */,
4216
- with_context: context,
4217
- ids,
4218
- kwargs: {
4219
- vals: data,
4220
- specification
4221
- }
4222
- };
4223
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post(path != null ? path : "/call" /* CALL_PATH */, jsonData, {
4224
- headers: {
4225
- "Content-Type": "application/json"
4226
- }
4227
- });
4104
+ method: "web_save" /* WEB_SAVE */,
4105
+ with_context: context,
4106
+ ids,
4107
+ kwargs: {
4108
+ vals: data,
4109
+ specification
4110
+ }
4111
+ };
4112
+ return env2?.requests?.post(path ?? "/call" /* CALL_PATH */, jsonData, {
4113
+ headers: {
4114
+ "Content-Type": "application/json"
4115
+ }
4228
4116
  });
4229
4117
  },
4230
- delete(_0) {
4231
- return __async(this, arguments, function* ({ ids = [], model }) {
4232
- var _a;
4233
- const env2 = getEnv();
4234
- const jsonData = {
4235
- model,
4236
- method: "unlink" /* UNLINK */,
4237
- ids
4238
- };
4239
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4240
- headers: {
4241
- "Content-Type": "application/json"
4242
- }
4243
- });
4118
+ async delete({ ids = [], model }) {
4119
+ const env2 = getEnv();
4120
+ const jsonData = {
4121
+ model,
4122
+ method: "unlink" /* UNLINK */,
4123
+ ids
4124
+ };
4125
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4126
+ headers: {
4127
+ "Content-Type": "application/json"
4128
+ }
4244
4129
  });
4245
4130
  },
4246
- onChange(_0) {
4247
- return __async(this, arguments, function* ({
4248
- ids = [],
4131
+ async onChange({
4132
+ ids = [],
4133
+ model,
4134
+ object,
4135
+ specification,
4136
+ context,
4137
+ fieldChange
4138
+ }) {
4139
+ const env2 = getEnv();
4140
+ const jsonData = {
4249
4141
  model,
4250
- object,
4251
- specification,
4252
- context,
4253
- fieldChange
4254
- }) {
4255
- var _a;
4256
- const env2 = getEnv();
4257
- const jsonData = {
4258
- model,
4259
- method: "onchange" /* ONCHANGE */,
4260
- ids,
4261
- with_context: context,
4262
- args: [
4263
- object ? object : {},
4264
- fieldChange ? fieldChange : [],
4265
- specification
4266
- ]
4267
- };
4268
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4269
- headers: {
4270
- "Content-Type": "application/json"
4271
- }
4272
- });
4142
+ method: "onchange" /* ONCHANGE */,
4143
+ ids,
4144
+ with_context: context,
4145
+ args: [
4146
+ object ? object : {},
4147
+ fieldChange ? fieldChange : [],
4148
+ specification
4149
+ ]
4150
+ };
4151
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4152
+ headers: {
4153
+ "Content-Type": "application/json"
4154
+ }
4273
4155
  });
4274
4156
  },
4275
- getListFieldsOnchange(_0) {
4276
- return __async(this, arguments, function* ({ model }) {
4277
- var _a;
4278
- const env2 = getEnv();
4279
- const jsonData = {
4280
- model,
4281
- method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
4282
- };
4283
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4284
- headers: {
4285
- "Content-Type": "application/json"
4286
- }
4287
- });
4157
+ async getListFieldsOnchange({ model }) {
4158
+ const env2 = getEnv();
4159
+ const jsonData = {
4160
+ model,
4161
+ method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
4162
+ };
4163
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4164
+ headers: {
4165
+ "Content-Type": "application/json"
4166
+ }
4288
4167
  });
4289
4168
  },
4290
4169
  parseORMOdoo(data) {
@@ -4298,14 +4177,13 @@ var ModelService = {
4298
4177
  data[key] = "/";
4299
4178
  }
4300
4179
  }
4301
- return __spreadValues({}, data);
4180
+ return { ...data };
4302
4181
  },
4303
4182
  toDataJS(data, viewData, model) {
4304
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
4305
4183
  for (const key in data) {
4306
4184
  if (data[key] === false) {
4307
4185
  if (viewData && model) {
4308
- 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 */) {
4186
+ if (viewData?.models?.[model]?.[key]?.type !== "boolean" /* BOOLEAN */) {
4309
4187
  data[key] = null;
4310
4188
  }
4311
4189
  } else {
@@ -4315,13 +4193,12 @@ var ModelService = {
4315
4193
  data[key] = "Draft";
4316
4194
  } else if (data[key] !== false) {
4317
4195
  if (model !== void 0) {
4318
- 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 */) {
4319
- data[key] = (_k = (_j = data[key]) != null ? _j : data[key] = []) == null ? void 0 : _k.map((item) => {
4320
- var _a2, _b2, _c2, _d2;
4321
- 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;
4196
+ if (viewData?.models?.[model]?.[key]?.type === "one2many" /* ONE2MANY */ || viewData?.models?.[model]?.[key]?.type === "many2many" /* MANY2MANY */) {
4197
+ data[key] = (data[key] ??= [])?.map((item) => {
4198
+ const relation = viewData?.models?.[model]?.[key]?.relation;
4322
4199
  if (relation !== void 0) {
4323
- if ((_d2 = viewData == null ? void 0 : viewData.models) == null ? void 0 : _d2[relation]) {
4324
- if ((item == null ? void 0 : item.length) >= 3) {
4200
+ if (viewData?.models?.[relation]) {
4201
+ if (item?.length >= 3) {
4325
4202
  return ModelService.toDataJS(
4326
4203
  item[OBJECT_POSITION],
4327
4204
  viewData,
@@ -4331,7 +4208,7 @@ var ModelService = {
4331
4208
  return ModelService.toDataJS(item, viewData, relation);
4332
4209
  }
4333
4210
  } else {
4334
- if ((item == null ? void 0 : item.length) >= 3) {
4211
+ if (item?.length >= 3) {
4335
4212
  return item[OBJECT_POSITION];
4336
4213
  } else {
4337
4214
  return item;
@@ -4343,556 +4220,514 @@ var ModelService = {
4343
4220
  }
4344
4221
  }
4345
4222
  }
4346
- return __spreadValues({}, data);
4223
+ return { ...data };
4347
4224
  }
4348
4225
  };
4349
4226
  var model_service_default = ModelService;
4350
4227
 
4351
4228
  // src/services/user-service/index.ts
4352
4229
  var UserService = {
4353
- getProfile(path) {
4354
- return __async(this, null, function* () {
4355
- const env2 = getEnv();
4356
- return env2.requests.get(path != null ? path : "/userinfo" /* PROFILE_PATH */, {
4357
- headers: {
4358
- "Content-Type": "application/x-www-form-urlencoded"
4359
- }
4360
- });
4230
+ async getProfile(path) {
4231
+ const env2 = getEnv();
4232
+ return env2?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
4233
+ headers: {
4234
+ "Content-Type": "application/x-www-form-urlencoded"
4235
+ }
4361
4236
  });
4362
4237
  },
4363
- getUser(_0) {
4364
- return __async(this, arguments, function* ({ context, id }) {
4365
- const env2 = getEnv();
4366
- const jsonData = {
4367
- model: "res.users",
4368
- method: "web_read",
4369
- ids: [id],
4370
- with_context: context,
4371
- kwargs: {
4372
- specification: {
4373
- display_name: {},
4374
- image_1920: {},
4375
- name: {},
4376
- login: {},
4377
- email: {},
4378
- password: {},
4379
- visible_group_id: {
4380
- fields: {
4381
- id: {},
4382
- display_name: {}
4383
- }
4384
- },
4385
- company_id: {
4386
- fields: {
4387
- id: {},
4388
- display_name: {}
4389
- }
4238
+ async getUser({ context, id }) {
4239
+ const env2 = getEnv();
4240
+ const jsonData = {
4241
+ model: "res.users",
4242
+ method: "web_read",
4243
+ ids: [id],
4244
+ with_context: context,
4245
+ kwargs: {
4246
+ specification: {
4247
+ display_name: {},
4248
+ image_1920: {},
4249
+ name: {},
4250
+ login: {},
4251
+ email: {},
4252
+ password: {},
4253
+ visible_group_id: {
4254
+ fields: {
4255
+ id: {},
4256
+ display_name: {}
4257
+ }
4258
+ },
4259
+ company_id: {
4260
+ fields: {
4261
+ id: {},
4262
+ display_name: {}
4390
4263
  }
4391
4264
  }
4392
4265
  }
4393
- };
4394
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4395
- headers: {
4396
- "Content-Type": "application/json"
4397
- }
4398
- });
4266
+ }
4267
+ };
4268
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4269
+ headers: {
4270
+ "Content-Type": "application/json"
4271
+ }
4399
4272
  });
4400
4273
  },
4401
- switchUserLocale: (_0) => __async(null, [_0], function* ({ id, values }) {
4402
- var _a;
4274
+ switchUserLocale: async ({ id, values }) => {
4403
4275
  const env2 = getEnv();
4404
4276
  const jsonData = {
4405
4277
  model: "res.users",
4406
4278
  domain: [["id", "=", id]],
4407
4279
  values
4408
4280
  };
4409
- return env2 == null ? void 0 : env2.requests.post((_a = UriConstants) == null ? void 0 : _a.CREATE_UPDATE_PATH, jsonData, {
4281
+ return env2?.requests.post(UriConstants?.CREATE_UPDATE_PATH, jsonData, {
4410
4282
  headers: {
4411
4283
  "Content-Type": "application/json"
4412
4284
  }
4413
4285
  });
4414
- })
4286
+ }
4415
4287
  };
4416
4288
  var user_service_default = UserService;
4417
4289
 
4418
4290
  // src/services/view-service/index.ts
4419
4291
  var ViewService = {
4420
- getView(_0) {
4421
- return __async(this, arguments, function* ({
4292
+ async getView({
4293
+ model,
4294
+ views,
4295
+ context = {},
4296
+ options = {},
4297
+ aid
4298
+ }) {
4299
+ const env2 = getEnv();
4300
+ const defaultOptions = {
4301
+ load_filters: true,
4302
+ toolbar: true,
4303
+ action_id: aid
4304
+ };
4305
+ const jsonDataView = {
4422
4306
  model,
4423
- views,
4424
- context = {},
4425
- options = {},
4426
- aid
4427
- }) {
4428
- var _a;
4429
- const env2 = getEnv();
4430
- const defaultOptions = {
4431
- load_filters: true,
4432
- toolbar: true,
4433
- action_id: aid
4434
- };
4435
- const jsonDataView = {
4436
- model,
4437
- method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
4438
- kwargs: {
4439
- views,
4440
- options: __spreadValues(__spreadValues({}, options), defaultOptions)
4441
- },
4442
- with_context: context
4443
- };
4444
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonDataView, {
4445
- headers: {
4446
- "Content-Type": "application/json"
4447
- }
4448
- });
4307
+ method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
4308
+ kwargs: {
4309
+ views,
4310
+ options: { ...options, ...defaultOptions }
4311
+ },
4312
+ with_context: context
4313
+ };
4314
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
4315
+ headers: {
4316
+ "Content-Type": "application/json"
4317
+ }
4449
4318
  });
4450
4319
  },
4451
- getMenu(context) {
4452
- return __async(this, null, function* () {
4453
- var _a;
4454
- const env2 = getEnv();
4455
- const jsonData = {
4456
- model: "ir.ui.menu" /* MENU */,
4457
- method: "web_search_read" /* WEB_SEARCH_READ */,
4458
- ids: [],
4459
- with_context: context,
4460
- kwargs: {
4461
- specification: {
4462
- active: {},
4463
- name: {},
4464
- is_display: {},
4465
- sequence: {},
4466
- complete_name: {},
4467
- action: {
4468
- fields: {
4469
- display_name: {},
4470
- type: {},
4471
- binding_view_types: {}
4472
- // res_model: {},
4473
- }
4320
+ async getMenu(context) {
4321
+ const env2 = getEnv();
4322
+ const jsonData = {
4323
+ model: "ir.ui.menu" /* MENU */,
4324
+ method: "web_search_read" /* WEB_SEARCH_READ */,
4325
+ ids: [],
4326
+ with_context: context,
4327
+ kwargs: {
4328
+ specification: {
4329
+ active: {},
4330
+ name: {},
4331
+ is_display: {},
4332
+ sequence: {},
4333
+ complete_name: {},
4334
+ action: {
4335
+ fields: {
4336
+ display_name: {},
4337
+ type: {},
4338
+ binding_view_types: {}
4339
+ // res_model: {},
4340
+ }
4341
+ },
4342
+ url_icon: {},
4343
+ web_icon: {},
4344
+ web_icon_data: {},
4345
+ groups_id: {
4346
+ fields: {
4347
+ full_name: {}
4474
4348
  },
4475
- url_icon: {},
4476
- web_icon: {},
4477
- web_icon_data: {},
4478
- groups_id: {
4479
- fields: {
4480
- full_name: {}
4349
+ limit: 40,
4350
+ order: ""
4351
+ },
4352
+ display_name: {},
4353
+ child_id: {
4354
+ fields: {
4355
+ active: {},
4356
+ name: {},
4357
+ is_display: {},
4358
+ sequence: {},
4359
+ complete_name: {},
4360
+ action: {
4361
+ fields: {
4362
+ display_name: {},
4363
+ type: {},
4364
+ binding_view_types: {}
4365
+ // res_model: {},
4366
+ }
4481
4367
  },
4482
- limit: 40,
4483
- order: ""
4484
- },
4485
- display_name: {},
4486
- child_id: {
4487
- fields: {
4488
- active: {},
4489
- name: {},
4490
- is_display: {},
4491
- sequence: {},
4492
- complete_name: {},
4493
- action: {
4494
- fields: {
4495
- display_name: {},
4496
- type: {},
4497
- binding_view_types: {}
4498
- // res_model: {},
4499
- }
4368
+ url_icon: {},
4369
+ web_icon: {},
4370
+ web_icon_data: {},
4371
+ groups_id: {
4372
+ fields: {
4373
+ full_name: {}
4500
4374
  },
4501
- url_icon: {},
4502
- web_icon: {},
4503
- web_icon_data: {},
4504
- groups_id: {
4505
- fields: {
4506
- full_name: {}
4375
+ limit: 40,
4376
+ order: ""
4377
+ },
4378
+ display_name: {},
4379
+ child_id: {
4380
+ fields: {
4381
+ active: {},
4382
+ name: {},
4383
+ is_display: {},
4384
+ sequence: {},
4385
+ complete_name: {},
4386
+ action: {
4387
+ fields: {
4388
+ display_name: {},
4389
+ type: {},
4390
+ binding_view_types: {}
4391
+ // res_model: {},
4392
+ }
4507
4393
  },
4508
- limit: 40,
4509
- order: ""
4510
- },
4511
- display_name: {},
4512
- child_id: {
4513
- fields: {
4514
- active: {},
4515
- name: {},
4516
- is_display: {},
4517
- sequence: {},
4518
- complete_name: {},
4519
- action: {
4520
- fields: {
4521
- display_name: {},
4522
- type: {},
4523
- binding_view_types: {}
4524
- // res_model: {},
4525
- }
4394
+ url_icon: {},
4395
+ web_icon: {},
4396
+ web_icon_data: {},
4397
+ groups_id: {
4398
+ fields: {
4399
+ full_name: {}
4526
4400
  },
4527
- url_icon: {},
4528
- web_icon: {},
4529
- web_icon_data: {},
4530
- groups_id: {
4531
- fields: {
4532
- full_name: {}
4401
+ limit: 40,
4402
+ order: ""
4403
+ },
4404
+ display_name: {},
4405
+ child_id: {
4406
+ fields: {
4407
+ active: {},
4408
+ name: {},
4409
+ is_display: {},
4410
+ sequence: {},
4411
+ complete_name: {},
4412
+ action: {
4413
+ fields: {
4414
+ display_name: {},
4415
+ type: {},
4416
+ binding_view_types: {}
4417
+ // res_model: {},
4418
+ }
4533
4419
  },
4534
- limit: 40,
4535
- order: ""
4536
- },
4537
- display_name: {},
4538
- child_id: {
4539
- fields: {
4540
- active: {},
4541
- name: {},
4542
- is_display: {},
4543
- sequence: {},
4544
- complete_name: {},
4545
- action: {
4546
- fields: {
4547
- display_name: {},
4548
- type: {},
4549
- binding_view_types: {}
4550
- // res_model: {},
4551
- }
4420
+ url_icon: {},
4421
+ web_icon: {},
4422
+ web_icon_data: {},
4423
+ groups_id: {
4424
+ fields: {
4425
+ full_name: {}
4552
4426
  },
4553
- url_icon: {},
4554
- web_icon: {},
4555
- web_icon_data: {},
4556
- groups_id: {
4557
- fields: {
4558
- full_name: {}
4559
- },
4560
- limit: 40,
4561
- order: ""
4562
- },
4563
- display_name: {},
4564
- child_id: {
4565
- fields: {},
4566
- limit: 40,
4567
- order: ""
4568
- }
4427
+ limit: 40,
4428
+ order: ""
4569
4429
  },
4570
- limit: 40,
4571
- order: ""
4572
- }
4573
- },
4574
- limit: 40,
4575
- order: ""
4576
- }
4577
- },
4578
- limit: 40,
4579
- order: ""
4580
- }
4581
- },
4582
- domain: [
4583
- "&",
4584
- ["is_display", "=", true],
4585
- "&",
4586
- ["active", "=", true],
4587
- ["parent_id", "=", false]
4588
- ]
4589
- }
4590
- };
4591
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4592
- headers: {
4593
- "Content-Type": "application/json"
4594
- }
4595
- });
4596
- });
4597
- },
4598
- getActionDetail(aid, context) {
4599
- return __async(this, null, function* () {
4600
- var _a;
4601
- const env2 = getEnv();
4602
- const jsonData = {
4603
- model: "ir.actions.act_window" /* WINDOW_ACTION */,
4604
- method: "web_read" /* WEB_READ */,
4605
- ids: [aid],
4606
- with_context: context,
4607
- kwargs: {
4608
- specification: {
4609
- id: {},
4610
- name: {},
4611
- res_model: {},
4612
- views: {},
4613
- view_mode: {},
4614
- mobile_view_mode: {},
4615
- domain: {},
4616
- context: {},
4617
- groups_id: {},
4618
- search_view_id: {}
4430
+ display_name: {},
4431
+ child_id: {
4432
+ fields: {},
4433
+ limit: 40,
4434
+ order: ""
4435
+ }
4436
+ },
4437
+ limit: 40,
4438
+ order: ""
4439
+ }
4440
+ },
4441
+ limit: 40,
4442
+ order: ""
4443
+ }
4444
+ },
4445
+ limit: 40,
4446
+ order: ""
4619
4447
  }
4620
- }
4621
- };
4622
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4623
- headers: {
4624
- "Content-Type": "application/json"
4625
- }
4626
- });
4448
+ },
4449
+ domain: [
4450
+ "&",
4451
+ ["is_display", "=", true],
4452
+ "&",
4453
+ ["active", "=", true],
4454
+ ["parent_id", "=", false]
4455
+ ]
4456
+ }
4457
+ };
4458
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4459
+ headers: {
4460
+ "Content-Type": "application/json"
4461
+ }
4627
4462
  });
4628
4463
  },
4629
- getResequence(_0) {
4630
- return __async(this, arguments, function* ({
4631
- model,
4632
- ids,
4633
- context,
4634
- offset
4635
- }) {
4636
- const env2 = getEnv();
4637
- const jsonData = __spreadValues({
4638
- model,
4639
- with_context: context,
4640
- ids,
4641
- field: "sequence"
4642
- }, offset > 0 ? { offset } : {});
4643
- return env2 == null ? void 0 : env2.requests.post("/web/dataset/resequence", jsonData, {
4644
- headers: {
4645
- "Content-Type": "application/json"
4464
+ async getActionDetail(aid, context) {
4465
+ const env2 = getEnv();
4466
+ const jsonData = {
4467
+ model: "ir.actions.act_window" /* WINDOW_ACTION */,
4468
+ method: "web_read" /* WEB_READ */,
4469
+ ids: [aid],
4470
+ with_context: context,
4471
+ kwargs: {
4472
+ specification: {
4473
+ id: {},
4474
+ name: {},
4475
+ res_model: {},
4476
+ views: {},
4477
+ view_mode: {},
4478
+ mobile_view_mode: {},
4479
+ domain: {},
4480
+ context: {},
4481
+ groups_id: {},
4482
+ search_view_id: {}
4646
4483
  }
4647
- });
4484
+ }
4485
+ };
4486
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4487
+ headers: {
4488
+ "Content-Type": "application/json"
4489
+ }
4648
4490
  });
4649
4491
  },
4650
- getSelectionItem(_0) {
4651
- return __async(this, arguments, function* ({ data }) {
4652
- var _a;
4653
- const env2 = getEnv();
4654
- const jsonData = {
4655
- model: data.model,
4656
- ids: [],
4657
- method: "get_data_select",
4658
- with_context: data.context,
4659
- kwargs: {
4660
- count_limit: 10001,
4661
- domain: data.domain ? data.domain : [],
4662
- offset: 0,
4663
- order: "",
4664
- specification: (_a = data == null ? void 0 : data.specification) != null ? _a : {
4665
- id: {},
4666
- name: {},
4667
- display_name: {}
4668
- }
4669
- }
4670
- };
4671
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4672
- headers: {
4673
- "Content-Type": "application/json"
4674
- }
4675
- });
4492
+ async getResequence({
4493
+ model,
4494
+ ids,
4495
+ context,
4496
+ offset
4497
+ }) {
4498
+ const env2 = getEnv();
4499
+ const jsonData = {
4500
+ model,
4501
+ with_context: context,
4502
+ ids,
4503
+ field: "sequence",
4504
+ ...offset > 0 ? { offset } : {}
4505
+ };
4506
+ return env2?.requests.post("/web/dataset/resequence", jsonData, {
4507
+ headers: {
4508
+ "Content-Type": "application/json"
4509
+ }
4676
4510
  });
4677
4511
  },
4678
- loadMessages() {
4679
- return __async(this, null, function* () {
4680
- const env2 = getEnv();
4681
- return env2.requests.post(
4682
- "/load_message_failures" /* LOAD_MESSAGE */,
4683
- {},
4684
- {
4685
- headers: {
4686
- "Content-Type": "application/json"
4687
- }
4512
+ async getSelectionItem({ data }) {
4513
+ const env2 = getEnv();
4514
+ const jsonData = {
4515
+ model: data.model,
4516
+ ids: [],
4517
+ method: "get_data_select",
4518
+ with_context: data.context,
4519
+ kwargs: {
4520
+ count_limit: 10001,
4521
+ domain: data.domain ? data.domain : [],
4522
+ offset: 0,
4523
+ order: "",
4524
+ specification: data?.specification ?? {
4525
+ id: {},
4526
+ name: {},
4527
+ display_name: {}
4688
4528
  }
4689
- );
4529
+ }
4530
+ };
4531
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4532
+ headers: {
4533
+ "Content-Type": "application/json"
4534
+ }
4690
4535
  });
4691
4536
  },
4692
- getVersion() {
4693
- return __async(this, null, function* () {
4694
- var _a;
4695
- const env2 = getEnv();
4696
- console.log("env?.requests", env2, env2 == null ? void 0 : env2.requests);
4697
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.get("", {
4537
+ async loadMessages() {
4538
+ const env2 = getEnv();
4539
+ return env2.requests.post(
4540
+ "/load_message_failures" /* LOAD_MESSAGE */,
4541
+ {},
4542
+ {
4698
4543
  headers: {
4699
4544
  "Content-Type": "application/json"
4700
4545
  }
4701
- });
4546
+ }
4547
+ );
4548
+ },
4549
+ async getVersion() {
4550
+ const env2 = getEnv();
4551
+ return env2?.requests.get("", {
4552
+ headers: {
4553
+ "Content-Type": "application/json"
4554
+ }
4702
4555
  });
4703
4556
  },
4704
- get2FAMethods(_0) {
4705
- return __async(this, arguments, function* ({
4557
+ async get2FAMethods({
4558
+ method,
4559
+ with_context
4560
+ }) {
4561
+ const env2 = getEnv();
4562
+ const jsonData = {
4706
4563
  method,
4707
4564
  with_context
4708
- }) {
4709
- const env2 = getEnv();
4710
- const jsonData = {
4711
- method,
4712
- with_context
4713
- };
4714
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4715
- headers: {
4716
- "Content-Type": "application/json"
4717
- }
4718
- });
4565
+ };
4566
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4567
+ headers: {
4568
+ "Content-Type": "application/json"
4569
+ }
4719
4570
  });
4720
4571
  },
4721
- verify2FA(_0) {
4722
- return __async(this, arguments, function* ({
4572
+ async verify2FA({
4573
+ method,
4574
+ with_context,
4575
+ code,
4576
+ device,
4577
+ location
4578
+ }) {
4579
+ const env2 = getEnv();
4580
+ const jsonData = {
4723
4581
  method,
4724
- with_context,
4725
- code,
4726
- device,
4727
- location
4728
- }) {
4729
- const env2 = getEnv();
4730
- const jsonData = {
4731
- method,
4732
- kwargs: {
4733
- vals: {
4734
- code,
4735
- device,
4736
- location
4737
- }
4738
- },
4739
- with_context
4740
- };
4741
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4742
- headers: {
4743
- "Content-Type": "application/json"
4744
- },
4745
- withCredentials: true
4746
- });
4582
+ kwargs: {
4583
+ vals: {
4584
+ code,
4585
+ device,
4586
+ location
4587
+ }
4588
+ },
4589
+ with_context
4590
+ };
4591
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4592
+ headers: {
4593
+ "Content-Type": "application/json"
4594
+ },
4595
+ withCredentials: true
4747
4596
  });
4748
4597
  },
4749
- signInSSO(_0) {
4750
- return __async(this, arguments, function* ({
4751
- redirect_uri,
4752
- state,
4753
- client_id,
4598
+ async signInSSO({
4599
+ redirect_uri,
4600
+ state,
4601
+ client_id,
4602
+ response_type,
4603
+ path
4604
+ }) {
4605
+ const env2 = getEnv();
4606
+ const params = new URLSearchParams({
4754
4607
  response_type,
4755
- path
4756
- }) {
4757
- const env2 = getEnv();
4758
- const params = new URLSearchParams({
4759
- response_type,
4760
- client_id,
4761
- redirect_uri,
4762
- state
4763
- });
4764
- const url = `${path}?${params.toString()}`;
4765
- return env2 == null ? void 0 : env2.requests.get(url, {
4766
- headers: {
4767
- "Content-Type": "application/json"
4768
- },
4769
- withCredentials: true
4770
- });
4608
+ client_id,
4609
+ redirect_uri,
4610
+ state
4611
+ });
4612
+ const url = `${path}?${params.toString()}`;
4613
+ return env2?.requests.get(url, {
4614
+ headers: {
4615
+ "Content-Type": "application/json"
4616
+ },
4617
+ withCredentials: true
4771
4618
  });
4772
4619
  },
4773
- grantAccess(_0) {
4774
- return __async(this, arguments, function* ({
4620
+ async grantAccess({
4621
+ redirect_uri,
4622
+ state,
4623
+ client_id,
4624
+ scopes
4625
+ }) {
4626
+ const env2 = getEnv();
4627
+ const jsonData = {
4775
4628
  redirect_uri,
4776
4629
  state,
4777
4630
  client_id,
4778
4631
  scopes
4779
- }) {
4780
- const env2 = getEnv();
4781
- const jsonData = {
4782
- redirect_uri,
4783
- state,
4784
- client_id,
4785
- scopes
4786
- };
4787
- return env2 == null ? void 0 : env2.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
4788
- headers: {
4789
- "Content-Type": "application/json"
4790
- },
4791
- withCredentials: true
4792
- });
4632
+ };
4633
+ return env2?.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
4634
+ headers: {
4635
+ "Content-Type": "application/json"
4636
+ },
4637
+ withCredentials: true
4793
4638
  });
4794
4639
  },
4795
- getFieldsViewSecurity(_0) {
4796
- return __async(this, arguments, function* ({
4640
+ async getFieldsViewSecurity({
4641
+ method,
4642
+ token,
4643
+ views
4644
+ }) {
4645
+ const env2 = getEnv();
4646
+ const jsonData = {
4797
4647
  method,
4798
- token,
4799
- views
4800
- }) {
4801
- const env2 = getEnv();
4802
- const jsonData = {
4803
- method,
4804
- kwargs: {
4805
- views
4806
- },
4807
- with_context: {
4808
- token
4809
- }
4810
- };
4811
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4812
- headers: {
4813
- "Content-Type": "application/json"
4814
- }
4815
- });
4648
+ kwargs: {
4649
+ views
4650
+ },
4651
+ with_context: {
4652
+ token
4653
+ }
4654
+ };
4655
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4656
+ headers: {
4657
+ "Content-Type": "application/json"
4658
+ }
4816
4659
  });
4817
4660
  },
4818
- settingsWebRead2fa(_0) {
4819
- return __async(this, arguments, function* ({
4661
+ async settingsWebRead2fa({
4662
+ method,
4663
+ model,
4664
+ kwargs,
4665
+ token
4666
+ }) {
4667
+ const env2 = getEnv();
4668
+ const jsonData = {
4820
4669
  method,
4821
4670
  model,
4822
4671
  kwargs,
4823
- token
4824
- }) {
4825
- const env2 = getEnv();
4826
- const jsonData = {
4827
- method,
4828
- model,
4829
- kwargs,
4830
- with_context: {
4831
- token
4832
- }
4833
- };
4834
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4835
- headers: {
4836
- "Content-Type": "application/json"
4837
- }
4838
- });
4672
+ with_context: {
4673
+ token
4674
+ }
4675
+ };
4676
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4677
+ headers: {
4678
+ "Content-Type": "application/json"
4679
+ }
4839
4680
  });
4840
4681
  },
4841
- requestSetupTotp(_0) {
4842
- return __async(this, arguments, function* ({ method, token }) {
4843
- const env2 = getEnv();
4844
- const jsonData = {
4845
- method,
4846
- with_context: {
4847
- token
4848
- }
4849
- };
4850
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4851
- headers: {
4852
- "Content-Type": "application/json"
4853
- }
4854
- });
4682
+ async requestSetupTotp({ method, token }) {
4683
+ const env2 = getEnv();
4684
+ const jsonData = {
4685
+ method,
4686
+ with_context: {
4687
+ token
4688
+ }
4689
+ };
4690
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4691
+ headers: {
4692
+ "Content-Type": "application/json"
4693
+ }
4855
4694
  });
4856
4695
  },
4857
- verifyTotp(_0) {
4858
- return __async(this, arguments, function* ({
4696
+ async verifyTotp({
4697
+ method,
4698
+ action_token,
4699
+ code
4700
+ }) {
4701
+ const env2 = getEnv();
4702
+ const jsonData = {
4859
4703
  method,
4860
- action_token,
4861
- code
4862
- }) {
4863
- const env2 = getEnv();
4864
- const jsonData = {
4865
- method,
4866
- kwargs: {
4867
- vals: {
4868
- code
4869
- }
4870
- },
4871
- with_context: {
4872
- action_token
4873
- }
4874
- };
4875
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4876
- headers: {
4877
- "Content-Type": "application/json"
4704
+ kwargs: {
4705
+ vals: {
4706
+ code
4878
4707
  }
4879
- });
4708
+ },
4709
+ with_context: {
4710
+ action_token
4711
+ }
4712
+ };
4713
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4714
+ headers: {
4715
+ "Content-Type": "application/json"
4716
+ }
4880
4717
  });
4881
4718
  },
4882
- removeTotpSetUp(_0) {
4883
- return __async(this, arguments, function* ({ method, token }) {
4884
- const env2 = getEnv();
4885
- const jsonData = {
4886
- method,
4887
- with_context: {
4888
- token
4889
- }
4890
- };
4891
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4892
- headers: {
4893
- "Content-Type": "application/json"
4894
- }
4895
- });
4719
+ async removeTotpSetUp({ method, token }) {
4720
+ const env2 = getEnv();
4721
+ const jsonData = {
4722
+ method,
4723
+ with_context: {
4724
+ token
4725
+ }
4726
+ };
4727
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4728
+ headers: {
4729
+ "Content-Type": "application/json"
4730
+ }
4896
4731
  });
4897
4732
  }
4898
4733
  };
@@ -4928,7 +4763,7 @@ var import_react_query3 = require("@tanstack/react-query");
4928
4763
  var useGetProvider = () => {
4929
4764
  return (0, import_react_query3.useMutation)({
4930
4765
  mutationFn: (data) => {
4931
- return auth_service_default.getProviders(data == null ? void 0 : data.db);
4766
+ return auth_service_default.getProviders(data?.db);
4932
4767
  }
4933
4768
  });
4934
4769
  };
@@ -5428,6 +5263,10 @@ var use_get_list_my_bank_account_default = useGetListMyBankAccount;
5428
5263
 
5429
5264
  // src/models/base-model/index.ts
5430
5265
  var BaseModel = class {
5266
+ name;
5267
+ view;
5268
+ actContext;
5269
+ fields;
5431
5270
  constructor(init) {
5432
5271
  this.name = init.name;
5433
5272
  this.view = init.view;
@@ -5442,22 +5281,21 @@ var BaseModel = class {
5442
5281
  modelRoot
5443
5282
  }) {
5444
5283
  if (Array.isArray(fields)) {
5445
- let spec = __spreadValues({}, specification);
5284
+ let spec = { ...specification };
5446
5285
  fields.forEach((field) => {
5447
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
5448
- if (!(field == null ? void 0 : field.type_co) || (field == null ? void 0 : field.name) && (field == null ? void 0 : field.type_co) === "field" /* FIELD */) {
5449
- if ((_a = modelsData == null ? void 0 : modelsData[model]) == null ? void 0 : _a[field == null ? void 0 : field.name]) {
5450
- if (((_c = (_b = modelsData == null ? void 0 : modelsData[model]) == null ? void 0 : _b[field == null ? void 0 : field.name]) == null ? void 0 : _c.type) === "one2many" /* ONE2MANY */ || ((_e = (_d = modelsData == null ? void 0 : modelsData[model]) == null ? void 0 : _d[field == null ? void 0 : field.name]) == null ? void 0 : _e.type) === "many2many" /* MANY2MANY */) {
5451
- const relation = (_g = (_f = modelsData == null ? void 0 : modelsData[model]) == null ? void 0 : _f[field == null ? void 0 : field.name]) == null ? void 0 : _g.relation;
5452
- const modelRelation = modelsData == null ? void 0 : modelsData[relation];
5286
+ if (!field?.type_co || field?.name && field?.type_co === "field" /* FIELD */) {
5287
+ if (modelsData?.[model]?.[field?.name]) {
5288
+ if (modelsData?.[model]?.[field?.name]?.type === "one2many" /* ONE2MANY */ || modelsData?.[model]?.[field?.name]?.type === "many2many" /* MANY2MANY */) {
5289
+ const relation = modelsData?.[model]?.[field?.name]?.relation;
5290
+ const modelRelation = modelsData?.[relation];
5453
5291
  if (modelRelation) {
5454
- spec[field == null ? void 0 : field.name] = {
5292
+ spec[field?.name] = {
5455
5293
  fields: {}
5456
5294
  };
5457
5295
  if (modelRoot && modelRoot === relation) {
5458
- spec[field == null ? void 0 : field.name].fields = { id: {} };
5296
+ spec[field?.name].fields = { id: {} };
5459
5297
  } else {
5460
- spec[field == null ? void 0 : field.name].fields = this.getSpecificationByFields({
5298
+ spec[field?.name].fields = this.getSpecificationByFields({
5461
5299
  fields: Object.values(modelRelation),
5462
5300
  specification: {},
5463
5301
  modelsData,
@@ -5466,42 +5304,45 @@ var BaseModel = class {
5466
5304
  });
5467
5305
  }
5468
5306
  } else {
5469
- spec[field == null ? void 0 : field.name] = {
5307
+ spec[field?.name] = {
5470
5308
  fields: {
5471
5309
  id: {},
5472
5310
  display_name: {}
5473
5311
  }
5474
5312
  };
5475
5313
  }
5476
- } else if (((_i = (_h = modelsData == null ? void 0 : modelsData[model]) == null ? void 0 : _h[field == null ? void 0 : field.name]) == null ? void 0 : _i.type) === "many2one" /* MANY2ONE */) {
5477
- spec[field == null ? void 0 : field.name] = {
5478
- fields: __spreadValues(__spreadValues(__spreadValues({
5314
+ } else if (modelsData?.[model]?.[field?.name]?.type === "many2one" /* MANY2ONE */) {
5315
+ spec[field?.name] = {
5316
+ fields: {
5479
5317
  id: {},
5480
- display_name: {}
5481
- }, WIDGETAVATAR[field == null ? void 0 : field.widget] ? { image_256: {} } : {}), (field == null ? void 0 : field.name) === "currency_id" && (fields == null ? void 0 : fields.find((item) => (item == null ? void 0 : item.widget) === "monetary")) ? { symbol: {} } : {}), (field == null ? void 0 : field.widget) === "many2many_binary" ? { mimetype: {} } : {})
5318
+ display_name: {},
5319
+ ...WIDGETAVATAR[field?.widget] ? { image_256: {} } : {},
5320
+ ...field?.name === "currency_id" && fields?.find((item) => item?.widget === "monetary") ? { symbol: {} } : {},
5321
+ ...field?.widget === "many2many_binary" ? { mimetype: {} } : {}
5322
+ }
5482
5323
  };
5483
5324
  } else {
5484
- spec[field == null ? void 0 : field.name] = {};
5325
+ spec[field?.name] = {};
5485
5326
  }
5486
5327
  }
5487
- } else if ((field == null ? void 0 : field.type_co) === "group" /* GROUP */ || (field == null ? void 0 : field.type_co) === "div" /* DIV */ || (field == null ? void 0 : field.type_co) === "span" /* SPAN */) {
5328
+ } else if (field?.type_co === "group" /* GROUP */ || field?.type_co === "div" /* DIV */ || field?.type_co === "span" /* SPAN */) {
5488
5329
  const specGroup = this.getSpecificationByFields({
5489
- fields: field == null ? void 0 : field.fields,
5330
+ fields: field?.fields,
5490
5331
  specification: spec,
5491
5332
  modelsData,
5492
5333
  model
5493
5334
  });
5494
- spec = __spreadValues(__spreadValues({}, spec), specGroup);
5495
- } else if ((field == null ? void 0 : field.type_co) === "tree" /* TREE */ || (field == null ? void 0 : field.type_co) === "list" /* LIST */) {
5496
- const relation = (_k = (_j = modelsData == null ? void 0 : modelsData[model]) == null ? void 0 : _j[field == null ? void 0 : field.name]) == null ? void 0 : _k.relation;
5335
+ spec = { ...spec, ...specGroup };
5336
+ } else if (field?.type_co === "tree" /* TREE */ || field?.type_co === "list" /* LIST */) {
5337
+ const relation = modelsData?.[model]?.[field?.name]?.relation;
5497
5338
  const specTreee = this.getSpecificationByFields({
5498
- fields: field == null ? void 0 : field.fields,
5339
+ fields: field?.fields,
5499
5340
  specification: {},
5500
5341
  modelsData,
5501
5342
  model: relation,
5502
5343
  modelRoot: model
5503
5344
  });
5504
- spec = __spreadProps(__spreadValues({}, spec), { [field == null ? void 0 : field.name]: { fields: specTreee } });
5345
+ spec = { ...spec, [field?.name]: { fields: specTreee } };
5505
5346
  }
5506
5347
  });
5507
5348
  return spec;
@@ -5510,19 +5351,16 @@ var BaseModel = class {
5510
5351
  }
5511
5352
  }
5512
5353
  getTreeProps() {
5513
- var _a, _b;
5514
- const props = ((_b = (_a = this.view) == null ? void 0 : _a.views) == null ? void 0 : _b.list) || {};
5354
+ const props = this.view?.views?.list || {};
5515
5355
  return props;
5516
5356
  }
5517
5357
  getTreeFields() {
5518
- var _a, _b, _c;
5519
- const fields = ((_c = (_b = (_a = this.view) == null ? void 0 : _a.views) == null ? void 0 : _b.list) == null ? void 0 : _c.fields) || [];
5358
+ const fields = this.view?.views?.list?.fields || [];
5520
5359
  return fields;
5521
5360
  }
5522
5361
  getSpecification() {
5523
- var _a;
5524
5362
  const specInit = {};
5525
- const modelData = ((_a = this.view) == null ? void 0 : _a.models) || {};
5363
+ const modelData = this.view?.models || {};
5526
5364
  const specification = this.getSpecificationByFields({
5527
5365
  fields: this.fields,
5528
5366
  specification: specInit,
@@ -5538,7 +5376,7 @@ var base_model_default = BaseModel;
5538
5376
  // src/hooks/model/use-model.ts
5539
5377
  var useModel = () => {
5540
5378
  const initModel = (modelData) => {
5541
- switch (modelData == null ? void 0 : modelData.name) {
5379
+ switch (modelData?.name) {
5542
5380
  default:
5543
5381
  return new base_model_default(modelData);
5544
5382
  }
@@ -5683,22 +5521,22 @@ var useGetActionDetail = ({
5683
5521
  }) => {
5684
5522
  const data = {
5685
5523
  id,
5686
- model: model != null ? model : "",
5524
+ model: model ?? "",
5687
5525
  context
5688
5526
  };
5689
5527
  return (0, import_react_query43.useQuery)({
5690
5528
  queryKey,
5691
- queryFn: () => __async(null, null, function* () {
5529
+ queryFn: async () => {
5692
5530
  if (aid) {
5693
- const res = yield view_service_default.getActionDetail(aid, context);
5531
+ const res = await view_service_default.getActionDetail(aid, context);
5694
5532
  if (res && res.length > 0) {
5695
5533
  return res[0];
5696
5534
  }
5697
5535
  } else {
5698
- const res = yield form_service_default.getFormView({ data });
5536
+ const res = await form_service_default.getFormView({ data });
5699
5537
  return res;
5700
5538
  }
5701
- }),
5539
+ },
5702
5540
  enabled,
5703
5541
  refetchOnWindowFocus: false,
5704
5542
  staleTime: Infinity
@@ -5770,9 +5608,8 @@ var useGetMenu = (context, enabled) => {
5770
5608
  return (0, import_react_query47.useQuery)({
5771
5609
  queryKey: ["menus" /* MENU */, context],
5772
5610
  queryFn: () => view_service_default.getMenu(context).then((res) => {
5773
- var _a;
5774
- if (res && (res == null ? void 0 : res.records) && ((_a = res == null ? void 0 : res.records) == null ? void 0 : _a.length) > 0) {
5775
- return res == null ? void 0 : res.records;
5611
+ if (res && res?.records && res?.records?.length > 0) {
5612
+ return res?.records;
5776
5613
  }
5777
5614
  return [];
5778
5615
  }),