@fctc/interface-logic 1.5.8 → 1.6.0

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