bx-rest 0.1.0 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/consts/part-name-metods.d.ts +9 -0
  2. package/esm2020/consts/part-name-metods.mjs +10 -1
  3. package/esm2020/map/lists.mjs +2 -2
  4. package/esm2020/map/task.mjs +10 -1
  5. package/esm2020/public-api.mjs +2 -2
  6. package/esm2020/request/bizproc/activity.mjs +23 -0
  7. package/esm2020/request/bizproc/event.mjs +19 -0
  8. package/esm2020/request/bizproc/robot.mjs +22 -0
  9. package/esm2020/request/bizproc/task.mjs +20 -0
  10. package/esm2020/request/bizproc/workflow/instance.mjs +19 -0
  11. package/esm2020/request/bizproc/workflow/template.mjs +27 -0
  12. package/esm2020/request/bizproc/workflow.mjs +31 -0
  13. package/esm2020/request/bizproc.mjs +25 -0
  14. package/esm2020/request/disk/file.mjs +3 -3
  15. package/esm2020/request/disk/folder.mjs +2 -2
  16. package/esm2020/request/disk/storage.mjs +3 -3
  17. package/esm2020/request/lists/element.mjs +5 -4
  18. package/esm2020/request/lists.mjs +2 -2
  19. package/esm2020/request/tasks/task.mjs +34 -1
  20. package/esm2020/request/user.mjs +40 -108
  21. package/esm2020/request-navvy/bizproc/workflow.mjs +22 -0
  22. package/esm2020/request-navvy/bizproc.mjs +60 -0
  23. package/esm2020/request-navvy/disk/file.mjs +12 -16
  24. package/esm2020/request-navvy/disk/folder.mjs +9 -10
  25. package/esm2020/request-navvy/disk/storage.mjs +20 -18
  26. package/esm2020/request-navvy/lists/element.mjs +11 -7
  27. package/esm2020/request-navvy/lists.mjs +2 -10
  28. package/esm2020/request-navvy/tasks/task.mjs +67 -19
  29. package/esm2020/request-navvy/user.mjs +33 -22
  30. package/esm2020/rest.mjs +21 -17
  31. package/esm2020/services/base.mjs +3 -3
  32. package/esm2020/services/http/HttpBX.mjs +44 -61
  33. package/esm2020/services/http/base/base.mjs +3 -4
  34. package/esm2020/services/http/base/http.mjs +6 -21
  35. package/esm2020/services/http/http.mjs +37 -103
  36. package/esm2020/services/http/sessionKey.mjs +128 -113
  37. package/esm2020/services/navvy.mjs +26 -0
  38. package/esm2020/services/vanilla/sessionStorage.mjs +23 -0
  39. package/esm2020/settings.mjs +2 -2
  40. package/esm2020/typification/auth/save.mjs +1 -1
  41. package/esm2020/typification/rest/base/OrderOptions.mjs +2 -0
  42. package/esm2020/typification/rest/base/sort.mjs +2 -0
  43. package/esm2020/typification/rest/bizproc/base/filedEnum.mjs +2 -0
  44. package/esm2020/typification/rest/bizproc/workflow/start.mjs +2 -0
  45. package/esm2020/typification/rest/bizproc/workflow/template/list.mjs +2 -0
  46. package/esm2020/typification/rest/lists/element/add.mjs +2 -0
  47. package/esm2020/typification/rest/task/base/fieldsName.mjs +2 -0
  48. package/esm2020/typification/rest/tasks/task/add.mjs +2 -0
  49. package/esm2020/typification/rest/tasks/task/get.mjs +2 -0
  50. package/esm2020/typification/rest/tasks/task/list.mjs +2 -0
  51. package/esm2020/typification/rest/user/get.mjs +1 -1
  52. package/fesm2015/bx-rest.mjs +970 -842
  53. package/fesm2015/bx-rest.mjs.map +1 -1
  54. package/fesm2020/bx-rest.mjs +973 -840
  55. package/fesm2020/bx-rest.mjs.map +1 -1
  56. package/map/lists.d.ts +1 -1
  57. package/map/task.d.ts +4 -1
  58. package/package.json +1 -1
  59. package/public-api.d.ts +1 -1
  60. package/request/bizproc/activity.d.ts +12 -0
  61. package/request/bizproc/event.d.ts +8 -0
  62. package/request/bizproc/robot.d.ts +11 -0
  63. package/request/bizproc/task.d.ts +9 -0
  64. package/request/bizproc/workflow/instance.d.ts +8 -0
  65. package/request/bizproc/workflow/template.d.ts +16 -0
  66. package/request/bizproc/workflow.d.ts +20 -0
  67. package/request/bizproc.d.ts +16 -0
  68. package/request/lists/element.d.ts +2 -1
  69. package/request/lists.d.ts +1 -1
  70. package/request/tasks/task.d.ts +9 -1
  71. package/request/user.d.ts +7 -7
  72. package/request-navvy/bizproc/workflow.d.ts +12 -0
  73. package/request-navvy/bizproc.d.ts +24 -0
  74. package/request-navvy/disk/file.d.ts +7 -9
  75. package/request-navvy/disk/folder.d.ts +3 -1
  76. package/request-navvy/disk/storage.d.ts +5 -2
  77. package/request-navvy/lists/element.d.ts +6 -2
  78. package/request-navvy/lists.d.ts +1 -8
  79. package/request-navvy/tasks/task.d.ts +13 -3
  80. package/request-navvy/user.d.ts +12 -9
  81. package/rest.d.ts +13 -9
  82. package/services/http/HttpBX.d.ts +6 -6
  83. package/services/http/base/base.d.ts +4 -4
  84. package/services/http/base/http.d.ts +3 -3
  85. package/services/http/http.d.ts +3 -12
  86. package/services/http/sessionKey.d.ts +3 -23
  87. package/services/navvy.d.ts +11 -0
  88. package/services/vanilla/sessionStorage.d.ts +7 -0
  89. package/settings.d.ts +1 -1
  90. package/typification/auth/save.d.ts +1 -1
  91. package/typification/rest/base/OrderOptions.d.ts +1 -0
  92. package/typification/rest/base/sort.d.ts +1 -0
  93. package/typification/rest/bizproc/base/filedEnum.d.ts +1 -0
  94. package/typification/rest/bizproc/workflow/start.d.ts +5 -0
  95. package/typification/rest/bizproc/workflow/template/list.d.ts +8 -0
  96. package/typification/rest/lists/element/add.d.ts +9 -0
  97. package/typification/rest/task/base/fieldsName.d.ts +1 -0
  98. package/typification/rest/{task/fieldsForSend.d.ts → tasks/task/add.d.ts} +1 -1
  99. package/typification/rest/tasks/task/get.d.ts +5 -0
  100. package/typification/rest/tasks/task/list.d.ts +65 -0
  101. package/typification/rest/user/get.d.ts +7 -2
  102. package/esm2020/store/auth.mjs +0 -26
  103. package/esm2020/store/users.mjs +0 -67
  104. package/esm2020/typification/rest/task/fieldsForSend.mjs +0 -2
  105. package/store/auth.d.ts +0 -20
  106. package/store/users.d.ts +0 -34
@@ -1,22 +1,19 @@
1
1
  import * as i0 from '@angular/core';
2
- import { NgModule, inject, Component, ViewEncapsulation, Inject, Injectable, Optional } from '@angular/core';
3
- import { Subscription, filter, take, of, throwError, forkJoin, mergeMap, tap } from 'rxjs';
4
- import { map, catchError, mergeMap as mergeMap$1, first, take as take$1 } from 'rxjs/operators';
2
+ import { NgModule, inject, Component, ViewEncapsulation, Inject, Injectable } from '@angular/core';
3
+ import { Subscription, of, mergeMap, throwError, forkJoin, tap } from 'rxjs';
5
4
  import clone from 'just-clone';
5
+ import { map, catchError, take, mergeMap as mergeMap$1 } from 'rxjs/operators';
6
6
  import * as i1$1 from '@angular/material/snack-bar';
7
7
  import { MatSnackBarRef, MAT_SNACK_BAR_DATA } from '@angular/material/snack-bar';
8
8
  import * as i2 from '@angular/material/icon';
9
9
  import { MatIconModule } from '@angular/material/icon';
10
10
  import * as i1 from '@angular/material/button';
11
11
  import { MatButtonModule } from '@angular/material/button';
12
- import * as i1$2 from '@ngrx/store';
13
- import { createAction, props, createReducer, on } from '@ngrx/store';
14
12
  import { DateTime } from 'luxon';
15
- import * as i2$1 from '@angular/router';
16
- import * as i1$3 from '@angular/common/http';
13
+ import * as i1$2 from '@angular/common/http';
17
14
  import { HttpParams } from '@angular/common/http';
18
15
 
19
- const REST_SETTINGS = {
16
+ const BX_REST_SETTINGS = {
20
17
  auth: {
21
18
  source: 'cookies',
22
19
  key: 'auth'
@@ -33,81 +30,6 @@ function BXRestMapResult(v) {
33
30
  return undefined;
34
31
  }
35
32
 
36
- const $get = 'get';
37
- const $add = 'add';
38
- const $set = 'set';
39
- const $event = 'event';
40
- const $update = 'update';
41
- const $user = 'user';
42
- const $task = 'task';
43
- const $calendar = 'calendar';
44
- const $meeting = 'meeting';
45
- const $list = 'list';
46
- const $search = 'search';
47
- const $accessibility = 'accessibility';
48
- const $delete = 'delete';
49
- const $nearest = 'nearest';
50
- const $params = 'params';
51
- const $status = 'status';
52
- const $resource = 'resource';
53
- const $booking = 'booking';
54
- const $section = 'section';
55
- const $settings = 'settings';
56
- const $tasks = 'tasks';
57
- const $elapseditem = 'elapseditem';
58
- const $getlist = 'getlist';
59
- const $approve = 'approve';
60
- const $complete = 'complete';
61
- const $counters = 'counters';
62
- const $deger = 'deger';
63
- const $delegate = 'delegate';
64
- const $disapprove = 'disapprove';
65
- const $favorite = 'favorite';
66
- const $files = 'files';
67
- const $file = 'file';
68
- const $attach = 'attach';
69
- const $field = 'field';
70
- const $getFields = 'get' + $field + 's';
71
- const $getaccess = 'getaccess';
72
- const $history = 'history';
73
- const $pause = 'pause';
74
- const $renew = 'renew';
75
- const $start = 'start';
76
- const $result = 'result';
77
- const $planner = 'planner';
78
- const $disk = 'disk';
79
- const $rename = 'rename';
80
- const $markdeleted = 'markdeleted';
81
- const $restore = 'restore';
82
- const $folder = 'folder';
83
- const $getchildren = 'getchildren';
84
- const $copyto = 'copyto';
85
- const $moveto = 'moveto';
86
- const $uploadfile = 'uploadfile';
87
- const $storage = 'storage';
88
- const $getTypes = 'getTypes';
89
- const $stages = 'stages';
90
- const $getmanifest = 'getmanifest';
91
- const $isactionallowed = 'isactionallowed';
92
- const $commentitem = 'commentitem';
93
- const $department = 'department';
94
- const $sonet_group = 'sonet_group';
95
- const $create = 'create';
96
- const $feature = 'feature';
97
- const $access = 'access';
98
- const $request = 'request';
99
- const $socialnetwork = 'socialnetwork';
100
- const $api = 'api';
101
- const $workgroup = 'workgroup';
102
- const $log = 'log';
103
- const $blogpost = 'blogpost';
104
- const $lists = 'lists';
105
- const $iblock = 'iblock';
106
- const $type = 'type';
107
- const $id = 'id';
108
- const $element = 'element';
109
- const $url = 'url';
110
-
111
33
  class BxRestModule {
112
34
  }
113
35
  BxRestModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BxRestModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -452,29 +374,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
452
374
  }]
453
375
  }] });
454
376
 
455
- const save$1 = createAction('[Auth Component] Save', props());
456
- const saveAccessToken = createAction('[Auth Component] SaveAccessToken', props());
457
- const initialState$1 = {
458
- access_token: '',
459
- client_endpoint: '',
460
- domain: '',
461
- expires: 0,
462
- expires_in: 0,
463
- member_id: '',
464
- refresh_token: '',
465
- scope: '',
466
- server_endpoint: '',
467
- status: '',
468
- user_id: 0
469
- };
470
- const _authReducer = createReducer(initialState$1, on(saveAccessToken, (s, data) => {
471
- let copy = clone(s);
472
- return Object.assign(copy, data);
473
- }));
474
- function authReducer(state = initialState$1, action) {
475
- return _authReducer(state, action);
476
- }
477
-
478
377
  const time = {
479
378
  oneDayMilliseconds: 1000 * 60 * 60 * 24
480
379
  };
@@ -576,7 +475,7 @@ class BaseServices {
576
475
  }
577
476
  getHomeAddress() {
578
477
  // return this.prepareBaseAddress(environment.urls.home)
579
- return this.prepareBaseAddress(REST_SETTINGS.urls.home);
478
+ return this.prepareBaseAddress(BX_REST_SETTINGS.urls.home);
580
479
  }
581
480
  dateDiff(a, b) {
582
481
  return new Date(a.valueOf() - b.valueOf());
@@ -680,6 +579,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
680
579
  }]
681
580
  }] });
682
581
 
582
+ class SessionStorage {
583
+ static setItem(name, value) {
584
+ sessionStorage.setItem(name, JSON.stringify(value));
585
+ }
586
+ static getItem(name) {
587
+ const res = sessionStorage.getItem(name);
588
+ if (res) {
589
+ return JSON.parse(res);
590
+ }
591
+ return undefined;
592
+ }
593
+ }
594
+ SessionStorage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionStorage, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
595
+ SessionStorage.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionStorage, providedIn: 'root' });
596
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionStorage, decorators: [{
597
+ type: Injectable,
598
+ args: [{
599
+ providedIn: 'root'
600
+ }]
601
+ }] });
602
+
683
603
  class RestServices {
684
604
  constructor() {
685
605
  this.BX24 = false;
@@ -700,114 +620,136 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
700
620
  }], ctorParameters: function () { return []; } });
701
621
 
