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