bx-rest 0.0.35 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/README.md +60 -4
  2. package/esm2020/functions/mapResult.mjs +2 -2
  3. package/esm2020/map/disk/base.mjs +57 -0
  4. package/esm2020/map/disk/folder.mjs +17 -0
  5. package/esm2020/map/disk/storage.mjs +17 -0
  6. package/esm2020/map/lists/element.mjs +8 -8
  7. package/esm2020/map/lists.mjs +19 -0
  8. package/esm2020/map/task.mjs +115 -0
  9. package/esm2020/map/user.mjs +89 -0
  10. package/esm2020/public-api.mjs +4 -2
  11. package/esm2020/request/disk/file.mjs +38 -0
  12. package/esm2020/request/disk/folder.mjs +46 -0
  13. package/esm2020/request/disk/storage.mjs +46 -0
  14. package/esm2020/request/disk.mjs +19 -0
  15. package/esm2020/request/lists/element.mjs +5 -7
  16. package/esm2020/request/tasks/task.mjs +61 -0
  17. package/esm2020/request/tasks.mjs +17 -0
  18. package/esm2020/request/user.mjs +23 -55
  19. package/esm2020/request-navvy/disk/file.mjs +43 -0
  20. package/esm2020/request-navvy/disk/folder.mjs +45 -0
  21. package/esm2020/request-navvy/disk/operation.mjs +95 -0
  22. package/esm2020/request-navvy/disk/storage.mjs +54 -0
  23. package/esm2020/request-navvy/disk.mjs +21 -0
  24. package/esm2020/request-navvy/lists/element.mjs +24 -0
  25. package/esm2020/request-navvy/lists.mjs +25 -0
  26. package/esm2020/request-navvy/tasks/task.mjs +64 -0
  27. package/esm2020/request-navvy/tasks.mjs +17 -0
  28. package/esm2020/request-navvy/user.mjs +53 -0
  29. package/esm2020/rest.mjs +42 -4
  30. package/esm2020/services/base.mjs +3 -2
  31. package/esm2020/services/http/HttpBX.mjs +15 -36
  32. package/esm2020/services/http/HttpData.mjs +2 -8
  33. package/esm2020/services/http/http.mjs +8 -8
  34. package/esm2020/services/http/sessionKey.mjs +36 -20
  35. package/esm2020/settings.mjs +4 -5
  36. package/esm2020/typification/rest/base/answer.mjs +2 -0
  37. package/esm2020/typification/rest/base/filterGenerator.mjs +2 -0
  38. package/esm2020/typification/rest/batch/batchRequestParam.mjs +1 -1
  39. package/esm2020/typification/rest/disk/file.mjs +2 -0
  40. package/esm2020/typification/rest/disk/folder.mjs +2 -0
  41. package/esm2020/typification/rest/disk/map.mjs +2 -0
  42. package/esm2020/typification/rest/disk/storage/uploadfile.mjs +2 -0
  43. package/esm2020/typification/rest/lists/element/get.mjs +1 -1
  44. package/esm2020/typification/rest/task/fieldsForSend.mjs +2 -0
  45. package/esm2020/typification/rest/task/people/base.mjs +2 -0
  46. package/esm2020/typification/rest/task/task.mjs +2 -0
  47. package/esm2020/typification/settings.mjs +1 -1
  48. package/fesm2015/bx-rest.mjs +1094 -313
  49. package/fesm2015/bx-rest.mjs.map +1 -1
  50. package/fesm2020/bx-rest.mjs +1092 -313
  51. package/fesm2020/bx-rest.mjs.map +1 -1
  52. package/functions/mapResult.d.ts +4 -2
  53. package/map/disk/base.d.ts +12 -0
  54. package/map/disk/folder.d.ts +9 -0
  55. package/map/disk/storage.d.ts +9 -0
  56. package/map/lists/element.d.ts +4 -4
  57. package/map/lists.d.ts +9 -0
  58. package/map/task.d.ts +8 -0
  59. package/map/user.d.ts +12 -0
  60. package/package.json +1 -1
  61. package/public-api.d.ts +3 -1
  62. package/request/disk/file.d.ts +25 -0
  63. package/request/disk/folder.d.ts +26 -0
  64. package/request/disk/storage.d.ts +34 -0
  65. package/request/disk.d.ts +10 -0
  66. package/request/lists/element.d.ts +3 -5
  67. package/request/tasks/task.d.ts +55 -0
  68. package/request/tasks.d.ts +8 -0
  69. package/request/user.d.ts +9 -20
  70. package/request-navvy/disk/file.d.ts +19 -0
  71. package/request-navvy/disk/folder.d.ts +11 -0
  72. package/request-navvy/disk/operation.d.ts +23 -0
  73. package/request-navvy/disk/storage.d.ts +23 -0
  74. package/request-navvy/disk.d.ts +12 -0
  75. package/request-navvy/lists/element.d.ts +12 -0
  76. package/request-navvy/lists.d.ts +15 -0
  77. package/request-navvy/tasks/task.d.ts +16 -0
  78. package/request-navvy/tasks.d.ts +8 -0
  79. package/request-navvy/user.d.ts +19 -0
  80. package/rest.d.ts +25 -1
  81. package/services/http/HttpBX.d.ts +3 -12
  82. package/services/http/HttpData.d.ts +1 -3
  83. package/services/http/http.d.ts +0 -5
  84. package/services/http/sessionKey.d.ts +13 -2
  85. package/typification/rest/base/{httpAnswerBX.d.ts → answer.d.ts} +1 -1
  86. package/typification/rest/base/filterGenerator.d.ts +5 -0
  87. package/typification/rest/batch/batchRequestParam.d.ts +2 -2
  88. package/typification/rest/disk/file.d.ts +14 -0
  89. package/typification/rest/disk/folder.d.ts +47 -0
  90. package/typification/rest/disk/map.d.ts +6 -0
  91. package/typification/rest/disk/storage/uploadfile.d.ts +9 -0
  92. package/typification/rest/lists/element/get.d.ts +9 -1
  93. package/typification/rest/task/fieldsForSend.d.ts +61 -0
  94. package/typification/rest/task/people/base.d.ts +12 -0
  95. package/typification/rest/task/task.d.ts +102 -0
  96. package/typification/settings.d.ts +3 -4
  97. package/esm2020/services/map/base.mjs +0 -14
  98. package/esm2020/services/map/rest/user.mjs +0 -89
  99. package/esm2020/typification/rest/base/httpAnswerBX.mjs +0 -2
  100. package/services/map/base.d.ts +0 -6
  101. package/services/map/rest/user.d.ts +0 -12
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
- import { NgModule, inject, Component, ViewEncapsulation, Inject, Injectable } from '@angular/core';
3
- import { Subscription, filter, take, of, throwError, forkJoin, mergeMap } from 'rxjs';
4
- import { map, catchError, mergeMap as mergeMap$1, first } from 'rxjs/operators';
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';
5
5
  import clone from 'just-clone';
6
6
  import * as i1$1 from '@angular/material/snack-bar';
7
7
  import { MatSnackBarRef, MAT_SNACK_BAR_DATA } from '@angular/material/snack-bar';
@@ -13,10 +13,26 @@ import * as i1$2 from '@ngrx/store';
13
13
  import { createAction, props, createReducer, on } from '@ngrx/store';
14
14
  import { DateTime } from 'luxon';
15
15
  import * as i2$1 from '@angular/router';
16
- import flatten from 'just-flatten-it';
17
16
  import * as i1$3 from '@angular/common/http';
18
17
  import { HttpParams } from '@angular/common/http';
19
18
 
19
+ const REST_SETTINGS = {
20
+ auth: {
21
+ source: 'cookies',
22
+ key: 'auth'
23
+ },
24
+ urls: {
25
+ home: 'b24.trace-studio.com'
26
+ }
27
+ };
28
+
29
+ function BXRestMapResult(v) {
30
+ if (v && (v.result || typeof v.result === 'boolean')) {
31
+ return v.result;
32
+ }
33
+ return undefined;
34
+ }
35
+
20
36
  const $get = 'get';
21
37
  const $add = 'add';
22
38
  const $set = 'set';
@@ -560,7 +576,7 @@ class BaseServices {
560
576
  }
561
577
  getHomeAddress() {
562
578
  // return this.prepareBaseAddress(environment.urls.home)
563
- return this.prepareBaseAddress('b24.trace-studio.com');
579
+ return this.prepareBaseAddress(REST_SETTINGS.urls.home);
564
580
  }
565
581
  dateDiff(a, b) {
566
582
  return new Date(a.valueOf() - b.valueOf());
@@ -664,17 +680,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
664
680
  }]
665
681
  }] });
666
682
 
667
- const REST_SETTINGS = {
668
- support: {
669
- map: true,
670
- result: true
671
- },
672
- auth: 'cookies',
673
- urls: {
674
- home: 'b24.trace-studio.com'
675
- }
676
- };
677
-
678
683
  class RestServices {
679
684
  constructor() {
680
685
  this.BX24 = false;
@@ -695,7 +700,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
695
700
  }], ctorParameters: function () { return []; } });
696
701
 