702
622
  class SessionKeyServices extends BaseServices {
703
- constructor(store, route, BxApiLib, REST_SETTINGS) {
623
+ constructor(
624
+ // private route: ActivatedRoute,
625
+ BxApiLib) {
704
626
  super();
705
- this.store = store;
706
- this.route = route;
707
627
  this.BxApiLib = BxApiLib;
708
628
  this.authHave = false;
709
629
  this.subscribe = {
710
630
  authData: new Subscription()
711
631
  };
712
- this.REST_SETTINGS = REST_SETTINGS;
713
- this.authData$ = this.store.select('auth');
714
- this.authData$.subscribe(authData => {
715
- if ((authData && !authData.access_token.length) || !authData) {
716
- // получаем токен по собственным каналом (в битриксе приложение trace:apps.trace)
717
- window.addEventListener('message', (event) => {
718
- if (event.origin !== window.origin) { // проверяем что это не наше сообщение (с текущего приложения)
719
- if (event.data && event.data.param) {
720
- if (typeof event.data.param === 'string') {
721
- event.data.param = JSON.parse(event.data.param);
722
- }
723
- let save = {};
724
- if (event.data.param.access_token) {
725
- let param = event.data.param;
726
- save.access_token = event.data.param.access_token;
727
- save = {
728
- access_token: (param.access_token) ? param.access_token : undefined,
729
- client_endpoint: (param.client_endpoint) ? param.client_endpoint : undefined,
730
- domain: (param.domain) ? param.domain : undefined,
731
- expires: (param.expires) ? param.expires : undefined,
732
- expires_in: (param.expires_in) ? param.expires_in : undefined,
733
- member_id: (param.member_id) ? param.member_id : undefined,
734
- refresh_token: (param.refresh_token) ? param.refresh_token : undefined,
735
- scope: (param.scope) ? param.scope : undefined,
736
- server_endpoint: (param.server_endpoint) ? param.server_endpoint : undefined,
737
- status: (param.status) ? param.status : undefined,
738
- user_id: (param.user_id) ? param.user_id : undefined,
739
- type: (param.type) ? param.type : undefined,
740
- };
741
- }
632
+ let authData = SessionStorage.getItem(this.constructor.name);
633
+ if ((authData && !authData.access_token.length) || !authData) {
634
+ // получаем токен по собственным каналом (в битриксе приложение trace:apps.trace)
635
+ window.addEventListener('message', (event) => {
636
+ if (event.origin !== window.origin) { // проверяем что это не наше сообщение (с текущего приложения)
637
+ if (event.data && event.data.param) {
638
+ if (typeof event.data.param === 'string') {
639
+ event.data.param = JSON.parse(event.data.param);
640
+ }
641
+ if (event.data.param.access_token) {
642
+ let param = event.data.param;
643
+ let save = {
644
+ access_token: (param.access_token) ? param.access_token : undefined,
645
+ client_endpoint: (param.client_endpoint) ? param.client_endpoint : undefined,
646
+ domain: (param.domain) ? param.domain : undefined,
647
+ expires: (param.expires) ? param.expires : undefined,
648
+ expires_in: (param.expires_in) ? param.expires_in : undefined,
649
+ member_id: (param.member_id) ? param.member_id : undefined,
650
+ refresh_token: (param.refresh_token) ? param.refresh_token : undefined,
651
+ scope: (param.scope) ? param.scope : undefined,
652
+ server_endpoint: (param.server_endpoint) ? param.server_endpoint : undefined,
653
+ status: (param.status) ? param.status : undefined,
654
+ user_id: (param.user_id) ? param.user_id : undefined,
655
+ type: (param.type) ? param.type : undefined,
656
+ };
742
657
  if (Object.keys(save).length && save.access_token) {
743
- this.store.dispatch(saveAccessToken(save));
658
+ SessionStorage.setItem(this.constructor.name, save);
744
659
  this.subscribeAll();
745
660
  }
746
661
  }
747
662
  }
748
- });
749
- this.subscribe.authData = this.route.queryParamMap
750
- .pipe(filter(param => param.has('AUTH_ID')
751
- || param.has('access_token')
752
- || param.has('REFRESH_ID')
753
- || param.has('DOMAIN')))
754
- .subscribe((param) => {
755
- let save = {};
756
- if (param.has('AUTH_ID') && !authData.access_token.length) {
757
- const get = param.get('AUTH_ID');
758
- if (get) {
759
- CookiesServices.set('auth', get); // потом убрать
760
- save.access_token = get;
761
- }
762
- }
763
- if (param.has('access_token') && !authData.access_token.length) {
764
- const get = param.get('access_token');
765
- if (get) {
766
- CookiesServices.set('auth', get); // потом убрать
767
- save.access_token = get;
768
- }
769
- }
770
- if (param.has('REFRESH_ID') && !authData.refresh_token.length) {
771
- const get = param.get('REFRESH_ID');
772
- if (get) {
773
- save.refresh_token = get;
774
- }
775
- }
776
- if (param.has('DOMAIN') && !authData.domain.length) {
777
- const get = param.get('DOMAIN');
778
- if (get) {
779
- save.domain = get;
780
- }
781
- }
782
- if (Object.keys(save).length && save.access_token) {
783
- this.store.dispatch(saveAccessToken(save));
784
- this.subscribeAll();
785
- }
786
- else {
787
- // если битрикс не шлёт нужные мне параметры на прямую
788
- // просим их мне отдать так как описано это в документации
789
- let f = () => {
790
- if (this.BxApiLib.BX24) {
791
- const initDate = this.BxApiLib.BX24.getAuth();
792
- this.store.dispatch(saveAccessToken(initDate));
793
- }
794
- };
795
- this.BxApiLib.init(f);
663
+ }
664
+ });
665
+ /*
666
+ this.subscribe.authData = this.route.queryParamMap
667
+ .pipe(
668
+ filter(param =>
669
+ param.has('AUTH_ID')
670
+ || param.has('access_token')
671
+ || param.has('REFRESH_ID')
672
+ || param.has('DOMAIN')
673
+ )
674
+ )
675
+ .subscribe((param: ParamMap) => {
676
+ if(!save) {
677
+ let save = {
678
+ access_token: undefined,
679
+ client_endpoint: (param.client_endpoint) ? param.client_endpoint : undefined,
680
+ domain: (param.domain) ? param.domain : undefined,
681
+ expires: (param.expires) ? param.expires : undefined,
682
+ expires_in: (param.expires_in) ? param.expires_in : undefined,
683
+ member_id: (param.member_id) ? param.member_id : undefined,
684
+ refresh_token: (param.refresh_token) ? param.refresh_token : undefined,
685
+ scope: (param.scope) ? param.scope : undefined,
686
+ server_endpoint: (param.server_endpoint) ? param.server_endpoint : undefined,
687
+ status: (param.status) ? param.status : undefined,
688
+ user_id: (param.user_id) ? param.user_id : undefined,
689
+ type: (param.type) ? param.type : undefined,
690
+ }
691
+ }
692
+
693
+ if (param.has('AUTH_ID') && !authData?.access_token.length) {
694
+ const get = param.get('AUTH_ID')
695
+ if (get) {
696
+ Cookies.set('auth', get) //TODO: потом убрать
697
+ save.access_token = get
698
+ }
699
+ }
700
+
701
+ if (param.has('access_token') && !authData.access_token.length) {
702
+ const get = param.get('access_token')
703
+ if (get) {
704
+ Cookies.set('auth', get) // TODO: потом убрать
705
+ save.access_token = get
706
+ }
707
+ }
708
+
709
+ if (param.has('REFRESH_ID') && !authData.refresh_token.length) {
710
+ const get = param.get('REFRESH_ID')
711
+ if (get) {
712
+ save.refresh_token = get
713
+ }
714
+ }
715
+
716
+ if (param.has('DOMAIN') && !authData.domain.length) {
717
+ const get = param.get('DOMAIN')
718
+ if (get) {
719
+ save.domain = get
720
+ }
721
+ }
722
+ if (Object.keys(save).length && save.access_token) {
723
+ SessionStorage.setItem(this.constructor.name, save)
724
+ this.subscribeAll()
725
+ } else {
726
+ // если битрикс не шлёт нужные мне параметры на прямую
727
+ // просим их мне отдать так как описано это в документации
728
+ let f = () => {
729
+ if (this.BxApiLib.BX24) {
730
+ const initDate = this.BxApiLib.BX24.getAuth()
731
+ SessionStorage.setItem(this.constructor.name, save)
796
732
  }
797
- });
798
- }
799
- else if (this.getAuth().length) {
800
- this.authHave = true;
801
- }
802
- this.authData = authData;
803
- });
733
+ }
734
+
735
+ this.BxApiLib.init(f)
736
+ }
737
+
738
+ })
739
+ */
740
+ }
741
+ else if (this.getAuth().length) {
742
+ this.authHave = true;
743
+ }
744
+ this.authData = authData;
804
745
  }
805
746
  subscribeAll() {
806
747
  this.subscribe.authData.unsubscribe();
807
748
  }
808
749
  getAuth() {
809
- switch (REST_SETTINGS.auth.key) {
750
+ switch (BX_REST_SETTINGS.auth.key) {
810
751
  case 'auth':
752
+ console.log('Cookies.get(\'auth\')', CookiesServices.get('auth'));
811
753
  return CookiesServices.get('auth');
812
754
  default:
813
755
  if (window.BX && window.BX.bitrix_sessid()) {
@@ -823,8 +765,8 @@ class SessionKeyServices extends BaseServices {
823
765
  }
824
766
  }
825
767
  getKeyAuth() {
826
- if (REST_SETTINGS.auth.key.length) {
827
- return REST_SETTINGS.auth.key;
768
+ if (BX_REST_SETTINGS.auth.key.length) {
769
+ return BX_REST_SETTINGS.auth.key;
828
770
  }
829
771
  else {
830
772
  if (window.BX && window.BX.bitrix_sessid()
@@ -859,34 +801,30 @@ class SessionKeyServices extends BaseServices {
859
801
  return false;
860
802
  }
861
803
  getAuthParams() {
862
- switch (REST_SETTINGS.auth.source) {
804
+ console.log('BX_REST_SETTINGS', BX_REST_SETTINGS);
805
+ switch (BX_REST_SETTINGS.auth.source) {
863
806
  case 'cookies':
864
- return of(this.getAuth());
807
+ return this.getAuth();
865
808
  default:
866
- return this.authData$.pipe(take(1), map(v => (v) ? v.access_token : undefined));
809
+ return (this.authData) ? this.authData.access_token : undefined;
867
810
  }
868
811
  }
869
812
  getBaseUrl() {
870
- return of(this.prepareBaseAddress(this.REST_SETTINGS.urls.home, 'rest'));
813
+ return of(this.prepareBaseAddress(BX_REST_SETTINGS.urls.home, 'rest'));
871
814
  // return this.authData$.pipe( // TODO: разобраться позже
872
815
  // take(1),
873
816
  // map(v => (v && v.domain) ? this.prepareBaseAddress(v.domain) : undefined)
874
817
  // )
875
818
  }
876
819
  }
877
- SessionKeyServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionKeyServices, deps: [{ token: i1$2.Store }, { token: i2$1.ActivatedRoute }, { token: RestServices }, { token: REST_SETTINGS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
820
+ SessionKeyServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionKeyServices, deps: [{ token: RestServices }], target: i0.ɵɵFactoryTarget.Injectable });
878
821
  SessionKeyServices.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionKeyServices, providedIn: 'root' });
879
822
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionKeyServices, decorators: [{
880
823
  type: Injectable,
881
824
  args: [{
882
825
  providedIn: 'root'
883
826
  }]
884
- }], ctorParameters: function () { return [{ type: i1$2.Store }, { type: i2$1.ActivatedRoute }, { type: RestServices }, { type: undefined, decorators: [{
885
- type: Optional
886
- }, {
887
- type: Inject,
888
- args: [REST_SETTINGS]
889
- }] }]; } });
827
+ }], ctorParameters: function () { return [{ type: RestServices }]; } });
890
828
 
891
829
  class HttpData extends BaseServices {
892
830
  constructor() {
@@ -1010,44 +948,30 @@ class BaseHttp extends HttpData {
1010
948
  this.http = http;
1011
949
  this.snackBar = snackBar;
1012
950
  }
1013
- handleError(result, textError = 'получения данных') {
951
+ handleError(result) {
1014
952
  return (error) => {
1015
953
  console.error(`failed: ${error.message}`);
1016
- this.snackBar.error('Ошибка: ' + textError);
1017
954
  return of(result);
1018
955
  };
1019
956
  }
1020
957
  }
1021
- BaseHttp.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseHttp, deps: [{ token: i1$3.HttpClient }, { token: SnackBarService }], target: i0.ɵɵFactoryTarget.Injectable });
958
+ BaseHttp.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseHttp, deps: [{ token: i1$2.HttpClient }, { token: SnackBarService }], target: i0.ɵɵFactoryTarget.Injectable });
1022
959
  BaseHttp.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseHttp, providedIn: 'root' });
1023
960
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseHttp, decorators: [{
1024
961
  type: Injectable,
1025
962
  args: [{
1026
963
  providedIn: 'root'
1027
964
  }]
1028
- }], ctorParameters: function () { return [{ type: i1$3.HttpClient }, { type: SnackBarService }]; } });
965
+ }], ctorParameters: function () { return [{ type: i1$2.HttpClient }, { type: SnackBarService }]; } });
1029
966
 
1030
967
  class BaseHttpServices extends BaseHttp {
1031
- httpGet(url, params = {}, textError = '', settings = this.defSettings) {
968
+ httpGet(url, params = {}, settings = this.defSettings) {
1032
969
  return this.http.get(url, {
1033
970
  params: this.getHttpParamsGet(params, new HttpParams(), false, [], settings)
1034
- }).pipe(catchError(err => {
1035
- if (!textError.length && err.error.error_description) {
1036
- textError = err.error.error_description;
1037
- }
1038
- this.snackBar.error('Ошибка: ' + textError);
1039
- return throwError(() => err);
1040
- }));
971
+ });
1041
972
  }
1042
- httpPost(url, params = {}, textError = '', settings = this.defSettings) {
1043
- return this.http.post(url, this.getHttpParamsPost(params, new FormData(), false, [], settings)).pipe(catchError(err => {
1044
- if (!textError.length && err.error.error_description) {
1045
- textError = err.error.error_description;
1046
- }
1047
- this.snackBar.error('Ошибка: ' + textError);
1048
- console.error(err);
1049
- return throwError(() => err);
1050
- }));
973
+ httpPost(url, params = {}, settings = this.defSettings) {
974
+ return this.http.post(url, this.getHttpParamsPost(params, new FormData(), false, [], settings));
1051
975
  }
1052
976
  }
