@fctc/edu-logic-lib 1.0.2 → 1.0.4

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.
Files changed (69) hide show
  1. package/dist/{store.d.ts → index.d.mts} +574 -3
  2. package/dist/{store.d.mts → index.d.ts} +574 -3
  3. package/dist/index.js +4709 -0
  4. package/dist/index.mjs +4596 -0
  5. package/package.json +1 -1
  6. package/dist/base-model-type-DvO53Lwi.d.mts +0 -7
  7. package/dist/base-model-type-DvO53Lwi.d.ts +0 -7
  8. package/dist/chunk-6BLY7NZ6.mjs +0 -124
  9. package/dist/chunk-6QXB3XX7.mjs +0 -258
  10. package/dist/chunk-ELARQVCE.mjs +0 -2364
  11. package/dist/chunk-FVGPSTJ7.js +0 -124
  12. package/dist/chunk-GGOFXFSX.js +0 -2364
  13. package/dist/chunk-IXDDYGKE.js +0 -61
  14. package/dist/chunk-MJLXGYQ4.mjs +0 -102
  15. package/dist/chunk-MLJQPO4Q.mjs +0 -61
  16. package/dist/chunk-QLUONJPQ.mjs +0 -604
  17. package/dist/chunk-RZBHZYXG.js +0 -604
  18. package/dist/chunk-S7B3VKMJ.mjs +0 -95
  19. package/dist/chunk-S7YF2I23.js +0 -95
  20. package/dist/chunk-U4CC2BBB.js +0 -1074
  21. package/dist/chunk-UY6GNZNB.js +0 -258
  22. package/dist/chunk-W4W2L2NA.js +0 -102
  23. package/dist/chunk-WYXAE5LI.mjs +0 -1074
  24. package/dist/config.d.mts +0 -15
  25. package/dist/config.d.ts +0 -15
  26. package/dist/config.js +0 -7
  27. package/dist/config.mjs +0 -7
  28. package/dist/constants.d.mts +0 -120
  29. package/dist/constants.d.ts +0 -120
  30. package/dist/constants.js +0 -30
  31. package/dist/constants.mjs +0 -30
  32. package/dist/context-type-D5XefoL-.d.mts +0 -8
  33. package/dist/context-type-D5XefoL-.d.ts +0 -8
  34. package/dist/environment.d.mts +0 -37
  35. package/dist/environment.d.ts +0 -37
  36. package/dist/environment.js +0 -15
  37. package/dist/environment.mjs +0 -15
  38. package/dist/hooks.d.mts +0 -216
  39. package/dist/hooks.d.ts +0 -216
  40. package/dist/hooks.js +0 -776
  41. package/dist/hooks.mjs +0 -776
  42. package/dist/index-C_nK1Mii.d.mts +0 -19
  43. package/dist/index-C_nK1Mii.d.ts +0 -19
  44. package/dist/models.d.mts +0 -35
  45. package/dist/models.d.ts +0 -35
  46. package/dist/models.js +0 -43
  47. package/dist/models.mjs +0 -43
  48. package/dist/provider.d.mts +0 -16
  49. package/dist/provider.d.ts +0 -16
  50. package/dist/provider.js +0 -86
  51. package/dist/provider.mjs +0 -86
  52. package/dist/services.d.mts +0 -160
  53. package/dist/services.d.ts +0 -160
  54. package/dist/services.js +0 -26
  55. package/dist/services.mjs +0 -26
  56. package/dist/store.js +0 -128
  57. package/dist/store.mjs +0 -128
  58. package/dist/types.d.mts +0 -12
  59. package/dist/types.d.ts +0 -12
  60. package/dist/types.js +0 -1
  61. package/dist/types.mjs +0 -0
  62. package/dist/use-get-selection-DFh6sc49.d.mts +0 -26
  63. package/dist/use-get-selection-DFh6sc49.d.ts +0 -26
  64. package/dist/utils.d.mts +0 -52
  65. package/dist/utils.d.ts +0 -52
  66. package/dist/utils.js +0 -34
  67. package/dist/utils.mjs +0 -34
  68. package/dist/view-type-BTzRpkT7.d.mts +0 -106
  69. package/dist/view-type-BTzRpkT7.d.ts +0 -106
