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