bx-rest 0.0.34 → 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 -35
  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 -312
  49. package/fesm2015/bx-rest.mjs.map +1 -1
  50. package/fesm2020/bx-rest.mjs +1092 -312
  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';
@@ -14,10 +14,26 @@ import { createAction, props, createReducer, on } from '@ngrx/store';
14
14
  import { __awaiter } from 'tslib';
15
15
  import { DateTime } from 'luxon';
16
16
  import * as i2$1 from '@angular/router';
17
- import flatten from 'just-flatten-it';
18
17
  import * as i1$3 from '@angular/common/http';
19
18
  import { HttpParams } from '@angular/common/http';
20
19
 
20
+ const REST_SETTINGS = {
21
+ auth: {
22
+ source: 'cookies',
23
+ key: 'auth'
24
+ },
25
+ urls: {
26
+ home: 'b24.trace-studio.com'
27
+ }
28
+ };
29
+
30
+ function BXRestMapResult(v) {
31
+ if (v && (v.result || typeof v.result === 'boolean')) {
32
+ return v.result;
33
+ }
34
+ return undefined;
35
+ }
36
+
21
37
  const $get = 'get';
22
38
  const $add = 'add';
23
39
  const $set = 'set';
@@ -563,7 +579,7 @@ class BaseServices {
563
579
  }
564
580
  getHomeAddress() {
565
581
  // return this.prepareBaseAddress(environment.urls.home)
566
- return this.prepareBaseAddress('b24.trace-studio.com');
582
+ return this.prepareBaseAddress(REST_SETTINGS.urls.home);
567
583
  }
568
584
  dateDiff(a, b) {
569
585
  return new Date(a.valueOf() - b.valueOf());
@@ -669,17 +685,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
669
685
  }]
670
686
  }] });
671
687
 
672
- const REST_SETTINGS = {
673
- support: {
674
- map: true,
675
- result: true
676
- },
677
- auth: 'cookies',
678
- urls: {
679
- home: 'b24.trace-studio.com'
680
- }
681
- };
682
-
683
688
  class RestServices {
684
689
  constructor() {
685
690
  this.BX24 = false;
@@ -700,7 +705,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
700
705
  }], ctorParameters: function () { return []; } });
701
706
 
702
707
  class SessionKeyServices extends BaseServices {
703
- constructor(store, route, BxApiLib) {
708
+ constructor(store, route, BxApiLib, REST_SETTINGS) {
704
709
  super();
705
710
  this.store = store;
706
711
  this.route = route;
@@ -709,6 +714,7 @@ class SessionKeyServices extends BaseServices {
709
714
  this.subscribe = {
710
715
  authData: new Subscription()
711
716
  };
717
+ this.REST_SETTINGS = REST_SETTINGS;
712
718
  this.authData$ = this.store.select('auth');
713
719
  this.authData$.subscribe(authData => {
714
720
  if ((authData && !authData.access_token.length) || !authData) {
@@ -805,24 +811,34 @@ class SessionKeyServices extends BaseServices {
805
811
  this.subscribe.authData.unsubscribe();
806
812
  }
807
813
  getAuth() {
808
- if (window.BX && window.BX.bitrix_sessid()) {
809
- return window.BX.bitrix_sessid();
810
- }
811
- else if (this.getSessid().length) {
812
- let str = this.getSessid();
813
- return (str) ? str : '';
814
- }
815
- else {
816
- return CookiesServices.get('auth');
814
+ switch (REST_SETTINGS.auth.key) {
815
+ case 'auth':
816
+ return CookiesServices.get('auth');
817
+ default:
818
+ if (window.BX && window.BX.bitrix_sessid()) {
819
+ return window.BX.bitrix_sessid();
820
+ }
821
+ else if (this.getSessid().length) {
822
+ let str = this.getSessid();
823
+ return (str) ? str : '';
824
+ }
825
+ else {
826
+ return CookiesServices.get('auth');
827
+ }
817
828
  }
818
829
  }
819
830
  getKeyAuth() {
820
- if (window.BX && window.BX.bitrix_sessid()
821
- || this.getSessid().length) {
822
- return 'sessid';
831
+ if (REST_SETTINGS.auth.key.length) {
832
+ return REST_SETTINGS.auth.key;
823
833
  }
824
834
  else {
825
- return 'auth';
835
+ if (window.BX && window.BX.bitrix_sessid()
836
+ || this.getSessid().length) {
837
+ return 'sessid';
838
+ }
839
+ else {
840
+ return 'auth';
841
+ }
826
842
  }
827
843
  }
828
844
  getSessid() {
@@ -848,7 +864,7 @@ class SessionKeyServices extends BaseServices {
848
864
  return false;
849
865
  }
850
866
  getAuthParams() {
851
- switch (REST_SETTINGS.auth) {
867
+ switch (REST_SETTINGS.auth.source) {
852
868
  case 'cookies':
853
869
  return of(this.getAuth());
854
870
  default:
@@ -856,21 +872,28 @@ class SessionKeyServices extends BaseServices {
856
872
  }
857
873
  }
858
874
  getBaseUrl() {
859
- return of(this.prepareBaseAddress(REST_SETTINGS.urls.home, 'rest')); // TODO: вынести в настройки
875
+ return of(this.prepareBaseAddress(this.REST_SETTINGS.urls.home, 'rest'));
860
876
  // return this.authData$.pipe( // TODO: разобраться позже
861
877
  // take(1),
862
878
  // map(v => (v && v.domain) ? this.prepareBaseAddress(v.domain) : undefined)
863
879
  // )
864
880
  }
865
881
  }
866
- 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 });
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 });
867
883
  SessionKeyServices.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionKeyServices, providedIn: 'root' });
868
884
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SessionKeyServices, decorators: [{
869
885
  type: Injectable,
870
886
  args: [{
871
887
  providedIn: 'root'
872
888
  }]
873
- }], ctorParameters: function () { return [{ type: i1$2.Store }, { type: i2$1.ActivatedRoute }, { type: RestServices }]; } });
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
+ } });
874
897
 
875
898
  class HttpData extends BaseServices {
876
899
  constructor() {
@@ -975,12 +998,6 @@ class HttpData extends BaseServices {
975
998
  }
976
999
  return sendHttpParams;
977
1000
  }
978
- mapResult(v) {
979
- if (v && (v.result || typeof v.result === 'boolean')) {
980
- return v.result;
981
- }
982
- return undefined;
983
- }
984
1001
  sliceArrayIntoChunks(arr, chunkSize) {
985
1002
  const res = [];
986
1003
  for (let i = 0; i < arr.length; i += chunkSize) {
@@ -1086,12 +1103,13 @@ class HttpServices extends BaseHttpServices {
1086
1103
  }
1087
1104
  return res;
1088
1105
  }
1089
- mapBranchResult(res) {
1090
- return Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined));
1091
- }
1092
- mapBranchResultWithoutKey(res) {
1093
- return flatten(Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined)));
1094
- }
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
+ // }
1095
1113
  httpPost(url, params = {}, textError = '', settings = this.defSettings) {
1096
1114
  return this.session.getAuthParams().pipe(mergeMap(auth => {
1097
1115
  if (auth) {
@@ -1160,13 +1178,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1160
1178
  }]
1161
1179
  }], ctorParameters: function () { return [{ type: i1$3.HttpClient }, { type: SnackBarService }, { type: SessionKeyServices }]; } });
1162
1180
 