1053
977
 
@@ -1056,120 +980,55 @@ class HttpServices extends BaseHttpServices {
1056
980
  super(http, snackBar);
1057
981
  this.session = session;
1058
982
  }
1059
- timeNowOnServer() {
1060
- return this.httpGet('server.time').pipe(map(v => {
1061
- if (v && v.result) {
1062
- return new Date(v.result);
1063
- }
1064
- return undefined;
1065
- }));
1066
- }
1067
- /**
1068
- * Это пиздец а не метод
1069
- * @param param
1070
- */
1071
- branch(param) {
1072
- let prepareParam = Object.entries(this.prepareBatch(param));
1073
- const size = 50; // больше не отдаст
1074
- let subarray = []; //массив в который будет выведен результат.
1075
- for (let i = 0; i < Math.ceil(prepareParam.length / size); i++) {
1076
- subarray[i] = prepareParam.slice((i * size), (i * size) + size);
983
+ httpPost(url, params = {}, settings = this.defSettings) {
984
+ let auth = this.session.getAuthParams();
985
+ if (auth) {
986
+ const paramsClone = clone(params);
987
+ paramsClone[this.session.getKeyAuth()] = auth;
988
+ return this.session.getBaseUrl().pipe(mergeMap(v => {
989
+ if (v) {
990
+ return this.http.post(this.prepareBaseAddress(v) + url, this.getHttpParamsPost(paramsClone, new FormData(), false, [], settings));
991
+ }
992
+ return throwError(() => 'get base url error');
993
+ }));
1077
994
  }
1078
- return forkJoin(subarray.map(i => {
1079
- return this.httpPost('batch.json', {
1080
- halt: 0,
1081
- cmd: Object.assign({}, ...i.map(x => {
1082
- return { [x[0]]: x[1] };
1083
- }))
1084
- });
1085
- }));
1086
- }
1087
- prepareBatch(param) {
1088
- let res = Object.keys(param).reduce((obj, key) => {
1089
- obj[key] = '';
1090
- return obj;
1091
- }, {});
1092
- for (let key in param) {
1093
- if (typeof key === 'string' || typeof key === 'number' && param[key].param) {
1094
- res[key] = param[key].name + '?' + this.getHttpParamsGet(param[key].param).toString();
1095
- }
995
+ else {
996
+ this.snackBar.error('Error: Auth not get');
997
+ return throwError(() => 'auth not get');
1096
998
  }
1097
- return res;
1098
999
  }
1099
- // mapBranchResult<T>(res: iBatchRequestAnswer<T>[]){
1100
- // return Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined)) as {[key:keyBatch]: T}
1101
- // }
1102
- //
1103
- // mapBranchResultWithoutKey<T>(res: iBatchRequestAnswer<T>[]): T[]{
1104
- // return flatten<T>(Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined)))
1105
- // }
1106
- httpPost(url, params = {}, textError = '', settings = this.defSettings) {
1107
- return this.session.getAuthParams().pipe(mergeMap(auth => {
1108
- if (auth) {
1109
- const paramsClone = clone(params);
1110
- paramsClone[this.session.getKeyAuth()] = auth;
1111
- return this.session.getBaseUrl().pipe(mergeMap(v => {
1112
- if (v) {
1113
- return this.http.post(this.prepareBaseAddress(v) + url, this.getHttpParamsPost(paramsClone, new FormData(), false, [], settings))
1114
- .pipe(take(1), catchError(err => {
1115
- if (!textError.length && err.error.error_description) {
1116
- textError = err.error.error_description;
1117
- }
1118
- this.snackBar.error('Ошибка: ' + textError);
1119
- return throwError(() => err);
1120
- }));
1121
- }
1122
- return throwError(() => 'get base url error');
1123
- }));
1124
- }
1125
- else {
1126
- this.snackBar.error('Error: Auth not get');
1127
- return throwError(() => 'auth not get');
1000
+ httpGet(url, params = {}, settings = this.defSettings) {
1001
+ let auth = this.session.getAuthParams();
1002
+ if (auth) {
1003
+ if (params === null) {
1004
+ params = {};
1128
1005
  }
1129
- }));
1130
- }
1131
- httpGet(url, params = {}, textError = '', settings = this.defSettings) {
1132
- return this.session.getAuthParams().pipe(mergeMap(auth => {
1133
- if (auth) {
1134
- if (params === null) {
1135
- params = {};
1006
+ const paramsClone = clone(params);
1007
+ paramsClone[this.session.getKeyAuth()] = auth;
1008
+ let options = {
1009
+ params: this.getHttpParamsGet(paramsClone)
1010
+ };
1011
+ return this.session.getBaseUrl().pipe(mergeMap(v => {
1012
+ if (v) {
1013
+ return this.http.get(this.prepareBaseAddress(v) + url, options);
1136
1014
  }
1137
- const paramsClone = clone(params);
1138
- paramsClone[this.session.getKeyAuth()] = auth;
1139
- let options = {
1140
- params: this.getHttpParamsGet(paramsClone)
1141
- };
1142
- return this.session.getBaseUrl().pipe(mergeMap(v => {
1143
- if (v) {
1144
- return this.http.get(this.prepareBaseAddress(v) + url, options).pipe(take(1), catchError(err => {
1145
- if (!textError.length && err.error.error_description) {
1146
- textError = err.error.error_description;
1147
- }
1148
- this.snackBar.error('Ошибка: ' + textError);
1149
- return throwError(() => err);
1150
- }));
1151
- }
1152
- return throwError(() => 'get base url error');
1153
- }));
1154
- }
1155
- else {
1156
- this.snackBar.error('Error: Auth not get');
1157
- return throwError(() => 'auth not get');
1158
- }
1159
- }));
1160
- }
1161
- getNameMethod(arr) {
1162
- return arr.join('.');
1015
+ return throwError(() => 'get base url error');
1016
+ }));
1017
+ }
1018
+ else {
1019
+ this.snackBar.error('Error: Auth not get');
1020
+ return throwError(() => 'auth not get');
1021
+ }
1163
1022
  }
1164
1023
  }
1165
- HttpServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HttpServices, deps: [{ token: i1$3.HttpClient }, { token: SnackBarService }, { token: SessionKeyServices }], target: i0.ɵɵFactoryTarget.Injectable });
1024
+ HttpServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HttpServices, deps: [{ token: i1$2.HttpClient }, { token: SnackBarService }, { token: SessionKeyServices }], target: i0.ɵɵFactoryTarget.Injectable });
1166
1025
  HttpServices.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HttpServices, providedIn: 'root' });
1167
1026
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HttpServices, decorators: [{
1168
1027
  type: Injectable,
1169
1028
  args: [{
1170
1029
  providedIn: 'root'
1171
1030
  }]
1172
- }], ctorParameters: function () { return [{ type: i1$3.HttpClient }, { type: SnackBarService }, { type: SessionKeyServices }]; } });
1031
+ }], ctorParameters: function () { return [{ type: i1$2.HttpClient }, { type: SnackBarService }, { type: SessionKeyServices }]; } });
1173
1032
 
1174
1033
  // type TransformFunction<T, R> = (input: T) => R;
1175
1034
  class HttpBXServices extends HttpServices {
@@ -1222,66 +1081,49 @@ class HttpBXServices extends HttpServices {
1222
1081
  // override mapBranchResultWithoutKey<T>(res: iBatchRequestAnswer<T>[]): T[] {
1223
1082
  // return flatten<T>(Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined)))
1224
1083
  // }
1225
- post(name, params = {}, textError = '', settings = this.defSettings) {
1226
- return this.httpPost(this.getNameMethod(name), params, textError, settings);
1227
- }
1228
- get(name, params = {}, textError = '', settings = this.defSettings) {
1229
- return this.httpGet(this.getNameMethod(name), params, textError, settings);
1230
- }
1231
- httpPost(url, params = {}, textError = '', settings = this.defSettings) {
1232
- return this.session.getAuthParams().pipe(mergeMap(auth => {
1233
- if (auth) {
1234
- const paramsClone = clone(params);
1235
- paramsClone[this.session.getKeyAuth()] = auth;
1236
- return this.session.getBaseUrl().pipe(mergeMap(v => {
1237
- if (v) {
1238
- return this.http.post(this.prepareBaseAddress(v) + url, this.getHttpParamsPost(paramsClone, new FormData(), false, [], settings))
1239
- .pipe(take(1), catchError(err => {
1240
- if (!textError.length && err.error.error_description) {
1241
- textError = err.error.error_description;
1242
- }
1243
- this.snackBar.error('Ошибка: ' + textError);
1244
- return throwError(() => err);
1245
- }));
1246
- }
1247
- return throwError(() => 'get base url error');
1248
- }));
1249
- }
1250
- else {
1251
- this.snackBar.error('Error: Auth not get');
1252
- return throwError(() => 'auth not get');
1253
- }
1254
- }));
1255
- }
1256
- httpGet(url, params = {}, textError = '', settings = this.defSettings) {
1257
- return this.session.getAuthParams().pipe(mergeMap(auth => {
1258
- if (auth) {
1259
- if (params === null) {
1260
- params = {};
1084
+ post(name, params = {}, settings = this.defSettings) {
1085
+ return this.httpPost(this.getNameMethod(name), params, settings);
1086
+ }
1087
+ get(name, params = {}, settings = this.defSettings) {
1088
+ return this.httpGet(this.getNameMethod(name), params, settings);
1089
+ }
1090
+ httpPost(url, params = {}, settings = this.defSettings) {
1091
+ let auth = this.session.getAuthParams();
1092
+ if (auth) {
1093
+ const paramsClone = clone(params);
1094
+ paramsClone[this.session.getKeyAuth()] = auth;
1095
+ return this.session.getBaseUrl().pipe(mergeMap(v => {
1096
+ if (v) {
1097
+ return this.http.post(this.prepareBaseAddress(v) + url, this.getHttpParamsPost(paramsClone, new FormData(), false, [], settings));
1261
1098
  }
1262
- const paramsClone = clone(params);
1263
- paramsClone[this.session.getKeyAuth()] = auth;
1264
- let options = {
1265
- params: this.getHttpParamsGet(paramsClone)
1266
- };
1267
- return this.session.getBaseUrl().pipe(mergeMap(v => {
1268
- if (v) {
1269
- return this.http.get(this.prepareBaseAddress(v) + url, options).pipe(take(1), catchError(err => {
1270
- if (!textError.length && err.error.error_description) {
1271
- textError = err.error.error_description;
1272
- }
1273
- this.snackBar.error('Ошибка: ' + textError);
1274
- return throwError(() => err);
1275
- }));
1276
- }
1277
- return throwError(() => 'get base url error');
1278
- }));
1279
- }
1280
- else {
1281
- this.snackBar.error('Error: Auth not get');
1282
- return throwError(() => 'auth not get');
1099
+ return throwError(() => 'get base url error');
1100
+ }));
1101
+ }
1102
+ else {
1103
+ return throwError(() => 'auth not get');
1104
+ }
1105
+ }
1106
+ httpGet(url, params = {}, settings = this.defSettings) {
1107
+ let auth = this.session.getAuthParams();
1108
+ if (auth) {
1109
+ if (params === null) {
1110
+ params = {};
1283
1111
  }
1284
- }));
1112
+ const paramsClone = clone(params);
1113
+ paramsClone[this.session.getKeyAuth()] = auth;
1114
+ let options = {
1115
+ params: this.getHttpParamsGet(paramsClone)
1116
+ };
1117
+ return this.session.getBaseUrl().pipe(mergeMap(v => {
1118
+ if (v) {
1119
+ return this.http.get(this.prepareBaseAddress(v) + url, options);
1120
+ }
1121
+ return throwError(() => 'get base url error');
1122
+ }));
1123
+ }
1124
+ else {
1125
+ return throwError(() => 'auth not get');
1126
+ }
1285
1127
  }
1286
1128
  getNameMethod(arr) {
1287
1129
  return arr.join('.');
@@ -1296,52 +1138,89 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1296
1138
  }]
1297
1139
  }] });
1298
1140
 