697
702
  class SessionKeyServices extends BaseServices {
698
- constructor(store, route, BxApiLib) {
703
+ constructor(store, route, BxApiLib, REST_SETTINGS) {
699
704
  super();
700
705
  this.store = store;
701
706
  this.route = route;
@@ -704,6 +709,7 @@ class SessionKeyServices extends BaseServices {
704
709
  this.subscribe = {
705
710
  authData: new Subscription()
706
711
  };
712
+ this.REST_SETTINGS = REST_SETTINGS;
707
713
  this.authData$ = this.store.select('auth');
708
714
  this.authData$.subscribe(authData => {
709
715
  if ((authData && !authData.access_token.length) || !authData) {
@@ -800,24 +806,34 @@ class SessionKeyServices extends BaseServices {
800
806
  this.subscribe.authData.unsubscribe();
801
807
  }
802
808
  getAuth() {
803
- if (window.BX && window.BX.bitrix_sessid()) {
804
- return window.BX.bitrix_sessid();
805
- }
806
- else if (this.getSessid().length) {
807
- let str = this.getSessid();
808
- return (str) ? str : '';
809
- }
810
- else {
811
- return CookiesServices.get('auth');
809
+ switch (REST_SETTINGS.auth.key) {
810
+ case 'auth':
811
+ return CookiesServices.get('auth');
812
+ default:
813
+ if (window.BX && window.BX.bitrix_sessid()) {
814
+ return window.BX.bitrix_sessid();
815
+ }
816
+ else if (this.getSessid().length) {
817
+ let str = this.getSessid();
818
+ return (str) ? str : '';
819
+ }
820
+ else {
821
+ return CookiesServices.get('auth');
822
+ }
812
823
  }
813
824
  }
814
825
  getKeyAuth() {
815
- if (window.BX && window.BX.bitrix_sessid()
816
- || this.getSessid().length) {
817
- return 'sessid';
826
+ if (REST_SETTINGS.auth.key.length) {
827
+ return REST_SETTINGS.auth.key;
818
828
  }
819
829
  else {
820
- return 'auth';
830
+ if (window.BX && window.BX.bitrix_sessid()
831
+ || this.getSessid().length) {
832
+ return 'sessid';
833
+ }
834
+ else {
835
+ return 'auth';
836
+ }
821
837
  }
822
838
  }
823
839
  getSessid() {
@@ -843,7 +859,7 @@ class SessionKeyServices extends BaseServices {
843
859
  return false;
844
860
  }
845
861
  getAuthParams() {
846
- switch (REST_SETTINGS.auth) {
862
+ switch (REST_SETTINGS.auth.source) {
847
863
  case 'cookies':
848
864
  return of(this.getAuth());
849
865
  default:
@@ -851,21 +867,26 @@ class SessionKeyServices extends BaseServices {
851
867
  }
852
868
  }
853
869
  getBaseUrl() {
854
- return of(this.prepareBaseAddress(REST_SETTINGS.urls.home, 'rest')); // TODO: вынести в настройки
870
+ return of(this.prepareBaseAddress(this.REST_SETTINGS.urls.home, 'rest'));
855
871
  // return this.authData$.pipe( // TODO: разобраться позже
856
872
  // take(1),
857
873
  // map(v => (v && v.domain) ? this.prepareBaseAddress(v.domain) : undefined)
858
874
  // )
859
875
  }
860
876
  }
861
- 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 }], target: i0.ɵɵFactoryTarget.Injectable });
877
+ SessionKeyServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionKeyServices, deps: [{ token: i1$2.Store }, { token: i2$1.ActivatedRoute }, { token: RestServices }, { token: REST_SETTINGS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
862
878
  SessionKeyServices.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionKeyServices, providedIn: 'root' });
863
879
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionKeyServices, decorators: [{
864
880
  type: Injectable,
865
881
  args: [{
866
882
  providedIn: 'root'
867
883
  }]
868
- }], ctorParameters: function () { return [{ type: i1$2.Store }, { type: i2$1.ActivatedRoute }, { type: RestServices }]; } });
884
+ }], ctorParameters: function () { return [{ type: i1$2.Store }, { type: i2$1.ActivatedRoute }, { type: RestServices }, { type: undefined, decorators: [{
885
+ type: Optional
886
+ }, {
887
+ type: Inject,
888
+ args: [REST_SETTINGS]
889
+ }] }]; } });
869
890
 
870
891
  class HttpData extends BaseServices {
871
892
  constructor() {
@@ -970,12 +991,6 @@ class HttpData extends BaseServices {
970
991
  }
971
992
  return sendHttpParams;
972
993
  }
973
- mapResult(v) {
974
- if (v && (v.result || typeof v.result === 'boolean')) {
975
- return v.result;
976
- }
977
- return undefined;
978
- }
979
994
  sliceArrayIntoChunks(arr, chunkSize) {
980
995
  const res = [];
981
996
  for (let i = 0; i < arr.length; i += chunkSize) {
@@ -1081,12 +1096,13 @@ class HttpServices extends BaseHttpServices {
1081
1096
  }
1082
1097
  return res;
1083
1098
  }
1084
- mapBranchResult(res) {
1085
- return Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined));
1086
- }
1087
- mapBranchResultWithoutKey(res) {
1088
- return flatten(Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined)));
1089
- }
1099
+ // mapBranchResult<T>(res: iBatchRequestAnswer<T>[]){
1100
+ // return Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined)) as {[key:keyBatch]: T}
1101
+ // }
1102
+ //
1103
+ // mapBranchResultWithoutKey<T>(res: iBatchRequestAnswer<T>[]): T[]{
1104
+ // return flatten<T>(Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined)))
1105
+ // }
1090
1106
  httpPost(url, params = {}, textError = '', settings = this.defSettings) {
1091
1107
  return this.session.getAuthParams().pipe(mergeMap(auth => {
1092
1108
  if (auth) {
@@ -1155,13 +1171,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1155
1171
  }]
1156
1172
  }], ctorParameters: function () { return [{ type: i1$3.HttpClient }, { type: SnackBarService }, { type: SessionKeyServices }]; } });
1157
1173
 
1158
- function mapResult(v) {
1159
- if (v && (v.result || typeof v.result === 'boolean')) {
1160
- return v.result;
1161
- }
1162
- return undefined;
1163
- }
1164
-
1174
+ // type TransformFunction<T, R> = (input: T) => R;
1165
1175
  class HttpBXServices extends HttpServices {
1166
1176
  timeNowOnServer() {
1167
1177
  return this.httpGet('server.time').pipe(map(v => {
@@ -1203,39 +1213,20 @@ class HttpBXServices extends HttpServices {
1203
1213
  }
1204
1214
  return res;
1205
1215
  }
1206
- mapBranchResult(res) {
1207
- return Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined));
1208
- }
1209
- mapBranchResultWithoutKey(res) {
1210
- return flatten(Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined)));
1211
- }
1212
- post(name, params = {}, textError = '', mapHttp = undefined, settings = this.defSettings) {
1213
- return this.httpPost(this.getNameMethod(name), params, textError, settings).pipe(map(v => {
1214
- console.log('result', v);
1215
- if (v && v.result && REST_SETTINGS.support.map && mapHttp) {
1216
- console.log('result2', mapHttp(v.result));
1217
- // console.log('result2', v, Array.isArray(v.result)
1218
- // ? Object.assign(v, {result: v.result.map(i => mapHttp(i))}) as iHttpAnswerBX<R>
1219
- // : Object.assign(v, {result: mapHttp(v.result)}) as iHttpAnswerBX<R>)
1220
- // Array.isArray(v.result)
1221
- // ? Object.assign(v, {result: v.result.map(i => mapHttp(i))}) as iHttpAnswerBX<R>
1222
- // :
1223
- return Object.assign(v, { result: mapHttp(v.result) });
1224
- }
1225
- return v;
1226
- }), map(v => (v && REST_SETTINGS.support.result) ? mapResult : v));
1227
- }
1228
- get(name, params = {}, textError = '', mapHttp = (v) => {
1229
- return v;
1230
- }, settings = this.defSettings) {
1231
- return this.httpGet(this.getNameMethod(name), params, textError, settings).pipe(map(v => {
1232
- if (v && v.result && REST_SETTINGS.support.map) {
1233
- return Array.isArray(v.result)
1234
- ? Object.assign(v, { result: v.result.map(i => mapHttp(i)) })
1235
- : Object.assign(v, { result: mapHttp(v.result) });
1236
- }
1237
- return v;
1238
- }), map(v => (v && REST_SETTINGS.support.result) ? mapResult : v));
1216
+ // override mapBranchResult<T>(res: iBatchRequestAnswer<T>[]) {
1217
+ // return Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined)) as {
1218
+ // [key: keyBatch]: T
1219
+ // }
1220
+ // }
1221
+ //
1222
+ // override mapBranchResultWithoutKey<T>(res: iBatchRequestAnswer<T>[]): T[] {
1223
+ // return flatten<T>(Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined)))
1224
+ // }
1225
+ post(name, params = {}, textError = '', settings = this.defSettings) {
1226
+ return this.httpPost(this.getNameMethod(name), params, textError, settings);
1227
+ }
1228
+ get(name, params = {}, textError = '', settings = this.defSettings) {
1229
+ return this.httpGet(this.getNameMethod(name), params, textError, settings);
1239
1230
  }
1240
1231
  httpPost(url, params = {}, textError = '', settings = this.defSettings) {
1241
1232
  return this.session.getAuthParams().pipe(mergeMap(auth => {
@@ -1305,40 +1296,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1305
1296
  }]
1306
1297
  }] });
1307
1298
 
1308
- let BaseMapServices$1 = class BaseMapServices extends BaseServices {
1309
- };
1310
- BaseMapServices$1.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseMapServices$1, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1311
- BaseMapServices$1.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseMapServices$1, providedIn: 'root' });
1312
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseMapServices$1, decorators: [{
1313
- type: Injectable,
1314
- args: [{
1315
- providedIn: 'root'
1316
- }]
1317
- }] });
1318
-
1319
- class BXRestListsElementMap extends BaseMapServices$1 {
1320
- get(item) {
1321
- return Object.assign(item, {
1322
- BP_PUBLISHED: item.BP_PUBLISHED === 'Y',
1323
- CREATED_BY: this.toNum(item.CREATED_BY),
1324
- IBLOCK_ID: this.toNum(item.IBLOCK_ID),
1325
- ID: this.toNum(item.ID)
1326
- });
1327
- }
1328
- }
1329
- BXRestListsElementMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElementMap, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1330
- BXRestListsElementMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElementMap, providedIn: 'root' });
1331
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElementMap, decorators: [{
1332
- type: Injectable,
1333
- args: [{
1334
- providedIn: 'root'
1335
- }]
1336
- }] });
1337
-
1338
1299
  class BXRestListsElement {
1339
- constructor(http, mapResult) {
1300
+ constructor(http) {
1340
1301
  this.http = http;
1341
- this.mapResult = mapResult;
1342
1302
  this.url = {
1343
1303
  add: [$lists, $element, $add],
1344
1304
  delete: [$lists, $element, $delete],
@@ -1348,19 +1308,19 @@ class BXRestListsElement {
1348
1308
  };
1349
1309
  }
1350
1310
  get(pram) {
1351
- return this.http.post(this.url.get, pram, 'Не Удалось получить элемент списка', (v) => v.map(i => this.mapResult.get(i)));
1311
+ return this.http.post(this.url.get, pram, 'Не Удалось получить элемент списка');
1352
1312
  }
1353
1313
  customPipe() {
1354
1314
  }
1355
1315
  }
1356
- BXRestListsElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, deps: [{ token: HttpBXServices }, { token: BXRestListsElementMap }], target: i0.ɵɵFactoryTarget.Injectable });
1316
+ BXRestListsElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, deps: [{ token: HttpBXServices }], target: i0.ɵɵFactoryTarget.Injectable });
1357
1317
  BXRestListsElement.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, providedIn: 'root' });