1163
- function mapResult(v) {
1164
- if (v && (v.result || typeof v.result === 'boolean')) {
1165
- return v.result;
1166
- }
1167
- return undefined;
1168
- }
1169
-
1181
+ // type TransformFunction<T, R> = (input: T) => R;
1170
1182
  class HttpBXServices extends HttpServices {
1171
1183
  timeNowOnServer() {
1172
1184
  return this.httpGet('server.time').pipe(map(v => {
@@ -1208,38 +1220,20 @@ class HttpBXServices extends HttpServices {
1208
1220
  }
1209
1221
  return res;
1210
1222
  }
1211
- mapBranchResult(res) {
1212
- return Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined));
1213
- }
1214
- mapBranchResultWithoutKey(res) {
1215
- return flatten(Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined)));
1216
- }
1217
- post(name, params = {}, textError = '', mapHttp = undefined, settings = this.defSettings) {
1218
- return this.httpPost(this.getNameMethod(name), params, textError, settings).pipe(map(v => {
1219
- console.log('result', v);
1220
- if (v && v.result && REST_SETTINGS.support.map && mapHttp) {
1221
- // console.log('result2', v, Array.isArray(v.result)
1222
- // ? Object.assign(v, {result: v.result.map(i => mapHttp(i))}) as iHttpAnswerBX<R>
1223
- // : Object.assign(v, {result: mapHttp(v.result)}) as iHttpAnswerBX<R>)
1224
- // Array.isArray(v.result)
1225
- // ? Object.assign(v, {result: v.result.map(i => mapHttp(i))}) as iHttpAnswerBX<R>
1226
- // :
1227
- return Object.assign(v, { result: mapHttp(v.result) });
1228
- }
1229
- return v;
1230
- }), map(v => (v && REST_SETTINGS.support.result) ? mapResult : v));
1231
- }
1232
- get(name, params = {}, textError = '', mapHttp = (v) => {
1233
- return v;
1234
- }, settings = this.defSettings) {
1235
- return this.httpGet(this.getNameMethod(name), params, textError, settings).pipe(map(v => {
1236
- if (v && v.result && REST_SETTINGS.support.map) {
1237
- return Array.isArray(v.result)
1238
- ? Object.assign(v, { result: v.result.map(i => mapHttp(i)) })
1239
- : Object.assign(v, { result: mapHttp(v.result) });
1240
- }
1241
- return v;
1242
- }), map(v => (v && REST_SETTINGS.support.result) ? mapResult : v));
1223
+ // override mapBranchResult<T>(res: iBatchRequestAnswer<T>[]) {
1224
+ // return Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined)) as {
1225
+ // [key: keyBatch]: T
1226
+ // }
1227
+ // }
1228
+ //
1229
+ // override mapBranchResultWithoutKey<T>(res: iBatchRequestAnswer<T>[]): T[] {
1230
+ // return flatten<T>(Object.assign([], ...res.map(i => (i.result && i.result.result) ? i.result.result : undefined)))
1231
+ // }
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);
1243
1237
  }
1244
1238
  httpPost(url, params = {}, textError = '', settings = this.defSettings) {
1245
1239
  return this.session.getAuthParams().pipe(mergeMap(auth => {
@@ -1309,40 +1303,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1309
1303
  }]
1310
1304
  }] });
1311
1305
 
1312
- let BaseMapServices$1 = class BaseMapServices extends BaseServices {
1313
- };
1314
- BaseMapServices$1.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseMapServices$1, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1315
- BaseMapServices$1.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseMapServices$1, providedIn: 'root' });
1316
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseMapServices$1, decorators: [{
1317
- type: Injectable,
1318
- args: [{
1319
- providedIn: 'root'
1320
- }]
1321
- }] });
1322
-
1323
- class BXRestListsElementMap extends BaseMapServices$1 {
1324
- get(item) {
1325
- return Object.assign(item, {
1326
- BP_PUBLISHED: item.BP_PUBLISHED === 'Y',
1327
- CREATED_BY: this.toNum(item.CREATED_BY),
1328
- IBLOCK_ID: this.toNum(item.IBLOCK_ID),
1329
- ID: this.toNum(item.ID)
1330
- });
1331
- }
1332
- }
1333
- BXRestListsElementMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElementMap, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1334
- BXRestListsElementMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElementMap, providedIn: 'root' });
1335
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElementMap, decorators: [{
1336
- type: Injectable,
1337
- args: [{
1338
- providedIn: 'root'
1339
- }]
1340
- }] });
1341
-
1342
1306
  class BXRestListsElement {
1343
- constructor(http, mapResult) {
1307
+ constructor(http) {
1344
1308
  this.http = http;
1345
- this.mapResult = mapResult;
1346
1309
  this.url = {
1347
1310
  add: [$lists, $element, $add],
1348
1311
  delete: [$lists, $element, $delete],
@@ -1352,19 +1315,19 @@ class BXRestListsElement {
1352
1315
  };
1353
1316
  }
1354
1317
  get(pram) {
1355
- return this.http.post(this.url.get, pram, 'Не Удалось получить элемент списка', (v) => v.map(i => this.mapResult.get(i)));
1318
+ return this.http.post(this.url.get, pram, 'Не Удалось получить элемент списка');
1356
1319
  }
1357
1320
  customPipe() {
1358
1321
  }
1359
1322
  }
1360
- 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 });
1323
+ BXRestListsElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, deps: [{ token: HttpBXServices }], target: i0.ɵɵFactoryTarget.Injectable });
1361
1324
  BXRestListsElement.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, providedIn: 'root' });
1362
1325
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, decorators: [{
1363
1326
  type: Injectable,
1364
1327
  args: [{
1365
1328
  providedIn: 'root'
1366
1329
  }]
1367
- }], ctorParameters: function () { return [{ type: HttpBXServices }, { type: BXRestListsElementMap }]; } });
1330
+ }], ctorParameters: function () { return [{ type: HttpBXServices }]; } });
1368
1331
 
1369
1332
  class BXRestLists {
1370
1333
  constructor(element) {
@@ -1387,70 +1350,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1387
1350
  }]
1388
1351
  }], ctorParameters: function () { return [{ type: BXRestListsElement }]; } });
1389
1352
 
1390
- const save = createAction('[Users Component] Save', props());
1391
- const saveArr = createAction('[Users Component] Save Arr', props());
1392
- const update = createAction('[Users Component] Update', props());
1393
- const loadAll = createAction('[Users Component] loadAll', props());
1394
- const saveSelf = createAction('[Users Component] saveSelf', props());
1395
- const saveIDLoadedDepartment = createAction('[Users Component] saveIDLoadedDepartment', props());
1396
- const initialState = {
1397
- load: {
1398
- all: false,
1399
- department: []
1400
- },
1401
- self: undefined,
1402
- data: []
1403
- };
1404
- const _usersReducer = createReducer(initialState, on(saveIDLoadedDepartment, (s, data) => {
1405
- let copy = clone(s);
1406
- copy.load.department = [...copy.load.department, ...data.id];
1407
- return copy;
1408
- }), on(save, (s, data) => {
1409
- const find = s.data.find(v => v.ID === data.ID);
1410
- if (!find) {
1411
- const copy = clone(s);
1412
- copy.data.push(data);
1413
- return copy;
1414
- }
1415
- return s;
1416
- }), on(saveArr, (s, data) => {
1417
- const copy = clone(s);
1418
- if (copy.data && copy.data.length) {
1419
- for (const user of data.arr) {
1420
- const find = copy.data.find(v => v.ID === user.ID);
1421
- if (!find) {
1422
- copy.data.push(user);
1423
- }
1424
- }
1425
- }
1426
- else {
1427
- copy.data = [...data.arr];
1428
- }
1429
- return copy;
1430
- }), on(update, (s, data) => {
1431
- const copy = clone(s);
1432
- let find = copy.data.findIndex(v => v.ID === data.ID);
1433
- if (find !== -1) {
1434
- const copy = clone(s);
1435
- copy.data.splice(find, 1, data);
1436
- // copy.data.push(data)
1437
- return copy;
1438
- }
1439
- return s;
1440
- }), on(loadAll, (s, data) => {
1441
- if (data.load !== s.load.all) {
1442
- const copy = clone(s);
1443
- copy.load.all = data.load;
1444
- return copy;
1445
- }
1446
- return s;
1447
- }), on(saveSelf, (s, data) => {
1448
- return Object.assign(Object.assign({}, s), { self: data.self });
1449
- }));
1450
- function usersReducer(state = initialState, action) {
1451
- return _usersReducer(state, action);
1452
- }
1453
-
1454
1353
  class BaseMapServices extends BaseServices {
1455
1354
  }