1299
- class BXRestListsElement {
1300
- constructor(http) {
1301
- this.http = http;
1302
- this.url = {
1303
- add: [$lists, $element, $add],
1304
- delete: [$lists, $element, $delete],
1305
- get: [$lists, $element, $get],
1306
- update: [$lists, $element, $update],
1307
- getFileUrl: [$lists, $element, $get, $file, $url] // Метод возвращает путь к файлу
1308
- };
1309
- }
1310
- get(pram) {
1311
- return this.http.post(this.url.get, pram, 'Не Удалось получить элемент списка');
1312
- }
1313
- customPipe() {
1314
- }
1315
- }
1316
- BXRestListsElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, deps: [{ token: HttpBXServices }], target: i0.ɵɵFactoryTarget.Injectable });
1317
- BXRestListsElement.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, providedIn: 'root' });
1318
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, decorators: [{
1319
- type: Injectable,
1320
- args: [{
1321
- providedIn: 'root'
1322
- }]
1323
- }], ctorParameters: function () { return [{ type: HttpBXServices }]; } });
1324
-
1325
- class BXRestLists {
1326
- constructor(element) {
1327
- this.element = element;
1328
- this.url = {
1329
- add: [$lists, $add],
1330
- delete: [$lists, $delete],
1331
- get: [$lists, $get],
1332
- update: [$lists, $update],
1333
- getIblockTypeId: [$lists, $get, $iblock, $type, $id], // Метод возвращает id типа инфоблока
1334
- };
1335
- }
1336
- }
1337
- BXRestLists.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestLists, deps: [{ token: BXRestListsElement }], target: i0.ɵɵFactoryTarget.Injectable });
1338
- BXRestLists.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestLists, providedIn: 'root' });
1339
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestLists, decorators: [{
1340
- type: Injectable,
1341
- args: [{
1342
- providedIn: 'root'
1343
- }]
1344
- }], ctorParameters: function () { return [{ type: BXRestListsElement }]; } });
1141
+ const $get = 'get';
1142
+ const $add = 'add';
1143
+ const $set = 'set';
1144
+ const $event = 'event';
1145
+ const $update = 'update';
1146
+ const $user = 'user';
1147
+ const $task = 'task';
1148
+ const $calendar = 'calendar';
1149
+ const $meeting = 'meeting';
1150
+ const $list = 'list';
1151
+ const $search = 'search';
1152
+ const $accessibility = 'accessibility';
1153
+ const $delete = 'delete';
1154
+ const $nearest = 'nearest';
1155
+ const $params = 'params';
1156
+ const $status = 'status';
1157
+ const $resource = 'resource';
1158
+ const $booking = 'booking';
1159
+ const $section = 'section';
1160
+ const $settings = 'settings';
1161
+ const $tasks = 'tasks';
1162
+ const $elapseditem = 'elapseditem';
1163
+ const $getlist = 'getlist';
1164
+ const $approve = 'approve';
1165
+ const $complete = 'complete';
1166
+ const $counters = 'counters';
1167
+ const $deger = 'deger';
1168
+ const $delegate = 'delegate';
1169
+ const $disapprove = 'disapprove';
1170
+ const $favorite = 'favorite';
1171
+ const $files = 'files';
1172
+ const $file = 'file';
1173
+ const $attach = 'attach';
1174
+ const $field = 'field';
1175
+ const $getFields = 'get' + $field + 's';
1176
+ const $getaccess = 'getaccess';
1177
+ const $history = 'history';
1178
+ const $pause = 'pause';
1179
+ const $renew = 'renew';
1180
+ const $start = 'start';
1181
+ const $result = 'result';
1182
+ const $planner = 'planner';
1183
+ const $disk = 'disk';
1184
+ const $rename = 'rename';
1185
+ const $markdeleted = 'markdeleted';
1186
+ const $restore = 'restore';
1187
+ const $folder = 'folder';
1188
+ const $getchildren = 'getchildren';
1189
+ const $copyto = 'copyto';
1190
+ const $moveto = 'moveto';
1191
+ const $uploadfile = 'uploadfile';
1192
+ const $storage = 'storage';
1193
+ const $getTypes = 'getTypes';
1194
+ const $stages = 'stages';
1195
+ const $getmanifest = 'getmanifest';
1196
+ const $isactionallowed = 'isactionallowed';
1197
+ const $commentitem = 'commentitem';
1198
+ const $department = 'department';
1199
+ const $sonet_group = 'sonet_group';
1200
+ const $create = 'create';
1201
+ const $feature = 'feature';
1202
+ const $access = 'access';
1203
+ const $request = 'request';
1204
+ const $socialnetwork = 'socialnetwork';
1205
+ const $api = 'api';
1206
+ const $workgroup = 'workgroup';
1207
+ const $log = 'log';
1208
+ const $blogpost = 'blogpost';
1209
+ const $lists = 'lists';
1210
+ const $iblock = 'iblock';
1211
+ const $type = 'type';
1212
+ const $id = 'id';
1213
+ const $element = 'element';
1214
+ const $url = 'url';
1215
+ const $bizproc = 'bizproc';
1216
+ const $workflow = 'workflow';
1217
+ const $instances = 'instances';
1218
+ const $terminate = '$terminate';
1219
+ const $kill = 'kill';
1220
+ const $template = 'template';
1221
+ const $activity = 'activity';
1222
+ const $robot = 'robot';
1223
+ const $send = 'send';
1345
1224
 
1346
1225
  class BaseMapServices extends BaseServices {
1347
1226
  }
@@ -1354,83 +1233,95 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1354
1233
  }]
1355
1234
  }] });
1356
1235
 
1357
- class BXRestMapListsElement extends BaseMapServices {
1358
- get(items) {
1359
- return items.map(item => Object.assign(item, {
1360
- BP_PUBLISHED: item.BP_PUBLISHED === 'Y',
1361
- CREATED_BY: this.toNum(item.CREATED_BY),
1362
- IBLOCK_ID: this.toNum(item.IBLOCK_ID),
1363
- ID: this.toNum(item.ID)
1364
- }));
1236
+ class BXRestUserMap extends BaseMapServices {
1237
+ current(user) {
1238
+ let res = Object.assign(clone(user), {
1239
+ ID: this.toNum(user.ID),
1240
+ IS_ONLINE: this.toBool(user.IS_ONLINE),
1241
+ DATE_REGISTER: this.toDate(user.DATE_REGISTER),
1242
+ PERSONAL_BIRTHDAY: this.toDate(user.PERSONAL_BIRTHDAY),
1243
+ });
1244
+ if (user.LAST_LOGIN) {
1245
+ res.LAST_LOGIN = this.toDate(user.LAST_LOGIN);
1246
+ }
1247
+ return res;
1365
1248
  }
1366
- }
1367
- BXRestMapListsElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapListsElement, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1368
- BXRestMapListsElement.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapListsElement, providedIn: 'root' });
1369
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapListsElement, decorators: [{
1370
- type: Injectable,
1371
- args: [{
1372
- providedIn: 'root'
1373
- }]
1374
- }] });
1375
-
1376
- class BXRestMapLists extends BaseMapServices {
1377
- constructor(element) {
1378
- super();
1379
- this.element = element;
1249
+ BXtoHttp(user) {
1250
+ return Object.assign(clone(user), {
1251
+ ID: this.toStr(user.ID),
1252
+ IS_ONLINE: this.toBXYorN(user.IS_ONLINE),
1253
+ DATE_REGISTER: this.getBXStrTime(user.DATE_REGISTER),
1254
+ PERSONAL_BIRTHDAY: this.toStr(user.PERSONAL_BIRTHDAY),
1255
+ LAST_LOGIN: this.toStr(user.LAST_LOGIN)
1256
+ });
1380
1257
  }
1381
- }
1382
- BXRestMapLists.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapLists, deps: [{ token: BXRestMapListsElement }], target: i0.ɵɵFactoryTarget.Injectable });
1383
- BXRestMapLists.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapLists, providedIn: 'root' });
1384
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapLists, decorators: [{
1385
- type: Injectable,
1386
- args: [{
1387
- providedIn: 'root'
1388
- }]
1389
- }], ctorParameters: function () { return [{ type: BXRestMapListsElement }]; } });
1390
-
1391
- class BXRestNavvyListsElement {
1392
- constructor(BXRestListsElement, BXRestMap) {
1393
- this.BXRestListsElement = BXRestListsElement;
1394
- this.BXRestMap = BXRestMap;
1258
+ getFIO(user) {
1259
+ let res = '';
1260
+ if (!user.LAST_NAME) {
1261
+ const SECOND_NAME = (user.SECOND_NAME) ? user.SECOND_NAME : '';
1262
+ const NAME = (user.NAME) ? user.NAME : '';
1263
+ res = NAME + ' ' + SECOND_NAME;
1264
+ }
1265
+ else if (!user.NAME) {
1266
+ res = user.LAST_NAME;
1267
+ }
1268
+ else if (!user.SECOND_NAME) {
1269
+ res = user.LAST_NAME + ' ' + user.NAME;
1270
+ }
1271
+ else {
1272
+ res = user.LAST_NAME + ' ' + user.NAME + ' ' + user.SECOND_NAME;
1273
+ }
1274
+ return res.trim();
1395
1275
  }
1396
- get(pram) {
1397
- return this.BXRestListsElement.get(pram).pipe(map(v => (v) ? this.BXRestMap.get(BXRestMapResult(v)) : undefined));
1276
+ getFI(user) {
1277
+ let res = '';
1278
+ if (!user.LAST_NAME) {
1279
+ const NAME = (user.NAME) ? user.NAME : '';
1280
+ res = NAME;
1281
+ }
1282
+ else if (!user.NAME) {
1283
+ res = user.LAST_NAME;
1284
+ }
1285
+ else {
1286
+ res = user.LAST_NAME + ' ' + user.NAME;
1287
+ }
1288
+ return res.trim();
1398
1289
  }
1399
- }
1400
- BXRestNavvyListsElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyListsElement, deps: [{ token: BXRestListsElement }, { token: BXRestMapListsElement }], target: i0.ɵɵFactoryTarget.Injectable });
1401
- BXRestNavvyListsElement.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyListsElement, providedIn: 'root' });
1402
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyListsElement, decorators: [{
1403
- type: Injectable,
1404
- args: [{
1405
- providedIn: 'root'
1406
- }]
1407
- }], ctorParameters: function () { return [{ type: BXRestListsElement }, { type: BXRestMapListsElement }]; } });
1408
-
1409
- class BXRestNavvyLists {
1410
- constructor(element) {
1411
- this.element = element;
1412
- this.url = {
1413
- add: [$lists, $add],
1414
- delete: [$lists, $delete],
1415
- get: [$lists, $get],
1416
- update: [$lists, $update],
1417
- getIblockTypeId: [$lists, $get, $iblock, $type, $id], // Метод возвращает id типа инфоблока
1418
- };
1290
+ getFIOShort(user) {
1291
+ let res = '';
1292
+ if (!user.LAST_NAME) {
1293
+ const SECOND_NAME = (user.SECOND_NAME) ? user.SECOND_NAME : '';
1294
+ const NAME = (user.NAME) ? user.NAME : '';
1295
+ res = NAME + ' ' + SECOND_NAME;
1296
+ }
1297
+ else if (!user.NAME) {
1298
+ res = user.LAST_NAME;
1299
+ }
1300
+ else if (!user.SECOND_NAME) {
1301
+ res = user.LAST_NAME + ' ' + user.NAME.charAt(0).toUpperCase() + '.';
1302
+ }
1303
+ else {
1304
+ res =
1305
+ user.LAST_NAME + ' ' +
1306
+ user.NAME.charAt(0).toUpperCase() + '.' +
1307
+ user.SECOND_NAME.charAt(0).toUpperCase() + '.';
1308
+ }
1309
+ return res.trim();
1419
1310
  }
1420
1311
  }
1421
- BXRestNavvyLists.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyLists, deps: [{ token: BXRestNavvyListsElement }], target: i0.ɵɵFactoryTarget.Injectable });
1422
- BXRestNavvyLists.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyLists, providedIn: 'root' });
1423
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyLists, decorators: [{
1312
+ BXRestUserMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUserMap, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1313
+ BXRestUserMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUserMap, providedIn: 'root' });
1314
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUserMap, decorators: [{
1424
1315
  type: Injectable,
1425
1316
  args: [{
1426
1317
  providedIn: 'root'
1427
1318
  }]
1428
- }], ctorParameters: function () { return [{ type: BXRestNavvyListsElement }]; } });
1319
+ }] });
1429
1320
 