1358
1318
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, decorators: [{
1359
1319
  type: Injectable,
1360
1320
  args: [{
1361
1321
  providedIn: 'root'
1362
1322
  }]
1363
- }], ctorParameters: function () { return [{ type: HttpBXServices }, { type: BXRestListsElementMap }]; } });
1323
+ }], ctorParameters: function () { return [{ type: HttpBXServices }]; } });
1364
1324
 
1365
1325
  class BXRestLists {
1366
1326
  constructor(element) {
@@ -1383,70 +1343,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1383
1343
  }]
1384
1344
  }], ctorParameters: function () { return [{ type: BXRestListsElement }]; } });
1385
1345
 
1386
- const save = createAction('[Users Component] Save', props());
1387
- const saveArr = createAction('[Users Component] Save Arr', props());
1388
- const update = createAction('[Users Component] Update', props());
1389
- const loadAll = createAction('[Users Component] loadAll', props());
1390
- const saveSelf = createAction('[Users Component] saveSelf', props());
1391
- const saveIDLoadedDepartment = createAction('[Users Component] saveIDLoadedDepartment', props());
1392
- const initialState = {
1393
- load: {
1394
- all: false,
1395
- department: []
1396
- },
1397
- self: undefined,
1398
- data: []
1399
- };
1400
- const _usersReducer = createReducer(initialState, on(saveIDLoadedDepartment, (s, data) => {
1401
- let copy = clone(s);
1402
- copy.load.department = [...copy.load.department, ...data.id];
1403
- return copy;
1404
- }), on(save, (s, data) => {
1405
- const find = s.data.find(v => v.ID === data.ID);
1406
- if (!find) {
1407
- const copy = clone(s);
1408
- copy.data.push(data);
1409
- return copy;
1410
- }
1411
- return s;
1412
- }), on(saveArr, (s, data) => {
1413
- const copy = clone(s);
1414
- if (copy.data && copy.data.length) {
1415
- for (const user of data.arr) {
1416
- const find = copy.data.find(v => v.ID === user.ID);
1417
- if (!find) {
1418
- copy.data.push(user);
1419
- }
1420
- }
1421
- }
1422
- else {
1423
- copy.data = [...data.arr];
1424
- }
1425
- return copy;
1426
- }), on(update, (s, data) => {
1427
- const copy = clone(s);
1428
- let find = copy.data.findIndex(v => v.ID === data.ID);
1429
- if (find !== -1) {
1430
- const copy = clone(s);
1431
- copy.data.splice(find, 1, data);
1432
- // copy.data.push(data)
1433
- return copy;
1434
- }
1435
- return s;
1436
- }), on(loadAll, (s, data) => {
1437
- if (data.load !== s.load.all) {
1438
- const copy = clone(s);
1439
- copy.load.all = data.load;
1440
- return copy;
1441
- }
1442
- return s;
1443
- }), on(saveSelf, (s, data) => {
1444
- return { ...s, self: data.self };
1445
- }));
1446
- function usersReducer(state = initialState, action) {
1447
- return _usersReducer(state, action);
1448
- }
1449
-
1450
1346
  class BaseMapServices extends BaseServices {
1451
1347
  }
1452
1348
  BaseMapServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseMapServices, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
@@ -1458,100 +1354,83 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1458
1354
  }]
1459
1355
  }] });
1460
1356
 
1461
- class BitrixApiUserMapServices extends BaseMapServices {
1462
- HttpToBX(user) {
1463
- let res = Object.assign(clone(user), {
1464
- ID: this.toNum(user.ID),
1465
- IS_ONLINE: this.toBool(user.IS_ONLINE),
1466
- DATE_REGISTER: this.toDate(user.DATE_REGISTER),
1467
- PERSONAL_BIRTHDAY: this.toDate(user.PERSONAL_BIRTHDAY),
1468
- });
1469
- if (user.LAST_LOGIN) {
1470
- res.LAST_LOGIN = this.toDate(user.LAST_LOGIN);
1471
- }
1472
- return res;
1357
+ class BXRestMapListsElement extends BaseMapServices {
1358
+ get(items) {
1359
+ return items.map(item => Object.assign(item, {
1360
+ BP_PUBLISHED: item.BP_PUBLISHED === 'Y',
1361
+ CREATED_BY: this.toNum(item.CREATED_BY),
1362
+ IBLOCK_ID: this.toNum(item.IBLOCK_ID),
1363
+ ID: this.toNum(item.ID)
1364
+ }));
1473
1365
  }
1474
- BXtoHttp(user) {
1475
- return Object.assign(clone(user), {
1476
- ID: this.toStr(user.ID),
1477
- IS_ONLINE: this.toBXYorN(user.IS_ONLINE),
1478
- DATE_REGISTER: this.getBXStrTime(user.DATE_REGISTER),
1479
- PERSONAL_BIRTHDAY: this.toStr(user.PERSONAL_BIRTHDAY),
1480
- LAST_LOGIN: this.toStr(user.LAST_LOGIN)
1481
- });
1366
+ }
1367
+ BXRestMapListsElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapListsElement, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1368
+ BXRestMapListsElement.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapListsElement, providedIn: 'root' });
1369
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapListsElement, decorators: [{
1370
+ type: Injectable,
1371
+ args: [{
1372
+ providedIn: 'root'
1373
+ }]
1374
+ }] });
1375
+
1376
+ class BXRestMapLists extends BaseMapServices {
1377
+ constructor(element) {
1378
+ super();
1379
+ this.element = element;
1482
1380
  }
1483
- getFIO(user) {
1484
- let res = '';
1485
- if (!user.LAST_NAME) {
1486
- const SECOND_NAME = (user.SECOND_NAME) ? user.SECOND_NAME : '';
1487
- const NAME = (user.NAME) ? user.NAME : '';
1488
- res = NAME + ' ' + SECOND_NAME;
1489
- }
1490
- else if (!user.NAME) {
1491
- res = user.LAST_NAME;
1492
- }
1493
- else if (!user.SECOND_NAME) {
1494
- res = user.LAST_NAME + ' ' + user.NAME;
1495
- }
1496
- else {
1497
- res = user.LAST_NAME + ' ' + user.NAME + ' ' + user.SECOND_NAME;
1498
- }
1499
- return res.trim();
1381
+ }
1382
+ BXRestMapLists.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapLists, deps: [{ token: BXRestMapListsElement }], target: i0.ɵɵFactoryTarget.Injectable });
1383
+ BXRestMapLists.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapLists, providedIn: 'root' });
1384
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapLists, decorators: [{
1385
+ type: Injectable,
1386
+ args: [{
1387
+ providedIn: 'root'
1388
+ }]
1389
+ }], ctorParameters: function () { return [{ type: BXRestMapListsElement }]; } });
1390
+
1391
+ class BXRestNavvyListsElement {
1392
+ constructor(BXRestListsElement, BXRestMap) {
1393
+ this.BXRestListsElement = BXRestListsElement;
1394
+ this.BXRestMap = BXRestMap;
1500
1395
  }
1501
- getFI(user) {
1502
- let res = '';
1503
- if (!user.LAST_NAME) {
1504
- const NAME = (user.NAME) ? user.NAME : '';
1505
- res = NAME;
1506
- }
1507
- else if (!user.NAME) {
1508
- res = user.LAST_NAME;
1509
- }
1510
- else {
1511
- res = user.LAST_NAME + ' ' + user.NAME;
1512
- }
1513
- return res.trim();
1396
+ get(pram) {
1397
+ return this.BXRestListsElement.get(pram).pipe(map(v => (v) ? this.BXRestMap.get(BXRestMapResult(v)) : undefined));
1514
1398
  }
1515
- getFIOShort(user) {
1516
- let res = '';
1517
- if (!user.LAST_NAME) {
1518
- const SECOND_NAME = (user.SECOND_NAME) ? user.SECOND_NAME : '';
1519
- const NAME = (user.NAME) ? user.NAME : '';
1520
- res = NAME + ' ' + SECOND_NAME;
1521
- }
1522
- else if (!user.NAME) {
1523
- res = user.LAST_NAME;
1524
- }
1525
- else if (!user.SECOND_NAME) {
1526
- res = user.LAST_NAME + ' ' + user.NAME.charAt(0).toUpperCase() + '.';
1527
- }
1528
- else {
1529
- res =
1530
- user.LAST_NAME + ' ' +
1531
- user.NAME.charAt(0).toUpperCase() + '.' +
1532
- user.SECOND_NAME.charAt(0).toUpperCase() + '.';
1533
- }
1534
- return res.trim();
1399
+ }
1400
+ BXRestNavvyListsElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyListsElement, deps: [{ token: BXRestListsElement }, { token: BXRestMapListsElement }], target: i0.ɵɵFactoryTarget.Injectable });
1401
+ BXRestNavvyListsElement.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyListsElement, providedIn: 'root' });
1402
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyListsElement, decorators: [{
1403
+ type: Injectable,
1404
+ args: [{
1405
+ providedIn: 'root'
1406
+ }]
1407
+ }], ctorParameters: function () { return [{ type: BXRestListsElement }, { type: BXRestMapListsElement }]; } });
1408
+
1409
+ class BXRestNavvyLists {
1410
+ constructor(element) {
1411
+ this.element = element;
1412
+ this.url = {
1413
+ add: [$lists, $add],
1414
+ delete: [$lists, $delete],
1415
+ get: [$lists, $get],
1416
+ update: [$lists, $update],
1417
+ getIblockTypeId: [$lists, $get, $iblock, $type, $id], // Метод возвращает id типа инфоблока
1418
+ };
1535
1419
  }
1536
1420
  }