1456
1355
  BaseMapServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseMapServices, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
@@ -1462,100 +1361,83 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1462
1361
  }]
1463
1362
  }] });
1464
1363
 
1465
- class BitrixApiUserMapServices extends BaseMapServices {
1466
- HttpToBX(user) {
1467
- let res = Object.assign(clone(user), {
1468
- ID: this.toNum(user.ID),
1469
- IS_ONLINE: this.toBool(user.IS_ONLINE),
1470
- DATE_REGISTER: this.toDate(user.DATE_REGISTER),
1471
- PERSONAL_BIRTHDAY: this.toDate(user.PERSONAL_BIRTHDAY),
1472
- });
1473
- if (user.LAST_LOGIN) {
1474
- res.LAST_LOGIN = this.toDate(user.LAST_LOGIN);
1475
- }
1476
- return res;
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
+ }));
1477
1372
  }
1478
- BXtoHttp(user) {
1479
- return Object.assign(clone(user), {
1480
- ID: this.toStr(user.ID),
1481
- IS_ONLINE: this.toBXYorN(user.IS_ONLINE),
1482
- DATE_REGISTER: this.getBXStrTime(user.DATE_REGISTER),
1483
- PERSONAL_BIRTHDAY: this.toStr(user.PERSONAL_BIRTHDAY),
1484
- LAST_LOGIN: this.toStr(user.LAST_LOGIN)
1485
- });
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;
1486
1387
  }
1487
- getFIO(user) {
1488
- let res = '';
1489
- if (!user.LAST_NAME) {
1490
- const SECOND_NAME = (user.SECOND_NAME) ? user.SECOND_NAME : '';
1491
- const NAME = (user.NAME) ? user.NAME : '';
1492
- res = NAME + ' ' + SECOND_NAME;
1493
- }
1494
- else if (!user.NAME) {
1495
- res = user.LAST_NAME;
1496
- }
1497
- else if (!user.SECOND_NAME) {
1498
- res = user.LAST_NAME + ' ' + user.NAME;
1499
- }
1500
- else {
1501
- res = user.LAST_NAME + ' ' + user.NAME + ' ' + user.SECOND_NAME;
1502
- }
1503
- return res.trim();
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;
1504
1402
  }
1505
- getFI(user) {
1506
- let res = '';
1507
- if (!user.LAST_NAME) {
1508
- const NAME = (user.NAME) ? user.NAME : '';
1509
- res = NAME;
1510
- }
1511
- else if (!user.NAME) {
1512
- res = user.LAST_NAME;
1513
- }
1514
- else {
1515
- res = user.LAST_NAME + ' ' + user.NAME;
1516
- }
1517
- return res.trim();
1403
+ get(pram) {
1404
+ return this.BXRestListsElement.get(pram).pipe(map(v => (v) ? this.BXRestMap.get(BXRestMapResult(v)) : undefined));
1518
1405
  }
1519
- getFIOShort(user) {
1520
- let res = '';
1521
- if (!user.LAST_NAME) {
1522
- const SECOND_NAME = (user.SECOND_NAME) ? user.SECOND_NAME : '';
1523
- const NAME = (user.NAME) ? user.NAME : '';
1524
- res = NAME + ' ' + SECOND_NAME;
1525
- }
1526
- else if (!user.NAME) {
1527
- res = user.LAST_NAME;
1528
- }
1529
- else if (!user.SECOND_NAME) {
1530
- res = user.LAST_NAME + ' ' + user.NAME.charAt(0).toUpperCase() + '.';
1531
- }
1532
- else {
1533
- res =
1534
- user.LAST_NAME + ' ' +
1535
- user.NAME.charAt(0).toUpperCase() + '.' +
1536
- user.SECOND_NAME.charAt(0).toUpperCase() + '.';
1537
- }
1538
- return res.trim();
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
+ };
1539
1426
  }
1540
1427
  }
1541
- BitrixApiUserMapServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BitrixApiUserMapServices, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1542
- BitrixApiUserMapServices.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BitrixApiUserMapServices, providedIn: 'root' });
1543
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BitrixApiUserMapServices, decorators: [{
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: [{
1544
1431
  type: Injectable,
1545
1432
  args: [{
1546
1433
  providedIn: 'root'
1547
1434
  }]
1548
- }] });
1435
+ }], ctorParameters: function () { return [{ type: BXRestNavvyListsElement }]; } });
1549
1436
 