1430
1321
  class BXRestUser {
1431
- constructor(http, snackBar) {
1322
+ constructor(http, BXRestUserMap) {
1432
1323
  this.http = http;
1433
- this.snackBar = snackBar;
1324
+ this.BXRestUserMap = BXRestUserMap;
1434
1325
  this.url = {
1435
1326
  admin: [$user, 'admin'],
1436
1327
  get: [$user, $get],
@@ -1456,64 +1347,31 @@ class BXRestUser {
1456
1347
  get(params = {}) {
1457
1348
  let copyParams = clone(params);
1458
1349
  this.setDefParam(copyParams);
1459
- return this.http.post(this.url.get, copyParams, 'Не удалось получить пользователей');
1460
- // .pipe(
1461
- // tap(v => {
1462
- // if (v && v.result) {
1463
- // this.saveArrUser(v.result)
1464
- // }
1465
- // })
1466
- // )
1350
+ return this.http.post(this.url.get, copyParams);
1467
1351
  }
1468
1352
  current() {
1469
- return this.http.get(this.url.current, {}, 'Не удалось получить пользователя');
1353
+ return this.http.get(this.url.current, {});
1470
1354
  }
1471
- access(access, textError = 'Не удалось получить права') {
1472
- return this.http.get(this.url.access, { ACCESS: access }, textError);
1355
+ update(user, fieldUpdate) {
1356
+ if (fieldUpdate && fieldUpdate.length) {
1357
+ let sendData = {
1358
+ ID: user.ID,
1359
+ };
1360
+ const userBX = this.BXRestUserMap.BXtoHttp(user);
1361
+ for (const field of fieldUpdate) {
1362
+ if (userBX[field]) {
1363
+ sendData[field] = userBX[field];
1364
+ }
1365
+ else {
1366
+ return throwError(() => 'One sent field is empty');
1367
+ }
1368
+ }
1369
+ return this.http.post(this.url.update, sendData);
1370
+ }
1371
+ else {
1372
+ return throwError(() => 'All sent field for edit is empty');
1373
+ }
1473
1374
  }
1474
- // getAll(params: iBXGetParam = {}): Observable<iBXRestUser [] | undefined> {
1475
- // if (!Object.keys(params).length) {
1476
- // params = clone(this.def.params)
1477
- // }
1478
- //
1479
- // const saveAllUser = compare(params, this.def.params)
1480
- // return this.user$.pipe(
1481
- // take(1),
1482
- // mergeMap(v => {
1483
- // if (v.load.all) {
1484
- // if (compare(this.def.params, params)) {
1485
- // return of(clone(v.data))
1486
- // }
1487
- // }
1488
- //
1489
- // return this.getEndArray(params).pipe(
1490
- // take(1),
1491
- // map(v => {
1492
- // if (v && v.result) {
1493
- // let cl = clone(v.result)
1494
- // return this.saveArrUser(cl)
1495
- // }
1496
- // return undefined
1497
- // }),
1498
- // )
1499
- // }),
1500
- // tap(v => {
1501
- // if (v && v.length && saveAllUser) {
1502
- // this.store.dispatch(loadAll({load: true}))
1503
- // }
1504
- // params.start = this.def.params.start
1505
- // })
1506
- // )
1507
- // }
1508
- // private saveArrUser(users: iBXRestUserHttp[]) {
1509
- // let result: iBXRestUser [] = []
1510
- // for (const user of users) {
1511
- // result.push(this.userMap.HttpToBX(user))
1512
- // }
1513
- // this.store.dispatch(saveArr({arr: result}))
1514
- //
1515
- // return result
1516
- // }
1517
1375
  search(params) {
1518
1376
  if (typeof params === 'string') {
1519
1377
  params = { FIND: params };
@@ -1521,75 +1379,90 @@ class BXRestUser {
1521
1379
  if (typeof params.ACTIVE !== 'boolean') {
1522
1380
  params.ACTIVE = true;
1523
1381
  }
1524
- return this.http.get(this.url.search, params, 'Сервер не отвечает на запрос поиска');
1382
+ return this.http.get(this.url.search, params);
1383
+ }
1384
+ access(access) {
1385
+ return this.http.get(this.url.access, { ACCESS: access });
1525
1386
  }
1526
1387
  fields() {
1527
1388
  return this.http.get(this.url.fields);
1528
1389
  }
1529
- update(user, fieldUpdate) {
1530
- if (fieldUpdate && fieldUpdate.length) {
1531
- let sendData = {
1532
- ID: user.ID,
1533
- };
1534
- // const userBX = this.userMap.BXtoHttp(user)
1535
- // for (const field of fieldUpdate) {
1536
- // if (userBX[field]) {
1537
- // sendData[field] = userBX[field]
1538
- // } else {
1539
- // this.snackBar.error('Одно из указанных полей отправлено не верно')
1540
- // }
1541
- // }
1542
- return this.http.post(this.url.update, sendData, 'Не удалось обновить пользователя с ID' + user.ID);
1543
- }
1544
- else {
1545
- this.snackBar.error('Не указано ни одно поле для редактирования пользователя');
1546
- return of({});
1547
- }
1548
- }
1549
- // getEndArray(params: UserFilter = {}): Observable<iHttpAnswerBX<iBXRestUserHttp[]> | undefined> {
1550
- // return this.get(params).pipe(
1551
- // mergeMap(items => {
1552
- // if (items && items.result && typeof items.result === 'object') {
1553
- // if (items.next) {
1554
- // params.start = items.next
1555
- // return this.getEndArray(params).pipe(map(vEnd => {
1556
- // if (vEnd && items.result && vEnd.result) {
1557
- // return {result: [...items.result, ...vEnd.result]}
1558
- // }
1559
- // return (items) ? items : undefined
1560
- // }))
1561
- // }
1562
- // return of(items)
1563
- // } else {
1564
- // return of(undefined)
1565
- // }
1566
- // }),
1567
- // )
1568
- // }
1569
1390
  setDefParam(params) {
1391
+ if (!params.FILTER) {
1392
+ params.FILTER = {};
1393
+ }
1570
1394
  if (!params.hasOwnProperty('ACTIVE')) {
1571
- params.ACTIVE = this.def.params.ACTIVE;
1395
+ params.FILTER.ACTIVE = this.def.params.ACTIVE;
1572
1396
  }
1573
- if (params.ACTIVE && params.ACTIVE === 2) {
1574
- delete params.ACTIVE;
1397
+ if (params.FILTER.ACTIVE && params.FILTER.ACTIVE === 2) {
1398
+ delete params.FILTER.ACTIVE;
1575
1399
  }
1576
1400
  if (!params.hasOwnProperty('start')) {
1577
1401
  params.start = this.def.params.start;
1578
1402
  }
1579
- if (params.UF_DEPARTMENT && !params.UF_DEPARTMENT.length) {
1580
- delete params.UF_DEPARTMENT;
1403
+ if (params.FILTER.UF_DEPARTMENT && !params.FILTER.UF_DEPARTMENT.length) {
1404
+ delete params.FILTER.UF_DEPARTMENT;
1581
1405
  }
1582
1406
  }
1583
1407
  }
1584
- BXRestUser.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUser, deps: [{ token: HttpBXServices }, { token: SnackBarService }], target: i0.ɵɵFactoryTarget.Injectable });
1408
+ BXRestUser.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUser, deps: [{ token: HttpBXServices }, { token: BXRestUserMap }], target: i0.ɵɵFactoryTarget.Injectable });
1585
1409
  BXRestUser.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUser, providedIn: 'root' });
1586
1410
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUser, decorators: [{
1587
1411
  type: Injectable,
1588
1412
  args: [{
1589
1413
  providedIn: 'root'
1590
1414
  }]
1591
- }], ctorParameters: function () { return [{ type: HttpBXServices }, { type: SnackBarService }]; } });
1415
+ }], ctorParameters: function () { return [{ type: HttpBXServices }, { type: BXRestUserMap }]; } });
1416
+
1417
+ class BXRestListsElement {
1418
+ constructor(http) {
1419
+ this.http = http;
1420
+ this.url = {
1421
+ add: [$lists, $element, $add],
1422
+ delete: [$lists, $element, $delete],
1423
+ get: [$lists, $element, $get],
1424
+ update: [$lists, $element, $update],
1425
+ getFileUrl: [$lists, $element, $get, $file, $url] // Метод возвращает путь к файлу // TODO: Реализовать
1426
+ };
1427
+ }
1428
+ get(pram) {
1429
+ return this.http.post(this.url.get, pram);
1430
+ }
1431
+ add(param) {
1432
+ return this.http.post(this.url.add, param);
1433
+ }
1434
+ }
1435
+ BXRestListsElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, deps: [{ token: HttpBXServices }], target: i0.ɵɵFactoryTarget.Injectable });
1436
+ BXRestListsElement.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, providedIn: 'root' });
1437
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, decorators: [{
1438
+ type: Injectable,
1439
+ args: [{
1440
+ providedIn: 'root'
1441
+ }]
1442
+ }], ctorParameters: function () { return [{ type: HttpBXServices }]; } });
1443
+
1444
+ class BXRestLists {
1445
+ constructor(element) {
1446
+ this.element = element;
1447
+ this.url = {
1448
+ add: [$lists, $add],
1449
+ delete: [$lists, $delete],
1450
+ get: [$lists, $get],
1451
+ update: [$lists, $update],
1452
+ getIblockTypeId: [$lists, $get, $iblock, $type, $id], // Метод возвращает id типа инфоблока
1453
+ };
1454
+ }
1455
+ }
1456
+ BXRestLists.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestLists, deps: [{ token: BXRestListsElement }], target: i0.ɵɵFactoryTarget.Injectable });
1457
+ BXRestLists.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestLists, providedIn: 'root' });
1458
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestLists, decorators: [{
1459
+ type: Injectable,
1460
+ args: [{
1461
+ providedIn: 'root'
1462
+ }]
1463
+ }], ctorParameters: function () { return [{ type: BXRestListsElement }]; } });
1592
1464
 
1465
+ // import { AnswerApiTaskBX } from '../../typification/rest/task/answers/task';
1593
1466
  class BXRestTasksTask {
1594
1467
  constructor(http) {
1595
1468
  this.http = http;
@@ -1637,6 +1510,38 @@ class BXRestTasksTask {
1637
1510
  add(param) {
1638
1511
  return this.http.post(this.url.add, param);
1639
1512
  }
1513
+ /*
1514
+ update(taskId: number, updateFields: iBXRestTaskFieldsName[], task: iBXRestTask) {
1515
+ let sendTask: Record<string, any> = {}
1516
+ let taskTS: Record<string, any> = task
1517
+ if (updateFields.length) {
1518
+ for (let updateField of updateFields) {
1519
+ if (taskTS[camelCase(updateField)]) {
1520
+ sendTask[updateField] = taskTS[camelCase(updateField)]
1521
+ }
1522
+ }
1523
+ if (Object.values(sendTask).length) {
1524
+ return this.http.post(
1525
+ this.url.update,
1526
+ {taskId: taskId, fields: sendTask},
1527
+ 'error to update task')
1528
+ } else {
1529
+ this.snackBar.error('not valid send data task')
1530
+ console.error('not valid send data task', sendTask, task)
1531
+ return of(undefined)
1532
+ }
1533
+ }
1534
+
1535
+ this.snackBar.warning('not have field for update')
1536
+ return of(undefined)
1537
+ }
1538
+ */
1539
+ get(requestArray) {
1540
+ return this.http.post(this.url.get, requestArray);
1541
+ }
1542
+ list(param = {}) {
1543
+ return this.http.post(this.url.list, param);
1544
+ }
1640
1545
  }
1641
1546
  BXRestTasksTask.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTasksTask, deps: [{ token: HttpBXServices }], target: i0.ɵɵFactoryTarget.Injectable });
1642
1547
  BXRestTasksTask.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTasksTask, providedIn: 'root' });
@@ -1680,10 +1585,10 @@ class BXRestDiskFile {
1680
1585
  };
1681
1586
  }
1682
1587
  get(id) {
1683
- return this.http.post(this.url.get, { id: id }, 'Не удалось получить файл');
1588
+ return this.http.post(this.url.get, { id: id });
1684
1589
  }
1685
1590
  markDel(id) {
1686
- return this.http.post(this.url.markdeleted, { id: id }, 'Не удалось переместить файл в корзину');
1591
+ return this.http.post(this.url.markdeleted, { id: id });
1687
1592
  }
1688
1593
  }
1689
1594
  BXRestDiskFile.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskFile, deps: [{ token: HttpBXServices }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -1725,228 +1630,328 @@ class BXRestDiskFolder {
1725
1630
  });
1726
1631
  }
1727
1632
  getchildren(id) {
1728
- return this.http.post(this.url.getchildren, { id: id }, 'get folders and files');
1633
+ return this.http.post(this.url.getchildren, { id: id });
1634
+ }
1635
+ }
1636
+ BXRestDiskFolder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskFolder, deps: [{ token: HttpBXServices }], target: i0.ɵɵFactoryTarget.Injectable });
1637
+ BXRestDiskFolder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskFolder, providedIn: 'root' });
1638
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskFolder, decorators: [{
1639
+ type: Injectable,
1640
+ args: [{
1641
+ providedIn: 'root'
1642
+ }]
1643
+ }], ctorParameters: function () { return [{ type: HttpBXServices }]; } });
1644
+
1645
+ class BXRestDisk {
1646
+ constructor(file, folder) {
1647
+ this.file = file;
1648
+ this.folder = folder;
1649
+ }
1650
+ }
1651
+ BXRestDisk.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDisk, deps: [{ token: BXRestDiskFile }, { token: BXRestDiskFolder }], target: i0.ɵɵFactoryTarget.Injectable });
1652
+ BXRestDisk.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDisk, providedIn: 'root' });
1653
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDisk, decorators: [{
1654
+ type: Injectable,
1655
+ args: [{
1656
+ providedIn: 'root'
1657
+ }]
1658
+ }], ctorParameters: function () { return [{ type: BXRestDiskFile }, { type: BXRestDiskFolder }]; } });
1659
+
1660
+ class BXRestBizprocWorkflowInstance {
1661
+ constructor() {
1662
+ this.url = {
1663
+ list: [$bizproc, $workflow, $instances, $list], // Возвращает список запущенных бизнес-процессов. Алиас bizproc.workflow.instances
1664
+ };
1665
+ }
1666
+ }
1667
+ BXRestBizprocWorkflowInstance.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocWorkflowInstance, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1668
+ BXRestBizprocWorkflowInstance.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocWorkflowInstance, providedIn: 'root' });
1669
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocWorkflowInstance, decorators: [{
1670
+ type: Injectable,
1671
+ args: [{
1672
+ providedIn: 'root'
1673
+ }]
1674
+ }] });
1675
+
1676
+ class BXRestBizprocWorkflowTemplate {
1677
+ constructor(http) {
1678
+ this.http = http;
1679
+ this.url = {
1680
+ add: [$bizproc, $workflow, $template, $add],
1681
+ delete: [$bizproc, $workflow, $template, $delete],
1682
+ update: [$bizproc, $workflow, $template, $update],
1683
+ list: [$bizproc, $workflow, $template, $list] // Возвращает список шаблонов Бизнес-процессов, установленных на сайте
1684
+ };
1685
+ }
1686
+ list(param = { select: [], filter: {} }) {
1687
+ return this.http.post(this.url.list, param);
1688
+ }
1689
+ }
1690
+ BXRestBizprocWorkflowTemplate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocWorkflowTemplate, deps: [{ token: HttpBXServices }], target: i0.ɵɵFactoryTarget.Injectable });
1691
+ BXRestBizprocWorkflowTemplate.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocWorkflowTemplate, providedIn: 'root' });
1692
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocWorkflowTemplate, decorators: [{
1693
+ type: Injectable,
1694
+ args: [{
1695
+ providedIn: 'root'
1696
+ }]
1697
+ }], ctorParameters: function () { return [{ type: HttpBXServices }]; } });
1698
+
1699
+ class BXRestBizprocWorkflow {
1700
+ constructor(instances, template, http) {
1701
+ this.instances = instances;
1702
+ this.template = template;
1703
+ this.http = http;
1704
+ this.url = {
1705
+ instances: [$bizproc, $workflow, $instances],
1706
+ terminate: [$bizproc, $workflow, $terminate],
1707
+ start: [$bizproc, $workflow, $start],
1708
+ kill: [$bizproc, $workflow, $kill], // Удаляет запущенный бизнес-процесс // TODO: реализовать
1709
+ };
1710
+ }
1711
+ start(param) {
1712
+ return this.http.post(this.url.start, param);
1713
+ }
1714
+ }
1715
+ BXRestBizprocWorkflow.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocWorkflow, deps: [{ token: BXRestBizprocWorkflowInstance }, { token: BXRestBizprocWorkflowTemplate }, { token: HttpBXServices }], target: i0.ɵɵFactoryTarget.Injectable });
1716
+ BXRestBizprocWorkflow.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocWorkflow, providedIn: 'root' });
1717
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocWorkflow, decorators: [{
1718
+ type: Injectable,
1719
+ args: [{
1720
+ providedIn: 'root'
1721
+ }]
1722
+ }], ctorParameters: function () { return [{ type: BXRestBizprocWorkflowInstance }, { type: BXRestBizprocWorkflowTemplate }, { type: HttpBXServices }]; } });
1723
+
1724
+ class BXRestBizprocActivity {
1725
+ constructor() {
1726
+ this.url = {
1727
+ add: [$bizproc, $activity, $add],
1728
+ delete: [$bizproc, $activity, $delete],
1729
+ list: [$bizproc, $activity, $list],
1730
+ update: [$bizproc, $activity, $update],
1731
+ log: [$bizproc, $activity, $log] // Записывает информацию в лог бизнес-процесса
1732
+ };
1733
+ }
1734
+ }
1735
+ BXRestBizprocActivity.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocActivity, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1736
+ BXRestBizprocActivity.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocActivity, providedIn: 'root' });
1737
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocActivity, decorators: [{
1738
+ type: Injectable,
1739
+ args: [{
1740
+ providedIn: 'root'
1741
+ }]
1742
+ }] });
1743
+
1744
+ class BXRestBizprocTask {
1745
+ constructor() {
1746
+ this.url = {
1747
+ complete: [$bizproc, $task, $complete],
1748
+ list: [$bizproc, $task, $list], // Возвращает список заданий бизнес-процессов
1749
+ };
1729
1750
  }
1730
1751
  }
