@fctc/interface-logic 1.5.8 → 1.5.9

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