@@ -1,1074 +0,0 @@
1
- import {
2
- toQueryString
3
- } from "./chunk-ELARQVCE.mjs";
4
- import {
5
- getEnv
6
- } from "./chunk-MJLXGYQ4.mjs";
7
- import {
8
- UriConstants
9
- } from "./chunk-MLJQPO4Q.mjs";
10
-
11
- // src/services/action-service/index.ts
12
- var ActionService = {
13
- async loadAction({
14
- idAction,
15
- context
16
- }) {
17
- const env = getEnv();
18
- const jsonData = {
19
- action_id: idAction,
20
- with_context: {
21
- ...context
22
- }
23
- };
24
- return env.requests.post(`${"/load_action" /* LOAD_ACTION */}`, jsonData, {
25
- headers: {
26
- "Content-Type": "application/json"
27
- }
28
- });
29
- },
30
- async callButton({
31
- model,
32
- ids = [],
33
- context,
34
- method
35
- }) {
36
- try {
37
- const env = getEnv();
38
- const jsonData = {
39
- model,
40
- method,
41
- ids,
42
- with_context: context
43
- };
44
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
45
- headers: {
46
- "Content-Type": "application/json"
47
- }
48
- });
49
- } catch (error) {
50
- console.error("Error when calling button action:", error);
51
- throw error;
52
- }
53
- },
54
- async removeRows({
55
- model,
56
- ids,
57
- context
58
- }) {
59
- const env = getEnv();
60
- const jsonData = {
61
- model,
62
- method: "unlink",
63
- ids,
64
- with_context: context
65
- };
66
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
67
- headers: {
68
- "Content-Type": "application/json"
69
- }
70
- });
71
- },
72
- async duplicateRecord({
73
- model,
74
- id,
75
- context
76
- }) {
77
- const env = getEnv();
78
- const jsonData = {
79
- model,
80
- method: "copy",
81
- ids: id,
82
- with_context: context
83
- };
84
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
85
- headers: {
86
- "Content-Type": "application/json"
87
- }
88
- });
89
- },
90
- async print({ id, report, db }) {
91
- const env = getEnv();
92
- const jsonData = {
93
- report,
94
- id,
95
- type: "pdf",
96
- file_response: true,
97
- db
98
- };
99
- const queryString = toQueryString(jsonData);
100
- const urlWithParams = `${"/report" /* REPORT_PATH */}?${queryString}`;
101
- return env.requests.get(urlWithParams, {
102
- headers: {
103
- "Content-Type": "application/json"
104
- },
105
- responseType: "arraybuffer"
106
- });
107
- },
108
- async runAction({
109
- idAction,
110
- context
111
- }) {
112
- const env = getEnv();
113
- const jsonData = {
114
- action_id: idAction,
115
- with_context: {
116
- ...context
117
- }
118
- };
119
- return env.requests.post(`${"/run_action" /* RUN_ACTION_PATH */}`, jsonData, {
120
- headers: {
121
- "Content-Type": "application/json"
122
- }
123
- });
124
- }
125
- };
126
- var action_service_default = ActionService;
127
-
128
- // src/services/auth-service/index.ts
129
- var AuthService = {
130
- async login(body) {
131
- const env = getEnv();
132
- const payload = Object.fromEntries(
133
- Object.entries({
134
- username: body.email,
135
- password: body.password,
136
- grant_type: env?.config?.grantType || "",
137
- client_id: env?.config?.clientId || "",
138
- client_secret: env?.config?.clientSecret || ""
139
- }).filter(([_, value]) => !!value)
140
- );
141
- const encodedData = new URLSearchParams(payload).toString();
142
- return env?.requests?.post(body.path, encodedData, {
143
- headers: {
144
- "Content-Type": "application/x-www-form-urlencoded"
145
- }
146
- });
147
- },
148
- async forgotPassword(email) {
149
- const env = getEnv();
150
- const bodyData = {
151
- login: email,
152
- url: `${window.location.origin}/reset-password`
153
- };
154
- return env?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
155
- headers: {
156
- "Content-Type": "application/json"
157
- }
158
- });
159
- },
160
- async resetPassword(data, token) {
161
- const env = getEnv();
162
- const bodyData = {
163
- token,
164
- password: data.password,
165
- new_password: data.confirmPassword
166
- };
167
- return env?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
168
- headers: {
169
- "Content-Type": "application/json"
170
- }
171
- });
172
- },
173
- async updatePassword(data, token) {
174
- const env = getEnv();
175
- const bodyData = {
176
- token,
177
- old_password: data.oldPassword,
178
- new_password: data.newPassword
179
- };
180
- return env?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
181
- headers: {
182
- "Content-Type": "application/json"
183
- }
184
- });
185
- },
186
- async isValidToken(token) {
187
- const env = getEnv();
188
- const bodyData = {
189
- token
190
- };
191
- return env?.requests?.post("/check_token" /* TOKEN */, bodyData, {
192
- headers: {
193
- "Content-Type": "application/json"
194
- }
195
- });
196
- },
197
- async loginSocial({
198
- state,
199
- access_token
200
- }) {
201
- const env = getEnv();
202
- return env?.requests?.post(
203
- "/token/generate" /* GENTOKEN_SOCIAL */,
204
- { state, access_token },
205
- {
206
- headers: {
207
- "Content-Type": "application/json"
208
- }
209
- }
210
- );
211
- },
212
- async getProviders(db) {
213
- const env = getEnv();
214
- return env?.requests?.get("/oauth/providers", { params: { db } });
215
- }
216
- };
217
- var auth_service_default = AuthService;
218
-
219
- // src/services/company-service/index.ts
220
- var CompanyService = {
221
- async getCurrentCompany() {
222
- const env = getEnv();
223
- return await env.requests.get("/company" /* COMPANY_PATH */, {
224
- headers: {
225
- "Content-Type": "application/json"
226
- }
227
- });
228
- },
229
- async getInfoCompany(id) {
230
- const env = getEnv();
231
- const jsonData = {
232
- ids: [id],
233
- model: "res.company" /* COMPANY */,
234
- method: "web_read" /* WEB_READ */,
235
- kwargs: {
236
- specification: {
237
- primary_color: {},
238
- secondary_color: {},
239
- logo: {},
240
- display_name: {},
241
- secondary_logo: {}
242
- }
243
- }
244
- };
245
- return await env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
246
- headers: {
247
- "Content-Type": "application/json"
248
- }
249
- });
250
- }
251
- };
252
- var company_service_default = CompanyService;
253
-
254
- // src/services/excel-service/index.ts
255
- var ExcelService = {
256
- async uploadFile({ formData }) {
257
- const env = getEnv();
258
- return env.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
259
- headers: {
260
- "Content-Type": "multipart/form-data"
261
- }
262
- });
263
- },
264
- async uploadIdFile({ formData }) {
265
- const env = getEnv();
266
- return env.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
267
- headers: {
268
- "Content-Type": "multipart/form-data"
269
- }
270
- });
271
- },
272
- async parsePreview({
273
- id,
274
- selectedSheet,
275
- isHeader,
276
- context
277
- }) {
278
- const env = getEnv();
279
- const jsonData = {
280
- model: "base_import.import" /* BASE_IMPORT */,
281
- method: "parse_preview",
282
- ids: [id],
283
- kwargs: {
284
- options: {
285
- import_skip_records: [],
286
- import_set_empty_fields: [],
287
- fallback_values: {},
288
- name_create_enabled_fields: {},
289
- encoding: "",
290
- separator: "",
291
- quoting: '"',
292
- date_format: "",
293
- datetime_format: "",
294
- float_thousand_separator: ",",
295
- float_decimal_separator: ".",
296
- advanced: true,
297
- has_headers: isHeader,
298
- keep_matches: false,
299
- limit: 2e3,
300
- sheets: [],
301
- sheet: selectedSheet,
302
- skip: 0,
303
- tracking_disable: true
304
- }
305
- },
306
- with_context: context
307
- };
308
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
309
- headers: {
310
- "Content-Type": "multipart/form-data"
311
- }
312
- });
313
- },
314
- async executeImport({
315
- columns,
316
- fields,
317
- idFile,
318
- options,
319
- dryrun,
320
- context
321
- }) {
322
- const env = getEnv();
323
- const jsonData = {
324
- model: "base_import.import" /* BASE_IMPORT */,
325
- method: "execute_import",
326
- ids: [idFile],
327
- kwargs: {
328
- fields,
329
- columns,
330
- options,
331
- dryrun
332
- },
333
- with_context: context
334
- };
335
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
336
- headers: {
337
- "Content-Type": "multipart/form-data"
338
- }
339
- });
340
- },
341
- async getFileExcel({ model, context }) {
342
- const env = getEnv();
343
- const jsonData = {
344
- model,
345
- method: "get_import_templates" /* GET_IMPORT */,
346
- args: [],
347
- with_context: context
348
- };
349
- return env.requests.post("/call" /* CALL_PATH */, jsonData);
350
- },
351
- async getFieldExport({
352
- ids,
353
- model,
354
- isShow,
355
- parentField,
356
- fieldType,
357
- parentName,
358
- prefix,
359
- name,
360
- context,
361
- importCompat
362
- }) {
363
- const env = getEnv();
364
- const jsonData = {
365
- model,
366
- import_compat: importCompat,
367
- domain: [["id", "in", ids]],
368
- with_context: context
369
- };
370
- if (isShow) {
371
- jsonData.parent_field = parentField;
372
- jsonData.parent_field_type = fieldType;
373
- jsonData.parent_name = parentName;
374
- jsonData.name = name;
375
- jsonData.prefix = prefix;
376
- jsonData.exclude = [null];
377
- }
378
- return env.requests.post("/export/get_fields", jsonData);
379
- },
380
- async exportExcel({
381
- model,
382
- domain,
383
- ids,
384
- fields,
385
- type,
386
- importCompat,
387
- context,
388
- groupby
389
- }) {
390
- const env = getEnv();
391
- const jsonData = {
392
- model,
393
- domain,
394
- ids,
395
- import_compat: importCompat,
396
- fields,
397
- with_context: context,
398
- groupby: groupby ?? []
399
- };
400
- return env.requests.post_excel(`/export/${type}`, jsonData);
401
- }
402
- };
403
- var excel_service_default = ExcelService;
404
-
405
- // src/services/form-service/index.ts
406
- var FormService = {
407
- async getComment({ data }) {
408
- try {
409
- const env = getEnv();
410
- const jsonData = {
411
- thread_id: data.thread_id,
412
- thread_model: data.thread_model,
413
- limit: 100,
414
- with_context: {
415
- lang: data.lang
416
- }
417
- };
418
- return env.requests.post("/chatter/thread/messages" /* GET_MESSAGE */, jsonData, {
419
- headers: {
420
- "Content-Type": "application/json"
421
- }
422
- });
423
- } catch (error) {
424
- console.error("Error when sending message:", error);
425
- throw error;
426
- }
427
- },
428
- async sentComment({ data }) {
429
- try {
430
- const env = getEnv();
431
- const jsonData = {
432
- context: {
433
- tz: "Asia/Saigon",
434
- uid: 2,
435
- allowed_company_ids: [1],
436
- mail_post_autofollow: false,
437
- temporary_id: 142183.01
438
- },
439
- post_data: {
440
- body: data.message,
441
- message_type: "comment",
442
- attachment_ids: data.attachment_ids,
443
- attachment_tokens: [],
444
- subtype_xmlid: data.subtype
445
- },
446
- thread_id: Number(data.thread_id),
447
- thread_model: data.thread_model
448
- };
449
- return env.requests.post("/chatter/message/post" /* SENT_MESSAGE */, jsonData, {
450
- headers: {
451
- "Content-Type": "application/json"
452
- }
453
- });
454
- } catch (error) {
455
- console.error("Error when sent message:", error);
456
- throw error;
457
- }
458
- },
459
- async deleteComment({ data }) {
460
- try {
461
- const env = getEnv();
462
- const jsonData = {
463
- attachment_ids: [],
464
- attachment_tokens: [],
465
- body: "",
466
- message_id: data.message_id
467
- };
468
- return env.requests.post("/chatter/message/update_content" /* DELETE_MESSAGE */, jsonData, {
469
- headers: {
470
- "Content-Type": "application/json"
471
- }
472
- });
473
- } catch (error) {
474
- console.error("Error when sent message:", error);
475
- throw error;
476
- }
477
- },
478
- async getImage({ data }) {
479
- try {
480
- const env = getEnv();
481
- return env.requests.get(
482
- `${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
483
- {
484
- headers: {
485
- "Content-Type": "application/json"
486
- }
487
- }
488
- );
489
- } catch (error) {
490
- console.error("Error when sent message:", error);
491
- throw error;
492
- }
493
- },
494
- async uploadImage({ data }) {
495
- try {
496
- const env = getEnv();
497
- return env.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, data, {
498
- headers: {
499
- "Content-Type": "multipart/form-data"
500
- }
501
- });
502
- } catch (error) {
503
- console.error("Error when sent message:", error);
504
- throw error;
505
- }
506
- },
507
- async getFormView({ data }) {
508
- try {
509
- const env = getEnv();
510
- const jsonData = {
511
- model: data.model,
512
- method: "get_formview_action",
513
- ids: data.id ? [data.id] : [],
514
- with_context: data.context
515
- };
516
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
517
- headers: {
518
- "Content-Type": "application/json"
519
- }
520
- });
521
- } catch (error) {
522
- console.error("Error when fetching form view:", error);
523
- throw error;
524
- }
525
- },
526
- async changeStatus({ data }) {
527
- const env = getEnv();
528
- const vals = {
529
- [data.name]: data.stage_id
530
- };
531
- const jsonData = {
532
- model: data.model,
533
- method: "web_save",
534
- with_context: {
535
- lang: data.lang,
536
- allowed_company_ids: [1],
537
- uid: 2,
538
- search_default_my_ticket: true,
539
- search_default_is_open: true
540
- },
541
- ids: [data.id],
542
- kwargs: {
543
- vals,
544
- specification: {}
545
- }
546
- };
547
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
548
- headers: {
549
- "Content-Type": "application/json"
550
- }
551
- });
552
- }
553
- };
554
- var form_service_default = FormService;
555
-
556
- // src/services/model-service/index.ts
557
- var OBJECT_POSITION = 2;
558
- var ModelService = {
559
- async getAll({ data }) {
560
- const env = getEnv();
561
- const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
562
- fields: data.fields,
563
- groupby: data.groupby
564
- } : {
565
- count_limit: 10001,
566
- order: data.sort,
567
- specification: data.specification
568
- };
569
- const jsonData = {
570
- model: String(data.model),
571
- method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
572
- ids: data.ids,
573
- with_context: data.context,
574
- kwargs: {
575
- domain: data.domain,
576
- limit: data.limit,
577
- offset: data.offset,
578
- ...jsonReadGroup
579
- }
580
- };
581
- return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
582
- headers: {
583
- "Content-Type": "application/json"
584
- }
585
- });
586
- },
587
- async getList({
588
- model,
589
- ids = [],
590
- specification = {},
591
- domain = [],
592
- offset,
593
- order,
594
- context = {},
595
- limit = 10
596
- }) {
597
- const env = getEnv();
598
- const jsonData = {
599
- model,
600
- method: "web_search_read" /* WEB_SEARCH_READ */,
601
- ids,
602
- with_context: context,
603
- kwargs: {
604
- specification,
605
- domain,
606
- limit,
607
- offset,
608
- order
609
- }
610
- };
611
- return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
612
- headers: {
613
- "Content-Type": "application/json"
614
- }
615
- });
616
- },
617
- async getDetail({
618
- ids = [],
619
- model,
620
- specification,
621
- context
622
- }) {
623
- const env = getEnv();
624
- const jsonData = {
625
- model,
626
- method: "web_read" /* WEB_READ */,
627
- ids,
628
- with_context: context,
629
- kwargs: {
630
- specification
631
- }
632
- };
633
- return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
634
- headers: {
635
- "Content-Type": "application/json"
636
- }
637
- });
638
- },
639
- async save({
640
- model,
641
- ids = [],
642
- data = {},
643
- specification = {},
644
- context = {}
645
- }) {
646
- const env = getEnv();
647
- const jsonData = {
648
- model,
649
- method: "web_save" /* WEB_SAVE */,
650
- with_context: context,
651
- ids,
652
- kwargs: {
653
- vals: data,
654
- specification
655
- }
656
- };
657
- return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
658
- headers: {
659
- "Content-Type": "application/json"
660
- }
661
- });
662
- },
663
- async delete({ ids = [], model }) {
664
- const env = getEnv();
665
- const jsonData = {
666
- model,
667
- method: "unlink" /* UNLINK */,
668
- ids
669
- };
670
- return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
671
- headers: {
672
- "Content-Type": "application/json"
673
- }
674
- });
675
- },
676
- async onChange({
677
- ids = [],
678
- model,
679
- object,
680
- specification,
681
- context,
682
- fieldChange
683
- }) {
684
- const env = getEnv();
685
- const jsonData = {
686
- model,
687
- method: "onchange" /* ONCHANGE */,
688
- ids,
689
- with_context: context,
690
- args: [
691
- object ? object : {},
692
- fieldChange ? fieldChange : [],
693
- specification
694
- ]
695
- };
696
- return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
697
- headers: {
698
- "Content-Type": "application/json"
699
- }
700
- });
701
- },
702
- async getListFieldsOnchange({ model }) {
703
- const env = getEnv();
704
- const jsonData = {
705
- model,
706
- method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
707
- };
708
- return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
709
- headers: {
710
- "Content-Type": "application/json"
711
- }
712
- });
713
- },
714
- parseORMOdoo(data) {
715
- for (const key in data) {
716
- if (key === "display_name") {
717
- delete data[key];
718
- }
719
- if (!data[key] && data[key] !== 0) {
720
- data[key] = false;
721
- } else if (data[key] === "Draft") {
722
- data[key] = "/";
723
- }
724
- }
725
- return { ...data };
726
- },
727
- toDataJS(data, viewData, model) {
728
- for (const key in data) {
729
- if (data[key] === false) {
730
- if (viewData && model) {
731
- if (viewData?.models?.[model]?.[key]?.type !== "boolean" /* BOOLEAN */) {
732
- data[key] = null;
733
- }
734
- } else {
735
- data[key] = null;
736
- }
737
- } else if (data[key] === "/") {
738
- data[key] = "Draft";
739
- } else if (data[key] !== false) {
740
- if (model !== void 0) {
741
- if (viewData?.models?.[model]?.[key]?.type === "one2many" /* ONE2MANY */ || viewData?.models?.[model]?.[key]?.type === "many2many" /* MANY2MANY */) {
742
- data[key] = (data[key] ??= [])?.map((item, index) => {
743
- const relation = viewData?.models?.[model]?.[key]?.relation;
744
- if (relation !== void 0) {
745
- if (viewData?.models?.[relation]) {
746
- if (item?.length >= 3) {
747
- if (item[0] === 2 /* DELETE */) {
748
- delete data[key][index];
749
- return;
750
- }
751
- return ModelService.toDataJS(
752
- { ...item[OBJECT_POSITION], id: `virtual_${index}` },
753
- viewData,
754
- relation
755
- );
756
- } else {
757
- return ModelService.toDataJS(item, viewData, relation);
758
- }
759
- } else {
760
- if (item?.length >= 3) {
761
- if (!item[OBJECT_POSITION] || item[0] === 2 /* DELETE */) {
762
- delete data[key][index];
763
- return;
764
- }
765
- return item[OBJECT_POSITION];
766
- } else {
767
- return item;
768
- }
769
- }
770
- }
771
- });
772
- }
773
- }
774
- }
775
- }
776
- return { ...data };
777
- }
778
- };
779
- var model_service_default = ModelService;
780
-
781
- // src/services/user-service/index.ts
782
- var UserService = {
783
- async getProfile() {
784
- const env = getEnv();
785
- return env.requests.get("/userinfo" /* PROFILE_PATH */, {
786
- headers: {
787
- "Content-Type": "application/x-www-form-urlencoded"
788
- }
789
- });
790
- },
791
- async getUser({ context, id }) {
792
- const env = getEnv();
793
- const jsonData = {
794
- model: "res.users",
795
- method: "web_read",
796
- ids: [id],
797
- with_context: context,
798
- kwargs: {
799
- specification: {
800
- display_name: {},
801
- image_1920: {},
802
- name: {},
803
- login: {},
804
- email: {},
805
- password: {},
806
- visible_group_id: {
807
- fields: {
808
- id: {},
809
- display_name: {}
810
- }
811
- },
812
- company_id: {
813
- fields: {
814
- id: {},
815
- display_name: {}
816
- }
817
- }
818
- }
819
- }
820
- };
821
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
822
- headers: {
823
- "Content-Type": "application/json"
824
- }
825
- });
826
- },
827
- switchUserLocale: async ({ id, values }) => {
828
- const env = getEnv();
829
- const jsonData = {
830
- model: "res.users",
831
- domain: [["id", "=", id]],
832
- values
833
- };
834
- return env?.requests.post(UriConstants?.CREATE_UPDATE_PATH, jsonData, {
835
- headers: {
836
- "Content-Type": "application/json"
837
- }
838
- });
839
- }
840
- };
841
- var user_service_default = UserService;
842
-
843
- // src/services/view-service/index.ts
844
- var ViewService = {
845
- async getView({
846
- model,
847
- views,
848
- context = {},
849
- options = {},
850
- aid
851
- }) {
852
- const env = getEnv();
853
- const defaultOptions = {
854
- load_filters: true,
855
- toolbar: true,
856
- action_id: aid
857
- };
858
- const jsonDataView = {
859
- model,
860
- method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
861
- kwargs: {
862
- views,
863
- options: { ...options, ...defaultOptions }
864
- },
865
- with_context: context
866
- };
867
- return env?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
868
- headers: {
869
- "Content-Type": "application/json"
870
- }
871
- });
872
- },
873
- async getMenu(context) {
874
- const env = getEnv();
875
- const jsonData = {
876
- model: "ir.ui.menu" /* MENU */,
877
- method: "web_search_read" /* WEB_SEARCH_READ */,
878
- ids: [],
879
- with_context: context,
880
- kwargs: {
881
- specification: {
882
- active: {},
883
- name: {},
884
- is_display: {},
885
- sequence: {},
886
- complete_name: {},
887
- action: {
888
- fields: {
889
- display_name: {},
890
- type: {},
891
- binding_view_types: {}
892
- // res_model: {},
893
- }
894
- },
895
- url_icon: {},
896
- web_icon: {},
897
- web_icon_data: {},
898
- groups_id: {
899
- fields: {
900
- full_name: {}
901
- },
902
- limit: 40,
903
- order: ""
904
- },
905
- display_name: {},
906
- child_id: {
907
- fields: {
908
- active: {},
909
- name: {},
910
- is_display: {},
911
- sequence: {},
912
- complete_name: {},
913
- action: {
914
- fields: {
915
- display_name: {},
916
- type: {},
917
- binding_view_types: {}
918
- // res_model: {},
919
- }
920
- },
921
- url_icon: {},
922
- web_icon: {},
923
- web_icon_data: {},
924
- groups_id: {
925
- fields: {
926
- full_name: {}
927
- },
928
- limit: 40,
929
- order: ""
930
- },
931
- display_name: {},
932
- child_id: {
933
- fields: {
934
- active: {},
935
- name: {},
936
- is_display: {},
937
- sequence: {},
938
- complete_name: {},
939
- action: {
940
- fields: {
941
- display_name: {},
942
- type: {},
943
- binding_view_types: {}
944
- // res_model: {},
945
- }
946
- },
947
- url_icon: {},
948
- web_icon: {},
949
- web_icon_data: {},
950
- groups_id: {
951
- fields: {
952
- full_name: {}
953
- },
954
- limit: 40,
955
- order: ""
956
- },
957
- display_name: {},
958
- child_id: {
959
- fields: {
960
- active: {},
961
- name: {},
962
- is_display: {},
963
- sequence: {},
964
- complete_name: {},
965
- action: {
966
- fields: {
967
- display_name: {},
968
- type: {},
969
- binding_view_types: {}
970
- // res_model: {},
971
- }
972
- },
973
- url_icon: {},
974
- web_icon: {},
975
- web_icon_data: {},
976
- groups_id: {
977
- fields: {
978
- full_name: {}
979
- },
980
- limit: 40,
981
- order: ""
982
- },
983
- display_name: {},
984
- child_id: {
985
- fields: {},
986
- limit: 40,
987
- order: ""
988
- }
989
- },
990
- limit: 40,
991
- order: ""
992
- }
993
- },
994
- limit: 40,
995
- order: ""
996
- }
997
- },
998
- limit: 40,
999
- order: ""
1000
- }
1001
- },
1002
- domain: [
1003
- "&",
1004
- ["is_display", "=", true],
1005
- "&",
1006
- ["active", "=", true],
1007
- ["parent_id", "=", false]
1008
- ]
1009
- }
1010
- };
1011
- return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
1012
- headers: {
1013
- "Content-Type": "application/json"
1014
- }
1015
- });
1016
- },
1017
- async getSelectionItem({ data }) {
1018
- const env = getEnv();
1019
- const jsonData = {
1020
- model: data.model,
1021
- ids: [],
1022
- method: "get_data_select",
1023
- with_context: data.context,
1024
- kwargs: {
1025
- count_limit: 10001,
1026
- domain: data.domain ? data.domain : [],
1027
- offset: 0,
1028
- order: "",
1029
- specification: data?.specification ?? {
1030
- id: {},
1031
- name: {},
1032
- display_name: {}
1033
- }
1034
- }
1035
- };
1036
- return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
1037
- headers: {
1038
- "Content-Type": "application/json"
1039
- }
1040
- });
1041
- },
1042
- async loadMessages() {
1043
- const env = getEnv();
1044
- return env.requests.post(
1045
- "/load_message_failures" /* LOAD_MESSAGE */,
1046
- {},
1047
- {
1048
- headers: {
1049
- "Content-Type": "application/json"
1050
- }
1051
- }
1052
- );
1053
- },
1054
- async getVersion() {
1055
- const env = getEnv();
1056
- return env?.requests.get("", {
1057
- headers: {
1058
- "Content-Type": "application/json"
1059
- }
1060
- });
1061
- }
1062
- };
1063
- var view_service_default = ViewService;
1064
-
1065
- export {
1066
- action_service_default,
1067
- auth_service_default,
1068
- company_service_default,
1069
- excel_service_default,
1070
- form_service_default,
1071
- model_service_default,
1072
- user_service_default,
1073
- view_service_default
1074
- };