1731
- BXRestDiskFolder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskFolder, deps: [{ token: HttpBXServices }], target: i0.ɵɵFactoryTarget.Injectable });
1732
- BXRestDiskFolder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskFolder, providedIn: 'root' });
1733
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskFolder, decorators: [{
1752
+ BXRestBizprocTask.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocTask, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1753
+ BXRestBizprocTask.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocTask, providedIn: 'root' });
1754
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocTask, decorators: [{
1734
1755
  type: Injectable,
1735
1756
  args: [{
1736
1757
  providedIn: 'root'
1737
1758
  }]
1738
- }], ctorParameters: function () { return [{ type: HttpBXServices }]; } });
1759
+ }] });
1739
1760
 
1740
- class BXRestDisk {
1741
- constructor(file, folder) {
1742
- this.file = file;
1743
- this.folder = folder;
1761
+ class BXRestBizprocRobot {
1762
+ constructor() {
1763
+ this.url = {
1764
+ add: [$bizproc, $robot, $add],
1765
+ delete: [$bizproc, $robot, $delete],
1766
+ list: [$bizproc, $robot, $list],
1767
+ update: [$bizproc, $robot, $update] // Обновляет поля робота
1768
+ };
1744
1769
  }
1745
1770
  }
1746
- BXRestDisk.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDisk, deps: [{ token: BXRestDiskFile }, { token: BXRestDiskFolder }], target: i0.ɵɵFactoryTarget.Injectable });
1747
- BXRestDisk.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDisk, providedIn: 'root' });
1748
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDisk, decorators: [{
1771
+ BXRestBizprocRobot.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocRobot, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1772
+ BXRestBizprocRobot.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocRobot, providedIn: 'root' });
1773
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocRobot, decorators: [{
1749
1774
  type: Injectable,
1750
1775
  args: [{
1751
1776
  providedIn: 'root'
1752
1777
  }]
1753
- }], ctorParameters: function () { return [{ type: BXRestDiskFile }, { type: BXRestDiskFolder }]; } });
1778
+ }] });
1754
1779
 
1755
- const save = createAction('[Users Component] Save', props());
1756
- const saveArr = createAction('[Users Component] Save Arr', props());
1757
- const update = createAction('[Users Component] Update', props());
1758
- const loadAll = createAction('[Users Component] loadAll', props());
1759
- const saveSelf = createAction('[Users Component] saveSelf', props());
1760
- const saveIDLoadedDepartment = createAction('[Users Component] saveIDLoadedDepartment', props());
1761
- const initialState = {
1762
- load: {
1763
- all: false,
1764
- department: []
1765
- },
1766
- self: undefined,
1767
- data: []
1768
- };
1769
- const _usersReducer = createReducer(initialState, on(saveIDLoadedDepartment, (s, data) => {
1770
- let copy = clone(s);
1771
- copy.load.department = [...copy.load.department, ...data.id];
1772
- return copy;
1773
- }), on(save, (s, data) => {
1774
- const find = s.data.find(v => v.ID === data.ID);
1775
- if (!find) {
1776
- const copy = clone(s);
1777
- copy.data.push(data);
1778
- return copy;
1779
- }
1780
- return s;
1781
- }), on(saveArr, (s, data) => {
1782
- const copy = clone(s);
1783
- if (copy.data && copy.data.length) {
1784
- for (const user of data.arr) {
1785
- const find = copy.data.find(v => v.ID === user.ID);
1786
- if (!find) {
1787
- copy.data.push(user);
1788
- }
1789
- }
1780
+ class BXRestBizprocEvent {
1781
+ constructor() {
1782
+ this.url = {
1783
+ send: [$bizproc, $event, $send], // Возвращает действию выходные параметры, заданные в описании действия
1784
+ };
1790
1785
  }
1791
- else {
1792
- copy.data = [...data.arr];
1793
- }
1794
- return copy;
1795
- }), on(update, (s, data) => {
1796
- const copy = clone(s);
1797
- let find = copy.data.findIndex(v => v.ID === data.ID);
1798
- if (find !== -1) {
1799
- const copy = clone(s);
1800
- copy.data.splice(find, 1, data);
1801
- // copy.data.push(data)
1802
- return copy;
1803
- }
1804
- return s;
1805
- }), on(loadAll, (s, data) => {
1806
- if (data.load !== s.load.all) {
1807
- const copy = clone(s);
1808
- copy.load.all = data.load;
1809
- return copy;
1810
- }
1811
- return s;
1812
- }), on(saveSelf, (s, data) => {
1813
- return { ...s, self: data.self };
1814
- }));
1815
- function usersReducer(state = initialState, action) {
1816
- return _usersReducer(state, action);
1817
- }
1786
+ }
1787
+ BXRestBizprocEvent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocEvent, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1788
+ BXRestBizprocEvent.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocEvent, providedIn: 'root' });
1789
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizprocEvent, decorators: [{
1790
+ type: Injectable,
1791
+ args: [{
1792
+ providedIn: 'root'
1793
+ }]
1794
+ }] });
1818
1795
 
1819
- class BXRestUserMap extends BaseMapServices {
1820
- current(user) {
1821
- let res = Object.assign(clone(user), {
1822
- ID: this.toNum(user.ID),
1823
- IS_ONLINE: this.toBool(user.IS_ONLINE),
1824
- DATE_REGISTER: this.toDate(user.DATE_REGISTER),
1825
- PERSONAL_BIRTHDAY: this.toDate(user.PERSONAL_BIRTHDAY),
1826
- });
1827
- if (user.LAST_LOGIN) {
1828
- res.LAST_LOGIN = this.toDate(user.LAST_LOGIN);
1829
- }
1830
- return res;
1831
- }
1832
- BXtoHttp(user) {
1833
- return Object.assign(clone(user), {
1834
- ID: this.toStr(user.ID),
1835
- IS_ONLINE: this.toBXYorN(user.IS_ONLINE),
1836
- DATE_REGISTER: this.getBXStrTime(user.DATE_REGISTER),
1837
- PERSONAL_BIRTHDAY: this.toStr(user.PERSONAL_BIRTHDAY),
1838
- LAST_LOGIN: this.toStr(user.LAST_LOGIN)
1839
- });
1840
- }
1841
- getFIO(user) {
1842
- let res = '';
1843
- if (!user.LAST_NAME) {
1844
- const SECOND_NAME = (user.SECOND_NAME) ? user.SECOND_NAME : '';
1845
- const NAME = (user.NAME) ? user.NAME : '';
1846
- res = NAME + ' ' + SECOND_NAME;
1847
- }
1848
- else if (!user.NAME) {
1849
- res = user.LAST_NAME;
1850
- }
1851
- else if (!user.SECOND_NAME) {
1852
- res = user.LAST_NAME + ' ' + user.NAME;
1853
- }
1854
- else {
1855
- res = user.LAST_NAME + ' ' + user.NAME + ' ' + user.SECOND_NAME;
1856
- }
1857
- return res.trim();
1796
+ class BXRestBizproc {
1797
+ constructor(workflow, activity, task, robot, event) {
1798
+ this.workflow = workflow;
1799
+ this.activity = activity;
1800
+ this.task = task;
1801
+ this.robot = robot;
1802
+ this.event = event;
1858
1803
  }
1859
- getFI(user) {
1860
- let res = '';
1861
- if (!user.LAST_NAME) {
1862
- const NAME = (user.NAME) ? user.NAME : '';
1863
- res = NAME;
1864
- }
1865
- else if (!user.NAME) {
1866
- res = user.LAST_NAME;
1867
- }
1868
- else {
1869
- res = user.LAST_NAME + ' ' + user.NAME;
1870
- }
1871
- return res.trim();
1804
+ }
1805
+ BXRestBizproc.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizproc, deps: [{ token: BXRestBizprocWorkflow }, { token: BXRestBizprocActivity }, { token: BXRestBizprocTask }, { token: BXRestBizprocRobot }, { token: BXRestBizprocEvent }], target: i0.ɵɵFactoryTarget.Injectable });
1806
+ BXRestBizproc.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizproc, providedIn: 'root' });
1807
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestBizproc, decorators: [{
1808
+ type: Injectable,
1809
+ args: [{
1810
+ providedIn: 'root'
1811
+ }]
1812
+ }], ctorParameters: function () { return [{ type: BXRestBizprocWorkflow }, { type: BXRestBizprocActivity }, { type: BXRestBizprocTask }, { type: BXRestBizprocRobot }, { type: BXRestBizprocEvent }]; } });
1813
+
1814
+ class Navvy {
1815
+ constructor(snackBar) {
1816
+ this.snackBar = snackBar;
1872
1817
  }
1873
- getFIOShort(user) {
1874
- let res = '';
1875
- if (!user.LAST_NAME) {
1876
- const SECOND_NAME = (user.SECOND_NAME) ? user.SECOND_NAME : '';
1877
- const NAME = (user.NAME) ? user.NAME : '';
1878
- res = NAME + ' ' + SECOND_NAME;
1879
- }
1880
- else if (!user.NAME) {
1881
- res = user.LAST_NAME;
1882
- }
1883
- else if (!user.SECOND_NAME) {
1884
- res = user.LAST_NAME + ' ' + user.NAME.charAt(0).toUpperCase() + '.';
1885
- }
1886
- else {
1887
- res =
1888
- user.LAST_NAME + ' ' +
1889
- user.NAME.charAt(0).toUpperCase() + '.' +
1890
- user.SECOND_NAME.charAt(0).toUpperCase() + '.';
1891
- }
1892
- return res.trim();
1818
+ mapAndSnackBarError(request, errorText) {
1819
+ return request.pipe(map(v => BXRestMapResult(v)), catchError(err => {
1820
+ this.snackBar.error(errorText);
1821
+ return throwError(() => err);
1822
+ }));
1893
1823
  }
1894
1824
  }
1895
- BXRestUserMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUserMap, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1896
- BXRestUserMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUserMap, providedIn: 'root' });
1897
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUserMap, decorators: [{
1825
+ Navvy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: Navvy, deps: [{ token: SnackBarService }], target: i0.ɵɵFactoryTarget.Injectable });
1826
+ Navvy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: Navvy, providedIn: 'root' });
1827
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: Navvy, decorators: [{
1898
1828
  type: Injectable,
1899
1829
  args: [{
1900
1830
  providedIn: 'root'
1901
1831
  }]
1902
- }] });
1832
+ }], ctorParameters: function () { return [{ type: SnackBarService }]; } });
1903
1833
 
1904
1834
  class BXRestNavvyUser {
1905
- constructor(BXRestUser, store, BXRestUserMap) {
1835
+ constructor(BXRestUser, BXRestUserMap, Navvy) {
1906
1836
  this.BXRestUser = BXRestUser;
1907
- this.store = store;
1908
1837
  this.BXRestUserMap = BXRestUserMap;
1909
- this.user$ = this.store.select('users');
1838
+ this.Navvy = Navvy;
1839
+ }
1840
+ get(params = {}) {
1841
+ return this.Navvy.mapAndSnackBarError(this.BXRestUser.get(params), 'Не удалось получить пользователей');
1910
1842
  }
1911
1843
  current(update = false) {
1912
1844
  if (update) {
1913
1845
  return this.self();
1914
1846
  }
1915
1847
  else {
1916
- return this.user$.pipe(mergeMap$1(v => {
1917
- if (v && v.self) {
1918
- return of(v.self);
1919
- }
1920
- else {
1921
- return this.self();
1922
- }
1923
- }), first());
1848
+ let self = SessionStorage.getItem(this.constructor.name + this.self.name);
1849
+ if (self) {
1850
+ return of(self);
1851
+ }
1852
+ return this.self();
1924
1853
  }
1925
1854
  }
1855
+ update(user, fieldUpdate) {
1856
+ return this.Navvy.mapAndSnackBarError(this.BXRestUser.update(user, fieldUpdate), 'Не удалось обновить пользователя с ID' + user.ID);
1857
+ }
1926
1858
  self() {
1927
- return this.BXRestUser.current()
1859
+ return this.Navvy.mapAndSnackBarError(this.BXRestUser.current(), 'Не удалось получить пользователя')
1928
1860
  .pipe(map(v => {
1929
- if (v && v.result) {
1930
- return this.BXRestUserMap.current(v.result);
1861
+ if (v) {
1862
+ return this.BXRestUserMap.current(v);
1931
1863
  }
1932
1864
  return undefined;
1933
1865
  }), tap(v => {
1934
1866
  if (v) {
1935
- this.store.dispatch(saveSelf({ self: v }));
1867
+ SessionStorage.setItem(this.constructor.name + this.self.name, v);
1936
1868
  }
1937
1869
  }));
1938
1870
  }
1871
+ search(params) {
1872
+ return this.Navvy.mapAndSnackBarError(this.BXRestUser.search(params), 'Сервер не отвечает на запрос поиска');
1873
+ }
1874
+ access(access) {
1875
+ return this.Navvy.mapAndSnackBarError(this.BXRestUser.access(access), 'Не удалось получить права');
1876
+ }
1877
+ fields() {
1878
+ return this.Navvy.mapAndSnackBarError(this.BXRestUser.fields(), 'Не удалось поля');
1879
+ }
1939
1880
  }
1940
- BXRestNavvyUser.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyUser, deps: [{ token: BXRestUser }, { token: i1$2.Store }, { token: BXRestUserMap }], target: i0.ɵɵFactoryTarget.Injectable });
1881
+ BXRestNavvyUser.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyUser, deps: [{ token: BXRestUser }, { token: BXRestUserMap }, { token: Navvy }], target: i0.ɵɵFactoryTarget.Injectable });
1941
1882
  BXRestNavvyUser.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyUser, providedIn: 'root' });