1550
1437
  class BXRestUser {
1551
- constructor(http, snackBar,
1552
- // private img: ImgServices,
1553
- //private dateTrace: DateTrace,
1554
- store, userMap) {
1438
+ constructor(http, snackBar) {
1555
1439
  this.http = http;
1556
1440
  this.snackBar = snackBar;
1557
- this.store = store;
1558
- this.userMap = userMap;
1559
1441
  this.url = {
1560
1442
  admin: [$user, 'admin'],
1561
1443
  get: [$user, $get],
@@ -1574,7 +1456,6 @@ class BXRestUser {
1574
1456
  this.def = {
1575
1457
  params: { ACTIVE: 1, start: 0 }
1576
1458
  };
1577
- this.user$ = this.store.select('users');
1578
1459
  }
1579
1460
  admin() {
1580
1461
  return this.http.get(this.url.admin);
@@ -1582,7 +1463,7 @@ class BXRestUser {
1582
1463
  get(params = {}) {
1583
1464
  let copyParams = clone(params);
1584
1465
  this.setDefParam(copyParams);
1585
- return this.http.post(this.url.get, copyParams, 'Не удалось получить пользователей', (v) => { return v.map(i => this.userMap.HttpToBX(i)); });
1466
+ return this.http.post(this.url.get, copyParams, 'Не удалось получить пользователей');
1586
1467
  // .pipe(
1587
1468
  // tap(v => {
1588
1469
  // if (v && v.result) {
@@ -1591,30 +1472,8 @@ class BXRestUser {
1591
1472
  // })
1592
1473
  // )
1593
1474
  }
1594
- current(update = false) {
1595
- if (update) {
1596
- return this.getSelfHttp();
1597
- }
1598
- else {
1599
- return this.user$.pipe(mergeMap$1(v => {
1600
- if (v && v.self) {
1601
- return of(v.self);
1602
- }
1603
- else {
1604
- return this.getSelfHttp();
1605
- }
1606
- }), first());
1607
- }
1608
- }
1609
- getSelfHttp() {
1475
+ current() {
1610
1476
  return this.http.get(this.url.current, {}, 'Не удалось получить пользователя');
1611
- // .pipe(
1612
- // tap(v => {
1613
- // if (v) {
1614
- // this.store.dispatch(saveSelf({self: v}))
1615
- // }
1616
- // }),
1617
- // )
1618
1477
  }
1619
1478
  access(access, textError = 'Не удалось получить права') {
1620
1479
  return this.http.get(this.url.access, { ACCESS: access }, textError);
@@ -1653,14 +1512,15 @@ class BXRestUser {
1653
1512
  // })
1654
1513
  // )
1655
1514
  // }
1656
- saveArrUser(users) {
1657
- let result = [];
1658
- for (const user of users) {
1659
- result.push(this.userMap.HttpToBX(user));
1660
- }
1661
- this.store.dispatch(saveArr({ arr: result }));
1662
- return result;
1663
- }
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
+ // }
1664
1524
  search(params) {
1665
1525
  if (typeof params === 'string') {
1666
1526
  params = { FIND: params };
@@ -1678,15 +1538,14 @@ class BXRestUser {
1678
1538
  let sendData = {
1679
1539
  ID: user.ID,
1680
1540
  };
1681
- const userBX = this.userMap.BXtoHttp(user);
1682
- for (const field of fieldUpdate) {
1683
- if (userBX[field]) {
1684
- sendData[field] = userBX[field];
1685
- }
1686
- else {
1687
- this.snackBar.error('Одно из указанных полей отправлено не верно');
1688
- }
1689
- }
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
+ // }
1690
1549
  return this.http.post(this.url.update, sendData, 'Не удалось обновить пользователя с ID' + user.ID);
1691
1550
  }
1692
1551
  else {
@@ -1729,29 +1588,952 @@ class BXRestUser {
1729
1588
  }
1730
1589
  }
1731
1590
  }
1732
- 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 });
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 });
1733
1592
  BXRestUser.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUser, providedIn: 'root' });
1734
1593
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUser, decorators: [{
1735
1594
  type: Injectable,
1736
1595
  args: [{
1737
1596
  providedIn: 'root'
1738
1597
  }]
1739
- }], ctorParameters: function () { return [{ type: HttpBXServices }, { type: SnackBarService }, { type: i1$2.Store }, { type: BitrixApiUserMapServices }]; } });
1598
+ }], ctorParameters: function () { return [{ type: HttpBXServices }, { type: SnackBarService }]; } });
1599
+
1600
+ class BXRestTasksTask {
1601
+ constructor(http) {
1602
+ this.http = http;
1603
+ this.url = {
1604
+ add: [$tasks, $task, $add],
1605
+ approve: [$tasks, $task, $approve],
1606
+ complete: [$tasks, $task, $complete],
1607
+ counters: {
1608
+ get: [$tasks, $task, $counters, $get], //Получает счетчики пользователя
1609
+ },
1610
+ deger: [$tasks, $task, $deger],
1611
+ delegate: [$tasks, $task, $delegate],
1612
+ delete: [$tasks, $task, $delete],
1613
+ disapprove: [$tasks, $task, $disapprove],
1614
+ favorite: {
1615
+ add: [$tasks, $task, $favorite, $add],
1616
+ delete: [$tasks, $task, $favorite, $delete], // Удаляет задачи из "Избранного"
1617
+ },
1618
+ files: {
1619
+ attach: [$tasks, $task, $files, $attach], // Прикрепляет загруженный на диск файл к задаче
1620
+ },
1621
+ get: [$tasks, $task, $get],
1622
+ getFields: [$tasks, $task, $getFields],
1623
+ getaccess: [$tasks, $task, $getaccess],
1624
+ history: {
1625
+ list: [$tasks, $task, $history, $list], // Получает историю задачи
1626
+ },
1627
+ list: [$tasks, $task, $list],
1628
+ pause: [$tasks, $task, $pause],
1629
+ renew: [$tasks, $task, $renew],
1630
+ start: [$tasks, $task, $start],
1631
+ startwatch: [$tasks, $task, 'startwatch'],
1632
+ stopwatch: [$tasks, $task, 'stopwatch'],
1633
+ update: [$tasks, $task, $update],
1634
+ result: {
1635
+ list: [$tasks, $task, $result, $list],
1636
+ addFromComment: [$tasks, $task, $result, 'addFromComment'],
1637
+ deleteFromComment: [$tasks, $task, $result, 'deleteFromComment'], // Удаление результата задачи по комментарию из которого он был создан
1638
+ },
1639
+ planner: {
1640
+ getlist: [$task, $planner, $getlist], // Возвращает массив, содержащий идентификаторы задач в плане на день
1641
+ }
1642
+ };
1643
+ }
1644
+ add(param) {
1645
+ return this.http.post(this.url.add, param);
1646
+ }
1647
+ }
1648
+ BXRestTasksTask.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTasksTask, deps: [{ token: HttpBXServices }], target: i0.ɵɵFactoryTarget.Injectable });
1649
+ BXRestTasksTask.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTasksTask, providedIn: 'root' });
1650
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTasksTask, decorators: [{
1651
+ type: Injectable,
1652
+ args: [{
1653
+ providedIn: 'root'
1654
+ }]
1655
+ }], ctorParameters: function () { return [{ type: HttpBXServices }]; } });
1656
+
1657
+ class BXRestTasks {
1658
+ constructor(task) {
1659
+ this.task = task;
1660
+ }
1661
+ }
1662
+ BXRestTasks.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTasks, deps: [{ token: BXRestTasksTask }], target: i0.ɵɵFactoryTarget.Injectable });
1663
+ BXRestTasks.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTasks, providedIn: 'root' });
1664
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTasks, decorators: [{
1665
+ type: Injectable,
1666
+ args: [{
1667
+ providedIn: 'root'
1668
+ }]
1669
+ }], ctorParameters: function () { return [{ type: BXRestTasksTask }]; } });
1670
+
1671
+ class BXRestDiskFile {
1672
+ constructor(http) {
1673
+ this.http = http;
1674
+ this.url = {
1675
+ getfields: [$disk, $file, $getFields],
1676
+ get: [$disk, $file, $get],
1677
+ rename: [$disk, $file, $rename],
1678
+ copyto: [$disk, $file, $copyto],
1679
+ moveto: [$disk, $file, $moveto],
1680
+ delete: [$disk, $file, $delete],
1681
+ markdeleted: [$disk, $file, $markdeleted],
1682
+ restore: [$disk, $file, $restore],
1683
+ uploadversion: [$disk, $file, 'uploadversion'],
1684
+ getVersions: [$disk, $file, 'getVersions'],
1685
+ restoreFromVersion: [$disk, $file, 'restoreFromVersion'],
1686
+ getExternalLink: [$disk, $file, 'getexternallink'] // Возвращает публичную ссылку на файл
1687
+ };
1688
+ }
1689
+ get(id) {
1690
+ return this.http.post(this.url.get, { id: id }, 'Не удалось получить файл');
1691
+ }
1692
+ markDel(id) {
1693
+ return this.http.post(this.url.markdeleted, { id: id }, 'Не удалось переместить файл в корзину');
1694
+ }
1695
+ }
1696
+ BXRestDiskFile.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskFile, deps: [{ token: HttpBXServices }], target: i0.ɵɵFactoryTarget.Injectable });
1697
+ BXRestDiskFile.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskFile, providedIn: 'root' });
1698
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskFile, decorators: [{
1699
+ type: Injectable,
1700
+ args: [{
1701
+ providedIn: 'root'
1702
+ }]
1703
+ }], ctorParameters: function () { return [{ type: HttpBXServices }]; } });
1704
+
1705
+ class BXRestDiskFolder {
1706
+ constructor(http) {
1707
+ this.http = http;
1708
+ this.url = {
1709
+ getfields: [$disk, $folder, $getFields],
1710
+ get: [$disk, $folder, $get],
1711
+ getchildren: [$disk, $folder, $getchildren],
1712
+ addsubfolder: [$disk, $folder, 'addsubfolder'],
1713
+ copyto: [$disk, $folder, $copyto],
1714
+ moveto: [$disk, $folder, $moveto],
1715
+ rename: [$disk, $folder, $rename],
1716
+ deletetree: [$disk, $folder, 'deletetree'],
1717
+ markdeleted: [$disk, $folder, $markdeleted],
1718
+ restore: [$disk, $folder, $restore],
1719
+ uploadfile: [$disk, $folder, $uploadfile],
1720
+ getExternalLink: [$disk, $folder, 'getExternalLink'] // Метод возвращает публичную ссылку
1721
+ };
1722
+ }
1723
+ uploadfile(id, fileContent) {
1724
+ return this.http.post(this.url.uploadfile, {
1725
+ id: id,
1726
+ fileContent: fileContent,
1727
+ data: {
1728
+ NAME: fileContent[0]
1729
+ } // Обязательное поле NAME - имя нового файла
1730
+ // generateUniqueName Необязательный, по умолчанию false. При указании true, для загружаемого файла будет уникализировано имя, добавлением суффикса (1), (2) и т.п.
1731
+ // rights Необязательный, по умолчанию пустой массив. Массив прав доступа на загружаемый файл.
1732
+ });
1733
+ }
1734
+ getchildren(id) {
1735
+ return this.http.post(this.url.getchildren, { id: id }, 'get folders and files');
1736
+ }
1737
+ }
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: [{
1741
+ type: Injectable,
1742
+ args: [{
1743
+ providedIn: 'root'
1744
+ }]
1745
+ }], ctorParameters: function () { return [{ type: HttpBXServices }]; } });
1746
+
1747
+ class BXRestDisk {
1748
+ constructor(file, folder) {
1749
+ this.file = file;
1750
+ this.folder = folder;
1751
+ }
1752
+ }
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: [{
1756
+ type: Injectable,
1757
+ args: [{
1758
+ providedIn: 'root'
1759
+ }]
1760
+ }], ctorParameters: function () { return [{ type: BXRestDiskFile }, { type: BXRestDiskFolder }]; } });
1761
+
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
+ }
1797
+ }
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
+ }
1825
+
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();
1865
+ }
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();
1879
+ }
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();
1900
+ }
1901
+ }
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: [{
1905
+ type: Injectable,
1906
+ args: [{
1907
+ providedIn: 'root'
1908
+ }]
1909
+ }] });
1910
+
1911
+ class BXRestNavvyUser {
1912
+ constructor(BXRestUser, store, BXRestUserMap) {
1913
+ this.BXRestUser = BXRestUser;
1914
+ this.store = store;
1915
+ this.BXRestUserMap = BXRestUserMap;
1916
+ this.user$ = this.store.select('users');
1917
+ }
1918
+ current(update = false) {
1919
+ if (update) {
1920
+ return this.self();
1921
+ }
1922
+ 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());
1931
+ }
1932
+ }
1933
+ self() {
1934
+ return this.BXRestUser.current()
1935
+ .pipe(map(v => {
1936
+ if (v && v.result) {
1937
+ return this.BXRestUserMap.current(v.result);
1938
+ }
1939
+ return undefined;
1940
+ }), tap(v => {
1941
+ if (v) {
1942
+ this.store.dispatch(saveSelf({ self: v }));
1943
+ }
1944
+ }));
1945
+ }
1946
+ }
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 });
1948
+ BXRestNavvyUser.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyUser, providedIn: 'root' });
1949
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyUser, decorators: [{
1950
+ type: Injectable,
1951
+ args: [{
1952
+ providedIn: 'root'
1953
+ }]
1954
+ }], ctorParameters: function () { return [{ type: BXRestUser }, { type: i1$2.Store }, { type: BXRestUserMap }]; } });
1955
+
1956
+ class BXRestTaskMap extends BaseMapServices {
1957
+ TaskBXHttpToTaskBX(item) {
1958
+ let result = {};
1959
+ if (item.id) {
1960
+ result.id = this.toNum(item.id);
1961
+ }
1962
+ if (item.parentId) {
1963
+ result.parentId = this.toNum(item.parentId);
1964
+ }
1965
+ if (item.priority) {
1966
+ result.priority = this.toNum(item.priority);
1967
+ }
1968
+ if (item.status) {
1969
+ result.status = this.toNum(item.status);
1970
+ }
1971
+ if (item.multitask) {
1972
+ result.multitask = item.multitask === 'Y';
1973
+ }
1974
+ if (item.groupId) {
1975
+ result.groupId = this.toNum(item.groupId);
1976
+ }
1977
+ if (item.stageId) {
1978
+ result.stageId = this.toNum(item.stageId);
1979
+ }
1980
+ if (item.createdBy) {
1981
+ result.createdBy = this.toNum(item.createdBy);
1982
+ }
1983
+ if (item.createdDate) {
1984
+ result.createdDate = this.toDate(item.createdDate);
1985
+ }
1986
+ if (item.responsibleId) {
1987
+ result.responsibleId = this.toNum(item.responsibleId);
1988
+ }
1989
+ if (item.changedBy) {
1990
+ result.changedBy = this.toNum(item.changedBy);
1991
+ }
1992
+ if (item.changedDate) {
1993
+ result.changedDate = this.toDate(item.changedDate);
1994
+ }
1995
+ if (item.statusChangedBy) {
1996
+ result.statusChangedBy = this.toNum(item.statusChangedBy);
1997
+ }
1998
+ if (item.statusChangedDate) {
1999
+ result.statusChangedDate = this.toDate(item.statusChangedDate);
2000
+ }
2001
+ if (item.closedBy) {
2002
+ result.closedBy = this.toNum(item.closedBy);
2003
+ }
2004
+ if (item.closedDate) {
2005
+ result.closedDate = this.toDate(item.closedDate);
2006
+ }
2007
+ if (item.dateStart) {
2008
+ result.dateStart = this.toDate(item.dateStart);
2009
+ }
2010
+ if (item.deadline) {
2011
+ result.deadline = this.toDate(item.deadline);
2012
+ }
2013
+ if (item.startDatePlan) {
2014
+ result.startDatePlan = this.toDate(item.startDatePlan);
2015
+ }
2016
+ if (item.endDatePlan) {
2017
+ result.endDatePlan = this.toDate(item.endDatePlan);
2018
+ }
2019
+ if (item.forumTopicId) {
2020
+ result.forumTopicId = this.toNum(item.forumTopicId);
2021
+ }
2022
+ if (item.forumId) {
2023
+ result.forumId = this.toNum(item.forumId);
2024
+ }
2025
+ if (item.viewedDate) {
2026
+ result.viewedDate = this.toDate(item.viewedDate);
2027
+ }
2028
+ if (item.sorting) {
2029
+ result.sorting = this.toNum(item.sorting);
2030
+ }
2031
+ if (item.durationPlan) {
2032
+ result.durationPlan = this.toNum(item.durationPlan);
2033
+ }
2034
+ if (item.descriptionInBbcode) {
2035
+ result.descriptionInBbcode = item.descriptionInBbcode === 'Y';
2036
+ }
2037
+ if (item.accomplices) {
2038
+ result.accomplices = item.accomplices.map(i => this.toNum(i));
2039
+ }
2040
+ if (item.subStatus) {
2041
+ result.subStatus = this.toNum(item.subStatus);
2042
+ }
2043
+ if (item.creator) {
2044
+ result.creator = Object.assign(item.creator, { id: this.toNum(item.creator.id) });
2045
+ }
2046
+ if (item.responsible) {
2047
+ result.responsible = Object.assign(item.responsible, { id: this.toNum(item.responsible.id) });
2048
+ }
2049
+ if (item.accomplicesData) {
2050
+ result.accomplicesData =
2051
+ Object.values(item.accomplicesData).map(i => Object.assign(i, { id: this.toNum(i.id) }));
2052
+ }
2053
+ if (item.allowTimeTracking) {
2054
+ result.allowTimeTracking = item.allowTimeTracking === 'Y';
2055
+ }
2056
+ return Object.assign(item, result);
2057
+ }
2058
+ }
2059
+ BXRestTaskMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTaskMap, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
2060
+ BXRestTaskMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTaskMap, providedIn: 'root' });
2061
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestTaskMap, decorators: [{
2062
+ type: Injectable,
2063
+ args: [{
2064
+ providedIn: 'root'
2065
+ }]
2066
+ }] });
2067
+
2068
+ // export interface TimeProcess {
2069
+ // total: number,
2070
+ // next: number
2071
+ // }
2072
+ 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
+ // storeTask$: Observable<iStoreTask>
2084
+ constructor(BXRestTasks, snackBar,
2085
+ // private store: Store<{ tasks: IStoreTask }>,
2086
+ taskMap) {
2087
+ this.BXRestTasks = BXRestTasks;
2088
+ this.snackBar = snackBar;
2089
+ this.taskMap = taskMap;
2090
+ // this.storeTask$ = this.store.select('tasks')
2091
+ // this.nowLoad$.next({
2092
+ // total: 0,
2093
+ // next: 0
2094
+ // })
2095
+ }
2096
+ 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);
2100
+ }
2101
+ return undefined;
2102
+ }));
2103
+ // return this.http.post<{ task: TaskBXHttp }>(this.url.add, {fields: param}).pipe(
2104
+ // map(v => {
2105
+ // if (v && v.result && v.result.task) {
2106
+ // return Object.assign(
2107
+ // v,
2108
+ // {
2109
+ // result: this.taskBXMap.TaskBXHttpToTaskBX(v.result.task)
2110
+ // })
2111
+ // }
2112
+ // return undefined
2113
+ // }
2114
+ // ))
2115
+ }
2116
+ }
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 });
2118
+ BXRestNavvyTasksTask.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyTasksTask, providedIn: 'root' });
2119
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyTasksTask, decorators: [{
2120
+ type: Injectable,
2121
+ args: [{
2122
+ providedIn: 'root'
2123
+ }]
2124
+ }], ctorParameters: function () { return [{ type: BXRestTasksTask }, { type: SnackBarService }, { type: BXRestTaskMap }]; } });
2125
+
2126
+ class BXRestNavvyTasks {
2127
+ constructor(task) {
2128
+ this.task = task;
2129
+ }
2130
+ }
2131
+ BXRestNavvyTasks.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyTasks, deps: [{ token: BXRestNavvyTasksTask }], target: i0.ɵɵFactoryTarget.Injectable });
2132
+ BXRestNavvyTasks.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyTasks, providedIn: 'root' });
2133
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyTasks, decorators: [{
2134
+ type: Injectable,
2135
+ args: [{
2136
+ providedIn: 'root'
2137
+ }]
2138
+ }], ctorParameters: function () { return [{ type: BXRestNavvyTasksTask }]; } });
2139
+
2140
+ class BXRestNavvyDiskFile extends BaseServices {
2141
+ constructor(BXRestDiskFile) {
2142
+ super();
2143
+ this.BXRestDiskFile = BXRestDiskFile;
2144
+ }
2145
+ 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
+ });
2152
+ }
2153
+ return undefined;
2154
+ }));
2155
+ }
2156
+ markDel(id) {
2157
+ return this.BXRestDiskFile.markDel(id)
2158
+ .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
+ });
2164
+ }
2165
+ return undefined;
2166
+ }));
2167
+ }
2168
+ }
2169
+ BXRestNavvyDiskFile.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskFile, deps: [{ token: BXRestDiskFile }], target: i0.ɵɵFactoryTarget.Injectable });
2170
+ BXRestNavvyDiskFile.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskFile, providedIn: 'root' });
2171
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskFile, decorators: [{
2172
+ type: Injectable,
2173
+ args: [{
2174
+ providedIn: 'root'
2175
+ }]
2176
+ }], ctorParameters: function () { return [{ type: BXRestDiskFile }]; } });
2177
+
2178
+ class BXRestMapDiskBase extends BaseMapServices {
2179
+ separationFoldersAndFiles(arr) {
2180
+ let result = { file: [], folder: [] };
2181
+ for (let i of arr) {
2182
+ if (this.instanceOfiFile(i)) {
2183
+ result.file.push(Object.assign(i, {
2184
+ CREATED_BY: this.toNum(i.CREATED_BY),
2185
+ CREATE_TIME: this.toDate(i.CREATE_TIME),
2186
+ DELETED_BY: this.toNum(i.DELETED_BY),
2187
+ DELETED_TYPE: this.toNum(i.DELETED_TYPE),
2188
+ DELETE_TIME: (i.DELETE_TIME) ? this.toDate(i.DELETE_TIME) : null,
2189
+ ID: this.toNum(i.ID),
2190
+ PARENT_ID: this.toNum(i.PARENT_ID),
2191
+ REAL_OBJECT_ID: this.toNum(i.REAL_OBJECT_ID),
2192
+ STORAGE_ID: this.toNum(i.STORAGE_ID),
2193
+ UPDATED_BY: this.toNum(i.UPDATED_BY),
2194
+ UPDATE_TIME: this.toDate(i.UPDATE_TIME),
2195
+ SIZE: this.toNum(i.SIZE),
2196
+ }));
2197
+ }
2198
+ else if (this.instanceOfiFolder(i)) {
2199
+ result.folder.push(Object.assign(i, {
2200
+ CREATED_BY: this.toNum(i.CREATED_BY),
2201
+ CREATE_TIME: this.toDate(i.CREATE_TIME),
2202
+ DELETED_BY: this.toNum(i.DELETED_BY),
2203
+ DELETED_TYPE: this.toNum(i.DELETED_TYPE),
2204
+ DELETE_TIME: (i.DELETE_TIME) ? this.toDate(i.DELETE_TIME) : null,
2205
+ ID: this.toNum(i.ID),
2206
+ PARENT_ID: this.toNum(i.PARENT_ID),
2207
+ REAL_OBJECT_ID: this.toNum(i.REAL_OBJECT_ID),
2208
+ STORAGE_ID: this.toNum(i.STORAGE_ID),
2209
+ UPDATED_BY: this.toNum(i.UPDATED_BY),
2210
+ UPDATE_TIME: this.toDate(i.UPDATE_TIME),
2211
+ }));
2212
+ }
2213
+ }
2214
+ return result;
2215
+ }
2216
+ instanceOfiFile(object) {
2217
+ return object && object.TYPE && object.TYPE === 'file';
2218
+ }
2219
+ instanceOfiFolder(object) {
2220
+ return object && object.TYPE && object.TYPE === 'folder';
2221
+ }
2222
+ }
2223
+ BXRestMapDiskBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapDiskBase, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
2224
+ BXRestMapDiskBase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapDiskBase, providedIn: 'root' });
2225
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapDiskBase, decorators: [{
2226
+ type: Injectable,
2227
+ args: [{
2228
+ providedIn: 'root'
2229
+ }]
2230
+ }] });
2231
+
2232
+ class BXRestMapDiskFolder extends BXRestMapDiskBase {
2233
+ getContent(arr) {
2234
+ return this.separationFoldersAndFiles(arr);
2235
+ }
2236
+ }
2237
+ BXRestMapDiskFolder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapDiskFolder, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
2238
+ BXRestMapDiskFolder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapDiskFolder, providedIn: 'root' });
2239
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapDiskFolder, decorators: [{
2240
+ type: Injectable,
2241
+ args: [{
2242
+ providedIn: 'root'
2243
+ }]
2244
+ }] });
2245
+
2246
+ class BXRestDiskNavvyFolder {
2247
+ constructor(BXRestDiskFolder, BXRestMapDiskFolder
2248
+ // private diskFileBaseMap: diskFileBaseMapServices
2249
+ ) {
2250
+ this.BXRestDiskFolder = BXRestDiskFolder;
2251
+ this.BXRestMapDiskFolder = BXRestMapDiskFolder;
2252
+ }
2253
+ // uploadfile(id: number, fileContent: string[]) {
2254
+ // return this.httpPost(
2255
+ // this.url.uploadfile,
2256
+ // {
2257
+ // id: id, // Идентификатор папки. В текущем API загружать файл по пути к папке невозможно. Необходимо обязательно вычислить ID папки
2258
+ // fileContent: fileContent, // Аналогично 'DETAIL_PICTURE' в примере Обработка файлов (['имя файла', 'содержимое в base64'])
2259
+ // data: {
2260
+ // NAME: fileContent[0]
2261
+ // } // Обязательное поле NAME - имя нового файла
2262
+ // // generateUniqueName Необязательный, по умолчанию false. При указании true, для загружаемого файла будет уникализировано имя, добавлением суффикса (1), (2) и т.п.
2263
+ // // rights Необязательный, по умолчанию пустой массив. Массив прав доступа на загружаемый файл.
2264
+ // }
2265
+ // )
2266
+ // }
2267
+ getchildren(id) {
2268
+ return this.BXRestDiskFolder.getchildren(id).pipe(map(v => {
2269
+ if (v && v.result) {
2270
+ return this.BXRestMapDiskFolder.getContent(BXRestMapResult(v));
2271
+ }
2272
+ return { file: [], folder: [] };
2273
+ }));
2274
+ }
2275
+ }
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 });
2277
+ BXRestDiskNavvyFolder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskNavvyFolder, providedIn: 'root' });
2278
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskNavvyFolder, decorators: [{
2279
+ type: Injectable,
2280
+ args: [{
2281
+ providedIn: 'root'
2282
+ }]
2283
+ }], ctorParameters: function () { return [{ type: BXRestDiskFolder }, { type: BXRestMapDiskFolder }]; } });
2284
+
2285
+ class BXRestMapDiskStorage extends BXRestMapDiskBase {
2286
+ getchildren(arr) {
2287
+ return this.separationFoldersAndFiles(arr);
2288
+ }
2289
+ }
2290
+ BXRestMapDiskStorage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapDiskStorage, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
2291
+ BXRestMapDiskStorage.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapDiskStorage, providedIn: 'root' });
2292
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMapDiskStorage, decorators: [{
2293
+ type: Injectable,
2294
+ args: [{
2295
+ providedIn: 'root'
2296
+ }]
2297
+ }] });
2298
+
2299
+ class BXRestDiskStorage {
2300
+ constructor(http) {
2301
+ this.http = http;
2302
+ this.url = {
2303
+ getfields: [$disk, $storage, $getFields],
2304
+ get: [$disk, $storage, $get],
2305
+ rename: [$disk, $storage, $rename],
2306
+ // Допустимо переименование только хранилища приложения (см. disk.storage.getforapp)
2307
+ getlist: [$disk, $storage, $getlist],
2308
+ gettypes: [$disk, $storage, $getTypes],
2309
+ addfolder: [$disk, $storage, 'addfolder'],
2310
+ getchildren: [$disk, $storage, $getchildren],
2311
+ // которые находятся непосредственно в корне хранилища
2312
+ uploadfile: [$disk, $storage, $uploadfile],
2313
+ getforapp: [$disk, $storage, 'getforapp'] // Возвращает описание хранилища,
2314
+ // с которым может работать приложение для хранения своих данных (файлов и папок)
2315
+ };
2316
+ }
2317
+ getforapp() {
2318
+ return this.http.post(this.url.getforapp, {}, 'get root app folder');
2319
+ }
2320
+ // TODO: разобраться с фильтром
2321
+ getchildren(param) {
2322
+ return this.http.post(this.url.getchildren, param, 'get root app folders and files');
2323
+ }
2324
+ // TODO: разобраться что возвращает и что вставлять
2325
+ addfolder(param) {
2326
+ return this.http.post(this.url.addfolder, param);
2327
+ }
2328
+ uploadfile(param) {
2329
+ return this.http.post(this.url.uploadfile, param);
2330
+ }
2331
+ }
2332
+ BXRestDiskStorage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskStorage, deps: [{ token: HttpBXServices }], target: i0.ɵɵFactoryTarget.Injectable });
2333
+ BXRestDiskStorage.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskStorage, providedIn: 'root' });
2334
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestDiskStorage, decorators: [{
2335
+ type: Injectable,
2336
+ args: [{
2337
+ providedIn: 'root'
2338
+ }]
2339
+ }], ctorParameters: function () { return [{ type: HttpBXServices }]; } });
2340
+
2341
+ class BXRestNavvyDiskStorage {
2342
+ // BXDiskFolder$ = new Observable<BXDiskFolderStore>()
2343
+ constructor(BXRestDiskStorage, BXRestMapDiskStorage
2344
+ // private store: Store<{ BXDiskFolder: BXDiskFolderStore }>,
2345
+ ) {
2346
+ this.BXRestDiskStorage = BXRestDiskStorage;
2347
+ this.BXRestMapDiskStorage = BXRestMapDiskStorage;
2348
+ // this.BXDiskFolder$ = this.store.select('BXDiskFolder')
2349
+ }
2350
+ 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
+ // )
2362
+ }
2363
+ // TODO: разобраться с фильтром позже
2364
+ getchildren(param) {
2365
+ return this.BXRestDiskStorage.getchildren(param).pipe(map(v => BXRestMapResult(v)), map(v => {
2366
+ if (v && v.length) {
2367
+ return this.BXRestMapDiskStorage.getchildren(v);
2368
+ }
2369
+ return { file: [], folder: [] };
2370
+ }));
2371
+ }
2372
+ // TODO: разобраться что возвращает и что вставлять
2373
+ addfolder(param) {
2374
+ return this.BXRestDiskStorage.addfolder(param).pipe(map(v => BXRestMapResult(v)));
2375
+ }
2376
+ uploadfile(param) {
2377
+ return this.BXRestDiskStorage.uploadfile(param);
2378
+ }
2379
+ }
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 });
2381
+ BXRestNavvyDiskStorage.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskStorage, providedIn: 'root' });
2382
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskStorage, decorators: [{
2383
+ type: Injectable,
2384
+ args: [{
2385
+ providedIn: 'root'
2386
+ }]
2387
+ }], ctorParameters: function () { return [{ type: BXRestDiskStorage }, { type: BXRestMapDiskStorage }]; } });
2388
+
2389
+ class BXRestNavvyDiskOperation {
2390
+ constructor(folder, disk, storage) {
2391
+ this.folder = folder;
2392
+ this.disk = disk;
2393
+ this.storage = storage;
2394
+ }
2395
+ // данные файла в base64
2396
+ loadFileInAppFolder(file) {
2397
+ return this.storage.getforapp().pipe(take$1(1), mergeMap$1(infoFolder => {
2398
+ if (infoFolder) {
2399
+ return this.storage.uploadfile({
2400
+ id: infoFolder.ID,
2401
+ fileContent: [file.name, file.val],
2402
+ data: {
2403
+ NAME: file.name
2404
+ },
2405
+ generateUniqueName: true
2406
+ }).pipe(map(v => BXRestMapResult(v)));
2407
+ }
2408
+ return of(undefined);
2409
+ }));
2410
+ }
2411
+ getOfCreateRootContentFolderApp(folderName) {
2412
+ return this.getOfCreateRootFolderApp(folderName).pipe(mergeMap$1(v => {
2413
+ if (v) {
2414
+ return this.folder.getchildren(v.ID);
2415
+ }
2416
+ return of(undefined);
2417
+ }));
2418
+ }
2419
+ getRootFoldersApp() {
2420
+ // return this.BXDiskFolder$.pipe(
2421
+ // take(1),
2422
+ // mergeMap(
2423
+ // saveData => {
2424
+ // if (saveData.content.root.app) {
2425
+ // return of(saveData.content.root.app)
2426
+ // }
2427
+ return this.storage.getforapp().pipe(mergeMap$1(v => {
2428
+ if (v && v.ID) {
2429
+ return this.storage.getchildren({ id: v.ID });
2430
+ // .pipe(
2431
+ // tap(v => {
2432
+ // if (v) {
2433
+ // this.store.dispatch(saveContentRootAppInfo({value: v}))
2434
+ // }
2435
+ // })
2436
+ // )
2437
+ }
2438
+ return of(undefined);
2439
+ }));
2440
+ // }
2441
+ // )
2442
+ // )
2443
+ }
2444
+ /**
2445
+ * Получать или создать папку, если её нет, с определенным именем для приложения
2446
+ * @param folderName
2447
+ */
2448
+ getOfCreateRootFolderApp(folderName) {
2449
+ return this.getRootFoldersApp().pipe(mergeMap$1(v => {
2450
+ if (v) {
2451
+ if (v.folder.length) {
2452
+ let find = v.folder.find(i => i.NAME === folderName);
2453
+ if (find) {
2454
+ return of(find);
2455
+ }
2456
+ }
2457
+ }
2458
+ return this.storage.getforapp().pipe(mergeMap$1(v => {
2459
+ if (v && v.ID) {
2460
+ return this.storage.addfolder({ id: v.ID, data: { NAME: folderName } });
2461
+ }
2462
+ return of(undefined);
2463
+ }));
2464
+ }));
2465
+ }
2466
+ }
2467
+ 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 });
2468
+ BXRestNavvyDiskOperation.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskOperation, providedIn: 'root' });
2469
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDiskOperation, decorators: [{
2470
+ type: Injectable,
2471
+ args: [{
2472
+ providedIn: 'root'
2473
+ }]
2474
+ }], ctorParameters: function () { return [{ type: BXRestDiskNavvyFolder }, { type: BXRestNavvyDiskFile }, { type: BXRestNavvyDiskStorage }]; } });
2475
+
2476
+ class BXRestNavvyDisk {
2477
+ constructor(file, folder, operation) {
2478
+ this.file = file;
2479
+ this.folder = folder;
2480
+ this.operation = operation;
2481
+ }
2482
+ }
2483
+ 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 });
2484
+ BXRestNavvyDisk.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDisk, providedIn: 'root' });
2485
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvyDisk, decorators: [{
2486
+ type: Injectable,
2487
+ args: [{
2488
+ providedIn: 'root'
2489
+ }]
2490
+ }], ctorParameters: function () { return [{ type: BXRestNavvyDiskFile }, { type: BXRestDiskNavvyFolder }, { type: BXRestNavvyDiskOperation }]; } });
1740
2491
 
