bx-rest 0.0.12 → 0.0.14
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.
- package/README.md +5 -17
- package/consts/part-name-metods.d.ts +63 -0
- package/esm2020/consts/part-name-metods.mjs +64 -1
- package/esm2020/functions/mapResult.mjs +7 -0
- package/esm2020/map/base.mjs +14 -0
- package/esm2020/map/lists/element.mjs +22 -0
- package/esm2020/public-api.mjs +4 -3
- package/esm2020/request/lists/element.mjs +64 -0
- package/esm2020/request/lists.mjs +46 -0
- package/esm2020/request/user.mjs +227 -0
- package/esm2020/services/base.mjs +2 -2
- package/esm2020/services/map/rest/user.mjs +2 -2
- package/esm2020/typification/rest/lists/element/get.mjs +2 -0
- package/fesm2015/bx-rest.mjs +469 -326
- package/fesm2015/bx-rest.mjs.map +1 -1
- package/fesm2020/bx-rest.mjs +466 -323
- package/fesm2020/bx-rest.mjs.map +1 -1
- package/functions/mapResult.d.ts +2 -0
- package/map/base.d.ts +6 -0
- package/map/lists/element.d.ts +8 -0
- package/package.json +1 -1
- package/public-api.d.ts +3 -2
- package/request/lists/element.d.ts +29 -0
- package/request/lists.d.ts +18 -0
- package/request/user.d.ts +59 -0
- package/services/base.d.ts +1 -1
- package/typification/rest/lists/element/get.d.ts +28 -0
- package/esm2020/request/user/user.mjs +0 -279
- package/esm2020/typification/rest/user/CustomUserFieldInfo.mjs +0 -2
- package/esm2020/typification/rest/user/userFilter.mjs +0 -2
- package/request/user/user.d.ts +0 -63
- package/typification/rest/user/CustomUserFieldInfo.d.ts +0 -56
- package/typification/rest/user/userFilter.d.ts +0 -13
package/fesm2015/bx-rest.mjs
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as i0 from '@angular/core';
|
|
3
|
-
import { Injectable, NgModule, inject, Component, ViewEncapsulation, Inject } from '@angular/core';
|
|
4
|
-
import { DateTime } from 'luxon';
|
|
5
|
-
import { Subscription, filter, take, of, throwError, forkJoin, mergeMap } from 'rxjs';
|
|
1
|
+
import { Subscription, filter, take, of, throwError, forkJoin, mergeMap, Observable } from 'rxjs';
|
|
6
2
|
import { map, catchError, tap, mergeMap as mergeMap$1, first } from 'rxjs/operators';
|
|
7
3
|
import clone from 'just-clone';
|
|
8
|
-
import
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { NgModule, inject, Component, ViewEncapsulation, Inject, Injectable } from '@angular/core';
|
|
9
6
|
import * as i1$1 from '@angular/material/snack-bar';
|
|
10
7
|
import { MatSnackBarRef, MAT_SNACK_BAR_DATA } from '@angular/material/snack-bar';
|
|
11
8
|
import * as i2 from '@angular/material/icon';
|
|
@@ -14,187 +11,14 @@ import * as i1 from '@angular/material/button';
|
|
|
14
11
|
import { MatButtonModule } from '@angular/material/button';
|
|
15
12
|
import * as i1$2 from '@ngrx/store';
|
|
16
13
|
import { createAction, props, createReducer, on } from '@ngrx/store';
|
|
14
|
+
import { __awaiter } from 'tslib';
|
|
15
|
+
import { DateTime } from 'luxon';
|
|
17
16
|
import * as i2$1 from '@angular/router';
|
|
18
17
|
import flatten from 'just-flatten-it';
|
|
19
18
|
import * as i1$3 from '@angular/common/http';
|
|
20
19
|
import { HttpParams } from '@angular/common/http';
|
|
21
20
|
import * as i3 from '@angular/common';
|
|
22
21
|
|
|
23
|
-
const time = {
|
|
24
|
-
oneDayMilliseconds: 1000 * 60 * 60 * 24
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
class BaseServices {
|
|
28
|
-
toStr(val) {
|
|
29
|
-
return (val) ? String(val) : '';
|
|
30
|
-
}
|
|
31
|
-
toNumber(val) {
|
|
32
|
-
return (val && Number(val)) ? Number(val) : 0;
|
|
33
|
-
}
|
|
34
|
-
toDate(val, format, opt) {
|
|
35
|
-
if (val instanceof Date) {
|
|
36
|
-
return val;
|
|
37
|
-
}
|
|
38
|
-
else if (typeof val == 'string') {
|
|
39
|
-
if (format) {
|
|
40
|
-
if (opt) {
|
|
41
|
-
return DateTime.fromFormat(val, format, opt).toJSDate();
|
|
42
|
-
}
|
|
43
|
-
return DateTime.fromFormat(val, format).toJSDate();
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
return new Date(val);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
else if (typeof val == 'number') {
|
|
50
|
-
return new Date(val);
|
|
51
|
-
}
|
|
52
|
-
console.error('Wrong date format', val, format);
|
|
53
|
-
throw 'Wrong date format';
|
|
54
|
-
}
|
|
55
|
-
getBXStrTime(date) {
|
|
56
|
-
return this.toISOStringWithTimezone(date);
|
|
57
|
-
}
|
|
58
|
-
toISOStringWithTimezone(date) {
|
|
59
|
-
const tzOffset = -date.getTimezoneOffset();
|
|
60
|
-
const diff = tzOffset >= 0 ? '+' : '-';
|
|
61
|
-
const pad = (n) => `${Math.floor(Math.abs(n))}`.padStart(2, '0');
|
|
62
|
-
return date.getFullYear() +
|
|
63
|
-
'-' + pad(date.getMonth() + 1) +
|
|
64
|
-
'-' + pad(date.getDate()) +
|
|
65
|
-
'T' + pad(date.getHours()) +
|
|
66
|
-
':' + pad(date.getMinutes()) +
|
|
67
|
-
':' + pad(date.getSeconds()) +
|
|
68
|
-
diff + pad(tzOffset / 60) +
|
|
69
|
-
':' + pad(tzOffset % 60);
|
|
70
|
-
}
|
|
71
|
-
;
|
|
72
|
-
toBool(val) {
|
|
73
|
-
switch (typeof val) {
|
|
74
|
-
case 'string':
|
|
75
|
-
val = val.toLowerCase();
|
|
76
|
-
if (val === 'n' || val === 'y') { // битриксовые понятия о bool
|
|
77
|
-
return val === 'y';
|
|
78
|
-
}
|
|
79
|
-
else if (val === 'true' || val === 'false') { // битриксовые понятия о bool
|
|
80
|
-
return val === 'true';
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
default:
|
|
86
|
-
return Boolean(val);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
toBXYorN(val) {
|
|
90
|
-
return (val) ? 'Y' : 'N';
|
|
91
|
-
}
|
|
92
|
-
typeof(val) {
|
|
93
|
-
return typeof val;
|
|
94
|
-
}
|
|
95
|
-
typeDefClass(val) {
|
|
96
|
-
if (val) {
|
|
97
|
-
if (val instanceof Date) {
|
|
98
|
-
return 'date';
|
|
99
|
-
}
|
|
100
|
-
return undefined;
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
toJSON(val) {
|
|
107
|
-
return JSON.stringify(val);
|
|
108
|
-
}
|
|
109
|
-
fromJSON(val) {
|
|
110
|
-
return JSON.parse(val);
|
|
111
|
-
}
|
|
112
|
-
prepareBaseAddress(url, add = '') {
|
|
113
|
-
if (url.search('https://') !== 0 && url.search('http://')) {
|
|
114
|
-
url = 'https://' + url;
|
|
115
|
-
}
|
|
116
|
-
if (url.lastIndexOf('/') !== (url.length - 1)) {
|
|
117
|
-
url = url + '/';
|
|
118
|
-
}
|
|
119
|
-
url = url + add;
|
|
120
|
-
return url;
|
|
121
|
-
}
|
|
122
|
-
getHomeAddress() {
|
|
123
|
-
// return this.prepareBaseAddress(environment.urls.home)
|
|
124
|
-
return this.prepareBaseAddress('b24.trace-studio.com');
|
|
125
|
-
}
|
|
126
|
-
dateDiff(a, b) {
|
|
127
|
-
return new Date(a.valueOf() - b.valueOf());
|
|
128
|
-
}
|
|
129
|
-
dateDiffInDays(a, b) {
|
|
130
|
-
return Math.floor(this.dateDiff(a, b).valueOf() / time.oneDayMilliseconds);
|
|
131
|
-
}
|
|
132
|
-
getBase64File(file) {
|
|
133
|
-
return new Promise((resolve, reject) => {
|
|
134
|
-
const reader = new FileReader();
|
|
135
|
-
reader.readAsDataURL(file);
|
|
136
|
-
reader.onload = () => resolve(reader.result);
|
|
137
|
-
reader.onerror = error => reject(error);
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
getBase64FileLikeStr(file) {
|
|
141
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
142
|
-
let result = yield this.getBase64File(file);
|
|
143
|
-
if (typeof result === 'string') {
|
|
144
|
-
let split = result.split(',');
|
|
145
|
-
return {
|
|
146
|
-
header: split[0],
|
|
147
|
-
val: split[1]
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
return undefined;
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
sumArray(numbers) {
|
|
154
|
-
return numbers.reduce((a, b) => {
|
|
155
|
-
return a + b;
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
isItTheSameDate(date1, date2) {
|
|
159
|
-
return date1.getDate() === date2.getDate()
|
|
160
|
-
&& date1.getMonth() === date2.getMonth()
|
|
161
|
-
&& date1.getFullYear() === date2.getFullYear();
|
|
162
|
-
}
|
|
163
|
-
toUnix(date) {
|
|
164
|
-
return Math.floor(date.valueOf() / 1000);
|
|
165
|
-
}
|
|
166
|
-
arrSum(x) {
|
|
167
|
-
let s = 0;
|
|
168
|
-
for (let i = 0; i < x.length; i++) {
|
|
169
|
-
s += x[i];
|
|
170
|
-
}
|
|
171
|
-
return s;
|
|
172
|
-
}
|
|
173
|
-
getBaseUrlHttps(url, component = false) {
|
|
174
|
-
if (component) {
|
|
175
|
-
return encodeURI(this.cropUrl(url) + '/');
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
return encodeURI('https://' + this.cropUrl(url) + '/');
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
cropUrl(url) {
|
|
182
|
-
url = (url) ? url.replace('https://', '') : '';
|
|
183
|
-
url = (url) ? url.replace('http://', '') : '';
|
|
184
|
-
url = (url) ? url.replace('https:', '') : '';
|
|
185
|
-
url = (url) ? url.replace('http:', '') : '';
|
|
186
|
-
return url;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
BaseServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseServices, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
190
|
-
BaseServices.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseServices, providedIn: 'root' });
|
|
191
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseServices, decorators: [{
|
|
192
|
-
type: Injectable,
|
|
193
|
-
args: [{
|
|
194
|
-
providedIn: 'root'
|
|
195
|
-
}]
|
|
196
|
-
}] });
|
|
197
|
-
|
|
198
22
|
class BxRestModule {
|
|
199
23
|
}
|
|
200
24
|
BxRestModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BxRestModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -564,6 +388,181 @@ function authReducer(state = initialState$1, action) {
|
|
|
564
388
|
return _authReducer(state, action);
|
|
565
389
|
}
|
|
566
390
|
|
|
391
|
+
const time = {
|
|
392
|
+
oneDayMilliseconds: 1000 * 60 * 60 * 24
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
class BaseServices {
|
|
396
|
+
toStr(val) {
|
|
397
|
+
return (val) ? String(val) : '';
|
|
398
|
+
}
|
|
399
|
+
toNum(val) {
|
|
400
|
+
return (val && Number(val)) ? Number(val) : 0;
|
|
401
|
+
}
|
|
402
|
+
toDate(val, format, opt) {
|
|
403
|
+
if (val instanceof Date) {
|
|
404
|
+
return val;
|
|
405
|
+
}
|
|
406
|
+
else if (typeof val == 'string') {
|
|
407
|
+
if (format) {
|
|
408
|
+
if (opt) {
|
|
409
|
+
return DateTime.fromFormat(val, format, opt).toJSDate();
|
|
410
|
+
}
|
|
411
|
+
return DateTime.fromFormat(val, format).toJSDate();
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
return new Date(val);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
else if (typeof val == 'number') {
|
|
418
|
+
return new Date(val);
|
|
419
|
+
}
|
|
420
|
+
console.error('Wrong date format', val, format);
|
|
421
|
+
throw 'Wrong date format';
|
|
422
|
+
}
|
|
423
|
+
getBXStrTime(date) {
|
|
424
|
+
return this.toISOStringWithTimezone(date);
|
|
425
|
+
}
|
|
426
|
+
toISOStringWithTimezone(date) {
|
|
427
|
+
const tzOffset = -date.getTimezoneOffset();
|
|
428
|
+
const diff = tzOffset >= 0 ? '+' : '-';
|
|
429
|
+
const pad = (n) => `${Math.floor(Math.abs(n))}`.padStart(2, '0');
|
|
430
|
+
return date.getFullYear() +
|
|
431
|
+
'-' + pad(date.getMonth() + 1) +
|
|
432
|
+
'-' + pad(date.getDate()) +
|
|
433
|
+
'T' + pad(date.getHours()) +
|
|
434
|
+
':' + pad(date.getMinutes()) +
|
|
435
|
+
':' + pad(date.getSeconds()) +
|
|
436
|
+
diff + pad(tzOffset / 60) +
|
|
437
|
+
':' + pad(tzOffset % 60);
|
|
438
|
+
}
|
|
439
|
+
;
|
|
440
|
+
toBool(val) {
|
|
441
|
+
switch (typeof val) {
|
|
442
|
+
case 'string':
|
|
443
|
+
val = val.toLowerCase();
|
|
444
|
+
if (val === 'n' || val === 'y') { // битриксовые понятия о bool
|
|
445
|
+
return val === 'y';
|
|
446
|
+
}
|
|
447
|
+
else if (val === 'true' || val === 'false') { // битриксовые понятия о bool
|
|
448
|
+
return val === 'true';
|
|
449
|
+
}
|
|
450
|
+
else {
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
default:
|
|
454
|
+
return Boolean(val);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
toBXYorN(val) {
|
|
458
|
+
return (val) ? 'Y' : 'N';
|
|
459
|
+
}
|
|
460
|
+
typeof(val) {
|
|
461
|
+
return typeof val;
|
|
462
|
+
}
|
|
463
|
+
typeDefClass(val) {
|
|
464
|
+
if (val) {
|
|
465
|
+
if (val instanceof Date) {
|
|
466
|
+
return 'date';
|
|
467
|
+
}
|
|
468
|
+
return undefined;
|
|
469
|
+
}
|
|
470
|
+
else {
|
|
471
|
+
return null;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
toJSON(val) {
|
|
475
|
+
return JSON.stringify(val);
|
|
476
|
+
}
|
|
477
|
+
fromJSON(val) {
|
|
478
|
+
return JSON.parse(val);
|
|
479
|
+
}
|
|
480
|
+
prepareBaseAddress(url, add = '') {
|
|
481
|
+
if (url.search('https://') !== 0 && url.search('http://')) {
|
|
482
|
+
url = 'https://' + url;
|
|
483
|
+
}
|
|
484
|
+
if (url.lastIndexOf('/') !== (url.length - 1)) {
|
|
485
|
+
url = url + '/';
|
|
486
|
+
}
|
|
487
|
+
url = url + add;
|
|
488
|
+
return url;
|
|
489
|
+
}
|
|
490
|
+
getHomeAddress() {
|
|
491
|
+
// return this.prepareBaseAddress(environment.urls.home)
|
|
492
|
+
return this.prepareBaseAddress('b24.trace-studio.com');
|
|
493
|
+
}
|
|
494
|
+
dateDiff(a, b) {
|
|
495
|
+
return new Date(a.valueOf() - b.valueOf());
|
|
496
|
+
}
|
|
497
|
+
dateDiffInDays(a, b) {
|
|
498
|
+
return Math.floor(this.dateDiff(a, b).valueOf() / time.oneDayMilliseconds);
|
|
499
|
+
}
|
|
500
|
+
getBase64File(file) {
|
|
501
|
+
return new Promise((resolve, reject) => {
|
|
502
|
+
const reader = new FileReader();
|
|
503
|
+
reader.readAsDataURL(file);
|
|
504
|
+
reader.onload = () => resolve(reader.result);
|
|
505
|
+
reader.onerror = error => reject(error);
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
getBase64FileLikeStr(file) {
|
|
509
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
510
|
+
let result = yield this.getBase64File(file);
|
|
511
|
+
if (typeof result === 'string') {
|
|
512
|
+
let split = result.split(',');
|
|
513
|
+
return {
|
|
514
|
+
header: split[0],
|
|
515
|
+
val: split[1]
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
return undefined;
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
sumArray(numbers) {
|
|
522
|
+
return numbers.reduce((a, b) => {
|
|
523
|
+
return a + b;
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
isItTheSameDate(date1, date2) {
|
|
527
|
+
return date1.getDate() === date2.getDate()
|
|
528
|
+
&& date1.getMonth() === date2.getMonth()
|
|
529
|
+
&& date1.getFullYear() === date2.getFullYear();
|
|
530
|
+
}
|
|
531
|
+
toUnix(date) {
|
|
532
|
+
return Math.floor(date.valueOf() / 1000);
|
|
533
|
+
}
|
|
534
|
+
arrSum(x) {
|
|
535
|
+
let s = 0;
|
|
536
|
+
for (let i = 0; i < x.length; i++) {
|
|
537
|
+
s += x[i];
|
|
538
|
+
}
|
|
539
|
+
return s;
|
|
540
|
+
}
|
|
541
|
+
getBaseUrlHttps(url, component = false) {
|
|
542
|
+
if (component) {
|
|
543
|
+
return encodeURI(this.cropUrl(url) + '/');
|
|
544
|
+
}
|
|
545
|
+
else {
|
|
546
|
+
return encodeURI('https://' + this.cropUrl(url) + '/');
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
cropUrl(url) {
|
|
550
|
+
url = (url) ? url.replace('https://', '') : '';
|
|
551
|
+
url = (url) ? url.replace('http://', '') : '';
|
|
552
|
+
url = (url) ? url.replace('https:', '') : '';
|
|
553
|
+
url = (url) ? url.replace('http:', '') : '';
|
|
554
|
+
return url;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
BaseServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseServices, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
558
|
+
BaseServices.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseServices, providedIn: 'root' });
|
|
559
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseServices, decorators: [{
|
|
560
|
+
type: Injectable,
|
|
561
|
+
args: [{
|
|
562
|
+
providedIn: 'root'
|
|
563
|
+
}]
|
|
564
|
+
}] });
|
|
565
|
+
|
|
567
566
|
class LocalStorageServices {
|
|
568
567
|
static get(name) {
|
|
569
568
|
return localStorage.getItem(name);
|
|
@@ -1272,23 +1271,93 @@ const $task = 'task';
|
|
|
1272
1271
|
const $calendar = 'calendar';
|
|
1273
1272
|
const $meeting = 'meeting';
|
|
1274
1273
|
const $list = 'list';
|
|
1275
|
-
const $search = 'search';
|
|
1274
|
+
const $search = 'search';
|
|
1275
|
+
const $accessibility = 'accessibility';
|
|
1276
|
+
const $delete = 'delete';
|
|
1277
|
+
const $nearest = 'nearest';
|
|
1278
|
+
const $params = 'params';
|
|
1279
|
+
const $status = 'status';
|
|
1280
|
+
const $resource = 'resource';
|
|
1281
|
+
const $booking = 'booking';
|
|
1282
|
+
const $section = 'section';
|
|
1283
|
+
const $settings = 'settings';
|
|
1284
|
+
const $tasks = 'tasks';
|
|
1285
|
+
const $elapseditem = 'elapseditem';
|
|
1286
|
+
const $getlist = 'getlist';
|
|
1287
|
+
const $approve = 'approve';
|
|
1288
|
+
const $complete = 'complete';
|
|
1289
|
+
const $counters = 'counters';
|
|
1290
|
+
const $deger = 'deger';
|
|
1291
|
+
const $delegate = 'delegate';
|
|
1292
|
+
const $disapprove = 'disapprove';
|
|
1293
|
+
const $favorite = 'favorite';
|
|
1294
|
+
const $files = 'files';
|
|
1295
|
+
const $file = 'file';
|
|
1296
|
+
const $attach = 'attach';
|
|
1297
|
+
const $field = 'field';
|
|
1298
|
+
const $getFields = 'get' + $field + 's';
|
|
1299
|
+
const $getaccess = 'getaccess';
|
|
1300
|
+
const $history = 'history';
|
|
1301
|
+
const $pause = 'pause';
|
|
1302
|
+
const $renew = 'renew';
|
|
1303
|
+
const $start = 'start';
|
|
1304
|
+
const $result = 'result';
|
|
1305
|
+
const $planner = 'planner';
|
|
1306
|
+
const $disk = 'disk';
|
|
1307
|
+
const $rename = 'rename';
|
|
1308
|
+
const $markdeleted = 'markdeleted';
|
|
1309
|
+
const $restore = 'restore';
|
|
1310
|
+
const $folder = 'folder';
|
|
1311
|
+
const $getchildren = 'getchildren';
|
|
1312
|
+
const $copyto = 'copyto';
|
|
1313
|
+
const $moveto = 'moveto';
|
|
1314
|
+
const $uploadfile = 'uploadfile';
|
|
1315
|
+
const $storage = 'storage';
|
|
1316
|
+
const $getTypes = 'getTypes';
|
|
1317
|
+
const $stages = 'stages';
|
|
1318
|
+
const $getmanifest = 'getmanifest';
|
|
1319
|
+
const $isactionallowed = 'isactionallowed';
|
|
1320
|
+
const $commentitem = 'commentitem';
|
|
1321
|
+
const $department = 'department';
|
|
1322
|
+
const $sonet_group = 'sonet_group';
|
|
1323
|
+
const $create = 'create';
|
|
1324
|
+
const $feature = 'feature';
|
|
1325
|
+
const $access = 'access';
|
|
1326
|
+
const $request = 'request';
|
|
1327
|
+
const $socialnetwork = 'socialnetwork';
|
|
1328
|
+
const $api = 'api';
|
|
1329
|
+
const $workgroup = 'workgroup';
|
|
1330
|
+
const $log = 'log';
|
|
1331
|
+
const $blogpost = 'blogpost';
|
|
1332
|
+
const $lists = 'lists';
|
|
1333
|
+
const $iblock = 'iblock';
|
|
1334
|
+
const $type = 'type';
|
|
1335
|
+
const $id = 'id';
|
|
1336
|
+
const $element = 'element';
|
|
1337
|
+
const $url = 'url';
|
|
1276
1338
|
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1339
|
+
function mapResult(v) {
|
|
1340
|
+
if (v && (v.result || typeof v.result === 'boolean')) {
|
|
1341
|
+
return v.result;
|
|
1342
|
+
}
|
|
1343
|
+
return undefined;
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
let BaseMapServices$1 = class BaseMapServices extends BaseServices {
|
|
1347
|
+
};
|
|
1348
|
+
BaseMapServices$1.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseMapServices$1, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1349
|
+
BaseMapServices$1.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseMapServices$1, providedIn: 'root' });
|
|
1350
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseMapServices$1, decorators: [{
|
|
1282
1351
|
type: Injectable,
|
|
1283
1352
|
args: [{
|
|
1284
1353
|
providedIn: 'root'
|
|
1285
1354
|
}]
|
|
1286
1355
|
}] });
|
|
1287
1356
|
|
|
1288
|
-
class BitrixApiUserMapServices extends BaseMapServices {
|
|
1357
|
+
class BitrixApiUserMapServices extends BaseMapServices$1 {
|
|
1289
1358
|
HttpToBX(user) {
|
|
1290
1359
|
let res = Object.assign(clone(user), {
|
|
1291
|
-
ID: this.
|
|
1360
|
+
ID: this.toNum(user.ID),
|
|
1292
1361
|
IS_ONLINE: this.toBool(user.IS_ONLINE),
|
|
1293
1362
|
DATE_REGISTER: this.toDate(user.DATE_REGISTER),
|
|
1294
1363
|
PERSONAL_BIRTHDAY: this.toDate(user.PERSONAL_BIRTHDAY),
|
|
@@ -1383,7 +1452,7 @@ class BXRestUser {
|
|
|
1383
1452
|
this.url = {
|
|
1384
1453
|
admin: [$user, 'admin'],
|
|
1385
1454
|
get: [$user, $get],
|
|
1386
|
-
|
|
1455
|
+
current: [$user, 'current'],
|
|
1387
1456
|
update: [$user, $update],
|
|
1388
1457
|
search: [$user, $search],
|
|
1389
1458
|
access: [$user, 'access'],
|
|
@@ -1400,6 +1469,9 @@ class BXRestUser {
|
|
|
1400
1469
|
};
|
|
1401
1470
|
this.user$ = this.store.select('users');
|
|
1402
1471
|
}
|
|
1472
|
+
admin() {
|
|
1473
|
+
return this.http.get(this.url.admin);
|
|
1474
|
+
}
|
|
1403
1475
|
get(params = {}) {
|
|
1404
1476
|
let copyParams = clone(params);
|
|
1405
1477
|
this.setDefParam(copyParams);
|
|
@@ -1410,28 +1482,7 @@ class BXRestUser {
|
|
|
1410
1482
|
}
|
|
1411
1483
|
}));
|
|
1412
1484
|
}
|
|
1413
|
-
|
|
1414
|
-
return this.get({ start: (page - 1) * 50 }).pipe(map(v => {
|
|
1415
|
-
let res = this.http.mapResult(v);
|
|
1416
|
-
return (res) ? res.map(r => this.userMap.HttpToBX(r)) : undefined;
|
|
1417
|
-
}));
|
|
1418
|
-
}
|
|
1419
|
-
getByID(id, reload = true) {
|
|
1420
|
-
return this.getByIDs([id], reload).pipe(map(v => (v && v.length) ? v[0] : undefined));
|
|
1421
|
-
}
|
|
1422
|
-
getByIDs(ids, reload = true) {
|
|
1423
|
-
ids = Array.from(new Set(ids));
|
|
1424
|
-
return this.user$.pipe(take(1), mergeMap$1(v => {
|
|
1425
|
-
if (!reload) {
|
|
1426
|
-
let find = v.data.filter(i => ids.includes(i.ID));
|
|
1427
|
-
if (find && find.length === ids.length) {
|
|
1428
|
-
return of(find);
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
return this.getAll({ ID: ids, ACTIVE: 2 }).pipe(map(v => (v && v.length) ? v : undefined));
|
|
1432
|
-
}));
|
|
1433
|
-
}
|
|
1434
|
-
getSelf(update = false) {
|
|
1485
|
+
current(update = false) {
|
|
1435
1486
|
if (update) {
|
|
1436
1487
|
return this.getSelfHttp();
|
|
1437
1488
|
}
|
|
@@ -1447,7 +1498,7 @@ class BXRestUser {
|
|
|
1447
1498
|
}
|
|
1448
1499
|
}
|
|
1449
1500
|
getSelfHttp() {
|
|
1450
|
-
return this.http.get(this.url.
|
|
1501
|
+
return this.http.get(this.url.current, {}, 'Не удалось получить пользователя')
|
|
1451
1502
|
.pipe(map(v => {
|
|
1452
1503
|
if (v && v.result) {
|
|
1453
1504
|
return this.userMap.HttpToBX(v.result);
|
|
@@ -1460,79 +1511,42 @@ class BXRestUser {
|
|
|
1460
1511
|
}));
|
|
1461
1512
|
}
|
|
1462
1513
|
access(access, textError = 'Не удалось получить права') {
|
|
1463
|
-
return this.http.get(this.url.access, { ACCESS: access }, textError)
|
|
1464
|
-
}
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
this.store.dispatch(loadAll({ load: true }));
|
|
1500
|
-
}
|
|
1501
|
-
params.start = this.def.params.start;
|
|
1502
|
-
}));
|
|
1503
|
-
}
|
|
1504
|
-
getAllByPersonalBirthday(day = undefined, month = undefined, checkWeekend = false) {
|
|
1505
|
-
return this.http.timeNowOnServer().pipe(mergeMap$1(date => {
|
|
1506
|
-
if (date) {
|
|
1507
|
-
let daySent = (day) ? day : date.getDate();
|
|
1508
|
-
let start = date.getFullYear() + 1;
|
|
1509
|
-
let monthSent = (month) ? month : date.getMonth() + 1;
|
|
1510
|
-
let arr = Array.from(Array(200).keys()).map(_ => {
|
|
1511
|
-
start--;
|
|
1512
|
-
let res = this.datePipe.transform(new Date(start, monthSent - 1, daySent), 'YYYY-MM-dd');
|
|
1513
|
-
return (res) ? res : '';
|
|
1514
|
-
});
|
|
1515
|
-
// TODO: Упростить
|
|
1516
|
-
if (checkWeekend && date.getDay() === 1) {
|
|
1517
|
-
start = date.getFullYear() + 1;
|
|
1518
|
-
arr.push(...Array.from(Array(200).keys()).map(_ => {
|
|
1519
|
-
start--;
|
|
1520
|
-
let res = this.datePipe.transform(new Date(start, monthSent - 1, daySent - 1), 'YYYY-MM-dd');
|
|
1521
|
-
return (res) ? res : '';
|
|
1522
|
-
}));
|
|
1523
|
-
start = date.getFullYear() + 1;
|
|
1524
|
-
arr.push(...Array.from(Array(200).keys()).map(_ => {
|
|
1525
|
-
start--;
|
|
1526
|
-
let res = this.datePipe.transform(new Date(start, monthSent - 1, daySent - 2), 'YYYY-MM-dd');
|
|
1527
|
-
return (res) ? res : '';
|
|
1528
|
-
}));
|
|
1529
|
-
}
|
|
1530
|
-
return this.getAll({ PERSONAL_BIRTHDAY: arr });
|
|
1531
|
-
}
|
|
1532
|
-
this.snackBar.warning('Не удалось получить время сервера');
|
|
1533
|
-
return of(undefined);
|
|
1534
|
-
}));
|
|
1535
|
-
}
|
|
1514
|
+
return this.http.get(this.url.access, { ACCESS: access }, textError);
|
|
1515
|
+
}
|
|
1516
|
+
// getAll(params: iBXGetParam = {}): Observable<iBXRestUser [] | undefined> {
|
|
1517
|
+
// if (!Object.keys(params).length) {
|
|
1518
|
+
// params = clone(this.def.params)
|
|
1519
|
+
// }
|
|
1520
|
+
//
|
|
1521
|
+
// const saveAllUser = compare(params, this.def.params)
|
|
1522
|
+
// return this.user$.pipe(
|
|
1523
|
+
// take(1),
|
|
1524
|
+
// mergeMap(v => {
|
|
1525
|
+
// if (v.load.all) {
|
|
1526
|
+
// if (compare(this.def.params, params)) {
|
|
1527
|
+
// return of(clone(v.data))
|
|
1528
|
+
// }
|
|
1529
|
+
// }
|
|
1530
|
+
//
|
|
1531
|
+
// return this.getEndArray(params).pipe(
|
|
1532
|
+
// take(1),
|
|
1533
|
+
// map(v => {
|
|
1534
|
+
// if (v && v.result) {
|
|
1535
|
+
// let cl = clone(v.result)
|
|
1536
|
+
// return this.saveArrUser(cl)
|
|
1537
|
+
// }
|
|
1538
|
+
// return undefined
|
|
1539
|
+
// }),
|
|
1540
|
+
// )
|
|
1541
|
+
// }),
|
|
1542
|
+
// tap(v => {
|
|
1543
|
+
// if (v && v.length && saveAllUser) {
|
|
1544
|
+
// this.store.dispatch(loadAll({load: true}))
|
|
1545
|
+
// }
|
|
1546
|
+
// params.start = this.def.params.start
|
|
1547
|
+
// })
|
|
1548
|
+
// )
|
|
1549
|
+
// }
|
|
1536
1550
|
saveArrUser(users) {
|
|
1537
1551
|
let result = [];
|
|
1538
1552
|
for (const user of users) {
|
|
@@ -1548,19 +1562,10 @@ class BXRestUser {
|
|
|
1548
1562
|
if (typeof params.ACTIVE !== 'boolean') {
|
|
1549
1563
|
params.ACTIVE = true;
|
|
1550
1564
|
}
|
|
1551
|
-
return this.http.get(this.url.search, params, 'Сервер не отвечает на запрос поиска')
|
|
1552
|
-
.pipe(map(v => {
|
|
1553
|
-
if (v && v.result) {
|
|
1554
|
-
const mapResult = this.http.mapResult(v);
|
|
1555
|
-
if (mapResult) {
|
|
1556
|
-
return this.saveArrUser(mapResult);
|
|
1557
|
-
}
|
|
1558
|
-
}
|
|
1559
|
-
return undefined;
|
|
1560
|
-
}));
|
|
1565
|
+
return this.http.get(this.url.search, params, 'Сервер не отвечает на запрос поиска');
|
|
1561
1566
|
}
|
|
1562
1567
|
fields() {
|
|
1563
|
-
return this.http.get(this.url.fields)
|
|
1568
|
+
return this.http.get(this.url.fields);
|
|
1564
1569
|
}
|
|
1565
1570
|
update(user, fieldUpdate) {
|
|
1566
1571
|
if (fieldUpdate && fieldUpdate.length) {
|
|
@@ -1583,27 +1588,25 @@ class BXRestUser {
|
|
|
1583
1588
|
return of({});
|
|
1584
1589
|
}
|
|
1585
1590
|
}
|
|
1586
|
-
getEndArray(params = {}) {
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
// getUrlCompressedImage(url: string, width: number, height: number) {
|
|
1606
|
-
// return this.img.getUrlCompressed(url, width, height)
|
|
1591
|
+
// getEndArray(params: UserFilter = {}): Observable<iHttpAnswerBX<iBXRestUserHttp[]> | undefined> {
|
|
1592
|
+
// return this.get(params).pipe(
|
|
1593
|
+
// mergeMap(items => {
|
|
1594
|
+
// if (items && items.result && typeof items.result === 'object') {
|
|
1595
|
+
// if (items.next) {
|
|
1596
|
+
// params.start = items.next
|
|
1597
|
+
// return this.getEndArray(params).pipe(map(vEnd => {
|
|
1598
|
+
// if (vEnd && items.result && vEnd.result) {
|
|
1599
|
+
// return {result: [...items.result, ...vEnd.result]}
|
|
1600
|
+
// }
|
|
1601
|
+
// return (items) ? items : undefined
|
|
1602
|
+
// }))
|
|
1603
|
+
// }
|
|
1604
|
+
// return of(items)
|
|
1605
|
+
// } else {
|
|
1606
|
+
// return of(undefined)
|
|
1607
|
+
// }
|
|
1608
|
+
// }),
|
|
1609
|
+
// )
|
|
1607
1610
|
// }
|
|
1608
1611
|
setDefParam(params) {
|
|
1609
1612
|
if (!params.hasOwnProperty('ACTIVE')) {
|
|
@@ -1619,12 +1622,6 @@ class BXRestUser {
|
|
|
1619
1622
|
delete params.UF_DEPARTMENT;
|
|
1620
1623
|
}
|
|
1621
1624
|
}
|
|
1622
|
-
getInfoAboutCustomFieldsBX() {
|
|
1623
|
-
return this.http.get(this.url.userfield.list).pipe(map(v => this.http.mapResult(v)));
|
|
1624
|
-
}
|
|
1625
|
-
itIsAdmin() {
|
|
1626
|
-
return this.http.get(this.url.admin).pipe(map(v => this.http.mapResult(v)));
|
|
1627
|
-
}
|
|
1628
1625
|
}
|
|
1629
1626
|
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 }, { token: i3.DatePipe }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1630
1627
|
BXRestUser.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUser, providedIn: 'root' });
|
|
@@ -1633,7 +1630,153 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
1633
1630
|
args: [{
|
|
1634
1631
|
providedIn: 'root'
|
|
1635
1632
|
}]
|
|
1636
|
-
}], ctorParameters: function () { return [{ type: HttpBXServices }, { type: SnackBarService }, { type: i1$2.Store }, { type: BitrixApiUserMapServices }, { type: i3.DatePipe }]; } });
|
|
1633
|
+
}], ctorParameters: function () { return [{ type: HttpBXServices }, { type: SnackBarService }, { type: i1$2.Store }, { type: BitrixApiUserMapServices }, { type: i3.DatePipe }]; } });
|
|
1634
|
+
class BXRestUserRes extends new Proxy(BXRestUser, {
|
|
1635
|
+
get(target, prop, receiver) {
|
|
1636
|
+
const res = Reflect.get(target, prop, receiver);
|
|
1637
|
+
if (res in Observable) {
|
|
1638
|
+
return Reflect.get(target, prop, receiver).pipe(
|
|
1639
|
+
// @ts-ignore
|
|
1640
|
+
map(v => mapResult(v)));
|
|
1641
|
+
}
|
|
1642
|
+
return res;
|
|
1643
|
+
}
|
|
1644
|
+
}) {
|
|
1645
|
+
}
|
|
1646
|
+
BXRestUserRes.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUserRes, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1647
|
+
BXRestUserRes.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUserRes, providedIn: 'root' });
|
|
1648
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestUserRes, decorators: [{
|
|
1649
|
+
type: Injectable,
|
|
1650
|
+
args: [{
|
|
1651
|
+
providedIn: 'root'
|
|
1652
|
+
}]
|
|
1653
|
+
}] });
|
|
1654
|
+
|
|
1655
|
+
class BXRestLists {
|
|
1656
|
+
constructor() {
|
|
1657
|
+
this.url = {
|
|
1658
|
+
add: [$lists, $add],
|
|
1659
|
+
delete: [$lists, $delete],
|
|
1660
|
+
get: [$lists, $get],
|
|
1661
|
+
update: [$lists, $update],
|
|
1662
|
+
getIblockTypeId: [$lists, $get, $iblock, $type, $id], // Метод возвращает id типа инфоблока
|
|
1663
|
+
};
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
BXRestLists.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestLists, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1667
|
+
BXRestLists.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestLists, providedIn: 'root' });
|
|
1668
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestLists, decorators: [{
|
|
1669
|
+
type: Injectable,
|
|
1670
|
+
args: [{
|
|
1671
|
+
providedIn: 'root'
|
|
1672
|
+
}]
|
|
1673
|
+
}] });
|
|
1674
|
+
class BXRestListsRes extends new Proxy(BXRestLists, {
|
|
1675
|
+
get(target, prop, receiver) {
|
|
1676
|
+
const res = Reflect.get(target, prop, receiver);
|
|
1677
|
+
if (res in Observable) {
|
|
1678
|
+
return Reflect.get(target, prop, receiver).pipe(
|
|
1679
|
+
// @ts-ignore
|
|
1680
|
+
map(v => mapResult(v)));
|
|
1681
|
+
}
|
|
1682
|
+
return res;
|
|
1683
|
+
}
|
|
1684
|
+
}) {
|
|
1685
|
+
}
|
|
1686
|
+
BXRestListsRes.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsRes, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1687
|
+
BXRestListsRes.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsRes, providedIn: 'root' });
|
|
1688
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsRes, decorators: [{
|
|
1689
|
+
type: Injectable,
|
|
1690
|
+
args: [{
|
|
1691
|
+
providedIn: 'root'
|
|
1692
|
+
}]
|
|
1693
|
+
}] });
|
|
1694
|
+
|
|
1695
|
+
class BaseMapServices extends BaseServices {
|
|
1696
|
+
}
|
|
1697
|
+
BaseMapServices.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseMapServices, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1698
|
+
BaseMapServices.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseMapServices, providedIn: 'root' });
|
|
1699
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseMapServices, decorators: [{
|
|
1700
|
+
type: Injectable,
|
|
1701
|
+
args: [{
|
|
1702
|
+
providedIn: 'root'
|
|
1703
|
+
}]
|
|
1704
|
+
}] });
|
|
1705
|
+
|
|
1706
|
+
class BXRestListsElementMap extends BaseMapServices {
|
|
1707
|
+
get(item) {
|
|
1708
|
+
return Object.assign(item, {
|
|
1709
|
+
BP_PUBLISHED: item.BP_PUBLISHED === 'Y',
|
|
1710
|
+
CREATED_BY: this.toNum(item.CREATED_BY),
|
|
1711
|
+
IBLOCK_ID: this.toNum(item.IBLOCK_ID),
|
|
1712
|
+
ID: this.toNum(item.ID)
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
BXRestListsElementMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElementMap, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1717
|
+
BXRestListsElementMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElementMap, providedIn: 'root' });
|
|
1718
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElementMap, decorators: [{
|
|
1719
|
+
type: Injectable,
|
|
1720
|
+
args: [{
|
|
1721
|
+
providedIn: 'root'
|
|
1722
|
+
}]
|
|
1723
|
+
}] });
|
|
1724
|
+
|
|
1725
|
+
class BXRestListsElementBase {
|
|
1726
|
+
constructor(http, mapResult) {
|
|
1727
|
+
this.http = http;
|
|
1728
|
+
this.mapResult = mapResult;
|
|
1729
|
+
this.url = {
|
|
1730
|
+
add: [$lists, $element, $add],
|
|
1731
|
+
delete: [$lists, $element, $delete],
|
|
1732
|
+
get: [$lists, $element, $get],
|
|
1733
|
+
update: [$lists, $element, $update],
|
|
1734
|
+
getFileUrl: [$lists, $element, $get, $file, $url] // Метод возвращает путь к файлу
|
|
1735
|
+
};
|
|
1736
|
+
}
|
|
1737
|
+
get(pram) {
|
|
1738
|
+
return this.http.post(this.url.get, pram)
|
|
1739
|
+
.pipe(map(v => (v && v.result)
|
|
1740
|
+
? Object.assign(v, { result: v.result.map(i => this.mapResult.get(i)) })
|
|
1741
|
+
: undefined));
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
BXRestListsElementBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElementBase, deps: [{ token: HttpBXServices }, { token: BXRestListsElementMap }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1745
|
+
BXRestListsElementBase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElementBase, providedIn: 'root' });
|
|
1746
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElementBase, decorators: [{
|
|
1747
|
+
type: Injectable,
|
|
1748
|
+
args: [{
|
|
1749
|
+
providedIn: 'root'
|
|
1750
|
+
}]
|
|
1751
|
+
}], ctorParameters: function () { return [{ type: HttpBXServices }, { type: BXRestListsElementMap }]; } });
|
|
1752
|
+
class BXRestListsElement extends new Proxy(BXRestListsElementBase, {
|
|
1753
|
+
get(target, prop, receiver) {
|
|
1754
|
+
const res = Reflect.get(target, prop, receiver);
|
|
1755
|
+
console.log('res', res);
|
|
1756
|
+
if (res in Observable) {
|
|
1757
|
+
let mapRes = new BXRestListsElementMap();
|
|
1758
|
+
console.log('res', res);
|
|
1759
|
+
return Reflect.get(target, prop, receiver).pipe(
|
|
1760
|
+
// @ts-ignore
|
|
1761
|
+
map(v => (v && v.result)
|
|
1762
|
+
// @ts-ignore
|
|
1763
|
+
? Object.assign(v, { result: v.result.map(i => mapRes.get(i)) })
|
|
1764
|
+
: undefined),
|
|
1765
|
+
// @ts-ignore
|
|
1766
|
+
map(v => mapResult(v)));
|
|
1767
|
+
}
|
|
1768
|
+
return res;
|
|
1769
|
+
}
|
|
1770
|
+
}) {
|
|
1771
|
+
}
|
|
1772
|
+
BXRestListsElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1773
|
+
BXRestListsElement.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, providedIn: 'root' });
|
|
1774
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BXRestListsElement, decorators: [{
|
|
1775
|
+
type: Injectable,
|
|
1776
|
+
args: [{
|
|
1777
|
+
providedIn: 'root'
|
|
1778
|
+
}]
|
|
1779
|
+
}] });
|
|
1637
1780
|
|
|
1638
1781
|
/*
|
|
1639
1782
|
* Public API Surface of bx-rest
|
|
@@ -1644,5 +1787,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
1644
1787
|
* Generated bundle index. Do not edit.
|
|
1645
1788
|
*/
|
|
1646
1789
|
|
|
1647
|
-
export { BXRestUser,
|
|
1790
|
+
export { BXRestListsElement, BXRestListsRes, BXRestUser, BXRestUserRes };
|
|
1648
1791
|
//# sourceMappingURL=bx-rest.mjs.map
|