1942
1883
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyUser, decorators: [{
1943
1884
  type: Injectable,
1944
1885
  args: [{
1945
1886
  providedIn: 'root'
1946
1887
  }]
1947
- }], ctorParameters: function () { return [{ type: BXRestUser }, { type: i1$2.Store }, { type: BXRestUserMap }]; } });
1888
+ }], ctorParameters: function () { return [{ type: BXRestUser }, { type: BXRestUserMap }, { type: Navvy }]; } });
1889
+
1890
+ class BXRestMapListsElement extends BaseMapServices {
1891
+ get(items) {
1892
+ return items.map(item => Object.assign(item, {
1893
+ BP_PUBLISHED: item.BP_PUBLISHED === 'Y',
1894
+ CREATED_BY: this.toNum(item.CREATED_BY),
1895
+ IBLOCK_ID: this.toNum(item.IBLOCK_ID),
1896
+ ID: this.toNum(item.ID)
1897
+ }));
1898
+ }
1899
+ }
1900
+ BXRestMapListsElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapListsElement, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1901
+ BXRestMapListsElement.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapListsElement, providedIn: 'root' });
1902
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapListsElement, decorators: [{
1903
+ type: Injectable,
1904
+ args: [{
1905
+ providedIn: 'root'
1906
+ }]
1907
+ }] });
1908
+
1909
+ class BXRestNavvyListsElement {
1910
+ constructor(BXRestListsElement, BXRestMap, Navvy) {
1911
+ this.BXRestListsElement = BXRestListsElement;
1912
+ this.BXRestMap = BXRestMap;
1913
+ this.Navvy = Navvy;
1914
+ }
1915
+ get(param) {
1916
+ return this.Navvy.mapAndSnackBarError(this.BXRestListsElement.get(param), 'Не удалось получить элемент списка').pipe(map(v => (v) ? this.BXRestMap.get(v) : undefined));
1917
+ }
1918
+ add(param) {
1919
+ return this.Navvy.mapAndSnackBarError(this.BXRestListsElement.add(param), 'Не удалось получить элемент списка');
1920
+ }
1921
+ }
1922
+ BXRestNavvyListsElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyListsElement, deps: [{ token: BXRestListsElement }, { token: BXRestMapListsElement }, { token: Navvy }], target: i0.ɵɵFactoryTarget.Injectable });
1923
+ BXRestNavvyListsElement.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyListsElement, providedIn: 'root' });
1924
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyListsElement, decorators: [{
1925
+ type: Injectable,
1926
+ args: [{
1927
+ providedIn: 'root'
1928
+ }]
1929
+ }], ctorParameters: function () { return [{ type: BXRestListsElement }, { type: BXRestMapListsElement }, { type: Navvy }]; } });
1930
+
1931
+ class BXRestNavvyLists {
1932
+ constructor(element) {
1933
+ this.element = element;
1934
+ }
1935
+ }
1936
+ BXRestNavvyLists.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyLists, deps: [{ token: BXRestNavvyListsElement }], target: i0.ɵɵFactoryTarget.Injectable });
1937
+ BXRestNavvyLists.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyLists, providedIn: 'root' });
1938
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyLists, decorators: [{
1939
+ type: Injectable,
1940
+ args: [{
1941
+ providedIn: 'root'
1942
+ }]
1943
+ }], ctorParameters: function () { return [{ type: BXRestNavvyListsElement }]; } });
1948
1944
 
1949
1945
  class BXRestTaskMap extends BaseMapServices {
1946
+ add(item) {
1947
+ return this.TaskBXHttpToTaskBX(item);
1948
+ }
1949
+ get(item) {
1950
+ return this.TaskBXHttpToTaskBX(item);
1951
+ }
1952
+ list(item) {
1953
+ return item.map(i => this.TaskBXHttpToTaskBX(i));
1954
+ }
1950
1955
  TaskBXHttpToTaskBX(item) {
1951
1956
  let result = {};
1952
1957
  if (item.id) {
@@ -2063,23 +2068,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2063
2068
  // next: number
2064
2069
  // }
2065
2070
  class BXRestNavvyTasksTask {
2066
- // pageSize = 50
2067
- // nowLoad$ = new ReplaySubject<TimeProcess>(1)
2068
- // def: { select: iBXRestTaskFieldsName[] } = {
2069
- // select: ['ID', 'PARENT_ID', 'TITLE', 'DESCRIPTION', 'MARK', 'PRIORITY', 'STATUS', 'MULTITASK',
2070
- // 'GROUP_ID', 'STAGE_ID', 'CREATED_BY', 'CREATED_DATE', 'RESPONSIBLE_ID', 'ACCOMPLICES', 'AUDITORS',
2071
- // 'CHANGED_BY', 'CHANGED_DATE', 'STATUS_CHANGED_DATE', 'CLOSED_BY', 'CLOSED_DATE', 'DATE_START', 'VIEWED_DATE',
2072
- // 'DEADLINE', 'START_DATE_PLAN', 'END_DATE_PLAN', 'FORKED_BY_TEMPLATE_ID', 'TIME_ESTIMATE', 'TIME_SPENT_IN_LOGS',
2073
- // 'TAGS', 'ALLOW_TIME_TRACKING'
2074
- // ]
2075
- // }
2076
2071
  // storeTask$: Observable<iStoreTask>
2077
- constructor(BXRestTasks, snackBar,
2072
+ constructor(BXRestTasksTask, snackBar,
2078
2073
  // private store: Store<{ tasks: IStoreTask }>,
2079
- taskMap) {
2080
- this.BXRestTasks = BXRestTasks;
2074
+ taskMap,
2075
+ // private taskResultMap: BitrixApiTaskResultMapServices
2076
+ Navvy) {
2077
+ this.BXRestTasksTask = BXRestTasksTask;
2081
2078
  this.snackBar = snackBar;
2082
2079
  this.taskMap = taskMap;
2080
+ this.Navvy = Navvy;
2081
+ // pageSize = 50
2082
+ // nowLoad$ = new ReplaySubject<TimeProcess>(1)
2083
+ this.def = {
2084
+ select: ['ID', 'PARENT_ID', 'TITLE', 'DESCRIPTION', 'MARK', 'PRIORITY', 'STATUS', 'MULTITASK',
2085
+ 'GROUP_ID', 'STAGE_ID', 'CREATED_BY', 'CREATED_DATE', 'RESPONSIBLE_ID', 'ACCOMPLICES', 'AUDITORS',
2086
+ 'CHANGED_BY', 'CHANGED_DATE', 'STATUS_CHANGED_DATE', 'CLOSED_BY', 'CLOSED_DATE', 'DATE_START', 'VIEWED_DATE',
2087
+ 'DEADLINE', 'START_DATE_PLAN', 'END_DATE_PLAN', 'FORKED_BY_TEMPLATE_ID', 'TIME_ESTIMATE', 'TIME_SPENT_IN_LOGS',
2088
+ 'TAGS', 'ALLOW_TIME_TRACKING'
2089
+ ]
2090
+ };
2083
2091
  // this.storeTask$ = this.store.select('tasks')
2084
2092
  // this.nowLoad$.next({
2085
2093
  // total: 0,
@@ -2087,9 +2095,9 @@ class BXRestNavvyTasksTask {
2087
2095
  // })
2088
2096
  }
2089
2097
  add(param) {
2090
- return this.BXRestTasks.add(param).pipe(map(v => {
2091
- if (v && v.result && v.result.task) {
2092
- return this.taskMap.TaskBXHttpToTaskBX(v.result.task);
2098
+ return this.Navvy.mapAndSnackBarError(this.BXRestTasksTask.add(param), 'Не удалось получить задачу').pipe(map(v => {
2099
+ if (v && v.task) {
2100
+ return this.taskMap.add(v.task);
2093
2101
  }
2094
2102
  return undefined;
2095
2103
  }));
@@ -2106,15 +2114,57 @@ class BXRestNavvyTasksTask {
2106
2114
  // }
2107
2115
  // ))
2108
2116
  }
2117
+ /*
2118
+ update(taskId: number, updateFields: iBXRestTaskFieldsName[], task: iBXRestTask) {
2119
+ let sendTask: Record<string, any> = {}
2120
+ let taskTS: Record<string, any> = task
2121
+ if (updateFields.length) {
2122
+ for (let updateField of updateFields) {
2123
+ if (taskTS[camelCase(updateField)]) {
2124
+ sendTask[updateField] = taskTS[camelCase(updateField)]
2125
+ }
2126
+ }
2127
+ if (Object.values(sendTask).length) {
2128
+ return this.http.post(
2129
+ this.url.update,
2130
+ {taskId: taskId, fields: sendTask},
2131
+ 'error to update task')
2132
+ } else {
2133
+ this.snackBar.error('not valid send data task')
2134
+ console.error('not valid send data task', sendTask, task)
2135
+ return of(undefined)
2136
+ }
2137
+ }
2138
+
2139
+ this.snackBar.warning('not have field for update')
2140
+ return of(undefined)
2141
+ }
2142
+ */
2143
+ get(requestArray) {
2144
+ if (!requestArray.select) {
2145
+ requestArray.select = this.def.select;
2146
+ }
2147
+ return this.Navvy.mapAndSnackBarError(this.BXRestTasksTask.get(requestArray), 'Не удалось получить задачу').pipe(map(v => (v && v.task) ? v.task : undefined), map(v => (v) ? this.taskMap.get(v) : undefined));
2148
+ }
2149
+ list(param = {}) {
2150
+ if (!param.select) {
2151
+ param.select = this.def.select;
2152
+ }
2153
+ return this.Navvy.mapAndSnackBarError(this.BXRestTasksTask.list(param), 'Не удалось получить задачи').pipe(map(v => (v && v.tasks) ? v.tasks : undefined), map(v => (v) ? this.taskMap.list(v) : undefined), tap(v => {
2154
+ if (v) {
2155
+ SessionStorage.setItem(this.constructor.name + this.list.name, v);
2156
+ }
2157
+ }));
2158
+ }
2109
2159
  }
2110
- BXRestNavvyTasksTask.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyTasksTask, deps: [{ token: BXRestTasksTask }, { token: SnackBarService }, { token: BXRestTaskMap }], target: i0.ɵɵFactoryTarget.Injectable });
2160
+ BXRestNavvyTasksTask.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyTasksTask, deps: [{ token: BXRestTasksTask }, { token: SnackBarService }, { token: BXRestTaskMap }, { token: Navvy }], target: i0.ɵɵFactoryTarget.Injectable });
2111
2161
  BXRestNavvyTasksTask.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyTasksTask, providedIn: 'root' });
2112
2162
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyTasksTask, decorators: [{
2113
2163
  type: Injectable,
2114
2164
  args: [{
2115
2165
  providedIn: 'root'
2116
2166
  }]
2117
- }], ctorParameters: function () { return [{ type: BXRestTasksTask }, { type: SnackBarService }, { type: BXRestTaskMap }]; } });
2167
+ }], ctorParameters: function () { return [{ type: BXRestTasksTask }, { type: SnackBarService }, { type: BXRestTaskMap }, { type: Navvy }]; } });
2118
2168
 
2119
2169
  class BXRestNavvyTasks {
2120
2170
  constructor(task) {
@@ -2131,42 +2181,37 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2131
2181
  }], ctorParameters: function () { return [{ type: BXRestNavvyTasksTask }]; } });
2132
2182
 
2133
2183
  class BXRestNavvyDiskFile extends BaseServices {
2134
- constructor(BXRestDiskFile) {
2184
+ constructor(BXRestDiskFile, Navvy) {
2135
2185
  super();
2136
2186
  this.BXRestDiskFile = BXRestDiskFile;
2187
+ this.Navvy = Navvy;
2137
2188
  }
2138
2189
  get(id) {
2139
- return this.BXRestDiskFile.get(id).pipe(map(v => {
2140
- if (v && v.result) {
2141
- let newResult = Object.assign(v.result, { SIZE: this.toNum(v.result.SIZE) });
2142
- return Object.assign(v, {
2143
- result: newResult
2144
- });
2190
+ return this.Navvy.mapAndSnackBarError(this.BXRestDiskFile.get(id), 'Не удалось получить файл').pipe(map(v => {
2191
+ if (v) {
2192
+ return Object.assign(v, { SIZE: this.toNum(v.SIZE) });
2145
2193
  }
2146
2194
  return undefined;
2147
2195
  }));
2148
2196
  }
2149
2197
  markDel(id) {
2150
- return this.BXRestDiskFile.markDel(id)
2198
+ return this.Navvy.mapAndSnackBarError(this.BXRestDiskFile.markDel(id), 'Не удалось переместить файл в корзину')
2151
2199
  .pipe(map(v => {
2152
- if (v && v.result) {
2153
- let newResult = Object.assign(v.result, { SIZE: this.toNum(v.result.SIZE) });
2154
- return Object.assign(v, {
2155
- result: newResult
2156
- });
2200
+ if (v) {
2201
+ return Object.assign(v, { SIZE: this.toNum(v.SIZE) });
2157
2202
  }
2158
2203
  return undefined;
2159
2204
  }));
2160
2205
  }
2161
2206
  }
2162
- BXRestNavvyDiskFile.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskFile, deps: [{ token: BXRestDiskFile }], target: i0.ɵɵFactoryTarget.Injectable });
2207
+ BXRestNavvyDiskFile.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskFile, deps: [{ token: BXRestDiskFile }, { token: Navvy }], target: i0.ɵɵFactoryTarget.Injectable });
2163
2208
  BXRestNavvyDiskFile.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskFile, providedIn: 'root' });
2164
2209
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskFile, decorators: [{
2165
2210
  type: Injectable,
2166
2211
  args: [{
2167
2212
  providedIn: 'root'
2168
2213
  }]
2169
- }], ctorParameters: function () { return [{ type: BXRestDiskFile }]; } });
2214
+ }], ctorParameters: function () { return [{ type: BXRestDiskFile }, { type: Navvy }]; } });
2170
2215
 
2171
2216
  class BXRestMapDiskBase extends BaseMapServices {
2172
2217
  separationFoldersAndFiles(arr) {
@@ -2237,11 +2282,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2237
2282
  }] });
2238
2283
 
2239
2284
  class BXRestDiskNavvyFolder {
2240
- constructor(BXRestDiskFolder, BXRestMapDiskFolder
2241
- // private diskFileBaseMap: diskFileBaseMapServices
2242
- ) {
2285
+ constructor(BXRestDiskFolder, BXRestMapDiskFolder, Navvy) {
2243
2286
  this.BXRestDiskFolder = BXRestDiskFolder;
2244
2287
  this.BXRestMapDiskFolder = BXRestMapDiskFolder;
2288
+ this.Navvy = Navvy;
2245
2289
  }
2246
2290
  // uploadfile(id: number, fileContent: string[]) {
2247
2291
  // return this.httpPost(
@@ -2258,22 +2302,22 @@ class BXRestDiskNavvyFolder {
2258
2302
  // )
2259
2303
  // }
2260
2304
  getchildren(id) {
2261
- return this.BXRestDiskFolder.getchildren(id).pipe(map(v => {
2262
- if (v && v.result) {
2263
- return this.BXRestMapDiskFolder.getContent(BXRestMapResult(v));
2305
+ return this.Navvy.mapAndSnackBarError(this.BXRestDiskFolder.getchildren(id), 'get folders and files').pipe(map(v => {
2306
+ if (v) {
2307
+ return this.BXRestMapDiskFolder.getContent(v);
2264
2308
  }
2265
2309
  return { file: [], folder: [] };
2266
2310
  }));
2267
2311
  }
2268
2312
  }
2269
- BXRestDiskNavvyFolder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskNavvyFolder, deps: [{ token: BXRestDiskFolder }, { token: BXRestMapDiskFolder }], target: i0.ɵɵFactoryTarget.Injectable });
2313
+ BXRestDiskNavvyFolder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskNavvyFolder, deps: [{ token: BXRestDiskFolder }, { token: BXRestMapDiskFolder }, { token: Navvy }], target: i0.ɵɵFactoryTarget.Injectable });
2270
2314
  BXRestDiskNavvyFolder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskNavvyFolder, providedIn: 'root' });