1741
2492
  class BXRest {
1742
- constructor(user, lists) {
2493
+ constructor(user, lists, tasks, disk) {
1743
2494
  this.user = user;
1744
2495
  this.lists = lists;
2496
+ this.tasks = tasks;
2497
+ this.disk = disk;
1745
2498
  }
1746
2499
  }
1747
- 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 });
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 });
1748
2501
  BXRest.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRest, providedIn: 'root' });
1749
2502
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRest, decorators: [{
1750
2503
  type: Injectable,
1751
2504
  args: [{
1752
2505
  providedIn: 'root'
1753
2506
  }]
1754
- }], ctorParameters: function () { return [{ type: BXRestUser }, { type: BXRestLists }]; } });
2507
+ }], ctorParameters: function () { return [{ type: BXRestUser }, { type: BXRestLists }, { type: BXRestTasks }, { type: BXRestDisk }]; } });
2508
+ class BXRestNavvy {
2509
+ constructor(user, lists, tasks, disk) {
2510
+ this.user = user;
2511
+ this.lists = lists;
2512
+ this.tasks = tasks;
2513
+ this.disk = disk;
2514
+ }
2515
+ }
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 });
2517
+ BXRestNavvy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvy, providedIn: 'root' });
2518
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestNavvy, decorators: [{
2519
+ type: Injectable,
2520
+ args: [{
2521
+ providedIn: 'root'
2522
+ }]
2523
+ }], ctorParameters: function () { return [{ type: BXRestNavvyUser }, { type: BXRestNavvyLists }, { type: BXRestNavvyTasks }, { type: BXRestNavvyDisk }]; } });
2524
+ class BXRestMap {
2525
+ constructor(lists) {
2526
+ this.lists = lists;
2527
+ }
2528
+ }
2529
+ BXRestMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMap, deps: [{ token: BXRestMapLists }], target: i0.ɵɵFactoryTarget.Injectable });
2530
+ BXRestMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMap, providedIn: 'root' });
2531
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestMap, decorators: [{
2532
+ type: Injectable,
2533
+ args: [{
2534
+ providedIn: 'root'
2535
+ }]
2536
+ }], ctorParameters: function () { return [{ type: BXRestMapLists }]; } });
1755
2537
 
1756
2538
  /*
1757
2539
  * Public API Surface of bx-rest
@@ -1761,5 +2543,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1761
2543
  * Generated bundle index. Do not edit.
1762
2544
  */
1763
2545
 
1764
- export { BXRest };
2546
+ export { BXRest, BXRestMap, BXRestMapResult, BXRestNavvy, REST_SETTINGS };
1765
2547
  //# sourceMappingURL=bx-rest.mjs.map