1537
- BitrixApiUserMapServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BitrixApiUserMapServices, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1538
- BitrixApiUserMapServices.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BitrixApiUserMapServices, providedIn: 'root' });
1539
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BitrixApiUserMapServices, decorators: [{
1421
+ BXRestNavvyLists.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyLists, deps: [{ token: BXRestNavvyListsElement }], target: i0.ɵɵFactoryTarget.Injectable });
1422
+ BXRestNavvyLists.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyLists, providedIn: 'root' });
1423
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyLists, decorators: [{
1540
1424
  type: Injectable,
1541
1425
  args: [{
1542
1426
  providedIn: 'root'
1543
1427
  }]
1544
- }] });
1428
+ }], ctorParameters: function () { return [{ type: BXRestNavvyListsElement }]; } });
1545
1429
 
1546
1430
  class BXRestUser {
1547
- constructor(http, snackBar,
1548
- // private img: ImgServices,
1549
- //private dateTrace: DateTrace,
1550
- store, userMap) {
1431
+ constructor(http, snackBar) {
1551
1432
  this.http = http;
1552
1433
  this.snackBar = snackBar;
1553
- this.store = store;
1554
- this.userMap = userMap;
1555
1434
  this.url = {
1556
1435
  admin: [$user, 'admin'],
1557
1436
  get: [$user, $get],
@@ -1570,7 +1449,6 @@ class BXRestUser {
1570
1449
  this.def = {
1571
1450
  params: { ACTIVE: 1, start: 0 }
1572
1451
  };
1573
- this.user$ = this.store.select('users');
1574
1452
  }
1575
1453
  admin() {
1576
1454
  return this.http.get(this.url.admin);
@@ -1578,7 +1456,7 @@ class BXRestUser {
1578
1456
  get(params = {}) {
1579
1457
  let copyParams = clone(params);
1580
1458
  this.setDefParam(copyParams);
1581
- return this.http.post(this.url.get, copyParams, 'Не удалось получить пользователей', (v) => { return v.map(i => this.userMap.HttpToBX(i)); });
1459
+ return this.http.post(this.url.get, copyParams, 'Не удалось получить пользователей');
1582
1460
  // .pipe(
1583
1461
  // tap(v => {
1584
1462
  // if (v && v.result) {
@@ -1587,30 +1465,8 @@ class BXRestUser {
1587
1465
  // })
1588
1466
  // )
1589
1467
  }
1590
- current(update = false) {
1591
- if (update) {
1592
- return this.getSelfHttp();
1593
- }
1594
- else {
1595
- return this.user$.pipe(mergeMap$1(v => {
1596
- if (v && v.self) {
1597
- return of(v.self);
1598
- }
1599
- else {
1600
- return this.getSelfHttp();
1601
- }
1602
- }), first());
1603
- }
1604
- }
1605
- getSelfHttp() {
1468
+ current() {
1606
1469
  return this.http.get(this.url.current, {}, 'Не удалось получить пользователя');
1607
- // .pipe(
1608
- // tap(v => {
1609
- // if (v) {
1610
- // this.store.dispatch(saveSelf({self: v}))
1611
- // }
1612
- // }),
1613
- // )
1614
1470
  }
1615
1471
  access(access, textError = 'Не удалось получить права') {
1616
1472
  return this.http.get(this.url.access, { ACCESS: access }, textError);
@@ -1649,14 +1505,15 @@ class BXRestUser {
1649
1505
  // })
1650
1506
  // )
1651
1507
  // }
1652
- saveArrUser(users) {
1653
- let result = [];
1654
- for (const user of users) {
1655
- result.push(this.userMap.HttpToBX(user));
1656
- }
1657
- this.store.dispatch(saveArr({ arr: result }));
1658
- return result;
1659
- }
1508
+ // private saveArrUser(users: iBXRestUserHttp[]) {
1509
+ // let result: iBXRestUser [] = []
1510
+ // for (const user of users) {
1511
+ // result.push(this.userMap.HttpToBX(user))
1512
+ // }
1513
+ // this.store.dispatch(saveArr({arr: result}))
1514
+ //
1515
+ // return result
1516
+ // }
1660
1517
  search(params) {
1661
1518
  if (typeof params === 'string') {
1662
1519
  params = { FIND: params };
@@ -1674,15 +1531,14 @@ class BXRestUser {
1674
1531
  let sendData = {
1675
1532
  ID: user.ID,
1676
1533
  };
1677
- const userBX = this.userMap.BXtoHttp(user);
1678
- for (const field of fieldUpdate) {
1679
- if (userBX[field]) {
1680
- sendData[field] = userBX[field];
1681
- }
1682
- else {
1683
- this.snackBar.error('Одно из указанных полей отправлено не верно');
1684
- }
1685
- }
1534
+ // const userBX = this.userMap.BXtoHttp(user)
1535
+ // for (const field of fieldUpdate) {
1536
+ // if (userBX[field]) {
1537
+ // sendData[field] = userBX[field]
1538
+ // } else {
1539
+ // this.snackBar.error('Одно из указанных полей отправлено не верно')
1540
+ // }
1541
+ // }
1686
1542
  return this.http.post(this.url.update, sendData, 'Не удалось обновить пользователя с ID' + user.ID);
1687
1543
  }
1688
1544
  else {
@@ -1725,29 +1581,952 @@ class BXRestUser {
1725
1581
  }
1726
1582
  }
1727
1583
  }
1728
- BXRestUser.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUser, deps: [{ token: HttpBXServices }, { token: SnackBarService }, { token: i1$2.Store }, { token: BitrixApiUserMapServices }], target: i0.ɵɵFactoryTarget.Injectable });
1584
+ BXRestUser.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUser, deps: [{ token: HttpBXServices }, { token: SnackBarService }], target: i0.ɵɵFactoryTarget.Injectable });
1729
1585
  BXRestUser.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUser, providedIn: 'root' });
1730
1586
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUser, decorators: [{
1731
1587
  type: Injectable,
1732
1588
  args: [{
1733
1589
  providedIn: 'root'
1734
1590
  }]
1735
- }], ctorParameters: function () { return [{ type: HttpBXServices }, { type: SnackBarService }, { type: i1$2.Store }, { type: BitrixApiUserMapServices }]; } });
1591
+ }], ctorParameters: function () { return [{ type: HttpBXServices }, { type: SnackBarService }]; } });
1592
+
1593
+ class BXRestTasksTask {
1594
+ constructor(http) {
1595
+ this.http = http;
1596
+ this.url = {
1597
+ add: [$tasks, $task, $add],
1598
+ approve: [$tasks, $task, $approve],
1599
+ complete: [$tasks, $task, $complete],
1600
+ counters: {
1601
+ get: [$tasks, $task, $counters, $get], //Получает счетчики пользователя
1602
+ },
1603
+ deger: [$tasks, $task, $deger],
1604
+ delegate: [$tasks, $task, $delegate],
1605
+ delete: [$tasks, $task, $delete],
1606
+ disapprove: [$tasks, $task, $disapprove],
1607
+ favorite: {
1608
+ add: [$tasks, $task, $favorite, $add],
1609
+ delete: [$tasks, $task, $favorite, $delete], // Удаляет задачи из "Избранного"
1610
+ },
1611
+ files: {
1612
+ attach: [$tasks, $task, $files, $attach], // Прикрепляет загруженный на диск файл к задаче
1613
+ },
1614
+ get: [$tasks, $task, $get],
1615
+ getFields: [$tasks, $task, $getFields],
1616
+ getaccess: [$tasks, $task, $getaccess],
1617
+ history: {
1618
+ list: [$tasks, $task, $history, $list], // Получает историю задачи
1619
+ },
1620
+ list: [$tasks, $task, $list],
1621
+ pause: [$tasks, $task, $pause],
1622
+ renew: [$tasks, $task, $renew],
1623
+ start: [$tasks, $task, $start],
1624
+ startwatch: [$tasks, $task, 'startwatch'],
1625
+ stopwatch: [$tasks, $task, 'stopwatch'],
1626
+ update: [$tasks, $task, $update],
1627
+ result: {
1628
+ list: [$tasks, $task, $result, $list],
1629
+ addFromComment: [$tasks, $task, $result, 'addFromComment'],
1630
+ deleteFromComment: [$tasks, $task, $result, 'deleteFromComment'], // Удаление результата задачи по комментарию из которого он был создан
1631
+ },
1632
+ planner: {
1633
+ getlist: [$task, $planner, $getlist], // Возвращает массив, содержащий идентификаторы задач в плане на день
1634
+ }
1635
+ };
1636
+ }
1637
+ add(param) {
1638
+ return this.http.post(this.url.add, param);
1639
+ }
1640
+ }
1641
+ BXRestTasksTask.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTasksTask, deps: [{ token: HttpBXServices }], target: i0.ɵɵFactoryTarget.Injectable });
1642
+ BXRestTasksTask.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTasksTask, providedIn: 'root' });
1643
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTasksTask, decorators: [{
1644
+ type: Injectable,
1645
+ args: [{
1646
+ providedIn: 'root'
1647
+ }]
1648
+ }], ctorParameters: function () { return [{ type: HttpBXServices }]; } });
1649
+
1650
+ class BXRestTasks {
1651
+ constructor(task) {
1652
+ this.task = task;
1653
+ }
1654
+ }
1655
+ BXRestTasks.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTasks, deps: [{ token: BXRestTasksTask }], target: i0.ɵɵFactoryTarget.Injectable });
1656
+ BXRestTasks.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTasks, providedIn: 'root' });
1657
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTasks, decorators: [{
1658
+ type: Injectable,
1659
+ args: [{
1660
+ providedIn: 'root'
1661
+ }]
1662
+ }], ctorParameters: function () { return [{ type: BXRestTasksTask }]; } });
1663
+
1664
+ class BXRestDiskFile {
1665
+ constructor(http) {
1666
+ this.http = http;
1667
+ this.url = {
1668
+ getfields: [$disk, $file, $getFields],
1669
+ get: [$disk, $file, $get],
1670
+ rename: [$disk, $file, $rename],
1671
+ copyto: [$disk, $file, $copyto],
1672
+ moveto: [$disk, $file, $moveto],
1673
+ delete: [$disk, $file, $delete],
1674
+ markdeleted: [$disk, $file, $markdeleted],
1675
+ restore: [$disk, $file, $restore],
1676
+ uploadversion: [$disk, $file, 'uploadversion'],
1677
+ getVersions: [$disk, $file, 'getVersions'],
1678
+ restoreFromVersion: [$disk, $file, 'restoreFromVersion'],
1679
+ getExternalLink: [$disk, $file, 'getexternallink'] // Возвращает публичную ссылку на файл
1680
+ };
1681
+ }
1682
+ get(id) {
1683
+ return this.http.post(this.url.get, { id: id }, 'Не удалось получить файл');
1684
+ }
1685
+ markDel(id) {
1686
+ return this.http.post(this.url.markdeleted, { id: id }, 'Не удалось переместить файл в корзину');
1687
+ }
1688
+ }
1689
+ BXRestDiskFile.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskFile, deps: [{ token: HttpBXServices }], target: i0.ɵɵFactoryTarget.Injectable });
1690
+ BXRestDiskFile.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskFile, providedIn: 'root' });
1691
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskFile, decorators: [{
1692
+ type: Injectable,
1693
+ args: [{
1694
+ providedIn: 'root'
1695
+ }]
1696
+ }], ctorParameters: function () { return [{ type: HttpBXServices }]; } });
1697
+
1698
+ class BXRestDiskFolder {
1699
+ constructor(http) {
1700
+ this.http = http;
1701
+ this.url = {
1702
+ getfields: [$disk, $folder, $getFields],
1703
+ get: [$disk, $folder, $get],
1704
+ getchildren: [$disk, $folder, $getchildren],
1705
+ addsubfolder: [$disk, $folder, 'addsubfolder'],
1706
+ copyto: [$disk, $folder, $copyto],
1707
+ moveto: [$disk, $folder, $moveto],
1708
+ rename: [$disk, $folder, $rename],
1709
+ deletetree: [$disk, $folder, 'deletetree'],
1710
+ markdeleted: [$disk, $folder, $markdeleted],
1711
+ restore: [$disk, $folder, $restore],
1712
+ uploadfile: [$disk, $folder, $uploadfile],
1713
+ getExternalLink: [$disk, $folder, 'getExternalLink'] // Метод возвращает публичную ссылку
1714
+ };
1715
+ }
1716
+ uploadfile(id, fileContent) {
1717
+ return this.http.post(this.url.uploadfile, {
1718
+ id: id,
1719
+ fileContent: fileContent,
1720
+ data: {
1721
+ NAME: fileContent[0]
1722
+ } // Обязательное поле NAME - имя нового файла
1723
+ // generateUniqueName Необязательный, по умолчанию false. При указании true, для загружаемого файла будет уникализировано имя, добавлением суффикса (1), (2) и т.п.
1724
+ // rights Необязательный, по умолчанию пустой массив. Массив прав доступа на загружаемый файл.
1725
+ });
1726
+ }
1727
+ getchildren(id) {
1728
+ return this.http.post(this.url.getchildren, { id: id }, 'get folders and files');
1729
+ }
1730
+ }
1731
+ BXRestDiskFolder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskFolder, deps: [{ token: HttpBXServices }], target: i0.ɵɵFactoryTarget.Injectable });
1732
+ BXRestDiskFolder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskFolder, providedIn: 'root' });
1733
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskFolder, decorators: [{
1734
+ type: Injectable,
1735
+ args: [{
1736
+ providedIn: 'root'
1737
+ }]
1738
+ }], ctorParameters: function () { return [{ type: HttpBXServices }]; } });
1739
+
1740
+ class BXRestDisk {
1741
+ constructor(file, folder) {
1742
+ this.file = file;
1743
+ this.folder = folder;
1744
+ }
1745
+ }
1746
+ BXRestDisk.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDisk, deps: [{ token: BXRestDiskFile }, { token: BXRestDiskFolder }], target: i0.ɵɵFactoryTarget.Injectable });
1747
+ BXRestDisk.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDisk, providedIn: 'root' });
1748
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDisk, decorators: [{
1749
+ type: Injectable,
1750
+ args: [{
1751
+ providedIn: 'root'
1752
+ }]
1753
+ }], ctorParameters: function () { return [{ type: BXRestDiskFile }, { type: BXRestDiskFolder }]; } });
1754
+
1755
+ const save = createAction('[Users Component] Save', props());
1756
+ const saveArr = createAction('[Users Component] Save Arr', props());
1757
+ const update = createAction('[Users Component] Update', props());
1758
+ const loadAll = createAction('[Users Component] loadAll', props());
1759
+ const saveSelf = createAction('[Users Component] saveSelf', props());
1760
+ const saveIDLoadedDepartment = createAction('[Users Component] saveIDLoadedDepartment', props());
1761
+ const initialState = {
1762
+ load: {
1763
+ all: false,
1764
+ department: []
1765
+ },
1766
+ self: undefined,
1767
+ data: []
1768
+ };
1769
+ const _usersReducer = createReducer(initialState, on(saveIDLoadedDepartment, (s, data) => {
1770
+ let copy = clone(s);
1771
+ copy.load.department = [...copy.load.department, ...data.id];
1772
+ return copy;
1773
+ }), on(save, (s, data) => {
1774
+ const find = s.data.find(v => v.ID === data.ID);
1775
+ if (!find) {
1776
+ const copy = clone(s);
1777
+ copy.data.push(data);
1778
+ return copy;
1779
+ }
1780
+ return s;
1781
+ }), on(saveArr, (s, data) => {
1782
+ const copy = clone(s);
1783
+ if (copy.data && copy.data.length) {
1784
+ for (const user of data.arr) {
1785
+ const find = copy.data.find(v => v.ID === user.ID);
1786
+ if (!find) {
1787
+ copy.data.push(user);
1788
+ }
1789
+ }
1790
+ }
1791
+ else {
1792
+ copy.data = [...data.arr];
1793
+ }
1794
+ return copy;
1795
+ }), on(update, (s, data) => {
1796
+ const copy = clone(s);
1797
+ let find = copy.data.findIndex(v => v.ID === data.ID);
1798
+ if (find !== -1) {
1799
+ const copy = clone(s);
1800
+ copy.data.splice(find, 1, data);
1801
+ // copy.data.push(data)
1802
+ return copy;
1803
+ }
1804
+ return s;
1805
+ }), on(loadAll, (s, data) => {
1806
+ if (data.load !== s.load.all) {
1807
+ const copy = clone(s);
1808
+ copy.load.all = data.load;
1809
+ return copy;
1810
+ }
1811
+ return s;
1812
+ }), on(saveSelf, (s, data) => {
1813
+ return { ...s, self: data.self };
1814
+ }));
1815
+ function usersReducer(state = initialState, action) {
1816
+ return _usersReducer(state, action);
1817
+ }
1818
+
1819
+ class BXRestUserMap extends BaseMapServices {
1820
+ current(user) {
1821
+ let res = Object.assign(clone(user), {
1822
+ ID: this.toNum(user.ID),
1823
+ IS_ONLINE: this.toBool(user.IS_ONLINE),
1824
+ DATE_REGISTER: this.toDate(user.DATE_REGISTER),
1825
+ PERSONAL_BIRTHDAY: this.toDate(user.PERSONAL_BIRTHDAY),
1826
+ });
1827
+ if (user.LAST_LOGIN) {
1828
+ res.LAST_LOGIN = this.toDate(user.LAST_LOGIN);
1829
+ }
1830
+ return res;
1831
+ }
1832
+ BXtoHttp(user) {
1833
+ return Object.assign(clone(user), {
1834
+ ID: this.toStr(user.ID),
1835
+ IS_ONLINE: this.toBXYorN(user.IS_ONLINE),
1836
+ DATE_REGISTER: this.getBXStrTime(user.DATE_REGISTER),
1837
+ PERSONAL_BIRTHDAY: this.toStr(user.PERSONAL_BIRTHDAY),
1838
+ LAST_LOGIN: this.toStr(user.LAST_LOGIN)
1839
+ });
1840
+ }
1841
+ getFIO(user) {
1842
+ let res = '';
1843
+ if (!user.LAST_NAME) {
1844
+ const SECOND_NAME = (user.SECOND_NAME) ? user.SECOND_NAME : '';
1845
+ const NAME = (user.NAME) ? user.NAME : '';
1846
+ res = NAME + ' ' + SECOND_NAME;
1847
+ }
1848
+ else if (!user.NAME) {
1849
+ res = user.LAST_NAME;
1850
+ }
1851
+ else if (!user.SECOND_NAME) {
1852
+ res = user.LAST_NAME + ' ' + user.NAME;
1853
+ }
1854
+ else {
1855
+ res = user.LAST_NAME + ' ' + user.NAME + ' ' + user.SECOND_NAME;
1856
+ }
1857
+ return res.trim();
1858
+ }
1859
+ getFI(user) {
1860
+ let res = '';
1861
+ if (!user.LAST_NAME) {
1862
+ const NAME = (user.NAME) ? user.NAME : '';
1863
+ res = NAME;
1864
+ }
1865
+ else if (!user.NAME) {
1866
+ res = user.LAST_NAME;
1867
+ }
1868
+ else {
1869
+ res = user.LAST_NAME + ' ' + user.NAME;
1870
+ }
1871
+ return res.trim();
1872
+ }
1873
+ getFIOShort(user) {
1874
+ let res = '';
1875
+ if (!user.LAST_NAME) {
1876
+ const SECOND_NAME = (user.SECOND_NAME) ? user.SECOND_NAME : '';
1877
+ const NAME = (user.NAME) ? user.NAME : '';
1878
+ res = NAME + ' ' + SECOND_NAME;
1879
+ }
1880
+ else if (!user.NAME) {
1881
+ res = user.LAST_NAME;
1882
+ }
1883
+ else if (!user.SECOND_NAME) {
1884
+ res = user.LAST_NAME + ' ' + user.NAME.charAt(0).toUpperCase() + '.';
1885
+ }
1886
+ else {
1887
+ res =
1888
+ user.LAST_NAME + ' ' +
1889
+ user.NAME.charAt(0).toUpperCase() + '.' +
1890
+ user.SECOND_NAME.charAt(0).toUpperCase() + '.';
1891
+ }
1892
+ return res.trim();
1893
+ }
1894
+ }
1895
+ BXRestUserMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUserMap, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1896
+ BXRestUserMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUserMap, providedIn: 'root' });
1897
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUserMap, decorators: [{
1898
+ type: Injectable,
1899
+ args: [{
1900
+ providedIn: 'root'
1901
+ }]
1902
+ }] });
1903
+
1904
+ class BXRestNavvyUser {
1905
+ constructor(BXRestUser, store, BXRestUserMap) {
1906
+ this.BXRestUser = BXRestUser;
1907
+ this.store = store;
1908
+ this.BXRestUserMap = BXRestUserMap;
1909
+ this.user$ = this.store.select('users');
1910
+ }
1911
+ current(update = false) {
1912
+ if (update) {
1913
+ return this.self();
1914
+ }
1915
+ else {
1916
+ return this.user$.pipe(mergeMap$1(v => {
1917
+ if (v && v.self) {
1918
+ return of(v.self);
1919
+ }
1920
+ else {
1921
+ return this.self();
1922
+ }
1923
+ }), first());
1924
+ }
1925
+ }
1926
+ self() {
1927
+ return this.BXRestUser.current()
1928
+ .pipe(map(v => {
1929
+ if (v && v.result) {
1930
+ return this.BXRestUserMap.current(v.result);
1931
+ }
1932
+ return undefined;
1933
+ }), tap(v => {
1934
+ if (v) {
1935
+ this.store.dispatch(saveSelf({ self: v }));
1936
+ }
1937
+ }));
1938
+ }
1939
+ }
1940
+ BXRestNavvyUser.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyUser, deps: [{ token: BXRestUser }, { token: i1$2.Store }, { token: BXRestUserMap }], target: i0.ɵɵFactoryTarget.Injectable });
1941
+ BXRestNavvyUser.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyUser, providedIn: 'root' });
1942
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyUser, decorators: [{
1943
+ type: Injectable,
1944
+ args: [{
1945
+ providedIn: 'root'
1946
+ }]
1947
+ }], ctorParameters: function () { return [{ type: BXRestUser }, { type: i1$2.Store }, { type: BXRestUserMap }]; } });
1948
+
1949
+ class BXRestTaskMap extends BaseMapServices {
1950
+ TaskBXHttpToTaskBX(item) {
1951
+ let result = {};
1952
+ if (item.id) {
1953
+ result.id = this.toNum(item.id);
1954
+ }
1955
+ if (item.parentId) {
1956
+ result.parentId = this.toNum(item.parentId);
1957
+ }
1958
+ if (item.priority) {
1959
+ result.priority = this.toNum(item.priority);
1960
+ }
1961
+ if (item.status) {
1962
+ result.status = this.toNum(item.status);
1963
+ }
1964
+ if (item.multitask) {
1965
+ result.multitask = item.multitask === 'Y';
1966
+ }
1967
+ if (item.groupId) {
1968
+ result.groupId = this.toNum(item.groupId);
1969
+ }
1970
+ if (item.stageId) {
1971
+ result.stageId = this.toNum(item.stageId);
1972
+ }
1973
+ if (item.createdBy) {
1974
+ result.createdBy = this.toNum(item.createdBy);
1975
+ }
1976
+ if (item.createdDate) {
1977
+ result.createdDate = this.toDate(item.createdDate);
1978
+ }
1979
+ if (item.responsibleId) {
1980
+ result.responsibleId = this.toNum(item.responsibleId);
1981
+ }
1982
+ if (item.changedBy) {
1983
+ result.changedBy = this.toNum(item.changedBy);
1984
+ }
1985
+ if (item.changedDate) {
1986
+ result.changedDate = this.toDate(item.changedDate);
1987
+ }
1988
+ if (item.statusChangedBy) {
1989
+ result.statusChangedBy = this.toNum(item.statusChangedBy);
1990
+ }
1991
+ if (item.statusChangedDate) {
1992
+ result.statusChangedDate = this.toDate(item.statusChangedDate);
1993
+ }
1994
+ if (item.closedBy) {
1995
+ result.closedBy = this.toNum(item.closedBy);
1996
+ }
1997
+ if (item.closedDate) {
1998
+ result.closedDate = this.toDate(item.closedDate);
1999
+ }
2000
+ if (item.dateStart) {
2001
+ result.dateStart = this.toDate(item.dateStart);
2002
+ }
2003
+ if (item.deadline) {
2004
+ result.deadline = this.toDate(item.deadline);
2005
+ }
2006
+ if (item.startDatePlan) {
2007
+ result.startDatePlan = this.toDate(item.startDatePlan);
2008
+ }
2009
+ if (item.endDatePlan) {
2010
+ result.endDatePlan = this.toDate(item.endDatePlan);
2011
+ }
2012
+ if (item.forumTopicId) {
2013
+ result.forumTopicId = this.toNum(item.forumTopicId);
2014
+ }
2015
+ if (item.forumId) {
2016
+ result.forumId = this.toNum(item.forumId);
2017
+ }
2018
+ if (item.viewedDate) {
2019
+ result.viewedDate = this.toDate(item.viewedDate);
2020
+ }
2021
+ if (item.sorting) {
2022
+ result.sorting = this.toNum(item.sorting);
2023
+ }
2024
+ if (item.durationPlan) {
2025
+ result.durationPlan = this.toNum(item.durationPlan);
2026
+ }
2027
+ if (item.descriptionInBbcode) {
2028
+ result.descriptionInBbcode = item.descriptionInBbcode === 'Y';
2029
+ }
2030
+ if (item.accomplices) {
2031
+ result.accomplices = item.accomplices.map(i => this.toNum(i));
2032
+ }
2033
+ if (item.subStatus) {
2034
+ result.subStatus = this.toNum(item.subStatus);
2035
+ }
2036
+ if (item.creator) {
2037
+ result.creator = Object.assign(item.creator, { id: this.toNum(item.creator.id) });
2038
+ }
2039
+ if (item.responsible) {
2040
+ result.responsible = Object.assign(item.responsible, { id: this.toNum(item.responsible.id) });
2041
+ }
2042
+ if (item.accomplicesData) {
2043
+ result.accomplicesData =
2044
+ Object.values(item.accomplicesData).map(i => Object.assign(i, { id: this.toNum(i.id) }));
2045
+ }
2046
+ if (item.allowTimeTracking) {
2047
+ result.allowTimeTracking = item.allowTimeTracking === 'Y';
2048
+ }
2049
+ return Object.assign(item, result);
2050
+ }
2051
+ }
2052
+ BXRestTaskMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTaskMap, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
2053
+ BXRestTaskMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTaskMap, providedIn: 'root' });
2054
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTaskMap, decorators: [{
2055
+ type: Injectable,
2056
+ args: [{
2057
+ providedIn: 'root'
2058
+ }]
2059
+ }] });
2060
+
2061
+ // export interface TimeProcess {
2062
+ // total: number,
2063
+ // next: number
2064
+ // }
2065
+ class BXRestNavvyTasksTask {
2066
+ // pageSize = 50
2067
+ // nowLoad$ = new ReplaySubject<TimeProcess>(1)
2068
+ // def: { select: iBXRestTaskFieldsName[] } = {
2069
+ // select: ['ID', 'PARENT_ID', 'TITLE', 'DESCRIPTION', 'MARK', 'PRIORITY', 'STATUS', 'MULTITASK',
2070
+ // 'GROUP_ID', 'STAGE_ID', 'CREATED_BY', 'CREATED_DATE', 'RESPONSIBLE_ID', 'ACCOMPLICES', 'AUDITORS',
2071
+ // 'CHANGED_BY', 'CHANGED_DATE', 'STATUS_CHANGED_DATE', 'CLOSED_BY', 'CLOSED_DATE', 'DATE_START', 'VIEWED_DATE',
2072
+ // 'DEADLINE', 'START_DATE_PLAN', 'END_DATE_PLAN', 'FORKED_BY_TEMPLATE_ID', 'TIME_ESTIMATE', 'TIME_SPENT_IN_LOGS',
2073
+ // 'TAGS', 'ALLOW_TIME_TRACKING'
2074
+ // ]
2075
+ // }
2076
+ // storeTask$: Observable<iStoreTask>
2077
+ constructor(BXRestTasks, snackBar,
2078
+ // private store: Store<{ tasks: IStoreTask }>,
2079
+ taskMap) {
2080
+ this.BXRestTasks = BXRestTasks;
2081
+ this.snackBar = snackBar;
2082
+ this.taskMap = taskMap;
2083
+ // this.storeTask$ = this.store.select('tasks')
2084
+ // this.nowLoad$.next({
2085
+ // total: 0,
2086
+ // next: 0
2087
+ // })
2088
+ }
2089
+ add(param) {
2090
+ return this.BXRestTasks.add(param).pipe(map(v => {
2091
+ if (v && v.result && v.result.task) {
2092
+ return this.taskMap.TaskBXHttpToTaskBX(v.result.task);
2093
+ }
2094
+ return undefined;
2095
+ }));
2096
+ // return this.http.post<{ task: TaskBXHttp }>(this.url.add, {fields: param}).pipe(
2097
+ // map(v => {
2098
+ // if (v && v.result && v.result.task) {
2099
+ // return Object.assign(
2100
+ // v,
2101
+ // {
2102
+ // result: this.taskBXMap.TaskBXHttpToTaskBX(v.result.task)
2103
+ // })
2104
+ // }
2105
+ // return undefined
2106
+ // }
2107
+ // ))
2108
+ }
2109
+ }
2110
+ BXRestNavvyTasksTask.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyTasksTask, deps: [{ token: BXRestTasksTask }, { token: SnackBarService }, { token: BXRestTaskMap }], target: i0.ɵɵFactoryTarget.Injectable });
2111
+ BXRestNavvyTasksTask.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyTasksTask, providedIn: 'root' });
2112
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyTasksTask, decorators: [{
2113
+ type: Injectable,
2114
+ args: [{
2115
+ providedIn: 'root'
2116
+ }]
2117
+ }], ctorParameters: function () { return [{ type: BXRestTasksTask }, { type: SnackBarService }, { type: BXRestTaskMap }]; } });
2118
+
2119
+ class BXRestNavvyTasks {
2120
+ constructor(task) {
2121
+ this.task = task;
2122
+ }
2123
+ }
2124
+ BXRestNavvyTasks.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyTasks, deps: [{ token: BXRestNavvyTasksTask }], target: i0.ɵɵFactoryTarget.Injectable });
2125
+ BXRestNavvyTasks.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyTasks, providedIn: 'root' });
2126
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyTasks, decorators: [{
2127
+ type: Injectable,
2128
+ args: [{
2129
+ providedIn: 'root'
2130
+ }]
2131
+ }], ctorParameters: function () { return [{ type: BXRestNavvyTasksTask }]; } });
2132
+
2133
+ class BXRestNavvyDiskFile extends BaseServices {
2134
+ constructor(BXRestDiskFile) {
2135
+ super();
2136
+ this.BXRestDiskFile = BXRestDiskFile;
2137
+ }
2138
+ get(id) {
2139
+ return this.BXRestDiskFile.get(id).pipe(map(v => {
2140
+ if (v && v.result) {
2141
+ let newResult = Object.assign(v.result, { SIZE: this.toNum(v.result.SIZE) });
2142
+ return Object.assign(v, {
2143
+ result: newResult
2144
+ });
2145
+ }
2146
+ return undefined;
2147
+ }));
2148
+ }
2149
+ markDel(id) {
2150
+ return this.BXRestDiskFile.markDel(id)
2151
+ .pipe(map(v => {
2152
+ if (v && v.result) {
2153
+ let newResult = Object.assign(v.result, { SIZE: this.toNum(v.result.SIZE) });
2154
+ return Object.assign(v, {
2155
+ result: newResult
2156
+ });
2157
+ }
2158
+ return undefined;
2159
+ }));
2160
+ }
2161
+ }
2162
+ BXRestNavvyDiskFile.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskFile, deps: [{ token: BXRestDiskFile }], target: i0.ɵɵFactoryTarget.Injectable });
2163
+ BXRestNavvyDiskFile.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskFile, providedIn: 'root' });
2164
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskFile, decorators: [{
2165
+ type: Injectable,
2166
+ args: [{
2167
+ providedIn: 'root'
2168
+ }]
2169
+ }], ctorParameters: function () { return [{ type: BXRestDiskFile }]; } });
2170
+
2171
+ class BXRestMapDiskBase extends BaseMapServices {
2172
+ separationFoldersAndFiles(arr) {
2173
+ let result = { file: [], folder: [] };
2174
+ for (let i of arr) {
2175
+ if (this.instanceOfiFile(i)) {
2176
+ result.file.push(Object.assign(i, {
2177
+ CREATED_BY: this.toNum(i.CREATED_BY),
2178
+ CREATE_TIME: this.toDate(i.CREATE_TIME),
2179
+ DELETED_BY: this.toNum(i.DELETED_BY),
2180
+ DELETED_TYPE: this.toNum(i.DELETED_TYPE),
2181
+ DELETE_TIME: (i.DELETE_TIME) ? this.toDate(i.DELETE_TIME) : null,
2182
+ ID: this.toNum(i.ID),
2183
+ PARENT_ID: this.toNum(i.PARENT_ID),
2184
+ REAL_OBJECT_ID: this.toNum(i.REAL_OBJECT_ID),
2185
+ STORAGE_ID: this.toNum(i.STORAGE_ID),
2186
+ UPDATED_BY: this.toNum(i.UPDATED_BY),
2187
+ UPDATE_TIME: this.toDate(i.UPDATE_TIME),
2188
+ SIZE: this.toNum(i.SIZE),
2189
+ }));
2190
+ }
2191
+ else if (this.instanceOfiFolder(i)) {
2192
+ result.folder.push(Object.assign(i, {
2193
+ CREATED_BY: this.toNum(i.CREATED_BY),
2194
+ CREATE_TIME: this.toDate(i.CREATE_TIME),
2195
+ DELETED_BY: this.toNum(i.DELETED_BY),
2196
+ DELETED_TYPE: this.toNum(i.DELETED_TYPE),
2197
+ DELETE_TIME: (i.DELETE_TIME) ? this.toDate(i.DELETE_TIME) : null,
2198
+ ID: this.toNum(i.ID),
2199
+ PARENT_ID: this.toNum(i.PARENT_ID),
2200
+ REAL_OBJECT_ID: this.toNum(i.REAL_OBJECT_ID),
2201
+ STORAGE_ID: this.toNum(i.STORAGE_ID),
2202
+ UPDATED_BY: this.toNum(i.UPDATED_BY),
2203
+ UPDATE_TIME: this.toDate(i.UPDATE_TIME),
2204
+ }));
2205
+ }
2206
+ }
2207
+ return result;
2208
+ }
2209
+ instanceOfiFile(object) {
2210
+ return object && object.TYPE && object.TYPE === 'file';
2211
+ }
2212
+ instanceOfiFolder(object) {
2213
+ return object && object.TYPE && object.TYPE === 'folder';
2214
+ }
2215
+ }
2216
+ BXRestMapDiskBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapDiskBase, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
2217
+ BXRestMapDiskBase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapDiskBase, providedIn: 'root' });
2218
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapDiskBase, decorators: [{
2219
+ type: Injectable,
2220
+ args: [{
2221
+ providedIn: 'root'
2222
+ }]
2223
+ }] });
2224
+
2225
+ class BXRestMapDiskFolder extends BXRestMapDiskBase {
2226
+ getContent(arr) {
2227
+ return this.separationFoldersAndFiles(arr);
2228
+ }
2229
+ }
2230
+ BXRestMapDiskFolder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapDiskFolder, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
2231
+ BXRestMapDiskFolder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapDiskFolder, providedIn: 'root' });
2232
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapDiskFolder, decorators: [{
2233
+ type: Injectable,
2234
+ args: [{
2235
+ providedIn: 'root'
2236
+ }]
2237
+ }] });
2238
+
2239
+ class BXRestDiskNavvyFolder {
2240
+ constructor(BXRestDiskFolder, BXRestMapDiskFolder
2241
+ // private diskFileBaseMap: diskFileBaseMapServices
2242
+ ) {
2243
+ this.BXRestDiskFolder = BXRestDiskFolder;
2244
+ this.BXRestMapDiskFolder = BXRestMapDiskFolder;
2245
+ }
2246
+ // uploadfile(id: number, fileContent: string[]) {
2247
+ // return this.httpPost(
2248
+ // this.url.uploadfile,
2249
+ // {
2250
+ // id: id, // Идентификатор папки. В текущем API загружать файл по пути к папке невозможно. Необходимо обязательно вычислить ID папки
2251
+ // fileContent: fileContent, // Аналогично 'DETAIL_PICTURE' в примере Обработка файлов (['имя файла', 'содержимое в base64'])
2252
+ // data: {
2253
+ // NAME: fileContent[0]
2254
+ // } // Обязательное поле NAME - имя нового файла
2255
+ // // generateUniqueName Необязательный, по умолчанию false. При указании true, для загружаемого файла будет уникализировано имя, добавлением суффикса (1), (2) и т.п.
2256
+ // // rights Необязательный, по умолчанию пустой массив. Массив прав доступа на загружаемый файл.
2257
+ // }
2258
+ // )
2259
+ // }
2260
+ getchildren(id) {
2261
+ return this.BXRestDiskFolder.getchildren(id).pipe(map(v => {
2262
+ if (v && v.result) {
2263
+ return this.BXRestMapDiskFolder.getContent(BXRestMapResult(v));
2264
+ }
2265
+ return { file: [], folder: [] };
2266
+ }));
2267
+ }
2268
+ }
2269
+ BXRestDiskNavvyFolder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskNavvyFolder, deps: [{ token: BXRestDiskFolder }, { token: BXRestMapDiskFolder }], target: i0.ɵɵFactoryTarget.Injectable });
2270
+ BXRestDiskNavvyFolder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskNavvyFolder, providedIn: 'root' });
2271
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskNavvyFolder, decorators: [{
2272
+ type: Injectable,
2273
+ args: [{
2274
+ providedIn: 'root'
2275
+ }]
2276
+ }], ctorParameters: function () { return [{ type: BXRestDiskFolder }, { type: BXRestMapDiskFolder }]; } });
2277
+
2278
+ class BXRestMapDiskStorage extends BXRestMapDiskBase {
2279
+ getchildren(arr) {
2280
+ return this.separationFoldersAndFiles(arr);
2281
+ }
2282
+ }
2283
+ BXRestMapDiskStorage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapDiskStorage, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
2284
+ BXRestMapDiskStorage.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapDiskStorage, providedIn: 'root' });
2285
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapDiskStorage, decorators: [{
2286
+ type: Injectable,
2287
+ args: [{
2288
+ providedIn: 'root'
2289
+ }]
2290
+ }] });
2291
+
2292
+ class BXRestDiskStorage {
2293
+ constructor(http) {
2294
+ this.http = http;
2295
+ this.url = {
2296
+ getfields: [$disk, $storage, $getFields],
2297
+ get: [$disk, $storage, $get],
2298
+ rename: [$disk, $storage, $rename],
2299
+ // Допустимо переименование только хранилища приложения (см. disk.storage.getforapp)
2300
+ getlist: [$disk, $storage, $getlist],
2301
+ gettypes: [$disk, $storage, $getTypes],
2302
+ addfolder: [$disk, $storage, 'addfolder'],
2303
+ getchildren: [$disk, $storage, $getchildren],
2304
+ // которые находятся непосредственно в корне хранилища
2305
+ uploadfile: [$disk, $storage, $uploadfile],
2306
+ getforapp: [$disk, $storage, 'getforapp'] // Возвращает описание хранилища,
2307
+ // с которым может работать приложение для хранения своих данных (файлов и папок)
2308
+ };
2309
+ }
2310
+ getforapp() {
2311
+ return this.http.post(this.url.getforapp, {}, 'get root app folder');
2312
+ }
2313
+ // TODO: разобраться с фильтром
2314
+ getchildren(param) {
2315
+ return this.http.post(this.url.getchildren, param, 'get root app folders and files');
2316
+ }
2317
+ // TODO: разобраться что возвращает и что вставлять
2318
+ addfolder(param) {
2319
+ return this.http.post(this.url.addfolder, param);
2320
+ }
2321
+ uploadfile(param) {
2322
+ return this.http.post(this.url.uploadfile, param);
2323
+ }
2324
+ }
2325
+ BXRestDiskStorage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskStorage, deps: [{ token: HttpBXServices }], target: i0.ɵɵFactoryTarget.Injectable });
2326
+ BXRestDiskStorage.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskStorage, providedIn: 'root' });
2327
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskStorage, decorators: [{
2328
+ type: Injectable,
2329
+ args: [{
2330
+ providedIn: 'root'
2331
+ }]
2332
+ }], ctorParameters: function () { return [{ type: HttpBXServices }]; } });
2333
+
2334
+ class BXRestNavvyDiskStorage {
2335
+ // BXDiskFolder$ = new Observable<BXDiskFolderStore>()
2336
+ constructor(BXRestDiskStorage, BXRestMapDiskStorage
2337
+ // private store: Store<{ BXDiskFolder: BXDiskFolderStore }>,
2338
+ ) {
2339
+ this.BXRestDiskStorage = BXRestDiskStorage;
2340
+ this.BXRestMapDiskStorage = BXRestMapDiskStorage;
2341
+ // this.BXDiskFolder$ = this.store.select('BXDiskFolder')
2342
+ }
2343
+ getforapp() {
2344
+ // return this.BXDiskFolder$.pipe(
2345
+ // take(1),
2346
+ // mergeMap(
2347
+ // saveData => {
2348
+ // if (saveData.folder.app) {
2349
+ // return of(saveData.folder.app)
2350
+ // }
2351
+ return this.BXRestDiskStorage.getforapp().pipe(map(v => BXRestMapResult(v)));
2352
+ // }
2353
+ // )
2354
+ // )
2355
+ }
2356
+ // TODO: разобраться с фильтром позже
2357
+ getchildren(param) {
2358
+ return this.BXRestDiskStorage.getchildren(param).pipe(map(v => BXRestMapResult(v)), map(v => {
2359
+ if (v && v.length) {
2360
+ return this.BXRestMapDiskStorage.getchildren(v);
2361
+ }
2362
+ return { file: [], folder: [] };
2363
+ }));
2364
+ }
2365
+ // TODO: разобраться что возвращает и что вставлять
2366
+ addfolder(param) {
2367
+ return this.BXRestDiskStorage.addfolder(param).pipe(map(v => BXRestMapResult(v)));
2368
+ }
2369
+ uploadfile(param) {
2370
+ return this.BXRestDiskStorage.uploadfile(param);
2371
+ }
2372
+ }
2373
+ BXRestNavvyDiskStorage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskStorage, deps: [{ token: BXRestDiskStorage }, { token: BXRestMapDiskStorage }], target: i0.ɵɵFactoryTarget.Injectable });
2374
+ BXRestNavvyDiskStorage.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskStorage, providedIn: 'root' });
2375
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskStorage, decorators: [{
2376
+ type: Injectable,
2377
+ args: [{
2378
+ providedIn: 'root'
2379
+ }]
2380
+ }], ctorParameters: function () { return [{ type: BXRestDiskStorage }, { type: BXRestMapDiskStorage }]; } });
2381
+
2382
+ class BXRestNavvyDiskOperation {
2383
+ constructor(folder, disk, storage) {
2384
+ this.folder = folder;
2385
+ this.disk = disk;
2386
+ this.storage = storage;
2387
+ }
2388
+ // данные файла в base64
2389
+ loadFileInAppFolder(file) {
2390
+ return this.storage.getforapp().pipe(take$1(1), mergeMap$1(infoFolder => {
2391
+ if (infoFolder) {
2392
+ return this.storage.uploadfile({
2393
+ id: infoFolder.ID,
2394
+ fileContent: [file.name, file.val],
2395
+ data: {
2396
+ NAME: file.name
2397
+ },
2398
+ generateUniqueName: true
2399
+ }).pipe(map(v => BXRestMapResult(v)));
2400
+ }
2401
+ return of(undefined);
2402
+ }));
2403
+ }
2404
+ getOfCreateRootContentFolderApp(folderName) {
2405
+ return this.getOfCreateRootFolderApp(folderName).pipe(mergeMap$1(v => {
2406
+ if (v) {
2407
+ return this.folder.getchildren(v.ID);
2408
+ }
2409
+ return of(undefined);
2410
+ }));
2411
+ }
2412
+ getRootFoldersApp() {
2413
+ // return this.BXDiskFolder$.pipe(
2414
+ // take(1),
2415
+ // mergeMap(
2416
+ // saveData => {
2417
+ // if (saveData.content.root.app) {
2418
+ // return of(saveData.content.root.app)
2419
+ // }
2420
+ return this.storage.getforapp().pipe(mergeMap$1(v => {
2421
+ if (v && v.ID) {
2422
+ return this.storage.getchildren({ id: v.ID });
2423
+ // .pipe(
2424
+ // tap(v => {
2425
+ // if (v) {
2426
+ // this.store.dispatch(saveContentRootAppInfo({value: v}))
2427
+ // }
2428
+ // })
2429
+ // )
2430
+ }
2431
+ return of(undefined);
2432
+ }));
2433
+ // }
2434
+ // )
2435
+ // )
2436
+ }
2437
+ /**
2438
+ * Получать или создать папку, если её нет, с определенным именем для приложения
2439
+ * @param folderName
2440
+ */
2441
+ getOfCreateRootFolderApp(folderName) {
2442
+ return this.getRootFoldersApp().pipe(mergeMap$1(v => {
2443
+ if (v) {
2444
+ if (v.folder.length) {
2445
+ let find = v.folder.find(i => i.NAME === folderName);
2446
+ if (find) {
2447
+ return of(find);
2448
+ }
2449
+ }
2450
+ }
2451
+ return this.storage.getforapp().pipe(mergeMap$1(v => {
2452
+ if (v && v.ID) {
2453
+ return this.storage.addfolder({ id: v.ID, data: { NAME: folderName } });
2454
+ }
2455
+ return of(undefined);
2456
+ }));
2457
+ }));
2458
+ }
2459
+ }
2460
+ BXRestNavvyDiskOperation.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskOperation, deps: [{ token: BXRestDiskNavvyFolder }, { token: BXRestNavvyDiskFile }, { token: BXRestNavvyDiskStorage }], target: i0.ɵɵFactoryTarget.Injectable });
2461
+ BXRestNavvyDiskOperation.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskOperation, providedIn: 'root' });
2462
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskOperation, decorators: [{
2463
+ type: Injectable,
2464
+ args: [{
2465
+ providedIn: 'root'
2466
+ }]
2467
+ }], ctorParameters: function () { return [{ type: BXRestDiskNavvyFolder }, { type: BXRestNavvyDiskFile }, { type: BXRestNavvyDiskStorage }]; } });
2468
+
2469
+ class BXRestNavvyDisk {
2470
+ constructor(file, folder, operation) {
2471
+ this.file = file;
2472
+ this.folder = folder;
2473
+ this.operation = operation;
2474
+ }
2475
+ }
2476
+ BXRestNavvyDisk.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDisk, deps: [{ token: BXRestNavvyDiskFile }, { token: BXRestDiskNavvyFolder }, { token: BXRestNavvyDiskOperation }], target: i0.ɵɵFactoryTarget.Injectable });
2477
+ BXRestNavvyDisk.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDisk, providedIn: 'root' });
2478
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDisk, decorators: [{
2479
+ type: Injectable,
2480
+ args: [{
2481
+ providedIn: 'root'
2482
+ }]
2483
+ }], ctorParameters: function () { return [{ type: BXRestNavvyDiskFile }, { type: BXRestDiskNavvyFolder }, { type: BXRestNavvyDiskOperation }]; } });
1736
2484
 