2271
2315
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskNavvyFolder, decorators: [{
2272
2316
  type: Injectable,
2273
2317
  args: [{
2274
2318
  providedIn: 'root'
2275
2319
  }]
2276
- }], ctorParameters: function () { return [{ type: BXRestDiskFolder }, { type: BXRestMapDiskFolder }]; } });
2320
+ }], ctorParameters: function () { return [{ type: BXRestDiskFolder }, { type: BXRestMapDiskFolder }, { type: Navvy }]; } });
2277
2321
 
2278
2322
  class BXRestMapDiskStorage extends BXRestMapDiskBase {
2279
2323
  getchildren(arr) {
@@ -2308,11 +2352,11 @@ class BXRestDiskStorage {
2308
2352
  };
2309
2353
  }
2310
2354
  getforapp() {
2311
- return this.http.post(this.url.getforapp, {}, 'get root app folder');
2355
+ return this.http.post(this.url.getforapp, {});
2312
2356
  }
2313
2357
  // TODO: разобраться с фильтром
2314
2358
  getchildren(param) {
2315
- return this.http.post(this.url.getchildren, param, 'get root app folders and files');
2359
+ return this.http.post(this.url.getchildren, param);
2316
2360
  }
2317
2361
  // TODO: разобраться что возвращает и что вставлять
2318
2362
  addfolder(param) {
@@ -2333,29 +2377,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2333
2377
 
2334
2378
  class BXRestNavvyDiskStorage {
2335
2379
  // BXDiskFolder$ = new Observable<BXDiskFolderStore>()
2336
- constructor(BXRestDiskStorage, BXRestMapDiskStorage
2337
- // private store: Store<{ BXDiskFolder: BXDiskFolderStore }>,
2338
- ) {
2380
+ constructor(BXRestDiskStorage, BXRestMapDiskStorage, Navvy) {
2339
2381
  this.BXRestDiskStorage = BXRestDiskStorage;
2340
2382
  this.BXRestMapDiskStorage = BXRestMapDiskStorage;
2383
+ this.Navvy = Navvy;
2341
2384
  // this.BXDiskFolder$ = this.store.select('BXDiskFolder')
2342
2385
  }
2343
2386
  getforapp() {
2344
- // return this.BXDiskFolder$.pipe(
2345
- // take(1),
2346
- // mergeMap(
2347
- // saveData => {
2348
- // if (saveData.folder.app) {
2349
- // return of(saveData.folder.app)
2350
- // }
2351
- return this.BXRestDiskStorage.getforapp().pipe(map(v => BXRestMapResult(v)));
2352
- // }
2353
- // )
2354
- // )
2387
+ let res = SessionStorage.getItem(this.constructor.name + this.getforapp.name);
2388
+ if (res) {
2389
+ return of(res);
2390
+ }
2391
+ else {
2392
+ return this.Navvy.mapAndSnackBarError(this.BXRestDiskStorage.getforapp(), 'get root app folder').pipe(tap(v => {
2393
+ if (v) {
2394
+ SessionStorage.setItem(this.constructor.name + this.getforapp.name, v);
2395
+ }
2396
+ }));
2397
+ }
2355
2398
  }
2356
2399
  // TODO: разобраться с фильтром позже
2357
2400
  getchildren(param) {
2358
- return this.BXRestDiskStorage.getchildren(param).pipe(map(v => BXRestMapResult(v)), map(v => {
2401
+ return this.Navvy.mapAndSnackBarError(this.BXRestDiskStorage.getchildren(param), 'get root app folders and files').pipe(map(v => {
2359
2402
  if (v && v.length) {
2360
2403
  return this.BXRestMapDiskStorage.getchildren(v);
2361
2404
  }
@@ -2370,14 +2413,14 @@ class BXRestNavvyDiskStorage {
2370
2413
  return this.BXRestDiskStorage.uploadfile(param);
2371
2414
  }
2372
2415
  }
2373
- BXRestNavvyDiskStorage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskStorage, deps: [{ token: BXRestDiskStorage }, { token: BXRestMapDiskStorage }], target: i0.ɵɵFactoryTarget.Injectable });
2416
+ BXRestNavvyDiskStorage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskStorage, deps: [{ token: BXRestDiskStorage }, { token: BXRestMapDiskStorage }, { token: Navvy }], target: i0.ɵɵFactoryTarget.Injectable });
2374
2417
  BXRestNavvyDiskStorage.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskStorage, providedIn: 'root' });
2375
2418
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskStorage, decorators: [{
2376
2419
  type: Injectable,
2377
2420
  args: [{
2378
2421
  providedIn: 'root'
2379
2422
  }]
2380
- }], ctorParameters: function () { return [{ type: BXRestDiskStorage }, { type: BXRestMapDiskStorage }]; } });
2423
+ }], ctorParameters: function () { return [{ type: BXRestDiskStorage }, { type: BXRestMapDiskStorage }, { type: Navvy }]; } });
2381
2424
 
2382
2425
  class BXRestNavvyDiskOperation {
2383
2426
  constructor(folder, disk, storage) {
@@ -2387,7 +2430,7 @@ class BXRestNavvyDiskOperation {
2387
2430
  }
2388
2431
  // данные файла в base64
2389
2432
  loadFileInAppFolder(file) {
2390
- return this.storage.getforapp().pipe(take$1(1), mergeMap$1(infoFolder => {
2433
+ return this.storage.getforapp().pipe(take(1), mergeMap$1(infoFolder => {
2391
2434
  if (infoFolder) {
2392
2435
  return this.storage.uploadfile({
2393
2436
  id: infoFolder.ID,
@@ -2482,38 +2525,128 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2482
2525
  }]
2483
2526
  }], ctorParameters: function () { return [{ type: BXRestNavvyDiskFile }, { type: BXRestDiskNavvyFolder }, { type: BXRestNavvyDiskOperation }]; } });
2484
2527
 
2528
+ class BXRestNavvyBizprocWorkflow {
2529
+ constructor(BXRestBizprocWorkflow, Navvy) {
2530
+ this.BXRestBizprocWorkflow = BXRestBizprocWorkflow;
2531
+ this.Navvy = Navvy;
2532
+ }
2533
+ start(param) {
2534
+ return this.Navvy.mapAndSnackBarError(this.BXRestBizprocWorkflow.start(param), 'Не удалось запустить бизнес процесс');
2535
+ }
2536
+ }
2537
+ BXRestNavvyBizprocWorkflow.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyBizprocWorkflow, deps: [{ token: BXRestBizprocWorkflow }, { token: Navvy }], target: i0.ɵɵFactoryTarget.Injectable });
2538
+ BXRestNavvyBizprocWorkflow.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyBizprocWorkflow, providedIn: 'root' });
2539
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyBizprocWorkflow, decorators: [{
2540
+ type: Injectable,
2541
+ args: [{
2542
+ providedIn: 'root'
2543
+ }]
2544
+ }], ctorParameters: function () { return [{ type: BXRestBizprocWorkflow }, { type: Navvy }]; } });
2545
+
2546
+ class BXRestNavvyBizproc {
2547
+ constructor(workflow, BXRestNavvyLists) {
2548
+ this.workflow = workflow;
2549
+ this.BXRestNavvyLists = BXRestNavvyLists;
2550
+ }
2551
+ /**
2552
+ * Метод по запуску бизнес процессов из ленты
2553
+ *
2554
+ * @param id
2555
+ * @param parametersElement
2556
+ * @param parametersBizproc
2557
+ * @param templateIDs
2558
+ */
2559
+ startProcFormNewsFeed(id, parametersElement, parametersBizproc, templateIDs) {
2560
+ return this.BXRestNavvyLists.element.add({
2561
+ IBLOCK_TYPE_ID: 'bitrix_processes',
2562
+ IBLOCK_ID: id,
2563
+ ELEMENT_CODE: 'trace_studio_' + Date.now() + '_' + Math.random(),
2564
+ // тут должно быть уникально значение (генерация уникальных значений на фронте лол),
2565
+ // как ещё уникальнее сделать я просто не знаю
2566
+ // это поле обязательно без него не работает
2567
+ FIELDS: {
2568
+ NAME: parametersElement['NAME'],
2569
+ ...parametersElement
2570
+ }
2571
+ }).pipe(mergeMap(v => {
2572
+ if (v) {
2573
+ if (Object.keys(parametersBizproc).length) {
2574
+ let reques = [];
2575
+ for (let templateID of templateIDs) {
2576
+ reques.push(this.workflow.start({
2577
+ TEMPLATE_ID: templateID,
2578
+ DOCUMENT_ID: ['lists', 'BizprocDocument', String(v)],
2579
+ PARAMETERS: parametersBizproc
2580
+ }));
2581
+ }
2582
+ return forkJoin(reques);
2583
+ }
2584
+ else {
2585
+ return of(true);
2586
+ }
2587
+ }
2588
+ return of(false);
2589
+ }));
2590
+ }
2591
+ }
2592
+ BXRestNavvyBizproc.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyBizproc, deps: [{ token: BXRestNavvyBizprocWorkflow }, { token: BXRestNavvyLists }], target: i0.ɵɵFactoryTarget.Injectable });
2593
+ BXRestNavvyBizproc.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyBizproc, providedIn: 'root' });
2594
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyBizproc, decorators: [{
2595
+ type: Injectable,
2596
+ args: [{
2597
+ providedIn: 'root'
2598
+ }]
2599
+ }], ctorParameters: function () { return [{ type: BXRestNavvyBizprocWorkflow }, { type: BXRestNavvyLists }]; } });
2600
+
2601
+ class BXRestMapLists extends BaseMapServices {
2602
+ constructor(element) {
2603
+ super();
2604
+ this.element = element;
2605
+ }
2606
+ }
2607
+ BXRestMapLists.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapLists, deps: [{ token: BXRestMapListsElement }], target: i0.ɵɵFactoryTarget.Injectable });
2608
+ BXRestMapLists.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapLists, providedIn: 'root' });
2609
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapLists, decorators: [{
2610
+ type: Injectable,
2611
+ args: [{
2612
+ providedIn: 'root'
2613
+ }]
2614
+ }], ctorParameters: function () { return [{ type: BXRestMapListsElement }]; } });
2615
+
2485
2616
  class BXRest {
2486
- constructor(user, lists, tasks, disk) {
2617
+ constructor(user, lists, tasks, disk, bizproc) {
2487
2618
  this.user = user;
2488
2619
  this.lists = lists;
2489
2620
  this.tasks = tasks;
2490
2621
  this.disk = disk;
2622
+ this.bizproc = bizproc;
2491
2623
  }
2492
2624
  }
2493
- BXRest.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRest, deps: [{ token: BXRestUser }, { token: BXRestLists }, { token: BXRestTasks }, { token: BXRestDisk }], target: i0.ɵɵFactoryTarget.Injectable });
2625
+ BXRest.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRest, deps: [{ token: BXRestUser }, { token: BXRestLists }, { token: BXRestTasks }, { token: BXRestDisk }, { token: BXRestBizproc }], target: i0.ɵɵFactoryTarget.Injectable });
2494
2626
  BXRest.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRest, providedIn: 'root' });
2495
2627
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRest, decorators: [{
2496
2628
  type: Injectable,
2497
2629
  args: [{
2498
2630
  providedIn: 'root'
2499
2631
  }]
2500
- }], ctorParameters: function () { return [{ type: BXRestUser }, { type: BXRestLists }, { type: BXRestTasks }, { type: BXRestDisk }]; } });
2632
+ }], ctorParameters: function () { return [{ type: BXRestUser }, { type: BXRestLists }, { type: BXRestTasks }, { type: BXRestDisk }, { type: BXRestBizproc }]; } });
2501
2633
  class BXRestNavvy {
2502
- constructor(user, lists, tasks, disk) {
2634
+ constructor(user, lists, tasks, disk, bizproc) {
2503
2635
  this.user = user;
2504
2636
  this.lists = lists;
2505
2637
  this.tasks = tasks;
2506
2638
  this.disk = disk;
2639
+ this.bizproc = bizproc;
2507
2640
  }
2508
2641
  }
2509
- BXRestNavvy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvy, deps: [{ token: BXRestNavvyUser }, { token: BXRestNavvyLists }, { token: BXRestNavvyTasks }, { token: BXRestNavvyDisk }], target: i0.ɵɵFactoryTarget.Injectable });
2642
+ BXRestNavvy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvy, deps: [{ token: BXRestNavvyUser }, { token: BXRestNavvyLists }, { token: BXRestNavvyTasks }, { token: BXRestNavvyDisk }, { token: BXRestNavvyBizproc }], target: i0.ɵɵFactoryTarget.Injectable });
2510
2643
  BXRestNavvy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvy, providedIn: 'root' });
2511
2644
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvy, decorators: [{
2512
2645
  type: Injectable,
2513
2646
  args: [{
2514
2647
  providedIn: 'root'
2515
2648
  }]
2516
- }], ctorParameters: function () { return [{ type: BXRestNavvyUser }, { type: BXRestNavvyLists }, { type: BXRestNavvyTasks }, { type: BXRestNavvyDisk }]; } });
2649
+ }], ctorParameters: function () { return [{ type: BXRestNavvyUser }, { type: BXRestNavvyLists }, { type: BXRestNavvyTasks }, { type: BXRestNavvyDisk }, { type: BXRestNavvyBizproc }]; } });
2517
2650
  class BXRestMap {
2518
2651
  constructor(lists) {
2519
2652
  this.lists = lists;
@@ -2536,5 +2669,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2536
2669
  * Generated bundle index. Do not edit.
2537
2670
  */
2538
2671
 
2539
- export { BXRest, BXRestMap, BXRestMapResult, BXRestNavvy, REST_SETTINGS };
2672
+ export { BXRest, BXRestMap, BXRestMapResult, BXRestNavvy, BX_REST_SETTINGS };
2540
2673
  //# sourceMappingURL=bx-rest.mjs.map