1737
2485
  class BXRest {
1738
- constructor(user, lists) {
2486
+ constructor(user, lists, tasks, disk) {
1739
2487
  this.user = user;
1740
2488
  this.lists = lists;
2489
+ this.tasks = tasks;
2490
+ this.disk = disk;
1741
2491
  }
1742
2492
  }
1743
- BXRest.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRest, deps: [{ token: BXRestUser }, { token: BXRestLists }], target: i0.ɵɵFactoryTarget.Injectable });
2493
+ BXRest.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRest, deps: [{ token: BXRestUser }, { token: BXRestLists }, { token: BXRestTasks }, { token: BXRestDisk }], target: i0.ɵɵFactoryTarget.Injectable });
1744
2494
  BXRest.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRest, providedIn: 'root' });
1745
2495
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRest, decorators: [{
1746
2496
  type: Injectable,
1747
2497
  args: [{
1748
2498
  providedIn: 'root'
1749
2499
  }]
1750
- }], ctorParameters: function () { return [{ type: BXRestUser }, { type: BXRestLists }]; } });
2500
+ }], ctorParameters: function () { return [{ type: BXRestUser }, { type: BXRestLists }, { type: BXRestTasks }, { type: BXRestDisk }]; } });
2501
+ class BXRestNavvy {
2502
+ constructor(user, lists, tasks, disk) {
2503
+ this.user = user;
2504
+ this.lists = lists;
2505
+ this.tasks = tasks;
2506
+ this.disk = disk;
2507
+ }
2508
+ }
2509
+ BXRestNavvy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvy, deps: [{ token: BXRestNavvyUser }, { token: BXRestNavvyLists }, { token: BXRestNavvyTasks }, { token: BXRestNavvyDisk }], target: i0.ɵɵFactoryTarget.Injectable });
2510
+ BXRestNavvy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvy, providedIn: 'root' });
2511
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvy, decorators: [{
2512
+ type: Injectable,
2513
+ args: [{
2514
+ providedIn: 'root'
2515
+ }]
2516
+ }], ctorParameters: function () { return [{ type: BXRestNavvyUser }, { type: BXRestNavvyLists }, { type: BXRestNavvyTasks }, { type: BXRestNavvyDisk }]; } });
2517
+ class BXRestMap {
2518
+ constructor(lists) {
2519
+ this.lists = lists;
2520
+ }
2521
+ }
2522
+ BXRestMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMap, deps: [{ token: BXRestMapLists }], target: i0.ɵɵFactoryTarget.Injectable });
2523
+ BXRestMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMap, providedIn: 'root' });
2524
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMap, decorators: [{
2525
+ type: Injectable,
2526
+ args: [{
2527
+ providedIn: 'root'
2528
+ }]
2529
+ }], ctorParameters: function () { return [{ type: BXRestMapLists }]; } });
1751
2530
 
1752
2531
  /*
1753
2532
  * Public API Surface of bx-rest
@@ -1757,5 +2536,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1757
2536
  * Generated bundle index. Do not edit.
1758
2537
  */
1759
2538
 
1760
- export { BXRest };
2539
+ export { BXRest, BXRestMap, BXRestMapResult, BXRestNavvy, REST_SETTINGS };
1761
2540
  //# sourceMappingURL=bx-rest.mjs.map